lilact 0.17.0 → 0.19.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 +156 -118
- package/dist/lilact.development.js.map +3 -3
- package/dist/lilact.development.min.js +20 -20
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +18 -18
- package/docs/assets/hierarchy.js +1 -1
- 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.createComponent.html +1 -1
- package/docs/functions/components.createPortal.html +11 -0
- package/docs/functions/components.createRoot.html +1 -1
- package/docs/functions/components.memo.html +7 -0
- package/docs/functions/components.render.html +1 -1
- package/docs/functions/hooks.startTransition.html +1 -1
- package/docs/functions/hooks.useActionState.html +1 -1
- package/docs/functions/hooks.useDebugValue.html +3 -3
- package/docs/functions/hooks.useDeferredValue.html +1 -1
- package/docs/functions/hooks.useEffect.html +4 -3
- package/docs/functions/hooks.useImperativeHandle.html +1 -1
- package/docs/functions/hooks.useInsertionEffect.html +4 -3
- package/docs/functions/hooks.useLayoutEffect.html +4 -3
- package/docs/functions/hooks.useMemo.html +4 -3
- package/docs/functions/hooks.useReducer.html +1 -1
- package/docs/functions/misc.Fragment.html +1 -1
- package/docs/functions/misc.Portal.html +4 -0
- package/docs/functions/misc.deepEqual.html +1 -1
- package/docs/functions/misc.forwardRef.html +1 -1
- package/docs/functions/misc.getComponentByPointer.html +1 -1
- package/docs/functions/misc.isAsync.html +1 -1
- package/docs/functions/misc.isClass.html +1 -1
- package/docs/functions/misc.isEmpty.html +1 -1
- package/docs/functions/misc.isError.html +1 -1
- package/docs/functions/misc.isThenable.html +1 -1
- package/docs/functions/misc.shallowEqual.html +3 -2
- package/docs/functions/misc.toBool.html +1 -1
- package/docs/functions/timers.timeoutPromise.html +5 -6
- package/docs/hierarchy.html +1 -1
- package/docs/modules/components.html +1 -1
- package/docs/modules/misc.html +1 -1
- package/docs/static/demos/memo.jsx +26 -0
- package/docs/static/demos/portal.jsx +56 -0
- package/docs/static/index.html +8 -3
- package/docs/static/lilact.development.js +156 -118
- package/docs/static/lilact.development.js.map +3 -3
- package/docs/static/lilact.development.min.js +20 -20
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +18 -18
- package/docs/variables/misc.Children.html +2 -2
- package/examples/demos/memo.jsx +26 -0
- package/examples/demos/portal.jsx +56 -0
- package/examples/index.html +8 -3
- package/examples/lilact.development.js +156 -118
- package/examples/lilact.development.js.map +3 -3
- package/examples/lilact.development.min.js +20 -20
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +18 -18
- package/package.json +1 -1
- package/src/components.jsx +101 -33
- package/src/hooks.jsx +10 -6
- package/src/lilact.jsx +1 -1
- package/src/misc.jsx +22 -4
|
@@ -1975,6 +1975,7 @@ __export(components_exports, {
|
|
|
1975
1975
|
capture_events_set: () => capture_events_set,
|
|
1976
1976
|
createComponent: () => createComponent2,
|
|
1977
1977
|
createElement: () => createElement,
|
|
1978
|
+
createPortal: () => createPortal,
|
|
1978
1979
|
createRoot: () => createRoot,
|
|
1979
1980
|
current_component: () => current_component,
|
|
1980
1981
|
effect_timeout: () => effect_timeout,
|
|
@@ -1982,6 +1983,7 @@ __export(components_exports, {
|
|
|
1982
1983
|
insertion_effects: () => insertion_effects,
|
|
1983
1984
|
layout_effects: () => layout_effects,
|
|
1984
1985
|
length_css_attributes_set: () => length_css_attributes_set,
|
|
1986
|
+
memo: () => memo,
|
|
1985
1987
|
passive_effects: () => passive_effects,
|
|
1986
1988
|
processEffects: () => processEffects,
|
|
1987
1989
|
render: () => render,
|
|
@@ -2031,6 +2033,7 @@ var misc_exports = {};
|
|
|
2031
2033
|
__export(misc_exports, {
|
|
2032
2034
|
Children: () => Children,
|
|
2033
2035
|
Fragment: () => Fragment2,
|
|
2036
|
+
Portal: () => Portal,
|
|
2034
2037
|
deepEqual: () => deepEqual,
|
|
2035
2038
|
eval_num: () => eval_num,
|
|
2036
2039
|
findDOMNode: () => findDOMNode,
|
|
@@ -2062,10 +2065,15 @@ var findDOMNode = (component) => {
|
|
|
2062
2065
|
if (!((_b = (_a = component[CORE]) == null ? void 0 : _a.element) == null ? void 0 : _b.parentNode)) throw new Error("findDOMNode only works on mounted components.");
|
|
2063
2066
|
return component[CORE].element;
|
|
2064
2067
|
};
|
|
2065
|
-
|
|
2068
|
+
function Fragment2({ children }) {
|
|
2066
2069
|
return children;
|
|
2067
|
-
}
|
|
2070
|
+
}
|
|
2068
2071
|
Fragment2.displayName = "Fragment";
|
|
2072
|
+
function Portal({ children, view }) {
|
|
2073
|
+
this[CORE].portal = view;
|
|
2074
|
+
return children;
|
|
2075
|
+
}
|
|
2076
|
+
Portal.displayName = "Portal";
|
|
2069
2077
|
var Children = {
|
|
2070
2078
|
/**
|
|
2071
2079
|
* Returns the only child from a children collection.
|
|
@@ -2136,7 +2144,7 @@ function isEmpty(value) {
|
|
|
2136
2144
|
for (let i2 in value) return false;
|
|
2137
2145
|
return true;
|
|
2138
2146
|
}
|
|
2139
|
-
var shallowEqual = (source, target) => {
|
|
2147
|
+
var shallowEqual = (source, target, ignore) => {
|
|
2140
2148
|
if (typeOf(source) !== typeOf(target)) {
|
|
2141
2149
|
return false;
|
|
2142
2150
|
}
|
|
@@ -2144,9 +2152,9 @@ var shallowEqual = (source, target) => {
|
|
|
2144
2152
|
if (source.length !== target.length) {
|
|
2145
2153
|
return false;
|
|
2146
2154
|
}
|
|
2147
|
-
return source.every((el, index2) => el === target[index2]);
|
|
2155
|
+
return source.every((el, index2) => el === target[index2] || index2 === ignore);
|
|
2148
2156
|
} else if (typeOf(source) === "object") {
|
|
2149
|
-
return Object.keys(source).every((key) => source[key] === target[key]);
|
|
2157
|
+
return Object.keys(source).every((key) => source[key] === target[key] || key === ignore);
|
|
2150
2158
|
} else if (typeOf(source) === "date") {
|
|
2151
2159
|
return source.getTime() === target.getTime();
|
|
2152
2160
|
}
|
|
@@ -2245,7 +2253,7 @@ var ComponentCache = class {
|
|
|
2245
2253
|
arr.slice(arr[IDX]).forEach((ex) => {
|
|
2246
2254
|
if (ex.cleanup) {
|
|
2247
2255
|
ex.cleanup();
|
|
2248
|
-
} else if (ex.element) {
|
|
2256
|
+
} else if (ex.element && !ex.portal) {
|
|
2249
2257
|
ex.element.parentElement.removeChild(ex.element);
|
|
2250
2258
|
}
|
|
2251
2259
|
});
|
|
@@ -2285,116 +2293,119 @@ var ComponentCore = class {
|
|
|
2285
2293
|
this.props = props || {};
|
|
2286
2294
|
}
|
|
2287
2295
|
/*
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
// if(this.outlet && this.entity[MEMOIZED]) {
|
|
2291
|
-
// if(shallowEqual(this.props, next_props)) do_rerender=false;
|
|
2292
|
-
// delete this.entity[MEMOIZED];
|
|
2293
|
-
// }
|
|
2294
|
-
|
|
2295
|
-
if(do_rerender) {
|
|
2296
|
-
*/
|
|
2296
|
+
*/
|
|
2297
2297
|
// TODO: should componentDidUpdate be called after arranging/appending the outlet or before?
|
|
2298
2298
|
apply(next_props = this.props, next_state = this.next_state || this.state) {
|
|
2299
|
-
var _a, _b, _c, _d;
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
PropTypes.checkPropTypes(this.component.propTypes, this.props, "prop", this.component.name);
|
|
2299
|
+
var _a, _b, _c, _d, _e;
|
|
2300
|
+
let do_rerender = true;
|
|
2301
|
+
if (this.outlet && (this == null ? void 0 : this[MEMOIZED])) {
|
|
2302
|
+
if (shallowEqual(this.props, next_props, "children") && shallowEqual((_a = this.props) == null ? void 0 : _a.children, next_props == null ? void 0 : next_props.children)) {
|
|
2303
|
+
do_rerender = false;
|
|
2305
2304
|
}
|
|
2306
2305
|
}
|
|
2307
|
-
if (
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
this.element = document.createElement(this.entity);
|
|
2315
|
-
if (next_props == null ? void 0 : next_props.defaultValue) this.element.value = String(next_props.defaultValue).slice(0, next_props == null ? void 0 : next_props.maxLength);
|
|
2316
|
-
if (next_props == null ? void 0 : next_props.defaultChecked) this.element.checked = next_props.defaultChecked;
|
|
2306
|
+
if (do_rerender) {
|
|
2307
|
+
if (true) {
|
|
2308
|
+
if ((_b = this.entity) == null ? void 0 : _b.propTypes) {
|
|
2309
|
+
PropTypes.checkPropTypes(this.entity.propTypes, this.props, "prop", this.entity.name);
|
|
2310
|
+
} else if ((_c = this.component) == null ? void 0 : _c.propTypes) {
|
|
2311
|
+
PropTypes.checkPropTypes(this.component.propTypes, this.props, "prop", this.component.name);
|
|
2312
|
+
}
|
|
2317
2313
|
}
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
if (typeof next_props.ref === "function") {
|
|
2322
|
-
next_props.ref(this.element || this.component);
|
|
2323
|
-
} else {
|
|
2324
|
-
next_props.ref.current = this.element || this.component;
|
|
2314
|
+
if (typeof next_state === "function") next_state = next_state(this.state);
|
|
2315
|
+
if (this.component.constructor.defaultProps) {
|
|
2316
|
+
next_props = { ...this.component.constructor.defaultProps, ...next_props };
|
|
2325
2317
|
}
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
if (this.element) {
|
|
2335
|
-
this.updateElementProps(next_props);
|
|
2336
|
-
}
|
|
2337
|
-
this.props = next_props;
|
|
2338
|
-
if (typeof this.next_state === "object") {
|
|
2339
|
-
if (!this.state) this.state = { ...next_state };
|
|
2340
|
-
else Object.assign(this.state, next_state);
|
|
2341
|
-
} else if (this.next_state !== void 0) throw new Error("Component.setState only accepts objects or functions is new state.");
|
|
2342
|
-
if (this.next_state) delete this.next_state;
|
|
2343
|
-
if (this.hooks !== void 0) {
|
|
2344
|
-
this.hook_index = 0;
|
|
2345
|
-
lilact_default.current_component = [this, lilact_default.current_component];
|
|
2346
|
-
try {
|
|
2347
|
-
this.outlet = this.component.render(next_props, { current: this.element || this.component });
|
|
2348
|
-
} catch (e) {
|
|
2349
|
-
renderErrorHandler(this, e);
|
|
2318
|
+
if (this.component.shouldComponentUpdate && !this.component.shouldComponentUpdate(next_state, next_props, this.context)) return;
|
|
2319
|
+
if (typeof this.entity === "string") {
|
|
2320
|
+
if (!(this.element instanceof Element)) {
|
|
2321
|
+
this.element = document.createElement(this.entity);
|
|
2322
|
+
if (next_props == null ? void 0 : next_props.defaultValue) this.element.value = String(next_props.defaultValue).slice(0, next_props == null ? void 0 : next_props.maxLength);
|
|
2323
|
+
if (next_props == null ? void 0 : next_props.defaultChecked) this.element.checked = next_props.defaultChecked;
|
|
2324
|
+
}
|
|
2325
|
+
this.element[COMPONENT] = this.component;
|
|
2350
2326
|
}
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2327
|
+
if (next_props.ref) {
|
|
2328
|
+
if (typeof next_props.ref === "function") {
|
|
2329
|
+
next_props.ref(this.element || this.component);
|
|
2330
|
+
} else {
|
|
2331
|
+
next_props.ref.current = this.element || this.component;
|
|
2332
|
+
}
|
|
2357
2333
|
}
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
if (
|
|
2366
|
-
this.
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
this.
|
|
2371
|
-
|
|
2372
|
-
} else if (
|
|
2373
|
-
|
|
2374
|
-
|
|
2334
|
+
if (next_props !== void 0 && this.component.componentWillReceiveProps) {
|
|
2335
|
+
this.component.componentWillReceiveProps(next_props);
|
|
2336
|
+
}
|
|
2337
|
+
if (this.component.componentWillUpdate) {
|
|
2338
|
+
this.component.componentWillUpdate(next_props, next_state);
|
|
2339
|
+
}
|
|
2340
|
+
const prev_state = this.state, prev_props = this.props;
|
|
2341
|
+
if (this.element) {
|
|
2342
|
+
this.updateElementProps(next_props);
|
|
2343
|
+
}
|
|
2344
|
+
this.props = next_props;
|
|
2345
|
+
if (typeof this.next_state === "object") {
|
|
2346
|
+
if (!this.state) this.state = { ...next_state };
|
|
2347
|
+
else Object.assign(this.state, next_state);
|
|
2348
|
+
} else if (this.next_state !== void 0) throw new Error("Component.setState only accepts objects or functions is new state.");
|
|
2349
|
+
if (this.next_state) delete this.next_state;
|
|
2350
|
+
if (this.hooks !== void 0) {
|
|
2351
|
+
this.hook_index = 0;
|
|
2352
|
+
lilact_default.current_component = [this, lilact_default.current_component];
|
|
2353
|
+
try {
|
|
2354
|
+
this.outlet = this.component.render(next_props, { current: this.element || this.component });
|
|
2355
|
+
} catch (e) {
|
|
2356
|
+
renderErrorHandler(this, e);
|
|
2357
|
+
}
|
|
2358
|
+
lilact_default.current_component = lilact_default.current_component[1];
|
|
2375
2359
|
} else {
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2360
|
+
try {
|
|
2361
|
+
this.outlet = this.component.render({ current: this.element || this.component });
|
|
2362
|
+
} catch (e) {
|
|
2363
|
+
renderErrorHandler(this, e);
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
if (this == null ? void 0 : this.portal) {
|
|
2367
|
+
this.element = this.portal;
|
|
2368
|
+
}
|
|
2369
|
+
if (((_e = (_d = this.outlet) == null ? void 0 : _d.constructor) == null ? void 0 : _e.name) !== "Array") {
|
|
2370
|
+
this.outlet = [this.outlet];
|
|
2371
|
+
}
|
|
2372
|
+
this.outlet = [...this.outlet];
|
|
2373
|
+
for (let i2 = 0; i2 < this.outlet.length; i2++) {
|
|
2374
|
+
let item = this.outlet[i2];
|
|
2375
|
+
if (item === void 0 || item === null || typeof item === "boolean") {
|
|
2376
|
+
this.outlet.splice(i2, 1);
|
|
2377
|
+
i2--;
|
|
2378
|
+
} else if (typeof item === "function") {
|
|
2379
|
+
const res2 = this.childFunctionHandler(item);
|
|
2380
|
+
this.outlet.splice(i2, 1, res2);
|
|
2381
|
+
i2--;
|
|
2382
|
+
} else if (item.constructor.name === "Array") {
|
|
2383
|
+
this.outlet.splice(i2, 1, ...item);
|
|
2384
|
+
i2--;
|
|
2381
2385
|
} else {
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
core.
|
|
2387
|
-
|
|
2386
|
+
const core = prepareCore(this, item);
|
|
2387
|
+
this.outlet[i2] = core;
|
|
2388
|
+
if (core[TEXT2] === void 0) {
|
|
2389
|
+
core.container = this.element ? this : this.container;
|
|
2390
|
+
core.apply(item.props);
|
|
2391
|
+
} else {
|
|
2392
|
+
if (!core.element) {
|
|
2393
|
+
core.element = document.createTextNode(item[TEXT2]);
|
|
2394
|
+
core[TEXT2] = item[TEXT2];
|
|
2395
|
+
} else if (core[TEXT2] !== item[TEXT2]) {
|
|
2396
|
+
core.element.textContent = item[TEXT2];
|
|
2397
|
+
core[TEXT2] = item[TEXT2];
|
|
2398
|
+
}
|
|
2388
2399
|
}
|
|
2389
2400
|
}
|
|
2390
2401
|
}
|
|
2402
|
+
if (this.cache) this.cache.commit();
|
|
2403
|
+
if (this.element) this.arrangeOutlet();
|
|
2404
|
+
if (this.component.componentDidUpdate) {
|
|
2405
|
+
this.component.componentDidUpdate(prev_props, prev_state, this.last_snapshot);
|
|
2406
|
+
}
|
|
2407
|
+
if (this.last_snapshot) delete this.last_snapshot;
|
|
2391
2408
|
}
|
|
2392
|
-
if (this.cache) this.cache.commit();
|
|
2393
|
-
if (this.element) this.arrangeOutlet();
|
|
2394
|
-
if (this.component.componentDidUpdate) {
|
|
2395
|
-
this.component.componentDidUpdate(prev_props, prev_state, this.last_snapshot);
|
|
2396
|
-
}
|
|
2397
|
-
if (this.last_snapshot) delete this.last_snapshot;
|
|
2398
2409
|
}
|
|
2399
2410
|
async cleanup() {
|
|
2400
2411
|
var _a, _b, _c;
|
|
@@ -2410,7 +2421,7 @@ var ComponentCore = class {
|
|
|
2410
2421
|
if (this.component.componentWillUnmount) {
|
|
2411
2422
|
this.component.componentWillUnmount();
|
|
2412
2423
|
}
|
|
2413
|
-
if ((_b = this == null ? void 0 : this.element) == null ? void 0 : _b.parentElement) {
|
|
2424
|
+
if (((_b = this == null ? void 0 : this.element) == null ? void 0 : _b.parentElement) && !this.portal) {
|
|
2414
2425
|
this.element.parentElement.removeChild(this.element);
|
|
2415
2426
|
}
|
|
2416
2427
|
if (this.outlet !== void 0) {
|
|
@@ -2558,6 +2569,7 @@ var ComponentCore = class {
|
|
|
2558
2569
|
}
|
|
2559
2570
|
appendElement(core) {
|
|
2560
2571
|
var _a;
|
|
2572
|
+
if (core.portal) return;
|
|
2561
2573
|
this.scanZombies(core.container, core.element);
|
|
2562
2574
|
if ((core == null ? void 0 : core.element.parentNode) === null) {
|
|
2563
2575
|
core.container.element.insertBefore(
|
|
@@ -2622,18 +2634,27 @@ var renderErrorHandler = (c, e) => {
|
|
|
2622
2634
|
} else throw e;
|
|
2623
2635
|
};
|
|
2624
2636
|
function constructFunc(core, parent) {
|
|
2625
|
-
var _a, _b;
|
|
2626
2637
|
let comp = core;
|
|
2627
2638
|
if (core[TEXT2] !== void 0) {
|
|
2628
2639
|
} else {
|
|
2629
|
-
|
|
2630
|
-
|
|
2640
|
+
let entity = core.entity;
|
|
2641
|
+
let memoized = false;
|
|
2642
|
+
if (typeof entity === "object") {
|
|
2643
|
+
if (entity[MEMOIZED]) {
|
|
2644
|
+
memoized = entity[MEMOIZED];
|
|
2645
|
+
entity = entity.component;
|
|
2646
|
+
} else {
|
|
2647
|
+
throw new Error("Invalid component.");
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
if (typeof entity === "string") {
|
|
2651
|
+
comp = new HTMLComponent(entity, core.props);
|
|
2631
2652
|
} else {
|
|
2632
|
-
if (isClass(
|
|
2633
|
-
if (
|
|
2634
|
-
core.props = { ...
|
|
2653
|
+
if (isClass(entity)) {
|
|
2654
|
+
if (entity == null ? void 0 : entity.defaultProps) {
|
|
2655
|
+
core.props = { ...entity.defaultProps, ...core.props };
|
|
2635
2656
|
}
|
|
2636
|
-
comp = new
|
|
2657
|
+
comp = new entity(core.props);
|
|
2637
2658
|
const desc = Object.getOwnPropertyDescriptor(comp, "state");
|
|
2638
2659
|
if (desc) {
|
|
2639
2660
|
if (typeof desc.get !== "function" && typeof desc.set !== "function") {
|
|
@@ -2652,22 +2673,23 @@ function constructFunc(core, parent) {
|
|
|
2652
2673
|
});
|
|
2653
2674
|
}
|
|
2654
2675
|
}
|
|
2655
|
-
} else if (typeof
|
|
2656
|
-
if (
|
|
2657
|
-
core.props = { ...
|
|
2676
|
+
} else if (typeof entity === "function") {
|
|
2677
|
+
if (entity == null ? void 0 : entity.defaultProps) {
|
|
2678
|
+
core.props = { ...entity.defaultProps, ...core.props };
|
|
2658
2679
|
}
|
|
2659
2680
|
comp = new Component(core.props);
|
|
2660
|
-
comp.render =
|
|
2681
|
+
comp.render = entity.bind(comp);
|
|
2661
2682
|
comp[CORE].hooks = [];
|
|
2662
2683
|
comp[CORE].hook_index = 0;
|
|
2663
2684
|
} else {
|
|
2664
|
-
throw new Error("
|
|
2685
|
+
throw new Error("Error in constructing component.");
|
|
2665
2686
|
}
|
|
2666
|
-
comp[CORE].entity =
|
|
2687
|
+
comp[CORE].entity = entity;
|
|
2667
2688
|
if (core.container) {
|
|
2668
2689
|
comp[CORE].container = core.container;
|
|
2669
2690
|
}
|
|
2670
2691
|
}
|
|
2692
|
+
if (memoized) comp[CORE][MEMOIZED] = true;
|
|
2671
2693
|
}
|
|
2672
2694
|
if (parent instanceof ComponentCore) comp[CORE].parent = parent;
|
|
2673
2695
|
return comp;
|
|
@@ -2904,7 +2926,9 @@ var RootComponent = class extends HTMLComponent {
|
|
|
2904
2926
|
};
|
|
2905
2927
|
function createComponent2(entity, props = {}, ...children) {
|
|
2906
2928
|
if (typeof entity !== "string" && typeof entity !== "function") {
|
|
2907
|
-
|
|
2929
|
+
if (typeof entity !== "object" || !entity[MEMOIZED]) {
|
|
2930
|
+
throw new Error("Invalid entity for createComponent.");
|
|
2931
|
+
}
|
|
2908
2932
|
}
|
|
2909
2933
|
for (let i2 = 0; i2 < children.length; i2++) {
|
|
2910
2934
|
let ch2 = children[i2];
|
|
@@ -2947,12 +2971,23 @@ function createRoot(element) {
|
|
|
2947
2971
|
}
|
|
2948
2972
|
};
|
|
2949
2973
|
}
|
|
2974
|
+
function createPortal(children, element) {
|
|
2975
|
+
return createComponent2(lilact_default.Portal, { "view": element }, children);
|
|
2976
|
+
}
|
|
2950
2977
|
function render(component, element) {
|
|
2951
2978
|
if (component[CORE] && (component[CORE].container || component[CORE].parent)) {
|
|
2952
2979
|
throw new Error("Component is already in use");
|
|
2953
2980
|
}
|
|
2954
2981
|
return createRoot(element).render(component);
|
|
2955
2982
|
}
|
|
2983
|
+
function memo(component) {
|
|
2984
|
+
if (typeof component === "object") {
|
|
2985
|
+
component[MEMOIZED] = true;
|
|
2986
|
+
} else {
|
|
2987
|
+
component = { component, [MEMOIZED]: true };
|
|
2988
|
+
}
|
|
2989
|
+
return component;
|
|
2990
|
+
}
|
|
2956
2991
|
var createElement = createComponent2;
|
|
2957
2992
|
var current_component = [];
|
|
2958
2993
|
var update_set = /* @__PURE__ */ new Set();
|
|
@@ -5815,7 +5850,7 @@ function transpileJSX(jsx2, {
|
|
|
5815
5850
|
|
|
5816
5851
|
// .tmp/src/lilact.jsx
|
|
5817
5852
|
var Lilact2 = {
|
|
5818
|
-
VERSION: "beta.
|
|
5853
|
+
VERSION: "beta.19",
|
|
5819
5854
|
// Configuration
|
|
5820
5855
|
defaultTransitionTimeout: 300,
|
|
5821
5856
|
defaultIsEqual: Object.is,
|
|
@@ -5867,6 +5902,7 @@ export {
|
|
|
5867
5902
|
Lilact2 as Lilact,
|
|
5868
5903
|
Link,
|
|
5869
5904
|
NavLink,
|
|
5905
|
+
Portal,
|
|
5870
5906
|
PropTypes,
|
|
5871
5907
|
Provider,
|
|
5872
5908
|
RootComponent,
|
|
@@ -5890,6 +5926,7 @@ export {
|
|
|
5890
5926
|
createComponent2 as createComponent,
|
|
5891
5927
|
createContext,
|
|
5892
5928
|
createElement,
|
|
5929
|
+
createPortal,
|
|
5893
5930
|
createRoot,
|
|
5894
5931
|
createSyntheticEvent,
|
|
5895
5932
|
current_component,
|
|
@@ -5917,6 +5954,7 @@ export {
|
|
|
5917
5954
|
layout_effects,
|
|
5918
5955
|
lazy,
|
|
5919
5956
|
length_css_attributes_set,
|
|
5957
|
+
memo,
|
|
5920
5958
|
passive_effects,
|
|
5921
5959
|
pauseTimers,
|
|
5922
5960
|
processEffects,
|