63 Commits
Author SHA1 Message Date
hyper ae36125af0 docs(skill): add rules-writing conventions
Add rules.md covering document structure, theme/players/time header, icon-first mentions, veteran-first prose, and a closing timestamp. Link it from SKILL.md.
2026-10-24 16:51:59 +08:00
hyper f9ea37427b docs(content): add inline spark-table example 2026-09-12 23:58:49 +08:00
hyper ebb49ddfca docs(todo): track variable store audit 2026-09-12 23:58:44 +08:00
hyper 322287da29 docs(reference): cover bare dice and tilde fences
Add the bare d-form (d20) to the dice notation table, and note that role fences accept backticks or tildes with hyphen-capable attribute keys. Regenerate both reference copies from known.ts and mirror the notes in the skill and markdown docs.
2026-09-12 23:56:12 +08:00
hyper 08bc97bec5 fix(markdown): accept tilde fences when scanning
Fenced block scanning was backtick-only in FENCED_BLOCK_RE (used by scanDoc) and in the yaml role=tag render extension, while stripFencedBlocks and the validator already accepted tildes. Match both marker styles and require the closing fence to reuse the opening marker.
2026-09-12 23:45:01 +08:00
hyper 264038e27c fix(markdown): keep hyphenated block attribute keys
The key pattern \w+ could not cross a hyphen, so data-config=foo was parsed as config=foo and the data- prefix was lost. Allow hyphens in keys, matching parseDirectiveAttrs.
2026-09-12 23:44:43 +08:00
hyper e838f9a4b1 fix(journal): tokenize bare dice notation
The tokenizer only recognized dice when the pattern started with a count (3d6), so a bare d20 fell through to the identifier branch and failed as an unknown identifier. Add a dedicated branch for the bare d-form; DICE_RE already accepted it.
2026-09-12 23:44:24 +08:00
hyper 3532be2335 fix(journal): re-publish only changed declarations
topoSortAffected followed declared dependencies even when they were not in the affected set, so reevaluateDependents re-evaluated and re-published variables that had not changed. This could also overwrite a value just set via /set with the declaration's own expression.
2026-09-12 23:44:06 +08:00
hyper f17f09a8c4 refactor(components): remove md-commander widget
The journal now owns command history and tracking, so retire the md-commander widget. Its dice engine was extracted to src/components/dice in the previous commit.

Removes the custom element, tracker/command stores, completions, useCommander, Emmet parser, the doc entry, test fixtures, and the known-element catalog entry (reference docs regenerated).

BREAKING CHANGE: :md-commander is no longer a known element; content using it now fails tttk check with TTTK-D001.
2026-09-12 23:29:26 +08:00
hyper 3508286792 refactor(dice): extract engine from md-commander
The dice engine lived under md-commander/hooks but is shared by :md-dice, spark tables, the journal /roll command, and dice inside variable expressions. Move it to src/components/dice so the md-commander widget can be retired without losing rolling.

Also promote the browser-console harness to a real jest suite; the file was named test.ts, so jest never ran it.
2026-09-12 23:14:28 +08:00
hyper 0b029b325e docs(declare): document the YAML declare format
Update the journal-set doc entry, the CLI diagnostic table, and the
authoring skill, along with the in-app empty-state hint and the var
message comment.
2026-09-12 22:51:12 +08:00
hyper 0ac9a833e4 docs(reference): regenerate declare block docs
Regenerate `docs/reference.md` and the skill copy from `known.ts`.
2026-09-12 22:51:00 +08:00
hyper fadfd4cba6 feat(declare)!: parse role=declare blocks as YAML
Replace the tag/threshold/key/expr CSV body with YAML `vars:` and
`tags:` maps. `parseDeclare` validates the body with an exported Zod
schema and returns the same declaration and modifier shapes the
reactivity engine already consumes.

The breaking rename from `parseDeclareCsv` updates the registry, the
journal re-exports, and the `tttk check` role checks, where R003 now
reports schema errors with their path and R004 warns when a block
declares nothing.
2026-09-12 22:50:48 +08:00
hyper 16f2038fd8 fix(journal): unify $var lookup and error
EvalContext.lookup now receives the full $var name, matching getCombined,
setBase, and getMods, and parseFactor throws "Unknown variable" when the
lookup returns undefined. /set and /roll use the new resolveVariable() so a
typo errors instead of silently evaluating to 0.

