From da4220bed4431a9bf77ecc28c546b42c3cc9672d Mon Sep 17 00:00:00 2001 From: PageHey Date: Tue, 5 Aug 2025 23:39:52 +0200 Subject: [PATCH] docs: update and improve docs --- CHANGELOG.md | 1 + docs/case-studies/use-stimulus-and-turbo.md | 2 +- docs/guides/control-popover.md | 8 +++++++- docs/html-elements.md | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dd9788..30c3ed9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * helper methods defined on `ApplicationController` are available in popover by default, and a configuration option is added to disable this behavior * all application helpers are included by default, and a configuration option is added to disable this behavior * empty popover params are not frozen anymore +- docs: update and improve docs ### v1.0.3 - fix commit f989786 that changed the wrong line (0b7832e) diff --git a/docs/case-studies/use-stimulus-and-turbo.md b/docs/case-studies/use-stimulus-and-turbo.md index 06ab6af..77e39cd 100644 --- a/docs/case-studies/use-stimulus-and-turbo.md +++ b/docs/case-studies/use-stimulus-and-turbo.md @@ -8,7 +8,7 @@ nav_order: 4 # {{ page.title }} If you are using both [Stimulus](https://stimulus.hotwired.dev/) and [Turbo](https://turbo.hotwired.dev/) from [Hotwired](https://hotwired.dev/), -here's a Stimulus controller I recommend setting up on your popover layouts to improve your developer experience and easily controller the popovers. +here's a Stimulus controller you can set up on your popover layouts to improve your developer experience and easily controller the popovers. This uses the [Stimulus dispatch API](https://stimulus.hotwired.dev/reference/controllers#cross-controller-coordination-with-events) and [Turbo events](https://turbo.hotwired.dev/reference/events). diff --git a/docs/guides/control-popover.md b/docs/guides/control-popover.md index 498ec19..f40c5a1 100644 --- a/docs/guides/control-popover.md +++ b/docs/guides/control-popover.md @@ -32,6 +32,12 @@ coupdoeilElement.openPopover() coupdoeilElement.closePopover() ``` +### Check state + +```js +coupdoeilElement.dataset.popoverOpen // 'true' if popover is open, else undefined +``` + ### disabling/enabling A `coup-doeil` element can be disabled so the popover won't open, regardless of the trigger option selected. @@ -69,4 +75,4 @@ popover.coupdoeilElement ## Using Stimulus and Turbo If you are using both [Stimulus](https://stimulus.hotwired.dev/) and [Turbo](https://turbo.hotwired.dev/) from [Hotwired](https://hotwired.dev/), -I recommend setting up a Stimulus controller on your popover layouts as depicted in [this example](/case-studies/using-stimulus-and-turbo.html). +you can set up a Stimulus controller on your popover layouts as depicted in [this example](/case-studies/using-stimulus-and-turbo.html). diff --git a/docs/html-elements.md b/docs/html-elements.md index a25be29..aaddeb1 100644 --- a/docs/html-elements.md +++ b/docs/html-elements.md @@ -55,4 +55,4 @@ and an inline style attribute to actually position it. ### Controlling the popover -If you need to control the popover, check the [Control or disable popover page](). +If you need to control the popover, check the [Control or disable popover page](/guides/control-popover.html). -- GitLab