@replohq/canopy-sdk 2.6.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 +1 -12
- 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,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { canopyTombstoneObject } from "../../lib/tombstone";
|
|
2
|
+
const IDLE_SESSION = canopyTombstoneObject({
|
|
3
|
+
symbol: "IDLE_SESSION",
|
|
4
|
+
subpath: "editor/select-mode/selectModeSession",
|
|
5
|
+
replacement: { kind: "sandbox-runtime" }
|
|
6
|
+
});
|
|
4
7
|
export {
|
|
5
8
|
IDLE_SESSION
|
|
6
9
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../editor/select-mode/selectModeSession.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n SelectableData,\n SelectModeBoundingRect,\n SelectModeClickPosition,\n SelectModeSelectionType,\n} from \"schemas/generated/selectMode\";\nimport type {\n DragPosition,\n ScrollOffset,\n} from \"./interactions/selectionGeometry\";\n\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type {\n SelectableData,\n SelectModeBoundingRect,\n SelectModeClickPosition,\n SelectModeSelectionType,\n} from \"schemas/generated/selectMode\";\nimport type {\n DragPosition,\n ScrollOffset,\n} from \"./interactions/selectionGeometry\";\n\nimport { canopyTombstoneObject } from \"../../lib/tombstone\";\n\nexport type SelectModeInteractionSession =\n | {\n type: Extract<SelectModeSelectionType, \"none\">;\n }\n | {\n type: Extract<SelectModeSelectionType, \"drag\">;\n dragStart: DragPosition;\n dragCurrent: DragPosition;\n scrollOffset: ScrollOffset;\n hasExceededThreshold: boolean;\n }\n | {\n type: Extract<SelectModeSelectionType, \"element\">;\n element: Element;\n clickPosition: SelectModeClickPosition | null;\n data: SelectableData;\n }\n | {\n type: Extract<SelectModeSelectionType, \"area\">;\n pageRect: SelectModeBoundingRect;\n items: SelectableData[];\n };\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport const IDLE_SESSION: SelectModeInteractionSession =\n canopyTombstoneObject<SelectModeInteractionSession>({\n symbol: \"IDLE_SESSION\",\n subpath: \"editor/select-mode/selectModeSession\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n"],
|
|
5
|
+
"mappings": "AAWA,SAAS,6BAA6B;AA0B/B,MAAM,eACX,sBAAoD;AAAA,EAClD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa,EAAE,MAAM,kBAAkB;AACzC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-iframe selection frame renderer.
|
|
3
|
-
*
|
|
4
|
-
* Lives in the canopy iframe (not in agent-ui) because the previous
|
|
5
|
-
* parent-side overlay had to be re-anchored on every scroll frame via
|
|
6
|
-
* postMessage hop -> Zustand update -> React reconciliation, which
|
|
7
|
-
* shows up as visible lag when the user scrolls quickly.
|
|
8
|
-
*
|
|
9
|
-
* By rendering directly inside the canopy iframe's document we get two
|
|
10
|
-
* properties for free:
|
|
11
|
-
*
|
|
12
|
-
* 1. `position: absolute` + page coordinates means the document's own
|
|
13
|
-
* scroll naturally translates the frames — zero JavaScript per
|
|
14
|
-
* scroll frame, the browser composites them with the underlying page
|
|
15
|
-
* content.
|
|
16
|
-
* 2. No bridge serialization: the only cost when selection commits is
|
|
17
|
-
* a handful of style writes on the frame nodes.
|
|
18
|
-
*
|
|
19
|
-
* A single click resolves to one frame; an area drag resolves to one
|
|
20
|
-
* frame per captured element, so the renderer keeps a pool of nodes
|
|
21
|
-
* under a shared container and reconciles it on each call (reusing
|
|
22
|
-
* existing nodes when the count is stable, which keeps the single-frame
|
|
23
|
-
* scroll-sync hot path a couple of style writes rather than a DOM churn).
|
|
24
|
-
*
|
|
25
|
-
* The canopy iframe loads a customer page and doesn't include lattice /
|
|
26
|
-
* tailwind, so styling is intentionally vanilla inline CSS rather than
|
|
27
|
-
* Tailwind classes.
|
|
28
|
-
*
|
|
29
|
-
* @author Kevin O'Connell 2026-05-26
|
|
30
|
-
*/
|
|
31
1
|
type SelectionFrameVariant = "element" | "area";
|
|
32
2
|
type SelectionFramePageRect = {
|
|
33
3
|
x: number;
|
|
@@ -39,43 +9,22 @@ type SelectionFrameSpec = {
|
|
|
39
9
|
pageRect: SelectionFramePageRect;
|
|
40
10
|
variant: SelectionFrameVariant;
|
|
41
11
|
};
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export declare function setSelectionFrameEditing(editing: boolean): void;
|
|
47
|
-
/**
|
|
48
|
-
* Shared body-level layer container for in-iframe editor overlays (selection
|
|
49
|
-
* frames, annotation frames). Zero-size and pointer-transparent so it never
|
|
50
|
-
* affects the page; children opt into pointer events individually.
|
|
51
|
-
*/
|
|
52
|
-
export declare function getOrCreateFramesLayerContainer({ id, zIndex, }: {
|
|
12
|
+
/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
|
|
13
|
+
export declare function setSelectionFrameEditing(_editing: boolean): void;
|
|
14
|
+
/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
|
|
15
|
+
export declare function getOrCreateFramesLayerContainer(_args: {
|
|
53
16
|
id: string;
|
|
54
17
|
zIndex: number;
|
|
55
18
|
}): HTMLDivElement | null;
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
* spec. Page coords don't shift during scroll, so the caller is free to
|
|
59
|
-
* call this once at commit time and let the browser handle the rest of the
|
|
60
|
-
* scroll lifetime. Reconciles the node pool against `frames.length` so a
|
|
61
|
-
* repeated single-frame call (scroll sync) just repositions one node.
|
|
62
|
-
*
|
|
63
|
-
* @author Kevin O'Connell 2026-05-26
|
|
64
|
-
*/
|
|
65
|
-
export declare function showSelectionFrames({ frames, }: {
|
|
19
|
+
/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
|
|
20
|
+
export declare function showSelectionFrames(_args: {
|
|
66
21
|
frames: SelectionFrameSpec[];
|
|
67
22
|
}): void;
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
* @author Kevin O'Connell 2026-05-26
|
|
72
|
-
*/
|
|
73
|
-
export declare function showSelectionFrame({ pageRect, variant, }: {
|
|
23
|
+
/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
|
|
24
|
+
export declare function showSelectionFrame(_args: {
|
|
74
25
|
pageRect: SelectionFramePageRect;
|
|
75
26
|
variant: SelectionFrameVariant;
|
|
76
27
|
}): void;
|
|
77
|
-
/**
|
|
78
|
-
* @author Kevin O'Connell 2026-05-26
|
|
79
|
-
*/
|
|
28
|
+
/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
|
|
80
29
|
export declare function hideSelectionFrame(): void;
|
|
81
30
|
export {};
|
|
@@ -1,126 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
function applyVariantStyle({
|
|
9
|
-
frame,
|
|
10
|
-
variant
|
|
11
|
-
}) {
|
|
12
|
-
frame.style.border = `2px solid ${getFrameBorderHex()}`;
|
|
13
|
-
frame.style.background = variant === "area" ? "rgba(192, 38, 211, 0.08)" : "transparent";
|
|
14
|
-
}
|
|
15
|
-
function setSelectionFrameEditing(editing) {
|
|
16
|
-
if (isEditing === editing) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
isEditing = editing;
|
|
20
|
-
if (typeof document === "undefined") {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const container = document.getElementById(FRAMES_CONTAINER_ID);
|
|
24
|
-
if (!(container instanceof HTMLDivElement)) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
for (const child of container.children) {
|
|
28
|
-
if (child instanceof HTMLDivElement) {
|
|
29
|
-
child.style.borderColor = getFrameBorderHex();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function getOrCreateFramesLayerContainer({
|
|
34
|
-
id,
|
|
35
|
-
zIndex
|
|
36
|
-
}) {
|
|
37
|
-
if (typeof document === "undefined") {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
const existing = document.getElementById(id);
|
|
41
|
-
if (existing instanceof HTMLDivElement) {
|
|
42
|
-
return existing;
|
|
43
|
-
}
|
|
44
|
-
if (!document.body) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
const container = document.createElement("div");
|
|
48
|
-
container.id = id;
|
|
49
|
-
container.setAttribute("aria-hidden", "true");
|
|
50
|
-
container.style.cssText = [
|
|
51
|
-
"position: absolute",
|
|
52
|
-
"top: 0",
|
|
53
|
-
"left: 0",
|
|
54
|
-
"width: 0",
|
|
55
|
-
"height: 0",
|
|
56
|
-
"margin: 0",
|
|
57
|
-
"padding: 0",
|
|
58
|
-
"pointer-events: none",
|
|
59
|
-
`z-index: ${zIndex}`
|
|
60
|
-
].join(";");
|
|
61
|
-
document.body.append(container);
|
|
62
|
-
return container;
|
|
63
|
-
}
|
|
64
|
-
function getOrCreateContainer() {
|
|
65
|
-
return getOrCreateFramesLayerContainer({
|
|
66
|
-
id: FRAMES_CONTAINER_ID,
|
|
67
|
-
zIndex: 2147483646
|
|
1
|
+
import { canopyTombstoneError } from "../../lib/tombstone";
|
|
2
|
+
function setSelectionFrameEditing(_editing) {
|
|
3
|
+
throw canopyTombstoneError({
|
|
4
|
+
symbol: "setSelectionFrameEditing",
|
|
5
|
+
subpath: "editor/select-mode/selectionFrame",
|
|
6
|
+
replacement: { kind: "sandbox-runtime" }
|
|
68
7
|
});
|
|
69
8
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"left: 0",
|
|
77
|
-
"box-sizing: border-box",
|
|
78
|
-
"border-radius: 2px",
|
|
79
|
-
"pointer-events: none",
|
|
80
|
-
"margin: 0",
|
|
81
|
-
"padding: 0"
|
|
82
|
-
].join(";");
|
|
83
|
-
return frame;
|
|
9
|
+
function getOrCreateFramesLayerContainer(_args) {
|
|
10
|
+
throw canopyTombstoneError({
|
|
11
|
+
symbol: "getOrCreateFramesLayerContainer",
|
|
12
|
+
subpath: "editor/select-mode/selectionFrame",
|
|
13
|
+
replacement: { kind: "sandbox-runtime" }
|
|
14
|
+
});
|
|
84
15
|
}
|
|
85
|
-
function showSelectionFrames({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
while (container.childElementCount > frames.length) {
|
|
93
|
-
container.lastElementChild?.remove();
|
|
94
|
-
}
|
|
95
|
-
while (container.childElementCount < frames.length) {
|
|
96
|
-
container.append(createFrameNode());
|
|
97
|
-
}
|
|
98
|
-
frames.forEach((spec, index) => {
|
|
99
|
-
const frame = container.children[index];
|
|
100
|
-
if (!(frame instanceof HTMLDivElement)) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
applyVariantStyle({ frame, variant: spec.variant });
|
|
104
|
-
frame.style.left = `${spec.pageRect.x}px`;
|
|
105
|
-
frame.style.top = `${spec.pageRect.y}px`;
|
|
106
|
-
frame.style.width = `${spec.pageRect.width}px`;
|
|
107
|
-
frame.style.height = `${spec.pageRect.height}px`;
|
|
16
|
+
function showSelectionFrames(_args) {
|
|
17
|
+
throw canopyTombstoneError({
|
|
18
|
+
symbol: "showSelectionFrames",
|
|
19
|
+
subpath: "editor/select-mode/selectionFrame",
|
|
20
|
+
replacement: { kind: "sandbox-runtime" }
|
|
108
21
|
});
|
|
109
22
|
}
|
|
110
|
-
function showSelectionFrame({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
23
|
+
function showSelectionFrame(_args) {
|
|
24
|
+
throw canopyTombstoneError({
|
|
25
|
+
symbol: "showSelectionFrame",
|
|
26
|
+
subpath: "editor/select-mode/selectionFrame",
|
|
27
|
+
replacement: { kind: "sandbox-runtime" }
|
|
28
|
+
});
|
|
115
29
|
}
|
|
116
30
|
function hideSelectionFrame() {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
container.replaceChildren();
|
|
123
|
-
}
|
|
31
|
+
throw canopyTombstoneError({
|
|
32
|
+
symbol: "hideSelectionFrame",
|
|
33
|
+
subpath: "editor/select-mode/selectionFrame",
|
|
34
|
+
replacement: { kind: "sandbox-runtime" }
|
|
35
|
+
});
|
|
124
36
|
}
|
|
125
37
|
export {
|
|
126
38
|
getOrCreateFramesLayerContainer,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../editor/select-mode/selectionFrame.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* oxlint-disable replo/no-void-return-type -- Tombstone declarations preserve exact return types for consumer compatibility. */\nimport { canopyTombstoneError } from \"../../lib/tombstone\";\n\ntype SelectionFrameVariant = \"element\" | \"area\";\n\ntype SelectionFramePageRect = {\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\ntype SelectionFrameSpec = {\n pageRect: SelectionFramePageRect;\n variant: SelectionFrameVariant;\n};\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function setSelectionFrameEditing(_editing: boolean): void {\n throw canopyTombstoneError({\n symbol: \"setSelectionFrameEditing\",\n subpath: \"editor/select-mode/selectionFrame\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function getOrCreateFramesLayerContainer(_args: {\n id: string;\n zIndex: number;\n}): HTMLDivElement | null {\n throw canopyTombstoneError({\n symbol: \"getOrCreateFramesLayerContainer\",\n subpath: \"editor/select-mode/selectionFrame\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function showSelectionFrames(_args: {\n frames: SelectionFrameSpec[];\n}): void {\n throw canopyTombstoneError({\n symbol: \"showSelectionFrames\",\n subpath: \"editor/select-mode/selectionFrame\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function showSelectionFrame(_args: {\n pageRect: SelectionFramePageRect;\n variant: SelectionFrameVariant;\n}): void {\n throw canopyTombstoneError({\n symbol: \"showSelectionFrame\",\n subpath: \"editor/select-mode/selectionFrame\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function hideSelectionFrame(): void {\n throw canopyTombstoneError({\n symbol: \"hideSelectionFrame\",\n subpath: \"editor/select-mode/selectionFrame\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,4BAA4B;AAiB9B,SAAS,yBAAyB,UAAyB;AAChE,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,gCAAgC,OAGtB;AACxB,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,oBAAoB,OAE3B;AACP,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,mBAAmB,OAG1B;AACP,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;AAGO,SAAS,qBAA2B;AACzC,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { SelectedElement } from "../../_vendor/schemas/generated/selectMode";
|
|
2
|
-
|
|
2
|
+
/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
|
|
3
|
+
export declare function symbolicateSelectedElement(_selectedElement: SelectedElement): Promise<SelectedElement>;
|
|
@@ -1,198 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return filePath.includes(".next") || filePath.includes("/chunks/") || filePath.includes("webpack-internal:") || filePath.includes("turbopack:") || filePath.endsWith(".js") || filePath.startsWith("about:");
|
|
9
|
-
}
|
|
10
|
-
function isDependencyOrInternalPath(filePath) {
|
|
11
|
-
return filePath.includes("node_modules") || filePath.includes("/dist/compiled/") || filePath.startsWith("about:");
|
|
12
|
-
}
|
|
13
|
-
function isServerChunk(filePath) {
|
|
14
|
-
return filePath.startsWith("about://React/Server") || filePath.includes("/server/chunks/") || filePath.includes(".next-dev/dev/server/") || filePath.includes(".next/server/");
|
|
15
|
-
}
|
|
16
|
-
const NEXT_STATIC_PATH_PATTERN = /\/_next(\/static\/.+)/;
|
|
17
|
-
function getNextDistDir() {
|
|
18
|
-
try {
|
|
19
|
-
const distDir = process.env.__NEXT_DIST_DIR;
|
|
20
|
-
return typeof distDir === "string" && distDir.length > 0 ? distDir : null;
|
|
21
|
-
} catch {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function rewriteBrowserChunkUrlToDistPath(filePath) {
|
|
26
|
-
if (!/^https?:\/\//.test(filePath)) {
|
|
27
|
-
return filePath;
|
|
28
|
-
}
|
|
29
|
-
const distDir = getNextDistDir();
|
|
30
|
-
if (!distDir) {
|
|
31
|
-
return filePath;
|
|
32
|
-
}
|
|
33
|
-
let url;
|
|
34
|
-
try {
|
|
35
|
-
url = new URL(filePath);
|
|
36
|
-
} catch {
|
|
37
|
-
return filePath;
|
|
38
|
-
}
|
|
39
|
-
const staticPathMatch = NEXT_STATIC_PATH_PATTERN.exec(url.pathname);
|
|
40
|
-
if (!staticPathMatch?.[1]) {
|
|
41
|
-
return filePath;
|
|
42
|
-
}
|
|
43
|
-
const normalizedDistDir = distDir.replace(/\\/g, "/").replace(/\/$/, "");
|
|
44
|
-
return `file://${normalizedDistDir}${staticPathMatch[1]}${url.search}`;
|
|
45
|
-
}
|
|
46
|
-
function normalizeFilePathForSymbolicator(filePath) {
|
|
47
|
-
let normalized = filePath;
|
|
48
|
-
if (normalized.startsWith("about://React/Server/")) {
|
|
49
|
-
normalized = normalized.slice("about://React/Server/".length);
|
|
50
|
-
}
|
|
51
|
-
normalized = normalized.replace(/\?\d+$/, "");
|
|
52
|
-
return rewriteBrowserChunkUrlToDistPath(normalized);
|
|
53
|
-
}
|
|
54
|
-
function toNextStackFrame(location) {
|
|
55
|
-
return {
|
|
56
|
-
file: normalizeFilePathForSymbolicator(location.filePath),
|
|
57
|
-
methodName: location.componentName ?? null,
|
|
58
|
-
arguments: [],
|
|
59
|
-
line1: location.lineNumber,
|
|
60
|
-
column1: location.columnNumber ?? null
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function extractResolvedFrame(entry) {
|
|
64
|
-
if (!entry || entry.status !== "fulfilled") {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
return entry.value?.originalStackFrame ?? null;
|
|
68
|
-
}
|
|
69
|
-
async function postFrames({
|
|
70
|
-
frames,
|
|
71
|
-
isServer
|
|
72
|
-
}) {
|
|
73
|
-
if (frames.length === 0) {
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
try {
|
|
77
|
-
const response = await fetch(SYMBOLICATE_ENDPOINT, {
|
|
78
|
-
method: "POST",
|
|
79
|
-
headers: { "content-type": "application/json" },
|
|
80
|
-
body: JSON.stringify({
|
|
81
|
-
frames,
|
|
82
|
-
isServer,
|
|
83
|
-
isEdgeServer: false,
|
|
84
|
-
isAppDirectory: true
|
|
85
|
-
})
|
|
86
|
-
});
|
|
87
|
-
if (!response.ok) {
|
|
88
|
-
console.log("[selectMode] symbolicate: endpoint returned non-OK status", {
|
|
89
|
-
status: response.status,
|
|
90
|
-
isServer
|
|
91
|
-
});
|
|
92
|
-
return frames.map(() => null);
|
|
93
|
-
}
|
|
94
|
-
const parsed = await response.json();
|
|
95
|
-
if (Array.isArray(parsed)) {
|
|
96
|
-
return parsed;
|
|
97
|
-
}
|
|
98
|
-
return frames.map(() => null);
|
|
99
|
-
} catch (error) {
|
|
100
|
-
console.log("[selectMode] symbolicate: fetch failed", {
|
|
101
|
-
isServer,
|
|
102
|
-
error
|
|
103
|
-
});
|
|
104
|
-
return frames.map(() => null);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async function symbolicateFrames(frames) {
|
|
108
|
-
const serverIndices = [];
|
|
109
|
-
const clientIndices = [];
|
|
110
|
-
for (const [index, frame] of frames.entries()) {
|
|
111
|
-
if (frame.file && isServerChunk(frame.file)) {
|
|
112
|
-
serverIndices.push(index);
|
|
113
|
-
} else {
|
|
114
|
-
clientIndices.push(index);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
const [serverResults, clientResults] = await Promise.all([
|
|
118
|
-
postFrames({
|
|
119
|
-
frames: serverIndices.map((index) => frames[index]),
|
|
120
|
-
isServer: true
|
|
121
|
-
}),
|
|
122
|
-
postFrames({
|
|
123
|
-
frames: clientIndices.map((index) => frames[index]),
|
|
124
|
-
isServer: false
|
|
125
|
-
})
|
|
126
|
-
]);
|
|
127
|
-
const merged = frames.map(() => null);
|
|
128
|
-
for (const [position, index] of serverIndices.entries()) {
|
|
129
|
-
merged[index] = serverResults[position] ?? null;
|
|
130
|
-
}
|
|
131
|
-
for (const [position, index] of clientIndices.entries()) {
|
|
132
|
-
merged[index] = clientResults[position] ?? null;
|
|
133
|
-
}
|
|
134
|
-
return merged;
|
|
135
|
-
}
|
|
136
|
-
function applyResolved({
|
|
137
|
-
original,
|
|
138
|
-
frame
|
|
139
|
-
}) {
|
|
140
|
-
if (!frame || !frame.file || isNullish(frame.line1)) {
|
|
141
|
-
return original;
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
filePath: frame.file,
|
|
145
|
-
lineNumber: frame.line1,
|
|
146
|
-
columnNumber: frame.column1 ?? void 0,
|
|
147
|
-
componentName: original.componentName
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
function findUserSourceLocation(fiberChain) {
|
|
151
|
-
return fiberChain.find((entry) => {
|
|
152
|
-
return !isLikelyCompiledLocation(entry.sourceLocation) && !isDependencyOrInternalPath(entry.sourceLocation.filePath);
|
|
153
|
-
})?.sourceLocation;
|
|
154
|
-
}
|
|
155
|
-
async function symbolicateSelectedElement(selectedElement) {
|
|
156
|
-
const targets = [];
|
|
157
|
-
const fiberChain = selectedElement.fiberChain.map((entry) => ({ ...entry }));
|
|
158
|
-
for (const entry of fiberChain) {
|
|
159
|
-
if (isLikelyCompiledLocation(entry.sourceLocation)) {
|
|
160
|
-
targets.push({
|
|
161
|
-
location: entry.sourceLocation,
|
|
162
|
-
apply: (next) => {
|
|
163
|
-
entry.sourceLocation = next;
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
let sourceLocation = selectedElement.sourceLocation;
|
|
169
|
-
if (fiberChain.length === 0 && sourceLocation && isLikelyCompiledLocation(sourceLocation)) {
|
|
170
|
-
const captured = sourceLocation;
|
|
171
|
-
targets.push({
|
|
172
|
-
location: captured,
|
|
173
|
-
apply: (next) => {
|
|
174
|
-
sourceLocation = next;
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
if (targets.length === 0) {
|
|
179
|
-
return selectedElement;
|
|
180
|
-
}
|
|
181
|
-
const resolved = await symbolicateFrames(
|
|
182
|
-
targets.map((target) => toNextStackFrame(target.location))
|
|
183
|
-
);
|
|
184
|
-
for (const [index, target] of targets.entries()) {
|
|
185
|
-
const frame = extractResolvedFrame(resolved[index] ?? null);
|
|
186
|
-
target.apply(applyResolved({ original: target.location, frame }));
|
|
187
|
-
}
|
|
188
|
-
if (fiberChain.length > 0) {
|
|
189
|
-
sourceLocation = findUserSourceLocation(fiberChain) ?? fiberChain[0].sourceLocation;
|
|
190
|
-
}
|
|
191
|
-
return {
|
|
192
|
-
...selectedElement,
|
|
193
|
-
sourceLocation,
|
|
194
|
-
fiberChain
|
|
195
|
-
};
|
|
1
|
+
import { canopyTombstoneError } from "../../lib/tombstone";
|
|
2
|
+
async function symbolicateSelectedElement(_selectedElement) {
|
|
3
|
+
throw canopyTombstoneError({
|
|
4
|
+
symbol: "symbolicateSelectedElement",
|
|
5
|
+
subpath: "editor/select-mode/symbolicate",
|
|
6
|
+
replacement: { kind: "sandbox-runtime" }
|
|
7
|
+
});
|
|
196
8
|
}
|
|
197
9
|
export {
|
|
198
10
|
symbolicateSelectedElement
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../editor/select-mode/symbolicate.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n SelectedElement,\n SelectModeFiberChainEntry,\n SelectModeSourceLocation,\n} from \"schemas/generated/selectMode\";\n\nimport { isNullish } from \"replo-utils/lib/misc\";\n\n/**\n * Runtime source-attribution for React 19 + Next.js Turbopack.\n *\n * React 19 removed `fiber._debugSource`; the only per-element source pointer\n * left is `fiber._debugStack`, whose `.stack` references compiled SSR/client\n * chunks. We POST those compiled frames to Next.js's dev-only\n * `/__nextjs_original-stack-frames` endpoint, which symbolicates them through\n * Turbopack's in-memory source maps \u2014 the same mechanism the Next error\n * overlay uses (see `next/dist/server/dev/middleware-turbopack.js`).\n */\n\ntype NextStackFrame = {\n file: string | null;\n methodName: string | null;\n arguments: string[];\n // Next.js's `/__nextjs_original-stack-frames` reads these as `line1`/`column1`\n // (1-based) in the request body \u2014 same field names it uses in the response.\n // Sending `lineNumber`/`column` is silently dropped on the server side.\n line1: number | null;\n column1: number | null;\n};\n\ntype ResolvedFrame = {\n file: string | null;\n line1?: number | null;\n column1?: number | null;\n methodName?: string | null;\n ignored?: boolean;\n arguments?: string[];\n};\n\ntype OriginalStackFrameResponse = {\n originalStackFrame: ResolvedFrame | null;\n originalCodeFrame: string | null;\n};\n\ntype SettledResponseEntry =\n | { status: \"fulfilled\"; value: OriginalStackFrameResponse }\n | { status: \"rejected\"; reason: string };\n\nconst SYMBOLICATE_ENDPOINT = \"/__nextjs_original-stack-frames\";\n\nfunction isLikelyCompiledLocation(\n location: SelectModeSourceLocation | undefined,\n): boolean {\n if (!location) {\n return false;\n }\n const filePath = location.filePath;\n return (\n filePath.includes(\".next\") ||\n filePath.includes(\"/chunks/\") ||\n filePath.includes(\"webpack-internal:\") ||\n filePath.includes(\"turbopack:\") ||\n filePath.endsWith(\".js\") ||\n filePath.startsWith(\"about:\")\n );\n}\n\n// A resolved source that lives in a dependency or framework internal is never\n// the user's own code. The canonical case is Next's `<Image>`, whose rendered\n// `<img>` symbolicates to\n// `.../node_modules/next/src/client/image-component.tsx` \u2014 useless as an edit\n// target. We skip these and keep walking the ownership chain toward the user's\n// call site. See (Noah, 2026-07-09, REPL-29098).\nfunction isDependencyOrInternalPath(filePath: string): boolean {\n return (\n filePath.includes(\"node_modules\") ||\n filePath.includes(\"/dist/compiled/\") ||\n filePath.startsWith(\"about:\")\n );\n}\n\n// React 19 fibers for server-rendered (RSC) elements carry a `_debugStack`\n// whose top frame points at an SSR chunk (e.g. `about://React/Server/file://\n// .../.next-dev/.../server/chunks/ssr/*.js`). The endpoint resolves those\n// against the server bundler context; client chunks go through the client\n// bundler context. Mis-routing returns the compiled chunk unchanged.\nfunction isServerChunk(filePath: string): boolean {\n return (\n filePath.startsWith(\"about://React/Server\") ||\n filePath.includes(\"/server/chunks/\") ||\n filePath.includes(\".next-dev/dev/server/\") ||\n filePath.includes(\".next/server/\")\n );\n}\n\n// Matches the `/_next/static/...` tail of a browser chunk URL's pathname.\n// Capture group 1 is the `/static/...` segment that lives under the dist dir\n// on disk. Mirrors `regexNextStatic` in\n// `next/dist/server/lib/parse-stack.js`.\nconst NEXT_STATIC_PATH_PATTERN = /\\/_next(\\/static\\/.+)/;\n\n// Absolute path to the dev dist dir (e.g.\n// `/workspace/dev/website/.next-dev/dev`). Next.js define-injects this into\n// dev client bundles (see the `__NEXT_DIST_DIR` define in\n// `next/dist/build/define-env.ts`); because canopy-sdk is transpiled into the\n// host Next app, the replacement reaches this reference too. Outside a Next\n// dev client build the value is absent, so we bail and leave the URL as-is.\nfunction getNextDistDir(): string | null {\n try {\n const distDir = process.env.__NEXT_DIST_DIR;\n return typeof distDir === \"string\" && distDir.length > 0 ? distDir : null;\n } catch {\n return null;\n }\n}\n\n// Turbopack's `/__nextjs_original-stack-frames` backend only resolves source\n// maps for `file://` (or bare filesystem) paths \u2014 it rejects browser chunk\n// URLs (`https://host/_next/static/chunks/X.js`) with \"Unknown url scheme\",\n// which is why client-component frames never symbolicated in the sandbox\n// (everything is served over https) even though it worked for RSC frames that\n// already carry filesystem paths. Rewrite the URL to the on-disk dist path the\n// same way Next's own server-side stack parser does, so the endpoint can map\n// it back to the user's `.tsx`.\nfunction rewriteBrowserChunkUrlToDistPath(filePath: string): string {\n if (!/^https?:\\/\\//.test(filePath)) {\n return filePath;\n }\n const distDir = getNextDistDir();\n if (!distDir) {\n return filePath;\n }\n let url: URL;\n try {\n url = new URL(filePath);\n } catch {\n return filePath;\n }\n const staticPathMatch = NEXT_STATIC_PATH_PATTERN.exec(url.pathname);\n if (!staticPathMatch?.[1]) {\n return filePath;\n }\n const normalizedDistDir = distDir.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\");\n return `file://${normalizedDistDir}${staticPathMatch[1]}${url.search}`;\n}\n\n// React 19's `_debugStack.stack` for RSC components wraps the SSR chunk URL\n// in an `about://React/Server/` prefix and appends a `?<digits>` cache-buster\n// (e.g. `about://React/Server/file:///.../[root-of-the-server]__abc._.js?21`).\n// Turbopack's source-map lookup matches against the bare chunk URL; with\n// either decoration in place it returns the compiled chunk unchanged. Client\n// components instead carry a plain browser chunk URL, which Turbopack rejects\n// outright unless rewritten to its on-disk `file://` path.\nfunction normalizeFilePathForSymbolicator(filePath: string): string {\n let normalized = filePath;\n if (normalized.startsWith(\"about://React/Server/\")) {\n normalized = normalized.slice(\"about://React/Server/\".length);\n }\n normalized = normalized.replace(/\\?\\d+$/, \"\");\n return rewriteBrowserChunkUrlToDistPath(normalized);\n}\n\nfunction toNextStackFrame(location: SelectModeSourceLocation): NextStackFrame {\n return {\n file: normalizeFilePathForSymbolicator(location.filePath),\n methodName: location.componentName ?? null,\n arguments: [],\n line1: location.lineNumber,\n column1: location.columnNumber ?? null,\n };\n}\n\nfunction extractResolvedFrame(\n entry: SettledResponseEntry | null,\n): ResolvedFrame | null {\n if (!entry || entry.status !== \"fulfilled\") {\n return null;\n }\n return entry.value?.originalStackFrame ?? null;\n}\n\nasync function postFrames({\n frames,\n isServer,\n}: {\n frames: NextStackFrame[];\n isServer: boolean;\n}): Promise<(SettledResponseEntry | null)[]> {\n if (frames.length === 0) {\n return [];\n }\n try {\n const response = await fetch(SYMBOLICATE_ENDPOINT, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({\n frames,\n isServer,\n isEdgeServer: false,\n isAppDirectory: true,\n }),\n });\n if (!response.ok) {\n console.log(\"[selectMode] symbolicate: endpoint returned non-OK status\", {\n status: response.status,\n isServer,\n });\n return frames.map(() => null);\n }\n const parsed: unknown = await response.json();\n if (Array.isArray(parsed)) {\n // Promise.allSettled-shaped entries; see\n // node_modules/next/dist/server/dev/middleware-turbopack.js.\n // Legacy cast - the runtime shape isn't exported as a type.\n // eslint-disable-next-line replo/no-as-cast\n return parsed as (SettledResponseEntry | null)[];\n }\n return frames.map(() => null);\n } catch (error) {\n console.log(\"[selectMode] symbolicate: fetch failed\", {\n isServer,\n error,\n });\n return frames.map(() => null);\n }\n}\n\nasync function symbolicateFrames(\n frames: NextStackFrame[],\n): Promise<(SettledResponseEntry | null)[]> {\n const serverIndices: number[] = [];\n const clientIndices: number[] = [];\n for (const [index, frame] of frames.entries()) {\n if (frame.file && isServerChunk(frame.file)) {\n serverIndices.push(index);\n } else {\n clientIndices.push(index);\n }\n }\n\n const [serverResults, clientResults] = await Promise.all([\n postFrames({\n frames: serverIndices.map((index) => frames[index]!),\n isServer: true,\n }),\n postFrames({\n frames: clientIndices.map((index) => frames[index]!),\n isServer: false,\n }),\n ]);\n\n const merged: (SettledResponseEntry | null)[] = frames.map(() => null);\n for (const [position, index] of serverIndices.entries()) {\n merged[index] = serverResults[position] ?? null;\n }\n for (const [position, index] of clientIndices.entries()) {\n merged[index] = clientResults[position] ?? null;\n }\n return merged;\n}\n\nfunction applyResolved({\n original,\n frame,\n}: {\n original: SelectModeSourceLocation;\n frame: ResolvedFrame | null;\n}): SelectModeSourceLocation {\n if (!frame || !frame.file || isNullish(frame.line1)) {\n return original;\n }\n return {\n filePath: frame.file,\n lineNumber: frame.line1,\n columnNumber: frame.column1 ?? undefined,\n componentName: original.componentName,\n };\n}\n\n// The innermost chain entry that is a usable edit target: already-symbolicated\n// (still-compiled frames failed to resolve and are useless) and outside\n// dependency/framework code. See (Noah, 2026-07-09, REPL-29098).\nfunction findUserSourceLocation(\n fiberChain: SelectModeFiberChainEntry[],\n): SelectModeSourceLocation | undefined {\n return fiberChain.find((entry) => {\n return (\n !isLikelyCompiledLocation(entry.sourceLocation) &&\n !isDependencyOrInternalPath(entry.sourceLocation.filePath)\n );\n })?.sourceLocation;\n}\n\nexport async function symbolicateSelectedElement(\n selectedElement: SelectedElement,\n): Promise<SelectedElement> {\n const targets: {\n location: SelectModeSourceLocation;\n apply: (next: SelectModeSourceLocation) => void;\n }[] = [];\n\n const fiberChain: SelectModeFiberChainEntry[] =\n selectedElement.fiberChain.map((entry) => ({ ...entry }));\n for (const entry of fiberChain) {\n if (isLikelyCompiledLocation(entry.sourceLocation)) {\n targets.push({\n location: entry.sourceLocation,\n apply: (next) => {\n entry.sourceLocation = next;\n },\n });\n }\n }\n\n let sourceLocation = selectedElement.sourceLocation;\n // With a chain present `sourceLocation` is re-derived from it below, so\n // targeting it here would just duplicate the chain head's round trip.\n if (\n fiberChain.length === 0 &&\n sourceLocation &&\n isLikelyCompiledLocation(sourceLocation)\n ) {\n const captured = sourceLocation;\n targets.push({\n location: captured,\n apply: (next) => {\n sourceLocation = next;\n },\n });\n }\n\n if (targets.length === 0) {\n return selectedElement;\n }\n\n const resolved = await symbolicateFrames(\n targets.map((target) => toNextStackFrame(target.location)),\n );\n\n for (const [index, target] of targets.entries()) {\n const frame = extractResolvedFrame(resolved[index] ?? null);\n target.apply(applyResolved({ original: target.location, frame }));\n }\n\n if (fiberChain.length > 0) {\n // Fall back to the chain head so we never regress to attributing nothing.\n sourceLocation =\n findUserSourceLocation(fiberChain) ?? fiberChain[0]!.sourceLocation;\n }\n\n return {\n ...selectedElement,\n sourceLocation,\n fiberChain,\n };\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { SelectedElement } from \"schemas/generated/selectMode\";\n\nimport { canopyTombstoneError } from \"../../lib/tombstone\";\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport async function symbolicateSelectedElement(\n _selectedElement: SelectedElement,\n): Promise<SelectedElement> {\n throw canopyTombstoneError({\n symbol: \"symbolicateSelectedElement\",\n subpath: \"editor/select-mode/symbolicate\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,4BAA4B;AAGrC,eAAsB,2BACpB,kBAC0B;AAC1B,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,16 @@
|
|
|
1
|
-
import type { JSONContent } from "@tiptap/core";
|
|
2
1
|
import type { SelectModeFormatCommand } from "../../_vendor/schemas/generated/selectMode";
|
|
2
|
+
type JSONContent = {
|
|
3
|
+
type?: string;
|
|
4
|
+
attrs?: Record<string, any>;
|
|
5
|
+
content?: JSONContent[];
|
|
6
|
+
marks?: {
|
|
7
|
+
type: string;
|
|
8
|
+
attrs?: Record<string, any>;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}[];
|
|
11
|
+
text?: string;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
3
14
|
export type InlineTiptapEditor = {
|
|
4
15
|
focus: () => void;
|
|
5
16
|
focusAndSelectAll: () => void;
|
|
@@ -8,7 +19,8 @@ export type InlineTiptapEditor = {
|
|
|
8
19
|
getJSON: () => JSONContent;
|
|
9
20
|
runFormatCommand: (command: SelectModeFormatCommand) => void;
|
|
10
21
|
};
|
|
11
|
-
|
|
22
|
+
/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */
|
|
23
|
+
export declare function createInlineTiptapEditor(_args: {
|
|
12
24
|
element: HTMLElement;
|
|
13
25
|
content: string;
|
|
14
26
|
onCommit: () => void;
|
|
@@ -21,3 +33,4 @@ export declare function createInlineTiptapEditor({ element, content, onCommit, o
|
|
|
21
33
|
strike: boolean;
|
|
22
34
|
}) => void;
|
|
23
35
|
}): InlineTiptapEditor;
|
|
36
|
+
export {};
|