@syntrologie/adapt-content 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.
Files changed (171) hide show
  1. package/dist/runtime.js +425 -366
  2. package/dist/runtime.js.map +7 -0
  3. package/dist/schema.d.ts +55 -16
  4. package/dist/schema.d.ts.map +1 -1
  5. package/dist/schema.js +316 -62
  6. package/dist/schema.js.map +7 -0
  7. package/package.json +2 -20
  8. package/dist/cdn.d.ts +0 -35
  9. package/dist/cdn.d.ts.map +0 -1
  10. package/dist/cdn.js +0 -39
  11. package/dist/components/AnchorPicker.d.ts +0 -8
  12. package/dist/components/AnchorPicker.d.ts.map +0 -1
  13. package/dist/components/AnchorPicker.js +0 -6
  14. package/dist/content-editor-state.d.ts +0 -45
  15. package/dist/content-editor-state.d.ts.map +0 -1
  16. package/dist/content-editor-state.js +0 -123
  17. package/dist/content-editor-ui.d.ts +0 -26
  18. package/dist/content-editor-ui.d.ts.map +0 -1
  19. package/dist/content-editor-ui.js +0 -291
  20. package/dist/editor.d.ts +0 -9
  21. package/dist/editor.d.ts.map +0 -1
  22. package/dist/editor.js +0 -8
  23. package/dist/reconciliation-guard.js +0 -80
  24. package/dist/sanitizer.js +0 -95
  25. package/dist/summarize.js +0 -88
  26. package/dist/types.js +0 -7
  27. package/dist/utils/selectorGenerator.d.ts +0 -6
  28. package/dist/utils/selectorGenerator.d.ts.map +0 -1
  29. package/dist/utils/selectorGenerator.js +0 -4
  30. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts +0 -2
  31. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts.map +0 -1
  32. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.js +0 -3
  33. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +0 -34
  34. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +0 -1
  35. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +0 -161
  36. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts +0 -84
  37. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts.map +0 -1
  38. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.js +0 -323
  39. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts +0 -7
  40. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +0 -1
  41. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +0 -9
  42. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts +0 -25
  43. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts.map +0 -1
  44. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.js +0 -55
  45. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +0 -23
  46. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +0 -1
  47. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +0 -40
  48. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts +0 -33
  49. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts.map +0 -1
  50. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.js +0 -118
  51. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +0 -7
  52. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +0 -1
  53. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +0 -22
  54. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts +0 -32
  55. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts.map +0 -1
  56. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.js +0 -68
  57. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts +0 -8
  58. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts.map +0 -1
  59. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +0 -9
  60. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts +0 -34
  61. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts.map +0 -1
  62. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.js +0 -57
  63. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts +0 -7
  64. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +0 -1
  65. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +0 -4
  66. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts +0 -13
  67. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts.map +0 -1
  68. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.js +0 -31
  69. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts +0 -7
  70. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts.map +0 -1
  71. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.js +0 -4
  72. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts +0 -7
  73. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts.map +0 -1
  74. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.js +0 -15
  75. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts +0 -13
  76. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +0 -1
  77. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +0 -15
  78. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts +0 -36
  79. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts.map +0 -1
  80. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.js +0 -102
  81. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts +0 -7
  82. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +0 -1
  83. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +0 -4
  84. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts +0 -20
  85. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts.map +0 -1
  86. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.js +0 -48
  87. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts +0 -9
  88. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts.map +0 -1
  89. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.js +0 -4
  90. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts +0 -16
  91. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts.map +0 -1
  92. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.js +0 -25
  93. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +0 -8
  94. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +0 -1
  95. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +0 -8
  96. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts +0 -66
  97. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts.map +0 -1
  98. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.js +0 -87
  99. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts +0 -7
  100. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts.map +0 -1
  101. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.js +0 -4
  102. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts +0 -7
  103. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts.map +0 -1
  104. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.js +0 -15
  105. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +0 -25
  106. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +0 -1
  107. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +0 -390
  108. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts +0 -66
  109. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts.map +0 -1
  110. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.js +0 -528
  111. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +0 -8
  112. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +0 -1
  113. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +0 -8
  114. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts +0 -41
  115. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts.map +0 -1
  116. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.js +0 -63
  117. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +0 -8
  118. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +0 -1
  119. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +0 -17
  120. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts +0 -55
  121. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts.map +0 -1
  122. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.js +0 -92
  123. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts +0 -32
  124. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +0 -1
  125. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +0 -85
  126. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts +0 -90
  127. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts.map +0 -1
  128. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.js +0 -242
  129. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts +0 -6
  130. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts.map +0 -1
  131. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.js +0 -4
  132. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts +0 -12
  133. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts.map +0 -1
  134. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.js +0 -21
  135. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts +0 -8
  136. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts.map +0 -1
  137. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.js +0 -5
  138. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts +0 -21
  139. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts.map +0 -1
  140. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.js +0 -33
  141. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +0 -12
  142. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +0 -1
  143. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +0 -40
  144. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts +0 -28
  145. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts.map +0 -1
  146. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.js +0 -121
  147. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts +0 -110
  148. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts.map +0 -1
  149. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.js +0 -481
  150. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +0 -26
  151. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +0 -1
  152. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +0 -202
  153. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts +0 -8
  154. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts.map +0 -1
  155. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.js +0 -46
  156. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts +0 -24
  157. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +0 -1
  158. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.js +0 -86
  159. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +0 -36
  160. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +0 -1
  161. package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +0 -26
  162. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts +0 -15
  163. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts.map +0 -1
  164. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.js +0 -14
  165. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts +0 -33
  166. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts.map +0 -1
  167. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.js +0 -68
  168. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts +0 -22
  169. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts.map +0 -1
  170. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.js +0 -143
  171. package/node_modules/@syntrologie/shared-editor-ui/package.json +0 -55
