@replohq/canopy-sdk 2.5.0 → 3.0.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.
- package/_vendor/replo-utils/lib/fonts.mjs +1 -0
- package/_vendor/replo-utils/lib/geometry.mjs +2 -0
- package/_vendor/replo-utils/lib/json.mjs +1 -0
- package/_vendor/replo-utils/lib/misc.mjs +1 -0
- package/_vendor/replo-utils/lib/posthogReplay.mjs +2 -0
- package/_vendor/replo-utils/lib/url.mjs +1 -0
- package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +1 -1
- package/_vendor/schemas/designLibrary.mjs +1 -1
- package/_vendor/schemas/iframeRpcChannel.mjs +2 -1
- package/_vendor/schemas/loaderKeys.d.ts +1 -1
- package/_vendor/schemas/loaderKeys.mjs +103 -23
- package/_vendor/schemas/money.mjs +1860 -3
- package/_vendor/schemas/pageAnnotations.mjs +1 -1
- package/_vendor/schemas/routing/match.mjs +1 -0
- package/_vendor/schemas/routing/rules.mjs +2 -1
- package/_vendor/schemas/selectMode.d.ts +4 -4
- package/_vendor/schemas/selectMode.mjs +1 -0
- package/_vendor/schemas/selectModeIframeRpc.d.ts +4 -4
- package/_vendor/schemas/selectModeIframeRpc.mjs +1 -0
- package/analytics/analytics-provider.d.ts +5 -10
- package/analytics/analytics-provider.js +14 -101
- package/analytics/analytics-provider.js.map +2 -2
- package/analytics/get-analytics-sinks.d.ts +2 -19
- package/analytics/get-analytics-sinks.js +9 -46
- package/analytics/get-analytics-sinks.js.map +2 -2
- package/analytics/hooks/use-product-viewed-analytics.d.ts +2 -6
- package/analytics/hooks/use-product-viewed-analytics.js +6 -28
- package/analytics/hooks/use-product-viewed-analytics.js.map +2 -2
- package/analytics/replo-first-party-pixel.d.ts +3 -12
- package/analytics/replo-first-party-pixel.js +8 -24
- package/analytics/replo-first-party-pixel.js.map +2 -2
- package/analytics/replo-pixel-script.d.ts +4 -10
- package/analytics/replo-pixel-script.js +9 -23
- package/analytics/replo-pixel-script.js.map +2 -2
- package/analytics/sinks/ga4-sink.d.ts +10 -9
- package/analytics/sinks/ga4-sink.js +99 -50
- package/analytics/sinks/ga4-sink.js.map +2 -2
- package/analytics/sinks/meta-sink.d.ts +5 -4
- package/analytics/sinks/meta-sink.js +82 -29
- package/analytics/sinks/meta-sink.js.map +2 -2
- package/analytics/sinks/pinterest-sink.d.ts +7 -6
- package/analytics/sinks/pinterest-sink.js +82 -49
- package/analytics/sinks/pinterest-sink.js.map +2 -2
- package/analytics/sinks/reddit-sink.d.ts +8 -7
- package/analytics/sinks/reddit-sink.js +82 -53
- package/analytics/sinks/reddit-sink.js.map +2 -2
- package/analytics/sinks/replo-sink.d.ts +9 -8
- package/analytics/sinks/replo-sink.js +89 -37
- package/analytics/sinks/replo-sink.js.map +2 -2
- package/analytics/sinks/snapchat-sink.d.ts +6 -5
- package/analytics/sinks/snapchat-sink.js +82 -40
- package/analytics/sinks/snapchat-sink.js.map +2 -2
- package/analytics/sinks/tiktok-sink.d.ts +8 -7
- package/analytics/sinks/tiktok-sink.js +82 -52
- package/analytics/sinks/tiktok-sink.js.map +2 -2
- package/analytics/sinks/window-sink.d.ts +11 -14
- package/analytics/sinks/window-sink.js +101 -28
- package/analytics/sinks/window-sink.js.map +2 -2
- package/analytics/utils/analytics-utils.d.ts +4 -2
- package/analytics/utils/analytics-utils.js +19 -123
- package/analytics/utils/analytics-utils.js.map +2 -2
- package/analytics/utils/navigation-tracker.d.ts +2 -1
- package/analytics/utils/navigation-tracker.js +37 -30
- package/analytics/utils/navigation-tracker.js.map +2 -2
- package/analytics/utils/shopify-funnel-gate.d.ts +2 -7
- package/analytics/utils/shopify-funnel-gate.js +8 -15
- package/analytics/utils/shopify-funnel-gate.js.map +2 -2
- package/cart/buy-now-action.d.ts +2 -9
- package/cart/buy-now-action.js +5 -97
- package/cart/buy-now-action.js.map +2 -2
- package/cart/cart-actions.d.ts +12 -56
- package/cart/cart-actions.js +88 -68
- package/cart/cart-actions.js.map +2 -2
- package/cart/cart-loader.d.ts +3 -9
- package/cart/cart-loader.js +14 -6
- package/cart/cart-loader.js.map +2 -2
- package/cart/cart-provider.d.ts +6 -58
- package/cart/cart-provider.js +13 -359
- package/cart/cart-provider.js.map +3 -3
- package/cart/cart-schema.d.ts +2 -1
- package/cart/cart-schema.js +12 -64
- package/cart/cart-schema.js.map +2 -2
- package/cart/cart-types.d.ts +1 -1
- package/cart/cart-types.js +5 -4
- package/cart/cart-types.js.map +2 -2
- package/cart/gateways/cart-constants.d.ts +1 -0
- package/cart/gateways/cart-constants.js.map +2 -2
- package/cart/gateways/cart-gateway.d.ts +1 -0
- package/cart/gateways/cart-gateway.js +13 -12
- package/cart/gateways/cart-gateway.js.map +2 -2
- package/cart/gateways/cookie-cart-gateway.d.ts +8 -11
- package/cart/gateways/cookie-cart-gateway.js +93 -97
- package/cart/gateways/cookie-cart-gateway.js.map +2 -2
- package/cart/gateways/default-cart-gateway.d.ts +10 -16
- package/cart/gateways/default-cart-gateway.js +13 -23
- package/cart/gateways/default-cart-gateway.js.map +2 -2
- package/cart/gateways/resolver-cart-gateway.d.ts +1 -0
- package/cart/gateways/resolver-cart-gateway.js +13 -102
- package/cart/gateways/resolver-cart-gateway.js.map +2 -2
- package/cart/gateways/stripe-cart-gateway.d.ts +10 -16
- package/cart/gateways/stripe-cart-gateway.js +13 -21
- package/cart/gateways/stripe-cart-gateway.js.map +2 -2
- package/cart/hooks/use-add-to-cart.d.ts +3 -47
- package/cart/hooks/use-add-to-cart.js +10 -115
- package/cart/hooks/use-add-to-cart.js.map +2 -2
- package/cart/hooks/use-buy-now.d.ts +1 -39
- package/cart/hooks/use-buy-now.js +5 -55
- package/cart/hooks/use-buy-now.js.map +2 -2
- package/cart/utils/cart-utils.d.ts +8 -35
- package/cart/utils/cart-utils.js +21 -35
- package/cart/utils/cart-utils.js.map +2 -2
- package/cart/utils/cookie-cart-persistence.d.ts +16 -41
- package/cart/utils/cookie-cart-persistence.js +38 -143
- package/cart/utils/cookie-cart-persistence.js.map +2 -2
- package/cart/utils/variant-to-cart-line.d.ts +12 -42
- package/cart/utils/variant-to-cart-line.js +31 -147
- package/cart/utils/variant-to-cart-line.js.map +2 -2
- package/chunk-UJCSKKID.mjs +27 -0
- package/{chunk-OFU2QEDR.mjs → chunk-ZZPQ3E7S.mjs} +50 -5
- package/consent/consent-action.d.ts +2 -1
- package/consent/consent-action.js +10 -20
- package/consent/consent-action.js.map +2 -2
- package/consent/consent-actions.d.ts +2 -13
- package/consent/consent-actions.js +9 -29
- package/consent/consent-actions.js.map +2 -2
- package/consent/consent-store.d.ts +9 -36
- package/consent/consent-store.js +12 -182
- package/consent/consent-store.js.map +2 -2
- package/consent/cookie.d.ts +9 -12
- package/consent/cookie.js +32 -64
- package/consent/cookie.js.map +2 -2
- package/consent/replo-scripts.d.ts +5 -18
- package/consent/replo-scripts.js +11 -94
- package/consent/replo-scripts.js.map +2 -2
- package/consent/script-registration-store.d.ts +6 -2
- package/consent/script-registration-store.js +33 -47
- package/consent/script-registration-store.js.map +2 -2
- package/consent/script-snippets.d.ts +4 -18
- package/consent/script-snippets.js +19 -127
- package/consent/script-snippets.js.map +2 -2
- package/consent/window-api.d.ts +4 -15
- package/consent/window-api.js +8 -63
- package/consent/window-api.js.map +2 -2
- package/editor/ClientErrorBoundary.d.ts +4 -10
- package/editor/ClientErrorBoundary.js +7 -55
- package/editor/ClientErrorBoundary.js.map +2 -2
- package/editor/DocumentReadyBeacon.d.ts +3 -1
- package/editor/DocumentReadyBeacon.js +6 -3
- package/editor/DocumentReadyBeacon.js.map +2 -2
- package/editor/LinkInterceptor.d.ts +1 -0
- package/editor/LinkInterceptor.js +6 -121
- package/editor/LinkInterceptor.js.map +2 -2
- package/editor/NextErrorReporter.d.ts +1 -0
- package/editor/NextErrorReporter.js +6 -85
- package/editor/NextErrorReporter.js.map +2 -2
- package/editor/annotations/AnnotationLayerMount.d.ts +1 -0
- package/editor/annotations/AnnotationLayerMount.js +6 -6
- package/editor/annotations/AnnotationLayerMount.js.map +2 -2
- package/editor/annotations/annotationController.d.ts +1 -0
- package/editor/annotations/annotationController.js +6 -378
- package/editor/annotations/annotationController.js.map +2 -2
- package/editor/annotations/bridgeGate.d.ts +4 -7
- package/editor/annotations/bridgeGate.js +13 -15
- package/editor/annotations/bridgeGate.js.map +2 -2
- package/editor/design-library-preview/DesignLibraryPreview.d.ts +1 -0
- package/editor/design-library-preview/DesignLibraryPreview.js +6 -86
- package/editor/design-library-preview/DesignLibraryPreview.js.map +2 -2
- package/editor/posthog-relay.d.ts +1 -10
- package/editor/posthog-relay.js +6 -65
- package/editor/posthog-relay.js.map +2 -2
- package/editor/select-mode/EditorSelection.d.ts +1 -23
- package/editor/select-mode/EditorSelection.js +5 -87
- package/editor/select-mode/EditorSelection.js.map +2 -2
- package/editor/select-mode/annotationFrames.d.ts +9 -9
- package/editor/select-mode/annotationFrames.js +22 -103
- package/editor/select-mode/annotationFrames.js.map +2 -2
- package/editor/select-mode/descriptor/elementDescriptor.d.ts +6 -21
- package/editor/select-mode/descriptor/elementDescriptor.js +19 -192
- package/editor/select-mode/descriptor/elementDescriptor.js.map +3 -3
- package/editor/select-mode/descriptor/styleExtraction.d.ts +4 -2
- package/editor/select-mode/descriptor/styleExtraction.js +11 -262
- package/editor/select-mode/descriptor/styleExtraction.js.map +2 -2
- package/editor/select-mode/displayModeStore.d.ts +2 -0
- package/editor/select-mode/displayModeStore.js +14 -39
- package/editor/select-mode/displayModeStore.js.map +2 -2
- package/editor/select-mode/fast-refresh-relay.d.ts +2 -1
- package/editor/select-mode/fast-refresh-relay.js +7 -28
- package/editor/select-mode/fast-refresh-relay.js.map +2 -2
- package/editor/select-mode/fiber.d.ts +14 -7
- package/editor/select-mode/fiber.js +40 -286
- package/editor/select-mode/fiber.js.map +2 -2
- package/editor/select-mode/hooks/useCrosshairCursor.d.ts +2 -9
- package/editor/select-mode/hooks/useCrosshairCursor.js +7 -15
- package/editor/select-mode/hooks/useCrosshairCursor.js.map +2 -2
- package/editor/select-mode/hooks/useEditModeStateMachine.d.ts +5 -3
- package/editor/select-mode/hooks/useEditModeStateMachine.js +13 -228
- package/editor/select-mode/hooks/useEditModeStateMachine.js.map +2 -2
- package/editor/select-mode/hooks/useOptimisticOverrides.d.ts +2 -1
- package/editor/select-mode/hooks/useOptimisticOverrides.js +6 -277
- package/editor/select-mode/hooks/useOptimisticOverrides.js.map +2 -2
- package/editor/select-mode/hooks/useParentMessaging.d.ts +2 -20
- package/editor/select-mode/hooks/useParentMessaging.js +7 -69
- package/editor/select-mode/hooks/useParentMessaging.js.map +2 -2
- package/editor/select-mode/hooks/useSelectModeController.d.ts +2 -1
- package/editor/select-mode/hooks/useSelectModeController.js +6 -40
- package/editor/select-mode/hooks/useSelectModeController.js.map +2 -2
- package/editor/select-mode/hooks/useSelectionHover.d.ts +2 -16
- package/editor/select-mode/hooks/useSelectionHover.js +7 -105
- package/editor/select-mode/hooks/useSelectionHover.js.map +2 -2
- package/editor/select-mode/hooks/useSelectionInteractions.d.ts +2 -26
- package/editor/select-mode/hooks/useSelectionInteractions.js +7 -348
- package/editor/select-mode/hooks/useSelectionInteractions.js.map +2 -2
- package/editor/select-mode/hooks/useSelectionScrollSync.d.ts +2 -22
- package/editor/select-mode/hooks/useSelectionScrollSync.js +7 -65
- package/editor/select-mode/hooks/useSelectionScrollSync.js.map +2 -2
- package/editor/select-mode/hooks/useSiblingResolution.d.ts +4 -2
- package/editor/select-mode/hooks/useSiblingResolution.js +13 -52
- package/editor/select-mode/hooks/useSiblingResolution.js.map +2 -2
- package/editor/select-mode/iframeRpcChannel.d.ts +10 -349
- package/editor/select-mode/iframeRpcChannel.js +23 -79
- package/editor/select-mode/iframeRpcChannel.js.map +2 -2
- package/editor/select-mode/inlineTextMarks.d.ts +4 -6
- package/editor/select-mode/inlineTextMarks.js +13 -18
- package/editor/select-mode/inlineTextMarks.js.map +2 -2
- package/editor/select-mode/interactions/selectionGeometry.d.ts +19 -61
- package/editor/select-mode/interactions/selectionGeometry.js +57 -165
- package/editor/select-mode/interactions/selectionGeometry.js.map +2 -2
- package/editor/select-mode/selectModeSession.d.ts +1 -0
- package/editor/select-mode/selectModeSession.js +6 -3
- package/editor/select-mode/selectModeSession.js.map +2 -2
- package/editor/select-mode/selectionFrame.d.ts +9 -60
- package/editor/select-mode/selectionFrame.js +28 -116
- package/editor/select-mode/selectionFrame.js.map +2 -2
- package/editor/select-mode/symbolicate.d.ts +2 -1
- package/editor/select-mode/symbolicate.js +7 -195
- package/editor/select-mode/symbolicate.js.map +2 -2
- package/editor/select-mode/tiptapInlineEditor.d.ts +15 -2
- package/editor/select-mode/tiptapInlineEditor.js +6 -114
- package/editor/select-mode/tiptapInlineEditor.js.map +2 -2
- package/env.d.ts +2 -1
- package/env.js +10 -37
- package/env.js.map +2 -2
- package/gateways/canopy-api.d.ts +15 -12
- package/gateways/canopy-api.js +122 -160
- package/gateways/canopy-api.js.map +2 -2
- package/hooks/use-client-value.d.ts +2 -10
- package/hooks/use-client-value.js +10 -7
- package/hooks/use-client-value.js.map +2 -2
- package/hooks/use-formatted-price.d.ts +1 -14
- package/hooks/use-formatted-price.js +6 -14
- package/hooks/use-formatted-price.js.map +2 -2
- package/lib/canopy-error.d.ts +2 -5
- package/lib/canopy-error.js +10 -14
- package/lib/canopy-error.js.map +2 -2
- package/lib/get-query-client.d.ts +2 -1
- package/lib/get-query-client.js +8 -27
- package/lib/get-query-client.js.map +2 -2
- package/lib/integration-utils.d.ts +1 -0
- package/lib/integration-utils.js +9 -3
- package/lib/integration-utils.js.map +2 -2
- package/lib/shopify-utils.d.ts +2 -10
- package/lib/shopify-utils.js +10 -2
- package/lib/shopify-utils.js.map +2 -2
- package/lib/tombstone.d.ts +21 -0
- package/lib/tombstone.js +99 -0
- package/lib/tombstone.js.map +7 -0
- package/lib/url-utils.d.ts +2 -4
- package/lib/url-utils.js +10 -3
- package/lib/url-utils.js.map +2 -2
- package/loaders/collection-loader.d.ts +3 -2
- package/loaders/collection-loader.js +5 -48
- package/loaders/collection-loader.js.map +2 -2
- package/loaders/collection-products-loader.d.ts +3 -2
- package/loaders/collection-products-loader.js +5 -51
- package/loaders/collection-products-loader.js.map +2 -2
- package/loaders/contentful-entries-loader.d.ts +3 -2
- package/loaders/contentful-entries-loader.js +5 -71
- package/loaders/contentful-entries-loader.js.map +2 -2
- package/loaders/contentful-entry-loader.d.ts +3 -2
- package/loaders/contentful-entry-loader.js +5 -53
- package/loaders/contentful-entry-loader.js.map +2 -2
- package/loaders/invoke-loader-action.d.ts +2 -8
- package/loaders/invoke-loader-action.js +13 -8
- package/loaders/invoke-loader-action.js.map +2 -2
- package/loaders/invoke-loader-server.d.ts +2 -14
- package/loaders/invoke-loader-server.js +12 -34
- package/loaders/invoke-loader-server.js.map +2 -2
- package/loaders/invoke-loader.d.ts +6 -12
- package/loaders/invoke-loader.js +27 -29
- package/loaders/invoke-loader.js.map +2 -2
- package/loaders/levanta-product-loader.d.ts +3 -2
- package/loaders/levanta-product-loader.js +5 -46
- package/loaders/levanta-product-loader.js.map +2 -2
- package/loaders/loader-error-boundary.d.ts +9 -15
- package/loaders/loader-error-boundary.js +50 -13
- package/loaders/loader-error-boundary.js.map +2 -2
- package/loaders/loader-keys.d.ts +4 -12
- package/loaders/loader-keys.js +6 -1
- package/loaders/loader-keys.js.map +2 -2
- package/loaders/loader-schemas.d.ts +142 -61
- package/loaders/loader-schemas.js +253 -90
- package/loaders/loader-schemas.js.map +2 -2
- package/loaders/metaobject-loader.d.ts +3 -2
- package/loaders/metaobject-loader.js +5 -47
- package/loaders/metaobject-loader.js.map +2 -2
- package/loaders/metaobjects-loader.d.ts +3 -2
- package/loaders/metaobjects-loader.js +5 -53
- package/loaders/metaobjects-loader.js.map +2 -2
- package/loaders/okendo-review-aggregate-loader.d.ts +9 -10
- package/loaders/okendo-review-aggregate-loader.js +5 -49
- package/loaders/okendo-review-aggregate-loader.js.map +2 -2
- package/loaders/okendo-reviews-loader.d.ts +8 -16
- package/loaders/okendo-reviews-loader.js +5 -47
- package/loaders/okendo-reviews-loader.js.map +2 -2
- package/loaders/prefetch-loaders.d.ts +4 -26
- package/loaders/prefetch-loaders.js +5 -40
- package/loaders/prefetch-loaders.js.map +2 -2
- package/loaders/preview-placeholder.d.ts +8 -22
- package/loaders/preview-placeholder.js +47 -209
- package/loaders/preview-placeholder.js.map +2 -2
- package/loaders/product-loader-args.d.ts +2 -11
- package/loaders/product-loader-args.js +6 -12
- package/loaders/product-loader-args.js.map +2 -2
- package/loaders/product-loader.d.ts +3 -2
- package/loaders/product-loader.js +5 -45
- package/loaders/product-loader.js.map +2 -2
- package/loaders/rebuy-recommendations-loader.d.ts +8 -157
- package/loaders/rebuy-recommendations-loader.js +5 -50
- package/loaders/rebuy-recommendations-loader.js.map +2 -2
- package/loaders/reviews-io-review-aggregate-loader.d.ts +5 -4
- package/loaders/reviews-io-review-aggregate-loader.js +5 -36
- package/loaders/reviews-io-review-aggregate-loader.js.map +2 -2
- package/loaders/reviews-io-reviews-loader.d.ts +5 -4
- package/loaders/reviews-io-reviews-loader.js +5 -58
- package/loaders/reviews-io-reviews-loader.js.map +2 -2
- package/loaders/smile-earning-rules-loader.d.ts +10 -11
- package/loaders/smile-earning-rules-loader.js +5 -37
- package/loaders/smile-earning-rules-loader.js.map +2 -2
- package/loaders/smile-rewards-loader.d.ts +10 -11
- package/loaders/smile-rewards-loader.js +5 -37
- package/loaders/smile-rewards-loader.js.map +2 -2
- package/loaders/smile-vip-tiers-loader.d.ts +9 -10
- package/loaders/smile-vip-tiers-loader.js +5 -36
- package/loaders/smile-vip-tiers-loader.js.map +2 -2
- package/loaders/statsig-experiment-loader.d.ts +3 -8
- package/loaders/statsig-experiment-loader.js +5 -74
- package/loaders/statsig-experiment-loader.js.map +2 -2
- package/loaders/vendor-loader-keys.d.ts +4 -0
- package/loaders/vendor-loader-keys.js +9 -0
- package/loaders/vendor-loader-keys.js.map +7 -0
- package/loaders/yotpo-review-aggregate-loader.d.ts +5 -4
- package/loaders/yotpo-review-aggregate-loader.js +5 -43
- package/loaders/yotpo-review-aggregate-loader.js.map +2 -2
- package/loaders/yotpo-reviews-loader.d.ts +5 -4
- package/loaders/yotpo-reviews-loader.js +5 -58
- package/loaders/yotpo-reviews-loader.js.map +2 -2
- package/money.d.ts +9 -9
- package/money.js +25 -6
- package/money.js.map +2 -2
- package/next/config.d.ts +3 -1
- package/next/config.js +11 -85
- package/next/config.js.map +2 -2
- package/next/image-loader.d.ts +2 -1
- package/next/image-loader.js +7 -47
- package/next/image-loader.js.map +2 -2
- package/next/open-next.d.ts +4 -2
- package/next/open-next.js +6 -19
- package/next/open-next.js.map +2 -2
- package/orders/order-status-schema.d.ts +28 -13
- package/orders/order-status-schema.js +45 -13
- package/orders/order-status-schema.js.map +2 -2
- package/orders/order-status.d.ts +2 -8
- package/orders/order-status.js +6 -36
- package/orders/order-status.js.map +2 -2
- package/package.json +2 -13
- package/providers/query-provider.d.ts +3 -1
- package/providers/query-provider.js +10 -6
- package/providers/query-provider.js.map +2 -2
- package/providers/replo-provider.d.ts +3 -1
- package/providers/replo-provider.js +6 -37
- package/providers/replo-provider.js.map +2 -2
- package/routing/evaluate.d.ts +3 -3
- package/routing/evaluate.js +5 -40
- package/routing/evaluate.js.map +2 -2
- package/routing/rules.d.ts +3 -11
- package/routing/rules.js +7 -1
- 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": "
|
|
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
|
-
|
|
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 {
|
|
2
|
-
function useCrosshairCursor({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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": ["
|
|
5
|
-
"mappings": "
|
|
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
|
-
|
|
5
|
-
export declare function
|
|
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:
|
|
15
|
+
editingElementRef: React.RefObject<HTMLElement | null>;
|
|
14
16
|
formatCommand: (command: SelectModeFormatCommand) => void;
|
|
15
17
|
revert: () => void;
|
|
16
18
|
};
|
|
@@ -1,232 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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": "
|
|
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;
|