glass-easel 0.1.0
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/README.md +40 -0
- package/dist/glass_easel.all.d.ts +1 -0
- package/dist/glass_easel.all.js +2 -0
- package/dist/glass_easel.all.js.map +1 -0
- package/dist/glass_easel.domlike.global.d.ts +1 -0
- package/dist/glass_easel.domlike.global.js +2 -0
- package/dist/glass_easel.domlike.global.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/src/backend/backend_protocol.d.ts +119 -0
- package/dist/types/src/backend/backend_protocol.d.ts.map +1 -0
- package/dist/types/src/backend/composed_backend_protocol.d.ts +90 -0
- package/dist/types/src/backend/composed_backend_protocol.d.ts.map +1 -0
- package/dist/types/src/backend/domlike_backend_protocol.d.ts +76 -0
- package/dist/types/src/backend/domlike_backend_protocol.d.ts.map +1 -0
- package/dist/types/src/backend/mode.d.ts +46 -0
- package/dist/types/src/backend/mode.d.ts.map +1 -0
- package/dist/types/src/backend/suggested_backend_protocol.d.ts +30 -0
- package/dist/types/src/backend/suggested_backend_protocol.d.ts.map +1 -0
- package/dist/types/src/behavior.d.ts +428 -0
- package/dist/types/src/behavior.d.ts.map +1 -0
- package/dist/types/src/class_list.d.ts +79 -0
- package/dist/types/src/class_list.d.ts.map +1 -0
- package/dist/types/src/component.d.ts +291 -0
- package/dist/types/src/component.d.ts.map +1 -0
- package/dist/types/src/component_params.d.ts +239 -0
- package/dist/types/src/component_params.d.ts.map +1 -0
- package/dist/types/src/component_space.d.ts +164 -0
- package/dist/types/src/component_space.d.ts.map +1 -0
- package/dist/types/src/data_path.d.ts +5 -0
- package/dist/types/src/data_path.d.ts.map +1 -0
- package/dist/types/src/data_proxy.d.ts +107 -0
- package/dist/types/src/data_proxy.d.ts.map +1 -0
- package/dist/types/src/data_utils.d.ts +3 -0
- package/dist/types/src/data_utils.d.ts.map +1 -0
- package/dist/types/src/element.d.ts +275 -0
- package/dist/types/src/element.d.ts.map +1 -0
- package/dist/types/src/element_iterator.d.ts +43 -0
- package/dist/types/src/element_iterator.d.ts.map +1 -0
- package/dist/types/src/event.d.ts +104 -0
- package/dist/types/src/event.d.ts.map +1 -0
- package/dist/types/src/external_shadow_tree.d.ts +20 -0
- package/dist/types/src/external_shadow_tree.d.ts.map +1 -0
- package/dist/types/src/func_arr.d.ts +39 -0
- package/dist/types/src/func_arr.d.ts.map +1 -0
- package/dist/types/src/global_options.d.ts +111 -0
- package/dist/types/src/global_options.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +43 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/mutation_observer.d.ts +79 -0
- package/dist/types/src/mutation_observer.d.ts.map +1 -0
- package/dist/types/src/native_node.d.ts +8 -0
- package/dist/types/src/native_node.d.ts.map +1 -0
- package/dist/types/src/node.d.ts +49 -0
- package/dist/types/src/node.d.ts.map +1 -0
- package/dist/types/src/relation.d.ts +47 -0
- package/dist/types/src/relation.d.ts.map +1 -0
- package/dist/types/src/render.d.ts +3 -0
- package/dist/types/src/render.d.ts.map +1 -0
- package/dist/types/src/selector.d.ts +32 -0
- package/dist/types/src/selector.d.ts.map +1 -0
- package/dist/types/src/shadow_root.d.ts +136 -0
- package/dist/types/src/shadow_root.d.ts.map +1 -0
- package/dist/types/src/template_engine.d.ts +18 -0
- package/dist/types/src/template_engine.d.ts.map +1 -0
- package/dist/types/src/text_node.d.ts +32 -0
- package/dist/types/src/text_node.d.ts.map +1 -0
- package/dist/types/src/tmpl/index.d.ts +18 -0
- package/dist/types/src/tmpl/index.d.ts.map +1 -0
- package/dist/types/src/tmpl/native_rendering.d.ts +45 -0
- package/dist/types/src/tmpl/native_rendering.d.ts.map +1 -0
- package/dist/types/src/tmpl/proc_gen_wrapper.d.ts +80 -0
- package/dist/types/src/tmpl/proc_gen_wrapper.d.ts.map +1 -0
- package/dist/types/src/tmpl/proc_gen_wrapper_dom.d.ts +50 -0
- package/dist/types/src/tmpl/proc_gen_wrapper_dom.d.ts.map +1 -0
- package/dist/types/src/tmpl/range_list_diff.d.ts +19 -0
- package/dist/types/src/tmpl/range_list_diff.d.ts.map +1 -0
- package/dist/types/src/trait_behaviors.d.ts +38 -0
- package/dist/types/src/trait_behaviors.d.ts.map +1 -0
- package/dist/types/src/virtual_node.d.ts +10 -0
- package/dist/types/src/virtual_node.d.ts.map +1 -0
- package/dist/types/tests/backend/domlike.test.d.ts +2 -0
- package/dist/types/tests/backend/domlike.test.d.ts.map +1 -0
- package/dist/types/tests/base/env.d.ts +29 -0
- package/dist/types/tests/base/env.d.ts.map +1 -0
- package/dist/types/tests/base/match.d.ts +9 -0
- package/dist/types/tests/base/match.d.ts.map +1 -0
- package/dist/types/tests/core/backend.test.d.ts +2 -0
- package/dist/types/tests/core/backend.test.d.ts.map +1 -0
- package/dist/types/tests/core/behavior.test.d.ts +2 -0
- package/dist/types/tests/core/behavior.test.d.ts.map +1 -0
- package/dist/types/tests/core/component_space.test.d.ts +2 -0
- package/dist/types/tests/core/component_space.test.d.ts.map +1 -0
- package/dist/types/tests/core/data_update.test.d.ts +2 -0
- package/dist/types/tests/core/data_update.test.d.ts.map +1 -0
- package/dist/types/tests/core/misc.test.d.ts +2 -0
- package/dist/types/tests/core/misc.test.d.ts.map +1 -0
- package/dist/types/tests/core/placeholder.test.d.ts +2 -0
- package/dist/types/tests/core/placeholder.test.d.ts.map +1 -0
- package/dist/types/tests/core/slot.test.d.ts +2 -0
- package/dist/types/tests/core/slot.test.d.ts.map +1 -0
- package/dist/types/tests/core/trait_behaviors.test.d.ts +2 -0
- package/dist/types/tests/core/trait_behaviors.test.d.ts.map +1 -0
- package/dist/types/tests/tmpl/binding_map.test.d.ts +2 -0
- package/dist/types/tests/tmpl/binding_map.test.d.ts.map +1 -0
- package/dist/types/tests/tmpl/event.test.d.ts +2 -0
- package/dist/types/tests/tmpl/event.test.d.ts.map +1 -0
- package/dist/types/tests/tmpl/expression.test.d.ts +2 -0
- package/dist/types/tests/tmpl/expression.test.d.ts.map +1 -0
- package/dist/types/tests/tmpl/lvalue.test.d.ts +2 -0
- package/dist/types/tests/tmpl/lvalue.test.d.ts.map +1 -0
- package/dist/types/tests/tmpl/native_rendering.test.d.ts +2 -0
- package/dist/types/tests/tmpl/native_rendering.test.d.ts.map +1 -0
- package/dist/types/tests/tmpl/structure.test.d.ts +2 -0
- package/dist/types/tests/tmpl/structure.test.d.ts.map +1 -0
- package/dist/types/tests/types/chaining.test.d.ts +2 -0
- package/dist/types/tests/types/chaining.test.d.ts.map +1 -0
- package/dist/types/tests/types/createElement.test.d.ts +2 -0
- package/dist/types/tests/types/createElement.test.d.ts.map +1 -0
- package/dist/types/tests/types/definition.test.d.ts +2 -0
- package/dist/types/tests/types/definition.test.d.ts.map +1 -0
- package/guide/zh_CN/advanced/binding_map_update.md +32 -0
- package/guide/zh_CN/advanced/build_args.md +28 -0
- package/guide/zh_CN/advanced/component_filter.md +70 -0
- package/guide/zh_CN/advanced/component_space.md +124 -0
- package/guide/zh_CN/advanced/custom_backend.md +53 -0
- package/guide/zh_CN/advanced/error_listener.md +32 -0
- package/guide/zh_CN/advanced/external_component.md +73 -0
- package/guide/zh_CN/advanced/template_engine.md +61 -0
- package/guide/zh_CN/appendix/backend_protocol.md +501 -0
- package/guide/zh_CN/appendix/list_diff_algorithm.md +406 -0
- package/guide/zh_CN/basic/beginning.md +94 -0
- package/guide/zh_CN/basic/component.md +156 -0
- package/guide/zh_CN/basic/event.md +169 -0
- package/guide/zh_CN/basic/lifetime.md +66 -0
- package/guide/zh_CN/basic/method.md +62 -0
- package/guide/zh_CN/basic/template.md +135 -0
- package/guide/zh_CN/data_management/advanced_update.md +170 -0
- package/guide/zh_CN/data_management/data_deep_copy.md +157 -0
- package/guide/zh_CN/data_management/data_observer.md +154 -0
- package/guide/zh_CN/data_management/property_early_init.md +31 -0
- package/guide/zh_CN/data_management/pure_data_pattern.md +21 -0
- package/guide/zh_CN/index.md +93 -0
- package/guide/zh_CN/interaction/behavior.md +52 -0
- package/guide/zh_CN/interaction/component_path.md +37 -0
- package/guide/zh_CN/interaction/generic.md +73 -0
- package/guide/zh_CN/interaction/placeholder.md +40 -0
- package/guide/zh_CN/interaction/relation.md +151 -0
- package/guide/zh_CN/interaction/slot.md +137 -0
- package/guide/zh_CN/interaction/template_import.md +94 -0
- package/guide/zh_CN/interaction/trait_behavior.md +117 -0
- package/guide/zh_CN/styling/external_class.md +46 -0
- package/guide/zh_CN/styling/style_isolation.md +54 -0
- package/guide/zh_CN/styling/virtual_host.md +52 -0
- package/guide/zh_CN/tree/element_iterator.md +54 -0
- package/guide/zh_CN/tree/mutation_observer.md +52 -0
- package/guide/zh_CN/tree/node_tree.md +142 -0
- package/guide/zh_CN/tree/node_tree_modification.md +78 -0
- package/guide/zh_CN/tree/selector.md +66 -0
- package/jest.config.js +6 -0
- package/jest.dts.config.js +9 -0
- package/jest.unit.config.js +14 -0
- package/package.json +28 -0
- package/src/backend/backend_protocol.ts +313 -0
- package/src/backend/composed_backend_protocol.ts +252 -0
- package/src/backend/domlike_backend_protocol.ts +370 -0
- package/src/backend/mode.ts +51 -0
- package/src/backend/suggested_backend_protocol.ts +83 -0
- package/src/behavior.ts +1655 -0
- package/src/bootstrap_dom_dev.js +22 -0
- package/src/class_list.ts +376 -0
- package/src/component.ts +1309 -0
- package/src/component_params.ts +461 -0
- package/src/component_space.ts +547 -0
- package/src/data_path.ts +225 -0
- package/src/data_proxy.ts +670 -0
- package/src/data_utils.ts +50 -0
- package/src/element.ts +1966 -0
- package/src/element_iterator.ts +158 -0
- package/src/event.ts +401 -0
- package/src/external_shadow_tree.ts +27 -0
- package/src/func_arr.ts +198 -0
- package/src/global_options.ts +242 -0
- package/src/index.ts +187 -0
- package/src/mutation_observer.ts +252 -0
- package/src/native_node.ts +74 -0
- package/src/node.ts +174 -0
- package/src/relation.ts +380 -0
- package/src/render.ts +25 -0
- package/src/selector.ts +218 -0
- package/src/shadow_root.ts +766 -0
- package/src/template_engine.ts +45 -0
- package/src/text_node.ts +149 -0
- package/src/tmpl/index.ts +199 -0
- package/src/tmpl/native_rendering.ts +175 -0
- package/src/tmpl/proc_gen_wrapper.ts +954 -0
- package/src/tmpl/proc_gen_wrapper_dom.ts +230 -0
- package/src/tmpl/range_list_diff.ts +443 -0
- package/src/trait_behaviors.ts +51 -0
- package/src/virtual_node.ts +51 -0
- package/tests/backend/domlike.test.ts +254 -0
- package/tests/base/env.ts +78 -0
- package/tests/base/match.ts +185 -0
- package/tests/core/backend.test.ts +144 -0
- package/tests/core/behavior.test.ts +546 -0
- package/tests/core/component_space.test.ts +212 -0
- package/tests/core/data_update.test.ts +461 -0
- package/tests/core/misc.test.ts +339 -0
- package/tests/core/placeholder.test.ts +180 -0
- package/tests/core/slot.test.ts +1495 -0
- package/tests/core/trait_behaviors.test.ts +153 -0
- package/tests/legacy/README.md +3 -0
- package/tests/legacy/behavior.test.js +293 -0
- package/tests/legacy/component.test.js +1247 -0
- package/tests/legacy/data_path.test.js +149 -0
- package/tests/legacy/data_proxy.test.js +759 -0
- package/tests/legacy/element_iterator.test.js +148 -0
- package/tests/legacy/event.test.js +849 -0
- package/tests/legacy/external.test.js +510 -0
- package/tests/legacy/extra_info.test.js +109 -0
- package/tests/legacy/generics.test.js +176 -0
- package/tests/legacy/mutation_observer.test.js +210 -0
- package/tests/legacy/relation.test.js +517 -0
- package/tests/legacy/selector.test.js +263 -0
- package/tests/legacy/slot.test.js +915 -0
- package/tests/legacy/virtual.test.js +394 -0
- package/tests/tmpl/binding_map.test.ts +208 -0
- package/tests/tmpl/event.test.ts +206 -0
- package/tests/tmpl/expression.test.ts +429 -0
- package/tests/tmpl/lvalue.test.ts +160 -0
- package/tests/tmpl/native_rendering.test.ts +155 -0
- package/tests/tmpl/structure.test.ts +998 -0
- package/tests/types/chaining.test.ts +614 -0
- package/tests/types/createElement.test.ts +82 -0
- package/tests/types/definition.test.ts +442 -0
- package/tsconfig.json +11 -0
- package/webpack.config.js +270 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { ComponentParams, DataList, PropertyList, MethodList, ComponentInstance, Empty } from './component_params';
|
|
2
|
+
import { Behavior, BehaviorBuilder, GeneralBehavior } from './behavior';
|
|
3
|
+
import { ComponentDefinition, GeneralComponentDefinition, GeneralComponent } from './component';
|
|
4
|
+
import { ComponentOptions, NormalizedComponentOptions } from './global_options';
|
|
5
|
+
import { StyleScopeManager } from './class_list';
|
|
6
|
+
import { GeneralBackendContext } from '.';
|
|
7
|
+
import { TraitBehavior } from './trait_behaviors';
|
|
8
|
+
export declare const normalizeUrl: (path: string, relPath: string) => {
|
|
9
|
+
domain: string | null;
|
|
10
|
+
absPath: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class ComponentWaitingList {
|
|
13
|
+
/** @internal */
|
|
14
|
+
private _$callbacks;
|
|
15
|
+
add(callback: (c: GeneralComponentDefinition) => void): void;
|
|
16
|
+
remove(callback: (c: GeneralComponentDefinition) => void): void;
|
|
17
|
+
call(c: GeneralComponentDefinition): void;
|
|
18
|
+
}
|
|
19
|
+
/** A group of components for cross-component using */
|
|
20
|
+
export declare class ComponentSpace {
|
|
21
|
+
/** @internal */
|
|
22
|
+
private _$behaviorList;
|
|
23
|
+
/** @internal */
|
|
24
|
+
private _$pubBehaviorList;
|
|
25
|
+
/** @internal */
|
|
26
|
+
private _$list;
|
|
27
|
+
/** @internal */
|
|
28
|
+
private _$pubList;
|
|
29
|
+
/** @internal */
|
|
30
|
+
private _$importedSpaces;
|
|
31
|
+
/** @internal */
|
|
32
|
+
private _$defaultComponent;
|
|
33
|
+
/** @internal */
|
|
34
|
+
private _$componentOptions;
|
|
35
|
+
styleScopeManager: StyleScopeManager;
|
|
36
|
+
/** @internal */
|
|
37
|
+
private _$listWaiting;
|
|
38
|
+
/** @internal */
|
|
39
|
+
private _$pubListWaiting;
|
|
40
|
+
/**
|
|
41
|
+
* Create a new component space
|
|
42
|
+
*
|
|
43
|
+
* The `defaultComponent` is the default component path.
|
|
44
|
+
* It should be defined soon after creation.
|
|
45
|
+
* A `baseSpace` can be provided as a "base" component space -
|
|
46
|
+
* every component alias (and behavior alias) in the space will be imported when creation.
|
|
47
|
+
* However, if any new component is added to the base space after the creation,
|
|
48
|
+
* it will not be added to the created space.
|
|
49
|
+
*/
|
|
50
|
+
constructor(defaultComponent?: string, baseSpace?: ComponentSpace, styleScopeManager?: StyleScopeManager);
|
|
51
|
+
/**
|
|
52
|
+
* Update the default component options for this space
|
|
53
|
+
*
|
|
54
|
+
* The new options will be merged with existing options.
|
|
55
|
+
*/
|
|
56
|
+
updateComponentOptions(componentOptions: ComponentOptions): void;
|
|
57
|
+
getComponentOptions(): NormalizedComponentOptions;
|
|
58
|
+
/**
|
|
59
|
+
* Update the base component space
|
|
60
|
+
*
|
|
61
|
+
* This will add the components in `baseSpace` if there is no components with the same names.
|
|
62
|
+
*/
|
|
63
|
+
updateBaseSpace(baseSpace: ComponentSpace): void;
|
|
64
|
+
/**
|
|
65
|
+
* Import another component space
|
|
66
|
+
*
|
|
67
|
+
* The components in the imported space can be used by components in this space.
|
|
68
|
+
* The `protoDomain` should be URL-like, i.e. `space://another-space` .
|
|
69
|
+
* When using, the components in the imported space should be specified with `protoDomain` .
|
|
70
|
+
* For example, if `protoDomain` is `space://another-space` and one imported component has alias `my-comp` ,
|
|
71
|
+
* then it should be specified with `space://another-space/my-comp` .
|
|
72
|
+
* If `privateUse` set to false, only component alias in the imported space can be used;
|
|
73
|
+
* the original name of components is imported otherwise.
|
|
74
|
+
*/
|
|
75
|
+
importSpace(protoDomain: string, space: ComponentSpace, privateUse: boolean): void;
|
|
76
|
+
/**
|
|
77
|
+
* Get a component by the `path`
|
|
78
|
+
*
|
|
79
|
+
* The component `is` is actually treated as the "path" of the component.
|
|
80
|
+
* In other words, the component `is` field can be a string like `path/to/the/component` .
|
|
81
|
+
* Other components can be used by the component with "relative path" spacified.
|
|
82
|
+
* In this method, if the `path` is given as a relative path (not started with `/` ),
|
|
83
|
+
* it will be converted according to the `basePath` .
|
|
84
|
+
* If the `path` is given as a URL-like format,
|
|
85
|
+
* the component will be searched in imported comopnent spaces ( `importSpace()` for details).
|
|
86
|
+
*/
|
|
87
|
+
getComponentByUrl(path: string, basePath: string): GeneralComponentDefinition;
|
|
88
|
+
/**
|
|
89
|
+
* Get a component by the `path`
|
|
90
|
+
*
|
|
91
|
+
* Similar to `getComponentByUrl()` ,
|
|
92
|
+
* but returns `null` instead of the default component if no compnent was found.
|
|
93
|
+
*/
|
|
94
|
+
getComponentByUrlWithoutDefault(path: string, relPath: string): GeneralComponentDefinition | null;
|
|
95
|
+
private getComponent;
|
|
96
|
+
getDefaultComponent(): GeneralComponentDefinition | null;
|
|
97
|
+
isDefaultComponent(def: GeneralComponentDefinition): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Get a behavior by the `path`
|
|
100
|
+
*
|
|
101
|
+
* Similar to `getComponentByUrlWithoutDefault()` but for behaviors.
|
|
102
|
+
*/
|
|
103
|
+
getBehaviorByUrl(path: string, relPath: string): GeneralBehavior | null;
|
|
104
|
+
/** @internal */
|
|
105
|
+
_$getBehavior(absPath: string, domain?: string | null): GeneralBehavior | undefined;
|
|
106
|
+
/** Register a component in this space */
|
|
107
|
+
defineComponent<TData extends DataList, TProperty extends PropertyList, TMethod extends MethodList>(def: ComponentParams<TData, TProperty, TMethod> & ThisType<ComponentInstance<TData, TProperty, TMethod>>): ComponentDefinition<TData, TProperty, TMethod>;
|
|
108
|
+
/** Register a behavior in this space */
|
|
109
|
+
defineBehavior<TData extends DataList, TProperty extends PropertyList, TMethod extends MethodList>(def: ComponentParams<TData, TProperty, TMethod> & ThisType<ComponentInstance<TData, TProperty, TMethod>>): Behavior<TData, TProperty, TMethod, never>;
|
|
110
|
+
/** Register a component or a behavior with chaining API */
|
|
111
|
+
define(is?: string): BehaviorBuilder;
|
|
112
|
+
/**
|
|
113
|
+
* Register a component or a behavior with chaining API (with method caller type specified)
|
|
114
|
+
*
|
|
115
|
+
* This API is generally designed for adapters which require special method callers.
|
|
116
|
+
*/
|
|
117
|
+
defineWithMethodCaller(is?: string): BehaviorBuilder<Empty, Empty, Empty, Empty, never, never>;
|
|
118
|
+
/** @internal */
|
|
119
|
+
_$registerComponent(is: string, comp: GeneralComponentDefinition): void;
|
|
120
|
+
/** @internal */
|
|
121
|
+
_$registerBehavior(is: string, beh: GeneralBehavior): void;
|
|
122
|
+
/**
|
|
123
|
+
* Assign a public alias to a component
|
|
124
|
+
*
|
|
125
|
+
* The alias can be used in other component spaces which imported this component space.
|
|
126
|
+
* One component may have multiple aliases.
|
|
127
|
+
*/
|
|
128
|
+
exportComponent(alias: string, is: string): void;
|
|
129
|
+
/**
|
|
130
|
+
* Assign a public alias to a behavior
|
|
131
|
+
*
|
|
132
|
+
* The alias can be used in other component spaces which imported this component space.
|
|
133
|
+
* One behavior may have multiple aliases.
|
|
134
|
+
*/
|
|
135
|
+
exportBehavior(alias: string, is: string): void;
|
|
136
|
+
/** @internal */
|
|
137
|
+
_$componentWaitingList(path: string, relPath: string): ComponentWaitingList | null;
|
|
138
|
+
getWaitingComponents(): string[];
|
|
139
|
+
/**
|
|
140
|
+
* Create a component by URL
|
|
141
|
+
*
|
|
142
|
+
* This `url` can contain params (started with "?" character).
|
|
143
|
+
* The params will try to be set to component properties (if matches the property name).
|
|
144
|
+
*/
|
|
145
|
+
createComponentByUrl(tagName: string, url: string, genericTargets: {
|
|
146
|
+
[name: string]: string;
|
|
147
|
+
} | null, backendContext: GeneralBackendContext | null): GeneralComponent;
|
|
148
|
+
/**
|
|
149
|
+
* Define a trait behavior
|
|
150
|
+
*
|
|
151
|
+
* A trait behavior
|
|
152
|
+
* Optionally, the trait behavior can add a conversion function.
|
|
153
|
+
* This function can convert the implementation to another interface.
|
|
154
|
+
*/
|
|
155
|
+
defineTraitBehavior<TIn extends {
|
|
156
|
+
[key: string]: any;
|
|
157
|
+
}>(): TraitBehavior<TIn, TIn>;
|
|
158
|
+
defineTraitBehavior<TIn extends {
|
|
159
|
+
[key: string]: any;
|
|
160
|
+
}, TOut extends {
|
|
161
|
+
[key: string]: any;
|
|
162
|
+
}>(trans: (impl: TIn) => TOut): TraitBehavior<TIn, TOut>;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=component_space.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component_space.d.ts","sourceRoot":"","sources":["../../../src/component_space.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,KAAK,EACN,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,QAAQ,EACR,eAAe,EACf,eAAe,EAChB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAE1B,gBAAgB,EACjB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,gBAAgB,EAEhB,0BAA0B,EAC3B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,iBAAiB,EAClB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,qBAAqB,EACtB,MAAM,GAAG,CAAA;AACV,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAsBjD,eAAO,MAAM,YAAY,SACjB,MAAM,WACH,MAAM,KACd;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAwB1C,CAAA;AAED,qBAAa,oBAAoB;IAC/B,gBAAgB;IAChB,OAAO,CAAC,WAAW,CAAkD;IAErE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,0BAA0B,KAAK,IAAI;IAIrD,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,0BAA0B,KAAK,IAAI;IAMxD,IAAI,CAAC,CAAC,EAAE,0BAA0B;CAQnC;AAED,sDAAsD;AACtD,qBAAa,cAAc;IACzB,gBAAgB;IAChB,OAAO,CAAC,cAAc,CAA6D;IACn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AAsB,CACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,oBAAoB,GAAG,IAAI;IAmC9B,oBAAoB;IAIpB;;;;;OAKG;IACH,oBAAoB,CAClB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,cAAc,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,EACjD,cAAc,EAAE,qBAAqB,GAAG,IAAI,GAC3C,gBAAgB;IAuDnB;;;;;;OAMG;IACH,mBAAmB,CAAC,GAAG,SAAS;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,KAAK,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC;IAClF,mBAAmB,CACjB,GAAG,SAAS;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAClC,IAAI,SAAS;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EACnC,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC;CAOxD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type DataPath = Array<string | number>;
|
|
2
|
+
export type MultiPaths = DataPath[];
|
|
3
|
+
export declare const parseSinglePath: (str: string) => DataPath | null;
|
|
4
|
+
export declare const parseMultiPaths: (str: string | string[]) => MultiPaths;
|
|
5
|
+
//# sourceMappingURL=data_path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data_path.d.ts","sourceRoot":"","sources":["../../../src/data_path.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;AAE7C,MAAM,MAAM,UAAU,GAAG,QAAQ,EAAE,CAAA;AAsLnC,eAAO,MAAM,eAAe,QAAS,MAAM,KAAG,QAAQ,GAAG,IAgBxD,CAAA;AAED,eAAO,MAAM,eAAe,QAAS,MAAM,GAAG,MAAM,EAAE,eAkBrD,CAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { PropertyDefinition } from './behavior';
|
|
2
|
+
import { DataPath, MultiPaths } from './data_path';
|
|
3
|
+
import { DeepCopyKind } from './global_options';
|
|
4
|
+
import { DataList, PropertyList, MethodList, ComponentInstance, DataWithPropertyValues } from './component_params';
|
|
5
|
+
export declare const enum DeepCopyStrategy {
|
|
6
|
+
None = 0,
|
|
7
|
+
Simple = 1,
|
|
8
|
+
SimpleWithRecursion = 2
|
|
9
|
+
}
|
|
10
|
+
export type DataValue = unknown;
|
|
11
|
+
export type DataObserver = (...values: unknown[]) => void;
|
|
12
|
+
export type DataChange = DataReplace | DataSplice;
|
|
13
|
+
export type DataReplace = [DataPath, DataValue, undefined, undefined];
|
|
14
|
+
export type DataSplice = [DataPath, DataValue[], number, number];
|
|
15
|
+
export type PropertyChange = {
|
|
16
|
+
propName: string;
|
|
17
|
+
prop: PropertyDefinition;
|
|
18
|
+
oldValue: unknown;
|
|
19
|
+
newValue: unknown;
|
|
20
|
+
skipModelListener: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type DataUpdateCallback = (data: {
|
|
23
|
+
[name: string]: DataValue;
|
|
24
|
+
}, combinedChanges: DataChange[]) => void;
|
|
25
|
+
export type ModelBindingListener = (value: DataValue) => void;
|
|
26
|
+
type ObserverNode = {
|
|
27
|
+
listener?: number[];
|
|
28
|
+
wildcard?: number[];
|
|
29
|
+
sub: {
|
|
30
|
+
[name: string]: ObserverNode;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare class DataGroupObserverTree {
|
|
34
|
+
propFields: {
|
|
35
|
+
[name: string]: PropertyDefinition;
|
|
36
|
+
};
|
|
37
|
+
observerTree: ObserverNode;
|
|
38
|
+
observers: DataObserverWithPath[];
|
|
39
|
+
constructor(propFields: {
|
|
40
|
+
[name: string]: PropertyDefinition;
|
|
41
|
+
});
|
|
42
|
+
cloneSub(): DataGroupObserverTree;
|
|
43
|
+
addObserver(func: DataObserver, dataPath: MultiPaths): void;
|
|
44
|
+
}
|
|
45
|
+
type DataObserverWithPath = {
|
|
46
|
+
path: MultiPaths;
|
|
47
|
+
f: DataObserver;
|
|
48
|
+
};
|
|
49
|
+
export declare const getDeepCopyStrategy: (level: DeepCopyKind) => DeepCopyStrategy;
|
|
50
|
+
/** A data wrapper for data operations such as `setData` */
|
|
51
|
+
export declare class DataGroup<TData extends DataList, TProperty extends PropertyList, TMethod extends MethodList> {
|
|
52
|
+
data: DataWithPropertyValues<TData, TProperty>;
|
|
53
|
+
innerData: {
|
|
54
|
+
[key: string]: DataValue;
|
|
55
|
+
} | null;
|
|
56
|
+
private _$comp;
|
|
57
|
+
private _$pureDataPattern;
|
|
58
|
+
private _$dataDeepCopy;
|
|
59
|
+
private _$propertyPassingDeepCopy;
|
|
60
|
+
private _$reflectToAttributes;
|
|
61
|
+
private _$propFields;
|
|
62
|
+
private _$observerTree;
|
|
63
|
+
private _$observers;
|
|
64
|
+
private _$observerStatus;
|
|
65
|
+
private _$modelBindingListener;
|
|
66
|
+
private _$updateListener?;
|
|
67
|
+
private _$pendingChanges;
|
|
68
|
+
private _$doingUpdates;
|
|
69
|
+
private _$generateInnerData;
|
|
70
|
+
constructor(associatedComponent: ComponentInstance<TData, TProperty, TMethod> | null, data: DataWithPropertyValues<TData, TProperty>, pureDataPattern: RegExp | null, dataDeepCopy: DeepCopyStrategy, propertyPassingDeepCopy: DeepCopyStrategy, reflectToAttributes: boolean, observerTree: DataGroupObserverTree);
|
|
71
|
+
/** Create a simple data group */
|
|
72
|
+
static create(data: {
|
|
73
|
+
[key: string]: DataValue;
|
|
74
|
+
}): DataGroup<any, PropertyList, MethodList>;
|
|
75
|
+
/** Set a callback for every grouped update */
|
|
76
|
+
setUpdateListener(updateListener: DataUpdateCallback): void;
|
|
77
|
+
/** Replace the underlying data */
|
|
78
|
+
replaceWholeData(data: DataWithPropertyValues<TData, TProperty>): void;
|
|
79
|
+
/** Add a new common data change to queue */
|
|
80
|
+
replaceDataOnPath(path: DataPath, newData: DataValue): void;
|
|
81
|
+
/** Add a new array splice operation to queue */
|
|
82
|
+
spliceArrayDataOnPath(path: DataPath, index: number | undefined, del: number | undefined, inserts: DataValue[]): void;
|
|
83
|
+
/**
|
|
84
|
+
* Add a new property change to queue
|
|
85
|
+
*
|
|
86
|
+
* (Generally designed for template engines.)
|
|
87
|
+
* If the `propName` is a property,
|
|
88
|
+
* the `newData` will be deep-copied according to the `propertyPassingDeepCopy` configuration.
|
|
89
|
+
* Otherwise, it returns false.
|
|
90
|
+
*/
|
|
91
|
+
replaceProperty(propName: string, newData: DataValue): boolean;
|
|
92
|
+
/** Discard changes in queue and generate a new queue with specified changes */
|
|
93
|
+
setChanges(changes: DataChange[]): void;
|
|
94
|
+
/** Get the data change queue */
|
|
95
|
+
getChanges(): DataChange[];
|
|
96
|
+
/**
|
|
97
|
+
* Set a callback when a specified property changes
|
|
98
|
+
*
|
|
99
|
+
* (Generally designed for template engines.)
|
|
100
|
+
*/
|
|
101
|
+
setModelBindingListener(propName: string, listener: ModelBindingListener): void;
|
|
102
|
+
/** Apply all changes in queue */
|
|
103
|
+
applyDataUpdates(skipModelListener?: boolean): void;
|
|
104
|
+
}
|
|
105
|
+
export type GeneralDataGroup = DataGroup<DataList, PropertyList, MethodList>;
|
|
106
|
+
export {};
|
|
107
|
+
//# sourceMappingURL=data_proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data_proxy.d.ts","sourceRoot":"","sources":["../../../src/data_proxy.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,kBAAkB,EACnB,MAAM,YAAY,CAAA;AAKnB,OAAO,EACL,QAAQ,EACR,UAAU,EACX,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,YAAY,EACb,MAAM,kBAAkB,CAAA;AAIzB,OAAO,EAEL,QAAQ,EACR,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ings":"AAyBA,eAAO,MAAM,cAAc,kBAmB1B,CAAA;AAED,eAAO,MAAM,QAAQ,6BAA8B,OAAO,MAGzD,CAAA"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { MutationObserverTarget } from './mutation_observer';
|
|
2
|
+
import { Event, EventListener, EventListenerOptions, EventOptions, EventTarget } from './event';
|
|
3
|
+
import { ParsedSelector } from './selector';
|
|
4
|
+
import { BackendMode, BoundingClientRect, ScrollOffset } from './backend/mode';
|
|
5
|
+
import { DataList, PropertyList, MethodList, ComponentInstance } from './component_params';
|
|
6
|
+
import { Node, GeneralBackendContext, GeneralBackendElement, ClassList, NativeNode, VirtualNode, ShadowRoot, ComponentDefinition, NodeCast } from '.';
|
|
7
|
+
/**
|
|
8
|
+
* The "style" attributes segments
|
|
9
|
+
*
|
|
10
|
+
* This allows different modules set the "style" attribute of an element
|
|
11
|
+
* without overriding each other.
|
|
12
|
+
* The final "style" attribute value is the concat of all segments.
|
|
13
|
+
* When calling `setNodeStyle` on an element,
|
|
14
|
+
* a segment can be specified.
|
|
15
|
+
*/
|
|
16
|
+
export declare const enum StyleSegmentIndex {
|
|
17
|
+
/** The main style segment, generally managed by the template engine */
|
|
18
|
+
MAIN = 0,
|
|
19
|
+
/** The template style segment, preserved for template engine */
|
|
20
|
+
TEMPLATE_EXTRA = 1,
|
|
21
|
+
/** The animation style segment, preserved for temporary transition */
|
|
22
|
+
ANIMATION_EXTRA = 2,
|
|
23
|
+
/** The temporary style segment, preserved for high priority styles */
|
|
24
|
+
TEMP_EXTRA = 3
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A general element
|
|
28
|
+
*
|
|
29
|
+
* An element can be a `NativeNode` , a `Component` , or a `VirtualNode` .
|
|
30
|
+
*/
|
|
31
|
+
export declare class Element implements NodeCast {
|
|
32
|
+
/** @internal */
|
|
33
|
+
private _$backendElement;
|
|
34
|
+
/** @internal */
|
|
35
|
+
_$destroyOnDetach: boolean;
|
|
36
|
+
/** @internal */
|
|
37
|
+
_$nodeTreeContext: GeneralBackendContext;
|
|
38
|
+
/** @internal */
|
|
39
|
+
private _$nodeId;
|
|
40
|
+
/** @internal */
|
|
41
|
+
private _$nodeAttributes;
|
|
42
|
+
/** @internal */
|
|
43
|
+
_$nodeSlot: string;
|
|
44
|
+
/** @internal */
|
|
45
|
+
_$slotName: string | null;
|
|
46
|
+
/** @internal */
|
|
47
|
+
_$slotValues: {
|
|
48
|
+
[name: string]: unknown;
|
|
49
|
+
} | null;
|
|
50
|
+
/** @internal */
|
|
51
|
+
_$nodeSlotElement: Element | null;
|
|
52
|
+
/** @internal */
|
|
53
|
+
private _$subtreeSlotCount;
|
|
54
|
+
/** @internal */
|
|
55
|
+
_$inheritSlots: boolean;
|
|
56
|
+
/** @internal */
|
|
57
|
+
_$placeholderHandler: (() => void) | undefined;
|
|
58
|
+
/** @internal */
|
|
59
|
+
private _$virtual;
|
|
60
|
+
dataset: {
|
|
61
|
+
[name: string]: unknown;
|
|
62
|
+
} | null;
|
|
63
|
+
/** @internal */
|
|
64
|
+
private _$marks;
|
|
65
|
+
/** @internal */
|
|
66
|
+
private _$attached;
|
|
67
|
+
/** The `ClassList` of the element (will never change and must not be modified!) */
|
|
68
|
+
classList: ClassList | null;
|
|
69
|
+
/** @internal */
|
|
70
|
+
private _$styleSegments;
|
|
71
|
+
/** The parent element (must not be modified directly!) */
|
|
72
|
+
parentNode: Element | null;
|
|
73
|
+
/** The child nodes (must not be modified directly!) */
|
|
74
|
+
childNodes: Node[];
|
|
75
|
+
/** The shadow-root which owns the element (will never change and must not be modified!) */
|
|
76
|
+
ownerShadowRoot: ShadowRoot | null;
|
|
77
|
+
/** @internal */
|
|
78
|
+
_$mutationObserverTarget: MutationObserverTarget | null;
|
|
79
|
+
/** @internal */
|
|
80
|
+
_$eventTarget: EventTarget<{
|
|
81
|
+
[name: string]: unknown;
|
|
82
|
+
}>;
|
|
83
|
+
constructor();
|
|
84
|
+
protected _$initialize(virtual: boolean, backendElement: GeneralBackendElement | null, owner: ShadowRoot | null, nodeTreeContext?: GeneralBackendContext): void;
|
|
85
|
+
get $$(): GeneralBackendElement | null;
|
|
86
|
+
get id(): string;
|
|
87
|
+
set id(x: unknown);
|
|
88
|
+
get slot(): string;
|
|
89
|
+
set slot(x: string);
|
|
90
|
+
get attributes(): {
|
|
91
|
+
name: string;
|
|
92
|
+
value: unknown;
|
|
93
|
+
}[];
|
|
94
|
+
get class(): string;
|
|
95
|
+
set class(classNames: string);
|
|
96
|
+
get style(): string;
|
|
97
|
+
set style(styleText: string);
|
|
98
|
+
asTextNode(): null;
|
|
99
|
+
asElement(): Element;
|
|
100
|
+
asNativeNode(): NativeNode | null;
|
|
101
|
+
asVirtualNode(): VirtualNode | null;
|
|
102
|
+
asInstanceOf<UData extends DataList, UProperty extends PropertyList, UMethod extends MethodList>(componentDefinition: ComponentDefinition<UData, UProperty, UMethod>): ComponentInstance<UData, UProperty, UMethod> | null;
|
|
103
|
+
/** Get the backend context */
|
|
104
|
+
getBackendContext(): GeneralBackendContext;
|
|
105
|
+
/** Get the backend mode */
|
|
106
|
+
getBackendMode(): BackendMode;
|
|
107
|
+
/** Get the backend element */
|
|
108
|
+
getBackendElement(): GeneralBackendElement | null;
|
|
109
|
+
/** Destroy the backend element */
|
|
110
|
+
destroyBackendElement(): void;
|
|
111
|
+
/** Destroy the backend element on next detach */
|
|
112
|
+
destroyBackendElementOnDetach(): void;
|
|
113
|
+
/** Get whether the node is virtual or not */
|
|
114
|
+
isVirtual(): boolean;
|
|
115
|
+
/** Set the node style */
|
|
116
|
+
setNodeStyle(styleSegment: string, index?: StyleSegmentIndex): void;
|
|
117
|
+
private static checkAndCallAttached;
|
|
118
|
+
private static checkAndCallDetached;
|
|
119
|
+
private static checkAndCallMoved;
|
|
120
|
+
private static checkChildObservers;
|
|
121
|
+
/**
|
|
122
|
+
* Get whether a node has any subtree `MutationObserver` attached to it
|
|
123
|
+
*
|
|
124
|
+
* If there is, then tree update may have more performance impact.
|
|
125
|
+
*/
|
|
126
|
+
static hasSubtreeMutationObservers(node: Element): boolean;
|
|
127
|
+
private static updateSlotCount;
|
|
128
|
+
/** @internal */
|
|
129
|
+
static _$insertChildReassignSlot(shadowRoot: ShadowRoot, name: string, oldSlot: Element | null, newSlot: Element | null): void;
|
|
130
|
+
private static insertChildReassignComposed;
|
|
131
|
+
private static findNearestNonVirtual;
|
|
132
|
+
private static countNonVirtual;
|
|
133
|
+
private static insertChildComposed;
|
|
134
|
+
private static insertChildSingleOperation;
|
|
135
|
+
private static insertChildBatchRemoval;
|
|
136
|
+
private static insertChildBatchInsertion;
|
|
137
|
+
private static insertChildPlaceholerReplace;
|
|
138
|
+
appendChild(child: Node): void;
|
|
139
|
+
insertChildAt(child: Node, index: number): void;
|
|
140
|
+
insertBefore(child: Node, before: Node): void;
|
|
141
|
+
removeChildAt(index: number): void;
|
|
142
|
+
removeChild(child: Node): void;
|
|
143
|
+
replaceChildAt(child: Node, index: number): void;
|
|
144
|
+
replaceChild(child: Node, relChild: Node): void;
|
|
145
|
+
insertChildren(children: Node[], index: number): void;
|
|
146
|
+
removeChildren(index: number, count: number): void;
|
|
147
|
+
selfReplaceWith(replaceWith: Element): void;
|
|
148
|
+
/** @internal */
|
|
149
|
+
protected static _$generateIdMap(node: ShadowRoot): {
|
|
150
|
+
[id: string]: Element;
|
|
151
|
+
};
|
|
152
|
+
/** Trigger an event on the element */
|
|
153
|
+
triggerEvent(name: string, detail?: unknown, options?: EventOptions): void;
|
|
154
|
+
/** Trigger an event with specified event object on the element */
|
|
155
|
+
dispatchEvent(ev: Event<unknown>): void;
|
|
156
|
+
private _$updateEventDefaultPrevented;
|
|
157
|
+
/** Add an event listener on the element */
|
|
158
|
+
addListener(name: string, func: EventListener<unknown>, options?: EventListenerOptions): void;
|
|
159
|
+
/** Remove an event listener on the element */
|
|
160
|
+
removeListener(name: string, func: EventListener<unknown>, options?: EventListenerOptions): void;
|
|
161
|
+
/** Get an attribute value ( `null` if not set or removed) */
|
|
162
|
+
getAttribute(name: string): unknown;
|
|
163
|
+
/** Update an attribute value */
|
|
164
|
+
updateAttribute(name: string, value: unknown): void;
|
|
165
|
+
/** Set an attribute value */
|
|
166
|
+
setAttribute(name: string, value: unknown): void;
|
|
167
|
+
/** Remove an attribute */
|
|
168
|
+
removeAttribute(name: string): void;
|
|
169
|
+
/** Set a mark on the element */
|
|
170
|
+
setMark(name: string, value: unknown): void;
|
|
171
|
+
/**
|
|
172
|
+
* Collect the marks on the element
|
|
173
|
+
*
|
|
174
|
+
* The marks includes the marks on ancestors (in shadow tree) of the element.
|
|
175
|
+
* If multiple marks on different elements shares the same name,
|
|
176
|
+
* the mark value on the child-most element is accepted.
|
|
177
|
+
*/
|
|
178
|
+
collectMarks(): {
|
|
179
|
+
[name: string]: unknown;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Attach the element into the backend, swapping out a placeholder element in the backend.
|
|
183
|
+
*
|
|
184
|
+
* The `element` must not be a child node of another element,
|
|
185
|
+
* must not be attached before,
|
|
186
|
+
* and must not have a `ownerShadowRoot` .
|
|
187
|
+
* The `element` `targetParent` and `targetNode` must be in the same backend context.
|
|
188
|
+
* The `element` replaces the `targetNode` in the `targetParent` .
|
|
189
|
+
*/
|
|
190
|
+
static replaceDocumentElement(element: Element, targetParent: GeneralBackendElement, targetNode: GeneralBackendElement): void;
|
|
191
|
+
/**
|
|
192
|
+
* Make the element looks like attached.
|
|
193
|
+
*
|
|
194
|
+
* If the element will never be attached to backend or it has no backend element at all,
|
|
195
|
+
* this can be used to trigger `attached` life-time.
|
|
196
|
+
*/
|
|
197
|
+
static pretendAttached(element: Element): void;
|
|
198
|
+
/**
|
|
199
|
+
* Make the element looks like detached.
|
|
200
|
+
*
|
|
201
|
+
* This can be used to trigger `detached` life-time without remove the element in the backend.
|
|
202
|
+
*/
|
|
203
|
+
static pretendDetached(element: Element): void;
|
|
204
|
+
/** Check the element is attached or not */
|
|
205
|
+
static isAttached(element: Element): boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Set the slot name of the element
|
|
208
|
+
*
|
|
209
|
+
* Once this method is called for an `element` ,
|
|
210
|
+
* it will be treated as a slot which can contain child nodes in composed tree.
|
|
211
|
+
* This method should not be used in components,
|
|
212
|
+
* otherwise the slot content will always be dangled.
|
|
213
|
+
*/
|
|
214
|
+
static setSlotName(element: Element, name?: string): void;
|
|
215
|
+
/**
|
|
216
|
+
* Get the slot name of the element
|
|
217
|
+
*/
|
|
218
|
+
static getSlotName(element: Element): string | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* Set the virtual node to slot-inherit mode
|
|
221
|
+
*
|
|
222
|
+
* In slot-inherit mode of an element,
|
|
223
|
+
* the child nodes of the element will be treated as siblings and can have different target slot.
|
|
224
|
+
*/
|
|
225
|
+
static setInheritSlots(element: VirtualNode): void;
|
|
226
|
+
/** Get whether the slot-inherit mode is set or not */
|
|
227
|
+
static getInheritSlots(element: Element): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Set the binding slot of specific node
|
|
230
|
+
*
|
|
231
|
+
* Necessary if node belongs to a dynamic slot, which cannot be identified by slot name.
|
|
232
|
+
*/
|
|
233
|
+
static setSlotElement(node: Node, slot: Element): void;
|
|
234
|
+
static getSlotElement(node: Node): Element | null | undefined;
|
|
235
|
+
/** Get composed parent (including virtual nodes) */
|
|
236
|
+
getComposedParent(): Element | null;
|
|
237
|
+
/**
|
|
238
|
+
* Get the composed children
|
|
239
|
+
*
|
|
240
|
+
* This method always returns a new array.
|
|
241
|
+
* It is convinient but less performant.
|
|
242
|
+
* For better performance, consider using `forEachComposedChild` .
|
|
243
|
+
*/
|
|
244
|
+
getComposedChildren(): Node[];
|
|
245
|
+
/**
|
|
246
|
+
* Iterate composed child nodes (including virtual nodes)
|
|
247
|
+
*
|
|
248
|
+
* if `f` returns `false` then the iteration is interrupted.
|
|
249
|
+
* Returns `true` if that happens.
|
|
250
|
+
*/
|
|
251
|
+
forEachComposedChild(f: (node: Node) => boolean | void): boolean;
|
|
252
|
+
/** Parse a selector string so that it can be used multiple queries */
|
|
253
|
+
static parseSelector(str: string): ParsedSelector;
|
|
254
|
+
/** Select the first descendant which matches the selector */
|
|
255
|
+
querySelector(selectorStr: string | ParsedSelector): Element | null;
|
|
256
|
+
/** Select all descendants which matches the selector */
|
|
257
|
+
querySelectorAll(selectorStr: string | ParsedSelector): Element[];
|
|
258
|
+
/** Test whether the target matches the selector */
|
|
259
|
+
static matchSelector(selectorStr: string | ParsedSelector, target: Element): boolean;
|
|
260
|
+
/** Test whether the target in this subtree matches the selector */
|
|
261
|
+
matchSelector(selectorStr: string | ParsedSelector, target: Element): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Get the bounding client rect
|
|
264
|
+
*
|
|
265
|
+
* Return zero values when the backend element is invalid or it does not have layout information.
|
|
266
|
+
*/
|
|
267
|
+
getBoundingClientRect(cb: (res: BoundingClientRect) => void): void;
|
|
268
|
+
/**
|
|
269
|
+
* Get the bounding client rect
|
|
270
|
+
*
|
|
271
|
+
* Return zero values when the backend element is invalid or it does not have layout information.
|
|
272
|
+
*/
|
|
273
|
+
getScrollOffset(cb: (res: ScrollOffset) => void): void;
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../src/element.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,sBAAsB,EACvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,KAAK,EACL,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,WAAW,EAEZ,MAAM,SAAS,CAAA;AAIhB,OAAO,EACL,cAAc,EACf,MAAM,YAAY,CAAA;AACnB,OAAO,EAEL,WAAW,EACX,kBAAkB,EAClB,YAAY,EACb,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAEL,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,EAClB,MAAM,oBAAoB,CA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ahC,oDAAoD;IACpD,iBAAiB,IAAI,OAAO,GAAG,IAAI;IAcnC;;;;;;OAMG;IACH,mBAAmB,IAAI,IAAI,EAAE;IAQ7B;;;;;OAKG;IACH,oBAAoB,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,GAAG,IAAI,GAAG,OAAO;IA6BhE,sEAAsE;IACtE,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc;IAIjD,6DAA6D;IAC7D,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,GAAG,IAAI;IAQnE,wDAAwD;IACxD,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,EAAE;IAQjE,mDAAmD;IACnD,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAOpF,mEAAmE;IACnE,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAO7E;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAAG,IAAI;IAwBlE;;;;OAIG;IACH,eAAe,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;CA4BvD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Node } from './node';
|
|
2
|
+
/** The iterator direction and order */
|
|
3
|
+
export declare const enum ElementIteratorType {
|
|
4
|
+
/** Iterate all ancestors in shadow tree */
|
|
5
|
+
ShadowAncestors = "shadow-ancestors",
|
|
6
|
+
/** Iterate all ancestors in composed tree */
|
|
7
|
+
ComposedAncestors = "composed-ancestors",
|
|
8
|
+
/** Iterate all descendants in shadow tree, returning parents before their children */
|
|
9
|
+
ShadowDescendantsRootFirst = "shadow-descendants-root-first",
|
|
10
|
+
/** Iterate all descendants in shadow tree, returning parents after their children */
|
|
11
|
+
ShadowDescendantsRootLast = "shadow-descendants-root-last",
|
|
12
|
+
/** Iterate all descendants in composed tree, returning parents before their children */
|
|
13
|
+
ComposedDescendantsRootFirst = "composed-descendants-root-first",
|
|
14
|
+
/** Iterate all descendants in composed tree, returning parents after their children */
|
|
15
|
+
ComposedDescendantsRootLast = "composed-descendants-root-last"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* An iterator for node tree traversal
|
|
19
|
+
*
|
|
20
|
+
* This iterator is convinient but seems a little slower.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ElementIterator {
|
|
23
|
+
private _$node;
|
|
24
|
+
private _$nodeTypeLimit;
|
|
25
|
+
private _$composed;
|
|
26
|
+
private _$isAncestor;
|
|
27
|
+
private _$rootFirst;
|
|
28
|
+
/**
|
|
29
|
+
* Create an iterator with type specified
|
|
30
|
+
*
|
|
31
|
+
* The `nodeTypeLimit` is used to limit which kind of nodes will be returned.
|
|
32
|
+
* It limits the returned result by an `instanceof` call.
|
|
33
|
+
* The default value is `Element` ,
|
|
34
|
+
* which means only elements will be returned (text nodes will not).
|
|
35
|
+
* Consider specifying `Node` if text nodes need to be returned as well as elements.
|
|
36
|
+
* Specify `Component` will only return components.
|
|
37
|
+
*/
|
|
38
|
+
constructor(node: Node, type: ElementIteratorType, nodeTypeLimit?: unknown);
|
|
39
|
+
/** Same as constructor (for backward compatibility) */
|
|
40
|
+
static create(node: Node, type: ElementIteratorType, nodeTypeLimit?: unknown): ElementIterator;
|
|
41
|
+
forEach(f: (node: Node) => boolean): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=element_iterator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element_iterator.d.ts","sourceRoot":"","sources":["../../../src/element_iterator.ts"],"names":[],"mappings":"AASA,OAAO,EACL,IAAI,EACL,MAAM,QAAQ,CAAA;AAEf,uCAAuC;AACvC,0BAAkB,mBAAmB;IACnC,2CAA2C;IAC3C,eAAe,qBAAqB;IACpC,6CAA6C;IAC7C,iBAAiB,uBAAuB;IACxC,sFAAsF;IACtF,0BAA0B,kCAAkC;IAC5D,qFAAqF;IACrF,yBAAyB,iCAAiC;IAC1D,wFAAwF;IACxF,4BAA4B,oCAAoC;IAChE,uFAAuF;IACvF,2BAA2B,mCAAmC;CAC/D;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAS;IAE5B;;;;;;;;;OASG;gBACS,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,mBAAmB,EAAE,aAAa,GAAE,OAAiB;IAuCnF,uDAAuD;IACvD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,mBAAmB,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,eAAe;IAI9F,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO;CA8DnC"}
|