Declarations and tag modifiers stay lenient (unknown -> 0): the documented
$hp = $con*5+$mod_hp pattern depends on external/undeclared variables
defaulting to 0.
2026-09-12 22:34:12 +08:00
hyper 02442a1100 fix(journal): re-init reactivity and drop var del
Make the reactivity engine re-initialize when the loaded declarations
change instead of only at import. ensureReactivity() reads the live
completions signal, compares a signature, and rebuilds from the store
(with exact bases) only when needed; dispatchCommand calls it before each
dispatch. Remove the unused DispatchContext.declarations/tagModifiers
fields, which were mount-time snapshots and could not be trusted.

Build initReactivity's maps into locals and commit only after the
circular check passes, so a failed re-init leaves the previous engine
intact; clear inFlight on commit.

Drop the unreachable var "del" action from the schema, render, and
reducer.
2026-09-12 22:29:25 +08:00
hyper 9f372fa2b0 fix(journal): surface variable eval errors
Collect and report failed declarations, failed tag modifier expressions, and
circular dependencies instead of swallowing them. Diagnostics are deduped,
logged with key/expression context, cleared on re-init, and exposed through
useJournalCompletions and the VariableView warning banner. A bad declaration
no longer aborts the rest of a cascade.

Reject malformed numeric literals in the tokenizer so inputs like "1.2.3"
throw instead of being truncated by parseFloat.
2026-09-12 22:22:18 +08:00
hyper a26d53cbeb fix(journal): keep variable bases in the stream
The stream only carried combined values, so hydrating a session lost the raw base and rebuildReactivityFromStore re-applied tag modifiers on top of already-combined values (e.g. $hp 70 became 90).

Publish the raw base alongside the combined value on var messages, persist it in variableBases, and rebuild engine state from exact bases. Derive tag activations from base tagmaps so tagmap-valued modifier targets are not re-triggered on every rebuild.

Seed declared variables only after hydration and only for keys absent from the store, so persisted values are no longer clobbered on load and reloads stop appending duplicate var messages.
2026-09-12 21:59:45 +08:00
hyper 0ce91afc49 feat(journal): show spark roll dice and markdown
The spark message never displayed the dice, and its rollResult came from a
second, independent roll that could disagree with the row actually
selected.

rollSparkTable now reports the roll(s) it used, so the message can show
'header / notation -> roll' in the purple box and render each rolled value
as markdown (its own div) below it.
2026-09-12 20:43:03 +08:00
hyper c7f3b3425b fix(dev): proxy content registry to CLI server
Inline spark tables (role=spark-table) live in the content registry, but the
rsbuild dev proxy forwarded only /__COMPLETIONS.json and
/__CONTENT_INDEX.json. The registry fetch fell back to the SPA index.html,
so /roll resolved the inline CSV as HTML and csv-parse failed with an
invalid opening quote.

Load the registry before publishing the loaded completions state so a roll
cannot fire while inline content is still unresolvable.
2026-09-12 20:30:57 +08:00
hyper b5591f2a78 chore(cli): ignore .ttrpg session logs 2026-09-12 20:13:53 +08:00
hyper 2ed69d744a chore(dev): Add dev runner and split dev ports
Add dev:web (rsbuild) and dev:cli (tttk serve ./content), with dev
running both via scripts/dev.mjs, which shuts both down when either
exits. Also add tttk:inspect for --inspect debugging.

Both servers previously defaulted to port 3000, so the CLI could not
bind while the web dev server was running and the proxy targeted
itself. Pin the web dev server to 5173; the CLI keeps 3000 to match
the proxy. Document the two-process setup and inspector debugging in
docs/development.md.
2026-09-12 20:11:34 +08:00
hyper 53620e0a92 docs(doc-entries): Show examples as code blocks
Directive examples sat bare in the doc bodies, so rendering them as
markdown executed the directives: live components, missing-file
fetches, and style side effects on the dialog. Wrap each example in
a markdown fence, matching the convention already used by md-table.
2026-09-12 19:58:37 +08:00
hyper a752fdc2f4 fix(DocDialog): Render doc bodies as markdown
DocContent rendered the raw body in a whitespace-pre-wrap div, so
markdown syntax and fenced code blocks appeared literally. Parse
through the shared markdown pipeline and style with prose.

