reactive-md 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +96 -0
- package/CHANGELOG.md +82 -39
- package/CONTRIBUTING-ch.md +62 -0
- package/CONTRIBUTING.md +64 -65
- package/README-ch.md +122 -0
- package/README-en.md +146 -0
- package/README.md +146 -89
- package/SECURITY-ch.md +80 -0
- package/SECURITY.md +58 -49
- package/THIRD_PARTY_NOTICES.md +85 -1
- package/bin/reactive-md.mjs +40 -0
- package/cli/args.mjs +181 -0
- package/cli/assets.mjs +390 -0
- package/cli/build.mjs +268 -0
- package/cli/document.mjs +130 -0
- package/cli/errors.mjs +61 -0
- package/cli/fs-utils.mjs +133 -0
- package/cli/glob.mjs +203 -0
- package/cli/help.mjs +138 -0
- package/cli/lint.mjs +177 -0
- package/cli/main.mjs +55 -0
- package/cli/migrate.mjs +368 -0
- package/cli/package.mjs +209 -0
- package/dist-library/reactive-md-react.js +3425 -1647
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +1798 -4
- package/dist-library/runtime-DtjdPXxJ.js +15410 -0
- package/dist-library/types/index.d.ts +1 -0
- package/dist-library/types/local/LocalDocumentView.d.ts +66 -3
- package/dist-library/types/local/authoring.d.ts +63 -0
- package/dist-library/types/local/collection-functions.d.ts +4 -0
- package/dist-library/types/local/colors.d.ts +2 -0
- package/dist-library/types/local/computations.d.ts +53 -0
- package/dist-library/types/local/data-functions.d.ts +22 -0
- package/dist-library/types/local/data-table.d.ts +65 -0
- package/dist-library/types/local/dates.d.ts +2 -0
- package/dist-library/types/local/dependencies.d.ts +31 -0
- package/dist-library/types/local/diagnostics.d.ts +1450 -0
- package/dist-library/types/local/expression.d.ts +13 -3
- package/dist-library/types/local/formatting.d.ts +41 -0
- package/dist-library/types/local/heading-anchors.d.ts +13 -2
- package/dist-library/types/local/i18n.d.ts +18 -0
- package/dist-library/types/local/index.d.ts +18 -1
- package/dist-library/types/local/limits.d.ts +32 -1
- package/dist-library/types/local/locale.d.ts +1 -0
- package/dist-library/types/local/math.d.ts +6 -1
- package/dist-library/types/local/parser.d.ts +10 -4
- package/dist-library/types/local/render-types.d.ts +5 -1
- package/dist-library/types/local/retention.d.ts +23 -0
- package/dist-library/types/local/schema.d.ts +25 -3
- package/dist-library/types/local/source-migration.d.ts +35 -0
- package/dist-library/types/local/state.d.ts +80 -0
- package/dist-library/types/local/text-length.d.ts +13 -0
- package/dist-library/types/local/theme.d.ts +30 -0
- package/dist-library/types/local/types.d.ts +112 -4
- package/dist-library/types/local/validation.d.ts +32 -0
- package/dist-library/types/local/version.d.ts +1 -1
- package/dist-library/types/local/worker.d.ts +82 -0
- package/dist-library/types/react/index.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +64 -0
- package/dist-standalone/reactive-md-standalone.css +2 -0
- package/dist-standalone/reactive-md-standalone.js +57 -0
- package/docs/author-tools-ch.md +56 -0
- package/docs/author-tools-en.md +56 -0
- package/docs/compatibility-ch.md +103 -0
- package/docs/compatibility-en.md +103 -0
- package/docs/{component-development.md → component-development-ch.md} +210 -206
- package/docs/component-development-en.md +210 -0
- package/docs/{component-protocol.md → component-protocol-ch.md} +710 -685
- package/docs/component-protocol-en.md +710 -0
- package/docs/computations-formatting-ch.md +87 -0
- package/docs/computations-formatting-en.md +87 -0
- package/docs/constraints-collections-ch.md +84 -0
- package/docs/constraints-collections-en.md +84 -0
- package/docs/diagnostics-counting-ch.md +84 -0
- package/docs/diagnostics-counting-en.md +84 -0
- package/docs/local-components-v2-ch.md +138 -0
- package/docs/local-components-v2-en.md +104 -0
- package/docs/{local-guide.md → local-guide-ch.md} +28 -8
- package/docs/local-guide-en.md +961 -0
- package/docs/local-integration-ch.md +363 -0
- package/docs/local-integration-en.md +363 -0
- package/docs/{local-interaction-syntax.md → local-interaction-syntax-ch.md} +66 -20
- package/docs/local-interaction-syntax-en.md +483 -0
- package/docs/{performance.md → performance-ch.md} +12 -3
- package/docs/performance-en.md +76 -0
- package/docs/release-0.4.0-ch.md +89 -0
- package/docs/release-0.4.0-en.md +89 -0
- package/docs/releasing-ch.md +101 -0
- package/docs/releasing-en.md +101 -0
- package/docs/shareable-export-ch.md +205 -0
- package/docs/shareable-export-en.md +207 -0
- package/docs/source-versioning-ch.md +159 -0
- package/docs/source-versioning-en.md +159 -0
- package/docs/theme-protocol-ch.md +107 -0
- package/docs/theme-protocol-en.md +107 -0
- package/examples/conformance/README.md +33 -31
- package/examples/conformance/component-protocol-1.json +482 -194
- package/examples/conformance/component-protocol-1.schema.json +76 -76
- package/examples/conformance/history/v0.3.1/catalog.reactive.md +20 -0
- package/examples/conformance/history/v0.3.1/charts.reactive.md +73 -0
- package/examples/conformance/history/v0.3.1/checklist.reactive.md +32 -0
- package/examples/conformance/history/v0.3.1/comparison.reactive.md +47 -0
- package/examples/conformance/history/v0.3.1/components.reactive.md +44 -0
- package/examples/conformance/history/v0.3.1/counter.reactive.md +7 -0
- package/examples/conformance/history/v0.3.1/diagnostics.reactive.md +54 -0
- package/examples/conformance/history/v0.3.1/diagram.reactive.md +44 -0
- package/examples/conformance/history/v0.3.1/gallery.reactive.md +61 -0
- package/examples/conformance/history/v0.3.1/local-draft-1.json +50 -0
- package/examples/conformance/history/v0.3.1/parameters.reactive.md +36 -0
- package/examples/conformance/history/v0.3.1/planning.reactive.md +24 -0
- package/examples/conformance/history/v0.3.1/pricing.reactive.md +20 -0
- package/examples/conformance/history/v0.3.1/provenance.json +72 -0
- package/examples/conformance/local-draft-2.json +212 -0
- package/examples/integration/README.md +45 -29
- package/examples/integration/core/index.mjs +32 -19
- package/examples/integration/react/index.html +1 -1
- package/examples/integration/react/main.jsx +5 -5
- package/examples/integration/worker/index.html +19 -0
- package/examples/integration/worker/main.js +61 -0
- package/examples/integration/worker/package.json +13 -0
- package/examples/integration/worker/worker.js +3 -0
- package/examples/local/README.md +64 -58
- package/examples/local/catalog.reactive.md +14 -14
- package/examples/local/charts.reactive.md +34 -34
- package/examples/local/checklist.reactive.md +19 -19
- package/examples/local/comparison.reactive.md +23 -23
- package/examples/local/components.reactive.md +20 -20
- package/examples/local/counter.reactive.md +4 -4
- package/examples/local/diagnostics.reactive.md +25 -25
- package/examples/local/diagram.reactive.md +20 -20
- package/examples/local/gallery.reactive.md +31 -31
- package/examples/local/parameters.reactive.md +19 -19
- package/examples/local/planning.reactive.md +15 -15
- package/examples/local/pricing.reactive.md +10 -10
- package/examples/local/recipes/invoice-zh.reactive.md +36 -0
- package/examples/local/recipes/invoice.reactive.md +36 -0
- package/examples/local/recipes/workshop-zh.reactive.md +33 -0
- package/examples/local/recipes/workshop.reactive.md +33 -0
- package/examples/local/showcase/README.md +25 -0
- package/examples/local/showcase/explore.reactive.md +102 -0
- package/examples/local/showcase/flow.reactive.md +86 -0
- package/examples/local/showcase/forms.reactive.md +126 -0
- package/examples/local/showcase/functions.reactive.md +119 -0
- package/examples/local/showcase/layout.reactive.md +100 -0
- package/examples/local/showcase/statistics.reactive.md +108 -0
- package/examples/local/showcase/tasks.reactive.md +89 -0
- package/examples/local/showcase/zh/explore.reactive.md +102 -0
- package/examples/local/showcase/zh/flow.reactive.md +86 -0
- package/examples/local/showcase/zh/forms.reactive.md +126 -0
- package/examples/local/showcase/zh/functions.reactive.md +119 -0
- package/examples/local/showcase/zh/layout.reactive.md +100 -0
- package/examples/local/showcase/zh/statistics.reactive.md +108 -0
- package/examples/local/showcase/zh/tasks.reactive.md +89 -0
- package/examples/local/zh/catalog.reactive.md +20 -0
- package/examples/local/zh/charts.reactive.md +73 -0
- package/examples/local/zh/checklist.reactive.md +32 -0
- package/examples/local/zh/comparison.reactive.md +47 -0
- package/examples/local/zh/components.reactive.md +44 -0
- package/examples/local/zh/counter.reactive.md +7 -0
- package/examples/local/zh/diagnostics.reactive.md +54 -0
- package/examples/local/zh/diagram.reactive.md +44 -0
- package/examples/local/zh/gallery.reactive.md +61 -0
- package/examples/local/zh/parameters.reactive.md +36 -0
- package/examples/local/zh/planning.reactive.md +24 -0
- package/examples/local/zh/pricing.reactive.md +20 -0
- package/package.json +16 -3
- package/README.en.md +0 -76
- package/dist-library/runtime-CPzMEMcW.js +0 -11111
- package/docs/compatibility.md +0 -68
- package/docs/local-integration.md +0 -218
- package/docs/releasing.md +0 -92
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Reactive MD theme protocol
|
|
2
|
+
|
|
3
|
+
Protocol revision: `reactive-md-theme-1`. This feature ships in `0.4.0`, the preview release on the `next` channel. The built-in `default` preserves the existing appearance.
|
|
4
|
+
|
|
5
|
+
## Selecting a theme
|
|
6
|
+
|
|
7
|
+
Place a declaration before the document body:
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
<theme name="default">
|
|
11
|
+
|
|
12
|
+
# Document title
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`<theme name="default" />` is also accepted. Omission selects `default`. Whitespace, a BOM and comments may precede the declaration. Declare it once, outside components. The static `name` uses lowercase kebab-case, starts with a letter and has at most 64 characters. Expressions and additional attributes are invalid.
|
|
16
|
+
|
|
17
|
+
The declaration is document metadata, does not count as a component and produces no visible element. Compilation stores `document.theme` and the original declaration's `document.themeRange`. Body nodes retain their original source positions. Fenced code, inline code, comments and escaped examples remain literal.
|
|
18
|
+
|
|
19
|
+
Invalid declarations produce `local.theme.*` warnings and select `default`. Repeated declarations do not change the first selection. Late or nested declarations do not select a theme. Healthy body content and controls remain usable.
|
|
20
|
+
|
|
21
|
+
## Host registration
|
|
22
|
+
|
|
23
|
+
A developer supplies CSS and registration metadata. Import the shared styles before the theme stylesheet, then pass the allowed themes to the renderer:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { LOCAL_THEME_PROTOCOL, type LocalThemeDefinition } from 'reactive-md';
|
|
27
|
+
import { LocalReactiveDocument } from 'reactive-md/react';
|
|
28
|
+
import 'reactive-md/styles.css';
|
|
29
|
+
import './paper-theme.css';
|
|
30
|
+
|
|
31
|
+
const paperTheme = {
|
|
32
|
+
name: 'paper',
|
|
33
|
+
protocol: LOCAL_THEME_PROTOCOL,
|
|
34
|
+
colorSchemes: ['light', 'dark'],
|
|
35
|
+
} as const satisfies LocalThemeDefinition;
|
|
36
|
+
|
|
37
|
+
export function Article({ source }: { source: string }) {
|
|
38
|
+
return <LocalReactiveDocument source={source} themes={[paperTheme]} colorScheme="auto" />;
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This demonstrates registration. The repository includes only `default`; it does not include a `paper` design or stylesheet.
|
|
43
|
+
|
|
44
|
+
| Field | Requirement |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `name` | Follows the document identifier rules; unique in the host list; `default` is reserved |
|
|
47
|
+
| `protocol` | Must be `reactive-md-theme-1`; use `LOCAL_THEME_PROTOCOL` |
|
|
48
|
+
| `colorSchemes` | Must include both `light` and `dark` |
|
|
49
|
+
|
|
50
|
+
The host loads the CSS. Registration does not fetch or inject styles. Documents select a registered name and cannot provide CSS, stylesheet URLs or scripts. Theme CSS is trusted host code; the host reviews its scope and resource references.
|
|
51
|
+
|
|
52
|
+
An unknown name, duplicate selected name, invalid selected registration, unsupported protocol or missing mode produces a renderer warning and falls back to `default`. Core-only hosts can call `resolveLocalTheme(name, themes, range?, source?)` to obtain `{ name, diagnostics }`. Compilation parses declarations independently of host registrations.
|
|
53
|
+
|
|
54
|
+
## Color schemes and instance scope
|
|
55
|
+
|
|
56
|
+
Both React components accept `themes` and `colorScheme`. The theme selects the visual design; the color scheme selects its light or dark version:
|
|
57
|
+
|
|
58
|
+
| Value | Behavior |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| `light` | Forces light mode for this document, including inside a dark host |
|
|
61
|
+
| `dark` | Forces dark mode for this document |
|
|
62
|
+
| `auto` (default) | Uses the nearest ancestor's explicit preference, then the system preference; server output starts in light mode |
|
|
63
|
+
|
|
64
|
+
Ancestor preferences support `data-color-scheme="light|dark"` and the existing `data-theme="light|dark"`. Ancestor attribute changes and system preference changes update the document in the browser. An explicit local `colorScheme` takes precedence.
|
|
65
|
+
|
|
66
|
+
The renderer exposes the resolved selection on its document root:
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<article class="md-document local-document"
|
|
70
|
+
data-rmd-theme="paper"
|
|
71
|
+
data-color-scheme="dark">
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Each instance chooses independently. Every theme rule must be scoped to its named root or descendants, for example `[data-rmd-theme="paper"][data-color-scheme="dark"]`. Global `body`, `:root` and unscoped element rules must not affect the host.
|
|
75
|
+
|
|
76
|
+
Changing `themes` or `colorScheme` does not create a runtime. Changing `LocalReactiveDocument.source` retains its existing behavior: recompilation and a new runtime. Hosts that retain parameters across source changes can manage `LocalDocumentView` and its runtime themselves.
|
|
77
|
+
|
|
78
|
+
## Shared style variables
|
|
79
|
+
|
|
80
|
+
Shared component CSS supplies structure, interaction and defaults. Custom themes inherit a complete default variable set and override the values they need. Both light and dark variants must be designed and checked.
|
|
81
|
+
|
|
82
|
+
| Purpose | Public variables |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| Surfaces | `--paper`, `--surface`, `--document-bg` (defaults to `--surface`), `--surface-subtle`, `--surface-hover`, `--surface-active` |
|
|
85
|
+
| Text and borders | `--ink`, `--ink-soft`, `--ink-muted`, `--line`, `--line-strong` |
|
|
86
|
+
| Accent | `--accent`, `--accent-hover`, `--accent-soft`, `--accent-line` |
|
|
87
|
+
| Status | `--info`, `--info-soft`, `--success`, `--success-soft`, `--success-line`, `--warning`, `--warning-soft`, `--warning-line`, `--danger`, `--danger-soft`, `--danger-line`, `--neutral-soft` |
|
|
88
|
+
| Focus | `--focus`, `--focus-outline`, `--focus-ring` |
|
|
89
|
+
| Data and code | `--chart-1` through `--chart-8`, `--chart-grid`, `--chart-axis`, `--code-bg`, `--code-bg-deep`, `--code-ink` |
|
|
90
|
+
| Fonts | `--font-sans`, `--font-mono`, `--text-xs` through `--text-xl`, `--text-2xl`, `--text-block-title`, `--text-block-subtitle` |
|
|
91
|
+
| Line height and weight | `--leading-tight`, `--leading-snug`, `--leading-normal`, `--leading-relaxed`, `--weight-regular`, `--weight-medium`, `--weight-semibold`, `--weight-bold` |
|
|
92
|
+
| Spacing | `--space-1` through `--space-7`, `--field-gap` |
|
|
93
|
+
| Radius | `--radius-control`, `--radius-card`, `--radius-panel`, `--radius-pill` |
|
|
94
|
+
| Controls | `--control-height-sm`, `--control-height`, `--control-height-lg`, `--control-padding-x`, `--control-padding-y`, `--disabled-opacity` |
|
|
95
|
+
| Motion and elevation | `--motion-fast`, `--motion-base`, `--motion-slow`, `--ease-standard`, `--shadow-sm`, `--shadow-md` |
|
|
96
|
+
|
|
97
|
+
Existing `--blue`, `--blue-deep`, `--blue-soft` and `--blue-line` remain compatible. New themes should use the accent variables. Explicit component `color` attributes override their corresponding local color; other properties continue to use the theme. Series and status colors retain their semantic roles.
|
|
98
|
+
|
|
99
|
+
## Component CSS and acceptance
|
|
100
|
+
|
|
101
|
+
Themes can supplement variable overrides with existing `.md-*` and `.local-*` component classes. Root classes, component outer classes and semantic state attributes are styling interfaces; internal node ordering is not an extension API. Load scoped theme rules after the shared stylesheet, using sufficiently specific root and component selectors instead of relying on `!important`.
|
|
102
|
+
|
|
103
|
+
Coverage includes Markdown, tables, formulas, controls, containers, feedback, charts and diagrams. New components must consume shared variables and work with `default`. Themes without dedicated rules for a new component inherit its shared styles.
|
|
104
|
+
|
|
105
|
+
A conforming theme must check every component in both modes, including hover, focus, active, disabled, error and selection states. Preserve visible keyboard focus, readable text and controls, a usable 375px layout and reduced-motion preferences. Font changes require checking SVG diagram labels, nodes and bounds.
|
|
106
|
+
|
|
107
|
+
Registration validates protocol and declared modes. Browser acceptance verifies CSS coverage, contrast and layout. Include multiple isolated themes, forced light inside a dark host, system preference changes, retained interaction state and unmount cleanup.
|
|
@@ -1,51 +1,53 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Language conformance data
|
|
2
2
|
|
|
3
|
-
[local-draft-
|
|
3
|
+
[local-draft-2.json](local-draft-2.json) is a copyable minimal semantic conformance suite containing source documents, compilation results, initial parameters, state writes and expected text. The data is distributed with the npm package so other tools or implementations can read the same JSON.
|
|
4
4
|
|
|
5
|
-
- `syntaxVersion`
|
|
6
|
-
- `ok`
|
|
7
|
-
- `initial`
|
|
8
|
-
- `actions`
|
|
9
|
-
- `text`
|
|
5
|
+
- `syntaxVersion` matches the core export `LOCAL_SYNTAX_VERSION`.
|
|
6
|
+
- `ok` is the expected compilation result; `codes` is the deduplicated set of expected diagnostic codes, and when omitted no diagnostics are expected. A successful compile can still contain degradation warnings.
|
|
7
|
+
- `initial` checks the initial values of public parameters; `bindingNames`, when present, checks the complete set of binding names.
|
|
8
|
+
- `actions` finds controls by `bind` and submits `value`; when `codes` is present the write is expected to be rejected, otherwise it is expected to succeed.
|
|
9
|
+
- `text` is evaluated with the updated state and the result should equal `expectedText`.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The runner lives at `tests/conformance.test.ts` in the repository; run `npm test` to check it. This suite covers shared parameters, hidden initialization, write constraints, code isolation, diagnostics, multi-slot controls, multiple selection, generated-table selection and a computed-value aggregate recalculation. It does not cover validation hints, generated table rendering, HTML export, author tooling or browser behavior; those have dedicated tests and the release gate. Full syntax conformance also includes other language tests and browser checks, with rules in the [syntax specification](../../docs/local-interaction-syntax-en.md). See the [compatibility notes](../../docs/compatibility-en.md) for cross-version guarantees on diagnostic codes.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The conformance sources are unversioned and use the current `local-draft-2` revision. The optional prologue version declaration is compile metadata and does not change these semantic cases. Version rejection and migration behavior have dedicated tests and historical fixtures. See [Source revisions and migration](../../docs/source-versioning-en.md).
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## Component protocol conformance
|
|
16
|
+
|
|
17
|
+
[component-protocol-1.json](component-protocol-1.json) provides representative cases for the [component protocol](../../docs/component-protocol-en.md), covering `slider`, `tabs`, `plot` and lazy degradation of unknown components. The [JSON Schema](component-protocol-1.schema.json) defines the conformance file format so tools from other implementations can read it. This JSON is test input and expected results; see the [development guide](../../docs/component-development-en.md) for the declaration template of a component proposal.
|
|
16
18
|
|
|
17
19
|
```sh
|
|
18
20
|
npm run test:components
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
That command runs the component protocol cases and the existing language conformance data. A new component should add its own cases, unit tests and affected renderer checks; passing this suite only proves these specific cases pass.
|
|
22
24
|
|
|
23
|
-
###
|
|
25
|
+
### File and case fields
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
The file root object contains `protocolVersion`, `syntaxVersion` and a non-empty `cases` array. Currently these are `component-protocol-1` and `local-draft-2`. The package version is identified separately by `package.json` and is not inferred from these two fields.
|
|
26
28
|
|
|
27
|
-
|
|
|
29
|
+
| Field | Rule |
|
|
28
30
|
| --- | --- |
|
|
29
|
-
| `id` |
|
|
30
|
-
| `component` |
|
|
31
|
-
| `source` |
|
|
32
|
-
| `ok` |
|
|
33
|
-
| `codes` |
|
|
34
|
-
| `initial` |
|
|
35
|
-
| `bindingNames` |
|
|
36
|
-
| `actions` |
|
|
37
|
-
| `reset` |
|
|
38
|
-
| `text
|
|
39
|
-
| `htmlIncludes
|
|
31
|
+
| `id` | Required, unique within the file; describes one observable behavior |
|
|
32
|
+
| `component` | Required, names the component primarily under test; the source may use other components too |
|
|
33
|
+
| `source` | Required, the original document source |
|
|
34
|
+
| `ok` | Required, whether compilation is expected to succeed |
|
|
35
|
+
| `codes` | Required, the deduplicated set of compilation diagnostic codes; `[]` when there are none, order ignored, the set compared exactly |
|
|
36
|
+
| `initial` | Optional, initial state expectations after successful compilation, partially matched by the given keys |
|
|
37
|
+
| `bindingNames` | Optional, the complete set of public binding names; excludes internal state keys of anonymous components |
|
|
38
|
+
| `actions` | Optional, writes to named bindings in order; each entry requires `bind`, `value`, `codes` and may include `expectedState` |
|
|
39
|
+
| `reset` | Optional, resets the named node after the writes; requires `component` and `expectedState`, `index` defaults to the 0th in source order among components with that name |
|
|
40
|
+
| `text`, `expectedText` | Optional, must be paired; evaluated after writes and reset with the result compared exactly |
|
|
41
|
+
| `htmlIncludes`, `htmlExcludes` | Optional, performs React static rendering in the final state and checks each listed fragment is present or absent |
|
|
40
42
|
|
|
41
|
-
`initial
|
|
43
|
+
`initial` and `expectedState` values use the language's existing `LocalValue`: a string, finite number, boolean, `null` or string array. Public writable controls do not produce numeric arrays; numeric arrays are available to expressions and computed values. `actions[].codes` is the set of diagnostic codes returned by that write; still write `[]` when there are none. A rejected write should keep the last valid state. The runner finds compiled controls by `bind` and calls `runtime.set`; it does not simulate browser input events.
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
Execution order is fixed: validate the data format and unique IDs, compile and compare diagnostics, check the initial state and public binding names, perform writes in order, then reset, and finally check text and optional rendering results. Every created runtime is disposed at the end. Cases with `ok: false` may only use compile-time fields and cannot add state, action or rendering expectations; unknown fields, missing fields and invalid values should fail conformance.
|
|
44
46
|
|
|
45
|
-
`reset`
|
|
47
|
+
`reset` calls `runtime.reset(node)` on the current instance; nodes are found by component name and index, and the conformance file does not store `node.id`. This check verifies runtime reset semantics; clicking a reset button still needs a renderer or browser check.
|
|
46
48
|
|
|
47
|
-
###
|
|
49
|
+
### Portable scope
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
Compilation results, diagnostic sets, state changes and expression text are portable semantic expectations. HTML fragments only check this repository's React reference renderer; other renderers should verify equivalent user behavior and need not generate the same DOM or CSS class names.
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
These cases do not prove real keyboard operation, focus movement, Chinese input methods, 375px layout, timer pause, or timer cleanup after disposal. Contributions involving those behaviors still need corresponding browser evidence; see the [development guide](../../docs/component-development-en.md) for verification methods. Cross-version stability of diagnostic codes continues to follow the [compatibility notes](../../docs/compatibility-en.md).
|