@jsenv/navi 0.29.140 → 0.29.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/jsenv_navi.js +266 -245
- package/dist/jsenv_navi.js.map +26 -32
- package/docs/popup_open.md +18 -5
- package/package.json +1 -1
package/docs/popup_open.md
CHANGED
|
@@ -97,11 +97,24 @@ This is the same entry point the attributes go through: same target resolution,
|
|
|
97
97
|
same command proxies, same events. The popup stays uncontrolled, and keeps its
|
|
98
98
|
say over closing.
|
|
99
99
|
|
|
100
|
-
`event` is
|
|
101
|
-
|
|
102
|
-
handle focus correctly (which element to give focus back to,
|
|
103
|
-
mousedown's click must be swallowed)
|
|
104
|
-
|
|
100
|
+
`event` is what caused the decision, and it is mandatory — triggering a command
|
|
101
|
+
without one throws. It is chained into the request event, and that chain is what
|
|
102
|
+
lets the popup handle focus correctly (which element to give focus back to,
|
|
103
|
+
whether a mousedown's click must be swallowed) and what the debug panel groups
|
|
104
|
+
the whole sequence under.
|
|
105
|
+
|
|
106
|
+
Almost always there is a DOM event to hand over, because almost always something
|
|
107
|
+
was done to the page. When there genuinely was not — a timer firing, an action
|
|
108
|
+
settling, a signal changing — say so with a `CustomEvent` named after what
|
|
109
|
+
happened rather than leaving the origin unsaid:
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
import { chainEvent, triggerNaviCommand } from "@jsenv/navi";
|
|
113
|
+
|
|
114
|
+
const expiredEvent = new CustomEvent("session_expired");
|
|
115
|
+
chainEvent(expiredEvent, causeEvent); // when something did precede it
|
|
116
|
+
triggerNaviCommand(dialogRef.current, "--navi-open", expiredEvent);
|
|
117
|
+
```
|
|
105
118
|
|
|
106
119
|
## Which element receives the command
|
|
107
120
|
|