@osdk/react-devtools 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (443) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/build/esm/DevToolsContext.js +19 -0
  3. package/build/esm/DevToolsContext.js.map +1 -0
  4. package/build/esm/components/ActionMetrics.js +89 -0
  5. package/build/esm/components/ActionMetrics.js.map +1 -0
  6. package/build/esm/components/BubbleChart.js +175 -0
  7. package/build/esm/components/BubbleChart.js.map +1 -0
  8. package/build/esm/components/BubbleChart.module.scss.js +6 -0
  9. package/build/esm/components/CacheInspectorTab.js +291 -0
  10. package/build/esm/components/CacheInspectorTab.js.map +1 -0
  11. package/build/esm/components/CacheInspectorTab.module.scss.js +39 -0
  12. package/build/esm/components/CacheMetrics.js +55 -0
  13. package/build/esm/components/CacheMetrics.js.map +1 -0
  14. package/build/esm/components/ComponentCard.js +124 -0
  15. package/build/esm/components/ComponentCard.js.map +1 -0
  16. package/build/esm/components/ComponentCard.module.scss.js +31 -0
  17. package/build/esm/components/ComputeTab.js +175 -0
  18. package/build/esm/components/ComputeTab.js.map +1 -0
  19. package/build/esm/components/CopyableCodeBlock.js +49 -0
  20. package/build/esm/components/CopyableCodeBlock.js.map +1 -0
  21. package/build/esm/components/CopyableCodeBlock.module.scss.js +10 -0
  22. package/build/esm/components/DebuggingTab.js +342 -0
  23. package/build/esm/components/DebuggingTab.js.map +1 -0
  24. package/build/esm/components/DebuggingTab.module.scss.js +18 -0
  25. package/build/esm/components/HookRow.js +180 -0
  26. package/build/esm/components/HookRow.js.map +1 -0
  27. package/build/esm/components/HookRow.module.scss.js +16 -0
  28. package/build/esm/components/ImprovementsTab.js +138 -0
  29. package/build/esm/components/ImprovementsTab.js.map +1 -0
  30. package/build/esm/components/ImprovementsTab.module.scss.js +30 -0
  31. package/build/esm/components/InspectorSelectionHeader.js +65 -0
  32. package/build/esm/components/InspectorSelectionHeader.js.map +1 -0
  33. package/build/esm/components/InterceptTab.js +862 -0
  34. package/build/esm/components/InterceptTab.js.map +1 -0
  35. package/build/esm/components/InterceptTab.module.scss.js +49 -0
  36. package/build/esm/components/IssueCard.js +115 -0
  37. package/build/esm/components/IssueCard.js.map +1 -0
  38. package/build/esm/components/IssueCard.module.scss.js +24 -0
  39. package/build/esm/components/LogEntryCard.js +94 -0
  40. package/build/esm/components/LogEntryCard.js.map +1 -0
  41. package/build/esm/components/LogEntryCard.module.scss.js +19 -0
  42. package/build/esm/components/MockEditor.js +316 -0
  43. package/build/esm/components/MockEditor.js.map +1 -0
  44. package/build/esm/components/MonitorErrorBoundary.js +64 -0
  45. package/build/esm/components/MonitorErrorBoundary.js.map +1 -0
  46. package/build/esm/components/MonitorErrorBoundary.module.scss.js +9 -0
  47. package/build/esm/components/MonitoringPanel.js +434 -0
  48. package/build/esm/components/MonitoringPanel.js.map +1 -0
  49. package/build/esm/components/MonitoringPanel.module.scss.js +81 -0
  50. package/build/esm/components/ObjectLoadingMetrics.js +60 -0
  51. package/build/esm/components/ObjectLoadingMetrics.js.map +1 -0
  52. package/build/esm/components/OsdkAppErrorBoundary.js +68 -0
  53. package/build/esm/components/OsdkAppErrorBoundary.js.map +1 -0
  54. package/build/esm/components/OsdkDevTools.js +40 -0
  55. package/build/esm/components/OsdkDevTools.js.map +1 -0
  56. package/build/esm/components/OverrideEditor.js +197 -0
  57. package/build/esm/components/OverrideEditor.js.map +1 -0
  58. package/build/esm/components/PerformanceTab.js +297 -0
  59. package/build/esm/components/PerformanceTab.js.map +1 -0
  60. package/build/esm/components/PrimitiveSelectionPanel.js +220 -0
  61. package/build/esm/components/PrimitiveSelectionPanel.js.map +1 -0
  62. package/build/esm/components/PrimitiveSelectionPanel.module.scss.js +26 -0
  63. package/build/esm/components/issueTypes.js +2 -0
  64. package/build/esm/components/issueTypes.js.map +1 -0
  65. package/build/esm/components/resolveComponentName.js +57 -0
  66. package/build/esm/components/resolveComponentName.js.map +1 -0
  67. package/build/esm/components/testHelpers.js +312 -0
  68. package/build/esm/components/testHelpers.js.map +1 -0
  69. package/build/esm/css.d.ts +20 -0
  70. package/build/esm/fiber/DegradationNotice.js +193 -0
  71. package/build/esm/fiber/DegradationNotice.js.map +1 -0
  72. package/build/esm/fiber/DevtoolsHook.js +252 -0
  73. package/build/esm/fiber/DevtoolsHook.js.map +1 -0
  74. package/build/esm/fiber/FiberAccess.js +65 -0
  75. package/build/esm/fiber/FiberAccess.js.map +1 -0
  76. package/build/esm/fiber/FiberInspection.js +140 -0
  77. package/build/esm/fiber/FiberInspection.js.map +1 -0
  78. package/build/esm/fiber/FiberTags.js +52 -0
  79. package/build/esm/fiber/FiberTags.js.map +1 -0
  80. package/build/esm/fiber/HookStateInspector.js +254 -0
  81. package/build/esm/fiber/HookStateInspector.js.map +1 -0
  82. package/build/esm/fiber/SafeFiberOperation.js +35 -0
  83. package/build/esm/fiber/SafeFiberOperation.js.map +1 -0
  84. package/build/esm/fiber/capabilities.js +180 -0
  85. package/build/esm/fiber/capabilities.js.map +1 -0
  86. package/build/esm/fiber/traverseFiber.js +129 -0
  87. package/build/esm/fiber/traverseFiber.js.map +1 -0
  88. package/build/esm/fiber/types.js +2 -0
  89. package/build/esm/fiber/types.js.map +1 -0
  90. package/build/esm/fiber/validation.js +155 -0
  91. package/build/esm/fiber/validation.js.map +1 -0
  92. package/build/esm/hooks/createPollingStore.js +81 -0
  93. package/build/esm/hooks/createPollingStore.js.map +1 -0
  94. package/build/esm/hooks/useActiveComponents.js +27 -0
  95. package/build/esm/hooks/useActiveComponents.js.map +1 -0
  96. package/build/esm/hooks/useComponentRegistry.js +25 -0
  97. package/build/esm/hooks/useComponentRegistry.js.map +1 -0
  98. package/build/esm/hooks/useComputeSelectors.js +43 -0
  99. package/build/esm/hooks/useComputeSelectors.js.map +1 -0
  100. package/build/esm/hooks/useConsoleLogs.js +46 -0
  101. package/build/esm/hooks/useConsoleLogs.js.map +1 -0
  102. package/build/esm/hooks/useInspectorSelection.js +93 -0
  103. package/build/esm/hooks/useInspectorSelection.js.map +1 -0
  104. package/build/esm/hooks/useMetrics.js +23 -0
  105. package/build/esm/hooks/useMetrics.js.map +1 -0
  106. package/build/esm/hooks/usePersistedState.js +89 -0
  107. package/build/esm/hooks/usePersistedState.js.map +1 -0
  108. package/build/esm/hooks/useRecommendations.js +123 -0
  109. package/build/esm/hooks/useRecommendations.js.map +1 -0
  110. package/build/esm/hooks/useSharedTick.js +49 -0
  111. package/build/esm/hooks/useSharedTick.js.map +1 -0
  112. package/build/esm/hooks/useTimeElapsed.js +51 -0
  113. package/build/esm/hooks/useTimeElapsed.js.map +1 -0
  114. package/build/esm/hooks/useTrackerSubscription.js +97 -0
  115. package/build/esm/hooks/useTrackerSubscription.js.map +1 -0
  116. package/build/esm/hooks/useUnusedFieldAnalysis.js +99 -0
  117. package/build/esm/hooks/useUnusedFieldAnalysis.js.map +1 -0
  118. package/build/esm/index.js +31 -0
  119. package/build/esm/index.js.map +1 -0
  120. package/build/esm/inspector/ClickToInspectSystem.js +228 -0
  121. package/build/esm/inspector/ClickToInspectSystem.js.map +1 -0
  122. package/build/esm/inspector/components/ComponentLabel.js +175 -0
  123. package/build/esm/inspector/components/ComponentLabel.js.map +1 -0
  124. package/build/esm/inspector/components/ComponentLabel.module.scss.js +12 -0
  125. package/build/esm/inspector/components/InspectorBanner.js +79 -0
  126. package/build/esm/inspector/components/InspectorBanner.js.map +1 -0
  127. package/build/esm/inspector/components/InspectorOverlay.js +149 -0
  128. package/build/esm/inspector/components/InspectorOverlay.js.map +1 -0
  129. package/build/esm/inspector/components/SelectionHighlight.js +74 -0
  130. package/build/esm/inspector/components/SelectionHighlight.js.map +1 -0
  131. package/build/esm/inspector/createClickToInspect.js +21 -0
  132. package/build/esm/inspector/createClickToInspect.js.map +1 -0
  133. package/build/esm/inspector/hooks/useAnimatedBounds.js +167 -0
  134. package/build/esm/inspector/hooks/useAnimatedBounds.js.map +1 -0
  135. package/build/esm/inspector/index.js +40 -0
  136. package/build/esm/inspector/index.js.map +1 -0
  137. package/build/esm/inspector/inspectorController.js +328 -0
  138. package/build/esm/inspector/inspectorController.js.map +1 -0
  139. package/build/esm/inspector/types.js +2 -0
  140. package/build/esm/inspector/types.js.map +1 -0
  141. package/build/esm/inspector/utils/elementBounds.js +72 -0
  142. package/build/esm/inspector/utils/elementBounds.js.map +1 -0
  143. package/build/esm/inspector/utils/interpolation.js +26 -0
  144. package/build/esm/inspector/utils/interpolation.js.map +1 -0
  145. package/build/esm/inspector/utils/labelPositioning.js +62 -0
  146. package/build/esm/inspector/utils/labelPositioning.js.map +1 -0
  147. package/build/esm/mocking/MockCacheKeyGenerator.js +109 -0
  148. package/build/esm/mocking/MockCacheKeyGenerator.js.map +1 -0
  149. package/build/esm/mocking/MockManager.js +281 -0
  150. package/build/esm/mocking/MockManager.js.map +1 -0
  151. package/build/esm/prototyping/PrototypeOverrideStore.js +66 -0
  152. package/build/esm/prototyping/PrototypeOverrideStore.js.map +1 -0
  153. package/build/esm/prototyping/index.js +18 -0
  154. package/build/esm/prototyping/index.js.map +1 -0
  155. package/build/esm/public/vite.js +19 -0
  156. package/build/esm/public/vite.js.map +1 -0
  157. package/build/esm/register.js +41 -0
  158. package/build/esm/register.js.map +1 -0
  159. package/build/esm/scss.d.ts +20 -0
  160. package/build/esm/store/ComputeStore.js +269 -0
  161. package/build/esm/store/ComputeStore.js.map +1 -0
  162. package/build/esm/store/ConsoleLogStore.js +289 -0
  163. package/build/esm/store/ConsoleLogStore.js.map +1 -0
  164. package/build/esm/store/MetricsStore.js +428 -0
  165. package/build/esm/store/MetricsStore.js.map +1 -0
  166. package/build/esm/store/MonitorStore.js +288 -0
  167. package/build/esm/store/MonitorStore.js.map +1 -0
  168. package/build/esm/store/SubscribableStore.js +38 -0
  169. package/build/esm/store/SubscribableStore.js.map +1 -0
  170. package/build/esm/store/WindowErrorStore.js +195 -0
  171. package/build/esm/store/WindowErrorStore.js.map +1 -0
  172. package/build/esm/styles.css +19441 -0
  173. package/build/esm/styles.js +31 -0
  174. package/build/esm/styles.js.map +1 -0
  175. package/build/esm/types/compute.js +2 -0
  176. package/build/esm/types/compute.js.map +1 -0
  177. package/build/esm/types/emissions.js +2 -0
  178. package/build/esm/types/emissions.js.map +1 -0
  179. package/build/esm/types/index.js +23 -0
  180. package/build/esm/types/index.js.map +1 -0
  181. package/build/esm/utils/ActionLifecycleTracker.js +178 -0
  182. package/build/esm/utils/ActionLifecycleTracker.js.map +1 -0
  183. package/build/esm/utils/CacheEfficiencyAnalyzer.js +198 -0
  184. package/build/esm/utils/CacheEfficiencyAnalyzer.js.map +1 -0
  185. package/build/esm/utils/CircularBuffer.js +96 -0
  186. package/build/esm/utils/CircularBuffer.js.map +1 -0
  187. package/build/esm/utils/ComponentContextCapture.js +215 -0
  188. package/build/esm/utils/ComponentContextCapture.js.map +1 -0
  189. package/build/esm/utils/ComponentPrimitiveDiscovery.js +173 -0
  190. package/build/esm/utils/ComponentPrimitiveDiscovery.js.map +1 -0
  191. package/build/esm/utils/ComponentQueryRegistry.js +340 -0
  192. package/build/esm/utils/ComponentQueryRegistry.js.map +1 -0
  193. package/build/esm/utils/ComputeMonitor.js +199 -0
  194. package/build/esm/utils/ComputeMonitor.js.map +1 -0
  195. package/build/esm/utils/EventTimeline.js +130 -0
  196. package/build/esm/utils/EventTimeline.js.map +1 -0
  197. package/build/esm/utils/LinkTraversalTracker.js +116 -0
  198. package/build/esm/utils/LinkTraversalTracker.js.map +1 -0
  199. package/build/esm/utils/MockDataGenerator.js +473 -0
  200. package/build/esm/utils/MockDataGenerator.js.map +1 -0
  201. package/build/esm/utils/ObservableClientMonitor.js +768 -0
  202. package/build/esm/utils/ObservableClientMonitor.js.map +1 -0
  203. package/build/esm/utils/PerformanceRecommendationEngine.js +185 -0
  204. package/build/esm/utils/PerformanceRecommendationEngine.js.map +1 -0
  205. package/build/esm/utils/PropertyAccessTracker.js +238 -0
  206. package/build/esm/utils/PropertyAccessTracker.js.map +1 -0
  207. package/build/esm/utils/RecommendationMatcher.js +53 -0
  208. package/build/esm/utils/RecommendationMatcher.js.map +1 -0
  209. package/build/esm/utils/SubscriptionTracker.js +132 -0
  210. package/build/esm/utils/SubscriptionTracker.js.map +1 -0
  211. package/build/esm/utils/UnusedFieldAnalyzer.js +186 -0
  212. package/build/esm/utils/UnusedFieldAnalyzer.js.map +1 -0
  213. package/build/esm/utils/WaterfallDetector.js +200 -0
  214. package/build/esm/utils/WaterfallDetector.js.map +1 -0
  215. package/build/esm/utils/computePayload.js +37 -0
  216. package/build/esm/utils/computePayload.js.map +1 -0
  217. package/build/esm/utils/computeRequest.js +29 -0
  218. package/build/esm/utils/computeRequest.js.map +1 -0
  219. package/build/esm/utils/format.js +69 -0
  220. package/build/esm/utils/format.js.map +1 -0
  221. package/build/esm/utils/logger.js +31 -0
  222. package/build/esm/utils/logger.js.map +1 -0
  223. package/build/esm/vite/constants.js +18 -0
  224. package/build/esm/vite/constants.js.map +1 -0
  225. package/build/esm/vite/hookInstaller.js +99 -0
  226. package/build/esm/vite/hookInstaller.js.map +1 -0
  227. package/build/esm/vite/index.js +77 -0
  228. package/build/esm/vite/index.js.map +1 -0
  229. package/build/types/DevToolsContext.d.ts +3 -0
  230. package/build/types/DevToolsContext.d.ts.map +1 -0
  231. package/build/types/components/ActionMetrics.d.ts +6 -0
  232. package/build/types/components/ActionMetrics.d.ts.map +1 -0
  233. package/build/types/components/BubbleChart.d.ts +10 -0
  234. package/build/types/components/BubbleChart.d.ts.map +1 -0
  235. package/build/types/components/CacheInspectorTab.d.ts +6 -0
  236. package/build/types/components/CacheInspectorTab.d.ts.map +1 -0
  237. package/build/types/components/CacheMetrics.d.ts +6 -0
  238. package/build/types/components/CacheMetrics.d.ts.map +1 -0
  239. package/build/types/components/ComponentCard.d.ts +13 -0
  240. package/build/types/components/ComponentCard.d.ts.map +1 -0
  241. package/build/types/components/ComputeTab.d.ts +6 -0
  242. package/build/types/components/ComputeTab.d.ts.map +1 -0
  243. package/build/types/components/CopyableCodeBlock.d.ts +7 -0
  244. package/build/types/components/CopyableCodeBlock.d.ts.map +1 -0
  245. package/build/types/components/DebuggingTab.d.ts +6 -0
  246. package/build/types/components/DebuggingTab.d.ts.map +1 -0
  247. package/build/types/components/HookRow.d.ts +9 -0
  248. package/build/types/components/HookRow.d.ts.map +1 -0
  249. package/build/types/components/ImprovementsTab.d.ts +7 -0
  250. package/build/types/components/ImprovementsTab.d.ts.map +1 -0
  251. package/build/types/components/InspectorSelectionHeader.d.ts +12 -0
  252. package/build/types/components/InspectorSelectionHeader.d.ts.map +1 -0
  253. package/build/types/components/InterceptTab.d.ts +126 -0
  254. package/build/types/components/InterceptTab.d.ts.map +1 -0
  255. package/build/types/components/IssueCard.d.ts +8 -0
  256. package/build/types/components/IssueCard.d.ts.map +1 -0
  257. package/build/types/components/LogEntryCard.d.ts +7 -0
  258. package/build/types/components/LogEntryCard.d.ts.map +1 -0
  259. package/build/types/components/MockEditor.d.ts +58 -0
  260. package/build/types/components/MockEditor.d.ts.map +1 -0
  261. package/build/types/components/MonitorErrorBoundary.d.ts +16 -0
  262. package/build/types/components/MonitorErrorBoundary.d.ts.map +1 -0
  263. package/build/types/components/MonitoringPanel.d.ts +8 -0
  264. package/build/types/components/MonitoringPanel.d.ts.map +1 -0
  265. package/build/types/components/ObjectLoadingMetrics.d.ts +7 -0
  266. package/build/types/components/ObjectLoadingMetrics.d.ts.map +1 -0
  267. package/build/types/components/OsdkAppErrorBoundary.d.ts +18 -0
  268. package/build/types/components/OsdkAppErrorBoundary.d.ts.map +1 -0
  269. package/build/types/components/OsdkDevTools.d.ts +2 -0
  270. package/build/types/components/OsdkDevTools.d.ts.map +1 -0
  271. package/build/types/components/OverrideEditor.d.ts +26 -0
  272. package/build/types/components/OverrideEditor.d.ts.map +1 -0
  273. package/build/types/components/PerformanceTab.d.ts +8 -0
  274. package/build/types/components/PerformanceTab.d.ts.map +1 -0
  275. package/build/types/components/PrimitiveSelectionPanel.d.ts +28 -0
  276. package/build/types/components/PrimitiveSelectionPanel.d.ts.map +1 -0
  277. package/build/types/components/issueTypes.d.ts +16 -0
  278. package/build/types/components/issueTypes.d.ts.map +1 -0
  279. package/build/types/components/resolveComponentName.d.ts +3 -0
  280. package/build/types/components/resolveComponentName.d.ts.map +1 -0
  281. package/build/types/components/testHelpers.d.ts +2 -0
  282. package/build/types/components/testHelpers.d.ts.map +1 -0
  283. package/build/types/css.d.d.ts +4 -0
  284. package/build/types/css.d.d.ts.map +1 -0
  285. package/build/types/fiber/DegradationNotice.d.ts +8 -0
  286. package/build/types/fiber/DegradationNotice.d.ts.map +1 -0
  287. package/build/types/fiber/DevtoolsHook.d.ts +7 -0
  288. package/build/types/fiber/DevtoolsHook.d.ts.map +1 -0
  289. package/build/types/fiber/FiberAccess.d.ts +2 -0
  290. package/build/types/fiber/FiberAccess.d.ts.map +1 -0
  291. package/build/types/fiber/FiberInspection.d.ts +6 -0
  292. package/build/types/fiber/FiberInspection.d.ts.map +1 -0
  293. package/build/types/fiber/FiberTags.d.ts +33 -0
  294. package/build/types/fiber/FiberTags.d.ts.map +1 -0
  295. package/build/types/fiber/HookStateInspector.d.ts +45 -0
  296. package/build/types/fiber/HookStateInspector.d.ts.map +1 -0
  297. package/build/types/fiber/SafeFiberOperation.d.ts +7 -0
  298. package/build/types/fiber/SafeFiberOperation.d.ts.map +1 -0
  299. package/build/types/fiber/capabilities.d.ts +38 -0
  300. package/build/types/fiber/capabilities.d.ts.map +1 -0
  301. package/build/types/fiber/traverseFiber.d.ts +5 -0
  302. package/build/types/fiber/traverseFiber.d.ts.map +1 -0
  303. package/build/types/fiber/types.d.ts +87 -0
  304. package/build/types/fiber/types.d.ts.map +1 -0
  305. package/build/types/fiber/validation.d.ts +10 -0
  306. package/build/types/fiber/validation.d.ts.map +1 -0
  307. package/build/types/hooks/createPollingStore.d.ts +5 -0
  308. package/build/types/hooks/createPollingStore.d.ts.map +1 -0
  309. package/build/types/hooks/useActiveComponents.d.ts +3 -0
  310. package/build/types/hooks/useActiveComponents.d.ts.map +1 -0
  311. package/build/types/hooks/useComponentRegistry.d.ts +3 -0
  312. package/build/types/hooks/useComponentRegistry.d.ts.map +1 -0
  313. package/build/types/hooks/useComputeSelectors.d.ts +7 -0
  314. package/build/types/hooks/useComputeSelectors.d.ts.map +1 -0
  315. package/build/types/hooks/useConsoleLogs.d.ts +7 -0
  316. package/build/types/hooks/useConsoleLogs.d.ts.map +1 -0
  317. package/build/types/hooks/useInspectorSelection.d.ts +9 -0
  318. package/build/types/hooks/useInspectorSelection.d.ts.map +1 -0
  319. package/build/types/hooks/useMetrics.d.ts +3 -0
  320. package/build/types/hooks/useMetrics.d.ts.map +1 -0
  321. package/build/types/hooks/usePersistedState.d.ts +1 -0
  322. package/build/types/hooks/usePersistedState.d.ts.map +1 -0
  323. package/build/types/hooks/useRecommendations.d.ts +10 -0
  324. package/build/types/hooks/useRecommendations.d.ts.map +1 -0
  325. package/build/types/hooks/useSharedTick.d.ts +1 -0
  326. package/build/types/hooks/useSharedTick.d.ts.map +1 -0
  327. package/build/types/hooks/useTimeElapsed.d.ts +1 -0
  328. package/build/types/hooks/useTimeElapsed.d.ts.map +1 -0
  329. package/build/types/hooks/useTrackerSubscription.d.ts +16 -0
  330. package/build/types/hooks/useTrackerSubscription.d.ts.map +1 -0
  331. package/build/types/hooks/useUnusedFieldAnalysis.d.ts +8 -0
  332. package/build/types/hooks/useUnusedFieldAnalysis.d.ts.map +1 -0
  333. package/build/types/index.d.ts +21 -0
  334. package/build/types/index.d.ts.map +1 -0
  335. package/build/types/inspector/ClickToInspectSystem.d.ts +40 -0
  336. package/build/types/inspector/ClickToInspectSystem.d.ts.map +1 -0
  337. package/build/types/inspector/components/ComponentLabel.d.ts +3 -0
  338. package/build/types/inspector/components/ComponentLabel.d.ts.map +1 -0
  339. package/build/types/inspector/components/InspectorBanner.d.ts +5 -0
  340. package/build/types/inspector/components/InspectorBanner.d.ts.map +1 -0
  341. package/build/types/inspector/components/InspectorOverlay.d.ts +3 -0
  342. package/build/types/inspector/components/InspectorOverlay.d.ts.map +1 -0
  343. package/build/types/inspector/components/SelectionHighlight.d.ts +3 -0
  344. package/build/types/inspector/components/SelectionHighlight.d.ts.map +1 -0
  345. package/build/types/inspector/createClickToInspect.d.ts +3 -0
  346. package/build/types/inspector/createClickToInspect.d.ts.map +1 -0
  347. package/build/types/inspector/hooks/useAnimatedBounds.d.ts +2 -0
  348. package/build/types/inspector/hooks/useAnimatedBounds.d.ts.map +1 -0
  349. package/build/types/inspector/index.d.ts +13 -0
  350. package/build/types/inspector/index.d.ts.map +1 -0
  351. package/build/types/inspector/inspectorController.d.ts +2 -0
  352. package/build/types/inspector/inspectorController.d.ts.map +1 -0
  353. package/build/types/inspector/types.d.ts +94 -0
  354. package/build/types/inspector/types.d.ts.map +1 -0
  355. package/build/types/inspector/utils/elementBounds.d.ts +3 -0
  356. package/build/types/inspector/utils/elementBounds.d.ts.map +1 -0
  357. package/build/types/inspector/utils/interpolation.d.ts +7 -0
  358. package/build/types/inspector/utils/interpolation.d.ts.map +1 -0
  359. package/build/types/inspector/utils/labelPositioning.d.ts +3 -0
  360. package/build/types/inspector/utils/labelPositioning.d.ts.map +1 -0
  361. package/build/types/mocking/MockCacheKeyGenerator.d.ts +41 -0
  362. package/build/types/mocking/MockCacheKeyGenerator.d.ts.map +1 -0
  363. package/build/types/mocking/MockManager.d.ts +103 -0
  364. package/build/types/mocking/MockManager.d.ts.map +1 -0
  365. package/build/types/prototyping/PrototypeOverrideStore.d.ts +33 -0
  366. package/build/types/prototyping/PrototypeOverrideStore.d.ts.map +1 -0
  367. package/build/types/prototyping/index.d.ts +1 -0
  368. package/build/types/prototyping/index.d.ts.map +1 -0
  369. package/build/types/public/vite.d.ts +2 -0
  370. package/build/types/public/vite.d.ts.map +1 -0
  371. package/build/types/register.d.ts +1 -0
  372. package/build/types/register.d.ts.map +1 -0
  373. package/build/types/scss.d.d.ts +6 -0
  374. package/build/types/scss.d.d.ts.map +1 -0
  375. package/build/types/store/ComputeStore.d.ts +47 -0
  376. package/build/types/store/ComputeStore.d.ts.map +1 -0
  377. package/build/types/store/ConsoleLogStore.d.ts +29 -0
  378. package/build/types/store/ConsoleLogStore.d.ts.map +1 -0
  379. package/build/types/store/MetricsStore.d.ts +42 -0
  380. package/build/types/store/MetricsStore.d.ts.map +1 -0
  381. package/build/types/store/MonitorStore.d.ts +86 -0
  382. package/build/types/store/MonitorStore.d.ts.map +1 -0
  383. package/build/types/store/SubscribableStore.d.ts +6 -0
  384. package/build/types/store/SubscribableStore.d.ts.map +1 -0
  385. package/build/types/store/WindowErrorStore.d.ts +32 -0
  386. package/build/types/store/WindowErrorStore.d.ts.map +1 -0
  387. package/build/types/styles.d.ts +1 -0
  388. package/build/types/styles.d.ts.map +1 -0
  389. package/build/types/types/compute.d.ts +73 -0
  390. package/build/types/types/compute.d.ts.map +1 -0
  391. package/build/types/types/emissions.d.ts +24 -0
  392. package/build/types/types/emissions.d.ts.map +1 -0
  393. package/build/types/types/index.d.ts +143 -0
  394. package/build/types/types/index.d.ts.map +1 -0
  395. package/build/types/utils/ActionLifecycleTracker.d.ts +39 -0
  396. package/build/types/utils/ActionLifecycleTracker.d.ts.map +1 -0
  397. package/build/types/utils/CacheEfficiencyAnalyzer.d.ts +45 -0
  398. package/build/types/utils/CacheEfficiencyAnalyzer.d.ts.map +1 -0
  399. package/build/types/utils/CircularBuffer.d.ts +18 -0
  400. package/build/types/utils/CircularBuffer.d.ts.map +1 -0
  401. package/build/types/utils/ComponentContextCapture.d.ts +29 -0
  402. package/build/types/utils/ComponentContextCapture.d.ts.map +1 -0
  403. package/build/types/utils/ComponentPrimitiveDiscovery.d.ts +62 -0
  404. package/build/types/utils/ComponentPrimitiveDiscovery.d.ts.map +1 -0
  405. package/build/types/utils/ComponentQueryRegistry.d.ts +91 -0
  406. package/build/types/utils/ComponentQueryRegistry.d.ts.map +1 -0
  407. package/build/types/utils/ComputeMonitor.d.ts +14 -0
  408. package/build/types/utils/ComputeMonitor.d.ts.map +1 -0
  409. package/build/types/utils/EventTimeline.d.ts +102 -0
  410. package/build/types/utils/EventTimeline.d.ts.map +1 -0
  411. package/build/types/utils/LinkTraversalTracker.d.ts +43 -0
  412. package/build/types/utils/LinkTraversalTracker.d.ts.map +1 -0
  413. package/build/types/utils/MockDataGenerator.d.ts +23 -0
  414. package/build/types/utils/MockDataGenerator.d.ts.map +1 -0
  415. package/build/types/utils/ObservableClientMonitor.d.ts +62 -0
  416. package/build/types/utils/ObservableClientMonitor.d.ts.map +1 -0
  417. package/build/types/utils/PerformanceRecommendationEngine.d.ts +67 -0
  418. package/build/types/utils/PerformanceRecommendationEngine.d.ts.map +1 -0
  419. package/build/types/utils/PropertyAccessTracker.d.ts +50 -0
  420. package/build/types/utils/PropertyAccessTracker.d.ts.map +1 -0
  421. package/build/types/utils/RecommendationMatcher.d.ts +5 -0
  422. package/build/types/utils/RecommendationMatcher.d.ts.map +1 -0
  423. package/build/types/utils/SubscriptionTracker.d.ts +17 -0
  424. package/build/types/utils/SubscriptionTracker.d.ts.map +1 -0
  425. package/build/types/utils/UnusedFieldAnalyzer.d.ts +46 -0
  426. package/build/types/utils/UnusedFieldAnalyzer.d.ts.map +1 -0
  427. package/build/types/utils/WaterfallDetector.d.ts +28 -0
  428. package/build/types/utils/WaterfallDetector.d.ts.map +1 -0
  429. package/build/types/utils/computePayload.d.ts +3 -0
  430. package/build/types/utils/computePayload.d.ts.map +1 -0
  431. package/build/types/utils/computeRequest.d.ts +20 -0
  432. package/build/types/utils/computeRequest.d.ts.map +1 -0
  433. package/build/types/utils/format.d.ts +5 -0
  434. package/build/types/utils/format.d.ts.map +1 -0
  435. package/build/types/utils/logger.d.ts +2 -0
  436. package/build/types/utils/logger.d.ts.map +1 -0
  437. package/build/types/vite/constants.d.ts +1 -0
  438. package/build/types/vite/constants.d.ts.map +1 -0
  439. package/build/types/vite/hookInstaller.d.ts +1 -0
  440. package/build/types/vite/hookInstaller.d.ts.map +1 -0
  441. package/build/types/vite/index.d.ts +20 -0
  442. package/build/types/vite/index.d.ts.map +1 -0
  443. package/package.json +114 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,79 @@
