narraleaf-react 0.41.1 → 0.41.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.
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One advance of an NVL line, decided and carried out.
|
|
3
|
+
*
|
|
4
|
+
* NVL differs from ADV in that the page owns the line: `requestNvlAdvance` is not a query but the
|
|
5
|
+
* move itself, and it settles a line that has finished revealing without the dialog hearing about
|
|
6
|
+
* it. Only when it answers `typing` is there anything left for this dialog to do - and what to do
|
|
7
|
+
* then is the same rule ADV follows, {@link resolveDialogAdvanceIntent}: an advance asks the line
|
|
8
|
+
* to complete, and only the skip mode forces.
|
|
9
|
+
*
|
|
10
|
+
* The skip key used to force here on every emission, tap included, which walked it past the pauses
|
|
11
|
+
* an author wrote. It is kept out of the hook so that a test can drive it against a real dialog
|
|
12
|
+
* state without a React tree.
|
|
13
|
+
*
|
|
14
|
+
* Comments in English per project convention.
|
|
15
|
+
*/
|
|
16
|
+
/** The page state, as this module needs it. */
|
|
17
|
+
export type NvlAdvancePage = {
|
|
18
|
+
requestNvlAdvance(dialogId: string): "ignore" | "typing" | "advance";
|
|
19
|
+
};
|
|
20
|
+
/** The part of a dialog state an advance touches. Structural, as in `dialogAdvanceIntent`. */
|
|
21
|
+
export type NvlAdvanceTarget = {
|
|
22
|
+
forceSkip(): void;
|
|
23
|
+
requestComplete(): void;
|
|
24
|
+
};
|
|
25
|
+
export type NvlAdvanceInput = {
|
|
26
|
+
dialogId: string;
|
|
27
|
+
/** Whether this dialog is the one holding the line. */
|
|
28
|
+
active: boolean;
|
|
29
|
+
/** Whether this is the skip mode rather than one advance. */
|
|
30
|
+
forced: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* What one advance of an NVL line ended up doing.
|
|
34
|
+
*
|
|
35
|
+
* - `ignore` - not this dialog's to answer.
|
|
36
|
+
* - `pageHandled` - the page moved on its own; there was nothing left to reveal.
|
|
37
|
+
* - `requestComplete` / `forceSkip` - what was asked of the line still revealing.
|
|
38
|
+
*/
|
|
39
|
+
export type NvlAdvanceResult = "ignore" | "pageHandled" | "requestComplete" | "forceSkip";
|
|
40
|
+
export declare function applyNvlAdvance(page: NvlAdvancePage, dialog: NvlAdvanceTarget, { dialogId, active, forced }: NvlAdvanceInput): NvlAdvanceResult;
|