@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,167 @@
|
|
|
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 React from "react";
|
|
18
|
+
import { DEFAULT_CONVERGENCE_THRESHOLD, interpolate, INTERPOLATION_FACTORS } from "../utils/interpolation.js";
|
|
19
|
+
class AnimationBoundsStore {
|
|
20
|
+
current = null;
|
|
21
|
+
animationFrameId = null;
|
|
22
|
+
listeners = new Set();
|
|
23
|
+
hasRenderedOnce = false;
|
|
24
|
+
constructor(targetBounds, interpolationFactor, convergenceThreshold, enabled) {
|
|
25
|
+
this.targetBounds = targetBounds;
|
|
26
|
+
this.interpolationFactor = interpolationFactor;
|
|
27
|
+
this.convergenceThreshold = convergenceThreshold;
|
|
28
|
+
this.enabled = enabled;
|
|
29
|
+
this.current = {
|
|
30
|
+
x: targetBounds.x,
|
|
31
|
+
y: targetBounds.y,
|
|
32
|
+
width: targetBounds.width,
|
|
33
|
+
height: targetBounds.height
|
|
34
|
+
};
|
|
35
|
+
this.hasRenderedOnce = true;
|
|
36
|
+
if (enabled) {
|
|
37
|
+
this.startAnimation();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
subscribe = onStoreChange => {
|
|
41
|
+
this.listeners.add(onStoreChange);
|
|
42
|
+
return () => {
|
|
43
|
+
this.listeners.delete(onStoreChange);
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
getSnapshot = () => {
|
|
47
|
+
return this.current;
|
|
48
|
+
};
|
|
49
|
+
updateTarget(targetBounds, interpolationFactor, convergenceThreshold, enabled) {
|
|
50
|
+
this.targetBounds = targetBounds;
|
|
51
|
+
this.interpolationFactor = interpolationFactor;
|
|
52
|
+
this.convergenceThreshold = convergenceThreshold;
|
|
53
|
+
this.enabled = enabled;
|
|
54
|
+
if (!this.hasRenderedOnce || !enabled) {
|
|
55
|
+
this.cancelAnimation();
|
|
56
|
+
this.current = {
|
|
57
|
+
x: targetBounds.x,
|
|
58
|
+
y: targetBounds.y,
|
|
59
|
+
width: targetBounds.width,
|
|
60
|
+
height: targetBounds.height
|
|
61
|
+
};
|
|
62
|
+
this.hasRenderedOnce = true;
|
|
63
|
+
this.notify();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.cancelAnimation();
|
|
67
|
+
this.startAnimation();
|
|
68
|
+
}
|
|
69
|
+
dispose() {
|
|
70
|
+
this.cancelAnimation();
|
|
71
|
+
this.listeners.clear();
|
|
72
|
+
}
|
|
73
|
+
startAnimation() {
|
|
74
|
+
const animate = () => {
|
|
75
|
+
const targetX = this.targetBounds.x;
|
|
76
|
+
const targetY = this.targetBounds.y;
|
|
77
|
+
const targetWidth = this.targetBounds.width;
|
|
78
|
+
const targetHeight = this.targetBounds.height;
|
|
79
|
+
if (!this.current) {
|
|
80
|
+
this.current = {
|
|
81
|
+
x: targetX,
|
|
82
|
+
y: targetY,
|
|
83
|
+
width: targetWidth,
|
|
84
|
+
height: targetHeight
|
|
85
|
+
};
|
|
86
|
+
this.animationFrameId = null;
|
|
87
|
+
this.notify();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const nextX = interpolate(this.current.x, targetX, this.interpolationFactor);
|
|
91
|
+
const nextY = interpolate(this.current.y, targetY, this.interpolationFactor);
|
|
92
|
+
const nextWidth = interpolate(this.current.width, targetWidth, this.interpolationFactor);
|
|
93
|
+
const nextHeight = interpolate(this.current.height, targetHeight, this.interpolationFactor);
|
|
94
|
+
const hasConverged = Math.abs(nextX - targetX) < this.convergenceThreshold && Math.abs(nextY - targetY) < this.convergenceThreshold && Math.abs(nextWidth - targetWidth) < this.convergenceThreshold && Math.abs(nextHeight - targetHeight) < this.convergenceThreshold;
|
|
95
|
+
if (hasConverged) {
|
|
96
|
+
this.current = {
|
|
97
|
+
x: targetX,
|
|
98
|
+
y: targetY,
|
|
99
|
+
width: targetWidth,
|
|
100
|
+
height: targetHeight
|
|
101
|
+
};
|
|
102
|
+
this.animationFrameId = null;
|
|
103
|
+
} else {
|
|
104
|
+
this.current = {
|
|
105
|
+
x: nextX,
|
|
106
|
+
y: nextY,
|
|
107
|
+
width: nextWidth,
|
|
108
|
+
height: nextHeight
|
|
109
|
+
};
|
|
110
|
+
this.animationFrameId = requestAnimationFrame(animate);
|
|
111
|
+
}
|
|
112
|
+
this.notify();
|
|
113
|
+
};
|
|
114
|
+
this.animationFrameId = requestAnimationFrame(animate);
|
|
115
|
+
}
|
|
116
|
+
cancelAnimation() {
|
|
117
|
+
if (this.animationFrameId != null) {
|
|
118
|
+
cancelAnimationFrame(this.animationFrameId);
|
|
119
|
+
this.animationFrameId = null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
notify() {
|
|
123
|
+
for (const listener of this.listeners) {
|
|
124
|
+
listener();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export function useAnimatedBounds(targetBounds, options = {}) {
|
|
129
|
+
const {
|
|
130
|
+
interpolationFactor = INTERPOLATION_FACTORS.selection,
|
|
131
|
+
convergenceThreshold = DEFAULT_CONVERGENCE_THRESHOLD,
|
|
132
|
+
enabled = true
|
|
133
|
+
} = options;
|
|
134
|
+
const storeRef = React.useRef(null);
|
|
135
|
+
if (targetBounds) {
|
|
136
|
+
if (storeRef.current) {
|
|
137
|
+
storeRef.current.updateTarget(targetBounds, interpolationFactor, convergenceThreshold, enabled);
|
|
138
|
+
} else {
|
|
139
|
+
storeRef.current = new AnimationBoundsStore(targetBounds, interpolationFactor, convergenceThreshold, enabled);
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
if (storeRef.current) {
|
|
143
|
+
storeRef.current.dispose();
|
|
144
|
+
storeRef.current = null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Deps use `targetBounds == null` (boolean) so callbacks only change when
|
|
149
|
+
// transitioning between null/non-null, not on every bounds update.
|
|
150
|
+
// The store handles internal updates via its own subscription mechanism.
|
|
151
|
+
const subscribe = React.useCallback(onStoreChange => {
|
|
152
|
+
const store = storeRef.current;
|
|
153
|
+
if (!store) {
|
|
154
|
+
return () => {};
|
|
155
|
+
}
|
|
156
|
+
return store.subscribe(onStoreChange);
|
|
157
|
+
}, [targetBounds == null]);
|
|
158
|
+
const getSnapshot = React.useCallback(() => {
|
|
159
|
+
const store = storeRef.current;
|
|
160
|
+
if (!store) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
return store.getSnapshot();
|
|
164
|
+
}, [targetBounds == null]);
|
|
165
|
+
return React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=useAnimatedBounds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnimatedBounds.js","names":["React","DEFAULT_CONVERGENCE_THRESHOLD","interpolate","INTERPOLATION_FACTORS","AnimationBoundsStore","current","animationFrameId","listeners","Set","hasRenderedOnce","constructor","targetBounds","interpolationFactor","convergenceThreshold","enabled","x","y","width","height","startAnimation","subscribe","onStoreChange","add","delete","getSnapshot","updateTarget","cancelAnimation","notify","dispose","clear","animate","targetX","targetY","targetWidth","targetHeight","nextX","nextY","nextWidth","nextHeight","hasConverged","Math","abs","requestAnimationFrame","cancelAnimationFrame","listener","useAnimatedBounds","options","selection","storeRef","useRef","useCallback","store","useSyncExternalStore"],"sources":["useAnimatedBounds.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 React from \"react\";\nimport type {\n AnimatedBounds,\n AnimationOptions,\n OverlayBounds,\n} from \"../types.js\";\nimport {\n DEFAULT_CONVERGENCE_THRESHOLD,\n interpolate,\n INTERPOLATION_FACTORS,\n} from \"../utils/interpolation.js\";\n\nclass AnimationBoundsStore {\n private current: AnimatedBounds | null = null;\n private animationFrameId: number | null = null;\n private listeners: Set<() => void> = new Set();\n private hasRenderedOnce = false;\n\n constructor(\n private targetBounds: OverlayBounds,\n private interpolationFactor: number,\n private convergenceThreshold: number,\n private enabled: boolean,\n ) {\n this.current = {\n x: targetBounds.x,\n y: targetBounds.y,\n width: targetBounds.width,\n height: targetBounds.height,\n };\n this.hasRenderedOnce = true;\n\n if (enabled) {\n this.startAnimation();\n }\n }\n\n subscribe = (onStoreChange: () => void): () => void => {\n this.listeners.add(onStoreChange);\n return () => {\n this.listeners.delete(onStoreChange);\n };\n };\n\n getSnapshot = (): AnimatedBounds | null => {\n return this.current;\n };\n\n updateTarget(\n targetBounds: OverlayBounds,\n interpolationFactor: number,\n convergenceThreshold: number,\n enabled: boolean,\n ): void {\n this.targetBounds = targetBounds;\n this.interpolationFactor = interpolationFactor;\n this.convergenceThreshold = convergenceThreshold;\n this.enabled = enabled;\n\n if (!this.hasRenderedOnce || !enabled) {\n this.cancelAnimation();\n this.current = {\n x: targetBounds.x,\n y: targetBounds.y,\n width: targetBounds.width,\n height: targetBounds.height,\n };\n this.hasRenderedOnce = true;\n this.notify();\n return;\n }\n\n this.cancelAnimation();\n this.startAnimation();\n }\n\n dispose(): void {\n this.cancelAnimation();\n this.listeners.clear();\n }\n\n private startAnimation(): void {\n const animate = () => {\n const targetX = this.targetBounds.x;\n const targetY = this.targetBounds.y;\n const targetWidth = this.targetBounds.width;\n const targetHeight = this.targetBounds.height;\n\n if (!this.current) {\n this.current = {\n x: targetX,\n y: targetY,\n width: targetWidth,\n height: targetHeight,\n };\n this.animationFrameId = null;\n this.notify();\n return;\n }\n\n const nextX = interpolate(\n this.current.x,\n targetX,\n this.interpolationFactor,\n );\n const nextY = interpolate(\n this.current.y,\n targetY,\n this.interpolationFactor,\n );\n const nextWidth = interpolate(\n this.current.width,\n targetWidth,\n this.interpolationFactor,\n );\n const nextHeight = interpolate(\n this.current.height,\n targetHeight,\n this.interpolationFactor,\n );\n\n const hasConverged = Math.abs(nextX - targetX) < this.convergenceThreshold\n && Math.abs(nextY - targetY) < this.convergenceThreshold\n && Math.abs(nextWidth - targetWidth) < this.convergenceThreshold\n && Math.abs(nextHeight - targetHeight) < this.convergenceThreshold;\n\n if (hasConverged) {\n this.current = {\n x: targetX,\n y: targetY,\n width: targetWidth,\n height: targetHeight,\n };\n this.animationFrameId = null;\n } else {\n this.current = {\n x: nextX,\n y: nextY,\n width: nextWidth,\n height: nextHeight,\n };\n this.animationFrameId = requestAnimationFrame(animate);\n }\n this.notify();\n };\n\n this.animationFrameId = requestAnimationFrame(animate);\n }\n\n private cancelAnimation(): void {\n if (this.animationFrameId != null) {\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n }\n }\n\n private notify(): void {\n for (const listener of this.listeners) {\n listener();\n }\n }\n}\n\nexport function useAnimatedBounds(\n targetBounds: OverlayBounds | null,\n options: AnimationOptions = {},\n): AnimatedBounds | null {\n const {\n interpolationFactor = INTERPOLATION_FACTORS.selection,\n convergenceThreshold = DEFAULT_CONVERGENCE_THRESHOLD,\n enabled = true,\n } = options;\n\n const storeRef = React.useRef<AnimationBoundsStore | null>(null);\n\n if (targetBounds) {\n if (storeRef.current) {\n storeRef.current.updateTarget(\n targetBounds,\n interpolationFactor,\n convergenceThreshold,\n enabled,\n );\n } else {\n storeRef.current = new AnimationBoundsStore(\n targetBounds,\n interpolationFactor,\n convergenceThreshold,\n enabled,\n );\n }\n } else {\n if (storeRef.current) {\n storeRef.current.dispose();\n storeRef.current = null;\n }\n }\n\n // Deps use `targetBounds == null` (boolean) so callbacks only change when\n // transitioning between null/non-null, not on every bounds update.\n // The store handles internal updates via its own subscription mechanism.\n const subscribe = React.useCallback((onStoreChange: () => void) => {\n const store = storeRef.current;\n if (!store) {\n return () => {};\n }\n return store.subscribe(onStoreChange);\n }, [targetBounds == null]);\n\n const getSnapshot = React.useCallback((): AnimatedBounds | null => {\n const store = storeRef.current;\n if (!store) {\n return null;\n }\n return store.getSnapshot();\n }, [targetBounds == null]);\n\n return React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAMzB,SACEC,6BAA6B,EAC7BC,WAAW,EACXC,qBAAqB,QAChB,2BAA2B;AAElC,MAAMC,oBAAoB,CAAC;EACjBC,OAAO,GAA0B,IAAI;EACrCC,gBAAgB,GAAkB,IAAI;EACtCC,SAAS,GAAoB,IAAIC,GAAG,CAAC,CAAC;EACtCC,eAAe,GAAG,KAAK;EAE/BC,WAAWA,CACDC,YAA2B,EAC3BC,mBAA2B,EAC3BC,oBAA4B,EAC5B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A6B;IACjE,MAAMC,KAAK,GAAGH,QAAQ,CAAC3C,OAAO;IAC9B,IAAI,CAAC8C,KAAK,EAAE;MACV,OAAO,IAAI;IACb;IACA,OAAOA,KAAK,CAAC3B,WAAW,CAAC,CAAC;EAC5B,CAAC,EAAE,CAACb,YAAY,IAAI,IAAI,CAAC,CAAC;EAE1B,OAAOX,KAAK,CAACoD,oBAAoB,CAAChC,SAAS,EAAEI,WAAW,EAAEA,WAAW,CAAC;AACxE","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
// Types
|
|
18
|
+
|
|
19
|
+
// Components
|
|
20
|
+
export { ComponentLabel } from "./components/ComponentLabel.js";
|
|
21
|
+
export { InspectorBanner } from "./components/InspectorBanner.js";
|
|
22
|
+
export { InspectorOverlay } from "./components/InspectorOverlay.js";
|
|
23
|
+
export { SelectionHighlight } from "./components/SelectionHighlight.js";
|
|
24
|
+
|
|
25
|
+
// Hooks
|
|
26
|
+
export { useAnimatedBounds } from "./hooks/useAnimatedBounds.js";
|
|
27
|
+
|
|
28
|
+
// Controller
|
|
29
|
+
export { createInspectorController } from "./inspectorController.js";
|
|
30
|
+
|
|
31
|
+
// Orchestrator
|
|
32
|
+
export { ClickToInspectSystem } from "./ClickToInspectSystem.js";
|
|
33
|
+
// Factory
|
|
34
|
+
export { createClickToInspect } from "./createClickToInspect.js";
|
|
35
|
+
|
|
36
|
+
// Utilities
|
|
37
|
+
export { createElementBounds, getElementAtPosition } from "./utils/elementBounds.js";
|
|
38
|
+
export { DEFAULT_CONVERGENCE_THRESHOLD, interpolate, INTERPOLATION_FACTORS } from "./utils/interpolation.js";
|
|
39
|
+
export { computeLabelPosition, OFFSCREEN_POSITION } from "./utils/labelPositioning.js";
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentLabel","InspectorBanner","InspectorOverlay","SelectionHighlight","useAnimatedBounds","createInspectorController","ClickToInspectSystem","createClickToInspect","createElementBounds","getElementAtPosition","DEFAULT_CONVERGENCE_THRESHOLD","interpolate","INTERPOLATION_FACTORS","computeLabelPosition","OFFSCREEN_POSITION"],"sources":["index.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\n// Types\nexport type {\n AnimatedBounds,\n AnimationOptions,\n ComponentLabelProps,\n HighlightVariant,\n InspectedComponent,\n InspectorController,\n InspectorEventHandlers,\n InspectorMode,\n InspectorOptions,\n InspectorOverlayProps,\n InspectorState,\n LabelPosition,\n OverlayBounds,\n SelectionHighlightProps,\n SelectionLabelStatus,\n} from \"./types.js\";\n\n// Components\nexport { ComponentLabel } from \"./components/ComponentLabel.js\";\nexport { InspectorBanner } from \"./components/InspectorBanner.js\";\nexport { InspectorOverlay } from \"./components/InspectorOverlay.js\";\nexport { SelectionHighlight } from \"./components/SelectionHighlight.js\";\n\n// Hooks\nexport { useAnimatedBounds } from \"./hooks/useAnimatedBounds.js\";\n\n// Controller\nexport { createInspectorController } from \"./inspectorController.js\";\n\n// Orchestrator\nexport { ClickToInspectSystem } from \"./ClickToInspectSystem.js\";\nexport type { ClickToInspectOptions } from \"./ClickToInspectSystem.js\";\n\n// Factory\nexport { createClickToInspect } from \"./createClickToInspect.js\";\n\n// Utilities\nexport {\n createElementBounds,\n getElementAtPosition,\n} from \"./utils/elementBounds.js\";\nexport {\n DEFAULT_CONVERGENCE_THRESHOLD,\n interpolate,\n INTERPOLATION_FACTORS,\n} from \"./utils/interpolation.js\";\nexport {\n computeLabelPosition,\n OFFSCREEN_POSITION,\n} from \"./utils/labelPositioning.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAmBA;AACA,SAASA,cAAc,QAAQ,gCAAgC;AAC/D,SAASC,eAAe,QAAQ,iCAAiC;AACjE,SAASC,gBAAgB,QAAQ,kCAAkC;AACnE,SAASC,kBAAkB,QAAQ,oCAAoC;;AAEvE;AACA,SAASC,iBAAiB,QAAQ,8BAA8B;;AAEhE;AACA,SAASC,yBAAyB,QAAQ,0BAA0B;;AAEpE;AACA,SAASC,oBAAoB,QAAQ,2BAA2B;AAGhE;AACA,SAASC,oBAAoB,QAAQ,2BAA2B;;AAEhE;AACA,SACEC,mBAAmB,EACnBC,oBAAoB,QACf,0BAA0B;AACjC,SACEC,6BAA6B,EAC7BC,WAAW,EACXC,qBAAqB,QAChB,0BAA0B;AACjC,SACEC,oBAAoB,EACpBC,kBAAkB,QACb,6BAA6B","ignoreList":[]}
|
|
@@ -0,0 +1,328 @@
|
|
|
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 { getFiberFromElement } from "../fiber/FiberAccess.js";
|
|
18
|
+
import { getComponentName, getHookStates, getProps, getSourceLocation } from "../fiber/FiberInspection.js";
|
|
19
|
+
import { isUserComponent } from "../fiber/FiberTags.js";
|
|
20
|
+
import { findParentComponent } from "../fiber/traverseFiber.js";
|
|
21
|
+
import { createElementBounds, getElementAtPosition } from "./utils/elementBounds.js";
|
|
22
|
+
const OFFSCREEN_POSITION = -9999;
|
|
23
|
+
const DEFAULT_THROTTLE_MS = 32;
|
|
24
|
+
const DEFAULT_BOUNDS_REFRESH_INTERVAL_MS = 100;
|
|
25
|
+
function createInitialState() {
|
|
26
|
+
return {
|
|
27
|
+
mode: "inactive",
|
|
28
|
+
mouseX: OFFSCREEN_POSITION,
|
|
29
|
+
mouseY: OFFSCREEN_POSITION,
|
|
30
|
+
hoveredElement: null,
|
|
31
|
+
selectedElement: null,
|
|
32
|
+
frozenElement: null,
|
|
33
|
+
inspectedComponent: null,
|
|
34
|
+
selectionBounds: null,
|
|
35
|
+
labelPosition: null,
|
|
36
|
+
labelStatus: "idle",
|
|
37
|
+
viewportVersion: 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function extractComponentInfo(element, fiber) {
|
|
41
|
+
const name = getComponentName(fiber);
|
|
42
|
+
if (!name) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const sourceLocation = getSourceLocation(fiber);
|
|
46
|
+
const props = getProps(fiber);
|
|
47
|
+
const hookStates = getHookStates(fiber);
|
|
48
|
+
return {
|
|
49
|
+
name,
|
|
50
|
+
fiber: new WeakRef(fiber),
|
|
51
|
+
element: new WeakRef(element),
|
|
52
|
+
sourceLocation,
|
|
53
|
+
props,
|
|
54
|
+
hookCount: hookStates.length
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function createInspectorController(options = {}) {
|
|
58
|
+
const {
|
|
59
|
+
containerElement = document.body,
|
|
60
|
+
throttleMs = DEFAULT_THROTTLE_MS,
|
|
61
|
+
boundsRefreshIntervalMs = DEFAULT_BOUNDS_REFRESH_INTERVAL_MS,
|
|
62
|
+
eventHandlers = {}
|
|
63
|
+
} = options;
|
|
64
|
+
let state = createInitialState();
|
|
65
|
+
const listeners = new Set();
|
|
66
|
+
let lastElementDetectionTime = 0;
|
|
67
|
+
let boundsRefreshIntervalId = null;
|
|
68
|
+
let abortController = null;
|
|
69
|
+
function setState(partial) {
|
|
70
|
+
state = {
|
|
71
|
+
...state,
|
|
72
|
+
...partial
|
|
73
|
+
};
|
|
74
|
+
listeners.forEach(listener => listener(state));
|
|
75
|
+
}
|
|
76
|
+
function handleMouseMove(event) {
|
|
77
|
+
if (state.mode === "inactive" || state.mode === "frozen") {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const {
|
|
81
|
+
clientX,
|
|
82
|
+
clientY
|
|
83
|
+
} = event;
|
|
84
|
+
setState({
|
|
85
|
+
mouseX: clientX,
|
|
86
|
+
mouseY: clientY
|
|
87
|
+
});
|
|
88
|
+
const now = performance.now();
|
|
89
|
+
if (now - lastElementDetectionTime < throttleMs) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
lastElementDetectionTime = now;
|
|
93
|
+
detectElementAtPosition(clientX, clientY);
|
|
94
|
+
}
|
|
95
|
+
function detectElementAtPosition(clientX, clientY) {
|
|
96
|
+
const element = getElementAtPosition(clientX, clientY, "[data-osdk-devtools-ignore]");
|
|
97
|
+
if (!element) {
|
|
98
|
+
setState({
|
|
99
|
+
hoveredElement: null,
|
|
100
|
+
inspectedComponent: null,
|
|
101
|
+
selectionBounds: null,
|
|
102
|
+
labelStatus: "idle"
|
|
103
|
+
});
|
|
104
|
+
eventHandlers.onHover?.(null);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (element === state.hoveredElement) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const fiber = getFiberFromElement(element);
|
|
111
|
+
if (!fiber) {
|
|
112
|
+
setState({
|
|
113
|
+
hoveredElement: element,
|
|
114
|
+
inspectedComponent: null,
|
|
115
|
+
selectionBounds: createElementBounds(element),
|
|
116
|
+
labelStatus: "idle"
|
|
117
|
+
});
|
|
118
|
+
eventHandlers.onHover?.(null);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const componentFiber = isUserComponent(fiber) ? fiber : findParentComponent(fiber);
|
|
122
|
+
if (!componentFiber) {
|
|
123
|
+
setState({
|
|
124
|
+
hoveredElement: element,
|
|
125
|
+
inspectedComponent: null,
|
|
126
|
+
selectionBounds: createElementBounds(element),
|
|
127
|
+
labelStatus: "idle"
|
|
128
|
+
});
|
|
129
|
+
eventHandlers.onHover?.(null);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const componentInfo = extractComponentInfo(element, componentFiber);
|
|
133
|
+
setState({
|
|
134
|
+
hoveredElement: element,
|
|
135
|
+
inspectedComponent: componentInfo,
|
|
136
|
+
selectionBounds: createElementBounds(element),
|
|
137
|
+
labelStatus: "hover"
|
|
138
|
+
});
|
|
139
|
+
if (componentInfo) {
|
|
140
|
+
eventHandlers.onHover?.(componentInfo);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function handleClick(event) {
|
|
144
|
+
if (state.mode === "inactive") {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const target = event.target;
|
|
148
|
+
if (target.closest("[data-osdk-devtools-ignore]")) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
event.stopImmediatePropagation();
|
|
153
|
+
if (state.mode === "frozen") {
|
|
154
|
+
setState({
|
|
155
|
+
mode: "hover",
|
|
156
|
+
frozenElement: null,
|
|
157
|
+
labelStatus: "hover"
|
|
158
|
+
});
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (state.hoveredElement && state.inspectedComponent) {
|
|
162
|
+
setState({
|
|
163
|
+
mode: "frozen",
|
|
164
|
+
frozenElement: state.hoveredElement,
|
|
165
|
+
selectedElement: state.hoveredElement,
|
|
166
|
+
labelStatus: "selected"
|
|
167
|
+
});
|
|
168
|
+
eventHandlers.onSelect?.(state.inspectedComponent);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function handleKeyDown(event) {
|
|
172
|
+
if (state.mode === "inactive") {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (event.key === "Escape") {
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
event.stopImmediatePropagation();
|
|
178
|
+
if (state.mode === "frozen") {
|
|
179
|
+
setState({
|
|
180
|
+
mode: "hover",
|
|
181
|
+
frozenElement: null,
|
|
182
|
+
labelStatus: "hover"
|
|
183
|
+
});
|
|
184
|
+
} else {
|
|
185
|
+
deactivate();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function handleScroll() {
|
|
190
|
+
if (state.mode === "inactive") {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
setState({
|
|
194
|
+
viewportVersion: state.viewportVersion + 1
|
|
195
|
+
});
|
|
196
|
+
recalculateBounds();
|
|
197
|
+
}
|
|
198
|
+
function handleResize() {
|
|
199
|
+
if (state.mode === "inactive") {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
setState({
|
|
203
|
+
viewportVersion: state.viewportVersion + 1
|
|
204
|
+
});
|
|
205
|
+
recalculateBounds();
|
|
206
|
+
}
|
|
207
|
+
function recalculateBounds() {
|
|
208
|
+
const element = state.frozenElement ?? state.hoveredElement;
|
|
209
|
+
if (!element || !document.contains(element)) {
|
|
210
|
+
setState({
|
|
211
|
+
hoveredElement: null,
|
|
212
|
+
frozenElement: null,
|
|
213
|
+
inspectedComponent: null,
|
|
214
|
+
selectionBounds: null,
|
|
215
|
+
labelStatus: "idle"
|
|
216
|
+
});
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
setState({
|
|
220
|
+
selectionBounds: createElementBounds(element)
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
function startBoundsRefreshInterval() {
|
|
224
|
+
if (boundsRefreshIntervalId) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
boundsRefreshIntervalId = setInterval(recalculateBounds, boundsRefreshIntervalMs);
|
|
228
|
+
}
|
|
229
|
+
function stopBoundsRefreshInterval() {
|
|
230
|
+
if (boundsRefreshIntervalId) {
|
|
231
|
+
clearInterval(boundsRefreshIntervalId);
|
|
232
|
+
boundsRefreshIntervalId = null;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function attachEventListeners() {
|
|
236
|
+
abortController = new AbortController();
|
|
237
|
+
const {
|
|
238
|
+
signal
|
|
239
|
+
} = abortController;
|
|
240
|
+
containerElement.addEventListener("mousemove", handleMouseMove, {
|
|
241
|
+
signal,
|
|
242
|
+
passive: true
|
|
243
|
+
});
|
|
244
|
+
containerElement.addEventListener("click", handleClick, {
|
|
245
|
+
signal,
|
|
246
|
+
capture: true
|
|
247
|
+
});
|
|
248
|
+
document.addEventListener("keydown", handleKeyDown, {
|
|
249
|
+
signal,
|
|
250
|
+
capture: true
|
|
251
|
+
});
|
|
252
|
+
window.addEventListener("scroll", handleScroll, {
|
|
253
|
+
signal,
|
|
254
|
+
passive: true
|
|
255
|
+
});
|
|
256
|
+
window.addEventListener("resize", handleResize, {
|
|
257
|
+
signal,
|
|
258
|
+
passive: true
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function detachEventListeners() {
|
|
262
|
+
if (abortController) {
|
|
263
|
+
abortController.abort();
|
|
264
|
+
abortController = null;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function deactivate() {
|
|
268
|
+
if (state.mode === "inactive") {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
detachEventListeners();
|
|
272
|
+
stopBoundsRefreshInterval();
|
|
273
|
+
setState(createInitialState());
|
|
274
|
+
eventHandlers.onDeactivate?.();
|
|
275
|
+
}
|
|
276
|
+
function freeze() {
|
|
277
|
+
if (state.mode !== "hover" || !state.hoveredElement) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
setState({
|
|
281
|
+
mode: "frozen",
|
|
282
|
+
frozenElement: state.hoveredElement,
|
|
283
|
+
selectedElement: state.hoveredElement,
|
|
284
|
+
labelStatus: "selected"
|
|
285
|
+
});
|
|
286
|
+
if (state.inspectedComponent) {
|
|
287
|
+
eventHandlers.onSelect?.(state.inspectedComponent);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function getState() {
|
|
291
|
+
return state;
|
|
292
|
+
}
|
|
293
|
+
return {
|
|
294
|
+
activate: function activate() {
|
|
295
|
+
if (state.mode !== "inactive") {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
setState({
|
|
299
|
+
mode: "hover"
|
|
300
|
+
});
|
|
301
|
+
attachEventListeners();
|
|
302
|
+
startBoundsRefreshInterval();
|
|
303
|
+
eventHandlers.onActivate?.();
|
|
304
|
+
},
|
|
305
|
+
deactivate,
|
|
306
|
+
freeze,
|
|
307
|
+
unfreeze: function unfreeze() {
|
|
308
|
+
if (state.mode !== "frozen") {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
setState({
|
|
312
|
+
mode: "hover",
|
|
313
|
+
frozenElement: null,
|
|
314
|
+
labelStatus: "hover"
|
|
315
|
+
});
|
|
316
|
+
},
|
|
317
|
+
getState,
|
|
318
|
+
subscribe: function subscribe(listener) {
|
|
319
|
+
listeners.add(listener);
|
|
320
|
+
return () => listeners.delete(listener);
|
|
321
|
+
},
|
|
322
|
+
destroy: function destroy() {
|
|
323
|
+
deactivate();
|
|
324
|
+
listeners.clear();
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=inspectorController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspectorController.js","names":["getFiberFromElement","getComponentName","getHookStates","getProps","getSourceLocation","isUserComponent","findParentComponent","createElementBounds","getElementAtPosition","OFFSCREEN_POSITION","DEFAULT_THROTTLE_MS","DEFAULT_BOUNDS_REFRESH_INTERVAL_MS","createInitialState","mode","mouseX","mouseY","hoveredElement","selectedElement","frozenElement","inspectedComponent","selectionBounds","labelPosition","labelStatus","viewportVersion","extractComponentInfo","element","fiber","name","sourceLocation","props","hookStates","WeakRef","hookCount","length","createInspectorController","options","containerElement","document","body","throttleMs","boundsRefreshIntervalMs","eventHandlers","state","listeners","Set","lastElementDetectionTime","boundsRefreshIntervalId","abortController","setState","partial","forEach","listener","handleMouseMove","event","clientX","clientY","now","performance","detectElementAtPosition","onHover","componentFiber","componentInfo","handleClick","target","closest","preventDefault","stopImmediatePropagation","onSelect","handleKeyDown","key","deactivate","handleScroll","recalculateBounds","handleResize","contains","startBoundsRefreshInterval","setInterval","stopBoundsRefreshInterval","clearInterval","attachEventListeners","AbortController","signal","addEventListener","passive","capture","window","detachEventListeners","abort","onDeactivate","freeze","getState","activate","onActivate","unfreeze","subscribe","add","delete","destroy","clear"],"sources":["inspectorController.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 { getFiberFromElement } from \"../fiber/FiberAccess.js\";\nimport {\n getComponentName,\n getHookStates,\n getProps,\n getSourceLocation,\n} from \"../fiber/FiberInspection.js\";\nimport { isUserComponent } from \"../fiber/FiberTags.js\";\nimport { findParentComponent } from \"../fiber/traverseFiber.js\";\nimport type { Fiber } from \"../fiber/types.js\";\nimport type {\n InspectedComponent,\n InspectorController,\n InspectorOptions,\n InspectorState,\n} from \"./types.js\";\nimport {\n createElementBounds,\n getElementAtPosition,\n} from \"./utils/elementBounds.js\";\n\nconst OFFSCREEN_POSITION = -9999;\nconst DEFAULT_THROTTLE_MS = 32;\nconst DEFAULT_BOUNDS_REFRESH_INTERVAL_MS = 100;\n\nfunction createInitialState(): InspectorState {\n return {\n mode: \"inactive\",\n mouseX: OFFSCREEN_POSITION,\n mouseY: OFFSCREEN_POSITION,\n hoveredElement: null,\n selectedElement: null,\n frozenElement: null,\n inspectedComponent: null,\n selectionBounds: null,\n labelPosition: null,\n labelStatus: \"idle\",\n viewportVersion: 0,\n };\n}\n\nfunction extractComponentInfo(\n element: Element,\n fiber: Fiber,\n): InspectedComponent | null {\n const name = getComponentName(fiber);\n if (!name) {\n return null;\n }\n\n const sourceLocation = getSourceLocation(fiber);\n const props = getProps(fiber);\n const hookStates = getHookStates(fiber);\n\n return {\n name,\n fiber: new WeakRef(fiber),\n element: new WeakRef(element),\n sourceLocation,\n props,\n hookCount: hookStates.length,\n };\n}\n\nexport function createInspectorController(\n options: InspectorOptions = {},\n): InspectorController {\n const {\n containerElement = document.body,\n throttleMs = DEFAULT_THROTTLE_MS,\n boundsRefreshIntervalMs = DEFAULT_BOUNDS_REFRESH_INTERVAL_MS,\n eventHandlers = {},\n } = options;\n\n let state = createInitialState();\n const listeners = new Set<(state: InspectorState) => void>();\n let lastElementDetectionTime = 0;\n let boundsRefreshIntervalId: ReturnType<typeof setInterval> | null = null;\n let abortController: AbortController | null = null;\n\n function setState(partial: Partial<InspectorState>): void {\n state = { ...state, ...partial };\n listeners.forEach((listener) => listener(state));\n }\n\n function handleMouseMove(event: MouseEvent): void {\n if (state.mode === \"inactive\" || state.mode === \"frozen\") {\n return;\n }\n\n const { clientX, clientY } = event;\n setState({ mouseX: clientX, mouseY: clientY });\n\n const now = performance.now();\n if (now - lastElementDetectionTime < throttleMs) {\n return;\n }\n lastElementDetectionTime = now;\n\n detectElementAtPosition(clientX, clientY);\n }\n\n function detectElementAtPosition(clientX: number, clientY: number): void {\n const element = getElementAtPosition(\n clientX,\n clientY,\n \"[data-osdk-devtools-ignore]\",\n );\n\n if (!element) {\n setState({\n hoveredElement: null,\n inspectedComponent: null,\n selectionBounds: null,\n labelStatus: \"idle\",\n });\n eventHandlers.onHover?.(null);\n return;\n }\n\n if (element === state.hoveredElement) {\n return;\n }\n\n const fiber = getFiberFromElement(element);\n if (!fiber) {\n setState({\n hoveredElement: element,\n inspectedComponent: null,\n selectionBounds: createElementBounds(element),\n labelStatus: \"idle\",\n });\n eventHandlers.onHover?.(null);\n return;\n }\n\n const componentFiber = isUserComponent(fiber)\n ? fiber\n : findParentComponent(fiber);\n if (!componentFiber) {\n setState({\n hoveredElement: element,\n inspectedComponent: null,\n selectionBounds: createElementBounds(element),\n labelStatus: \"idle\",\n });\n eventHandlers.onHover?.(null);\n return;\n }\n\n const componentInfo = extractComponentInfo(element, componentFiber);\n setState({\n hoveredElement: element,\n inspectedComponent: componentInfo,\n selectionBounds: createElementBounds(element),\n labelStatus: \"hover\",\n });\n\n if (componentInfo) {\n eventHandlers.onHover?.(componentInfo);\n }\n }\n\n function handleClick(event: MouseEvent): void {\n if (state.mode === \"inactive\") {\n return;\n }\n\n const target = event.target as Element;\n\n if (target.closest(\"[data-osdk-devtools-ignore]\")) {\n return;\n }\n\n event.preventDefault();\n event.stopImmediatePropagation();\n\n if (state.mode === \"frozen\") {\n setState({ mode: \"hover\", frozenElement: null, labelStatus: \"hover\" });\n return;\n }\n\n if (state.hoveredElement && state.inspectedComponent) {\n setState({\n mode: \"frozen\",\n frozenElement: state.hoveredElement,\n selectedElement: state.hoveredElement,\n labelStatus: \"selected\",\n });\n eventHandlers.onSelect?.(state.inspectedComponent);\n }\n }\n\n function handleKeyDown(event: KeyboardEvent): void {\n if (state.mode === \"inactive\") {\n return;\n }\n\n if (event.key === \"Escape\") {\n event.preventDefault();\n event.stopImmediatePropagation();\n\n if (state.mode === \"frozen\") {\n setState({ mode: \"hover\", frozenElement: null, labelStatus: \"hover\" });\n } else {\n deactivate();\n }\n }\n }\n\n function handleScroll(): void {\n if (state.mode === \"inactive\") {\n return;\n }\n setState({ viewportVersion: state.viewportVersion + 1 });\n recalculateBounds();\n }\n\n function handleResize(): void {\n if (state.mode === \"inactive\") {\n return;\n }\n setState({ viewportVersion: state.viewportVersion + 1 });\n recalculateBounds();\n }\n\n function recalculateBounds(): void {\n const element = state.frozenElement ?? state.hoveredElement;\n if (!element || !document.contains(element)) {\n setState({\n hoveredElement: null,\n frozenElement: null,\n inspectedComponent: null,\n selectionBounds: null,\n labelStatus: \"idle\",\n });\n return;\n }\n\n setState({ selectionBounds: createElementBounds(element) });\n }\n\n function startBoundsRefreshInterval(): void {\n if (boundsRefreshIntervalId) {\n return;\n }\n boundsRefreshIntervalId = setInterval(\n recalculateBounds,\n boundsRefreshIntervalMs,\n );\n }\n\n function stopBoundsRefreshInterval(): void {\n if (boundsRefreshIntervalId) {\n clearInterval(boundsRefreshIntervalId);\n boundsRefreshIntervalId = null;\n }\n }\n\n function attachEventListeners(): void {\n abortController = new AbortController();\n const { signal } = abortController;\n\n containerElement.addEventListener(\"mousemove\", handleMouseMove, {\n signal,\n passive: true,\n });\n containerElement.addEventListener(\"click\", handleClick, {\n signal,\n capture: true,\n });\n document.addEventListener(\"keydown\", handleKeyDown, {\n signal,\n capture: true,\n });\n window.addEventListener(\"scroll\", handleScroll, { signal, passive: true });\n window.addEventListener(\"resize\", handleResize, { signal, passive: true });\n }\n\n function detachEventListeners(): void {\n if (abortController) {\n abortController.abort();\n abortController = null;\n }\n }\n\n function activate(): void {\n if (state.mode !== \"inactive\") {\n return;\n }\n\n setState({ mode: \"hover\" });\n attachEventListeners();\n startBoundsRefreshInterval();\n eventHandlers.onActivate?.();\n }\n\n function deactivate(): void {\n if (state.mode === \"inactive\") {\n return;\n }\n\n detachEventListeners();\n stopBoundsRefreshInterval();\n setState(createInitialState());\n eventHandlers.onDeactivate?.();\n }\n\n function freeze(): void {\n if (state.mode !== \"hover\" || !state.hoveredElement) {\n return;\n }\n\n setState({\n mode: \"frozen\",\n frozenElement: state.hoveredElement,\n selectedElement: state.hoveredElement,\n labelStatus: \"selected\",\n });\n\n if (state.inspectedComponent) {\n eventHandlers.onSelect?.(state.inspectedComponent);\n }\n }\n\n function unfreeze(): void {\n if (state.mode !== \"frozen\") {\n return;\n }\n\n setState({\n mode: \"hover\",\n frozenElement: null,\n labelStatus: \"hover\",\n });\n }\n\n function getState(): InspectorState {\n return state;\n }\n\n function subscribe(listener: (state: InspectorState) => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n }\n\n function destroy(): void {\n deactivate();\n listeners.clear();\n }\n\n return {\n activate,\n deactivate,\n freeze,\n unfreeze,\n getState,\n subscribe,\n destroy,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,yBAAyB;AAC7D,SACEC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,QACZ,6BAA6B;AACpC,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,mBAAmB,QAAQ,2BAA2B;AAQ/D,SACEC,mBAAmB,EACnBC,oBAAoB,QACf,0BAA0B;AAEjC,MAAMC,kBAAkB,GAAG,CAAC,IAAI;AAChC,MAAM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D;EACF;EAcA,SAASuE,QAAQA,CAAA,EAAmB;IAClC,OAAOhD,KAAK;EACd;EAYA,OAAO;IACLiD,QAAQ,EAlEV,SAASA,QAAQA,CAAA,EAAS;MACxB,IAAIjD,KAAK,CAAC7B,IAAI,KAAK,UAAU,EAAE;QAC7B;MACF;MAEAmC,QAAQ,CAAC;QAAEnC,IAAI,EAAE;MAAQ,CAAC,CAAC;MAC3BkE,oBAAoB,CAAC,CAAC;MACtBJ,0BAA0B,CAAC,CAAC;MAC5BlC,aAAa,CAACmD,UAAU,GAAG,CAAC;IAC9B,CAyDU;IACRtB,UAAU;IACVmB,MAAM;IACNI,QAAQ,EA9BV,SAASA,QAAQA,CAAA,EAAS;MACxB,IAAInD,KAAK,CAAC7B,IAAI,KAAK,QAAQ,EAAE;QAC3B;MACF;MAEAmC,QAAQ,CAAC;QACPnC,IAAI,EAAE,OAAO;QACbK,aAAa,EAAE,IAAI;QACnBI,WAAW,EAAE;MACf,CAAC,CAAC;IACJ,CAoBU;IACRoE,QAAQ;IACRI,SAAS,EAhBX,SAASA,SAASA,CAAC3C,QAAyC,EAAc;MACxER,SAAS,CAACoD,GAAG,CAAC5C,QAAQ,CAAC;MACvB,OAAO,MAAMR,SAAS,CAACqD,MAAM,CAAC7C,QAAQ,CAAC;IACzC,CAaW;IACT8C,OAAO,EAZT,SAASA,OAAOA,CAAA,EAAS;MACvB3B,UAAU,CAAC,CAAC;MACZ3B,SAAS,CAACuD,KAAK,CAAC,CAAC;IACnB;EAUA,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["types.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 { Fiber, SourceLocation } from \"../fiber/types.js\";\n\nexport interface OverlayBounds {\n x: number;\n y: number;\n width: number;\n height: number;\n borderRadius: string;\n transform: string;\n}\n\nexport interface LabelPosition {\n left: number;\n top: number;\n arrowLeft: number;\n arrowPosition: \"top\" | \"bottom\";\n}\n\nexport interface InspectedComponent {\n name: string;\n fiber: WeakRef<Fiber>;\n element: WeakRef<Element>;\n sourceLocation: SourceLocation | null;\n props: Record<string, unknown>;\n hookCount: number;\n}\n\nexport type SelectionLabelStatus = \"idle\" | \"hover\" | \"selected\" | \"copying\";\n\nexport type InspectorMode = \"inactive\" | \"hover\" | \"frozen\";\n\nexport interface InspectorState {\n mode: InspectorMode;\n mouseX: number;\n mouseY: number;\n hoveredElement: Element | null;\n selectedElement: Element | null;\n frozenElement: Element | null;\n inspectedComponent: InspectedComponent | null;\n selectionBounds: OverlayBounds | null;\n labelPosition: LabelPosition | null;\n labelStatus: SelectionLabelStatus;\n viewportVersion: number;\n}\n\nexport interface InspectorEventHandlers {\n onActivate: () => void;\n onDeactivate: () => void;\n onSelect: (component: InspectedComponent) => void;\n onHover: (component: InspectedComponent | null) => void;\n onOpenSource: (sourceLocation: SourceLocation) => void;\n}\n\nexport interface InspectorOptions {\n containerElement?: HTMLElement;\n throttleMs?: number;\n boundsRefreshIntervalMs?: number;\n eventHandlers?: Partial<InspectorEventHandlers>;\n zIndex?: number;\n}\n\nexport interface AnimationOptions {\n interpolationFactor?: number;\n convergenceThreshold?: number;\n enabled?: boolean;\n}\n\nexport interface AnimatedBounds {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport type HighlightVariant = \"hover\" | \"selected\" | \"frozen\";\n\nexport interface SelectionHighlightProps {\n bounds: OverlayBounds | null;\n variant: HighlightVariant;\n animationOptions?: AnimationOptions;\n visible: boolean;\n}\n\nexport interface ComponentLabelProps {\n component: InspectedComponent | null;\n bounds: OverlayBounds | null;\n mouseX: number;\n mouseY: number;\n status: SelectionLabelStatus;\n onOpenSource?: (sourceLocation: SourceLocation) => void;\n visible: boolean;\n}\n\nexport interface InspectorOverlayProps {\n state: InspectorState;\n eventHandlers?: Partial<InspectorEventHandlers>;\n animationOptions?: AnimationOptions;\n zIndex?: number;\n}\n\nexport interface InspectorController {\n activate: () => void;\n deactivate: () => void;\n freeze: () => void;\n unfreeze: () => void;\n getState: () => InspectorState;\n subscribe: (listener: (state: InspectorState) => void) => () => void;\n destroy: () => void;\n}\n"],"mappings":"","ignoreList":[]}
|