@osdk/react-devtools 0.10.0 → 0.10.1-main-e39a72892d538f3130e2cd51cee05d83d11fa493
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 +10 -0
- package/build/esm/DevToolsContext.js.map +1 -1
- package/build/esm/components/ActionMetrics.js +2 -2
- package/build/esm/components/ActionMetrics.js.map +1 -1
- package/build/esm/components/BubbleChart.js +1 -1
- package/build/esm/components/BubbleChart.js.map +1 -1
- package/build/esm/components/CacheInspectorTab.js +1 -1
- package/build/esm/components/CacheInspectorTab.js.map +1 -1
- package/build/esm/components/CacheMetrics.js +1 -1
- package/build/esm/components/CacheMetrics.js.map +1 -1
- package/build/esm/components/ComponentCard.js +1 -1
- package/build/esm/components/ComponentCard.js.map +1 -1
- package/build/esm/components/ComputeTab.js +6 -6
- package/build/esm/components/ComputeTab.js.map +1 -1
- package/build/esm/components/CopyableCodeBlock.js.map +1 -1
- package/build/esm/components/DebuggingTab.js +2 -2
- package/build/esm/components/DebuggingTab.js.map +1 -1
- package/build/esm/components/HookRow.js.map +1 -1
- package/build/esm/components/ImprovementsTab.js.map +1 -1
- package/build/esm/components/InspectorSelectionHeader.js.map +1 -1
- package/build/esm/components/InterceptTab.js +5 -5
- package/build/esm/components/InterceptTab.js.map +1 -1
- package/build/esm/components/IssueCard.js.map +1 -1
- package/build/esm/components/LogEntryCard.js.map +1 -1
- package/build/esm/components/MockEditor.js.map +1 -1
- package/build/esm/components/MonitorErrorBoundary.js.map +1 -1
- package/build/esm/components/MonitoringPanel.js +1 -1
- package/build/esm/components/MonitoringPanel.js.map +1 -1
- package/build/esm/components/ObjectLoadingMetrics.js.map +1 -1
- package/build/esm/components/OsdkAppErrorBoundary.js.map +1 -1
- package/build/esm/components/OsdkDevTools.js.map +1 -1
- package/build/esm/components/OverrideEditor.js.map +1 -1
- package/build/esm/components/PerformanceTab.js +8 -8
- package/build/esm/components/PerformanceTab.js.map +1 -1
- package/build/esm/components/PrimitiveSelectionPanel.js +1 -1
- package/build/esm/components/PrimitiveSelectionPanel.js.map +1 -1
- package/build/esm/components/resolveComponentName.js +2 -2
- package/build/esm/components/resolveComponentName.js.map +1 -1
- package/build/esm/components/testHelpers.js.map +1 -1
- package/build/esm/fiber/DegradationNotice.js +2 -2
- package/build/esm/fiber/DegradationNotice.js.map +1 -1
- package/build/esm/fiber/DevtoolsHook.js +4 -4
- package/build/esm/fiber/DevtoolsHook.js.map +1 -1
- package/build/esm/fiber/FiberAccess.js.map +1 -1
- package/build/esm/fiber/FiberInspection.js.map +1 -1
- package/build/esm/fiber/FiberTags.js.map +1 -1
- package/build/esm/fiber/HookStateInspector.js.map +1 -1
- package/build/esm/fiber/SafeFiberOperation.js.map +1 -1
- package/build/esm/fiber/capabilities.js.map +1 -1
- package/build/esm/fiber/traverseFiber.js.map +1 -1
- package/build/esm/fiber/types.js.map +1 -1
- package/build/esm/fiber/validation.js +1 -1
- package/build/esm/fiber/validation.js.map +1 -1
- package/build/esm/hooks/createPollingStore.js.map +1 -1
- package/build/esm/hooks/useActiveComponents.js.map +1 -1
- package/build/esm/hooks/useComponentRegistry.js.map +1 -1
- package/build/esm/hooks/useComputeSelectors.js.map +1 -1
- package/build/esm/hooks/useConsoleLogs.js.map +1 -1
- package/build/esm/hooks/useInspectorSelection.js.map +1 -1
- package/build/esm/hooks/useMetrics.js.map +1 -1
- package/build/esm/hooks/usePersistedState.js.map +1 -1
- package/build/esm/hooks/useRecommendations.js +1 -1
- package/build/esm/hooks/useRecommendations.js.map +1 -1
- package/build/esm/hooks/useSharedTick.js.map +1 -1
- package/build/esm/hooks/useTimeElapsed.js.map +1 -1
- package/build/esm/hooks/useTrackerSubscription.js.map +1 -1
- package/build/esm/hooks/useUnusedFieldAnalysis.js.map +1 -1
- package/build/esm/inspector/ClickToInspectSystem.js.map +1 -1
- package/build/esm/inspector/components/ComponentLabel.js.map +1 -1
- package/build/esm/inspector/components/InspectorBanner.js.map +1 -1
- package/build/esm/inspector/components/InspectorOverlay.js.map +1 -1
- package/build/esm/inspector/components/SelectionHighlight.js.map +1 -1
- package/build/esm/inspector/createClickToInspect.js.map +1 -1
- package/build/esm/inspector/hooks/useAnimatedBounds.js.map +1 -1
- package/build/esm/inspector/inspectorController.js.map +1 -1
- package/build/esm/inspector/utils/elementBounds.js.map +1 -1
- package/build/esm/inspector/utils/interpolation.js.map +1 -1
- package/build/esm/inspector/utils/labelPositioning.js.map +1 -1
- package/build/esm/mocking/MockCacheKeyGenerator.js +3 -3
- package/build/esm/mocking/MockCacheKeyGenerator.js.map +1 -1
- package/build/esm/mocking/MockManager.js +4 -4
- package/build/esm/mocking/MockManager.js.map +1 -1
- package/build/esm/prototyping/PrototypeOverrideStore.js +1 -1
- package/build/esm/prototyping/PrototypeOverrideStore.js.map +1 -1
- package/build/esm/register.js.map +1 -1
- package/build/esm/store/ComputeStore.js.map +1 -1
- package/build/esm/store/ConsoleLogStore.js +2 -2
- package/build/esm/store/ConsoleLogStore.js.map +1 -1
- package/build/esm/store/MetricsStore.js.map +1 -1
- package/build/esm/store/MonitorStore.js.map +1 -1
- package/build/esm/store/WindowErrorStore.js.map +1 -1
- package/build/esm/styles.js.map +1 -1
- package/build/esm/types/compute.js.map +1 -1
- package/build/esm/utils/ActionLifecycleTracker.js.map +1 -1
- package/build/esm/utils/CacheEfficiencyAnalyzer.js.map +1 -1
- package/build/esm/utils/ComponentContextCapture.js +10 -10
- package/build/esm/utils/ComponentContextCapture.js.map +1 -1
- package/build/esm/utils/ComponentPrimitiveDiscovery.js.map +1 -1
- package/build/esm/utils/ComponentQueryRegistry.js +8 -8
- package/build/esm/utils/ComponentQueryRegistry.js.map +1 -1
- package/build/esm/utils/ComputeMonitor.js +2 -2
- package/build/esm/utils/ComputeMonitor.js.map +1 -1
- package/build/esm/utils/EventTimeline.js.map +1 -1
- package/build/esm/utils/LinkTraversalTracker.js +2 -2
- package/build/esm/utils/LinkTraversalTracker.js.map +1 -1
- package/build/esm/utils/MockDataGenerator.js +4 -4
- package/build/esm/utils/MockDataGenerator.js.map +1 -1
- package/build/esm/utils/ObservableClientMonitor.js +2 -2
- package/build/esm/utils/ObservableClientMonitor.js.map +1 -1
- package/build/esm/utils/PerformanceRecommendationEngine.js +1 -1
- package/build/esm/utils/PerformanceRecommendationEngine.js.map +1 -1
- package/build/esm/utils/PropertyAccessTracker.js +3 -3
- package/build/esm/utils/PropertyAccessTracker.js.map +1 -1
- package/build/esm/utils/RecommendationMatcher.js.map +1 -1
- package/build/esm/utils/SubscriptionTracker.js +1 -1
- package/build/esm/utils/SubscriptionTracker.js.map +1 -1
- package/build/esm/utils/UnusedFieldAnalyzer.js +6 -7
- package/build/esm/utils/UnusedFieldAnalyzer.js.map +1 -1
- package/build/esm/utils/WaterfallDetector.js.map +1 -1
- package/build/esm/utils/computePayload.js +2 -2
- package/build/esm/utils/computePayload.js.map +1 -1
- package/build/esm/utils/computeRequest.js.map +1 -1
- package/build/esm/utils/format.js.map +1 -1
- package/build/esm/vite/hookInstaller.js.map +1 -1
- package/build/esm/vite/index.js +2 -3
- package/build/esm/vite/index.js.map +1 -1
- package/build/types/DevToolsContext.d.ts.map +1 -1
- package/build/types/components/ActionMetrics.d.ts.map +1 -1
- package/build/types/components/BubbleChart.d.ts.map +1 -1
- package/build/types/components/CacheInspectorTab.d.ts.map +1 -1
- package/build/types/components/CacheMetrics.d.ts.map +1 -1
- package/build/types/components/ComponentCard.d.ts.map +1 -1
- package/build/types/components/ComputeTab.d.ts.map +1 -1
- package/build/types/components/CopyableCodeBlock.d.ts.map +1 -1
- package/build/types/components/DebuggingTab.d.ts.map +1 -1
- package/build/types/components/HookRow.d.ts.map +1 -1
- package/build/types/components/ImprovementsTab.d.ts.map +1 -1
- package/build/types/components/InspectorSelectionHeader.d.ts.map +1 -1
- package/build/types/components/InterceptTab.d.ts.map +1 -1
- package/build/types/components/IssueCard.d.ts.map +1 -1
- package/build/types/components/LogEntryCard.d.ts.map +1 -1
- package/build/types/components/MockEditor.d.ts.map +1 -1
- package/build/types/components/MonitorErrorBoundary.d.ts.map +1 -1
- package/build/types/components/MonitoringPanel.d.ts.map +1 -1
- package/build/types/components/ObjectLoadingMetrics.d.ts.map +1 -1
- package/build/types/components/OsdkAppErrorBoundary.d.ts.map +1 -1
- package/build/types/components/OsdkDevTools.d.ts.map +1 -1
- package/build/types/components/OverrideEditor.d.ts.map +1 -1
- package/build/types/components/PerformanceTab.d.ts.map +1 -1
- package/build/types/components/PrimitiveSelectionPanel.d.ts.map +1 -1
- package/build/types/components/resolveComponentName.d.ts.map +1 -1
- package/build/types/components/testHelpers.d.ts.map +1 -1
- package/build/types/fiber/DegradationNotice.d.ts.map +1 -1
- package/build/types/fiber/DevtoolsHook.d.ts.map +1 -1
- package/build/types/fiber/FiberInspection.d.ts.map +1 -1
- package/build/types/fiber/HookStateInspector.d.ts.map +1 -1
- package/build/types/fiber/capabilities.d.ts.map +1 -1
- package/build/types/fiber/traverseFiber.d.ts.map +1 -1
- package/build/types/fiber/types.d.ts.map +1 -1
- package/build/types/hooks/useActiveComponents.d.ts.map +1 -1
- package/build/types/hooks/useComponentRegistry.d.ts.map +1 -1
- package/build/types/hooks/useComputeSelectors.d.ts.map +1 -1
- package/build/types/hooks/useConsoleLogs.d.ts.map +1 -1
- package/build/types/hooks/useInspectorSelection.d.ts.map +1 -1
- package/build/types/hooks/useMetrics.d.ts.map +1 -1
- package/build/types/hooks/useRecommendations.d.ts.map +1 -1
- package/build/types/hooks/useUnusedFieldAnalysis.d.ts.map +1 -1
- package/build/types/inspector/ClickToInspectSystem.d.ts.map +1 -1
- package/build/types/inspector/components/ComponentLabel.d.ts.map +1 -1
- package/build/types/inspector/components/InspectorOverlay.d.ts.map +1 -1
- package/build/types/inspector/components/SelectionHighlight.d.ts.map +1 -1
- package/build/types/inspector/hooks/useAnimatedBounds.d.ts.map +1 -1
- package/build/types/mocking/MockManager.d.ts.map +1 -1
- package/build/types/store/ComputeStore.d.ts.map +1 -1
- package/build/types/store/ConsoleLogStore.d.ts.map +1 -1
- package/build/types/store/MetricsStore.d.ts.map +1 -1
- package/build/types/store/MonitorStore.d.ts.map +1 -1
- package/build/types/store/WindowErrorStore.d.ts.map +1 -1
- package/build/types/styles.d.ts +0 -1
- package/build/types/styles.d.ts.map +1 -1
- package/build/types/types/compute.d.ts.map +1 -1
- package/build/types/utils/ActionLifecycleTracker.d.ts.map +1 -1
- package/build/types/utils/CacheEfficiencyAnalyzer.d.ts.map +1 -1
- package/build/types/utils/ComponentContextCapture.d.ts.map +1 -1
- package/build/types/utils/ComponentPrimitiveDiscovery.d.ts.map +1 -1
- package/build/types/utils/ComponentQueryRegistry.d.ts.map +1 -1
- package/build/types/utils/ComputeMonitor.d.ts.map +1 -1
- package/build/types/utils/EventTimeline.d.ts.map +1 -1
- package/build/types/utils/LinkTraversalTracker.d.ts.map +1 -1
- package/build/types/utils/MockDataGenerator.d.ts.map +1 -1
- package/build/types/utils/ObservableClientMonitor.d.ts.map +1 -1
- package/build/types/utils/PerformanceRecommendationEngine.d.ts.map +1 -1
- package/build/types/utils/PropertyAccessTracker.d.ts.map +1 -1
- package/build/types/utils/SubscriptionTracker.d.ts.map +1 -1
- package/build/types/utils/UnusedFieldAnalyzer.d.ts.map +1 -1
- package/build/types/utils/WaterfallDetector.d.ts.map +1 -1
- package/build/types/utils/computeRequest.d.ts.map +1 -1
- package/build/types/vite/index.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRecommendations.js","names":["React","RecommendationsStore","state","recommendations","isLoading","error","listeners","Set","constructor","monitorStore","subscribe","callback","add","size","setTimeout","refresh","metricsStore","getMetricsStore","unsubscribeMetrics","clearTimeout","debounceTimeout","delete","undefined","getSnapshot","notify","engine","getRecommendationEngine","snapshot","getCacheSnapshot","freshRecommendations","generateRecommendations","merged","Map","rec","set","id","
|
|
1
|
+
{"version":3,"file":"useRecommendations.js","names":["React","RecommendationsStore","state","recommendations","isLoading","error","listeners","Set","constructor","monitorStore","subscribe","callback","add","size","setTimeout","refresh","metricsStore","getMetricsStore","unsubscribeMetrics","clearTimeout","debounceTimeout","delete","undefined","getSnapshot","notify","engine","getRecommendationEngine","snapshot","getCacheSnapshot","freshRecommendations","generateRecommendations","merged","Map","rec","set","id","values","e","Error","String","dismiss","dismissRecommendation","filter","r","listener","useRecommendations","storeRef","useRef","current","store","useCallback","useSyncExternalStore"],"sources":["useRecommendations.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\";\n\nimport type { MonitorStore } from \"../store/MonitorStore.js\";\nimport type { Recommendation } from \"../utils/PerformanceRecommendationEngine.js\";\n\nexport interface RecommendationsState {\n recommendations: Recommendation[];\n isLoading: boolean;\n error: Error | null;\n refresh: () => void;\n dismiss: (id: string) => void;\n}\n\ninterface RecommendationsInternalState {\n recommendations: Recommendation[];\n isLoading: boolean;\n error: Error | null;\n}\n\nclass RecommendationsStore {\n private state: RecommendationsInternalState = {\n recommendations: [],\n isLoading: true,\n error: null,\n };\n private listeners = new Set<() => void>();\n private unsubscribeMetrics: (() => void) | undefined;\n private debounceTimeout: ReturnType<typeof setTimeout> | undefined;\n\n constructor(private readonly monitorStore: MonitorStore) {}\n\n subscribe(callback: () => void): () => void {\n this.listeners.add(callback);\n\n if (this.listeners.size === 1) {\n setTimeout(() => void this.refresh(), 0);\n const metricsStore = this.monitorStore.getMetricsStore();\n this.unsubscribeMetrics = metricsStore.subscribe(() => {\n clearTimeout(this.debounceTimeout);\n this.debounceTimeout = setTimeout(() => {\n void this.refresh();\n }, 1000);\n });\n }\n\n return () => {\n this.listeners.delete(callback);\n if (this.listeners.size === 0) {\n if (this.unsubscribeMetrics) {\n this.unsubscribeMetrics();\n this.unsubscribeMetrics = undefined;\n }\n clearTimeout(this.debounceTimeout);\n }\n };\n }\n\n getSnapshot(): RecommendationsInternalState {\n return this.state;\n }\n\n async refresh(): Promise<void> {\n this.state = { ...this.state, isLoading: true, error: null };\n this.notify();\n try {\n const engine = this.monitorStore.getRecommendationEngine();\n const snapshot = await this.monitorStore.getCacheSnapshot();\n const freshRecommendations = engine.generateRecommendations(snapshot);\n const merged = new Map<string, Recommendation>();\n for (const rec of this.state.recommendations) {\n merged.set(rec.id, rec);\n }\n for (const rec of freshRecommendations) {\n merged.set(rec.id, rec);\n }\n this.state = {\n recommendations: [...merged.values()],\n isLoading: false,\n error: null,\n };\n this.notify();\n } catch (e) {\n this.state = {\n ...this.state,\n isLoading: false,\n error: e instanceof Error ? e : new Error(String(e)),\n };\n this.notify();\n }\n }\n\n dismiss(id: string): void {\n const engine = this.monitorStore.getRecommendationEngine();\n engine.dismissRecommendation(id);\n this.state = {\n ...this.state,\n recommendations: this.state.recommendations.filter((r) => r.id !== id),\n };\n this.notify();\n }\n\n private notify(): void {\n for (const listener of this.listeners) {\n listener();\n }\n }\n}\n\nexport function useRecommendations(\n monitorStore: MonitorStore\n): RecommendationsState {\n const storeRef = React.useRef<RecommendationsStore | null>(null);\n\n if (storeRef.current == null) {\n storeRef.current = new RecommendationsStore(monitorStore);\n }\n\n const store = storeRef.current;\n\n const subscribe = React.useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store]\n );\n\n const getSnapshot = React.useCallback(() => store.getSnapshot(), [store]);\n\n const state = React.useSyncExternalStore(subscribe, getSnapshot);\n\n const refresh = React.useCallback(() => {\n void store.refresh();\n }, [store]);\n\n const dismiss = React.useCallback((id: string) => store.dismiss(id), [store]);\n\n return {\n recommendations: state.recommendations,\n isLoading: state.isLoading,\n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,WAAW,CAAC;EAEhE,MAAMR,OAAO,GAAGf,KAAK,CAACkD,WAAW,CAAC,MAAM;IACtC,KAAKD,KAAK,CAAClC,OAAO,CAAC,CAAC;EACtB,CAAC,EAAE,CAACkC,KAAK,CAAC,CAAC;EAEX,MAAMT,OAAO,GAAGxC,KAAK,CAACkD,WAAW,CAAEf,EAAU,IAAKc,KAAK,CAACT,OAAO,CAACL,EAAE,CAAC,EAAE,CAACc,KAAK,CAAC,CAAC;EAE7E,OAAO;IACL9C,eAAe,EAAED,KAAK,CAACC,eAAe;IACtCC,SAAS,EAAEF,KAAK,CAACE,SAAS;IAC1BC,KAAK,EAAEH,KAAK,CAACG,KAAK;IAClBU,OAAO;IACPyB;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSharedTick.js","names":["React","tickListeners","Set","tickInterval","tickVersion","startTick","setInterval","forEach","fn","stopTick","size","clearInterval","subscribeTick","callback","add","delete","getTickSnapshot","useSharedTick","useSyncExternalStore"],"sources":["useSharedTick.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\";\n\nconst tickListeners = new Set<() => void>();\nlet tickInterval: ReturnType<typeof setInterval> | null = null;\nlet tickVersion = 0;\n\nfunction startTick() {\n if (!tickInterval) {\n tickInterval = setInterval(() => {\n tickVersion++;\n tickListeners.forEach(fn => fn());\n }, 1000);\n }\n}\n\nfunction stopTick() {\n if (tickListeners.size === 0 && tickInterval) {\n clearInterval(tickInterval);\n tickInterval = null;\n }\n}\n\nfunction subscribeTick(callback: () => void): () => void {\n tickListeners.add(callback);\n startTick();\n return () => {\n tickListeners.delete(callback);\n stopTick();\n };\n}\n\nfunction getTickSnapshot(): number {\n return tickVersion;\n}\n\nexport function useSharedTick(): number {\n return React.useSyncExternalStore(subscribeTick, getTickSnapshot);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAa,CAAC;AAC3C,IAAIC,YAAmD,GAAG,IAAI;AAC9D,IAAIC,WAAW,GAAG,CAAC;AAEnB,SAASC,SAASA,CAAA,EAAG;EACnB,IAAI,CAACF,YAAY,EAAE;IACjBA,YAAY,GAAGG,WAAW,CAAC,MAAM;MAC/BF,WAAW,EAAE;MACbH,aAAa,CAACM,OAAO,
|
|
1
|
+
{"version":3,"file":"useSharedTick.js","names":["React","tickListeners","Set","tickInterval","tickVersion","startTick","setInterval","forEach","fn","stopTick","size","clearInterval","subscribeTick","callback","add","delete","getTickSnapshot","useSharedTick","useSyncExternalStore"],"sources":["useSharedTick.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\";\n\nconst tickListeners = new Set<() => void>();\nlet tickInterval: ReturnType<typeof setInterval> | null = null;\nlet tickVersion = 0;\n\nfunction startTick() {\n if (!tickInterval) {\n tickInterval = setInterval(() => {\n tickVersion++;\n tickListeners.forEach((fn) => fn());\n }, 1000);\n }\n}\n\nfunction stopTick() {\n if (tickListeners.size === 0 && tickInterval) {\n clearInterval(tickInterval);\n tickInterval = null;\n }\n}\n\nfunction subscribeTick(callback: () => void): () => void {\n tickListeners.add(callback);\n startTick();\n return () => {\n tickListeners.delete(callback);\n stopTick();\n };\n}\n\nfunction getTickSnapshot(): number {\n return tickVersion;\n}\n\nexport function useSharedTick(): number {\n return React.useSyncExternalStore(subscribeTick, getTickSnapshot);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAa,CAAC;AAC3C,IAAIC,YAAmD,GAAG,IAAI;AAC9D,IAAIC,WAAW,GAAG,CAAC;AAEnB,SAASC,SAASA,CAAA,EAAG;EACnB,IAAI,CAACF,YAAY,EAAE;IACjBA,YAAY,GAAGG,WAAW,CAAC,MAAM;MAC/BF,WAAW,EAAE;MACbH,aAAa,CAACM,OAAO,CAAEC,EAAE,IAAKA,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC,EAAE,IAAI,CAAC;EACV;AACF;AAEA,SAASC,QAAQA,CAAA,EAAG;EAClB,IAAIR,aAAa,CAACS,IAAI,KAAK,CAAC,IAAIP,YAAY,EAAE;IAC5CQ,aAAa,CAACR,YAAY,CAAC;IAC3BA,YAAY,GAAG,IAAI;EACrB;AACF;AAEA,SAASS,aAAaA,CAACC,QAAoB,EAAc;EACvDZ,aAAa,CAACa,GAAG,CAACD,QAAQ,CAAC;EAC3BR,SAAS,CAAC,CAAC;EACX,OAAO,MAAM;IACXJ,aAAa,CAACc,MAAM,CAACF,QAAQ,CAAC;IAC9BJ,QAAQ,CAAC,CAAC;EACZ,CAAC;AACH;AAEA,SAASO,eAAeA,CAAA,EAAW;EACjC,OAAOZ,WAAW;AACpB;AAEA,OAAO,SAASa,aAAaA,CAAA,EAAW;EACtC,OAAOjB,KAAK,CAACkB,oBAAoB,CAACN,aAAa,EAAEI,eAAe,CAAC;AACnE","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTimeElapsed.js","names":["React","useTimeElapsed","startTime","startMs","getTime","stateRef","useRef","tick","cachedTick","cachedValue","undefined","subscribe","useCallback","callback","intervalId","setInterval","current","clearInterval","getSnapshot","state","Date","now","useSyncExternalStore"],"sources":["useTimeElapsed.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\";\n\nexport function useTimeElapsed(\n startTime: Date | undefined
|
|
1
|
+
{"version":3,"file":"useTimeElapsed.js","names":["React","useTimeElapsed","startTime","startMs","getTime","stateRef","useRef","tick","cachedTick","cachedValue","undefined","subscribe","useCallback","callback","intervalId","setInterval","current","clearInterval","getSnapshot","state","Date","now","useSyncExternalStore"],"sources":["useTimeElapsed.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\";\n\nexport function useTimeElapsed(\n startTime: Date | undefined\n): number | undefined {\n const startMs = startTime?.getTime();\n\n const stateRef = React.useRef({\n tick: 0,\n cachedTick: -1,\n cachedValue: undefined as number | undefined,\n });\n\n const subscribe = React.useCallback(\n (callback: () => void) => {\n if (startMs == null) {\n return () => {};\n }\n\n const intervalId = setInterval(() => {\n stateRef.current.tick++;\n callback();\n }, 1000);\n return () => {\n clearInterval(intervalId);\n };\n },\n [startMs]\n );\n\n const getSnapshot = React.useCallback((): number | undefined => {\n if (startMs == null) {\n return undefined;\n }\n const state = stateRef.current;\n if (state.cachedTick === state.tick) {\n return state.cachedValue;\n }\n state.cachedValue = Date.now() - startMs;\n state.cachedTick = state.tick;\n return state.cachedValue;\n }, [startMs]);\n\n return React.useSyncExternalStore(subscribe, getSnapshot);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAO,SAASC,cAAcA,CAC5BC,SAA2B,EACP;EACpB,MAAMC,OAAO,GAAGD,SAAS,EAAEE,OAAO,CAAC,CAAC;EAEpC,MAAMC,QAAQ,GAAGL,KAAK,CAACM,MAAM,CAAC;IAC5BC,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE,CAAC,CAAC;IACdC,WAAW,EAAEC;EACf,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAGX,KAAK,CAACY,WAAW,CAChCC,QAAoB,IAAK;IACxB,IAAIV,OAAO,IAAI,IAAI,EAAE;MACnB,OAAO,MAAM,CAAC,CAAC;IACjB;IAEA,MAAMW,UAAU,GAAGC,WAAW,CAAC,MAAM;MACnCV,QAAQ,CAACW,OAAO,CAACT,IAAI,EAAE;MACvBM,QAAQ,CAAC,CAAC;IACZ,CAAC,EAAE,IAAI,CAAC;IACR,OAAO,MAAM;MACXI,aAAa,CAACH,UAAU,CAAC;IAC3B,CAAC;EACH,CAAC,EACD,CAACX,OAAO,CACV,CAAC;EAED,MAAMe,WAAW,GAAGlB,KAAK,CAACY,WAAW,CAAC,MAA0B;IAC9D,IAAIT,OAAO,IAAI,IAAI,EAAE;MACnB,OAAOO,SAAS;IAClB;IACA,MAAMS,KAAK,GAAGd,QAAQ,CAACW,OAAO;IAC9B,IAAIG,KAAK,CAACX,UAAU,KAAKW,KAAK,CAACZ,IAAI,EAAE;MACnC,OAAOY,KAAK,CAACV,WAAW;IAC1B;IACAU,KAAK,CAACV,WAAW,GAAGW,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGlB,OAAO;IACxCgB,KAAK,CAACX,UAAU,GAAGW,KAAK,CAACZ,IAAI;IAC7B,OAAOY,KAAK,CAACV,WAAW;EAC1B,CAAC,EAAE,CAACN,OAAO,CAAC,CAAC;EAEb,OAAOH,KAAK,CAACsB,oBAAoB,CAACX,SAAS,EAAEO,WAAW,CAAC;AAC3D","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTrackerSubscription.js","names":["React","useTrackerSubscription","tracker","getData","emptyData","options","autoRefresh","refreshInterval","limit","getDataRef","useRef","emptyDataRef","current","storeRef","data","listeners","Set","subscribe","useCallback","callback","store","add","doRefresh","listener","unsubscribeTracker","intervalId","setInterval","delete","undefined","clearInterval","getSnapshot","useSyncExternalStore","refresh"],"sources":["useTrackerSubscription.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\";\n\ninterface Subscribable {\n subscribe(cb: () => void): () => void;\n}\n\nexport interface TrackerSubscriptionOptions {\n autoRefresh?: boolean;\n refreshInterval?: number;\n limit?: number;\n}\n\nexport function useTrackerSubscription<TTracker extends Subscribable, TData>(\n tracker: TTracker | null,\n getData: (tracker: TTracker, limit: number) => TData,\n emptyData: TData,\n options: TrackerSubscriptionOptions = {}
|
|
1
|
+
{"version":3,"file":"useTrackerSubscription.js","names":["React","useTrackerSubscription","tracker","getData","emptyData","options","autoRefresh","refreshInterval","limit","getDataRef","useRef","emptyDataRef","current","storeRef","data","listeners","Set","subscribe","useCallback","callback","store","add","doRefresh","listener","unsubscribeTracker","intervalId","setInterval","delete","undefined","clearInterval","getSnapshot","useSyncExternalStore","refresh"],"sources":["useTrackerSubscription.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\";\n\ninterface Subscribable {\n subscribe(cb: () => void): () => void;\n}\n\nexport interface TrackerSubscriptionOptions {\n autoRefresh?: boolean;\n refreshInterval?: number;\n limit?: number;\n}\n\nexport function useTrackerSubscription<TTracker extends Subscribable, TData>(\n tracker: TTracker | null,\n getData: (tracker: TTracker, limit: number) => TData,\n emptyData: TData,\n options: TrackerSubscriptionOptions = {}\n): { data: TData; refresh: () => void } {\n const { autoRefresh = true, refreshInterval = 1000, limit = 10 } = options;\n\n const getDataRef = React.useRef(getData);\n const emptyDataRef = React.useRef(emptyData);\n getDataRef.current = getData;\n emptyDataRef.current = emptyData;\n\n const storeRef = React.useRef<{\n data: TData;\n listeners: Set<() => void>;\n } | null>(null);\n\n if (storeRef.current == null) {\n storeRef.current = {\n data: tracker ? getData(tracker, limit) : emptyData,\n listeners: new Set(),\n };\n }\n\n const subscribe = React.useCallback(\n (callback: () => void) => {\n const store = storeRef.current;\n if (store == null) {\n return () => {};\n }\n store.listeners.add(callback);\n\n const doRefresh = () => {\n if (store == null) {\n return;\n }\n if (tracker) {\n store.data = getDataRef.current(tracker, limit);\n } else {\n store.data = emptyDataRef.current;\n }\n for (const listener of store.listeners) {\n listener();\n }\n };\n\n doRefresh();\n\n let unsubscribeTracker: (() => void) | undefined;\n let intervalId: ReturnType<typeof setInterval> | undefined;\n\n if (tracker && autoRefresh) {\n unsubscribeTracker = tracker.subscribe(doRefresh);\n intervalId = setInterval(doRefresh, refreshInterval);\n }\n\n return () => {\n store.listeners.delete(callback);\n if (unsubscribeTracker) {\n unsubscribeTracker();\n }\n if (intervalId !== undefined) {\n clearInterval(intervalId);\n }\n };\n },\n [tracker, autoRefresh, refreshInterval, limit]\n );\n\n const getSnapshot = React.useCallback((): TData => {\n if (storeRef.current == null) {\n return emptyData;\n }\n return storeRef.current.data;\n }, [emptyData]);\n\n const data = React.useSyncExternalStore(subscribe, getSnapshot);\n\n const refresh = React.useCallback(() => {\n const store = storeRef.current;\n if (store == null) {\n return;\n }\n if (tracker) {\n store.data = getDataRef.current(tracker, limit);\n } else {\n store.data = emptyDataRef.current;\n }\n for (const listener of store.listeners) {\n listener();\n }\n }, [tracker, limit]);\n\n return { data, refresh };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAYzB,OAAO,SAASC,sBAAsBA,CACpCC,OAAwB,EACxBC,OAAoD,EACpDC,SAAgB,EAChBC,OAAmC,GAAG,CAAC,CAAC,EACF;EACtC,MAAM;IAAEC,WAAW,GAAG,IAAI;IAAEC,eAAe,GAAG,IAAI;IAAEC,KAAK,GAAG;EAAG,CAAC,GAAGH,OAAO;EAE1E,MAAMI,UAAU,GAAGT,KAAK,CAACU,MAAM,CAACP,OAAO,CAAC;EACxC,MAAM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{"version":3,"file":"useUnusedFieldAnalysis.js","names":["React","UnusedFieldAnalyzer","AnalysisStore","state","report","isLoading","error","listeners","Set","isAnalyzing","constructor","monitorStore","updateIntervalMs","subscribe","callback","add","size","setTimeout","analyze","intervalId","setInterval","delete","undefined","clearInterval","getSnapshot","notify","registry","getComponentRegistry","propertyTracker","getPropertyAccessTracker","cacheSnapshot","getCacheSnapshot","analyzer","generateGlobalReport","Error","String","listener","useUnusedFieldAnalysis","storeRef","useRef","current","store","useCallback","useSyncExternalStore"],"sources":["useUnusedFieldAnalysis.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 { MonitorStore } from \"../store/MonitorStore.js\";\nimport {\n UnusedFieldAnalyzer,\n type UnusedFieldReport,\n} from \"../utils/UnusedFieldAnalyzer.js\";\n\nexport interface UnusedFieldAnalysisState {\n report: UnusedFieldReport | null;\n isLoading: boolean;\n error: Error | null;\n}\n\nclass AnalysisStore {\n private state: UnusedFieldAnalysisState = {\n report: null,\n isLoading: true,\n error: null,\n };\n private listeners = new Set<() => void>();\n private intervalId: ReturnType<typeof setInterval> | undefined;\n private isAnalyzing = false;\n\n constructor(\n private readonly monitorStore: MonitorStore,\n private readonly updateIntervalMs: number
|
|
1
|
+
{"version":3,"file":"useUnusedFieldAnalysis.js","names":["React","UnusedFieldAnalyzer","AnalysisStore","state","report","isLoading","error","listeners","Set","isAnalyzing","constructor","monitorStore","updateIntervalMs","subscribe","callback","add","size","setTimeout","analyze","intervalId","setInterval","delete","undefined","clearInterval","getSnapshot","notify","registry","getComponentRegistry","propertyTracker","getPropertyAccessTracker","cacheSnapshot","getCacheSnapshot","analyzer","generateGlobalReport","Error","String","listener","useUnusedFieldAnalysis","storeRef","useRef","current","store","useCallback","useSyncExternalStore"],"sources":["useUnusedFieldAnalysis.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\";\n\nimport type { MonitorStore } from \"../store/MonitorStore.js\";\nimport {\n UnusedFieldAnalyzer,\n type UnusedFieldReport,\n} from \"../utils/UnusedFieldAnalyzer.js\";\n\nexport interface UnusedFieldAnalysisState {\n report: UnusedFieldReport | null;\n isLoading: boolean;\n error: Error | null;\n}\n\nclass AnalysisStore {\n private state: UnusedFieldAnalysisState = {\n report: null,\n isLoading: true,\n error: null,\n };\n private listeners = new Set<() => void>();\n private intervalId: ReturnType<typeof setInterval> | undefined;\n private isAnalyzing = false;\n\n constructor(\n private readonly monitorStore: MonitorStore,\n private readonly updateIntervalMs: number\n ) {}\n\n subscribe(callback: () => void): () => void {\n this.listeners.add(callback);\n\n if (this.listeners.size === 1) {\n setTimeout(() => void this.analyze(), 0);\n this.intervalId = setInterval(() => {\n void this.analyze();\n }, this.updateIntervalMs);\n }\n\n return () => {\n this.listeners.delete(callback);\n if (this.listeners.size === 0 && this.intervalId !== undefined) {\n clearInterval(this.intervalId);\n this.intervalId = undefined;\n }\n };\n }\n\n getSnapshot(): UnusedFieldAnalysisState {\n return this.state;\n }\n\n private async analyze(): Promise<void> {\n if (this.isAnalyzing) {\n return;\n }\n this.isAnalyzing = true;\n\n try {\n this.state = { ...this.state, isLoading: true };\n this.notify();\n\n const registry = this.monitorStore.getComponentRegistry();\n const propertyTracker = this.monitorStore.getPropertyAccessTracker();\n const cacheSnapshot = await this.monitorStore.getCacheSnapshot();\n\n const analyzer = new UnusedFieldAnalyzer(registry, propertyTracker);\n\n const report = analyzer.generateGlobalReport(cacheSnapshot);\n\n this.state = {\n report,\n isLoading: false,\n error: null,\n };\n this.notify();\n } catch (error) {\n this.state = {\n report: null,\n isLoading: false,\n error: error instanceof Error ? error : new Error(String(error)),\n };\n this.notify();\n } finally {\n this.isAnalyzing = false;\n }\n }\n\n private notify(): void {\n for (const listener of this.listeners) {\n listener();\n }\n }\n}\n\nexport function useUnusedFieldAnalysis(\n monitorStore: MonitorStore,\n updateIntervalMs: number = 2000\n): UnusedFieldAnalysisState {\n const storeRef = React.useRef<AnalysisStore | null>(null);\n\n if (storeRef.current == null) {\n storeRef.current = new AnalysisStore(monitorStore, updateIntervalMs);\n }\n\n const store = storeRef.current;\n\n const subscribe = React.useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store]\n );\n\n const getSnapshot = React.useCallback(() => store.getSnapshot(), [store]);\n\n return React.useSyncExternalStore(subscribe, getSnapshot);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAGzB,SACEC,mBAAmB,QAEd,iCAAiC;AAQxC,MAAMC,aAAa,CAAC;EACVC,KAAK,GAA6B;IACxCC,MAAM,EAAE,IAAI;IACZC,SAAS,EAAE,IAAI;IACfC,KAAK,EAAE;EACT,CAAC;EACOC,SAAS,GAAG,IAAIC,GAAG,CAAa,CAAC;EAEjCC,WAAW,GAAG,KAAK;EAE3BC,WAAWA,CACQC,YAA0B,EAC1BC,gBAAwB,EACzC;IAAA,KAFiBD,YAA0B,GAA1BA,YAA0B;IAAA,KAC1BC,gBAAwB,GAAxBA,gBAA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,CAAC0C,WAAW,CAAC,MAAMD,KAAK,CAACjB,WAAW,CAAC,CAAC,EAAE,CAACiB,KAAK,CAAC,CAAC;EAEzE,OAAOzC,KAAK,CAAC2C,oBAAoB,CAAC9B,SAAS,EAAEW,WAAW,CAAC;AAC3D","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickToInspectSystem.js","names":["React","createRoot","InspectorBanner","InspectorOverlay","createInspectorController","ClickToInspectSystem","state","active","hoveredElement","hoveredComponentId","selectedComponentId","inspectorController","bannerContainer","bannerRoot","overlayContainer","overlayRoot","stateUnsubscribe","eventHandlers","Map","constructor","options","setupKeyboardShortcuts","activate","containerElement","onActivate","onDeactivate","deactivate","onSelect","component","handleComponentSelected","onHover","name","showOverlay","showBanner","setCursor","renderTarget","document","body","createElement","id","setAttribute","appendChild","subscribe","controllerState","renderOverlay","getState","render","hideOverlay","mode","mouseX","mouseY","selectedElement","frozenElement","inspectedComponent","selectionBounds","labelPosition","labelStatus","viewportVersion","visible","hideBanner","destroy","clearHover","toggle","existing","get","window","removeEventListener","eventType","handler","delete","e","keyEvent","ctrlKey","metaKey","shiftKey","key","preventDefault","stopPropagation","addEventListener","set","cursor","style","dispose","values","clear","unmount","remove"],"sources":["ClickToInspectSystem.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 { createRoot, type Root } from \"react-dom/client\";\nimport { InspectorBanner } from \"./components/InspectorBanner.js\";\nimport { InspectorOverlay } from \"./components/InspectorOverlay.js\";\nimport { createInspectorController } from \"./inspectorController.js\";\nimport type {\n InspectedComponent,\n InspectorController,\n InspectorState as InspectorControllerState,\n} from \"./types.js\";\n\nexport interface ClickToInspectOptions {\n containerElement?: HTMLElement;\n renderTarget?: HTMLElement;\n onSelect?: (component: InspectedComponent) => void;\n onActivate?: () => void;\n onDeactivate?: () => void;\n}\n\nexport interface InspectorState {\n active: boolean;\n hoveredElement: HTMLElement | null;\n hoveredComponentId: string | null;\n selectedComponentId: string | null;\n}\n\nexport class ClickToInspectSystem {\n private state: InspectorState = {\n active: false,\n hoveredElement: null,\n hoveredComponentId: null,\n selectedComponentId: null,\n };\n\n private readonly options: ClickToInspectOptions;\n private inspectorController: InspectorController | null = null;\n private bannerContainer: HTMLDivElement | null = null;\n private bannerRoot: Root | null = null;\n private overlayContainer: HTMLDivElement | null = null;\n private overlayRoot: Root | null = null;\n private stateUnsubscribe: (() => void) | null = null;\n private eventHandlers: Map<\n string,\n { eventType: string; handler: EventListener }\n > = new Map();\n\n constructor(options: ClickToInspectOptions = {}) {\n this.options = options;\n this.setupKeyboardShortcuts();\n }\n\n activate(): void {\n if (this.state.active) {\n return;\n }\n\n this.state.active = true;\n\n this.inspectorController = createInspectorController({\n containerElement: this.options.containerElement,\n eventHandlers: {\n onActivate: () => {\n this.options.onActivate?.();\n },\n onDeactivate: () => {\n this.deactivate();\n },\n onSelect: (component: InspectedComponent) => {\n this.handleComponentSelected(component);\n },\n onHover: (component: InspectedComponent | null) => {\n if (component) {\n this.state.hoveredComponentId = component.name;\n } else {\n this.state.hoveredComponentId = null;\n }\n },\n },\n });\n\n this.inspectorController.activate();\n\n this.showOverlay();\n this.showBanner();\n this.setCursor(\"crosshair\");\n }\n\n private showOverlay(): void {\n const renderTarget = this.options.renderTarget ?? document.body;\n\n if (!this.overlayContainer) {\n this.overlayContainer = document.createElement(\"div\");\n this.overlayContainer.id = \"osdk-inspector-overlay\";\n this.overlayContainer.setAttribute(\"data-osdk-devtools-ignore\", \"\");\n renderTarget.appendChild(this.overlayContainer);\n this.overlayRoot = createRoot(this.overlayContainer);\n }\n\n if (this.inspectorController) {\n this.stateUnsubscribe = this.inspectorController.subscribe(\n (controllerState) => {\n this.renderOverlay(controllerState);\n },\n );\n\n this.renderOverlay(this.inspectorController.getState());\n }\n }\n\n private renderOverlay(controllerState: InspectorControllerState): void {\n if (!this.overlayRoot) {\n return;\n }\n\n this.overlayRoot.render(\n React.createElement(InspectorOverlay, {\n state: controllerState,\n }),\n );\n }\n\n private hideOverlay(): void {\n if (this.stateUnsubscribe) {\n this.stateUnsubscribe();\n this.stateUnsubscribe = null;\n }\n\n if (this.overlayRoot) {\n this.overlayRoot.render(\n React.createElement(InspectorOverlay, {\n state: {\n mode: \"inactive\",\n mouseX: -9999,\n mouseY: -9999,\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 );\n }\n }\n\n private showBanner(): void {\n const renderTarget = this.options.renderTarget ?? document.body;\n\n if (!this.bannerContainer) {\n this.bannerContainer = document.createElement(\"div\");\n this.bannerContainer.id = \"osdk-inspector-banner\";\n renderTarget.appendChild(this.bannerContainer);\n this.bannerRoot = createRoot(this.bannerContainer);\n }\n\n this.bannerRoot?.render(\n React.createElement(InspectorBanner, { visible: true }),\n );\n }\n\n private hideBanner(): void {\n if (this.bannerRoot) {\n this.bannerRoot.render(\n React.createElement(InspectorBanner, { visible: false }),\n );\n }\n }\n\n private handleComponentSelected(component: InspectedComponent): void {\n this.state.selectedComponentId = component.name;\n this.options.onSelect?.(component);\n this.deactivate();\n }\n\n deactivate(): void {\n if (!this.state.active) {\n return;\n }\n\n this.state.active = false;\n\n this.hideOverlay();\n\n if (this.inspectorController) {\n this.inspectorController.destroy();\n this.inspectorController = null;\n }\n\n this.hideBanner();\n this.setCursor(\"default\");\n this.clearHover();\n\n this.options.onDeactivate?.();\n }\n\n toggle(): void {\n if (this.state.active) {\n this.deactivate();\n } else {\n this.activate();\n }\n }\n\n private setupKeyboardShortcuts(): void {\n const existing = this.eventHandlers.get(\"keydown-global\");\n if (existing) {\n window.removeEventListener(existing.eventType, existing.handler, true);\n this.eventHandlers.delete(\"keydown-global\");\n }\n\n const handler = (e: Event) => {\n const keyEvent = e as KeyboardEvent;\n\n if (\n (keyEvent.ctrlKey || keyEvent.metaKey) && keyEvent.shiftKey\n && keyEvent.key === \"C\"\n ) {\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n this.toggle();\n }\n\n if (keyEvent.key === \"Escape\" && this.state.active) {\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n this.deactivate();\n }\n };\n\n window.addEventListener(\"keydown\", handler, true);\n this.eventHandlers.set(\"keydown-global\", { eventType: \"keydown\", handler });\n }\n\n private clearHover(): void {\n this.state.hoveredElement = null;\n this.state.hoveredComponentId = null;\n }\n\n private setCursor(cursor: string): void {\n document.body.style.cursor = cursor;\n }\n\n dispose(): void {\n this.deactivate();\n\n for (const { eventType, handler } of this.eventHandlers.values()) {\n window.removeEventListener(eventType, handler, true);\n }\n this.eventHandlers.clear();\n\n if (this.bannerRoot) {\n this.bannerRoot.unmount();\n this.bannerRoot = null;\n }\n if (this.bannerContainer) {\n this.bannerContainer.remove();\n this.bannerContainer = null;\n }\n\n if (this.overlayRoot) {\n this.overlayRoot.unmount();\n this.overlayRoot = null;\n }\n if (this.overlayContainer) {\n this.overlayContainer.remove();\n this.overlayContainer = null;\n }\n }\n\n getState(): InspectorState {\n return { ...this.state };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAmB,kBAAkB;AACxD,SAASC,eAAe,QAAQ,iCAAiC;AACjE,SAASC,gBAAgB,QAAQ,kCAAkC;AACnE,SAASC,yBAAyB,QAAQ,0BAA0B;AAsBpE,OAA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C,mBAAmB,CAACC,SAAS,EAAEC,OAAO,EAAE,IAAI,CAAC;IACtD;IACA,IAAI,CAACnD,aAAa,CAACmE,KAAK,CAAC,CAAC;IAE1B,IAAI,IAAI,CAACvE,UAAU,EAAE;MACnB,IAAI,CAACA,UAAU,CAACwE,OAAO,CAAC,CAAC;MACzB,IAAI,CAACxE,UAAU,GAAG,IAAI;IACxB;IACA,IAAI,IAAI,CAACD,eAAe,EAAE;MACxB,IAAI,CAACA,eAAe,CAAC0E,MAAM,CAAC,CAAC;MAC7B,IAAI,CAAC1E,eAAe,GAAG,IAAI;IAC7B;IAEA,IAAI,IAAI,CAACG,WAAW,EAAE;MACpB,IAAI,CAACA,WAAW,CAACsE,OAAO,CAAC,CAAC;MAC1B,IAAI,CAACtE,WAAW,GAAG,IAAI;IACzB;IACA,IAAI,IAAI,CAACD,gBAAgB,EAAE;MACzB,IAAI,CAACA,gBAAgB,CAACwE,MAAM,CAAC,CAAC;MAC9B,IAAI,CAACxE,gBAAgB,GAAG,IAAI;IAC9B;EACF;EAEA+B,QAAQA,CAAA,EAAmB;IACzB,OAAO;MAAE,GAAG,IAAI,CAACvC;IAAM,CAAC;EAC1B;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ClickToInspectSystem.js","names":["React","createRoot","InspectorBanner","InspectorOverlay","createInspectorController","ClickToInspectSystem","state","active","hoveredElement","hoveredComponentId","selectedComponentId","inspectorController","bannerContainer","bannerRoot","overlayContainer","overlayRoot","stateUnsubscribe","eventHandlers","Map","constructor","options","setupKeyboardShortcuts","activate","containerElement","onActivate","onDeactivate","deactivate","onSelect","component","handleComponentSelected","onHover","name","showOverlay","showBanner","setCursor","renderTarget","document","body","createElement","id","setAttribute","appendChild","subscribe","controllerState","renderOverlay","getState","render","hideOverlay","mode","mouseX","mouseY","selectedElement","frozenElement","inspectedComponent","selectionBounds","labelPosition","labelStatus","viewportVersion","visible","hideBanner","destroy","clearHover","toggle","existing","get","window","removeEventListener","eventType","handler","delete","e","keyEvent","ctrlKey","metaKey","shiftKey","key","preventDefault","stopPropagation","addEventListener","set","cursor","style","dispose","values","clear","unmount","remove"],"sources":["ClickToInspectSystem.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 { createRoot, type Root } from \"react-dom/client\";\n\nimport { InspectorBanner } from \"./components/InspectorBanner.js\";\nimport { InspectorOverlay } from \"./components/InspectorOverlay.js\";\nimport { createInspectorController } from \"./inspectorController.js\";\nimport type {\n InspectedComponent,\n InspectorController,\n InspectorState as InspectorControllerState,\n} from \"./types.js\";\n\nexport interface ClickToInspectOptions {\n containerElement?: HTMLElement;\n renderTarget?: HTMLElement;\n onSelect?: (component: InspectedComponent) => void;\n onActivate?: () => void;\n onDeactivate?: () => void;\n}\n\nexport interface InspectorState {\n active: boolean;\n hoveredElement: HTMLElement | null;\n hoveredComponentId: string | null;\n selectedComponentId: string | null;\n}\n\nexport class ClickToInspectSystem {\n private state: InspectorState = {\n active: false,\n hoveredElement: null,\n hoveredComponentId: null,\n selectedComponentId: null,\n };\n\n private readonly options: ClickToInspectOptions;\n private inspectorController: InspectorController | null = null;\n private bannerContainer: HTMLDivElement | null = null;\n private bannerRoot: Root | null = null;\n private overlayContainer: HTMLDivElement | null = null;\n private overlayRoot: Root | null = null;\n private stateUnsubscribe: (() => void) | null = null;\n private eventHandlers = new Map<\n string,\n { eventType: string; handler: EventListener }\n >();\n\n constructor(options: ClickToInspectOptions = {}) {\n this.options = options;\n this.setupKeyboardShortcuts();\n }\n\n activate(): void {\n if (this.state.active) {\n return;\n }\n\n this.state.active = true;\n\n this.inspectorController = createInspectorController({\n containerElement: this.options.containerElement,\n eventHandlers: {\n onActivate: () => {\n this.options.onActivate?.();\n },\n onDeactivate: () => {\n this.deactivate();\n },\n onSelect: (component: InspectedComponent) => {\n this.handleComponentSelected(component);\n },\n onHover: (component: InspectedComponent | null) => {\n if (component) {\n this.state.hoveredComponentId = component.name;\n } else {\n this.state.hoveredComponentId = null;\n }\n },\n },\n });\n\n this.inspectorController.activate();\n\n this.showOverlay();\n this.showBanner();\n this.setCursor(\"crosshair\");\n }\n\n private showOverlay(): void {\n const renderTarget = this.options.renderTarget ?? document.body;\n\n if (!this.overlayContainer) {\n this.overlayContainer = document.createElement(\"div\");\n this.overlayContainer.id = \"osdk-inspector-overlay\";\n this.overlayContainer.setAttribute(\"data-osdk-devtools-ignore\", \"\");\n renderTarget.appendChild(this.overlayContainer);\n this.overlayRoot = createRoot(this.overlayContainer);\n }\n\n if (this.inspectorController) {\n this.stateUnsubscribe = this.inspectorController.subscribe(\n (controllerState) => {\n this.renderOverlay(controllerState);\n }\n );\n\n this.renderOverlay(this.inspectorController.getState());\n }\n }\n\n private renderOverlay(controllerState: InspectorControllerState): void {\n if (!this.overlayRoot) {\n return;\n }\n\n this.overlayRoot.render(\n React.createElement(InspectorOverlay, {\n state: controllerState,\n })\n );\n }\n\n private hideOverlay(): void {\n if (this.stateUnsubscribe) {\n this.stateUnsubscribe();\n this.stateUnsubscribe = null;\n }\n\n if (this.overlayRoot) {\n this.overlayRoot.render(\n React.createElement(InspectorOverlay, {\n state: {\n mode: \"inactive\",\n mouseX: -9999,\n mouseY: -9999,\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 );\n }\n }\n\n private showBanner(): void {\n const renderTarget = this.options.renderTarget ?? document.body;\n\n if (!this.bannerContainer) {\n this.bannerContainer = document.createElement(\"div\");\n this.bannerContainer.id = \"osdk-inspector-banner\";\n renderTarget.appendChild(this.bannerContainer);\n this.bannerRoot = createRoot(this.bannerContainer);\n }\n\n this.bannerRoot?.render(\n React.createElement(InspectorBanner, { visible: true })\n );\n }\n\n private hideBanner(): void {\n if (this.bannerRoot) {\n this.bannerRoot.render(\n React.createElement(InspectorBanner, { visible: false })\n );\n }\n }\n\n private handleComponentSelected(component: InspectedComponent): void {\n this.state.selectedComponentId = component.name;\n this.options.onSelect?.(component);\n this.deactivate();\n }\n\n deactivate(): void {\n if (!this.state.active) {\n return;\n }\n\n this.state.active = false;\n\n this.hideOverlay();\n\n if (this.inspectorController) {\n this.inspectorController.destroy();\n this.inspectorController = null;\n }\n\n this.hideBanner();\n this.setCursor(\"default\");\n this.clearHover();\n\n this.options.onDeactivate?.();\n }\n\n toggle(): void {\n if (this.state.active) {\n this.deactivate();\n } else {\n this.activate();\n }\n }\n\n private setupKeyboardShortcuts(): void {\n const existing = this.eventHandlers.get(\"keydown-global\");\n if (existing) {\n window.removeEventListener(existing.eventType, existing.handler, true);\n this.eventHandlers.delete(\"keydown-global\");\n }\n\n const handler = (e: Event) => {\n const keyEvent = e as KeyboardEvent;\n\n if (\n (keyEvent.ctrlKey || keyEvent.metaKey) &&\n keyEvent.shiftKey &&\n keyEvent.key === \"C\"\n ) {\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n this.toggle();\n }\n\n if (keyEvent.key === \"Escape\" && this.state.active) {\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n this.deactivate();\n }\n };\n\n window.addEventListener(\"keydown\", handler, true);\n this.eventHandlers.set(\"keydown-global\", { eventType: \"keydown\", handler });\n }\n\n private clearHover(): void {\n this.state.hoveredElement = null;\n this.state.hoveredComponentId = null;\n }\n\n private setCursor(cursor: string): void {\n document.body.style.cursor = cursor;\n }\n\n dispose(): void {\n this.deactivate();\n\n for (const { eventType, handler } of this.eventHandlers.values()) {\n window.removeEventListener(eventType, handler, true);\n }\n this.eventHandlers.clear();\n\n if (this.bannerRoot) {\n this.bannerRoot.unmount();\n this.bannerRoot = null;\n }\n if (this.bannerContainer) {\n this.bannerContainer.remove();\n this.bannerContainer = null;\n }\n\n if (this.overlayRoot) {\n this.overlayRoot.unmount();\n this.overlayRoot = null;\n }\n if (this.overlayContainer) {\n this.overlayContainer.remove();\n this.overlayContainer = null;\n }\n }\n\n getState(): InspectorState {\n return { ...this.state };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAmB,kBAAkB;AAExD,SAASC,eAAe,QAAQ,iCAAiC;AACjE,SAASC,gBAAgB,QAAQ,kCAAkC;AACnE,SAASC,yBAAyB,QAAQ,0BAA0B;AAsBpE,OAAO,MAAMC,oBAAoB,CAAC;EACxBC,KAAK,GAAmB;IAC9BC,MAAM,EAAE,KAAK;IACbC,cAAc,EAAE,IAAI;IACpBC,kBAAkB,EAAE,IAAI;IACxBC,mBAAmB,EAAE;EACvB,CAAC;EAGOC,mBAAmB,GAA+B,IAAI;EACtDC,eAAe,GAA0B,IAAI;EAC7CC,UAAU,GAAgB,IAAI;EAC9BC,gBAAgB,GAA0B,IAAI;EAC9CC,WAAW,GAAgB,IAAI;EAC/BC,gBAAgB,GAAwB,IAAI;EAC5CC,aAAa,GAAG,IAAIC,GAAG,CAG7B,CAAC;EAEHC,WAAWA,CAACC,OAA8B,GAAG,CAAC,CAAC,EAAE;IAC/C,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,sBAAsB,CAAC,CAAC;EAC/B;EAEAC,QAAQA,CAAA,EAAS;IACf,IAAI,IAAI,CAAChB,KAAK,CAACC,MAAM,EAAE;MACrB;IACF;IAEA,IAAI,CAACD,KAAK,CAACC,MAAM,GAAG,IAAI;IAExB,IAAI,CAACI,mBAAmB,GAAGP,yBAAyB,CAAC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,GAAG,IAAI,CAACvC;IAAM,CAAC;EAC1B;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentLabel.js","names":["React","useCallback","useRef","useState","computeLabelPosition","OFFSCREEN_POSITION","styles","ARROW_HEIGHT","COPY_FEEDBACK_DURATION_MS","EMPTY_SIZE","width","height","useElementSize","ref","sizeRef","subscribe","onStoreChange","el","current","measure","rect","getBoundingClientRect","next","observer","ResizeObserver","observe","disconnect","getSnapshot","useSyncExternalStore","ComponentLabel","component","bounds","mouseX","mouseY","status","onOpenSource","visible","containerRef","measuredSize","showCopied","setShowCopied","copyTimeoutRef","position","useMemo","handleSourceClick","sourceLocation","handleCopySourceLocation","loc","fullPath","columnNumber","fileName","lineNumber","navigator","clipboard","writeText","then","clearTimeout","setTimeout","catch","arrowStyle","left","arrowLeft","arrowPosition","top","borderBottom","bottom","borderTop","createElement","className","label","style","opacity","arrow","componentName","name","hookCount","hookBadge","sourceRow","onClick","viewBox","fill","stroke","strokeWidth","d","points","split","pop","type","copyButton","title","x","y","rx","ry","copiedText"],"sources":["ComponentLabel.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 React, { useCallback, useRef, useState } from \"react\";\nimport type { SourceLocation } from \"../../fiber/types.js\";\nimport type { ComponentLabelProps, LabelPosition } from \"../types.js\";\nimport {\n computeLabelPosition,\n OFFSCREEN_POSITION,\n} from \"../utils/labelPositioning.js\";\nimport styles from \"./ComponentLabel.module.scss\";\n\nconst ARROW_HEIGHT = 8;\nconst COPY_FEEDBACK_DURATION_MS = 1500;\n\ninterface SizeSnapshot {\n width: number;\n height: number;\n}\n\nconst EMPTY_SIZE: SizeSnapshot = { width: 0, height: 0 };\n\nfunction useElementSize(\n ref: React.RefObject<HTMLDivElement | null>,\n): SizeSnapshot {\n const sizeRef = useRef<SizeSnapshot>(EMPTY_SIZE);\n\n const subscribe = React.useCallback((onStoreChange: () => void) => {\n const el = ref.current;\n if (!el) {\n return () => {};\n }\n\n const measure = () => {\n const rect = el.getBoundingClientRect();\n const next = { width: rect.width, height: rect.height };\n if (\n next.width !== sizeRef.current.width\n || next.height !== sizeRef.current.height\n ) {\n sizeRef.current = next;\n onStoreChange();\n }\n };\n\n measure();\n\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => observer.disconnect();\n }, [ref]);\n\n const getSnapshot = React.useCallback(() => sizeRef.current, []);\n\n return React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\nexport function ComponentLabel({\n component,\n bounds,\n mouseX,\n mouseY,\n status,\n onOpenSource,\n visible,\n}: ComponentLabelProps): React.ReactElement | null {\n const containerRef = useRef<HTMLDivElement>(null);\n const measuredSize = useElementSize(containerRef);\n const [showCopied, setShowCopied] = useState(false);\n const copyTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const position: LabelPosition = React.useMemo(() => {\n if (!bounds || measuredSize.width === 0 || measuredSize.height === 0) {\n return OFFSCREEN_POSITION;\n }\n\n return computeLabelPosition(\n bounds,\n measuredSize.width,\n measuredSize.height,\n mouseX,\n );\n }, [bounds, measuredSize.width, measuredSize.height, mouseX]);\n\n const handleSourceClick = useCallback(() => {\n if (component?.sourceLocation && onOpenSource) {\n onOpenSource(component.sourceLocation);\n }\n }, [component?.sourceLocation, onOpenSource]);\n\n const handleCopySourceLocation = useCallback(() => {\n if (!component?.sourceLocation) {\n return;\n }\n\n const loc = component.sourceLocation;\n const fullPath = loc.columnNumber\n ? `${loc.fileName}:${loc.lineNumber}:${loc.columnNumber}`\n : `${loc.fileName}:${loc.lineNumber}`;\n\n navigator.clipboard.writeText(fullPath).then(() => {\n if (copyTimeoutRef.current) {\n clearTimeout(copyTimeoutRef.current);\n }\n\n setShowCopied(true);\n copyTimeoutRef.current = setTimeout(() => {\n setShowCopied(false);\n copyTimeoutRef.current = null;\n }, COPY_FEEDBACK_DURATION_MS);\n }).catch(() => {\n });\n }, [component?.sourceLocation]);\n\n if (!component || !visible) {\n return null;\n }\n\n const arrowStyle: React.CSSProperties = {\n left: `${position.arrowLeft - 8}px`,\n ...(position.arrowPosition === \"bottom\"\n ? {\n top: `-${ARROW_HEIGHT}px`,\n borderBottom: \"8px solid rgba(30, 30, 30, 0.95)\",\n }\n : {\n bottom: `-${ARROW_HEIGHT}px`,\n borderTop: \"8px solid rgba(30, 30, 30, 0.95)\",\n }),\n };\n\n const formatSourceLocation = (loc: SourceLocation): string => {\n const fileName = loc.fileName.split(\"/\").pop() ?? loc.fileName;\n return loc.columnNumber\n ? `${fileName}:${loc.lineNumber}:${loc.columnNumber}`\n : `${fileName}:${loc.lineNumber}`;\n };\n\n return (\n <div\n ref={containerRef}\n data-osdk-devtools-ignore={true}\n className={styles.label}\n style={{\n left: `${position.left}px`,\n top: `${position.top}px`,\n opacity: visible && position.left > -9000 ? 1 : 0,\n }}\n >\n <div className={styles.arrow} style={arrowStyle} />\n <div className={styles.componentName}>\n {\"<\"}\n {component.name}\n {\" />\"}\n {component.hookCount > 0 && (\n <span className={styles.hookBadge}>\n {component.hookCount} hook{component.hookCount !== 1 ? \"s\" : \"\"}\n </span>\n )}\n </div>\n {component.sourceLocation && (\n <div className={styles.sourceRow}>\n <div\n className={styles.sourceLocation}\n onClick={handleSourceClick}\n >\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n >\n <path d=\"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z\" />\n <polyline points=\"13 2 13 9 20 9\" />\n </svg>\n {formatSourceLocation(component.sourceLocation)}\n </div>\n <button\n type=\"button\"\n className={styles.copyButton}\n onClick={handleCopySourceLocation}\n title=\"Copy source location\"\n >\n {showCopied\n ? (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"#22c55e\"\n strokeWidth=\"2\"\n >\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n )\n : (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n >\n <rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\" />\n <path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\" />\n </svg>\n )}\n </button>\n {showCopied && <span className={styles.copiedText}>Copied!</span>}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAG5D,SACEC,oBAAoB,EACpBC,kBAAkB,QACb,8BAA8B;AACrC,OAAOC,MAAM,MAAM,8BAA8B;AAEjD,MAAMC,YAAY,GAAG,CAAC;AACtB,MAAMC,yBAAyB,GAAG,IAAI;AAOtC,MAAMC,UAAwB,GAAG;EAAEC,KAAK,EAAE,CAAC;EAAEC,MAAM,EAAE;AAAE,CAAC;AAExD,SAASC,cAAcA,CACrBC,GAA2C,EAC7B;EACd,MAAMC,OAAO,GAAGZ,MAAM,CAAeO,UAAU,CAAC;EAEhD,MAAMM,SAAS,GAAGf,KAAK,CAACC,WAAW,CAAEe,aAAyB,IAAK;IACjE,MAAMC,EAAE,GAAGJ,GAAG,CAACK,OAAO;IACtB,IAAI,CAAC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C,wBAAyB;IAClC2C,KAAK,EAAC;EAAsB,GAE3BlD,UAAU,gBAEPvC,KAAA,CAAAmE,aAAA;IACEzD,KAAK,EAAC,IAAI;IACVC,MAAM,EAAC,IAAI;IACXoE,OAAO,EAAC,WAAW;IACnBC,IAAI,EAAC,MAAM;IACXC,MAAM,EAAC,SAAS;IAChBC,WAAW,EAAC;EAAG,gBAEflF,KAAA,CAAAmE,aAAA;IAAUiB,MAAM,EAAC;EAAgB,CAAE,CAChC,CAAC,gBAGNpF,KAAA,CAAAmE,aAAA;IACEzD,KAAK,EAAC,IAAI;IACVC,MAAM,EAAC,IAAI;IACXoE,OAAO,EAAC,WAAW;IACnBC,IAAI,EAAC,MAAM;IACXC,MAAM,EAAC,cAAc;IACrBC,WAAW,EAAC;EAAG,gBAEflF,KAAA,CAAAmE,aAAA;IAAMuB,CAAC,EAAC,GAAG;IAACC,CAAC,EAAC,GAAG;IAACjF,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC,IAAI;IAACiF,EAAE,EAAC,GAAG;IAACC,EAAE,EAAC;EAAG,CAAE,CAAC,eACzD7F,KAAA,CAAAmE,aAAA;IAAMgB,CAAC,EAAC;EAAyD,CAAE,CAChE,CAEH,CAAC,EACR5C,UAAU,iBAAIvC,KAAA,CAAAmE,aAAA;IAAMC,SAAS,EAAE9D,MAAM,CAACwF;EAAW,GAAC,SAAa,CAC7D,CAEJ,CAAC;AAEV","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ComponentLabel.js","names":["React","useCallback","useRef","useState","computeLabelPosition","OFFSCREEN_POSITION","styles","ARROW_HEIGHT","COPY_FEEDBACK_DURATION_MS","EMPTY_SIZE","width","height","useElementSize","ref","sizeRef","subscribe","onStoreChange","el","current","measure","rect","getBoundingClientRect","next","observer","ResizeObserver","observe","disconnect","getSnapshot","useSyncExternalStore","ComponentLabel","component","bounds","mouseX","mouseY","status","onOpenSource","visible","containerRef","measuredSize","showCopied","setShowCopied","copyTimeoutRef","position","useMemo","handleSourceClick","sourceLocation","handleCopySourceLocation","loc","fullPath","columnNumber","fileName","lineNumber","navigator","clipboard","writeText","then","clearTimeout","setTimeout","catch","arrowStyle","left","arrowLeft","arrowPosition","top","borderBottom","bottom","borderTop","createElement","className","label","style","opacity","arrow","componentName","name","hookCount","hookBadge","sourceRow","onClick","viewBox","fill","stroke","strokeWidth","d","points","split","pop","type","copyButton","title","x","y","rx","ry","copiedText"],"sources":["ComponentLabel.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 React, { useCallback, useRef, useState } from \"react\";\n\nimport type { SourceLocation } from \"../../fiber/types.js\";\nimport type { ComponentLabelProps, LabelPosition } from \"../types.js\";\nimport {\n computeLabelPosition,\n OFFSCREEN_POSITION,\n} from \"../utils/labelPositioning.js\";\n\nimport styles from \"./ComponentLabel.module.scss\";\n\nconst ARROW_HEIGHT = 8;\nconst COPY_FEEDBACK_DURATION_MS = 1500;\n\ninterface SizeSnapshot {\n width: number;\n height: number;\n}\n\nconst EMPTY_SIZE: SizeSnapshot = { width: 0, height: 0 };\n\nfunction useElementSize(\n ref: React.RefObject<HTMLDivElement | null>\n): SizeSnapshot {\n const sizeRef = useRef<SizeSnapshot>(EMPTY_SIZE);\n\n const subscribe = React.useCallback(\n (onStoreChange: () => void) => {\n const el = ref.current;\n if (!el) {\n return () => {};\n }\n\n const measure = () => {\n const rect = el.getBoundingClientRect();\n const next = { width: rect.width, height: rect.height };\n if (\n next.width !== sizeRef.current.width ||\n next.height !== sizeRef.current.height\n ) {\n sizeRef.current = next;\n onStoreChange();\n }\n };\n\n measure();\n\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => observer.disconnect();\n },\n [ref]\n );\n\n const getSnapshot = React.useCallback(() => sizeRef.current, []);\n\n return React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\nexport function ComponentLabel({\n component,\n bounds,\n mouseX,\n mouseY,\n status,\n onOpenSource,\n visible,\n}: ComponentLabelProps): React.ReactElement | null {\n const containerRef = useRef<HTMLDivElement>(null);\n const measuredSize = useElementSize(containerRef);\n const [showCopied, setShowCopied] = useState(false);\n const copyTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const position: LabelPosition = React.useMemo(() => {\n if (!bounds || measuredSize.width === 0 || measuredSize.height === 0) {\n return OFFSCREEN_POSITION;\n }\n\n return computeLabelPosition(\n bounds,\n measuredSize.width,\n measuredSize.height,\n mouseX\n );\n }, [bounds, measuredSize.width, measuredSize.height, mouseX]);\n\n const handleSourceClick = useCallback(() => {\n if (component?.sourceLocation && onOpenSource) {\n onOpenSource(component.sourceLocation);\n }\n }, [component?.sourceLocation, onOpenSource]);\n\n const handleCopySourceLocation = useCallback(() => {\n if (!component?.sourceLocation) {\n return;\n }\n\n const loc = component.sourceLocation;\n const fullPath = loc.columnNumber\n ? `${loc.fileName}:${loc.lineNumber}:${loc.columnNumber}`\n : `${loc.fileName}:${loc.lineNumber}`;\n\n navigator.clipboard\n .writeText(fullPath)\n .then(() => {\n if (copyTimeoutRef.current) {\n clearTimeout(copyTimeoutRef.current);\n }\n\n setShowCopied(true);\n copyTimeoutRef.current = setTimeout(() => {\n setShowCopied(false);\n copyTimeoutRef.current = null;\n }, COPY_FEEDBACK_DURATION_MS);\n })\n .catch(() => {});\n }, [component?.sourceLocation]);\n\n if (!component || !visible) {\n return null;\n }\n\n const arrowStyle: React.CSSProperties = {\n left: `${position.arrowLeft - 8}px`,\n ...(position.arrowPosition === \"bottom\"\n ? {\n top: `-${ARROW_HEIGHT}px`,\n borderBottom: \"8px solid rgba(30, 30, 30, 0.95)\",\n }\n : {\n bottom: `-${ARROW_HEIGHT}px`,\n borderTop: \"8px solid rgba(30, 30, 30, 0.95)\",\n }),\n };\n\n const formatSourceLocation = (loc: SourceLocation): string => {\n const fileName = loc.fileName.split(\"/\").pop() ?? loc.fileName;\n return loc.columnNumber\n ? `${fileName}:${loc.lineNumber}:${loc.columnNumber}`\n : `${fileName}:${loc.lineNumber}`;\n };\n\n return (\n <div\n ref={containerRef}\n data-osdk-devtools-ignore={true}\n className={styles.label}\n style={{\n left: `${position.left}px`,\n top: `${position.top}px`,\n opacity: visible && position.left > -9000 ? 1 : 0,\n }}\n >\n <div className={styles.arrow} style={arrowStyle} />\n <div className={styles.componentName}>\n {\"<\"}\n {component.name}\n {\" />\"}\n {component.hookCount > 0 && (\n <span className={styles.hookBadge}>\n {component.hookCount} hook{component.hookCount !== 1 ? \"s\" : \"\"}\n </span>\n )}\n </div>\n {component.sourceLocation && (\n <div className={styles.sourceRow}>\n <div className={styles.sourceLocation} onClick={handleSourceClick}>\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n >\n <path d=\"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z\" />\n <polyline points=\"13 2 13 9 20 9\" />\n </svg>\n {formatSourceLocation(component.sourceLocation)}\n </div>\n <button\n type=\"button\"\n className={styles.copyButton}\n onClick={handleCopySourceLocation}\n title=\"Copy source location\"\n >\n {showCopied ? (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"#22c55e\"\n strokeWidth=\"2\"\n >\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n ) : (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n >\n <rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\" />\n <path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\" />\n </svg>\n )}\n </button>\n {showCopied && <span className={styles.copiedText}>Copied!</span>}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAI5D,SACEC,oBAAoB,EACpBC,kBAAkB,QACb,8BAA8B;AAErC,OAAOC,MAAM,MAAM,8BAA8B;AAEjD,MAAMC,YAAY,GAAG,CAAC;AACtB,MAAMC,yBAAyB,GAAG,IAAI;AAOtC,MAAMC,UAAwB,GAAG;EAAEC,KAAK,EAAE,CAAC;EAAEC,MAAM,EAAE;AAAE,CAAC;AAExD,SAASC,cAAcA,CACrBC,GAA2C,EAC7B;EACd,MAAMC,OAAO,GAAGZ,MAAM,CAAeO,UAAU,CAAC;EAEhD,MAAMM,SAAS,GAAGf,KAAK,CAACC,WAAW,CAChCe,aAAyB,IAAK;IAC7B,MAAMC,EAAE,GAAGJ,GAAG,CAACK,OAAO;IACtB,IAAI,CAACD,EAAE,EAAE;MACP,OAAO,MAAM,CAAC,CAAC;IACjB;IAEA,MAAME,OAAO,GAAGA,CAAA,KAAM;MACpB,MAAMC,IAAI,GAAGH,EAAE,CAACI,qBAAqB,CAAC,CAAC;MACvC,MAAMC,IAAI,GAAG;QAAEZ,KAAK,EAAEU,IAAI,CAACV,KAAK;QAAEC,MAAM,EAAES,IAAI,CAACT;MAAO,CAAC;MACvD,IACEW,IAAI,CAACZ,KAAK,KAAKI,OAAO,CAACI,OAAO,CAACR,KAAK,IACpCY,IAAI,CAACX,MAAM,KAAKG,OAAO,CAACI,OAAO,CAACP,MAAM,EACtC;QACAG,OAAO,CAACI,O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ACnBC,IAAI,EAAC,MAAM;IACXC,MAAM,EAAC,cAAc;IACrBC,WAAW,EAAC;EAAG,gBAEflF,KAAA,CAAAmE,aAAA;IAAMuB,CAAC,EAAC,GAAG;IAACC,CAAC,EAAC,GAAG;IAACjF,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC,IAAI;IAACiF,EAAE,EAAC,GAAG;IAACC,EAAE,EAAC;EAAG,CAAE,CAAC,eACzD7F,KAAA,CAAAmE,aAAA;IAAMgB,CAAC,EAAC;EAAyD,CAAE,CAChE,CAED,CAAC,EACR5C,UAAU,iBAAIvC,KAAA,CAAAmE,aAAA;IAAMC,SAAS,EAAE9D,MAAM,CAACwF;EAAW,GAAC,SAAa,CAC7D,CAEJ,CAAC;AAEV","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InspectorBanner.js","names":["React","bannerStyles","position","top","left","transform","background","color","padding","borderRadius","fontSize","fontWeight","fontFamily","boxShadow","pointerEvents","zIndex","textAlign","transition","containerStyles","display","alignItems","gap","kbdStyles","marginLeft","hintStyles","opacity","InspectorBanner","visible","createElement","style","width","height","viewBox","fill","xmlns","d","stroke","strokeWidth"],"sources":["InspectorBanner.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 React from \"react\";\n\nexport interface InspectorBannerProps {\n visible: boolean;\n}\n\nconst bannerStyles: React.CSSProperties = {\n position: \"fixed\",\n top: 0,\n left: \"50%\",\n transform: \"translateX(-50%)\",\n background: \"linear-gradient(135deg, #667eea 0%, #764ba2 100%)\",\n color: \"white\",\n padding: \"12px 24px\",\n borderRadius: \"0 0 8px 8px\",\n fontSize: \"14px\",\n fontWeight: 600,\n fontFamily: \"system-ui, -apple-system, sans-serif\",\n boxShadow: \"0 4px 12px rgba(0, 0, 0, 0.3)\",\n pointerEvents: \"none\",\n zIndex: 2147483648,\n textAlign: \"center\",\n transition: \"opacity 150ms ease-out, transform 150ms ease-out\",\n};\n\nconst containerStyles: React.CSSProperties = {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"12px\",\n};\n\nconst kbdStyles: React.CSSProperties = {\n background: \"rgba(0, 0, 0, 0.3)\",\n padding: \"2px 6px\",\n borderRadius: \"3px\",\n fontSize: \"12px\",\n marginLeft: \"8px\",\n};\n\nconst hintStyles: React.CSSProperties = {\n fontSize: \"12px\",\n opacity: 0.9,\n};\n\nexport const InspectorBanner: React.FC<InspectorBannerProps> = (\n
|
|
1
|
+
{"version":3,"file":"InspectorBanner.js","names":["React","bannerStyles","position","top","left","transform","background","color","padding","borderRadius","fontSize","fontWeight","fontFamily","boxShadow","pointerEvents","zIndex","textAlign","transition","containerStyles","display","alignItems","gap","kbdStyles","marginLeft","hintStyles","opacity","InspectorBanner","visible","createElement","style","width","height","viewBox","fill","xmlns","d","stroke","strokeWidth"],"sources":["InspectorBanner.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 React from \"react\";\n\nexport interface InspectorBannerProps {\n visible: boolean;\n}\n\nconst bannerStyles: React.CSSProperties = {\n position: \"fixed\",\n top: 0,\n left: \"50%\",\n transform: \"translateX(-50%)\",\n background: \"linear-gradient(135deg, #667eea 0%, #764ba2 100%)\",\n color: \"white\",\n padding: \"12px 24px\",\n borderRadius: \"0 0 8px 8px\",\n fontSize: \"14px\",\n fontWeight: 600,\n fontFamily: \"system-ui, -apple-system, sans-serif\",\n boxShadow: \"0 4px 12px rgba(0, 0, 0, 0.3)\",\n pointerEvents: \"none\",\n zIndex: 2147483648,\n textAlign: \"center\",\n transition: \"opacity 150ms ease-out, transform 150ms ease-out\",\n};\n\nconst containerStyles: React.CSSProperties = {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"12px\",\n};\n\nconst kbdStyles: React.CSSProperties = {\n background: \"rgba(0, 0, 0, 0.3)\",\n padding: \"2px 6px\",\n borderRadius: \"3px\",\n fontSize: \"12px\",\n marginLeft: \"8px\",\n};\n\nconst hintStyles: React.CSSProperties = {\n fontSize: \"12px\",\n opacity: 0.9,\n};\n\nexport const InspectorBanner: React.FC<InspectorBannerProps> = ({\n visible,\n}) => {\n if (!visible) {\n return null;\n }\n\n return (\n <div style={bannerStyles}>\n <div style={containerStyles}>\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M10 2L3 6V10C3 14.5 6.5 18.5 10 19.5C13.5 18.5 17 14.5 17 10V6L10 2Z\"\n stroke=\"white\"\n strokeWidth=\"1.5\"\n fill=\"rgba(255,255,255,0.2)\"\n />\n </svg>\n <span>Click on a component to inspect its OSDK hooks</span>\n <kbd style={kbdStyles}>ESC</kbd>\n <span style={hintStyles}>to exit</span>\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAMzB,MAAMC,YAAiC,GAAG;EACxCC,QAAQ,EAAE,OAAO;EACjBC,GAAG,EAAE,CAAC;EACNC,I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B,CAC7B,CACE,CAAC,eACNjC,KAAA,CAAA4B,aAAA,eAAM,gDAAoD,CAAC,eAC3D5B,KAAA,CAAA4B,aAAA;IAAKC,KAAK,EAAEP;EAAU,GAAC,KAAQ,CAAC,eAChCtB,KAAA,CAAA4B,aAAA;IAAMC,KAAK,EAAEL;EAAW,GAAC,SAAa,CACnC,CACF,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InspectorOverlay.js","names":["React","useCallback","useMemo","useRef","ComponentLabel","SelectionHighlight","FLASH_DURATION_MS","GrabbedFlash","bounds","trigger","previousTriggerRef","flashStateRef","isVisible","opacity","fadeTimer","hideTimer","subscribe","onStoreChange","state","current","clearTimeout","setTimeout","getSnapshot","useSyncExternalStore","createElement","style","position","left","x","top","y","width","height","borderRadius","transform","border","backgroundColor","pointerEvents","zIndex","transition","overlayContainerStyles","InspectorOverlay","eventHandlers","animationOptions","mode","selectionBounds","inspectedComponent","mouseX","mouseY","labelStatus","isFrozen","effectiveZIndex","handleOpenSource","sourceLocation","onOpenSource","containerStyle","variant","visible","component","status"],"sources":["InspectorOverlay.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 React, { useCallback, useMemo, useRef } from \"react\";\nimport type { SourceLocation } from \"../../fiber/types.js\";\nimport type { InspectorOverlayProps, OverlayBounds } from \"../types.js\";\nimport { ComponentLabel } from \"./ComponentLabel.js\";\nimport { SelectionHighlight } from \"./SelectionHighlight.js\";\n\nconst FLASH_DURATION_MS = 500;\n\ninterface GrabbedFlashProps {\n bounds: OverlayBounds | null;\n trigger: boolean;\n}\n\nfunction GrabbedFlash(\n
|
|
1
|
+
{"version":3,"file":"InspectorOverlay.js","names":["React","useCallback","useMemo","useRef","ComponentLabel","SelectionHighlight","FLASH_DURATION_MS","GrabbedFlash","bounds","trigger","previousTriggerRef","flashStateRef","isVisible","opacity","fadeTimer","hideTimer","subscribe","onStoreChange","state","current","clearTimeout","setTimeout","getSnapshot","useSyncExternalStore","createElement","style","position","left","x","top","y","width","height","borderRadius","transform","border","backgroundColor","pointerEvents","zIndex","transition","overlayContainerStyles","InspectorOverlay","eventHandlers","animationOptions","mode","selectionBounds","inspectedComponent","mouseX","mouseY","labelStatus","isFrozen","effectiveZIndex","handleOpenSource","sourceLocation","onOpenSource","containerStyle","variant","visible","component","status"],"sources":["InspectorOverlay.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 React, { useCallback, useMemo, useRef } from \"react\";\n\nimport type { SourceLocation } from \"../../fiber/types.js\";\nimport type { InspectorOverlayProps, OverlayBounds } from \"../types.js\";\nimport { ComponentLabel } from \"./ComponentLabel.js\";\nimport { SelectionHighlight } from \"./SelectionHighlight.js\";\n\nconst FLASH_DURATION_MS = 500;\n\ninterface GrabbedFlashProps {\n bounds: OverlayBounds | null;\n trigger: boolean;\n}\n\nfunction GrabbedFlash({\n bounds,\n trigger,\n}: GrabbedFlashProps): React.ReactElement | null {\n const previousTriggerRef = useRef(trigger);\n const flashStateRef = useRef<{\n isVisible: boolean;\n opacity: number;\n fadeTimer: ReturnType<typeof setTimeout> | null;\n hideTimer: ReturnType<typeof setTimeout> | null;\n }>({ isVisible: false, opacity: 0, fadeTimer: null, hideTimer: null });\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n const state = flashStateRef.current;\n\n if (trigger && !previousTriggerRef.current) {\n if (state.fadeTimer) {\n clearTimeout(state.fadeTimer);\n }\n if (state.hideTimer) {\n clearTimeout(state.hideTimer);\n }\n\n state.isVisible = true;\n state.opacity = 1;\n\n state.fadeTimer = setTimeout(() => {\n state.opacity = 0;\n state.fadeTimer = null;\n onStoreChange();\n }, 50);\n\n state.hideTimer = setTimeout(() => {\n state.isVisible = false;\n state.hideTimer = null;\n onStoreChange();\n }, FLASH_DURATION_MS);\n\n onStoreChange();\n }\n\n previousTriggerRef.current = trigger;\n\n return () => {\n if (state.fadeTimer) {\n clearTimeout(state.fadeTimer);\n state.fadeTimer = null;\n }\n if (state.hideTimer) {\n clearTimeout(state.hideTimer);\n state.hideTimer = null;\n }\n };\n },\n [trigger]\n );\n\n const getSnapshot = useCallback(() => {\n return flashStateRef.current;\n }, []);\n\n const state = React.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n\n if (!state.isVisible || !bounds) {\n return null;\n }\n\n return (\n <div\n data-osdk-devtools-ignore\n style={{\n position: \"fixed\",\n left: bounds.x,\n top: bounds.y,\n width: bounds.width,\n height: bounds.height,\n borderRadius: bounds.borderRadius,\n transform: bounds.transform,\n border: \"3px solid #22c55e\",\n backgroundColor: \"rgba(34, 197, 94, 0.2)\",\n pointerEvents: \"none\",\n zIndex: 2147483645,\n opacity: state.opacity,\n transition: `opacity ${FLASH_DURATION_MS}ms ease-out`,\n }}\n />\n );\n}\n\nconst overlayContainerStyles: React.CSSProperties = {\n position: \"fixed\",\n top: 0,\n left: 0,\n width: 0,\n height: 0,\n pointerEvents: \"none\",\n zIndex: 2147483646,\n};\n\nexport function InspectorOverlay({\n state,\n eventHandlers,\n animationOptions,\n zIndex,\n}: InspectorOverlayProps): React.ReactElement | null {\n const {\n mode,\n selectionBounds,\n inspectedComponent,\n mouseX,\n mouseY,\n labelStatus,\n } = state;\n\n const isActive = mode !== \"inactive\";\n const isFrozen = mode === \"frozen\";\n\n const effectiveZIndex = zIndex ?? 2147483646;\n\n const handleOpenSource = useCallback(\n (sourceLocation: SourceLocation) => {\n eventHandlers?.onOpenSource?.(sourceLocation);\n },\n [eventHandlers]\n );\n\n const containerStyle = useMemo(\n () => ({\n ...overlayContainerStyles,\n zIndex: effectiveZIndex,\n }),\n [effectiveZIndex]\n );\n\n if (!isActive) {\n return null;\n }\n\n return (\n <div data-osdk-devtools-ignore style={containerStyle}>\n <GrabbedFlash bounds={selectionBounds} trigger={isFrozen} />\n\n <SelectionHighlight\n bounds={selectionBounds}\n variant={isFrozen ? \"frozen\" : \"hover\"}\n animationOptions={animationOptions}\n visible={!!selectionBounds}\n />\n\n <ComponentLabel\n component={inspectedComponent}\n bounds={selectionBounds}\n mouseX={mouseX}\n mouseY={mouseY}\n status={labelStatus}\n onOpenSource={handleOpenSource}\n visible={!!inspectedComponent && !!selectionBounds}\n />\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAI3D,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,MAAMC,iBAAiB,GAAG,GAAG;AAO7B,SAASC,YAAYA,CAAC;EACpBC,MAAM;EACNC;AACiB,CAAC,EAA6B;EAC/C,MAAMC,kBAAkB,GAAGP,MAAM,CAACM,OAAO,CAAC;EAC1C,MAAME,aAAa,GAAGR,MAAM,CAKzB;IAAES,SAAS,EAAE,KAAK;IAAEC,OAAO,EAAE,CAAC;IAAEC,SAAS,EAAE,IAAI;IAAEC,SAAS,EAAE;EAAK,CA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AAI,KAAK,QAAQ;EAElC,MAAMO,eAAe,GAAGb,MAAM,IAAI,UAAU;EAE5C,MAAMc,gBAAgB,GAAGnD,WAAW,CACjCoD,cAA8B,IAAK;IAClCX,aAAa,EAAEY,YAAY,GAAGD,cAAc,CAAC;EAC/C,CAAC,EACD,CAACX,aAAa,CAChB,CAAC;EAED,MAAMa,cAAc,GAAGrD,OAAO,CAC5B,OAAO;IACL,GAAGsC,sBAAsB;IACzBF,MAAM,EAAEa;EACV,CAAC,CAAC,EACF,CAACA,eAAe,CAClB,CAAC;EAED,IAAI,EApBaP,IAAI,KAAK,UAAU,CAoBvB,EAAE;IACb,OAAO,IAAI;EACb;EAEA,oBACE5C,KAAA,CAAAwB,aAAA;IAAK,iCAAyB;IAACC,KAAK,EAAE8B;EAAe,gBACnDvD,KAAA,CAAAwB,aAAA,CAACjB,YAAY;IAACC,MAAM,EAAEqC,eAAgB;IAACpC,OAAO,EAAEyC;EAAS,CAAE,CAAC,eAE5DlD,KAAA,CAAAwB,aAAA,CAACnB,kBAAkB;IACjBG,MAAM,EAAEqC,eAAgB;IACxBW,OAAO,EAAEN,QAAQ,GAAG,QAAQ,GAAG,OAAQ;IACvCP,gBAAgB,EAAEA,gBAAiB;IACnCc,OAAO,EAAE,CAAC,CAACZ;EAAgB,CAC5B,CAAC,eAEF7C,KAAA,CAAAwB,aAAA,CAACpB,cAAc;IACbsD,SAAS,EAAEZ,kBAAmB;IAC9BtC,MAAM,EAAEqC,eAAgB;IACxBE,MAAM,EAAEA,MAAO;IACfC,MAAM,EAAEA,MAAO;IACfW,MAAM,EAAEV,WAAY;IACpBK,YAAY,EAAEF,gBAAiB;IAC/BK,OAAO,EAAE,CAAC,CAACX,kBAAkB,IAAI,CAAC,CAACD;EAAgB,CACpD,CACE,CAAC;AAEV","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionHighlight.js","names":["React","useAnimatedBounds","INTERPOLATION_FACTORS","variantColors","hover","border","bg","selected","frozen","baseStyles","position","pointerEvents","zIndex","boxSizing","transition","SelectionHighlight","bounds","variant","animationOptions","visible","colors","effectiveAnimationOptions","interpolationFactor","selection","convergenceThreshold","enabled","animatedBounds","style","left","x","top","y","width","height","borderRadius","transform","backgroundColor","opacity","createElement"],"sources":["SelectionHighlight.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 React from \"react\";\nimport { useAnimatedBounds } from \"../hooks/useAnimatedBounds.js\";\nimport type { HighlightVariant, SelectionHighlightProps } from \"../types.js\";\nimport { INTERPOLATION_FACTORS } from \"../utils/interpolation.js\";\n\nconst variantColors: Record<HighlightVariant, { border: string; bg: string }> =\n {\n hover: {\n border: \"rgba(59, 130, 246, 0.8)\",\n bg: \"rgba(59, 130, 246, 0.1)\",\n },\n selected: {\n border: \"rgba(34, 197, 94, 0.8)\",\n bg: \"rgba(34, 197, 94, 0.15)\",\n },\n frozen: {\n border: \"rgba(168, 85, 247, 0.8)\",\n bg: \"rgba(168, 85, 247, 0.1)\",\n },\n };\n\nconst baseStyles: React.CSSProperties = {\n position: \"fixed\",\n pointerEvents: \"none\",\n zIndex: 2147483646,\n boxSizing: \"border-box\",\n transition: \"opacity 150ms ease-out\",\n};\n\nexport function SelectionHighlight({\n bounds,\n variant,\n animationOptions,\n visible,\n}: SelectionHighlightProps): React.ReactElement | null {\n const colors = variantColors[variant];\n\n const effectiveAnimationOptions = {\n interpolationFactor
|
|
1
|
+
{"version":3,"file":"SelectionHighlight.js","names":["React","useAnimatedBounds","INTERPOLATION_FACTORS","variantColors","hover","border","bg","selected","frozen","baseStyles","position","pointerEvents","zIndex","boxSizing","transition","SelectionHighlight","bounds","variant","animationOptions","visible","colors","effectiveAnimationOptions","interpolationFactor","selection","convergenceThreshold","enabled","animatedBounds","style","left","x","top","y","width","height","borderRadius","transform","backgroundColor","opacity","createElement"],"sources":["SelectionHighlight.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 React from \"react\";\n\nimport { useAnimatedBounds } from \"../hooks/useAnimatedBounds.js\";\nimport type { HighlightVariant, SelectionHighlightProps } from \"../types.js\";\nimport { INTERPOLATION_FACTORS } from \"../utils/interpolation.js\";\n\nconst variantColors: Record<HighlightVariant, { border: string; bg: string }> =\n {\n hover: {\n border: \"rgba(59, 130, 246, 0.8)\",\n bg: \"rgba(59, 130, 246, 0.1)\",\n },\n selected: {\n border: \"rgba(34, 197, 94, 0.8)\",\n bg: \"rgba(34, 197, 94, 0.15)\",\n },\n frozen: {\n border: \"rgba(168, 85, 247, 0.8)\",\n bg: \"rgba(168, 85, 247, 0.1)\",\n },\n };\n\nconst baseStyles: React.CSSProperties = {\n position: \"fixed\",\n pointerEvents: \"none\",\n zIndex: 2147483646,\n boxSizing: \"border-box\",\n transition: \"opacity 150ms ease-out\",\n};\n\nexport function SelectionHighlight({\n bounds,\n variant,\n animationOptions,\n visible,\n}: SelectionHighlightProps): React.ReactElement | null {\n const colors = variantColors[variant];\n\n const effectiveAnimationOptions = {\n interpolationFactor:\n animationOptions?.interpolationFactor ?? INTERPOLATION_FACTORS.selection,\n convergenceThreshold: animationOptions?.convergenceThreshold,\n enabled: animationOptions?.enabled ?? true,\n };\n\n const animatedBounds = useAnimatedBounds(bounds, effectiveAnimationOptions);\n\n if (!animatedBounds || !visible) {\n return null;\n }\n\n const style: React.CSSProperties = {\n ...baseStyles,\n left: `${animatedBounds.x}px`,\n top: `${animatedBounds.y}px`,\n width: `${animatedBounds.width}px`,\n height: `${animatedBounds.height}px`,\n borderRadius: bounds?.borderRadius ?? \"0px\",\n transform: bounds?.transform ?? \"\",\n border: `2px solid ${colors.border}`,\n backgroundColor: colors.bg,\n opacity: visible ? 1 : 0,\n };\n\n return <div data-osdk-devtools-ignore style={style} />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,iBAAiB,QAAQ,+BAA+B;AAEjE,SAASC,qBAAqB,QAAQ,2BAA2B;AAEjE,MAAMC,aAAuE,GAC3E;EACEC,KAAK,EAAE;IACLC,MAAM,EAAE,yBAAyB;IACjCC,EAAE,EAAE;EACN,CAAC;EACDC,QAAQ,EAAE;IACRF,MAAM,EAAE,wBAAwB;IAChCC,EAAE,EAAE;EACN,CAAC;EACDE,MAAM,EAAE;IACNH,MAAM,EAAE,yBAAyB;IACjCC,EAAE,EAAE;EACN;AACF,CAAC;AAEH,MAAMG,UAA+B,GAAG;EACtCC,QAAQ,EAAE,OAAO;EACjBC,aAAa,EAAE,MAAM;EACrBC,MAAM,EAAE,UAAU;EAClBC,SAAS,EAAE,YAAY;EACvBC,UAAU,EAAE;AACd,CAAC;AAED,OAAO,SAASC,kBAAkBA,CAAC;EACjCC,MAAM;EACNC,OAAO;EACPC,gBAAgB;EAChBC;AACuB,CAAC,EAA6B;EACrD,MAAMC,MAAM,GAAGjB,aAAa,CAACc,OAAO,CAAC;EAErC,MAAMI,yBAAyB,GAAG;IAChCC,mBAAmB,EACjBJ,gBAAgB,EAAEI,mBAAmB,IAAIpB,qBAAqB,CAACqB,SAAS;IAC1EC,oBAAoB,EAAEN,gBAAgB,EAAEM,oBAAoB;IAC5DC,OAAO,EAAEP,gBAAgB,EAAEO,OAAO,IAAI;EACxC,CAAC;EAED,MAAMC,cAAc,GAAGzB,iBAAiB,CAACe,MAAM,EAAEK,yBAAyB,CAAC;EAE3E,IAAI,CAACK,cAAc,IAAI,CAACP,OAAO,EAAE;IAC/B,OAAO,IAAI;EACb;EAEA,MAAMQ,KAA0B,GAAG;IACjC,GAAGlB,UAAU;IACbmB,IAAI,EAAE,GAAGF,cAAc,CAACG,CAAC,IAAI;IAC7BC,GAAG,EAAE,GAAGJ,cAAc,CAACK,CAAC,IAAI;IAC5BC,KAAK,EAAE,GAAGN,cAAc,CAACM,KAAK,IAAI;IAClCC,MAAM,EAAE,GAAGP,cAAc,CAACO,MAAM,IAAI;IACpCC,YAAY,EAAElB,MAAM,EAAEkB,YAAY,IAAI,KAAK;IAC3CC,SAAS,EAAEnB,MAAM,EAAEmB,SAAS,IAAI,EAAE;IAClC9B,MAAM,EAAE,aAAae,MAAM,CAACf,MAAM,EAAE;IACpC+B,eAAe,EAAEhB,MAAM,CAACd,EAAE;IAC1B+B,OAAO,EAAElB,OAAO,GAAG,CAAC,GAAG;EACzB,CAAC;EAED,oBAAOnB,KAAA,CAAAsC,aAAA;IAAK,iCAAyB;IAACX,KAAK,EAAEA;EAAM,CAAE,CAAC;AACxD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClickToInspect.js","names":["ClickToInspectSystem","createClickToInspect","options"],"sources":["createClickToInspect.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 {\n type ClickToInspectOptions,\n ClickToInspectSystem,\n} from \"./ClickToInspectSystem.js\";\n\nexport type { ClickToInspectOptions } from \"./ClickToInspectSystem.js\";\n\nexport function createClickToInspect(\n options: ClickToInspectOptions = {}
|
|
1
|
+
{"version":3,"file":"createClickToInspect.js","names":["ClickToInspectSystem","createClickToInspect","options"],"sources":["createClickToInspect.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 {\n type ClickToInspectOptions,\n ClickToInspectSystem,\n} from \"./ClickToInspectSystem.js\";\n\nexport type { ClickToInspectOptions } from \"./ClickToInspectSystem.js\";\n\nexport function createClickToInspect(\n options: ClickToInspectOptions = {}\n): ClickToInspectSystem {\n return new ClickToInspectSystem(options);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEEA,oBAAoB,QACf,2BAA2B;AAIlC,OAAO,SAASC,oBAAoBA,CAClCC,OAA8B,GAAG,CAAC,CAAC,EACb;EACtB,OAAO,IAAIF,oBAAoB,CAACE,OAAO,CAAC;AAC1C","ignoreList":[]}
|
|
@@ -1 +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,Y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Ma,WAAW,GAAGxB,KAAK,CAACkD,WAAW,CAAC,MAA6B;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":[]}
|
|
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\";\n\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 = new Set<() => void>();\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 =\n 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(\n (onStoreChange: () => void) => {\n const store = storeRef.current;\n if (!store) {\n return () => {};\n }\n return store.subscribe(onStoreChange);\n },\n [targetBounds == null]\n );\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;AAOzB,SACEC,6BAA6B,EAC7BC,WAAW,EACXC,qBAAqB,QAChB,2BAA2B;AAElC,MAAMC,oBAAoB,CAAC;EACjBC,OAAO,GAA0B,IAAI;EACrCC,gBAAgB,GAAkB,IAAI;EACtCC,SAAS,GAAG,IAAIC,GAAG,CAAa,CAAC;EACjCC,eAAe,GAAG,KAAK;EAE/BC,WAAWA,CACDC,YAA2B,EAC3BC,mBAA2B,EAC3BC,oBAA4B,EAC5BC,OAAgB,EACxB;IAAA,KAJQH,YAA2B,GAA3BA,YAA2B;IAAA,KAC3BC,mBAA2B,GAA3BA,mBAA2B;IAAA,KAC3BC,oBAA4B,GAA5BA,oBAA4B;IAAA,KAC5BC,OAAgB,GAAhBA,OAAgB;IAExB,IAAI,CAACT,OAAO,GAAG;MACbU,CAAC,EAAEJ,YAAY,CAACI,CAAC;MACjBC,CAAC,EAAEL,YAAY,CAACK,CAAC;MACjBC,KAAK,EAAEN,YAAY,CAACM,KAAK;MACzBC,MAAM,EAAEP,YAAY,CAACO;IACvB,CAAC;IACD,IAAI,CAACT,eAAe,GAAG,IAAI;IAE3B,IAAIK,OAAO,EAAE;MACX,IAAI,CAACK,cAAc,CAAC,CAAC;IACvB;EACF;EAEAC,SAAS,GAAIC,aAAyB,IAAmB;IACvD,IAAI,CAACd,SAAS,CAACe,GAAG,CAACD,aAAa,CAAC;IACjC,OAAO,MAAM;MACX,IAAI,CAACd,SAAS,CAACgB,MAAM,CAACF,aAAa,CAAC;IACtC,CAAC;EACH,CAAC;EAEDG,WAAW,GAAGA,CAAA,KAA6B;IACzC,OAAO,IAAI,CAACnB,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