seitu 0.5.4 → 0.6.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/core/subscription.d.ts +10 -4
- package/dist/{core-3fd1NXIt.js → core-DLt97Ptv.js} +9 -11
- package/dist/core.js +1 -1
- package/dist/web.js +10 -10
- package/package.json +1 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
export interface SubscribeOptions {
|
|
2
|
+
/**
|
|
3
|
+
* When `true`, the callback is invoked immediately with the current value upon subscribing.
|
|
4
|
+
*/
|
|
5
|
+
immediate?: boolean;
|
|
6
|
+
}
|
|
1
7
|
export interface Subscribable<V> {
|
|
2
|
-
'subscribe': (callback: (value: V) => any) => () => void;
|
|
8
|
+
'subscribe': (callback: (value: V) => any, options?: SubscribeOptions) => () => void;
|
|
3
9
|
'~': {
|
|
4
10
|
/**
|
|
5
11
|
* Type type with returned value of the subscription.
|
|
@@ -23,7 +29,7 @@ export interface Removable {
|
|
|
23
29
|
export interface Destroyable {
|
|
24
30
|
destroy: () => void;
|
|
25
31
|
}
|
|
26
|
-
export declare function createSubscription
|
|
27
|
-
subscribe: (callback: (
|
|
28
|
-
notify: (
|
|
32
|
+
export declare function createSubscription(): {
|
|
33
|
+
subscribe: (callback: () => any, options?: SubscribeOptions) => () => void;
|
|
34
|
+
notify: () => void;
|
|
29
35
|
};
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
function e() {
|
|
3
3
|
let e = /* @__PURE__ */ new Set();
|
|
4
4
|
return {
|
|
5
|
-
subscribe(t) {
|
|
6
|
-
return e.add(t), () => {
|
|
5
|
+
subscribe(t, n) {
|
|
6
|
+
return n?.immediate && t(), e.add(t), () => {
|
|
7
7
|
e.delete(t);
|
|
8
8
|
};
|
|
9
9
|
},
|
|
10
|
-
notify(
|
|
11
|
-
e.forEach((e) => e(
|
|
10
|
+
notify() {
|
|
11
|
+
e.forEach((e) => e());
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -19,8 +19,8 @@ function t(t, n) {
|
|
|
19
19
|
for (let e of a) e.subscribe(() => i());
|
|
20
20
|
return {
|
|
21
21
|
get: s,
|
|
22
|
-
subscribe(e) {
|
|
23
|
-
return r(() => e(s()));
|
|
22
|
+
subscribe(e, t) {
|
|
23
|
+
return r(() => e(s()), t);
|
|
24
24
|
},
|
|
25
25
|
"~": {
|
|
26
26
|
output: null,
|
|
@@ -57,9 +57,7 @@ function r(t) {
|
|
|
57
57
|
s.set(t), a();
|
|
58
58
|
},
|
|
59
59
|
getDefaultValue: (e) => o[e],
|
|
60
|
-
subscribe: (e) => r(() =>
|
|
61
|
-
e(c());
|
|
62
|
-
}),
|
|
60
|
+
subscribe: (e, t) => r(() => e(c()), t),
|
|
63
61
|
destroy: () => {
|
|
64
62
|
s.destroy?.();
|
|
65
63
|
},
|
|
@@ -88,8 +86,8 @@ function a(t) {
|
|
|
88
86
|
let t = typeof e == "function" ? e(n) : e;
|
|
89
87
|
t !== n && (n = t, i());
|
|
90
88
|
},
|
|
91
|
-
subscribe(e) {
|
|
92
|
-
return r(() => e(a()));
|
|
89
|
+
subscribe(e, t) {
|
|
90
|
+
return r(() => e(a()), t);
|
|
93
91
|
},
|
|
94
92
|
"~": {
|
|
95
93
|
output: null,
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, n as t, o as n, r, t as i } from "./core-
|
|
1
|
+
import { a as e, n as t, o as n, r, t as i } from "./core-DLt97Ptv.js";
|
|
2
2
|
export { e as createComputed, t as createSchemaStore, r as createSchemaStoreMemoryProvider, i as createStore, n as createSubscription };
|
package/dist/web.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as e, n as t, o as n } from "./core-
|
|
1
|
+
import { i as e, n as t, o as n } from "./core-DLt97Ptv.js";
|
|
2
2
|
//#region src/web/is-online.ts
|
|
3
3
|
function r() {
|
|
4
4
|
let { subscribe: e, notify: t } = n(), r = () => typeof navigator > "u" ? !0 : navigator.onLine, i = () => t();
|
|
5
5
|
return typeof window < "u" && (window.addEventListener("online", i), window.addEventListener("offline", i)), {
|
|
6
6
|
get: r,
|
|
7
|
-
subscribe: (t) => e(() => t(r())),
|
|
7
|
+
subscribe: (t, n) => e(() => t(r()), n),
|
|
8
8
|
destroy: () => {
|
|
9
9
|
typeof window < "u" && (window.removeEventListener("online", i), window.removeEventListener("offline", i));
|
|
10
10
|
},
|
|
@@ -131,7 +131,7 @@ function o(t) {
|
|
|
131
131
|
newValue: a
|
|
132
132
|
})), i = !1, c();
|
|
133
133
|
},
|
|
134
|
-
subscribe: (e) => s(() => e(l())),
|
|
134
|
+
subscribe: (e, t) => s(() => e(l()), t),
|
|
135
135
|
remove: () => {
|
|
136
136
|
typeof window > "u" || window[r].removeItem(t.key);
|
|
137
137
|
},
|
|
@@ -158,7 +158,7 @@ function c(e) {
|
|
|
158
158
|
let { subscribe: t, notify: r } = n(), i = typeof window > "u" ? null : window.matchMedia(e.query), a = () => i?.matches ?? e.defaultMatches ?? !1, o = () => r();
|
|
159
159
|
return i?.addEventListener("change", o), {
|
|
160
160
|
get: a,
|
|
161
|
-
subscribe: (e) => t(() => e(a())),
|
|
161
|
+
subscribe: (e, n) => t(() => e(a()), n),
|
|
162
162
|
destroy: () => {
|
|
163
163
|
i?.removeEventListener("change", o);
|
|
164
164
|
},
|
|
@@ -206,12 +206,12 @@ function u(e) {
|
|
|
206
206
|
};
|
|
207
207
|
return {
|
|
208
208
|
get: c,
|
|
209
|
-
subscribe: (e) => {
|
|
210
|
-
let
|
|
211
|
-
if (!
|
|
212
|
-
let
|
|
213
|
-
return
|
|
214
|
-
|
|
209
|
+
subscribe: (e, t) => {
|
|
210
|
+
let n = s();
|
|
211
|
+
if (!n) return e(c()), () => {};
|
|
212
|
+
let r = i(() => e(c()), t), a = () => e(c());
|
|
213
|
+
return n.addEventListener("scroll", a, { passive: !0 }), () => {
|
|
214
|
+
r(), n.removeEventListener("scroll", a);
|
|
215
215
|
};
|
|
216
216
|
},
|
|
217
217
|
"~": {
|