@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
package/dist/define.js
CHANGED
|
@@ -1,338 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { attachStates } from './states.js';
|
|
15
|
-
import { STORE_SEND } from './store.js';
|
|
16
|
-
import { StoreBinding } from './store-binding.js';
|
|
17
|
-
import { withViewTransition } from './transitions.js';
|
|
18
|
-
// Lit types `isServer` per build condition; widen it so both branches type-check (ADR 0012).
|
|
19
|
-
const onServer = isServer;
|
|
20
|
-
const DEFER_HYDRATION = 'defer-hydration';
|
|
21
|
-
/**
|
|
22
|
-
* Has Lit's hydrate support patched LitElement? It then defers `defer-hydration` elements
|
|
23
|
-
* itself. A bundler can evaluate Lit before `@gyral/ssr/hydrate`, so it may not have
|
|
24
|
-
* (gyral-czi.41); the patch adds an own static `observedAttributes` to LitElement.
|
|
25
|
-
*/
|
|
26
|
-
const litDefers = () => Object.prototype.hasOwnProperty.call(LitElement, 'observedAttributes');
|
|
27
|
-
/**
|
|
28
|
-
* Compiles a Model-View-Intent spec into a custom element and registers it under `tag`.
|
|
29
|
-
* See docs/design-docs/0001-mvi-parsed-intent.md, 0006-effects-and-drivers.md, 0007-props.md
|
|
30
|
-
* 0008-forms.md and 0012-ssr.md.
|
|
31
|
-
*/
|
|
32
|
-
export function define(tag, spec) {
|
|
33
|
-
const propTable = (spec.props ?? {});
|
|
34
|
-
const propNames = Object.keys(propTable);
|
|
35
|
-
const shadowed = onServer ? [] : shadowedBuiltins(propNames);
|
|
36
|
-
if (shadowed.length > 0) {
|
|
37
|
-
console.warn(`<${tag}> declares prop(s) that shadow built-in element properties: ` +
|
|
38
|
-
`${shadowed.join(', ')}. Setting them changes platform behaviour ` +
|
|
39
|
-
`(a prop named "hidden" hides the element). Rename them.`);
|
|
1
|
+
import { elementClass } from './element.js';
|
|
2
|
+
import { markGyralHost } from './intent.js';
|
|
3
|
+
import { isLight } from './light-dom.js';
|
|
4
|
+
import { features } from './features.js';
|
|
5
|
+
import { recordSpec } from './server-specs.js';
|
|
6
|
+
import { DEV, message } from './view/index.js';
|
|
7
|
+
function checkSpec(tag, spec) {
|
|
8
|
+
const names = Object.keys(spec.props ?? {});
|
|
9
|
+
// The prop builders registered the prop feature (features.ts) if there are props.
|
|
10
|
+
if (names.length > 0)
|
|
11
|
+
features.props?.checkShadowed(tag, names);
|
|
12
|
+
if (DEV && isLight(spec) && spec.styles !== undefined) {
|
|
13
|
+
console.warn(`<${tag}> has shadow: false, so its styles are ignored; use document CSS.`);
|
|
40
14
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/** The renderRoot is a server-rendered (declarative) shadow root to hydrate in place. */
|
|
61
|
-
this.#ssrShadow = false;
|
|
62
|
-
/** Mirrors spec.states onto CSS custom states; only attached when the spec asks. */
|
|
63
|
-
this.#syncStates = spec.states === undefined || onServer ? undefined : attachStates(this);
|
|
64
|
-
// el.drivers → nearest provider → spec.drivers → the command's own (gyral-czi.35).
|
|
65
|
-
this.#resolve = (driver) => this.drivers[driver.name] ??
|
|
66
|
-
providedDriver(this, driver.name) ??
|
|
67
|
-
spec.drivers?.[driver.name] ??
|
|
68
|
-
driver;
|
|
69
|
-
this.#onEvent = (event) => {
|
|
70
|
-
handleIntent(event, this.renderRoot, parsers, tag, this.#deliver);
|
|
71
|
-
};
|
|
72
|
-
this.#deliver = (msg) => {
|
|
73
|
-
if (msg !== undefined && this.isConnected)
|
|
74
|
-
this.#dispatch(msg);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
static { this.properties = spec.props ?? {}; }
|
|
78
|
-
static { this.styles = componentStyles(spec, tag); }
|
|
79
|
-
static { this.spec = spec; }
|
|
80
|
-
static { this.tagName = tag; }
|
|
81
|
-
// Always observe `defer-hydration`, so Gyral can defer server-rendered children itself
|
|
82
|
-
// when Lit's hydrate support isn't installed (gyral-czi.41, ADR 0012).
|
|
83
|
-
static get observedAttributes() {
|
|
84
|
-
const base = super.observedAttributes;
|
|
85
|
-
return base.includes(DEFER_HYDRATION) ? base : [...base, DEFER_HYDRATION];
|
|
86
|
-
}
|
|
87
|
-
/** Reads, subscriptions and writes for spec.stores (ADR 0013). */
|
|
88
|
-
#binding;
|
|
89
|
-
#model;
|
|
90
|
-
/** Props as of the last init or PropsChanged; the `prev` of the next PropsChanged. */
|
|
91
|
-
#seenProps;
|
|
92
|
-
#listening;
|
|
93
|
-
#interpreter;
|
|
94
|
-
#pending;
|
|
95
|
-
/** init's commands on the hydration path; started in firstUpdated (ADR 0012). */
|
|
96
|
-
#afterHydration;
|
|
97
|
-
/** Resumed from server markup; reported by the Hydrated message. */
|
|
98
|
-
#serverRendered;
|
|
99
|
-
/** The renderRoot is a server-rendered (declarative) shadow root to hydrate in place. */
|
|
100
|
-
#ssrShadow;
|
|
101
|
-
/** The latest view-transition update, awaited by updateComplete. */
|
|
102
|
-
#transition;
|
|
103
|
-
/** Mirrors spec.states onto CSS custom states; only attached when the spec asks. */
|
|
104
|
-
#syncStates;
|
|
105
|
-
get state() {
|
|
106
|
-
if (this.#model === undefined) {
|
|
107
|
-
const missing = missingRequired(this, propTable);
|
|
108
|
-
if (missing.length > 0) {
|
|
109
|
-
console.warn(`<${tag}> is missing required prop(s): ${missing.join(', ')}.`);
|
|
110
|
-
}
|
|
111
|
-
this.#seenProps = this.#props();
|
|
112
|
-
this.#apply(runInit(spec, this.#seenProps));
|
|
113
|
-
for (const msg of this.initialMessages)
|
|
114
|
-
this.#dispatch(msg, false);
|
|
115
|
-
}
|
|
116
|
-
return this.#model.value;
|
|
117
|
-
}
|
|
118
|
-
send(msg) {
|
|
119
|
-
this.#dispatch(msg);
|
|
120
|
-
}
|
|
121
|
-
#dispatch(msg, render = true) {
|
|
122
|
-
const reducer = reducers[msg._tag];
|
|
123
|
-
if (reducer === undefined) {
|
|
124
|
-
// Framework messages have optional reducers; props and stores stay readable as context.
|
|
125
|
-
if (msg._tag !== 'PropsChanged' && msg._tag !== 'StoreChanged') {
|
|
126
|
-
console.warn(`<${tag}> has no update for message "${msg._tag}".`);
|
|
127
|
-
}
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
const prev = this.state;
|
|
131
|
-
this.#apply(reducer(prev, msg, this.#ctx()));
|
|
132
|
-
if (DEVTOOLS_ENABLED)
|
|
133
|
-
devUpdate(this, tag, msg, prev, this.state);
|
|
134
|
-
if (!render)
|
|
135
|
-
return;
|
|
136
|
-
if (spec.viewTransition?.(prev, this.state, msg) === true) {
|
|
137
|
-
// The DOM change happens inside the transition callback (ADR 0001 addendum);
|
|
138
|
-
// updateComplete waits for it, so tests and callers see the new DOM.
|
|
139
|
-
this.#transition = withViewTransition(async () => {
|
|
140
|
-
this.requestUpdate();
|
|
141
|
-
await super.getUpdateComplete();
|
|
142
|
-
}).catch((error) => {
|
|
143
|
-
console.error(`<${tag}> view transition update failed`, error);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
this.requestUpdate();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
async getUpdateComplete() {
|
|
151
|
-
await this.#transition;
|
|
152
|
-
return super.getUpdateComplete();
|
|
153
|
-
}
|
|
154
|
-
connectedCallback() {
|
|
155
|
-
this.#resumeFromSeed();
|
|
156
|
-
// A component server-rendered inside another's view waits (`defer-hydration`) for its
|
|
157
|
-
// parent to hydrate first. Lit's hydrate support, when installed, defers LitElement
|
|
158
|
-
// itself; otherwise Gyral holds back Lit's connect until the attribute goes.
|
|
159
|
-
const waiting = this.hasAttribute(DEFER_HYDRATION);
|
|
160
|
-
if (!waiting || litDefers())
|
|
161
|
-
super.connectedCallback();
|
|
162
|
-
if (waiting) {
|
|
163
|
-
scheduleIsland(this); // lazy islands release themselves (gyral-4k7.4)
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
this.#connect();
|
|
167
|
-
}
|
|
168
|
-
attributeChangedCallback(name, old, value) {
|
|
169
|
-
super.attributeChangedCallback(name, old, value);
|
|
170
|
-
if (name !== DEFER_HYDRATION || value !== null || !this.isConnected)
|
|
171
|
-
return;
|
|
172
|
-
if (!litDefers())
|
|
173
|
-
super.connectedCallback(); // Lit's support would have connected it
|
|
174
|
-
this.#connect();
|
|
175
|
-
}
|
|
176
|
-
#connect() {
|
|
177
|
-
// Re-resolve on every connect: the nearest <gyral-stores> may differ after a move.
|
|
178
|
-
if (this.#binding.connect())
|
|
179
|
-
this.requestUpdate();
|
|
180
|
-
this.#interpreter = makeInterpreter(this.#resolve, (msg) => {
|
|
181
|
-
this.#dispatch(msg);
|
|
182
|
-
}, DEVTOOLS_ENABLED ? devCommands(() => devOwner(this, tag)) : undefined);
|
|
183
|
-
if (DEVTOOLS_ENABLED)
|
|
184
|
-
devConnect(this, tag, true);
|
|
185
|
-
const pending = this.#pending;
|
|
186
|
-
this.#pending = [];
|
|
187
|
-
for (const cmd of pending)
|
|
188
|
-
this.#interpreter.run(cmd);
|
|
189
|
-
if (this.#listening)
|
|
190
|
-
return;
|
|
191
|
-
listenForIntents(this.renderRoot, spec.events ?? [], this.#onEvent);
|
|
192
|
-
this.#listening = true;
|
|
193
|
-
}
|
|
194
|
-
disconnectedCallback() {
|
|
195
|
-
super.disconnectedCallback();
|
|
196
|
-
this.#binding.disconnect();
|
|
197
|
-
this.#interpreter?.dispose();
|
|
198
|
-
this.#interpreter = undefined;
|
|
199
|
-
if (DEVTOOLS_ENABLED)
|
|
200
|
-
devConnect(this, tag, false);
|
|
201
|
-
}
|
|
202
|
-
willUpdate(changed) {
|
|
203
|
-
super.willUpdate(changed);
|
|
204
|
-
if (onServer) {
|
|
205
|
-
// Server renders run constructor, willUpdate and render only (ADR 0012).
|
|
206
|
-
// init is pure, so the client can recompute an unchanged state from the props.
|
|
207
|
-
const [initial] = splitNext(runInit(spec, this.#props()));
|
|
208
|
-
writeSeed(this, this.state, readRawProps(this, propTable), propTable, { value: initial });
|
|
209
|
-
if (isLight(spec))
|
|
210
|
-
markLightHost(this);
|
|
211
|
-
markIsland(this, spec.hydrate);
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const prev = this.#seenProps;
|
|
215
|
-
if (prev === undefined)
|
|
216
|
-
return; // first render: init() sees the props
|
|
217
|
-
const props = this.#props();
|
|
218
|
-
if (sameProps(propNames, props, prev))
|
|
219
|
-
return;
|
|
220
|
-
this.#seenProps = props;
|
|
221
|
-
// Inside the update cycle, so the new state renders in this same pass.
|
|
222
|
-
this.#dispatch({ _tag: 'PropsChanged', props, prev }, false);
|
|
223
|
-
}
|
|
224
|
-
// Light-DOM mode (ADR 0014): render into the element itself. A server-rendered shadow root
|
|
225
|
-
// (Declarative Shadow DOM) is reused as is and hydrated in update() (gyral-czi.41): this
|
|
226
|
-
// bypasses Lit's hydrate-support patch on purpose, so hydration is correct whether or not
|
|
227
|
-
// that patch was installed before Lit evaluated (bundlers can reorder it; ADR 0012).
|
|
228
|
-
createRenderRoot() {
|
|
229
|
-
if (isLight(spec))
|
|
230
|
-
return this;
|
|
231
|
-
if (!onServer && this.shadowRoot !== null) {
|
|
232
|
-
this.#ssrShadow = true;
|
|
233
|
-
return this.shadowRoot;
|
|
234
|
-
}
|
|
235
|
-
return super.createRenderRoot();
|
|
236
|
-
}
|
|
237
|
-
update(changed) {
|
|
238
|
-
if (this.#ssrShadow && !this.hasUpdated) {
|
|
239
|
-
const styles = this.constructor.elementStyles;
|
|
240
|
-
hydrateShadow(this.renderRoot, this.render(), this.renderOptions, styles);
|
|
241
|
-
}
|
|
242
|
-
if (isLight(spec) && !this.hasUpdated && this.#serverRendered) {
|
|
243
|
-
hydrateLight(this, this.render(), this.renderOptions); // ADR 0014
|
|
244
|
-
}
|
|
245
|
-
super.update(changed);
|
|
246
|
-
}
|
|
247
|
-
render() {
|
|
248
|
-
return spec.view(this.state, intentNames, this.#ctx());
|
|
249
|
-
}
|
|
250
|
-
updated(changed) {
|
|
251
|
-
super.updated(changed);
|
|
252
|
-
if (spec.states !== undefined)
|
|
253
|
-
this.#syncStates?.(spec.states(this.state));
|
|
254
|
-
}
|
|
255
|
-
#apply(next) {
|
|
256
|
-
const [state, commands] = splitNext(next);
|
|
257
|
-
this.#model = { value: state };
|
|
258
|
-
if (onServer)
|
|
259
|
-
return; // commands never run on the server; the client's init starts them
|
|
260
|
-
for (const cmd of commands) {
|
|
261
|
-
if (cmd.driver === EMIT)
|
|
262
|
-
dispatchOutput(this, cmd.input);
|
|
263
|
-
else if (cmd.driver === STORE_SEND)
|
|
264
|
-
this.#binding.send(cmd.input);
|
|
265
|
-
else if (cmd.driver === FOCUS)
|
|
266
|
-
focusAfterUpdate(this, tag, cmd.input);
|
|
267
|
-
else if (this.#interpreter === undefined)
|
|
268
|
-
this.#pending.push(cmd);
|
|
269
|
-
else
|
|
270
|
-
this.#interpreter.run(cmd);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Hydration (ADR 0012): use the server's state and restore props that only travelled in the
|
|
275
|
-
* seed. init(props) runs again for its commands only, and they start after the hydrating
|
|
276
|
-
* render: a driver that answers synchronously must not change state before hydration.
|
|
277
|
-
*/
|
|
278
|
-
#resumeFromSeed() {
|
|
279
|
-
if (this.#model !== undefined)
|
|
280
|
-
return;
|
|
281
|
-
const seed = takeSeed(this);
|
|
282
|
-
if (seed === undefined)
|
|
283
|
-
return;
|
|
284
|
-
restoreProps(this, propNames, seed.props);
|
|
285
|
-
this.#seenProps = this.#props();
|
|
286
|
-
const [initial, commands] = splitNext(runInit(spec, this.#seenProps));
|
|
287
|
-
// Sound: the seed is this component's own state, serialized by writeSeed() on the server;
|
|
288
|
-
// when absent, the server's state was exactly init(props) (seed deduplication).
|
|
289
|
-
this.#model = { value: 'state' in seed ? seed.state : initial };
|
|
290
|
-
this.#afterHydration = commands;
|
|
291
|
-
this.#serverRendered = true;
|
|
292
|
-
}
|
|
293
|
-
firstUpdated(changed) {
|
|
294
|
-
super.firstUpdated(changed);
|
|
295
|
-
if (this.#serverRendered)
|
|
296
|
-
fillEmptyTextParts(this.renderRoot); // gyral-4k7.12
|
|
297
|
-
if (DEVTOOLS_ENABLED)
|
|
298
|
-
devHydrated(this, tag, this.#serverRendered);
|
|
299
|
-
const commands = this.#afterHydration;
|
|
300
|
-
const wantsHydrated = reducers['Hydrated'] !== undefined;
|
|
301
|
-
if (commands.length === 0 && !wantsHydrated)
|
|
302
|
-
return;
|
|
303
|
-
this.#afterHydration = [];
|
|
304
|
-
// After the first (possibly hydrating) update has fully completed, so whatever these
|
|
305
|
-
// change starts a fresh update instead of diverging from the server markup.
|
|
306
|
-
void this.updateComplete.then(() => {
|
|
307
|
-
if (wantsHydrated) {
|
|
308
|
-
this.#dispatch({ _tag: 'Hydrated', serverRendered: this.#serverRendered });
|
|
309
|
-
}
|
|
310
|
-
if (commands.length > 0)
|
|
311
|
-
this.#apply([this.state, commands]);
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
// el.drivers → nearest provider → spec.drivers → the command's own (gyral-czi.35).
|
|
315
|
-
#resolve;
|
|
316
|
-
#onEvent;
|
|
317
|
-
#deliver;
|
|
318
|
-
#ctx() {
|
|
319
|
-
return { props: this.#props(), read: (store) => this.#binding.read(store) };
|
|
320
|
-
}
|
|
321
|
-
#storeChanged(store, state, prev) {
|
|
322
|
-
if (reducers['StoreChanged'] === undefined)
|
|
323
|
-
this.requestUpdate();
|
|
324
|
-
else
|
|
325
|
-
this.#dispatch({ _tag: 'StoreChanged', store: store.name, state, prev });
|
|
326
|
-
}
|
|
327
|
-
#props() {
|
|
328
|
-
// Sound: propNames are exactly the declared props, P's keys.
|
|
329
|
-
return readProps(this, propTable);
|
|
15
|
+
}
|
|
16
|
+
// One function serves both call forms; the overloads type the result.
|
|
17
|
+
export function define() {
|
|
18
|
+
return defineElement;
|
|
19
|
+
}
|
|
20
|
+
function defineElement(tag, spec) {
|
|
21
|
+
checkSpec(tag, spec);
|
|
22
|
+
if (typeof HTMLElement === 'undefined') {
|
|
23
|
+
// No DOM (Node, Workers): the server renderer renders the spec itself (Phase 4). Only the
|
|
24
|
+
// spec is recorded here, so the server registry code never reaches client bundles.
|
|
25
|
+
recordSpec(tag, spec);
|
|
26
|
+
return Object.assign(function Placeholder() {
|
|
27
|
+
throw new Error(message(1, tag));
|
|
28
|
+
}, { spec, tagName: tag });
|
|
29
|
+
}
|
|
30
|
+
const existing = customElements.get(tag);
|
|
31
|
+
if (existing !== undefined) {
|
|
32
|
+
if (DEV && existing.spec !== spec) {
|
|
33
|
+
console.warn(`<${tag}> is already defined with a different spec; keeping the first.`);
|
|
330
34
|
}
|
|
35
|
+
return existing;
|
|
331
36
|
}
|
|
37
|
+
const Element = elementClass(tag, spec);
|
|
332
38
|
markGyralHost(Element);
|
|
333
|
-
|
|
334
|
-
customElements.define(tag, Element);
|
|
335
|
-
// Sound: the declared props are reactive properties on every instance.
|
|
39
|
+
customElements.define(tag, Element);
|
|
336
40
|
return Element;
|
|
337
41
|
}
|
|
338
42
|
//# sourceMappingURL=define.js.map
|
package/dist/define.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.js","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,WAAW,EACX,QAAQ,EACR,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,SAAS,GAKV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAmB,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,WAA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AAQ,CAEN;QAEF,QAAQ,CAEN;QAEF,IAAI;YACF,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9E,CAAC;QAED,aAAa,CAAC,KAAe,EAAE,KAAc,EAAE,IAAa;YAC1D,IAAI,QAAQ,CAAC,cAAc,CAAC,KAAK,SAAS;gBAAE,IAAI,CAAC,aAAa,EAAE,CAAC;;gBAC5D,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAY,CAAC,CAAC;QAC1F,CAAC;QAED,MAAM;YACJ,6DAA6D;YAC7D,OAAO,SAAS,CAAC,IAAI,EAAE,SAAS,CAAM,CAAC;QACzC,CAAC;;IAGH,aAAa,CAAC,OAAO,CAAC,CAAC;IACvB,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;QAAE,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC/E,uEAAuE;IACvE,OAAO,OAAmD,CAAC;AAC7D,CAAC","sourcesContent":["import { isServer, LitElement } from 'lit';\nimport { providedDriver } from './drivers-scope.js';\nimport {\n DEVTOOLS_ENABLED,\n devCommands,\n devConnect,\n devHydrated,\n devOwner,\n devUpdate,\n} from '#devtools';\nimport {\n splitNext,\n type AnyDriver,\n type Command,\n type DriverOverrides,\n type Next,\n} from './command.js';\nimport { dispatchOutput, EMIT } from './children.js';\nimport { FOCUS, focusAfterUpdate, type FocusInput } from './focus.js';\nimport type { GyralElement, GyralElementClass } from './element-types.js';\nimport { fillEmptyTextParts, takeSeed, writeSeed } from './hydration.js';\nimport { markIsland, scheduleIsland } from './islands.js';\nimport { runInit } from './init.js';\nimport { handleIntent, intentNames, listenForIntents, markGyralHost } from './intent.js';\nimport {\n componentStyles,\n hydrateLight,\n hydrateShadow,\n isLight,\n markLightHost,\n} from './light-dom.js';\nimport { makeInterpreter, type Interpreter } from './internal/interpreter.js';\nimport {\n missingRequired,\n readProps,\n readRawProps,\n restoreProps,\n sameProps,\n shadowedBuiltins,\n type PropTable,\n} from './props.js';\nimport { attachStates, type StateSync } from './states.js';\nimport { STORE_SEND, type AnyStore, type StoreOverrides, type StoreSendInput } from './store.js';\nimport { StoreBinding } from './store-binding.js';\nimport { withViewTransition } from './transitions.js';\nimport type {\n ComponentSpec,\n Ctx,\n IntentNames,\n IntentParser,\n IntentRejected,\n Tagged,\n} from './types.js';\n\nexport type { GyralElement, GyralElementClass } from './element-types.js';\n\n// Lit types `isServer` per build condition; widen it so both branches type-check (ADR 0012).\nconst onServer: boolean = isServer;\n\nconst DEFER_HYDRATION = 'defer-hydration';\n\n/**\n * Has Lit's hydrate support patched LitElement? It then defers `defer-hydration` elements\n * itself. A bundler can evaluate Lit before `@gyral/ssr/hydrate`, so it may not have\n * (gyral-czi.41); the patch adds an own static `observedAttributes` to LitElement.\n */\nconst litDefers = (): boolean =>\n Object.prototype.hasOwnProperty.call(LitElement, 'observedAttributes');\n\n/**\n * Compiles a Model-View-Intent spec into a custom element and registers it under `tag`.\n * See docs/design-docs/0001-mvi-parsed-intent.md, 0006-effects-and-drivers.md, 0007-props.md\n * 0008-forms.md and 0012-ssr.md.\n */\nexport function define<S, M extends Tagged, P extends object = object, O extends Tagged = never>(\n tag: string,\n spec: ComponentSpec<S, M, P>,\n): GyralElementClass<S, M, P, O> {\n const propTable = (spec.props ?? {}) as PropTable;\n const propNames = Object.keys(propTable);\n const shadowed = onServer ? [] : shadowedBuiltins(propNames);\n if (shadowed.length > 0) {\n console.warn(\n `<${tag}> declares prop(s) that shadow built-in element properties: ` +\n `${shadowed.join(', ')}. Setting them changes platform behaviour ` +\n `(a prop named \"hidden\" hides the element). Rename them.`,\n );\n }\n const parsers = spec.intent as Readonly<Record<string, IntentParser<M> | undefined>>;\n // Sound: #dispatch() only calls the reducer whose key equals msg._tag.\n const reducers = spec.update as unknown as Readonly<\n Record<string, ((state: S, msg: Tagged, ctx: Ctx<P>) => Next<S, M>) | undefined>\n >;\n\n class Element extends LitElement implements GyralElement<S, M> {\n static override properties = spec.props ?? {};\n static override styles = componentStyles(spec, tag);\n static readonly spec = spec;\n static readonly tagName = tag;\n\n // Always observe `defer-hydration`, so Gyral can defer server-rendered children itself\n // when Lit's hydrate support isn't installed (gyral-czi.41, ADR 0012).\n static override get observedAttributes(): string[] {\n const base = super.observedAttributes;\n return base.includes(DEFER_HYDRATION) ? base : [...base, DEFER_HYDRATION];\n }\n\n drivers: DriverOverrides = {};\n stores: StoreOverrides = {};\n initialMessages: readonly Tagged[] = [];\n\n /** Reads, subscriptions and writes for spec.stores (ADR 0013). */\n #binding = new StoreBinding(\n this,\n tag,\n spec.stores ?? [],\n () => this.stores,\n (store, state, prev) => {\n this.#storeChanged(store, state, prev);\n },\n );\n #model: { value: S } | undefined;\n /** Props as of the last init or PropsChanged; the `prev` of the next PropsChanged. */\n #seenProps: P | undefined;\n #listening = false;\n #interpreter: Interpreter<M | IntentRejected> | undefined;\n #pending: Command<M | IntentRejected>[] = [];\n /** init's commands on the hydration path; started in firstUpdated (ADR 0012). */\n #afterHydration: readonly Command<M | IntentRejected>[] = [];\n /** Resumed from server markup; reported by the Hydrated message. */\n #serverRendered = false;\n /** The renderRoot is a server-rendered (declarative) shadow root to hydrate in place. */\n #ssrShadow = false;\n /** The latest view-transition update, awaited by updateComplete. */\n #transition: Promise<void> | undefined;\n /** Mirrors spec.states onto CSS custom states; only attached when the spec asks. */\n #syncStates: StateSync | undefined =\n spec.states === undefined || onServer ? undefined : attachStates(this);\n\n get state(): S {\n if (this.#model === undefined) {\n const missing = missingRequired(this, propTable);\n if (missing.length > 0) {\n console.warn(`<${tag}> is missing required prop(s): ${missing.join(', ')}.`);\n }\n this.#seenProps = this.#props();\n this.#apply(runInit(spec, this.#seenProps));\n for (const msg of this.initialMessages) this.#dispatch(msg, false);\n }\n return (this.#model as { value: S }).value;\n }\n\n send(msg: M): void {\n this.#dispatch(msg);\n }\n\n #dispatch(msg: Tagged, render = true): void {\n const reducer = reducers[msg._tag];\n if (reducer === undefined) {\n // Framework messages have optional reducers; props and stores stay readable as context.\n if (msg._tag !== 'PropsChanged' && msg._tag !== 'StoreChanged') {\n console.warn(`<${tag}> has no update for message \"${msg._tag}\".`);\n }\n return;\n }\n const prev = this.state;\n this.#apply(reducer(prev, msg, this.#ctx()));\n if (DEVTOOLS_ENABLED) devUpdate(this, tag, msg, prev, this.state);\n if (!render) return;\n if (spec.viewTransition?.(prev, this.state, msg) === true) {\n // The DOM change happens inside the transition callback (ADR 0001 addendum);\n // updateComplete waits for it, so tests and callers see the new DOM.\n this.#transition = withViewTransition(async () => {\n this.requestUpdate();\n await super.getUpdateComplete();\n }).catch((error: unknown) => {\n console.error(`<${tag}> view transition update failed`, error);\n });\n } else {\n this.requestUpdate();\n }\n }\n\n protected override async getUpdateComplete(): Promise<boolean> {\n await this.#transition;\n return super.getUpdateComplete();\n }\n\n override connectedCallback(): void {\n this.#resumeFromSeed();\n // A component server-rendered inside another's view waits (`defer-hydration`) for its\n // parent to hydrate first. Lit's hydrate support, when installed, defers LitElement\n // itself; otherwise Gyral holds back Lit's connect until the attribute goes.\n const waiting = this.hasAttribute(DEFER_HYDRATION);\n if (!waiting || litDefers()) super.connectedCallback();\n if (waiting) {\n scheduleIsland(this); // lazy islands release themselves (gyral-4k7.4)\n return;\n }\n this.#connect();\n }\n\n override attributeChangedCallback(name: string, old: string | null, value: string | null) {\n super.attributeChangedCallback(name, old, value);\n if (name !== DEFER_HYDRATION || value !== null || !this.isConnected) return;\n if (!litDefers()) super.connectedCallback(); // Lit's support would have connected it\n this.#connect();\n }\n\n #connect(): void {\n // Re-resolve on every connect: the nearest <gyral-stores> may differ after a move.\n if (this.#binding.connect()) this.requestUpdate();\n this.#interpreter = makeInterpreter<M | IntentRejected>(\n this.#resolve,\n (msg) => {\n this.#dispatch(msg);\n },\n DEVTOOLS_ENABLED ? devCommands(() => devOwner(this, tag)) : undefined,\n );\n if (DEVTOOLS_ENABLED) devConnect(this, tag, true);\n const pending = this.#pending;\n this.#pending = [];\n for (const cmd of pending) this.#interpreter.run(cmd);\n if (this.#listening) return;\n listenForIntents(this.renderRoot, spec.events ?? [], this.#onEvent);\n this.#listening = true;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#binding.disconnect();\n this.#interpreter?.dispose();\n this.#interpreter = undefined;\n if (DEVTOOLS_ENABLED) devConnect(this, tag, false);\n }\n\n protected override willUpdate(changed: Map<PropertyKey, unknown>): void {\n super.willUpdate(changed);\n if (onServer) {\n // Server renders run constructor, willUpdate and render only (ADR 0012).\n // init is pure, so the client can recompute an unchanged state from the props.\n const [initial] = splitNext(runInit(spec, this.#props()));\n writeSeed(this, this.state, readRawProps(this, propTable), propTable, { value: initial });\n if (isLight(spec)) markLightHost(this);\n markIsland(this, spec.hydrate);\n return;\n }\n const prev = this.#seenProps;\n if (prev === undefined) return; // first render: init() sees the props\n const props = this.#props();\n if (sameProps(propNames, props, prev)) return;\n this.#seenProps = props;\n // Inside the update cycle, so the new state renders in this same pass.\n this.#dispatch({ _tag: 'PropsChanged', props, prev } as Tagged, false);\n }\n\n // Light-DOM mode (ADR 0014): render into the element itself. A server-rendered shadow root\n // (Declarative Shadow DOM) is reused as is and hydrated in update() (gyral-czi.41): this\n // bypasses Lit's hydrate-support patch on purpose, so hydration is correct whether or not\n // that patch was installed before Lit evaluated (bundlers can reorder it; ADR 0012).\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n if (isLight(spec)) return this;\n if (!onServer && this.shadowRoot !== null) {\n this.#ssrShadow = true;\n return this.shadowRoot;\n }\n return super.createRenderRoot();\n }\n\n protected override update(changed: Map<PropertyKey, unknown>): void {\n if (this.#ssrShadow && !this.hasUpdated) {\n const styles = (this.constructor as typeof LitElement).elementStyles;\n hydrateShadow(this.renderRoot as ShadowRoot, this.render(), this.renderOptions, styles);\n }\n if (isLight(spec) && !this.hasUpdated && this.#serverRendered) {\n hydrateLight(this, this.render(), this.renderOptions); // ADR 0014\n }\n super.update(changed);\n }\n\n protected override render(): unknown {\n return spec.view(this.state, intentNames as IntentNames<M>, this.#ctx());\n }\n\n protected override updated(changed: Map<PropertyKey, unknown>): void {\n super.updated(changed);\n if (spec.states !== undefined) this.#syncStates?.(spec.states(this.state));\n }\n\n #apply(next: Next<S, M>): void {\n const [state, commands] = splitNext(next);\n this.#model = { value: state };\n if (onServer) return; // commands never run on the server; the client's init starts them\n for (const cmd of commands) {\n if (cmd.driver === EMIT) dispatchOutput(this, cmd.input);\n else if (cmd.driver === STORE_SEND) this.#binding.send(cmd.input as StoreSendInput);\n else if (cmd.driver === FOCUS) focusAfterUpdate(this, tag, cmd.input as FocusInput);\n else if (this.#interpreter === undefined) this.#pending.push(cmd);\n else this.#interpreter.run(cmd);\n }\n }\n\n /**\n * Hydration (ADR 0012): use the server's state and restore props that only travelled in the\n * seed. init(props) runs again for its commands only, and they start after the hydrating\n * render: a driver that answers synchronously must not change state before hydration.\n */\n #resumeFromSeed(): void {\n if (this.#model !== undefined) return;\n const seed = takeSeed(this);\n if (seed === undefined) return;\n restoreProps(this, propNames, seed.props);\n this.#seenProps = this.#props();\n const [initial, commands] = splitNext(runInit(spec, this.#seenProps));\n // Sound: the seed is this component's own state, serialized by writeSeed() on the server;\n // when absent, the server's state was exactly init(props) (seed deduplication).\n this.#model = { value: 'state' in seed ? (seed.state as S) : initial };\n this.#afterHydration = commands;\n this.#serverRendered = true;\n }\n\n protected override firstUpdated(changed: Map<PropertyKey, unknown>): void {\n super.firstUpdated(changed);\n if (this.#serverRendered) fillEmptyTextParts(this.renderRoot); // gyral-4k7.12\n if (DEVTOOLS_ENABLED) devHydrated(this, tag, this.#serverRendered);\n const commands = this.#afterHydration;\n const wantsHydrated = reducers['Hydrated'] !== undefined;\n if (commands.length === 0 && !wantsHydrated) return;\n this.#afterHydration = [];\n // After the first (possibly hydrating) update has fully completed, so whatever these\n // change starts a fresh update instead of diverging from the server markup.\n void this.updateComplete.then(() => {\n if (wantsHydrated) {\n this.#dispatch({ _tag: 'Hydrated', serverRendered: this.#serverRendered } as Tagged);\n }\n if (commands.length > 0) this.#apply([this.state, commands]);\n });\n }\n\n // el.drivers → nearest provider → spec.drivers → the command's own (gyral-czi.35).\n #resolve = (driver: AnyDriver): AnyDriver =>\n this.drivers[driver.name] ??\n providedDriver(this, driver.name) ??\n spec.drivers?.[driver.name] ??\n driver;\n\n #onEvent = (event: Event): void => {\n handleIntent(event, this.renderRoot, parsers, tag, this.#deliver);\n };\n\n #deliver = (msg: Tagged | undefined): void => {\n if (msg !== undefined && this.isConnected) this.#dispatch(msg);\n };\n\n #ctx(): Ctx<P> {\n return { props: this.#props(), read: (store) => this.#binding.read(store) };\n }\n\n #storeChanged(store: AnyStore, state: unknown, prev: unknown): void {\n if (reducers['StoreChanged'] === undefined) this.requestUpdate();\n else this.#dispatch({ _tag: 'StoreChanged', store: store.name, state, prev } as Tagged);\n }\n\n #props(): P {\n // Sound: propNames are exactly the declared props, P's keys.\n return readProps(this, propTable) as P;\n }\n }\n\n markGyralHost(Element);\n if (customElements.get(tag) === undefined) customElements.define(tag, Element);\n // Sound: the declared props are reactive properties on every instance.\n return Element as unknown as GyralElementClass<S, M, P, O>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,E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AC,CAAC;QACxF,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACxC,aAAa,CAAC,OAAO,CAAC,CAAC;IACvB,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// `define<S, M>()(tag, spec)` (docs/design-docs/view/05-element.md, ADR 0023): compiles a\n// Model-View-Intent spec into a custom element and registers it. Outside the browser it\n// records the spec in the server registry instead (view/06-server.md) and returns a\n// placeholder class.\nimport type { GyralElementClass } from './element-types.js';\nimport { elementClass } from './element.js';\nimport { markGyralHost } from './intent.js';\nimport { isLight } from './light-dom.js';\nimport { features } from './features.js';\nimport { recordSpec } from './server-specs.js';\nimport type { ComponentSpec, ShadowOption, Tagged } from './types.js';\nimport { DEV, message } from './view/index.js';\n\nexport type { GyralElement, GyralElementClass } from './element-types.js';\n\ninterface SpecShape {\n readonly props?: object;\n readonly shadow?: ShadowOption;\n readonly styles?: unknown;\n}\n\nfunction checkSpec(tag: string, spec: SpecShape): void {\n const names = Object.keys(spec.props ?? {});\n // The prop builders registered the prop feature (features.ts) if there are props.\n if (names.length > 0) features.props?.checkShadowed(tag, names);\n if (DEV && isLight(spec) && spec.styles !== undefined) {\n console.warn(`<${tag}> has shadow: false, so its styles are ignored; use document CSS.`);\n }\n}\n\n/** The second call of `define()`: takes the tag and the spec, infers the intent names. */\nexport type Definer<S, M extends Tagged, P extends object, O extends Tagged> = <\n N extends string = never,\n>(\n tag: string,\n spec: ComponentSpec<S, M, P, N>,\n) => GyralElementClass<S, M, P, O, N>;\n\n/**\n * Compiles a Model-View-Intent spec into a custom element and registers it under `tag`. Two\n * calls (ADR 0023): the first takes the types, the second the tag and spec, from whose\n * `intent` keys it infers the component's intent names.\n *\n * define<State, Msg>()('x-counter', { init, intent: { Increment: … }, update, view })\n *\n * With no type arguments, `define()('x-badge', spec)` infers the state, messages, props and\n * intent names from the spec. See docs/design-docs/0001-mvi-parsed-intent.md,\n * 0006-effects-and-drivers.md, 0007-props.md, 0008-forms.md and view/05-element.md.\n */\nexport function define(): <\n S,\n M extends Tagged = never,\n P extends object = object,\n N extends string = never,\n>(\n tag: string,\n spec: ComponentSpec<S, M, P, N>,\n) => GyralElementClass<S, M, P, never, N>;\nexport function define<\n S,\n // No messages: `define<State>()` for a pure view (intent and update optional).\n M extends Tagged = never,\n P extends object = object,\n O extends Tagged = never,\n>(): Definer<S, M, P, O>;\n// One function serves both call forms; the overloads type the result.\nexport function define(): (tag: string, spec: never) => unknown {\n return defineElement;\n}\n\nfunction defineElement(tag: string, spec: ComponentSpec<unknown, Tagged, object>): unknown {\n checkSpec(tag, spec);\n if (typeof HTMLElement === 'undefined') {\n // No DOM (Node, Workers): the server renderer renders the spec itself (Phase 4). Only the\n // spec is recorded here, so the server registry code never reaches client bundles.\n recordSpec(tag, spec);\n return Object.assign(\n function Placeholder(): never {\n throw new Error(message(1, tag));\n },\n { spec, tagName: tag },\n );\n }\n const existing = customElements.get(tag);\n if (existing !== undefined) {\n if (DEV && (existing as { readonly spec?: unknown }).spec !== spec) {\n console.warn(`<${tag}> is already defined with a different spec; keeping the first.`);\n }\n return existing;\n }\n const Element = elementClass(tag, spec);\n markGyralHost(Element);\n customElements.define(tag, Element);\n return Element;\n}\n"]}
|
|
@@ -35,10 +35,23 @@ export type DevEvent = {
|
|
|
35
35
|
readonly kind: 'hydrated';
|
|
36
36
|
readonly component: DevComponentRef;
|
|
37
37
|
readonly serverRendered: boolean;
|
|
38
|
+
} | {
|
|
39
|
+
/** The server DOM didn't match the first render (view/07-hydration.md "Mismatches"). */
|
|
40
|
+
readonly kind: 'mismatch';
|
|
41
|
+
readonly component: DevComponentRef;
|
|
42
|
+
readonly message: string;
|
|
38
43
|
} | ({
|
|
39
44
|
readonly kind: 'command';
|
|
40
45
|
readonly owner: string;
|
|
41
46
|
} & CommandTraceEvent) | {
|
|
47
|
+
/** A failure Gyral caught (ADR 0024): `component` is absent for stores and shared work. */
|
|
48
|
+
readonly kind: 'error';
|
|
49
|
+
readonly component?: DevComponentRef;
|
|
50
|
+
readonly phase: string;
|
|
51
|
+
readonly msg?: string;
|
|
52
|
+
readonly message: string;
|
|
53
|
+
readonly error: unknown;
|
|
54
|
+
} | {
|
|
42
55
|
readonly kind: 'store';
|
|
43
56
|
readonly store: string;
|
|
44
57
|
readonly msg: Tagged;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-events.js","sourceRoot":"","sources":["../src/devtools-events.ts"],"names":[],"mappings":"AAKA,oFAAoF;AACpF,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC","sourcesContent":["// The devtools event stream (ADR 0017). Types and the global hook name only: the emitting code\n// lives in devtools.ts (development builds) and devtools-off.ts (production builds).\nimport type { Concurrency } from './command.js';\nimport type { Tagged } from './types.js';\n\n/** Where a listener installs itself: `globalThis.__GYRAL_DEVTOOLS__ = { emit }`. */\nexport const DEVTOOLS_GLOBAL = '__GYRAL_DEVTOOLS__';\n\n/** A live component, identified for the timeline. `element` gives the panel its state. */\nexport interface DevComponentRef {\n readonly tag: string;\n readonly id: number;\n readonly element: Element;\n}\n\nexport type CommandPhase = 'issued' | 'dropped' | 'settled' | 'failed' | 'interrupted';\n\n/** What the interpreter reports about one command (ADR 0006 lanes and policies). */\nexport interface CommandTraceEvent {\n readonly phase: CommandPhase;\n readonly driver: string;\n readonly lane: string;\n readonly policy: Concurrency;\n readonly input: unknown;\n /** Driver output (`settled`) or error (`failed`). */\n readonly result?: unknown;\n}\n\nexport type CommandTrace = (event: CommandTraceEvent) => void;\n\nexport type DevEvent = { readonly at: number } & (\n | { readonly kind: 'connect' | 'disconnect'; readonly component: DevComponentRef }\n | {\n readonly kind: 'update';\n readonly component: DevComponentRef;\n readonly msg: Tagged;\n readonly prev: unknown;\n readonly next: unknown;\n }\n | {\n readonly kind: 'hydrated';\n readonly component: DevComponentRef;\n readonly serverRendered: boolean;\n }\n | ({ readonly kind: 'command'; readonly owner: string } & CommandTraceEvent)\n | {\n readonly kind: 'store';\n readonly store: string;\n readonly msg: Tagged;\n readonly prev: unknown;\n readonly next: unknown;\n }\n);\n\n/** Installed by a devtools panel (or a test) on `globalThis[DEVTOOLS_GLOBAL]`. */\nexport interface DevtoolsHook {\n emit(event: DevEvent): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"devtools-events.js","sourceRoot":"","sources":["../src/devtools-events.ts"],"names":[],"mappings":"AAKA,oFAAoF;AACpF,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC","sourcesContent":["// The devtools event stream (ADR 0017). Types and the global hook name only: the emitting code\n// lives in devtools.ts (development builds) and devtools-off.ts (production builds).\nimport type { Concurrency } from './command.js';\nimport type { Tagged } from './types.js';\n\n/** Where a listener installs itself: `globalThis.__GYRAL_DEVTOOLS__ = { emit }`. */\nexport const DEVTOOLS_GLOBAL = '__GYRAL_DEVTOOLS__';\n\n/** A live component, identified for the timeline. `element` gives the panel its state. */\nexport interface DevComponentRef {\n readonly tag: string;\n readonly id: number;\n readonly element: Element;\n}\n\nexport type CommandPhase = 'issued' | 'dropped' | 'settled' | 'failed' | 'interrupted';\n\n/** What the interpreter reports about one command (ADR 0006 lanes and policies). */\nexport interface CommandTraceEvent {\n readonly phase: CommandPhase;\n readonly driver: string;\n readonly lane: string;\n readonly policy: Concurrency;\n readonly input: unknown;\n /** Driver output (`settled`) or error (`failed`). */\n readonly result?: unknown;\n}\n\nexport type CommandTrace = (event: CommandTraceEvent) => void;\n\nexport type DevEvent = { readonly at: number } & (\n | { readonly kind: 'connect' | 'disconnect'; readonly component: DevComponentRef }\n | {\n readonly kind: 'update';\n readonly component: DevComponentRef;\n readonly msg: Tagged;\n readonly prev: unknown;\n readonly next: unknown;\n }\n | {\n readonly kind: 'hydrated';\n readonly component: DevComponentRef;\n readonly serverRendered: boolean;\n }\n | {\n /** The server DOM didn't match the first render (view/07-hydration.md \"Mismatches\"). */\n readonly kind: 'mismatch';\n readonly component: DevComponentRef;\n readonly message: string;\n }\n | ({ readonly kind: 'command'; readonly owner: string } & CommandTraceEvent)\n | {\n /** A failure Gyral caught (ADR 0024): `component` is absent for stores and shared work. */\n readonly kind: 'error';\n readonly component?: DevComponentRef;\n readonly phase: string;\n readonly msg?: string;\n readonly message: string;\n readonly error: unknown;\n }\n | {\n readonly kind: 'store';\n readonly store: string;\n readonly msg: Tagged;\n readonly prev: unknown;\n readonly next: unknown;\n }\n);\n\n/** Installed by a devtools panel (or a test) on `globalThis[DEVTOOLS_GLOBAL]`. */\nexport interface DevtoolsHook {\n emit(event: DevEvent): void;\n}\n"]}
|
package/dist/devtools-off.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ export declare const DEVTOOLS_ENABLED: boolean;
|
|
|
3
3
|
export declare const devConnect: typeof Dev.devConnect;
|
|
4
4
|
export declare const devUpdate: typeof Dev.devUpdate;
|
|
5
5
|
export declare const devHydrated: typeof Dev.devHydrated;
|
|
6
|
+
export declare const devMismatch: typeof Dev.devMismatch;
|
|
6
7
|
export declare const devStore: typeof Dev.devStore;
|
|
8
|
+
export declare const devError: typeof Dev.devError;
|
|
7
9
|
export declare const devCommands: typeof Dev.devCommands;
|
|
8
10
|
export declare const devOwner: typeof Dev.devOwner;
|
|
9
11
|
export declare const devLiveComponents: typeof Dev.devLiveComponents;
|
package/dist/devtools-off.js
CHANGED
|
@@ -3,7 +3,9 @@ const noop = () => undefined;
|
|
|
3
3
|
export const devConnect = noop;
|
|
4
4
|
export const devUpdate = noop;
|
|
5
5
|
export const devHydrated = noop;
|
|
6
|
+
export const devMismatch = noop;
|
|
6
7
|
export const devStore = noop;
|
|
8
|
+
export const devError = noop;
|
|
7
9
|
export const devCommands = () => noop;
|
|
8
10
|
export const devOwner = () => '';
|
|
9
11
|
export const devLiveComponents = () => [];
|
package/dist/devtools-off.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-off.js","sourceRoot":"","sources":["../src/devtools-off.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,gBAAgB,GAAY,KAAK,CAAC;AAE/C,MAAM,IAAI,GAAG,GAAS,EAAE,CAAC,SAAS,CAAC;AAEnC,MAAM,CAAC,MAAM,UAAU,GAA0B,IAAI,CAAC;AACtD,MAAM,CAAC,MAAM,SAAS,GAAyB,IAAI,CAAC;AACpD,MAAM,CAAC,MAAM,WAAW,GAA2B,IAAI,CAAC;AACxD,MAAM,CAAC,MAAM,QAAQ,GAAwB,IAAI,CAAC;AAClD,MAAM,CAAC,MAAM,WAAW,GAA2B,GAAG,EAAE,CAAC,IAAI,CAAC;AAC9D,MAAM,CAAC,MAAM,QAAQ,GAAwB,GAAG,EAAE,CAAC,EAAE,CAAC;AACtD,MAAM,CAAC,MAAM,iBAAiB,GAAiC,GAAG,EAAE,CAAC,EAAE,CAAC","sourcesContent":["// Production build of the devtools hook (ADR 0017): the same names as devtools.ts, doing\n// nothing. Call sites guard with DEVTOOLS_ENABLED, a literal `false` here, so bundlers drop\n// them entirely. The `typeof Dev.x` annotations keep both modules' signatures in sync.\nimport type * as Dev from './devtools.js';\n\nexport const DEVTOOLS_ENABLED: boolean = false;\n\nconst noop = (): void => undefined;\n\nexport const devConnect: typeof Dev.devConnect = noop;\nexport const devUpdate: typeof Dev.devUpdate = noop;\nexport const devHydrated: typeof Dev.devHydrated = noop;\nexport const devStore: typeof Dev.devStore = noop;\nexport const devCommands: typeof Dev.devCommands = () => noop;\nexport const devOwner: typeof Dev.devOwner = () => '';\nexport const devLiveComponents: typeof Dev.devLiveComponents = () => [];\n"]}
|
|
1
|
+
{"version":3,"file":"devtools-off.js","sourceRoot":"","sources":["../src/devtools-off.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,gBAAgB,GAAY,KAAK,CAAC;AAE/C,MAAM,IAAI,GAAG,GAAS,EAAE,CAAC,SAAS,CAAC;AAEnC,MAAM,CAAC,MAAM,UAAU,GAA0B,IAAI,CAAC;AACtD,MAAM,CAAC,MAAM,SAAS,GAAyB,IAAI,CAAC;AACpD,MAAM,CAAC,MAAM,WAAW,GAA2B,IAAI,CAAC;AACxD,MAAM,CAAC,MAAM,WAAW,GAA2B,IAAI,CAAC;AACxD,MAAM,CAAC,MAAM,QAAQ,GAAwB,IAAI,CAAC;AAClD,MAAM,CAAC,MAAM,QAAQ,GAAwB,IAAI,CAAC;AAClD,MAAM,CAAC,MAAM,WAAW,GAA2B,GAAG,EAAE,CAAC,IAAI,CAAC;AAC9D,MAAM,CAAC,MAAM,QAAQ,GAAwB,GAAG,EAAE,CAAC,EAAE,CAAC;AACtD,MAAM,CAAC,MAAM,iBAAiB,GAAiC,GAAG,EAAE,CAAC,EAAE,CAAC","sourcesContent":["// Production build of the devtools hook (ADR 0017): the same names as devtools.ts, doing\n// nothing. Call sites guard with DEVTOOLS_ENABLED, a literal `false` here, so bundlers drop\n// them entirely. The `typeof Dev.x` annotations keep both modules' signatures in sync.\nimport type * as Dev from './devtools.js';\n\nexport const DEVTOOLS_ENABLED: boolean = false;\n\nconst noop = (): void => undefined;\n\nexport const devConnect: typeof Dev.devConnect = noop;\nexport const devUpdate: typeof Dev.devUpdate = noop;\nexport const devHydrated: typeof Dev.devHydrated = noop;\nexport const devMismatch: typeof Dev.devMismatch = noop;\nexport const devStore: typeof Dev.devStore = noop;\nexport const devError: typeof Dev.devError = noop;\nexport const devCommands: typeof Dev.devCommands = () => noop;\nexport const devOwner: typeof Dev.devOwner = () => '';\nexport const devLiveComponents: typeof Dev.devLiveComponents = () => [];\n"]}
|
package/dist/devtools.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CommandTrace, type DevComponentRef } from './devtools-events.js';
|
|
2
|
+
import type { GyralError } from './errors.js';
|
|
2
3
|
import type { Tagged } from './types.js';
|
|
3
4
|
export declare const DEVTOOLS_ENABLED: boolean;
|
|
4
5
|
/** Components connected right now, for a panel that starts after they did. */
|
|
@@ -6,7 +7,10 @@ export declare function devLiveComponents(): readonly DevComponentRef[];
|
|
|
6
7
|
export declare function devConnect(element: Element, tag: string, connected: boolean): void;
|
|
7
8
|
export declare function devUpdate(element: Element, tag: string, msg: Tagged, prev: unknown, next: unknown): void;
|
|
8
9
|
export declare function devHydrated(element: Element, tag: string, serverRendered: boolean): void;
|
|
10
|
+
export declare function devMismatch(element: Element, tag: string, message: string): void;
|
|
9
11
|
export declare function devStore(store: string, msg: Tagged, prev: unknown, next: unknown): void;
|
|
12
|
+
/** A failure `fail()` reported (ADR 0024); `element` is the failing host, if any. */
|
|
13
|
+
export declare function devError(element: Element | undefined, error: GyralError): void;
|
|
10
14
|
/** A command tracer for one owner (`<tag>#id` or `store:name`). */
|
|
11
15
|
export declare function devCommands(owner: () => string): CommandTrace;
|
|
12
16
|
/** The label the panel shows for a component's commands. */
|
package/dist/devtools.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// with the `development` condition; production builds get devtools-off.ts instead, so the
|
|
3
3
|
// guarded call sites (`if (DEVTOOLS_ENABLED) …`) disappear from the bundle.
|
|
4
4
|
import { DEVTOOLS_GLOBAL, } from './devtools-events.js';
|
|
5
|
-
import { warnLeakingLitHtmlOnce } from './lit-html-check.js';
|
|
6
5
|
export const DEVTOOLS_ENABLED = true;
|
|
7
6
|
const hook = () => globalThis[DEVTOOLS_GLOBAL];
|
|
8
7
|
const ids = new WeakMap();
|
|
@@ -35,7 +34,6 @@ export function devLiveComponents() {
|
|
|
35
34
|
return [...live].map(([element, tag]) => ref(element, tag));
|
|
36
35
|
}
|
|
37
36
|
export function devConnect(element, tag, connected) {
|
|
38
|
-
warnLeakingLitHtmlOnce();
|
|
39
37
|
if (connected)
|
|
40
38
|
live.set(element, tag);
|
|
41
39
|
else
|
|
@@ -52,9 +50,26 @@ export function devUpdate(element, tag, msg, prev, next) {
|
|
|
52
50
|
export function devHydrated(element, tag, serverRendered) {
|
|
53
51
|
emit(() => ({ kind: 'hydrated', component: ref(element, tag), serverRendered, at: now() }));
|
|
54
52
|
}
|
|
53
|
+
export function devMismatch(element, tag, message) {
|
|
54
|
+
emit(() => ({ kind: 'mismatch', component: ref(element, tag), message, at: now() }));
|
|
55
|
+
}
|
|
55
56
|
export function devStore(store, msg, prev, next) {
|
|
56
57
|
emit(() => ({ kind: 'store', store, msg, prev, next, at: now() }));
|
|
57
58
|
}
|
|
59
|
+
/** A failure `fail()` reported (ADR 0024); `element` is the failing host, if any. */
|
|
60
|
+
export function devError(element, error) {
|
|
61
|
+
emit(() => ({
|
|
62
|
+
kind: 'error',
|
|
63
|
+
...(element === undefined
|
|
64
|
+
? {}
|
|
65
|
+
: { component: ref(element, error.component ?? element.localName) }),
|
|
66
|
+
phase: error.phase,
|
|
67
|
+
...(error.msg === undefined ? {} : { msg: error.msg }),
|
|
68
|
+
message: error.message,
|
|
69
|
+
error: error.cause,
|
|
70
|
+
at: now(),
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
58
73
|
/** A command tracer for one owner (`<tag>#id` or `store:name`). */
|
|
59
74
|
export function devCommands(owner) {
|
|
60
75
|
return (event) => {
|
package/dist/devtools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools.js","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,0FAA0F;AAC1F,4EAA4E;AAC5E,OAAO,EACL,eAAe,GAKhB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"devtools.js","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,0FAA0F;AAC1F,4EAA4E;AAC5E,OAAO,EACL,eAAe,GAKhB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,CAAC,MAAM,gBAAgB,GAAY,IAAI,CAAC;AAE9C,MAAM,IAAI,GAAG,GAA6B,EAAE,CACzC,UAAsC,CAAC,eAAe,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pD,CAAC","sourcesContent":["// Development build of the devtools hook (ADR 0017). Resolved through the `#devtools` import\n// with the `development` condition; production builds get devtools-off.ts instead, so the\n// guarded call sites (`if (DEVTOOLS_ENABLED) …`) disappear from the bundle.\nimport {\n DEVTOOLS_GLOBAL,\n type CommandTrace,\n type DevComponentRef,\n type DevEvent,\n type DevtoolsHook,\n} from './devtools-events.js';\nimport type { GyralError } from './errors.js';\nimport type { Tagged } from './types.js';\n\nexport const DEVTOOLS_ENABLED: boolean = true;\n\nconst hook = (): DevtoolsHook | undefined =>\n (globalThis as Record<string, unknown>)[DEVTOOLS_GLOBAL] as DevtoolsHook | undefined;\n\nconst ids = new WeakMap<Element, number>();\nlet nextId = 1;\n\nfunction ref(element: Element, tag: string): DevComponentRef {\n let id = ids.get(element);\n if (id === undefined) {\n id = nextId++;\n ids.set(element, id);\n }\n return { tag, id, element };\n}\n\n// Builds nothing unless a listener is installed: zero cost in dev without devtools.\nfunction emit(make: () => DevEvent): void {\n const listener = hook();\n if (listener === undefined) return;\n try {\n listener.emit(make());\n } catch (error) {\n console.error('gyral devtools listener threw', error);\n }\n}\n\nconst now = (): number => performance.now();\n\n/** Connected components, so a panel loaded later still lists them (dev builds only). */\nconst live = new Map<Element, string>();\n\n/** Components connected right now, for a panel that starts after they did. */\nexport function devLiveComponents(): readonly DevComponentRef[] {\n return [...live].map(([element, tag]) => ref(element, tag));\n}\n\nexport function devConnect(element: Element, tag: string, connected: boolean): void {\n if (connected) live.set(element, tag);\n else live.delete(element);\n emit(() => ({\n kind: connected ? 'connect' : 'disconnect',\n component: ref(element, tag),\n at: now(),\n }));\n}\n\nexport function devUpdate(\n element: Element,\n tag: string,\n msg: Tagged,\n prev: unknown,\n next: unknown,\n) {\n emit(() => ({ kind: 'update', component: ref(element, tag), msg, prev, next, at: now() }));\n}\n\nexport function devHydrated(element: Element, tag: string, serverRendered: boolean): void {\n emit(() => ({ kind: 'hydrated', component: ref(element, tag), serverRendered, at: now() }));\n}\n\nexport function devMismatch(element: Element, tag: string, message: string): void {\n emit(() => ({ kind: 'mismatch', component: ref(element, tag), message, at: now() }));\n}\n\nexport function devStore(store: string, msg: Tagged, prev: unknown, next: unknown): void {\n emit(() => ({ kind: 'store', store, msg, prev, next, at: now() }));\n}\n\n/** A failure `fail()` reported (ADR 0024); `element` is the failing host, if any. */\nexport function devError(element: Element | undefined, error: GyralError): void {\n emit(() => ({\n kind: 'error',\n ...(element === undefined\n ? {}\n : { component: ref(element, error.component ?? element.localName) }),\n phase: error.phase,\n ...(error.msg === undefined ? {} : { msg: error.msg }),\n message: error.message,\n error: error.cause,\n at: now(),\n }));\n}\n\n/** A command tracer for one owner (`<tag>#id` or `store:name`). */\nexport function devCommands(owner: () => string): CommandTrace {\n return (event) => {\n emit(() => ({ kind: 'command', owner: owner(), ...event, at: now() }));\n };\n}\n\n/** The label the panel shows for a component's commands. */\nexport function devOwner(element: Element, tag: string): string {\n return `<${tag}>#${String(ref(element, tag).id)}`;\n}\n"]}
|
package/dist/drivers-scope.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export declare function provideDrivers(element: Element, drivers: DriverOverride
|
|
|
10
10
|
/**
|
|
11
11
|
* The override for `name` from the nearest provider that has one. Providers nest: an inner
|
|
12
12
|
* provider without that driver lets an outer one supply it. Commands never run on the server,
|
|
13
|
-
* so
|
|
13
|
+
* so only the browser calls this.
|
|
14
14
|
*/
|
|
15
15
|
export declare function providedDriver(host: Element, name: string): AnyDriver | undefined;
|