lilact 0.27.0 → 0.27.2
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 +238 -135
- package/dist/lilact.development.js.map +3 -3
- package/dist/lilact.development.min.js +57 -57
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +57 -57
- package/docs/classes/accessories.ErrorBoundary.html +3 -3
- package/docs/classes/accessories.Suspense.html +2 -2
- package/docs/classes/components.Component.html +3 -3
- package/docs/classes/components.HTMLComponent.html +4 -4
- package/docs/classes/components.RootComponent.html +5 -5
- 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/hooks.createContext.html +1 -1
- package/docs/functions/hooks.startTransition.html +1 -1
- package/docs/functions/hooks.useActionState.html +1 -1
- package/docs/functions/hooks.useContext.html +1 -1
- 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.useId.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.useLocalStorage.html +1 -1
- package/docs/functions/hooks.useMemo.html +1 -1
- package/docs/functions/hooks.useReducer.html +1 -1
- package/docs/functions/hooks.useRef.html +1 -1
- package/docs/functions/hooks.useTransition.html +1 -1
- package/docs/functions/misc.Fragment.html +2 -2
- package/docs/functions/misc.Portal.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.shallowEqual.html +1 -1
- package/docs/functions/misc.toBool.html +1 -1
- package/docs/functions/run.lazy.html +1 -1
- package/docs/functions/run.require.html +1 -1
- package/docs/functions/run.run.html +1 -1
- package/docs/functions/run.runScripts.html +1 -1
- package/docs/functions/timers.timeoutPromise.html +10 -10
- package/docs/static/index.html +1 -1
- package/docs/static/lilact.development.js +238 -135
- package/docs/static/lilact.development.js.map +3 -3
- package/docs/static/lilact.development.min.js +57 -57
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +57 -57
- package/docs/variables/components.cloneElement.html +1 -1
- package/docs/variables/misc.Children.html +10 -10
- package/docs/variables/misc.isValidElement.html +1 -1
- package/docs/variables/run.required_scripts.html +1 -1
- package/examples/index.html +1 -1
- package/examples/lilact.development.js +238 -135
- package/examples/lilact.development.js.map +3 -3
- package/examples/lilact.development.min.js +57 -57
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +57 -57
- package/package.json +1 -1
- package/src/components.jsx +24 -13
- package/src/errors.jsx +310 -310
- package/src/hooks.jsx +60 -44
- package/src/lilact.jsx +4 -2
- package/src/misc.jsx +46 -18
- package/src/run.jsx +406 -291
|
@@ -1760,7 +1760,9 @@ var typeOf = (input) => {
|
|
|
1760
1760
|
return type;
|
|
1761
1761
|
};
|
|
1762
1762
|
var isValidComponent = (value) => {
|
|
1763
|
-
return
|
|
1763
|
+
return Boolean(
|
|
1764
|
+
value && (value[CORE] !== void 0 || value[TEXT] !== void 0)
|
|
1765
|
+
);
|
|
1764
1766
|
};
|
|
1765
1767
|
var isValidElement = isValidComponent;
|
|
1766
1768
|
var findDOMNode = (component) => {
|
|
@@ -1930,10 +1932,10 @@ function getComponentByPointer() {
|
|
|
1930
1932
|
const pr = new Promise((res, rej) => {
|
|
1931
1933
|
resolve_func = res;
|
|
1932
1934
|
});
|
|
1933
|
-
function click_handler(
|
|
1934
|
-
|
|
1935
|
+
function click_handler(event) {
|
|
1936
|
+
event.stopImmediatePropagation();
|
|
1935
1937
|
window.removeEventListener("click", click_handler, true);
|
|
1936
|
-
let t =
|
|
1938
|
+
let t = event.target;
|
|
1937
1939
|
while (!t[COMPONENT] && t.parentNode) {
|
|
1938
1940
|
t = t.parentNode;
|
|
1939
1941
|
}
|
|
@@ -1948,6 +1950,9 @@ function isEmpty(value) {
|
|
|
1948
1950
|
return true;
|
|
1949
1951
|
}
|
|
1950
1952
|
var shallowEqual = (source, target, ignore) => {
|
|
1953
|
+
if (Object.is(source, target)) {
|
|
1954
|
+
return true;
|
|
1955
|
+
}
|
|
1951
1956
|
if (typeOf(source) !== typeOf(target)) {
|
|
1952
1957
|
return false;
|
|
1953
1958
|
}
|
|
@@ -1955,13 +1960,24 @@ var shallowEqual = (source, target, ignore) => {
|
|
|
1955
1960
|
if (source.length !== target.length) {
|
|
1956
1961
|
return false;
|
|
1957
1962
|
}
|
|
1958
|
-
return source.every(
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
}
|
|
1963
|
+
return source.every(
|
|
1964
|
+
(value, index2) => index2 === ignore || Object.is(value, target[index2])
|
|
1965
|
+
);
|
|
1966
|
+
}
|
|
1967
|
+
if (typeOf(source) === "object") {
|
|
1968
|
+
const sourceKeys = Object.keys(source).filter((key) => key !== ignore);
|
|
1969
|
+
const targetKeys = Object.keys(target).filter((key) => key !== ignore);
|
|
1970
|
+
if (sourceKeys.length !== targetKeys.length) {
|
|
1971
|
+
return false;
|
|
1972
|
+
}
|
|
1973
|
+
return sourceKeys.every(
|
|
1974
|
+
(key) => Object.prototype.hasOwnProperty.call(target, key) && Object.is(source[key], target[key])
|
|
1975
|
+
);
|
|
1976
|
+
}
|
|
1977
|
+
if (typeOf(source) === "date") {
|
|
1962
1978
|
return source.getTime() === target.getTime();
|
|
1963
1979
|
}
|
|
1964
|
-
return source
|
|
1980
|
+
return Object.is(source, target);
|
|
1965
1981
|
};
|
|
1966
1982
|
function deepEqual(source, target) {
|
|
1967
1983
|
if (typeOf(source) !== typeOf(target)) {
|
|
@@ -2990,11 +3006,16 @@ var Component = class {
|
|
|
2990
3006
|
* @type {string}
|
|
2991
3007
|
*/
|
|
2992
3008
|
displayName() {
|
|
2993
|
-
|
|
2994
|
-
if (
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
if (typeof
|
|
3009
|
+
const entity = this[CORE].entity;
|
|
3010
|
+
if (entity == null ? void 0 : entity.displayName) {
|
|
3011
|
+
return typeof entity.displayName === "function" ? entity.displayName() : entity.displayName;
|
|
3012
|
+
}
|
|
3013
|
+
if (typeof entity === "string") {
|
|
3014
|
+
return entity;
|
|
3015
|
+
}
|
|
3016
|
+
if (typeof entity === "function") {
|
|
3017
|
+
return entity.name || "Component";
|
|
3018
|
+
}
|
|
2998
3019
|
return "Component";
|
|
2999
3020
|
}
|
|
3000
3021
|
constructor(props) {
|
|
@@ -3351,8 +3372,8 @@ function useState(initialValue) {
|
|
|
3351
3372
|
return [hk.value, hk.set_func];
|
|
3352
3373
|
}
|
|
3353
3374
|
function useCallback(callback, deps = void 0) {
|
|
3354
|
-
if (deps !== void 0 && (
|
|
3355
|
-
throw new Error("Callback dependencies must be an array or omitted.");
|
|
3375
|
+
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3376
|
+
throw new Error("Callback dependencies must be an array, object or omitted.");
|
|
3356
3377
|
}
|
|
3357
3378
|
const hk = useHook();
|
|
3358
3379
|
if (!isEmpty(hk)) {
|
|
@@ -3377,16 +3398,12 @@ function createContext(defaultValue) {
|
|
|
3377
3398
|
};
|
|
3378
3399
|
}
|
|
3379
3400
|
function useContext(context2) {
|
|
3380
|
-
var _a;
|
|
3381
|
-
let core = lilact_default.current_component[0].parent;
|
|
3382
|
-
while (core.entity !== context2.Provider
|
|
3401
|
+
var _a, _b, _c;
|
|
3402
|
+
let core = (_a = lilact_default.current_component[0]) == null ? void 0 : _a.parent;
|
|
3403
|
+
while (core && core.entity !== context2.Provider) {
|
|
3383
3404
|
core = core.parent;
|
|
3384
3405
|
}
|
|
3385
|
-
|
|
3386
|
-
let v = (_a = core.props) == null ? void 0 : _a.value;
|
|
3387
|
-
return v != null ? v : v = context2.default;
|
|
3388
|
-
}
|
|
3389
|
-
return context2.default;
|
|
3406
|
+
return core ? (_c = (_b = core.props) == null ? void 0 : _b.value) != null ? _c : context2.default : context2.default;
|
|
3390
3407
|
}
|
|
3391
3408
|
function useId(prefix2 = "N") {
|
|
3392
3409
|
const hk = useHook();
|
|
@@ -3404,10 +3421,13 @@ function useTransition() {
|
|
|
3404
3421
|
core.component.forceUpdate();
|
|
3405
3422
|
}
|
|
3406
3423
|
hk2.count++;
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3424
|
+
try {
|
|
3425
|
+
return await fn();
|
|
3426
|
+
} finally {
|
|
3427
|
+
hk2.count--;
|
|
3428
|
+
if (hk2.count === 0) {
|
|
3429
|
+
core.component.forceUpdate();
|
|
3430
|
+
}
|
|
3411
3431
|
}
|
|
3412
3432
|
}).bind(void 0, lilact_default.current_component[0], hk);
|
|
3413
3433
|
}
|
|
@@ -3445,7 +3465,7 @@ function useRef(initialValue = null) {
|
|
|
3445
3465
|
return hk;
|
|
3446
3466
|
}
|
|
3447
3467
|
async function useLayoutEffect(effect, deps = void 0) {
|
|
3448
|
-
if (deps !== void 0 && (
|
|
3468
|
+
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3449
3469
|
throw new Error("Layout effect dependencies must be an array, object or omitted.");
|
|
3450
3470
|
}
|
|
3451
3471
|
const hk = useHook();
|
|
@@ -3464,7 +3484,7 @@ async function useLayoutEffect(effect, deps = void 0) {
|
|
|
3464
3484
|
lilact_default.setTimeout(lilact_default.processEffects, 0);
|
|
3465
3485
|
}
|
|
3466
3486
|
async function useEffect(effect, deps = void 0) {
|
|
3467
|
-
if (deps !== void 0 && (
|
|
3487
|
+
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3468
3488
|
throw new Error("Effect dependencies must be an array, object or omitted.");
|
|
3469
3489
|
}
|
|
3470
3490
|
const hk = useHook();
|
|
@@ -3483,7 +3503,7 @@ async function useEffect(effect, deps = void 0) {
|
|
|
3483
3503
|
lilact_default.setTimeout(lilact_default.processEffects, 0);
|
|
3484
3504
|
}
|
|
3485
3505
|
async function useInsertionEffect(effect, deps = void 0) {
|
|
3486
|
-
if (deps !== void 0 && (
|
|
3506
|
+
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3487
3507
|
throw new Error("Insertion effect dependencies must be an array, object, or omitted.");
|
|
3488
3508
|
}
|
|
3489
3509
|
const hk = useHook();
|
|
@@ -3502,7 +3522,7 @@ async function useInsertionEffect(effect, deps = void 0) {
|
|
|
3502
3522
|
lilact_default.setTimeout(lilact_default.processEffects, 0);
|
|
3503
3523
|
}
|
|
3504
3524
|
function useMemo(factory, deps = void 0) {
|
|
3505
|
-
if (deps !== void 0 && (
|
|
3525
|
+
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3506
3526
|
throw new Error("Memo dependencies must be an array or omitted.");
|
|
3507
3527
|
}
|
|
3508
3528
|
const hk = useHook();
|
|
@@ -3520,11 +3540,11 @@ function useActionState(action, initialState) {
|
|
|
3520
3540
|
const [is_pending, tran_start_func] = useTransition();
|
|
3521
3541
|
if (isEmpty(hk)) {
|
|
3522
3542
|
hk.state = initialState;
|
|
3523
|
-
hk.form_action = (
|
|
3543
|
+
hk.form_action = (event) => {
|
|
3524
3544
|
event.preventDefault();
|
|
3525
3545
|
tran_start_func(
|
|
3526
3546
|
async () => {
|
|
3527
|
-
const form_data = new FormData(
|
|
3547
|
+
const form_data = new FormData(event.target, event.submitter);
|
|
3528
3548
|
hk.state = await action(hk.state, form_data);
|
|
3529
3549
|
},
|
|
3530
3550
|
[]
|
|
@@ -3537,16 +3557,16 @@ function useActionState(action, initialState) {
|
|
|
3537
3557
|
function useReducer(reducer, initialArg, init) {
|
|
3538
3558
|
const hk = useHook();
|
|
3539
3559
|
if (isEmpty(hk)) {
|
|
3540
|
-
hk.reducer = reducer;
|
|
3541
3560
|
hk.state = init ? init(initialArg) : initialArg;
|
|
3542
3561
|
hk.dispatch = function(core, hk2, action) {
|
|
3543
|
-
const
|
|
3544
|
-
if (!lilact_default.defaultIsEqual(
|
|
3545
|
-
hk2.state =
|
|
3562
|
+
const newState = hk2.reducer(hk2.state, action);
|
|
3563
|
+
if (!lilact_default.defaultIsEqual(newState, hk2.state)) {
|
|
3564
|
+
hk2.state = newState;
|
|
3546
3565
|
core.component.forceUpdate();
|
|
3547
3566
|
}
|
|
3548
3567
|
}.bind(void 0, lilact_default.current_component[0], hk);
|
|
3549
3568
|
}
|
|
3569
|
+
hk.reducer = reducer;
|
|
3550
3570
|
return [hk.state, hk.dispatch];
|
|
3551
3571
|
}
|
|
3552
3572
|
function useDeferredValue(value, initialValue) {
|
|
@@ -3585,7 +3605,7 @@ function useImperativeHandle(ref, factory, deps = void 0) {
|
|
|
3585
3605
|
if (typeof (ref == null ? void 0 : ref.current) !== "object") {
|
|
3586
3606
|
ref.current = {};
|
|
3587
3607
|
}
|
|
3588
|
-
Object.assign(ref.current, factory()
|
|
3608
|
+
Object.assign(ref.current, factory());
|
|
3589
3609
|
}
|
|
3590
3610
|
function useDebugValue(val, formatter = (x) => x) {
|
|
3591
3611
|
if (true) {
|
|
@@ -3608,11 +3628,16 @@ __export(run_exports, {
|
|
|
3608
3628
|
function joinPaths(basePath, relativePath) {
|
|
3609
3629
|
const absolute = relativePath.startsWith("/");
|
|
3610
3630
|
const parts = (absolute ? "" : basePath).split("/").filter(Boolean);
|
|
3611
|
-
if (!absolute && !basePath.endsWith("/"))
|
|
3631
|
+
if (!absolute && !basePath.endsWith("/")) {
|
|
3632
|
+
parts.pop();
|
|
3633
|
+
}
|
|
3612
3634
|
for (const part of relativePath.split("/")) {
|
|
3613
3635
|
if (!part || part === ".") continue;
|
|
3614
|
-
if (part === "..")
|
|
3615
|
-
|
|
3636
|
+
if (part === "..") {
|
|
3637
|
+
parts.pop();
|
|
3638
|
+
} else {
|
|
3639
|
+
parts.push(part);
|
|
3640
|
+
}
|
|
3616
3641
|
}
|
|
3617
3642
|
return `${absolute ? "/" : ""}${parts.join("/")}`;
|
|
3618
3643
|
}
|
|
@@ -3626,7 +3651,9 @@ function asError(value, fallback = "Unknown error") {
|
|
|
3626
3651
|
if (value.name) error2.name = value.name;
|
|
3627
3652
|
if (value.stack) error2.stack = value.stack;
|
|
3628
3653
|
for (const key of Object.keys(value)) {
|
|
3629
|
-
if (!(key in error2))
|
|
3654
|
+
if (!(key in error2)) {
|
|
3655
|
+
error2[key] = value[key];
|
|
3656
|
+
}
|
|
3630
3657
|
}
|
|
3631
3658
|
}
|
|
3632
3659
|
return error2;
|
|
@@ -3640,7 +3667,9 @@ function markSource(value, path2) {
|
|
|
3640
3667
|
}
|
|
3641
3668
|
function report(value, path2) {
|
|
3642
3669
|
const error2 = markSource(value, path2);
|
|
3643
|
-
if (error2.isTraced)
|
|
3670
|
+
if (error2.isTraced) {
|
|
3671
|
+
return error2;
|
|
3672
|
+
}
|
|
3644
3673
|
if (typeof lilact_default.traceError === "function") {
|
|
3645
3674
|
return lilact_default.traceError(error2, path2);
|
|
3646
3675
|
}
|
|
@@ -3648,20 +3677,50 @@ function report(value, path2) {
|
|
|
3648
3677
|
return error2;
|
|
3649
3678
|
}
|
|
3650
3679
|
var required_scripts = {};
|
|
3680
|
+
function createModule(path2, {
|
|
3681
|
+
code: code2 = "",
|
|
3682
|
+
isInline: isInline2 = false,
|
|
3683
|
+
isModule: isModule2 = true
|
|
3684
|
+
} = {}) {
|
|
3685
|
+
const module2 = {
|
|
3686
|
+
path: path2,
|
|
3687
|
+
code: String(code2),
|
|
3688
|
+
mappings: [],
|
|
3689
|
+
exports: {},
|
|
3690
|
+
isInline: isInline2,
|
|
3691
|
+
isModule: isModule2,
|
|
3692
|
+
// True only after the module has been successfully evaluated.
|
|
3693
|
+
loaded: false,
|
|
3694
|
+
// The promise for the request currently loading this resource.
|
|
3695
|
+
// This is deliberately stored on the module to deduplicate requests.
|
|
3696
|
+
request: void 0,
|
|
3697
|
+
error: void 0
|
|
3698
|
+
};
|
|
3699
|
+
required_scripts[path2] = module2;
|
|
3700
|
+
return module2;
|
|
3701
|
+
}
|
|
3651
3702
|
function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
|
|
3652
3703
|
isInline = true,
|
|
3653
3704
|
isModule = true
|
|
3654
3705
|
} = {}) {
|
|
3655
3706
|
var _a, _b;
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
}
|
|
3664
|
-
|
|
3707
|
+
let module = required_scripts[path];
|
|
3708
|
+
if (!module) {
|
|
3709
|
+
module = createModule(path, {
|
|
3710
|
+
code: jsx,
|
|
3711
|
+
isInline,
|
|
3712
|
+
isModule
|
|
3713
|
+
});
|
|
3714
|
+
} else {
|
|
3715
|
+
module.path = path;
|
|
3716
|
+
module.code = String(jsx);
|
|
3717
|
+
module.mappings = [];
|
|
3718
|
+
module.exports = {};
|
|
3719
|
+
module.isInline = isInline;
|
|
3720
|
+
module.isModule = isModule;
|
|
3721
|
+
module.loaded = false;
|
|
3722
|
+
module.error = void 0;
|
|
3723
|
+
}
|
|
3665
3724
|
let processed;
|
|
3666
3725
|
try {
|
|
3667
3726
|
processed = lilact_default.transpileJSX(String(jsx), {
|
|
@@ -3691,6 +3750,7 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
|
|
|
3691
3750
|
globalThis.createComponent = lilact_default.createComponent;
|
|
3692
3751
|
globalThis.Fragment = lilact_default.Fragment;
|
|
3693
3752
|
const result = eval(processed);
|
|
3753
|
+
module.loaded = true;
|
|
3694
3754
|
return isEmpty(module.exports) ? result : module.exports;
|
|
3695
3755
|
} catch (value) {
|
|
3696
3756
|
const error2 = report(value, path);
|
|
@@ -3699,8 +3759,64 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
|
|
|
3699
3759
|
throw error2;
|
|
3700
3760
|
}
|
|
3701
3761
|
}
|
|
3762
|
+
function getOrCreateModule(path2, options = {}) {
|
|
3763
|
+
return required_scripts[path2] || createModule(path2, options);
|
|
3764
|
+
}
|
|
3765
|
+
function loadAsyncResource(path2, module2) {
|
|
3766
|
+
var _a, _b;
|
|
3767
|
+
let source;
|
|
3768
|
+
try {
|
|
3769
|
+
const resolved = (_b = (_a = lilact_default).resolver) == null ? void 0 : _b.call(_a, path2);
|
|
3770
|
+
if (resolved == null) {
|
|
3771
|
+
if (module2.code && !module2.loaded) {
|
|
3772
|
+
source = Promise.resolve(module2.code);
|
|
3773
|
+
} else {
|
|
3774
|
+
source = fetch(path2).then((response) => {
|
|
3775
|
+
if (!response.ok) {
|
|
3776
|
+
throw report(
|
|
3777
|
+
new Error(
|
|
3778
|
+
`Unable to load ${path2}: HTTP ${response.status}`
|
|
3779
|
+
),
|
|
3780
|
+
path2
|
|
3781
|
+
);
|
|
3782
|
+
}
|
|
3783
|
+
return response.text();
|
|
3784
|
+
});
|
|
3785
|
+
}
|
|
3786
|
+
} else {
|
|
3787
|
+
source = Promise.resolve(resolved);
|
|
3788
|
+
}
|
|
3789
|
+
} catch (value) {
|
|
3790
|
+
source = Promise.reject(report(value, path2));
|
|
3791
|
+
}
|
|
3792
|
+
let request;
|
|
3793
|
+
request = Promise.resolve(source).then((sourceText) => {
|
|
3794
|
+
module2.code = String(sourceText);
|
|
3795
|
+
if (path2.endsWith(".css")) {
|
|
3796
|
+
injectGlobal(module2.code);
|
|
3797
|
+
module2.loaded = true;
|
|
3798
|
+
return void 0;
|
|
3799
|
+
}
|
|
3800
|
+
return run(module2.code, path2, {
|
|
3801
|
+
isInline: false,
|
|
3802
|
+
isModule: true
|
|
3803
|
+
});
|
|
3804
|
+
}).then((result2) => {
|
|
3805
|
+
var _a2;
|
|
3806
|
+
return (_a2 = result2 == null ? void 0 : result2.default) != null ? _a2 : result2;
|
|
3807
|
+
}).catch((error2) => {
|
|
3808
|
+
module2.error = report(error2, path2);
|
|
3809
|
+
throw module2.error;
|
|
3810
|
+
}).finally(() => {
|
|
3811
|
+
if (module2.request === request) {
|
|
3812
|
+
module2.request = void 0;
|
|
3813
|
+
}
|
|
3814
|
+
});
|
|
3815
|
+
module2.request = request;
|
|
3816
|
+
return request;
|
|
3817
|
+
}
|
|
3702
3818
|
function require2(path2) {
|
|
3703
|
-
var _a, _b, _c, _d
|
|
3819
|
+
var _a, _b, _c, _d;
|
|
3704
3820
|
let options = {};
|
|
3705
3821
|
if (arguments.length === 2 && arguments[1] && typeof arguments[1] === "object") {
|
|
3706
3822
|
options = arguments[1];
|
|
@@ -3708,12 +3824,16 @@ function require2(path2) {
|
|
|
3708
3824
|
if ((_a = lilact_default.importObjectPaths) == null ? void 0 : _a[path2]) {
|
|
3709
3825
|
return lilact_default.importObjectPaths[path2];
|
|
3710
3826
|
}
|
|
3711
|
-
const loadAsync = Boolean(lilact_default[LAZY]) || Boolean(options.isLazy);
|
|
3712
3827
|
if ((_b = options.requirer) == null ? void 0 : _b.path) {
|
|
3713
3828
|
path2 = joinPaths(options.requirer.path, path2);
|
|
3714
3829
|
}
|
|
3715
|
-
|
|
3716
|
-
|
|
3830
|
+
const loadAsync = Boolean(lilact_default[LAZY]) || Boolean(options.isLazy);
|
|
3831
|
+
const module2 = getOrCreateModule(path2, {
|
|
3832
|
+
isInline: false,
|
|
3833
|
+
isModule: true
|
|
3834
|
+
});
|
|
3835
|
+
if (module2.loaded && !options.forceUpdate && !loadAsync) {
|
|
3836
|
+
return module2.exports;
|
|
3717
3837
|
}
|
|
3718
3838
|
if (path2.startsWith("#")) {
|
|
3719
3839
|
const element = document.getElementById(path2.slice(1));
|
|
@@ -3727,49 +3847,18 @@ function require2(path2) {
|
|
|
3727
3847
|
}
|
|
3728
3848
|
if (loadAsync) {
|
|
3729
3849
|
lilact_default[LAZY] = false;
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
if (required_scripts[path2] && !options.forceUpdate) {
|
|
3733
|
-
request2 = Promise.resolve(required_scripts[path2].code);
|
|
3734
|
-
} else {
|
|
3735
|
-
request2 = fetch(path2).then((response) => {
|
|
3736
|
-
if (!response.ok) {
|
|
3737
|
-
throw report(
|
|
3738
|
-
new Error(
|
|
3739
|
-
`Unable to load ${path2}: HTTP ${response.status}`
|
|
3740
|
-
),
|
|
3741
|
-
path2
|
|
3742
|
-
);
|
|
3743
|
-
}
|
|
3744
|
-
return response.text();
|
|
3745
|
-
});
|
|
3746
|
-
}
|
|
3747
|
-
} else {
|
|
3748
|
-
request2 = Promise.resolve(request2);
|
|
3850
|
+
if (module2.request) {
|
|
3851
|
+
return module2.request;
|
|
3749
3852
|
}
|
|
3750
|
-
return
|
|
3751
|
-
if (path2.endsWith(".css")) {
|
|
3752
|
-
injectGlobal(String(source));
|
|
3753
|
-
return;
|
|
3754
|
-
}
|
|
3755
|
-
return run(String(source), path2, {
|
|
3756
|
-
isInline: false,
|
|
3757
|
-
isModule: true
|
|
3758
|
-
});
|
|
3759
|
-
}).then(
|
|
3760
|
-
(result2) => {
|
|
3761
|
-
var _a2;
|
|
3762
|
-
return (_a2 = result2 == null ? void 0 : result2.default) != null ? _a2 : result2;
|
|
3763
|
-
}
|
|
3764
|
-
).catch((error2) => {
|
|
3765
|
-
throw report(error2, path2);
|
|
3766
|
-
});
|
|
3853
|
+
return loadAsyncResource(path2, module2);
|
|
3767
3854
|
}
|
|
3768
|
-
const resolved = (
|
|
3855
|
+
const resolved = (_d = (_c = lilact_default).resolver) == null ? void 0 : _d.call(_c, path2);
|
|
3769
3856
|
if (resolved != null) {
|
|
3770
3857
|
if (path2.endsWith(".css")) {
|
|
3771
3858
|
injectGlobal(String(resolved));
|
|
3772
|
-
|
|
3859
|
+
module2.code = String(resolved);
|
|
3860
|
+
module2.loaded = true;
|
|
3861
|
+
return void 0;
|
|
3773
3862
|
}
|
|
3774
3863
|
return run(String(resolved), path2, {
|
|
3775
3864
|
isInline: false,
|
|
@@ -3785,8 +3874,10 @@ function require2(path2) {
|
|
|
3785
3874
|
}
|
|
3786
3875
|
if (request.status >= 200 && request.status < 300) {
|
|
3787
3876
|
if (path2.endsWith(".css")) {
|
|
3788
|
-
|
|
3789
|
-
|
|
3877
|
+
module2.code = request.responseText;
|
|
3878
|
+
injectGlobal(module2.code);
|
|
3879
|
+
module2.loaded = true;
|
|
3880
|
+
return void 0;
|
|
3790
3881
|
}
|
|
3791
3882
|
return run(request.responseText, path2, {
|
|
3792
3883
|
isInline: false,
|
|
@@ -3794,7 +3885,9 @@ function require2(path2) {
|
|
|
3794
3885
|
});
|
|
3795
3886
|
}
|
|
3796
3887
|
throw report(
|
|
3797
|
-
new Error(
|
|
3888
|
+
new Error(
|
|
3889
|
+
`Unable to load ${path2}: HTTP ${request.status || 0}`
|
|
3890
|
+
),
|
|
3798
3891
|
path2
|
|
3799
3892
|
);
|
|
3800
3893
|
}
|
|
@@ -3823,8 +3916,12 @@ function lazy(factory) {
|
|
|
3823
3916
|
status = "success";
|
|
3824
3917
|
}
|
|
3825
3918
|
function LazyComponent(props) {
|
|
3826
|
-
if (status === "pending")
|
|
3827
|
-
|
|
3919
|
+
if (status === "pending") {
|
|
3920
|
+
throw result2;
|
|
3921
|
+
}
|
|
3922
|
+
if (status === "error") {
|
|
3923
|
+
throw result2;
|
|
3924
|
+
}
|
|
3828
3925
|
const Component2 = result2;
|
|
3829
3926
|
return createComponent(Component2, { ...props });
|
|
3830
3927
|
}
|
|
@@ -3838,10 +3935,13 @@ function scriptTags() {
|
|
|
3838
3935
|
content: element.textContent || ""
|
|
3839
3936
|
}));
|
|
3840
3937
|
}
|
|
3841
|
-
function runScripts() {
|
|
3938
|
+
async function runScripts() {
|
|
3842
3939
|
for (const script of scriptTags()) {
|
|
3843
|
-
if (script.src)
|
|
3844
|
-
|
|
3940
|
+
if (script.src) {
|
|
3941
|
+
await require2(script.src);
|
|
3942
|
+
} else if (script.content) {
|
|
3943
|
+
run(script.content);
|
|
3944
|
+
}
|
|
3845
3945
|
}
|
|
3846
3946
|
}
|
|
3847
3947
|
|
|
@@ -4671,47 +4771,47 @@ function globalErrorHandler(eventOrError) {
|
|
|
4671
4771
|
error2.lineNumber
|
|
4672
4772
|
);
|
|
4673
4773
|
const className = css(`
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4774
|
+
background: linear-gradient(135deg, #fff2f2d4, #ffffffd4);
|
|
4775
|
+
backdrop-filter: blur(10px);
|
|
4776
|
+
border: 1px solid rgba(255,255,255,.25);
|
|
4777
|
+
border-radius: 5px;
|
|
4778
|
+
box-shadow: 0 10px 30px rgba(0,0,0,.35);
|
|
4779
|
+
overflow: hidden;
|
|
4780
|
+
min-width: 400px;
|
|
4781
|
+
width: 66%;
|
|
4682
4782
|
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4783
|
+
red {
|
|
4784
|
+
color: #d00;
|
|
4785
|
+
}
|
|
4686
4786
|
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4787
|
+
code {
|
|
4788
|
+
border: 1px solid #0003;
|
|
4789
|
+
overflow: auto;
|
|
4790
|
+
padding: 10px;
|
|
4791
|
+
display: block;
|
|
4792
|
+
}
|
|
4793
|
+
`);
|
|
4694
4794
|
const dialog = document.createElement("dialog");
|
|
4695
4795
|
dialog.className = className;
|
|
4696
4796
|
const location = error2.fileName ? `At ${escapeHtml(error2.fileName)}` : "";
|
|
4697
4797
|
const line2 = Number.isFinite(error2.lineNumber) ? `: Line ${error2.lineNumber + 1}` : "";
|
|
4698
4798
|
const componentStack = ((_a = error2._error) == null ? void 0 : _a.componentStackLog) || ((_b = error2._error) == null ? void 0 : _b.componentStack) || "";
|
|
4699
4799
|
dialog.innerHTML = `
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4800
|
+
<h3><red>Error!</red></h3>
|
|
4801
|
+
<b>${location}${line2}</b><br><br>
|
|
4802
|
+
<b>${escapeHtml(error2.name)}</b>:
|
|
4803
|
+
<span>${escapeHtml(error2.message)}</span>
|
|
4804
|
+
<br><br>
|
|
4705
4805
|
|
|
4706
|
-
|
|
4806
|
+
${excerpt ? "<code><pre></pre><red><pre></pre></red><pre></pre></code>" : ""}
|
|
4707
4807
|
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4808
|
+
${componentStack ? `
|
|
4809
|
+
<br>
|
|
4810
|
+
Component Stack:
|
|
4811
|
+
<br>
|
|
4812
|
+
<code><pre>${escapeHtml(componentStack)}</pre></code>
|
|
4813
|
+
` : ""}
|
|
4814
|
+
`;
|
|
4715
4815
|
if (excerpt) {
|
|
4716
4816
|
const pre = dialog.querySelectorAll("pre");
|
|
4717
4817
|
pre[0].innerText = excerpt.before;
|
|
@@ -6805,7 +6905,10 @@ globalThis.createComponent = Lilact2.createComponent;
|
|
|
6805
6905
|
globalThis.Fragment = Lilact2.Fragment;
|
|
6806
6906
|
globalThis.require = Lilact2.require;
|
|
6807
6907
|
document.addEventListener("DOMContentLoaded", () => {
|
|
6808
|
-
Lilact2.runScripts()
|
|
6908
|
+
Lilact2.runScripts().catch((error2) => {
|
|
6909
|
+
var _a;
|
|
6910
|
+
(_a = Lilact2.globalErrorHandler) == null ? void 0 : _a.call(Lilact2, error2);
|
|
6911
|
+
});
|
|
6809
6912
|
});
|
|
6810
6913
|
if (true) {
|
|
6811
6914
|
window.addEventListener("unhandledrejection", (e) => {
|