concept-atlas-dense-explain 4.1.0 → 4.1.2

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 CHANGED
@@ -12,7 +12,7 @@ Two page shells share one component library:
12
12
  ## CLI
13
13
 
14
14
  ```bash
15
- # Learn the components from a real, compilable reference
15
+ # Optional: learn from a compilable reference; also overwrites assets/ beside the output
16
16
  npx concept-atlas-dense-explain guide --mode atlas -o atlas-guide.mdx
17
17
  npx concept-atlas-dense-explain guide --mode scroll -o scroll-guide.mdx
18
18
 
@@ -26,24 +26,27 @@ npx concept-atlas-dense-explain validate topic.mdx --mode atlas
26
26
  npx concept-atlas-dense-explain topic.mdx --mode atlas
27
27
  ```
28
28
 
29
- Existing outputs are overwritten; `--force` is accepted for compatibility and is
30
- a no-op. `--mode` defaults to `scroll`. Use `-o` to choose the output path (a
31
- directory when passing several inputs). Validation errors abort the build; `--no-validate` forces a knowingly
32
- broken build.
33
-
34
- Mermaid-syntax diagrams are rendered by Pele, which ships inline: a page with
35
- `<Mermaid>` is a fully offline single file with no CDN call, and a document
36
- without `<Mermaid>` drops the renderer entirely. Appearance defaults can be
37
- baked with `--skin`, `--default-mode` and `--style`; readers can still switch in
38
- the UI. Local figures link by default (small HTML, ship `assets/` beside the
39
- output); `--inline-assets` bakes them in as base64 for a self-contained file,
40
- and a per-figure `inline={true|false}` overrides that choice.
29
+ Existing outputs are overwritten, and `guide` also overwrites `assets/` beside
30
+ its output. `--force` is accepted for compatibility and is a no-op. `create` and
31
+ `guide` default to `scroll`; validation and builds detect the MDX shell when
32
+ `--mode` is omitted. Use `-o` to choose the output path (a directory when passing
33
+ several inputs). Validation errors abort the build; `--no-validate` forces a
34
+ knowingly broken build.
35
+
36
+ Mermaid-syntax diagrams are rendered by Pele, which ships inline: diagrams need
37
+ no chart CDN, and a document without `<Mermaid>` drops the renderer entirely.
38
+ Fonts may still load from Google Fonts and fall back to system fonts offline.
39
+ Appearance defaults can be baked with `--skin`, `--default-mode` and `--style`;
40
+ readers can still switch in the UI. Local figures link by default (small HTML,
41
+ ship `assets/` beside the output); `--inline-assets` bakes them in as base64 for
42
+ a self-contained file, and a per-figure `inline={true|false}` overrides that choice.
41
43
 
42
44
  Run `npx concept-atlas-dense-explain help` for the full flag list.
43
45
 
44
46
  ## Links
45
47
 
46
48
  - Repository: https://github.com/wurenrumian/concept-atlas
