@syntrologie/adapt-overlays 2.14.0 → 2.15.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.
Files changed (88) hide show
  1. package/dist/WorkflowWidgetLit.d.ts +123 -0
  2. package/dist/WorkflowWidgetLit.d.ts.map +1 -0
  3. package/dist/WorkflowWidgetLit.js +617 -0
  4. package/dist/runtime-lit.d.ts +94 -0
  5. package/dist/runtime-lit.d.ts.map +1 -0
  6. package/dist/runtime-lit.js +402 -0
  7. package/dist/runtime.d.ts.map +1 -1
  8. package/dist/runtime.js +10 -0
  9. package/dist/schema.d.ts +4 -4
  10. package/node_modules/@syntro/design-system/dist/tokens/index.d.ts +2 -0
  11. package/node_modules/@syntro/design-system/dist/tokens/index.d.ts.map +1 -1
  12. package/node_modules/@syntro/design-system/dist/tokens/index.js +2 -0
  13. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts +93 -0
  14. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts.map +1 -0
  15. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.js +72 -0
  16. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts +84 -0
  17. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts.map +1 -0
  18. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.js +323 -0
  19. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts +25 -0
  20. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts.map +1 -0
  21. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.js +55 -0
  22. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts +33 -0
  23. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts.map +1 -0
  24. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.js +118 -0
  25. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts +32 -0
  26. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts.map +1 -0
  27. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.js +68 -0
  28. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts +34 -0
  29. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts.map +1 -0
  30. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.js +57 -0
  31. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts +13 -0
  32. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts.map +1 -0
  33. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.js +31 -0
  34. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts +7 -0
  35. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts.map +1 -0
  36. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.js +15 -0
  37. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts +36 -0
  38. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts.map +1 -0
  39. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.js +102 -0
  40. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts +20 -0
  41. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts.map +1 -0
  42. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.js +48 -0
  43. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts +16 -0
  44. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts.map +1 -0
  45. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.js +25 -0
  46. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts +66 -0
  47. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts.map +1 -0
  48. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.js +87 -0
  49. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts +7 -0
  50. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts.map +1 -0
  51. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.js +15 -0
  52. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +1 -1
  53. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +28 -17
  54. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts +66 -0
  55. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts.map +1 -0
  56. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.js +528 -0
  57. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts +41 -0
  58. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts.map +1 -0
  59. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.js +63 -0
  60. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts +55 -0
  61. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts.map +1 -0
  62. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.js +92 -0
  63. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts +90 -0
  64. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts.map +1 -0
  65. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.js +242 -0
  66. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts +12 -0
  67. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts.map +1 -0
  68. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.js +21 -0
  69. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts +21 -0
  70. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts.map +1 -0
  71. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.js +33 -0
  72. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts +28 -0
  73. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts.map +1 -0
  74. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.js +121 -0
  75. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts +110 -0
  76. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts.map +1 -0
  77. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.js +476 -0
  78. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +2 -0
  79. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +1 -1
  80. package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +1 -0
  81. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts +15 -0
  82. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts.map +1 -0
  83. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.js +14 -0
  84. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts +0 -4
  85. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts.map +1 -1
  86. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.js +17 -1
  87. package/node_modules/@syntrologie/shared-editor-ui/package.json +9 -1
  88. package/package.json +9 -2
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Adaptive Overlays - Runtime Module (Lit)
3
+ *
4
+ * Visual overlay actions: highlight, pulse, badge, tooltip, celebrations.
5
+ * Uses the Lit web component mountable instead of the React one.
6
+ */
7
+ import { executeTour } from './executors/tour';
8
+ import { executeModal } from './modal';
9
+ import type { ActionExecutor, BadgeAction, HighlightAction, PulseAction, TooltipAction } from './types';
10
+ export { executeModal, executeTour };
11
+ export type { TourAction, TourStep, WorkflowMeta } from './tour-types';
12
+ /**
13
+ * Execute a highlight action
14
+ */
15
+ export declare const executeHighlight: ActionExecutor<HighlightAction>;
16
+ /**
17
+ * Execute a pulse action
18
+ */
19
+ export declare const executePulse: ActionExecutor<PulseAction>;
20
+ /**
21
+ * Execute a badge action
22
+ */
23
+ export declare const executeBadge: ActionExecutor<BadgeAction>;
24
+ /**
25
+ * Execute a tooltip action
26
+ */
27
+ export declare const executeTooltip: ActionExecutor<TooltipAction>;
28
+ /**
29
+ * All executors provided by this app.
30
+ * These are registered with the runtime's ExecutorRegistry.
31
+ */
32
+ export declare const executors: readonly [{
33
+ readonly kind: "overlays:highlight";
34
+ readonly executor: ActionExecutor<HighlightAction>;
35
+ }, {
36
+ readonly kind: "overlays:pulse";
37
+ readonly executor: ActionExecutor<PulseAction>;
38
+ }, {
39
+ readonly kind: "overlays:badge";
40
+ readonly executor: ActionExecutor<BadgeAction>;
41
+ }, {
42
+ readonly kind: "overlays:tooltip";
43
+ readonly executor: ActionExecutor<TooltipAction>;
44
+ }, {
45
+ readonly kind: "overlays:modal";
46
+ readonly executor: ActionExecutor<import("./types").ModalAction>;
47
+ }, {
48
+ readonly kind: "overlays:tour";
49
+ readonly executor: ActionExecutor<import("./tour-types").TourAction>;
50
+ }, {
51
+ readonly kind: "overlays:celebrate";
52
+ readonly executor: ActionExecutor<import("./types").CelebrateAction>;
53
+ }];
54
+ /**
55
+ * App runtime manifest (Lit variant).
56
+ */
57
+ export declare const runtime: {
58
+ id: string;
59
+ version: string;
60
+ name: string;
61
+ description: string;
62
+ executors: readonly [{
63
+ readonly kind: "overlays:highlight";
64
+ readonly executor: ActionExecutor<HighlightAction>;
65
+ }, {
66
+ readonly kind: "overlays:pulse";
67
+ readonly executor: ActionExecutor<PulseAction>;
68
+ }, {
69
+ readonly kind: "overlays:badge";
70
+ readonly executor: ActionExecutor<BadgeAction>;
71
+ }, {
72
+ readonly kind: "overlays:tooltip";
73
+ readonly executor: ActionExecutor<TooltipAction>;
74
+ }, {
75
+ readonly kind: "overlays:modal";
76
+ readonly executor: ActionExecutor<import("./types").ModalAction>;
77
+ }, {
78
+ readonly kind: "overlays:tour";
79
+ readonly executor: ActionExecutor<import("./tour-types").TourAction>;
80
+ }, {
81
+ readonly kind: "overlays:celebrate";
82
+ readonly executor: ActionExecutor<import("./types").CelebrateAction>;
83
+ }];
84
+ widgets: {
85
+ id: string;
86
+ component: import("./WorkflowWidgetLit").MountableWidget;
87
+ metadata: {
88
+ name: string;
89
+ icon: string;
90
+ description: string;
91
+ };
92
+ }[];
93
+ };
94
+ //# sourceMappingURL=runtime-lit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-lit.d.ts","sourceRoot":"","sources":["../src/runtime-lit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EAEX,eAAe,EACf,WAAW,EACX,aAAa,EACd,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AAGrC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAMvE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,eAAe,CAsE5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,WAAW,CA0GpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,WAAW,CAoGpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CAwFxD,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;EAQZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBnB,CAAC"}
@@ -0,0 +1,402 @@
1
+ /**
2
+ * Adaptive Overlays - Runtime Module (Lit)
3
+ *
4
+ * Visual overlay actions: highlight, pulse, badge, tooltip, celebrations.
5
+ * Uses the Lit web component mountable instead of the React one.
6
+ */
7
+ import { executeCelebrate } from './celebrations';
8
+ import { executeTour } from './executors/tour';
9
+ import { showHighlight } from './highlight';
10
+ import { executeModal } from './modal';
11
+ import { sanitizeHtml } from './sanitizer';
12
+ import { showTooltip } from './tooltip';
13
+ import { WorkflowWidgetLitMountable } from './WorkflowWidgetLit';
14
+ // Re-export executeModal and executeTour for use by other packages
15
+ export { executeModal, executeTour };
16
+ // ============================================================================
17
+ // Executors
18
+ // ============================================================================
19
+ /**
20
+ * Execute a highlight action
21
+ */
22
+ export const executeHighlight = async (action, context) => {
23
+ let anchorEl = context.resolveAnchor(action.anchorId);
24
+ if (!anchorEl && context.waitForAnchor) {
25
+ anchorEl = await context.waitForAnchor(action.anchorId, 3000);
26
+ }
27
+ if (!anchorEl) {
28
+ console.warn(`[adaptive-overlays] Anchor not found after waiting: ${action.anchorId.selector}`);
29
+ return { cleanup: () => { } };
30
+ }
31
+ // Skip re-application if the user previously dismissed this highlight.
32
+ // The dismissed attribute is set by onDismiss (user click-outside / Esc)
33
+ // and survives config-driven revert+reapply cycles.
34
+ if (anchorEl.getAttribute('data-syntro-highlight-dismissed')) {
35
+ return { cleanup: () => { } };
36
+ }
37
+ // Self-guard: destroy any existing highlight on this anchor to prevent duplicates
38
+ // (batch re-apply on navigation can call this executor multiple times for the same anchor)
39
+ const existing = anchorEl.getAttribute('data-syntro-highlight');
40
+ if (existing) {
41
+ const prev = context.overlayRoot.querySelectorAll('.syntro-spotlight-scrim, .syntro-spotlight-ring');
42
+ prev.forEach((el) => el.remove());
43
+ }
44
+ anchorEl.setAttribute('data-syntro-highlight', 'true');
45
+ // Resolve ring color: action override → theme primary → host page var → fallback
46
+ let ringColor = action.style?.color;
47
+ if (!ringColor) {
48
+ try {
49
+ const primary = getComputedStyle(context.overlayRoot)
50
+ .getPropertyValue('--sc-color-primary')
51
+ ?.trim();
52
+ if (primary)
53
+ ringColor = primary;
54
+ }
55
+ catch {
56
+ /* fallback to showHighlight default */
57
+ }
58
+ }
59
+ const handle = showHighlight(anchorEl, context.overlayRoot, {
60
+ paddingPx: action.style?.paddingPx ?? 12,
61
+ radiusPx: action.style?.radiusPx ?? 12,
62
+ scrimOpacity: action.style?.scrimOpacity ?? 0.55,
63
+ ringColor,
64
+ blocking: action.blocking ?? false,
65
+ onClickOutside: action.onClickOutside ?? true,
66
+ onEsc: action.onEsc ?? true,
67
+ onDismiss: () => {
68
+ anchorEl.setAttribute('data-syntro-highlight-dismissed', 'true');
69
+ },
70
+ });
71
+ context.publishEvent('action.applied', {
72
+ id: context.generateId(),
73
+ kind: 'overlays:highlight',
74
+ anchorId: action.anchorId,
75
+ });
76
+ return {
77
+ cleanup: () => {
78
+ handle.destroy();
79
+ anchorEl.removeAttribute('data-syntro-highlight');
80
+ anchorEl.removeAttribute('data-syntro-highlight-dismissed');
81
+ },
82
+ };
83
+ };
84
+ /**
85
+ * Execute a pulse action
86
+ */
87
+ export const executePulse = async (action, context) => {
88
+ let anchorEl = context.resolveAnchor(action.anchorId);
89
+ if (!anchorEl && context.waitForAnchor) {
90
+ anchorEl = await context.waitForAnchor(action.anchorId, 3000);
91
+ }
92
+ if (!anchorEl) {
93
+ console.warn(`[adaptive-overlays] Anchor not found after waiting: ${action.anchorId.selector}`);
94
+ return { cleanup: () => { } };
95
+ }
96
+ const duration = action.duration ?? 4000;
97
+ // Wait one frame so ThemeProvider's useEffect has injected CSS vars
98
+ await new Promise((resolve) => requestAnimationFrame(resolve));
99
+ // Read primary + secondary colors from theme (shadow DOM overlay root has --sc-* vars)
100
+ const parseHex = (hex) => ({
101
+ r: parseInt(hex.slice(1, 3), 16),
102
+ g: parseInt(hex.slice(3, 5), 16),
103
+ b: parseInt(hex.slice(5, 7), 16),
104
+ });
105
+ const fallback = { r: 79, g: 70, b: 229 }; // indigo-600
106
+ let primary = fallback;
107
+ let secondary = null;
108
+ try {
109
+ const styles = getComputedStyle(context.overlayRoot);
110
+ const pHex = styles.getPropertyValue('--sc-color-primary')?.trim();
111
+ const sHex = styles.getPropertyValue('--sc-color-primary-hover')?.trim();
112
+ if (pHex?.startsWith('#') && pHex.length >= 7) {
113
+ primary = parseHex(pHex);
114
+ }
115
+ if (sHex?.startsWith('#') && sHex.length >= 7) {
116
+ secondary = parseHex(sHex);
117
+ }
118
+ }
119
+ catch {
120
+ /* fallback to default */
121
+ }
122
+ // Inject/update pulse animation with theme colors
123
+ // Two-tone pulse when both primary and secondary are available
124
+ const existing = document.querySelector('[data-syntro-pulse-styles]');
125
+ if (existing)
126
+ existing.remove();
127
+ const style = document.createElement('style');
128
+ style.setAttribute('data-syntro-pulse-styles', '');
129
+ const { r: pr, g: pg, b: pb } = primary;
130
+ if (secondary) {
131
+ const { r: sr, g: sg, b: sb } = secondary;
132
+ style.textContent = `
133
+ @keyframes syntro-pulse-anim {
134
+ 0%, 100% {
135
+ box-shadow: 0 0 0 0 rgba(${pr}, ${pg}, ${pb}, 0.35);
136
+ }
137
+ 25% {
138
+ box-shadow: 0 0 0 12px rgba(${pr}, ${pg}, ${pb}, 0);
139
+ }
140
+ 50% {
141
+ box-shadow: 0 0 0 0 rgba(${sr}, ${sg}, ${sb}, 0.35);
142
+ }
143
+ 75% {
144
+ box-shadow: 0 0 0 12px rgba(${sr}, ${sg}, ${sb}, 0);
145
+ }
146
+ }
147
+ `;
148
+ }
149
+ else {
150
+ style.textContent = `
151
+ @keyframes syntro-pulse-anim {
152
+ 0%, 100% {
153
+ box-shadow: 0 0 0 0 rgba(${pr}, ${pg}, ${pb}, 0.35);
154
+ }
155
+ 50% {
156
+ box-shadow: 0 0 0 12px rgba(${pr}, ${pg}, ${pb}, 0);
157
+ }
158
+ }
159
+ `;
160
+ }
161
+ document.head.appendChild(style);
162
+ // Apply pulse animation via inline style (scoped to this element)
163
+ const originalAnimation = anchorEl.style.animation;
164
+ anchorEl.style.animation = 'syntro-pulse-anim 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite';
165
+ anchorEl.setAttribute('data-syntro-pulse', 'true');
166
+ // Set up auto-remove timeout
167
+ const timeoutId = setTimeout(() => {
168
+ anchorEl.style.animation = originalAnimation;
169
+ anchorEl.removeAttribute('data-syntro-pulse');
170
+ }, duration);
171
+ context.publishEvent('action.applied', {
172
+ id: context.generateId(),
173
+ kind: 'overlays:pulse',
174
+ anchorId: action.anchorId,
175
+ duration,
176
+ });
177
+ return {
178
+ cleanup: () => {
179
+ clearTimeout(timeoutId);
180
+ if (!anchorEl.isConnected)
181
+ return;
182
+ anchorEl.style.animation = originalAnimation;
183
+ anchorEl.removeAttribute('data-syntro-pulse');
184
+ },
185
+ };
186
+ };
187
+ /**
188
+ * Execute a badge action
189
+ */
190
+ export const executeBadge = async (action, context) => {
191
+ let anchorEl = context.resolveAnchor(action.anchorId);
192
+ if (!anchorEl && context.waitForAnchor) {
193
+ anchorEl = await context.waitForAnchor(action.anchorId, 3000);
194
+ }
195
+ if (!anchorEl) {
196
+ console.warn(`[adaptive-overlays] Anchor not found after waiting: ${action.anchorId.selector}`);
197
+ return { cleanup: () => { } };
198
+ }
199
+ // Read primary color from theme (overlay root has --sc-* vars from shadow DOM)
200
+ let badgeColor = '#4f46e5';
201
+ try {
202
+ const primary = getComputedStyle(context.overlayRoot)
203
+ .getPropertyValue('--sc-color-primary')
204
+ ?.trim();
205
+ if (primary?.startsWith('#') && primary.length >= 7) {
206
+ badgeColor = primary;
207
+ }
208
+ }
209
+ catch {
210
+ /* fallback to default */
211
+ }
212
+ // Create badge element with inline styles (no global style injection)
213
+ const badge = document.createElement('div');
214
+ badge.textContent = action.content;
215
+ badge.setAttribute('data-syntro-badge', action.anchorId.selector);
216
+ // Apply styles directly to element
217
+ Object.assign(badge.style, {
218
+ position: 'absolute',
219
+ padding: '2px 6px',
220
+ fontSize: '12px',
221
+ fontWeight: '600',
222
+ lineHeight: '1',
223
+ color: 'white',
224
+ background: badgeColor,
225
+ borderRadius: '9999px',
226
+ pointerEvents: 'none',
227
+ zIndex: '2147483646',
228
+ whiteSpace: 'nowrap',
229
+ });
230
+ // Position badge relative to anchor
231
+ const position = action.position ?? 'top-right';
232
+ // Ensure anchor has relative positioning for badge
233
+ const originalPosition = anchorEl.style.position;
234
+ if (getComputedStyle(anchorEl).position === 'static') {
235
+ anchorEl.style.position = 'relative';
236
+ }
237
+ // Append to anchor for relative positioning
238
+ anchorEl.appendChild(badge);
239
+ // Position based on config
240
+ switch (position) {
241
+ case 'top-left':
242
+ Object.assign(badge.style, { top: '-8px', left: '-8px' });
243
+ break;
244
+ case 'top-right':
245
+ Object.assign(badge.style, { top: '-8px', right: '-8px' });
246
+ break;
247
+ case 'bottom-left':
248
+ Object.assign(badge.style, { bottom: '-8px', left: '-8px' });
249
+ break;
250
+ case 'bottom-right':
251
+ Object.assign(badge.style, { bottom: '-8px', right: '-8px' });
252
+ break;
253
+ }
254
+ context.publishEvent('action.applied', {
255
+ id: context.generateId(),
256
+ kind: 'overlays:badge',
257
+ anchorId: action.anchorId,
258
+ content: action.content,
259
+ position,
260
+ });
261
+ return {
262
+ cleanup: () => {
263
+ try {
264
+ badge.remove();
265
+ }
266
+ catch {
267
+ /* already detached */
268
+ }
269
+ if (!anchorEl.isConnected)
270
+ return;
271
+ if (originalPosition !== undefined) {
272
+ anchorEl.style.position = originalPosition;
273
+ }
274
+ },
275
+ updateFn: (changes) => {
276
+ if ('content' in changes && typeof changes.content === 'string') {
277
+ badge.textContent = changes.content;
278
+ }
279
+ },
280
+ };
281
+ };
282
+ /**
283
+ * Execute a tooltip action
284
+ */
285
+ export const executeTooltip = async (action, context) => {
286
+ let anchorEl = context.resolveAnchor(action.anchorId);
287
+ if (!anchorEl && context.waitForAnchor) {
288
+ anchorEl = await context.waitForAnchor(action.anchorId, 3000);
289
+ }
290
+ if (!anchorEl) {
291
+ console.warn(`[adaptive-overlays] Anchor not found after waiting: ${action.anchorId.selector}`);
292
+ return { cleanup: () => { } };
293
+ }
294
+ // Build tooltip HTML
295
+ const { content } = action;
296
+ let html = '';
297
+ if (content.title) {
298
+ html += `<div class="syntro-tt-title">${sanitizeHtml(content.title)}</div>`;
299
+ }
300
+ html += `<div class="syntro-tt-body">${sanitizeHtml(content.body)}</div>`;
301
+ // Add CTA buttons if provided (new multi-button support)
302
+ if (content.ctaButtons && content.ctaButtons.length > 0) {
303
+ html += `<div class="syntro-tt-actions">`;
304
+ for (const btn of content.ctaButtons) {
305
+ const isPrimary = btn.primary ?? false;
306
+ html += `
307
+ <button
308
+ class="syntro-tt-btn ${isPrimary ? 'syntro-tt-btn-primary' : ''}"
309
+ data-syntro-action="${sanitizeHtml(btn.actionId)}"
310
+ >
311
+ ${sanitizeHtml(btn.label)}
312
+ </button>
313
+ `;
314
+ }
315
+ html += `</div>`;
316
+ }
317
+ else if (content.cta) {
318
+ // Legacy single CTA support
319
+ html += `<div class="syntro-tt-actions">
320
+ <button class="syntro-tt-btn syntro-tt-btn-primary" data-syntro-action="cta">
321
+ ${sanitizeHtml(content.cta.label)}
322
+ </button>
323
+ </div>`;
324
+ }
325
+ const handle = showTooltip(anchorEl, context.overlayRoot, {
326
+ html,
327
+ placement: action.placement ?? 'top',
328
+ trigger: action.trigger ?? 'immediate',
329
+ onAction: (actionId) => {
330
+ // Handle dismiss CTA — destroy the tooltip
331
+ if (actionId === 'dismiss') {
332
+ handle.destroy();
333
+ return;
334
+ }
335
+ if (actionId === 'cta' && content.cta) {
336
+ context.publishEvent('action.cta_clicked', {
337
+ anchorId: action.anchorId,
338
+ ctaLabel: content.cta.label,
339
+ });
340
+ }
341
+ else if (content.ctaButtons) {
342
+ const clickedBtn = content.ctaButtons.find((b) => b.actionId === actionId);
343
+ if (clickedBtn) {
344
+ context.publishEvent('action.tooltip_cta_clicked', {
345
+ anchorId: action.anchorId,
346
+ actionId,
347
+ label: clickedBtn.label,
348
+ });
349
+ }
350
+ }
351
+ handle.destroy();
352
+ },
353
+ });
354
+ context.publishEvent('action.applied', {
355
+ id: context.generateId(),
356
+ kind: 'overlays:tooltip',
357
+ anchorId: action.anchorId,
358
+ trigger: action.trigger ?? 'immediate',
359
+ });
360
+ return {
361
+ cleanup: () => {
362
+ handle.destroy();
363
+ },
364
+ };
365
+ };
366
+ // ============================================================================
367
+ // Executor Definitions for Registration
368
+ // ============================================================================
369
+ /**
370
+ * All executors provided by this app.
371
+ * These are registered with the runtime's ExecutorRegistry.
372
+ */
373
+ export const executors = [
374
+ { kind: 'overlays:highlight', executor: executeHighlight },
375
+ { kind: 'overlays:pulse', executor: executePulse },
376
+ { kind: 'overlays:badge', executor: executeBadge },
377
+ { kind: 'overlays:tooltip', executor: executeTooltip },
378
+ { kind: 'overlays:modal', executor: executeModal },
379
+ { kind: 'overlays:tour', executor: executeTour },
380
+ { kind: 'overlays:celebrate', executor: executeCelebrate },
381
+ ];
382
+ /**
383
+ * App runtime manifest (Lit variant).
384
+ */
385
+ export const runtime = {
386
+ id: 'adaptive-overlays',
387
+ version: '1.0.0',
388
+ name: 'Overlays',
389
+ description: 'Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking',
390
+ executors,
391
+ widgets: [
392
+ {
393
+ id: 'adaptive-overlays:workflow-tracker',
394
+ component: WorkflowWidgetLitMountable,
395
+ metadata: {
396
+ name: 'Workflow Tracker',
397
+ icon: '📋',
398
+ description: 'Tracks multi-step workflow progress across tours',
399
+ },
400
+ },
401
+ ],
402
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EAEX,eAAe,EACf,WAAW,EACX,aAAa,EACd,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AAGrC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAMvE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,eAAe,CAsE5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,WAAW,CA0GpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,WAAW,CAoGpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CAwFxD,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;EAQZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBnB,CAAC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EAEX,eAAe,EACf,WAAW,EACX,aAAa,EACd,MAAM,SAAS,CAAC;AAKjB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AAGrC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAMvE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,eAAe,CAsE5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,WAAW,CA0GpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,WAAW,CAoGpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CAwFxD,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;EAQZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BnB,CAAC"}
package/dist/runtime.js CHANGED
@@ -10,6 +10,7 @@ import { executeModal } from './modal';
10
10
  import { sanitizeHtml } from './sanitizer';
11
11
  import { showTooltip } from './tooltip';
12
12
  import { WorkflowMountableWidget } from './WorkflowWidget';
13
+ import { WorkflowWidgetLitMountable } from './WorkflowWidgetLit';
13
14
  // Re-export executeModal and executeTour for use by other packages
14
15
  export { executeModal, executeTour };
15
16
  // ============================================================================
@@ -397,5 +398,14 @@ export const runtime = {
397
398
  description: 'Tracks multi-step workflow progress across tours',
398
399
  },
399
400
  },
