@syntrologie/adapt-content 2.1.0 → 2.2.0-canary.1

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 (148) hide show
  1. package/dist/cdn.d.ts +1 -1
  2. package/dist/components/AnchorPicker.d.ts +5 -20
  3. package/dist/components/AnchorPicker.d.ts.map +1 -1
  4. package/dist/components/AnchorPicker.js +4 -181
  5. package/dist/editor.d.ts.map +1 -1
  6. package/dist/editor.js +51 -27
  7. package/dist/runtime.d.ts +1 -1
  8. package/dist/runtime.d.ts.map +1 -1
  9. package/dist/schema.d.ts +28 -28
  10. package/dist/types.d.ts +5 -15
  11. package/dist/types.d.ts.map +1 -1
  12. package/dist/utils/selectorGenerator.d.ts +3 -19
  13. package/dist/utils/selectorGenerator.d.ts.map +1 -1
  14. package/dist/utils/selectorGenerator.js +2 -119
  15. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/BeforeAfterToggle.test.d.ts +2 -0
  16. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/BeforeAfterToggle.test.d.ts.map +1 -0
  17. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/BeforeAfterToggle.test.js +28 -0
  18. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DetectionBadge.test.d.ts +2 -0
  19. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DetectionBadge.test.d.ts.map +1 -0
  20. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DetectionBadge.test.js +18 -0
  21. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.d.ts +2 -0
  22. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.d.ts.map +1 -0
  23. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.js +22 -0
  24. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditBackButton.test.d.ts +2 -0
  25. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditBackButton.test.d.ts.map +1 -0
  26. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditBackButton.test.js +20 -0
  27. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorBody.test.d.ts +2 -0
  28. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorBody.test.d.ts.map +1 -0
  29. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorBody.test.js +12 -0
  30. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.d.ts +2 -0
  31. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.d.ts.map +1 -0
  32. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.js +25 -0
  33. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorFooter.test.d.ts +2 -0
  34. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorFooter.test.d.ts.map +1 -0
  35. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorFooter.test.js +23 -0
  36. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorHeader.test.d.ts +2 -0
  37. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorHeader.test.d.ts.map +1 -0
  38. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorHeader.test.js +24 -0
  39. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorInput.test.d.ts +2 -0
  40. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorInput.test.d.ts.map +1 -0
  41. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorInput.test.js +26 -0
  42. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorLayout.test.d.ts +2 -0
  43. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorLayout.test.d.ts.map +1 -0
  44. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorLayout.test.js +13 -0
  45. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorSelect.test.d.ts +2 -0
  46. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorSelect.test.d.ts.map +1 -0
  47. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorSelect.test.js +22 -0
  48. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorTextarea.test.d.ts +2 -0
  49. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorTextarea.test.d.ts.map +1 -0
  50. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorTextarea.test.js +20 -0
  51. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.d.ts +2 -0
  52. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.d.ts.map +1 -0
  53. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.js +100 -0
  54. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EmptyState.test.d.ts +2 -0
  55. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EmptyState.test.d.ts.map +1 -0
  56. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EmptyState.test.js +10 -0
  57. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/GroupHeader.test.d.ts +2 -0
  58. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/GroupHeader.test.d.ts.map +1 -0
  59. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/GroupHeader.test.js +14 -0
  60. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/TriggerJourney.test.d.ts +2 -0
  61. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/TriggerJourney.test.d.ts.map +1 -0
  62. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/TriggerJourney.test.js +126 -0
  63. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/cn.test.d.ts +2 -0
  64. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/cn.test.d.ts.map +1 -0
  65. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/cn.test.js +16 -0
  66. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/formatConditionLabel.test.d.ts +2 -0
  67. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/formatConditionLabel.test.d.ts.map +1 -0
  68. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/formatConditionLabel.test.js +329 -0
  69. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useElementRect.test.d.ts +2 -0
  70. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useElementRect.test.d.ts.map +1 -0
  71. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useElementRect.test.js +112 -0
  72. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts +2 -0
  73. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts.map +1 -0
  74. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.js +3 -0
  75. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +31 -0
  76. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +1 -0
  77. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +152 -0
  78. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts +7 -0
  79. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +1 -0
  80. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +9 -0
  81. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +23 -0
  82. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +1 -0
  83. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +40 -0
  84. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +6 -0
  85. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +1 -0
  86. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +5 -0
  87. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts +8 -0
  88. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts.map +1 -0
  89. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +9 -0
  90. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts +7 -0
  91. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +1 -0
  92. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +4 -0
  93. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts +7 -0
  94. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts.map +1 -0
  95. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.js +4 -0
  96. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts +13 -0
  97. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +1 -0
  98. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +6 -0
  99. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts +7 -0
  100. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +1 -0
  101. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +4 -0
  102. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts +9 -0
  103. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts.map +1 -0
  104. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.js +4 -0
  105. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +8 -0
  106. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +1 -0
  107. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +5 -0
  108. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts +7 -0
  109. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts.map +1 -0
  110. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.js +4 -0
  111. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +23 -0
  112. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +1 -0
  113. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +116 -0
  114. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +8 -0
  115. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +1 -0
  116. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +5 -0
  117. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +8 -0
  118. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +1 -0
  119. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +15 -0
  120. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts +32 -0
  121. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +1 -0
  122. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +75 -0
  123. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts +6 -0
  124. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts.map +1 -0
  125. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.js +4 -0
  126. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts +8 -0
  127. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts.map +1 -0
  128. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.js +5 -0
  129. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +12 -0
  130. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +1 -0
  131. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +40 -0
  132. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +26 -0
  133. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +1 -0
  134. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +207 -0
  135. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts +8 -0
  136. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts.map +1 -0
  137. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.js +46 -0
  138. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useShowWhenStatus.d.ts +24 -0
  139. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useShowWhenStatus.d.ts.map +1 -0
  140. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useShowWhenStatus.js +215 -0
  141. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +33 -0
  142. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +1 -0
  143. package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +24 -0
  144. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts +22 -0
  145. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts.map +1 -0
  146. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.js +143 -0
  147. package/node_modules/@syntrologie/shared-editor-ui/package.json +45 -0
  148. package/package.json +17 -12
