narraleaf-react 0.39.2 → 0.40.1

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.
@@ -0,0 +1,52 @@
1
+ /**
2
+ * What a click that landed on the stage is asking for.
3
+ *
4
+ * The stage announcer decides *whether* a click belongs to the stage at all - it is over the player,
5
+ * it is not inside a menu, a notification, a page or a word that takes its own clicks. This decides
6
+ * what the ones that survive that walk actually mean, and it is kept apart from the walk because the
7
+ * walk is DOM and this is not: the rules below are the ones worth pinning, and pinning them needs no
8
+ * document.
9
+ *
10
+ * Comments in English per project convention.
11
+ */
12
+ /**
13
+ * The three things a click on the stage can mean.
14
+ *
15
+ * - `advance` - settle the line, the ordinary case.
16
+ * - `restoreDialog` - bring the dialog box back, because it has been put away.
17
+ * - `ignore` - the click reached nothing that wants it.
18
+ */
19
+ export type StageClickIntent = "advance" | "restoreDialog" | "ignore";
20
+ export type StageClickInput = {
21
+ /**
22
+ * Whether the announcer's DOM walk decided this click belongs to the stage rather than to
23
+ * something drawn on it.
24
+ */
25
+ onStage: boolean;
26
+ /**
27
+ * The `showDialog` preference: `false` means the player has put the box away to look at the
28
+ * picture behind it.
29
+ */
30
+ dialogShown: boolean;
31
+ /** Whether anything is currently holding the line - see `GameState.suspendAdvance`. */
32
+ advanceSuspended: boolean;
33
+ };
34
+ /**
35
+ * Decide what one click on the stage means.
36
+ *
37
+ * Two rules, in the order they are asked:
38
+ *
39
+ * - **A click with the box put away brings it back; it does not spend a line.** The box is the thing
40
+ * a click on the stage acts on, so with the box gone there is nothing on screen the click could
41
+ * have been aimed at - and the line it would have settled is one the player never saw. Every
42
+ * visual novel treats the next click after a hide as the one that undoes the hide, which is also
43
+ * the only reading that cannot lose text.
44
+ * - **That outranks a hold on the line.** A suspension is a hold on *advancing*, taken by something
45
+ * drawn over a line that wants the player's attention first - a definition popup on an inline
46
+ * word. Everything that takes one is drawn inside the box, so while the box is away the hold is
47
+ * invisible; leaving it in charge would mean a player who put the box away had no way to bring it
48
+ * back and no way to reach the thing holding the line either. Restoring the box does not settle
49
+ * the line, so it takes nothing away from whatever holds it: the hold is still there, and still
50
+ * in charge, the moment the box is back.
51
+ */
52
+ export declare function resolveStageClickIntent({ onStage, dialogShown, advanceSuspended, }: StageClickInput): StageClickIntent;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * How a dialog box that has been put away is hidden.
3
+ *
4
+ * Hiding the box is how a player looks at the picture behind it; it is not the box going away. The
5
+ * box keeps its line, its typing task, its animations and - the part this file exists for - its
6
+ * place in hit testing, because whatever a game has drawn inside the box is still a thing the player
7
+ * can be reaching for. The engine's own UI has nothing in there, but a host that renders its own
8
+ * dialog into this box does, and that content is the only route it has to the pointer.
9
+ *
10
+ * Comments in English per project convention.
11
+ */
12
+ export type DialogVisibility = {
13
+ /** The class the box carries while in this state, or an empty string for none. */
14
+ className: string;
15
+ /** Whether the box should be hidden from assistive technology. */
16
+ ariaHidden: boolean;
17
+ };
18
+ /**
19
+ * Decide how a box in the given `showDialog` state is presented.
20
+ *
21
+ * **Not `visibility: hidden`, and not `display: none`.** Both take the whole subtree out of hit
22
+ * testing, which is a different statement from "do not draw this": with either of them the box is
23
+ * not merely invisible, it is unreachable, and so is everything a host has rendered inside it. The
24
+ * box used to be hidden that way while also asking for `pointer-events: auto` on the same element -
25
+ * two instructions that cannot both be followed, and the one that lost is the one that was meant.
26
+ * What it cost: a panel inside the box could not be scrolled, tapped or dismissed while the box was
27
+ * away, and nothing said why, because the elements were all still there and all still styled to
28
+ * receive the pointer.
29
+ *
30
+ * Transparency says only "do not draw this", which is what hiding the box means. It costs a stacking
31
+ * context, which this element already has wherever the stage is scaled to fit, and it leaves the box
32
+ * in the accessibility tree - so a hidden box is marked `aria-hidden` here rather than relying on a
33
+ * side effect of how it is drawn.
34
+ *
35
+ * **No `pointer-events` of its own, in either state.** Whether a box is reachable at all is its
36
+ * layer's to say, not the box's: a scene parked behind a returnable jump keeps a layer that covers
37
+ * the stage with nothing in it, and that layer turns the pointer off for everything inside it. A box
38
+ * asserting `pointer-events: auto` would overrule that and go back to swallowing the clicks meant
39
+ * for the scene in front of it. The old hidden state did assert it, which was harmless only because
40
+ * it was paired with a rule that removed the box from hit testing anyway.
41
+ */
42
+ export declare function resolveDialogVisibility(shown: boolean): DialogVisibility;