@rohal12/spindle 0.52.7 → 0.52.9
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 +26 -0
- package/dist/pkg/format.js +1 -1
- package/dist/pkg/headless.js +986 -854
- package/dist/pkg/macro-registry.json +18 -0
- package/package.json +1 -1
- package/src/action-registry.ts +9 -0
- package/src/class-registry.ts +1 -5
- package/src/components/Passage.tsx +35 -39
- package/src/components/PassageDialog.tsx +2 -2
- package/src/components/StoryInterface.tsx +2 -2
- package/src/components/macros/Checkbox.tsx +3 -8
- package/src/components/macros/Computed.tsx +1 -1
- package/src/components/macros/Cycle.tsx +3 -6
- package/src/components/macros/ExprDisplay.tsx +12 -29
- package/src/components/macros/If.tsx +35 -41
- package/src/components/macros/Include.tsx +2 -1
- package/src/components/macros/Listbox.tsx +5 -7
- package/src/components/macros/Print.tsx +3 -5
- package/src/components/macros/Radiobutton.tsx +3 -5
- package/src/components/macros/Repeat.tsx +2 -1
- package/src/components/macros/Switch.tsx +6 -13
- package/src/components/macros/Timed.tsx +14 -18
- package/src/components/macros/Type.tsx +2 -1
- package/src/components/macros/VarDisplay.tsx +12 -32
- package/src/components/macros/Widget.tsx +49 -20
- package/src/components/macros/branches.ts +18 -0
- package/src/components/macros/display.ts +19 -0
- package/src/components/macros/input-macro.ts +33 -11
- package/src/components/macros/macro-args.ts +7 -0
- package/src/components/macros/option-utils.ts +10 -7
- package/src/define-macro.ts +4 -6
- package/src/expression.ts +58 -40
- package/src/hooks/use-action.ts +7 -15
- package/src/index.tsx +5 -15
- package/src/interpolation.ts +34 -41
- package/src/markup/ast.ts +4 -3
- package/src/markup/render.tsx +121 -65
- package/src/parser.ts +119 -13
- package/src/registry.ts +13 -12
- package/src/saves/save-manager.ts +18 -13
- package/src/saves/storage.ts +19 -20
- package/src/story-api.ts +30 -73
- package/src/structural.ts +1 -18
- package/src/types-drift-check.ts +37 -50
- package/src/utils/macro-names.ts +40 -0
- package/src/utils/namespace.ts +17 -0
- package/src/widgets/widget-registry.ts +5 -4
package/README.md
CHANGED
|
@@ -67,8 +67,34 @@ bun run build # build format
|
|
|
67
67
|
bun run preview # build + compile dev story
|
|
68
68
|
bun run docs:dev # local docs dev server
|
|
69
69
|
bun run docs:build # build docs for deployment
|
|
70
|
+
bun run duplication # code duplication checks (CPD needs PMD_BIN)
|
|
70
71
|
```
|
|
71
72
|
|
|
73
|
+
### Code duplication
|
|
74
|
+
|
|
75
|
+
CI measures duplication in `src/` with three tools, each a separate check:
|
|
76
|
+
jscpd and PMD CPD (exact copies) and fallow (copies with renamed
|
|
77
|
+
identifiers). A pull request fails when it adds duplication compared with
|
|
78
|
+
`main` or exceeds `duplication-budget.json`. The settings are in
|
|
79
|
+
`.jscpd.json` and `.fallowrc.json`; `scripts/duplication.ts` runs the
|
|
80
|
+
checks and compares against a base (`--base main`). Locally, CPD needs
|
|
81
|
+
[PMD](https://pmd.github.io/) 7 with `PMD_BIN` set to its `bin/pmd`.
|
|
82
|
+
|
|
83
|
+
Before adding a helper, parser or hook, look for the one that already does
|
|
84
|
+
the job and extend it; most fixes then land in one place. The shared modules:
|
|
85
|
+
|
|
86
|
+
| Job | Module |
|
|
87
|
+
| -------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
88
|
+
| Name-keyed storage, own-key reads (`hasOwn`, `ownValue`) | `src/utils/namespace.ts` |
|
|
89
|
+
| Case-insensitive macro/widget names | `src/utils/macro-names.ts` |
|
|
90
|
+
| Clone, equality, structural diff and merge | `src/structural.ts` |
|
|
91
|
+
| Macro arguments: declared `parameters`, `ctx.args` | `src/components/macros/macro-args.ts` |
|
|
92
|
+
| Quoting, splitting, string scanning | `src/components/macros/arg-utils.ts` |
|
|
93
|
+
| JavaScript scanning (`findCodeEnd`, `lexJs`) | `src/js-lexer.ts` |
|
|
94
|
+
| Sigils and scopes (`SIGIL_SCOPES`, `SCOPE_SIGILS`) | `src/markup/tokenizer.ts` |
|
|
95
|
+
| Reading story state / render contexts in components | `src/hooks/use-story-fields.ts`, `src/hooks/use-render-options.ts` |
|
|
96
|
+
| Save storage operations | `src/saves/storage.ts` (`createBackend`) |
|
|
97
|
+
|
|
72
98
|
## License
|
|
73
99
|
|
|
74
100
|
This is free and unencumbered software released into the public domain. See [UNLICENSE](UNLICENSE).
|