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,7 +1,48 @@
|
|
|
1
1
|
import { b as e, c as t, o as n, s as r, u as i } from "./limits-CFERRrlC.js";
|
|
2
|
-
import { f as a, h as o, l as s, n as c, s as l } from "./version-
|
|
2
|
+
import { f as a, h as o, l as s, n as c, s as l } from "./version-4wzhbvDG.js";
|
|
3
|
+
// src/contracts/font-aliases.ts
|
|
4
|
+
var u = [
|
|
5
|
+
"sans",
|
|
6
|
+
"serif",
|
|
7
|
+
"mono"
|
|
8
|
+
], d = "reactive-md/text", f = /* @__PURE__ */ new Set([
|
|
9
|
+
...u,
|
|
10
|
+
"constructor",
|
|
11
|
+
"prototype"
|
|
12
|
+
]), p = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, m = /^[\p{L}\p{N}][\p{L}\p{M}\p{N} ._-]*$/u, h = Object.freeze({}), g = 64;
|
|
13
|
+
function _(e, t) {
|
|
14
|
+
if (e === void 0) return;
|
|
15
|
+
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError(`${t} must map font aliases to family names.`);
|
|
16
|
+
let n = Object.keys(e).sort();
|
|
17
|
+
if (n.length > g) throw TypeError(`${t} accepts at most ${g} aliases.`);
|
|
18
|
+
if (!n.length) return;
|
|
19
|
+
let r = e, i = n.map((e) => {
|
|
20
|
+
if (e.length > 64 || e.trim() !== e || !p.test(e) || f.has(e)) throw TypeError(`${t} has an invalid or reserved font alias "${e}".`);
|
|
21
|
+
let n = r[e];
|
|
22
|
+
if (typeof n != "string" || n.length > 600 || n.trim() !== n || !m.test(n)) throw TypeError(`${t}.${e} must be a single font family name.`);
|
|
23
|
+
return [e, n];
|
|
24
|
+
});
|
|
25
|
+
return Object.freeze(Object.fromEntries(i));
|
|
26
|
+
}
|
|
27
|
+
function v(e, t) {
|
|
28
|
+
let n = e?.fonts, r = e?.themes.find((e) => e.name === t)?.fonts;
|
|
29
|
+
return r ? {
|
|
30
|
+
...n,
|
|
31
|
+
...r
|
|
32
|
+
} : n ?? h;
|
|
33
|
+
}
|
|
34
|
+
function y(e, t = u) {
|
|
35
|
+
return [.../* @__PURE__ */ new Set([...t, ...Object.keys(e).sort()])];
|
|
36
|
+
}
|
|
37
|
+
function b(e) {
|
|
38
|
+
let t = Object.keys(e.fonts ?? h).sort(), n = e.themes.flatMap((e) => {
|
|
39
|
+
let t = Object.keys(e.fonts ?? h).sort();
|
|
40
|
+
return t.length ? [[e.name, t]] : [];
|
|
41
|
+
});
|
|
42
|
+
return t.length || n.length ? JSON.stringify([t, n]) : "";
|
|
43
|
+
}
|
|
3
44
|
// src/sdk/hash.ts
|
|
4
|
-
function
|
|
45
|
+
function x(e) {
|
|
5
46
|
let t = 2166136261, n = 16777619;
|
|
6
47
|
for (let r = 0; r < e.length; r += 1) {
|
|
7
48
|
let i = e.charCodeAt(r);
|
|
@@ -11,14 +52,14 @@ function u(e) {
|
|
|
11
52
|
return t ^= r, t = Math.imul(t, 16777619) >>> 0, n ^= r, n = Math.imul(n, 3266489909) >>> 0, `rmd-${t.toString(16).padStart(8, "0")}${n.toString(16).padStart(8, "0")}`;
|
|
12
53
|
}
|
|
13
54
|
// src/sdk/pattern.ts
|
|
14
|
-
function
|
|
55
|
+
function S(e, t) {
|
|
15
56
|
let n = e[t];
|
|
16
57
|
if (n === "*" || n === "+" || n === "?") return { length: e[t + 1] === "?" ? 2 : 1 };
|
|
17
58
|
if (n !== "{") return null;
|
|
18
59
|
let r = /^\{(\d+)(?:,(\d*))?\}/.exec(e.slice(t));
|
|
19
60
|
return r ? { length: r[0].length + +(e[t + r[0].length] === "?") } : null;
|
|
20
61
|
}
|
|
21
|
-
function
|
|
62
|
+
function ee(e) {
|
|
22
63
|
let t = [], n = !1, r = !1;
|
|
23
64
|
for (let i = 0; i < e.length; i += 1) {
|
|
24
65
|
let a = e[i];
|
|
@@ -63,13 +104,13 @@ function f(e) {
|
|
|
63
104
|
if (a === ")") {
|
|
64
105
|
let n = t.pop();
|
|
65
106
|
if (!n) return !1;
|
|
66
|
-
let r =
|
|
107
|
+
let r = S(e, i + 1);
|
|
67
108
|
if (r && (n.quantified || n.alternation)) return !1;
|
|
68
109
|
let a = t[t.length - 1];
|
|
69
110
|
a && (a.quantified = a.quantified || n.quantified || r !== null, a.alternation = a.alternation || n.alternation), r && (i += r.length);
|
|
70
111
|
continue;
|
|
71
112
|
}
|
|
72
|
-
let o =
|
|
113
|
+
let o = S(e, i);
|
|
73
114
|
if (o) {
|
|
74
115
|
let e = t[t.length - 1];
|
|
75
116
|
e && (e.quantified = !0), i += o.length - 1;
|
|
@@ -77,28 +118,40 @@ function f(e) {
|
|
|
77
118
|
}
|
|
78
119
|
return t.length === 0 && !n && !r;
|
|
79
120
|
}
|
|
121
|
+
// src/contracts/number-literal.ts
|
|
122
|
+
var te = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
123
|
+
function ne(e) {
|
|
124
|
+
let t = e.trim();
|
|
125
|
+
if (!te.test(t)) return null;
|
|
126
|
+
let n = Number(t);
|
|
127
|
+
return Number.isFinite(n) ? n : null;
|
|
128
|
+
}
|
|
129
|
+
function re(e) {
|
|
130
|
+
let t = ne(e);
|
|
131
|
+
return t !== null && t > 0 ? t : void 0;
|
|
132
|
+
}
|
|
80
133
|
// src/sdk/manifest.ts
|
|
81
|
-
var
|
|
134
|
+
var ie = 64, ae = 64, oe = 128, se = 160, ce = 64, le = 64, ue = 512, C = 4096, de = 16, fe = 32, pe = 256, me = 65536, w = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, T = /^[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*$/, he = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/, ge = /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/, E = /* @__PURE__ */ new Set([
|
|
82
135
|
"__proto__",
|
|
83
136
|
"constructor",
|
|
84
137
|
"prototype"
|
|
85
|
-
]),
|
|
138
|
+
]), D = /* @__PURE__ */ new WeakSet(), _e = /* @__PURE__ */ new Set([
|
|
86
139
|
"string",
|
|
87
140
|
"number",
|
|
88
141
|
"boolean",
|
|
89
142
|
"enum"
|
|
90
|
-
]),
|
|
143
|
+
]), ve = /* @__PURE__ */ new Set([
|
|
91
144
|
"leaf",
|
|
92
145
|
"inline",
|
|
93
146
|
"container"
|
|
94
|
-
]),
|
|
147
|
+
]), ye = /* @__PURE__ */ new Set([
|
|
95
148
|
"string",
|
|
96
149
|
"number",
|
|
97
150
|
"boolean",
|
|
98
151
|
"null",
|
|
99
152
|
"array",
|
|
100
153
|
"number-array"
|
|
101
|
-
]),
|
|
154
|
+
]), be = /* @__PURE__ */ new Set([
|
|
102
155
|
"text",
|
|
103
156
|
"number",
|
|
104
157
|
"boolean",
|
|
@@ -112,7 +165,7 @@ var p = 64, m = 64, h = 128, g = 160, _ = 64, v = 64, y = 512, b = 4096, x = 16,
|
|
|
112
165
|
"selection",
|
|
113
166
|
"steps",
|
|
114
167
|
"collection"
|
|
115
|
-
]),
|
|
168
|
+
]), xe = /* @__PURE__ */ new Set([
|
|
116
169
|
"empty",
|
|
117
170
|
"false",
|
|
118
171
|
"max-step",
|
|
@@ -126,11 +179,11 @@ var p = 64, m = 64, h = 128, g = 160, _ = 64, v = 64, y = 512, b = 4096, x = 16,
|
|
|
126
179
|
"duration",
|
|
127
180
|
"empty-array",
|
|
128
181
|
"none"
|
|
129
|
-
]),
|
|
182
|
+
]), Se = /* @__PURE__ */ new Set([
|
|
130
183
|
"none",
|
|
131
184
|
"inline",
|
|
132
185
|
"markdown"
|
|
133
|
-
]),
|
|
186
|
+
]), Ce = /* @__PURE__ */ new Set([
|
|
134
187
|
"none",
|
|
135
188
|
"any",
|
|
136
189
|
"inline",
|
|
@@ -144,11 +197,11 @@ var p = 64, m = 64, h = 128, g = 160, _ = 64, v = 64, y = 512, b = 4096, x = 16,
|
|
|
144
197
|
"tabs",
|
|
145
198
|
"steps",
|
|
146
199
|
"components"
|
|
147
|
-
]),
|
|
200
|
+
]), we = /* @__PURE__ */ new Set(/* @__PURE__ */ "numeric-range.text-length.date-bounds.nonempty.progress-bounds.timer-duration.option-count.required-one-of.selection-requires.inline-body.no-components.single-table.math-body.options-body.value-sequence.only-children.diagram-body.quiz-body.checklist-body.dynamic-constraints.require-full-interpolation.scoped-expressions.row-values.validation-rule.anchor.navigation.data-table.plot-math.chart-table.timeline-table.table-selection.retain.self-binding-read.inline-math-reads.value-date.value-length.value-required.value-email".split(".")), Te = /* @__PURE__ */ new Set([
|
|
148
201
|
"none",
|
|
149
202
|
"required",
|
|
150
203
|
"optional"
|
|
151
|
-
]),
|
|
204
|
+
]), Ee = /* @__PURE__ */ new Set([
|
|
152
205
|
"id",
|
|
153
206
|
"name",
|
|
154
207
|
"version",
|
|
@@ -167,7 +220,7 @@ var p = 64, m = 64, h = 128, g = 160, _ = 64, v = 64, y = 512, b = 4096, x = 16,
|
|
|
167
220
|
"styles",
|
|
168
221
|
"requires",
|
|
169
222
|
"replaces"
|
|
170
|
-
]),
|
|
223
|
+
]), De = /* @__PURE__ */ new Set([
|
|
171
224
|
"kind",
|
|
172
225
|
"required",
|
|
173
226
|
"static",
|
|
@@ -181,10 +234,11 @@ var p = 64, m = 64, h = 128, g = 160, _ = 64, v = 64, y = 512, b = 4096, x = 16,
|
|
|
181
234
|
"max",
|
|
182
235
|
"integer",
|
|
183
236
|
"positive",
|
|
237
|
+
"allowPositiveNumber",
|
|
184
238
|
"color",
|
|
185
239
|
"coerce",
|
|
186
240
|
"description"
|
|
187
|
-
]),
|
|
241
|
+
]), Oe = /* @__PURE__ */ new Set([
|
|
188
242
|
"kind",
|
|
189
243
|
"family",
|
|
190
244
|
"bind",
|
|
@@ -198,21 +252,21 @@ var p = 64, m = 64, h = 128, g = 160, _ = 64, v = 64, y = 512, b = 4096, x = 16,
|
|
|
198
252
|
"requiresAttributes",
|
|
199
253
|
"compare",
|
|
200
254
|
"retain"
|
|
201
|
-
]),
|
|
255
|
+
]), ke = /* @__PURE__ */ new Set([
|
|
202
256
|
"min",
|
|
203
257
|
"max",
|
|
204
258
|
"step"
|
|
205
|
-
]),
|
|
259
|
+
]), Ae = /* @__PURE__ */ new Set([
|
|
206
260
|
"interactive",
|
|
207
261
|
"static",
|
|
208
262
|
"ssr",
|
|
209
263
|
"offline"
|
|
210
|
-
]),
|
|
264
|
+
]), je = /* @__PURE__ */ new Set([
|
|
211
265
|
"title",
|
|
212
266
|
"description",
|
|
213
267
|
"category",
|
|
214
268
|
"insertText"
|
|
215
|
-
]),
|
|
269
|
+
]), Me = /* @__PURE__ */ new Set(["kind", "required"]), Ne = /* @__PURE__ */ new Set([
|
|
216
270
|
"rule",
|
|
217
271
|
"label",
|
|
218
272
|
"parents",
|
|
@@ -226,15 +280,15 @@ var p = 64, m = 64, h = 128, g = 160, _ = 64, v = 64, y = 512, b = 4096, x = 16,
|
|
|
226
280
|
"generatedPrefix",
|
|
227
281
|
"forbidSeparator",
|
|
228
282
|
"maxItems"
|
|
229
|
-
]),
|
|
283
|
+
]), Pe = /* @__PURE__ */ new Set(["id", "version"]), Fe = /* @__PURE__ */ new Set(["kernel"]), Ie = /* @__PURE__ */ new Set(["id", "version"]), Le = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/, Re = /^[A-Za-z][A-Za-z0-9]*$/, O = /* @__PURE__ */ new Set(["setMany"]), ze = 16, Be = 32, Ve = 16, He = 32, Ue = /* @__PURE__ */ new Set([
|
|
230
284
|
"bind",
|
|
231
285
|
"initial",
|
|
232
286
|
"disabled"
|
|
233
287
|
]);
|
|
234
|
-
function
|
|
288
|
+
function k(e, t) {
|
|
235
289
|
throw Error(`Invalid local component manifest (${e}): ${t}`);
|
|
236
290
|
}
|
|
237
|
-
function
|
|
291
|
+
function A(e) {
|
|
238
292
|
try {
|
|
239
293
|
let t = JSON.stringify(e);
|
|
240
294
|
return typeof t == "string" ? typeof TextEncoder == "function" ? new TextEncoder().encode(t).length : t.length * 2 : Infinity;
|
|
@@ -242,50 +296,50 @@ function k(e) {
|
|
|
242
296
|
return Infinity;
|
|
243
297
|
}
|
|
244
298
|
}
|
|
245
|
-
function
|
|
299
|
+
function j(e) {
|
|
246
300
|
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
247
301
|
let t = Object.getPrototypeOf(e);
|
|
248
302
|
return t === Object.prototype || t === null;
|
|
249
303
|
}
|
|
250
|
-
function
|
|
251
|
-
for (let r of Object.keys(e))
|
|
252
|
-
}
|
|
253
|
-
function M(e, t) {
|
|
254
|
-
return typeof e != "boolean" && O(t, "must be a boolean."), e;
|
|
304
|
+
function M(e, t, n) {
|
|
305
|
+
for (let r of Object.keys(e)) E.has(r) && k(n, `field "${r}" is not allowed.`), t.has(r) || k(n, `unknown field "${r}".`);
|
|
255
306
|
}
|
|
256
|
-
function N(e, t
|
|
257
|
-
return typeof e != "
|
|
307
|
+
function N(e, t) {
|
|
308
|
+
return typeof e != "boolean" && k(t, "must be a boolean."), e;
|
|
258
309
|
}
|
|
259
|
-
function P(e, t) {
|
|
260
|
-
return typeof e
|
|
310
|
+
function P(e, t, n = C) {
|
|
311
|
+
return typeof e != "string" && k(t, "must be a string."), e.length > n && k(t, `exceeds the ${n}-character limit.`), e;
|
|
261
312
|
}
|
|
262
313
|
function F(e, t) {
|
|
263
|
-
return typeof e
|
|
314
|
+
return typeof e == "number" && Number.isFinite(e) || k(t, "must be a finite number."), e;
|
|
264
315
|
}
|
|
265
316
|
function I(e, t) {
|
|
266
|
-
|
|
317
|
+
return typeof e != "string" && k(t, "must be a string."), e.length > 128 && k(t, "exceeds the 128-character limit."), w.test(e) || k(t, "must use lowercase kebab-case."), e;
|
|
318
|
+
}
|
|
319
|
+
function L(e, t) {
|
|
320
|
+
j(e) || k(t, "must be an object.");
|
|
267
321
|
let n = {}, r = Object.keys(e).sort();
|
|
268
|
-
for (let i of r)
|
|
322
|
+
for (let i of r) E.has(i) && k(t, `locale "${i}" is not allowed.`), ge.test(i) || k(t, `locale "${i}" must look like "en" or "zh-CN".`), n[i] = P(e[i], `${t}.${i}`, 256);
|
|
269
323
|
return n;
|
|
270
324
|
}
|
|
271
|
-
function
|
|
272
|
-
|
|
325
|
+
function We(e, t) {
|
|
326
|
+
j(e) || k(t, "must be an object."), M(e, je, t);
|
|
273
327
|
let n = {};
|
|
274
|
-
return e.title !== void 0 && (n.title =
|
|
328
|
+
return e.title !== void 0 && (n.title = L(e.title, `${t}.title`)), e.description !== void 0 && (n.description = L(e.description, `${t}.description`)), e.category !== void 0 && (n.category = P(e.category, `${t}.category`, 64)), e.insertText !== void 0 && (n.insertText = P(e.insertText, `${t}.insertText`, C)), n;
|
|
275
329
|
}
|
|
276
|
-
function
|
|
277
|
-
|
|
330
|
+
function Ge(e, t, n) {
|
|
331
|
+
j(e) || k(n, "must be an object."), M(e, Me, n);
|
|
278
332
|
let r = e.kind;
|
|
279
|
-
typeof r == "string" &&
|
|
333
|
+
typeof r == "string" && Se.has(r) || k(`${n}.kind`, "must be \"none\", \"inline\" or \"markdown\".");
|
|
280
334
|
let i = r;
|
|
281
|
-
e.required !== void 0 &&
|
|
335
|
+
e.required !== void 0 && N(e.required, `${n}.required`);
|
|
282
336
|
let a = e.required === !0;
|
|
283
|
-
return t === "leaf" && i !== "none" &&
|
|
337
|
+
return t === "leaf" && i !== "none" && k(n, "a leaf component cannot declare body content."), t === "inline" && i === "markdown" && k(n, "an inline component cannot declare Markdown block content."), a && i === "none" && k(n, "cannot require body content of kind \"none\"."), {
|
|
284
338
|
kind: i,
|
|
285
339
|
...a ? { required: !0 } : {}
|
|
286
340
|
};
|
|
287
341
|
}
|
|
288
|
-
function
|
|
342
|
+
function R(e) {
|
|
289
343
|
if (e !== void 0) return e.kind === "none" ? Object.freeze({
|
|
290
344
|
rule: "none",
|
|
291
345
|
label: "none"
|
|
@@ -301,59 +355,59 @@ function L(e) {
|
|
|
301
355
|
...e.required ? { min: 1 } : {}
|
|
302
356
|
});
|
|
303
357
|
}
|
|
304
|
-
function
|
|
305
|
-
Array.isArray(e) ||
|
|
358
|
+
function z(e, t) {
|
|
359
|
+
Array.isArray(e) || k(t, "must be an array of component names."), e.length > 32 && k(t, "accepts at most 32 names.");
|
|
306
360
|
let n = /* @__PURE__ */ new Set(), r = [];
|
|
307
361
|
for (let i of e) {
|
|
308
|
-
let e =
|
|
309
|
-
n.has(e) &&
|
|
362
|
+
let e = I(i, t);
|
|
363
|
+
n.has(e) && k(t, `name "${e}" is declared more than once.`), n.add(e), r.push(e);
|
|
310
364
|
}
|
|
311
365
|
return r;
|
|
312
366
|
}
|
|
313
|
-
function
|
|
314
|
-
let n =
|
|
315
|
-
return (!Number.isInteger(n) || n < 0) &&
|
|
367
|
+
function B(e, t) {
|
|
368
|
+
let n = F(e, t);
|
|
369
|
+
return (!Number.isInteger(n) || n < 0) && k(t, "must be a nonnegative integer."), n;
|
|
316
370
|
}
|
|
317
|
-
function
|
|
318
|
-
|
|
371
|
+
function Ke(e, t, r) {
|
|
372
|
+
j(e) || k(r, "must be an object."), M(e, Ne, r);
|
|
319
373
|
let i = e.rule;
|
|
320
|
-
typeof i == "string" &&
|
|
374
|
+
typeof i == "string" && Ce.has(i) || k(`${r}.rule`, "is not a supported child rule.");
|
|
321
375
|
let a = i;
|
|
322
|
-
a === "raw-body" && t !== "container" &&
|
|
376
|
+
a === "raw-body" && t !== "container" && k(r, "\"raw-body\" requires form \"container\"."), t === "leaf" && a !== "none" && k(r, "a leaf component cannot declare body content."), t === "inline" && a !== "none" && a !== "inline" && a !== "any" && k(r, "an inline component only supports \"none\", \"inline\" or \"any\".");
|
|
323
377
|
let o = { rule: a };
|
|
324
|
-
if (e.label !== void 0 && (typeof e.label == "string" &&
|
|
325
|
-
let t =
|
|
326
|
-
t.length === 0 &&
|
|
378
|
+
if (e.label !== void 0 && (typeof e.label == "string" && Te.has(e.label) || k(`${r}.label`, "must be \"none\", \"required\" or \"optional\"."), o.label = e.label), e.parents !== void 0 && (o.parents = z(e.parents, `${r}.parents`)), e.child !== void 0 && (o.child = I(e.child, `${r}.child`)), e.children !== void 0 && (o.children = z(e.children, `${r}.children`)), e.min !== void 0 && (o.min = H(e.min, `${r}.min`, n)), e.max !== void 0 && (o.max = H(e.max, `${r}.max`, n)), o.min !== void 0 && o.max !== void 0 && o.min > o.max && k(r, "\"min\" cannot exceed \"max\"."), e.inlineOnly !== void 0 && (o.inlineOnly = N(e.inlineOnly, `${r}.inlineOnly`)), e.noComponents !== void 0 && (o.noComponents = N(e.noComponents, `${r}.noComponents`)), e.valueAttribute !== void 0 && (o.valueAttribute = I(e.valueAttribute, `${r}.valueAttribute`)), e.generatedPrefix !== void 0) {
|
|
379
|
+
let t = P(e.generatedPrefix, `${r}.generatedPrefix`, 128);
|
|
380
|
+
t.length === 0 && k(`${r}.generatedPrefix`, "must not be empty."), o.generatedPrefix = t;
|
|
327
381
|
}
|
|
328
382
|
if (e.forbidSeparator !== void 0) {
|
|
329
|
-
let t =
|
|
330
|
-
t.length === 0 &&
|
|
383
|
+
let t = P(e.forbidSeparator, `${r}.forbidSeparator`, 4);
|
|
384
|
+
t.length === 0 && k(`${r}.forbidSeparator`, "must not be empty."), o.forbidSeparator = t;
|
|
331
385
|
}
|
|
332
386
|
return e.maxItems !== void 0 && (o.maxItems = H(e.maxItems, `${r}.maxItems`, n)), o;
|
|
333
387
|
}
|
|
334
|
-
function B(e, t) {
|
|
335
|
-
return F(e, t);
|
|
336
|
-
}
|
|
337
388
|
function V(e, t) {
|
|
338
|
-
return
|
|
389
|
+
return I(e, t);
|
|
390
|
+
}
|
|
391
|
+
function qe(e, t) {
|
|
392
|
+
return B(e, t);
|
|
339
393
|
}
|
|
340
394
|
function H(e, t, n) {
|
|
341
|
-
let r =
|
|
342
|
-
return r > n &&
|
|
395
|
+
let r = B(e, t);
|
|
396
|
+
return r > n && k(t, `cannot exceed the kernel limit ${n}.`), r;
|
|
343
397
|
}
|
|
344
398
|
function U(e, t) {
|
|
345
|
-
return
|
|
399
|
+
return z(e, t);
|
|
346
400
|
}
|
|
347
|
-
function
|
|
348
|
-
return Array.isArray(e) ||
|
|
401
|
+
function Je(e, t) {
|
|
402
|
+
return Array.isArray(e) || k(t, "must be an array of strings."), e.length > 32 && k(t, "accepts at most 32 values."), e.map((e) => P(e, t, 128));
|
|
349
403
|
}
|
|
350
|
-
function
|
|
351
|
-
|
|
404
|
+
function Ye(a, o) {
|
|
405
|
+
j(a) || k(o, "must be an object.");
|
|
352
406
|
let s = a.kind;
|
|
353
|
-
typeof s == "string" &&
|
|
354
|
-
let c = (e) =>
|
|
407
|
+
typeof s == "string" && we.has(s) || k(`${o}.kind`, "is not a supported rule.");
|
|
408
|
+
let c = (e) => M(a, /* @__PURE__ */ new Set(["kind", ...e]), o), l = (e) => {
|
|
355
409
|
let t = {};
|
|
356
|
-
for (let n of e) a[n] !== void 0 && (t[n] =
|
|
410
|
+
for (let n of e) a[n] !== void 0 && (t[n] = V(a[n], `${o}.${n}`));
|
|
357
411
|
return t;
|
|
358
412
|
};
|
|
359
413
|
switch (s) {
|
|
@@ -367,7 +421,7 @@ function Fe(a, o) {
|
|
|
367
421
|
"positiveInteger"
|
|
368
422
|
]);
|
|
369
423
|
let e;
|
|
370
|
-
return a.order !== void 0 && (a.order !== "nondecreasing" && a.order !== "increasing" &&
|
|
424
|
+
return a.order !== void 0 && (a.order !== "nondecreasing" && a.order !== "increasing" && k(`${o}.order`, "must be \"nondecreasing\" or \"increasing\"."), e = a.order), {
|
|
371
425
|
kind: s,
|
|
372
426
|
...l([
|
|
373
427
|
"min",
|
|
@@ -397,7 +451,7 @@ function Fe(a, o) {
|
|
|
397
451
|
};
|
|
398
452
|
case "nonempty": return c(["attribute"]), {
|
|
399
453
|
kind: s,
|
|
400
|
-
attribute:
|
|
454
|
+
attribute: V(a.attribute, `${o}.attribute`)
|
|
401
455
|
};
|
|
402
456
|
case "progress-bounds": return c([
|
|
403
457
|
"value",
|
|
@@ -405,34 +459,42 @@ function Fe(a, o) {
|
|
|
405
459
|
"defaultMax"
|
|
406
460
|
]), {
|
|
407
461
|
kind: s,
|
|
408
|
-
value:
|
|
409
|
-
max:
|
|
410
|
-
defaultMax:
|
|
462
|
+
value: V(a.value, `${o}.value`),
|
|
463
|
+
max: V(a.max, `${o}.max`),
|
|
464
|
+
defaultMax: F(a.defaultMax, `${o}.defaultMax`)
|
|
411
465
|
};
|
|
412
466
|
case "timer-duration": return c(["attribute", "default"]), {
|
|
413
467
|
kind: s,
|
|
414
|
-
attribute:
|
|
415
|
-
default:
|
|
468
|
+
attribute: V(a.attribute, `${o}.attribute`),
|
|
469
|
+
default: F(a.default, `${o}.default`)
|
|
416
470
|
};
|
|
417
471
|
case "option-count": return c(["max"]), {
|
|
418
472
|
kind: s,
|
|
419
|
-
...a.max === void 0 ? {} : { max:
|
|
473
|
+
...a.max === void 0 ? {} : { max: V(a.max, `${o}.max`) }
|
|
420
474
|
};
|
|
475
|
+
case "required-one-of": {
|
|
476
|
+
c(["attributes"]);
|
|
477
|
+
let e = U(a.attributes, `${o}.attributes`);
|
|
478
|
+
return e.length || k(`${o}.attributes`, "must list at least one attribute."), {
|
|
479
|
+
kind: s,
|
|
480
|
+
attributes: e
|
|
481
|
+
};
|
|
482
|
+
}
|
|
421
483
|
case "selection-requires": return c(["key", "attributes"]), {
|
|
422
484
|
kind: s,
|
|
423
|
-
key:
|
|
485
|
+
key: V(a.key, `${o}.key`),
|
|
424
486
|
attributes: U(a.attributes, `${o}.attributes`)
|
|
425
487
|
};
|
|
426
488
|
case "inline-body": return c(["strict"]), {
|
|
427
489
|
kind: s,
|
|
428
|
-
...a.strict === void 0 ? {} : { strict:
|
|
490
|
+
...a.strict === void 0 ? {} : { strict: N(a.strict, `${o}.strict`) }
|
|
429
491
|
};
|
|
430
492
|
case "no-components":
|
|
431
493
|
case "math-body":
|
|
432
494
|
case "inline-math-reads": return c([]), { kind: s };
|
|
433
495
|
case "single-table": return c(["fallbackSingle"]), {
|
|
434
496
|
kind: s,
|
|
435
|
-
...a.fallbackSingle === void 0 ? {} : { fallbackSingle:
|
|
497
|
+
...a.fallbackSingle === void 0 ? {} : { fallbackSingle: N(a.fallbackSingle, `${o}.fallbackSingle`) }
|
|
436
498
|
};
|
|
437
499
|
case "options-body": return c([
|
|
438
500
|
"child",
|
|
@@ -442,11 +504,11 @@ function Fe(a, o) {
|
|
|
442
504
|
"forbidSeparator"
|
|
443
505
|
]), {
|
|
444
506
|
kind: s,
|
|
445
|
-
child:
|
|
446
|
-
valueAttribute:
|
|
447
|
-
unique: a.unique === void 0 ||
|
|
507
|
+
child: V(a.child, `${o}.child`),
|
|
508
|
+
valueAttribute: V(a.valueAttribute, `${o}.valueAttribute`),
|
|
509
|
+
unique: a.unique === void 0 || N(a.unique, `${o}.unique`),
|
|
448
510
|
...a.max === void 0 ? {} : { max: H(a.max, `${o}.max`, n) },
|
|
449
|
-
...a.forbidSeparator === void 0 ? {} : { forbidSeparator:
|
|
511
|
+
...a.forbidSeparator === void 0 ? {} : { forbidSeparator: P(a.forbidSeparator, `${o}.forbidSeparator`, 4) }
|
|
450
512
|
};
|
|
451
513
|
case "value-sequence": return c([
|
|
452
514
|
"child",
|
|
@@ -457,12 +519,12 @@ function Fe(a, o) {
|
|
|
457
519
|
"duplicateCode"
|
|
458
520
|
]), {
|
|
459
521
|
kind: s,
|
|
460
|
-
child:
|
|
461
|
-
valueAttribute:
|
|
462
|
-
min:
|
|
463
|
-
generatedPrefix:
|
|
464
|
-
unique: a.unique === void 0 ||
|
|
465
|
-
...a.duplicateCode === void 0 ? {} : { duplicateCode:
|
|
522
|
+
child: V(a.child, `${o}.child`),
|
|
523
|
+
valueAttribute: V(a.valueAttribute, `${o}.valueAttribute`),
|
|
524
|
+
min: qe(a.min, `${o}.min`),
|
|
525
|
+
generatedPrefix: P(a.generatedPrefix, `${o}.generatedPrefix`, 128),
|
|
526
|
+
unique: a.unique === void 0 || N(a.unique, `${o}.unique`),
|
|
527
|
+
...a.duplicateCode === void 0 ? {} : { duplicateCode: P(a.duplicateCode, `${o}.duplicateCode`, 128) }
|
|
466
528
|
};
|
|
467
529
|
case "only-children": return c([
|
|
468
530
|
"children",
|
|
@@ -473,10 +535,10 @@ function Fe(a, o) {
|
|
|
473
535
|
]), {
|
|
474
536
|
kind: s,
|
|
475
537
|
children: U(a.children, `${o}.children`),
|
|
476
|
-
min:
|
|
538
|
+
min: qe(a.min, `${o}.min`),
|
|
477
539
|
...a.max === void 0 ? {} : { max: H(a.max, `${o}.max`, n) },
|
|
478
|
-
...a.maxCode === void 0 ? {} : { maxCode:
|
|
479
|
-
...a.onlyCode === void 0 ? {} : { onlyCode:
|
|
540
|
+
...a.maxCode === void 0 ? {} : { maxCode: P(a.maxCode, `${o}.maxCode`, 128) },
|
|
541
|
+
...a.onlyCode === void 0 ? {} : { onlyCode: P(a.onlyCode, `${o}.onlyCode`, 128) }
|
|
480
542
|
};
|
|
481
543
|
case "diagram-body": return c([
|
|
482
544
|
"node",
|
|
@@ -487,12 +549,12 @@ function Fe(a, o) {
|
|
|
487
549
|
"label"
|
|
488
550
|
]), {
|
|
489
551
|
kind: s,
|
|
490
|
-
node:
|
|
491
|
-
edge:
|
|
492
|
-
id:
|
|
493
|
-
from:
|
|
494
|
-
to:
|
|
495
|
-
...a.label === void 0 ? {} : { label:
|
|
552
|
+
node: V(a.node, `${o}.node`),
|
|
553
|
+
edge: V(a.edge, `${o}.edge`),
|
|
554
|
+
id: V(a.id, `${o}.id`),
|
|
555
|
+
from: V(a.from, `${o}.from`),
|
|
556
|
+
to: V(a.to, `${o}.to`),
|
|
557
|
+
...a.label === void 0 ? {} : { label: V(a.label, `${o}.label`) }
|
|
496
558
|
};
|
|
497
559
|
case "quiz-body": return c([
|
|
498
560
|
"type",
|
|
@@ -503,11 +565,11 @@ function Fe(a, o) {
|
|
|
503
565
|
"max"
|
|
504
566
|
]), {
|
|
505
567
|
kind: s,
|
|
506
|
-
type:
|
|
507
|
-
answer:
|
|
508
|
-
tolerance:
|
|
509
|
-
child:
|
|
510
|
-
valueAttribute:
|
|
568
|
+
type: V(a.type, `${o}.type`),
|
|
569
|
+
answer: V(a.answer, `${o}.answer`),
|
|
570
|
+
tolerance: V(a.tolerance, `${o}.tolerance`),
|
|
571
|
+
child: V(a.child, `${o}.child`),
|
|
572
|
+
valueAttribute: V(a.valueAttribute, `${o}.valueAttribute`),
|
|
511
573
|
...a.max === void 0 ? {} : { max: H(a.max, `${o}.max`, n) }
|
|
512
574
|
};
|
|
513
575
|
case "checklist-body": return c(["itemLimit"]), {
|
|
@@ -519,7 +581,7 @@ function Fe(a, o) {
|
|
|
519
581
|
kind: s,
|
|
520
582
|
attributes: U(a.attributes, `${o}.attributes`)
|
|
521
583
|
};
|
|
522
|
-
case "scoped-expressions": return c(["attributes", "scope"]), a.scope !== "row" && a.scope !== "validation" &&
|
|
584
|
+
case "scoped-expressions": return c(["attributes", "scope"]), a.scope !== "row" && a.scope !== "validation" && k(`${o}.scope`, "must be \"row\" or \"validation\"."), {
|
|
523
585
|
kind: s,
|
|
524
586
|
attributes: U(a.attributes, `${o}.attributes`),
|
|
525
587
|
scope: a.scope
|
|
@@ -531,10 +593,10 @@ function Fe(a, o) {
|
|
|
531
593
|
"childValue"
|
|
532
594
|
]), {
|
|
533
595
|
kind: s,
|
|
534
|
-
rows:
|
|
535
|
-
key:
|
|
536
|
-
child:
|
|
537
|
-
childValue:
|
|
596
|
+
rows: V(a.rows, `${o}.rows`),
|
|
597
|
+
key: V(a.key, `${o}.key`),
|
|
598
|
+
child: V(a.child, `${o}.child`),
|
|
599
|
+
childValue: V(a.childValue, `${o}.childValue`)
|
|
538
600
|
};
|
|
539
601
|
case "validation-rule": return c([
|
|
540
602
|
"when",
|
|
@@ -542,21 +604,21 @@ function Fe(a, o) {
|
|
|
542
604
|
"message",
|
|
543
605
|
"placement",
|
|
544
606
|
"max"
|
|
545
|
-
]), a.placement !== "container" && a.placement !== "prose" &&
|
|
607
|
+
]), a.placement !== "container" && a.placement !== "prose" && k(`${o}.placement`, "must be \"container\" or \"prose\"."), {
|
|
546
608
|
kind: s,
|
|
547
|
-
when:
|
|
548
|
-
fields:
|
|
549
|
-
message:
|
|
609
|
+
when: V(a.when, `${o}.when`),
|
|
610
|
+
fields: V(a.fields, `${o}.fields`),
|
|
611
|
+
message: V(a.message, `${o}.message`),
|
|
550
612
|
placement: a.placement,
|
|
551
613
|
max: H(a.max, `${o}.max`, 100)
|
|
552
614
|
};
|
|
553
615
|
case "anchor": return c(["id"]), {
|
|
554
616
|
kind: s,
|
|
555
|
-
id:
|
|
617
|
+
id: V(a.id, `${o}.id`)
|
|
556
618
|
};
|
|
557
619
|
case "navigation": return c(["target"]), {
|
|
558
620
|
kind: s,
|
|
559
|
-
target:
|
|
621
|
+
target: V(a.target, `${o}.target`)
|
|
560
622
|
};
|
|
561
623
|
case "data-table": return c([
|
|
562
624
|
"rows",
|
|
@@ -571,12 +633,12 @@ function Fe(a, o) {
|
|
|
571
633
|
"maxColumns"
|
|
572
634
|
]), {
|
|
573
635
|
kind: s,
|
|
574
|
-
rows:
|
|
575
|
-
key:
|
|
576
|
-
child:
|
|
577
|
-
childValue:
|
|
578
|
-
label:
|
|
579
|
-
maxRows:
|
|
636
|
+
rows: V(a.rows, `${o}.rows`),
|
|
637
|
+
key: V(a.key, `${o}.key`),
|
|
638
|
+
child: V(a.child, `${o}.child`),
|
|
639
|
+
childValue: V(a.childValue, `${o}.childValue`),
|
|
640
|
+
label: V(a.label, `${o}.label`),
|
|
641
|
+
maxRows: V(a.maxRows, `${o}.maxRows`),
|
|
580
642
|
defaultMaxRows: H(a.defaultMaxRows, `${o}.defaultMaxRows`, i),
|
|
581
643
|
documentRows: H(a.documentRows, `${o}.documentRows`, t),
|
|
582
644
|
documentCells: H(a.documentCells, `${o}.documentCells`, r),
|
|
@@ -591,10 +653,10 @@ function Fe(a, o) {
|
|
|
591
653
|
"points"
|
|
592
654
|
]), {
|
|
593
655
|
kind: s,
|
|
594
|
-
min:
|
|
595
|
-
max:
|
|
596
|
-
samples:
|
|
597
|
-
...a.samplesAlias === void 0 ? {} : { samplesAlias:
|
|
656
|
+
min: V(a.min, `${o}.min`),
|
|
657
|
+
max: V(a.max, `${o}.max`),
|
|
658
|
+
samples: V(a.samples, `${o}.samples`),
|
|
659
|
+
...a.samplesAlias === void 0 ? {} : { samplesAlias: V(a.samplesAlias, `${o}.samplesAlias`) },
|
|
598
660
|
curves: H(a.curves, `${o}.curves`, 16),
|
|
599
661
|
points: H(a.points, `${o}.points`, e)
|
|
600
662
|
};
|
|
@@ -604,27 +666,27 @@ function Fe(a, o) {
|
|
|
604
666
|
"y"
|
|
605
667
|
]), {
|
|
606
668
|
kind: s,
|
|
607
|
-
chartKind:
|
|
608
|
-
x:
|
|
609
|
-
y:
|
|
669
|
+
chartKind: V(a.chartKind, `${o}.chartKind`),
|
|
670
|
+
x: V(a.x, `${o}.x`),
|
|
671
|
+
y: V(a.y, `${o}.y`)
|
|
610
672
|
};
|
|
611
|
-
case "timeline-table": return c(["headerSets"]), Array.isArray(a.headerSets) ||
|
|
673
|
+
case "timeline-table": return c(["headerSets"]), Array.isArray(a.headerSets) || k(`${o}.headerSets`, "must be an array."), {
|
|
612
674
|
kind: s,
|
|
613
|
-
headerSets: a.headerSets.map((e, t) =>
|
|
675
|
+
headerSets: a.headerSets.map((e, t) => Je(e, `${o}.headerSets[${t}]`))
|
|
614
676
|
};
|
|
615
677
|
case "table-selection": return c(["key", "bindings"]), {
|
|
616
678
|
kind: s,
|
|
617
|
-
key:
|
|
679
|
+
key: V(a.key, `${o}.key`),
|
|
618
680
|
bindings: U(a.bindings, `${o}.bindings`)
|
|
619
681
|
};
|
|
620
682
|
case "retain": return c(["value"]), {
|
|
621
683
|
kind: s,
|
|
622
|
-
value:
|
|
684
|
+
value: N(a.value, `${o}.value`)
|
|
623
685
|
};
|
|
624
|
-
case "self-binding-read": return c(["mode", "attribute"]), a.mode !== "always" && a.mode !== "attribute" &&
|
|
686
|
+
case "self-binding-read": return c(["mode", "attribute"]), a.mode !== "always" && a.mode !== "attribute" && k(`${o}.mode`, "must be \"always\" or \"attribute\"."), {
|
|
625
687
|
kind: s,
|
|
626
688
|
mode: a.mode,
|
|
627
|
-
...a.attribute === void 0 ? {} : { attribute:
|
|
689
|
+
...a.attribute === void 0 ? {} : { attribute: V(a.attribute, `${o}.attribute`) }
|
|
628
690
|
};
|
|
629
691
|
case "value-date": return c([
|
|
630
692
|
"min",
|
|
@@ -650,41 +712,41 @@ function Fe(a, o) {
|
|
|
650
712
|
"max",
|
|
651
713
|
"email"
|
|
652
714
|
]),
|
|
653
|
-
...a.emailType === void 0 ? {} : { emailType:
|
|
715
|
+
...a.emailType === void 0 ? {} : { emailType: P(a.emailType, `${o}.emailType`, 128) }
|
|
654
716
|
};
|
|
655
717
|
case "value-required": return c(["required"]), {
|
|
656
718
|
kind: s,
|
|
657
|
-
required:
|
|
719
|
+
required: V(a.required, `${o}.required`)
|
|
658
720
|
};
|
|
659
721
|
case "value-email": return c(["type", "value"]), {
|
|
660
722
|
kind: s,
|
|
661
723
|
...l(["type"]),
|
|
662
|
-
...a.value === void 0 ? {} : { value:
|
|
724
|
+
...a.value === void 0 ? {} : { value: P(a.value, `${o}.value`, 128) }
|
|
663
725
|
};
|
|
664
|
-
default:
|
|
726
|
+
default: k(`${o}.kind`, "is not a supported rule.");
|
|
665
727
|
}
|
|
666
728
|
}
|
|
667
|
-
function
|
|
668
|
-
Array.isArray(e) ||
|
|
729
|
+
function Xe(e) {
|
|
730
|
+
Array.isArray(e) || k("rules", "must be an array."), e.length > 32 && k("rules", "accepts at most 32 rules.");
|
|
669
731
|
let t = [];
|
|
670
|
-
for (let n = 0; n < e.length; n += 1) t.push(
|
|
732
|
+
for (let n = 0; n < e.length; n += 1) t.push(Ye(e[n], `rules[${n}]`));
|
|
671
733
|
return t;
|
|
672
734
|
}
|
|
673
|
-
function
|
|
674
|
-
Array.isArray(e) ||
|
|
735
|
+
function Ze(e) {
|
|
736
|
+
Array.isArray(e) || k("slotRelations", "must be an array."), e.length > 16 && k("slotRelations", "accepts at most 16 relations.");
|
|
675
737
|
let t = [];
|
|
676
738
|
for (let n = 0; n < e.length; n += 1) {
|
|
677
739
|
let r = e[n], i = `slotRelations[${n}]`;
|
|
678
|
-
|
|
679
|
-
lower:
|
|
680
|
-
upper:
|
|
740
|
+
j(r) || k(i, "must be an object."), M(r, /* @__PURE__ */ new Set(["lower", "upper"]), i), t.push({
|
|
741
|
+
lower: I(r.lower, `${i}.lower`),
|
|
742
|
+
upper: I(r.upper, `${i}.upper`)
|
|
681
743
|
});
|
|
682
744
|
}
|
|
683
745
|
return t;
|
|
684
746
|
}
|
|
685
|
-
function
|
|
686
|
-
|
|
687
|
-
let n = (n) => e[n] !== void 0 &&
|
|
747
|
+
function Qe(e, t) {
|
|
748
|
+
j(e) || k(t, "must be an object."), M(e, Ae, t);
|
|
749
|
+
let n = (n) => e[n] !== void 0 && N(e[n], `${t}.${n}`);
|
|
688
750
|
return {
|
|
689
751
|
interactive: n("interactive"),
|
|
690
752
|
static: n("static"),
|
|
@@ -692,10 +754,10 @@ function Re(e, t) {
|
|
|
692
754
|
offline: n("offline")
|
|
693
755
|
};
|
|
694
756
|
}
|
|
695
|
-
function
|
|
696
|
-
|
|
757
|
+
function $e(e, t) {
|
|
758
|
+
j(e) || k(t, "must be an object."), M(e, De, t);
|
|
697
759
|
let n = e.kind;
|
|
698
|
-
typeof n == "string" &&
|
|
760
|
+
typeof n == "string" && _e.has(n) || k(`${t}.kind`, "must be \"string\", \"number\", \"boolean\" or \"enum\".");
|
|
699
761
|
let r = n, i = { kind: r };
|
|
700
762
|
for (let n of [
|
|
701
763
|
"required",
|
|
@@ -703,44 +765,45 @@ function ze(e, t) {
|
|
|
703
765
|
"dynamic",
|
|
704
766
|
"integer",
|
|
705
767
|
"positive",
|
|
768
|
+
"allowPositiveNumber",
|
|
706
769
|
"color",
|
|
707
770
|
"nullable"
|
|
708
|
-
]) e[n] !== void 0 && (i[n] =
|
|
709
|
-
i.static === !0 && i.dynamic === !0 &&
|
|
771
|
+
]) e[n] !== void 0 && (i[n] = N(e[n], `${t}.${n}`));
|
|
772
|
+
i.static === !0 && i.dynamic === !0 && k(t, "cannot be both static and dynamic."), e.coerce !== void 0 && (e.coerce !== "text" && k(`${t}.coerce`, "must be \"text\"."), r !== "string" && k(`${t}.coerce`, "is only valid for kind \"string\"."), i.coerce = "text");
|
|
710
773
|
let a = e.enum === void 0 ? e.values : e.enum, o = a !== void 0;
|
|
711
|
-
if (r !== "enum") o &&
|
|
774
|
+
if (r !== "enum") o && k(t, `"enum" is only valid for kind "enum", not "${r}".`), i.allowPositiveNumber !== void 0 && k(t, "\"allowPositiveNumber\" is only valid for kind \"enum\".");
|
|
712
775
|
else {
|
|
713
|
-
e.enum !== void 0 && e.values !== void 0 &&
|
|
776
|
+
e.enum !== void 0 && e.values !== void 0 && k(t, "use \"enum\" or \"values\", not both."), Array.isArray(a) && a.length !== 0 || k(`${t}.enum`, "must be a non-empty string array."), a.length > 64 && k(`${t}.enum`, "accepts at most 64 values.");
|
|
714
777
|
let n = /* @__PURE__ */ new Set(), r = [];
|
|
715
778
|
for (let e of a) {
|
|
716
|
-
let i =
|
|
717
|
-
n.has(i) &&
|
|
779
|
+
let i = P(e, `${t}.enum`, 128);
|
|
780
|
+
n.has(i) && k(`${t}.enum`, `value "${i}" is declared more than once.`), n.add(i), r.push(i);
|
|
718
781
|
}
|
|
719
782
|
i.enum = r;
|
|
720
783
|
}
|
|
721
784
|
let s = e.pattern !== void 0;
|
|
722
|
-
if (r !== "string") s &&
|
|
785
|
+
if (r !== "string") s && k(t, `"pattern" is only valid for kind "string", not "${r}".`);
|
|
723
786
|
else if (s) {
|
|
724
|
-
typeof e.pattern != "string" &&
|
|
787
|
+
typeof e.pattern != "string" && k(`${t}.pattern`, "must be a string."), e.pattern.length > 512 && k(`${t}.pattern`, "exceeds the 512-character limit.");
|
|
725
788
|
try {
|
|
726
789
|
new RegExp(e.pattern);
|
|
727
790
|
} catch {
|
|
728
|
-
|
|
791
|
+
k(`${t}.pattern`, "is not a valid regular expression.");
|
|
729
792
|
}
|
|
730
|
-
|
|
793
|
+
ee(e.pattern) || k(`${t}.pattern`, "uses unsupported regex syntax; nested quantifiers, quantified alternation, backreferences and lookarounds are rejected."), i.pattern = e.pattern;
|
|
731
794
|
}
|
|
732
795
|
let c = e.min !== void 0, l = e.max !== void 0;
|
|
733
|
-
if (r === "number" ? (c && (i.min =
|
|
796
|
+
if (r === "number" ? (c && (i.min = F(e.min, `${t}.min`)), l && (i.max = F(e.max, `${t}.max`)), i.min !== void 0 && i.max !== void 0 && i.min > i.max && k(t, "\"min\" cannot exceed \"max\".")) : ((c || l) && k(t, "\"min\" and \"max\" are only valid for kind \"number\"."), i.integer === !0 && k(t, "\"integer\" is only valid for kind \"number\"."), i.positive === !0 && k(t, "\"positive\" is only valid for kind \"number\".")), i.color === !0 && r !== "string" && k(t, "\"color\" is only valid for kind \"string\"."), e.description !== void 0 && (i.description = L(e.description, `${t}.description`)), e.default !== void 0) {
|
|
734
797
|
let n = e.default;
|
|
735
|
-
if (n === null) i.nullable !== !0 &&
|
|
736
|
-
else if (r === "string") i.default =
|
|
798
|
+
if (n === null) i.nullable !== !0 && k(`${t}.default`, "is null but the prop is not nullable."), i.default = null;
|
|
799
|
+
else if (r === "string") i.default = P(n, `${t}.default`);
|
|
737
800
|
else if (r === "number") {
|
|
738
|
-
let e =
|
|
739
|
-
i.integer === !0 && !Number.isInteger(e) &&
|
|
740
|
-
} else if (r === "boolean") i.default =
|
|
801
|
+
let e = F(n, `${t}.default`);
|
|
802
|
+
i.integer === !0 && !Number.isInteger(e) && k(`${t}.default`, "must be an integer."), i.positive === !0 && !(e > 0) && k(`${t}.default`, "must be greater than zero."), i.min !== void 0 && e < i.min && k(`${t}.default`, `is below the minimum ${i.min}.`), i.max !== void 0 && e > i.max && k(`${t}.default`, `exceeds the maximum ${i.max}.`), i.default = e;
|
|
803
|
+
} else if (r === "boolean") i.default = N(n, `${t}.default`);
|
|
741
804
|
else {
|
|
742
|
-
let e =
|
|
743
|
-
i.enum?.includes(e)
|
|
805
|
+
let e = P(n, `${t}.default`, 128);
|
|
806
|
+
!i.enum?.includes(e) && !(i.allowPositiveNumber && re(e) !== void 0) && k(`${t}.default`, `"${e}" is not an allowed enum value.`), i.default = e;
|
|
744
807
|
}
|
|
745
808
|
if (i.pattern !== void 0 && r === "string" && typeof i.default == "string") {
|
|
746
809
|
let e = !0;
|
|
@@ -749,22 +812,22 @@ function ze(e, t) {
|
|
|
749
812
|
} catch {
|
|
750
813
|
e = !1;
|
|
751
814
|
}
|
|
752
|
-
e ||
|
|
815
|
+
e || k(`${t}.default`, `does not match pattern ${i.pattern}.`);
|
|
753
816
|
}
|
|
754
817
|
}
|
|
755
818
|
return i;
|
|
756
819
|
}
|
|
757
|
-
function
|
|
758
|
-
|
|
820
|
+
function et(e, t) {
|
|
821
|
+
j(e) || k(t, "must be an object with \"literal\" or \"prop\".");
|
|
759
822
|
let n = Object.keys(e);
|
|
760
|
-
n.length !== 1 &&
|
|
823
|
+
n.length !== 1 && k(t, "must contain exactly one of \"literal\" or \"prop\".");
|
|
761
824
|
let r = n[0];
|
|
762
|
-
if (
|
|
763
|
-
if (r === "prop") return { prop:
|
|
764
|
-
|
|
825
|
+
if (E.has(r) && k(t, `field "${r}" is not allowed.`), r === "literal") return { literal: F(e.literal, `${t}.literal`) };
|
|
826
|
+
if (r === "prop") return { prop: I(e.prop, `${t}.prop`) };
|
|
827
|
+
k(t, `unknown field "${r}"; use "literal" or "prop".`);
|
|
765
828
|
}
|
|
766
|
-
function
|
|
767
|
-
|
|
829
|
+
function tt(e, t, n, r) {
|
|
830
|
+
j(e) || k(r, "must be an object."), M(e, ke, r);
|
|
768
831
|
let i = {};
|
|
769
832
|
for (let n of [
|
|
770
833
|
"min",
|
|
@@ -772,16 +835,16 @@ function Ve(e, t, n, r) {
|
|
|
772
835
|
"step"
|
|
773
836
|
]) {
|
|
774
837
|
if (e[n] === void 0) continue;
|
|
775
|
-
let a =
|
|
838
|
+
let a = et(e[n], `${r}.${n}`);
|
|
776
839
|
if ("prop" in a) {
|
|
777
840
|
let e = t[a.prop];
|
|
778
|
-
e === void 0 &&
|
|
841
|
+
e === void 0 && k(`${r}.${n}`, `references undeclared prop "${a.prop}".`), e.kind !== "number" && k(`${r}.${n}`, `references prop "${a.prop}", which is not a number.`);
|
|
779
842
|
}
|
|
780
|
-
n === "step" && "literal" in a && !(a.literal > 0) &&
|
|
843
|
+
n === "step" && "literal" in a && !(a.literal > 0) && k(`${r}.step`, "must be greater than 0."), i[n] = a;
|
|
781
844
|
}
|
|
782
|
-
return n !== "number" && (i.min || i.max || i.step) &&
|
|
845
|
+
return n !== "number" && (i.min || i.max || i.step) && k(r, "\"min\", \"max\" and \"step\" are only valid for number bindings."), i.min && "literal" in i.min && i.max && "literal" in i.max && i.min.literal > i.max.literal && k(r, "\"min\" cannot exceed \"max\"."), i;
|
|
783
846
|
}
|
|
784
|
-
function
|
|
847
|
+
function nt(e, t) {
|
|
785
848
|
if (e === "number") return t === "timer" ? /* @__PURE__ */ new Set([
|
|
786
849
|
"duration",
|
|
787
850
|
"min",
|
|
@@ -805,12 +868,12 @@ function He(e, t) {
|
|
|
805
868
|
default: return /* @__PURE__ */ new Set(["empty"]);
|
|
806
869
|
}
|
|
807
870
|
}
|
|
808
|
-
function
|
|
809
|
-
|
|
871
|
+
function rt(e, t, n, r = !1) {
|
|
872
|
+
j(e) || k(n, "must be an object."), M(e, Oe, n);
|
|
810
873
|
let i = e.kind;
|
|
811
|
-
typeof i == "string" &&
|
|
874
|
+
typeof i == "string" && ye.has(i) || k(`${n}.kind`, "must be \"string\", \"number\", \"boolean\", \"array\", \"number-array\" or \"null\".");
|
|
812
875
|
let a = i, o = e.family;
|
|
813
|
-
typeof o == "string" &&
|
|
876
|
+
typeof o == "string" && be.has(o) || k(`${n}.family`, "must be a supported binding family.");
|
|
814
877
|
let s = o;
|
|
815
878
|
({
|
|
816
879
|
number: /* @__PURE__ */ new Set(["number", "timer"]),
|
|
@@ -831,23 +894,23 @@ function Ue(e, t, n, r = !1) {
|
|
|
831
894
|
]),
|
|
832
895
|
"number-array": /* @__PURE__ */ new Set(["collection"]),
|
|
833
896
|
null: /* @__PURE__ */ new Set(["text"])
|
|
834
|
-
})[a]?.has(s) ||
|
|
897
|
+
})[a]?.has(s) || k(`${n}.family`, `"${s}" is not supported for a ${a} binding.`);
|
|
835
898
|
let c;
|
|
836
899
|
if (e.options !== void 0) {
|
|
837
|
-
a !== "string" &&
|
|
900
|
+
a !== "string" && k(`${n}.options`, "is only valid for a string binding."), s !== "choice" && k(`${n}.options`, "requires family \"choice\".");
|
|
838
901
|
let t = e.options;
|
|
839
|
-
Array.isArray(t) && t.length !== 0 ||
|
|
902
|
+
Array.isArray(t) && t.length !== 0 || k(`${n}.options`, "must be a non-empty string array."), t.length > 64 && k(`${n}.options`, "accepts at most 64 values.");
|
|
840
903
|
let r = /* @__PURE__ */ new Set(), i = [];
|
|
841
904
|
for (let e of t) {
|
|
842
|
-
let t =
|
|
843
|
-
t.length === 0 &&
|
|
905
|
+
let t = P(e, `${n}.options`, 128);
|
|
906
|
+
t.length === 0 && k(`${n}.options`, "values must be non-empty."), r.has(t) && k(`${n}.options`, `value "${t}" is declared more than once.`), r.add(t), i.push(t);
|
|
844
907
|
}
|
|
845
908
|
c = i;
|
|
846
909
|
}
|
|
847
|
-
a === "string" && s === "choice" && c === void 0 && !r &&
|
|
848
|
-
let l =
|
|
849
|
-
l === u &&
|
|
850
|
-
let d =
|
|
910
|
+
a === "string" && s === "choice" && c === void 0 && !r && k(`${n}.options`, "is required for a choice binding."), s !== "choice" && c !== void 0 && k(`${n}.options`, "is only valid for family \"choice\".");
|
|
911
|
+
let l = I(e.bind, `${n}.bind`), u = I(e.initial, `${n}.initial`);
|
|
912
|
+
l === u && k(n, "\"bind\" and \"initial\" must name different attributes."), (O.has(l) || O.has(u)) && k(n, "binding attributes cannot use a reserved slot name."), (Object.hasOwn(t, l) || Object.hasOwn(t, u)) && k(n, "binding attributes are reserved and cannot be declared as props.");
|
|
913
|
+
let d = nt(a, s), f;
|
|
851
914
|
if (e.initialRule === void 0) switch (a) {
|
|
852
915
|
case "number":
|
|
853
916
|
f = s === "timer" ? "duration" : "nearest-zero";
|
|
@@ -866,26 +929,26 @@ function Ue(e, t, n, r = !1) {
|
|
|
866
929
|
break;
|
|
867
930
|
default: f = s === "choice" ? "first-option" : s === "tabs" ? "first-tab" : s === "steps" ? "first-step" : s === "diagram" ? "first-node" : s === "selection" ? "none" : "empty";
|
|
868
931
|
}
|
|
869
|
-
else typeof e.initialRule == "string" &&
|
|
870
|
-
d.has(f) ||
|
|
932
|
+
else typeof e.initialRule == "string" && xe.has(e.initialRule) || k(`${n}.initialRule`, "is not a supported initial rule."), f = e.initialRule;
|
|
933
|
+
d.has(f) || k(`${n}.initialRule`, `is not supported for a ${a} ${s} binding.`), e.required !== void 0 && N(e.required, `${n}.required`), e.exclusive !== void 0 && N(e.exclusive, `${n}.exclusive`), e.retain !== void 0 && N(e.retain, `${n}.retain`);
|
|
871
934
|
let p;
|
|
872
|
-
e.constraints !== void 0 && (p =
|
|
935
|
+
e.constraints !== void 0 && (p = tt(e.constraints, t, a, `${n}.constraints`));
|
|
873
936
|
let m;
|
|
874
937
|
if (e.maxItems !== void 0) {
|
|
875
|
-
if (a !== "array" && a !== "number-array" &&
|
|
938
|
+
if (a !== "array" && a !== "number-array" && k(`${n}.maxItems`, "is only valid for array or number-array bindings."), m = et(e.maxItems, `${n}.maxItems`), "prop" in m) {
|
|
876
939
|
let e = t[m.prop];
|
|
877
|
-
e === void 0 &&
|
|
878
|
-
} else (!Number.isInteger(m.literal) || m.literal < 0) &&
|
|
940
|
+
e === void 0 && k(`${n}.maxItems`, `references undeclared prop "${m.prop}".`), e.kind !== "number" && k(`${n}.maxItems`, `references prop "${m.prop}", which is not a number.`), e.dynamic === !0 && k(`${n}.maxItems`, "requires a static numeric property.");
|
|
941
|
+
} else (!Number.isInteger(m.literal) || m.literal < 0) && k(`${n}.maxItems`, "must be a nonnegative integer.");
|
|
879
942
|
}
|
|
880
943
|
let h;
|
|
881
944
|
if (e.requiresAttributes !== void 0) {
|
|
882
|
-
h =
|
|
883
|
-
for (let e of h) Object.hasOwn(t, e) ||
|
|
945
|
+
h = z(e.requiresAttributes, `${n}.requiresAttributes`);
|
|
946
|
+
for (let e of h) Object.hasOwn(t, e) || k(`${n}.requiresAttributes`, `references undeclared prop "${e}".`);
|
|
884
947
|
}
|
|
885
948
|
let g;
|
|
886
949
|
if (e.compare !== void 0) {
|
|
887
|
-
g =
|
|
888
|
-
for (let e of g) Object.hasOwn(t, e) ||
|
|
950
|
+
g = z(e.compare, `${n}.compare`);
|
|
951
|
+
for (let e of g) Object.hasOwn(t, e) || k(`${n}.compare`, `references undeclared prop "${e}".`);
|
|
889
952
|
}
|
|
890
953
|
return {
|
|
891
954
|
kind: a,
|
|
@@ -903,78 +966,78 @@ function Ue(e, t, n, r = !1) {
|
|
|
903
966
|
...e.retain === !1 ? { retain: !1 } : {}
|
|
904
967
|
};
|
|
905
968
|
}
|
|
906
|
-
function
|
|
907
|
-
|
|
969
|
+
function it(e, t) {
|
|
970
|
+
j(e) || k(t, "must be an object."), M(e, Pe, t);
|
|
908
971
|
let n = e.id;
|
|
909
|
-
(typeof n != "string" || !
|
|
972
|
+
(typeof n != "string" || !T.test(n) || n.length > 160) && k(`${t}.id`, "must be a lowercase namespaced id.");
|
|
910
973
|
let r;
|
|
911
974
|
if (e.version !== void 0) {
|
|
912
975
|
let n = e.version, i = o(n);
|
|
913
|
-
i === null &&
|
|
976
|
+
i === null && k(`${t}.version`, "must be an exact version or a supported range (exact, ^, ~, >=, <=, >, <)."), r = i.source;
|
|
914
977
|
}
|
|
915
978
|
return {
|
|
916
979
|
id: n,
|
|
917
980
|
...r ? { version: r } : {}
|
|
918
981
|
};
|
|
919
982
|
}
|
|
920
|
-
function
|
|
921
|
-
|
|
983
|
+
function at(e) {
|
|
984
|
+
j(e) || k("requires", "must be an object."), M(e, Fe, "requires");
|
|
922
985
|
let t;
|
|
923
986
|
if (e.kernel !== void 0) {
|
|
924
987
|
let n = o(e.kernel);
|
|
925
|
-
n === null &&
|
|
988
|
+
n === null && k("requires.kernel", "must be a supported kernel version range (exact, ^, ~, >=, <=, >, <)."), t = n.source;
|
|
926
989
|
}
|
|
927
990
|
return { ...t ? { kernel: t } : {} };
|
|
928
991
|
}
|
|
929
|
-
function
|
|
930
|
-
|
|
992
|
+
function ot(e, t) {
|
|
993
|
+
j(e) || k("replaces", "must be an object."), M(e, Ie, "replaces");
|
|
931
994
|
let n = e.id;
|
|
932
|
-
(typeof n != "string" || !
|
|
995
|
+
(typeof n != "string" || !T.test(n) || n.length > 160) && k("replaces.id", "must be a lowercase namespaced id."), n !== t && k("replaces.id", "must equal the declaring manifest id.");
|
|
933
996
|
let r;
|
|
934
997
|
if (e.version !== void 0) {
|
|
935
998
|
let t = o(e.version);
|
|
936
|
-
t === null &&
|
|
999
|
+
t === null && k("replaces.version", "must be an exact version or a supported range (exact, ^, ~, >=, <=, >, <)."), r = t.source;
|
|
937
1000
|
}
|
|
938
1001
|
return {
|
|
939
1002
|
id: n,
|
|
940
1003
|
...r ? { version: r } : {}
|
|
941
1004
|
};
|
|
942
1005
|
}
|
|
943
|
-
function
|
|
944
|
-
Array.isArray(e) ||
|
|
1006
|
+
function st(e) {
|
|
1007
|
+
Array.isArray(e) || k("styles", "must be an array of style-resource ids."), e.length > 32 && k("styles", "accepts at most 32 resources.");
|
|
945
1008
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
946
1009
|
for (let r = 0; r < e.length; r += 1) {
|
|
947
1010
|
let i = e[r];
|
|
948
|
-
(typeof i != "string" || i.length === 0 || i.length > 256) &&
|
|
1011
|
+
(typeof i != "string" || i.length === 0 || i.length > 256) && k(`styles[${r}]`, "must be a non-empty string of at most 256 characters."), Le.test(i) || k(`styles[${r}]`, "must be a bounded resource id."), t.has(i) && k("styles", `resource "${i}" is declared more than once.`), t.add(i), n.push(i);
|
|
949
1012
|
}
|
|
950
1013
|
return n;
|
|
951
1014
|
}
|
|
952
1015
|
function W(e) {
|
|
953
|
-
if (typeof e == "object" && e &&
|
|
954
|
-
|
|
1016
|
+
if (typeof e == "object" && e && D.has(e)) return e;
|
|
1017
|
+
j(e) || k("manifest", "must be an object."), M(e, Ee, "manifest");
|
|
955
1018
|
let t = e.id;
|
|
956
|
-
(typeof t != "string" || t.length > 160 || !
|
|
957
|
-
let n =
|
|
958
|
-
(typeof r != "string" || r.length > 64 || !
|
|
1019
|
+
(typeof t != "string" || t.length > 160 || !T.test(t)) && k("id", "must be a lowercase namespaced id such as \"example/rating\".");
|
|
1020
|
+
let n = I(e.name, "name"), r = e.version;
|
|
1021
|
+
(typeof r != "string" || r.length > 64 || !he.test(r)) && k("version", "must be a semantic version such as 1.0.0."), e.protocol !== "reactive-md-component/v1" && k("protocol", `must be "${c}".`);
|
|
959
1022
|
let i = e.form;
|
|
960
|
-
typeof i == "string" &&
|
|
1023
|
+
typeof i == "string" && ve.has(i) || k("form", "must be \"leaf\", \"inline\" or \"container\".");
|
|
961
1024
|
let a = i;
|
|
962
|
-
|
|
1025
|
+
j(e.props) || k("props", "must be an object.");
|
|
963
1026
|
let o = Object.keys(e.props).sort();
|
|
964
|
-
o.length > 64 &&
|
|
1027
|
+
o.length > 64 && k("props", "accepts at most 64 properties.");
|
|
965
1028
|
let s = {};
|
|
966
|
-
for (let t of o)
|
|
1029
|
+
for (let t of o) E.has(t) && k("props", `property "${t}" is not allowed.`), (!w.test(t) || t.length > 128) && k("props", `property "${t}" must use lowercase kebab-case.`), s[t] = $e(e.props[t], `props.${t}`);
|
|
967
1030
|
let l;
|
|
968
1031
|
if (e.bindings !== void 0) {
|
|
969
|
-
|
|
1032
|
+
j(e.bindings) || k("bindings", "must be an object.");
|
|
970
1033
|
let t = Object.keys(e.bindings);
|
|
971
|
-
t.length === 0 &&
|
|
1034
|
+
t.length === 0 && k("bindings", "must declare at least one binding slot."), t.length > 16 && k("bindings", "accepts at most 16 slots.");
|
|
972
1035
|
let n = {}, r = /* @__PURE__ */ new Set();
|
|
973
1036
|
for (let i of t) {
|
|
974
|
-
|
|
975
|
-
let t =
|
|
976
|
-
i !== "value" && (t.kind !== "number" || t.family !== "number") &&
|
|
977
|
-
for (let e of [t.bind, t.initial]) r.has(e) &&
|
|
1037
|
+
E.has(i) && k("bindings", `field "${i}" is not allowed.`), Re.test(i) || k("bindings", `slot "${i}" must be a letter followed by letters or digits.`), O.has(i) && k("bindings", `slot "${i}" is reserved by the runtime.`);
|
|
1038
|
+
let t = rt(e.bindings[i], s, `bindings.${i}`, a === "container" && Array.isArray(e.rules) && e.rules.some((e) => j(e) && e.kind === "options-body"));
|
|
1039
|
+
i !== "value" && (t.kind !== "number" || t.family !== "number") && k(`bindings.${i}`, "numeric named slots support kind \"number\" with family \"number\" in this contract."), i !== "value" && j(e.bindings[i]) && e.bindings[i].exclusive === !1 && k(`bindings.${i}.exclusive`, "named slots require exclusive ownership in this contract.");
|
|
1040
|
+
for (let e of [t.bind, t.initial]) r.has(e) && k("bindings", `attribute "${e}" is claimed by more than one binding.`), r.add(e);
|
|
978
1041
|
n[i] = i === "value" ? t : {
|
|
979
1042
|
...t,
|
|
980
1043
|
exclusive: !0
|
|
@@ -982,17 +1045,19 @@ function W(e) {
|
|
|
982
1045
|
}
|
|
983
1046
|
l = n;
|
|
984
1047
|
}
|
|
985
|
-
let u = e.children === void 0 ? void 0 :
|
|
986
|
-
e.children !== void 0 && e.structure !== void 0 &&
|
|
987
|
-
let d = e.structure === void 0 ?
|
|
988
|
-
e.
|
|
989
|
-
let
|
|
1048
|
+
let u = e.children === void 0 ? void 0 : Ge(e.children, a, "children");
|
|
1049
|
+
e.children !== void 0 && e.structure !== void 0 && k("manifest", "cannot declare both \"children\" and \"structure\"; use \"structure\".");
|
|
1050
|
+
let d = e.structure === void 0 ? R(u) : Ke(e.structure, a, "structure"), f = e.rules === void 0 ? void 0 : Xe(e.rules);
|
|
1051
|
+
for (let [e, t] of (f ?? []).entries()) if (t.kind === "required-one-of") for (let n of t.attributes) Object.hasOwn(s, n) || k(`rules[${e}].attributes`, `refers to undeclared attribute "${n}".`);
|
|
1052
|
+
let p = e.slotRelations === void 0 ? void 0 : Ze(e.slotRelations);
|
|
1053
|
+
e.legacyHost !== void 0 && N(e.legacyHost, "legacyHost");
|
|
1054
|
+
let m = Qe(e.capabilities, "capabilities"), h = e.authoring === void 0 ? void 0 : We(e.authoring, "authoring"), g = e.styles === void 0 ? void 0 : st(e.styles), _ = e.requires === void 0 ? void 0 : at(e.requires), v = e.replaces === void 0 ? void 0 : ot(e.replaces, t), y;
|
|
990
1055
|
if (e.dependencies !== void 0) {
|
|
991
|
-
Array.isArray(e.dependencies) ||
|
|
1056
|
+
Array.isArray(e.dependencies) || k("dependencies", "must be an array."), e.dependencies.length > 16 && k("dependencies", "accepts at most 16 entries.");
|
|
992
1057
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
993
1058
|
for (let r = 0; r < e.dependencies.length; r += 1) {
|
|
994
|
-
let i =
|
|
995
|
-
t.has(i.id) &&
|
|
1059
|
+
let i = it(e.dependencies[r], `dependencies[${r}]`);
|
|
1060
|
+
t.has(i.id) && k("dependencies", `"${i.id}" is declared more than once.`), t.add(i.id), n.push(i);
|
|
996
1061
|
}
|
|
997
1062
|
y = n;
|
|
998
1063
|
}
|
|
@@ -1016,19 +1081,19 @@ function W(e) {
|
|
|
1016
1081
|
...y ? { dependencies: y } : {},
|
|
1017
1082
|
...v ? { replaces: v } : {}
|
|
1018
1083
|
};
|
|
1019
|
-
|
|
1020
|
-
let x =
|
|
1021
|
-
return
|
|
1084
|
+
A(b) > 65536 && k("manifest", `serialized size exceeds the ${me}-byte budget.`);
|
|
1085
|
+
let x = lt(b);
|
|
1086
|
+
return D.add(x), x;
|
|
1022
1087
|
}
|
|
1023
|
-
function
|
|
1088
|
+
function ct(e) {
|
|
1024
1089
|
return W(e);
|
|
1025
1090
|
}
|
|
1026
|
-
function
|
|
1091
|
+
function lt(e) {
|
|
1027
1092
|
if (typeof e != "object" || !e) return e;
|
|
1028
|
-
for (let t of Object.keys(e))
|
|
1093
|
+
for (let t of Object.keys(e)) lt(e[t]);
|
|
1029
1094
|
return Object.freeze(e);
|
|
1030
1095
|
}
|
|
1031
|
-
function
|
|
1096
|
+
function ut(e) {
|
|
1032
1097
|
return {
|
|
1033
1098
|
kind: e.kind,
|
|
1034
1099
|
...e.required === !0 ? { required: !0 } : {},
|
|
@@ -1042,6 +1107,7 @@ function Xe(e) {
|
|
|
1042
1107
|
...e.max === void 0 ? {} : { max: e.max },
|
|
1043
1108
|
...e.integer === !0 ? { integer: !0 } : {},
|
|
1044
1109
|
...e.positive === !0 ? { positive: !0 } : {},
|
|
1110
|
+
...e.allowPositiveNumber === !0 ? { allowPositiveNumber: !0 } : {},
|
|
1045
1111
|
...e.color === !0 ? { color: !0 } : {},
|
|
1046
1112
|
...e.coerce === void 0 ? {} : { coerce: e.coerce }
|
|
1047
1113
|
};
|
|
@@ -1049,14 +1115,14 @@ function Xe(e) {
|
|
|
1049
1115
|
function G(e) {
|
|
1050
1116
|
return "literal" in e ? { literal: e.literal } : { prop: e.prop };
|
|
1051
1117
|
}
|
|
1052
|
-
function
|
|
1118
|
+
function dt(e) {
|
|
1053
1119
|
return {
|
|
1054
1120
|
...e.min ? { min: G(e.min) } : {},
|
|
1055
1121
|
...e.max ? { max: G(e.max) } : {},
|
|
1056
1122
|
...e.step ? { step: G(e.step) } : {}
|
|
1057
1123
|
};
|
|
1058
1124
|
}
|
|
1059
|
-
function
|
|
1125
|
+
function ft(e) {
|
|
1060
1126
|
let t = e.constraints;
|
|
1061
1127
|
return {
|
|
1062
1128
|
kind: e.kind,
|
|
@@ -1067,14 +1133,14 @@ function Qe(e) {
|
|
|
1067
1133
|
...e.required === !0 ? { required: !0 } : {},
|
|
1068
1134
|
...e.exclusive === !0 ? { exclusive: !0 } : {},
|
|
1069
1135
|
...e.options ? { options: [...e.options] } : {},
|
|
1070
|
-
...t ? { constraints:
|
|
1136
|
+
...t ? { constraints: dt(t) } : {},
|
|
1071
1137
|
...e.maxItems ? { maxItems: G(e.maxItems) } : {},
|
|
1072
1138
|
...e.requiresAttributes ? { requiresAttributes: [...e.requiresAttributes] } : {},
|
|
1073
1139
|
...e.compare ? { compare: [...e.compare] } : {},
|
|
1074
1140
|
...e.retain === !1 ? { retain: !1 } : {}
|
|
1075
1141
|
};
|
|
1076
1142
|
}
|
|
1077
|
-
function
|
|
1143
|
+
function pt(e) {
|
|
1078
1144
|
return {
|
|
1079
1145
|
rule: e.rule,
|
|
1080
1146
|
...e.label === void 0 ? {} : { label: e.label },
|
|
@@ -1091,7 +1157,7 @@ function $e(e) {
|
|
|
1091
1157
|
...e.maxItems === void 0 ? {} : { maxItems: e.maxItems }
|
|
1092
1158
|
};
|
|
1093
1159
|
}
|
|
1094
|
-
function
|
|
1160
|
+
function mt(e) {
|
|
1095
1161
|
let t = e, n = Object.keys(t).sort(), r = {};
|
|
1096
1162
|
for (let e of n) {
|
|
1097
1163
|
let n = t[e];
|
|
@@ -1099,11 +1165,11 @@ function et(e) {
|
|
|
1099
1165
|
}
|
|
1100
1166
|
return r;
|
|
1101
1167
|
}
|
|
1102
|
-
function
|
|
1168
|
+
function ht(e) {
|
|
1103
1169
|
let t = {};
|
|
1104
|
-
for (let n of Object.keys(e.props).sort()) t[n] =
|
|
1170
|
+
for (let n of Object.keys(e.props).sort()) t[n] = ut(e.props[n]);
|
|
1105
1171
|
let n = {};
|
|
1106
|
-
if (e.bindings) for (let t of Object.keys(e.bindings).sort()) n[t] =
|
|
1172
|
+
if (e.bindings) for (let t of Object.keys(e.bindings).sort()) n[t] = ft(e.bindings[t]);
|
|
1107
1173
|
return {
|
|
1108
1174
|
protocol: e.protocol,
|
|
1109
1175
|
id: e.id,
|
|
@@ -1116,8 +1182,8 @@ function tt(e) {
|
|
|
1116
1182
|
kind: e.children.kind,
|
|
1117
1183
|
...e.children.required ? { required: !0 } : {}
|
|
1118
1184
|
} } : {},
|
|
1119
|
-
...e.structure ? { structure:
|
|
1120
|
-
...e.rules ? { rules: e.rules.map(
|
|
1185
|
+
...e.structure ? { structure: pt(e.structure) } : {},
|
|
1186
|
+
...e.rules ? { rules: e.rules.map(mt) } : {},
|
|
1121
1187
|
...e.slotRelations ? { slotRelations: e.slotRelations.map((e) => ({ ...e })) } : {},
|
|
1122
1188
|
capabilities: {
|
|
1123
1189
|
interactive: e.capabilities.interactive,
|
|
@@ -1134,14 +1200,14 @@ function tt(e) {
|
|
|
1134
1200
|
} } : {}
|
|
1135
1201
|
};
|
|
1136
1202
|
}
|
|
1137
|
-
var
|
|
1203
|
+
var gt = /* @__PURE__ */ new WeakMap();
|
|
1138
1204
|
function K(e) {
|
|
1139
|
-
let t =
|
|
1205
|
+
let t = D.has(e) ? e : W(e), n = gt.get(t);
|
|
1140
1206
|
if (n !== void 0) return n;
|
|
1141
|
-
let r =
|
|
1142
|
-
return
|
|
1207
|
+
let r = x(JSON.stringify(ht(t)));
|
|
1208
|
+
return gt.set(t, r), r;
|
|
1143
1209
|
}
|
|
1144
|
-
function
|
|
1210
|
+
function _t(e) {
|
|
1145
1211
|
return Object.freeze({
|
|
1146
1212
|
id: e.id,
|
|
1147
1213
|
name: e.name,
|
|
@@ -1149,18 +1215,18 @@ function rt(e) {
|
|
|
1149
1215
|
digest: K(e)
|
|
1150
1216
|
});
|
|
1151
1217
|
}
|
|
1152
|
-
function
|
|
1153
|
-
return typeof e == "string" && e.length <= 128 &&
|
|
1218
|
+
function vt(e) {
|
|
1219
|
+
return typeof e == "string" && e.length <= 128 && w.test(e);
|
|
1154
1220
|
}
|
|
1155
1221
|
function q(e) {
|
|
1156
|
-
return typeof e == "string" && e.length > 0 && e.length <= 160 &&
|
|
1222
|
+
return typeof e == "string" && e.length > 0 && e.length <= 160 && T.test(e);
|
|
1157
1223
|
}
|
|
1158
1224
|
// src/sdk/default-identity.ts
|
|
1159
|
-
var
|
|
1225
|
+
var yt = "reactive-md/default", bt = "reactive-md/minimal", xt = s, St = 160, Ct = 256, wt = 32, Tt = 256, Et = 4096, Dt = /^[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*$/, Ot = /* @__PURE__ */ new Set([
|
|
1160
1226
|
"__proto__",
|
|
1161
1227
|
"constructor",
|
|
1162
1228
|
"prototype"
|
|
1163
|
-
]),
|
|
1229
|
+
]), kt = /* @__PURE__ */ new Set([
|
|
1164
1230
|
"protocol",
|
|
1165
1231
|
"id",
|
|
1166
1232
|
"version",
|
|
@@ -1169,12 +1235,12 @@ var at = "reactive-md/default", ot = "reactive-md/minimal", st = s, ct = 160, lt
|
|
|
1169
1235
|
"themes",
|
|
1170
1236
|
"dependencies",
|
|
1171
1237
|
"metadata"
|
|
1172
|
-
]),
|
|
1238
|
+
]), At = /* @__PURE__ */ new Set([
|
|
1173
1239
|
"title",
|
|
1174
1240
|
"description",
|
|
1175
1241
|
"category",
|
|
1176
1242
|
"insertText"
|
|
1177
|
-
]),
|
|
1243
|
+
]), jt = /* @__PURE__ */ new Set(["title", "description"]), Mt = /* @__PURE__ */ new Set(["id", "version"]), J = /* @__PURE__ */ new WeakSet();
|
|
1178
1244
|
function Y(e, t) {
|
|
1179
1245
|
throw Error(`Invalid local preset (${e}): ${t}`);
|
|
1180
1246
|
}
|
|
@@ -1184,25 +1250,25 @@ function X(e) {
|
|
|
1184
1250
|
return t === Object.prototype || t === null;
|
|
1185
1251
|
}
|
|
1186
1252
|
function Z(e, t, n) {
|
|
1187
|
-
for (let r of Object.keys(e))
|
|
1253
|
+
for (let r of Object.keys(e)) Ot.has(r) && Y(n, `field "${r}" is not allowed.`), t.has(r) || Y(n, `unknown field "${r}".`);
|
|
1188
1254
|
}
|
|
1189
1255
|
function Q(e, t) {
|
|
1190
1256
|
X(e) || Y(t, "must be a locale-keyed string map.");
|
|
1191
1257
|
let n = {};
|
|
1192
1258
|
for (let r of Object.keys(e).sort()) {
|
|
1193
|
-
|
|
1259
|
+
Ot.has(r) && Y(t, `locale "${r}" is not allowed.`), /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(r) || Y(t, `locale "${r}" must look like "en" or "zh-CN".`);
|
|
1194
1260
|
let i = e[r];
|
|
1195
|
-
(typeof i != "string" || i.length >
|
|
1261
|
+
(typeof i != "string" || i.length > Et) && Y(t, `locale "${r}" must be a bounded string.`), n[r] = i;
|
|
1196
1262
|
}
|
|
1197
1263
|
return Object.freeze(n);
|
|
1198
1264
|
}
|
|
1199
|
-
function
|
|
1200
|
-
X(e) || Y("authoring", "must be an object."), Z(e,
|
|
1265
|
+
function Nt(e) {
|
|
1266
|
+
X(e) || Y("authoring", "must be an object."), Z(e, At, "authoring");
|
|
1201
1267
|
let t = {};
|
|
1202
|
-
return e.title !== void 0 && (t.title = Q(e.title, "authoring.title")), e.description !== void 0 && (t.description = Q(e.description, "authoring.description")), e.category !== void 0 && ((typeof e.category != "string" || e.category.length > 64) && Y("authoring.category", "must be a bounded string."), t.category = e.category), e.insertText !== void 0 && ((typeof e.insertText != "string" || e.insertText.length >
|
|
1268
|
+
return e.title !== void 0 && (t.title = Q(e.title, "authoring.title")), e.description !== void 0 && (t.description = Q(e.description, "authoring.description")), e.category !== void 0 && ((typeof e.category != "string" || e.category.length > 64) && Y("authoring.category", "must be a bounded string."), t.category = e.category), e.insertText !== void 0 && ((typeof e.insertText != "string" || e.insertText.length > Et) && Y("authoring.insertText", "must be a bounded string."), t.insertText = e.insertText), Object.freeze(t);
|
|
1203
1269
|
}
|
|
1204
|
-
function
|
|
1205
|
-
Array.isArray(e) || Y("authoring", "must be an array."), e.length >
|
|
1270
|
+
function Pt(e, t) {
|
|
1271
|
+
Array.isArray(e) || Y("authoring", "must be an array."), e.length > Tt && Y("authoring", `accepts at most ${Tt} entries.`);
|
|
1206
1272
|
let n = new Set(t.map((e) => e.id)), r = /* @__PURE__ */ new Set(), i = [];
|
|
1207
1273
|
for (let t = 0; t < e.length; t += 1) {
|
|
1208
1274
|
let a = e[t];
|
|
@@ -1210,17 +1276,17 @@ function bt(e, t) {
|
|
|
1210
1276
|
let o = a.componentId;
|
|
1211
1277
|
typeof o == "string" && q(o) || Y(`authoring[${t}].componentId`, "must be a lowercase namespaced id."), n.has(o) || Y(`authoring[${t}].componentId`, `"${o}" is not declared by this preset.`), r.has(o) && Y("authoring", `component "${o}" is declared more than once.`), r.add(o), i.push(Object.freeze({
|
|
1212
1278
|
componentId: o,
|
|
1213
|
-
authoring:
|
|
1279
|
+
authoring: Nt(a.authoring)
|
|
1214
1280
|
}));
|
|
1215
1281
|
}
|
|
1216
1282
|
return Object.freeze(i.sort((e, t) => e.componentId < t.componentId ? -1 : +(e.componentId > t.componentId)));
|
|
1217
1283
|
}
|
|
1218
|
-
function
|
|
1219
|
-
Array.isArray(e) || Y("dependencies", "must be an array."), e.length >
|
|
1284
|
+
function Ft(e) {
|
|
1285
|
+
Array.isArray(e) || Y("dependencies", "must be an array."), e.length > wt && Y("dependencies", `accepts at most ${wt} entries.`);
|
|
1220
1286
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1221
1287
|
for (let r = 0; r < e.length; r += 1) {
|
|
1222
1288
|
let i = e[r];
|
|
1223
|
-
X(i) || Y(`dependencies[${r}]`, "must be an object."), Z(i,
|
|
1289
|
+
X(i) || Y(`dependencies[${r}]`, "must be an object."), Z(i, Mt, `dependencies[${r}]`);
|
|
1224
1290
|
let o = i.id;
|
|
1225
1291
|
typeof o == "string" && q(o) || Y(`dependencies[${r}].id`, "must be a lowercase namespaced id."), t.has(o) && Y("dependencies", `"${o}" is declared more than once.`), t.add(o);
|
|
1226
1292
|
let s = i.version;
|
|
@@ -1231,41 +1297,46 @@ function xt(e) {
|
|
|
1231
1297
|
}
|
|
1232
1298
|
return Object.freeze(n.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
|
|
1233
1299
|
}
|
|
1234
|
-
function
|
|
1300
|
+
function It(e) {
|
|
1235
1301
|
Array.isArray(e) || Y("themes", "must be an array.");
|
|
1236
1302
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
1237
1303
|
for (let i = 0; i < e.length; i += 1) {
|
|
1238
1304
|
let o = e[i];
|
|
1239
1305
|
X(o) || Y(`themes[${i}]`, "must be an object.");
|
|
1240
1306
|
let s = o.id, c = o.name, l = o.version;
|
|
1241
|
-
(typeof s != "string" || s.length === 0) && Y(`themes[${i}].id`, "must be a non-empty string."), (typeof c != "string" || c.length === 0) && Y(`themes[${i}].name`, "must be a non-empty string."), typeof l == "string" && a(l) || Y(`themes[${i}].version`, "must be a semantic version."), n.has(s) && Y("themes", `theme id "${s}" is declared more than once.`), r.has(c) && Y("themes", `theme name "${c}" is declared more than once.`), n.add(s), r.add(c)
|
|
1307
|
+
(typeof s != "string" || s.length === 0) && Y(`themes[${i}].id`, "must be a non-empty string."), (typeof c != "string" || c.length === 0) && Y(`themes[${i}].name`, "must be a non-empty string."), typeof l == "string" && a(l) || Y(`themes[${i}].version`, "must be a semantic version."), n.has(s) && Y("themes", `theme id "${s}" is declared more than once.`), r.has(c) && Y("themes", `theme name "${c}" is declared more than once.`), n.add(s), r.add(c);
|
|
1308
|
+
let u = _(o.fonts, `themes[${i}].fonts`);
|
|
1309
|
+
t.push(Object.freeze({
|
|
1310
|
+
...o,
|
|
1311
|
+
...o.fonts === void 0 ? {} : { fonts: u }
|
|
1312
|
+
}));
|
|
1242
1313
|
}
|
|
1243
1314
|
return Object.freeze(t.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
|
|
1244
1315
|
}
|
|
1245
|
-
function
|
|
1246
|
-
return X(e) || Y("metadata", "must be an object."), Z(e,
|
|
1316
|
+
function Lt(e) {
|
|
1317
|
+
return X(e) || Y("metadata", "must be an object."), Z(e, jt, "metadata"), Object.freeze({
|
|
1247
1318
|
...e.title === void 0 ? {} : { title: Q(e.title, "metadata.title") },
|
|
1248
1319
|
...e.description === void 0 ? {} : { description: Q(e.description, "metadata.description") }
|
|
1249
1320
|
});
|
|
1250
1321
|
}
|
|
1251
1322
|
function $(e) {
|
|
1252
1323
|
if (X(e) && J.has(e)) return e;
|
|
1253
|
-
X(e) || Y("preset", "must be an object."), Z(e,
|
|
1324
|
+
X(e) || Y("preset", "must be an object."), Z(e, kt, "preset"), e.protocol !== "reactive-md-preset/v1" && Y("protocol", `must be "${l}".`);
|
|
1254
1325
|
let t = e.id;
|
|
1255
|
-
(typeof t != "string" || t.length >
|
|
1326
|
+
(typeof t != "string" || t.length > St || !Dt.test(t)) && Y("id", "must be a lowercase namespaced id.");
|
|
1256
1327
|
let n = e.version;
|
|
1257
|
-
typeof n == "string" && a(n) || Y("version", "must be a semantic version such as \"1.0.0\"."), Array.isArray(e.components) || Y("components", "must be an array."), e.components.length >
|
|
1328
|
+
typeof n == "string" && a(n) || Y("version", "must be a semantic version such as \"1.0.0\"."), Array.isArray(e.components) || Y("components", "must be an array."), e.components.length > Ct && Y("components", `accepts at most ${Ct} components.`);
|
|
1258
1329
|
let r = [], i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
1259
1330
|
for (let t = 0; t < e.components.length; t += 1) {
|
|
1260
1331
|
let n;
|
|
1261
1332
|
try {
|
|
1262
|
-
n =
|
|
1333
|
+
n = ct(e.components[t]);
|
|
1263
1334
|
} catch (e) {
|
|
1264
1335
|
Y(`components[${t}]`, e instanceof Error ? e.message : String(e));
|
|
1265
1336
|
}
|
|
1266
1337
|
i.has(n.id) && Y("components", `component id "${n.id}" is declared more than once.`), o.has(n.name) && Y("components", `component name "${n.name}" is declared more than once.`), i.add(n.id), o.add(n.name), r.push(n);
|
|
1267
1338
|
}
|
|
1268
|
-
let s = e.authoring === void 0 ? void 0 :
|
|
1339
|
+
let s = e.authoring === void 0 ? void 0 : Pt(e.authoring, r), c = e.themes === void 0 ? void 0 : It(e.themes), u = e.dependencies === void 0 ? void 0 : Ft(e.dependencies), d = e.metadata === void 0 ? void 0 : Lt(e.metadata), f = e.components, p = Object.isFrozen(f) && f.length === r.length && f.every((e, t) => e === r[t]) ? f : Object.freeze(r), m = Object.freeze({
|
|
1269
1340
|
protocol: l,
|
|
1270
1341
|
id: t,
|
|
1271
1342
|
version: n,
|
|
@@ -1277,12 +1348,12 @@ function $(e) {
|
|
|
1277
1348
|
});
|
|
1278
1349
|
return J.add(m), m;
|
|
1279
1350
|
}
|
|
1280
|
-
function
|
|
1351
|
+
function Rt(e) {
|
|
1281
1352
|
return $(e);
|
|
1282
1353
|
}
|
|
1283
|
-
function
|
|
1354
|
+
function zt(e) {
|
|
1284
1355
|
let t = $(e);
|
|
1285
|
-
return
|
|
1356
|
+
return x(JSON.stringify({
|
|
1286
1357
|
protocol: l,
|
|
1287
1358
|
id: t.id,
|
|
1288
1359
|
version: t.version,
|
|
@@ -1297,4 +1368,4 @@ function Tt(e) {
|
|
|
1297
1368
|
})).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id))
|
|
1298
1369
|
}));
|
|
1299
1370
|
}
|
|
1300
|
-
export {
|
|
1371
|
+
export { A, b as B, ce as C, vt as D, q as E, ee as F, _ as H, x as I, d as L, W as M, ne as N, K as O, re as P, u as R, pe as S, ct as T, y as V, Be as _, xt as a, He as b, ze as c, le as d, se as f, ae as g, ue as h, yt as i, R as j, _t as k, ie as l, oe as m, zt as n, bt as o, me as p, $ as r, Ue as s, Rt as t, de as u, Ve as v, ht as w, fe as x, C as y, v as z };
|