@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.
Files changed (199) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/esm/DevToolsContext.js.map +1 -1
  3. package/build/esm/components/ActionMetrics.js +2 -2
  4. package/build/esm/components/ActionMetrics.js.map +1 -1
  5. package/build/esm/components/BubbleChart.js +1 -1
  6. package/build/esm/components/BubbleChart.js.map +1 -1
  7. package/build/esm/components/CacheInspectorTab.js +1 -1
  8. package/build/esm/components/CacheInspectorTab.js.map +1 -1
  9. package/build/esm/components/CacheMetrics.js +1 -1
  10. package/build/esm/components/CacheMetrics.js.map +1 -1
  11. package/build/esm/components/ComponentCard.js +1 -1
  12. package/build/esm/components/ComponentCard.js.map +1 -1
  13. package/build/esm/components/ComputeTab.js +6 -6
  14. package/build/esm/components/ComputeTab.js.map +1 -1
  15. package/build/esm/components/CopyableCodeBlock.js.map +1 -1
  16. package/build/esm/components/DebuggingTab.js +2 -2
  17. package/build/esm/components/DebuggingTab.js.map +1 -1
  18. package/build/esm/components/HookRow.js.map +1 -1
  19. package/build/esm/components/ImprovementsTab.js.map +1 -1
  20. package/build/esm/components/InspectorSelectionHeader.js.map +1 -1
  21. package/build/esm/components/InterceptTab.js +5 -5
  22. package/build/esm/components/InterceptTab.js.map +1 -1
  23. package/build/esm/components/IssueCard.js.map +1 -1
  24. package/build/esm/components/LogEntryCard.js.map +1 -1
  25. package/build/esm/components/MockEditor.js.map +1 -1
  26. package/build/esm/components/MonitorErrorBoundary.js.map +1 -1
  27. package/build/esm/components/MonitoringPanel.js +1 -1
  28. package/build/esm/components/MonitoringPanel.js.map +1 -1
  29. package/build/esm/components/ObjectLoadingMetrics.js.map +1 -1
  30. package/build/esm/components/OsdkAppErrorBoundary.js.map +1 -1
  31. package/build/esm/components/OsdkDevTools.js.map +1 -1
  32. package/build/esm/components/OverrideEditor.js.map +1 -1
  33. package/build/esm/components/PerformanceTab.js +8 -8
  34. package/build/esm/components/PerformanceTab.js.map +1 -1
  35. package/build/esm/components/PrimitiveSelectionPanel.js +1 -1
  36. package/build/esm/components/PrimitiveSelectionPanel.js.map +1 -1
  37. package/build/esm/components/resolveComponentName.js +2 -2
  38. package/build/esm/components/resolveComponentName.js.map +1 -1
  39. package/build/esm/components/testHelpers.js.map +1 -1
  40. package/build/esm/fiber/DegradationNotice.js +2 -2
  41. package/build/esm/fiber/DegradationNotice.js.map +1 -1
  42. package/build/esm/fiber/DevtoolsHook.js +4 -4
  43. package/build/esm/fiber/DevtoolsHook.js.map +1 -1
  44. package/build/esm/fiber/FiberAccess.js.map +1 -1
  45. package/build/esm/fiber/FiberInspection.js.map +1 -1
  46. package/build/esm/fiber/FiberTags.js.map +1 -1
  47. package/build/esm/fiber/HookStateInspector.js.map +1 -1
  48. package/build/esm/fiber/SafeFiberOperation.js.map +1 -1
  49. package/build/esm/fiber/capabilities.js.map +1 -1
  50. package/build/esm/fiber/traverseFiber.js.map +1 -1
  51. package/build/esm/fiber/types.js.map +1 -1
  52. package/build/esm/fiber/validation.js +1 -1
  53. package/build/esm/fiber/validation.js.map +1 -1
  54. package/build/esm/hooks/createPollingStore.js.map +1 -1
  55. package/build/esm/hooks/useActiveComponents.js.map +1 -1
  56. package/build/esm/hooks/useComponentRegistry.js.map +1 -1
  57. package/build/esm/hooks/useComputeSelectors.js.map +1 -1
  58. package/build/esm/hooks/useConsoleLogs.js.map +1 -1
  59. package/build/esm/hooks/useInspectorSelection.js.map +1 -1
  60. package/build/esm/hooks/useMetrics.js.map +1 -1
  61. package/build/esm/hooks/usePersistedState.js.map +1 -1
  62. package/build/esm/hooks/useRecommendations.js +1 -1
  63. package/build/esm/hooks/useRecommendations.js.map +1 -1
  64. package/build/esm/hooks/useSharedTick.js.map +1 -1
  65. package/build/esm/hooks/useTimeElapsed.js.map +1 -1
  66. package/build/esm/hooks/useTrackerSubscription.js.map +1 -1
  67. package/build/esm/hooks/useUnusedFieldAnalysis.js.map +1 -1
  68. package/build/esm/inspector/ClickToInspectSystem.js.map +1 -1
  69. package/build/esm/inspector/components/ComponentLabel.js.map +1 -1
  70. package/build/esm/inspector/components/InspectorBanner.js.map +1 -1
  71. package/build/esm/inspector/components/InspectorOverlay.js.map +1 -1
  72. package/build/esm/inspector/components/SelectionHighlight.js.map +1 -1
  73. package/build/esm/inspector/createClickToInspect.js.map +1 -1
  74. package/build/esm/inspector/hooks/useAnimatedBounds.js.map +1 -1
  75. package/build/esm/inspector/inspectorController.js.map +1 -1
  76. package/build/esm/inspector/utils/elementBounds.js.map +1 -1
  77. package/build/esm/inspector/utils/interpolation.js.map +1 -1
  78. package/build/esm/inspector/utils/labelPositioning.js.map +1 -1
  79. package/build/esm/mocking/MockCacheKeyGenerator.js +3 -3
  80. package/build/esm/mocking/MockCacheKeyGenerator.js.map +1 -1
  81. package/build/esm/mocking/MockManager.js +4 -4
  82. package/build/esm/mocking/MockManager.js.map +1 -1
  83. package/build/esm/prototyping/PrototypeOverrideStore.js +1 -1
  84. package/build/esm/prototyping/PrototypeOverrideStore.js.map +1 -1
  85. package/build/esm/register.js.map +1 -1
  86. package/build/esm/store/ComputeStore.js.map +1 -1
  87. package/build/esm/store/ConsoleLogStore.js +2 -2
  88. package/build/esm/store/ConsoleLogStore.js.map +1 -1
  89. package/build/esm/store/MetricsStore.js.map +1 -1
  90. package/build/esm/store/MonitorStore.js.map +1 -1
  91. package/build/esm/store/WindowErrorStore.js.map +1 -1
  92. package/build/esm/styles.js.map +1 -1
  93. package/build/esm/types/compute.js.map +1 -1
  94. package/build/esm/utils/ActionLifecycleTracker.js.map +1 -1
  95. package/build/esm/utils/CacheEfficiencyAnalyzer.js.map +1 -1
  96. package/build/esm/utils/ComponentContextCapture.js +10 -10
  97. package/build/esm/utils/ComponentContextCapture.js.map +1 -1
  98. package/build/esm/utils/ComponentPrimitiveDiscovery.js.map +1 -1
  99. package/build/esm/utils/ComponentQueryRegistry.js +8 -8
  100. package/build/esm/utils/ComponentQueryRegistry.js.map +1 -1
  101. package/build/esm/utils/ComputeMonitor.js +2 -2
  102. package/build/esm/utils/ComputeMonitor.js.map +1 -1
  103. package/build/esm/utils/EventTimeline.js.map +1 -1
  104. package/build/esm/utils/LinkTraversalTracker.js +2 -2
  105. package/build/esm/utils/LinkTraversalTracker.js.map +1 -1
  106. package/build/esm/utils/MockDataGenerator.js +4 -4
  107. package/build/esm/utils/MockDataGenerator.js.map +1 -1
  108. package/build/esm/utils/ObservableClientMonitor.js +2 -2
  109. package/build/esm/utils/ObservableClientMonitor.js.map +1 -1
  110. package/build/esm/utils/PerformanceRecommendationEngine.js +1 -1
  111. package/build/esm/utils/PerformanceRecommendationEngine.js.map +1 -1
  112. package/build/esm/utils/PropertyAccessTracker.js +3 -3
  113. package/build/esm/utils/PropertyAccessTracker.js.map +1 -1
  114. package/build/esm/utils/RecommendationMatcher.js.map +1 -1
  115. package/build/esm/utils/SubscriptionTracker.js +1 -1
  116. package/build/esm/utils/SubscriptionTracker.js.map +1 -1
  117. package/build/esm/utils/UnusedFieldAnalyzer.js +6 -7
  118. package/build/esm/utils/UnusedFieldAnalyzer.js.map +1 -1
  119. package/build/esm/utils/WaterfallDetector.js.map +1 -1
  120. package/build/esm/utils/computePayload.js +2 -2
  121. package/build/esm/utils/computePayload.js.map +1 -1
  122. package/build/esm/utils/computeRequest.js.map +1 -1
  123. package/build/esm/utils/format.js.map +1 -1
  124. package/build/esm/vite/hookInstaller.js.map +1 -1
  125. package/build/esm/vite/index.js +2 -3
  126. package/build/esm/vite/index.js.map +1 -1
  127. package/build/types/DevToolsContext.d.ts.map +1 -1
  128. package/build/types/components/ActionMetrics.d.ts.map +1 -1
  129. package/build/types/components/BubbleChart.d.ts.map +1 -1
  130. package/build/types/components/CacheInspectorTab.d.ts.map +1 -1
  131. package/build/types/components/CacheMetrics.d.ts.map +1 -1
  132. package/build/types/components/ComponentCard.d.ts.map +1 -1
  133. package/build/types/components/ComputeTab.d.ts.map +1 -1
  134. package/build/types/components/CopyableCodeBlock.d.ts.map +1 -1
  135. package/build/types/components/DebuggingTab.d.ts.map +1 -1
  136. package/build/types/components/HookRow.d.ts.map +1 -1
  137. package/build/types/components/ImprovementsTab.d.ts.map +1 -1
  138. package/build/types/components/InspectorSelectionHeader.d.ts.map +1 -1
  139. package/build/types/components/InterceptTab.d.ts.map +1 -1
  140. package/build/types/components/IssueCard.d.ts.map +1 -1
  141. package/build/types/components/LogEntryCard.d.ts.map +1 -1
  142. package/build/types/components/MockEditor.d.ts.map +1 -1
  143. package/build/types/components/MonitorErrorBoundary.d.ts.map +1 -1
  144. package/build/types/components/MonitoringPanel.d.ts.map +1 -1
  145. package/build/types/components/ObjectLoadingMetrics.d.ts.map +1 -1
  146. package/build/types/components/OsdkAppErrorBoundary.d.ts.map +1 -1
  147. package/build/types/components/OsdkDevTools.d.ts.map +1 -1
  148. package/build/types/components/OverrideEditor.d.ts.map +1 -1
  149. package/build/types/components/PerformanceTab.d.ts.map +1 -1
  150. package/build/types/components/PrimitiveSelectionPanel.d.ts.map +1 -1
  151. package/build/types/components/resolveComponentName.d.ts.map +1 -1
  152. package/build/types/components/testHelpers.d.ts.map +1 -1
  153. package/build/types/fiber/DegradationNotice.d.ts.map +1 -1
  154. package/build/types/fiber/DevtoolsHook.d.ts.map +1 -1
  155. package/build/types/fiber/FiberInspection.d.ts.map +1 -1
  156. package/build/types/fiber/HookStateInspector.d.ts.map +1 -1
  157. package/build/types/fiber/capabilities.d.ts.map +1 -1
  158. package/build/types/fiber/traverseFiber.d.ts.map +1 -1
  159. package/build/types/fiber/types.d.ts.map +1 -1
  160. package/build/types/hooks/useActiveComponents.d.ts.map +1 -1
  161. package/build/types/hooks/useComponentRegistry.d.ts.map +1 -1
  162. package/build/types/hooks/useComputeSelectors.d.ts.map +1 -1
  163. package/build/types/hooks/useConsoleLogs.d.ts.map +1 -1
  164. package/build/types/hooks/useInspectorSelection.d.ts.map +1 -1
  165. package/build/types/hooks/useMetrics.d.ts.map +1 -1
  166. package/build/types/hooks/useRecommendations.d.ts.map +1 -1
  167. package/build/types/hooks/useUnusedFieldAnalysis.d.ts.map +1 -1
  168. package/build/types/inspector/ClickToInspectSystem.d.ts.map +1 -1
  169. package/build/types/inspector/components/ComponentLabel.d.ts.map +1 -1
  170. package/build/types/inspector/components/InspectorOverlay.d.ts.map +1 -1
  171. package/build/types/inspector/components/SelectionHighlight.d.ts.map +1 -1
  172. package/build/types/inspector/hooks/useAnimatedBounds.d.ts.map +1 -1
  173. package/build/types/mocking/MockManager.d.ts.map +1 -1
  174. package/build/types/store/ComputeStore.d.ts.map +1 -1
  175. package/build/types/store/ConsoleLogStore.d.ts.map +1 -1
  176. package/build/types/store/MetricsStore.d.ts.map +1 -1
  177. package/build/types/store/MonitorStore.d.ts.map +1 -1
  178. package/build/types/store/WindowErrorStore.d.ts.map +1 -1
  179. package/build/types/styles.d.ts +0 -1
  180. package/build/types/styles.d.ts.map +1 -1
  181. package/build/types/types/compute.d.ts.map +1 -1
  182. package/build/types/utils/ActionLifecycleTracker.d.ts.map +1 -1
  183. package/build/types/utils/CacheEfficiencyAnalyzer.d.ts.map +1 -1
  184. package/build/types/utils/ComponentContextCapture.d.ts.map +1 -1
  185. package/build/types/utils/ComponentPrimitiveDiscovery.d.ts.map +1 -1
  186. package/build/types/utils/ComponentQueryRegistry.d.ts.map +1 -1
  187. package/build/types/utils/ComputeMonitor.d.ts.map +1 -1
  188. package/build/types/utils/EventTimeline.d.ts.map +1 -1
  189. package/build/types/utils/LinkTraversalTracker.d.ts.map +1 -1
  190. package/build/types/utils/MockDataGenerator.d.ts.map +1 -1
  191. package/build/types/utils/ObservableClientMonitor.d.ts.map +1 -1
  192. package/build/types/utils/PerformanceRecommendationEngine.d.ts.map +1 -1
  193. package/build/types/utils/PropertyAccessTracker.d.ts.map +1 -1
  194. package/build/types/utils/SubscriptionTracker.d.ts.map +1 -1
  195. package/build/types/utils/UnusedFieldAnalyzer.d.ts.map +1 -1
  196. package/build/types/utils/WaterfallDetector.d.ts.map +1 -1
  197. package/build/types/utils/computeRequest.d.ts.map +1 -1
  198. package/build/types/vite/index.d.ts.map +1 -1
  199. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"FiberTags.js","names":["FIBER_TAG","FUNCTION_COMPONENT","CLASS_COMPONENT","INDETERMINATE_COMPONENT","HOST_ROOT","HOST_PORTAL","HOST_ELEMENT","HOST_TEXT","FRAGMENT","MODE","CONTEXT_CONSUMER","CONTEXT_PROVIDER","FORWARD_REF","PROFILER","SUSPENSE","MEMO","SIMPLE_MEMO","LAZY","INCOMPLETE_CLASS","DEHYDRATED_FRAGMENT","SUSPENSE_LIST","SCOPE","OFFSCREEN","LEGACY_HIDDEN","CACHE","TRACING_MARKER","HOST_HOISTABLE","HOST_SINGLETON","ACTIVITY","VIEW_TRANSITION","isUserComponent","fiber","tag"],"sources":["FiberTags.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Fiber } from \"./types.js\";\n\nexport const FIBER_TAG = {\n FUNCTION_COMPONENT: 0,\n CLASS_COMPONENT: 1,\n INDETERMINATE_COMPONENT: 2,\n HOST_ROOT: 3,\n HOST_PORTAL: 4,\n HOST_ELEMENT: 5,\n HOST_TEXT: 6,\n FRAGMENT: 7,\n MODE: 8,\n CONTEXT_CONSUMER: 9,\n CONTEXT_PROVIDER: 10,\n FORWARD_REF: 11,\n PROFILER: 12,\n SUSPENSE: 13,\n MEMO: 14,\n SIMPLE_MEMO: 15,\n LAZY: 16,\n INCOMPLETE_CLASS: 17,\n DEHYDRATED_FRAGMENT: 18,\n SUSPENSE_LIST: 19,\n SCOPE: 21,\n OFFSCREEN: 22,\n LEGACY_HIDDEN: 23,\n CACHE: 24,\n TRACING_MARKER: 25,\n HOST_HOISTABLE: 26,\n HOST_SINGLETON: 27,\n ACTIVITY: 28,\n VIEW_TRANSITION: 30,\n} as const;\n\nexport function isUserComponent(fiber: Fiber): boolean {\n const tag = fiber.tag;\n return (\n tag === FIBER_TAG.FUNCTION_COMPONENT\n || tag === FIBER_TAG.CLASS_COMPONENT\n || tag === FIBER_TAG.FORWARD_REF\n || tag === FIBER_TAG.MEMO\n || tag === FIBER_TAG.SIMPLE_MEMO\n || tag === FIBER_TAG.LAZY\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,MAAMA,SAAS,GAAG;EACvBC,kBAAkB,EAAE,CAAC;EACrBC,eAAe,EAAE,CAAC;EAClBC,uBAAuB,EAAE,CAAC;EAC1BC,SAAS,EAAE,CAAC;EACZC,WAAW,EAAE,CAAC;EACdC,YAAY,EAAE,CAAC;EACfC,SAAS,EAAE,CAAC;EACZC,QAAQ,EAAE,CAAC;EACXC,IAAI,EAAE,CAAC;EACPC,gBAAgB,EAAE,CAAC;EACnBC,gBAAgB,EAAE,EAAE;EACpBC,WAAW,EAAE,EAAE;EACfC,QAAQ,EAAE,EAAE;EACZC,QAAQ,EAAE,EAAE;EACZC,IAAI,EAAE,EAAE;EACRC,WAAW,EAAE,EAAE;EACfC,IAAI,EAAE,EAAE;EACRC,gBAAgB,EAAE,EAAE;EACpBC,mBAAmB,EAAE,EAAE;EACvBC,aAAa,EAAE,EAAE;EACjBC,KAAK,EAAE,EAAE;EACTC,SAAS,EAAE,EAAE;EACbC,aAAa,EAAE,EAAE;EACjBC,KAAK,EAAE,EAAE;EACTC,cAAc,EAAE,EAAE;EAClBC,cAAc,EAAE,EAAE;EAClBC,cAAc,EAAE,EAAE;EAClBC,QAAQ,EAAE,EAAE;EACZC,eAAe,EAAE;AACnB,CAAU;AAEV,OAAO,SAASC,eAAeA,CAACC,KAAY,EAAW;EACrD,MAAMC,GAAG,GAAGD,KAAK,CAACC,GAAG;EACrB,OACEA,GAAG,KAAKhC,SAAS,CAACC,kBAAkB,IACjC+B,GAAG,KAAKhC,SAAS,CAACE,eAAe,IACjC8B,GAAG,KAAKhC,SAAS,CAACY,WAAW,IAC7BoB,GAAG,KAAKhC,SAAS,CAACe,IAAI,IACtBiB,GAAG,KAAKhC,SAAS,CAACgB,WAAW,IAC7BgB,GAAG,KAAKhC,SAAS,CAACiB,IAAI;AAE7B","ignoreList":[]}