package/dist/cdn.d.ts CHANGED
@@ -16,7 +16,7 @@ export declare const manifest: {
16
16
  runtime: {
17
17
  actions: {
18
18
  kind: "content:insertHtml" | "content:setText" | "content:setAttr" | "content:addClass" | "content:removeClass" | "content:setStyle";
19
- executor: import("./types").ActionExecutor<import("./types").InsertHtmlAction> | import("./types").ActionExecutor<import("./types").SetTextAction> | import("./types").ActionExecutor<import("./types").SetAttrAction> | import("./types").ActionExecutor<import("./types").AddClassAction> | import("./types").ActionExecutor<import("./types").RemoveClassAction> | import("./types").ActionExecutor<import("./types").SetStyleAction>;
19
+ executor: import("packages/sdk-contracts/dist").ActionExecutor<import("./types").InsertHtmlAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").SetTextAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").SetAttrAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").AddClassAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").RemoveClassAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").SetStyleAction>;
20
20
  }[];
21
21
  };
22
22
  editor: {
@@ -1,23 +1,8 @@
1
1
  /**
2
- * AnchorPicker 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
- * Ported from editor-sdk for use in adaptive-content's create flow.
2
+ * Re-export AnchorPicker from shared-editor-ui.
3
+ * This file exists for backwards compatibility — all consumers should
4
+ * migrate to importing directly from @syntrologie/shared-editor-ui.
8
5
  */
9
- import React from 'react';
10
- export interface PickedElement {
11
- element: Element;
12
- selector: string;
13
- description: string;
14
- }
15
- interface AnchorPickerProps {
16
- isActive: boolean;
17
- onPick: (picked: PickedElement) => void;
18
- onCancel: () => void;
19
- excludeSelector?: string;
20
- }
21
- export declare function AnchorPicker({ isActive, onPick, onCancel, excludeSelector, }: AnchorPickerProps): React.ReactPortal | null;
22
- export {};
6
+ export type { AnchorPickerProps, PickedElement } from '@syntrologie/shared-editor-ui';
7
+ export { AnchorPicker } from '@syntrologie/shared-editor-ui';
23
8
  //# sourceMappingURL=AnchorPicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorPicker.d.ts","sourceRoot":"","sources":["../../src/components/AnchorPicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AASxE,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,iBAAiB;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAKD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,eAAuJ,GACxJ,EAAE,iBAAiB,4BAmQnB"}
1
+ {"version":3,"file":"AnchorPicker.d.ts","sourceRoot":"","sources":["../../src/components/AnchorPicker.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC"}
@@ -1,183 +1,6 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  /**
3
- * AnchorPicker 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
- * Ported from editor-sdk for use in adaptive-content's create flow.
2
+ * Re-export AnchorPicker from shared-editor-ui.
3
+ * This file exists for backwards compatibility — all consumers should
4
+ * migrate to importing directly from @syntrologie/shared-editor-ui.
9
5
  */
10
- import { useState, useCallback, useEffect, useRef } from 'react';
11
- import { createPortal } from 'react-dom';
12
- import { generateSelector, getElementDescription, validateSelector, } from '../utils/selectorGenerator';
13
- const HIGHLIGHT_COLOR = '#3b82f6';
14
- const HIGHLIGHT_BG = 'rgba(59, 130, 246, 0.1)';
15
- export function AnchorPicker({ isActive, onPick, onCancel, excludeSelector = '[data-syntro-editor-panel], [data-shadow-canvas-id], .syntro-tooltip, .syntro-modal, .syntro-highlight, [data-syntro-anchor-picker]', }) {
16
- const [hoveredElement, setHoveredElement] = useState(null);
17
- const [hoveredSelector, setHoveredSelector] = useState('');
18
- const overlayRef = useRef(null);
19
- const handleMouseMove = useCallback((e) => {
20
- const overlay = overlayRef.current;
21
- if (overlay) {
22
- overlay.style.pointerEvents = 'none';
23
- }
24
- const elementAtPoint = document.elementFromPoint(e.clientX, e.clientY);
25
- if (overlay) {
26
- overlay.style.pointerEvents = 'auto';
27
- }
28
- if (!elementAtPoint) {
29
- setHoveredElement(null);
30
- setHoveredSelector('');
31
- return;
32
- }
33
- if (excludeSelector && elementAtPoint.closest(excludeSelector)) {
34
- setHoveredElement(null);
35
- setHoveredSelector('');
36
- return;
37
- }
38
- if (['HTML', 'BODY', 'HEAD'].includes(elementAtPoint.tagName)) {
39
- setHoveredElement(null);
40
- setHoveredSelector('');
41
- return;
42
- }
43
- setHoveredElement(elementAtPoint);
44
- const selector = generateSelector(elementAtPoint);
45
- setHoveredSelector(selector);
46
- }, [excludeSelector]);
47
- const handleClick = useCallback((e) => {
48
- e.preventDefault();
49
- e.stopPropagation();
50
- if (hoveredElement && hoveredSelector) {
51
- if (validateSelector(hoveredSelector, hoveredElement)) {
52
- onPick({
53
- element: hoveredElement,
54
- selector: hoveredSelector,
55
- description: getElementDescription(hoveredElement),
56
- });
57
- }
58
- else {
59
- const newSelector = generateSelector(hoveredElement);
60
- onPick({
61
- element: hoveredElement,
62
- selector: newSelector,
63
- description: getElementDescription(hoveredElement),
64
- });
65
- }
66
- }
67
- }, [hoveredElement, hoveredSelector, onPick]);
68
- const handleKeyDown = useCallback((e) => {
69
- if (e.key === 'Escape') {
70
- e.preventDefault();
71
- onCancel();
72
- }
73
- }, [onCancel]);
74
- useEffect(() => {
75
- if (!isActive)
76
- return;
77
- document.addEventListener('mousemove', handleMouseMove, true);
78
- document.addEventListener('click', handleClick, true);
79
- document.addEventListener('keydown', handleKeyDown, true);
80
- return () => {
81
- document.removeEventListener('mousemove', handleMouseMove, true);
82
- document.removeEventListener('click', handleClick, true);
83
- document.removeEventListener('keydown', handleKeyDown, true);
84
- };
85
- }, [isActive, handleMouseMove, handleClick, handleKeyDown]);
86
- if (!isActive)
87
- return null;
88
- const rect = hoveredElement?.getBoundingClientRect();
89
- return createPortal(_jsxs("div", { ref: overlayRef, "data-syntro-anchor-picker": true, style: {
90
- position: 'fixed',
91
- inset: 0,
92
- cursor: 'crosshair',
93
- zIndex: 2147483647,
94
- }, children: [_jsx("div", { style: {
95
- position: 'absolute',
96
- inset: 0,
97
- background: 'rgba(0, 0, 0, 0.05)',
98
- pointerEvents: 'none',
99
- } }), hoveredElement && rect && (_jsx("div", { style: {
100
- position: 'fixed',
101
- left: rect.left - 2,
102
- top: rect.top - 2,
103
- width: rect.width + 4,
104
- height: rect.height + 4,
105
- border: `2px solid ${HIGHLIGHT_COLOR}`,
106
- backgroundColor: HIGHLIGHT_BG,
107
- borderRadius: '4px',
108
- boxShadow: '0 0 0 9999px rgba(0, 0, 0, 0.15)',
109
- pointerEvents: 'none',
110
- transition: 'all 0.1s ease-out',
111
- } })), hoveredElement && rect && (_jsxs("div", { style: {
112
- position: 'fixed',
113
- left: Math.max(8, Math.min(rect.left, window.innerWidth - 320)),
114
- top: Math.max(8, rect.top - 68),
115
- backgroundColor: '#1e293b',
116
- color: '#e2e8f0',
117
- padding: '8px 12px',
118
- borderRadius: '6px',
119
- boxShadow: '0 4px 12px rgba(0, 0, 0, 0.3)',
120
- zIndex: 1,
121
- fontFamily: 'monospace',
122
- fontSize: '12px',
123
- maxWidth: '300px',
124
- pointerEvents: 'none',
125
- }, children: [_jsx("div", { style: {
126
- fontSize: '11px',
127
- textTransform: 'uppercase',
128
- letterSpacing: '0.05em',
129
- marginBottom: '4px',
130
- color: '#94a3b8',
131
- }, children: "Click to select" }), _jsx("div", { style: {
132
- color: '#38bdf8',
133
- overflow: 'hidden',
134
- textOverflow: 'ellipsis',
135
- whiteSpace: 'nowrap',
136
- }, children: hoveredSelector }), _jsx("div", { style: {
137
- marginTop: '4px',
138
- color: '#cbd5e1',
139
- overflow: 'hidden',
140
- textOverflow: 'ellipsis',
141
- whiteSpace: 'nowrap',
142
- }, children: getElementDescription(hoveredElement) })] })), _jsxs("div", { style: {
143
- position: 'fixed',
144
- bottom: 0,
145
- left: 0,
146
- right: 0,
147
- display: 'flex',
148
- justifyContent: 'space-between',
149
- alignItems: 'center',
150
- backgroundColor: '#1e293b',
151
- color: '#e2e8f0',
152
- padding: '12px 20px',
153
- boxShadow: '0 -4px 12px rgba(0, 0, 0, 0.2)',
154
- fontSize: '14px',
155
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
156
- }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '16px' }, children: [_jsx("span", { style: {
157
- padding: '4px 12px',
158
- borderRadius: '4px',
159
- fontWeight: 600,
160
- color: '#fff',
161
- backgroundColor: HIGHLIGHT_COLOR,
162
- }, children: "Element Picker" }), _jsx("span", { style: { color: '#cbd5e1' }, children: "Hover over an element and click to select it" })] }), _jsxs("button", { onClick: (e) => {
163
- e.stopPropagation();
164
- onCancel();
165
- }, style: {
166
- background: 'transparent',
167
- border: '1px solid #475569',
168
- color: '#e2e8f0',
169
- padding: '8px 16px',
170
- borderRadius: '6px',
171
- cursor: 'pointer',
172
- fontSize: '14px',
173
- display: 'flex',
174
- alignItems: 'center',
175
- gap: '8px',
176
- fontFamily: 'inherit',
177
- }, children: [_jsx("kbd", { style: {
178
- padding: '2px 6px',
179
- borderRadius: '3px',
180
- backgroundColor: '#334155',
181
- fontSize: '12px',
182
- }, children: "ESC" }), "Cancel"] })] })] }), document.body);
183
- }
6
+ export { AnchorPicker } from '@syntrologie/shared-editor-ui';
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwBH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA4IhD,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CAwgB3E;AAED;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;CAAe,CAAC;AAExC,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAuBH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA4IhD,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CA6iB3E;AAED;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;CAAe,CAAC;AAExC,eAAe,aAAa,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 one-liner change summaries.
7
7
  * Clicking a card navigates to the element and shows a floating edit panel.
