feat: defineMacro context API, dialog extraction, and wiki-link desugaring#33
Merged
feat: defineMacro context API, dialog extraction, and wiki-link desugaring#33
Conversation
Introduce `defineMacro()` builder that eliminates boilerplate across all
36 macro components. Macros declare feature flags (interpolate, merged,
storeVar) and receive a pre-wired `ctx` object with always-on helpers
(h, renderNodes, hooks, cls, mutate, wrap, useAction) plus opt-in
capabilities (evaluate, resolve, value/setValue).
- New `src/define-macro.ts` with MacroContext/MacroDefinition types
- New `MacroError` shared component replaces 10+ duplicate error spans
- New `parseVarArgs()` utility deduplicates Textbox/Numberbox/Textarea
- All macros migrated to defineMacro() config pattern
- Public API: `Story.defineMacro()` for custom macros in {do} blocks
- Beginner-friendly custom-macros.md with step-by-step tutorials
release-npm
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The test expected #timed-output to contain "Second section!", but after the per-section class/id fix, that ID only applies to the first section. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use beforeAll to navigate once per describe block for tests that only read DOM state, eliminating ~160 redundant page loads. Side-effect tests (button clicks, form inputs, navigation) keep their own fresh navigation. Reduces e2e suite time from ~90s to ~27s. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract SaveLoadDialog/SettingsDialog into PassageDialog with SaveManager/SettingsControls/MenubarButtons. Migrate all macros to use defineMacro context pattern (ctx.h, ctx.hooks, ctx.renderNodes) instead of direct imports. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert LinkNode → MacroNode in buildAST so [[Go|Forest]] produces the
same AST as {link "Go" "Forest"}. Removes PassageLink component and
unifies CSS under .macro-link.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ctx.h,ctx.hooks,ctx.renderNodesinstead of direct Preact imports, enabling a cleaner public API[[Go|Forest]]now produces the same AST as{link "Go" "Forest"}at parse time, removing the PassageLink component and unifying CSS under.macro-linkBreaking changes
.passage-linkCSS class renamed to.macro-link— authors using custom CSS for wiki-links need to update selectorsTest plan
npx tsc --noEmitpassesrelease-npm
🤖 Generated with Claude Code