1
+ {"version":3,"file":"FiberTags.js","names":["FIBER_TAG","FUNCTION_COMPONENT","CLASS_COMPONENT","INDETERMINATE_COMPONENT","HOST_ROOT","HOST_PORTAL","HOST_ELEMENT","HOST_TEXT","FRAGMENT","MODE","CONTEXT_CONSUMER","CONTEXT_PROVIDER","FORWARD_REF","PROFILER","SUSPENSE","MEMO","SIMPLE_MEMO","LAZY","INCOMPLETE_CLASS","DEHYDRATED_FRAGMENT","SUSPENSE_LIST","SCOPE","OFFSCREEN","LEGACY_HIDDEN","CACHE","TRACING_MARKER","HOST_HOISTABLE","HOST_SINGLETON","ACTIVITY","VIEW_TRANSITION","isUserComponent","fiber","tag"],"sources":["FiberTags.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Fiber } from \"./types.js\";\n\nexport const FIBER_TAG = {\n FUNCTION_COMPONENT: 0,\n CLASS_COMPONENT: 1,\n INDETERMINATE_COMPONENT: 2,\n HOST_ROOT: 3,\n HOST_PORTAL: 4,\n HOST_ELEMENT: 5,\n HOST_TEXT: 6,\n FRAGMENT: 7,\n MODE: 8,\n CONTEXT_CONSUMER: 9,\n CONTEXT_PROVIDER: 10,\n FORWARD_REF: 11,\n PROFILER: 12,\n SUSPENSE: 13,\n MEMO: 14,\n SIMPLE_MEMO: 15,\n LAZY: 16,\n INCOMPLETE_CLASS: 17,\n DEHYDRATED_FRAGMENT: 18,\n SUSPENSE_LIST: 19,\n SCOPE: 21,\n OFFSCREEN: 22,\n LEGACY_HIDDEN: 23,\n CACHE: 24,\n TRACING_MARKER: 25,\n HOST_HOISTABLE: 26,\n HOST_SINGLETON: 27,\n ACTIVITY: 28,\n VIEW_TRANSITION: 30,\n} as const;\n\nexport function isUserComponent(fiber: Fiber): boolean {\n const tag = fiber.tag;\n return (\n tag === FIBER_TAG.FUNCTION_COMPONENT ||\n tag === FIBER_TAG.CLASS_COMPONENT ||\n tag === FIBER_TAG.FORWARD_REF ||\n tag === FIBER_TAG.MEMO ||\n tag === FIBER_TAG.SIMPLE_MEMO ||\n tag === FIBER_TAG.LAZY\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,MAAMA,SAAS,GAAG;EACvBC,kBAAkB,EAAE,CAAC;EACrBC,eAAe,EAAE,CAAC;EAClBC,uBAAuB,EAAE,CAAC;EAC1BC,SAAS,EAAE,CAAC;EACZC,WAAW,EAAE,CAAC;EACdC,YAAY,EAAE,CAAC;EACfC,SAAS,EAAE,CAAC;EACZC,QAAQ,EAAE,CAAC;EACXC,IAAI,EAAE,CAAC;EACPC,gBAAgB,EAAE,CAAC;EACnBC,gBAAgB,EAAE,EAAE;EACpBC,WAAW,EAAE,EAAE;EACfC,QAAQ,EAAE,EAAE;EACZC,QAAQ,EAAE,EAAE;EACZC,IAAI,EAAE,EAAE;EACRC,WAAW,EAAE,EAAE;EACfC,IAAI,EAAE,EAAE;EACRC,gBAAgB,EAAE,EAAE;EACpBC,mBAAmB,EAAE,EAAE;EACvBC,aAAa,EAAE,EAAE;EACjBC,KAAK,EAAE,EAAE;EACTC,SAAS,EAAE,EAAE;EACbC,aAAa,EAAE,EAAE;EACjBC,KAAK,EAAE,EAAE;EACTC,cAAc,EAAE,EAAE;EAClBC,cAAc,EAAE,EAAE;EAClBC,cAAc,EAAE,EAAE;EAClBC,QAAQ,EAAE,EAAE;EACZC,eAAe,EAAE;AACnB,CAAU;AAEV,OAAO,SAASC,eAAeA,CAACC,KAAY,EAAW;EACrD,MAAMC,GAAG,GAAGD,KAAK,CAACC,GAAG;EACrB,OACEA,GAAG,KAAKhC,SAAS,CAACC,kBAAkB,IACpC+B,GAAG,KAAKhC,SAAS,CAACE,eAAe,IACjC8B,GAAG,KAAKhC,SAAS,CAACY,WAAW,IAC7BoB,GAAG,KAAKhC,SAAS,CAACe,IAAI,IACtBiB,GAAG,KAAKhC,SAAS,CAACgB,WAAW,IAC7BgB,GAAG,KAAKhC,SAAS,CAACiB,IAAI;AAE1B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"HookStateInspector.js","names":["getComponentId","getComponentName","safeFiberOperation","traverseAllFibers","walkFiberTree","OSDK_HOOK_METADATA","Symbol","for","isOsdkContextConsumer","fiber","fibersToCheck","alternate","filter","Boolean","f","dependencies","firstContext","ctx","value","memoizedValue","next","fallback","feature","getSourceBasedId","name","source","_debugSource","shortPath","fileName","split","slice","join","lineNumber","getFiberSourceLocation","buildConsumerInfo","componentName","sourceLocation","sourceBasedId","isOsdkFunctionComponent","type","findOsdkConsumersInAncestors","maxDepth","node","undefined","map","hasOsdkConsumerInTree","current","depth","return","createSearchBudget","scope","nodesVisited","resultsFound","maxNodes","maxAncestorLevels","maxChildDepth","maxSiblingsPerLevel","maxResults","maxTotalResults","isBudgetExhausted","budget","DEFAULT_SEARCH_SCOPE","findOsdkConsumersInSiblings","consumers","visited","Set","ancestorPath","pathFiber","add","currentAncestor","ancestorLevel","child","siblingCount","has","remaining","subtreeMatches","match","push","sibling","findOsdkConsumersInDescendants","length","matches","isOsdkHookMetadata","isRefStorage","Object","keys","VALID_HOOK_TYPES","isValidHookType","extractOsdkMetadataFromFiber","results","memoizedState","state","Array","isArray","memoValue","meta","hookType","validated","actionName","objectType","primaryKey","sourceObjectType","linkName","where","orderBy","pageSize","aggregate","discoverOsdkComponentsFromRoot","fiberRoot","components","Map","rootFiber","metadata","componentId","set","hooks"],"sources":["HookStateInspector.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 { getComponentId, getComponentName } from \"./FiberInspection.js\";\nimport { safeFiberOperation } from \"./SafeFiberOperation.js\";\nimport { traverseAllFibers, walkFiberTree } from \"./traverseFiber.js\";\nimport type {\n ContextDependency,\n Fiber,\n FiberRoot,\n MemoizedState,\n} from \"./types.js\";\n\nconst OSDK_HOOK_METADATA = Symbol.for(\"__OSDK_HOOK_METADATA__\");\n\nexport interface OsdkHookMetadata {\n readonly [key: symbol]: true;\n readonly hookType:\n | \"useOsdkAction\"\n | \"useOsdkObjects\"\n | \"useOsdkObject\"\n | \"useLinks\"\n | \"useOsdkAggregation\"\n | \"useOsdkFunction\"\n | \"useObjectSet\";\n readonly actionName?: string;\n readonly objectType?: string;\n readonly primaryKey?: string;\n readonly sourceObjectType?: string;\n readonly linkName?: string;\n readonly where?: unknown;\n readonly orderBy?: unknown;\n readonly pageSize?: number;\n readonly aggregate?: unknown;\n}\n\nexport interface OsdkConsumerFiber {\n fiber: Fiber;\n componentName: string;\n sourceLocation: { fileName?: string; lineNumber?: number } | null;\n sourceBasedId: string | null;\n}\n\nfunction isOsdkContextConsumer(fiber: Fiber): boolean {\n return safeFiberOperation(\n () => {\n const fibersToCheck = [fiber, fiber.alternate].filter(Boolean) as Fiber[];\n\n for (const f of fibersToCheck) {\n if (!f.dependencies?.firstContext) {\n continue;\n }\n\n let ctx: ContextDependency | null = f.dependencies.firstContext;\n while (ctx) {\n const value = ctx.memoizedValue;\n if (\n value != null\n && typeof value === \"object\"\n && \"observableClient\" in value\n && \"client\" in value\n ) {\n return true;\n }\n ctx = ctx.next;\n }\n }\n return false;\n },\n { fallback: false, feature: \"hook-discovery\" },\n );\n}\n\nfunction getSourceBasedId(fiber: Fiber): string | null {\n const name = getComponentName(fiber);\n const source = fiber._debugSource;\n if (!source) {\n return null;\n }\n\n const shortPath = source.fileName?.split(\"/\").slice(-2).join(\"/\")\n || \"unknown\";\n return `fiber-${name}-${shortPath}-${source.lineNumber || 0}`;\n}\n\nfunction getFiberSourceLocation(fiber: Fiber): {\n fileName?: string;\n lineNumber?: number;\n} | null {\n if (!fiber._debugSource) {\n return null;\n }\n return {\n fileName: fiber._debugSource.fileName,\n lineNumber: fiber._debugSource.lineNumber,\n };\n}\n\nfunction buildConsumerInfo(fiber: Fiber): OsdkConsumerFiber {\n return {\n fiber,\n componentName: getComponentName(fiber),\n sourceLocation: getFiberSourceLocation(fiber),\n sourceBasedId: getSourceBasedId(fiber),\n };\n}\n\nfunction isOsdkFunctionComponent(fiber: Fiber): boolean {\n return typeof fiber.type === \"function\" && isOsdkContextConsumer(fiber);\n}\n\nexport function findOsdkConsumersInAncestors(\n fiber: Fiber,\n maxDepth = 50,\n): OsdkConsumerFiber[] {\n return traverseAllFibers(\n fiber,\n (node) => isOsdkFunctionComponent(node),\n /* ascending */ true,\n /* maxResults */ undefined,\n maxDepth,\n ).map(buildConsumerInfo);\n}\n\nexport function hasOsdkConsumerInTree(fiber: Fiber, maxDepth = 50): boolean {\n let current: Fiber | null = fiber;\n let depth = 0;\n\n while (current && depth < maxDepth) {\n if (typeof current.type === \"function\" && isOsdkContextConsumer(current)) {\n return true;\n }\n current = current.return;\n depth++;\n }\n\n return false;\n}\n\ninterface SearchScope {\n maxAncestorLevels: number;\n maxChildDepth: number;\n maxTotalResults: number;\n maxSiblingsPerLevel: number;\n}\n\ninterface SearchBudget {\n nodesVisited: number;\n resultsFound: number;\n readonly maxNodes: number;\n readonly maxResults: number;\n}\n\nfunction createSearchBudget(scope: SearchScope): SearchBudget {\n return {\n nodesVisited: 0,\n resultsFound: 0,\n maxNodes: scope.maxAncestorLevels * scope.maxChildDepth\n * scope.maxSiblingsPerLevel,\n maxResults: scope.maxTotalResults,\n };\n}\n\nfunction isBudgetExhausted(budget: SearchBudget): boolean {\n return budget.nodesVisited >= budget.maxNodes\n || budget.resultsFound >= budget.maxResults;\n}\n\nconst DEFAULT_SEARCH_SCOPE: SearchScope = {\n maxAncestorLevels: 10,\n maxChildDepth: 10,\n maxTotalResults: 10,\n maxSiblingsPerLevel: 20,\n};\n\nexport function findOsdkConsumersInSiblings(\n fiber: Fiber,\n scope: SearchScope = DEFAULT_SEARCH_SCOPE,\n): OsdkConsumerFiber[] {\n return safeFiberOperation(\n () => {\n const consumers: OsdkConsumerFiber[] = [];\n const visited = new Set<Fiber>();\n const ancestorPath = new Set<Fiber>();\n const budget = createSearchBudget(scope);\n\n let pathFiber: Fiber | null = fiber;\n while (pathFiber) {\n ancestorPath.add(pathFiber);\n pathFiber = pathFiber.return;\n }\n\n let currentAncestor: Fiber | null = fiber.return;\n let ancestorLevel = 0;\n\n while (\n currentAncestor\n && ancestorLevel < scope.maxAncestorLevels\n && !isBudgetExhausted(budget)\n ) {\n let child: Fiber | null = currentAncestor.child;\n let siblingCount = 0;\n while (\n child\n && siblingCount < scope.maxSiblingsPerLevel\n && !isBudgetExhausted(budget)\n ) {\n if (!ancestorPath.has(child)) {\n const remaining = budget.maxResults - budget.resultsFound;\n const subtreeMatches = traverseAllFibers(\n child,\n (node) => {\n if (visited.has(node)) {\n return false;\n }\n visited.add(node);\n budget.nodesVisited++;\n return isOsdkFunctionComponent(node);\n },\n /* ascending */ false,\n /* maxResults */ remaining,\n scope.maxChildDepth,\n );\n\n for (const match of subtreeMatches) {\n consumers.push(buildConsumerInfo(match));\n budget.resultsFound++;\n }\n }\n child = child.sibling;\n siblingCount++;\n }\n\n currentAncestor = currentAncestor.return;\n ancestorLevel++;\n }\n\n return consumers;\n },\n { fallback: [], feature: \"hook-discovery\" },\n );\n}\n\nexport function findOsdkConsumersInDescendants(\n fiber: Fiber,\n scope: SearchScope = DEFAULT_SEARCH_SCOPE,\n): OsdkConsumerFiber[] {\n return safeFiberOperation(\n () => {\n const consumers: OsdkConsumerFiber[] = [];\n\n let child: Fiber | null = fiber.child;\n let siblingCount = 0;\n while (\n child\n && siblingCount < scope.maxSiblingsPerLevel\n && consumers.length < scope.maxTotalResults\n ) {\n const remaining = scope.maxTotalResults - consumers.length;\n const matches = traverseAllFibers(\n child,\n (node) => isOsdkFunctionComponent(node),\n /* ascending */ false,\n remaining,\n scope.maxChildDepth,\n );\n for (const match of matches) {\n consumers.push(buildConsumerInfo(match));\n }\n child = child.sibling;\n siblingCount++;\n }\n\n return consumers;\n },\n { fallback: [], feature: \"hook-discovery\" },\n );\n}\n\nfunction isOsdkHookMetadata(value: unknown): value is OsdkHookMetadata {\n return (\n value != null\n && typeof value === \"object\"\n && OSDK_HOOK_METADATA in value\n && (value as Record<symbol, unknown>)[OSDK_HOOK_METADATA] === true\n );\n}\n\nfunction isRefStorage(value: unknown): value is { current: unknown } {\n return (\n value != null\n && typeof value === \"object\"\n && \"current\" in value\n && Object.keys(value as object).length <= 2\n );\n}\n\nconst VALID_HOOK_TYPES = new Set<OsdkHookMetadata[\"hookType\"]>([\n \"useOsdkAction\",\n \"useOsdkObjects\",\n \"useOsdkObject\",\n \"useLinks\",\n \"useOsdkAggregation\",\n \"useOsdkFunction\",\n \"useObjectSet\",\n]);\n\nfunction isValidHookType(value: string): value is OsdkHookMetadata[\"hookType\"] {\n return VALID_HOOK_TYPES.has(value as OsdkHookMetadata[\"hookType\"]);\n}\n\nexport function extractOsdkMetadataFromFiber(fiber: Fiber): OsdkHookMetadata[] {\n return safeFiberOperation(\n () => {\n const results: OsdkHookMetadata[] = [];\n let current: MemoizedState | null = fiber.memoizedState;\n\n while (current) {\n const state = current.memoizedState;\n\n // useRef check: state is { current: OsdkHookMetadata }\n if (isRefStorage(state) && isOsdkHookMetadata(state.current)) {\n results.push(state.current);\n }\n\n // useMemo check: state is [memoizedValue, deps]\n // The memoizedValue is the makeExternalStore return object\n // which has OSDK_HOOK_METADATA as a non-enumerable symbol property\n if (\n Array.isArray(state)\n && state[0] != null\n && typeof state[0] === \"object\"\n ) {\n const memoValue = state[0];\n if (OSDK_HOOK_METADATA in memoValue) {\n // `in` validates the key exists; TS can't narrow symbol keys\n const meta =\n (memoValue as Record<symbol, unknown>)[OSDK_HOOK_METADATA];\n if (\n meta != null\n && typeof meta === \"object\"\n && \"hookType\" in meta\n && typeof (meta as { hookType: unknown }).hookType === \"string\"\n && isValidHookType(\n (meta as { hookType: string }).hookType,\n )\n ) {\n const validated = meta as {\n hookType: OsdkHookMetadata[\"hookType\"];\n [key: string]: unknown;\n };\n results.push({\n [OSDK_HOOK_METADATA]: true,\n hookType: validated.hookType,\n actionName: typeof validated.actionName === \"string\"\n ? validated.actionName\n : undefined,\n objectType: typeof validated.objectType === \"string\"\n ? validated.objectType\n : undefined,\n primaryKey: typeof validated.primaryKey === \"string\"\n ? validated.primaryKey\n : undefined,\n sourceObjectType: typeof validated.sourceObjectType === \"string\"\n ? validated.sourceObjectType\n : undefined,\n linkName: typeof validated.linkName === \"string\"\n ? validated.linkName\n : undefined,\n where: validated.where,\n orderBy: validated.orderBy,\n pageSize: typeof validated.pageSize === \"number\"\n ? validated.pageSize\n : undefined,\n aggregate: validated.aggregate,\n });\n }\n }\n }\n\n current = current.next;\n }\n\n return results;\n },\n { fallback: [], feature: \"metadata-extraction\" },\n );\n}\n\nexport interface DiscoveredComponent {\n componentId: string;\n componentName: string;\n hooks: OsdkHookMetadata[];\n sourceLocation: { fileName?: string; lineNumber?: number } | null;\n}\n\nexport function discoverOsdkComponentsFromRoot(\n fiberRoot: FiberRoot,\n): Map<string, DiscoveredComponent> {\n return safeFiberOperation(\n () => {\n const components = new Map<string, DiscoveredComponent>();\n const rootFiber = fiberRoot.current;\n\n if (!rootFiber) {\n return components;\n }\n\n walkFiberTree(rootFiber, (fiber) => {\n if (typeof fiber.type !== \"function\") {\n return;\n }\n\n const metadata = extractOsdkMetadataFromFiber(fiber);\n if (metadata.length > 0) {\n const componentId = getComponentId(fiber);\n const componentName = getComponentName(fiber);\n const sourceLocation = getFiberSourceLocation(fiber);\n\n components.set(componentId, {\n componentId,\n componentName,\n hooks: metadata,\n sourceLocation,\n });\n }\n });\n\n return components;\n },\n { fallback: new Map(), feature: \"fiber-discovery\" },\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,EAAEC,gBAAgB,QAAQ,sBAAsB;AACvE,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,oBAAoB;AAQrE,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,GAAG,CAAC,wBAAwB,CAAC;AA8B/D,SAASC,qBAAqBA,CAACC,KAAY,EAAW;EACpD,OAAOP,kBAAkB,CACvB,MAAM;IACJ,MAAMQ,aAAa,GAAG,CAACD,KAAK,EAAEA,KAAK,CAACE,SAAS,CAAC,CAACC,MAAM,CAACC,OAAO,CAAY;IAEzE,KAAK,MAAMC,CAAC,IAAIJ,aAAa,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E;UAC1BA,WAAW;UACX9E,aAAa;UACbgF,KAAK,EAAEH,QAAQ;UACf5E;QACF,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;IAEF,OAAOyE,UAAU;EACnB,CAAC,EACD;IAAExF,QAAQ,EAAE,IAAIyF,GAAG,CAAC,CAAC;IAAExF,OAAO,EAAE;EAAkB,CACpD,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"HookStateInspector.js","names":["getComponentId","getComponentName","safeFiberOperation","traverseAllFibers","walkFiberTree","OSDK_HOOK_METADATA","Symbol","for","isOsdkContextConsumer","fiber","fibersToCheck","alternate","filter","Boolean","f","dependencies","firstContext","ctx","value","memoizedValue","next","fallback","feature","getSourceBasedId","name","source","_debugSource","shortPath","fileName","split","slice","join","lineNumber","getFiberSourceLocation","buildConsumerInfo","componentName","sourceLocation","sourceBasedId","isOsdkFunctionComponent","type","findOsdkConsumersInAncestors","maxDepth","node","undefined","map","hasOsdkConsumerInTree","current","depth","return","createSearchBudget","scope","nodesVisited","resultsFound","maxNodes","maxAncestorLevels","maxChildDepth","maxSiblingsPerLevel","maxResults","maxTotalResults","isBudgetExhausted","budget","DEFAULT_SEARCH_SCOPE","findOsdkConsumersInSiblings","consumers","visited","Set","ancestorPath","pathFiber","add","currentAncestor","ancestorLevel","child","siblingCount","has","remaining","subtreeMatches","match","push","sibling","findOsdkConsumersInDescendants","length","matches","isOsdkHookMetadata","isRefStorage","Object","keys","VALID_HOOK_TYPES","isValidHookType","extractOsdkMetadataFromFiber","results","memoizedState","state","Array","isArray","memoValue","meta","hookType","validated","actionName","objectType","primaryKey","sourceObjectType","linkName","where","orderBy","pageSize","aggregate","discoverOsdkComponentsFromRoot","fiberRoot","components","Map","rootFiber","metadata","componentId","set","hooks"],"sources":["HookStateInspector.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 { getComponentId, getComponentName } from \"./FiberInspection.js\";\nimport { safeFiberOperation } from \"./SafeFiberOperation.js\";\nimport { traverseAllFibers, walkFiberTree } from \"./traverseFiber.js\";\nimport type {\n ContextDependency,\n Fiber,\n FiberRoot,\n MemoizedState,\n} from \"./types.js\";\n\nconst OSDK_HOOK_METADATA = Symbol.for(\"__OSDK_HOOK_METADATA__\");\n\nexport interface OsdkHookMetadata {\n readonly [key: symbol]: true;\n readonly hookType:\n | \"useOsdkAction\"\n | \"useOsdkObjects\"\n | \"useOsdkObject\"\n | \"useLinks\"\n | \"useOsdkAggregation\"\n | \"useOsdkFunction\"\n | \"useObjectSet\";\n readonly actionName?: string;\n readonly objectType?: string;\n readonly primaryKey?: string;\n readonly sourceObjectType?: string;\n readonly linkName?: string;\n readonly where?: unknown;\n readonly orderBy?: unknown;\n readonly pageSize?: number;\n readonly aggregate?: unknown;\n}\n\nexport interface OsdkConsumerFiber {\n fiber: Fiber;\n componentName: string;\n sourceLocation: { fileName?: string; lineNumber?: number } | null;\n sourceBasedId: string | null;\n}\n\nfunction isOsdkContextConsumer(fiber: Fiber): boolean {\n return safeFiberOperation(\n () => {\n const fibersToCheck = [fiber, fiber.alternate].filter(Boolean) as Fiber[];\n\n for (const f of fibersToCheck) {\n if (!f.dependencies?.firstContext) {\n continue;\n }\n\n let ctx: ContextDependency | null = f.dependencies.firstContext;\n while (ctx) {\n const value = ctx.memoizedValue;\n if (\n value != null &&\n typeof value === \"object\" &&\n \"observableClient\" in value &&\n \"client\" in value\n ) {\n return true;\n }\n ctx = ctx.next;\n }\n }\n return false;\n },\n { fallback: false, feature: \"hook-discovery\" }\n );\n}\n\nfunction getSourceBasedId(fiber: Fiber): string | null {\n const name = getComponentName(fiber);\n const source = fiber._debugSource;\n if (!source) {\n return null;\n }\n\n const shortPath =\n source.fileName?.split(\"/\").slice(-2).join(\"/\") || \"unknown\";\n return `fiber-${name}-${shortPath}-${source.lineNumber || 0}`;\n}\n\nfunction getFiberSourceLocation(fiber: Fiber): {\n fileName?: string;\n lineNumber?: number;\n} | null {\n if (!fiber._debugSource) {\n return null;\n }\n return {\n fileName: fiber._debugSource.fileName,\n lineNumber: fiber._debugSource.lineNumber,\n };\n}\n\nfunction buildConsumerInfo(fiber: Fiber): OsdkConsumerFiber {\n return {\n fiber,\n componentName: getComponentName(fiber),\n sourceLocation: getFiberSourceLocation(fiber),\n sourceBasedId: getSourceBasedId(fiber),\n };\n}\n\nfunction isOsdkFunctionComponent(fiber: Fiber): boolean {\n return typeof fiber.type === \"function\" && isOsdkContextConsumer(fiber);\n}\n\nexport function findOsdkConsumersInAncestors(\n fiber: Fiber,\n maxDepth = 50\n): OsdkConsumerFiber[] {\n return traverseAllFibers(\n fiber,\n (node) => isOsdkFunctionComponent(node),\n /* ascending */ true,\n /* maxResults */ undefined,\n maxDepth\n ).map(buildConsumerInfo);\n}\n\nexport function hasOsdkConsumerInTree(fiber: Fiber, maxDepth = 50): boolean {\n let current: Fiber | null = fiber;\n let depth = 0;\n\n while (current && depth < maxDepth) {\n if (typeof current.type === \"function\" && isOsdkContextConsumer(current)) {\n return true;\n }\n current = current.return;\n depth++;\n }\n\n return false;\n}\n\ninterface SearchScope {\n maxAncestorLevels: number;\n maxChildDepth: number;\n maxTotalResults: number;\n maxSiblingsPerLevel: number;\n}\n\ninterface SearchBudget {\n nodesVisited: number;\n resultsFound: number;\n readonly maxNodes: number;\n readonly maxResults: number;\n}\n\nfunction createSearchBudget(scope: SearchScope): SearchBudget {\n return {\n nodesVisited: 0,\n resultsFound: 0,\n maxNodes:\n scope.maxAncestorLevels * scope.maxChildDepth * scope.maxSiblingsPerLevel,\n maxResults: scope.maxTotalResults,\n };\n}\n\nfunction isBudgetExhausted(budget: SearchBudget): boolean {\n return (\n budget.nodesVisited >= budget.maxNodes ||\n budget.resultsFound >= budget.maxResults\n );\n}\n\nconst DEFAULT_SEARCH_SCOPE: SearchScope = {\n maxAncestorLevels: 10,\n maxChildDepth: 10,\n maxTotalResults: 10,\n maxSiblingsPerLevel: 20,\n};\n\nexport function findOsdkConsumersInSiblings(\n fiber: Fiber,\n scope: SearchScope = DEFAULT_SEARCH_SCOPE\n): OsdkConsumerFiber[] {\n return safeFiberOperation(\n () => {\n const consumers: OsdkConsumerFiber[] = [];\n const visited = new Set<Fiber>();\n const ancestorPath = new Set<Fiber>();\n const budget = createSearchBudget(scope);\n\n let pathFiber: Fiber | null = fiber;\n while (pathFiber) {\n ancestorPath.add(pathFiber);\n pathFiber = pathFiber.return;\n }\n\n let currentAncestor: Fiber | null = fiber.return;\n let ancestorLevel = 0;\n\n while (\n currentAncestor &&\n ancestorLevel < scope.maxAncestorLevels &&\n !isBudgetExhausted(budget)\n ) {\n let child: Fiber | null = currentAncestor.child;\n let siblingCount = 0;\n while (\n child &&\n siblingCount < scope.maxSiblingsPerLevel &&\n !isBudgetExhausted(budget)\n ) {\n if (!ancestorPath.has(child)) {\n const remaining = budget.maxResults - budget.resultsFound;\n const subtreeMatches = traverseAllFibers(\n child,\n (node) => {\n if (visited.has(node)) {\n return false;\n }\n visited.add(node);\n budget.nodesVisited++;\n return isOsdkFunctionComponent(node);\n },\n /* ascending */ false,\n /* maxResults */ remaining,\n scope.maxChildDepth\n );\n\n for (const match of subtreeMatches) {\n consumers.push(buildConsumerInfo(match));\n budget.resultsFound++;\n }\n }\n child = child.sibling;\n siblingCount++;\n }\n\n currentAncestor = currentAncestor.return;\n ancestorLevel++;\n }\n\n return consumers;\n },\n { fallback: [], feature: \"hook-discovery\" }\n );\n}\n\nexport function findOsdkConsumersInDescendants(\n fiber: Fiber,\n scope: SearchScope = DEFAULT_SEARCH_SCOPE\n): OsdkConsumerFiber[] {\n return safeFiberOperation(\n () => {\n const consumers: OsdkConsumerFiber[] = [];\n\n let child: Fiber | null = fiber.child;\n let siblingCount = 0;\n while (\n child &&\n siblingCount < scope.maxSiblingsPerLevel &&\n consumers.length < scope.maxTotalResults\n ) {\n const remaining = scope.maxTotalResults - consumers.length;\n const matches = traverseAllFibers(\n child,\n (node) => isOsdkFunctionComponent(node),\n /* ascending */ false,\n remaining,\n scope.maxChildDepth\n );\n for (const match of matches) {\n consumers.push(buildConsumerInfo(match));\n }\n child = child.sibling;\n siblingCount++;\n }\n\n return consumers;\n },\n { fallback: [], feature: \"hook-discovery\" }\n );\n}\n\nfunction isOsdkHookMetadata(value: unknown): value is OsdkHookMetadata {\n return (\n value != null &&\n typeof value === \"object\" &&\n OSDK_HOOK_METADATA in value &&\n (value as Record<symbol, unknown>)[OSDK_HOOK_METADATA] === true\n );\n}\n\nfunction isRefStorage(value: unknown): value is { current: unknown } {\n return (\n value != null &&\n typeof value === \"object\" &&\n \"current\" in value &&\n Object.keys(value as object).length <= 2\n );\n}\n\nconst VALID_HOOK_TYPES = new Set<OsdkHookMetadata[\"hookType\"]>([\n \"useOsdkAction\",\n \"useOsdkObjects\",\n \"useOsdkObject\",\n \"useLinks\",\n \"useOsdkAggregation\",\n \"useOsdkFunction\",\n \"useObjectSet\",\n]);\n\nfunction isValidHookType(value: string): value is OsdkHookMetadata[\"hookType\"] {\n return VALID_HOOK_TYPES.has(value as OsdkHookMetadata[\"hookType\"]);\n}\n\nexport function extractOsdkMetadataFromFiber(fiber: Fiber): OsdkHookMetadata[] {\n return safeFiberOperation(\n () => {\n const results: OsdkHookMetadata[] = [];\n let current: MemoizedState | null = fiber.memoizedState;\n\n while (current) {\n const state = current.memoizedState;\n\n // useRef check: state is { current: OsdkHookMetadata }\n if (isRefStorage(state) && isOsdkHookMetadata(state.current)) {\n results.push(state.current);\n }\n\n // useMemo check: state is [memoizedValue, deps]\n // The memoizedValue is the makeExternalStore return object\n // which has OSDK_HOOK_METADATA as a non-enumerable symbol property\n if (\n Array.isArray(state) &&\n state[0] != null &&\n typeof state[0] === \"object\"\n ) {\n const memoValue = state[0];\n if (OSDK_HOOK_METADATA in memoValue) {\n // `in` validates the key exists; TS can't narrow symbol keys\n const meta = (memoValue as Record<symbol, unknown>)[\n OSDK_HOOK_METADATA\n ];\n if (\n meta != null &&\n typeof meta === \"object\" &&\n \"hookType\" in meta &&\n typeof (meta as { hookType: unknown }).hookType === \"string\" &&\n isValidHookType((meta as { hookType: string }).hookType)\n ) {\n const validated = meta as {\n hookType: OsdkHookMetadata[\"hookType\"];\n [key: string]: unknown;\n };\n results.push({\n [OSDK_HOOK_METADATA]: true,\n hookType: validated.hookType,\n actionName:\n typeof validated.actionName === \"string\"\n ? validated.actionName\n : undefined,\n objectType:\n typeof validated.objectType === \"string\"\n ? validated.objectType\n : undefined,\n primaryKey:\n typeof validated.primaryKey === \"string\"\n ? validated.primaryKey\n : undefined,\n sourceObjectType:\n typeof validated.sourceObjectType === \"string\"\n ? validated.sourceObjectType\n : undefined,\n linkName:\n typeof validated.linkName === \"string\"\n ? validated.linkName\n : undefined,\n where: validated.where,\n orderBy: validated.orderBy,\n pageSize:\n typeof validated.pageSize === \"number\"\n ? validated.pageSize\n : undefined,\n aggregate: validated.aggregate,\n });\n }\n }\n }\n\n current = current.next;\n }\n\n return results;\n },\n { fallback: [], feature: \"metadata-extraction\" }\n );\n}\n\nexport interface DiscoveredComponent {\n componentId: string;\n componentName: string;\n hooks: OsdkHookMetadata[];\n sourceLocation: { fileName?: string; lineNumber?: number } | null;\n}\n\nexport function discoverOsdkComponentsFromRoot(\n fiberRoot: FiberRoot\n): Map<string, DiscoveredComponent> {\n return safeFiberOperation(\n () => {\n const components = new Map<string, DiscoveredComponent>();\n const rootFiber = fiberRoot.current;\n\n if (!rootFiber) {\n return components;\n }\n\n walkFiberTree(rootFiber, (fiber) => {\n if (typeof fiber.type !== \"function\") {\n return;\n }\n\n const metadata = extractOsdkMetadataFromFiber(fiber);\n if (metadata.length > 0) {\n const componentId = getComponentId(fiber);\n const componentName = getComponentName(fiber);\n const sourceLocation = getFiberSourceLocation(fiber);\n\n components.set(componentId, {\n componentId,\n componentName,\n hooks: metadata,\n sourceLocation,\n });\n }\n });\n\n return components;\n },\n { fallback: new Map(), feature: \"fiber-discovery\" }\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,EAAEC,gBAAgB,QAAQ,sBAAsB;AACvE,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,oBAAoB;AAQrE,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,GAAG,CAAC,wBAAwB,CAAC;AA8B/D,SAASC,qBAAqBA,CAACC,KAAY,EAAW;EACpD,OAAOP,kBAAkB,CACvB,MAAM;IACJ,MAAMQ,aAAa,GAAG,CAACD,KAAK,EAAEA,KAAK,CAACE,SAAS,CAAC,CAACC,MAAM,CAACC,OAAO,CAAY;IAEzE,KAAK,MAAMC,CAAC,IAAIJ,aAAa,EAAE;MAC7B,IAAI,CAACI,CAAC,CAACC,YAAY,EAAEC,YAAY,EAAE;QACjC;MACF;MAEA,IAAIC,GAA6B,GAAGH,CAAC,CAACC,YAAY,CAACC,YAAY;MAC/D,OAAOC,GAAG,EAAE;QACV,MAAMC,KAAK,GAAGD,GAAG,CAACE,aAAa;QAC/B,IACED,KAAK,IAAI,IAAI,IACb,OAAOA,KAAK,KAAK,QAAQ,IACzB,kBAAkB,IAAIA,KAAK,IAC3B,QAAQ,IAAIA,KAAK,EACjB;UACA,OAAO,IAAI;QACb;QACAD,GAAG,GAAGA,GAAG,CAACG,IAAI;MAChB;IACF;IACA,OAAO,KAAK;EACd,CAAC,EACD;IAAEC,QAAQ,EAAE,KAAK;IAAEC,OAAO,EAAE;EAAiB,CAC/C,CAAC;AACH;AAEA,SAASC,gBAAgBA,CAACd,KAAY,E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AAC;AACH;AASA,OAAO,SAASqF,8BAA8BA,CAC5CC,SAAoB,EACc;EAClC,OAAO1G,kBAAkB,CACvB,MAAM;IACJ,MAAM2G,UAAU,GAAG,IAAIC,GAAG,CAA8B,CAAC;IACzD,MAAMC,SAAS,GAAGH,SAAS,CAAC9D,OAAO;IAEnC,IAAI,CAACiE,SAAS,EAAE;MACd,OAAOF,UAAU;IACnB;IAEAzG,aAAa,CAAC2G,SAAS,EAAGtG,KAAK,IAAK;MAClC,IAAI,OAAOA,KAAK,CAAC8B,IAAI,KAAK,UAAU,EAAE;QACpC;MACF;MAEA,MAAMyE,QAAQ,GAAGxB,4BAA4B,CAAC/E,KAAK,CAAC;MACpD,IAAIuG,QAAQ,CAAChC,MAAM,GAAG,CAAC,EAAE;QACvB,MAAMiC,WAAW,GAAGjH,cAAc,CAACS,KAAK,CAAC;QACzC,MAAM0B,aAAa,GAAGlC,gBAAgB,CAACQ,KAAK,CAAC;QAC7C,MAAM2B,cAAc,GAAGH,sBAAsB,CAACxB,KAAK,CAAC;QAEpDoG,UAAU,CAACK,GAAG,CAACD,WAAW,EAAE;UAC1BA,WAAW;UACX9E,aAAa;UACbgF,KAAK,EAAEH,QAAQ;UACf5E;QACF,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;IAEF,OAAOyE,UAAU;EACnB,CAAC,EACD;IAAExF,QAAQ,EAAE,IAAIyF,GAAG,CAAC,CAAC;IAAExF,OAAO,EAAE;EAAkB,CACpD,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"SafeFiberOperation.js","names":["getCapabilitiesManager","safeFiberOperation","operation","options","manager","caps","getCapabilities","disabledFeatures","has","feature","fallback","result","fiberAccessWorking","setCapability","error","recordError"],"sources":["SafeFiberOperation.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type FiberFeature, getCapabilitiesManager } from \"./capabilities.js\";\n\ninterface SafeOperationOptions<T> {\n fallback: T;\n feature: FiberFeature;\n}\n\nexport function safeFiberOperation<T>(\n operation: () => T,\n options: SafeOperationOptions<T>,\n): T {\n const manager = getCapabilitiesManager();\n const caps = manager.getCapabilities();\n\n if (caps.disabledFeatures.has(options.feature)) {\n return options.fallback;\n }\n\n try {\n const result = operation();\n\n if (result !== options.fallback && !caps.fiberAccessWorking) {\n manager.setCapability(\"fiberAccessWorking\", true);\n }\n\n return result;\n } catch (error) {\n manager.recordError(options.feature, error);\n return options.fallback;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAA4BA,sBAAsB,QAAQ,mBAAmB;AAO7E,OAAO,SAASC,kBAAkBA,CAChCC,SAAkB,EAClBC,OAAgC,EAC7B;EACH,MAAMC,OAAO,GAAGJ,sBAAsB,CAAC,CAAC;EACxC,MAAMK,IAAI,GAAGD,OAAO,CAACE,eAAe,CAAC,CAAC;EAEtC,IAAID,IAAI,CAACE,gBAAgB,CAACC,GAAG,CAACL,OAAO,CAACM,OAAO,CAAC,EAAE;IAC9C,OAAON,OAAO,CAACO,QAAQ;EACzB;EAEA,IAAI;IACF,MAAMC,MAAM,GAAGT,SAAS,CAAC,CAAC;IAE1B,IAAIS,MAAM,KAAKR,OAAO,CAACO,QAAQ,IAAI,CAACL,IAAI,CAACO,kBAAkB,EAAE;MAC3DR,OAAO,CAACS,aAAa,CAAC,oBAAoB,EAAE,IAAI,CAAC;IACnD;IAEA,OAAOF,MAAM;EACf,CAAC,CAAC,OAAOG,KAAK,EAAE;IACdV,OAAO,CAACW,WAAW,CAACZ,OAAO,CAACM,OAAO,EAAEK,KAAK,CAAC;IAC3C,OAAOX,OAAO,CAACO,QAAQ;EACzB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"SafeFiberOperation.js","names":["getCapabilitiesManager","safeFiberOperation","operation","options","manager","caps","getCapabilities","disabledFeatures","has","feature","fallback","result","fiberAccessWorking","setCapability","error","recordError"],"sources":["SafeFiberOperation.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type FiberFeature, getCapabilitiesManager } from \"./capabilities.js\";\n\ninterface SafeOperationOptions<T> {\n fallback: T;\n feature: FiberFeature;\n}\n\nexport function safeFiberOperation<T>(\n operation: () => T,\n options: SafeOperationOptions<T>\n): T {\n const manager = getCapabilitiesManager();\n const caps = manager.getCapabilities();\n\n if (caps.disabledFeatures.has(options.feature)) {\n return options.fallback;\n }\n\n try {\n const result = operation();\n\n if (result !== options.fallback && !caps.fiberAccessWorking) {\n manager.setCapability(\"fiberAccessWorking\", true);\n }\n\n return result;\n } catch (error) {\n manager.recordError(options.feature, error);\n return options.fallback;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAA4BA,sBAAsB,QAAQ,mBAAmB;AAO7E,OAAO,SAASC,kBAAkBA,CAChCC,SAAkB,EAClBC,OAAgC,EAC7B;EACH,MAAMC,OAAO,GAAGJ,sBAAsB,CAAC,CAAC;EACxC,MAAMK,IAAI,GAAGD,OAAO,CAACE,eAAe,CAAC,CAAC;EAEtC,IAAID,IAAI,CAACE,gBAAgB,CAACC,GAAG,CAACL,OAAO,CAACM,OAAO,CAAC,EAAE;IAC9C,OAAON,OAAO,CAACO,QAAQ;EACzB;EAEA,IAAI;IACF,MAAMC,MAAM,GAAGT,SAAS,CAAC,CAAC;IAE1B,IAAIS,MAAM,KAAKR,OAAO,CAACO,QAAQ,IAAI,CAACL,IAAI,CAACO,kBAAkB,EAAE;MAC3DR,OAAO,CAACS,aAAa,CAAC,oBAAoB,EAAE,IAAI,CAAC;IACnD;IAEA,OAAOF,MAAM;EACf,CAAC,CAAC,OAAOG,KAAK,EAAE;IACdV,OAAO,CAACW,WAAW,CAACZ,OAAO,CAACM,OAAO,EAAEK,KAAK,CAAC;IAC3C,OAAOX,OAAO,CAACO,QAAQ;EACzB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.js","names":["DEFAULT_DEGRADATION_CONFIG","errorThreshold","recoveryTimeout","FiberCapabilitiesManager","cachedSnapshot","listeners","Set","featureErrorCounts","Map","featureLastError","recoveryTimers","constructor","config","capabilities","hookInstalled","rendererDetected","fiberAccessWorking","detectedReactVersion","lastValidationTime","errorCount","disabledFeatures","getCapabilities","isFeatureAvailable","feature","has","setCapability","key","value","oldValue","notifyListeners","recordError","error","currentCount","get","newCount","set","Date","now","disableFeature","scheduleRecoveryCheck","process","env","NODE_ENV","console","warn","clearErrors","delete","newDisabled","resetAll","clear","onCapabilitiesChange","listener","add","dispose","timer","values","clearTimeout","existingTimer","undefined","setTimeout","lastError","info","snapshot","instance","getCapabilitiesManager"],"sources":["capabilities.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\nexport type FiberFeature =\n | \"component-inspection\"\n | \"hook-discovery\"\n | \"render-tracking\"\n | \"state-inspection\"\n | \"metadata-extraction\"\n | \"fiber-discovery\";\n\nexport interface FiberCapabilities {\n hookInstalled: boolean;\n rendererDetected: boolean;\n fiberAccessWorking: boolean;\n detectedReactVersion: string | null;\n lastValidationTime: number;\n errorCount: number;\n disabledFeatures: Set<FiberFeature>;\n}\n\ninterface DegradationConfig {\n errorThreshold: number;\n recoveryTimeout: number;\n}\n\nconst DEFAULT_DEGRADATION_CONFIG: DegradationConfig = {\n errorThreshold: 3,\n recoveryTimeout: 30000,\n};\n\ntype CapabilitiesListener = (capabilities: FiberCapabilities) => void;\n\nexport class FiberCapabilitiesManager {\n private capabilities: FiberCapabilities;\n private cachedSnapshot: Readonly<FiberCapabilities> | null = null;\n private listeners: Set<CapabilitiesListener> = new Set();\n private featureErrorCounts: Map<FiberFeature, number> = new Map();\n private featureLastError: Map<FiberFeature, number> = new Map();\n private recoveryTimers: Map<FiberFeature, ReturnType<typeof setTimeout>> =\n new Map();\n private config: DegradationConfig;\n\n constructor(config: Partial<DegradationConfig> = {}) {\n this.config = { ...DEFAULT_DEGRADATION_CONFIG, ...config };\n this.capabilities = {\n hookInstalled: false,\n rendererDetected: false,\n fiberAccessWorking: false,\n detectedReactVersion: null,\n lastValidationTime: 0,\n errorCount: 0,\n disabledFeatures: new Set(),\n };\n }\n\n getCapabilities(): Readonly<FiberCapabilities> {\n if (this.cachedSnapshot != null) {\n return this.cachedSnapshot;\n }\n this.cachedSnapshot = {\n ...this.capabilities,\n disabledFeatures: new Set(this.capabilities.disabledFeatures),\n };\n return this.cachedSnapshot;\n }\n\n isFeatureAvailable(feature: FiberFeature): boolean {\n if (this.capabilities.disabledFeatures.has(feature)) {\n return false;\n }\n return this.capabilities.fiberAccessWorking;\n }\n\n setCapability<K extends keyof FiberCapabilities>(\n key: K,\n value: FiberCapabilities[K],\n ): void {\n const oldValue = this.capabilities[key];\n if (oldValue === value) {\n return;\n }\n\n this.capabilities = {\n ...this.capabilities,\n [key]: value,\n };\n this.cachedSnapshot = null;\n this.notifyListeners();\n }\n\n recordError(feature: FiberFeature, error: unknown): void {\n const currentCount = this.featureErrorCounts.get(feature) ?? 0;\n const newCount = currentCount + 1;\n this.featureErrorCounts.set(feature, newCount);\n this.featureLastError.set(feature, Date.now());\n\n this.capabilities = {\n ...this.capabilities,\n errorCount: this.capabilities.errorCount + 1,\n };\n this.cachedSnapshot = null;\n\n if (newCount >= this.config.errorThreshold) {\n this.disableFeature(feature);\n }\n\n this.scheduleRecoveryCheck(feature);\n this.notifyListeners();\n\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n `[OSDK DevTools] Fiber feature \"${feature}\" error (${newCount}/${this.config.errorThreshold}):`,\n error,\n );\n }\n }\n\n clearErrors(feature: FiberFeature): void {\n this.featureErrorCounts.delete(feature);\n this.featureLastError.delete(feature);\n\n if (this.capabilities.disabledFeatures.has(feature)) {\n const newDisabled = new Set(this.capabilities.disabledFeatures);\n newDisabled.delete(feature);\n this.capabilities = {\n ...this.capabilities,\n disabledFeatures: newDisabled,\n };\n this.cachedSnapshot = null;\n this.notifyListeners();\n }\n }\n\n resetAll(): void {\n this.featureErrorCounts.clear();\n this.featureLastError.clear();\n this.capabilities = {\n ...this.capabilities,\n errorCount: 0,\n disabledFeatures: new Set(),\n };\n this.cachedSnapshot = null;\n this.notifyListeners();\n }\n\n onCapabilitiesChange(listener: CapabilitiesListener): () => void {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n dispose(): void {\n for (const timer of this.recoveryTimers.values()) {\n clearTimeout(timer);\n }\n this.recoveryTimers.clear();\n this.listeners.clear();\n }\n\n private disableFeature(feature: FiberFeature): void {\n if (this.capabilities.disabledFeatures.has(feature)) {\n return;\n }\n\n const newDisabled = new Set(this.capabilities.disabledFeatures);\n newDisabled.add(feature);\n this.capabilities = {\n ...this.capabilities,\n disabledFeatures: newDisabled,\n };\n this.cachedSnapshot = null;\n\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n `[OSDK DevTools] Fiber feature \"${feature}\" has been disabled due to repeated errors`,\n );\n }\n }\n\n private scheduleRecoveryCheck(feature: FiberFeature): void {\n const existingTimer = this.recoveryTimers.get(feature);\n if (existingTimer !== undefined) {\n clearTimeout(existingTimer);\n }\n\n const timer = setTimeout(() => {\n this.recoveryTimers.delete(feature);\n const lastError = this.featureLastError.get(feature);\n if (lastError && Date.now() - lastError >= this.config.recoveryTimeout) {\n this.clearErrors(feature);\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.info(\n `[OSDK DevTools] Fiber feature \"${feature}\" re-enabled after recovery timeout`,\n );\n }\n }\n }, this.config.recoveryTimeout);\n\n this.recoveryTimers.set(feature, timer);\n }\n\n private notifyListeners(): void {\n const snapshot = this.getCapabilities();\n for (const listener of this.listeners) {\n try {\n listener(snapshot);\n } catch {\n // Ignore listener errors\n }\n }\n }\n}\n\nlet instance: FiberCapabilitiesManager | null = null;\n\nexport function getCapabilitiesManager(): FiberCapabilitiesManager {\n if (instance == null) {\n instance = new FiberCapabilitiesManager();\n }\n return instance;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyBA,MAAMA,0BAA6C,GAAG;EACpDC,cAAc,EAAE,CAAC;EACjBC,eAAe,EAAE;AACnB,CAAC;AAID,OAAO,MAAMC,wBAAwB,CAAC;EAE5BC,cAAc,GAAuC,IAAI;EACzDC,SAAS,GAA8B,IAAIC,GAAG,CAAC,CAAC;EAChDC,kBAAkB,GAA8B,IAAIC,GAAG,CAAC,CAAC;EACzDC,gBAAgB,GAA8B,IAAID,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EAAS;IAC9B,MAAMiC,QAAQ,GAAG,IAAI,CAACzC,eAAe,CAAC,CAAC;IACvC,KAAK,MAAM8B,QAAQ,IAAI,IAAI,CAAC9C,SAAS,EAAE;MACrC,IAAI;QACF8C,QAAQ,CAACW,QAAQ,CAAC;MACpB,CAAC,CAAC,MAAM;QACN;MAAA;IAEJ;EACF;AACF;AAEA,IAAIC,QAAyC,GAAG,IAAI;AAEpD,OAAO,SAASC,sBAAsBA,CAAA,EAA6B;EACjE,IAAID,QAAQ,IAAI,IAAI,EAAE;IACpBA,QAAQ,GAAG,IAAI5D,wBAAwB,CAAC,CAAC;EAC3C;EACA,OAAO4D,QAAQ;AACjB","ignoreList":[]}
1
+ {"version":3,"file":"capabilities.js","names":["DEFAULT_DEGRADATION_CONFIG","errorThreshold","recoveryTimeout","FiberCapabilitiesManager","cachedSnapshot","listeners","Set","featureErrorCounts","Map","featureLastError","recoveryTimers","constructor","config","capabilities","hookInstalled","rendererDetected","fiberAccessWorking","detectedReactVersion","lastValidationTime","errorCount","disabledFeatures","getCapabilities","isFeatureAvailable","feature","has","setCapability","key","value","oldValue","notifyListeners","recordError","error","currentCount","get","newCount","set","Date","now","disableFeature","scheduleRecoveryCheck","process","env","NODE_ENV","console","warn","clearErrors","delete","newDisabled","resetAll","clear","onCapabilitiesChange","listener","add","dispose","timer","values","clearTimeout","existingTimer","undefined","setTimeout","lastError","info","snapshot","instance","getCapabilitiesManager"],"sources":["capabilities.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\nexport type FiberFeature =\n | \"component-inspection\"\n | \"hook-discovery\"\n | \"render-tracking\"\n | \"state-inspection\"\n | \"metadata-extraction\"\n | \"fiber-discovery\";\n\nexport interface FiberCapabilities {\n hookInstalled: boolean;\n rendererDetected: boolean;\n fiberAccessWorking: boolean;\n detectedReactVersion: string | null;\n lastValidationTime: number;\n errorCount: number;\n disabledFeatures: Set<FiberFeature>;\n}\n\ninterface DegradationConfig {\n errorThreshold: number;\n recoveryTimeout: number;\n}\n\nconst DEFAULT_DEGRADATION_CONFIG: DegradationConfig = {\n errorThreshold: 3,\n recoveryTimeout: 30000,\n};\n\ntype CapabilitiesListener = (capabilities: FiberCapabilities) => void;\n\nexport class FiberCapabilitiesManager {\n private capabilities: FiberCapabilities;\n private cachedSnapshot: Readonly<FiberCapabilities> | null = null;\n private listeners = new Set<CapabilitiesListener>();\n private featureErrorCounts = new Map<FiberFeature, number>();\n private featureLastError = new Map<FiberFeature, number>();\n private recoveryTimers = new Map<\n FiberFeature,\n ReturnType<typeof setTimeout>\n >();\n private config: DegradationConfig;\n\n constructor(config: Partial<DegradationConfig> = {}) {\n this.config = { ...DEFAULT_DEGRADATION_CONFIG, ...config };\n this.capabilities = {\n hookInstalled: false,\n rendererDetected: false,\n fiberAccessWorking: false,\n detectedReactVersion: null,\n lastValidationTime: 0,\n errorCount: 0,\n disabledFeatures: new Set(),\n };\n }\n\n getCapabilities(): Readonly<FiberCapabilities> {\n if (this.cachedSnapshot != null) {\n return this.cachedSnapshot;\n }\n this.cachedSnapshot = {\n ...this.capabilities,\n disabledFeatures: new Set(this.capabilities.disabledFeatures),\n };\n return this.cachedSnapshot;\n }\n\n isFeatureAvailable(feature: FiberFeature): boolean {\n if (this.capabilities.disabledFeatures.has(feature)) {\n return false;\n }\n return this.capabilities.fiberAccessWorking;\n }\n\n setCapability<K extends keyof FiberCapabilities>(\n key: K,\n value: FiberCapabilities[K]\n ): void {\n const oldValue = this.capabilities[key];\n if (oldValue === value) {\n return;\n }\n\n this.capabilities = {\n ...this.capabilities,\n [key]: value,\n };\n this.cachedSnapshot = null;\n this.notifyListeners();\n }\n\n recordError(feature: FiberFeature, error: unknown): void {\n const currentCount = this.featureErrorCounts.get(feature) ?? 0;\n const newCount = currentCount + 1;\n this.featureErrorCounts.set(feature, newCount);\n this.featureLastError.set(feature, Date.now());\n\n this.capabilities = {\n ...this.capabilities,\n errorCount: this.capabilities.errorCount + 1,\n };\n this.cachedSnapshot = null;\n\n if (newCount >= this.config.errorThreshold) {\n this.disableFeature(feature);\n }\n\n this.scheduleRecoveryCheck(feature);\n this.notifyListeners();\n\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n `[OSDK DevTools] Fiber feature \"${feature}\" error (${newCount}/${this.config.errorThreshold}):`,\n error\n );\n }\n }\n\n clearErrors(feature: FiberFeature): void {\n this.featureErrorCounts.delete(feature);\n this.featureLastError.delete(feature);\n\n if (this.capabilities.disabledFeatures.has(feature)) {\n const newDisabled = new Set(this.capabilities.disabledFeatures);\n newDisabled.delete(feature);\n this.capabilities = {\n ...this.capabilities,\n disabledFeatures: newDisabled,\n };\n this.cachedSnapshot = null;\n this.notifyListeners();\n }\n }\n\n resetAll(): void {\n this.featureErrorCounts.clear();\n this.featureLastError.clear();\n this.capabilities = {\n ...this.capabilities,\n errorCount: 0,\n disabledFeatures: new Set(),\n };\n this.cachedSnapshot = null;\n this.notifyListeners();\n }\n\n onCapabilitiesChange(listener: CapabilitiesListener): () => void {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n dispose(): void {\n for (const timer of this.recoveryTimers.values()) {\n clearTimeout(timer);\n }\n this.recoveryTimers.clear();\n this.listeners.clear();\n }\n\n private disableFeature(feature: FiberFeature): void {\n if (this.capabilities.disabledFeatures.has(feature)) {\n return;\n }\n\n const newDisabled = new Set(this.capabilities.disabledFeatures);\n newDisabled.add(feature);\n this.capabilities = {\n ...this.capabilities,\n disabledFeatures: newDisabled,\n };\n this.cachedSnapshot = null;\n\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n `[OSDK DevTools] Fiber feature \"${feature}\" has been disabled due to repeated errors`\n );\n }\n }\n\n private scheduleRecoveryCheck(feature: FiberFeature): void {\n const existingTimer = this.recoveryTimers.get(feature);\n if (existingTimer !== undefined) {\n clearTimeout(existingTimer);\n }\n\n const timer = setTimeout(() => {\n this.recoveryTimers.delete(feature);\n const lastError = this.featureLastError.get(feature);\n if (lastError && Date.now() - lastError >= this.config.recoveryTimeout) {\n this.clearErrors(feature);\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.info(\n `[OSDK DevTools] Fiber feature \"${feature}\" re-enabled after recovery timeout`\n );\n }\n }\n }, this.config.recoveryTimeout);\n\n this.recoveryTimers.set(feature, timer);\n }\n\n private notifyListeners(): void {\n const snapshot = this.getCapabilities();\n for (const listener of this.listeners) {\n try {\n listener(snapshot);\n } catch {\n // Ignore listener errors\n }\n }\n }\n}\n\nlet instance: FiberCapabilitiesManager | null = null;\n\nexport function getCapabilitiesManager(): FiberCapabilitiesManager {\n if (instance == null) {\n instance = new FiberCapabilitiesManager();\n }\n return instance;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyBA,MAAMA,0BAA6C,GAAG;EACpDC,cAAc,EAAE,CAAC;EACjBC,eAAe,EAAE;AACnB,CAAC;AAID,OAAO,MAAMC,wBAAwB,CAAC;EAE5BC,cAAc,GAAuC,IAAI;EACzDC,SAAS,GAAG,IAAIC,GAAG,CAAuB,CAAC;EAC3CC,kBAAkB,GAAG,IAAIC,GAAG,CAAuB,CAAC;EACpDC,gBAAgB,GAAG,IAAID,GAAG,CAAuB,CAAC;EAClDE,cAAc,GAAG,IAAIF,GAAG,CAG9B,CAAC;EAGHG,WAAWA,CAACC,MAAkC,GAAG,CAAC,CAAC,EAAE;IACnD,IAAI,CAACA,MAAM,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QACF8C,QAAQ,CAACW,QAAQ,CAAC;MACpB,CAAC,CAAC,MAAM;QACN;MAAA;IAEJ;EACF;AACF;AAEA,IAAIC,QAAyC,GAAG,IAAI;AAEpD,OAAO,SAASC,sBAAsBA,CAAA,EAA6B;EACjE,IAAID,QAAQ,IAAI,IAAI,EAAE;IACpBA,QAAQ,GAAG,IAAI5D,wBAAwB,CAAC,CAAC;EAC3C;EACA,OAAO4D,QAAQ;AACjB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"traverseFiber.js","names":["isUserComponent","safeFiberOperation","DEFAULT_MAX_DEPTH","traverseFiber","fiber","selector","ascending","maxDepth","return","child","match","sibling","traverseAllFibers","maxResults","results","walk","node","depth","length","push","walkFiberTree","visitor","stack","entry","pop","current","children","i","FIND_PARENT_MAX_DEPTH","findParentComponent","fallback","feature"],"sources":["traverseFiber.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 { isUserComponent } from \"./FiberTags.js\";\nimport { safeFiberOperation } from \"./SafeFiberOperation.js\";\nimport type { Fiber } from \"./types.js\";\n\nconst DEFAULT_MAX_DEPTH = 500;\n\nexport function traverseFiber(\n fiber: Fiber | null,\n selector: (node: Fiber) => boolean | void,\n ascending?: boolean,\n maxDepth: number = DEFAULT_MAX_DEPTH,\n): Fiber | null {\n if (!fiber) {\n return null;\n }\n\n if (selector(fiber) === true) {\n return fiber;\n }\n\n if (maxDepth <= 0) {\n return null;\n }\n\n if (ascending) {\n return fiber.return\n ? traverseFiber(fiber.return, selector, true, maxDepth - 1)\n : null;\n }\n\n let child: Fiber | null = fiber.child;\n while (child) {\n const match = traverseFiber(child, selector, false, maxDepth - 1);\n if (match) {\n return match;\n }\n child = child.sibling;\n }\n\n return null;\n}\n\nexport function traverseAllFibers(\n fiber: Fiber | null,\n selector: (node: Fiber) => boolean | void,\n ascending?: boolean,\n maxResults?: number,\n maxDepth: number = DEFAULT_MAX_DEPTH,\n): Fiber[] {\n const results: Fiber[] = [];\n\n function walk(node: Fiber | null, depth: number): void {\n if (!node) {\n return;\n }\n if (maxResults != null && results.length >= maxResults) {\n return;\n }\n\n if (selector(node) === true) {\n results.push(node);\n if (maxResults != null && results.length >= maxResults) {\n return;\n }\n }\n\n if (depth >= maxDepth) {\n return;\n }\n\n if (ascending) {\n if (node.return) {\n walk(node.return, depth + 1);\n }\n } else {\n let child: Fiber | null = node.child;\n while (child) {\n walk(child, depth + 1);\n if (maxResults != null && results.length >= maxResults) {\n return;\n }\n child = child.sibling;\n }\n }\n }\n\n walk(fiber, 0);\n return results;\n}\n\nexport function walkFiberTree(\n fiber: Fiber,\n visitor: (fiber: Fiber) => void,\n maxDepth: number = DEFAULT_MAX_DEPTH,\n): void {\n const stack: Array<{ fiber: Fiber; depth: number }> = [\n { fiber, depth: 0 },\n ];\n\n while (stack.length > 0) {\n const entry = stack.pop();\n if (!entry) {\n continue;\n }\n const { fiber: current, depth } = entry;\n\n if (depth > maxDepth) {\n continue;\n }\n\n visitor(current);\n\n const children: Fiber[] = [];\n let child: Fiber | null = current.child;\n while (child) {\n children.push(child);\n child = child.sibling;\n }\n\n for (let i = children.length - 1; i >= 0; i--) {\n stack.push({ fiber: children[i], depth: depth + 1 });\n }\n }\n}\n\nconst FIND_PARENT_MAX_DEPTH = 100;\n\nexport function findParentComponent(fiber: Fiber): Fiber | null {\n return safeFiberOperation(\n () => {\n let current: Fiber | null = fiber.return;\n let depth = 0;\n\n while (current && depth < FIND_PARENT_MAX_DEPTH) {\n if (isUserComponent(current)) {\n return current;\n }\n current = current.return;\n depth++;\n }\n\n return null;\n },\n { fallback: null, feature: \"component-inspection\" },\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,QAAQ,gBAAgB;AAChD,SAASC,kBAAkB,QAAQ,yBAAyB;AAG5D,MAAMC,iBAAiB,GAAG,GAAG;AAE7B,OAAO,SAASC,aAAaA,CAC3BC,KAAmB,EACnBC,QAAyC,EACzCC,SAAmB,EACnBC,QAAgB,GAAGL,iBAAiB,EACtB;EACd,IAAI,CAACE,KAAK,EAAE;IACV,OAAO,IAAI;EACb;EAEA,IAAIC,QAAQ,CAACD,KAAK,CAAC,KAAK,IAAI,EAAE;IAC5B,OAAOA,KAAK;EACd;EAEA,IAAIG,QAAQ,IAAI,CAAC,EAAE;IACjB,OAAO,IAAI;EACb;EAEA,IAAID,SAAS,EAAE;IACb,OAAOF,KAAK,CAACI,MAAM,GACfL,aAAa,CAACC,KAAK,CAACI,MAAM,EAAEH,QAAQ,EAAE,IAAI,EAAEE,QAAQ,GAAG,CAAC,CAAC,GACzD,IAAI;EACV;EAEA,IAAIE,KAAmB,GAAGL,KAAK,CAACK,KAAK;EACrC,OAAOA,KAAK,EAAE;IACZ,MAAMC,KAAK,GAAGP,aAAa,CAACM,KAAK,EAAEJ,QAAQ,EAAE,KAAK,EAAEE,QAAQ,GAAG,CAAC,CAAC;IACjE,IAAIG,KAAK,EAAE;MACT,OAAOA,KAAK;IACd;IACAD,KAAK,GAAGA,KAAK,CAACE,OAAO;EACvB;EAEA,OAAO,IAAI;AACb;AAEA,OAAO,SAASC,iBAAiBA,CAC/BR,KAAmB,EACnBC,QAAyC,EACzCC,SAAmB,EACnBO,UAAmB,EACnBN,QAAgB,GAAGL,iBAAiB,EAC3B;EACT,MAAMY,OAAgB,GAAG,EAAE;EAE3B,SAASC,IAAIA,CAACC,IAAkB,EAAEC,KAAa,EAAQ;IACrD,IAAI,CAACD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AEvC,IAAIN,KAAK,GAAGV,QAAQ,EAAE;MACpB;IACF;IAEAc,OAAO,CAACI,OAAO,CAAC;IAEhB,MAAMC,QAAiB,GAAG,EAAE;IAC5B,IAAIjB,KAAmB,GAAGgB,OAAO,CAAChB,KAAK;IACvC,OAAOA,KAAK,EAAE;MACZiB,QAAQ,CAACP,IAAI,CAACV,KAAK,CAAC;MACpBA,KAAK,GAAGA,KAAK,CAACE,OAAO;IACvB;IAEA,KAAK,IAAIgB,CAAC,GAAGD,QAAQ,CAACR,MAAM,GAAG,CAAC,EAAES,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;MAC7CL,KAAK,CAACH,IAAI,CAAC;QAAEf,KAAK,EAAEsB,QAAQ,CAACC,CAAC,CAAC;QAAEV,KAAK,EAAEA,KAAK,GAAG;MAAE,CAAC,CAAC;IACtD;EACF;AACF;AAEA,MAAMW,qBAAqB,GAAG,GAAG;AAEjC,OAAO,SAASC,mBAAmBA,CAACzB,KAAY,EAAgB;EAC9D,OAAOH,kBAAkB,CACvB,MAAM;IACJ,IAAIwB,OAAqB,GAAGrB,KAAK,CAACI,MAAM;IACxC,IAAIS,KAAK,GAAG,CAAC;IAEb,OAAOQ,OAAO,IAAIR,KAAK,GAAGW,qBAAqB,EAAE;MAC/C,IAAI5B,eAAe,CAACyB,OAAO,CAAC,EAAE;QAC5B,OAAOA,OAAO;MAChB;MACAA,OAAO,GAAGA,OAAO,CAACjB,MAAM;MACxBS,KAAK,EAAE;IACT;IAEA,OAAO,IAAI;EACb,CAAC,EACD;IAAEa,QAAQ,EAAE,IAAI;IAAEC,OAAO,EAAE;EAAuB,CACpD,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"traverseFiber.js","names":["isUserComponent","safeFiberOperation","DEFAULT_MAX_DEPTH","traverseFiber","fiber","selector","ascending","maxDepth","return","child","match","sibling","traverseAllFibers","maxResults","results","walk","node","depth","length","push","walkFiberTree","visitor","stack","entry","pop","current","children","i","FIND_PARENT_MAX_DEPTH","findParentComponent","fallback","feature"],"sources":["traverseFiber.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 { isUserComponent } from \"./FiberTags.js\";\nimport { safeFiberOperation } from \"./SafeFiberOperation.js\";\nimport type { Fiber } from \"./types.js\";\n\nconst DEFAULT_MAX_DEPTH = 500;\n\nexport function traverseFiber(\n fiber: Fiber | null,\n selector: (node: Fiber) => boolean | void,\n ascending?: boolean,\n maxDepth: number = DEFAULT_MAX_DEPTH\n): Fiber | null {\n if (!fiber) {\n return null;\n }\n\n if (selector(fiber) === true) {\n return fiber;\n }\n\n if (maxDepth <= 0) {\n return null;\n }\n\n if (ascending) {\n return fiber.return\n ? traverseFiber(fiber.return, selector, true, maxDepth - 1)\n : null;\n }\n\n let child: Fiber | null = fiber.child;\n while (child) {\n const match = traverseFiber(child, selector, false, maxDepth - 1);\n if (match) {\n return match;\n }\n child = child.sibling;\n }\n\n return null;\n}\n\nexport function traverseAllFibers(\n fiber: Fiber | null,\n selector: (node: Fiber) => boolean | void,\n ascending?: boolean,\n maxResults?: number,\n maxDepth: number = DEFAULT_MAX_DEPTH\n): Fiber[] {\n const results: Fiber[] = [];\n\n function walk(node: Fiber | null, depth: number): void {\n if (!node) {\n return;\n }\n if (maxResults != null && results.length >= maxResults) {\n return;\n }\n\n if (selector(node) === true) {\n results.push(node);\n if (maxResults != null && results.length >= maxResults) {\n return;\n }\n }\n\n if (depth >= maxDepth) {\n return;\n }\n\n if (ascending) {\n if (node.return) {\n walk(node.return, depth + 1);\n }\n } else {\n let child: Fiber | null = node.child;\n while (child) {\n walk(child, depth + 1);\n if (maxResults != null && results.length >= maxResults) {\n return;\n }\n child = child.sibling;\n }\n }\n }\n\n walk(fiber, 0);\n return results;\n}\n\nexport function walkFiberTree(\n fiber: Fiber,\n visitor: (fiber: Fiber) => void,\n maxDepth: number = DEFAULT_MAX_DEPTH\n): void {\n const stack: Array<{ fiber: Fiber; depth: number }> = [{ fiber, depth: 0 }];\n\n while (stack.length > 0) {\n const entry = stack.pop();\n if (!entry) {\n continue;\n }\n const { fiber: current, depth } = entry;\n\n if (depth > maxDepth) {\n continue;\n }\n\n visitor(current);\n\n const children: Fiber[] = [];\n let child: Fiber | null = current.child;\n while (child) {\n children.push(child);\n child = child.sibling;\n }\n\n for (let i = children.length - 1; i >= 0; i--) {\n stack.push({ fiber: children[i], depth: depth + 1 });\n }\n }\n}\n\nconst FIND_PARENT_MAX_DEPTH = 100;\n\nexport function findParentComponent(fiber: Fiber): Fiber | null {\n return safeFiberOperation(\n () => {\n let current: Fiber | null = fiber.return;\n let depth = 0;\n\n while (current && depth < FIND_PARENT_MAX_DEPTH) {\n if (isUserComponent(current)) {\n return current;\n }\n current = current.return;\n depth++;\n }\n\n return null;\n },\n { fallback: null, feature: \"component-inspection\" }\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,QAAQ,gBAAgB;AAChD,SAASC,kBAAkB,QAAQ,yBAAyB;AAG5D,MAAMC,iBAAiB,GAAG,GAAG;AAE7B,OAAO,SAASC,aAAaA,CAC3BC,KAAmB,EACnBC,QAAyC,EACzCC,SAAmB,EACnBC,QAAgB,GAAGL,iBAAiB,EACtB;EACd,IAAI,CAACE,KAAK,EAAE;IACV,OAAO,IAAI;EACb;EAEA,IAAIC,QAAQ,CAACD,KAAK,CAAC,KAAK,IAAI,EAAE;IAC5B,OAAOA,KAAK;EACd;EAEA,IAAIG,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,GAAG;MAAE,CAAC,CAAC;IACtD;EACF;AACF;AAEA,MAAMW,qBAAqB,GAAG,GAAG;AAEjC,OAAO,SAASC,mBAAmBA,CAACzB,KAAY,EAAgB;EAC9D,OAAOH,kBAAkB,CACvB,MAAM;IACJ,IAAIwB,OAAqB,GAAGrB,KAAK,CAACI,MAAM;IACxC,IAAIS,KAAK,GAAG,CAAC;IAEb,OAAOQ,OAAO,IAAIR,KAAK,GAAGW,qBAAqB,EAAE;MAC/C,IAAI5B,eAAe,CAACyB,OAAO,CAAC,EAAE;QAC5B,OAAOA,OAAO;MAChB;MACAA,OAAO,GAAGA,OAAO,CAACjB,MAAM;MACxBS,KAAK,EAAE;IACT;IAEA,OAAO,IAAI;EACb,CAAC,EACD;IAAEa,QAAQ,EAAE,IAAI;IAAEC,OAAO,EAAE;EAAuB,CACpD,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n Fiber as ReactFiber,\n FiberRoot,\n Flags,\n Lanes,\n ReactContext,\n WorkTag,\n} from \"react-reconciler\";\n\nexport type { FiberRoot, Flags, Lanes, ReactContext, WorkTag };\n\nexport interface ContextDependency<T = unknown> {\n context: ReactContext<T>;\n memoizedValue: T;\n next: ContextDependency | null;\n observedBits: number;\n}\n\nexport interface Dependencies {\n firstContext: ContextDependency | null;\n lanes: Lanes;\n}\n\nexport interface Effect {\n create: (...args: unknown[]) => unknown;\n deps: unknown[] | null;\n destroy: ((...args: unknown[]) => unknown) | null;\n next: Effect | null;\n tag: number;\n}\n\nexport interface MemoizedState {\n memoizedState: unknown;\n next: MemoizedState | null;\n}\n\nexport interface FiberProps {\n [key: string]: unknown;\n}\n\nexport interface UpdateQueue {\n lastEffect: Effect | null;\n}\n\nexport type Fiber<TStateNode = unknown> =\n & Omit<\n ReactFiber,\n | \"alternate\"\n | \"child\"\n | \"dependencies\"\n | \"memoizedProps\"\n | \"memoizedState\"\n | \"pendingProps\"\n | \"return\"\n | \"sibling\"\n | \"stateNode\"\n | \"updateQueue\"\n >\n & {\n _debugInfo?: Array<{\n debugLocation?: unknown;\n env?: string;\n name?: string;\n }>;\n\n _debugOwner?: Fiber;\n _debugSource?: {\n columnNumber?: number;\n fileName: string;\n lineNumber: number;\n };\n\n _debugStack?: Error & { stack: string };\n alternate: Fiber | null;\n child: Fiber | null;\n return: Fiber | null;\n sibling: Fiber | null;\n\n dependencies: Dependencies | null;\n memoizedProps: FiberProps;\n memoizedState: MemoizedState | null;\n pendingProps: FiberProps;\n stateNode: TStateNode;\n updateQueue: UpdateQueue | null;\n };\n\nexport interface ReactRenderer {\n bundleType: 0 | 1;\n findFiberByHostInstance?: (hostInstance: unknown) => Fiber | null;\n getCurrentFiber?: (fiber: Fiber) => Fiber | null;\n overrideHookState?: (\n fiber: Fiber,\n id: string,\n path: string[],\n value: unknown,\n ) => void;\n overrideProps?: (fiber: Fiber, path: string[], value: unknown) => void;\n reconcilerVersion: string;\n rendererPackageName: string;\n version: string;\n}\n\nexport interface ReactDevToolsGlobalHook {\n _instrumentationIsActive?: boolean;\n _instrumentationSource?: string;\n checkDCE: (fn: unknown) => void;\n hasUnsupportedRendererAttached: boolean;\n inject: (renderer: ReactRenderer) => number;\n on: () => void;\n onCommitFiberRoot: (\n rendererID: number,\n root: FiberRoot,\n priority: number | void,\n ) => void;\n onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;\n onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;\n renderers: Map<number, ReactRenderer>;\n supportsFiber: boolean;\n supportsFlight: boolean;\n}\n\nexport interface SourceLocation {\n fileName: string;\n lineNumber: number;\n columnNumber?: number;\n}\n\ndeclare global {\n var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook | undefined;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n Fiber as ReactFiber,\n FiberRoot,\n Flags,\n Lanes,\n ReactContext,\n WorkTag,\n} from \"react-reconciler\";\n\nexport type { FiberRoot, Flags, Lanes, ReactContext, WorkTag };\n\nexport interface ContextDependency<T = unknown> {\n context: ReactContext<T>;\n memoizedValue: T;\n next: ContextDependency | null;\n observedBits: number;\n}\n\nexport interface Dependencies {\n firstContext: ContextDependency | null;\n lanes: Lanes;\n}\n\nexport interface Effect {\n create: (...args: unknown[]) => unknown;\n deps: unknown[] | null;\n destroy: ((...args: unknown[]) => unknown) | null;\n next: Effect | null;\n tag: number;\n}\n\nexport interface MemoizedState {\n memoizedState: unknown;\n next: MemoizedState | null;\n}\n\nexport interface FiberProps {\n [key: string]: unknown;\n}\n\nexport interface UpdateQueue {\n lastEffect: Effect | null;\n}\n\nexport type Fiber<TStateNode = unknown> = Omit<\n ReactFiber,\n | \"alternate\"\n | \"child\"\n | \"dependencies\"\n | \"memoizedProps\"\n | \"memoizedState\"\n | \"pendingProps\"\n | \"return\"\n | \"sibling\"\n | \"stateNode\"\n | \"updateQueue\"\n> & {\n _debugInfo?: Array<{\n debugLocation?: unknown;\n env?: string;\n name?: string;\n }>;\n\n _debugOwner?: Fiber;\n _debugSource?: {\n columnNumber?: number;\n fileName: string;\n lineNumber: number;\n };\n\n _debugStack?: Error & { stack: string };\n alternate: Fiber | null;\n child: Fiber | null;\n return: Fiber | null;\n sibling: Fiber | null;\n\n dependencies: Dependencies | null;\n memoizedProps: FiberProps;\n memoizedState: MemoizedState | null;\n pendingProps: FiberProps;\n stateNode: TStateNode;\n updateQueue: UpdateQueue | null;\n};\n\nexport interface ReactRenderer {\n bundleType: 0 | 1;\n findFiberByHostInstance?: (hostInstance: unknown) => Fiber | null;\n getCurrentFiber?: (fiber: Fiber) => Fiber | null;\n overrideHookState?: (\n fiber: Fiber,\n id: string,\n path: string[],\n value: unknown\n ) => void;\n overrideProps?: (fiber: Fiber, path: string[], value: unknown) => void;\n reconcilerVersion: string;\n rendererPackageName: string;\n version: string;\n}\n\nexport interface ReactDevToolsGlobalHook {\n _instrumentationIsActive?: boolean;\n _instrumentationSource?: string;\n checkDCE: (fn: unknown) => void;\n hasUnsupportedRendererAttached: boolean;\n inject: (renderer: ReactRenderer) => number;\n on: () => void;\n onCommitFiberRoot: (\n rendererID: number,\n root: FiberRoot,\n priority: number | void\n ) => void;\n onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;\n onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;\n renderers: Map<number, ReactRenderer>;\n supportsFiber: boolean;\n supportsFlight: boolean;\n}\n\nexport interface SourceLocation {\n fileName: string;\n lineNumber: number;\n columnNumber?: number;\n}\n\ndeclare global {\n var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook | undefined;\n}\n"],"mappings":"","ignoreList":[]}
@@ -20,7 +20,7 @@ export function validateFiberAccess() {
20
20
  const manager = getCapabilitiesManager();
21
21
  const errors = [];
22
22
  let reactVersion = null;
23
- const hookInstalled = typeof globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined";
23
+ const hookInstalled = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__ !== undefined;
24
24
  manager.setCapability("hookInstalled", hookInstalled);
25
25
  if (!hookInstalled) {
26
26
  errors.push({
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","names":["getCapabilitiesManager","getAllFiberRoots","getRenderers","validateFiberAccess","manager","errors","reactVersion","hookInstalled","globalThis","__REACT_DEVTOOLS_GLOBAL_HOOK__","setCapability","push","field","message","value","rendererDetected","hook","renderers","size","firstRenderer","values","next","version","reconcilerVersion","fiberAccessWorking","testFiberAccess","Date","now","success","capabilities","detectedReactVersion","trackedRoots","fiberRoot","current","tag","domRoots","findReactRoots","root","fiber","getFiberFromRoot","COMMON_ROOT_SELECTORS","hasReactInternals","element","key","startsWith","roots","selector","el","document","querySelector","length","topLevelChildren","body","children","child","elementWithInternals","container","legacyRoot","_reactRootContainer","internalRoot","_internalRoot"],"sources":["validation.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ValidationError } from \"../types/index.js\";\nimport {\n type FiberCapabilities,\n getCapabilitiesManager,\n} from \"./capabilities.js\";\nimport { getAllFiberRoots, getRenderers } from \"./DevtoolsHook.js\";\n\ninterface ValidationResult {\n success: boolean;\n reactVersion: string | null;\n capabilities: Partial<FiberCapabilities>;\n errors: ValidationError[];\n}\n\nexport function validateFiberAccess(): ValidationResult {\n const manager = getCapabilitiesManager();\n const errors: ValidationError[] = [];\n let reactVersion: string | null = null;\n\n const hookInstalled =\n typeof globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__ !== \"undefined\";\n manager.setCapability(\"hookInstalled\", hookInstalled);\n\n if (!hookInstalled) {\n errors.push({\n field: \"hookInstalled\",\n message: \"React DevTools global hook is not installed\",\n value: false,\n });\n }\n\n let rendererDetected = false;\n if (hookInstalled) {\n const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n if (hook?.renderers && hook.renderers.size > 0) {\n rendererDetected = true;\n\n const firstRenderer = hook.renderers.values().next().value;\n if (firstRenderer?.version) {\n reactVersion = firstRenderer.version;\n } else if (firstRenderer?.reconcilerVersion) {\n reactVersion = firstRenderer.reconcilerVersion;\n }\n }\n }\n manager.setCapability(\"rendererDetected\", rendererDetected);\n manager.setCapability(\"detectedReactVersion\", reactVersion);\n\n if (!rendererDetected) {\n errors.push({\n field: \"rendererDetected\",\n message: \"No React renderer detected. React may not have loaded yet.\",\n value: false,\n });\n }\n\n let fiberAccessWorking = false;\n if (rendererDetected) {\n fiberAccessWorking = testFiberAccess();\n }\n manager.setCapability(\"fiberAccessWorking\", fiberAccessWorking);\n\n if (rendererDetected && !fiberAccessWorking) {\n errors.push({\n field: \"fiberAccessWorking\",\n message: \"Unable to access React fiber tree\",\n value: false,\n });\n }\n\n manager.setCapability(\"lastValidationTime\", Date.now());\n\n const success = hookInstalled && rendererDetected && fiberAccessWorking;\n\n return {\n success,\n reactVersion,\n capabilities: {\n hookInstalled,\n rendererDetected,\n fiberAccessWorking,\n detectedReactVersion: reactVersion,\n },\n errors,\n };\n}\n\nfunction testFiberAccess(): boolean {\n const renderers = getRenderers();\n if (renderers.size > 0) {\n return true;\n }\n\n try {\n const trackedRoots = getAllFiberRoots();\n for (const fiberRoot of trackedRoots) {\n if (\n fiberRoot.current\n && typeof fiberRoot.current === \"object\"\n && \"tag\" in fiberRoot.current\n && typeof fiberRoot.current.tag === \"number\"\n ) {\n return true;\n }\n }\n\n const domRoots = findReactRoots();\n for (const root of domRoots) {\n const fiber = getFiberFromRoot(root);\n if (\n fiber\n && typeof fiber === \"object\"\n && \"tag\" in fiber\n && typeof fiber.tag === \"number\"\n ) {\n return true;\n }\n }\n\n return false;\n } catch {\n return false;\n }\n}\n\nconst COMMON_ROOT_SELECTORS = [\n \"#root\",\n \"#app\",\n \"#__next\",\n \"[data-reactroot]\",\n \"#___gatsby\",\n \"#react-root\",\n \"#application\",\n];\n\nfunction hasReactInternals(element: Element): boolean {\n for (const key in element) {\n if (\n key.startsWith(\"__reactContainer$\")\n || key.startsWith(\"_reactRootContainer\")\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction findReactRoots(): Element[] {\n const roots: Element[] = [];\n\n for (const selector of COMMON_ROOT_SELECTORS) {\n const el = document.querySelector(selector);\n if (el && hasReactInternals(el)) {\n roots.push(el);\n }\n }\n\n if (roots.length > 0) {\n return roots;\n }\n\n const topLevelChildren = document.body?.children;\n if (topLevelChildren) {\n for (const child of topLevelChildren) {\n if (hasReactInternals(child)) {\n roots.push(child);\n }\n }\n }\n\n return roots;\n}\n\nfunction getFiberFromRoot(element: Element): unknown {\n const elementWithInternals = element as unknown as Record<string, unknown>;\n\n for (const key in element) {\n if (key.startsWith(\"__reactContainer$\")) {\n const container = elementWithInternals[key];\n if (\n container && typeof container === \"object\" && \"current\" in container\n ) {\n return (container as { current: unknown }).current;\n }\n }\n }\n\n if (\"_reactRootContainer\" in element) {\n const legacyRoot = elementWithInternals._reactRootContainer;\n if (legacyRoot && typeof legacyRoot === \"object\") {\n const internalRoot =\n (legacyRoot as Record<string, unknown>)._internalRoot;\n if (internalRoot && typeof internalRoot === \"object\") {\n return (internalRoot as { current: unknown }).current;\n }\n }\n }\n\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAEEA,sBAAsB,QACjB,mBAAmB;AAC1B,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,mBAAmB;AASlE,OAAO,SAASC,m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ASN,gBAAgBA,CAACG,OAAgB,EAAW;EACnD,MAAMa,oBAAoB,GAAGb,OAA6C;EAE1E,KAAK,MAAMC,GAAG,IAAID,OAAO,EAAE;IACzB,IAAIC,GAAG,CAACC,UAAU,CAAC,mBAAmB,CAAC,EAAE;MACvC,MAAMY,SAAS,GAAGD,oBAAoB,CAACZ,GAAG,CAAC;MAC3C,IACEa,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,SAAS,IAAIA,SAAS,EACpE;QACA,OAAQA,SAAS,CAA0BvB,OAAO;MACpD;IACF;EACF;EAEA,IAAI,qBAAqB,IAAIS,OAAO,EAAE;IACpC,MAAMe,UAAU,GAAGF,oBAAoB,CAACG,mBAAmB;IAC3D,IAAID,UAAU,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;MAChD,MAAME,YAAY,GACfF,UAAU,CAA6BG,aAAa;MACvD,IAAID,YAAY,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;QACpD,OAAQA,YAAY,CAA0B1B,OAAO;MACvD;IACF;EACF;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
1
+ {"version":3,"file":"validation.js","names":["getCapabilitiesManager","getAllFiberRoots","getRenderers","validateFiberAccess","manager","errors","reactVersion","hookInstalled","globalThis","__REACT_DEVTOOLS_GLOBAL_HOOK__","undefined","setCapability","push","field","message","value","rendererDetected","hook","renderers","size","firstRenderer","values","next","version","reconcilerVersion","fiberAccessWorking","testFiberAccess","Date","now","success","capabilities","detectedReactVersion","trackedRoots","fiberRoot","current","tag","domRoots","findReactRoots","root","fiber","getFiberFromRoot","COMMON_ROOT_SELECTORS","hasReactInternals","element","key","startsWith","roots","selector","el","document","querySelector","length","topLevelChildren","body","children","child","elementWithInternals","container","legacyRoot","_reactRootContainer","internalRoot","_internalRoot"],"sources":["validation.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ValidationError } from \"../types/index.js\";\nimport {\n type FiberCapabilities,\n getCapabilitiesManager,\n} from \"./capabilities.js\";\nimport { getAllFiberRoots, getRenderers } from \"./DevtoolsHook.js\";\n\ninterface ValidationResult {\n success: boolean;\n reactVersion: string | null;\n capabilities: Partial<FiberCapabilities>;\n errors: ValidationError[];\n}\n\nexport function validateFiberAccess(): ValidationResult {\n const manager = getCapabilitiesManager();\n const errors: ValidationError[] = [];\n let reactVersion: string | null = null;\n\n const hookInstalled = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__ !== undefined;\n manager.setCapability(\"hookInstalled\", hookInstalled);\n\n if (!hookInstalled) {\n errors.push({\n field: \"hookInstalled\",\n message: \"React DevTools global hook is not installed\",\n value: false,\n });\n }\n\n let rendererDetected = false;\n if (hookInstalled) {\n const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n if (hook?.renderers && hook.renderers.size > 0) {\n rendererDetected = true;\n\n const firstRenderer = hook.renderers.values().next().value;\n if (firstRenderer?.version) {\n reactVersion = firstRenderer.version;\n } else if (firstRenderer?.reconcilerVersion) {\n reactVersion = firstRenderer.reconcilerVersion;\n }\n }\n }\n manager.setCapability(\"rendererDetected\", rendererDetected);\n manager.setCapability(\"detectedReactVersion\", reactVersion);\n\n if (!rendererDetected) {\n errors.push({\n field: \"rendererDetected\",\n message: \"No React renderer detected. React may not have loaded yet.\",\n value: false,\n });\n }\n\n let fiberAccessWorking = false;\n if (rendererDetected) {\n fiberAccessWorking = testFiberAccess();\n }\n manager.setCapability(\"fiberAccessWorking\", fiberAccessWorking);\n\n if (rendererDetected && !fiberAccessWorking) {\n errors.push({\n field: \"fiberAccessWorking\",\n message: \"Unable to access React fiber tree\",\n value: false,\n });\n }\n\n manager.setCapability(\"lastValidationTime\", Date.now());\n\n const success = hookInstalled && rendererDetected && fiberAccessWorking;\n\n return {\n success,\n reactVersion,\n capabilities: {\n hookInstalled,\n rendererDetected,\n fiberAccessWorking,\n detectedReactVersion: reactVersion,\n },\n errors,\n };\n}\n\nfunction testFiberAccess(): boolean {\n const renderers = getRenderers();\n if (renderers.size > 0) {\n return true;\n }\n\n try {\n const trackedRoots = getAllFiberRoots();\n for (const fiberRoot of trackedRoots) {\n if (\n fiberRoot.current &&\n typeof fiberRoot.current === \"object\" &&\n \"tag\" in fiberRoot.current &&\n typeof fiberRoot.current.tag === \"number\"\n ) {\n return true;\n }\n }\n\n const domRoots = findReactRoots();\n for (const root of domRoots) {\n const fiber = getFiberFromRoot(root);\n if (\n fiber &&\n typeof fiber === \"object\" &&\n \"tag\" in fiber &&\n typeof fiber.tag === \"number\"\n ) {\n return true;\n }\n }\n\n return false;\n } catch {\n return false;\n }\n}\n\nconst COMMON_ROOT_SELECTORS = [\n \"#root\",\n \"#app\",\n \"#__next\",\n \"[data-reactroot]\",\n \"#___gatsby\",\n \"#react-root\",\n \"#application\",\n];\n\nfunction hasReactInternals(element: Element): boolean {\n for (const key in element) {\n if (\n key.startsWith(\"__reactContainer$\") ||\n key.startsWith(\"_reactRootContainer\")\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction findReactRoots(): Element[] {\n const roots: Element[] = [];\n\n for (const selector of COMMON_ROOT_SELECTORS) {\n const el = document.querySelector(selector);\n if (el && hasReactInternals(el)) {\n roots.push(el);\n }\n }\n\n if (roots.length > 0) {\n return roots;\n }\n\n const topLevelChildren = document.body?.children;\n if (topLevelChildren) {\n for (const child of topLevelChildren) {\n if (hasReactInternals(child)) {\n roots.push(child);\n }\n }\n }\n\n return roots;\n}\n\nfunction getFiberFromRoot(element: Element): unknown {\n const elementWithInternals = element as unknown as Record<string, unknown>;\n\n for (const key in element) {\n if (key.startsWith(\"__reactContainer$\")) {\n const container = elementWithInternals[key];\n if (\n container &&\n typeof container === \"object\" &&\n \"current\" in container\n ) {\n return (container as { current: unknown }).current;\n }\n }\n }\n\n if (\"_reactRootContainer\" in element) {\n const legacyRoot = elementWithInternals._reactRootContainer;\n if (legacyRoot && typeof legacyRoot === \"object\") {\n const internalRoot = (legacyRoot as Record<string, unknown>)\n ._internalRoot;\n if (internalRoot && typeof internalRoot === \"object\") {\n return (internalRoot as { current: unknown }).current;\n }\n }\n }\n\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAEEA,sBAAsB,QACjB,mBAAmB;AAC1B,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,mBAAmB;AASlE,OAAO,SAASC,mBAAmBA,CAAA,EAAqB;EACtD,MAAMC,OAAO,GAAGJ,sBAAsB,CAAC,CAAC;EACxC,MAAMK,MAAyB,GAAG,EAAE;EACpC,IAAIC,YAA2B,GAAG,IAAI;EAEtC,MAAMC,aAAa,GAAGC,UAAU,CAACC,8BAA8B,KAAKC,SAAS;EAC7EN,OAAO,CAACO,aAAa,CAAC,eAAe,EAAEJ,aAAa,CAAC;EAErD,IAAI,CAACA,aAAa,EAAE;IAClBF,MAAM,CAACO,IAAI,CAAC;MACVC,KAAK,EAAE,eAAe;MACtBC,OAAO,EAAE,6CAA6C;MACtDC,KAAK,EAAE;IACT,CAAC,CAAC;EACJ;EAEA,IAAIC,gBAAgB,GAAG,KAAK;EAC5B,IAAIT,aAAa,EAAE;IACjB,MAAMU,IAAI,GAAGT,UAAU,CAACC,8BAA8B;IACtD,IAAIQ,IAAI,EAAEC,SAAS,IAAID,IAAI,CAACC,SAAS,CAACC,IAAI,GAAG,CAAC,EAAE;MAC9CH,gBAAgB,GAAG,IAAI;MAEvB,MAAMI,aAAa,GAAGH,IAAI,CAACC,SAAS,CAACG,MAAM,CAA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 -1 +1 @@
1
- {"version":3,"file":"createPollingStore.js","names":["createPollingStore","fetchFn","intervalMs","currentValue","listeners","Set","intervalId","notify","listener","poll","result","Promise","then","value","catch","getSnapshot","subscribe","callback","add","size","setInterval","delete","clearInterval","forceRefresh"],"sources":["createPollingStore.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\nexport function createPollingStore<T>(\n fetchFn: () => T | Promise<T>,\n intervalMs: number,\n): {\n subscribe: (callback: () => void) => () => void;\n getSnapshot: () => T | undefined;\n forceRefresh: () => void;\n} {\n let currentValue: T | undefined;\n const listeners = new Set<() => void>();\n let intervalId: ReturnType<typeof setInterval> | null = null;\n\n function notify(): void {\n for (const listener of listeners) {\n listener();\n }\n }\n\n function poll(): void {\n try {\n const result = fetchFn();\n if (result instanceof Promise) {\n result.then((value) => {\n currentValue = value;\n notify();\n }).catch(() => {});\n } else {\n currentValue = result;\n notify();\n }\n } catch {\n // ignore polling errors\n }\n }\n\n // Eagerly fetch initial value at creation time (not during subscribe)\n // so getSnapshot() returns data before the first subscription.\n try {\n const result = fetchFn();\n if (result instanceof Promise) {\n result.then((value) => {\n currentValue = value;\n notify();\n }).catch(() => {});\n } else {\n currentValue = result;\n }\n } catch {\n // ignore initial fetch errors\n }\n\n function subscribe(callback: () => void): () => void {\n listeners.add(callback);\n if (listeners.size === 1) {\n intervalId = setInterval(poll, intervalMs);\n }\n return () => {\n listeners.delete(callback);\n if (listeners.size === 0 && intervalId != null) {\n clearInterval(intervalId);\n intervalId = null;\n }\n };\n }\n\n function getSnapshot(): T | undefined {\n return currentValue;\n }\n\n function forceRefresh(): void {\n poll();\n }\n\n return { subscribe, getSnapshot, forceRefresh };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASA,kBAAkBA,CAChCC,OAA6B,EAC7BC,UAAkB,EAKlB;EACA,IAAIC,YAA2B;EAC/B,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAa,CAAC;EACvC,IAAIC,UAAiD,GAAG,IAAI;EAE5D,SAASC,MAAMA,CAAA,EAAS;IACtB,KAAK,MAAMC,QAAQ,IAAIJ,SAAS,EAAE;MAChCI,QAAQ,CAAC,CAAC;IACZ;EACF;EAEA,SAASC,IAAIA,CAAA,EAAS;IACpB,IAAI;MACF,MAAMC,MAAM,GAAGT,OAAO,CAAC,CAAC;MACxB,IAAIS,MAAM,YAAYC,OAAO,EAAE;QAC7BD,MAAM,CAACE,IAAI,CAAEC,KAAK,IAAK;UACrBV,YAAY,GAAGU,KAAK;UACpBN,MAAM,CAAC,CAAC;QACV,CAAC,CAAC,CAACO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;MACpB,CAAC,MAAM;QACLX,YAAY,GAAGO,MAAM;QACrBH,MAAM,CAAC,CAAC;MACV;IACF,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ;;EAEA;EACA;EACA,IAAI;IACF,MAAMG,MAAM,GAAGT,OAAO,CAAC,CAAC;IACxB,IAAIS,MAAM,YAAYC,OAAO,EAAE;MAC7BD,MAAM,CAACE,IAAI,CAAEC,KAAK,IAAK;QACrBV,YAAY,GAAGU,KAAK;QACpBN,MAAM,CAAC,CAAC;MACV,CAAC,CAAC,CAACO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACpB,CAAC,MAAM;MACLX,YAAY,GAAGO,MAAM;IACvB;EACF,CAAC,CAAC,MAAM;IACN;EAAA;EAiBF,SAASK,WAAWA,CAAA,EAAkB;IACpC,OAAOZ,YAAY;EACrB;EAMA,OAAO;IAAEa,SAAS,EAtBlB,SAASA,SAASA,CAACC,QAAoB,EAAc;MACnDb,SAAS,CAACc,GAAG,CAACD,QAAQ,CAAC;MACvB,IAAIb,SAAS,CAACe,IAAI,KAAK,CAAC,EAAE;QACxBb,UAAU,GAAGc,WAAW,CAACX,IAAI,EAAEP,UAAU,CAAC;MAC5C;MACA,OAAO,MAAM;QACXE,SAAS,CAACiB,MAAM,CAACJ,QAAQ,CAAC;QAC1B,IAAIb,SAAS,CAACe,IAAI,KAAK,CAAC,IAAIb,UAAU,IAAI,IAAI,EAAE;UAC9CgB,aAAa,CAAChB,UAAU,CAAC;UACzBA,UAAU,GAAG,IAAI;QACnB;MACF,CAAC;IACH,CAUkB;IAAES,WAAW;IAAEQ,YAAY,EAJ7C,SAASA,YAAYA,CAAA,EAAS;MAC5Bd,IAAI,CAAC,CAAC;IACR;EAE8C,CAAC;AACjD","ignoreList":[]}
1
+ {"version":3,"file":"createPollingStore.js","names":["createPollingStore","fetchFn","intervalMs","currentValue","listeners","Set","intervalId","notify","listener","poll","result","Promise","then","value","catch","getSnapshot","subscribe","callback","add","size","setInterval","delete","clearInterval","forceRefresh"],"sources":["createPollingStore.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\nexport function createPollingStore<T>(\n fetchFn: () => T | Promise<T>,\n intervalMs: number\n): {\n subscribe: (callback: () => void) => () => void;\n getSnapshot: () => T | undefined;\n forceRefresh: () => void;\n} {\n let currentValue: T | undefined;\n const listeners = new Set<() => void>();\n let intervalId: ReturnType<typeof setInterval> | null = null;\n\n function notify(): void {\n for (const listener of listeners) {\n listener();\n }\n }\n\n function poll(): void {\n try {\n const result = fetchFn();\n if (result instanceof Promise) {\n result\n .then((value) => {\n currentValue = value;\n notify();\n })\n .catch(() => {});\n } else {\n currentValue = result;\n notify();\n }\n } catch {\n // ignore polling errors\n }\n }\n\n // Eagerly fetch initial value at creation time (not during subscribe)\n // so getSnapshot() returns data before the first subscription.\n try {\n const result = fetchFn();\n if (result instanceof Promise) {\n result\n .then((value) => {\n currentValue = value;\n notify();\n })\n .catch(() => {});\n } else {\n currentValue = result;\n }\n } catch {\n // ignore initial fetch errors\n }\n\n function subscribe(callback: () => void): () => void {\n listeners.add(callback);\n if (listeners.size === 1) {\n intervalId = setInterval(poll, intervalMs);\n }\n return () => {\n listeners.delete(callback);\n if (listeners.size === 0 && intervalId != null) {\n clearInterval(intervalId);\n intervalId = null;\n }\n };\n }\n\n function getSnapshot(): T | undefined {\n return currentValue;\n }\n\n function forceRefresh(): void {\n poll();\n }\n\n return { subscribe, getSnapshot, forceRefresh };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASA,kBAAkBA,CAChCC,OAA6B,EAC7BC,UAAkB,EAKlB;EACA,IAAIC,YAA2B;EAC/B,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAa,CAAC;EACvC,IAAIC,UAAiD,GAAG,IAAI;EAE5D,SAASC,MAAMA,CAAA,EAAS;IACtB,KAAK,MAAMC,QAAQ,IAAIJ,SAAS,EAAE;MAChCI,QAAQ,CAAC,CAAC;IACZ;EACF;EAEA,SAASC,IAAIA,CAAA,EAAS;IACpB,IAAI;MACF,MAAMC,MAAM,GAAGT,OAAO,CAAC,CAAC;MACxB,IAAIS,MAAM,YAAYC,OAAO,EAAE;QAC7BD,MAAM,CACHE,IAAI,CAAEC,KAAK,IAAK;UACf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veComponents.js","names":["useMemo","useComponentRegistry","useActiveComponents","monitorStore","registry","version","getVersion","getActiveComponents"],"sources":["useActiveComponents.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 { useMemo } from \"react\";\nimport type { MonitorStore } from \"../store/MonitorStore.js\";\nimport type { ComponentHookBinding } from \"../utils/ComponentQueryRegistry.js\";\nimport { useComponentRegistry } from \"./useComponentRegistry.js\";\n\nexport function useActiveComponents(\n monitorStore: MonitorStore,\n): Map<string, ComponentHookBinding[]> {\n const registry = useComponentRegistry(monitorStore);\n const version = registry.getVersion();\n\n return useMemo(() => {\n return registry.getActiveComponents();\n // registry version triggers recalculation\n }, [registry, version]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,OAAO;AAG/B,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,OAAO,SAASC,mBAAmBA,CACjCC,YAA0B,EACW;EACrC,MAAMC,QAAQ,GAAGH,oBAAoB,CAACE,YAAY,CAAC;EACnD,MAAME,OAAO,GAAGD,QAAQ,CAACE,UAAU,CAAC,CAAC;EAErC,OAAON,OAAO,CAAC,MAAM;IACnB,OAAOI,QAAQ,CAACG,mBAAmB,CAAC,CAAC;IACrC;EACF,CAAC,EAAE,CAACH,QAAQ,EAAEC,OAAO,CAAC,CAAC;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"useActiveComponents.js","names":["useMemo","useComponentRegistry","useActiveComponents","monitorStore","registry","version","getVersion","getActiveComponents"],"sources":["useActiveComponents.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 { useMemo } from \"react\";\n\nimport type { MonitorStore } from \"../store/MonitorStore.js\";\nimport type { ComponentHookBinding } from \"../utils/ComponentQueryRegistry.js\";\nimport { useComponentRegistry } from \"./useComponentRegistry.js\";\n\nexport function useActiveComponents(\n monitorStore: MonitorStore\n): Map<string, ComponentHookBinding[]> {\n const registry = useComponentRegistry(monitorStore);\n const version = registry.getVersion();\n\n return useMemo(() => {\n return registry.getActiveComponents();\n // registry version triggers recalculation\n }, [registry, version]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,OAAO;AAI/B,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,OAAO,SAASC,mBAAmBA,CACjCC,YAA0B,EACW;EACrC,MAAMC,QAAQ,GAAGH,oBAAoB,CAACE,YAAY,CAAC;EACnD,MAAME,OAAO,GAAGD,QAAQ,CAACE,UAAU,CAAC,CAAC;EAErC,OAAON,OAAO,CAAC,MAAM;IACnB,OAAOI,QAAQ,CAACG,mBAAmB,CAAC,CAAC;IACrC;EACF,CAAC,EAAE,CAACH,QAAQ,EAAEC,OAAO,CAAC,CAAC;AACzB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useComponentRegistry.js","names":["React","useComponentRegistry","monitorStore","registry","getComponentRegistry","subscribe","useCallback","callback","getSnapshot","getVersion","useSyncExternalStore"],"sources":["useComponentRegistry.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 type { ComponentQueryRegistry } from \"../utils/ComponentQueryRegistry.js\";\n\nexport function useComponentRegistry(\n monitorStore: MonitorStore,\n): ComponentQueryRegistry {\n const registry = monitorStore.getComponentRegistry();\n\n const subscribe = React.useCallback(\n (callback: () => void) => registry.subscribe(callback),\n [registry],\n );\n\n const getSnapshot = React.useCallback(\n () => registry.getVersion(),\n [registry],\n );\n\n React.useSyncExternalStore(subscribe, getSnapshot);\n\n return registry;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAIzB,OAAO,SAASC,oBAAoBA,CAClCC,YAA0B,EACF;EACxB,MAAMC,QAAQ,GAAGD,YAAY,CAACE,oBAAoB,CAAC,CAAC;EAEpD,MAAMC,SAAS,GAAGL,KAAK,CAACM,WAAW,CAChCC,QAAoB,IAAKJ,QAAQ,CAACE,SAAS,CAACE,QAAQ,CAAC,EACtD,CAACJ,QAAQ,CACX,CAAC;EAED,MAAMK,WAAW,GAAGR,KAAK,CAACM,WAAW,CACnC,MAAMH,QAAQ,CAACM,UAAU,CAAC,CAAC,EAC3B,CAACN,QAAQ,CACX,CAAC;EAEDH,KAAK,CAACU,oBAAoB,CAACL,SAAS,EAAEG,WAAW,CAAC;EAElD,OAAOL,QAAQ;AACjB","ignoreList":[]}
1
+ {"version":3,"file":"useComponentRegistry.js","names":["React","useComponentRegistry","monitorStore","registry","getComponentRegistry","subscribe","useCallback","callback","getSnapshot","getVersion","useSyncExternalStore"],"sources":["useComponentRegistry.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 { ComponentQueryRegistry } from \"../utils/ComponentQueryRegistry.js\";\n\nexport function useComponentRegistry(\n monitorStore: MonitorStore\n): ComponentQueryRegistry {\n const registry = monitorStore.getComponentRegistry();\n\n const subscribe = React.useCallback(\n (callback: () => void) => registry.subscribe(callback),\n [registry]\n );\n\n const getSnapshot = React.useCallback(\n () => registry.getVersion(),\n [registry]\n );\n\n React.useSyncExternalStore(subscribe, getSnapshot);\n\n return registry;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAKzB,OAAO,SAASC,oBAAoBA,CAClCC,YAA0B,EACF;EACxB,MAAMC,QAAQ,GAAGD,YAAY,CAACE,oBAAoB,CAAC,CAAC;EAEpD,MAAMC,SAAS,GAAGL,KAAK,CAACM,WAAW,CAChCC,QAAoB,IAAKJ,QAAQ,CAACE,SAAS,CAACE,QAAQ,CAAC,EACtD,CAACJ,QAAQ,CACX,CAAC;EAED,MAAMK,WAAW,GAAGR,KAAK,CAACM,WAAW,CACnC,MAAMH,QAAQ,CAACM,UAAU,CAAC,CAAC,EAC3B,CAACN,QAAQ,CACX,CAAC;EAEDH,KAAK,CAACU,oBAAoB,CAACL,SAAS,EAAEG,WAAW,CAAC;EAElD,OAAOL,QAAQ;AACjB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useComputeSelectors.js","names":["useCallback","useSyncExternalStore","useComputeMetrics","store","subscribe","callback","getSnapshot","metrics","useComputeRequests","requests","useComputeRecording","isRecording","useComputeNetworkPaused","isNetworkPaused","useComputeLastRecordingEvent","lastRecordingEvent"],"sources":["useComputeSelectors.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 { useCallback, useSyncExternalStore } from \"react\";\nimport type { ComputeStore } from \"../store/ComputeStore.js\";\nimport type {\n ComputeMetrics,\n ComputeRequest,\n RecordingEvent,\n} from \"../types/compute.js\";\n\nexport function useComputeMetrics(store: ComputeStore): ComputeMetrics {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store],\n );\n const getSnapshot = useCallback(() => store.getSnapshot().metrics, [store]);\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport function useComputeRequests(\n store: ComputeStore,\n): ReadonlyArray<ComputeRequest> {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store],\n );\n const getSnapshot = useCallback(() => store.getSnapshot().requests, [store]);\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport function useComputeRecording(store: ComputeStore): boolean {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store],\n );\n const getSnapshot = useCallback(() => store.getSnapshot().isRecording, [\n store,\n ]);\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport function useComputeNetworkPaused(store: ComputeStore): boolean {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store],\n );\n const getSnapshot = useCallback(\n () => store.getSnapshot().isNetworkPaused,\n [store],\n );\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport function useComputeLastRecordingEvent(\n store: ComputeStore,\n): RecordingEvent | undefined {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store],\n );\n const getSnapshot = useCallback(\n () => store.getSnapshot().lastRecordingEvent,\n [store],\n );\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,oBAAoB,QAAQ,OAAO;AAQzD,OAAO,SAASC,iBAAiBA,CAACC,KAAmB,EAAkB;EACrE,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAAC,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,CAACC,OAAO,EAAE,CAACJ,KAAK,CAAC,CAAC;EAC3E,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,CAAC;AACrD;AAEA,OAAO,SAASE,kBAAkBA,CAChCL,KAAmB,EACY;EAC/B,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAAC,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,CAACG,QAAQ,EAAE,CAACN,KAAK,CAAC,CAAC;EAC5E,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,CAAC;AACrD;AAEA,OAAO,SAASI,mBAAmBA,CAACP,KAAmB,EAAW;EAChE,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAAC,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,CAACK,WAAW,EAAE,CACrER,KAAK,CACN,CAAC;EACF,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,CAAC;AACrD;AAEA,OAAO,SAASM,uBAAuBA,CAACT,KAAmB,EAAW;EACpE,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAC7B,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,CAACO,eAAe,EACzC,CAACV,KAAK,CACR,CAAC;EACD,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,CAAC;AACrD;AAEA,OAAO,SAASQ,4BAA4BA,CAC1CX,KAAmB,EACS;EAC5B,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAC7B,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,CAACS,kBAAkB,EAC5C,CAACZ,KAAK,CACR,CAAC;EACD,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,CAAC;AACrD","ignoreList":[]}
1
+ {"version":3,"file":"useComputeSelectors.js","names":["useCallback","useSyncExternalStore","useComputeMetrics","store","subscribe","callback","getSnapshot","metrics","useComputeRequests","requests","useComputeRecording","isRecording","useComputeNetworkPaused","isNetworkPaused","useComputeLastRecordingEvent","lastRecordingEvent"],"sources":["useComputeSelectors.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 { useCallback, useSyncExternalStore } from \"react\";\n\nimport type { ComputeStore } from \"../store/ComputeStore.js\";\nimport type {\n ComputeMetrics,\n ComputeRequest,\n RecordingEvent,\n} from \"../types/compute.js\";\n\nexport function useComputeMetrics(store: ComputeStore): ComputeMetrics {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store]\n );\n const getSnapshot = useCallback(() => store.getSnapshot().metrics, [store]);\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport function useComputeRequests(\n store: ComputeStore\n): ReadonlyArray<ComputeRequest> {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store]\n );\n const getSnapshot = useCallback(() => store.getSnapshot().requests, [store]);\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport function useComputeRecording(store: ComputeStore): boolean {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store]\n );\n const getSnapshot = useCallback(\n () => store.getSnapshot().isRecording,\n [store]\n );\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport function useComputeNetworkPaused(store: ComputeStore): boolean {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store]\n );\n const getSnapshot = useCallback(\n () => store.getSnapshot().isNetworkPaused,\n [store]\n );\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport function useComputeLastRecordingEvent(\n store: ComputeStore\n): RecordingEvent | undefined {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store]\n );\n const getSnapshot = useCallback(\n () => store.getSnapshot().lastRecordingEvent,\n [store]\n );\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,oBAAoB,QAAQ,OAAO;AASzD,OAAO,SAASC,iBAAiBA,CAACC,KAAmB,EAAkB;EACrE,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAAC,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,CAACC,OAAO,EAAE,CAACJ,KAAK,CAAC,CAAC;EAC3E,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,CAAC;AACrD;AAEA,OAAO,SAASE,kBAAkBA,CAChCL,KAAmB,EACY;EAC/B,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAAC,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,CAACG,QAAQ,EAAE,CAACN,KAAK,CAAC,CAAC;EAC5E,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,CAAC;AACrD;AAEA,OAAO,SAASI,mBAAmBA,CAACP,KAAmB,EAAW;EAChE,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAC7B,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,CAACK,WAAW,EACrC,CAACR,KAAK,CACR,CAAC;EACD,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,CAAC;AACrD;AAEA,OAAO,SAASM,uBAAuBA,CAACT,KAAmB,EAAW;EACpE,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAC7B,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,CAACO,eAAe,EACzC,CAACV,KAAK,CACR,CAAC;EACD,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,CAAC;AACrD;AAEA,OAAO,SAASQ,4BAA4BA,CAC1CX,KAAmB,EACS;EAC5B,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAC7B,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,CAACS,kBAAkB,EAC5C,CAACZ,KAAK,CACR,CAAC;EACD,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,CAAC;AACrD","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useConsoleLogs.js","names":["React","useConsoleLogs","monitorStore","store","getConsoleLogStore","subscribe","useCallback","callback","cachedRef","useRef","entries","getEntries","count","getSize","getSnapshot","prev","current","snapshot","useSyncExternalStore","clear"],"sources":["useConsoleLogs.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 { ConsoleLogEntry } from \"../store/ConsoleLogStore.js\";\nimport type { MonitorStore } from \"../store/MonitorStore.js\";\n\ninterface ConsoleLogSnapshot {\n entries: readonly ConsoleLogEntry[];\n count: number;\n}\n\nexport function useConsoleLogs(monitorStore: MonitorStore): {\n entries: readonly ConsoleLogEntry[];\n count: number;\n clear: () => void;\n} {\n const store = monitorStore.getConsoleLogStore();\n\n const subscribe = React.useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store],\n );\n\n const cachedRef = React.useRef<ConsoleLogSnapshot>({\n entries: store.getEntries(),\n count: store.getSize(),\n });\n\n const getSnapshot = React.useCallback(\n (): ConsoleLogSnapshot => {\n const entries = store.getEntries();\n const count = store.getSize();\n const prev = cachedRef.current;\n if (prev.entries === entries && prev.count === count) {\n return prev;\n }\n cachedRef.current = { entries, count };\n return cachedRef.current;\n },\n [store],\n );\n\n const snapshot = React.useSyncExternalStore(subscribe, getSnapshot);\n\n const clear = React.useCallback(() => store.clear(), [store]);\n\n return {\n entries: snapshot.entries,\n count: snapshot.count,\n clear,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AASzB,OAAO,SAASC,cAAcA,CAACC,YAA0B,EAIvD;EACA,MAAMC,KAAK,GAAGD,YAAY,CAACE,kBAAkB,CAAC,CAAC;EAE/C,MAAMC,SAAS,GAAGL,KAAK,CAACM,WAAW,CAChCC,QAAoB,IAAKJ,KAAK,CAACE,SAAS,CAACE,QAAQ,CAAC,EACnD,CAACJ,KAAK,CACR,CAAC;EAED,MAAMK,SAAS,GAAGR,KAAK,CAACS,MAAM,CAAqB;IACjDC,OAAO,EAAEP,KAAK,CAACQ,UAAU,CAAC,CAAC;IAC3BC,KAAK,EAAET,KAAK,CAACU,OAAO,CAAC;EACvB,CAAC,CAAC;EAEF,MAAMC,WAAW,GAAGd,KAAK,CAACM,WAAW,CACnC,MAA0B;IACxB,MAAMI,OAAO,GAAGP,KAAK,CAACQ,UAAU,CAAC,CAAC;IAClC,MAAMC,KAAK,GAAGT,KAAK,CAACU,OAAO,CAAC,CAAC;IAC7B,MAAME,IAAI,GAAGP,SAAS,CAACQ,OAAO;IAC9B,IAAID,IAAI,CAACL,OAAO,KAAKA,OAAO,IAAIK,IAAI,CAACH,KAAK,KAAKA,KAAK,EAAE;MACpD,OAAOG,IAAI;IACb;IACAP,SAAS,CAACQ,OAAO,GAAG;MAAEN,OAAO;MAAEE;IAAM,CAAC;IACtC,OAAOJ,SAAS,CAACQ,OAAO;EAC1B,CAAC,EACD,CAACb,KAAK,CACR,CAAC;EAED,MAAMc,QAAQ,GAAGjB,KAAK,CAACkB,oBAAoB,CAACb,SAAS,EAAES,WAAW,CAAC;EAEnE,MAAMK,KAAK,GAAGnB,KAAK,CAACM,WAAW,CAAC,MAAMH,KAAK,CAACgB,KAAK,CAAC,CAAC,EAAE,CAAChB,KAAK,CAAC,CAAC;EAE7D,OAAO;IACLO,OAAO,EAAEO,QAAQ,CAACP,OAAO;IACzBE,KAAK,EAAEK,QAAQ,CAACL,KAAK;IACrBO;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"useConsoleLogs.js","names":["React","useConsoleLogs","monitorStore","store","getConsoleLogStore","subscribe","useCallback","callback","cachedRef","useRef","entries","getEntries","count","getSize","getSnapshot","prev","current","snapshot","useSyncExternalStore","clear"],"sources":["useConsoleLogs.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 { ConsoleLogEntry } from \"../store/ConsoleLogStore.js\";\nimport type { MonitorStore } from \"../store/MonitorStore.js\";\n\ninterface ConsoleLogSnapshot {\n entries: readonly ConsoleLogEntry[];\n count: number;\n}\n\nexport function useConsoleLogs(monitorStore: MonitorStore): {\n entries: readonly ConsoleLogEntry[];\n count: number;\n clear: () => void;\n} {\n const store = monitorStore.getConsoleLogStore();\n\n const subscribe = React.useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store]\n );\n\n const cachedRef = React.useRef<ConsoleLogSnapshot>({\n entries: store.getEntries(),\n count: store.getSize(),\n });\n\n const getSnapshot = React.useCallback((): ConsoleLogSnapshot => {\n const entries = store.getEntries();\n const count = store.getSize();\n const prev = cachedRef.current;\n if (prev.entries === entries && prev.count === count) {\n return prev;\n }\n cachedRef.current = { entries, count };\n return cachedRef.current;\n }, [store]);\n\n const snapshot = React.useSyncExternalStore(subscribe, getSnapshot);\n\n const clear = React.useCallback(() => store.clear(), [store]);\n\n return {\n entries: snapshot.entries,\n count: snapshot.count,\n clear,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAUzB,OAAO,SAASC,cAAcA,CAACC,YAA0B,EAIvD;EACA,MAAMC,KAAK,GAAGD,YAAY,CAACE,kBAAkB,CAAC,CAAC;EAE/C,MAAMC,SAAS,GAAGL,KAAK,CAACM,WAAW,CAChCC,QAAoB,IAAKJ,KAAK,CAACE,SAAS,CAACE,QAAQ,CAAC,EACnD,CAACJ,KAAK,CACR,CAAC;EAED,MAAMK,SAAS,GAAGR,KAAK,CAACS,MAAM,CAAqB;IACjDC,OAAO,EAAEP,KAAK,CAACQ,UAAU,CAAC,CAAC;IAC3BC,KAAK,EAAET,KAAK,CAACU,OAAO,CAAC;EACvB,CAAC,CAAC;EAEF,MAAMC,WAAW,GAAGd,KAAK,CAACM,WAAW,CAAC,MAA0B;IAC9D,MAAMI,OAAO,GAAGP,KAAK,CAACQ,UAAU,CAAC,CAAC;IAClC,MAAMC,KAAK,GAAGT,KAAK,CAACU,OAAO,CAAC,CAAC;IAC7B,MAAME,IAAI,GAAGP,SAAS,CAACQ,OAAO;IAC9B,IAAID,IAAI,CAACL,OAAO,KAAKA,OAAO,IAAIK,IAAI,CAACH,KAAK,KAAKA,KAAK,EAAE;MACpD,OAAOG,IAAI;IACb;IACAP,SAAS,CAACQ,OAAO,GAAG;MAAEN,OAAO;MAAEE;IAAM,CAAC;IACtC,OAAOJ,SAAS,CAACQ,OAAO;EAC1B,CAAC,EAAE,CAACb,KAAK,CAAC,CAAC;EAEX,MAAMc,QAAQ,GAAGjB,KAAK,CAACkB,oBAAoB,CAACb,SAAS,EAAES,WAAW,CAAC;EAEnE,MAAMK,KAAK,GAAGnB,KAAK,CAACM,WAAW,CAAC,MAAMH,KAAK,CAACgB,KAAK,CAAC,CAAC,EAAE,CAAChB,KAAK,CAAC,CAAC;EAE7D,OAAO;IACLO,OAAO,EAAEO,QAAQ,CAACP,OAAO;IACzBE,KAAK,EAAEK,QAAQ,CAACL,KAAK;IACrBO;EACF,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useInspectorSelection.js","names":["React","InspectorSelectionStore","state","isSelectionActive","discoveredPrimitives","listeners","Set","subscribe","callback","add","handlePrimitivesDiscovered","event","detail","primitives","notify","handleSelectionModeDeactivated","window","addEventListener","delete","removeEventListener","getSnapshot","activateSelection","monitorStore","clickToInspect","getClickToInspectSystem","activate","clearDiscoveredPrimitives","listener","useInspectorSelection","storeRef","useRef","current","store","useCallback","snapshot","useSyncExternalStore"],"sources":["useInspectorSelection.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 type { DiscoveredPrimitives } from \"../utils/ComponentPrimitiveDiscovery.js\";\n\nexport interface InspectorSelectionState {\n isSelectionActive: boolean;\n discoveredPrimitives: DiscoveredPrimitives | null;\n activateSelection: () => void;\n clearDiscoveredPrimitives: () => void;\n}\n\ninterface InspectorSelectionSnapshot {\n isSelectionActive: boolean;\n discoveredPrimitives: DiscoveredPrimitives | null;\n}\n\nclass InspectorSelectionStore {\n private state: InspectorSelectionSnapshot = {\n isSelectionActive: false,\n discoveredPrimitives: null,\n };\n private listeners = new Set<() => void>();\n\n subscribe(callback: () => void): () => void {\n this.listeners.add(callback);\n\n const handlePrimitivesDiscovered = (event: Event) => {\n const customEvent = event as CustomEvent<{\n componentId: string;\n primitives: DiscoveredPrimitives;\n }>;\n this.state = {\n isSelectionActive: false,\n discoveredPrimitives: customEvent.detail.primitives,\n };\n this.notify();\n };\n\n const handleSelectionModeDeactivated = () => {\n this.state = {\n ...this.state,\n isSelectionActive: false,\n };\n this.notify();\n };\n\n window.addEventListener(\n \"primitives-discovered\",\n handlePrimitivesDiscovered,\n );\n window.addEventListener(\n \"inspector-deactivated\",\n handleSelectionModeDeactivated,\n );\n\n return () => {\n this.listeners.delete(callback);\n window.removeEventListener(\n \"primitives-discovered\",\n handlePrimitivesDiscovered,\n );\n window.removeEventListener(\n \"inspector-deactivated\",\n handleSelectionModeDeactivated,\n );\n };\n }\n\n getSnapshot(): InspectorSelectionSnapshot {\n return this.state;\n }\n\n activateSelection(monitorStore: MonitorStore): void {\n const clickToInspect = monitorStore.getClickToInspectSystem();\n if (clickToInspect) {\n clickToInspect.activate();\n this.state = {\n isSelectionActive: true,\n discoveredPrimitives: null,\n };\n this.notify();\n }\n }\n\n clearDiscoveredPrimitives(): void {\n this.state = {\n ...this.state,\n discoveredPrimitives: null,\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 useInspectorSelection(\n monitorStore: MonitorStore,\n): InspectorSelectionState {\n const storeRef = React.useRef<InspectorSelectionStore | null>(null);\n\n if (storeRef.current == null) {\n storeRef.current = new InspectorSelectionStore();\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(\n () => store.getSnapshot(),\n [store],\n );\n\n const snapshot = React.useSyncExternalStore(subscribe, getSnapshot);\n\n const activateSelection = React.useCallback(\n () => store.activateSelection(monitorStore),\n [store, monitorStore],\n );\n\n const clearDiscoveredPrimitives = React.useCallback(\n () => store.clearDiscoveredPrimitives(),\n [store],\n );\n\n return {\n isSelectionActive: snapshot.isSelectionActive,\n discoveredPrimitives: snapshot.discoveredPrimitives,\n activateSelection,\n clearDiscoveredPrimitives,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAgBzB,MAAMC,uBAAuB,CAAC;EACpBC,KAAK,GAA+B;IAC1CC,iBAAiB,EAAE,KAAK;IACxBC,oBAAoB,EAAE;EACxB,CAAC;EACOC,SAAS,GAAG,IAAIC,GAAG,CAAa,CAAC;EAEzCC,SAASA,CAACC,QAAoB,EAAc;IAC1C,IAAI,CAACH,SAAS,CAACI,GAAG,CAACD,QAAQ,CAAC;IAE5B,MAAME,0BAA0B,GAAIC,KAAY,IAAK;MAKnD,IAAI,CAACT,KAAK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,IAAI,CAACtB,SAAS,EAAE;MACrCsB,QAAQ,CAAC,CAAC;IACZ;EACF;AACF;AAEA,OAAO,SAASC,qBAAqBA,CACnCN,YAA0B,EACD;EACzB,MAAMO,QAAQ,GAAG7B,KAAK,CAAC8B,MAAM,CAAiC,IAAI,CAAC;EAEnE,IAAID,QAAQ,CAACE,OAAO,IAAI,IAAI,EAAE;IAC5BF,QAAQ,CAACE,OAAO,GAAG,IAAI9B,uBAAuB,CAAC,CAAC;EAClD;EAEA,MAAM+B,KAAK,GAAGH,QAAQ,CAACE,OAAO;EAE9B,MAAMxB,SAAS,GAAGP,KAAK,CAACiC,WAAW,CAChCzB,QAAoB,IAAKwB,KAAK,CAACzB,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACwB,KAAK,CACR,CAAC;EAED,MAAMZ,WAAW,GAAGpB,KAAK,CAACiC,WAAW,CACnC,MAAMD,KAAK,CAACZ,WAAW,CAAC,CAAC,EACzB,CAACY,KAAK,CACR,CAAC;EAED,MAAME,QAAQ,GAAGlC,KAAK,CAACmC,oBAAoB,CAAC5B,SAAS,EAAEa,WAAW,CAAC;EAEnE,MAAMC,iBAAiB,GAAGrB,KAAK,CAACiC,WAAW,CACzC,MAAMD,KAAK,CAACX,iBAAiB,CAACC,YAAY,CAAC,EAC3C,CAACU,KAAK,EAAEV,YAAY,CACtB,CAAC;EAED,MAAMI,yBAAyB,GAAG1B,KAAK,CAACiC,WAAW,CACjD,MAAMD,KAAK,CAACN,yBAAyB,CAAC,CAAC,EACvC,CAACM,KAAK,CACR,CAAC;EAED,OAAO;IACL7B,iBAAiB,EAAE+B,QAAQ,CAAC/B,iBAAiB;IAC7CC,oBAAoB,EAAE8B,QAAQ,CAAC9B,oBAAoB;IACnDiB,iBAAiB;IACjBK;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"useInspectorSelection.js","names":["React","InspectorSelectionStore","state","isSelectionActive","discoveredPrimitives","listeners","Set","subscribe","callback","add","handlePrimitivesDiscovered","event","detail","primitives","notify","handleSelectionModeDeactivated","window","addEventListener","delete","removeEventListener","getSnapshot","activateSelection","monitorStore","clickToInspect","getClickToInspectSystem","activate","clearDiscoveredPrimitives","listener","useInspectorSelection","storeRef","useRef","current","store","useCallback","snapshot","useSyncExternalStore"],"sources":["useInspectorSelection.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 { DiscoveredPrimitives } from \"../utils/ComponentPrimitiveDiscovery.js\";\n\nexport interface InspectorSelectionState {\n isSelectionActive: boolean;\n discoveredPrimitives: DiscoveredPrimitives | null;\n activateSelection: () => void;\n clearDiscoveredPrimitives: () => void;\n}\n\ninterface InspectorSelectionSnapshot {\n isSelectionActive: boolean;\n discoveredPrimitives: DiscoveredPrimitives | null;\n}\n\nclass InspectorSelectionStore {\n private state: InspectorSelectionSnapshot = {\n isSelectionActive: false,\n discoveredPrimitives: null,\n };\n private listeners = new Set<() => void>();\n\n subscribe(callback: () => void): () => void {\n this.listeners.add(callback);\n\n const handlePrimitivesDiscovered = (event: Event) => {\n const customEvent = event as CustomEvent<{\n componentId: string;\n primitives: DiscoveredPrimitives;\n }>;\n this.state = {\n isSelectionActive: false,\n discoveredPrimitives: customEvent.detail.primitives,\n };\n this.notify();\n };\n\n const handleSelectionModeDeactivated = () => {\n this.state = {\n ...this.state,\n isSelectionActive: false,\n };\n this.notify();\n };\n\n window.addEventListener(\n \"primitives-discovered\",\n handlePrimitivesDiscovered\n );\n window.addEventListener(\n \"inspector-deactivated\",\n handleSelectionModeDeactivated\n );\n\n return () => {\n this.listeners.delete(callback);\n window.removeEventListener(\n \"primitives-discovered\",\n handlePrimitivesDiscovered\n );\n window.removeEventListener(\n \"inspector-deactivated\",\n handleSelectionModeDeactivated\n );\n };\n }\n\n getSnapshot(): InspectorSelectionSnapshot {\n return this.state;\n }\n\n activateSelection(monitorStore: MonitorStore): void {\n const clickToInspect = monitorStore.getClickToInspectSystem();\n if (clickToInspect) {\n clickToInspect.activate();\n this.state = {\n isSelectionActive: true,\n discoveredPrimitives: null,\n };\n this.notify();\n }\n }\n\n clearDiscoveredPrimitives(): void {\n this.state = {\n ...this.state,\n discoveredPrimitives: null,\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 useInspectorSelection(\n monitorStore: MonitorStore\n): InspectorSelectionState {\n const storeRef = React.useRef<InspectorSelectionStore | null>(null);\n\n if (storeRef.current == null) {\n storeRef.current = new InspectorSelectionStore();\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 snapshot = React.useSyncExternalStore(subscribe, getSnapshot);\n\n const activateSelection = React.useCallback(\n () => store.activateSelection(monitorStore),\n [store, monitorStore]\n );\n\n const clearDiscoveredPrimitives = React.useCallback(\n () => store.clearDiscoveredPrimitives(),\n [store]\n );\n\n return {\n isSelectionActive: snapshot.isSelectionActive,\n discoveredPrimitives: snapshot.discoveredPrimitives,\n activateSelection,\n clearDiscoveredPrimitives,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAiBzB,MAAMC,uBAAuB,CAAC;EACpBC,KAAK,GAA+B;IAC1CC,iBAAiB,EAAE,KAAK;IACxBC,oBAAoB,E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,iBAAiB;IAC7CC,oBAAoB,EAAE8B,QAAQ,CAAC9B,oBAAoB;IACnDiB,iBAAiB;IACjBK;EACF,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useMetrics.js","names":["useCallback","useSyncExternalStore","useMetrics","store","subscribe","callback","getSnapshot"],"sources":["useMetrics.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 { useCallback, useSyncExternalStore } from \"react\";\nimport type { MetricsStore } from \"../store/MetricsStore.js\";\nimport type { MetricsSnapshot } from \"../types/index.js\";\n\nexport function useMetrics(store: MetricsStore): MetricsSnapshot {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store],\n );\n const getSnapshot = useCallback(\n () => store.getSnapshot(),\n [store],\n );\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,oBAAoB,QAAQ,OAAO;AAIzD,OAAO,SAASC,UAAUA,CAACC,KAAmB,EAAmB;EAC/D,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAC7B,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,EACzB,CAACH,KAAK,CACR,CAAC;EACD,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,EAAEA,WAAW,CAAC;AAClE","ignoreList":[]}
1
+ {"version":3,"file":"useMetrics.js","names":["useCallback","useSyncExternalStore","useMetrics","store","subscribe","callback","getSnapshot"],"sources":["useMetrics.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 { useCallback, useSyncExternalStore } from \"react\";\n\nimport type { MetricsStore } from \"../store/MetricsStore.js\";\nimport type { MetricsSnapshot } from \"../types/index.js\";\n\nexport function useMetrics(store: MetricsStore): MetricsSnapshot {\n const subscribe = useCallback(\n (callback: () => void) => store.subscribe(callback),\n [store]\n );\n const getSnapshot = useCallback(() => store.getSnapshot(), [store]);\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,oBAAoB,QAAQ,OAAO;AAKzD,OAAO,SAASC,UAAUA,CAACC,KAAmB,EAAmB;EAC/D,MAAMC,SAAS,GAAGJ,WAAW,CAC1BK,QAAoB,IAAKF,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,EACnD,CAACF,KAAK,CACR,CAAC;EACD,MAAMG,WAAW,GAAGN,WAAW,CAAC,MAAMG,KAAK,CAACG,WAAW,CAAC,CAAC,EAAE,CAACH,KAAK,CAAC,CAAC;EACnE,OAAOF,oBAAoB,CAACG,SAAS,EAAEE,WAAW,EAAEA,WAAW,CAAC;AAClE","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"usePersistedState.js","names":["React","readFromStorage","key","defaultValue","window","stored","localStorage","getItem","JSON","parse","usePersistedState","storeRef","useRef","current","value","listeners","Set","subscribe","useCallback","callback","store","add","handleStorageChange","e","newValue","listener","addEventListener","delete","removeEventListener","getSnapshot","useSyncExternalStore","setPersistedValue","resolvedValue","setItem","stringify"],"sources":["usePersistedState.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\nfunction readFromStorage<T>(key: string, defaultValue: T): T {\n if (typeof window === \"undefined\") {\n return defaultValue;\n }\n\n try {\n const stored = localStorage.getItem(key);\n return stored ? JSON.parse(stored) : defaultValue;\n } catch {\n return defaultValue;\n }\n}\n\nexport function usePersistedState<T>(\n key: string,\n defaultValue: T,\n): [T, (value: T | ((prev: T) => T)) => void] {\n const storeRef = React.useRef<\n {\n key: string;\n value: T;\n listeners: Set<() => void>;\n } | null\n >(null);\n\n if (storeRef.current == null || storeRef.current.key !== key) {\n storeRef.current = {\n key,\n value: readFromStorage(key, defaultValue),\n listeners: storeRef.current?.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 handleStorageChange = (e: StorageEvent) => {\n if (e.key === key && e.newValue && store != null) {\n try {\n store.value = JSON.parse(e.newValue);\n for (const listener of store.listeners) {\n listener();\n }\n } catch {\n }\n }\n };\n\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"storage\", handleStorageChange);\n }\n\n return () => {\n store.listeners.delete(callback);\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"storage\", handleStorageChange);\n }\n };\n },\n [key],\n );\n\n const getSnapshot = React.useCallback(\n (): T => {\n if (storeRef.current == null) {\n return defaultValue;\n }\n return storeRef.current.value;\n },\n [defaultValue],\n );\n\n const value = React.useSyncExternalStore(subscribe, getSnapshot);\n\n const setPersistedValue = React.useCallback(\n (newValue: T | ((prev: T) => T)) => {\n const store = storeRef.current;\n if (store == null) {\n return;\n }\n\n const resolvedValue = typeof newValue === \"function\"\n ? (newValue as (prev: T) => T)(store.value)\n : newValue;\n\n store.value = resolvedValue;\n\n if (typeof window !== \"undefined\") {\n try {\n localStorage.setItem(key, JSON.stringify(resolvedValue));\n } catch {\n }\n }\n\n for (const listener of store.listeners) {\n listener();\n }\n },\n [key],\n );\n\n return [value, setPersistedValue];\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,eAAeA,CAAIC,GAAW,EAAEC,YAAe,EAAK;EAC3D,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACjC,OAAOD,YAAY;EACrB;EAEA,IAAI;IACF,MAAME,MAAM,GAAGC,YAAY,CAACC,OAAO,CAACL,GAAG,CAAC;IACxC,OAAOG,MAAM,GAAGG,IAAI,CAACC,KAAK,CAACJ,MAAM,CAAC,GAAGF,YAAY;EACnD,CAAC,CAAC,MAAM;IACN,OAAOA,YAAY;EACrB;AACF;AAEA,OAAO,SAASO,iBAAiBA,CAC/BR,GAAW,EACXC,YAAe,EAC6B;EAC5C,MAAMQ,QAAQ,GAAGX,KAAK,CAACY,MAAM,CAM3B,IAAI,CAAC;EAEP,IAAID,QAAQ,CAACE,OAAO,IAAI,IAAI,IAAIF,QAAQ,CAACE,OAAO,CAACX,GAAG,KAAKA,GAAG,EAA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P,IAAIP,QAAQ,CAACE,OAAO,IAAI,IAAI,EAAE;MAC5B,OAAOV,YAAY;IACrB;IACA,OAAOQ,QAAQ,CAACE,OAAO,CAACC,KAAK;EAC/B,CAAC,EACD,CAACX,YAAY,CACf,CAAC;EAED,MAAMW,KAAK,GAAGd,KAAK,CAAC8B,oBAAoB,CAACb,SAAS,EAAEY,WAAW,CAAC;EAEhE,MAAME,iBAAiB,GAAG/B,KAAK,CAACkB,WAAW,CACxCM,QAA8B,IAAK;IAClC,MAAMJ,KAAK,GAAGT,QAAQ,CAACE,OAAO;IAC9B,IAAIO,KAAK,IAAI,IAAI,EAAE;MACjB;IACF;IAEA,MAAMY,aAAa,GAAG,OAAOR,QAAQ,KAAK,UAAU,GAC/CA,QAAQ,CAAoBJ,KAAK,CAACN,KAAK,CAAC,GACzCU,QAAQ;IAEZJ,KAAK,CAACN,KAAK,GAAGkB,aAAa;IAE3B,IAAI,OAAO5B,MAAM,KAAK,WAAW,EAAE;MACjC,IAAI;QACFE,YAAY,CAAC2B,OAAO,CAAC/B,GAAG,EAAEM,IAAI,CAAC0B,SAAS,CAACF,aAAa,CAAC,CAAC;MAC1D,CAAC,CAAC,MAAM,CACR;IACF;IAEA,KAAK,MAAMP,QAAQ,IAAIL,KAAK,CAACL,SAAS,EAAE;MACtCU,QAAQ,CAAC,CAAC;IACZ;EACF,CAAC,EACD,CAACvB,GAAG,CACN,CAAC;EAED,OAAO,CAACY,KAAK,EAAEiB,iBAAiB,CAAC;AACnC","ignoreList":[]}
1
+ {"version":3,"file":"usePersistedState.js","names":["React","readFromStorage","key","defaultValue","window","stored","localStorage","getItem","JSON","parse","usePersistedState","storeRef","useRef","current","value","listeners","Set","subscribe","useCallback","callback","store","add","handleStorageChange","e","newValue","listener","addEventListener","delete","removeEventListener","getSnapshot","useSyncExternalStore","setPersistedValue","resolvedValue","setItem","stringify"],"sources":["usePersistedState.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\nfunction readFromStorage<T>(key: string, defaultValue: T): T {\n if (typeof window === \"undefined\") {\n return defaultValue;\n }\n\n try {\n const stored = localStorage.getItem(key);\n return stored ? JSON.parse(stored) : defaultValue;\n } catch {\n return defaultValue;\n }\n}\n\nexport function usePersistedState<T>(\n key: string,\n defaultValue: T\n): [T, (value: T | ((prev: T) => T)) => void] {\n const storeRef = React.useRef<{\n key: string;\n value: T;\n listeners: Set<() => void>;\n } | null>(null);\n\n if (storeRef.current == null || storeRef.current.key !== key) {\n storeRef.current = {\n key,\n value: readFromStorage(key, defaultValue),\n listeners: storeRef.current?.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 handleStorageChange = (e: StorageEvent) => {\n if (e.key === key && e.newValue && store != null) {\n try {\n store.value = JSON.parse(e.newValue);\n for (const listener of store.listeners) {\n listener();\n }\n } catch {}\n }\n };\n\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"storage\", handleStorageChange);\n }\n\n return () => {\n store.listeners.delete(callback);\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"storage\", handleStorageChange);\n }\n };\n },\n [key]\n );\n\n const getSnapshot = React.useCallback((): T => {\n if (storeRef.current == null) {\n return defaultValue;\n }\n return storeRef.current.value;\n }, [defaultValue]);\n\n const value = React.useSyncExternalStore(subscribe, getSnapshot);\n\n const setPersistedValue = React.useCallback(\n (newValue: T | ((prev: T) => T)) => {\n const store = storeRef.current;\n if (store == null) {\n return;\n }\n\n const resolvedValue =\n typeof newValue === \"function\"\n ? (newValue as (prev: T) => T)(store.value)\n : newValue;\n\n store.value = resolvedValue;\n\n if (typeof window !== \"undefined\") {\n try {\n localStorage.setItem(key, JSON.stringify(resolvedValue));\n } catch {}\n }\n\n for (const listener of store.listeners) {\n listener();\n }\n },\n [key]\n );\n\n return [value, setPersistedValue];\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,eAAeA,CAAIC,GAAW,EAAEC,YAAe,EAAK;EAC3D,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACjC,OAAOD,YAAY;EACrB;EAEA,IAAI;IACF,MAAME,MAAM,GAAGC,YAAY,CAACC,OAAO,CAACL,GAAG,CAAC;IACxC,OAAOG,MAAM,GAAGG,IAAI,CAACC,KAAK,CAACJ,MAAM,CAAC,GAAGF,YAAY;EACnD,CAAC,CAAC,MAAM;IACN,OAAOA,YAAY;EACrB;AACF;AAEA,OAAO,SAASO,iBAAiBA,CAC/BR,GAAW,EACXC,YAAe,EAC6B;EAC5C,MAAMQ,QAAQ,GAAGX,KAAK,CAACY,MAAM,CAInB,IAAI,CAAC;EAEf,IAAID,QAAQ,CAACE,OAAO,IAAI,IAAI,IAAIF,QAAQ,CAACE,OAAO,CAACX,GAAG,KAAKA,GAAG,EAAE;IAC5DS,QAAQ,CAACE,OAAO,GAAG;MACjBX,GAAG;MACHY,KAAK,EAAEb,eAAe,CAACC,GAAG,EAAEC,YAAY,CAAC;MACzCY,SAAS,EAAEJ,QAAQ,CAACE,OAAO,EAAEE,SAAS,IAAI,IAAIC,GAAG,CAAC;IACpD,CAAC;EACH;EAEA,MAAMC,SAAS,GAAGjB,KAAK,CAACkB,WAAW,CAChCC,QAAoB,IAAK;IACxB,MAAMC,KAAK,GAAGT,QAAQ,CAACE,OAAO;IAC9B,IA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MJ,KAAK,GAAGT,QAAQ,CAACE,OAAO;IAC9B,IAAIO,KAAK,IAAI,IAAI,EAAE;MACjB;IACF;IAEA,MAAMY,aAAa,GACjB,OAAOR,QAAQ,KAAK,UAAU,GACzBA,QAAQ,CAAoBJ,KAAK,CAACN,KAAK,CAAC,GACzCU,QAAQ;IAEdJ,KAAK,CAACN,KAAK,GAAGkB,aAAa;IAE3B,IAAI,OAAO5B,MAAM,KAAK,WAAW,EAAE;MACjC,IAAI;QACFE,YAAY,CAAC2B,OAAO,CAAC/B,GAAG,EAAEM,IAAI,CAAC0B,SAAS,CAACF,aAAa,CAAC,CAAC;MAC1D,CAAC,CAAC,MAAM,CAAC;IACX;IAEA,KAAK,MAAMP,QAAQ,IAAIL,KAAK,CAACL,SAAS,EAAE;MACtCU,QAAQ,CAAC,CAAC;IACZ;EACF,CAAC,EACD,CAACvB,GAAG,CACN,CAAC;EAED,OAAO,CAACY,KAAK,EAAEiB,iBAAiB,CAAC;AACnC","ignoreList":[]}
@@ -70,7 +70,7 @@ class RecommendationsStore {
70
70
  merged.set(rec.id, rec);
71
71
  }
72
72
  this.state = {
73
- recommendations: Array.from(merged.values()),
73
+ recommendations: [...merged.values()],
74
74
  isLoading: false,
75
75
  error: null
76
76
  };