49
+ - Documentation index: [`docs/README.md`](https://github.com/wurenrumian/concept-atlas/blob/master/docs/README.md)
47
50
  - Framework guide: [`docs/FRAMEWORK.md`](https://github.com/wurenrumian/concept-atlas/blob/master/docs/FRAMEWORK.md)
48
51
  - Usage recipes: [`docs/USAGE.md`](https://github.com/wurenrumian/concept-atlas/blob/master/docs/USAGE.md)
49
52
 
package/bin/cli.mjs CHANGED
@@ -45,7 +45,7 @@ function usage() {
45
45
  console.log(' npx concept-atlas-dense-explain guide [--mode atlas|scroll] [-o output.mdx]');
46
46
  console.log('');
47
47
  console.log(
48
- ' --mode defaults to scroll. Existing outputs are overwritten; --force is accepted for compatibility and is a no-op.'
48
+ ' create/guide default to scroll; validate/build detect the MDX shell when --mode is omitted. Existing outputs are overwritten; guide also overwrites assets/ beside its output. --force is a compatibility no-op.'
49
49
  );
50
50
  console.log(' --help shows this text; --version prints the package version.');
51
51
  console.log(
@@ -55,7 +55,7 @@ function usage() {
55
55
  ' Figures are kept as relative links by default (small HTML; ship the assets/ dir beside it). --inline-assets bakes every local image into the HTML as base64 instead; a per-tag inline={true|false} on <Figure> overrides that for one image. --link-assets is kept as an explicit alias for the default.'
56
56
  );
57
57
  console.log(
58
- ' Mermaid-syntax diagrams (<Mermaid>) are rendered by Pele and ship inline, so every page is a fully offline single file. A document without <Mermaid> drops the renderer entirely.'
58
+ ' Mermaid-syntax diagrams (<Mermaid>) are rendered by Pele and ship inline, so diagrams need no chart CDN. A document without <Mermaid> drops the renderer entirely. Fonts may load remotely and local images stay linked unless inlined.'
59
59
  );
60
60
  console.log(
61
61
  ` --skin bakes a default palette (${SKINS.map(skin => skin.id).join(', ')}); --default-mode bakes a default dark/light mode; --style bakes a default component style (${COMPONENT_STYLES.map(style => style.id).join(', ')}). Readers can still switch in the UI.`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "concept-atlas-dense-explain",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "description": "Portable dense-explanation skill and MDX concept atlas template",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,74 +1,74 @@
1
1
  ---
2
2
  name: concept-atlas-dense-explain
3
- description: Turn a topic or existing document into an interactive Concept Atlas explainer — AI-editable MDX compiled to standalone HTML with concept nodes, relation graphs, math, charts, figures, citations, and reading aids. Use for technical explanations, concept maps, layered knowledge pages, dense explainers, or interactive teaching pages; also 概念图 / 知识地图 / 分层讲解.
3
+ description: Build a dense, interactive Concept Atlas page from a topic or source document — semantic MDX compiled to standalone HTML, with concept graphs, math, charts, figures, and citations. Use it when someone wants material turned into an interactive HTML/MDX explainer, tutorial, technical deep-dive, report, concept/knowledge map, or teaching page, including "turn this doc into a page" or "explain this properly as a page"; also 讲解 / 深度长文 / 教程 / 技术文档 / 报告 / 概念图 / 知识地图 / 分层讲解. Not for a short chat answer, summary-only work, a slide deck, or a Word/PDF-only deliverable.
4
4
  ---
5
5
 
6
6
  # Concept Atlas Dense Explain
7
7
 
8
- Drive everything through the `concept-atlas-dense-explain` CLI, always via `npx`. Everything you need is in this file and the bundled `references/`; do not read the framework repository or installed package files, do not copy implementation files from the skill directory, and do not recreate the React/Vite app. If a command name is unclear, run `npx concept-atlas-dense-explain help`. If the user only wants the prompt/methodology and not files, still choose a shell and emit valid MDX; the CLI is needed only to validate and compile.
8
+ Turn a topic or source document into semantic MDX and compile it with the `concept-atlas-dense-explain` CLI. Everything needed is in this file and the bundled `references/`; do not read the framework repository or installed package files, copy implementation files from the skill directory, or recreate the React/Vite app.
9
9
 
10
- ## Running the CLI
10
+ If the user only wants the methodology or MDX text, still choose one shell and emit valid MDX. CLI validation and compilation are needed only when producing files.
11
11
 
12
- Always invoke the CLI through `npx`, from any directory:
12
+ ## Operating rules
13
13
 
14
- ```bash
15
- npx concept-atlas-dense-explain <args>
16
- ```
17
-
18
- This is the only runner — there is nothing to look for. Do not search for a local binary, a repository checkout, or an installed copy, and do not run the framework's own `npm` scripts. The first call downloads the package from the npm registry; say so once, then continue.
14
+ - Use the CLI only through `npx`. Do not search for another runner or run the framework repository's own scripts.
15
+ - Use exactly one page shell per file. Keep MDX semantic: no CSS, SVG, custom React, or invented component APIs. Use free-position coordinates only when the user explicitly asks for manual layout.
16
+ - Preserve source claims, citations, counterexamples, and uncertainty. Never invent evidence, measurements, references, or examples to make a page look complete.
17
+ - Protect user files. `create`, `guide`, and compiled outputs overwrite their targets; `guide` also overwrites `assets/` beside its output. Choose a new path or ask before overwriting existing work.
18
+ - Load references by task instead of reading everything: component API, authoring, CLI details, and diagnostics are separate files.
19
19
 
20
20
  ## Workflow
21
21
 
22
- 1. Choose one page shell: `atlas` (concept graph with node navigation) or `scroll` (continuous document). Recommend `atlas` when the reader drills into concepts or follows relations, `scroll` for linear argument, tutorials, and reports. The library is shared. If an `.mdx` already exists, detect its shell and work with it.
23
- 2. **Learn the components before authoring.** `references/components.md` is the catalogue — search it by component name for props and shapes rather than guessing. `references/atlas-guide.mdx` (atlas) or `references/scroll-guide.mdx` (scroll) is real, compilable MDX showing how that shell's components compose into a page. Do not look for component documentation anywhere else, and do not run `guide` for this.
24
- Run `npx concept-atlas-dense-explain guide --mode <mode> -o <file>` only when you specifically need a project-local copy to compile beside the page, and delete that copy when done.
25
- 3. Start from a skeleton when useful: `npx concept-atlas-dense-explain create <file>.mdx --mode atlas|scroll` (`--mode` defaults to `scroll`). `create` and `guide` overwrite their output, so never point them at a file you want to keep.
26
- 4. Write the semantic MDX into the user's `.mdx` file (see Authoring rules).
27
- 5. Validate before rendering:
22
+ 1. **Establish the deliverable.** Identify the source material, audience, desired output path, and whether the user wants MDX only or compiled HTML. Ask only when a choice is ambiguous or would overwrite user work.
23
+ 2. **Choose the shell.** Use the decision table below. If an `.mdx` file already exists, detect its shell and keep it unless conversion is requested.
24
+ 3. **Learn the API before writing tags.** Read `references/components.md` and search it by component name. Unknown props are silently ignored, so do not guess. Use the matching bundled guide as a compilable example: `references/atlas-guide.mdx` or `references/scroll-guide.mdx`.
25
+ 4. **Draft the semantic MDX.** Start from `create` when useful, then apply the authoring contract below. Read `references/authoring.md` for document conversion, source-to-component mapping, density checks, and stopping conditions.
26
+ 5. **Validate before rendering.**
28
27
  ```bash
29
28
  npx concept-atlas-dense-explain validate <file>.mdx --mode atlas|scroll
30
- npx concept-atlas-dense-explain validate <file>.mdx --json
29
+ npx concept-atlas-dense-explain validate <file>.mdx --mode atlas|scroll --json
31
30
  ```
32
- Diagnostics are `CODE line:column message`. Fix all `error`s and re-run; address warnings when cheap.
33
- 6. Compile: `npx concept-atlas-dense-explain <file>.mdx --mode atlas|scroll [-o out.html] [--skin <id>] [--default-mode dark|light|system] [--style <id>]`. Output is a standalone HTML beside the MDX unless `-o` is given. Validation errors abort the build (`--no-validate` forces a knowingly broken build). `<Mermaid>` charts are rendered by Pele and inline into the HTML, so the page is a fully offline single file with no CDN call — no flag needed.
34
- 7. **Appearance (optional)**: pages ship a reader-facing appearance menu — palette (`aurora` indigo, `ember` gold, `verdant` forest, `sakura` pink-plum, `noir` ink), a dark/light toggle, and a component style pack (`manuscript` editorial marginalia, `classic` boxed cards, `shadcn` hairline-bordered minimal UI, `elastic` bordered observability panels). The shipped default is aurora × manuscript × light; choices persist in localStorage across both carriers. Bake different compile-time defaults with `--skin ember --default-mode dark --style classic` (or `CONCEPT_ATLAS_SKIN` / `CONCEPT_ATLAS_DEFAULT_MODE` / `CONCEPT_ATLAS_STYLE` on the repo build); `--default-mode` honors `dark`/`light` and resolves `system` to the carrier default (`light`). Bake a default only when the user asks for one — content MDX never sets appearance.
35
- 8. For several documents, pass them all in one call: `npx concept-atlas-dense-explain a.mdx b.mdx c.mdx -o dist [--concurrency 3]` (`-o` is then a directory; everything validates first, then builds in parallel). Builds bundle only the renderers the content uses: no `<Math>` skips KaTeX's ~1.4MB inlined fonts, and no `<Mermaid>` drops Pele entirely. Never add dummy `<Math>`/`<Mermaid>` nodes to "enable" them.
36
- 9. Report the shell, output path, validation result (errors/warnings), and limitations. Do not claim interactions you did not verify.
37
-
38
- ## Carriers
39
-
40
- - `atlas`: `ExplainPage` → `ConceptGraph` → `ConceptNode`, plus `Children`/`ConceptRef` and cross-branch `Relation`s. Exactly one `L0` root, several `L1` branches, depth to `L3`/`L4`. Shared components live inside nodes. `ConceptNode` also takes an optional `kind` (see Authoring rules) that labels a node's knowledge role independently of its level.
41
- - `scroll`: `ScrollDocument` → `ScrollHeader` + `ScrollSection` (+ `ScrollProse`, `ScrollGrid`). Shared components live inside sections. The shell auto-builds a table of contents and reading progress from section titles — do not hand-build navigation.
42
- - The browser tab comes from the shell, not the build flags: `ExplainPage title` (atlas) or `ScrollHeader title` (scroll) becomes the `<title>`, so give it a real, specific name — never a placeholder like "主题名称". Every page uses a fixed 📃 favicon.
43
- - Never make one MDX file both shells. When switching shells, convert only the outer structure.
31
+ Fix every error and re-run. Address warnings when cheap; use `--strict` when the user wants a clean structural contract. See `references/diagnostics.md` for causes and fixes.
32
+ 6. **Compile.** Read `references/cli.md` for output, appearance, batching, and asset flags.
33
+ ```bash
34
+ npx concept-atlas-dense-explain <file>.mdx --mode atlas|scroll [-o out.html]
35
+ ```
36
+ Validation errors block the build. Use `--no-validate` only with an explicit reason.
37
+ 7. **Verify the result.** Confirm the HTML exists. When a browser tool is available, open it and check the title, shell navigation, and every diagram, chart, figure, tab, or citation you added. Fix blank widgets or broken interactions; otherwise state what remains unverified.
38
+ 8. **Report the outcome.** Name the shell, MDX and HTML paths, validation result, restructured/merged/dropped source material, and limitations that actually apply. Diagrams need no chart CDN, but fonts may load remotely and local images remain linked unless inlined. Do not claim interactions you did not verify.
44
39
 
45
- ## Component and prop reference
40
+ ## Shell decision
46
41
 
47
- The component catalogue, every prop shape, and the syntax traps are in `references/components.md`. Read it before authoring, and search it by component name whenever a tag is new to this page — prop names and shapes are not guessable. Charts, the learning loop, provenance, data/behaviour and structure components are documented there in full; only the rules that must hold on every page are repeated below.
42
+ | Reader task | Shell | Structure |
43
+ | --- | --- | --- |
44
+ | Explore concepts, compare branches, follow relations | `atlas` | `ExplainPage` → `ConceptGraph` → `ConceptNode`, with `Children` / `ConceptRef` and cross-branch `Relation` |
45
+ | Read an argument, tutorial, procedure, or report in order | `scroll` | `ScrollDocument` → `ScrollHeader` + `ScrollSection`, with shared content components inside sections |
46
+ | Existing MDX | Detect and keep | Convert only the outer shell when requested; never combine both shells |
48
47
 
49
- ## Authoring rules
48
+ For `atlas`, keep exactly one `L0` root and use `L1`–`L4` for progressively finer detail. For `scroll`, the shell builds the table of contents and reading progress from section titles; do not hand-build navigation. Give `ExplainPage title` or `ScrollHeader title` a real static string because it becomes the browser tab title.
50
49
 
51
- - Keep MDX semantic. Never write CSS, coordinates, SVG, or replacement application code; never invent component names or props.
52
- - Give each important node a claim-like title, a one-sentence `summary`, and real substance (`Definition`, `Mechanism`, `Example`, `Boundary`, `Evidence`, a model, a chart, or math). Do not restate the same text across `Overview`, `Definition`, and `Insight`.
53
- - **`kind` (optional, atlas)**: tag a node's knowledge role independently of `level`. One of `system`, `stage`, `mechanism`, `artifact`, `failure`, `tool`, `boundary`, `decision`. It powers the graph's "知识类型" filter and a node badge, so use it where the role is clear rather than on every node. Two opt-in contracts fire once you declare one: `kind="mechanism"` should contain an `Invariant` or `Evidence`, and `kind="failure"` should contain a `FailureMode` (with `symptom`/`cause`/`evidence`/`remedy`).
54
- - Array props are arrays of objects: `Flow steps={[{title, description}]}`, `Timeline events={[{label, content}]}`, `MatrixModel cells={[{title, description, tone}]}`, `DecisionMatrix headers={[...]} rows={[[...]]}`, `Chart data={[{label, value}]}`, `References items={[{id, authors, year, title, url, source}]}`. The validator warns (`PROP_EXPECTS_ARRAY`) when an array prop gets a string or non-array.
55
- - `Relation type` must be one of `prerequisite`, `causes`, `produces`, `uses`, `implements`, `contrasts`, `depends-on`, `exception-of`, `precedes`, and each `Relation` needs a `label`. Parent/child hierarchy is implicit (via `parent` and `Children`/`ConceptRef`) — do not express it with a `Relation`.
56
- - **Math**: MDX parses `{ ... }` in children as expressions, so pass LaTeX with braces or backslashes through `formula`: `<Math formula="r_{\text{ann}} = (1 + r)^{12} - 1" />`, `<MathBlock formula="I(x) = -\log_2 p(x)" variables={[{symbol, description}]} />`. Brace-free children such as `<Math>\log_2 N</Math>` are fine. The validator warns (`MATH_CHILDREN_BRACES`).
57
- - **Code**: pass code as a string via `code` (or as children) wrapped in a template literal, so MDX does not read it as expressions: `<CodeBlock language="bash" lineNumbers>{`npm run validate`}</CodeBlock>`. Badges, captions and wrapping are documented in `references/components.md`.
58
- - **Figures**: always set `alt`; number with an `id` plus `<FigureRef>`, never hand-write "图 N"; relative links versus `--inline-assets` is a size trade-off — decide it with the user instead of choosing silently.
59
- - **Cite/References**: `<Cite id="..." />` renders `[n]` from the matching item's position in `<References items={...} />`. In `atlas`, keep the cites and the `References` block in the same node, because node content only renders when that node is open.
60
- - Continuous reading is configured on the shell, not with manual CSS: `spacing="compact|comfortable|airy"` for rhythm, `fontSize="compact|normal|large|xlarge"` (or numeric `scale`/`lineHeight`) for text size.
50
+ ## Authoring contract
61
51
 
62
- ## Validation diagnostics
52
+ - Give each important concept a claim-like title, a one-sentence summary where the shell supports it, and substance that adds new information. Merge stubs instead of padding them.
53
+ - Density means information gain, not quotas. Cover what the concept is, why/how it works, evidence or an example when available, and a boundary or trade-off when relevant; stop when the reader's question is answered.
54
+ - Use `kind` only when an atlas node's knowledge role is clear. A `mechanism` should carry an `Invariant` or `Evidence`; a `failure` should carry a structured `FailureMode`.
55
+ - Use relation types for cross-branch meaning, never for parent-child hierarchy. Every `Relation` needs a meaningful `label`.
56
+ - Check array shapes in `components.md`. Pass LaTeX and code through the documented string/template-literal forms so MDX does not parse them as expressions.
57
+ - Always set figure `alt`; use `id` + `FigureRef` for automatic numbering. In `atlas`, keep `Cite` and `References` in the same node.
58
+ - Configure reading rhythm and text size on the shell, not with manual CSS.
63
59
 
64
- `validate` and the build print `CODE line:column message`. Fix every `error` before building; `references/diagnostics.md` lists the codes you may meet and separates errors from warnings. `NO_ROOT_LEVEL`, `MULTIPLE_ROOT_LEVEL`, `MECHANISM_KIND_UNVERIFIED` and `FAILURE_KIND_UNSTRUCTURED` are warnings that `--strict` promotes to errors.
60
+ ## Reference router
65
61
 
66
- ## Before you report
62
+ | Need | Read |
63
+ | --- | --- |
64
+ | Component props, defaults, array shapes, aliases, traps | `references/components.md` |
65
+ | Document conversion, source fidelity, density, stopping conditions | `references/authoring.md` |
66
+ | Commands, flags, appearance, batching, assets, version mismatch | `references/cli.md` |
67
+ | Diagnostic meaning and repair action | `references/diagnostics.md` |
68
+ | Compilable composition examples | `references/atlas-guide.mdx` or `references/scroll-guide.mdx` |
67
69
 
68
- - All `error` diagnostics resolved (or `--no-validate` explicitly justified).
69
- - All `ConceptRef`, `Relation` endpoints, and `ConceptGraph root` point at existing node ids.
70
- - Every node has `title` + `summary`; every `Relation` has a `label`.
71
- - Pages with `<Mermaid>` are already fully offline: Pele ships inline, so you never need a CDN flag.
72
- - The HTML file exists at the reported path.
70
+ ## Failure recovery
73
71
 
74
- If `npx` cannot reach the registry, report the blocker. Never copy implementation files into the skill directory.
72
+ - If `npx` cannot reach the registry, report the blocker; do not switch to a repository build or copy implementation files.
73
+ - If the CLI rejects a component that the current skill documents, check `--version` and report a likely skill/CLI version mismatch rather than inventing a workaround.
74
+ - If validation still fails after the documented fix, report the remaining diagnostic and the file location instead of using `--no-validate` silently.
@@ -0,0 +1,59 @@
1
+ # Authoring and document conversion
2
+
3
+ Use this reference when turning source material into a page, or when deciding whether a draft is complete. Component APIs live in `components.md`; this file governs structure, fidelity, and stopping conditions.
4
+
5
+ ## Choose the shell from the reading task
6
+
7
+ - Choose `atlas` when readers need to compare concepts, follow cross-branch relations, or explore details out of order.
8
+ - Choose `scroll` when the source's argument must be read in order: tutorials, reports, procedures, and long-form explanations.
9
+ - If an `.mdx` file already exists, detect and keep its shell unless the user asks to convert it. Never make one file both shells.
10
+
11
+ ## Turn a document into a page
12
+
13
+ Restructure the source; do not paste it into one node or section. Map the source's own outline first, then convert each unit into one claim with its supporting material.
14
+
15
+ | Source material | Preferred expression |
16
+ | --- | --- |
17
+ | Chapter or major heading | One `ScrollSection`, or one named concept node in `atlas` |
18
+ | Neutral table or raw observations | `DataTable` |
19
+ | Options compared against criteria | `DecisionMatrix` or `Tradeoff` |
20
+ | Two-dimensional positioning | `MatrixModel` |
21
+ | Ordered process | `Flow` or `WorkedExample` + `Step` |
22
+ | Dated sequence | `Timeline` |
23
+ | Before/after or alternative designs | `Compare` or `CodeDiff` |
24
+ | Headline number | `Metric` |
25
+ | Repeated definition or prose | One `Definition` plus its evidence; merge duplicates |
26
+ | Citation or source claim | `Cite` + `References`, and `Source` where provenance matters |
27
+
28
+ Preserve the source's citations, qualifications, counterexamples, and uncertainty. Do not invent evidence, citations, measurements, or examples to make the page look complete. If the source leaves a material gap, say so in the page or report it to the user.
29
+
30
+ Finish with a short mapping report: what was restructured, merged, dropped, or left unresolved. This lets the user check that the conversion did not silently change the argument.
31
+
32
+ ## Density means information gain, not quotas
33
+
34
+ A branch that only restates its title is a stub. A block that repeats the previous block in different styling is also a stub. Fix both by adding new information or merging the unit.
35
+
36
+ For each important concept, ask:
37
+
38
+ 1. **What is it?** Give a precise definition or mental model.
39
+ 2. **Why or how does it work?** Explain the mechanism, cause, or decision rule.
40
+ 3. **What supports it?** Add evidence, a worked example, data, or a citation when available.
41
+ 4. **Where does it stop?** State a boundary, failure mode, trade-off, or counterexample when relevant.
42
+
43
+ These are coverage questions, not required block counts. A simple concept may need only a definition and an example; a complex mechanism may need several models and a failure analysis. Stop when the reader can answer the concept's key question and check the important claims. Never split prose or fabricate substance merely to hit a number.
44
+
45
+ In `scroll`, one section should make one claim plus its evidence. Split a section when it changes subject or develops a second independent claim, not because it crosses an arbitrary screen count.
46
+
47
+ ## Component selection follows the relationship
48
+
49
+ Use the component whose data shape matches the information, not the one with the most decorative treatment. A `Flow` expresses order; `Timeline` adds time; `StateMachine` adds states and transitions; `DecisionTree` adds conditions; `FeedbackLoop` adds feedback polarity. If two components would show the same text, keep one.
50
+
51
+ ## Final content check
52
+
53
+ Before compiling, verify:
54
+
55
+ - Every important unit has a claim-like title and non-duplicated substance.
56
+ - Every node has `title` and `summary`; every relation has a meaningful `label`.
57
+ - All ids, parents, refs, relation endpoints, figures, and citations resolve.
58
+ - Source claims remain traceable, and uncertainty has not been silently upgraded into certainty.
59
+ - The page answers the user's actual reading task rather than merely displaying many components.
@@ -0,0 +1,77 @@
1
+ # CLI reference
2
+
3
+ Use this reference when scaffolding, validating, compiling, batching, or configuring appearance. The main workflow is in `SKILL.md`.
4
+
5
+ ## Runner
6
+
7
+ Always invoke the CLI through `npx`, from any directory:
8
+
9
+ ```bash
10
+ npx concept-atlas-dense-explain <args>
11
+ ```
12
+
13
+ This is the only runner. Do not search for a local binary, repository checkout, or installed copy, and do not run the framework repository's own `npm` scripts. The first call may download the package from npm; say so once, then continue. Use `npx concept-atlas-dense-explain help` when a flag is unclear and `--version` when diagnosing a version mismatch.
14
+
15
+ ## Core commands
16
+
17
+ ```bash
18
+ # Optional skeleton; defaults to scroll and overwrites the target.
19
+ npx concept-atlas-dense-explain create <file>.mdx --mode atlas|scroll
20
+
21
+ # Validate before rendering.
22
+ npx concept-atlas-dense-explain validate <file>.mdx --mode atlas|scroll
23
+ npx concept-atlas-dense-explain validate <file>.mdx --mode atlas|scroll --json
24
+
25
+ # Compile; detects the MDX shell when --mode is omitted and writes beside the MDX unless -o is given.
26
+ npx concept-atlas-dense-explain <file>.mdx --mode atlas|scroll [-o out.html]
27
+
28
+ # Build several documents; -o becomes a directory.
29
+ npx concept-atlas-dense-explain a.mdx b.mdx c.mdx -o dist [--concurrency 3]
30
+ ```
31
+
32
+ `create`, `guide`, and compiled HTML outputs overwrite existing files. `guide` also copies its sample resources into `assets/` beside the output and overwrites matching files. Do not point it at a path containing user work unless overwriting is intended; choose a new path or ask first.
33
+
34
+ `guide` is only needed when the user wants a project-local, compilable copy of the bundled example. The installed skill already contains `references/atlas-guide.mdx` and `references/scroll-guide.mdx`; do not generate another copy just to learn the components.
35
+
36
+ ## Flags
37
+
38
+ | Flag | Meaning |
39
+ | --- | --- |
40
+ | `--mode atlas\|scroll` | Selects the page shell. `create` / `guide` default to `scroll`; validation and builds detect the shell when omitted. Keep it consistent across commands when specified. |
41
+ | `-o <path>` | Output HTML file, or output directory for multiple inputs. |
42
+ | `--strict` | Promotes structural warnings to validation errors. |
43
+ | `--json` | Machine-readable validation output. |
44
+ | `--no-validate` | Skips validation and knowingly allows a broken build. Use only with an explicit reason. |
45
+ | `--inline-assets` | Inlines every local image as base64. |
46
+ | `--link-assets` | Explicit alias for the default linked-image behavior; mutually exclusive with `--inline-assets`. |
47
+ | `--concurrency <N>` | Parallel build limit for multiple inputs; default 2, capped at 4. |
48
+ | `--skin <id>` | Bakes a default palette. |
49
+ | `--default-mode dark\|light\|system` | Bakes a default color mode. |
50
+ | `--style <id>` | Bakes a default component style. |
51
+ | `--force` | Compatibility no-op; outputs are overwritten anyway. |
52
+
53
+ ## Appearance
54
+
55
+ Pages ship a reader-facing appearance menu: palette (`aurora` indigo, `ember` gold, `verdant` forest, `sakura` pink-plum, `noir` ink), dark/light mode, and component style (`manuscript` editorial marginalia, `classic` boxed cards, `shadcn` hairline-bordered minimal UI, `elastic` bordered observability panels). The shipped default is aurora × manuscript × light, and choices persist in localStorage.
56
+
57
+ Bake different defaults only when the user asks:
58
+
59
+ ```bash
60
+ npx concept-atlas-dense-explain article.mdx --mode scroll \
61
+ --skin ember --default-mode dark --style classic
62
+ ```
63
+
64
+ `--default-mode system` resolves to the carrier default (`light`). Content MDX never sets appearance.
65
+
66
+ ## Assets and offline behavior
67
+
68
+ - `<Mermaid>` diagrams are rendered by Pele and inlined, so diagrams need no chart CDN. A page without `<Mermaid>` drops the renderer entirely.
69
+ - Fonts may load from Google Fonts at runtime and fall back to the system stack offline.
70
+ - Local images stay relative links by default. Ship the `assets/` directory beside the HTML, or use `--inline-assets`.
71
+ - A per-figure `inline={true}` / `inline={false}` overrides the global flag for one image.
72
+ - Remote images remain links and require network access.
73
+ - Never add dummy `<Math>` or `<Mermaid>` nodes to enable a renderer; builds include only what the content uses.
74
+
75
+ ## Version mismatch
76
+
77
+ The skill documentation and the npm `latest` CLI are released separately. If a documented component is rejected as `UNKNOWN_COMPONENT` after `npx` has fetched `latest`, report the likely version mismatch and the versions involved. Do not copy package implementation files into the skill, invent a replacement API, or silently downgrade the page.
@@ -1,26 +1,158 @@
1
1
  # Component and prop reference
2
2
 
3
- Search this file by component name before writing a tag the page has not used yet. Props are shown in their real shapes; anything not listed here does not exist. The rules that hold for every page — semantic MDX, `kind` contracts, relation types, array-prop shape, math braces, figure numbering, cite scoping — are in `SKILL.md`; this file adds the per-component detail.
3
+ Search this file by component name before writing a tag the page has not used yet. The tables below describe the **effective MDX author API**: renderer props plus fields consumed by the atlas semantic model. Reserved/no-op compatibility props are marked explicitly. Defaults that affect output are included. Array props default to `[]` unless stated otherwise; widget props default to `width="auto"`, `height="auto"`, `x={0}`, `y={0}`, and `position="flow"`.
4
+
5
+ A component missing from the tables does not exist (`UNKNOWN_COMPONENT`). An unknown *prop* is silently ignored — the validator only reports array-shaped props that receive a non-array (`PROP_EXPECTS_ARRAY`) — so check the table instead of guessing. `children` is listed only where the component actually renders it or uses it as a fallback.
6
+
7
+ The rules that hold for every page — semantic MDX, `kind` contracts, relation types, math braces, figure numbering, cite scoping — are in `SKILL.md`; this file adds the per-component detail.
4
8
 
5
9
  ## Families
6
10
 
11
+ - Shell and structure: `ExplainPage`, `ConceptGraph`, `ConceptNode`, `ConceptRef`, `Children`, `Relation`, `ScrollDocument`, `ScrollHeader`, `ScrollSection`, `ScrollProse`, `ScrollPair`, `ScrollGrid`, `ScrollToc`, `Columns`, `Stack`, `Grid`, `Split`
7
12
  - Node semantics: `Overview`, `Definition`, `Mechanism`, `Implementation`, `CodeBlock`, `Boundary`, `Example`, `Counterexample`, `Prerequisite`, `Input`, `Output`, `Glossary`
8
13
  - Argument and evidence: `Evidence`, `Invariant`, `FailureMode`, `Tradeoff`, `Checklist`, `LearningObjectives`, `KeyQuestion`
9
14
  - Learning loop and provenance: `WorkedExample` + `Step`, `Quiz`, `KeyTakeaways`, `Source`, `Confidence`, `LastReviewed`, `Term`
10
15
  - Information models: `Flow`, `Timeline`, `Compare`, `DecisionMatrix`, `FrameworkModel`, `MatrixModel`, `FormulaModel`, `PyramidModel`, `FunnelModel`
11
16
  - Data and behaviour: `DataTable`, `Metric`, `PropertyList`, `TreeView`, `StateMachine`, `DecisionTree`, `FeedbackLoop`, `CodeDiff`
12
- - Reading and layout: `Insight`, `Callout`, `Details`, `Quote`, `NoteGrid`, `Tabs`, `Columns`, `Stack`, `Grid`, `Split`, `ScrollGrid`, `ScrollPair`, `ScrollToc`
17
+ - Reading and layout: `Insight`, `Callout`, `Details`, `Quote`, `NoteGrid`, `Tabs`
13
18
  - Graphics and extensions: `Mermaid`, `RelationMap`, `RelationPath`, `Math`, `MathBlock`, `Chart`, `CodeTabs`, `AnnotatedCode`, `Figure` (alias `Image`), `FigureRef`, `Cite`, `References`
14
19
 
15
- ## Props and usage
20
+ ## Props at a glance
21
+
22
+ ### Shell and structure
23
+
24
+ | Component | Props |
25
+ | --- | --- |
26
+ | `ExplainPage` | `id`, `title`, `summary`, `layout` = `editorial`, `density` = `reading`, `children` — `layout` / `density` are reserved data attributes with no current visual or model effect; use a static string for `title` if it must become the browser tab title |
27
+ | `ConceptGraph` | `root`, `children` — `root` is optional; omission infers the root and warns |
28
+ | `ConceptNode` | `id`, `title`, `level` = `L2` (`L0`–`L4`), `parent` = `null`, `summary`, `kind`, `input`, `output`, `children` — `summary`/`kind`/`input`/`output` are consumed by the atlas model |
29
+ | `ConceptRef` | `id` |
30
+ | `Children` | `children` — a list of `ConceptRef` |
31
+ | `Relation` | `from`, `to`, `type` = `depends-on`, `label`, `description`, `children` |
32
+ | `ScrollDocument` | `spacing` = `comfortable` (`compact`\|`comfortable`\|`airy`), `fontSize` = `normal` (`compact`\|`normal`\|`large`\|`xlarge`), `scale`, `lineHeight`, `toc` = `true`, `progress` = `true`, `children` |
33
+ | `ScrollHeader` | `label` = `连续阅读`, `title`, `children` |
34
+ | `ScrollSection` | `title`, `id`, `wide` = `false`, `spacing` = `inherit`, `children` — `wide` is reserved and currently adds no extra width |
35
+ | `ScrollProse`, `ScrollPair`, `Columns` | `children` |
36
+ | `ScrollGrid` | `columns` = `3` (`2`\|`3`\|`4`), `children` |
37
+ | `ScrollToc` | `items` = `[]`, `activeId` = `null`, `title` = `目录`, `onNavigate` — internal shell component; fewer than two items renders nothing |
38
+ | `Stack` | `gap` = `md` (`sm`\|`md`\|`lg`), `children` |
39
+ | `Grid` | `columns` = `auto` (`auto`\|`2`\|`3`\|`4`), `gap` = `md` (`sm`\|`md`\|`lg`), `children` |
40
+ | `Split` | `ratio` = `1fr 1fr`, `children` |
41
+
42
+ ### Node semantics
43
+
44
+ | Component | Props |
45
+ | --- | --- |
46
+ | `Overview`, `Definition`, `Mechanism`, `Prerequisite`, `Input`, `Output`, `KeyQuestion` | `children` |
47
+ | `Implementation` | `language` = `text`, `title` = `实现代码`, `children` |
48
+ | `CodeBlock` | `code`, `language` = `text`, `title`, `caption`, `lineNumbers` = `false`, `wrap` = `false`, `children` — `code` or template-literal children |
49
+ | `Boundary`, `Example`, `Counterexample`, `Invariant` | `title`, `children` — defaults: `边界与约束`, `典型示例`, `反例与误区`, `不变量` |
50
+ | `Glossary` | `term`, `children` — the definition goes in children |
51
+
52
+ ### Argument, evidence and provenance
53
+
54
+ | Component | Props |
55
+ | --- | --- |
56
+ | `Evidence` | `command`, `observes`, `children` — children can supply `observes` when that prop is omitted |
57
+ | `FailureMode` | `symptom`, `cause`, `evidence`, `remedy`, `children` |
58
+ | `Tradeoff` | `title` = `工程权衡`, `options`, `children` |
59
+ | `Checklist` | `title` = `验证清单`, `items`, `children` |
60
+ | `LearningObjectives` | `items`, `children` — `items` is an array of strings |
61
+ | `WorkedExample` | `title` = `推演过程`, `problem`, `children` — children are `Step` components |
62
+ | `Step` | `number`, `title`, `reason`, `children` — omitted numbers are automatic |
63
+ | `Quiz` | `question`, `answer`, `tone` = `info`, `children` — children are the explanation |
64
+ | `KeyTakeaways` | `title` = `关键要点`, `items`, `children` — `items` is an array of strings |
65
+ | `Source` | `kind` = `reference` (`spec`\|`rfc`\|`implementation`\|`experiment`\|`experience`\|`reference`), `label`, `href`, `children` |
66
+ | `Confidence` | `level` = `medium` (`high`\|`medium`\|`low`), `basis`, `children` |
67
+ | `Term` | `name`, `definition`, `children` — with `name`, children are the definition; without `name`, children are only the term text |
68
+ | `LastReviewed` | `date`, `by`, `note` — renders nothing when all three are empty |
69
+
70
+ ### Information models
71
+
72
+ | Component | Props |
73
+ | --- | --- |
74
+ | `Flow` | `steps`, `children` |
75
+ | `Timeline` | `events`, `children` |
76
+ | `Compare` | `items`, `children` |
77
+ | `DecisionMatrix` | `title` = `权衡矩阵`, `headers`, `rows`, `children` |
78
+ | `FrameworkModel` | `title` = `结构化模型`, `type` = `elements` (`elements`\|`stages`\|`layers`\|`cycle`), `elements`, `question`, `children` |
79
+ | `MatrixModel` | `title` = `二维矩阵`, `xLabel` = `横轴`, `yLabel` = `纵轴`, `cells`, `children` |
80
+ | `FormulaModel` | `title` = `公式模型`, `formula`, `variables`, `children` |
81
+ | `PyramidModel` | `title` = `金字塔模型`, `levels`, `children` |
82
+ | `FunnelModel` | `title` = `漏斗模型`, `steps`, `children` |
16
83
 
17
- - **CodeBlock**: a general code block usable anywhere; `Implementation` is the node-bound variant. Pass the code as a string via `code` (or as children) wrapped in a template literal so MDX does not read it as expressions: `<CodeBlock language="bash" title="..." lineNumbers>{`npm run validate`}</CodeBlock>`. `language` adds the badge, `title`/`caption` add labels, `lineNumbers` and `wrap` are booleans.
18
- - **Chart**: `type` is `bar` | `line` | `pie`; use `data` for bar/pie and `labels` + `series={[{name, values}]}` for line. Charts follow theme colors.
19
- - **Learning loop**: `WorkedExample` holds `Step` children; give each step a `reason` (the justification) so it teaches reasoning, not just the result. `Quiz question answer` reveals the answer on click with children as the explanation. `KeyTakeaways items={[...]}` closes a section.
20
- - **Provenance**: `Source kind="spec|rfc|implementation|experiment|experience|reference" label href` marks one claim's origin inline (`reference` is the default); `Confidence level="high|medium|low" basis` wraps a claim with how strongly it is established; `Term name` (or children as the definition) gives an inline hover definition.
21
- - **Data and behaviour**: `DataTable headers={[...]} rows={[[...]]}` is the neutral table (no comparative stance). `Metric label value unit delta trend note` is one headline number — compose several with `Grid`/`ScrollGrid`. `StateMachine states={[{id,label,terminal}]} transitions={[{from,to,event,guard}]}` expresses cycles and guards. `DecisionTree branches={[{condition,outcome,tone,branches}]}` nests branches. `FeedbackLoop type="reinforcing|balancing" nodes={[{label,description}]}` closes a loop. `CodeDiff before after language` shows a change.
22
- - **Structure and code extensions**: `Quote author source href` attributes a quotation. `Checklist title items={[{text,status:'pass'|'fail'|'unknown'|'todo',note}]}` is a verification list. `PropertyList title items={[{name,value,note}]}` is a name/value spec ledger. `TreeView title items={[{label,description,children:[…]}]}` nests a hierarchy. `CodeTabs items={[{label,language,code}]} title caption lineNumbers` gives one collapsible listing per variant. `AnnotatedCode code language title notes={[{line,text}]}` numbers a listing and calls out specific lines. `LastReviewed date by note` is a review stamp.
23
- - **Figure**: a relative `src` (`./assets/diagram.png`) stays a relative link by default; compile with `--inline-assets` to bake every local image in as base64, or set `inline={true}` / `inline={false}` on one figure to override (precedence: per-figure prop > global flag > link). `http(s)` URLs stay links and warn (`ASSET_REMOTE`). Always set `alt`; a missing relative file warns (`ASSET_MISSING`) and shows a placeholder. Readers can click a figure to open it full-screen (zoom, drag, `Esc`) — mention it for diagram-heavy pages.
84
+ ### Data and behaviour
85
+
86
+ | Component | Props |
87
+ | --- | --- |
88
+ | `DataTable` | `title`, `caption`, `headers`, `rows`, `children` |
89
+ | `Metric` | `label`, `value`, `unit`, `delta`, `trend` (`up`\|`down`\|`flat`), `note` — omitted `trend` is inferred from `delta` |
90
+ | `PropertyList` | `title`, `items`, `children` |
91
+ | `TreeView` | `title`, `items`, `children` |
92
+ | `StateMachine` | `title` = `状态机`, `initial`, `states`, `transitions`, `children` |
93
+ | `DecisionTree` | `title` = `决策路径`, `question`, `branches`, `children` |
94
+ | `FeedbackLoop` | `title` = `反馈回路`, `type` = `reinforcing` (`reinforcing`\|`balancing`), `nodes`, `children` |
95
+ | `CodeDiff` | `title` = `代码对比`, `language` = `text`, `before`, `after`, `beforeLabel` = `修改前`, `afterLabel` = `修改后`, `caption` |
96
+
97
+ ### Reading, layout and graphics
98
+
99
+ | Component | Props |
100
+ | --- | --- |
101
+ | `Insight` | `title` = `关键判断`, `tone` = `info` (`info`\|`success`\|`warn`\|`danger`), `children`, `width` = `auto`, `height` = `auto`, `x` = `0`, `y` = `0`, `position` = `flow` |
102
+ | `Callout` | `type` = `info` (`info`\|`success`\|`warn`\|`danger`), `title`, `children` |
103
+ | `Details` | `summary` = `详细展开`, `children` |
104
+ | `Quote` | `author`, `source`, `href`, `children` |
105
+ | `NoteGrid` | `notes`, `children`, `width` = `auto`, `height` = `auto`, `x` = `0`, `y` = `0`, `position` = `flow` |
106
+ | `Tabs` | `items`, `children` — children are `<details>` blocks |
107
+ | `Mermaid` | `chart` = `''`, `title` = `关系草图`, `width` = `auto`, `height` = `auto`, `x` = `0`, `y` = `0`, `position` = `flow` |
108
+ | `RelationMap` | `title` = `关系速览`, `items`, `children`, `width` = `auto`, `height` = `auto`, `x` = `0`, `y` = `0`, `position` = `flow` |
109
+ | `RelationPath` | `title` = `关系链`, `steps`, `children` |
110
+ | `Math` | `formula`, `children` — children are fine only when they contain no braces; `formula` is safer for backslashes |
111
+ | `MathBlock` | `title` = `公式`, `formula`, `variables`, `children` |
112
+ | `Chart` | `title` = `图表`, `type` = `bar` (`bar`\|`line`\|`pie`), `data`, `series`, `labels`, `unit` = `''`, `showValues` = `true`, `width` = `auto`, `height` = `auto`, `x` = `0`, `y` = `0`, `position` = `flow` |
113
+ | `CodeTabs` | `items`, `title`, `caption`, `lineNumbers` = `false` |
114
+ | `AnnotatedCode` | `code`, `language` = `text`, `title`, `caption`, `notes` |
115
+ | `Figure`, `Image` | `id`, `src`, `alt` = `''`, `caption`, `label`, `inline`, `width` = `auto`, `height` = `auto`, `x` = `0`, `y` = `0`, `position` = `flow` |
116
+ | `FigureRef` | `id`, `children` — children override the automatic label |
117
+ | `Cite` | `id`, `children` — children override the automatic citation number |
118
+ | `References` | `title` = `参考文献`, `items`, `children` |
119
+
120
+ ## Shapes and traps
121
+
122
+ Array props are arrays, but not always arrays of objects: some take strings, numbers, or nested arrays. Field names differ per component and are not interchangeable. Unknown props are dropped without a word, so a wrong field name usually shows up as an empty cell, a missing badge, or a card with only its title.
123
+
124
+ - **Booleans:** prefer a bare prop or `{true}` / `{false}`. Runtime booleans such as `toc="false"` and `showValues="false"` are truthy. The asset plugin also accepts quoted `inline="false"`, but use `inline={false}` for consistency.
125
+ - **`Callout` uses `type`, while `Insight` and `Quiz` use `tone`.** Both accept `info` / `success` / `warn` / `danger`; anything else falls back to `info`.
126
+ - **`Compare` puts the row labels on the first item only:** `items={[{label, rows: ['行一','行二'], values: ['…','…']}]}`. `label` is the column header, `rows` is read from `items[0]` and shared by every column, and each item's `values[i]` fills row `i`. A missing cell renders `-`; `0`, `false`, and an empty string are preserved. For a free-form side-by-side block instead, use children (e.g. `Columns` + `Split`).
127
+ - **`Flow`** takes strings or `{title?, label?, description?}` objects. **`Timeline`** takes `{label?, time?, content?, desc?}`: `label` is primary, `time` is shown beside it when both exist, and `desc` is a legacy fallback for `content`.
128
+ - **`FrameworkModel` / `PyramidModel` / `FunnelModel`:** `elements={[{title?, label?, name?, description?}]}`, `levels={[{title?, label?, description?}]}`, and `steps={[{title?, label?, description?}]}`. `FrameworkModel type` labels the model; only `stages` currently adds arrow layout. `cycle` is a semantic label, not a circular layout.
129
+ - **`MatrixModel` is the 2×2 quadrant** (`xLabel`, `yLabel`, `cells={[{title?, label?, description?, tone?}]}`, usually four cells); **`DecisionMatrix` is the weighted table** (`headers`, `rows` as arrays of cells). `cells` on a `DecisionMatrix` is silently ignored.
130
+ - **`Tradeoff` options carry the verdict:** `options={[{name?, label?, benefit?, cost?, when?}]}` — `when` is the condition under which that option wins.
131
+ - **`NoteGrid`** takes `notes={[{title?, label?, content?, text?, description?}]}`; **`Tabs`** takes `items={[{label?, title?, content?}]}` and opens the first tab.
132
+ - **`Evidence` is normally a command/observation pair** (`command`, `observes`); children can supply `observes` when the prop is omitted.
133
+ - **`Checklist` items** are strings or `{text?, status, note?}` with `status` one of `pass` / `fail` / `unknown` / `todo`. Invalid or omitted statuses become `unknown`.
134
+ - **`LearningObjectives` / `KeyTakeaways` items** are arrays of strings.
135
+ - **`PropertyList` items** are strings or `{name?, label?, key?, value?, note?}`; **`TreeView` items** are `{label?, title?, description?, children: […]}` (nest to any depth).
136
+ - **`StateMachine`** needs `states={[{id, label?, description?, terminal?}]}` and `transitions={[{from, to, event?, guard?}]}` whose `from`/`to` are state ids; `initial` marks the entry state.
137
+ - **`DecisionTree` branches** are `{condition?, outcome?, note?, tone?, branches: […]}` — nest `branches` for deeper levels.
138
+ - **`FeedbackLoop` nodes** are `{label?, title?, description?}` and `type="balancing"` flips the loop polarity.
139
+ - **`Chart`** reads `data={[{label?, x?, value?, y?}]}` or numbers for `bar`/`pie`, and `labels` + `series={[{name?, label?, values}]}` for `line`. Invalid `type` values fall back to `bar`. `unit` is shown in the chart's header badge (`CHART · BAR · ms`), not appended to each value.
140
+ - **`RelationMap` items** are `{from?, source?, type, to?, target?, note?}` with `type` from the same whitelist as `Relation`; **`RelationPath` steps** are `{level?, node?, title?, note?, relation?, tone?}`. `node` is the display label (not a node id), and `relation` labels the edge to the next step.
141
+ - **`Math`** requires `formula` when children contain braces — MDX reads `{…}` as an expression. Brace-free children such as `<Math>\log_2 N</Math>` work, but `formula` is safer and more consistent. `MathBlock` adds `variables={[{symbol?, name?, description?, value?}]}` and a title.
142
+ - **`CodeTabs` items** are `{label?, language?, code?}`; **`AnnotatedCode` notes** are `{line, text?}` and `line` is the 1-based line number in `code`.
143
+ - **`Mermaid`** takes the chart as a template literal (`chart={\`flowchart LR …\`}`); keep the backtick wrapper so newlines survive. Readers can open any chart full-screen from the widget head or by clicking the drawing. Pele renders it as an inline SVG, so the page stays offline; its layout differs from Mermaid.js, and `themeVariables` does nothing — colours come from the page theme.
144
+ - **Widget props** (`width`, `height`, `x`, `y`, `position`) exist on `Mermaid`, `Chart`, `Figure`, `Image`, `Insight`, `NoteGrid` and `RelationMap`. `position="absolute"` places the widget at `x`/`y` inside its container; any other value keeps it in the flow and uses `x`/`y` as a translate offset. Leave them alone unless the layout asks for it.
145
+ - **`ConceptNode` content precedence:** `<Input>` / `<Output>` children override the node's `input` / `output` props. A string-only `<Overview>` supplies `summary` when the prop is omitted.
146
+ - **`Relation` precedence differs by carrier:** direct scroll rendering prefers children over `description`; atlas extraction prefers `description` over children. Set `description` explicitly when the same edge must read identically in both carriers.
147
+ - **`Term`:** `<Term name="X">定义</Term>` creates a term with a definition. `<Term>X</Term>` only sets the term text and has no definition.
148
+ - **`FigureRef` / `Cite` children** override the automatic “图 N” / `[n]` text. Use this sparingly; the automatic labels stay correct when content moves.
149
+
150
+ ## Figures and assets
151
+
152
+ - A relative `src` (`./assets/diagram.png`) stays a relative link by default; compile with `--inline-assets` to bake every local image in as base64, or set `inline={true}` / `inline={false}` on one figure to override (precedence: per-figure prop > global flag > link). `http(s)` URLs stay links and warn (`ASSET_REMOTE`). Always set `alt`; a missing relative file warns (`ASSET_MISSING`) and shows a placeholder. Readers can click a figure to open it full-screen (zoom, drag, `Esc`) — mention it for diagram-heavy pages.
24
153
  - **Figure numbering**: give a figure an `id` and reference it with `<FigureRef id="..." />` to render "图 N". Numbering follows document order (per node in `atlas`, whole document in `scroll`) and reflows automatically, so never hand-write "图 1"; an explicit `label` still wins. A ref with no matching `id` warns (`FIGURE_REF_UNRESOLVED`).
25
- - **Figure size & cost**: linking keeps the HTML small but requires the output to sit beside the MDX's `assets/` (the CLI warns when `-o` points elsewhere). Inlining is what makes a screenshot-heavy page large (a page with no heavy renderers otherwise lands near 250KB), and an inlined asset over 512KB warns (`ASSET_LARGE`). Decide the trade-off with the user instead of choosing silently.
26
- - **Cite/References**: `<Cite id="..." />` renders `[n]` from the matching item's position in `<References items={...} />`. In `scroll`, `References` can sit anywhere. In `atlas`, keep the cites and the `References` block in the same node, because node content only renders when that node is open.
154
+ - **Figure size & cost**: linking keeps the HTML small, but the relative `src` must resolve from the output HTML location; keep the needed `assets/` beside the HTML or adjust the path. The CLI warns when `-o` points outside the MDX directory. Inlining is what makes a screenshot-heavy page large (a page with no heavy renderers otherwise lands near 250KB). An asset over 512KB warns (`ASSET_LARGE`) when inlined by the global flag or a per-figure `inline` prop. Decide the trade-off with the user instead of choosing silently.
155
+
156
+ ## Cite and References
157
+
158
+ `<Cite id="..." />` renders `[n]` from the matching item's position in `<References items={...} />`, where each item is `{id, authors?, year?, title?, url?, source?, note?}`. In `scroll`, `References` can sit anywhere. In `atlas`, keep the cites and the `References` block in the same node, because node content only renders when that node is open.
@@ -1,15 +1,55 @@
1
1
  # Validation diagnostics
2
2
 
3
- `validate` and the build print `CODE line:column message`. The message names the offending node or prop; this file is the checklist of codes you may meet.
3
+ Human-readable diagnostics use `error|warn line:column CODE message`; `--json` returns structured objects. Fix every error before building. Warnings usually mean the page still renders but loses structure, provenance, or reader clarity; fix them when cheap, and use `--strict` when a clean result is required.
4
4
 
5
5
  ## Errors — fix before building
6
6
 
7
- `UNKNOWN_COMPONENT`, `CARRIER_MISSING`, `CARRIER_CONFLICT`, `CARRIER_MODE_MISMATCH`, `NODE_MISSING_ID`, `DUPLICATE_NODE_ID`, `NODE_MISSING_TITLE`, `MISSING_PARENT`, `GRAPH_ROOT_UNRESOLVED`, `REF_MISSING_ID`, `REF_UNRESOLVED`, `RELATION_FROM_UNRESOLVED`, `RELATION_TO_UNRESOLVED`.
7
+ | Code | What it means | What to do |
8
+ | --- | --- | --- |
9
+ | `UNKNOWN_COMPONENT` | The tag is not registered. | Replace it with a component from `components.md`; do not invent aliases except `Image` for `Figure`. |
10
+ | `CARRIER_MISSING` | Neither page shell was found. | Add exactly one `ExplainPage` or `ScrollDocument` shell. |
11
+ | `CARRIER_CONFLICT` | Both shells occur in one file. | Keep one shell; convert the outer structure rather than nesting both. |
12
+ | `CARRIER_MODE_MISMATCH` | The file's shell disagrees with `--mode`. | Pass the matching `--mode atlas` or `--mode scroll`, or convert the file. |
13
+ | `NODE_MISSING_ID` | A `ConceptNode` has no stable id. | Add a unique kebab-case id. |
14
+ | `DUPLICATE_NODE_ID` | Two nodes share an id. | Rename one and update `parent`, `ConceptRef`, and `Relation` references. |
15
+ | `NODE_MISSING_TITLE` | A node has no readable title. | Add a claim-like `title`; an id alone is not enough. |
16
+ | `MISSING_PARENT` | A non-root node points to a missing parent. | Correct the parent id or remove it for the root. |
17
+ | `GRAPH_ROOT_UNRESOLVED` | `ConceptGraph root` names no node. | Point it at the `L0` node id. |
18
+ | `REF_MISSING_ID` | `ConceptRef` has no id. | Add the target node id. |
19
+ | `REF_UNRESOLVED` | `ConceptRef` points at no node. | Correct the id or add the missing node. |
20
+ | `RELATION_FROM_UNRESOLVED` | A relation's source id is missing. | Correct `from` or add the source node. |
21
+ | `RELATION_TO_UNRESOLVED` | A relation's target id is missing. | Correct `to` or add the target node. |
8
22
 
9
23
  ## Warnings — fix when cheap
10
24
 
11
- `NODE_MISSING_SUMMARY`, `NODE_NO_CORE_CONTENT`, `UNKNOWN_LEVEL`, `UNKNOWN_KIND`, `MECHANISM_KIND_UNVERIFIED`, `FAILURE_KIND_UNSTRUCTURED`, `FAILURE_MODE_EMPTY`, `UNKNOWN_RELATION_TYPE`, `RELATION_MISSING_LABEL`, `RELATION_SELF`, `PROP_EXPECTS_ARRAY`, `MATH_CHILDREN_BRACES`, `PROSE_EXPRESSION`, `FRONTMATTER_UNSUPPORTED`, `GRAPH_MISSING_ROOT`, `FIGURE_MISSING_SRC`, `ASSET_MISSING`, `ASSET_REMOTE`, `ASSET_LARGE`, `FIGURE_REF_UNRESOLVED`, `FIGURE_REF_MISSING_ID`, `FIGURE_DUPLICATE_ID`, `REF_SELF`.
25
+ | Code | What it means | What to do |
26
+ | --- | --- | --- |
27
+ | `NODE_MISSING_SUMMARY` | A node has no one-sentence summary. | Add `summary`; a string-only `Overview` can supply it in atlas. |
28
+ | `NODE_NO_CORE_CONTENT` | A node only repeats metadata or navigation. | Add definition, mechanism, evidence, example, model, or boundary content; merge it if it is only a stub. |
29
+ | `NO_ROOT_LEVEL` | The atlas has no `L0` root. | Mark exactly one root node `level="L0"`; `--strict` promotes this warning. |
30
+ | `MULTIPLE_ROOT_LEVEL` | More than one node is marked `L0`. | Keep one `L0`; make the other top-level branches `L1`. |
31
+ | `UNKNOWN_LEVEL` | `level` is outside `L0`–`L4`. | Use a declared level that matches the node's cognitive depth. |
32
+ | `UNKNOWN_KIND` | `kind` is outside the whitelist. | Use `system`, `stage`, `mechanism`, `artifact`, `failure`, `tool`, `boundary`, or `decision`, or omit it. |
33
+ | `MECHANISM_KIND_UNVERIFIED` | A mechanism node lacks `Invariant` or `Evidence`. | Add the invariant or evidence that makes the mechanism checkable. |
34
+ | `FAILURE_KIND_UNSTRUCTURED` | A failure node lacks a structured `FailureMode`. | Add `symptom`, `cause`, `evidence`, or `remedy`; `--strict` promotes this warning. |
35
+ | `FAILURE_MODE_EMPTY` | A self-closing `FailureMode` has no fields or children. | Supply at least one failure field or explanatory children. |
36
+ | `UNKNOWN_RELATION_TYPE` | The relation type is not in the whitelist. | Use a type from `SKILL.md`; do not express parent-child hierarchy as a relation. |
37
+ | `RELATION_MISSING_LABEL` | The edge has no reader-facing label. | Add a short `label` that states the relation's meaning. |
38
+ | `RELATION_SELF` | A relation starts and ends at the same node. | Remove it or connect two distinct nodes. |
39
+ | `PROP_EXPECTS_ARRAY` | An array prop received a string or non-array expression. | Pass an array literal such as `steps={[...]}`; check `components.md` for the item shape. |
40
+ | `MATH_CHILDREN_BRACES` | LaTeX in children contains MDX expression syntax. | Move the formula into `formula="..."` or a template literal. |
41
+ | `PROSE_EXPRESSION` | Prose was parsed as a JavaScript expression. | Escape or rewrite the braces; use a code block for literal syntax. |
42
+ | `FRONTMATTER_UNSUPPORTED` | The MDX frontmatter uses fields the renderer does not consume. | Remove the unsupported fields; keep authoring metadata outside the page shell. |
43
+ | `GRAPH_MISSING_ROOT` | `ConceptGraph` has no explicit root. | Add `root="<L0-id>"`; omission currently infers a root and warns. |
44
+ | `FIGURE_MISSING_SRC` | `Figure` has no image source. | Add a valid local path or remote URL. |
45
+ | `ASSET_MISSING` | A relative image path does not exist. | Correct the path relative to the MDX file. |
46
+ | `ASSET_REMOTE` | An image uses an `http(s)` URL. | Keep it only when remote loading is acceptable; otherwise use a local asset. |
47
+ | `ASSET_LARGE` | An asset over 512KB is inlined by `--inline-assets` or a per-figure `inline` prop. | Compress it, link it instead, or set `inline={false}` for that figure. |
48
+ | `FIGURE_REF_UNRESOLVED` | `FigureRef` names no figure id. | Add the matching `id` or correct the reference. |
49
+ | `FIGURE_REF_MISSING_ID` | `FigureRef` has no id. | Add the target figure id. |
50
+ | `FIGURE_DUPLICATE_ID` | Two figures share an id. | Rename one and update its references. |
51
+ | `REF_SELF` | A node lists itself as a child. | Remove the self-reference; use `parent` and `Children` for real hierarchy. |
12
52
 
13
53
  ## Promoted by `--strict`
14
54
 
15
- `NO_ROOT_LEVEL`, `MULTIPLE_ROOT_LEVEL`, `MECHANISM_KIND_UNVERIFIED` and `FAILURE_KIND_UNSTRUCTURED` are warnings that `--strict` turns into errors.
55
+ `NO_ROOT_LEVEL`, `MULTIPLE_ROOT_LEVEL`, `MECHANISM_KIND_UNVERIFIED` and `FAILURE_KIND_UNSTRUCTURED` are warnings that `--strict` turns into errors. The first two mean the atlas has no `L0` or has more than one; keep exactly one root.
@@ -298,7 +298,7 @@ export function Compare({ items = [], children }) {
298
298
  <tr key={rIdx}>
299
299
  <td className="compare-row-label">{rowKey}</td>
300
300
  {items.map((it, idx) => (
301
- <td key={idx}>{it.values?.[rIdx] || '-'}</td>
301
+ <td key={idx}>{it.values?.[rIdx] ?? '-'}</td>
302
302
  ))}
303
303
  </tr>
304
304
  ))
@@ -376,7 +376,10 @@ export function Timeline({ events = [], children }) {
376
376
  {events.map((ev, i) => (
377
377
  <div key={i} className="timeline-item">
378
378
  <div className="timeline-point" />
379
- <div className="timeline-label">{ev.label || ev.time}</div>
379
+ <div className="timeline-label">
380
+ {ev.label || ev.time}
381
+ {ev.label && ev.time && <small className="timeline-time">{ev.time}</small>}
382
+ </div>
380
383
  <div className="timeline-content">{ev.content || ev.desc}</div>
381
384
  </div>
382
385
  ))}
@@ -1395,15 +1398,18 @@ export function Tabs({ items = [], children }) {
1395
1398
  Tabs.displayName = 'Tabs';
1396
1399
 
1397
1400
  /**
1398
- * Enlarged reader for a diagram. It re-renders the chart under a fresh id so
1399
- * the full-size copy never collides with the inline SVG, then hands the result
1400
- * to the shared zoom overlay (wheel zoom, drag to pan, Esc to close).
1401
+ * The drawing inside the full-size reader. A diagram is a vector, so enlarging
1402
+ * it has to change its layout size: a CSS `scale()` on the wrapper only
1403
+ * stretches the layer the browser already rasterised, which is what makes a
1404
+ * chart look like a blurry bitmap while it grows. The SVG therefore carries its
1405
+ * own viewBox size (`--diagram-w`, `--diagram-ratio`) and the reader multiplies
1406
+ * that width by the current zoom; panning still rides a transform, because a
1407
+ * translation never resamples.
1401
1408
  */
1402
- function MermaidZoom({ chart, title, onClose }) {
1409
+ function DiagramCanvas({ chart, zoom, onError }) {
1403
1410
  const ref = React.useRef(null);
1404
- const [error, setError] = React.useState('');
1405
1411
 
1406
- React.useEffect(() => {
1412
+ React.useLayoutEffect(() => {
1407
1413
  if (!ref.current) return;
1408
1414
  const source = chart.trim();
1409
1415
  if (!source) return;
@@ -1414,19 +1420,40 @@ function MermaidZoom({ chart, title, onClose }) {
1414
1420
  responsive: false
1415
1421
  });
1416
1422
  ref.current.innerHTML = svg;
1417
- setError('');
1423
+ const el = ref.current.querySelector('svg');
1424
+ const box = el?.viewBox?.baseVal;
1425
+ const width = box?.width || Number(el?.getAttribute('width')) || 0;
1426
+ const height = box?.height || Number(el?.getAttribute('height')) || 0;
1427
+ if (el && width > 0 && height > 0) {
1428
+ el.style.setProperty('--diagram-w', `${width}px`);
1429
+ el.style.setProperty('--diagram-ratio', String(width / height));
1430
+ }
1431
+ onError('');
1418
1432
  } catch (err) {
1419
- setError(err.message || '图表语法错误');
1433
+ onError(err.message || '图表语法错误');
1420
1434
  }
1421
- }, [chart]);
1435
+ }, [chart, onError]);
1436
+
1437
+ return <div className="mermaid-zoom-canvas" ref={ref} style={{ '--zoom': zoom }} />;
1438
+ }
1439
+
1440
+ /**
1441
+ * Enlarged reader for a diagram. It re-renders the chart under a fresh id so
1442
+ * the full-size copy never collides with the inline SVG, then hands the result
1443
+ * to the shared zoom overlay (wheel zoom, drag to pan, Esc to close).
1444
+ */
1445
+ function MermaidZoom({ chart, title, onClose }) {
1446
+ const [error, setError] = React.useState('');
1422
1447
 
1423
1448
  return (
1424
- <ZoomOverlay title={title || '关系草图'} caption={title} onClose={onClose}>
1425
- {error ? (
1426
- <pre className="mermaid-error">{error}</pre>
1427
- ) : (
1428
- <div className="mermaid-zoom-canvas" ref={ref} />
1429
- )}
1449
+ <ZoomOverlay title={title || '关系草图'} caption={title} onClose={onClose} vector>
1450
+ {scale =>
1451
+ error ? (
1452
+ <pre className="mermaid-error">{error}</pre>
1453
+ ) : (
1454
+ <DiagramCanvas chart={chart} zoom={scale} onError={setError} />
1455
+ )
1456
+ }
1430
1457
  </ZoomOverlay>
1431
1458
  );
1432
1459
  }
@@ -1726,6 +1753,7 @@ export function Chart({
1726
1753
  y = 0,
1727
1754
  position = 'flow'
1728
1755
  }) {
1756
+ const safeType = ['bar', 'line', 'pie'].includes(type) ? type : 'bar';
1729
1757
  const points = normalizePoints(data);
1730
1758
  const seriesList = (Array.isArray(series) ? series : []).filter(Boolean).map((entry, index) => ({
1731
1759
  name: entry.name || entry.label || `系列 ${index + 1}`,
@@ -1746,7 +1774,7 @@ export function Chart({
1746
1774
  const ticks = [0, 0.25, 0.5, 0.75, 1].map(ratio => ({ ratio, value: max * ratio }));
1747
1775
 
1748
1776
  const body = (() => {
1749
- if (type === 'pie') {
1777
+ if (safeType === 'pie') {
1750
1778
  if (!points.length) return null;
1751
1779
  const total = points.reduce((sum, point) => sum + Math.max(0, point.value), 0) || 1;
1752
1780
  const radius = Math.min(innerW, innerH) / 2;
@@ -1804,7 +1832,7 @@ export function Chart({
1804
1832
  </g>
1805
1833
  );
1806
1834
 
1807
- if (type === 'line') {
1835
+ if (safeType === 'line') {
1808
1836
  const count = Math.max(1, seriesList[0]?.values.length || 0, labels.length);
1809
1837
  const stepX = count > 1 ? innerW / (count - 1) : 0;
1810
1838
  const xFor = idx => PAD.left + idx * stepX;
@@ -1925,7 +1953,7 @@ export function Chart({
1925
1953
  <div className="semantic-widget-head">
1926
1954
  <span>{title}</span>
1927
1955
  <code>
1928
- CHART · {type.toUpperCase()}
1956
+ CHART · {safeType.toUpperCase()}
1929
1957
  {unit ? ` · ${unit}` : ''}
1930
1958
  </code>
1931
1959
  </div>
@@ -1961,7 +1989,7 @@ const clampScale = value => Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, +value.toFixed
1961
1989
  * fixed` would otherwise be contained by them). Supports wheel zoom, drag to
1962
1990
  * pan, double-click to toggle 1x/2x, and Escape to close.
1963
1991
  */
1964
- function ZoomOverlay({ title, caption, label, onClose, children }) {
1992
+ function ZoomOverlay({ title, caption, label, onClose, children, vector = false }) {
1965
1993
  const [scale, setScale] = React.useState(1);
1966
1994
  const [offset, setOffset] = React.useState({ x: 0, y: 0 });
1967
1995
  const [dragging, setDragging] = React.useState(false);
@@ -1971,6 +1999,9 @@ function ZoomOverlay({ title, caption, label, onClose, children }) {
1971
1999
  const movedRef = React.useRef(false);
1972
2000
  const scaleRef = React.useRef(scale);
1973
2001
  scaleRef.current = scale;
2002
+ // A vector target (a rendered diagram) receives the zoom as a number and
2003
+ // resizes itself; only a raster target (an image) is scaled as a layer.
2004
+ const content = typeof children === 'function' ? children(scale) : children;
1974
2005
 
1975
2006
  const zoomBy = React.useCallback(delta => setScale(value => clampScale(value + delta)), []);
1976
2007
  const reset = React.useCallback(() => {
@@ -2080,9 +2111,13 @@ function ZoomOverlay({ title, caption, label, onClose, children }) {
2080
2111
  >
2081
2112
  <div
2082
2113
  className="image-zoom-target"
2083
- style={{ transform: `translate(${offset.x}px, ${offset.y}px) scale(${scale})` }}
2114
+ style={
2115
+ vector
2116
+ ? { transform: `translate(${offset.x}px, ${offset.y}px)` }
2117
+ : { transform: `translate(${offset.x}px, ${offset.y}px) scale(${scale})` }
2118
+ }
2084
2119
  >
2085
- {children}
2120
+ {content}
2086
2121
  </div>
2087
2122
  </div>
2088
2123
  {title && (
@@ -2119,9 +2154,19 @@ function ZoomOverlay({ title, caption, label, onClose, children }) {
2119
2154
 
2120
2155
  function ImageZoom({ src, alt, caption, label, onClose }) {
2121
2156
  const title = alt || caption || '图片';
2157
+ const imgRef = React.useRef(null);
2158
+ // An SVG authored without width/height has no intrinsic width, so `width:auto`
2159
+ // inside the shrink-to-fit stage resolves to 0 and the reader opens empty.
2160
+ // Such an image gets the viewer's width instead; a bitmap keeps its own.
2161
+ const sizeSizelessImage = () => {
2162
+ const img = imgRef.current;
2163
+ if (!img || !img.complete || !img.naturalWidth) return;
2164
+ if (img.getBoundingClientRect().width > 0) return;
2165
+ img.style.width = 'min(94vw, 1800px)';
2166
+ };
2122
2167
  return (
2123
2168
  <ZoomOverlay title={title} caption={caption || alt} label={label} onClose={onClose}>
2124
- <img src={src} alt={alt || ''} draggable="false" />
2169
+ <img ref={imgRef} src={src} alt={alt || ''} draggable="false" onLoad={sizeSizelessImage} />
2125
2170
  </ZoomOverlay>
2126
2171
  );
2127
2172
  }
@@ -1 +1 @@
1
- export * from './MDXComponents.jsx';
1
+ export * from './MDXComponents.jsx';
@@ -1,16 +1,16 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom/client';
3
- import { App } from './app/App.jsx';
4
- import * as Components from './components/index.js';
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import { App } from './app/App.jsx';
4
+ import * as Components from './components/index.js';
5
5
  import UserDocument from '@concept-atlas/content';
6
-
7
- // Mount MDX application to DOM
8
- const rootElement = document.getElementById('root') || document.getElementById('app');
9
- if (rootElement) {
10
- const root = ReactDOM.createRoot(rootElement);
11
- root.render(
12
- <React.StrictMode>
6
+
7
+ // Mount MDX application to DOM
8
+ const rootElement = document.getElementById('root') || document.getElementById('app');
9
+ if (rootElement) {
10
+ const root = ReactDOM.createRoot(rootElement);
11
+ root.render(
12
+ <React.StrictMode>
13
13
  <App mdxContent={<UserDocument components={Components} />} />
14
- </React.StrictMode>
15
- );
16
- }
14
+ </React.StrictMode>
15
+ );
16
+ }
@@ -162,7 +162,7 @@ function parseConceptNode(nodeElement) {
162
162
  case 'Implementation':
163
163
  node.implementation = {
164
164
  language: child.props.language || 'text',
165
- title: child.props.title || '代码实现',
165
+ title: child.props.title || '实现代码',
166
166
  code: child.props.children
167
167
  };
168
168
  break;
@@ -174,13 +174,13 @@ function parseConceptNode(nodeElement) {
174
174
  break;
175
175
  case 'Counterexample':
176
176
  node.counterexamples.push({
177
- title: child.props.title || '边界反例 / 常见误区',
177
+ title: child.props.title || '反例与误区',
178
178
  content: child.props.children
179
179
  });
180
180
  break;
181
181
  case 'Boundary':
182
182
  node.boundaries.push({
183
- title: child.props.title || '边界条件 / 约束',
183
+ title: child.props.title || '边界与约束',
184
184
  content: child.props.children
185
185
  });
186
186
  break;
@@ -117,9 +117,11 @@ export const LARGE_ASSET_BYTES = 512 * 1024;
117
117
  export const ARRAY_PROPS = {
118
118
  Flow: ['steps'],
119
119
  Timeline: ['events'],
120
+ ScrollToc: ['items'],
120
121
  FrameworkModel: ['elements'],
121
122
  MatrixModel: ['cells'],
122
123
  FormulaModel: ['variables'],
124
+ MathBlock: ['variables'],
123
125
  PyramidModel: ['levels'],
124
126
  FunnelModel: ['steps'],
125
127
  DecisionMatrix: ['headers', 'rows'],
@@ -136,7 +138,7 @@ export const ARRAY_PROPS = {
136
138
  RelationMap: ['items'],
137
139
  RelationPath: ['steps'],
138
140
  References: ['items'],
139
- Chart: ['data', 'series'],
141
+ Chart: ['data', 'series', 'labels'],
140
142
  DataTable: ['headers', 'rows'],
141
143
  StateMachine: ['states', 'transitions'],
142
144
  KeyTakeaways: ['items'],
@@ -369,6 +371,14 @@ function attrValue(map, name) {
369
371
  return attr.value;
370
372
  }
371
373
 
374
+ /** Matches the build-time asset plugin's boolean prop handling. */
375
+ function attrTruthy(attr) {
376
+ if (!attr) return false;
377
+ if (!attr.hasValue) return true;
378
+ const value = String(attr.value).trim();
379
+ return value !== 'false' && value !== '0';
380
+ }
381
+
372
382
  /**
373
383
  * Statically validate a Concept Atlas MDX document without rendering React.
374
384
  * Works in Node (CLI) and in the browser (registry only).
@@ -478,6 +488,7 @@ export function validateMdxSource(source, options = {}) {
478
488
  const map = attrsToMap(tag.attrs);
479
489
  const src = attrValue(map, 'src');
480
490
  const quoted = map.src ? map.src.quoted : false;
491
+ const inlineRequested = map.inline ? attrTruthy(map.inline) : inlineAssets;
481
492
  const figureId = attrValue(map, 'id');
482
493
  if (figureId) {
483
494
  if (figureIds.has(figureId))
@@ -497,7 +508,7 @@ export function validateMdxSource(source, options = {}) {
497
508
  const resolved = src.startsWith('.') ? src : `./${src}`;
498
509
  if (!assetExists(resolved)) {
499
510
  add('warning', 'ASSET_MISSING', `找不到图片文件:${src}(将显示占位符)`, tag.start, src);
500
- } else if (inlineAssets && assetSize) {
511
+ } else if (inlineRequested && assetSize) {
501
512
  const bytes = assetSize(resolved);
502
513
  if (typeof bytes === 'number' && bytes > LARGE_ASSET_BYTES) {
503
514
  add(
@@ -92,8 +92,15 @@ button:focus-visible, a:focus-visible, [role="button"]:focus-visible {
92
92
  /* Optional semantic layout primitives */
93
93
  .semantic-stack { display: flex; flex-direction: column; }
94
94
  .semantic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
95
+ .semantic-grid.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
96
+ .semantic-grid.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
97
+ .semantic-grid.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
95
98
  .semantic-split { display: grid; grid-template-columns: var(--split-ratio, 1fr 1fr); align-items: start; }
96
99
  .gap-sm { gap: 8px; } .gap-md { gap: 16px; } .gap-lg { gap: 28px; }
100
+ .timeline-time { margin-left: 8px; color: var(--text-muted); font-size: 11px; }
101
+ @media (max-width: 720px) {
102
+ .semantic-grid.grid-2, .semantic-grid.grid-3, .semantic-grid.grid-4 { grid-template-columns: 1fr; }
103
+ }
97
104
  .semantic-tabs details { border-bottom: 1px solid var(--border-subtle); padding: 8px 0; }
98
105
  .semantic-tabs summary { cursor: pointer; font-weight: 700; color: var(--text-primary); }
99
106
  .mermaid-tools { display: inline-flex; align-items: center; gap: 6px; }
@@ -3885,6 +3892,9 @@ html[data-carrier='scroll'] #root {
3885
3892
  display: grid;
3886
3893
  place-items: center;
3887
3894
  padding: 28px;
3895
+ /* How much of the viewport a full-size diagram may fill; the reader's fit
3896
+ math and the small-screen override both read it. */
3897
+ --zoom-fit-h: 84vh;
3888
3898
  background: var(--overlay-scrim);
3889
3899
  /* Clip at the viewport, not at the media box: the zoom transform does not
3890
3900
  change layout size, so a stage-sized clip would only ever reveal what the
@@ -3928,12 +3938,19 @@ html[data-carrier='scroll'] #root {
3928
3938
  .image-zoom-stage.is-dragging .image-zoom-target { transition: none; }
3929
3939
 
3930
3940
  /* A diagram keeps its natural aspect inside the viewer and paints on the
3931
- diagram canvas tone, so labels stay legible over the dark scrim. */
3941
+ diagram canvas tone, so labels stay legible over the dark scrim. It is a
3942
+ vector: the reader multiplies its layout width by `--zoom` (a number handed
3943
+ down by ZoomOverlay) instead of scaling a rasterised layer, so every step of
3944
+ the zoom re-renders sharp. `--diagram-w` / `--diagram-ratio` come from the
3945
+ SVG's own viewBox: the fit fills the viewport, never past twice the natural
3946
+ width, and a tall chart is bounded by the height instead — so opening a
3947
+ narrow chart no longer paints a wide empty slab. */
3932
3948
  .mermaid-zoom-canvas svg {
3933
3949
  display: block;
3934
- width: min(94vw, 1800px);
3950
+ width: calc(min(94vw, calc(var(--diagram-w, 1800px) * 2), calc(var(--zoom-fit-h, 84vh) * var(--diagram-ratio, 1.78))) * var(--zoom, 1));
3935
3951
  height: auto;
3936
- max-height: 84vh;
3952
+ max-width: none;
3953
+ max-height: none;
3937
3954
  border-radius: var(--radius-3);
3938
3955
  background: var(--pele-bg);
3939
3956
  box-shadow: var(--shadow-modal);
@@ -4000,9 +4017,8 @@ html[data-carrier='scroll'] #root {
4000
4017
  }
4001
4018
 
4002
4019
  @media (max-width: 760px) {
4003
- .image-zoom-overlay { padding: 12px; }
4020
+ .image-zoom-overlay { padding: 12px; --zoom-fit-h: 74vh; }
4004
4021
  .image-zoom-stage img { max-height: 74vh; }
4005
- .mermaid-zoom-canvas svg { max-height: 74vh; }
4006
4022
  .image-zoom-caption { top: 10px; font-size: 12px; }
4007
4023
  }
4008
4024
 
@@ -32,11 +32,20 @@ const MARKDOWN_IMAGE_RE = /!\[([^\]]*)\]\(([^)\s]+)(\s+["'][^"']*["'])?\)/g;
32
32
  * mistaken for the prop itself.
33
33
  */
34
34
  function readInlineProp(tag) {
35
- const stripped = tag.replace(/"[^"]*"|'[^']*'/g, '""');
36
- const match = stripped.match(/\binline\b(?:\s*=\s*(\{[^}]*\}|[^\s/>]+))?/);
37
- if (!match) return null;
38
- if (match[1] === undefined) return true;
39
- return match[1].replace(/^\{|\}$/g, '').trim() !== 'false';
35
+ // Consume whole attribute values so an `inline` word inside `title="..."` or
36
+ // another quoted string cannot be mistaken for the prop itself.
37
+ const attr = /([:\w-]+)(?:\s*=\s*(\{[^}]*\}|"[^"]*"|'[^']*'|[^\s/>]+))?/g;
38
+ for (const match of tag.matchAll(attr)) {
39
+ if (match[1] !== 'inline') continue;
40
+ if (match[2] === undefined) return true;
41
+ let value = match[2]
42
+ .trim()
43
+ .replace(/^\{|\}$/g, '')
44
+ .trim();
45
+ if (/^(["']).*\1$/.test(value)) value = value.slice(1, -1);
46
+ return value !== 'false' && value !== '0';
47
+ }
48
+ return null;
40
49
  }
41
50
 
42
51
  /**