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