@stnd/launcher 1.6.7 → 1.7.0
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/CHANGELOG.md +6 -0
- package/Launcher.svelte +4 -3
- package/README.md +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/Launcher.svelte
CHANGED
|
@@ -158,9 +158,10 @@
|
|
|
158
158
|
key: "Escape",
|
|
159
159
|
id: "launcher-escape",
|
|
160
160
|
action: () => {
|
|
161
|
-
//
|
|
162
|
-
//
|
|
163
|
-
window.
|
|
161
|
+
// A step back in the history is the default. An app can take the key instead: the
|
|
162
|
+
// event is cancelable, and cancelling it means the app has dealt with Esc.
|
|
163
|
+
const handled = !window.dispatchEvent(new CustomEvent("stnd:escape", { cancelable: true }));
|
|
164
|
+
if (!handled) window.history.back();
|
|
164
165
|
},
|
|
165
166
|
}),
|
|
166
167
|
];
|
package/README.md
CHANGED
|
@@ -165,6 +165,10 @@ Switch the active view.
|
|
|
165
165
|
- **view**: Trigger ID of the view.
|
|
166
166
|
- **props**: Data to pass to the view component.
|
|
167
167
|
|
|
168
|
+
## Keyboard: Esc
|
|
169
|
+
|
|
170
|
+
The launcher registers `Esc` with the keyboard module. By default it steps back in the history. Before doing so it dispatches a cancelable `stnd:escape` event on `window`: an app that wants Esc to lead somewhere else (its home page, its own panel) listens to it and calls `event.preventDefault()`, and the history is left alone. The àVélo app uses it to send Esc to its overview (`apps/ÀVélo-stat/modules/core/scripts/shortcuts.ts`).
|
|
171
|
+
|
|
168
172
|
## Data Attributes
|
|
169
173
|
|
|
170
174
|
The UI listens for clicks on elements with specific data attributes:
|