@runopencode/rx-stencil 0.4.3 → 0.5.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/dist/cjs/{index-CbERigo8.js → index-DWhjpI-K.js} +396 -41
- package/dist/{esm/set-property-CpZKE-Xu.js → cjs/index-Dssn3hdS.js} +2 -61
- package/dist/cjs/index.cjs.js +280 -244
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mutation-observable-qY7nC854.js +152 -0
- package/dist/cjs/properties-observable-DXbVBslA.js +23 -0
- package/dist/cjs/property-observable-CPp5WEjC.js +86 -0
- package/dist/cjs/rx-async.cjs.entry.js +21 -14
- package/dist/cjs/rx-stencil.cjs.js +3 -3
- package/dist/cjs/schedule-render-DG4hFv5E.js +53 -0
- package/dist/cjs/set-property-C3KARzdl.js +33 -0
- package/dist/cjs/stencil-uD4ZIy1h.js +75 -0
- package/dist/cjs/test-properties-observable.cjs.entry.js +27 -0
- package/dist/cjs/test-property-observable.cjs.entry.js +31 -0
- package/dist/cjs/test-schedule-render.cjs.entry.js +28 -0
- package/dist/cjs/test-view-child-observable-shadow-dom.cjs.entry.js +40 -0
- package/dist/cjs/until-disconnected-BTCr-3q2.js +27 -0
- package/dist/collection/collection-manifest.json +9 -2
- package/dist/collection/components/async/async.js +42 -10
- package/dist/collection/components/index.js +1 -0
- package/dist/collection/rx/decorator/content-child.js +34 -0
- package/dist/collection/rx/decorator/content-children.js +34 -0
- package/dist/collection/rx/decorator/index.js +6 -2
- package/dist/collection/rx/decorator/query-selector-all.js +6 -38
- package/dist/collection/rx/decorator/query-selector.js +6 -51
- package/dist/collection/rx/decorator/view-child.js +34 -0
- package/dist/collection/rx/decorator/view-children.js +34 -0
- package/dist/collection/rx/index.js +1 -0
- package/dist/collection/rx/observable/connected-observable.js +27 -0
- package/dist/collection/rx/observable/content-child-observable.js +24 -0
- package/dist/collection/rx/observable/content-children-observable.js +15 -0
- package/dist/collection/rx/observable/from-event.js +26 -0
- package/dist/collection/rx/observable/index.js +9 -4
- package/dist/collection/rx/observable/mutation-observable.js +6 -0
- package/dist/collection/rx/observable/properties-observable.js +5 -0
- package/dist/collection/rx/observable/property-observable.js +72 -17
- package/dist/collection/rx/observable/render-observable.js +18 -9
- package/dist/collection/rx/observable/view-child-observable.js +30 -0
- package/dist/collection/rx/observable/view-children-observable.js +21 -0
- package/dist/collection/rx/operator/index.js +4 -3
- package/dist/collection/rx/operator/to-property.js +7 -7
- package/dist/collection/rx/operator/until-disconnected.js +12 -94
- package/dist/collection/rx/operator/while-connected.js +39 -0
- package/dist/collection/rx/subscriber/index.js +1 -1
- package/dist/collection/rx/subscriber/set-property.js +13 -0
- package/dist/collection/rx/types.js +1 -0
- package/dist/collection/tests/rx/observable/from-event/test-from-event.component.js +30 -0
- package/dist/collection/tests/rx/observable/properties-observable/test-properties-observable.component.js +85 -0
- package/dist/collection/tests/rx/observable/property-observable/test-property-observable.component.js +47 -0
- package/dist/collection/tests/rx/observable/render-observable.unit.js +38 -0
- package/dist/collection/tests/rx/observable/view-child-observable/test-view-child-observable-shadow-dom.component.js +96 -0
- package/dist/collection/tests/rx/operator/schedule-render/test-schedule-render.component.js +42 -0
- package/dist/collection/tests/rx/operator/to-property.unit.js +28 -0
- package/dist/collection/tests/rx/operator/until-disconnected.unit.js +25 -0
- package/dist/collection/tests/rx/operator/while-connected/test-while-connected.component.js +32 -0
- package/dist/collection/tests/rx/subscriber/set-property.unit.js +53 -0
- package/dist/collection/utils/decorator.js +33 -0
- package/dist/collection/utils/index.js +1 -1
- package/dist/collection/utils/rxjs.js +67 -0
- package/dist/collection/utils/stencil.js +66 -0
- package/dist/collection/utils/values-registry.js +40 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -0
- package/dist/components/mutation-observable.js +1 -0
- package/dist/components/properties-observable.js +1 -0
- package/dist/components/property-observable.js +1 -0
- package/dist/components/rx-async.js +1 -1
- package/dist/components/schedule-render.js +1 -0
- package/dist/components/set-property.js +1 -1
- package/dist/components/stencil.js +1 -0
- package/dist/components/test-properties-observable.d.ts +11 -0
- package/dist/components/test-properties-observable.js +1 -0
- package/dist/components/test-property-observable.d.ts +11 -0
- package/dist/components/test-property-observable.js +1 -0
- package/dist/components/test-schedule-render.d.ts +11 -0
- package/dist/components/test-schedule-render.js +1 -0
- package/dist/components/test-view-child-observable-shadow-dom.d.ts +11 -0
- package/dist/components/test-view-child-observable-shadow-dom.js +1 -0
- package/dist/components/until-disconnected.js +1 -0
- package/dist/esm/{index-BIBww8qU.js → index-BCGlW-2C.js} +396 -42
- package/dist/{cjs/set-property-BZHuI0P5.js → esm/index-Bn8mRT4P.js} +1 -67
- package/dist/esm/index.js +266 -240
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mutation-observable-xA7xgk29.js +145 -0
- package/dist/esm/properties-observable-Bzq-rZ4c.js +21 -0
- package/dist/esm/property-observable-BKyQe0OR.js +84 -0
- package/dist/esm/rx-async.entry.js +18 -11
- package/dist/esm/rx-stencil.js +4 -4
- package/dist/esm/schedule-render-BGCI5FMG.js +50 -0
- package/dist/esm/set-property-CgrvJ28c.js +31 -0
- package/dist/esm/stencil-BQCAKjCT.js +68 -0
- package/dist/esm/test-properties-observable.entry.js +25 -0
- package/dist/esm/test-property-observable.entry.js +29 -0
- package/dist/esm/test-schedule-render.entry.js +26 -0
- package/dist/esm/test-view-child-observable-shadow-dom.entry.js +38 -0
- package/dist/esm/until-disconnected-D2pF81SM.js +25 -0
- package/dist/rx-stencil/index.esm.js +1 -1
- package/dist/rx-stencil/p-7c570c65.entry.js +1 -0
- package/dist/rx-stencil/p-BCGlW-2C.js +3 -0
- package/dist/rx-stencil/p-BLLg2g3n.js +1 -0
- package/dist/rx-stencil/p-BQCAKjCT.js +1 -0
- package/dist/rx-stencil/p-Bn8mRT4P.js +1 -0
- package/dist/rx-stencil/p-D1zETqVV.js +1 -0
- package/dist/rx-stencil/p-DHIVm3-O.js +1 -0
- package/dist/rx-stencil/p-J0xLdrjW.js +1 -0
- package/dist/rx-stencil/p-Sf5sf4Pq.js +1 -0
- package/dist/rx-stencil/p-a4c71f45.entry.js +1 -0
- package/dist/rx-stencil/p-b2c6ba01.entry.js +1 -0
- package/dist/rx-stencil/p-dc654207.entry.js +1 -0
- package/dist/rx-stencil/p-e661490a.entry.js +1 -0
- package/dist/rx-stencil/p-wVeMJABH.js +1 -0
- package/dist/rx-stencil/rx-stencil.esm.js +1 -1
- package/dist/types/components/async/async.d.ts +9 -2
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components.d.ts +92 -2
- package/dist/types/rx/decorator/content-child.d.ts +3 -0
- package/dist/types/rx/decorator/content-children.d.ts +3 -0
- package/dist/types/rx/decorator/index.d.ts +6 -2
- package/dist/types/rx/decorator/query-selector-all.d.ts +7 -21
- package/dist/types/rx/decorator/query-selector.d.ts +7 -29
- package/dist/types/rx/decorator/view-child.d.ts +27 -0
- package/dist/types/rx/decorator/view-children.d.ts +11 -0
- package/dist/types/rx/index.d.ts +1 -0
- package/dist/types/rx/observable/connected-observable.d.ts +9 -0
- package/dist/types/rx/observable/content-child-observable.d.ts +5 -0
- package/dist/types/rx/observable/content-children-observable.d.ts +5 -0
- package/dist/types/rx/observable/from-event.d.ts +26 -0
- package/dist/types/rx/observable/index.d.ts +9 -4
- package/dist/types/rx/observable/mutation-observable.d.ts +6 -0
- package/dist/types/rx/observable/properties-observable.d.ts +5 -0
- package/dist/types/rx/observable/property-observable.d.ts +1 -1
- package/dist/types/rx/observable/render-observable.d.ts +6 -1
- package/dist/types/rx/observable/view-child-observable.d.ts +17 -0
- package/dist/types/rx/observable/view-children-observable.d.ts +5 -0
- package/dist/types/rx/operator/index.d.ts +4 -3
- package/dist/types/rx/operator/to-property.d.ts +1 -3
- package/dist/types/rx/operator/while-connected.d.ts +22 -0
- package/dist/types/rx/subscriber/index.d.ts +1 -1
- package/dist/types/rx/subscriber/set-property.d.ts +13 -0
- package/dist/types/rx/types.d.ts +12 -0
- package/dist/types/stencil-public-runtime.d.ts +74 -55
- package/dist/types/tests/rx/observable/properties-observable/test-properties-observable.component.d.ts +9 -0
- package/dist/types/tests/rx/observable/property-observable/test-property-observable.component.d.ts +8 -0
- package/dist/types/tests/rx/observable/render-observable.unit.d.ts +1 -0
- package/dist/types/tests/rx/observable/view-child-observable/test-view-child-observable-shadow-dom.component.d.ts +12 -0
- package/dist/types/tests/rx/operator/schedule-render/test-schedule-render.component.d.ts +7 -0
- package/dist/types/tests/rx/operator/to-property.unit.d.ts +1 -0
- package/dist/types/tests/rx/operator/until-disconnected.unit.d.ts +1 -0
- package/dist/types/tests/rx/subscriber/set-property.unit.d.ts +1 -0
- package/dist/types/utils/decorator.d.ts +11 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/rxjs.d.ts +31 -0
- package/dist/types/utils/stencil.d.ts +54 -0
- package/dist/types/utils/values-registry.d.ts +10 -0
- package/loader/index.d.ts +1 -1
- package/package.json +19 -10
- package/dist/collection/utils/get-property-descriptor.js +0 -17
- package/dist/rx-stencil/p-77100dee.entry.js +0 -1
- package/dist/rx-stencil/p-BIBww8qU.js +0 -2
- package/dist/rx-stencil/p-IbpJ_cRo.js +0 -1
- package/dist/types/utils/get-property-descriptor.d.ts +0 -7
|
@@ -5,15 +5,38 @@
|
|
|
5
5
|
* It contains typing information for all components that exist in this project.
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
-
import { AsyncValue } from "./components/async/async";
|
|
9
|
-
export { AsyncValue } from "./components/async/async";
|
|
8
|
+
import { AsyncValue, ValueTransformFn } from "./components/async/async";
|
|
9
|
+
export { AsyncValue, ValueTransformFn } from "./components/async/async";
|
|
10
10
|
export namespace Components {
|
|
11
11
|
interface RxAsync {
|
|
12
|
+
/**
|
|
13
|
+
* @default (value: unknown | null | undefined): any => value
|
|
14
|
+
*/
|
|
15
|
+
"transform": ValueTransformFn;
|
|
12
16
|
/**
|
|
13
17
|
* @default null
|
|
14
18
|
*/
|
|
15
19
|
"value": AsyncValue;
|
|
16
20
|
}
|
|
21
|
+
interface TestPropertiesObservable {
|
|
22
|
+
"bar": string;
|
|
23
|
+
"baz": string;
|
|
24
|
+
"foo": string;
|
|
25
|
+
}
|
|
26
|
+
interface TestPropertyObservable {
|
|
27
|
+
"setValue": (value: string) => Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
interface TestScheduleRender {
|
|
30
|
+
"increase": () => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
interface TestViewChildObservableShadowDom {
|
|
33
|
+
"clearLog": () => Promise<void>;
|
|
34
|
+
"getLog": () => Promise<string[]>;
|
|
35
|
+
/**
|
|
36
|
+
* @default 'all'
|
|
37
|
+
*/
|
|
38
|
+
"which": 'even' | 'odd' | 'all';
|
|
39
|
+
}
|
|
17
40
|
}
|
|
18
41
|
declare global {
|
|
19
42
|
interface HTMLRxAsyncElement extends Components.RxAsync, HTMLStencilElement {
|
|
@@ -22,19 +45,82 @@ declare global {
|
|
|
22
45
|
prototype: HTMLRxAsyncElement;
|
|
23
46
|
new (): HTMLRxAsyncElement;
|
|
24
47
|
};
|
|
48
|
+
interface HTMLTestPropertiesObservableElement extends Components.TestPropertiesObservable, HTMLStencilElement {
|
|
49
|
+
}
|
|
50
|
+
var HTMLTestPropertiesObservableElement: {
|
|
51
|
+
prototype: HTMLTestPropertiesObservableElement;
|
|
52
|
+
new (): HTMLTestPropertiesObservableElement;
|
|
53
|
+
};
|
|
54
|
+
interface HTMLTestPropertyObservableElement extends Components.TestPropertyObservable, HTMLStencilElement {
|
|
55
|
+
}
|
|
56
|
+
var HTMLTestPropertyObservableElement: {
|
|
57
|
+
prototype: HTMLTestPropertyObservableElement;
|
|
58
|
+
new (): HTMLTestPropertyObservableElement;
|
|
59
|
+
};
|
|
60
|
+
interface HTMLTestScheduleRenderElement extends Components.TestScheduleRender, HTMLStencilElement {
|
|
61
|
+
}
|
|
62
|
+
var HTMLTestScheduleRenderElement: {
|
|
63
|
+
prototype: HTMLTestScheduleRenderElement;
|
|
64
|
+
new (): HTMLTestScheduleRenderElement;
|
|
65
|
+
};
|
|
66
|
+
interface HTMLTestViewChildObservableShadowDomElement extends Components.TestViewChildObservableShadowDom, HTMLStencilElement {
|
|
67
|
+
}
|
|
68
|
+
var HTMLTestViewChildObservableShadowDomElement: {
|
|
69
|
+
prototype: HTMLTestViewChildObservableShadowDomElement;
|
|
70
|
+
new (): HTMLTestViewChildObservableShadowDomElement;
|
|
71
|
+
};
|
|
25
72
|
interface HTMLElementTagNameMap {
|
|
26
73
|
"rx-async": HTMLRxAsyncElement;
|
|
74
|
+
"test-properties-observable": HTMLTestPropertiesObservableElement;
|
|
75
|
+
"test-property-observable": HTMLTestPropertyObservableElement;
|
|
76
|
+
"test-schedule-render": HTMLTestScheduleRenderElement;
|
|
77
|
+
"test-view-child-observable-shadow-dom": HTMLTestViewChildObservableShadowDomElement;
|
|
27
78
|
}
|
|
28
79
|
}
|
|
29
80
|
declare namespace LocalJSX {
|
|
81
|
+
type OneOf<K extends string, PropT, AttrT = PropT> = { [P in K]: PropT } & { [P in `attr:${K}`]?: never } | { [P in `attr:${K}`]: AttrT } & { [P in K]?: never };
|
|
82
|
+
|
|
30
83
|
interface RxAsync {
|
|
84
|
+
/**
|
|
85
|
+
* @default (value: unknown | null | undefined): any => value
|
|
86
|
+
*/
|
|
87
|
+
"transform"?: ValueTransformFn;
|
|
31
88
|
/**
|
|
32
89
|
* @default null
|
|
33
90
|
*/
|
|
34
91
|
"value"?: AsyncValue;
|
|
35
92
|
}
|
|
93
|
+
interface TestPropertiesObservable {
|
|
94
|
+
"bar": string;
|
|
95
|
+
"baz": string;
|
|
96
|
+
"foo": string;
|
|
97
|
+
}
|
|
98
|
+
interface TestPropertyObservable {
|
|
99
|
+
}
|
|
100
|
+
interface TestScheduleRender {
|
|
101
|
+
}
|
|
102
|
+
interface TestViewChildObservableShadowDom {
|
|
103
|
+
/**
|
|
104
|
+
* @default 'all'
|
|
105
|
+
*/
|
|
106
|
+
"which"?: 'even' | 'odd' | 'all';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface TestPropertiesObservableAttributes {
|
|
110
|
+
"foo": string;
|
|
111
|
+
"bar": string;
|
|
112
|
+
"baz": string;
|
|
113
|
+
}
|
|
114
|
+
interface TestViewChildObservableShadowDomAttributes {
|
|
115
|
+
"which": 'even' | 'odd' | 'all';
|
|
116
|
+
}
|
|
117
|
+
|
|
36
118
|
interface IntrinsicElements {
|
|
37
119
|
"rx-async": RxAsync;
|
|
120
|
+
"test-properties-observable": Omit<TestPropertiesObservable, keyof TestPropertiesObservableAttributes> & { [K in keyof TestPropertiesObservable & keyof TestPropertiesObservableAttributes]?: TestPropertiesObservable[K] } & { [K in keyof TestPropertiesObservable & keyof TestPropertiesObservableAttributes as `attr:${K}`]?: TestPropertiesObservableAttributes[K] } & { [K in keyof TestPropertiesObservable & keyof TestPropertiesObservableAttributes as `prop:${K}`]?: TestPropertiesObservable[K] } & OneOf<"foo", TestPropertiesObservable["foo"], TestPropertiesObservableAttributes["foo"]> & OneOf<"bar", TestPropertiesObservable["bar"], TestPropertiesObservableAttributes["bar"]> & OneOf<"baz", TestPropertiesObservable["baz"], TestPropertiesObservableAttributes["baz"]>;
|
|
121
|
+
"test-property-observable": TestPropertyObservable;
|
|
122
|
+
"test-schedule-render": TestScheduleRender;
|
|
123
|
+
"test-view-child-observable-shadow-dom": Omit<TestViewChildObservableShadowDom, keyof TestViewChildObservableShadowDomAttributes> & { [K in keyof TestViewChildObservableShadowDom & keyof TestViewChildObservableShadowDomAttributes]?: TestViewChildObservableShadowDom[K] } & { [K in keyof TestViewChildObservableShadowDom & keyof TestViewChildObservableShadowDomAttributes as `attr:${K}`]?: TestViewChildObservableShadowDomAttributes[K] } & { [K in keyof TestViewChildObservableShadowDom & keyof TestViewChildObservableShadowDomAttributes as `prop:${K}`]?: TestViewChildObservableShadowDom[K] };
|
|
38
124
|
}
|
|
39
125
|
}
|
|
40
126
|
export { LocalJSX as JSX };
|
|
@@ -42,6 +128,10 @@ declare module "@stencil/core" {
|
|
|
42
128
|
export namespace JSX {
|
|
43
129
|
interface IntrinsicElements {
|
|
44
130
|
"rx-async": LocalJSX.IntrinsicElements["rx-async"] & JSXBase.HTMLAttributes<HTMLRxAsyncElement>;
|
|
131
|
+
"test-properties-observable": LocalJSX.IntrinsicElements["test-properties-observable"] & JSXBase.HTMLAttributes<HTMLTestPropertiesObservableElement>;
|
|
132
|
+
"test-property-observable": LocalJSX.IntrinsicElements["test-property-observable"] & JSXBase.HTMLAttributes<HTMLTestPropertyObservableElement>;
|
|
133
|
+
"test-schedule-render": LocalJSX.IntrinsicElements["test-schedule-render"] & JSXBase.HTMLAttributes<HTMLTestScheduleRenderElement>;
|
|
134
|
+
"test-view-child-observable-shadow-dom": LocalJSX.IntrinsicElements["test-view-child-observable-shadow-dom"] & JSXBase.HTMLAttributes<HTMLTestViewChildObservableShadowDomElement>;
|
|
45
135
|
}
|
|
46
136
|
}
|
|
47
137
|
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './content-child';
|
|
2
|
+
export * from './content-children';
|
|
3
|
+
export * from './query-selector';
|
|
4
|
+
export * from './query-selector-all';
|
|
5
|
+
export * from './view-child';
|
|
6
|
+
export * from './view-children';
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
shadowRoot?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* If `true`, mutation observer instead of `renderObservable` from this package will
|
|
11
|
-
* be used to detect changes. Default is `false`.
|
|
12
|
-
*/
|
|
13
|
-
mutationObserver?: boolean;
|
|
1
|
+
import { ContentChildrenOptions } from './content-children';
|
|
2
|
+
import { ViewChildrenOptions } from './view-children';
|
|
3
|
+
export type QuerySelectorAllOptions = ViewChildrenOptions & {
|
|
4
|
+
target?: 'view';
|
|
5
|
+
} | ContentChildrenOptions & {
|
|
6
|
+
target: 'content';
|
|
14
7
|
};
|
|
15
|
-
|
|
16
|
-
* Property decorator inspired by Angular's @ViewChild/@ContentChild.
|
|
17
|
-
*
|
|
18
|
-
* After each render, the decorated property will be set to the first element
|
|
19
|
-
* matching the given selector. If no element is found, the property will be
|
|
20
|
-
* set to null.
|
|
21
|
-
*/
|
|
22
|
-
export declare function QuerySelectorAll<T extends HTMLElement = HTMLElement>(selector: string, options?: QuerySelectorAllOptions): any;
|
|
8
|
+
export declare function QuerySelectorAll<E extends Element = Element>(selector: string, options?: QuerySelectorAllOptions): any;
|
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* If `true`, the element will be searched in the shadow root. Default is `false`.
|
|
8
|
-
*/
|
|
9
|
-
shadowRoot?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* If `true`, mutation observer instead of `renderObservable` from this package will
|
|
12
|
-
* be used to detect changes. Default is `false`.
|
|
13
|
-
*/
|
|
14
|
-
mutationObserver?: boolean;
|
|
1
|
+
import { ContentChildOptions } from './content-child';
|
|
2
|
+
import { ViewChildOptions } from './view-child';
|
|
3
|
+
export type QuerySelectorOptions = ViewChildOptions & {
|
|
4
|
+
target?: 'view';
|
|
5
|
+
} | ContentChildOptions & {
|
|
6
|
+
target: 'content';
|
|
15
7
|
};
|
|
16
|
-
|
|
17
|
-
* Observe all sub nodes of the given node and notify
|
|
18
|
-
* when any of them is removed and/or added.
|
|
19
|
-
*
|
|
20
|
-
* {@internal}
|
|
21
|
-
*/
|
|
22
|
-
export declare function observeSubNodes(target: Node): Observable<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Property decorator inspired by Angular's @ViewChild/@ContentChild.
|
|
25
|
-
*
|
|
26
|
-
* After each render, the decorated property will be set to the first element
|
|
27
|
-
* matching the given selector. If no element is found, the property will be
|
|
28
|
-
* set to null.
|
|
29
|
-
*/
|
|
30
|
-
export declare function QuerySelector<T extends HTMLElement = HTMLElement>(selector: string, options?: QuerySelectorOptions): any;
|
|
8
|
+
export declare function QuerySelector<E extends Element = Element>(selector: string, options?: QuerySelectorOptions): any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ViewChildObservableOptions } from '../observable/view-child-observable';
|
|
2
|
+
import { ElementFilterFn } from '../types';
|
|
3
|
+
export type ViewChildOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* If true, the property value will be cached and will not be updated when DOM changes.
|
|
6
|
+
*
|
|
7
|
+
* Default is false.
|
|
8
|
+
*/
|
|
9
|
+
cached?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* If true, the property will be updated only when the element is present in the DOM.
|
|
12
|
+
*
|
|
13
|
+
* Default is false.
|
|
14
|
+
*/
|
|
15
|
+
filter?: boolean | ElementFilterFn;
|
|
16
|
+
/**
|
|
17
|
+
* If true, property will be updated only when component is connected to the DOM. If false,
|
|
18
|
+
* property will be updated even if component is not connected to the DOM.
|
|
19
|
+
*
|
|
20
|
+
* This can be useful for cases where you want to move components in and out of the DOM, but
|
|
21
|
+
* you want to react only while component is connected to the DOM.
|
|
22
|
+
*
|
|
23
|
+
* Default is false.
|
|
24
|
+
*/
|
|
25
|
+
whileConnected?: boolean;
|
|
26
|
+
} & ViewChildObservableOptions;
|
|
27
|
+
export declare function ViewChild<E extends Element = Element>(selector: string, options?: ViewChildOptions): any;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ElementsFilterFn } from '../types';
|
|
2
|
+
import { ViewChildOptions } from './view-child';
|
|
3
|
+
export type ViewChildrenOptions = Omit<ViewChildOptions, 'filter'> & {
|
|
4
|
+
/**
|
|
5
|
+
* If true, the property will be updated only when the elements are present in the DOM.
|
|
6
|
+
*
|
|
7
|
+
* Default is false.
|
|
8
|
+
*/
|
|
9
|
+
filter?: boolean | ElementsFilterFn;
|
|
10
|
+
};
|
|
11
|
+
export declare function ViewChildren<E extends Element = Element>(selector: string, options?: ViewChildrenOptions): any;
|
package/dist/types/rx/index.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentInterface } from '../../stencil-public-runtime';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
/**
|
|
4
|
+
* Returns an observable that emits `true` when the component is connected to DOM,
|
|
5
|
+
* and `false` when it is disconnected from DOM.
|
|
6
|
+
*
|
|
7
|
+
* Uses hot observable pattern.
|
|
8
|
+
*/
|
|
9
|
+
export declare function connectedObservable(cmp: ComponentInterface): Observable<boolean>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentInterface } from '../../stencil-public-runtime';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ViewChildObservableOptions } from './view-child-observable';
|
|
4
|
+
export type ContentChildObservableOptions = ViewChildObservableOptions;
|
|
5
|
+
export declare function contentChildObservable<E extends Element = Element>(cmp: ComponentInterface, selector: string, options?: ContentChildObservableOptions): Observable<E | null>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentInterface } from '../../stencil-public-runtime';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ViewChildrenObservableOptions } from './view-children-observable';
|
|
4
|
+
export type ContentChildrenObservableOptions = ViewChildrenObservableOptions;
|
|
5
|
+
export declare function contentChildrenObservable<E extends Element = Element>(cmp: ComponentInterface, selector: string, options?: ContentChildrenObservableOptions): Observable<E[]>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentInterface } from '../../stencil-public-runtime';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
export type EventHandlerOptions = {
|
|
4
|
+
capture?: boolean;
|
|
5
|
+
passive?: boolean;
|
|
6
|
+
once?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Create an observable that emits events from a Stencil component.
|
|
10
|
+
*
|
|
11
|
+
* @param {ComponentInterface} cmp The Stencil component to listen for events on.
|
|
12
|
+
* @param {string} eventName The name of the event to listen for.
|
|
13
|
+
* @param {string} [delegate] An optional CSS selector to delegate the event to.
|
|
14
|
+
* @param {EventHandlerOptions} [options] An optional object that specifies event listener options.
|
|
15
|
+
* @returns {Observable<Event>} An observable that emits events of type T.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fromEvent<T extends Event = Event>(cmp: ComponentInterface, eventName: string, delegate?: string, options?: EventHandlerOptions): Observable<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Create an observable that emits events from a Stencil component.
|
|
20
|
+
*
|
|
21
|
+
* @param {ComponentInterface} cmp The Stencil component to listen for events on.
|
|
22
|
+
* @param {string} eventName The name of the event to listen for.
|
|
23
|
+
* @param {EventHandlerOptions} [options] An optional object that specifies event listener options.
|
|
24
|
+
* @returns {Observable<Event>} An observable that emits events of type T.
|
|
25
|
+
*/
|
|
26
|
+
export declare function fromEvent<T extends Event = Event>(cmp: ComponentInterface, eventName: string, options?: EventHandlerOptions): Observable<T>;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from './content-child-observable';
|
|
2
|
+
export * from './content-children-observable';
|
|
3
|
+
export * from './from-event';
|
|
4
|
+
export * from './mutation-observable';
|
|
5
|
+
export * from './properties-observable';
|
|
6
|
+
export * from './property-observable';
|
|
7
|
+
export * from './render-observable';
|
|
8
|
+
export * from './view-child-observable';
|
|
9
|
+
export * from './view-children-observable';
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* Create mutation observer and return observable that emits mutation records when the target node is mutated.
|
|
4
|
+
*
|
|
5
|
+
* @param {Node} target The target node to observe for mutations.
|
|
6
|
+
* @param {MutationObserverInit} options The options for the mutation observer.
|
|
7
|
+
*/
|
|
2
8
|
export declare function mutationObservable(target: Node, options?: MutationObserverInit): Observable<MutationRecord[]>;
|
|
@@ -2,5 +2,10 @@ import { ComponentInterface } from '../../stencil-public-runtime';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
/**
|
|
4
4
|
* Returns an observable that emits an array of values from the given properties.
|
|
5
|
+
*
|
|
6
|
+
* It always emits an array of values, even if only one property is specified. The order
|
|
7
|
+
* of the values in the emitted array corresponds to the order of the properties specified.
|
|
8
|
+
*
|
|
9
|
+
* Do note that `combineLatest()` operator is used to combine the observables.
|
|
5
10
|
*/
|
|
6
11
|
export declare function propertiesObservable<T extends any[]>(cmp: ComponentInterface, ...properties: string[]): Observable<T>;
|
|
@@ -3,4 +3,4 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns an observable that emits property value when the component property value changes.
|
|
5
5
|
*/
|
|
6
|
-
export declare function propertyObservable<T = any>(cmp: ComponentInterface, property: string): Observable<T>;
|
|
6
|
+
export declare function propertyObservable<T = any>(cmp: ComponentInterface, property: string): Observable<T | undefined>;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { ComponentInterface } from '../../stencil-public-runtime';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
/**
|
|
4
|
-
* Returns an observable that emits when the component render()
|
|
4
|
+
* Returns an observable that emits when the component `render()`
|
|
5
5
|
* function is called. Value will be emitted after the next
|
|
6
6
|
* microtask (next tick).
|
|
7
|
+
*
|
|
8
|
+
* If component is already rendered, the observable will emit
|
|
9
|
+
* immediately.
|
|
10
|
+
*
|
|
11
|
+
* Uses hot observable pattern.
|
|
7
12
|
*/
|
|
8
13
|
export declare function renderObservable(cmp: ComponentInterface): Observable<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentInterface } from '../../stencil-public-runtime';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ElementComparatorFn } from '../types';
|
|
4
|
+
export type ViewChildObservableOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* If true, the observable will only emit when the element changes. If false, the observable will emit every time
|
|
7
|
+
* the component is rendered.
|
|
8
|
+
*
|
|
9
|
+
* You can also provide a custom comparator function to determine if the element has changed. The function should
|
|
10
|
+
* return true if the elements are equal, and false if they are not. If you set value to true, the default
|
|
11
|
+
* comparator function will be used, which compares the elements by reference.
|
|
12
|
+
*
|
|
13
|
+
* Default is true.
|
|
14
|
+
*/
|
|
15
|
+
distinct?: ElementComparatorFn | boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function viewChildObservable<E extends Element = Element>(cmp: ComponentInterface, selector: string, options?: ViewChildObservableOptions): Observable<E | null>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentInterface } from '../../stencil-public-runtime';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ViewChildObservableOptions } from './view-child-observable';
|
|
4
|
+
export type ViewChildrenObservableOptions = ViewChildObservableOptions;
|
|
5
|
+
export declare function viewChildrenObservable<E extends Element = Element>(cmp: ComponentInterface, selector: string, options?: ViewChildrenObservableOptions): Observable<E[]>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from './schedule-render';
|
|
2
|
+
export * from './to-property';
|
|
3
|
+
export * from './until-disconnected';
|
|
4
|
+
export * from './while-connected';
|
|
@@ -2,8 +2,6 @@ import { ComponentInterface } from '../../stencil-public-runtime';
|
|
|
2
2
|
import { MonoTypeOperatorFunction } from 'rxjs';
|
|
3
3
|
/**
|
|
4
4
|
* Use this function to tap into a value stream and flush value to
|
|
5
|
-
* component property.
|
|
6
|
-
* function (function will detect that value is passed instead of
|
|
7
|
-
* observable).
|
|
5
|
+
* component property.
|
|
8
6
|
*/
|
|
9
7
|
export declare function toProperty<T = any>(cmp: ComponentInterface, property: string): MonoTypeOperatorFunction<T>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentInterface } from '../../stencil-public-runtime';
|
|
2
|
+
import { MonoTypeOperatorFunction } from 'rxjs';
|
|
3
|
+
export type WhileConnectedOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* If true, the operator will re-emit the last value received from the source observable while component
|
|
6
|
+
* was disconnected, when the component is re-connected to DOM. This is useful for cases where the
|
|
7
|
+
* component may be disconnected and re-connected multiple times, and you want to ensure that the last
|
|
8
|
+
* emitted value is still available when the component is re-connected.
|
|
9
|
+
*
|
|
10
|
+
* Default is false.
|
|
11
|
+
*/
|
|
12
|
+
reemit?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Operator that emits values from the source observable only
|
|
16
|
+
* while the component is connected to DOM.
|
|
17
|
+
*
|
|
18
|
+
* This can be useful for cases where you want to move components in and out of the DOM,
|
|
19
|
+
* but still want to receive values from an observable while the component is connected
|
|
20
|
+
* and react to them.
|
|
21
|
+
*/
|
|
22
|
+
export declare function whileConnected<T = unknown>(cmp: ComponentInterface, options?: WhileConnectedOptions): MonoTypeOperatorFunction<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './set-property';
|
|
@@ -13,4 +13,17 @@ export type SetPropertyOptions = {
|
|
|
13
13
|
*/
|
|
14
14
|
nextTick?: boolean;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Set a property on a Stencil component and optionally schedule a render.
|
|
18
|
+
*
|
|
19
|
+
* This function returns a setter function that can be used to update the property value. Common use case
|
|
20
|
+
* is to set it as subscriber to an observable, so that the property is updated whenever the observable
|
|
21
|
+
* emits a new value.
|
|
22
|
+
*
|
|
23
|
+
* @param {ComponentInterface} cmp Component instance on which the property is to be set.
|
|
24
|
+
* @param {string} property Name of the property to be set on the component.
|
|
25
|
+
* @param {SetPropertyOptions} options Options to control the behavior of the property setter,
|
|
26
|
+
* such as whether to schedule a render and whether to do
|
|
27
|
+
* it on the next tick.
|
|
28
|
+
*/
|
|
16
29
|
export declare function setProperty<T = any>(cmp: ComponentInterface, property: string, options?: SetPropertyOptions): (value: T) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A function that compares two elements and returns true if they are equal, and false if they are not.
|
|
3
|
+
*/
|
|
4
|
+
export type ElementComparatorFn<E extends Element = Element> = (previous: E | null, current: E | null) => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* A function that filters elements.
|
|
7
|
+
*/
|
|
8
|
+
export type ElementFilterFn<E extends Element = Element> = (element: E | null) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* A function that filters collection of elements.
|
|
11
|
+
*/
|
|
12
|
+
export type ElementsFilterFn<E extends Element = Element> = (elements: E[]) => boolean;
|