@replohq/canopy-sdk 2.6.0 → 3.0.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 (389) hide show
  1. package/_vendor/replo-utils/lib/fonts.mjs +1 -0
  2. package/_vendor/replo-utils/lib/geometry.mjs +2 -0
  3. package/_vendor/replo-utils/lib/json.mjs +1 -0
  4. package/_vendor/replo-utils/lib/misc.mjs +1 -0
  5. package/_vendor/replo-utils/lib/posthogReplay.mjs +2 -0
  6. package/_vendor/replo-utils/lib/url.mjs +1 -0
  7. package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +1 -1
  8. package/_vendor/schemas/designLibrary.mjs +1 -1
  9. package/_vendor/schemas/generated/consent.d.ts +2 -0
  10. package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +8 -0
  11. package/_vendor/schemas/iframeRpcChannel.mjs +2 -1
  12. package/_vendor/schemas/loaderKeys.d.ts +1 -1
  13. package/_vendor/schemas/loaderKeys.mjs +103 -23
  14. package/_vendor/schemas/money.mjs +1860 -3
  15. package/_vendor/schemas/pageAnnotations.mjs +1 -1
  16. package/_vendor/schemas/routing/match.mjs +1 -0
  17. package/_vendor/schemas/routing/rules.mjs +2 -1
  18. package/_vendor/schemas/selectMode.d.ts +4 -4
  19. package/_vendor/schemas/selectMode.mjs +1 -0
  20. package/_vendor/schemas/selectModeIframeRpc.d.ts +25 -5
  21. package/_vendor/schemas/selectModeIframeRpc.mjs +12 -3
  22. package/analytics/analytics-provider.d.ts +5 -10
  23. package/analytics/analytics-provider.js +14 -101
  24. package/analytics/analytics-provider.js.map +2 -2
  25. package/analytics/get-analytics-sinks.d.ts +2 -19
  26. package/analytics/get-analytics-sinks.js +9 -46
  27. package/analytics/get-analytics-sinks.js.map +2 -2
  28. package/analytics/hooks/use-product-viewed-analytics.d.ts +2 -6
  29. package/analytics/hooks/use-product-viewed-analytics.js +6 -28
  30. package/analytics/hooks/use-product-viewed-analytics.js.map +2 -2
  31. package/analytics/replo-first-party-pixel.d.ts +3 -12
  32. package/analytics/replo-first-party-pixel.js +8 -24
  33. package/analytics/replo-first-party-pixel.js.map +2 -2
  34. package/analytics/replo-pixel-script.d.ts +4 -10
  35. package/analytics/replo-pixel-script.js +9 -23
  36. package/analytics/replo-pixel-script.js.map +2 -2
  37. package/analytics/sinks/ga4-sink.d.ts +10 -9
  38. package/analytics/sinks/ga4-sink.js +99 -50
  39. package/analytics/sinks/ga4-sink.js.map +2 -2
  40. package/analytics/sinks/meta-sink.d.ts +5 -4
  41. package/analytics/sinks/meta-sink.js +82 -29
  42. package/analytics/sinks/meta-sink.js.map +2 -2
  43. package/analytics/sinks/pinterest-sink.d.ts +7 -6
  44. package/analytics/sinks/pinterest-sink.js +82 -49
  45. package/analytics/sinks/pinterest-sink.js.map +2 -2
  46. package/analytics/sinks/reddit-sink.d.ts +8 -7
  47. package/analytics/sinks/reddit-sink.js +82 -53
  48. package/analytics/sinks/reddit-sink.js.map +2 -2
  49. package/analytics/sinks/replo-sink.d.ts +9 -8
  50. package/analytics/sinks/replo-sink.js +89 -37
  51. package/analytics/sinks/replo-sink.js.map +2 -2
  52. package/analytics/sinks/snapchat-sink.d.ts +6 -5
  53. package/analytics/sinks/snapchat-sink.js +82 -40
  54. package/analytics/sinks/snapchat-sink.js.map +2 -2
  55. package/analytics/sinks/tiktok-sink.d.ts +8 -7
  56. package/analytics/sinks/tiktok-sink.js +82 -52
  57. package/analytics/sinks/tiktok-sink.js.map +2 -2
  58. package/analytics/sinks/window-sink.d.ts +11 -14
  59. package/analytics/sinks/window-sink.js +101 -28
  60. package/analytics/sinks/window-sink.js.map +2 -2
  61. package/analytics/utils/analytics-utils.d.ts +4 -2
  62. package/analytics/utils/analytics-utils.js +19 -123
  63. package/analytics/utils/analytics-utils.js.map +2 -2
  64. package/analytics/utils/navigation-tracker.d.ts +2 -1
  65. package/analytics/utils/navigation-tracker.js +37 -30
  66. package/analytics/utils/navigation-tracker.js.map +2 -2
  67. package/analytics/utils/shopify-funnel-gate.d.ts +2 -7
  68. package/analytics/utils/shopify-funnel-gate.js +8 -15
  69. package/analytics/utils/shopify-funnel-gate.js.map +2 -2
  70. package/cart/buy-now-action.d.ts +2 -9
  71. package/cart/buy-now-action.js +5 -97
  72. package/cart/buy-now-action.js.map +2 -2
  73. package/cart/cart-actions.d.ts +12 -56
  74. package/cart/cart-actions.js +88 -68
  75. package/cart/cart-actions.js.map +2 -2
  76. package/cart/cart-loader.d.ts +3 -9
  77. package/cart/cart-loader.js +14 -6
  78. package/cart/cart-loader.js.map +2 -2
  79. package/cart/cart-provider.d.ts +6 -58
  80. package/cart/cart-provider.js +13 -359
  81. package/cart/cart-provider.js.map +3 -3
  82. package/cart/cart-schema.d.ts +2 -1
  83. package/cart/cart-schema.js +12 -64
  84. package/cart/cart-schema.js.map +2 -2
  85. package/cart/cart-types.d.ts +1 -1
  86. package/cart/cart-types.js +5 -4
  87. package/cart/cart-types.js.map +2 -2
  88. package/cart/gateways/cart-constants.d.ts +1 -0
  89. package/cart/gateways/cart-constants.js.map +2 -2
  90. package/cart/gateways/cart-gateway.d.ts +1 -0
  91. package/cart/gateways/cart-gateway.js +13 -12
  92. package/cart/gateways/cart-gateway.js.map +2 -2
  93. package/cart/gateways/cookie-cart-gateway.d.ts +8 -11
  94. package/cart/gateways/cookie-cart-gateway.js +93 -97
  95. package/cart/gateways/cookie-cart-gateway.js.map +2 -2
  96. package/cart/gateways/default-cart-gateway.d.ts +10 -16
  97. package/cart/gateways/default-cart-gateway.js +13 -23
  98. package/cart/gateways/default-cart-gateway.js.map +2 -2
  99. package/cart/gateways/resolver-cart-gateway.d.ts +1 -0
  100. package/cart/gateways/resolver-cart-gateway.js +13 -102
  101. package/cart/gateways/resolver-cart-gateway.js.map +2 -2
  102. package/cart/gateways/stripe-cart-gateway.d.ts +10 -16
  103. package/cart/gateways/stripe-cart-gateway.js +13 -21
  104. package/cart/gateways/stripe-cart-gateway.js.map +2 -2
  105. package/cart/hooks/use-add-to-cart.d.ts +3 -47
  106. package/cart/hooks/use-add-to-cart.js +10 -115
  107. package/cart/hooks/use-add-to-cart.js.map +2 -2
  108. package/cart/hooks/use-buy-now.d.ts +1 -39
  109. package/cart/hooks/use-buy-now.js +5 -55
  110. package/cart/hooks/use-buy-now.js.map +2 -2
  111. package/cart/utils/cart-utils.d.ts +8 -35
  112. package/cart/utils/cart-utils.js +21 -35
  113. package/cart/utils/cart-utils.js.map +2 -2
  114. package/cart/utils/cookie-cart-persistence.d.ts +16 -41
  115. package/cart/utils/cookie-cart-persistence.js +38 -143
  116. package/cart/utils/cookie-cart-persistence.js.map +2 -2
  117. package/cart/utils/variant-to-cart-line.d.ts +12 -42
  118. package/cart/utils/variant-to-cart-line.js +31 -147
  119. package/cart/utils/variant-to-cart-line.js.map +2 -2
  120. package/chunk-UJCSKKID.mjs +27 -0
  121. package/{chunk-OFU2QEDR.mjs → chunk-ZZPQ3E7S.mjs} +50 -5
  122. package/consent/consent-action.d.ts +2 -1
  123. package/consent/consent-action.js +10 -20
  124. package/consent/consent-action.js.map +2 -2
  125. package/consent/consent-actions.d.ts +2 -13
  126. package/consent/consent-actions.js +9 -29
  127. package/consent/consent-actions.js.map +2 -2
  128. package/consent/consent-store.d.ts +9 -36
  129. package/consent/consent-store.js +12 -182
  130. package/consent/consent-store.js.map +2 -2
  131. package/consent/cookie.d.ts +9 -12
  132. package/consent/cookie.js +32 -64
  133. package/consent/cookie.js.map +2 -2
  134. package/consent/replo-scripts.d.ts +5 -18
  135. package/consent/replo-scripts.js +11 -94
  136. package/consent/replo-scripts.js.map +2 -2
  137. package/consent/script-registration-store.d.ts +6 -2
  138. package/consent/script-registration-store.js +33 -47
  139. package/consent/script-registration-store.js.map +2 -2
  140. package/consent/script-snippets.d.ts +4 -18
  141. package/consent/script-snippets.js +19 -127
  142. package/consent/script-snippets.js.map +2 -2
  143. package/consent/window-api.d.ts +4 -15
  144. package/consent/window-api.js +8 -63
  145. package/consent/window-api.js.map +2 -2
  146. package/editor/ClientErrorBoundary.d.ts +4 -10
  147. package/editor/ClientErrorBoundary.js +7 -55
  148. package/editor/ClientErrorBoundary.js.map +2 -2
  149. package/editor/DocumentReadyBeacon.d.ts +3 -1
  150. package/editor/DocumentReadyBeacon.js +6 -3
  151. package/editor/DocumentReadyBeacon.js.map +2 -2
  152. package/editor/LinkInterceptor.d.ts +1 -0
  153. package/editor/LinkInterceptor.js +6 -121
  154. package/editor/LinkInterceptor.js.map +2 -2
  155. package/editor/NextErrorReporter.d.ts +1 -0
  156. package/editor/NextErrorReporter.js +6 -85
  157. package/editor/NextErrorReporter.js.map +2 -2
  158. package/editor/annotations/AnnotationLayerMount.d.ts +1 -0
  159. package/editor/annotations/AnnotationLayerMount.js +6 -6
  160. package/editor/annotations/AnnotationLayerMount.js.map +2 -2
  161. package/editor/annotations/annotationController.d.ts +1 -0
  162. package/editor/annotations/annotationController.js +6 -378
  163. package/editor/annotations/annotationController.js.map +2 -2
  164. package/editor/annotations/bridgeGate.d.ts +4 -7
  165. package/editor/annotations/bridgeGate.js +13 -15
  166. package/editor/annotations/bridgeGate.js.map +2 -2
  167. package/editor/design-library-preview/DesignLibraryPreview.d.ts +1 -0
  168. package/editor/design-library-preview/DesignLibraryPreview.js +6 -86
  169. package/editor/design-library-preview/DesignLibraryPreview.js.map +2 -2
  170. package/editor/posthog-relay.d.ts +1 -10
  171. package/editor/posthog-relay.js +6 -65
  172. package/editor/posthog-relay.js.map +2 -2
  173. package/editor/select-mode/EditorSelection.d.ts +1 -23
  174. package/editor/select-mode/EditorSelection.js +5 -87
  175. package/editor/select-mode/EditorSelection.js.map +2 -2
  176. package/editor/select-mode/annotationFrames.d.ts +9 -9
  177. package/editor/select-mode/annotationFrames.js +22 -103
  178. package/editor/select-mode/annotationFrames.js.map +2 -2
  179. package/editor/select-mode/descriptor/elementDescriptor.d.ts +6 -21
  180. package/editor/select-mode/descriptor/elementDescriptor.js +19 -192
  181. package/editor/select-mode/descriptor/elementDescriptor.js.map +3 -3
  182. package/editor/select-mode/descriptor/styleExtraction.d.ts +4 -2
  183. package/editor/select-mode/descriptor/styleExtraction.js +11 -262
  184. package/editor/select-mode/descriptor/styleExtraction.js.map +2 -2
  185. package/editor/select-mode/displayModeStore.d.ts +2 -0
  186. package/editor/select-mode/displayModeStore.js +14 -39
  187. package/editor/select-mode/displayModeStore.js.map +2 -2
  188. package/editor/select-mode/fast-refresh-relay.d.ts +2 -1
  189. package/editor/select-mode/fast-refresh-relay.js +7 -28
  190. package/editor/select-mode/fast-refresh-relay.js.map +2 -2
  191. package/editor/select-mode/fiber.d.ts +14 -7
  192. package/editor/select-mode/fiber.js +40 -286
  193. package/editor/select-mode/fiber.js.map +2 -2
  194. package/editor/select-mode/hooks/useCrosshairCursor.d.ts +2 -9
  195. package/editor/select-mode/hooks/useCrosshairCursor.js +7 -15
  196. package/editor/select-mode/hooks/useCrosshairCursor.js.map +2 -2
  197. package/editor/select-mode/hooks/useEditModeStateMachine.d.ts +5 -3
  198. package/editor/select-mode/hooks/useEditModeStateMachine.js +13 -228
  199. package/editor/select-mode/hooks/useEditModeStateMachine.js.map +2 -2
  200. package/editor/select-mode/hooks/useOptimisticOverrides.d.ts +2 -1
  201. package/editor/select-mode/hooks/useOptimisticOverrides.js +6 -277
  202. package/editor/select-mode/hooks/useOptimisticOverrides.js.map +2 -2
  203. package/editor/select-mode/hooks/useParentMessaging.d.ts +2 -20
  204. package/editor/select-mode/hooks/useParentMessaging.js +7 -69
  205. package/editor/select-mode/hooks/useParentMessaging.js.map +2 -2
  206. package/editor/select-mode/hooks/useSelectModeController.d.ts +2 -1
  207. package/editor/select-mode/hooks/useSelectModeController.js +6 -40
  208. package/editor/select-mode/hooks/useSelectModeController.js.map +2 -2
  209. package/editor/select-mode/hooks/useSelectionHover.d.ts +2 -16
  210. package/editor/select-mode/hooks/useSelectionHover.js +7 -105
  211. package/editor/select-mode/hooks/useSelectionHover.js.map +2 -2
  212. package/editor/select-mode/hooks/useSelectionInteractions.d.ts +2 -26
  213. package/editor/select-mode/hooks/useSelectionInteractions.js +7 -348
  214. package/editor/select-mode/hooks/useSelectionInteractions.js.map +2 -2
  215. package/editor/select-mode/hooks/useSelectionScrollSync.d.ts +2 -22
  216. package/editor/select-mode/hooks/useSelectionScrollSync.js +7 -65
  217. package/editor/select-mode/hooks/useSelectionScrollSync.js.map +2 -2
  218. package/editor/select-mode/hooks/useSiblingResolution.d.ts +4 -2
  219. package/editor/select-mode/hooks/useSiblingResolution.js +13 -52
  220. package/editor/select-mode/hooks/useSiblingResolution.js.map +2 -2
  221. package/editor/select-mode/iframeRpcChannel.d.ts +10 -349
  222. package/editor/select-mode/iframeRpcChannel.js +23 -79
  223. package/editor/select-mode/iframeRpcChannel.js.map +2 -2
  224. package/editor/select-mode/inlineTextMarks.d.ts +4 -6
  225. package/editor/select-mode/inlineTextMarks.js +13 -18
  226. package/editor/select-mode/inlineTextMarks.js.map +2 -2
  227. package/editor/select-mode/interactions/selectionGeometry.d.ts +19 -61
  228. package/editor/select-mode/interactions/selectionGeometry.js +57 -165
  229. package/editor/select-mode/interactions/selectionGeometry.js.map +2 -2
  230. package/editor/select-mode/selectModeSession.d.ts +1 -0
  231. package/editor/select-mode/selectModeSession.js +6 -3
  232. package/editor/select-mode/selectModeSession.js.map +2 -2
  233. package/editor/select-mode/selectionFrame.d.ts +9 -60
  234. package/editor/select-mode/selectionFrame.js +28 -116
  235. package/editor/select-mode/selectionFrame.js.map +2 -2
  236. package/editor/select-mode/symbolicate.d.ts +2 -1
  237. package/editor/select-mode/symbolicate.js +7 -195
  238. package/editor/select-mode/symbolicate.js.map +2 -2
  239. package/editor/select-mode/tiptapInlineEditor.d.ts +15 -2
  240. package/editor/select-mode/tiptapInlineEditor.js +6 -114
  241. package/editor/select-mode/tiptapInlineEditor.js.map +2 -2
  242. package/env.d.ts +2 -1
  243. package/env.js +10 -37
  244. package/env.js.map +2 -2
  245. package/gateways/canopy-api.d.ts +15 -12
  246. package/gateways/canopy-api.js +122 -160
  247. package/gateways/canopy-api.js.map +2 -2
  248. package/hooks/use-client-value.d.ts +2 -10
  249. package/hooks/use-client-value.js +10 -7
  250. package/hooks/use-client-value.js.map +2 -2
  251. package/hooks/use-formatted-price.d.ts +1 -14
  252. package/hooks/use-formatted-price.js +6 -14
  253. package/hooks/use-formatted-price.js.map +2 -2
  254. package/lib/canopy-error.d.ts +2 -5
  255. package/lib/canopy-error.js +10 -14
  256. package/lib/canopy-error.js.map +2 -2
  257. package/lib/get-query-client.d.ts +2 -1
  258. package/lib/get-query-client.js +8 -27
  259. package/lib/get-query-client.js.map +2 -2
  260. package/lib/integration-utils.d.ts +1 -0
  261. package/lib/integration-utils.js +9 -3
  262. package/lib/integration-utils.js.map +2 -2
  263. package/lib/shopify-utils.d.ts +2 -10
  264. package/lib/shopify-utils.js +10 -2
  265. package/lib/shopify-utils.js.map +2 -2
  266. package/lib/tombstone.d.ts +21 -0
  267. package/lib/tombstone.js +99 -0
  268. package/lib/tombstone.js.map +7 -0
  269. package/lib/url-utils.d.ts +2 -4
  270. package/lib/url-utils.js +10 -3
  271. package/lib/url-utils.js.map +2 -2
  272. package/loaders/collection-loader.d.ts +3 -2
  273. package/loaders/collection-loader.js +5 -48
  274. package/loaders/collection-loader.js.map +2 -2
  275. package/loaders/collection-products-loader.d.ts +3 -2
  276. package/loaders/collection-products-loader.js +5 -51
  277. package/loaders/collection-products-loader.js.map +2 -2
  278. package/loaders/contentful-entries-loader.d.ts +3 -2
  279. package/loaders/contentful-entries-loader.js +5 -71
  280. package/loaders/contentful-entries-loader.js.map +2 -2
  281. package/loaders/contentful-entry-loader.d.ts +3 -2
  282. package/loaders/contentful-entry-loader.js +5 -53
  283. package/loaders/contentful-entry-loader.js.map +2 -2
  284. package/loaders/invoke-loader-action.d.ts +2 -8
  285. package/loaders/invoke-loader-action.js +13 -8
  286. package/loaders/invoke-loader-action.js.map +2 -2
  287. package/loaders/invoke-loader-server.d.ts +2 -14
  288. package/loaders/invoke-loader-server.js +12 -34
  289. package/loaders/invoke-loader-server.js.map +2 -2
  290. package/loaders/invoke-loader.d.ts +6 -12
  291. package/loaders/invoke-loader.js +27 -29
  292. package/loaders/invoke-loader.js.map +2 -2
  293. package/loaders/levanta-product-loader.d.ts +3 -2
  294. package/loaders/levanta-product-loader.js +5 -46
  295. package/loaders/levanta-product-loader.js.map +2 -2
  296. package/loaders/loader-error-boundary.d.ts +9 -15
  297. package/loaders/loader-error-boundary.js +50 -13
  298. package/loaders/loader-error-boundary.js.map +2 -2
  299. package/loaders/loader-keys.d.ts +4 -12
  300. package/loaders/loader-keys.js +6 -1
  301. package/loaders/loader-keys.js.map +2 -2
  302. package/loaders/loader-schemas.d.ts +142 -61
  303. package/loaders/loader-schemas.js +253 -90
  304. package/loaders/loader-schemas.js.map +2 -2
  305. package/loaders/metaobject-loader.d.ts +3 -2
  306. package/loaders/metaobject-loader.js +5 -47
  307. package/loaders/metaobject-loader.js.map +2 -2
  308. package/loaders/metaobjects-loader.d.ts +3 -2
  309. package/loaders/metaobjects-loader.js +5 -53
  310. package/loaders/metaobjects-loader.js.map +2 -2
  311. package/loaders/okendo-review-aggregate-loader.d.ts +9 -10
  312. package/loaders/okendo-review-aggregate-loader.js +5 -49
  313. package/loaders/okendo-review-aggregate-loader.js.map +2 -2
  314. package/loaders/okendo-reviews-loader.d.ts +8 -16
  315. package/loaders/okendo-reviews-loader.js +5 -47
  316. package/loaders/okendo-reviews-loader.js.map +2 -2
  317. package/loaders/prefetch-loaders.d.ts +4 -26
  318. package/loaders/prefetch-loaders.js +5 -40
  319. package/loaders/prefetch-loaders.js.map +2 -2
  320. package/loaders/preview-placeholder.d.ts +8 -22
  321. package/loaders/preview-placeholder.js +47 -209
  322. package/loaders/preview-placeholder.js.map +2 -2
  323. package/loaders/product-loader-args.d.ts +2 -11
  324. package/loaders/product-loader-args.js +6 -12
  325. package/loaders/product-loader-args.js.map +2 -2
  326. package/loaders/product-loader.d.ts +3 -2
  327. package/loaders/product-loader.js +5 -45
  328. package/loaders/product-loader.js.map +2 -2
  329. package/loaders/rebuy-recommendations-loader.d.ts +8 -157
  330. package/loaders/rebuy-recommendations-loader.js +5 -50
  331. package/loaders/rebuy-recommendations-loader.js.map +2 -2
  332. package/loaders/reviews-io-review-aggregate-loader.d.ts +5 -4
  333. package/loaders/reviews-io-review-aggregate-loader.js +5 -36
  334. package/loaders/reviews-io-review-aggregate-loader.js.map +2 -2
  335. package/loaders/reviews-io-reviews-loader.d.ts +5 -4
  336. package/loaders/reviews-io-reviews-loader.js +5 -58
  337. package/loaders/reviews-io-reviews-loader.js.map +2 -2
  338. package/loaders/smile-earning-rules-loader.d.ts +10 -11
  339. package/loaders/smile-earning-rules-loader.js +5 -37
  340. package/loaders/smile-earning-rules-loader.js.map +2 -2
  341. package/loaders/smile-rewards-loader.d.ts +10 -11
  342. package/loaders/smile-rewards-loader.js +5 -37
  343. package/loaders/smile-rewards-loader.js.map +2 -2
  344. package/loaders/smile-vip-tiers-loader.d.ts +9 -10
  345. package/loaders/smile-vip-tiers-loader.js +5 -36
  346. package/loaders/smile-vip-tiers-loader.js.map +2 -2
  347. package/loaders/statsig-experiment-loader.d.ts +3 -8
  348. package/loaders/statsig-experiment-loader.js +5 -74
  349. package/loaders/statsig-experiment-loader.js.map +2 -2
  350. package/loaders/vendor-loader-keys.d.ts +4 -0
  351. package/loaders/vendor-loader-keys.js +9 -0
  352. package/loaders/vendor-loader-keys.js.map +7 -0
  353. package/loaders/yotpo-review-aggregate-loader.d.ts +5 -4
  354. package/loaders/yotpo-review-aggregate-loader.js +5 -43
  355. package/loaders/yotpo-review-aggregate-loader.js.map +2 -2
  356. package/loaders/yotpo-reviews-loader.d.ts +5 -4
  357. package/loaders/yotpo-reviews-loader.js +5 -58
  358. package/loaders/yotpo-reviews-loader.js.map +2 -2
  359. package/money.d.ts +9 -9
  360. package/money.js +25 -6
  361. package/money.js.map +2 -2
  362. package/next/config.d.ts +3 -1
  363. package/next/config.js +11 -85
  364. package/next/config.js.map +2 -2
  365. package/next/image-loader.d.ts +2 -1
  366. package/next/image-loader.js +7 -47
  367. package/next/image-loader.js.map +2 -2
  368. package/next/open-next.d.ts +4 -2
  369. package/next/open-next.js +6 -19
  370. package/next/open-next.js.map +2 -2
  371. package/orders/order-status-schema.d.ts +28 -13
  372. package/orders/order-status-schema.js +45 -13
  373. package/orders/order-status-schema.js.map +2 -2
  374. package/orders/order-status.d.ts +2 -8
  375. package/orders/order-status.js +6 -36
  376. package/orders/order-status.js.map +2 -2
  377. package/package.json +1 -12
  378. package/providers/query-provider.d.ts +3 -1
  379. package/providers/query-provider.js +10 -6
  380. package/providers/query-provider.js.map +2 -2
  381. package/providers/replo-provider.d.ts +3 -1
  382. package/providers/replo-provider.js +6 -37
  383. package/providers/replo-provider.js.map +2 -2
  384. package/routing/evaluate.d.ts +3 -3
  385. package/routing/evaluate.js +5 -40
  386. package/routing/evaluate.js.map +2 -2
  387. package/routing/rules.d.ts +3 -11
  388. package/routing/rules.js +7 -1
  389. package/routing/rules.js.map +2 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../editor/select-mode/fiber.ts"],
