lilact 0.16.3 → 0.18.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 +227 -151
- 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 +20 -20
- 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.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 +6 -0
- package/docs/functions/hooks.useActionState.html +1 -1
- package/docs/functions/hooks.useDebugValue.html +5 -0
- package/docs/functions/hooks.useDeferredValue.html +1 -1
- package/docs/functions/hooks.useEffect.html +5 -4
- package/docs/functions/hooks.useImperativeHandle.html +1 -1
- package/docs/functions/hooks.useInsertionEffect.html +6 -0
- package/docs/functions/hooks.useLayoutEffect.html +3 -2
- package/docs/functions/hooks.useMemo.html +3 -2
- package/docs/functions/hooks.useReducer.html +1 -1
- package/docs/functions/misc.Fragment.html +2 -2
- package/docs/functions/misc.deepEqual.html +1 -1
- package/docs/functions/misc.findDOMNode.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.isValidElement.html → misc.isValidComponent.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 +10 -7
- package/docs/hierarchy.html +1 -1
- package/docs/modules/components.html +1 -1
- package/docs/modules/hooks.html +1 -1
- package/docs/modules/misc.html +1 -1
- package/docs/static/demos/actionstate.jsx +2 -2
- package/docs/static/demos/memo.jsx +26 -0
- package/docs/static/demos/priorities.jsx +68 -0
- package/docs/static/index.html +3 -1
- package/docs/static/lilact.development.js +227 -151
- 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 +20 -20
- package/docs/variables/misc.Children.html +2 -2
- package/docs/variables/misc.isValidElement.html +7 -0
- package/examples/demos/actionstate.jsx +2 -2
- package/examples/demos/memo.jsx +26 -0
- package/examples/demos/priorities.jsx +68 -0
- package/examples/index.html +3 -1
- package/examples/lilact.development.js +227 -151
- 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 +20 -20
- package/package.json +1 -1
- package/src/components.jsx +126 -40
- package/src/hooks.jsx +84 -11
- package/src/lilact.jsx +1 -1
- package/src/misc.jsx +13 -8
|
@@ -1977,14 +1977,21 @@ __export(components_exports, {
|
|
|
1977
1977
|
createElement: () => createElement,
|
|
1978
1978
|
createRoot: () => createRoot,
|
|
1979
1979
|
current_component: () => current_component,
|
|
1980
|
+
effect_timeout: () => effect_timeout,
|
|
1980
1981
|
events_set: () => events_set,
|
|
1982
|
+
insertion_effects: () => insertion_effects,
|
|
1981
1983
|
layout_effects: () => layout_effects,
|
|
1982
1984
|
length_css_attributes_set: () => length_css_attributes_set,
|
|
1985
|
+
memo: () => memo,
|
|
1986
|
+
passive_effects: () => passive_effects,
|
|
1987
|
+
processEffects: () => processEffects,
|
|
1983
1988
|
render: () => render,
|
|
1984
1989
|
roots: () => roots,
|
|
1985
1990
|
special_attributes: () => special_attributes,
|
|
1986
1991
|
update_cbs: () => update_cbs,
|
|
1987
|
-
|
|
1992
|
+
update_interval_margin: () => update_interval_margin,
|
|
1993
|
+
update_set: () => update_set,
|
|
1994
|
+
update_timeout: () => update_timeout
|
|
1988
1995
|
});
|
|
1989
1996
|
|
|
1990
1997
|
// .tmp/src/symbols.jsx
|
|
@@ -2036,11 +2043,10 @@ __export(misc_exports, {
|
|
|
2036
2043
|
isEmpty: () => isEmpty,
|
|
2037
2044
|
isError: () => isError2,
|
|
2038
2045
|
isThenable: () => isThenable,
|
|
2046
|
+
isValidComponent: () => isValidComponent,
|
|
2039
2047
|
isValidElement: () => isValidElement,
|
|
2040
2048
|
shallowEqual: () => shallowEqual,
|
|
2041
|
-
toBool: () => toBool
|
|
2042
|
-
update_interval_margin: () => update_interval_margin,
|
|
2043
|
-
update_timeout: () => update_timeout
|
|
2049
|
+
toBool: () => toBool
|
|
2044
2050
|
});
|
|
2045
2051
|
var typeOf = (input) => {
|
|
2046
2052
|
const rawObject = Object.prototype.toString.call(input).toLowerCase();
|
|
@@ -2048,9 +2054,10 @@ var typeOf = (input) => {
|
|
|
2048
2054
|
const type = typeOfRegex.exec(rawObject)[1];
|
|
2049
2055
|
return type;
|
|
2050
2056
|
};
|
|
2051
|
-
var
|
|
2057
|
+
var isValidComponent = (value) => {
|
|
2052
2058
|
return value[CORE] !== void 0 || value[TEXT] !== void 0;
|
|
2053
2059
|
};
|
|
2060
|
+
var isValidElement = isValidComponent;
|
|
2054
2061
|
var findDOMNode = (component) => {
|
|
2055
2062
|
var _a, _b;
|
|
2056
2063
|
if (!((_b = (_a = component[CORE]) == null ? void 0 : _a.element) == null ? void 0 : _b.parentNode)) throw new Error("findDOMNode only works on mounted components.");
|
|
@@ -2130,7 +2137,7 @@ function isEmpty(value) {
|
|
|
2130
2137
|
for (let i2 in value) return false;
|
|
2131
2138
|
return true;
|
|
2132
2139
|
}
|
|
2133
|
-
var shallowEqual = (source, target) => {
|
|
2140
|
+
var shallowEqual = (source, target, ignore) => {
|
|
2134
2141
|
if (typeOf(source) !== typeOf(target)) {
|
|
2135
2142
|
return false;
|
|
2136
2143
|
}
|
|
@@ -2138,9 +2145,9 @@ var shallowEqual = (source, target) => {
|
|
|
2138
2145
|
if (source.length !== target.length) {
|
|
2139
2146
|
return false;
|
|
2140
2147
|
}
|
|
2141
|
-
return source.every((el, index2) => el === target[index2]);
|
|
2148
|
+
return source.every((el, index2) => el === target[index2] || index2 === ignore);
|
|
2142
2149
|
} else if (typeOf(source) === "object") {
|
|
2143
|
-
return Object.keys(source).every((key) => source[key] === target[key]);
|
|
2150
|
+
return Object.keys(source).every((key) => source[key] === target[key] || key === ignore);
|
|
2144
2151
|
} else if (typeOf(source) === "date") {
|
|
2145
2152
|
return source.getTime() === target.getTime();
|
|
2146
2153
|
}
|
|
@@ -2193,8 +2200,6 @@ function toBool(value) {
|
|
|
2193
2200
|
}
|
|
2194
2201
|
return Boolean(value);
|
|
2195
2202
|
}
|
|
2196
|
-
var update_timeout = void 0;
|
|
2197
|
-
var update_interval_margin = 0;
|
|
2198
2203
|
var id_num = Math.floor(Math.random() * 1e4);
|
|
2199
2204
|
var eval_num = 0;
|
|
2200
2205
|
|
|
@@ -2239,7 +2244,11 @@ var ComponentCache = class {
|
|
|
2239
2244
|
commit() {
|
|
2240
2245
|
this.current_map.forEach((arr) => {
|
|
2241
2246
|
arr.slice(arr[IDX]).forEach((ex) => {
|
|
2242
|
-
if (ex.cleanup)
|
|
2247
|
+
if (ex.cleanup) {
|
|
2248
|
+
ex.cleanup();
|
|
2249
|
+
} else if (ex.element) {
|
|
2250
|
+
ex.element.parentElement.removeChild(ex.element);
|
|
2251
|
+
}
|
|
2243
2252
|
});
|
|
2244
2253
|
});
|
|
2245
2254
|
this.current_map = this.new_map;
|
|
@@ -2277,116 +2286,116 @@ var ComponentCore = class {
|
|
|
2277
2286
|
this.props = props || {};
|
|
2278
2287
|
}
|
|
2279
2288
|
/*
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
// if(this.outlet && this.entity[MEMOIZED]) {
|
|
2283
|
-
// if(shallowEqual(this.props, next_props)) do_rerender=false;
|
|
2284
|
-
// delete this.entity[MEMOIZED];
|
|
2285
|
-
// }
|
|
2286
|
-
|
|
2287
|
-
if(do_rerender) {
|
|
2288
|
-
*/
|
|
2289
|
+
*/
|
|
2289
2290
|
// TODO: should componentDidUpdate be called after arranging/appending the outlet or before?
|
|
2290
2291
|
apply(next_props = this.props, next_state = this.next_state || this.state) {
|
|
2291
|
-
var _a, _b, _c, _d;
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
PropTypes.checkPropTypes(this.component.propTypes, this.props, "prop", this.component.name);
|
|
2292
|
+
var _a, _b, _c, _d, _e;
|
|
2293
|
+
let do_rerender = true;
|
|
2294
|
+
if (this.outlet && (this == null ? void 0 : this[MEMOIZED])) {
|
|
2295
|
+
if (shallowEqual(this.props, next_props, "children") && shallowEqual((_a = this.props) == null ? void 0 : _a.children, next_props == null ? void 0 : next_props.children)) {
|
|
2296
|
+
do_rerender = false;
|
|
2297
2297
|
}
|
|
2298
2298
|
}
|
|
2299
|
-
if (
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
this.element = document.createElement(this.entity);
|
|
2307
|
-
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);
|
|
2308
|
-
if (next_props == null ? void 0 : next_props.defaultChecked) this.element.checked = next_props.defaultChecked;
|
|
2299
|
+
if (do_rerender) {
|
|
2300
|
+
if (true) {
|
|
2301
|
+
if ((_b = this.entity) == null ? void 0 : _b.propTypes) {
|
|
2302
|
+
PropTypes.checkPropTypes(this.entity.propTypes, this.props, "prop", this.entity.name);
|
|
2303
|
+
} else if ((_c = this.component) == null ? void 0 : _c.propTypes) {
|
|
2304
|
+
PropTypes.checkPropTypes(this.component.propTypes, this.props, "prop", this.component.name);
|
|
2305
|
+
}
|
|
2309
2306
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
if (typeof next_props.ref === "function") {
|
|
2314
|
-
next_props.ref(this.element || this.component);
|
|
2315
|
-
} else {
|
|
2316
|
-
next_props.ref.current = this.element || this.component;
|
|
2307
|
+
if (typeof next_state === "function") next_state = next_state(this.state);
|
|
2308
|
+
if (this.component.constructor.defaultProps) {
|
|
2309
|
+
next_props = { ...this.component.constructor.defaultProps, ...next_props };
|
|
2317
2310
|
}
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
if (this.element) {
|
|
2327
|
-
this.updateElementProps(next_props);
|
|
2328
|
-
}
|
|
2329
|
-
this.props = next_props;
|
|
2330
|
-
if (typeof this.next_state === "object") {
|
|
2331
|
-
if (!this.state) this.state = { ...next_state };
|
|
2332
|
-
else Object.assign(this.state, next_state);
|
|
2333
|
-
} else if (this.next_state !== void 0) throw new Error("Component.setState only accepts objects or functions is new state.");
|
|
2334
|
-
if (this.next_state) delete this.next_state;
|
|
2335
|
-
if (this.hooks !== void 0) {
|
|
2336
|
-
this.hook_index = 0;
|
|
2337
|
-
lilact_default.current_component = [this, lilact_default.current_component];
|
|
2338
|
-
try {
|
|
2339
|
-
this.outlet = this.component.render(next_props, { current: this.element || this.component });
|
|
2340
|
-
} catch (e) {
|
|
2341
|
-
renderErrorHandler(this, e);
|
|
2311
|
+
if (this.component.shouldComponentUpdate && !this.component.shouldComponentUpdate(next_state, next_props, this.context)) return;
|
|
2312
|
+
if (typeof this.entity === "string") {
|
|
2313
|
+
if (!(this.element instanceof Element)) {
|
|
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;
|
|
2317
|
+
}
|
|
2318
|
+
this.element[COMPONENT] = this.component;
|
|
2342
2319
|
}
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2320
|
+
if (next_props.ref) {
|
|
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;
|
|
2325
|
+
}
|
|
2349
2326
|
}
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
if (
|
|
2358
|
-
this.
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
this.
|
|
2363
|
-
|
|
2364
|
-
} else if (
|
|
2365
|
-
|
|
2366
|
-
|
|
2327
|
+
if (next_props !== void 0 && this.component.componentWillReceiveProps) {
|
|
2328
|
+
this.component.componentWillReceiveProps(next_props);
|
|
2329
|
+
}
|
|
2330
|
+
if (this.component.componentWillUpdate) {
|
|
2331
|
+
this.component.componentWillUpdate(next_props, next_state);
|
|
2332
|
+
}
|
|
2333
|
+
const prev_state = this.state, prev_props = this.props;
|
|
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);
|
|
2350
|
+
}
|
|
2351
|
+
lilact_default.current_component = lilact_default.current_component[1];
|
|
2367
2352
|
} else {
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2353
|
+
try {
|
|
2354
|
+
this.outlet = this.component.render({ current: this.element || this.component });
|
|
2355
|
+
} catch (e) {
|
|
2356
|
+
renderErrorHandler(this, e);
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
if (((_e = (_d = this.outlet) == null ? void 0 : _d.constructor) == null ? void 0 : _e.name) !== "Array") {
|
|
2360
|
+
this.outlet = [this.outlet];
|
|
2361
|
+
}
|
|
2362
|
+
this.outlet = [...this.outlet];
|
|
2363
|
+
for (let i2 = 0; i2 < this.outlet.length; i2++) {
|
|
2364
|
+
let item = this.outlet[i2];
|
|
2365
|
+
if (item === void 0 || item === null || typeof item === "boolean") {
|
|
2366
|
+
this.outlet.splice(i2, 1);
|
|
2367
|
+
i2--;
|
|
2368
|
+
} else if (typeof item === "function") {
|
|
2369
|
+
const res2 = this.childFunctionHandler(item);
|
|
2370
|
+
this.outlet.splice(i2, 1, res2);
|
|
2371
|
+
i2--;
|
|
2372
|
+
} else if (item.constructor.name === "Array") {
|
|
2373
|
+
this.outlet.splice(i2, 1, ...item);
|
|
2374
|
+
i2--;
|
|
2373
2375
|
} else {
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
core.
|
|
2379
|
-
|
|
2376
|
+
const core = prepareCore(this, item);
|
|
2377
|
+
this.outlet[i2] = core;
|
|
2378
|
+
if (core[TEXT2] === void 0) {
|
|
2379
|
+
core.container = this.element ? this : this.container;
|
|
2380
|
+
core.apply(item.props);
|
|
2381
|
+
} else {
|
|
2382
|
+
if (!core.element) {
|
|
2383
|
+
core.element = document.createTextNode(item[TEXT2]);
|
|
2384
|
+
core[TEXT2] = item[TEXT2];
|
|
2385
|
+
} else if (core[TEXT2] !== item[TEXT2]) {
|
|
2386
|
+
core.element.textContent = item[TEXT2];
|
|
2387
|
+
core[TEXT2] = item[TEXT2];
|
|
2388
|
+
}
|
|
2380
2389
|
}
|
|
2381
2390
|
}
|
|
2382
2391
|
}
|
|
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;
|
|
2383
2398
|
}
|
|
2384
|
-
if (this.cache) this.cache.commit();
|
|
2385
|
-
if (this.element) this.arrangeOutlet();
|
|
2386
|
-
if (this.component.componentDidUpdate) {
|
|
2387
|
-
this.component.componentDidUpdate(prev_props, prev_state, this.last_snapshot);
|
|
2388
|
-
}
|
|
2389
|
-
if (this.last_snapshot) delete this.last_snapshot;
|
|
2390
2399
|
}
|
|
2391
2400
|
async cleanup() {
|
|
2392
2401
|
var _a, _b, _c;
|
|
@@ -2614,18 +2623,23 @@ var renderErrorHandler = (c, e) => {
|
|
|
2614
2623
|
} else throw e;
|
|
2615
2624
|
};
|
|
2616
2625
|
function constructFunc(core, parent) {
|
|
2617
|
-
var _a, _b;
|
|
2618
2626
|
let comp = core;
|
|
2619
2627
|
if (core[TEXT2] !== void 0) {
|
|
2620
2628
|
} else {
|
|
2621
|
-
|
|
2622
|
-
|
|
2629
|
+
let entity = core.entity;
|
|
2630
|
+
let memoized = false;
|
|
2631
|
+
if (typeof entity === "object" && entity[MEMOIZED]) {
|
|
2632
|
+
memoized = true;
|
|
2633
|
+
entity = entity[MEMOIZED];
|
|
2634
|
+
}
|
|
2635
|
+
if (typeof entity === "string") {
|
|
2636
|
+
comp = new HTMLComponent(entity, core.props);
|
|
2623
2637
|
} else {
|
|
2624
|
-
if (isClass(
|
|
2625
|
-
if (
|
|
2626
|
-
core.props = { ...
|
|
2638
|
+
if (isClass(entity)) {
|
|
2639
|
+
if (entity == null ? void 0 : entity.defaultProps) {
|
|
2640
|
+
core.props = { ...entity.defaultProps, ...core.props };
|
|
2627
2641
|
}
|
|
2628
|
-
comp = new
|
|
2642
|
+
comp = new entity(core.props);
|
|
2629
2643
|
const desc = Object.getOwnPropertyDescriptor(comp, "state");
|
|
2630
2644
|
if (desc) {
|
|
2631
2645
|
if (typeof desc.get !== "function" && typeof desc.set !== "function") {
|
|
@@ -2644,22 +2658,23 @@ function constructFunc(core, parent) {
|
|
|
2644
2658
|
});
|
|
2645
2659
|
}
|
|
2646
2660
|
}
|
|
2647
|
-
} else if (typeof
|
|
2648
|
-
if (
|
|
2649
|
-
core.props = { ...
|
|
2661
|
+
} else if (typeof entity === "function") {
|
|
2662
|
+
if (entity == null ? void 0 : entity.defaultProps) {
|
|
2663
|
+
core.props = { ...entity.defaultProps, ...core.props };
|
|
2650
2664
|
}
|
|
2651
2665
|
comp = new Component(core.props);
|
|
2652
|
-
comp.render =
|
|
2666
|
+
comp.render = entity.bind(comp);
|
|
2653
2667
|
comp[CORE].hooks = [];
|
|
2654
2668
|
comp[CORE].hook_index = 0;
|
|
2655
2669
|
} else {
|
|
2656
|
-
throw new Error("
|
|
2670
|
+
throw new Error("Error in constructing component.");
|
|
2657
2671
|
}
|
|
2658
|
-
comp[CORE].entity =
|
|
2672
|
+
comp[CORE].entity = entity;
|
|
2659
2673
|
if (core.container) {
|
|
2660
2674
|
comp[CORE].container = core.container;
|
|
2661
2675
|
}
|
|
2662
2676
|
}
|
|
2677
|
+
if (memoized) comp[CORE][MEMOIZED] = true;
|
|
2663
2678
|
}
|
|
2664
2679
|
if (parent instanceof ComponentCore) comp[CORE].parent = parent;
|
|
2665
2680
|
return comp;
|
|
@@ -2680,16 +2695,26 @@ function prepareCore(parent, core) {
|
|
|
2680
2695
|
}
|
|
2681
2696
|
}
|
|
2682
2697
|
function doUpdates() {
|
|
2698
|
+
clearTimeout(lilact_default.effect_timeout);
|
|
2699
|
+
const _update_set = lilact_default.update_set;
|
|
2700
|
+
const _update_cbs = lilact_default.update_cbs;
|
|
2701
|
+
lilact_default.update_set = /* @__PURE__ */ new Set();
|
|
2702
|
+
lilact_default.update_cbs = /* @__PURE__ */ new Set();
|
|
2703
|
+
for (const u of _update_set) u.apply();
|
|
2704
|
+
for (const cb of _update_cbs) cb();
|
|
2705
|
+
processEffects();
|
|
2706
|
+
}
|
|
2707
|
+
function processEffects() {
|
|
2708
|
+
const _insertion_effects = lilact_default.insertion_effects;
|
|
2709
|
+
const _layout_effects = lilact_default.layout_effects;
|
|
2710
|
+
const _passive_effects = lilact_default.passive_effects;
|
|
2711
|
+
lilact_default.insertion_effects = /* @__PURE__ */ new Set();
|
|
2712
|
+
lilact_default.layout_effects = /* @__PURE__ */ new Set();
|
|
2713
|
+
lilact_default.passive_effects = /* @__PURE__ */ new Set();
|
|
2714
|
+
for (const ie of _insertion_effects) ie();
|
|
2715
|
+
for (const le of _layout_effects) le();
|
|
2683
2716
|
requestAnimationFrame(() => {
|
|
2684
|
-
|
|
2685
|
-
let _update_cbs = lilact_default.update_cbs;
|
|
2686
|
-
let _update_set = lilact_default.update_set;
|
|
2687
|
-
lilact_default.layout_effects = /* @__PURE__ */ new Set();
|
|
2688
|
-
lilact_default.update_cbs = /* @__PURE__ */ new Set();
|
|
2689
|
-
lilact_default.update_set = /* @__PURE__ */ new Set();
|
|
2690
|
-
for (const le of _layout_effects) le();
|
|
2691
|
-
for (const u of _update_set) u.apply();
|
|
2692
|
-
for (const cb of _update_cbs) cb();
|
|
2717
|
+
for (const pe of _passive_effects) pe();
|
|
2693
2718
|
});
|
|
2694
2719
|
}
|
|
2695
2720
|
var generateComponentKey = (entity, props) => {
|
|
@@ -2885,8 +2910,10 @@ var RootComponent = class extends HTMLComponent {
|
|
|
2885
2910
|
}
|
|
2886
2911
|
};
|
|
2887
2912
|
function createComponent2(entity, props = {}, ...children) {
|
|
2888
|
-
if (
|
|
2889
|
-
|
|
2913
|
+
if (typeof entity !== "string" && typeof entity !== "function") {
|
|
2914
|
+
if (typeof entity !== "object" || !entity[MEMOIZED]) {
|
|
2915
|
+
throw new Error("Invalid entity for createComponent.");
|
|
2916
|
+
}
|
|
2890
2917
|
}
|
|
2891
2918
|
for (let i2 = 0; i2 < children.length; i2++) {
|
|
2892
2919
|
let ch2 = children[i2];
|
|
@@ -2935,12 +2962,20 @@ function render(component, element) {
|
|
|
2935
2962
|
}
|
|
2936
2963
|
return createRoot(element).render(component);
|
|
2937
2964
|
}
|
|
2965
|
+
function memo(component) {
|
|
2966
|
+
return { [MEMOIZED]: component };
|
|
2967
|
+
}
|
|
2938
2968
|
var createElement = createComponent2;
|
|
2939
2969
|
var current_component = [];
|
|
2940
2970
|
var update_set = /* @__PURE__ */ new Set();
|
|
2941
2971
|
var update_cbs = /* @__PURE__ */ new Set();
|
|
2942
2972
|
var roots = /* @__PURE__ */ new Set();
|
|
2943
2973
|
var layout_effects = /* @__PURE__ */ new Set();
|
|
2974
|
+
var insertion_effects = /* @__PURE__ */ new Set();
|
|
2975
|
+
var passive_effects = /* @__PURE__ */ new Set();
|
|
2976
|
+
var update_timeout = void 0;
|
|
2977
|
+
var effect_timeout = void 0;
|
|
2978
|
+
var update_interval_margin = 0;
|
|
2944
2979
|
var special_attributes = /* @__PURE__ */ new Set([
|
|
2945
2980
|
"classname",
|
|
2946
2981
|
"ref",
|
|
@@ -3097,14 +3132,17 @@ var boolean_html_attributes_set = /* @__PURE__ */ new Set([
|
|
|
3097
3132
|
var hooks_exports = {};
|
|
3098
3133
|
__export(hooks_exports, {
|
|
3099
3134
|
createContext: () => createContext,
|
|
3135
|
+
startTransition: () => startTransition,
|
|
3100
3136
|
useActionState: () => useActionState,
|
|
3101
3137
|
useCallback: () => useCallback,
|
|
3102
3138
|
useContext: () => useContext,
|
|
3139
|
+
useDebugValue: () => useDebugValue,
|
|
3103
3140
|
useDeferredValue: () => useDeferredValue,
|
|
3104
3141
|
useEffect: () => useEffect,
|
|
3105
3142
|
useHook: () => useHook,
|
|
3106
3143
|
useId: () => useId,
|
|
3107
3144
|
useImperativeHandle: () => useImperativeHandle,
|
|
3145
|
+
useInsertionEffect: () => useInsertionEffect,
|
|
3108
3146
|
useLayoutEffect: () => useLayoutEffect,
|
|
3109
3147
|
useLocalStorage: () => useLocalStorage,
|
|
3110
3148
|
useMemo: () => useMemo,
|
|
@@ -3183,10 +3221,10 @@ function useTransition() {
|
|
|
3183
3221
|
if (isEmpty(hk)) {
|
|
3184
3222
|
hk.count = 0;
|
|
3185
3223
|
hk.func = (async function(core, hk2, fn) {
|
|
3186
|
-
hk2.count
|
|
3187
|
-
if (hk2.count === 1) {
|
|
3224
|
+
if (hk2.count === 0) {
|
|
3188
3225
|
core.component.forceUpdate();
|
|
3189
3226
|
}
|
|
3227
|
+
hk2.count++;
|
|
3190
3228
|
await fn();
|
|
3191
3229
|
hk2.count--;
|
|
3192
3230
|
if (hk2.count === 0) {
|
|
@@ -3229,7 +3267,7 @@ function useRef(initialValue = null) {
|
|
|
3229
3267
|
}
|
|
3230
3268
|
function useLayoutEffect(effect, deps = void 0) {
|
|
3231
3269
|
if (deps !== void 0 && (typeof deps !== "object" || deps.constructor.name !== "Array")) {
|
|
3232
|
-
throw new Error("Layout effect dependencies must be an array or omitted.");
|
|
3270
|
+
throw new Error("Layout effect dependencies must be an array, object or omitted.");
|
|
3233
3271
|
}
|
|
3234
3272
|
const hk = useHook();
|
|
3235
3273
|
if (!isEmpty(hk)) {
|
|
@@ -3242,11 +3280,12 @@ function useLayoutEffect(effect, deps = void 0) {
|
|
|
3242
3280
|
lilact_default.layout_effects.add(() => {
|
|
3243
3281
|
hk.cleanup = effect();
|
|
3244
3282
|
});
|
|
3245
|
-
lilact_default.
|
|
3283
|
+
lilact_default.clearTimeout(lilact_default.effect_timeout);
|
|
3284
|
+
lilact_default.setTimeout(lilact_default.processEffects, 0);
|
|
3246
3285
|
}
|
|
3247
3286
|
function useEffect(effect, deps = void 0) {
|
|
3248
3287
|
if (deps !== void 0 && (typeof deps !== "object" || deps.constructor.name !== "Array")) {
|
|
3249
|
-
throw new Error("Effect dependencies must be an array or omitted.");
|
|
3288
|
+
throw new Error("Effect dependencies must be an array, object or omitted.");
|
|
3250
3289
|
}
|
|
3251
3290
|
const hk = useHook();
|
|
3252
3291
|
if (!isEmpty(hk)) {
|
|
@@ -3256,9 +3295,29 @@ function useEffect(effect, deps = void 0) {
|
|
|
3256
3295
|
hk.cleanup();
|
|
3257
3296
|
}
|
|
3258
3297
|
hk.deps = deps;
|
|
3259
|
-
lilact_default.
|
|
3298
|
+
lilact_default.passive_effects.add(() => {
|
|
3260
3299
|
hk.cleanup = effect();
|
|
3261
|
-
}
|
|
3300
|
+
});
|
|
3301
|
+
lilact_default.clearTimeout(lilact_default.effect_timeout);
|
|
3302
|
+
lilact_default.setTimeout(lilact_default.processEffects, 0);
|
|
3303
|
+
}
|
|
3304
|
+
function useInsertionEffect(effect, deps = void 0) {
|
|
3305
|
+
if (deps !== void 0 && (typeof deps !== "object" || deps.constructor.name !== "Array")) {
|
|
3306
|
+
throw new Error("Insertion effect dependencies must be an array, object, or omitted.");
|
|
3307
|
+
}
|
|
3308
|
+
const hk = useHook();
|
|
3309
|
+
if (!isEmpty(hk)) {
|
|
3310
|
+
if (deps !== void 0 && (hk == null ? void 0 : hk.deps) !== void 0 && shallowEqual(deps, hk.deps)) return;
|
|
3311
|
+
}
|
|
3312
|
+
if (hk == null ? void 0 : hk.cleanup) {
|
|
3313
|
+
hk.cleanup();
|
|
3314
|
+
}
|
|
3315
|
+
hk.deps = deps;
|
|
3316
|
+
lilact_default.insertion_effects.add(() => {
|
|
3317
|
+
hk.cleanup = effect();
|
|
3318
|
+
});
|
|
3319
|
+
lilact_default.clearTimeout(lilact_default.effect_timeout);
|
|
3320
|
+
lilact_default.setTimeout(lilact_default.processEffects, 0);
|
|
3262
3321
|
}
|
|
3263
3322
|
function useMemo(factory, deps = void 0) {
|
|
3264
3323
|
if (deps !== void 0 && (typeof deps !== "object" || deps.constructor.name !== "Array")) {
|
|
@@ -3346,6 +3405,14 @@ function useImperativeHandle(ref, factory, deps = void 0) {
|
|
|
3346
3405
|
}
|
|
3347
3406
|
Object.assign(ref.current, factory(), 0);
|
|
3348
3407
|
}
|
|
3408
|
+
function useDebugValue(val, formatter = (x) => x) {
|
|
3409
|
+
if (true) {
|
|
3410
|
+
console.log(formatter(val));
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
function startTransition(transition) {
|
|
3414
|
+
transition();
|
|
3415
|
+
}
|
|
3349
3416
|
|
|
3350
3417
|
// .tmp/src/run.jsx
|
|
3351
3418
|
var run_exports = {};
|
|
@@ -3494,7 +3561,7 @@ var timers_exports = {};
|
|
|
3494
3561
|
__export(timers_exports, {
|
|
3495
3562
|
animationFramePromise: () => animationFramePromise,
|
|
3496
3563
|
clearInterval: () => clearInterval,
|
|
3497
|
-
clearTimeout: () =>
|
|
3564
|
+
clearTimeout: () => clearTimeout2,
|
|
3498
3565
|
grabTimers: () => grabTimers,
|
|
3499
3566
|
pauseTimers: () => pauseTimers,
|
|
3500
3567
|
releaseTimers: () => releaseTimers,
|
|
@@ -3603,7 +3670,7 @@ function setTimeout2(callback, delay, ...args) {
|
|
|
3603
3670
|
function setInterval(callback, interval, ...args) {
|
|
3604
3671
|
return add_timer({ [CALLBACK]: callback, [INTERVAL]: interval, [DUE]: Date.now() + interval, [REPEAT]: true, [ARGS]: args });
|
|
3605
3672
|
}
|
|
3606
|
-
function
|
|
3673
|
+
function clearTimeout2(id) {
|
|
3607
3674
|
if (all_timers[id]) all_timers[id][CLEARED] = true;
|
|
3608
3675
|
}
|
|
3609
3676
|
function clearInterval(id) {
|
|
@@ -3686,14 +3753,14 @@ function Transition({
|
|
|
3686
3753
|
} else this[CORE].mount_state = EXITED;
|
|
3687
3754
|
}
|
|
3688
3755
|
useEffect(() => {
|
|
3689
|
-
return () =>
|
|
3756
|
+
return () => clearTimeout2(this[CORE].timer);
|
|
3690
3757
|
}, []);
|
|
3691
3758
|
useEffect(() => {
|
|
3692
3759
|
if (!this[CORE].is_appeared && appear && this[CORE].mount_state === ENTERING && inProp) {
|
|
3693
3760
|
onEnter == null ? void 0 : onEnter();
|
|
3694
3761
|
requestAnimationFrame(() => {
|
|
3695
3762
|
onEntering == null ? void 0 : onEntering(!this[CORE].is_appeared);
|
|
3696
|
-
|
|
3763
|
+
clearTimeout2(this[CORE].timer);
|
|
3697
3764
|
this[CORE].timer = setTimeout2(() => {
|
|
3698
3765
|
this[CORE].mount_state = ENTERED;
|
|
3699
3766
|
this.forceUpdate();
|
|
@@ -3711,7 +3778,7 @@ function Transition({
|
|
|
3711
3778
|
this[CORE].mount_state = ENTERING;
|
|
3712
3779
|
this.forceUpdate(() => {
|
|
3713
3780
|
onEntering == null ? void 0 : onEntering(!this[CORE].is_appeared);
|
|
3714
|
-
|
|
3781
|
+
clearTimeout2(this[CORE].timer);
|
|
3715
3782
|
this[CORE].timer = setTimeout2(() => {
|
|
3716
3783
|
this[CORE].mount_state = ENTERED;
|
|
3717
3784
|
this.forceUpdate();
|
|
@@ -3725,7 +3792,7 @@ function Transition({
|
|
|
3725
3792
|
this[CORE].mount_state = EXITING;
|
|
3726
3793
|
this.forceUpdate(() => {
|
|
3727
3794
|
onExiting == null ? void 0 : onExiting();
|
|
3728
|
-
|
|
3795
|
+
clearTimeout2(this[CORE].timer);
|
|
3729
3796
|
this[CORE].timer = setTimeout2(() => {
|
|
3730
3797
|
this[CORE].mount_state = EXITED;
|
|
3731
3798
|
this.forceUpdate();
|
|
@@ -4578,11 +4645,11 @@ var Suspense = class extends Component {
|
|
|
4578
4645
|
/** @ignore */
|
|
4579
4646
|
_clearTimers() {
|
|
4580
4647
|
if (this._delayTimer) {
|
|
4581
|
-
|
|
4648
|
+
clearTimeout2(this._delayTimer);
|
|
4582
4649
|
this._delayTimer = null;
|
|
4583
4650
|
}
|
|
4584
4651
|
if (this._minShowTimer) {
|
|
4585
|
-
|
|
4652
|
+
clearTimeout2(this._minShowTimer);
|
|
4586
4653
|
this._minShowTimer = null;
|
|
4587
4654
|
}
|
|
4588
4655
|
}
|
|
@@ -4593,7 +4660,7 @@ var Suspense = class extends Component {
|
|
|
4593
4660
|
if (this._pending.size === 1) {
|
|
4594
4661
|
const delay = Math.max(0, this.props.minDelay);
|
|
4595
4662
|
if (this._delayTimer) {
|
|
4596
|
-
|
|
4663
|
+
clearTimeout2(this._delayTimer);
|
|
4597
4664
|
this._delayTimer = null;
|
|
4598
4665
|
}
|
|
4599
4666
|
this._delayTimer = setTimeout2(() => {
|
|
@@ -4608,7 +4675,7 @@ var Suspense = class extends Component {
|
|
|
4608
4675
|
}
|
|
4609
4676
|
if (this._pending.size === 0) {
|
|
4610
4677
|
if (this._delayTimer) {
|
|
4611
|
-
|
|
4678
|
+
clearTimeout2(this._delayTimer);
|
|
4612
4679
|
this._delayTimer = null;
|
|
4613
4680
|
this.setState({ showingFallback: false });
|
|
4614
4681
|
return;
|
|
@@ -4619,7 +4686,7 @@ var Suspense = class extends Component {
|
|
|
4619
4686
|
this.setState({ showingFallback: false });
|
|
4620
4687
|
} else {
|
|
4621
4688
|
if (this._minShowTimer) {
|
|
4622
|
-
|
|
4689
|
+
clearTimeout2(this._minShowTimer);
|
|
4623
4690
|
this._minShowTimer = null;
|
|
4624
4691
|
}
|
|
4625
4692
|
this._minShowTimer = setTimeout2(() => {
|
|
@@ -5760,7 +5827,7 @@ function transpileJSX(jsx2, {
|
|
|
5760
5827
|
|
|
5761
5828
|
// .tmp/src/lilact.jsx
|
|
5762
5829
|
var Lilact2 = {
|
|
5763
|
-
VERSION: "beta.
|
|
5830
|
+
VERSION: "beta.18",
|
|
5764
5831
|
// Configuration
|
|
5765
5832
|
defaultTransitionTimeout: 300,
|
|
5766
5833
|
defaultIsEqual: Object.is,
|
|
@@ -5829,7 +5896,7 @@ export {
|
|
|
5829
5896
|
boolean_html_attributes_set,
|
|
5830
5897
|
capture_events_set,
|
|
5831
5898
|
clearInterval,
|
|
5832
|
-
clearTimeout,
|
|
5899
|
+
clearTimeout2 as clearTimeout,
|
|
5833
5900
|
combineReducers2 as combineReducers,
|
|
5834
5901
|
connect,
|
|
5835
5902
|
createComponent2 as createComponent,
|
|
@@ -5840,6 +5907,7 @@ export {
|
|
|
5840
5907
|
current_component,
|
|
5841
5908
|
deepEqual,
|
|
5842
5909
|
lilact_default as default,
|
|
5910
|
+
effect_timeout,
|
|
5843
5911
|
emotion_css_esm_exports as emotion,
|
|
5844
5912
|
error,
|
|
5845
5913
|
eval_num,
|
|
@@ -5850,16 +5918,21 @@ export {
|
|
|
5850
5918
|
globalErrorHandler,
|
|
5851
5919
|
grabTimers,
|
|
5852
5920
|
id_num,
|
|
5921
|
+
insertion_effects,
|
|
5853
5922
|
isAsync,
|
|
5854
5923
|
isClass,
|
|
5855
5924
|
isEmpty,
|
|
5856
5925
|
isError2 as isError,
|
|
5857
5926
|
isThenable,
|
|
5927
|
+
isValidComponent,
|
|
5858
5928
|
isValidElement,
|
|
5859
5929
|
layout_effects,
|
|
5860
5930
|
lazy,
|
|
5861
5931
|
length_css_attributes_set,
|
|
5932
|
+
memo,
|
|
5933
|
+
passive_effects,
|
|
5862
5934
|
pauseTimers,
|
|
5935
|
+
processEffects,
|
|
5863
5936
|
redux_exports as redux,
|
|
5864
5937
|
releaseSyntheticEvent,
|
|
5865
5938
|
releaseTimers,
|
|
@@ -5876,6 +5949,7 @@ export {
|
|
|
5876
5949
|
setTimeout2 as setTimeout,
|
|
5877
5950
|
shallowEqual,
|
|
5878
5951
|
special_attributes,
|
|
5952
|
+
startTransition,
|
|
5879
5953
|
timeoutPromise,
|
|
5880
5954
|
toBool,
|
|
5881
5955
|
traceError,
|
|
@@ -5888,12 +5962,14 @@ export {
|
|
|
5888
5962
|
useActionState,
|
|
5889
5963
|
useCallback,
|
|
5890
5964
|
useContext,
|
|
5965
|
+
useDebugValue,
|
|
5891
5966
|
useDeferredValue,
|
|
5892
5967
|
useDispatch,
|
|
5893
5968
|
useEffect,
|
|
5894
5969
|
useHook,
|
|
5895
5970
|
useId,
|
|
5896
5971
|
useImperativeHandle,
|
|
5972
|
+
useInsertionEffect,
|
|
5897
5973
|
useLayoutEffect,
|
|
5898
5974
|
useLocalStorage,
|
|
5899
5975
|
useLocation,
|