@rohal12/spindle 0.52.9 → 0.54.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.
Files changed (50) hide show
  1. package/README.md +5 -1
  2. package/dist/pkg/format.js +1 -1
  3. package/dist/pkg/headless.js +6484 -2558
  4. package/dist/pkg/story-variables.js +4009 -940
  5. package/dist/pkg/tooling.js +13 -1
  6. package/package.json +6 -1
  7. package/src/class-registry.ts +252 -250
  8. package/src/components/App.tsx +2 -0
  9. package/src/components/Passage.tsx +3 -3
  10. package/src/components/PassageDialog.tsx +2 -4
  11. package/src/components/RuntimeErrors.tsx +46 -0
  12. package/src/components/StoryInterface.tsx +2 -4
  13. package/src/components/macros/Computed.tsx +5 -2
  14. package/src/components/macros/Do.tsx +4 -2
  15. package/src/components/macros/Goto.tsx +13 -3
  16. package/src/components/macros/Include.tsx +2 -3
  17. package/src/components/macros/MacroError.tsx +14 -7
  18. package/src/components/macros/SaveManager.tsx +2 -2
  19. package/src/components/macros/VarDisplay.tsx +1 -1
  20. package/src/components/macros/Widget.tsx +5 -33
  21. package/src/index.tsx +57 -37
  22. package/src/interpolation.ts +4 -5
  23. package/src/markup/ast.ts +11 -226
  24. package/src/markup/code-attributes.ts +3 -3
  25. package/src/markup/code-end.ts +121 -0
  26. package/src/markup/parse.ts +118 -0
  27. package/src/markup/render.tsx +1 -1
  28. package/src/markup/spindle.d.peggy.ts +24 -0
  29. package/src/markup/spindle.peggy +463 -0
  30. package/src/markup/tokens.ts +95 -0
  31. package/src/markup/validate.ts +219 -0
  32. package/src/parser.ts +19 -4
  33. package/src/runtime-errors.ts +65 -0
  34. package/src/saves/format.ts +199 -0
  35. package/src/saves/save-manager.ts +45 -63
  36. package/src/saves/types.ts +71 -88
  37. package/src/store.ts +167 -87
  38. package/src/story-init.ts +3 -5
  39. package/src/story-variables.ts +18 -4
  40. package/src/structural.ts +266 -57
  41. package/src/styles.css +45 -0
  42. package/src/tooling.ts +50 -0
  43. package/src/types-drift-check.ts +28 -1
  44. package/src/utils/object-path.ts +13 -12
  45. package/src/utils/stable-key.ts +2 -1
  46. package/src/utils/value-kinds.ts +45 -0
  47. package/src/widgets/widget-def.ts +60 -0
  48. package/types/index.d.ts +32 -8
  49. package/types/tooling.d.ts +42 -0
  50. package/src/markup/tokenizer.ts +0 -1112
package/README.md CHANGED
@@ -18,6 +18,8 @@ A modern [Twine 2](https://twinery.org/) story format built with [Preact](https:
18
18
  npm install @rohal12/spindle
19
19
  ```
20
20
 
21
+ The package (the compiler entry point, `@rohal12/spindle/tooling` and `@rohal12/spindle/headless`) needs Node.js 22.17 or later. Compiled stories run in current browsers.
22
+
21
23
  ## Features
22
24
 
23
25
  - Curly-brace macro syntax: `{if $health > 0}...{/if}`, `{set $name = "Hero"}`
@@ -91,7 +93,9 @@ the job and extend it; most fixes then land in one place. The shared modules:
91
93
  | Macro arguments: declared `parameters`, `ctx.args` | `src/components/macros/macro-args.ts` |
92
94
  | Quoting, splitting, string scanning | `src/components/macros/arg-utils.ts` |
93
95
  | JavaScript scanning (`findCodeEnd`, `lexJs`) | `src/js-lexer.ts` |
94
- | Sigils and scopes (`SIGIL_SCOPES`, `SCOPE_SIGILS`) | `src/markup/tokenizer.ts` |
96
+ | Sigils and scopes (`SIGIL_SCOPES`, `SCOPE_SIGILS`) | `src/markup/tokens.ts` |
97
+ | Passage markup (`parseMarkup`, `tokenizeMarkup`) | `src/markup/parse.ts` (grammar: `src/markup/spindle.peggy`) |
98
+ | Where code in `{…}` ends (`closeBrace`, `rawBodyEnd`) | `src/markup/code-end.ts` |
95
99
  | Reading story state / render contexts in components | `src/hooks/use-story-fields.ts`, `src/hooks/use-render-options.ts` |
96
100
  | Save storage operations | `src/saves/storage.ts` (`createBackend`) |
97
101