reactive-md 0.3.1 → 0.4.1
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 +113 -0
- package/CHANGELOG.md +113 -53
- package/CONTRIBUTING-ch.md +62 -0
- package/CONTRIBUTING.md +64 -65
- package/LICENSE +21 -21
- package/README-ch.md +123 -0
- package/README-en.md +147 -0
- package/README.md +96 -38
- 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 +3525 -1651
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +1798 -4
- package/dist-library/runtime-D3QTVYaz.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/release-0.4.1-ch.md +23 -0
- package/docs/release-0.4.1-en.md +23 -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/core/package.json +7 -7
- package/examples/integration/react/index.html +12 -12
- package/examples/integration/react/main.jsx +21 -21
- package/examples/integration/react/package.json +9 -9
- 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 +20 -20
- package/examples/local/charts.reactive.md +34 -34
- package/examples/local/checklist.reactive.md +32 -32
- package/examples/local/comparison.reactive.md +47 -47
- package/examples/local/components.reactive.md +44 -44
- package/examples/local/counter.reactive.md +7 -7
- package/examples/local/diagnostics.reactive.md +54 -54
- package/examples/local/diagram.reactive.md +44 -44
- package/examples/local/gallery.reactive.md +61 -61
- package/examples/local/parameters.reactive.md +36 -36
- package/examples/local/planning.reactive.md +24 -24
- package/examples/local/pricing.reactive.md +20 -20
- 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 +91 -77
- 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
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
<slider bind="seats" label="
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
<number bind="seats" label="
|
|
14
|
-
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
<slider bind="ratio" label="
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
<if when="{{ seats }}">
|
|
22
|
-
|
|
23
|
-
</if>
|
|
24
|
-
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
<slidr label="
|
|
28
|
-
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
<counter label="
|
|
32
|
-
|
|
33
|
-
##
|
|
34
|
-
|
|
35
|
-
<diagram label="
|
|
36
|
-
<node id="input" label="
|
|
37
|
-
|
|
38
|
-
</node>
|
|
39
|
-
<edge from="input" to="missing">
|
|
40
|
-
</diagram>
|
|
41
|
-
|
|
42
|
-
##
|
|
43
|
-
|
|
44
|
-
<plot label="
|
|
45
|
-
$$ y = \int_0^x t^2\,dt $$
|
|
46
|
-
</plot>
|
|
47
|
-
|
|
48
|
-
##
|
|
49
|
-
|
|
50
|
-
<chart title="
|
|
51
|
-
|
|
|
52
|
-
| --- | ---: |
|
|
53
|
-
|
|
|
54
|
-
</chart>
|
|
1
|
+
# Diagnostics example
|
|
2
|
+
|
|
3
|
+
This document intentionally keeps errors to exercise the diagnostic messages. Start with the other documents in this folder for correct examples.
|
|
4
|
+
|
|
5
|
+
## Reference to a misspelled parameter name
|
|
6
|
+
|
|
7
|
+
<slider bind="seats" label="People" initial="2" min="1" max="20">
|
|
8
|
+
|
|
9
|
+
Current headcount: {{ seat }}.
|
|
10
|
+
|
|
11
|
+
## Duplicate initial declaration
|
|
12
|
+
|
|
13
|
+
<number bind="seats" label="Another headcount input" initial="3" min="1" max="20">
|
|
14
|
+
|
|
15
|
+
## Initial value out of range
|
|
16
|
+
|
|
17
|
+
<slider bind="ratio" label="Ratio" initial="12" min="0" max="10">
|
|
18
|
+
|
|
19
|
+
## Condition type error
|
|
20
|
+
|
|
21
|
+
<if when="{{ seats }}">
|
|
22
|
+
This needs a boolean condition, such as seats greater than 5.
|
|
23
|
+
</if>
|
|
24
|
+
|
|
25
|
+
## Unknown tag
|
|
26
|
+
|
|
27
|
+
<slidr label="Misspelled slider" />
|
|
28
|
+
|
|
29
|
+
## Event outside the local interaction language
|
|
30
|
+
|
|
31
|
+
<counter label="Counter" on-click="increment">
|
|
32
|
+
|
|
33
|
+
## Missing node
|
|
34
|
+
|
|
35
|
+
<diagram label="Broken edge">
|
|
36
|
+
<node id="input" label="Input">
|
|
37
|
+
This is the only node.
|
|
38
|
+
</node>
|
|
39
|
+
<edge from="input" to="missing">
|
|
40
|
+
</diagram>
|
|
41
|
+
|
|
42
|
+
## Unsupported math structure
|
|
43
|
+
|
|
44
|
+
<plot label="Integrals are not part of the plot grammar">
|
|
45
|
+
$$ y = \int_0^x t^2\,dt $$
|
|
46
|
+
</plot>
|
|
47
|
+
|
|
48
|
+
## Invalid chart data
|
|
49
|
+
|
|
50
|
+
<chart title="Units mixed into a numeric column">
|
|
51
|
+
| Item | Cost |
|
|
52
|
+
| --- | ---: |
|
|
53
|
+
| Content | 20 USD |
|
|
54
|
+
</chart>
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<diagram bind="selected" initial="input" label="
|
|
6
|
-
<node id="input" label="
|
|
7
|
-
|
|
8
|
-
</node>
|
|
9
|
-
|
|
10
|
-
<node id="compute" label="
|
|
11
|
-
|
|
12
|
-
</node>
|
|
13
|
-
|
|
14
|
-
<node id="view" label="
|
|
15
|
-
|
|
16
|
-
</node>
|
|
17
|
-
|
|
18
|
-
<edge from="input" to="compute" label="
|
|
19
|
-
<edge from="compute" to="view" label="
|
|
20
|
-
</diagram>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
##
|
|
25
|
-
|
|
26
|
-
<panel title="
|
|
27
|
-
<slider bind="a" label="
|
|
28
|
-
<slider bind="f" label="
|
|
29
|
-
</panel>
|
|
30
|
-
|
|
31
|
-
<plot min="0" max="12.56" label="
|
|
32
|
-
$$ y = a\sin(fx) $$
|
|
33
|
-
</plot>
|
|
34
|
-
|
|
35
|
-
<if when="{{ a == 0 }}">
|
|
36
|
-
|
|
37
|
-
</if>
|
|
38
|
-
|
|
39
|
-
##
|
|
40
|
-
|
|
41
|
-
<plot min="-5" max="5" label="
|
|
42
|
-
$$ y = x^2 $$
|
|
43
|
-
$$ y = 2x + 1 $$
|
|
44
|
-
</plot>
|
|
1
|
+
# Make explanations explorable
|
|
2
|
+
|
|
3
|
+
Click a node or use the keyboard to select a step and read its description.
|
|
4
|
+
|
|
5
|
+
<diagram bind="selected" initial="input" label="Reactive state flow">
|
|
6
|
+
<node id="input" label="Input">
|
|
7
|
+
Readers change parameters with sliders, switches and text fields.
|
|
8
|
+
</node>
|
|
9
|
+
|
|
10
|
+
<node id="compute" label="Compute">
|
|
11
|
+
Formulas that depend on those parameters are recalculated.
|
|
12
|
+
</node>
|
|
13
|
+
|
|
14
|
+
<node id="view" label="View">
|
|
15
|
+
Prose, charts and hints update with the result.
|
|
16
|
+
</node>
|
|
17
|
+
|
|
18
|
+
<edge from="input" to="compute" label="Parameter change">
|
|
19
|
+
<edge from="compute" to="view" label="Updated result">
|
|
20
|
+
</diagram>
|
|
21
|
+
|
|
22
|
+
Current step: {{ selected == 'input' ? 'Input' : selected == 'compute' ? 'Compute' : 'View' }}.
|
|
23
|
+
|
|
24
|
+
## Change parameters and watch the curve
|
|
25
|
+
|
|
26
|
+
<panel title="Sine wave parameters">
|
|
27
|
+
<slider bind="a" label="Amplitude" initial="1" min="0" max="3" step="0.5">
|
|
28
|
+
<slider bind="f" label="Frequency parameter" initial="1" min="0.5" max="3" step="0.5">
|
|
29
|
+
</panel>
|
|
30
|
+
|
|
31
|
+
<plot min="0" max="12.56" label="Sine wave" x-label="x" y-label="Displacement">
|
|
32
|
+
$$ y = a\sin(fx) $$
|
|
33
|
+
</plot>
|
|
34
|
+
|
|
35
|
+
<if when="{{ a == 0 }}">
|
|
36
|
+
The amplitude is zero, so the curve lies flat on the horizontal axis.
|
|
37
|
+
</if>
|
|
38
|
+
|
|
39
|
+
## Overlay two curves
|
|
40
|
+
|
|
41
|
+
<plot min="-5" max="5" label="Parabola and line">
|
|
42
|
+
$$ y = x^2 $$
|
|
43
|
+
$$ y = 2x + 1 $$
|
|
44
|
+
</plot>
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
<panel title="
|
|
6
|
-
<input bind="name" label="
|
|
7
|
-
<number bind="quantity" label="
|
|
8
|
-
|
|
9
|
-
<select bind="plan" label="
|
|
10
|
-
<option value="basic"
|
|
11
|
-
<option value="pro"
|
|
12
|
-
</select>
|
|
13
|
-
|
|
14
|
-
<toggle bind="annual" label="
|
|
15
|
-
<toggle bind="express" label="
|
|
16
|
-
<slider bind="budgetLevel" label="
|
|
17
|
-
</panel>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<if when="{{ quantity >= 5 }}">
|
|
24
|
-
<badge tone="success"
|
|
25
|
-
</if>
|
|
26
|
-
|
|
27
|
-
|
|
|
28
|
-
| --- | --- |
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
<if when="{{ express }}">
|
|
34
|
-
<checklist label="
|
|
35
|
-
- [x]
|
|
36
|
-
- [ ]
|
|
37
|
-
</checklist>
|
|
38
|
-
</if>
|
|
39
|
-
|
|
40
|
-
##
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<grid>
|
|
45
|
-
<card title="
|
|
46
|
-
<counter label="
|
|
47
|
-
</card>
|
|
48
|
-
|
|
49
|
-
<card title="
|
|
50
|
-
<timer label="
|
|
51
|
-
</card>
|
|
52
|
-
</grid>
|
|
53
|
-
|
|
54
|
-
##
|
|
55
|
-
|
|
56
|
-
```markdown
|
|
57
|
-
<slider bind="example" label="
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
|
|
1
|
+
# Common component gallery
|
|
2
|
+
|
|
3
|
+
## Inputs and live results
|
|
4
|
+
|
|
5
|
+
<panel title="Describe your plan">
|
|
6
|
+
<input bind="name" label="Name" initial="Alex" placeholder="Enter a name">
|
|
7
|
+
<number bind="quantity" label="Quantity" initial="3" min="1" max="20">
|
|
8
|
+
|
|
9
|
+
<select bind="plan" label="Plan" initial="pro">
|
|
10
|
+
<option value="basic">Basic</option>
|
|
11
|
+
<option value="pro">Pro</option>
|
|
12
|
+
</select>
|
|
13
|
+
|
|
14
|
+
<toggle bind="annual" label="Annual billing (20% off)">
|
|
15
|
+
<toggle bind="express" label="Show express checklist" initial="true">
|
|
16
|
+
<slider bind="budgetLevel" label="Budget level" initial="50" step="10">
|
|
17
|
+
</panel>
|
|
18
|
+
|
|
19
|
+
Hello, **{{ name }}**.
|
|
20
|
+
|
|
21
|
+
Estimated cost: **{{ round(quantity * 80 * (plan == 'pro' ? 1 : 0.8) * (annual ? 0.8 : 1)) }} USD**.
|
|
22
|
+
|
|
23
|
+
<if when="{{ quantity >= 5 }}">
|
|
24
|
+
<badge tone="success">Team tier reached</badge>
|
|
25
|
+
</if>
|
|
26
|
+
|
|
27
|
+
| Condition | Current choice |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Plan | {{ plan == 'pro' ? 'Pro' : 'Basic' }} |
|
|
30
|
+
| Annual billing | {{ annual ? 'On' : 'Off' }} |
|
|
31
|
+
| Budget level | {{ budgetLevel }} |
|
|
32
|
+
|
|
33
|
+
<if when="{{ express }}">
|
|
34
|
+
<checklist label="Express preparation">
|
|
35
|
+
- [x] Express checklist shown
|
|
36
|
+
- [ ] Confirm the delivery time
|
|
37
|
+
</checklist>
|
|
38
|
+
</if>
|
|
39
|
+
|
|
40
|
+
## Components that work on their own
|
|
41
|
+
|
|
42
|
+
These components do not expose parameters to the prose, so they omit bind.
|
|
43
|
+
|
|
44
|
+
<grid>
|
|
45
|
+
<card title="People counter">
|
|
46
|
+
<counter label="Participants" initial="2" min="1" max="20">
|
|
47
|
+
</card>
|
|
48
|
+
|
|
49
|
+
<card title="Short focus">
|
|
50
|
+
<timer label="One-minute countdown">
|
|
51
|
+
</card>
|
|
52
|
+
</grid>
|
|
53
|
+
|
|
54
|
+
## Show code as-is
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
<slider bind="example" label="Example parameter">
|
|
58
|
+
Current value: {{ example }}.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The code above is displayed as an example only and does not create a control.
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<panel title="
|
|
6
|
-
<input bind="name" label="
|
|
7
|
-
|
|
8
|
-
<choices bind="role" label="
|
|
9
|
-
<option value="personal"
|
|
10
|
-
<option value="team"
|
|
11
|
-
</choices>
|
|
12
|
-
|
|
13
|
-
<date bind="appointment" label="
|
|
14
|
-
|
|
15
|
-
<textarea bind="message" label="
|
|
16
|
-
|
|
17
|
-
<checkbox bind="showNotes" label="
|
|
18
|
-
</panel>
|
|
19
|
-
|
|
20
|
-
<card title="
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</card>
|
|
29
|
-
|
|
30
|
-
<if when="{{ showNotes }}">
|
|
31
|
-
<checklist label="
|
|
32
|
-
- [ ]
|
|
33
|
-
- [ ]
|
|
34
|
-
- [ ]
|
|
35
|
-
</checklist>
|
|
36
|
-
</if>
|
|
1
|
+
# Fill it in, watch the result
|
|
2
|
+
|
|
3
|
+
Enter your preferences and the description below updates immediately.
|
|
4
|
+
|
|
5
|
+
<panel title="Meeting preparation">
|
|
6
|
+
<input bind="name" label="Name" placeholder="What should we call you?">
|
|
7
|
+
|
|
8
|
+
<choices bind="role" label="Usage">
|
|
9
|
+
<option value="personal">Personal use</option>
|
|
10
|
+
<option value="team">Team use</option>
|
|
11
|
+
</choices>
|
|
12
|
+
|
|
13
|
+
<date bind="appointment" label="Preferred meeting date" initial="2026-10-22">
|
|
14
|
+
|
|
15
|
+
<textarea bind="message" label="What interactive document do you want to build?" placeholder="For example: a course handout with adjustable parameters">
|
|
16
|
+
|
|
17
|
+
<checkbox bind="showNotes" label="Show the preparation checklist">
|
|
18
|
+
</panel>
|
|
19
|
+
|
|
20
|
+
<card title="Current plan">
|
|
21
|
+
Name: **{{ name == '' ? 'Not provided yet' : name }}**.
|
|
22
|
+
|
|
23
|
+
Usage: {{ role == 'personal' ? 'Personal use' : 'Team use' }}.
|
|
24
|
+
|
|
25
|
+
Planned date: {{ appointment }}.
|
|
26
|
+
|
|
27
|
+
Idea: {{ message == '' ? 'Start with a small calculator.' : message }}
|
|
28
|
+
</card>
|
|
29
|
+
|
|
30
|
+
<if when="{{ showNotes }}">
|
|
31
|
+
<checklist label="Before the meeting">
|
|
32
|
+
- [ ] Decide which parameters readers need to adjust
|
|
33
|
+
- [ ] Prepare a concrete calculation or chart example
|
|
34
|
+
- [ ] Write down the changes you want readers to notice
|
|
35
|
+
</checklist>
|
|
36
|
+
</if>
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
<timeline title="45
|
|
4
|
-
|
|
|
5
|
-
| --- | ---: | ---: | --- |
|
|
6
|
-
|
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
</timeline>
|
|
11
|
-
|
|
12
|
-
<timer label="
|
|
13
|
-
|
|
14
|
-
##
|
|
15
|
-
|
|
16
|
-
<panel title="
|
|
17
|
-
<number bind="total" label="
|
|
18
|
-
<slider bind="people" label="
|
|
19
|
-
<slider bind="tip" label="
|
|
20
|
-
</panel>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
# Planning, timing and simple tools
|
|
2
|
+
|
|
3
|
+
<timeline title="45-minute work plan">
|
|
4
|
+
| Task | Start | Duration | Notes |
|
|
5
|
+
| --- | ---: | ---: | --- |
|
|
6
|
+
| Prepare materials | 0 | 10 | List what you need first |
|
|
7
|
+
| Draft the main section | 10 | 25 | Focus on the core content |
|
|
8
|
+
| Assemble references | 15 | 15 | Can run in parallel with the main section |
|
|
9
|
+
| Review and deliver | 35 | 10 | Leave time for a final check |
|
|
10
|
+
</timeline>
|
|
11
|
+
|
|
12
|
+
<timer label="One-minute focus timer" duration="60">
|
|
13
|
+
|
|
14
|
+
## Splitting a dinner bill
|
|
15
|
+
|
|
16
|
+
<panel title="Bill parameters">
|
|
17
|
+
<number bind="total" label="Bill amount" initial="240" min="0">
|
|
18
|
+
<slider bind="people" label="People" initial="3" min="1" max="12">
|
|
19
|
+
<slider bind="tip" label="Extra charge (%)" initial="10" min="0" max="20">
|
|
20
|
+
</panel>
|
|
21
|
+
|
|
22
|
+
Each person pays **{{ round(total * (1 + tip / 100) / people * 100) / 100 }} USD**.
|
|
23
|
+
|
|
24
|
+
Amounts are rounded to two decimals without padding trailing zeros.
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<panel title="
|
|
6
|
-
<slider bind="seats" label="
|
|
7
|
-
<toggle bind="annual" label="
|
|
8
|
-
</panel>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<if when="{{ seats >= 5 }}">
|
|
17
|
-
<alert title="
|
|
18
|
-
|
|
19
|
-
</alert>
|
|
20
|
-
</if>
|
|
1
|
+
# Plan calculator
|
|
2
|
+
|
|
3
|
+
Adjust the headcount and billing cycle to compare the average monthly cost. Each person costs 100 USD per month, and annual billing takes 20% off.
|
|
4
|
+
|
|
5
|
+
<panel title="Your plan">
|
|
6
|
+
<slider bind="seats" label="People" initial="2" min="1" max="20">
|
|
7
|
+
<toggle bind="annual" label="Annual billing">
|
|
8
|
+
</panel>
|
|
9
|
+
|
|
10
|
+
Current headcount: **{{ seats }}**.
|
|
11
|
+
|
|
12
|
+
Per person per month: **{{ annual ? 80 : 100 }} USD**.
|
|
13
|
+
|
|
14
|
+
Monthly total: **{{ seats * (annual ? 80 : 100) }} USD**.
|
|
15
|
+
|
|
16
|
+
<if when="{{ seats >= 5 }}">
|
|
17
|
+
<alert title="Team plan">
|
|
18
|
+
You selected at least 5 people. Switch the billing cycle to compare costs.
|
|
19
|
+
</alert>
|
|
20
|
+
</if>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<const name="unitPrice" value="{{ 12.5 }}">
|
|
2
|
+
<computed name="total" value="{{ quantity * unitPrice }}">
|
|
3
|
+
<computed name="invoice" value="{{ formatCurrency(total, 'CNY', 2, 'zh-CN') }}">
|
|
4
|
+
<computed name="days" value="{{ startDate == '' || endDate == '' ? null : dateDiff(endDate, startDate) }}">
|
|
5
|
+
|
|
6
|
+
# 共享账单计算
|
|
7
|
+
|
|
8
|
+
<panel title="调整账单">
|
|
9
|
+
<number bind="quantity" label="数量" initial="2" min="0" max="100">
|
|
10
|
+
<date bind="startDate" label="开始日期" initial="2026-10-24">
|
|
11
|
+
<date bind="endDate" label="结束日期" initial="2026-10-26">
|
|
12
|
+
</panel>
|
|
13
|
+
|
|
14
|
+
账单:**{{ invoice }}**。单价:{{ formatCurrency(unitPrice, 'CNY', 2, 'zh-CN') }}。
|
|
15
|
+
|
|
16
|
+
天数:{{ days == null ? '请选择两个日期' : formatNumber(days, 0) }}。
|
|
17
|
+
|
|
18
|
+
<if when="{{ total >= 100 }}">
|
|
19
|
+
达到批量配送门槛。
|
|
20
|
+
</if>
|
|
21
|
+
|
|
22
|
+
<chart kind="bar" title="账单总额" x="项目" y="费用">
|
|
23
|
+
| 项目 | 费用 |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| 账单 | {{ total }} |
|
|
26
|
+
| 单件 | {{ unitPrice }} |
|
|
27
|
+
</chart>
|
|
28
|
+
|
|
29
|
+
<plot label="账单倍数" min="0" max="2" samples="21">
|
|
30
|
+
$$
|
|
31
|
+
y = \mathrm{total} x
|
|
32
|
+
$$
|
|
33
|
+
</plot>
|
|
34
|
+
|
|
35
|
+
同一数字的其他显示:{{ formatNumber(total, 0) }}、{{ formatScientific(total) }}。
|
|
36
|
+
比例 {{ formatPercent(0.125, 1) }} 的显示不随读者设备地区变化。
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<const name="unitPrice" value="{{ 12.5 }}">
|
|
2
|
+
<computed name="total" value="{{ quantity * unitPrice }}">
|
|
3
|
+
<computed name="invoice" value="{{ formatCurrency(total) }}">
|
|
4
|
+
<computed name="days" value="{{ startDate == '' || endDate == '' ? null : dateDiff(endDate, startDate) }}">
|
|
5
|
+
|
|
6
|
+
# Shared invoice calculations
|
|
7
|
+
|
|
8
|
+
<panel title="Adjust the invoice">
|
|
9
|
+
<number bind="quantity" label="Quantity" initial="2" min="0" max="100">
|
|
10
|
+
<date bind="startDate" label="Start" initial="2026-10-24">
|
|
11
|
+
<date bind="endDate" label="End" initial="2026-10-26">
|
|
12
|
+
</panel>
|
|
13
|
+
|
|
14
|
+
Invoice: **{{ invoice }}**. Per item: {{ formatCurrency(unitPrice) }}.
|
|
15
|
+
|
|
16
|
+
Days: {{ days == null ? 'Choose both dates' : formatNumber(days, 0) }}.
|
|
17
|
+
|
|
18
|
+
<if when="{{ total >= 100 }}">
|
|
19
|
+
Eligible for bulk delivery.
|
|
20
|
+
</if>
|
|
21
|
+
|
|
22
|
+
<chart kind="bar" title="Invoice total" x="Item" y="Cost">
|
|
23
|
+
| Item | Cost |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| Invoice | {{ total }} |
|
|
26
|
+
| One item | {{ unitPrice }} |
|
|
27
|
+
</chart>
|
|
28
|
+
|
|
29
|
+
<plot label="Scaled invoice" min="0" max="2" samples="21">
|
|
30
|
+
$$
|
|
31
|
+
y = \mathrm{total} x
|
|
32
|
+
$$
|
|
33
|
+
</plot>
|
|
34
|
+
|
|
35
|
+
Other displays of the same number: {{ formatNumber(total, 0) }}, {{ formatScientific(total) }}.
|
|
36
|
+
The fraction {{ formatPercent(0.125, 1) }} is independent of the reader's device locale.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<computed name="costs" value="{{ [seats * 80, materials ? seats * 20 : 0] }}">
|
|
2
|
+
<computed name="total" value="{{ sum(costs) }}">
|
|
3
|
+
|
|
4
|
+
# 校验工作坊计划
|
|
5
|
+
|
|
6
|
+
<panel title="工作坊计划">
|
|
7
|
+
<number bind="seats" label="人数" initial="4" min="1" max="20">
|
|
8
|
+
<number bind="budget" label="预算" initial="500" min="0" max="5000">
|
|
9
|
+
<toggle bind="materials" label="包含材料">
|
|
10
|
+
<date bind="startDate" label="开始日期" initial="2026-10-24">
|
|
11
|
+
<date bind="endDate" label="结束日期" initial="2026-10-26">
|
|
12
|
+
<multi-select bind="subjects" label="主题" max-selected="3">
|
|
13
|
+
<option value="mathematics">数学</option>
|
|
14
|
+
<option value="physics">物理</option>
|
|
15
|
+
<option value="chemistry">化学</option>
|
|
16
|
+
</multi-select>
|
|
17
|
+
</panel>
|
|
18
|
+
|
|
19
|
+
<validation when="{{ total <= budget }}" message="预估 {{ formatCurrency(total, 'CNY', 2, 'zh-CN') }} 已超出预算。" fields="seats budget materials">
|
|
20
|
+
<validation when="{{ startDate == '' || endDate == '' || dateCompare(endDate, startDate) >= 0 }}" message="结束日期应不早于开始日期。" fields="startDate endDate">
|
|
21
|
+
|
|
22
|
+
<badge tone="{{ total <= budget ? 'success' : 'warning' }}">预估:{{ formatCurrency(total, 'CNY', 2, 'zh-CN') }}</badge>
|
|
23
|
+
|
|
24
|
+
教学:{{ formatCurrency(costs[0], 'CNY', 2, 'zh-CN') }}。材料:{{ formatCurrency(costs[1], 'CNY', 2, 'zh-CN') }}。
|
|
25
|
+
平均费用类别:{{ formatCurrency(average(costs), 'CNY', 2, 'zh-CN') }}。
|
|
26
|
+
|
|
27
|
+
<data-table label="已选主题" rows="{{ subjects }}" key="{{ item }}" max-rows="3">
|
|
28
|
+
<column label="主题标识" value="{{ item }}">
|
|
29
|
+
<column label="序号" value="{{ index + 1 }}">
|
|
30
|
+
<column label="准备工作" value="{{ item == 'chemistry' ? '准备材料' : '准备例题' }}">
|
|
31
|
+
</data-table>
|
|
32
|
+
|
|
33
|
+
选择主题后表格自动生成行。调低预算可查看警告,再修改预算或人数即可消除。重置面板恢复初始计划。
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<computed name="costs" value="{{ [seats * 80, materials ? seats * 20 : 0] }}">
|
|
2
|
+
<computed name="total" value="{{ sum(costs) }}">
|
|
3
|
+
|
|
4
|
+
# Check a workshop plan
|
|
5
|
+
|
|
6
|
+
<panel title="Workshop plan">
|
|
7
|
+
<number bind="seats" label="Participants" initial="4" min="1" max="20">
|
|
8
|
+
<number bind="budget" label="Budget" initial="500" min="0" max="5000">
|
|
9
|
+
<toggle bind="materials" label="Include materials">
|
|
10
|
+
<date bind="startDate" label="Start date" initial="2026-10-24">
|
|
11
|
+
<date bind="endDate" label="End date" initial="2026-10-26">
|
|
12
|
+
<multi-select bind="subjects" label="Subjects" max-selected="3">
|
|
13
|
+
<option value="mathematics">Mathematics</option>
|
|
14
|
+
<option value="physics">Physics</option>
|
|
15
|
+
<option value="chemistry">Chemistry</option>
|
|
16
|
+
</multi-select>
|
|
17
|
+
</panel>
|
|
18
|
+
|
|
19
|
+
<validation when="{{ total <= budget }}" message="The estimated {{ formatCurrency(total) }} exceeds the budget." fields="seats budget materials">
|
|
20
|
+
<validation when="{{ startDate == '' || endDate == '' || dateCompare(endDate, startDate) >= 0 }}" message="End date must be on or after start date." fields="startDate endDate">
|
|
21
|
+
|
|
22
|
+
<badge tone="{{ total <= budget ? 'success' : 'warning' }}">Estimate: {{ formatCurrency(total) }}</badge>
|
|
23
|
+
|
|
24
|
+
Teaching: {{ formatCurrency(costs[0]) }}. Materials: {{ formatCurrency(costs[1]) }}.
|
|
25
|
+
Average cost category: {{ formatCurrency(average(costs)) }}.
|
|
26
|
+
|
|
27
|
+
<data-table label="Selected subjects" rows="{{ subjects }}" key="{{ item }}" max-rows="3">
|
|
28
|
+
<column label="Subject ID" value="{{ item }}">
|
|
29
|
+
<column label="Position" value="{{ index + 1 }}">
|
|
30
|
+
<column label="Preparation" value="{{ item == 'chemistry' ? 'Prepare materials' : 'Prepare examples' }}">
|
|
31
|
+
</data-table>
|
|
32
|
+
|
|
33
|
+
Choose subjects to populate the table. Lower the budget to see the warning, then edit either the budget or participant count to clear it. Reset the panel to restore the plan.
|