@osdk/react-devtools 0.5.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/CHANGELOG.md +79 -0
- package/build/esm/DevToolsContext.js +19 -0
- package/build/esm/DevToolsContext.js.map +1 -0
- package/build/esm/components/ActionMetrics.js +89 -0
- package/build/esm/components/ActionMetrics.js.map +1 -0
- package/build/esm/components/BubbleChart.js +175 -0
- package/build/esm/components/BubbleChart.js.map +1 -0
- package/build/esm/components/BubbleChart.module.scss.js +6 -0
- package/build/esm/components/CacheInspectorTab.js +291 -0
- package/build/esm/components/CacheInspectorTab.js.map +1 -0
- package/build/esm/components/CacheInspectorTab.module.scss.js +39 -0
- package/build/esm/components/CacheMetrics.js +55 -0
- package/build/esm/components/CacheMetrics.js.map +1 -0
- package/build/esm/components/ComponentCard.js +124 -0
- package/build/esm/components/ComponentCard.js.map +1 -0
- package/build/esm/components/ComponentCard.module.scss.js +31 -0
- package/build/esm/components/ComputeTab.js +175 -0
- package/build/esm/components/ComputeTab.js.map +1 -0
- package/build/esm/components/CopyableCodeBlock.js +49 -0
- package/build/esm/components/CopyableCodeBlock.js.map +1 -0
- package/build/esm/components/CopyableCodeBlock.module.scss.js +10 -0
- package/build/esm/components/DebuggingTab.js +342 -0
- package/build/esm/components/DebuggingTab.js.map +1 -0
- package/build/esm/components/DebuggingTab.module.scss.js +18 -0
- package/build/esm/components/HookRow.js +180 -0
- package/build/esm/components/HookRow.js.map +1 -0
- package/build/esm/components/HookRow.module.scss.js +16 -0
- package/build/esm/components/ImprovementsTab.js +138 -0
- package/build/esm/components/ImprovementsTab.js.map +1 -0
- package/build/esm/components/ImprovementsTab.module.scss.js +30 -0
- package/build/esm/components/InspectorSelectionHeader.js +65 -0
- package/build/esm/components/InspectorSelectionHeader.js.map +1 -0
- package/build/esm/components/InterceptTab.js +862 -0
- package/build/esm/components/InterceptTab.js.map +1 -0
- package/build/esm/components/InterceptTab.module.scss.js +49 -0
- package/build/esm/components/IssueCard.js +115 -0
- package/build/esm/components/IssueCard.js.map +1 -0
- package/build/esm/components/IssueCard.module.scss.js +24 -0
- package/build/esm/components/LogEntryCard.js +94 -0
- package/build/esm/components/LogEntryCard.js.map +1 -0
- package/build/esm/components/LogEntryCard.module.scss.js +19 -0
- package/build/esm/components/MockEditor.js +316 -0
- package/build/esm/components/MockEditor.js.map +1 -0
- package/build/esm/components/MonitorErrorBoundary.js +64 -0
- package/build/esm/components/MonitorErrorBoundary.js.map +1 -0
- package/build/esm/components/MonitorErrorBoundary.module.scss.js +9 -0
- package/build/esm/components/MonitoringPanel.js +434 -0
- package/build/esm/components/MonitoringPanel.js.map +1 -0
- package/build/esm/components/MonitoringPanel.module.scss.js +81 -0
- package/build/esm/components/ObjectLoadingMetrics.js +60 -0
- package/build/esm/components/ObjectLoadingMetrics.js.map +1 -0
- package/build/esm/components/OsdkAppErrorBoundary.js +68 -0
- package/build/esm/components/OsdkAppErrorBoundary.js.map +1 -0
- package/build/esm/components/OsdkDevTools.js +40 -0
- package/build/esm/components/OsdkDevTools.js.map +1 -0
- package/build/esm/components/OverrideEditor.js +197 -0
- package/build/esm/components/OverrideEditor.js.map +1 -0
- package/build/esm/components/PerformanceTab.js +297 -0
- package/build/esm/components/PerformanceTab.js.map +1 -0
- package/build/esm/components/PrimitiveSelectionPanel.js +220 -0
- package/build/esm/components/PrimitiveSelectionPanel.js.map +1 -0
- package/build/esm/components/PrimitiveSelectionPanel.module.scss.js +26 -0
- package/build/esm/components/issueTypes.js +2 -0
- package/build/esm/components/issueTypes.js.map +1 -0
- package/build/esm/components/resolveComponentName.js +57 -0
- package/build/esm/components/resolveComponentName.js.map +1 -0
- package/build/esm/components/testHelpers.js +312 -0
- package/build/esm/components/testHelpers.js.map +1 -0
- package/build/esm/css.d.ts +20 -0
- package/build/esm/fiber/DegradationNotice.js +193 -0
- package/build/esm/fiber/DegradationNotice.js.map +1 -0
- package/build/esm/fiber/DevtoolsHook.js +252 -0
- package/build/esm/fiber/DevtoolsHook.js.map +1 -0
- package/build/esm/fiber/FiberAccess.js +65 -0
- package/build/esm/fiber/FiberAccess.js.map +1 -0
- package/build/esm/fiber/FiberInspection.js +140 -0
- package/build/esm/fiber/FiberInspection.js.map +1 -0
- package/build/esm/fiber/FiberTags.js +52 -0
- package/build/esm/fiber/FiberTags.js.map +1 -0
- package/build/esm/fiber/HookStateInspector.js +254 -0
- package/build/esm/fiber/HookStateInspector.js.map +1 -0
- package/build/esm/fiber/SafeFiberOperation.js +35 -0
- package/build/esm/fiber/SafeFiberOperation.js.map +1 -0
- package/build/esm/fiber/capabilities.js +180 -0
- package/build/esm/fiber/capabilities.js.map +1 -0
- package/build/esm/fiber/traverseFiber.js +129 -0
- package/build/esm/fiber/traverseFiber.js.map +1 -0
- package/build/esm/fiber/types.js +2 -0
- package/build/esm/fiber/types.js.map +1 -0
- package/build/esm/fiber/validation.js +155 -0
- package/build/esm/fiber/validation.js.map +1 -0
- package/build/esm/hooks/createPollingStore.js +81 -0
- package/build/esm/hooks/createPollingStore.js.map +1 -0
- package/build/esm/hooks/useActiveComponents.js +27 -0
- package/build/esm/hooks/useActiveComponents.js.map +1 -0
- package/build/esm/hooks/useComponentRegistry.js +25 -0
- package/build/esm/hooks/useComponentRegistry.js.map +1 -0
- package/build/esm/hooks/useComputeSelectors.js +43 -0
- package/build/esm/hooks/useComputeSelectors.js.map +1 -0
- package/build/esm/hooks/useConsoleLogs.js +46 -0
- package/build/esm/hooks/useConsoleLogs.js.map +1 -0
- package/build/esm/hooks/useInspectorSelection.js +93 -0
- package/build/esm/hooks/useInspectorSelection.js.map +1 -0
- package/build/esm/hooks/useMetrics.js +23 -0
- package/build/esm/hooks/useMetrics.js.map +1 -0
- package/build/esm/hooks/usePersistedState.js +89 -0
- package/build/esm/hooks/usePersistedState.js.map +1 -0
- package/build/esm/hooks/useRecommendations.js +123 -0
- package/build/esm/hooks/useRecommendations.js.map +1 -0
- package/build/esm/hooks/useSharedTick.js +49 -0
- package/build/esm/hooks/useSharedTick.js.map +1 -0
- package/build/esm/hooks/useTimeElapsed.js +51 -0
- package/build/esm/hooks/useTimeElapsed.js.map +1 -0
- package/build/esm/hooks/useTrackerSubscription.js +97 -0
- package/build/esm/hooks/useTrackerSubscription.js.map +1 -0
- package/build/esm/hooks/useUnusedFieldAnalysis.js +99 -0
- package/build/esm/hooks/useUnusedFieldAnalysis.js.map +1 -0
- package/build/esm/index.js +31 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/inspector/ClickToInspectSystem.js +228 -0
- package/build/esm/inspector/ClickToInspectSystem.js.map +1 -0
- package/build/esm/inspector/components/ComponentLabel.js +175 -0
- package/build/esm/inspector/components/ComponentLabel.js.map +1 -0
- package/build/esm/inspector/components/ComponentLabel.module.scss.js +12 -0
- package/build/esm/inspector/components/InspectorBanner.js +79 -0
- package/build/esm/inspector/components/InspectorBanner.js.map +1 -0
- package/build/esm/inspector/components/InspectorOverlay.js +149 -0
- package/build/esm/inspector/components/InspectorOverlay.js.map +1 -0
- package/build/esm/inspector/components/SelectionHighlight.js +74 -0
- package/build/esm/inspector/components/SelectionHighlight.js.map +1 -0
- package/build/esm/inspector/createClickToInspect.js +21 -0
- package/build/esm/inspector/createClickToInspect.js.map +1 -0
- package/build/esm/inspector/hooks/useAnimatedBounds.js +167 -0
- package/build/esm/inspector/hooks/useAnimatedBounds.js.map +1 -0
- package/build/esm/inspector/index.js +40 -0
- package/build/esm/inspector/index.js.map +1 -0
- package/build/esm/inspector/inspectorController.js +328 -0
- package/build/esm/inspector/inspectorController.js.map +1 -0
- package/build/esm/inspector/types.js +2 -0
- package/build/esm/inspector/types.js.map +1 -0
- package/build/esm/inspector/utils/elementBounds.js +72 -0
- package/build/esm/inspector/utils/elementBounds.js.map +1 -0
- package/build/esm/inspector/utils/interpolation.js +26 -0
- package/build/esm/inspector/utils/interpolation.js.map +1 -0
- package/build/esm/inspector/utils/labelPositioning.js +62 -0
- package/build/esm/inspector/utils/labelPositioning.js.map +1 -0
- package/build/esm/mocking/MockCacheKeyGenerator.js +109 -0
- package/build/esm/mocking/MockCacheKeyGenerator.js.map +1 -0
- package/build/esm/mocking/MockManager.js +281 -0
- package/build/esm/mocking/MockManager.js.map +1 -0
- package/build/esm/prototyping/PrototypeOverrideStore.js +66 -0
- package/build/esm/prototyping/PrototypeOverrideStore.js.map +1 -0
- package/build/esm/prototyping/index.js +18 -0
- package/build/esm/prototyping/index.js.map +1 -0
- package/build/esm/public/vite.js +19 -0
- package/build/esm/public/vite.js.map +1 -0
- package/build/esm/register.js +41 -0
- package/build/esm/register.js.map +1 -0
- package/build/esm/scss.d.ts +20 -0
- package/build/esm/store/ComputeStore.js +269 -0
- package/build/esm/store/ComputeStore.js.map +1 -0
- package/build/esm/store/ConsoleLogStore.js +289 -0
- package/build/esm/store/ConsoleLogStore.js.map +1 -0
- package/build/esm/store/MetricsStore.js +428 -0
- package/build/esm/store/MetricsStore.js.map +1 -0
- package/build/esm/store/MonitorStore.js +288 -0
- package/build/esm/store/MonitorStore.js.map +1 -0
- package/build/esm/store/SubscribableStore.js +38 -0
- package/build/esm/store/SubscribableStore.js.map +1 -0
- package/build/esm/store/WindowErrorStore.js +195 -0
- package/build/esm/store/WindowErrorStore.js.map +1 -0
- package/build/esm/styles.css +19441 -0
- package/build/esm/styles.js +31 -0
- package/build/esm/styles.js.map +1 -0
- package/build/esm/types/compute.js +2 -0
- package/build/esm/types/compute.js.map +1 -0
- package/build/esm/types/emissions.js +2 -0
- package/build/esm/types/emissions.js.map +1 -0
- package/build/esm/types/index.js +23 -0
- package/build/esm/types/index.js.map +1 -0
- package/build/esm/utils/ActionLifecycleTracker.js +178 -0
- package/build/esm/utils/ActionLifecycleTracker.js.map +1 -0
- package/build/esm/utils/CacheEfficiencyAnalyzer.js +198 -0
- package/build/esm/utils/CacheEfficiencyAnalyzer.js.map +1 -0
- package/build/esm/utils/CircularBuffer.js +96 -0
- package/build/esm/utils/CircularBuffer.js.map +1 -0
- package/build/esm/utils/ComponentContextCapture.js +215 -0
- package/build/esm/utils/ComponentContextCapture.js.map +1 -0
- package/build/esm/utils/ComponentPrimitiveDiscovery.js +173 -0
- package/build/esm/utils/ComponentPrimitiveDiscovery.js.map +1 -0
- package/build/esm/utils/ComponentQueryRegistry.js +340 -0
- package/build/esm/utils/ComponentQueryRegistry.js.map +1 -0
- package/build/esm/utils/ComputeMonitor.js +199 -0
- package/build/esm/utils/ComputeMonitor.js.map +1 -0
- package/build/esm/utils/EventTimeline.js +130 -0
- package/build/esm/utils/EventTimeline.js.map +1 -0
- package/build/esm/utils/LinkTraversalTracker.js +116 -0
- package/build/esm/utils/LinkTraversalTracker.js.map +1 -0
- package/build/esm/utils/MockDataGenerator.js +473 -0
- package/build/esm/utils/MockDataGenerator.js.map +1 -0
- package/build/esm/utils/ObservableClientMonitor.js +768 -0
- package/build/esm/utils/ObservableClientMonitor.js.map +1 -0
- package/build/esm/utils/PerformanceRecommendationEngine.js +185 -0
- package/build/esm/utils/PerformanceRecommendationEngine.js.map +1 -0
- package/build/esm/utils/PropertyAccessTracker.js +238 -0
- package/build/esm/utils/PropertyAccessTracker.js.map +1 -0
- package/build/esm/utils/RecommendationMatcher.js +53 -0
- package/build/esm/utils/RecommendationMatcher.js.map +1 -0
- package/build/esm/utils/SubscriptionTracker.js +132 -0
- package/build/esm/utils/SubscriptionTracker.js.map +1 -0
- package/build/esm/utils/UnusedFieldAnalyzer.js +186 -0
- package/build/esm/utils/UnusedFieldAnalyzer.js.map +1 -0
- package/build/esm/utils/WaterfallDetector.js +200 -0
- package/build/esm/utils/WaterfallDetector.js.map +1 -0
- package/build/esm/utils/computePayload.js +37 -0
- package/build/esm/utils/computePayload.js.map +1 -0
- package/build/esm/utils/computeRequest.js +29 -0
- package/build/esm/utils/computeRequest.js.map +1 -0
- package/build/esm/utils/format.js +69 -0
- package/build/esm/utils/format.js.map +1 -0
- package/build/esm/utils/logger.js +31 -0
- package/build/esm/utils/logger.js.map +1 -0
- package/build/esm/vite/constants.js +18 -0
- package/build/esm/vite/constants.js.map +1 -0
- package/build/esm/vite/hookInstaller.js +99 -0
- package/build/esm/vite/hookInstaller.js.map +1 -0
- package/build/esm/vite/index.js +77 -0
- package/build/esm/vite/index.js.map +1 -0
- package/build/types/DevToolsContext.d.ts +3 -0
- package/build/types/DevToolsContext.d.ts.map +1 -0
- package/build/types/components/ActionMetrics.d.ts +6 -0
- package/build/types/components/ActionMetrics.d.ts.map +1 -0
- package/build/types/components/BubbleChart.d.ts +10 -0
- package/build/types/components/BubbleChart.d.ts.map +1 -0
- package/build/types/components/CacheInspectorTab.d.ts +6 -0
- package/build/types/components/CacheInspectorTab.d.ts.map +1 -0
- package/build/types/components/CacheMetrics.d.ts +6 -0
- package/build/types/components/CacheMetrics.d.ts.map +1 -0
- package/build/types/components/ComponentCard.d.ts +13 -0
- package/build/types/components/ComponentCard.d.ts.map +1 -0
- package/build/types/components/ComputeTab.d.ts +6 -0
- package/build/types/components/ComputeTab.d.ts.map +1 -0
- package/build/types/components/CopyableCodeBlock.d.ts +7 -0
- package/build/types/components/CopyableCodeBlock.d.ts.map +1 -0
- package/build/types/components/DebuggingTab.d.ts +6 -0
- package/build/types/components/DebuggingTab.d.ts.map +1 -0
- package/build/types/components/HookRow.d.ts +9 -0
- package/build/types/components/HookRow.d.ts.map +1 -0
- package/build/types/components/ImprovementsTab.d.ts +7 -0
- package/build/types/components/ImprovementsTab.d.ts.map +1 -0
- package/build/types/components/InspectorSelectionHeader.d.ts +12 -0
- package/build/types/components/InspectorSelectionHeader.d.ts.map +1 -0
- package/build/types/components/InterceptTab.d.ts +126 -0
- package/build/types/components/InterceptTab.d.ts.map +1 -0
- package/build/types/components/IssueCard.d.ts +8 -0
- package/build/types/components/IssueCard.d.ts.map +1 -0
- package/build/types/components/LogEntryCard.d.ts +7 -0
- package/build/types/components/LogEntryCard.d.ts.map +1 -0
- package/build/types/components/MockEditor.d.ts +58 -0
- package/build/types/components/MockEditor.d.ts.map +1 -0
- package/build/types/components/MonitorErrorBoundary.d.ts +16 -0
- package/build/types/components/MonitorErrorBoundary.d.ts.map +1 -0
- package/build/types/components/MonitoringPanel.d.ts +8 -0
- package/build/types/components/MonitoringPanel.d.ts.map +1 -0
- package/build/types/components/ObjectLoadingMetrics.d.ts +7 -0
- package/build/types/components/ObjectLoadingMetrics.d.ts.map +1 -0
- package/build/types/components/OsdkAppErrorBoundary.d.ts +18 -0
- package/build/types/components/OsdkAppErrorBoundary.d.ts.map +1 -0
- package/build/types/components/OsdkDevTools.d.ts +2 -0
- package/build/types/components/OsdkDevTools.d.ts.map +1 -0
- package/build/types/components/OverrideEditor.d.ts +26 -0
- package/build/types/components/OverrideEditor.d.ts.map +1 -0
- package/build/types/components/PerformanceTab.d.ts +8 -0
- package/build/types/components/PerformanceTab.d.ts.map +1 -0
- package/build/types/components/PrimitiveSelectionPanel.d.ts +28 -0
- package/build/types/components/PrimitiveSelectionPanel.d.ts.map +1 -0
- package/build/types/components/issueTypes.d.ts +16 -0
- package/build/types/components/issueTypes.d.ts.map +1 -0
- package/build/types/components/resolveComponentName.d.ts +3 -0
- package/build/types/components/resolveComponentName.d.ts.map +1 -0
- package/build/types/components/testHelpers.d.ts +2 -0
- package/build/types/components/testHelpers.d.ts.map +1 -0
- package/build/types/css.d.d.ts +4 -0
- package/build/types/css.d.d.ts.map +1 -0
- package/build/types/fiber/DegradationNotice.d.ts +8 -0
- package/build/types/fiber/DegradationNotice.d.ts.map +1 -0
- package/build/types/fiber/DevtoolsHook.d.ts +7 -0
- package/build/types/fiber/DevtoolsHook.d.ts.map +1 -0
- package/build/types/fiber/FiberAccess.d.ts +2 -0
- package/build/types/fiber/FiberAccess.d.ts.map +1 -0
- package/build/types/fiber/FiberInspection.d.ts +6 -0
- package/build/types/fiber/FiberInspection.d.ts.map +1 -0
- package/build/types/fiber/FiberTags.d.ts +33 -0
- package/build/types/fiber/FiberTags.d.ts.map +1 -0
- package/build/types/fiber/HookStateInspector.d.ts +45 -0
- package/build/types/fiber/HookStateInspector.d.ts.map +1 -0
- package/build/types/fiber/SafeFiberOperation.d.ts +7 -0
- package/build/types/fiber/SafeFiberOperation.d.ts.map +1 -0
- package/build/types/fiber/capabilities.d.ts +38 -0
- package/build/types/fiber/capabilities.d.ts.map +1 -0
- package/build/types/fiber/traverseFiber.d.ts +5 -0
- package/build/types/fiber/traverseFiber.d.ts.map +1 -0
- package/build/types/fiber/types.d.ts +87 -0
- package/build/types/fiber/types.d.ts.map +1 -0
- package/build/types/fiber/validation.d.ts +10 -0
- package/build/types/fiber/validation.d.ts.map +1 -0
- package/build/types/hooks/createPollingStore.d.ts +5 -0
- package/build/types/hooks/createPollingStore.d.ts.map +1 -0
- package/build/types/hooks/useActiveComponents.d.ts +3 -0
- package/build/types/hooks/useActiveComponents.d.ts.map +1 -0
- package/build/types/hooks/useComponentRegistry.d.ts +3 -0
- package/build/types/hooks/useComponentRegistry.d.ts.map +1 -0
- package/build/types/hooks/useComputeSelectors.d.ts +7 -0
- package/build/types/hooks/useComputeSelectors.d.ts.map +1 -0
- package/build/types/hooks/useConsoleLogs.d.ts +7 -0
- package/build/types/hooks/useConsoleLogs.d.ts.map +1 -0
- package/build/types/hooks/useInspectorSelection.d.ts +9 -0
- package/build/types/hooks/useInspectorSelection.d.ts.map +1 -0
- package/build/types/hooks/useMetrics.d.ts +3 -0
- package/build/types/hooks/useMetrics.d.ts.map +1 -0
- package/build/types/hooks/usePersistedState.d.ts +1 -0
- package/build/types/hooks/usePersistedState.d.ts.map +1 -0
- package/build/types/hooks/useRecommendations.d.ts +10 -0
- package/build/types/hooks/useRecommendations.d.ts.map +1 -0
- package/build/types/hooks/useSharedTick.d.ts +1 -0
- package/build/types/hooks/useSharedTick.d.ts.map +1 -0
- package/build/types/hooks/useTimeElapsed.d.ts +1 -0
- package/build/types/hooks/useTimeElapsed.d.ts.map +1 -0
- package/build/types/hooks/useTrackerSubscription.d.ts +16 -0
- package/build/types/hooks/useTrackerSubscription.d.ts.map +1 -0
- package/build/types/hooks/useUnusedFieldAnalysis.d.ts +8 -0
- package/build/types/hooks/useUnusedFieldAnalysis.d.ts.map +1 -0
- package/build/types/index.d.ts +21 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/inspector/ClickToInspectSystem.d.ts +40 -0
- package/build/types/inspector/ClickToInspectSystem.d.ts.map +1 -0
- package/build/types/inspector/components/ComponentLabel.d.ts +3 -0
- package/build/types/inspector/components/ComponentLabel.d.ts.map +1 -0
- package/build/types/inspector/components/InspectorBanner.d.ts +5 -0
- package/build/types/inspector/components/InspectorBanner.d.ts.map +1 -0
- package/build/types/inspector/components/InspectorOverlay.d.ts +3 -0
- package/build/types/inspector/components/InspectorOverlay.d.ts.map +1 -0
- package/build/types/inspector/components/SelectionHighlight.d.ts +3 -0
- package/build/types/inspector/components/SelectionHighlight.d.ts.map +1 -0
- package/build/types/inspector/createClickToInspect.d.ts +3 -0
- package/build/types/inspector/createClickToInspect.d.ts.map +1 -0
- package/build/types/inspector/hooks/useAnimatedBounds.d.ts +2 -0
- package/build/types/inspector/hooks/useAnimatedBounds.d.ts.map +1 -0
- package/build/types/inspector/index.d.ts +13 -0
- package/build/types/inspector/index.d.ts.map +1 -0
- package/build/types/inspector/inspectorController.d.ts +2 -0
- package/build/types/inspector/inspectorController.d.ts.map +1 -0
- package/build/types/inspector/types.d.ts +94 -0
- package/build/types/inspector/types.d.ts.map +1 -0
- package/build/types/inspector/utils/elementBounds.d.ts +3 -0
- package/build/types/inspector/utils/elementBounds.d.ts.map +1 -0
- package/build/types/inspector/utils/interpolation.d.ts +7 -0
- package/build/types/inspector/utils/interpolation.d.ts.map +1 -0
- package/build/types/inspector/utils/labelPositioning.d.ts +3 -0
- package/build/types/inspector/utils/labelPositioning.d.ts.map +1 -0
- package/build/types/mocking/MockCacheKeyGenerator.d.ts +41 -0
- package/build/types/mocking/MockCacheKeyGenerator.d.ts.map +1 -0
- package/build/types/mocking/MockManager.d.ts +103 -0
- package/build/types/mocking/MockManager.d.ts.map +1 -0
- package/build/types/prototyping/PrototypeOverrideStore.d.ts +33 -0
- package/build/types/prototyping/PrototypeOverrideStore.d.ts.map +1 -0
- package/build/types/prototyping/index.d.ts +1 -0
- package/build/types/prototyping/index.d.ts.map +1 -0
- package/build/types/public/vite.d.ts +2 -0
- package/build/types/public/vite.d.ts.map +1 -0
- package/build/types/register.d.ts +1 -0
- package/build/types/register.d.ts.map +1 -0
- package/build/types/scss.d.d.ts +6 -0
- package/build/types/scss.d.d.ts.map +1 -0
- package/build/types/store/ComputeStore.d.ts +47 -0
- package/build/types/store/ComputeStore.d.ts.map +1 -0
- package/build/types/store/ConsoleLogStore.d.ts +29 -0
- package/build/types/store/ConsoleLogStore.d.ts.map +1 -0
- package/build/types/store/MetricsStore.d.ts +42 -0
- package/build/types/store/MetricsStore.d.ts.map +1 -0
- package/build/types/store/MonitorStore.d.ts +86 -0
- package/build/types/store/MonitorStore.d.ts.map +1 -0
- package/build/types/store/SubscribableStore.d.ts +6 -0
- package/build/types/store/SubscribableStore.d.ts.map +1 -0
- package/build/types/store/WindowErrorStore.d.ts +32 -0
- package/build/types/store/WindowErrorStore.d.ts.map +1 -0
- package/build/types/styles.d.ts +1 -0
- package/build/types/styles.d.ts.map +1 -0
- package/build/types/types/compute.d.ts +73 -0
- package/build/types/types/compute.d.ts.map +1 -0
- package/build/types/types/emissions.d.ts +24 -0
- package/build/types/types/emissions.d.ts.map +1 -0
- package/build/types/types/index.d.ts +143 -0
- package/build/types/types/index.d.ts.map +1 -0
- package/build/types/utils/ActionLifecycleTracker.d.ts +39 -0
- package/build/types/utils/ActionLifecycleTracker.d.ts.map +1 -0
- package/build/types/utils/CacheEfficiencyAnalyzer.d.ts +45 -0
- package/build/types/utils/CacheEfficiencyAnalyzer.d.ts.map +1 -0
- package/build/types/utils/CircularBuffer.d.ts +18 -0
- package/build/types/utils/CircularBuffer.d.ts.map +1 -0
- package/build/types/utils/ComponentContextCapture.d.ts +29 -0
- package/build/types/utils/ComponentContextCapture.d.ts.map +1 -0
- package/build/types/utils/ComponentPrimitiveDiscovery.d.ts +62 -0
- package/build/types/utils/ComponentPrimitiveDiscovery.d.ts.map +1 -0
- package/build/types/utils/ComponentQueryRegistry.d.ts +91 -0
- package/build/types/utils/ComponentQueryRegistry.d.ts.map +1 -0
- package/build/types/utils/ComputeMonitor.d.ts +14 -0
- package/build/types/utils/ComputeMonitor.d.ts.map +1 -0
- package/build/types/utils/EventTimeline.d.ts +102 -0
- package/build/types/utils/EventTimeline.d.ts.map +1 -0
- package/build/types/utils/LinkTraversalTracker.d.ts +43 -0
- package/build/types/utils/LinkTraversalTracker.d.ts.map +1 -0
- package/build/types/utils/MockDataGenerator.d.ts +23 -0
- package/build/types/utils/MockDataGenerator.d.ts.map +1 -0
- package/build/types/utils/ObservableClientMonitor.d.ts +62 -0
- package/build/types/utils/ObservableClientMonitor.d.ts.map +1 -0
- package/build/types/utils/PerformanceRecommendationEngine.d.ts +67 -0
- package/build/types/utils/PerformanceRecommendationEngine.d.ts.map +1 -0
- package/build/types/utils/PropertyAccessTracker.d.ts +50 -0
- package/build/types/utils/PropertyAccessTracker.d.ts.map +1 -0
- package/build/types/utils/RecommendationMatcher.d.ts +5 -0
- package/build/types/utils/RecommendationMatcher.d.ts.map +1 -0
- package/build/types/utils/SubscriptionTracker.d.ts +17 -0
- package/build/types/utils/SubscriptionTracker.d.ts.map +1 -0
- package/build/types/utils/UnusedFieldAnalyzer.d.ts +46 -0
- package/build/types/utils/UnusedFieldAnalyzer.d.ts.map +1 -0
- package/build/types/utils/WaterfallDetector.d.ts +28 -0
- package/build/types/utils/WaterfallDetector.d.ts.map +1 -0
- package/build/types/utils/computePayload.d.ts +3 -0
- package/build/types/utils/computePayload.d.ts.map +1 -0
- package/build/types/utils/computeRequest.d.ts +20 -0
- package/build/types/utils/computeRequest.d.ts.map +1 -0
- package/build/types/utils/format.d.ts +5 -0
- package/build/types/utils/format.d.ts.map +1 -0
- package/build/types/utils/logger.d.ts +2 -0
- package/build/types/utils/logger.d.ts.map +1 -0
- package/build/types/vite/constants.d.ts +1 -0
- package/build/types/vite/constants.d.ts.map +1 -0
- package/build/types/vite/hookInstaller.d.ts +1 -0
- package/build/types/vite/hookInstaller.d.ts.map +1 -0
- package/build/types/vite/index.d.ts +20 -0
- package/build/types/vite/index.d.ts.map +1 -0
- package/package.json +114 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { Button, Callout, Intent, Tag } from "@blueprintjs/core";
|
|
18
|
+
import React from "react";
|
|
19
|
+
import { getCapabilitiesManager } from "./capabilities.js";
|
|
20
|
+
import { onReactDetected } from "./DevtoolsHook.js";
|
|
21
|
+
import { validateFiberAccess } from "./validation.js";
|
|
22
|
+
const FEATURE_LABELS = {
|
|
23
|
+
"component-inspection": "Component Inspection",
|
|
24
|
+
"hook-discovery": "Hook Discovery",
|
|
25
|
+
"render-tracking": "Render Tracking",
|
|
26
|
+
"state-inspection": "State Inspection",
|
|
27
|
+
"metadata-extraction": "Metadata Extraction",
|
|
28
|
+
"fiber-discovery": "Fiber Discovery"
|
|
29
|
+
};
|
|
30
|
+
const FEATURE_DESCRIPTIONS = {
|
|
31
|
+
"component-inspection": "View component hierarchy and props",
|
|
32
|
+
"hook-discovery": "Detect OSDK hooks in components",
|
|
33
|
+
"render-tracking": "Track component re-renders",
|
|
34
|
+
"state-inspection": "Inspect component state and hooks",
|
|
35
|
+
"metadata-extraction": "Extract OSDK hook metadata from fibers",
|
|
36
|
+
"fiber-discovery": "Discover OSDK components from fiber tree"
|
|
37
|
+
};
|
|
38
|
+
function subscribeToCapabilities(onStoreChange) {
|
|
39
|
+
const manager = getCapabilitiesManager();
|
|
40
|
+
validateFiberAccess();
|
|
41
|
+
const unsubscribe = manager.onCapabilitiesChange(() => {
|
|
42
|
+
onStoreChange();
|
|
43
|
+
});
|
|
44
|
+
const unsubscribeReactDetected = onReactDetected(() => {
|
|
45
|
+
validateFiberAccess();
|
|
46
|
+
});
|
|
47
|
+
return () => {
|
|
48
|
+
unsubscribe();
|
|
49
|
+
unsubscribeReactDetected();
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function getCapabilitiesSnapshot() {
|
|
53
|
+
return getCapabilitiesManager().getCapabilities();
|
|
54
|
+
}
|
|
55
|
+
export const DegradationNotice = ({
|
|
56
|
+
onRetry,
|
|
57
|
+
showWhenHealthy = false
|
|
58
|
+
}) => {
|
|
59
|
+
const capabilities = React.useSyncExternalStore(subscribeToCapabilities, getCapabilitiesSnapshot, getCapabilitiesSnapshot);
|
|
60
|
+
const disabledFeatures = Array.from(capabilities.disabledFeatures);
|
|
61
|
+
const hasIssues = !capabilities.fiberAccessWorking || disabledFeatures.length > 0;
|
|
62
|
+
if (!hasIssues && !showWhenHealthy) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (!hasIssues && showWhenHealthy) {
|
|
66
|
+
return /*#__PURE__*/React.createElement(Callout, {
|
|
67
|
+
intent: Intent.SUCCESS,
|
|
68
|
+
icon: "tick-circle",
|
|
69
|
+
title: "Fiber Access Healthy",
|
|
70
|
+
style: {
|
|
71
|
+
margin: "8px"
|
|
72
|
+
}
|
|
73
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
74
|
+
style: {
|
|
75
|
+
margin: 0
|
|
76
|
+
}
|
|
77
|
+
}, "All fiber features are working correctly.", capabilities.detectedReactVersion && /*#__PURE__*/React.createElement(React.Fragment, null, "React ", capabilities.detectedReactVersion, " detected.")));
|
|
78
|
+
}
|
|
79
|
+
if (!capabilities.hookInstalled) {
|
|
80
|
+
return /*#__PURE__*/React.createElement(Callout, {
|
|
81
|
+
intent: Intent.WARNING,
|
|
82
|
+
icon: "warning-sign",
|
|
83
|
+
title: "DevTools Hook Not Installed",
|
|
84
|
+
style: {
|
|
85
|
+
margin: "8px"
|
|
86
|
+
}
|
|
87
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
88
|
+
style: {
|
|
89
|
+
margin: "0 0 8px 0"
|
|
90
|
+
}
|
|
91
|
+
}, "The React DevTools hook was not installed before React loaded. Some features may be unavailable."), /*#__PURE__*/React.createElement("p", {
|
|
92
|
+
style: {
|
|
93
|
+
margin: 0,
|
|
94
|
+
fontSize: "12px",
|
|
95
|
+
color: "#5c7080"
|
|
96
|
+
}
|
|
97
|
+
}, "Ensure the devtools are imported before React in your entry point."));
|
|
98
|
+
}
|
|
99
|
+
if (!capabilities.rendererDetected) {
|
|
100
|
+
return /*#__PURE__*/React.createElement(Callout, {
|
|
101
|
+
intent: Intent.PRIMARY,
|
|
102
|
+
icon: "time",
|
|
103
|
+
title: "Waiting for React",
|
|
104
|
+
style: {
|
|
105
|
+
margin: "8px"
|
|
106
|
+
}
|
|
107
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
108
|
+
style: {
|
|
109
|
+
margin: 0
|
|
110
|
+
}
|
|
111
|
+
}, "No React renderer detected yet. React may still be loading."), onRetry && /*#__PURE__*/React.createElement(Button, {
|
|
112
|
+
size: "small",
|
|
113
|
+
variant: "minimal",
|
|
114
|
+
intent: Intent.PRIMARY,
|
|
115
|
+
onClick: onRetry,
|
|
116
|
+
style: {
|
|
117
|
+
marginTop: "8px"
|
|
118
|
+
}
|
|
119
|
+
}, "Check Again"));
|
|
120
|
+
}
|
|
121
|
+
if (!capabilities.fiberAccessWorking) {
|
|
122
|
+
return /*#__PURE__*/React.createElement(Callout, {
|
|
123
|
+
intent: Intent.DANGER,
|
|
124
|
+
icon: "error",
|
|
125
|
+
title: "Fiber Access Unavailable",
|
|
126
|
+
style: {
|
|
127
|
+
margin: "8px"
|
|
128
|
+
}
|
|
129
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
130
|
+
style: {
|
|
131
|
+
margin: "0 0 8px 0"
|
|
132
|
+
}
|
|
133
|
+
}, "Unable to access React's internal fiber tree. Component inspection and related features are disabled."), capabilities.detectedReactVersion && /*#__PURE__*/React.createElement("p", {
|
|
134
|
+
style: {
|
|
135
|
+
margin: "0 0 8px 0",
|
|
136
|
+
fontSize: "12px",
|
|
137
|
+
color: "#5c7080"
|
|
138
|
+
}
|
|
139
|
+
}, "React ", capabilities.detectedReactVersion, " detected"), onRetry && /*#__PURE__*/React.createElement(Button, {
|
|
140
|
+
size: "small",
|
|
141
|
+
intent: Intent.PRIMARY,
|
|
142
|
+
onClick: onRetry
|
|
143
|
+
}, "Retry"));
|
|
144
|
+
}
|
|
145
|
+
return /*#__PURE__*/React.createElement(Callout, {
|
|
146
|
+
intent: Intent.WARNING,
|
|
147
|
+
icon: "warning-sign",
|
|
148
|
+
title: "Some Features Disabled",
|
|
149
|
+
style: {
|
|
150
|
+
margin: "8px"
|
|
151
|
+
}
|
|
152
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
153
|
+
style: {
|
|
154
|
+
margin: "0 0 8px 0"
|
|
155
|
+
}
|
|
156
|
+
}, "The following features have been temporarily disabled due to errors:"), /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
style: {
|
|
158
|
+
display: "flex",
|
|
159
|
+
flexWrap: "wrap",
|
|
160
|
+
gap: "4px",
|
|
161
|
+
marginBottom: "8px"
|
|
162
|
+
}
|
|
163
|
+
}, disabledFeatures.map(feature => /*#__PURE__*/React.createElement(Tag, {
|
|
164
|
+
key: feature,
|
|
165
|
+
intent: Intent.WARNING,
|
|
166
|
+
minimal: true,
|
|
167
|
+
title: FEATURE_DESCRIPTIONS[feature]
|
|
168
|
+
}, FEATURE_LABELS[feature]))), capabilities.errorCount > 0 && /*#__PURE__*/React.createElement("p", {
|
|
169
|
+
style: {
|
|
170
|
+
margin: "0 0 8px 0",
|
|
171
|
+
fontSize: "12px",
|
|
172
|
+
color: "#5c7080"
|
|
173
|
+
}
|
|
174
|
+
}, capabilities.errorCount, " ", "error", capabilities.errorCount > 1 ? "s" : "", " ", "recorded. Features will auto-recover after 30 seconds of successful operation."), onRetry && /*#__PURE__*/React.createElement(Button, {
|
|
175
|
+
size: "small",
|
|
176
|
+
variant: "minimal",
|
|
177
|
+
intent: Intent.WARNING,
|
|
178
|
+
onClick: () => {
|
|
179
|
+
getCapabilitiesManager().resetAll();
|
|
180
|
+
onRetry();
|
|
181
|
+
}
|
|
182
|
+
}, "Reset & Retry"));
|
|
183
|
+
};
|
|
184
|
+
function subscribeToCapabilitiesSimple(onStoreChange) {
|
|
185
|
+
const manager = getCapabilitiesManager();
|
|
186
|
+
return manager.onCapabilitiesChange(() => {
|
|
187
|
+
onStoreChange();
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
export function useFiberCapabilities() {
|
|
191
|
+
return React.useSyncExternalStore(subscribeToCapabilitiesSimple, getCapabilitiesSnapshot, getCapabilitiesSnapshot);
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=DegradationNotice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DegradationNotice.js","names":["Button","Callout","Intent","Tag","React","getCapabilitiesManager","onReactDetected","validateFiberAccess","FEATURE_LABELS","FEATURE_DESCRIPTIONS","subscribeToCapabilities","onStoreChange","manager","unsubscribe","onCapabilitiesChange","unsubscribeReactDetected","getCapabilitiesSnapshot","getCapabilities","DegradationNotice","onRetry","showWhenHealthy","capabilities","useSyncExternalStore","disabledFeatures","Array","from","hasIssues","fiberAccessWorking","length","createElement","intent","SUCCESS","icon","title","style","margin","detectedReactVersion","Fragment","hookInstalled","WARNING","fontSize","color","rendererDetected","PRIMARY","size","variant","onClick","marginTop","DANGER","display","flexWrap","gap","marginBottom","map","feature","key","minimal","errorCount","resetAll","subscribeToCapabilitiesSimple","useFiberCapabilities"],"sources":["DegradationNotice.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Button, Callout, Intent, Tag } from \"@blueprintjs/core\";\nimport React from \"react\";\nimport {\n type FiberCapabilities,\n type FiberFeature,\n getCapabilitiesManager,\n} from \"./capabilities.js\";\nimport { onReactDetected } from \"./DevtoolsHook.js\";\nimport { validateFiberAccess } from \"./validation.js\";\n\nconst FEATURE_LABELS: Record<FiberFeature, string> = {\n \"component-inspection\": \"Component Inspection\",\n \"hook-discovery\": \"Hook Discovery\",\n \"render-tracking\": \"Render Tracking\",\n \"state-inspection\": \"State Inspection\",\n \"metadata-extraction\": \"Metadata Extraction\",\n \"fiber-discovery\": \"Fiber Discovery\",\n};\n\nconst FEATURE_DESCRIPTIONS: Record<FiberFeature, string> = {\n \"component-inspection\": \"View component hierarchy and props\",\n \"hook-discovery\": \"Detect OSDK hooks in components\",\n \"render-tracking\": \"Track component re-renders\",\n \"state-inspection\": \"Inspect component state and hooks\",\n \"metadata-extraction\": \"Extract OSDK hook metadata from fibers\",\n \"fiber-discovery\": \"Discover OSDK components from fiber tree\",\n};\n\nexport interface DegradationNoticeProps {\n onRetry?: () => void;\n showWhenHealthy?: boolean;\n}\n\nfunction subscribeToCapabilities(onStoreChange: () => void): () => void {\n const manager = getCapabilitiesManager();\n\n validateFiberAccess();\n\n const unsubscribe = manager.onCapabilitiesChange(() => {\n onStoreChange();\n });\n\n const unsubscribeReactDetected = onReactDetected(() => {\n validateFiberAccess();\n });\n\n return () => {\n unsubscribe();\n unsubscribeReactDetected();\n };\n}\n\nfunction getCapabilitiesSnapshot(): FiberCapabilities {\n return getCapabilitiesManager().getCapabilities();\n}\n\nexport const DegradationNotice: React.FC<DegradationNoticeProps> = ({\n onRetry,\n showWhenHealthy = false,\n}) => {\n const capabilities = React.useSyncExternalStore(\n subscribeToCapabilities,\n getCapabilitiesSnapshot,\n getCapabilitiesSnapshot,\n );\n\n const disabledFeatures = Array.from(capabilities.disabledFeatures);\n const hasIssues = !capabilities.fiberAccessWorking\n || disabledFeatures.length > 0;\n\n if (!hasIssues && !showWhenHealthy) {\n return null;\n }\n\n if (!hasIssues && showWhenHealthy) {\n return (\n <Callout\n intent={Intent.SUCCESS}\n icon=\"tick-circle\"\n title=\"Fiber Access Healthy\"\n style={{ margin: \"8px\" }}\n >\n <p style={{ margin: 0 }}>\n All fiber features are working correctly.\n {capabilities.detectedReactVersion && (\n <>React {capabilities.detectedReactVersion} detected.</>\n )}\n </p>\n </Callout>\n );\n }\n\n if (!capabilities.hookInstalled) {\n return (\n <Callout\n intent={Intent.WARNING}\n icon=\"warning-sign\"\n title=\"DevTools Hook Not Installed\"\n style={{ margin: \"8px\" }}\n >\n <p style={{ margin: \"0 0 8px 0\" }}>\n The React DevTools hook was not installed before React loaded. Some\n features may be unavailable.\n </p>\n <p style={{ margin: 0, fontSize: \"12px\", color: \"#5c7080\" }}>\n Ensure the devtools are imported before React in your entry point.\n </p>\n </Callout>\n );\n }\n\n if (!capabilities.rendererDetected) {\n return (\n <Callout\n intent={Intent.PRIMARY}\n icon=\"time\"\n title=\"Waiting for React\"\n style={{ margin: \"8px\" }}\n >\n <p style={{ margin: 0 }}>\n No React renderer detected yet. React may still be loading.\n </p>\n {onRetry && (\n <Button\n size=\"small\"\n variant=\"minimal\"\n intent={Intent.PRIMARY}\n onClick={onRetry}\n style={{ marginTop: \"8px\" }}\n >\n Check Again\n </Button>\n )}\n </Callout>\n );\n }\n\n if (!capabilities.fiberAccessWorking) {\n return (\n <Callout\n intent={Intent.DANGER}\n icon=\"error\"\n title=\"Fiber Access Unavailable\"\n style={{ margin: \"8px\" }}\n >\n <p style={{ margin: \"0 0 8px 0\" }}>\n Unable to access React's internal fiber tree. Component\n inspection and related features are disabled.\n </p>\n {capabilities.detectedReactVersion && (\n <p\n style={{ margin: \"0 0 8px 0\", fontSize: \"12px\", color: \"#5c7080\" }}\n >\n React {capabilities.detectedReactVersion} detected\n </p>\n )}\n {onRetry && (\n <Button\n size=\"small\"\n intent={Intent.PRIMARY}\n onClick={onRetry}\n >\n Retry\n </Button>\n )}\n </Callout>\n );\n }\n\n return (\n <Callout\n intent={Intent.WARNING}\n icon=\"warning-sign\"\n title=\"Some Features Disabled\"\n style={{ margin: \"8px\" }}\n >\n <p style={{ margin: \"0 0 8px 0\" }}>\n The following features have been temporarily disabled due to errors:\n </p>\n <div\n style={{\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"4px\",\n marginBottom: \"8px\",\n }}\n >\n {disabledFeatures.map((feature) => (\n <Tag\n key={feature}\n intent={Intent.WARNING}\n minimal\n title={FEATURE_DESCRIPTIONS[feature]}\n >\n {FEATURE_LABELS[feature]}\n </Tag>\n ))}\n </div>\n {capabilities.errorCount > 0 && (\n <p style={{ margin: \"0 0 8px 0\", fontSize: \"12px\", color: \"#5c7080\" }}>\n {capabilities.errorCount}{\" \"}\n error{capabilities.errorCount > 1 ? \"s\" : \"\"}{\" \"}\n recorded. Features will auto-recover after 30 seconds of successful\n operation.\n </p>\n )}\n {onRetry && (\n <Button\n size=\"small\"\n variant=\"minimal\"\n intent={Intent.WARNING}\n onClick={() => {\n getCapabilitiesManager().resetAll();\n onRetry();\n }}\n >\n Reset & Retry\n </Button>\n )}\n </Callout>\n );\n};\n\nfunction subscribeToCapabilitiesSimple(onStoreChange: () => void): () => void {\n const manager = getCapabilitiesManager();\n return manager.onCapabilitiesChange(() => {\n onStoreChange();\n });\n}\n\nexport function useFiberCapabilities(): FiberCapabilities {\n return React.useSyncExternalStore(\n subscribeToCapabilitiesSimple,\n getCapabilitiesSnapshot,\n getCapabilitiesSnapshot,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEC,GAAG,QAAQ,mBAAmB;AAChE,OAAOC,KAAK,MAAM,OAAO;AACzB,SAGEC,sBAAsB,QACjB,mBAAmB;AAC1B,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,mBAAmB,QAAQ,iBAAiB;AAErD,MAAMC,cAA4C,GAAG;EACnD,sBAAsB,EAAE,sBAAsB;EAC9C,gBAAgB,EAAE,gBAAgB;EAClC,iBAAiB,EAAE,iBAAiB;EACpC,kBAAkB,EAAE,kBAAkB;EACtC,qBAAqB,EAAE,qBAAqB;EAC5C,iBAAiB,EAAE;AACrB,CAAC;AAED,MAAMC,oBAAkD,GAAG;EACzD,sBAAsB,EAAE,oCAAoC;EAC5D,gBAAgB,EAAE,iCAAiC;EACnD,iBAAiB,EAAE,4BAA4B;EAC/C,kBAAkB,EAAE,mCAAmC;EACvD,qBAAqB,EAAE,wCAAwC;EAC/D,iBAAiB,EAAE;AACrB,CAAC;AAOD,SAASC,uBAAuBA,CAACC,aAAyB,EAAc;EACtE,MAAMC,OAAO,GAAGP,sBAAsB,CAAC,CAAC;EAExCE,mBAAmB,CAAC,CAAC;EAErB,MAAMM,WAAW,GAAGD,OAAO,CAACE,oBAAoB,CAAC,MAAM;IACrDH,aAAa,CAAC,CAAC;EACjB,CAAC,CAAC;EAEF,MAAMI,wBAAwB,GAAGT,eAAe,CAAC,MAAM;IACrDC,mBAAmB,CAA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,CACE,CAAC,EACLjC,YAAY,CAACoC,UAAU,GAAG,CAAC,iBAC1BrD,KAAA,CAAAyB,aAAA;IAAGK,KAAK,EAAE;MAAEC,MAAM,EAAE,WAAW;MAAEK,QAAQ,EAAE,MAAM;MAAEC,KAAK,EAAE;IAAU;EAAE,GACnEpB,YAAY,CAACoC,UAAU,EAAE,GAAG,EAAC,OACzB,EAACpC,YAAY,CAACoC,UAAU,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,EAAE,GAAG,EAAC,gFAGjD,CACJ,EACAtC,OAAO,iBACNf,KAAA,CAAAyB,aAAA,CAAC7B,MAAM;IACL4C,IAAI,EAAC,OAAO;IACZC,OAAO,EAAC,SAAS;IACjBf,MAAM,EAAE5B,MAAM,CAACqC,OAAQ;IACvBO,OAAO,EAAEA,CAAA,KAAM;MACbzC,sBAAsB,CAAC,CAAC,CAACqD,QAAQ,CAAC,CAAC;MACnCvC,OAAO,CAAC,CAAC;IACX;EAAE,GACH,eAEO,CAEH,CAAC;AAEd,CAAC;AAED,SAASwC,6BAA6BA,CAAChD,aAAyB,EAAc;EAC5E,MAAMC,OAAO,GAAGP,sBAAsB,CAAC,CAAC;EACxC,OAAOO,OAAO,CAACE,oBAAoB,CAAC,MAAM;IACxCH,aAAa,CAAC,CAAC;EACjB,CAAC,CAAC;AACJ;AAEA,OAAO,SAASiD,oBAAoBA,CAAA,EAAsB;EACxD,OAAOxD,KAAK,CAACkB,oBAAoB,CAC/BqC,6BAA6B,EAC7B3C,uBAAuB,EACvBA,uBACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const OSDK_INSTRUMENTATION_STRING = "osdk-devtools";
|
|
18
|
+
const NO_OP = () => {
|
|
19
|
+
/* no-op */
|
|
20
|
+
};
|
|
21
|
+
const checkDCE = fn => {
|
|
22
|
+
try {
|
|
23
|
+
const code = Function.prototype.toString.call(fn);
|
|
24
|
+
if (code.indexOf("^_^") > -1) {
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
throw new Error("React is running in production mode, but dead code " + "elimination has not been applied. Read how to correctly " + "configure React for production: " + "https://reactjs.org/link/perf-use-production-build");
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
} catch {
|
|
30
|
+
// Ignore errors in DCE check
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const allRenderers = new Set();
|
|
34
|
+
const onActiveListeners = new Set();
|
|
35
|
+
const fiberRoots = new Map();
|
|
36
|
+
function isClientEnvironment() {
|
|
37
|
+
return typeof window !== "undefined"
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Browser detection pattern from React DevTools
|
|
39
|
+
&& (typeof window.document?.createElement === "function"
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- ReactNative detection pattern
|
|
41
|
+
|| window.navigator?.product === "ReactNative");
|
|
42
|
+
}
|
|
43
|
+
function hasDevToolsHook() {
|
|
44
|
+
return Object.prototype.hasOwnProperty.call(globalThis, "__REACT_DEVTOOLS_GLOBAL_HOOK__");
|
|
45
|
+
}
|
|
46
|
+
function installDevToolsHook(onActive) {
|
|
47
|
+
const renderers = new Map();
|
|
48
|
+
let nextId = 0;
|
|
49
|
+
let hook = {
|
|
50
|
+
_instrumentationIsActive: false,
|
|
51
|
+
_instrumentationSource: OSDK_INSTRUMENTATION_STRING,
|
|
52
|
+
checkDCE,
|
|
53
|
+
hasUnsupportedRendererAttached: false,
|
|
54
|
+
inject(renderer) {
|
|
55
|
+
const id = ++nextId;
|
|
56
|
+
renderers.set(id, renderer);
|
|
57
|
+
allRenderers.add(renderer);
|
|
58
|
+
fiberRoots.set(id, new Set());
|
|
59
|
+
if (!hook._instrumentationIsActive) {
|
|
60
|
+
hook._instrumentationIsActive = true;
|
|
61
|
+
notifyActiveListeners();
|
|
62
|
+
}
|
|
63
|
+
return id;
|
|
64
|
+
},
|
|
65
|
+
on: NO_OP,
|
|
66
|
+
onCommitFiberRoot(rendererID, root) {
|
|
67
|
+
const roots = fiberRoots.get(rendererID);
|
|
68
|
+
if (roots) {
|
|
69
|
+
roots.add(root);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
onCommitFiberUnmount: NO_OP,
|
|
73
|
+
onPostCommitFiberRoot: NO_OP,
|
|
74
|
+
renderers,
|
|
75
|
+
supportsFiber: true,
|
|
76
|
+
supportsFlight: true
|
|
77
|
+
};
|
|
78
|
+
try {
|
|
79
|
+
Object.defineProperty(globalThis, "__REACT_DEVTOOLS_GLOBAL_HOOK__", {
|
|
80
|
+
configurable: true,
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get() {
|
|
83
|
+
return hook;
|
|
84
|
+
},
|
|
85
|
+
set(newHook) {
|
|
86
|
+
if (newHook && typeof newHook === "object") {
|
|
87
|
+
const ourRenderers = hook.renderers;
|
|
88
|
+
hook = newHook;
|
|
89
|
+
if (ourRenderers.size > 0) {
|
|
90
|
+
ourRenderers.forEach((renderer, id) => {
|
|
91
|
+
allRenderers.add(renderer);
|
|
92
|
+
newHook.renderers.set(id, renderer);
|
|
93
|
+
});
|
|
94
|
+
patchDevToolsHook(onActive);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Chrome extension compatibility hack
|
|
101
|
+
// https://github.com/facebook/react/blob/main/packages/react-devtools-extensions/src/contentScripts/installHook.js
|
|
102
|
+
let hasRunHack = false;
|
|
103
|
+
Object.defineProperty(window, "hasOwnProperty", {
|
|
104
|
+
configurable: true,
|
|
105
|
+
writable: true,
|
|
106
|
+
value: function (prop) {
|
|
107
|
+
try {
|
|
108
|
+
if (!hasRunHack && prop === "__REACT_DEVTOOLS_GLOBAL_HOOK__") {
|
|
109
|
+
globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__ = undefined;
|
|
110
|
+
hasRunHack = true;
|
|
111
|
+
// Chrome DevTools extension compatibility: returns -0 (falsy, non-boolean)
|
|
112
|
+
// so the extension detects a race condition and re-installs its own hook.
|
|
113
|
+
// See: https://github.com/facebook/react/blob/main/packages/react-devtools-extensions/src/contentScripts/installHook.js
|
|
114
|
+
return -0;
|
|
115
|
+
}
|
|
116
|
+
} catch {
|
|
117
|
+
// Ignore errors in hack
|
|
118
|
+
}
|
|
119
|
+
return Object.prototype.hasOwnProperty.call(this, prop);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
} catch {
|
|
123
|
+
// If property definition fails, try to patch existing hook
|
|
124
|
+
patchDevToolsHook(onActive);
|
|
125
|
+
}
|
|
126
|
+
if (onActive) {
|
|
127
|
+
onActiveListeners.add(onActive);
|
|
128
|
+
}
|
|
129
|
+
return hook;
|
|
130
|
+
}
|
|
131
|
+
function patchDevToolsHook(onActive) {
|
|
132
|
+
if (onActive) {
|
|
133
|
+
onActiveListeners.add(onActive);
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
137
|
+
if (!hook) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (hook._instrumentationSource === OSDK_INSTRUMENTATION_STRING) {
|
|
141
|
+
if (hook.renderers.size || hook._instrumentationIsActive) {
|
|
142
|
+
onActive?.();
|
|
143
|
+
}
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Mark as patched
|
|
148
|
+
hook._instrumentationSource = OSDK_INSTRUMENTATION_STRING;
|
|
149
|
+
hook._instrumentationIsActive = false;
|
|
150
|
+
hook.supportsFiber = true;
|
|
151
|
+
hook.supportsFlight = true;
|
|
152
|
+
hook.hasUnsupportedRendererAttached = false;
|
|
153
|
+
const originalInject = hook.inject;
|
|
154
|
+
hook.inject = renderer => {
|
|
155
|
+
const id = originalInject(renderer);
|
|
156
|
+
allRenderers.add(renderer);
|
|
157
|
+
fiberRoots.set(id, new Set());
|
|
158
|
+
hook._instrumentationIsActive = true;
|
|
159
|
+
notifyActiveListeners();
|
|
160
|
+
return id;
|
|
161
|
+
};
|
|
162
|
+
const originalOnCommitFiberRoot = hook.onCommitFiberRoot;
|
|
163
|
+
hook.onCommitFiberRoot = (rendererID, root, priority) => {
|
|
164
|
+
if (!fiberRoots.has(rendererID)) {
|
|
165
|
+
fiberRoots.set(rendererID, new Set());
|
|
166
|
+
}
|
|
167
|
+
const roots = fiberRoots.get(rendererID);
|
|
168
|
+
if (roots) {
|
|
169
|
+
roots.add(root);
|
|
170
|
+
}
|
|
171
|
+
originalOnCommitFiberRoot(rendererID, root, priority);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// If renderers already exist, we're active - set them up now
|
|
175
|
+
if (hook.renderers.size) {
|
|
176
|
+
hook.renderers.forEach((renderer, id) => {
|
|
177
|
+
allRenderers.add(renderer);
|
|
178
|
+
if (!fiberRoots.has(id)) {
|
|
179
|
+
fiberRoots.set(id, new Set());
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
hook._instrumentationIsActive = true;
|
|
183
|
+
notifyActiveListeners();
|
|
184
|
+
}
|
|
185
|
+
} catch {
|
|
186
|
+
// Ignore patching errors
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function getDevToolsHook(onActive) {
|
|
190
|
+
if (!hasDevToolsHook()) {
|
|
191
|
+
return installDevToolsHook(onActive);
|
|
192
|
+
}
|
|
193
|
+
patchDevToolsHook(onActive);
|
|
194
|
+
return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
195
|
+
}
|
|
196
|
+
export function safelyInstallDevToolsHook() {
|
|
197
|
+
try {
|
|
198
|
+
if (isClientEnvironment()) {
|
|
199
|
+
getDevToolsHook();
|
|
200
|
+
}
|
|
201
|
+
} catch {
|
|
202
|
+
// Ignore installation errors
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
export function isReactDetected() {
|
|
206
|
+
const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
207
|
+
return Boolean(hook && (hook.renderers.size > 0 || hook._instrumentationIsActive));
|
|
208
|
+
}
|
|
209
|
+
export function getRenderers() {
|
|
210
|
+
const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
211
|
+
return hook?.renderers ?? new Map();
|
|
212
|
+
}
|
|
213
|
+
export function getAllFiberRoots() {
|
|
214
|
+
const roots = [];
|
|
215
|
+
for (const rootSet of fiberRoots.values()) {
|
|
216
|
+
roots.push(...rootSet);
|
|
217
|
+
}
|
|
218
|
+
return roots;
|
|
219
|
+
}
|
|
220
|
+
export function onReactDetected(callback) {
|
|
221
|
+
if (isReactDetected()) {
|
|
222
|
+
callback();
|
|
223
|
+
}
|
|
224
|
+
onActiveListeners.add(callback);
|
|
225
|
+
return () => {
|
|
226
|
+
onActiveListeners.delete(callback);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
export function onCommitFiberRoot(handler) {
|
|
230
|
+
const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
231
|
+
if (!hook) {
|
|
232
|
+
return () => {};
|
|
233
|
+
}
|
|
234
|
+
const originalHandler = hook.onCommitFiberRoot;
|
|
235
|
+
hook.onCommitFiberRoot = (rendererID, root, priority) => {
|
|
236
|
+
originalHandler(rendererID, root, priority);
|
|
237
|
+
handler(rendererID, root, priority ?? undefined);
|
|
238
|
+
};
|
|
239
|
+
return () => {
|
|
240
|
+
hook.onCommitFiberRoot = originalHandler;
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function notifyActiveListeners() {
|
|
244
|
+
for (const listener of onActiveListeners) {
|
|
245
|
+
try {
|
|
246
|
+
listener();
|
|
247
|
+
} catch {
|
|
248
|
+
// Ignore listener errors
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=DevtoolsHook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DevtoolsHook.js","names":["OSDK_INSTRUMENTATION_STRING","NO_OP","checkDCE","fn","code","Function","prototype","toString","call","indexOf","setTimeout","Error","allRenderers","Set","onActiveListeners","fiberRoots","Map","isClientEnvironment","window","document","createElement","navigator","product","hasDevToolsHook","Object","hasOwnProperty","globalThis","installDevToolsHook","onActive","renderers","nextId","hook","_instrumentationIsActive","_instrumentationSource","hasUnsupportedRendererAttached","inject","renderer","id","set","add","notifyActiveListeners","on","onCommitFiberRoot","rendererID","root","roots","get","onCommitFiberUnmount","onPostCommitFiberRoot","supportsFiber","supportsFlight","defineProperty","configurable","enumerable","newHook","ourRenderers","size","forEach","patchDevToolsHook","hasRunHack","writable","value","prop","__REACT_DEVTOOLS_GLOBAL_HOOK__","undefined","originalInject","originalOnCommitFiberRoot","priority","has","getDevToolsHook","safelyInstallDevToolsHook","isReactDetected","Boolean","getRenderers","getAllFiberRoots","rootSet","values","push","onReactDetected","callback","delete","handler","originalHandler","listener"],"sources":["DevtoolsHook.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n FiberRoot,\n ReactDevToolsGlobalHook,\n ReactRenderer,\n} from \"./types.js\";\n\nconst OSDK_INSTRUMENTATION_STRING = \"osdk-devtools\";\n\nconst NO_OP = () => {\n /* no-op */\n};\n\nconst checkDCE = (fn: unknown): void => {\n try {\n const code = Function.prototype.toString.call(fn);\n if (code.indexOf(\"^_^\") > -1) {\n setTimeout(() => {\n throw new Error(\n \"React is running in production mode, but dead code \"\n + \"elimination has not been applied. Read how to correctly \"\n + \"configure React for production: \"\n + \"https://reactjs.org/link/perf-use-production-build\",\n );\n });\n }\n } catch {\n // Ignore errors in DCE check\n }\n};\n\nconst allRenderers = new Set<ReactRenderer>();\nconst onActiveListeners = new Set<() => void>();\nconst fiberRoots = new Map<number, Set<FiberRoot>>();\n\nfunction isClientEnvironment(): boolean {\n return (\n typeof window !== \"undefined\"\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- Browser detection pattern from React DevTools\n && (typeof window.document?.createElement === \"function\"\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- ReactNative detection pattern\n || window.navigator?.product === \"ReactNative\")\n );\n}\n\nfunction hasDevToolsHook(): boolean {\n return Object.prototype.hasOwnProperty.call(\n globalThis,\n \"__REACT_DEVTOOLS_GLOBAL_HOOK__\",\n );\n}\n\nfunction installDevToolsHook(\n onActive?: () => void,\n): ReactDevToolsGlobalHook {\n const renderers = new Map<number, ReactRenderer>();\n let nextId = 0;\n\n let hook: ReactDevToolsGlobalHook = {\n _instrumentationIsActive: false,\n _instrumentationSource: OSDK_INSTRUMENTATION_STRING,\n checkDCE,\n hasUnsupportedRendererAttached: false,\n inject(renderer) {\n const id = ++nextId;\n renderers.set(id, renderer);\n allRenderers.add(renderer);\n\n fiberRoots.set(id, new Set());\n\n if (!hook._instrumentationIsActive) {\n hook._instrumentationIsActive = true;\n notifyActiveListeners();\n }\n return id;\n },\n on: NO_OP,\n onCommitFiberRoot(rendererID, root, _priority) {\n const roots = fiberRoots.get(rendererID);\n if (roots) {\n roots.add(root);\n }\n },\n onCommitFiberUnmount: NO_OP,\n onPostCommitFiberRoot: NO_OP,\n renderers,\n supportsFiber: true,\n supportsFlight: true,\n };\n\n try {\n Object.defineProperty(globalThis, \"__REACT_DEVTOOLS_GLOBAL_HOOK__\", {\n configurable: true,\n enumerable: true,\n get() {\n return hook;\n },\n set(newHook) {\n if (newHook && typeof newHook === \"object\") {\n const ourRenderers = hook.renderers;\n\n hook = newHook as ReactDevToolsGlobalHook;\n if (ourRenderers.size > 0) {\n ourRenderers.forEach((renderer, id) => {\n allRenderers.add(renderer);\n (newHook as ReactDevToolsGlobalHook).renderers.set(id, renderer);\n });\n patchDevToolsHook(onActive);\n }\n }\n },\n });\n\n // Chrome extension compatibility hack\n // https://github.com/facebook/react/blob/main/packages/react-devtools-extensions/src/contentScripts/installHook.js\n let hasRunHack = false;\n\n Object.defineProperty(window, \"hasOwnProperty\", {\n configurable: true,\n writable: true,\n value: function(\n this: unknown,\n prop: PropertyKey,\n ): boolean | number {\n try {\n if (!hasRunHack && prop === \"__REACT_DEVTOOLS_GLOBAL_HOOK__\") {\n globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__ = undefined;\n hasRunHack = true;\n // Chrome DevTools extension compatibility: returns -0 (falsy, non-boolean)\n // so the extension detects a race condition and re-installs its own hook.\n // See: https://github.com/facebook/react/blob/main/packages/react-devtools-extensions/src/contentScripts/installHook.js\n return -0;\n }\n } catch {\n // Ignore errors in hack\n }\n return Object.prototype.hasOwnProperty.call(this, prop);\n },\n });\n } catch {\n // If property definition fails, try to patch existing hook\n patchDevToolsHook(onActive);\n }\n\n if (onActive) {\n onActiveListeners.add(onActive);\n }\n\n return hook;\n}\n\nfunction patchDevToolsHook(onActive?: () => void): void {\n if (onActive) {\n onActiveListeners.add(onActive);\n }\n\n try {\n const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n if (!hook) {\n return;\n }\n\n if (hook._instrumentationSource === OSDK_INSTRUMENTATION_STRING) {\n if (hook.renderers.size || hook._instrumentationIsActive) {\n onActive?.();\n }\n return;\n }\n\n // Mark as patched\n hook._instrumentationSource = OSDK_INSTRUMENTATION_STRING;\n hook._instrumentationIsActive = false;\n hook.supportsFiber = true;\n hook.supportsFlight = true;\n hook.hasUnsupportedRendererAttached = false;\n\n const originalInject = hook.inject;\n hook.inject = (renderer) => {\n const id = originalInject(renderer);\n allRenderers.add(renderer);\n fiberRoots.set(id, new Set());\n hook._instrumentationIsActive = true;\n notifyActiveListeners();\n return id;\n };\n\n const originalOnCommitFiberRoot = hook.onCommitFiberRoot;\n hook.onCommitFiberRoot = (rendererID, root, priority) => {\n if (!fiberRoots.has(rendererID)) {\n fiberRoots.set(rendererID, new Set());\n }\n const roots = fiberRoots.get(rendererID);\n if (roots) {\n roots.add(root);\n }\n originalOnCommitFiberRoot(rendererID, root, priority);\n };\n\n // If renderers already exist, we're active - set them up now\n if (hook.renderers.size) {\n hook.renderers.forEach((renderer, id) => {\n allRenderers.add(renderer);\n if (!fiberRoots.has(id)) {\n fiberRoots.set(id, new Set());\n }\n });\n hook._instrumentationIsActive = true;\n notifyActiveListeners();\n }\n } catch {\n // Ignore patching errors\n }\n}\n\nfunction getDevToolsHook(\n onActive?: () => void,\n): ReactDevToolsGlobalHook {\n if (!hasDevToolsHook()) {\n return installDevToolsHook(onActive);\n }\n\n patchDevToolsHook(onActive);\n return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__ as ReactDevToolsGlobalHook;\n}\n\nexport function safelyInstallDevToolsHook(): void {\n try {\n if (isClientEnvironment()) {\n getDevToolsHook();\n }\n } catch {\n // Ignore installation errors\n }\n}\n\nexport function isReactDetected(): boolean {\n const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n return Boolean(\n hook && (hook.renderers.size > 0 || hook._instrumentationIsActive),\n );\n}\n\nexport function getRenderers(): Map<number, ReactRenderer> {\n const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n return hook?.renderers ?? new Map();\n}\n\nexport function getAllFiberRoots(): FiberRoot[] {\n const roots: FiberRoot[] = [];\n for (const rootSet of fiberRoots.values()) {\n roots.push(...rootSet);\n }\n return roots;\n}\n\nexport function onReactDetected(callback: () => void): () => void {\n if (isReactDetected()) {\n callback();\n }\n onActiveListeners.add(callback);\n return () => {\n onActiveListeners.delete(callback);\n };\n}\n\nexport function onCommitFiberRoot(\n handler: (\n rendererID: number,\n root: FiberRoot,\n priority: number | undefined,\n ) => void,\n): () => void {\n const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n if (!hook) {\n return () => {};\n }\n\n const originalHandler = hook.onCommitFiberRoot;\n hook.onCommitFiberRoot = (rendererID, root, priority) => {\n originalHandler(rendererID, root, priority);\n handler(rendererID, root, priority ?? undefined);\n };\n\n return () => {\n hook.onCommitFiberRoot = originalHandler;\n };\n}\n\nfunction notifyActiveListeners(): void {\n for (const listener of onActiveListeners) {\n try {\n listener();\n } catch {\n // Ignore listener errors\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,MAAMA,2BAA2B,GAAG,eAAe;AAEnD,MAAMC,KAAK,GAAGA,CAAA,KAAM;EAClB;AAAA,CACD;AAED,MAAMC,QAAQ,GAAIC,EAAW,IAAW;EACtC,IAAI;IACF,MAAMC,IAAI,GAAGC,QAAQ,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACL,EAAE,CAAC;IACjD,IAAIC,IAAI,CAACK,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE;MAC5BC,UAAU,CAAC,MAAM;QACf,MAAM,IAAIC,KAAK,CACb,qDAAqD,GACjD,0DAA0D,GAC1D,kCAAkC,GAClC,oDAC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CAAC;AACH;AAEA,OAAO,SAASrC,iBAAiBA,CAC/BuC,OAIS,EACG;EACZ,MAAMlD,IAAI,GAAGL,UAAU,CAACqC,8BAA8B;EACtD,IAAI,CAAChC,IAAI,EAAE;IACT,OAAO,MAAM,CAAC,CAAC;EACjB;EAEA,MAAMmD,eAAe,GAAGnD,IAAI,CAACW,iBAAiB;EAC9CX,IAAI,CAACW,iBAAiB,GAAG,CAACC,UAAU,EAAEC,IAAI,EAAEuB,QAAQ,KAAK;IACvDe,eAAe,CAACvC,UAAU,EAAEC,IAAI,EAAEuB,QAAQ,CAAC;IAC3Cc,OAAO,CAACtC,UAAU,EAAEC,IAAI,EAAEuB,QAAQ,IAAIH,SAAS,CAAC;EAClD,CAAC;EAED,OAAO,MAAM;IACXjC,IAAI,CAACW,iBAAiB,GAAGwC,eAAe;EAC1C,CAAC;AACH;AAEA,SAAS1C,qBAAqBA,CAAA,EAAS;EACrC,KAAK,MAAM2C,QAAQ,IAAIrE,iBAAiB,EAAE;IACxC,IAAI;MACFqE,QAAQ,CAAC,CAAC;IACZ,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { getRenderers } from "./DevtoolsHook.js";
|
|
18
|
+
import { safeFiberOperation } from "./SafeFiberOperation.js";
|
|
19
|
+
function isValidFiber(value) {
|
|
20
|
+
return typeof value === "object" && value != null && "tag" in value && "stateNode" in value && "return" in value && "child" in value && "sibling" in value && "flags" in value;
|
|
21
|
+
}
|
|
22
|
+
export function getFiberFromElement(element) {
|
|
23
|
+
return safeFiberOperation(() => getFiberFromElementUnsafe(element), {
|
|
24
|
+
fallback: null,
|
|
25
|
+
feature: "component-inspection"
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function getFiberFromElementUnsafe(element) {
|
|
29
|
+
const renderers = getRenderers();
|
|
30
|
+
for (const renderer of renderers.values()) {
|
|
31
|
+
if (renderer.findFiberByHostInstance) {
|
|
32
|
+
const fiber = renderer.findFiberByHostInstance(element);
|
|
33
|
+
if (fiber && isValidFiber(fiber)) {
|
|
34
|
+
return fiber;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const legacyRoot = element._reactRootContainer;
|
|
39
|
+
if (legacyRoot?._internalRoot?.current?.child) {
|
|
40
|
+
const fiber = legacyRoot._internalRoot.current.child;
|
|
41
|
+
if (isValidFiber(fiber)) {
|
|
42
|
+
return fiber;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const fiber = findFiberFromInternalProperties(element);
|
|
46
|
+
if (fiber) {
|
|
47
|
+
return fiber;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const REACT_KEY_PREFIXES = ["__reactFiber$", "__reactInternalInstance$", "__reactContainer$"];
|
|
52
|
+
function findFiberFromInternalProperties(element) {
|
|
53
|
+
for (const key in element) {
|
|
54
|
+
for (const prefix of REACT_KEY_PREFIXES) {
|
|
55
|
+
if (key.startsWith(prefix)) {
|
|
56
|
+
const value = element[key];
|
|
57
|
+
if (isValidFiber(value)) {
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=FiberAccess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FiberAccess.js","names":["getRenderers","safeFiberOperation","isValidFiber","value","getFiberFromElement","element","getFiberFromElementUnsafe","fallback","feature","renderers","renderer","values","findFiberByHostInstance","fiber","legacyRoot","_reactRootContainer","_internalRoot","current","child","findFiberFromInternalProperties","REACT_KEY_PREFIXES","key","prefix","startsWith"],"sources":["FiberAccess.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getRenderers } from \"./DevtoolsHook.js\";\nimport { safeFiberOperation } from \"./SafeFiberOperation.js\";\nimport type { Fiber } from \"./types.js\";\n\nfunction isValidFiber(value: unknown): value is Fiber {\n return (\n typeof value === \"object\"\n && value != null\n && \"tag\" in value\n && \"stateNode\" in value\n && \"return\" in value\n && \"child\" in value\n && \"sibling\" in value\n && \"flags\" in value\n );\n}\n\nexport function getFiberFromElement(element: Element): Fiber | null {\n return safeFiberOperation(\n () => getFiberFromElementUnsafe(element),\n { fallback: null, feature: \"component-inspection\" },\n );\n}\n\nfunction getFiberFromElementUnsafe(element: Element): Fiber | null {\n const renderers = getRenderers();\n for (const renderer of renderers.values()) {\n if (renderer.findFiberByHostInstance) {\n const fiber = renderer.findFiberByHostInstance(element);\n if (fiber && isValidFiber(fiber)) {\n return fiber;\n }\n }\n }\n\n const legacyRoot = (element as unknown as Record<string, unknown>)\n ._reactRootContainer as\n | { _internalRoot?: { current?: { child?: unknown } } }\n | undefined;\n if (legacyRoot?._internalRoot?.current?.child) {\n const fiber = legacyRoot._internalRoot.current.child;\n if (isValidFiber(fiber)) {\n return fiber;\n }\n }\n\n const fiber = findFiberFromInternalProperties(element);\n if (fiber) {\n return fiber;\n }\n\n return null;\n}\n\nconst REACT_KEY_PREFIXES = [\n \"__reactFiber$\",\n \"__reactInternalInstance$\",\n \"__reactContainer$\",\n] as const;\n\nfunction findFiberFromInternalProperties(element: Element): Fiber | null {\n for (const key in element) {\n for (const prefix of REACT_KEY_PREFIXES) {\n if (key.startsWith(prefix)) {\n const value = (element as unknown as Record<string, unknown>)[key];\n if (isValidFiber(value)) {\n return value;\n }\n }\n }\n }\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,mBAAmB;AAChD,SAASC,kBAAkB,QAAQ,yBAAyB;AAG5D,SAASC,YAAYA,CAACC,KAAc,EAAkB;EACpD,OACE,OAAOA,KAAK,KAAK,QAAQ,IACtBA,KAAK,IAAI,IAAI,IACb,KAAK,IAAIA,KAAK,IACd,WAAW,IAAIA,KAAK,IACpB,QAAQ,IAAIA,KAAK,IACjB,OAAO,IAAIA,KAAK,IAChB,SAAS,IAAIA,KAAK,IAClB,OAAO,IAAIA,KAAK;AAEvB;AAEA,OAAO,SAASC,mBAAmBA,CAACC,OAAgB,EAAgB;EAClE,OAAOJ,kBAAkB,CACvB,MAAMK,yBAAyB,CAACD,OAAO,CAAC,EACxC;IAAEE,QAAQ,EAAE,IAAI;IAAEC,OAAO,EAAE;EAAuB,CACpD,CAAC;AACH;AAEA,SAASF,yBAAyBA,CAACD,OAAgB,EAAgB;EACjE,MAAMI,SAAS,GAAGT,YAAY,CAAC,CAAC;EAChC,KAAK,MAAMU,QAAQ,IAAID,SAAS,CAACE,MAAM,CAAC,CAAC,EAAE;IACzC,IAAID,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