package/dist/sanitizer.js DELETED
@@ -1,95 +0,0 @@
1
- /**
2
- * HTML Sanitizer
3
- *
4
- * Sanitizes HTML to prevent XSS attacks.
5
- * Uses native Sanitizer API when available, falls back to whitelist approach.
6
- */
7
- const ALLOWED_TAGS = new Set([
8
- 'b',
9
- 'strong',
10
- 'i',
11
- 'em',
12
- 'u',
13
- 'span',
14
- 'div',
15
- 'p',
16
- 'br',
17
- 'ul',
18
- 'ol',
19
- 'li',
20
- 'code',
21
- 'pre',
22
- 'small',
23
- 'sup',
24
- 'sub',
25
- 'a',
26
- 'button',
27
- // SVG elements (for inline Lucide icons in config HTML)
28
- 'svg',
29
- 'path',
30
- 'circle',
31
- 'line',
32
- 'polyline',
33
- 'polygon',
34
- 'rect',
35
- 'g',
36
- ]);
37
- export function sanitizeHtml(html) {
38
- // Try native Sanitizer API first
39
- const hasNative = typeof window.Sanitizer === 'function';
40
- if (hasNative) {
41
- try {
42
- const s = new window.Sanitizer({});
43
- const frag = s.sanitizeToFragment(html);
44
- const div = document.createElement('div');
45
- div.append(frag);
46
- return div.innerHTML;
47
- }
48
- catch {
49
- // Fall through to manual sanitizer
50
- }
51
- }
52
- // Conservative fallback sanitizer
53
- const tpl = document.createElement('template');
54
- tpl.innerHTML = html;
55
- const root = tpl.content;
56
- const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, null);
57
- const toRemove = [];
58
- while (walker.nextNode()) {
59
- const el = walker.currentNode;
60
- const tag = el.tagName.toLowerCase();
61
- if (!ALLOWED_TAGS.has(tag)) {
62
- toRemove.push(el);
63
- continue;
64
- }
65
- // Remove dangerous attributes
66
- for (const attr of Array.from(el.attributes)) {
67
- const name = attr.name.toLowerCase();
68
- const value = attr.value.trim().toLowerCase();
69
- const isEvent = name.startsWith('on');
70
- const isUrlAttr = name === 'href' || name === 'src' || name === 'formaction';
71
- const isDangerousUrl = isUrlAttr &&
72
- (value.startsWith('javascript:') ||
73
- value.startsWith('vbscript:') ||
74
- value.startsWith('data:text/html'));
75
- if (isEvent || isDangerousUrl) {
76
- el.removeAttribute(attr.name);
77
- }
78
- }
79
- }
80
- // Strip SVG elements that contained script children (XSS vector)
81
- const svgs = Array.from(root.querySelectorAll('svg'));
82
- for (const svg of svgs) {
83
- if (toRemove.some((el) => svg.contains(el) && el.tagName.toLowerCase() === 'script')) {
84
- toRemove.push(svg);
85
- }
86
- }
87
- // Remove disallowed elements but keep their children
88
- for (const el of toRemove) {
89
- while (el.firstChild) {
90
- el.parentNode?.insertBefore(el.firstChild, el);
91
- }
92
- el.remove();
93
- }
94
- return tpl.innerHTML;
95
- }
package/dist/summarize.js DELETED
@@ -1,88 +0,0 @@
1
- /**
2
- * Human-readable summary generation for content config changes.
3
- *
4
- * Pure functions — no DOM access, just string formatting from config data.
5
- */
6
- const MAX_TEXT_LEN = 40;
7
- /** Extract the CSS selector string from an anchorId object. */
8
- function resolveAnchorSelector(anchorId) {
9
- if (!anchorId)
10
- return '';
11
- if (typeof anchorId === 'string')
12
- return anchorId;
13
- if (typeof anchorId === 'object')
14
- return anchorId.selector ?? '';
15
- return '';
16
- }
17
- /**
18
- * Convert a CSS selector into a human-friendly element description.
19
- */
20
- export function describeSelector(selector) {
21
- if (!selector)
22
- return '(no target)';
23
- // ID selector: strip # and common prefixes
24
- if (selector.startsWith('#')) {
25
- let name = selector.slice(1);
26
- const prefixes = ['hero-', 'main-', 'page-', 'app-', 'section-'];
27
- for (const prefix of prefixes) {
28
- if (name.startsWith(prefix)) {
29
- name = name.slice(prefix.length);
30
- break;
31
- }
32
- }
33
- return truncate(name, 50);
34
- }
35
- // data-testid selector
36
- const testIdMatch = selector.match(/\[data-testid="([^"]+)"\]/);
37
- if (testIdMatch) {
38
- return `${testIdMatch[1]} element`;
39
- }
40
- // Class selector or complex selector: keep as-is
41
- return truncate(selector, 50);
42
- }
43
- function truncate(text, max) {
44
- if (text.length <= max)
45
- return text;
46
- return `${text.slice(0, max)}...`;
47
- }
48
- function truncateQuoted(text, max) {
49
- if (text.length <= max)
50
- return `"${text}"`;
51
- return `"${text.slice(0, max)}..."`;
52
- }
53
- /**
54
- * Generate a human-readable one-liner for a content config change.
55
- */
56
- export function summarizeContentChange(type, item) {
57
- const desc = describeSelector(resolveAnchorSelector(item.anchorId));
58
- switch (type) {
59
- case 'textReplacements': {
60
- const text = item.text || '';
61
- return `Change ${desc} to ${truncateQuoted(text, MAX_TEXT_LEN)}`;
62
- }
63
- case 'attributeChanges': {
64
- const attr = item.attr || '';
65
- const value = item.value || '';
66
- return `Set ${desc} ${attr} to ${truncateQuoted(value, MAX_TEXT_LEN)}`;
67
- }
68
- case 'styleChanges': {
69
- const styles = item.styles || {};
70
- const count = Object.keys(styles).length;
71
- return `Restyle ${desc} (${count} ${count === 1 ? 'property' : 'properties'})`;
72
- }
73
- case 'htmlInsertions': {
74
- const position = item.position || 'append';
75
- return `Insert HTML ${position} ${desc}`;
76
- }
77
- case 'classAdditions': {
78
- const className = item.className || '';
79
- return `Add class "${className}" to ${desc}`;
80
- }
81
- case 'classRemovals': {
82
- const className = item.className || '';
83
- return `Remove class "${className}" from ${desc}`;
84
- }
85
- default:
86
- return `Unknown change on ${desc}`;
87
- }
88
- }
package/dist/types.js DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * Types from @syntrologie/runtime-sdk
3
- *
4
- * Minimal type definitions for building this app independently.
5
- * These match the types exported from @syntrologie/runtime-sdk/types.
6
- */
7
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * Re-export selector utilities from shared-editor-ui.
3
- */
4
- export type { SelectorOptions } from '@syntrologie/shared-editor-ui';
5
- export { generateSelector, getElementDescription, validateSelector, } from '@syntrologie/shared-editor-ui';
6
- //# sourceMappingURL=selectorGenerator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"selectorGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/selectorGenerator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC"}
@@ -1,4 +0,0 @@
1
- /**
2
- * Re-export selector utilities from shared-editor-ui.
3
- */
4
- export { generateSelector, getElementDescription, validateSelector, } from '@syntrologie/shared-editor-ui';
@@ -1,2 +0,0 @@
1
- export declare function cn(...classes: (string | false | null | undefined)[]): string;
2
- //# sourceMappingURL=cn.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../src/cn.ts"],"names":[],"mappings":"AAAA,wBAAgB,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CAE5E"}
@@ -1,3 +0,0 @@
1
- export function cn(...classes) {
2
- return classes.filter(Boolean).join(' ');
3
- }
@@ -1,34 +0,0 @@
1
- /**
2
- * AnchorPicker — Shared Element Picker Overlay
3
- *
4
- * Full-page overlay that lets the user hover and click to select a DOM element.
5
- * Returns the element, its CSS selector, and a human-readable description.
6
- *
7
- * Renders via createPortal to document.body. Uses inline styles (not Tailwind)
8
- * because it lives outside the editor's style scope.
9
- *
10
- * EXCEPTION: This component MUST stay on document.body (not in shadow root).
11
- * It uses document.elementFromPoint() to detect host page elements under the
12
- * cursor. If placed inside a shadow root, the overlay would block detection
13
- * of underlying host elements.
14
- *
15
- * Instructions / cancel UI should be rendered by the consumer in their own
16
- * panel — this component only provides the page overlay.
17
- */
18
- export interface PickedElement {
19
- element: Element;
20
- selector: string;
21
- description: string;
22
- }
23
- export interface AnchorPickerProps {
24
- isActive: boolean;
25
- onPick: (picked: PickedElement) => void;
26
- onCancel: () => void;
27
- /** When true, clicks pass through to the page (no preventDefault/stopPropagation).
28
- * The consumer is responsible for capturing the pick via EventBus or other means.
29
- * Hover highlighting still works for visual feedback. */
30
- passthroughClicks?: boolean;
31
- excludeSelector?: string;
32
- }
33
- export declare function AnchorPicker({ isActive, onPick, onCancel, passthroughClicks, excludeSelector, }: AnchorPickerProps): import("react").ReactPortal | null;
34
- //# sourceMappingURL=AnchorPicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnchorPicker.d.ts","sourceRoot":"","sources":["../../src/components/AnchorPicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAWH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;8DAE0D;IAC1D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAKD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,iBAAyB,EACzB,eAAuJ,GACxJ,EAAE,iBAAiB,sCA2MnB"}
@@ -1,161 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * AnchorPicker — Shared Element Picker Overlay
4
- *
5
- * Full-page overlay that lets the user hover and click to select a DOM element.
6
- * Returns the element, its CSS selector, and a human-readable description.
7
- *
8
- * Renders via createPortal to document.body. Uses inline styles (not Tailwind)
9
- * because it lives outside the editor's style scope.
10
- *
11
- * EXCEPTION: This component MUST stay on document.body (not in shadow root).
12
- * It uses document.elementFromPoint() to detect host page elements under the
13
- * cursor. If placed inside a shadow root, the overlay would block detection
14
- * of underlying host elements.
15
- *
16
- * Instructions / cancel UI should be rendered by the consumer in their own
17
- * panel — this component only provides the page overlay.
18
- */
19
- import { useCallback, useEffect, useRef, useState } from 'react';
20
- import { createPortal } from 'react-dom';
21
- import { generateSelector, getElementDescription, validateSelector, } from '../utils/selectorGenerator';
22
- const HIGHLIGHT_COLOR = '#3b82f6';
23
- const HIGHLIGHT_BG = 'rgba(59, 130, 246, 0.1)';
24
- export function AnchorPicker({ isActive, onPick, onCancel, passthroughClicks = false, excludeSelector = '[data-syntro-editor-panel], [data-shadow-canvas-id], .syntro-tooltip, .syntro-modal, .syntro-highlight, [data-syntro-anchor-picker]', }) {
25
- const [hoveredElement, setHoveredElement] = useState(null);
26
- const [hoveredSelector, setHoveredSelector] = useState('');
27
- const overlayRef = useRef(null);
28
- const handleMouseMove = useCallback((e) => {
29
- const overlay = overlayRef.current;
30
- // In passthrough mode the overlay is already pointerEvents:'none',
31
- // so elementFromPoint can see through it — no toggle needed.
32
- // In non-passthrough mode, temporarily disable to detect elements underneath.
33
- if (overlay && !passthroughClicks) {
34
- overlay.style.pointerEvents = 'none';
35
- }
36
- const elementAtPoint = document.elementFromPoint(e.clientX, e.clientY);
37
- if (overlay && !passthroughClicks) {
38
- overlay.style.pointerEvents = 'auto';
39
- }
40
- if (!elementAtPoint) {
41
- setHoveredElement(null);
42
- setHoveredSelector('');
43
- return;
44
- }
45
- if (excludeSelector && elementAtPoint.closest(excludeSelector)) {
46
- setHoveredElement(null);
47
- setHoveredSelector('');
48
- return;
49
- }
50
- if (['HTML', 'BODY', 'HEAD'].includes(elementAtPoint.tagName)) {
51
- setHoveredElement(null);
52
- setHoveredSelector('');
53
- return;
54
- }
55
- setHoveredElement(elementAtPoint);
56
- const selector = generateSelector(elementAtPoint);
57
- setHoveredSelector(selector);
58
- }, [excludeSelector, passthroughClicks]);
59
- const handleClick = useCallback((e) => {
60
- if (passthroughClicks)
61
- return; // Let click propagate to PostHog
62
- e.preventDefault();
63
- e.stopPropagation();
64
- if (hoveredElement && hoveredSelector) {
65
- if (validateSelector(hoveredSelector, hoveredElement)) {
66
- onPick({
67
- element: hoveredElement,
68
- selector: hoveredSelector,
69
- description: getElementDescription(hoveredElement),
70
- });
71
- }
72
- else {
73
- const newSelector = generateSelector(hoveredElement);
74
- onPick({
75
- element: hoveredElement,
76
- selector: newSelector,
77
- description: getElementDescription(hoveredElement),
78
- });
79
- }
80
- }
81
- }, [passthroughClicks, hoveredElement, hoveredSelector, onPick]);
82
- const handleKeyDown = useCallback((e) => {
83
- if (e.key === 'Escape') {
84
- e.preventDefault();
85
- onCancel();
86
- }
87
- }, [onCancel]);
88
- useEffect(() => {
89
- if (!isActive)
90
- return;
91
- document.addEventListener('mousemove', handleMouseMove, true);
92
- // In passthrough mode, don't register click handler — let clicks reach PostHog
93
- if (!passthroughClicks) {
94
- document.addEventListener('click', handleClick, true);
95
- }
96
- document.addEventListener('keydown', handleKeyDown, true);
97
- return () => {
98
- document.removeEventListener('mousemove', handleMouseMove, true);
99
- if (!passthroughClicks) {
100
- document.removeEventListener('click', handleClick, true);
101
- }
102
- document.removeEventListener('keydown', handleKeyDown, true);
103
- };
104
- }, [isActive, passthroughClicks, handleMouseMove, handleClick, handleKeyDown]);
105
- if (!isActive)
106
- return null;
107
- const rect = hoveredElement?.getBoundingClientRect();
108
- return createPortal(_jsxs("div", { ref: overlayRef, "data-syntro-anchor-picker": true, style: {
109
- position: 'fixed',
110
- inset: 0,
111
- cursor: 'crosshair',
112
- zIndex: 2147483644,
113
- pointerEvents: passthroughClicks ? 'none' : undefined,
114
- }, children: [_jsx("div", { style: {
115
- position: 'absolute',
116
- inset: 0,
117
- background: 'rgba(0, 0, 0, 0.08)',
118
- pointerEvents: 'none',
119
- } }), hoveredElement && rect && (_jsx("div", { style: {
120
- position: 'fixed',
121
- left: rect.left - 2,
122
- top: rect.top - 2,
123
- width: rect.width + 4,
124
- height: rect.height + 4,
125
- border: `2px solid ${HIGHLIGHT_COLOR}`,
126
- backgroundColor: HIGHLIGHT_BG,
127
- borderRadius: '4px',
128
- boxShadow: '0 0 0 9999px rgba(0, 0, 0, 0.2)',
129
- pointerEvents: 'none',
130
- transition: 'all 0.1s ease-out',
131
- } })), hoveredElement && rect && (_jsxs("div", { className: "se-text-xs", style: {
132
- position: 'fixed',
133
- left: Math.max(8, Math.min(rect.left, window.innerWidth - 320)),
134
- top: Math.max(8, rect.top - 68),
135
- backgroundColor: '#1e293b',
136
- color: '#e2e8f0',
137
- padding: '8px 12px',
138
- borderRadius: '6px',
139
- boxShadow: '0 4px 12px rgba(0, 0, 0, 0.3)',
140
- zIndex: 1,
141
- fontFamily: 'monospace',
142
- maxWidth: '300px',
143
- pointerEvents: 'none',
144
- }, children: [_jsx("div", { className: "se-text-xs", style: {
145
- textTransform: 'uppercase',
146
- letterSpacing: '0.05em',
147
- marginBottom: '4px',
148
- color: '#94a3b8',
149
- }, children: "Click to select" }), _jsx("div", { style: {
150
- color: '#38bdf8',
151
- overflow: 'hidden',
152
- textOverflow: 'ellipsis',
153
- whiteSpace: 'nowrap',
154
- }, children: hoveredSelector }), _jsx("div", { style: {
155
- marginTop: '4px',
156
- color: '#cbd5e1',
157
- overflow: 'hidden',
158
- textOverflow: 'ellipsis',
159
- whiteSpace: 'nowrap',
160
- }, children: getElementDescription(hoveredElement) })] }))] }), document.body);
161
- }
@@ -1,84 +0,0 @@
1
- /**
2
- * AnchorPickerLit — Shared Element Picker Overlay (Lit web component).
3
- *
4
- * Full-page overlay that lets the user hover and click to select a DOM element.
5
- * Returns the element, its CSS selector, and a human-readable description
6
- * via custom events.
7
- *
8
- * The overlay is rendered into a portal div appended to document.body, NOT
9
- * into the component's own render root. This is necessary because the editor
10
- * panel applies `backdrop-filter: blur(...)` which, in Chrome, creates a new
11
- * containing block for `position: fixed` descendants. Without the portal, the
12
- * highlight box coordinates (from getBoundingClientRect, which are viewport-
13
- * relative) would be interpreted relative to the panel, causing the highlight
14
- * to appear far off from the actual hovered element.
15
- *
16
- * Lit port of AnchorPicker.tsx — preserves all behavior including:
17
- * - Mouse tracking with elementFromPoint detection
18
- * - Passthrough click mode for PostHog integration
19
- * - Element highlight with info tooltip
20
- * - Escape key cancellation
21
- * - Exclude selector filtering
22
- */
23
- import { LitElement } from 'lit';
24
- export interface PickedElement {
25
- element: Element;
26
- selector: string;
27
- description: string;
28
- }
29
- export declare class AnchorPickerLit extends LitElement {
30
- static properties: {
31
- isActive: {
32
- type: BooleanConstructor;
33
- attribute: string;
34
- };
35
- passthroughClicks: {
36
- type: BooleanConstructor;
37
- attribute: string;
38
- };
39
- excludeSelector: {
40
- type: StringConstructor;
41
- attribute: string;
42
- };
43
- _hoveredElement: {
44
- state: boolean;
45
- };
46
- _hoveredSelector: {
47
- state: boolean;
48
- };
49
- };
50
- isActive: boolean;
51
- passthroughClicks: boolean;
52
- excludeSelector: string;
53
- private _hoveredElement;
54
- private _hoveredSelector;
55
- private _overlayEl;
56
- private _portalDiv;
57
- createRenderRoot(): this;
58
- connectedCallback(): void;
59
- disconnectedCallback(): void;
60
- updated(changed: Map<string, unknown>): void;
61
- /**
62
- * Create or update the body-level portal div.
63
- * Rendering into document.body ensures position:fixed coordinates are
64
- * relative to the viewport, not an ancestor with backdrop-filter.
65
- */
66
- private _syncPortal;
67
- private _destroyPortal;
68
- private _attachDocumentListeners;
69
- private _detachDocumentListeners;
70
- /**
71
- * Resolve the shadow host this picker lives inside, if any. When the picker
72
- * is mounted inside a shadow root (e.g. the editor SDK mounts inside
73
- * `<smart-canvas>`'s shadow), `document.elementFromPoint` returns the shadow
74
- * *host*, not the host page element beneath. Temporarily disabling pointer
75
- * events on the host lets hit-testing fall through to the host page.
76
- */
77
- private _getShadowHost;
78
- private _handleMouseMove;
79
- private _handleClick;
80
- private _handleKeyDown;
81
- render(): symbol;
82
- private _overlayTemplate;
83
- }
84
- //# sourceMappingURL=AnchorPickerLit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnchorPickerLit.d.ts","sourceRoot":"","sources":["../../src/components/AnchorPickerLit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAQ,UAAU,EAAgC,MAAM,KAAK,CAAC;AAarE,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAiBD,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,OAAgB,UAAU;;;;;;;;;;;;;;;;;;;MAOxB;IAEF,QAAQ,UAAS;IACjB,iBAAiB,UAAS;IAC1B,eAAe,EAAE,MAAM,CAA4B;IAGnD,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,gBAAgB,CAAM;IAG9B,OAAO,CAAC,UAAU,CAA+B;IAGjD,OAAO,CAAC,UAAU,CAA+B;IAIxC,gBAAgB;IAIhB,iBAAiB,IAAI,IAAI;IAOzB,oBAAoB,IAAI,IAAI;IAM5B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAiBrD;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,wBAAwB;IAQhC;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,gBAAgB,CA+CtB;IAEF,OAAO,CAAC,YAAY,CAwBlB;IAEF,OAAO,CAAC,cAAc,CAUpB;IAMO,MAAM;IAIf,OAAO,CAAC,gBAAgB;CA0GzB"}