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