8
8
  */
9
- import { EditorLayout, EditorHeader, EditorBody, EditorFooter, EditorCard, DetectionBadge, DismissedSection, GroupHeader, BeforeAfterToggle, EditorInput, EditorTextarea, EditorSelect, EditBackButton, EmptyState, } from '@syntrologie/shared-editor-ui';
10
- import { Type, Tag, Palette, FileCode, Plus, Minus } from 'lucide-react';
11
- import { useState, useCallback, useEffect, useRef } from 'react';
9
+ import { DetectionBadge, DismissedSection, EditorBody, EditorCard, EditorFooter, EditorHeader, EditorInput, EditorLayout, EditorSelect, EditorTextarea, EmptyState, GroupHeader, } from '@syntrologie/shared-editor-ui';
10
+ import { FileCode, Minus, Palette, Plus, Tag, Type } from 'lucide-react';
11
+ import { useCallback, useEffect, useRef, useState } from 'react';
12
12
  import { AnchorPicker } from './components/AnchorPicker';
13
13
  import { summarizeContentChange } from './summarize';
14
14
  function itemKey(section, index) {
@@ -104,7 +104,7 @@ export function ContentEditor({ config, onChange, editor }) {
104
104
  const typedConfig = config;
105
105
  const [dismissedKeys, setDismissedKeys] = useState(() => editor.getDismissedKeys?.() ?? new Set());
106
106
  const [editingKey, setEditingKey] = useState(null);
107
- const [previewMode, setPreviewMode] = useState('after');
107
+ const [_previewMode, setPreviewMode] = useState('after');
108
108
  // Sync dismissed keys back to navigation context on every change
109
109
  useEffect(() => {
110
110
  editor.setDismissedKeys?.(dismissedKeys);
@@ -114,6 +114,23 @@ export function ContentEditor({ config, onChange, editor }) {
114
114
  const [createAnchorId, setCreateAnchorId] = useState('');
115
115
  const [createText, setCreateText] = useState('');
116
116
  const [createDescription, setCreateDescription] = useState('');
117
+ // React to global before/after toggle from the panel
118
+ // biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitted — adding config/typedConfig/previewConfig would cause infinite re-renders since previewConfig triggers state updates
119
+ useEffect(() => {
120
+ const mode = editor.previewMode;
121
+ if (!mode)
122
+ return;
123
+ if (mode === 'before') {
124
+ // Remove all content changes — push a config with every item filtered out
125
+ const allKeys = new Set(flattenItems(typedConfig).map((item) => item.key));
126
+ const empty = filterConfig(typedConfig, allKeys);
127
+ editor.previewConfig(empty);
128
+ }
129
+ else {
130
+ // Restore the full config
131
+ editor.previewConfig(config);
132
+ }
133
+ }, [editor.previewMode]);
117
134
  // Consume initialEditKey from accordion navigation on mount
118
135
  const initialConsumed = useRef(false);
119
136
  useEffect(() => {
@@ -132,7 +149,7 @@ export function ContentEditor({ config, onChange, editor }) {
132
149
  }
133
150
  else if (editor.initialCreate && !initialConsumed.current) {
134
151
  initialConsumed.current = true;
135
- setCreateMode('picking');
152
+ setCreateMode('form');
136
153
  editor.clearInitialState?.();
137
154
  }
138
155
  }, [editor, typedConfig]);
@@ -171,7 +188,12 @@ export function ContentEditor({ config, onChange, editor }) {
171
188
  editor.previewConfig(config);
172
189
  editor.clearHighlight();
173
190
  }, [editor, config]);
174
- const handleBeforeAfter = useCallback((mode) => {
191
+ // Register back handler in panel header when editing
192
+ useEffect(() => {
193
+ editor.setBackHandler?.(editingKey !== null ? handleBackToList : null);
194
+ return () => editor.setBackHandler?.(null);
195
+ }, [editingKey, handleBackToList, editor]);
196
+ const _handleBeforeAfter = useCallback((mode) => {
175
197
  setPreviewMode(mode);
176
198
  if (mode === 'before') {
177
199
  const filtered = filterConfig(typedConfig, new Set([editingKey]));
@@ -215,7 +237,7 @@ export function ContentEditor({ config, onChange, editor }) {
215
237
  setCreateAnchorId('');
216
238
  setCreateText('');
217
239
  setCreateDescription('');
218
- setCreateMode('picking');
240
+ setCreateMode('form');
219
241
  }, [editor]);
220
242
  const handleElementPicked = useCallback((picked) => {
221
243
  setCreateAnchorId(picked.selector);
@@ -265,31 +287,36 @@ export function ContentEditor({ config, onChange, editor }) {
265
287
  const anchorId = item.anchorId || '';
266
288
  switch (section) {
267
289
  case 'textReplacements':
268
- return (_jsxs("div", { className: "se-py-1", children: [_jsx("div", { className: "se-text-[11px] se-font-mono se-text-slate-grey-8 se-py-1 se-px-2 se-bg-white/[0.04] se-rounded se-mb-3", children: anchorId }), _jsx(EditorTextarea, { label: "Text", value: item.text || '', onChange: (e) => handleFieldChange(section, index, 'text', e.target.value) })] }));
290
+ return (_jsxs("div", { className: "se-py-1", children: [_jsx("div", { className: "se-text-sm se-font-mono se-text-text-secondary se-py-1 se-px-2 se-bg-slate-grey-3 se-rounded-lg se-mb-3", children: anchorId }), _jsx(EditorTextarea, { label: "Text", value: item.text || '', onChange: (e) => handleFieldChange(section, index, 'text', e.target.value) })] }));
269
291
  case 'attributeChanges':
270
- return (_jsxs("div", { className: "se-py-1", children: [_jsx("div", { className: "se-text-[11px] se-font-mono se-text-slate-grey-8 se-py-1 se-px-2 se-bg-white/[0.04] se-rounded se-mb-3", children: anchorId }), _jsx(EditorInput, { label: "Attribute", value: item.attr || '', onChange: (e) => handleFieldChange(section, index, 'attr', e.target.value) }), _jsx(EditorInput, { label: "Value", value: item.value || '', onChange: (e) => handleFieldChange(section, index, 'value', e.target.value) })] }));
292
+ return (_jsxs("div", { className: "se-py-1", children: [_jsx("div", { className: "se-text-sm se-font-mono se-text-text-secondary se-py-1 se-px-2 se-bg-slate-grey-3 se-rounded-lg se-mb-3", children: anchorId }), _jsx(EditorInput, { label: "Attribute", value: item.attr || '', onChange: (e) => handleFieldChange(section, index, 'attr', e.target.value) }), _jsx(EditorInput, { label: "Value", value: item.value || '', onChange: (e) => handleFieldChange(section, index, 'value', e.target.value) })] }));
271
293
  case 'styleChanges': {
272
294
  const styleObj = item.styles || {};
273
- return (_jsxs("div", { className: "se-py-1", children: [_jsx("div", { className: "se-text-[11px] se-font-mono se-text-slate-grey-8 se-py-1 se-px-2 se-bg-white/[0.04] se-rounded se-mb-3", children: anchorId }), _jsx("label", { className: "se-text-[11px] se-font-semibold se-text-slate-grey-7 se-mb-1 se-block", children: "Styles" }), Object.entries(styleObj).map(([prop, val]) => (_jsxs("div", { className: "se-flex se-gap-1 se-mb-1", children: [_jsx("input", { className: "se-flex-1 se-py-1.5 se-px-2 se-rounded se-border se-border-white/10 se-bg-white/[0.04] se-text-slate-grey-10 se-text-xs se-font-[inherit] se-box-border", value: prop, readOnly: true }), _jsx("input", { className: "se-flex-1 se-py-1.5 se-px-2 se-rounded se-border se-border-white/10 se-bg-white/[0.04] se-text-slate-grey-10 se-text-xs se-font-[inherit] se-box-border", value: val, onChange: (e) => {
295
+ return (_jsxs("div", { className: "se-py-1", children: [_jsx("div", { className: "se-text-sm se-font-mono se-text-text-secondary se-py-1 se-px-2 se-bg-slate-grey-3 se-rounded-lg se-mb-3", children: anchorId }), _jsx("label", { className: "se-text-[11px] se-font-semibold se-text-slate-grey-7 se-mb-1 se-block", children: "Styles" }), Object.entries(styleObj).map(([prop, val]) => (_jsxs("div", { className: "se-flex se-gap-1 se-mb-1", children: [_jsx("input", { className: "se-flex-1 se-py-1.5 se-px-2 se-rounded-lg se-border se-border-input-field-border se-bg-slate-grey-3 se-text-text-primary se-text-sm se-font-[inherit] se-box-border", value: prop, readOnly: true }), _jsx("input", { className: "se-flex-1 se-py-1.5 se-px-2 se-rounded-lg se-border se-border-input-field-border se-bg-slate-grey-3 se-text-text-primary se-text-sm se-font-[inherit] se-box-border", value: val, onChange: (e) => {
274
296
  const newStyles = { ...styleObj, [prop]: e.target.value };
275
297
  handleFieldChange(section, index, 'styles', newStyles);
276
298
  } })] }, prop)))] }));
277
299
  }
278
300
  case 'htmlInsertions':
279
- return (_jsxs("div", { className: "se-py-1", children: [_jsx("div", { className: "se-text-[11px] se-font-mono se-text-slate-grey-8 se-py-1 se-px-2 se-bg-white/[0.04] se-rounded se-mb-3", children: anchorId }), _jsxs(EditorSelect, { label: "Position", value: item.position || 'after', onChange: (e) => handleFieldChange(section, index, 'position', e.target.value), children: [_jsx("option", { value: "before", children: "Before" }), _jsx("option", { value: "after", children: "After" }), _jsx("option", { value: "prepend", children: "Prepend" }), _jsx("option", { value: "append", children: "Append" }), _jsx("option", { value: "replace", children: "Replace" })] }), _jsx(EditorTextarea, { label: "HTML", value: item.html || '', onChange: (e) => handleFieldChange(section, index, 'html', e.target.value), className: "se-font-mono" })] }));
301
+ return (_jsxs("div", { className: "se-py-1", children: [_jsx("div", { className: "se-text-sm se-font-mono se-text-text-secondary se-py-1 se-px-2 se-bg-slate-grey-3 se-rounded-lg se-mb-3", children: anchorId }), _jsxs(EditorSelect, { label: "Position", value: item.position || 'after', onChange: (e) => handleFieldChange(section, index, 'position', e.target.value), children: [_jsx("option", { value: "before", children: "Before" }), _jsx("option", { value: "after", children: "After" }), _jsx("option", { value: "prepend", children: "Prepend" }), _jsx("option", { value: "append", children: "Append" }), _jsx("option", { value: "replace", children: "Replace" })] }), _jsx(EditorTextarea, { label: "HTML", value: item.html || '', onChange: (e) => handleFieldChange(section, index, 'html', e.target.value), className: "se-font-mono" })] }));
280
302
  case 'classAdditions':
281
303
  case 'classRemovals':
282
- return (_jsxs("div", { className: "se-py-1", children: [_jsx("div", { className: "se-text-[11px] se-font-mono se-text-slate-grey-8 se-py-1 se-px-2 se-bg-white/[0.04] se-rounded se-mb-3", children: anchorId }), _jsx(EditorInput, { label: "Class Name", value: item.className || '', onChange: (e) => handleFieldChange(section, index, 'className', e.target.value) })] }));
304
+ return (_jsxs("div", { className: "se-py-1", children: [_jsx("div", { className: "se-text-sm se-font-mono se-text-text-secondary se-py-1 se-px-2 se-bg-slate-grey-3 se-rounded-lg se-mb-3", children: anchorId }), _jsx(EditorInput, { label: "Class Name", value: item.className || '', onChange: (e) => handleFieldChange(section, index, 'className', e.target.value) })] }));
283
305
  default:
284
306
  return null;
285
307
  }
286
308
  };
287
- const headerTitle = createMode === 'form' ? 'Add Text Change' : 'Content';
288
- const headerSubtitle = createMode === 'form'
289
- ? 'Pick an element and set its new text'
290
- : `${totalChanges} change${totalChanges !== 1 ? 's' : ''}${totalChanges > 0 ? ` (${foundCount} found on this page)` : ''}`;
309
+ const headerTitle = createMode === 'form' || createMode === 'picking' ? 'Add Text Change' : 'Content';
310
+ const headerSubtitle = createMode === 'picking'
311
+ ? 'Click an element on the page to select it. Press ESC to go back.'
312
+ : createMode === 'form'
313
+ ? 'Pick an element and set its new text'
314
+ : `${totalChanges} change${totalChanges !== 1 ? 's' : ''}${totalChanges > 0 ? ` (${foundCount} found on this page)` : ''}`;
291
315
  const handleHeaderBack = () => {
292
- if (createMode) {
316
+ if (createMode === 'picking') {
317
+ setCreateMode('form');
318
+ }
319
+ else if (createMode === 'form') {
293
320
  handleCancelCreate();
294
321
  }
295
322
  else if (editingKey !== null) {
@@ -299,29 +326,26 @@ export function ContentEditor({ config, onChange, editor }) {
299
326
  editor.navigateHome();
300
327
  }
301
328
  };
302
- return (_jsxs(EditorLayout, { children: [_jsx(EditorHeader, { title: headerTitle, subtitle: headerSubtitle, onBack: handleHeaderBack }), _jsx(EditorBody, { children: createMode === 'form' ? (
329
+ return (_jsxs(EditorLayout, { children: [_jsx(EditorHeader, { title: headerTitle, subtitle: headerSubtitle, onBack: handleHeaderBack }), _jsx(EditorBody, { children: createMode === 'form' || createMode === 'picking' ? (
303
330
  /* ---- Create form mode ---- */
304
- _jsxs("div", { className: "se-flex se-flex-col se-gap-4", children: [_jsxs("div", { className: "se-flex se-flex-col se-gap-1.5", children: [_jsx("label", { className: "se-text-[11px] se-font-semibold se-text-slate-grey-7 se-uppercase se-tracking-wide", children: "Target Element" }), _jsxs("div", { className: "se-flex se-gap-2 se-items-center", children: [_jsx("code", { className: "se-flex-1 se-py-1.5 se-px-2 se-rounded se-border se-border-white/10 se-bg-white/[0.04] se-text-slate-grey-10 se-text-xs se-overflow-hidden se-text-ellipsis se-whitespace-nowrap", children: createAnchorId }), _jsx("button", { onClick: () => setCreateMode('picking'), className: "se-py-1.5 se-px-3 se-rounded se-border se-border-white/10 se-bg-transparent se-text-slate-grey-9 se-text-xs se-cursor-pointer se-shrink-0", children: "Re-pick" })] }), createDescription && (_jsx("span", { className: "se-text-[11px] se-text-slate-grey-6", children: createDescription }))] }), _jsxs("div", { className: "se-flex se-flex-col se-gap-1.5", children: [_jsx("label", { className: "se-text-[11px] se-font-semibold se-text-slate-grey-7 se-uppercase se-tracking-wide", children: "Text Content" }), _jsx(EditorTextarea, { value: createText, onChange: (e) => setCreateText(e.target.value) })] }), _jsxs("div", { className: "se-flex se-gap-2 se-mt-2", children: [_jsx("button", { onClick: handleCancelCreate, className: "se-flex-1 se-py-2 se-rounded se-border se-border-white/10 se-bg-transparent se-text-slate-grey-9 se-text-sm se-cursor-pointer", children: "Cancel" }), _jsx("button", { onClick: handleSaveCreate, disabled: !createAnchorId, className: "se-flex-1 se-py-2 se-rounded se-border-none se-bg-blue-5 se-text-white se-text-sm se-font-semibold se-cursor-pointer disabled:se-opacity-40 disabled:se-cursor-not-allowed", children: "Add Change" })] })] })) : editingKey !== null ? (
331
+ _jsxs("div", { className: "se-flex se-flex-col se-gap-4", children: [_jsxs("div", { className: "se-flex se-flex-col se-gap-1.5", children: [_jsx("span", { className: "se-text-sm se-font-semibold se-text-text-primary se-uppercase se-tracking-wide", children: "Target Element" }), createAnchorId ? (_jsxs("div", { className: "se-flex se-gap-2 se-items-center", children: [_jsx("code", { className: "se-flex-1 se-py-1.5 se-px-2 se-rounded-lg se-border se-border-input-field-border se-bg-slate-grey-3 se-text-text-primary se-text-sm se-overflow-hidden se-text-ellipsis se-whitespace-nowrap", children: createAnchorId }), _jsx("button", { type: "button", onClick: () => setCreateMode('picking'), className: "se-py-1.5 se-px-3 se-rounded-lg se-border se-border-btn-neutral-border se-bg-btn-neutral se-text-btn-neutral-text se-text-sm se-cursor-pointer se-shrink-0 hover:se-text-btn-neutral-text-hover", children: "Re-pick" })] })) : (_jsx("button", { type: "button", onClick: () => setCreateMode('picking'), className: "se-w-full se-h-12 se-px-4 se-py-2 se-rounded-lg se-border-2 se-border-dashed se-border-btn-primary/30 se-bg-btn-primary/5 se-text-btn-primary se-text-sm se-font-medium se-cursor-pointer se-inline-flex se-items-center se-justify-center se-gap-2 hover:se-bg-btn-primary/10 hover:se-border-btn-primary/50", children: "+ Pick Target Element" })), createDescription && (_jsx("span", { className: "se-text-sm se-text-text-secondary", children: createDescription }))] }), _jsxs("div", { className: "se-flex se-flex-col se-gap-1.5", children: [_jsx("span", { className: "se-text-sm se-font-semibold se-text-text-primary se-uppercase se-tracking-wide", children: "Text Content" }), _jsx(EditorTextarea, { value: createText, onChange: (e) => setCreateText(e.target.value) })] }), _jsxs("div", { className: "se-flex se-gap-2 se-mt-2", children: [_jsx("button", { type: "button", onClick: handleCancelCreate, className: "se-flex-1 se-h-10 se-px-4 se-py-2 se-rounded-md se-border se-border-btn-neutral-border se-bg-btn-neutral se-text-btn-neutral-text se-text-sm se-font-medium se-cursor-pointer se-inline-flex se-items-center se-justify-center hover:se-text-btn-neutral-text-hover", children: "Cancel" }), _jsx("button", { type: "button", onClick: handleSaveCreate, disabled: !createAnchorId, className: "se-flex-1 se-h-10 se-px-4 se-py-2 se-rounded-md se-border-none se-bg-btn-primary se-text-btn-primary-text se-text-sm se-font-medium se-cursor-pointer se-inline-flex se-items-center se-justify-center hover:se-bg-btn-primary-hover disabled:se-opacity-50 disabled:se-pointer-events-none", children: "Add Change" })] })] })) : editingKey !== null ? (
305
332
  /* ---- Edit mode ---- */
306
333
  (() => {
307
334
  const ref = parseItemKey(editingKey);
308
335
  const editItem = allItems.find((it) => it.key === editingKey);
309
- 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: editItem && _jsx(SectionIcon, { section: editItem.section }) }), _jsx("span", { children: editItem?.summary })] }), _jsx(BeforeAfterToggle, { mode: previewMode, onToggle: handleBeforeAfter }), renderEditFields(ref.section, ref.index), _jsx(EditBackButton, { onClick: handleBackToList })] }));
336
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "se-flex se-items-center se-gap-2 se-mb-3 se-text-lg se-font-semibold se-text-text-primary", children: [_jsx("span", { children: editItem && _jsx(SectionIcon, { section: editItem.section }) }), _jsx("span", { children: editItem?.summary })] }), renderEditFields(ref.section, ref.index)] }));
310
337
  })()) : (
311
338
  /* ---- List mode ---- */
312
- _jsxs(_Fragment, { children: [_jsx("button", { onClick: handleStartCreate, className: "se-w-full se-py-2.5 se-rounded-md se-border se-border-dashed se-border-blue-5/30 se-bg-blue-5/5 se-text-blue-5 se-text-xs se-font-semibold se-cursor-pointer se-flex se-items-center se-justify-center se-gap-1.5 se-mb-3", children: "+ Add Text Change" }), allItems.length === 0 && _jsx(EmptyState, { message: "No content changes configured. Click above to add one." }), activeItems.length > 0 && (_jsxs(_Fragment, { children: [_jsx(GroupHeader, { label: "CONTENT", count: activeItems.length }), activeItems.map((item) => {
339
+ _jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: handleStartCreate, className: "se-w-full se-h-10 se-px-4 se-py-2 se-rounded-md se-border se-border-dashed se-border-btn-primary/30 se-bg-btn-primary/5 se-text-btn-primary se-text-sm se-font-medium se-cursor-pointer se-flex se-items-center se-justify-center se-gap-2 se-mb-3", children: "+ Add Text Change" }), allItems.length === 0 && (_jsx(EmptyState, { message: "No content changes configured. Click above to add one." })), activeItems.length > 0 && (_jsxs(_Fragment, { children: [_jsx(GroupHeader, { label: "CONTENT", count: activeItems.length }), activeItems.map((item) => {
313
340
  const detection = detectionMap.get(item.key);
314
- return (_jsxs(EditorCard, { itemKey: item.key, className: "se-flex se-items-center se-gap-2 se-cursor-pointer", onMouseEnter: () => handleCardHover(item), onMouseLeave: handleCardLeave, children: [_jsx(DetectionBadge, { found: detection?.found ?? false }), _jsx("span", { className: "se-shrink-0 se-flex se-items-center -se-ml-1", onClick: (e) => {
315
- e.stopPropagation();
316
- handleCardClick(item);
317
- }, children: _jsx(SectionIcon, { section: item.section }) }), _jsx("span", { className: "se-flex-1 se-overflow-hidden se-text-ellipsis se-whitespace-nowrap", onClick: () => handleCardClick(item), children: item.summary }), _jsx("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) => {
341
+ return (_jsxs(EditorCard, { itemKey: item.key, onClick: () => handleCardClick(item), className: "se-flex se-items-center se-gap-2", onMouseEnter: () => handleCardHover(item), onMouseLeave: handleCardLeave, children: [_jsx(DetectionBadge, { found: detection?.found ?? false }), _jsx("span", { className: "se-shrink-0 se-flex se-items-center -se-ml-1", children: _jsx(SectionIcon, { section: item.section }) }), _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) => {
318
342
  e.stopPropagation();
319
343
  handleDismiss(item.key);
320
344
  }, title: "Dismiss this change", children: "\u00D7" })] }, item.key));
321
- })] })), 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-shrink-0 se-flex se-items-center -se-ml-1", children: _jsx(SectionIcon, { section: item.section }) }), _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) => {
345
+ })] })), 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-lg se-border se-border-white/[0.03] se-bg-transparent se-mb-0.5 se-cursor-pointer se-text-sm se-text-text-tertiary se-opacity-60", children: [_jsx("span", { className: "se-shrink-0 se-flex se-items-center -se-ml-1", children: _jsx(SectionIcon, { section: item.section }) }), _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) => {
322
346
  e.stopPropagation();
323
347
  handleRestore(item.key);
324
- }, children: "Restore" })] }, item.key))) }))] })) }), _jsx(EditorFooter, { onSave: () => editor.save(), onPublish: handlePublish }), _jsx(AnchorPicker, { isActive: createMode === 'picking', onPick: handleElementPicked, onCancel: handleCancelCreate })] }));
348
+ }, children: "Restore" })] }, item.key))) }))] })) }), _jsx(EditorFooter, { onSave: () => editor.save(), onPublish: handlePublish }), _jsx(AnchorPicker, { isActive: createMode === 'picking', onPick: handleElementPicked, onCancel: () => setCreateMode('form') })] }));
325
349
  }
