sibujs 4.8.0 → 4.10.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 +44 -6
- package/dist/browser.d.cts +3 -2
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +4 -4
- package/dist/build.cjs +128 -56
- package/dist/build.js +10 -10
- package/dist/cdn.dev.global.js +14 -14
- package/dist/cdn.full.dev.global.js +13 -13
- package/dist/cdn.full.global.js +12 -12
- package/dist/cdn.global.js +15 -15
- package/dist/{chunk-J3YQ457H.js → chunk-2NWHJ2UJ.js} +99 -61
- package/dist/{chunk-JUTFX2RM.js → chunk-4DCVJ4YA.js} +42 -15
- package/dist/{chunk-QGMSESDD.js → chunk-54F4TPHK.js} +2 -2
- package/dist/{chunk-KJ3UKABJ.js → chunk-5PC7OTQW.js} +1 -1
- package/dist/{chunk-V3LHZSU5.js → chunk-7WIHYHWD.js} +8 -1
- package/dist/{chunk-44MTL7ED.js → chunk-BMCR7TXG.js} +3 -3
- package/dist/{chunk-TQQUN4WR.js → chunk-D6HYFOWR.js} +39 -4
- package/dist/{chunk-VWT3VXPL.js → chunk-EVI4ZQO3.js} +2 -2
- package/dist/{chunk-CZPRSWSS.js → chunk-EVOK663Z.js} +1 -1
- package/dist/{chunk-DSID757X.js → chunk-FYUEL5IW.js} +1 -1
- package/dist/{chunk-UCNP3HVM.js → chunk-GMMDHJJT.js} +30 -12
- package/dist/{chunk-C7AA2CZX.js → chunk-GOL3FU5Q.js} +1 -1
- package/dist/{chunk-EGUQLBHE.js → chunk-GTS35FLA.js} +5 -4
- package/dist/{chunk-GSGNX35Q.js → chunk-IFRIBZ4O.js} +4 -4
- package/dist/{chunk-C5PEWEGH.js → chunk-IL5MMSCL.js} +19 -12
- package/dist/{chunk-ZVLHNEEL.js → chunk-ITEL5KPL.js} +6 -6
- package/dist/{chunk-RGLPEBDE.js → chunk-JCKUWWHU.js} +3 -3
- package/dist/{chunk-Q5J2LVKH.js → chunk-N6U4GOIU.js} +1 -1
- package/dist/{chunk-LI4W3U6C.js → chunk-TOPRMXFY.js} +1 -1
- package/dist/{chunk-4WMSTZ7J.js → chunk-VWPMWV7O.js} +4 -4
- package/dist/{chunk-O6TRVMJI.js → chunk-XUQUQJYE.js} +1 -1
- package/dist/data.cjs +67 -12
- package/dist/data.d.cts +32 -5
- package/dist/data.d.ts +32 -5
- package/dist/data.js +5 -5
- package/dist/devtools.cjs +41 -4
- package/dist/devtools.js +4 -4
- package/dist/ecosystem.cjs +41 -4
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +125 -41
- package/dist/extras.js +20 -20
- package/dist/index.cjs +128 -56
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +10 -10
- package/dist/motion.cjs +36 -4
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +41 -4
- package/dist/patterns.js +5 -5
- package/dist/performance.cjs +55 -14
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +176 -60
- package/dist/plugins.d.cts +62 -2
- package/dist/plugins.d.ts +62 -2
- package/dist/plugins.js +143 -61
- package/dist/ssr.cjs +77 -16
- package/dist/ssr.d.cts +4 -0
- package/dist/ssr.d.ts +4 -0
- package/dist/ssr.js +7 -7
- package/dist/testing.cjs +41 -4
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +42 -5
- package/dist/ui.js +7 -7
- package/dist/widgets.cjs +36 -4
- package/dist/widgets.js +6 -6
- package/package.json +1 -1
package/dist/browser.cjs
CHANGED
|
@@ -327,6 +327,24 @@ function untracked(fn) {
|
|
|
327
327
|
resumeTracking();
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
+
var currentOwnerScope = null;
|
|
331
|
+
function getOwnerScope() {
|
|
332
|
+
return currentOwnerScope;
|
|
333
|
+
}
|
|
334
|
+
function runWithOwnerScope(scope, fn) {
|
|
335
|
+
const prev = currentOwnerScope;
|
|
336
|
+
currentOwnerScope = scope;
|
|
337
|
+
try {
|
|
338
|
+
return fn();
|
|
339
|
+
} finally {
|
|
340
|
+
currentOwnerScope = prev;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function bindOwnerScope(fn) {
|
|
344
|
+
const scope = currentOwnerScope;
|
|
345
|
+
if (scope === null) return fn;
|
|
346
|
+
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
347
|
+
}
|
|
330
348
|
var subscriberEpochCounter = 0;
|
|
331
349
|
function retrack(effectFn, subscriber) {
|
|
332
350
|
const prev = currentSubscriber;
|
|
@@ -342,6 +360,10 @@ function retrack(effectFn, subscriber) {
|
|
|
342
360
|
currentSubscriber = subscriber;
|
|
343
361
|
const sub = subscriber;
|
|
344
362
|
if (sub._cap === void 0) sub._cap = currentDisposerCapture();
|
|
363
|
+
const prevScope = currentOwnerScope;
|
|
364
|
+
if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
|
|
365
|
+
const scope = sub._scope === void 0 ? null : sub._scope;
|
|
366
|
+
if (scope !== prevScope) currentOwnerScope = scope;
|
|
345
367
|
const epoch = ++subscriberEpochCounter;
|
|
346
368
|
sub._epoch = epoch;
|
|
347
369
|
sub._structDirty = false;
|
|
@@ -354,6 +376,7 @@ function retrack(effectFn, subscriber) {
|
|
|
354
376
|
effectFn();
|
|
355
377
|
} finally {
|
|
356
378
|
currentSubscriber = prev;
|
|
379
|
+
currentOwnerScope = prevScope;
|
|
357
380
|
if (savedDepth !== 0) {
|
|
358
381
|
suspendDepth = savedDepth;
|
|
359
382
|
suspendSavedSub = savedSuspendSub;
|
|
@@ -388,23 +411,26 @@ function track(effectFn, subscriber) {
|
|
|
388
411
|
trackingSuspended = false;
|
|
389
412
|
}
|
|
390
413
|
currentSubscriber = subscriber;
|
|
414
|
+
const sub = subscriber;
|
|
415
|
+
if (sub._scope === void 0) sub._scope = currentOwnerScope;
|
|
416
|
+
const prevScope = currentOwnerScope;
|
|
417
|
+
currentOwnerScope = sub._scope;
|
|
391
418
|
try {
|
|
392
419
|
effectFn();
|
|
393
420
|
} finally {
|
|
394
421
|
currentSubscriber = prev;
|
|
422
|
+
currentOwnerScope = prevScope;
|
|
395
423
|
if (savedDepth !== 0) {
|
|
396
424
|
suspendDepth = savedDepth;
|
|
397
425
|
suspendSavedSub = savedSuspendSub;
|
|
398
426
|
trackingSuspended = true;
|
|
399
427
|
}
|
|
400
|
-
|
|
401
|
-
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
428
|
+
for (let n = sub.depsHead ?? null; n !== null; n = n.subNext) {
|
|
402
429
|
const sig = n.sig;
|
|
403
430
|
sig.__activeNode = n.prevActive;
|
|
404
431
|
n.prevActive = null;
|
|
405
432
|
}
|
|
406
433
|
}
|
|
407
|
-
const sub = subscriber;
|
|
408
434
|
return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
|
|
409
435
|
}
|
|
410
436
|
function reactiveBinding(commit, ownerNode) {
|
|
@@ -674,7 +700,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
674
700
|
}
|
|
675
701
|
|
|
676
702
|
// src/reactivity/track.ts
|
|
677
|
-
var _runtimeVersion = true ? "4.
|
|
703
|
+
var _runtimeVersion = true ? "4.10.0" : "dev";
|
|
678
704
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
679
705
|
function resolveReactiveApi() {
|
|
680
706
|
const g = globalThis;
|
|
@@ -706,6 +732,9 @@ function resolveReactiveApi() {
|
|
|
706
732
|
getSubscriberCount,
|
|
707
733
|
getSubscriberDeps,
|
|
708
734
|
forEachSubscriber,
|
|
735
|
+
getOwnerScope,
|
|
736
|
+
runWithOwnerScope,
|
|
737
|
+
bindOwnerScope,
|
|
709
738
|
version: _runtimeVersion
|
|
710
739
|
};
|
|
711
740
|
g[REGISTRY_KEY] = local;
|
|
@@ -729,6 +758,9 @@ var notifySubscribers2 = API.notifySubscribers;
|
|
|
729
758
|
var getSubscriberCount2 = API.getSubscriberCount;
|
|
730
759
|
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
731
760
|
var forEachSubscriber2 = API.forEachSubscriber;
|
|
761
|
+
var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
762
|
+
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
763
|
+
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
732
764
|
|
|
733
765
|
// src/reactivity/batch.ts
|
|
734
766
|
var batchDepth = 0;
|
|
@@ -924,6 +956,11 @@ function flushUserCleanups(ctx) {
|
|
|
924
956
|
const list = ctx.userCleanups;
|
|
925
957
|
if (list.length === 0) return;
|
|
926
958
|
ctx.userCleanups = [];
|
|
959
|
+
const scope = ctx.subscriber._scope ?? null;
|
|
960
|
+
if (scope === getOwnerScope2()) runCleanups(list);
|
|
961
|
+
else runWithOwnerScope2(scope, () => runCleanups(list));
|
|
962
|
+
}
|
|
963
|
+
function runCleanups(list) {
|
|
927
964
|
for (let i = list.length - 1; i >= 0; i--) {
|
|
928
965
|
try {
|
|
929
966
|
list[i]();
|
|
@@ -2264,6 +2301,7 @@ function keyboard(options = {}) {
|
|
|
2264
2301
|
};
|
|
2265
2302
|
}
|
|
2266
2303
|
const target = options.target ?? window;
|
|
2304
|
+
const view = options.target?.ownerDocument?.defaultView ?? window;
|
|
2267
2305
|
const filter = options.keys ? new Set(options.keys) : null;
|
|
2268
2306
|
const onDown = (e) => {
|
|
2269
2307
|
if (filter && !filter.has(e.key)) return;
|
|
@@ -2286,14 +2324,14 @@ function keyboard(options = {}) {
|
|
|
2286
2324
|
const onBlur = () => setPressed(/* @__PURE__ */ new Set());
|
|
2287
2325
|
target.addEventListener("keydown", onDown);
|
|
2288
2326
|
target.addEventListener("keyup", onUp);
|
|
2289
|
-
|
|
2327
|
+
view.addEventListener("blur", onBlur);
|
|
2290
2328
|
function isPressed(key) {
|
|
2291
2329
|
return pressed().has(key);
|
|
2292
2330
|
}
|
|
2293
2331
|
function dispose() {
|
|
2294
2332
|
target.removeEventListener("keydown", onDown);
|
|
2295
2333
|
target.removeEventListener("keyup", onUp);
|
|
2296
|
-
|
|
2334
|
+
view.removeEventListener("blur", onBlur);
|
|
2297
2335
|
}
|
|
2298
2336
|
return { pressed, isPressed, dispose };
|
|
2299
2337
|
}
|
package/dist/browser.d.cts
CHANGED
|
@@ -642,8 +642,9 @@ interface KeyboardOptions {
|
|
|
642
642
|
* `KeyboardEvent.key`). On every key event the signal is replaced with a
|
|
643
643
|
* new Set instance so reactive subscribers see the change.
|
|
644
644
|
*
|
|
645
|
-
* Also listens to `
|
|
646
|
-
*
|
|
645
|
+
* Also listens to `blur` on the target's window (the global `window`, or the
|
|
646
|
+
* window of the document a `target` element belongs to) to clear stuck keys
|
|
647
|
+
* if it loses focus mid-press — otherwise held modifiers can "ghost" forever.
|
|
647
648
|
*
|
|
648
649
|
* @example
|
|
649
650
|
* ```ts
|
package/dist/browser.d.ts
CHANGED
|
@@ -642,8 +642,9 @@ interface KeyboardOptions {
|
|
|
642
642
|
* `KeyboardEvent.key`). On every key event the signal is replaced with a
|
|
643
643
|
* new Set instance so reactive subscribers see the change.
|
|
644
644
|
*
|
|
645
|
-
* Also listens to `
|
|
646
|
-
*
|
|
645
|
+
* Also listens to `blur` on the target's window (the global `window`, or the
|
|
646
|
+
* window of the document a `target` element belongs to) to clear stuck keys
|
|
647
|
+
* if it loses focus mid-press — otherwise held modifiers can "ghost" forever.
|
|
647
648
|
*
|
|
648
649
|
* @example
|
|
649
650
|
* ```ts
|
package/dist/browser.js
CHANGED
|
@@ -36,15 +36,15 @@ import {
|
|
|
36
36
|
visibility,
|
|
37
37
|
wakeLock,
|
|
38
38
|
windowSize
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-GTS35FLA.js";
|
|
40
40
|
import "./chunk-52XFPGSN.js";
|
|
41
41
|
import "./chunk-62BDYGAG.js";
|
|
42
42
|
import "./chunk-7ZHH77QA.js";
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-7WIHYHWD.js";
|
|
44
44
|
import "./chunk-EXXSN3BW.js";
|
|
45
45
|
import "./chunk-7XHATCIH.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-FYUEL5IW.js";
|
|
47
|
+
import "./chunk-D6HYFOWR.js";
|
|
48
48
|
import "./chunk-NYNYSPK7.js";
|
|
49
49
|
export {
|
|
50
50
|
__resetSpeechCoordinator,
|
package/dist/build.cjs
CHANGED
|
@@ -3201,6 +3201,24 @@ function untracked(fn) {
|
|
|
3201
3201
|
resumeTracking();
|
|
3202
3202
|
}
|
|
3203
3203
|
}
|
|
3204
|
+
var currentOwnerScope = null;
|
|
3205
|
+
function getOwnerScope() {
|
|
3206
|
+
return currentOwnerScope;
|
|
3207
|
+
}
|
|
3208
|
+
function runWithOwnerScope(scope, fn) {
|
|
3209
|
+
const prev = currentOwnerScope;
|
|
3210
|
+
currentOwnerScope = scope;
|
|
3211
|
+
try {
|
|
3212
|
+
return fn();
|
|
3213
|
+
} finally {
|
|
3214
|
+
currentOwnerScope = prev;
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
function bindOwnerScope(fn) {
|
|
3218
|
+
const scope = currentOwnerScope;
|
|
3219
|
+
if (scope === null) return fn;
|
|
3220
|
+
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
3221
|
+
}
|
|
3204
3222
|
var subscriberEpochCounter = 0;
|
|
3205
3223
|
function retrack(effectFn, subscriber) {
|
|
3206
3224
|
const prev = currentSubscriber;
|
|
@@ -3216,6 +3234,10 @@ function retrack(effectFn, subscriber) {
|
|
|
3216
3234
|
currentSubscriber = subscriber;
|
|
3217
3235
|
const sub2 = subscriber;
|
|
3218
3236
|
if (sub2._cap === void 0) sub2._cap = currentDisposerCapture();
|
|
3237
|
+
const prevScope = currentOwnerScope;
|
|
3238
|
+
if (prevScope !== null && !sub2._epoch && sub2._scope === void 0) sub2._scope = prevScope;
|
|
3239
|
+
const scope = sub2._scope === void 0 ? null : sub2._scope;
|
|
3240
|
+
if (scope !== prevScope) currentOwnerScope = scope;
|
|
3219
3241
|
const epoch = ++subscriberEpochCounter;
|
|
3220
3242
|
sub2._epoch = epoch;
|
|
3221
3243
|
sub2._structDirty = false;
|
|
@@ -3228,6 +3250,7 @@ function retrack(effectFn, subscriber) {
|
|
|
3228
3250
|
effectFn();
|
|
3229
3251
|
} finally {
|
|
3230
3252
|
currentSubscriber = prev;
|
|
3253
|
+
currentOwnerScope = prevScope;
|
|
3231
3254
|
if (savedDepth !== 0) {
|
|
3232
3255
|
suspendDepth = savedDepth;
|
|
3233
3256
|
suspendSavedSub = savedSuspendSub;
|
|
@@ -3262,23 +3285,26 @@ function track(effectFn, subscriber) {
|
|
|
3262
3285
|
trackingSuspended = false;
|
|
3263
3286
|
}
|
|
3264
3287
|
currentSubscriber = subscriber;
|
|
3288
|
+
const sub2 = subscriber;
|
|
3289
|
+
if (sub2._scope === void 0) sub2._scope = currentOwnerScope;
|
|
3290
|
+
const prevScope = currentOwnerScope;
|
|
3291
|
+
currentOwnerScope = sub2._scope;
|
|
3265
3292
|
try {
|
|
3266
3293
|
effectFn();
|
|
3267
3294
|
} finally {
|
|
3268
3295
|
currentSubscriber = prev;
|
|
3296
|
+
currentOwnerScope = prevScope;
|
|
3269
3297
|
if (savedDepth !== 0) {
|
|
3270
3298
|
suspendDepth = savedDepth;
|
|
3271
3299
|
suspendSavedSub = savedSuspendSub;
|
|
3272
3300
|
trackingSuspended = true;
|
|
3273
3301
|
}
|
|
3274
|
-
|
|
3275
|
-
for (let n = sub3.depsHead ?? null; n !== null; n = n.subNext) {
|
|
3302
|
+
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
3276
3303
|
const sig = n.sig;
|
|
3277
3304
|
sig.__activeNode = n.prevActive;
|
|
3278
3305
|
n.prevActive = null;
|
|
3279
3306
|
}
|
|
3280
3307
|
}
|
|
3281
|
-
const sub2 = subscriber;
|
|
3282
3308
|
return sub2._dispose ?? (sub2._dispose = () => cleanup(subscriber));
|
|
3283
3309
|
}
|
|
3284
3310
|
function reactiveBinding(commit, ownerNode) {
|
|
@@ -3548,7 +3574,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
3548
3574
|
}
|
|
3549
3575
|
|
|
3550
3576
|
// src/reactivity/track.ts
|
|
3551
|
-
var _runtimeVersion = true ? "4.
|
|
3577
|
+
var _runtimeVersion = true ? "4.10.0" : "dev";
|
|
3552
3578
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
3553
3579
|
function resolveReactiveApi() {
|
|
3554
3580
|
const g2 = globalThis;
|
|
@@ -3580,6 +3606,9 @@ function resolveReactiveApi() {
|
|
|
3580
3606
|
getSubscriberCount,
|
|
3581
3607
|
getSubscriberDeps,
|
|
3582
3608
|
forEachSubscriber,
|
|
3609
|
+
getOwnerScope,
|
|
3610
|
+
runWithOwnerScope,
|
|
3611
|
+
bindOwnerScope,
|
|
3583
3612
|
version: _runtimeVersion
|
|
3584
3613
|
};
|
|
3585
3614
|
g2[REGISTRY_KEY] = local;
|
|
@@ -3603,6 +3632,9 @@ var notifySubscribers2 = API.notifySubscribers;
|
|
|
3603
3632
|
var getSubscriberCount2 = API.getSubscriberCount;
|
|
3604
3633
|
var getSubscriberDeps2 = API.getSubscriberDeps;
|
|
3605
3634
|
var forEachSubscriber2 = API.forEachSubscriber;
|
|
3635
|
+
var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
3636
|
+
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
3637
|
+
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
3606
3638
|
|
|
3607
3639
|
// src/reactivity/bindAttribute.ts
|
|
3608
3640
|
function bindAttribute(el, attr, getter) {
|
|
@@ -4276,12 +4308,16 @@ function lazy(importFn) {
|
|
|
4276
4308
|
}
|
|
4277
4309
|
const container = div({ class: "sibu-lazy" });
|
|
4278
4310
|
let disposed = false;
|
|
4279
|
-
importFn().then(
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4311
|
+
importFn().then(
|
|
4312
|
+
// The component renders after the import resolves, in the owner scope
|
|
4313
|
+
// of whoever rendered the placeholder.
|
|
4314
|
+
bindOwnerScope2((mod) => {
|
|
4315
|
+
if (disposed) return;
|
|
4316
|
+
cached = mod.default;
|
|
4317
|
+
const rendered = cached();
|
|
4318
|
+
replaceChildrenSafely(container, rendered);
|
|
4319
|
+
})
|
|
4320
|
+
).catch((err) => {
|
|
4285
4321
|
if (disposed) return;
|
|
4286
4322
|
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
4287
4323
|
replaceChildrenSafely(
|
|
@@ -4312,7 +4348,7 @@ function Suspense({ nodes, fallback }) {
|
|
|
4312
4348
|
}
|
|
4313
4349
|
if (childEl && !container.contains(childEl)) dispose(childEl);
|
|
4314
4350
|
});
|
|
4315
|
-
|
|
4351
|
+
const renderContent = bindOwnerScope2(() => {
|
|
4316
4352
|
if (suspenseDisposed) return;
|
|
4317
4353
|
try {
|
|
4318
4354
|
const el = nodes();
|
|
@@ -4340,10 +4376,14 @@ function Suspense({ nodes, fallback }) {
|
|
|
4340
4376
|
dispatchPropagate(container, errorObj);
|
|
4341
4377
|
}
|
|
4342
4378
|
});
|
|
4379
|
+
queueMicrotask(renderContent);
|
|
4343
4380
|
return container;
|
|
4344
4381
|
}
|
|
4345
4382
|
|
|
4346
4383
|
// src/core/rendering/lifecycle.ts
|
|
4384
|
+
function pinScope(scope, fn) {
|
|
4385
|
+
return () => getOwnerScope2() === scope ? fn() : runWithOwnerScope2(scope, fn);
|
|
4386
|
+
}
|
|
4347
4387
|
function safeCall(cb, hookName) {
|
|
4348
4388
|
try {
|
|
4349
4389
|
return cb();
|
|
@@ -4353,13 +4393,14 @@ function safeCall(cb, hookName) {
|
|
|
4353
4393
|
return void 0;
|
|
4354
4394
|
}
|
|
4355
4395
|
}
|
|
4356
|
-
function runMountCallback(callback, hookName, element, isDisposed) {
|
|
4357
|
-
const
|
|
4358
|
-
if (typeof
|
|
4396
|
+
function runMountCallback(callback, hookName, element, isDisposed, scope) {
|
|
4397
|
+
const returned = safeCall(callback, hookName);
|
|
4398
|
+
if (typeof returned !== "function") return;
|
|
4399
|
+
const cleanup3 = pinScope(scope, returned);
|
|
4359
4400
|
if (isDisposed() || !element.isConnected) {
|
|
4360
4401
|
safeCall(cleanup3, "onUnmount");
|
|
4361
4402
|
} else {
|
|
4362
|
-
|
|
4403
|
+
watchUnmount(cleanup3, element);
|
|
4363
4404
|
}
|
|
4364
4405
|
}
|
|
4365
4406
|
var mountWatchers = /* @__PURE__ */ new WeakMap();
|
|
@@ -4519,6 +4560,8 @@ function registerUnmountWatcher(element, cb) {
|
|
|
4519
4560
|
}
|
|
4520
4561
|
function onMount(callback, element) {
|
|
4521
4562
|
if (typeof document === "undefined") return;
|
|
4563
|
+
const scope = getOwnerScope2();
|
|
4564
|
+
callback = pinScope(scope, callback);
|
|
4522
4565
|
if (element) {
|
|
4523
4566
|
let disposed = false;
|
|
4524
4567
|
const isDisposed = () => disposed;
|
|
@@ -4528,19 +4571,19 @@ function onMount(callback, element) {
|
|
|
4528
4571
|
if (element.isConnected) {
|
|
4529
4572
|
queueMicrotask(() => {
|
|
4530
4573
|
if (disposed) return;
|
|
4531
|
-
runMountCallback(callback, "onMount", element, isDisposed);
|
|
4574
|
+
runMountCallback(callback, "onMount", element, isDisposed, scope);
|
|
4532
4575
|
});
|
|
4533
4576
|
return;
|
|
4534
4577
|
}
|
|
4535
4578
|
queueMicrotask(() => {
|
|
4536
4579
|
if (disposed) return;
|
|
4537
4580
|
if (element.isConnected) {
|
|
4538
|
-
runMountCallback(callback, "onMount", element, isDisposed);
|
|
4581
|
+
runMountCallback(callback, "onMount", element, isDisposed, scope);
|
|
4539
4582
|
return;
|
|
4540
4583
|
}
|
|
4541
4584
|
const unregister = registerMountWatcher(element, () => {
|
|
4542
4585
|
if (disposed) return;
|
|
4543
|
-
runMountCallback(callback, "onMount", element, isDisposed);
|
|
4586
|
+
runMountCallback(callback, "onMount", element, isDisposed, scope);
|
|
4544
4587
|
});
|
|
4545
4588
|
registerDisposer(element, unregister);
|
|
4546
4589
|
});
|
|
@@ -4552,6 +4595,9 @@ function onMount(callback, element) {
|
|
|
4552
4595
|
}
|
|
4553
4596
|
function onUnmount(callback, element) {
|
|
4554
4597
|
if (typeof document === "undefined") return;
|
|
4598
|
+
watchUnmount(pinScope(getOwnerScope2(), callback), element);
|
|
4599
|
+
}
|
|
4600
|
+
function watchUnmount(callback, element) {
|
|
4555
4601
|
let fired = false;
|
|
4556
4602
|
const fireOnce = () => {
|
|
4557
4603
|
if (fired) return;
|
|
@@ -4714,6 +4760,11 @@ function flushUserCleanups(ctx) {
|
|
|
4714
4760
|
const list = ctx.userCleanups;
|
|
4715
4761
|
if (list.length === 0) return;
|
|
4716
4762
|
ctx.userCleanups = [];
|
|
4763
|
+
const scope = ctx.subscriber._scope ?? null;
|
|
4764
|
+
if (scope === getOwnerScope2()) runCleanups(list);
|
|
4765
|
+
else runWithOwnerScope2(scope, () => runCleanups(list));
|
|
4766
|
+
}
|
|
4767
|
+
function runCleanups(list) {
|
|
4717
4768
|
for (let i2 = list.length - 1; i2 >= 0; i2--) {
|
|
4718
4769
|
try {
|
|
4719
4770
|
list[i2]();
|
|
@@ -5643,11 +5694,15 @@ function ErrorBoundary(optionsOrChildren, maybeChildren) {
|
|
|
5643
5694
|
return;
|
|
5644
5695
|
}
|
|
5645
5696
|
replaceChildrenSafely(asyncContainer, el);
|
|
5646
|
-
}).catch(
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5697
|
+
}).catch(
|
|
5698
|
+
// The fallback is rendered later, in the owner scope of the
|
|
5699
|
+
// render that produced the async child.
|
|
5700
|
+
bindOwnerScope2((e) => {
|
|
5701
|
+
if (asyncDisposed) return;
|
|
5702
|
+
const err = handleError(e);
|
|
5703
|
+
replaceChildrenSafely(asyncContainer, tryRenderFallback(err));
|
|
5704
|
+
})
|
|
5705
|
+
);
|
|
5651
5706
|
return asyncContainer;
|
|
5652
5707
|
}
|
|
5653
5708
|
return result;
|
|
@@ -5817,37 +5872,44 @@ function action(element, action2, param2) {
|
|
|
5817
5872
|
}
|
|
5818
5873
|
}
|
|
5819
5874
|
var clickOutside = (element, callback) => {
|
|
5875
|
+
const doc = element.ownerDocument;
|
|
5820
5876
|
const handler = (e) => {
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
}
|
|
5877
|
+
const target = e.target;
|
|
5878
|
+
if (!(typeof target?.nodeType === "number" && element.contains(target))) callback();
|
|
5824
5879
|
};
|
|
5825
|
-
|
|
5826
|
-
return () =>
|
|
5880
|
+
doc.addEventListener("pointerdown", handler, true);
|
|
5881
|
+
return () => doc.removeEventListener("pointerdown", handler, true);
|
|
5827
5882
|
};
|
|
5883
|
+
var PRESS_END_EVENTS = ["pointerup", "pointerleave", "pointercancel"];
|
|
5828
5884
|
var longPress = (element, options) => {
|
|
5829
5885
|
const duration = options.duration ?? 500;
|
|
5830
5886
|
let timer = null;
|
|
5831
|
-
|
|
5832
|
-
timer = setTimeout(() => {
|
|
5833
|
-
options.callback();
|
|
5834
|
-
timer = null;
|
|
5835
|
-
}, duration);
|
|
5836
|
-
};
|
|
5887
|
+
let owner;
|
|
5837
5888
|
const cancel = () => {
|
|
5838
5889
|
if (timer !== null) {
|
|
5839
5890
|
clearTimeout(timer);
|
|
5840
5891
|
timer = null;
|
|
5841
5892
|
}
|
|
5842
5893
|
};
|
|
5894
|
+
const start = (e) => {
|
|
5895
|
+
const id = e.pointerId;
|
|
5896
|
+
if (timer !== null && id !== owner) return;
|
|
5897
|
+
cancel();
|
|
5898
|
+
owner = id;
|
|
5899
|
+
timer = setTimeout(() => {
|
|
5900
|
+
timer = null;
|
|
5901
|
+
options.callback();
|
|
5902
|
+
}, duration);
|
|
5903
|
+
};
|
|
5904
|
+
const end = (e) => {
|
|
5905
|
+
if (timer !== null && e.pointerId === owner) cancel();
|
|
5906
|
+
};
|
|
5843
5907
|
element.addEventListener("pointerdown", start);
|
|
5844
|
-
element.addEventListener(
|
|
5845
|
-
element.addEventListener("pointerleave", cancel);
|
|
5908
|
+
for (const type of PRESS_END_EVENTS) element.addEventListener(type, end);
|
|
5846
5909
|
return () => {
|
|
5847
5910
|
cancel();
|
|
5848
5911
|
element.removeEventListener("pointerdown", start);
|
|
5849
|
-
element.removeEventListener(
|
|
5850
|
-
element.removeEventListener("pointerleave", cancel);
|
|
5912
|
+
for (const type of PRESS_END_EVENTS) element.removeEventListener(type, end);
|
|
5851
5913
|
};
|
|
5852
5914
|
};
|
|
5853
5915
|
var copyOnClick = (element, getText) => {
|
|
@@ -5881,10 +5943,11 @@ var trapFocus = (element) => {
|
|
|
5881
5943
|
if (elements.length === 0) return;
|
|
5882
5944
|
const first = elements[0];
|
|
5883
5945
|
const last = elements[elements.length - 1];
|
|
5884
|
-
|
|
5946
|
+
const active = element.ownerDocument.activeElement;
|
|
5947
|
+
if (e.shiftKey && active === first) {
|
|
5885
5948
|
e.preventDefault();
|
|
5886
5949
|
last.focus();
|
|
5887
|
-
} else if (!e.shiftKey &&
|
|
5950
|
+
} else if (!e.shiftKey && active === last) {
|
|
5888
5951
|
e.preventDefault();
|
|
5889
5952
|
first.focus();
|
|
5890
5953
|
}
|
|
@@ -6092,9 +6155,11 @@ function when(condition, thenBranch, elseBranch) {
|
|
|
6092
6155
|
currentNode = null;
|
|
6093
6156
|
});
|
|
6094
6157
|
if (!initialized) {
|
|
6095
|
-
queueMicrotask(
|
|
6096
|
-
|
|
6097
|
-
|
|
6158
|
+
queueMicrotask(
|
|
6159
|
+
bindOwnerScope2(() => {
|
|
6160
|
+
if (!disposed && !initialized && anchor.parentNode) update();
|
|
6161
|
+
})
|
|
6162
|
+
);
|
|
6098
6163
|
}
|
|
6099
6164
|
return anchor;
|
|
6100
6165
|
}
|
|
@@ -6133,9 +6198,11 @@ function match(value, cases, fallback) {
|
|
|
6133
6198
|
currentNode = null;
|
|
6134
6199
|
});
|
|
6135
6200
|
if (!initialized) {
|
|
6136
|
-
queueMicrotask(
|
|
6137
|
-
|
|
6138
|
-
|
|
6201
|
+
queueMicrotask(
|
|
6202
|
+
bindOwnerScope2(() => {
|
|
6203
|
+
if (!disposed && !initialized && anchor.parentNode) update();
|
|
6204
|
+
})
|
|
6205
|
+
);
|
|
6139
6206
|
}
|
|
6140
6207
|
return anchor;
|
|
6141
6208
|
}
|
|
@@ -6433,11 +6500,13 @@ function each(getArray, render, options) {
|
|
|
6433
6500
|
};
|
|
6434
6501
|
registerDisposer(anchor, disposeRange);
|
|
6435
6502
|
if (!initialized) {
|
|
6436
|
-
queueMicrotask(
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6503
|
+
queueMicrotask(
|
|
6504
|
+
bindOwnerScope2(() => {
|
|
6505
|
+
if (!initialized && !rangeDisposed && anchor.parentNode) {
|
|
6506
|
+
update();
|
|
6507
|
+
}
|
|
6508
|
+
})
|
|
6509
|
+
);
|
|
6441
6510
|
}
|
|
6442
6511
|
return anchor;
|
|
6443
6512
|
}
|
|
@@ -6885,7 +6954,7 @@ function KeepAlive(activeKey, cases, options) {
|
|
|
6885
6954
|
return;
|
|
6886
6955
|
}
|
|
6887
6956
|
node = factory();
|
|
6888
|
-
if (node
|
|
6957
|
+
if (node.nodeType === 11) {
|
|
6889
6958
|
const wrapper = document.createElement("div");
|
|
6890
6959
|
wrapper.style.display = "contents";
|
|
6891
6960
|
wrapper.appendChild(node);
|
|
@@ -6915,9 +6984,11 @@ function KeepAlive(activeKey, cases, options) {
|
|
|
6915
6984
|
};
|
|
6916
6985
|
const untrack = track2(update);
|
|
6917
6986
|
if (!initialized) {
|
|
6918
|
-
queueMicrotask(
|
|
6919
|
-
|
|
6920
|
-
|
|
6987
|
+
queueMicrotask(
|
|
6988
|
+
bindOwnerScope2(() => {
|
|
6989
|
+
if (!initialized && anchor.parentNode) update();
|
|
6990
|
+
})
|
|
6991
|
+
);
|
|
6921
6992
|
}
|
|
6922
6993
|
registerDisposer(anchor, () => {
|
|
6923
6994
|
disposed = true;
|
|
@@ -7022,7 +7093,7 @@ function Portal(nodes, target) {
|
|
|
7022
7093
|
const container = target || document.body;
|
|
7023
7094
|
let portalContent = null;
|
|
7024
7095
|
let disposed = false;
|
|
7025
|
-
|
|
7096
|
+
const renderContent = bindOwnerScope2(() => {
|
|
7026
7097
|
if (disposed) return;
|
|
7027
7098
|
try {
|
|
7028
7099
|
portalContent = nodes();
|
|
@@ -7037,6 +7108,7 @@ function Portal(nodes, target) {
|
|
|
7037
7108
|
});
|
|
7038
7109
|
}
|
|
7039
7110
|
});
|
|
7111
|
+
queueMicrotask(renderContent);
|
|
7040
7112
|
registerDisposer(anchor, () => {
|
|
7041
7113
|
disposed = true;
|
|
7042
7114
|
if (portalContent) {
|
package/dist/build.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
index_exports
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-2NWHJ2UJ.js";
|
|
4
|
+
import "./chunk-N6U4GOIU.js";
|
|
5
5
|
import "./chunk-FC6KCJSA.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-EVOK663Z.js";
|
|
7
|
+
import "./chunk-GOL3FU5Q.js";
|
|
8
8
|
import "./chunk-62BDYGAG.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-EVI4ZQO3.js";
|
|
10
|
+
import "./chunk-XUQUQJYE.js";
|
|
11
11
|
import "./chunk-3ACAAQIN.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-5PC7OTQW.js";
|
|
13
13
|
import "./chunk-7ZHH77QA.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-7WIHYHWD.js";
|
|
15
15
|
import {
|
|
16
16
|
isEventHandlerAttr,
|
|
17
17
|
isHtmlContentAttribute,
|
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
} from "./chunk-EXXSN3BW.js";
|
|
20
20
|
import "./chunk-7XHATCIH.js";
|
|
21
21
|
import "./chunk-5HZXGZ6T.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-FYUEL5IW.js";
|
|
23
|
+
import "./chunk-D6HYFOWR.js";
|
|
24
24
|
import "./chunk-NYNYSPK7.js";
|
|
25
25
|
|
|
26
26
|
// src/build/sourceEdit.ts
|