reactive-md 0.6.1 → 0.8.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 +66 -0
- package/CHANGELOG.md +66 -0
- package/CONTRIBUTING-ch.md +6 -62
- package/CONTRIBUTING.md +5 -63
- package/README-ch.md +232 -67
- package/README-en.md +209 -71
- package/README.md +209 -71
- package/SECURITY-ch.md +3 -1
- package/SECURITY.md +3 -1
- package/THIRD_PARTY_NOTICES.md +1909 -87
- package/cli/args.mjs +33 -1
- package/cli/build.mjs +62 -1
- package/cli/check.mjs +444 -0
- package/cli/help.mjs +181 -3
- package/cli/init.mjs +1577 -0
- package/cli/main.mjs +11 -1
- package/cli/package-loader.mjs +41 -0
- package/dist-library/LocalDocumentView-6trX7xJc.js +97920 -0
- package/dist-library/{authoring-BEVyth5X.js → authoring-BsfSwQRm.js} +237 -209
- package/dist-library/compiler--ea2CKQF.js +61 -0
- package/dist-library/compiler-core-kPiH-gOV.js +11805 -0
- package/dist-library/component-state-Cq2K5gkS.js +490 -0
- package/dist-library/component-state-D_cw_EHe.js +54 -0
- package/dist-library/config-validation-DXTynAw7.js +3005 -0
- package/dist-library/default-components-Z_YMio5P.js +2346 -0
- package/dist-library/identity-MYJXKSkB.js +1443 -0
- package/dist-library/math-display-BJz4gbFc.js +24000 -0
- package/dist-library/math-sample-BGEW49zY.js +1124 -0
- package/dist-library/options-CX5m5n-J.js +115 -0
- package/dist-library/parser-standard-DlCk7sLo.js +10122 -0
- package/dist-library/props-DGlBk0e5.js +183 -0
- package/dist-library/react-ByOHunUW.js +122 -0
- package/dist-library/reactive-md-authoring.js +712 -1077
- package/dist-library/reactive-md-build.js +7966 -0
- package/dist-library/reactive-md-compiler-standard.js +33 -0
- package/dist-library/reactive-md-compiler.js +22 -0
- package/dist-library/reactive-md-default-packs.js +71 -0
- package/dist-library/reactive-md-default-preset.js +10 -0
- package/dist-library/reactive-md-export.js +111 -0
- package/dist-library/reactive-md-print.css +18 -3
- package/dist-library/reactive-md-react-runtime.js +251 -0
- package/dist-library/reactive-md-react-server.js +55 -0
- package/dist-library/reactive-md-react-unstyled.js +9 -1
- package/dist-library/reactive-md-react.js +9 -1
- package/dist-library/reactive-md-runtime-browser.js +51 -0
- package/dist-library/reactive-md-runtime.js +3 -0
- package/dist-library/reactive-md-sdk.js +6 -0
- package/dist-library/reactive-md-standalone-host.js +442 -0
- package/dist-library/reactive-md-testing-browser.js +523 -0
- package/dist-library/reactive-md-testing-react.js +221 -0
- package/dist-library/reactive-md-testing.js +638 -0
- package/dist-library/reactive-md-vite.js +959 -0
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +1080 -795
- package/dist-library/registry-B9Jc3FVe.js +1174 -0
- package/dist-library/resources-BGt8mpDA.js +204 -0
- package/dist-library/runtime-C-sbfpOX.js +1157 -0
- package/dist-library/runtime-Dkq7ldyg.js +172 -0
- package/dist-library/schema-ZFufO8V0.js +39 -0
- package/dist-library/shareable-DDVL4Fi9.js +844 -0
- package/dist-library/types/authoring/catalog.d.ts +168 -0
- package/dist-library/types/authoring/conformance.d.ts +24 -0
- package/dist-library/types/{editor → authoring}/editor-i18n.d.ts +3 -24
- package/dist-library/types/authoring/extensions.d.ts +13 -0
- package/dist-library/types/authoring/index.d.ts +14 -11
- package/dist-library/types/authoring/insert.d.ts +16 -0
- package/dist-library/types/{editor → authoring}/native-components.d.ts +19 -2
- package/dist-library/types/authoring/templates.d.ts +65 -0
- package/dist-library/types/build/diagnostics.d.ts +8 -0
- package/dist-library/types/build/digest.d.ts +5 -0
- package/dist-library/types/build/entry.d.ts +9 -0
- package/dist-library/types/build/host.d.ts +36 -0
- package/dist-library/types/build/index.d.ts +99 -0
- package/dist-library/types/build/notices.d.ts +29 -0
- package/dist-library/types/build/resources.d.ts +60 -0
- package/dist-library/types/build/vite.d.ts +15 -0
- package/dist-library/types/compiler/index.d.ts +22 -0
- package/dist-library/types/compiler/result.d.ts +30 -0
- package/dist-library/types/compiler/standard.d.ts +16 -0
- package/dist-library/types/compiler/types.d.ts +69 -0
- package/dist-library/types/components/chart-motion.d.ts +12 -0
- package/dist-library/types/components/controls.d.ts +21 -0
- package/dist-library/types/{local → components}/data-table.d.ts +10 -24
- package/dist-library/types/components/default-chart-types.d.ts +22 -0
- package/dist-library/types/components/default-chart.d.ts +2 -0
- package/dist-library/types/components/default-preset.d.ts +10 -0
- package/dist-library/types/components/diagram-inspector.d.ts +24 -0
- package/dist-library/types/components/gallery.d.ts +6 -0
- package/dist-library/types/components/layout.d.ts +23 -0
- package/dist-library/types/components/mafs-plot-grid.d.ts +57 -0
- package/dist-library/types/components/mafs-visuals.d.ts +40 -0
- package/dist-library/types/components/numeric-sliders.d.ts +3 -0
- package/dist-library/types/components/uiarc/calendar/calendar.d.ts +26 -0
- package/dist-library/types/components/uiarc/date-picker/date-picker.d.ts +29 -0
- package/dist-library/types/components/uiarc/lib/motion-tokens.d.ts +2 -0
- package/dist-library/types/components/uiarc/lib/use-today.d.ts +2 -0
- package/dist-library/types/components/uiarc/motion-tokens.d.ts +60 -0
- package/dist-library/types/components/uiarc/rmd-motion.d.ts +12 -0
- package/dist-library/types/components/uiarc/select/select.d.ts +21 -0
- package/dist-library/types/components/uiarc/slider/slider.d.ts +53 -0
- package/dist-library/types/components/use-hydrated.d.ts +6 -0
- package/dist-library/types/components/visuals.d.ts +13 -0
- package/dist-library/types/export/component-state.d.ts +39 -0
- package/dist-library/types/export/index.d.ts +47 -0
- package/dist-library/types/export/requirements.d.ts +23 -0
- package/dist-library/types/export/resources.d.ts +8 -0
- package/dist-library/types/export/restoration.d.ts +52 -0
- package/dist-library/types/index.d.ts +1 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +16 -0
- package/dist-library/types/local/compilation/compiler-services.d.ts +64 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +46 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +9 -0
- package/dist-library/types/local/compilation/compiler.d.ts +34 -0
- package/dist-library/types/local/compilation/component-kernel.d.ts +487 -0
- package/dist-library/types/local/{dependencies.d.ts → compilation/dependencies.d.ts} +4 -3
- package/dist-library/types/local/{diagnostics.d.ts → configuration/diagnostic-messages.d.ts} +193 -65
- package/dist-library/types/local/configuration/diagnostics.d.ts +58 -0
- package/dist-library/types/local/{limits.d.ts → configuration/limits.d.ts} +15 -2
- package/dist-library/types/local/configuration/options-core.d.ts +120 -0
- package/dist-library/types/local/configuration/options.d.ts +17 -0
- package/dist-library/types/local/configuration/portable-options.d.ts +3 -0
- package/dist-library/types/local/configuration/schema-core.d.ts +32 -0
- package/dist-library/types/local/configuration/schema.d.ts +12 -0
- package/dist-library/types/local/contracts/types.d.ts +519 -0
- package/dist-library/types/local/{version.d.ts → contracts/version.d.ts} +1 -1
- package/dist-library/types/local/{computations.d.ts → evaluation/computations.d.ts} +6 -3
- package/dist-library/types/local/{expression.d.ts → evaluation/expression.d.ts} +2 -2
- package/dist-library/types/local/{math-display.d.ts → evaluation/math-display.d.ts} +2 -16
- package/dist-library/types/local/evaluation/math-sample.d.ts +23 -0
- package/dist-library/types/local/evaluation/math.d.ts +73 -0
- package/dist-library/types/local/{validation.d.ts → evaluation/validation.d.ts} +1 -1
- package/dist-library/types/local/html/html-details.d.ts +16 -0
- package/dist-library/types/local/html/html-entities.d.ts +7 -0
- package/dist-library/types/local/html/html-policy.d.ts +43 -0
- package/dist-library/types/local/html/html-recovery.d.ts +16 -0
- package/dist-library/types/local/html/html-table-names.d.ts +9 -0
- package/dist-library/types/local/{html-table.d.ts → html/html-table.d.ts} +2 -6
- package/dist-library/types/local/{html.d.ts → html/html.d.ts} +1 -1
- package/dist-library/types/local/index.d.ts +31 -24
- package/dist-library/types/local/markdown/fast-markdown.d.ts +137 -0
- package/dist-library/types/local/{footnotes.d.ts → markdown/footnotes.d.ts} +1 -1
- package/dist-library/types/local/{heading-anchors.d.ts → markdown/heading-anchors.d.ts} +12 -2
- package/dist-library/types/local/markdown/markdown-blocks.d.ts +55 -0
- package/dist-library/types/local/markdown/markdown-structure.d.ts +3 -0
- package/dist-library/types/local/markdown/plain-paragraphs.d.ts +10 -0
- package/dist-library/types/local/parsing/lexical.d.ts +21 -0
- package/dist-library/types/local/parsing/parse-budget.d.ts +67 -0
- package/dist-library/types/local/parsing/parser-capabilities.d.ts +42 -0
- package/dist-library/types/local/parsing/parser-core.d.ts +65 -0
- package/dist-library/types/local/parsing/parser-standard.d.ts +7 -0
- package/dist-library/types/local/parsing/parser.d.ts +16 -0
- package/dist-library/types/local/parsing/rmd-recovery.d.ts +48 -0
- package/dist-library/types/local/{LocalDocumentView.d.ts → rendering/LocalDocumentView.d.ts} +67 -24
- package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +36 -0
- package/dist-library/types/local/rendering/render-types.d.ts +57 -0
- package/dist-library/types/local/rendering/view-revision.d.ts +75 -0
- package/dist-library/types/local/{retention.d.ts → runtime/retention.d.ts} +1 -1
- package/dist-library/types/local/runtime/runtime.d.ts +34 -0
- package/dist-library/types/local/{state.d.ts → runtime/state.d.ts} +4 -4
- package/dist-library/types/local/session/compiler-cache.d.ts +44 -0
- package/dist-library/types/local/session/incremental.d.ts +48 -0
- package/dist-library/types/local/session/parse-session.d.ts +62 -0
- package/dist-library/types/local/session/row-reuse.d.ts +46 -0
- package/dist-library/types/local/{authoring.d.ts → source/authoring.d.ts} +11 -3
- package/dist-library/types/local/source/node-walk.d.ts +3 -0
- package/dist-library/types/local/source/source-context.d.ts +63 -0
- package/dist-library/types/local/{source-migration.d.ts → source/source-migration.d.ts} +2 -2
- package/dist-library/types/local/{i18n.d.ts → theme/i18n.d.ts} +2 -2
- package/dist-library/types/local/theme/theme-name.d.ts +3 -0
- package/dist-library/types/local/{theme.d.ts → theme/theme.d.ts} +3 -3
- package/dist-library/types/local/transport/compile-patch.d.ts +127 -0
- package/dist-library/types/local/{compiled-data.d.ts → transport/compiled-data.d.ts} +1 -1
- package/dist-library/types/local/transport/flat-compiled-data.d.ts +17 -0
- package/dist-library/types/local/transport/shared-data.d.ts +10 -0
- package/dist-library/types/local/transport/worker.d.ts +265 -0
- package/dist-library/types/local/widgets/visuals.d.ts +25 -0
- package/dist-library/types/presets/default-authoring.d.ts +50 -0
- package/dist-library/types/presets/default-components.d.ts +4 -0
- package/dist-library/types/presets/default-semantics.d.ts +8 -0
- package/dist-library/types/presets/default.d.ts +11 -0
- package/dist-library/types/presets/identity.d.ts +7 -0
- package/dist-library/types/presets/packs.d.ts +4 -0
- package/dist-library/types/react/component-api.d.ts +260 -0
- package/dist-library/types/react/component-primitives.d.ts +21 -0
- package/dist-library/types/react/component-utils.d.ts +125 -0
- package/dist-library/types/react/default-theme.d.ts +6 -0
- package/dist-library/types/react/field-validation.d.ts +11 -0
- package/dist-library/types/react/index.d.ts +17 -5
- package/dist-library/types/react/overflow-text-tooltip.d.ts +6 -0
- package/dist-library/types/react/package.d.ts +69 -0
- package/dist-library/types/react/runtime/common.d.ts +4 -0
- package/dist-library/types/react/runtime/index.d.ts +8 -0
- package/dist-library/types/react/runtime/useComponentState.d.ts +30 -0
- package/dist-library/types/react/runtime/useKeys.d.ts +16 -0
- package/dist-library/types/react/runtime/useSwipe.d.ts +27 -0
- package/dist-library/types/react/runtime/useTicker.d.ts +17 -0
- package/dist-library/types/react/sdk.d.ts +110 -0
- package/dist-library/types/react/server.d.ts +15 -0
- package/dist-library/types/react/tooltip-layer.d.ts +10 -0
- package/dist-library/types/react/use-draft-field.d.ts +17 -0
- package/dist-library/types/runtime-services/browser/index.d.ts +63 -0
- package/dist-library/types/runtime-services/component-state.d.ts +152 -0
- package/dist-library/types/runtime-services/identity.d.ts +41 -0
- package/dist-library/types/runtime-services/index.d.ts +10 -0
- package/dist-library/types/runtime-services/random.d.ts +42 -0
- package/dist-library/types/runtime-services/runtime.d.ts +51 -0
- package/dist-library/types/runtime-services/scheduler.d.ts +44 -0
- package/dist-library/types/sdk/assembly.d.ts +73 -0
- package/dist-library/types/sdk/compat-profile.d.ts +57 -0
- package/dist-library/types/sdk/compiler-config.d.ts +33 -0
- package/dist-library/types/sdk/config-validation.d.ts +33 -0
- package/dist-library/types/sdk/config.d.ts +35 -0
- package/dist-library/types/sdk/hash.d.ts +9 -0
- package/dist-library/types/sdk/index.d.ts +10 -0
- package/dist-library/types/sdk/manifest.d.ts +49 -0
- package/dist-library/types/sdk/pattern.d.ts +11 -0
- package/dist-library/types/sdk/preset-core.d.ts +11 -0
- package/dist-library/types/sdk/preset.d.ts +9 -0
- package/dist-library/types/sdk/props.d.ts +33 -0
- package/dist-library/types/sdk/registry-core.d.ts +16 -0
- package/dist-library/types/sdk/registry.d.ts +18 -0
- package/dist-library/types/sdk/theme.d.ts +73 -0
- package/dist-library/types/sdk/types.d.ts +221 -0
- package/dist-library/types/sdk/version.d.ts +49 -0
- package/dist-library/types/shareable.d.ts +29 -3
- package/dist-library/types/standalone/diagnostics.d.ts +16 -0
- package/dist-library/types/standalone/events.d.ts +4 -0
- package/dist-library/types/standalone/library.d.ts +6 -0
- package/dist-library/types/standalone/payload.d.ts +15 -0
- package/dist-library/types/standalone/prepare.d.ts +21 -0
- package/dist-library/types/standalone/session.d.ts +68 -0
- package/dist-library/types/standalone/version.d.ts +7 -0
- package/dist-library/types/testing/behavior.d.ts +19 -0
- package/dist-library/types/testing/browser.d.ts +126 -0
- package/dist-library/types/testing/cases.d.ts +16 -0
- package/dist-library/types/testing/index.d.ts +13 -0
- package/dist-library/types/testing/manifest.d.ts +10 -0
- package/dist-library/types/testing/react.d.ts +45 -0
- package/dist-library/types/testing/report.d.ts +20 -0
- package/dist-library/types/testing/types.d.ts +125 -0
- package/dist-library/types/testing/values.d.ts +22 -0
- package/dist-library/types/vite/client.d.ts +36 -0
- package/dist-library/types/vite/discovery.d.ts +51 -0
- package/dist-library/types/vite/index.d.ts +31 -0
- package/dist-library/types/vite/registration.d.ts +109 -0
- package/dist-library/types-BFCrMrg0.js +52 -0
- package/dist-library/validation-W-bmny-x.js +2253 -0
- package/dist-library/values-CIt8AjiU.js +134 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +591 -95
- package/docs/README-ch.md +90 -0
- package/docs/README.md +87 -81
- package/docs/compatibility/compatibility-ch.md +22 -14
- package/docs/compatibility/compatibility-en.md +22 -14
- package/docs/compatibility/source-versioning-ch.md +15 -12
- package/docs/compatibility/source-versioning-en.md +16 -13
- package/docs/development/component-development-ch.md +51 -195
- package/docs/development/component-development-en.md +51 -195
- package/docs/development/component-development-reference-ch.md +253 -0
- package/docs/development/component-development-reference-en.md +238 -0
- package/docs/development/component-protocol-ch.md +51 -50
- package/docs/development/component-protocol-en.md +52 -49
- package/docs/development/local-module-layout-ch.md +59 -0
- package/docs/development/local-module-layout-en.md +59 -0
- package/docs/development/performance-overview-ch.md +402 -0
- package/docs/development/performance-overview-en.md +402 -0
- package/docs/development/releasing-ch.md +8 -104
- package/docs/development/releasing-en.md +8 -104
- package/docs/guides/local-guide-ch.md +28 -9
- package/docs/guides/local-guide-en.md +31 -12
- package/docs/integration/author-tools-ch.md +4 -2
- package/docs/integration/author-tools-en.md +4 -2
- package/docs/integration/codemirror-ch.md +52 -0
- package/docs/integration/codemirror-en.md +29 -0
- package/docs/integration/compiler-ch.md +47 -0
- package/docs/integration/compiler-en.md +34 -0
- package/docs/integration/directory-discovery-ch.md +53 -0
- package/docs/integration/directory-discovery-en.md +31 -0
- package/docs/integration/editor-ch.md +48 -21
- package/docs/integration/editor-en.md +48 -21
- package/docs/integration/extension-sdk-ch.md +392 -0
- package/docs/integration/extension-sdk-en.md +377 -0
- package/docs/integration/local-integration-ch.md +63 -9
- package/docs/integration/local-integration-en.md +89 -13
- package/docs/integration/repository-split-ch.md +40 -0
- package/docs/integration/repository-split-en.md +23 -0
- package/docs/integration/shareable-export-ch.md +46 -2
- package/docs/integration/shareable-export-en.md +46 -2
- package/docs/reference/computations-formatting-ch.md +4 -2
- package/docs/reference/computations-formatting-en.md +4 -2
- package/docs/reference/constraints-collections-ch.md +21 -1
- package/docs/reference/constraints-collections-en.md +21 -1
- package/docs/reference/diagnostics-counting-ch.md +1 -1
- package/docs/reference/diagnostics-counting-en.md +1 -1
- package/docs/reference/html-compatibility-ch.md +4 -0
- package/docs/reference/html-compatibility-en.md +4 -0
- package/docs/reference/local-components-v2-ch.md +2 -0
- package/docs/reference/local-components-v2-en.md +2 -0
- package/docs/reference/local-interaction-syntax-ch.md +51 -15
- package/docs/reference/local-interaction-syntax-en.md +58 -14
- package/docs/reference/theme-protocol-ch.md +79 -7
- package/docs/reference/theme-protocol-en.md +79 -7
- package/docs/reference/tolerance-ch.md +64 -0
- package/docs/reference/tolerance-en.md +57 -0
- package/docs/releases/release-0.4.0-ch.md +2 -0
- package/docs/releases/release-0.4.0-en.md +2 -0
- package/docs/releases/release-0.4.1-ch.md +2 -0
- package/docs/releases/release-0.4.1-en.md +2 -0
- package/docs/releases/release-0.5.0-ch.md +2 -0
- package/docs/releases/release-0.5.0-en.md +2 -0
- package/docs/releases/release-0.5.1-ch.md +2 -0
- package/docs/releases/release-0.5.1-en.md +2 -0
- package/docs/releases/release-0.5.2-ch.md +2 -0
- package/docs/releases/release-0.5.2-en.md +2 -0
- package/docs/releases/release-0.5.3-ch.md +2 -0
- package/docs/releases/release-0.5.3-en.md +2 -0
- package/docs/releases/release-0.6.0-ch.md +2 -0
- package/docs/releases/release-0.6.0-en.md +2 -0
- package/docs/releases/release-0.6.1-ch.md +2 -0
- package/docs/releases/release-0.6.1-en.md +2 -0
- package/docs/releases/release-0.7.0-ch.md +86 -0
- package/docs/releases/release-0.7.0-en.md +86 -0
- package/docs/releases/release-0.8.0-ch.md +126 -0
- package/docs/releases/release-0.8.0-en.md +126 -0
- package/examples/component-package/LICENSE +21 -0
- package/examples/component-package/NOTICES.md +12 -0
- package/examples/component-package/README-ch.md +101 -0
- package/examples/component-package/README.md +133 -0
- package/examples/component-package/package.json +35 -0
- package/examples/component-package/sample/document.reactive.md +14 -0
- package/examples/component-package/scripts/build-export.mjs +44 -0
- package/examples/component-package/scripts/build.mjs +130 -0
- package/examples/component-package/scripts/verify.mjs +257 -0
- package/examples/component-package/src/assets/notice.svg +4 -0
- package/examples/component-package/src/component.css +40 -0
- package/examples/component-package/src/components.tsx +105 -0
- package/examples/component-package/src/harness.tsx +34 -0
- package/examples/component-package/src/manifests.ts +71 -0
- package/examples/component-package/src/node-entry.ts +18 -0
- package/examples/component-package/src/sample.ts +4 -0
- package/examples/component-package/src/theme.css +44 -0
- package/examples/component-package/src/theme.ts +22 -0
- package/examples/component-package/tsconfig.json +15 -0
- package/examples/conformance/README-ch.md +55 -0
- package/examples/conformance/README.md +2 -0
- package/examples/conformance/local-draft-3.json +296 -0
- package/examples/game-2048-package/LICENSE +21 -0
- package/examples/game-2048-package/NOTICES.md +11 -0
- package/examples/game-2048-package/README-ch.md +97 -0
- package/examples/game-2048-package/README.md +102 -0
- package/examples/game-2048-package/package.json +35 -0
- package/examples/game-2048-package/sample/document.reactive.md +17 -0
- package/examples/game-2048-package/scripts/build-export.mjs +44 -0
- package/examples/game-2048-package/scripts/build.mjs +130 -0
- package/examples/game-2048-package/scripts/verify.mjs +180 -0
- package/examples/game-2048-package/src/component.css +161 -0
- package/examples/game-2048-package/src/components.tsx +326 -0
- package/examples/game-2048-package/src/game-engine.ts +228 -0
- package/examples/game-2048-package/src/harness.tsx +34 -0
- package/examples/game-2048-package/src/manifest.ts +85 -0
- package/examples/game-2048-package/src/node-entry.ts +30 -0
- package/examples/game-2048-package/src/sample.ts +4 -0
- package/examples/game-2048-package/tsconfig.json +15 -0
- package/examples/integration/README-ch.md +63 -0
- package/examples/integration/README.md +17 -1
- package/examples/integration/extension-sdk/README-ch.md +24 -0
- package/examples/integration/extension-sdk/README.md +24 -0
- package/examples/integration/extension-sdk/advanced-standalone.ts +6 -0
- package/examples/integration/extension-sdk/advanced.tsx +101 -0
- package/examples/integration/extension-sdk/env.d.ts +2 -0
- package/examples/integration/extension-sdk/extensions.tsx +97 -0
- package/examples/integration/extension-sdk/index.html +3 -0
- package/examples/integration/extension-sdk/main.tsx +10 -0
- package/examples/integration/extension-sdk/package.json +6 -0
- package/examples/integration/extension-sdk/standalone.ts +7 -0
- package/examples/integration/extension-sdk/tsconfig.json +8 -0
- package/examples/integration/react-comprehensive/index.html +12 -0
- package/examples/integration/react-comprehensive/main.jsx +123 -0
- package/examples/integration/react-comprehensive/package.json +18 -0
- package/examples/local/README-ch.md +76 -0
- package/examples/local/README.md +4 -2
- package/examples/local/scenarios/blog-zh.reactive.md +71 -0
- package/examples/local/scenarios/blog.reactive.md +71 -0
- package/examples/local/scenarios/classroom-zh.reactive.md +97 -0
- package/examples/local/scenarios/classroom.reactive.md +97 -0
- package/examples/local/scenarios/proposal-zh.reactive.md +79 -0
- package/examples/local/scenarios/proposal.reactive.md +79 -0
- package/examples/local/scenarios/survey-zh.reactive.md +74 -0
- package/examples/local/scenarios/survey.reactive.md +74 -0
- package/examples/local/showcase/README-ch.md +22 -0
- package/examples/local/showcase/README.md +9 -3
- package/examples/local/showcase/features.reactive.md +637 -0
- package/examples/local/showcase/zh/features.reactive.md +637 -0
- package/examples/sci-fi-theme/README-ch.md +131 -0
- package/examples/sci-fi-theme/README.md +146 -0
- package/examples/sci-fi-theme/demo/demo.css +532 -0
- package/examples/sci-fi-theme/demo/document.reactive.md +185 -0
- package/examples/sci-fi-theme/demo/index.html +13 -0
- package/examples/sci-fi-theme/demo/main.tsx +180 -0
- package/examples/sci-fi-theme/docs/design-system-ch.md +245 -0
- package/examples/sci-fi-theme/docs/design-system.md +474 -0
- package/examples/sci-fi-theme/package.json +27 -0
- package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -0
- package/examples/sci-fi-theme/src/components.css +1460 -0
- package/examples/sci-fi-theme/src/index.ts +6 -0
- package/examples/sci-fi-theme/src/sci-fi.css +5 -0
- package/examples/sci-fi-theme/src/theme.ts +37 -0
- package/examples/sci-fi-theme/src/tokens.css +408 -0
- package/examples/sci-fi-theme/tsconfig.json +20 -0
- package/examples/sci-fi-theme/vite.config.ts +24 -0
- package/examples/tetris-package/LICENSE +21 -0
- package/examples/tetris-package/NOTICES.md +11 -0
- package/examples/tetris-package/README-ch.md +91 -0
- package/examples/tetris-package/README.md +95 -0
- package/examples/tetris-package/package.json +35 -0
- package/examples/tetris-package/sample/document.reactive.md +16 -0
- package/examples/tetris-package/scripts/build-export.mjs +44 -0
- package/examples/tetris-package/scripts/build.mjs +130 -0
- package/examples/tetris-package/scripts/verify.mjs +173 -0
- package/examples/tetris-package/src/component.css +145 -0
- package/examples/tetris-package/src/components.tsx +334 -0
- package/examples/tetris-package/src/harness.tsx +34 -0
- package/examples/tetris-package/src/manifests.ts +93 -0
- package/examples/tetris-package/src/node-entry.ts +16 -0
- package/examples/tetris-package/src/sample.ts +4 -0
- package/examples/tetris-package/src/tetris-engine.ts +325 -0
- package/examples/tetris-package/tsconfig.json +15 -0
- package/package.json +98 -44
- package/dist-library/compiler-Cm3ppMxG.js +0 -46044
- package/dist-library/react-Bh7_oxZp.js +0 -59655
- package/dist-library/reactive-md-editor.css +0 -2
- package/dist-library/reactive-md-editor.js +0 -3853
- package/dist-library/runtime-DlFYQ4s_.js +0 -498
- package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +0 -7
- package/dist-library/types/editor/editor-toolbar.d.ts +0 -24
- package/dist-library/types/editor/editor-view-bar.d.ts +0 -11
- package/dist-library/types/editor/extended-native-components.d.ts +0 -58
- package/dist-library/types/editor/index.d.ts +0 -9
- package/dist-library/types/editor/locale.d.ts +0 -13
- package/dist-library/types/editor/source-authoring.d.ts +0 -59
- package/dist-library/types/editor/types.d.ts +0 -48
- package/dist-library/types/editor/use-gutter-metrics.d.ts +0 -5
- package/dist-library/types/editor/use-source-history.d.ts +0 -16
- package/dist-library/types/local/compiler.d.ts +0 -4
- package/dist-library/types/local/math.d.ts +0 -48
- package/dist-library/types/local/options.d.ts +0 -36
- package/dist-library/types/local/parser.d.ts +0 -13
- package/dist-library/types/local/render-types.d.ts +0 -27
- package/dist-library/types/local/runtime.d.ts +0 -2
- package/dist-library/types/local/schema.d.ts +0 -77
- package/dist-library/types/local/types.d.ts +0 -263
- package/dist-library/types/local/visuals.d.ts +0 -12
- package/dist-library/types/local/worker.d.ts +0 -98
- package/docs/development/performance-ch.md +0 -76
- package/docs/development/performance-en.md +0 -76
- /package/dist-library/types/{editor → authoring}/command-types.d.ts +0 -0
- /package/dist-library/types/{editor → authoring}/editor-commands.d.ts +0 -0
- /package/dist-library/types/local/{locale.d.ts → contracts/locale.d.ts} +0 -0
- /package/dist-library/types/local/{collection-functions.d.ts → evaluation/collection-functions.d.ts} +0 -0
- /package/dist-library/types/local/{data-functions.d.ts → evaluation/data-functions.d.ts} +0 -0
- /package/dist-library/types/local/{dates.d.ts → evaluation/dates.d.ts} +0 -0
- /package/dist-library/types/local/{formatting.d.ts → evaluation/formatting.d.ts} +0 -0
- /package/dist-library/types/local/{html-names.d.ts → html/html-names.d.ts} +0 -0
- /package/dist-library/types/local/{text-length.d.ts → source/text-length.d.ts} +0 -0
- /package/dist-library/types/local/{colors.d.ts → theme/colors.d.ts} +0 -0
- /package/dist-library/types/local/{code-block.d.ts → widgets/code-block.d.ts} +0 -0
- /package/dist-library/types/local/{code-languages.d.ts → widgets/code-languages.d.ts} +0 -0
- /package/dist-library/types/local/{diagram-layout.d.ts → widgets/diagram-layout.d.ts} +0 -0
- /package/dist-library/types/local/{image-view.d.ts → widgets/image-view.d.ts} +0 -0
- /package/dist-library/types/local/{math-view.d.ts → widgets/math-view.d.ts} +0 -0
- /package/dist-library/types/local/{table-surface.d.ts → widgets/table-surface.d.ts} +0 -0
|
@@ -0,0 +1,1174 @@
|
|
|
1
|
+
import { F as e, M as t, P as n, a as r, i, j as a, k as o, q as s } from "./identity-MYJXKSkB.js";
|
|
2
|
+
import { $ as c, S as l, _ as u, a as d, c as f, d as ee, g as p, h as te, i as m, m as ne, n as h, nt as g, o as re, p as ie, r as _, s as ae, t as oe, v as se, y as ce } from "./config-validation-DXTynAw7.js";
|
|
3
|
+
import { t as le } from "./default-components-Z_YMio5P.js";
|
|
4
|
+
import v from "./reactive-md-default-preset.js";
|
|
5
|
+
// src/local/theme/theme.ts
|
|
6
|
+
var y = "reactive-md-theme-1", b = Object.freeze({
|
|
7
|
+
name: "default",
|
|
8
|
+
protocol: y,
|
|
9
|
+
colorSchemes: Object.freeze(["light", "dark"])
|
|
10
|
+
});
|
|
11
|
+
function ue(e, t) {
|
|
12
|
+
let n = typeof t == "string" ? t.length : Infinity;
|
|
13
|
+
if (!e || typeof e.start != "number" || typeof e.end != "number" || !Number.isFinite(e.start) || !Number.isFinite(e.end)) return {
|
|
14
|
+
start: 0,
|
|
15
|
+
end: 0
|
|
16
|
+
};
|
|
17
|
+
let r = Math.max(0, Math.min(n, Math.floor(e.start)));
|
|
18
|
+
return {
|
|
19
|
+
start: r,
|
|
20
|
+
end: Math.max(r, Math.min(n, Math.floor(e.end)))
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function de(e, t) {
|
|
24
|
+
if (typeof e != "string" || e.length === 0) return {
|
|
25
|
+
line: 1,
|
|
26
|
+
column: 1
|
|
27
|
+
};
|
|
28
|
+
let n = Math.min(t, e.length), r = 1, i = 0;
|
|
29
|
+
for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1, i = t + 1);
|
|
30
|
+
return {
|
|
31
|
+
line: r,
|
|
32
|
+
column: t - i + 1
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function fe(e, t, n, r) {
|
|
36
|
+
let i = ue(n, r), { line: a, column: o } = de(r, i.start);
|
|
37
|
+
return {
|
|
38
|
+
code: e,
|
|
39
|
+
message: c(t),
|
|
40
|
+
severity: "warning",
|
|
41
|
+
range: i,
|
|
42
|
+
line: a,
|
|
43
|
+
column: o,
|
|
44
|
+
messageKey: t.key,
|
|
45
|
+
...t.params ? { params: t.params } : {}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function pe(e, t, n, r) {
|
|
49
|
+
let i = (e, t) => ({
|
|
50
|
+
name: b.name,
|
|
51
|
+
diagnostics: [fe(e, t, n, r)]
|
|
52
|
+
}), a = e;
|
|
53
|
+
if (a == null || a === "") return {
|
|
54
|
+
name: b.name,
|
|
55
|
+
diagnostics: []
|
|
56
|
+
};
|
|
57
|
+
if (!l(a)) return i("local.theme.name", g("local.theme.name", {
|
|
58
|
+
name: String(a),
|
|
59
|
+
limit: 64
|
|
60
|
+
}));
|
|
61
|
+
let o = a;
|
|
62
|
+
if (o === b.name) return {
|
|
63
|
+
name: b.name,
|
|
64
|
+
diagnostics: []
|
|
65
|
+
};
|
|
66
|
+
if (!Array.isArray(t)) return i("local.theme.missing", g("local.theme.missing", { name: o }));
|
|
67
|
+
let s = 0, c = null;
|
|
68
|
+
try {
|
|
69
|
+
for (let e of t) typeof e == "object" && e && !Array.isArray(e) && e.name === o && (s += 1, c = e);
|
|
70
|
+
} catch {
|
|
71
|
+
return i("local.theme.manifest", g("local.theme.manifest.unreadable"));
|
|
72
|
+
}
|
|
73
|
+
if (s === 0) return i("local.theme.missing", g("local.theme.missing", { name: o }));
|
|
74
|
+
if (s > 1) return i("local.theme.duplicate", g("local.theme.duplicate", { name: o }));
|
|
75
|
+
try {
|
|
76
|
+
let e = c;
|
|
77
|
+
if (!e || typeof e != "object") return i("local.theme.manifest", g("local.theme.manifest.definition", { name: o }));
|
|
78
|
+
if (e.protocol !== "reactive-md-theme-1") return i("local.theme.protocol", g("local.theme.protocol", {
|
|
79
|
+
name: o,
|
|
80
|
+
protocol: y
|
|
81
|
+
}));
|
|
82
|
+
let t = e.colorSchemes;
|
|
83
|
+
if (!Array.isArray(t) || !t.includes("light") || !t.includes("dark")) return i("local.theme.modes", g("local.theme.modes", { name: o }));
|
|
84
|
+
} catch {
|
|
85
|
+
return i("local.theme.manifest", g("local.theme.manifest.selected", { name: o }));
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
name: o,
|
|
89
|
+
diagnostics: []
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
// src/sdk/theme.ts
|
|
93
|
+
var me = 128, he = 32, ge = 128, _e = 262144, x = 524288, ve = /^[a-z][a-z0-9]*(?:[-./][a-z0-9]+)*$/, ye = /^[a-z][a-z0-9._/-]*$/, be = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/, xe = /^\[\s*data-rmd-theme\s*=\s*(?:"[^"]*"|'[^']*'|[^\]]*?)\s*\]/, Se = /^(?::root|html|body)(?![A-Za-z0-9_-])/i, Ce = /* @__PURE__ */ new Set([
|
|
94
|
+
"media",
|
|
95
|
+
"supports",
|
|
96
|
+
"layer",
|
|
97
|
+
"container",
|
|
98
|
+
"scope",
|
|
99
|
+
"starting-style"
|
|
100
|
+
]), we = 256, Te = /* @__PURE__ */ new Set([
|
|
101
|
+
"serif",
|
|
102
|
+
"sans-serif",
|
|
103
|
+
"monospace",
|
|
104
|
+
"cursive",
|
|
105
|
+
"fantasy",
|
|
106
|
+
"system-ui",
|
|
107
|
+
"ui-serif",
|
|
108
|
+
"ui-sans-serif",
|
|
109
|
+
"ui-monospace",
|
|
110
|
+
"ui-rounded",
|
|
111
|
+
"math",
|
|
112
|
+
"emoji",
|
|
113
|
+
"fangsong",
|
|
114
|
+
"-apple-system",
|
|
115
|
+
"blinkmacsystemfont"
|
|
116
|
+
]), S = /* @__PURE__ */ new Set([
|
|
117
|
+
"inherit",
|
|
118
|
+
"initial",
|
|
119
|
+
"unset",
|
|
120
|
+
"revert",
|
|
121
|
+
"revert-layer"
|
|
122
|
+
]), Ee = /* @__PURE__ */ new Set([
|
|
123
|
+
"caption",
|
|
124
|
+
"icon",
|
|
125
|
+
"menu",
|
|
126
|
+
"message-box",
|
|
127
|
+
"small-caption",
|
|
128
|
+
"status-bar"
|
|
129
|
+
]), De = /* @__PURE__ */ new Set([
|
|
130
|
+
"xx-small",
|
|
131
|
+
"x-small",
|
|
132
|
+
"small",
|
|
133
|
+
"medium",
|
|
134
|
+
"large",
|
|
135
|
+
"x-large",
|
|
136
|
+
"xx-large",
|
|
137
|
+
"xxx-large",
|
|
138
|
+
"smaller",
|
|
139
|
+
"larger"
|
|
140
|
+
]), Oe = /^rmd-theme-([a-z][a-z0-9-]*)-font-([0-9a-f]+)$/;
|
|
141
|
+
function C(e, t) {
|
|
142
|
+
return /* @__PURE__ */ Error(`Invalid local theme ${e}: ${t}`);
|
|
143
|
+
}
|
|
144
|
+
function ke(e) {
|
|
145
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
146
|
+
}
|
|
147
|
+
function w(e, t) {
|
|
148
|
+
if (!ke(e)) throw C(t, "must be an object.");
|
|
149
|
+
return e;
|
|
150
|
+
}
|
|
151
|
+
function T(e, t) {
|
|
152
|
+
if (typeof e != "string" || e.length === 0) throw C(t, "must be a non-empty string.");
|
|
153
|
+
if (e.length > me) throw C(t, `must not exceed ${me} characters.`);
|
|
154
|
+
if (!ve.test(e)) throw C(t, `"${e}" must be lowercase, start with a letter and use "-", "." or "/" only as separators.`);
|
|
155
|
+
return e;
|
|
156
|
+
}
|
|
157
|
+
function E(e, t) {
|
|
158
|
+
if (!l(e)) throw C(t, "must be a lowercase kebab-case name that starts with a letter.");
|
|
159
|
+
if (e === "default") throw C(t, "must not replace the reserved built-in \"default\" theme.");
|
|
160
|
+
return e;
|
|
161
|
+
}
|
|
162
|
+
function D(e, t) {
|
|
163
|
+
if (typeof e != "string" || !be.test(e)) throw C(t, "must be a semantic version such as \"1.0.0\".");
|
|
164
|
+
return e;
|
|
165
|
+
}
|
|
166
|
+
function Ae(e, t) {
|
|
167
|
+
if (e === void 0) return Object.freeze(["light", "dark"]);
|
|
168
|
+
if (!Array.isArray(e)) throw C(t, "must be an array of \"light\" and \"dark\".");
|
|
169
|
+
let n = [];
|
|
170
|
+
for (let r of e) {
|
|
171
|
+
if (r !== "light" && r !== "dark") throw C(t, "may only contain \"light\" and \"dark\".");
|
|
172
|
+
if (n.includes(r)) throw C(t, `must not repeat "${r}".`);
|
|
173
|
+
n.push(r);
|
|
174
|
+
}
|
|
175
|
+
if (!n.includes("light") || !n.includes("dark")) throw C(t, "must declare both \"light\" and \"dark\".");
|
|
176
|
+
return Object.freeze(n);
|
|
177
|
+
}
|
|
178
|
+
function O(e, t) {
|
|
179
|
+
let n = e[t], r = t + 1;
|
|
180
|
+
for (; r < e.length;) if (e[r] === "\\") r += 2;
|
|
181
|
+
else {
|
|
182
|
+
if (e[r] === n) return r + 1;
|
|
183
|
+
r += 1;
|
|
184
|
+
}
|
|
185
|
+
return e.length;
|
|
186
|
+
}
|
|
187
|
+
function k(e, t, n, r) {
|
|
188
|
+
let i = 0;
|
|
189
|
+
for (let a = t; a < e.length; a += 1) {
|
|
190
|
+
let t = e[a];
|
|
191
|
+
if (t === "\"" || t === "'") a = O(e, a) - 1;
|
|
192
|
+
else if (t === "/" && e[a + 1] === "*") {
|
|
193
|
+
let t = e.indexOf("*/", a + 2);
|
|
194
|
+
a = (t < 0 ? e.length : t + 2) - 1;
|
|
195
|
+
} else if (t === n) i += 1;
|
|
196
|
+
else if (t === r && (--i, i === 0)) return a + 1;
|
|
197
|
+
}
|
|
198
|
+
return e.length;
|
|
199
|
+
}
|
|
200
|
+
function je(e, t, n) {
|
|
201
|
+
let r = t + 3;
|
|
202
|
+
for (; r < e.length && /\s/.test(e[r]);) r += 1;
|
|
203
|
+
if (e[r] !== "(") throw C(n, "has a malformed url() value.");
|
|
204
|
+
for (r += 1; r < e.length && /\s/.test(e[r]);) r += 1;
|
|
205
|
+
let i = e[r];
|
|
206
|
+
if (i === "\"" || i === "'") {
|
|
207
|
+
let t = e.indexOf(i, r + 1);
|
|
208
|
+
if (t < 0) throw C(n, "has an unterminated url() string.");
|
|
209
|
+
let a = e.slice(r + 1, t);
|
|
210
|
+
for (r = t + 1; r < e.length && /\s/.test(e[r]);) r += 1;
|
|
211
|
+
if (e[r] !== ")") throw C(n, "has a malformed url() value.");
|
|
212
|
+
return {
|
|
213
|
+
value: a.trim(),
|
|
214
|
+
end: r + 1
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
let a = e.indexOf(")", r);
|
|
218
|
+
if (a < 0) throw C(n, "has an unterminated url() value.");
|
|
219
|
+
return {
|
|
220
|
+
value: e.slice(r, a).trim(),
|
|
221
|
+
end: a + 1
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function Me(e, t, n, r) {
|
|
225
|
+
let i = t;
|
|
226
|
+
for (; i < e.length && e[i] !== "(";) i += 1;
|
|
227
|
+
if (i >= e.length) throw C(r, `has a malformed ${n}() value.`);
|
|
228
|
+
let a = k(e, i, "(", ")");
|
|
229
|
+
if (a <= i + 1 || e[a - 1] !== ")") throw C(r, `has an unterminated ${n}() value.`);
|
|
230
|
+
return {
|
|
231
|
+
body: e.slice(i + 1, a - 1),
|
|
232
|
+
end: a
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function Ne(e, t) {
|
|
236
|
+
let n = 0;
|
|
237
|
+
for (; n < e.length;) {
|
|
238
|
+
let r = e[n];
|
|
239
|
+
if (r === "\"" || r === "'") {
|
|
240
|
+
let i = O(e, n);
|
|
241
|
+
if (i > e.length || e[i - 1] !== r) throw C(t, "has an unterminated image-set() string.");
|
|
242
|
+
let a = e.slice(n + 1, i - 1).trim();
|
|
243
|
+
if (!/^data:/i.test(a)) throw C(t, "image-set() entries must be inline data: URLs; network and file URLs are not allowed.");
|
|
244
|
+
n = i;
|
|
245
|
+
} else if (r === "/" && e[n + 1] === "*") {
|
|
246
|
+
let t = e.indexOf("*/", n + 2);
|
|
247
|
+
n = t < 0 ? e.length : t + 2;
|
|
248
|
+
} else n += 1;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function Pe(e, t, n = !1) {
|
|
252
|
+
if (e.toLowerCase().includes("</style")) throw C(t, "must not contain a closing style tag.");
|
|
253
|
+
let r = 0;
|
|
254
|
+
for (; r < e.length;) {
|
|
255
|
+
let i = e[r];
|
|
256
|
+
if (i === "\"" || i === "'") r = O(e, r);
|
|
257
|
+
else if (i === "/" && e[r + 1] === "*") {
|
|
258
|
+
let t = e.indexOf("*/", r + 2);
|
|
259
|
+
r = t < 0 ? e.length : t + 2;
|
|
260
|
+
} else {
|
|
261
|
+
if (i === "\\") throw C(t, "must not use CSS escapes outside strings; escaped tokens can disguise url() or @import.");
|
|
262
|
+
if (i === "@" && /^@import\b/i.test(e.slice(r, r + 8))) throw C(t, "must not use @import; inline every resource.");
|
|
263
|
+
if ((i === "i" || i === "I" || i === "-") && /^(?:-webkit-)?image-set\s*\(/i.test(e.slice(r, r + 24))) {
|
|
264
|
+
let { body: n } = Me(e, r, "image-set", t);
|
|
265
|
+
Ne(n, t), r += 1;
|
|
266
|
+
} else if ((i === "u" || i === "U") && /^url\s*\(/i.test(e.slice(r, r + 12))) {
|
|
267
|
+
let i = je(e, r, t);
|
|
268
|
+
if (!/^data:/i.test(i.value) && !(n && i.value.startsWith("#"))) throw C(t, "may only reference data: URLs; network and file URLs are not allowed.");
|
|
269
|
+
r = i.end;
|
|
270
|
+
} else {
|
|
271
|
+
if ((i === "e" || i === "E") && /^expression\s*\(/i.test(e.slice(r, r + 16))) throw C(t, "must not use CSS expression().");
|
|
272
|
+
r += 1;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
function Fe(e) {
|
|
278
|
+
if (typeof e != "string" || e.length > 4194304) return !1;
|
|
279
|
+
try {
|
|
280
|
+
return Pe(e, "css", !0), !0;
|
|
281
|
+
} catch {
|
|
282
|
+
return !1;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function Ie(e) {
|
|
286
|
+
let t = [], n = 0, r = 0, i = 0;
|
|
287
|
+
for (let a = 0; a < e.length; a += 1) {
|
|
288
|
+
let o = e[a];
|
|
289
|
+
if (o === "\"" || o === "'") a = O(e, a) - 1;
|
|
290
|
+
else if (o === "/" && e[a + 1] === "*") {
|
|
291
|
+
let t = e.indexOf("*/", a + 2);
|
|
292
|
+
a = (t < 0 ? e.length : t + 2) - 1;
|
|
293
|
+
} else o === "\\" ? a += 1 : o === "(" ? r += 1 : o === ")" ? r = Math.max(0, r - 1) : o === "[" ? i += 1 : o === "]" ? i = Math.max(0, i - 1) : o === "," && r === 0 && i === 0 && (t.push(e.slice(n, a)), n = a + 1);
|
|
294
|
+
}
|
|
295
|
+
return t.push(e.slice(n)), t;
|
|
296
|
+
}
|
|
297
|
+
function Le(e, t) {
|
|
298
|
+
let n = e.trim(), r = `[data-rmd-theme="${t}"]`, i = xe.exec(n);
|
|
299
|
+
return i ? `${r}${n.slice(i[0].length)}` : `${r} ${n}`;
|
|
300
|
+
}
|
|
301
|
+
function A(e, t) {
|
|
302
|
+
let n = t;
|
|
303
|
+
for (; n < e.length;) if (/\s/.test(e[n])) n += 1;
|
|
304
|
+
else if (e[n] === "/" && e[n + 1] === "*") {
|
|
305
|
+
let t = e.indexOf("*/", n + 2);
|
|
306
|
+
n = t < 0 ? e.length : t + 2;
|
|
307
|
+
} else break;
|
|
308
|
+
return n;
|
|
309
|
+
}
|
|
310
|
+
function Re(e, t) {
|
|
311
|
+
let n = e.toLowerCase(), r = /:has\s*\(/g;
|
|
312
|
+
for (let i = r.exec(n); i; i = r.exec(n)) {
|
|
313
|
+
if (r.lastIndex = i.index + 1, i.index >= t) continue;
|
|
314
|
+
let n = i.index + i[0].length - 1, a = k(e, n, "(", ")"), o = e.slice(n + 1, Math.max(n + 1, a - 1));
|
|
315
|
+
for (let t of Ie(o)) if (/^\s*[+~]/.test(t)) throw C("theme.css", `selector "${e.trim()}" uses :has() with a sibling combinator that can escape the theme root.`);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function ze(e) {
|
|
319
|
+
let t = e.trim();
|
|
320
|
+
if (t === "") return;
|
|
321
|
+
if (t[0] === "+" || t[0] === "~") throw C("theme.css", `selector "${t}" begins with a sibling combinator and cannot be scoped.`);
|
|
322
|
+
let n = xe.exec(t);
|
|
323
|
+
if (n) {
|
|
324
|
+
let e = n[0].length;
|
|
325
|
+
for (; e < t.length;) {
|
|
326
|
+
let n = t[e];
|
|
327
|
+
if (/\s/.test(n) || n === "+" || n === "~" || n === ">" || n === ",") break;
|
|
328
|
+
n === "[" ? e = k(t, e, "[", "]") : n === "(" ? e = k(t, e, "(", ")") : e += 1;
|
|
329
|
+
}
|
|
330
|
+
let r = A(t, e);
|
|
331
|
+
if (t[r] === "+" || t[r] === "~") throw C("theme.css", `selector "${t}" uses a sibling combinator that can escape the theme root.`);
|
|
332
|
+
Re(t, e);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function Be(e, t) {
|
|
336
|
+
let n = Ie(e).map((e) => e.trim()).filter(Boolean);
|
|
337
|
+
if (n.length === 0) return e.trim();
|
|
338
|
+
for (let e of n) {
|
|
339
|
+
if (Se.test(e)) throw C("theme.css", `selector "${e}" targets the host document; scope it under the theme root instead.`);
|
|
340
|
+
ze(e);
|
|
341
|
+
}
|
|
342
|
+
return n.map((e) => Le(e, t)).join(", ");
|
|
343
|
+
}
|
|
344
|
+
function j(e, t) {
|
|
345
|
+
let n = 1;
|
|
346
|
+
for (let r = t; r < e.length; r += 1) {
|
|
347
|
+
let t = e[r];
|
|
348
|
+
if (t === "\"" || t === "'") r = O(e, r) - 1;
|
|
349
|
+
else if (t === "/" && e[r + 1] === "*") {
|
|
350
|
+
let t = e.indexOf("*/", r + 2);
|
|
351
|
+
r = (t < 0 ? e.length : t + 2) - 1;
|
|
352
|
+
} else if (t === "{") n += 1;
|
|
353
|
+
else if (t === "}" && (--n, n === 0)) return r;
|
|
354
|
+
}
|
|
355
|
+
return e.length;
|
|
356
|
+
}
|
|
357
|
+
function M(e) {
|
|
358
|
+
return e.trim().replace(/\s+/g, " ").toLowerCase();
|
|
359
|
+
}
|
|
360
|
+
function Ve(e) {
|
|
361
|
+
let t = [];
|
|
362
|
+
for (let n of e) {
|
|
363
|
+
let e = n.codePointAt(0);
|
|
364
|
+
e <= 127 ? t.push(e) : e <= 2047 ? t.push(192 | e >> 6, 128 | e & 63) : e <= 65535 ? t.push(224 | e >> 12, 128 | e >> 6 & 63, 128 | e & 63) : t.push(240 | e >> 18, 128 | e >> 12 & 63, 128 | e >> 6 & 63, 128 | e & 63);
|
|
365
|
+
}
|
|
366
|
+
return t;
|
|
367
|
+
}
|
|
368
|
+
function He(e) {
|
|
369
|
+
let t = "", n = 0;
|
|
370
|
+
for (; n < e.length;) {
|
|
371
|
+
let r = e[n], i, a;
|
|
372
|
+
if (r <= 127) i = r, a = 1;
|
|
373
|
+
else if (r >= 194 && r <= 223) i = r & 31, a = 2;
|
|
374
|
+
else if (r >= 224 && r <= 239) i = r & 15, a = 3;
|
|
375
|
+
else if (r >= 240 && r <= 244) i = r & 7, a = 4;
|
|
376
|
+
else return null;
|
|
377
|
+
if (n + a > e.length) return null;
|
|
378
|
+
for (let t = 1; t < a; t += 1) {
|
|
379
|
+
let r = e[n + t];
|
|
380
|
+
if ((r & 192) != 128) return null;
|
|
381
|
+
i = i << 6 | r & 63;
|
|
382
|
+
}
|
|
383
|
+
if (a === 3 && (i < 2048 || i >= 55296 && i <= 57343) || a === 4 && (i < 65536 || i > 1114111)) return null;
|
|
384
|
+
t += String.fromCodePoint(i), n += a;
|
|
385
|
+
}
|
|
386
|
+
return t;
|
|
387
|
+
}
|
|
388
|
+
function Ue(e, t) {
|
|
389
|
+
return `rmd-theme-${e}-font-${Ve(t).map((e) => e.toString(16).padStart(2, "0")).join("")}`;
|
|
390
|
+
}
|
|
391
|
+
function We(e) {
|
|
392
|
+
let t = Oe.exec(e);
|
|
393
|
+
if (!t || t[2].length % 2 != 0) return null;
|
|
394
|
+
let n = [];
|
|
395
|
+
for (let e = 0; e < t[2].length; e += 2) n.push(Number.parseInt(t[2].slice(e, e + 2), 16));
|
|
396
|
+
let r = He(n);
|
|
397
|
+
return r === null || r.length === 0 || M(r) !== r ? null : {
|
|
398
|
+
themeName: t[1],
|
|
399
|
+
original: r
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
function N(e) {
|
|
403
|
+
return e === void 0 ? !1 : /[A-Za-z0-9_-]/.test(e) || e.codePointAt(0) >= 128;
|
|
404
|
+
}
|
|
405
|
+
function Ge(e, t) {
|
|
406
|
+
let n = e[t];
|
|
407
|
+
if (n === void 0) return !1;
|
|
408
|
+
if (/[A-Za-z_]/.test(n) || n.codePointAt(0) >= 128) return !0;
|
|
409
|
+
if (n === "-") {
|
|
410
|
+
let n = e[t + 1];
|
|
411
|
+
return n !== void 0 && (N(n) || n === "-");
|
|
412
|
+
}
|
|
413
|
+
return !1;
|
|
414
|
+
}
|
|
415
|
+
function Ke(e, t) {
|
|
416
|
+
let n = e[t];
|
|
417
|
+
if (n === void 0) return !1;
|
|
418
|
+
if (n >= "0" && n <= "9") return !0;
|
|
419
|
+
let r = e[t + 1];
|
|
420
|
+
return n === "+" || n === "-" ? r !== void 0 && (r >= "0" && r <= "9" || r === ".") : n === "." && r !== void 0 && r >= "0" && r <= "9";
|
|
421
|
+
}
|
|
422
|
+
function P(e) {
|
|
423
|
+
let t = [], n = 0;
|
|
424
|
+
for (; n < e.length;) {
|
|
425
|
+
let r = e[n];
|
|
426
|
+
if (/\s/.test(r)) {
|
|
427
|
+
n += 1;
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
if (r === "/" && e[n + 1] === "*") {
|
|
431
|
+
let t = e.indexOf("*/", n + 2);
|
|
432
|
+
n = t < 0 ? e.length : t + 2;
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
let i = n;
|
|
436
|
+
if (r === "\"" || r === "'") {
|
|
437
|
+
let r = O(e, n);
|
|
438
|
+
t.push({
|
|
439
|
+
type: "string",
|
|
440
|
+
text: e.slice(i, r),
|
|
441
|
+
start: i,
|
|
442
|
+
end: r,
|
|
443
|
+
name: "",
|
|
444
|
+
stringValue: e.slice(i + 1, Math.max(i + 1, r - 1))
|
|
445
|
+
}), n = r;
|
|
446
|
+
} else if (r === ",") t.push({
|
|
447
|
+
type: "comma",
|
|
448
|
+
text: ",",
|
|
449
|
+
start: i,
|
|
450
|
+
end: n + 1,
|
|
451
|
+
name: "",
|
|
452
|
+
stringValue: ""
|
|
453
|
+
}), n += 1;
|
|
454
|
+
else if (Ke(e, n)) {
|
|
455
|
+
let r = n;
|
|
456
|
+
for ((e[r] === "+" || e[r] === "-") && (r += 1); e[r] >= "0" && e[r] <= "9";) r += 1;
|
|
457
|
+
if (e[r] === ".") for (r += 1; e[r] >= "0" && e[r] <= "9";) r += 1;
|
|
458
|
+
if (e[r] === "e" || e[r] === "E") {
|
|
459
|
+
let t = r;
|
|
460
|
+
r += 1, (e[r] === "+" || e[r] === "-") && (r += 1);
|
|
461
|
+
let n = r;
|
|
462
|
+
for (; e[r] >= "0" && e[r] <= "9";) r += 1;
|
|
463
|
+
r === n && (r = t);
|
|
464
|
+
}
|
|
465
|
+
let a = "number";
|
|
466
|
+
if (e[r] === "%") r += 1, a = "percentage";
|
|
467
|
+
else if (Ge(e, r)) {
|
|
468
|
+
for (r += 1; N(e[r]);) r += 1;
|
|
469
|
+
a = "dimension";
|
|
470
|
+
}
|
|
471
|
+
t.push({
|
|
472
|
+
type: a,
|
|
473
|
+
text: e.slice(i, r),
|
|
474
|
+
start: i,
|
|
475
|
+
end: r,
|
|
476
|
+
name: "",
|
|
477
|
+
stringValue: ""
|
|
478
|
+
}), n = r;
|
|
479
|
+
} else if (Ge(e, n)) {
|
|
480
|
+
let r = n + 1;
|
|
481
|
+
for (; N(e[r]);) r += 1;
|
|
482
|
+
let a = e.slice(n, r).toLowerCase();
|
|
483
|
+
if (e[r] === "(") {
|
|
484
|
+
let o = k(e, r, "(", ")"), s = Math.min(o, e.length);
|
|
485
|
+
t.push({
|
|
486
|
+
type: "function",
|
|
487
|
+
text: e.slice(n, s),
|
|
488
|
+
start: i,
|
|
489
|
+
end: s,
|
|
490
|
+
name: a,
|
|
491
|
+
stringValue: ""
|
|
492
|
+
}), n = s;
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
t.push({
|
|
496
|
+
type: "ident",
|
|
497
|
+
text: e.slice(n, r),
|
|
498
|
+
start: i,
|
|
499
|
+
end: r,
|
|
500
|
+
name: a,
|
|
501
|
+
stringValue: ""
|
|
502
|
+
}), n = r;
|
|
503
|
+
} else if (r === "(") {
|
|
504
|
+
let r = k(e, n, "(", ")"), a = Math.min(r, e.length);
|
|
505
|
+
t.push({
|
|
506
|
+
type: "function",
|
|
507
|
+
text: e.slice(n, a),
|
|
508
|
+
start: i,
|
|
509
|
+
end: a,
|
|
510
|
+
name: "",
|
|
511
|
+
stringValue: ""
|
|
512
|
+
}), n = a;
|
|
513
|
+
} else t.push({
|
|
514
|
+
type: "delimiter",
|
|
515
|
+
text: r,
|
|
516
|
+
start: i,
|
|
517
|
+
end: n + 1,
|
|
518
|
+
name: "",
|
|
519
|
+
stringValue: ""
|
|
520
|
+
}), n += 1;
|
|
521
|
+
}
|
|
522
|
+
return t;
|
|
523
|
+
}
|
|
524
|
+
function F(e) {
|
|
525
|
+
return A(e, 0) === e.length;
|
|
526
|
+
}
|
|
527
|
+
function I(e) {
|
|
528
|
+
let t = P(e);
|
|
529
|
+
if (t.length === 0) return null;
|
|
530
|
+
if (t.length === 1 && t[0].type === "string") {
|
|
531
|
+
let e = M(t[0].stringValue);
|
|
532
|
+
return e === "" ? null : {
|
|
533
|
+
key: e,
|
|
534
|
+
start: t[0].start,
|
|
535
|
+
end: t[0].end
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
if (t[0].type === "string") return null;
|
|
539
|
+
for (let n = 0; n < t.length; n += 1) if (t[n].type !== "ident" || n > 0 && !F(e.slice(t[n - 1].end, t[n].start))) return null;
|
|
540
|
+
if (t.length === 1 && (S.has(t[0].name) || Te.has(t[0].name))) return null;
|
|
541
|
+
let n = M(t.map((e) => e.text).join(" "));
|
|
542
|
+
return n === "" ? null : {
|
|
543
|
+
key: n,
|
|
544
|
+
start: t[0].start,
|
|
545
|
+
end: t[t.length - 1].end
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
function L(e) {
|
|
549
|
+
let t = [], n = 0, r = 0;
|
|
550
|
+
for (; r < e.length;) {
|
|
551
|
+
let i = e[r];
|
|
552
|
+
if (i === "\"" || i === "'") r = O(e, r);
|
|
553
|
+
else if (i === "/" && e[r + 1] === "*") {
|
|
554
|
+
let t = e.indexOf("*/", r + 2);
|
|
555
|
+
r = t < 0 ? e.length : t + 2;
|
|
556
|
+
} else i === "(" || i === "[" ? r = k(e, r, i, i === "(" ? ")" : "]") : (i === "," && (t.push({
|
|
557
|
+
start: n,
|
|
558
|
+
end: r
|
|
559
|
+
}), n = r + 1), r += 1);
|
|
560
|
+
}
|
|
561
|
+
return t.push({
|
|
562
|
+
start: n,
|
|
563
|
+
end: e.length
|
|
564
|
+
}), t;
|
|
565
|
+
}
|
|
566
|
+
function R(e) {
|
|
567
|
+
let t = P(e);
|
|
568
|
+
if (t.length < 2) return {
|
|
569
|
+
body: e,
|
|
570
|
+
important: ""
|
|
571
|
+
};
|
|
572
|
+
let n = t[t.length - 1], r = t[t.length - 2];
|
|
573
|
+
return n.type !== "ident" || n.name !== "important" || r.type !== "delimiter" || r.text !== "!" || !F(e.slice(r.end, n.start)) ? {
|
|
574
|
+
body: e,
|
|
575
|
+
important: ""
|
|
576
|
+
} : {
|
|
577
|
+
body: e.slice(0, r.start),
|
|
578
|
+
important: e.slice(r.start)
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
function z(e, t) {
|
|
582
|
+
if (t.length === 0) return e;
|
|
583
|
+
let n = [...t].sort((e, t) => e.start - t.start), r = "", i = 0;
|
|
584
|
+
for (let t of n) t.start < i || (r += e.slice(i, t.start) + t.text, i = t.end);
|
|
585
|
+
return r + e.slice(i);
|
|
586
|
+
}
|
|
587
|
+
function qe(e) {
|
|
588
|
+
return `"${e}"`;
|
|
589
|
+
}
|
|
590
|
+
function B(e, t, n = 0) {
|
|
591
|
+
if (t.size === 0) return e;
|
|
592
|
+
if (n > 64) throw C("theme.css", "font-family fallback nesting exceeds 64 levels.");
|
|
593
|
+
let { body: r, important: i } = R(e), a = [];
|
|
594
|
+
for (let e of L(r)) {
|
|
595
|
+
let i = r.slice(e.start, e.end), o = I(i);
|
|
596
|
+
if (o) {
|
|
597
|
+
let n = t.get(o.key);
|
|
598
|
+
n && a.push({
|
|
599
|
+
start: e.start + o.start,
|
|
600
|
+
end: e.start + o.end,
|
|
601
|
+
text: qe(n)
|
|
602
|
+
});
|
|
603
|
+
continue;
|
|
604
|
+
}
|
|
605
|
+
let s = P(i);
|
|
606
|
+
if (s.length !== 0 && (s.length !== 1 || s[0].type !== "ident" || !Te.has(s[0].name) && !S.has(s[0].name))) {
|
|
607
|
+
if (s.length === 1 && s[0].type === "function" && s[0].name === "var") {
|
|
608
|
+
let r = s[0], i = r.text.indexOf("("), o = r.text.slice(i + 1, -1), c = L(o), l = P(o.slice(0, c[0].end));
|
|
609
|
+
if (!r.text.endsWith(")") || l.length !== 1 || l[0].type !== "ident" || !l[0].text.startsWith("--")) throw C("theme.css", "font-family var() must start with a custom property name.");
|
|
610
|
+
if (c.length > 1) {
|
|
611
|
+
let s = c[0].end + 1, l = o.slice(s);
|
|
612
|
+
a.push({
|
|
613
|
+
start: e.start + r.start + i + 1 + s,
|
|
614
|
+
end: e.start + r.end - 1,
|
|
615
|
+
text: B(l, t, n + 1)
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
} else throw C("theme.css", "unsupported font-family syntax; use literal families or var() with a family-list fallback.");
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return z(r, a) + i;
|
|
622
|
+
}
|
|
623
|
+
function Je(e) {
|
|
624
|
+
let t = P(e);
|
|
625
|
+
if (t.length === 0 || t.length === 1 && t[0].type === "ident" && (Ee.has(t[0].name) || S.has(t[0].name))) return null;
|
|
626
|
+
let n = -1;
|
|
627
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
628
|
+
let r = t[e];
|
|
629
|
+
if (r.type === "dimension" && !/(?:deg|grad|rad|turn)$/i.test(r.text) || r.type === "percentage" || r.type === "ident" && De.has(r.name) || r.type === "number" && Number(r.text) === 0) {
|
|
630
|
+
n = e;
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
if (r.type === "function") {
|
|
634
|
+
let i = t[e + 1];
|
|
635
|
+
if ([
|
|
636
|
+
"calc",
|
|
637
|
+
"min",
|
|
638
|
+
"max",
|
|
639
|
+
"clamp"
|
|
640
|
+
].includes(r.name) || r.name === "var" && i?.type === "delimiter" && i.text === "/") {
|
|
641
|
+
n = e;
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (n < 0) return null;
|
|
647
|
+
let r = n + 1, i = t[r];
|
|
648
|
+
return i?.type === "delimiter" && i.text === "/" && (r += 2), r >= t.length ? null : t[r].start;
|
|
649
|
+
}
|
|
650
|
+
function Ye(e, t) {
|
|
651
|
+
if (t.size === 0) return e;
|
|
652
|
+
let { body: n, important: r } = R(e), i = Je(n);
|
|
653
|
+
if (i === null) {
|
|
654
|
+
let t = P(n);
|
|
655
|
+
if (t.length === 1 && t[0].type === "ident" && (Ee.has(t[0].name) || S.has(t[0].name)) || t.length === 1 && t[0].type === "function" && t[0].name === "var" && L(t[0].text.slice(t[0].text.indexOf("(") + 1, -1)).length === 1) return e;
|
|
656
|
+
throw C("theme.css", "unsupported font shorthand; use an explicit font size (including calc/min/max/clamp) and a family list.");
|
|
657
|
+
}
|
|
658
|
+
let a = B(n.slice(i), t);
|
|
659
|
+
return n.slice(0, i) + a + r;
|
|
660
|
+
}
|
|
661
|
+
function V(e, t = !1, n = 0) {
|
|
662
|
+
if (n > 64) throw C("theme.css", "nested font declarations exceed 64 levels.");
|
|
663
|
+
let r = [], i = (i) => {
|
|
664
|
+
let a = j(e, i + 1);
|
|
665
|
+
if (t) for (let t of V(e.slice(i + 1, a), !0, n + 1)) r.push({
|
|
666
|
+
name: t.name,
|
|
667
|
+
valueStart: i + 1 + t.valueStart,
|
|
668
|
+
valueEnd: i + 1 + t.valueEnd
|
|
669
|
+
});
|
|
670
|
+
return Math.min(a + 1, e.length);
|
|
671
|
+
}, a = 0;
|
|
672
|
+
for (; a < e.length && (a = A(e, a), !(a >= e.length));) {
|
|
673
|
+
if (e[a] === ";" || e[a] === "}") {
|
|
674
|
+
a += 1;
|
|
675
|
+
continue;
|
|
676
|
+
}
|
|
677
|
+
if (e[a] === "{") {
|
|
678
|
+
a = i(a);
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
let t = a, n = a;
|
|
682
|
+
for (; n < e.length;) {
|
|
683
|
+
let t = e[n];
|
|
684
|
+
if (t === "\"" || t === "'") n = O(e, n);
|
|
685
|
+
else if (t === "/" && e[n + 1] === "*") n = A(e, n);
|
|
686
|
+
else if (t === "(" || t === "[") n = k(e, n, t, t === "(" ? ")" : "]");
|
|
687
|
+
else {
|
|
688
|
+
if (t === ":" || t === ";" || t === "{" || t === "}") break;
|
|
689
|
+
n += 1;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
if (n >= e.length) break;
|
|
693
|
+
if (e[n] !== ":") {
|
|
694
|
+
a = e[n] === "{" ? i(n) : n + 1;
|
|
695
|
+
continue;
|
|
696
|
+
}
|
|
697
|
+
let o = P(e.slice(t, n)), s = o.length === 1 && o[0].type === "ident" ? o[0] : void 0, c = s?.text ?? "", l = c.startsWith("--") ? c : c.toLowerCase(), u = n + 1, d = u;
|
|
698
|
+
for (; d < e.length;) {
|
|
699
|
+
let t = e[d];
|
|
700
|
+
if (t === "\"" || t === "'") d = O(e, d);
|
|
701
|
+
else if (t === "/" && e[d + 1] === "*") d = A(e, d);
|
|
702
|
+
else if (t === "(" || t === "[") d = k(e, d, t, t === "(" ? ")" : "]");
|
|
703
|
+
else if (t === "{" && c.startsWith("--")) d = j(e, d + 1) + 1;
|
|
704
|
+
else {
|
|
705
|
+
if (t === ";" || t === "{" || t === "}") break;
|
|
706
|
+
d += 1;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
e[d] === "{" ? a = i(d) : (s && r.push({
|
|
710
|
+
name: l,
|
|
711
|
+
valueStart: u,
|
|
712
|
+
valueEnd: d
|
|
713
|
+
}), a = d, e[d] === ";" && (a += 1));
|
|
714
|
+
}
|
|
715
|
+
return r;
|
|
716
|
+
}
|
|
717
|
+
function Xe(e, t) {
|
|
718
|
+
if (t.size === 0) return e;
|
|
719
|
+
let n = [];
|
|
720
|
+
for (let r of V(e, !0)) {
|
|
721
|
+
let i = r.name === "font-family" || r.name === "--font-sans" || r.name === "--font-mono";
|
|
722
|
+
if (!i && r.name !== "font") continue;
|
|
723
|
+
let a = e.slice(r.valueStart, r.valueEnd), o = i ? B(a, t) : Ye(a, t);
|
|
724
|
+
o !== a && n.push({
|
|
725
|
+
start: r.valueStart,
|
|
726
|
+
end: r.valueEnd,
|
|
727
|
+
text: o
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
return z(e, n);
|
|
731
|
+
}
|
|
732
|
+
function Ze(e, t, n) {
|
|
733
|
+
let r = 0;
|
|
734
|
+
for (; r < e.length;) {
|
|
735
|
+
let i = e[r];
|
|
736
|
+
if (/\s/.test(i) || i === ";" || i === "}") {
|
|
737
|
+
r += 1;
|
|
738
|
+
continue;
|
|
739
|
+
}
|
|
740
|
+
if (i === "/" && e[r + 1] === "*") {
|
|
741
|
+
let t = e.indexOf("*/", r + 2);
|
|
742
|
+
r = t < 0 ? e.length : t + 2;
|
|
743
|
+
continue;
|
|
744
|
+
}
|
|
745
|
+
if (i === "{") {
|
|
746
|
+
r = j(e, r + 1) + 1;
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
let a = r, o = r;
|
|
750
|
+
for (; o < e.length;) {
|
|
751
|
+
let t = e[o];
|
|
752
|
+
if (t === "\"" || t === "'") o = O(e, o);
|
|
753
|
+
else if (t === "/" && e[o + 1] === "*") {
|
|
754
|
+
let t = e.indexOf("*/", o + 2);
|
|
755
|
+
o = t < 0 ? e.length : t + 2;
|
|
756
|
+
} else if (t === "(" || t === "[") o = k(e, o, t, t === "(" ? ")" : "]");
|
|
757
|
+
else {
|
|
758
|
+
if (t === "{" || t === ";" || t === "}") break;
|
|
759
|
+
o += 1;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
if (o >= e.length) break;
|
|
763
|
+
if (e[o] !== "{") {
|
|
764
|
+
r = o + 1;
|
|
765
|
+
continue;
|
|
766
|
+
}
|
|
767
|
+
let s = j(e, o + 1), c = e.slice(a, o).trim();
|
|
768
|
+
if (c.startsWith("@")) {
|
|
769
|
+
let r = (/^@([A-Za-z-]+)/.exec(c)?.[1] ?? "").toLowerCase();
|
|
770
|
+
r === "font-face" ? n(e.slice(o + 1, s), t) : Ce.has(r) && Ze(e.slice(o + 1, s), t, n);
|
|
771
|
+
}
|
|
772
|
+
r = Math.min(s + 1, e.length);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
function Qe(e, t) {
|
|
776
|
+
let n = V(e).filter((e) => e.name === "font-family");
|
|
777
|
+
if (n.length === 0) throw C(t, "@font-face must declare a font-family descriptor.");
|
|
778
|
+
if (n.length > 1) throw C(t, "@font-face may declare font-family only once.");
|
|
779
|
+
let { body: r, important: i } = R(e.slice(n[0].valueStart, n[0].valueEnd));
|
|
780
|
+
if (i !== "") throw C(t, "@font-face descriptors must not use !important.");
|
|
781
|
+
if (L(r).length !== 1) throw C(t, "@font-face font-family must be a single family name, not a list.");
|
|
782
|
+
let a = I(r);
|
|
783
|
+
if (!a) throw C(t, "@font-face font-family must be one quoted or unquoted family name; generic families, keywords, var() and other functions are not allowed.");
|
|
784
|
+
if (Ve(We(a.key)?.original ?? a.key).length > we) throw C(t, `@font-face font-family must not exceed ${we} UTF-8 bytes.`);
|
|
785
|
+
return a.key;
|
|
786
|
+
}
|
|
787
|
+
function $e(e, t, n) {
|
|
788
|
+
let r = /* @__PURE__ */ new Map();
|
|
789
|
+
for (let i of e) Ze(i.css, n, (e, n) => {
|
|
790
|
+
let i = Qe(e, n), a = We(i), o = a ? a.original : i, s = Ue(t, o), c = r.get(i);
|
|
791
|
+
if (c !== void 0 && c !== s) throw C(n, `@font-face family "${i}" maps to more than one name.`);
|
|
792
|
+
r.set(i, s), r.set(o, s);
|
|
793
|
+
});
|
|
794
|
+
return r;
|
|
795
|
+
}
|
|
796
|
+
function et(e, t, n) {
|
|
797
|
+
let r = V(e).filter((e) => e.name === "font-family");
|
|
798
|
+
if (r.length !== 1) throw C(n, "@font-face must declare exactly one font-family descriptor.");
|
|
799
|
+
let i = r[0], { body: a } = R(e.slice(i.valueStart, i.valueEnd));
|
|
800
|
+
if (L(a).length !== 1) throw C(n, "@font-face font-family must be a single family name, not a list.");
|
|
801
|
+
let o = I(a);
|
|
802
|
+
if (!o) throw C(n, "@font-face has an unsupported font-family descriptor.");
|
|
803
|
+
let s = t.get(o.key);
|
|
804
|
+
if (s === void 0) throw C(n, `@font-face family "${o.key}" was not registered.`);
|
|
805
|
+
return z(e, [{
|
|
806
|
+
start: i.valueStart + o.start,
|
|
807
|
+
end: i.valueStart + o.end,
|
|
808
|
+
text: qe(s)
|
|
809
|
+
}]);
|
|
810
|
+
}
|
|
811
|
+
var tt = /* @__PURE__ */ new Map();
|
|
812
|
+
function nt(e, t, n = tt) {
|
|
813
|
+
let r = "", i = 0;
|
|
814
|
+
for (; i < e.length;) {
|
|
815
|
+
let a = e[i];
|
|
816
|
+
if (a === "/" && e[i + 1] === "*") {
|
|
817
|
+
let t = e.indexOf("*/", i + 2), n = t < 0 ? e.length : t + 2;
|
|
818
|
+
r += e.slice(i, n), i = n;
|
|
819
|
+
continue;
|
|
820
|
+
}
|
|
821
|
+
if (/\s/.test(a) || a === ";" || a === "}") {
|
|
822
|
+
r += a, i += 1;
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
let o = i, s = i;
|
|
826
|
+
for (; s < e.length;) {
|
|
827
|
+
let t = e[s];
|
|
828
|
+
if (t === "\"" || t === "'") s = O(e, s);
|
|
829
|
+
else if (t === "/" && e[s + 1] === "*") {
|
|
830
|
+
let t = e.indexOf("*/", s + 2);
|
|
831
|
+
s = t < 0 ? e.length : t + 2;
|
|
832
|
+
} else if (t === "(") s = k(e, s, "(", ")");
|
|
833
|
+
else if (t === "[") s = k(e, s, "[", "]");
|
|
834
|
+
else {
|
|
835
|
+
if (t === "{" || t === ";" || t === "}") break;
|
|
836
|
+
s += 1;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
if (s >= e.length) {
|
|
840
|
+
r += e.slice(o);
|
|
841
|
+
break;
|
|
842
|
+
}
|
|
843
|
+
let c = e.slice(o, s), l = e[s];
|
|
844
|
+
if (l === ";" || l === "}") {
|
|
845
|
+
r += c + l, i = s + 1;
|
|
846
|
+
continue;
|
|
847
|
+
}
|
|
848
|
+
let u = j(e, s + 1), d = e.slice(s + 1, u), f = c.trim();
|
|
849
|
+
if (f.startsWith("@")) {
|
|
850
|
+
let e = (/^@([A-Za-z-]+)/.exec(f)?.[1] ?? "").toLowerCase();
|
|
851
|
+
if (e === "import") throw C("theme.css", "must not use @import.");
|
|
852
|
+
if (e === "keyframes" || e.endsWith("-keyframes")) throw C("theme.css", `@${e} declares a global name; phase one only supports document-scoped CSS.`);
|
|
853
|
+
if (e === "font-face") r += `${f} {${et(d, n, "theme.css")}}`;
|
|
854
|
+
else {
|
|
855
|
+
let i = Ce.has(e) ? nt(d, t, n) : d;
|
|
856
|
+
r += `${f} {${i}}`;
|
|
857
|
+
}
|
|
858
|
+
} else r += `${Be(f, t)} {${Xe(d, n)}}`;
|
|
859
|
+
i = Math.min(u + 1, e.length);
|
|
860
|
+
}
|
|
861
|
+
return r;
|
|
862
|
+
}
|
|
863
|
+
function H(e, t, n = tt) {
|
|
864
|
+
return nt(e, t, n);
|
|
865
|
+
}
|
|
866
|
+
function U(e, t) {
|
|
867
|
+
if (!Array.isArray(e)) throw C(t, "must be an array of { id, css } resources.");
|
|
868
|
+
if (e.length > he) throw C(t, `may contain at most ${he} resources.`);
|
|
869
|
+
let n = /* @__PURE__ */ new Set(), r = [], i = 0;
|
|
870
|
+
for (let a = 0; a < e.length; a += 1) {
|
|
871
|
+
let o = e[a], s = `${t}[${a}]`;
|
|
872
|
+
if (!ke(o)) throw C(s, "must be an object.");
|
|
873
|
+
let c = o.id;
|
|
874
|
+
if (typeof c != "string" || c.length === 0) throw C(`${s}.id`, "must be a non-empty string.");
|
|
875
|
+
if (c.length > ge) throw C(`${s}.id`, `must not exceed ${ge} characters.`);
|
|
876
|
+
if (!ye.test(c)) throw C(`${s}.id`, `"${c}" must start with a letter and use letters, digits, ".", "_", "-" or "/".`);
|
|
877
|
+
if (n.has(c)) throw C(`${s}.id`, `"${c}" is declared more than once.`);
|
|
878
|
+
n.add(c);
|
|
879
|
+
let l = o.css;
|
|
880
|
+
if (typeof l != "string") throw C(`${s}.css`, "must be a string.");
|
|
881
|
+
if (l.length > _e) throw C(`${s}.css`, `must not exceed ${_e} characters.`);
|
|
882
|
+
if (i += l.length, i > x) throw C(t, `must not exceed ${x} characters in total.`);
|
|
883
|
+
Pe(l, `${s}.css`), r.push(Object.freeze({
|
|
884
|
+
id: c,
|
|
885
|
+
css: l
|
|
886
|
+
}));
|
|
887
|
+
}
|
|
888
|
+
return {
|
|
889
|
+
resources: Object.freeze(r),
|
|
890
|
+
totalLength: i
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
function W(e) {
|
|
894
|
+
return Object.freeze({
|
|
895
|
+
id: e.id,
|
|
896
|
+
name: e.name,
|
|
897
|
+
version: e.version,
|
|
898
|
+
protocol: e.protocol,
|
|
899
|
+
colorSchemes: Object.freeze([...e.colorSchemes]),
|
|
900
|
+
css: Object.freeze(e.css.map((e) => Object.freeze({
|
|
901
|
+
id: e.id,
|
|
902
|
+
css: e.css
|
|
903
|
+
})))
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
function rt(e, t) {
|
|
907
|
+
let n = w(e, t), r = T(n.id, `${t}.id`), i = E(n.name, `${t}.name`), a = D(n.version, `${t}.version`);
|
|
908
|
+
if (n.protocol !== "reactive-md-theme-1") throw C(`${t}.protocol`, `must be "${y}".`);
|
|
909
|
+
let o = Ae(n.colorSchemes, `${t}.colorSchemes`), { resources: s } = U(n.css, `${t}.css`);
|
|
910
|
+
return W({
|
|
911
|
+
id: r,
|
|
912
|
+
name: i,
|
|
913
|
+
version: a,
|
|
914
|
+
protocol: y,
|
|
915
|
+
colorSchemes: o,
|
|
916
|
+
css: s
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
function G(e) {
|
|
920
|
+
let t = w(e, "input"), n = T(t.id, "theme.id"), r = E(t.name, "theme.name"), i = D(t.version, "theme.version");
|
|
921
|
+
if ((t.protocol === void 0 ? "reactive-md-theme-1" : t.protocol) !== "reactive-md-theme-1") throw C("theme.protocol", `must be "${y}".`);
|
|
922
|
+
let a = Ae(t.colorSchemes, "theme.colorSchemes"), { resources: o } = U(t.css, "theme.css"), s = $e(o, r, "theme.css");
|
|
923
|
+
return W({
|
|
924
|
+
id: n,
|
|
925
|
+
name: r,
|
|
926
|
+
version: i,
|
|
927
|
+
protocol: y,
|
|
928
|
+
colorSchemes: a,
|
|
929
|
+
css: o.map((e) => Object.freeze({
|
|
930
|
+
id: e.id,
|
|
931
|
+
css: H(e.css, r, s)
|
|
932
|
+
}))
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
function it(e) {
|
|
936
|
+
let t = w(e, "input"), n = T(t.id, "theme.id"), r = E(t.name, "theme.name"), i = D(t.version, "theme.version"), a = rt(t.base, "theme.base"), o = U(t.overrides, "theme.overrides"), s = $e([...a.css, ...o.resources], r, "theme.css"), c = new Set(a.css.map((e) => e.id));
|
|
937
|
+
for (let e of o.resources) {
|
|
938
|
+
if (c.has(e.id)) throw C("theme.overrides", `resource "${e.id}" is already declared by the base theme.`);
|
|
939
|
+
c.add(e.id);
|
|
940
|
+
}
|
|
941
|
+
let l = [...a.css.map((e) => Object.freeze({
|
|
942
|
+
id: e.id,
|
|
943
|
+
css: H(e.css, r, s)
|
|
944
|
+
})), ...o.resources.map((e) => Object.freeze({
|
|
945
|
+
id: e.id,
|
|
946
|
+
css: H(e.css, r, s)
|
|
947
|
+
}))], u = 0;
|
|
948
|
+
for (let e of l) if (u += e.css.length, u > x) throw C("theme.css", `must not exceed ${x} characters in total.`);
|
|
949
|
+
return W({
|
|
950
|
+
id: n,
|
|
951
|
+
name: r,
|
|
952
|
+
version: i,
|
|
953
|
+
protocol: a.protocol,
|
|
954
|
+
colorSchemes: a.colorSchemes,
|
|
955
|
+
css: l
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
function at(e) {
|
|
959
|
+
let { resources: t } = U(w(e, "theme").css, "theme.css");
|
|
960
|
+
return t.map((e) => e.css).join("\n");
|
|
961
|
+
}
|
|
962
|
+
// src/sdk/preset.ts
|
|
963
|
+
var K = /* @__PURE__ */ new WeakSet();
|
|
964
|
+
function ot(e, t) {
|
|
965
|
+
let n = t instanceof Error ? t.message : String(t);
|
|
966
|
+
throw Error(`Invalid local preset (themes[${e}]): ${n}`);
|
|
967
|
+
}
|
|
968
|
+
function q(e) {
|
|
969
|
+
if (typeof e == "object" && e && K.has(e)) return e;
|
|
970
|
+
let t = r(e);
|
|
971
|
+
if (t.themes === void 0) return K.add(t), t;
|
|
972
|
+
let n = t.themes.map((e, t) => {
|
|
973
|
+
try {
|
|
974
|
+
return G(e);
|
|
975
|
+
} catch (e) {
|
|
976
|
+
ot(t, e);
|
|
977
|
+
}
|
|
978
|
+
}), i = Object.freeze({
|
|
979
|
+
...t,
|
|
980
|
+
themes: Object.freeze(n)
|
|
981
|
+
});
|
|
982
|
+
return K.add(i), i;
|
|
983
|
+
}
|
|
984
|
+
function st(e) {
|
|
985
|
+
return q(e);
|
|
986
|
+
}
|
|
987
|
+
function ct(e) {
|
|
988
|
+
return i(e);
|
|
989
|
+
}
|
|
990
|
+
// src/sdk/config.ts
|
|
991
|
+
var lt = v.id, ut = v.version, dt = Object.freeze({
|
|
992
|
+
id: lt,
|
|
993
|
+
version: ut
|
|
994
|
+
}), ft = 16, pt = /* @__PURE__ */ new Set([
|
|
995
|
+
"presets",
|
|
996
|
+
"components",
|
|
997
|
+
"replacements",
|
|
998
|
+
"themes"
|
|
999
|
+
]), J = /* @__PURE__ */ new WeakSet();
|
|
1000
|
+
function mt(e) {
|
|
1001
|
+
d(e) || m("themes", "each theme must be an object."), _(e, /* @__PURE__ */ new Set([
|
|
1002
|
+
"id",
|
|
1003
|
+
"name",
|
|
1004
|
+
"version",
|
|
1005
|
+
"protocol",
|
|
1006
|
+
"colorSchemes",
|
|
1007
|
+
"css"
|
|
1008
|
+
]), "theme");
|
|
1009
|
+
try {
|
|
1010
|
+
return G(e);
|
|
1011
|
+
} catch (e) {
|
|
1012
|
+
m("theme", e instanceof Error ? e.message : String(e));
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
function Y(e) {
|
|
1016
|
+
if (e === void 0) return Object.freeze([]);
|
|
1017
|
+
Array.isArray(e) || m("themes", "must be an array."), e.length > 16 && m("themes", "accepts at most 16 themes.");
|
|
1018
|
+
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = [];
|
|
1019
|
+
for (let i of e) {
|
|
1020
|
+
let e = mt(i);
|
|
1021
|
+
t.has(e.id) && m("themes", `theme id "${e.id}" is declared more than once.`), n.has(e.name) && m("themes", `theme name "${e.name}" is declared more than once.`), t.add(e.id), n.add(e.name), r.push(e);
|
|
1022
|
+
}
|
|
1023
|
+
return Object.freeze(r.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
|
|
1024
|
+
}
|
|
1025
|
+
function ht(e, t) {
|
|
1026
|
+
if (typeof e == "string") return e !== "default" && e !== v.id && m(`presets[${t}]`, `unsupported preset "${e}"; phase one accepts only the built-in default package.`), v;
|
|
1027
|
+
if (d(e) || m(`presets[${t}]`, "must be a preset package, \"default\" or a preset reference."), e.protocol !== void 0 || e.components !== void 0) try {
|
|
1028
|
+
return q(e);
|
|
1029
|
+
} catch (e) {
|
|
1030
|
+
m(`presets[${t}]`, e instanceof Error ? e.message : String(e));
|
|
1031
|
+
}
|
|
1032
|
+
let n = e.id, r = e.version;
|
|
1033
|
+
return typeof n != "string" && m(`presets[${t}].id`, "must be a string."), typeof r != "string" && m(`presets[${t}].version`, "must be a string."), (n === "default" ? v.id : n) !== v.id && m(`presets[${t}]`, `unsupported preset "${n}"; phase one accepts only "${v.id}".`), r !== v.version && m(`presets[${t}].version`, `must be "${v.version}".`), v;
|
|
1034
|
+
}
|
|
1035
|
+
function gt(e) {
|
|
1036
|
+
if (e === void 0) return Object.freeze([v]);
|
|
1037
|
+
Array.isArray(e) || m("presets", "must be an array.");
|
|
1038
|
+
let t = [], n = /* @__PURE__ */ new Set();
|
|
1039
|
+
for (let r = 0; r < e.length; r += 1) {
|
|
1040
|
+
let i = ht(e[r], r);
|
|
1041
|
+
n.has(i.id) && m("presets", `preset "${i.id}" is selected more than once.`), n.add(i.id), t.push(i);
|
|
1042
|
+
}
|
|
1043
|
+
return Object.freeze([...t].sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
|
|
1044
|
+
}
|
|
1045
|
+
function _t(e) {
|
|
1046
|
+
if (e === void 0) return Object.freeze([]);
|
|
1047
|
+
Array.isArray(e) || m("components", "must be an array.");
|
|
1048
|
+
let t = e.map((e, t) => {
|
|
1049
|
+
try {
|
|
1050
|
+
return a(e);
|
|
1051
|
+
} catch (e) {
|
|
1052
|
+
m(`components[${t}]`, e instanceof Error ? e.message : String(e));
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
return Object.freeze(t.sort((e, t) => {
|
|
1056
|
+
if (e.id !== t.id) return e.id < t.id ? -1 : 1;
|
|
1057
|
+
let n = e.replaces === void 0 ? 0 : 1, r = t.replaces === void 0 ? 0 : 1;
|
|
1058
|
+
return n === r ? e.version === t.version ? e.name < t.name ? -1 : +(e.name > t.name) : e.version < t.version ? -1 : 1 : n - r;
|
|
1059
|
+
}));
|
|
1060
|
+
}
|
|
1061
|
+
function vt(e) {
|
|
1062
|
+
return e === void 0 ? "allow" : (e !== "allow" && e !== "forbid" && m("replacements", "must be \"allow\" or \"forbid\"."), e);
|
|
1063
|
+
}
|
|
1064
|
+
function yt(e, n) {
|
|
1065
|
+
d(e) || m(n, "must be an object."), _(e, pt, n);
|
|
1066
|
+
let r = Object.freeze({
|
|
1067
|
+
protocol: t,
|
|
1068
|
+
presets: gt(e.presets),
|
|
1069
|
+
components: _t(e.components),
|
|
1070
|
+
replacementPolicy: vt(e.replacements),
|
|
1071
|
+
themes: Y(e.themes)
|
|
1072
|
+
});
|
|
1073
|
+
return o(r) > 16777216 && m(n, `serialized size exceeds the ${h}-byte budget.`), r;
|
|
1074
|
+
}
|
|
1075
|
+
function bt(e) {
|
|
1076
|
+
return Object.freeze({
|
|
1077
|
+
...e,
|
|
1078
|
+
presets: Object.freeze(e.presets.map((e) => q(e))),
|
|
1079
|
+
themes: Y(e.themes)
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
function X(e) {
|
|
1083
|
+
let t = bt(e), n = te(t, { legacyProfiles: p }), r = ee(t, n);
|
|
1084
|
+
return J.add(r), r;
|
|
1085
|
+
}
|
|
1086
|
+
function Z(e = {}) {
|
|
1087
|
+
return X(yt(e, "config"));
|
|
1088
|
+
}
|
|
1089
|
+
var xt;
|
|
1090
|
+
function St(e) {
|
|
1091
|
+
return e === void 0 ? xt ??= Z().key : Q(e).key;
|
|
1092
|
+
}
|
|
1093
|
+
function Ct(e) {
|
|
1094
|
+
return new Set(e.legacyKeys.map((e) => e.key));
|
|
1095
|
+
}
|
|
1096
|
+
function wt(e, t) {
|
|
1097
|
+
let n = Q(t ?? Z()), r = e.componentConfigKey;
|
|
1098
|
+
return r === void 0 || r === n.key || Ct(n).has(r) ? [] : [{
|
|
1099
|
+
code: "local.extension.config-mismatch",
|
|
1100
|
+
severity: "error",
|
|
1101
|
+
message: "The document compiler configuration differs from the installed renderer. Recompile with the same host.config used by host.reactConfig (including Worker requests).",
|
|
1102
|
+
range: {
|
|
1103
|
+
start: 0,
|
|
1104
|
+
end: 0
|
|
1105
|
+
},
|
|
1106
|
+
line: 1,
|
|
1107
|
+
column: 1
|
|
1108
|
+
}];
|
|
1109
|
+
}
|
|
1110
|
+
function Tt(e) {
|
|
1111
|
+
return e.preset.id === v.id && e.preset.version === v.version ? v : q({
|
|
1112
|
+
...v,
|
|
1113
|
+
id: e.preset.id,
|
|
1114
|
+
version: e.preset.version
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
function Et(e, n) {
|
|
1118
|
+
let r = ae(e.presets, dt, n)[0] ?? dt, i = u(r, n);
|
|
1119
|
+
i === void 0 && m("presets", `local.config.migration-unsupported: no compatibility profile matches preset "${r.id}" ${r.version}.`);
|
|
1120
|
+
let a = i.legacyKeys[0];
|
|
1121
|
+
a === void 0 && m("presets", `local.config.migration-unsupported: profile "${i.name}" has no legacy key mapping.`), f(i, v.components);
|
|
1122
|
+
let o = Tt(i), s = re(e.components, v.components);
|
|
1123
|
+
s.some((e) => e.replaces !== void 0) && m("config", "replaces is not supported by reactive-md-config/v1.");
|
|
1124
|
+
let c = Y(e.themes), l = Object.freeze({
|
|
1125
|
+
protocol: t,
|
|
1126
|
+
presets: Object.freeze([o]),
|
|
1127
|
+
components: s,
|
|
1128
|
+
replacementPolicy: "forbid",
|
|
1129
|
+
themes: c
|
|
1130
|
+
}), d = te(l, { legacyProfiles: n }), p = ie(i.preset, d.components), ne = [...d.legacyKeys, ...d.legacyKeys.some((e) => e.key === p) ? [] : [Object.freeze({
|
|
1131
|
+
profile: a.profile,
|
|
1132
|
+
key: p
|
|
1133
|
+
})]], h = ee(l, d, ne);
|
|
1134
|
+
return J.add(h), h;
|
|
1135
|
+
}
|
|
1136
|
+
function Q(t, r = []) {
|
|
1137
|
+
return typeof t == "object" && t && J.has(t) ? t : (d(t) || m("config", "must be an object."), _(t, oe, "config"), t.protocol === "reactive-md-config/v1" ? Et(t, se(r)) : (t.protocol !== "reactive-md-config/v2" && m("config.protocol", `must be "${e}" (or legacy "${n}").`), X(ne(t.assembly))));
|
|
1138
|
+
}
|
|
1139
|
+
function Dt(e) {
|
|
1140
|
+
if (typeof e == "object" && e && J.has(e)) return e.key;
|
|
1141
|
+
try {
|
|
1142
|
+
return Q(e).key;
|
|
1143
|
+
} catch {
|
|
1144
|
+
try {
|
|
1145
|
+
return `invalid:${s(JSON.stringify(e))}`;
|
|
1146
|
+
} catch {
|
|
1147
|
+
return "invalid";
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
function Ot(e) {
|
|
1152
|
+
try {
|
|
1153
|
+
return Q(e);
|
|
1154
|
+
} catch {
|
|
1155
|
+
return e;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
// src/sdk/registry.ts
|
|
1159
|
+
function kt() {
|
|
1160
|
+
return le;
|
|
1161
|
+
}
|
|
1162
|
+
function $(e) {
|
|
1163
|
+
return e ? Q(e).registry : kt();
|
|
1164
|
+
}
|
|
1165
|
+
function At(e, t) {
|
|
1166
|
+
let n = $(t);
|
|
1167
|
+
for (let t of n) if (t.name === e) return t;
|
|
1168
|
+
}
|
|
1169
|
+
function jt(e) {
|
|
1170
|
+
let t = /* @__PURE__ */ new Map();
|
|
1171
|
+
for (let n of $(e)) t.set(n.name, ce(n));
|
|
1172
|
+
return t;
|
|
1173
|
+
}
|
|
1174
|
+
export { pe as S, it as _, ut as a, b, St as c, Ot as d, wt as f, at as g, q as h, lt as i, Dt as l, ct as m, $ as n, ft as o, st as p, jt as r, Z as s, At as t, Q as u, G as v, y as x, Fe as y };
|