typecomposer 0.1.43 → 0.1.44
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/core/components/DialogPanel.d.ts +2 -2
- package/core/components/DialogPanel.js +7 -7
- package/core/components/DialogPanel.js.map +1 -1
- package/core/ref/RefBoolean.d.ts +69 -0
- package/core/ref/RefBoolean.js +64 -0
- package/core/ref/RefBoolean.js.map +1 -1
- package/core/ref/RefContainer.d.ts +1 -0
- package/core/ref/RefContainer.js +3 -0
- package/core/ref/RefContainer.js.map +1 -1
- package/core/ref/RefList.d.ts +81 -9
- package/core/ref/RefList.js +80 -12
- package/core/ref/RefList.js.map +1 -1
- package/core/ref/RefMap.d.ts +79 -0
- package/core/ref/RefMap.js +78 -1
- package/core/ref/RefMap.js.map +1 -1
- package/core/ref/RefNumber.d.ts +101 -8
- package/core/ref/RefNumber.js +116 -25
- package/core/ref/RefNumber.js.map +1 -1
- package/core/ref/RefObject.d.ts +92 -1
- package/core/ref/RefObject.js +39 -8
- package/core/ref/RefObject.js.map +1 -1
- package/core/ref/RefSet.d.ts +78 -0
- package/core/ref/RefSet.js +77 -1
- package/core/ref/RefSet.js.map +1 -1
- package/core/ref/RefState.d.ts +1 -0
- package/core/ref/RefState.js +3 -0
- package/core/ref/RefState.js.map +1 -1
- package/core/ref/RefString.d.ts +116 -40
- package/core/ref/RefString.js +141 -159
- package/core/ref/RefString.js.map +1 -1
- package/core/ref/index.d.ts +0 -1
- package/core/ref/index.js +0 -2
- package/core/ref/index.js.map +1 -1
- package/global/index.js +115 -121
- package/global/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ComponentProps, DialogElement } from "../..";
|
|
2
|
-
export declare class DialogPanel extends DialogElement {
|
|
2
|
+
export declare class DialogPanel extends DialogElement implements IComponent {
|
|
3
3
|
#private;
|
|
4
4
|
clickOutsideToClose: boolean;
|
|
5
|
-
constructor(props
|
|
5
|
+
constructor(props?: {
|
|
6
6
|
show?: boolean | "modal" | "popover" | "show";
|
|
7
7
|
clickOutsideToClose?: boolean;
|
|
8
8
|
root?: HTMLElement | "body";
|
|
@@ -4,6 +4,7 @@ export class DialogPanel extends DialogElement {
|
|
|
4
4
|
#initShow = false;
|
|
5
5
|
constructor(props) {
|
|
6
6
|
super();
|
|
7
|
+
props = props || {};
|
|
7
8
|
this.close();
|
|
8
9
|
this.addEventListener("click", (event) => {
|
|
9
10
|
const rect = this.getBoundingClientRect();
|
|
@@ -22,16 +23,15 @@ export class DialogPanel extends DialogElement {
|
|
|
22
23
|
this.addEventListener("close", () => {
|
|
23
24
|
this.onClose(this.returnValue);
|
|
24
25
|
});
|
|
25
|
-
this.variant = props.variant || "default";
|
|
26
26
|
if (props?.clickOutsideToClose !== undefined)
|
|
27
27
|
this.clickOutsideToClose = props.clickOutsideToClose;
|
|
28
28
|
// @ts-ignore
|
|
29
|
-
if (props
|
|
29
|
+
if (props?.content)
|
|
30
30
|
this.content = props.content;
|
|
31
|
-
delete props
|
|
32
|
-
delete props
|
|
33
|
-
this.#initShow = props
|
|
34
|
-
delete props
|
|
31
|
+
delete props?.variant;
|
|
32
|
+
delete props?.content;
|
|
33
|
+
this.#initShow = props?.show || false;
|
|
34
|
+
delete props?.show;
|
|
35
35
|
this.addEventListener("onConnected", () => {
|
|
36
36
|
if (this.#initShow == true || this.#initShow == "modal")
|
|
37
37
|
this.showModal();
|
|
@@ -44,7 +44,7 @@ export class DialogPanel extends DialogElement {
|
|
|
44
44
|
document.body.appendChild(this);
|
|
45
45
|
else if (props.root)
|
|
46
46
|
props.root.appendChild(this);
|
|
47
|
-
delete props
|
|
47
|
+
delete props?.root;
|
|
48
48
|
Component.applyProps(this, props);
|
|
49
49
|
}
|
|
50
50
|
showModal() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogPanel.js","sourceRoot":"","sources":["../../../src/core/components/DialogPanel.ts"],"names":[],"mappings":"AAAA,OAAO,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,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,KAAK,CAAC,WAAW,EAAE,CAAC;IACtB,CAAC;IAED,MAAM,KAAW,CAAC;IAElB,OAAO,CAAC,WAAoB,IAAI,CAAC;CAClC;AAED,YAAY,CAAC,aAAa,CAAC,cAAc,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC"}
|
package/core/ref/RefBoolean.d.ts
CHANGED
|
@@ -1,26 +1,95 @@
|
|
|
1
1
|
import { ref } from ".";
|
|
2
2
|
import { RefContainer } from "./RefContainer";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new reactive boolean reference.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The initial boolean value.
|
|
7
|
+
* @returns A new instance of RefBoolean.
|
|
8
|
+
*/
|
|
3
9
|
export declare function refBoolean(value: boolean): RefBoolean;
|
|
10
|
+
/**
|
|
11
|
+
* Union type for accepting both primitive booleans and RefBoolean instances.
|
|
12
|
+
*/
|
|
4
13
|
export type refBoolean = boolean | RefBoolean;
|
|
14
|
+
/**
|
|
15
|
+
* Reactive wrapper for a boolean value, supporting subscriptions and reactivity.
|
|
16
|
+
*/
|
|
5
17
|
export declare class RefBoolean implements Boolean, ref<boolean> {
|
|
18
|
+
/**
|
|
19
|
+
* Internal container that manages subscribers and the current value.
|
|
20
|
+
*/
|
|
6
21
|
readonly container: RefContainer;
|
|
22
|
+
/**
|
|
23
|
+
* A unique key identifying this reactive reference (optional).
|
|
24
|
+
*/
|
|
7
25
|
readonly refKey: string;
|
|
26
|
+
/**
|
|
27
|
+
* Constructs a reactive boolean wrapper.
|
|
28
|
+
*
|
|
29
|
+
* @param value - The initial boolean value.
|
|
30
|
+
* @param refKey - Optional key used for registration in a central Ref registry.
|
|
31
|
+
*/
|
|
8
32
|
constructor(value: boolean, refKey?: string);
|
|
33
|
+
/**
|
|
34
|
+
* Emits a change if the new value differs from the current value.
|
|
35
|
+
*
|
|
36
|
+
* @param propertyName - The property being updated (typically "value").
|
|
37
|
+
* @param value - The new value being set.
|
|
38
|
+
*/
|
|
9
39
|
private emit;
|
|
40
|
+
/**
|
|
41
|
+
* Subscribes to value changes and immediately emits the current value.
|
|
42
|
+
*/
|
|
10
43
|
subscribe(target: (arg: boolean) => void): boolean;
|
|
11
44
|
subscribe(target: (arg: boolean) => void, onUnsubscribe: Function): boolean;
|
|
12
45
|
subscribe(target: object, propertyName: string | symbol): boolean;
|
|
13
46
|
subscribe(target: object, propertyName: string | symbol, onUnsubscribe: Function): boolean;
|
|
14
47
|
subscribe(target: object | ((arg: boolean) => void), propertyName: string | symbol | Function, onUnsubscribe?: Function): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Subscribes to value changes without emitting the current value.
|
|
50
|
+
*
|
|
51
|
+
* @param target - Callback function to be invoked on future value changes.
|
|
52
|
+
* @param onUnsubscribe - Optional callback to be invoked when unsubscribed.
|
|
53
|
+
* @returns true if subscription was successful.
|
|
54
|
+
*/
|
|
55
|
+
listen(target: (arg: boolean) => void, onUnsubscribe?: Function): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Unsubscribes a function or object-property pair from receiving value changes.
|
|
58
|
+
*/
|
|
15
59
|
unsubscribe(target: (arg: boolean) => void): boolean;
|
|
16
60
|
unsubscribe(target: object, propertyName: string | symbol): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Provides primitive conversion support for the boolean wrapper.
|
|
63
|
+
*
|
|
64
|
+
* @param hint - The conversion context ("default", "number", "string", etc.)
|
|
65
|
+
* @returns The primitive boolean value.
|
|
66
|
+
*/
|
|
17
67
|
[Symbol.toPrimitive](hint: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Specifies the primitive type associated with this object.
|
|
70
|
+
*/
|
|
18
71
|
static get [Symbol.species](): BooleanConstructor;
|
|
72
|
+
/**
|
|
73
|
+
* Gets the current boolean value.
|
|
74
|
+
*/
|
|
19
75
|
get value(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Sets a new boolean value and notifies subscribers if changed.
|
|
78
|
+
*/
|
|
20
79
|
set value(value: boolean);
|
|
80
|
+
/**
|
|
81
|
+
* Returns the primitive boolean value.
|
|
82
|
+
*/
|
|
21
83
|
valueOf(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Returns a JSON-serializable representation of this boolean.
|
|
86
|
+
* If this is a root ref, only the value is returned. Otherwise, a wrapped object is returned.
|
|
87
|
+
*/
|
|
22
88
|
toJSON(): boolean | {
|
|
23
89
|
value: boolean;
|
|
24
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* Returns a string representation of the current value.
|
|
93
|
+
*/
|
|
25
94
|
toString(): string;
|
|
26
95
|
}
|
package/core/ref/RefBoolean.js
CHANGED
|
@@ -1,22 +1,51 @@
|
|
|
1
1
|
import { Ref } from ".";
|
|
2
2
|
import { RefContainer } from "./RefContainer";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new reactive boolean reference.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The initial boolean value.
|
|
7
|
+
* @returns A new instance of RefBoolean.
|
|
8
|
+
*/
|
|
3
9
|
export function refBoolean(value) {
|
|
4
10
|
return new RefBoolean(value);
|
|
5
11
|
}
|
|
12
|
+
// Customizes instanceof behavior for type checking
|
|
6
13
|
Object.defineProperty(refBoolean, Symbol.hasInstance, {
|
|
7
14
|
value: function (instance) {
|
|
8
15
|
return !!instance && instance instanceof RefBoolean;
|
|
9
16
|
},
|
|
10
17
|
});
|
|
18
|
+
/**
|
|
19
|
+
* Reactive wrapper for a boolean value, supporting subscriptions and reactivity.
|
|
20
|
+
*/
|
|
11
21
|
export class RefBoolean {
|
|
22
|
+
/**
|
|
23
|
+
* Internal container that manages subscribers and the current value.
|
|
24
|
+
*/
|
|
12
25
|
container;
|
|
26
|
+
/**
|
|
27
|
+
* A unique key identifying this reactive reference (optional).
|
|
28
|
+
*/
|
|
13
29
|
refKey;
|
|
30
|
+
/**
|
|
31
|
+
* Constructs a reactive boolean wrapper.
|
|
32
|
+
*
|
|
33
|
+
* @param value - The initial boolean value.
|
|
34
|
+
* @param refKey - Optional key used for registration in a central Ref registry.
|
|
35
|
+
*/
|
|
14
36
|
constructor(value, refKey) {
|
|
15
37
|
this.refKey = refKey;
|
|
16
38
|
this.container = new RefContainer(value);
|
|
39
|
+
// Registers in Ref registry if key is provided
|
|
17
40
|
// @ts-ignore
|
|
18
41
|
refKey && Ref.set(refKey, this);
|
|
19
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Emits a change if the new value differs from the current value.
|
|
45
|
+
*
|
|
46
|
+
* @param propertyName - The property being updated (typically "value").
|
|
47
|
+
* @param value - The new value being set.
|
|
48
|
+
*/
|
|
20
49
|
// @ts-ignore
|
|
21
50
|
emit(propertyName, value) {
|
|
22
51
|
if (this.value === value)
|
|
@@ -26,31 +55,66 @@ export class RefBoolean {
|
|
|
26
55
|
subscribe(target, propertyName, onUnsubscribe) {
|
|
27
56
|
return this.container.emit(this.container.subscribe(target, propertyName, onUnsubscribe), this.value);
|
|
28
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Subscribes to value changes without emitting the current value.
|
|
60
|
+
*
|
|
61
|
+
* @param target - Callback function to be invoked on future value changes.
|
|
62
|
+
* @param onUnsubscribe - Optional callback to be invoked when unsubscribed.
|
|
63
|
+
* @returns true if subscription was successful.
|
|
64
|
+
*/
|
|
65
|
+
listen(target, onUnsubscribe) {
|
|
66
|
+
return this.container.subscribe(target, onUnsubscribe) !== undefined;
|
|
67
|
+
}
|
|
29
68
|
unsubscribe(targe, propertyName = "") {
|
|
30
69
|
return this.container.unsubscribe(targe, propertyName);
|
|
31
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Provides primitive conversion support for the boolean wrapper.
|
|
73
|
+
*
|
|
74
|
+
* @param hint - The conversion context ("default", "number", "string", etc.)
|
|
75
|
+
* @returns The primitive boolean value.
|
|
76
|
+
*/
|
|
32
77
|
[Symbol.toPrimitive](hint) {
|
|
33
78
|
if (hint === "boolean" || hint === "default") {
|
|
34
79
|
return this.value;
|
|
35
80
|
}
|
|
36
81
|
return this.valueOf();
|
|
37
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Specifies the primitive type associated with this object.
|
|
85
|
+
*/
|
|
38
86
|
static get [Symbol.species]() {
|
|
39
87
|
return Boolean;
|
|
40
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Gets the current boolean value.
|
|
91
|
+
*/
|
|
41
92
|
get value() {
|
|
42
93
|
return this.container.value.valueOf();
|
|
43
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Sets a new boolean value and notifies subscribers if changed.
|
|
97
|
+
*/
|
|
44
98
|
set value(value) {
|
|
45
99
|
this.emit("value", value);
|
|
46
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Returns the primitive boolean value.
|
|
103
|
+
*/
|
|
47
104
|
valueOf() {
|
|
48
105
|
return this.value.valueOf();
|
|
49
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Returns a JSON-serializable representation of this boolean.
|
|
109
|
+
* If this is a root ref, only the value is returned. Otherwise, a wrapped object is returned.
|
|
110
|
+
*/
|
|
50
111
|
// @ts-ignore
|
|
51
112
|
toJSON() {
|
|
52
113
|
return this.container.root ? this.value : { value: this.value };
|
|
53
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Returns a string representation of the current value.
|
|
117
|
+
*/
|
|
54
118
|
toString() {
|
|
55
119
|
return this.container.toString();
|
|
56
120
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefBoolean.js","sourceRoot":"","sources":["../../../src/core/ref/RefBoolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAO,MAAM,GAAG,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,cAAc,CAAC,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a;IACb,MAAM;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -17,6 +17,7 @@ export declare class RefContainer {
|
|
|
17
17
|
index: number;
|
|
18
18
|
};
|
|
19
19
|
subscribe(target: any, propertyName: any, onUnsubscribe?: any): IRefSubscriber;
|
|
20
|
+
listen(target: (arg: any) => void, onUnsubscribe?: Function): IRefSubscriber;
|
|
20
21
|
unsubscribe(target: object | Function, propertyName: string | symbol): boolean;
|
|
21
22
|
[Symbol.toPrimitive](hint: string): string;
|
|
22
23
|
toString(): string;
|
package/core/ref/RefContainer.js
CHANGED
|
@@ -68,6 +68,9 @@ export class RefContainer {
|
|
|
68
68
|
Ref.subscribe(target, typeof propertyName === "string" ? propertyName : "", this);
|
|
69
69
|
return subscriber;
|
|
70
70
|
}
|
|
71
|
+
listen(target, onUnsubscribe) {
|
|
72
|
+
return this.subscribe(target, onUnsubscribe);
|
|
73
|
+
}
|
|
71
74
|
unsubscribe(target, propertyName) {
|
|
72
75
|
const resutl = this.getSubscriber(target, propertyName);
|
|
73
76
|
if (resutl.subscriber === undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefContainer.js","sourceRoot":"","sources":["../../../src/core/ref/RefContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;AAExB,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAS9C,MAAM,OAAO,YAAY;IAId;IACS;IAJlB,YAAY,GAAqB,EAAE,CAAC;IAEpC,YACS,KAAW,EACF,IAAmB;QAD5B,UAAK,GAAL,KAAK,CAAM;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K,QAAQ,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;aAAM,IAAI,IAAI,CAAC,KAAK,YAAY,MAAM,EAAE,CAAC;YACxC,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;IAED,MAAM;QACJ,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjB,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
|
package/core/ref/RefList.d.ts
CHANGED
|
@@ -1,19 +1,59 @@
|
|
|
1
1
|
import { ref } from ".";
|
|
2
2
|
import { RefContainer } from "./RefContainer";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new reactive list wrapper around a standard array.
|
|
5
|
+
*
|
|
6
|
+
* @param items - The initial array of items.
|
|
7
|
+
* @returns A new instance of RefList.
|
|
8
|
+
*/
|
|
3
9
|
export declare function refList<T>(items: T[]): RefList<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Type alias representing a reactive list of items of type T.
|
|
12
|
+
*/
|
|
4
13
|
export type refList<T> = RefList<T>;
|
|
14
|
+
/**
|
|
15
|
+
* A reactive wrapper for arrays that notifies subscribers on mutation.
|
|
16
|
+
* Inherits from Array and intercepts mutations like push, pop, splice, etc.
|
|
17
|
+
*/
|
|
5
18
|
export declare class RefList<T = any> extends Array<T> implements ref<T[]> {
|
|
19
|
+
/**
|
|
20
|
+
* Internal container that manages the reactive value and its subscribers.
|
|
21
|
+
*/
|
|
6
22
|
readonly container: RefContainer;
|
|
23
|
+
/**
|
|
24
|
+
* A unique key identifying this list reference (optional).
|
|
25
|
+
*/
|
|
7
26
|
readonly refKey: string;
|
|
27
|
+
/**
|
|
28
|
+
* Constructs a new RefList instance with the given items.
|
|
29
|
+
*
|
|
30
|
+
* @param items - The initial items for the list.
|
|
31
|
+
* @param refKey - Optional key used for registration in a central Ref registry.
|
|
32
|
+
*/
|
|
8
33
|
constructor(items: T[], refKey?: string);
|
|
34
|
+
/**
|
|
35
|
+
* Emits a change event to all subscribers for a specific mutation.
|
|
36
|
+
*
|
|
37
|
+
* @param propertyName - The type of mutation (e.g., "push", "splice", "value").
|
|
38
|
+
* @param value - The new list value.
|
|
39
|
+
*/
|
|
9
40
|
private emit;
|
|
41
|
+
/** Reactive subscription methods **/
|
|
10
42
|
subscribe(target: (arg: T[]) => void): boolean;
|
|
11
43
|
subscribe(target: (arg: T[]) => void, onUnsubscribe: Function): boolean;
|
|
12
44
|
subscribe(target: object, propertyName: string | symbol): boolean;
|
|
13
45
|
subscribe(target: object, propertyName: string | symbol, onUnsubscribe: Function): boolean;
|
|
14
46
|
subscribe(target: object | ((arg: T[]) => void), propertyName: string | symbol | Function, onUnsubscribe?: Function): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Subscribes to future changes without emitting the current value.
|
|
49
|
+
*/
|
|
50
|
+
listen(target: (arg: T[]) => void, onUnsubscribe?: Function): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Unsubscribes a function or object-property pair from list updates.
|
|
53
|
+
*/
|
|
15
54
|
unsubscribe(target: (arg: T[]) => void): boolean;
|
|
16
55
|
unsubscribe(target: object, propertyName: string | symbol): boolean;
|
|
56
|
+
/** Reactive mutation overrides **/
|
|
17
57
|
push(...items: T[]): number;
|
|
18
58
|
pop(): T | undefined;
|
|
19
59
|
shift(): T | undefined;
|
|
@@ -24,29 +64,61 @@ export declare class RefList<T = any> extends Array<T> implements ref<T[]> {
|
|
|
24
64
|
reverse(): T[];
|
|
25
65
|
fill(value: T, start?: number, end?: number): this;
|
|
26
66
|
copyWithin(target: number, start: number, end?: number): this;
|
|
67
|
+
/**
|
|
68
|
+
* Changes the length of the array and emits a change.
|
|
69
|
+
*/
|
|
27
70
|
set length(value: number);
|
|
71
|
+
/**
|
|
72
|
+
* Clears all elements in the list.
|
|
73
|
+
*/
|
|
28
74
|
clear(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Inserts items at a specific index.
|
|
77
|
+
*/
|
|
29
78
|
insert(index: number, ...items: T[]): number;
|
|
79
|
+
/**
|
|
80
|
+
* Removes a specific item from the list.
|
|
81
|
+
*/
|
|
30
82
|
removeItem(value: T): T;
|
|
83
|
+
/**
|
|
84
|
+
* Removes elements starting from an index.
|
|
85
|
+
*/
|
|
31
86
|
remove(index: number, count?: number): number;
|
|
87
|
+
/**
|
|
88
|
+
* Returns a shallow copy of the current list.
|
|
89
|
+
*/
|
|
32
90
|
valueOf(): T[];
|
|
33
91
|
get length(): number;
|
|
34
92
|
/**
|
|
35
|
-
* Synchronizes the children of an HTML element
|
|
36
|
-
* Ensures that the `element` contains the same elements as in the `list`, in the same order.
|
|
93
|
+
* Synchronizes the children of an HTML element with a list of HTMLElements.
|
|
37
94
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* 2. Appends elements from `list` to `element` that are not already present.
|
|
41
|
-
* 3. Reorders children of `element` to match the order in `list`.
|
|
42
|
-
*
|
|
43
|
-
* @param list - An array of `HTMLElement`s that should be reflected as the children of `element`.
|
|
44
|
-
* @param element - The parent `HTMLElement` whose children will be synchronized with `list`.
|
|
95
|
+
* @param list - The list of elements to reflect in the container.
|
|
96
|
+
* @param element - The container element whose children will be updated.
|
|
45
97
|
*/
|
|
46
98
|
static syncComponentWithList(list: Element[], element: HTMLElement): void;
|
|
99
|
+
/**
|
|
100
|
+
* Identifies this object as a custom reactive list in `Object.prototype.toString`.
|
|
101
|
+
*/
|
|
47
102
|
get [Symbol.toStringTag](): string;
|
|
103
|
+
/**
|
|
104
|
+
* Ensures Array is returned when using methods like `slice()` or `map()`.
|
|
105
|
+
*/
|
|
48
106
|
static get [Symbol.species](): ArrayConstructor;
|
|
107
|
+
/**
|
|
108
|
+
* Gets the current value of the reactive list.
|
|
109
|
+
* Returns a shallow copy of the internal array to prevent direct mutation.
|
|
110
|
+
*/
|
|
49
111
|
get value(): T[];
|
|
112
|
+
/**
|
|
113
|
+
* Replaces the entire contents of the list with a new array of items.
|
|
114
|
+
* If the same array reference is passed, no update or notification occurs.
|
|
115
|
+
*
|
|
116
|
+
* @param value - The new array of items to assign.
|
|
117
|
+
*/
|
|
50
118
|
set value(value: T[]);
|
|
119
|
+
/**
|
|
120
|
+
* Serializes the current list value for JSON output.
|
|
121
|
+
* This ensures only the raw array contents are emitted.
|
|
122
|
+
*/
|
|
51
123
|
toJSON(): T[];
|
|
52
124
|
}
|
package/core/ref/RefList.js
CHANGED
|
@@ -1,31 +1,70 @@
|
|
|
1
1
|
import { Ref } from ".";
|
|
2
2
|
import { RefContainer } from "./RefContainer";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new reactive list wrapper around a standard array.
|
|
5
|
+
*
|
|
6
|
+
* @param items - The initial array of items.
|
|
7
|
+
* @returns A new instance of RefList.
|
|
8
|
+
*/
|
|
3
9
|
export function refList(items) {
|
|
4
10
|
return new RefList(items);
|
|
5
11
|
}
|
|
12
|
+
// Enables `instanceof refList` to work correctly
|
|
6
13
|
Object.defineProperty(refList, Symbol.hasInstance, {
|
|
7
14
|
value: function (instance) {
|
|
8
15
|
return !!instance && instance instanceof RefList;
|
|
9
16
|
},
|
|
10
17
|
});
|
|
18
|
+
/**
|
|
19
|
+
* A reactive wrapper for arrays that notifies subscribers on mutation.
|
|
20
|
+
* Inherits from Array and intercepts mutations like push, pop, splice, etc.
|
|
21
|
+
*/
|
|
11
22
|
export class RefList extends Array {
|
|
23
|
+
/**
|
|
24
|
+
* Internal container that manages the reactive value and its subscribers.
|
|
25
|
+
*/
|
|
12
26
|
container;
|
|
27
|
+
/**
|
|
28
|
+
* A unique key identifying this list reference (optional).
|
|
29
|
+
*/
|
|
13
30
|
refKey;
|
|
31
|
+
/**
|
|
32
|
+
* Constructs a new RefList instance with the given items.
|
|
33
|
+
*
|
|
34
|
+
* @param items - The initial items for the list.
|
|
35
|
+
* @param refKey - Optional key used for registration in a central Ref registry.
|
|
36
|
+
*/
|
|
14
37
|
constructor(items, refKey) {
|
|
15
38
|
super(...items);
|
|
16
39
|
this.refKey = refKey;
|
|
17
40
|
this.container = new RefContainer(this);
|
|
18
41
|
refKey && Ref.set(refKey, this);
|
|
19
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Emits a change event to all subscribers for a specific mutation.
|
|
45
|
+
*
|
|
46
|
+
* @param propertyName - The type of mutation (e.g., "push", "splice", "value").
|
|
47
|
+
* @param value - The new list value.
|
|
48
|
+
*/
|
|
20
49
|
emit(propertyName, value) {
|
|
21
50
|
this.container.emitAll(propertyName, value);
|
|
22
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Subscribes to list changes and immediately emits the current value.
|
|
54
|
+
*/
|
|
23
55
|
subscribe(target, propertyName, onUnsubscribe) {
|
|
24
56
|
return this.container.emit(this.container.subscribe(target, propertyName, onUnsubscribe), this);
|
|
25
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Subscribes to future changes without emitting the current value.
|
|
60
|
+
*/
|
|
61
|
+
listen(target, onUnsubscribe) {
|
|
62
|
+
return this.container.subscribe(target, onUnsubscribe) !== undefined;
|
|
63
|
+
}
|
|
26
64
|
unsubscribe(targe, propertyName = "") {
|
|
27
65
|
return this.container.unsubscribe(targe, propertyName);
|
|
28
66
|
}
|
|
67
|
+
/** Reactive mutation overrides **/
|
|
29
68
|
push(...items) {
|
|
30
69
|
const n = super.push(...items);
|
|
31
70
|
this.container.emitAll("push", this);
|
|
@@ -71,19 +110,31 @@ export class RefList extends Array {
|
|
|
71
110
|
this.container.emitAll("copyWithin", this);
|
|
72
111
|
return this;
|
|
73
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Changes the length of the array and emits a change.
|
|
115
|
+
*/
|
|
74
116
|
set length(value) {
|
|
75
117
|
super.length = value;
|
|
76
118
|
this.container.emitAll("length", this);
|
|
77
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Clears all elements in the list.
|
|
122
|
+
*/
|
|
78
123
|
clear() {
|
|
79
124
|
super.length = 0;
|
|
80
125
|
this.container.emitAll("clear", this);
|
|
81
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Inserts items at a specific index.
|
|
129
|
+
*/
|
|
82
130
|
insert(index, ...items) {
|
|
83
131
|
super.splice(index, 0, ...items);
|
|
84
132
|
this.container.emitAll("insert", this);
|
|
85
133
|
return this.length;
|
|
86
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Removes a specific item from the list.
|
|
137
|
+
*/
|
|
87
138
|
removeItem(value) {
|
|
88
139
|
const index = super.indexOf(value);
|
|
89
140
|
if (index === -1)
|
|
@@ -92,11 +143,17 @@ export class RefList extends Array {
|
|
|
92
143
|
this.container.emitAll("removeValue", this);
|
|
93
144
|
return value;
|
|
94
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Removes elements starting from an index.
|
|
148
|
+
*/
|
|
95
149
|
remove(index, count = 1) {
|
|
96
150
|
super.splice(index, count);
|
|
97
151
|
this.container.emitAll("remove", this);
|
|
98
152
|
return this.length;
|
|
99
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Returns a shallow copy of the current list.
|
|
156
|
+
*/
|
|
100
157
|
valueOf() {
|
|
101
158
|
return Array.from(this);
|
|
102
159
|
}
|
|
@@ -104,16 +161,10 @@ export class RefList extends Array {
|
|
|
104
161
|
return super.length;
|
|
105
162
|
}
|
|
106
163
|
/**
|
|
107
|
-
* Synchronizes the children of an HTML element
|
|
108
|
-
* Ensures that the `element` contains the same elements as in the `list`, in the same order.
|
|
164
|
+
* Synchronizes the children of an HTML element with a list of HTMLElements.
|
|
109
165
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* 2. Appends elements from `list` to `element` that are not already present.
|
|
113
|
-
* 3. Reorders children of `element` to match the order in `list`.
|
|
114
|
-
*
|
|
115
|
-
* @param list - An array of `HTMLElement`s that should be reflected as the children of `element`.
|
|
116
|
-
* @param element - The parent `HTMLElement` whose children will be synchronized with `list`.
|
|
166
|
+
* @param list - The list of elements to reflect in the container.
|
|
167
|
+
* @param element - The container element whose children will be updated.
|
|
117
168
|
*/
|
|
118
169
|
static syncComponentWithList(list, element) {
|
|
119
170
|
const currentChildren = Array.from(element.children);
|
|
@@ -134,17 +185,31 @@ export class RefList extends Array {
|
|
|
134
185
|
}
|
|
135
186
|
});
|
|
136
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Identifies this object as a custom reactive list in `Object.prototype.toString`.
|
|
190
|
+
*/
|
|
137
191
|
get [Symbol.toStringTag]() {
|
|
138
192
|
return "refList";
|
|
139
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Ensures Array is returned when using methods like `slice()` or `map()`.
|
|
196
|
+
*/
|
|
140
197
|
static get [Symbol.species]() {
|
|
141
198
|
return Array;
|
|
142
199
|
}
|
|
143
|
-
|
|
200
|
+
/**
|
|
201
|
+
* Gets the current value of the reactive list.
|
|
202
|
+
* Returns a shallow copy of the internal array to prevent direct mutation.
|
|
203
|
+
*/
|
|
144
204
|
get value() {
|
|
145
205
|
return this.container.value.valueOf();
|
|
146
206
|
}
|
|
147
|
-
|
|
207
|
+
/**
|
|
208
|
+
* Replaces the entire contents of the list with a new array of items.
|
|
209
|
+
* If the same array reference is passed, no update or notification occurs.
|
|
210
|
+
*
|
|
211
|
+
* @param value - The new array of items to assign.
|
|
212
|
+
*/
|
|
148
213
|
set value(value) {
|
|
149
214
|
// @ts-ignore
|
|
150
215
|
if (this === value)
|
|
@@ -152,7 +217,10 @@ export class RefList extends Array {
|
|
|
152
217
|
super.splice(0, this.length, ...value);
|
|
153
218
|
this.emit("value", value);
|
|
154
219
|
}
|
|
155
|
-
|
|
220
|
+
/**
|
|
221
|
+
* Serializes the current list value for JSON output.
|
|
222
|
+
* This ensures only the raw array contents are emitted.
|
|
223
|
+
*/
|
|
156
224
|
toJSON() {
|
|
157
225
|
return this.value;
|
|
158
226
|
}
|