sibujs 4.5.0 → 4.7.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/README.md +1 -1
- package/dist/browser.cjs +326 -133
- package/dist/browser.d.cts +46 -14
- package/dist/browser.d.ts +46 -14
- package/dist/browser.js +8 -6
- package/dist/build.cjs +2094 -1033
- package/dist/build.d.cts +133 -44
- package/dist/build.d.ts +133 -44
- package/dist/build.js +1372 -574
- package/dist/cdn.dev.global.js +10 -10
- package/dist/cdn.full.dev.global.js +11 -11
- package/dist/cdn.full.global.js +10 -10
- package/dist/cdn.global.js +10 -10
- package/dist/{chunk-2DCGACUU.js → chunk-2BPG2XDA.js} +251 -66
- package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
- package/dist/{chunk-4PMLNECI.js → chunk-3QWBSL5R.js} +98 -29
- package/dist/{chunk-KKLW7YWL.js → chunk-4AWA2PVD.js} +275 -144
- package/dist/chunk-5HZXGZ6T.js +24 -0
- package/dist/{chunk-PCT43HW3.js → chunk-7LUJQAOJ.js} +1 -1
- package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
- package/dist/chunk-BC2SECJD.js +44 -0
- package/dist/{chunk-TBYTO6BS.js → chunk-BSY63EM6.js} +136 -80
- package/dist/{chunk-FTIR4QW2.js → chunk-DKXRACVN.js} +6 -8
- package/dist/{chunk-ONOHFDLG.js → chunk-FNJXNGYZ.js} +3 -3
- package/dist/{chunk-XZZOBQAY.js → chunk-FQRUXCEE.js} +6 -5
- package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
- package/dist/chunk-J6FW5TV6.js +233 -0
- package/dist/{chunk-UGRX3S57.js → chunk-JWKYU5GV.js} +22 -4
- package/dist/chunk-NYNYSPK7.js +318 -0
- package/dist/{chunk-RBTPLM32.js → chunk-RUSSKG6G.js} +13 -12
- package/dist/{chunk-7LN645I6.js → chunk-SLM3IA34.js} +3 -3
- package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
- package/dist/{chunk-B3WHI2QA.js → chunk-UNWRJRKC.js} +55 -31
- package/dist/{chunk-KEISJXBU.js → chunk-UOL2ECCS.js} +44 -17
- package/dist/{chunk-RJE2BNI4.js → chunk-VZSG24LS.js} +108 -45
- package/dist/{chunk-RIXRAYIU.js → chunk-WEQ3DMVL.js} +10 -4
- package/dist/{chunk-3JZ4L5TJ.js → chunk-WOLJZUFQ.js} +354 -90
- package/dist/{chunk-S373NSMK.js → chunk-XYV3EDB7.js} +283 -123
- package/dist/{chunk-VZKNK2V7.js → chunk-XZR4PXRE.js} +296 -38
- package/dist/{chunk-GW3SCCZG.js → chunk-Z3OHK6QT.js} +153 -110
- package/dist/{chunk-OMJJM3KM.js → chunk-ZVL7TY4K.js} +287 -130
- package/dist/{contracts-DBdg9J_a.d.ts → contracts-CLqzJnOV.d.ts} +36 -17
- package/dist/{contracts-DBdg9J_a.d.cts → contracts-CTOJXu-x.d.cts} +36 -17
- package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
- package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
- package/dist/data.cjs +410 -155
- package/dist/data.d.cts +166 -12
- package/dist/data.d.ts +166 -12
- package/dist/data.js +12 -9
- package/dist/devtools.cjs +98 -61
- package/dist/devtools.js +7 -8
- package/dist/dispose-GEIG2KOF.js +28 -0
- package/dist/ecosystem.cjs +372 -126
- package/dist/ecosystem.d.cts +20 -3
- package/dist/ecosystem.d.ts +20 -3
- package/dist/ecosystem.js +12 -12
- package/dist/extras.cjs +2366 -909
- package/dist/extras.d.cts +11 -9
- package/dist/extras.d.ts +11 -9
- package/dist/extras.js +39 -28
- package/dist/index.cjs +421 -158
- package/dist/index.d.cts +213 -171
- package/dist/index.d.ts +213 -171
- package/dist/index.js +24 -27
- package/dist/motion.cjs +118 -44
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +344 -53
- package/dist/patterns.d.cts +28 -9
- package/dist/patterns.d.ts +28 -9
- package/dist/patterns.js +8 -8
- package/dist/performance.cjs +325 -220
- package/dist/performance.d.cts +2 -2
- package/dist/performance.d.ts +2 -2
- package/dist/performance.js +8 -9
- package/dist/plugin-DVgSnTfK.d.cts +112 -0
- package/dist/plugin-DVgSnTfK.d.ts +112 -0
- package/dist/plugins.cjs +664 -233
- package/dist/plugins.d.cts +127 -14
- package/dist/plugins.d.ts +127 -14
- package/dist/plugins.js +96 -42
- package/dist/signal-EotCj4hS.d.cts +110 -0
- package/dist/signal-EotCj4hS.d.ts +110 -0
- package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
- package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
- package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
- package/dist/ssr.cjs +229 -84
- package/dist/ssr.d.cts +9 -3
- package/dist/ssr.d.ts +9 -3
- package/dist/ssr.js +11 -12
- package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
- package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
- package/dist/tagFactory-8qL9LCIx.d.cts +156 -0
- package/dist/tagFactory-BL2fymez.d.ts +156 -0
- package/dist/testing.cjs +2503 -2191
- package/dist/testing.d.cts +56 -5
- package/dist/testing.d.ts +56 -5
- package/dist/testing.js +580 -307
- package/dist/types-CJFViL6Q.d.cts +26 -0
- package/dist/types-CJFViL6Q.d.ts +26 -0
- package/dist/ui.cjs +732 -329
- package/dist/ui.d.cts +41 -7
- package/dist/ui.d.ts +41 -7
- package/dist/ui.js +151 -56
- package/dist/widgets.cjs +267 -291
- package/dist/widgets.js +9 -10
- package/package.json +4 -2
- package/dist/chunk-2WLZ6757.js +0 -149
- package/dist/chunk-CCSJMTRN.js +0 -15
- package/dist/chunk-QKRPLZ2V.js +0 -108
- package/dist/chunk-VUF4ALSW.js +0 -60
- package/dist/chunk-WWV3SJ3L.js +0 -131
- package/dist/dispose-46BOMMQJ.js +0 -19
- package/dist/plugin-D30wlGW5.d.cts +0 -71
- package/dist/plugin-D30wlGW5.d.ts +0 -71
- package/dist/tagFactory-DVoDpHye.d.cts +0 -215
- package/dist/tagFactory-DVoDpHye.d.ts +0 -215
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
catchError,
|
|
15
15
|
catchErrorAsync,
|
|
16
16
|
clickOutside,
|
|
17
|
+
context,
|
|
17
18
|
copyOnClick,
|
|
18
19
|
deepEqual,
|
|
19
20
|
deepSignal,
|
|
@@ -52,7 +53,7 @@ import {
|
|
|
52
53
|
unregisterIsland,
|
|
53
54
|
when,
|
|
54
55
|
writable
|
|
55
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-XYV3EDB7.js";
|
|
56
57
|
import {
|
|
57
58
|
a,
|
|
58
59
|
abbr,
|
|
@@ -190,36 +191,33 @@ import {
|
|
|
190
191
|
use,
|
|
191
192
|
var_,
|
|
192
193
|
video
|
|
193
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-7LUJQAOJ.js";
|
|
194
195
|
import {
|
|
195
196
|
trustHTML
|
|
196
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-HURREPU2.js";
|
|
197
198
|
import {
|
|
198
199
|
watch
|
|
199
|
-
} from "./chunk-
|
|
200
|
+
} from "./chunk-SLM3IA34.js";
|
|
200
201
|
import {
|
|
201
202
|
__resetIdCounter,
|
|
202
203
|
createId
|
|
203
|
-
} from "./chunk-
|
|
204
|
-
import {
|
|
205
|
-
context
|
|
206
|
-
} from "./chunk-VUF4ALSW.js";
|
|
204
|
+
} from "./chunk-BC2SECJD.js";
|
|
207
205
|
import {
|
|
208
206
|
SVG_NS,
|
|
209
207
|
tagFactory
|
|
210
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-UOL2ECCS.js";
|
|
211
209
|
import {
|
|
212
210
|
bindDynamic
|
|
213
|
-
} from "./chunk-
|
|
211
|
+
} from "./chunk-FNJXNGYZ.js";
|
|
214
212
|
import {
|
|
215
213
|
derived
|
|
216
|
-
} from "./chunk-
|
|
217
|
-
import "./chunk-
|
|
214
|
+
} from "./chunk-RUSSKG6G.js";
|
|
215
|
+
import "./chunk-2INLLLMZ.js";
|
|
218
216
|
import "./chunk-7ZHH77QA.js";
|
|
219
217
|
import {
|
|
220
218
|
effect,
|
|
221
219
|
on
|
|
222
|
-
} from "./chunk-
|
|
220
|
+
} from "./chunk-WEQ3DMVL.js";
|
|
223
221
|
import {
|
|
224
222
|
disableSSR,
|
|
225
223
|
enableSSR,
|
|
@@ -228,33 +226,32 @@ import {
|
|
|
228
226
|
isSSR,
|
|
229
227
|
runInSSRContext,
|
|
230
228
|
withSSR
|
|
231
|
-
} from "./chunk-
|
|
232
|
-
import
|
|
233
|
-
MAX_DRAIN_TEARDOWNS,
|
|
234
|
-
checkLeaks,
|
|
235
|
-
dispose,
|
|
236
|
-
registerDisposer,
|
|
237
|
-
replaceChildrenSafely,
|
|
238
|
-
reportDrainRunaway,
|
|
239
|
-
unregisterDisposer
|
|
240
|
-
} from "./chunk-QKRPLZ2V.js";
|
|
229
|
+
} from "./chunk-7XHATCIH.js";
|
|
230
|
+
import "./chunk-5HZXGZ6T.js";
|
|
241
231
|
import {
|
|
242
232
|
batch,
|
|
243
233
|
enqueueBatchedSignal,
|
|
244
234
|
external,
|
|
245
235
|
isBatching,
|
|
246
236
|
signal
|
|
247
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-FQRUXCEE.js";
|
|
248
238
|
import {
|
|
249
239
|
retrack,
|
|
250
240
|
setMaxDrainIterations,
|
|
251
241
|
untracked
|
|
252
|
-
} from "./chunk-
|
|
242
|
+
} from "./chunk-JWKYU5GV.js";
|
|
253
243
|
import {
|
|
244
|
+
MAX_DRAIN_TEARDOWNS,
|
|
245
|
+
checkLeaks,
|
|
246
|
+
dispose,
|
|
254
247
|
getRuntimeErrorHandler,
|
|
248
|
+
registerDisposer,
|
|
249
|
+
replaceChildrenSafely,
|
|
250
|
+
reportDrainRunaway,
|
|
255
251
|
reportError,
|
|
256
|
-
setRuntimeErrorHandler
|
|
257
|
-
|
|
252
|
+
setRuntimeErrorHandler,
|
|
253
|
+
unregisterDisposer
|
|
254
|
+
} from "./chunk-NYNYSPK7.js";
|
|
258
255
|
export {
|
|
259
256
|
DynamicComponent,
|
|
260
257
|
ErrorBoundary,
|
package/dist/motion.cjs
CHANGED
|
@@ -44,17 +44,6 @@ __export(motion_exports, {
|
|
|
44
44
|
});
|
|
45
45
|
module.exports = __toCommonJS(motion_exports);
|
|
46
46
|
|
|
47
|
-
// src/core/dev.ts
|
|
48
|
-
var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
|
|
49
|
-
// safe default: off in browser, on in test/dev Node
|
|
50
|
-
typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
51
|
-
);
|
|
52
|
-
function devWarn(message) {
|
|
53
|
-
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
54
|
-
console.warn(`[SibuJS] ${message}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
47
|
// src/core/errors.ts
|
|
59
48
|
var ERROR_STATE_KEY = /* @__PURE__ */ Symbol.for("sibujs.runtime-errors.v1");
|
|
60
49
|
function state() {
|
|
@@ -143,9 +132,37 @@ function reportError(error, context) {
|
|
|
143
132
|
});
|
|
144
133
|
}
|
|
145
134
|
|
|
135
|
+
// src/core/dev.ts
|
|
136
|
+
var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
|
|
137
|
+
// safe default: off in browser, on in test/dev Node
|
|
138
|
+
typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
139
|
+
);
|
|
140
|
+
function devWarn(message) {
|
|
141
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
142
|
+
console.warn(`[SibuJS] ${message}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
146
|
// src/core/rendering/dispose.ts
|
|
147
147
|
var elementDisposers = /* @__PURE__ */ new WeakMap();
|
|
148
148
|
var activeBindingCount = 0;
|
|
149
|
+
function resolveCapture(capture) {
|
|
150
|
+
let frame = capture;
|
|
151
|
+
while (frame?.closed) frame = frame.forwardTo;
|
|
152
|
+
return frame ?? null;
|
|
153
|
+
}
|
|
154
|
+
var registrationCaptures = [];
|
|
155
|
+
function currentDisposerCapture() {
|
|
156
|
+
return resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
157
|
+
}
|
|
158
|
+
function beginDisposerCapture(capture) {
|
|
159
|
+
if (capture === null && registrationCaptures.length === 0) return false;
|
|
160
|
+
registrationCaptures.push(resolveCapture(capture));
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
function endDisposerCapture() {
|
|
164
|
+
registrationCaptures.pop();
|
|
165
|
+
}
|
|
149
166
|
function registerDisposer(node, teardown) {
|
|
150
167
|
let disposers = elementDisposers.get(node);
|
|
151
168
|
if (!disposers) {
|
|
@@ -154,6 +171,8 @@ function registerDisposer(node, teardown) {
|
|
|
154
171
|
}
|
|
155
172
|
disposers.push(teardown);
|
|
156
173
|
if (DEV) activeBindingCount++;
|
|
174
|
+
const capture = resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
175
|
+
if (capture) capture.entries.push([node, teardown]);
|
|
157
176
|
}
|
|
158
177
|
|
|
159
178
|
// src/ui/transition.ts
|
|
@@ -183,6 +202,15 @@ function transition(element, options = {}) {
|
|
|
183
202
|
resolvePrev();
|
|
184
203
|
}
|
|
185
204
|
}
|
|
205
|
+
function complete(callback, name, resolve) {
|
|
206
|
+
try {
|
|
207
|
+
callback?.();
|
|
208
|
+
} catch (error) {
|
|
209
|
+
reportError(error, { phase: "async", name, node: element });
|
|
210
|
+
} finally {
|
|
211
|
+
resolve();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
186
214
|
function enter() {
|
|
187
215
|
return new Promise((resolve) => {
|
|
188
216
|
cancelPending();
|
|
@@ -195,8 +223,7 @@ function transition(element, options = {}) {
|
|
|
195
223
|
activeTimer = null;
|
|
196
224
|
pendingResolve = null;
|
|
197
225
|
if (enterClass) element.classList.remove(enterClass);
|
|
198
|
-
onEnterDone
|
|
199
|
-
resolve();
|
|
226
|
+
complete(onEnterDone, "transition(onEnterDone)", resolve);
|
|
200
227
|
};
|
|
201
228
|
if (duration > 0) {
|
|
202
229
|
pendingResolve = resolve;
|
|
@@ -217,8 +244,7 @@ function transition(element, options = {}) {
|
|
|
217
244
|
activeTimer = null;
|
|
218
245
|
pendingResolve = null;
|
|
219
246
|
if (leaveClass) element.classList.remove(leaveClass);
|
|
220
|
-
onLeaveDone
|
|
221
|
-
resolve();
|
|
247
|
+
complete(onLeaveDone, "transition(onLeaveDone)", resolve);
|
|
222
248
|
};
|
|
223
249
|
if (duration > 0) {
|
|
224
250
|
pendingResolve = resolve;
|
|
@@ -402,6 +428,7 @@ function retrack(effectFn, subscriber) {
|
|
|
402
428
|
}
|
|
403
429
|
currentSubscriber = subscriber;
|
|
404
430
|
const sub = subscriber;
|
|
431
|
+
if (sub._cap === void 0) sub._cap = currentDisposerCapture();
|
|
405
432
|
const epoch = ++subscriberEpochCounter;
|
|
406
433
|
sub._epoch = epoch;
|
|
407
434
|
sub._structDirty = false;
|
|
@@ -593,7 +620,12 @@ function drainQueue() {
|
|
|
593
620
|
quarantined.add(sub);
|
|
594
621
|
continue;
|
|
595
622
|
}
|
|
596
|
-
|
|
623
|
+
const pushed = beginDisposerCapture(sub._cap ?? null);
|
|
624
|
+
try {
|
|
625
|
+
safeInvoke(sub);
|
|
626
|
+
} finally {
|
|
627
|
+
if (pushed) endDisposerCapture();
|
|
628
|
+
}
|
|
597
629
|
}
|
|
598
630
|
}
|
|
599
631
|
function drainNotificationQueue() {
|
|
@@ -729,7 +761,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
729
761
|
}
|
|
730
762
|
|
|
731
763
|
// src/reactivity/track.ts
|
|
732
|
-
var _runtimeVersion = true ? "4.
|
|
764
|
+
var _runtimeVersion = true ? "4.7.0" : "dev";
|
|
733
765
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
734
766
|
function resolveReactiveApi() {
|
|
735
767
|
const g = globalThis;
|
|
@@ -835,6 +867,14 @@ var batch = API2.batch;
|
|
|
835
867
|
var enqueueBatchedSignal = API2.enqueueBatchedSignal;
|
|
836
868
|
var isBatching = API2.isBatching;
|
|
837
869
|
|
|
870
|
+
// src/core/devtoolsHook.ts
|
|
871
|
+
function emitDevtools(hook, event, payload) {
|
|
872
|
+
try {
|
|
873
|
+
hook.emit(event, payload);
|
|
874
|
+
} catch {
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
|
|
838
878
|
// src/core/signals/signal.ts
|
|
839
879
|
var _g = globalThis;
|
|
840
880
|
function signal(initial, options) {
|
|
@@ -868,7 +908,7 @@ function signal(initial, options) {
|
|
|
868
908
|
state2.__v++;
|
|
869
909
|
if (DEV) {
|
|
870
910
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
871
|
-
if (hook) hook
|
|
911
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
|
|
872
912
|
}
|
|
873
913
|
if (!enqueueBatchedSignal(state2)) {
|
|
874
914
|
notifySubscribers2(state2);
|
|
@@ -882,7 +922,7 @@ function signal(initial, options) {
|
|
|
882
922
|
state2.value = newValue;
|
|
883
923
|
state2.__v++;
|
|
884
924
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
885
|
-
if (hook) hook
|
|
925
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state2, name: debugName, oldValue: prev, newValue });
|
|
886
926
|
if (!enqueueBatchedSignal(state2)) {
|
|
887
927
|
notifySubscribers2(state2);
|
|
888
928
|
}
|
|
@@ -901,7 +941,7 @@ function signal(initial, options) {
|
|
|
901
941
|
}
|
|
902
942
|
if (DEV) {
|
|
903
943
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
904
|
-
if (hook) hook
|
|
944
|
+
if (hook) emitDevtools(hook, "signal:create", { signal: state2, name: debugName, getter: get, initial });
|
|
905
945
|
}
|
|
906
946
|
return [get, set];
|
|
907
947
|
}
|
|
@@ -1083,22 +1123,54 @@ async function sequence(steps) {
|
|
|
1083
1123
|
}
|
|
1084
1124
|
}
|
|
1085
1125
|
|
|
1126
|
+
// src/utils/adoptThenable.ts
|
|
1127
|
+
function adoptThenable(value) {
|
|
1128
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") return null;
|
|
1129
|
+
let then;
|
|
1130
|
+
try {
|
|
1131
|
+
then = value.then;
|
|
1132
|
+
} catch (error) {
|
|
1133
|
+
return Promise.reject(error);
|
|
1134
|
+
}
|
|
1135
|
+
if (typeof then !== "function") return null;
|
|
1136
|
+
return new Promise((resolve, reject) => {
|
|
1137
|
+
queueMicrotask(() => {
|
|
1138
|
+
try {
|
|
1139
|
+
Reflect.apply(then, value, [resolve, reject]);
|
|
1140
|
+
} catch (error) {
|
|
1141
|
+
reject(error);
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1086
1147
|
// src/ui/TransitionGroup.ts
|
|
1087
1148
|
function TransitionGroup(options) {
|
|
1088
1149
|
const [elements, setElements] = signal([]);
|
|
1089
1150
|
const positions = /* @__PURE__ */ new Map();
|
|
1151
|
+
function runCallback(name, callback, el) {
|
|
1152
|
+
const report = (error) => reportError(error, { phase: "async", name: `TransitionGroup.${name}`, node: el });
|
|
1153
|
+
try {
|
|
1154
|
+
adoptThenable(callback(el))?.then(void 0, report);
|
|
1155
|
+
} catch (error) {
|
|
1156
|
+
report(error);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1090
1159
|
function add(el) {
|
|
1091
1160
|
setElements((prev) => [...prev, el]);
|
|
1092
|
-
if (options.enter)
|
|
1093
|
-
options.enter(el);
|
|
1094
|
-
}
|
|
1161
|
+
if (options.enter) runCallback("enter", options.enter, el);
|
|
1095
1162
|
}
|
|
1096
1163
|
async function remove(el) {
|
|
1097
|
-
|
|
1098
|
-
|
|
1164
|
+
try {
|
|
1165
|
+
if (options.leave) {
|
|
1166
|
+
await adoptThenable(options.leave(el));
|
|
1167
|
+
}
|
|
1168
|
+
} catch (error) {
|
|
1169
|
+
reportError(error, { phase: "async", name: "TransitionGroup.leave", node: el });
|
|
1170
|
+
} finally {
|
|
1171
|
+
positions.delete(el);
|
|
1172
|
+
setElements((prev) => prev.filter((e) => e !== el));
|
|
1099
1173
|
}
|
|
1100
|
-
positions.delete(el);
|
|
1101
|
-
setElements((prev) => prev.filter((e) => e !== el));
|
|
1102
1174
|
}
|
|
1103
1175
|
function track3(newElements) {
|
|
1104
1176
|
const oldPositions = /* @__PURE__ */ new Map();
|
|
@@ -1110,17 +1182,13 @@ function TransitionGroup(options) {
|
|
|
1110
1182
|
const currentSet = new Set(elements());
|
|
1111
1183
|
for (const el of newElements) {
|
|
1112
1184
|
if (!currentSet.has(el)) {
|
|
1113
|
-
if (options.enter)
|
|
1114
|
-
options.enter(el);
|
|
1115
|
-
}
|
|
1185
|
+
if (options.enter) runCallback("enter", options.enter, el);
|
|
1116
1186
|
}
|
|
1117
1187
|
}
|
|
1118
1188
|
const newSet = new Set(newElements);
|
|
1119
1189
|
for (const el of elements()) {
|
|
1120
1190
|
if (!newSet.has(el)) {
|
|
1121
|
-
if (options.leave)
|
|
1122
|
-
options.leave(el);
|
|
1123
|
-
}
|
|
1191
|
+
if (options.leave) runCallback("leave", options.leave, el);
|
|
1124
1192
|
}
|
|
1125
1193
|
}
|
|
1126
1194
|
setElements(newElements);
|
|
@@ -1130,7 +1198,7 @@ function TransitionGroup(options) {
|
|
|
1130
1198
|
if (oldRect && typeof el.getBoundingClientRect === "function") {
|
|
1131
1199
|
const newRect = el.getBoundingClientRect();
|
|
1132
1200
|
if (oldRect.left !== newRect.left || oldRect.top !== newRect.top) {
|
|
1133
|
-
options.move
|
|
1201
|
+
runCallback("move", options.move, el);
|
|
1134
1202
|
}
|
|
1135
1203
|
}
|
|
1136
1204
|
}
|
|
@@ -1181,9 +1249,13 @@ function springSignal(initial, options) {
|
|
|
1181
1249
|
let target = initial;
|
|
1182
1250
|
let rafId = null;
|
|
1183
1251
|
let lastTime = 0;
|
|
1252
|
+
let disposed = false;
|
|
1253
|
+
const canAnimate = () => typeof requestAnimationFrame === "function";
|
|
1184
1254
|
const REF_DT_MS = 1e3 / 60;
|
|
1185
1255
|
const MAX_STEP_RATIO = 4;
|
|
1186
1256
|
function tick(now) {
|
|
1257
|
+
rafId = null;
|
|
1258
|
+
if (disposed) return;
|
|
1187
1259
|
if (lastTime === 0) lastTime = now;
|
|
1188
1260
|
const rawDt = now - lastTime;
|
|
1189
1261
|
lastTime = now;
|
|
@@ -1196,23 +1268,27 @@ function springSignal(initial, options) {
|
|
|
1196
1268
|
if (Math.abs(current - target) < precision && Math.abs(velocity) < precision) {
|
|
1197
1269
|
current = target;
|
|
1198
1270
|
velocity = 0;
|
|
1199
|
-
rafId = null;
|
|
1200
1271
|
lastTime = 0;
|
|
1201
1272
|
setValue(current);
|
|
1202
1273
|
return;
|
|
1203
1274
|
}
|
|
1204
1275
|
setValue(current);
|
|
1276
|
+
if (disposed || rafId !== null) return;
|
|
1205
1277
|
rafId = requestAnimationFrame(tick);
|
|
1206
1278
|
}
|
|
1279
|
+
function cancelFrame() {
|
|
1280
|
+
if (rafId !== null) {
|
|
1281
|
+
if (typeof cancelAnimationFrame === "function") cancelAnimationFrame(rafId);
|
|
1282
|
+
rafId = null;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1207
1285
|
function set(newTarget) {
|
|
1286
|
+
if (disposed) return;
|
|
1208
1287
|
target = newTarget;
|
|
1209
|
-
if (prefersReducedMotion()) {
|
|
1288
|
+
if (!canAnimate() || prefersReducedMotion()) {
|
|
1210
1289
|
current = newTarget;
|
|
1211
1290
|
velocity = 0;
|
|
1212
|
-
|
|
1213
|
-
cancelAnimationFrame(rafId);
|
|
1214
|
-
rafId = null;
|
|
1215
|
-
}
|
|
1291
|
+
cancelFrame();
|
|
1216
1292
|
lastTime = 0;
|
|
1217
1293
|
setValue(current);
|
|
1218
1294
|
return;
|
|
@@ -1223,10 +1299,8 @@ function springSignal(initial, options) {
|
|
|
1223
1299
|
}
|
|
1224
1300
|
}
|
|
1225
1301
|
function dispose() {
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
rafId = null;
|
|
1229
|
-
}
|
|
1302
|
+
disposed = true;
|
|
1303
|
+
cancelFrame();
|
|
1230
1304
|
lastTime = 0;
|
|
1231
1305
|
}
|
|
1232
1306
|
return [value, set, dispose];
|
package/dist/motion.js
CHANGED
|
@@ -20,11 +20,11 @@ import {
|
|
|
20
20
|
stagger,
|
|
21
21
|
transition,
|
|
22
22
|
viewTransition
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-UNWRJRKC.js";
|
|
24
|
+
import "./chunk-5HZXGZ6T.js";
|
|
25
|
+
import "./chunk-FQRUXCEE.js";
|
|
26
|
+
import "./chunk-JWKYU5GV.js";
|
|
27
|
+
import "./chunk-NYNYSPK7.js";
|
|
28
28
|
export {
|
|
29
29
|
TransitionGroup,
|
|
30
30
|
animate,
|