@almadar/ui 4.23.0 → 4.24.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/avl/index.cjs +43 -2
- package/dist/avl/index.js +43 -2
- package/dist/runtime/index.cjs +43 -2
- package/dist/runtime/index.js +43 -2
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -52773,6 +52773,7 @@ function prepareSchemaForPreview(input) {
|
|
|
52773
52773
|
// runtime/OrbPreview.tsx
|
|
52774
52774
|
init_logger();
|
|
52775
52775
|
var xOrbitalLog2 = createLogger("almadar:runtime:cross-orbital");
|
|
52776
|
+
var navLog = createLogger("almadar:runtime:navigation");
|
|
52776
52777
|
function normalizeChild(child) {
|
|
52777
52778
|
if (typeof child === "string") return child;
|
|
52778
52779
|
if (child === null || typeof child !== "object" || Array.isArray(child)) {
|
|
@@ -52848,6 +52849,19 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
52848
52849
|
}, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, embeddedTraits]);
|
|
52849
52850
|
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, traitConfigsByName, orbitalsByTrait, embeddedTraits } : { navigate: onNavigate, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits };
|
|
52850
52851
|
const { sendEvent } = useTraitStateMachine(traits2, uiSlots, opts);
|
|
52852
|
+
const prevTraitNamesRef = React127.useRef("");
|
|
52853
|
+
React127.useEffect(() => {
|
|
52854
|
+
const traitNames = traits2.map((b) => b.trait?.name ?? "").filter(Boolean).sort().join(",");
|
|
52855
|
+
if (prevTraitNamesRef.current && prevTraitNamesRef.current !== traitNames) {
|
|
52856
|
+
navLog.info("page:trait-set-changed", {
|
|
52857
|
+
from: prevTraitNamesRef.current,
|
|
52858
|
+
to: traitNames,
|
|
52859
|
+
action: "clearAll-slots"
|
|
52860
|
+
});
|
|
52861
|
+
uiSlots.clearAll();
|
|
52862
|
+
}
|
|
52863
|
+
prevTraitNamesRef.current = traitNames;
|
|
52864
|
+
}, [traits2, uiSlots]);
|
|
52851
52865
|
const initSentRef = React127.useRef(false);
|
|
52852
52866
|
React127.useEffect(() => {
|
|
52853
52867
|
if (!orbitalNames?.length) {
|
|
@@ -52862,6 +52876,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
52862
52876
|
}, 5e3);
|
|
52863
52877
|
return () => clearTimeout(fallback);
|
|
52864
52878
|
}, [traits2, orbitalNames, sendEvent, onLocalFallback]);
|
|
52879
|
+
const orbitalsKey = (orbitalNames ?? []).slice().sort().join(",");
|
|
52880
|
+
React127.useEffect(() => {
|
|
52881
|
+
initSentRef.current = false;
|
|
52882
|
+
}, [orbitalsKey]);
|
|
52865
52883
|
React127.useEffect(() => {
|
|
52866
52884
|
if (!bridge.connected || !orbitalNames?.length || initSentRef.current) return;
|
|
52867
52885
|
initSentRef.current = true;
|
|
@@ -53102,8 +53120,19 @@ function OrbPreview({
|
|
|
53102
53120
|
}, [initialPageName, currentPage]);
|
|
53103
53121
|
const handleNavigate = React127.useCallback((path) => {
|
|
53104
53122
|
const match = pages.find(({ page }) => page.path === path);
|
|
53123
|
+
navLog.info("handleNavigate", {
|
|
53124
|
+
path,
|
|
53125
|
+
matched: match?.page.name ?? null,
|
|
53126
|
+
availablePaths: pages.map((p2) => p2.page.path)
|
|
53127
|
+
});
|
|
53105
53128
|
if (match) {
|
|
53106
53129
|
setCurrentPage(match.page.name);
|
|
53130
|
+
if (typeof window !== "undefined") {
|
|
53131
|
+
const url = new URL(window.location.href);
|
|
53132
|
+
url.searchParams.set("page", path);
|
|
53133
|
+
window.history.pushState({}, "", url.toString());
|
|
53134
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
53135
|
+
}
|
|
53107
53136
|
}
|
|
53108
53137
|
}, [pages]);
|
|
53109
53138
|
if (!parseResult.ok) {
|
|
@@ -53115,18 +53144,30 @@ function OrbPreview({
|
|
|
53115
53144
|
const containerRef = React127.useRef(null);
|
|
53116
53145
|
React127.useEffect(() => {
|
|
53117
53146
|
const el = containerRef.current;
|
|
53118
|
-
if (!el
|
|
53147
|
+
if (!el) return;
|
|
53148
|
+
if (pages.length <= 1) {
|
|
53149
|
+
navLog.info("interceptor:skipped", { reason: "single-page schema", pageCount: pages.length });
|
|
53150
|
+
return;
|
|
53151
|
+
}
|
|
53119
53152
|
const handler = (e) => {
|
|
53120
53153
|
const anchor = e.target.closest("a");
|
|
53121
53154
|
if (!anchor) return;
|
|
53122
53155
|
const href = anchor.getAttribute("href") ?? anchor.getAttribute("to") ?? "";
|
|
53123
|
-
|
|
53156
|
+
navLog.info("click:intercepted", {
|
|
53157
|
+
href,
|
|
53158
|
+
anchorText: anchor.textContent?.trim().slice(0, 40)
|
|
53159
|
+
});
|
|
53160
|
+
if (!href || href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("#")) {
|
|
53161
|
+
navLog.info("click:skipped", { href, reason: "external/empty/hash" });
|
|
53162
|
+
return;
|
|
53163
|
+
}
|
|
53124
53164
|
e.preventDefault();
|
|
53125
53165
|
e.stopPropagation();
|
|
53126
53166
|
e.stopImmediatePropagation();
|
|
53127
53167
|
handleNavigate(href);
|
|
53128
53168
|
};
|
|
53129
53169
|
el.addEventListener("click", handler, true);
|
|
53170
|
+
navLog.info("interceptor:installed", { pageCount: pages.length, paths: pages.map((p2) => p2.page.path) });
|
|
53130
53171
|
return () => el.removeEventListener("click", handler, true);
|
|
53131
53172
|
}, [pages, handleNavigate]);
|
|
53132
53173
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
package/dist/avl/index.js
CHANGED
|
@@ -52727,6 +52727,7 @@ function prepareSchemaForPreview(input) {
|
|
|
52727
52727
|
// runtime/OrbPreview.tsx
|
|
52728
52728
|
init_logger();
|
|
52729
52729
|
var xOrbitalLog2 = createLogger("almadar:runtime:cross-orbital");
|
|
52730
|
+
var navLog = createLogger("almadar:runtime:navigation");
|
|
52730
52731
|
function normalizeChild(child) {
|
|
52731
52732
|
if (typeof child === "string") return child;
|
|
52732
52733
|
if (child === null || typeof child !== "object" || Array.isArray(child)) {
|
|
@@ -52802,6 +52803,19 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
52802
52803
|
}, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, embeddedTraits]);
|
|
52803
52804
|
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, traitConfigsByName, orbitalsByTrait, embeddedTraits } : { navigate: onNavigate, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits };
|
|
52804
52805
|
const { sendEvent } = useTraitStateMachine(traits2, uiSlots, opts);
|
|
52806
|
+
const prevTraitNamesRef = useRef("");
|
|
52807
|
+
useEffect(() => {
|
|
52808
|
+
const traitNames = traits2.map((b) => b.trait?.name ?? "").filter(Boolean).sort().join(",");
|
|
52809
|
+
if (prevTraitNamesRef.current && prevTraitNamesRef.current !== traitNames) {
|
|
52810
|
+
navLog.info("page:trait-set-changed", {
|
|
52811
|
+
from: prevTraitNamesRef.current,
|
|
52812
|
+
to: traitNames,
|
|
52813
|
+
action: "clearAll-slots"
|
|
52814
|
+
});
|
|
52815
|
+
uiSlots.clearAll();
|
|
52816
|
+
}
|
|
52817
|
+
prevTraitNamesRef.current = traitNames;
|
|
52818
|
+
}, [traits2, uiSlots]);
|
|
52805
52819
|
const initSentRef = useRef(false);
|
|
52806
52820
|
useEffect(() => {
|
|
52807
52821
|
if (!orbitalNames?.length) {
|
|
@@ -52816,6 +52830,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
52816
52830
|
}, 5e3);
|
|
52817
52831
|
return () => clearTimeout(fallback);
|
|
52818
52832
|
}, [traits2, orbitalNames, sendEvent, onLocalFallback]);
|
|
52833
|
+
const orbitalsKey = (orbitalNames ?? []).slice().sort().join(",");
|
|
52834
|
+
useEffect(() => {
|
|
52835
|
+
initSentRef.current = false;
|
|
52836
|
+
}, [orbitalsKey]);
|
|
52819
52837
|
useEffect(() => {
|
|
52820
52838
|
if (!bridge.connected || !orbitalNames?.length || initSentRef.current) return;
|
|
52821
52839
|
initSentRef.current = true;
|
|
@@ -53056,8 +53074,19 @@ function OrbPreview({
|
|
|
53056
53074
|
}, [initialPageName, currentPage]);
|
|
53057
53075
|
const handleNavigate = useCallback((path) => {
|
|
53058
53076
|
const match = pages.find(({ page }) => page.path === path);
|
|
53077
|
+
navLog.info("handleNavigate", {
|
|
53078
|
+
path,
|
|
53079
|
+
matched: match?.page.name ?? null,
|
|
53080
|
+
availablePaths: pages.map((p2) => p2.page.path)
|
|
53081
|
+
});
|
|
53059
53082
|
if (match) {
|
|
53060
53083
|
setCurrentPage(match.page.name);
|
|
53084
|
+
if (typeof window !== "undefined") {
|
|
53085
|
+
const url = new URL(window.location.href);
|
|
53086
|
+
url.searchParams.set("page", path);
|
|
53087
|
+
window.history.pushState({}, "", url.toString());
|
|
53088
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
53089
|
+
}
|
|
53061
53090
|
}
|
|
53062
53091
|
}, [pages]);
|
|
53063
53092
|
if (!parseResult.ok) {
|
|
@@ -53069,18 +53098,30 @@ function OrbPreview({
|
|
|
53069
53098
|
const containerRef = useRef(null);
|
|
53070
53099
|
useEffect(() => {
|
|
53071
53100
|
const el = containerRef.current;
|
|
53072
|
-
if (!el
|
|
53101
|
+
if (!el) return;
|
|
53102
|
+
if (pages.length <= 1) {
|
|
53103
|
+
navLog.info("interceptor:skipped", { reason: "single-page schema", pageCount: pages.length });
|
|
53104
|
+
return;
|
|
53105
|
+
}
|
|
53073
53106
|
const handler = (e) => {
|
|
53074
53107
|
const anchor = e.target.closest("a");
|
|
53075
53108
|
if (!anchor) return;
|
|
53076
53109
|
const href = anchor.getAttribute("href") ?? anchor.getAttribute("to") ?? "";
|
|
53077
|
-
|
|
53110
|
+
navLog.info("click:intercepted", {
|
|
53111
|
+
href,
|
|
53112
|
+
anchorText: anchor.textContent?.trim().slice(0, 40)
|
|
53113
|
+
});
|
|
53114
|
+
if (!href || href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("#")) {
|
|
53115
|
+
navLog.info("click:skipped", { href, reason: "external/empty/hash" });
|
|
53116
|
+
return;
|
|
53117
|
+
}
|
|
53078
53118
|
e.preventDefault();
|
|
53079
53119
|
e.stopPropagation();
|
|
53080
53120
|
e.stopImmediatePropagation();
|
|
53081
53121
|
handleNavigate(href);
|
|
53082
53122
|
};
|
|
53083
53123
|
el.addEventListener("click", handler, true);
|
|
53124
|
+
navLog.info("interceptor:installed", { pageCount: pages.length, paths: pages.map((p2) => p2.page.path) });
|
|
53084
53125
|
return () => el.removeEventListener("click", handler, true);
|
|
53085
53126
|
}, [pages, handleNavigate]);
|
|
53086
53127
|
return /* @__PURE__ */ jsxs(
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -39531,6 +39531,7 @@ function prepareSchemaForPreview(input) {
|
|
|
39531
39531
|
// runtime/OrbPreview.tsx
|
|
39532
39532
|
init_logger();
|
|
39533
39533
|
var xOrbitalLog2 = createLogger("almadar:runtime:cross-orbital");
|
|
39534
|
+
var navLog = createLogger("almadar:runtime:navigation");
|
|
39534
39535
|
function normalizeChild(child) {
|
|
39535
39536
|
if (typeof child === "string") return child;
|
|
39536
39537
|
if (child === null || typeof child !== "object" || Array.isArray(child)) {
|
|
@@ -39606,6 +39607,19 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
39606
39607
|
}, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, embeddedTraits]);
|
|
39607
39608
|
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, traitConfigsByName, orbitalsByTrait, embeddedTraits } : { navigate: onNavigate, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits };
|
|
39608
39609
|
const { sendEvent } = useTraitStateMachine(traits2, uiSlots, opts);
|
|
39610
|
+
const prevTraitNamesRef = React113.useRef("");
|
|
39611
|
+
React113.useEffect(() => {
|
|
39612
|
+
const traitNames = traits2.map((b) => b.trait?.name ?? "").filter(Boolean).sort().join(",");
|
|
39613
|
+
if (prevTraitNamesRef.current && prevTraitNamesRef.current !== traitNames) {
|
|
39614
|
+
navLog.info("page:trait-set-changed", {
|
|
39615
|
+
from: prevTraitNamesRef.current,
|
|
39616
|
+
to: traitNames,
|
|
39617
|
+
action: "clearAll-slots"
|
|
39618
|
+
});
|
|
39619
|
+
uiSlots.clearAll();
|
|
39620
|
+
}
|
|
39621
|
+
prevTraitNamesRef.current = traitNames;
|
|
39622
|
+
}, [traits2, uiSlots]);
|
|
39609
39623
|
const initSentRef = React113.useRef(false);
|
|
39610
39624
|
React113.useEffect(() => {
|
|
39611
39625
|
if (!orbitalNames?.length) {
|
|
@@ -39620,6 +39634,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
39620
39634
|
}, 5e3);
|
|
39621
39635
|
return () => clearTimeout(fallback);
|
|
39622
39636
|
}, [traits2, orbitalNames, sendEvent, onLocalFallback]);
|
|
39637
|
+
const orbitalsKey = (orbitalNames ?? []).slice().sort().join(",");
|
|
39638
|
+
React113.useEffect(() => {
|
|
39639
|
+
initSentRef.current = false;
|
|
39640
|
+
}, [orbitalsKey]);
|
|
39623
39641
|
React113.useEffect(() => {
|
|
39624
39642
|
if (!bridge.connected || !orbitalNames?.length || initSentRef.current) return;
|
|
39625
39643
|
initSentRef.current = true;
|
|
@@ -39860,8 +39878,19 @@ function OrbPreview({
|
|
|
39860
39878
|
}, [initialPageName, currentPage]);
|
|
39861
39879
|
const handleNavigate = React113.useCallback((path) => {
|
|
39862
39880
|
const match = pages.find(({ page }) => page.path === path);
|
|
39881
|
+
navLog.info("handleNavigate", {
|
|
39882
|
+
path,
|
|
39883
|
+
matched: match?.page.name ?? null,
|
|
39884
|
+
availablePaths: pages.map((p2) => p2.page.path)
|
|
39885
|
+
});
|
|
39863
39886
|
if (match) {
|
|
39864
39887
|
setCurrentPage(match.page.name);
|
|
39888
|
+
if (typeof window !== "undefined") {
|
|
39889
|
+
const url = new URL(window.location.href);
|
|
39890
|
+
url.searchParams.set("page", path);
|
|
39891
|
+
window.history.pushState({}, "", url.toString());
|
|
39892
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
39893
|
+
}
|
|
39865
39894
|
}
|
|
39866
39895
|
}, [pages]);
|
|
39867
39896
|
if (!parseResult.ok) {
|
|
@@ -39873,18 +39902,30 @@ function OrbPreview({
|
|
|
39873
39902
|
const containerRef = React113.useRef(null);
|
|
39874
39903
|
React113.useEffect(() => {
|
|
39875
39904
|
const el = containerRef.current;
|
|
39876
|
-
if (!el
|
|
39905
|
+
if (!el) return;
|
|
39906
|
+
if (pages.length <= 1) {
|
|
39907
|
+
navLog.info("interceptor:skipped", { reason: "single-page schema", pageCount: pages.length });
|
|
39908
|
+
return;
|
|
39909
|
+
}
|
|
39877
39910
|
const handler = (e) => {
|
|
39878
39911
|
const anchor = e.target.closest("a");
|
|
39879
39912
|
if (!anchor) return;
|
|
39880
39913
|
const href = anchor.getAttribute("href") ?? anchor.getAttribute("to") ?? "";
|
|
39881
|
-
|
|
39914
|
+
navLog.info("click:intercepted", {
|
|
39915
|
+
href,
|
|
39916
|
+
anchorText: anchor.textContent?.trim().slice(0, 40)
|
|
39917
|
+
});
|
|
39918
|
+
if (!href || href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("#")) {
|
|
39919
|
+
navLog.info("click:skipped", { href, reason: "external/empty/hash" });
|
|
39920
|
+
return;
|
|
39921
|
+
}
|
|
39882
39922
|
e.preventDefault();
|
|
39883
39923
|
e.stopPropagation();
|
|
39884
39924
|
e.stopImmediatePropagation();
|
|
39885
39925
|
handleNavigate(href);
|
|
39886
39926
|
};
|
|
39887
39927
|
el.addEventListener("click", handler, true);
|
|
39928
|
+
navLog.info("interceptor:installed", { pageCount: pages.length, paths: pages.map((p2) => p2.page.path) });
|
|
39888
39929
|
return () => el.removeEventListener("click", handler, true);
|
|
39889
39930
|
}, [pages, handleNavigate]);
|
|
39890
39931
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
package/dist/runtime/index.js
CHANGED
|
@@ -39486,6 +39486,7 @@ function prepareSchemaForPreview(input) {
|
|
|
39486
39486
|
// runtime/OrbPreview.tsx
|
|
39487
39487
|
init_logger();
|
|
39488
39488
|
var xOrbitalLog2 = createLogger("almadar:runtime:cross-orbital");
|
|
39489
|
+
var navLog = createLogger("almadar:runtime:navigation");
|
|
39489
39490
|
function normalizeChild(child) {
|
|
39490
39491
|
if (typeof child === "string") return child;
|
|
39491
39492
|
if (child === null || typeof child !== "object" || Array.isArray(child)) {
|
|
@@ -39561,6 +39562,19 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
39561
39562
|
}, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, embeddedTraits]);
|
|
39562
39563
|
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, traitConfigsByName, orbitalsByTrait, embeddedTraits } : { navigate: onNavigate, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits };
|
|
39563
39564
|
const { sendEvent } = useTraitStateMachine(traits2, uiSlots, opts);
|
|
39565
|
+
const prevTraitNamesRef = useRef("");
|
|
39566
|
+
useEffect(() => {
|
|
39567
|
+
const traitNames = traits2.map((b) => b.trait?.name ?? "").filter(Boolean).sort().join(",");
|
|
39568
|
+
if (prevTraitNamesRef.current && prevTraitNamesRef.current !== traitNames) {
|
|
39569
|
+
navLog.info("page:trait-set-changed", {
|
|
39570
|
+
from: prevTraitNamesRef.current,
|
|
39571
|
+
to: traitNames,
|
|
39572
|
+
action: "clearAll-slots"
|
|
39573
|
+
});
|
|
39574
|
+
uiSlots.clearAll();
|
|
39575
|
+
}
|
|
39576
|
+
prevTraitNamesRef.current = traitNames;
|
|
39577
|
+
}, [traits2, uiSlots]);
|
|
39564
39578
|
const initSentRef = useRef(false);
|
|
39565
39579
|
useEffect(() => {
|
|
39566
39580
|
if (!orbitalNames?.length) {
|
|
@@ -39575,6 +39589,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
39575
39589
|
}, 5e3);
|
|
39576
39590
|
return () => clearTimeout(fallback);
|
|
39577
39591
|
}, [traits2, orbitalNames, sendEvent, onLocalFallback]);
|
|
39592
|
+
const orbitalsKey = (orbitalNames ?? []).slice().sort().join(",");
|
|
39593
|
+
useEffect(() => {
|
|
39594
|
+
initSentRef.current = false;
|
|
39595
|
+
}, [orbitalsKey]);
|
|
39578
39596
|
useEffect(() => {
|
|
39579
39597
|
if (!bridge.connected || !orbitalNames?.length || initSentRef.current) return;
|
|
39580
39598
|
initSentRef.current = true;
|
|
@@ -39815,8 +39833,19 @@ function OrbPreview({
|
|
|
39815
39833
|
}, [initialPageName, currentPage]);
|
|
39816
39834
|
const handleNavigate = useCallback((path) => {
|
|
39817
39835
|
const match = pages.find(({ page }) => page.path === path);
|
|
39836
|
+
navLog.info("handleNavigate", {
|
|
39837
|
+
path,
|
|
39838
|
+
matched: match?.page.name ?? null,
|
|
39839
|
+
availablePaths: pages.map((p2) => p2.page.path)
|
|
39840
|
+
});
|
|
39818
39841
|
if (match) {
|
|
39819
39842
|
setCurrentPage(match.page.name);
|
|
39843
|
+
if (typeof window !== "undefined") {
|
|
39844
|
+
const url = new URL(window.location.href);
|
|
39845
|
+
url.searchParams.set("page", path);
|
|
39846
|
+
window.history.pushState({}, "", url.toString());
|
|
39847
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
39848
|
+
}
|
|
39820
39849
|
}
|
|
39821
39850
|
}, [pages]);
|
|
39822
39851
|
if (!parseResult.ok) {
|
|
@@ -39828,18 +39857,30 @@ function OrbPreview({
|
|
|
39828
39857
|
const containerRef = useRef(null);
|
|
39829
39858
|
useEffect(() => {
|
|
39830
39859
|
const el = containerRef.current;
|
|
39831
|
-
if (!el
|
|
39860
|
+
if (!el) return;
|
|
39861
|
+
if (pages.length <= 1) {
|
|
39862
|
+
navLog.info("interceptor:skipped", { reason: "single-page schema", pageCount: pages.length });
|
|
39863
|
+
return;
|
|
39864
|
+
}
|
|
39832
39865
|
const handler = (e) => {
|
|
39833
39866
|
const anchor = e.target.closest("a");
|
|
39834
39867
|
if (!anchor) return;
|
|
39835
39868
|
const href = anchor.getAttribute("href") ?? anchor.getAttribute("to") ?? "";
|
|
39836
|
-
|
|
39869
|
+
navLog.info("click:intercepted", {
|
|
39870
|
+
href,
|
|
39871
|
+
anchorText: anchor.textContent?.trim().slice(0, 40)
|
|
39872
|
+
});
|
|
39873
|
+
if (!href || href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("#")) {
|
|
39874
|
+
navLog.info("click:skipped", { href, reason: "external/empty/hash" });
|
|
39875
|
+
return;
|
|
39876
|
+
}
|
|
39837
39877
|
e.preventDefault();
|
|
39838
39878
|
e.stopPropagation();
|
|
39839
39879
|
e.stopImmediatePropagation();
|
|
39840
39880
|
handleNavigate(href);
|
|
39841
39881
|
};
|
|
39842
39882
|
el.addEventListener("click", handler, true);
|
|
39883
|
+
navLog.info("interceptor:installed", { pageCount: pages.length, paths: pages.map((p2) => p2.page.path) });
|
|
39843
39884
|
return () => el.removeEventListener("click", handler, true);
|
|
39844
39885
|
}, [pages, handleNavigate]);
|
|
39845
39886
|
return /* @__PURE__ */ jsxs(
|