@lushly-dev/fast-element 3.0.1-preview.0 → 3.0.1-preview.2
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 +12 -0
- package/dist/command/command.api.json +7857 -0
- package/dist/context/context.api.json +1084 -0
- package/dist/declarative/declarative.api.json +8130 -0
- package/dist/definition-schema/definition-schema.api.json +2689 -0
- package/dist/di/di.api.json +4945 -0
- package/dist/dts/arrays.d.ts +2 -0
- package/dist/dts/binding/binding.d.ts +59 -0
- package/dist/dts/binding/exports.d.ts +9 -0
- package/dist/dts/binding/normalize.d.ts +9 -0
- package/dist/dts/binding/one-time.d.ts +11 -0
- package/dist/dts/binding/one-way.d.ts +20 -0
- package/dist/dts/binding/signal.d.ts +36 -0
- package/dist/dts/binding/two-way.d.ts +44 -0
- package/dist/dts/command/behavior.d.ts +94 -0
- package/dist/dts/command/behaviors/confirm-behavior.d.ts +139 -0
- package/dist/dts/command/behaviors/undo-behavior.d.ts +178 -0
- package/dist/dts/command/command.d.ts +79 -0
- package/dist/dts/command/component-registry.d.ts +50 -0
- package/dist/dts/command/components/confirm-dialog.d.ts +117 -0
- package/dist/dts/command/index.d.ts +21 -0
- package/dist/dts/command/registry.d.ts +201 -0
- package/dist/dts/command/schema-validation.d.ts +45 -0
- package/dist/dts/command/types.d.ts +332 -0
- package/dist/dts/command/validation.d.ts +116 -0
- package/dist/dts/command/weak-ref.d.ts +11 -0
- package/dist/dts/components/attributes.d.ts +153 -0
- package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
- package/dist/dts/components/element-controller.d.ts +349 -0
- package/dist/dts/components/element-hydration.d.ts +2 -0
- package/dist/dts/components/enable-hydration.d.ts +66 -0
- package/dist/dts/components/fast-definitions.d.ts +211 -0
- package/dist/dts/components/fast-element-registry.d.ts +23 -0
- package/dist/dts/components/fast-element.d.ts +91 -0
- package/dist/dts/components/hydration-tracker.d.ts +110 -0
- package/dist/dts/components/hydration.d.ts +52 -0
- package/dist/dts/components/schema.d.ts +205 -0
- package/dist/dts/context.d.ts +171 -0
- package/dist/dts/debug.d.ts +5 -0
- package/dist/dts/declarative/attribute-map.d.ts +58 -0
- package/dist/dts/declarative/debug.d.ts +4 -0
- package/dist/dts/declarative/index.d.ts +14 -0
- package/dist/dts/declarative/interfaces.d.ts +8 -0
- package/dist/dts/declarative/observer-map-utilities.d.ts +58 -0
- package/dist/dts/declarative/observer-map.d.ts +89 -0
- package/dist/dts/declarative/runtime.d.ts +5 -0
- package/dist/dts/declarative/syntax.d.ts +21 -0
- package/dist/dts/declarative/template-bridge.d.ts +33 -0
- package/dist/dts/declarative/template-parser.d.ts +98 -0
- package/dist/dts/declarative/template.d.ts +9 -0
- package/dist/dts/declarative/utilities.d.ts +358 -0
- package/dist/dts/definition-schema/api.d.ts +42 -0
- package/dist/dts/definition-schema/cem.d.ts +78 -0
- package/dist/dts/definition-schema/extension.d.ts +18 -0
- package/dist/dts/definition-schema/extract.d.ts +38 -0
- package/dist/dts/definition-schema/index.d.ts +9 -0
- package/dist/dts/definition-schema/storage.d.ts +35 -0
- package/dist/dts/definition-schema/types.d.ts +176 -0
- package/dist/dts/dev-mode.d.ts +13 -0
- package/dist/dts/di/di.d.ts +894 -0
- package/dist/dts/dom-policy.d.ts +101 -0
- package/dist/dts/dom.d.ts +88 -0
- package/dist/dts/hydration/diagnostics.d.ts +93 -0
- package/dist/dts/hydration/exports.d.ts +18 -0
- package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
- package/dist/dts/hydration/messages.d.ts +62 -0
- package/dist/dts/hydration/runtime.d.ts +7 -0
- package/dist/dts/hydration/target-builder.d.ts +107 -0
- package/dist/dts/index.d.ts +51 -0
- package/dist/dts/index.debug.d.ts +1 -0
- package/dist/dts/index.rollup.d.ts +1 -0
- package/dist/dts/index.rollup.debug.d.ts +1 -0
- package/dist/dts/interfaces.d.ts +106 -0
- package/dist/dts/metadata.d.ts +26 -0
- package/dist/dts/observation/arrays.d.ts +248 -0
- package/dist/dts/observation/notifier.d.ts +127 -0
- package/dist/dts/observation/observable.d.ts +276 -0
- package/dist/dts/observation/update-queue.d.ts +40 -0
- package/dist/dts/observation/volatile.d.ts +9 -0
- package/dist/dts/platform.d.ts +87 -0
- package/dist/dts/registry.d.ts +2 -0
- package/dist/dts/render.d.ts +7 -0
- package/dist/dts/schema.d.ts +1 -0
- package/dist/dts/scoped/detection.d.ts +55 -0
- package/dist/dts/scoped/index.d.ts +68 -0
- package/dist/dts/scoped/mixin.d.ts +118 -0
- package/dist/dts/scoped/registry.d.ts +76 -0
- package/dist/dts/scoped/types.d.ts +48 -0
- package/dist/dts/state/exports.d.ts +3 -0
- package/dist/dts/state/reactive.d.ts +8 -0
- package/dist/dts/state/state.d.ts +141 -0
- package/dist/dts/state/visitor.d.ts +6 -0
- package/dist/dts/state/watch.d.ts +10 -0
- package/dist/dts/styles/css-directive.d.ts +50 -0
- package/dist/dts/styles/css.d.ts +34 -0
- package/dist/dts/styles/element-styles.d.ts +61 -0
- package/dist/dts/styles/host.d.ts +65 -0
- package/dist/dts/styles/style-strategy.d.ts +42 -0
- package/dist/dts/templating/children.d.ts +62 -0
- package/dist/dts/templating/compiler.d.ts +54 -0
- package/dist/dts/templating/html-binding-directive.d.ts +155 -0
- package/dist/dts/templating/html-directive.d.ts +218 -0
- package/dist/dts/templating/html.d.ts +1 -0
- package/dist/dts/templating/hydration-view.d.ts +130 -0
- package/dist/dts/templating/markup.d.ts +48 -0
- package/dist/dts/templating/node-observation.d.ts +99 -0
- package/dist/dts/templating/ref.d.ts +23 -0
- package/dist/dts/templating/render.d.ts +318 -0
- package/dist/dts/templating/repeat.d.ts +131 -0
- package/dist/dts/templating/slotted.d.ts +38 -0
- package/dist/dts/templating/template.d.ts +221 -0
- package/dist/dts/templating/view.d.ts +268 -0
- package/dist/dts/templating/when.d.ts +12 -0
- package/dist/dts/testing/exports.d.ts +3 -0
- package/dist/dts/testing/fakes.d.ts +16 -0
- package/dist/dts/testing/fixture.d.ts +84 -0
- package/dist/dts/testing/models.d.ts +20 -0
- package/dist/dts/testing/timeout.d.ts +7 -0
- package/dist/dts/trust/index.d.ts +8 -0
- package/dist/dts/trust/types.d.ts +48 -0
- package/dist/dts/trust/utils.d.ts +26 -0
- package/dist/dts/tsdoc-metadata.json +11 -0
- package/dist/dts/utilities.d.ts +76 -0
- package/dist/esm/arrays.js +1 -0
- package/dist/esm/binding/binding.js +18 -0
- package/dist/esm/binding/exports.js +6 -0
- package/dist/esm/binding/normalize.js +17 -0
- package/dist/esm/binding/one-time.js +21 -0
- package/dist/esm/binding/one-way.js +30 -0
- package/dist/esm/binding/signal.js +99 -0
- package/dist/esm/binding/two-way.js +109 -0
- package/dist/esm/command/behavior.js +155 -0
- package/dist/esm/command/behaviors/confirm-behavior.js +225 -0
- package/dist/esm/command/behaviors/undo-behavior.js +313 -0
- package/dist/esm/command/command.js +104 -0
- package/dist/esm/command/component-registry.js +107 -0
- package/dist/esm/command/components/confirm-dialog.js +370 -0
- package/dist/esm/command/index.js +22 -0
- package/dist/esm/command/registry.js +755 -0
- package/dist/esm/command/schema-validation.js +194 -0
- package/dist/esm/command/types.js +86 -0
- package/dist/esm/command/validation.js +508 -0
- package/dist/esm/command/weak-ref.js +5 -0
- package/dist/esm/components/attributes.js +219 -0
- package/dist/esm/components/definition-schema-transforms.js +23 -0
- package/dist/esm/components/element-controller.js +840 -0
- package/dist/esm/components/element-hydration.js +2 -0
- package/dist/esm/components/enable-hydration.js +123 -0
- package/dist/esm/components/fast-definitions.js +294 -0
- package/dist/esm/components/fast-element-registry.js +67 -0
- package/dist/esm/components/fast-element.js +82 -0
- package/dist/esm/components/hydration-tracker.js +211 -0
- package/dist/esm/components/hydration.js +187 -0
- package/dist/esm/components/schema.js +253 -0
- package/dist/esm/context.js +185 -0
- package/dist/esm/debug.js +71 -0
- package/dist/esm/declarative/attribute-map.js +122 -0
- package/dist/esm/declarative/debug.js +4 -0
- package/dist/esm/declarative/index.js +10 -0
- package/dist/esm/declarative/interfaces.js +9 -0
- package/dist/esm/declarative/observer-map-utilities.js +565 -0
- package/dist/esm/declarative/observer-map.js +216 -0
- package/dist/esm/declarative/runtime.js +14 -0
- package/dist/esm/declarative/syntax.js +36 -0
- package/dist/esm/declarative/template-bridge.js +160 -0
- package/dist/esm/declarative/template-parser.js +306 -0
- package/dist/esm/declarative/template.js +116 -0
- package/dist/esm/declarative/utilities.js +1069 -0
- package/dist/esm/definition-schema/api.js +129 -0
- package/dist/esm/definition-schema/cem.js +89 -0
- package/dist/esm/definition-schema/extension.js +53 -0
- package/dist/esm/definition-schema/extract.js +167 -0
- package/dist/esm/definition-schema/index.js +8 -0
- package/dist/esm/definition-schema/storage.js +58 -0
- package/dist/esm/definition-schema/types.js +8 -0
- package/dist/esm/dev-mode.js +22 -0
- package/dist/esm/di/di.js +1441 -0
- package/dist/esm/dom-policy.js +374 -0
- package/dist/esm/dom.js +101 -0
- package/dist/esm/hydration/diagnostics.js +50 -0
- package/dist/esm/hydration/exports.js +6 -0
- package/dist/esm/hydration/hydration-debugger.js +112 -0
- package/dist/esm/hydration/messages.js +84 -0
- package/dist/esm/hydration/runtime.js +33 -0
- package/dist/esm/hydration/target-builder.js +264 -0
- package/dist/esm/index.debug.js +3 -0
- package/dist/esm/index.js +49 -0
- package/dist/esm/index.rollup.debug.js +6 -0
- package/dist/esm/index.rollup.js +4 -0
- package/dist/esm/interfaces.js +55 -0
- package/dist/esm/metadata.js +57 -0
- package/dist/esm/observation/arrays.js +661 -0
- package/dist/esm/observation/notifier.js +162 -0
- package/dist/esm/observation/observable.js +324 -0
- package/dist/esm/observation/update-queue.js +56 -0
- package/dist/esm/observation/volatile.js +16 -0
- package/dist/esm/platform.js +98 -0
- package/dist/esm/registry.js +2 -0
- package/dist/esm/render.js +1 -0
- package/dist/esm/schema.js +1 -0
- package/dist/esm/scoped/detection.js +102 -0
- package/dist/esm/scoped/index.js +69 -0
- package/dist/esm/scoped/mixin.js +127 -0
- package/dist/esm/scoped/registry.js +125 -0
- package/dist/esm/scoped/types.js +4 -0
- package/dist/esm/state/exports.js +3 -0
- package/dist/esm/state/reactive.js +34 -0
- package/dist/esm/state/state.js +148 -0
- package/dist/esm/state/visitor.js +28 -0
- package/dist/esm/state/watch.js +36 -0
- package/dist/esm/styles/css-directive.js +36 -0
- package/dist/esm/styles/css.js +56 -0
- package/dist/esm/styles/element-styles.js +144 -0
- package/dist/esm/styles/host.js +1 -0
- package/dist/esm/styles/style-strategy.js +1 -0
- package/dist/esm/templating/children.js +67 -0
- package/dist/esm/templating/compiler.js +359 -0
- package/dist/esm/templating/html-binding-directive.js +288 -0
- package/dist/esm/templating/html-directive.js +113 -0
- package/dist/esm/templating/html.js +1 -0
- package/dist/esm/templating/hydration-view.js +228 -0
- package/dist/esm/templating/markup.js +83 -0
- package/dist/esm/templating/node-observation.js +84 -0
- package/dist/esm/templating/ref.js +21 -0
- package/dist/esm/templating/render.js +468 -0
- package/dist/esm/templating/repeat.js +434 -0
- package/dist/esm/templating/slotted.js +49 -0
- package/dist/esm/templating/template.js +206 -0
- package/dist/esm/templating/view.js +298 -0
- package/dist/esm/templating/when.js +22 -0
- package/dist/esm/testing/exports.js +3 -0
- package/dist/esm/testing/fakes.js +107 -0
- package/dist/esm/testing/fixture.js +86 -0
- package/dist/esm/testing/models.js +58 -0
- package/dist/esm/testing/timeout.js +24 -0
- package/dist/esm/trust/index.js +7 -0
- package/dist/esm/trust/types.js +6 -0
- package/dist/esm/trust/utils.js +126 -0
- package/dist/esm/utilities.js +140 -0
- package/dist/fast-element.api.json +26798 -0
- package/dist/fast-element.d.ts +3985 -0
- package/dist/fast-element.debug.js +7604 -0
- package/dist/fast-element.debug.min.js +3 -0
- package/dist/fast-element.js +7603 -0
- package/dist/fast-element.min.js +3 -0
- package/dist/fast-element.untrimmed.d.ts +4103 -0
- package/dist/observation/arrays/arrays.api.json +2621 -0
- package/dist/scoped/scoped.api.json +891 -0
- package/dist/trust/trust.api.json +629 -0
- package/package.json +21 -23
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry builder utilities for Scoped Custom Element Registries.
|
|
3
|
+
*/
|
|
4
|
+
import type { CreateRegistryOptions, ElementDefinition } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates a scoped custom element registry with the provided element definitions.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* When scoped registries are supported, creates a new CustomElementRegistry
|
|
10
|
+
* and defines all provided elements in it. When not supported, falls back to
|
|
11
|
+
* registering elements on the global `customElements` registry (with a dev warning).
|
|
12
|
+
*
|
|
13
|
+
* In strict mode, throws an error if scoped registries are not supported
|
|
14
|
+
* instead of falling back to the global registry.
|
|
15
|
+
*
|
|
16
|
+
* @param definitions - Array of [Constructor, tagName] tuples to register
|
|
17
|
+
* @param options - Configuration options
|
|
18
|
+
* @returns The created registry, or undefined if fallback to global occurred
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Basic usage
|
|
23
|
+
* const registry = createRegistry([
|
|
24
|
+
* [MyButton, 'my-button'],
|
|
25
|
+
* [MyInput, 'my-input'],
|
|
26
|
+
* ]);
|
|
27
|
+
*
|
|
28
|
+
* if (registry) {
|
|
29
|
+
* element.attachShadow({ mode: 'open', customElementRegistry: registry });
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* // Strict mode - throws if not supported
|
|
36
|
+
* const registry = createRegistry(
|
|
37
|
+
* [[MyButton, 'my-button']],
|
|
38
|
+
* { strict: true }
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare function createRegistry(definitions: ElementDefinition[], options?: CreateRegistryOptions): CustomElementRegistry | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a scoped custom element registry with automatic polyfill loading.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* This async version first ensures scoped registry support is available
|
|
50
|
+
* (loading the polyfill if necessary), then creates the registry.
|
|
51
|
+
*
|
|
52
|
+
* Unlike `createRegistry()`, this function always operates in strict mode
|
|
53
|
+
* after polyfill loading, as the polyfill should provide support. If the
|
|
54
|
+
* polyfill fails to load, the underlying `ensureScopedRegistrySupport()`
|
|
55
|
+
* will throw.
|
|
56
|
+
*
|
|
57
|
+
* @param definitions - Array of [Constructor, tagName] tuples to register
|
|
58
|
+
* @param options - Configuration options (strict is always true after polyfill)
|
|
59
|
+
* @returns Promise resolving to the created registry
|
|
60
|
+
*
|
|
61
|
+
* @throws Error if polyfill loading fails
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* // Automatically loads polyfill if needed
|
|
66
|
+
* const registry = await createRegistryAsync([
|
|
67
|
+
* [MyButton, 'my-button'],
|
|
68
|
+
* [MyInput, 'my-input'],
|
|
69
|
+
* ]);
|
|
70
|
+
*
|
|
71
|
+
* element.attachShadow({ mode: 'open', customElementRegistry: registry });
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
export declare function createRegistryAsync(definitions: ElementDefinition[], options?: CreateRegistryOptions): Promise<CustomElementRegistry>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Scoped Custom Element Registries.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Extended ShadowRootInit with registry support.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Extends the standard ShadowRootInit to support scoped custom element registries.
|
|
9
|
+
* The `customElementRegistry` property is the native spec key (Safari 26+, Chrome 133+ OT).
|
|
10
|
+
* The `registry` property is deprecated and will be removed in a future version.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export interface ScopedShadowRootInit extends ShadowRootInit {
|
|
15
|
+
/** @deprecated Use customElementRegistry instead */
|
|
16
|
+
registry?: CustomElementRegistry;
|
|
17
|
+
/** Native spec key - preferred (Safari 26+, Chrome 133+ Origin Trial) */
|
|
18
|
+
customElementRegistry?: CustomElementRegistry;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Element definition tuple: [Constructor, tag-name]
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Used with createRegistry() to define elements in a scoped registry.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const definitions: ElementDefinition[] = [
|
|
29
|
+
* [MyButton, 'my-button'],
|
|
30
|
+
* [MyInput, 'my-input'],
|
|
31
|
+
* ];
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export type ElementDefinition = [CustomElementConstructor, string];
|
|
37
|
+
/**
|
|
38
|
+
* Options for createRegistry helper.
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export interface CreateRegistryOptions {
|
|
43
|
+
/**
|
|
44
|
+
* If true, throw when unsupported instead of falling back to global registry.
|
|
45
|
+
* Default: false (uses global registry fallback)
|
|
46
|
+
*/
|
|
47
|
+
strict?: boolean;
|
|
48
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { reactive } from "./reactive.js";
|
|
2
|
+
export { type ComputedBuilder, type ComputedInitializer, type ComputedSetupCallback, type ComputedState, computedState, type OwnedState, ownedState, type ReadonlyOwnedState, type ReadonlyState, type State, type StateOptions, state, } from "./state.js";
|
|
3
|
+
export { watch } from "./watch.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a plain object to a reactive, observable object.
|
|
3
|
+
* @param object - The object to make reactive.
|
|
4
|
+
* @param deep - Indicates whether or not to deeply convert the oject.
|
|
5
|
+
* @returns The converted object.
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export declare function reactive<T>(object: T, deep?: boolean): T;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { type Disposable } from "../interfaces.js";
|
|
2
|
+
import type { Subscriber } from "../observation/notifier.js";
|
|
3
|
+
/**
|
|
4
|
+
* Options for creating state.
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export type StateOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Indicates whether to deeply make the state value observable.
|
|
10
|
+
*/
|
|
11
|
+
deep?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* A friendly name for the state.
|
|
14
|
+
*/
|
|
15
|
+
name?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A readonly stateful value.
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
export type ReadonlyState<T> = {
|
|
22
|
+
/**
|
|
23
|
+
* Gets the current state value.
|
|
24
|
+
*/
|
|
25
|
+
(): T;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the current state value.
|
|
28
|
+
*/
|
|
29
|
+
readonly current: T;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A read/write stateful value.
|
|
33
|
+
* @beta
|
|
34
|
+
*/
|
|
35
|
+
export type State<T> = ReadonlyState<T> & {
|
|
36
|
+
/**
|
|
37
|
+
* Gets or sets the current state value.
|
|
38
|
+
*/
|
|
39
|
+
current: T;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the current state value.
|
|
42
|
+
* @param value - The new state value.
|
|
43
|
+
*/
|
|
44
|
+
set(value: T): void;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a readonly version of the state.
|
|
47
|
+
*/
|
|
48
|
+
asReadonly(): ReadonlyState<T>;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Creates a reactive state value.
|
|
52
|
+
* @param value - The initial state value.
|
|
53
|
+
* @param options - Options to customize the state or a friendly name.
|
|
54
|
+
* @returns A State instance.
|
|
55
|
+
* @beta
|
|
56
|
+
*/
|
|
57
|
+
export declare function state<T>(value: T, options?: string | StateOptions): State<T>;
|
|
58
|
+
/**
|
|
59
|
+
* A readonly stateful value associated with an object owner.
|
|
60
|
+
* @beta
|
|
61
|
+
*/
|
|
62
|
+
export type ReadonlyOwnedState<T> = {
|
|
63
|
+
/**
|
|
64
|
+
* Gets the current stateful value for the owner.
|
|
65
|
+
*/
|
|
66
|
+
(owner: any): T;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* A read/write stateful value associated with an owner.
|
|
70
|
+
* @beta
|
|
71
|
+
*/
|
|
72
|
+
export type OwnedState<T> = ReadonlyOwnedState<T> & {
|
|
73
|
+
/**
|
|
74
|
+
* Sets
|
|
75
|
+
* @param owner - The object to set the state for the owner.
|
|
76
|
+
* @param value - The new state value.
|
|
77
|
+
*/
|
|
78
|
+
set(owner: any, value: T): void;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a readonly version of the state.
|
|
81
|
+
*/
|
|
82
|
+
asReadonly(): ReadonlyOwnedState<T>;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Creates a reactive state that has its value associated with a specific owner.
|
|
86
|
+
* @param value - The initial value or a factory that provides an initial value for each owner.
|
|
87
|
+
* @param options - Options to customize the state or a friendly name.
|
|
88
|
+
* @returns An OwnedState instance.
|
|
89
|
+
* @beta
|
|
90
|
+
*/
|
|
91
|
+
export declare function ownedState<T>(value: T | (() => T), options?: string | StateOptions): OwnedState<T>;
|
|
92
|
+
/**
|
|
93
|
+
* State whose value is computed from other dependencies.
|
|
94
|
+
* @beta
|
|
95
|
+
*/
|
|
96
|
+
export type ComputedState<T> = ReadonlyState<T> & Disposable & {
|
|
97
|
+
/**
|
|
98
|
+
* Subscribes to notification of changes in the state.
|
|
99
|
+
* @param subscriber - The object that is subscribing for change notification.
|
|
100
|
+
*/
|
|
101
|
+
subscribe(subscriber: Subscriber): void;
|
|
102
|
+
/**
|
|
103
|
+
* Unsubscribes from notification of changes in the state.
|
|
104
|
+
* @param subscriber - The object that is unsubscribing from change notification.
|
|
105
|
+
*/
|
|
106
|
+
unsubscribe(subscriber: Subscriber): void;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* A callback that enables computation setup.
|
|
110
|
+
* @beta
|
|
111
|
+
*/
|
|
112
|
+
export type ComputedSetupCallback = () => (() => void) | void;
|
|
113
|
+
/**
|
|
114
|
+
* Provides computed state capabilities.
|
|
115
|
+
* @beta
|
|
116
|
+
*/
|
|
117
|
+
export type ComputedBuilder = {
|
|
118
|
+
/**
|
|
119
|
+
* Callbacks related to computed state.
|
|
120
|
+
*/
|
|
121
|
+
on: {
|
|
122
|
+
/**
|
|
123
|
+
* Provides a setup callback for the computation.
|
|
124
|
+
* @param callback - The callback to run to setup the computation.
|
|
125
|
+
*/
|
|
126
|
+
setup(callback: ComputedSetupCallback): void;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* A callback that initializes the computation.
|
|
131
|
+
* @beta
|
|
132
|
+
*/
|
|
133
|
+
export type ComputedInitializer<T> = (builder: ComputedBuilder) => () => T;
|
|
134
|
+
/**
|
|
135
|
+
* Creates a ComputedState.
|
|
136
|
+
* @param initialize - The initialization callback.
|
|
137
|
+
* @param name - A friendly name for this computation.
|
|
138
|
+
* @returns A ComputedState
|
|
139
|
+
* @beta
|
|
140
|
+
*/
|
|
141
|
+
export declare function computedState<T>(initialize: ComputedInitializer<T>, name?: string): ComputedState<T>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface ObjectVisitor<TVisitorData> {
|
|
2
|
+
visitObject(object: any, data: TVisitorData): void;
|
|
3
|
+
visitArray(array: any[], data: TVisitorData): void;
|
|
4
|
+
visitProperty(object: any, key: PropertyKey, value: any, data: TVisitorData): void;
|
|
5
|
+
}
|
|
6
|
+
export declare function visitObject<TVisitorData>(object: any, deep: boolean, visitor: ObjectVisitor<TVisitorData>, data: TVisitorData, traversed: WeakSet<any> | Set<any>): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Disposable } from "../interfaces.js";
|
|
2
|
+
import type { Subscriber } from "../observation/notifier.js";
|
|
3
|
+
/**
|
|
4
|
+
* Deeply subscribes to changes in existing observable objects.
|
|
5
|
+
* @param object - The observable object to watch.
|
|
6
|
+
* @param subscriber - The handler to call when changes are made to the object.
|
|
7
|
+
* @returns A disposable that can be used to unsubscribe from change updates.
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export declare function watch(object: any, subscriber: Subscriber | ((subject: any, args: any) => void)): Disposable;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Constructable } from "../interfaces.js";
|
|
2
|
+
import type { ComposableStyles } from "./element-styles.js";
|
|
3
|
+
/**
|
|
4
|
+
* Directive for use in CSS templates.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface CSSDirective {
|
|
9
|
+
/**
|
|
10
|
+
* Creates static styles to interpolate into the CSS document.
|
|
11
|
+
* @returns - the styles to interpolate into CSS
|
|
12
|
+
*/
|
|
13
|
+
createCSS(): ComposableStyles;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Defines metadata for a CSSDirective.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export interface CSSDirectiveDefinition<TType extends Constructable<CSSDirective> = Constructable<CSSDirective>> {
|
|
20
|
+
/**
|
|
21
|
+
* The type that the definition provides metadata for.
|
|
22
|
+
*/
|
|
23
|
+
readonly type: TType;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Instructs the css engine to provide styles during CSS template composition.
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare const CSSDirective: Readonly<{
|
|
30
|
+
/**
|
|
31
|
+
* Gets the directive definition associated with the instance.
|
|
32
|
+
* @param instance - The directive instance to retrieve the definition for.
|
|
33
|
+
*/
|
|
34
|
+
getForInstance: (object: any) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the directive definition associated with the specified type.
|
|
37
|
+
* @param type - The directive type to retrieve the definition for.
|
|
38
|
+
*/
|
|
39
|
+
getByType: (key: Function) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Defines a CSSDirective.
|
|
42
|
+
* @param type - The type to define as a directive.
|
|
43
|
+
*/
|
|
44
|
+
define<TType extends Constructable<CSSDirective>>(type: any): TType;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Decorator: Defines a CSSDirective.
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export declare function cssDirective(): (type: Constructable<CSSDirective>) => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CSSDirective } from "./css-directive.js";
|
|
2
|
+
import { type ComposableStyles, ElementStyles } from "./element-styles.js";
|
|
3
|
+
/**
|
|
4
|
+
* Represents the types of values that can be interpolated into a template.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type CSSValue = ComposableStyles | CSSDirective;
|
|
8
|
+
/**
|
|
9
|
+
* Transforms a template literal string into styles.
|
|
10
|
+
* @param strings - The string fragments that are interpolated with the values.
|
|
11
|
+
* @param values - The values that are interpolated with the string fragments.
|
|
12
|
+
* @remarks
|
|
13
|
+
* The css helper supports interpolation of static composable styles and CSS directives.
|
|
14
|
+
* Use the .partial method to create partial CSS fragments.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: CSSValue[]) => ElementStyles) & {
|
|
18
|
+
/**
|
|
19
|
+
* Transforms a template literal string into partial CSS.
|
|
20
|
+
* @param strings - The string fragments that are interpolated with the values.
|
|
21
|
+
* @param values - The values that are interpolated with the string fragments.
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
partial(strings: TemplateStringsArray, ...values: CSSValue[]): CSSDirective;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Transforms a template literal string into styles.
|
|
28
|
+
* @param strings - The string fragments that are interpolated with the values.
|
|
29
|
+
* @param values - The values that are interpolated with the string fragments.
|
|
30
|
+
* @remarks
|
|
31
|
+
* The css helper supports interpolation of static composable styles and CSS directives.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare const css: CSSTemplateTag;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { StyleStrategy, StyleTarget } from "./style-strategy.js";
|
|
2
|
+
/**
|
|
3
|
+
* Represents styles that can be composed into the ShadowDOM of a custom element.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type ComposableStyles = string | ElementStyles | CSSStyleSheet;
|
|
7
|
+
/**
|
|
8
|
+
* A type that instantiates a StyleStrategy.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export type ConstructibleStyleStrategy = {
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of the strategy.
|
|
14
|
+
* @param styles - The styles to initialize the strategy with.
|
|
15
|
+
*/
|
|
16
|
+
new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Represents styles that can be applied to a custom element.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare class ElementStyles {
|
|
23
|
+
readonly styles: ReadonlyArray<ComposableStyles>;
|
|
24
|
+
private targets;
|
|
25
|
+
private _strategy;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the StyleStrategy associated with these element styles.
|
|
28
|
+
*/
|
|
29
|
+
get strategy(): StyleStrategy;
|
|
30
|
+
/**
|
|
31
|
+
* Creates an instance of ElementStyles.
|
|
32
|
+
* @param styles - The styles that will be associated with elements.
|
|
33
|
+
*/
|
|
34
|
+
constructor(styles: ReadonlyArray<ComposableStyles>);
|
|
35
|
+
/** @internal */
|
|
36
|
+
addStylesTo(target: StyleTarget): void;
|
|
37
|
+
/** @internal */
|
|
38
|
+
removeStylesFrom(target: StyleTarget): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
isAttachedTo(target: StyleTarget): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the strategy that handles adding/removing these styles for an element.
|
|
43
|
+
* @param strategy - The strategy to use.
|
|
44
|
+
*/
|
|
45
|
+
withStrategy(Strategy: ConstructibleStyleStrategy): this;
|
|
46
|
+
/**
|
|
47
|
+
* Sets the default strategy type to use when creating style strategies.
|
|
48
|
+
* @param Strategy - The strategy type to construct.
|
|
49
|
+
*/
|
|
50
|
+
static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
|
|
51
|
+
/**
|
|
52
|
+
* Normalizes a set of composable style options.
|
|
53
|
+
* @param styles - The style options to normalize.
|
|
54
|
+
* @returns A singular ElementStyles instance or undefined.
|
|
55
|
+
*/
|
|
56
|
+
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Indicates whether the DOM supports the adoptedStyleSheets feature.
|
|
59
|
+
*/
|
|
60
|
+
static readonly supportsAdoptedStyleSheets: boolean;
|
|
61
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ExpressionController } from "../observation/observable.js";
|
|
2
|
+
import type { ElementStyles } from "./element-styles.js";
|
|
3
|
+
/**
|
|
4
|
+
* Controls the lifecycle and context of behaviors and styles
|
|
5
|
+
* associated with a component host.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface HostController<TSource = any> extends ExpressionController<TSource> {
|
|
9
|
+
/**
|
|
10
|
+
* Indicates whether the host is connected or not.
|
|
11
|
+
*/
|
|
12
|
+
readonly isConnected: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The main set of styles used for the component, independent
|
|
15
|
+
* of any behavior-specific styles.
|
|
16
|
+
*/
|
|
17
|
+
mainStyles: ElementStyles | null;
|
|
18
|
+
/**
|
|
19
|
+
* Adds the behavior to the component.
|
|
20
|
+
* @param behavior - The behavior to add.
|
|
21
|
+
*/
|
|
22
|
+
addBehavior(behavior: HostBehavior<TSource>): void;
|
|
23
|
+
/**
|
|
24
|
+
* Removes the behavior from the component.
|
|
25
|
+
* @param behavior - The behavior to remove.
|
|
26
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
27
|
+
*/
|
|
28
|
+
removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
|
|
29
|
+
/**
|
|
30
|
+
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
31
|
+
* @param styles - The styles to add.
|
|
32
|
+
*/
|
|
33
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
34
|
+
/**
|
|
35
|
+
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
36
|
+
* @param styles - the styles to remove.
|
|
37
|
+
*/
|
|
38
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Represents an object that can contribute behavior to a host.
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export interface HostBehavior<TSource = any> {
|
|
45
|
+
/**
|
|
46
|
+
* Executed when this behavior is attached to a controller.
|
|
47
|
+
* @param controller - Controls the behavior lifecycle.
|
|
48
|
+
*/
|
|
49
|
+
addedCallback?(controller: HostController<TSource>): void;
|
|
50
|
+
/**
|
|
51
|
+
* Executed when this behavior is detached from a controller.
|
|
52
|
+
* @param controller - Controls the behavior lifecycle.
|
|
53
|
+
*/
|
|
54
|
+
removedCallback?(controller: HostController<TSource>): void;
|
|
55
|
+
/**
|
|
56
|
+
* Executed when this behavior's host is connected.
|
|
57
|
+
* @param controller - Controls the behavior lifecycle.
|
|
58
|
+
*/
|
|
59
|
+
connectedCallback?(controller: HostController<TSource>): void;
|
|
60
|
+
/**
|
|
61
|
+
* Executed when this behavior's host is disconnected.
|
|
62
|
+
* @param controller - Controls the behavior lifecycle.
|
|
63
|
+
*/
|
|
64
|
+
disconnectedCallback?(controller: HostController<TSource>): void;
|
|
65
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A node that can be targeted by styles.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface StyleTarget extends Pick<Node, "getRootNode"> {
|
|
6
|
+
/**
|
|
7
|
+
* Stylesheets to be adopted by the node.
|
|
8
|
+
*/
|
|
9
|
+
adoptedStyleSheets?: CSSStyleSheet[];
|
|
10
|
+
/**
|
|
11
|
+
* Adds styles to the target by appending the styles.
|
|
12
|
+
* @param styles - The styles element to add.
|
|
13
|
+
*/
|
|
14
|
+
append(styles: HTMLStyleElement): void;
|
|
15
|
+
/**
|
|
16
|
+
* Removes styles from the target.
|
|
17
|
+
* @param styles - The styles element to remove.
|
|
18
|
+
*/
|
|
19
|
+
removeChild(styles: HTMLStyleElement): void;
|
|
20
|
+
/**
|
|
21
|
+
* Returns all element descendants of node that match selectors.
|
|
22
|
+
* @param selectors - The CSS selector to use for the query.
|
|
23
|
+
*/
|
|
24
|
+
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Implemented to provide specific behavior when adding/removing styles
|
|
28
|
+
* for elements.
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export interface StyleStrategy {
|
|
32
|
+
/**
|
|
33
|
+
* Adds styles to the target.
|
|
34
|
+
* @param target - The target to add the styles to.
|
|
35
|
+
*/
|
|
36
|
+
addStylesTo(target: StyleTarget): void;
|
|
37
|
+
/**
|
|
38
|
+
* Removes styles from the target.
|
|
39
|
+
* @param target - The target to remove the styles from.
|
|
40
|
+
*/
|
|
41
|
+
removeStylesFrom(target: StyleTarget): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type NodeBehaviorOptions, NodeObservationDirective } from "./node-observation.js";
|
|
2
|
+
import type { CaptureType } from "./template.js";
|
|
3
|
+
/**
|
|
4
|
+
* The options used to configure child list observation.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface ChildListDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The options used to configure subtree observation.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
|
|
14
|
+
/**
|
|
15
|
+
* Indicates that child subtrees should be observed for changes.
|
|
16
|
+
*/
|
|
17
|
+
subtree: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* When subtrees are observed, a query selector is required to indicate
|
|
20
|
+
* which of potentially many nodes should be assigned to the property.
|
|
21
|
+
*/
|
|
22
|
+
selector: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The options used to configure child/subtree node observation.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
|
|
29
|
+
/**
|
|
30
|
+
* The runtime behavior for child node observation.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare class ChildrenDirective extends NodeObservationDirective<ChildrenDirectiveOptions> {
|
|
34
|
+
private observerProperty;
|
|
35
|
+
/**
|
|
36
|
+
* Creates an instance of ChildrenDirective.
|
|
37
|
+
* @param options - The options to use in configuring the child observation behavior.
|
|
38
|
+
*/
|
|
39
|
+
constructor(options: ChildrenDirectiveOptions);
|
|
40
|
+
/**
|
|
41
|
+
* Begins observation of the nodes.
|
|
42
|
+
* @param target - The target to observe.
|
|
43
|
+
*/
|
|
44
|
+
observe(target: any): void;
|
|
45
|
+
/**
|
|
46
|
+
* Disconnects observation of the nodes.
|
|
47
|
+
* @param target - The target to unobserve.
|
|
48
|
+
*/
|
|
49
|
+
disconnect(target: any): void;
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves the raw nodes that should be assigned to the source property.
|
|
52
|
+
* @param target - The target to get the node to.
|
|
53
|
+
*/
|
|
54
|
+
getNodes(target: Element): Node[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A directive that observes the `childNodes` of an element and updates a property
|
|
58
|
+
* whenever they change.
|
|
59
|
+
* @param propertyOrOptions - The options used to configure child node observation.
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export declare function children<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DOMPolicy } from "../dom-policy.js";
|
|
2
|
+
import { type ViewBehaviorFactory } from "./html-directive.js";
|
|
3
|
+
import type { HTMLTemplateCompilationResult as TemplateCompilationResult } from "./template.js";
|
|
4
|
+
/**
|
|
5
|
+
* A function capable of compiling a template from the preprocessed form produced
|
|
6
|
+
* by the html template function into a result that can instantiate views.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type CompilationStrategy = (
|
|
10
|
+
/**
|
|
11
|
+
* The preprocessed HTML string or template to compile.
|
|
12
|
+
*/
|
|
13
|
+
html: string | HTMLTemplateElement,
|
|
14
|
+
/**
|
|
15
|
+
* The behavior factories used within the html that is being compiled.
|
|
16
|
+
*/
|
|
17
|
+
factories: Record<string, ViewBehaviorFactory>,
|
|
18
|
+
/**
|
|
19
|
+
* The security policy to compile the html with.
|
|
20
|
+
*/
|
|
21
|
+
policy: DOMPolicy) => TemplateCompilationResult;
|
|
22
|
+
/**
|
|
23
|
+
* Common APIs related to compilation.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare const Compiler: {
|
|
27
|
+
/**
|
|
28
|
+
* Compiles a template and associated directives into a compilation
|
|
29
|
+
* result which can be used to create views.
|
|
30
|
+
* @param html - The html string or template element to compile.
|
|
31
|
+
* @param factories - The behavior factories referenced by the template.
|
|
32
|
+
* @param policy - The security policy to compile the html with.
|
|
33
|
+
* @remarks
|
|
34
|
+
* The template that is provided for compilation is altered in-place
|
|
35
|
+
* and cannot be compiled again. If the original template must be preserved,
|
|
36
|
+
* it is recommended that you clone the original and pass the clone to this API.
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy): TemplateCompilationResult<TSource, TParent>;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the default compilation strategy that will be used by the ViewTemplate whenever
|
|
42
|
+
* it needs to compile a view preprocessed with the html template function.
|
|
43
|
+
* @param strategy - The compilation strategy to use when compiling templates.
|
|
44
|
+
*/
|
|
45
|
+
setDefaultStrategy(strategy: CompilationStrategy): void;
|
|
46
|
+
/**
|
|
47
|
+
* Aggregates an array of strings and directives into a single directive.
|
|
48
|
+
* @param parts - A heterogeneous array of static strings interspersed with
|
|
49
|
+
* directives.
|
|
50
|
+
* @param policy - The security policy to use with the aggregated bindings.
|
|
51
|
+
* @returns A single inline directive that aggregates the behavior of all the parts.
|
|
52
|
+
*/
|
|
53
|
+
aggregate(parts: (string | ViewBehaviorFactory)[], policy?: DOMPolicy): ViewBehaviorFactory;
|
|
54
|
+
};
|