@syntrologie/adapt-nav 2.1.0 → 2.2.0-canary.2
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/NavWidget.d.ts +1 -1
- package/dist/NavWidget.d.ts.map +1 -1
- package/dist/NavWidget.js +6 -8
- package/dist/cdn.d.ts +1 -1
- package/dist/cdn.d.ts.map +1 -1
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +35 -10
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/schema.d.ts +702 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +33 -0
- package/dist/summarize.d.ts +1 -1
- package/dist/summarize.d.ts.map +1 -1
- package/dist/types.d.ts +5 -15
- package/dist/types.d.ts.map +1 -1
- package/node_modules/@syntro/design-system/README.md +335 -0
- package/node_modules/@syntro/design-system/dist/assets/syntrologie-logo.svg +21 -0
- package/node_modules/@syntro/design-system/dist/assets/syntrologie-logomark.svg +10 -0
- package/node_modules/@syntro/design-system/dist/index.d.ts +8 -0
- package/node_modules/@syntro/design-system/dist/index.d.ts.map +1 -0
- package/node_modules/@syntro/design-system/dist/index.js +7 -0
- package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts +19 -0
- package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts.map +1 -0
- package/node_modules/@syntro/design-system/dist/tailwind-preset.js +432 -0
- package/node_modules/@syntro/design-system/dist/tokens/colors.css +464 -0
- package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts +874 -0
- package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts.map +1 -0
- package/node_modules/@syntro/design-system/dist/tokens/colors.js +564 -0
- package/node_modules/@syntro/design-system/dist/tokens/effects.css +43 -0
- package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts +85 -0
- package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts.map +1 -0
- package/node_modules/@syntro/design-system/dist/tokens/effects.js +77 -0
- package/node_modules/@syntro/design-system/dist/tokens/index.d.ts +10 -0
- package/node_modules/@syntro/design-system/dist/tokens/index.d.ts.map +1 -0
- package/node_modules/@syntro/design-system/dist/tokens/index.js +9 -0
- package/node_modules/@syntro/design-system/package.json +55 -0
- package/node_modules/@syntro/design-system/src/assets/syntrologie-logo.svg +21 -0
- package/node_modules/@syntro/design-system/src/assets/syntrologie-logomark.svg +10 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/BeforeAfterToggle.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/BeforeAfterToggle.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/BeforeAfterToggle.test.js +28 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DetectionBadge.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DetectionBadge.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DetectionBadge.test.js +18 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.js +22 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditBackButton.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditBackButton.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditBackButton.test.js +20 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorBody.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorBody.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorBody.test.js +12 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.js +25 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorFooter.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorFooter.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorFooter.test.js +23 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorHeader.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorHeader.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorHeader.test.js +24 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorInput.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorInput.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorInput.test.js +26 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorLayout.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorLayout.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorLayout.test.js +13 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorSelect.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorSelect.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorSelect.test.js +22 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorTextarea.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorTextarea.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorTextarea.test.js +20 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.js +100 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EmptyState.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EmptyState.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EmptyState.test.js +10 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/GroupHeader.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/GroupHeader.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/GroupHeader.test.js +14 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/TriggerJourney.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/TriggerJourney.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/TriggerJourney.test.js +126 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/cn.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/cn.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/cn.test.js +16 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/formatConditionLabel.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/formatConditionLabel.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/formatConditionLabel.test.js +329 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useElementRect.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useElementRect.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useElementRect.test.js +112 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.js +3 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +31 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +152 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts +7 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +9 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +23 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +40 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +6 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +5 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts +8 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +9 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts +7 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +4 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts +7 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.js +4 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts +13 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +6 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts +7 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +4 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts +9 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.js +4 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +8 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +5 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts +7 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.js +4 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +23 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +116 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +8 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +5 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +8 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +15 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts +32 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +75 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts +6 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.js +4 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts +8 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.js +5 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +12 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +40 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +26 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +207 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts +8 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.js +46 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useShowWhenStatus.d.ts +24 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useShowWhenStatus.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useShowWhenStatus.js +215 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +33 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +24 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts +22 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.js +143 -0
- package/node_modules/@syntrologie/shared-editor-ui/package.json +45 -0
- package/package.json +15 -10
package/dist/NavWidget.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Demonstrates the compositional action pattern where child actions
|
|
8
8
|
* (nav:tip) serve as configuration data for the parent widget.
|
|
9
9
|
*/
|
|
10
|
-
import type {
|
|
10
|
+
import type { NavConfig, NavWidgetProps, NavWidgetRuntime } from './types';
|
|
11
11
|
/**
|
|
12
12
|
* NavWidget - Renders a collapsible navigation tips accordion.
|
|
13
13
|
*
|
package/dist/NavWidget.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavWidget.d.ts","sourceRoot":"","sources":["../src/NavWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"NavWidget.d.ts","sourceRoot":"","sources":["../src/NavWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAgB,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA4PzF;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,cAAc,2CAiOxE;AAMD;;GAEG;AACH,eAAO,MAAM,kBAAkB;qBAEhB,WAAW,WACb,SAAS,GAAG;QAAE,OAAO,CAAC,EAAE,gBAAgB,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;CAiD3E,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/NavWidget.js
CHANGED
|
@@ -8,8 +8,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
* Demonstrates the compositional action pattern where child actions
|
|
9
9
|
* (nav:tip) serve as configuration data for the parent widget.
|
|
10
10
|
*/
|
|
11
|
-
import { base,
|
|
12
|
-
import React, {
|
|
11
|
+
import { base, purple, slateGrey } from '@syntro/design-system/tokens';
|
|
12
|
+
import React, { useCallback, useEffect, useMemo, useReducer, useState } from 'react';
|
|
13
13
|
import { createRoot } from 'react-dom/client';
|
|
14
14
|
// ============================================================================
|
|
15
15
|
// Sanitization
|
|
@@ -202,7 +202,7 @@ function NavTipItem({ item, isExpanded, onToggle, onNavigate, theme }) {
|
|
|
202
202
|
onNavigate(href, external ?? false);
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
|
-
return (_jsxs("div", { style: itemStyle, "data-nav-tip-id": item.config.id, children: [_jsxs("button", { style: headerStyle, onClick: onToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-expanded": isExpanded, children: [icon && _jsx("span", { style: baseStyles.icon, children: icon }), _jsx("span", { children: title }), _jsx("span", { style: chevronStyle, children: '\u25BC' })] }), _jsxs("div", { style: bodyStyle, "aria-hidden": !isExpanded, children: [_jsx("p", { style: baseStyles.description, children: description }), href && (_jsxs("a", { href: href, onClick: handleLinkClick, style: { ...baseStyles.linkButton, ...colors.linkButton }, target: external ? '_blank' : undefined, rel: external ? 'noopener noreferrer' : undefined, children: ["Go ", external ? '\u2197' : '\u2192'] }))] })] }));
|
|
205
|
+
return (_jsxs("div", { style: itemStyle, "data-nav-tip-id": item.config.id, children: [_jsxs("button", { type: "button", style: headerStyle, onClick: onToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-expanded": isExpanded, children: [icon && _jsx("span", { style: baseStyles.icon, children: icon }), _jsx("span", { children: title }), _jsx("span", { style: chevronStyle, children: '\u25BC' })] }), _jsxs("div", { style: bodyStyle, "aria-hidden": !isExpanded, children: [_jsx("p", { style: baseStyles.description, children: description }), href && (_jsxs("a", { href: href, onClick: handleLinkClick, style: { ...baseStyles.linkButton, ...colors.linkButton }, target: external ? '_blank' : undefined, rel: external ? 'noopener noreferrer' : undefined, children: ["Go ", external ? '\u2197' : '\u2192'] }))] })] }));
|
|
206
206
|
}
|
|
207
207
|
// ============================================================================
|
|
208
208
|
// NavWidget Component
|
|
@@ -274,6 +274,7 @@ export function NavWidget({ config, runtime, instanceId }) {
|
|
|
274
274
|
}
|
|
275
275
|
}, [config.scope, config.actions, runtime.accumulator]);
|
|
276
276
|
// Filter visible tips based on per-item showWhen
|
|
277
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: renderTick is intentionally included to force re-evaluation when the runtime's mutable context changes (subscribed above via forceUpdate)
|
|
277
278
|
const visibleTips = useMemo(() => config.actions.filter((tip) => {
|
|
278
279
|
if (!tip.showWhen)
|
|
279
280
|
return true;
|
|
@@ -285,9 +286,7 @@ export function NavWidget({ config, runtime, instanceId }) {
|
|
|
285
286
|
// If strategy evaluation fails, hide the tip (fail-closed)
|
|
286
287
|
return false;
|
|
287
288
|
}
|
|
288
|
-
}),
|
|
289
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
290
|
-
[config.actions, runtime, renderTick]);
|
|
289
|
+
}), [config.actions, runtime, renderTick]);
|
|
291
290
|
// Group by category
|
|
292
291
|
const categoryGroups = useMemo(() => {
|
|
293
292
|
const groups = new Map();
|
|
@@ -353,8 +352,7 @@ export function NavWidget({ config, runtime, instanceId }) {
|
|
|
353
352
|
const handleNavigate = useCallback((href, external) => {
|
|
354
353
|
// Reject dangerous URIs to prevent XSS
|
|
355
354
|
const normalizedHref = href.trim().toLowerCase();
|
|
356
|
-
if (normalizedHref.startsWith('javascript:') ||
|
|
357
|
-
normalizedHref.startsWith('data:')) {
|
|
355
|
+
if (normalizedHref.startsWith('javascript:') || normalizedHref.startsWith('data:')) {
|
|
358
356
|
return;
|
|
359
357
|
}
|
|
360
358
|
runtime.events.publish('nav:tip_clicked', {
|
package/dist/cdn.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare const manifest: {
|
|
|
17
17
|
runtime: {
|
|
18
18
|
actions: {
|
|
19
19
|
kind: "navigation:scrollTo" | "navigation:navigate";
|
|
20
|
-
executor: import("
|
|
20
|
+
executor: import("packages/sdk-contracts/dist").ActionExecutor<import("./types").ScrollToAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").NavigateAction>;
|
|
21
21
|
}[];
|
|
22
22
|
widgets: {
|
|
23
23
|
id: string;
|
package/dist/cdn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAA0B,MAAM,UAAU,CAAC;AAIlD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAA0B,MAAM,UAAU,CAAC;AAIlD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;2BA0DqsY,CAAC;8BAA8B,CAAC;;;;;;;;;QA/CtvY;;;;WAIG;8BACmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;+BAoBtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CAQjD,CAAC;AAaF,eAAe,QAAQ,CAAC"}
|
package/dist/editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,OAAO,EACL,KAAK,gBAAgB,EAKtB,MAAM,SAAS,CAAC;AA0KjB,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CA6XvE;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;CAGlB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/editor.js
CHANGED
|
@@ -6,9 +6,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
6
6
|
* Displays a scannable list of tip cards with trigger, rationale,
|
|
7
7
|
* and inline editing. Includes detection badges and hover-to-highlight.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
9
|
+
import { DetectionBadge, DismissedSection, EditorBody, EditorCard, EditorFooter, EditorHeader, EditorInput, EditorLayout, EmptyState, GroupHeader, TriggerJourney, useShowWhenStatus, } from '@syntrologie/shared-editor-ui';
|
|
10
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
11
|
+
import { describeTrigger, summarizeNavItem } from './summarize';
|
|
12
12
|
import { isOwnAction, } from './types';
|
|
13
13
|
function isRuleStrategy(s) {
|
|
14
14
|
return (typeof s === 'object' &&
|
|
@@ -130,6 +130,23 @@ export function NavEditor({ config, onChange, editor }) {
|
|
|
130
130
|
useEffect(() => {
|
|
131
131
|
editor.setDismissedKeys?.(dismissedKeys);
|
|
132
132
|
}, [dismissedKeys, editor]);
|
|
133
|
+
// React to global before/after toggle from the panel
|
|
134
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitted — adding config/typedConfig/previewConfig would cause infinite re-renders since previewConfig triggers state updates
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
const mode = editor.previewMode;
|
|
137
|
+
if (!mode)
|
|
138
|
+
return;
|
|
139
|
+
if (mode === 'before') {
|
|
140
|
+
// Remove all nav tips — push a config with every item filtered out
|
|
141
|
+
const allKeys = new Set(flattenItems(typedConfig).map((item) => item.key));
|
|
142
|
+
const empty = filterConfig(typedConfig, allKeys);
|
|
143
|
+
editor.previewConfig(empty);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
// Restore the full config
|
|
147
|
+
editor.previewConfig(config);
|
|
148
|
+
}
|
|
149
|
+
}, [editor.previewMode]);
|
|
133
150
|
// If navigated here with an editKey, jump directly to that item's edit view
|
|
134
151
|
const initialConsumed = useRef(false);
|
|
135
152
|
useEffect(() => {
|
|
@@ -146,7 +163,7 @@ export function NavEditor({ config, onChange, editor }) {
|
|
|
146
163
|
const dismissedItems = allItems.filter((item) => dismissedKeys.has(item.key));
|
|
147
164
|
const totalLinks = activeItems.length;
|
|
148
165
|
// Live showWhen status for condition diagnostics
|
|
149
|
-
const showWhenItems =
|
|
166
|
+
const showWhenItems = useMemo(() => allItems.map((item) => ({
|
|
150
167
|
id: item.key,
|
|
151
168
|
showWhen: item.tip.showWhen,
|
|
152
169
|
})), [allItems]);
|
|
@@ -187,6 +204,11 @@ export function NavEditor({ config, onChange, editor }) {
|
|
|
187
204
|
editor.previewConfig(config);
|
|
188
205
|
editor.clearHighlight();
|
|
189
206
|
}, [editor, config]);
|
|
207
|
+
// Register back handler in panel header when editing
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
editor.setBackHandler?.(editingKey !== null ? handleBackToList : null);
|
|
210
|
+
return () => editor.setBackHandler?.(null);
|
|
211
|
+
}, [editingKey, handleBackToList, editor]);
|
|
190
212
|
const handleBeforeAfter = useCallback((mode) => {
|
|
191
213
|
setPreviewMode(mode);
|
|
192
214
|
if (mode === 'before') {
|
|
@@ -231,7 +253,7 @@ export function NavEditor({ config, onChange, editor }) {
|
|
|
231
253
|
if (!tip)
|
|
232
254
|
return null;
|
|
233
255
|
const item = allItems.find((it) => it.key === String(index));
|
|
234
|
-
return (_jsxs("div", { className: "se-py-1", children: [item && item.trigger !== 'All pages' && (_jsxs("
|
|
256
|
+
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' })] }));
|
|
235
257
|
};
|
|
236
258
|
const subtitle = `${totalLinks} tip${totalLinks !== 1 ? 's' : ''}${totalLinks > 0 ? ` (${foundCount} found on this page)` : ''}`;
|
|
237
259
|
return (_jsxs(EditorLayout, { children: [_jsx(EditorHeader, { title: "Navigation Tips", subtitle: subtitle, onBack: () => editor.navigateHome() }), _jsx(EditorBody, { children: editingKey !== null ? (
|
|
@@ -239,19 +261,22 @@ export function NavEditor({ config, onChange, editor }) {
|
|
|
239
261
|
(() => {
|
|
240
262
|
const editIndex = Number(editingKey);
|
|
241
263
|
const editItem = allItems.find((it) => it.key === editingKey);
|
|
242
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "se-flex se-items-center se-gap-2 se-mb-3 se-text-[13px] se-font-semibold se-text-slate-grey-10", children: [_jsx("span", { children: '\u{1F9ED}' }), _jsx("span", { children: editItem?.summary })] }),
|
|
264
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "se-flex se-items-center se-gap-2 se-mb-3 se-text-[13px] se-font-semibold se-text-slate-grey-10", children: [_jsx("span", { children: '\u{1F9ED}' }), _jsx("span", { children: editItem?.summary })] }), renderEditFields(editIndex)] }));
|
|
243
265
|
})()) : (
|
|
244
266
|
/* ---- List mode ---- */
|
|
245
267
|
_jsxs(_Fragment, { children: [allItems.length === 0 && _jsx(EmptyState, { message: "No tips configured." }), activeItems.length > 0 && (_jsxs(_Fragment, { children: [_jsx(GroupHeader, { label: "TIPS", count: activeItems.length }), activeItems.map((item) => {
|
|
246
268
|
const detection = detectionMap.get(item.key);
|
|
247
|
-
return (_jsxs(EditorCard, { itemKey: item.key, onMouseEnter: () => handleCardHover(item), onMouseLeave: handleCardLeave, children: [item.trigger !== 'All pages' && (_jsxs("
|
|
269
|
+
return (_jsxs(EditorCard, { itemKey: item.key, onClick: () => handleCardBodyClick(item), onMouseEnter: () => handleCardHover(item), onMouseLeave: handleCardLeave, children: [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: (e) => {
|
|
248
270
|
e.stopPropagation();
|
|
249
271
|
handleTriggerClick(item);
|
|
250
|
-
}, children: [_jsx("span", { children: '\u{1f4cd}' }), _jsx("span", { children: item.trigger })] })), _jsxs("div", { "data-card-body": true, className: "se-flex se-items-center se-gap-2 se-cursor-pointer", onClick: () => handleCardBodyClick(item),
|
|
272
|
+
}, children: [_jsx("span", { children: '\u{1f4cd}' }), _jsx("span", { children: item.trigger })] })), _jsxs("div", { "data-card-body": true, role: "button", tabIndex: 0, className: "se-flex se-items-center se-gap-2 se-cursor-pointer", onClick: () => handleCardBodyClick(item), onKeyDown: (e) => {
|
|
273
|
+
if (e.key === 'Enter' || e.key === ' ')
|
|
274
|
+
handleCardBodyClick(item);
|
|
275
|
+
}, children: [_jsx(DetectionBadge, { found: detection?.found ?? false }), _jsx("span", { className: "se-flex-1 se-overflow-hidden se-text-ellipsis se-whitespace-nowrap", children: item.summary }), _jsx("button", { type: "button", className: "se-py-0.5 se-px-1.5 se-rounded se-border-none se-bg-transparent se-text-slate-grey-7 se-text-sm se-cursor-pointer se-shrink-0 se-leading-none", onClick: (e) => {
|
|
251
276
|
e.stopPropagation();
|
|
252
277
|
handleDismiss(item.key);
|
|
253
|
-
}, title: "Dismiss this tip", children: "\u00D7" })] }), _jsxs("div", { className: "se-text-[10px] se-text-slate-grey-7 se-mt-1", children: ["WHY: ", item.rationale ? item.rationale.why : 'N/A'] }), _jsx(
|
|
254
|
-
})] })), dismissedItems.length > 0 && (_jsx(DismissedSection, { count: dismissedItems.length, children: dismissedItems.map((item) => (_jsxs("div", { className: "se-flex se-items-center se-gap-2 se-py-1.5 se-px-2.5 se-rounded-md se-border se-border-white/[0.03] se-bg-transparent se-mb-0.5 se-cursor-pointer se-text-xs se-text-slate-grey-6 se-opacity-60", children: [_jsx("span", { className: "se-flex-1 se-overflow-hidden se-text-ellipsis se-whitespace-nowrap se-line-through", children: item.summary }), _jsx("button", { className: "se-py-0.5 se-px-1.5 se-rounded se-border-none se-bg-transparent se-text-blue-5 se-text-[11px] se-cursor-pointer se-shrink-0 se-leading-none", onClick: (e) => {
|
|
278
|
+
}, title: "Dismiss this tip", children: "\u00D7" })] }), _jsxs("div", { className: "se-text-[10px] se-text-slate-grey-7 se-mt-1", children: ["WHY: ", item.rationale ? item.rationale.why : 'N/A'] }), _jsx(TriggerJourney, { status: showWhenStatuses.get(item.key) ?? null })] }, item.key));
|
|
279
|
+
})] })), dismissedItems.length > 0 && (_jsx(DismissedSection, { count: dismissedItems.length, children: dismissedItems.map((item) => (_jsxs("div", { className: "se-flex se-items-center se-gap-2 se-py-1.5 se-px-2.5 se-rounded-md se-border se-border-white/[0.03] se-bg-transparent se-mb-0.5 se-cursor-pointer se-text-xs se-text-slate-grey-6 se-opacity-60", children: [_jsx("span", { className: "se-flex-1 se-overflow-hidden se-text-ellipsis se-whitespace-nowrap se-line-through", children: item.summary }), _jsx("button", { type: "button", className: "se-py-0.5 se-px-1.5 se-rounded se-border-none se-bg-transparent se-text-blue-5 se-text-[11px] se-cursor-pointer se-shrink-0 se-leading-none", onClick: (e) => {
|
|
255
280
|
e.stopPropagation();
|
|
256
281
|
handleRestore(item.key);
|
|
257
282
|
}, children: "Restore" })] }, item.key))) }))] })) }), _jsx(EditorFooter, { onSave: () => editor.save(), onPublish: handlePublish })] }));
|
package/dist/runtime.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Includes widget-based nav tips and navigation action executors
|
|
6
6
|
* (scrollTo, navigate) previously in adaptive-navigation.
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { ActionExecutor, NavigateAction, ScrollToAction } from './types';
|
|
9
9
|
/**
|
|
10
10
|
* Execute a scrollTo action
|
|
11
11
|
*/
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAkB,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAM9F;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CA4B1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CAgC1D,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;EAGZ,CAAC;AAMX;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;IAMlB;;OAEG;;;;;;;;IAGH;;OAEG;;;;;uBAe0rV,CAAC;0BAA8B,CAAC;;;;;;;;;CAH9tV,CAAC;AAEF,eAAe,OAAO,CAAC"}
|