401
+ {
402
+ id: 'adaptive-overlays:workflow-tracker-lit',
403
+ component: WorkflowWidgetLitMountable,
404
+ metadata: {
405
+ name: 'Workflow Tracker (Lit)',
406
+ icon: '📋',
407
+ description: 'Lit web component equivalent of the Workflow Tracker — decorator-free, light DOM',
408
+ },
409
+ },
400
410
  ],
401
411
  };
package/dist/schema.d.ts CHANGED
@@ -121,7 +121,7 @@ export declare const configSchema: z.ZodObject<{
121
121
  } | undefined;
122
122
  };
123
123
  trigger?: "click" | "immediate" | "hover" | undefined;
124
- placement?: "bottom" | "left" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
124
+ placement?: "left" | "bottom" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
125
125
  }, {
126
126
  summary: string;
127
127
  anchorId: {
@@ -137,7 +137,7 @@ export declare const configSchema: z.ZodObject<{
137
137
  } | undefined;
138
138
  };
139
139
  trigger?: "click" | "immediate" | "hover" | undefined;
140
- placement?: "bottom" | "left" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
140
+ placement?: "left" | "bottom" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
141
141
  }>, "many">>;
142
142
  /** Badge configurations */
143
143
  badges: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -365,7 +365,7 @@ export declare const configSchema: z.ZodObject<{
365
365
  } | undefined;
