@fictjs/runtime 0.6.0 → 0.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/dist/advanced.cjs +13 -9
- package/dist/advanced.cjs.map +1 -1
- package/dist/advanced.d.cts +4 -4
- package/dist/advanced.d.ts +4 -4
- package/dist/advanced.js +8 -4
- package/dist/advanced.js.map +1 -1
- package/dist/{chunk-D2IWOO4X.js → chunk-4LCHQ7U4.js} +250 -99
- package/dist/chunk-4LCHQ7U4.js.map +1 -0
- package/dist/{chunk-LRFMCJY3.js → chunk-7YQK3XKY.js} +120 -27
- package/dist/chunk-7YQK3XKY.js.map +1 -0
- package/dist/{chunk-QB2UD62G.cjs → chunk-CEV6TO5U.cjs} +8 -8
- package/dist/{chunk-QB2UD62G.cjs.map → chunk-CEV6TO5U.cjs.map} +1 -1
- package/dist/{chunk-ZR435MDC.cjs → chunk-FSCBL7RI.cjs} +120 -27
- package/dist/chunk-FSCBL7RI.cjs.map +1 -0
- package/dist/{chunk-KNGHYGK4.cjs → chunk-HHDHQGJY.cjs} +17 -17
- package/dist/{chunk-KNGHYGK4.cjs.map → chunk-HHDHQGJY.cjs.map} +1 -1
- package/dist/{chunk-Z6M3HKLG.cjs → chunk-PRF4QG73.cjs} +400 -249
- package/dist/chunk-PRF4QG73.cjs.map +1 -0
- package/dist/{chunk-4NUHM77Z.js → chunk-TLDT76RV.js} +3 -3
- package/dist/{chunk-SLFAEVKJ.js → chunk-WRU3IZOA.js} +3 -3
- package/dist/{context-CTBE00S_.d.cts → context-BFbHf9nC.d.cts} +1 -1
- package/dist/{context-lkLhbkFJ.d.ts → context-C4vBQbb4.d.ts} +1 -1
- package/dist/{effect-BpSNEJJz.d.cts → effect-DAzpH7Mm.d.cts} +33 -1
- package/dist/{effect-BpSNEJJz.d.ts → effect-DAzpH7Mm.d.ts} +33 -1
- package/dist/index.cjs +42 -42
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.dev.js +206 -46
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/internal.cjs +55 -41
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +3 -3
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +17 -3
- package/dist/internal.js.map +1 -1
- package/dist/loader.cjs +9 -9
- package/dist/loader.js +1 -1
- package/dist/{props-XTHYD19o.d.cts → props-84UJeWO8.d.cts} +1 -1
- package/dist/{props-x-HbI-jX.d.ts → props-BRhFK50f.d.ts} +1 -1
- package/dist/{scope-CdbGmsFf.d.ts → scope-D3DpsfoG.d.ts} +1 -1
- package/dist/{scope-DfcP9I-A.d.cts → scope-DlCBL1Ft.d.cts} +1 -1
- package/package.json +1 -1
- package/src/advanced.ts +1 -1
- package/src/binding.ts +229 -101
- package/src/constants.ts +1 -1
- package/src/cycle-guard.ts +4 -3
- package/src/dom.ts +15 -4
- package/src/hooks.ts +1 -1
- package/src/internal.ts +7 -0
- package/src/lifecycle.ts +1 -1
- package/src/props.ts +60 -1
- package/src/signal.ts +60 -10
- package/src/store.ts +131 -18
- package/src/transition.ts +46 -9
- package/dist/chunk-D2IWOO4X.js.map +0 -1
- package/dist/chunk-LRFMCJY3.js.map +0 -1
- package/dist/chunk-Z6M3HKLG.cjs.map +0 -1
- package/dist/chunk-ZR435MDC.cjs.map +0 -1
- /package/dist/{chunk-4NUHM77Z.js.map → chunk-TLDT76RV.js.map} +0 -0
- /package/dist/{chunk-SLFAEVKJ.js.map → chunk-WRU3IZOA.js.map} +0 -0
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
setTransitionContext,
|
|
41
41
|
signal,
|
|
42
42
|
untrack
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-7YQK3XKY.js";
|
|
44
44
|
|
|
45
45
|
// src/jsx.ts
|
|
46
46
|
var Fragment = Symbol("Fragment");
|
|
@@ -259,15 +259,48 @@ function startTransition(fn) {
|
|
|
259
259
|
}
|
|
260
260
|
function useTransition() {
|
|
261
261
|
const pending = signal(false);
|
|
262
|
+
let pendingCount = 0;
|
|
263
|
+
const beginPending = () => {
|
|
264
|
+
pendingCount += 1;
|
|
265
|
+
if (pendingCount === 1) {
|
|
266
|
+
pending(true);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const endPending = () => {
|
|
270
|
+
if (pendingCount === 0) return;
|
|
271
|
+
pendingCount -= 1;
|
|
272
|
+
if (pendingCount === 0) {
|
|
273
|
+
pending(false);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
262
276
|
const start = (fn) => {
|
|
277
|
+
beginPending();
|
|
278
|
+
let result;
|
|
279
|
+
let thrown;
|
|
280
|
+
let didThrow = false;
|
|
263
281
|
startTransition(() => {
|
|
264
|
-
pending(true);
|
|
265
282
|
try {
|
|
266
|
-
fn();
|
|
267
|
-
}
|
|
268
|
-
|
|
283
|
+
result = fn();
|
|
284
|
+
} catch (err) {
|
|
285
|
+
thrown = err;
|
|
286
|
+
didThrow = true;
|
|
269
287
|
}
|
|
270
288
|
});
|
|
289
|
+
if (didThrow) {
|
|
290
|
+
endPending();
|
|
291
|
+
throw thrown;
|
|
292
|
+
}
|
|
293
|
+
if (result && typeof result.then === "function") {
|
|
294
|
+
Promise.resolve(result).finally(() => {
|
|
295
|
+
endPending();
|
|
296
|
+
});
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (typeof queueMicrotask === "function") {
|
|
300
|
+
queueMicrotask(endPending);
|
|
301
|
+
} else {
|
|
302
|
+
Promise.resolve().then(endPending);
|
|
303
|
+
}
|
|
271
304
|
};
|
|
272
305
|
return [() => pending(), start];
|
|
273
306
|
}
|
|
@@ -351,22 +384,83 @@ function isHydratingActive() {
|
|
|
351
384
|
}
|
|
352
385
|
|
|
353
386
|
// src/binding.ts
|
|
354
|
-
var isDev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process
|
|
387
|
+
var isDev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
|
|
388
|
+
var TEXT_CACHE = Symbol("fict:text");
|
|
389
|
+
var ATTR_CACHE = Symbol("fict:attr");
|
|
390
|
+
var PROP_CACHE = Symbol("fict:prop");
|
|
391
|
+
var STYLE_CACHE = Symbol("fict:style");
|
|
392
|
+
var CLASS_STATE_CACHE = Symbol("fict:class-state");
|
|
393
|
+
var CLASS_VALUE_CACHE = Symbol("fict:class-value");
|
|
394
|
+
var NON_REACTIVE_FN_MARKER = Symbol.for("fict:non-reactive-fn");
|
|
395
|
+
var REACTIVE_FN_MARKER = Symbol.for("fict:reactive-fn");
|
|
396
|
+
var NON_REACTIVE_FN_REGISTRY_KEY = Symbol.for("fict:non-reactive-fn-registry");
|
|
397
|
+
var PROPERTY_BINDING_KEYS = /* @__PURE__ */ new Set([
|
|
398
|
+
"value",
|
|
399
|
+
"checked",
|
|
400
|
+
"selected",
|
|
401
|
+
"disabled",
|
|
402
|
+
"readOnly",
|
|
403
|
+
"multiple",
|
|
404
|
+
"muted"
|
|
405
|
+
]);
|
|
406
|
+
var STYLE_PROP_CACHE = /* @__PURE__ */ new Map();
|
|
407
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
408
|
+
function getNonReactiveFnRegistry() {
|
|
409
|
+
const host = globalThis;
|
|
410
|
+
let registry = host[NON_REACTIVE_FN_REGISTRY_KEY];
|
|
411
|
+
if (!registry) {
|
|
412
|
+
registry = /* @__PURE__ */ new WeakSet();
|
|
413
|
+
host[NON_REACTIVE_FN_REGISTRY_KEY] = registry;
|
|
414
|
+
}
|
|
415
|
+
return registry;
|
|
416
|
+
}
|
|
417
|
+
function isExplicitReactiveFn(value) {
|
|
418
|
+
if (typeof value !== "function") return false;
|
|
419
|
+
return value[REACTIVE_FN_MARKER] === true;
|
|
420
|
+
}
|
|
355
421
|
function isReactive(value) {
|
|
356
422
|
if (typeof value !== "function") return false;
|
|
423
|
+
if (isNonReactiveFn(value)) return false;
|
|
357
424
|
if (isSignal(value) || isComputed(value)) return true;
|
|
425
|
+
if (isExplicitReactiveFn(value)) return true;
|
|
358
426
|
if (isEffect(value) || isEffectScope(value)) return false;
|
|
359
427
|
return value.length === 0;
|
|
360
428
|
}
|
|
361
429
|
function isStrictlyReactive(value) {
|
|
362
430
|
if (typeof value !== "function") return false;
|
|
363
|
-
return isSignal(value) || isComputed(value) || isPropGetterFn(value);
|
|
431
|
+
return isSignal(value) || isComputed(value) || isPropGetterFn(value) || isExplicitReactiveFn(value);
|
|
364
432
|
}
|
|
365
433
|
var PROP_GETTER_MARKER = Symbol.for("fict:prop-getter");
|
|
366
434
|
function isPropGetterFn(value) {
|
|
367
435
|
if (typeof value !== "function") return false;
|
|
368
436
|
return value[PROP_GETTER_MARKER] === true;
|
|
369
437
|
}
|
|
438
|
+
function isNonReactiveFn(value) {
|
|
439
|
+
if (typeof value !== "function") return false;
|
|
440
|
+
if (getNonReactiveFnRegistry().has(value)) return true;
|
|
441
|
+
return value[NON_REACTIVE_FN_MARKER] === true;
|
|
442
|
+
}
|
|
443
|
+
function nonReactive(fn) {
|
|
444
|
+
getNonReactiveFnRegistry().add(fn);
|
|
445
|
+
if (Object.isExtensible(fn)) {
|
|
446
|
+
try {
|
|
447
|
+
;
|
|
448
|
+
fn[NON_REACTIVE_FN_MARKER] = true;
|
|
449
|
+
} catch {
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return fn;
|
|
453
|
+
}
|
|
454
|
+
function reactive(fn) {
|
|
455
|
+
if (Object.isExtensible(fn)) {
|
|
456
|
+
try {
|
|
457
|
+
;
|
|
458
|
+
fn[REACTIVE_FN_MARKER] = true;
|
|
459
|
+
} catch {
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return fn;
|
|
463
|
+
}
|
|
370
464
|
function unwrap(value) {
|
|
371
465
|
return isReactive(value) ? value() : value;
|
|
372
466
|
}
|
|
@@ -398,24 +492,25 @@ function createTextBinding(value) {
|
|
|
398
492
|
const text = document.createTextNode("");
|
|
399
493
|
if (isReactive(value)) {
|
|
400
494
|
createRenderEffect(() => {
|
|
401
|
-
|
|
402
|
-
const fmt = formatTextValue(v);
|
|
403
|
-
if (text.data !== fmt) {
|
|
404
|
-
text.data = fmt;
|
|
405
|
-
}
|
|
495
|
+
setText(text, value());
|
|
406
496
|
});
|
|
407
497
|
} else {
|
|
408
|
-
text
|
|
498
|
+
setText(text, value);
|
|
409
499
|
}
|
|
410
500
|
return text;
|
|
411
501
|
}
|
|
412
502
|
function bindText(textNode, getValue) {
|
|
413
|
-
return createRenderEffect(() =>
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
503
|
+
return createRenderEffect(() => setText(textNode, getValue()));
|
|
504
|
+
}
|
|
505
|
+
function setText(textNode, value) {
|
|
506
|
+
const next = formatTextValue(value);
|
|
507
|
+
const cache = textNode;
|
|
508
|
+
const prev = cache[TEXT_CACHE];
|
|
509
|
+
if (prev === next && textNode.data === next) return;
|
|
510
|
+
cache[TEXT_CACHE] = next;
|
|
511
|
+
if (textNode.data !== next) {
|
|
512
|
+
textNode.data = next;
|
|
513
|
+
}
|
|
419
514
|
}
|
|
420
515
|
function formatTextValue(value) {
|
|
421
516
|
if (value == null || value === false) {
|
|
@@ -433,65 +528,57 @@ function createAttributeBinding(el, key, value, setter) {
|
|
|
433
528
|
}
|
|
434
529
|
}
|
|
435
530
|
function bindAttribute(el, key, getValue) {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
531
|
+
return createRenderEffect(() => setAttr(el, key, getValue()));
|
|
532
|
+
}
|
|
533
|
+
function setAttr(el, key, value) {
|
|
534
|
+
const cacheTarget = el;
|
|
535
|
+
const attrCache = cacheTarget[ATTR_CACHE] ?? (cacheTarget[ATTR_CACHE] = /* @__PURE__ */ Object.create(null));
|
|
536
|
+
if (attrCache[key] === value) return;
|
|
537
|
+
attrCache[key] = value;
|
|
538
|
+
if (value === void 0 || value === null || value === false) {
|
|
539
|
+
el.removeAttribute(key);
|
|
540
|
+
} else if (value === true) {
|
|
541
|
+
el.setAttribute(key, "");
|
|
542
|
+
} else {
|
|
543
|
+
el.setAttribute(key, String(value));
|
|
544
|
+
}
|
|
449
545
|
}
|
|
450
546
|
function bindProperty(el, key, getValue) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
if (PROPERTY_BINDING_KEYS.has(key) && (next === void 0 || next === null)) {
|
|
466
|
-
const fallback = key === "checked" || key === "selected" ? false : "";
|
|
467
|
-
el[key] = fallback;
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
;
|
|
471
|
-
el[key] = next;
|
|
472
|
-
});
|
|
547
|
+
return createRenderEffect(() => setProp(el, key, getValue()));
|
|
548
|
+
}
|
|
549
|
+
function setProp(el, key, value) {
|
|
550
|
+
const cacheTarget = el;
|
|
551
|
+
const propCache = cacheTarget[PROP_CACHE] ?? (cacheTarget[PROP_CACHE] = /* @__PURE__ */ Object.create(null));
|
|
552
|
+
if (propCache[key] === value) return;
|
|
553
|
+
propCache[key] = value;
|
|
554
|
+
if (PROPERTY_BINDING_KEYS.has(key) && (value === void 0 || value === null)) {
|
|
555
|
+
const fallback = key === "checked" || key === "selected" ? false : "";
|
|
556
|
+
el[key] = fallback;
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
;
|
|
560
|
+
el[key] = value;
|
|
473
561
|
}
|
|
474
562
|
function createStyleBinding(el, value) {
|
|
475
|
-
const target = el;
|
|
476
563
|
if (isReactive(value)) {
|
|
477
|
-
let prev;
|
|
478
564
|
createRenderEffect(() => {
|
|
479
|
-
|
|
480
|
-
applyStyle(target, next, prev);
|
|
481
|
-
prev = next;
|
|
565
|
+
setStyle(el, value());
|
|
482
566
|
});
|
|
483
567
|
} else {
|
|
484
|
-
|
|
568
|
+
setStyle(el, value);
|
|
485
569
|
}
|
|
486
570
|
}
|
|
487
571
|
function bindStyle(el, getValue) {
|
|
572
|
+
return createRenderEffect(() => setStyle(el, getValue()));
|
|
573
|
+
}
|
|
574
|
+
function setStyle(el, value) {
|
|
488
575
|
const target = el;
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
576
|
+
const cache = target;
|
|
577
|
+
const prev = cache[STYLE_CACHE];
|
|
578
|
+
if (typeof value === "string" && prev === value) return;
|
|
579
|
+
if ((value === null || value === void 0) && (prev === null || prev === void 0)) return;
|
|
580
|
+
applyStyle(target, value, prev);
|
|
581
|
+
cache[STYLE_CACHE] = value;
|
|
495
582
|
}
|
|
496
583
|
function applyStyle(el, value, prev) {
|
|
497
584
|
if (typeof value === "string") {
|
|
@@ -503,29 +590,33 @@ function applyStyle(el, value, prev) {
|
|
|
503
590
|
}
|
|
504
591
|
if (prev && typeof prev === "object") {
|
|
505
592
|
const prevStyles = prev;
|
|
506
|
-
for (const key
|
|
507
|
-
if (!(key
|
|
508
|
-
|
|
593
|
+
for (const key in prevStyles) {
|
|
594
|
+
if (!hasOwn.call(prevStyles, key)) continue;
|
|
595
|
+
if (!hasOwn.call(styles, key)) {
|
|
596
|
+
const cssProperty = normalizeStyleProperty(key);
|
|
509
597
|
el.style.removeProperty(cssProperty);
|
|
510
598
|
}
|
|
511
599
|
}
|
|
512
600
|
}
|
|
513
|
-
for (const
|
|
601
|
+
for (const prop2 in styles) {
|
|
602
|
+
if (!hasOwn.call(styles, prop2)) continue;
|
|
603
|
+
const v = styles[prop2];
|
|
514
604
|
if (v != null) {
|
|
515
|
-
const cssProperty = prop2
|
|
605
|
+
const cssProperty = normalizeStyleProperty(prop2);
|
|
516
606
|
const unitless = isUnitlessStyleProperty(prop2) || isUnitlessStyleProperty(cssProperty);
|
|
517
607
|
const valueStr = typeof v === "number" && !unitless ? `${v}px` : String(v);
|
|
518
608
|
el.style.setProperty(cssProperty, valueStr);
|
|
519
609
|
} else {
|
|
520
|
-
const cssProperty = prop2
|
|
610
|
+
const cssProperty = normalizeStyleProperty(prop2);
|
|
521
611
|
el.style.removeProperty(cssProperty);
|
|
522
612
|
}
|
|
523
613
|
}
|
|
524
614
|
} else {
|
|
525
615
|
if (prev && typeof prev === "object") {
|
|
526
616
|
const prevStyles = prev;
|
|
527
|
-
for (const key
|
|
528
|
-
|
|
617
|
+
for (const key in prevStyles) {
|
|
618
|
+
if (!hasOwn.call(prevStyles, key)) continue;
|
|
619
|
+
const cssProperty = normalizeStyleProperty(key);
|
|
529
620
|
el.style.removeProperty(cssProperty);
|
|
530
621
|
}
|
|
531
622
|
} else if (typeof prev === "string") {
|
|
@@ -534,32 +625,38 @@ function applyStyle(el, value, prev) {
|
|
|
534
625
|
}
|
|
535
626
|
}
|
|
536
627
|
var isUnitlessStyleProperty = isDev ? (prop2) => UnitlessStyles.has(prop2) : (prop2) => prop2 === "opacity" || prop2 === "zIndex";
|
|
628
|
+
function normalizeStyleProperty(prop2) {
|
|
629
|
+
const cached = STYLE_PROP_CACHE.get(prop2);
|
|
630
|
+
if (cached) return cached;
|
|
631
|
+
const normalized = prop2.includes("-") ? prop2 : prop2.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
632
|
+
STYLE_PROP_CACHE.set(prop2, normalized);
|
|
633
|
+
return normalized;
|
|
634
|
+
}
|
|
537
635
|
function createClassBinding(el, value) {
|
|
538
636
|
if (isReactive(value)) {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
prev = applyClass(el, next, prev);
|
|
543
|
-
});
|
|
637
|
+
createRenderEffect(
|
|
638
|
+
() => setClass(el, value())
|
|
639
|
+
);
|
|
544
640
|
} else {
|
|
545
|
-
|
|
641
|
+
setClass(el, value);
|
|
546
642
|
}
|
|
547
643
|
}
|
|
548
644
|
function bindClass(el, getValue) {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
645
|
+
return createRenderEffect(() => setClass(el, getValue()));
|
|
646
|
+
}
|
|
647
|
+
function setClass(el, value) {
|
|
648
|
+
const cache = el;
|
|
649
|
+
const prevValue = cache[CLASS_VALUE_CACHE];
|
|
650
|
+
const prevState = cache[CLASS_STATE_CACHE] ?? {};
|
|
651
|
+
if (typeof value === "string") {
|
|
652
|
+
if (typeof prevValue === "string" && prevValue === value) return;
|
|
653
|
+
el.className = value;
|
|
654
|
+
cache[CLASS_STATE_CACHE] = {};
|
|
655
|
+
cache[CLASS_VALUE_CACHE] = value;
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
cache[CLASS_STATE_CACHE] = applyClass(el, value, prevState);
|
|
659
|
+
cache[CLASS_VALUE_CACHE] = value;
|
|
563
660
|
}
|
|
564
661
|
function toggleClassKey(node, key, value) {
|
|
565
662
|
const classNames = key.trim().split(/\s+/);
|
|
@@ -1509,9 +1606,21 @@ function createPortal(container, render2, createElementFn) {
|
|
|
1509
1606
|
|
|
1510
1607
|
// src/props.ts
|
|
1511
1608
|
var PROP_GETTER_MARKER2 = Symbol.for("fict:prop-getter");
|
|
1609
|
+
var NON_REACTIVE_FN_MARKER2 = Symbol.for("fict:non-reactive-fn");
|
|
1610
|
+
var REACTIVE_FN_MARKER2 = Symbol.for("fict:reactive-fn");
|
|
1611
|
+
var NON_REACTIVE_FN_REGISTRY_KEY2 = Symbol.for("fict:non-reactive-fn-registry");
|
|
1512
1612
|
var propGetters = /* @__PURE__ */ new WeakSet();
|
|
1513
1613
|
var rawToProxy = /* @__PURE__ */ new WeakMap();
|
|
1514
1614
|
var proxyToRaw = /* @__PURE__ */ new WeakMap();
|
|
1615
|
+
function getNonReactiveFnRegistry2() {
|
|
1616
|
+
const host = globalThis;
|
|
1617
|
+
let registry = host[NON_REACTIVE_FN_REGISTRY_KEY2];
|
|
1618
|
+
if (!registry) {
|
|
1619
|
+
registry = /* @__PURE__ */ new WeakSet();
|
|
1620
|
+
host[NON_REACTIVE_FN_REGISTRY_KEY2] = registry;
|
|
1621
|
+
}
|
|
1622
|
+
return registry;
|
|
1623
|
+
}
|
|
1515
1624
|
function __fictProp(getter) {
|
|
1516
1625
|
if (typeof getter === "function" && getter.length === 0) {
|
|
1517
1626
|
propGetters.add(getter);
|
|
@@ -1530,6 +1639,35 @@ function isPropGetter(value) {
|
|
|
1530
1639
|
const fn = value;
|
|
1531
1640
|
return propGetters.has(fn) || fn[PROP_GETTER_MARKER2] === true;
|
|
1532
1641
|
}
|
|
1642
|
+
function isNonReactiveFn2(value) {
|
|
1643
|
+
if (typeof value !== "function") return false;
|
|
1644
|
+
if (getNonReactiveFnRegistry2().has(value)) return true;
|
|
1645
|
+
return value[NON_REACTIVE_FN_MARKER2] === true;
|
|
1646
|
+
}
|
|
1647
|
+
function markNonReactiveFn(fn) {
|
|
1648
|
+
getNonReactiveFnRegistry2().add(fn);
|
|
1649
|
+
if (Object.isExtensible(fn)) {
|
|
1650
|
+
try {
|
|
1651
|
+
;
|
|
1652
|
+
fn[NON_REACTIVE_FN_MARKER2] = true;
|
|
1653
|
+
} catch {
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
return fn;
|
|
1657
|
+
}
|
|
1658
|
+
function isExplicitReactiveFn2(value) {
|
|
1659
|
+
if (typeof value !== "function") return false;
|
|
1660
|
+
return value[REACTIVE_FN_MARKER2] === true;
|
|
1661
|
+
}
|
|
1662
|
+
function normalizePropsFunction(value) {
|
|
1663
|
+
if (typeof value !== "function") return value;
|
|
1664
|
+
if (value.length !== 0) return value;
|
|
1665
|
+
if (isPropGetter(value) || isSignal(value) || isComputed(value) || isExplicitReactiveFn2(value)) {
|
|
1666
|
+
return value;
|
|
1667
|
+
}
|
|
1668
|
+
if (isEffect(value) || isEffectScope(value) || isNonReactiveFn2(value)) return value;
|
|
1669
|
+
return markNonReactiveFn(value);
|
|
1670
|
+
}
|
|
1533
1671
|
function createPropsProxy(props) {
|
|
1534
1672
|
if (!props || typeof props !== "object") {
|
|
1535
1673
|
return props;
|
|
@@ -1547,7 +1685,7 @@ function createPropsProxy(props) {
|
|
|
1547
1685
|
if (isPropGetter(value)) {
|
|
1548
1686
|
return value();
|
|
1549
1687
|
}
|
|
1550
|
-
return value;
|
|
1688
|
+
return normalizePropsFunction(value);
|
|
1551
1689
|
},
|
|
1552
1690
|
set(target, prop2, value, receiver) {
|
|
1553
1691
|
return Reflect.set(target, prop2, value, receiver);
|
|
@@ -1679,7 +1817,7 @@ function prop(getter, options) {
|
|
|
1679
1817
|
// src/dom.ts
|
|
1680
1818
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
1681
1819
|
var MATHML_NS = "http://www.w3.org/1998/Math/MathML";
|
|
1682
|
-
var isDev2 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process
|
|
1820
|
+
var isDev2 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
|
|
1683
1821
|
var nextComponentId = 1;
|
|
1684
1822
|
function render(view, container) {
|
|
1685
1823
|
const root = createRootContext();
|
|
@@ -1752,6 +1890,9 @@ function createElementWithContext(node, namespace) {
|
|
|
1752
1890
|
}
|
|
1753
1891
|
return createElementWithContext(resolved, namespace);
|
|
1754
1892
|
}
|
|
1893
|
+
if (typeof node === "function") {
|
|
1894
|
+
return document.createTextNode("");
|
|
1895
|
+
}
|
|
1755
1896
|
if (typeof node === "object" && node !== null && !(node instanceof Node)) {
|
|
1756
1897
|
if ("marker" in node) {
|
|
1757
1898
|
const handle = node;
|
|
@@ -1945,9 +2086,12 @@ function appendChildNode(parent, child, namespace) {
|
|
|
1945
2086
|
child.flush?.();
|
|
1946
2087
|
return;
|
|
1947
2088
|
}
|
|
1948
|
-
if (typeof child === "function"
|
|
2089
|
+
if (typeof child === "function") {
|
|
1949
2090
|
const childGetter = child;
|
|
1950
|
-
|
|
2091
|
+
if (isReactive(childGetter)) {
|
|
2092
|
+
createChildBinding(parent, childGetter, (node) => createElementWithContext(node, namespace));
|
|
2093
|
+
return;
|
|
2094
|
+
}
|
|
1951
2095
|
return;
|
|
1952
2096
|
}
|
|
1953
2097
|
if (Array.isArray(child)) {
|
|
@@ -2220,17 +2364,24 @@ export {
|
|
|
2220
2364
|
batch2 as batch,
|
|
2221
2365
|
untrack2 as untrack,
|
|
2222
2366
|
isReactive,
|
|
2367
|
+
nonReactive,
|
|
2368
|
+
reactive,
|
|
2223
2369
|
unwrap,
|
|
2224
2370
|
callEventHandler,
|
|
2225
2371
|
createTextBinding,
|
|
2226
2372
|
bindText,
|
|
2373
|
+
setText,
|
|
2227
2374
|
createAttributeBinding,
|
|
2228
2375
|
bindAttribute,
|
|
2376
|
+
setAttr,
|
|
2229
2377
|
bindProperty,
|
|
2378
|
+
setProp,
|
|
2230
2379
|
createStyleBinding,
|
|
2231
2380
|
bindStyle,
|
|
2381
|
+
setStyle,
|
|
2232
2382
|
createClassBinding,
|
|
2233
2383
|
bindClass,
|
|
2384
|
+
setClass,
|
|
2234
2385
|
classList,
|
|
2235
2386
|
insert,
|
|
2236
2387
|
insertBetween,
|
|
@@ -2256,4 +2407,4 @@ export {
|
|
|
2256
2407
|
createElement,
|
|
2257
2408
|
template
|
|
2258
2409
|
};
|
|
2259
|
-
//# sourceMappingURL=chunk-
|
|
2410
|
+
//# sourceMappingURL=chunk-4LCHQ7U4.js.map
|