@rohal12/spindle 0.64.18 → 0.64.20
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/pkg/format.js +1 -1
- package/dist/pkg/headless.js +115 -19
- package/package.json +1 -1
- package/src/components/PassageDialog.tsx +38 -4
- package/src/components/StoryInterface.tsx +25 -1
- package/src/event-emitter.ts +5 -3
- package/src/index.tsx +3 -2
- package/src/store.ts +115 -10
- package/src/story-api.ts +2 -0
- package/src/story-init.ts +17 -12
- package/types/index.d.ts +24 -0
package/types/index.d.ts
CHANGED
|
@@ -168,6 +168,15 @@ export interface StoryEventMap {
|
|
|
168
168
|
* without one).
|
|
169
169
|
*/
|
|
170
170
|
dialogrender: (passage: string, element: HTMLElement) => void;
|
|
171
|
+
/**
|
|
172
|
+
* A dialog has closed, whichever way: fires once for each `dialogrender`,
|
|
173
|
+
* with the same `passage`, after the dialog is removed from the DOM (a
|
|
174
|
+
* passage transition may still show an inert copy of the outgoing passage,
|
|
175
|
+
* dialog included) and focus is back on the element that had it before the
|
|
176
|
+
* dialog opened. Not fired for dialogs still open when the page is closed
|
|
177
|
+
* or reloaded.
|
|
178
|
+
*/
|
|
179
|
+
dialogclose: (passage: string) => void;
|
|
171
180
|
}
|
|
172
181
|
|
|
173
182
|
/** Event name that can be passed to `Story.on()`. */
|
|
@@ -742,6 +751,21 @@ export interface StoryAPI {
|
|
|
742
751
|
/** Go forward one step in history. Throws like `goto()`. */
|
|
743
752
|
forward(): void;
|
|
744
753
|
|
|
754
|
+
/**
|
|
755
|
+
* Record the story variables as they are now as the state of the current
|
|
756
|
+
* moment, without navigating. From then on a page refresh, a save made on
|
|
757
|
+
* this passage and loaded, and moving back to this moment restore them,
|
|
758
|
+
* not the state on entering the passage. Use it for a change the player
|
|
759
|
+
* makes on a passage without leaving it (in a dialog, say).
|
|
760
|
+
*
|
|
761
|
+
* Writes the session, and throws like `goto()` once the moment is
|
|
762
|
+
* recorded. If the player had gone back, the moments after the current
|
|
763
|
+
* one are dropped. No events fire, the passage is not rendered again and
|
|
764
|
+
* the moment keeps the PRNG state it was entered with. Does nothing when
|
|
765
|
+
* the variables are as recorded already.
|
|
766
|
+
*/
|
|
767
|
+
recordMoment(): void;
|
|
768
|
+
|
|
745
769
|
/** Restart the story from the beginning. */
|
|
746
770
|
restart(): void;
|
|
747
771
|
|