lilact 0.27.0 → 0.27.1
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 +18 -15
- package/dist/lilact.development.js.map +3 -3
- package/dist/lilact.development.min.js +6 -6
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +6 -6
- 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/run.runScripts.html +1 -1
- package/docs/static/lilact.development.js +18 -15
- package/docs/static/lilact.development.js.map +3 -3
- package/docs/static/lilact.development.min.js +6 -6
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +6 -6
- package/examples/lilact.development.js +18 -15
- package/examples/lilact.development.js.map +3 -3
- package/examples/lilact.development.min.js +6 -6
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +6 -6
- package/package.json +1 -1
- package/src/hooks.jsx +29 -9
- package/src/lilact.jsx +4 -2
- package/src/run.jsx +2 -2
|
@@ -1930,10 +1930,10 @@ function getComponentByPointer() {
|
|
|
1930
1930
|
const pr = new Promise((res, rej) => {
|
|
1931
1931
|
resolve_func = res;
|
|
1932
1932
|
});
|
|
1933
|
-
function click_handler(
|
|
1934
|
-
|
|
1933
|
+
function click_handler(event) {
|
|
1934
|
+
event.stopImmediatePropagation();
|
|
1935
1935
|
window.removeEventListener("click", click_handler, true);
|
|
1936
|
-
let t =
|
|
1936
|
+
let t = event.target;
|
|
1937
1937
|
while (!t[COMPONENT] && t.parentNode) {
|
|
1938
1938
|
t = t.parentNode;
|
|
1939
1939
|
}
|
|
@@ -3351,8 +3351,8 @@ function useState(initialValue) {
|
|
|
3351
3351
|
return [hk.value, hk.set_func];
|
|
3352
3352
|
}
|
|
3353
3353
|
function useCallback(callback, deps = void 0) {
|
|
3354
|
-
if (deps !== void 0 && (
|
|
3355
|
-
throw new Error("Callback dependencies must be an array or omitted.");
|
|
3354
|
+
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3355
|
+
throw new Error("Callback dependencies must be an array, object or omitted.");
|
|
3356
3356
|
}
|
|
3357
3357
|
const hk = useHook();
|
|
3358
3358
|
if (!isEmpty(hk)) {
|
|
@@ -3445,7 +3445,7 @@ function useRef(initialValue = null) {
|
|
|
3445
3445
|
return hk;
|
|
3446
3446
|
}
|
|
3447
3447
|
async function useLayoutEffect(effect, deps = void 0) {
|
|
3448
|
-
if (deps !== void 0 && (
|
|
3448
|
+
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3449
3449
|
throw new Error("Layout effect dependencies must be an array, object or omitted.");
|
|
3450
3450
|
}
|
|
3451
3451
|
const hk = useHook();
|
|
@@ -3464,7 +3464,7 @@ async function useLayoutEffect(effect, deps = void 0) {
|
|
|
3464
3464
|
lilact_default.setTimeout(lilact_default.processEffects, 0);
|
|
3465
3465
|
}
|
|
3466
3466
|
async function useEffect(effect, deps = void 0) {
|
|
3467
|
-
if (deps !== void 0 && (
|
|
3467
|
+
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3468
3468
|
throw new Error("Effect dependencies must be an array, object or omitted.");
|
|
3469
3469
|
}
|
|
3470
3470
|
const hk = useHook();
|
|
@@ -3483,7 +3483,7 @@ async function useEffect(effect, deps = void 0) {
|
|
|
3483
3483
|
lilact_default.setTimeout(lilact_default.processEffects, 0);
|
|
3484
3484
|
}
|
|
3485
3485
|
async function useInsertionEffect(effect, deps = void 0) {
|
|
3486
|
-
if (deps !== void 0 && (
|
|
3486
|
+
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3487
3487
|
throw new Error("Insertion effect dependencies must be an array, object, or omitted.");
|
|
3488
3488
|
}
|
|
3489
3489
|
const hk = useHook();
|
|
@@ -3502,7 +3502,7 @@ async function useInsertionEffect(effect, deps = void 0) {
|
|
|
3502
3502
|
lilact_default.setTimeout(lilact_default.processEffects, 0);
|
|
3503
3503
|
}
|
|
3504
3504
|
function useMemo(factory, deps = void 0) {
|
|
3505
|
-
if (deps !== void 0 && (
|
|
3505
|
+
if (deps !== void 0 && !Array.isArray(deps) && deps !== null && typeof deps !== "object") {
|
|
3506
3506
|
throw new Error("Memo dependencies must be an array or omitted.");
|
|
3507
3507
|
}
|
|
3508
3508
|
const hk = useHook();
|
|
@@ -3520,11 +3520,11 @@ function useActionState(action, initialState) {
|
|
|
3520
3520
|
const [is_pending, tran_start_func] = useTransition();
|
|
3521
3521
|
if (isEmpty(hk)) {
|
|
3522
3522
|
hk.state = initialState;
|
|
3523
|
-
hk.form_action = (
|
|
3523
|
+
hk.form_action = (event) => {
|
|
3524
3524
|
event.preventDefault();
|
|
3525
3525
|
tran_start_func(
|
|
3526
3526
|
async () => {
|
|
3527
|
-
const form_data = new FormData(
|
|
3527
|
+
const form_data = new FormData(event.target, event.submitter);
|
|
3528
3528
|
hk.state = await action(hk.state, form_data);
|
|
3529
3529
|
},
|
|
3530
3530
|
[]
|
|
@@ -3585,7 +3585,7 @@ function useImperativeHandle(ref, factory, deps = void 0) {
|
|
|
3585
3585
|
if (typeof (ref == null ? void 0 : ref.current) !== "object") {
|
|
3586
3586
|
ref.current = {};
|
|
3587
3587
|
}
|
|
3588
|
-
Object.assign(ref.current, factory()
|
|
3588
|
+
Object.assign(ref.current, factory());
|
|
3589
3589
|
}
|
|
3590
3590
|
function useDebugValue(val, formatter = (x) => x) {
|
|
3591
3591
|
if (true) {
|
|
@@ -3838,9 +3838,9 @@ function scriptTags() {
|
|
|
3838
3838
|
content: element.textContent || ""
|
|
3839
3839
|
}));
|
|
3840
3840
|
}
|
|
3841
|
-
function runScripts() {
|
|
3841
|
+
async function runScripts() {
|
|
3842
3842
|
for (const script of scriptTags()) {
|
|
3843
|
-
if (script.src) require2(script.src);
|
|
3843
|
+
if (script.src) await require2(script.src);
|
|
3844
3844
|
if (script.content) run(script.content);
|
|
3845
3845
|
}
|
|
3846
3846
|
}
|
|
@@ -6805,7 +6805,10 @@ globalThis.createComponent = Lilact2.createComponent;
|
|
|
6805
6805
|
globalThis.Fragment = Lilact2.Fragment;
|
|
6806
6806
|
globalThis.require = Lilact2.require;
|
|
6807
6807
|
document.addEventListener("DOMContentLoaded", () => {
|
|
6808
|
-
Lilact2.runScripts()
|
|
6808
|
+
Lilact2.runScripts().catch((error2) => {
|
|
6809
|
+
var _a;
|
|
6810
|
+
(_a = Lilact2.globalErrorHandler) == null ? void 0 : _a.call(Lilact2, error2);
|
|
6811
|
+
});
|
|
6809
6812
|
});
|
|
6810
6813
|
if (true) {
|
|
6811
6814
|
window.addEventListener("unhandledrejection", (e) => {
|