@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/hydration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydration.js","sourceRoot":"","sources":["../src/hydration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hydration.js","sourceRoot":"","sources":["../src/hydration.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,0FAA0F;AAC1F,+FAA+F;AAC/F,6FAA6F;AAC7F,2FAA2F;AAC3F,yFAAyF;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,iFAAiF;AACjF,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAYhD,uFAAuF;AACvF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAE,CAAU,EAAW,EAAE,CAC1D,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,QAAQ,CACtB,GAAW,EACX,KAAc,EACd,OAAgB,EAChB,OAA0C;IAE1C,MAAM,IAAI,GAAS,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAC7F,IAAI,GAAG;QAAE,cAAc,CAAC,IAAI,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,wCAAwC;IAE3F,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// Server-render seeds (docs/design-docs/0012-ssr.md, view/06-server.md \"Components\"). The\n// server writes each component's state, plus the props an attribute can't carry, into one\n// attribute; the client reads it on connect, before its first render, so both sides start from\n// the same state. The client reads seeds in hydration-loader.ts (core's `#hydration-loader`:\n// hydration-off.ts in client-only builds); the walk that then hydrates the server's DOM is\n// hydration-client.ts, which the loader imports lazily (view/07-hydration.md \"Loading\").\nimport { warnJsonHazard } from './json-safety.js';\nimport { DEV } from './view/index.js';\n\n/** Host attribute holding the JSON seed. Removed once the client has read it. */\nexport const SEED_ATTRIBUTE = 'data-gyral-seed';\n\nexport interface Seed {\n /**\n * The server's state. Omitted when it equals what `init(props)` returns for the seeded\n * props (gyral-czi 4k7.10): the client recomputes it instead of reading a second copy of\n * data the props already carry.\n */\n readonly state?: unknown;\n readonly props: Readonly<Record<string, unknown>>;\n}\n\n/** JSON equality: seeds are JSON, so two values that serialize alike hydrate alike. */\nexport const sameJson = (a: unknown, b: unknown): boolean =>\n JSON.stringify(a) === JSON.stringify(b);\n\n/**\n * Server side: the seed for a component whose props `carried` travel in no attribute\n * (property holes) and whose state is `state`; `initial` is `init(props)`'s state.\n */\nexport function makeSeed(\n tag: string,\n state: unknown,\n initial: unknown,\n carried: Readonly<Record<string, unknown>>,\n): Seed {\n const seed: Seed = sameJson(state, initial) ? { props: carried } : { state, props: carried };\n if (DEV) warnJsonHazard(`<${tag}>`, seed, 'seed'); // view/06-server.md \"Seed\": development\n\n return seed;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,43 +1,31 @@
|
|
|
1
1
|
export { command, defineDriver } from './command.js';
|
|
2
|
-
export type { AnyDriver, Command, CommandHandlers, Concurrency, Driver, DriverContext, DriverOverrides, Next, RetryPolicy, } from './command.js';
|
|
3
|
-
export {
|
|
2
|
+
export type { AnyDriver, Command, CommandHandlers, Concurrency, Driver, DriverContext, DriverOverrides, DriverToken, Next, RetryPolicy, } from './command.js';
|
|
3
|
+
export { retry } from './retry.js';
|
|
4
|
+
export { subscription } from './subscription.js';
|
|
5
|
+
export type { SubscriptionContext, SubscriptionOptions, Unsubscribe } from './subscription.js';
|
|
6
|
+
export { child, outputs } from './children.js';
|
|
4
7
|
export { focus } from './focus.js';
|
|
8
|
+
export { call, type CallInput } from './call.js';
|
|
5
9
|
export type { FocusOptions } from './focus.js';
|
|
6
|
-
export { invokersSupported } from './invokers.js';
|
|
7
10
|
export type { CommandInfo } from './invokers.js';
|
|
8
|
-
export { ISLAND_ATTRIBUTE } from './islands.js';
|
|
9
11
|
export type { HydrateStrategy } from './islands.js';
|
|
10
|
-
export type { ChildSource, OutputSource } from './children.js';
|
|
12
|
+
export type { ChildSource, OutputEvent, OutputSource, OutputsOf } from './children.js';
|
|
11
13
|
export { define } from './define.js';
|
|
14
|
+
export { intentsOf, OUTPUT_EVENT } from './intent.js';
|
|
15
|
+
export { settled } from './settled.js';
|
|
16
|
+
export { componentsReady } from './components-ready.js';
|
|
17
|
+
export { GyralError, type ErrorPhase } from './errors.js';
|
|
12
18
|
export { changed, defineStore, send } from './store.js';
|
|
13
|
-
export type { AnyStore, AnyStoreInstance, Store, StoreChanged, StoreInstance, StoreOverrides, StoreRef,
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export type {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export { liveBoolean } from './live-boolean.js';
|
|
27
|
-
export { textarea, textareaMarkup } from './textarea.js';
|
|
28
|
-
export { DEVTOOLS_ENABLED as devtoolsEnabled, devLiveComponents as devtoolsLiveComponents, } from '#devtools';
|
|
29
|
-
export { DEVTOOLS_GLOBAL } from './devtools-events.js';
|
|
30
|
-
export type { CommandPhase, CommandTraceEvent, DevComponentRef, DevEvent, DevtoolsHook, } from './devtools-events.js';
|
|
31
|
-
export type { TextareaAttribute, TextareaOptions } from './textarea.js';
|
|
32
|
-
export type { Styles } from './styles.js';
|
|
33
|
-
export { HIDDEN_MARKER, HYDRATE_KEY, isLightComponent, LIGHT_ATTRIBUTE } from './light-dom.js';
|
|
34
|
-
export type { GyralElement, GyralElementClass } from './define.js';
|
|
35
|
-
export type { ComponentSpec, Ctx, FieldIssue, FormFields, IntentInput, IntentNames, IntentParser, IntentRejected, Intents, PropDeclarations, Hydrated, PropsChanged, Stateless, StoreReader, Tagged, Update, } from './types.js';
|
|
36
|
-
export { css, nothing, unsafeCSS } from 'lit';
|
|
37
|
-
export { html, svg } from './templates.js';
|
|
38
|
-
export { directive } from 'lit/directive.js';
|
|
39
|
-
export { classMap } from 'lit/directives/class-map.js';
|
|
40
|
-
export { keyed } from 'lit/directives/keyed.js';
|
|
41
|
-
export { live } from 'lit/directives/live.js';
|
|
42
|
-
export { repeat } from 'lit/directives/repeat.js';
|
|
43
|
-
export { styleMap } from 'lit/directives/style-map.js';
|
|
19
|
+
export type { AnyStore, AnyStoreInstance, Store, StoreChanged, StoreInstance, StoreOverrides, StoreRef, SeedCheck, StoreResolver, StoreSpec, StoreUpdate, } from './store.js';
|
|
20
|
+
export { provideDrivers } from './drivers-scope.js';
|
|
21
|
+
export { defineForm, field, fieldErrors, form } from './forms.js';
|
|
22
|
+
export type { FieldName, FormDefinition, FormOptions, FormResult, FormValue, FormValues, } from './forms.js';
|
|
23
|
+
export { invalid } from './hooks/invalid.js';
|
|
24
|
+
export type { FormAssociation, FormControlValue, FormControlValidity, FormDisabled, FormReset, FormStateRestore, } from './form-associated.js';
|
|
25
|
+
export { prop } from './prop.js';
|
|
26
|
+
export type { Prop, PropGuard, PropKind, PropsOf } from './prop.js';
|
|
27
|
+
export type { Definer, GyralElement, GyralElementClass } from './define.js';
|
|
28
|
+
export type { ComponentSpec, Ctx, FieldIssue, FormFields, IntentInput, IntentNames, IntentParser, IntentRejected, Intents, ParserCtx, ParserFor, PropDeclarations, Errored, Hydrated, PropsChanged, ShadowOption, Stateless, StoreReader, Tagged, Update, } from './types.js';
|
|
29
|
+
export { css, defineHook, each, html, keyed, nothing, raw, svg } from './view/index.js';
|
|
30
|
+
export type { ChildValue, CssValue, HookAttributes, HookResult, HookSpec, ListResult, RawResult, StyleSource, Styles, TemplateResult, } from './view/index.js';
|
|
31
|
+
export type { Head, HeadLink, HeadMeta, JsonValue } from './head.js';
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,19 @@
|
|
|
1
1
|
export { command, defineDriver } from './command.js';
|
|
2
|
-
export {
|
|
2
|
+
export { retry } from './retry.js';
|
|
3
|
+
export { subscription } from './subscription.js';
|
|
4
|
+
export { child, outputs } from './children.js';
|
|
3
5
|
export { focus } from './focus.js';
|
|
4
|
-
export {
|
|
5
|
-
export { ISLAND_ATTRIBUTE } from './islands.js';
|
|
6
|
+
export { call } from './call.js';
|
|
6
7
|
export { define } from './define.js';
|
|
8
|
+
export { intentsOf, OUTPUT_EVENT } from './intent.js';
|
|
9
|
+
export { settled } from './settled.js';
|
|
10
|
+
export { componentsReady } from './components-ready.js';
|
|
11
|
+
export { GyralError } from './errors.js';
|
|
7
12
|
export { changed, defineStore, send } from './store.js';
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
export { random, randomDriver, randomInt, toInt } from './random.js';
|
|
15
|
-
export { defineForm, field, fieldErrors, form, formDataToObject, formFields, intentRejectedSchema, redirectedTo, validateForm, } from './forms.js';
|
|
16
|
-
export { ElementDirective } from './element-directive.js';
|
|
17
|
-
export { runInit } from './init.js';
|
|
18
|
-
export { invalid } from './invalid.js';
|
|
19
|
-
export { findInScope, labelledBy } from './accessible-name.js';
|
|
20
|
-
export { liveBoolean } from './live-boolean.js';
|
|
21
|
-
export { textarea, textareaMarkup } from './textarea.js';
|
|
22
|
-
// Devtools event stream (ADR 0017): emitted in development builds only.
|
|
23
|
-
export { DEVTOOLS_ENABLED as devtoolsEnabled, devLiveComponents as devtoolsLiveComponents, } from '#devtools';
|
|
24
|
-
export { DEVTOOLS_GLOBAL } from './devtools-events.js';
|
|
25
|
-
// Used by @gyral/ssr to render light-DOM components as plain children (ADR 0014).
|
|
26
|
-
export { HIDDEN_MARKER, HYDRATE_KEY, isLightComponent, LIGHT_ATTRIBUTE } from './light-dom.js';
|
|
27
|
-
// The view layer is Lit. Re-exported so most apps need a single import. `html` and `svg` are
|
|
28
|
-
// Lit's tags with indentation whitespace removed (template-whitespace.ts, gyral-9rf).
|
|
29
|
-
export { css, nothing, unsafeCSS } from 'lit';
|
|
30
|
-
export { html, svg } from './templates.js';
|
|
31
|
-
export { directive } from 'lit/directive.js';
|
|
32
|
-
export { classMap } from 'lit/directives/class-map.js';
|
|
33
|
-
export { keyed } from 'lit/directives/keyed.js';
|
|
34
|
-
export { live } from 'lit/directives/live.js';
|
|
35
|
-
export { repeat } from 'lit/directives/repeat.js';
|
|
36
|
-
export { styleMap } from 'lit/directives/style-map.js';
|
|
13
|
+
export { provideDrivers } from './drivers-scope.js';
|
|
14
|
+
export { defineForm, field, fieldErrors, form } from './forms.js';
|
|
15
|
+
export { invalid } from './hooks/invalid.js';
|
|
16
|
+
export { prop } from './prop.js';
|
|
17
|
+
// The view layer (ADR 0018, docs/design-docs/view/): templates, lists, hooks and styles.
|
|
18
|
+
export { css, defineHook, each, html, keyed, nothing, raw, svg } from './view/index.js';
|
|
37
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAarD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAkB,MAAM,WAAW,CAAC;AAKjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAmB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAcxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AASlE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAS7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA0BjC,yFAAyF;AACzF,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { command, defineDriver } from './command.js';\nexport type {\n AnyDriver,\n Command,\n CommandHandlers,\n Concurrency,\n Driver,\n DriverContext,\n DriverOverrides,\n DriverToken,\n Next,\n RetryPolicy,\n} from './command.js';\nexport { retry } from './retry.js';\nexport { subscription } from './subscription.js';\nexport type { SubscriptionContext, SubscriptionOptions, Unsubscribe } from './subscription.js';\nexport { child, outputs } from './children.js';\nexport { focus } from './focus.js';\nexport { call, type CallInput } from './call.js';\nexport type { FocusOptions } from './focus.js';\nexport type { CommandInfo } from './invokers.js';\nexport type { HydrateStrategy } from './islands.js';\nexport type { ChildSource, OutputEvent, OutputSource, OutputsOf } from './children.js';\nexport { define } from './define.js';\nexport { intentsOf, OUTPUT_EVENT } from './intent.js';\nexport { settled } from './settled.js';\nexport { componentsReady } from './components-ready.js';\nexport { GyralError, type ErrorPhase } from './errors.js';\nexport { changed, defineStore, send } from './store.js';\nexport type {\n AnyStore,\n AnyStoreInstance,\n Store,\n StoreChanged,\n StoreInstance,\n StoreOverrides,\n StoreRef,\n SeedCheck,\n StoreResolver,\n StoreSpec,\n StoreUpdate,\n} from './store.js';\nexport { provideDrivers } from './drivers-scope.js';\nexport { defineForm, field, fieldErrors, form } from './forms.js';\nexport type {\n FieldName,\n FormDefinition,\n FormOptions,\n FormResult,\n FormValue,\n FormValues,\n} from './forms.js';\nexport { invalid } from './hooks/invalid.js';\nexport type {\n FormAssociation,\n FormControlValue,\n FormControlValidity,\n FormDisabled,\n FormReset,\n FormStateRestore,\n} from './form-associated.js';\nexport { prop } from './prop.js';\nexport type { Prop, PropGuard, PropKind, PropsOf } from './prop.js';\nexport type { Definer, GyralElement, GyralElementClass } from './define.js';\nexport type {\n ComponentSpec,\n Ctx,\n FieldIssue,\n FormFields,\n IntentInput,\n IntentNames,\n IntentParser,\n IntentRejected,\n Intents,\n ParserCtx,\n ParserFor,\n PropDeclarations,\n Errored,\n Hydrated,\n PropsChanged,\n ShadowOption,\n Stateless,\n StoreReader,\n Tagged,\n Update,\n} from './types.js';\n\n// The view layer (ADR 0018, docs/design-docs/view/): templates, lists, hooks and styles.\nexport { css, defineHook, each, html, keyed, nothing, raw, svg } from './view/index.js';\nexport type {\n ChildValue,\n CssValue,\n HookAttributes,\n HookResult,\n HookSpec,\n ListResult,\n RawResult,\n StyleSource,\n Styles,\n TemplateResult,\n} from './view/index.js';\n\n// The head model (ADR 0019): shared by @gyral/ssr's renderPage() and @gyral/router's setHead().\nexport type { Head, HeadLink, HeadMeta, JsonValue } from './head.js';\n"]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
export type IndexedDBStores = Readonly<Record<string, StandardSchemaV1>>;
|
|
3
|
+
export type IndexedDBRecord<S extends StandardSchemaV1> = StandardSchemaV1.InferOutput<S>;
|
|
4
|
+
export type IndexedDBRange = {
|
|
5
|
+
readonly _tag: 'Only';
|
|
6
|
+
readonly key: IDBValidKey;
|
|
7
|
+
} | {
|
|
8
|
+
readonly _tag: 'Lower' | 'Upper';
|
|
9
|
+
readonly key: IDBValidKey;
|
|
10
|
+
readonly open?: boolean;
|
|
11
|
+
} | {
|
|
12
|
+
readonly _tag: 'Bound';
|
|
13
|
+
readonly lower: IDBValidKey;
|
|
14
|
+
readonly upper: IDBValidKey;
|
|
15
|
+
readonly lowerOpen?: boolean;
|
|
16
|
+
readonly upperOpen?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type IndexedDBOperation<S extends IndexedDBStores> = {
|
|
19
|
+
[K in keyof S & string]: {
|
|
20
|
+
readonly _tag: 'Read' | 'Delete';
|
|
21
|
+
readonly store: K;
|
|
22
|
+
readonly key: IDBValidKey;
|
|
23
|
+
} | {
|
|
24
|
+
readonly _tag: 'Put';
|
|
25
|
+
readonly store: K;
|
|
26
|
+
readonly value: IndexedDBRecord<S[K]>;
|
|
27
|
+
readonly key?: IDBValidKey;
|
|
28
|
+
} | {
|
|
29
|
+
readonly _tag: 'Query';
|
|
30
|
+
readonly store: K;
|
|
31
|
+
readonly index?: string;
|
|
32
|
+
readonly range?: IndexedDBRange;
|
|
33
|
+
readonly direction?: IDBCursorDirection;
|
|
34
|
+
readonly limit: number;
|
|
35
|
+
};
|
|
36
|
+
}[keyof S & string];
|
|
37
|
+
export type IndexedDBInput<S extends IndexedDBStores> = IndexedDBOperation<S> | {
|
|
38
|
+
readonly _tag: 'Transaction';
|
|
39
|
+
readonly operations: readonly IndexedDBOperation<S>[];
|
|
40
|
+
};
|
|
41
|
+
export type IndexedDBResult<S extends IndexedDBStores> = {
|
|
42
|
+
[K in keyof S & string]: {
|
|
43
|
+
readonly _tag: 'Record';
|
|
44
|
+
readonly store: K;
|
|
45
|
+
readonly key: IDBValidKey;
|
|
46
|
+
readonly entry: {
|
|
47
|
+
readonly found: false;
|
|
48
|
+
} | {
|
|
49
|
+
readonly found: true;
|
|
50
|
+
readonly value: IndexedDBRecord<S[K]>;
|
|
51
|
+
};
|
|
52
|
+
} | {
|
|
53
|
+
readonly _tag: 'Put' | 'Deleted';
|
|
54
|
+
readonly store: K;
|
|
55
|
+
readonly key: IDBValidKey;
|
|
56
|
+
} | {
|
|
57
|
+
readonly _tag: 'Records';
|
|
58
|
+
readonly store: K;
|
|
59
|
+
readonly records: readonly {
|
|
60
|
+
readonly key: IDBValidKey;
|
|
61
|
+
readonly value: IndexedDBRecord<S[K]>;
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
}[keyof S & string];
|
|
65
|
+
export type IndexedDBOutput<S extends IndexedDBStores> = IndexedDBResult<S> | {
|
|
66
|
+
readonly _tag: 'Committed';
|
|
67
|
+
readonly results: readonly IndexedDBResult<S>[];
|
|
68
|
+
};
|
|
69
|
+
export type IndexedDBError = {
|
|
70
|
+
readonly _tag: 'IndexedDBBlockedError';
|
|
71
|
+
readonly database: string;
|
|
72
|
+
readonly version: number;
|
|
73
|
+
} | {
|
|
74
|
+
readonly _tag: 'IndexedDBInputError';
|
|
75
|
+
readonly message: string;
|
|
76
|
+
} | {
|
|
77
|
+
readonly _tag: 'IndexedDBAccessError';
|
|
78
|
+
readonly database: string;
|
|
79
|
+
readonly phase: 'encode' | 'open' | 'upgrade' | 'transaction';
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly message: string;
|
|
82
|
+
} | {
|
|
83
|
+
readonly _tag: 'IndexedDBDecodeError';
|
|
84
|
+
readonly store: string;
|
|
85
|
+
readonly issues: readonly StandardSchemaV1.Issue[];
|
|
86
|
+
/** Native transaction completed before decoding. Its writes cannot be undone. */
|
|
87
|
+
readonly committed: true;
|
|
88
|
+
};
|
|
89
|
+
export interface IndexedDBOptions<S extends IndexedDBStores> {
|
|
90
|
+
readonly database: string;
|
|
91
|
+
readonly version: number;
|
|
92
|
+
readonly name?: string;
|
|
93
|
+
readonly factory?: () => IDBFactory;
|
|
94
|
+
/** Synchronous: queue migration requests before returning; never await. */
|
|
95
|
+
readonly upgrade?: (db: IDBDatabase, oldVersion: number, newVersion: number, transaction: IDBTransaction) => void;
|
|
96
|
+
readonly encode?: <K extends keyof S & string>(store: K, value: IndexedDBRecord<S[K]>) => unknown;
|
|
97
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexeddb-types.js","sourceRoot":"","sources":["../src/indexeddb-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StandardSchemaV1 } from '@standard-schema/spec';\n\nexport type IndexedDBStores = Readonly<Record<string, StandardSchemaV1>>;\nexport type IndexedDBRecord<S extends StandardSchemaV1> = StandardSchemaV1.InferOutput<S>;\nexport type IndexedDBRange =\n | { readonly _tag: 'Only'; readonly key: IDBValidKey }\n | { readonly _tag: 'Lower' | 'Upper'; readonly key: IDBValidKey; readonly open?: boolean }\n | {\n readonly _tag: 'Bound';\n readonly lower: IDBValidKey;\n readonly upper: IDBValidKey;\n readonly lowerOpen?: boolean;\n readonly upperOpen?: boolean;\n };\nexport type IndexedDBOperation<S extends IndexedDBStores> = {\n [K in keyof S & string]:\n | { readonly _tag: 'Read' | 'Delete'; readonly store: K; readonly key: IDBValidKey }\n | {\n readonly _tag: 'Put';\n readonly store: K;\n readonly value: IndexedDBRecord<S[K]>;\n readonly key?: IDBValidKey;\n }\n | {\n readonly _tag: 'Query';\n readonly store: K;\n readonly index?: string;\n readonly range?: IndexedDBRange;\n readonly direction?: IDBCursorDirection;\n readonly limit: number;\n };\n}[keyof S & string];\nexport type IndexedDBInput<S extends IndexedDBStores> =\n | IndexedDBOperation<S>\n | { readonly _tag: 'Transaction'; readonly operations: readonly IndexedDBOperation<S>[] };\nexport type IndexedDBResult<S extends IndexedDBStores> = {\n [K in keyof S & string]:\n | {\n readonly _tag: 'Record';\n readonly store: K;\n readonly key: IDBValidKey;\n readonly entry:\n | { readonly found: false }\n | { readonly found: true; readonly value: IndexedDBRecord<S[K]> };\n }\n | { readonly _tag: 'Put' | 'Deleted'; readonly store: K; readonly key: IDBValidKey }\n | {\n readonly _tag: 'Records';\n readonly store: K;\n readonly records: readonly {\n readonly key: IDBValidKey;\n readonly value: IndexedDBRecord<S[K]>;\n }[];\n };\n}[keyof S & string];\nexport type IndexedDBOutput<S extends IndexedDBStores> =\n | IndexedDBResult<S>\n | { readonly _tag: 'Committed'; readonly results: readonly IndexedDBResult<S>[] };\nexport type IndexedDBError =\n | { readonly _tag: 'IndexedDBBlockedError'; readonly database: string; readonly version: number }\n | { readonly _tag: 'IndexedDBInputError'; readonly message: string }\n | {\n readonly _tag: 'IndexedDBAccessError';\n readonly database: string;\n readonly phase: 'encode' | 'open' | 'upgrade' | 'transaction';\n readonly name: string;\n readonly message: string;\n }\n | {\n readonly _tag: 'IndexedDBDecodeError';\n readonly store: string;\n readonly issues: readonly StandardSchemaV1.Issue[];\n /** Native transaction completed before decoding. Its writes cannot be undone. */\n readonly committed: true;\n };\nexport interface IndexedDBOptions<S extends IndexedDBStores> {\n readonly database: string;\n readonly version: number;\n readonly name?: string;\n readonly factory?: () => IDBFactory;\n /** Synchronous: queue migration requests before returning; never await. */\n readonly upgrade?: (\n db: IDBDatabase,\n oldVersion: number,\n newVersion: number,\n transaction: IDBTransaction,\n ) => void;\n readonly encode?: <K extends keyof S & string>(store: K, value: IndexedDBRecord<S[K]>) => unknown;\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Driver } from './command.js';
|
|
2
|
+
import type { IndexedDBError, IndexedDBInput, IndexedDBOptions, IndexedDBOutput, IndexedDBStores } from './indexeddb-types.js';
|
|
3
|
+
export type { IndexedDBError, IndexedDBInput, IndexedDBOperation, IndexedDBOptions, IndexedDBOutput, IndexedDBRange, IndexedDBRecord, IndexedDBResult, IndexedDBStores, } from './indexeddb-types.js';
|
|
4
|
+
/** Typed record operations and atomic batches over application-owned stores and migrations. */
|
|
5
|
+
export declare function makeIndexedDBDriver<S extends IndexedDBStores>(stores: S, options: IndexedDBOptions<S>): Driver<IndexedDBInput<S>, IndexedDBOutput<S>, IndexedDBError>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { DatabaseFailure, databaseError, openDatabase } from './internal/indexeddb-open.js';
|
|
2
|
+
import { transact } from './internal/indexeddb-transaction.js';
|
|
3
|
+
/** Typed record operations and atomic batches over application-owned stores and migrations. */
|
|
4
|
+
export function makeIndexedDBDriver(stores, options) {
|
|
5
|
+
const decode = async (store, value) => {
|
|
6
|
+
const schema = stores[store];
|
|
7
|
+
if (schema === undefined)
|
|
8
|
+
throw new DatabaseFailure({
|
|
9
|
+
_tag: 'IndexedDBInputError',
|
|
10
|
+
message: `Unknown store ${store}.`,
|
|
11
|
+
});
|
|
12
|
+
try {
|
|
13
|
+
const result = await schema['~standard'].validate(value);
|
|
14
|
+
if (result.issues !== undefined)
|
|
15
|
+
throw new DatabaseFailure({
|
|
16
|
+
_tag: 'IndexedDBDecodeError',
|
|
17
|
+
store,
|
|
18
|
+
issues: result.issues,
|
|
19
|
+
committed: true,
|
|
20
|
+
});
|
|
21
|
+
return result.value;
|
|
22
|
+
}
|
|
23
|
+
catch (cause) {
|
|
24
|
+
if (cause instanceof DatabaseFailure)
|
|
25
|
+
throw cause;
|
|
26
|
+
throw new DatabaseFailure({
|
|
27
|
+
_tag: 'IndexedDBDecodeError',
|
|
28
|
+
store,
|
|
29
|
+
committed: true,
|
|
30
|
+
issues: [{ message: cause instanceof Error ? cause.message : String(cause) }],
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const decodeResult = async (result) => {
|
|
35
|
+
let decoded = result;
|
|
36
|
+
if (result._tag === 'Record' && result.entry.found)
|
|
37
|
+
decoded = {
|
|
38
|
+
...result,
|
|
39
|
+
entry: { found: true, value: await decode(result.store, result.entry.value) },
|
|
40
|
+
};
|
|
41
|
+
else if (result._tag === 'Records')
|
|
42
|
+
decoded = {
|
|
43
|
+
...result,
|
|
44
|
+
records: await Promise.all(result.records.map(async (r) => ({
|
|
45
|
+
key: r.key,
|
|
46
|
+
value: await decode(result.store, r.value),
|
|
47
|
+
}))),
|
|
48
|
+
};
|
|
49
|
+
// The store name originates in the typed input, and each value passed that store's schema.
|
|
50
|
+
return decoded;
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
name: options.name ?? 'indexeddb',
|
|
54
|
+
concurrency: 'merge',
|
|
55
|
+
toError: (cause) => cause instanceof DatabaseFailure
|
|
56
|
+
? cause.error
|
|
57
|
+
: databaseError(options.database, 'open', cause).error,
|
|
58
|
+
run: async (input, ctx) => {
|
|
59
|
+
ctx.signal.throwIfAborted();
|
|
60
|
+
let phase = 'encode';
|
|
61
|
+
try {
|
|
62
|
+
const operations = input._tag === 'Transaction' ? input.operations : [input];
|
|
63
|
+
if (operations.length === 0)
|
|
64
|
+
throw new DatabaseFailure({
|
|
65
|
+
_tag: 'IndexedDBInputError',
|
|
66
|
+
message: 'Transactions require at least one operation.',
|
|
67
|
+
});
|
|
68
|
+
for (const op of operations) {
|
|
69
|
+
if (stores[op.store] === undefined)
|
|
70
|
+
throw new DatabaseFailure({
|
|
71
|
+
_tag: 'IndexedDBInputError',
|
|
72
|
+
message: `Unknown store ${op.store}.`,
|
|
73
|
+
});
|
|
74
|
+
if (op._tag === 'Query' &&
|
|
75
|
+
(!Number.isInteger(op.limit) || op.limit < 1 || op.limit > 0xffffffff))
|
|
76
|
+
throw new DatabaseFailure({
|
|
77
|
+
_tag: 'IndexedDBInputError',
|
|
78
|
+
message: 'Query limit must be an integer from 1 to 2^32 - 1.',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const encoded = operations.map((op) => {
|
|
82
|
+
if (op._tag !== 'Put' || options.encode === undefined)
|
|
83
|
+
return op;
|
|
84
|
+
return {
|
|
85
|
+
_tag: 'Put',
|
|
86
|
+
store: op.store,
|
|
87
|
+
value: options.encode(op.store, op.value),
|
|
88
|
+
...(op.key === undefined ? {} : { key: op.key }),
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
phase = 'open';
|
|
92
|
+
const db = await openDatabase(options, ctx.signal);
|
|
93
|
+
phase = 'transaction';
|
|
94
|
+
let raw;
|
|
95
|
+
try {
|
|
96
|
+
raw = await transact(db, encoded, ctx.signal);
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
db.close();
|
|
100
|
+
}
|
|
101
|
+
const results = await Promise.all(raw.map(decodeResult));
|
|
102
|
+
ctx.signal.throwIfAborted();
|
|
103
|
+
if (input._tag === 'Transaction')
|
|
104
|
+
return { _tag: 'Committed', results };
|
|
105
|
+
const result = results[0];
|
|
106
|
+
if (result === undefined)
|
|
107
|
+
throw new Error('Missing transaction result.');
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
catch (cause) {
|
|
111
|
+
if (ctx.signal.aborted || cause instanceof DatabaseFailure)
|
|
112
|
+
throw cause;
|
|
113
|
+
throw databaseError(options.database, phase, cause);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=indexeddb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexeddb.js","sourceRoot":"","sources":["../src/indexeddb.ts"],"names":[],"mappings":"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","sourcesContent":["// Optional native IndexedDB commands; native resources only exist while commands run (ADR 0028).\nimport type { Driver } from './command.js';\nimport type {\n IndexedDBError,\n IndexedDBInput,\n IndexedDBOptions,\n IndexedDBOperation,\n IndexedDBOutput,\n IndexedDBResult,\n IndexedDBStores,\n} from './indexeddb-types.js';\nimport { DatabaseFailure, databaseError, openDatabase } from './internal/indexeddb-open.js';\nimport { transact, type RawResult } from './internal/indexeddb-transaction.js';\nexport type {\n IndexedDBError,\n IndexedDBInput,\n IndexedDBOperation,\n IndexedDBOptions,\n IndexedDBOutput,\n IndexedDBRange,\n IndexedDBRecord,\n IndexedDBResult,\n IndexedDBStores,\n} from './indexeddb-types.js';\n\n/** Typed record operations and atomic batches over application-owned stores and migrations. */\nexport function makeIndexedDBDriver<S extends IndexedDBStores>(\n stores: S,\n options: IndexedDBOptions<S>,\n): Driver<IndexedDBInput<S>, IndexedDBOutput<S>, IndexedDBError> {\n const decode = async (store: string, value: unknown): Promise<unknown> => {\n const schema = stores[store];\n if (schema === undefined)\n throw new DatabaseFailure({\n _tag: 'IndexedDBInputError',\n message: `Unknown store ${store}.`,\n });\n try {\n const result = await schema['~standard'].validate(value);\n if (result.issues !== undefined)\n throw new DatabaseFailure({\n _tag: 'IndexedDBDecodeError',\n store,\n issues: result.issues,\n committed: true,\n });\n return result.value;\n } catch (cause) {\n if (cause instanceof DatabaseFailure) throw cause;\n throw new DatabaseFailure({\n _tag: 'IndexedDBDecodeError',\n store,\n committed: true,\n issues: [{ message: cause instanceof Error ? cause.message : String(cause) }],\n });\n }\n };\n const decodeResult = async (result: RawResult): Promise<IndexedDBResult<S>> => {\n let decoded: RawResult = result;\n if (result._tag === 'Record' && result.entry.found)\n decoded = {\n ...result,\n entry: { found: true, value: await decode(result.store, result.entry.value) },\n };\n else if (result._tag === 'Records')\n decoded = {\n ...result,\n records: await Promise.all(\n result.records.map(async (r) => ({\n key: r.key,\n value: await decode(result.store, r.value),\n })),\n ),\n };\n // The store name originates in the typed input, and each value passed that store's schema.\n return decoded;\n };\n return {\n name: options.name ?? 'indexeddb',\n concurrency: 'merge',\n toError: (cause) =>\n cause instanceof DatabaseFailure\n ? cause.error\n : databaseError(options.database, 'open', cause).error,\n run: async (input, ctx) => {\n ctx.signal.throwIfAborted();\n let phase: 'encode' | 'open' | 'transaction' = 'encode';\n try {\n const operations = input._tag === 'Transaction' ? input.operations : [input];\n if (operations.length === 0)\n throw new DatabaseFailure({\n _tag: 'IndexedDBInputError',\n message: 'Transactions require at least one operation.',\n });\n for (const op of operations) {\n if (stores[op.store] === undefined)\n throw new DatabaseFailure({\n _tag: 'IndexedDBInputError',\n message: `Unknown store ${op.store}.`,\n });\n if (\n op._tag === 'Query' &&\n (!Number.isInteger(op.limit) || op.limit < 1 || op.limit > 0xffffffff)\n )\n throw new DatabaseFailure({\n _tag: 'IndexedDBInputError',\n message: 'Query limit must be an integer from 1 to 2^32 - 1.',\n });\n }\n const encoded = operations.map((op): IndexedDBOperation<IndexedDBStores> => {\n if (op._tag !== 'Put' || options.encode === undefined) return op;\n return {\n _tag: 'Put',\n store: op.store,\n value: options.encode(op.store, op.value),\n ...(op.key === undefined ? {} : { key: op.key }),\n };\n });\n phase = 'open';\n const db = await openDatabase(options, ctx.signal);\n phase = 'transaction';\n let raw: readonly RawResult[];\n try {\n raw = await transact(db, encoded, ctx.signal);\n } finally {\n db.close();\n }\n const results = await Promise.all(raw.map(decodeResult));\n ctx.signal.throwIfAborted();\n if (input._tag === 'Transaction') return { _tag: 'Committed', results };\n const result = results[0];\n if (result === undefined) throw new Error('Missing transaction result.');\n return result;\n } catch (cause) {\n if (ctx.signal.aborted || cause instanceof DatabaseFailure) throw cause;\n throw databaseError(options.database, phase, cause);\n }\n },\n };\n}\n"]}
|
package/dist/intent.d.ts
CHANGED
|
@@ -1,25 +1,70 @@
|
|
|
1
|
-
import type { IntentInput, IntentParser, Tagged } from './types.js';
|
|
2
|
-
|
|
1
|
+
import type { IntentInput, IntentNames, IntentParser, ParserCtx, Tagged } from './types.js';
|
|
2
|
+
import { type Markup } from './view/index.js';
|
|
3
|
+
/** Event a child component dispatches on its host to send an output up (ADR 0010); public. */
|
|
3
4
|
export declare const OUTPUT_EVENT = "gyral-output";
|
|
5
|
+
/** Default triggers (`defaultTrigger`): every component root listens for these. */
|
|
6
|
+
export declare const DEFAULT_EVENTS: readonly string[];
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
6
|
-
* non-bubbling events such as `toggle` are seen too)
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* The events `data-intent-on` usually names. A component root listens (capture phase, so
|
|
9
|
+
* non-bubbling events such as `toggle` are seen too) for the defaults and for the events its
|
|
10
|
+
* templates name in `data-intent-<event>` attributes and static `data-intent-on` values; a
|
|
11
|
+
* template that binds `data-intent-on` dynamically adds all of these. Any other event with a
|
|
12
|
+
* bound intent takes a per-event attribute, `data-intent-pointerdown=${i.Press}`, whose name the
|
|
13
|
+
* template carries (view/05-element.md "Intent events").
|
|
14
|
+
*/
|
|
15
|
+
export declare const INTENT_EVENTS: readonly string[];
|
|
16
|
+
/**
|
|
17
|
+
* The intent events a template's (or `raw()` markup's) `data-intent-<event>` and
|
|
18
|
+
* `data-intent-on` attributes name. A bound attribute's name is in its part; a bound
|
|
19
|
+
* `data-intent-on` adds every intent event.
|
|
20
|
+
*/
|
|
21
|
+
export declare function eventsOf(markup: Markup): readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* The event that fires an intent unless `data-intent-on` overrides it. Custom elements
|
|
24
|
+
* (autonomous: the name has a dash) talk to their parent via outputs.
|
|
9
25
|
*/
|
|
10
|
-
export declare const INTENT_EVENTS: readonly ["click", "submit", "input", "change", "keydown", "keyup", "focusin", "focusout", "toggle", "command", "gyral-output"];
|
|
11
|
-
/** The event that fires an intent unless `data-intent-on` overrides it. */
|
|
12
26
|
export declare function defaultTrigger(el: Element): string;
|
|
13
27
|
export declare function markGyralHost(ctor: object): void;
|
|
14
28
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
29
|
+
* The number of Gyral host ancestors of `el` in the composed tree (across shadow roots): the
|
|
30
|
+
* scheduler renders smaller depths first (view/04-scheduler.md "Marking").
|
|
31
|
+
*/
|
|
32
|
+
export declare function hostDepth(el: Element): number;
|
|
33
|
+
/**
|
|
34
|
+
* Reads an event into an IntentInput for the nearest element on its path that names an intent
|
|
35
|
+
* for it and belongs to `root`: its `data-intent-<type>`, else its `data-intent` when the
|
|
36
|
+
* event is one of its triggers. With `after`, the search starts past that element (the intent
|
|
37
|
+
* whose parser declined). Elements inside nested components are ignored: that is component
|
|
38
|
+
* isolation. Form submissions are prevented and turned into FormData.
|
|
17
39
|
*/
|
|
18
|
-
export declare function
|
|
19
|
-
/** Reads an event into an IntentInput. Form submissions are prevented and turned into FormData. */
|
|
20
|
-
export declare function readIntent(event: Event, root: Node): IntentInput | undefined;
|
|
40
|
+
export declare function readIntent(event: Event, root: Node, after?: Element): IntentInput | undefined;
|
|
21
41
|
export declare const intentNames: unknown;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
/**
|
|
43
|
+
* A component's intent names as a module-level constant, so pure list rows can name intents
|
|
44
|
+
* without passing them through `pick` (view/03-lists.md "Rows must be pure"). The same object
|
|
45
|
+
* the view gets as `i`, typed by the component's class (ADR 0023). A row that names intents
|
|
46
|
+
* this way needs an explicit return type, or the row, the view and the class infer each other
|
|
47
|
+
* in a circle:
|
|
48
|
+
*
|
|
49
|
+
* const i = intentsOf<typeof TodoList>();
|
|
50
|
+
* const Row = (t: Todo): TemplateResult => html`<input value=${t.id} data-intent=${i.Toggle} />`;
|
|
51
|
+
*/
|
|
52
|
+
export declare function intentsOf<C extends {
|
|
53
|
+
readonly intentNames?: string;
|
|
54
|
+
}>(): IntentNames<NonNullable<C['intentNames']>>;
|
|
55
|
+
/**
|
|
56
|
+
* Adds capture listeners for `types` to a component root, skipping those in `listening`. A
|
|
57
|
+
* root that listens for `command` in a browser without invoker commands loads the fallback
|
|
58
|
+
* (invokers-shim.ts, ADR 0003 tier 3); settled() waits for it.
|
|
59
|
+
*/
|
|
60
|
+
export declare function listenForIntents(root: Node, listening: Set<string>, types: readonly string[], handler: (event: Event) => void): void;
|
|
61
|
+
/**
|
|
62
|
+
* Parses one event with its matching parser and delivers the message (sync or async). A
|
|
63
|
+
* parser that returns `undefined` synchronously declines: the next intent outward for the same
|
|
64
|
+
* event gets it, up to the component root. A promise can't decline. The model's `ctx()` is
|
|
65
|
+
* built only when a parser runs, so its props are those at event time.
|
|
66
|
+
*/
|
|
67
|
+
export declare function handleIntent<M>(event: Event, root: Node, parsers: Readonly<Record<string, IntentParser<M> | true | undefined>>, tag: string, model: {
|
|
68
|
+
ctx(): ParserCtx<unknown>;
|
|
69
|
+
fail(cause: unknown, phase: 'parse', text: string, msg?: string): unknown;
|
|
70
|
+
}, deliver: (msg: Tagged | undefined) => void): void;
|