reactive-md 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +333 -306
- package/CHANGELOG.md +334 -307
- package/CONTRIBUTING-ch.md +22 -22
- package/CONTRIBUTING.md +22 -22
- package/README-ch.md +431 -431
- package/README-en.md +431 -431
- package/README.md +429 -429
- package/SECURITY-ch.md +83 -83
- package/SECURITY.md +83 -83
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/bin/reactive-md.mjs +39 -39
- package/cli/args.mjs +263 -263
- package/cli/assets.mjs +395 -395
- package/cli/build.mjs +445 -444
- package/cli/check.mjs +444 -444
- package/cli/document.mjs +130 -130
- package/cli/errors.mjs +61 -61
- package/cli/fs-utils.mjs +133 -133
- package/cli/glob.mjs +203 -203
- package/cli/help.mjs +323 -323
- package/cli/init.mjs +1577 -1577
- package/cli/lint.mjs +177 -177
- package/cli/main.mjs +65 -65
- package/cli/migrate.mjs +368 -368
- package/cli/package-loader.mjs +41 -41
- package/cli/package.mjs +211 -211
- package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-BuqgJZEY.js} +11 -11
- package/dist-library/LocalDocumentViewCore-DXE0I0Qc.js +9830 -0
- package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +275 -0
- package/dist-library/{authoring-Co_TiE-P.js → authoring-Ci_KzJ0q.js} +87 -67
- package/dist-library/{compile-LhpTKqCR.js → compile-Dx6Uw3D9.js} +11 -11
- package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-DDDdvuLy.js} +2618 -1846
- package/dist-library/compiler-dxLPB9Ym.js +86 -0
- package/dist-library/{component-state-BBJ08vML.js → component-state-BRwvTV0d.js} +15 -14
- package/dist-library/component-state-CwKX_SN5.js +763 -0
- package/dist-library/{config-BUo-8O5C.js → config-DXLvctiZ.js} +68 -66
- package/dist-library/config-validation-D3D7Dy2J.js +586 -0
- package/dist-library/{controls-BWiLLtBO.js → controls-DoZyLCrV.js} +2434 -2410
- package/dist-library/{coordinate-BSl6enWV.js → coordinate-B1VFK9fd.js} +108 -107
- package/dist-library/{data-table-DfvytZKQ.js → data-table-8-3F15Jf.js} +69 -66
- package/dist-library/{default-components-BwQf0oP-.js → default-components-s21NevON.js} +29 -28
- package/dist-library/{display-lw3BT1TA.js → display-B_uutKkN.js} +1 -1
- package/dist-library/{config-validation-C5kJYk-J.js → document-theme-C8J6UyNO.js} +241 -731
- package/dist-library/export-CIAIPBov.js +370 -0
- package/dist-library/{gallery-B8kSt1oI.js → gallery-Dv1rOvL0.js} +151 -147
- package/dist-library/html-Cr4CBwAH.js +758 -0
- package/dist-library/identity-BUx0Q_-d.js +40 -0
- package/dist-library/{incremental-D_6vwAAE.js → incremental-9nx92u9c.js} +407 -143
- package/dist-library/layout-BBB2VF0S.js +562 -0
- package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-DMZ5wd3t.js} +3 -3
- package/dist-library/observability-4KqXhIEU.js +421 -0
- package/dist-library/observability-core-Bcu7vpnl.js +24 -0
- package/dist-library/options-BBp9IcHm.js +121 -0
- package/dist-library/{package-core-D0POW4Gd.js → package-core-K5xesGqy.js} +30 -29
- package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-CBA1-hdG.js} +3332 -3840
- package/dist-library/{plugin-packs-B1XPWcFs.js → plugin-packs-Bh1HhLym.js} +3 -2
- package/dist-library/preset-core-DeZPA8IE.js +1298 -0
- package/dist-library/react-0DCh-Mar.js +7 -0
- package/dist-library/reactive-md-authoring.js +28 -30
- package/dist-library/reactive-md-build.js +99 -61
- package/dist-library/reactive-md-compiler-standard.js +10 -9
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-default-packs.js +3 -2
- package/dist-library/reactive-md-default-preset.js +3 -2
- package/dist-library/reactive-md-export.js +4 -4
- package/dist-library/reactive-md-minimal-preset.js +2 -2
- package/dist-library/reactive-md-minimal-react-preset.js +3 -3
- package/dist-library/reactive-md-observability.js +4 -0
- package/dist-library/reactive-md-pdf.js +127 -3
- package/dist-library/reactive-md-plugin-chart.js +3 -3
- package/dist-library/reactive-md-plugin-data.js +5 -5
- package/dist-library/reactive-md-plugin-diagram.js +4 -4
- package/dist-library/reactive-md-plugin-forms.js +4 -4
- package/dist-library/reactive-md-plugin-gallery.js +3 -3
- package/dist-library/reactive-md-plugin-navigation.js +3 -3
- package/dist-library/reactive-md-plugin-network.js +119 -116
- package/dist-library/reactive-md-plugin-plot.js +4 -4
- package/dist-library/reactive-md-print.css +304 -304
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-server.js +6 -6
- package/dist-library/reactive-md-react-unstyled.js +11 -12
- package/dist-library/reactive-md-react.js +11 -12
- package/dist-library/reactive-md-runtime-browser.js +2 -1
- package/dist-library/reactive-md-runtime.js +4 -3
- package/dist-library/reactive-md-sdk.js +8 -7
- 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 +5 -5
- package/dist-library/reactive-md.js +649 -373
- package/dist-library/{registry-05JiqmEp.js → registry-D6OGkOcX.js} +3 -3
- package/dist-library/{registry-core-Bbad9Bm2.js → registry-core-C9xOunaw.js} +1 -1
- package/dist-library/{resources-IeJomeUT.js → resources-B0x_w3s9.js} +71 -46
- package/dist-library/{runtime-B2fxeveq.js → runtime-BDnnimPA.js} +17 -16
- package/dist-library/{runtime-CuOyRe9f.js → runtime-BpQdZmFI.js} +269 -263
- package/dist-library/{schema-C-AeByPp.js → schema-BryM_VRW.js} +14 -14
- package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-ChslheKs.js} +499 -158
- package/dist-library/{session-core-BGka5D1J.js → session-core-dxQCJBNa.js} +171 -156
- package/dist-library/{shareable-jkGi2g6y.js → shareable-B8xMoGEa.js} +265 -297
- package/dist-library/types/authoring/catalog.d.ts +1 -2
- package/dist-library/types/build/diagnostics.d.ts +1 -1
- package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
- package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
- package/dist-library/types/local/compilation/compiler.d.ts +3 -3
- package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
- package/dist-library/types/local/compilation/streaming.d.ts +27 -0
- package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
- package/dist-library/types/local/configuration/options-core.d.ts +1 -2
- package/dist-library/types/local/configuration/options.d.ts +1 -0
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html.d.ts +39 -3
- package/dist-library/types/local/index.d.ts +7 -1
- package/dist-library/types/local/observability-codes.d.ts +2 -0
- package/dist-library/types/local/observability-core.d.ts +25 -0
- package/dist-library/types/local/observability-messages.d.ts +6 -0
- package/dist-library/types/local/observability.d.ts +43 -0
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
- package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
- package/dist-library/types/local/parsing/parser-internals.d.ts +2 -1
- package/dist-library/types/local/parsing/parser.d.ts +2 -2
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/transport/worker.d.ts +79 -5
- package/dist-library/types/local/types.d.ts +60 -16
- package/dist-library/types/observability.d.ts +7 -0
- package/dist-library/types/react/component-api.d.ts +10 -1
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/sdk-core.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +5 -4
- package/dist-library/types/standalone/prepare.d.ts +1 -1
- package/dist-library/types/standalone/session-core.d.ts +3 -2
- package/dist-library/{types-BFC5rzC4.js → types-Ib5kSScP.js} +1 -1
- package/dist-library/types-daDo2c_w.js +3 -0
- package/dist-library/{validation-BlDL2uD9.js → validation-B3RI0xOk.js} +218 -200
- package/dist-library/version-DAxuGOG2.js +147 -0
- package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-_rcd5HUv.js} +6 -5
- package/dist-library/{visuals-BkYRmYGO.js → visuals-DkDhNdEZ.js} +24191 -24190
- package/dist-standalone/reactive-md-standalone.js +124 -117
- package/docs/README-ch.md +101 -94
- package/docs/README.md +101 -94
- package/docs/compatibility/api-stability-ch.md +25 -0
- package/docs/compatibility/api-stability-en.md +25 -0
- package/docs/compatibility/compatibility-ch.md +146 -129
- package/docs/compatibility/compatibility-en.md +146 -129
- package/docs/compatibility/compatibility-manifest.schema.json +161 -0
- package/docs/compatibility/deprecation-ch.md +21 -0
- package/docs/compatibility/deprecation-en.md +21 -0
- package/docs/compatibility/source-versioning-ch.md +162 -162
- package/docs/compatibility/source-versioning-en.md +162 -162
- package/docs/compatibility/support-matrix-ch.md +108 -0
- package/docs/compatibility/support-matrix-en.md +108 -0
- package/docs/development/component-development-ch.md +66 -66
- package/docs/development/component-development-en.md +66 -66
- package/docs/development/component-development-reference-ch.md +253 -253
- package/docs/development/component-development-reference-en.md +238 -238
- package/docs/development/component-protocol-ch.md +748 -748
- package/docs/development/component-protocol-en.md +750 -750
- package/docs/development/extension-tutorial-ch.md +308 -308
- package/docs/development/extension-tutorial-en.md +308 -308
- package/docs/development/performance-overview-ch.md +422 -422
- package/docs/development/performance-overview-en.md +422 -422
- package/docs/guides/local-guide-ch.md +532 -532
- package/docs/guides/local-guide-en.md +532 -532
- package/docs/integration/author-tools-ch.md +64 -64
- package/docs/integration/author-tools-en.md +64 -64
- package/docs/integration/compiler-ch.md +49 -47
- package/docs/integration/compiler-en.md +36 -34
- package/docs/integration/directory-discovery-en.md +1 -1
- package/docs/integration/editor-ch.md +295 -295
- package/docs/integration/editor-en.md +303 -303
- package/docs/integration/extension-sdk-ch.md +394 -394
- package/docs/integration/extension-sdk-en.md +379 -379
- package/docs/integration/local-integration-ch.md +646 -524
- package/docs/integration/local-integration-en.md +662 -540
- package/docs/integration/shareable-export-ch.md +307 -305
- package/docs/integration/shareable-export-en.md +309 -307
- package/docs/reference/diagnostics-counting-ch.md +104 -104
- package/docs/reference/diagnostics-counting-en.md +104 -104
- package/docs/reference/html-compatibility-ch.md +93 -140
- package/docs/reference/html-compatibility-en.md +95 -140
- package/docs/reference/local-interaction-syntax-ch.md +724 -724
- package/docs/reference/local-interaction-syntax-en.md +722 -722
- package/docs/reference/public-api-ch.md +39 -7
- package/docs/reference/public-api-en.md +39 -7
- package/docs/reference/theme-protocol-ch.md +198 -198
- package/docs/reference/theme-protocol-en.md +217 -217
- package/docs/releases/release-0.4.0-ch.md +91 -91
- package/docs/releases/release-0.4.0-en.md +91 -91
- package/docs/releases/release-0.4.1-ch.md +25 -25
- package/docs/releases/release-0.4.1-en.md +25 -25
- package/docs/releases/release-0.5.0-ch.md +43 -43
- package/docs/releases/release-0.5.0-en.md +43 -43
- package/docs/releases/release-0.5.1-ch.md +41 -41
- package/docs/releases/release-0.5.1-en.md +41 -41
- package/docs/releases/release-0.5.2-ch.md +37 -37
- package/docs/releases/release-0.5.2-en.md +37 -37
- package/docs/releases/release-0.5.3-ch.md +26 -26
- package/docs/releases/release-0.5.3-en.md +26 -26
- package/docs/releases/release-0.6.0-ch.md +59 -59
- package/docs/releases/release-0.6.0-en.md +59 -59
- package/docs/releases/release-0.6.1-ch.md +29 -29
- package/docs/releases/release-0.6.1-en.md +29 -29
- package/docs/releases/release-0.7.0-ch.md +86 -86
- package/docs/releases/release-0.7.0-en.md +86 -86
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/docs/releases/release-0.9.2-ch.md +33 -0
- package/docs/releases/release-0.9.2-en.md +33 -0
- package/examples/component-package/README-ch.md +101 -101
- package/examples/component-package/README.md +133 -133
- package/examples/conformance/README-ch.md +55 -55
- package/examples/conformance/README.md +55 -55
- package/examples/conformance/component-protocol-1.json +482 -482
- package/examples/conformance/component-protocol-1.schema.json +76 -76
- package/examples/conformance/local-draft-1.json +50 -50
- package/examples/conformance/local-draft-2.json +212 -212
- package/examples/game-2048-package/LICENSE +21 -21
- package/examples/game-2048-package/NOTICES.md +11 -11
- package/examples/game-2048-package/README-ch.md +91 -91
- package/examples/game-2048-package/README.md +98 -98
- package/examples/game-2048-package/package.json +35 -35
- package/examples/game-2048-package/sample/document.reactive.md +17 -17
- package/examples/game-2048-package/scripts/build-export.mjs +44 -44
- package/examples/game-2048-package/scripts/build.mjs +130 -130
- package/examples/game-2048-package/scripts/verify.mjs +180 -180
- package/examples/game-2048-package/src/component.css +161 -161
- package/examples/game-2048-package/src/components.tsx +326 -326
- package/examples/game-2048-package/src/game-engine.ts +228 -228
- package/examples/game-2048-package/src/harness.tsx +34 -34
- package/examples/game-2048-package/src/manifest.ts +85 -85
- package/examples/game-2048-package/src/node-entry.ts +30 -30
- package/examples/game-2048-package/src/sample.ts +4 -4
- package/examples/game-2048-package/tsconfig.json +15 -15
- package/examples/integration/README-ch.md +82 -63
- package/examples/integration/README.md +82 -63
- package/examples/integration/core/index.mjs +32 -32
- package/examples/integration/extension-sdk/README-ch.md +24 -24
- package/examples/integration/extension-sdk/README.md +24 -24
- package/examples/integration/streaming/index.html +48 -0
- package/examples/integration/streaming/main.js +175 -0
- package/examples/integration/streaming/package.json +13 -0
- package/examples/integration/streaming/worker.js +3 -0
- package/examples/integration/worker/index.html +19 -19
- package/examples/integration/worker/main.js +61 -61
- package/examples/integration/worker/package.json +13 -13
- package/examples/integration/worker/worker.js +3 -3
- package/examples/local/README-ch.md +76 -76
- package/examples/local/README.md +76 -76
- package/examples/local/charts.reactive.md +73 -73
- package/examples/local/recipes/invoice-zh.reactive.md +36 -36
- package/examples/local/recipes/invoice.reactive.md +36 -36
- package/examples/local/recipes/workshop-zh.reactive.md +33 -33
- package/examples/local/recipes/workshop.reactive.md +33 -33
- package/examples/local/showcase/README-ch.md +22 -22
- package/examples/local/showcase/README.md +31 -31
- package/examples/local/showcase/explore.reactive.md +102 -102
- package/examples/local/showcase/flow.reactive.md +86 -86
- package/examples/local/showcase/forms.reactive.md +126 -126
- package/examples/local/showcase/functions.reactive.md +119 -119
- package/examples/local/showcase/layout.reactive.md +100 -100
- package/examples/local/showcase/statistics.reactive.md +108 -108
- package/examples/local/showcase/tasks.reactive.md +89 -89
- package/examples/local/showcase/zh/explore.reactive.md +102 -102
- package/examples/local/showcase/zh/flow.reactive.md +86 -86
- package/examples/local/showcase/zh/forms.reactive.md +126 -126
- package/examples/local/showcase/zh/functions.reactive.md +119 -119
- package/examples/local/showcase/zh/layout.reactive.md +100 -100
- package/examples/local/showcase/zh/statistics.reactive.md +108 -108
- package/examples/local/showcase/zh/tasks.reactive.md +89 -89
- package/examples/minimal-extension/README-ch.md +78 -78
- package/examples/minimal-extension/README.md +78 -78
- package/examples/minimal-extension/index.html +15 -15
- package/examples/minimal-extension/package.json +26 -26
- package/examples/minimal-extension/sample/document.reactive.md +10 -10
- package/examples/minimal-extension/scripts/build.mjs +32 -32
- package/examples/minimal-extension/scripts/export.mjs +72 -72
- package/examples/minimal-extension/scripts/test-node.mjs +75 -75
- package/examples/minimal-extension/src/extension.tsx +90 -90
- package/examples/minimal-extension/src/preview.tsx +12 -12
- package/examples/minimal-extension/src/source.ts +4 -4
- package/examples/minimal-extension/tsconfig.json +14 -14
- package/examples/sci-fi-theme/README-ch.md +133 -133
- package/examples/sci-fi-theme/README.md +148 -148
- package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
- package/examples/sci-fi-theme/demo/demo.css +638 -638
- package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
- package/examples/sci-fi-theme/demo/index.html +13 -13
- package/examples/sci-fi-theme/demo/main.tsx +215 -215
- package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
- package/examples/sci-fi-theme/docs/design-system.md +474 -474
- package/examples/sci-fi-theme/package.json +28 -28
- package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
- package/examples/sci-fi-theme/src/components.css +2370 -2370
- package/examples/sci-fi-theme/src/index.ts +6 -6
- package/examples/sci-fi-theme/src/notch.css +142 -142
- package/examples/sci-fi-theme/src/sci-fi.css +7 -7
- package/examples/sci-fi-theme/src/theme.ts +39 -39
- package/examples/sci-fi-theme/tsconfig.json +20 -20
- package/examples/sci-fi-theme/vite.config.ts +24 -24
- package/examples/tetris-package/LICENSE +21 -21
- package/examples/tetris-package/NOTICES.md +11 -11
- package/examples/tetris-package/README-ch.md +91 -91
- package/examples/tetris-package/README.md +95 -95
- package/examples/tetris-package/package.json +35 -35
- package/examples/tetris-package/sample/document.reactive.md +16 -16
- package/examples/tetris-package/scripts/build-export.mjs +44 -44
- package/examples/tetris-package/scripts/build.mjs +130 -130
- package/examples/tetris-package/scripts/verify.mjs +173 -173
- package/examples/tetris-package/src/component.css +145 -145
- package/examples/tetris-package/src/components.tsx +334 -334
- package/examples/tetris-package/src/harness.tsx +34 -34
- package/examples/tetris-package/src/manifests.ts +93 -93
- package/examples/tetris-package/src/node-entry.ts +16 -16
- package/examples/tetris-package/src/sample.ts +4 -4
- package/examples/tetris-package/src/tetris-engine.ts +325 -325
- package/examples/tetris-package/tsconfig.json +15 -15
- package/package.json +12 -1
- package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
- package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
- package/dist-library/compiler-DfGbQhyD.js +0 -62
- package/dist-library/component-state-BoLCGee4.js +0 -801
- package/dist-library/component-utils-BvHL8VGt.js +0 -298
- package/dist-library/export-C7IDW9ul.js +0 -311
- package/dist-library/layout-C22VjZh0.js +0 -542
- package/dist-library/options-CdSKOi7p.js +0 -116
- package/dist-library/preset-core-CKc5YXSM.js +0 -1443
- package/dist-library/react-LY5qsVeP.js +0 -7
|
@@ -1,1443 +0,0 @@
|
|
|
1
|
-
// src/local/configuration/limits.ts
|
|
2
|
-
var e = 1e6, t = 1e4, n = 2e7, r = 1e3, i = 1e5, a = 1e4, o = 1e5, s = 2e3, c = 16, l = 2e4, u = 2e6, d = 1e3, f = 100, p = 20, m = 2e3, h = 1e4;
|
|
3
|
-
function g(e) {
|
|
4
|
-
if (e.length > 254 || /\s/.test(e)) return !1;
|
|
5
|
-
let t = e.indexOf("@");
|
|
6
|
-
if (t < 1 || t !== e.lastIndexOf("@")) return !1;
|
|
7
|
-
let n = e.lastIndexOf(".");
|
|
8
|
-
return n > t + 1 && n < e.length - 1;
|
|
9
|
-
}
|
|
10
|
-
// src/sdk/hash.ts
|
|
11
|
-
function _(e) {
|
|
12
|
-
let t = 2166136261, n = 16777619;
|
|
13
|
-
for (let r = 0; r < e.length; r += 1) {
|
|
14
|
-
let i = e.charCodeAt(r);
|
|
15
|
-
t ^= i, t = Math.imul(t, 16777619) >>> 0, n ^= i + r, n = Math.imul(n, 2246822507) >>> 0;
|
|
16
|
-
}
|
|
17
|
-
let r = e.length;
|
|
18
|
-
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")}`;
|
|
19
|
-
}
|
|
20
|
-
// src/sdk/pattern.ts
|
|
21
|
-
function v(e, t) {
|
|
22
|
-
let n = e[t];
|
|
23
|
-
if (n === "*" || n === "+" || n === "?") return { length: e[t + 1] === "?" ? 2 : 1 };
|
|
24
|
-
if (n !== "{") return null;
|
|
25
|
-
let r = /^\{(\d+)(?:,(\d*))?\}/.exec(e.slice(t));
|
|
26
|
-
return r ? { length: r[0].length + +(e[t + r[0].length] === "?") } : null;
|
|
27
|
-
}
|
|
28
|
-
function y(e) {
|
|
29
|
-
let t = [], n = !1, r = !1;
|
|
30
|
-
for (let i = 0; i < e.length; i += 1) {
|
|
31
|
-
let a = e[i];
|
|
32
|
-
if (n) {
|
|
33
|
-
n = !1;
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
if (a === "\\") {
|
|
37
|
-
let t = e[i + 1];
|
|
38
|
-
if (t !== void 0 && t >= "1" && t <= "9" || t === "k" && e[i + 2] === "<") return !1;
|
|
39
|
-
n = !0;
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (r) {
|
|
43
|
-
a === "]" && (r = !1);
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
if (a === "[") {
|
|
47
|
-
r = !0;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (a === "(") {
|
|
51
|
-
if (e[i + 1] === "?") {
|
|
52
|
-
if (e[i + 2] !== ":") return !1;
|
|
53
|
-
t.push({
|
|
54
|
-
quantified: !1,
|
|
55
|
-
alternation: !1
|
|
56
|
-
}), i += 2;
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
t.push({
|
|
60
|
-
quantified: !1,
|
|
61
|
-
alternation: !1
|
|
62
|
-
});
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (a === "|") {
|
|
66
|
-
let e = t[t.length - 1];
|
|
67
|
-
e && (e.alternation = !0);
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
if (a === ")") {
|
|
71
|
-
let n = t.pop();
|
|
72
|
-
if (!n) return !1;
|
|
73
|
-
let r = v(e, i + 1);
|
|
74
|
-
if (r && (n.quantified || n.alternation)) return !1;
|
|
75
|
-
let a = t[t.length - 1];
|
|
76
|
-
a && (a.quantified = a.quantified || n.quantified || r !== null, a.alternation = a.alternation || n.alternation), r && (i += r.length);
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
let o = v(e, i);
|
|
80
|
-
if (o) {
|
|
81
|
-
let e = t[t.length - 1];
|
|
82
|
-
e && (e.quantified = !0), i += o.length - 1;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return t.length === 0 && !n && !r;
|
|
86
|
-
}
|
|
87
|
-
// src/sdk/version.ts
|
|
88
|
-
var b = "0.7.0", x = "reactive-md-component/v1", ee = "reactive-md-config/v1", te = "reactive-md-config/v2", S = "reactive-md-preset/v1", ne = "reactive-md-react-preset/v1", re = "reactive-md-assembly/v1", ie = "reactive-md-extensions/v1", ae = 128, oe = 8, se = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/, ce = /^0\d+$/;
|
|
89
|
-
function le(e) {
|
|
90
|
-
if (e === void 0) return Object.freeze([]);
|
|
91
|
-
let t = e.split("."), n = [];
|
|
92
|
-
for (let e of t) {
|
|
93
|
-
if (e.length === 0 || ce.test(e) && e !== "0" && /^\d+$/.test(e) || /^\d+$/.test(e) && !Number.isSafeInteger(Number(e))) return null;
|
|
94
|
-
n.push(/^\d+$/.test(e) ? Number(e) : e);
|
|
95
|
-
}
|
|
96
|
-
return Object.freeze(n);
|
|
97
|
-
}
|
|
98
|
-
function C(e) {
|
|
99
|
-
let t = se.exec(e);
|
|
100
|
-
if (!t) return null;
|
|
101
|
-
let [, n, r, i, a] = t;
|
|
102
|
-
for (let e of [
|
|
103
|
-
n,
|
|
104
|
-
r,
|
|
105
|
-
i
|
|
106
|
-
]) if (e.length > 1 && e.startsWith("0") || !Number.isSafeInteger(Number(e))) return null;
|
|
107
|
-
let o = le(a);
|
|
108
|
-
return o === null ? null : {
|
|
109
|
-
major: Number(n),
|
|
110
|
-
minor: Number(r),
|
|
111
|
-
patch: Number(i),
|
|
112
|
-
prerelease: o
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
function ue(e, t) {
|
|
116
|
-
return typeof e == "number" && typeof t == "number" ? e === t ? 0 : e < t ? -1 : 1 : typeof e == "number" ? -1 : typeof t == "number" ? 1 : e === t ? 0 : e < t ? -1 : 1;
|
|
117
|
-
}
|
|
118
|
-
function de(e, t) {
|
|
119
|
-
for (let n of [
|
|
120
|
-
"major",
|
|
121
|
-
"minor",
|
|
122
|
-
"patch"
|
|
123
|
-
]) if (e[n] !== t[n]) return e[n] < t[n] ? -1 : 1;
|
|
124
|
-
if (e.prerelease.length === 0 && t.prerelease.length === 0) return 0;
|
|
125
|
-
if (e.prerelease.length === 0) return 1;
|
|
126
|
-
if (t.prerelease.length === 0) return -1;
|
|
127
|
-
let n = Math.min(e.prerelease.length, t.prerelease.length);
|
|
128
|
-
for (let r = 0; r < n; r += 1) {
|
|
129
|
-
let n = ue(e.prerelease[r], t.prerelease[r]);
|
|
130
|
-
if (n !== 0) return n;
|
|
131
|
-
}
|
|
132
|
-
return e.prerelease.length === t.prerelease.length ? 0 : e.prerelease.length < t.prerelease.length ? -1 : 1;
|
|
133
|
-
}
|
|
134
|
-
function w(e, t, n) {
|
|
135
|
-
return {
|
|
136
|
-
major: e,
|
|
137
|
-
minor: t,
|
|
138
|
-
patch: n,
|
|
139
|
-
prerelease: Object.freeze([])
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function fe(e, t) {
|
|
143
|
-
if (e === "^") {
|
|
144
|
-
let e = t.major > 0 ? w(t.major + 1, 0, 0) : t.minor > 0 ? w(0, t.minor + 1, 0) : w(0, 0, t.patch + 1);
|
|
145
|
-
return [{
|
|
146
|
-
operator: ">=",
|
|
147
|
-
version: t
|
|
148
|
-
}, {
|
|
149
|
-
operator: "<",
|
|
150
|
-
version: e
|
|
151
|
-
}];
|
|
152
|
-
}
|
|
153
|
-
return e === "~" ? [{
|
|
154
|
-
operator: ">=",
|
|
155
|
-
version: t
|
|
156
|
-
}, {
|
|
157
|
-
operator: "<",
|
|
158
|
-
version: w(t.major, t.minor + 1, 0)
|
|
159
|
-
}] : [{
|
|
160
|
-
operator: e,
|
|
161
|
-
version: t
|
|
162
|
-
}];
|
|
163
|
-
}
|
|
164
|
-
function T(e) {
|
|
165
|
-
if (typeof e != "string") return null;
|
|
166
|
-
let t = e.trim();
|
|
167
|
-
if (t.length === 0 || t.length > 128) return null;
|
|
168
|
-
let n = t.split(/\s+/);
|
|
169
|
-
if (n.length === 0 || n.length > 8) return null;
|
|
170
|
-
let r = [];
|
|
171
|
-
try {
|
|
172
|
-
for (let e of n) {
|
|
173
|
-
let t = "=", n = e;
|
|
174
|
-
e.startsWith(">=") || e.startsWith("<=") ? (t = e.slice(0, 2), n = e.slice(2)) : (e.startsWith(">") || e.startsWith("<") || e.startsWith("=") || e.startsWith("^") || e.startsWith("~")) && (t = e[0], n = e.slice(1));
|
|
175
|
-
let i = C(n);
|
|
176
|
-
if (i === null || (r.push(...fe(t, i)), r.length > 16)) return null;
|
|
177
|
-
}
|
|
178
|
-
} catch {
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
return Object.freeze({
|
|
182
|
-
source: t,
|
|
183
|
-
comparators: Object.freeze(r)
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
function E(e) {
|
|
187
|
-
return typeof e == "string" && C(e) !== null;
|
|
188
|
-
}
|
|
189
|
-
function pe(e, t) {
|
|
190
|
-
try {
|
|
191
|
-
let n = C(e);
|
|
192
|
-
if (n === null) return !1;
|
|
193
|
-
let r = typeof t == "string" ? T(t) : t;
|
|
194
|
-
if (!r || !Array.isArray(r.comparators) || r.comparators.length === 0 || n.prerelease.length && !r.comparators.some(({ version: e }) => e.prerelease.length && e.major === n.major && e.minor === n.minor && e.patch === n.patch)) return !1;
|
|
195
|
-
for (let e of r.comparators) {
|
|
196
|
-
let t = de(n, e.version);
|
|
197
|
-
switch (e.operator) {
|
|
198
|
-
case "=":
|
|
199
|
-
if (t !== 0) return !1;
|
|
200
|
-
break;
|
|
201
|
-
case ">":
|
|
202
|
-
if (t <= 0) return !1;
|
|
203
|
-
break;
|
|
204
|
-
case ">=":
|
|
205
|
-
if (t < 0) return !1;
|
|
206
|
-
break;
|
|
207
|
-
case "<":
|
|
208
|
-
if (t >= 0) return !1;
|
|
209
|
-
break;
|
|
210
|
-
case "<=":
|
|
211
|
-
if (t > 0) return !1;
|
|
212
|
-
break;
|
|
213
|
-
default: return !1;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return !0;
|
|
217
|
-
} catch {
|
|
218
|
-
return !1;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
function me(e) {
|
|
222
|
-
return typeof e == "object" && !!e && typeof e.source == "string" && Array.isArray(e.comparators);
|
|
223
|
-
}
|
|
224
|
-
// src/sdk/manifest.ts
|
|
225
|
-
var he = 64, ge = 64, _e = 128, ve = 160, ye = 64, be = 64, xe = 512, D = 4096, Se = 16, Ce = 32, we = 256, Te = 65536, O = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, k = /^[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*$/, Ee = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/, De = /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/, A = /* @__PURE__ */ new Set([
|
|
226
|
-
"__proto__",
|
|
227
|
-
"constructor",
|
|
228
|
-
"prototype"
|
|
229
|
-
]), j = /* @__PURE__ */ new WeakSet(), Oe = /* @__PURE__ */ new Set([
|
|
230
|
-
"string",
|
|
231
|
-
"number",
|
|
232
|
-
"boolean",
|
|
233
|
-
"enum"
|
|
234
|
-
]), ke = /* @__PURE__ */ new Set([
|
|
235
|
-
"leaf",
|
|
236
|
-
"inline",
|
|
237
|
-
"container"
|
|
238
|
-
]), Ae = /* @__PURE__ */ new Set([
|
|
239
|
-
"string",
|
|
240
|
-
"number",
|
|
241
|
-
"boolean",
|
|
242
|
-
"null",
|
|
243
|
-
"array",
|
|
244
|
-
"number-array"
|
|
245
|
-
]), je = /* @__PURE__ */ new Set([
|
|
246
|
-
"text",
|
|
247
|
-
"number",
|
|
248
|
-
"boolean",
|
|
249
|
-
"choice",
|
|
250
|
-
"date",
|
|
251
|
-
"timer",
|
|
252
|
-
"checklist",
|
|
253
|
-
"tabs",
|
|
254
|
-
"diagram",
|
|
255
|
-
"multi-select",
|
|
256
|
-
"selection",
|
|
257
|
-
"steps",
|
|
258
|
-
"collection"
|
|
259
|
-
]), Me = /* @__PURE__ */ new Set([
|
|
260
|
-
"empty",
|
|
261
|
-
"false",
|
|
262
|
-
"max-step",
|
|
263
|
-
"nearest-zero",
|
|
264
|
-
"min",
|
|
265
|
-
"first-option",
|
|
266
|
-
"first-tab",
|
|
267
|
-
"first-step",
|
|
268
|
-
"first-node",
|
|
269
|
-
"checked",
|
|
270
|
-
"duration",
|
|
271
|
-
"empty-array",
|
|
272
|
-
"none"
|
|
273
|
-
]), Ne = /* @__PURE__ */ new Set([
|
|
274
|
-
"none",
|
|
275
|
-
"inline",
|
|
276
|
-
"markdown"
|
|
277
|
-
]), Pe = /* @__PURE__ */ new Set([
|
|
278
|
-
"none",
|
|
279
|
-
"any",
|
|
280
|
-
"inline",
|
|
281
|
-
"content",
|
|
282
|
-
"table",
|
|
283
|
-
"plot",
|
|
284
|
-
"diagram",
|
|
285
|
-
"quiz",
|
|
286
|
-
"options",
|
|
287
|
-
"tabs",
|
|
288
|
-
"steps",
|
|
289
|
-
"components"
|
|
290
|
-
]), Fe = /* @__PURE__ */ new Set(/* @__PURE__ */ "numeric-range.text-length.date-bounds.nonempty.progress-bounds.timer-duration.option-count.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(".")), Ie = /* @__PURE__ */ new Set([
|
|
291
|
-
"none",
|
|
292
|
-
"required",
|
|
293
|
-
"optional"
|
|
294
|
-
]), Le = /* @__PURE__ */ new Set([
|
|
295
|
-
"id",
|
|
296
|
-
"name",
|
|
297
|
-
"version",
|
|
298
|
-
"protocol",
|
|
299
|
-
"form",
|
|
300
|
-
"props",
|
|
301
|
-
"bindings",
|
|
302
|
-
"children",
|
|
303
|
-
"structure",
|
|
304
|
-
"rules",
|
|
305
|
-
"slotRelations",
|
|
306
|
-
"legacyHost",
|
|
307
|
-
"capabilities",
|
|
308
|
-
"authoring",
|
|
309
|
-
"dependencies",
|
|
310
|
-
"styles",
|
|
311
|
-
"requires",
|
|
312
|
-
"replaces"
|
|
313
|
-
]), Re = /* @__PURE__ */ new Set([
|
|
314
|
-
"kind",
|
|
315
|
-
"required",
|
|
316
|
-
"static",
|
|
317
|
-
"dynamic",
|
|
318
|
-
"default",
|
|
319
|
-
"nullable",
|
|
320
|
-
"enum",
|
|
321
|
-
"values",
|
|
322
|
-
"pattern",
|
|
323
|
-
"min",
|
|
324
|
-
"max",
|
|
325
|
-
"integer",
|
|
326
|
-
"positive",
|
|
327
|
-
"color",
|
|
328
|
-
"coerce",
|
|
329
|
-
"description"
|
|
330
|
-
]), ze = /* @__PURE__ */ new Set([
|
|
331
|
-
"kind",
|
|
332
|
-
"family",
|
|
333
|
-
"bind",
|
|
334
|
-
"initial",
|
|
335
|
-
"initialRule",
|
|
336
|
-
"required",
|
|
337
|
-
"exclusive",
|
|
338
|
-
"constraints",
|
|
339
|
-
"options",
|
|
340
|
-
"maxItems",
|
|
341
|
-
"requiresAttributes",
|
|
342
|
-
"compare",
|
|
343
|
-
"retain"
|
|
344
|
-
]), Be = /* @__PURE__ */ new Set([
|
|
345
|
-
"min",
|
|
346
|
-
"max",
|
|
347
|
-
"step"
|
|
348
|
-
]), Ve = /* @__PURE__ */ new Set([
|
|
349
|
-
"interactive",
|
|
350
|
-
"static",
|
|
351
|
-
"ssr",
|
|
352
|
-
"offline"
|
|
353
|
-
]), He = /* @__PURE__ */ new Set([
|
|
354
|
-
"title",
|
|
355
|
-
"description",
|
|
356
|
-
"category",
|
|
357
|
-
"insertText"
|
|
358
|
-
]), Ue = /* @__PURE__ */ new Set(["kind", "required"]), We = /* @__PURE__ */ new Set([
|
|
359
|
-
"rule",
|
|
360
|
-
"label",
|
|
361
|
-
"parents",
|
|
362
|
-
"child",
|
|
363
|
-
"children",
|
|
364
|
-
"min",
|
|
365
|
-
"max",
|
|
366
|
-
"inlineOnly",
|
|
367
|
-
"noComponents",
|
|
368
|
-
"valueAttribute",
|
|
369
|
-
"generatedPrefix",
|
|
370
|
-
"forbidSeparator",
|
|
371
|
-
"maxItems"
|
|
372
|
-
]), Ge = /* @__PURE__ */ new Set(["id", "version"]), Ke = /* @__PURE__ */ new Set(["kernel"]), qe = /* @__PURE__ */ new Set(["id", "version"]), Je = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/, Ye = /^[A-Za-z][A-Za-z0-9]*$/, M = /* @__PURE__ */ new Set(["setMany"]), Xe = 16, Ze = 32, Qe = 16, $e = 32, et = /* @__PURE__ */ new Set([
|
|
373
|
-
"bind",
|
|
374
|
-
"initial",
|
|
375
|
-
"disabled"
|
|
376
|
-
]);
|
|
377
|
-
function N(e, t) {
|
|
378
|
-
throw Error(`Invalid local component manifest (${e}): ${t}`);
|
|
379
|
-
}
|
|
380
|
-
function tt(e) {
|
|
381
|
-
try {
|
|
382
|
-
let t = JSON.stringify(e);
|
|
383
|
-
return typeof t == "string" ? typeof TextEncoder == "function" ? new TextEncoder().encode(t).length : t.length * 2 : Infinity;
|
|
384
|
-
} catch {
|
|
385
|
-
return Infinity;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
function P(e) {
|
|
389
|
-
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
390
|
-
let t = Object.getPrototypeOf(e);
|
|
391
|
-
return t === Object.prototype || t === null;
|
|
392
|
-
}
|
|
393
|
-
function F(e, t, n) {
|
|
394
|
-
for (let r of Object.keys(e)) A.has(r) && N(n, `field "${r}" is not allowed.`), t.has(r) || N(n, `unknown field "${r}".`);
|
|
395
|
-
}
|
|
396
|
-
function I(e, t) {
|
|
397
|
-
return typeof e != "boolean" && N(t, "must be a boolean."), e;
|
|
398
|
-
}
|
|
399
|
-
function L(e, t, n = D) {
|
|
400
|
-
return typeof e != "string" && N(t, "must be a string."), e.length > n && N(t, `exceeds the ${n}-character limit.`), e;
|
|
401
|
-
}
|
|
402
|
-
function R(e, t) {
|
|
403
|
-
return typeof e == "number" && Number.isFinite(e) || N(t, "must be a finite number."), e;
|
|
404
|
-
}
|
|
405
|
-
function z(e, t) {
|
|
406
|
-
return typeof e != "string" && N(t, "must be a string."), e.length > 128 && N(t, "exceeds the 128-character limit."), O.test(e) || N(t, "must use lowercase kebab-case."), e;
|
|
407
|
-
}
|
|
408
|
-
function B(e, t) {
|
|
409
|
-
P(e) || N(t, "must be an object.");
|
|
410
|
-
let n = {}, r = Object.keys(e).sort();
|
|
411
|
-
for (let i of r) A.has(i) && N(t, `locale "${i}" is not allowed.`), De.test(i) || N(t, `locale "${i}" must look like "en" or "zh-CN".`), n[i] = L(e[i], `${t}.${i}`, 256);
|
|
412
|
-
return n;
|
|
413
|
-
}
|
|
414
|
-
function nt(e, t) {
|
|
415
|
-
P(e) || N(t, "must be an object."), F(e, He, t);
|
|
416
|
-
let n = {};
|
|
417
|
-
return e.title !== void 0 && (n.title = B(e.title, `${t}.title`)), e.description !== void 0 && (n.description = B(e.description, `${t}.description`)), e.category !== void 0 && (n.category = L(e.category, `${t}.category`, 64)), e.insertText !== void 0 && (n.insertText = L(e.insertText, `${t}.insertText`, D)), n;
|
|
418
|
-
}
|
|
419
|
-
function rt(e, t, n) {
|
|
420
|
-
P(e) || N(n, "must be an object."), F(e, Ue, n);
|
|
421
|
-
let r = e.kind;
|
|
422
|
-
typeof r == "string" && Ne.has(r) || N(`${n}.kind`, "must be \"none\", \"inline\" or \"markdown\".");
|
|
423
|
-
let i = r;
|
|
424
|
-
e.required !== void 0 && I(e.required, `${n}.required`);
|
|
425
|
-
let a = e.required === !0;
|
|
426
|
-
return t === "leaf" && i !== "none" && N(n, "a leaf component cannot declare body content."), t === "inline" && i === "markdown" && N(n, "an inline component cannot declare Markdown block content."), a && i === "none" && N(n, "cannot require body content of kind \"none\"."), {
|
|
427
|
-
kind: i,
|
|
428
|
-
...a ? { required: !0 } : {}
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
function it(e) {
|
|
432
|
-
if (e !== void 0) return e.kind === "none" ? Object.freeze({
|
|
433
|
-
rule: "none",
|
|
434
|
-
label: "none"
|
|
435
|
-
}) : e.kind === "inline" ? Object.freeze({
|
|
436
|
-
rule: "inline",
|
|
437
|
-
label: "none",
|
|
438
|
-
inlineOnly: !0,
|
|
439
|
-
noComponents: !0,
|
|
440
|
-
...e.required ? { min: 1 } : {}
|
|
441
|
-
}) : Object.freeze({
|
|
442
|
-
rule: "any",
|
|
443
|
-
label: "none",
|
|
444
|
-
...e.required ? { min: 1 } : {}
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
function V(e, t) {
|
|
448
|
-
Array.isArray(e) || N(t, "must be an array of component names."), e.length > 32 && N(t, "accepts at most 32 names.");
|
|
449
|
-
let n = /* @__PURE__ */ new Set(), r = [];
|
|
450
|
-
for (let i of e) {
|
|
451
|
-
let e = z(i, t);
|
|
452
|
-
n.has(e) && N(t, `name "${e}" is declared more than once.`), n.add(e), r.push(e);
|
|
453
|
-
}
|
|
454
|
-
return r;
|
|
455
|
-
}
|
|
456
|
-
function at(e, t) {
|
|
457
|
-
let n = R(e, t);
|
|
458
|
-
return (!Number.isInteger(n) || n < 0) && N(t, "must be a nonnegative integer."), n;
|
|
459
|
-
}
|
|
460
|
-
function ot(e, t, n) {
|
|
461
|
-
P(e) || N(n, "must be an object."), F(e, We, n);
|
|
462
|
-
let r = e.rule;
|
|
463
|
-
typeof r == "string" && Pe.has(r) || N(`${n}.rule`, "is not a supported child rule.");
|
|
464
|
-
let i = r;
|
|
465
|
-
t === "leaf" && i !== "none" && N(n, "a leaf component cannot declare body content."), t === "inline" && i !== "none" && i !== "inline" && i !== "any" && N(n, "an inline component only supports \"none\", \"inline\" or \"any\".");
|
|
466
|
-
let o = { rule: i };
|
|
467
|
-
if (e.label !== void 0 && (typeof e.label == "string" && Ie.has(e.label) || N(`${n}.label`, "must be \"none\", \"required\" or \"optional\"."), o.label = e.label), e.parents !== void 0 && (o.parents = V(e.parents, `${n}.parents`)), e.child !== void 0 && (o.child = z(e.child, `${n}.child`)), e.children !== void 0 && (o.children = V(e.children, `${n}.children`)), e.min !== void 0 && (o.min = U(e.min, `${n}.min`, a)), e.max !== void 0 && (o.max = U(e.max, `${n}.max`, a)), o.min !== void 0 && o.max !== void 0 && o.min > o.max && N(n, "\"min\" cannot exceed \"max\"."), e.inlineOnly !== void 0 && (o.inlineOnly = I(e.inlineOnly, `${n}.inlineOnly`)), e.noComponents !== void 0 && (o.noComponents = I(e.noComponents, `${n}.noComponents`)), e.valueAttribute !== void 0 && (o.valueAttribute = z(e.valueAttribute, `${n}.valueAttribute`)), e.generatedPrefix !== void 0) {
|
|
468
|
-
let t = L(e.generatedPrefix, `${n}.generatedPrefix`, 128);
|
|
469
|
-
t.length === 0 && N(`${n}.generatedPrefix`, "must not be empty."), o.generatedPrefix = t;
|
|
470
|
-
}
|
|
471
|
-
if (e.forbidSeparator !== void 0) {
|
|
472
|
-
let t = L(e.forbidSeparator, `${n}.forbidSeparator`, 4);
|
|
473
|
-
t.length === 0 && N(`${n}.forbidSeparator`, "must not be empty."), o.forbidSeparator = t;
|
|
474
|
-
}
|
|
475
|
-
return e.maxItems !== void 0 && (o.maxItems = U(e.maxItems, `${n}.maxItems`, a)), o;
|
|
476
|
-
}
|
|
477
|
-
function H(e, t) {
|
|
478
|
-
return z(e, t);
|
|
479
|
-
}
|
|
480
|
-
function st(e, t) {
|
|
481
|
-
return at(e, t);
|
|
482
|
-
}
|
|
483
|
-
function U(e, t, n) {
|
|
484
|
-
let r = at(e, t);
|
|
485
|
-
return r > n && N(t, `cannot exceed the kernel limit ${n}.`), r;
|
|
486
|
-
}
|
|
487
|
-
function W(e, t) {
|
|
488
|
-
return V(e, t);
|
|
489
|
-
}
|
|
490
|
-
function ct(e, t) {
|
|
491
|
-
return Array.isArray(e) || N(t, "must be an array of strings."), e.length > 32 && N(t, "accepts at most 32 values."), e.map((e) => L(e, t, 128));
|
|
492
|
-
}
|
|
493
|
-
function lt(e, t) {
|
|
494
|
-
P(e) || N(t, "must be an object.");
|
|
495
|
-
let n = e.kind;
|
|
496
|
-
typeof n == "string" && Fe.has(n) || N(`${t}.kind`, "is not a supported rule.");
|
|
497
|
-
let r = (n) => F(e, /* @__PURE__ */ new Set(["kind", ...n]), t), i = (n) => {
|
|
498
|
-
let r = {};
|
|
499
|
-
for (let i of n) e[i] !== void 0 && (r[i] = H(e[i], `${t}.${i}`));
|
|
500
|
-
return r;
|
|
501
|
-
};
|
|
502
|
-
switch (n) {
|
|
503
|
-
case "numeric-range": {
|
|
504
|
-
r([
|
|
505
|
-
"min",
|
|
506
|
-
"max",
|
|
507
|
-
"step",
|
|
508
|
-
"order",
|
|
509
|
-
"integer",
|
|
510
|
-
"positiveInteger"
|
|
511
|
-
]);
|
|
512
|
-
let a;
|
|
513
|
-
return e.order !== void 0 && (e.order !== "nondecreasing" && e.order !== "increasing" && N(`${t}.order`, "must be \"nondecreasing\" or \"increasing\"."), a = e.order), {
|
|
514
|
-
kind: n,
|
|
515
|
-
...i([
|
|
516
|
-
"min",
|
|
517
|
-
"max",
|
|
518
|
-
"step",
|
|
519
|
-
"integer",
|
|
520
|
-
"positiveInteger"
|
|
521
|
-
]),
|
|
522
|
-
...a ? { order: a } : {}
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
case "text-length": return r(["min", "max"]), {
|
|
526
|
-
kind: n,
|
|
527
|
-
...i(["min", "max"])
|
|
528
|
-
};
|
|
529
|
-
case "date-bounds": return r([
|
|
530
|
-
"min",
|
|
531
|
-
"max",
|
|
532
|
-
"required"
|
|
533
|
-
]), {
|
|
534
|
-
kind: n,
|
|
535
|
-
...i([
|
|
536
|
-
"min",
|
|
537
|
-
"max",
|
|
538
|
-
"required"
|
|
539
|
-
])
|
|
540
|
-
};
|
|
541
|
-
case "nonempty": return r(["attribute"]), {
|
|
542
|
-
kind: n,
|
|
543
|
-
attribute: H(e.attribute, `${t}.attribute`)
|
|
544
|
-
};
|
|
545
|
-
case "progress-bounds": return r([
|
|
546
|
-
"value",
|
|
547
|
-
"max",
|
|
548
|
-
"defaultMax"
|
|
549
|
-
]), {
|
|
550
|
-
kind: n,
|
|
551
|
-
value: H(e.value, `${t}.value`),
|
|
552
|
-
max: H(e.max, `${t}.max`),
|
|
553
|
-
defaultMax: R(e.defaultMax, `${t}.defaultMax`)
|
|
554
|
-
};
|
|
555
|
-
case "timer-duration": return r(["attribute", "default"]), {
|
|
556
|
-
kind: n,
|
|
557
|
-
attribute: H(e.attribute, `${t}.attribute`),
|
|
558
|
-
default: R(e.default, `${t}.default`)
|
|
559
|
-
};
|
|
560
|
-
case "option-count": return r(["max"]), {
|
|
561
|
-
kind: n,
|
|
562
|
-
...e.max === void 0 ? {} : { max: H(e.max, `${t}.max`) }
|
|
563
|
-
};
|
|
564
|
-
case "selection-requires": return r(["key", "attributes"]), {
|
|
565
|
-
kind: n,
|
|
566
|
-
key: H(e.key, `${t}.key`),
|
|
567
|
-
attributes: W(e.attributes, `${t}.attributes`)
|
|
568
|
-
};
|
|
569
|
-
case "inline-body": return r(["strict"]), {
|
|
570
|
-
kind: n,
|
|
571
|
-
...e.strict === void 0 ? {} : { strict: I(e.strict, `${t}.strict`) }
|
|
572
|
-
};
|
|
573
|
-
case "no-components":
|
|
574
|
-
case "math-body":
|
|
575
|
-
case "inline-math-reads": return r([]), { kind: n };
|
|
576
|
-
case "single-table": return r(["fallbackSingle"]), {
|
|
577
|
-
kind: n,
|
|
578
|
-
...e.fallbackSingle === void 0 ? {} : { fallbackSingle: I(e.fallbackSingle, `${t}.fallbackSingle`) }
|
|
579
|
-
};
|
|
580
|
-
case "options-body": return r([
|
|
581
|
-
"child",
|
|
582
|
-
"valueAttribute",
|
|
583
|
-
"unique",
|
|
584
|
-
"max",
|
|
585
|
-
"forbidSeparator"
|
|
586
|
-
]), {
|
|
587
|
-
kind: n,
|
|
588
|
-
child: H(e.child, `${t}.child`),
|
|
589
|
-
valueAttribute: H(e.valueAttribute, `${t}.valueAttribute`),
|
|
590
|
-
unique: e.unique === void 0 || I(e.unique, `${t}.unique`),
|
|
591
|
-
...e.max === void 0 ? {} : { max: U(e.max, `${t}.max`, a) },
|
|
592
|
-
...e.forbidSeparator === void 0 ? {} : { forbidSeparator: L(e.forbidSeparator, `${t}.forbidSeparator`, 4) }
|
|
593
|
-
};
|
|
594
|
-
case "value-sequence": return r([
|
|
595
|
-
"child",
|
|
596
|
-
"valueAttribute",
|
|
597
|
-
"min",
|
|
598
|
-
"generatedPrefix",
|
|
599
|
-
"unique",
|
|
600
|
-
"duplicateCode"
|
|
601
|
-
]), {
|
|
602
|
-
kind: n,
|
|
603
|
-
child: H(e.child, `${t}.child`),
|
|
604
|
-
valueAttribute: H(e.valueAttribute, `${t}.valueAttribute`),
|
|
605
|
-
min: st(e.min, `${t}.min`),
|
|
606
|
-
generatedPrefix: L(e.generatedPrefix, `${t}.generatedPrefix`, 128),
|
|
607
|
-
unique: e.unique === void 0 || I(e.unique, `${t}.unique`),
|
|
608
|
-
...e.duplicateCode === void 0 ? {} : { duplicateCode: L(e.duplicateCode, `${t}.duplicateCode`, 128) }
|
|
609
|
-
};
|
|
610
|
-
case "only-children": return r([
|
|
611
|
-
"children",
|
|
612
|
-
"min",
|
|
613
|
-
"max",
|
|
614
|
-
"maxCode",
|
|
615
|
-
"onlyCode"
|
|
616
|
-
]), {
|
|
617
|
-
kind: n,
|
|
618
|
-
children: W(e.children, `${t}.children`),
|
|
619
|
-
min: st(e.min, `${t}.min`),
|
|
620
|
-
...e.max === void 0 ? {} : { max: U(e.max, `${t}.max`, a) },
|
|
621
|
-
...e.maxCode === void 0 ? {} : { maxCode: L(e.maxCode, `${t}.maxCode`, 128) },
|
|
622
|
-
...e.onlyCode === void 0 ? {} : { onlyCode: L(e.onlyCode, `${t}.onlyCode`, 128) }
|
|
623
|
-
};
|
|
624
|
-
case "diagram-body": return r([
|
|
625
|
-
"node",
|
|
626
|
-
"edge",
|
|
627
|
-
"id",
|
|
628
|
-
"from",
|
|
629
|
-
"to",
|
|
630
|
-
"label"
|
|
631
|
-
]), {
|
|
632
|
-
kind: n,
|
|
633
|
-
node: H(e.node, `${t}.node`),
|
|
634
|
-
edge: H(e.edge, `${t}.edge`),
|
|
635
|
-
id: H(e.id, `${t}.id`),
|
|
636
|
-
from: H(e.from, `${t}.from`),
|
|
637
|
-
to: H(e.to, `${t}.to`),
|
|
638
|
-
...e.label === void 0 ? {} : { label: H(e.label, `${t}.label`) }
|
|
639
|
-
};
|
|
640
|
-
case "quiz-body": return r([
|
|
641
|
-
"type",
|
|
642
|
-
"answer",
|
|
643
|
-
"tolerance",
|
|
644
|
-
"child",
|
|
645
|
-
"valueAttribute",
|
|
646
|
-
"max"
|
|
647
|
-
]), {
|
|
648
|
-
kind: n,
|
|
649
|
-
type: H(e.type, `${t}.type`),
|
|
650
|
-
answer: H(e.answer, `${t}.answer`),
|
|
651
|
-
tolerance: H(e.tolerance, `${t}.tolerance`),
|
|
652
|
-
child: H(e.child, `${t}.child`),
|
|
653
|
-
valueAttribute: H(e.valueAttribute, `${t}.valueAttribute`),
|
|
654
|
-
...e.max === void 0 ? {} : { max: U(e.max, `${t}.max`, a) }
|
|
655
|
-
};
|
|
656
|
-
case "checklist-body": return r(["itemLimit"]), {
|
|
657
|
-
kind: n,
|
|
658
|
-
itemLimit: U(e.itemLimit, `${t}.itemLimit`, a)
|
|
659
|
-
};
|
|
660
|
-
case "dynamic-constraints":
|
|
661
|
-
case "require-full-interpolation": return r(["attributes"]), {
|
|
662
|
-
kind: n,
|
|
663
|
-
attributes: W(e.attributes, `${t}.attributes`)
|
|
664
|
-
};
|
|
665
|
-
case "scoped-expressions": return r(["attributes", "scope"]), e.scope !== "row" && e.scope !== "validation" && N(`${t}.scope`, "must be \"row\" or \"validation\"."), {
|
|
666
|
-
kind: n,
|
|
667
|
-
attributes: W(e.attributes, `${t}.attributes`),
|
|
668
|
-
scope: e.scope
|
|
669
|
-
};
|
|
670
|
-
case "row-values": return r([
|
|
671
|
-
"rows",
|
|
672
|
-
"key",
|
|
673
|
-
"child",
|
|
674
|
-
"childValue"
|
|
675
|
-
]), {
|
|
676
|
-
kind: n,
|
|
677
|
-
rows: H(e.rows, `${t}.rows`),
|
|
678
|
-
key: H(e.key, `${t}.key`),
|
|
679
|
-
child: H(e.child, `${t}.child`),
|
|
680
|
-
childValue: H(e.childValue, `${t}.childValue`)
|
|
681
|
-
};
|
|
682
|
-
case "validation-rule": return r([
|
|
683
|
-
"when",
|
|
684
|
-
"fields",
|
|
685
|
-
"message",
|
|
686
|
-
"placement",
|
|
687
|
-
"max"
|
|
688
|
-
]), e.placement !== "container" && e.placement !== "prose" && N(`${t}.placement`, "must be \"container\" or \"prose\"."), {
|
|
689
|
-
kind: n,
|
|
690
|
-
when: H(e.when, `${t}.when`),
|
|
691
|
-
fields: H(e.fields, `${t}.fields`),
|
|
692
|
-
message: H(e.message, `${t}.message`),
|
|
693
|
-
placement: e.placement,
|
|
694
|
-
max: U(e.max, `${t}.max`, 100)
|
|
695
|
-
};
|
|
696
|
-
case "anchor": return r(["id"]), {
|
|
697
|
-
kind: n,
|
|
698
|
-
id: H(e.id, `${t}.id`)
|
|
699
|
-
};
|
|
700
|
-
case "navigation": return r(["target"]), {
|
|
701
|
-
kind: n,
|
|
702
|
-
target: H(e.target, `${t}.target`)
|
|
703
|
-
};
|
|
704
|
-
case "data-table": return r([
|
|
705
|
-
"rows",
|
|
706
|
-
"key",
|
|
707
|
-
"child",
|
|
708
|
-
"childValue",
|
|
709
|
-
"label",
|
|
710
|
-
"maxRows",
|
|
711
|
-
"defaultMaxRows",
|
|
712
|
-
"documentRows",
|
|
713
|
-
"documentCells",
|
|
714
|
-
"maxColumns"
|
|
715
|
-
]), {
|
|
716
|
-
kind: n,
|
|
717
|
-
rows: H(e.rows, `${t}.rows`),
|
|
718
|
-
key: H(e.key, `${t}.key`),
|
|
719
|
-
child: H(e.child, `${t}.child`),
|
|
720
|
-
childValue: H(e.childValue, `${t}.childValue`),
|
|
721
|
-
label: H(e.label, `${t}.label`),
|
|
722
|
-
maxRows: H(e.maxRows, `${t}.maxRows`),
|
|
723
|
-
defaultMaxRows: U(e.defaultMaxRows, `${t}.defaultMaxRows`, d),
|
|
724
|
-
documentRows: U(e.documentRows, `${t}.documentRows`, m),
|
|
725
|
-
documentCells: U(e.documentCells, `${t}.documentCells`, h),
|
|
726
|
-
maxColumns: U(e.maxColumns, `${t}.maxColumns`, 20)
|
|
727
|
-
};
|
|
728
|
-
case "plot-math": return r([
|
|
729
|
-
"min",
|
|
730
|
-
"max",
|
|
731
|
-
"samples",
|
|
732
|
-
"samplesAlias",
|
|
733
|
-
"curves",
|
|
734
|
-
"points"
|
|
735
|
-
]), {
|
|
736
|
-
kind: n,
|
|
737
|
-
min: H(e.min, `${t}.min`),
|
|
738
|
-
max: H(e.max, `${t}.max`),
|
|
739
|
-
samples: H(e.samples, `${t}.samples`),
|
|
740
|
-
...e.samplesAlias === void 0 ? {} : { samplesAlias: H(e.samplesAlias, `${t}.samplesAlias`) },
|
|
741
|
-
curves: U(e.curves, `${t}.curves`, 16),
|
|
742
|
-
points: U(e.points, `${t}.points`, l)
|
|
743
|
-
};
|
|
744
|
-
case "chart-table": return r([
|
|
745
|
-
"chartKind",
|
|
746
|
-
"x",
|
|
747
|
-
"y"
|
|
748
|
-
]), {
|
|
749
|
-
kind: n,
|
|
750
|
-
chartKind: H(e.chartKind, `${t}.chartKind`),
|
|
751
|
-
x: H(e.x, `${t}.x`),
|
|
752
|
-
y: H(e.y, `${t}.y`)
|
|
753
|
-
};
|
|
754
|
-
case "timeline-table": return r(["headerSets"]), Array.isArray(e.headerSets) || N(`${t}.headerSets`, "must be an array."), {
|
|
755
|
-
kind: n,
|
|
756
|
-
headerSets: e.headerSets.map((e, n) => ct(e, `${t}.headerSets[${n}]`))
|
|
757
|
-
};
|
|
758
|
-
case "table-selection": return r(["key", "bindings"]), {
|
|
759
|
-
kind: n,
|
|
760
|
-
key: H(e.key, `${t}.key`),
|
|
761
|
-
bindings: W(e.bindings, `${t}.bindings`)
|
|
762
|
-
};
|
|
763
|
-
case "retain": return r(["value"]), {
|
|
764
|
-
kind: n,
|
|
765
|
-
value: I(e.value, `${t}.value`)
|
|
766
|
-
};
|
|
767
|
-
case "self-binding-read": return r(["mode", "attribute"]), e.mode !== "always" && e.mode !== "attribute" && N(`${t}.mode`, "must be \"always\" or \"attribute\"."), {
|
|
768
|
-
kind: n,
|
|
769
|
-
mode: e.mode,
|
|
770
|
-
...e.attribute === void 0 ? {} : { attribute: H(e.attribute, `${t}.attribute`) }
|
|
771
|
-
};
|
|
772
|
-
case "value-date": return r([
|
|
773
|
-
"min",
|
|
774
|
-
"max",
|
|
775
|
-
"required"
|
|
776
|
-
]), {
|
|
777
|
-
kind: n,
|
|
778
|
-
...i([
|
|
779
|
-
"min",
|
|
780
|
-
"max",
|
|
781
|
-
"required"
|
|
782
|
-
])
|
|
783
|
-
};
|
|
784
|
-
case "value-length": return r([
|
|
785
|
-
"min",
|
|
786
|
-
"max",
|
|
787
|
-
"email",
|
|
788
|
-
"emailType"
|
|
789
|
-
]), {
|
|
790
|
-
kind: n,
|
|
791
|
-
...i([
|
|
792
|
-
"min",
|
|
793
|
-
"max",
|
|
794
|
-
"email"
|
|
795
|
-
]),
|
|
796
|
-
...e.emailType === void 0 ? {} : { emailType: L(e.emailType, `${t}.emailType`, 128) }
|
|
797
|
-
};
|
|
798
|
-
case "value-required": return r(["required"]), {
|
|
799
|
-
kind: n,
|
|
800
|
-
required: H(e.required, `${t}.required`)
|
|
801
|
-
};
|
|
802
|
-
case "value-email": return r(["type", "value"]), {
|
|
803
|
-
kind: n,
|
|
804
|
-
...i(["type"]),
|
|
805
|
-
...e.value === void 0 ? {} : { value: L(e.value, `${t}.value`, 128) }
|
|
806
|
-
};
|
|
807
|
-
default: N(`${t}.kind`, "is not a supported rule.");
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
function ut(e) {
|
|
811
|
-
Array.isArray(e) || N("rules", "must be an array."), e.length > 32 && N("rules", "accepts at most 32 rules.");
|
|
812
|
-
let t = [];
|
|
813
|
-
for (let n = 0; n < e.length; n += 1) t.push(lt(e[n], `rules[${n}]`));
|
|
814
|
-
return t;
|
|
815
|
-
}
|
|
816
|
-
function dt(e) {
|
|
817
|
-
Array.isArray(e) || N("slotRelations", "must be an array."), e.length > 16 && N("slotRelations", "accepts at most 16 relations.");
|
|
818
|
-
let t = [];
|
|
819
|
-
for (let n = 0; n < e.length; n += 1) {
|
|
820
|
-
let r = e[n], i = `slotRelations[${n}]`;
|
|
821
|
-
P(r) || N(i, "must be an object."), F(r, /* @__PURE__ */ new Set(["lower", "upper"]), i), t.push({
|
|
822
|
-
lower: z(r.lower, `${i}.lower`),
|
|
823
|
-
upper: z(r.upper, `${i}.upper`)
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
return t;
|
|
827
|
-
}
|
|
828
|
-
function ft(e, t) {
|
|
829
|
-
P(e) || N(t, "must be an object."), F(e, Ve, t);
|
|
830
|
-
let n = (n) => e[n] !== void 0 && I(e[n], `${t}.${n}`);
|
|
831
|
-
return {
|
|
832
|
-
interactive: n("interactive"),
|
|
833
|
-
static: n("static"),
|
|
834
|
-
ssr: n("ssr"),
|
|
835
|
-
offline: n("offline")
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
function pt(e, t) {
|
|
839
|
-
P(e) || N(t, "must be an object."), F(e, Re, t);
|
|
840
|
-
let n = e.kind;
|
|
841
|
-
typeof n == "string" && Oe.has(n) || N(`${t}.kind`, "must be \"string\", \"number\", \"boolean\" or \"enum\".");
|
|
842
|
-
let r = n, i = { kind: r };
|
|
843
|
-
for (let n of [
|
|
844
|
-
"required",
|
|
845
|
-
"static",
|
|
846
|
-
"dynamic",
|
|
847
|
-
"integer",
|
|
848
|
-
"positive",
|
|
849
|
-
"color",
|
|
850
|
-
"nullable"
|
|
851
|
-
]) e[n] !== void 0 && (i[n] = I(e[n], `${t}.${n}`));
|
|
852
|
-
i.static === !0 && i.dynamic === !0 && N(t, "cannot be both static and dynamic."), e.coerce !== void 0 && (e.coerce !== "text" && N(`${t}.coerce`, "must be \"text\"."), r !== "string" && N(`${t}.coerce`, "is only valid for kind \"string\"."), i.coerce = "text");
|
|
853
|
-
let a = e.enum === void 0 ? e.values : e.enum, o = a !== void 0;
|
|
854
|
-
if (r !== "enum") o && N(t, `"enum" is only valid for kind "enum", not "${r}".`);
|
|
855
|
-
else {
|
|
856
|
-
e.enum !== void 0 && e.values !== void 0 && N(t, "use \"enum\" or \"values\", not both."), Array.isArray(a) && a.length !== 0 || N(`${t}.enum`, "must be a non-empty string array."), a.length > 64 && N(`${t}.enum`, "accepts at most 64 values.");
|
|
857
|
-
let n = /* @__PURE__ */ new Set(), r = [];
|
|
858
|
-
for (let e of a) {
|
|
859
|
-
let i = L(e, `${t}.enum`, 128);
|
|
860
|
-
n.has(i) && N(`${t}.enum`, `value "${i}" is declared more than once.`), n.add(i), r.push(i);
|
|
861
|
-
}
|
|
862
|
-
i.enum = r;
|
|
863
|
-
}
|
|
864
|
-
let s = e.pattern !== void 0;
|
|
865
|
-
if (r !== "string") s && N(t, `"pattern" is only valid for kind "string", not "${r}".`);
|
|
866
|
-
else if (s) {
|
|
867
|
-
typeof e.pattern != "string" && N(`${t}.pattern`, "must be a string."), e.pattern.length > 512 && N(`${t}.pattern`, "exceeds the 512-character limit.");
|
|
868
|
-
try {
|
|
869
|
-
new RegExp(e.pattern);
|
|
870
|
-
} catch {
|
|
871
|
-
N(`${t}.pattern`, "is not a valid regular expression.");
|
|
872
|
-
}
|
|
873
|
-
y(e.pattern) || N(`${t}.pattern`, "uses unsupported regex syntax; nested quantifiers, quantified alternation, backreferences and lookarounds are rejected."), i.pattern = e.pattern;
|
|
874
|
-
}
|
|
875
|
-
let c = e.min !== void 0, l = e.max !== void 0;
|
|
876
|
-
if (r === "number" ? (c && (i.min = R(e.min, `${t}.min`)), l && (i.max = R(e.max, `${t}.max`)), i.min !== void 0 && i.max !== void 0 && i.min > i.max && N(t, "\"min\" cannot exceed \"max\".")) : ((c || l) && N(t, "\"min\" and \"max\" are only valid for kind \"number\"."), i.integer === !0 && N(t, "\"integer\" is only valid for kind \"number\"."), i.positive === !0 && N(t, "\"positive\" is only valid for kind \"number\".")), i.color === !0 && r !== "string" && N(t, "\"color\" is only valid for kind \"string\"."), e.description !== void 0 && (i.description = B(e.description, `${t}.description`)), e.default !== void 0) {
|
|
877
|
-
let n = e.default;
|
|
878
|
-
if (n === null) i.nullable !== !0 && N(`${t}.default`, "is null but the prop is not nullable."), i.default = null;
|
|
879
|
-
else if (r === "string") i.default = L(n, `${t}.default`);
|
|
880
|
-
else if (r === "number") {
|
|
881
|
-
let e = R(n, `${t}.default`);
|
|
882
|
-
i.integer === !0 && !Number.isInteger(e) && N(`${t}.default`, "must be an integer."), i.positive === !0 && !(e > 0) && N(`${t}.default`, "must be greater than zero."), i.min !== void 0 && e < i.min && N(`${t}.default`, `is below the minimum ${i.min}.`), i.max !== void 0 && e > i.max && N(`${t}.default`, `exceeds the maximum ${i.max}.`), i.default = e;
|
|
883
|
-
} else if (r === "boolean") i.default = I(n, `${t}.default`);
|
|
884
|
-
else {
|
|
885
|
-
let e = L(n, `${t}.default`, 128);
|
|
886
|
-
i.enum?.includes(e) || N(`${t}.default`, `"${e}" is not an allowed enum value.`), i.default = e;
|
|
887
|
-
}
|
|
888
|
-
if (i.pattern !== void 0 && r === "string" && typeof i.default == "string") {
|
|
889
|
-
let e = !0;
|
|
890
|
-
try {
|
|
891
|
-
e = new RegExp(i.pattern).test(i.default);
|
|
892
|
-
} catch {
|
|
893
|
-
e = !1;
|
|
894
|
-
}
|
|
895
|
-
e || N(`${t}.default`, `does not match pattern ${i.pattern}.`);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
return i;
|
|
899
|
-
}
|
|
900
|
-
function mt(e, t) {
|
|
901
|
-
P(e) || N(t, "must be an object with \"literal\" or \"prop\".");
|
|
902
|
-
let n = Object.keys(e);
|
|
903
|
-
n.length !== 1 && N(t, "must contain exactly one of \"literal\" or \"prop\".");
|
|
904
|
-
let r = n[0];
|
|
905
|
-
if (A.has(r) && N(t, `field "${r}" is not allowed.`), r === "literal") return { literal: R(e.literal, `${t}.literal`) };
|
|
906
|
-
if (r === "prop") return { prop: z(e.prop, `${t}.prop`) };
|
|
907
|
-
N(t, `unknown field "${r}"; use "literal" or "prop".`);
|
|
908
|
-
}
|
|
909
|
-
function ht(e, t, n, r) {
|
|
910
|
-
P(e) || N(r, "must be an object."), F(e, Be, r);
|
|
911
|
-
let i = {};
|
|
912
|
-
for (let n of [
|
|
913
|
-
"min",
|
|
914
|
-
"max",
|
|
915
|
-
"step"
|
|
916
|
-
]) {
|
|
917
|
-
if (e[n] === void 0) continue;
|
|
918
|
-
let a = mt(e[n], `${r}.${n}`);
|
|
919
|
-
if ("prop" in a) {
|
|
920
|
-
let e = t[a.prop];
|
|
921
|
-
e === void 0 && N(`${r}.${n}`, `references undeclared prop "${a.prop}".`), e.kind !== "number" && N(`${r}.${n}`, `references prop "${a.prop}", which is not a number.`);
|
|
922
|
-
}
|
|
923
|
-
n === "step" && "literal" in a && !(a.literal > 0) && N(`${r}.step`, "must be greater than 0."), i[n] = a;
|
|
924
|
-
}
|
|
925
|
-
return n !== "number" && (i.min || i.max || i.step) && N(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 && N(r, "\"min\" cannot exceed \"max\"."), i;
|
|
926
|
-
}
|
|
927
|
-
function gt(e, t) {
|
|
928
|
-
if (e === "number") return t === "timer" ? /* @__PURE__ */ new Set([
|
|
929
|
-
"duration",
|
|
930
|
-
"min",
|
|
931
|
-
"nearest-zero"
|
|
932
|
-
]) : /* @__PURE__ */ new Set([
|
|
933
|
-
"min",
|
|
934
|
-
"nearest-zero",
|
|
935
|
-
"max-step"
|
|
936
|
-
]);
|
|
937
|
-
if (e === "boolean") return /* @__PURE__ */ new Set(["false"]);
|
|
938
|
-
if (e === "null") return /* @__PURE__ */ new Set(["empty"]);
|
|
939
|
-
if (e === "array") return t === "checklist" ? /* @__PURE__ */ new Set(["checked", "empty-array"]) : /* @__PURE__ */ new Set(["empty-array"]);
|
|
940
|
-
if (e === "number-array") return /* @__PURE__ */ new Set(["empty-array"]);
|
|
941
|
-
switch (t) {
|
|
942
|
-
case "choice":
|
|
943
|
-
case "selection": return /* @__PURE__ */ new Set(["first-option", "none"]);
|
|
944
|
-
case "tabs": return /* @__PURE__ */ new Set(["first-tab"]);
|
|
945
|
-
case "steps": return /* @__PURE__ */ new Set(["first-step"]);
|
|
946
|
-
case "diagram": return /* @__PURE__ */ new Set(["first-node"]);
|
|
947
|
-
case "date": return /* @__PURE__ */ new Set(["empty"]);
|
|
948
|
-
default: return /* @__PURE__ */ new Set(["empty"]);
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
function _t(e, t, n, r = !1) {
|
|
952
|
-
P(e) || N(n, "must be an object."), F(e, ze, n);
|
|
953
|
-
let i = e.kind;
|
|
954
|
-
typeof i == "string" && Ae.has(i) || N(`${n}.kind`, "must be \"string\", \"number\", \"boolean\", \"array\", \"number-array\" or \"null\".");
|
|
955
|
-
let a = i, o = e.family;
|
|
956
|
-
typeof o == "string" && je.has(o) || N(`${n}.family`, "must be a supported binding family.");
|
|
957
|
-
let s = o;
|
|
958
|
-
({
|
|
959
|
-
number: /* @__PURE__ */ new Set(["number", "timer"]),
|
|
960
|
-
boolean: /* @__PURE__ */ new Set(["boolean"]),
|
|
961
|
-
string: /* @__PURE__ */ new Set([
|
|
962
|
-
"text",
|
|
963
|
-
"choice",
|
|
964
|
-
"date",
|
|
965
|
-
"tabs",
|
|
966
|
-
"diagram",
|
|
967
|
-
"steps",
|
|
968
|
-
"selection"
|
|
969
|
-
]),
|
|
970
|
-
array: /* @__PURE__ */ new Set([
|
|
971
|
-
"multi-select",
|
|
972
|
-
"checklist",
|
|
973
|
-
"collection"
|
|
974
|
-
]),
|
|
975
|
-
"number-array": /* @__PURE__ */ new Set(["collection"]),
|
|
976
|
-
null: /* @__PURE__ */ new Set(["text"])
|
|
977
|
-
})[a]?.has(s) || N(`${n}.family`, `"${s}" is not supported for a ${a} binding.`);
|
|
978
|
-
let c;
|
|
979
|
-
if (e.options !== void 0) {
|
|
980
|
-
a !== "string" && N(`${n}.options`, "is only valid for a string binding."), s !== "choice" && N(`${n}.options`, "requires family \"choice\".");
|
|
981
|
-
let t = e.options;
|
|
982
|
-
Array.isArray(t) && t.length !== 0 || N(`${n}.options`, "must be a non-empty string array."), t.length > 64 && N(`${n}.options`, "accepts at most 64 values.");
|
|
983
|
-
let r = /* @__PURE__ */ new Set(), i = [];
|
|
984
|
-
for (let e of t) {
|
|
985
|
-
let t = L(e, `${n}.options`, 128);
|
|
986
|
-
t.length === 0 && N(`${n}.options`, "values must be non-empty."), r.has(t) && N(`${n}.options`, `value "${t}" is declared more than once.`), r.add(t), i.push(t);
|
|
987
|
-
}
|
|
988
|
-
c = i;
|
|
989
|
-
}
|
|
990
|
-
a === "string" && s === "choice" && c === void 0 && !r && N(`${n}.options`, "is required for a choice binding."), s !== "choice" && c !== void 0 && N(`${n}.options`, "is only valid for family \"choice\".");
|
|
991
|
-
let l = z(e.bind, `${n}.bind`), u = z(e.initial, `${n}.initial`);
|
|
992
|
-
l === u && N(n, "\"bind\" and \"initial\" must name different attributes."), (M.has(l) || M.has(u)) && N(n, "binding attributes cannot use a reserved slot name."), (Object.hasOwn(t, l) || Object.hasOwn(t, u)) && N(n, "binding attributes are reserved and cannot be declared as props.");
|
|
993
|
-
let d = gt(a, s), f;
|
|
994
|
-
if (e.initialRule === void 0) switch (a) {
|
|
995
|
-
case "number":
|
|
996
|
-
f = s === "timer" ? "duration" : "nearest-zero";
|
|
997
|
-
break;
|
|
998
|
-
case "boolean":
|
|
999
|
-
f = "false";
|
|
1000
|
-
break;
|
|
1001
|
-
case "array":
|
|
1002
|
-
f = s === "checklist" ? "checked" : "empty-array";
|
|
1003
|
-
break;
|
|
1004
|
-
case "number-array":
|
|
1005
|
-
f = "empty-array";
|
|
1006
|
-
break;
|
|
1007
|
-
case "null":
|
|
1008
|
-
f = "empty";
|
|
1009
|
-
break;
|
|
1010
|
-
default: f = s === "choice" ? "first-option" : s === "tabs" ? "first-tab" : s === "steps" ? "first-step" : s === "diagram" ? "first-node" : s === "selection" ? "none" : "empty";
|
|
1011
|
-
}
|
|
1012
|
-
else typeof e.initialRule == "string" && Me.has(e.initialRule) || N(`${n}.initialRule`, "is not a supported initial rule."), f = e.initialRule;
|
|
1013
|
-
d.has(f) || N(`${n}.initialRule`, `is not supported for a ${a} ${s} binding.`), e.required !== void 0 && I(e.required, `${n}.required`), e.exclusive !== void 0 && I(e.exclusive, `${n}.exclusive`), e.retain !== void 0 && I(e.retain, `${n}.retain`);
|
|
1014
|
-
let p;
|
|
1015
|
-
e.constraints !== void 0 && (p = ht(e.constraints, t, a, `${n}.constraints`));
|
|
1016
|
-
let m;
|
|
1017
|
-
if (e.maxItems !== void 0) {
|
|
1018
|
-
if (a !== "array" && a !== "number-array" && N(`${n}.maxItems`, "is only valid for array or number-array bindings."), m = mt(e.maxItems, `${n}.maxItems`), "prop" in m) {
|
|
1019
|
-
let e = t[m.prop];
|
|
1020
|
-
e === void 0 && N(`${n}.maxItems`, `references undeclared prop "${m.prop}".`), e.kind !== "number" && N(`${n}.maxItems`, `references prop "${m.prop}", which is not a number.`), e.dynamic === !0 && N(`${n}.maxItems`, "requires a static numeric property.");
|
|
1021
|
-
} else (!Number.isInteger(m.literal) || m.literal < 0) && N(`${n}.maxItems`, "must be a nonnegative integer.");
|
|
1022
|
-
}
|
|
1023
|
-
let h;
|
|
1024
|
-
if (e.requiresAttributes !== void 0) {
|
|
1025
|
-
h = V(e.requiresAttributes, `${n}.requiresAttributes`);
|
|
1026
|
-
for (let e of h) Object.hasOwn(t, e) || N(`${n}.requiresAttributes`, `references undeclared prop "${e}".`);
|
|
1027
|
-
}
|
|
1028
|
-
let g;
|
|
1029
|
-
if (e.compare !== void 0) {
|
|
1030
|
-
g = V(e.compare, `${n}.compare`);
|
|
1031
|
-
for (let e of g) Object.hasOwn(t, e) || N(`${n}.compare`, `references undeclared prop "${e}".`);
|
|
1032
|
-
}
|
|
1033
|
-
return {
|
|
1034
|
-
kind: a,
|
|
1035
|
-
family: s,
|
|
1036
|
-
bind: l,
|
|
1037
|
-
initial: u,
|
|
1038
|
-
initialRule: f,
|
|
1039
|
-
...e.required === !0 ? { required: !0 } : {},
|
|
1040
|
-
...e.exclusive === !0 ? { exclusive: !0 } : {},
|
|
1041
|
-
...c ? { options: c } : {},
|
|
1042
|
-
...p ? { constraints: p } : {},
|
|
1043
|
-
...m ? { maxItems: m } : {},
|
|
1044
|
-
...h ? { requiresAttributes: h } : {},
|
|
1045
|
-
...g ? { compare: g } : {},
|
|
1046
|
-
...e.retain === !1 ? { retain: !1 } : {}
|
|
1047
|
-
};
|
|
1048
|
-
}
|
|
1049
|
-
function vt(e, t) {
|
|
1050
|
-
P(e) || N(t, "must be an object."), F(e, Ge, t);
|
|
1051
|
-
let n = e.id;
|
|
1052
|
-
(typeof n != "string" || !k.test(n) || n.length > 160) && N(`${t}.id`, "must be a lowercase namespaced id.");
|
|
1053
|
-
let r;
|
|
1054
|
-
if (e.version !== void 0) {
|
|
1055
|
-
let n = e.version, i = T(n);
|
|
1056
|
-
i === null && N(`${t}.version`, "must be an exact version or a supported range (exact, ^, ~, >=, <=, >, <)."), r = i.source;
|
|
1057
|
-
}
|
|
1058
|
-
return {
|
|
1059
|
-
id: n,
|
|
1060
|
-
...r ? { version: r } : {}
|
|
1061
|
-
};
|
|
1062
|
-
}
|
|
1063
|
-
function yt(e) {
|
|
1064
|
-
P(e) || N("requires", "must be an object."), F(e, Ke, "requires");
|
|
1065
|
-
let t;
|
|
1066
|
-
if (e.kernel !== void 0) {
|
|
1067
|
-
let n = T(e.kernel);
|
|
1068
|
-
n === null && N("requires.kernel", "must be a supported kernel version range (exact, ^, ~, >=, <=, >, <)."), t = n.source;
|
|
1069
|
-
}
|
|
1070
|
-
return { ...t ? { kernel: t } : {} };
|
|
1071
|
-
}
|
|
1072
|
-
function bt(e, t) {
|
|
1073
|
-
P(e) || N("replaces", "must be an object."), F(e, qe, "replaces");
|
|
1074
|
-
let n = e.id;
|
|
1075
|
-
(typeof n != "string" || !k.test(n) || n.length > 160) && N("replaces.id", "must be a lowercase namespaced id."), n !== t && N("replaces.id", "must equal the declaring manifest id.");
|
|
1076
|
-
let r;
|
|
1077
|
-
if (e.version !== void 0) {
|
|
1078
|
-
let t = T(e.version);
|
|
1079
|
-
t === null && N("replaces.version", "must be an exact version or a supported range (exact, ^, ~, >=, <=, >, <)."), r = t.source;
|
|
1080
|
-
}
|
|
1081
|
-
return {
|
|
1082
|
-
id: n,
|
|
1083
|
-
...r ? { version: r } : {}
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
function xt(e) {
|
|
1087
|
-
Array.isArray(e) || N("styles", "must be an array of style-resource ids."), e.length > 32 && N("styles", "accepts at most 32 resources.");
|
|
1088
|
-
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1089
|
-
for (let r = 0; r < e.length; r += 1) {
|
|
1090
|
-
let i = e[r];
|
|
1091
|
-
(typeof i != "string" || i.length === 0 || i.length > 256) && N(`styles[${r}]`, "must be a non-empty string of at most 256 characters."), Je.test(i) || N(`styles[${r}]`, "must be a bounded resource id."), t.has(i) && N("styles", `resource "${i}" is declared more than once.`), t.add(i), n.push(i);
|
|
1092
|
-
}
|
|
1093
|
-
return n;
|
|
1094
|
-
}
|
|
1095
|
-
function G(e) {
|
|
1096
|
-
if (typeof e == "object" && e && j.has(e)) return e;
|
|
1097
|
-
P(e) || N("manifest", "must be an object."), F(e, Le, "manifest");
|
|
1098
|
-
let t = e.id;
|
|
1099
|
-
(typeof t != "string" || t.length > 160 || !k.test(t)) && N("id", "must be a lowercase namespaced id such as \"example/rating\".");
|
|
1100
|
-
let n = z(e.name, "name"), r = e.version;
|
|
1101
|
-
(typeof r != "string" || r.length > 64 || !Ee.test(r)) && N("version", "must be a semantic version such as 1.0.0."), e.protocol !== "reactive-md-component/v1" && N("protocol", `must be "${x}".`);
|
|
1102
|
-
let i = e.form;
|
|
1103
|
-
typeof i == "string" && ke.has(i) || N("form", "must be \"leaf\", \"inline\" or \"container\".");
|
|
1104
|
-
let a = i;
|
|
1105
|
-
P(e.props) || N("props", "must be an object.");
|
|
1106
|
-
let o = Object.keys(e.props).sort();
|
|
1107
|
-
o.length > 64 && N("props", "accepts at most 64 properties.");
|
|
1108
|
-
let s = {};
|
|
1109
|
-
for (let t of o) A.has(t) && N("props", `property "${t}" is not allowed.`), (!O.test(t) || t.length > 128) && N("props", `property "${t}" must use lowercase kebab-case.`), s[t] = pt(e.props[t], `props.${t}`);
|
|
1110
|
-
let c;
|
|
1111
|
-
if (e.bindings !== void 0) {
|
|
1112
|
-
P(e.bindings) || N("bindings", "must be an object.");
|
|
1113
|
-
let t = Object.keys(e.bindings);
|
|
1114
|
-
t.length === 0 && N("bindings", "must declare at least one binding slot."), t.length > 16 && N("bindings", "accepts at most 16 slots.");
|
|
1115
|
-
let n = {}, r = /* @__PURE__ */ new Set();
|
|
1116
|
-
for (let i of t) {
|
|
1117
|
-
A.has(i) && N("bindings", `field "${i}" is not allowed.`), Ye.test(i) || N("bindings", `slot "${i}" must be a letter followed by letters or digits.`), M.has(i) && N("bindings", `slot "${i}" is reserved by the runtime.`);
|
|
1118
|
-
let t = _t(e.bindings[i], s, `bindings.${i}`, a === "container" && Array.isArray(e.rules) && e.rules.some((e) => P(e) && e.kind === "options-body"));
|
|
1119
|
-
i !== "value" && (t.kind !== "number" || t.family !== "number") && N(`bindings.${i}`, "numeric named slots support kind \"number\" with family \"number\" in this contract."), i !== "value" && P(e.bindings[i]) && e.bindings[i].exclusive === !1 && N(`bindings.${i}.exclusive`, "named slots require exclusive ownership in this contract.");
|
|
1120
|
-
for (let e of [t.bind, t.initial]) r.has(e) && N("bindings", `attribute "${e}" is claimed by more than one binding.`), r.add(e);
|
|
1121
|
-
n[i] = i === "value" ? t : {
|
|
1122
|
-
...t,
|
|
1123
|
-
exclusive: !0
|
|
1124
|
-
};
|
|
1125
|
-
}
|
|
1126
|
-
c = n;
|
|
1127
|
-
}
|
|
1128
|
-
let l = e.children === void 0 ? void 0 : rt(e.children, a, "children");
|
|
1129
|
-
e.children !== void 0 && e.structure !== void 0 && N("manifest", "cannot declare both \"children\" and \"structure\"; use \"structure\".");
|
|
1130
|
-
let u = e.structure === void 0 ? it(l) : ot(e.structure, a, "structure"), d = e.rules === void 0 ? void 0 : ut(e.rules), f = e.slotRelations === void 0 ? void 0 : dt(e.slotRelations);
|
|
1131
|
-
e.legacyHost !== void 0 && I(e.legacyHost, "legacyHost");
|
|
1132
|
-
let p = ft(e.capabilities, "capabilities"), m = e.authoring === void 0 ? void 0 : nt(e.authoring, "authoring"), h = e.styles === void 0 ? void 0 : xt(e.styles), g = e.requires === void 0 ? void 0 : yt(e.requires), _ = e.replaces === void 0 ? void 0 : bt(e.replaces, t), v;
|
|
1133
|
-
if (e.dependencies !== void 0) {
|
|
1134
|
-
Array.isArray(e.dependencies) || N("dependencies", "must be an array."), e.dependencies.length > 16 && N("dependencies", "accepts at most 16 entries.");
|
|
1135
|
-
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1136
|
-
for (let r = 0; r < e.dependencies.length; r += 1) {
|
|
1137
|
-
let i = vt(e.dependencies[r], `dependencies[${r}]`);
|
|
1138
|
-
t.has(i.id) && N("dependencies", `"${i.id}" is declared more than once.`), t.add(i.id), n.push(i);
|
|
1139
|
-
}
|
|
1140
|
-
v = n;
|
|
1141
|
-
}
|
|
1142
|
-
let y = {
|
|
1143
|
-
id: t,
|
|
1144
|
-
name: n,
|
|
1145
|
-
version: r,
|
|
1146
|
-
protocol: x,
|
|
1147
|
-
form: a,
|
|
1148
|
-
props: s,
|
|
1149
|
-
...c ? { bindings: c } : {},
|
|
1150
|
-
...l ? { children: l } : {},
|
|
1151
|
-
...u && !l ? { structure: u } : {},
|
|
1152
|
-
...d ? { rules: d } : {},
|
|
1153
|
-
...f ? { slotRelations: f } : {},
|
|
1154
|
-
...e.legacyHost === !0 ? { legacyHost: !0 } : {},
|
|
1155
|
-
capabilities: p,
|
|
1156
|
-
...m ? { authoring: m } : {},
|
|
1157
|
-
...h ? { styles: h } : {},
|
|
1158
|
-
...g ? { requires: g } : {},
|
|
1159
|
-
...v ? { dependencies: v } : {},
|
|
1160
|
-
..._ ? { replaces: _ } : {}
|
|
1161
|
-
};
|
|
1162
|
-
tt(y) > 65536 && N("manifest", `serialized size exceeds the ${Te}-byte budget.`);
|
|
1163
|
-
let b = Ct(y);
|
|
1164
|
-
return j.add(b), b;
|
|
1165
|
-
}
|
|
1166
|
-
function St(e) {
|
|
1167
|
-
return G(e);
|
|
1168
|
-
}
|
|
1169
|
-
function Ct(e) {
|
|
1170
|
-
if (typeof e != "object" || !e) return e;
|
|
1171
|
-
for (let t of Object.keys(e)) Ct(e[t]);
|
|
1172
|
-
return Object.freeze(e);
|
|
1173
|
-
}
|
|
1174
|
-
function wt(e) {
|
|
1175
|
-
return {
|
|
1176
|
-
kind: e.kind,
|
|
1177
|
-
...e.required === !0 ? { required: !0 } : {},
|
|
1178
|
-
...e.static === !0 ? { static: !0 } : {},
|
|
1179
|
-
...e.dynamic === void 0 ? {} : { dynamic: e.dynamic },
|
|
1180
|
-
...e.default === void 0 ? {} : { default: e.default },
|
|
1181
|
-
...e.nullable === !0 ? { nullable: !0 } : {},
|
|
1182
|
-
...e.enum ? { enum: [...e.enum] } : {},
|
|
1183
|
-
...e.pattern === void 0 ? {} : { pattern: e.pattern },
|
|
1184
|
-
...e.min === void 0 ? {} : { min: e.min },
|
|
1185
|
-
...e.max === void 0 ? {} : { max: e.max },
|
|
1186
|
-
...e.integer === !0 ? { integer: !0 } : {},
|
|
1187
|
-
...e.positive === !0 ? { positive: !0 } : {},
|
|
1188
|
-
...e.color === !0 ? { color: !0 } : {},
|
|
1189
|
-
...e.coerce === void 0 ? {} : { coerce: e.coerce }
|
|
1190
|
-
};
|
|
1191
|
-
}
|
|
1192
|
-
function K(e) {
|
|
1193
|
-
return "literal" in e ? { literal: e.literal } : { prop: e.prop };
|
|
1194
|
-
}
|
|
1195
|
-
function Tt(e) {
|
|
1196
|
-
return {
|
|
1197
|
-
...e.min ? { min: K(e.min) } : {},
|
|
1198
|
-
...e.max ? { max: K(e.max) } : {},
|
|
1199
|
-
...e.step ? { step: K(e.step) } : {}
|
|
1200
|
-
};
|
|
1201
|
-
}
|
|
1202
|
-
function Et(e) {
|
|
1203
|
-
let t = e.constraints;
|
|
1204
|
-
return {
|
|
1205
|
-
kind: e.kind,
|
|
1206
|
-
family: e.family,
|
|
1207
|
-
bind: e.bind,
|
|
1208
|
-
initial: e.initial,
|
|
1209
|
-
initialRule: e.initialRule,
|
|
1210
|
-
...e.required === !0 ? { required: !0 } : {},
|
|
1211
|
-
...e.exclusive === !0 ? { exclusive: !0 } : {},
|
|
1212
|
-
...e.options ? { options: [...e.options] } : {},
|
|
1213
|
-
...t ? { constraints: Tt(t) } : {},
|
|
1214
|
-
...e.maxItems ? { maxItems: K(e.maxItems) } : {},
|
|
1215
|
-
...e.requiresAttributes ? { requiresAttributes: [...e.requiresAttributes] } : {},
|
|
1216
|
-
...e.compare ? { compare: [...e.compare] } : {},
|
|
1217
|
-
...e.retain === !1 ? { retain: !1 } : {}
|
|
1218
|
-
};
|
|
1219
|
-
}
|
|
1220
|
-
function Dt(e) {
|
|
1221
|
-
return {
|
|
1222
|
-
rule: e.rule,
|
|
1223
|
-
...e.label === void 0 ? {} : { label: e.label },
|
|
1224
|
-
...e.parents ? { parents: [...e.parents] } : {},
|
|
1225
|
-
...e.child === void 0 ? {} : { child: e.child },
|
|
1226
|
-
...e.children ? { children: [...e.children] } : {},
|
|
1227
|
-
...e.min === void 0 ? {} : { min: e.min },
|
|
1228
|
-
...e.max === void 0 ? {} : { max: e.max },
|
|
1229
|
-
...e.inlineOnly === void 0 ? {} : { inlineOnly: e.inlineOnly },
|
|
1230
|
-
...e.noComponents === void 0 ? {} : { noComponents: e.noComponents },
|
|
1231
|
-
...e.valueAttribute === void 0 ? {} : { valueAttribute: e.valueAttribute },
|
|
1232
|
-
...e.generatedPrefix === void 0 ? {} : { generatedPrefix: e.generatedPrefix },
|
|
1233
|
-
...e.forbidSeparator === void 0 ? {} : { forbidSeparator: e.forbidSeparator },
|
|
1234
|
-
...e.maxItems === void 0 ? {} : { maxItems: e.maxItems }
|
|
1235
|
-
};
|
|
1236
|
-
}
|
|
1237
|
-
function Ot(e) {
|
|
1238
|
-
let t = e, n = Object.keys(t).sort(), r = {};
|
|
1239
|
-
for (let e of n) {
|
|
1240
|
-
let n = t[e];
|
|
1241
|
-
r[e] = Array.isArray(n) ? n.map((e) => Array.isArray(e) ? [...e] : e) : n;
|
|
1242
|
-
}
|
|
1243
|
-
return r;
|
|
1244
|
-
}
|
|
1245
|
-
function kt(e) {
|
|
1246
|
-
let t = {};
|
|
1247
|
-
for (let n of Object.keys(e.props).sort()) t[n] = wt(e.props[n]);
|
|
1248
|
-
let n = {};
|
|
1249
|
-
if (e.bindings) for (let t of Object.keys(e.bindings).sort()) n[t] = Et(e.bindings[t]);
|
|
1250
|
-
return {
|
|
1251
|
-
protocol: e.protocol,
|
|
1252
|
-
id: e.id,
|
|
1253
|
-
name: e.name,
|
|
1254
|
-
version: e.version,
|
|
1255
|
-
form: e.form,
|
|
1256
|
-
props: t,
|
|
1257
|
-
...e.bindings ? { bindings: n } : {},
|
|
1258
|
-
...e.children ? { children: {
|
|
1259
|
-
kind: e.children.kind,
|
|
1260
|
-
...e.children.required ? { required: !0 } : {}
|
|
1261
|
-
} } : {},
|
|
1262
|
-
...e.structure ? { structure: Dt(e.structure) } : {},
|
|
1263
|
-
...e.rules ? { rules: e.rules.map(Ot) } : {},
|
|
1264
|
-
...e.slotRelations ? { slotRelations: e.slotRelations.map((e) => ({ ...e })) } : {},
|
|
1265
|
-
capabilities: {
|
|
1266
|
-
interactive: e.capabilities.interactive,
|
|
1267
|
-
static: e.capabilities.static,
|
|
1268
|
-
ssr: e.capabilities.ssr,
|
|
1269
|
-
offline: e.capabilities.offline
|
|
1270
|
-
},
|
|
1271
|
-
...e.styles ? { styles: [...e.styles] } : {},
|
|
1272
|
-
...e.requires?.kernel ? { requires: { kernel: e.requires.kernel } } : {},
|
|
1273
|
-
...e.dependencies ? { dependencies: [...e.dependencies].map((e) => ({ ...e })).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)) } : {},
|
|
1274
|
-
...e.replaces ? { replaces: {
|
|
1275
|
-
id: e.replaces.id,
|
|
1276
|
-
...e.replaces.version ? { version: e.replaces.version } : {}
|
|
1277
|
-
} } : {}
|
|
1278
|
-
};
|
|
1279
|
-
}
|
|
1280
|
-
var At = /* @__PURE__ */ new WeakMap();
|
|
1281
|
-
function q(e) {
|
|
1282
|
-
let t = j.has(e) ? e : G(e), n = At.get(t);
|
|
1283
|
-
if (n !== void 0) return n;
|
|
1284
|
-
let r = _(JSON.stringify(kt(t)));
|
|
1285
|
-
return At.set(t, r), r;
|
|
1286
|
-
}
|
|
1287
|
-
function jt(e) {
|
|
1288
|
-
return Object.freeze({
|
|
1289
|
-
id: e.id,
|
|
1290
|
-
name: e.name,
|
|
1291
|
-
version: e.version,
|
|
1292
|
-
digest: q(e)
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
function Mt(e) {
|
|
1296
|
-
return typeof e == "string" && e.length <= 128 && O.test(e);
|
|
1297
|
-
}
|
|
1298
|
-
function J(e) {
|
|
1299
|
-
return typeof e == "string" && e.length > 0 && e.length <= 160 && k.test(e);
|
|
1300
|
-
}
|
|
1301
|
-
// src/presets/identity.ts
|
|
1302
|
-
var Nt = "reactive-md/default", Pt = "reactive-md/minimal", Ft = b, It = 160, Lt = 256, Rt = 32, zt = 256, Bt = 4096, Vt = /^[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*$/, Ht = /* @__PURE__ */ new Set([
|
|
1303
|
-
"__proto__",
|
|
1304
|
-
"constructor",
|
|
1305
|
-
"prototype"
|
|
1306
|
-
]), Ut = /* @__PURE__ */ new Set([
|
|
1307
|
-
"protocol",
|
|
1308
|
-
"id",
|
|
1309
|
-
"version",
|
|
1310
|
-
"components",
|
|
1311
|
-
"authoring",
|
|
1312
|
-
"themes",
|
|
1313
|
-
"dependencies",
|
|
1314
|
-
"metadata"
|
|
1315
|
-
]), Wt = /* @__PURE__ */ new Set([
|
|
1316
|
-
"title",
|
|
1317
|
-
"description",
|
|
1318
|
-
"category",
|
|
1319
|
-
"insertText"
|
|
1320
|
-
]), Gt = /* @__PURE__ */ new Set(["title", "description"]), Kt = /* @__PURE__ */ new Set(["id", "version"]), qt = /* @__PURE__ */ new WeakSet();
|
|
1321
|
-
function Y(e, t) {
|
|
1322
|
-
throw Error(`Invalid local preset (${e}): ${t}`);
|
|
1323
|
-
}
|
|
1324
|
-
function X(e) {
|
|
1325
|
-
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
1326
|
-
let t = Object.getPrototypeOf(e);
|
|
1327
|
-
return t === Object.prototype || t === null;
|
|
1328
|
-
}
|
|
1329
|
-
function Z(e, t, n) {
|
|
1330
|
-
for (let r of Object.keys(e)) Ht.has(r) && Y(n, `field "${r}" is not allowed.`), t.has(r) || Y(n, `unknown field "${r}".`);
|
|
1331
|
-
}
|
|
1332
|
-
function Q(e, t) {
|
|
1333
|
-
X(e) || Y(t, "must be a locale-keyed string map.");
|
|
1334
|
-
let n = {};
|
|
1335
|
-
for (let r of Object.keys(e).sort()) {
|
|
1336
|
-
Ht.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".`);
|
|
1337
|
-
let i = e[r];
|
|
1338
|
-
(typeof i != "string" || i.length > Bt) && Y(t, `locale "${r}" must be a bounded string.`), n[r] = i;
|
|
1339
|
-
}
|
|
1340
|
-
return Object.freeze(n);
|
|
1341
|
-
}
|
|
1342
|
-
function Jt(e) {
|
|
1343
|
-
X(e) || Y("authoring", "must be an object."), Z(e, Wt, "authoring");
|
|
1344
|
-
let t = {};
|
|
1345
|
-
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 > Bt) && Y("authoring.insertText", "must be a bounded string."), t.insertText = e.insertText), Object.freeze(t);
|
|
1346
|
-
}
|
|
1347
|
-
function Yt(e, t) {
|
|
1348
|
-
Array.isArray(e) || Y("authoring", "must be an array."), e.length > zt && Y("authoring", `accepts at most ${zt} entries.`);
|
|
1349
|
-
let n = new Set(t.map((e) => e.id)), r = /* @__PURE__ */ new Set(), i = [];
|
|
1350
|
-
for (let t = 0; t < e.length; t += 1) {
|
|
1351
|
-
let a = e[t];
|
|
1352
|
-
X(a) || Y(`authoring[${t}]`, "must be an object."), Z(a, /* @__PURE__ */ new Set(["componentId", "authoring"]), `authoring[${t}]`);
|
|
1353
|
-
let o = a.componentId;
|
|
1354
|
-
typeof o == "string" && J(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({
|
|
1355
|
-
componentId: o,
|
|
1356
|
-
authoring: Jt(a.authoring)
|
|
1357
|
-
}));
|
|
1358
|
-
}
|
|
1359
|
-
return Object.freeze(i.sort((e, t) => e.componentId < t.componentId ? -1 : +(e.componentId > t.componentId)));
|
|
1360
|
-
}
|
|
1361
|
-
function Xt(e) {
|
|
1362
|
-
Array.isArray(e) || Y("dependencies", "must be an array."), e.length > Rt && Y("dependencies", `accepts at most ${Rt} entries.`);
|
|
1363
|
-
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1364
|
-
for (let r = 0; r < e.length; r += 1) {
|
|
1365
|
-
let i = e[r];
|
|
1366
|
-
X(i) || Y(`dependencies[${r}]`, "must be an object."), Z(i, Kt, `dependencies[${r}]`);
|
|
1367
|
-
let a = i.id;
|
|
1368
|
-
typeof a == "string" && J(a) || Y(`dependencies[${r}].id`, "must be a lowercase namespaced id."), t.has(a) && Y("dependencies", `"${a}" is declared more than once.`), t.add(a);
|
|
1369
|
-
let o = i.version;
|
|
1370
|
-
typeof o == "string" && E(o) || Y(`dependencies[${r}].version`, "must be an exact semantic version."), n.push(Object.freeze({
|
|
1371
|
-
id: a,
|
|
1372
|
-
version: o
|
|
1373
|
-
}));
|
|
1374
|
-
}
|
|
1375
|
-
return Object.freeze(n.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
|
|
1376
|
-
}
|
|
1377
|
-
function Zt(e) {
|
|
1378
|
-
Array.isArray(e) || Y("themes", "must be an array.");
|
|
1379
|
-
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
1380
|
-
for (let i = 0; i < e.length; i += 1) {
|
|
1381
|
-
let a = e[i];
|
|
1382
|
-
X(a) || Y(`themes[${i}]`, "must be an object.");
|
|
1383
|
-
let o = a.id, s = a.name, c = a.version;
|
|
1384
|
-
(typeof o != "string" || o.length === 0) && Y(`themes[${i}].id`, "must be a non-empty string."), (typeof s != "string" || s.length === 0) && Y(`themes[${i}].name`, "must be a non-empty string."), typeof c == "string" && E(c) || Y(`themes[${i}].version`, "must be a semantic version."), n.has(o) && Y("themes", `theme id "${o}" is declared more than once.`), r.has(s) && Y("themes", `theme name "${s}" is declared more than once.`), n.add(o), r.add(s), t.push(Object.freeze({ ...a }));
|
|
1385
|
-
}
|
|
1386
|
-
return Object.freeze(t.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
|
|
1387
|
-
}
|
|
1388
|
-
function Qt(e) {
|
|
1389
|
-
return X(e) || Y("metadata", "must be an object."), Z(e, Gt, "metadata"), Object.freeze({
|
|
1390
|
-
...e.title === void 0 ? {} : { title: Q(e.title, "metadata.title") },
|
|
1391
|
-
...e.description === void 0 ? {} : { description: Q(e.description, "metadata.description") }
|
|
1392
|
-
});
|
|
1393
|
-
}
|
|
1394
|
-
function $(e) {
|
|
1395
|
-
if (X(e) && qt.has(e)) return e;
|
|
1396
|
-
X(e) || Y("preset", "must be an object."), Z(e, Ut, "preset"), e.protocol !== "reactive-md-preset/v1" && Y("protocol", `must be "${S}".`);
|
|
1397
|
-
let t = e.id;
|
|
1398
|
-
(typeof t != "string" || t.length > It || !Vt.test(t)) && Y("id", "must be a lowercase namespaced id.");
|
|
1399
|
-
let n = e.version;
|
|
1400
|
-
typeof n == "string" && E(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 > Lt && Y("components", `accepts at most ${Lt} components.`);
|
|
1401
|
-
let r = [], i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
1402
|
-
for (let t = 0; t < e.components.length; t += 1) {
|
|
1403
|
-
let n;
|
|
1404
|
-
try {
|
|
1405
|
-
n = St(e.components[t]);
|
|
1406
|
-
} catch (e) {
|
|
1407
|
-
Y(`components[${t}]`, e instanceof Error ? e.message : String(e));
|
|
1408
|
-
}
|
|
1409
|
-
i.has(n.id) && Y("components", `component id "${n.id}" is declared more than once.`), a.has(n.name) && Y("components", `component name "${n.name}" is declared more than once.`), i.add(n.id), a.add(n.name), r.push(n);
|
|
1410
|
-
}
|
|
1411
|
-
let o = e.authoring === void 0 ? void 0 : Yt(e.authoring, r), s = e.themes === void 0 ? void 0 : Zt(e.themes), c = e.dependencies === void 0 ? void 0 : Xt(e.dependencies), l = e.metadata === void 0 ? void 0 : Qt(e.metadata), u = e.components, d = Object.isFrozen(u) && u.length === r.length && u.every((e, t) => e === r[t]) ? u : Object.freeze(r), f = Object.freeze({
|
|
1412
|
-
protocol: S,
|
|
1413
|
-
id: t,
|
|
1414
|
-
version: n,
|
|
1415
|
-
components: d,
|
|
1416
|
-
...o ? { authoring: o } : {},
|
|
1417
|
-
...s ? { themes: s } : {},
|
|
1418
|
-
...c ? { dependencies: c } : {},
|
|
1419
|
-
...l ? { metadata: l } : {}
|
|
1420
|
-
});
|
|
1421
|
-
return qt.add(f), f;
|
|
1422
|
-
}
|
|
1423
|
-
function $t(e) {
|
|
1424
|
-
return $(e);
|
|
1425
|
-
}
|
|
1426
|
-
function en(e) {
|
|
1427
|
-
let t = $(e);
|
|
1428
|
-
return _(JSON.stringify({
|
|
1429
|
-
protocol: S,
|
|
1430
|
-
id: t.id,
|
|
1431
|
-
version: t.version,
|
|
1432
|
-
components: [...t.components].map((e) => ({
|
|
1433
|
-
id: e.id,
|
|
1434
|
-
version: e.version,
|
|
1435
|
-
digest: q(e)
|
|
1436
|
-
})).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)),
|
|
1437
|
-
dependencies: [...t.dependencies ?? []].map((e) => ({
|
|
1438
|
-
id: e.id,
|
|
1439
|
-
version: e.version
|
|
1440
|
-
})).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id))
|
|
1441
|
-
}));
|
|
1442
|
-
}
|
|
1443
|
-
export { a as $, tt as A, b as B, ye as C, Mt as D, J as E, ee as F, pe as G, ae as H, te as I, _ as J, T as K, ie as L, G as M, re as N, q as O, x as P, t as Q, S as R, we as S, St as T, E as U, oe as V, me as W, r as X, f as Y, n as Z, Ze as _, Ft as a, e as at, $e as b, Xe as c, u as ct, be as d, g as dt, h as et, ve as f, ge as g, xe as h, Nt as i, s as it, it as j, jt as k, he as l, i as lt, _e as m, en as n, p as nt, Pt as o, c as ot, Te as p, y as q, $ as r, d as rt, et as s, l as st, $t as t, m as tt, Se as u, o as ut, Qe as v, kt as w, Ce as x, D as y, ne as z };
|