reactive-md 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +397 -333
- package/CHANGELOG.md +398 -334
- package/CONTRIBUTING-ch.md +22 -22
- package/CONTRIBUTING.md +22 -22
- package/README-ch.md +431 -431
- package/README-en.md +431 -431
- package/README.md +429 -429
- package/SECURITY-ch.md +83 -83
- package/SECURITY.md +83 -83
- package/THIRD_PARTY_NOTICES.md +0 -57
- package/bin/reactive-md.mjs +39 -39
- package/cli/args.mjs +263 -263
- package/cli/assets.mjs +395 -395
- package/cli/build.mjs +445 -445
- package/cli/check.mjs +444 -444
- package/cli/document.mjs +130 -130
- package/cli/errors.mjs +61 -61
- package/cli/fs-utils.mjs +133 -133
- package/cli/glob.mjs +203 -203
- package/cli/help.mjs +325 -323
- package/cli/init.mjs +1577 -1577
- package/cli/lint.mjs +177 -177
- package/cli/main.mjs +65 -65
- package/cli/migrate.mjs +368 -368
- package/cli/package-loader.mjs +41 -41
- package/cli/package.mjs +211 -211
- package/dist-library/LocalDocumentView-CP2QG86k.js +114 -0
- package/dist-library/{LocalDocumentViewCore-DXE0I0Qc.js → LocalDocumentViewCore-Cd6yMEkg.js} +379 -9445
- package/dist-library/LocalReactiveDocumentCore-VuYpZqdn.js +283 -0
- package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
- package/dist-library/authoring-Bwu_zCWs.js +768 -0
- package/dist-library/chart-B1TUtzm-.js +3 -0
- package/dist-library/choice-values-BItGjPD2.js +58 -0
- package/dist-library/color-values-r8Wf7ALn.js +6 -0
- package/dist-library/compile-B35rfzKr.js +1742 -0
- package/dist-library/compile-cache-key-D21X2Obx.js +28 -0
- package/dist-library/compiler-DBwLawMZ.js +98 -0
- package/dist-library/{compiler-core-DDDdvuLy.js → compiler-core-kkDiQ1RK.js} +4202 -3496
- package/dist-library/component-kernel-CsJSabHX.js +372 -0
- package/dist-library/{component-state-BRwvTV0d.js → component-state-Da0G8Ajc.js} +1 -1
- package/dist-library/component-utils-ZM3jUJNy.js +339 -0
- package/dist-library/conditional-branches-CIhJXasR.js +17 -0
- package/dist-library/config-validation-DbmsWAEV.js +469 -0
- package/dist-library/controls-DRy5rzzN.js +5970 -0
- package/dist-library/controls-DWlx-AQl.js +3 -0
- package/dist-library/{coordinate-B1VFK9fd.js → coordinate-c54pHfgf.js} +89 -89
- package/dist-library/data-BtFlkJzp.js +3 -0
- package/dist-library/data-table-CSAkm1eU.js +290 -0
- package/dist-library/data-table-model-DruztQFt.js +391 -0
- package/dist-library/data-visuals-rZQUeQM0.js +384 -0
- package/dist-library/{default-components-s21NevON.js → default-components-B-39etG9.js} +518 -355
- package/dist-library/{config-DXLvctiZ.js → default-config-CCa8rm2k.js} +265 -230
- package/dist-library/default-options-By16CVw1.js +131 -0
- package/dist-library/{registry-D6OGkOcX.js → default-registry-DXJy66xj.js} +4 -4
- package/dist-library/default-schema-CeYiEW1K.js +33 -0
- package/dist-library/diagram-BLepzI8l.js +3 -0
- package/dist-library/display-Bb6hAG5T.js +2065 -0
- package/dist-library/dist-Cueh1Psp.js +4761 -0
- package/dist-library/{document-theme-C8J6UyNO.js → document-theme-CJvN-nC1.js} +246 -4
- package/dist-library/{export-CIAIPBov.js → export-BSV4E0jv.js} +135 -135
- package/dist-library/font-aliases-CKYjwn4o.js +4 -0
- package/dist-library/gallery-BC6FYTqw.js +3 -0
- package/dist-library/{gallery-Dv1rOvL0.js → gallery-DM2yTVZJ.js} +1 -1
- package/dist-library/{html-Cr4CBwAH.js → html-CY9mC3Sr.js} +49 -48
- package/dist-library/{incremental-9nx92u9c.js → incremental-B-wW4H3F.js} +537 -384
- package/dist-library/{display-B_uutKkN.js → katex-4ukd4ZxT.js} +1555 -3618
- package/dist-library/layout-CPQggKxk.js +592 -0
- package/dist-library/layout-CaDWsDof.js +3 -0
- package/dist-library/limits-CFERRrlC.js +10 -0
- package/dist-library/localization-COdJ6lw2.js +6 -0
- package/dist-library/mafs-CnzDC5CR.js +3 -0
- package/dist-library/math-view-CyGTS6kv.js +20 -0
- package/dist-library/motion-tokens-Czk0RDmS.js +283 -0
- package/dist-library/mount-preset-DtrCX4G8.js +24 -0
- package/dist-library/numeric-sliders-BmJ1LCLx.js +542 -0
- package/dist-library/{observability-4KqXhIEU.js → observability-BVQ16ByQ.js} +125 -43
- package/dist-library/package-core-Cu_r_qs7.js +128 -0
- package/dist-library/parser-BHl9Lxbw.js +8 -0
- package/dist-library/parser-standard-DDAKv_DZ.js +4872 -0
- package/dist-library/plugin-packs-CkI0floL.js +19 -0
- package/dist-library/preset-core-BKPbH_Nv.js +1371 -0
- package/dist-library/props-0iDqxlTk.js +174 -0
- package/dist-library/react-74jdGBmu.js +32 -0
- package/dist-library/reactive-md-authoring.js +315 -296
- package/dist-library/reactive-md-build.js +334 -43
- package/dist-library/reactive-md-compiler-session.js +4 -0
- package/dist-library/reactive-md-compiler-standard.js +10 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-contracts.js +6 -0
- package/dist-library/reactive-md-default-packs.js +32 -15
- package/dist-library/reactive-md-default-preset.js +7 -7
- package/dist-library/reactive-md-export.js +6 -5
- package/dist-library/reactive-md-minimal-preset.js +3 -2
- package/dist-library/reactive-md-minimal-react-preset.js +26 -23
- package/dist-library/reactive-md-minimal.css +1 -1
- package/dist-library/reactive-md-observability.js +125 -3
- package/dist-library/reactive-md-pack-style-manifest.js +805 -0
- package/dist-library/reactive-md-plugin-chart.js +14 -9
- package/dist-library/reactive-md-plugin-data.js +8 -8
- package/dist-library/reactive-md-plugin-diagram.js +7 -6
- package/dist-library/reactive-md-plugin-forms.js +14 -13
- package/dist-library/reactive-md-plugin-gallery.js +6 -5
- package/dist-library/reactive-md-plugin-navigation.js +8 -8
- package/dist-library/reactive-md-plugin-network.js +13 -13
- package/dist-library/reactive-md-plugin-plot.js +7 -6
- package/dist-library/reactive-md-print.css +304 -304
- package/dist-library/reactive-md-react-component-accordion.js +10 -0
- package/dist-library/reactive-md-react-component-alert.js +10 -0
- package/dist-library/reactive-md-react-component-anchor.js +10 -0
- package/dist-library/reactive-md-react-component-badge.js +10 -0
- package/dist-library/reactive-md-react-component-card.js +10 -0
- package/dist-library/reactive-md-react-component-chart.js +22 -0
- package/dist-library/reactive-md-react-component-checkbox.js +10 -0
- package/dist-library/reactive-md-react-component-checklist.js +10 -0
- package/dist-library/reactive-md-react-component-choices.js +10 -0
- package/dist-library/reactive-md-react-component-column.js +6 -0
- package/dist-library/reactive-md-react-component-coordinate.js +21 -0
- package/dist-library/reactive-md-react-component-counter.js +10 -0
- package/dist-library/reactive-md-react-component-data-table.js +14 -0
- package/dist-library/reactive-md-react-component-date.js +10 -0
- package/dist-library/reactive-md-react-component-diagram.js +22 -0
- package/dist-library/reactive-md-react-component-disclosure.js +10 -0
- package/dist-library/reactive-md-react-component-edge.js +22 -0
- package/dist-library/reactive-md-react-component-else.js +10 -0
- package/dist-library/reactive-md-react-component-gallery-item.js +10 -0
- package/dist-library/reactive-md-react-component-gallery.js +10 -0
- package/dist-library/reactive-md-react-component-grid.js +10 -0
- package/dist-library/reactive-md-react-component-if.js +10 -0
- package/dist-library/reactive-md-react-component-input.js +10 -0
- package/dist-library/reactive-md-react-component-jump.js +10 -0
- package/dist-library/reactive-md-react-component-multi-select.js +10 -0
- package/dist-library/reactive-md-react-component-node.js +22 -0
- package/dist-library/reactive-md-react-component-number.js +10 -0
- package/dist-library/reactive-md-react-component-option.js +10 -0
- package/dist-library/reactive-md-react-component-panel.js +10 -0
- package/dist-library/reactive-md-react-component-plot.js +26 -0
- package/dist-library/reactive-md-react-component-progress.js +10 -0
- package/dist-library/reactive-md-react-component-quiz.js +10 -0
- package/dist-library/reactive-md-react-component-radio-group.js +10 -0
- package/dist-library/reactive-md-react-component-range-slider.js +10 -0
- package/dist-library/reactive-md-react-component-section.js +10 -0
- package/dist-library/reactive-md-react-component-select.js +10 -0
- package/dist-library/reactive-md-react-component-slider.js +10 -0
- package/dist-library/reactive-md-react-component-step.js +10 -0
- package/dist-library/reactive-md-react-component-steps.js +10 -0
- package/dist-library/reactive-md-react-component-tab.js +10 -0
- package/dist-library/reactive-md-react-component-table.js +14 -0
- package/dist-library/reactive-md-react-component-tabs.js +10 -0
- package/dist-library/reactive-md-react-component-text.js +10 -0
- package/dist-library/reactive-md-react-component-textarea.js +10 -0
- package/dist-library/reactive-md-react-component-timeline.js +14 -0
- package/dist-library/reactive-md-react-component-timer.js +10 -0
- package/dist-library/reactive-md-react-component-toggle.js +10 -0
- package/dist-library/reactive-md-react-component-tooltip.js +10 -0
- package/dist-library/reactive-md-react-component-validation.js +10 -0
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-pack-controls.js +44 -0
- package/dist-library/reactive-md-react-pack-data.js +21 -0
- package/dist-library/reactive-md-react-pack-layout.js +37 -0
- package/dist-library/reactive-md-react-pack-visuals.js +43 -0
- package/dist-library/reactive-md-react-packed.js +50 -0
- package/dist-library/reactive-md-react-server.js +29 -27
- package/dist-library/reactive-md-react-static-server.js +24 -0
- package/dist-library/reactive-md-react-static.js +1 -0
- package/dist-library/reactive-md-react-unstyled.js +15 -12
- package/dist-library/reactive-md-react.js +15 -12
- package/dist-library/reactive-md-scan.js +1 -0
- package/dist-library/reactive-md-sdk.js +23 -9
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +32 -32
- package/dist-library/reactive-md-testing.js +12 -12
- package/dist-library/reactive-md-vite.js +25 -9
- package/dist-library/reactive-md-worker-pool.js +401 -0
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +97 -1554
- package/dist-library/registry-core-DxEaxhJ6.js +126 -0
- package/dist-library/render-nodes-B6j6Ip5I.js +9404 -0
- package/dist-library/requirements-C56sFIEs.js +157 -0
- package/dist-library/resources-6VaNgk-h.js +74 -0
- package/dist-library/rmd-pack-controls.css +1032 -0
- package/dist-library/rmd-pack-data.css +724 -0
- package/dist-library/rmd-pack-layout.css +1834 -0
- package/dist-library/rmd-pack-resource-chart.css +300 -0
- package/dist-library/rmd-pack-resource-controls.css +781 -0
- package/dist-library/rmd-pack-resource-data-visuals.css +501 -0
- package/dist-library/rmd-pack-resource-diagram.css +106 -0
- package/dist-library/rmd-pack-resource-gallery.css +346 -0
- package/dist-library/rmd-pack-resource-graphics.css +516 -0
- package/dist-library/rmd-pack-resource-layout.css +1489 -0
- package/dist-library/rmd-pack-resource-mafs-core.css +124 -0
- package/dist-library/rmd-pack-resource-mafs.css +129 -0
- package/dist-library/rmd-pack-resource-visual-base.css +224 -0
- package/dist-library/rmd-pack-visuals.css +1394 -0
- package/dist-library/runtime-BHeuLOv_.js +1369 -0
- package/dist-library/runtime-requirement-DzPO8raU.js +772 -0
- package/dist-library/schema-core-CDXfxdID.js +155 -0
- package/dist-library/sdk-core-CnE-n0Z7.js +1295 -0
- package/dist-library/{session-core-dxQCJBNa.js → session-core-C071yQwV.js} +147 -133
- package/dist-library/sha256-utf16-Bmandi_H.js +937 -0
- package/dist-library/shareable-CHCDnl6j.js +844 -0
- package/dist-library/shared-bTzN-F4g.js +3 -0
- package/dist-library/structural-views-30-YD_TJ.js +11 -0
- package/dist-library/table-surface-CfZn_tk-.js +13 -0
- package/dist-library/types/assemblies/compile-cache-key.d.ts +11 -0
- package/dist-library/types/assemblies/default-config.d.ts +35 -0
- package/dist-library/types/{local/configuration/options.d.ts → assemblies/default-options.d.ts} +4 -4
- package/dist-library/types/assemblies/default-registry.d.ts +18 -0
- package/dist-library/types/{local/configuration/schema.d.ts → assemblies/default-schema.d.ts} +4 -4
- package/dist-library/types/authoring/catalog.d.ts +14 -2
- package/dist-library/types/authoring/extensions.d.ts +1 -1
- package/dist-library/types/authoring/index.d.ts +4 -4
- package/dist-library/types/authoring/templates.d.ts +1 -1
- package/dist-library/types/compiler/index.d.ts +1 -0
- package/dist-library/types/compiler/session.d.ts +19 -0
- package/dist-library/types/compiler/standard.d.ts +1 -0
- package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
- package/dist-library/types/components/chart/default-chart.d.ts +7 -0
- package/dist-library/types/components/entries/accordion.d.ts +3 -0
- package/dist-library/types/components/entries/alert.d.ts +3 -0
- package/dist-library/types/components/entries/anchor.d.ts +3 -0
- package/dist-library/types/components/entries/badge.d.ts +3 -0
- package/dist-library/types/components/entries/card.d.ts +3 -0
- package/dist-library/types/components/entries/chart.d.ts +3 -0
- package/dist-library/types/components/entries/checkbox.d.ts +3 -0
- package/dist-library/types/components/entries/checklist.d.ts +3 -0
- package/dist-library/types/components/entries/choices.d.ts +3 -0
- package/dist-library/types/components/entries/column.d.ts +3 -0
- package/dist-library/types/components/entries/coordinate.d.ts +3 -0
- package/dist-library/types/components/entries/counter.d.ts +3 -0
- package/dist-library/types/components/entries/data-table.d.ts +3 -0
- package/dist-library/types/components/entries/date.d.ts +3 -0
- package/dist-library/types/components/entries/diagram.d.ts +3 -0
- package/dist-library/types/components/entries/disclosure.d.ts +3 -0
- package/dist-library/types/components/entries/edge.d.ts +3 -0
- package/dist-library/types/components/entries/else.d.ts +3 -0
- package/dist-library/types/components/entries/gallery-item.d.ts +3 -0
- package/dist-library/types/components/entries/gallery.d.ts +3 -0
- package/dist-library/types/components/entries/grid.d.ts +3 -0
- package/dist-library/types/components/entries/if.d.ts +3 -0
- package/dist-library/types/components/entries/input.d.ts +3 -0
- package/dist-library/types/components/entries/jump.d.ts +3 -0
- package/dist-library/types/components/entries/multi-select.d.ts +3 -0
- package/dist-library/types/components/entries/node.d.ts +3 -0
- package/dist-library/types/components/entries/number.d.ts +3 -0
- package/dist-library/types/components/entries/option.d.ts +3 -0
- package/dist-library/types/components/entries/panel.d.ts +3 -0
- package/dist-library/types/components/entries/plot.d.ts +3 -0
- package/dist-library/types/components/entries/progress.d.ts +3 -0
- package/dist-library/types/components/entries/quiz.d.ts +3 -0
- package/dist-library/types/components/entries/radio-group.d.ts +3 -0
- package/dist-library/types/components/entries/range-slider.d.ts +3 -0
- package/dist-library/types/components/entries/section.d.ts +3 -0
- package/dist-library/types/components/entries/select.d.ts +3 -0
- package/dist-library/types/components/entries/slider.d.ts +3 -0
- package/dist-library/types/components/entries/step.d.ts +3 -0
- package/dist-library/types/components/entries/steps.d.ts +3 -0
- package/dist-library/types/components/entries/tab.d.ts +3 -0
- package/dist-library/types/components/entries/table.d.ts +3 -0
- package/dist-library/types/components/entries/tabs.d.ts +3 -0
- package/dist-library/types/components/entries/text.d.ts +3 -0
- package/dist-library/types/components/entries/textarea.d.ts +3 -0
- package/dist-library/types/components/entries/timeline.d.ts +3 -0
- package/dist-library/types/components/entries/timer.d.ts +3 -0
- package/dist-library/types/components/entries/toggle.d.ts +3 -0
- package/dist-library/types/components/entries/tooltip.d.ts +3 -0
- package/dist-library/types/components/entries/validation.d.ts +3 -0
- package/dist-library/types/components/layout/layout.d.ts +6 -3
- package/dist-library/types/components/layout/structural-views.d.ts +3 -0
- package/dist-library/types/components/mount-preset.d.ts +2 -0
- package/dist-library/types/components/packs/controls.d.ts +2 -0
- package/dist-library/types/components/packs/data.d.ts +2 -0
- package/dist-library/types/components/packs/layout.d.ts +2 -0
- package/dist-library/types/components/packs/visuals.d.ts +2 -0
- package/dist-library/types/components/shared/data-visuals.d.ts +3 -0
- package/dist-library/types/components/shared/table-surface.d.ts +10 -0
- package/dist-library/types/components/shared/visual-helpers.d.ts +24 -0
- package/dist-library/types/components/shared/visuals.d.ts +1 -3
- package/dist-library/types/components/table/data-table-model.d.ts +141 -0
- package/dist-library/types/components/table/data-table.d.ts +3 -50
- package/dist-library/types/{local/configuration → contracts}/component-kernel.d.ts +9 -2
- package/dist-library/types/contracts/font-aliases.d.ts +18 -0
- package/dist-library/types/contracts/index.d.ts +8 -0
- package/dist-library/types/{local/configuration → contracts}/limits.d.ts +9 -1
- package/dist-library/types/contracts/localization.d.ts +6 -0
- package/dist-library/types/contracts/number-literal.d.ts +2 -0
- package/dist-library/types/contracts/runtime-types.d.ts +19 -0
- package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
- package/dist-library/types/export/index.d.ts +4 -1
- package/dist-library/types/local/compilation/cache-version.d.ts +1 -0
- package/dist-library/types/local/compilation/compile-status.d.ts +2 -0
- package/dist-library/types/local/compilation/compiler-bindings.d.ts +1 -1
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +4 -1
- package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +1 -1
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
- package/dist-library/types/local/compilation/compiler-embedding.d.ts +20 -0
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +17 -5
- package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +9 -3
- package/dist-library/types/local/compilation/compiler-tables.d.ts +4 -2
- package/dist-library/types/local/compilation/compiler-validation.d.ts +14 -7
- package/dist-library/types/local/compilation/compiler-values.d.ts +2 -3
- package/dist-library/types/local/compilation/compiler.d.ts +1 -1
- package/dist-library/types/local/compilation/component-usage.d.ts +2 -0
- package/dist-library/types/local/compilation/runtime-requirement.d.ts +3 -0
- package/dist-library/types/local/compilation/session/incremental.d.ts +5 -1
- package/dist-library/types/local/compilation/streaming.d.ts +1 -1
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +228 -2
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
- package/dist-library/types/local/configuration/embedding.d.ts +4 -0
- package/dist-library/types/local/configuration/kernel-value-rules.d.ts +1 -1
- package/dist-library/types/local/configuration/options-core.d.ts +8 -2
- package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
- package/dist-library/types/local/evaluation/computations.d.ts +13 -5
- package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
- package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
- package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
- package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
- package/dist-library/types/local/evaluation/validation.d.ts +8 -6
- package/dist-library/types/local/index.d.ts +10 -4
- package/dist-library/types/local/observability-core.d.ts +20 -1
- package/dist-library/types/local/observability.d.ts +2 -0
- package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
- package/dist-library/types/local/parsing/parse-budget.d.ts +18 -2
- package/dist-library/types/local/parsing/parser-region.d.ts +13 -2
- package/dist-library/types/local/parsing/parser-tags.d.ts +6 -1
- package/dist-library/types/local/parsing/rmd-recovery.d.ts +8 -0
- package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
- package/dist-library/types/local/performance-report.d.ts +70 -0
- package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
- package/dist-library/types/local/runtime/runtime-pool.d.ts +14 -0
- package/dist-library/types/local/runtime/runtime.d.ts +3 -1
- package/dist-library/types/local/runtime/state.d.ts +30 -15
- package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
- package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
- package/dist-library/types/local/source/authoring.d.ts +10 -0
- package/dist-library/types/local/source/source-migration.d.ts +1 -0
- package/dist-library/types/local/transport/worker-handler.d.ts +3 -0
- package/dist-library/types/local/transport/worker-job.d.ts +12 -2
- package/dist-library/types/local/transport/worker-pool.d.ts +68 -0
- package/dist-library/types/local/transport/worker.d.ts +14 -0
- package/dist-library/types/local/types.d.ts +70 -27
- package/dist-library/types/observability.d.ts +1 -0
- package/dist-library/types/presets/default-semantics.d.ts +1 -1
- package/dist-library/types/presets/identity.d.ts +1 -8
- package/dist-library/types/presets/pack-style-entry.d.ts +3 -0
- package/dist-library/types/presets/pack-style-manifest.d.ts +11 -0
- package/dist-library/types/react/component-api.d.ts +24 -4
- package/dist-library/types/react/component-loader.d.ts +61 -0
- package/dist-library/types/react/component-primitives.d.ts +5 -5
- package/dist-library/types/react/component-utils.d.ts +11 -0
- package/dist-library/types/react/font-aliases.d.ts +2 -0
- package/dist-library/types/react/index.d.ts +9 -5
- package/dist-library/types/react/localization.d.ts +5 -6
- package/dist-library/types/react/minimal.d.ts +2 -2
- package/dist-library/types/react/package-core.d.ts +6 -0
- package/dist-library/types/react/packed.d.ts +17 -0
- package/dist-library/types/react/render-lifecycle.d.ts +9 -0
- package/dist-library/types/{local → react}/rendering/document/ExtendedHtmlFragment.d.ts +1 -1
- package/dist-library/types/{local → react}/rendering/document/LocalDocumentViewCore.d.ts +11 -4
- package/dist-library/types/react/rendering/document/LocalPooledDocumentView.d.ts +8 -0
- package/dist-library/types/react/rendering/document/LocalReactiveDocumentCore.d.ts +6 -0
- package/dist-library/types/react/rendering/document/LocalStaticDocumentView.d.ts +18 -0
- package/dist-library/types/react/rendering/document/StaticExternalSlot.d.ts +25 -0
- package/dist-library/types/react/rendering/document/StaticHostData.d.ts +14 -0
- package/dist-library/types/{local → react}/rendering/document/render-nodes.d.ts +8 -8
- package/dist-library/types/react/rendering/document/static-runtime.d.ts +11 -0
- package/dist-library/types/{local → react}/rendering/document/use-author-script.d.ts +2 -2
- package/dist-library/types/{local → react}/rendering/document/validation-state.d.ts +3 -3
- package/dist-library/types/{local → react}/rendering/document/view-render-context.d.ts +40 -8
- package/dist-library/types/{local → react}/rendering/document/view-revision.d.ts +5 -14
- package/dist-library/types/{local → react}/rendering/render-types.d.ts +5 -5
- package/dist-library/types/react/rendering/table/data-table.d.ts +5 -0
- package/dist-library/types/{local → react}/rendering/table/table-numeric-columns.d.ts +3 -3
- package/dist-library/types/react/sdk-core.d.ts +15 -4
- package/dist-library/types/react/sdk.d.ts +2 -1
- package/dist-library/types/react/server.d.ts +3 -10
- package/dist-library/types/react/static-server.d.ts +12 -0
- package/dist-library/types/scan/index.d.ts +15 -0
- package/dist-library/types/sdk/assembly.d.ts +3 -0
- package/dist-library/types/sdk/config.d.ts +2 -35
- package/dist-library/types/sdk/default-identity.d.ts +3 -0
- package/dist-library/types/sdk/font.d.ts +13 -0
- package/dist-library/types/sdk/index.d.ts +2 -1
- package/dist-library/types/sdk/preset.d.ts +9 -0
- package/dist-library/types/sdk/props.d.ts +8 -3
- package/dist-library/types/sdk/registry-core.d.ts +2 -2
- package/dist-library/types/sdk/registry.d.ts +2 -18
- package/dist-library/types/sdk/theme.d.ts +5 -0
- package/dist-library/types/sdk/types.d.ts +8 -2
- package/dist-library/types/sdk/version.d.ts +2 -0
- package/dist-library/types/shareable.d.ts +15 -3
- package/dist-library/types/standalone/prepare.d.ts +4 -2
- package/dist-library/types/standalone/session-core.d.ts +5 -2
- package/dist-library/types/vite/index.d.ts +3 -0
- package/dist-library/types/vite/registration.d.ts +1 -0
- package/dist-library/{types-Ib5kSScP.js → types-B4qG8J4S.js} +1 -1
- package/dist-library/types-FYhRWRn9.js +3 -0
- package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
- package/dist-library/validation-DRuW0Wl9.js +433 -0
- package/dist-library/{version-DAxuGOG2.js → version-4wzhbvDG.js} +24 -33
- package/dist-library/visual-frame-y5RFhJ0_.js +19 -0
- package/dist-library/visual-helpers-UU6xiL8g.js +75 -0
- package/dist-library/visuals-7xzoL9ql.js +49340 -0
- package/dist-library/visuals-CdHezgh5.js +3 -0
- package/dist-library/worker-3ldRjOEG.js +1632 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +127 -366
- package/docs/README-ch.md +104 -101
- package/docs/README.md +104 -101
- package/docs/compatibility/api-stability-ch.md +1 -1
- package/docs/compatibility/api-stability-en.md +1 -1
- package/docs/compatibility/compatibility-ch.md +146 -146
- package/docs/compatibility/compatibility-en.md +146 -146
- package/docs/compatibility/compatibility-manifest.schema.json +3 -2
- package/docs/compatibility/deprecation-ch.md +2 -2
- package/docs/compatibility/deprecation-en.md +2 -2
- package/docs/compatibility/source-versioning-ch.md +170 -162
- package/docs/compatibility/source-versioning-en.md +171 -162
- package/docs/compatibility/support-matrix-ch.md +4 -3
- package/docs/compatibility/support-matrix-en.md +4 -3
- package/docs/development/component-development-ch.md +66 -66
- package/docs/development/component-development-en.md +66 -66
- package/docs/development/component-development-reference-ch.md +269 -253
- package/docs/development/component-development-reference-en.md +254 -238
- package/docs/development/component-protocol-ch.md +768 -748
- package/docs/development/component-protocol-en.md +770 -750
- package/docs/development/extension-tutorial-ch.md +308 -308
- package/docs/development/extension-tutorial-en.md +308 -308
- package/docs/development/performance-overview-ch.md +422 -422
- package/docs/development/performance-overview-en.md +422 -422
- package/docs/guides/local-guide-ch.md +621 -532
- package/docs/guides/local-guide-en.md +621 -532
- package/docs/integration/author-tools-ch.md +66 -64
- package/docs/integration/author-tools-en.md +66 -64
- package/docs/integration/compiler-ch.md +90 -49
- package/docs/integration/compiler-en.md +77 -36
- package/docs/integration/directory-discovery-en.md +1 -1
- package/docs/integration/editor-ch.md +295 -295
- package/docs/integration/editor-en.md +303 -303
- package/docs/integration/extension-sdk-ch.md +424 -394
- package/docs/integration/extension-sdk-en.md +409 -379
- package/docs/integration/local-integration-ch.md +648 -646
- package/docs/integration/local-integration-en.md +664 -662
- package/docs/integration/pdf-export-ch.md +42 -0
- package/docs/integration/pdf-export-en.md +42 -0
- package/docs/integration/shareable-export-ch.md +299 -307
- package/docs/integration/shareable-export-en.md +301 -309
- package/docs/reference/diagnostics-counting-ch.md +127 -104
- package/docs/reference/diagnostics-counting-en.md +127 -104
- package/docs/reference/html-compatibility-ch.md +93 -93
- package/docs/reference/html-compatibility-en.md +95 -95
- package/docs/reference/local-interaction-syntax-ch.md +913 -724
- package/docs/reference/local-interaction-syntax-en.md +911 -722
- package/docs/reference/public-api-ch.md +134 -21
- package/docs/reference/public-api-en.md +134 -21
- package/docs/reference/theme-protocol-ch.md +198 -198
- package/docs/reference/theme-protocol-en.md +217 -217
- package/docs/releases/release-0.10.0-ch.md +45 -0
- package/docs/releases/release-0.10.0-en.md +45 -0
- package/docs/releases/release-0.4.0-ch.md +91 -91
- package/docs/releases/release-0.4.0-en.md +91 -91
- package/docs/releases/release-0.4.1-ch.md +25 -25
- package/docs/releases/release-0.4.1-en.md +25 -25
- package/docs/releases/release-0.5.0-ch.md +43 -43
- package/docs/releases/release-0.5.0-en.md +43 -43
- package/docs/releases/release-0.5.1-ch.md +41 -41
- package/docs/releases/release-0.5.1-en.md +41 -41
- package/docs/releases/release-0.5.2-ch.md +37 -37
- package/docs/releases/release-0.5.2-en.md +37 -37
- package/docs/releases/release-0.5.3-ch.md +26 -26
- package/docs/releases/release-0.5.3-en.md +26 -26
- package/docs/releases/release-0.6.0-ch.md +59 -59
- package/docs/releases/release-0.6.0-en.md +59 -59
- package/docs/releases/release-0.6.1-ch.md +29 -29
- package/docs/releases/release-0.6.1-en.md +29 -29
- package/docs/releases/release-0.7.0-ch.md +86 -86
- package/docs/releases/release-0.7.0-en.md +86 -86
- package/docs/releases/release-0.9.3-ch.md +45 -0
- package/docs/releases/release-0.9.3-en.md +45 -0
- package/examples/component-package/README-ch.md +101 -101
- package/examples/component-package/README.md +133 -133
- package/examples/conformance/README-ch.md +55 -55
- package/examples/conformance/README.md +55 -55
- package/examples/conformance/component-protocol-1.json +482 -482
- package/examples/conformance/component-protocol-1.schema.json +76 -76
- package/examples/conformance/local-draft-1.json +50 -50
- package/examples/conformance/local-draft-2.json +212 -212
- package/examples/conformance/local-draft-4.json +441 -0
- package/examples/game-2048-package/LICENSE +21 -21
- package/examples/game-2048-package/NOTICES.md +11 -11
- package/examples/game-2048-package/README-ch.md +91 -91
- package/examples/game-2048-package/README.md +98 -98
- package/examples/game-2048-package/package.json +35 -35
- package/examples/game-2048-package/sample/document.reactive.md +17 -17
- package/examples/game-2048-package/scripts/build-export.mjs +44 -44
- package/examples/game-2048-package/scripts/build.mjs +130 -130
- package/examples/game-2048-package/scripts/verify.mjs +180 -180
- package/examples/game-2048-package/src/component.css +161 -161
- package/examples/game-2048-package/src/components.tsx +326 -326
- package/examples/game-2048-package/src/game-engine.ts +228 -228
- package/examples/game-2048-package/src/harness.tsx +34 -34
- package/examples/game-2048-package/src/manifest.ts +85 -85
- package/examples/game-2048-package/src/node-entry.ts +30 -30
- package/examples/game-2048-package/src/sample.ts +4 -4
- package/examples/game-2048-package/tsconfig.json +15 -15
- package/examples/integration/README-ch.md +114 -82
- package/examples/integration/README.md +114 -82
- package/examples/integration/chat-session/index.mjs +91 -0
- package/examples/integration/chat-session/package.json +10 -0
- package/examples/integration/core/index.mjs +32 -32
- package/examples/integration/extension-sdk/README-ch.md +24 -24
- package/examples/integration/extension-sdk/README.md +24 -24
- package/examples/integration/static-embed/embed.mjs +44 -0
- package/examples/integration/static-embed/index.html +12 -0
- package/examples/integration/static-embed/main.mjs +24 -0
- package/examples/integration/static-embed/references.mjs +5 -0
- package/examples/integration/static-embed/render.mjs +10 -0
- package/examples/integration/worker/index.html +19 -19
- package/examples/integration/worker/main.js +61 -61
- package/examples/integration/worker/package.json +13 -13
- package/examples/integration/worker/worker.js +3 -3
- package/examples/local/README-ch.md +76 -76
- package/examples/local/README.md +76 -76
- package/examples/local/charts.reactive.md +73 -73
- package/examples/local/recipes/invoice-zh.reactive.md +36 -36
- package/examples/local/recipes/invoice.reactive.md +36 -36
- package/examples/local/recipes/workshop-zh.reactive.md +33 -33
- package/examples/local/recipes/workshop.reactive.md +33 -33
- package/examples/local/showcase/README-ch.md +22 -22
- package/examples/local/showcase/README.md +31 -31
- package/examples/local/showcase/explore.reactive.md +102 -102
- package/examples/local/showcase/flow.reactive.md +86 -86
- package/examples/local/showcase/forms.reactive.md +126 -126
- package/examples/local/showcase/functions.reactive.md +119 -119
- package/examples/local/showcase/layout.reactive.md +100 -100
- package/examples/local/showcase/statistics.reactive.md +108 -108
- package/examples/local/showcase/tasks.reactive.md +89 -89
- package/examples/local/showcase/zh/explore.reactive.md +102 -102
- package/examples/local/showcase/zh/flow.reactive.md +86 -86
- package/examples/local/showcase/zh/forms.reactive.md +126 -126
- package/examples/local/showcase/zh/functions.reactive.md +119 -119
- package/examples/local/showcase/zh/layout.reactive.md +100 -100
- package/examples/local/showcase/zh/statistics.reactive.md +108 -108
- package/examples/local/showcase/zh/tasks.reactive.md +89 -89
- package/examples/minimal-extension/README-ch.md +78 -78
- package/examples/minimal-extension/README.md +78 -78
- package/examples/minimal-extension/index.html +15 -15
- package/examples/minimal-extension/package.json +26 -26
- package/examples/minimal-extension/sample/document.reactive.md +10 -10
- package/examples/minimal-extension/scripts/build.mjs +32 -32
- package/examples/minimal-extension/scripts/export.mjs +72 -72
- package/examples/minimal-extension/scripts/test-node.mjs +75 -75
- package/examples/minimal-extension/src/extension.tsx +90 -90
- package/examples/minimal-extension/src/preview.tsx +12 -12
- package/examples/minimal-extension/src/source.ts +4 -4
- package/examples/minimal-extension/tsconfig.json +14 -14
- package/examples/sci-fi-theme/README-ch.md +133 -133
- package/examples/sci-fi-theme/README.md +148 -148
- package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
- package/examples/sci-fi-theme/demo/demo.css +638 -638
- package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
- package/examples/sci-fi-theme/demo/index.html +13 -13
- package/examples/sci-fi-theme/demo/main.tsx +215 -215
- package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
- package/examples/sci-fi-theme/docs/design-system.md +474 -474
- package/examples/sci-fi-theme/package.json +28 -28
- package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
- package/examples/sci-fi-theme/src/components.css +2370 -2370
- package/examples/sci-fi-theme/src/index.ts +6 -6
- package/examples/sci-fi-theme/src/notch.css +142 -142
- package/examples/sci-fi-theme/src/sci-fi.css +7 -7
- package/examples/sci-fi-theme/src/theme.ts +39 -39
- package/examples/sci-fi-theme/tsconfig.json +20 -20
- package/examples/sci-fi-theme/vite.config.ts +24 -24
- package/examples/tetris-package/LICENSE +21 -21
- package/examples/tetris-package/NOTICES.md +11 -11
- package/examples/tetris-package/README-ch.md +91 -91
- package/examples/tetris-package/README.md +95 -95
- package/examples/tetris-package/package.json +35 -35
- package/examples/tetris-package/sample/document.reactive.md +16 -16
- package/examples/tetris-package/scripts/build-export.mjs +44 -44
- package/examples/tetris-package/scripts/build.mjs +130 -130
- package/examples/tetris-package/scripts/verify.mjs +173 -173
- package/examples/tetris-package/src/component.css +145 -145
- package/examples/tetris-package/src/components.tsx +334 -334
- package/examples/tetris-package/src/harness.tsx +34 -34
- package/examples/tetris-package/src/manifests.ts +93 -93
- package/examples/tetris-package/src/node-entry.ts +16 -16
- package/examples/tetris-package/src/sample.ts +4 -4
- package/examples/tetris-package/src/tetris-engine.ts +325 -325
- package/examples/tetris-package/tsconfig.json +15 -15
- package/package.json +66 -2
- package/dist-library/LocalDocumentView-BuqgJZEY.js +0 -109
- package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +0 -275
- package/dist-library/authoring-Ci_KzJ0q.js +0 -892
- package/dist-library/compile-Dx6Uw3D9.js +0 -1249
- package/dist-library/compiler-dxLPB9Ym.js +0 -86
- package/dist-library/config-validation-D3D7Dy2J.js +0 -586
- package/dist-library/controls-DoZyLCrV.js +0 -6740
- package/dist-library/data-table-8-3F15Jf.js +0 -296
- package/dist-library/layout-BBB2VF0S.js +0 -562
- package/dist-library/mount-preset-DMZ5wd3t.js +0 -13
- package/dist-library/options-BBp9IcHm.js +0 -121
- package/dist-library/package-core-K5xesGqy.js +0 -117
- package/dist-library/parser-standard-CBA1-hdG.js +0 -9630
- package/dist-library/plugin-packs-Bh1HhLym.js +0 -19
- package/dist-library/preset-core-DeZPA8IE.js +0 -1298
- package/dist-library/props-sJ8vk0cr.js +0 -183
- package/dist-library/react-0DCh-Mar.js +0 -7
- package/dist-library/registry-core-C9xOunaw.js +0 -479
- package/dist-library/resources-B0x_w3s9.js +0 -229
- package/dist-library/runtime-BpQdZmFI.js +0 -1288
- package/dist-library/schema-BryM_VRW.js +0 -40
- package/dist-library/sdk-core-ChslheKs.js +0 -1167
- package/dist-library/shareable-B8xMoGEa.js +0 -814
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +0 -6
- package/dist-library/types/local/rendering/table/data-table.d.ts +0 -13
- package/dist-library/types-daDo2c_w.js +0 -3
- package/dist-library/validation-B3RI0xOk.js +0 -1123
- package/dist-library/visual-frame-_rcd5HUv.js +0 -48
- package/dist-library/visuals-DkDhNdEZ.js +0 -72572
- /package/dist-library/types/{local/configuration → contracts}/color-values.d.ts +0 -0
- /package/dist-library/types/{local/html → contracts}/html-names.d.ts +0 -0
- /package/dist-library/types/{local/configuration → contracts}/schema-core.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/code/code-block.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/code/code-languages.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/document/LocalDocumentView.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/document/use-color-scheme.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/image/image-view.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/math-view.d.ts +0 -0
|
@@ -0,0 +1,1295 @@
|
|
|
1
|
+
import { u as e } from "./document-theme-CJvN-nC1.js";
|
|
2
|
+
import { a as t, d as n, i as r } from "./choice-values-BItGjPD2.js";
|
|
3
|
+
import { O as i } from "./preset-core-BKPbH_Nv.js";
|
|
4
|
+
import { i as a } from "./props-0iDqxlTk.js";
|
|
5
|
+
import { n as o } from "./conditional-branches-CIhJXasR.js";
|
|
6
|
+
import { s } from "./default-config-CCa8rm2k.js";
|
|
7
|
+
import { r as c, t as l } from "./observability-core-Bcu7vpnl.js";
|
|
8
|
+
import { S as u } from "./component-state-CwKX_SN5.js";
|
|
9
|
+
import { i as d, n as f, o as p, s as m } from "./identity-BUx0Q_-d.js";
|
|
10
|
+
import { t as h } from "./runtime-BDnnimPA.js";
|
|
11
|
+
import { r as g } from "./requirements-C56sFIEs.js";
|
|
12
|
+
import _, { Component as v, createElement as y, useCallback as b, useEffect as x, useLayoutEffect as ee, useRef as S, useSyncExternalStore as te } from "react";
|
|
13
|
+
import { Fragment as ne, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
14
|
+
// src/react/component-api.tsx
|
|
15
|
+
var re = Symbol("reactive-md.content-node");
|
|
16
|
+
function T(e) {
|
|
17
|
+
return e[re];
|
|
18
|
+
}
|
|
19
|
+
function E(e, t) {
|
|
20
|
+
return Object.defineProperty(e, re, {
|
|
21
|
+
value: t,
|
|
22
|
+
enumerable: !1,
|
|
23
|
+
configurable: !1,
|
|
24
|
+
writable: !1
|
|
25
|
+
}), Object.freeze(e);
|
|
26
|
+
}
|
|
27
|
+
var ie = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
28
|
+
function ae(e) {
|
|
29
|
+
return e === null ? "" : typeof e == "string" ? e : typeof e == "number" ? Number.isFinite(e) ? String(e) : null : typeof e == "boolean" ? e ? "true" : "false" : null;
|
|
30
|
+
}
|
|
31
|
+
function D(e) {
|
|
32
|
+
if (!Number.isFinite(e)) return "—";
|
|
33
|
+
if (Object.is(e, -0)) return "0";
|
|
34
|
+
let t = Math.abs(e);
|
|
35
|
+
return t >= 0xe8d4a51000 || t > 0 && t < 1e-4 ? e.toExponential(3).replace(/(\.\d*?)0+e/, "$1e").replace(/\.e/, "e") : Number(e.toFixed(6)).toString();
|
|
36
|
+
}
|
|
37
|
+
function O(e) {
|
|
38
|
+
return Array.isArray(e) ? Object.freeze(e.slice()) : e === void 0 ? null : e;
|
|
39
|
+
}
|
|
40
|
+
function oe(e) {
|
|
41
|
+
return Array.isArray(e) ? e.slice() : e;
|
|
42
|
+
}
|
|
43
|
+
function se(e, t, n, r, i) {
|
|
44
|
+
try {
|
|
45
|
+
return {
|
|
46
|
+
ok: !0,
|
|
47
|
+
value: a(e, t, n, r, i)
|
|
48
|
+
};
|
|
49
|
+
} catch (e) {
|
|
50
|
+
return {
|
|
51
|
+
ok: !1,
|
|
52
|
+
error: e
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
var k = Object.freeze({
|
|
57
|
+
ok: !0,
|
|
58
|
+
value: null
|
|
59
|
+
}), ce = Object.freeze({
|
|
60
|
+
ok: !0,
|
|
61
|
+
value: !0
|
|
62
|
+
}), le = Object.freeze({
|
|
63
|
+
ok: !0,
|
|
64
|
+
value: !1
|
|
65
|
+
});
|
|
66
|
+
function A(e, t, n) {
|
|
67
|
+
return e?.type === "component" && e.name === t && n(t)?.id === `reactive-md/${t}`;
|
|
68
|
+
}
|
|
69
|
+
function ue(e, t, n) {
|
|
70
|
+
let r = se(t, "when", e.attrs?.when, n, e.literalAttributes === !0 || e.macroLiteralAttrs?.includes("when") === !0);
|
|
71
|
+
return r.ok ? r.value === !0 ? ce : r.value === !1 ? le : r : r;
|
|
72
|
+
}
|
|
73
|
+
function j(e, t, n) {
|
|
74
|
+
let r = /* @__PURE__ */ new Map(), i = t("if"), a = t("else");
|
|
75
|
+
if (i?.id !== "reactive-md/if" || a?.id !== "reactive-md/else") return r;
|
|
76
|
+
for (let s = 0; s < e.length; s += 1) {
|
|
77
|
+
let c = e[s];
|
|
78
|
+
if (!A(c, "if", t)) continue;
|
|
79
|
+
let l = o(e, s);
|
|
80
|
+
if (!A(e[l], "else", t)) continue;
|
|
81
|
+
let u = [c];
|
|
82
|
+
for (; A(e[l], "else", t);) {
|
|
83
|
+
let t = e[l];
|
|
84
|
+
if (u.push(t), s = l, t.attrs?.when === void 0) break;
|
|
85
|
+
l = o(e, l);
|
|
86
|
+
}
|
|
87
|
+
let d;
|
|
88
|
+
u.forEach((e, t) => r.set(e, () => {
|
|
89
|
+
if (!d) {
|
|
90
|
+
let e = !0;
|
|
91
|
+
d = u.map((t, r) => {
|
|
92
|
+
if (!e) return {
|
|
93
|
+
condition: k,
|
|
94
|
+
selection: !1
|
|
95
|
+
};
|
|
96
|
+
if (r > 0 && t.attrs?.when === void 0) return {
|
|
97
|
+
condition: k,
|
|
98
|
+
selection: !0
|
|
99
|
+
};
|
|
100
|
+
let o = ue(t, r === 0 ? i : a, n), s = o.ok && typeof o.value == "boolean" ? o.value : null;
|
|
101
|
+
return e = s === !1, {
|
|
102
|
+
condition: o,
|
|
103
|
+
selection: s
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return d[t];
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
return r;
|
|
111
|
+
}
|
|
112
|
+
var de = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap();
|
|
113
|
+
function fe(e) {
|
|
114
|
+
M.delete(P(e));
|
|
115
|
+
}
|
|
116
|
+
var N = /* @__PURE__ */ new WeakMap(), pe = 4096, me = 512;
|
|
117
|
+
function P(e) {
|
|
118
|
+
let t = I.get(e);
|
|
119
|
+
return t || (t = Object.freeze({}), I.set(e, t)), t;
|
|
120
|
+
}
|
|
121
|
+
function he(e, t, n) {
|
|
122
|
+
let { environment: r, node: i } = e, a = r.positionOf?.(i.range.start) ?? {
|
|
123
|
+
line: 1,
|
|
124
|
+
column: 1
|
|
125
|
+
}, o = n instanceof Error ? n.message : String(n);
|
|
126
|
+
return {
|
|
127
|
+
code: "local.component.prop",
|
|
128
|
+
message: `Component <${i.name ?? i.id}> prop "${t}" is invalid: ${o}`,
|
|
129
|
+
severity: "error",
|
|
130
|
+
range: {
|
|
131
|
+
start: i.range.start,
|
|
132
|
+
end: i.range.end
|
|
133
|
+
},
|
|
134
|
+
line: a.line,
|
|
135
|
+
column: a.column
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function ge(e, t, n) {
|
|
139
|
+
if (n.length === 0) return;
|
|
140
|
+
if (typeof window > "u") {
|
|
141
|
+
e.report(n);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
let r = N.get(t);
|
|
145
|
+
r || (r = {
|
|
146
|
+
diagnostics: [],
|
|
147
|
+
scheduled: !1,
|
|
148
|
+
report: e.report
|
|
149
|
+
}, N.set(t, r));
|
|
150
|
+
let i = r;
|
|
151
|
+
i.report = e.report;
|
|
152
|
+
for (let e of n) {
|
|
153
|
+
if (i.diagnostics.length >= me) break;
|
|
154
|
+
i.diagnostics.push(e);
|
|
155
|
+
}
|
|
156
|
+
if (i.scheduled) return;
|
|
157
|
+
i.scheduled = !0;
|
|
158
|
+
let a = () => {
|
|
159
|
+
i.scheduled = !1;
|
|
160
|
+
let e = i.diagnostics.splice(0);
|
|
161
|
+
e.length > 0 && i.report(e);
|
|
162
|
+
};
|
|
163
|
+
typeof queueMicrotask == "function" ? queueMicrotask(a) : setTimeout(a, 0);
|
|
164
|
+
}
|
|
165
|
+
function _e(e, n, r, i, a) {
|
|
166
|
+
if (!e) return {};
|
|
167
|
+
let o = n ?? {}, s = {}, c = i?.environment.mode === "static" && typeof window > "u", l = i !== void 0, u = i ? P(r) : null, d = null;
|
|
168
|
+
if (i && u && l) {
|
|
169
|
+
let e = c ? M : de;
|
|
170
|
+
d = e.get(u) ?? null, d ? d.size > pe && d.clear() : (d = /* @__PURE__ */ new Map(), e.set(u, d));
|
|
171
|
+
}
|
|
172
|
+
let f = [];
|
|
173
|
+
for (let n of Object.keys(e.props)) {
|
|
174
|
+
let c = Object.hasOwn(o, n) && typeof o[n] == "string" ? o[n] : void 0;
|
|
175
|
+
if (n === "options" && t(e) && c !== void 0) {
|
|
176
|
+
s[n] = z(e, c, r), i && d && d.delete(`${i.node.id}\u0000${n}`);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
let l = n === "when" ? a : void 0;
|
|
180
|
+
if (typeof l == "function") {
|
|
181
|
+
let e;
|
|
182
|
+
Object.defineProperty(s, n, {
|
|
183
|
+
enumerable: !0,
|
|
184
|
+
get() {
|
|
185
|
+
let t = e ??= l();
|
|
186
|
+
return t.ok ? t.value : null;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
let u = l ?? se(e, n, c, r, i?.node.literalAttributes === !0 || i?.node.macroLiteralAttrs?.includes(n) === !0);
|
|
192
|
+
if (u.ok) s[n] = u.value, i && d && d.delete(`${i.node.id}\u0000${n}`);
|
|
193
|
+
else if (s[n] = null, i) {
|
|
194
|
+
if (d) {
|
|
195
|
+
let e = `${i.node.id}\u0000${n}`, t = `${c ?? ""}\u0000${u.error instanceof Error ? u.error.message : String(u.error)}`;
|
|
196
|
+
if (d.get(e) === t) continue;
|
|
197
|
+
d.set(e, t);
|
|
198
|
+
}
|
|
199
|
+
f.push(he(i, n, u.error));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return i && u && ge(i.environment, u, f), s;
|
|
203
|
+
}
|
|
204
|
+
function ve(e) {
|
|
205
|
+
return e?.bindings ?? {};
|
|
206
|
+
}
|
|
207
|
+
function F(e, t, n, r, i) {
|
|
208
|
+
let a = r.get(e);
|
|
209
|
+
if (a) return a;
|
|
210
|
+
let o = e.type === "component" || e.type === "hostComponent", s = o ? t.definitionFor(e.name ?? "") : void 0, c = Object.freeze(o ? _e(s, e.attrs, t.runtime, {
|
|
211
|
+
environment: t,
|
|
212
|
+
node: e
|
|
213
|
+
}, i ?? (A(e, "else", t.definitionFor) ? k : void 0)) : {}), l = e.children ?? [], u = j(l, t.definitionFor, t.runtime), d = l.map((e) => {
|
|
214
|
+
let i = u.get(e);
|
|
215
|
+
return F(e, t, n, r, i ? () => i().condition : A(e, "if", t.definitionFor) ? () => ue(e, t.definitionFor("if"), t.runtime) : void 0);
|
|
216
|
+
}), f = null;
|
|
217
|
+
if (o) try {
|
|
218
|
+
f = O(t.runtime.get(e));
|
|
219
|
+
} catch {
|
|
220
|
+
f = null;
|
|
221
|
+
}
|
|
222
|
+
else if (e.type === "interpolation") try {
|
|
223
|
+
f = O(t.runtime.evaluate(e.value ?? ""));
|
|
224
|
+
} catch {
|
|
225
|
+
f = null;
|
|
226
|
+
}
|
|
227
|
+
let p = E({
|
|
228
|
+
id: e.id,
|
|
229
|
+
kind: o ? "component" : e.type,
|
|
230
|
+
name: o ? e.name ?? "" : "",
|
|
231
|
+
...o && s ? { form: s.form } : {},
|
|
232
|
+
props: c,
|
|
233
|
+
attrs: Object.freeze({ ...e.attrs ?? {} }),
|
|
234
|
+
value: f,
|
|
235
|
+
text: typeof e.value == "string" ? e.value : "",
|
|
236
|
+
...e.macroMathScope ? { macroMathScope: e.macroMathScope } : {},
|
|
237
|
+
...e.lang === void 0 ? e.type === "math" || e.type === "inlineMath" ? { format: e.type } : {} : { format: e.lang },
|
|
238
|
+
visible: n,
|
|
239
|
+
children: Object.freeze(d),
|
|
240
|
+
range: Object.freeze({
|
|
241
|
+
start: e.range.start,
|
|
242
|
+
end: e.range.end
|
|
243
|
+
})
|
|
244
|
+
}, e);
|
|
245
|
+
return r.set(e, p), p;
|
|
246
|
+
}
|
|
247
|
+
var I = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap();
|
|
248
|
+
function ye(e, t) {
|
|
249
|
+
if (n(t) !== void 0) {
|
|
250
|
+
let n = L.get(e)?.document?.computations?.[t];
|
|
251
|
+
if (n?.kind === "const" && Array.isArray(n.value)) return n.value;
|
|
252
|
+
}
|
|
253
|
+
return e.evaluate(t);
|
|
254
|
+
}
|
|
255
|
+
function be(e, t, n) {
|
|
256
|
+
let r = t === "static", i = P(e), a = T, o = (e) => (e.length > 0 && n(e), e), s = (e, t) => {
|
|
257
|
+
let n = {
|
|
258
|
+
start: e.range.start,
|
|
259
|
+
end: e.range.end
|
|
260
|
+
};
|
|
261
|
+
return [{
|
|
262
|
+
code: "local.extension.write",
|
|
263
|
+
message: `Component <${e.name || e.id}> write failed: ${t instanceof Error ? t.message : String(t)}`,
|
|
264
|
+
severity: "error",
|
|
265
|
+
range: n,
|
|
266
|
+
line: 1,
|
|
267
|
+
column: 1
|
|
268
|
+
}];
|
|
269
|
+
}, c = Object.freeze({
|
|
270
|
+
identity: i,
|
|
271
|
+
get(t, n) {
|
|
272
|
+
return O(e.get(a(t), n === "value" ? void 0 : n));
|
|
273
|
+
},
|
|
274
|
+
set(t, n, i) {
|
|
275
|
+
if (r) return s(t, /* @__PURE__ */ Error("Runtime is read-only in static mode."));
|
|
276
|
+
try {
|
|
277
|
+
return o(e.set(a(t), oe(n), i === "value" ? void 0 : i));
|
|
278
|
+
} catch (e) {
|
|
279
|
+
return s(t, e);
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
setMany(t, n) {
|
|
283
|
+
if (r) return s(t, /* @__PURE__ */ Error("Runtime is read-only in static mode."));
|
|
284
|
+
try {
|
|
285
|
+
let r = {};
|
|
286
|
+
for (let [e, t] of Object.entries(n)) r[e] = oe(t);
|
|
287
|
+
return o(e.setMany(a(t), r));
|
|
288
|
+
} catch (e) {
|
|
289
|
+
return s(t, e);
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
reset(t) {
|
|
293
|
+
if (!r) try {
|
|
294
|
+
e.reset(a(t));
|
|
295
|
+
} catch {}
|
|
296
|
+
},
|
|
297
|
+
resetToken(t) {
|
|
298
|
+
try {
|
|
299
|
+
return e.resetToken(a(t));
|
|
300
|
+
} catch {
|
|
301
|
+
return 0;
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
evaluate(t) {
|
|
305
|
+
return O(e.evaluate(t));
|
|
306
|
+
},
|
|
307
|
+
snapshot() {
|
|
308
|
+
try {
|
|
309
|
+
let t = e.snapshot(), n = {};
|
|
310
|
+
for (let [e, r] of Object.entries(t.state)) n[e] = O(r);
|
|
311
|
+
return {
|
|
312
|
+
revision: t.revision,
|
|
313
|
+
state: Object.freeze(n)
|
|
314
|
+
};
|
|
315
|
+
} catch {
|
|
316
|
+
return {
|
|
317
|
+
revision: 0,
|
|
318
|
+
state: {}
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
readSubmissionFields(t) {
|
|
323
|
+
let n = {
|
|
324
|
+
ok: !1,
|
|
325
|
+
field: t[0] ?? "",
|
|
326
|
+
reason: "unavailable"
|
|
327
|
+
};
|
|
328
|
+
if (r) return n;
|
|
329
|
+
try {
|
|
330
|
+
return e.readSubmissionFields?.(t) ?? n;
|
|
331
|
+
} catch {
|
|
332
|
+
return n;
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
registerSubmissionField(t, n) {
|
|
336
|
+
return r ? () => {} : e.registerSubmissionField?.(a(t), n) ?? (() => {});
|
|
337
|
+
},
|
|
338
|
+
validate() {
|
|
339
|
+
try {
|
|
340
|
+
return e.validate();
|
|
341
|
+
} catch {
|
|
342
|
+
return [];
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
text(t) {
|
|
346
|
+
try {
|
|
347
|
+
return e.text(t);
|
|
348
|
+
} catch {
|
|
349
|
+
return "";
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
return L.set(c, e), c;
|
|
354
|
+
}
|
|
355
|
+
function xe(e, t, n, r) {
|
|
356
|
+
return Object.freeze({
|
|
357
|
+
get: () => {
|
|
358
|
+
try {
|
|
359
|
+
return e.get(t, n);
|
|
360
|
+
} catch {
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
set: (i) => {
|
|
365
|
+
if (r) return {
|
|
366
|
+
ok: !1,
|
|
367
|
+
diagnostics: []
|
|
368
|
+
};
|
|
369
|
+
let a = e.set(t, i, n);
|
|
370
|
+
return {
|
|
371
|
+
ok: a.length === 0,
|
|
372
|
+
diagnostics: a
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
var Se = /^\s*\{\{([\s\S]*)\}\}\s*$/, R = Object.freeze({}), Ce = Object.freeze({});
|
|
378
|
+
function z(e, n, i) {
|
|
379
|
+
if (!t(e) || n === void 0) return null;
|
|
380
|
+
let a = Se.exec(n);
|
|
381
|
+
if (!a) return null;
|
|
382
|
+
let o;
|
|
383
|
+
try {
|
|
384
|
+
o = i.evaluate(a[1]);
|
|
385
|
+
} catch {
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
return r(o);
|
|
389
|
+
}
|
|
390
|
+
function we(e, t, n, r) {
|
|
391
|
+
let i = `${e.id}:option:${r}`, a = `${i}:text`, { start: o, end: s } = e.range, c = {
|
|
392
|
+
id: a,
|
|
393
|
+
type: "text",
|
|
394
|
+
value: n,
|
|
395
|
+
range: {
|
|
396
|
+
start: o,
|
|
397
|
+
end: s
|
|
398
|
+
}
|
|
399
|
+
}, l = E({
|
|
400
|
+
id: a,
|
|
401
|
+
kind: "text",
|
|
402
|
+
name: "",
|
|
403
|
+
props: R,
|
|
404
|
+
attrs: Ce,
|
|
405
|
+
value: null,
|
|
406
|
+
text: n,
|
|
407
|
+
visible: e.visible,
|
|
408
|
+
children: Object.freeze([]),
|
|
409
|
+
range: Object.freeze({
|
|
410
|
+
start: o,
|
|
411
|
+
end: s
|
|
412
|
+
})
|
|
413
|
+
}, c), u = {
|
|
414
|
+
id: i,
|
|
415
|
+
type: "component",
|
|
416
|
+
name: "option",
|
|
417
|
+
attrs: { value: n },
|
|
418
|
+
children: [c],
|
|
419
|
+
range: {
|
|
420
|
+
start: o,
|
|
421
|
+
end: s
|
|
422
|
+
}
|
|
423
|
+
}, d = E({
|
|
424
|
+
id: i,
|
|
425
|
+
kind: "component",
|
|
426
|
+
name: "option",
|
|
427
|
+
props: R,
|
|
428
|
+
attrs: Object.freeze({ value: n }),
|
|
429
|
+
value: null,
|
|
430
|
+
text: "",
|
|
431
|
+
visible: e.visible,
|
|
432
|
+
children: Object.freeze([l]),
|
|
433
|
+
range: Object.freeze({
|
|
434
|
+
start: o,
|
|
435
|
+
end: s
|
|
436
|
+
})
|
|
437
|
+
}, u);
|
|
438
|
+
return Object.freeze({
|
|
439
|
+
value: n,
|
|
440
|
+
content: d,
|
|
441
|
+
label: n,
|
|
442
|
+
render: () => t.renderInline(u.children, e.visible)
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
function Te(e, n) {
|
|
446
|
+
let r = n.definitionFor(e.name);
|
|
447
|
+
if (t(r) && e.attrs.options !== void 0) return (z(r, e.attrs.options, n.runtime) ?? []).map((t, r) => we(e, n, t, r));
|
|
448
|
+
let i = [], a = e.children, o = r?.rules?.find((e) => e.kind === "options-body"), s = o?.kind === "options-body" ? o.child : r?.structure?.child ?? "option", c = o?.kind === "options-body" ? o.valueAttribute : r?.structure?.valueAttribute ?? "value", l = 0;
|
|
449
|
+
for (let t of a) {
|
|
450
|
+
if (t.kind !== "component" || t.name !== s) continue;
|
|
451
|
+
let r = T(t), a = t.attrs[c] ?? `option-${l + 1}`;
|
|
452
|
+
l += 1;
|
|
453
|
+
let o = n.renderToText(r.children) || t.attrs[c] || "";
|
|
454
|
+
i.push(Object.freeze({
|
|
455
|
+
value: a,
|
|
456
|
+
content: t,
|
|
457
|
+
label: o,
|
|
458
|
+
render: () => n.renderInline(r.children, e.visible)
|
|
459
|
+
}));
|
|
460
|
+
}
|
|
461
|
+
return i;
|
|
462
|
+
}
|
|
463
|
+
function B(e, t) {
|
|
464
|
+
let n = e.children ?? [], r = n.filter((e) => !(e.type === "text" && !(e.value ?? "").trim())), i, a = "empty", o = "", s = null, c = null;
|
|
465
|
+
if (r.length === 1 && r[0].type === "interpolation") try {
|
|
466
|
+
i = t.runtime.evaluate(r[0].value ?? "");
|
|
467
|
+
let e = ae(i);
|
|
468
|
+
i === null ? (a = "null", o = "") : typeof i == "string" ? (a = "string", o = i) : typeof i == "number" ? Number.isFinite(i) ? (a = "number", o = D(i), s = i) : (a = "error", o = t.locale === "zh" ? "无法计算" : "Cannot compute", c = t.locale === "zh" ? "结果不是有限数字" : "Result is not a finite number") : typeof i == "boolean" ? (a = "boolean", o = i ? "true" : "false") : (a = "array", o = e ?? "", c = t.locale === "zh" ? "数组需要先用 len 等函数转换" : "Arrays must first be converted with a function such as len");
|
|
469
|
+
} catch (e) {
|
|
470
|
+
a = "error", o = t.locale === "zh" ? "无法计算" : "Cannot compute", c = e instanceof Error ? e.message : String(e);
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
let e = "", l = null, u = (n) => {
|
|
474
|
+
for (let r of n ?? []) if (r.type === "text" || r.type === "inlineCode" || r.type === "code") e += r.value ?? "";
|
|
475
|
+
else if (r.type === "interpolation") try {
|
|
476
|
+
let n = ae(t.runtime.evaluate(r.value ?? ""));
|
|
477
|
+
n === null ? l ??= t.locale === "zh" ? "数组需要先用 len 等函数转换" : "Arrays must first be converted with a function such as len" : e += n;
|
|
478
|
+
} catch (n) {
|
|
479
|
+
l ??= n instanceof Error ? n.message : String(n), e += t.locale === "zh" ? "无法计算" : "Cannot compute";
|
|
480
|
+
}
|
|
481
|
+
else r.type === "inlineMath" || r.type === "math" ? e += r.value ?? "" : r.type === "image" ? e += r.alt ?? "" : r.children && r.children.length > 0 ? u(r.children) : r.value && (e += r.value);
|
|
482
|
+
};
|
|
483
|
+
u(n);
|
|
484
|
+
let d = r.length > 0 && r.every((e) => e.type === "text"), f = e.trim();
|
|
485
|
+
if (d && ie.test(f)) {
|
|
486
|
+
let t = Number(f);
|
|
487
|
+
Number.isFinite(t) && (a = "number", o = e, s = t, i = t);
|
|
488
|
+
}
|
|
489
|
+
a === "empty" && (l ? (a = "error", o = t.locale === "zh" ? "无法计算" : "Cannot compute", c = l) : (a = f === "" ? "empty" : "string", o = e, i = e));
|
|
490
|
+
}
|
|
491
|
+
return Object.freeze({
|
|
492
|
+
text: o,
|
|
493
|
+
value: i,
|
|
494
|
+
kind: a,
|
|
495
|
+
numeric: s,
|
|
496
|
+
error: c,
|
|
497
|
+
render: () => t.renderInline(n, !0)
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
function Ee(e, t) {
|
|
501
|
+
let n = e.children.find((e) => e.kind === "table");
|
|
502
|
+
if (!n) return null;
|
|
503
|
+
let r = (T(n).children ?? []).filter((e) => e.type === "tableRow");
|
|
504
|
+
if (r.length === 0) return null;
|
|
505
|
+
let i = (r[0].children ?? []).map((e) => B(e, t));
|
|
506
|
+
return Object.freeze({
|
|
507
|
+
header: Object.freeze(i),
|
|
508
|
+
headerText: Object.freeze(i.map((e) => e.error ? t.locale === "zh" ? "无法计算" : "Cannot compute" : e.text)),
|
|
509
|
+
rows: Object.freeze(r.slice(1).map((e, n) => Object.freeze({
|
|
510
|
+
index: n,
|
|
511
|
+
cells: Object.freeze((e.children ?? []).map((e) => B(e, t)))
|
|
512
|
+
})))
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
function De(e, t) {
|
|
516
|
+
let n = e["state-key"];
|
|
517
|
+
return p(typeof n == "string" ? n : t["state-key"]);
|
|
518
|
+
}
|
|
519
|
+
function Oe(e) {
|
|
520
|
+
try {
|
|
521
|
+
return e.document.source;
|
|
522
|
+
} catch {
|
|
523
|
+
return "";
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
var V = /* @__PURE__ */ new WeakMap();
|
|
527
|
+
function ke(e) {
|
|
528
|
+
if (e.services !== void 0) return e.services;
|
|
529
|
+
let t = V.get(e);
|
|
530
|
+
return t === void 0 && (t = h({ sourceDigest: d(Oe(e)) }), V.set(e, t)), t;
|
|
531
|
+
}
|
|
532
|
+
function Ae(e, t, n) {
|
|
533
|
+
let r = t.definitionFor(e.name ?? ""), i = /* @__PURE__ */ new Map(), a = F(e, t, t.visible, i, n), o = be(t.runtime, t.mode, t.report), s = t.services ?? ke(t.runtime), c = r?.id ?? e.name ?? e.type, l = De(a.props, a.attrs), d = null, p = () => (d === null && (d = s.state.handle({
|
|
534
|
+
nodeId: e.id,
|
|
535
|
+
component: c,
|
|
536
|
+
componentVersion: r?.version ?? "0.0.0",
|
|
537
|
+
stateKey: l,
|
|
538
|
+
stateVersion: 0
|
|
539
|
+
})), d), h = typeof a.props.seed == "number" && Number.isFinite(a.props.seed) ? a.props.seed : void 0, g = m({
|
|
540
|
+
explicitSeed: h,
|
|
541
|
+
documentSeed: s.randomSeed,
|
|
542
|
+
componentId: c,
|
|
543
|
+
nodeId: e.id,
|
|
544
|
+
stateKey: l
|
|
545
|
+
}), _ = Object.freeze({
|
|
546
|
+
network: t.mode === "static" ? u : t.network ?? t.runtime.network ?? u,
|
|
547
|
+
random: Object.freeze({
|
|
548
|
+
seed: g,
|
|
549
|
+
derive: (e) => f(g, e)
|
|
550
|
+
}),
|
|
551
|
+
clock: s.clock,
|
|
552
|
+
scheduler: s.scheduler,
|
|
553
|
+
get state() {
|
|
554
|
+
return p();
|
|
555
|
+
}
|
|
556
|
+
}), v = t.mode === "static", y = ve(r), b = {};
|
|
557
|
+
for (let e of Object.keys(y)) b[e] = xe(o, a, e, v);
|
|
558
|
+
let x = b.value ?? Object.freeze({
|
|
559
|
+
get: () => null,
|
|
560
|
+
set: () => ({
|
|
561
|
+
ok: !1,
|
|
562
|
+
diagnostics: []
|
|
563
|
+
})
|
|
564
|
+
}), ee = Object.freeze({
|
|
565
|
+
render: () => t.renderChildren(e.children, t.visible),
|
|
566
|
+
inline: () => t.renderInline(e.children, t.visible),
|
|
567
|
+
text: () => t.renderToText(e.children),
|
|
568
|
+
items: () => a.children,
|
|
569
|
+
renderItems: (e, n) => t.renderChildren(e.map((e) => T(e)), n ?? t.visible),
|
|
570
|
+
renderInlineItems: (e, n) => t.renderInline(e.map((e) => T(e)), n ?? t.visible),
|
|
571
|
+
textOf: (e) => t.renderToText(e.map((e) => T(e))),
|
|
572
|
+
options: () => Te(a, t),
|
|
573
|
+
table: () => Ee(a, t),
|
|
574
|
+
math: () => a.children.filter((e) => e.kind === "math" || e.kind === "inlineMath")
|
|
575
|
+
}), S = Object.freeze({
|
|
576
|
+
value: x,
|
|
577
|
+
slots: Object.freeze(b),
|
|
578
|
+
isReadOnly: v,
|
|
579
|
+
get(e = "value") {
|
|
580
|
+
let t = b[e];
|
|
581
|
+
return t ? t.get() : null;
|
|
582
|
+
},
|
|
583
|
+
set(e, t) {
|
|
584
|
+
let n = b[e];
|
|
585
|
+
return n ? n.set(t) : {
|
|
586
|
+
ok: !1,
|
|
587
|
+
diagnostics: [{
|
|
588
|
+
code: "local.extension.binding",
|
|
589
|
+
message: `Component <${a.name || a.id}> has no binding slot "${e}".`,
|
|
590
|
+
severity: "error",
|
|
591
|
+
range: a.range,
|
|
592
|
+
line: 1,
|
|
593
|
+
column: 1
|
|
594
|
+
}]
|
|
595
|
+
};
|
|
596
|
+
},
|
|
597
|
+
setMany(e) {
|
|
598
|
+
if (v) return {
|
|
599
|
+
ok: !1,
|
|
600
|
+
diagnostics: []
|
|
601
|
+
};
|
|
602
|
+
let t = o.setMany(a, e);
|
|
603
|
+
return {
|
|
604
|
+
ok: t.length === 0,
|
|
605
|
+
diagnostics: t
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
}), te = Object.freeze({
|
|
609
|
+
fieldFor: (e) => t.validationFieldFor(T(e)),
|
|
610
|
+
hintFor: (e) => t.validationHintFor(T(e))
|
|
611
|
+
}), ne = Object.freeze({
|
|
612
|
+
targetId: (e) => t.targetId(e),
|
|
613
|
+
anchorId: () => t.anchorId(e),
|
|
614
|
+
allowed: (e) => t.jumpAllowed(e),
|
|
615
|
+
jump: (e) => {
|
|
616
|
+
let n = t.targetId(e);
|
|
617
|
+
return n === void 0 ? "missing" : t.jumpTo(n);
|
|
618
|
+
}
|
|
619
|
+
}), C = Object.freeze({
|
|
620
|
+
resolve(e, n) {
|
|
621
|
+
if (!e) return null;
|
|
622
|
+
let r = e.trim();
|
|
623
|
+
if (!r) return null;
|
|
624
|
+
let i = r.replace(/[\u0000- ]+/g, ""), a = /^([a-z][a-z0-9+.-]*):/i.exec(i);
|
|
625
|
+
if (a) {
|
|
626
|
+
let e = a[1].toLowerCase();
|
|
627
|
+
if (!(n === "image" ? e === "http" || e === "https" : e === "http" || e === "https" || e === "mailto" || e === "tel")) return null;
|
|
628
|
+
}
|
|
629
|
+
if (!t.urlPolicy) return n === "image" ? null : r;
|
|
630
|
+
try {
|
|
631
|
+
return t.urlPolicy(r, n) ? r : null;
|
|
632
|
+
} catch {
|
|
633
|
+
return null;
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
image(e) {
|
|
637
|
+
let n = C.resolve(e, "image");
|
|
638
|
+
if (!n) return null;
|
|
639
|
+
if (!t.imageResolver) return n;
|
|
640
|
+
try {
|
|
641
|
+
let e = t.imageResolver(n);
|
|
642
|
+
return typeof e == "string" && e.trim() !== "" ? e : null;
|
|
643
|
+
} catch {
|
|
644
|
+
return null;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}), w = Object.freeze({
|
|
648
|
+
locale: t.locale,
|
|
649
|
+
t: (e, n) => t.locale === "zh" ? n : e,
|
|
650
|
+
formatNumber: D
|
|
651
|
+
});
|
|
652
|
+
return Object.freeze({
|
|
653
|
+
props: a.props,
|
|
654
|
+
authorStyle: t.authorStyle,
|
|
655
|
+
authorStyleText: t.authorStyleText,
|
|
656
|
+
dispatchAuthorAction: t.dispatchAuthorAction,
|
|
657
|
+
content: a,
|
|
658
|
+
services: _,
|
|
659
|
+
bindings: S,
|
|
660
|
+
children: ee,
|
|
661
|
+
runtime: o,
|
|
662
|
+
instance: Object.freeze({
|
|
663
|
+
id: e.id,
|
|
664
|
+
componentId: r?.id ?? e.name ?? "",
|
|
665
|
+
range: Object.freeze({
|
|
666
|
+
start: e.range.start,
|
|
667
|
+
end: e.range.end
|
|
668
|
+
})
|
|
669
|
+
}),
|
|
670
|
+
mode: t.mode,
|
|
671
|
+
visible: t.visible,
|
|
672
|
+
disabled: t.disabled,
|
|
673
|
+
disabledInvalid: t.disabledInvalid,
|
|
674
|
+
resetToken: t.resetToken,
|
|
675
|
+
validation: te,
|
|
676
|
+
source: Object.freeze({ attributes: (n) => t.sourceAttributes(n ? T(n) : e, e.name) }),
|
|
677
|
+
navigation: ne,
|
|
678
|
+
url: C,
|
|
679
|
+
locale: w,
|
|
680
|
+
report: t.report
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
var je = [
|
|
684
|
+
"interactive",
|
|
685
|
+
"static",
|
|
686
|
+
"ssr",
|
|
687
|
+
"offline"
|
|
688
|
+
];
|
|
689
|
+
function Me(e) {
|
|
690
|
+
let t = e.capabilities;
|
|
691
|
+
if (t === void 0) return;
|
|
692
|
+
if (typeof t != "object" || !t || Array.isArray(t)) throw TypeError("Component capabilities must be an object.");
|
|
693
|
+
let n = {};
|
|
694
|
+
for (let e of je) {
|
|
695
|
+
let r = t[e];
|
|
696
|
+
if (r !== void 0) {
|
|
697
|
+
if (typeof r != "boolean") throw TypeError(`Component capability "${e}" must be a boolean.`);
|
|
698
|
+
n[e] = r;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
return n;
|
|
702
|
+
}
|
|
703
|
+
function Ne(e, t, n) {
|
|
704
|
+
if (t) {
|
|
705
|
+
if (typeof n.render != "function") throw TypeError("defineReactComponent requires a render function.");
|
|
706
|
+
if (n.renderStatic !== void 0 && typeof n.renderStatic != "function") throw TypeError("defineReactComponent renderStatic must be a function.");
|
|
707
|
+
if (t.static === !1 && t.ssr === !0) throw TypeError(`Component "${e.id ?? ""}" declares SSR without static rendering.`);
|
|
708
|
+
if (t.static === !1 && t.offline === !0) throw TypeError(`Component "${e.id ?? ""}" declares offline output without a static implementation.`);
|
|
709
|
+
if (t.interactive === !1 && t.offline === !0 && t.static !== !0) throw TypeError(`Component "${e.id ?? ""}" declares offline output without any renderable implementation.`);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
function Pe(e) {
|
|
713
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("defineReactComponent requires a component definition object.");
|
|
714
|
+
return e;
|
|
715
|
+
}
|
|
716
|
+
function H(e, t) {
|
|
717
|
+
let n = Pe(e);
|
|
718
|
+
if (!t || typeof t != "object") throw TypeError("defineReactComponent requires an implementation object.");
|
|
719
|
+
Ne(n, Me(n), t);
|
|
720
|
+
let r;
|
|
721
|
+
try {
|
|
722
|
+
r = i(n);
|
|
723
|
+
} catch (e) {
|
|
724
|
+
throw TypeError(`Cannot bind a React implementation to component "${n.id}": ${e instanceof Error ? e.message : String(e)}`);
|
|
725
|
+
}
|
|
726
|
+
return Object.freeze({
|
|
727
|
+
definition: n,
|
|
728
|
+
digest: r,
|
|
729
|
+
render: t.render,
|
|
730
|
+
...t.renderStatic === void 0 ? {} : { renderStatic: t.renderStatic }
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
// src/react/component-loader.ts
|
|
734
|
+
var U = Object.freeze({ status: "loading" }), W = Object.freeze({ status: "failed" }), G = () => globalThis.performance?.now() ?? Date.now(), Fe = (e) => Math.max(0, Math.round(G() - e));
|
|
735
|
+
function Ie(e, t) {
|
|
736
|
+
return JSON.stringify([
|
|
737
|
+
e.traceId ?? t,
|
|
738
|
+
e.documentId,
|
|
739
|
+
e.sourceRevision,
|
|
740
|
+
e.sourcePhase
|
|
741
|
+
]);
|
|
742
|
+
}
|
|
743
|
+
var Le = class {
|
|
744
|
+
resolver;
|
|
745
|
+
identityFor;
|
|
746
|
+
validate;
|
|
747
|
+
entries = /* @__PURE__ */ new Map();
|
|
748
|
+
identities = /* @__PURE__ */ new WeakMap();
|
|
749
|
+
constructor(e, t, n) {
|
|
750
|
+
this.resolver = e, this.identityFor = t, this.validate = n;
|
|
751
|
+
}
|
|
752
|
+
identity(e) {
|
|
753
|
+
let t = this.identities.get(e);
|
|
754
|
+
return t || (t = this.identityFor(e), this.identities.set(e, t)), t;
|
|
755
|
+
}
|
|
756
|
+
snapshot(e) {
|
|
757
|
+
return this.entries.get(this.identity(e))?.state ?? U;
|
|
758
|
+
}
|
|
759
|
+
serverSnapshot() {
|
|
760
|
+
return U;
|
|
761
|
+
}
|
|
762
|
+
subscribe(e, t, n) {
|
|
763
|
+
let r = this.identity(e), i = n?.observer?.onTrace ? n : void 0, a = this.entries.get(r);
|
|
764
|
+
a ? (a.subscribers.set(t, i), a.abort && i && this.observeWait(e, a, t, i), a.observation && (a.observation.peakSubscribers = Math.max(a.observation.peakSubscribers, a.subscribers.size))) : (a = {
|
|
765
|
+
state: U,
|
|
766
|
+
subscribers: /* @__PURE__ */ new Map([[t, i]])
|
|
767
|
+
}, this.entries.set(r, a), this.start(r, e, a));
|
|
768
|
+
let o = a;
|
|
769
|
+
return () => {
|
|
770
|
+
let e = o.observation, n = i?.observer;
|
|
771
|
+
if (e && n) {
|
|
772
|
+
let r = e.waits.get(n), a = Ie(i, e.id), s = r?.get(a);
|
|
773
|
+
r && s?.subscribers.delete(t) && !s.subscribers.size && queueMicrotask(() => {
|
|
774
|
+
o.observation !== e || s.subscribers.size || r.get(a) !== s || (r.delete(a), r.size || e.waits.delete(n), s.finish("cancelled"));
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
o.subscribers.delete(t), !(o.subscribers.size || o.state.status === "ready") && queueMicrotask(() => {
|
|
778
|
+
o.subscribers.size || o.state.status === "ready" || this.entries.get(r) !== o || (this.entries.delete(r), o.abort?.abort(), o.abort = void 0, this.finishObservation(o, "cancelled"));
|
|
779
|
+
});
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
retry(e, t) {
|
|
783
|
+
let n = this.identity(e), r = this.entries.get(n);
|
|
784
|
+
if (r?.state.status === "failed") {
|
|
785
|
+
this.start(n, e, r, t);
|
|
786
|
+
for (let e of r.subscribers.keys()) e();
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
observeWait(e, t, n, r) {
|
|
790
|
+
let i = r.observer, a = t.observation ??= {
|
|
791
|
+
id: l(),
|
|
792
|
+
peakSubscribers: t.subscribers.size,
|
|
793
|
+
waits: /* @__PURE__ */ new Map()
|
|
794
|
+
}, o = a.waits.get(i);
|
|
795
|
+
o || (o = /* @__PURE__ */ new Map(), a.waits.set(i, o));
|
|
796
|
+
let s = Ie(r, a.id), u = o.get(s);
|
|
797
|
+
if (!u) {
|
|
798
|
+
let { traceId: t = a.id, documentId: n, sourceRevision: l, sourcePhase: d } = r, f = G();
|
|
799
|
+
u = {
|
|
800
|
+
subscribers: /* @__PURE__ */ new Set(),
|
|
801
|
+
finish: (r) => c(i, {
|
|
802
|
+
type: "component-load-wait-end",
|
|
803
|
+
traceId: t,
|
|
804
|
+
documentId: n,
|
|
805
|
+
sourceRevision: l,
|
|
806
|
+
sourcePhase: d,
|
|
807
|
+
loadId: a.id,
|
|
808
|
+
timestamp: Date.now(),
|
|
809
|
+
status: r,
|
|
810
|
+
componentName: e.name,
|
|
811
|
+
componentVersion: e.version,
|
|
812
|
+
durationMs: Fe(f)
|
|
813
|
+
})
|
|
814
|
+
}, o.set(s, u);
|
|
815
|
+
}
|
|
816
|
+
u.subscribers.add(n);
|
|
817
|
+
}
|
|
818
|
+
finishObservation(e, t) {
|
|
819
|
+
let n = e.observation;
|
|
820
|
+
if (e.observation = void 0, n?.finishRequest?.(t), n) for (let e of n.waits.values()) for (let n of e.values()) n.finish(n.subscribers.size ? t : "cancelled");
|
|
821
|
+
}
|
|
822
|
+
start(e, t, n, r) {
|
|
823
|
+
let i = new AbortController();
|
|
824
|
+
n.abort = i, n.state = U;
|
|
825
|
+
for (let [e, r] of n.subscribers) r && this.observeWait(t, n, e, r);
|
|
826
|
+
let a = (t) => {
|
|
827
|
+
if (this.entries.get(e) === n && n.abort === i) {
|
|
828
|
+
n.abort = void 0, n.state = t, this.finishObservation(n, t.status === "ready" ? "ok" : "failed");
|
|
829
|
+
for (let e of n.subscribers.keys()) e();
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
Promise.resolve().then(() => {
|
|
833
|
+
if (i.signal.aborted || !n.subscribers.size) return null;
|
|
834
|
+
let e = n.observation;
|
|
835
|
+
if (e) {
|
|
836
|
+
let i = r?.observer?.onTrace ? r : void 0;
|
|
837
|
+
if (!i) {
|
|
838
|
+
for (let e of n.subscribers.values()) if (e?.observer?.onTrace) {
|
|
839
|
+
i = e;
|
|
840
|
+
break;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
if (i?.observer) {
|
|
844
|
+
let { observer: n, traceId: r = e.id, documentId: a, sourceRevision: o, sourcePhase: s } = i, l = {
|
|
845
|
+
traceId: r,
|
|
846
|
+
documentId: a,
|
|
847
|
+
sourceRevision: o,
|
|
848
|
+
sourcePhase: s,
|
|
849
|
+
loadId: e.id,
|
|
850
|
+
componentName: t.name,
|
|
851
|
+
componentVersion: t.version
|
|
852
|
+
}, u = G();
|
|
853
|
+
e.finishRequest = (t) => c(n, {
|
|
854
|
+
...l,
|
|
855
|
+
type: "component-load-end",
|
|
856
|
+
timestamp: Date.now(),
|
|
857
|
+
status: t,
|
|
858
|
+
subscribers: e.peakSubscribers,
|
|
859
|
+
durationMs: Fe(u)
|
|
860
|
+
}), c(n, {
|
|
861
|
+
...l,
|
|
862
|
+
type: "component-load-start",
|
|
863
|
+
timestamp: Date.now()
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return this.resolver({
|
|
868
|
+
name: t.name,
|
|
869
|
+
definition: t,
|
|
870
|
+
signal: i.signal
|
|
871
|
+
});
|
|
872
|
+
}).then((e) => {
|
|
873
|
+
if (!e || i.signal.aborted) {
|
|
874
|
+
a(W);
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
let n = this.validate(t, e);
|
|
878
|
+
a(n === null ? W : {
|
|
879
|
+
status: "ready",
|
|
880
|
+
component: n
|
|
881
|
+
});
|
|
882
|
+
}).catch(() => a(W));
|
|
883
|
+
}
|
|
884
|
+
}, Re = class extends Le {
|
|
885
|
+
resolveSync;
|
|
886
|
+
synchronous = /* @__PURE__ */ new WeakMap();
|
|
887
|
+
constructor(e, t) {
|
|
888
|
+
super(e, (e) => `${e.id}\0${e.version}\0${i(e)}`, ze), this.resolveSync = t;
|
|
889
|
+
}
|
|
890
|
+
synchronousImplementation(e) {
|
|
891
|
+
if (!this.resolveSync) return null;
|
|
892
|
+
let t = this.synchronous.get(e);
|
|
893
|
+
if (t !== void 0) return t;
|
|
894
|
+
let n = null;
|
|
895
|
+
try {
|
|
896
|
+
let t = this.resolveSync({
|
|
897
|
+
name: e.name,
|
|
898
|
+
definition: e
|
|
899
|
+
});
|
|
900
|
+
t && (n = ze(e, t));
|
|
901
|
+
} catch {}
|
|
902
|
+
return this.synchronous.set(e, n), n;
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
function ze(e, t) {
|
|
906
|
+
let n = i(e);
|
|
907
|
+
return t.digest === n && i(t.definition) === n ? H(e, t) : null;
|
|
908
|
+
}
|
|
909
|
+
// src/react/render-lifecycle.tsx
|
|
910
|
+
var K = () => globalThis.performance?.now() ?? Date.now(), q = (e, t) => Math.max(0, Math.round(t - e));
|
|
911
|
+
function Be({ trace: e, component: t }) {
|
|
912
|
+
let n = S(e);
|
|
913
|
+
n.current = e;
|
|
914
|
+
let r = e.observer?.onTrace ? K() : void 0, i = S(e.sourcePhase), a = S(void 0), o = S(void 0);
|
|
915
|
+
return ee(() => {
|
|
916
|
+
if (e.observer?.onTrace) return () => {
|
|
917
|
+
o.current = K();
|
|
918
|
+
};
|
|
919
|
+
}, [e.observer, t]), x(() => {
|
|
920
|
+
let e = n.current;
|
|
921
|
+
if (!e.observer?.onTrace || r === void 0) return;
|
|
922
|
+
let i = e.traceId ?? l();
|
|
923
|
+
a.current = i;
|
|
924
|
+
let s = typeof _.captureOwnerStack == "function" ? "development" : "production", u = K(), d = {
|
|
925
|
+
traceId: i,
|
|
926
|
+
environment: s,
|
|
927
|
+
componentName: t?.name,
|
|
928
|
+
componentVersion: t?.version
|
|
929
|
+
};
|
|
930
|
+
return c(e.observer, {
|
|
931
|
+
...d,
|
|
932
|
+
type: "render-mount",
|
|
933
|
+
timestamp: Date.now(),
|
|
934
|
+
documentId: e.documentId,
|
|
935
|
+
sourceRevision: e.sourceRevision,
|
|
936
|
+
sourcePhase: e.sourcePhase,
|
|
937
|
+
durationMs: q(r, u)
|
|
938
|
+
}), () => {
|
|
939
|
+
let t = n.current, r = K(), a = q(u, r), s = o.current === void 0 ? void 0 : q(o.current, r);
|
|
940
|
+
o.current = void 0, c(e.observer, {
|
|
941
|
+
...d,
|
|
942
|
+
traceId: t.traceId ?? i,
|
|
943
|
+
type: "render-unmount",
|
|
944
|
+
timestamp: Date.now(),
|
|
945
|
+
mountedMs: a,
|
|
946
|
+
durationMs: a,
|
|
947
|
+
unmountMs: s,
|
|
948
|
+
documentId: t.documentId,
|
|
949
|
+
sourceRevision: t.sourceRevision,
|
|
950
|
+
sourcePhase: t.sourcePhase
|
|
951
|
+
});
|
|
952
|
+
};
|
|
953
|
+
}, [e.observer, t]), x(() => {
|
|
954
|
+
let n = i.current;
|
|
955
|
+
i.current = e.sourcePhase, n === "streaming" && e.sourcePhase === "final" && e.observer?.onTrace && c(e.observer, {
|
|
956
|
+
type: "render-retained",
|
|
957
|
+
traceId: e.traceId ?? a.current ?? l(),
|
|
958
|
+
timestamp: Date.now(),
|
|
959
|
+
environment: typeof _.captureOwnerStack == "function" ? "development" : "production",
|
|
960
|
+
documentId: e.documentId,
|
|
961
|
+
sourceRevision: e.sourceRevision,
|
|
962
|
+
sourcePhase: e.sourcePhase,
|
|
963
|
+
componentName: t?.name,
|
|
964
|
+
componentVersion: t?.version
|
|
965
|
+
});
|
|
966
|
+
}, [e, t]), null;
|
|
967
|
+
}
|
|
968
|
+
// src/react/sdk-core.tsx
|
|
969
|
+
function Ve(e) {
|
|
970
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("defineReactComponent requires a component definition object.");
|
|
971
|
+
return e;
|
|
972
|
+
}
|
|
973
|
+
var J = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap();
|
|
974
|
+
function He(e) {
|
|
975
|
+
let t = J.get(e);
|
|
976
|
+
if (t) return t;
|
|
977
|
+
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
978
|
+
for (let t of e.components) n.set(t.definition.name, t), r.set(t.definition.id, t);
|
|
979
|
+
let i = Object.freeze({
|
|
980
|
+
byName: n,
|
|
981
|
+
byId: r
|
|
982
|
+
});
|
|
983
|
+
return J.set(e, i), i;
|
|
984
|
+
}
|
|
985
|
+
function Ue(e) {
|
|
986
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("createReactConfig components must be LocalReactComponent values.");
|
|
987
|
+
let t = e;
|
|
988
|
+
if (!t.definition || typeof t.definition != "object") throw TypeError("A React component is missing its manifest definition.");
|
|
989
|
+
if (typeof t.render != "function") throw TypeError("A React component is missing its render implementation.");
|
|
990
|
+
if (t.renderStatic !== void 0 && typeof t.renderStatic != "function") throw TypeError("A React component renderStatic must be a function.");
|
|
991
|
+
return t;
|
|
992
|
+
}
|
|
993
|
+
function We(e, t, n, r) {
|
|
994
|
+
let a = s(e), o = t?.components;
|
|
995
|
+
if (!Array.isArray(o)) throw TypeError("createReactConfig requires a components array.");
|
|
996
|
+
let c = t?.presets ?? [];
|
|
997
|
+
if (!Array.isArray(c)) throw TypeError("createReactConfig presets must be an array.");
|
|
998
|
+
let l = [], u = [], d = /* @__PURE__ */ new Set(), f = (e, t) => {
|
|
999
|
+
let n = Ue(e), r = Ve(n.definition), a = i(r);
|
|
1000
|
+
if (n.digest !== a) throw TypeError(`React component "${r.id}" from ${t} has a stale digest; create it with defineReactComponent.`);
|
|
1001
|
+
return l.push(n), n;
|
|
1002
|
+
};
|
|
1003
|
+
for (let e of n) {
|
|
1004
|
+
let t = f(e, "the default React preset");
|
|
1005
|
+
d.add(t);
|
|
1006
|
+
}
|
|
1007
|
+
for (let e of c) {
|
|
1008
|
+
if (!e || typeof e != "object" || !Array.isArray(e.components)) throw TypeError("createReactConfig preset must expose a components array.");
|
|
1009
|
+
for (let t of e.components) u.push(f(t, `preset "${e.id ?? ""}"`));
|
|
1010
|
+
}
|
|
1011
|
+
for (let e of o) u.push(f(e, "components"));
|
|
1012
|
+
let p = [], m = [], h = /* @__PURE__ */ new Map();
|
|
1013
|
+
for (let e of a.registry) {
|
|
1014
|
+
let t = i(e), n = l.filter((n) => n.definition.id === e.id && n.definition.name === e.name && n.definition.version === e.version && n.digest === t);
|
|
1015
|
+
if (n.length === 0) {
|
|
1016
|
+
if (l.some((t) => t.definition.id === e.id)) throw TypeError(`React component "${e.id}@${e.version}" does not match the installed manifest contract.`);
|
|
1017
|
+
r ? h.set(e.name, e) : m.push(`${e.id}@${e.version}`);
|
|
1018
|
+
continue;
|
|
1019
|
+
}
|
|
1020
|
+
let a = e.id === "reactive-md/column" && n.every((e) => e.render === n[0].render && e.renderStatic === n[0].renderStatic);
|
|
1021
|
+
if (n.length > 1 && !a) throw TypeError(`Component id "${e.id}" has more than one matching React implementation.`);
|
|
1022
|
+
p.push(n[0]);
|
|
1023
|
+
}
|
|
1024
|
+
if (m.length > 0) {
|
|
1025
|
+
let e = new Set(a.registry.map((e) => e.id)), t = [...new Set(u.filter((t) => !e.has(t.definition.id)).map((e) => `${e.definition.id}@${e.definition.version}`))];
|
|
1026
|
+
throw TypeError(`createReactConfig is missing implementations for: ${m.join(", ")}.` + (t.length === 0 ? "" : ` Supplied implementation(s) ${t.join(", ")} are not declared by this local config.`));
|
|
1027
|
+
}
|
|
1028
|
+
let g = new Map(p.map((e) => [e.definition.id, e])), _ = new Map(p.map((e) => [e.definition.name, e])), v = p.filter((e) => !d.has(e)), y = Object.freeze(a.themes.slice()), b = Object.freeze({
|
|
1029
|
+
byName: new Map(_),
|
|
1030
|
+
byId: new Map(g)
|
|
1031
|
+
}), x = Object.freeze({
|
|
1032
|
+
config: a,
|
|
1033
|
+
components: Object.freeze(v),
|
|
1034
|
+
implementations: Object.freeze(p),
|
|
1035
|
+
themes: y,
|
|
1036
|
+
hostRenderer: et(b)
|
|
1037
|
+
});
|
|
1038
|
+
return J.set(x, b), r && Y.set(x, {
|
|
1039
|
+
loader: new Re(r.resolver, r.resolveSync),
|
|
1040
|
+
definitions: h
|
|
1041
|
+
}), x;
|
|
1042
|
+
}
|
|
1043
|
+
function Ge(e, t, n) {
|
|
1044
|
+
if (typeof t?.resolver != "function") throw TypeError("A deferred React config requires a resolver.");
|
|
1045
|
+
if (t.resolveSync !== void 0 && typeof t.resolveSync != "function") throw TypeError("resolveSync must be a function.");
|
|
1046
|
+
return We(e, t, n, t);
|
|
1047
|
+
}
|
|
1048
|
+
var X = class extends Error {
|
|
1049
|
+
componentName;
|
|
1050
|
+
constructor(e) {
|
|
1051
|
+
super(`No React implementation is registered for <${e}>.`), this.name = "LocalReactExtensionMissingError", this.componentName = e;
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
function Ke(e) {
|
|
1055
|
+
try {
|
|
1056
|
+
return e.snapshot().revision;
|
|
1057
|
+
} catch {
|
|
1058
|
+
return 0;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
function Z(e, t) {
|
|
1062
|
+
if (typeof e != "string" || e.length === 0) return {
|
|
1063
|
+
line: 1,
|
|
1064
|
+
column: 1
|
|
1065
|
+
};
|
|
1066
|
+
let n = Math.max(0, Math.min(t, e.length)), r = 1, i = 0;
|
|
1067
|
+
for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1, i = t + 1);
|
|
1068
|
+
return {
|
|
1069
|
+
line: r,
|
|
1070
|
+
column: n - i + 1
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
function qe(e, t, n, r, i) {
|
|
1074
|
+
let { line: a, column: o } = Z(r, n.start);
|
|
1075
|
+
return {
|
|
1076
|
+
code: e,
|
|
1077
|
+
message: `Component <${t}> failed: ${i instanceof Error ? i.message : String(i)}`,
|
|
1078
|
+
severity: "error",
|
|
1079
|
+
range: {
|
|
1080
|
+
start: n.start,
|
|
1081
|
+
end: n.end
|
|
1082
|
+
},
|
|
1083
|
+
line: a,
|
|
1084
|
+
column: o
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
var Je = class extends v {
|
|
1088
|
+
state = { failed: !1 };
|
|
1089
|
+
static getDerivedStateFromError() {
|
|
1090
|
+
return { failed: !0 };
|
|
1091
|
+
}
|
|
1092
|
+
componentDidCatch(e) {
|
|
1093
|
+
try {
|
|
1094
|
+
this.props.report([qe("local.extension.render", this.props.name, this.props.range, this.props.source, e)]);
|
|
1095
|
+
} catch {}
|
|
1096
|
+
}
|
|
1097
|
+
componentDidUpdate(e) {
|
|
1098
|
+
this.state.failed && e.revision !== this.props.revision && this.setState({ failed: !1 });
|
|
1099
|
+
}
|
|
1100
|
+
render() {
|
|
1101
|
+
return this.state.failed ? y("span", {
|
|
1102
|
+
className: "local-host-component local-host-unavailable local-sdk-unavailable",
|
|
1103
|
+
"data-local-host-component": this.props.name,
|
|
1104
|
+
"data-local-host-reason": "error",
|
|
1105
|
+
"data-rmd-source-start": String(this.props.range.start),
|
|
1106
|
+
"data-rmd-source-end": String(this.props.range.end),
|
|
1107
|
+
"data-rmd-source-node": this.props.nodeId,
|
|
1108
|
+
"data-rmd-source-type": "hostComponent",
|
|
1109
|
+
"data-rmd-source-component": this.props.name,
|
|
1110
|
+
role: "note"
|
|
1111
|
+
}, `Component <${this.props.name}> is unavailable here.`) : this.props.children;
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
function Ye({ implementation: e, node: t, environment: n }) {
|
|
1115
|
+
let r = e.definition.id.startsWith("reactive-md/"), i = n.mode === "static" ? "static" : "interactive";
|
|
1116
|
+
if (!r && !e.definition.capabilities[i]) throw Error(`Component ${e.definition.id} does not support ${i} rendering.`);
|
|
1117
|
+
let a = Ae(t, {
|
|
1118
|
+
runtime: n.runtime,
|
|
1119
|
+
authorStyle: n.authorStyle,
|
|
1120
|
+
authorStyleText: n.authorStyleText,
|
|
1121
|
+
dispatchAuthorAction: n.dispatchAuthorAction,
|
|
1122
|
+
network: n.network,
|
|
1123
|
+
services: n.services ?? n.runtime.services,
|
|
1124
|
+
mode: n.mode,
|
|
1125
|
+
locale: n.locale,
|
|
1126
|
+
visible: n.visible,
|
|
1127
|
+
disabled: n.disabled,
|
|
1128
|
+
disabledInvalid: n.disabledInvalid,
|
|
1129
|
+
resetToken: n.resetToken,
|
|
1130
|
+
definitionFor: n.definitionFor,
|
|
1131
|
+
validationFieldFor: n.validationField,
|
|
1132
|
+
validationHintFor: n.validationHint,
|
|
1133
|
+
sourceAttributes: n.sourceAttributes,
|
|
1134
|
+
renderChildren: (e, t) => n.renderChildren(e, t),
|
|
1135
|
+
renderInline: (e, t) => n.renderInline(e, t),
|
|
1136
|
+
renderToText: (e) => n.renderToText(e),
|
|
1137
|
+
report: n.report,
|
|
1138
|
+
targetId: n.targetId,
|
|
1139
|
+
anchorId: n.anchorId,
|
|
1140
|
+
jumpAllowed: n.jumpAllowed,
|
|
1141
|
+
jumpTo: n.jumpTo,
|
|
1142
|
+
urlPolicy: n.urlPolicy,
|
|
1143
|
+
imageResolver: n.imageResolver
|
|
1144
|
+
}, n.branchCondition), o = n.mode === "static" && e.renderStatic ? e.renderStatic : e.render, s = y(o, a);
|
|
1145
|
+
return n.trace?.observer?.onTrace ? /* @__PURE__ */ w(ne, { children: [s, /* @__PURE__ */ C(Be, {
|
|
1146
|
+
trace: n.trace,
|
|
1147
|
+
component: e.definition
|
|
1148
|
+
})] }) : s;
|
|
1149
|
+
}
|
|
1150
|
+
function Q(e, t, n, r) {
|
|
1151
|
+
let i = t.name ?? "", a = r ?? e.byName.get(i);
|
|
1152
|
+
if (!a) throw new X(i);
|
|
1153
|
+
let o;
|
|
1154
|
+
try {
|
|
1155
|
+
o = n.runtime.document.source;
|
|
1156
|
+
} catch {
|
|
1157
|
+
o = void 0;
|
|
1158
|
+
}
|
|
1159
|
+
let s = y(Ye, {
|
|
1160
|
+
implementation: a,
|
|
1161
|
+
node: t,
|
|
1162
|
+
environment: n
|
|
1163
|
+
});
|
|
1164
|
+
return a.definition.id.startsWith("reactive-md/") ? s : y(Je, {
|
|
1165
|
+
name: i,
|
|
1166
|
+
nodeId: t.id,
|
|
1167
|
+
revision: Ke(n.runtime),
|
|
1168
|
+
range: t.range,
|
|
1169
|
+
source: o,
|
|
1170
|
+
report: n.report
|
|
1171
|
+
}, s);
|
|
1172
|
+
}
|
|
1173
|
+
var Xe = /* @__PURE__ */ new WeakMap();
|
|
1174
|
+
function Ze({ loader: t, index: n, definition: r, node: i, environment: a }) {
|
|
1175
|
+
let o = a.trace, s = b((e) => t.subscribe(r, e, o), [
|
|
1176
|
+
t,
|
|
1177
|
+
r,
|
|
1178
|
+
o
|
|
1179
|
+
]), c = b(() => t.snapshot(r), [t, r]), l = te(s, c, t.serverSnapshot), u = a.runtime.document, d = l.status === "loading", f = d ? "local.extension.load" : "local.extension.load-failed", p = e(f, a.locale) ?? f;
|
|
1180
|
+
if (x(() => {
|
|
1181
|
+
if (l.status === "ready") return;
|
|
1182
|
+
let e = Xe.get(u);
|
|
1183
|
+
e || (e = /* @__PURE__ */ new Set(), Xe.set(u, e));
|
|
1184
|
+
let t = `${o?.sourceRevision ?? ""}:${r.id}:${r.version}:${f}`;
|
|
1185
|
+
e.size >= 64 || e.has(t) || (e.add(t), a.report([{
|
|
1186
|
+
code: f,
|
|
1187
|
+
message: p,
|
|
1188
|
+
messageKey: f,
|
|
1189
|
+
severity: "warning",
|
|
1190
|
+
range: i.range,
|
|
1191
|
+
...Z(u.source, i.range.start),
|
|
1192
|
+
phase: "host",
|
|
1193
|
+
recoverable: !0
|
|
1194
|
+
}]));
|
|
1195
|
+
}, [
|
|
1196
|
+
u,
|
|
1197
|
+
r,
|
|
1198
|
+
f,
|
|
1199
|
+
p,
|
|
1200
|
+
l.status,
|
|
1201
|
+
o?.sourceRevision,
|
|
1202
|
+
a,
|
|
1203
|
+
i
|
|
1204
|
+
]), l.status === "ready") return Q(n, i, a, l.component);
|
|
1205
|
+
let m = a.locale === "zh" ? "重试" : "Retry";
|
|
1206
|
+
return /* @__PURE__ */ w("span", {
|
|
1207
|
+
className: "local-component-loading",
|
|
1208
|
+
"data-rmd-component-load": l.status,
|
|
1209
|
+
role: "status",
|
|
1210
|
+
children: [p, !d && /* @__PURE__ */ C("button", {
|
|
1211
|
+
type: "button",
|
|
1212
|
+
onClick: () => t.retry(r, o),
|
|
1213
|
+
children: m
|
|
1214
|
+
})]
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
function Qe(e) {
|
|
1218
|
+
let t = He(e), n = Y.get(e);
|
|
1219
|
+
return (e, r) => {
|
|
1220
|
+
let a = e.name ?? "", o = n?.definitions.get(a);
|
|
1221
|
+
if (!n || !o) return Q(t, e, r);
|
|
1222
|
+
let s = r.runtime.document.componentDefinitions?.find((e) => e.name === a);
|
|
1223
|
+
if (!s || s.id !== o.id || s.version !== o.version || i(s) !== i(o)) throw new X(a);
|
|
1224
|
+
let c = n.loader.synchronousImplementation(o);
|
|
1225
|
+
return c ? Q(t, e, r, c) : /* @__PURE__ */ C(Ze, {
|
|
1226
|
+
loader: n.loader,
|
|
1227
|
+
index: t,
|
|
1228
|
+
definition: o,
|
|
1229
|
+
node: e,
|
|
1230
|
+
environment: r
|
|
1231
|
+
});
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
function $e(e) {
|
|
1235
|
+
let t = "";
|
|
1236
|
+
for (let n of e ?? []) n.type === "text" || n.type === "inlineCode" || n.type === "code" || n.type === "rawBody" ? t += n.value ?? "" : n.type === "math" || n.type === "inlineMath" || n.type === "image" ? t += n.value ?? n.alt ?? "" : t += $e(n.children);
|
|
1237
|
+
return t;
|
|
1238
|
+
}
|
|
1239
|
+
function et(e) {
|
|
1240
|
+
return (t, n, r) => Q(e, t, {
|
|
1241
|
+
runtime: r.runtime,
|
|
1242
|
+
mode: r.mode,
|
|
1243
|
+
visible: r.visible,
|
|
1244
|
+
disabled: r.disabled,
|
|
1245
|
+
disabledInvalid: !1,
|
|
1246
|
+
resetToken: r.resetToken,
|
|
1247
|
+
locale: "en",
|
|
1248
|
+
renderChildren: (e, t) => r.render(e, t),
|
|
1249
|
+
renderInline: (e, t) => r.render(e, t),
|
|
1250
|
+
renderToText: (e) => $e(e),
|
|
1251
|
+
report: (e) => r.report(e),
|
|
1252
|
+
definitionFor: (t) => e.byName.get(t)?.definition,
|
|
1253
|
+
validationField: () => ({ invalid: !1 }),
|
|
1254
|
+
validationHint: () => null,
|
|
1255
|
+
sourceAttributes: () => ({}),
|
|
1256
|
+
targetId: () => void 0,
|
|
1257
|
+
anchorId: () => void 0,
|
|
1258
|
+
jumpAllowed: () => !1,
|
|
1259
|
+
jumpTo: () => "missing"
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
function tt(e, t) {
|
|
1263
|
+
let n = g(t, e.config);
|
|
1264
|
+
if (n.length || !t || typeof t != "object") return n;
|
|
1265
|
+
let r = t.components;
|
|
1266
|
+
if (!Array.isArray(r)) return n;
|
|
1267
|
+
let i = He(e), a = Y.get(e);
|
|
1268
|
+
for (let e of r) !i.byId.has(e.id) && a?.definitions.get(e.name)?.id !== e.id && n.push({
|
|
1269
|
+
code: "local.extension.renderer-missing",
|
|
1270
|
+
severity: "error",
|
|
1271
|
+
message: new X(e.name).message,
|
|
1272
|
+
range: {
|
|
1273
|
+
start: 0,
|
|
1274
|
+
end: 0
|
|
1275
|
+
},
|
|
1276
|
+
line: 1,
|
|
1277
|
+
column: 1
|
|
1278
|
+
});
|
|
1279
|
+
return n;
|
|
1280
|
+
}
|
|
1281
|
+
function $(e, t, n) {
|
|
1282
|
+
try {
|
|
1283
|
+
e.report([qe("local.extension.event", e.instance.componentId, e.instance.range, n, t)]);
|
|
1284
|
+
} catch {}
|
|
1285
|
+
}
|
|
1286
|
+
function nt(e, t, n) {
|
|
1287
|
+
return (...r) => {
|
|
1288
|
+
try {
|
|
1289
|
+
t(...r);
|
|
1290
|
+
} catch (t) {
|
|
1291
|
+
$(e, t, n);
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
export { $ as a, Be as c, j as d, H as f, ye as h, Qe as i, Le as l, A as m, Ge as n, nt as o, D as p, We as r, tt as s, X as t, fe as u };
|