reactive-md 0.9.3 → 0.10.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 +34 -0
- package/CHANGELOG.md +34 -0
- package/README-ch.md +7 -7
- package/README-en.md +7 -7
- package/README.md +7 -7
- package/THIRD_PARTY_NOTICES.md +0 -57
- package/cli/help.mjs +6 -4
- package/cli/init.mjs +1 -1
- package/cli/migrate.mjs +1 -1
- package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
- package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
- package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
- package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
- package/dist-library/authoring-Bwu_zCWs.js +768 -0
- package/dist-library/choice-values-BItGjPD2.js +58 -0
- package/dist-library/compile-B35rfzKr.js +1742 -0
- package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
- package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
- package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
- package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
- package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
- package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
- package/dist-library/conditional-branches-CIhJXasR.js +17 -0
- package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
- package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
- package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
- package/dist-library/data-table-CSAkm1eU.js +290 -0
- package/dist-library/data-table-model-DruztQFt.js +391 -0
- package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
- package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
- package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
- package/dist-library/default-options-By16CVw1.js +131 -0
- package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
- package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
- package/dist-library/display-Bb6hAG5T.js +2065 -0
- package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
- package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
- package/dist-library/font-aliases-CKYjwn4o.js +4 -0
- package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
- package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
- package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
- package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
- package/dist-library/layout-CPQggKxk.js +592 -0
- package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
- package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
- package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
- package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
- package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
- package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
- package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
- package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
- package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
- package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
- package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
- package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
- package/dist-library/reactive-md-authoring.js +277 -269
- package/dist-library/reactive-md-build.js +327 -33
- package/dist-library/reactive-md-compiler-session.js +3 -3
- package/dist-library/reactive-md-compiler-standard.js +10 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-contracts.js +4 -4
- package/dist-library/reactive-md-default-packs.js +4 -3
- package/dist-library/reactive-md-default-preset.js +3 -3
- package/dist-library/reactive-md-export.js +6 -6
- package/dist-library/reactive-md-minimal-preset.js +3 -2
- package/dist-library/reactive-md-minimal-react-preset.js +18 -17
- package/dist-library/reactive-md-minimal.css +1 -1
- package/dist-library/reactive-md-observability.js +2 -2
- package/dist-library/reactive-md-pack-style-manifest.js +8 -0
- package/dist-library/reactive-md-plugin-chart.js +13 -9
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +5 -5
- package/dist-library/reactive-md-plugin-gallery.js +3 -3
- package/dist-library/reactive-md-plugin-navigation.js +10 -10
- package/dist-library/reactive-md-plugin-network.js +5 -5
- package/dist-library/reactive-md-plugin-plot.js +4 -4
- package/dist-library/reactive-md-react-component-accordion.js +3 -3
- package/dist-library/reactive-md-react-component-alert.js +3 -3
- package/dist-library/reactive-md-react-component-anchor.js +3 -3
- package/dist-library/reactive-md-react-component-badge.js +3 -3
- package/dist-library/reactive-md-react-component-card.js +3 -3
- package/dist-library/reactive-md-react-component-chart.js +2 -2
- package/dist-library/reactive-md-react-component-checkbox.js +2 -2
- package/dist-library/reactive-md-react-component-checklist.js +2 -2
- package/dist-library/reactive-md-react-component-choices.js +2 -2
- package/dist-library/reactive-md-react-component-column.js +1 -1
- package/dist-library/reactive-md-react-component-coordinate.js +2 -2
- package/dist-library/reactive-md-react-component-counter.js +2 -2
- package/dist-library/reactive-md-react-component-data-table.js +2 -2
- package/dist-library/reactive-md-react-component-date.js +2 -2
- package/dist-library/reactive-md-react-component-diagram.js +2 -2
- package/dist-library/reactive-md-react-component-disclosure.js +3 -3
- package/dist-library/reactive-md-react-component-edge.js +1 -1
- package/dist-library/reactive-md-react-component-else.js +10 -0
- package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
- package/dist-library/reactive-md-react-component-gallery.js +2 -2
- package/dist-library/reactive-md-react-component-grid.js +3 -3
- package/dist-library/reactive-md-react-component-if.js +3 -3
- package/dist-library/reactive-md-react-component-input.js +2 -2
- package/dist-library/reactive-md-react-component-jump.js +3 -3
- package/dist-library/reactive-md-react-component-multi-select.js +2 -2
- package/dist-library/reactive-md-react-component-node.js +2 -2
- package/dist-library/reactive-md-react-component-number.js +2 -2
- package/dist-library/reactive-md-react-component-option.js +1 -1
- package/dist-library/reactive-md-react-component-panel.js +3 -3
- package/dist-library/reactive-md-react-component-plot.js +2 -2
- package/dist-library/reactive-md-react-component-progress.js +2 -2
- package/dist-library/reactive-md-react-component-quiz.js +2 -2
- package/dist-library/reactive-md-react-component-radio-group.js +2 -2
- package/dist-library/reactive-md-react-component-range-slider.js +2 -2
- package/dist-library/reactive-md-react-component-section.js +3 -3
- package/dist-library/reactive-md-react-component-select.js +2 -2
- package/dist-library/reactive-md-react-component-slider.js +2 -2
- package/dist-library/reactive-md-react-component-step.js +3 -3
- package/dist-library/reactive-md-react-component-steps.js +3 -3
- package/dist-library/reactive-md-react-component-tab.js +3 -3
- package/dist-library/reactive-md-react-component-table.js +2 -2
- package/dist-library/reactive-md-react-component-tabs.js +3 -3
- package/dist-library/reactive-md-react-component-text.js +3 -3
- package/dist-library/reactive-md-react-component-textarea.js +2 -2
- package/dist-library/reactive-md-react-component-timeline.js +2 -2
- package/dist-library/reactive-md-react-component-timer.js +2 -2
- package/dist-library/reactive-md-react-component-toggle.js +2 -2
- package/dist-library/reactive-md-react-component-tooltip.js +3 -3
- package/dist-library/reactive-md-react-component-validation.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-pack-controls.js +4 -4
- package/dist-library/reactive-md-react-pack-data.js +3 -3
- package/dist-library/reactive-md-react-pack-layout.js +25 -24
- package/dist-library/reactive-md-react-pack-visuals.js +2 -2
- package/dist-library/reactive-md-react-packed.js +6 -6
- package/dist-library/reactive-md-react-server.js +37 -36
- package/dist-library/reactive-md-react-static-server.js +2 -2
- package/dist-library/reactive-md-react-static.js +1 -1
- package/dist-library/reactive-md-react-unstyled.js +12 -12
- package/dist-library/reactive-md-react.js +12 -12
- package/dist-library/reactive-md-scan.js +1 -1
- package/dist-library/reactive-md-sdk.js +23 -9
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +6 -6
- package/dist-library/reactive-md-vite.js +25 -9
- package/dist-library/reactive-md-worker-pool.js +3 -3
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +52 -43
- package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
- package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
- package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
- package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
- package/dist-library/rmd-pack-layout.css +9 -0
- package/dist-library/rmd-pack-resource-layout.css +9 -0
- package/dist-library/runtime-BHeuLOv_.js +1369 -0
- package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
- package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
- package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
- package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
- package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
- package/dist-library/shareable-CHCDnl6j.js +844 -0
- package/dist-library/types/authoring/catalog.d.ts +3 -1
- package/dist-library/types/authoring/index.d.ts +1 -1
- package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
- package/dist-library/types/components/chart/default-chart.d.ts +7 -0
- package/dist-library/types/components/entries/else.d.ts +3 -0
- package/dist-library/types/components/layout/layout.d.ts +5 -0
- package/dist-library/types/components/shared/visuals.d.ts +1 -1
- package/dist-library/types/components/table/data-table-model.d.ts +95 -2
- package/dist-library/types/components/table/data-table.d.ts +2 -2
- package/dist-library/types/contracts/component-kernel.d.ts +5 -0
- package/dist-library/types/contracts/font-aliases.d.ts +18 -0
- package/dist-library/types/contracts/number-literal.d.ts +2 -0
- package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
- package/dist-library/types/export/index.d.ts +4 -1
- package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
- package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
- package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
- package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
- package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
- package/dist-library/types/local/evaluation/computations.d.ts +13 -5
- package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
- package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
- package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
- package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
- package/dist-library/types/local/evaluation/validation.d.ts +8 -6
- package/dist-library/types/local/index.d.ts +4 -3
- package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
- package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
- package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
- package/dist-library/types/local/runtime/runtime.d.ts +3 -1
- package/dist-library/types/local/runtime/state.d.ts +30 -15
- package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
- package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
- package/dist-library/types/local/source/authoring.d.ts +10 -0
- package/dist-library/types/local/source/source-migration.d.ts +1 -0
- package/dist-library/types/local/types.d.ts +33 -2
- package/dist-library/types/react/component-api.d.ts +21 -2
- package/dist-library/types/react/component-utils.d.ts +11 -0
- package/dist-library/types/react/font-aliases.d.ts +2 -0
- package/dist-library/types/react/package-core.d.ts +3 -0
- package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
- package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
- package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
- package/dist-library/types/react/sdk-core.d.ts +3 -1
- package/dist-library/types/sdk/assembly.d.ts +3 -0
- package/dist-library/types/sdk/font.d.ts +13 -0
- package/dist-library/types/sdk/index.d.ts +1 -0
- package/dist-library/types/sdk/theme.d.ts +5 -0
- package/dist-library/types/sdk/types.d.ts +6 -0
- package/dist-library/types/sdk/version.d.ts +1 -1
- package/dist-library/types/shareable.d.ts +15 -3
- package/dist-library/types/standalone/prepare.d.ts +4 -2
- package/dist-library/types/standalone/session-core.d.ts +4 -1
- package/dist-library/types/vite/index.d.ts +3 -0
- package/dist-library/types/vite/registration.d.ts +1 -0
- package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
- package/dist-library/types-FYhRWRn9.js +3 -0
- package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
- package/dist-library/validation-DRuW0Wl9.js +433 -0
- package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
- package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
- package/dist-library/visuals-7xzoL9ql.js +49340 -0
- package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +128 -368
- package/docs/README-ch.md +3 -1
- package/docs/README.md +3 -1
- package/docs/compatibility/api-stability-ch.md +1 -1
- package/docs/compatibility/api-stability-en.md +1 -1
- package/docs/compatibility/compatibility-ch.md +15 -15
- package/docs/compatibility/compatibility-en.md +15 -15
- package/docs/compatibility/compatibility-manifest.schema.json +3 -2
- package/docs/compatibility/deprecation-ch.md +2 -2
- package/docs/compatibility/deprecation-en.md +2 -2
- package/docs/compatibility/source-versioning-ch.md +22 -14
- package/docs/compatibility/source-versioning-en.md +22 -13
- package/docs/compatibility/support-matrix-ch.md +4 -3
- package/docs/compatibility/support-matrix-en.md +4 -3
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-protocol-ch.md +18 -18
- package/docs/development/component-protocol-en.md +14 -14
- package/docs/guides/local-guide-ch.md +109 -20
- package/docs/guides/local-guide-en.md +109 -20
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +29 -3
- package/docs/integration/extension-sdk-en.md +29 -3
- package/docs/integration/local-integration-ch.md +3 -3
- package/docs/integration/local-integration-en.md +3 -3
- package/docs/integration/pdf-export-ch.md +42 -0
- package/docs/integration/pdf-export-en.md +42 -0
- package/docs/integration/shareable-export-ch.md +11 -19
- package/docs/integration/shareable-export-en.md +11 -19
- package/docs/reference/diagnostics-counting-ch.md +24 -1
- package/docs/reference/diagnostics-counting-en.md +24 -1
- package/docs/reference/local-interaction-syntax-ch.md +222 -33
- package/docs/reference/local-interaction-syntax-en.md +220 -31
- package/docs/reference/public-api-ch.md +24 -18
- package/docs/reference/public-api-en.md +24 -18
- package/docs/reference/theme-protocol-ch.md +1 -1
- package/docs/reference/theme-protocol-en.md +1 -1
- package/docs/releases/release-0.10.0-ch.md +45 -0
- package/docs/releases/release-0.10.0-en.md +45 -0
- package/examples/conformance/README-ch.md +3 -3
- package/examples/conformance/README.md +3 -3
- package/examples/conformance/local-draft-4.json +441 -0
- package/examples/integration/README-ch.md +3 -3
- package/examples/integration/README.md +3 -3
- package/examples/integration/chat-session/package.json +1 -1
- package/examples/local/README-ch.md +1 -1
- package/examples/local/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
- package/dist-library/authoring-B14SsOXZ.js +0 -893
- package/dist-library/compile-D50B5_Ww.js +0 -1249
- package/dist-library/computations-CffoW7Ff.js +0 -340
- package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
- package/dist-library/default-options-DU5dxuU6.js +0 -125
- package/dist-library/layout-BfUzzO2b.js +0 -553
- package/dist-library/runtime-CuJndKqK.js +0 -1289
- package/dist-library/shareable-C6mUerpQ.js +0 -817
- package/dist-library/types-daDo2c_w.js +0 -3
- package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
- package/dist-library/visuals-CoVSjVD8.js +0 -49159
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { builtinModules } from "node:module";
|
|
1
2
|
import { createHash } from "node:crypto";
|
|
2
3
|
import { readFile, realpath, stat } from "node:fs/promises";
|
|
3
4
|
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
@@ -10,6 +11,37 @@ var MAX_LOCAL_PLOT_POINTS = 2e4;
|
|
|
10
11
|
var MAX_LOCAL_DATA_TABLE_ROWS = 1e3;
|
|
11
12
|
var MAX_LOCAL_DATA_DOCUMENT_ROWS = 2e3;
|
|
12
13
|
var MAX_LOCAL_DATA_DOCUMENT_CELLS = 1e4;
|
|
14
|
+
// src/contracts/font-aliases.ts
|
|
15
|
+
var LOCAL_TEXT_FONT_CHOICES = [
|
|
16
|
+
"sans",
|
|
17
|
+
"serif",
|
|
18
|
+
"mono"
|
|
19
|
+
];
|
|
20
|
+
var RESERVED = /* @__PURE__ */ new Set([
|
|
21
|
+
...LOCAL_TEXT_FONT_CHOICES,
|
|
22
|
+
"constructor",
|
|
23
|
+
"prototype"
|
|
24
|
+
]);
|
|
25
|
+
var ALIAS = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
26
|
+
var FAMILY = /^[\p{L}\p{N}][\p{L}\p{M}\p{N} ._-]*$/u;
|
|
27
|
+
Object.freeze({});
|
|
28
|
+
var MAX_ALIASES = 64;
|
|
29
|
+
/** Validate metadata without reading a stylesheet or loading any font. */
|
|
30
|
+
function readLocalFontAliases(value, path) {
|
|
31
|
+
if (value === void 0) return void 0;
|
|
32
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${path} must map font aliases to family names.`);
|
|
33
|
+
const aliases = Object.keys(value).sort();
|
|
34
|
+
if (aliases.length > MAX_ALIASES) throw new TypeError(`${path} accepts at most ${MAX_ALIASES} aliases.`);
|
|
35
|
+
if (!aliases.length) return void 0;
|
|
36
|
+
const record = value;
|
|
37
|
+
const entries = aliases.map((alias) => {
|
|
38
|
+
if (alias.length > 64 || alias.trim() !== alias || !ALIAS.test(alias) || RESERVED.has(alias)) throw new TypeError(`${path} has an invalid or reserved font alias "${alias}".`);
|
|
39
|
+
const family = record[alias];
|
|
40
|
+
if (typeof family !== "string" || family.length > 600 || family.trim() !== family || !FAMILY.test(family)) throw new TypeError(`${path}.${alias} must be a single font family name.`);
|
|
41
|
+
return [alias, family];
|
|
42
|
+
});
|
|
43
|
+
return Object.freeze(Object.fromEntries(entries));
|
|
44
|
+
}
|
|
13
45
|
var LOCAL_KERNEL_DECLARATIONS = Object.freeze([
|
|
14
46
|
Object.freeze({
|
|
15
47
|
name: "computed",
|
|
@@ -89,7 +121,30 @@ var LOCAL_KERNEL_DECLARATIONS = Object.freeze([
|
|
|
89
121
|
rule: "none",
|
|
90
122
|
label: "none"
|
|
91
123
|
}
|
|
92
|
-
})
|
|
124
|
+
}),
|
|
125
|
+
{
|
|
126
|
+
name: "dataset",
|
|
127
|
+
form: "container",
|
|
128
|
+
childRule: "table",
|
|
129
|
+
label: "none",
|
|
130
|
+
props: {
|
|
131
|
+
name: {
|
|
132
|
+
kind: "string",
|
|
133
|
+
static: true,
|
|
134
|
+
required: true
|
|
135
|
+
},
|
|
136
|
+
key: {
|
|
137
|
+
kind: "string",
|
|
138
|
+
static: true,
|
|
139
|
+
required: true
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
structure: {
|
|
143
|
+
rule: "table",
|
|
144
|
+
label: "none"
|
|
145
|
+
},
|
|
146
|
+
rules: [{ kind: "single-table" }]
|
|
147
|
+
}
|
|
93
148
|
]);
|
|
94
149
|
// src/contracts/html-names.ts
|
|
95
150
|
/**
|
|
@@ -243,6 +298,18 @@ function isSafeLocalPattern(source) {
|
|
|
243
298
|
}
|
|
244
299
|
return groups.length === 0 && !escaped && !inClass;
|
|
245
300
|
}
|
|
301
|
+
// src/contracts/number-literal.ts
|
|
302
|
+
var NUMBER_TEXT = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
303
|
+
function parseNumberLiteral(raw) {
|
|
304
|
+
const text = raw.trim();
|
|
305
|
+
if (!NUMBER_TEXT.test(text)) return null;
|
|
306
|
+
const value = Number(text);
|
|
307
|
+
return Number.isFinite(value) ? value : null;
|
|
308
|
+
}
|
|
309
|
+
function parsePositiveNumberLiteral(raw) {
|
|
310
|
+
const value = parseNumberLiteral(raw);
|
|
311
|
+
return value !== null && value > 0 ? value : void 0;
|
|
312
|
+
}
|
|
246
313
|
// src/sdk/version.ts
|
|
247
314
|
/**
|
|
248
315
|
* SDK protocol identities and package version.
|
|
@@ -517,6 +584,7 @@ var RULE_KINDS = /* @__PURE__ */ new Set([
|
|
|
517
584
|
"progress-bounds",
|
|
518
585
|
"timer-duration",
|
|
519
586
|
"option-count",
|
|
587
|
+
"required-one-of",
|
|
520
588
|
"selection-requires",
|
|
521
589
|
"inline-body",
|
|
522
590
|
"no-components",
|
|
@@ -587,6 +655,7 @@ var PROP_KEYS = /* @__PURE__ */ new Set([
|
|
|
587
655
|
"max",
|
|
588
656
|
"integer",
|
|
589
657
|
"positive",
|
|
658
|
+
"allowPositiveNumber",
|
|
590
659
|
"color",
|
|
591
660
|
"coerce",
|
|
592
661
|
"description"
|
|
@@ -910,6 +979,15 @@ function readRule(value, path) {
|
|
|
910
979
|
kind,
|
|
911
980
|
...value.max !== void 0 ? { max: readRuleAttribute(value.max, `${path}.max`) } : {}
|
|
912
981
|
};
|
|
982
|
+
case "required-one-of": {
|
|
983
|
+
allow(["attributes"]);
|
|
984
|
+
const attributes = readRuleStringList(value.attributes, `${path}.attributes`);
|
|
985
|
+
if (!attributes.length) fail$2(`${path}.attributes`, "must list at least one attribute.");
|
|
986
|
+
return {
|
|
987
|
+
kind,
|
|
988
|
+
attributes
|
|
989
|
+
};
|
|
990
|
+
}
|
|
913
991
|
case "selection-requires":
|
|
914
992
|
allow(["key", "attributes"]);
|
|
915
993
|
return {
|
|
@@ -1261,6 +1339,7 @@ function readProp(value, path) {
|
|
|
1261
1339
|
"dynamic",
|
|
1262
1340
|
"integer",
|
|
1263
1341
|
"positive",
|
|
1342
|
+
"allowPositiveNumber",
|
|
1264
1343
|
"color",
|
|
1265
1344
|
"nullable"
|
|
1266
1345
|
]) {
|
|
@@ -1277,6 +1356,7 @@ function readProp(value, path) {
|
|
|
1277
1356
|
const hasEnum = rawEnum !== void 0;
|
|
1278
1357
|
if (typedKind !== "enum") {
|
|
1279
1358
|
if (hasEnum) fail$2(path, `"enum" is only valid for kind "enum", not "${typedKind}".`);
|
|
1359
|
+
if (out.allowPositiveNumber !== void 0) fail$2(path, "\"allowPositiveNumber\" is only valid for kind \"enum\".");
|
|
1280
1360
|
} else {
|
|
1281
1361
|
if (value.enum !== void 0 && value.values !== void 0) fail$2(path, "use \"enum\" or \"values\", not both.");
|
|
1282
1362
|
if (!Array.isArray(rawEnum) || rawEnum.length === 0) fail$2(`${path}.enum`, "must be a non-empty string array.");
|
|
@@ -1334,7 +1414,7 @@ function readProp(value, path) {
|
|
|
1334
1414
|
} else if (typedKind === "boolean") out.default = readBoolean(fallback, `${path}.default`);
|
|
1335
1415
|
else {
|
|
1336
1416
|
const text = readString(fallback, `${path}.default`, 128);
|
|
1337
|
-
if (!out.enum?.includes(text)) fail$2(`${path}.default`, `"${text}" is not an allowed enum value.`);
|
|
1417
|
+
if (!out.enum?.includes(text) && !(out.allowPositiveNumber && parsePositiveNumberLiteral(text) !== void 0)) fail$2(`${path}.default`, `"${text}" is not an allowed enum value.`);
|
|
1338
1418
|
out.default = text;
|
|
1339
1419
|
}
|
|
1340
1420
|
if (out.pattern !== void 0 && typedKind === "string" && typeof out.default === "string") {
|
|
@@ -1649,6 +1729,10 @@ function readLocalComponentManifest(value) {
|
|
|
1649
1729
|
if (value.children !== void 0 && value.structure !== void 0) fail$2("manifest", "cannot declare both \"children\" and \"structure\"; use \"structure\".");
|
|
1650
1730
|
const structure = value.structure !== void 0 ? readStructure(value.structure, form, "structure") : localStructureFromChildren(children);
|
|
1651
1731
|
const rules = value.rules === void 0 ? void 0 : readRules(value.rules);
|
|
1732
|
+
for (const [index, rule] of (rules ?? []).entries()) {
|
|
1733
|
+
if (rule.kind !== "required-one-of") continue;
|
|
1734
|
+
for (const attribute of rule.attributes) if (!Object.hasOwn(props, attribute)) fail$2(`rules[${index}].attributes`, `refers to undeclared attribute "${attribute}".`);
|
|
1735
|
+
}
|
|
1652
1736
|
const slotRelations = value.slotRelations === void 0 ? void 0 : readSlotRelations(value.slotRelations);
|
|
1653
1737
|
if (value.legacyHost !== void 0) readBoolean(value.legacyHost, "legacyHost");
|
|
1654
1738
|
const capabilities = readCapabilities(value.capabilities, "capabilities");
|
|
@@ -1718,6 +1802,7 @@ function canonicalProp(prop) {
|
|
|
1718
1802
|
...prop.max !== void 0 ? { max: prop.max } : {},
|
|
1719
1803
|
...prop.integer === true ? { integer: true } : {},
|
|
1720
1804
|
...prop.positive === true ? { positive: true } : {},
|
|
1805
|
+
...prop.allowPositiveNumber === true ? { allowPositiveNumber: true } : {},
|
|
1721
1806
|
...prop.color === true ? { color: true } : {},
|
|
1722
1807
|
...prop.coerce !== void 0 ? { coerce: prop.coerce } : {}
|
|
1723
1808
|
};
|
|
@@ -2019,7 +2104,11 @@ function readThemeList(value) {
|
|
|
2019
2104
|
if (names.has(name)) presetError("themes", `theme name "${name}" is declared more than once.`);
|
|
2020
2105
|
ids.add(id);
|
|
2021
2106
|
names.add(name);
|
|
2022
|
-
|
|
2107
|
+
const fonts = readLocalFontAliases(entry.fonts, `themes[${index}].fonts`);
|
|
2108
|
+
themes.push(Object.freeze({
|
|
2109
|
+
...entry,
|
|
2110
|
+
...entry.fonts !== void 0 ? { fonts } : {}
|
|
2111
|
+
}));
|
|
2023
2112
|
}
|
|
2024
2113
|
return Object.freeze(themes.sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
2025
2114
|
}
|
|
@@ -2110,7 +2199,8 @@ var SNAPSHOT_KEYS = /* @__PURE__ */ new Set([
|
|
|
2110
2199
|
"presets",
|
|
2111
2200
|
"components",
|
|
2112
2201
|
"replacementPolicy",
|
|
2113
|
-
"themes"
|
|
2202
|
+
"themes",
|
|
2203
|
+
"fonts"
|
|
2114
2204
|
]);
|
|
2115
2205
|
var MAX_ASSEMBLY_PRESETS = 32;
|
|
2116
2206
|
var MAX_ASSEMBLY_COMPONENTS = 256;
|
|
@@ -2189,7 +2279,11 @@ function readAssemblyThemes(value) {
|
|
|
2189
2279
|
if (typeof version !== "string" || !isLocalVersion(version)) fail$1(`assembly.themes[${index}].version`, "must be a semantic version.");
|
|
2190
2280
|
if (ids.has(id)) fail$1("assembly.themes", `theme id "${id}" is declared more than once.`);
|
|
2191
2281
|
ids.add(id);
|
|
2192
|
-
|
|
2282
|
+
const fonts = readLocalFontAliases(entry.fonts, `assembly.themes[${index}].fonts`);
|
|
2283
|
+
return Object.freeze({
|
|
2284
|
+
...entry,
|
|
2285
|
+
...entry.fonts !== void 0 ? { fonts } : {}
|
|
2286
|
+
});
|
|
2193
2287
|
}), (theme) => theme.id));
|
|
2194
2288
|
}
|
|
2195
2289
|
/** Validate and freeze a transported assembly snapshot. */
|
|
@@ -2199,12 +2293,14 @@ function readLocalAssemblySnapshot(value) {
|
|
|
2199
2293
|
if (value.protocol !== "reactive-md-assembly/v1") fail$1("assembly.protocol", `must be "${LOCAL_ASSEMBLY_PROTOCOL}".`);
|
|
2200
2294
|
const replacementPolicy = value.replacementPolicy;
|
|
2201
2295
|
if (replacementPolicy !== "allow" && replacementPolicy !== "forbid") fail$1("assembly.replacementPolicy", "must be \"allow\" or \"forbid\".");
|
|
2296
|
+
const fonts = readLocalFontAliases(value.fonts, "assembly.fonts");
|
|
2202
2297
|
return Object.freeze({
|
|
2203
2298
|
protocol: LOCAL_ASSEMBLY_PROTOCOL,
|
|
2204
2299
|
presets: readAssemblyPresets(value.presets),
|
|
2205
2300
|
components: readAssemblyComponents(value.components),
|
|
2206
2301
|
replacementPolicy,
|
|
2207
|
-
themes: readAssemblyThemes(value.themes)
|
|
2302
|
+
themes: readAssemblyThemes(value.themes),
|
|
2303
|
+
...fonts ? { fonts } : {}
|
|
2208
2304
|
});
|
|
2209
2305
|
}
|
|
2210
2306
|
function orderPresets(presets) {
|
|
@@ -2365,7 +2461,9 @@ function resolveContributions(contributions, replacementPolicy, presetAuthoring)
|
|
|
2365
2461
|
}
|
|
2366
2462
|
const active = [];
|
|
2367
2463
|
const replacements = [];
|
|
2368
|
-
for (const
|
|
2464
|
+
for (const contributions of groups.values()) {
|
|
2465
|
+
const chartColumn = contributions.find((item) => item.definition.id === "reactive-md/column" && item.origin.kind === "preset" && item.origin.id === "reactive-md/chart" && item.definition.replaces === void 0);
|
|
2466
|
+
const group = chartColumn && contributions.find((item) => item !== chartColumn && item.origin.kind === "preset" && item.origin.id.startsWith("reactive-md/") && item.definition.replaces === void 0 && localComponentDigest(item.definition) === localComponentDigest(chartColumn.definition) && JSON.stringify(effectiveAuthoring(item, presetAuthoring)) === JSON.stringify(effectiveAuthoring(chartColumn, presetAuthoring))) ? contributions.filter((item) => item !== chartColumn) : contributions;
|
|
2369
2467
|
if (group.length === 1) {
|
|
2370
2468
|
const only = group[0];
|
|
2371
2469
|
if (only.definition.replaces !== void 0) {
|
|
@@ -2534,6 +2632,7 @@ function localConfigFromAssembly(assembly, resolved, legacyKeys = resolved.legac
|
|
|
2534
2632
|
replacements: resolved.replacements,
|
|
2535
2633
|
registry: resolved.registry,
|
|
2536
2634
|
themes: resolved.themes,
|
|
2635
|
+
...assembly.fonts ? { fonts: assembly.fonts } : {},
|
|
2537
2636
|
legacyKeys: Object.freeze(legacyKeys)
|
|
2538
2637
|
});
|
|
2539
2638
|
}
|
|
@@ -2544,7 +2643,8 @@ function localAssemblyIdentity(input) {
|
|
|
2544
2643
|
presets: Object.freeze(sortById(input.presets, (item) => item.id)),
|
|
2545
2644
|
components: Object.freeze(sortById(input.registry.map(localComponentRequirement), (item) => item.id)),
|
|
2546
2645
|
replacements: Object.freeze(sortById(input.replacements, (item) => item.id)),
|
|
2547
|
-
legacyKeys: Object.freeze(sortById(input.legacyKeys, (item) => item.key))
|
|
2646
|
+
legacyKeys: Object.freeze(sortById(input.legacyKeys, (item) => item.key)),
|
|
2647
|
+
...input.fonts ? { fontDigest: localHash(JSON.stringify(input.fonts)) } : {}
|
|
2548
2648
|
});
|
|
2549
2649
|
}
|
|
2550
2650
|
/** Deterministic digest over the assembly identity. */
|
|
@@ -2577,6 +2677,7 @@ var CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
2577
2677
|
"replacements",
|
|
2578
2678
|
"registry",
|
|
2579
2679
|
"themes",
|
|
2680
|
+
"fonts",
|
|
2580
2681
|
"legacyKeys"
|
|
2581
2682
|
]);
|
|
2582
2683
|
function fail(path, message) {
|
|
@@ -2801,24 +2902,28 @@ var DEFAULT_COMPONENT_AUTHORING = Object.freeze({
|
|
|
2801
2902
|
},
|
|
2802
2903
|
text: {
|
|
2803
2904
|
title: {
|
|
2804
|
-
en: "
|
|
2805
|
-
zh: "
|
|
2905
|
+
en: "Inline text style",
|
|
2906
|
+
zh: "行内文字样式"
|
|
2806
2907
|
},
|
|
2807
2908
|
description: {
|
|
2808
|
-
en: "
|
|
2809
|
-
zh: "
|
|
2909
|
+
en: "Set at least one of color, size or font. Omitted styles are inherited.",
|
|
2910
|
+
zh: "至少填写 color、size、font 中的一项。省略的样式由上下文继承。"
|
|
2810
2911
|
},
|
|
2811
2912
|
category: "hint",
|
|
2812
2913
|
keywords: {
|
|
2813
2914
|
en: [
|
|
2814
2915
|
"text",
|
|
2815
2916
|
"color",
|
|
2816
|
-
"foreground"
|
|
2917
|
+
"foreground",
|
|
2918
|
+
"size",
|
|
2919
|
+
"font"
|
|
2817
2920
|
],
|
|
2818
2921
|
zh: [
|
|
2819
2922
|
"文字",
|
|
2820
2923
|
"颜色",
|
|
2821
|
-
"前景"
|
|
2924
|
+
"前景",
|
|
2925
|
+
"字号",
|
|
2926
|
+
"字体"
|
|
2822
2927
|
]
|
|
2823
2928
|
},
|
|
2824
2929
|
inline: true,
|
|
@@ -3459,6 +3564,39 @@ var DEFAULT_COMPONENT_AUTHORING = Object.freeze({
|
|
|
3459
3564
|
zh: "<if when=\"{{ {{select:true}} }}\">\n{{selection:示例内容}}\n</if>"
|
|
3460
3565
|
}
|
|
3461
3566
|
},
|
|
3567
|
+
else: {
|
|
3568
|
+
title: {
|
|
3569
|
+
en: "If/else pair",
|
|
3570
|
+
zh: "条件与否则"
|
|
3571
|
+
},
|
|
3572
|
+
description: {
|
|
3573
|
+
en: "Insert a complete if/else pair; the else branch shows when the condition is false.",
|
|
3574
|
+
zh: "一次插入完整的 if/else 配对;条件不成立时显示否则分支。"
|
|
3575
|
+
},
|
|
3576
|
+
category: "layout",
|
|
3577
|
+
keywords: {
|
|
3578
|
+
en: [
|
|
3579
|
+
"else",
|
|
3580
|
+
"if",
|
|
3581
|
+
"otherwise",
|
|
3582
|
+
"fallback",
|
|
3583
|
+
"condition",
|
|
3584
|
+
"branch"
|
|
3585
|
+
],
|
|
3586
|
+
zh: [
|
|
3587
|
+
"否则",
|
|
3588
|
+
"如果",
|
|
3589
|
+
"其他",
|
|
3590
|
+
"分支",
|
|
3591
|
+
"条件",
|
|
3592
|
+
"配对"
|
|
3593
|
+
]
|
|
3594
|
+
},
|
|
3595
|
+
insertText: {
|
|
3596
|
+
en: "<if when=\"{{ {{select:true}} }}\">\n{{selection:Sample content}}\n</if>\n<else>\n{{selection:Alternative content}}\n</else>",
|
|
3597
|
+
zh: "<if when=\"{{ {{select:true}} }}\">\n{{selection:示例内容}}\n</if>\n<else>\n{{selection:否则内容}}\n</else>"
|
|
3598
|
+
}
|
|
3599
|
+
},
|
|
3462
3600
|
gallery: {
|
|
3463
3601
|
title: {
|
|
3464
3602
|
en: "Gallery",
|
|
@@ -4234,6 +4372,7 @@ function optionsComponent(name, def = "container") {
|
|
|
4234
4372
|
return definition(name, def, {
|
|
4235
4373
|
props: {
|
|
4236
4374
|
label: label(),
|
|
4375
|
+
options: props.expressionText(),
|
|
4237
4376
|
disabled: disabled(),
|
|
4238
4377
|
color: color()
|
|
4239
4378
|
},
|
|
@@ -4253,6 +4392,13 @@ function optionsComponent(name, def = "container") {
|
|
|
4253
4392
|
valueAttribute: "value",
|
|
4254
4393
|
unique: true,
|
|
4255
4394
|
max: MAX_LOCAL_ARRAY_LENGTH
|
|
4395
|
+
}, {
|
|
4396
|
+
kind: "require-full-interpolation",
|
|
4397
|
+
attributes: ["options"]
|
|
4398
|
+
}, {
|
|
4399
|
+
kind: "scoped-expressions",
|
|
4400
|
+
attributes: ["options"],
|
|
4401
|
+
scope: "row"
|
|
4256
4402
|
})
|
|
4257
4403
|
});
|
|
4258
4404
|
}
|
|
@@ -4262,6 +4408,7 @@ var radioGroupDef = optionsComponent("radio-group");
|
|
|
4262
4408
|
var multiSelectDef = definition("multi-select", "container", {
|
|
4263
4409
|
props: {
|
|
4264
4410
|
label: label(),
|
|
4411
|
+
options: props.expressionText(),
|
|
4265
4412
|
"max-selected": props.number({
|
|
4266
4413
|
integer: true,
|
|
4267
4414
|
min: 0
|
|
@@ -4293,6 +4440,13 @@ var multiSelectDef = definition("multi-select", "container", {
|
|
|
4293
4440
|
}, {
|
|
4294
4441
|
kind: "option-count",
|
|
4295
4442
|
max: "max-selected"
|
|
4443
|
+
}, {
|
|
4444
|
+
kind: "require-full-interpolation",
|
|
4445
|
+
attributes: ["options"]
|
|
4446
|
+
}, {
|
|
4447
|
+
kind: "scoped-expressions",
|
|
4448
|
+
attributes: ["options"],
|
|
4449
|
+
scope: "row"
|
|
4296
4450
|
})
|
|
4297
4451
|
});
|
|
4298
4452
|
var optionDef = definition("option", "container", {
|
|
@@ -4444,10 +4598,23 @@ var anchorDef = definition("anchor", "leaf", {
|
|
|
4444
4598
|
})
|
|
4445
4599
|
});
|
|
4446
4600
|
var textDef = definition("text", "inline", {
|
|
4447
|
-
props: {
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4601
|
+
props: {
|
|
4602
|
+
color: color(),
|
|
4603
|
+
size: props.choice([
|
|
4604
|
+
"sm",
|
|
4605
|
+
"md",
|
|
4606
|
+
"lg",
|
|
4607
|
+
"xl"
|
|
4608
|
+
], {
|
|
4609
|
+
static: true,
|
|
4610
|
+
allowPositiveNumber: true,
|
|
4611
|
+
description: {
|
|
4612
|
+
en: "A theme size or a positive number in pixels, such as 20.",
|
|
4613
|
+
zh: "主题字号或以像素为单位的正数,例如 20。"
|
|
4614
|
+
}
|
|
4615
|
+
}),
|
|
4616
|
+
font: props.choice(LOCAL_TEXT_FONT_CHOICES, { static: true })
|
|
4617
|
+
},
|
|
4451
4618
|
structure: structure({
|
|
4452
4619
|
rule: "inline",
|
|
4453
4620
|
label: "none",
|
|
@@ -4455,6 +4622,13 @@ var textDef = definition("text", "inline", {
|
|
|
4455
4622
|
noComponents: true
|
|
4456
4623
|
}),
|
|
4457
4624
|
rules: rules({
|
|
4625
|
+
kind: "required-one-of",
|
|
4626
|
+
attributes: [
|
|
4627
|
+
"color",
|
|
4628
|
+
"size",
|
|
4629
|
+
"font"
|
|
4630
|
+
]
|
|
4631
|
+
}, {
|
|
4458
4632
|
kind: "inline-body",
|
|
4459
4633
|
strict: true
|
|
4460
4634
|
}, { kind: "no-components" })
|
|
@@ -4681,6 +4855,17 @@ var ifDef = definition("if", "container", {
|
|
|
4681
4855
|
attributes: ["when"]
|
|
4682
4856
|
})
|
|
4683
4857
|
});
|
|
4858
|
+
var elseDef = definition("else", "container", {
|
|
4859
|
+
props: { when: props.boolean({ dynamic: true }) },
|
|
4860
|
+
structure: structure({
|
|
4861
|
+
rule: "any",
|
|
4862
|
+
label: "none"
|
|
4863
|
+
}),
|
|
4864
|
+
rules: rules({
|
|
4865
|
+
kind: "require-full-interpolation",
|
|
4866
|
+
attributes: ["when"]
|
|
4867
|
+
})
|
|
4868
|
+
});
|
|
4684
4869
|
var alertDef = definition("alert", "container", {
|
|
4685
4870
|
props: {
|
|
4686
4871
|
title: optionalTitle(),
|
|
@@ -4764,15 +4949,36 @@ var validationDef = definition("validation", "leaf", {
|
|
|
4764
4949
|
var dataTableDef = definition("data-table", "container", {
|
|
4765
4950
|
props: {
|
|
4766
4951
|
label: props.staticText(),
|
|
4952
|
+
empty: props.staticText(),
|
|
4767
4953
|
rows: props.expressionText({ required: true }),
|
|
4768
4954
|
key: props.expressionText({ required: true }),
|
|
4955
|
+
searchable: props.boolean({ default: false }),
|
|
4956
|
+
sortable: props.boolean({ default: false }),
|
|
4957
|
+
"page-size": props.number({
|
|
4958
|
+
integer: true,
|
|
4959
|
+
positive: true
|
|
4960
|
+
}),
|
|
4769
4961
|
"max-rows": props.number({
|
|
4770
4962
|
integer: true,
|
|
4771
4963
|
positive: true,
|
|
4772
4964
|
max: MAX_LOCAL_DATA_TABLE_ROWS,
|
|
4773
4965
|
default: 100
|
|
4774
|
-
})
|
|
4966
|
+
}),
|
|
4967
|
+
align: props.choice([
|
|
4968
|
+
"left",
|
|
4969
|
+
"center",
|
|
4970
|
+
"right"
|
|
4971
|
+
], {
|
|
4972
|
+
static: true,
|
|
4973
|
+
default: "center"
|
|
4974
|
+
}),
|
|
4975
|
+
"row-align": props.choice([
|
|
4976
|
+
"left",
|
|
4977
|
+
"center",
|
|
4978
|
+
"right"
|
|
4979
|
+
], { dynamic: true })
|
|
4775
4980
|
},
|
|
4981
|
+
bindings: { value: binding("string", "selection", "none", { requiresAttributes: ["key"] }) },
|
|
4776
4982
|
structure: structure({
|
|
4777
4983
|
rule: "components",
|
|
4778
4984
|
label: "required",
|
|
@@ -4795,10 +5001,14 @@ var dataTableDef = definition("data-table", "container", {
|
|
|
4795
5001
|
maxColumns: 20
|
|
4796
5002
|
}, {
|
|
4797
5003
|
kind: "require-full-interpolation",
|
|
4798
|
-
attributes: [
|
|
5004
|
+
attributes: [
|
|
5005
|
+
"rows",
|
|
5006
|
+
"key",
|
|
5007
|
+
"row-align"
|
|
5008
|
+
]
|
|
4799
5009
|
}, {
|
|
4800
5010
|
kind: "scoped-expressions",
|
|
4801
|
-
attributes: ["key"],
|
|
5011
|
+
attributes: ["key", "row-align"],
|
|
4802
5012
|
scope: "row"
|
|
4803
5013
|
}, {
|
|
4804
5014
|
kind: "row-values",
|
|
@@ -4806,17 +5016,59 @@ var dataTableDef = definition("data-table", "container", {
|
|
|
4806
5016
|
key: "key",
|
|
4807
5017
|
child: "column",
|
|
4808
5018
|
childValue: "value"
|
|
5019
|
+
}, {
|
|
5020
|
+
kind: "self-binding-read",
|
|
5021
|
+
mode: "always"
|
|
4809
5022
|
})
|
|
4810
5023
|
});
|
|
4811
5024
|
var columnDef = definition("column", "leaf", {
|
|
4812
5025
|
props: {
|
|
4813
5026
|
label: props.staticText({ required: true }),
|
|
4814
|
-
value: props.expressionText({ required: true })
|
|
5027
|
+
value: props.expressionText({ required: true }),
|
|
5028
|
+
format: props.choice([
|
|
5029
|
+
"plain",
|
|
5030
|
+
"number",
|
|
5031
|
+
"percent",
|
|
5032
|
+
"scientific",
|
|
5033
|
+
"currency"
|
|
5034
|
+
], {
|
|
5035
|
+
static: true,
|
|
5036
|
+
default: "plain"
|
|
5037
|
+
}),
|
|
5038
|
+
summary: props.choice([
|
|
5039
|
+
"sum",
|
|
5040
|
+
"average",
|
|
5041
|
+
"count"
|
|
5042
|
+
], { static: true }),
|
|
5043
|
+
align: props.choice([
|
|
5044
|
+
"left",
|
|
5045
|
+
"center",
|
|
5046
|
+
"right"
|
|
5047
|
+
], { static: true }),
|
|
5048
|
+
digits: props.number({
|
|
5049
|
+
integer: true,
|
|
5050
|
+
min: 0,
|
|
5051
|
+
max: 20
|
|
5052
|
+
}),
|
|
5053
|
+
currency: props.staticText({
|
|
5054
|
+
default: "USD",
|
|
5055
|
+
pattern: "^[A-Z]{3}$"
|
|
5056
|
+
}),
|
|
5057
|
+
locale: props.choice([
|
|
5058
|
+
"en-US",
|
|
5059
|
+
"zh-CN",
|
|
5060
|
+
"de-DE",
|
|
5061
|
+
"fr-FR",
|
|
5062
|
+
"ja-JP"
|
|
5063
|
+
], {
|
|
5064
|
+
static: true,
|
|
5065
|
+
default: "en-US"
|
|
5066
|
+
})
|
|
4815
5067
|
},
|
|
4816
5068
|
structure: structure({
|
|
4817
5069
|
rule: "none",
|
|
4818
5070
|
label: "none",
|
|
4819
|
-
parents: ["data-table"]
|
|
5071
|
+
parents: ["data-table", "chart"]
|
|
4820
5072
|
}),
|
|
4821
5073
|
rules: rules({
|
|
4822
5074
|
kind: "require-full-interpolation",
|
|
@@ -4872,11 +5124,18 @@ var chartDef = definition("chart", "container", {
|
|
|
4872
5124
|
default: "bar"
|
|
4873
5125
|
}),
|
|
4874
5126
|
title: optionalTitle(),
|
|
5127
|
+
rows: props.expressionText(),
|
|
4875
5128
|
x: props.staticText(),
|
|
4876
5129
|
y: props.staticText(),
|
|
4877
5130
|
"x-label": props.text(),
|
|
4878
5131
|
"y-label": props.text(),
|
|
4879
|
-
key: props.staticText()
|
|
5132
|
+
key: props.staticText(),
|
|
5133
|
+
"max-rows": props.number({
|
|
5134
|
+
integer: true,
|
|
5135
|
+
positive: true,
|
|
5136
|
+
max: MAX_LOCAL_DATA_TABLE_ROWS,
|
|
5137
|
+
default: 100
|
|
5138
|
+
})
|
|
4880
5139
|
},
|
|
4881
5140
|
bindings: { value: binding("string", "selection", "none", { requiresAttributes: ["key"] }) },
|
|
4882
5141
|
structure: structure({
|
|
@@ -4888,6 +5147,10 @@ var chartDef = definition("chart", "container", {
|
|
|
4888
5147
|
chartKind: "kind",
|
|
4889
5148
|
x: "x",
|
|
4890
5149
|
y: "y"
|
|
5150
|
+
}, {
|
|
5151
|
+
kind: "scoped-expressions",
|
|
5152
|
+
attributes: ["rows"],
|
|
5153
|
+
scope: "row"
|
|
4891
5154
|
}, {
|
|
4892
5155
|
kind: "table-selection",
|
|
4893
5156
|
key: "key",
|
|
@@ -5075,6 +5338,7 @@ var DEFAULT_SEMANTIC_COMPONENTS = Object.freeze([
|
|
|
5075
5338
|
accordionDef,
|
|
5076
5339
|
disclosureDef,
|
|
5077
5340
|
ifDef,
|
|
5341
|
+
elseDef,
|
|
5078
5342
|
alertDef,
|
|
5079
5343
|
badgeDef,
|
|
5080
5344
|
tooltipDef,
|
|
@@ -6047,7 +6311,12 @@ function rewriteDeclarationBody(body, families) {
|
|
|
6047
6311
|
if (families.size === 0) return body;
|
|
6048
6312
|
const replacements = [];
|
|
6049
6313
|
for (const declaration of scanDeclarations(body, true)) {
|
|
6050
|
-
const familyProperty =
|
|
6314
|
+
const familyProperty = [
|
|
6315
|
+
"font-family",
|
|
6316
|
+
"--font-sans",
|
|
6317
|
+
"--font-serif",
|
|
6318
|
+
"--font-mono"
|
|
6319
|
+
].includes(declaration.name);
|
|
6051
6320
|
if (!familyProperty && declaration.name !== "font") continue;
|
|
6052
6321
|
const value = body.slice(declaration.valueStart, declaration.valueEnd);
|
|
6053
6322
|
const rewritten = familyProperty ? rewriteFontFamilyList(value, families) : rewriteFontShorthand(value, families);
|
|
@@ -6291,12 +6560,17 @@ function freezePackage(input) {
|
|
|
6291
6560
|
version: input.version,
|
|
6292
6561
|
protocol: input.protocol,
|
|
6293
6562
|
colorSchemes: Object.freeze([...input.colorSchemes]),
|
|
6563
|
+
...input.fonts ? { fonts: input.fonts } : {},
|
|
6294
6564
|
css: Object.freeze(input.css.map((resource) => Object.freeze({
|
|
6295
6565
|
id: resource.id,
|
|
6296
6566
|
css: resource.css
|
|
6297
6567
|
})))
|
|
6298
6568
|
});
|
|
6299
6569
|
}
|
|
6570
|
+
function rewriteFontAliases(fonts, families) {
|
|
6571
|
+
if (!fonts || families.size === 0) return fonts;
|
|
6572
|
+
return Object.freeze(Object.fromEntries(Object.entries(fonts).map(([alias, family]) => [alias, families.get(normalizeFontFamily(family)) ?? family])));
|
|
6573
|
+
}
|
|
6300
6574
|
/**
|
|
6301
6575
|
* Validate, scope and freeze a theme package. The input is cloned; the result
|
|
6302
6576
|
* and every nested resource are frozen.
|
|
@@ -6321,7 +6595,8 @@ function defineLocalTheme(input) {
|
|
|
6321
6595
|
version,
|
|
6322
6596
|
protocol: LOCAL_THEME_PROTOCOL,
|
|
6323
6597
|
colorSchemes,
|
|
6324
|
-
css: scoped
|
|
6598
|
+
css: scoped,
|
|
6599
|
+
fonts: rewriteFontAliases(readLocalFontAliases(record.fonts, "theme.fonts"), families)
|
|
6325
6600
|
});
|
|
6326
6601
|
}
|
|
6327
6602
|
// src/sdk/preset.ts
|
|
@@ -6369,7 +6644,8 @@ var INPUT_KEYS = /* @__PURE__ */ new Set([
|
|
|
6369
6644
|
"presets",
|
|
6370
6645
|
"components",
|
|
6371
6646
|
"replacements",
|
|
6372
|
-
"themes"
|
|
6647
|
+
"themes",
|
|
6648
|
+
"fonts"
|
|
6373
6649
|
]);
|
|
6374
6650
|
/**
|
|
6375
6651
|
* Configurations produced by this module are deeply frozen and already
|
|
@@ -6385,7 +6661,8 @@ function readThemePackage(value) {
|
|
|
6385
6661
|
"version",
|
|
6386
6662
|
"protocol",
|
|
6387
6663
|
"colorSchemes",
|
|
6388
|
-
"css"
|
|
6664
|
+
"css",
|
|
6665
|
+
"fonts"
|
|
6389
6666
|
]), "theme");
|
|
6390
6667
|
try {
|
|
6391
6668
|
return defineLocalTheme(value);
|
|
@@ -6469,12 +6746,14 @@ function readReplacementPolicy(value) {
|
|
|
6469
6746
|
function buildAssembly(input, path) {
|
|
6470
6747
|
if (!isPlainRecord(input)) fail(path, "must be an object.");
|
|
6471
6748
|
checkKeys(input, INPUT_KEYS, path);
|
|
6749
|
+
const fonts = readLocalFontAliases(input.fonts, "fonts");
|
|
6472
6750
|
const assembly = Object.freeze({
|
|
6473
6751
|
protocol: LOCAL_ASSEMBLY_PROTOCOL,
|
|
6474
6752
|
presets: readPresetInputs(input.presets),
|
|
6475
6753
|
components: readInputComponents(input.components),
|
|
6476
6754
|
replacementPolicy: readReplacementPolicy(input.replacements),
|
|
6477
|
-
themes: readInputThemes(input.themes)
|
|
6755
|
+
themes: readInputThemes(input.themes),
|
|
6756
|
+
...fonts ? { fonts } : {}
|
|
6478
6757
|
});
|
|
6479
6758
|
if (localJsonByteLength(assembly) > 16777216) fail(path, `serialized size exceeds the ${MAX_LOCAL_SDK_CONFIG_BYTES}-byte budget.`);
|
|
6480
6759
|
return assembly;
|
|
@@ -6566,7 +6845,8 @@ function localThemeContractDigest(theme) {
|
|
|
6566
6845
|
theme.version,
|
|
6567
6846
|
theme.protocol,
|
|
6568
6847
|
theme.colorSchemes,
|
|
6569
|
-
theme.css.map(({ id, css }) => [id, css])
|
|
6848
|
+
theme.css.map(({ id, css }) => [id, css]),
|
|
6849
|
+
...theme.fonts ? [theme.fonts] : []
|
|
6570
6850
|
]));
|
|
6571
6851
|
}
|
|
6572
6852
|
function createLocalBundleManifest(script, config) {
|
|
@@ -7731,6 +8011,18 @@ if (typeof document !== "undefined") {
|
|
|
7731
8011
|
}
|
|
7732
8012
|
// src/build/vite.ts
|
|
7733
8013
|
var MAX_SCRIPT_BYTES = 33554432;
|
|
8014
|
+
var NODE_BUILTIN_MARKER = "reactive-md-node-builtin: ";
|
|
8015
|
+
var NODE_BUILTINS = new Set(builtinModules.flatMap((name) => [name, `node:${name}`]));
|
|
8016
|
+
function nodeBuiltinMessage(id, importer) {
|
|
8017
|
+
return `${NODE_BUILTIN_MARKER}"${id}"${importer ? ` (imported by ${importer})` : ""} cannot be bundled for a browser build. Host modules run in the browser; compute build-only paths in the build script or use new URL('.', import.meta.url) for root.`;
|
|
8018
|
+
}
|
|
8019
|
+
function browserSafetyDetail(error) {
|
|
8020
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
8021
|
+
const index = message.indexOf(NODE_BUILTIN_MARKER);
|
|
8022
|
+
if (index < 0) return null;
|
|
8023
|
+
const end = message.indexOf("\n", index);
|
|
8024
|
+
return message.slice(index + 26, end < 0 ? void 0 : end).replace(/\u001b\[[0-9;]*m/g, "");
|
|
8025
|
+
}
|
|
7734
8026
|
var FORBIDDEN_SCRIPT_TOKENS = [
|
|
7735
8027
|
[/\bimport\s*\.\s*meta\b/, "import.meta"],
|
|
7736
8028
|
[/\bimport\s*\(/, "a dynamic import"],
|
|
@@ -7854,7 +8146,8 @@ async function buildLocalStandaloneScript(input, vite, diagnostics) {
|
|
|
7854
8146
|
plugins: [{
|
|
7855
8147
|
name: "reactive-md-standalone-host",
|
|
7856
8148
|
enforce: "pre",
|
|
7857
|
-
resolveId(id) {
|
|
8149
|
+
resolveId(id, importer) {
|
|
8150
|
+
if (id.startsWith("node:") || NODE_BUILTINS.has(id)) throw new Error(nodeBuiltinMessage(id, importer));
|
|
7858
8151
|
if (id === "virtual:reactive-md-host-entry") return `\0${VIRTUAL_HOST_ENTRY}`;
|
|
7859
8152
|
if (id === "virtual:reactive-md-host-module") return hostId;
|
|
7860
8153
|
return null;
|
|
@@ -7897,7 +8190,8 @@ async function buildLocalStandaloneScript(input, vite, diagnostics) {
|
|
|
7897
8190
|
try {
|
|
7898
8191
|
result = await vite.build(config);
|
|
7899
8192
|
} catch (error) {
|
|
7900
|
-
|
|
8193
|
+
const safety = browserSafetyDetail(error);
|
|
8194
|
+
diagnostics.push(safety ? buildDiagnostic("local.build.host-browser", `The standalone host is not browser-safe: ${safety}`) : buildDiagnostic("local.build.vite", `The Vite build failed: ${messageOf(error)}`));
|
|
7901
8195
|
return null;
|
|
7902
8196
|
}
|
|
7903
8197
|
const output = readSingleOutput(result, diagnostics);
|
|
@@ -8052,4 +8346,4 @@ async function buildLocalStandaloneBundle(options) {
|
|
|
8052
8346
|
manifest
|
|
8053
8347
|
});
|
|
8054
8348
|
}
|
|
8055
|
-
export { DEFAULT_LOCAL_BUILD_BUDGETS, LOCAL_BUILD_PROTOCOL, LocalBuildError, VIRTUAL_HOST_ENTRY, VIRTUAL_HOST_MODULE, buildLocalStandaloneBundle, collectLocalBuildNotices, collectLocalBuildResources, createLocalStandaloneEntrySource, defineLocalTheme as n, preflightLocalStandaloneBuild, LOCAL_REACT_PRESET_PROTOCOL as r, readLocalBuildBudgets, readLocalBuildHost, readLocalStyleResourceInputs, resolveLocalVite, createLocalConfig as t };
|
|
8349
|
+
export { DEFAULT_LOCAL_BUILD_BUDGETS, LOCAL_BUILD_PROTOCOL, LocalBuildError, VIRTUAL_HOST_ENTRY, VIRTUAL_HOST_MODULE, buildLocalStandaloneBundle, collectLocalBuildNotices, collectLocalBuildResources, createLocalStandaloneEntrySource, readLocalFontAliases as i, defineLocalTheme as n, preflightLocalStandaloneBuild, LOCAL_REACT_PRESET_PROTOCOL as r, readLocalBuildBudgets, readLocalBuildHost, readLocalStyleResourceInputs, resolveLocalVite, createLocalConfig as t };
|