@replohq/canopy-sdk 0.11.1 → 0.13.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 (63) hide show
  1. package/_vendor/replo-utils/lib/misc.d.ts +18 -1
  2. package/_vendor/replo-utils/lib/misc.mjs +1 -1
  3. package/_vendor/schemas/designLibrary.d.ts +4 -4
  4. package/_vendor/schemas/errors.mjs +1 -1
  5. package/_vendor/schemas/generated/selectMode.d.ts +102 -0
  6. package/_vendor/schemas/savedStyles.d.ts +2 -2
  7. package/_vendor/schemas/selectMode.d.ts +471 -0
  8. package/_vendor/schemas/selectMode.mjs +119 -3
  9. package/{chunk-RUJDCFMG.mjs → chunk-OCB5XQYL.mjs} +1 -1
  10. package/editor/LinkInterceptor.js +4 -0
  11. package/editor/LinkInterceptor.js.map +2 -2
  12. package/editor/select-mode/EditorSelection.js +74 -1
  13. package/editor/select-mode/EditorSelection.js.map +2 -2
  14. package/editor/select-mode/descriptor/elementDescriptor.d.ts +13 -2
  15. package/editor/select-mode/descriptor/elementDescriptor.js +19 -31
  16. package/editor/select-mode/descriptor/elementDescriptor.js.map +2 -2
  17. package/editor/select-mode/descriptor/styleExtraction.d.ts +3 -0
  18. package/editor/select-mode/descriptor/styleExtraction.js +271 -0
  19. package/editor/select-mode/descriptor/styleExtraction.js.map +7 -0
  20. package/editor/select-mode/displayModeStore.d.ts +10 -0
  21. package/editor/select-mode/displayModeStore.js +47 -0
  22. package/editor/select-mode/displayModeStore.js.map +7 -0
  23. package/editor/select-mode/fast-refresh-relay.d.ts +3 -0
  24. package/editor/select-mode/fast-refresh-relay.js +35 -0
  25. package/editor/select-mode/fast-refresh-relay.js.map +7 -0
  26. package/editor/select-mode/fiber.d.ts +17 -0
  27. package/editor/select-mode/fiber.js +103 -34
  28. package/editor/select-mode/fiber.js.map +2 -2
  29. package/editor/select-mode/hooks/useEditModeStateMachine.d.ts +20 -0
  30. package/editor/select-mode/hooks/useEditModeStateMachine.js +226 -0
  31. package/editor/select-mode/hooks/useEditModeStateMachine.js.map +7 -0
  32. package/editor/select-mode/hooks/useOptimisticOverrides.d.ts +20 -0
  33. package/editor/select-mode/hooks/useOptimisticOverrides.js +284 -0
  34. package/editor/select-mode/hooks/useOptimisticOverrides.js.map +7 -0
  35. package/editor/select-mode/hooks/useParentMessaging.d.ts +17 -2
  36. package/editor/select-mode/hooks/useParentMessaging.js +66 -1
  37. package/editor/select-mode/hooks/useParentMessaging.js.map +2 -2
  38. package/editor/select-mode/hooks/useSelectModeController.js +5 -6
  39. package/editor/select-mode/hooks/useSelectModeController.js.map +2 -2
  40. package/editor/select-mode/hooks/useSelectionHover.js +16 -1
  41. package/editor/select-mode/hooks/useSelectionHover.js.map +2 -2
  42. package/editor/select-mode/hooks/useSelectionInteractions.d.ts +7 -2
  43. package/editor/select-mode/hooks/useSelectionInteractions.js +57 -18
  44. package/editor/select-mode/hooks/useSelectionInteractions.js.map +2 -2
  45. package/editor/select-mode/hooks/useSiblingResolution.d.ts +6 -0
  46. package/editor/select-mode/hooks/useSiblingResolution.js +59 -0
  47. package/editor/select-mode/hooks/useSiblingResolution.js.map +7 -0
  48. package/editor/select-mode/inlineTextMarks.d.ts +6 -0
  49. package/editor/select-mode/inlineTextMarks.js +25 -0
  50. package/editor/select-mode/inlineTextMarks.js.map +7 -0
  51. package/editor/select-mode/interactions/selectionGeometry.js +4 -0
  52. package/editor/select-mode/interactions/selectionGeometry.js.map +2 -2
  53. package/editor/select-mode/selectionFrame.d.ts +5 -0
  54. package/editor/select-mode/selectionFrame.js +25 -1
  55. package/editor/select-mode/selectionFrame.js.map +2 -2
  56. package/editor/select-mode/symbolicate.js +32 -10
  57. package/editor/select-mode/symbolicate.js.map +2 -2
  58. package/editor/select-mode/tiptapInlineEditor.d.ts +23 -0
  59. package/editor/select-mode/tiptapInlineEditor.js +120 -0
  60. package/editor/select-mode/tiptapInlineEditor.js.map +7 -0
  61. package/next/config.js +11 -9
  62. package/next/config.js.map +2 -2
  63. package/package.json +9 -1
