lilact 0.31.6 → 0.31.8
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/lilact.development.js +61 -22
- package/dist/lilact.development.js.map +3 -3
- package/dist/lilact.development.min.js +26 -26
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +26 -26
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/accessories.ErrorBoundary.html +8 -8
- package/docs/classes/accessories.Suspense.html +7 -7
- package/docs/classes/components.Component.html +11 -11
- package/docs/classes/components.HTMLComponent.html +11 -11
- package/docs/classes/components.RootComponent.html +11 -11
- package/docs/functions/components.cloneComponent.html +1 -1
- package/docs/functions/components.createComponent.html +1 -1
- package/docs/functions/components.createPortal.html +1 -1
- package/docs/functions/components.createRoot.html +1 -1
- package/docs/functions/components.memo.html +1 -1
- package/docs/functions/components.render.html +1 -1
- package/docs/functions/components.replaceAllComponentInstances.html +1 -1
- package/docs/functions/components.replaceComponentEntity.html +1 -1
- package/docs/functions/hooks.startTransition.html +1 -1
- package/docs/functions/hooks.useCallback.html +2 -2
- package/docs/functions/hooks.useDebugValue.html +1 -1
- package/docs/functions/hooks.useDeferredValue.html +1 -1
- package/docs/functions/hooks.useEffect.html +1 -1
- package/docs/functions/hooks.useImperativeHandle.html +2 -2
- package/docs/functions/hooks.useInsertionEffect.html +1 -1
- package/docs/functions/hooks.useLayoutEffect.html +1 -1
- package/docs/functions/hooks.useMemo.html +1 -1
- package/docs/functions/hooks.useReducer.html +1 -1
- package/docs/functions/run.lazy.html +10 -1
- package/docs/functions/run.require.html +7 -1
- package/docs/functions/run.run.html +14 -1
- package/docs/functions/run.runScripts.html +8 -1
- package/docs/modules/run.html +1 -1
- package/docs/static/demos/error-callback.jsx +7 -9
- package/docs/static/lilact.development.js +61 -22
- package/docs/static/lilact.development.js.map +3 -3
- package/docs/static/lilact.development.min.js +26 -26
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +26 -26
- package/docs/variables/components.cloneElement.html +1 -1
- package/examples/demos/error-callback.jsx +7 -9
- package/examples/lilact.development.js +61 -22
- package/examples/lilact.development.js.map +3 -3
- package/examples/lilact.development.min.js +26 -26
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +26 -26
- package/package.json +1 -1
- package/src/components.jsx +83 -27
- package/src/hooks.jsx +7 -8
- package/src/run.jsx +62 -6
- package/src/symbols.jsx +2 -0
- package/docs/variables/run.required_scripts.html +0 -1
|
@@ -1709,6 +1709,7 @@ __export(symbols_exports, {
|
|
|
1709
1709
|
CALLBACK: () => CALLBACK,
|
|
1710
1710
|
CHILD_CLASS_ADDENDUM: () => CHILD_CLASS_ADDENDUM,
|
|
1711
1711
|
CLEARED: () => CLEARED,
|
|
1712
|
+
CLONED_STYLE: () => CLONED_STYLE,
|
|
1712
1713
|
COMPONENT: () => COMPONENT,
|
|
1713
1714
|
CORE: () => CORE,
|
|
1714
1715
|
DUE: () => DUE,
|
|
@@ -1731,6 +1732,7 @@ var [
|
|
|
1731
1732
|
CHILD_CLASS_ADDENDUM,
|
|
1732
1733
|
MEMOIZED,
|
|
1733
1734
|
LAZY,
|
|
1735
|
+
CLONED_STYLE,
|
|
1734
1736
|
DUE,
|
|
1735
1737
|
REPEAT,
|
|
1736
1738
|
CLEARED,
|
|
@@ -1747,6 +1749,7 @@ var [
|
|
|
1747
1749
|
/* @__PURE__ */ Symbol.for("LILACT:CHILD_CLASS_ADDENDUM"),
|
|
1748
1750
|
/* @__PURE__ */ Symbol.for("LILACT:MEMOIZED"),
|
|
1749
1751
|
/* @__PURE__ */ Symbol.for("LILACT:LAZY"),
|
|
1752
|
+
/* @__PURE__ */ Symbol.for("LILACT:CLONED_STYLE"),
|
|
1750
1753
|
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:DUE"),
|
|
1751
1754
|
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:REPEAT"),
|
|
1752
1755
|
/* @__PURE__ */ Symbol.for("LILACT:TIMERS:CLEARED"),
|
|
@@ -2379,6 +2382,21 @@ function getComponentEntity(entity) {
|
|
|
2379
2382
|
return entity?.[MEMOIZED] ? entity.component : entity;
|
|
2380
2383
|
}
|
|
2381
2384
|
var hotEntityAliases = /* @__PURE__ */ new Map();
|
|
2385
|
+
var hotEntityCacheTokens = /* @__PURE__ */ new WeakMap();
|
|
2386
|
+
function getHotEntityCacheToken(entity) {
|
|
2387
|
+
entity = getComponentEntity(entity);
|
|
2388
|
+
if (typeof entity !== "function") {
|
|
2389
|
+
return entity;
|
|
2390
|
+
}
|
|
2391
|
+
let token2 = hotEntityCacheTokens.get(entity);
|
|
2392
|
+
if (!token2) {
|
|
2393
|
+
const resolved = resolveHotEntity(entity);
|
|
2394
|
+
token2 = hotEntityCacheTokens.get(resolved) || {};
|
|
2395
|
+
hotEntityCacheTokens.set(entity, token2);
|
|
2396
|
+
hotEntityCacheTokens.set(resolved, token2);
|
|
2397
|
+
}
|
|
2398
|
+
return token2;
|
|
2399
|
+
}
|
|
2382
2400
|
function resolveHotEntity(entity) {
|
|
2383
2401
|
entity = getComponentEntity(entity);
|
|
2384
2402
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -2434,6 +2452,9 @@ function replaceComponentEntity(componentCore, nextEntity) {
|
|
|
2434
2452
|
}
|
|
2435
2453
|
const oldEntity = getComponentEntity(componentCore.entity);
|
|
2436
2454
|
const newEntity = resolveHotEntity(nextEntity);
|
|
2455
|
+
const cacheToken = hotEntityCacheTokens.get(oldEntity) || hotEntityCacheTokens.get(newEntity) || {};
|
|
2456
|
+
hotEntityCacheTokens.set(oldEntity, cacheToken);
|
|
2457
|
+
hotEntityCacheTokens.set(newEntity, cacheToken);
|
|
2437
2458
|
if (oldEntity === newEntity) {
|
|
2438
2459
|
return true;
|
|
2439
2460
|
}
|
|
@@ -2463,6 +2484,9 @@ function replaceAllComponentInstances(oldEntity, newEntity) {
|
|
|
2463
2484
|
if (oldEntity === newEntity) {
|
|
2464
2485
|
return 0;
|
|
2465
2486
|
}
|
|
2487
|
+
const cacheToken = hotEntityCacheTokens.get(oldEntity) || hotEntityCacheTokens.get(newEntity) || {};
|
|
2488
|
+
hotEntityCacheTokens.set(oldEntity, cacheToken);
|
|
2489
|
+
hotEntityCacheTokens.set(newEntity, cacheToken);
|
|
2466
2490
|
hotEntityAliases.set(oldEntity, newEntity);
|
|
2467
2491
|
const instances = componentInstances.get(oldEntity);
|
|
2468
2492
|
if (!instances) {
|
|
@@ -2522,7 +2546,7 @@ var ComponentCache = class {
|
|
|
2522
2546
|
if (ex.cleanup) {
|
|
2523
2547
|
ex.cleanup();
|
|
2524
2548
|
} else if (ex.element && !ex.portal) {
|
|
2525
|
-
ex.element.parentElement
|
|
2549
|
+
ex.element.parentElement?.removeChild?.(ex.element);
|
|
2526
2550
|
}
|
|
2527
2551
|
});
|
|
2528
2552
|
});
|
|
@@ -2576,14 +2600,21 @@ var ComponentCore = class {
|
|
|
2576
2600
|
if (do_rerender) {
|
|
2577
2601
|
if (true) {
|
|
2578
2602
|
if (this.entity?.propTypes) {
|
|
2579
|
-
PropTypes.checkPropTypes(this.entity.propTypes,
|
|
2603
|
+
PropTypes.checkPropTypes(this.entity.propTypes, next_props, "prop", this.entity.name);
|
|
2580
2604
|
} else if (this.component?.propTypes) {
|
|
2581
|
-
PropTypes.checkPropTypes(this.component.propTypes,
|
|
2605
|
+
PropTypes.checkPropTypes(this.component.propTypes, next_props, "prop", this.component.name);
|
|
2582
2606
|
}
|
|
2583
2607
|
}
|
|
2584
2608
|
if (typeof next_state === "function") next_state = next_state(this.state);
|
|
2585
|
-
|
|
2586
|
-
|
|
2609
|
+
const defaultProps = this.entity?.defaultProps || this.component?.constructor?.defaultProps;
|
|
2610
|
+
if (defaultProps) {
|
|
2611
|
+
next_props = {
|
|
2612
|
+
...defaultProps,
|
|
2613
|
+
...next_props || {}
|
|
2614
|
+
};
|
|
2615
|
+
}
|
|
2616
|
+
if (next_props?.style && typeof next_props.style === "object" && !next_props.style[CLONED_STYLE]) {
|
|
2617
|
+
next_props.style = { ...next_props.style, [CLONED_STYLE]: true };
|
|
2587
2618
|
}
|
|
2588
2619
|
if (this?.parent?.component?.context || this?.parent?.component?.getChildContext) {
|
|
2589
2620
|
this.context = { ...this.parent.component.context, ...this.parent.component.getChildContext?.() };
|
|
@@ -2692,7 +2723,7 @@ var ComponentCore = class {
|
|
|
2692
2723
|
if (typeof this.props.ref === "function") {
|
|
2693
2724
|
this.props.ref(null);
|
|
2694
2725
|
} else {
|
|
2695
|
-
this.props.current = null;
|
|
2726
|
+
this.props.ref.current = null;
|
|
2696
2727
|
}
|
|
2697
2728
|
}
|
|
2698
2729
|
if (this.component.componentWillUnmount) {
|
|
@@ -2786,7 +2817,7 @@ var ComponentCore = class {
|
|
|
2786
2817
|
this.element.style = "";
|
|
2787
2818
|
} else {
|
|
2788
2819
|
for (let p in this.props.style) {
|
|
2789
|
-
if (!patch.style.hasOwnProperty(p)) {
|
|
2820
|
+
if (p !== CLONED_STYLE && !patch.style.hasOwnProperty(p)) {
|
|
2790
2821
|
this.element.style[p] = "";
|
|
2791
2822
|
}
|
|
2792
2823
|
}
|
|
@@ -2808,7 +2839,7 @@ var ComponentCore = class {
|
|
|
2808
2839
|
}
|
|
2809
2840
|
} else if (a === "autoFocus") {
|
|
2810
2841
|
this.element["autofocus"] = toBool(patch[a]);
|
|
2811
|
-
} else if (a === "htmlFor") {
|
|
2842
|
+
} else if (a === "htmlFor" || a === "for") {
|
|
2812
2843
|
this.element.setAttribute("for", patch[a]);
|
|
2813
2844
|
} else if (al !== "value" || ["input", "textarea", "select"].indexOf(this.entity) === -1) {
|
|
2814
2845
|
this.element.setAttribute(al, patch[a]);
|
|
@@ -2997,11 +3028,22 @@ function prepareCore(parent, core) {
|
|
|
2997
3028
|
try {
|
|
2998
3029
|
parent.cache ?? (parent.cache = new ComponentCache(parent));
|
|
2999
3030
|
const isText = core[TEXT2] !== void 0;
|
|
3000
|
-
const
|
|
3001
|
-
const entity = isText ||
|
|
3031
|
+
const isExistingCore = core instanceof ComponentCore;
|
|
3032
|
+
const entity = isText || isExistingCore ? void 0 : resolveHotEntity(core.entity);
|
|
3033
|
+
const hasExplicitKey = !isText && core.props && core.props.key !== void 0 && core.props.key !== null;
|
|
3034
|
+
let key;
|
|
3035
|
+
if (isText) {
|
|
3036
|
+
key = ":text:";
|
|
3037
|
+
} else if (hasExplicitKey) {
|
|
3038
|
+
key = core.props.key;
|
|
3039
|
+
} else if (typeof entity === "function") {
|
|
3040
|
+
key = getHotEntityCacheToken(entity);
|
|
3041
|
+
} else {
|
|
3042
|
+
key = entity;
|
|
3043
|
+
}
|
|
3002
3044
|
return parent.cache.pick(
|
|
3003
3045
|
key,
|
|
3004
|
-
() => isText ||
|
|
3046
|
+
() => isText || isExistingCore ? core : constructFunc(core, parent)[CORE],
|
|
3005
3047
|
entity
|
|
3006
3048
|
);
|
|
3007
3049
|
} catch (e) {
|
|
@@ -3509,7 +3551,7 @@ function useState(initialValue) {
|
|
|
3509
3551
|
}
|
|
3510
3552
|
return [hk.value, hk.set_func];
|
|
3511
3553
|
}
|
|
3512
|
-
function useCallback(callback, deps
|
|
3554
|
+
function useCallback(callback, deps) {
|
|
3513
3555
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3514
3556
|
throw new Error("Callback dependencies must be an array, object or omitted.");
|
|
3515
3557
|
}
|
|
@@ -3601,7 +3643,7 @@ function useRef(initialValue = null) {
|
|
|
3601
3643
|
}
|
|
3602
3644
|
return hk;
|
|
3603
3645
|
}
|
|
3604
|
-
async function useLayoutEffect(effect, deps
|
|
3646
|
+
async function useLayoutEffect(effect, deps) {
|
|
3605
3647
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3606
3648
|
throw new Error("Layout effect dependencies must be an array, object or omitted.");
|
|
3607
3649
|
}
|
|
@@ -3620,7 +3662,7 @@ async function useLayoutEffect(effect, deps = void 0) {
|
|
|
3620
3662
|
NATIVE_TIMERS.clearTimeout(lilact_default.effect_timeout);
|
|
3621
3663
|
lilact_default.effect_timeout = NATIVE_TIMERS.setTimeout(lilact_default.processEffects, 0);
|
|
3622
3664
|
}
|
|
3623
|
-
async function useEffect(effect, deps
|
|
3665
|
+
async function useEffect(effect, deps) {
|
|
3624
3666
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3625
3667
|
throw new Error("Effect dependencies must be an array, object or omitted.");
|
|
3626
3668
|
}
|
|
@@ -3639,7 +3681,7 @@ async function useEffect(effect, deps = void 0) {
|
|
|
3639
3681
|
NATIVE_TIMERS.clearTimeout(lilact_default.effect_timeout);
|
|
3640
3682
|
lilact_default.effect_timeout = NATIVE_TIMERS.setTimeout(lilact_default.processEffects, 0);
|
|
3641
3683
|
}
|
|
3642
|
-
async function useInsertionEffect(effect, deps
|
|
3684
|
+
async function useInsertionEffect(effect, deps) {
|
|
3643
3685
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3644
3686
|
throw new Error("Insertion effect dependencies must be an array, object, or omitted.");
|
|
3645
3687
|
}
|
|
@@ -3658,7 +3700,7 @@ async function useInsertionEffect(effect, deps = void 0) {
|
|
|
3658
3700
|
NATIVE_TIMERS.clearTimeout(lilact_default.effect_timeout);
|
|
3659
3701
|
lilact_default.effect_timeout = NATIVE_TIMERS.setTimeout(lilact_default.processEffects, 0);
|
|
3660
3702
|
}
|
|
3661
|
-
function useMemo(factory, deps
|
|
3703
|
+
function useMemo(factory, deps) {
|
|
3662
3704
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3663
3705
|
throw new Error("Memo dependencies must be an array or omitted.");
|
|
3664
3706
|
}
|
|
@@ -3683,8 +3725,7 @@ function useActionState(action, initialState) {
|
|
|
3683
3725
|
async () => {
|
|
3684
3726
|
const form_data = new FormData(event.target, event.submitter);
|
|
3685
3727
|
hk.state = await action(hk.state, form_data);
|
|
3686
|
-
}
|
|
3687
|
-
[]
|
|
3728
|
+
}
|
|
3688
3729
|
);
|
|
3689
3730
|
return false;
|
|
3690
3731
|
};
|
|
@@ -3736,7 +3777,7 @@ function useDeferredValue(value, initialValue) {
|
|
|
3736
3777
|
}, [value]);
|
|
3737
3778
|
return deferred;
|
|
3738
3779
|
}
|
|
3739
|
-
function useImperativeHandle(ref, factory, deps
|
|
3780
|
+
function useImperativeHandle(ref, factory, deps) {
|
|
3740
3781
|
if (deps !== void 0 && ref?.deps !== void 0 && shallowEqual(deps, ref.deps)) return;
|
|
3741
3782
|
ref.deps = deps;
|
|
3742
3783
|
if (typeof ref?.current !== "object") {
|
|
@@ -3823,10 +3864,7 @@ function createModule(path2, {
|
|
|
3823
3864
|
mappings: [],
|
|
3824
3865
|
meta: {},
|
|
3825
3866
|
exports: {},
|
|
3826
|
-
// True only after the module has been successfully evaluated.
|
|
3827
3867
|
loaded: false,
|
|
3828
|
-
// The promise for the request currently loading this resource.
|
|
3829
|
-
// This is deliberately stored on the module to deduplicate requests.
|
|
3830
3868
|
request: void 0,
|
|
3831
3869
|
error: void 0
|
|
3832
3870
|
};
|
|
@@ -7188,6 +7226,7 @@ export {
|
|
|
7188
7226
|
CALLBACK,
|
|
7189
7227
|
CHILD_CLASS_ADDENDUM,
|
|
7190
7228
|
CLEARED,
|
|
7229
|
+
CLONED_STYLE,
|
|
7191
7230
|
COMPONENT,
|
|
7192
7231
|
CORE,
|
|
7193
7232
|
CSSTransition,
|