marko 5.37.1 → 6.0.0-3.4
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/dist/common/attr-tag.d.ts +8 -0
- package/dist/common/compat-meta.d.ts +2 -0
- package/dist/common/for.d.ts +5 -0
- package/dist/common/helpers.d.ts +7 -0
- package/dist/common/meta.d.ts +2 -0
- package/dist/common/types.d.ts +105 -0
- package/dist/debug/dom.js +2112 -0
- package/dist/debug/dom.mjs +2089 -0
- package/dist/debug/html.js +2740 -0
- package/dist/debug/html.mjs +2663 -0
- package/dist/dom/abort-signal.d.ts +3 -0
- package/dist/dom/compat.d.ts +20 -0
- package/dist/dom/control-flow.d.ts +14 -0
- package/dist/dom/controllable.d.ts +12 -0
- package/dist/dom/dom.d.ts +19 -0
- package/dist/dom/event.d.ts +4 -0
- package/dist/dom/parse-html.d.ts +5 -0
- package/dist/dom/queue.d.ts +10 -0
- package/dist/dom/reconcile.d.ts +2 -0
- package/dist/dom/renderer.d.ts +21 -0
- package/dist/dom/resolve-cursor-position.d.ts +1 -0
- package/dist/dom/resume.d.ts +9 -0
- package/dist/dom/schedule.d.ts +2 -0
- package/dist/dom/scope.d.ts +7 -0
- package/dist/dom/signals.d.ts +39 -0
- package/dist/dom/template.d.ts +3 -0
- package/dist/dom/walker.d.ts +4 -0
- package/dist/dom.d.ts +15 -0
- package/dist/dom.js +1370 -0
- package/dist/dom.mjs +1350 -0
- package/dist/html/attrs.d.ts +14 -0
- package/dist/html/compat.d.ts +14 -0
- package/dist/html/content.d.ts +5 -0
- package/dist/html/dynamic-tag.d.ts +12 -0
- package/dist/html/for.d.ts +4 -0
- package/dist/html/inlined-runtimes.d.ts +2 -0
- package/dist/html/serializer.d.ts +14 -0
- package/dist/html/template.d.ts +3 -0
- package/dist/html/writer.d.ts +114 -0
- package/dist/html.d.ts +9 -0
- package/dist/html.js +1818 -0
- package/dist/html.mjs +1744 -0
- package/dist/translator/core/attrs.d.ts +3 -0
- package/dist/translator/core/client.d.ts +14 -0
- package/dist/translator/core/const.d.ts +3 -0
- package/dist/translator/core/debug.d.ts +3 -0
- package/dist/translator/core/define.d.ts +3 -0
- package/dist/translator/core/effect.d.ts +3 -0
- package/dist/translator/core/export.d.ts +3 -0
- package/dist/translator/core/for.d.ts +67 -0
- package/dist/translator/core/html-comment.d.ts +12 -0
- package/dist/translator/core/html-script.d.ts +9 -0
- package/dist/translator/core/html-style.d.ts +9 -0
- package/dist/translator/core/id.d.ts +3 -0
- package/dist/translator/core/if.d.ts +53 -0
- package/dist/translator/core/import.d.ts +3 -0
- package/dist/translator/core/index.d.ts +152 -0
- package/dist/translator/core/let.d.ts +8 -0
- package/dist/translator/core/lifecycle.d.ts +10 -0
- package/dist/translator/core/log.d.ts +3 -0
- package/dist/translator/core/return.d.ts +6 -0
- package/dist/translator/core/script.d.ts +3 -0
- package/dist/translator/core/server.d.ts +14 -0
- package/dist/translator/core/static.d.ts +14 -0
- package/dist/translator/core/style.d.ts +3 -0
- package/dist/translator/index.d.ts +201 -0
- package/dist/translator/index.js +9143 -489
- package/dist/translator/util/assert.d.ts +3 -0
- package/dist/translator/util/binding-has-downstream-expressions.d.ts +2 -0
- package/dist/translator/util/entry-builder.d.ts +19 -0
- package/dist/translator/util/evaluate.d.ts +11 -0
- package/dist/translator/util/for-each-identifier.d.ts +2 -0
- package/dist/translator/util/get-defined-binding-expression.d.ts +3 -0
- package/dist/translator/util/get-known-attr-values.d.ts +2 -0
- package/dist/translator/util/get-parent-tag.d.ts +2 -0
- package/dist/translator/util/get-root.d.ts +7 -0
- package/dist/translator/util/get-tag-name.d.ts +2 -0
- package/dist/translator/util/is-core-tag.d.ts +10 -0
- package/dist/translator/util/is-stateful.d.ts +3 -0
- package/dist/translator/util/is-static.d.ts +2 -0
- package/dist/translator/util/marko-config.d.ts +4 -0
- package/dist/translator/util/nested-attribute-tags.d.ts +17 -0
- package/dist/translator/util/normalize-string-expression.d.ts +3 -0
- package/dist/translator/util/optional.d.ts +20 -0
- package/dist/translator/util/plugin-hooks.d.ts +4 -0
- package/dist/translator/util/references.d.ts +84 -0
- package/dist/translator/util/runtime-info.d.ts +5 -0
- package/dist/translator/util/runtime.d.ts +15 -0
- package/dist/translator/util/scope-read.d.ts +6 -0
- package/dist/translator/util/sections.d.ts +51 -0
- package/dist/translator/util/signals.d.ts +61 -0
- package/dist/translator/util/simplify-fn.d.ts +5 -0
- package/dist/translator/util/state.d.ts +3 -0
- package/dist/translator/util/tag-name-type.d.ts +16 -0
- package/dist/translator/util/to-first-expression-or-block.d.ts +3 -0
- package/dist/translator/util/to-first-statement-or-block.d.ts +2 -0
- package/dist/translator/util/to-property-name.d.ts +7 -0
- package/dist/translator/util/translate-attrs.d.ts +12 -0
- package/dist/translator/util/translate-var.d.ts +2 -0
- package/dist/translator/util/traverse.d.ts +9 -0
- package/dist/translator/util/visitors.d.ts +11 -0
- package/dist/translator/util/walks.d.ts +15 -0
- package/dist/translator/util/with-previous-location.d.ts +2 -0
- package/dist/translator/util/writer.d.ts +13 -0
- package/dist/translator/visitors/cdata.d.ts +7 -0
- package/dist/translator/visitors/comment.d.ts +7 -0
- package/dist/translator/visitors/declaration.d.ts +7 -0
- package/dist/translator/visitors/document-type.d.ts +7 -0
- package/dist/translator/visitors/function.d.ts +19 -0
- package/dist/translator/visitors/import-declaration.d.ts +8 -0
- package/dist/translator/visitors/placeholder.d.ts +22 -0
- package/dist/translator/visitors/program/dom.d.ts +7 -0
- package/dist/translator/visitors/program/html.d.ts +8 -0
- package/dist/translator/visitors/program/index.d.ts +39 -0
- package/dist/translator/visitors/referenced-identifier.d.ts +7 -0
- package/dist/translator/visitors/scriptlet.d.ts +8 -0
- package/dist/translator/visitors/tag/attribute-tag.d.ts +11 -0
- package/dist/translator/visitors/tag/custom-tag.d.ts +19 -0
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +18 -0
- package/dist/translator/visitors/tag/index.d.ts +15 -0
- package/dist/translator/visitors/tag/native-tag.d.ts +25 -0
- package/dist/translator/visitors/text.d.ts +7 -0
- package/package.json +32 -74
- package/README.md +0 -161
- package/bin/markoc +0 -2
- package/bin/markoc.js +0 -441
- package/browser-refresh.js +0 -5
- package/compiler-browser.marko +0 -15
- package/compiler.js +0 -7
- package/components-browser.marko +0 -15
- package/components.js +0 -7
- package/dist/build.json +0 -3
- package/dist/compiler/config.js +0 -45
- package/dist/compiler/index.js +0 -164
- package/dist/compiler/modules.js +0 -5
- package/dist/core-tags/components/init-components-tag.js +0 -54
- package/dist/core-tags/components/preferred-script-location-tag.js +0 -25
- package/dist/core-tags/components/preserve-tag.js +0 -1
- package/dist/core-tags/core/__flush_here_and_after__.js +0 -44
- package/dist/core-tags/core/await/AsyncValue.js +0 -121
- package/dist/core-tags/core/await/client-reorder-runtime.js +0 -51
- package/dist/core-tags/core/await/index.d.marko +0 -10
- package/dist/core-tags/core/await/renderer.js +0 -249
- package/dist/core-tags/core/await/reorderer-renderer.js +0 -156
- package/dist/index.js +0 -4
- package/dist/node-require/browser-refresh.js +0 -18
- package/dist/node-require/hot-reload.js +0 -45
- package/dist/node-require/index.js +0 -103
- package/dist/node_modules/@internal/components-beginComponent/index-browser.js +0 -23
- package/dist/node_modules/@internal/components-beginComponent/index.js +0 -84
- package/dist/node_modules/@internal/components-beginComponent/package.json +0 -11
- package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +0 -335
- package/dist/node_modules/@internal/components-define-widget-legacy/index.js +0 -18
- package/dist/node_modules/@internal/components-define-widget-legacy/package.json +0 -11
- package/dist/node_modules/@internal/components-endComponent/index-browser.js +0 -5
- package/dist/node_modules/@internal/components-endComponent/index.js +0 -11
- package/dist/node_modules/@internal/components-endComponent/package.json +0 -11
- package/dist/node_modules/@internal/components-entry/index-browser.js +0 -11
- package/dist/node_modules/@internal/components-entry/index.js +0 -301
- package/dist/node_modules/@internal/components-entry/package.json +0 -11
- package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +0 -76
- package/dist/node_modules/@internal/components-entry-legacy/index.js +0 -16
- package/dist/node_modules/@internal/components-entry-legacy/package.json +0 -11
- package/dist/node_modules/@internal/components-registry/index-browser.js +0 -586
- package/dist/node_modules/@internal/components-registry/index.js +0 -44
- package/dist/node_modules/@internal/components-registry/package.json +0 -11
- package/dist/node_modules/@internal/components-util/index-browser.js +0 -152
- package/dist/node_modules/@internal/components-util/index.js +0 -75
- package/dist/node_modules/@internal/components-util/package.json +0 -11
- package/dist/node_modules/@internal/create-readable/index-browser.js +0 -30
- package/dist/node_modules/@internal/create-readable/index.js +0 -57
- package/dist/node_modules/@internal/create-readable/package.json +0 -11
- package/dist/node_modules/@internal/loader/fallback-node.js +0 -89
- package/dist/node_modules/@internal/loader/index-browser.js +0 -2
- package/dist/node_modules/@internal/loader/index.js +0 -23
- package/dist/node_modules/@internal/loader/package.json +0 -10
- package/dist/node_modules/@internal/preserve-tag/index-browser.js +0 -46
- package/dist/node_modules/@internal/preserve-tag/index.js +0 -34
- package/dist/node_modules/@internal/preserve-tag/package.json +0 -11
- package/dist/node_modules/@internal/require/index-browser.js +0 -15
- package/dist/node_modules/@internal/require/index-legacy-browser.js +0 -20
- package/dist/node_modules/@internal/require/index-webpack.js +0 -16
- package/dist/node_modules/@internal/require/index.js +0 -15
- package/dist/node_modules/@internal/require/package.json +0 -11
- package/dist/node_modules/@internal/set-immediate/index-browser.js +0 -19
- package/dist/node_modules/@internal/set-immediate/index-worker.js +0 -31
- package/dist/node_modules/@internal/set-immediate/index.js +0 -3
- package/dist/node_modules/@internal/set-immediate/package.json +0 -11
- package/dist/node_modules/@internal/set-immediate/queueMicrotask.js +0 -8
- package/dist/runtime/RenderResult.js +0 -112
- package/dist/runtime/components/Component.js +0 -663
- package/dist/runtime/components/ComponentDef.js +0 -169
- package/dist/runtime/components/ComponentsContext.js +0 -59
- package/dist/runtime/components/GlobalComponentsContext.js +0 -10
- package/dist/runtime/components/KeySequence.js +0 -16
- package/dist/runtime/components/ServerComponent.js +0 -73
- package/dist/runtime/components/State.js +0 -101
- package/dist/runtime/components/attach-detach.js +0 -60
- package/dist/runtime/components/defineComponent.js +0 -60
- package/dist/runtime/components/dom-data.js +0 -8
- package/dist/runtime/components/event-delegation.js +0 -144
- package/dist/runtime/components/index.js +0 -1
- package/dist/runtime/components/legacy/browser.json +0 -9
- package/dist/runtime/components/legacy/defineComponent-legacy.js +0 -27
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +0 -171
- package/dist/runtime/components/legacy/defineWidget-legacy.js +0 -1
- package/dist/runtime/components/legacy/dependencies/html.js +0 -3
- package/dist/runtime/components/legacy/dependencies/index.js +0 -177
- package/dist/runtime/components/legacy/dependencies/vdom.js +0 -3
- package/dist/runtime/components/legacy/index.js +0 -1
- package/dist/runtime/components/legacy/jquery.js +0 -52
- package/dist/runtime/components/legacy/ready.js +0 -152
- package/dist/runtime/components/legacy/renderer-legacy.js +0 -231
- package/dist/runtime/components/registry.js +0 -1
- package/dist/runtime/components/renderer.js +0 -236
- package/dist/runtime/components/update-manager.js +0 -94
- package/dist/runtime/createOut.js +0 -13
- package/dist/runtime/dom-insert.js +0 -77
- package/dist/runtime/events.js +0 -2
- package/dist/runtime/helpers/_change-case.js +0 -45
- package/dist/runtime/helpers/assign.js +0 -21
- package/dist/runtime/helpers/attr-tag.js +0 -43
- package/dist/runtime/helpers/class-value.js +0 -30
- package/dist/runtime/helpers/dynamic-tag.js +0 -181
- package/dist/runtime/helpers/empty-component.js +0 -1
- package/dist/runtime/helpers/merge.js +0 -13
- package/dist/runtime/helpers/of-fallback.js +0 -4
- package/dist/runtime/helpers/render-tag.js +0 -20
- package/dist/runtime/helpers/serialize-noop.js +0 -5
- package/dist/runtime/helpers/style-value.js +0 -45
- package/dist/runtime/helpers/tags-compat/dom-debug.js +0 -1
- package/dist/runtime/helpers/tags-compat/dom-debug.mjs +0 -4
- package/dist/runtime/helpers/tags-compat/dom.js +0 -1
- package/dist/runtime/helpers/tags-compat/dom.mjs +0 -4
- package/dist/runtime/helpers/tags-compat/html-debug.js +0 -3
- package/dist/runtime/helpers/tags-compat/html-debug.mjs +0 -4
- package/dist/runtime/helpers/tags-compat/html.js +0 -3
- package/dist/runtime/helpers/tags-compat/html.mjs +0 -4
- package/dist/runtime/helpers/tags-compat/runtime-dom.js +0 -239
- package/dist/runtime/helpers/tags-compat/runtime-html.js +0 -136
- package/dist/runtime/helpers/to-string.js +0 -5
- package/dist/runtime/html/AsyncStream.js +0 -805
- package/dist/runtime/html/BufferedWriter.js +0 -52
- package/dist/runtime/html/StringWriter.js +0 -73
- package/dist/runtime/html/helpers/_dynamic-attr.js +0 -35
- package/dist/runtime/html/helpers/attr.js +0 -80
- package/dist/runtime/html/helpers/attrs.js +0 -26
- package/dist/runtime/html/helpers/class-attr.js +0 -8
- package/dist/runtime/html/helpers/data-marko.js +0 -36
- package/dist/runtime/html/helpers/escape-quotes.js +0 -35
- package/dist/runtime/html/helpers/escape-script-placeholder.js +0 -24
- package/dist/runtime/html/helpers/escape-style-placeholder.js +0 -22
- package/dist/runtime/html/helpers/escape-xml.js +0 -21
- package/dist/runtime/html/helpers/merge-attrs.js +0 -55
- package/dist/runtime/html/helpers/props-script.js +0 -32
- package/dist/runtime/html/helpers/style-attr.js +0 -8
- package/dist/runtime/html/hot-reload.js +0 -26
- package/dist/runtime/html/index.js +0 -33
- package/dist/runtime/html/marko-namespace.js +0 -3
- package/dist/runtime/renderable.js +0 -194
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +0 -456
- package/dist/runtime/vdom/VComment.js +0 -24
- package/dist/runtime/vdom/VComponent.js +0 -17
- package/dist/runtime/vdom/VDocumentFragment.js +0 -34
- package/dist/runtime/vdom/VElement.js +0 -375
- package/dist/runtime/vdom/VFragment.js +0 -26
- package/dist/runtime/vdom/VNode.js +0 -100
- package/dist/runtime/vdom/VText.js +0 -25
- package/dist/runtime/vdom/helpers/attrs.js +0 -62
- package/dist/runtime/vdom/helpers/const-element.js +0 -25
- package/dist/runtime/vdom/helpers/merge-attrs.js +0 -16
- package/dist/runtime/vdom/hot-reload.js +0 -115
- package/dist/runtime/vdom/index.js +0 -30
- package/dist/runtime/vdom/is-text-only.js +0 -10
- package/dist/runtime/vdom/marko-namespace.js +0 -3
- package/dist/runtime/vdom/morphdom/fragment.js +0 -95
- package/dist/runtime/vdom/morphdom/helpers.js +0 -42
- package/dist/runtime/vdom/morphdom/index.js +0 -741
- package/dist/runtime/vdom/parse-html.js +0 -18
- package/dist/runtime/vdom/vdom.js +0 -88
- package/dist/taglib/index.js +0 -51
- package/dist/translator/cdata/index.js +0 -15
- package/dist/translator/cdata/index[html].js +0 -15
- package/dist/translator/cdata/index[vdom].js +0 -12
- package/dist/translator/class.js +0 -65
- package/dist/translator/comment/index.js +0 -15
- package/dist/translator/comment/index[html].js +0 -17
- package/dist/translator/comment/index[vdom].js +0 -3
- package/dist/translator/declaration/index.js +0 -15
- package/dist/translator/declaration/index[html].js +0 -12
- package/dist/translator/declaration/index[vdom].js +0 -3
- package/dist/translator/document-type/index.js +0 -15
- package/dist/translator/document-type/index[html].js +0 -12
- package/dist/translator/document-type/index[vdom].js +0 -3
- package/dist/translator/placeholder/index.js +0 -15
- package/dist/translator/placeholder/index[html].js +0 -93
- package/dist/translator/placeholder/index[vdom].js +0 -22
- package/dist/translator/scriptlet.js +0 -4
- package/dist/translator/tag/attribute/directives/class.js +0 -42
- package/dist/translator/tag/attribute/directives/index.js +0 -15
- package/dist/translator/tag/attribute/directives/no-update-body-if.js +0 -15
- package/dist/translator/tag/attribute/directives/no-update-body.js +0 -10
- package/dist/translator/tag/attribute/directives/no-update-if.js +0 -12
- package/dist/translator/tag/attribute/directives/no-update.js +0 -48
- package/dist/translator/tag/attribute/directives/style.js +0 -42
- package/dist/translator/tag/attribute/index.js +0 -150
- package/dist/translator/tag/attribute/modifiers/index.js +0 -7
- package/dist/translator/tag/attribute/modifiers/no-update.js +0 -14
- package/dist/translator/tag/attribute/modifiers/scoped.js +0 -23
- package/dist/translator/tag/attribute-tag.js +0 -149
- package/dist/translator/tag/custom-tag.js +0 -146
- package/dist/translator/tag/dynamic-tag.js +0 -74
- package/dist/translator/tag/index.js +0 -287
- package/dist/translator/tag/macro-tag.js +0 -7
- package/dist/translator/tag/native-tag.js +0 -27
- package/dist/translator/tag/native-tag[html]/attributes.js +0 -151
- package/dist/translator/tag/native-tag[html]/index.js +0 -221
- package/dist/translator/tag/native-tag[vdom]/attributes.js +0 -105
- package/dist/translator/tag/native-tag[vdom]/index.js +0 -189
- package/dist/translator/tag/util.js +0 -246
- package/dist/translator/taglib/core/conditional/translate-else-if.js +0 -20
- package/dist/translator/taglib/core/conditional/translate-else.js +0 -20
- package/dist/translator/taglib/core/conditional/translate-if.js +0 -8
- package/dist/translator/taglib/core/conditional/util.js +0 -41
- package/dist/translator/taglib/core/index.js +0 -474
- package/dist/translator/taglib/core/macro/parse.js +0 -17
- package/dist/translator/taglib/core/macro/translate.js +0 -48
- package/dist/translator/taglib/core/parse-class.js +0 -79
- package/dist/translator/taglib/core/parse-export.js +0 -14
- package/dist/translator/taglib/core/parse-import.js +0 -14
- package/dist/translator/taglib/core/parse-module-code.js +0 -18
- package/dist/translator/taglib/core/parse-static.js +0 -18
- package/dist/translator/taglib/core/transform-style.js +0 -66
- package/dist/translator/taglib/core/translate-await.js +0 -41
- package/dist/translator/taglib/core/translate-body.js +0 -17
- package/dist/translator/taglib/core/translate-for.js +0 -156
- package/dist/translator/taglib/core/translate-html-comment.js +0 -52
- package/dist/translator/taglib/core/translate-include-content.js +0 -53
- package/dist/translator/taglib/core/translate-server-only.js +0 -5
- package/dist/translator/taglib/core/translate-while.js +0 -32
- package/dist/translator/taglib/index.js +0 -6
- package/dist/translator/taglib/migrate/all-templates.js +0 -46
- package/dist/translator/taglib/migrate/index.js +0 -5
- package/dist/translator/text/index.js +0 -10
- package/dist/translator/text/index[html].js +0 -12
- package/dist/translator/text/index[vdom].js +0 -20
- package/dist/translator/util/add-dependencies.js +0 -329
- package/dist/translator/util/escape-regexp.js +0 -4
- package/dist/translator/util/get-component-files.js +0 -86
- package/dist/translator/util/html-out-write.js +0 -15
- package/dist/translator/util/key-manager.js +0 -176
- package/dist/translator/util/optimize-html-writes.js +0 -52
- package/dist/translator/util/optimize-vdom-create.js +0 -164
- package/dist/translator/util/plugin-hooks.js +0 -22
- package/dist/translator/util/runtime-flags.js +0 -3
- package/dist/translator/util/vdom-out-write.js +0 -10
- package/dist/translator/util/with-previous-location.js +0 -6
- package/docs/10-awesome-marko-features.md +0 -291
- package/docs/body-content.md +0 -355
- package/docs/class-components.md +0 -1001
- package/docs/cloudflare-workers.md +0 -32
- package/docs/compiler-hooks.png +0 -0
- package/docs/compiler.md +0 -473
- package/docs/component-diagram.afdesign +0 -0
- package/docs/component-diagram.svg +0 -87
- package/docs/concise.md +0 -141
- package/docs/conditionals-and-lists.md +0 -72
- package/docs/core-tags.md +0 -325
- package/docs/custom-tags.md +0 -201
- package/docs/editor-plugins.md +0 -45
- package/docs/events.md +0 -131
- package/docs/express.md +0 -66
- package/docs/fastify.md +0 -65
- package/docs/getting-started.md +0 -95
- package/docs/http.md +0 -34
- package/docs/icons/js.svg +0 -4
- package/docs/icons/marko.svg +0 -1
- package/docs/icons/ts.svg +0 -1
- package/docs/installing.md +0 -51
- package/docs/koa.md +0 -35
- package/docs/lasso.md +0 -196
- package/docs/marko-5-upgrade.md +0 -59
- package/docs/marko-json.md +0 -248
- package/docs/marko-vs-react.md +0 -854
- package/docs/redux.md +0 -61
- package/docs/rendering.md +0 -268
- package/docs/rollup.md +0 -352
- package/docs/state.md +0 -105
- package/docs/structure.json +0 -49
- package/docs/styles.md +0 -29
- package/docs/syntax.md +0 -601
- package/docs/troubleshooting-streaming.md +0 -68
- package/docs/typescript.md +0 -406
- package/docs/vite.md +0 -86
- package/docs/webpack.md +0 -205
- package/docs/why-is-marko-fast.md +0 -239
- package/env.js +0 -7
- package/helpers/README.md +0 -3
- package/helpers/empty.js +0 -4
- package/helpers/notEmpty.js +0 -11
- package/index-browser.marko +0 -15
- package/index.d.ts +0 -375
- package/index.js +0 -7
- package/legacy-components-browser.marko +0 -15
- package/legacy-components.js +0 -7
- package/node-require.js +0 -8
- package/src/build.json +0 -3
- package/src/compiler/config.js +0 -45
- package/src/compiler/index.js +0 -164
- package/src/compiler/modules.js +0 -5
- package/src/core-tags/.eslintrc +0 -5
- package/src/core-tags/components/init-components-tag.js +0 -54
- package/src/core-tags/components/preferred-script-location-tag.js +0 -25
- package/src/core-tags/components/preserve-tag.js +0 -1
- package/src/core-tags/core/__flush_here_and_after__.js +0 -44
- package/src/core-tags/core/await/AsyncValue.js +0 -121
- package/src/core-tags/core/await/client-reorder-runtime.js +0 -51
- package/src/core-tags/core/await/index.d.marko +0 -10
- package/src/core-tags/core/await/renderer.js +0 -249
- package/src/core-tags/core/await/reorderer-renderer.js +0 -156
- package/src/index.js +0 -4
- package/src/node-require/browser-refresh.js +0 -18
- package/src/node-require/hot-reload.js +0 -45
- package/src/node-require/index.js +0 -103
- package/src/node_modules/@internal/components-beginComponent/index-browser.js +0 -23
- package/src/node_modules/@internal/components-beginComponent/index.js +0 -84
- package/src/node_modules/@internal/components-beginComponent/package.json +0 -11
- package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +0 -335
- package/src/node_modules/@internal/components-define-widget-legacy/index.js +0 -18
- package/src/node_modules/@internal/components-define-widget-legacy/package.json +0 -11
- package/src/node_modules/@internal/components-endComponent/index-browser.js +0 -5
- package/src/node_modules/@internal/components-endComponent/index.js +0 -11
- package/src/node_modules/@internal/components-endComponent/package.json +0 -11
- package/src/node_modules/@internal/components-entry/index-browser.js +0 -11
- package/src/node_modules/@internal/components-entry/index.js +0 -301
- package/src/node_modules/@internal/components-entry/package.json +0 -11
- package/src/node_modules/@internal/components-entry-legacy/index-browser.js +0 -76
- package/src/node_modules/@internal/components-entry-legacy/index.js +0 -16
- package/src/node_modules/@internal/components-entry-legacy/package.json +0 -11
- package/src/node_modules/@internal/components-registry/index-browser.js +0 -586
- package/src/node_modules/@internal/components-registry/index.js +0 -44
- package/src/node_modules/@internal/components-registry/package.json +0 -11
- package/src/node_modules/@internal/components-util/index-browser.js +0 -152
- package/src/node_modules/@internal/components-util/index.js +0 -75
- package/src/node_modules/@internal/components-util/package.json +0 -11
- package/src/node_modules/@internal/create-readable/index-browser.js +0 -30
- package/src/node_modules/@internal/create-readable/index.js +0 -57
- package/src/node_modules/@internal/create-readable/package.json +0 -11
- package/src/node_modules/@internal/loader/fallback-node.js +0 -89
- package/src/node_modules/@internal/loader/index-browser.js +0 -2
- package/src/node_modules/@internal/loader/index.js +0 -23
- package/src/node_modules/@internal/loader/package.json +0 -10
- package/src/node_modules/@internal/preserve-tag/index-browser.js +0 -46
- package/src/node_modules/@internal/preserve-tag/index.js +0 -34
- package/src/node_modules/@internal/preserve-tag/package.json +0 -11
- package/src/node_modules/@internal/require/index-browser.js +0 -15
- package/src/node_modules/@internal/require/index-legacy-browser.js +0 -20
- package/src/node_modules/@internal/require/index-webpack.js +0 -16
- package/src/node_modules/@internal/require/index.js +0 -15
- package/src/node_modules/@internal/require/package.json +0 -11
- package/src/node_modules/@internal/set-immediate/index-browser.js +0 -19
- package/src/node_modules/@internal/set-immediate/index-worker.js +0 -31
- package/src/node_modules/@internal/set-immediate/index.js +0 -3
- package/src/node_modules/@internal/set-immediate/package.json +0 -11
- package/src/node_modules/@internal/set-immediate/queueMicrotask.js +0 -8
- package/src/runtime/.eslintrc +0 -5
- package/src/runtime/RenderResult.js +0 -112
- package/src/runtime/components/Component.js +0 -663
- package/src/runtime/components/ComponentDef.js +0 -169
- package/src/runtime/components/ComponentsContext.js +0 -59
- package/src/runtime/components/GlobalComponentsContext.js +0 -10
- package/src/runtime/components/KeySequence.js +0 -16
- package/src/runtime/components/ServerComponent.js +0 -73
- package/src/runtime/components/State.js +0 -101
- package/src/runtime/components/attach-detach.js +0 -60
- package/src/runtime/components/defineComponent.js +0 -60
- package/src/runtime/components/dom-data.js +0 -8
- package/src/runtime/components/event-delegation.js +0 -144
- package/src/runtime/components/index.js +0 -1
- package/src/runtime/components/legacy/browser.json +0 -9
- package/src/runtime/components/legacy/defineComponent-legacy.js +0 -27
- package/src/runtime/components/legacy/defineRenderer-legacy.js +0 -171
- package/src/runtime/components/legacy/defineWidget-legacy.js +0 -1
- package/src/runtime/components/legacy/dependencies/html.js +0 -3
- package/src/runtime/components/legacy/dependencies/index.js +0 -177
- package/src/runtime/components/legacy/dependencies/vdom.js +0 -3
- package/src/runtime/components/legacy/index.js +0 -1
- package/src/runtime/components/legacy/jquery.js +0 -52
- package/src/runtime/components/legacy/ready.js +0 -152
- package/src/runtime/components/legacy/renderer-legacy.js +0 -231
- package/src/runtime/components/registry.js +0 -1
- package/src/runtime/components/renderer.js +0 -236
- package/src/runtime/components/update-manager.js +0 -94
- package/src/runtime/createOut.js +0 -13
- package/src/runtime/dom-insert.js +0 -77
- package/src/runtime/events.js +0 -2
- package/src/runtime/helpers/_change-case.js +0 -45
- package/src/runtime/helpers/assign.js +0 -21
- package/src/runtime/helpers/attr-tag.js +0 -43
- package/src/runtime/helpers/class-value.js +0 -30
- package/src/runtime/helpers/dynamic-tag.js +0 -181
- package/src/runtime/helpers/empty-component.js +0 -1
- package/src/runtime/helpers/merge.js +0 -13
- package/src/runtime/helpers/of-fallback.js +0 -4
- package/src/runtime/helpers/render-tag.js +0 -20
- package/src/runtime/helpers/serialize-noop.js +0 -5
- package/src/runtime/helpers/style-value.js +0 -45
- package/src/runtime/helpers/tags-compat/dom-debug.js +0 -1
- package/src/runtime/helpers/tags-compat/dom-debug.mjs +0 -4
- package/src/runtime/helpers/tags-compat/dom.js +0 -1
- package/src/runtime/helpers/tags-compat/dom.mjs +0 -4
- package/src/runtime/helpers/tags-compat/html-debug.js +0 -3
- package/src/runtime/helpers/tags-compat/html-debug.mjs +0 -4
- package/src/runtime/helpers/tags-compat/html.js +0 -3
- package/src/runtime/helpers/tags-compat/html.mjs +0 -4
- package/src/runtime/helpers/tags-compat/runtime-dom.js +0 -239
- package/src/runtime/helpers/tags-compat/runtime-html.js +0 -136
- package/src/runtime/helpers/to-string.js +0 -5
- package/src/runtime/html/AsyncStream.js +0 -805
- package/src/runtime/html/BufferedWriter.js +0 -52
- package/src/runtime/html/StringWriter.js +0 -73
- package/src/runtime/html/helpers/_dynamic-attr.js +0 -35
- package/src/runtime/html/helpers/attr.js +0 -80
- package/src/runtime/html/helpers/attrs.js +0 -26
- package/src/runtime/html/helpers/class-attr.js +0 -8
- package/src/runtime/html/helpers/data-marko.js +0 -36
- package/src/runtime/html/helpers/escape-quotes.js +0 -35
- package/src/runtime/html/helpers/escape-script-placeholder.js +0 -24
- package/src/runtime/html/helpers/escape-style-placeholder.js +0 -22
- package/src/runtime/html/helpers/escape-xml.js +0 -21
- package/src/runtime/html/helpers/merge-attrs.js +0 -55
- package/src/runtime/html/helpers/props-script.js +0 -32
- package/src/runtime/html/helpers/style-attr.js +0 -8
- package/src/runtime/html/hot-reload.js +0 -26
- package/src/runtime/html/index.js +0 -33
- package/src/runtime/html/marko-namespace.js +0 -3
- package/src/runtime/renderable.js +0 -194
- package/src/runtime/vdom/AsyncVDOMBuilder.js +0 -456
- package/src/runtime/vdom/VComment.js +0 -24
- package/src/runtime/vdom/VComponent.js +0 -17
- package/src/runtime/vdom/VDocumentFragment.js +0 -34
- package/src/runtime/vdom/VElement.js +0 -375
- package/src/runtime/vdom/VFragment.js +0 -26
- package/src/runtime/vdom/VNode.js +0 -100
- package/src/runtime/vdom/VText.js +0 -25
- package/src/runtime/vdom/helpers/attrs.js +0 -62
- package/src/runtime/vdom/helpers/const-element.js +0 -25
- package/src/runtime/vdom/helpers/merge-attrs.js +0 -16
- package/src/runtime/vdom/hot-reload.js +0 -115
- package/src/runtime/vdom/index.js +0 -30
- package/src/runtime/vdom/is-text-only.js +0 -10
- package/src/runtime/vdom/marko-namespace.js +0 -3
- package/src/runtime/vdom/morphdom/fragment.js +0 -95
- package/src/runtime/vdom/morphdom/helpers.js +0 -42
- package/src/runtime/vdom/morphdom/index.js +0 -741
- package/src/runtime/vdom/parse-html.js +0 -18
- package/src/runtime/vdom/vdom.js +0 -88
- package/src/taglib/index.js +0 -51
- package/src/translator/cdata/index.js +0 -15
- package/src/translator/cdata/index[html].js +0 -15
- package/src/translator/cdata/index[vdom].js +0 -12
- package/src/translator/class.js +0 -65
- package/src/translator/comment/index.js +0 -15
- package/src/translator/comment/index[html].js +0 -17
- package/src/translator/comment/index[vdom].js +0 -3
- package/src/translator/declaration/index.js +0 -15
- package/src/translator/declaration/index[html].js +0 -12
- package/src/translator/declaration/index[vdom].js +0 -3
- package/src/translator/document-type/index.js +0 -15
- package/src/translator/document-type/index[html].js +0 -12
- package/src/translator/document-type/index[vdom].js +0 -3
- package/src/translator/index.js +0 -551
- package/src/translator/placeholder/index.js +0 -15
- package/src/translator/placeholder/index[html].js +0 -93
- package/src/translator/placeholder/index[vdom].js +0 -22
- package/src/translator/scriptlet.js +0 -4
- package/src/translator/tag/attribute/directives/class.js +0 -42
- package/src/translator/tag/attribute/directives/index.js +0 -15
- package/src/translator/tag/attribute/directives/no-update-body-if.js +0 -15
- package/src/translator/tag/attribute/directives/no-update-body.js +0 -10
- package/src/translator/tag/attribute/directives/no-update-if.js +0 -12
- package/src/translator/tag/attribute/directives/no-update.js +0 -48
- package/src/translator/tag/attribute/directives/style.js +0 -42
- package/src/translator/tag/attribute/index.js +0 -150
- package/src/translator/tag/attribute/modifiers/index.js +0 -7
- package/src/translator/tag/attribute/modifiers/no-update.js +0 -14
- package/src/translator/tag/attribute/modifiers/scoped.js +0 -23
- package/src/translator/tag/attribute-tag.js +0 -149
- package/src/translator/tag/custom-tag.js +0 -146
- package/src/translator/tag/dynamic-tag.js +0 -74
- package/src/translator/tag/index.js +0 -287
- package/src/translator/tag/macro-tag.js +0 -7
- package/src/translator/tag/native-tag.js +0 -27
- package/src/translator/tag/native-tag[html]/attributes.js +0 -151
- package/src/translator/tag/native-tag[html]/index.js +0 -221
- package/src/translator/tag/native-tag[vdom]/attributes.js +0 -105
- package/src/translator/tag/native-tag[vdom]/index.js +0 -189
- package/src/translator/tag/util.js +0 -246
- package/src/translator/taglib/core/conditional/translate-else-if.js +0 -20
- package/src/translator/taglib/core/conditional/translate-else.js +0 -20
- package/src/translator/taglib/core/conditional/translate-if.js +0 -8
- package/src/translator/taglib/core/conditional/util.js +0 -41
- package/src/translator/taglib/core/index.js +0 -474
- package/src/translator/taglib/core/macro/parse.js +0 -17
- package/src/translator/taglib/core/macro/translate.js +0 -48
- package/src/translator/taglib/core/parse-class.js +0 -79
- package/src/translator/taglib/core/parse-export.js +0 -14
- package/src/translator/taglib/core/parse-import.js +0 -14
- package/src/translator/taglib/core/parse-module-code.js +0 -18
- package/src/translator/taglib/core/parse-static.js +0 -18
- package/src/translator/taglib/core/transform-style.js +0 -66
- package/src/translator/taglib/core/translate-await.js +0 -41
- package/src/translator/taglib/core/translate-body.js +0 -17
- package/src/translator/taglib/core/translate-for.js +0 -156
- package/src/translator/taglib/core/translate-html-comment.js +0 -52
- package/src/translator/taglib/core/translate-include-content.js +0 -53
- package/src/translator/taglib/core/translate-server-only.js +0 -5
- package/src/translator/taglib/core/translate-while.js +0 -32
- package/src/translator/taglib/index.js +0 -7
- package/src/translator/taglib/migrate/all-templates.js +0 -46
- package/src/translator/taglib/migrate/index.js +0 -5
- package/src/translator/text/index.js +0 -10
- package/src/translator/text/index[html].js +0 -12
- package/src/translator/text/index[vdom].js +0 -20
- package/src/translator/util/add-dependencies.js +0 -329
- package/src/translator/util/escape-regexp.js +0 -4
- package/src/translator/util/get-component-files.js +0 -86
- package/src/translator/util/html-out-write.js +0 -15
- package/src/translator/util/key-manager.js +0 -176
- package/src/translator/util/optimize-html-writes.js +0 -52
- package/src/translator/util/optimize-vdom-create.js +0 -164
- package/src/translator/util/plugin-hooks.js +0 -22
- package/src/translator/util/runtime-flags.js +0 -3
- package/src/translator/util/vdom-out-write.js +0 -10
- package/src/translator/util/with-previous-location.js +0 -6
- package/tags-html.d.ts +0 -3855
- package/translator/index.d.ts +0 -7
- package/translator/package.json +0 -5
@@ -0,0 +1,2089 @@
|
|
1
|
+
// src/common/attr-tag.ts
|
2
|
+
var empty = [];
|
3
|
+
var rest = true ? Symbol("Attribute Tag") : Symbol();
|
4
|
+
function attrTag(attrs2) {
|
5
|
+
attrs2[Symbol.iterator] = attrTagIterator;
|
6
|
+
attrs2[rest] = empty;
|
7
|
+
return attrs2;
|
8
|
+
}
|
9
|
+
function attrTags(first, attrs2) {
|
10
|
+
if (first) {
|
11
|
+
if (first[rest] === empty) {
|
12
|
+
first[rest] = [attrs2];
|
13
|
+
} else {
|
14
|
+
first[rest].push(attrs2);
|
15
|
+
}
|
16
|
+
return first;
|
17
|
+
}
|
18
|
+
return attrTag(attrs2);
|
19
|
+
}
|
20
|
+
function* attrTagIterator() {
|
21
|
+
yield this;
|
22
|
+
yield* this[rest];
|
23
|
+
}
|
24
|
+
|
25
|
+
// src/common/for.ts
|
26
|
+
function forIn(obj, cb) {
|
27
|
+
for (const key in obj) {
|
28
|
+
cb(key, obj[key]);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
function forOf(list, cb) {
|
32
|
+
if (list) {
|
33
|
+
let i = 0;
|
34
|
+
for (const item of list) {
|
35
|
+
cb(item, i++);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
function forTo(to, from, step, cb) {
|
40
|
+
const start = from || 0;
|
41
|
+
const delta = step || 1;
|
42
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
|
43
|
+
cb(start + i * delta);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
// src/dom/schedule.ts
|
48
|
+
var runTask;
|
49
|
+
var port2 = /* @__PURE__ */ (() => {
|
50
|
+
const { port1, port2: port22 } = new MessageChannel();
|
51
|
+
port1.onmessage = () => {
|
52
|
+
isScheduled = false;
|
53
|
+
if (true) {
|
54
|
+
const run2 = runTask;
|
55
|
+
runTask = void 0;
|
56
|
+
run2();
|
57
|
+
} else {
|
58
|
+
run();
|
59
|
+
}
|
60
|
+
};
|
61
|
+
return port22;
|
62
|
+
})();
|
63
|
+
var isScheduled;
|
64
|
+
function schedule() {
|
65
|
+
if (!isScheduled) {
|
66
|
+
if (true) {
|
67
|
+
if (console.createTask) {
|
68
|
+
const task = console.createTask("queue");
|
69
|
+
runTask = () => task.run(run);
|
70
|
+
} else {
|
71
|
+
runTask = run;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
isScheduled = true;
|
75
|
+
queueMicrotask(flushAndWaitFrame);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
function flushAndWaitFrame() {
|
79
|
+
if (true) {
|
80
|
+
runTask();
|
81
|
+
} else {
|
82
|
+
run();
|
83
|
+
}
|
84
|
+
requestAnimationFrame(triggerMacroTask);
|
85
|
+
}
|
86
|
+
function triggerMacroTask() {
|
87
|
+
port2.postMessage(0);
|
88
|
+
}
|
89
|
+
|
90
|
+
// src/common/meta.ts
|
91
|
+
var DEFAULT_RUNTIME_ID = "M";
|
92
|
+
var DEFAULT_RENDER_ID = "_";
|
93
|
+
|
94
|
+
// src/dom/scope.ts
|
95
|
+
var debugID = 0;
|
96
|
+
function createScope($global) {
|
97
|
+
const scope = {
|
98
|
+
___client: 1,
|
99
|
+
$global
|
100
|
+
};
|
101
|
+
if (true) {
|
102
|
+
scope.___debugId = debugID++;
|
103
|
+
}
|
104
|
+
return scope;
|
105
|
+
}
|
106
|
+
var emptyScope = createScope({});
|
107
|
+
function getEmptyScope(marker) {
|
108
|
+
emptyScope.___startNode = emptyScope.___endNode = marker;
|
109
|
+
return emptyScope;
|
110
|
+
}
|
111
|
+
function destroyScope(scope) {
|
112
|
+
_destroyScope(scope);
|
113
|
+
scope.___cleanupOwner?.___cleanup?.delete(scope);
|
114
|
+
const closureSignals = scope.___renderer?.___closureSignals;
|
115
|
+
if (closureSignals) {
|
116
|
+
for (const signal of closureSignals) {
|
117
|
+
signal.___unsubscribe?.(scope);
|
118
|
+
}
|
119
|
+
}
|
120
|
+
return scope;
|
121
|
+
}
|
122
|
+
function _destroyScope(scope) {
|
123
|
+
scope.___cleanup?.forEach(_destroyScope);
|
124
|
+
const controllers = scope.___abortControllers;
|
125
|
+
if (controllers) {
|
126
|
+
for (const ctrl of controllers.values()) {
|
127
|
+
ctrl.abort();
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
function onDestroy(scope) {
|
132
|
+
let parentScope = scope.___cleanupOwner;
|
133
|
+
while (parentScope && !parentScope.___cleanup?.has(scope)) {
|
134
|
+
(parentScope.___cleanup ||= /* @__PURE__ */ new Set()).add(scope);
|
135
|
+
scope = parentScope;
|
136
|
+
parentScope = scope.___cleanupOwner;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
function removeAndDestroyScope(scope) {
|
140
|
+
destroyScope(scope);
|
141
|
+
let current = scope.___startNode;
|
142
|
+
const stop = scope.___endNode.nextSibling;
|
143
|
+
while (current !== stop) {
|
144
|
+
const next = current.nextSibling;
|
145
|
+
current.remove();
|
146
|
+
current = next;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
function insertBefore(scope, parent, nextSibling) {
|
150
|
+
let current = scope.___startNode;
|
151
|
+
const stop = scope.___endNode.nextSibling;
|
152
|
+
while (current !== stop) {
|
153
|
+
const next = current.nextSibling;
|
154
|
+
parent.insertBefore(current, nextSibling);
|
155
|
+
current = next;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
// src/dom/resume.ts
|
160
|
+
var registeredValues = {};
|
161
|
+
var Render = class {
|
162
|
+
___scopeStack = [];
|
163
|
+
___scopeLookup = {};
|
164
|
+
___serializeContext = {
|
165
|
+
_: registeredValues
|
166
|
+
};
|
167
|
+
constructor(renders, runtimeId, renderId) {
|
168
|
+
this.___renders = renders;
|
169
|
+
this.___runtimeId = runtimeId;
|
170
|
+
this.___renderId = renderId;
|
171
|
+
this.___data = renders[renderId];
|
172
|
+
this.___resume();
|
173
|
+
}
|
174
|
+
w() {
|
175
|
+
this.___data.w();
|
176
|
+
this.___resume();
|
177
|
+
}
|
178
|
+
___resume() {
|
179
|
+
const data2 = this.___data;
|
180
|
+
const serializeContext = this.___serializeContext;
|
181
|
+
const scopeLookup = this.___scopeLookup;
|
182
|
+
const visits = data2.v;
|
183
|
+
const cleanupOwners = /* @__PURE__ */ new Map();
|
184
|
+
if (visits.length) {
|
185
|
+
const commentPrefix = data2.i;
|
186
|
+
const commentPrefixLen = commentPrefix.length;
|
187
|
+
const cleanupMarkers = /* @__PURE__ */ new Map();
|
188
|
+
data2.v = [];
|
189
|
+
const sectionEnd = (visit, scopeId = this.___currentScopeId, curNode = visit) => {
|
190
|
+
const scope = scopeLookup[scopeId] ||= {};
|
191
|
+
let endNode = curNode;
|
192
|
+
while ((endNode = endNode.previousSibling).nodeType === 8) ;
|
193
|
+
scope.___endNode = endNode;
|
194
|
+
const startNode = scope.___startNode ||= endNode;
|
195
|
+
let len = cleanupMarkers.size;
|
196
|
+
for (const [markerScopeId, markerNode] of cleanupMarkers) {
|
197
|
+
if (!len--) break;
|
198
|
+
if (markerScopeId !== scopeId && startNode.compareDocumentPosition(markerNode) & 4 && curNode.compareDocumentPosition(markerNode) & 2) {
|
199
|
+
cleanupOwners.set("" + markerScopeId, scopeId);
|
200
|
+
cleanupMarkers.delete(markerScopeId);
|
201
|
+
}
|
202
|
+
}
|
203
|
+
cleanupMarkers.set(scopeId, visit);
|
204
|
+
return scope;
|
205
|
+
};
|
206
|
+
for (const visit of visits) {
|
207
|
+
const commentText = visit.data;
|
208
|
+
const token = commentText[commentPrefixLen];
|
209
|
+
const scopeId = parseInt(commentText.slice(commentPrefixLen + 1));
|
210
|
+
const scope = scopeLookup[scopeId] ||= {};
|
211
|
+
const dataIndex = commentText.indexOf(" ") + 1;
|
212
|
+
const data3 = dataIndex ? commentText.slice(dataIndex) : "";
|
213
|
+
if (token === "*" /* Node */) {
|
214
|
+
scope[data3] = visit.previousSibling;
|
215
|
+
} else if (token === "$" /* Cleanup */) {
|
216
|
+
cleanupMarkers.set(scopeId, visit);
|
217
|
+
} else if (token === "[" /* SectionStart */) {
|
218
|
+
if (this.___currentScopeId) {
|
219
|
+
if (data3) {
|
220
|
+
sectionEnd(visit);
|
221
|
+
}
|
222
|
+
this.___scopeStack.push(this.___currentScopeId);
|
223
|
+
}
|
224
|
+
this.___currentScopeId = scopeId;
|
225
|
+
scope.___startNode = visit;
|
226
|
+
} else if (token === "]" /* SectionEnd */) {
|
227
|
+
scope[data3] = visit;
|
228
|
+
if (scopeId < this.___currentScopeId) {
|
229
|
+
const currParent = visit.parentNode;
|
230
|
+
const startNode = sectionEnd(visit).___startNode;
|
231
|
+
if (currParent && currParent !== startNode.parentNode) {
|
232
|
+
currParent.prepend(startNode);
|
233
|
+
}
|
234
|
+
this.___currentScopeId = this.___scopeStack.pop();
|
235
|
+
}
|
236
|
+
} else if (token === "|" /* SectionSingleNodesEnd */) {
|
237
|
+
scope[true ? data3.slice(0, data3.indexOf(" ")) : parseInt(data3)] = visit;
|
238
|
+
const childScopeIds = JSON.parse(
|
239
|
+
"[" + data3.slice(data3.indexOf(" ") + 1) + "]"
|
240
|
+
);
|
241
|
+
let curNode = visit;
|
242
|
+
for (let i = childScopeIds.length - 1; i >= 0; i--) {
|
243
|
+
curNode = sectionEnd(visit, childScopeIds[i], curNode).___endNode;
|
244
|
+
}
|
245
|
+
}
|
246
|
+
}
|
247
|
+
}
|
248
|
+
const resumes = data2.r;
|
249
|
+
if (resumes) {
|
250
|
+
data2.r = [];
|
251
|
+
const len = resumes.length;
|
252
|
+
let i = 0;
|
253
|
+
try {
|
254
|
+
isResuming = true;
|
255
|
+
while (i < len) {
|
256
|
+
const resumeData = resumes[i++];
|
257
|
+
if (typeof resumeData === "function") {
|
258
|
+
const scopes = resumeData(serializeContext);
|
259
|
+
let { $global } = scopeLookup;
|
260
|
+
if (!$global) {
|
261
|
+
scopeLookup.$global = $global = scopes.$ || {};
|
262
|
+
$global.runtimeId = this.___runtimeId;
|
263
|
+
$global.renderId = this.___renderId;
|
264
|
+
}
|
265
|
+
for (const scopeId in scopes) {
|
266
|
+
if (scopeId !== "$") {
|
267
|
+
const scope = scopes[scopeId];
|
268
|
+
const prevScope = scopeLookup[scopeId];
|
269
|
+
scope.$global = $global;
|
270
|
+
if (prevScope !== scope) {
|
271
|
+
scopeLookup[scopeId] = Object.assign(
|
272
|
+
scope,
|
273
|
+
prevScope
|
274
|
+
);
|
275
|
+
}
|
276
|
+
const cleanupOwnerId = cleanupOwners.get(scopeId);
|
277
|
+
if (cleanupOwnerId) {
|
278
|
+
scope.___cleanupOwner = scopes[cleanupOwnerId];
|
279
|
+
onDestroy(scope);
|
280
|
+
}
|
281
|
+
}
|
282
|
+
}
|
283
|
+
} else if (i === len || typeof resumes[i] !== "string") {
|
284
|
+
delete this.___renders[this.___renderId];
|
285
|
+
} else {
|
286
|
+
registeredValues[resumes[i++]](
|
287
|
+
scopeLookup[resumeData],
|
288
|
+
scopeLookup[resumeData]
|
289
|
+
);
|
290
|
+
}
|
291
|
+
}
|
292
|
+
} finally {
|
293
|
+
isResuming = false;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
}
|
297
|
+
};
|
298
|
+
var isResuming = false;
|
299
|
+
function register(id, obj) {
|
300
|
+
registeredValues[id] = obj;
|
301
|
+
return obj;
|
302
|
+
}
|
303
|
+
function registerBoundSignal(id, signal) {
|
304
|
+
registeredValues[id] = (scope) => (valueOrOp) => signal(scope, valueOrOp);
|
305
|
+
return signal;
|
306
|
+
}
|
307
|
+
function getRegisteredWithScope(id, scope) {
|
308
|
+
const val = registeredValues[id];
|
309
|
+
return scope ? val(scope) : val;
|
310
|
+
}
|
311
|
+
function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
312
|
+
if (true) {
|
313
|
+
if (!runtimeId.match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
314
|
+
throw new Error(
|
315
|
+
`Invalid runtimeId: "${runtimeId}". The runtimeId must be a valid JavaScript identifier.`
|
316
|
+
);
|
317
|
+
}
|
318
|
+
}
|
319
|
+
const resumeRender = (renderId) => resumeRender[renderId] = renders[renderId] = new Render(renders, runtimeId, renderId);
|
320
|
+
let renders;
|
321
|
+
if (window[runtimeId]) {
|
322
|
+
setRenders(window[runtimeId]);
|
323
|
+
} else {
|
324
|
+
Object.defineProperty(window, runtimeId, {
|
325
|
+
configurable: true,
|
326
|
+
set: setRenders
|
327
|
+
});
|
328
|
+
}
|
329
|
+
function setRenders(v) {
|
330
|
+
if (true) {
|
331
|
+
if (renders) {
|
332
|
+
throw new Error(
|
333
|
+
"Marko tried to initialize multiple times. It could be that there are multiple instances of Marko running on the page."
|
334
|
+
);
|
335
|
+
}
|
336
|
+
}
|
337
|
+
renders = v;
|
338
|
+
for (const renderId in v) {
|
339
|
+
resumeRender(renderId);
|
340
|
+
}
|
341
|
+
Object.defineProperty(window, runtimeId, {
|
342
|
+
configurable: true,
|
343
|
+
value: resumeRender
|
344
|
+
});
|
345
|
+
}
|
346
|
+
}
|
347
|
+
function registerSubscriber(id, signal) {
|
348
|
+
register(id, signal.___subscribe);
|
349
|
+
return signal;
|
350
|
+
}
|
351
|
+
function nodeRef(id, key) {
|
352
|
+
return register(id, (scope) => () => scope[key]);
|
353
|
+
}
|
354
|
+
|
355
|
+
// src/dom/signals.ts
|
356
|
+
var MARK = true ? Symbol("mark") : {};
|
357
|
+
var CLEAN = true ? Symbol("clean") : {};
|
358
|
+
var DIRTY = true ? Symbol("dirty") : {};
|
359
|
+
function state(valueAccessor, fn, getIntersection) {
|
360
|
+
const valueSignal = value(valueAccessor, fn, getIntersection);
|
361
|
+
const markAccessor = valueAccessor + "#" /* Mark */;
|
362
|
+
const valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
363
|
+
return (scope, valueOrOp, valueChange) => {
|
364
|
+
if (rendering) {
|
365
|
+
const valueIsOp = valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY;
|
366
|
+
valueSignal(
|
367
|
+
scope,
|
368
|
+
valueIsOp || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
369
|
+
);
|
370
|
+
} else if (scope[valueChangeAccessor]) {
|
371
|
+
scope[valueChangeAccessor](valueOrOp);
|
372
|
+
} else {
|
373
|
+
queueSource(scope, valueSignal, valueOrOp);
|
374
|
+
}
|
375
|
+
return valueOrOp;
|
376
|
+
};
|
377
|
+
}
|
378
|
+
function value(valueAccessor, fn, getIntersection) {
|
379
|
+
const markAccessor = valueAccessor + "#" /* Mark */;
|
380
|
+
let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
381
|
+
return (scope, valueOrOp) => {
|
382
|
+
if (valueOrOp === MARK) {
|
383
|
+
if ((scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1) {
|
384
|
+
intersection2?.(scope, MARK);
|
385
|
+
}
|
386
|
+
} else if (valueOrOp !== DIRTY) {
|
387
|
+
const existing = scope[markAccessor] !== void 0;
|
388
|
+
if ((scope[markAccessor] ||= 1) === 1) {
|
389
|
+
if (valueOrOp === CLEAN || existing && scope[valueAccessor] === valueOrOp) {
|
390
|
+
intersection2?.(scope, CLEAN);
|
391
|
+
} else {
|
392
|
+
scope[valueAccessor] = valueOrOp;
|
393
|
+
fn && fn(scope, valueOrOp);
|
394
|
+
intersection2?.(scope, DIRTY);
|
395
|
+
}
|
396
|
+
}
|
397
|
+
scope[markAccessor]--;
|
398
|
+
}
|
399
|
+
};
|
400
|
+
}
|
401
|
+
var accessorId = 0;
|
402
|
+
function intersection(count, fn, getIntersection) {
|
403
|
+
const dirtyAccessor = "?" /* Dynamic */ + accessorId++;
|
404
|
+
const markAccessor = dirtyAccessor + "#" /* Mark */;
|
405
|
+
let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
406
|
+
return (scope, op) => {
|
407
|
+
if (op === MARK) {
|
408
|
+
if ((scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1) {
|
409
|
+
intersection2?.(scope, MARK);
|
410
|
+
}
|
411
|
+
} else if (scope[markAccessor] === void 0) {
|
412
|
+
scope[markAccessor] = count - 1;
|
413
|
+
scope[dirtyAccessor] = true;
|
414
|
+
} else if (--scope[markAccessor] === 0) {
|
415
|
+
if (op === DIRTY || scope[dirtyAccessor]) {
|
416
|
+
scope[dirtyAccessor] = false;
|
417
|
+
fn(scope, 0);
|
418
|
+
intersection2?.(scope, DIRTY);
|
419
|
+
} else {
|
420
|
+
intersection2?.(scope, CLEAN);
|
421
|
+
}
|
422
|
+
} else {
|
423
|
+
scope[dirtyAccessor] ||= op === DIRTY;
|
424
|
+
}
|
425
|
+
};
|
426
|
+
}
|
427
|
+
var defaultGetOwnerScope = (scope) => scope._;
|
428
|
+
function closure(ownerValueAccessor, fn, getOwnerScope = defaultGetOwnerScope, getIntersection) {
|
429
|
+
const dirtyAccessor = "?" /* Dynamic */ + accessorId++;
|
430
|
+
const markAccessor = dirtyAccessor + 1;
|
431
|
+
const getOwnerValueAccessor = typeof ownerValueAccessor === "function" ? ownerValueAccessor : () => ownerValueAccessor;
|
432
|
+
let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
433
|
+
return (scope, op) => {
|
434
|
+
if (op === MARK) {
|
435
|
+
if ((scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1) {
|
436
|
+
intersection2?.(scope, MARK);
|
437
|
+
}
|
438
|
+
} else {
|
439
|
+
let ownerScope, ownerValueAccessor2;
|
440
|
+
if (scope[markAccessor] === void 0) {
|
441
|
+
ownerScope = getOwnerScope(scope);
|
442
|
+
ownerValueAccessor2 = getOwnerValueAccessor(scope);
|
443
|
+
const ownerMark = ownerScope[ownerValueAccessor2 + "#" /* Mark */];
|
444
|
+
const ownerHasRun = ownerMark === void 0 ? !ownerScope.___client : ownerMark === 0;
|
445
|
+
scope[markAccessor] = ownerHasRun ? 1 : 2;
|
446
|
+
op = DIRTY;
|
447
|
+
}
|
448
|
+
if (--scope[markAccessor] === 0) {
|
449
|
+
if (op === DIRTY || scope[dirtyAccessor]) {
|
450
|
+
scope[dirtyAccessor] = false;
|
451
|
+
ownerScope ||= getOwnerScope(scope);
|
452
|
+
ownerValueAccessor2 ||= getOwnerValueAccessor(scope);
|
453
|
+
fn && fn(scope, ownerScope[ownerValueAccessor2]);
|
454
|
+
intersection2?.(scope, DIRTY);
|
455
|
+
} else {
|
456
|
+
intersection2?.(scope, CLEAN);
|
457
|
+
}
|
458
|
+
} else {
|
459
|
+
scope[dirtyAccessor] ||= op === DIRTY;
|
460
|
+
}
|
461
|
+
}
|
462
|
+
};
|
463
|
+
}
|
464
|
+
function dynamicClosure(ownerValueAccessor, fn, getOwnerScope = defaultGetOwnerScope, getIntersection) {
|
465
|
+
const getOwnerValueAccessor = typeof ownerValueAccessor === "function" ? ownerValueAccessor : () => ownerValueAccessor;
|
466
|
+
const signalFn = closure(
|
467
|
+
getOwnerValueAccessor,
|
468
|
+
fn,
|
469
|
+
getOwnerScope,
|
470
|
+
getIntersection
|
471
|
+
);
|
472
|
+
const subscribeFns = /* @__PURE__ */ new WeakMap();
|
473
|
+
signalFn.___subscribe = (scope) => {
|
474
|
+
const subscribeFn = (value2) => signalFn(scope, value2);
|
475
|
+
const ownerScope = getOwnerScope(scope);
|
476
|
+
const providerSubscriptionsAccessor = getOwnerValueAccessor(scope) + "*" /* Subscribers */;
|
477
|
+
subscribeFns.set(scope, subscribeFn);
|
478
|
+
(ownerScope[providerSubscriptionsAccessor] ||= /* @__PURE__ */ new Set()).add(subscribeFn);
|
479
|
+
};
|
480
|
+
signalFn.___unsubscribe = (scope) => {
|
481
|
+
const ownerScope = getOwnerScope(scope);
|
482
|
+
const providerSubscriptionsAccessor = getOwnerValueAccessor(scope) + "*" /* Subscribers */;
|
483
|
+
ownerScope[providerSubscriptionsAccessor]?.delete(subscribeFns.get(scope));
|
484
|
+
subscribeFns.delete(scope);
|
485
|
+
};
|
486
|
+
return signalFn;
|
487
|
+
}
|
488
|
+
function childClosures(closureSignals, childAccessor) {
|
489
|
+
const signal = (scope, op) => {
|
490
|
+
const childScope = scope[childAccessor];
|
491
|
+
for (const closureSignal of closureSignals) {
|
492
|
+
closureSignal(childScope, op);
|
493
|
+
}
|
494
|
+
};
|
495
|
+
signal.___subscribe = (scope) => {
|
496
|
+
const childScope = scope[childAccessor];
|
497
|
+
for (const closureSignal of closureSignals) {
|
498
|
+
closureSignal.___subscribe?.(childScope);
|
499
|
+
}
|
500
|
+
};
|
501
|
+
signal.___unsubscribe = (scope) => {
|
502
|
+
const childScope = scope[childAccessor];
|
503
|
+
for (const closureSignal of closureSignals) {
|
504
|
+
closureSignal.___unsubscribe?.(childScope);
|
505
|
+
}
|
506
|
+
};
|
507
|
+
return signal;
|
508
|
+
}
|
509
|
+
function dynamicSubscribers(valueAccessor) {
|
510
|
+
const subscribersAccessor = valueAccessor + "*" /* Subscribers */;
|
511
|
+
return (scope, op) => {
|
512
|
+
const subscribers = scope[subscribersAccessor];
|
513
|
+
if (subscribers) {
|
514
|
+
for (const subscriber of subscribers) {
|
515
|
+
subscriber(op);
|
516
|
+
}
|
517
|
+
}
|
518
|
+
};
|
519
|
+
}
|
520
|
+
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
521
|
+
scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
|
522
|
+
}
|
523
|
+
var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp);
|
524
|
+
function setTagVarChange(scope, changeHandler) {
|
525
|
+
scope["@" /* TagVariableChange */] = changeHandler;
|
526
|
+
}
|
527
|
+
var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2);
|
528
|
+
var renderBodyClosures = (renderBody, childScope, op) => {
|
529
|
+
const signals = renderBody?.___closureSignals;
|
530
|
+
if (signals) {
|
531
|
+
for (const signal of signals) {
|
532
|
+
signal(childScope, op);
|
533
|
+
}
|
534
|
+
}
|
535
|
+
};
|
536
|
+
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
537
|
+
function nextTagId({ $global }) {
|
538
|
+
const id = tagIdsByGlobal.get($global) || 0;
|
539
|
+
tagIdsByGlobal.set($global, id + 1);
|
540
|
+
return "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
541
|
+
}
|
542
|
+
function inChild(childAccessor, signal) {
|
543
|
+
return (scope, valueOrOp) => {
|
544
|
+
signal(scope[childAccessor], valueOrOp);
|
545
|
+
};
|
546
|
+
}
|
547
|
+
function intersections(signals) {
|
548
|
+
return (scope, op) => {
|
549
|
+
for (const signal of signals) {
|
550
|
+
signal(scope, op);
|
551
|
+
}
|
552
|
+
};
|
553
|
+
}
|
554
|
+
function effect(id, fn) {
|
555
|
+
register(id, fn);
|
556
|
+
return (scope) => {
|
557
|
+
queueEffect(scope, fn);
|
558
|
+
};
|
559
|
+
}
|
560
|
+
|
561
|
+
// src/dom/queue.ts
|
562
|
+
var pendingSignals = [];
|
563
|
+
var pendingEffects = [];
|
564
|
+
var rendering = false;
|
565
|
+
function queueSource(scope, signal, value2) {
|
566
|
+
schedule();
|
567
|
+
rendering = true;
|
568
|
+
signal(scope, MARK);
|
569
|
+
rendering = false;
|
570
|
+
pendingSignals.push(scope, signal, value2);
|
571
|
+
return value2;
|
572
|
+
}
|
573
|
+
function queueEffect(scope, fn) {
|
574
|
+
pendingEffects.push(scope, fn);
|
575
|
+
}
|
576
|
+
function run() {
|
577
|
+
const signals = pendingSignals;
|
578
|
+
const effects = pendingEffects;
|
579
|
+
try {
|
580
|
+
rendering = true;
|
581
|
+
pendingSignals = [];
|
582
|
+
runSignals(signals);
|
583
|
+
} finally {
|
584
|
+
rendering = false;
|
585
|
+
}
|
586
|
+
pendingEffects = [];
|
587
|
+
runEffects(effects);
|
588
|
+
}
|
589
|
+
function prepareEffects(fn) {
|
590
|
+
const prevSignals = pendingSignals;
|
591
|
+
const prevEffects = pendingEffects;
|
592
|
+
const preparedEffects = pendingEffects = [];
|
593
|
+
const preparedSignals = pendingSignals = [];
|
594
|
+
try {
|
595
|
+
rendering = true;
|
596
|
+
fn();
|
597
|
+
pendingSignals = prevSignals;
|
598
|
+
runSignals(preparedSignals);
|
599
|
+
} finally {
|
600
|
+
rendering = false;
|
601
|
+
pendingSignals = prevSignals;
|
602
|
+
pendingEffects = prevEffects;
|
603
|
+
}
|
604
|
+
return preparedEffects;
|
605
|
+
}
|
606
|
+
function runEffects(effects = pendingEffects) {
|
607
|
+
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
608
|
+
const scope = effects[i];
|
609
|
+
const fn = effects[i + 1];
|
610
|
+
fn(scope, scope);
|
611
|
+
}
|
612
|
+
}
|
613
|
+
function runSignals(signals) {
|
614
|
+
for (let i = 0; i < signals.length; i += 3 /* Total */) {
|
615
|
+
const scope = signals[i + 0 /* Scope */];
|
616
|
+
const signal = signals[i + 1 /* Signal */];
|
617
|
+
const value2 = signals[i + 2 /* Value */];
|
618
|
+
signal(scope, value2);
|
619
|
+
}
|
620
|
+
}
|
621
|
+
|
622
|
+
// src/dom/abort-signal.ts
|
623
|
+
function resetAbortSignal(scope, id) {
|
624
|
+
const controllers = scope.___abortControllers;
|
625
|
+
if (controllers) {
|
626
|
+
const ctrl = controllers.get(id);
|
627
|
+
if (ctrl) {
|
628
|
+
queueEffect(null, () => ctrl.abort());
|
629
|
+
controllers.delete(id);
|
630
|
+
}
|
631
|
+
}
|
632
|
+
}
|
633
|
+
function getAbortSignal(scope, id) {
|
634
|
+
const controllers = scope.___abortControllers ||= /* @__PURE__ */ new Map();
|
635
|
+
let controller = controllers.get(id);
|
636
|
+
if (!controller) {
|
637
|
+
onDestroy(scope);
|
638
|
+
controllers.set(id, controller = new AbortController());
|
639
|
+
}
|
640
|
+
return controller.signal;
|
641
|
+
}
|
642
|
+
|
643
|
+
// src/common/compat-meta.ts
|
644
|
+
var prefix = true ? "$compat_" : "$C_";
|
645
|
+
var RENDERER_REGISTER_ID = prefix + (true ? "renderer" : "r");
|
646
|
+
var SET_SCOPE_REGISTER_ID = prefix + (true ? "setScope" : "s");
|
647
|
+
|
648
|
+
// src/common/helpers.ts
|
649
|
+
function classValue(value2) {
|
650
|
+
return toDelimitedString(value2, " ", stringifyClassObject);
|
651
|
+
}
|
652
|
+
function stringifyClassObject(name, value2) {
|
653
|
+
return value2 ? name : "";
|
654
|
+
}
|
655
|
+
function styleValue(value2) {
|
656
|
+
return toDelimitedString(value2, ";", stringifyStyleObject);
|
657
|
+
}
|
658
|
+
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
659
|
+
function stringifyStyleObject(name, value2) {
|
660
|
+
return value2 || value2 === 0 ? `${name}:${typeof value2 === "number" && value2 && !NON_DIMENSIONAL.test(name) ? value2 + "px" : value2}` : "";
|
661
|
+
}
|
662
|
+
function toDelimitedString(val, delimiter, stringify) {
|
663
|
+
switch (typeof val) {
|
664
|
+
case "string":
|
665
|
+
return val;
|
666
|
+
case "object":
|
667
|
+
if (val !== null) {
|
668
|
+
let result = "";
|
669
|
+
let curDelimiter = "";
|
670
|
+
if (Array.isArray(val)) {
|
671
|
+
for (const v of val) {
|
672
|
+
const part = toDelimitedString(v, delimiter, stringify);
|
673
|
+
if (part !== "") {
|
674
|
+
result += curDelimiter + part;
|
675
|
+
curDelimiter = delimiter;
|
676
|
+
}
|
677
|
+
}
|
678
|
+
} else {
|
679
|
+
for (const name in val) {
|
680
|
+
const v = val[name];
|
681
|
+
const part = stringify(name, v);
|
682
|
+
if (part !== "") {
|
683
|
+
result += curDelimiter + part;
|
684
|
+
curDelimiter = delimiter;
|
685
|
+
}
|
686
|
+
}
|
687
|
+
}
|
688
|
+
return result;
|
689
|
+
}
|
690
|
+
}
|
691
|
+
return "";
|
692
|
+
}
|
693
|
+
function isEventHandler(name) {
|
694
|
+
return /^on[A-Z-]/.test(name);
|
695
|
+
}
|
696
|
+
function getEventHandlerName(name) {
|
697
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
698
|
+
}
|
699
|
+
function normalizeDynamicRenderer(value2) {
|
700
|
+
if (value2) return value2.renderBody || value2.default || value2;
|
701
|
+
}
|
702
|
+
|
703
|
+
// src/dom/reconcile.ts
|
704
|
+
var WRONG_POS = 2147483647;
|
705
|
+
function reconcile(parent, oldScopes, newScopes, afterReference) {
|
706
|
+
let oldStart = 0;
|
707
|
+
let newStart = 0;
|
708
|
+
let oldEnd = oldScopes.length - 1;
|
709
|
+
let newEnd = newScopes.length - 1;
|
710
|
+
let oldStartScope = oldScopes[oldStart];
|
711
|
+
let newStartScope = newScopes[newStart];
|
712
|
+
let oldEndScope = oldScopes[oldEnd];
|
713
|
+
let newEndScope = newScopes[newEnd];
|
714
|
+
let i;
|
715
|
+
let j;
|
716
|
+
let k;
|
717
|
+
let nextSibling;
|
718
|
+
let oldScope;
|
719
|
+
let newScope;
|
720
|
+
outer: {
|
721
|
+
while (oldStartScope === newStartScope) {
|
722
|
+
++oldStart;
|
723
|
+
++newStart;
|
724
|
+
if (oldStart > oldEnd || newStart > newEnd) {
|
725
|
+
break outer;
|
726
|
+
}
|
727
|
+
oldStartScope = oldScopes[oldStart];
|
728
|
+
newStartScope = newScopes[newStart];
|
729
|
+
}
|
730
|
+
while (oldEndScope === newEndScope) {
|
731
|
+
--oldEnd;
|
732
|
+
--newEnd;
|
733
|
+
if (oldStart > oldEnd || newStart > newEnd) {
|
734
|
+
break outer;
|
735
|
+
}
|
736
|
+
oldEndScope = oldScopes[oldEnd];
|
737
|
+
newEndScope = newScopes[newEnd];
|
738
|
+
}
|
739
|
+
}
|
740
|
+
if (oldStart > oldEnd) {
|
741
|
+
if (newStart <= newEnd) {
|
742
|
+
k = newEnd + 1;
|
743
|
+
nextSibling = k < newScopes.length ? newScopes[k].___startNode : afterReference;
|
744
|
+
do {
|
745
|
+
insertBefore(newScopes[newStart++], parent, nextSibling);
|
746
|
+
} while (newStart <= newEnd);
|
747
|
+
}
|
748
|
+
} else if (newStart > newEnd) {
|
749
|
+
do {
|
750
|
+
removeAndDestroyScope(oldScopes[oldStart++]);
|
751
|
+
} while (oldStart <= oldEnd);
|
752
|
+
} else {
|
753
|
+
const oldLength = oldEnd - oldStart + 1;
|
754
|
+
const newLength = newEnd - newStart + 1;
|
755
|
+
const aNullable = oldScopes;
|
756
|
+
const sources = new Array(newLength);
|
757
|
+
for (i = 0; i < newLength; ++i) {
|
758
|
+
sources[i] = -1;
|
759
|
+
}
|
760
|
+
let pos = 0;
|
761
|
+
let synced = 0;
|
762
|
+
const keyIndex = /* @__PURE__ */ new Map();
|
763
|
+
for (j = newStart; j <= newEnd; ++j) {
|
764
|
+
keyIndex.set(newScopes[j], j);
|
765
|
+
}
|
766
|
+
for (i = oldStart; i <= oldEnd && synced < newLength; ++i) {
|
767
|
+
oldScope = oldScopes[i];
|
768
|
+
j = keyIndex.get(oldScope);
|
769
|
+
if (j !== void 0) {
|
770
|
+
pos = pos > j ? WRONG_POS : j;
|
771
|
+
++synced;
|
772
|
+
newScope = newScopes[j];
|
773
|
+
sources[j - newStart] = i;
|
774
|
+
aNullable[i] = null;
|
775
|
+
}
|
776
|
+
}
|
777
|
+
if (oldLength === oldScopes.length && synced === 0) {
|
778
|
+
for (; newStart < newLength; ++newStart) {
|
779
|
+
insertBefore(newScopes[newStart], parent, afterReference);
|
780
|
+
}
|
781
|
+
for (; oldStart < oldLength; ++oldStart) {
|
782
|
+
removeAndDestroyScope(oldScopes[oldStart]);
|
783
|
+
}
|
784
|
+
} else {
|
785
|
+
i = oldLength - synced;
|
786
|
+
while (i > 0) {
|
787
|
+
oldScope = aNullable[oldStart++];
|
788
|
+
if (oldScope !== null) {
|
789
|
+
removeAndDestroyScope(oldScope);
|
790
|
+
i--;
|
791
|
+
}
|
792
|
+
}
|
793
|
+
if (pos === WRONG_POS) {
|
794
|
+
const seq = longestIncreasingSubsequence(sources);
|
795
|
+
j = seq.length - 1;
|
796
|
+
k = newScopes.length;
|
797
|
+
for (i = newLength - 1; i >= 0; --i) {
|
798
|
+
if (sources[i] === -1) {
|
799
|
+
pos = i + newStart;
|
800
|
+
newScope = newScopes[pos++];
|
801
|
+
nextSibling = pos < k ? newScopes[pos].___startNode : afterReference;
|
802
|
+
insertBefore(newScope, parent, nextSibling);
|
803
|
+
} else {
|
804
|
+
if (j < 0 || i !== seq[j]) {
|
805
|
+
pos = i + newStart;
|
806
|
+
newScope = newScopes[pos++];
|
807
|
+
nextSibling = pos < k ? newScopes[pos].___startNode : afterReference;
|
808
|
+
insertBefore(newScope, parent, nextSibling);
|
809
|
+
} else {
|
810
|
+
--j;
|
811
|
+
}
|
812
|
+
}
|
813
|
+
}
|
814
|
+
} else if (synced !== newLength) {
|
815
|
+
k = newScopes.length;
|
816
|
+
for (i = newLength - 1; i >= 0; --i) {
|
817
|
+
if (sources[i] === -1) {
|
818
|
+
pos = i + newStart;
|
819
|
+
newScope = newScopes[pos++];
|
820
|
+
nextSibling = pos < k ? newScopes[pos].___startNode : afterReference;
|
821
|
+
insertBefore(newScope, parent, nextSibling);
|
822
|
+
}
|
823
|
+
}
|
824
|
+
}
|
825
|
+
}
|
826
|
+
}
|
827
|
+
}
|
828
|
+
function longestIncreasingSubsequence(a) {
|
829
|
+
const p = a.slice();
|
830
|
+
const result = [];
|
831
|
+
result.push(0);
|
832
|
+
let u;
|
833
|
+
let v;
|
834
|
+
for (let i = 0, il = a.length; i < il; ++i) {
|
835
|
+
if (a[i] === -1) {
|
836
|
+
continue;
|
837
|
+
}
|
838
|
+
const j = result[result.length - 1];
|
839
|
+
if (a[j] < a[i]) {
|
840
|
+
p[i] = j;
|
841
|
+
result.push(i);
|
842
|
+
continue;
|
843
|
+
}
|
844
|
+
u = 0;
|
845
|
+
v = result.length - 1;
|
846
|
+
while (u < v) {
|
847
|
+
const c = (u + v) / 2 | 0;
|
848
|
+
if (a[result[c]] < a[i]) {
|
849
|
+
u = c + 1;
|
850
|
+
} else {
|
851
|
+
v = c;
|
852
|
+
}
|
853
|
+
}
|
854
|
+
if (a[i] < a[result[u]]) {
|
855
|
+
if (u > 0) {
|
856
|
+
p[i] = result[u - 1];
|
857
|
+
}
|
858
|
+
result[u] = i;
|
859
|
+
}
|
860
|
+
}
|
861
|
+
u = result.length;
|
862
|
+
v = result[u - 1];
|
863
|
+
while (u-- > 0) {
|
864
|
+
result[u] = v;
|
865
|
+
v = p[v];
|
866
|
+
}
|
867
|
+
return result;
|
868
|
+
}
|
869
|
+
|
870
|
+
// src/dom/event.ts
|
871
|
+
var elementHandlersByEvent = /* @__PURE__ */ new Map();
|
872
|
+
var defaultDelegator = createDelegator();
|
873
|
+
function on(element, type, handler) {
|
874
|
+
let handlersByElement = elementHandlersByEvent.get(type);
|
875
|
+
if (!handlersByElement) {
|
876
|
+
elementHandlersByEvent.set(type, handlersByElement = /* @__PURE__ */ new WeakMap());
|
877
|
+
}
|
878
|
+
if (!handlersByElement.has(element)) {
|
879
|
+
defaultDelegator(element, type, handleDelegated);
|
880
|
+
}
|
881
|
+
handlersByElement.set(element, handler || void 0);
|
882
|
+
}
|
883
|
+
function createDelegator() {
|
884
|
+
const delegatedEventsByRoot = /* @__PURE__ */ new WeakMap();
|
885
|
+
return function ensureDelegated(node, type, handler) {
|
886
|
+
const root = node.getRootNode();
|
887
|
+
let delegatedEvents = delegatedEventsByRoot.get(root);
|
888
|
+
if (!delegatedEvents) {
|
889
|
+
delegatedEventsByRoot.set(root, delegatedEvents = /* @__PURE__ */ new Set());
|
890
|
+
}
|
891
|
+
if (!delegatedEvents.has(type)) {
|
892
|
+
delegatedEvents.add(type);
|
893
|
+
root.addEventListener(type, handler, true);
|
894
|
+
}
|
895
|
+
};
|
896
|
+
}
|
897
|
+
function handleDelegated(ev) {
|
898
|
+
let target = ev.target;
|
899
|
+
if (target) {
|
900
|
+
const handlersByElement = elementHandlersByEvent.get(ev.type);
|
901
|
+
handlersByElement.get(target)?.(ev, target);
|
902
|
+
if (ev.bubbles) {
|
903
|
+
while ((target = target.parentElement) && !ev.cancelBubble) {
|
904
|
+
handlersByElement.get(target)?.(ev, target);
|
905
|
+
}
|
906
|
+
}
|
907
|
+
}
|
908
|
+
}
|
909
|
+
|
910
|
+
// src/dom/resolve-cursor-position.ts
|
911
|
+
function resolveCursorPosition(updatedValue, initialValue, initialPosition, inputType2) {
|
912
|
+
if (initialPosition !== initialValue.length || // short regex to match input types that delete backwards
|
913
|
+
/kw/.test(inputType2)) {
|
914
|
+
const before = initialValue.slice(0, initialPosition);
|
915
|
+
const after = initialValue.slice(initialPosition);
|
916
|
+
if (updatedValue.startsWith(before)) {
|
917
|
+
return initialPosition;
|
918
|
+
} else if (updatedValue.endsWith(after)) {
|
919
|
+
return updatedValue.length - after.length;
|
920
|
+
} else {
|
921
|
+
const relevantChars = stripSpacesAndPunctuation(before).length;
|
922
|
+
let pos = 0;
|
923
|
+
let relevantIndex = 0;
|
924
|
+
while (relevantIndex < relevantChars) {
|
925
|
+
if (stripSpacesAndPunctuation(updatedValue[pos])) relevantIndex++;
|
926
|
+
pos++;
|
927
|
+
}
|
928
|
+
return pos;
|
929
|
+
}
|
930
|
+
}
|
931
|
+
return -1;
|
932
|
+
}
|
933
|
+
function stripSpacesAndPunctuation(str) {
|
934
|
+
return str.replace(/[^\p{L}\p{N}]/gu, "");
|
935
|
+
}
|
936
|
+
|
937
|
+
// src/dom/controllable.ts
|
938
|
+
function controllable_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
939
|
+
setCheckboxValue(
|
940
|
+
scope,
|
941
|
+
nodeAccessor,
|
942
|
+
0 /* InputChecked */,
|
943
|
+
normalizeBoolProp(checked),
|
944
|
+
checkedChange
|
945
|
+
);
|
946
|
+
}
|
947
|
+
function controllable_input_checked_effect(scope, nodeAccessor) {
|
948
|
+
const el = scope[nodeAccessor];
|
949
|
+
syncControllable(el, "input", hasCheckboxChanged, () => {
|
950
|
+
const checkedChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
951
|
+
if (checkedChange) {
|
952
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
|
953
|
+
checkedChange(el.checked);
|
954
|
+
run();
|
955
|
+
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
956
|
+
el.checked = !el.checked;
|
957
|
+
}
|
958
|
+
}
|
959
|
+
});
|
960
|
+
}
|
961
|
+
function controllable_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value2) {
|
962
|
+
scope[nodeAccessor + ":" /* ControlledValue */] = checkedValue;
|
963
|
+
attr(scope[nodeAccessor], "value", value2);
|
964
|
+
setCheckboxValue(
|
965
|
+
scope,
|
966
|
+
nodeAccessor,
|
967
|
+
1 /* InputCheckedValue */,
|
968
|
+
Array.isArray(checkedValue) ? checkedValue.includes(value2) : checkedValue === value2,
|
969
|
+
checkedValueChange
|
970
|
+
);
|
971
|
+
}
|
972
|
+
function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
973
|
+
const el = scope[nodeAccessor];
|
974
|
+
syncControllable(el, "input", hasCheckboxChanged, () => {
|
975
|
+
const checkedValueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
976
|
+
if (checkedValueChange) {
|
977
|
+
const oldValue = scope[nodeAccessor + ":" /* ControlledValue */];
|
978
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
|
979
|
+
checkedValueChange(
|
980
|
+
Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0
|
981
|
+
);
|
982
|
+
run();
|
983
|
+
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
984
|
+
el.checked = !el.checked;
|
985
|
+
}
|
986
|
+
}
|
987
|
+
});
|
988
|
+
}
|
989
|
+
function controllable_input_value(scope, nodeAccessor, value2, valueChange) {
|
990
|
+
const el = scope[nodeAccessor];
|
991
|
+
const normalizedValue = normalizeStrProp(value2);
|
992
|
+
scope[nodeAccessor + ";" /* ControlledHandler */] = valueChange;
|
993
|
+
if (valueChange) {
|
994
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 0 /* InputChecked */;
|
995
|
+
scope[nodeAccessor + ":" /* ControlledValue */] = value2;
|
996
|
+
if (el.isConnected) {
|
997
|
+
setValueAndUpdateSelection(el, normalizedValue);
|
998
|
+
} else {
|
999
|
+
el.defaultValue = normalizedValue;
|
1000
|
+
}
|
1001
|
+
} else {
|
1002
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */;
|
1003
|
+
el.defaultValue = normalizedValue;
|
1004
|
+
}
|
1005
|
+
}
|
1006
|
+
function controllable_input_value_effect(scope, nodeAccessor) {
|
1007
|
+
const el = scope[nodeAccessor];
|
1008
|
+
if (isResuming) {
|
1009
|
+
scope[nodeAccessor + ":" /* ControlledValue */] = el.defaultValue;
|
1010
|
+
}
|
1011
|
+
syncControllable(el, "input", hasValueChanged, (ev) => {
|
1012
|
+
const valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
1013
|
+
if (valueChange) {
|
1014
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
|
1015
|
+
if (ev) inputType = ev.inputType;
|
1016
|
+
valueChange(el.value);
|
1017
|
+
run();
|
1018
|
+
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
1019
|
+
setValueAndUpdateSelection(
|
1020
|
+
el,
|
1021
|
+
scope[nodeAccessor + ":" /* ControlledValue */]
|
1022
|
+
);
|
1023
|
+
}
|
1024
|
+
inputType = "";
|
1025
|
+
}
|
1026
|
+
});
|
1027
|
+
}
|
1028
|
+
function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
1029
|
+
scope[nodeAccessor + ";" /* ControlledHandler */] = valueChange;
|
1030
|
+
if (valueChange) {
|
1031
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 3 /* SelectValue */;
|
1032
|
+
scope[nodeAccessor + ":" /* ControlledValue */] = value2;
|
1033
|
+
} else {
|
1034
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */;
|
1035
|
+
}
|
1036
|
+
setSelectOptions(
|
1037
|
+
scope[nodeAccessor],
|
1038
|
+
value2,
|
1039
|
+
valueChange
|
1040
|
+
);
|
1041
|
+
}
|
1042
|
+
function controllable_select_value_effect(scope, nodeAccessor) {
|
1043
|
+
const el = scope[nodeAccessor];
|
1044
|
+
syncControllable(el, "input", hasSelectChanged, () => {
|
1045
|
+
const valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
1046
|
+
if (valueChange) {
|
1047
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
|
1048
|
+
valueChange(
|
1049
|
+
Array.isArray(scope[nodeAccessor + ":" /* ControlledValue */]) ? Array.from(el.selectedOptions, toValueProp) : el.value
|
1050
|
+
);
|
1051
|
+
run();
|
1052
|
+
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
1053
|
+
setSelectOptions(
|
1054
|
+
el,
|
1055
|
+
scope[nodeAccessor + ":" /* ControlledValue */],
|
1056
|
+
valueChange
|
1057
|
+
);
|
1058
|
+
}
|
1059
|
+
}
|
1060
|
+
});
|
1061
|
+
}
|
1062
|
+
function setSelectOptions(el, value2, valueChange) {
|
1063
|
+
if (Array.isArray(value2)) {
|
1064
|
+
for (const opt of el.options) {
|
1065
|
+
const selected = value2.includes(opt.value);
|
1066
|
+
if (valueChange) {
|
1067
|
+
opt.selected = selected;
|
1068
|
+
} else {
|
1069
|
+
opt.defaultSelected = selected;
|
1070
|
+
}
|
1071
|
+
}
|
1072
|
+
} else {
|
1073
|
+
const normalizedValue = normalizeStrProp(value2);
|
1074
|
+
if (valueChange) {
|
1075
|
+
el.value = normalizedValue;
|
1076
|
+
} else {
|
1077
|
+
for (const opt of el.options) {
|
1078
|
+
opt.defaultSelected = opt.value === normalizedValue;
|
1079
|
+
}
|
1080
|
+
}
|
1081
|
+
}
|
1082
|
+
}
|
1083
|
+
function controllable_detailsOrDialog_open(scope, nodeAccessor, open, openChange) {
|
1084
|
+
scope[nodeAccessor + ";" /* ControlledHandler */] = openChange;
|
1085
|
+
if (openChange) {
|
1086
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 4 /* DetailsOrDialogOpen */;
|
1087
|
+
} else {
|
1088
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */;
|
1089
|
+
}
|
1090
|
+
scope[nodeAccessor].open = normalizeBoolProp(open);
|
1091
|
+
}
|
1092
|
+
function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
1093
|
+
const el = scope[nodeAccessor];
|
1094
|
+
syncControllable(
|
1095
|
+
el,
|
1096
|
+
el.tagName === "DIALOG" ? "close" : "toggle",
|
1097
|
+
() => {
|
1098
|
+
return scope[nodeAccessor + ";" /* ControlledHandler */] && el.open !== scope[nodeAccessor + ":" /* ControlledValue */];
|
1099
|
+
},
|
1100
|
+
() => {
|
1101
|
+
const openChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
1102
|
+
if (openChange) {
|
1103
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
|
1104
|
+
openChange(el.open);
|
1105
|
+
run();
|
1106
|
+
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
1107
|
+
el.open = !el.open;
|
1108
|
+
}
|
1109
|
+
}
|
1110
|
+
}
|
1111
|
+
);
|
1112
|
+
}
|
1113
|
+
var inputType = "";
|
1114
|
+
function setValueAndUpdateSelection(el, value2) {
|
1115
|
+
const initialValue = el.value;
|
1116
|
+
if (initialValue !== value2) {
|
1117
|
+
if (el.getRootNode().activeElement === el) {
|
1118
|
+
const initialPosition = el.selectionStart;
|
1119
|
+
el.value = value2;
|
1120
|
+
const updatedPosition = resolveCursorPosition(
|
1121
|
+
el.value,
|
1122
|
+
initialValue,
|
1123
|
+
initialPosition,
|
1124
|
+
inputType
|
1125
|
+
);
|
1126
|
+
if (~updatedPosition) {
|
1127
|
+
el.setSelectionRange(updatedPosition, updatedPosition);
|
1128
|
+
}
|
1129
|
+
} else {
|
1130
|
+
el.value = value2;
|
1131
|
+
}
|
1132
|
+
}
|
1133
|
+
}
|
1134
|
+
function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
|
1135
|
+
scope[nodeAccessor + ";" /* ControlledHandler */] = checkedChange;
|
1136
|
+
if (checkedChange) {
|
1137
|
+
scope[nodeAccessor + "=" /* ControlledType */] = type;
|
1138
|
+
scope[nodeAccessor].checked = checked;
|
1139
|
+
} else {
|
1140
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */;
|
1141
|
+
scope[nodeAccessor].defaultChecked = checked;
|
1142
|
+
}
|
1143
|
+
}
|
1144
|
+
var delegateFormControl = createDelegator();
|
1145
|
+
var formChangeHandlers = /* @__PURE__ */ new WeakMap();
|
1146
|
+
function syncControllable(el, event, hasChanged, onChange) {
|
1147
|
+
formChangeHandlers.set(el, onChange);
|
1148
|
+
delegateFormControl(el, event, onFormChange);
|
1149
|
+
if (el.form) {
|
1150
|
+
delegateFormControl(el.form, "reset", onFormReset);
|
1151
|
+
}
|
1152
|
+
if (isResuming && hasChanged(el)) {
|
1153
|
+
queueMicrotask(onChange);
|
1154
|
+
}
|
1155
|
+
}
|
1156
|
+
function onFormChange(ev) {
|
1157
|
+
formChangeHandlers.get(ev.target)?.(ev);
|
1158
|
+
}
|
1159
|
+
function onFormReset(ev) {
|
1160
|
+
const handlers = [];
|
1161
|
+
for (const el of ev.target.elements) {
|
1162
|
+
const handler = formChangeHandlers.get(el);
|
1163
|
+
if (handler && hasFormElementChanged(el)) {
|
1164
|
+
handlers.push(handler);
|
1165
|
+
}
|
1166
|
+
}
|
1167
|
+
requestAnimationFrame(() => {
|
1168
|
+
if (!ev.defaultPrevented) {
|
1169
|
+
for (const change of handlers) {
|
1170
|
+
change();
|
1171
|
+
}
|
1172
|
+
}
|
1173
|
+
});
|
1174
|
+
}
|
1175
|
+
function hasValueChanged(el) {
|
1176
|
+
return el.value !== el.defaultValue;
|
1177
|
+
}
|
1178
|
+
function hasCheckboxChanged(el) {
|
1179
|
+
return el.checked !== el.defaultChecked;
|
1180
|
+
}
|
1181
|
+
function hasSelectChanged(el) {
|
1182
|
+
for (const opt of el.options) {
|
1183
|
+
if (opt.selected !== opt.defaultSelected) {
|
1184
|
+
return true;
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
}
|
1188
|
+
function hasFormElementChanged(el) {
|
1189
|
+
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
1190
|
+
}
|
1191
|
+
function normalizeStrProp(value2) {
|
1192
|
+
return normalizeAttrValue(value2) || "";
|
1193
|
+
}
|
1194
|
+
function normalizeBoolProp(value2) {
|
1195
|
+
return value2 != null && value2 !== false;
|
1196
|
+
}
|
1197
|
+
function updateList(arr, val, push) {
|
1198
|
+
const index = arr.indexOf(val);
|
1199
|
+
return (push ? !~index && [...arr, val] : ~index && arr.slice(0, index).concat(arr.slice(index + 1))) || arr;
|
1200
|
+
}
|
1201
|
+
function toValueProp(it) {
|
1202
|
+
return it.value;
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
// src/dom/parse-html.ts
|
1206
|
+
var fallback = document.createTextNode("");
|
1207
|
+
var parser = /* @__PURE__ */ new Range();
|
1208
|
+
function parseHTML(html2) {
|
1209
|
+
return parser.createContextualFragment(html2);
|
1210
|
+
}
|
1211
|
+
function parseHTMLOrSingleNode(html2) {
|
1212
|
+
const content = parseHTML(html2);
|
1213
|
+
if (!content.firstChild) return fallback;
|
1214
|
+
return content.firstChild === content.lastChild && // If the firstChild is a comment it's possible its
|
1215
|
+
// a single replaced node, in which case the walker can't replace
|
1216
|
+
// the node itself.
|
1217
|
+
content.firstChild.nodeType !== 8 ? content.firstChild : content;
|
1218
|
+
}
|
1219
|
+
|
1220
|
+
// src/dom/dom.ts
|
1221
|
+
function attr(element, name, value2) {
|
1222
|
+
setAttribute(element, name, normalizeAttrValue(value2));
|
1223
|
+
}
|
1224
|
+
function setAttribute(element, name, value2) {
|
1225
|
+
if (element.getAttribute(name) != value2) {
|
1226
|
+
if (value2 === void 0) {
|
1227
|
+
element.removeAttribute(name);
|
1228
|
+
} else {
|
1229
|
+
element.setAttribute(name, value2);
|
1230
|
+
}
|
1231
|
+
}
|
1232
|
+
}
|
1233
|
+
function classAttr(element, value2) {
|
1234
|
+
setAttribute(element, "class", classValue(value2) || void 0);
|
1235
|
+
}
|
1236
|
+
function styleAttr(element, value2) {
|
1237
|
+
setAttribute(element, "style", styleValue(value2) || void 0);
|
1238
|
+
}
|
1239
|
+
function data(node, value2) {
|
1240
|
+
const normalizedValue = normalizeString(value2);
|
1241
|
+
if (node.data !== normalizedValue) {
|
1242
|
+
node.data = normalizedValue;
|
1243
|
+
}
|
1244
|
+
}
|
1245
|
+
function textContent(node, value2) {
|
1246
|
+
const normalizedValue = normalizeString(value2);
|
1247
|
+
if (node.textContent !== normalizedValue) {
|
1248
|
+
node.textContent = normalizedValue;
|
1249
|
+
}
|
1250
|
+
}
|
1251
|
+
function attrs(scope, nodeAccessor, nextAttrs) {
|
1252
|
+
const el = scope[nodeAccessor];
|
1253
|
+
for (const { name } of el.attributes) {
|
1254
|
+
if (!(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)))) {
|
1255
|
+
el.removeAttribute(name);
|
1256
|
+
}
|
1257
|
+
}
|
1258
|
+
attrsInternal(scope, nodeAccessor, nextAttrs);
|
1259
|
+
}
|
1260
|
+
function hasAttrAlias(element, attr2, nextAttrs) {
|
1261
|
+
return attr2 === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
1262
|
+
}
|
1263
|
+
function partialAttrs(scope, nodeAccessor, nextAttrs, skip) {
|
1264
|
+
const el = scope[nodeAccessor];
|
1265
|
+
const partial = {};
|
1266
|
+
for (const { name } of el.attributes) {
|
1267
|
+
if (!skip[name] && !(nextAttrs && name in nextAttrs)) {
|
1268
|
+
el.removeAttribute(name);
|
1269
|
+
}
|
1270
|
+
}
|
1271
|
+
for (const key in nextAttrs) {
|
1272
|
+
if (!skip[key]) partial[key] = nextAttrs[key];
|
1273
|
+
}
|
1274
|
+
attrsInternal(scope, nodeAccessor, partial);
|
1275
|
+
}
|
1276
|
+
function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
1277
|
+
const el = scope[nodeAccessor];
|
1278
|
+
let events;
|
1279
|
+
let skip;
|
1280
|
+
switch (el.tagName) {
|
1281
|
+
case "INPUT":
|
1282
|
+
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
|
1283
|
+
controllable_input_checked(
|
1284
|
+
scope,
|
1285
|
+
nodeAccessor,
|
1286
|
+
nextAttrs.checked,
|
1287
|
+
nextAttrs.checkedChange
|
1288
|
+
);
|
1289
|
+
} else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) {
|
1290
|
+
controllable_input_checkedValue(
|
1291
|
+
scope,
|
1292
|
+
nodeAccessor,
|
1293
|
+
nextAttrs.checkedValue,
|
1294
|
+
nextAttrs.checkedValueChange,
|
1295
|
+
nextAttrs.value
|
1296
|
+
);
|
1297
|
+
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
1298
|
+
controllable_input_value(
|
1299
|
+
scope,
|
1300
|
+
nodeAccessor,
|
1301
|
+
nextAttrs.value,
|
1302
|
+
nextAttrs.valueChange
|
1303
|
+
);
|
1304
|
+
} else {
|
1305
|
+
break;
|
1306
|
+
}
|
1307
|
+
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
1308
|
+
break;
|
1309
|
+
case "SELECT":
|
1310
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
1311
|
+
controllable_select_value(
|
1312
|
+
scope,
|
1313
|
+
nodeAccessor,
|
1314
|
+
nextAttrs.value,
|
1315
|
+
nextAttrs.valueChange
|
1316
|
+
);
|
1317
|
+
skip = /^value(?:Change)?$/;
|
1318
|
+
}
|
1319
|
+
break;
|
1320
|
+
case "TEXTAREA":
|
1321
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
1322
|
+
controllable_input_value(
|
1323
|
+
scope,
|
1324
|
+
nodeAccessor,
|
1325
|
+
nextAttrs.value,
|
1326
|
+
nextAttrs.valueChange
|
1327
|
+
);
|
1328
|
+
skip = /^value(?:Change)?$/;
|
1329
|
+
}
|
1330
|
+
break;
|
1331
|
+
case "DETAILS":
|
1332
|
+
case "DIALOG":
|
1333
|
+
if ("open" in nextAttrs || "openChange" in nextAttrs) {
|
1334
|
+
controllable_detailsOrDialog_open(
|
1335
|
+
scope,
|
1336
|
+
nodeAccessor,
|
1337
|
+
nextAttrs.open,
|
1338
|
+
nextAttrs.openChange
|
1339
|
+
);
|
1340
|
+
skip = /^open(?:Change)?$/;
|
1341
|
+
}
|
1342
|
+
break;
|
1343
|
+
}
|
1344
|
+
for (const name in nextAttrs) {
|
1345
|
+
const value2 = nextAttrs[name];
|
1346
|
+
switch (name) {
|
1347
|
+
case "class":
|
1348
|
+
classAttr(el, value2);
|
1349
|
+
break;
|
1350
|
+
case "style":
|
1351
|
+
styleAttr(el, value2);
|
1352
|
+
break;
|
1353
|
+
case "renderBody":
|
1354
|
+
break;
|
1355
|
+
default: {
|
1356
|
+
if (isEventHandler(name)) {
|
1357
|
+
(events ||= scope[nodeAccessor + "~" /* EventAttributes */] = {})[getEventHandlerName(name)] = value2;
|
1358
|
+
} else if (!skip?.test(name)) {
|
1359
|
+
attr(el, name, value2);
|
1360
|
+
}
|
1361
|
+
}
|
1362
|
+
}
|
1363
|
+
}
|
1364
|
+
}
|
1365
|
+
function attrsEvents(scope, nodeAccessor) {
|
1366
|
+
const el = scope[nodeAccessor];
|
1367
|
+
const events = scope[nodeAccessor + "~" /* EventAttributes */];
|
1368
|
+
switch (scope[nodeAccessor + "=" /* ControlledType */]) {
|
1369
|
+
case 0 /* InputChecked */:
|
1370
|
+
controllable_input_checked_effect(scope, nodeAccessor);
|
1371
|
+
break;
|
1372
|
+
case 1 /* InputCheckedValue */:
|
1373
|
+
controllable_input_checkedValue_effect(scope, nodeAccessor);
|
1374
|
+
break;
|
1375
|
+
case 2 /* InputValue */:
|
1376
|
+
controllable_input_value_effect(scope, nodeAccessor);
|
1377
|
+
break;
|
1378
|
+
case 3 /* SelectValue */:
|
1379
|
+
controllable_select_value_effect(scope, nodeAccessor);
|
1380
|
+
break;
|
1381
|
+
case 4 /* DetailsOrDialogOpen */:
|
1382
|
+
controllable_detailsOrDialog_open_effect(scope, nodeAccessor);
|
1383
|
+
break;
|
1384
|
+
}
|
1385
|
+
for (const name in events) {
|
1386
|
+
on(el, name, events[name]);
|
1387
|
+
}
|
1388
|
+
}
|
1389
|
+
function html(scope, value2, index) {
|
1390
|
+
const firstChild = scope[index];
|
1391
|
+
const lastChild = scope[index + "-"] || firstChild;
|
1392
|
+
const parentNode = firstChild.parentNode;
|
1393
|
+
const afterReference = lastChild.nextSibling;
|
1394
|
+
const newContent = parseHTML(value2 || value2 === 0 ? value2 + "" : "<!>");
|
1395
|
+
scope[index] = newContent.firstChild;
|
1396
|
+
scope[index + "-" /* DynamicPlaceholderLastChild */] = newContent.lastChild;
|
1397
|
+
parentNode.insertBefore(newContent, firstChild);
|
1398
|
+
let current = firstChild;
|
1399
|
+
while (current !== afterReference) {
|
1400
|
+
const next = current.nextSibling;
|
1401
|
+
current.remove();
|
1402
|
+
current = next;
|
1403
|
+
}
|
1404
|
+
}
|
1405
|
+
function props(scope, nodeIndex, index) {
|
1406
|
+
const nextProps = scope[index];
|
1407
|
+
const prevProps = scope[index + "-"];
|
1408
|
+
const node = scope[nodeIndex];
|
1409
|
+
if (prevProps) {
|
1410
|
+
for (const name in prevProps) {
|
1411
|
+
if (!(name in nextProps)) {
|
1412
|
+
node[name] = void 0;
|
1413
|
+
}
|
1414
|
+
}
|
1415
|
+
}
|
1416
|
+
for (const name in nextProps) {
|
1417
|
+
node[name] = nextProps[name];
|
1418
|
+
}
|
1419
|
+
scope[index + "-"] = nextProps;
|
1420
|
+
}
|
1421
|
+
function normalizeAttrValue(value2) {
|
1422
|
+
if (value2 || value2 === 0) {
|
1423
|
+
return value2 === true ? "" : value2 + "";
|
1424
|
+
}
|
1425
|
+
}
|
1426
|
+
function normalizeString(value2) {
|
1427
|
+
return value2 || value2 === 0 ? value2 + "" : "\u200D";
|
1428
|
+
}
|
1429
|
+
function lifecycle(scope, index, thisObj) {
|
1430
|
+
const instance = scope[index];
|
1431
|
+
if (instance) {
|
1432
|
+
Object.assign(instance, thisObj);
|
1433
|
+
instance.onUpdate?.();
|
1434
|
+
} else {
|
1435
|
+
scope[index] = thisObj;
|
1436
|
+
thisObj.onMount?.();
|
1437
|
+
getAbortSignal(
|
1438
|
+
scope,
|
1439
|
+
"-" /* LifecycleAbortController */ + index
|
1440
|
+
).onabort = () => thisObj.onDestroy?.();
|
1441
|
+
}
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
// src/dom/walker.ts
|
1445
|
+
var walker = /* @__PURE__ */ document.createTreeWalker(document);
|
1446
|
+
function trimWalkString(walkString) {
|
1447
|
+
let end = walkString.length;
|
1448
|
+
while (walkString.charCodeAt(--end) > 47 /* BeginChild */) ;
|
1449
|
+
return walkString.slice(0, end + 1);
|
1450
|
+
}
|
1451
|
+
function walk(startNode, walkCodes, scope) {
|
1452
|
+
walker.currentNode = startNode;
|
1453
|
+
walkInternal(walkCodes, scope, scope, 0);
|
1454
|
+
walker.currentNode = document.documentElement;
|
1455
|
+
}
|
1456
|
+
function walkInternal(walkCodes, scope, cleanupOwnerScope, currentWalkIndex) {
|
1457
|
+
let value2;
|
1458
|
+
let storedMultiplier = 0;
|
1459
|
+
let currentMultiplier = 0;
|
1460
|
+
let currentScopeIndex = 0;
|
1461
|
+
if (cleanupOwnerScope !== scope) {
|
1462
|
+
scope.___cleanupOwner = cleanupOwnerScope;
|
1463
|
+
}
|
1464
|
+
while (value2 = walkCodes.charCodeAt(currentWalkIndex++)) {
|
1465
|
+
currentMultiplier = storedMultiplier;
|
1466
|
+
storedMultiplier = 0;
|
1467
|
+
if (value2 >= 117 /* Multiplier */) {
|
1468
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
|
1469
|
+
} else if (value2 >= 107 /* Out */) {
|
1470
|
+
value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */;
|
1471
|
+
while (value2--) {
|
1472
|
+
walker.parentNode();
|
1473
|
+
}
|
1474
|
+
walker.nextSibling();
|
1475
|
+
} else if (value2 >= 97 /* Over */) {
|
1476
|
+
value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */;
|
1477
|
+
while (value2--) {
|
1478
|
+
walker.nextSibling();
|
1479
|
+
}
|
1480
|
+
} else if (value2 >= 67 /* Next */) {
|
1481
|
+
value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */;
|
1482
|
+
while (value2--) {
|
1483
|
+
walker.nextNode();
|
1484
|
+
}
|
1485
|
+
} else if (value2 === 47 /* BeginChild */) {
|
1486
|
+
currentWalkIndex = walkInternal(
|
1487
|
+
walkCodes,
|
1488
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global),
|
1489
|
+
cleanupOwnerScope,
|
1490
|
+
currentWalkIndex
|
1491
|
+
);
|
1492
|
+
} else if (value2 === 38 /* EndChild */) {
|
1493
|
+
return currentWalkIndex;
|
1494
|
+
} else if (value2 === 32 /* Get */) {
|
1495
|
+
scope[true ? getDebugKey(currentScopeIndex++, walker.currentNode) : currentScopeIndex++] = walker.currentNode;
|
1496
|
+
} else {
|
1497
|
+
const newNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = document.createTextNode("");
|
1498
|
+
const current = walker.currentNode;
|
1499
|
+
const parentNode = current.parentNode;
|
1500
|
+
if (value2 !== 37 /* Replace */) {
|
1501
|
+
throw new Error(`Unknown walk code: ${value2}`);
|
1502
|
+
}
|
1503
|
+
parentNode.replaceChild(newNode, current);
|
1504
|
+
walker.currentNode = newNode;
|
1505
|
+
}
|
1506
|
+
}
|
1507
|
+
return currentWalkIndex;
|
1508
|
+
}
|
1509
|
+
function getDebugKey(index, node) {
|
1510
|
+
if (typeof node === "string") {
|
1511
|
+
return `${node}/${index}`;
|
1512
|
+
} else if (node.nodeType === 3 /* Text */) {
|
1513
|
+
return `#text/${index}`;
|
1514
|
+
} else if (node.nodeType === 8 /* Comment */) {
|
1515
|
+
return `#comment/${index}`;
|
1516
|
+
} else if (node.nodeType === 1 /* Element */) {
|
1517
|
+
return `#${node.tagName.toLowerCase()}/${index}`;
|
1518
|
+
}
|
1519
|
+
return index;
|
1520
|
+
}
|
1521
|
+
|
1522
|
+
// src/dom/renderer.ts
|
1523
|
+
function createScopeWithRenderer(renderer, $global, ownerScope) {
|
1524
|
+
const newScope = createScope($global);
|
1525
|
+
newScope._ = newScope.___cleanupOwner = renderer.___owner || ownerScope;
|
1526
|
+
newScope.___renderer = renderer;
|
1527
|
+
initRenderer(renderer, newScope);
|
1528
|
+
if (renderer.___closureSignals) {
|
1529
|
+
for (const signal of renderer.___closureSignals) {
|
1530
|
+
signal.___subscribe?.(newScope);
|
1531
|
+
}
|
1532
|
+
}
|
1533
|
+
return newScope;
|
1534
|
+
}
|
1535
|
+
function createScopeWithTagNameOrRenderer(tagNameOrRenderer, $global, ownerScope) {
|
1536
|
+
if (typeof tagNameOrRenderer !== "string") {
|
1537
|
+
return createScopeWithRenderer(tagNameOrRenderer, $global, ownerScope);
|
1538
|
+
}
|
1539
|
+
const newScope = createScope($global);
|
1540
|
+
newScope._ = newScope.___cleanupOwner = ownerScope;
|
1541
|
+
newScope[true ? `#${tagNameOrRenderer}/0` : 0] = newScope.___startNode = newScope.___endNode = document.createElement(tagNameOrRenderer);
|
1542
|
+
return newScope;
|
1543
|
+
}
|
1544
|
+
function initRenderer(renderer, scope) {
|
1545
|
+
const dom = renderer.___clone();
|
1546
|
+
walk(
|
1547
|
+
dom.nodeType === 11 /* DocumentFragment */ ? dom.firstChild : dom,
|
1548
|
+
renderer.___walks,
|
1549
|
+
scope
|
1550
|
+
);
|
1551
|
+
scope.___startNode = dom.nodeType === 11 /* DocumentFragment */ ? dom.firstChild : dom;
|
1552
|
+
scope.___endNode = dom.nodeType === 11 /* DocumentFragment */ ? dom.lastChild : dom;
|
1553
|
+
if (renderer.___setup) {
|
1554
|
+
renderer.___setup(scope);
|
1555
|
+
}
|
1556
|
+
return dom;
|
1557
|
+
}
|
1558
|
+
function dynamicTagAttrs(nodeAccessor, getRenderBody, inputIsArgs) {
|
1559
|
+
return (scope, attrsOrOp) => {
|
1560
|
+
const renderer = scope[nodeAccessor + "(" /* ConditionalRenderer */];
|
1561
|
+
if (!renderer || attrsOrOp === DIRTY) {
|
1562
|
+
return;
|
1563
|
+
}
|
1564
|
+
const childScope = scope[nodeAccessor + "!" /* ConditionalScope */];
|
1565
|
+
if (attrsOrOp === MARK || attrsOrOp === CLEAN) {
|
1566
|
+
return renderer.___args?.(childScope, attrsOrOp);
|
1567
|
+
}
|
1568
|
+
const renderBody = getRenderBody?.(scope);
|
1569
|
+
if (typeof renderer === "string") {
|
1570
|
+
const nodeAccessor2 = true ? `#${renderer}/0` : 0;
|
1571
|
+
if (renderer === "textarea" && renderBody) {
|
1572
|
+
throw new Error(
|
1573
|
+
"A dynamic tag rendering a `<textarea>` cannot have a `renderBody` and must use the `value` attribute instead."
|
1574
|
+
);
|
1575
|
+
}
|
1576
|
+
setConditionalRendererOnlyChild(childScope, nodeAccessor2, renderBody);
|
1577
|
+
attrs(childScope, nodeAccessor2, attrsOrOp());
|
1578
|
+
} else if (renderer.___args) {
|
1579
|
+
const attributes = attrsOrOp();
|
1580
|
+
renderer.___args(
|
1581
|
+
childScope,
|
1582
|
+
inputIsArgs ? attributes : [
|
1583
|
+
renderBody ? {
|
1584
|
+
...attributes,
|
1585
|
+
renderBody
|
1586
|
+
} : attributes
|
1587
|
+
]
|
1588
|
+
);
|
1589
|
+
}
|
1590
|
+
};
|
1591
|
+
}
|
1592
|
+
function createRendererWithOwner(template, rawWalks, setup, getClosureSignals, getArgs) {
|
1593
|
+
let args;
|
1594
|
+
let closureSignals;
|
1595
|
+
const id = true ? Symbol("Marko Renderer") : {};
|
1596
|
+
const walks = rawWalks ? /* @__PURE__ */ trimWalkString(rawWalks) : " ";
|
1597
|
+
return (owner) => {
|
1598
|
+
return {
|
1599
|
+
___id: id,
|
1600
|
+
___template: template,
|
1601
|
+
___walks: walks,
|
1602
|
+
___setup: setup,
|
1603
|
+
___clone: _clone,
|
1604
|
+
___owner: owner,
|
1605
|
+
___sourceNode: void 0,
|
1606
|
+
get ___args() {
|
1607
|
+
return args ||= getArgs?.();
|
1608
|
+
},
|
1609
|
+
get ___closureSignals() {
|
1610
|
+
return closureSignals ||= new Set(getClosureSignals?.());
|
1611
|
+
}
|
1612
|
+
};
|
1613
|
+
};
|
1614
|
+
}
|
1615
|
+
function createRenderer(template, walks, setup, getClosureSignals, getArgs) {
|
1616
|
+
return createRendererWithOwner(
|
1617
|
+
template,
|
1618
|
+
walks,
|
1619
|
+
setup,
|
1620
|
+
getClosureSignals,
|
1621
|
+
getArgs
|
1622
|
+
)();
|
1623
|
+
}
|
1624
|
+
function _clone() {
|
1625
|
+
return (this.___sourceNode ||= parseHTMLOrSingleNode(
|
1626
|
+
this.___template
|
1627
|
+
)).cloneNode(true);
|
1628
|
+
}
|
1629
|
+
|
1630
|
+
// src/dom/control-flow.ts
|
1631
|
+
function patchConditionals(fn) {
|
1632
|
+
conditional = fn(conditional);
|
1633
|
+
conditionalOnlyChild = fn(conditionalOnlyChild);
|
1634
|
+
}
|
1635
|
+
var conditional = function conditional2(nodeAccessor, fn, getIntersection) {
|
1636
|
+
const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
|
1637
|
+
const childScopeAccessor = nodeAccessor + "!" /* ConditionalScope */;
|
1638
|
+
let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
1639
|
+
return (scope, newRendererOrOp) => {
|
1640
|
+
if (newRendererOrOp === DIRTY) return;
|
1641
|
+
let currentRenderer = scope[rendererAccessor];
|
1642
|
+
let op = newRendererOrOp;
|
1643
|
+
if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
|
1644
|
+
const normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
|
1645
|
+
if (isDifferentRenderer(normalizedRenderer, currentRenderer)) {
|
1646
|
+
currentRenderer = scope[rendererAccessor] = normalizedRenderer;
|
1647
|
+
setConditionalRenderer(scope, nodeAccessor, normalizedRenderer);
|
1648
|
+
fn && fn(scope);
|
1649
|
+
op = DIRTY;
|
1650
|
+
} else {
|
1651
|
+
op = CLEAN;
|
1652
|
+
}
|
1653
|
+
}
|
1654
|
+
intersection2?.(scope, op);
|
1655
|
+
renderBodyClosures(currentRenderer, scope[childScopeAccessor], op);
|
1656
|
+
};
|
1657
|
+
};
|
1658
|
+
function inConditionalScope(signal, nodeAccessor) {
|
1659
|
+
const scopeAccessor = nodeAccessor + "!" /* ConditionalScope */;
|
1660
|
+
const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
|
1661
|
+
return (scope, op) => {
|
1662
|
+
const conditionalScope = scope[scopeAccessor];
|
1663
|
+
if (conditionalScope) {
|
1664
|
+
const conditionalRenderer = scope[rendererAccessor];
|
1665
|
+
if (!conditionalRenderer?.___closureSignals || conditionalRenderer.___closureSignals.has(signal)) {
|
1666
|
+
signal(conditionalScope, op);
|
1667
|
+
}
|
1668
|
+
}
|
1669
|
+
};
|
1670
|
+
}
|
1671
|
+
function setConditionalRenderer(scope, nodeAccessor, newRenderer) {
|
1672
|
+
let newScope;
|
1673
|
+
let prevScope = scope[nodeAccessor + "!" /* ConditionalScope */];
|
1674
|
+
if (newRenderer) {
|
1675
|
+
newScope = scope[nodeAccessor + "!" /* ConditionalScope */] = createScopeWithTagNameOrRenderer(
|
1676
|
+
newRenderer,
|
1677
|
+
scope.$global,
|
1678
|
+
scope
|
1679
|
+
);
|
1680
|
+
prevScope = prevScope || getEmptyScope(scope[nodeAccessor]);
|
1681
|
+
} else {
|
1682
|
+
newScope = getEmptyScope(scope[nodeAccessor]);
|
1683
|
+
scope[nodeAccessor + "!" /* ConditionalScope */] = void 0;
|
1684
|
+
}
|
1685
|
+
insertBefore(
|
1686
|
+
newScope,
|
1687
|
+
prevScope.___startNode.parentNode,
|
1688
|
+
prevScope.___startNode
|
1689
|
+
);
|
1690
|
+
removeAndDestroyScope(prevScope);
|
1691
|
+
}
|
1692
|
+
var conditionalOnlyChild = function conditional3(nodeAccessor, fn, getIntersection) {
|
1693
|
+
const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
|
1694
|
+
const childScopeAccessor = nodeAccessor + "!" /* ConditionalScope */;
|
1695
|
+
let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
1696
|
+
return (scope, newRendererOrOp) => {
|
1697
|
+
if (newRendererOrOp === DIRTY) return;
|
1698
|
+
let currentRenderer = scope[rendererAccessor];
|
1699
|
+
let op = newRendererOrOp;
|
1700
|
+
if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
|
1701
|
+
const normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
|
1702
|
+
if (isDifferentRenderer(normalizedRenderer, currentRenderer)) {
|
1703
|
+
currentRenderer = scope[rendererAccessor] = normalizedRenderer;
|
1704
|
+
setConditionalRendererOnlyChild(
|
1705
|
+
scope,
|
1706
|
+
nodeAccessor,
|
1707
|
+
normalizedRenderer
|
1708
|
+
);
|
1709
|
+
fn && fn(scope);
|
1710
|
+
op = DIRTY;
|
1711
|
+
} else {
|
1712
|
+
op = CLEAN;
|
1713
|
+
}
|
1714
|
+
}
|
1715
|
+
intersection2?.(scope, op);
|
1716
|
+
renderBodyClosures(currentRenderer, scope[childScopeAccessor], op);
|
1717
|
+
};
|
1718
|
+
};
|
1719
|
+
function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer) {
|
1720
|
+
const prevScope = scope[nodeAccessor + "!" /* ConditionalScope */];
|
1721
|
+
const referenceNode = scope[nodeAccessor];
|
1722
|
+
referenceNode.textContent = "";
|
1723
|
+
if (newRenderer) {
|
1724
|
+
const newScope = scope[nodeAccessor + "!" /* ConditionalScope */] = createScopeWithTagNameOrRenderer(newRenderer, scope.$global, scope);
|
1725
|
+
insertBefore(newScope, referenceNode, null);
|
1726
|
+
}
|
1727
|
+
prevScope && destroyScope(prevScope);
|
1728
|
+
}
|
1729
|
+
var emptyMarkerMap = /* @__PURE__ */ new Map([[Symbol(), getEmptyScope(void 0)]]);
|
1730
|
+
var emptyMarkerArray = [
|
1731
|
+
/* @__PURE__ */ getEmptyScope(void 0)
|
1732
|
+
];
|
1733
|
+
var emptyMap = /* @__PURE__ */ new Map();
|
1734
|
+
var emptyArray = [];
|
1735
|
+
function loopOf(nodeAccessor, renderer) {
|
1736
|
+
return loop(
|
1737
|
+
nodeAccessor,
|
1738
|
+
renderer,
|
1739
|
+
([all, by = bySecondArg], cb) => {
|
1740
|
+
if (typeof by === "string") {
|
1741
|
+
forOf(
|
1742
|
+
all,
|
1743
|
+
(item, i) => cb(item[by], [item, i])
|
1744
|
+
);
|
1745
|
+
} else {
|
1746
|
+
forOf(all, (item, i) => cb(by(item, i), [item, i]));
|
1747
|
+
}
|
1748
|
+
}
|
1749
|
+
);
|
1750
|
+
}
|
1751
|
+
function loopIn(nodeAccessor, renderer) {
|
1752
|
+
return loop(
|
1753
|
+
nodeAccessor,
|
1754
|
+
renderer,
|
1755
|
+
([obj, by = byFirstArg], cb) => forIn(obj, (key, value2) => cb(by(key, value2), [key, value2]))
|
1756
|
+
);
|
1757
|
+
}
|
1758
|
+
function loopTo(nodeAccessor, renderer) {
|
1759
|
+
return loop(
|
1760
|
+
nodeAccessor,
|
1761
|
+
renderer,
|
1762
|
+
([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
|
1763
|
+
);
|
1764
|
+
}
|
1765
|
+
function loop(nodeAccessor, renderer, forEach) {
|
1766
|
+
const loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */;
|
1767
|
+
const closureSignals = renderer.___closureSignals;
|
1768
|
+
const params = renderer.___args;
|
1769
|
+
return (scope, valueOrOp) => {
|
1770
|
+
if (valueOrOp === DIRTY) return;
|
1771
|
+
if (valueOrOp === MARK || valueOrOp === CLEAN) {
|
1772
|
+
const loopScopes = scope[loopScopeAccessor] ?? scope[nodeAccessor + "(" /* LoopScopeMap */]?.values() ?? [];
|
1773
|
+
if (loopScopes !== emptyMarkerArray) {
|
1774
|
+
for (const childScope of loopScopes) {
|
1775
|
+
params?.(childScope, valueOrOp);
|
1776
|
+
for (const signal of closureSignals) {
|
1777
|
+
signal(childScope, valueOrOp);
|
1778
|
+
}
|
1779
|
+
}
|
1780
|
+
}
|
1781
|
+
return;
|
1782
|
+
}
|
1783
|
+
const referenceNode = scope[nodeAccessor];
|
1784
|
+
const referenceIsMarker = referenceNode.nodeType === 8 || referenceNode.nodeType === 3;
|
1785
|
+
const oldMap = scope[nodeAccessor + "(" /* LoopScopeMap */] || (referenceIsMarker ? emptyMarkerMap : emptyMap);
|
1786
|
+
const oldArray = scope[nodeAccessor + "!" /* LoopScopeArray */] || Array.from(oldMap.values());
|
1787
|
+
let newMap;
|
1788
|
+
let newArray;
|
1789
|
+
let afterReference;
|
1790
|
+
let parentNode;
|
1791
|
+
let needsReconciliation = true;
|
1792
|
+
forEach(valueOrOp, (key, args) => {
|
1793
|
+
let childScope = oldMap.get(key);
|
1794
|
+
let closureOp = CLEAN;
|
1795
|
+
if (!childScope) {
|
1796
|
+
childScope = createScopeWithRenderer(renderer, scope.$global, scope);
|
1797
|
+
closureOp = DIRTY;
|
1798
|
+
} else {
|
1799
|
+
}
|
1800
|
+
if (params) {
|
1801
|
+
params(childScope, args);
|
1802
|
+
}
|
1803
|
+
if (closureSignals) {
|
1804
|
+
for (const signal of closureSignals) {
|
1805
|
+
signal(childScope, closureOp);
|
1806
|
+
}
|
1807
|
+
}
|
1808
|
+
if (newMap) {
|
1809
|
+
newMap.set(key, childScope);
|
1810
|
+
newArray.push(childScope);
|
1811
|
+
} else {
|
1812
|
+
newMap = /* @__PURE__ */ new Map([[key, childScope]]);
|
1813
|
+
newArray = [childScope];
|
1814
|
+
}
|
1815
|
+
});
|
1816
|
+
if (!newMap) {
|
1817
|
+
if (referenceIsMarker) {
|
1818
|
+
newMap = emptyMarkerMap;
|
1819
|
+
newArray = emptyMarkerArray;
|
1820
|
+
getEmptyScope(referenceNode);
|
1821
|
+
} else {
|
1822
|
+
oldArray.forEach(destroyScope);
|
1823
|
+
referenceNode.textContent = "";
|
1824
|
+
newMap = emptyMap;
|
1825
|
+
newArray = emptyArray;
|
1826
|
+
needsReconciliation = false;
|
1827
|
+
}
|
1828
|
+
}
|
1829
|
+
if (needsReconciliation) {
|
1830
|
+
if (referenceIsMarker) {
|
1831
|
+
if (oldMap === emptyMarkerMap) {
|
1832
|
+
getEmptyScope(referenceNode);
|
1833
|
+
}
|
1834
|
+
const oldLastChild = oldArray[oldArray.length - 1];
|
1835
|
+
afterReference = oldLastChild.___endNode.nextSibling;
|
1836
|
+
parentNode = oldLastChild.___startNode.parentNode;
|
1837
|
+
} else {
|
1838
|
+
afterReference = null;
|
1839
|
+
parentNode = referenceNode;
|
1840
|
+
}
|
1841
|
+
reconcile(parentNode, oldArray, newArray, afterReference);
|
1842
|
+
}
|
1843
|
+
scope[nodeAccessor + "(" /* LoopScopeMap */] = newMap;
|
1844
|
+
scope[nodeAccessor + "!" /* LoopScopeArray */] = newArray;
|
1845
|
+
};
|
1846
|
+
}
|
1847
|
+
function inLoopScope(signal, loopNodeAccessor) {
|
1848
|
+
const loopScopeAccessor = loopNodeAccessor + "!" /* LoopScopeArray */;
|
1849
|
+
return (scope, op) => {
|
1850
|
+
const loopScopes = scope[loopScopeAccessor] ?? scope[loopNodeAccessor + "(" /* LoopScopeMap */]?.values() ?? [];
|
1851
|
+
if (loopScopes !== emptyMarkerArray) {
|
1852
|
+
for (const scope2 of loopScopes) {
|
1853
|
+
signal(scope2, op);
|
1854
|
+
}
|
1855
|
+
}
|
1856
|
+
};
|
1857
|
+
}
|
1858
|
+
function bySecondArg(_item, index) {
|
1859
|
+
return index;
|
1860
|
+
}
|
1861
|
+
function byFirstArg(name) {
|
1862
|
+
return name;
|
1863
|
+
}
|
1864
|
+
function isDifferentRenderer(a, b) {
|
1865
|
+
return a !== b && (a?.___id || 0) !== b?.___id;
|
1866
|
+
}
|
1867
|
+
|
1868
|
+
// src/dom/compat.ts
|
1869
|
+
var classIdToScope = /* @__PURE__ */ new Map();
|
1870
|
+
var compat = {
|
1871
|
+
patchConditionals,
|
1872
|
+
queueEffect,
|
1873
|
+
init() {
|
1874
|
+
register(SET_SCOPE_REGISTER_ID, (scope) => {
|
1875
|
+
classIdToScope.set(scope.m5c, scope);
|
1876
|
+
});
|
1877
|
+
},
|
1878
|
+
registerRenderer(fn) {
|
1879
|
+
register(RENDERER_REGISTER_ID, fn);
|
1880
|
+
},
|
1881
|
+
isOp(value2) {
|
1882
|
+
return value2 === MARK || value2 === CLEAN || value2 === DIRTY;
|
1883
|
+
},
|
1884
|
+
isRenderer(renderer) {
|
1885
|
+
return renderer.___clone !== void 0;
|
1886
|
+
},
|
1887
|
+
getStartNode(scope) {
|
1888
|
+
return scope.___startNode;
|
1889
|
+
},
|
1890
|
+
setScopeNodes(scope, startNode, endNode) {
|
1891
|
+
scope.___startNode = startNode;
|
1892
|
+
scope.___endNode = endNode;
|
1893
|
+
},
|
1894
|
+
runComponentEffects() {
|
1895
|
+
runEffects(this.effects);
|
1896
|
+
},
|
1897
|
+
resolveRegistered(value2, {
|
1898
|
+
runtimeId,
|
1899
|
+
componentIdPrefix
|
1900
|
+
}) {
|
1901
|
+
if (Array.isArray(value2) && typeof value2[0] === "string") {
|
1902
|
+
return getRegisteredWithScope(
|
1903
|
+
value2[0],
|
1904
|
+
value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.___scopeLookup[value2[1]]
|
1905
|
+
);
|
1906
|
+
}
|
1907
|
+
return value2;
|
1908
|
+
},
|
1909
|
+
createRenderer(setup, clone, args) {
|
1910
|
+
const renderer = createRenderer(
|
1911
|
+
"",
|
1912
|
+
void 0,
|
1913
|
+
setup,
|
1914
|
+
void 0,
|
1915
|
+
args && (() => args)
|
1916
|
+
);
|
1917
|
+
renderer.___clone = clone;
|
1918
|
+
return renderer;
|
1919
|
+
},
|
1920
|
+
render(out, component, renderer, input) {
|
1921
|
+
let scope = component.scope;
|
1922
|
+
if (!scope) {
|
1923
|
+
scope = classIdToScope.get(component.id);
|
1924
|
+
if (scope) {
|
1925
|
+
component.scope = scope;
|
1926
|
+
classIdToScope.delete(component.id);
|
1927
|
+
}
|
1928
|
+
}
|
1929
|
+
const args = renderer.___args || noop;
|
1930
|
+
let existing = false;
|
1931
|
+
component.effects = prepareEffects(() => {
|
1932
|
+
if (!scope) {
|
1933
|
+
scope = component.scope = createScopeWithRenderer(renderer, out.global);
|
1934
|
+
const closures = renderer.___closureSignals;
|
1935
|
+
if (closures) {
|
1936
|
+
for (const signal of closures) {
|
1937
|
+
signal(component.scope, CLEAN);
|
1938
|
+
}
|
1939
|
+
}
|
1940
|
+
} else {
|
1941
|
+
args(scope, MARK);
|
1942
|
+
existing = true;
|
1943
|
+
}
|
1944
|
+
args(scope, input);
|
1945
|
+
});
|
1946
|
+
if (!existing) {
|
1947
|
+
return scope.___startNode === scope.___endNode ? scope.___startNode : scope.___startNode.parentNode;
|
1948
|
+
}
|
1949
|
+
}
|
1950
|
+
};
|
1951
|
+
function noop() {
|
1952
|
+
}
|
1953
|
+
|
1954
|
+
// src/dom/template.ts
|
1955
|
+
var createTemplate = (templateId, ...rendererArgs) => {
|
1956
|
+
const renderer = createRenderer(...rendererArgs);
|
1957
|
+
renderer.mount = mount;
|
1958
|
+
renderer._ = renderer;
|
1959
|
+
if (true) {
|
1960
|
+
renderer.render = () => {
|
1961
|
+
throw new Error(
|
1962
|
+
`render() is not implemented for the DOM compilation of a Marko template`
|
1963
|
+
);
|
1964
|
+
};
|
1965
|
+
}
|
1966
|
+
return register(templateId, renderer);
|
1967
|
+
};
|
1968
|
+
function mount(input = {}, reference, position) {
|
1969
|
+
let scope, dom;
|
1970
|
+
let { $global } = input;
|
1971
|
+
if ($global) {
|
1972
|
+
({ $global, ...input } = input);
|
1973
|
+
$global = {
|
1974
|
+
runtimeId: DEFAULT_RUNTIME_ID,
|
1975
|
+
renderId: DEFAULT_RENDER_ID,
|
1976
|
+
...$global
|
1977
|
+
};
|
1978
|
+
} else {
|
1979
|
+
$global = {
|
1980
|
+
runtimeId: DEFAULT_RUNTIME_ID,
|
1981
|
+
renderId: DEFAULT_RENDER_ID
|
1982
|
+
};
|
1983
|
+
}
|
1984
|
+
const args = this.___args;
|
1985
|
+
const effects = prepareEffects(() => {
|
1986
|
+
scope = createScope($global);
|
1987
|
+
dom = initRenderer(this, scope);
|
1988
|
+
if (args) {
|
1989
|
+
args(scope, [input]);
|
1990
|
+
}
|
1991
|
+
});
|
1992
|
+
switch (position) {
|
1993
|
+
case "afterbegin":
|
1994
|
+
reference.insertBefore(dom, reference.firstChild);
|
1995
|
+
break;
|
1996
|
+
case "afterend":
|
1997
|
+
reference.parentElement.insertBefore(dom, reference.nextSibling);
|
1998
|
+
break;
|
1999
|
+
case "beforebegin":
|
2000
|
+
reference.parentElement.insertBefore(dom, reference);
|
2001
|
+
break;
|
2002
|
+
default:
|
2003
|
+
reference.appendChild(dom);
|
2004
|
+
break;
|
2005
|
+
}
|
2006
|
+
runEffects(effects);
|
2007
|
+
return {
|
2008
|
+
update: (newInput) => {
|
2009
|
+
if (args) {
|
2010
|
+
runEffects(
|
2011
|
+
prepareEffects(() => {
|
2012
|
+
args(scope, MARK);
|
2013
|
+
args(scope, [newInput]);
|
2014
|
+
})
|
2015
|
+
);
|
2016
|
+
}
|
2017
|
+
},
|
2018
|
+
destroy: () => {
|
2019
|
+
removeAndDestroyScope(scope);
|
2020
|
+
}
|
2021
|
+
};
|
2022
|
+
}
|
2023
|
+
export {
|
2024
|
+
attr,
|
2025
|
+
attrTag,
|
2026
|
+
attrTags,
|
2027
|
+
attrs,
|
2028
|
+
attrsEvents,
|
2029
|
+
childClosures,
|
2030
|
+
classAttr,
|
2031
|
+
closure,
|
2032
|
+
compat,
|
2033
|
+
conditional,
|
2034
|
+
conditionalOnlyChild,
|
2035
|
+
controllable_detailsOrDialog_open,
|
2036
|
+
controllable_detailsOrDialog_open_effect,
|
2037
|
+
controllable_input_checked,
|
2038
|
+
controllable_input_checkedValue,
|
2039
|
+
controllable_input_checkedValue_effect,
|
2040
|
+
controllable_input_checked_effect,
|
2041
|
+
controllable_input_value,
|
2042
|
+
controllable_input_value_effect,
|
2043
|
+
controllable_select_value,
|
2044
|
+
controllable_select_value_effect,
|
2045
|
+
controllable_input_value as controllable_textarea_value,
|
2046
|
+
controllable_input_value_effect as controllable_textarea_value_effect,
|
2047
|
+
createRenderer,
|
2048
|
+
createRendererWithOwner,
|
2049
|
+
createScope,
|
2050
|
+
createTemplate,
|
2051
|
+
data,
|
2052
|
+
dynamicClosure,
|
2053
|
+
dynamicSubscribers,
|
2054
|
+
dynamicTagAttrs,
|
2055
|
+
effect,
|
2056
|
+
forIn,
|
2057
|
+
forOf,
|
2058
|
+
forTo,
|
2059
|
+
getAbortSignal,
|
2060
|
+
html,
|
2061
|
+
inChild,
|
2062
|
+
inConditionalScope,
|
2063
|
+
inLoopScope,
|
2064
|
+
init,
|
2065
|
+
intersection,
|
2066
|
+
intersections,
|
2067
|
+
lifecycle,
|
2068
|
+
loopIn,
|
2069
|
+
loopOf,
|
2070
|
+
loopTo,
|
2071
|
+
nextTagId,
|
2072
|
+
nodeRef,
|
2073
|
+
on,
|
2074
|
+
partialAttrs,
|
2075
|
+
props,
|
2076
|
+
register,
|
2077
|
+
registerBoundSignal,
|
2078
|
+
registerSubscriber,
|
2079
|
+
resetAbortSignal,
|
2080
|
+
run,
|
2081
|
+
setTagVar,
|
2082
|
+
setTagVarChange,
|
2083
|
+
state,
|
2084
|
+
styleAttr,
|
2085
|
+
tagVarSignal,
|
2086
|
+
tagVarSignalChange,
|
2087
|
+
textContent,
|
2088
|
+
value
|
2089
|
+
};
|