@@ -0,0 +1,271 @@
1
+ const CONTROL_STYLE_PROPERTIES = [
2
+ "color",
3
+ "background-color",
4
+ "font-family",
5
+ "font-size",
6
+ "font-weight",
7
+ "line-height",
8
+ "letter-spacing",
9
+ "text-align"
10
+ ];
11
+ const CONTROL_STYLE_PROPERTY_SET = new Set(CONTROL_STYLE_PROPERTIES);
12
+ function isControlStyleProperty(propertyName) {
13
+ return CONTROL_STYLE_PROPERTY_SET.has(propertyName);
14
+ }
15
+ function getEscapedClassName(className) {
16
+ return CSS.escape(className);
17
+ }
18
+ function getClassSelectorMatches({
19
+ selectorText,
20
+ classNames
21
+ }) {
22
+ const matches = [];
23
+ const selectorParts = selectorText.split(",").map((selectorPart) => {
24
+ return selectorPart.trim();
25
+ });
26
+ for (const selectorPart of selectorParts) {
27
+ for (const className of classNames) {
28
+ const escapedClassName = getEscapedClassName(className);
29
+ const baseSelector = `.${escapedClassName}`;
30
+ if (selectorPart === baseSelector) {
31
+ matches.push({ className, pseudo: null });
32
+ continue;
33
+ }
34
+ if (!selectorPart.startsWith(`${baseSelector}:`)) {
35
+ continue;
36
+ }
37
+ const pseudo = selectorPart.slice(baseSelector.length);
38
+ const isSimplePseudoSelector = pseudo.startsWith(":") && !/[ >+~#[.]/.test(pseudo) && !pseudo.includes("::");
39
+ if (isSimplePseudoSelector) {
40
+ matches.push({ className, pseudo });
41
+ }
42
+ }
43
+ }
44
+ return matches;
45
+ }
46
+ function getNestedAtRules({
47
+ rule,
48
+ activeAtRules
49
+ }) {
50
+ const nextAtRules = [...activeAtRules];
51
+ if (rule instanceof CSSMediaRule) {
52
+ nextAtRules.push({ type: "@media", text: rule.conditionText });
53
+ } else if (rule instanceof CSSSupportsRule) {
54
+ nextAtRules.push({ type: "@supports", text: rule.conditionText });
55
+ } else if (rule.constructor?.name === "CSSContainerRule" && "conditionText" in rule && typeof rule.conditionText === "string") {
56
+ nextAtRules.push({
57
+ type: "@container",
58
+ text: rule.conditionText
59
+ });
60
+ }
61
+ return nextAtRules;
62
+ }
63
+ function getNestedRuleList(rule) {
64
+ if (typeof CSSGroupingRule !== "undefined" && rule instanceof CSSGroupingRule) {
65
+ return rule.cssRules;
66
+ }
67
+ return null;
68
+ }
69
+ function getStyleVariant({
70
+ atRules,
71
+ pseudo
72
+ }) {
73
+ if (atRules.length === 0 && !pseudo) {
74
+ return null;
75
+ }
76
+ return { atRules, pseudo };
77
+ }
78
+ function getStyleVariantKey(variant) {
79
+ return variant ? JSON.stringify(variant) : "base";
80
+ }
81
+ function getDefinedStyleKey({
82
+ property,
83
+ variant
84
+ }) {
85
+ return `${property}:${getStyleVariantKey(variant)}`;
86
+ }
87
+ function getResolvedClassStyleValue({
88
+ className,
89
+ property,
90
+ raw,
91
+ variant
92
+ }) {
93
+ if (variant) {
94
+ return raw;
95
+ }
96
+ const temporaryElement = document.createElement("div");
97
+ temporaryElement.className = className;
98
+ document.body.append(temporaryElement);
99
+ const resolved = window.getComputedStyle(temporaryElement).getPropertyValue(property);
100
+ temporaryElement.remove();
101
+ return resolved.trim() || raw;
102
+ }
103
+ function setDefinedStyle({
104
+ definedStylesByKey,
105
+ property,
106
+ variant,
107
+ className,
108
+ raw,
109
+ resolved
110
+ }) {
111
+ definedStylesByKey.set(getDefinedStyleKey({ property, variant }), {
112
+ property,
113
+ variant,
114
+ className,
115
+ raw,
116
+ resolved
117
+ });
118
+ }
119
+ function addRuleDefinedStyles({
120
+ rule,
121
+ activeAtRules,
122
+ classNames,
123
+ definedStylesByKey
124
+ }) {
125
+ const selectorMatches = getClassSelectorMatches({
126
+ selectorText: rule.selectorText ?? "",
127
+ classNames
128
+ });
129
+ if (selectorMatches.length === 0) {
130
+ return;
131
+ }
132
+ for (const selectorMatch of selectorMatches) {
133
+ const variant = getStyleVariant({
134
+ atRules: activeAtRules,
135
+ pseudo: selectorMatch.pseudo
136
+ });
137
+ for (let styleIndex = 0; styleIndex < rule.style.length; styleIndex += 1) {
138
+ const property = rule.style.item(styleIndex);
139
+ if (!property || !isControlStyleProperty(property)) {
140
+ continue;
141
+ }
142
+ const raw = rule.style.getPropertyValue(property).trim();
143
+ if (!raw) {
144
+ continue;
145
+ }
146
+ setDefinedStyle({
147
+ definedStylesByKey,
148
+ property,
149
+ variant,
150
+ className: selectorMatch.className,
151
+ raw,
152
+ resolved: getResolvedClassStyleValue({
153
+ className: selectorMatch.className,
154
+ property,
155
+ raw,
156
+ variant
157
+ })
158
+ });
159
+ }
160
+ }
161
+ }
162
+ function addStyleRulesRecursively({
163
+ ruleList,
164
+ activeAtRules,
165
+ classNames,
166
+ definedStylesByKey
167
+ }) {
168
+ for (const rule of Array.from(ruleList)) {
169
+ const nestedRuleList = getNestedRuleList(rule);
170
+ if (nestedRuleList) {
171
+ addStyleRulesRecursively({
172
+ ruleList: nestedRuleList,
173
+ activeAtRules: getNestedAtRules({ rule, activeAtRules }),
174
+ classNames,
175
+ definedStylesByKey
176
+ });
177
+ }
178
+ if (rule instanceof CSSStyleRule) {
179
+ addRuleDefinedStyles({
180
+ rule,
181
+ activeAtRules,
182
+ classNames,
183
+ definedStylesByKey
184
+ });
185
+ }
186
+ }
187
+ }
188
+ function addClassDefinedStyles({
189
+ element,
190
+ definedStylesByKey
191
+ }) {
192
+ const classNames = Array.from(
193
+ new Set([...element.classList].filter(Boolean))
194
+ );
195
+ if (classNames.length === 0) {
196
+ return;
197
+ }
198
+ for (const sheet of Array.from(document.styleSheets)) {
199
+ if (sheet.href) {
200
+ try {
201
+ const sheetUrl = new URL(sheet.href);
202
+ if (sheetUrl.origin !== window.location.origin) {
203
+ continue;
204
+ }
205
+ } catch (error) {
206
+ if (error instanceof TypeError) {
207
+ continue;
208
+ }
209
+ throw error;
210
+ }
211
+ }
212
+ try {
213
+ addStyleRulesRecursively({
214
+ ruleList: sheet.cssRules,
215
+ activeAtRules: [],
216
+ classNames,
217
+ definedStylesByKey
218
+ });
219
+ } catch (error) {
220
+ if (error instanceof DOMException && error.name === "SecurityError") {
221
+ continue;
222
+ }
223
+ throw error;
224
+ }
225
+ }
226
+ }
227
+ function addInlineDefinedStyles({
228
+ element,
229
+ definedStylesByKey
230
+ }) {
231
+ if (!(element instanceof HTMLElement)) {
232
+ return;
233
+ }
234
+ for (let styleIndex = 0; styleIndex < element.style.length; styleIndex += 1) {
235
+ const property = element.style.item(styleIndex);
236
+ if (!property || !isControlStyleProperty(property)) {
237
+ continue;
238
+ }
239
+ const raw = element.style.getPropertyValue(property).trim();
240
+ if (!raw) {
241
+ continue;
242
+ }
243
+ setDefinedStyle({
244
+ definedStylesByKey,
245
+ property,
246
+ variant: null,
247
+ className: null,
248
+ raw,
249
+ resolved: raw
250
+ });
251
+ }
252
+ }
253
+ function getDefinedStyles(element) {
254
+ const definedStylesByKey = /* @__PURE__ */ new Map();
255
+ addClassDefinedStyles({ element, definedStylesByKey });
256
+ addInlineDefinedStyles({ element, definedStylesByKey });
257
+ return Array.from(definedStylesByKey.values());
258
+ }
259
+ function getInheritedStyles(element) {
260
+ const computedStyle = window.getComputedStyle(element);
261
+ const inheritedStyles = {};
262
+ for (const property of CONTROL_STYLE_PROPERTIES) {
263
+ inheritedStyles[property] = computedStyle.getPropertyValue(property);
264
+ }
265
+ return inheritedStyles;
266
+ }
267
+ export {
268
+ getDefinedStyles,
269
+ getInheritedStyles
270
+ };
271
+ //# sourceMappingURL=styleExtraction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../editor/select-mode/descriptor/styleExtraction.ts"],
4
+ "sourcesContent": ["import type {\n SelectModeDefinedStyle,\n SelectModeStyleAtRule,\n SelectModeStyleVariant,\n} from \"schemas/generated/selectMode\";\n\nconst CONTROL_STYLE_PROPERTIES = [\n \"color\",\n \"background-color\",\n \"font-family\",\n \"font-size\",\n \"font-weight\",\n \"line-height\",\n \"letter-spacing\",\n \"text-align\",\n] as const;\n\ntype ControlStyleProperty = (typeof CONTROL_STYLE_PROPERTIES)[number];\n\nconst CONTROL_STYLE_PROPERTY_SET = new Set<string>(CONTROL_STYLE_PROPERTIES);\n\ntype SelectorMatch = {\n className: string;\n pseudo: string | null;\n};\n\nfunction isControlStyleProperty(\n propertyName: string,\n): propertyName is ControlStyleProperty {\n return CONTROL_STYLE_PROPERTY_SET.has(propertyName);\n}\n\nfunction getEscapedClassName(className: string) {\n return CSS.escape(className);\n}\n\nfunction getClassSelectorMatches({\n selectorText,\n classNames,\n}: {\n selectorText: string;\n classNames: string[];\n}): SelectorMatch[] {\n const matches: SelectorMatch[] = [];\n const selectorParts = selectorText.split(\",\").map((selectorPart) => {\n return selectorPart.trim();\n });\n\n for (const selectorPart of selectorParts) {\n for (const className of classNames) {\n const escapedClassName = getEscapedClassName(className);\n const baseSelector = `.${escapedClassName}`;\n if (selectorPart === baseSelector) {\n matches.push({ className, pseudo: null });\n continue;\n }\n\n if (!selectorPart.startsWith(`${baseSelector}:`)) {\n continue;\n }\n\n const pseudo = selectorPart.slice(baseSelector.length);\n const isSimplePseudoSelector =\n pseudo.startsWith(\":\") &&\n !/[ >+~#[.]/.test(pseudo) &&\n !pseudo.includes(\"::\");\n if (isSimplePseudoSelector) {\n matches.push({ className, pseudo });\n }\n }\n }\n\n return matches;\n}\n\nfunction getNestedAtRules({\n rule,\n activeAtRules,\n}: {\n rule: CSSRule;\n activeAtRules: SelectModeStyleAtRule[];\n}): SelectModeStyleAtRule[] {\n const nextAtRules = [...activeAtRules];\n if (rule instanceof CSSMediaRule) {\n nextAtRules.push({ type: \"@media\", text: rule.conditionText });\n } else if (rule instanceof CSSSupportsRule) {\n nextAtRules.push({ type: \"@supports\", text: rule.conditionText });\n } else if (\n rule.constructor?.name === \"CSSContainerRule\" &&\n \"conditionText\" in rule &&\n typeof rule.conditionText === \"string\"\n ) {\n nextAtRules.push({\n type: \"@container\",\n text: rule.conditionText,\n });\n }\n return nextAtRules;\n}\n\nfunction getNestedRuleList(rule: CSSRule): CSSRuleList | null {\n if (\n typeof CSSGroupingRule !== \"undefined\" &&\n rule instanceof CSSGroupingRule\n ) {\n return rule.cssRules;\n }\n return null;\n}\n\nfunction getStyleVariant({\n atRules,\n pseudo,\n}: {\n atRules: SelectModeStyleAtRule[];\n pseudo: string | null;\n}): SelectModeStyleVariant | null {\n if (atRules.length === 0 && !pseudo) {\n return null;\n }\n return { atRules, pseudo };\n}\n\nfunction getStyleVariantKey(variant: SelectModeStyleVariant | null) {\n return variant ? JSON.stringify(variant) : \"base\";\n}\n\nfunction getDefinedStyleKey({\n property,\n variant,\n}: {\n property: string;\n variant: SelectModeStyleVariant | null;\n}) {\n return `${property}:${getStyleVariantKey(variant)}`;\n}\n\nfunction getResolvedClassStyleValue({\n className,\n property,\n raw,\n variant,\n}: {\n className: string;\n property: string;\n raw: string;\n variant: SelectModeStyleVariant | null;\n}) {\n if (variant) {\n return raw;\n }\n\n const temporaryElement = document.createElement(\"div\");\n temporaryElement.className = className;\n document.body.append(temporaryElement);\n const resolved = window\n .getComputedStyle(temporaryElement)\n .getPropertyValue(property);\n temporaryElement.remove();\n\n return resolved.trim() || raw;\n}\n\nfunction setDefinedStyle({\n definedStylesByKey,\n property,\n variant,\n className,\n raw,\n resolved,\n}: {\n definedStylesByKey: Map<string, SelectModeDefinedStyle>;\n property: string;\n variant: SelectModeStyleVariant | null;\n className: string | null;\n raw: string;\n resolved: string;\n}) {\n definedStylesByKey.set(getDefinedStyleKey({ property, variant }), {\n property,\n variant,\n className,\n raw,\n resolved,\n });\n}\n\nfunction addRuleDefinedStyles({\n rule,\n activeAtRules,\n classNames,\n definedStylesByKey,\n}: {\n rule: CSSStyleRule;\n activeAtRules: SelectModeStyleAtRule[];\n classNames: string[];\n definedStylesByKey: Map<string, SelectModeDefinedStyle>;\n}) {\n const selectorMatches = getClassSelectorMatches({\n selectorText: rule.selectorText ?? \"\",\n classNames,\n });\n if (selectorMatches.length === 0) {\n return;\n }\n\n for (const selectorMatch of selectorMatches) {\n const variant = getStyleVariant({\n atRules: activeAtRules,\n pseudo: selectorMatch.pseudo,\n });\n\n for (let styleIndex = 0; styleIndex < rule.style.length; styleIndex += 1) {\n const property = rule.style.item(styleIndex);\n if (!property || !isControlStyleProperty(property)) {\n continue;\n }\n\n const raw = rule.style.getPropertyValue(property).trim();\n if (!raw) {\n continue;\n }\n\n setDefinedStyle({\n definedStylesByKey,\n property,\n variant,\n className: selectorMatch.className,\n raw,\n resolved: getResolvedClassStyleValue({\n className: selectorMatch.className,\n property,\n raw,\n variant,\n }),\n });\n }\n }\n}\n\nfunction addStyleRulesRecursively({\n ruleList,\n activeAtRules,\n classNames,\n definedStylesByKey,\n}: {\n ruleList: CSSRuleList;\n activeAtRules: SelectModeStyleAtRule[];\n classNames: string[];\n definedStylesByKey: Map<string, SelectModeDefinedStyle>;\n}) {\n for (const rule of Array.from(ruleList)) {\n const nestedRuleList = getNestedRuleList(rule);\n if (nestedRuleList) {\n addStyleRulesRecursively({\n ruleList: nestedRuleList,\n activeAtRules: getNestedAtRules({ rule, activeAtRules }),\n classNames,\n definedStylesByKey,\n });\n }\n\n if (rule instanceof CSSStyleRule) {\n addRuleDefinedStyles({\n rule,\n activeAtRules,\n classNames,\n definedStylesByKey,\n });\n }\n }\n}\n\nfunction addClassDefinedStyles({\n element,\n definedStylesByKey,\n}: {\n element: Element;\n definedStylesByKey: Map<string, SelectModeDefinedStyle>;\n}) {\n const classNames = Array.from(\n new Set([...element.classList].filter(Boolean)),\n );\n if (classNames.length === 0) {\n return;\n }\n\n for (const sheet of Array.from(document.styleSheets)) {\n if (sheet.href) {\n try {\n const sheetUrl = new URL(sheet.href);\n if (sheetUrl.origin !== window.location.origin) {\n continue;\n }\n } catch (error) {\n if (error instanceof TypeError) {\n continue;\n }\n throw error;\n }\n }\n\n try {\n addStyleRulesRecursively({\n ruleList: sheet.cssRules,\n activeAtRules: [],\n classNames,\n definedStylesByKey,\n });\n } catch (error) {\n if (error instanceof DOMException && error.name === \"SecurityError\") {\n continue;\n }\n throw error;\n }\n }\n}\n\nfunction addInlineDefinedStyles({\n element,\n definedStylesByKey,\n}: {\n element: Element;\n definedStylesByKey: Map<string, SelectModeDefinedStyle>;\n}) {\n if (!(element instanceof HTMLElement)) {\n return;\n }\n\n for (let styleIndex = 0; styleIndex < element.style.length; styleIndex += 1) {\n const property = element.style.item(styleIndex);\n if (!property || !isControlStyleProperty(property)) {\n continue;\n }\n const raw = element.style.getPropertyValue(property).trim();\n if (!raw) {\n continue;\n }\n setDefinedStyle({\n definedStylesByKey,\n property,\n variant: null,\n className: null,\n raw,\n resolved: raw,\n });\n }\n}\n\nexport function getDefinedStyles(element: Element): SelectModeDefinedStyle[] {\n const definedStylesByKey = new Map<string, SelectModeDefinedStyle>();\n addClassDefinedStyles({ element, definedStylesByKey });\n addInlineDefinedStyles({ element, definedStylesByKey });\n return Array.from(definedStylesByKey.values());\n}\n\nexport function getInheritedStyles(element: Element): Record<string, string> {\n const computedStyle = window.getComputedStyle(element);\n const inheritedStyles: Record<string, string> = {};\n for (const property of CONTROL_STYLE_PROPERTIES) {\n inheritedStyles[property] = computedStyle.getPropertyValue(property);\n }\n return inheritedStyles;\n}\n"],
5
+ "mappings": "AAMA,MAAM,2BAA2B;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,MAAM,6BAA6B,IAAI,IAAY,wBAAwB;AAO3E,SAAS,uBACP,cACsC;AACtC,SAAO,2BAA2B,IAAI,YAAY;AACpD;AAEA,SAAS,oBAAoB,WAAmB;AAC9C,SAAO,IAAI,OAAO,SAAS;AAC7B;AAEA,SAAS,wBAAwB;AAAA,EAC/B;AAAA,EACA;AACF,GAGoB;AAClB,QAAM,UAA2B,CAAC;AAClC,QAAM,gBAAgB,aAAa,MAAM,GAAG,EAAE,IAAI,CAAC,iBAAiB;AAClE,WAAO,aAAa,KAAK;AAAA,EAC3B,CAAC;AAED,aAAW,gBAAgB,eAAe;AACxC,eAAW,aAAa,YAAY;AAClC,YAAM,mBAAmB,oBA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endor/schemas/generated/selectMode";
2
+ export declare const displayModeStore: {
3
+ getSnapshot(): DisplayMode;
4
+ getServerSnapshot(): DisplayMode;
5
+ subscribe(listener: () => void): () => void;
6
+ setDisplayMode(nextDisplayMode: DisplayMode): void;
7
+ /** Test-only: reset back to the default so specs don't leak state. */
8
+ reset(): void;
9
+ };
10
+ export declare function useDisplayMode(): DisplayMode;
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { useSyncExternalStore } from "react";
3
+ const listeners = /* @__PURE__ */ new Set();
4
+ let displayMode = "browse";
5
+ const SERVER_SNAPSHOT = "browse";
6
+ function notify() {
7
+ for (const listener of listeners) {
8
+ listener();
9
+ }
10
+ }
11
+ const displayModeStore = {
12
+ getSnapshot() {
13
+ return displayMode;
14
+ },
15
+ getServerSnapshot() {
16
+ return SERVER_SNAPSHOT;
17
+ },
18
+ subscribe(listener) {
19
+ listeners.add(listener);
20
+ return () => {
21
+ listeners.delete(listener);
22
+ };
23
+ },
24
+ setDisplayMode(nextDisplayMode) {
25
+ if (nextDisplayMode === displayMode) {
26
+ return;
27
+ }
28
+ displayMode = nextDisplayMode;
29
+ notify();
30
+ },
31
+ /** Test-only: reset back to the default so specs don't leak state. */
32
+ reset() {
33
+ displayMode = "browse";
34
+ }
35
+ };
36
+ function useDisplayMode() {
37
+ return useSyncExternalStore(
38
+ displayModeStore.subscribe,
39
+ displayModeStore.getSnapshot,
40
+ displayModeStore.getServerSnapshot
41
+ );
42
+ }
43
+ export {
44
+ displayModeStore,
45
+ useDisplayMode
46
+ };
47
+ //# sourceMappingURL=displayModeStore.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../editor/select-mode/displayModeStore.ts"],
4
+ "sourcesContent": ["\"use client\";\n\nimport type { DisplayMode } from \"schemas/generated/selectMode\";\n\nimport { useSyncExternalStore } from \"react\";\n\n/**\n * Framework-agnostic singleton for the preview iframe's select-mode display\n * mode (\"browse\" vs \"selection\"). It lives as a module singleton so that\n * components that don't share a provider ancestor \u2014 `EditorSelection` (which\n * owns the pointer/selection machinery) and `LinkInterceptor` (a sibling under\n * `ReploProvider`) \u2014 can agree on whether the user is currently selecting.\n *\n * `LinkInterceptor` needs this because in agent-preview mode it turns\n * same-origin link clicks into a `replo:navigate` postMessage (SPA-style\n * navigation of the preview). While select mode is active that navigation must\n * stand down so a link click selects the element instead of leaving the page \u2014\n * the two capture-phase click listeners otherwise race, and `stopPropagation`\n * can't suppress a sibling listener on the same node.\n *\n * @author Noah Gilmore 2026-07-23\n */\n\nconst listeners = new Set<() => void>();\nlet displayMode: DisplayMode = \"browse\";\n\n// select-mode DOM behavior is client-only, so the server snapshot is a stable\n// constant and never causes a hydration mismatch.\nconst SERVER_SNAPSHOT: DisplayMode = \"browse\";\n\nfunction notify() {\n for (const listener of listeners) {\n listener();\n }\n}\n\nexport const displayModeStore = {\n getSnapshot(): DisplayMode {\n return displayMode;\n },\n getServerSnapshot(): DisplayMode {\n return SERVER_SNAPSHOT;\n },\n subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n setDisplayMode(nextDisplayMode: DisplayMode) {\n if (nextDisplayMode === displayMode) {\n return;\n }\n displayMode = nextDisplayMode;\n notify();\n },\n /** Test-only: reset back to the default so specs don't leak state. */\n reset() {\n displayMode = \"browse\";\n },\n};\n\nexport function useDisplayMode(): DisplayMode {\n return useSyncExternalStore(\n displayModeStore.subscribe,\n displayModeStore.getSnapshot,\n displayModeStore.getServerSnapshot,\n );\n}\n"],
5
+ "mappings": ";AAIA,SAAS,4BAA4B;AAmBrC,MAAM,YAAY,oBAAI,IAAgB;AACtC,IAAI,cAA2B;AAI/B,MAAM,kBAA+B;AAErC,SAAS,SAAS;AAChB,aAAW,YAAY,WAAW;AAChC,aAAS;AAAA,EACX;AACF;AAEO,MAAM,mBAAmB;AAAA,EAC9B,cAA2B;AACzB,WAAO;AAAA,EACT;AAAA,EACA,oBAAiC;AAC/B,WAAO;AAAA,EACT;AAAA,EACA,UAAU,UAAkC;AAC1C,cAAU,IAAI,QAAQ;AACtB,WAAO,MAAM;AACX,gBAAU,OAAO,QAAQ;AAAA,IAC3B;AAAA,EACF;AAAA,EACA,eAAe,iBAA8B;AAC3C,QAAI,oBAAoB,aAAa;AACnC;AAAA,IACF;AACA,kBAAc;AACd,WAAO;AAAA,EACT;AAAA;AAAA,EAEA,QAAQ;AACN,kBAAc;AAAA,EAChB;AACF;AAEO,SAAS,iBAA8B;AAC5C,SAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,EACnB;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ export declare function installFastRefreshRelay({ onComplete, }?: {
2
+ onComplete?: () => void;
3
+ }): void;
@@ -0,0 +1,35 @@
1
+ let hasInstalledFastRefreshRelay = false;
2
+ let onFastRefreshComplete = null;
3
+ function installFastRefreshRelay({
4
+ onComplete
5
+ } = {}) {
6
+ onFastRefreshComplete = onComplete ?? null;
7
+ if (hasInstalledFastRefreshRelay) {
8
+ return;
9
+ }
10
+ hasInstalledFastRefreshRelay = true;
11
+ const originalLog = console.log;
12
+ const originalInfo = console.info;
13
+ const relayIfFastRefreshComplete = (...args) => {
14
+ const message = args.join(" ");
15
+ if (message.includes("[Fast Refresh] done")) {
16
+ window.parent.postMessage(
17
+ { type: "replo:select:fastRefreshComplete" },
18
+ "*"
19
+ );
20
+ onFastRefreshComplete?.();
21
+ }
22
+ };
23
+ console.log = (...args) => {
24
+ relayIfFastRefreshComplete(...args);
25
+ originalLog(...args);
26
+ };
27
+ console.info = (...args) => {
28
+ relayIfFastRefreshComplete(...args);
29
+ originalInfo(...args);
30
+ };
31
+ }
32
+ export {
33
+ installFastRefreshRelay
34
+ };
35
+ //# sourceMappingURL=fast-refresh-relay.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../editor/select-mode/fast-refresh-relay.ts"],
4
+ "sourcesContent": ["let hasInstalledFastRefreshRelay = false;\nlet onFastRefreshComplete: (() => void) | null = null;\n\nexport function installFastRefreshRelay({\n onComplete,\n}: { onComplete?: () => void } = {}) {\n onFastRefreshComplete = onComplete ?? null;\n if (hasInstalledFastRefreshRelay) {\n return;\n }\n hasInstalledFastRefreshRelay = true;\n\n const originalLog = console.log;\n const originalInfo = console.info;\n const relayIfFastRefreshComplete = (...args: unknown[]) => {\n const message = args.join(\" \");\n if (message.includes(\"[Fast Refresh] done\")) {\n window.parent.postMessage(\n { type: \"replo:select:fastRefreshComplete\" },\n \"*\",\n );\n onFastRefreshComplete?.();\n }\n };\n\n console.log = (...args: unknown[]) => {\n relayIfFastRefreshComplete(...args);\n originalLog(...args);\n };\n console.info = (...args: unknown[]) => {\n relayIfFastRefreshComplete(...args);\n originalInfo(...args);\n };\n}\n"],
5
+ "mappings": "AAAA,IAAI,+BAA+B;AACnC,IAAI,wBAA6C;AAE1C,SAAS,wBAAwB;AAAA,EACtC;AACF,IAAiC,CAAC,GAAG;AACnC,0BAAwB,cAAc;AACtC,MAAI,8BAA8B;AAChC;AAAA,EACF;AACA,iCAA+B;AAE/B,QAAM,cAAc,QAAQ;AAC5B,QAAM,eAAe,QAAQ;AAC7B,QAAM,6BAA6B,IAAI,SAAoB;AACzD,UAAM,UAAU,KAAK,KAAK,GAAG;AAC7B,QAAI,QAAQ,SAAS,qBAAqB,GAAG;AAC3C,aAAO,OAAO;AAAA,QACZ,EAAE,MAAM,mCAAmC;AAAA,QAC3C;AAAA,MACF;AACA,8BAAwB;AAAA,IAC1B;AAAA,EACF;AAEA,UAAQ,MAAM,IAAI,SAAoB;AACpC,+BAA2B,GAAG,IAAI;AAClC,gBAAY,GAAG,IAAI;AAAA,EACrB;AACA,UAAQ,OAAO,IAAI,SAAoB;AACrC,+BAA2B,GAAG,IAAI;AAClC,iBAAa,GAAG,IAAI;AAAA,EACtB;AACF;",
6
+ "names": []
7
+ }
@@ -38,6 +38,23 @@ export declare function findDebugSourceReact19(fiber: ReactFiber): {
38
38
  componentName?: string;
39
39
  } | null;