366
366
  };
367
367
  trigger?: "click" | "immediate" | "hover" | undefined;
368
- placement?: "bottom" | "left" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
368
+ placement?: "left" | "bottom" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
369
369
  }[] | undefined;
370
370
  badges?: {
371
371
  summary: string;
@@ -447,7 +447,7 @@ export declare const configSchema: z.ZodObject<{
447
447
  } | undefined;
448
448
  };
449
449
  trigger?: "click" | "immediate" | "hover" | undefined;
450
- placement?: "bottom" | "left" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
450
+ placement?: "left" | "bottom" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
451
451
  }[] | undefined;
452
452
  badges?: {
453
453
  summary: string;
@@ -7,4 +7,6 @@ export * from './colors';
7
7
  export { default as colors } from './colors';
8
8
  export * from './effects';
9
9
  export { default as effects } from './effects';
10
+ export * from './panel-shell';
11
+ export { default as panelShell } from './panel-shell';
10
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAE7C,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAE7C,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAE/C,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -7,3 +7,5 @@ export * from './colors';
7
7
  export { default as colors } from './colors';
8
8
  export * from './effects';
9
9
  export { default as effects } from './effects';
10
+ export * from './panel-shell';
11
+ export { default as panelShell } from './panel-shell';
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Syntro Design System — Editor Panel Shell Tokens
3
+ *
4
+ * Single source of truth for the floating editor panel's visuals and behavior.
5
+ * Consumed by:
6
+ * - packages/shared-editor-ui/src/components/EditorPanelShell.tsx (React)
7
+ * - packages/shared-editor-ui/src/controllers/PanelShellController.ts (Lit)
8
+ *
9
+ * Any change here updates both React and Lit panels in one step — no drift.
10
+ */
11
+ /** Dark gradient rendered behind the panel contents (backdrop-blur layered on). */
12
+ export declare const panelBackground = "linear-gradient(160deg, rgba(7,8,10,0.84) 0%, rgba(14,17,20,0.88) 45%, rgba(15,19,24,0.84) 100%)";
13
+ /** Outer shadows for the panel, indexed by dock state. */
14
+ export declare const panelShadows: {
15
+ /** Free-floating panel — shadow all sides. */
16
+ readonly floating: "0 8px 60px rgba(0,0,0,0.5)";
17
+ /** Docked to left — shadow cast rightward into page. */
18
+ readonly dockedLeft: "20px 0 60px rgba(0,0,0,0.5)";
19
+ /** Docked to right — shadow cast leftward into page. */
20
+ readonly dockedRight: "-20px 0 60px rgba(0,0,0,0.5)";
21
+ };
22
+ /** Backdrop-filter blur radius applied to the panel surface. */
23
+ export declare const panelBackdropBlur = "12px";
24
+ export declare const fab: {
25
+ /** Diameter in pixels. */
26
+ readonly size: 56;
27
+ /** Inset from the panel's top-left corner in pixels. */
28
+ readonly inset: 12;
29
+ /** Background color (always the brand black). */
30
+ readonly background: "#000000";
31
+ /** Icon / logo color. */
32
+ readonly color: "#ffffff";
33
+ /** Border — 2px brand red ring. */
34
+ readonly border: "2px solid #b72e2a";
35
+ /** Shadow when the panel is open (inner ring for "active" state). */
36
+ readonly shadowOpen: "0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)";
37
+ /** Shadow when the panel is closed. */
38
+ readonly shadowClosed: "0 4px 24px rgba(0,0,0,0.6)";
39
+ };
40
+ export declare const panelBehavior: {
41
+ /** Minimum panel width when resizing or undocked. */
42
+ readonly minWidth: 480;
43
+ /** Minimum panel height when resizing or undocked. */
44
+ readonly minHeight: 400;
45
+ /** Edge thickness of resize handles in pixels. */
46
+ readonly handleSize: 8;
47
+ /** Pixels the FAB must move before a press becomes a drag (vs a click). */
48
+ readonly dragThreshold: 5;
49
+ /** Distance from a viewport edge that triggers edge-dock snapping. */
50
+ readonly snapThreshold: 20;
51
+ };
52
+ export declare const panelShell: {
53
+ readonly background: "linear-gradient(160deg, rgba(7,8,10,0.84) 0%, rgba(14,17,20,0.88) 45%, rgba(15,19,24,0.84) 100%)";
54
+ readonly shadows: {
55
+ /** Free-floating panel — shadow all sides. */
56
+ readonly floating: "0 8px 60px rgba(0,0,0,0.5)";
57
+ /** Docked to left — shadow cast rightward into page. */
58
+ readonly dockedLeft: "20px 0 60px rgba(0,0,0,0.5)";
59
+ /** Docked to right — shadow cast leftward into page. */
60
+ readonly dockedRight: "-20px 0 60px rgba(0,0,0,0.5)";
61
+ };
62
+ readonly backdropBlur: "12px";
63
+ readonly fab: {
64
+ /** Diameter in pixels. */
65
+ readonly size: 56;
66
+ /** Inset from the panel's top-left corner in pixels. */
67
+ readonly inset: 12;
68
+ /** Background color (always the brand black). */
69
+ readonly background: "#000000";
70
+ /** Icon / logo color. */
71
+ readonly color: "#ffffff";
72
+ /** Border — 2px brand red ring. */
73
+ readonly border: "2px solid #b72e2a";
74
+ /** Shadow when the panel is open (inner ring for "active" state). */
75
+ readonly shadowOpen: "0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)";
76
+ /** Shadow when the panel is closed. */
77
+ readonly shadowClosed: "0 4px 24px rgba(0,0,0,0.6)";
78
+ };
79
+ readonly behavior: {
80
+ /** Minimum panel width when resizing or undocked. */
81
+ readonly minWidth: 480;
82
+ /** Minimum panel height when resizing or undocked. */
83
+ readonly minHeight: 400;
84
+ /** Edge thickness of resize handles in pixels. */
85
+ readonly handleSize: 8;
86
+ /** Pixels the FAB must move before a press becomes a drag (vs a click). */
87
+ readonly dragThreshold: 5;
88
+ /** Distance from a viewport edge that triggers edge-dock snapping. */
89
+ readonly snapThreshold: 20;
90
+ };
91
+ };
92
+ export default panelShell;
93
+ //# sourceMappingURL=panel-shell.d.ts.map