@lolyjs/core 0.1.0-alpha.4 → 0.1.0-alpha.5
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/cli.cjs +3 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +56 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -29
- package/dist/index.js.map +1 -1
- package/dist/runtime.cjs +53 -29
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +53 -29
- package/dist/runtime.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1395,6 +1395,9 @@ function createClientConfig(projectRoot, mode) {
|
|
|
1395
1395
|
filename: mode === "production" ? "client.[contenthash].css" : "client.css"
|
|
1396
1396
|
})
|
|
1397
1397
|
],
|
|
1398
|
+
externals: {
|
|
1399
|
+
"@lolyjs/core/runtime": "@lolyjs/core/runtime"
|
|
1400
|
+
},
|
|
1398
1401
|
infrastructureLogging: {
|
|
1399
1402
|
level: "error"
|
|
1400
1403
|
},
|
|
@@ -5499,34 +5502,55 @@ async function navigate(nextUrl, handlers, options) {
|
|
|
5499
5502
|
}
|
|
5500
5503
|
function createClickHandler(navigate2) {
|
|
5501
5504
|
return function handleClick(ev) {
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
if (
|
|
5505
|
-
|
|
5506
|
-
if (
|
|
5505
|
+
try {
|
|
5506
|
+
if (ev.defaultPrevented) return;
|
|
5507
|
+
if (ev.type !== "click") return;
|
|
5508
|
+
if (ev.button !== 0) return;
|
|
5509
|
+
if (ev.metaKey || ev.ctrlKey || ev.shiftKey || ev.altKey) return;
|
|
5510
|
+
if (ev.clientX === 0 && ev.clientY === 0 && ev.detail === 0) {
|
|
5511
|
+
const target2 = ev.target;
|
|
5512
|
+
if (target2) {
|
|
5513
|
+
const tagName2 = target2.tagName.toLowerCase();
|
|
5514
|
+
if (tagName2 === "input" || tagName2 === "textarea" || tagName2 === "button" || tagName2 === "select") {
|
|
5515
|
+
return;
|
|
5516
|
+
}
|
|
5517
|
+
}
|
|
5518
|
+
}
|
|
5519
|
+
const target = ev.target;
|
|
5520
|
+
if (!target) return;
|
|
5521
|
+
const tagName = target.tagName.toLowerCase();
|
|
5522
|
+
if (tagName === "input" || tagName === "textarea" || tagName === "button" || tagName === "select" || target.isContentEditable || target.getAttribute("contenteditable") === "true") {
|
|
5507
5523
|
return;
|
|
5508
5524
|
}
|
|
5525
|
+
const interactiveParent = target.closest("input, textarea, button, select, [contenteditable], label");
|
|
5526
|
+
if (interactiveParent) {
|
|
5527
|
+
if (interactiveParent.tagName.toLowerCase() === "label") {
|
|
5528
|
+
const label = interactiveParent;
|
|
5529
|
+
if (label.control) {
|
|
5530
|
+
return;
|
|
5531
|
+
}
|
|
5532
|
+
} else {
|
|
5533
|
+
return;
|
|
5534
|
+
}
|
|
5535
|
+
}
|
|
5536
|
+
const anchor = target.closest("a[href]");
|
|
5537
|
+
if (!anchor) return;
|
|
5538
|
+
const href = anchor.getAttribute("href");
|
|
5539
|
+
if (!href) return;
|
|
5540
|
+
if (href.startsWith("#")) return;
|
|
5541
|
+
const url = new URL(href, window.location.href);
|
|
5542
|
+
if (url.origin !== window.location.origin) return;
|
|
5543
|
+
if (anchor.target && anchor.target !== "_self") return;
|
|
5544
|
+
ev.preventDefault();
|
|
5545
|
+
const nextUrl = url.pathname + url.search;
|
|
5546
|
+
const currentUrl = window.location.pathname + window.location.search;
|
|
5547
|
+
if (nextUrl === currentUrl) return;
|
|
5548
|
+
const shouldRevalidate = anchor.hasAttribute("data-revalidate") && anchor.getAttribute("data-revalidate") !== "false";
|
|
5549
|
+
window.history.pushState({}, "", nextUrl);
|
|
5550
|
+
navigate2(nextUrl, shouldRevalidate ? { revalidate: true } : void 0);
|
|
5551
|
+
} catch (error) {
|
|
5552
|
+
console.error("[navigation] Error in click handler:", error);
|
|
5509
5553
|
}
|
|
5510
|
-
const target = ev.target;
|
|
5511
|
-
if (!target) return;
|
|
5512
|
-
if (ev.defaultPrevented) return;
|
|
5513
|
-
if (ev.button !== 0) return;
|
|
5514
|
-
if (ev.metaKey || ev.ctrlKey || ev.shiftKey || ev.altKey) return;
|
|
5515
|
-
const anchor = target.closest("a[href]");
|
|
5516
|
-
if (!anchor) return;
|
|
5517
|
-
const href = anchor.getAttribute("href");
|
|
5518
|
-
if (!href) return;
|
|
5519
|
-
if (href.startsWith("#")) return;
|
|
5520
|
-
const url = new URL(href, window.location.href);
|
|
5521
|
-
if (url.origin !== window.location.origin) return;
|
|
5522
|
-
if (anchor.target && anchor.target !== "_self") return;
|
|
5523
|
-
ev.preventDefault();
|
|
5524
|
-
const nextUrl = url.pathname + url.search;
|
|
5525
|
-
const currentUrl = window.location.pathname + window.location.search;
|
|
5526
|
-
if (nextUrl === currentUrl) return;
|
|
5527
|
-
const shouldRevalidate = anchor.hasAttribute("data-revalidate") && anchor.getAttribute("data-revalidate") !== "false";
|
|
5528
|
-
window.history.pushState({}, "", nextUrl);
|
|
5529
|
-
navigate2(nextUrl, shouldRevalidate ? { revalidate: true } : void 0);
|
|
5530
5554
|
};
|
|
5531
5555
|
}
|
|
5532
5556
|
function createPopStateHandler(navigate2) {
|
|
@@ -5560,16 +5584,19 @@ function AppShell({
|
|
|
5560
5584
|
};
|
|
5561
5585
|
}, [routes, notFoundRoute, errorRoute]);
|
|
5562
5586
|
(0, import_react2.useEffect)(() => {
|
|
5587
|
+
let isMounted = true;
|
|
5563
5588
|
async function handleNavigate(nextUrl, options) {
|
|
5589
|
+
if (!isMounted) return;
|
|
5564
5590
|
await navigate(nextUrl, handlersRef.current, options);
|
|
5565
5591
|
}
|
|
5566
5592
|
const handleClick = createClickHandler(handleNavigate);
|
|
5567
5593
|
const handlePopState = createPopStateHandler(handleNavigate);
|
|
5568
|
-
window.addEventListener("click", handleClick,
|
|
5569
|
-
window.addEventListener("popstate", handlePopState,
|
|
5594
|
+
window.addEventListener("click", handleClick, false);
|
|
5595
|
+
window.addEventListener("popstate", handlePopState, false);
|
|
5570
5596
|
return () => {
|
|
5571
|
-
|
|
5572
|
-
window.removeEventListener("
|
|
5597
|
+
isMounted = false;
|
|
5598
|
+
window.removeEventListener("click", handleClick, false);
|
|
5599
|
+
window.removeEventListener("popstate", handlePopState, false);
|
|
5573
5600
|
};
|
|
5574
5601
|
}, []);
|
|
5575
5602
|
const isError = state.route === errorRoute;
|