40
40
  export declare function getSourceLocation(element: HTMLElement): SourceLocation | undefined;
41
+ export declare function getHostSourceIdentity(element: HTMLElement): {
42
+ filePath: string;
43
+ lineNumber: number;
44
+ columnNumber: number | undefined;
45
+ tagName: string;
46
+ } | null;
47
+ export declare function getFiberChain(element: HTMLElement): {
48
+ sourceLocation: {
49
+ filePath: string;
50
+ lineNumber: number;
51
+ columnNumber: number | undefined;
52
+ componentName: string | undefined;
53
+ };
54
+ tagName: string | undefined;
55
+ componentName: string | undefined;
56
+ props: Record<string, unknown> | undefined;
57
+ }[];
41
58
  /**
42
59
  * Extract event handlers from React fiber or DOM element
43
60
  *
@@ -1,3 +1,7 @@
1
+ import { z } from "zod";
2
+ const MAX_FIBER_CHAIN_DEPTH = 80;
3
+ const MAX_SERIALIZED_PROP_COUNT = 24;
4
+ const MAX_SERIALIZED_STRING_LENGTH = 500;
1
5
  const REACT_INTERNAL_FRAME_PATTERNS = [
2
6
  /react.*jsx-dev-runtime/,
3
7
  /react.*jsx-runtime/,
@@ -139,40 +143,6 @@ function findDebugSourceReact19(fiber) {
139
143
  let depth = 0;
140
144
  const maxDepth = 50;
141
145
  while (current && depth < maxDepth) {
142
- const anyFiber = current;
143
- const possibleSourceKeys = [
144
- "_debugSource",
145
- "__source",
146
- "_source",
147
- "debugSource"
148
- ];
149
- for (const key of possibleSourceKeys) {
150
- const source = anyFiber[key];
151
- if (source && typeof source === "object" && "fileName" in source) {
152
- return {
153
- // Legacy cast - may or may not be necessary
154
- // eslint-disable-next-line replo/no-as-cast
155
- source,
156
- componentName: getComponentName(current)
157
- };
158
- }
159
- }
160
- if (current.memoizedProps) {
161
- const props = current.memoizedProps;
162
- if (props.__source && typeof props.__source === "object") {
163
- const source = props.__source;
164
- if (source.fileName && source.lineNumber) {
165
- return {
166
- source: {
167
- fileName: source.fileName,
168
- lineNumber: source.lineNumber,
169
- columnNumber: source.columnNumber
170
- },
171
- componentName: getComponentName(current)
172
- };
173
- }
174
- }
175
- }
176
146
  const debugStackSource = parseDebugStackSource(current._debugStack) ?? parseDebugStackSource(current._debugOwner?._debugStack);
177
147
  if (debugStackSource) {
178
148
  return {
@@ -204,6 +174,103 @@ function getSourceLocation(element) {
204
174
  }
205
175
  return void 0;
206
176
  }
177
+ function getDebugSource(fiber) {
178
+ const debugInfo = findDebugSource(fiber) ?? findDebugSourceReact19(fiber);
179
+ return debugInfo?.source;
180
+ }
181
+ function getTagName(fiber) {
182
+ return z.string().safeParse(fiber.type).data?.toLowerCase();
183
+ }
184
+ function getHostSourceIdentity(element) {
185
+ const fiber = getFiberFromElement(element);
186
+ if (!fiber) {
187
+ return null;
188
+ }
189
+ const source = getDebugSource(fiber);
190
+ if (!source) {
191
+ return null;
192
+ }
193
+ return {
194
+ filePath: source.fileName,
195
+ lineNumber: source.lineNumber,
196
+ columnNumber: source.columnNumber,
197
+ tagName: element.tagName.toLowerCase()
198
+ };
199
+ }
200
+ function getSerializablePropValue(value) {
201
+ if (value === null || typeof value === "number" || typeof value === "boolean") {
202
+ return value;
203
+ }
204
+ if (typeof value === "string") {
205
+ return value.length > MAX_SERIALIZED_STRING_LENGTH ? `${value.slice(0, MAX_SERIALIZED_STRING_LENGTH)}...` : value;
206
+ }
207
+ if (Array.isArray(value)) {
208
+ return value.slice(0, 20).map(getSerializablePropValue);
209
+ }
210
+ if (typeof value === "object") {
211
+ return "[object]";
212
+ }
213
+ return void 0;
214
+ }
215
+ function getSerializableProps(props) {
216
+ if (!props) {
217
+ return void 0;
218
+ }
219
+ const serializedProps = {};
220
+ for (const [key, value] of Object.entries(props).slice(
221
+ 0,
222
+ MAX_SERIALIZED_PROP_COUNT
223
+ )) {
224
+ if (key === "children" || key === "ref" || key.startsWith("on") || typeof value === "function" || typeof value === "symbol") {
225
+ continue;
226
+ }
227
+ const serializableValue = getSerializablePropValue(value);
228
+ if (serializableValue !== void 0) {
229
+ serializedProps[key] = serializableValue;
230
+ }
231
+ }
232
+ return Object.keys(serializedProps).length > 0 ? serializedProps : void 0;
233
+ }
234
+ function getFiberChain(element) {
235
+ const rootFiber = getFiberFromElement(element);
236
+ const fiberChain = [];
237
+ const seenKeys = /* @__PURE__ */ new Set();
238
+ let currentFiber = rootFiber;
239
+ let depth = 0;
240
+ while (currentFiber && depth < MAX_FIBER_CHAIN_DEPTH) {
241
+ const source = getDebugSource(currentFiber);
242
+ if (source) {
243
+ const tagName = getTagName(currentFiber);
244
+ const componentName = getComponentName(currentFiber);
245
+ const key = [
246
+ source.fileName,
247
+ source.lineNumber,
248
+ source.columnNumber ?? "",
249
+ tagName ?? "",
250
+ componentName ?? ""
251
+ ].join(":");
252
+ if (!seenKeys.has(key)) {
253
+ seenKeys.add(key);
254
+ fiberChain.push({
255
+ sourceLocation: {
256
+ filePath: source.fileName,
257
+ lineNumber: source.lineNumber,
258
+ columnNumber: source.columnNumber,
259
+ componentName
260
+ },
261
+ tagName,
262
+ componentName,
263
+ props: getSerializableProps(
264
+ currentFiber.memoizedProps ?? currentFiber.pendingProps
265
+ )
266
+ });
267
+ }
268
+ }
269
+ currentFiber = currentFiber.return;
270
+ depth += 1;
271
+ }
272
+ return fiberChain;
273
+ }
207
274
  function extractEventHandlers(element) {
208
275
  const handlers = {};
209
276
  const fiber = getFiberFromElement(element);
@@ -262,7 +329,9 @@ export {
262
329
  findDebugSource,
263
330
  findDebugSourceReact19,
264
331
  getComponentName,
332
+ getFiberChain,
265
333
  getFiberFromElement,
334
+ getHostSourceIdentity,
266
335
  getSourceLocation,
267
336
  stringifyHandler
268
337
  };