@syntrologie/adapt-nav 2.16.0 → 2.17.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/NavWidgetLit.d.ts.map +1 -1
- package/dist/chunk-HMLY7DHA.js +16 -0
- package/dist/chunk-HMLY7DHA.js.map +7 -0
- package/dist/chunk-ZYHZ6JAD.js +447 -0
- package/dist/chunk-ZYHZ6JAD.js.map +7 -0
- package/dist/editor.d.ts +42 -21
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +310 -313
- package/dist/editor.js.map +7 -0
- package/dist/resolveNavTarget.d.ts +61 -0
- package/dist/resolveNavTarget.d.ts.map +1 -0
- package/dist/resolveNavTarget.test.d.ts +2 -0
- package/dist/resolveNavTarget.test.d.ts.map +1 -0
- package/dist/runtime.d.ts +3 -4
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +612 -221
- package/dist/runtime.js.map +7 -0
- package/dist/schema.d.ts +182 -72
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +155 -125
- package/dist/schema.js.map +7 -0
- package/package.json +9 -24
- package/dist/NavWidget.d.ts +0 -31
- package/dist/NavWidget.d.ts.map +0 -1
- package/dist/NavWidget.js +0 -476
- package/dist/NavWidgetLit.js +0 -495
- package/dist/NavWidgetLit.test.js +0 -199
- package/dist/cdn.d.ts +0 -62
- package/dist/cdn.d.ts.map +0 -1
- package/dist/cdn.js +0 -48
- package/dist/editor-lit.d.ts +0 -49
- package/dist/editor-lit.d.ts.map +0 -1
- package/dist/editor-lit.js +0 -319
- package/dist/runtime-lit.d.ts +0 -108
- package/dist/runtime-lit.d.ts.map +0 -1
- package/dist/runtime-lit.js +0 -241
- package/dist/summarize.js +0 -51
- package/dist/types.js +0 -18
- package/node_modules/@syntro/design-system/README.md +0 -335
- package/node_modules/@syntro/design-system/dist/assets/syntrologie-logo.svg +0 -21
- package/node_modules/@syntro/design-system/dist/assets/syntrologie-logomark.svg +0 -10
- package/node_modules/@syntro/design-system/dist/index.d.ts +0 -8
- package/node_modules/@syntro/design-system/dist/index.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/index.js +0 -7
- package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts +0 -19
- package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/tailwind-preset.js +0 -455
- package/node_modules/@syntro/design-system/dist/tokens/colors.css +0 -464
- package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts +0 -874
- package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/tokens/colors.js +0 -564
- package/node_modules/@syntro/design-system/dist/tokens/effects.css +0 -43
- package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts +0 -139
- package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/tokens/effects.js +0 -121
- package/node_modules/@syntro/design-system/dist/tokens/index.d.ts +0 -12
- package/node_modules/@syntro/design-system/dist/tokens/index.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/tokens/index.js +0 -11
- package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts +0 -93
- package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/tokens/panel-shell.js +0 -72
- package/node_modules/@syntro/design-system/package.json +0 -55
- package/node_modules/@syntro/design-system/src/assets/syntrologie-logo.svg +0 -21
- package/node_modules/@syntro/design-system/src/assets/syntrologie-logomark.svg +0 -10
- package/node_modules/@syntrologie/sdk-contracts/dist/index.d.ts +0 -129
- package/node_modules/@syntrologie/sdk-contracts/dist/index.js +0 -17
- package/node_modules/@syntrologie/sdk-contracts/dist/schemas.d.ts +0 -2296
- package/node_modules/@syntrologie/sdk-contracts/dist/schemas.js +0 -361
- package/node_modules/@syntrologie/sdk-contracts/package.json +0 -33
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts +0 -2
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.js +0 -3
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +0 -34
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +0 -161
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts +0 -84
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.js +0 -323
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts +0 -25
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.js +0 -55
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +0 -23
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +0 -40
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts +0 -33
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.js +0 -118
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +0 -22
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts +0 -32
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.js +0 -68
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts +0 -34
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.js +0 -57
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts +0 -13
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.js +0 -31
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.js +0 -15
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts +0 -13
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +0 -15
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts +0 -36
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.js +0 -102
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts +0 -20
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.js +0 -48
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts +0 -16
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.js +0 -25
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts +0 -66
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.js +0 -87
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.js +0 -15
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +0 -25
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +0 -390
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts +0 -66
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.js +0 -528
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts +0 -41
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.js +0 -63
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +0 -17
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts +0 -55
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.js +0 -92
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts +0 -32
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +0 -85
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts +0 -90
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.js +0 -242
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts +0 -6
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts +0 -12
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.js +0 -21
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.js +0 -5
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts +0 -21
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.js +0 -33
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +0 -12
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +0 -40
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts +0 -28
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.js +0 -121
- package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts +0 -110
- package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.js +0 -481
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +0 -26
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +0 -202
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.js +0 -46
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts +0 -24
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.js +0 -86
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +0 -36
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +0 -26
- package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts +0 -15
- package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.js +0 -14
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts +0 -33
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.js +0 -68
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts +0 -22
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.js +0 -143
- package/node_modules/@syntrologie/shared-editor-ui/package.json +0 -55
package/dist/runtime.js
CHANGED
|
@@ -1,241 +1,632 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import {
|
|
2
|
+
renderIcon
|
|
3
|
+
} from "./chunk-ZYHZ6JAD.js";
|
|
4
|
+
import {
|
|
5
|
+
__privateAdd,
|
|
6
|
+
__privateGet,
|
|
7
|
+
__privateMethod,
|
|
8
|
+
__privateSet
|
|
9
|
+
} from "./chunk-HMLY7DHA.js";
|
|
10
|
+
|
|
11
|
+
// src/NavWidgetLit.ts
|
|
12
|
+
import { html, LitElement, nothing } from "lit";
|
|
13
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
14
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
15
|
+
|
|
16
|
+
// src/resolveNavTarget.ts
|
|
17
|
+
function resolveNavTarget(args) {
|
|
18
|
+
const { href, external, windowOrigin, isIframe } = args;
|
|
19
|
+
const isOpaqueOrigin = windowOrigin === "null";
|
|
20
|
+
if (isIframe || isOpaqueOrigin) {
|
|
21
|
+
return { kind: "open", url: href };
|
|
22
|
+
}
|
|
23
|
+
if (external) {
|
|
24
|
+
return { kind: "open", url: href };
|
|
25
|
+
}
|
|
26
|
+
let url;
|
|
27
|
+
try {
|
|
28
|
+
url = new URL(href, windowOrigin);
|
|
29
|
+
} catch {
|
|
30
|
+
return { kind: "fullnav", url: href };
|
|
31
|
+
}
|
|
32
|
+
if (url.origin !== windowOrigin) {
|
|
33
|
+
return { kind: "fullnav", url: url.toString() };
|
|
34
|
+
}
|
|
35
|
+
return { kind: "spa", url };
|
|
36
|
+
}
|
|
37
|
+
function detectIsIframe() {
|
|
38
|
+
if (typeof window === "undefined") return false;
|
|
39
|
+
try {
|
|
40
|
+
return window !== window.top;
|
|
41
|
+
} catch {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// src/NavWidgetLit.ts
|
|
47
|
+
var TOKEN_PURPLE_4 = "#6a59ce";
|
|
48
|
+
var TOKEN_SLATE_GREY_7 = "#677384";
|
|
49
|
+
var TOKEN_SLATE_GREY_8 = "#87919f";
|
|
50
|
+
function escapeHtml(str) {
|
|
51
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
52
|
+
}
|
|
53
|
+
function renderIcon2(emoji) {
|
|
54
|
+
return renderIcon(emoji) || escapeHtml(emoji);
|
|
55
|
+
}
|
|
56
|
+
function routeMatchesCurrent(routes) {
|
|
57
|
+
if (typeof window === "undefined") return false;
|
|
58
|
+
const current = window.location.pathname;
|
|
59
|
+
return routes.some((route) => {
|
|
60
|
+
const routePath = route.split("?")[0].split("#")[0];
|
|
61
|
+
if (routePath.endsWith("/**")) {
|
|
62
|
+
return current.startsWith(routePath.slice(0, -3));
|
|
21
63
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
64
|
+
return current === routePath;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function pulseElement(el) {
|
|
68
|
+
const keyframes = [
|
|
69
|
+
{ boxShadow: "0 0 0 0 rgba(13, 148, 136, 0.5)" },
|
|
70
|
+
{ boxShadow: "0 0 0 8px rgba(13, 148, 136, 0)" }
|
|
71
|
+
];
|
|
72
|
+
el.animate(keyframes, { duration: 600, iterations: 3, easing: "ease-out" });
|
|
73
|
+
}
|
|
74
|
+
function resolveTheme(theme) {
|
|
75
|
+
if (theme === "dark") return "dark";
|
|
76
|
+
if (theme === "light") return "light";
|
|
77
|
+
if (typeof window !== "undefined") {
|
|
78
|
+
return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
79
|
+
}
|
|
80
|
+
return "light";
|
|
81
|
+
}
|
|
82
|
+
var _contextUnsub, _accumulatorUnsub, _NavWidgetLit_instances, subscribeRuntime_fn, unsubscribeRuntime_fn, getVisibleTips_fn, getResolvedTheme_fn, handleToggle_fn, handleNavigate_fn, handleFocusAnchor_fn, publishEvent_fn, renderTipItem_fn;
|
|
83
|
+
var NavWidgetLit = class extends LitElement {
|
|
84
|
+
constructor() {
|
|
85
|
+
super(...arguments);
|
|
86
|
+
__privateAdd(this, _NavWidgetLit_instances);
|
|
87
|
+
// ---------- Public properties --------------------------------------------
|
|
88
|
+
this.config = { expandBehavior: "single", theme: "auto", actions: [] };
|
|
89
|
+
this.runtime = void 0;
|
|
90
|
+
this.instanceId = "nav-widget";
|
|
91
|
+
// ---------- Internal state -----------------------------------------------
|
|
92
|
+
/** @internal */
|
|
93
|
+
this._expandedIds = /* @__PURE__ */ new Set();
|
|
94
|
+
/** @internal */
|
|
95
|
+
this._renderTick = 0;
|
|
96
|
+
/** @internal */
|
|
97
|
+
this._hoveredId = null;
|
|
98
|
+
// ---------- Private subscriptions ----------------------------------------
|
|
99
|
+
__privateAdd(this, _contextUnsub, null);
|
|
100
|
+
__privateAdd(this, _accumulatorUnsub, null);
|
|
101
|
+
}
|
|
102
|
+
// ---------- No shadow DOM — inherit host CSS variables --------------------
|
|
103
|
+
createRenderRoot() {
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
// ---------- Lifecycle: connectedCallback ---------------------------------
|
|
107
|
+
connectedCallback() {
|
|
108
|
+
super.connectedCallback();
|
|
109
|
+
__privateMethod(this, _NavWidgetLit_instances, subscribeRuntime_fn).call(this);
|
|
110
|
+
}
|
|
111
|
+
// ---------- Lifecycle: disconnectedCallback ------------------------------
|
|
112
|
+
disconnectedCallback() {
|
|
113
|
+
super.disconnectedCallback();
|
|
114
|
+
__privateMethod(this, _NavWidgetLit_instances, unsubscribeRuntime_fn).call(this);
|
|
115
|
+
}
|
|
116
|
+
// ---------- Lifecycle: updated -------------------------------------------
|
|
117
|
+
updated(changed) {
|
|
118
|
+
if (changed.has("runtime")) {
|
|
119
|
+
__privateMethod(this, _NavWidgetLit_instances, unsubscribeRuntime_fn).call(this);
|
|
120
|
+
__privateMethod(this, _NavWidgetLit_instances, subscribeRuntime_fn).call(this);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// ---------- Render --------------------------------------------------------
|
|
124
|
+
render() {
|
|
125
|
+
const visibleTips = __privateMethod(this, _NavWidgetLit_instances, getVisibleTips_fn).call(this);
|
|
126
|
+
const theme = __privateMethod(this, _NavWidgetLit_instances, getResolvedTheme_fn).call(this);
|
|
127
|
+
const containerStyle = styleMap({
|
|
128
|
+
fontFamily: "var(--sc-font-family, system-ui, -apple-system, sans-serif)",
|
|
129
|
+
maxWidth: "100%",
|
|
130
|
+
overflow: "hidden",
|
|
131
|
+
backgroundColor: "transparent",
|
|
132
|
+
color: "inherit"
|
|
27
133
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
behavior: action.behavior ?? 'smooth',
|
|
134
|
+
const accordionStyle = styleMap({
|
|
135
|
+
display: "flex",
|
|
136
|
+
flexDirection: "column",
|
|
137
|
+
gap: "var(--sc-content-item-gap, 6px)"
|
|
33
138
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
139
|
+
const categoryHeaderStyle = styleMap({
|
|
140
|
+
fontSize: "var(--sc-content-category-font-size, 12px)",
|
|
141
|
+
fontWeight: "600",
|
|
142
|
+
textTransform: "uppercase",
|
|
143
|
+
letterSpacing: "0.05em",
|
|
144
|
+
padding: "var(--sc-content-category-padding, 8px 4px 4px 4px)",
|
|
145
|
+
color: theme === "dark" ? TOKEN_SLATE_GREY_8 : TOKEN_SLATE_GREY_7
|
|
146
|
+
});
|
|
147
|
+
const emptyStateStyle = styleMap({
|
|
148
|
+
fontSize: "13px",
|
|
149
|
+
padding: "16px",
|
|
150
|
+
textAlign: "center",
|
|
151
|
+
color: theme === "dark" ? TOKEN_SLATE_GREY_7 : TOKEN_SLATE_GREY_8
|
|
152
|
+
});
|
|
153
|
+
if (visibleTips.length === 0) {
|
|
154
|
+
return html`
|
|
155
|
+
<div
|
|
156
|
+
style=${containerStyle}
|
|
157
|
+
data-adaptive-id=${this.instanceId}
|
|
158
|
+
data-adaptive-type="adaptive-nav"
|
|
159
|
+
>
|
|
160
|
+
<div style=${emptyStateStyle}>
|
|
161
|
+
You're all set for now! We'll share helpful tips here when they're relevant to what
|
|
162
|
+
you're doing.
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
const categoryGroups = /* @__PURE__ */ new Map();
|
|
168
|
+
for (const tip of visibleTips) {
|
|
169
|
+
const cat = tip.config.category;
|
|
170
|
+
if (!categoryGroups.has(cat)) {
|
|
171
|
+
categoryGroups.set(cat, []);
|
|
172
|
+
}
|
|
173
|
+
categoryGroups.get(cat).push(tip);
|
|
174
|
+
}
|
|
175
|
+
const hasCategories = visibleTips.some((t) => t.config.category);
|
|
176
|
+
return html`
|
|
177
|
+
<div
|
|
178
|
+
style=${containerStyle}
|
|
179
|
+
data-adaptive-id=${this.instanceId}
|
|
180
|
+
data-adaptive-type="adaptive-nav"
|
|
181
|
+
>
|
|
182
|
+
<div style=${accordionStyle}>
|
|
183
|
+
${hasCategories ? Array.from(categoryGroups.entries()).map(
|
|
184
|
+
([category, items]) => html`
|
|
185
|
+
${category ? html`<div style=${categoryHeaderStyle} data-category-header=${category}>${category}</div>` : nothing}
|
|
186
|
+
${items.map((tip, idx) => __privateMethod(this, _NavWidgetLit_instances, renderTipItem_fn).call(this, tip, idx, items.length))}
|
|
187
|
+
`
|
|
188
|
+
) : visibleTips.map((tip, idx) => __privateMethod(this, _NavWidgetLit_instances, renderTipItem_fn).call(this, tip, idx, visibleTips.length))}
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
_contextUnsub = new WeakMap();
|
|
195
|
+
_accumulatorUnsub = new WeakMap();
|
|
196
|
+
_NavWidgetLit_instances = new WeakSet();
|
|
197
|
+
// ---------- Runtime subscriptions ----------------------------------------
|
|
198
|
+
subscribeRuntime_fn = function() {
|
|
199
|
+
if (!this.runtime) return;
|
|
200
|
+
__privateSet(this, _contextUnsub, this.runtime.context.subscribe(() => {
|
|
201
|
+
this._renderTick += 1;
|
|
202
|
+
}));
|
|
203
|
+
if (this.runtime.accumulator?.subscribe) {
|
|
204
|
+
__privateSet(this, _accumulatorUnsub, this.runtime.accumulator.subscribe(() => {
|
|
205
|
+
this._renderTick += 1;
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
39
208
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// Next.js �� window.next.router.push() triggers App Router navigation
|
|
54
|
-
// with RSC fetch, layout preservation, and loading states
|
|
209
|
+
unsubscribeRuntime_fn = function() {
|
|
210
|
+
var _a, _b;
|
|
211
|
+
(_a = __privateGet(this, _contextUnsub)) == null ? void 0 : _a.call(this);
|
|
212
|
+
__privateSet(this, _contextUnsub, null);
|
|
213
|
+
(_b = __privateGet(this, _accumulatorUnsub)) == null ? void 0 : _b.call(this);
|
|
214
|
+
__privateSet(this, _accumulatorUnsub, null);
|
|
215
|
+
};
|
|
216
|
+
// ---------- Computed helpers (called on each render) ---------------------
|
|
217
|
+
getVisibleTips_fn = function() {
|
|
218
|
+
void this._renderTick;
|
|
219
|
+
if (!this.runtime) return this.config.actions;
|
|
220
|
+
return this.config.actions.filter((tip) => {
|
|
221
|
+
if (!tip.triggerWhen) return true;
|
|
55
222
|
try {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
223
|
+
const result = this.runtime.evaluateSync(tip.triggerWhen);
|
|
224
|
+
return result.value;
|
|
225
|
+
} catch {
|
|
226
|
+
return false;
|
|
61
227
|
}
|
|
62
|
-
|
|
63
|
-
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
getResolvedTheme_fn = function() {
|
|
231
|
+
return resolveTheme(this.config.theme);
|
|
232
|
+
};
|
|
233
|
+
// ---------- Event handlers -----------------------------------------------
|
|
234
|
+
handleToggle_fn = function(id) {
|
|
235
|
+
const wasExpanded = this._expandedIds.has(id);
|
|
236
|
+
let next;
|
|
237
|
+
if (this.config.expandBehavior === "single") {
|
|
238
|
+
for (const prevId of this._expandedIds) {
|
|
239
|
+
if (prevId !== id) {
|
|
240
|
+
__privateMethod(this, _NavWidgetLit_instances, publishEvent_fn).call(this, "nav:toggled", {
|
|
241
|
+
tipId: prevId,
|
|
242
|
+
expanded: false
|
|
243
|
+
});
|
|
244
|
+
}
|
|
64
245
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
246
|
+
next = wasExpanded ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([id]);
|
|
247
|
+
} else {
|
|
248
|
+
next = new Set(this._expandedIds);
|
|
249
|
+
if (wasExpanded) {
|
|
250
|
+
next.delete(id);
|
|
251
|
+
} else {
|
|
252
|
+
next.add(id);
|
|
73
253
|
}
|
|
74
|
-
|
|
75
|
-
|
|
254
|
+
}
|
|
255
|
+
__privateMethod(this, _NavWidgetLit_instances, publishEvent_fn).call(this, "nav:toggled", {
|
|
256
|
+
tipId: id,
|
|
257
|
+
expanded: !wasExpanded
|
|
258
|
+
});
|
|
259
|
+
this._expandedIds = next;
|
|
260
|
+
};
|
|
261
|
+
handleNavigate_fn = function(href, external) {
|
|
262
|
+
const normalized = href.trim().toLowerCase();
|
|
263
|
+
if (normalized.startsWith("javascript:") || normalized.startsWith("data:")) return;
|
|
264
|
+
__privateMethod(this, _NavWidgetLit_instances, publishEvent_fn).call(this, "nav:tip_clicked", { href, external });
|
|
265
|
+
this.dispatchEvent(
|
|
266
|
+
new CustomEvent("nav-tip-clicked", {
|
|
267
|
+
bubbles: true,
|
|
268
|
+
detail: { href, external, instanceId: this.instanceId }
|
|
269
|
+
})
|
|
270
|
+
);
|
|
271
|
+
const target = resolveNavTarget({
|
|
272
|
+
href,
|
|
273
|
+
external,
|
|
274
|
+
windowOrigin: typeof window !== "undefined" ? window.location.origin : "",
|
|
275
|
+
isIframe: detectIsIframe()
|
|
276
|
+
});
|
|
277
|
+
if (target.kind === "open") {
|
|
278
|
+
window.open(target.url, "_blank", "noopener,noreferrer");
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (target.kind === "fullnav") {
|
|
282
|
+
window.location.href = target.url;
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
target.url.search = window.location.search;
|
|
286
|
+
if (!navigateWithFrameworkRouter(target.url.toString())) {
|
|
287
|
+
window.history.pushState(null, "", target.url.toString());
|
|
288
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
handleFocusAnchor_fn = function(anchor) {
|
|
292
|
+
const el = document.querySelector(anchor.selector);
|
|
293
|
+
if (!(el instanceof HTMLElement)) return;
|
|
294
|
+
__privateMethod(this, _NavWidgetLit_instances, publishEvent_fn).call(this, "nav:tip_focused", {
|
|
295
|
+
selector: anchor.selector,
|
|
296
|
+
route: anchor.route
|
|
297
|
+
});
|
|
298
|
+
this.dispatchEvent(
|
|
299
|
+
new CustomEvent("nav-tip-focused", {
|
|
300
|
+
bubbles: true,
|
|
301
|
+
detail: { selector: anchor.selector, instanceId: this.instanceId }
|
|
302
|
+
})
|
|
303
|
+
);
|
|
304
|
+
el.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
305
|
+
pulseElement(el);
|
|
306
|
+
setTimeout(() => el.focus(), 400);
|
|
307
|
+
};
|
|
308
|
+
publishEvent_fn = function(name, props) {
|
|
309
|
+
this.runtime?.events.publish(name, {
|
|
310
|
+
instanceId: this.instanceId,
|
|
311
|
+
timestamp: Date.now(),
|
|
312
|
+
...props
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
// ---------- Tip item rendering -------------------------------------------
|
|
316
|
+
renderTipItem_fn = function(tip, index, total) {
|
|
317
|
+
const { id, title, description, href, icon, external, anchor, category: _cat } = tip.config;
|
|
318
|
+
const isExpanded = this._expandedIds.has(id);
|
|
319
|
+
const isLast = index === total - 1;
|
|
320
|
+
const isHovered = this._hoveredId === id;
|
|
321
|
+
const theme = __privateMethod(this, _NavWidgetLit_instances, getResolvedTheme_fn).call(this);
|
|
322
|
+
const effectiveHref = anchor ? Array.isArray(anchor.route) ? anchor.route[0] : anchor.route : href;
|
|
323
|
+
const isSamePage = anchor ? routeMatchesCurrent(Array.isArray(anchor.route) ? anchor.route : [anchor.route]) : effectiveHref ? routeMatchesCurrent([effectiveHref]) : false;
|
|
324
|
+
const hasSelector = anchor?.selector && anchor.selector !== "*";
|
|
325
|
+
const isFocusAction = isSamePage && hasSelector;
|
|
326
|
+
const hasAction = !!effectiveHref || isFocusAction;
|
|
327
|
+
const ctaLabel = isFocusAction ? "Focus \u2192" : external ? "Go \u2197" : "Go \u2192";
|
|
328
|
+
const itemStyle = styleMap({
|
|
329
|
+
borderRadius: "var(--sc-content-border-radius, 8px)",
|
|
330
|
+
overflow: "hidden",
|
|
331
|
+
transition: "box-shadow 0.2s ease",
|
|
332
|
+
backgroundColor: "var(--sc-content-background)",
|
|
333
|
+
border: "var(--sc-content-border)",
|
|
334
|
+
...isExpanded ? {
|
|
335
|
+
boxShadow: theme === "dark" ? "0 4px 12px rgba(0, 0, 0, 0.15)" : "0 4px 12px rgba(0, 0, 0, 0.08)"
|
|
336
|
+
} : {},
|
|
337
|
+
...!isLast ? { borderBottom: "var(--sc-content-item-divider, none)" } : {}
|
|
338
|
+
});
|
|
339
|
+
const headerStyle = styleMap({
|
|
340
|
+
display: "flex",
|
|
341
|
+
alignItems: "center",
|
|
342
|
+
gap: "8px",
|
|
343
|
+
width: "100%",
|
|
344
|
+
padding: "var(--sc-content-item-padding, 12px 16px)",
|
|
345
|
+
border: "none",
|
|
346
|
+
cursor: "pointer",
|
|
347
|
+
fontSize: "var(--sc-content-item-font-size, 15px)",
|
|
348
|
+
fontWeight: "500",
|
|
349
|
+
fontFamily: "inherit",
|
|
350
|
+
textAlign: "left",
|
|
351
|
+
transition: "background-color 0.15s ease",
|
|
352
|
+
backgroundColor: isHovered ? "var(--sc-content-background-hover)" : "transparent",
|
|
353
|
+
color: "var(--sc-content-text-color)"
|
|
354
|
+
});
|
|
355
|
+
const chevronStyle = styleMap({
|
|
356
|
+
fontSize: "20px",
|
|
357
|
+
transition: "transform 0.2s ease",
|
|
358
|
+
marginLeft: "auto",
|
|
359
|
+
flexShrink: "0",
|
|
360
|
+
color: "var(--sc-content-chevron-color, currentColor)",
|
|
361
|
+
transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)"
|
|
362
|
+
});
|
|
363
|
+
const bodyStyle = styleMap({
|
|
364
|
+
overflow: "hidden",
|
|
365
|
+
transition: "max-height 0.25s ease, padding-bottom 0.25s ease",
|
|
366
|
+
padding: "var(--sc-content-body-padding, 0 16px 12px 16px)",
|
|
367
|
+
color: "var(--sc-content-text-secondary-color)",
|
|
368
|
+
maxHeight: isExpanded ? "500px" : "0",
|
|
369
|
+
paddingBottom: isExpanded ? "16px" : "0"
|
|
370
|
+
});
|
|
371
|
+
const descriptionStyle = styleMap({
|
|
372
|
+
fontSize: "var(--sc-content-body-font-size, 14px)",
|
|
373
|
+
lineHeight: "1.5",
|
|
374
|
+
margin: "0"
|
|
375
|
+
});
|
|
376
|
+
const linkButtonStyle = styleMap({
|
|
377
|
+
display: "inline-flex",
|
|
378
|
+
alignItems: "center",
|
|
379
|
+
gap: "4px",
|
|
380
|
+
marginTop: "10px",
|
|
381
|
+
padding: "6px 12px",
|
|
382
|
+
borderRadius: "6px",
|
|
383
|
+
textDecoration: "none",
|
|
384
|
+
fontSize: "13px",
|
|
385
|
+
fontWeight: "500",
|
|
386
|
+
cursor: "pointer",
|
|
387
|
+
border: "none",
|
|
388
|
+
transition: "background-color 0.15s ease",
|
|
389
|
+
backgroundColor: `var(--sc-color-primary, ${TOKEN_PURPLE_4})`,
|
|
390
|
+
color: "#ffffff"
|
|
391
|
+
});
|
|
392
|
+
const iconStyle = styleMap({
|
|
393
|
+
fontSize: "16px",
|
|
394
|
+
flexShrink: "0"
|
|
395
|
+
});
|
|
396
|
+
const onLinkClick = (e) => {
|
|
397
|
+
e.preventDefault();
|
|
398
|
+
e.stopPropagation();
|
|
399
|
+
if (isFocusAction && anchor) {
|
|
400
|
+
__privateMethod(this, _NavWidgetLit_instances, handleFocusAnchor_fn).call(this, anchor);
|
|
401
|
+
} else if (effectiveHref) {
|
|
402
|
+
__privateMethod(this, _NavWidgetLit_instances, handleNavigate_fn).call(this, effectiveHref, external ?? false);
|
|
76
403
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
404
|
+
};
|
|
405
|
+
return html`
|
|
406
|
+
<div
|
|
407
|
+
style=${itemStyle}
|
|
408
|
+
data-nav-tip-id=${id}
|
|
409
|
+
>
|
|
410
|
+
<button
|
|
411
|
+
type="button"
|
|
412
|
+
style=${headerStyle}
|
|
413
|
+
aria-expanded=${isExpanded}
|
|
414
|
+
@click=${() => __privateMethod(this, _NavWidgetLit_instances, handleToggle_fn).call(this, id)}
|
|
415
|
+
@mouseenter=${() => {
|
|
416
|
+
this._hoveredId = id;
|
|
417
|
+
}}
|
|
418
|
+
@mouseleave=${() => {
|
|
419
|
+
this._hoveredId = null;
|
|
420
|
+
}}
|
|
421
|
+
>
|
|
422
|
+
${icon ? html`<span style=${iconStyle}>${unsafeHTML(renderIcon2(icon))}</span>` : nothing}
|
|
423
|
+
<span>${title}</span>
|
|
424
|
+
<span style=${chevronStyle}>${"\u203A"}</span>
|
|
425
|
+
</button>
|
|
426
|
+
<div style=${bodyStyle} aria-hidden=${!isExpanded}>
|
|
427
|
+
<p style=${descriptionStyle}>${description}</p>
|
|
428
|
+
${hasAction ? html`
|
|
429
|
+
<a
|
|
430
|
+
href=${effectiveHref || "#"}
|
|
431
|
+
style=${linkButtonStyle}
|
|
432
|
+
target=${external ? "_blank" : nothing}
|
|
433
|
+
rel=${external ? "noopener noreferrer" : nothing}
|
|
434
|
+
@click=${onLinkClick}
|
|
435
|
+
>${ctaLabel}</a>
|
|
436
|
+
` : nothing}
|
|
437
|
+
</div>
|
|
438
|
+
</div>
|
|
439
|
+
`;
|
|
440
|
+
};
|
|
441
|
+
// ---------- Reactive properties (no decorators) --------------------------
|
|
442
|
+
NavWidgetLit.properties = {
|
|
443
|
+
// Public inputs
|
|
444
|
+
config: { attribute: false },
|
|
445
|
+
runtime: { attribute: false },
|
|
446
|
+
instanceId: { type: String },
|
|
447
|
+
// Internal reactive state
|
|
448
|
+
_expandedIds: { state: true },
|
|
449
|
+
_renderTick: { state: true },
|
|
450
|
+
_hoveredId: { state: true }
|
|
451
|
+
};
|
|
452
|
+
var TAG_NAME = "syntro-nav-tips";
|
|
453
|
+
function registerNavWidgetLit() {
|
|
454
|
+
if (typeof window === "undefined") return;
|
|
455
|
+
if (!customElements.get(TAG_NAME)) {
|
|
456
|
+
customElements.define(TAG_NAME, NavWidgetLit);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// src/runtime.ts
|
|
461
|
+
var executeScrollTo = async (action, context) => {
|
|
462
|
+
const anchorEl = context.resolveAnchor(action.anchorId);
|
|
463
|
+
if (!anchorEl) {
|
|
464
|
+
console.error(
|
|
465
|
+
`[adaptive-nav] Anchor not found for scrollTo, skipping: ${action.anchorId.selector}`
|
|
466
|
+
);
|
|
467
|
+
return { cleanup: () => {
|
|
468
|
+
} };
|
|
469
|
+
}
|
|
470
|
+
anchorEl.scrollIntoView({
|
|
471
|
+
behavior: action.behavior ?? "smooth",
|
|
472
|
+
block: action.block ?? "center",
|
|
473
|
+
inline: action.inline ?? "nearest"
|
|
474
|
+
});
|
|
475
|
+
context.publishEvent("action.applied", {
|
|
476
|
+
id: context.generateId(),
|
|
477
|
+
kind: "navigation:scrollTo",
|
|
478
|
+
anchorId: action.anchorId,
|
|
479
|
+
behavior: action.behavior ?? "smooth"
|
|
480
|
+
});
|
|
481
|
+
return {
|
|
482
|
+
cleanup: () => {
|
|
82
483
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
function navigateWithFrameworkRouter(url) {
|
|
487
|
+
if (typeof window === "undefined") return false;
|
|
488
|
+
const w = window;
|
|
489
|
+
try {
|
|
490
|
+
const nextRouter = w.next?.router;
|
|
491
|
+
if (nextRouter?.push) {
|
|
492
|
+
nextRouter.push(url);
|
|
493
|
+
return true;
|
|
87
494
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
495
|
+
} catch {
|
|
496
|
+
}
|
|
497
|
+
try {
|
|
498
|
+
if (w.$nuxt?.$router?.push) {
|
|
499
|
+
w.$nuxt.$router.push(url);
|
|
500
|
+
return true;
|
|
92
501
|
}
|
|
93
|
-
|
|
502
|
+
} catch {
|
|
503
|
+
}
|
|
504
|
+
if (w.ng || w.getAllAngularRootElements || document.querySelector("[ng-version]")) {
|
|
505
|
+
window.location.href = url;
|
|
506
|
+
return true;
|
|
507
|
+
}
|
|
508
|
+
if (w.__SVELTEKIT_DATA__ || document.body?.hasAttribute("data-sveltekit")) {
|
|
509
|
+
window.location.href = url;
|
|
510
|
+
return true;
|
|
511
|
+
}
|
|
512
|
+
if (document.querySelector("[data-astro-transition-fallback]")) {
|
|
513
|
+
window.location.href = url;
|
|
514
|
+
return true;
|
|
515
|
+
}
|
|
516
|
+
return false;
|
|
94
517
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Check if a URL is same-origin as the current page.
|
|
97
|
-
* Relative URLs (e.g. "/dashboard") are always same-origin.
|
|
98
|
-
*/
|
|
99
518
|
function isSameOrigin(url) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
519
|
+
try {
|
|
520
|
+
const parsed = new URL(url, window.location.origin);
|
|
521
|
+
return parsed.origin === window.location.origin;
|
|
522
|
+
} catch {
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
108
525
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
window.open(url, '_blank', 'noopener,noreferrer');
|
|
526
|
+
var executeNavigate = async (action, context) => {
|
|
527
|
+
const url = action.url.trim();
|
|
528
|
+
if (url.toLowerCase().startsWith("javascript:")) {
|
|
529
|
+
throw new Error("javascript: URLs are not allowed");
|
|
530
|
+
}
|
|
531
|
+
const target = action.target ?? "_self";
|
|
532
|
+
context.publishEvent("action.applied", {
|
|
533
|
+
id: context.generateId(),
|
|
534
|
+
kind: "navigation:navigate",
|
|
535
|
+
url: action.url,
|
|
536
|
+
target
|
|
537
|
+
});
|
|
538
|
+
if (target === "_blank") {
|
|
539
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
540
|
+
} else if (!action.forceFullNavigation && isSameOrigin(url)) {
|
|
541
|
+
if (!navigateWithFrameworkRouter(url)) {
|
|
542
|
+
window.history.pushState(null, "", url);
|
|
543
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
128
544
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
window.dispatchEvent(new PopStateEvent('popstate'));
|
|
135
|
-
}
|
|
545
|
+
} else {
|
|
546
|
+
window.location.href = url;
|
|
547
|
+
}
|
|
548
|
+
return {
|
|
549
|
+
cleanup: () => {
|
|
136
550
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
var NavWidgetLitMountable = {
|
|
554
|
+
mount(container, config) {
|
|
555
|
+
registerNavWidgetLit();
|
|
556
|
+
const el = document.createElement("syntro-nav-tips");
|
|
557
|
+
const {
|
|
558
|
+
runtime: runtime2,
|
|
559
|
+
instanceId = "nav-widget",
|
|
560
|
+
...navConfig
|
|
561
|
+
} = config ?? {
|
|
562
|
+
expandBehavior: "single",
|
|
563
|
+
theme: "auto",
|
|
564
|
+
actions: []
|
|
145
565
|
};
|
|
566
|
+
Object.assign(el, {
|
|
567
|
+
config: navConfig,
|
|
568
|
+
runtime: runtime2,
|
|
569
|
+
instanceId
|
|
570
|
+
});
|
|
571
|
+
container.appendChild(el);
|
|
572
|
+
return () => el.remove();
|
|
573
|
+
}
|
|
146
574
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* NavWidgetLitMountable — Mounts the `<syntro-nav-tips>` Lit web component.
|
|
152
|
-
*
|
|
153
|
-
* Drop-in companion to NavMountableWidget that avoids React/ReactDOM entirely.
|
|
154
|
-
* Self-registers the custom element on first use.
|
|
155
|
-
*/
|
|
156
|
-
export const NavWidgetLitMountable = {
|
|
157
|
-
mount(container, config) {
|
|
158
|
-
registerNavWidgetLit();
|
|
159
|
-
const el = document.createElement('syntro-nav-tips');
|
|
160
|
-
const { runtime, instanceId = 'nav-widget', ...navConfig } = config ?? {
|
|
161
|
-
expandBehavior: 'single',
|
|
162
|
-
theme: 'auto',
|
|
163
|
-
actions: [],
|
|
164
|
-
};
|
|
165
|
-
// Assign structured props as JS properties (not HTML attributes)
|
|
166
|
-
Object.assign(el, {
|
|
167
|
-
config: navConfig,
|
|
168
|
-
runtime,
|
|
169
|
-
instanceId,
|
|
170
|
-
});
|
|
171
|
-
container.appendChild(el);
|
|
172
|
-
return () => el.remove();
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
// ============================================================================
|
|
176
|
-
// Executor Definitions for Registration
|
|
177
|
-
// ============================================================================
|
|
178
|
-
/**
|
|
179
|
-
* All executors provided by this app.
|
|
180
|
-
* These are registered with the runtime's ExecutorRegistry.
|
|
181
|
-
*/
|
|
182
|
-
export const executors = [
|
|
183
|
-
{ kind: 'navigation:scrollTo', executor: executeScrollTo },
|
|
184
|
-
{ kind: 'navigation:navigate', executor: executeNavigate },
|
|
575
|
+
var executors = [
|
|
576
|
+
{ kind: "navigation:scrollTo", executor: executeScrollTo },
|
|
577
|
+
{ kind: "navigation:navigate", executor: executeNavigate }
|
|
185
578
|
];
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
};
|
|
241
|
-
export default runtime;
|
|
579
|
+
var runtime = {
|
|
580
|
+
id: "adaptive-nav",
|
|
581
|
+
version: "2.0.0",
|
|
582
|
+
name: "Navigation Tips",
|
|
583
|
+
description: "Navigation actions and accordion-based tips with per-item conditional visibility",
|
|
584
|
+
/**
|
|
585
|
+
* Navigation action executors (scrollTo, navigate).
|
|
586
|
+
*/
|
|
587
|
+
executors,
|
|
588
|
+
/**
|
|
589
|
+
* Widget definitions for the runtime's WidgetRegistry.
|
|
590
|
+
*/
|
|
591
|
+
widgets: [
|
|
592
|
+
{
|
|
593
|
+
id: "adaptive-nav:tips",
|
|
594
|
+
component: NavWidgetLitMountable,
|
|
595
|
+
metadata: {
|
|
596
|
+
name: "Navigation Tips",
|
|
597
|
+
description: "Accordion of contextual navigation tips with per-item visibility",
|
|
598
|
+
icon: "\u{1F9ED}"
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
],
|
|
602
|
+
/**
|
|
603
|
+
* Extract notify watcher entries from tile config props.
|
|
604
|
+
* The runtime evaluates these continuously (even with drawer closed)
|
|
605
|
+
* and publishes nav:tip_revealed when triggerWhen transitions false → true.
|
|
606
|
+
*/
|
|
607
|
+
notifyWatchers(props) {
|
|
608
|
+
const actions = props.actions ?? [];
|
|
609
|
+
return actions.filter((a) => a.notify && a.triggerWhen).map((a) => ({
|
|
610
|
+
id: `nav:${a.config.id}`,
|
|
611
|
+
strategy: a.triggerWhen,
|
|
612
|
+
eventName: "nav:tip_revealed",
|
|
613
|
+
eventProps: {
|
|
614
|
+
tipId: a.config.id,
|
|
615
|
+
title: a.notify.title,
|
|
616
|
+
body: a.notify.body,
|
|
617
|
+
icon: a.notify.icon
|
|
618
|
+
}
|
|
619
|
+
}));
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
var runtime_default = runtime;
|
|
623
|
+
export {
|
|
624
|
+
NavWidgetLitMountable,
|
|
625
|
+
runtime_default as default,
|
|
626
|
+
executeNavigate,
|
|
627
|
+
executeScrollTo,
|
|
628
|
+
executors,
|
|
629
|
+
navigateWithFrameworkRouter,
|
|
630
|
+
runtime
|
|
631
|
+
};
|
|
632
|
+
//# sourceMappingURL=runtime.js.map
|