326
350
  /**
327
351
  * Editor module configuration.
package/dist/runtime.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * DOM manipulation actions: insertHtml, setText, setAttr, addClass, removeClass, setStyle.
5
5
  * These follow the hostPatcher snapshot pattern for safe reversibility.
6
6
  */
7
- import type { InsertHtmlAction, SetTextAction, SetAttrAction, AddClassAction, RemoveClassAction, SetStyleAction, ActionExecutor } from './types';
7
+ import type { ActionExecutor, AddClassAction, InsertHtmlAction, RemoveClassAction, SetAttrAction, SetStyleAction, SetTextAction } from './types';
8
8
  /**
9
9
  * Execute an insertHtml action
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,cAAc,EAEd,cAAc,EACf,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,gBAAgB,CAmE9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CA+BxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CAwDxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CA8B1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,iBAAiB,CA8BhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CA+C1D,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;EAOZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;CAMnB,CAAC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EAEd,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,aAAa,EACd,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,gBAAgB,CAmE9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CA+BxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CAwDxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CA8B1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,iBAAiB,CA8BhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CA+C1D,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;EAOZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;CAMnB,CAAC"}
package/dist/schema.d.ts CHANGED
@@ -15,13 +15,13 @@ export declare const configSchema: z.ZodObject<{
15
15
  summary: z.ZodString;
16
16
  text: z.ZodString;
17
17
  }, "strip", z.ZodTypeAny, {
18
+ summary: string;
18
19
  text: string;
19
20
  anchorId: string;
20
- summary: string;
21
21
  }, {
22
+ summary: string;
22
23
  text: string;
23
24
  anchorId: string;
24
- summary: string;
25
25
  }>, "many">>;
26
26
  /** Attribute modifications */
