contour-deck 0.3.1 → 0.3.2
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/README.md +2 -2
- package/dist/core/deck.js +11 -2
- package/dist/remote/presenter.js +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ deck.prev();
|
|
|
116
116
|
deck.open("4.2"); // put a block on the stage
|
|
117
117
|
deck.go("4.4.2"); // or deck.go("slide-id")
|
|
118
118
|
deck.overview(); // back to the outline
|
|
119
|
-
deck.slideBy(1); // the next slide, as the right arrow key; -1 for the one before
|
|
119
|
+
deck.slideBy(1); // the next slide, as the right arrow key once the page's steps are shown; -1 for the one before
|
|
120
120
|
deck.pageBy(1); // one stop down inside the slide, as the down arrow key
|
|
121
121
|
deck.state; // { mode, block, slide, page, step }; ordinals are 1-based
|
|
122
122
|
deck.on("change", ({ mode, at, step }) => {});
|
|
@@ -201,7 +201,7 @@ The phone must be able to open the page's URL, so a deck on `localhost` needs a
|
|
|
201
201
|
| --- | --- | --- |
|
|
202
202
|
| `Space`, `Enter`, `PageDown` | advance one step | open the current slide |
|
|
203
203
|
| `Shift+Space`, `PageUp`, `Backspace` | back one step | |
|
|
204
|
-
| `←` `→` |
|
|
204
|
+
| `←` `→` | hide or show the current page's steps first, then the previous or next slide | move between thumbnails |
|
|
205
205
|
| `↑` `↓` | previous, next stop | move between thumbnails |
|
|
206
206
|
| `Home`, `End` | first, last slide of the block | |
|
|
207
207
|
| `N` | notes panel | |
|
package/dist/core/deck.js
CHANGED
|
@@ -302,6 +302,15 @@ export function createDeck(root, options = {}) {
|
|
|
302
302
|
slide.el.scrollBy({ top: below + 32, behavior: smooth() });
|
|
303
303
|
render();
|
|
304
304
|
}
|
|
305
|
+
/** The arrow keys: reveal or hide the current page's steps first, then move to the next or previous slide. */
|
|
306
|
+
function stepOrSlide(direction) {
|
|
307
|
+
readScroll();
|
|
308
|
+
const steps = pageAt().steps;
|
|
309
|
+
const pending = direction > 0 ? steps.some(item => !item.hasAttribute(ON)) : steps.some(item => item.hasAttribute(ON));
|
|
310
|
+
if (pending)
|
|
311
|
+
return direction > 0 ? next() : prev();
|
|
312
|
+
slideBy(direction);
|
|
313
|
+
}
|
|
305
314
|
function prev() {
|
|
306
315
|
if (busy || mode !== "stage")
|
|
307
316
|
return;
|
|
@@ -509,8 +518,8 @@ export function createDeck(root, options = {}) {
|
|
|
509
518
|
PageDown: next,
|
|
510
519
|
PageUp: prev,
|
|
511
520
|
Backspace: prev,
|
|
512
|
-
ArrowRight: () =>
|
|
513
|
-
ArrowLeft: () =>
|
|
521
|
+
ArrowRight: () => stepOrSlide(1),
|
|
522
|
+
ArrowLeft: () => stepOrSlide(-1),
|
|
514
523
|
ArrowDown: () => stepV(1),
|
|
515
524
|
ArrowUp: () => stepV(-1),
|
|
516
525
|
Escape: toOverview,
|
package/dist/remote/presenter.js
CHANGED
|
@@ -24,6 +24,16 @@ const KEYS = {
|
|
|
24
24
|
Escape: "overview",
|
|
25
25
|
o: "overview",
|
|
26
26
|
};
|
|
27
|
+
/** The arrow keys reveal or hide the current page's steps before they move to another slide, as on the deck. */
|
|
28
|
+
function arrowStep(key, state) {
|
|
29
|
+
if (!state || state.mode !== "stage")
|
|
30
|
+
return undefined;
|
|
31
|
+
if (key === "ArrowRight" && state.step < state.steps)
|
|
32
|
+
return "next";
|
|
33
|
+
if (key === "ArrowLeft" && state.step > 0)
|
|
34
|
+
return "prev";
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
27
37
|
export function presenterView(root, options = {}) {
|
|
28
38
|
injectStyle(options.nonce);
|
|
29
39
|
const labels = { ...defaultRemoteLabels, ...options.labels };
|
|
@@ -94,7 +104,7 @@ export function presenterView(root, options = {}) {
|
|
|
94
104
|
const onButton = !!event.target.closest?.("button,a");
|
|
95
105
|
if (onButton && (key === " " || key === "Enter"))
|
|
96
106
|
return;
|
|
97
|
-
const command = key === " " && event.shiftKey ? "prev" : KEYS[key];
|
|
107
|
+
const command = key === " " && event.shiftKey ? "prev" : arrowStep(key, guest.state) ?? KEYS[key];
|
|
98
108
|
if (!command)
|
|
99
109
|
return;
|
|
100
110
|
event.preventDefault();
|