lilact 0.31.6 → 0.31.7
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 +49 -16
- package/dist/lilact.development.js.map +3 -3
- package/dist/lilact.development.min.js +23 -23
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +23 -23
- 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.useCallback.html +2 -2
- package/docs/functions/hooks.useEffect.html +1 -1
- package/docs/functions/hooks.useImperativeHandle.html +1 -1
- 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/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 +49 -16
- package/docs/static/lilact.development.js.map +3 -3
- package/docs/static/lilact.development.min.js +23 -23
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +23 -23
- package/docs/variables/components.cloneElement.html +1 -1
- package/examples/demos/error-callback.jsx +7 -9
- package/examples/lilact.development.js +49 -16
- package/examples/lilact.development.js.map +3 -3
- package/examples/lilact.development.min.js +23 -23
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +23 -23
- package/package.json +1 -1
- package/src/components.jsx +74 -22
- package/src/hooks.jsx +6 -6
- package/src/run.jsx +62 -6
- package/docs/variables/run.required_scripts.html +0 -1
|
@@ -2379,6 +2379,21 @@ function getComponentEntity(entity) {
|
|
|
2379
2379
|
return entity?.[MEMOIZED] ? entity.component : entity;
|
|
2380
2380
|
}
|
|
2381
2381
|
var hotEntityAliases = /* @__PURE__ */ new Map();
|
|
2382
|
+
var hotEntityCacheTokens = /* @__PURE__ */ new WeakMap();
|
|
2383
|
+
function getHotEntityCacheToken(entity) {
|
|
2384
|
+
entity = getComponentEntity(entity);
|
|
2385
|
+
if (typeof entity !== "function") {
|
|
2386
|
+
return entity;
|
|
2387
|
+
}
|
|
2388
|
+
let token2 = hotEntityCacheTokens.get(entity);
|
|
2389
|
+
if (!token2) {
|
|
2390
|
+
const resolved = resolveHotEntity(entity);
|
|
2391
|
+
token2 = hotEntityCacheTokens.get(resolved) || {};
|
|
2392
|
+
hotEntityCacheTokens.set(entity, token2);
|
|
2393
|
+
hotEntityCacheTokens.set(resolved, token2);
|
|
2394
|
+
}
|
|
2395
|
+
return token2;
|
|
2396
|
+
}
|
|
2382
2397
|
function resolveHotEntity(entity) {
|
|
2383
2398
|
entity = getComponentEntity(entity);
|
|
2384
2399
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -2434,6 +2449,9 @@ function replaceComponentEntity(componentCore, nextEntity) {
|
|
|
2434
2449
|
}
|
|
2435
2450
|
const oldEntity = getComponentEntity(componentCore.entity);
|
|
2436
2451
|
const newEntity = resolveHotEntity(nextEntity);
|
|
2452
|
+
const cacheToken = hotEntityCacheTokens.get(oldEntity) || hotEntityCacheTokens.get(newEntity) || {};
|
|
2453
|
+
hotEntityCacheTokens.set(oldEntity, cacheToken);
|
|
2454
|
+
hotEntityCacheTokens.set(newEntity, cacheToken);
|
|
2437
2455
|
if (oldEntity === newEntity) {
|
|
2438
2456
|
return true;
|
|
2439
2457
|
}
|
|
@@ -2463,6 +2481,9 @@ function replaceAllComponentInstances(oldEntity, newEntity) {
|
|
|
2463
2481
|
if (oldEntity === newEntity) {
|
|
2464
2482
|
return 0;
|
|
2465
2483
|
}
|
|
2484
|
+
const cacheToken = hotEntityCacheTokens.get(oldEntity) || hotEntityCacheTokens.get(newEntity) || {};
|
|
2485
|
+
hotEntityCacheTokens.set(oldEntity, cacheToken);
|
|
2486
|
+
hotEntityCacheTokens.set(newEntity, cacheToken);
|
|
2466
2487
|
hotEntityAliases.set(oldEntity, newEntity);
|
|
2467
2488
|
const instances = componentInstances.get(oldEntity);
|
|
2468
2489
|
if (!instances) {
|
|
@@ -2576,14 +2597,18 @@ var ComponentCore = class {
|
|
|
2576
2597
|
if (do_rerender) {
|
|
2577
2598
|
if (true) {
|
|
2578
2599
|
if (this.entity?.propTypes) {
|
|
2579
|
-
PropTypes.checkPropTypes(this.entity.propTypes,
|
|
2600
|
+
PropTypes.checkPropTypes(this.entity.propTypes, next_props, "prop", this.entity.name);
|
|
2580
2601
|
} else if (this.component?.propTypes) {
|
|
2581
|
-
PropTypes.checkPropTypes(this.component.propTypes,
|
|
2602
|
+
PropTypes.checkPropTypes(this.component.propTypes, next_props, "prop", this.component.name);
|
|
2582
2603
|
}
|
|
2583
2604
|
}
|
|
2584
2605
|
if (typeof next_state === "function") next_state = next_state(this.state);
|
|
2585
|
-
|
|
2586
|
-
|
|
2606
|
+
const defaultProps = this.entity?.defaultProps || this.component?.constructor?.defaultProps;
|
|
2607
|
+
if (defaultProps) {
|
|
2608
|
+
next_props = {
|
|
2609
|
+
...defaultProps,
|
|
2610
|
+
...next_props || {}
|
|
2611
|
+
};
|
|
2587
2612
|
}
|
|
2588
2613
|
if (this?.parent?.component?.context || this?.parent?.component?.getChildContext) {
|
|
2589
2614
|
this.context = { ...this.parent.component.context, ...this.parent.component.getChildContext?.() };
|
|
@@ -2997,11 +3022,22 @@ function prepareCore(parent, core) {
|
|
|
2997
3022
|
try {
|
|
2998
3023
|
parent.cache ?? (parent.cache = new ComponentCache(parent));
|
|
2999
3024
|
const isText = core[TEXT2] !== void 0;
|
|
3000
|
-
const
|
|
3001
|
-
const entity = isText ||
|
|
3025
|
+
const isExistingCore = core instanceof ComponentCore;
|
|
3026
|
+
const entity = isText || isExistingCore ? void 0 : resolveHotEntity(core.entity);
|
|
3027
|
+
const hasExplicitKey = !isText && core.props && core.props.key !== void 0 && core.props.key !== null;
|
|
3028
|
+
let key;
|
|
3029
|
+
if (isText) {
|
|
3030
|
+
key = ":text:";
|
|
3031
|
+
} else if (hasExplicitKey) {
|
|
3032
|
+
key = core.props.key;
|
|
3033
|
+
} else if (typeof entity === "function") {
|
|
3034
|
+
key = getHotEntityCacheToken(entity);
|
|
3035
|
+
} else {
|
|
3036
|
+
key = entity;
|
|
3037
|
+
}
|
|
3002
3038
|
return parent.cache.pick(
|
|
3003
3039
|
key,
|
|
3004
|
-
() => isText ||
|
|
3040
|
+
() => isText || isExistingCore ? core : constructFunc(core, parent)[CORE],
|
|
3005
3041
|
entity
|
|
3006
3042
|
);
|
|
3007
3043
|
} catch (e) {
|
|
@@ -3509,7 +3545,7 @@ function useState(initialValue) {
|
|
|
3509
3545
|
}
|
|
3510
3546
|
return [hk.value, hk.set_func];
|
|
3511
3547
|
}
|
|
3512
|
-
function useCallback(callback, deps
|
|
3548
|
+
function useCallback(callback, deps) {
|
|
3513
3549
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3514
3550
|
throw new Error("Callback dependencies must be an array, object or omitted.");
|
|
3515
3551
|
}
|
|
@@ -3601,7 +3637,7 @@ function useRef(initialValue = null) {
|
|
|
3601
3637
|
}
|
|
3602
3638
|
return hk;
|
|
3603
3639
|
}
|
|
3604
|
-
async function useLayoutEffect(effect, deps
|
|
3640
|
+
async function useLayoutEffect(effect, deps) {
|
|
3605
3641
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3606
3642
|
throw new Error("Layout effect dependencies must be an array, object or omitted.");
|
|
3607
3643
|
}
|
|
@@ -3620,7 +3656,7 @@ async function useLayoutEffect(effect, deps = void 0) {
|
|
|
3620
3656
|
NATIVE_TIMERS.clearTimeout(lilact_default.effect_timeout);
|
|
3621
3657
|
lilact_default.effect_timeout = NATIVE_TIMERS.setTimeout(lilact_default.processEffects, 0);
|
|
3622
3658
|
}
|
|
3623
|
-
async function useEffect(effect, deps
|
|
3659
|
+
async function useEffect(effect, deps) {
|
|
3624
3660
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3625
3661
|
throw new Error("Effect dependencies must be an array, object or omitted.");
|
|
3626
3662
|
}
|
|
@@ -3639,7 +3675,7 @@ async function useEffect(effect, deps = void 0) {
|
|
|
3639
3675
|
NATIVE_TIMERS.clearTimeout(lilact_default.effect_timeout);
|
|
3640
3676
|
lilact_default.effect_timeout = NATIVE_TIMERS.setTimeout(lilact_default.processEffects, 0);
|
|
3641
3677
|
}
|
|
3642
|
-
async function useInsertionEffect(effect, deps
|
|
3678
|
+
async function useInsertionEffect(effect, deps) {
|
|
3643
3679
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3644
3680
|
throw new Error("Insertion effect dependencies must be an array, object, or omitted.");
|
|
3645
3681
|
}
|
|
@@ -3658,7 +3694,7 @@ async function useInsertionEffect(effect, deps = void 0) {
|
|
|
3658
3694
|
NATIVE_TIMERS.clearTimeout(lilact_default.effect_timeout);
|
|
3659
3695
|
lilact_default.effect_timeout = NATIVE_TIMERS.setTimeout(lilact_default.processEffects, 0);
|
|
3660
3696
|
}
|
|
3661
|
-
function useMemo(factory, deps
|
|
3697
|
+
function useMemo(factory, deps) {
|
|
3662
3698
|
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3663
3699
|
throw new Error("Memo dependencies must be an array or omitted.");
|
|
3664
3700
|
}
|
|
@@ -3736,7 +3772,7 @@ function useDeferredValue(value, initialValue) {
|
|
|
3736
3772
|
}, [value]);
|
|
3737
3773
|
return deferred;
|
|
3738
3774
|
}
|
|
3739
|
-
function useImperativeHandle(ref, factory, deps
|
|
3775
|
+
function useImperativeHandle(ref, factory, deps) {
|
|
3740
3776
|
if (deps !== void 0 && ref?.deps !== void 0 && shallowEqual(deps, ref.deps)) return;
|
|
3741
3777
|
ref.deps = deps;
|
|
3742
3778
|
if (typeof ref?.current !== "object") {
|
|
@@ -3823,10 +3859,7 @@ function createModule(path2, {
|
|
|
3823
3859
|
mappings: [],
|
|
3824
3860
|
meta: {},
|
|
3825
3861
|
exports: {},
|
|
3826
|
-
// True only after the module has been successfully evaluated.
|
|
3827
3862
|
loaded: false,
|
|
3828
|
-
// The promise for the request currently loading this resource.
|
|
3829
|
-
// This is deliberately stored on the module to deduplicate requests.
|
|
3830
3863
|
request: void 0,
|
|
3831
3864
|
error: void 0
|
|
3832
3865
|
};
|