lilact 0.30.1 → 0.31.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/lilact.development.js +68 -43
- package/dist/lilact.development.js.map +2 -2
- 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/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.hotReloadRoot.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/static/lilact.development.js +68 -43
- package/docs/static/lilact.development.js.map +2 -2
- 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/lilact.development.js +68 -43
- package/examples/lilact.development.js.map +2 -2
- 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 +104 -69
- package/src/lilact.jsx +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>replaceComponentEntity | Lilact</title><meta name="description" content="Documentation for Lilact"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Lilact</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/components.html">components</a></li><li><a href="" aria-current="page">replaceComponentEntity</a></li></ul><h1>Function replaceComponentEntity</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="replacecomponententity"><span class="tsd-kind-call-signature">replaceComponentEntity</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">componentCore</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">nextEntity</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><a href="#replacecomponententity" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">componentCore</span>: <span class="tsd-signature-type">any</span></span></li><li><span><span class="tsd-kind-parameter">nextEntity</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources"><ul><li>Defined in components.jsx:
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>replaceComponentEntity | Lilact</title><meta name="description" content="Documentation for Lilact"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Lilact</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/components.html">components</a></li><li><a href="" aria-current="page">replaceComponentEntity</a></li></ul><h1>Function replaceComponentEntity</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="replacecomponententity"><span class="tsd-kind-call-signature">replaceComponentEntity</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">componentCore</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">nextEntity</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><a href="#replacecomponententity" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">componentCore</span>: <span class="tsd-signature-type">any</span></span></li><li><span><span class="tsd-kind-parameter">nextEntity</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources"><ul><li>Defined in components.jsx:122</li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">Lilact</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -2371,6 +2371,16 @@ var SVG_NS = "http://www.w3.org/2000/svg";
|
|
|
2371
2371
|
function getComponentEntity(entity) {
|
|
2372
2372
|
return entity?.[MEMOIZED] ? entity.component : entity;
|
|
2373
2373
|
}
|
|
2374
|
+
var hotEntityAliases = /* @__PURE__ */ new Map();
|
|
2375
|
+
function resolveHotEntity(entity) {
|
|
2376
|
+
entity = getComponentEntity(entity);
|
|
2377
|
+
const visited = /* @__PURE__ */ new Set();
|
|
2378
|
+
while (typeof entity === "function" && hotEntityAliases.has(entity) && !visited.has(entity)) {
|
|
2379
|
+
visited.add(entity);
|
|
2380
|
+
entity = hotEntityAliases.get(entity);
|
|
2381
|
+
}
|
|
2382
|
+
return entity;
|
|
2383
|
+
}
|
|
2374
2384
|
var componentInstances = /* @__PURE__ */ new Map();
|
|
2375
2385
|
function registerComponentCore(core) {
|
|
2376
2386
|
const entity = getComponentEntity(core.entity);
|
|
@@ -2416,7 +2426,7 @@ function replaceComponentEntity(componentCore, nextEntity) {
|
|
|
2416
2426
|
return false;
|
|
2417
2427
|
}
|
|
2418
2428
|
const oldEntity = getComponentEntity(componentCore.entity);
|
|
2419
|
-
const newEntity =
|
|
2429
|
+
const newEntity = resolveHotEntity(nextEntity);
|
|
2420
2430
|
if (oldEntity === newEntity) {
|
|
2421
2431
|
return true;
|
|
2422
2432
|
}
|
|
@@ -2442,6 +2452,11 @@ function replaceAllComponentInstances(oldEntity, newEntity) {
|
|
|
2442
2452
|
if (typeof oldEntity !== "function" || typeof newEntity !== "function") {
|
|
2443
2453
|
return 0;
|
|
2444
2454
|
}
|
|
2455
|
+
newEntity = resolveHotEntity(newEntity);
|
|
2456
|
+
if (oldEntity === newEntity) {
|
|
2457
|
+
return 0;
|
|
2458
|
+
}
|
|
2459
|
+
hotEntityAliases.set(oldEntity, newEntity);
|
|
2445
2460
|
const instances = componentInstances.get(oldEntity);
|
|
2446
2461
|
if (!instances) {
|
|
2447
2462
|
return 0;
|
|
@@ -2471,7 +2486,7 @@ var ComponentCache = class {
|
|
|
2471
2486
|
componentCore = bucket[bucket[IDX]];
|
|
2472
2487
|
bucket[IDX]++;
|
|
2473
2488
|
const oldEntity = getComponentEntity(componentCore.entity);
|
|
2474
|
-
const newEntity =
|
|
2489
|
+
const newEntity = resolveHotEntity(nextEntity);
|
|
2475
2490
|
const incompatible = typeof oldEntity !== typeof newEntity || typeof oldEntity === "function" && isClass(oldEntity) !== isClass(newEntity);
|
|
2476
2491
|
if (incompatible) {
|
|
2477
2492
|
componentCore = construct_func();
|
|
@@ -2898,8 +2913,7 @@ var renderErrorHandler = (c, e) => {
|
|
|
2898
2913
|
};
|
|
2899
2914
|
function constructFunc(core, parent) {
|
|
2900
2915
|
let comp = core;
|
|
2901
|
-
if (core[TEXT2]
|
|
2902
|
-
} else {
|
|
2916
|
+
if (core[TEXT2] === void 0) {
|
|
2903
2917
|
let entity = core.entity;
|
|
2904
2918
|
let memoized = false;
|
|
2905
2919
|
if (typeof entity === "object") {
|
|
@@ -2910,52 +2924,63 @@ function constructFunc(core, parent) {
|
|
|
2910
2924
|
throw new Error("Invalid component.");
|
|
2911
2925
|
}
|
|
2912
2926
|
}
|
|
2927
|
+
entity = resolveHotEntity(entity);
|
|
2913
2928
|
if (typeof entity === "string") {
|
|
2914
2929
|
comp = new HTMLComponent(entity, core.props);
|
|
2915
|
-
} else {
|
|
2916
|
-
if (
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2930
|
+
} else if (isClass(entity)) {
|
|
2931
|
+
if (entity?.defaultProps) {
|
|
2932
|
+
core.props = {
|
|
2933
|
+
...entity.defaultProps,
|
|
2934
|
+
...core.props
|
|
2935
|
+
};
|
|
2936
|
+
}
|
|
2937
|
+
comp = new entity(core.props);
|
|
2938
|
+
const desc = Object.getOwnPropertyDescriptor(comp, "state");
|
|
2939
|
+
if (desc) {
|
|
2940
|
+
if (typeof desc.get !== "function" && typeof desc.set !== "function") {
|
|
2941
|
+
comp[CORE].state = comp.state;
|
|
2942
|
+
Object.defineProperty(comp, "state", {
|
|
2943
|
+
get() {
|
|
2944
|
+
return this[CORE].state;
|
|
2945
|
+
},
|
|
2946
|
+
set(value) {
|
|
2947
|
+
if (this[CORE].state === void 0) {
|
|
2948
|
+
this[CORE].state = value;
|
|
2949
|
+
} else {
|
|
2950
|
+
throw new Error(
|
|
2951
|
+
"Assigning component state this way is not allowed."
|
|
2952
|
+
);
|
|
2935
2953
|
}
|
|
2936
|
-
}
|
|
2937
|
-
}
|
|
2938
|
-
}
|
|
2939
|
-
} else if (typeof entity === "function") {
|
|
2940
|
-
if (entity?.defaultProps) {
|
|
2941
|
-
core.props = { ...entity.defaultProps, ...core.props };
|
|
2954
|
+
}
|
|
2955
|
+
});
|
|
2942
2956
|
}
|
|
2943
|
-
comp = new Component(core.props);
|
|
2944
|
-
comp.render = entity.bind(comp);
|
|
2945
|
-
comp[CORE].hooks = [];
|
|
2946
|
-
comp[CORE].hook_index = 0;
|
|
2947
|
-
} else {
|
|
2948
|
-
throw new Error("Error in constructing component.");
|
|
2949
2957
|
}
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2958
|
+
} else if (typeof entity === "function") {
|
|
2959
|
+
if (entity?.defaultProps) {
|
|
2960
|
+
core.props = {
|
|
2961
|
+
...entity.defaultProps,
|
|
2962
|
+
...core.props
|
|
2963
|
+
};
|
|
2954
2964
|
}
|
|
2965
|
+
comp = new Component(core.props);
|
|
2966
|
+
comp.render = entity.bind(comp);
|
|
2967
|
+
comp[CORE].hooks = [];
|
|
2968
|
+
comp[CORE].hook_index = 0;
|
|
2969
|
+
} else {
|
|
2970
|
+
throw new Error("Error in constructing component.");
|
|
2971
|
+
}
|
|
2972
|
+
comp[CORE].entity = entity;
|
|
2973
|
+
registerComponentCore(comp[CORE]);
|
|
2974
|
+
if (core.container) {
|
|
2975
|
+
comp[CORE].container = core.container;
|
|
2955
2976
|
}
|
|
2956
|
-
if (memoized)
|
|
2977
|
+
if (memoized) {
|
|
2978
|
+
comp[CORE][MEMOIZED] = true;
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
if (parent instanceof ComponentCore) {
|
|
2982
|
+
comp[CORE].parent = parent;
|
|
2957
2983
|
}
|
|
2958
|
-
if (parent instanceof ComponentCore) comp[CORE].parent = parent;
|
|
2959
2984
|
return comp;
|
|
2960
2985
|
}
|
|
2961
2986
|
function prepareCore(parent, core) {
|
|
@@ -7098,7 +7123,7 @@ function transpileJSX(jsx2, {
|
|
|
7098
7123
|
|
|
7099
7124
|
// .tmp/src/lilact.jsx
|
|
7100
7125
|
var Lilact2 = {
|
|
7101
|
-
VERSION: "RC.
|
|
7126
|
+
VERSION: "RC.7",
|
|
7102
7127
|
// Configuration
|
|
7103
7128
|
defaultTransitionTimeout: 300,
|
|
7104
7129
|
defaultIsEqual: Object.is,
|