4
- "sourcesContent": ["// =============================================================================\n// React Fiber / Source Location Utilities\n// =============================================================================\n\nimport { z } from \"zod\";\n\nexport interface ReactFiber {\n _debugSource?: {\n fileName: string;\n lineNumber: number;\n columnNumber?: number;\n };\n _debugStack?: unknown;\n _debugOwner?: ReactFiber;\n type?:\n | { name?: string; displayName?: string }\n | string\n | ((...args: unknown[]) => unknown)\n | null;\n return?: ReactFiber | null;\n memoizedProps?: Record<string, unknown>;\n pendingProps?: Record<string, unknown>;\n}\n\nconst MAX_FIBER_CHAIN_DEPTH = 80;\nconst MAX_SERIALIZED_PROP_COUNT = 24;\nconst MAX_SERIALIZED_STRING_LENGTH = 500;\n\n// Frames produced by React's own JSX runtime \u2014 these come first in\n// `_debugStack.stack` because the `Error` is constructed inside `jsxDEV`. We\n// want the frame *above* them, which is the actual JSX call site.\n//\n// Turbopack rewrites `node_modules/next/dist/compiled/react-server-dom-*` and\n// friends into mangled chunk paths like\n// `_next/static/chunks/<hash>_next_dist_compiled_react-server-dom-turbopack_<hash>._.js`,\n// so we match both the human-readable module paths and the chunk-name forms.\n// Without this, `_debugStack`'s top frame inside React's RSC runtime gets\n// surfaced as the \"host\" source location for every text node on the page \u2014\n// which then symbolicates back to bundled React, not user code.\nconst REACT_INTERNAL_FRAME_PATTERNS = [\n /react.*jsx-dev-runtime/,\n /react.*jsx-runtime/,\n /react-dom\\//,\n /react\\/cjs\\/react\\./,\n /react-server-dom/,\n /react_server_dom/,\n /next[/_.]dist[/_.]compiled/,\n /\\/node_modules\\/(next|react|react-dom)\\//,\n];\n\nfunction isReactInternalFrame(fileName: string): boolean {\n return REACT_INTERNAL_FRAME_PATTERNS.some((pattern) => {\n return pattern.test(fileName);\n });\n}\n\n// React constructs the `_debugStack` Error inside its JSX runtime (`jsxDEV`,\n// `jsx`, `jsxs`), so those frames sit *above* the real JSX call site we want.\n// The file-based check above skips them when their path is recognizable, but\n// Turbopack mangles the client JSX-runtime chunk to an opaque name like\n// `node_modules__pnpm_<hash>._.js` (no \"react\"/\"jsx-dev-runtime\" substring),\n// so the top `jsxDEV` frame slips through and gets surfaced as the element's\n// source \u2014 which then symbolicates back to bundled React, not user code.\n// Matching by function name is stable across Turbopack's chunk hashing.\n// NOTE (Noah, 2026-07-27): Only bites client components; server-component\n// frames carry a recognizable `react-server-dom-*` path.\nconst REACT_INTERNAL_METHOD_PATTERNS = [\n /(?:^|\\.)jsxDEV(?:Impl)?$/,\n /(?:^|\\.)jsxs?$/,\n /(?:^|\\.)react_stack_bottom_frame$/,\n /(?:^|\\.)fakeJSXCallSite$/,\n];\n\nfunction isReactInternalMethod(methodName: string | null): boolean {\n if (!methodName) {\n return false;\n }\n return REACT_INTERNAL_METHOD_PATTERNS.some((pattern) => {\n return pattern.test(methodName);\n });\n}\n\nfunction parseDebugStackSource(\n debugStack: unknown,\n): ReactFiber[\"_debugSource\"] | null {\n let stackText: string | null = null;\n\n if (typeof debugStack === \"string\") {\n stackText = debugStack;\n } else if (\n typeof debugStack === \"object\" &&\n debugStack &&\n \"stack\" in debugStack\n ) {\n // Legacy cast - may or may not be necessary\n // eslint-disable-next-line replo/no-as-cast\n const stack = (debugStack as { stack?: unknown }).stack;\n if (typeof stack === \"string\") {\n stackText = stack;\n }\n }\n\n if (!stackText) {\n return null;\n }\n\n for (const rawLine of stackText.split(\"\\n\")) {\n const line = rawLine.trim();\n if (!line) {\n continue;\n }\n\n // Prefer the framed form `at <method> (<file>:<line>:<col>)` so we can\n // read the function name and skip React's JSX-runtime frames even when\n // Turbopack has mangled their chunk file name beyond recognition.\n const framedMatch = line.match(/^at\\s+(.+?)\\s+\\((.*):(\\d+):(\\d+)\\)$/);\n const stackFrameMatch =\n framedMatch ??\n line.match(/^at\\s+(?:.*\\()?(.*):(\\d+):(\\d+)\\)?$/) ??\n line.match(/^(.*):(\\d+):(\\d+)$/);\n\n if (!stackFrameMatch) {\n continue;\n }\n\n const methodName = framedMatch ? framedMatch[1]!.trim() : null;\n const fileOffset = framedMatch ? 2 : 1;\n const fileName = stackFrameMatch[fileOffset]?.trim();\n const lineNumber = Number.parseInt(\n stackFrameMatch[fileOffset + 1] ?? \"\",\n 10,\n );\n const columnNumber = Number.parseInt(\n stackFrameMatch[fileOffset + 2] ?? \"\",\n 10,\n );\n\n if (\n !fileName ||\n !Number.isFinite(lineNumber) ||\n !Number.isFinite(columnNumber)\n ) {\n continue;\n }\n\n if (isReactInternalFrame(fileName) || isReactInternalMethod(methodName)) {\n continue;\n }\n\n return {\n fileName,\n lineNumber,\n columnNumber,\n };\n }\n\n return null;\n}\n\nexport function getFiberFromElement(element: HTMLElement): ReactFiber | null {\n if (!element || typeof element !== \"object\") {\n return null;\n }\n\n const symbolKeys = Object.getOwnPropertySymbols(element);\n const fiberSymbolKey = symbolKeys.find((symbolKey) => {\n return symbolKey.toString().includes(\"reactFiber\");\n });\n if (fiberSymbolKey) {\n return (\n // Legacy cast - may or may not be necessary\n // eslint-disable-next-line replo/no-as-cast\n (element as unknown as Record<symbol, ReactFiber>)[fiberSymbolKey] ?? null\n );\n }\n\n const keys = Object.keys(element);\n const fiberKey = keys.find((key) => key.startsWith(\"__reactFiber$\"));\n if (fiberKey) {\n // Legacy cast - may or may not be necessary\n // eslint-disable-next-line replo/no-as-cast\n return (element as unknown as Record<string, ReactFiber>)[fiberKey] ?? null;\n }\n const instanceKey = keys.find((key) => {\n return key.startsWith(\"__reactInternalInstance$\");\n });\n if (instanceKey) {\n return (\n // Legacy cast - may or may not be necessary\n // eslint-disable-next-line replo/no-as-cast\n (element as unknown as Record<string, ReactFiber>)[instanceKey] ?? null\n );\n }\n\n const possibleFiberKey = keys.find((key) => {\n if (!key.startsWith(\"__react\")) {\n return false;\n }\n // Legacy cast - may or may not be necessary\n // eslint-disable-next-line replo/no-as-cast\n const value = (element as unknown as Record<string, unknown>)[key];\n return value && typeof value === \"object\" && \"_debugSource\" in value;\n });\n\n if (possibleFiberKey) {\n return (\n // Legacy cast - may or may not be necessary\n // eslint-disable-next-line replo/no-as-cast\n (element as unknown as Record<string, ReactFiber>)[possibleFiberKey] ??\n null\n );\n }\n\n return null;\n}\n\nexport function getComponentName(\n fiber: ReactFiber | null | undefined,\n): string | undefined {\n if (!fiber?.type) {\n return undefined;\n }\n\n if (typeof fiber.type === \"string\") {\n return undefined;\n }\n\n if (typeof fiber.type === \"function\") {\n return fiber.type.name || undefined;\n }\n\n if (typeof fiber.type === \"object\") {\n return fiber.type.displayName ?? fiber.type.name ?? undefined;\n }\n\n return undefined;\n}\n\nexport function findDebugSource(\n fiber: ReactFiber,\n maxDepth = 50,\n): { source: ReactFiber[\"_debugSource\"]; componentName?: string } | null {\n let current: ReactFiber | null | undefined = fiber;\n let depth = 0;\n\n while (current && depth < maxDepth) {\n if (current._debugSource) {\n return {\n source: current._debugSource,\n componentName: getComponentName(current),\n };\n }\n\n if (current._debugOwner?._debugSource) {\n return {\n source: current._debugOwner._debugSource,\n componentName: getComponentName(current._debugOwner),\n };\n }\n\n current = current.return;\n depth++;\n }\n\n return null;\n}\n\n// React 19 removed `fiber._debugSource`. The only per-element source pointer\n// left is `fiber._debugStack`, an `Error` constructed inside `jsxDEV` at the\n// JSX call site. We pull the topmost non-React frame out of that stack; it\n// references a compiled SSR/client chunk (e.g. `.next-dev/.../ssr/*.js`).\n// `symbolicateSelectedElement` later resolves those compiled frames to\n// original `.tsx` locations via Next.js's `/__nextjs_original-stack-frames`\n// dev-server endpoint.\nexport function findDebugSourceReact19(\n fiber: ReactFiber,\n): { source: ReactFiber[\"_debugSource\"]; componentName?: string } | null {\n let current: ReactFiber | null | undefined = fiber;\n let depth = 0;\n const maxDepth = 50;\n\n while (current && depth < maxDepth) {\n const debugStackSource =\n parseDebugStackSource(current._debugStack) ??\n parseDebugStackSource(current._debugOwner?._debugStack);\n if (debugStackSource) {\n return {\n source: debugStackSource,\n componentName: getComponentName(current),\n };\n }\n\n current = current.return;\n depth++;\n }\n\n return null;\n}\n\nexport function getSourceLocation(element: HTMLElement) {\n let currentElement: HTMLElement | null = element;\n\n while (currentElement) {\n const fiber = getFiberFromElement(currentElement);\n if (fiber) {\n const debugInfo = findDebugSource(fiber) ?? findDebugSourceReact19(fiber);\n if (debugInfo?.source) {\n return {\n filePath: debugInfo.source.fileName,\n lineNumber: debugInfo.source.lineNumber,\n columnNumber: debugInfo.source.columnNumber,\n componentName: debugInfo.componentName ?? undefined,\n };\n }\n }\n\n currentElement = currentElement.parentElement;\n }\n\n return undefined;\n}\n\nfunction getDebugSource(\n fiber: ReactFiber,\n): ReactFiber[\"_debugSource\"] | undefined {\n const debugInfo = findDebugSource(fiber) ?? findDebugSourceReact19(fiber);\n return debugInfo?.source;\n}\n\nfunction getTagName(fiber: ReactFiber): string | undefined {\n return z.string().safeParse(fiber.type).data?.toLowerCase();\n}\n\nexport function getHostSourceIdentity(element: HTMLElement) {\n const fiber = getFiberFromElement(element);\n if (!fiber) {\n return null;\n }\n const source = getDebugSource(fiber);\n if (!source) {\n return null;\n }\n return {\n filePath: source.fileName,\n lineNumber: source.lineNumber,\n columnNumber: source.columnNumber,\n tagName: element.tagName.toLowerCase(),\n };\n}\n\nfunction getSerializablePropValue(value: unknown): unknown {\n if (\n value === null ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ) {\n return value;\n }\n\n if (typeof value === \"string\") {\n return value.length > MAX_SERIALIZED_STRING_LENGTH\n ? `${value.slice(0, MAX_SERIALIZED_STRING_LENGTH)}...`\n : value;\n }\n\n if (Array.isArray(value)) {\n return value.slice(0, 20).map(getSerializablePropValue);\n }\n\n if (typeof value === \"object\") {\n return \"[object]\";\n }\n\n return undefined;\n}\n\nfunction getSerializableProps(\n props: Record<string, unknown> | undefined,\n): Record<string, unknown> | undefined {\n if (!props) {\n return undefined;\n }\n\n const serializedProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props).slice(\n 0,\n MAX_SERIALIZED_PROP_COUNT,\n )) {\n if (\n key === \"children\" ||\n key === \"ref\" ||\n key.startsWith(\"on\") ||\n typeof value === \"function\" ||\n typeof value === \"symbol\"\n ) {\n continue;\n }\n\n const serializableValue = getSerializablePropValue(value);\n if (serializableValue !== undefined) {\n serializedProps[key] = serializableValue;\n }\n }\n\n return Object.keys(serializedProps).length > 0 ? serializedProps : undefined;\n}\n\nexport function getFiberChain(element: HTMLElement) {\n const rootFiber = getFiberFromElement(element);\n const fiberChain = [];\n const seenKeys = new Set<string>();\n let currentFiber: ReactFiber | null | undefined = rootFiber;\n let depth = 0;\n\n while (currentFiber && depth < MAX_FIBER_CHAIN_DEPTH) {\n const source = getDebugSource(currentFiber);\n if (source) {\n const tagName = getTagName(currentFiber);\n const componentName = getComponentName(currentFiber);\n const key = [\n source.fileName,\n source.lineNumber,\n source.columnNumber ?? \"\",\n tagName ?? \"\",\n componentName ?? \"\",\n ].join(\":\");\n\n if (!seenKeys.has(key)) {\n seenKeys.add(key);\n fiberChain.push({\n sourceLocation: {\n filePath: source.fileName,\n lineNumber: source.lineNumber,\n columnNumber: source.columnNumber,\n componentName,\n },\n tagName,\n componentName,\n props: getSerializableProps(\n currentFiber.memoizedProps ?? currentFiber.pendingProps,\n ),\n });\n }\n }\n\n currentFiber = currentFiber.return;\n depth += 1;\n }\n\n return fiberChain;\n}\n"],
5
- "mappings": "AAIA,SAAS,SAAS;AAoBlB,MAAM,wBAAwB;AAC9B,MAAM,4BAA4B;AAClC,MAAM,+BAA+B;AAarC,MAAM,gCAAgC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,qBAAqB,UAA2B;AACvD,SAAO,8BAA8B,KAAK,CAAC,YAAY;AACrD,WAAO,QAAQ,KAAK,QAAQ;AAAA,EAC9B,CAAC;AACH;AAYA,MAAM,iCAAiC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,sBAAsB,YAAoC;AACjE,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AACA,SAAO,+BAA+B,KAAK,CAAC,YAAY;AACtD,WAAO,QAAQ,KAAK,UAAU;AAAA,EAChC,CAAC;AACH;AAEA,SAAS,sBACP,YACmC;AACnC,MAAI,YAA2B;AAE/B,MAAI,OAAO,eAAe,UAAU;AAClC,gBAAY;AAAA,EACd,WACE,OAAO,eAAe,YACtB,cACA,WAAW,YACX;AAGA,UAAM,QAAS,WAAmC;AAClD,QAAI,OAAO,UAAU,UAAU;AAC7B,kBAAY;AAAA,IACd;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,aAAW,WAAW,UAAU,MAAM,IAAI,GAAG;AAC3C,UAAM,OAAO,QAAQ,KAAK;AAC1B,QAAI,CAAC,MAAM;AACT;AAAA,IACF;AAKA,UAAM,cAAc,KAAK,MAAM,qCAAqC;AACpE,UAAM,kBAC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O,gBAAgB;AAAA,QACvB,WAAW;AAAA,QACX,iBAAiB;AAAA,MACnB,EAAE,KAAK,GAAG;AAEV,UAAI,CAAC,SAAS,IAAI,GAAG,GAAG;AACtB,iBAAS,IAAI,GAAG;AAChB,mBAAW,KAAK;AAAA,UACd,gBAAgB;AAAA,YACd,UAAU,OAAO;AAAA,YACjB,YAAY,OAAO;AAAA,YACnB,cAAc,OAAO;AAAA,YACrB;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,UACA,OAAO;AAAA,YACL,aAAa,iBAAiB,aAAa;AAAA,UAC7C;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAEA,mBAAe,aAAa;AAC5B,aAAS;AAAA,EACX;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import { canopyTombstoneError } from \"../../lib/tombstone\";\n\nexport interface ReactFiber {\n _debugSource?: {\n fileName: string;\n lineNumber: number;\n columnNumber?: number;\n };\n _debugStack?: unknown;\n _debugOwner?: ReactFiber;\n type?:\n | {\n name?: string;\n displayName?: string;\n }\n | string\n | ((...args: unknown[]) => unknown)\n | null;\n return?: ReactFiber | null;\n memoizedProps?: Record<string, unknown>;\n pendingProps?: Record<string, unknown>;\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function getFiberFromElement(_element: HTMLElement): ReactFiber | null {\n throw canopyTombstoneError({\n symbol: \"getFiberFromElement\",\n subpath: \"editor/select-mode/fiber\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function getComponentName(\n _fiber: ReactFiber | null | undefined,\n): string | undefined {\n throw canopyTombstoneError({\n symbol: \"getComponentName\",\n subpath: \"editor/select-mode/fiber\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function findDebugSource(\n _fiber: ReactFiber,\n _maxDepth = 50,\n): {\n source: ReactFiber[\"_debugSource\"];\n componentName?: string;\n} | null {\n throw canopyTombstoneError({\n symbol: \"findDebugSource\",\n subpath: \"editor/select-mode/fiber\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function findDebugSourceReact19(_fiber: ReactFiber): {\n source: ReactFiber[\"_debugSource\"];\n componentName?: string;\n} | null {\n throw canopyTombstoneError({\n symbol: \"findDebugSourceReact19\",\n subpath: \"editor/select-mode/fiber\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function getSourceLocation(_element: HTMLElement):\n | {\n filePath: string;\n lineNumber: number;\n columnNumber: number | undefined;\n componentName: string | undefined;\n }\n | undefined {\n throw canopyTombstoneError({\n symbol: \"getSourceLocation\",\n subpath: \"editor/select-mode/fiber\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function getHostSourceIdentity(_element: HTMLElement): {\n filePath: string;\n lineNumber: number;\n columnNumber: number | undefined;\n tagName: string;\n} | null {\n throw canopyTombstoneError({\n symbol: \"getHostSourceIdentity\",\n subpath: \"editor/select-mode/fiber\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function getFiberChain(_element: HTMLElement): {\n sourceLocation: {\n filePath: string;\n lineNumber: number;\n columnNumber: number | undefined;\n componentName: string | undefined;\n };\n tagName: string | undefined;\n componentName: string | undefined;\n props: Record<string, unknown> | undefined;\n}[] {\n throw canopyTombstoneError({\n symbol: \"getFiberChain\",\n subpath: \"editor/select-mode/fiber\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n"],
5
+ "mappings": "AAAA,SAAS,4BAA4B;AAwB9B,SAAS,oBAAoB,UAA0C;AAC5E,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,iBACd,QACoB;AACpB,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,gBACd,QACA,YAAY,IAIL;AACP,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,uBAAuB,QAG9B;AACP,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,kBAAkB,UAOpB;AACZ,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,sBAAsB,UAK7B;AACP,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,cAAc,UAU1B;AACF,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,12 +1,5 @@
1
1
  import type { DisplayMode } from "../../../_vendor/schemas/generated/selectMode";