1
+ # @osdk/react-devtools
2
+
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 203331e: GA: promote modern hooks from `@osdk/react/experimental` to the main entry, rename `@osdk/react/experimental/admin` → `@osdk/react/platform-apis`, consolidate to a single `OsdkProvider`. Promote `ObservableClient` and supporting types out of `@osdk/client/unstable-do-not-use` to a new stable `@osdk/client/observable` entry so the GA hooks no longer depend on a "do not use" entry point. The previous import paths and symbol names are kept as `@deprecated` shims so 0.x consumers can upgrade without code changes.
8
+
9
+ #### `@osdk/client` (minor)
10
+ - new stable entry point `@osdk/client/observable` exposes `createObservableClient`, `ObservableClient` (and its `CacheEntry`, `CacheSnapshot`, `CanonicalizedOptions`, `CanonicalizeOptionsInput`, `Observer`, `ObserveLinks`, `ObserveAggregationArgs`, `ObserveFunctionCallbackArgs`, `ObserveFunctionOptions`, `ObserveObjectCallbackArgs`, `ObserveObjectsCallbackArgs`, `ObserveObjectSetArgs`, `Unsubscribable` types), and the supporting `ActionSignatureFromDef`, `QueryParameterType`, `QueryReturnType` types
11
+ - these symbols are still re-exported from `@osdk/client/unstable-do-not-use` as `@deprecated` shims; new code should import from `@osdk/client/observable`
12
+
13
+ #### `@osdk/react` (minor)
14
+ - `OsdkProvider`, `useOsdkObjects`, `useOsdkObject`, `useOsdkAction`, `useLinks`, `useObjectSet`, `useOsdkAggregation`, `useOsdkFunction`, `useOsdkFunctions`, `useStableObjectSet`, `useRegisterUserAgent`, `useDebouncedCallback`, devtools registry re-exports are now exported directly from `@osdk/react`
15
+ - admin / CBAC platform hooks (`useFoundryUser`, `useCurrentFoundryUser`, `useFoundryUsersList`, `useMarkings`, `useMarkingCategories`, `useUserViewMarkings`, `useCbacBanner`, `useCbacMarkingRestrictions`) now live at `@osdk/react/platform-apis` and still require the optional `@osdk/foundry.admin` + `@osdk/foundry.core` peers
16
+ - the previous `OsdkProvider2` is now just `OsdkProvider`. The legacy `OsdkProvider` body is gone, but `useOsdkClient` and `useOsdkMetadata` keep working since the new provider supplies the same `client` shape
17
+ - `<OsdkProvider>` no longer accepts an `observableClient` prop. The provider always derives its `ObservableClient` from `client` so the two cannot diverge. Tests that need to stub the observable layer should import `TestOsdkProvider` from `@osdk/react/testing`. `OsdkProvider2` (the deprecated alias) inherits this — it also no longer accepts `observableClient`
18
+ - `useOsdkClient2` is unified into `useOsdkClient`; the unified hook now reads from the modern context (same `client` shape)
19
+ - `peerDependencies` on `@osdk/api` and `@osdk/client` resolve to `^2.15.0` so `@osdk/react@2.15` cannot install against a `@osdk/client` that lacks the new `./observable` entry
20
+
21
+ #### `@osdk/react-components` (patch)
22
+ - update internal imports for `@osdk/react` GA — `@osdk/react/experimental` → `@osdk/react` and `@osdk/react/experimental/admin` → `@osdk/react/platform-apis`
23
+ - update `QueryParameterType` import from `@osdk/client/unstable-do-not-use` → `@osdk/client/observable`
24
+ - bump `@osdk/react` peer range to `^2.15.0`
25
+
26
+ #### `@osdk/react-devtools` (patch)
27
+ - update observable-related imports from `@osdk/client/unstable-do-not-use` → `@osdk/client/observable`
28
+
29
+ #### `@osdk/cbac-components` (patch)
30
+ - update internal imports for `@osdk/react` GA — `@osdk/react/experimental` → `@osdk/react` and `@osdk/react/experimental/admin` → `@osdk/react/platform-apis`
31
+
32
+ #### Compatibility shims
33
+
34
+ These keep working in `@osdk/react@2.15` and `@osdk/client@2.15`, marked `@deprecated` so editors surface a strikethrough:
35
+ - `import { ... } from "@osdk/react/experimental"` re-exports everything now exported from `@osdk/react`, plus `OsdkProvider as OsdkProvider2` and `useOsdkClient as useOsdkClient2`
36
+ - `import { ... } from "@osdk/react/experimental/admin"` re-exports everything now exported from `@osdk/react/platform-apis`
37
+ - `import { createObservableClient, ObservableClient, ... } from "@osdk/client/unstable-do-not-use"` re-exports the symbols now in `@osdk/client/observable`
38
+ - `import { ... } from "@osdk/react/experimental/aip"` is unchanged — AIP is still in beta
39
+
40
+ These shims will be removed in a future major.
41
+
42
+ #### Migration
43
+
44
+ For consumers upgrading from `@osdk/react@0.x`:
45
+ - `import { ... } from "@osdk/react/experimental"` → `import { ... } from "@osdk/react"`
46
+ - `import { ... } from "@osdk/react/experimental/admin"` → `import { ... } from "@osdk/react/platform-apis"` (still requires the optional `@osdk/foundry.admin` + `@osdk/foundry.core` peers)
47
+ - `<OsdkProvider2 ...>` → `<OsdkProvider ...>` (the modern provider takes the bare name)
48
+ - if you were passing `observableClient={...}` to `<OsdkProvider>` or `<OsdkProvider2>` (in tests), import `TestOsdkProvider` from `@osdk/react/testing` and use that instead — production code does not need to change
49
+ - `useOsdkClient2()` → `useOsdkClient()` (the unified hook reads from the modern context — same `client` shape, no API change at the call site)
50
+ - bump `@osdk/client` and `@osdk/api` to `^2.15.0` to satisfy the new peer ranges
51
+
52
+ For consumers reaching directly into `@osdk/client/unstable-do-not-use` for observable APIs:
53
+ - `import { createObservableClient, ObservableClient, ... } from "@osdk/client/unstable-do-not-use"` → `import { ... } from "@osdk/client/observable"`
54
+ - the symbols moved: `createObservableClient`, `ObservableClient`, `CacheEntry`, `CacheSnapshot`, `CanonicalizedOptions`, `CanonicalizeOptionsInput`, `Observer`, `ObserveLinks`, `ObserveAggregationArgs`, `ObserveFunctionCallbackArgs`, `ObserveFunctionOptions`, `ObserveObjectCallbackArgs`, `ObserveObjectsCallbackArgs`, `ObserveObjectSetArgs`, `Unsubscribable`, `ActionSignatureFromDef`, `QueryParameterType`, `QueryReturnType`
55
+
56
+ ## 0.4.0
57
+
58
+ ### Minor Changes
59
+
60
+ - 645363b: fix devtools: errors panel surfaces console.error, uncaught errors, and unhandled rejections; compute tab classifies success-without-usage as its own state instead of failure; pause network blocks all OSDK traffic regardless of recording; rename getCacheEntries to loadCacheEntries (deprecated alias kept); add OsdkAppErrorBoundary for production render-error capture; emit OSDK_PAUSE_BLOCK MonitorEvent; bind unwrapped prototype methods on the wrapped ObservableClient so callers (e.g. canonicalizeOptions, which uses private fields) don't fail with "Receiver must be an instance of class ObservableClientImpl".
61
+ - 3e8db28: add devtools registration, vite plugin, and e2e wiring
62
+
63
+ ## 0.3.0
64
+
65
+ ### Minor Changes
66
+
67
+ - 41b94dc: implement v0 of react devtools panel
68
+
69
+ ## 0.2.0
70
+
71
+ ### Minor Changes
72
+
73
+ - f01a8f4: improvements(build): significant reduction in build task graphs
74
+
75
+ ## 0.1.0
76
+
77
+ ### Minor Changes
78
+
79
+ - 89def41: patch bump associated with BlueprintJS upgrade
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { createContext } from "react";
18
+ export const DevToolsContext = /*#__PURE__*/createContext(null);
19
+ //# sourceMappingURL=DevToolsContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevToolsContext.js","names":["createContext","DevToolsContext"],"sources":["DevToolsContext.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 { Context } from \"react\";\nimport { createContext } from \"react\";\nimport type { MonitorStore } from \"./store/MonitorStore.js\";\n\nexport const DevToolsContext: Context<MonitorStore | null> = createContext<\n MonitorStore | null\n>(null);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,aAAa,QAAQ,OAAO;AAGrC,OAAO,MAAMC,eAA6C,gBAAGD,aAAa,CAExE,IAAI,CAAC","ignoreList":[]}
@@ -0,0 +1,89 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import classNames from "classnames";
18
+ import React from "react";
19
+ import { formatNumber, formatTime } from "../utils/format.js";
20
+ import styles from "./MonitoringPanel.module.scss.js";
21
+ const ROLLBACK_EXCELLENT = 0.1;
22
+ const ROLLBACK_ACCEPTABLE = 0.25;
23
+ export const ActionMetrics = ({
24
+ metrics
25
+ }) => {
26
+ const totalActions = metrics.aggregates.actionCount;
27
+ const configuredActions = metrics.aggregates.configuredOptimisticActionCount;
28
+ const observedOptimisticActions = metrics.aggregates.optimisticActionCount;
29
+ const totalTimeSaved = metrics.aggregates.totalPerceivedSpeedup;
30
+ const avgTimeSaved = observedOptimisticActions > 0 ? totalTimeSaved / observedOptimisticActions : 0;
31
+ const adoptionRate = metrics.rates.configuredOptimisticActionRate;
32
+ const effectiveness = configuredActions > 0 ? observedOptimisticActions / configuredActions : 0;
33
+ const avgServerLatency = metrics.rates.averageServerRoundTripTime;
34
+ const avgOptimisticLatency = metrics.rates.averageOptimisticRenderTime;
35
+ const rollbackRate = metrics.rates.rollbackRate;
36
+ const validations = metrics.aggregates.validationCount;
37
+ const avgValidationTime = metrics.rates.averageValidationTime;
38
+ const validationSavings = metrics.rates.validationTimeSaved;
39
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
40
+ className: styles.metric
41
+ }, /*#__PURE__*/React.createElement("span", {
42
+ className: styles.metricLabel
43
+ }, "Time Saved (Optimistic)"), /*#__PURE__*/React.createElement("span", {
44
+ className: styles.metricValue
45
+ }, observedOptimisticActions > 0 ? formatTime(avgTimeSaved) : "\u2014"), /*#__PURE__*/React.createElement("span", {
46
+ className: styles.metricSubtext
47
+ }, observedOptimisticActions > 0 ? `Total ${formatTime(totalTimeSaved)} across ${formatNumber(observedOptimisticActions)} actions` : configuredActions > 0 && observedOptimisticActions === 0 ? "Optimistic handlers have not emitted yet" : "No optimistic handlers observed")), /*#__PURE__*/React.createElement("div", {
48
+ className: styles.metric
49
+ }, /*#__PURE__*/React.createElement("span", {
50
+ className: styles.metricLabel
51
+ }, "Optimistic Adoption"), /*#__PURE__*/React.createElement("span", {
52
+ className: styles.metricValue
53
+ }, totalActions > 0 ? `${(adoptionRate * 100).toFixed(0)}%` : "\u2014"), /*#__PURE__*/React.createElement("span", {
54
+ className: styles.metricSubtext
55
+ }, formatNumber(configuredActions), " / ", formatNumber(totalActions), " ", "actions")), /*#__PURE__*/React.createElement("div", {
56
+ className: styles.metric
57
+ }, /*#__PURE__*/React.createElement("span", {
58
+ className: styles.metricLabel
59
+ }, "Optimistic Effectiveness"), /*#__PURE__*/React.createElement("span", {
60
+ className: styles.metricValue
61
+ }, configuredActions > 0 ? `${(effectiveness * 100).toFixed(0)}%` : "\u2014"), /*#__PURE__*/React.createElement("span", {
62
+ className: styles.metricSubtext
63
+ }, configuredActions > 0 ? `${formatNumber(observedOptimisticActions)} emitted` : "No optimistic handlers")), /*#__PURE__*/React.createElement("div", {
64
+ className: styles.metric
65
+ }, /*#__PURE__*/React.createElement("span", {
66
+ className: styles.metricLabel
67
+ }, "Server Latency"), /*#__PURE__*/React.createElement("span", {
68
+ className: styles.metricValue
69
+ }, formatTime(avgServerLatency)), /*#__PURE__*/React.createElement("span", {
70
+ className: styles.metricSubtext
71
+ }, "Optimistic ", observedOptimisticActions > 0 ? formatTime(avgOptimisticLatency) : "\u2014")), /*#__PURE__*/React.createElement("div", {
72
+ className: styles.metric
73
+ }, /*#__PURE__*/React.createElement("span", {
74
+ className: styles.metricLabel
75
+ }, "Rollback Rate"), /*#__PURE__*/React.createElement("span", {
76
+ className: classNames(styles.metricValue, rollbackRate <= ROLLBACK_EXCELLENT ? styles.success : rollbackRate <= ROLLBACK_ACCEPTABLE ? styles.warning : styles.danger)
77
+ }, totalActions > 0 ? `${(rollbackRate * 100).toFixed(0)}%` : "\u2014"), /*#__PURE__*/React.createElement("span", {
78
+ className: styles.metricSubtext
79
+ }, formatNumber(metrics.aggregates.rollbackActionCount), " rollbacks")), /*#__PURE__*/React.createElement("div", {
80
+ className: styles.metric
81
+ }, /*#__PURE__*/React.createElement("span", {
82
+ className: styles.metricLabel
83
+ }, "Validation"), /*#__PURE__*/React.createElement("span", {
84
+ className: styles.metricValue
85
+ }, validations > 0 ? formatTime(avgValidationTime) : "\u2014"), /*#__PURE__*/React.createElement("span", {
86
+ className: styles.metricSubtext
87
+ }, validations > 0 ? `${formatNumber(validations)} validations \u00b7 saved ${formatTime(validationSavings)}` : "No validations run")));
88
+ };
89
+ //# sourceMappingURL=ActionMetrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionMetrics.js","names":["classNames","React","formatNumber","formatTime","styles","ROLLBACK_EXCELLENT","ROLLBACK_ACCEPTABLE","ActionMetrics","metrics","totalActions","aggregates","actionCount","configuredActions","configuredOptimisticActionCount","observedOptimisticActions","optimisticActionCount","totalTimeSaved","totalPerceivedSpeedup","avgTimeSaved","adoptionRate","rates","configuredOptimisticActionRate","effectiveness","avgServerLatency","averageServerRoundTripTime","avgOptimisticLatency","averageOptimisticRenderTime","rollbackRate","validations","validationCount","avgValidationTime","averageValidationTime","validationSavings","validationTimeSaved","createElement","Fragment","className","metric","metricLabel","metricValue","metricSubtext","toFixed","success","warning","danger","rollbackActionCount"],"sources":["ActionMetrics.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classNames from \"classnames\";\nimport React from \"react\";\nimport type { MetricsSnapshot } from \"../types/index.js\";\nimport { formatNumber, formatTime } from \"../utils/format.js\";\nimport styles from \"./MonitoringPanel.module.scss\";\n\nconst ROLLBACK_EXCELLENT = 0.1;\nconst ROLLBACK_ACCEPTABLE = 0.25;\n\nexport interface ActionMetricsProps {\n metrics: MetricsSnapshot;\n}\n\nexport const ActionMetrics: React.FC<ActionMetricsProps> = ({ metrics }) => {\n const totalActions = metrics.aggregates.actionCount;\n const configuredActions = metrics.aggregates.configuredOptimisticActionCount;\n const observedOptimisticActions = metrics.aggregates.optimisticActionCount;\n const totalTimeSaved = metrics.aggregates.totalPerceivedSpeedup;\n const avgTimeSaved = observedOptimisticActions > 0\n ? totalTimeSaved / observedOptimisticActions\n : 0;\n const adoptionRate = metrics.rates.configuredOptimisticActionRate;\n const effectiveness = configuredActions > 0\n ? observedOptimisticActions / configuredActions\n : 0;\n const avgServerLatency = metrics.rates.averageServerRoundTripTime;\n const avgOptimisticLatency = metrics.rates.averageOptimisticRenderTime;\n const rollbackRate = metrics.rates.rollbackRate;\n const validations = metrics.aggregates.validationCount;\n const avgValidationTime = metrics.rates.averageValidationTime;\n const validationSavings = metrics.rates.validationTimeSaved;\n const waitingForOptimism = configuredActions > 0\n && observedOptimisticActions === 0;\n\n return (\n <>\n <div className={styles.metric}>\n <span className={styles.metricLabel}>Time Saved (Optimistic)</span>\n <span className={styles.metricValue}>\n {observedOptimisticActions > 0\n ? formatTime(avgTimeSaved)\n : \"\\u2014\"}\n </span>\n <span className={styles.metricSubtext}>\n {observedOptimisticActions > 0\n ? `Total ${formatTime(totalTimeSaved)} across ${\n formatNumber(observedOptimisticActions)\n } actions`\n : waitingForOptimism\n ? \"Optimistic handlers have not emitted yet\"\n : \"No optimistic handlers observed\"}\n </span>\n </div>\n\n <div className={styles.metric}>\n <span className={styles.metricLabel}>Optimistic Adoption</span>\n <span className={styles.metricValue}>\n {totalActions > 0 ? `${(adoptionRate * 100).toFixed(0)}%` : \"\\u2014\"}\n </span>\n <span className={styles.metricSubtext}>\n {formatNumber(configuredActions)} / {formatNumber(totalActions)}{\" \"}\n actions\n </span>\n </div>\n\n <div className={styles.metric}>\n <span className={styles.metricLabel}>Optimistic Effectiveness</span>\n <span className={styles.metricValue}>\n {configuredActions > 0\n ? `${(effectiveness * 100).toFixed(0)}%`\n : \"\\u2014\"}\n </span>\n <span className={styles.metricSubtext}>\n {configuredActions > 0\n ? `${formatNumber(observedOptimisticActions)} emitted`\n : \"No optimistic handlers\"}\n </span>\n </div>\n\n <div className={styles.metric}>\n <span className={styles.metricLabel}>Server Latency</span>\n <span className={styles.metricValue}>\n {formatTime(avgServerLatency)}\n </span>\n <span className={styles.metricSubtext}>\n Optimistic {observedOptimisticActions > 0\n ? formatTime(avgOptimisticLatency)\n : \"\\u2014\"}\n </span>\n </div>\n\n <div className={styles.metric}>\n <span className={styles.metricLabel}>Rollback Rate</span>\n <span\n className={classNames(\n styles.metricValue,\n rollbackRate <= ROLLBACK_EXCELLENT\n ? styles.success\n : rollbackRate <= ROLLBACK_ACCEPTABLE\n ? styles.warning\n : styles.danger,\n )}\n >\n {totalActions > 0\n ? `${(rollbackRate * 100).toFixed(0)}%`\n : \"\\u2014\"}\n </span>\n <span className={styles.metricSubtext}>\n {formatNumber(metrics.aggregates.rollbackActionCount)} rollbacks\n </span>\n </div>\n\n <div className={styles.metric}>\n <span className={styles.metricLabel}>Validation</span>\n <span className={styles.metricValue}>\n {validations > 0 ? formatTime(avgValidationTime) : \"\\u2014\"}\n </span>\n <span className={styles.metricSubtext}>\n {validations > 0\n ? `${formatNumber(validations)} validations \\u00b7 saved ${\n formatTime(validationSavings)\n }`\n : \"No validations run\"}\n </span>\n </div>\n </>\n );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,YAAY,EAAEC,UAAU,QAAQ,oBAAoB;AAC7D,OAAOC,MAAM,MAAM,+BAA+B;AAElD,MAAMC,kBAAkB,GAAG,GAAG;AAC9B,MAAMC,mBAAmB,GAAG,IAAI;AAMhC,OAAO,MAAMC,aAA2C,GAAGA,CAAC;EAAEC;AAAQ,CAAC,KAAK;EAC1E,MAAMC,YAAY,GAAGD,OAAO,CAACE,UAAU,CAACC,WAAW;EACnD,MAAMC,iBAAiB,GAAGJ,OAAO,CAACE,UAAU,CAACG,+BAA+B;EAC5E,MAAMC,yBAAyB,GAAGN,OAAO,CAACE,UAAU,CAACK,qBAAqB;EAC1E,MAAMC,cAAc,GAAGR,OAAO,CAACE,UAAU,CAACO,qBAAqB;EAC/D,MAAMC,YAAY,GAAGJ,yBAAyB,GAAG,CAAC,GAC9CE,cAAc,GAAGF,yBAAyB,GAC1C,CAAC;EACL,MAAMK,YAAY,GAAGX,OAAO,CAACY,KAAK,CAACC,8BAA8B;EACjE,MAAMC,aAAa,GAAGV,iBAAiB,GAAG,CAAC,GACvCE,yBAAyB,GAAGF,iBAAiB,GAC7C,CAAC;EACL,MAAMW,gB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() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ /*
3
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import { Axis } from "@visx/axis";
19
+ import { GlyphCircle } from "@visx/glyph";
20
+ import { GridColumns } from "@visx/grid";
21
+ import { useParentSize } from "@visx/responsive";
22
+ import { scaleLinear } from "@visx/scale";
23
+ import { Text } from "@visx/text";
24
+ import React from "react";
25
+ import { useComputeLastRecordingEvent, useComputeRecording, useComputeRequests } from "../hooks/useComputeSelectors.js";
26
+ import { useTimeElapsed } from "../hooks/useTimeElapsed.js";
27
+ import { visitComputeRequest } from "../utils/computeRequest.js";
28
+ import { formatMilliseconds } from "../utils/format.js";
29
+ import css from "./BubbleChart.module.scss.js";
30
+ const EMPTY_DATA = [];
31
+ const STROKE_WIDTH_PX = 1.5;
32
+ const FIXED_CHART_HEIGHT_PX = 250;
33
+ const MARGIN_TOP = 10;
34
+ const GRID_COLOR = "#2d343c";
35
+ const TICK_LABEL_PROPS = {
36
+ textAnchor: "end",
37
+ fill: "#5c6b77",
38
+ fontSize: 11,
39
+ fontFamily: "\"JetBrains Mono\", \"SF Mono\", \"Monaco\", \"Menlo\", \"Consolas\", monospace"
40
+ };
41
+ export const BubbleChart = ({
42
+ computeStore,
43
+ fillHeight,
44
+ selectedIds,
45
+ onSelectRequest
46
+ }) => {
47
+ const requests = useComputeRequests(computeStore);
48
+ const isRecording = useComputeRecording(computeStore);
49
+ const lastRecordingEvent = useComputeLastRecordingEvent(computeStore);
50
+ const startTimestamp = lastRecordingEvent?.timestamp;
51
+ const requestData = React.useMemo(() => {
52
+ if (startTimestamp == null || requests.length === 0) {
53
+ return EMPTY_DATA;
54
+ }
55
+ const hasSelections = selectedIds.length > 0;
56
+ const selectedSet = hasSelections ? new Set(selectedIds) : undefined;
57
+ const datums = requests.map(request => ({
58
+ x: request.requestTimestamp.getTime() - startTimestamp.getTime(),
59
+ y: request.requestPayloadHash % 10 + 1,
60
+ size: visitComputeRequest(request, {
61
+ failed: () => 40,
62
+ fulfilled: req => Math.max(1, req.computeUsage) * 20,
63
+ fulfilledWithoutUsage: () => 20,
64
+ pending: () => 20
65
+ }),
66
+ fill: visitComputeRequest(request, {
67
+ failed: () => "#e05252",
68
+ fulfilled: () => "#2d8cf0",
69
+ fulfilledWithoutUsage: () => "#7a8693",
70
+ pending: () => "#6b7785"
71
+ }),
72
+ isSelected: selectedSet ? selectedSet.has(request.id) : undefined,
73
+ id: request.id
74
+ }));
75
+ if (hasSelections) {
76
+ const selected = [];
77
+ const unselected = [];
78
+ for (const datum of datums) {
79
+ if (datum.isSelected) {
80
+ selected.push(datum);
81
+ } else {
82
+ unselected.push(datum);
83
+ }
84
+ }
85
+ return [...unselected, ...selected];
86
+ }
87
+ return datums;
88
+ }, [requests, selectedIds, startTimestamp]);
89
+ const timeElapsed = useTimeElapsed(isRecording ? startTimestamp : undefined);
90
+ const maxTimeDomain = lastRecordingEvent?.type === "ended" ? (lastRecordingEvent.endTimestamp?.getTime() ?? Date.now()) - lastRecordingEvent.timestamp.getTime() : timeElapsed;
91
+ const {
92
+ parentRef,
93
+ width,
94
+ height
95
+ } = useParentSize();
96
+ const chartHeight = fillHeight ? height : FIXED_CHART_HEIGHT_PX;
97
+ const xScale = React.useMemo(() => scaleLinear({
98
+ domain: [0, Math.max(500, maxTimeDomain ?? 0)],
99
+ range: [0, width]
100
+ }), [maxTimeDomain, width]);
101
+ const yScale = React.useMemo(() => scaleLinear({
102
+ domain: [-1, 12],
103
+ range: [chartHeight, MARGIN_TOP]
104
+ }), [chartHeight]);
105
+ const handleUnselect = React.useCallback(() => onSelectRequest(undefined), [onSelectRequest]);
106
+ return /*#__PURE__*/React.createElement("div", {
107
+ className: css.container,
108
+ ref: parentRef
109
+ }, /*#__PURE__*/React.createElement("svg", {
110
+ height: chartHeight,
111
+ width: width
112
+ }, /*#__PURE__*/React.createElement("rect", {
113
+ opacity: 0,
114
+ onClick: handleUnselect,
115
+ height: chartHeight,
116
+ width: width
117
+ }), /*#__PURE__*/React.createElement(Axis, {
118
+ scale: xScale,
119
+ tickLabelProps: TICK_LABEL_PROPS,
120
+ top: 25,
121
+ orientation: "top",
122
+ stroke: GRID_COLOR,
123
+ hideTicks: true,
124
+ hideZero: true,
125
+ tickComponent: renderTick,
126
+ tickFormat: formatTick
127
+ }), /*#__PURE__*/React.createElement(GridColumns, {
128
+ stroke: GRID_COLOR,
129
+ scale: xScale,
130
+ width: width,
131
+ height: chartHeight
132
+ }), requestData.map(datum => /*#__PURE__*/React.createElement(RequestGlyph, {
133
+ key: datum.id,
134
+ datum: datum,
135
+ xScale: xScale,
136
+ yScale: yScale,
137
+ onClick: onSelectRequest
138
+ }))));
139
+ };
140
+ const RequestGlyph = ({
141
+ datum,
142
+ onClick,
143
+ xScale,
144
+ yScale
145
+ }) => {
146
+ const fill = datum.isSelected === false ? "#323a44" : datum.fill;
147
+ const handleClick = React.useCallback(() => {
148
+ onClick(datum.id);
149
+ }, [datum.id, onClick]);
150
+ return /*#__PURE__*/React.createElement(GlyphCircle, {
151
+ className: css.glyph,
152
+ top: yScale(datum.y),
153
+ left: xScale(datum.x),
154
+ size: datum.size,
155
+ fill: fill,
156
+ fillOpacity: 0.5,
157
+ onClick: handleClick,
158
+ strokeOpacity: 1,
159
+ stroke: `color-mix(in srgb, ${fill}, white 20%)`,
160
+ strokeWidth: STROKE_WIDTH_PX
161
+ });
162
+ };
163
+ const renderTick = ({
164
+ x,
165
+ y,
166
+ formattedValue,
167
+ ...props
168
+ }) => {
169
+ return /*#__PURE__*/React.createElement(Text, _extends({}, props, {
170
+ x: x - 3,
171
+ y: y
172
+ }), formattedValue);
173
+ };
174
+ const formatTick = ms => formatMilliseconds(ms.valueOf(), false);
175
+ //# sourceMappingURL=BubbleChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BubbleChart.js","names":["Axis","GlyphCircle","GridColumns","useParentSize","scaleLinear","Text","React","useComputeLastRecordingEvent","useComputeRecording","useComputeRequests","useTimeElapsed","visitComputeRequest","formatMilliseconds","css","EMPTY_DATA","STROKE_WIDTH_PX","FIXED_CHART_HEIGHT_PX","MARGIN_TOP","GRID_COLOR","TICK_LABEL_PROPS","textAnchor","fill","fontSize","fontFamily","BubbleChart","computeStore","fillHeight","selectedIds","onSelectRequest","requests","isRecording","lastRecordingEvent","startTimestamp","timestamp","requestData","useMemo","length","hasSelections","selectedSet","Set","undefined","datums","map","request","x","requestTimestamp","getTime","y","requestPayloadHash","size","failed","fulfilled","req","Math","max","computeUsage","fulfilledWithoutUsage","pending","isSelected","has","id","selected","unselected","datum","push","timeElapsed","maxTimeDomain","type","endTimestamp","Date","now","parentRef","width","height","chartHeight","xScale","domain","range","yScale","handleUnselect","useCallback","createElement","className","container","ref","opacity","onClick","scale","tickLabelProps","top","orientation","stroke","hideTicks","hideZero","tickComponent","renderTick","tickFormat","formatTick","RequestGlyph","key","handleClick","glyph","left","fillOpacity","strokeOpacity","strokeWidth","formattedValue","props","_extends","ms","valueOf"],"sources":["BubbleChart.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Axis } from \"@visx/axis\";\nimport { GlyphCircle } from \"@visx/glyph\";\nimport { GridColumns } from \"@visx/grid\";\nimport { useParentSize } from \"@visx/responsive\";\nimport { scaleLinear } from \"@visx/scale\";\nimport { Text, type TextProps } from \"@visx/text\";\nimport React from \"react\";\nimport {\n useComputeLastRecordingEvent,\n useComputeRecording,\n useComputeRequests,\n} from \"../hooks/useComputeSelectors.js\";\nimport { useTimeElapsed } from \"../hooks/useTimeElapsed.js\";\nimport type { ComputeStore } from \"../store/ComputeStore.js\";\nimport { visitComputeRequest } from \"../utils/computeRequest.js\";\nimport { formatMilliseconds } from \"../utils/format.js\";\nimport css from \"./BubbleChart.module.scss\";\n\ntype Datum = {\n id: string;\n x: number;\n y: number;\n size: number;\n fill: string;\n isSelected: boolean | undefined;\n};\n\nconst EMPTY_DATA: Datum[] = [];\n\nconst STROKE_WIDTH_PX = 1.5;\nconst FIXED_CHART_HEIGHT_PX = 250;\n\nconst MARGIN_TOP = 10;\n\nconst GRID_COLOR = \"#2d343c\";\n\nconst TICK_LABEL_PROPS = {\n textAnchor: \"end\",\n fill: \"#5c6b77\",\n fontSize: 11,\n fontFamily:\n \"\\\"JetBrains Mono\\\", \\\"SF Mono\\\", \\\"Monaco\\\", \\\"Menlo\\\", \\\"Consolas\\\", monospace\",\n} as const;\n\ninterface BubbleChartProps {\n computeStore: ComputeStore;\n fillHeight: boolean;\n selectedIds: string[];\n onSelectRequest: (id: string | undefined) => void;\n}\n\nexport const BubbleChart: React.FC<BubbleChartProps> = ({\n computeStore,\n fillHeight,\n selectedIds,\n onSelectRequest,\n}) => {\n const requests = useComputeRequests(computeStore);\n const isRecording = useComputeRecording(computeStore);\n const lastRecordingEvent = useComputeLastRecordingEvent(computeStore);\n\n const startTimestamp = lastRecordingEvent?.timestamp;\n\n const requestData: Datum[] = React.useMemo(() => {\n if (startTimestamp == null || requests.length === 0) {\n return EMPTY_DATA;\n }\n\n const hasSelections = selectedIds.length > 0;\n const selectedSet = hasSelections ? new Set(selectedIds) : undefined;\n\n const datums = requests.map(\n (request): Datum => ({\n x: request.requestTimestamp.getTime() - startTimestamp.getTime(),\n y: (request.requestPayloadHash % 10) + 1,\n size: visitComputeRequest(request, {\n failed: () => 40,\n fulfilled: (req) => Math.max(1, req.computeUsage) * 20,\n fulfilledWithoutUsage: () => 20,\n pending: () => 20,\n }),\n fill: visitComputeRequest(request, {\n failed: () => \"#e05252\",\n fulfilled: () => \"#2d8cf0\",\n fulfilledWithoutUsage: () => \"#7a8693\",\n pending: () => \"#6b7785\",\n }),\n isSelected: selectedSet\n ? selectedSet.has(request.id)\n : undefined,\n id: request.id,\n }),\n );\n\n if (hasSelections) {\n const selected: Datum[] = [];\n const unselected: Datum[] = [];\n for (const datum of datums) {\n if (datum.isSelected) {\n selected.push(datum);\n } else {\n unselected.push(datum);\n }\n }\n return [...unselected, ...selected];\n }\n\n return datums;\n }, [requests, selectedIds, startTimestamp]);\n\n const timeElapsed = useTimeElapsed(isRecording ? startTimestamp : undefined);\n\n const maxTimeDomain = lastRecordingEvent?.type === \"ended\"\n ? (lastRecordingEvent.endTimestamp?.getTime() ?? Date.now())\n - lastRecordingEvent.timestamp.getTime()\n : timeElapsed;\n\n const { parentRef, width, height } = useParentSize();\n\n const chartHeight = fillHeight ? height : FIXED_CHART_HEIGHT_PX;\n\n const xScale = React.useMemo(\n () =>\n scaleLinear<number>({\n domain: [0, Math.max(500, maxTimeDomain ?? 0)],\n range: [0, width],\n }),\n [maxTimeDomain, width],\n );\n\n const yScale = React.useMemo(\n () =>\n scaleLinear<number>({\n domain: [-1, 12],\n range: [chartHeight, MARGIN_TOP],\n }),\n [chartHeight],\n );\n\n const handleUnselect = React.useCallback(\n () => onSelectRequest(undefined),\n [onSelectRequest],\n );\n\n return (\n <div className={css.container} ref={parentRef}>\n <svg height={chartHeight} width={width}>\n <rect\n opacity={0}\n onClick={handleUnselect}\n height={chartHeight}\n width={width}\n />\n <Axis\n scale={xScale}\n tickLabelProps={TICK_LABEL_PROPS}\n top={25}\n orientation=\"top\"\n stroke={GRID_COLOR}\n hideTicks={true}\n hideZero={true}\n tickComponent={renderTick}\n tickFormat={formatTick}\n />\n <GridColumns\n stroke={GRID_COLOR}\n scale={xScale}\n width={width}\n height={chartHeight}\n />\n {requestData.map((datum) => (\n <RequestGlyph\n key={datum.id}\n datum={datum}\n xScale={xScale}\n yScale={yScale}\n onClick={onSelectRequest}\n />\n ))}\n </svg>\n </div>\n );\n};\n\ninterface RequestGlyphProps {\n datum: Datum;\n xScale: (x: number) => number;\n yScale: (y: number) => number;\n onClick: (id: string) => void;\n}\n\nconst RequestGlyph: React.FC<RequestGlyphProps> = ({\n datum,\n onClick,\n xScale,\n yScale,\n}) => {\n const fill = datum.isSelected === false ? \"#323a44\" : datum.fill;\n\n const handleClick = React.useCallback(() => {\n onClick(datum.id);\n }, [datum.id, onClick]);\n\n return (\n <GlyphCircle\n className={css.glyph}\n top={yScale(datum.y)}\n left={xScale(datum.x)}\n size={datum.size}\n fill={fill}\n fillOpacity={0.5}\n onClick={handleClick}\n strokeOpacity={1}\n stroke={`color-mix(in srgb, ${fill}, white 20%)`}\n strokeWidth={STROKE_WIDTH_PX}\n />\n );\n};\n\nconst renderTick = ({\n x,\n y,\n formattedValue,\n ...props\n}: Partial<TextProps> & {\n x: number;\n y: number;\n formattedValue: string | undefined;\n}): React.ReactNode => {\n return (\n <Text {...props} x={x - 3} y={y}>\n {formattedValue}\n </Text>\n );\n};\n\nconst formatTick = (ms: { valueOf(): number }) =>\n formatMilliseconds(ms.valueOf(), false);\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,YAAY;AACjC,SAASC,WAAW,QAAQ,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,KAAK,GAAG,SAAS,GAAGK,KAAK,CAAC1C,IAAI;EAEhE,MAAM+E,WAAW,GAAG9F,KAAK,CAAC0E,WAAW,CAAC,MAAM;IAC1CM,OAAO,CAACvB,KAAK,CAACH,EAAE,CAAC;EACnB,CAAC,EAAE,CAACG,KAAK,CAACH,EAAE,EAAE0B,OAAO,CAAC,CAAC;EAEvB,oBACEhF,KAAA,CAAA2E,aAAA,CAAChF,WAAW;IACViF,SAAS,EAAErE,GAAG,CAACwF,KAAM;IACrBZ,GAAG,EAAEX,MAAM,CAACf,KAAK,CAAChB,CAAC,CAAE;IACrBuD,IAAI,EAAE3B,MAAM,CAACZ,KAAK,CAACnB,CAAC,CAAE;IACtBK,IAAI,EAAEc,KAAK,CAACd,IAAK;IACjB5B,IAAI,EAAEA,IAAK;IACXkF,WAAW,EAAE,GAAI;IACjBjB,OAAO,EAAEc,WAAY;IACrBI,aAAa,EAAE,CAAE;IACjBb,MAAM,EAAE,sBAAsBtE,IAAI,cAAe;IACjDoF,WAAW,EAAE1F;EAAgB,CAC9B,CAAC;AAEN,CAAC;AAED,MAAMgF,UAAU,GAAGA,CAAC;EAClBnD,CAAC;EACDG,CAAC;EACD2D,cAAc;EACd,GAAGC;AAKL,CAAC,KAAsB;EACrB,oBACErG,KAAA,CAAA2E,aAAA,CAAC5E,IAAI,EAAAuG,QAAA,KAAKD,KAAK;IAAE/D,CAAC,EAAEA,CAAC,GAAG,CAAE;IAACG,CAAC,EAAEA;EAAE,IAC7B2D,cACG,CAAC;AAEX,CAAC;AAED,MAAMT,UAAU,GAAIY,EAAyB,IAC3CjG,kBAAkB,CAACiG,EAAE,CAACC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ // AUTO-GENERATED by scripts/build-css.mjs. Do not edit by hand.
2
+ const styles = {
3
+ "container": "BubbleChart-module__container___ydLwDYO5",
4
+ "glyph": "BubbleChart-module__glyph___G5loSE-h"
5
+ };
6
+ export default styles;