27
27
  attributeChanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -30,14 +30,14 @@ export declare const configSchema: z.ZodObject<{
30
30
  attr: z.ZodString;
31
31
  value: z.ZodString;
32
32
  }, "strip", z.ZodTypeAny, {
33
- value: string;
34
- anchorId: string;
35
33
  summary: string;
34
+ anchorId: string;
35
+ value: string;
36
36
  attr: string;
37
37
  }, {
38
- value: string;
39
- anchorId: string;
40
38
  summary: string;
39
+ anchorId: string;
40
+ value: string;
41
41
  attr: string;
42
42
  }>, "many">>;
43
43
  /** Style modifications */
@@ -46,12 +46,12 @@ export declare const configSchema: z.ZodObject<{
46
46
  summary: z.ZodString;
47
47
  styles: z.ZodRecord<z.ZodString, z.ZodString>;
48
48
  }, "strip", z.ZodTypeAny, {
49
- anchorId: string;
50
49
  summary: string;
50
+ anchorId: string;
51
51
  styles: Record<string, string>;
52
52
  }, {
53
- anchorId: string;
54
53
  summary: string;
54
+ anchorId: string;
55
55
  styles: Record<string, string>;
56
56
  }>, "many">>;
57
57
  /** HTML insertions */
@@ -61,15 +61,15 @@ export declare const configSchema: z.ZodObject<{
61
61
  html: z.ZodString;
62
62
  position: z.ZodEnum<["before", "after", "prepend", "append", "replace"]>;
63
63
  }, "strip", z.ZodTypeAny, {
64
- anchorId: string;
65
64
  html: string;
66
65
  summary: string;
67
66
  position: "replace" | "before" | "after" | "prepend" | "append";
68
- }, {
69
67
  anchorId: string;
68
+ }, {
70
69
  html: string;
71
70
  summary: string;
72
71
  position: "replace" | "before" | "after" | "prepend" | "append";
72
+ anchorId: string;
73
73
  }>, "many">>;