2
- /**
3
- * Forces a crosshair cursor + disables text selection / drag while the iframe
4
- * is in `selection` mode. We inject a `<style>` tag into the iframe document
5
- * (rather than toggling a class on `<html>`) so that the `!important` rule
6
- * wins against any per-element cursor styling on the page being edited.
7
- *
8
- * @author Kevin O'Connell 2026-04-17
9
- */
10
- export declare function useCrosshairCursor({ displayMode, }: {
2
+ /** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
3
+ export declare function useCrosshairCursor(_args: {
11
4
  displayMode: DisplayMode;
12
5
  }): void;
@@ -1,18 +1,10 @@
1
- import { useEffect } from "react";
2
- function useCrosshairCursor({
3
- displayMode
4
- }) {
5
- useEffect(() => {
6
- if (displayMode !== "selection") {
7
- return;
8
- }
9
- const styleElement = document.createElement("style");
10
- styleElement.textContent = "* { cursor: crosshair !important; user-select: none !important; -webkit-user-drag: none !important; }";
11
- document.head.append(styleElement);
12
- return () => {
13
- styleElement.remove();
14
- };
15
- }, [displayMode]);
1
+ import { canopyTombstoneError } from "../../../lib/tombstone";
2
+ function useCrosshairCursor(_args) {
3
+ throw canopyTombstoneError({
4
+ symbol: "useCrosshairCursor",
5
+ subpath: "editor/select-mode/hooks/useCrosshairCursor",
6
+ replacement: { kind: "sandbox-runtime" }
7
+ });
16
8
  }
17
9
  export {
18
10
  useCrosshairCursor
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../editor/select-mode/hooks/useCrosshairCursor.ts"],
4
- "sourcesContent": ["import type { DisplayMode } from \"schemas/generated/selectMode\";\n\nimport { useEffect } from \"react\";\n\n/**\n * Forces a crosshair cursor + disables text selection / drag while the iframe\n * is in `selection` mode. We inject a `<style>` tag into the iframe document\n * (rather than toggling a class on `<html>`) so that the `!important` rule\n * wins against any per-element cursor styling on the page being edited.\n *\n * @author Kevin O'Connell 2026-04-17\n */\nexport function useCrosshairCursor({\n displayMode,\n}: {\n displayMode: DisplayMode;\n}) {\n // eslint-disable-next-line replo/no-use-effect -- Legacy effect - may or may not be necessary\n useEffect(() => {\n if (displayMode !== \"selection\") {\n return;\n }\n\n const styleElement = document.createElement(\"style\");\n styleElement.textContent =\n \"* { cursor: crosshair !important; user-select: none !important; -webkit-user-drag: none !important; }\";\n document.head.append(styleElement);\n\n return () => {\n styleElement.remove();\n };\n }, [displayMode]);\n}\n"],
5
- "mappings": "AAEA,SAAS,iBAAiB;AAUnB,SAAS,mBAAmB;AAAA,EACjC;AACF,GAEG;AAED,YAAU,MAAM;AACd,QAAI,gBAAgB,aAAa;AAC/B;AAAA,IACF;AAEA,UAAM,eAAe,SAAS,cAAc,OAAO;AACnD,iBAAa,cACX;AACF,aAAS,KAAK,OAAO,YAAY;AAEjC,WAAO,MAAM;AACX,mBAAa,OAAO;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAClB;",
4
+ "sourcesContent": ["/* oxlint-disable replo/no-void-return-type -- Tombstone declarations preserve exact return types for consumer compatibility. */\nimport type { DisplayMode } from \"schemas/generated/selectMode\";\n\nimport { canopyTombstoneError } from \"../../../lib/tombstone\";\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function useCrosshairCursor(_args: { displayMode: DisplayMode }): void {\n throw canopyTombstoneError({\n symbol: \"useCrosshairCursor\",\n subpath: \"editor/select-mode/hooks/useCrosshairCursor\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n"],
5
+ "mappings": "AAGA,SAAS,4BAA4B;AAG9B,SAAS,mBAAmB,OAA2C;AAC5E,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,10 @@
1
1
  import type { MutableRefObject } from "react";
2
2
  import type { DisplayMode, SelectableData, SelectModeFormatCommand } from "../../../_vendor/schemas/generated/selectMode";
3
3
  import type { SelectModeInteractionSession } from "../selectModeSession";
4
- export declare function isTextEditableElement(element: Element): element is HTMLElement;
5
- export declare function useEditModeStateMachine({ displayMode, interactionSessionRef, }: {
4
+ /** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
5
+ export declare function isTextEditableElement(_element: Element): _element is HTMLElement;
6
+ /** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
7
+ export declare function useEditModeStateMachine(_args: {
6
8
  displayMode: DisplayMode;
7
9
  interactionSessionRef: MutableRefObject<SelectModeInteractionSession>;
8
10
  }): {
@@ -10,7 +12,7 @@ export declare function useEditModeStateMachine({ displayMode, interactionSessio
10
12
  element: Element;
11
13
  descriptorPromise: Promise<SelectableData>;
12
14
  }) => void;
13
- editingElementRef: import("react").RefObject<HTMLElement | null>;
15
+ editingElementRef: React.RefObject<HTMLElement | null>;
14
16
  formatCommand: (command: SelectModeFormatCommand) => void;
15
17
  revert: () => void;
16
18
  };
@@ -1,232 +1,17 @@
1
- import { useCallback, useEffect, useRef } from "react";
2
- import {
3
- getWebsiteBuilderRpc,
4
- requestInlineTextEdit
5
- } from "../iframeRpcChannel";
6
- import { setSelectionFrameEditing } from "../selectionFrame";
7
- import { symbolicateSelectedElement } from "../symbolicate";
8
- const EMPTY_ACTIVE_MARKS = {
9
- bold: false,
10
- italic: false,
11
- underline: false,
12
- strike: false
13
- };
14
- function postEditorState({
15
- activeMarks,
16
- isEditing
17
- }) {
18
- getWebsiteBuilderRpc()?.editorStateUpdate({ activeMarks, isEditing });
19
- }
20
- function isTextEditableElement(element) {
21
- const tagName = element.tagName.toLowerCase();
22
- return element instanceof HTMLElement && Boolean(element.textContent?.trim()) && ![
23
- "input",
24
- "textarea",
25
- "select",
26
- "option",
27
- "img",
28
- "video",
29
- "canvas"
30
- ].includes(tagName);
1
+ import { canopyTombstoneError } from "../../../lib/tombstone";
2
+ function isTextEditableElement(_element) {
3
+ throw canopyTombstoneError({
4
+ symbol: "isTextEditableElement",
5
+ subpath: "editor/select-mode/hooks/useEditModeStateMachine",
6
+ replacement: { kind: "sandbox-runtime" }
7
+ });
31
8
  }
32
- const FOCUS_STEAL_GUARD_MS = 1500;
33
- function useEditModeStateMachine({
34
- displayMode,
35
- interactionSessionRef
36
- }) {
37
- const editorRef = useRef(null);
38
- const editingElementRef = useRef(null);
39
- const editIdRef = useRef(null);
40
- const pendingEditRef = useRef(null);
41
- const originalInnerHTMLRef = useRef(null);
42
- const initialHTMLRef = useRef(null);
43
- const isCommittingRef = useRef(false);
44
- const beginEditingAtRef = useRef(0);
45
- const destroyEditor = useCallback(() => {
46
- editorRef.current?.destroy();
47
- editorRef.current = null;
48
- editingElementRef.current = null;
49
- editIdRef.current = null;
50
- if (pendingEditRef.current) {
51
- clearTimeout(pendingEditRef.current.timeout);
52
- pendingEditRef.current = null;
53
- }
54
- originalInnerHTMLRef.current = null;
55
- initialHTMLRef.current = null;
56
- isCommittingRef.current = false;
57
- setSelectionFrameEditing(false);
58
- postEditorState({ activeMarks: EMPTY_ACTIVE_MARKS, isEditing: false });
59
- }, []);
60
- const commit = useCallback(() => {
61
- const editor = editorRef.current;
62
- const editingElement = editingElementRef.current;
63
- const originalInnerHTML = originalInnerHTMLRef.current;
64
- const editId = editIdRef.current;
65
- if (!editor || !editId || originalInnerHTML === null || isCommittingRef.current) {
66
- return;
67
- }
68
- isCommittingRef.current = true;
69
- const committedHTML = editor.getHTML();
70
- if (committedHTML === initialHTMLRef.current) {
71
- destroyEditor();
72
- if (editingElement) {
73
- editingElement.innerHTML = originalInnerHTML;
74
- }
75
- return;
76
- }
77
- const committedJSON = editor.getJSON();
78
- getWebsiteBuilderRpc()?.textCommitted({
79
- editId,
80
- html: committedHTML,
81
- json: committedJSON,
82
- originalInnerHTML
83
- });
84
- destroyEditor();
85
- if (editingElement) {
86
- editingElement.innerHTML = committedHTML;
87
- }
88
- }, [destroyEditor]);
89
- const revert = useCallback(() => {
90
- const editingElement = editingElementRef.current;
91
- const originalInnerHTML = originalInnerHTMLRef.current;
92
- destroyEditor();
93
- if (editingElement && originalInnerHTML !== null) {
94
- editingElement.innerHTML = originalInnerHTML;
95
- }
96
- }, [destroyEditor]);
97
- const handleBlur = useCallback(() => {
98
- if (isCommittingRef.current) {
99
- return;
100
- }
101
- if (typeof document !== "undefined" && document.hasFocus()) {
102
- commit();
103
- return;
104
- }
105
- if (Date.now() - beginEditingAtRef.current < FOCUS_STEAL_GUARD_MS) {
106
- editorRef.current?.focus();
107
- }
108
- }, [commit]);
109
- const formatCommand = useCallback((command) => {
110
- editorRef.current?.runFormatCommand(command);
111
- }, []);
112
- const clearPendingEdit = useCallback((editId) => {
113
- if (pendingEditRef.current?.editId !== editId) {
114
- return;
115
- }
116
- clearTimeout(pendingEditRef.current.timeout);
117
- pendingEditRef.current = null;
118
- }, []);
119
- const resolveEditRequest = useCallback(
120
- ({ editId, allowed }) => {
121
- const pendingEdit = pendingEditRef.current;
122
- if (!pendingEdit || pendingEdit.editId !== editId) {
123
- return;
124
- }
125
- clearTimeout(pendingEdit.timeout);
126
- pendingEditRef.current = null;
127
- if (!allowed || !pendingEdit.element.isConnected) {
128
- return;
129
- }
130
- const element = pendingEdit.element;
131
- const originalInnerHTML = element.innerHTML;
132
- editingElementRef.current = element;
133
- editIdRef.current = editId;
134
- originalInnerHTMLRef.current = originalInnerHTML;
135
- void import("../tiptapInlineEditor").then(({ createInlineTiptapEditor }) => {
136
- if (editingElementRef.current !== element || editIdRef.current !== editId) {
137
- return;
138
- }
139
- editorRef.current = createInlineTiptapEditor({
140
- element,
141
- content: originalInnerHTML,
142
- onCommit: commit,
143
- onEscape: revert,
144
- onBlur: handleBlur,
145
- onSelectionUpdate: (activeMarks) => {
146
- postEditorState({ activeMarks, isEditing: true });
147
- }
148
- });
149
- initialHTMLRef.current = editorRef.current.getHTML();
150
- beginEditingAtRef.current = Date.now();
151
- editorRef.current.focusAndSelectAll();
152
- setSelectionFrameEditing(true);
153
- postEditorState({ activeMarks: EMPTY_ACTIVE_MARKS, isEditing: true });
154
- }).catch(() => {
155
- if (editingElementRef.current === element && editIdRef.current === editId) {
156
- revert();
157
- }
158
- });
159
- },
160
- [commit, handleBlur, revert]
161
- );
162
- const beginEditing = useCallback(
163
- ({
164
- element,
165
- descriptorPromise
166
- }) => {
167
- if (editingElementRef.current === element) {
168
- return;
169
- }
170
- if (!isTextEditableElement(element)) {
171
- return;
172
- }
173
- if (pendingEditRef.current?.element === element) {
174
- return;
175
- }
176
- void descriptorPromise.then((descriptor) => {
177
- if (descriptor.kind !== "react-element" || !element.isConnected) {
178
- return;
179
- }
180
- interactionSessionRef.current = {
181
- type: "element",
182
- element,
183
- clickPosition: null,
184
- data: descriptor
185
- };
186
- const editId = crypto.randomUUID();
187
- if (pendingEditRef.current) {
188
- clearTimeout(pendingEditRef.current.timeout);
189
- }
190
- const timeout = window.setTimeout(() => {
191
- clearPendingEdit(editId);
192
- }, 5e3);
193
- pendingEditRef.current = { editId, element, timeout };
194
- void symbolicateSelectedElement(descriptor).then(
195
- (symbolicated) => {
196
- if (pendingEditRef.current?.editId !== editId) {
197
- return;
198
- }
199
- void requestInlineTextEdit({
200
- editId,
201
- element: symbolicated
202
- }).then(
203
- ({ allowed }) => {
204
- resolveEditRequest({ editId, allowed });
205
- },
206
- () => {
207
- resolveEditRequest({ editId, allowed: false });
208
- }
209
- );
210
- },
211
- () => {
212
- clearPendingEdit(editId);
213
- }
214
- );
215
- });
216
- },
217
- [clearPendingEdit, interactionSessionRef, resolveEditRequest]
218
- );
219
- useEffect(() => {
220
- if (displayMode !== "selection") {
221
- revert();
222
- }
223
- }, [displayMode, revert]);
224
- return {
225
- beginEditing,
226
- editingElementRef,
227
- formatCommand,
228
- revert
229
- };
9
+ function useEditModeStateMachine(_args) {
10
+ throw canopyTombstoneError({
11
+ symbol: "useEditModeStateMachine",
12
+ subpath: "editor/select-mode/hooks/useEditModeStateMachine",
13
+ replacement: { kind: "sandbox-runtime" }
14
+ });
230
15
  }
231
16
  export {
232
17
  isTextEditableElement,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../editor/select-mode/hooks/useEditModeStateMachine.ts"],
4
- "sourcesContent": ["import type { MutableRefObject } from \"react\";\nimport type {\n DisplayMode,\n SelectableData,\n SelectModeFormatCommand,\n} from \"schemas/generated/selectMode\";\nimport type { SelectModeInteractionSession } from \"../selectModeSession\";\nimport type { InlineTiptapEditor } from \"../tiptapInlineEditor\";\n\nimport { useCallback, useEffect, useRef } from \"react\";\n\nimport {\n getWebsiteBuilderRpc,\n requestInlineTextEdit,\n} from \"../iframeRpcChannel\";\nimport { setSelectionFrameEditing } from \"../selectionFrame\";\nimport { symbolicateSelectedElement } from \"../symbolicate\";\n\ntype ActiveMarks = {\n bold: boolean;\n italic: boolean;\n underline: boolean;\n strike: boolean;\n};\n\nconst EMPTY_ACTIVE_MARKS: ActiveMarks = {\n bold: false,\n italic: false,\n underline: false,\n strike: false,\n};\n\n// Notify the parent of the inline editor's state so it can show the inline\n// formatting controls (and live mark state) only while editing.\nfunction postEditorState({\n activeMarks,\n isEditing,\n}: {\n activeMarks: ActiveMarks;\n isEditing: boolean;\n}) {\n getWebsiteBuilderRpc()?.editorStateUpdate({ activeMarks, isEditing });\n}\n\nexport function isTextEditableElement(\n element: Element,\n): element is HTMLElement {\n const tagName = element.tagName.toLowerCase();\n return (\n element instanceof HTMLElement &&\n Boolean(element.textContent?.trim()) &&\n ![\n \"input\",\n \"textarea\",\n \"select\",\n \"option\",\n \"img\",\n \"video\",\n \"canvas\",\n ].includes(tagName)\n );\n}\n\n// Window after entering an edit during which a focus loss to the parent frame\n// is treated as the select-mode panel's composer auto-focus stealing focus\n// (and is reclaimed) rather than a deliberate move into the editor UI.\nconst FOCUS_STEAL_GUARD_MS = 1500;\n\nexport function useEditModeStateMachine({\n displayMode,\n interactionSessionRef,\n}: {\n displayMode: DisplayMode;\n interactionSessionRef: MutableRefObject<SelectModeInteractionSession>;\n}) {\n const editorRef = useRef<InlineTiptapEditor | null>(null);\n const editingElementRef = useRef<HTMLElement | null>(null);\n const editIdRef = useRef<string | null>(null);\n const pendingEditRef = useRef<{\n editId: string;\n element: HTMLElement;\n timeout: number;\n } | null>(null);\n const originalInnerHTMLRef = useRef<string | null>(null);\n // The editor's HTML right after it parsed the original content. tiptap\n // re-serializes the markup, so this \u2014 not the raw `originalInnerHTML` \u2014 is the\n // apples-to-apples baseline for detecting whether a commit actually changed\n // anything.\n const initialHTMLRef = useRef<string | null>(null);\n const isCommittingRef = useRef(false);\n const beginEditingAtRef = useRef(0);\n\n const destroyEditor = useCallback(() => {\n editorRef.current?.destroy();\n editorRef.current = null;\n editingElementRef.current = null;\n editIdRef.current = null;\n if (pendingEditRef.current) {\n clearTimeout(pendingEditRef.current.timeout);\n pendingEditRef.current = null;\n }\n originalInnerHTMLRef.current = null;\n initialHTMLRef.current = null;\n isCommittingRef.current = false;\n setSelectionFrameEditing(false);\n postEditorState({ activeMarks: EMPTY_ACTIVE_MARKS, isEditing: false });\n }, []);\n\n const commit = useCallback(() => {\n const editor = editorRef.current;\n const editingElement = editingElementRef.current;\n const originalInnerHTML = originalInnerHTMLRef.current;\n const editId = editIdRef.current;\n if (\n !editor ||\n !editId ||\n originalInnerHTML === null ||\n isCommittingRef.current\n ) {\n return;\n }\n\n isCommittingRef.current = true;\n const committedHTML = editor.getHTML();\n\n // A blur or Shift-Enter with no actual change must not spawn an edit\n // session. When the content is untouched, restore the original markup and\n // tear down without notifying the parent.\n if (committedHTML === initialHTMLRef.current) {\n destroyEditor();\n if (editingElement) {\n editingElement.innerHTML = originalInnerHTML;\n }\n return;\n }\n\n const committedJSON = editor.getJSON();\n getWebsiteBuilderRpc()?.textCommitted({\n editId,\n html: committedHTML,\n json: committedJSON,\n originalInnerHTML,\n });\n // NOTE (Noah Gilmore, 2026-07-16): A directly mounted ProseMirror view\n // clears its root during destroy, so final HTML must be restored afterward.\n destroyEditor();\n if (editingElement) {\n editingElement.innerHTML = committedHTML;\n }\n }, [destroyEditor]);\n\n const revert = useCallback(() => {\n const editingElement = editingElementRef.current;\n const originalInnerHTML = originalInnerHTMLRef.current;\n destroyEditor();\n if (editingElement && originalInnerHTML !== null) {\n editingElement.innerHTML = originalInnerHTML;\n }\n }, [destroyEditor]);\n\n const handleBlur = useCallback(() => {\n if (isCommittingRef.current) {\n return;\n }\n // Focus stayed inside the iframe \u2014 the user clicked elsewhere on the page,\n // so this is a real \"click away\": commit.\n if (typeof document !== \"undefined\" && document.hasFocus()) {\n commit();\n return;\n }\n // Focus left the iframe to the parent editor. When it happens right as the\n // edit opens, the select-mode panel's composer auto-focus stole it \u2014 pull\n // it back so a double-click keeps the caret in the text. A deliberate move\n // into the editor UI later is left alone, and never commits/destroys.\n if (Date.now() - beginEditingAtRef.current < FOCUS_STEAL_GUARD_MS) {\n editorRef.current?.focus();\n }\n }, [commit]);\n\n const formatCommand = useCallback((command: SelectModeFormatCommand) => {\n editorRef.current?.runFormatCommand(command);\n }, []);\n\n const clearPendingEdit = useCallback((editId: string) => {\n if (pendingEditRef.current?.editId !== editId) {\n return;\n }\n clearTimeout(pendingEditRef.current.timeout);\n pendingEditRef.current = null;\n }, []);\n\n const resolveEditRequest = useCallback(\n ({ editId, allowed }: { editId: string; allowed: boolean }) => {\n const pendingEdit = pendingEditRef.current;\n if (!pendingEdit || pendingEdit.editId !== editId) {\n return;\n }\n clearTimeout(pendingEdit.timeout);\n pendingEditRef.current = null;\n if (!allowed || !pendingEdit.element.isConnected) {\n return;\n }\n\n const element = pendingEdit.element;\n const originalInnerHTML = element.innerHTML;\n editingElementRef.current = element;\n editIdRef.current = editId;\n originalInnerHTMLRef.current = originalInnerHTML;\n\n void import(\"../tiptapInlineEditor\")\n .then(({ createInlineTiptapEditor }) => {\n if (\n editingElementRef.current !== element ||\n editIdRef.current !== editId\n ) {\n return;\n }\n editorRef.current = createInlineTiptapEditor({\n element,\n content: originalInnerHTML,\n onCommit: commit,\n onEscape: revert,\n onBlur: handleBlur,\n onSelectionUpdate: (activeMarks) => {\n postEditorState({ activeMarks, isEditing: true });\n },\n });\n initialHTMLRef.current = editorRef.current.getHTML();\n beginEditingAtRef.current = Date.now();\n editorRef.current.focusAndSelectAll();\n setSelectionFrameEditing(true);\n postEditorState({ activeMarks: EMPTY_ACTIVE_MARKS, isEditing: true });\n })\n .catch(() => {\n if (\n editingElementRef.current === element &&\n editIdRef.current === editId\n ) {\n revert();\n }\n });\n },\n [commit, handleBlur, revert],\n );\n\n const beginEditing = useCallback(\n ({\n element,\n descriptorPromise,\n }: {\n element: Element;\n descriptorPromise: Promise<SelectableData>;\n }) => {\n // Already editing this element \u2014 re-entering would re-read the mid-edit\n // DOM as the \"original\" and rebuild the editor over itself, wiping the\n // content. The pointer-up guard prevents the usual trigger; this is the\n // backstop for any other path.\n if (editingElementRef.current === element) {\n return;\n }\n if (!isTextEditableElement(element)) {\n return;\n }\n // Same element already awaiting symbolicate / parent allow \u2014 ignore.\n // A different element supersedes the in-flight attempt below.\n if (pendingEditRef.current?.element === element) {\n return;\n }\n\n void descriptorPromise.then((descriptor) => {\n if (descriptor.kind !== \"react-element\" || !element.isConnected) {\n return;\n }\n interactionSessionRef.current = {\n type: \"element\",\n element,\n clickPosition: null,\n data: descriptor,\n };\n const editId = crypto.randomUUID();\n if (pendingEditRef.current) {\n clearTimeout(pendingEditRef.current.timeout);\n }\n // Symbolicate has no AbortSignal; a wedged sandbox can hang forever.\n // Self-clear so a hung attempt can't permanently block inline edit.\n const timeout = window.setTimeout(() => {\n clearPendingEdit(editId);\n }, 5000);\n pendingEditRef.current = { editId, element, timeout };\n void symbolicateSelectedElement(descriptor).then(\n (symbolicated) => {\n if (pendingEditRef.current?.editId !== editId) {\n return;\n }\n void requestInlineTextEdit({\n editId,\n element: symbolicated,\n }).then(\n ({ allowed }) => {\n resolveEditRequest({ editId, allowed });\n },\n () => {\n resolveEditRequest({ editId, allowed: false });\n },\n );\n },\n () => {\n clearPendingEdit(editId);\n },\n );\n });\n },\n [clearPendingEdit, interactionSessionRef, resolveEditRequest],\n );\n\n // eslint-disable-next-line replo/no-use-effect -- Tears down the inline editor when leaving selection mode.\n useEffect(() => {\n if (displayMode !== \"selection\") {\n revert();\n }\n }, [displayMode, revert]);\n\n return {\n beginEditing,\n editingElementRef,\n formatCommand,\n revert,\n };\n}\n"],
5
- "mappings": "AASA,SAAS,aAAa,WAAW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AAgB,aAAa;AAC/B,aAAO;AAAA,IACT;AAAA,EACF,GAAG,CAAC,aAAa,MAAM,CAAC;AAExB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import type { MutableRefObject } from \"react\";\nimport type {\n DisplayMode,\n SelectableData,\n SelectModeFormatCommand,\n} from \"schemas/generated/selectMode\";\nimport type { SelectModeInteractionSession } from \"../selectModeSession\";\n\nimport { canopyTombstoneError } from \"../../../lib/tombstone\";\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function isTextEditableElement(\n _element: Element,\n): _element is HTMLElement {\n throw canopyTombstoneError({\n symbol: \"isTextEditableElement\",\n subpath: \"editor/select-mode/hooks/useEditModeStateMachine\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function useEditModeStateMachine(_args: {\n displayMode: DisplayMode;\n interactionSessionRef: MutableRefObject<SelectModeInteractionSession>;\n}): {\n beginEditing: ({\n element,\n descriptorPromise,\n }: {\n element: Element;\n descriptorPromise: Promise<SelectableData>;\n }) => void;\n editingElementRef: React.RefObject<HTMLElement | null>;\n formatCommand: (command: SelectModeFormatCommand) => void;\n revert: () => void;\n} {\n throw canopyTombstoneError({\n symbol: \"useEditModeStateMachine\",\n subpath: \"editor/select-mode/hooks/useEditModeStateMachine\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n"],
5
+ "mappings": "AAQA,SAAS,4BAA4B;AAG9B,SAAS,sBACd,UACyB;AACzB,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,wBAAwB,OActC;AACA,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
1
  import type { SelectModeOptimisticUpdatePayload } from "../../../_vendor/schemas/generated/selectMode";
2
2
  type SessionOutcome = "persisted" | "failed";
3
+ /** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
3
4
  export declare function useOptimisticOverrides(): {
4
5
  applyOptimisticUpdate: ({ editId, payload, targetSelector, targetMode, }: {
5
6
  editId: string;
@@ -8,7 +9,7 @@ export declare function useOptimisticOverrides(): {
8
9
  targetMode: "primary" | "group";
9
10
  }) => void;
10
11
  markCommitted: (editId: string, sessionId: string) => void;
11
- reapplyOverrides: ({ skipElement }: {
12
+ reapplyOverrides: ({ skipElement, }: {
12
13
  skipElement: HTMLElement | null;
13
14
  }) => void;
14
15
  resolveSessionOverrides: (sessionId: string, outcome: SessionOutcome) => void;