Wrap the content in an <article> so md-bg and md-border, which
resolve element.closest("article"), get a valid style target
instead of throwing.
2026-09-12 19:48:57 +08:00
hyper 49260ae4f6 fix(md-embed): proper font size/weight inheritence 2026-08-29 16:23:43 +08:00
hyper 18cad20d2c feat: add PLT double cut option to plotter export 2026-07-23 20:08:51 +08:00
hyper a5021ff5b4 style: reformat PltPreview and fix SVG rendering
- Reformat code to use double quotes and consistent indentation
- Improve SVG path styling for travel paths and borders
- Fix layout nesting and indentation in the component template
- Add missing circle element to card index labels
2026-05-18 22:19:48 +08:00
hyper 385bcb16d8 fix: dev server not showing pngs 2026-04-08 19:56:44 +08:00
hyper afe2eb4af8 fix: cli file change detection now includes csv/yarn 2026-04-08 19:43:32 +08:00
hyper b09560a4e5 refactor: allow chinese layer names 2026-04-07 19:33:08 +08:00
hyper 4d1c40ed3e refactor: add support for non-png icons 2026-04-06 18:31:08 +08:00
hyper 1eaef04215 fix: package-lock.json 2026-04-06 17:55:18 +08:00
hyper 25d95e6990 refactor: remove inline-schema 2026-04-06 17:47:33 +08:00
hyper 12c2473aeb refactor: swithc to npm link based dependency 2026-04-02 21:09:42 +08:00
hyper 18ea01b904 fix: plt/print preview window stacking 2026-03-31 17:28:46 +08:00
hyper 246d983ad2 chore: update inline-schema 2026-03-31 17:18:26 +08:00
hyper 14a692cd2c fix: inline-schema type file write 2026-03-31 16:20:42 +08:00
hyper 57b46fedc1 chore: skip content in builds 2026-03-31 15:42:19 +08:00
hyper eb1388c6bc refactor: add inline-schema 2026-03-31 15:40:06 +08:00
hyper 7b68504b1e feat: mcp server! 2026-03-17 22:49:47 +08:00
hyper 834db72ec4 feat: mcp server? 2026-03-17 20:01:04 +08:00
hyper b099d5695d refactor: move centering to 3mf gen 2026-03-17 12:49:49 +08:00
hyper c24c3b920d fix: url 2026-03-17 12:38:01 +08:00
hyper 352b17071c fix: cleanup 2026-03-17 12:19:15 +08:00
hyper c3f71f8be1 Merge branch 'master' of https://gitea.ayi-games.online/hypercross/ttrpg-tools 2026-03-17 12:10:43 +08:00
hyper 940caaf8e4 fix: display 2026-03-17 12:10:33 +08:00
hyper 2476659fc6 refactor: stl->3mf 2026-03-15 23:17:16 +08:00
hyper 7be206581d refactor: plotter code 2026-03-15 21:08:41 +08:00
hyper 0ed95291ba feat: plt export 2026-03-14 16:20:55 +08:00
hyper 85ec3b9928 feat: plotcutter 2026-03-14 16:17:46 +08:00
hyper 107e6fd6a2 feat: shape for cards 2026-03-14 15:48:55 +08:00
hyper 11e5db02ed fix: reactivity 2026-02-27 23:09:03 +08:00
hyper 5bc77a2291 feat: nsew layers 2026-02-27 23:01:09 +08:00
hyper c204dc695c fix: add bounds back 2026-02-27 22:39:23 +08:00
hyper 806747833e refactor: remove jspdf dewp 2026-02-27 22:18:16 +08:00
hyper da1e11fb74 fix: pdf backgorund 2026-02-27 21:42:48 +08:00
hyper 7e95c44d8d refactor: add fit prop to bg 2026-02-27 21:26:51 +08:00
hyper 72e376a6ad fix: empty img 2026-02-27 21:24:06 +08:00
hyper 95be758bcc feat: md-bg 2026-02-27 21:22:13 +08:00
hyper 3154830edd refactor: pdf clean up 2026-02-27 21:12:23 +08:00
hyper 47c15e933c feat: error handling 2026-02-27 21:02:33 +08:00
hyper 24c797abc6 fix 2026-02-27 20:54:28 +08:00
hyper 082007cf9b feat: {{prop}} in cards 2026-02-27 20:29:48 +08:00
hyper f32bbe59b3 feat: jsPDF 2026-02-27 20:27:26 +08:00