@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
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NavWidgetLit — Vitest + @open-wc/testing-helpers unit tests
|
|
3
|
-
*
|
|
4
|
-
* Tests cover: rendering, expand/collapse, nav-tip-clicked event, XSS rejection,
|
|
5
|
-
* empty state, category grouping, and visibility filtering (triggerWhen).
|
|
6
|
-
*/
|
|
7
|
-
import { fixture, html } from '@open-wc/testing-helpers';
|
|
8
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
9
|
-
import { NavWidgetLit } from './NavWidgetLit';
|
|
10
|
-
// ── Custom element registration ───────────────────────────────────────────────
|
|
11
|
-
const TAG = 'syntro-nav-tips';
|
|
12
|
-
if (!customElements.get(TAG)) {
|
|
13
|
-
customElements.define(TAG, NavWidgetLit);
|
|
14
|
-
}
|
|
15
|
-
// ── Helpers ────────────────────────────────────────────────────────────────────
|
|
16
|
-
function makeTip(id, overrides = {}) {
|
|
17
|
-
return {
|
|
18
|
-
kind: 'nav:tip',
|
|
19
|
-
config: {
|
|
20
|
-
id,
|
|
21
|
-
title: `Tip ${id}`,
|
|
22
|
-
description: `Description for tip ${id}`,
|
|
23
|
-
...overrides,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function makeRuntime(overrides = {}) {
|
|
28
|
-
return {
|
|
29
|
-
evaluateSync: vi.fn().mockReturnValue({ value: true, isFallback: false }),
|
|
30
|
-
context: { subscribe: vi.fn().mockReturnValue(vi.fn()) },
|
|
31
|
-
events: { publish: vi.fn() },
|
|
32
|
-
accumulator: {
|
|
33
|
-
subscribe: vi.fn().mockReturnValue(vi.fn()),
|
|
34
|
-
register: vi.fn(),
|
|
35
|
-
},
|
|
36
|
-
...overrides,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function makeConfig(tips, overrides = {}) {
|
|
40
|
-
return {
|
|
41
|
-
expandBehavior: 'single',
|
|
42
|
-
theme: 'light',
|
|
43
|
-
actions: tips,
|
|
44
|
-
...overrides,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
async function renderWidget(tips, configOverrides = {}, runtime) {
|
|
48
|
-
const el = await fixture(html `<syntro-nav-tips></syntro-nav-tips>`);
|
|
49
|
-
el.config = makeConfig(tips, configOverrides);
|
|
50
|
-
el.runtime = runtime;
|
|
51
|
-
await el.updateComplete;
|
|
52
|
-
return el;
|
|
53
|
-
}
|
|
54
|
-
// ── Tests ─────────────────────────────────────────────────────────────────────
|
|
55
|
-
describe('NavWidgetLit', () => {
|
|
56
|
-
// ── Rendering ────────────────────────────────────────────────────────────
|
|
57
|
-
it('renders navigation tips from config', async () => {
|
|
58
|
-
const el = await renderWidget([makeTip('t1'), makeTip('t2')]);
|
|
59
|
-
expect(el.querySelectorAll('[data-nav-tip-id]')).toHaveLength(2);
|
|
60
|
-
expect(el.querySelector('[data-nav-tip-id="t1"]')).not.toBeNull();
|
|
61
|
-
expect(el.querySelector('[data-nav-tip-id="t2"]')).not.toBeNull();
|
|
62
|
-
});
|
|
63
|
-
it('renders tip titles in button text', async () => {
|
|
64
|
-
const el = await renderWidget([makeTip('a', { title: 'My Nav Tip' })]);
|
|
65
|
-
const btn = el.querySelector('button');
|
|
66
|
-
expect(btn.textContent).toContain('My Nav Tip');
|
|
67
|
-
});
|
|
68
|
-
// ── Expand / collapse ────────────────────────────────────────────────────
|
|
69
|
-
it('starts with all tips collapsed', async () => {
|
|
70
|
-
const el = await renderWidget([makeTip('t1'), makeTip('t2')]);
|
|
71
|
-
const buttons = el.querySelectorAll('button[aria-expanded]');
|
|
72
|
-
for (const btn of Array.from(buttons)) {
|
|
73
|
-
expect(btn.getAttribute('aria-expanded')).toBe('false');
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
it('expands a tip when its header button is clicked', async () => {
|
|
77
|
-
const el = await renderWidget([makeTip('t1')]);
|
|
78
|
-
const btn = el.querySelector('[data-nav-tip-id="t1"] button');
|
|
79
|
-
btn.click();
|
|
80
|
-
await el.updateComplete;
|
|
81
|
-
expect(btn.getAttribute('aria-expanded')).toBe('true');
|
|
82
|
-
});
|
|
83
|
-
it('collapses an expanded tip on second click', async () => {
|
|
84
|
-
const el = await renderWidget([makeTip('t1')]);
|
|
85
|
-
const btn = el.querySelector('[data-nav-tip-id="t1"] button');
|
|
86
|
-
btn.click();
|
|
87
|
-
await el.updateComplete;
|
|
88
|
-
btn.click();
|
|
89
|
-
await el.updateComplete;
|
|
90
|
-
expect(btn.getAttribute('aria-expanded')).toBe('false');
|
|
91
|
-
});
|
|
92
|
-
it('collapses previously-expanded tip in single-expand mode', async () => {
|
|
93
|
-
const el = await renderWidget([makeTip('t1'), makeTip('t2')], {
|
|
94
|
-
expandBehavior: 'single',
|
|
95
|
-
});
|
|
96
|
-
const btn1 = el.querySelector('[data-nav-tip-id="t1"] button');
|
|
97
|
-
const btn2 = el.querySelector('[data-nav-tip-id="t2"] button');
|
|
98
|
-
btn1.click();
|
|
99
|
-
await el.updateComplete;
|
|
100
|
-
expect(btn1.getAttribute('aria-expanded')).toBe('true');
|
|
101
|
-
btn2.click();
|
|
102
|
-
await el.updateComplete;
|
|
103
|
-
expect(btn1.getAttribute('aria-expanded')).toBe('false');
|
|
104
|
-
expect(btn2.getAttribute('aria-expanded')).toBe('true');
|
|
105
|
-
});
|
|
106
|
-
it('allows multiple tips open simultaneously in multiple-expand mode', async () => {
|
|
107
|
-
const el = await renderWidget([makeTip('t1'), makeTip('t2')], {
|
|
108
|
-
expandBehavior: 'multiple',
|
|
109
|
-
});
|
|
110
|
-
const btn1 = el.querySelector('[data-nav-tip-id="t1"] button');
|
|
111
|
-
const btn2 = el.querySelector('[data-nav-tip-id="t2"] button');
|
|
112
|
-
btn1.click();
|
|
113
|
-
await el.updateComplete;
|
|
114
|
-
btn2.click();
|
|
115
|
-
await el.updateComplete;
|
|
116
|
-
expect(btn1.getAttribute('aria-expanded')).toBe('true');
|
|
117
|
-
expect(btn2.getAttribute('aria-expanded')).toBe('true');
|
|
118
|
-
});
|
|
119
|
-
// ── Custom event ─────────────────────────────────────────────────────────
|
|
120
|
-
it('fires nav-tip-clicked custom event when CTA link is clicked', async () => {
|
|
121
|
-
const tip = makeTip('t1', { href: '/dashboard' });
|
|
122
|
-
const el = await renderWidget([tip]);
|
|
123
|
-
// Expand so the CTA link is rendered
|
|
124
|
-
const btn = el.querySelector('[data-nav-tip-id="t1"] button');
|
|
125
|
-
btn.click();
|
|
126
|
-
await el.updateComplete;
|
|
127
|
-
const events = [];
|
|
128
|
-
el.addEventListener('nav-tip-clicked', (e) => events.push(e));
|
|
129
|
-
const link = el.querySelector('a');
|
|
130
|
-
link.click();
|
|
131
|
-
expect(events).toHaveLength(1);
|
|
132
|
-
expect(events[0].detail.href).toBe('/dashboard');
|
|
133
|
-
});
|
|
134
|
-
// ── XSS rejection ────────────────────────────────────────────────────────
|
|
135
|
-
it('does not navigate when href starts with javascript:', async () => {
|
|
136
|
-
const originalOpen = window.open;
|
|
137
|
-
const openSpy = vi.fn();
|
|
138
|
-
window.open = openSpy;
|
|
139
|
-
// Directly invoke the internal navigate path via a link with a JS URL
|
|
140
|
-
const tip = makeTip('xss', { href: 'javascript:alert(1)', external: false });
|
|
141
|
-
const el = await renderWidget([tip]);
|
|
142
|
-
const headerBtn = el.querySelector('[data-nav-tip-id="xss"] button');
|
|
143
|
-
headerBtn.click();
|
|
144
|
-
await el.updateComplete;
|
|
145
|
-
const link = el.querySelector('a');
|
|
146
|
-
if (link) {
|
|
147
|
-
const navEvents = [];
|
|
148
|
-
el.addEventListener('nav-tip-clicked', (e) => navEvents.push(e));
|
|
149
|
-
link.click();
|
|
150
|
-
// The click handler checks the href and bails out early — no event should fire
|
|
151
|
-
expect(navEvents).toHaveLength(0);
|
|
152
|
-
}
|
|
153
|
-
window.open = originalOpen;
|
|
154
|
-
});
|
|
155
|
-
// ── Empty state ───────────────────────────────────────────────────────────
|
|
156
|
-
it('renders empty state when config has no actions', async () => {
|
|
157
|
-
const el = await renderWidget([]);
|
|
158
|
-
// No tip items
|
|
159
|
-
expect(el.querySelectorAll('[data-nav-tip-id]')).toHaveLength(0);
|
|
160
|
-
// The empty-state message is present
|
|
161
|
-
expect(el.textContent).toContain("You're all set for now");
|
|
162
|
-
});
|
|
163
|
-
// ── Category grouping ─────────────────────────────────────────────────────
|
|
164
|
-
it('renders category headers when tips have categories', async () => {
|
|
165
|
-
const tips = [
|
|
166
|
-
makeTip('t1', { category: 'Getting Started' }),
|
|
167
|
-
makeTip('t2', { category: 'Advanced' }),
|
|
168
|
-
];
|
|
169
|
-
const el = await renderWidget(tips);
|
|
170
|
-
const catHeaders = el.querySelectorAll('[data-category-header]');
|
|
171
|
-
expect(catHeaders).toHaveLength(2);
|
|
172
|
-
const headerTexts = Array.from(catHeaders).map((h) => h.textContent?.trim());
|
|
173
|
-
expect(headerTexts).toContain('Getting Started');
|
|
174
|
-
expect(headerTexts).toContain('Advanced');
|
|
175
|
-
});
|
|
176
|
-
it('does not render category headers when no tips have categories', async () => {
|
|
177
|
-
const tips = [makeTip('t1'), makeTip('t2')];
|
|
178
|
-
const el = await renderWidget(tips);
|
|
179
|
-
expect(el.querySelectorAll('[data-category-header]')).toHaveLength(0);
|
|
180
|
-
});
|
|
181
|
-
// ── Visibility filtering (triggerWhen) ────────────────────────────────────
|
|
182
|
-
it('hides tips whose triggerWhen evaluates to false', async () => {
|
|
183
|
-
const visibleTip = makeTip('visible');
|
|
184
|
-
const hiddenTip = {
|
|
185
|
-
...makeTip('hidden'),
|
|
186
|
-
triggerWhen: { type: 'rules', rules: [], default: false },
|
|
187
|
-
};
|
|
188
|
-
const runtime = makeRuntime({
|
|
189
|
-
evaluateSync: vi.fn((strategy) => {
|
|
190
|
-
if (strategy.default === false)
|
|
191
|
-
return { value: false, isFallback: false };
|
|
192
|
-
return { value: true, isFallback: false };
|
|
193
|
-
}),
|
|
194
|
-
});
|
|
195
|
-
const el = await renderWidget([visibleTip, hiddenTip], {}, runtime);
|
|
196
|
-
expect(el.querySelector('[data-nav-tip-id="visible"]')).not.toBeNull();
|
|
197
|
-
expect(el.querySelector('[data-nav-tip-id="hidden"]')).toBeNull();
|
|
198
|
-
});
|
|
199
|
-
});
|
package/dist/cdn.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CDN Entry Point for Adaptive Nav
|
|
3
|
-
*
|
|
4
|
-
* This module is bundled for CDN delivery and self-registers with the global
|
|
5
|
-
* SynOS app registry when loaded dynamically via the AppLoader.
|
|
6
|
-
*/
|
|
7
|
-
import NavEditor from './editor';
|
|
8
|
-
/**
|
|
9
|
-
* App manifest for registry registration.
|
|
10
|
-
* Follows the AppManifest interface expected by AppLoader/AppRegistry.
|
|
11
|
-
*/
|
|
12
|
-
export declare const manifest: {
|
|
13
|
-
id: string;
|
|
14
|
-
version: string;
|
|
15
|
-
name: string;
|
|
16
|
-
description: string;
|
|
17
|
-
runtime: {
|
|
18
|
-
actions: {
|
|
19
|
-
kind: "navigation:scrollTo" | "navigation:navigate";
|
|
20
|
-
executor: import("packages/sdk-contracts/dist").ActionExecutor<import("./types").ScrollToAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").NavigateAction>;
|
|
21
|
-
}[];
|
|
22
|
-
widgets: {
|
|
23
|
-
id: string;
|
|
24
|
-
component: {
|
|
25
|
-
mount(container: HTMLElement, config?: import("./types").NavConfig & {
|
|
26
|
-
runtime?: import("./types").NavWidgetRuntime;
|
|
27
|
-
instanceId?: string;
|
|
28
|
-
}): (() => void) | undefined;
|
|
29
|
-
};
|
|
30
|
-
metadata: {
|
|
31
|
-
name: string;
|
|
32
|
-
description: string;
|
|
33
|
-
icon: string;
|
|
34
|
-
};
|
|
35
|
-
}[];
|
|
36
|
-
notifyWatchers: (props: Record<string, unknown>) => {
|
|
37
|
-
id: string;
|
|
38
|
-
strategy: import("./types").DecisionStrategy<boolean>;
|
|
39
|
-
eventName: string;
|
|
40
|
-
eventProps: {
|
|
41
|
-
tipId: string;
|
|
42
|
-
title: string | undefined;
|
|
43
|
-
body: string | undefined;
|
|
44
|
-
icon: string | undefined;
|
|
45
|
-
};
|
|
46
|
-
}[];
|
|
47
|
-
};
|
|
48
|
-
editor: {
|
|
49
|
-
component: typeof NavEditor;
|
|
50
|
-
panel: {
|
|
51
|
-
title: string;
|
|
52
|
-
icon: string;
|
|
53
|
-
description: string;
|
|
54
|
-
};
|
|
55
|
-
getActionLabel(action: Record<string, unknown>): string;
|
|
56
|
-
};
|
|
57
|
-
metadata: {
|
|
58
|
-
isBuiltIn: boolean;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
export default manifest;
|
|
62
|
-
//# sourceMappingURL=cdn.d.ts.map
|
package/dist/cdn.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAA0B,MAAM,UAAU,CAAC;AAGlD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;2BAsCmymB,CAAC;8BAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAtB7zmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CAQjD,CAAC;AAaF,eAAe,QAAQ,CAAC"}
|
package/dist/cdn.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CDN Entry Point for Adaptive Nav
|
|
3
|
-
*
|
|
4
|
-
* This module is bundled for CDN delivery and self-registers with the global
|
|
5
|
-
* SynOS app registry when loaded dynamically via the AppLoader.
|
|
6
|
-
*/
|
|
7
|
-
import NavEditor, { editorPanel } from './editor';
|
|
8
|
-
import { executors, runtime } from './runtime';
|
|
9
|
-
/**
|
|
10
|
-
* App manifest for registry registration.
|
|
11
|
-
* Follows the AppManifest interface expected by AppLoader/AppRegistry.
|
|
12
|
-
*/
|
|
13
|
-
export const manifest = {
|
|
14
|
-
id: 'adaptive-nav',
|
|
15
|
-
version: runtime.version,
|
|
16
|
-
name: runtime.name,
|
|
17
|
-
description: runtime.description,
|
|
18
|
-
runtime: {
|
|
19
|
-
actions: executors.map(({ kind, executor }) => ({
|
|
20
|
-
kind,
|
|
21
|
-
executor,
|
|
22
|
-
})),
|
|
23
|
-
widgets: runtime.widgets,
|
|
24
|
-
notifyWatchers: runtime.notifyWatchers,
|
|
25
|
-
},
|
|
26
|
-
editor: {
|
|
27
|
-
component: NavEditor,
|
|
28
|
-
panel: editorPanel,
|
|
29
|
-
getActionLabel(action) {
|
|
30
|
-
const config = action.config || {};
|
|
31
|
-
return config.title || action.kind || 'nav:tip';
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
metadata: {
|
|
35
|
-
isBuiltIn: false,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Self-register with global registry if available.
|
|
40
|
-
* This happens when loaded via script tag (UMD).
|
|
41
|
-
*/
|
|
42
|
-
if (typeof window !== 'undefined') {
|
|
43
|
-
const registry = window.SynOS?.appRegistry;
|
|
44
|
-
if (registry && typeof registry.register === 'function') {
|
|
45
|
-
registry.register(manifest);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export default manifest;
|
package/dist/editor-lit.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adaptive Nav - Lit Editor Component
|
|
3
|
-
*
|
|
4
|
-
* Lit web component port of the React Nav editor (editor.tsx).
|
|
5
|
-
* Displays nav tip cards with detection badges, inline editing
|
|
6
|
-
* (Title, Description, Link URL, Icon, Category), and rationale.
|
|
7
|
-
*
|
|
8
|
-
* Custom events:
|
|
9
|
-
* navigate-home — user clicked back
|
|
10
|
-
* dirty-change — { dirty: boolean }
|
|
11
|
-
*/
|
|
12
|
-
import { LitElement } from 'lit';
|
|
13
|
-
import { type NavConfig } from './types';
|
|
14
|
-
export declare class NavEditorLit extends LitElement {
|
|
15
|
-
static properties: {
|
|
16
|
-
config: {
|
|
17
|
-
attribute: boolean;
|
|
18
|
-
};
|
|
19
|
-
onChange: {
|
|
20
|
-
attribute: boolean;
|
|
21
|
-
};
|
|
22
|
-
_editingKey: {
|
|
23
|
-
state: boolean;
|
|
24
|
-
};
|
|
25
|
-
_detectionMap: {
|
|
26
|
-
state: boolean;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
config: NavConfig | null;
|
|
30
|
-
onChange: ((updated: Record<string, unknown>) => void) | null;
|
|
31
|
-
private _editingKey;
|
|
32
|
-
private _detectionMap;
|
|
33
|
-
private _detectionInterval;
|
|
34
|
-
private _onPopstate;
|
|
35
|
-
createRenderRoot(): this;
|
|
36
|
-
connectedCallback(): void;
|
|
37
|
-
disconnectedCallback(): void;
|
|
38
|
-
firstUpdated(): void;
|
|
39
|
-
private _runDetection;
|
|
40
|
-
private _handleBack;
|
|
41
|
-
private _handleItemClick;
|
|
42
|
-
private _handleFieldChange;
|
|
43
|
-
private _handleBadgeClick;
|
|
44
|
-
private _renderDetectionBadge;
|
|
45
|
-
private _renderEditMode;
|
|
46
|
-
private _renderListMode;
|
|
47
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=editor-lit.d.ts.map
|
package/dist/editor-lit.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor-lit.d.ts","sourceRoot":"","sources":["../src/editor-lit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAQ,UAAU,EAAW,MAAM,KAAK,CAAC;AAGhD,OAAO,EAAe,KAAK,SAAS,EAAwC,MAAM,SAAS,CAAC;AAkH5F,qBAAa,YAAa,SAAQ,UAAU;IAC1C,OAAgB,UAAU;;;;;;;;;;;;;MAKxB;IAEF,MAAM,EAAE,SAAS,GAAG,IAAI,CAAQ;IAChC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAQ;IAErE,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,aAAa,CAA0C;IAC/D,OAAO,CAAC,kBAAkB,CAA+C;IACzE,OAAO,CAAC,WAAW,CAA8B;IAExC,gBAAgB;IAIhB,iBAAiB,IAAI,IAAI;IAOzB,oBAAoB,IAAI,IAAI;IAS5B,YAAY,IAAI,IAAI;IAK7B,OAAO,CAAC,aAAa,CAGnB;IAIF,OAAO,CAAC,WAAW,CAMjB;IAEF,OAAO,CAAC,gBAAgB,CAEtB;IAEF,OAAO,CAAC,kBAAkB,CAaxB;IAIF,OAAO,CAAC,iBAAiB,CAOvB;IAEF,OAAO,CAAC,qBAAqB,CAkB3B;IAEF,OAAO,CAAC,eAAe,CA0DrB;IAEF,OAAO,CAAC,eAAe,CA0CrB;IAEO,MAAM;CAoChB"}
|