74
74
  /** Class additions */
75
75
  classAdditions: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -77,13 +77,13 @@ export declare const configSchema: z.ZodObject<{
77
77
  summary: z.ZodString;
78
78
  className: z.ZodString;
79
79
  }, "strip", z.ZodTypeAny, {
80
+ summary: string;
80
81
  className: string;
81
82
  anchorId: string;
82
- summary: string;
83
83
  }, {
84
+ summary: string;
84
85
  className: string;
85
86
  anchorId: string;
86
- summary: string;
87
87
  }>, "many">>;
88
88
  /** Class removals */
89
89
  classRemovals: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -91,79 +91,79 @@ export declare const configSchema: z.ZodObject<{
91
91
  summary: z.ZodString;
92
92
  className: z.ZodString;
93
93
  }, "strip", z.ZodTypeAny, {
94
+ summary: string;
94
95
  className: string;
95
96
  anchorId: string;
96
- summary: string;
97
97
  }, {
98
+ summary: string;
98
99
  className: string;
99
100
  anchorId: string;
100
- summary: string;
101
101
  }>, "many">>;
102
102
  }, "strip", z.ZodTypeAny, {
103
103
  textReplacements?: {
104
+ summary: string;
104
105
  text: string;
105
106
  anchorId: string;
106
- summary: string;
107
107
  }[] | undefined;
108
108
  attributeChanges?: {
109
- value: string;
110
- anchorId: string;
111
109
  summary: string;
110
+ anchorId: string;
111
+ value: string;
112
112
  attr: string;
113
113
  }[] | undefined;
114
114
  styleChanges?: {
115
- anchorId: string;
116
115
  summary: string;
116
+ anchorId: string;
117
117
  styles: Record<string, string>;
118
118
  }[] | undefined;
119
119
  htmlInsertions?: {
120
- anchorId: string;
121
120
  html: string;
122
121
  summary: string;
123
122
  position: "replace" | "before" | "after" | "prepend" | "append";
123
+ anchorId: string;
124
124
  }[] | undefined;
125
125
  classAdditions?: {
126
+ summary: string;
126
127
  className: string;
127
128
  anchorId: string;
128
- summary: string;
129
129
  }[] | undefined;
130
130
  classRemovals?: {
131
+ summary: string;
131
132
  className: string;
132
133
  anchorId: string;
133
- summary: string;
134
134
  }[] | undefined;
135
135
  }, {
136
136
  textReplacements?: {
137
+ summary: string;
137
138
  text: string;
138
139
  anchorId: string;
139
- summary: string;
140
140
  }[] | undefined;
141
141
  attributeChanges?: {
142
- value: string;
143
- anchorId: string;
144
142
  summary: string;
143
+ anchorId: string;
144
+ value: string;
145
145
  attr: string;
146
146
  }[] | undefined;
147
147
  styleChanges?: {
148
- anchorId: string;
149
148
  summary: string;
149
+ anchorId: string;
150
150
  styles: Record<string, string>;
151
151
  }[] | undefined;
152
152
  htmlInsertions?: {
153
- anchorId: string;
154
153
  html: string;
155
154
  summary: string;
156
155
  position: "replace" | "before" | "after" | "prepend" | "append";
156
+ anchorId: string;
157
157
  }[] | undefined;
158
158
  classAdditions?: {
159
+ summary: string;
159
160
  className: string;
160
161
  anchorId: string;
161
- summary: string;
162
162
  }[] | undefined;
163
163
  classRemovals?: {
164
+ summary: string;
164
165
  className: string;
165
166
  anchorId: string;
166
- summary: string;
167
167
  }[] | undefined;
168
168
  }>;
169
169
  export type ContentConfig = z.infer<typeof configSchema>;