reactive-md 0.9.2 → 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 +397 -333
- package/CHANGELOG.md +398 -334
- 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 +0 -57
- package/bin/reactive-md.mjs +39 -39
- package/cli/args.mjs +263 -263
- package/cli/assets.mjs +395 -395
- package/cli/build.mjs +445 -445
- 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 +325 -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-CP2QG86k.js +114 -0
- package/dist-library/{LocalDocumentViewCore-DXE0I0Qc.js → LocalDocumentViewCore-Cd6yMEkg.js} +379 -9445
- package/dist-library/LocalReactiveDocumentCore-VuYpZqdn.js +283 -0
- package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
- package/dist-library/authoring-Bwu_zCWs.js +768 -0
- package/dist-library/chart-B1TUtzm-.js +3 -0
- package/dist-library/choice-values-BItGjPD2.js +58 -0
- package/dist-library/color-values-r8Wf7ALn.js +6 -0
- package/dist-library/compile-B35rfzKr.js +1742 -0
- package/dist-library/compile-cache-key-D21X2Obx.js +28 -0
- package/dist-library/compiler-DBwLawMZ.js +98 -0
- package/dist-library/{compiler-core-DDDdvuLy.js → compiler-core-kkDiQ1RK.js} +4202 -3496
- package/dist-library/component-kernel-CsJSabHX.js +372 -0
- package/dist-library/{component-state-BRwvTV0d.js → component-state-Da0G8Ajc.js} +1 -1
- package/dist-library/component-utils-ZM3jUJNy.js +339 -0
- package/dist-library/conditional-branches-CIhJXasR.js +17 -0
- package/dist-library/config-validation-DbmsWAEV.js +469 -0
- package/dist-library/controls-DRy5rzzN.js +5970 -0
- package/dist-library/controls-DWlx-AQl.js +3 -0
- package/dist-library/{coordinate-B1VFK9fd.js → coordinate-c54pHfgf.js} +89 -89
- package/dist-library/data-BtFlkJzp.js +3 -0
- package/dist-library/data-table-CSAkm1eU.js +290 -0
- package/dist-library/data-table-model-DruztQFt.js +391 -0
- package/dist-library/data-visuals-rZQUeQM0.js +384 -0
- package/dist-library/{default-components-s21NevON.js → default-components-B-39etG9.js} +518 -355
- package/dist-library/{config-DXLvctiZ.js → default-config-CCa8rm2k.js} +265 -230
- package/dist-library/default-options-By16CVw1.js +131 -0
- package/dist-library/{registry-D6OGkOcX.js → default-registry-DXJy66xj.js} +4 -4
- package/dist-library/default-schema-CeYiEW1K.js +33 -0
- package/dist-library/diagram-BLepzI8l.js +3 -0
- package/dist-library/display-Bb6hAG5T.js +2065 -0
- package/dist-library/dist-Cueh1Psp.js +4761 -0
- package/dist-library/{document-theme-C8J6UyNO.js → document-theme-CJvN-nC1.js} +246 -4
- package/dist-library/{export-CIAIPBov.js → export-BSV4E0jv.js} +135 -135
- package/dist-library/font-aliases-CKYjwn4o.js +4 -0
- package/dist-library/gallery-BC6FYTqw.js +3 -0
- package/dist-library/{gallery-Dv1rOvL0.js → gallery-DM2yTVZJ.js} +1 -1
- package/dist-library/{html-Cr4CBwAH.js → html-CY9mC3Sr.js} +49 -48
- package/dist-library/{incremental-9nx92u9c.js → incremental-B-wW4H3F.js} +537 -384
- package/dist-library/{display-B_uutKkN.js → katex-4ukd4ZxT.js} +1555 -3618
- package/dist-library/layout-CPQggKxk.js +592 -0
- package/dist-library/layout-CaDWsDof.js +3 -0
- package/dist-library/limits-CFERRrlC.js +10 -0
- package/dist-library/localization-COdJ6lw2.js +6 -0
- package/dist-library/mafs-CnzDC5CR.js +3 -0
- package/dist-library/math-view-CyGTS6kv.js +20 -0
- package/dist-library/motion-tokens-Czk0RDmS.js +283 -0
- package/dist-library/mount-preset-DtrCX4G8.js +24 -0
- package/dist-library/numeric-sliders-BmJ1LCLx.js +542 -0
- package/dist-library/{observability-4KqXhIEU.js → observability-BVQ16ByQ.js} +125 -43
- package/dist-library/package-core-Cu_r_qs7.js +128 -0
- package/dist-library/parser-BHl9Lxbw.js +8 -0
- package/dist-library/parser-standard-DDAKv_DZ.js +4872 -0
- package/dist-library/plugin-packs-CkI0floL.js +19 -0
- package/dist-library/preset-core-BKPbH_Nv.js +1371 -0
- package/dist-library/props-0iDqxlTk.js +174 -0
- package/dist-library/react-74jdGBmu.js +32 -0
- package/dist-library/reactive-md-authoring.js +315 -296
- package/dist-library/reactive-md-build.js +334 -43
- package/dist-library/reactive-md-compiler-session.js +4 -0
- 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 +6 -0
- package/dist-library/reactive-md-default-packs.js +32 -15
- package/dist-library/reactive-md-default-preset.js +7 -7
- package/dist-library/reactive-md-export.js +6 -5
- package/dist-library/reactive-md-minimal-preset.js +3 -2
- package/dist-library/reactive-md-minimal-react-preset.js +26 -23
- package/dist-library/reactive-md-minimal.css +1 -1
- package/dist-library/reactive-md-observability.js +125 -3
- package/dist-library/reactive-md-pack-style-manifest.js +805 -0
- package/dist-library/reactive-md-plugin-chart.js +14 -9
- package/dist-library/reactive-md-plugin-data.js +8 -8
- package/dist-library/reactive-md-plugin-diagram.js +7 -6
- package/dist-library/reactive-md-plugin-forms.js +14 -13
- package/dist-library/reactive-md-plugin-gallery.js +6 -5
- package/dist-library/reactive-md-plugin-navigation.js +8 -8
- package/dist-library/reactive-md-plugin-network.js +13 -13
- package/dist-library/reactive-md-plugin-plot.js +7 -6
- package/dist-library/reactive-md-print.css +304 -304
- package/dist-library/reactive-md-react-component-accordion.js +10 -0
- package/dist-library/reactive-md-react-component-alert.js +10 -0
- package/dist-library/reactive-md-react-component-anchor.js +10 -0
- package/dist-library/reactive-md-react-component-badge.js +10 -0
- package/dist-library/reactive-md-react-component-card.js +10 -0
- package/dist-library/reactive-md-react-component-chart.js +22 -0
- package/dist-library/reactive-md-react-component-checkbox.js +10 -0
- package/dist-library/reactive-md-react-component-checklist.js +10 -0
- package/dist-library/reactive-md-react-component-choices.js +10 -0
- package/dist-library/reactive-md-react-component-column.js +6 -0
- package/dist-library/reactive-md-react-component-coordinate.js +21 -0
- package/dist-library/reactive-md-react-component-counter.js +10 -0
- package/dist-library/reactive-md-react-component-data-table.js +14 -0
- package/dist-library/reactive-md-react-component-date.js +10 -0
- package/dist-library/reactive-md-react-component-diagram.js +22 -0
- package/dist-library/reactive-md-react-component-disclosure.js +10 -0
- package/dist-library/reactive-md-react-component-edge.js +22 -0
- package/dist-library/reactive-md-react-component-else.js +10 -0
- package/dist-library/reactive-md-react-component-gallery-item.js +10 -0
- package/dist-library/reactive-md-react-component-gallery.js +10 -0
- package/dist-library/reactive-md-react-component-grid.js +10 -0
- package/dist-library/reactive-md-react-component-if.js +10 -0
- package/dist-library/reactive-md-react-component-input.js +10 -0
- package/dist-library/reactive-md-react-component-jump.js +10 -0
- package/dist-library/reactive-md-react-component-multi-select.js +10 -0
- package/dist-library/reactive-md-react-component-node.js +22 -0
- package/dist-library/reactive-md-react-component-number.js +10 -0
- package/dist-library/reactive-md-react-component-option.js +10 -0
- package/dist-library/reactive-md-react-component-panel.js +10 -0
- package/dist-library/reactive-md-react-component-plot.js +26 -0
- package/dist-library/reactive-md-react-component-progress.js +10 -0
- package/dist-library/reactive-md-react-component-quiz.js +10 -0
- package/dist-library/reactive-md-react-component-radio-group.js +10 -0
- package/dist-library/reactive-md-react-component-range-slider.js +10 -0
- package/dist-library/reactive-md-react-component-section.js +10 -0
- package/dist-library/reactive-md-react-component-select.js +10 -0
- package/dist-library/reactive-md-react-component-slider.js +10 -0
- package/dist-library/reactive-md-react-component-step.js +10 -0
- package/dist-library/reactive-md-react-component-steps.js +10 -0
- package/dist-library/reactive-md-react-component-tab.js +10 -0
- package/dist-library/reactive-md-react-component-table.js +14 -0
- package/dist-library/reactive-md-react-component-tabs.js +10 -0
- package/dist-library/reactive-md-react-component-text.js +10 -0
- package/dist-library/reactive-md-react-component-textarea.js +10 -0
- package/dist-library/reactive-md-react-component-timeline.js +14 -0
- package/dist-library/reactive-md-react-component-timer.js +10 -0
- package/dist-library/reactive-md-react-component-toggle.js +10 -0
- package/dist-library/reactive-md-react-component-tooltip.js +10 -0
- package/dist-library/reactive-md-react-component-validation.js +10 -0
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-pack-controls.js +44 -0
- package/dist-library/reactive-md-react-pack-data.js +21 -0
- package/dist-library/reactive-md-react-pack-layout.js +37 -0
- package/dist-library/reactive-md-react-pack-visuals.js +43 -0
- package/dist-library/reactive-md-react-packed.js +50 -0
- package/dist-library/reactive-md-react-server.js +29 -27
- package/dist-library/reactive-md-react-static-server.js +24 -0
- package/dist-library/reactive-md-react-static.js +1 -0
- package/dist-library/reactive-md-react-unstyled.js +15 -12
- package/dist-library/reactive-md-react.js +15 -12
- package/dist-library/reactive-md-scan.js +1 -0
- 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 +32 -32
- package/dist-library/reactive-md-testing.js +12 -12
- package/dist-library/reactive-md-vite.js +25 -9
- package/dist-library/reactive-md-worker-pool.js +401 -0
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +97 -1554
- package/dist-library/registry-core-DxEaxhJ6.js +126 -0
- package/dist-library/render-nodes-B6j6Ip5I.js +9404 -0
- package/dist-library/requirements-C56sFIEs.js +157 -0
- package/dist-library/resources-6VaNgk-h.js +74 -0
- package/dist-library/rmd-pack-controls.css +1032 -0
- package/dist-library/rmd-pack-data.css +724 -0
- package/dist-library/rmd-pack-layout.css +1834 -0
- package/dist-library/rmd-pack-resource-chart.css +300 -0
- package/dist-library/rmd-pack-resource-controls.css +781 -0
- package/dist-library/rmd-pack-resource-data-visuals.css +501 -0
- package/dist-library/rmd-pack-resource-diagram.css +106 -0
- package/dist-library/rmd-pack-resource-gallery.css +346 -0
- package/dist-library/rmd-pack-resource-graphics.css +516 -0
- package/dist-library/rmd-pack-resource-layout.css +1489 -0
- package/dist-library/rmd-pack-resource-mafs-core.css +124 -0
- package/dist-library/rmd-pack-resource-mafs.css +129 -0
- package/dist-library/rmd-pack-resource-visual-base.css +224 -0
- package/dist-library/rmd-pack-visuals.css +1394 -0
- package/dist-library/runtime-BHeuLOv_.js +1369 -0
- package/dist-library/runtime-requirement-DzPO8raU.js +772 -0
- package/dist-library/schema-core-CDXfxdID.js +155 -0
- package/dist-library/sdk-core-CnE-n0Z7.js +1295 -0
- package/dist-library/{session-core-dxQCJBNa.js → session-core-C071yQwV.js} +147 -133
- package/dist-library/sha256-utf16-Bmandi_H.js +937 -0
- package/dist-library/shareable-CHCDnl6j.js +844 -0
- package/dist-library/shared-bTzN-F4g.js +3 -0
- package/dist-library/structural-views-30-YD_TJ.js +11 -0
- package/dist-library/table-surface-CfZn_tk-.js +13 -0
- package/dist-library/types/assemblies/compile-cache-key.d.ts +11 -0
- package/dist-library/types/assemblies/default-config.d.ts +35 -0
- package/dist-library/types/{local/configuration/options.d.ts → assemblies/default-options.d.ts} +4 -4
- package/dist-library/types/assemblies/default-registry.d.ts +18 -0
- package/dist-library/types/{local/configuration/schema.d.ts → assemblies/default-schema.d.ts} +4 -4
- package/dist-library/types/authoring/catalog.d.ts +14 -2
- package/dist-library/types/authoring/extensions.d.ts +1 -1
- package/dist-library/types/authoring/index.d.ts +4 -4
- package/dist-library/types/authoring/templates.d.ts +1 -1
- package/dist-library/types/compiler/index.d.ts +1 -0
- package/dist-library/types/compiler/session.d.ts +19 -0
- package/dist-library/types/compiler/standard.d.ts +1 -0
- 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/accordion.d.ts +3 -0
- package/dist-library/types/components/entries/alert.d.ts +3 -0
- package/dist-library/types/components/entries/anchor.d.ts +3 -0
- package/dist-library/types/components/entries/badge.d.ts +3 -0
- package/dist-library/types/components/entries/card.d.ts +3 -0
- package/dist-library/types/components/entries/chart.d.ts +3 -0
- package/dist-library/types/components/entries/checkbox.d.ts +3 -0
- package/dist-library/types/components/entries/checklist.d.ts +3 -0
- package/dist-library/types/components/entries/choices.d.ts +3 -0
- package/dist-library/types/components/entries/column.d.ts +3 -0
- package/dist-library/types/components/entries/coordinate.d.ts +3 -0
- package/dist-library/types/components/entries/counter.d.ts +3 -0
- package/dist-library/types/components/entries/data-table.d.ts +3 -0
- package/dist-library/types/components/entries/date.d.ts +3 -0
- package/dist-library/types/components/entries/diagram.d.ts +3 -0
- package/dist-library/types/components/entries/disclosure.d.ts +3 -0
- package/dist-library/types/components/entries/edge.d.ts +3 -0
- package/dist-library/types/components/entries/else.d.ts +3 -0
- package/dist-library/types/components/entries/gallery-item.d.ts +3 -0
- package/dist-library/types/components/entries/gallery.d.ts +3 -0
- package/dist-library/types/components/entries/grid.d.ts +3 -0
- package/dist-library/types/components/entries/if.d.ts +3 -0
- package/dist-library/types/components/entries/input.d.ts +3 -0
- package/dist-library/types/components/entries/jump.d.ts +3 -0
- package/dist-library/types/components/entries/multi-select.d.ts +3 -0
- package/dist-library/types/components/entries/node.d.ts +3 -0
- package/dist-library/types/components/entries/number.d.ts +3 -0
- package/dist-library/types/components/entries/option.d.ts +3 -0
- package/dist-library/types/components/entries/panel.d.ts +3 -0
- package/dist-library/types/components/entries/plot.d.ts +3 -0
- package/dist-library/types/components/entries/progress.d.ts +3 -0
- package/dist-library/types/components/entries/quiz.d.ts +3 -0
- package/dist-library/types/components/entries/radio-group.d.ts +3 -0
- package/dist-library/types/components/entries/range-slider.d.ts +3 -0
- package/dist-library/types/components/entries/section.d.ts +3 -0
- package/dist-library/types/components/entries/select.d.ts +3 -0
- package/dist-library/types/components/entries/slider.d.ts +3 -0
- package/dist-library/types/components/entries/step.d.ts +3 -0
- package/dist-library/types/components/entries/steps.d.ts +3 -0
- package/dist-library/types/components/entries/tab.d.ts +3 -0
- package/dist-library/types/components/entries/table.d.ts +3 -0
- package/dist-library/types/components/entries/tabs.d.ts +3 -0
- package/dist-library/types/components/entries/text.d.ts +3 -0
- package/dist-library/types/components/entries/textarea.d.ts +3 -0
- package/dist-library/types/components/entries/timeline.d.ts +3 -0
- package/dist-library/types/components/entries/timer.d.ts +3 -0
- package/dist-library/types/components/entries/toggle.d.ts +3 -0
- package/dist-library/types/components/entries/tooltip.d.ts +3 -0
- package/dist-library/types/components/entries/validation.d.ts +3 -0
- package/dist-library/types/components/layout/layout.d.ts +6 -3
- package/dist-library/types/components/layout/structural-views.d.ts +3 -0
- package/dist-library/types/components/mount-preset.d.ts +2 -0
- package/dist-library/types/components/packs/controls.d.ts +2 -0
- package/dist-library/types/components/packs/data.d.ts +2 -0
- package/dist-library/types/components/packs/layout.d.ts +2 -0
- package/dist-library/types/components/packs/visuals.d.ts +2 -0
- package/dist-library/types/components/shared/data-visuals.d.ts +3 -0
- package/dist-library/types/components/shared/table-surface.d.ts +10 -0
- package/dist-library/types/components/shared/visual-helpers.d.ts +24 -0
- package/dist-library/types/components/shared/visuals.d.ts +1 -3
- package/dist-library/types/components/table/data-table-model.d.ts +141 -0
- package/dist-library/types/components/table/data-table.d.ts +3 -50
- package/dist-library/types/{local/configuration → contracts}/component-kernel.d.ts +9 -2
- package/dist-library/types/contracts/font-aliases.d.ts +18 -0
- package/dist-library/types/contracts/index.d.ts +8 -0
- package/dist-library/types/{local/configuration → contracts}/limits.d.ts +9 -1
- package/dist-library/types/contracts/localization.d.ts +6 -0
- package/dist-library/types/contracts/number-literal.d.ts +2 -0
- package/dist-library/types/contracts/runtime-types.d.ts +19 -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/cache-version.d.ts +1 -0
- package/dist-library/types/local/compilation/compile-status.d.ts +2 -0
- package/dist-library/types/local/compilation/compiler-bindings.d.ts +1 -1
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +4 -1
- package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +1 -1
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
- package/dist-library/types/local/compilation/compiler-embedding.d.ts +20 -0
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +17 -5
- package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +9 -3
- package/dist-library/types/local/compilation/compiler-tables.d.ts +4 -2
- package/dist-library/types/local/compilation/compiler-validation.d.ts +14 -7
- package/dist-library/types/local/compilation/compiler-values.d.ts +2 -3
- package/dist-library/types/local/compilation/compiler.d.ts +1 -1
- package/dist-library/types/local/compilation/component-usage.d.ts +2 -0
- package/dist-library/types/local/compilation/runtime-requirement.d.ts +3 -0
- package/dist-library/types/local/compilation/session/incremental.d.ts +5 -1
- package/dist-library/types/local/compilation/streaming.d.ts +1 -1
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +228 -2
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
- package/dist-library/types/local/configuration/embedding.d.ts +4 -0
- package/dist-library/types/local/configuration/kernel-value-rules.d.ts +1 -1
- package/dist-library/types/local/configuration/options-core.d.ts +8 -2
- 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 +10 -4
- package/dist-library/types/local/observability-core.d.ts +20 -1
- package/dist-library/types/local/observability.d.ts +2 -0
- package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
- package/dist-library/types/local/parsing/parse-budget.d.ts +18 -2
- package/dist-library/types/local/parsing/parser-region.d.ts +13 -2
- package/dist-library/types/local/parsing/parser-tags.d.ts +6 -1
- package/dist-library/types/local/parsing/rmd-recovery.d.ts +8 -0
- package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
- package/dist-library/types/local/performance-report.d.ts +70 -0
- package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
- package/dist-library/types/local/runtime/runtime-pool.d.ts +14 -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/transport/worker-handler.d.ts +3 -0
- package/dist-library/types/local/transport/worker-job.d.ts +12 -2
- package/dist-library/types/local/transport/worker-pool.d.ts +68 -0
- package/dist-library/types/local/transport/worker.d.ts +14 -0
- package/dist-library/types/local/types.d.ts +70 -27
- package/dist-library/types/observability.d.ts +1 -0
- package/dist-library/types/presets/default-semantics.d.ts +1 -1
- package/dist-library/types/presets/identity.d.ts +1 -8
- package/dist-library/types/presets/pack-style-entry.d.ts +3 -0
- package/dist-library/types/presets/pack-style-manifest.d.ts +11 -0
- package/dist-library/types/react/component-api.d.ts +24 -4
- package/dist-library/types/react/component-loader.d.ts +61 -0
- package/dist-library/types/react/component-primitives.d.ts +5 -5
- 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/index.d.ts +9 -5
- package/dist-library/types/react/localization.d.ts +5 -6
- package/dist-library/types/react/minimal.d.ts +2 -2
- package/dist-library/types/react/package-core.d.ts +6 -0
- package/dist-library/types/react/packed.d.ts +17 -0
- package/dist-library/types/react/render-lifecycle.d.ts +9 -0
- package/dist-library/types/{local → react}/rendering/document/ExtendedHtmlFragment.d.ts +1 -1
- package/dist-library/types/{local → react}/rendering/document/LocalDocumentViewCore.d.ts +11 -4
- package/dist-library/types/react/rendering/document/LocalPooledDocumentView.d.ts +8 -0
- package/dist-library/types/react/rendering/document/LocalReactiveDocumentCore.d.ts +6 -0
- package/dist-library/types/react/rendering/document/LocalStaticDocumentView.d.ts +18 -0
- package/dist-library/types/react/rendering/document/StaticExternalSlot.d.ts +25 -0
- package/dist-library/types/react/rendering/document/StaticHostData.d.ts +14 -0
- package/dist-library/types/{local → react}/rendering/document/render-nodes.d.ts +8 -8
- package/dist-library/types/react/rendering/document/static-runtime.d.ts +11 -0
- package/dist-library/types/{local → react}/rendering/document/use-author-script.d.ts +2 -2
- package/dist-library/types/{local → react}/rendering/document/validation-state.d.ts +3 -3
- package/dist-library/types/{local → react}/rendering/document/view-render-context.d.ts +40 -8
- package/dist-library/types/{local → react}/rendering/document/view-revision.d.ts +5 -14
- package/dist-library/types/{local → react}/rendering/render-types.d.ts +5 -5
- package/dist-library/types/react/rendering/table/data-table.d.ts +5 -0
- package/dist-library/types/{local → react}/rendering/table/table-numeric-columns.d.ts +3 -3
- package/dist-library/types/react/sdk-core.d.ts +15 -4
- package/dist-library/types/react/sdk.d.ts +2 -1
- package/dist-library/types/react/server.d.ts +3 -10
- package/dist-library/types/react/static-server.d.ts +12 -0
- package/dist-library/types/scan/index.d.ts +15 -0
- package/dist-library/types/sdk/assembly.d.ts +3 -0
- package/dist-library/types/sdk/config.d.ts +2 -35
- package/dist-library/types/sdk/default-identity.d.ts +3 -0
- package/dist-library/types/sdk/font.d.ts +13 -0
- package/dist-library/types/sdk/index.d.ts +2 -1
- package/dist-library/types/sdk/preset.d.ts +9 -0
- package/dist-library/types/sdk/props.d.ts +8 -3
- package/dist-library/types/sdk/registry-core.d.ts +2 -2
- package/dist-library/types/sdk/registry.d.ts +2 -18
- package/dist-library/types/sdk/theme.d.ts +5 -0
- package/dist-library/types/sdk/types.d.ts +8 -2
- package/dist-library/types/sdk/version.d.ts +2 -0
- 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 +5 -2
- package/dist-library/types/vite/index.d.ts +3 -0
- package/dist-library/types/vite/registration.d.ts +1 -0
- package/dist-library/{types-Ib5kSScP.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-DAxuGOG2.js → version-4wzhbvDG.js} +24 -33
- package/dist-library/visual-frame-y5RFhJ0_.js +19 -0
- package/dist-library/visual-helpers-UU6xiL8g.js +75 -0
- package/dist-library/visuals-7xzoL9ql.js +49340 -0
- package/dist-library/visuals-CdHezgh5.js +3 -0
- package/dist-library/worker-3ldRjOEG.js +1632 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +127 -366
- package/docs/README-ch.md +104 -101
- package/docs/README.md +104 -101
- package/docs/compatibility/api-stability-ch.md +1 -1
- package/docs/compatibility/api-stability-en.md +1 -1
- package/docs/compatibility/compatibility-ch.md +146 -146
- package/docs/compatibility/compatibility-en.md +146 -146
- 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 +170 -162
- package/docs/compatibility/source-versioning-en.md +171 -162
- 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 +66 -66
- package/docs/development/component-development-en.md +66 -66
- package/docs/development/component-development-reference-ch.md +269 -253
- package/docs/development/component-development-reference-en.md +254 -238
- package/docs/development/component-protocol-ch.md +768 -748
- package/docs/development/component-protocol-en.md +770 -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 +621 -532
- package/docs/guides/local-guide-en.md +621 -532
- package/docs/integration/author-tools-ch.md +66 -64
- package/docs/integration/author-tools-en.md +66 -64
- package/docs/integration/compiler-ch.md +90 -49
- package/docs/integration/compiler-en.md +77 -36
- 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 +424 -394
- package/docs/integration/extension-sdk-en.md +409 -379
- package/docs/integration/local-integration-ch.md +648 -646
- package/docs/integration/local-integration-en.md +664 -662
- 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 +299 -307
- package/docs/integration/shareable-export-en.md +301 -309
- package/docs/reference/diagnostics-counting-ch.md +127 -104
- package/docs/reference/diagnostics-counting-en.md +127 -104
- package/docs/reference/html-compatibility-ch.md +93 -93
- package/docs/reference/html-compatibility-en.md +95 -95
- package/docs/reference/local-interaction-syntax-ch.md +913 -724
- package/docs/reference/local-interaction-syntax-en.md +911 -722
- package/docs/reference/public-api-ch.md +134 -21
- package/docs/reference/public-api-en.md +134 -21
- package/docs/reference/theme-protocol-ch.md +198 -198
- package/docs/reference/theme-protocol-en.md +217 -217
- package/docs/releases/release-0.10.0-ch.md +45 -0
- package/docs/releases/release-0.10.0-en.md +45 -0
- 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.3-ch.md +45 -0
- package/docs/releases/release-0.9.3-en.md +45 -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/conformance/local-draft-4.json +441 -0
- 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 +114 -82
- package/examples/integration/README.md +114 -82
- package/examples/integration/chat-session/index.mjs +91 -0
- package/examples/integration/chat-session/package.json +10 -0
- 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/static-embed/embed.mjs +44 -0
- package/examples/integration/static-embed/index.html +12 -0
- package/examples/integration/static-embed/main.mjs +24 -0
- package/examples/integration/static-embed/references.mjs +5 -0
- package/examples/integration/static-embed/render.mjs +10 -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 +66 -2
- package/dist-library/LocalDocumentView-BuqgJZEY.js +0 -109
- package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +0 -275
- package/dist-library/authoring-Ci_KzJ0q.js +0 -892
- package/dist-library/compile-Dx6Uw3D9.js +0 -1249
- package/dist-library/compiler-dxLPB9Ym.js +0 -86
- package/dist-library/config-validation-D3D7Dy2J.js +0 -586
- package/dist-library/controls-DoZyLCrV.js +0 -6740
- package/dist-library/data-table-8-3F15Jf.js +0 -296
- package/dist-library/layout-BBB2VF0S.js +0 -562
- package/dist-library/mount-preset-DMZ5wd3t.js +0 -13
- package/dist-library/options-BBp9IcHm.js +0 -121
- package/dist-library/package-core-K5xesGqy.js +0 -117
- package/dist-library/parser-standard-CBA1-hdG.js +0 -9630
- package/dist-library/plugin-packs-Bh1HhLym.js +0 -19
- package/dist-library/preset-core-DeZPA8IE.js +0 -1298
- package/dist-library/props-sJ8vk0cr.js +0 -183
- package/dist-library/react-0DCh-Mar.js +0 -7
- package/dist-library/registry-core-C9xOunaw.js +0 -479
- package/dist-library/resources-B0x_w3s9.js +0 -229
- package/dist-library/runtime-BpQdZmFI.js +0 -1288
- package/dist-library/schema-BryM_VRW.js +0 -40
- package/dist-library/sdk-core-ChslheKs.js +0 -1167
- package/dist-library/shareable-B8xMoGEa.js +0 -814
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +0 -6
- package/dist-library/types/local/rendering/table/data-table.d.ts +0 -13
- package/dist-library/types-daDo2c_w.js +0 -3
- package/dist-library/validation-B3RI0xOk.js +0 -1123
- package/dist-library/visual-frame-_rcd5HUv.js +0 -48
- package/dist-library/visuals-DkDhNdEZ.js +0 -72572
- /package/dist-library/types/{local/configuration → contracts}/color-values.d.ts +0 -0
- /package/dist-library/types/{local/html → contracts}/html-names.d.ts +0 -0
- /package/dist-library/types/{local/configuration → contracts}/schema-core.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/code/code-block.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/code/code-languages.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/document/LocalDocumentView.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/document/use-color-scheme.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/image/image-view.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/math-view.d.ts +0 -0
|
@@ -0,0 +1,1371 @@
|
|
|
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-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
|
+
}
|
|
44
|
+
// src/sdk/hash.ts
|
|
45
|
+
function x(e) {
|
|
46
|
+
let t = 2166136261, n = 16777619;
|
|
47
|
+
for (let r = 0; r < e.length; r += 1) {
|
|
48
|
+
let i = e.charCodeAt(r);
|
|
49
|
+
t ^= i, t = Math.imul(t, 16777619) >>> 0, n ^= i + r, n = Math.imul(n, 2246822507) >>> 0;
|
|
50
|
+
}
|
|
51
|
+
let r = e.length;
|
|
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")}`;
|
|
53
|
+
}
|
|
54
|
+
// src/sdk/pattern.ts
|
|
55
|
+
function S(e, t) {
|
|
56
|
+
let n = e[t];
|
|
57
|
+
if (n === "*" || n === "+" || n === "?") return { length: e[t + 1] === "?" ? 2 : 1 };
|
|
58
|
+
if (n !== "{") return null;
|
|
59
|
+
let r = /^\{(\d+)(?:,(\d*))?\}/.exec(e.slice(t));
|
|
60
|
+
return r ? { length: r[0].length + +(e[t + r[0].length] === "?") } : null;
|
|
61
|
+
}
|
|
62
|
+
function ee(e) {
|
|
63
|
+
let t = [], n = !1, r = !1;
|
|
64
|
+
for (let i = 0; i < e.length; i += 1) {
|
|
65
|
+
let a = e[i];
|
|
66
|
+
if (n) {
|
|
67
|
+
n = !1;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (a === "\\") {
|
|
71
|
+
let t = e[i + 1];
|
|
72
|
+
if (t !== void 0 && t >= "1" && t <= "9" || t === "k" && e[i + 2] === "<") return !1;
|
|
73
|
+
n = !0;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (r) {
|
|
77
|
+
a === "]" && (r = !1);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (a === "[") {
|
|
81
|
+
r = !0;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (a === "(") {
|
|
85
|
+
if (e[i + 1] === "?") {
|
|
86
|
+
if (e[i + 2] !== ":") return !1;
|
|
87
|
+
t.push({
|
|
88
|
+
quantified: !1,
|
|
89
|
+
alternation: !1
|
|
90
|
+
}), i += 2;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
t.push({
|
|
94
|
+
quantified: !1,
|
|
95
|
+
alternation: !1
|
|
96
|
+
});
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (a === "|") {
|
|
100
|
+
let e = t[t.length - 1];
|
|
101
|
+
e && (e.alternation = !0);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (a === ")") {
|
|
105
|
+
let n = t.pop();
|
|
106
|
+
if (!n) return !1;
|
|
107
|
+
let r = S(e, i + 1);
|
|
108
|
+
if (r && (n.quantified || n.alternation)) return !1;
|
|
109
|
+
let a = t[t.length - 1];
|
|
110
|
+
a && (a.quantified = a.quantified || n.quantified || r !== null, a.alternation = a.alternation || n.alternation), r && (i += r.length);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
let o = S(e, i);
|
|
114
|
+
if (o) {
|
|
115
|
+
let e = t[t.length - 1];
|
|
116
|
+
e && (e.quantified = !0), i += o.length - 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return t.length === 0 && !n && !r;
|
|
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
|
+
}
|
|
133
|
+
// src/sdk/manifest.ts
|
|
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([
|
|
135
|
+
"__proto__",
|
|
136
|
+
"constructor",
|
|
137
|
+
"prototype"
|
|
138
|
+
]), D = /* @__PURE__ */ new WeakSet(), _e = /* @__PURE__ */ new Set([
|
|
139
|
+
"string",
|
|
140
|
+
"number",
|
|
141
|
+
"boolean",
|
|
142
|
+
"enum"
|
|
143
|
+
]), ve = /* @__PURE__ */ new Set([
|
|
144
|
+
"leaf",
|
|
145
|
+
"inline",
|
|
146
|
+
"container"
|
|
147
|
+
]), ye = /* @__PURE__ */ new Set([
|
|
148
|
+
"string",
|
|
149
|
+
"number",
|
|
150
|
+
"boolean",
|
|
151
|
+
"null",
|
|
152
|
+
"array",
|
|
153
|
+
"number-array"
|
|
154
|
+
]), be = /* @__PURE__ */ new Set([
|
|
155
|
+
"text",
|
|
156
|
+
"number",
|
|
157
|
+
"boolean",
|
|
158
|
+
"choice",
|
|
159
|
+
"date",
|
|
160
|
+
"timer",
|
|
161
|
+
"checklist",
|
|
162
|
+
"tabs",
|
|
163
|
+
"diagram",
|
|
164
|
+
"multi-select",
|
|
165
|
+
"selection",
|
|
166
|
+
"steps",
|
|
167
|
+
"collection"
|
|
168
|
+
]), xe = /* @__PURE__ */ new Set([
|
|
169
|
+
"empty",
|
|
170
|
+
"false",
|
|
171
|
+
"max-step",
|
|
172
|
+
"nearest-zero",
|
|
173
|
+
"min",
|
|
174
|
+
"first-option",
|
|
175
|
+
"first-tab",
|
|
176
|
+
"first-step",
|
|
177
|
+
"first-node",
|
|
178
|
+
"checked",
|
|
179
|
+
"duration",
|
|
180
|
+
"empty-array",
|
|
181
|
+
"none"
|
|
182
|
+
]), Se = /* @__PURE__ */ new Set([
|
|
183
|
+
"none",
|
|
184
|
+
"inline",
|
|
185
|
+
"markdown"
|
|
186
|
+
]), Ce = /* @__PURE__ */ new Set([
|
|
187
|
+
"none",
|
|
188
|
+
"any",
|
|
189
|
+
"inline",
|
|
190
|
+
"raw-body",
|
|
191
|
+
"content",
|
|
192
|
+
"table",
|
|
193
|
+
"plot",
|
|
194
|
+
"diagram",
|
|
195
|
+
"quiz",
|
|
196
|
+
"options",
|
|
197
|
+
"tabs",
|
|
198
|
+
"steps",
|
|
199
|
+
"components"
|
|
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([
|
|
201
|
+
"none",
|
|
202
|
+
"required",
|
|
203
|
+
"optional"
|
|
204
|
+
]), Ee = /* @__PURE__ */ new Set([
|
|
205
|
+
"id",
|
|
206
|
+
"name",
|
|
207
|
+
"version",
|
|
208
|
+
"protocol",
|
|
209
|
+
"form",
|
|
210
|
+
"props",
|
|
211
|
+
"bindings",
|
|
212
|
+
"children",
|
|
213
|
+
"structure",
|
|
214
|
+
"rules",
|
|
215
|
+
"slotRelations",
|
|
216
|
+
"legacyHost",
|
|
217
|
+
"capabilities",
|
|
218
|
+
"authoring",
|
|
219
|
+
"dependencies",
|
|
220
|
+
"styles",
|
|
221
|
+
"requires",
|
|
222
|
+
"replaces"
|
|
223
|
+
]), De = /* @__PURE__ */ new Set([
|
|
224
|
+
"kind",
|
|
225
|
+
"required",
|
|
226
|
+
"static",
|
|
227
|
+
"dynamic",
|
|
228
|
+
"default",
|
|
229
|
+
"nullable",
|
|
230
|
+
"enum",
|
|
231
|
+
"values",
|
|
232
|
+
"pattern",
|
|
233
|
+
"min",
|
|
234
|
+
"max",
|
|
235
|
+
"integer",
|
|
236
|
+
"positive",
|
|
237
|
+
"allowPositiveNumber",
|
|
238
|
+
"color",
|
|
239
|
+
"coerce",
|
|
240
|
+
"description"
|
|
241
|
+
]), Oe = /* @__PURE__ */ new Set([
|
|
242
|
+
"kind",
|
|
243
|
+
"family",
|
|
244
|
+
"bind",
|
|
245
|
+
"initial",
|
|
246
|
+
"initialRule",
|
|
247
|
+
"required",
|
|
248
|
+
"exclusive",
|
|
249
|
+
"constraints",
|
|
250
|
+
"options",
|
|
251
|
+
"maxItems",
|
|
252
|
+
"requiresAttributes",
|
|
253
|
+
"compare",
|
|
254
|
+
"retain"
|
|
255
|
+
]), ke = /* @__PURE__ */ new Set([
|
|
256
|
+
"min",
|
|
257
|
+
"max",
|
|
258
|
+
"step"
|
|
259
|
+
]), Ae = /* @__PURE__ */ new Set([
|
|
260
|
+
"interactive",
|
|
261
|
+
"static",
|
|
262
|
+
"ssr",
|
|
263
|
+
"offline"
|
|
264
|
+
]), je = /* @__PURE__ */ new Set([
|
|
265
|
+
"title",
|
|
266
|
+
"description",
|
|
267
|
+
"category",
|
|
268
|
+
"insertText"
|
|
269
|
+
]), Me = /* @__PURE__ */ new Set(["kind", "required"]), Ne = /* @__PURE__ */ new Set([
|
|
270
|
+
"rule",
|
|
271
|
+
"label",
|
|
272
|
+
"parents",
|
|
273
|
+
"child",
|
|
274
|
+
"children",
|
|
275
|
+
"min",
|
|
276
|
+
"max",
|
|
277
|
+
"inlineOnly",
|
|
278
|
+
"noComponents",
|
|
279
|
+
"valueAttribute",
|
|
280
|
+
"generatedPrefix",
|
|
281
|
+
"forbidSeparator",
|
|
282
|
+
"maxItems"
|
|
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([
|
|
284
|
+
"bind",
|
|
285
|
+
"initial",
|
|
286
|
+
"disabled"
|
|
287
|
+
]);
|
|
288
|
+
function k(e, t) {
|
|
289
|
+
throw Error(`Invalid local component manifest (${e}): ${t}`);
|
|
290
|
+
}
|
|
291
|
+
function A(e) {
|
|
292
|
+
try {
|
|
293
|
+
let t = JSON.stringify(e);
|
|
294
|
+
return typeof t == "string" ? typeof TextEncoder == "function" ? new TextEncoder().encode(t).length : t.length * 2 : Infinity;
|
|
295
|
+
} catch {
|
|
296
|
+
return Infinity;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function j(e) {
|
|
300
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
301
|
+
let t = Object.getPrototypeOf(e);
|
|
302
|
+
return t === Object.prototype || t === null;
|
|
303
|
+
}
|
|
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}".`);
|
|
306
|
+
}
|
|
307
|
+
function N(e, t) {
|
|
308
|
+
return typeof e != "boolean" && k(t, "must be a boolean."), e;
|
|
309
|
+
}
|
|
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;
|
|
312
|
+
}
|
|
313
|
+
function F(e, t) {
|
|
314
|
+
return typeof e == "number" && Number.isFinite(e) || k(t, "must be a finite number."), e;
|
|
315
|
+
}
|
|
316
|
+
function I(e, t) {
|
|
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.");
|
|
321
|
+
let n = {}, r = Object.keys(e).sort();
|
|
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);
|
|
323
|
+
return n;
|
|
324
|
+
}
|
|
325
|
+
function We(e, t) {
|
|
326
|
+
j(e) || k(t, "must be an object."), M(e, je, t);
|
|
327
|
+
let n = {};
|
|
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;
|
|
329
|
+
}
|
|
330
|
+
function Ge(e, t, n) {
|
|
331
|
+
j(e) || k(n, "must be an object."), M(e, Me, n);
|
|
332
|
+
let r = e.kind;
|
|
333
|
+
typeof r == "string" && Se.has(r) || k(`${n}.kind`, "must be \"none\", \"inline\" or \"markdown\".");
|
|
334
|
+
let i = r;
|
|
335
|
+
e.required !== void 0 && N(e.required, `${n}.required`);
|
|
336
|
+
let a = e.required === !0;
|
|
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\"."), {
|
|
338
|
+
kind: i,
|
|
339
|
+
...a ? { required: !0 } : {}
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function R(e) {
|
|
343
|
+
if (e !== void 0) return e.kind === "none" ? Object.freeze({
|
|
344
|
+
rule: "none",
|
|
345
|
+
label: "none"
|
|
346
|
+
}) : e.kind === "inline" ? Object.freeze({
|
|
347
|
+
rule: "inline",
|
|
348
|
+
label: "none",
|
|
349
|
+
inlineOnly: !0,
|
|
350
|
+
noComponents: !0,
|
|
351
|
+
...e.required ? { min: 1 } : {}
|
|
352
|
+
}) : Object.freeze({
|
|
353
|
+
rule: "any",
|
|
354
|
+
label: "none",
|
|
355
|
+
...e.required ? { min: 1 } : {}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
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.");
|
|
360
|
+
let n = /* @__PURE__ */ new Set(), r = [];
|
|
361
|
+
for (let i of 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);
|
|
364
|
+
}
|
|
365
|
+
return r;
|
|
366
|
+
}
|
|
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;
|
|
370
|
+
}
|
|
371
|
+
function Ke(e, t, r) {
|
|
372
|
+
j(e) || k(r, "must be an object."), M(e, Ne, r);
|
|
373
|
+
let i = e.rule;
|
|
374
|
+
typeof i == "string" && Ce.has(i) || k(`${r}.rule`, "is not a supported child rule.");
|
|
375
|
+
let a = i;
|
|
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\".");
|
|
377
|
+
let o = { rule: a };
|
|
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;
|
|
381
|
+
}
|
|
382
|
+
if (e.forbidSeparator !== void 0) {
|
|
383
|
+
let t = P(e.forbidSeparator, `${r}.forbidSeparator`, 4);
|
|
384
|
+
t.length === 0 && k(`${r}.forbidSeparator`, "must not be empty."), o.forbidSeparator = t;
|
|
385
|
+
}
|
|
386
|
+
return e.maxItems !== void 0 && (o.maxItems = H(e.maxItems, `${r}.maxItems`, n)), o;
|
|
387
|
+
}
|
|
388
|
+
function V(e, t) {
|
|
389
|
+
return I(e, t);
|
|
390
|
+
}
|
|
391
|
+
function qe(e, t) {
|
|
392
|
+
return B(e, t);
|
|
393
|
+
}
|
|
394
|
+
function H(e, t, n) {
|
|
395
|
+
let r = B(e, t);
|
|
396
|
+
return r > n && k(t, `cannot exceed the kernel limit ${n}.`), r;
|
|
397
|
+
}
|
|
398
|
+
function U(e, t) {
|
|
399
|
+
return z(e, t);
|
|
400
|
+
}
|
|
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));
|
|
403
|
+
}
|
|
404
|
+
function Ye(a, o) {
|
|
405
|
+
j(a) || k(o, "must be an object.");
|
|
406
|
+
let s = a.kind;
|
|
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) => {
|
|
409
|
+
let t = {};
|
|
410
|
+
for (let n of e) a[n] !== void 0 && (t[n] = V(a[n], `${o}.${n}`));
|
|
411
|
+
return t;
|
|
412
|
+
};
|
|
413
|
+
switch (s) {
|
|
414
|
+
case "numeric-range": {
|
|
415
|
+
c([
|
|
416
|
+
"min",
|
|
417
|
+
"max",
|
|
418
|
+
"step",
|
|
419
|
+
"order",
|
|
420
|
+
"integer",
|
|
421
|
+
"positiveInteger"
|
|
422
|
+
]);
|
|
423
|
+
let e;
|
|
424
|
+
return a.order !== void 0 && (a.order !== "nondecreasing" && a.order !== "increasing" && k(`${o}.order`, "must be \"nondecreasing\" or \"increasing\"."), e = a.order), {
|
|
425
|
+
kind: s,
|
|
426
|
+
...l([
|
|
427
|
+
"min",
|
|
428
|
+
"max",
|
|
429
|
+
"step",
|
|
430
|
+
"integer",
|
|
431
|
+
"positiveInteger"
|
|
432
|
+
]),
|
|
433
|
+
...e ? { order: e } : {}
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
case "text-length": return c(["min", "max"]), {
|
|
437
|
+
kind: s,
|
|
438
|
+
...l(["min", "max"])
|
|
439
|
+
};
|
|
440
|
+
case "date-bounds": return c([
|
|
441
|
+
"min",
|
|
442
|
+
"max",
|
|
443
|
+
"required"
|
|
444
|
+
]), {
|
|
445
|
+
kind: s,
|
|
446
|
+
...l([
|
|
447
|
+
"min",
|
|
448
|
+
"max",
|
|
449
|
+
"required"
|
|
450
|
+
])
|
|
451
|
+
};
|
|
452
|
+
case "nonempty": return c(["attribute"]), {
|
|
453
|
+
kind: s,
|
|
454
|
+
attribute: V(a.attribute, `${o}.attribute`)
|
|
455
|
+
};
|
|
456
|
+
case "progress-bounds": return c([
|
|
457
|
+
"value",
|
|
458
|
+
"max",
|
|
459
|
+
"defaultMax"
|
|
460
|
+
]), {
|
|
461
|
+
kind: s,
|
|
462
|
+
value: V(a.value, `${o}.value`),
|
|
463
|
+
max: V(a.max, `${o}.max`),
|
|
464
|
+
defaultMax: F(a.defaultMax, `${o}.defaultMax`)
|
|
465
|
+
};
|
|
466
|
+
case "timer-duration": return c(["attribute", "default"]), {
|
|
467
|
+
kind: s,
|
|
468
|
+
attribute: V(a.attribute, `${o}.attribute`),
|
|
469
|
+
default: F(a.default, `${o}.default`)
|
|
470
|
+
};
|
|
471
|
+
case "option-count": return c(["max"]), {
|
|
472
|
+
kind: s,
|
|
473
|
+
...a.max === void 0 ? {} : { max: V(a.max, `${o}.max`) }
|
|
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
|
+
}
|
|
483
|
+
case "selection-requires": return c(["key", "attributes"]), {
|
|
484
|
+
kind: s,
|
|
485
|
+
key: V(a.key, `${o}.key`),
|
|
486
|
+
attributes: U(a.attributes, `${o}.attributes`)
|
|
487
|
+
};
|
|
488
|
+
case "inline-body": return c(["strict"]), {
|
|
489
|
+
kind: s,
|
|
490
|
+
...a.strict === void 0 ? {} : { strict: N(a.strict, `${o}.strict`) }
|
|
491
|
+
};
|
|
492
|
+
case "no-components":
|
|
493
|
+
case "math-body":
|
|
494
|
+
case "inline-math-reads": return c([]), { kind: s };
|
|
495
|
+
case "single-table": return c(["fallbackSingle"]), {
|
|
496
|
+
kind: s,
|
|
497
|
+
...a.fallbackSingle === void 0 ? {} : { fallbackSingle: N(a.fallbackSingle, `${o}.fallbackSingle`) }
|
|
498
|
+
};
|
|
499
|
+
case "options-body": return c([
|
|
500
|
+
"child",
|
|
501
|
+
"valueAttribute",
|
|
502
|
+
"unique",
|
|
503
|
+
"max",
|
|
504
|
+
"forbidSeparator"
|
|
505
|
+
]), {
|
|
506
|
+
kind: s,
|
|
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`),
|
|
510
|
+
...a.max === void 0 ? {} : { max: H(a.max, `${o}.max`, n) },
|
|
511
|
+
...a.forbidSeparator === void 0 ? {} : { forbidSeparator: P(a.forbidSeparator, `${o}.forbidSeparator`, 4) }
|
|
512
|
+
};
|
|
513
|
+
case "value-sequence": return c([
|
|
514
|
+
"child",
|
|
515
|
+
"valueAttribute",
|
|
516
|
+
"min",
|
|
517
|
+
"generatedPrefix",
|
|
518
|
+
"unique",
|
|
519
|
+
"duplicateCode"
|
|
520
|
+
]), {
|
|
521
|
+
kind: s,
|
|
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) }
|
|
528
|
+
};
|
|
529
|
+
case "only-children": return c([
|
|
530
|
+
"children",
|
|
531
|
+
"min",
|
|
532
|
+
"max",
|
|
533
|
+
"maxCode",
|
|
534
|
+
"onlyCode"
|
|
535
|
+
]), {
|
|
536
|
+
kind: s,
|
|
537
|
+
children: U(a.children, `${o}.children`),
|
|
538
|
+
min: qe(a.min, `${o}.min`),
|
|
539
|
+
...a.max === void 0 ? {} : { max: H(a.max, `${o}.max`, n) },
|
|
540
|
+
...a.maxCode === void 0 ? {} : { maxCode: P(a.maxCode, `${o}.maxCode`, 128) },
|
|
541
|
+
...a.onlyCode === void 0 ? {} : { onlyCode: P(a.onlyCode, `${o}.onlyCode`, 128) }
|
|
542
|
+
};
|
|
543
|
+
case "diagram-body": return c([
|
|
544
|
+
"node",
|
|
545
|
+
"edge",
|
|
546
|
+
"id",
|
|
547
|
+
"from",
|
|
548
|
+
"to",
|
|
549
|
+
"label"
|
|
550
|
+
]), {
|
|
551
|
+
kind: s,
|
|
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`) }
|
|
558
|
+
};
|
|
559
|
+
case "quiz-body": return c([
|
|
560
|
+
"type",
|
|
561
|
+
"answer",
|
|
562
|
+
"tolerance",
|
|
563
|
+
"child",
|
|
564
|
+
"valueAttribute",
|
|
565
|
+
"max"
|
|
566
|
+
]), {
|
|
567
|
+
kind: s,
|
|
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`),
|
|
573
|
+
...a.max === void 0 ? {} : { max: H(a.max, `${o}.max`, n) }
|
|
574
|
+
};
|
|
575
|
+
case "checklist-body": return c(["itemLimit"]), {
|
|
576
|
+
kind: s,
|
|
577
|
+
itemLimit: H(a.itemLimit, `${o}.itemLimit`, n)
|
|
578
|
+
};
|
|
579
|
+
case "dynamic-constraints":
|
|
580
|
+
case "require-full-interpolation": return c(["attributes"]), {
|
|
581
|
+
kind: s,
|
|
582
|
+
attributes: U(a.attributes, `${o}.attributes`)
|
|
583
|
+
};
|
|
584
|
+
case "scoped-expressions": return c(["attributes", "scope"]), a.scope !== "row" && a.scope !== "validation" && k(`${o}.scope`, "must be \"row\" or \"validation\"."), {
|
|
585
|
+
kind: s,
|
|
586
|
+
attributes: U(a.attributes, `${o}.attributes`),
|
|
587
|
+
scope: a.scope
|
|
588
|
+
};
|
|
589
|
+
case "row-values": return c([
|
|
590
|
+
"rows",
|
|
591
|
+
"key",
|
|
592
|
+
"child",
|
|
593
|
+
"childValue"
|
|
594
|
+
]), {
|
|
595
|
+
kind: s,
|
|
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`)
|
|
600
|
+
};
|
|
601
|
+
case "validation-rule": return c([
|
|
602
|
+
"when",
|
|
603
|
+
"fields",
|
|
604
|
+
"message",
|
|
605
|
+
"placement",
|
|
606
|
+
"max"
|
|
607
|
+
]), a.placement !== "container" && a.placement !== "prose" && k(`${o}.placement`, "must be \"container\" or \"prose\"."), {
|
|
608
|
+
kind: s,
|
|
609
|
+
when: V(a.when, `${o}.when`),
|
|
610
|
+
fields: V(a.fields, `${o}.fields`),
|
|
611
|
+
message: V(a.message, `${o}.message`),
|
|
612
|
+
placement: a.placement,
|
|
613
|
+
max: H(a.max, `${o}.max`, 100)
|
|
614
|
+
};
|
|
615
|
+
case "anchor": return c(["id"]), {
|
|
616
|
+
kind: s,
|
|
617
|
+
id: V(a.id, `${o}.id`)
|
|
618
|
+
};
|
|
619
|
+
case "navigation": return c(["target"]), {
|
|
620
|
+
kind: s,
|
|
621
|
+
target: V(a.target, `${o}.target`)
|
|
622
|
+
};
|
|
623
|
+
case "data-table": return c([
|
|
624
|
+
"rows",
|
|
625
|
+
"key",
|
|
626
|
+
"child",
|
|
627
|
+
"childValue",
|
|
628
|
+
"label",
|
|
629
|
+
"maxRows",
|
|
630
|
+
"defaultMaxRows",
|
|
631
|
+
"documentRows",
|
|
632
|
+
"documentCells",
|
|
633
|
+
"maxColumns"
|
|
634
|
+
]), {
|
|
635
|
+
kind: s,
|
|
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`),
|
|
642
|
+
defaultMaxRows: H(a.defaultMaxRows, `${o}.defaultMaxRows`, i),
|
|
643
|
+
documentRows: H(a.documentRows, `${o}.documentRows`, t),
|
|
644
|
+
documentCells: H(a.documentCells, `${o}.documentCells`, r),
|
|
645
|
+
maxColumns: H(a.maxColumns, `${o}.maxColumns`, 20)
|
|
646
|
+
};
|
|
647
|
+
case "plot-math": return c([
|
|
648
|
+
"min",
|
|
649
|
+
"max",
|
|
650
|
+
"samples",
|
|
651
|
+
"samplesAlias",
|
|
652
|
+
"curves",
|
|
653
|
+
"points"
|
|
654
|
+
]), {
|
|
655
|
+
kind: s,
|
|
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`) },
|
|
660
|
+
curves: H(a.curves, `${o}.curves`, 16),
|
|
661
|
+
points: H(a.points, `${o}.points`, e)
|
|
662
|
+
};
|
|
663
|
+
case "chart-table": return c([
|
|
664
|
+
"chartKind",
|
|
665
|
+
"x",
|
|
666
|
+
"y"
|
|
667
|
+
]), {
|
|
668
|
+
kind: s,
|
|
669
|
+
chartKind: V(a.chartKind, `${o}.chartKind`),
|
|
670
|
+
x: V(a.x, `${o}.x`),
|
|
671
|
+
y: V(a.y, `${o}.y`)
|
|
672
|
+
};
|
|
673
|
+
case "timeline-table": return c(["headerSets"]), Array.isArray(a.headerSets) || k(`${o}.headerSets`, "must be an array."), {
|
|
674
|
+
kind: s,
|
|
675
|
+
headerSets: a.headerSets.map((e, t) => Je(e, `${o}.headerSets[${t}]`))
|
|
676
|
+
};
|
|
677
|
+
case "table-selection": return c(["key", "bindings"]), {
|
|
678
|
+
kind: s,
|
|
679
|
+
key: V(a.key, `${o}.key`),
|
|
680
|
+
bindings: U(a.bindings, `${o}.bindings`)
|
|
681
|
+
};
|
|
682
|
+
case "retain": return c(["value"]), {
|
|
683
|
+
kind: s,
|
|
684
|
+
value: N(a.value, `${o}.value`)
|
|
685
|
+
};
|
|
686
|
+
case "self-binding-read": return c(["mode", "attribute"]), a.mode !== "always" && a.mode !== "attribute" && k(`${o}.mode`, "must be \"always\" or \"attribute\"."), {
|
|
687
|
+
kind: s,
|
|
688
|
+
mode: a.mode,
|
|
689
|
+
...a.attribute === void 0 ? {} : { attribute: V(a.attribute, `${o}.attribute`) }
|
|
690
|
+
};
|
|
691
|
+
case "value-date": return c([
|
|
692
|
+
"min",
|
|
693
|
+
"max",
|
|
694
|
+
"required"
|
|
695
|
+
]), {
|
|
696
|
+
kind: s,
|
|
697
|
+
...l([
|
|
698
|
+
"min",
|
|
699
|
+
"max",
|
|
700
|
+
"required"
|
|
701
|
+
])
|
|
702
|
+
};
|
|
703
|
+
case "value-length": return c([
|
|
704
|
+
"min",
|
|
705
|
+
"max",
|
|
706
|
+
"email",
|
|
707
|
+
"emailType"
|
|
708
|
+
]), {
|
|
709
|
+
kind: s,
|
|
710
|
+
...l([
|
|
711
|
+
"min",
|
|
712
|
+
"max",
|
|
713
|
+
"email"
|
|
714
|
+
]),
|
|
715
|
+
...a.emailType === void 0 ? {} : { emailType: P(a.emailType, `${o}.emailType`, 128) }
|
|
716
|
+
};
|
|
717
|
+
case "value-required": return c(["required"]), {
|
|
718
|
+
kind: s,
|
|
719
|
+
required: V(a.required, `${o}.required`)
|
|
720
|
+
};
|
|
721
|
+
case "value-email": return c(["type", "value"]), {
|
|
722
|
+
kind: s,
|
|
723
|
+
...l(["type"]),
|
|
724
|
+
...a.value === void 0 ? {} : { value: P(a.value, `${o}.value`, 128) }
|
|
725
|
+
};
|
|
726
|
+
default: k(`${o}.kind`, "is not a supported rule.");
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
function Xe(e) {
|
|
730
|
+
Array.isArray(e) || k("rules", "must be an array."), e.length > 32 && k("rules", "accepts at most 32 rules.");
|
|
731
|
+
let t = [];
|
|
732
|
+
for (let n = 0; n < e.length; n += 1) t.push(Ye(e[n], `rules[${n}]`));
|
|
733
|
+
return t;
|
|
734
|
+
}
|
|
735
|
+
function Ze(e) {
|
|
736
|
+
Array.isArray(e) || k("slotRelations", "must be an array."), e.length > 16 && k("slotRelations", "accepts at most 16 relations.");
|
|
737
|
+
let t = [];
|
|
738
|
+
for (let n = 0; n < e.length; n += 1) {
|
|
739
|
+
let r = e[n], i = `slotRelations[${n}]`;
|
|
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`)
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
return t;
|
|
746
|
+
}
|
|
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}`);
|
|
750
|
+
return {
|
|
751
|
+
interactive: n("interactive"),
|
|
752
|
+
static: n("static"),
|
|
753
|
+
ssr: n("ssr"),
|
|
754
|
+
offline: n("offline")
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function $e(e, t) {
|
|
758
|
+
j(e) || k(t, "must be an object."), M(e, De, t);
|
|
759
|
+
let n = e.kind;
|
|
760
|
+
typeof n == "string" && _e.has(n) || k(`${t}.kind`, "must be \"string\", \"number\", \"boolean\" or \"enum\".");
|
|
761
|
+
let r = n, i = { kind: r };
|
|
762
|
+
for (let n of [
|
|
763
|
+
"required",
|
|
764
|
+
"static",
|
|
765
|
+
"dynamic",
|
|
766
|
+
"integer",
|
|
767
|
+
"positive",
|
|
768
|
+
"allowPositiveNumber",
|
|
769
|
+
"color",
|
|
770
|
+
"nullable"
|
|
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");
|
|
773
|
+
let a = e.enum === void 0 ? e.values : e.enum, o = a !== void 0;
|
|
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\".");
|
|
775
|
+
else {
|
|
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.");
|
|
777
|
+
let n = /* @__PURE__ */ new Set(), r = [];
|
|
778
|
+
for (let e of a) {
|
|
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);
|
|
781
|
+
}
|
|
782
|
+
i.enum = r;
|
|
783
|
+
}
|
|
784
|
+
let s = e.pattern !== void 0;
|
|
785
|
+
if (r !== "string") s && k(t, `"pattern" is only valid for kind "string", not "${r}".`);
|
|
786
|
+
else if (s) {
|
|
787
|
+
typeof e.pattern != "string" && k(`${t}.pattern`, "must be a string."), e.pattern.length > 512 && k(`${t}.pattern`, "exceeds the 512-character limit.");
|
|
788
|
+
try {
|
|
789
|
+
new RegExp(e.pattern);
|
|
790
|
+
} catch {
|
|
791
|
+
k(`${t}.pattern`, "is not a valid regular expression.");
|
|
792
|
+
}
|
|
793
|
+
ee(e.pattern) || k(`${t}.pattern`, "uses unsupported regex syntax; nested quantifiers, quantified alternation, backreferences and lookarounds are rejected."), i.pattern = e.pattern;
|
|
794
|
+
}
|
|
795
|
+
let c = e.min !== void 0, l = e.max !== void 0;
|
|
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) {
|
|
797
|
+
let n = e.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`);
|
|
800
|
+
else if (r === "number") {
|
|
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`);
|
|
804
|
+
else {
|
|
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;
|
|
807
|
+
}
|
|
808
|
+
if (i.pattern !== void 0 && r === "string" && typeof i.default == "string") {
|
|
809
|
+
let e = !0;
|
|
810
|
+
try {
|
|
811
|
+
e = new RegExp(i.pattern).test(i.default);
|
|
812
|
+
} catch {
|
|
813
|
+
e = !1;
|
|
814
|
+
}
|
|
815
|
+
e || k(`${t}.default`, `does not match pattern ${i.pattern}.`);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
return i;
|
|
819
|
+
}
|
|
820
|
+
function et(e, t) {
|
|
821
|
+
j(e) || k(t, "must be an object with \"literal\" or \"prop\".");
|
|
822
|
+
let n = Object.keys(e);
|
|
823
|
+
n.length !== 1 && k(t, "must contain exactly one of \"literal\" or \"prop\".");
|
|
824
|
+
let r = n[0];
|
|
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".`);
|
|
828
|
+
}
|
|
829
|
+
function tt(e, t, n, r) {
|
|
830
|
+
j(e) || k(r, "must be an object."), M(e, ke, r);
|
|
831
|
+
let i = {};
|
|
832
|
+
for (let n of [
|
|
833
|
+
"min",
|
|
834
|
+
"max",
|
|
835
|
+
"step"
|
|
836
|
+
]) {
|
|
837
|
+
if (e[n] === void 0) continue;
|
|
838
|
+
let a = et(e[n], `${r}.${n}`);
|
|
839
|
+
if ("prop" in a) {
|
|
840
|
+
let e = t[a.prop];
|
|
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.`);
|
|
842
|
+
}
|
|
843
|
+
n === "step" && "literal" in a && !(a.literal > 0) && k(`${r}.step`, "must be greater than 0."), i[n] = a;
|
|
844
|
+
}
|
|
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;
|
|
846
|
+
}
|
|
847
|
+
function nt(e, t) {
|
|
848
|
+
if (e === "number") return t === "timer" ? /* @__PURE__ */ new Set([
|
|
849
|
+
"duration",
|
|
850
|
+
"min",
|
|
851
|
+
"nearest-zero"
|
|
852
|
+
]) : /* @__PURE__ */ new Set([
|
|
853
|
+
"min",
|
|
854
|
+
"nearest-zero",
|
|
855
|
+
"max-step"
|
|
856
|
+
]);
|
|
857
|
+
if (e === "boolean") return /* @__PURE__ */ new Set(["false"]);
|
|
858
|
+
if (e === "null") return /* @__PURE__ */ new Set(["empty"]);
|
|
859
|
+
if (e === "array") return t === "checklist" ? /* @__PURE__ */ new Set(["checked", "empty-array"]) : /* @__PURE__ */ new Set(["empty-array"]);
|
|
860
|
+
if (e === "number-array") return /* @__PURE__ */ new Set(["empty-array"]);
|
|
861
|
+
switch (t) {
|
|
862
|
+
case "choice":
|
|
863
|
+
case "selection": return /* @__PURE__ */ new Set(["first-option", "none"]);
|
|
864
|
+
case "tabs": return /* @__PURE__ */ new Set(["first-tab"]);
|
|
865
|
+
case "steps": return /* @__PURE__ */ new Set(["first-step"]);
|
|
866
|
+
case "diagram": return /* @__PURE__ */ new Set(["first-node"]);
|
|
867
|
+
case "date": return /* @__PURE__ */ new Set(["empty"]);
|
|
868
|
+
default: return /* @__PURE__ */ new Set(["empty"]);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
function rt(e, t, n, r = !1) {
|
|
872
|
+
j(e) || k(n, "must be an object."), M(e, Oe, n);
|
|
873
|
+
let i = e.kind;
|
|
874
|
+
typeof i == "string" && ye.has(i) || k(`${n}.kind`, "must be \"string\", \"number\", \"boolean\", \"array\", \"number-array\" or \"null\".");
|
|
875
|
+
let a = i, o = e.family;
|
|
876
|
+
typeof o == "string" && be.has(o) || k(`${n}.family`, "must be a supported binding family.");
|
|
877
|
+
let s = o;
|
|
878
|
+
({
|
|
879
|
+
number: /* @__PURE__ */ new Set(["number", "timer"]),
|
|
880
|
+
boolean: /* @__PURE__ */ new Set(["boolean"]),
|
|
881
|
+
string: /* @__PURE__ */ new Set([
|
|
882
|
+
"text",
|
|
883
|
+
"choice",
|
|
884
|
+
"date",
|
|
885
|
+
"tabs",
|
|
886
|
+
"diagram",
|
|
887
|
+
"steps",
|
|
888
|
+
"selection"
|
|
889
|
+
]),
|
|
890
|
+
array: /* @__PURE__ */ new Set([
|
|
891
|
+
"multi-select",
|
|
892
|
+
"checklist",
|
|
893
|
+
"collection"
|
|
894
|
+
]),
|
|
895
|
+
"number-array": /* @__PURE__ */ new Set(["collection"]),
|
|
896
|
+
null: /* @__PURE__ */ new Set(["text"])
|
|
897
|
+
})[a]?.has(s) || k(`${n}.family`, `"${s}" is not supported for a ${a} binding.`);
|
|
898
|
+
let c;
|
|
899
|
+
if (e.options !== void 0) {
|
|
900
|
+
a !== "string" && k(`${n}.options`, "is only valid for a string binding."), s !== "choice" && k(`${n}.options`, "requires family \"choice\".");
|
|
901
|
+
let t = e.options;
|
|
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.");
|
|
903
|
+
let r = /* @__PURE__ */ new Set(), i = [];
|
|
904
|
+
for (let e of t) {
|
|
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);
|
|
907
|
+
}
|
|
908
|
+
c = i;
|
|
909
|
+
}
|
|
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;
|
|
914
|
+
if (e.initialRule === void 0) switch (a) {
|
|
915
|
+
case "number":
|
|
916
|
+
f = s === "timer" ? "duration" : "nearest-zero";
|
|
917
|
+
break;
|
|
918
|
+
case "boolean":
|
|
919
|
+
f = "false";
|
|
920
|
+
break;
|
|
921
|
+
case "array":
|
|
922
|
+
f = s === "checklist" ? "checked" : "empty-array";
|
|
923
|
+
break;
|
|
924
|
+
case "number-array":
|
|
925
|
+
f = "empty-array";
|
|
926
|
+
break;
|
|
927
|
+
case "null":
|
|
928
|
+
f = "empty";
|
|
929
|
+
break;
|
|
930
|
+
default: f = s === "choice" ? "first-option" : s === "tabs" ? "first-tab" : s === "steps" ? "first-step" : s === "diagram" ? "first-node" : s === "selection" ? "none" : "empty";
|
|
931
|
+
}
|
|
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`);
|
|
934
|
+
let p;
|
|
935
|
+
e.constraints !== void 0 && (p = tt(e.constraints, t, a, `${n}.constraints`));
|
|
936
|
+
let m;
|
|
937
|
+
if (e.maxItems !== void 0) {
|
|
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) {
|
|
939
|
+
let e = t[m.prop];
|
|
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.");
|
|
942
|
+
}
|
|
943
|
+
let h;
|
|
944
|
+
if (e.requiresAttributes !== void 0) {
|
|
945
|
+
h = z(e.requiresAttributes, `${n}.requiresAttributes`);
|
|
946
|
+
for (let e of h) Object.hasOwn(t, e) || k(`${n}.requiresAttributes`, `references undeclared prop "${e}".`);
|
|
947
|
+
}
|
|
948
|
+
let g;
|
|
949
|
+
if (e.compare !== void 0) {
|
|
950
|
+
g = z(e.compare, `${n}.compare`);
|
|
951
|
+
for (let e of g) Object.hasOwn(t, e) || k(`${n}.compare`, `references undeclared prop "${e}".`);
|
|
952
|
+
}
|
|
953
|
+
return {
|
|
954
|
+
kind: a,
|
|
955
|
+
family: s,
|
|
956
|
+
bind: l,
|
|
957
|
+
initial: u,
|
|
958
|
+
initialRule: f,
|
|
959
|
+
...e.required === !0 ? { required: !0 } : {},
|
|
960
|
+
...e.exclusive === !0 ? { exclusive: !0 } : {},
|
|
961
|
+
...c ? { options: c } : {},
|
|
962
|
+
...p ? { constraints: p } : {},
|
|
963
|
+
...m ? { maxItems: m } : {},
|
|
964
|
+
...h ? { requiresAttributes: h } : {},
|
|
965
|
+
...g ? { compare: g } : {},
|
|
966
|
+
...e.retain === !1 ? { retain: !1 } : {}
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
function it(e, t) {
|
|
970
|
+
j(e) || k(t, "must be an object."), M(e, Pe, t);
|
|
971
|
+
let n = e.id;
|
|
972
|
+
(typeof n != "string" || !T.test(n) || n.length > 160) && k(`${t}.id`, "must be a lowercase namespaced id.");
|
|
973
|
+
let r;
|
|
974
|
+
if (e.version !== void 0) {
|
|
975
|
+
let n = e.version, i = o(n);
|
|
976
|
+
i === null && k(`${t}.version`, "must be an exact version or a supported range (exact, ^, ~, >=, <=, >, <)."), r = i.source;
|
|
977
|
+
}
|
|
978
|
+
return {
|
|
979
|
+
id: n,
|
|
980
|
+
...r ? { version: r } : {}
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
function at(e) {
|
|
984
|
+
j(e) || k("requires", "must be an object."), M(e, Fe, "requires");
|
|
985
|
+
let t;
|
|
986
|
+
if (e.kernel !== void 0) {
|
|
987
|
+
let n = o(e.kernel);
|
|
988
|
+
n === null && k("requires.kernel", "must be a supported kernel version range (exact, ^, ~, >=, <=, >, <)."), t = n.source;
|
|
989
|
+
}
|
|
990
|
+
return { ...t ? { kernel: t } : {} };
|
|
991
|
+
}
|
|
992
|
+
function ot(e, t) {
|
|
993
|
+
j(e) || k("replaces", "must be an object."), M(e, Ie, "replaces");
|
|
994
|
+
let n = e.id;
|
|
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.");
|
|
996
|
+
let r;
|
|
997
|
+
if (e.version !== void 0) {
|
|
998
|
+
let t = o(e.version);
|
|
999
|
+
t === null && k("replaces.version", "must be an exact version or a supported range (exact, ^, ~, >=, <=, >, <)."), r = t.source;
|
|
1000
|
+
}
|
|
1001
|
+
return {
|
|
1002
|
+
id: n,
|
|
1003
|
+
...r ? { version: r } : {}
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
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.");
|
|
1008
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1009
|
+
for (let r = 0; r < e.length; r += 1) {
|
|
1010
|
+
let i = e[r];
|
|
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);
|
|
1012
|
+
}
|
|
1013
|
+
return n;
|
|
1014
|
+
}
|
|
1015
|
+
function W(e) {
|
|
1016
|
+
if (typeof e == "object" && e && D.has(e)) return e;
|
|
1017
|
+
j(e) || k("manifest", "must be an object."), M(e, Ee, "manifest");
|
|
1018
|
+
let t = e.id;
|
|
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}".`);
|
|
1022
|
+
let i = e.form;
|
|
1023
|
+
typeof i == "string" && ve.has(i) || k("form", "must be \"leaf\", \"inline\" or \"container\".");
|
|
1024
|
+
let a = i;
|
|
1025
|
+
j(e.props) || k("props", "must be an object.");
|
|
1026
|
+
let o = Object.keys(e.props).sort();
|
|
1027
|
+
o.length > 64 && k("props", "accepts at most 64 properties.");
|
|
1028
|
+
let s = {};
|
|
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}`);
|
|
1030
|
+
let l;
|
|
1031
|
+
if (e.bindings !== void 0) {
|
|
1032
|
+
j(e.bindings) || k("bindings", "must be an object.");
|
|
1033
|
+
let t = Object.keys(e.bindings);
|
|
1034
|
+
t.length === 0 && k("bindings", "must declare at least one binding slot."), t.length > 16 && k("bindings", "accepts at most 16 slots.");
|
|
1035
|
+
let n = {}, r = /* @__PURE__ */ new Set();
|
|
1036
|
+
for (let i of t) {
|
|
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);
|
|
1041
|
+
n[i] = i === "value" ? t : {
|
|
1042
|
+
...t,
|
|
1043
|
+
exclusive: !0
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
l = n;
|
|
1047
|
+
}
|
|
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;
|
|
1055
|
+
if (e.dependencies !== void 0) {
|
|
1056
|
+
Array.isArray(e.dependencies) || k("dependencies", "must be an array."), e.dependencies.length > 16 && k("dependencies", "accepts at most 16 entries.");
|
|
1057
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1058
|
+
for (let r = 0; r < e.dependencies.length; r += 1) {
|
|
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);
|
|
1061
|
+
}
|
|
1062
|
+
y = n;
|
|
1063
|
+
}
|
|
1064
|
+
let b = {
|
|
1065
|
+
id: t,
|
|
1066
|
+
name: n,
|
|
1067
|
+
version: r,
|
|
1068
|
+
protocol: c,
|
|
1069
|
+
form: a,
|
|
1070
|
+
props: s,
|
|
1071
|
+
...l ? { bindings: l } : {},
|
|
1072
|
+
...u ? { children: u } : {},
|
|
1073
|
+
...d && !u ? { structure: d } : {},
|
|
1074
|
+
...f ? { rules: f } : {},
|
|
1075
|
+
...p ? { slotRelations: p } : {},
|
|
1076
|
+
...e.legacyHost === !0 ? { legacyHost: !0 } : {},
|
|
1077
|
+
capabilities: m,
|
|
1078
|
+
...h ? { authoring: h } : {},
|
|
1079
|
+
...g ? { styles: g } : {},
|
|
1080
|
+
..._ ? { requires: _ } : {},
|
|
1081
|
+
...y ? { dependencies: y } : {},
|
|
1082
|
+
...v ? { replaces: v } : {}
|
|
1083
|
+
};
|
|
1084
|
+
A(b) > 65536 && k("manifest", `serialized size exceeds the ${me}-byte budget.`);
|
|
1085
|
+
let x = lt(b);
|
|
1086
|
+
return D.add(x), x;
|
|
1087
|
+
}
|
|
1088
|
+
function ct(e) {
|
|
1089
|
+
return W(e);
|
|
1090
|
+
}
|
|
1091
|
+
function lt(e) {
|
|
1092
|
+
if (typeof e != "object" || !e) return e;
|
|
1093
|
+
for (let t of Object.keys(e)) lt(e[t]);
|
|
1094
|
+
return Object.freeze(e);
|
|
1095
|
+
}
|
|
1096
|
+
function ut(e) {
|
|
1097
|
+
return {
|
|
1098
|
+
kind: e.kind,
|
|
1099
|
+
...e.required === !0 ? { required: !0 } : {},
|
|
1100
|
+
...e.static === !0 ? { static: !0 } : {},
|
|
1101
|
+
...e.dynamic === void 0 ? {} : { dynamic: e.dynamic },
|
|
1102
|
+
...e.default === void 0 ? {} : { default: e.default },
|
|
1103
|
+
...e.nullable === !0 ? { nullable: !0 } : {},
|
|
1104
|
+
...e.enum ? { enum: [...e.enum] } : {},
|
|
1105
|
+
...e.pattern === void 0 ? {} : { pattern: e.pattern },
|
|
1106
|
+
...e.min === void 0 ? {} : { min: e.min },
|
|
1107
|
+
...e.max === void 0 ? {} : { max: e.max },
|
|
1108
|
+
...e.integer === !0 ? { integer: !0 } : {},
|
|
1109
|
+
...e.positive === !0 ? { positive: !0 } : {},
|
|
1110
|
+
...e.allowPositiveNumber === !0 ? { allowPositiveNumber: !0 } : {},
|
|
1111
|
+
...e.color === !0 ? { color: !0 } : {},
|
|
1112
|
+
...e.coerce === void 0 ? {} : { coerce: e.coerce }
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
function G(e) {
|
|
1116
|
+
return "literal" in e ? { literal: e.literal } : { prop: e.prop };
|
|
1117
|
+
}
|
|
1118
|
+
function dt(e) {
|
|
1119
|
+
return {
|
|
1120
|
+
...e.min ? { min: G(e.min) } : {},
|
|
1121
|
+
...e.max ? { max: G(e.max) } : {},
|
|
1122
|
+
...e.step ? { step: G(e.step) } : {}
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
function ft(e) {
|
|
1126
|
+
let t = e.constraints;
|
|
1127
|
+
return {
|
|
1128
|
+
kind: e.kind,
|
|
1129
|
+
family: e.family,
|
|
1130
|
+
bind: e.bind,
|
|
1131
|
+
initial: e.initial,
|
|
1132
|
+
initialRule: e.initialRule,
|
|
1133
|
+
...e.required === !0 ? { required: !0 } : {},
|
|
1134
|
+
...e.exclusive === !0 ? { exclusive: !0 } : {},
|
|
1135
|
+
...e.options ? { options: [...e.options] } : {},
|
|
1136
|
+
...t ? { constraints: dt(t) } : {},
|
|
1137
|
+
...e.maxItems ? { maxItems: G(e.maxItems) } : {},
|
|
1138
|
+
...e.requiresAttributes ? { requiresAttributes: [...e.requiresAttributes] } : {},
|
|
1139
|
+
...e.compare ? { compare: [...e.compare] } : {},
|
|
1140
|
+
...e.retain === !1 ? { retain: !1 } : {}
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
function pt(e) {
|
|
1144
|
+
return {
|
|
1145
|
+
rule: e.rule,
|
|
1146
|
+
...e.label === void 0 ? {} : { label: e.label },
|
|
1147
|
+
...e.parents ? { parents: [...e.parents] } : {},
|
|
1148
|
+
...e.child === void 0 ? {} : { child: e.child },
|
|
1149
|
+
...e.children ? { children: [...e.children] } : {},
|
|
1150
|
+
...e.min === void 0 ? {} : { min: e.min },
|
|
1151
|
+
...e.max === void 0 ? {} : { max: e.max },
|
|
1152
|
+
...e.inlineOnly === void 0 ? {} : { inlineOnly: e.inlineOnly },
|
|
1153
|
+
...e.noComponents === void 0 ? {} : { noComponents: e.noComponents },
|
|
1154
|
+
...e.valueAttribute === void 0 ? {} : { valueAttribute: e.valueAttribute },
|
|
1155
|
+
...e.generatedPrefix === void 0 ? {} : { generatedPrefix: e.generatedPrefix },
|
|
1156
|
+
...e.forbidSeparator === void 0 ? {} : { forbidSeparator: e.forbidSeparator },
|
|
1157
|
+
...e.maxItems === void 0 ? {} : { maxItems: e.maxItems }
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
function mt(e) {
|
|
1161
|
+
let t = e, n = Object.keys(t).sort(), r = {};
|
|
1162
|
+
for (let e of n) {
|
|
1163
|
+
let n = t[e];
|
|
1164
|
+
r[e] = Array.isArray(n) ? n.map((e) => Array.isArray(e) ? [...e] : e) : n;
|
|
1165
|
+
}
|
|
1166
|
+
return r;
|
|
1167
|
+
}
|
|
1168
|
+
function ht(e) {
|
|
1169
|
+
let t = {};
|
|
1170
|
+
for (let n of Object.keys(e.props).sort()) t[n] = ut(e.props[n]);
|
|
1171
|
+
let n = {};
|
|
1172
|
+
if (e.bindings) for (let t of Object.keys(e.bindings).sort()) n[t] = ft(e.bindings[t]);
|
|
1173
|
+
return {
|
|
1174
|
+
protocol: e.protocol,
|
|
1175
|
+
id: e.id,
|
|
1176
|
+
name: e.name,
|
|
1177
|
+
version: e.version,
|
|
1178
|
+
form: e.form,
|
|
1179
|
+
props: t,
|
|
1180
|
+
...e.bindings ? { bindings: n } : {},
|
|
1181
|
+
...e.children ? { children: {
|
|
1182
|
+
kind: e.children.kind,
|
|
1183
|
+
...e.children.required ? { required: !0 } : {}
|
|
1184
|
+
} } : {},
|
|
1185
|
+
...e.structure ? { structure: pt(e.structure) } : {},
|
|
1186
|
+
...e.rules ? { rules: e.rules.map(mt) } : {},
|
|
1187
|
+
...e.slotRelations ? { slotRelations: e.slotRelations.map((e) => ({ ...e })) } : {},
|
|
1188
|
+
capabilities: {
|
|
1189
|
+
interactive: e.capabilities.interactive,
|
|
1190
|
+
static: e.capabilities.static,
|
|
1191
|
+
ssr: e.capabilities.ssr,
|
|
1192
|
+
offline: e.capabilities.offline
|
|
1193
|
+
},
|
|
1194
|
+
...e.styles ? { styles: [...e.styles] } : {},
|
|
1195
|
+
...e.requires?.kernel ? { requires: { kernel: e.requires.kernel } } : {},
|
|
1196
|
+
...e.dependencies ? { dependencies: [...e.dependencies].map((e) => ({ ...e })).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)) } : {},
|
|
1197
|
+
...e.replaces ? { replaces: {
|
|
1198
|
+
id: e.replaces.id,
|
|
1199
|
+
...e.replaces.version ? { version: e.replaces.version } : {}
|
|
1200
|
+
} } : {}
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
var gt = /* @__PURE__ */ new WeakMap();
|
|
1204
|
+
function K(e) {
|
|
1205
|
+
let t = D.has(e) ? e : W(e), n = gt.get(t);
|
|
1206
|
+
if (n !== void 0) return n;
|
|
1207
|
+
let r = x(JSON.stringify(ht(t)));
|
|
1208
|
+
return gt.set(t, r), r;
|
|
1209
|
+
}
|
|
1210
|
+
function _t(e) {
|
|
1211
|
+
return Object.freeze({
|
|
1212
|
+
id: e.id,
|
|
1213
|
+
name: e.name,
|
|
1214
|
+
version: e.version,
|
|
1215
|
+
digest: K(e)
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
function vt(e) {
|
|
1219
|
+
return typeof e == "string" && e.length <= 128 && w.test(e);
|
|
1220
|
+
}
|
|
1221
|
+
function q(e) {
|
|
1222
|
+
return typeof e == "string" && e.length > 0 && e.length <= 160 && T.test(e);
|
|
1223
|
+
}
|
|
1224
|
+
// src/sdk/default-identity.ts
|
|
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([
|
|
1226
|
+
"__proto__",
|
|
1227
|
+
"constructor",
|
|
1228
|
+
"prototype"
|
|
1229
|
+
]), kt = /* @__PURE__ */ new Set([
|
|
1230
|
+
"protocol",
|
|
1231
|
+
"id",
|
|
1232
|
+
"version",
|
|
1233
|
+
"components",
|
|
1234
|
+
"authoring",
|
|
1235
|
+
"themes",
|
|
1236
|
+
"dependencies",
|
|
1237
|
+
"metadata"
|
|
1238
|
+
]), At = /* @__PURE__ */ new Set([
|
|
1239
|
+
"title",
|
|
1240
|
+
"description",
|
|
1241
|
+
"category",
|
|
1242
|
+
"insertText"
|
|
1243
|
+
]), jt = /* @__PURE__ */ new Set(["title", "description"]), Mt = /* @__PURE__ */ new Set(["id", "version"]), J = /* @__PURE__ */ new WeakSet();
|
|
1244
|
+
function Y(e, t) {
|
|
1245
|
+
throw Error(`Invalid local preset (${e}): ${t}`);
|
|
1246
|
+
}
|
|
1247
|
+
function X(e) {
|
|
1248
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
1249
|
+
let t = Object.getPrototypeOf(e);
|
|
1250
|
+
return t === Object.prototype || t === null;
|
|
1251
|
+
}
|
|
1252
|
+
function Z(e, t, n) {
|
|
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}".`);
|
|
1254
|
+
}
|
|
1255
|
+
function Q(e, t) {
|
|
1256
|
+
X(e) || Y(t, "must be a locale-keyed string map.");
|
|
1257
|
+
let n = {};
|
|
1258
|
+
for (let r of Object.keys(e).sort()) {
|
|
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".`);
|
|
1260
|
+
let i = e[r];
|
|
1261
|
+
(typeof i != "string" || i.length > Et) && Y(t, `locale "${r}" must be a bounded string.`), n[r] = i;
|
|
1262
|
+
}
|
|
1263
|
+
return Object.freeze(n);
|
|
1264
|
+
}
|
|
1265
|
+
function Nt(e) {
|
|
1266
|
+
X(e) || Y("authoring", "must be an object."), Z(e, At, "authoring");
|
|
1267
|
+
let t = {};
|
|
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);
|
|
1269
|
+
}
|
|
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.`);
|
|
1272
|
+
let n = new Set(t.map((e) => e.id)), r = /* @__PURE__ */ new Set(), i = [];
|
|
1273
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
1274
|
+
let a = e[t];
|
|
1275
|
+
X(a) || Y(`authoring[${t}]`, "must be an object."), Z(a, /* @__PURE__ */ new Set(["componentId", "authoring"]), `authoring[${t}]`);
|
|
1276
|
+
let o = a.componentId;
|
|
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({
|
|
1278
|
+
componentId: o,
|
|
1279
|
+
authoring: Nt(a.authoring)
|
|
1280
|
+
}));
|
|
1281
|
+
}
|
|
1282
|
+
return Object.freeze(i.sort((e, t) => e.componentId < t.componentId ? -1 : +(e.componentId > t.componentId)));
|
|
1283
|
+
}
|
|
1284
|
+
function Ft(e) {
|
|
1285
|
+
Array.isArray(e) || Y("dependencies", "must be an array."), e.length > wt && Y("dependencies", `accepts at most ${wt} entries.`);
|
|
1286
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1287
|
+
for (let r = 0; r < e.length; r += 1) {
|
|
1288
|
+
let i = e[r];
|
|
1289
|
+
X(i) || Y(`dependencies[${r}]`, "must be an object."), Z(i, Mt, `dependencies[${r}]`);
|
|
1290
|
+
let o = i.id;
|
|
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);
|
|
1292
|
+
let s = i.version;
|
|
1293
|
+
typeof s == "string" && a(s) || Y(`dependencies[${r}].version`, "must be an exact semantic version."), n.push(Object.freeze({
|
|
1294
|
+
id: o,
|
|
1295
|
+
version: s
|
|
1296
|
+
}));
|
|
1297
|
+
}
|
|
1298
|
+
return Object.freeze(n.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
|
|
1299
|
+
}
|
|
1300
|
+
function It(e) {
|
|
1301
|
+
Array.isArray(e) || Y("themes", "must be an array.");
|
|
1302
|
+
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
1303
|
+
for (let i = 0; i < e.length; i += 1) {
|
|
1304
|
+
let o = e[i];
|
|
1305
|
+
X(o) || Y(`themes[${i}]`, "must be an object.");
|
|
1306
|
+
let s = o.id, c = o.name, l = o.version;
|
|
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
|
+
}));
|
|
1313
|
+
}
|
|
1314
|
+
return Object.freeze(t.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
|
|
1315
|
+
}
|
|
1316
|
+
function Lt(e) {
|
|
1317
|
+
return X(e) || Y("metadata", "must be an object."), Z(e, jt, "metadata"), Object.freeze({
|
|
1318
|
+
...e.title === void 0 ? {} : { title: Q(e.title, "metadata.title") },
|
|
1319
|
+
...e.description === void 0 ? {} : { description: Q(e.description, "metadata.description") }
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
function $(e) {
|
|
1323
|
+
if (X(e) && J.has(e)) return 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}".`);
|
|
1325
|
+
let t = e.id;
|
|
1326
|
+
(typeof t != "string" || t.length > St || !Dt.test(t)) && Y("id", "must be a lowercase namespaced id.");
|
|
1327
|
+
let n = e.version;
|
|
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.`);
|
|
1329
|
+
let r = [], i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
1330
|
+
for (let t = 0; t < e.components.length; t += 1) {
|
|
1331
|
+
let n;
|
|
1332
|
+
try {
|
|
1333
|
+
n = ct(e.components[t]);
|
|
1334
|
+
} catch (e) {
|
|
1335
|
+
Y(`components[${t}]`, e instanceof Error ? e.message : String(e));
|
|
1336
|
+
}
|
|
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);
|
|
1338
|
+
}
|
|
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({
|
|
1340
|
+
protocol: l,
|
|
1341
|
+
id: t,
|
|
1342
|
+
version: n,
|
|
1343
|
+
components: p,
|
|
1344
|
+
...s ? { authoring: s } : {},
|
|
1345
|
+
...c ? { themes: c } : {},
|
|
1346
|
+
...u ? { dependencies: u } : {},
|
|
1347
|
+
...d ? { metadata: d } : {}
|
|
1348
|
+
});
|
|
1349
|
+
return J.add(m), m;
|
|
1350
|
+
}
|
|
1351
|
+
function Rt(e) {
|
|
1352
|
+
return $(e);
|
|
1353
|
+
}
|
|
1354
|
+
function zt(e) {
|
|
1355
|
+
let t = $(e);
|
|
1356
|
+
return x(JSON.stringify({
|
|
1357
|
+
protocol: l,
|
|
1358
|
+
id: t.id,
|
|
1359
|
+
version: t.version,
|
|
1360
|
+
components: [...t.components].map((e) => ({
|
|
1361
|
+
id: e.id,
|
|
1362
|
+
version: e.version,
|
|
1363
|
+
digest: K(e)
|
|
1364
|
+
})).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)),
|
|
1365
|
+
dependencies: [...t.dependencies ?? []].map((e) => ({
|
|
1366
|
+
id: e.id,
|
|
1367
|
+
version: e.version
|
|
1368
|
+
})).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id))
|
|
1369
|
+
}));
|
|
1370
|
+
}
|
|
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 };
|