@rohal12/spindle 0.59.32 → 0.60.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/README.md +20 -18
- package/dist/pkg/format.js +1 -1
- package/dist/pkg/headless.js +635 -98
- package/dist/pkg/story-variables.js +830 -54
- package/dist/pkg/tooling.js +1 -0
- package/package.json +4 -2
- package/src/action-registry.ts +84 -2
- package/src/automation/load-yaml.ts +10 -55
- package/src/automation/runner.ts +2 -14
- package/src/automation/types.ts +2 -8
- package/src/components/PassageDialog.tsx +8 -3
- package/src/components/dialog-close-context.ts +10 -0
- package/src/components/macros/Checkbox.tsx +2 -1
- package/src/components/macros/Cycle.tsx +2 -1
- package/src/components/macros/Listbox.tsx +2 -1
- package/src/components/macros/Radiobutton.tsx +3 -1
- package/src/components/macros/detached-body.tsx +19 -8
- package/src/components/macros/input-macro.ts +2 -1
- package/src/define-macro.ts +42 -16
- package/src/display-only.ts +30 -0
- package/src/format/format-passage.ts +626 -0
- package/src/format/placeholders.ts +316 -0
- package/src/format/prettier.ts +62 -0
- package/src/format/segment.ts +126 -0
- package/src/headless.ts +81 -1
- package/src/hooks/use-action.ts +31 -9
- package/src/index.tsx +16 -4
- package/src/js-lexer.ts +36 -6
- package/src/markup/code-end.ts +97 -41
- package/src/markup/parse.ts +6 -6
- package/src/observe/observable-text.ts +147 -0
- package/src/observe/observe.ts +160 -0
- package/src/store.ts +1 -0
- package/src/story-api.ts +21 -1
- package/src/story-context-passage.ts +132 -0
- package/src/tooling.ts +23 -1
- package/src/triggers.ts +32 -8
- package/src/twine-editor/builtin-macros.ts +11 -0
- package/src/twine-editor/commands.ts +173 -0
- package/src/twine-editor/highlight.ts +471 -0
- package/src/twine-editor/icons.ts +35 -0
- package/src/twine-editor/index.ts +19 -0
- package/src/twine-editor/mode.ts +137 -0
- package/src/twine-editor/references.ts +34 -0
- package/src/twine-editor/snippets.ts +74 -0
- package/src/twine-editor/toolbar.ts +85 -0
- package/src/types-drift-check.ts +12 -0
- package/src/utils/field-checks.ts +46 -0
- package/types/headless.d.ts +43 -2
- package/types/index.d.ts +71 -0
- package/types/tooling.d.ts +68 -0
package/README.md
CHANGED
|
@@ -59,6 +59,7 @@ Full docs at **[rohal12.github.io/spindle](https://rohal12.github.io/spindle/)**
|
|
|
59
59
|
- [Story API](https://rohal12.github.io/spindle/story-api) — The `window.Story` JavaScript API
|
|
60
60
|
- [Widgets](https://rohal12.github.io/spindle/widgets) — Reusable content blocks
|
|
61
61
|
- [npm Package](https://rohal12.github.io/spindle/story-format-packages) — Packaging guide
|
|
62
|
+
- [Twine Editor Extensions](https://rohal12.github.io/spindle/twine-editor) — Highlighting, references and a toolbar in Twine's passage editor
|
|
62
63
|
|
|
63
64
|
## Development
|
|
64
65
|
|
|
@@ -85,24 +86,25 @@ checks and compares against a base (`--base main`). Locally, CPD needs
|
|
|
85
86
|
Before adding a helper, parser or hook, look for the one that already does
|
|
86
87
|
the job and extend it; most fixes then land in one place. The shared modules:
|
|
87
88
|
|
|
88
|
-
| Job | Module
|
|
89
|
-
| -------------------------------------------------------- |
|
|
90
|
-
| Name-keyed storage, own-key reads (`hasOwn`, `ownValue`) | `src/utils/namespace.ts`
|
|
91
|
-
| Case-insensitive macro/widget names | `src/utils/macro-names.ts`
|
|
92
|
-
| Clone, equality, structural diff and merge | `src/structural.ts`
|
|
93
|
-
| Macro arguments: declared `parameters`, `ctx.args` | `src/components/macros/macro-args.ts`
|
|
94
|
-
| Quoting, splitting, string scanning | `src/components/macros/arg-utils.ts`
|
|
95
|
-
| JavaScript scanning (`findCodeEnd`, `lexJs`) | `src/js-lexer.ts`
|
|
96
|
-
| Which declaration a variable names (`Bindings`) | `src/js-bindings.ts`
|
|
97
|
-
| Sigils and scopes (`SIGIL_SCOPES`, `SCOPE_SIGILS`) | `src/markup/tokens.ts`
|
|
98
|
-
| Passage markup (`parseMarkup`, `tokenizeMarkup`) | `src/markup/parse.ts` (grammar: `src/markup/spindle.peggy`)
|
|
99
|
-
| Where code in `{…}` ends (`closeBrace`, `rawBodyEnd`) | `src/markup/code-end.ts`
|
|
100
|
-
| Which closer closes which opener (`pairMarkup`, the AST) | `src/markup/pair.ts` (`buildAst` in `src/markup/ast.ts`)
|
|
101
|
-
| Code, passage names and markup text in a passage | `src/code-check.ts` (`passagePiecesOf`)
|
|
102
|
-
| Declarations of `StoryVariables` (`parseDeclarations`) | `src/story-variables.ts` (literals: `src/static-literal.ts`)
|
|
103
|
-
| Reading story state / render contexts in components | `src/hooks/use-story-fields.ts`, `src/hooks/use-render-options.ts`
|
|
104
|
-
| Save storage operations | `src/saves/storage.ts` (`createBackend`)
|
|
105
|
-
| Listeners to notify (`createListeners`) | `src/utils/listeners.ts`
|
|
89
|
+
| Job | Module |
|
|
90
|
+
| -------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
91
|
+
| Name-keyed storage, own-key reads (`hasOwn`, `ownValue`) | `src/utils/namespace.ts` |
|
|
92
|
+
| Case-insensitive macro/widget names | `src/utils/macro-names.ts` |
|
|
93
|
+
| Clone, equality, structural diff and merge | `src/structural.ts` |
|
|
94
|
+
| Macro arguments: declared `parameters`, `ctx.args` | `src/components/macros/macro-args.ts` |
|
|
95
|
+
| Quoting, splitting, string scanning | `src/components/macros/arg-utils.ts` |
|
|
96
|
+
| JavaScript scanning (`findCodeEnd`, `lexJs`) | `src/js-lexer.ts` |
|
|
97
|
+
| Which declaration a variable names (`Bindings`) | `src/js-bindings.ts` |
|
|
98
|
+
| Sigils and scopes (`SIGIL_SCOPES`, `SCOPE_SIGILS`) | `src/markup/tokens.ts` |
|
|
99
|
+
| Passage markup (`parseMarkup`, `tokenizeMarkup`) | `src/markup/parse.ts` (grammar: `src/markup/spindle.peggy`) |
|
|
100
|
+
| Where code in `{…}` ends (`closeBrace`, `rawBodyEnd`) | `src/markup/code-end.ts` |
|
|
101
|
+
| Which closer closes which opener (`pairMarkup`, the AST) | `src/markup/pair.ts` (`buildAst` in `src/markup/ast.ts`) |
|
|
102
|
+
| Code, passage names and markup text in a passage | `src/code-check.ts` (`passagePiecesOf`) |
|
|
103
|
+
| Declarations of `StoryVariables` (`parseDeclarations`) | `src/story-variables.ts` (literals: `src/static-literal.ts`) |
|
|
104
|
+
| Reading story state / render contexts in components | `src/hooks/use-story-fields.ts`, `src/hooks/use-render-options.ts` |
|
|
105
|
+
| Save storage operations | `src/saves/storage.ts` (`createBackend`) |
|
|
106
|
+
| Listeners to notify (`createListeners`) | `src/utils/listeners.ts` |
|
|
107
|
+
| Checking plain data handed in (`checkObject`, matchers) | `src/utils/field-checks.ts` (`checkActionMatcher`: action registry) |
|
|
106
108
|
|
|
107
109
|
## License
|
|
108
110
|
|