@fluixi/reactive 1.0.0-alpha.82 → 1.0.0-alpha.84
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 +4 -0
- package/dist/cdn/reactive.cjs +2673 -1
- package/dist/cdn/reactive.global.js +2 -1
- package/dist/cdn/reactive.mjs +2657 -1
- package/dist/cdn/signal.cjs +299 -1
- package/dist/cdn/signal.d.ts +1 -1
- package/dist/cdn/signal.global.js +2 -1
- package/dist/cdn/signal.js +1 -1
- package/dist/cdn/signal.mjs +276 -1
- package/dist/index.cjs +2673 -1
- package/dist/index.mjs +2657 -1
- package/dist/lib/index.cjs +2674 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.mjs +2659 -1
- package/dist/lib/observable/index.cjs +386 -1
- package/dist/lib/observable/index.mjs +364 -1
- package/dist/lib/observable/observable.cjs +384 -1
- package/dist/lib/observable/observable.d.ts +0 -137
- package/dist/lib/observable/observable.d.ts.map +1 -1
- package/dist/lib/observable/observable.js +0 -71
- package/dist/lib/observable/observable.mjs +361 -1
- package/dist/lib/observable/subscription.cjs +180 -1
- package/dist/lib/observable/subscription.d.ts +0 -12
- package/dist/lib/observable/subscription.d.ts.map +1 -1
- package/dist/lib/observable/subscription.js +0 -12
- package/dist/lib/observable/subscription.mjs +157 -1
- package/dist/lib/observable/types.cjs +18 -1
- package/dist/lib/observable/types.d.ts.map +1 -1
- package/dist/lib/predicates.cjs +44 -1
- package/dist/lib/predicates.d.ts +2 -2
- package/dist/lib/predicates.js +2 -2
- package/dist/lib/predicates.mjs +23 -1
- package/dist/lib/signal/api.cjs +571 -1
- package/dist/lib/signal/api.d.ts +211 -1
- package/dist/lib/signal/api.d.ts.map +1 -1
- package/dist/lib/signal/api.js +207 -12
- package/dist/lib/signal/api.mjs +548 -1
- package/dist/lib/signal/cached-resource.cjs +672 -1
- package/dist/lib/signal/cached-resource.d.ts +28 -16
- package/dist/lib/signal/cached-resource.d.ts.map +1 -1
- package/dist/lib/signal/cached-resource.js +35 -29
- package/dist/lib/signal/cached-resource.mjs +650 -1
- package/dist/lib/signal/graph/children.cjs +325 -1
- package/dist/lib/signal/graph/children.js +1 -1
- package/dist/lib/signal/graph/children.mjs +302 -1
- package/dist/lib/signal/graph/compat.cjs +578 -1
- package/dist/lib/signal/graph/compat.d.ts +13 -13
- package/dist/lib/signal/graph/compat.d.ts.map +1 -1
- package/dist/lib/signal/graph/compat.js +51 -32
- package/dist/lib/signal/graph/compat.mjs +556 -1
- package/dist/lib/signal/graph/core.cjs +295 -1
- package/dist/lib/signal/graph/core.d.ts +28 -24
- package/dist/lib/signal/graph/core.d.ts.map +1 -1
- package/dist/lib/signal/graph/core.js +45 -31
- package/dist/lib/signal/graph/core.mjs +273 -1
- package/dist/lib/signal/graph/debounced.cjs +668 -1
- package/dist/lib/signal/graph/debounced.d.ts +5 -5
- package/dist/lib/signal/graph/debounced.d.ts.map +1 -1
- package/dist/lib/signal/graph/debounced.js +5 -5
- package/dist/lib/signal/graph/debounced.mjs +645 -1
- package/dist/lib/signal/graph/derived.cjs +496 -1
- package/dist/lib/signal/graph/derived.d.ts +1 -1
- package/dist/lib/signal/graph/derived.js +1 -1
- package/dist/lib/signal/graph/derived.mjs +473 -1
- package/dist/lib/signal/graph/detect.cjs +66 -1
- package/dist/lib/signal/graph/detect.mjs +45 -1
- package/dist/lib/signal/graph/error-boundary.cjs +301 -1
- package/dist/lib/signal/graph/error-boundary.js +3 -3
- package/dist/lib/signal/graph/error-boundary.mjs +278 -1
- package/dist/lib/signal/graph/index.cjs +305 -1
- package/dist/lib/signal/graph/index.d.ts +7 -6
- package/dist/lib/signal/graph/index.d.ts.map +1 -1
- package/dist/lib/signal/graph/index.js +7 -6
- package/dist/lib/signal/graph/index.mjs +283 -1
- package/dist/lib/signal/graph/observe.cjs +163 -0
- package/dist/lib/signal/graph/observe.d.ts +141 -0
- package/dist/lib/signal/graph/observe.d.ts.map +1 -0
- package/dist/lib/signal/graph/observe.js +149 -0
- package/dist/lib/signal/graph/observe.mjs +140 -0
- package/dist/lib/signal/graph/resource.cjs +620 -1
- package/dist/lib/signal/graph/resource.d.ts +1 -1
- package/dist/lib/signal/graph/resource.js +7 -8
- package/dist/lib/signal/graph/resource.mjs +597 -1
- package/dist/lib/signal/graph/runtime.cjs +501 -1
- package/dist/lib/signal/graph/runtime.d.ts +9 -9
- package/dist/lib/signal/graph/runtime.d.ts.map +1 -1
- package/dist/lib/signal/graph/runtime.js +56 -37
- package/dist/lib/signal/graph/runtime.mjs +478 -1
- package/dist/lib/signal/graph/signal-next.cjs +1208 -1
- package/dist/lib/signal/graph/signal-next.d.ts +5 -5
- package/dist/lib/signal/graph/signal-next.d.ts.map +1 -1
- package/dist/lib/signal/graph/signal-next.js +14 -12
- package/dist/lib/signal/graph/signal-next.mjs +1186 -1
- package/dist/lib/signal/graph/ssr-hooks.cjs +60 -1
- package/dist/lib/signal/graph/ssr-hooks.d.ts +6 -7
- package/dist/lib/signal/graph/ssr-hooks.d.ts.map +1 -1
- package/dist/lib/signal/graph/ssr-hooks.js +6 -7
- package/dist/lib/signal/graph/ssr-hooks.mjs +39 -1
- package/dist/lib/signal/graph/state.cjs +72 -1
- package/dist/lib/signal/graph/state.d.ts +43 -10
- package/dist/lib/signal/graph/state.d.ts.map +1 -1
- package/dist/lib/signal/graph/state.js +83 -21
- package/dist/lib/signal/graph/state.mjs +49 -1
- package/dist/lib/signal/graph/suspense.cjs +301 -1
- package/dist/lib/signal/graph/suspense.js +4 -4
- package/dist/lib/signal/graph/suspense.mjs +278 -1
- package/dist/lib/signal/index-legacy.cjs +2540 -1
- package/dist/lib/signal/index-legacy.d.ts +1 -1
- package/dist/lib/signal/index-legacy.js +1 -1
- package/dist/lib/signal/index-legacy.mjs +2518 -1
- package/dist/lib/signal/index.cjs +1275 -1
- package/dist/lib/signal/index.d.ts +5 -2
- package/dist/lib/signal/index.d.ts.map +1 -1
- package/dist/lib/signal/index.js +8 -3
- package/dist/lib/signal/index.mjs +1253 -1
- package/dist/lib/signal/list.cjs +549 -1
- package/dist/lib/signal/list.d.ts +5 -5
- package/dist/lib/signal/list.js +10 -10
- package/dist/lib/signal/list.mjs +526 -1
- package/dist/lib/signal/resource-api.cjs +626 -1
- package/dist/lib/signal/resource-api.d.ts +5 -5
- package/dist/lib/signal/resource-api.js +5 -5
- package/dist/lib/signal/resource-api.mjs +603 -1
- package/dist/lib/signal/signal.cjs +2023 -1
- package/dist/lib/signal/signal.d.ts +4 -4
- package/dist/lib/signal/signal.d.ts.map +1 -1
- package/dist/lib/signal/signal.js +22 -23
- package/dist/lib/signal/signal.mjs +2000 -1
- package/dist/lib/signal/types.cjs +38 -1
- package/dist/lib/signal/types.d.ts.map +1 -1
- package/dist/lib/signal/types.js +2 -2
- package/dist/lib/signal/types.mjs +17 -1
- package/dist/lib/signal/utilities.cjs +1012 -1
- package/dist/lib/signal/utilities.d.ts +0 -108
- package/dist/lib/signal/utilities.d.ts.map +1 -1
- package/dist/lib/signal/utilities.js +0 -158
- package/dist/lib/signal/utilities.mjs +990 -1
- package/dist/lib/store/api.cjs +612 -1
- package/dist/lib/store/api.d.ts +33 -0
- package/dist/lib/store/api.d.ts.map +1 -1
- package/dist/lib/store/api.js +41 -8
- package/dist/lib/store/api.mjs +596 -1
- package/dist/lib/store/index.cjs +691 -1
- package/dist/lib/store/index.js +1 -1
- package/dist/lib/store/index.mjs +676 -1
- package/dist/lib/store/setter.types.cjs +18 -1
- package/dist/lib/store/setter.types.d.ts +43 -3
- package/dist/lib/store/setter.types.d.ts.map +1 -1
- package/dist/lib/store/store.cjs +658 -1
- package/dist/lib/store/store.d.ts +72 -0
- package/dist/lib/store/store.d.ts.map +1 -1
- package/dist/lib/store/store.js +294 -11
- package/dist/lib/store/store.mjs +644 -1
- package/dist/lib/store/types.cjs +18 -1
- package/dist/lib/store/types.d.ts +1 -1
- package/dist/lib/store/types.d.ts.map +1 -1
- package/dist/lib/store/utils.cjs +43 -1
- package/dist/lib/store/utils.d.ts +1 -1
- package/dist/lib/store/utils.js +1 -1
- package/dist/lib/store/utils.mjs +22 -1
- package/dist/lib/subject.cjs +450 -1
- package/dist/lib/subject.js +3 -91
- package/dist/lib/subject.mjs +427 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/version.generated.cjs +27 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +2 -2
- package/dist/version.generated.mjs +7 -1
- package/package.json +5 -4
|
@@ -28,38 +28,26 @@ export declare class Subscription implements SubscriptionLike {
|
|
|
28
28
|
/** @private */ private _subscriptions;
|
|
29
29
|
/**
|
|
30
30
|
* Creates a new Subscription.
|
|
31
|
-
*
|
|
32
|
-
* @param {Unsubscribable} [unsubscribe] - Optional cleanup function to call on unsubscribe
|
|
33
31
|
*/
|
|
34
32
|
constructor(unsubscribe?: Unsubscribable);
|
|
35
33
|
/**
|
|
36
34
|
* Whether the subscription is closed.
|
|
37
|
-
*
|
|
38
|
-
* @returns {boolean} True if the subscription is closed
|
|
39
35
|
*/
|
|
40
36
|
get closed(): boolean;
|
|
41
37
|
/**
|
|
42
38
|
* Disposes the resources held by the subscription.
|
|
43
39
|
* May be called multiple times (idempotent).
|
|
44
|
-
*
|
|
45
|
-
* @returns {void}
|
|
46
40
|
*/
|
|
47
41
|
unsubscribe(): void;
|
|
48
42
|
/**
|
|
49
43
|
* Adds a child subscription or cleanup function to this subscription.
|
|
50
44
|
* When this subscription is unsubscribed, all added subscriptions/functions will be unsubscribed/called.
|
|
51
45
|
*
|
|
52
|
-
* @param {SubscriptionLike|Unsubscribable} subscription - Subscription or cleanup function to add
|
|
53
|
-
* @returns {Subscription} This subscription for chaining
|
|
54
|
-
*
|
|
55
46
|
* @throws {TypeError} If the argument is not a subscription-like object or function
|
|
56
47
|
*/
|
|
57
48
|
add(subscription: SubscriptionLike | Unsubscribable): this;
|
|
58
49
|
/**
|
|
59
50
|
* Removes a child subscription from this subscription.
|
|
60
|
-
*
|
|
61
|
-
* @param {Subscription} subscription - Subscription to remove
|
|
62
|
-
* @returns {void}
|
|
63
51
|
*/
|
|
64
52
|
remove(subscription: Subscription): void;
|
|
65
53
|
/** @private */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../src/lib/observable/subscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,YAAa,YAAW,gBAAgB;IACnD,eAAe,CAAC,OAAO,CAAC,OAAO,CAAS;IACxC,eAAe,CAAC,OAAO,CAAC,gBAAgB,CAGxB;IAChB,eAAe,CAAC,OAAO,CAAC,cAAc,CAEtB;IAEhB
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../src/lib/observable/subscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,YAAa,YAAW,gBAAgB;IACnD,eAAe,CAAC,OAAO,CAAC,OAAO,CAAS;IACxC,eAAe,CAAC,OAAO,CAAC,gBAAgB,CAGxB;IAChB,eAAe,CAAC,OAAO,CAAC,cAAc,CAEtB;IAEhB;;OAEG;gBACS,WAAW,CAAC,EAAE,cAAc;IAMxC;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;;OAGG;IACH,WAAW,IAAI,IAAI;IAuCnB;;;;;OAKG;IACH,GAAG,CAAC,YAAY,EAAE,gBAAgB,GAAG,cAAc,GAAG,IAAI;IA8C1D;;OAEG;IACH,MAAM,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAexC,eAAe;IACf,OAAO,CAAC,UAAU;IAWlB,eAAe;IACf,OAAO,CAAC,aAAa;CActB"}
|
|
@@ -28,8 +28,6 @@ export class Subscription {
|
|
|
28
28
|
/** @private */ _subscriptions = null;
|
|
29
29
|
/**
|
|
30
30
|
* Creates a new Subscription.
|
|
31
|
-
*
|
|
32
|
-
* @param {Unsubscribable} [unsubscribe] - Optional cleanup function to call on unsubscribe
|
|
33
31
|
*/
|
|
34
32
|
constructor(unsubscribe) {
|
|
35
33
|
if (unsubscribe) {
|
|
@@ -38,8 +36,6 @@ export class Subscription {
|
|
|
38
36
|
}
|
|
39
37
|
/**
|
|
40
38
|
* Whether the subscription is closed.
|
|
41
|
-
*
|
|
42
|
-
* @returns {boolean} True if the subscription is closed
|
|
43
39
|
*/
|
|
44
40
|
get closed() {
|
|
45
41
|
return this._closed;
|
|
@@ -47,8 +43,6 @@ export class Subscription {
|
|
|
47
43
|
/**
|
|
48
44
|
* Disposes the resources held by the subscription.
|
|
49
45
|
* May be called multiple times (idempotent).
|
|
50
|
-
*
|
|
51
|
-
* @returns {void}
|
|
52
46
|
*/
|
|
53
47
|
unsubscribe() {
|
|
54
48
|
if (this._closed) {
|
|
@@ -93,9 +87,6 @@ export class Subscription {
|
|
|
93
87
|
* Adds a child subscription or cleanup function to this subscription.
|
|
94
88
|
* When this subscription is unsubscribed, all added subscriptions/functions will be unsubscribed/called.
|
|
95
89
|
*
|
|
96
|
-
* @param {SubscriptionLike|Unsubscribable} subscription - Subscription or cleanup function to add
|
|
97
|
-
* @returns {Subscription} This subscription for chaining
|
|
98
|
-
*
|
|
99
90
|
* @throws {TypeError} If the argument is not a subscription-like object or function
|
|
100
91
|
*/
|
|
101
92
|
add(subscription) {
|
|
@@ -141,9 +132,6 @@ export class Subscription {
|
|
|
141
132
|
}
|
|
142
133
|
/**
|
|
143
134
|
* Removes a child subscription from this subscription.
|
|
144
|
-
*
|
|
145
|
-
* @param {Subscription} subscription - Subscription to remove
|
|
146
|
-
* @returns {void}
|
|
147
135
|
*/
|
|
148
136
|
remove(subscription) {
|
|
149
137
|
const { _subscriptions } = this;
|
|
@@ -1 +1,157 @@
|
|
|
1
|
-
|
|
1
|
+
// src/lib/predicates.ts
|
|
2
|
+
function isFunction(value) {
|
|
3
|
+
return typeof value === "function" && !/^class\s/.test(Function.prototype.toString.call(value));
|
|
4
|
+
}
|
|
5
|
+
function isObject(value) {
|
|
6
|
+
if (value == null) return false;
|
|
7
|
+
if (Array.isArray(value)) return false;
|
|
8
|
+
if (typeof value === "function") return false;
|
|
9
|
+
if (value instanceof Date) return false;
|
|
10
|
+
if (value instanceof RegExp) return false;
|
|
11
|
+
if (value instanceof Map) return false;
|
|
12
|
+
if (value instanceof Set) return false;
|
|
13
|
+
if (value instanceof Error) return false;
|
|
14
|
+
return typeof value === "object";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// src/lib/observable/subscription.ts
|
|
18
|
+
var Subscription = class _Subscription {
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new Subscription.
|
|
21
|
+
*/
|
|
22
|
+
constructor(unsubscribe) {
|
|
23
|
+
/** @private */
|
|
24
|
+
this._closed = false;
|
|
25
|
+
/** @private */
|
|
26
|
+
this._parentOrParents = null;
|
|
27
|
+
/** @private */
|
|
28
|
+
this._subscriptions = null;
|
|
29
|
+
if (unsubscribe) {
|
|
30
|
+
this._subscriptions = [unsubscribe];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Whether the subscription is closed.
|
|
35
|
+
*/
|
|
36
|
+
get closed() {
|
|
37
|
+
return this._closed;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Disposes the resources held by the subscription.
|
|
41
|
+
* May be called multiple times (idempotent).
|
|
42
|
+
*/
|
|
43
|
+
unsubscribe() {
|
|
44
|
+
if (this._closed) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this._closed = true;
|
|
48
|
+
const { _parentOrParents, _subscriptions } = this;
|
|
49
|
+
if (_parentOrParents instanceof _Subscription) {
|
|
50
|
+
_parentOrParents.remove(this);
|
|
51
|
+
} else if (_parentOrParents !== null) {
|
|
52
|
+
for (const parent of _parentOrParents) {
|
|
53
|
+
parent.remove(this);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (_subscriptions) {
|
|
57
|
+
for (const sub of _subscriptions) {
|
|
58
|
+
if (isFunction(sub) && !(sub instanceof _Subscription)) {
|
|
59
|
+
try {
|
|
60
|
+
sub();
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error("Error in unsubscribe function:", error);
|
|
63
|
+
}
|
|
64
|
+
} else if (isObject(sub) && typeof sub.unsubscribe === "function") {
|
|
65
|
+
try {
|
|
66
|
+
sub.unsubscribe();
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error("Error unsubscribing child:", error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
this._subscriptions = null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Adds a child subscription or cleanup function to this subscription.
|
|
77
|
+
* When this subscription is unsubscribed, all added subscriptions/functions will be unsubscribed/called.
|
|
78
|
+
*
|
|
79
|
+
* @throws {TypeError} If the argument is not a subscription-like object or function
|
|
80
|
+
*/
|
|
81
|
+
add(subscription) {
|
|
82
|
+
if (!subscription || subscription === this) {
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
if (subscription.closed) {
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
let { _closed, _subscriptions } = this;
|
|
89
|
+
if (_closed) {
|
|
90
|
+
if (isFunction(subscription)) {
|
|
91
|
+
try {
|
|
92
|
+
subscription();
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.error("Error in unsubscribe function:", error);
|
|
95
|
+
}
|
|
96
|
+
} else if (subscription.unsubscribe) {
|
|
97
|
+
try {
|
|
98
|
+
subscription.unsubscribe();
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error("Error unsubscribing:", error);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
if (!_subscriptions) {
|
|
106
|
+
this._subscriptions = [];
|
|
107
|
+
}
|
|
108
|
+
this._subscriptions.push(subscription);
|
|
109
|
+
if (subscription instanceof _Subscription) {
|
|
110
|
+
subscription._addParent(this);
|
|
111
|
+
}
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Removes a child subscription from this subscription.
|
|
116
|
+
*/
|
|
117
|
+
remove(subscription) {
|
|
118
|
+
const { _subscriptions } = this;
|
|
119
|
+
if (!_subscriptions) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const index = _subscriptions.indexOf(subscription);
|
|
123
|
+
if (index !== -1) {
|
|
124
|
+
_subscriptions.splice(index, 1);
|
|
125
|
+
subscription._removeParent(this);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** @private */
|
|
129
|
+
_addParent(parent) {
|
|
130
|
+
const { _parentOrParents } = this;
|
|
131
|
+
if (!_parentOrParents) {
|
|
132
|
+
this._parentOrParents = parent;
|
|
133
|
+
} else if (Array.isArray(_parentOrParents)) {
|
|
134
|
+
_parentOrParents.push(parent);
|
|
135
|
+
} else {
|
|
136
|
+
this._parentOrParents = [_parentOrParents, parent];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/** @private */
|
|
140
|
+
_removeParent(parent) {
|
|
141
|
+
const { _parentOrParents } = this;
|
|
142
|
+
if (_parentOrParents === parent) {
|
|
143
|
+
this._parentOrParents = null;
|
|
144
|
+
} else if (Array.isArray(_parentOrParents)) {
|
|
145
|
+
const index = _parentOrParents.indexOf(parent);
|
|
146
|
+
if (index !== -1) {
|
|
147
|
+
_parentOrParents.splice(index, 1);
|
|
148
|
+
if (_parentOrParents.length === 1) {
|
|
149
|
+
this._parentOrParents = _parentOrParents[0];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
export {
|
|
156
|
+
Subscription
|
|
157
|
+
};
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/lib/observable/types.ts
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/observable/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,IAAI,IAAI,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/observable/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,IAAI,IAAI,CAAC;CACvB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;AAG9E;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC7B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB"}
|
package/dist/lib/predicates.cjs
CHANGED
|
@@ -1 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/lib/predicates.ts
|
|
21
|
+
var predicates_exports = {};
|
|
22
|
+
__export(predicates_exports, {
|
|
23
|
+
isFunction: () => isFunction,
|
|
24
|
+
isObject: () => isObject,
|
|
25
|
+
isPromise: () => isPromise
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(predicates_exports);
|
|
28
|
+
function isFunction(value) {
|
|
29
|
+
return typeof value === "function" && !/^class\s/.test(Function.prototype.toString.call(value));
|
|
30
|
+
}
|
|
31
|
+
function isObject(value) {
|
|
32
|
+
if (value == null) return false;
|
|
33
|
+
if (Array.isArray(value)) return false;
|
|
34
|
+
if (typeof value === "function") return false;
|
|
35
|
+
if (value instanceof Date) return false;
|
|
36
|
+
if (value instanceof RegExp) return false;
|
|
37
|
+
if (value instanceof Map) return false;
|
|
38
|
+
if (value instanceof Set) return false;
|
|
39
|
+
if (value instanceof Error) return false;
|
|
40
|
+
return typeof value === "object";
|
|
41
|
+
}
|
|
42
|
+
function isPromise(value) {
|
|
43
|
+
return value instanceof Promise || !!value && (typeof value === "object" || typeof value === "function") && "then" in value;
|
|
44
|
+
}
|
package/dist/lib/predicates.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The type predicates this package needs, inlined.
|
|
3
3
|
*
|
|
4
4
|
* They came from `@fluixi/utils`, and the import was the only thing standing between
|
|
5
|
-
* this package and being installable on its own
|
|
5
|
+
* this package and being installable on its own, a signals library that drags a
|
|
6
6
|
* framework's utility package behind it reads as a framework component, whatever the
|
|
7
7
|
* README says. Three predicates are not worth a dependency.
|
|
8
8
|
*
|
|
@@ -22,7 +22,7 @@ export declare function isFunction<T extends Function = Function>(value: unknown
|
|
|
22
22
|
* built-ins with their own identity.
|
|
23
23
|
*
|
|
24
24
|
* Date, RegExp, Map, Set and Error are excluded because a store must treat them as
|
|
25
|
-
* opaque values rather than walking into them
|
|
25
|
+
* opaque values rather than walking into them, proxying a Date's internals produces
|
|
26
26
|
* an object that fails every method call on it.
|
|
27
27
|
*/
|
|
28
28
|
export declare function isObject(value: unknown): value is Record<string | symbol, unknown>;
|
package/dist/lib/predicates.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The type predicates this package needs, inlined.
|
|
3
3
|
*
|
|
4
4
|
* They came from `@fluixi/utils`, and the import was the only thing standing between
|
|
5
|
-
* this package and being installable on its own
|
|
5
|
+
* this package and being installable on its own, a signals library that drags a
|
|
6
6
|
* framework's utility package behind it reads as a framework component, whatever the
|
|
7
7
|
* README says. Three predicates are not worth a dependency.
|
|
8
8
|
*
|
|
@@ -25,7 +25,7 @@ export function isFunction(value) {
|
|
|
25
25
|
* built-ins with their own identity.
|
|
26
26
|
*
|
|
27
27
|
* Date, RegExp, Map, Set and Error are excluded because a store must treat them as
|
|
28
|
-
* opaque values rather than walking into them
|
|
28
|
+
* opaque values rather than walking into them, proxying a Date's internals produces
|
|
29
29
|
* an object that fails every method call on it.
|
|
30
30
|
*/
|
|
31
31
|
export function isObject(value) {
|
package/dist/lib/predicates.mjs
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
// src/lib/predicates.ts
|
|
2
|
+
function isFunction(value) {
|
|
3
|
+
return typeof value === "function" && !/^class\s/.test(Function.prototype.toString.call(value));
|
|
4
|
+
}
|
|
5
|
+
function isObject(value) {
|
|
6
|
+
if (value == null) return false;
|
|
7
|
+
if (Array.isArray(value)) return false;
|
|
8
|
+
if (typeof value === "function") return false;
|
|
9
|
+
if (value instanceof Date) return false;
|
|
10
|
+
if (value instanceof RegExp) return false;
|
|
11
|
+
if (value instanceof Map) return false;
|
|
12
|
+
if (value instanceof Set) return false;
|
|
13
|
+
if (value instanceof Error) return false;
|
|
14
|
+
return typeof value === "object";
|
|
15
|
+
}
|
|
16
|
+
function isPromise(value) {
|
|
17
|
+
return value instanceof Promise || !!value && (typeof value === "object" || typeof value === "function") && "then" in value;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
isFunction,
|
|
21
|
+
isObject,
|
|
22
|
+
isPromise
|
|
23
|
+
};
|