@syntrologie/adapt-nav 2.15.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 -476
- 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/editor.js
CHANGED
|
@@ -1,326 +1,323 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { isOwnAction, } from './types';
|
|
1
|
+
import "./chunk-HMLY7DHA.js";
|
|
2
|
+
|
|
3
|
+
// src/editor.ts
|
|
4
|
+
import { html, LitElement, nothing } from "lit";
|
|
5
|
+
|
|
6
|
+
// src/summarize.ts
|
|
7
|
+
var MAX_TITLE_LEN = 30;
|
|
8
|
+
function truncate(text, max) {
|
|
9
|
+
if (text.length <= max) return text;
|
|
10
|
+
return `${text.slice(0, max).trimEnd()}...`;
|
|
11
|
+
}
|
|
13
12
|
function isRuleStrategy(s) {
|
|
14
|
-
|
|
15
|
-
s !== null &&
|
|
16
|
-
s.type === 'rules' &&
|
|
17
|
-
Array.isArray(s.rules));
|
|
13
|
+
return typeof s === "object" && s !== null && s.type === "rules" && Array.isArray(s.rules);
|
|
18
14
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
for (const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
anchorSelectors.add(c.anchorId);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
15
|
+
function describeTrigger(triggerWhen) {
|
|
16
|
+
if (!triggerWhen) return "All pages";
|
|
17
|
+
if (!isRuleStrategy(triggerWhen)) return "All pages";
|
|
18
|
+
const pages = [];
|
|
19
|
+
const anchors = [];
|
|
20
|
+
for (const rule of triggerWhen.rules) {
|
|
21
|
+
for (const condition of rule.conditions) {
|
|
22
|
+
if (condition.type === "page_url" && typeof condition.url === "string") {
|
|
23
|
+
pages.push(condition.url);
|
|
24
|
+
}
|
|
25
|
+
if (condition.type === "anchor_visible" && typeof condition.anchorId === "string") {
|
|
26
|
+
anchors.push(condition.anchorId);
|
|
27
|
+
}
|
|
35
28
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
29
|
+
}
|
|
30
|
+
const parts = [];
|
|
31
|
+
if (pages.length > 0) parts.push(pages[0]);
|
|
32
|
+
if (anchors.length > 0) parts.push(anchors[0]);
|
|
33
|
+
return parts.length > 0 ? parts.join(" \xB7 ") : "All pages";
|
|
42
34
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
function summarizeNavItem(item) {
|
|
36
|
+
const icon = item.config.icon || "\u{1F9ED}";
|
|
37
|
+
const title = truncate(item.config.title, MAX_TITLE_LEN);
|
|
38
|
+
return `${icon} ${title}`;
|
|
46
39
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
|
|
41
|
+
// src/types.ts
|
|
42
|
+
var ACTION_NAMESPACES = ["nav", "navigation"];
|
|
43
|
+
function isOwnAction(action) {
|
|
44
|
+
return ACTION_NAMESPACES.some((ns) => action.kind.startsWith(`${ns}:`));
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
|
|
47
|
+
// src/editor.ts
|
|
48
|
+
var isRuleStrategy2 = (s) => typeof s === "object" && s !== null && s.type === "rules" && Array.isArray(s.rules);
|
|
49
|
+
var extractFirstPage = (triggerWhen) => {
|
|
50
|
+
if (!triggerWhen || !isRuleStrategy2(triggerWhen)) return null;
|
|
51
|
+
for (const rule of triggerWhen.rules) {
|
|
52
|
+
for (const cond of rule.conditions) {
|
|
53
|
+
const c = cond;
|
|
54
|
+
if (c.type === "page_url" && typeof c.url === "string") return c.url;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
};
|
|
59
|
+
var extractFirstAnchor = (triggerWhen) => {
|
|
60
|
+
if (!triggerWhen || !isRuleStrategy2(triggerWhen)) return null;
|
|
61
|
+
for (const rule of triggerWhen.rules) {
|
|
62
|
+
for (const cond of rule.conditions) {
|
|
63
|
+
const c = cond;
|
|
64
|
+
if (c.type === "anchor_visible" && typeof c.anchorId === "string") return c.anchorId;
|
|
58
65
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
firstAnchor: extractFirstAnchor(tip.triggerWhen),
|
|
69
|
-
tip,
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
function filterConfig(config, dismissedKeys) {
|
|
73
|
-
const ownActions = (config.actions || []).filter(isOwnAction);
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
};
|
|
69
|
+
var flattenItems = (config) => {
|
|
70
|
+
const actions = (config.actions || []).filter(isOwnAction);
|
|
71
|
+
return actions.map((tip, i) => {
|
|
72
|
+
const tipAnchor = tip.kind === "nav:tip" ? tip.config.anchor?.selector : void 0;
|
|
73
|
+
const rawRoute = tip.kind === "nav:tip" ? tip.config.anchor?.route : void 0;
|
|
74
|
+
const tipRoute = typeof rawRoute === "string" ? rawRoute : void 0;
|
|
74
75
|
return {
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
key: String(i),
|
|
77
|
+
index: i,
|
|
78
|
+
summary: summarizeNavItem(tip),
|
|
79
|
+
trigger: describeTrigger(tip.triggerWhen),
|
|
80
|
+
rationale: tip.rationale?.why,
|
|
81
|
+
firstAnchor: tipAnchor || extractFirstAnchor(tip.triggerWhen),
|
|
82
|
+
firstPage: tipRoute || extractFirstPage(tip.triggerWhen),
|
|
83
|
+
tip
|
|
77
84
|
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
setDetectionMap(map);
|
|
118
|
-
};
|
|
119
|
-
runDetection();
|
|
120
|
-
const interval = setInterval(runDetection, 2000);
|
|
121
|
-
window.addEventListener('popstate', runDetection);
|
|
122
|
-
return () => {
|
|
123
|
-
clearInterval(interval);
|
|
124
|
-
window.removeEventListener('popstate', runDetection);
|
|
125
|
-
};
|
|
126
|
-
}, [getCurrentRoute]);
|
|
127
|
-
return detectionMap;
|
|
128
|
-
}
|
|
129
|
-
// ============================================================================
|
|
130
|
-
// NavEditor Component
|
|
131
|
-
// ============================================================================
|
|
132
|
-
export function NavEditor({ config, onChange, editor }) {
|
|
133
|
-
const typedConfig = config;
|
|
134
|
-
const [dismissedKeys, setDismissedKeys] = useState(() => editor.getDismissedKeys?.() ?? new Set());
|
|
135
|
-
const [editingKey, setEditingKey] = useState(null);
|
|
136
|
-
const [_previewMode, setPreviewMode] = useState('after');
|
|
137
|
-
const [_hoveredKey, setHoveredKey] = useState(null);
|
|
138
|
-
// Sync dismissed keys back to navigation context on every change
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
editor.setDismissedKeys?.(dismissedKeys);
|
|
141
|
-
}, [dismissedKeys, editor]);
|
|
142
|
-
// React to global before/after toggle from the panel
|
|
143
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitted — adding config/typedConfig/previewConfig would cause infinite re-renders since previewConfig triggers state updates
|
|
144
|
-
useEffect(() => {
|
|
145
|
-
const mode = editor.previewMode;
|
|
146
|
-
if (!mode)
|
|
147
|
-
return;
|
|
148
|
-
if (mode === 'before') {
|
|
149
|
-
// Remove all nav tips — push a config with every item filtered out
|
|
150
|
-
const allKeys = new Set(flattenItems(typedConfig).map((item) => item.key));
|
|
151
|
-
const empty = filterConfig(typedConfig, allKeys);
|
|
152
|
-
editor.previewConfig(empty);
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
// Restore the full config
|
|
156
|
-
editor.previewConfig(config);
|
|
157
|
-
}
|
|
158
|
-
}, [editor.previewMode]);
|
|
159
|
-
// If navigated here with an editKey, jump directly to that item's edit view
|
|
160
|
-
const initialConsumed = useRef(false);
|
|
161
|
-
useEffect(() => {
|
|
162
|
-
if (!initialConsumed.current) {
|
|
163
|
-
initialConsumed.current = true;
|
|
164
|
-
if (editor.initialEditKey != null) {
|
|
165
|
-
setEditingKey(String(editor.initialEditKey));
|
|
166
|
-
}
|
|
167
|
-
editor.clearInitialState?.();
|
|
168
|
-
}
|
|
169
|
-
}, [editor]);
|
|
170
|
-
const allItems = flattenItems(typedConfig);
|
|
171
|
-
const activeItems = allItems.filter((item) => !dismissedKeys.has(item.key));
|
|
172
|
-
const dismissedItems = allItems.filter((item) => dismissedKeys.has(item.key));
|
|
173
|
-
const totalLinks = activeItems.length;
|
|
174
|
-
// Live triggerWhen status for condition diagnostics
|
|
175
|
-
const triggerWhenItems = useMemo(() => allItems.map((item) => ({
|
|
176
|
-
id: item.key,
|
|
177
|
-
triggerWhen: item.tip.triggerWhen,
|
|
178
|
-
})), [allItems]);
|
|
179
|
-
const triggerWhenStatuses = useTriggerWhenStatus(triggerWhenItems);
|
|
180
|
-
const detectionMap = useDetection(allItems, editor.getCurrentRoute);
|
|
181
|
-
const foundCount = activeItems.filter((item) => detectionMap.get(item.key)?.found).length;
|
|
182
|
-
const handleDismiss = useCallback((key) => {
|
|
183
|
-
setDismissedKeys((prev) => {
|
|
184
|
-
const next = new Set(prev);
|
|
185
|
-
next.add(key);
|
|
186
|
-
return next;
|
|
187
|
-
});
|
|
188
|
-
if (editingKey === key)
|
|
189
|
-
setEditingKey(null);
|
|
190
|
-
}, [editingKey]);
|
|
191
|
-
const handleRestore = useCallback((key) => {
|
|
192
|
-
setDismissedKeys((prev) => {
|
|
193
|
-
const next = new Set(prev);
|
|
194
|
-
next.delete(key);
|
|
195
|
-
return next;
|
|
196
|
-
});
|
|
197
|
-
}, []);
|
|
198
|
-
const handleCardBodyClick = useCallback((item) => {
|
|
199
|
-
setEditingKey(item.key);
|
|
200
|
-
}, []);
|
|
201
|
-
const handleTriggerClick = useCallback(async (item) => {
|
|
202
|
-
const pageUrl = extractFirstPage(item.tip.triggerWhen);
|
|
203
|
-
if (pageUrl) {
|
|
204
|
-
if (item.firstAnchor)
|
|
205
|
-
savePendingHighlight(item.firstAnchor);
|
|
206
|
-
await editor.navigateTo(pageUrl);
|
|
207
|
-
}
|
|
208
|
-
if (item.firstAnchor) {
|
|
209
|
-
editor.highlightElement(item.firstAnchor);
|
|
210
|
-
}
|
|
211
|
-
}, [editor]);
|
|
212
|
-
const handleBackToList = useCallback(() => {
|
|
213
|
-
setEditingKey(null);
|
|
214
|
-
setPreviewMode('after');
|
|
215
|
-
editor.previewConfig(config);
|
|
216
|
-
editor.clearHighlight();
|
|
217
|
-
}, [editor, config]);
|
|
218
|
-
// Register back handler in panel header when editing
|
|
219
|
-
useEffect(() => {
|
|
220
|
-
editor.setBackHandler?.(editingKey !== null ? handleBackToList : null);
|
|
221
|
-
return () => editor.setBackHandler?.(null);
|
|
222
|
-
}, [editingKey, handleBackToList, editor]);
|
|
223
|
-
const _handleBeforeAfter = useCallback((mode) => {
|
|
224
|
-
setPreviewMode(mode);
|
|
225
|
-
if (mode === 'before') {
|
|
226
|
-
const filtered = filterConfig(typedConfig, new Set([editingKey]));
|
|
227
|
-
editor.previewConfig(filtered);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
editor.previewConfig(config);
|
|
231
|
-
}
|
|
232
|
-
}, [typedConfig, editingKey, editor, config]);
|
|
233
|
-
const handleFieldChange = useCallback((index, field, value) => {
|
|
234
|
-
const ownActions = (typedConfig.actions || []).filter(isOwnAction).slice();
|
|
235
|
-
const link = { ...ownActions[index], config: { ...ownActions[index].config } };
|
|
236
|
-
link.config[field] = value;
|
|
237
|
-
ownActions[index] = link;
|
|
238
|
-
const otherActions = (typedConfig.actions || []).filter((a) => !isOwnAction(a));
|
|
239
|
-
const updated = { ...typedConfig, actions: [...otherActions, ...ownActions] };
|
|
240
|
-
onChange(updated);
|
|
241
|
-
editor.setDirty(true);
|
|
242
|
-
}, [typedConfig, onChange, editor]);
|
|
243
|
-
const _handlePublish = useCallback(() => {
|
|
244
|
-
if (dismissedKeys.size > 0) {
|
|
245
|
-
const filtered = filterConfig(typedConfig, dismissedKeys);
|
|
246
|
-
onChange(filtered);
|
|
247
|
-
}
|
|
248
|
-
editor.publish();
|
|
249
|
-
}, [dismissedKeys, typedConfig, onChange, editor]);
|
|
250
|
-
const handleBadgeClick = useCallback(async (item) => {
|
|
251
|
-
const detection = detectionMap.get(item.key);
|
|
252
|
-
if (detection?.found && item.firstAnchor) {
|
|
253
|
-
editor.highlightElement(item.firstAnchor);
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
const pageUrl = extractFirstPage(item.tip.triggerWhen);
|
|
257
|
-
if (pageUrl) {
|
|
258
|
-
if (item.firstAnchor)
|
|
259
|
-
savePendingHighlight(item.firstAnchor);
|
|
260
|
-
await editor.navigateTo(pageUrl);
|
|
261
|
-
if (item.firstAnchor)
|
|
262
|
-
editor.highlightElement(item.firstAnchor);
|
|
263
|
-
}
|
|
264
|
-
else if (item.firstAnchor) {
|
|
265
|
-
editor.highlightElement(item.firstAnchor);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}, [editor, detectionMap]);
|
|
269
|
-
const handleCardHover = useCallback((item) => {
|
|
270
|
-
setHoveredKey(item.key);
|
|
271
|
-
if (item.firstAnchor) {
|
|
272
|
-
editor.highlightElement(item.firstAnchor);
|
|
273
|
-
}
|
|
274
|
-
}, [editor]);
|
|
275
|
-
const handleCardLeave = useCallback(() => {
|
|
276
|
-
setHoveredKey(null);
|
|
277
|
-
editor.clearHighlight();
|
|
278
|
-
}, [editor]);
|
|
279
|
-
// ---- Edit form renderer ----
|
|
280
|
-
const renderEditFields = (index) => {
|
|
281
|
-
const actions = (typedConfig.actions || []).filter(isOwnAction);
|
|
282
|
-
const tip = actions[index];
|
|
283
|
-
if (!tip)
|
|
284
|
-
return null;
|
|
285
|
-
const item = allItems.find((it) => it.key === String(index));
|
|
286
|
-
return (_jsxs("div", { className: "se-py-1", children: [item && item.trigger !== 'All pages' && (_jsxs("button", { type: "button", "data-trigger": true, className: "se-flex se-items-center se-gap-1 se-text-[11px] se-text-slate-grey-8 se-cursor-pointer se-mb-1 se-border-none se-bg-transparent se-p-0 se-text-left", onClick: () => handleTriggerClick(item), children: [_jsx("span", { children: '\u{1f4cd}' }), _jsx("span", { children: item.trigger })] })), _jsx(EditorInput, { label: "Title", value: tip.config.title, onChange: (e) => handleFieldChange(index, 'title', e.target.value) }), _jsx(EditorInput, { label: "Description", value: tip.config.description, onChange: (e) => handleFieldChange(index, 'description', e.target.value) }), _jsx(EditorInput, { label: "Link URL", value: tip.config.href || '', onChange: (e) => handleFieldChange(index, 'href', e.target.value), placeholder: "Optional" }), _jsx(EditorInput, { label: "Icon", value: tip.config.icon || '', onChange: (e) => handleFieldChange(index, 'icon', e.target.value), placeholder: "e.g., \\u{1f9ed}" }), _jsx(EditorInput, { label: "Category", value: tip.config.category || '', onChange: (e) => handleFieldChange(index, 'category', e.target.value), placeholder: "Optional" }), _jsxs("label", { className: "se-flex se-items-center se-gap-2 se-text-xs se-text-slate-grey-8 se-mb-2", children: [_jsx("input", { type: "checkbox", checked: tip.config.external || false, onChange: (e) => handleFieldChange(index, 'external', e.target.checked) }), "Open in new tab"] }), _jsx("span", { className: "se-text-[11px] se-font-semibold se-text-slate-grey-7 se-mb-1 se-block", children: "AI Rationale" }), _jsx("div", { className: "se-p-2 se-rounded se-border se-border-dashed se-border-white/15 se-bg-white/[0.02] se-text-slate-grey-8 se-text-xs se-mb-2", children: tip.rationale ? tip.rationale.why : 'N/A' })] }));
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
var runDetection = (items) => {
|
|
88
|
+
const map = /* @__PURE__ */ new Map();
|
|
89
|
+
const currentPath = window.location.pathname;
|
|
90
|
+
for (const item of items) {
|
|
91
|
+
let pageMatch = true;
|
|
92
|
+
if (item.firstPage) {
|
|
93
|
+
const pattern = item.firstPage;
|
|
94
|
+
const regex = new RegExp(
|
|
95
|
+
`^${pattern.replace(/\*\*/g, ".*").replace(/(?<!\.)(\*)/g, "[^/]*")}$`
|
|
96
|
+
);
|
|
97
|
+
pageMatch = regex.test(currentPath);
|
|
98
|
+
}
|
|
99
|
+
let anchorFound = false;
|
|
100
|
+
if (item.firstAnchor) {
|
|
101
|
+
try {
|
|
102
|
+
anchorFound = document.querySelector(item.firstAnchor) !== null;
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
anchorFound = pageMatch;
|
|
107
|
+
}
|
|
108
|
+
map.set(item.key, { found: pageMatch && anchorFound });
|
|
109
|
+
}
|
|
110
|
+
return map;
|
|
111
|
+
};
|
|
112
|
+
var NavEditorLit = class extends LitElement {
|
|
113
|
+
constructor() {
|
|
114
|
+
super(...arguments);
|
|
115
|
+
this.config = null;
|
|
116
|
+
this.onChange = null;
|
|
117
|
+
this._editingKey = null;
|
|
118
|
+
this._detectionMap = /* @__PURE__ */ new Map();
|
|
119
|
+
this._detectionInterval = null;
|
|
120
|
+
this._onPopstate = () => this._runDetection();
|
|
121
|
+
this._runDetection = () => {
|
|
122
|
+
if (!this.config) return;
|
|
123
|
+
this._detectionMap = runDetection(flattenItems(this.config));
|
|
287
124
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
125
|
+
// ---- Actions ----
|
|
126
|
+
this._handleBack = () => {
|
|
127
|
+
if (this._editingKey !== null) {
|
|
128
|
+
this._editingKey = null;
|
|
129
|
+
} else {
|
|
130
|
+
this.dispatchEvent(new CustomEvent("navigate-home", { bubbles: true }));
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
this._handleItemClick = (key) => {
|
|
134
|
+
this._editingKey = key;
|
|
135
|
+
};
|
|
136
|
+
this._handleFieldChange = (index, field, value) => {
|
|
137
|
+
if (!this.config || !this.onChange) return;
|
|
138
|
+
const ownActions = (this.config.actions || []).filter(isOwnAction).slice();
|
|
139
|
+
const tip = { ...ownActions[index], config: { ...ownActions[index].config } };
|
|
140
|
+
tip.config[field] = value;
|
|
141
|
+
ownActions[index] = tip;
|
|
142
|
+
const otherActions = (this.config.actions || []).filter((a) => !isOwnAction(a));
|
|
143
|
+
const updated = { ...this.config, actions: [...otherActions, ...ownActions] };
|
|
144
|
+
this.onChange(updated);
|
|
145
|
+
this.dispatchEvent(new CustomEvent("dirty-change", { detail: { dirty: true }, bubbles: true }));
|
|
146
|
+
};
|
|
147
|
+
// ---- Render ----
|
|
148
|
+
this._handleBadgeClick = (item, e) => {
|
|
149
|
+
e.stopPropagation();
|
|
150
|
+
const href = item.tip.config.href;
|
|
151
|
+
if (!href) return;
|
|
152
|
+
window.history.pushState({}, "", href);
|
|
153
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
154
|
+
};
|
|
155
|
+
this._renderDetectionBadge = (item) => {
|
|
156
|
+
const detection = this._detectionMap.get(item.key);
|
|
157
|
+
const found = detection?.found ?? false;
|
|
158
|
+
if (found) {
|
|
159
|
+
return html`<button type="button"
|
|
160
|
+
title="Click to scroll to element"
|
|
161
|
+
@click=${(e) => this._handleBadgeClick(item, e)}
|
|
162
|
+
class="se-shrink-0 se-w-2 se-h-2 se-rounded-full se-border-none se-cursor-pointer"
|
|
163
|
+
style="background:#22c55e"
|
|
164
|
+
></button>`;
|
|
165
|
+
}
|
|
166
|
+
return html`<button type="button"
|
|
167
|
+
title="Click to navigate to page"
|
|
168
|
+
@click=${(e) => this._handleBadgeClick(item, e)}
|
|
169
|
+
class="se-shrink-0 se-w-2 se-h-2 se-rounded-full se-border-none se-cursor-pointer"
|
|
170
|
+
style="background:#ef4444"
|
|
171
|
+
></button>`;
|
|
172
|
+
};
|
|
173
|
+
this._renderEditMode = (item) => {
|
|
174
|
+
const tip = item.tip;
|
|
175
|
+
return html`
|
|
176
|
+
<div class="se-py-1">
|
|
177
|
+
<div class="se-flex se-items-center se-gap-2 se-mb-3 se-text-[13px] se-font-semibold se-text-text-primary">
|
|
178
|
+
<span>🧭</span>
|
|
179
|
+
<span>${item.summary}</span>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<div class="se-mb-3">
|
|
183
|
+
<label class="se-text-[11px] se-font-semibold se-text-text-secondary se-mb-1 se-block">Title</label>
|
|
184
|
+
<input type="text" .value=${tip.config.title}
|
|
185
|
+
@input=${(e) => this._handleFieldChange(item.index, "title", e.target.value)}
|
|
186
|
+
class="se-w-full se-p-2 se-rounded se-border se-border-border-primary se-bg-input-field-bg se-text-text-primary se-text-sm" />
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<div class="se-mb-3">
|
|
190
|
+
<label class="se-text-[11px] se-font-semibold se-text-text-secondary se-mb-1 se-block">Description</label>
|
|
191
|
+
<input type="text" .value=${tip.config.description}
|
|
192
|
+
@input=${(e) => this._handleFieldChange(item.index, "description", e.target.value)}
|
|
193
|
+
class="se-w-full se-p-2 se-rounded se-border se-border-border-primary se-bg-input-field-bg se-text-text-primary se-text-sm" />
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div class="se-mb-3">
|
|
197
|
+
<label class="se-text-[11px] se-font-semibold se-text-text-secondary se-mb-1 se-block">Link URL</label>
|
|
198
|
+
<input type="text" .value=${tip.config.href || ""} placeholder="Optional"
|
|
199
|
+
@input=${(e) => this._handleFieldChange(item.index, "href", e.target.value)}
|
|
200
|
+
class="se-w-full se-p-2 se-rounded se-border se-border-border-primary se-bg-input-field-bg se-text-text-primary se-text-sm" />
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<div class="se-mb-3">
|
|
204
|
+
<label class="se-text-[11px] se-font-semibold se-text-text-secondary se-mb-1 se-block">Icon</label>
|
|
205
|
+
<input type="text" .value=${tip.config.icon || ""} placeholder="e.g., 🧭"
|
|
206
|
+
@input=${(e) => this._handleFieldChange(item.index, "icon", e.target.value)}
|
|
207
|
+
class="se-w-full se-p-2 se-rounded se-border se-border-border-primary se-bg-input-field-bg se-text-text-primary se-text-sm" />
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<div class="se-mb-3">
|
|
211
|
+
<label class="se-text-[11px] se-font-semibold se-text-text-secondary se-mb-1 se-block">Category</label>
|
|
212
|
+
<input type="text" .value=${tip.config.category || ""} placeholder="Optional"
|
|
213
|
+
@input=${(e) => this._handleFieldChange(item.index, "category", e.target.value)}
|
|
214
|
+
class="se-w-full se-p-2 se-rounded se-border se-border-border-primary se-bg-input-field-bg se-text-text-primary se-text-sm" />
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
${tip.rationale ? html`
|
|
218
|
+
<div>
|
|
219
|
+
<span class="se-text-[11px] se-font-semibold se-text-text-secondary se-mb-1 se-block">AI Rationale</span>
|
|
220
|
+
<div class="se-p-2 se-rounded se-border se-border-dashed se-border-border-primary se-bg-card-bg se-text-text-secondary se-text-xs se-mb-2">
|
|
221
|
+
${tip.rationale.why}
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
` : nothing}
|
|
225
|
+
</div>
|
|
226
|
+
`;
|
|
227
|
+
};
|
|
228
|
+
this._renderListMode = (items) => {
|
|
229
|
+
if (items.length === 0) {
|
|
230
|
+
return html`<div class="se-text-center se-py-8 se-px-4 se-text-text-secondary se-text-sm">
|
|
231
|
+
No tips configured.
|
|
232
|
+
</div>`;
|
|
233
|
+
}
|
|
234
|
+
return html`
|
|
235
|
+
<div class="se-text-[11px] se-font-semibold se-uppercase se-tracking-wider se-text-text-secondary se-mb-2 se-px-1">
|
|
236
|
+
TIPS <span class="se-text-text-tertiary se-font-normal">${items.length}</span>
|
|
237
|
+
</div>
|
|
238
|
+
${items.map(
|
|
239
|
+
(item) => html`
|
|
240
|
+
<div
|
|
241
|
+
data-item-key=${item.key}
|
|
242
|
+
data-card-body
|
|
243
|
+
@click=${() => this._handleItemClick(item.key)}
|
|
244
|
+
class="se-p-3 se-rounded-lg se-border se-border-border-primary se-bg-card-bg se-cursor-pointer se-mb-2 se-transition-all hover:se-border-pink-4/40 hover:se-bg-pink-4/5"
|
|
245
|
+
>
|
|
246
|
+
<div class="se-flex se-items-center se-gap-2">
|
|
247
|
+
${this._renderDetectionBadge(item)}
|
|
248
|
+
<span class="se-flex-1 se-overflow-hidden se-text-ellipsis se-whitespace-nowrap se-text-sm se-text-text-primary">
|
|
249
|
+
${item.summary}
|
|
250
|
+
</span>
|
|
251
|
+
</div>
|
|
252
|
+
${item.trigger !== "All pages" ? html`
|
|
253
|
+
<div class="se-text-[10px] se-text-text-tertiary se-mt-1">📍 ${item.trigger}</div>
|
|
254
|
+
` : nothing}
|
|
255
|
+
${item.rationale ? html`
|
|
256
|
+
<div class="se-text-[10px] se-text-text-tertiary se-mt-1">WHY: ${item.rationale}</div>
|
|
257
|
+
` : nothing}
|
|
258
|
+
</div>
|
|
259
|
+
`
|
|
260
|
+
)}
|
|
261
|
+
`;
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
createRenderRoot() {
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
connectedCallback() {
|
|
268
|
+
super.connectedCallback();
|
|
269
|
+
window.addEventListener("popstate", this._onPopstate);
|
|
270
|
+
this._detectionInterval = setInterval(() => this._runDetection(), 2e3);
|
|
271
|
+
}
|
|
272
|
+
disconnectedCallback() {
|
|
273
|
+
window.removeEventListener("popstate", this._onPopstate);
|
|
274
|
+
if (this._detectionInterval) {
|
|
275
|
+
clearInterval(this._detectionInterval);
|
|
276
|
+
this._detectionInterval = null;
|
|
277
|
+
}
|
|
278
|
+
super.disconnectedCallback();
|
|
279
|
+
}
|
|
280
|
+
firstUpdated() {
|
|
281
|
+
this._runDetection();
|
|
282
|
+
}
|
|
283
|
+
render() {
|
|
284
|
+
if (!this.config) {
|
|
285
|
+
return html`<div class="se-p-8 se-text-center se-text-text-secondary se-text-sm">Loading...</div>`;
|
|
286
|
+
}
|
|
287
|
+
const items = flattenItems(this.config);
|
|
288
|
+
const editItem = this._editingKey !== null ? items.find((it) => it.key === this._editingKey) : null;
|
|
289
|
+
return html`
|
|
290
|
+
<div class="se-flex se-flex-col se-h-full">
|
|
291
|
+
<!-- Header (no Back button — panel provides that) -->
|
|
292
|
+
<div class="se-px-4 se-pt-3 se-pb-1">
|
|
293
|
+
<h2 class="se-m-0 se-text-base se-font-semibold se-text-text-primary">Navigation Tips</h2>
|
|
294
|
+
<p class="se-m-0 se-mt-0.5 se-text-xs se-text-text-secondary">
|
|
295
|
+
${items.length} tip${items.length !== 1 ? "s" : ""}
|
|
296
|
+
</p>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
<div class="se-flex-1 se-overflow-auto se-p-4">
|
|
300
|
+
${editItem ? html`
|
|
301
|
+
<button type="button" @click=${() => {
|
|
302
|
+
this._editingKey = null;
|
|
303
|
+
}}
|
|
304
|
+
class="se-mb-3 se-py-1 se-px-2 se-rounded se-border-none se-bg-card-bg se-text-text-secondary se-text-xs se-cursor-pointer"
|
|
305
|
+
>← Back to list</button>
|
|
306
|
+
${this._renderEditMode(editItem)}
|
|
307
|
+
` : this._renderListMode(items)}
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
`;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
NavEditorLit.properties = {
|
|
314
|
+
config: { attribute: false },
|
|
315
|
+
onChange: { attribute: false },
|
|
316
|
+
_editingKey: { state: true },
|
|
317
|
+
_detectionMap: { state: true }
|
|
321
318
|
};
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
319
|
+
customElements.define("se-nav-editor", NavEditorLit);
|
|
320
|
+
export {
|
|
321
|
+
NavEditorLit
|
|
325
322
|
};
|
|
326
|
-
|
|
323
|
+
//# sourceMappingURL=editor.js.map
|