sibujs 1.5.0 → 2.0.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/browser.cjs +238 -69
- package/dist/browser.d.cts +5 -0
- package/dist/browser.d.ts +5 -0
- package/dist/browser.js +6 -6
- package/dist/build.cjs +916 -292
- package/dist/build.js +15 -13
- package/dist/cdn.global.js +17 -16
- package/dist/chunk-2RA7SHDA.js +65 -0
- package/dist/chunk-2UPRY23K.js +80 -0
- package/dist/chunk-3JHCYHWN.js +125 -0
- package/dist/{chunk-VAPYJN4X.js → chunk-3LR7GLWQ.js} +93 -23
- package/dist/{chunk-RJ46C3CS.js → chunk-3NSGB5JN.js} +71 -20
- package/dist/{chunk-XUEEGU5O.js → chunk-52YJLLRO.js} +16 -4
- package/dist/{chunk-XHK6BDAJ.js → chunk-54EDRCEF.js} +25 -8
- package/dist/chunk-7JDB7I65.js +1327 -0
- package/dist/{chunk-WZSPOOER.js → chunk-CC65Y57T.js} +8 -5
- package/dist/{chunk-23VV7YD3.js → chunk-DFPFITST.js} +25 -30
- package/dist/{chunk-BGN5ZMP4.js → chunk-GTBNNBJ6.js} +14 -2
- package/dist/chunk-HB24TBAF.js +121 -0
- package/dist/{chunk-CZUGLNJS.js → chunk-ITX6OO3F.js} +3 -3
- package/dist/{chunk-BGTHZHJ5.js → chunk-JA6667UN.js} +188 -44
- package/dist/{chunk-7GRNSCFT.js → chunk-JXMMDLBY.js} +306 -183
- package/dist/{chunk-3X2YG6YM.js → chunk-JYD2PWXH.js} +59 -28
- package/dist/{chunk-SFKNRVCU.js → chunk-KLRMB5ZS.js} +135 -79
- package/dist/{chunk-5X6PP2UK.js → chunk-LMLD24FC.js} +2 -2
- package/dist/{chunk-M4NLBH4I.js → chunk-LYTCUZ7H.js} +3 -2
- package/dist/{chunk-BMPL52BF.js → chunk-MIUAXB7K.js} +118 -66
- package/dist/{chunk-JCDUJN2F.js → chunk-ND2664SF.js} +486 -153
- package/dist/{chunk-VQDZK23A.js → chunk-O2MNQFLP.js} +181 -66
- package/dist/{chunk-NHUC2QWH.js → chunk-R73P76YZ.js} +1 -1
- package/dist/{chunk-2BYQDGN3.js → chunk-SAHNHTFC.js} +234 -63
- package/dist/chunk-UCS6AMJ7.js +79 -0
- package/dist/{chunk-K4G4ZQNR.js → chunk-VLPPXTYG.js} +84 -38
- package/dist/{chunk-OUZZEE4S.js → chunk-WOMYAHHI.js} +17 -11
- package/dist/{customElement-BL3Uo8dL.d.cts → customElement-CPfIrbvg.d.cts} +14 -10
- package/dist/{customElement-BL3Uo8dL.d.ts → customElement-CPfIrbvg.d.ts} +14 -10
- package/dist/data.cjs +410 -99
- package/dist/data.d.cts +20 -2
- package/dist/data.d.ts +20 -2
- package/dist/data.js +11 -9
- package/dist/devtools.cjs +513 -223
- package/dist/devtools.d.cts +1 -1
- package/dist/devtools.d.ts +1 -1
- package/dist/devtools.js +12 -6
- package/dist/ecosystem.cjs +475 -144
- package/dist/ecosystem.d.cts +9 -7
- package/dist/ecosystem.d.ts +9 -7
- package/dist/ecosystem.js +12 -11
- package/dist/extras.cjs +3355 -1541
- package/dist/extras.d.cts +9 -9
- package/dist/extras.d.ts +9 -9
- package/dist/extras.js +58 -45
- package/dist/index.cjs +920 -292
- package/dist/index.d.cts +71 -8
- package/dist/index.d.ts +71 -8
- package/dist/index.js +28 -16
- package/dist/{introspect-BumjnBKr.d.cts → introspect-BWNjNw64.d.cts} +22 -2
- package/dist/{introspect-CZrlcaYy.d.ts → introspect-cY2pg9pW.d.ts} +22 -2
- package/dist/motion.cjs +77 -34
- package/dist/motion.js +4 -4
- package/dist/patterns.cjs +335 -69
- package/dist/patterns.d.cts +11 -12
- package/dist/patterns.d.ts +11 -12
- package/dist/patterns.js +7 -7
- package/dist/performance.cjs +279 -108
- package/dist/performance.d.cts +23 -16
- package/dist/performance.d.ts +23 -16
- package/dist/performance.js +13 -8
- package/dist/plugin-D30wlGW5.d.cts +71 -0
- package/dist/plugin-D30wlGW5.d.ts +71 -0
- package/dist/plugins.cjs +635 -260
- package/dist/plugins.d.cts +10 -3
- package/dist/plugins.d.ts +10 -3
- package/dist/plugins.js +106 -38
- package/dist/{ssr-Do_SiVoL.d.cts → ssr-CrVNy6Pa.d.cts} +9 -15
- package/dist/{ssr-Do_SiVoL.d.ts → ssr-CrVNy6Pa.d.ts} +9 -15
- package/dist/{ssr-4PBXAOO3.js → ssr-FXD2PPMC.js} +4 -3
- package/dist/ssr.cjs +642 -222
- package/dist/ssr.d.cts +26 -6
- package/dist/ssr.d.ts +26 -6
- package/dist/ssr.js +12 -11
- package/dist/{tagFactory-DaJ0YWX6.d.cts → tagFactory-S17H2qxu.d.cts} +9 -1
- package/dist/{tagFactory-DaJ0YWX6.d.ts → tagFactory-S17H2qxu.d.ts} +9 -1
- package/dist/testing.cjs +252 -63
- package/dist/testing.d.cts +17 -4
- package/dist/testing.d.ts +17 -4
- package/dist/testing.js +100 -44
- package/dist/ui.cjs +463 -137
- package/dist/ui.d.cts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +20 -17
- package/dist/widgets.cjs +977 -94
- package/dist/widgets.d.cts +104 -2
- package/dist/widgets.d.ts +104 -2
- package/dist/widgets.js +9 -7
- package/package.json +8 -2
- package/dist/chunk-32DY64NT.js +0 -282
- package/dist/chunk-3AIRKM3B.js +0 -1263
- package/dist/chunk-3ARAQO7B.js +0 -398
- package/dist/chunk-3CRQALYP.js +0 -877
- package/dist/chunk-4EI4AG32.js +0 -482
- package/dist/chunk-4MYMUBRS.js +0 -21
- package/dist/chunk-5ZYQ6KDD.js +0 -154
- package/dist/chunk-6BMPXPUW.js +0 -26
- package/dist/chunk-6HLLIF3K.js +0 -398
- package/dist/chunk-6LSNVCS2.js +0 -937
- package/dist/chunk-6SA3QQES.js +0 -61
- package/dist/chunk-77L6NL3X.js +0 -1097
- package/dist/chunk-7BF6TK55.js +0 -1097
- package/dist/chunk-7TQKR4PP.js +0 -294
- package/dist/chunk-7V26P53V.js +0 -712
- package/dist/chunk-AZ3ISID5.js +0 -298
- package/dist/chunk-B7SWRFUT.js +0 -332
- package/dist/chunk-BTU3TJDS.js +0 -365
- package/dist/chunk-BW3WT46K.js +0 -937
- package/dist/chunk-C6KFWOFV.js +0 -616
- package/dist/chunk-CHF5OHIA.js +0 -61
- package/dist/chunk-CHJ27IGK.js +0 -26
- package/dist/chunk-CMBFNA7L.js +0 -27
- package/dist/chunk-DAHRH4ON.js +0 -331
- package/dist/chunk-DKOHBI74.js +0 -924
- package/dist/chunk-DTCOOBMX.js +0 -725
- package/dist/chunk-EBGIRKQY.js +0 -616
- package/dist/chunk-EUZND3CB.js +0 -27
- package/dist/chunk-EVCZO745.js +0 -365
- package/dist/chunk-EWFVA3TJ.js +0 -282
- package/dist/chunk-F3FA4F32.js +0 -292
- package/dist/chunk-FGOEVHY3.js +0 -60
- package/dist/chunk-G3BOQPVO.js +0 -365
- package/dist/chunk-GCOK2LC3.js +0 -282
- package/dist/chunk-GJPXRJ45.js +0 -37
- package/dist/chunk-HGMJFBC7.js +0 -654
- package/dist/chunk-JAKHTMQU.js +0 -1000
- package/dist/chunk-JCI5M6U6.js +0 -956
- package/dist/chunk-K5ZUMYVS.js +0 -89
- package/dist/chunk-KQPDEVVS.js +0 -398
- package/dist/chunk-L6JRBDNS.js +0 -60
- package/dist/chunk-LA6KQEDU.js +0 -712
- package/dist/chunk-MB6QFH3I.js +0 -2776
- package/dist/chunk-MDVXJWFN.js +0 -304
- package/dist/chunk-MEZVEBPN.js +0 -2008
- package/dist/chunk-MK4ERFYL.js +0 -2249
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-MQ5GOYPH.js +0 -2249
- package/dist/chunk-MYRV7VDM.js +0 -742
- package/dist/chunk-N6IZB6KJ.js +0 -567
- package/dist/chunk-NEKUBFPT.js +0 -60
- package/dist/chunk-NMRUZALC.js +0 -1097
- package/dist/chunk-NYVAC6P5.js +0 -37
- package/dist/chunk-NZIIMDWI.js +0 -84
- package/dist/chunk-OF7UZIVB.js +0 -725
- package/dist/chunk-P3XWXJZU.js +0 -282
- package/dist/chunk-P6W3STU4.js +0 -2249
- package/dist/chunk-PBHF5WKN.js +0 -616
- package/dist/chunk-PDZQY43A.js +0 -616
- package/dist/chunk-PTQJDMRT.js +0 -146
- package/dist/chunk-PZEGYCF5.js +0 -61
- package/dist/chunk-QBMDLBU2.js +0 -975
- package/dist/chunk-QWZG56ET.js +0 -2744
- package/dist/chunk-RQGQSLQK.js +0 -725
- package/dist/chunk-SDLZDHKP.js +0 -107
- package/dist/chunk-TDGZL5CU.js +0 -365
- package/dist/chunk-TNQWPPE6.js +0 -37
- package/dist/chunk-TSOKIX5Z.js +0 -654
- package/dist/chunk-UHNL42EF.js +0 -2730
- package/dist/chunk-UNXCEF6S.js +0 -21
- package/dist/chunk-V2XTI523.js +0 -347
- package/dist/chunk-VAU366PN.js +0 -2241
- package/dist/chunk-VMVDTCXB.js +0 -712
- package/dist/chunk-VQNQZCWJ.js +0 -61
- package/dist/chunk-VRW3FULF.js +0 -725
- package/dist/chunk-WADYRCO2.js +0 -304
- package/dist/chunk-WILQZRO4.js +0 -282
- package/dist/chunk-WR5D4EGH.js +0 -26
- package/dist/chunk-WUHJISPP.js +0 -298
- package/dist/chunk-XYU6TZOW.js +0 -182
- package/dist/chunk-Y6GP4QGG.js +0 -276
- package/dist/chunk-YECR7UIA.js +0 -347
- package/dist/chunk-YUTWTI4B.js +0 -654
- package/dist/chunk-Z65KYU7I.js +0 -26
- package/dist/chunk-Z6POF5YC.js +0 -975
- package/dist/chunk-ZBJP6WFL.js +0 -482
- package/dist/chunk-ZD6OAMTH.js +0 -277
- package/dist/chunk-ZWKZCBO6.js +0 -317
- package/dist/contracts-DDrwxvJ-.d.cts +0 -245
- package/dist/contracts-DDrwxvJ-.d.ts +0 -245
- package/dist/contracts-DOrhwbke.d.cts +0 -245
- package/dist/contracts-DOrhwbke.d.ts +0 -245
- package/dist/contracts-xo5ckdRP.d.cts +0 -240
- package/dist/contracts-xo5ckdRP.d.ts +0 -240
- package/dist/customElement-BKQfbSZQ.d.cts +0 -262
- package/dist/customElement-BKQfbSZQ.d.ts +0 -262
- package/dist/customElement-D2DJp_xn.d.cts +0 -313
- package/dist/customElement-D2DJp_xn.d.ts +0 -313
- package/dist/customElement-yz8uyk-0.d.cts +0 -308
- package/dist/customElement-yz8uyk-0.d.ts +0 -308
- package/dist/introspect-Cb0zgpi2.d.cts +0 -477
- package/dist/introspect-Y2xNXGSf.d.ts +0 -477
- package/dist/plugin-Bek4RhJY.d.cts +0 -43
- package/dist/plugin-Bek4RhJY.d.ts +0 -43
- package/dist/ssr-3RXHP5ES.js +0 -38
- package/dist/ssr-6GIMY5MX.js +0 -38
- package/dist/ssr-BA6sxxUd.d.cts +0 -135
- package/dist/ssr-BA6sxxUd.d.ts +0 -135
- package/dist/ssr-WKUPVSSK.js +0 -36
- package/dist/tagFactory-Dl8QCLga.d.cts +0 -23
- package/dist/tagFactory-Dl8QCLga.d.ts +0 -23
package/dist/chunk-ZD6OAMTH.js
DELETED
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
devWarn,
|
|
3
|
-
isDev
|
|
4
|
-
} from "./chunk-5X6PP2UK.js";
|
|
5
|
-
|
|
6
|
-
// src/reactivity/track.ts
|
|
7
|
-
var _isDev = isDev();
|
|
8
|
-
var subscriberStack = new Array(32);
|
|
9
|
-
var stackCapacity = 32;
|
|
10
|
-
var stackTop = -1;
|
|
11
|
-
var currentSubscriber = null;
|
|
12
|
-
var signalSubscribers = /* @__PURE__ */ new WeakMap();
|
|
13
|
-
var SUBS = "__s";
|
|
14
|
-
var notifyDepth = 0;
|
|
15
|
-
var pendingQueue = [];
|
|
16
|
-
var pendingSet = /* @__PURE__ */ new Set();
|
|
17
|
-
function safeInvoke(sub) {
|
|
18
|
-
try {
|
|
19
|
-
sub();
|
|
20
|
-
} catch (err) {
|
|
21
|
-
if (_isDev) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
var suspendDepth = 0;
|
|
25
|
-
var trackingSuspended = false;
|
|
26
|
-
function track(effectFn, subscriber) {
|
|
27
|
-
if (!subscriber) subscriber = effectFn;
|
|
28
|
-
cleanup(subscriber);
|
|
29
|
-
++stackTop;
|
|
30
|
-
if (stackTop >= stackCapacity) {
|
|
31
|
-
stackCapacity *= 2;
|
|
32
|
-
subscriberStack.length = stackCapacity;
|
|
33
|
-
}
|
|
34
|
-
subscriberStack[stackTop] = subscriber;
|
|
35
|
-
currentSubscriber = subscriber;
|
|
36
|
-
try {
|
|
37
|
-
effectFn();
|
|
38
|
-
} finally {
|
|
39
|
-
stackTop--;
|
|
40
|
-
currentSubscriber = stackTop >= 0 ? subscriberStack[stackTop] : null;
|
|
41
|
-
}
|
|
42
|
-
return () => cleanup(subscriber);
|
|
43
|
-
}
|
|
44
|
-
function suspendTracking() {
|
|
45
|
-
if (suspendDepth === 0) {
|
|
46
|
-
++stackTop;
|
|
47
|
-
if (stackTop >= stackCapacity) {
|
|
48
|
-
stackCapacity *= 2;
|
|
49
|
-
subscriberStack.length = stackCapacity;
|
|
50
|
-
}
|
|
51
|
-
subscriberStack[stackTop] = null;
|
|
52
|
-
currentSubscriber = null;
|
|
53
|
-
trackingSuspended = true;
|
|
54
|
-
}
|
|
55
|
-
suspendDepth++;
|
|
56
|
-
}
|
|
57
|
-
function resumeTracking() {
|
|
58
|
-
suspendDepth--;
|
|
59
|
-
if (suspendDepth === 0) {
|
|
60
|
-
stackTop--;
|
|
61
|
-
currentSubscriber = stackTop >= 0 ? subscriberStack[stackTop] : null;
|
|
62
|
-
trackingSuspended = false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function untracked(fn) {
|
|
66
|
-
suspendTracking();
|
|
67
|
-
try {
|
|
68
|
-
return fn();
|
|
69
|
-
} finally {
|
|
70
|
-
resumeTracking();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function recordDependency(signal) {
|
|
74
|
-
if (!currentSubscriber) return;
|
|
75
|
-
const sub = currentSubscriber;
|
|
76
|
-
if (sub._dep === signal) return;
|
|
77
|
-
const deps = sub._deps;
|
|
78
|
-
if (deps) {
|
|
79
|
-
if (deps.has(signal)) return;
|
|
80
|
-
deps.add(signal);
|
|
81
|
-
} else if (sub._dep !== void 0) {
|
|
82
|
-
const set = /* @__PURE__ */ new Set();
|
|
83
|
-
set.add(sub._dep);
|
|
84
|
-
set.add(signal);
|
|
85
|
-
sub._deps = set;
|
|
86
|
-
sub._dep = void 0;
|
|
87
|
-
} else {
|
|
88
|
-
sub._dep = signal;
|
|
89
|
-
}
|
|
90
|
-
let subs = signal[SUBS];
|
|
91
|
-
if (!subs) {
|
|
92
|
-
subs = /* @__PURE__ */ new Set();
|
|
93
|
-
signalSubscribers.set(signal, subs);
|
|
94
|
-
signal[SUBS] = subs;
|
|
95
|
-
}
|
|
96
|
-
subs.add(currentSubscriber);
|
|
97
|
-
if (subs.size === 1) {
|
|
98
|
-
signal.__f = currentSubscriber;
|
|
99
|
-
} else if (signal.__f !== void 0) {
|
|
100
|
-
signal.__f = void 0;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function queueSignalNotification(signal) {
|
|
104
|
-
const subs = signal[SUBS];
|
|
105
|
-
if (!subs) return;
|
|
106
|
-
for (const sub of subs) {
|
|
107
|
-
if (sub._c) {
|
|
108
|
-
propagateDirty(sub);
|
|
109
|
-
} else if (!pendingSet.has(sub)) {
|
|
110
|
-
pendingSet.add(sub);
|
|
111
|
-
pendingQueue.push(sub);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
function drainNotificationQueue() {
|
|
116
|
-
if (notifyDepth > 0) return;
|
|
117
|
-
notifyDepth++;
|
|
118
|
-
try {
|
|
119
|
-
let i = 0;
|
|
120
|
-
while (i < pendingQueue.length) {
|
|
121
|
-
safeInvoke(pendingQueue[i]);
|
|
122
|
-
i++;
|
|
123
|
-
}
|
|
124
|
-
} finally {
|
|
125
|
-
pendingQueue.length = 0;
|
|
126
|
-
pendingSet.clear();
|
|
127
|
-
notifyDepth--;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function propagateDirty(sub) {
|
|
131
|
-
sub();
|
|
132
|
-
let sig = sub._sig;
|
|
133
|
-
while (sig) {
|
|
134
|
-
const first = sig.__f;
|
|
135
|
-
if (first) {
|
|
136
|
-
if (first._c) {
|
|
137
|
-
const nSig = first._sig;
|
|
138
|
-
nSig._d = true;
|
|
139
|
-
sig = nSig;
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
if (!pendingSet.has(first)) {
|
|
143
|
-
pendingSet.add(first);
|
|
144
|
-
pendingQueue.push(first);
|
|
145
|
-
}
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
const subs = sig[SUBS];
|
|
149
|
-
if (!subs) break;
|
|
150
|
-
let nextSig;
|
|
151
|
-
for (const s of subs) {
|
|
152
|
-
if (s._c) {
|
|
153
|
-
s();
|
|
154
|
-
const nSig = s._sig;
|
|
155
|
-
if (nSig && !nextSig) {
|
|
156
|
-
nextSig = nSig;
|
|
157
|
-
} else if (nSig) {
|
|
158
|
-
propagateDirty(s);
|
|
159
|
-
}
|
|
160
|
-
} else if (!pendingSet.has(s)) {
|
|
161
|
-
pendingSet.add(s);
|
|
162
|
-
pendingQueue.push(s);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
sig = nextSig;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function notifySubscribers(signal) {
|
|
169
|
-
const first = signal.__f;
|
|
170
|
-
if (first) {
|
|
171
|
-
if (notifyDepth > 0) {
|
|
172
|
-
if (first._c) {
|
|
173
|
-
propagateDirty(first);
|
|
174
|
-
} else if (!pendingSet.has(first)) {
|
|
175
|
-
pendingSet.add(first);
|
|
176
|
-
pendingQueue.push(first);
|
|
177
|
-
}
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
notifyDepth++;
|
|
181
|
-
try {
|
|
182
|
-
if (first._c) {
|
|
183
|
-
propagateDirty(first);
|
|
184
|
-
} else {
|
|
185
|
-
safeInvoke(first);
|
|
186
|
-
}
|
|
187
|
-
let i = 0;
|
|
188
|
-
while (i < pendingQueue.length) {
|
|
189
|
-
safeInvoke(pendingQueue[i]);
|
|
190
|
-
i++;
|
|
191
|
-
}
|
|
192
|
-
} finally {
|
|
193
|
-
pendingQueue.length = 0;
|
|
194
|
-
pendingSet.clear();
|
|
195
|
-
notifyDepth--;
|
|
196
|
-
}
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const subs = signal[SUBS];
|
|
200
|
-
if (!subs || subs.size === 0) return;
|
|
201
|
-
if (notifyDepth > 0) {
|
|
202
|
-
for (const sub of subs) {
|
|
203
|
-
if (sub._c) {
|
|
204
|
-
propagateDirty(sub);
|
|
205
|
-
} else if (!pendingSet.has(sub)) {
|
|
206
|
-
pendingSet.add(sub);
|
|
207
|
-
pendingQueue.push(sub);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
notifyDepth++;
|
|
213
|
-
try {
|
|
214
|
-
let directCount = 0;
|
|
215
|
-
for (const sub of subs) {
|
|
216
|
-
pendingQueue[directCount++] = sub;
|
|
217
|
-
}
|
|
218
|
-
for (let i2 = 0; i2 < directCount; i2++) {
|
|
219
|
-
if (pendingQueue[i2]._c) {
|
|
220
|
-
propagateDirty(pendingQueue[i2]);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
for (let i2 = 0; i2 < directCount; i2++) {
|
|
224
|
-
if (!pendingQueue[i2]._c) {
|
|
225
|
-
if (!pendingSet.has(pendingQueue[i2])) {
|
|
226
|
-
safeInvoke(pendingQueue[i2]);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
let i = directCount;
|
|
231
|
-
while (i < pendingQueue.length) {
|
|
232
|
-
safeInvoke(pendingQueue[i]);
|
|
233
|
-
i++;
|
|
234
|
-
}
|
|
235
|
-
} finally {
|
|
236
|
-
pendingQueue.length = 0;
|
|
237
|
-
pendingSet.clear();
|
|
238
|
-
notifyDepth--;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
function cleanup(subscriber) {
|
|
242
|
-
const sub = subscriber;
|
|
243
|
-
const singleDep = sub._dep;
|
|
244
|
-
if (singleDep !== void 0) {
|
|
245
|
-
const subs = singleDep[SUBS];
|
|
246
|
-
if (subs) {
|
|
247
|
-
subs.delete(subscriber);
|
|
248
|
-
if (singleDep.__f === subscriber) {
|
|
249
|
-
singleDep.__f = void 0;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
sub._dep = void 0;
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
const deps = sub._deps;
|
|
256
|
-
if (!deps || deps.size === 0) return;
|
|
257
|
-
for (const signal of deps) {
|
|
258
|
-
const subs = signal[SUBS];
|
|
259
|
-
if (subs) {
|
|
260
|
-
subs.delete(subscriber);
|
|
261
|
-
if (signal.__f === subscriber) {
|
|
262
|
-
signal.__f = void 0;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
deps.clear();
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
export {
|
|
270
|
-
trackingSuspended,
|
|
271
|
-
track,
|
|
272
|
-
untracked,
|
|
273
|
-
recordDependency,
|
|
274
|
-
queueSignalNotification,
|
|
275
|
-
drainNotificationQueue,
|
|
276
|
-
notifySubscribers
|
|
277
|
-
};
|
package/dist/chunk-ZWKZCBO6.js
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
derived
|
|
3
|
-
} from "./chunk-NEKUBFPT.js";
|
|
4
|
-
import {
|
|
5
|
-
effect
|
|
6
|
-
} from "./chunk-CHF5OHIA.js";
|
|
7
|
-
import {
|
|
8
|
-
signal
|
|
9
|
-
} from "./chunk-WZSPOOER.js";
|
|
10
|
-
|
|
11
|
-
// src/patterns/machine.ts
|
|
12
|
-
function machine(config) {
|
|
13
|
-
const [state, setState] = signal(config.initial);
|
|
14
|
-
const [context, setContext] = signal(config.context || {});
|
|
15
|
-
const initialDef = config.states[config.initial];
|
|
16
|
-
if (initialDef?.entry) {
|
|
17
|
-
initialDef.entry(context());
|
|
18
|
-
}
|
|
19
|
-
function send(event) {
|
|
20
|
-
const currentState = state();
|
|
21
|
-
const stateDef = config.states[currentState];
|
|
22
|
-
if (!stateDef?.on) return;
|
|
23
|
-
const transition = stateDef.on[event];
|
|
24
|
-
if (!transition) return;
|
|
25
|
-
let target;
|
|
26
|
-
let guard;
|
|
27
|
-
let action;
|
|
28
|
-
if (typeof transition === "string") {
|
|
29
|
-
target = transition;
|
|
30
|
-
} else {
|
|
31
|
-
target = transition.target;
|
|
32
|
-
guard = transition.guard;
|
|
33
|
-
action = transition.action;
|
|
34
|
-
}
|
|
35
|
-
const ctx = context();
|
|
36
|
-
if (guard && !guard(ctx)) return;
|
|
37
|
-
if (stateDef.exit) {
|
|
38
|
-
stateDef.exit(ctx);
|
|
39
|
-
}
|
|
40
|
-
if (action) {
|
|
41
|
-
const rawPatch = action(ctx);
|
|
42
|
-
const next = { ...ctx };
|
|
43
|
-
for (const key of Object.keys(rawPatch)) {
|
|
44
|
-
if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
|
|
45
|
-
next[key] = rawPatch[key];
|
|
46
|
-
}
|
|
47
|
-
setContext(next);
|
|
48
|
-
}
|
|
49
|
-
setState(target);
|
|
50
|
-
const targetDef = config.states[target];
|
|
51
|
-
if (targetDef?.entry) {
|
|
52
|
-
targetDef.entry(context());
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function matches(s) {
|
|
56
|
-
return state() === s;
|
|
57
|
-
}
|
|
58
|
-
function can(event) {
|
|
59
|
-
const currentState = state();
|
|
60
|
-
const stateDef = config.states[currentState];
|
|
61
|
-
if (!stateDef?.on) return false;
|
|
62
|
-
const transition = stateDef.on[event];
|
|
63
|
-
if (!transition) return false;
|
|
64
|
-
if (typeof transition === "string") return true;
|
|
65
|
-
if (transition.guard) {
|
|
66
|
-
return transition.guard(context());
|
|
67
|
-
}
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
return { state, context, send, matches, can };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/patterns/persist.ts
|
|
74
|
-
function persisted(key, initial, options = {}) {
|
|
75
|
-
const storage = options.session ? sessionStorage : localStorage;
|
|
76
|
-
const serialize = options.serialize || JSON.stringify;
|
|
77
|
-
const deserialize = options.deserialize || JSON.parse;
|
|
78
|
-
const encrypt = options.encrypt;
|
|
79
|
-
const decrypt = options.decrypt;
|
|
80
|
-
const syncTabs = options.session ? false : options.syncTabs ?? true;
|
|
81
|
-
let restored = initial;
|
|
82
|
-
try {
|
|
83
|
-
let raw = storage.getItem(key);
|
|
84
|
-
if (raw !== null) {
|
|
85
|
-
if (decrypt) raw = decrypt(raw);
|
|
86
|
-
const parsed = deserialize(raw);
|
|
87
|
-
restored = options.validate && !options.validate(parsed) ? initial : parsed;
|
|
88
|
-
}
|
|
89
|
-
} catch {
|
|
90
|
-
}
|
|
91
|
-
const [value, setValue] = signal(restored);
|
|
92
|
-
let applyingFromStorage = false;
|
|
93
|
-
effect(() => {
|
|
94
|
-
const current = value();
|
|
95
|
-
if (applyingFromStorage) return;
|
|
96
|
-
try {
|
|
97
|
-
let serialized = serialize(current);
|
|
98
|
-
if (encrypt) serialized = encrypt(serialized);
|
|
99
|
-
storage.setItem(key, serialized);
|
|
100
|
-
} catch {
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
let storageListener = null;
|
|
104
|
-
if (syncTabs && typeof window !== "undefined") {
|
|
105
|
-
storageListener = (e) => {
|
|
106
|
-
if (e.storageArea !== storage || e.key !== key) return;
|
|
107
|
-
if (e.newValue === null) {
|
|
108
|
-
applyingFromStorage = true;
|
|
109
|
-
try {
|
|
110
|
-
setValue(initial);
|
|
111
|
-
} finally {
|
|
112
|
-
applyingFromStorage = false;
|
|
113
|
-
}
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
try {
|
|
117
|
-
let raw = e.newValue;
|
|
118
|
-
if (decrypt) raw = decrypt(raw);
|
|
119
|
-
const parsed = deserialize(raw);
|
|
120
|
-
if (options.validate && !options.validate(parsed)) return;
|
|
121
|
-
applyingFromStorage = true;
|
|
122
|
-
try {
|
|
123
|
-
setValue(parsed);
|
|
124
|
-
} finally {
|
|
125
|
-
applyingFromStorage = false;
|
|
126
|
-
}
|
|
127
|
-
} catch {
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
window.addEventListener("storage", storageListener);
|
|
131
|
-
}
|
|
132
|
-
const dispose = () => {
|
|
133
|
-
if (storageListener && typeof window !== "undefined") {
|
|
134
|
-
window.removeEventListener("storage", storageListener);
|
|
135
|
-
storageListener = null;
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
Object.defineProperty(setValue, "dispose", {
|
|
139
|
-
value: dispose,
|
|
140
|
-
enumerable: false,
|
|
141
|
-
writable: false,
|
|
142
|
-
configurable: false
|
|
143
|
-
});
|
|
144
|
-
return [value, setValue];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// src/patterns/optimistic.ts
|
|
148
|
-
function optimistic(initialValue) {
|
|
149
|
-
const [value, setValue] = signal(initialValue);
|
|
150
|
-
const [_pending, setPending] = signal(false);
|
|
151
|
-
async function addOptimistic(optimisticValue, asyncAction) {
|
|
152
|
-
const previousValue = value();
|
|
153
|
-
setValue(optimisticValue);
|
|
154
|
-
setPending(true);
|
|
155
|
-
try {
|
|
156
|
-
const result = await asyncAction();
|
|
157
|
-
setValue(result);
|
|
158
|
-
} catch {
|
|
159
|
-
setValue(previousValue);
|
|
160
|
-
} finally {
|
|
161
|
-
setPending(false);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return [value, addOptimistic];
|
|
165
|
-
}
|
|
166
|
-
function optimisticList(initialValue) {
|
|
167
|
-
const [items, setItems] = signal([...initialValue]);
|
|
168
|
-
async function addOptimistic(item, asyncAction) {
|
|
169
|
-
const prev = items();
|
|
170
|
-
setItems([...prev, item]);
|
|
171
|
-
try {
|
|
172
|
-
const result = await asyncAction();
|
|
173
|
-
setItems((current) => {
|
|
174
|
-
const idx = current.lastIndexOf(item);
|
|
175
|
-
if (idx >= 0) {
|
|
176
|
-
const next = [...current];
|
|
177
|
-
next[idx] = result;
|
|
178
|
-
return next;
|
|
179
|
-
}
|
|
180
|
-
return [...current.filter((i) => i !== item), result];
|
|
181
|
-
});
|
|
182
|
-
} catch {
|
|
183
|
-
setItems(prev);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
async function removeOptimistic(predicate, asyncAction) {
|
|
187
|
-
const prev = items();
|
|
188
|
-
setItems(prev.filter((item) => !predicate(item)));
|
|
189
|
-
try {
|
|
190
|
-
await asyncAction();
|
|
191
|
-
} catch {
|
|
192
|
-
setItems(prev);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
async function updateOptimistic(predicate, update, asyncAction) {
|
|
196
|
-
const prev = items();
|
|
197
|
-
setItems(prev.map((item) => predicate(item) ? { ...item, ...update } : item));
|
|
198
|
-
try {
|
|
199
|
-
const result = await asyncAction();
|
|
200
|
-
setItems((current) => current.map((item) => predicate(item) ? result : item));
|
|
201
|
-
} catch {
|
|
202
|
-
setItems(prev);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return { items, addOptimistic, removeOptimistic, updateOptimistic };
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// src/patterns/timeTravel.ts
|
|
209
|
-
function timeline(initial, maxHistory = 100) {
|
|
210
|
-
const [history, setHistory] = signal([initial]);
|
|
211
|
-
const [index, setIndex] = signal(0);
|
|
212
|
-
const value = derived(() => history()[index()]);
|
|
213
|
-
const canUndo = derived(() => index() > 0);
|
|
214
|
-
const canRedo = derived(() => index() < history().length - 1);
|
|
215
|
-
function set(next) {
|
|
216
|
-
const current = value();
|
|
217
|
-
const newValue = typeof next === "function" ? next(current) : next;
|
|
218
|
-
if (Object.is(newValue, current)) return;
|
|
219
|
-
const hist = history();
|
|
220
|
-
const idx = index();
|
|
221
|
-
const newHistory = hist.slice(0, idx + 1);
|
|
222
|
-
newHistory.push(newValue);
|
|
223
|
-
if (newHistory.length > maxHistory) {
|
|
224
|
-
newHistory.shift();
|
|
225
|
-
setHistory(newHistory);
|
|
226
|
-
setIndex(newHistory.length - 1);
|
|
227
|
-
} else {
|
|
228
|
-
setHistory(newHistory);
|
|
229
|
-
setIndex(idx + 1);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
function undo() {
|
|
233
|
-
if (canUndo()) {
|
|
234
|
-
setIndex(index() - 1);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
function redo() {
|
|
238
|
-
if (canRedo()) {
|
|
239
|
-
setIndex(index() + 1);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
function reset() {
|
|
243
|
-
setHistory([initial]);
|
|
244
|
-
setIndex(0);
|
|
245
|
-
}
|
|
246
|
-
function jumpTo(targetIndex) {
|
|
247
|
-
const hist = history();
|
|
248
|
-
if (targetIndex >= 0 && targetIndex < hist.length) {
|
|
249
|
-
setIndex(targetIndex);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return { value, set, undo, redo, canUndo, canRedo, history, index, reset, jumpTo };
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// src/patterns/globalStore.ts
|
|
256
|
-
function globalStore(config) {
|
|
257
|
-
const initialState = { ...config.state };
|
|
258
|
-
const [getState, setState] = signal({ ...initialState });
|
|
259
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
260
|
-
const middlewares = config.middleware || [];
|
|
261
|
-
function dispatch(action, payload) {
|
|
262
|
-
const actionFn = config.actions[action];
|
|
263
|
-
if (!actionFn) throw new Error(`Unknown action: ${String(action)}`);
|
|
264
|
-
const execute = () => {
|
|
265
|
-
const current = getState();
|
|
266
|
-
const rawPatch = actionFn(current, payload);
|
|
267
|
-
const patch = {};
|
|
268
|
-
for (const key of Object.keys(rawPatch)) {
|
|
269
|
-
if (key !== "__proto__" && key !== "constructor" && key !== "prototype") {
|
|
270
|
-
patch[key] = rawPatch[key];
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
setState({ ...current, ...patch });
|
|
274
|
-
const newState = getState();
|
|
275
|
-
for (const listener of listeners) {
|
|
276
|
-
listener(newState);
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
if (middlewares.length === 0) {
|
|
280
|
-
execute();
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
let index = 0;
|
|
284
|
-
const next = () => {
|
|
285
|
-
if (index < middlewares.length) {
|
|
286
|
-
const mw = middlewares[index++];
|
|
287
|
-
mw(getState(), String(action), payload, next);
|
|
288
|
-
} else {
|
|
289
|
-
execute();
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
next();
|
|
293
|
-
}
|
|
294
|
-
function select(selector) {
|
|
295
|
-
return derived(() => selector(getState()));
|
|
296
|
-
}
|
|
297
|
-
function subscribe(callback) {
|
|
298
|
-
listeners.add(callback);
|
|
299
|
-
return () => listeners.delete(callback);
|
|
300
|
-
}
|
|
301
|
-
function reset() {
|
|
302
|
-
setState({ ...initialState });
|
|
303
|
-
for (const listener of listeners) {
|
|
304
|
-
listener(getState());
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return { getState, select, dispatch, subscribe, reset };
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export {
|
|
311
|
-
machine,
|
|
312
|
-
persisted,
|
|
313
|
-
optimistic,
|
|
314
|
-
optimisticList,
|
|
315
|
-
timeline,
|
|
316
|
-
globalStore
|
|
317
|
-
};
|