@gyral/core 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -0
- package/NOTICE +19 -0
- package/README.md +35 -8
- package/dist/call.d.ts +32 -0
- package/dist/call.js +63 -0
- package/dist/call.js.map +1 -0
- package/dist/children.d.ts +30 -5
- package/dist/children.js +26 -4
- package/dist/children.js.map +1 -1
- package/dist/cli/gyral-types.d.ts +2 -0
- package/dist/cli/gyral-types.js +23 -0
- package/dist/cli/gyral-types.js.map +1 -0
- package/dist/command.d.ts +54 -12
- package/dist/command.js +31 -11
- package/dist/command.js.map +1 -1
- package/dist/compiler/ast.d.ts +23 -0
- package/dist/compiler/ast.js +149 -0
- package/dist/compiler/ast.js.map +1 -0
- package/dist/compiler/compile.d.ts +41 -0
- package/dist/compiler/compile.js +148 -0
- package/dist/compiler/compile.js.map +1 -0
- package/dist/compiler/component-entries.d.ts +7 -0
- package/dist/compiler/component-entries.js +42 -0
- package/dist/compiler/component-entries.js.map +1 -0
- package/dist/compiler/components.d.ts +4 -0
- package/dist/compiler/components.js +182 -0
- package/dist/compiler/components.js.map +1 -0
- package/dist/compiler/facts.d.ts +31 -0
- package/dist/compiler/facts.js +285 -0
- package/dist/compiler/facts.js.map +1 -0
- package/dist/compiler/features.d.ts +34 -0
- package/dist/compiler/features.js +158 -0
- package/dist/compiler/features.js.map +1 -0
- package/dist/compiler/hooks.d.ts +22 -0
- package/dist/compiler/hooks.js +241 -0
- package/dist/compiler/hooks.js.map +1 -0
- package/dist/compiler/loader-source.d.ts +14 -0
- package/dist/compiler/loader-source.js +86 -0
- package/dist/compiler/loader-source.js.map +1 -0
- package/dist/compiler/locate.d.ts +14 -0
- package/dist/compiler/locate.js +78 -0
- package/dist/compiler/locate.js.map +1 -0
- package/dist/compiler/parse5-check.d.ts +21 -0
- package/dist/compiler/parse5-check.js +60 -0
- package/dist/compiler/parse5-check.js.map +1 -0
- package/dist/compiler/prop-schemas.d.ts +4 -0
- package/dist/compiler/prop-schemas.js +108 -0
- package/dist/compiler/prop-schemas.js.map +1 -0
- package/dist/compiler/scan.d.ts +41 -0
- package/dist/compiler/scan.js +160 -0
- package/dist/compiler/scan.js.map +1 -0
- package/dist/compiler/scope.d.ts +8 -0
- package/dist/compiler/scope.js +116 -0
- package/dist/compiler/scope.js.map +1 -0
- package/dist/compiler/source.d.ts +34 -0
- package/dist/compiler/source.js +114 -0
- package/dist/compiler/source.js.map +1 -0
- package/dist/compiler/tag-map.d.ts +41 -0
- package/dist/compiler/tag-map.js +126 -0
- package/dist/compiler/tag-map.js.map +1 -0
- package/dist/components-ready.d.ts +7 -0
- package/dist/components-ready.js +19 -0
- package/dist/components-ready.js.map +1 -0
- package/dist/define.d.ts +13 -4
- package/dist/define.js +35 -331
- package/dist/define.js.map +1 -1
- package/dist/devtools-events.d.ts +13 -0
- package/dist/devtools-events.js.map +1 -1
- package/dist/devtools-off.d.ts +2 -0
- package/dist/devtools-off.js +2 -0
- package/dist/devtools-off.js.map +1 -1
- package/dist/devtools.d.ts +4 -0
- package/dist/devtools.js +17 -2
- package/dist/devtools.js.map +1 -1
- package/dist/drivers-scope.d.ts +1 -1
- package/dist/drivers-scope.js +1 -8
- package/dist/drivers-scope.js.map +1 -1
- package/dist/element-internals.d.ts +1 -0
- package/dist/element-internals.js +11 -0
- package/dist/element-internals.js.map +1 -0
- package/dist/element-types.d.ts +11 -5
- package/dist/element-types.js.map +1 -1
- package/dist/element.d.ts +3 -0
- package/dist/element.js +322 -0
- package/dist/element.js.map +1 -0
- package/dist/error-view.d.ts +10 -0
- package/dist/error-view.js +30 -0
- package/dist/error-view.js.map +1 -0
- package/dist/errors.d.ts +21 -0
- package/dist/errors.js +47 -0
- package/dist/errors.js.map +1 -0
- package/dist/errors.json +289 -0
- package/dist/eslint/imports.d.ts +26 -0
- package/dist/eslint/imports.js +78 -0
- package/dist/eslint/imports.js.map +1 -0
- package/dist/eslint/index.d.ts +16 -0
- package/dist/eslint/index.js +23 -0
- package/dist/eslint/index.js.map +1 -0
- package/dist/eslint/locate.d.ts +33 -0
- package/dist/eslint/locate.js +132 -0
- package/dist/eslint/locate.js.map +1 -0
- package/dist/eslint/row-purity-rule.d.ts +2 -0
- package/dist/eslint/row-purity-rule.js +103 -0
- package/dist/eslint/row-purity-rule.js.map +1 -0
- package/dist/eslint/template-rule.d.ts +6 -0
- package/dist/eslint/template-rule.js +76 -0
- package/dist/eslint/template-rule.js.map +1 -0
- package/dist/eslint/unused-intent-rule.d.ts +2 -0
- package/dist/eslint/unused-intent-rule.js +186 -0
- package/dist/eslint/unused-intent-rule.js.map +1 -0
- package/dist/features.d.ts +39 -0
- package/dist/features.js +2 -0
- package/dist/features.js.map +1 -0
- package/dist/focus.d.ts +13 -12
- package/dist/focus.js +44 -11
- package/dist/focus.js.map +1 -1
- package/dist/form-associated.d.ts +46 -0
- package/dist/form-associated.js +77 -0
- package/dist/form-associated.js.map +1 -0
- package/dist/forms.d.ts +42 -30
- package/dist/forms.js +85 -41
- package/dist/forms.js.map +1 -1
- package/dist/frame-lane.d.ts +11 -0
- package/dist/frame-lane.js +28 -0
- package/dist/frame-lane.js.map +1 -0
- package/dist/head.d.ts +61 -0
- package/dist/head.js +85 -0
- package/dist/head.js.map +1 -0
- package/dist/hooks/invalid.d.ts +14 -0
- package/dist/hooks/invalid.js +72 -0
- package/dist/hooks/invalid.js.map +1 -0
- package/dist/host-model.d.ts +77 -0
- package/dist/host-model.js +278 -0
- package/dist/host-model.js.map +1 -0
- package/dist/hydration-client.d.ts +9 -0
- package/dist/hydration-client.js +35 -0
- package/dist/hydration-client.js.map +1 -0
- package/dist/hydration-loader.d.ts +13 -0
- package/dist/hydration-loader.js +58 -0
- package/dist/hydration-loader.js.map +1 -0
- package/dist/hydration-off.d.ts +8 -0
- package/dist/hydration-off.js +25 -0
- package/dist/hydration-off.js.map +1 -0
- package/dist/hydration.d.ts +3 -21
- package/dist/hydration.js +14 -63
- package/dist/hydration.js.map +1 -1
- package/dist/index.d.ts +24 -36
- package/dist/index.js +14 -32
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-types.d.ts +97 -0
- package/dist/indexeddb-types.js +2 -0
- package/dist/indexeddb-types.js.map +1 -0
- package/dist/indexeddb.d.ts +5 -0
- package/dist/indexeddb.js +118 -0
- package/dist/indexeddb.js.map +1 -0
- package/dist/intent.d.ts +62 -17
- package/dist/intent.js +193 -100
- package/dist/intent.js.map +1 -1
- package/dist/internal/indexeddb-open.d.ts +8 -0
- package/dist/internal/indexeddb-open.js +96 -0
- package/dist/internal/indexeddb-open.js.map +1 -0
- package/dist/internal/indexeddb-transaction.d.ts +4 -0
- package/dist/internal/indexeddb-transaction.js +134 -0
- package/dist/internal/indexeddb-transaction.js.map +1 -0
- package/dist/internal/interpreter.d.ts +15 -1
- package/dist/internal/interpreter.js +42 -47
- package/dist/internal/interpreter.js.map +1 -1
- package/dist/internal/token.d.ts +1 -0
- package/dist/internal/token.js +7 -0
- package/dist/internal/token.js.map +1 -0
- package/dist/internal.d.ts +20 -0
- package/dist/internal.js +22 -0
- package/dist/internal.js.map +1 -0
- package/dist/invoker-fallback-used.d.ts +4 -0
- package/dist/invoker-fallback-used.js +10 -0
- package/dist/invoker-fallback-used.js.map +1 -0
- package/dist/invoker-fallback.d.ts +4 -0
- package/dist/invoker-fallback.js +15 -0
- package/dist/invoker-fallback.js.map +1 -0
- package/dist/invokers-shim.d.ts +6 -0
- package/dist/invokers-shim.js +32 -0
- package/dist/invokers-shim.js.map +1 -0
- package/dist/invokers.d.ts +3 -5
- package/dist/invokers.js +11 -51
- package/dist/invokers.js.map +1 -1
- package/dist/islands.d.ts +0 -2
- package/dist/islands.js +4 -11
- package/dist/islands.js.map +1 -1
- package/dist/light-dom.d.ts +4 -53
- package/dist/light-dom.js +5 -100
- package/dist/light-dom.js.map +1 -1
- package/dist/prop.d.ts +89 -0
- package/dist/prop.js +41 -0
- package/dist/prop.js.map +1 -0
- package/dist/props.d.ts +57 -21
- package/dist/props.js +157 -34
- package/dist/props.js.map +1 -1
- package/dist/retry.d.ts +15 -0
- package/dist/retry.js +48 -0
- package/dist/retry.js.map +1 -0
- package/dist/scheduler.d.ts +43 -0
- package/dist/scheduler.js +212 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/script-json.d.ts +2 -0
- package/dist/script-json.js +13 -0
- package/dist/script-json.js.map +1 -0
- package/dist/server-component.d.ts +10 -0
- package/dist/server-component.js +133 -0
- package/dist/server-component.js.map +1 -0
- package/dist/server-specs.d.ts +6 -0
- package/dist/server-specs.js +13 -0
- package/dist/server-specs.js.map +1 -0
- package/dist/server.d.ts +34 -0
- package/dist/server.js +59 -0
- package/dist/server.js.map +1 -0
- package/dist/settled.d.ts +11 -0
- package/dist/settled.js +62 -0
- package/dist/settled.js.map +1 -0
- package/dist/spec-features-used.d.ts +21 -0
- package/dist/spec-features-used.js +50 -0
- package/dist/spec-features-used.js.map +1 -0
- package/dist/spec-features.d.ts +28 -0
- package/dist/spec-features.js +42 -0
- package/dist/spec-features.js.map +1 -0
- package/dist/states.d.ts +3 -5
- package/dist/states.js +22 -11
- package/dist/states.js.map +1 -1
- package/dist/storage.d.ts +69 -0
- package/dist/storage.js +158 -0
- package/dist/storage.js.map +1 -0
- package/dist/store-binding.d.ts +6 -3
- package/dist/store-binding.js +7 -8
- package/dist/store-binding.js.map +1 -1
- package/dist/store-scope.d.ts +8 -11
- package/dist/store-scope.js +15 -40
- package/dist/store-scope.js.map +1 -1
- package/dist/store.d.ts +3 -0
- package/dist/store.js +45 -10
- package/dist/store.js.map +1 -1
- package/dist/stores-provider.d.ts +2 -6
- package/dist/stores-provider.js +21 -55
- package/dist/stores-provider.js.map +1 -1
- package/dist/subscription.d.ts +35 -0
- package/dist/subscription.js +74 -0
- package/dist/subscription.js.map +1 -0
- package/dist/subscriptions.d.ts +26 -0
- package/dist/subscriptions.js +98 -0
- package/dist/subscriptions.js.map +1 -0
- package/dist/transitions.d.ts +5 -7
- package/dist/transitions.js +17 -20
- package/dist/transitions.js.map +1 -1
- package/dist/types.d.ts +142 -49
- package/dist/types.js.map +1 -1
- package/dist/use-dialogs.d.ts +2 -0
- package/dist/use-dialogs.js +9 -0
- package/dist/use-dialogs.js.map +1 -0
- package/dist/use-disposal.d.ts +2 -0
- package/dist/use-disposal.js +9 -0
- package/dist/use-disposal.js.map +1 -0
- package/dist/use-error-view.d.ts +2 -0
- package/dist/use-error-view.js +9 -0
- package/dist/use-error-view.js.map +1 -0
- package/dist/use-errored.d.ts +2 -0
- package/dist/use-errored.js +9 -0
- package/dist/use-errored.js.map +1 -0
- package/dist/use-form-associated.d.ts +2 -0
- package/dist/use-form-associated.js +7 -0
- package/dist/use-form-associated.js.map +1 -0
- package/dist/use-frame-lane.d.ts +2 -0
- package/dist/use-frame-lane.js +10 -0
- package/dist/use-frame-lane.js.map +1 -0
- package/dist/use-invokers.d.ts +2 -0
- package/dist/use-invokers.js +10 -0
- package/dist/use-invokers.js.map +1 -0
- package/dist/use-states.d.ts +2 -0
- package/dist/use-states.js +10 -0
- package/dist/use-states.js.map +1 -0
- package/dist/use-subscriptions.d.ts +2 -0
- package/dist/use-subscriptions.js +10 -0
- package/dist/use-subscriptions.js.map +1 -0
- package/dist/use-transitions.d.ts +2 -0
- package/dist/use-transitions.js +10 -0
- package/dist/use-transitions.js.map +1 -0
- package/dist/view/attributes.d.ts +11 -0
- package/dist/view/attributes.js +15 -0
- package/dist/view/attributes.js.map +1 -0
- package/dist/view/compiled.d.ts +1 -0
- package/dist/view/compiled.js +6 -0
- package/dist/view/compiled.js.map +1 -0
- package/dist/view/dev-off.d.ts +1 -0
- package/dist/view/dev-off.js +4 -0
- package/dist/view/dev-off.js.map +1 -0
- package/dist/view/dev.d.ts +1 -0
- package/dist/view/dev.js +5 -0
- package/dist/view/dev.js.map +1 -0
- package/dist/view/flags.d.ts +1 -0
- package/dist/view/flags.js +4 -0
- package/dist/view/flags.js.map +1 -0
- package/dist/view/index.d.ts +26 -0
- package/dist/view/index.js +27 -0
- package/dist/view/index.js.map +1 -0
- package/dist/view/loc.d.ts +9 -0
- package/dist/view/loc.js +50 -0
- package/dist/view/loc.js.map +1 -0
- package/dist/view/message.d.ts +17 -0
- package/dist/view/message.js +40 -0
- package/dist/view/message.js.map +1 -0
- package/dist/view/messages.d.ts +43 -0
- package/dist/view/messages.js +84 -0
- package/dist/view/messages.js.map +1 -0
- package/dist/view/normalize/check.d.ts +23 -0
- package/dist/view/normalize/check.js +81 -0
- package/dist/view/normalize/check.js.map +1 -0
- package/dist/view/normalize/emit.d.ts +15 -0
- package/dist/view/normalize/emit.js +165 -0
- package/dist/view/normalize/emit.js.map +1 -0
- package/dist/view/normalize/entities.d.ts +4 -0
- package/dist/view/normalize/entities.js +38 -0
- package/dist/view/normalize/entities.js.map +1 -0
- package/dist/view/normalize/errors.d.ts +9 -0
- package/dist/view/normalize/errors.js +19 -0
- package/dist/view/normalize/errors.js.map +1 -0
- package/dist/view/normalize/id.d.ts +10 -0
- package/dist/view/normalize/id.js +55 -0
- package/dist/view/normalize/id.js.map +1 -0
- package/dist/view/normalize/normalize.d.ts +18 -0
- package/dist/view/normalize/normalize.js +42 -0
- package/dist/view/normalize/normalize.js.map +1 -0
- package/dist/view/normalize/repairs.d.ts +24 -0
- package/dist/view/normalize/repairs.js +166 -0
- package/dist/view/normalize/repairs.js.map +1 -0
- package/dist/view/normalize/rules.d.ts +39 -0
- package/dist/view/normalize/rules.js +120 -0
- package/dist/view/normalize/rules.js.map +1 -0
- package/dist/view/normalize/shape.d.ts +5 -0
- package/dist/view/normalize/shape.js +38 -0
- package/dist/view/normalize/shape.js.map +1 -0
- package/dist/view/normalize/source.d.ts +13 -0
- package/dist/view/normalize/source.js +34 -0
- package/dist/view/normalize/source.js.map +1 -0
- package/dist/view/normalize/svg.d.ts +14 -0
- package/dist/view/normalize/svg.js +40 -0
- package/dist/view/normalize/svg.js.map +1 -0
- package/dist/view/normalize/tag-states.d.ts +23 -0
- package/dist/view/normalize/tag-states.js +192 -0
- package/dist/view/normalize/tag-states.js.map +1 -0
- package/dist/view/normalize/tokenizer.d.ts +5 -0
- package/dist/view/normalize/tokenizer.js +233 -0
- package/dist/view/normalize/tokenizer.js.map +1 -0
- package/dist/view/normalize/tokens.d.ts +55 -0
- package/dist/view/normalize/tokens.js +24 -0
- package/dist/view/normalize/tokens.js.map +1 -0
- package/dist/view/normalize/tree.d.ts +65 -0
- package/dist/view/normalize/tree.js +235 -0
- package/dist/view/normalize/tree.js.map +1 -0
- package/dist/view/normalize/types.d.ts +146 -0
- package/dist/view/normalize/types.js +29 -0
- package/dist/view/normalize/types.js.map +1 -0
- package/dist/view/normalize/whitespace.d.ts +2 -0
- package/dist/{template-whitespace.js → view/normalize/whitespace.js} +27 -36
- package/dist/view/normalize/whitespace.js.map +1 -0
- package/dist/view/prepare-stub.d.ts +3 -0
- package/dist/view/prepare-stub.js +7 -0
- package/dist/view/prepare-stub.js.map +1 -0
- package/dist/view/prepare.d.ts +11 -0
- package/dist/view/prepare.js +63 -0
- package/dist/view/prepare.js.map +1 -0
- package/dist/view/registry.d.ts +78 -0
- package/dist/view/registry.js +27 -0
- package/dist/view/registry.js.map +1 -0
- package/dist/view/render/adopt-attr.d.ts +14 -0
- package/dist/view/render/adopt-attr.js +83 -0
- package/dist/view/render/adopt-attr.js.map +1 -0
- package/dist/view/render/adopt-plan.d.ts +10 -0
- package/dist/view/render/adopt-plan.js +26 -0
- package/dist/view/render/adopt-plan.js.map +1 -0
- package/dist/view/render/adopt.d.ts +3 -0
- package/dist/view/render/adopt.js +286 -0
- package/dist/view/render/adopt.js.map +1 -0
- package/dist/view/render/attr-parts.d.ts +72 -0
- package/dist/view/render/attr-parts.js +262 -0
- package/dist/view/render/attr-parts.js.map +1 -0
- package/dist/view/render/child-part.d.ts +51 -0
- package/dist/view/render/child-part.js +173 -0
- package/dist/view/render/child-part.js.map +1 -0
- package/dist/view/render/dev-check.d.ts +12 -0
- package/dist/view/render/dev-check.js +122 -0
- package/dist/view/render/dev-check.js.map +1 -0
- package/dist/view/render/dispose.d.ts +3 -0
- package/dist/view/render/dispose.js +76 -0
- package/dist/view/render/dispose.js.map +1 -0
- package/dist/view/render/hook-part.d.ts +5 -0
- package/dist/view/render/hook-part.js +36 -0
- package/dist/view/render/hook-part.js.map +1 -0
- package/dist/view/render/hook-run.d.ts +2 -0
- package/dist/view/render/hook-run.js +72 -0
- package/dist/view/render/hook-run.js.map +1 -0
- package/dist/view/render/hooks.d.ts +108 -0
- package/dist/view/render/hooks.js +108 -0
- package/dist/view/render/hooks.js.map +1 -0
- package/dist/view/render/hydrate.d.ts +10 -0
- package/dist/view/render/hydrate.js +33 -0
- package/dist/view/render/hydrate.js.map +1 -0
- package/dist/view/render/instance.d.ts +33 -0
- package/dist/view/render/instance.js +107 -0
- package/dist/view/render/instance.js.map +1 -0
- package/dist/view/render/keyed.d.ts +6 -0
- package/dist/view/render/keyed.js +15 -0
- package/dist/view/render/keyed.js.map +1 -0
- package/dist/view/render/list.d.ts +20 -0
- package/dist/view/render/list.js +156 -0
- package/dist/view/render/list.js.map +1 -0
- package/dist/view/render/mismatch.d.ts +10 -0
- package/dist/view/render/mismatch.js +55 -0
- package/dist/view/render/mismatch.js.map +1 -0
- package/dist/view/render/modal.d.ts +3 -0
- package/dist/view/render/modal.js +39 -0
- package/dist/view/render/modal.js.map +1 -0
- package/dist/view/render/nodes.d.ts +10 -0
- package/dist/view/render/nodes.js +37 -0
- package/dist/view/render/nodes.js.map +1 -0
- package/dist/view/render/place.d.ts +18 -0
- package/dist/view/render/place.js +69 -0
- package/dist/view/render/place.js.map +1 -0
- package/dist/view/render/plan.d.ts +26 -0
- package/dist/view/render/plan.js +124 -0
- package/dist/view/render/plan.js.map +1 -0
- package/dist/view/render/raw.d.ts +21 -0
- package/dist/view/render/raw.js +72 -0
- package/dist/view/render/raw.js.map +1 -0
- package/dist/view/render/render.d.ts +15 -0
- package/dist/view/render/render.js +65 -0
- package/dist/view/render/render.js.map +1 -0
- package/dist/view/render/reorder.d.ts +4 -0
- package/dist/view/render/reorder.js +101 -0
- package/dist/view/render/reorder.js.map +1 -0
- package/dist/view/render/rows.d.ts +23 -0
- package/dist/view/render/rows.js +95 -0
- package/dist/view/render/rows.js.map +1 -0
- package/dist/view/render/seen.d.ts +11 -0
- package/dist/view/render/seen.js +17 -0
- package/dist/view/render/seen.js.map +1 -0
- package/dist/view/render/toggles.d.ts +6 -0
- package/dist/view/render/toggles.js +6 -0
- package/dist/view/render/toggles.js.map +1 -0
- package/dist/view/render/values.d.ts +29 -0
- package/dist/view/render/values.js +13 -0
- package/dist/view/render/values.js.map +1 -0
- package/dist/view/render/warn.d.ts +28 -0
- package/dist/view/render/warn.js +114 -0
- package/dist/view/render/warn.js.map +1 -0
- package/dist/view/server/component.d.ts +12 -0
- package/dist/view/server/component.js +64 -0
- package/dist/view/server/component.js.map +1 -0
- package/dist/view/server/escape.d.ts +10 -0
- package/dist/view/server/escape.js +34 -0
- package/dist/view/server/escape.js.map +1 -0
- package/dist/view/server/index.d.ts +48 -0
- package/dist/view/server/index.js +80 -0
- package/dist/view/server/index.js.map +1 -0
- package/dist/view/server/sha256.d.ts +2 -0
- package/dist/view/server/sha256.js +75 -0
- package/dist/view/server/sha256.js.map +1 -0
- package/dist/view/server/tags.d.ts +68 -0
- package/dist/view/server/tags.js +132 -0
- package/dist/view/server/tags.js.map +1 -0
- package/dist/view/server/values.d.ts +18 -0
- package/dist/view/server/values.js +94 -0
- package/dist/view/server/values.js.map +1 -0
- package/dist/view/server/writer.d.ts +21 -0
- package/dist/view/server/writer.js +170 -0
- package/dist/view/server/writer.js.map +1 -0
- package/dist/view/styles.d.ts +25 -0
- package/dist/view/styles.js +58 -0
- package/dist/view/styles.js.map +1 -0
- package/dist/view/template-element.d.ts +10 -0
- package/dist/view/template-element.js +45 -0
- package/dist/view/template-element.js.map +1 -0
- package/dist/view/template.d.ts +29 -0
- package/dist/view/template.js +84 -0
- package/dist/view/template.js.map +1 -0
- package/dist/view/trusted-html.d.ts +6 -0
- package/dist/view/trusted-html.js +34 -0
- package/dist/view/trusted-html.js.map +1 -0
- package/dist/vite.d.ts +57 -11
- package/dist/vite.js +319 -27
- package/dist/vite.js.map +1 -1
- package/package.json +70 -4
- package/dist/accessible-name.d.ts +0 -19
- package/dist/accessible-name.js +0 -56
- package/dist/accessible-name.js.map +0 -1
- package/dist/element-directive.d.ts +0 -20
- package/dist/element-directive.js +0 -31
- package/dist/element-directive.js.map +0 -1
- package/dist/invalid.d.ts +0 -21
- package/dist/invalid.js +0 -70
- package/dist/invalid.js.map +0 -1
- package/dist/lit-html-check.d.ts +0 -6
- package/dist/lit-html-check.js +0 -48
- package/dist/lit-html-check.js.map +0 -1
- package/dist/live-boolean.d.ts +0 -22
- package/dist/live-boolean.js +0 -34
- package/dist/live-boolean.js.map +0 -1
- package/dist/random.d.ts +0 -13
- package/dist/random.js +0 -19
- package/dist/random.js.map +0 -1
- package/dist/styles.d.ts +0 -12
- package/dist/styles.js +0 -11
- package/dist/styles.js.map +0 -1
- package/dist/template-whitespace.d.ts +0 -7
- package/dist/template-whitespace.js.map +0 -1
- package/dist/templates.d.ts +0 -5
- package/dist/templates.js +0 -15
- package/dist/templates.js.map +0 -1
- package/dist/textarea.d.ts +0 -26
- package/dist/textarea.js +0 -85
- package/dist/textarea.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/view/render/plan.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,sFAAsF;AACtF,+FAA+F;AAC/F,8FAA8F;AAC9F,mFAAmF;AACnF,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,GAGV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,IAAI,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I,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACrC,KAAK,SAAS;YACZ,OAAO,IAAI,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,IAAI,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;QACxD;YACE,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/E,CAAC;AACH,CAAC;AAED,MAAM,KAAK,GAAG,IAAI,OAAO,EAAwB,CAAC;AAClD,IAAI,YAAwC,CAAC;AAC7C,IAAI,QAA0B,CAAC;AAE/B,gGAAgG;AAChG,MAAM,UAAU,MAAM,CAAC,QAAwB;IAC7C,IAAI,QAAQ,KAAK,YAAY;QAAE,OAAO,QAAgB,CAAC;IACvD,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QACvB,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;IACD,YAAY,GAAG,QAAQ,CAAC;IACxB,QAAQ,GAAG,IAAI,CAAC;IAChB,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// Instantiation plans (view/01-templates.md \"Instantiation\"): computed once per template object,\n// they say how to reach every part's nodes in a clone by child-index paths, following\n// firstChild/nextSibling and sharing prefixes (no TreeWalker, no marker search), and what each\n// part is. Part kinds that depend on the element (live form state) are decided here, from the\n// template's own parsed content, so creating an instance only walks and allocates.\nimport {\n ATTR_PART,\n BOOL_PART,\n CHILD_BEFORE,\n CHILD_SOLE,\n MULTI_PART,\n PROP_PART,\n HOOK_PART,\n TEXT_PART,\n type PartSpec,\n type TemplateObject,\n} from '../normalize/types.js';\nimport { templateElement } from '../template-element.js';\nimport { attrKind, HOOK, MULTI, PROP, TEXTAREA, TITLE } from './attr-parts.js';\n\n/** Plan kinds of child parts (element parts use their attr-parts.ts kind, ≥ 0). */\nexport const CHILD = -1;\nexport const SOLE = -2;\nexport const ROOT = -3;\n\nexport interface Plan {\n readonly content: DocumentFragment;\n /** One root node and no root-level holes: clone that node instead of the fragment. */\n readonly single: boolean;\n /** Per target node, in document order: keep depth, sibling skip (-1: none), n, n indexes. */\n readonly ops: readonly number[];\n readonly targets: number;\n /** Per part: its element's (or child part's parent's) target, its reference node's target. */\n readonly a: readonly number[];\n readonly b: readonly number[];\n /** Per part: the index of its (first) value, and its kind. */\n readonly at: readonly number[];\n readonly kinds: readonly number[];\n}\n\n/** Scratch space for walks (never re-entrant: nested instances are created after the walk). */\nexport const stack: Node[] = [];\nexport const nodes: Node[] = [];\n\n/** Fills `nodes` with each target of `plan`, walking from `stack[0]` (or `stack[1]`). */\nexport function walk(plan: Plan): void {\n const ops = plan.ops;\n let k = 0;\n for (let t = 0; t < plan.targets; t++) {\n const keep = ops[k] as number;\n const skip = ops[k + 1] as number;\n const n = ops[k + 2] as number;\n k += 3;\n let depth = keep;\n let node = stack[keep] as Node;\n if (skip >= 0) {\n node = stack[++depth] as Node;\n for (let s = 0; s < skip; s++) node = node.nextSibling as Node;\n stack[depth] = node;\n }\n for (let j = 0; j < n; j++) {\n node = node.firstChild as Node;\n for (let s = ops[k++] as number; s > 0; s--) node = node.nextSibling as Node;\n stack[++depth] = node;\n }\n nodes[t] = node;\n }\n}\n\nfunction build(template: TemplateObject): Plan {\n const content = templateElement(template).content;\n const single = content.childNodes.length === 1 && template.parts.every((p) => p[1].length > 0);\n const ids = new Map<string, number>();\n const ops: number[] = [];\n let cursor: readonly number[] = single ? [0] : [];\n const target = (path: readonly number[]): number => {\n const id = path.join();\n const known = ids.get(id);\n if (known !== undefined) return known;\n let keep = 0;\n while (keep < path.length && path[keep] === cursor[keep]) keep++;\n if (keep === path.length) {\n ops.push(keep, -1, 0); // an ancestor of the cursor (or the cursor itself)\n } else {\n const from = (cursor[keep] ?? Infinity) < (path[keep] as number) ? keep + 1 : keep;\n const skip = from > keep ? (path[keep] as number) - (cursor[keep] as number) : -1;\n ops.push(keep, skip, path.length - from, ...path.slice(from));\n cursor = path;\n }\n ids.set(id, ids.size);\n return ids.size - 1;\n };\n const a: number[] = [];\n const b: number[] = [];\n const at: number[] = [];\n let value = 0;\n for (const spec of template.parts) {\n a.push(target(spec[1]));\n b.push(spec[0] === CHILD_BEFORE ? target([...spec[1], spec[2]]) : -1);\n at.push(value);\n value += spec[0] === MULTI_PART ? spec[3].length - 1 : 1;\n }\n const kinds: number[] = [];\n const plan: Plan = { content, single, ops, targets: ids.size, a, b, at, kinds };\n // Walk the template's own content once to decide the element-dependent kinds.\n stack[0] = content;\n if (single) stack[1] = content.firstChild as Node;\n walk(plan);\n template.parts.forEach((spec, i) => {\n kinds.push(kindOf(spec, nodes[a[i] as number] as Element));\n });\n return plan;\n}\n\nfunction kindOf(spec: PartSpec, el: Element): number {\n switch (spec[0]) {\n case ATTR_PART:\n return attrKind(el, spec[2], false);\n case MULTI_PART:\n return MULTI;\n case BOOL_PART:\n return attrKind(el, spec[2], true);\n case PROP_PART:\n return PROP;\n case HOOK_PART:\n return HOOK;\n case TEXT_PART:\n return el.localName === 'textarea' ? TEXTAREA : TITLE;\n default:\n return spec[1].length === 0 ? ROOT : spec[0] === CHILD_SOLE ? SOLE : CHILD;\n }\n}\n\nconst plans = new WeakMap<TemplateObject, Plan>();\nlet lastTemplate: TemplateObject | undefined;\nlet lastPlan: Plan | undefined;\n\n/** The plan of `template` (one-entry cache in front of the WeakMap: rows repeat a template). */\nexport function planOf(template: TemplateObject): Plan {\n if (template === lastTemplate) return lastPlan as Plan;\n let plan = plans.get(template);\n if (plan === undefined) {\n plan = build(template);\n plans.set(template, plan);\n }\n lastTemplate = template;\n lastPlan = plan;\n return plan;\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type RawResult } from './values.js';
|
|
2
|
+
/** Parsed `raw()` markup: the start anchor, the last node, and the string. */
|
|
3
|
+
export declare class RawRange {
|
|
4
|
+
readonly start: Comment;
|
|
5
|
+
end: Node;
|
|
6
|
+
html: string;
|
|
7
|
+
constructor(start: Comment, end: Node, html: string);
|
|
8
|
+
first(): Node;
|
|
9
|
+
last(): Node;
|
|
10
|
+
remove(): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* `html` parsed by a <template> through the `gyral` Trusted Types policy (its content is reused:
|
|
14
|
+
* read it before the next call).
|
|
15
|
+
*/
|
|
16
|
+
export declare function parse(html: string): DocumentFragment;
|
|
17
|
+
/**
|
|
18
|
+
* Trusted markup from your own code (Markdown output, JSON-LD), parsed in a child hole and
|
|
19
|
+
* re-parsed only when the string changes. Never pass user input.
|
|
20
|
+
*/
|
|
21
|
+
export declare function raw(html: string): RawResult;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// `raw(html)` (view/02-bindings.md "`raw(html)`"): trusted markup parsed in a child hole, kept
|
|
2
|
+
// as a node range after a start anchor and re-parsed only when the string changes. Its result
|
|
3
|
+
// carries `commitRaw`, so apps that never call `raw` don't bundle this module.
|
|
4
|
+
import { DEV } from '#view-dev';
|
|
5
|
+
import { EMPTY, RAW } from './child-part.js';
|
|
6
|
+
import { removeRange } from './nodes.js';
|
|
7
|
+
import { trustedHTML } from '../trusted-html.js';
|
|
8
|
+
import { report } from './seen.js';
|
|
9
|
+
import { MARKUP } from './values.js';
|
|
10
|
+
import { warnRaw } from './warn.js';
|
|
11
|
+
/** Parsed `raw()` markup: the start anchor, the last node, and the string. */
|
|
12
|
+
export class RawRange {
|
|
13
|
+
constructor(start, end, html) {
|
|
14
|
+
this.start = start;
|
|
15
|
+
this.end = end;
|
|
16
|
+
this.html = html;
|
|
17
|
+
}
|
|
18
|
+
first() {
|
|
19
|
+
return this.start;
|
|
20
|
+
}
|
|
21
|
+
last() {
|
|
22
|
+
return this.end;
|
|
23
|
+
}
|
|
24
|
+
remove() {
|
|
25
|
+
removeRange(this.start, this.end);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
let parser;
|
|
29
|
+
/**
|
|
30
|
+
* `html` parsed by a <template> through the `gyral` Trusted Types policy (its content is reused:
|
|
31
|
+
* read it before the next call).
|
|
32
|
+
*/
|
|
33
|
+
export function parse(html) {
|
|
34
|
+
parser ??= document.createElement('template');
|
|
35
|
+
parser.innerHTML = trustedHTML(html);
|
|
36
|
+
return parser.content;
|
|
37
|
+
}
|
|
38
|
+
/** Commits `raw()` markup into `part`. */
|
|
39
|
+
function commitRaw(part, html) {
|
|
40
|
+
if (DEV)
|
|
41
|
+
warnRaw();
|
|
42
|
+
report({ html });
|
|
43
|
+
if (part.kind === RAW) {
|
|
44
|
+
const range = part.content;
|
|
45
|
+
if (range.html === html)
|
|
46
|
+
return;
|
|
47
|
+
if (range.end !== range.start)
|
|
48
|
+
removeRange(range.start.nextSibling, range.end);
|
|
49
|
+
const frag = parse(html);
|
|
50
|
+
range.end = frag.lastChild ?? range.start;
|
|
51
|
+
range.html = html;
|
|
52
|
+
range.start.after(frag);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (part.kind !== EMPTY)
|
|
56
|
+
part.clear();
|
|
57
|
+
const start = document.createComment('');
|
|
58
|
+
const frag = parse(html);
|
|
59
|
+
const end = frag.lastChild ?? start;
|
|
60
|
+
frag.prepend(start);
|
|
61
|
+
part.parent().insertBefore(frag, part.end());
|
|
62
|
+
part.kind = RAW;
|
|
63
|
+
part.content = new RawRange(start, end, html);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Trusted markup from your own code (Markdown output, JSON-LD), parsed in a child hole and
|
|
67
|
+
* re-parsed only when the string changes. Never pass user input.
|
|
68
|
+
*/
|
|
69
|
+
export function raw(html) {
|
|
70
|
+
return { [MARKUP]: commitRaw, html };
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=raw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw.js","sourceRoot":"","sources":["../../../src/view/render/raw.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,8FAA8F;AAC9F,+EAA+E;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAkB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,MAAM,EAAkB,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,8EAA8E;AAC9E,MAAM,OAAO,QAAQ;IACnB,YACW,KAAc,EAChB,GAAS,EACT,IAAY;QAFV,UAAK,GAAL,KAAK,CAAS;QAChB,QAAG,GAAH,GAAG,CAAM;QACT,SAAI,GAAJ,IAAI,CAAQ;IAClB,CAAC;IAEJ,KAAK;QACH,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,MAAM;QACJ,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;CACF;AAED,IAAI,MAAuC,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY;IAChC,MAAM,KAAK,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,CAAC,SAAS,GAAG,WAAW,CAAC,IAAI,C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,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AAChD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,IAAY;IAC9B,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACvC,CAAC","sourcesContent":["// `raw(html)` (view/02-bindings.md \"`raw(html)`\"): trusted markup parsed in a child hole, kept\n// as a node range after a start anchor and re-parsed only when the string changes. Its result\n// carries `commitRaw`, so apps that never call `raw` don't bundle this module.\nimport { DEV } from '#view-dev';\nimport { EMPTY, RAW, type ChildPart } from './child-part.js';\nimport { removeRange } from './nodes.js';\nimport { trustedHTML } from '../trusted-html.js';\nimport { report } from './seen.js';\nimport { MARKUP, type RawResult } from './values.js';\nimport { warnRaw } from './warn.js';\n\n/** Parsed `raw()` markup: the start anchor, the last node, and the string. */\nexport class RawRange {\n constructor(\n readonly start: Comment,\n public end: Node,\n public html: string,\n ) {}\n\n first(): Node {\n return this.start;\n }\n\n last(): Node {\n return this.end;\n }\n\n remove(): void {\n removeRange(this.start, this.end);\n }\n}\n\nlet parser: HTMLTemplateElement | undefined;\n\n/**\n * `html` parsed by a <template> through the `gyral` Trusted Types policy (its content is reused:\n * read it before the next call).\n */\nexport function parse(html: string): DocumentFragment {\n parser ??= document.createElement('template');\n parser.innerHTML = trustedHTML(html);\n return parser.content;\n}\n\n/** Commits `raw()` markup into `part`. */\nfunction commitRaw(part: ChildPart, html: string): void {\n if (DEV) warnRaw();\n report({ html });\n if (part.kind === RAW) {\n const range = part.content as RawRange;\n if (range.html === html) return;\n if (range.end !== range.start) removeRange(range.start.nextSibling as Node, range.end);\n const frag = parse(html);\n range.end = frag.lastChild ?? range.start;\n range.html = html;\n range.start.after(frag);\n return;\n }\n if (part.kind !== EMPTY) part.clear();\n const start = document.createComment('');\n const frag = parse(html);\n const end = frag.lastChild ?? start;\n frag.prepend(start);\n part.parent().insertBefore(frag, part.end());\n part.kind = RAW;\n part.content = new RawRange(start, end, html);\n}\n\n/**\n * Trusted markup from your own code (Markdown output, JSON-LD), parsed in a child hole and\n * re-parsed only when the string changes. Never pass user input.\n */\nexport function raw(html: string): RawResult {\n return { [MARKUP]: commitRaw, html };\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChildPart } from './child-part.js';
|
|
2
|
+
import { type SeenMarkup } from './seen.js';
|
|
3
|
+
import type { ChildValue } from './values.js';
|
|
4
|
+
/**
|
|
5
|
+
* Runs `fn` (one scheduler flush) with one shared row-check budget for every render in it, and
|
|
6
|
+
* element hooks deferred to `flushHooks` (after each pass) and the end of the flush.
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderBatch(fn: () => void): void;
|
|
9
|
+
/**
|
|
10
|
+
* Renders `value` into `root`, updating what an earlier call rendered there. `seen` is told
|
|
11
|
+
* about each template the render instantiates (seen.ts).
|
|
12
|
+
*/
|
|
13
|
+
export declare function render(value: ChildValue, root: Element | ShadowRoot | DocumentFragment, seen?: SeenMarkup): void;
|
|
14
|
+
/** Hydration (hydrate.ts): `part`, built over server DOM, is `root`'s part from now on. */
|
|
15
|
+
export declare function setRootPart(root: Node, part: ChildPart): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// `render(value, root)`: the client renderer's entry point (view/02-bindings.md "Commit order").
|
|
2
|
+
// The root's child part is cached per root, so later calls update in place. Synchronous: when
|
|
3
|
+
// it returns, the DOM is committed, and outside a flush every element hook's `client` call has
|
|
4
|
+
// run. The scheduler (view/04-scheduler.md) calls it once per dirty host, inside `renderBatch`,
|
|
5
|
+
// so the list dev check's budget (03) is per flush and hooks run once every host has rendered,
|
|
6
|
+
// children first (hooks.ts); a call outside a batch gets a budget and a hook run of its own.
|
|
7
|
+
// `hydrate(value, root)` (hydrate.ts) makes the same root part from server DOM instead (07).
|
|
8
|
+
import { DEV } from '#view-dev';
|
|
9
|
+
import { ChildPart } from './child-part.js';
|
|
10
|
+
import { resetRowChecks } from './dev-check.js';
|
|
11
|
+
import { dropHooks, endHooks, hookMark, runHooks, startHooks } from './hooks.js';
|
|
12
|
+
import { listenFor } from './seen.js';
|
|
13
|
+
const roots = new WeakMap();
|
|
14
|
+
let batching = false;
|
|
15
|
+
/**
|
|
16
|
+
* Runs `fn` (one scheduler flush) with one shared row-check budget for every render in it, and
|
|
17
|
+
* element hooks deferred to `flushHooks` (after each pass) and the end of the flush.
|
|
18
|
+
*/
|
|
19
|
+
export function renderBatch(fn) {
|
|
20
|
+
if (DEV)
|
|
21
|
+
resetRowChecks(); // the budget is a development check
|
|
22
|
+
const outer = batching;
|
|
23
|
+
startHooks(); // element hooks wait for the flush (hook-run.ts)
|
|
24
|
+
let ok = false;
|
|
25
|
+
batching = true;
|
|
26
|
+
try {
|
|
27
|
+
fn();
|
|
28
|
+
ok = true;
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
batching = outer;
|
|
32
|
+
endHooks(ok);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Renders `value` into `root`, updating what an earlier call rendered there. `seen` is told
|
|
37
|
+
* about each template the render instantiates (seen.ts).
|
|
38
|
+
*/
|
|
39
|
+
export function render(value, root, seen) {
|
|
40
|
+
let part = roots.get(root);
|
|
41
|
+
if (part === undefined) {
|
|
42
|
+
part = new ChildPart(root, null, null, 0, false, 0);
|
|
43
|
+
roots.set(root, part);
|
|
44
|
+
}
|
|
45
|
+
const mark = hookMark(root);
|
|
46
|
+
if (DEV && !batching)
|
|
47
|
+
resetRowChecks();
|
|
48
|
+
const outer = listenFor(seen);
|
|
49
|
+
try {
|
|
50
|
+
part.commit(value);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
dropHooks(mark);
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
listenFor(outer);
|
|
58
|
+
}
|
|
59
|
+
runHooks(mark, root);
|
|
60
|
+
}
|
|
61
|
+
/** Hydration (hydrate.ts): `part`, built over server DOM, is `root`'s part from now on. */
|
|
62
|
+
export function setRootPart(root, part) {
|
|
63
|
+
roots.set(root, part);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/view/render/render.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,8FAA8F;AAC9F,+FAA+F;AAC/F,gGAAgG;AAChG,+FAA+F;AAC/F,6FAA6F;AAC7F,6FAA6F;AAC7F,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,SAAS,EAAmB,MAAM,WAAW,CAAC;AAGvD,MAAM,KAAK,GAAG,IAAI,OAAO,EAAmB,CAAC;AAC7C,IAAI,QAAQ,GAAG,KAAK,CAAC;AAErB;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAAc;IACxC,IAAI,GAAG;QAAE,cAAc,EAAE,CAAC,CAAC,oCAAoC;IAC/D,MAAM,KAAK,GAAG,QAAQ,CAAC;IACvB,UAAU,EAAE,CAAC,CAAC,iDAAiD;IAC/D,IAAI,EAAE,GAAG,KAAK,CAAC;IACf,QAAQ,GAAG,IAAI,CAAC;IAChB,IAAI,CAAC;QACH,EAAE,EAAE,CAAC;QACL,EAAE,GAAG,IAAI,CAAC;IACZ,CAAC;YAAS,CAAC;QACT,QAAQ,GAAG,KAAK,CAAC;QACjB,QAAQ,CAAC,EAAE,CAAC,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CACpB,KAAiB,EACjB,IAA6C,EAC7C,IAAiB;IAEjB,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,IAAI,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QACpD,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACxB,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,GAAG,IAAI,CAAC,QAAQ;QAAE,cAAc,EAAE,CAAC;IACvC,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,SAAS,CAAC,IAAI,CAAC,CAAC;QAChB,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,SAAS,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IACD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACvB,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,WAAW,CAAC,IAAU,EAAE,IAAe;IACrD,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACxB,CAAC","sourcesContent":["// `render(value, root)`: the client renderer's entry point (view/02-bindings.md \"Commit order\").\n// The root's child part is cached per root, so later calls update in place. Synchronous: when\n// it returns, the DOM is committed, and outside a flush every element hook's `client` call has\n// run. The scheduler (view/04-scheduler.md) calls it once per dirty host, inside `renderBatch`,\n// so the list dev check's budget (03) is per flush and hooks run once every host has rendered,\n// children first (hooks.ts); a call outside a batch gets a budget and a hook run of its own.\n// `hydrate(value, root)` (hydrate.ts) makes the same root part from server DOM instead (07).\nimport { DEV } from '#view-dev';\nimport { ChildPart } from './child-part.js';\nimport { resetRowChecks } from './dev-check.js';\nimport { dropHooks, endHooks, hookMark, runHooks, startHooks } from './hooks.js';\nimport { listenFor, type SeenMarkup } from './seen.js';\nimport type { ChildValue } from './values.js';\n\nconst roots = new WeakMap<Node, ChildPart>();\nlet batching = false;\n\n/**\n * Runs `fn` (one scheduler flush) with one shared row-check budget for every render in it, and\n * element hooks deferred to `flushHooks` (after each pass) and the end of the flush.\n */\nexport function renderBatch(fn: () => void): void {\n if (DEV) resetRowChecks(); // the budget is a development check\n const outer = batching;\n startHooks(); // element hooks wait for the flush (hook-run.ts)\n let ok = false;\n batching = true;\n try {\n fn();\n ok = true;\n } finally {\n batching = outer;\n endHooks(ok);\n }\n}\n\n/**\n * Renders `value` into `root`, updating what an earlier call rendered there. `seen` is told\n * about each template the render instantiates (seen.ts).\n */\nexport function render(\n value: ChildValue,\n root: Element | ShadowRoot | DocumentFragment,\n seen?: SeenMarkup,\n): void {\n let part = roots.get(root);\n if (part === undefined) {\n part = new ChildPart(root, null, null, 0, false, 0);\n roots.set(root, part);\n }\n const mark = hookMark(root);\n if (DEV && !batching) resetRowChecks();\n const outer = listenFor(seen);\n try {\n part.commit(value);\n } catch (error) {\n dropHooks(mark);\n throw error;\n } finally {\n listenFor(outer);\n }\n runHooks(mark, root);\n}\n\n/** Hydration (hydrate.ts): `part`, built over server DOM, is `root`'s part from now on. */\nexport function setRootPart(root: Node, part: ChildPart): void {\n roots.set(root, part);\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChildPart } from './child-part.js';
|
|
2
|
+
import { type List } from './rows.js';
|
|
3
|
+
import type { ListResult } from './values.js';
|
|
4
|
+
export declare function reorder(part: ChildPart, list: List, l: ListResult, rows: ChildPart[], s: number, oe: number, ne: number): void;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { clearList, createRows } from './list.js';
|
|
2
|
+
import { lis, placeRows } from './place.js';
|
|
3
|
+
import { firstFrom, newRow, updateRow } from './rows.js';
|
|
4
|
+
function match(old, keys, s, oe, ne) {
|
|
5
|
+
const src = new Int32Array(ne - s + 1).fill(-1);
|
|
6
|
+
const keep = new Uint8Array(ne - s + 1);
|
|
7
|
+
const m = { src, keep, found: 0 };
|
|
8
|
+
let os = s;
|
|
9
|
+
let ns = s;
|
|
10
|
+
for (; os <= oe && ns <= ne; m.found++) {
|
|
11
|
+
const head = old[os].key;
|
|
12
|
+
const tail = old[oe].key;
|
|
13
|
+
if (keys[ns - s] === head) {
|
|
14
|
+
keep[ns - s] = 1;
|
|
15
|
+
src[ns++ - s] = os++;
|
|
16
|
+
}
|
|
17
|
+
else if (keys[ne - s] === tail) {
|
|
18
|
+
keep[ne - s] = 1;
|
|
19
|
+
src[ne-- - s] = oe--;
|
|
20
|
+
}
|
|
21
|
+
else if (keys[ne - s] === head)
|
|
22
|
+
src[ne-- - s] = os++;
|
|
23
|
+
else if (keys[ns - s] === tail)
|
|
24
|
+
src[ns++ - s] = oe--;
|
|
25
|
+
else
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
if (os > oe || ns > ne)
|
|
29
|
+
return m;
|
|
30
|
+
m.keep = undefined;
|
|
31
|
+
const byKey = new Map();
|
|
32
|
+
for (let j = os; j <= oe; j++)
|
|
33
|
+
byKey.set(old[j].key, j);
|
|
34
|
+
for (let i = ns; i <= ne; i++) {
|
|
35
|
+
const key = keys[i - s];
|
|
36
|
+
const j = byKey.get(key);
|
|
37
|
+
if (j === undefined)
|
|
38
|
+
continue; // a new key (or, in production, a later duplicate)
|
|
39
|
+
byKey.delete(key);
|
|
40
|
+
src[i - s] = j;
|
|
41
|
+
m.found++;
|
|
42
|
+
}
|
|
43
|
+
return m;
|
|
44
|
+
}
|
|
45
|
+
export function reorder(part, list, l, rows, s, oe, ne) {
|
|
46
|
+
const { items, key } = l;
|
|
47
|
+
const old = list.rows;
|
|
48
|
+
const keys = [];
|
|
49
|
+
for (let i = s; i <= ne; i++)
|
|
50
|
+
keys.push(key(items[i]));
|
|
51
|
+
const m = match(old, keys, s, oe, ne);
|
|
52
|
+
const end = firstFrom(old, oe + 1, part);
|
|
53
|
+
if (m.found === 0) {
|
|
54
|
+
// Nothing reused: drop the old rows (all at once when they are the whole list).
|
|
55
|
+
if (s === 0 && oe === old.length - 1)
|
|
56
|
+
clearList(part, list);
|
|
57
|
+
else
|
|
58
|
+
for (let j = s; j <= oe; j++)
|
|
59
|
+
old[j].clear();
|
|
60
|
+
createRows(part, list, l, rows, s, ne, end, keys);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const src = m.src;
|
|
64
|
+
const reused = new Uint8Array(oe - s + 1);
|
|
65
|
+
let frag = null;
|
|
66
|
+
let moved = false;
|
|
67
|
+
let last = -1;
|
|
68
|
+
for (let i = s; i <= ne; i++) {
|
|
69
|
+
const j = src[i - s];
|
|
70
|
+
if (j < 0) {
|
|
71
|
+
frag ??= document.createDocumentFragment();
|
|
72
|
+
rows.push(newRow(null, frag, l, items[i], keys[i - s], i));
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
reused[j - s] = 1;
|
|
76
|
+
if (j < last)
|
|
77
|
+
moved = true;
|
|
78
|
+
else
|
|
79
|
+
last = j;
|
|
80
|
+
const row = old[j];
|
|
81
|
+
updateRow(row, items[i], l);
|
|
82
|
+
rows.push(row);
|
|
83
|
+
}
|
|
84
|
+
for (let j = s; j <= oe; j++)
|
|
85
|
+
if (reused[j - s] === 0)
|
|
86
|
+
old[j].clear();
|
|
87
|
+
if (!moved && frag === null)
|
|
88
|
+
return;
|
|
89
|
+
const keep = moved ? (m.keep ?? lis(src)) : undefined;
|
|
90
|
+
placeRows(part.parent(), rows, s, ne, src, keep, end);
|
|
91
|
+
if (frag === null)
|
|
92
|
+
return;
|
|
93
|
+
for (let i = s; i <= ne; i++) {
|
|
94
|
+
if (src[i - s] >= 0)
|
|
95
|
+
continue;
|
|
96
|
+
const row = rows[i];
|
|
97
|
+
row.parentNode = null;
|
|
98
|
+
row.owner = list;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=reorder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reorder.js","sourceRoot":"","sources":["../../../src/view/render/reorder.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAa,MAAM,WAAW,CAAC;AAWpE,SAAS,KAAK,CACZ,GAAyB,EACzB,IAAwB,EACxB,CAAS,EACT,EAAU,EACV,EAAU;IAEV,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,GAAU,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACzC,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QACvC,MAAM,IAAI,GAAI,GAAG,CAAC,EAAE,CAAe,CAAC,GAAG,CAAC;QACxC,MAAM,IAAI,GAAI,GAAG,CAAC,EAAE,CAAe,CAAC,GAAG,CAAC;QACxC,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAC1B,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACjB,GAAG,CAAC,EAAE,E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KAAK,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO;IACpC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACtD,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,IAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAY,IAAI,CAAC;YAAE,SAAS;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAc,CAAC;QACjC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC;QACtB,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["// Reordering the middle of a list (view/03-lists.md \"Reconciliation\", steps 1–3): old rows\n// `s…oe` become new rows `s…ne` once the common prefix and suffix are trimmed. Keys are matched\n// by a two-ended scan first (head and tail, crossed both ways), so swaps, single moves and\n// reversals need no map: the rows matched in place stay and the crossed ones move. When the\n// scan gets stuck, a key map matches the rest and the rows on a longest increasing subsequence\n// of old positions stay. Reused rows re-render in document order before anything moves; gone\n// rows are removed. The benchmark behind this choice is recorded in the spec.\nimport type { ChildPart } from './child-part.js';\nimport { clearList, createRows } from './list.js';\nimport { lis, placeRows } from './place.js';\nimport { firstFrom, newRow, updateRow, type List } from './rows.js';\nimport type { ListResult } from './values.js';\n\n/** The matching: old positions per new row (-1: new), what stays, and how many were found. */\ninterface Match {\n readonly src: Int32Array;\n /** Rows to keep in place; undefined: compute from `src` (the key map was needed). */\n keep: Uint8Array | undefined;\n found: number;\n}\n\nfunction match(\n old: readonly ChildPart[],\n keys: readonly unknown[],\n s: number,\n oe: number,\n ne: number,\n): Match {\n const src = new Int32Array(ne - s + 1).fill(-1);\n const keep = new Uint8Array(ne - s + 1);\n const m: Match = { src, keep, found: 0 };\n let os = s;\n let ns = s;\n for (; os <= oe && ns <= ne; m.found++) {\n const head = (old[os] as ChildPart).key;\n const tail = (old[oe] as ChildPart).key;\n if (keys[ns - s] === head) {\n keep[ns - s] = 1;\n src[ns++ - s] = os++;\n } else if (keys[ne - s] === tail) {\n keep[ne - s] = 1;\n src[ne-- - s] = oe--;\n } else if (keys[ne - s] === head) src[ne-- - s] = os++;\n else if (keys[ns - s] === tail) src[ns++ - s] = oe--;\n else break;\n }\n if (os > oe || ns > ne) return m;\n m.keep = undefined;\n const byKey = new Map<unknown, number>();\n for (let j = os; j <= oe; j++) byKey.set((old[j] as ChildPart).key, j);\n for (let i = ns; i <= ne; i++) {\n const key = keys[i - s];\n const j = byKey.get(key);\n if (j === undefined) continue; // a new key (or, in production, a later duplicate)\n byKey.delete(key);\n src[i - s] = j;\n m.found++;\n }\n return m;\n}\n\nexport function reorder(\n part: ChildPart,\n list: List,\n l: ListResult,\n rows: ChildPart[],\n s: number,\n oe: number,\n ne: number,\n): void {\n const { items, key } = l;\n const old = list.rows;\n const keys: unknown[] = [];\n for (let i = s; i <= ne; i++) keys.push(key(items[i]));\n const m = match(old, keys, s, oe, ne);\n const end = firstFrom(old, oe + 1, part);\n if (m.found === 0) {\n // Nothing reused: drop the old rows (all at once when they are the whole list).\n if (s === 0 && oe === old.length - 1) clearList(part, list);\n else for (let j = s; j <= oe; j++) (old[j] as ChildPart).clear();\n createRows(part, list, l, rows, s, ne, end, keys);\n return;\n }\n const src = m.src;\n const reused = new Uint8Array(oe - s + 1);\n let frag: DocumentFragment | null = null;\n let moved = false;\n let last = -1;\n for (let i = s; i <= ne; i++) {\n const j = src[i - s] as number;\n if (j < 0) {\n frag ??= document.createDocumentFragment();\n rows.push(newRow(null, frag, l, items[i], keys[i - s], i));\n continue;\n }\n reused[j - s] = 1;\n if (j < last) moved = true;\n else last = j;\n const row = old[j] as ChildPart;\n updateRow(row, items[i], l);\n rows.push(row);\n }\n for (let j = s; j <= oe; j++) if (reused[j - s] === 0) (old[j] as ChildPart).clear();\n if (!moved && frag === null) return;\n const keep = moved ? (m.keep ?? lis(src)) : undefined;\n placeRows(part.parent(), rows, s, ne, src, keep, end);\n if (frag === null) return;\n for (let i = s; i <= ne; i++) {\n if ((src[i - s] as number) >= 0) continue;\n const row = rows[i] as ChildPart;\n row.parentNode = null;\n row.owner = list;\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ChildPart, type Owner } from './child-part.js';
|
|
2
|
+
import type { ListResult } from './values.js';
|
|
3
|
+
/** The rows of a list or the items of an array, owned by one child part. */
|
|
4
|
+
export declare class List implements Owner {
|
|
5
|
+
readonly part: ChildPart;
|
|
6
|
+
rows: ChildPart[];
|
|
7
|
+
/** While rows are created into a fragment: they append to it. */
|
|
8
|
+
building: DocumentFragment | null;
|
|
9
|
+
/** Where the development re-evaluation check continues (dev-check.ts). */
|
|
10
|
+
cursor: number;
|
|
11
|
+
constructor(part: ChildPart);
|
|
12
|
+
parentFor(): Node;
|
|
13
|
+
endFor(index: number): Node | null;
|
|
14
|
+
first(): Node | null;
|
|
15
|
+
last(): Node | null;
|
|
16
|
+
}
|
|
17
|
+
/** The first node of `rows[from…]`, or the end of the list's part. */
|
|
18
|
+
export declare function firstFrom(rows: readonly ChildPart[], from: number, part: ChildPart): Node | null;
|
|
19
|
+
/** `Object.is`, or for arrays and plain objects the same entries by `Object.is` (one level). */
|
|
20
|
+
export declare function samePick(a: unknown, b: unknown): boolean;
|
|
21
|
+
export declare function updateRow(row: ChildPart, item: unknown, l: ListResult): void;
|
|
22
|
+
/** A new row: open (positioned by `owner`), or appended to `parent` until placed. */
|
|
23
|
+
export declare function newRow(owner: List | null, parent: Node | null, l: ListResult, item: unknown, key: unknown, index: number): ChildPart;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Rows of lists and arrays (view/03-lists.md "Row skipping", "Row boundaries"): the list that
|
|
2
|
+
// owns them (and resolves their positions), row skipping by item identity and a shallow pick
|
|
3
|
+
// comparison, and row creation. Shared by list.ts and the reordering step (reorder.ts).
|
|
4
|
+
import { ChildPart } from './child-part.js';
|
|
5
|
+
/** The rows of a list or the items of an array, owned by one child part. */
|
|
6
|
+
export class List {
|
|
7
|
+
constructor(part) {
|
|
8
|
+
this.part = part;
|
|
9
|
+
this.rows = [];
|
|
10
|
+
this.building = null;
|
|
11
|
+
this.cursor = 0;
|
|
12
|
+
}
|
|
13
|
+
parentFor() {
|
|
14
|
+
return this.building ?? this.part.parent();
|
|
15
|
+
}
|
|
16
|
+
endFor(index) {
|
|
17
|
+
return this.building !== null ? null : firstFrom(this.rows, index + 1, this.part);
|
|
18
|
+
}
|
|
19
|
+
first() {
|
|
20
|
+
const rows = this.rows;
|
|
21
|
+
for (let i = 0; i < rows.length; i++) {
|
|
22
|
+
const node = rows[i].first();
|
|
23
|
+
if (node !== null)
|
|
24
|
+
return node;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
last() {
|
|
29
|
+
const rows = this.rows;
|
|
30
|
+
for (let i = rows.length - 1; i >= 0; i--) {
|
|
31
|
+
const node = rows[i].last();
|
|
32
|
+
if (node !== null)
|
|
33
|
+
return node;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** The first node of `rows[from…]`, or the end of the list's part. */
|
|
39
|
+
export function firstFrom(rows, from, part) {
|
|
40
|
+
for (let j = from; j < rows.length; j++) {
|
|
41
|
+
const node = rows[j].first();
|
|
42
|
+
if (node !== null)
|
|
43
|
+
return node;
|
|
44
|
+
}
|
|
45
|
+
return part.end();
|
|
46
|
+
}
|
|
47
|
+
/** `Object.is`, or for arrays and plain objects the same entries by `Object.is` (one level). */
|
|
48
|
+
export function samePick(a, b) {
|
|
49
|
+
if (Object.is(a, b))
|
|
50
|
+
return true;
|
|
51
|
+
if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null)
|
|
52
|
+
return false;
|
|
53
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
54
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length)
|
|
55
|
+
return false;
|
|
56
|
+
for (let i = 0; i < a.length; i++)
|
|
57
|
+
if (!Object.is(a[i], b[i]))
|
|
58
|
+
return false;
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
const proto = Object.getPrototypeOf(a);
|
|
62
|
+
if ((proto !== Object.prototype && proto !== null) || Object.getPrototypeOf(b) !== proto) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const keys = Object.keys(a);
|
|
66
|
+
if (keys.length !== Object.keys(b).length)
|
|
67
|
+
return false;
|
|
68
|
+
for (const k of keys) {
|
|
69
|
+
if (!Object.hasOwn(b, k))
|
|
70
|
+
return false;
|
|
71
|
+
if (!Object.is(a[k], b[k])) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
export function updateRow(row, item, l) {
|
|
78
|
+
const picked = l.pick === undefined ? undefined : l.pick(item);
|
|
79
|
+
if (item === row.item && samePick(picked, row.picked))
|
|
80
|
+
return;
|
|
81
|
+
row.item = item;
|
|
82
|
+
row.picked = picked;
|
|
83
|
+
row.commit(l.row(item, picked));
|
|
84
|
+
}
|
|
85
|
+
/** A new row: open (positioned by `owner`), or appended to `parent` until placed. */
|
|
86
|
+
export function newRow(owner, parent, l, item, key, index) {
|
|
87
|
+
const row = new ChildPart(parent, null, owner, index, false, -1);
|
|
88
|
+
const picked = l.pick === undefined ? undefined : l.pick(item);
|
|
89
|
+
row.key = key;
|
|
90
|
+
row.item = item;
|
|
91
|
+
row.picked = picked;
|
|
92
|
+
row.commit(l.row(item, picked));
|
|
93
|
+
return row;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rows.js","sourceRoot":"","sources":["../../../src/view/render/rows.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,6FAA6F;AAC7F,wFAAwF;AACxF,OAAO,EAAE,SAAS,EAAc,MAAM,iBAAiB,CAAC;AAGxD,4EAA4E;AAC5E,MAAM,OAAO,IAAI;IAQf,YAAY,IAAe;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACpF,CAAC;IAED,KAAK;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,MAAM,IAAI,GAAI,IAAI,CAAC,CAAC,CAAe,CAAC,KAAK,EAAE,CAAC;YAC5C,IAAI,IAAI,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,KAAK,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I,IAAI,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC;QAAE,OAAO;IAC9D,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;IAChB,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;IACpB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AAClC,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,MAAM,CACpB,KAAkB,EAClB,MAAmB,EACnB,CAAa,EACb,IAAa,EACb,GAAY,EACZ,KAAa;IAEb,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC;IACd,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;IAChB,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;IACpB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Rows of lists and arrays (view/03-lists.md \"Row skipping\", \"Row boundaries\"): the list that\n// owns them (and resolves their positions), row skipping by item identity and a shallow pick\n// comparison, and row creation. Shared by list.ts and the reordering step (reorder.ts).\nimport { ChildPart, type Owner } from './child-part.js';\nimport type { ListResult } from './values.js';\n\n/** The rows of a list or the items of an array, owned by one child part. */\nexport class List implements Owner {\n readonly part: ChildPart;\n rows: ChildPart[];\n /** While rows are created into a fragment: they append to it. */\n building: DocumentFragment | null;\n /** Where the development re-evaluation check continues (dev-check.ts). */\n cursor: number;\n\n constructor(part: ChildPart) {\n this.part = part;\n this.rows = [];\n this.building = null;\n this.cursor = 0;\n }\n\n parentFor(): Node {\n return this.building ?? this.part.parent();\n }\n\n endFor(index: number): Node | null {\n return this.building !== null ? null : firstFrom(this.rows, index + 1, this.part);\n }\n\n first(): Node | null {\n const rows = this.rows;\n for (let i = 0; i < rows.length; i++) {\n const node = (rows[i] as ChildPart).first();\n if (node !== null) return node;\n }\n return null;\n }\n\n last(): Node | null {\n const rows = this.rows;\n for (let i = rows.length - 1; i >= 0; i--) {\n const node = (rows[i] as ChildPart).last();\n if (node !== null) return node;\n }\n return null;\n }\n}\n\n/** The first node of `rows[from…]`, or the end of the list's part. */\nexport function firstFrom(rows: readonly ChildPart[], from: number, part: ChildPart): Node | null {\n for (let j = from; j < rows.length; j++) {\n const node = (rows[j] as ChildPart).first();\n if (node !== null) return node;\n }\n return part.end();\n}\n\n/** `Object.is`, or for arrays and plain objects the same entries by `Object.is` (one level). */\nexport function samePick(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true;\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) return false;\n if (Array.isArray(a) || Array.isArray(b)) {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i])) return false;\n return true;\n }\n const proto = Object.getPrototypeOf(a) as unknown;\n if ((proto !== Object.prototype && proto !== null) || Object.getPrototypeOf(b) !== proto) {\n return false;\n }\n const keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length) return false;\n for (const k of keys) {\n if (!Object.hasOwn(b, k)) return false;\n if (!Object.is((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k])) {\n return false;\n }\n }\n return true;\n}\n\nexport function updateRow(row: ChildPart, item: unknown, l: ListResult): void {\n const picked = l.pick === undefined ? undefined : l.pick(item);\n if (item === row.item && samePick(picked, row.picked)) return;\n row.item = item;\n row.picked = picked;\n row.commit(l.row(item, picked));\n}\n\n/** A new row: open (positioned by `owner`), or appended to `parent` until placed. */\nexport function newRow(\n owner: List | null,\n parent: Node | null,\n l: ListResult,\n item: unknown,\n key: unknown,\n index: number,\n): ChildPart {\n const row = new ChildPart(parent, null, owner, index, false, -1);\n const picked = l.pick === undefined ? undefined : l.pick(item);\n row.key = key;\n row.item = item;\n row.picked = picked;\n row.commit(l.row(item, picked));\n return row;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PartSpec } from '../normalize/types.js';
|
|
2
|
+
/** What is reported: a template object, or `raw()` markup as `{ html }`. */
|
|
3
|
+
export interface Markup {
|
|
4
|
+
readonly html: string;
|
|
5
|
+
readonly parts?: readonly PartSpec[];
|
|
6
|
+
}
|
|
7
|
+
export type SeenMarkup = (markup: Markup) => void;
|
|
8
|
+
/** Reports `markup` to the current render's listener, if any. */
|
|
9
|
+
export declare function report(markup: Markup): void;
|
|
10
|
+
/** Sets the listener for one render; returns the previous one, to restore afterwards. */
|
|
11
|
+
export declare function listenFor(fn: SeenMarkup | undefined): SeenMarkup | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
let seen;
|
|
2
|
+
let last;
|
|
3
|
+
/** Reports `markup` to the current render's listener, if any. */
|
|
4
|
+
export function report(markup) {
|
|
5
|
+
if (seen !== undefined && markup !== last) {
|
|
6
|
+
last = markup;
|
|
7
|
+
seen(markup);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** Sets the listener for one render; returns the previous one, to restore afterwards. */
|
|
11
|
+
export function listenFor(fn) {
|
|
12
|
+
const outer = seen;
|
|
13
|
+
seen = fn;
|
|
14
|
+
last = undefined;
|
|
15
|
+
return outer;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=seen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seen.js","sourceRoot":"","sources":["../../../src/view/render/seen.ts"],"names":[],"mappings":"AAcA,IAAI,IAA4B,CAAC;AACjC,IAAI,IAAwB,CAAC;AAE7B,iEAAiE;AACjE,MAAM,UAAU,MAAM,CAAC,MAAc;IACnC,IAAI,IAAI,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAC1C,IAAI,GAAG,MAAM,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;AACH,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,SAAS,CAAC,EAA0B;IAClD,MAAM,KAAK,GAAG,IAAI,CAAC;IACnB,IAAI,GAAG,EAAE,CAAC;IACV,IAAI,GAAG,SAAS,CAAC;IACjB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// The templates a render instantiates, reported to the caller of `render`/`hydrate` (view/02\n// \"Commit order\"). Core uses it to listen only for the intent events a component's markup names\n// (view/05-element.md \"Intent events\"). Reporting costs one comparison per instance when no\n// one listens, and one call per run of instances of the same template when someone does.\nimport type { PartSpec } from '../normalize/types.js';\n\n/** What is reported: a template object, or `raw()` markup as `{ html }`. */\nexport interface Markup {\n readonly html: string;\n readonly parts?: readonly PartSpec[];\n}\n\nexport type SeenMarkup = (markup: Markup) => void;\n\nlet seen: SeenMarkup | undefined;\nlet last: Markup | undefined;\n\n/** Reports `markup` to the current render's listener, if any. */\nexport function report(markup: Markup): void {\n if (seen !== undefined && markup !== last) {\n last = markup;\n seen(markup);\n }\n}\n\n/** Sets the listener for one render; returns the previous one, to restore afterwards. */\nexport function listenFor(fn: SeenMarkup | undefined): SeenMarkup | undefined {\n const outer = seen;\n seen = fn;\n last = undefined;\n return outer;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HookPart } from './hooks.js';
|
|
2
|
+
/** Queues a native action after this part's DOM is committed and inserted. */
|
|
3
|
+
export type Toggle = (part: HookPart, name: string, on: boolean) => void;
|
|
4
|
+
export declare let toggle: Toggle | undefined;
|
|
5
|
+
/** Internal: turns the bindings on (modal.ts's `applyToggle`). */
|
|
6
|
+
export declare function useToggles(run: Toggle): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggles.js","sourceRoot":"","sources":["../../../src/view/render/toggles.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,IAAI,MAA0B,CAAC;AAEtC,kEAAkE;AAClE,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,GAAG,GAAG,CAAC;AACf,CAAC","sourcesContent":["// Dialogs and popovers from state (view/02-bindings.md \"Dialogs and popovers\", gyral-1zd.27):\n// `?modal=${open}` on a `<dialog>` and `?popover-open=${open}` on a `[popover]` element open and\n// close them with the platform's methods. The code that does it (modal.ts) registers here, so\n// only builds that use the bindings bundle it: core's `#spec-features` registers it at load\n// without a build step, and compiled builds register it when a module writes either binding.\nimport type { HookPart } from './hooks.js';\n\n/** Queues a native action after this part's DOM is committed and inserted. */\nexport type Toggle = (part: HookPart, name: string, on: boolean) => void;\n\nexport let toggle: Toggle | undefined;\n\n/** Internal: turns the bindings on (modal.ts's `applyToggle`). */\nexport function useToggles(run: Toggle): void {\n toggle = run;\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { TemplateResult } from '../template.js';
|
|
2
|
+
import type { ChildPart } from './child-part.js';
|
|
3
|
+
/** Renders nothing in a child hole; removes the attribute in an attribute hole. */
|
|
4
|
+
export declare const nothing: unique symbol;
|
|
5
|
+
/** Internal: "never committed", so a part's first commit always writes. */
|
|
6
|
+
export declare const UNSET: unique symbol;
|
|
7
|
+
/** Internal: the key of `raw`'s result; its value is the function that commits the markup. */
|
|
8
|
+
export declare const MARKUP: unique symbol;
|
|
9
|
+
/** Internal: the key of `each`'s result; its value is the function that commits the list. */
|
|
10
|
+
export declare const EACH: unique symbol;
|
|
11
|
+
/** Trusted markup for a child hole: what `raw(html)` returns. */
|
|
12
|
+
export interface RawResult {
|
|
13
|
+
readonly [MARKUP]: (part: ChildPart, html: string) => void;
|
|
14
|
+
readonly html: string;
|
|
15
|
+
}
|
|
16
|
+
/** A keyed list for a child hole: what `each(…)` returns. */
|
|
17
|
+
export interface ListResult {
|
|
18
|
+
readonly [EACH]: (part: ChildPart, list: ListResult) => void;
|
|
19
|
+
readonly items: readonly unknown[];
|
|
20
|
+
readonly key: (item: unknown) => unknown;
|
|
21
|
+
readonly row: (item: unknown, picked: unknown) => unknown;
|
|
22
|
+
readonly pick: ((item: unknown) => unknown) | undefined;
|
|
23
|
+
}
|
|
24
|
+
/** Everything a child hole accepts (view/02-bindings.md "Child values"). */
|
|
25
|
+
export type ChildValue = string | number | boolean | null | undefined | typeof nothing | TemplateResult | ListResult | RawResult | readonly ChildValue[];
|
|
26
|
+
export declare const isRaw: (value: object) => value is RawResult;
|
|
27
|
+
/** The markup of a `raw()` value, or undefined for anything else. */
|
|
28
|
+
export declare const rawHtml: (value: object) => string | undefined;
|
|
29
|
+
export declare const isList: (value: object) => value is ListResult;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Renders nothing in a child hole; removes the attribute in an attribute hole. */
|
|
2
|
+
export const nothing = Symbol('gyral.nothing');
|
|
3
|
+
/** Internal: "never committed", so a part's first commit always writes. */
|
|
4
|
+
export const UNSET = Symbol('gyral.unset');
|
|
5
|
+
/** Internal: the key of `raw`'s result; its value is the function that commits the markup. */
|
|
6
|
+
export const MARKUP = Symbol('gyral.raw');
|
|
7
|
+
/** Internal: the key of `each`'s result; its value is the function that commits the list. */
|
|
8
|
+
export const EACH = Symbol('gyral.each');
|
|
9
|
+
export const isRaw = (value) => MARKUP in value;
|
|
10
|
+
/** The markup of a `raw()` value, or undefined for anything else. */
|
|
11
|
+
export const rawHtml = (value) => isRaw(value) ? value.html : undefined;
|
|
12
|
+
export const isList = (value) => EACH in value;
|
|
13
|
+
//# sourceMappingURL=values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../src/view/render/values.ts"],"names":[],"mappings":"AAQA,mFAAmF;AACnF,MAAM,CAAC,MAAM,OAAO,GAAkB,MAAM,CAAC,eAAe,CAAC,CAAC;AAE9D,2EAA2E;AAC3E,MAAM,CAAC,MAAM,KAAK,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AAE1D,8FAA8F;AAC9F,MAAM,CAAC,MAAM,MAAM,GAAkB,MAAM,CAAC,WAAW,CAAC,CAAC;AACzD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,IAAI,GAAkB,MAAM,CAAC,YAAY,CAAC,CAAC;AA8BxD,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAsB,EAAE,CAAC,MAAM,IAAI,KAAK,CAAC;AAE5E,qEAAqE;AACrE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAsB,EAAE,CAC3D,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAExC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAuB,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC","sourcesContent":["// Child values besides text and templates (view/02-bindings.md \"Child values\", \"`raw(html)`\",\n// \"`nothing`\") and the result of `each` (view/03-lists.md \"The API\"). Each is recognised by a\n// symbol, so data parsed from JSON can never pass for one. `each` lives in list.ts and `raw` in\n// raw.ts: their results carry the code that commits them, so an app that never calls one\n// doesn't bundle that code.\nimport type { TemplateResult } from '../template.js';\nimport type { ChildPart } from './child-part.js';\n\n/** Renders nothing in a child hole; removes the attribute in an attribute hole. */\nexport const nothing: unique symbol = Symbol('gyral.nothing');\n\n/** Internal: \"never committed\", so a part's first commit always writes. */\nexport const UNSET: unique symbol = Symbol('gyral.unset');\n\n/** Internal: the key of `raw`'s result; its value is the function that commits the markup. */\nexport const MARKUP: unique symbol = Symbol('gyral.raw');\n/** Internal: the key of `each`'s result; its value is the function that commits the list. */\nexport const EACH: unique symbol = Symbol('gyral.each');\n\n/** Trusted markup for a child hole: what `raw(html)` returns. */\nexport interface RawResult {\n readonly [MARKUP]: (part: ChildPart, html: string) => void;\n readonly html: string;\n}\n\n/** A keyed list for a child hole: what `each(…)` returns. */\nexport interface ListResult {\n readonly [EACH]: (part: ChildPart, list: ListResult) => void;\n readonly items: readonly unknown[];\n readonly key: (item: unknown) => unknown;\n readonly row: (item: unknown, picked: unknown) => unknown;\n readonly pick: ((item: unknown) => unknown) | undefined;\n}\n\n/** Everything a child hole accepts (view/02-bindings.md \"Child values\"). */\nexport type ChildValue =\n | string\n | number\n | boolean\n | null\n | undefined\n | typeof nothing\n | TemplateResult\n | ListResult\n | RawResult\n | readonly ChildValue[];\n\nexport const isRaw = (value: object): value is RawResult => MARKUP in value;\n\n/** The markup of a `raw()` value, or undefined for anything else. */\nexport const rawHtml = (value: object): string | undefined =>\n isRaw(value) ? value.html : undefined;\n\nexport const isList = (value: object): value is ListResult => EACH in value;\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** A child hole got a value it can't render: an error in development. */
|
|
2
|
+
export declare function badChild(value: unknown): never;
|
|
3
|
+
/** `true` in a child hole, once per part: usually a `cond && x` slip. */
|
|
4
|
+
export declare function warnTrue(part: object): void;
|
|
5
|
+
/** An attribute or text-content hole got an object or function, once per part. */
|
|
6
|
+
export declare function warnValue(part: object, value: unknown, where: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* A property binding got a function, once per part (02 "Properties"): views attach no
|
|
9
|
+
* closures. Built-in elements and Gyral components warn; other custom elements may take a
|
|
10
|
+
* callback (a third-party widget's API), so they don't.
|
|
11
|
+
*/
|
|
12
|
+
export declare function warnFunctionProp(part: object, el: Element, name: string): void;
|
|
13
|
+
/** `raw()` parsed in the browser, once per page. */
|
|
14
|
+
export declare function warnRaw(): void;
|
|
15
|
+
/** Keys must be unique strings or numbers: an error in development. */
|
|
16
|
+
export declare function badKey(key: unknown, index: number, duplicate: boolean): never;
|
|
17
|
+
/** A skipped row would render differently: it reads something besides `item` and `pick`. */
|
|
18
|
+
export declare function warnImpureRow(row: (...args: never[]) => unknown): void;
|
|
19
|
+
/** A hook hole got something other than a hook result. */
|
|
20
|
+
/** `?modal`/`?popover-open` with the bindings' code left out of the build (toggles.ts). */
|
|
21
|
+
export declare function warnToggle(el: Element, name: string): void;
|
|
22
|
+
export declare function badHook(value: unknown): never;
|
|
23
|
+
/**
|
|
24
|
+
* An svg template renders only in SVG content: an SVG element other than <foreignObject>,
|
|
25
|
+
* <desc> or <title>, whose content is HTML (01 "svg templates"). A detached fragment (an
|
|
26
|
+
* instance being built) isn't checked: its place is known only when it is inserted.
|
|
27
|
+
*/
|
|
28
|
+
export declare function checkSvgParent(parent: Node): void;
|