@djangocfg/ui-tools 2.1.417 → 2.1.419

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 (335) hide show
  1. package/dist/audio-player/index.cjs +1 -2
  2. package/dist/audio-player/index.cjs.map +1 -1
  3. package/dist/audio-player/index.d.cts +3 -11
  4. package/dist/audio-player/index.d.ts +3 -11
  5. package/dist/audio-player/index.mjs +1 -2
  6. package/dist/audio-player/index.mjs.map +1 -1
  7. package/dist/file-icon/index.cjs +3 -3
  8. package/dist/file-icon/index.cjs.map +1 -1
  9. package/dist/file-icon/index.mjs +3 -3
  10. package/dist/file-icon/index.mjs.map +1 -1
  11. package/dist/tree/index.cjs +0 -3
  12. package/dist/tree/index.cjs.map +1 -1
  13. package/dist/tree/index.mjs +0 -3
  14. package/dist/tree/index.mjs.map +1 -1
  15. package/package.json +117 -36
  16. package/src/common/FloatingToolbar/actions/CopyAction.tsx +31 -0
  17. package/src/{components → common}/FloatingToolbar/actions/DownloadAction.tsx +15 -10
  18. package/src/common/FloatingToolbar/actions/ExpandAction.tsx +33 -0
  19. package/src/common/FloatingToolbar/actions/FullscreenAction.tsx +38 -0
  20. package/src/{components → common}/FloatingToolbar/index.tsx +39 -0
  21. package/src/lib/http.ts +64 -0
  22. package/src/tools/chat/index.ts +1 -1
  23. package/src/tools/chat/launcher/ChatFAB.tsx +66 -74
  24. package/src/tools/chat/launcher/header/ChatHeaderActionButton.tsx +2 -3
  25. package/src/tools/chat/lazy.tsx +1 -1
  26. package/src/tools/chat/messages/MessageBubble.tsx +1 -1
  27. package/src/tools/chat/messages/blocks/builtin.tsx +1 -1
  28. package/src/tools/chat/messages/blocks/renderers/CodeBlock.tsx +2 -2
  29. package/src/tools/chat/messages/blocks/renderers/JsonBlock.tsx +12 -1
  30. package/src/tools/data/DataGrid/lazy.tsx +1 -1
  31. package/src/tools/data/DataTable/lazy.tsx +1 -1
  32. package/src/tools/data/JsonTree/JsonViewer.tsx +720 -0
  33. package/src/tools/data/JsonTree/README.md +126 -73
  34. package/src/tools/data/JsonTree/index.tsx +3 -95
  35. package/src/tools/data/JsonTree/lazy.tsx +10 -50
  36. package/src/tools/data/JsonTree/types.ts +82 -63
  37. package/src/tools/data/Kanban/lazy.tsx +1 -1
  38. package/src/tools/data/Listbox/lazy.tsx +1 -1
  39. package/src/tools/data/Masonry/lazy.tsx +1 -1
  40. package/src/tools/data/Timeline/lazy.tsx +1 -1
  41. package/src/tools/data/Tree/components/TreeRow.tsx +0 -11
  42. package/src/tools/data/Tree/lazy.tsx +1 -1
  43. package/src/tools/dev/Map/lazy.tsx +1 -1
  44. package/src/tools/dev/Mermaid/Mermaid.client.tsx +2 -2
  45. package/src/tools/dev/Mermaid/lazy.tsx +1 -1
  46. package/src/tools/dev/api/ApiRefTable/ApiRefTable.tsx +65 -0
  47. package/src/tools/dev/api/ApiRefTable/README.md +31 -0
  48. package/src/tools/dev/api/ApiRefTable/components/Row.tsx +96 -0
  49. package/src/tools/dev/api/ApiRefTable/components/TypeDisplay.tsx +44 -0
  50. package/src/tools/dev/api/ApiRefTable/index.ts +6 -0
  51. package/src/tools/dev/api/ApiRefTable/lazy.tsx +21 -0
  52. package/src/tools/dev/api/ApiRefTable/types.ts +82 -0
  53. package/src/tools/dev/api/ApiRefTable/utils.ts +42 -0
  54. package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/ApiIntroSection.tsx +1 -1
  55. package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/CodeSamples/index.tsx +1 -1
  56. package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Header/index.tsx +1 -1
  57. package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Responses/ResponseBody.tsx +7 -21
  58. package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/RequestPanel.tsx +1 -1
  59. package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/PrettyView.tsx +13 -19
  60. package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/types.ts +1 -1
  61. package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/lazy.tsx +1 -1
  62. package/src/tools/dev/api/RequestViewer/README.md +33 -0
  63. package/src/tools/dev/api/RequestViewer/RequestViewer.tsx +121 -0
  64. package/src/tools/dev/api/RequestViewer/components/BodyTab.tsx +44 -0
  65. package/src/tools/dev/api/RequestViewer/components/EmptyState.tsx +13 -0
  66. package/src/tools/dev/api/RequestViewer/components/HeadersTab.tsx +78 -0
  67. package/src/tools/dev/api/RequestViewer/components/TimingTab.tsx +113 -0
  68. package/src/tools/dev/api/RequestViewer/components/utils.ts +31 -0
  69. package/src/tools/dev/api/RequestViewer/index.ts +16 -0
  70. package/src/tools/dev/api/RequestViewer/lazy.tsx +30 -0
  71. package/src/tools/dev/api/RequestViewer/types.ts +81 -0
  72. package/src/tools/dev/code/DiffViewer/DiffViewer.tsx +144 -0
  73. package/src/tools/dev/code/DiffViewer/README.md +33 -0
  74. package/src/tools/dev/code/DiffViewer/components/CopyButton.tsx +49 -0
  75. package/src/tools/dev/code/DiffViewer/components/DiffLineContent.tsx +48 -0
  76. package/src/tools/dev/code/DiffViewer/components/SplitView.tsx +220 -0
  77. package/src/tools/dev/code/DiffViewer/components/UnifiedView.tsx +154 -0
  78. package/src/tools/dev/code/DiffViewer/hooks/useDiff.ts +47 -0
  79. package/src/tools/dev/code/DiffViewer/hooks/useHighlighter.ts +54 -0
  80. package/src/tools/dev/code/DiffViewer/index.ts +22 -0
  81. package/src/tools/dev/code/DiffViewer/lazy.tsx +22 -0
  82. package/src/tools/dev/code/DiffViewer/types.ts +109 -0
  83. package/src/tools/dev/code/DiffViewer/utils/computeDiff.ts +159 -0
  84. package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/CollapseToggle.tsx +1 -1
  85. package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/MarkdownMessage.tsx +1 -1
  86. package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/components.tsx +2 -2
  87. package/src/tools/dev/{PrettyCode → code/PrettyCode}/PrettyCode.client.tsx +2 -2
  88. package/src/tools/dev/{PrettyCode → code/PrettyCode}/lazy.tsx +1 -1
  89. package/src/tools/dev/ops/EnvTable/EnvTable.tsx +228 -0
  90. package/src/tools/dev/ops/EnvTable/README.md +29 -0
  91. package/src/tools/dev/ops/EnvTable/hooks/useEnvMask.ts +121 -0
  92. package/src/tools/dev/ops/EnvTable/index.ts +12 -0
  93. package/src/tools/dev/ops/EnvTable/lazy.tsx +21 -0
  94. package/src/tools/dev/ops/EnvTable/types.ts +76 -0
  95. package/src/tools/dev/ops/LogViewer/LogViewer.tsx +194 -0
  96. package/src/tools/dev/ops/LogViewer/README.md +30 -0
  97. package/src/tools/dev/ops/LogViewer/components/LogRow.tsx +151 -0
  98. package/src/tools/dev/ops/LogViewer/components/Toolbar.tsx +199 -0
  99. package/src/tools/dev/ops/LogViewer/hooks/useAutoScroll.ts +68 -0
  100. package/src/tools/dev/ops/LogViewer/hooks/useLogFilter.ts +58 -0
  101. package/src/tools/dev/ops/LogViewer/index.ts +18 -0
  102. package/src/tools/dev/ops/LogViewer/lazy.tsx +25 -0
  103. package/src/tools/dev/ops/LogViewer/types.ts +142 -0
  104. package/src/tools/dev/ops/LogViewer/utils/ansi.ts +231 -0
  105. package/src/tools/forms/CodeEditor/components/Editor.tsx +19 -0
  106. package/src/tools/forms/CodeEditor/hooks/useEditorTheme.ts +13 -73
  107. package/src/tools/forms/CodeEditor/lazy.tsx +1 -1
  108. package/src/tools/forms/CodeEditor/types/index.ts +7 -0
  109. package/src/tools/forms/FileUpload/lazy.tsx +1 -1
  110. package/src/tools/forms/JsonEditor/JsonEditor.tsx +115 -0
  111. package/src/tools/forms/JsonEditor/index.ts +1 -0
  112. package/src/tools/forms/JsonEditor/lazy.tsx +24 -0
  113. package/src/tools/forms/JsonForm/index.ts +1 -1
  114. package/src/tools/forms/JsonForm/lazy.tsx +1 -1
  115. package/src/tools/forms/MarkdownEditor/MarkdownEditor.tsx +40 -0
  116. package/src/tools/forms/MarkdownEditor/lazy.tsx +1 -1
  117. package/src/tools/forms/MarkdownEditor/styles.css +174 -21
  118. package/src/tools/forms/NotionEditor/CustomKeymap.ts +48 -0
  119. package/src/tools/forms/NotionEditor/LinkDialog.tsx +133 -0
  120. package/src/tools/forms/NotionEditor/NotionEditor.tsx +304 -0
  121. package/src/tools/forms/NotionEditor/README.md +237 -0
  122. package/src/tools/forms/NotionEditor/SlashExtension.ts +32 -0
  123. package/src/tools/forms/NotionEditor/SlashList.tsx +136 -0
  124. package/src/tools/forms/NotionEditor/TaskItemView.tsx +41 -0
  125. package/src/tools/forms/NotionEditor/createSlashSuggestion.ts +121 -0
  126. package/src/tools/forms/NotionEditor/extensions.ts +105 -0
  127. package/src/tools/forms/NotionEditor/index.ts +1 -0
  128. package/src/tools/forms/NotionEditor/lazy.tsx +44 -0
  129. package/src/tools/forms/NotionEditor/slashItems.ts +159 -0
  130. package/src/tools/forms/NotionEditor/styles.css +478 -0
  131. package/src/tools/forms/NotionEditor/types.ts +28 -0
  132. package/src/tools/index.ts +153 -13
  133. package/src/tools/input/Combobox/lazy.tsx +1 -1
  134. package/src/tools/input/CronScheduler/components/CronPreview.README.md +28 -0
  135. package/src/tools/input/CronScheduler/components/CronPreview.tsx +136 -0
  136. package/src/tools/input/CronScheduler/components/index.ts +3 -0
  137. package/src/tools/input/CronScheduler/index.tsx +5 -1
  138. package/src/tools/input/CronScheduler/lazy.tsx +5 -1
  139. package/src/tools/input/CronScheduler/utils/cron-next-runs.ts +122 -0
  140. package/src/tools/input/CronScheduler/utils/index.ts +1 -0
  141. package/src/tools/input/Scroller/lazy.tsx +1 -1
  142. package/src/tools/input/Sortable/lazy.tsx +1 -1
  143. package/src/tools/input/SpeechRecognition/lazy.tsx +1 -1
  144. package/src/tools/input/SpeechRecognition/widgets/VoiceComposerSlot.tsx +41 -36
  145. package/src/tools/media/AudioPlayer/PlayerShell.tsx +3 -11
  146. package/src/tools/media/AudioPlayer/types.ts +4 -11
  147. package/src/tools/media/ImageViewer/components/ImageToolbar.tsx +58 -47
  148. package/src/tools/media/ImageViewer/components/ImageViewer.tsx +35 -19
  149. package/src/tools/media/ImageViewer/lazy.tsx +1 -1
  150. package/src/tools/media/ImageViewer/types.ts +4 -0
  151. package/src/tools/media/LottiePlayer/lazy.tsx +1 -1
  152. package/src/tools/media/VideoPlayer/VideoPlayer.tsx +47 -1
  153. package/src/tools/media/VideoPlayer/parts/fullscreen.tsx +21 -4
  154. package/src/tools/media/VideoPlayer/parts/pip.tsx +21 -4
  155. package/src/tools/media/VideoPlayer/parts/play-button.tsx +21 -4
  156. package/src/tools/media/VideoPlayer/parts/playback-rate.tsx +19 -3
  157. package/src/tools/media/VideoPlayer/parts/volume.tsx +237 -18
  158. package/src/tools/media/VideoPlayer/styles/video-player.css +87 -7
  159. package/src/tools/media/VideoPlayer/types.ts +4 -0
  160. package/src/tools/overlay/ResponsiveDialog/lazy.tsx +1 -1
  161. package/src/tools/overlay/ScrollSpy/lazy.tsx +1 -1
  162. package/src/tools/overlay/SelectionToolbar/lazy.tsx +1 -1
  163. package/src/tools/overlay/Tour/lazy.tsx +1 -1
  164. package/src/tools/visual/Marquee/lazy.tsx +1 -1
  165. package/src/tools/visual/QRCode/lazy.tsx +1 -1
  166. package/src/tools/visual/charts/ActivityGraph/ActivityGraph.tsx +195 -0
  167. package/src/tools/visual/charts/ActivityGraph/README.md +28 -0
  168. package/src/tools/visual/charts/ActivityGraph/index.ts +8 -0
  169. package/src/tools/visual/charts/ActivityGraph/lazy.tsx +21 -0
  170. package/src/tools/visual/charts/ActivityGraph/types.ts +59 -0
  171. package/src/tools/visual/charts/ActivityGraph/utils.ts +88 -0
  172. package/src/tools/visual/charts/CommitGraph/CommitGraph.tsx +80 -0
  173. package/src/tools/visual/charts/CommitGraph/README.md +28 -0
  174. package/src/tools/visual/charts/CommitGraph/components/CommitDetail.tsx +107 -0
  175. package/src/tools/visual/charts/CommitGraph/components/CommitRow.tsx +122 -0
  176. package/src/tools/visual/charts/CommitGraph/components/Rails.tsx +171 -0
  177. package/src/tools/visual/charts/CommitGraph/hooks/useGraphLayout.ts +169 -0
  178. package/src/tools/visual/charts/CommitGraph/hooks/useLaneColors.ts +45 -0
  179. package/src/tools/visual/charts/CommitGraph/index.ts +14 -0
  180. package/src/tools/visual/charts/CommitGraph/lazy.tsx +25 -0
  181. package/src/tools/visual/charts/CommitGraph/types.ts +85 -0
  182. package/src/tools/visual/charts/CommitGraph/utils.ts +53 -0
  183. package/src/tools/visual/{Gauge → charts/Gauge}/lazy.tsx +1 -1
  184. package/src/tools/visual/charts/Sparkline/README.md +29 -0
  185. package/src/tools/visual/charts/Sparkline/Sparkline.tsx +217 -0
  186. package/src/tools/visual/charts/Sparkline/index.ts +9 -0
  187. package/src/tools/visual/charts/Sparkline/lazy.tsx +26 -0
  188. package/src/tools/visual/charts/Sparkline/types.ts +58 -0
  189. package/src/tools/visual/design/ColorPalette/ColorPalette.tsx +129 -0
  190. package/src/tools/visual/design/ColorPalette/README.md +34 -0
  191. package/src/tools/visual/design/ColorPalette/components/Swatch.tsx +102 -0
  192. package/src/tools/visual/design/ColorPalette/hooks/useCopyToClipboard.ts +41 -0
  193. package/src/tools/visual/design/ColorPalette/index.ts +12 -0
  194. package/src/tools/visual/design/ColorPalette/lazy.tsx +21 -0
  195. package/src/tools/visual/design/ColorPalette/types.ts +63 -0
  196. package/src/tools/visual/design/ColorPalette/utils.ts +83 -0
  197. package/src/tools/visual/{ColorPicker → design/ColorPicker}/lazy.tsx +1 -1
  198. package/src/tools/visual/{FileIcon → design/FileIcon}/treeAdapter.tsx +1 -1
  199. package/src/tools/visual/{Fps → indicators/Fps}/lazy.tsx +1 -1
  200. package/src/tools/visual/{Rating → indicators/Rating}/lazy.tsx +1 -1
  201. package/src/tools/visual/indicators/StatusIndicator/README.md +28 -0
  202. package/src/tools/visual/indicators/StatusIndicator/StatusIndicator.tsx +83 -0
  203. package/src/tools/visual/indicators/StatusIndicator/index.ts +14 -0
  204. package/src/tools/visual/indicators/StatusIndicator/lazy.tsx +21 -0
  205. package/src/tools/visual/indicators/StatusIndicator/types.ts +133 -0
  206. package/src/components/FloatingToolbar/actions/CopyAction.tsx +0 -22
  207. package/src/components/FloatingToolbar/actions/ExpandAction.tsx +0 -25
  208. package/src/components/FloatingToolbar/actions/FullscreenAction.tsx +0 -30
  209. package/src/tools/data/JsonTree/components/JsonContent.tsx +0 -197
  210. package/src/tools/data/JsonTree/hooks/useJsonExpand.ts +0 -50
  211. /package/src/{components → common}/FloatingToolbar/FloatingToolbar.css +0 -0
  212. /package/src/{components → common}/FloatingToolbar/actions/index.ts +0 -0
  213. /package/src/{components → common}/FloatingToolbar/hooks/useElementCorner.ts +0 -0
  214. /package/src/{components → common}/FloatingToolbar/hooks/useScrollIsolation.ts +0 -0
  215. /package/src/{components → common}/index.ts +0 -0
  216. /package/src/{components → common}/lazy-wrapper.tsx +0 -0
  217. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/README.md +0 -0
  218. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/DocsView.tsx +0 -0
  219. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/CodeSamples/LanguageTabs.tsx +0 -0
  220. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/CodeSamples/useCodeSnippet.ts +0 -0
  221. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Header/MetaActions.tsx +0 -0
  222. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Header/MethodBadge.tsx +0 -0
  223. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Header/PathDisplay.tsx +0 -0
  224. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Parameters/ParamGroup.tsx +0 -0
  225. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Parameters/ParamRow.tsx +0 -0
  226. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Parameters/index.tsx +0 -0
  227. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/RequestBody/index.tsx +0 -0
  228. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Responses/ResponseRow.tsx +0 -0
  229. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Responses/StatusTag.tsx +0 -0
  230. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Responses/index.tsx +0 -0
  231. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/SchemaFields/FieldRow.tsx +0 -0
  232. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/SchemaFields/buildTree.ts +0 -0
  233. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/SchemaFields/index.tsx +0 -0
  234. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/SchemaFields/types.ts +0 -0
  235. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Section/SectionHeader.tsx +0 -0
  236. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Section/defaults.ts +0 -0
  237. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Section/index.tsx +0 -0
  238. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/context.tsx +0 -0
  239. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/hooks/useSectionHash.ts +0 -0
  240. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/index.tsx +0 -0
  241. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/store/index.ts +0 -0
  242. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/store/selectors.ts +0 -0
  243. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/types.ts +0 -0
  244. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/SchemaCopyMenu.tsx +0 -0
  245. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/BrandHeader.tsx +0 -0
  246. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/CategoryBlock.tsx +0 -0
  247. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/EndpointRow.tsx +0 -0
  248. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/SchemaSection.tsx +0 -0
  249. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/SearchInput.tsx +0 -0
  250. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/SidebarBody.tsx +0 -0
  251. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/Toolbar.tsx +0 -0
  252. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/buildVM.ts +0 -0
  253. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/index.tsx +0 -0
  254. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/types.ts +0 -0
  255. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/useDebouncedValue.ts +0 -0
  256. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/SlideInPlayground.tsx +0 -0
  257. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/TryItSheet.tsx +0 -0
  258. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/anchor.ts +0 -0
  259. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/grouping.ts +0 -0
  260. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/index.tsx +0 -0
  261. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/sidebarLabel.ts +0 -0
  262. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/index.ts +0 -0
  263. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/BodyFormEditor.tsx +0 -0
  264. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/EndpointDraftSync.tsx +0 -0
  265. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/EndpointResetButton.tsx +0 -0
  266. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/PreviewView.tsx +0 -0
  267. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/RawView.tsx +0 -0
  268. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/StatusBar.tsx +0 -0
  269. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/ViewTabs.tsx +0 -0
  270. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/detectContent.ts +0 -0
  271. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/index.tsx +0 -0
  272. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/useResponseView.ts +0 -0
  273. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/SendButton.tsx +0 -0
  274. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ui.tsx +0 -0
  275. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/constants.ts +0 -0
  276. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/context/PlaygroundContext.tsx +0 -0
  277. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/hooks/index.ts +0 -0
  278. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/hooks/useDocsUrlSync.ts +0 -0
  279. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/hooks/useEndpointDraft.ts +0 -0
  280. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/hooks/useMobile.ts +0 -0
  281. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/hooks/useOpenApiSchema.ts +0 -0
  282. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/index.tsx +0 -0
  283. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/types.ts +0 -0
  284. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/apiKeyManager.ts +0 -0
  285. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/codeSamples.ts +0 -0
  286. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/formatters.ts +0 -0
  287. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/index.ts +0 -0
  288. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/operationToHar.ts +0 -0
  289. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/sampler.ts +0 -0
  290. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/schemaExport.ts +0 -0
  291. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/scrollParent.ts +0 -0
  292. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/url.ts +0 -0
  293. /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/versionManager.ts +0 -0
  294. /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/ActionRow.tsx +0 -0
  295. /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/ChatMessageRow.tsx +0 -0
  296. /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/CodeBlock.tsx +0 -0
  297. /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/README.md +0 -0
  298. /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/index.ts +0 -0
  299. /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/linkRules.ts +0 -0
  300. /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/plainText.ts +0 -0
  301. /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/sanitize.ts +0 -0
  302. /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/types.ts +0 -0
  303. /package/src/tools/dev/{PrettyCode → code/PrettyCode}/README.md +0 -0
  304. /package/src/tools/dev/{PrettyCode → code/PrettyCode}/index.tsx +0 -0
  305. /package/src/tools/dev/{PrettyCode → code/PrettyCode}/registerPrismLanguages.ts +0 -0
  306. /package/src/tools/visual/{Gauge → charts/Gauge}/Gauge.tsx +0 -0
  307. /package/src/tools/visual/{Gauge → charts/Gauge}/index.ts +0 -0
  308. /package/src/tools/visual/{Gauge → charts/Gauge}/types.ts +0 -0
  309. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/ColorPicker.tsx +0 -0
  310. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/context/ColorPickerContext.tsx +0 -0
  311. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/context/ColorPickerStore.tsx +0 -0
  312. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/context/index.ts +0 -0
  313. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/index.ts +0 -0
  314. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/lib/color-utils.ts +0 -0
  315. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerAlphaSlider.tsx +0 -0
  316. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerArea.tsx +0 -0
  317. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerEyeDropper.tsx +0 -0
  318. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerFormatSelect.tsx +0 -0
  319. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerHueSlider.tsx +0 -0
  320. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerInput.tsx +0 -0
  321. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerSwatch.tsx +0 -0
  322. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/index.ts +0 -0
  323. /package/src/tools/visual/{ColorPicker → design/ColorPicker}/types.ts +0 -0
  324. /package/src/tools/visual/{FileIcon → design/FileIcon}/FileIcon.tsx +0 -0
  325. /package/src/tools/visual/{FileIcon → design/FileIcon}/get-file-icon.ts +0 -0
  326. /package/src/tools/visual/{FileIcon → design/FileIcon}/icons/icon-data.ts +0 -0
  327. /package/src/tools/visual/{FileIcon → design/FileIcon}/index.ts +0 -0
  328. /package/src/tools/visual/{FileIcon → design/FileIcon}/loader.ts +0 -0
  329. /package/src/tools/visual/{FileIcon → design/FileIcon}/specialFolders.ts +0 -0
  330. /package/src/tools/visual/{Fps → indicators/Fps}/Fps.tsx +0 -0
  331. /package/src/tools/visual/{Fps → indicators/Fps}/index.ts +0 -0
  332. /package/src/tools/visual/{Fps → indicators/Fps}/types.ts +0 -0
  333. /package/src/tools/visual/{Rating → indicators/Rating}/Rating.tsx +0 -0
  334. /package/src/tools/visual/{Rating → indicators/Rating}/index.ts +0 -0
  335. /package/src/tools/visual/{Rating → indicators/Rating}/types.ts +0 -0
@@ -1,89 +1,142 @@
1
1
  # JsonTree
2
2
 
3
- Interactive JSON tree viewer with expand/collapse, copy, and download.
3
+ Interactive JSON viewer with collapsible nodes, search, copy-path, and a
4
+ hover-revealed toolbar (ChatGPT-style).
4
5
 
5
- ## Why dark by default
6
+ ```tsx
7
+ import { JsonTree } from '@djangocfg/ui-tools/json-tree';
6
8
 
7
- JsonTree renders on a fixed dark surface (`#0d1117`) regardless of
8
- the host UI theme — same convention as Chrome DevTools, Insomnia,
9
- Bruno, Postman. JSON inspectors carry their own data-typed palette
10
- (blue keys, green strings, orange numbers, red null) tuned for dark
11
- backgrounds; mixing it with light UI tokens flattens values into
12
- unreadable pastels.
9
+ <JsonTree data={anyJson} />
10
+ ```
13
11
 
14
- The palette is intentionally **not** a semantic token. See PrettyCode
15
- README for the same rationale.
12
+ That covers 95% of cases. The remaining props live in `types.ts`.
13
+
14
+ ## Provenance
15
+
16
+ Ported from [jalco/ui's `JsonViewer`](https://ui.justinlevine.me/docs/components/json-viewer)
17
+ (MIT, Justin Levine — full source vendored at
18
+ `packages/@sources/jalcoui-main/`). Modifications:
19
+
20
+ - Removed the Shiki theme module (65 editor palettes) — we keep one
21
+ Tailwind-token palette that follows the host light/dark theme via
22
+ `useResolvedTheme`. No `colorTheme` prop.
23
+ - New `toolbar` prop (`'auto' | 'always' | 'never'`). `'auto'` fades the
24
+ toolbar in on hover or keyboard focus inside the container (the
25
+ ChatGPT pattern). `'always'` is for debug panels; `'never'` strips it
26
+ entirely.
27
+ - New `actions` prop selects which buttons to mount. Default omits the
28
+ download button — file-viewer hosts shouldn't offer "Download" for
29
+ JSON that already lives on disk.
30
+ - `bordered={false}` strips the card frame for embedded use; the second
31
+ source of borders (`JsonContent` wrapper) is gone too.
32
+ - Toolbar buttons use ui-core `<Tooltip>` / `<Button>` / `<Input>` so
33
+ they pick up shared focus/hover styling.
34
+
35
+ The original `react-json-tree`-based wrapper is gone; consumers that
36
+ called the legacy `<JsonTree mode="full" config={…}>` shape go through
37
+ `LegacyJsonTree` (default export) which adapts old props to the new
38
+ shape — see `legacyAdapter.tsx`.
39
+
40
+ ## API
41
+
42
+ ```ts
43
+ interface JsonTreeProps {
44
+ data: unknown;
45
+ title?: string;
46
+ rootName?: string; // default 'root'
47
+ toolbar?: 'auto' | 'always' | 'never'; // default 'auto'
48
+ actions?: ('search' | 'expand' | 'copy' | 'download')[];
49
+ // default ['search','expand','copy']
50
+ defaultExpandedDepth?: number | true; // default 2; true = expand all
51
+ bordered?: boolean; // default true
52
+ className?: string;
53
+ downloadFilename?: string; // default 'data.json'
54
+ }
55
+ ```
16
56
 
17
- ## Structure
57
+ ### When to override which
18
58
 
19
- ```
20
- JsonTree/
21
- ├── index.tsx # Main component (thin orchestrator)
22
- ├── types.ts # Types, interfaces, mode presets
23
- ├── hooks/
24
- │ └── useJsonExpand.ts # Expand/collapse state + shouldExpandNodeInitially logic
25
- ├── components/
26
- │ └── JsonContent.tsx # JSONTree wrapper with theme, getItemString, postprocessValue
27
- ├── lazy.tsx # Lazy-loaded export
28
- ├── JsonTree.story.tsx # Storybook stories
29
- └── README.md
30
- ```
59
+ | Goal | Set |
60
+ | --- | --- |
61
+ | Embed inside a pane that already draws border + bg | `bordered={false}` |
62
+ | Debug-panel feel (toolbar always visible) | `toolbar="always"` |
63
+ | Strip the toolbar entirely | `toolbar="never"` |
64
+ | Add a Download button (in-memory data) | `actions={['search','expand','copy','download']}` |
65
+ | Read-only display, no Search | `actions={['expand','copy']}` |
66
+ | Long config open everything | `defaultExpandedDepth={true}` |
31
67
 
32
- ## Usage
68
+ ## Theme
33
69
 
34
- ```tsx
35
- import JsonTree from '@djangocfg/ui-tools/JsonTree';
70
+ The data-typed palette is hand-tuned per light/dark rather than wired to
71
+ semantic UI tokens — same convention as Chrome DevTools, Insomnia, and
72
+ Bruno. JSON inspectors carry their own contrast model; flattening keys
73
+ and values into theme pastels makes them illegible.
36
74
 
37
- // Full mode (default)with toolbar, border, expand/copy controls
38
- <JsonTree data={myObject} />
75
+ The component is **transparent by default**no internal background,
76
+ so it inherits whatever surface the host provides. Pass `bordered`
77
+ explicitly when you want the card frame.
39
78
 
40
- // Compact — no toolbar, smaller font (11px), depth=1 auto-expand
41
- <JsonTree data={myObject} mode="compact" />
79
+ ## Search
42
80
 
43
- // Inline minimal, no border, smallest footprint
44
- <JsonTree data={myObject} mode="inline" />
45
- ```
81
+ Hidden behind the magnifying-glass icon in the toolbar; toggling it
82
+ expands the whole tree so matches inside collapsed nodes become
83
+ visible. Matches highlight in both keys and string values; numeric and
84
+ boolean values match as text.
85
+
86
+ ## Copy-path
87
+
88
+ Hover any row — a `⊕` icon appears on the right. Clicking it copies
89
+ the full JS access path (`root.dependencies["@tiptap/core"]`, including
90
+ bracket syntax for keys that aren't valid identifiers) to the clipboard.
91
+
92
+ ## Legacy props (back-compat)
46
93
 
47
- ## Props
48
-
49
- | Prop | Type | Default | Description |
50
- |------|------|---------|-------------|
51
- | `data` | `unknown` | — | JSON data to display |
52
- | `mode` | `'full' \| 'compact' \| 'inline'` | `'full'` | Display mode (affects font, padding, controls) |
53
- | `title` | `string` | — | Optional title (full mode only) |
54
- | `config` | `JsonTreeConfig` | `{}` | Fine-grained config overrides |
55
- | `jsonTreeProps` | `Partial<CommonExternalProps>` | `{}` | Pass-through to react-json-tree |
56
-
57
- ## Mode presets
58
-
59
- | | `full` | `compact` | `inline` |
60
- |---|---|---|---|
61
- | Font size | `13px` | `11px` | `11px` |
62
- | Auto-expand depth | `2` | `1` | `1` |
63
- | Expand/copy controls | ✓ | — | — |
64
- | Collection info | ✓ | ✓ | — |
65
- | Border | solid | subtle | none |
66
-
67
- ## Config options
68
-
69
- | Option | Default | Description |
70
- |--------|---------|-------------|
71
- | `maxAutoExpandDepth` | `2` | Auto-expand depth (0 = collapsed by default) |
72
- | `maxAutoExpandArrayItems` | `10` | Arrays ≤ N items are auto-expanded |
73
- | `maxAutoExpandObjectKeys` | `5` | Objects ≤ N keys are auto-expanded |
74
- | `maxStringLength` | `200` | Truncate long strings |
75
- | `collectionLimit` | `50` | Max items rendered per collection |
76
- | `fontSize` | mode-dependent | Override font size (e.g. `'10px'`) |
77
- | `showCollectionInfo` | `true` | Show `{N}` / `(N)` labels on collapsed nodes |
78
- | `showExpandControls` | `true` (full) | Show expand/collapse button |
79
- | `showActionButtons` | `true` (full) | Show copy/download buttons |
80
- | `preserveKeyOrder` | `true` | Preserve object key insertion order |
81
-
82
- ## In debug panels
83
-
84
- Use `mode="compact"` for log entry data — it renders at 11px with depth-1 auto-expand,
85
- matching a devtools-style view without taking excessive vertical space.
94
+ The default export — `LegacyJsonTree` — accepts the pre-refactor shape
95
+ so existing call sites compile unchanged:
86
96
 
87
97
  ```tsx
88
- <LazyJsonTree data={entry.data} mode="compact" />
98
+ // Old code still works
99
+ import JsonTree from '@djangocfg/ui-tools/json-tree';
100
+ <JsonTree
101
+ data={obj}
102
+ mode="full"
103
+ config={{
104
+ maxAutoExpandDepth: 3,
105
+ showActionButtons: true,
106
+ autoHideToolbar: true,
107
+ }}
108
+ />
89
109
  ```
110
+
111
+ `legacyAdapter.ts` maps:
112
+
113
+ - `mode` → `bordered` + `defaultExpandedDepth` defaults
114
+ - `config.maxAutoExpandDepth` → `defaultExpandedDepth`
115
+ - `config.showExpandControls / showCopy / showDownload / showActionButtons`
116
+ → `actions` array
117
+ - `config.autoHideToolbar` → `toolbar: 'auto'` (vs `'always'`)
118
+ - `jsonTreeProps` → silently dropped (react-json-tree-specific)
119
+
120
+ Migrate to the new API at your own pace — new code should target
121
+ `{ JsonTree }` from the named export.
122
+
123
+ ## Lazy entries
124
+
125
+ `@djangocfg/ui-tools/json-tree` ships two lazy wrappers:
126
+
127
+ - `LazyJsonTree` — legacy shape, default export. Old code keeps working.
128
+ - `LazyJsonTreeNew` — new shape, for greenfield code.
129
+
130
+ Both wrap the renderer in `React.lazy` (~80KB chunk including the
131
+ toolbar UI and Tailwind utility surface).
132
+
133
+ ## Related
134
+
135
+ - `@djangocfg/ui-tools/json-editor` — when you need to **edit** JSON
136
+ (drag-reorder, JSON Schema validation, undo/redo). Lazy-loads
137
+ `json-edit-react` (~19KB gz) on demand. Use for debug Store panels
138
+ and config admin UIs; for read-only display always reach for
139
+ `json-tree` first.
140
+ - `@djangocfg/ui-tools/pretty-code` — read-only syntax-highlighted code
141
+ blocks (any language). Use when you have a JSON **string** to display
142
+ unmodified.
@@ -1,98 +1,6 @@
1
1
  'use client';
2
2
 
3
- import React, { memo, useMemo, useRef } from 'react';
3
+ /** Public surface for `@djangocfg/ui-tools/json-tree`. */
4
4
 
5
- import { FloatingToolbar } from '../../../components/FloatingToolbar';
6
- import { CopyAction, DownloadAction, ExpandAction } from '../../../components/FloatingToolbar/actions';
7
- import { JsonContent } from './components/JsonContent';
8
- import { useJsonExpand } from './hooks/useJsonExpand';
9
- import { JsonTreeComponentProps, MODE_PRESETS } from './types';
10
-
11
- export type { Language } from 'prism-react-renderer';
12
- export type { JsonTreeConfig, JsonTreeComponentProps, JsonTreeMode } from './types';
13
-
14
- /**
15
- * JsonTreeComponent — JSON viewer with expand/collapse, copy, download.
16
- *
17
- * Memoised: re-renders only when `title`, `data`, `mode`, `config` or
18
- * `jsonTreeProps` change. `data` is compared by reference — the parent
19
- * should not mutate the object in place.
20
- */
21
- const JsonTreeComponent = memo(({
22
- title,
23
- data,
24
- mode = 'full',
25
- config = {},
26
- jsonTreeProps = {},
27
- }: JsonTreeComponentProps) => {
28
- const containerRef = useRef<HTMLDivElement>(null);
29
-
30
- const mergedConfig = useMemo(() => ({ ...MODE_PRESETS[mode], ...config }), [mode, config]);
31
-
32
- const {
33
- maxAutoExpandDepth = 2,
34
- maxAutoExpandArrayItems = 10,
35
- maxAutoExpandObjectKeys = 5,
36
- maxStringLength = 200,
37
- collectionLimit = 50,
38
- showCollectionInfo = true,
39
- showExpandControls = true,
40
- showActionButtons = true,
41
- className = '',
42
- preserveKeyOrder = true,
43
- fontSize,
44
- } = mergedConfig;
45
-
46
- const { isExpanded, toggle, renderKey, shouldExpandNodeInitially } = useJsonExpand({
47
- maxAutoExpandDepth,
48
- maxAutoExpandArrayItems,
49
- maxAutoExpandObjectKeys,
50
- });
51
-
52
- const jsonString = useMemo(() => JSON.stringify(data, null, 2), [data]);
53
-
54
- const containerClasses = useMemo(() => {
55
- const base = 'relative w-full';
56
- switch (mode) {
57
- case 'full': return `${base} border border-border rounded-sm ${className}`;
58
- case 'compact': return `${base} border border-border/50 rounded-md ${className}`;
59
- default: return `${base} ${className}`;
60
- }
61
- }, [mode, className]);
62
-
63
- const contentPadding = mode === 'full' ? 'p-4' : mode === 'compact' ? 'p-2' : 'p-1';
64
- const showControls = (showExpandControls || showActionButtons) && mode === 'full';
65
-
66
- return (
67
- <div ref={containerRef} className={containerClasses}>
68
- {showControls && (
69
- <FloatingToolbar containerRef={containerRef}>
70
- {showExpandControls && <ExpandAction isExpanded={isExpanded} onToggle={toggle} />}
71
- {showActionButtons && (
72
- <>
73
- <CopyAction value={jsonString} title="Copy JSON" />
74
- <DownloadAction value={jsonString} filename="data.json" mimeType="application/json" title="Download JSON" />
75
- </>
76
- )}
77
- </FloatingToolbar>
78
- )}
79
-
80
- <JsonContent
81
- data={data}
82
- renderKey={renderKey}
83
- title={title}
84
- showTitle={mode === 'full'}
85
- padding={contentPadding}
86
- collectionLimit={collectionLimit}
87
- preserveKeyOrder={preserveKeyOrder}
88
- showCollectionInfo={showCollectionInfo}
89
- maxStringLength={maxStringLength}
90
- shouldExpandNodeInitially={shouldExpandNodeInitially}
91
- fontSize={fontSize}
92
- jsonTreeProps={jsonTreeProps}
93
- />
94
- </div>
95
- );
96
- });
97
-
98
- export default JsonTreeComponent;
5
+ export { JsonTree, JsonTree as default } from './JsonViewer';
6
+ export type { JsonTreeProps, JsonValue, JsonAction, JsonSize } from './types';
@@ -1,62 +1,22 @@
1
1
  'use client';
2
2
 
3
3
  /**
4
- * Lazy-loaded JsonTree Component
4
+ * `@djangocfg/ui-tools/json-tree` subpath entrypoint.
5
5
  *
6
- * JsonTree (~100KB) is loaded only when component is rendered.
7
- * Use this for automatic code-splitting with Suspense fallback.
8
- *
9
- * For direct imports without lazy loading, use:
10
- * import JsonTree from '@djangocfg/ui-tools/json-tree'
6
+ * Single lazy-loaded export (`LazyJsonTree`) wrapping the renderer
7
+ * (~80KB chunk including the toolbar UI). Suspense fallback ships from
8
+ * the shared `LoadingFallback`.
11
9
  */
12
10
 
13
- import { createLazyComponent, LoadingFallback } from '../../../components/lazy-wrapper';
14
- import type { JsonTreeConfig, JsonTreeMode } from './index';
15
- import type { CommonExternalProps } from 'react-json-tree';
16
-
17
- // ============================================================================
18
- // Types
19
- // ============================================================================
20
-
21
- export interface JsonTreeProps {
22
- title?: string;
23
- data: unknown;
24
- /**
25
- * Display mode:
26
- * - "full" (default): With toolbar and border
27
- * - "compact": No toolbar, subtle styling
28
- * - "inline": Minimal, no border
29
- */
30
- mode?: JsonTreeMode;
31
- config?: JsonTreeConfig;
32
- jsonTreeProps?: Partial<CommonExternalProps>;
33
- }
11
+ import { createLazyComponent, LoadingFallback } from '../../../common/lazy-wrapper';
12
+ import type { JsonTreeProps } from './types';
34
13
 
35
- export type { JsonTreeConfig, JsonTreeMode };
14
+ export type { JsonTreeProps, JsonValue, JsonAction, JsonSize } from './types';
36
15
 
37
- // ============================================================================
38
- // Lazy Component
39
- // ============================================================================
40
-
41
- /**
42
- * LazyJsonTree - Lazy-loaded JSON visualization tree
43
- *
44
- * Automatically shows loading state while JsonTree loads (~100KB)
45
- *
46
- * @example
47
- * // Full mode (with toolbar)
48
- * <LazyJsonTree data={obj} mode="full" />
49
- *
50
- * // Compact mode (no toolbar)
51
- * <LazyJsonTree data={obj} mode="compact" />
52
- *
53
- * // Inline mode (minimal, for embedding)
54
- * <LazyJsonTree data={obj} mode="inline" />
55
- */
56
16
  export const LazyJsonTree = createLazyComponent<JsonTreeProps>(
57
- () => import('./index'),
17
+ () => import('./JsonViewer').then((m) => ({ default: m.JsonTree })),
58
18
  {
59
19
  displayName: 'LazyJsonTree',
60
- fallback: <LoadingFallback minHeight={100} text="Loading JSON viewer..." />,
61
- }
20
+ fallback: <LoadingFallback minHeight={100} text="Loading JSON viewer" />,
21
+ },
62
22
  );
@@ -1,72 +1,91 @@
1
- import { CommonExternalProps } from 'react-json-tree';
1
+ /**
2
+ * Public types for the new JsonTree.
3
+ *
4
+ * The shape is intentionally narrow — five props cover ~95% of cases.
5
+ * Old shape (`mode`, `config`, `jsonTreeProps`, `showActionButtons`, …)
6
+ * is bridged in `legacyAdapter.ts` so existing consumers compile
7
+ * unchanged. New code should target this surface.
8
+ */
2
9
 
3
- export type JsonTreeMode = 'full' | 'compact' | 'inline';
10
+ export type JsonValue =
11
+ | string
12
+ | number
13
+ | boolean
14
+ | null
15
+ | JsonValue[]
16
+ | { [key: string]: JsonValue };
4
17
 
5
- export interface JsonTreeConfig {
6
- /** Maximum depth to expand automatically (default: 2) */
7
- maxAutoExpandDepth?: number;
8
- /** Maximum items in array to auto-expand (default: 10) */
9
- maxAutoExpandArrayItems?: number;
10
- /** Maximum object keys to auto-expand (default: 5) */
11
- maxAutoExpandObjectKeys?: number;
12
- /** Maximum string length before truncation (default: 200) */
13
- maxStringLength?: number;
14
- /** Collection limit for performance (default: 50) */
15
- collectionLimit?: number;
16
- /** Whether to show collection info (array length, object keys count) */
17
- showCollectionInfo?: boolean;
18
- /** Whether to show expand/collapse all buttons */
19
- showExpandControls?: boolean;
20
- /** Whether to show copy/download buttons */
21
- showActionButtons?: boolean;
22
- /** Custom CSS classes for the container */
23
- className?: string;
24
- /** Whether to preserve object key order (default: true) */
25
- preserveKeyOrder?: boolean;
26
- /** Font size for tree nodes (default: '12px' for compact/inline, '13px' for full) */
27
- fontSize?: string;
28
- }
18
+ /** Which toolbar buttons to expose. Default `['search','expand','copy']`. */
19
+ export type JsonAction = 'search' | 'expand' | 'copy' | 'download';
29
20
 
30
- export interface JsonTreeComponentProps {
31
- title?: string;
21
+ /**
22
+ * Font size for the tree body. Toolbar metrics stay constant.
23
+ * - `'sm'` (default) — `text-xs`, dense for chat/debug
24
+ * - `'md'` — `text-sm`, reads like Monaco at normal zoom
25
+ * - `'lg'` — `text-base`, presentation / large screen
26
+ */
27
+ export type JsonSize = 'sm' | 'md' | 'lg';
28
+
29
+ export interface JsonTreeProps {
30
+ /** Any JSON-serializable value. */
32
31
  data: unknown;
32
+
33
+ /** Optional heading label rendered in the toolbar. */
34
+ title?: string;
35
+
36
+ /** Label for the root node in the tree. Default `'root'`. */
37
+ rootName?: string;
38
+
33
39
  /**
34
- * Extra top offset in px for the floating toolbar — use when your layout
35
- * has a non-sticky header that useNavbarHeight cannot auto-detect.
36
- * Adds to the auto-detected navbar height.
40
+ * How the toolbar behaves:
41
+ * - `'auto'` fades in on hover / keyboard focus (ChatGPT-style)
42
+ * - `'always'` visible from the start (good for debug panels)
43
+ * - `'never'` — no toolbar at all
44
+ * Default `'auto'`.
37
45
  */
38
- toolbarOffset?: number;
46
+ toolbar?: 'auto' | 'always' | 'never';
47
+
39
48
  /**
40
- * Display mode:
41
- * - "full" (default): With toolbar and border
42
- * - "compact": No toolbar, subtle styling
43
- * - "inline": Minimal, no border
49
+ * Which action buttons to render in the toolbar. Default
50
+ * `['search','expand','copy']`. Add `'download'` for in-memory data
51
+ * that should be exportable; omit for on-disk file viewers.
44
52
  */
45
- mode?: JsonTreeMode;
46
- config?: JsonTreeConfig;
47
- /** Override for react-json-tree props */
48
- jsonTreeProps?: Partial<CommonExternalProps>;
49
- }
53
+ actions?: readonly JsonAction[];
50
54
 
51
- export const MODE_PRESETS: Record<JsonTreeMode, Partial<JsonTreeConfig>> = {
52
- full: {
53
- showExpandControls: true,
54
- showActionButtons: true,
55
- showCollectionInfo: true,
56
- fontSize: '13px',
57
- },
58
- compact: {
59
- showExpandControls: false,
60
- showActionButtons: false,
61
- showCollectionInfo: true,
62
- fontSize: '11px',
63
- maxAutoExpandDepth: 1,
64
- },
65
- inline: {
66
- showExpandControls: false,
67
- showActionButtons: false,
68
- showCollectionInfo: false,
69
- fontSize: '11px',
70
- maxAutoExpandDepth: 1,
71
- },
72
- };
55
+ /**
56
+ * Auto-expand depth on mount. `true` = expand everything.
57
+ * Default `2` — root + first level open, deeper stays collapsed.
58
+ */
59
+ defaultExpandedDepth?: number | true;
60
+
61
+ /**
62
+ * Font size for the tree body. Default `'sm'`. Use `'md'` for
63
+ * full-pane previews (text-viewer.tsx) so it reads at the same
64
+ * weight as Monaco; `'lg'` for talks / demos.
65
+ */
66
+ size?: JsonSize;
67
+
68
+ /**
69
+ * Draw the card frame (border + rounded corners). Default `true`.
70
+ * Pass `false` to render flush inside a host pane that already owns
71
+ * the chrome (cmdop preview, OpenAPI response panel).
72
+ */
73
+ bordered?: boolean;
74
+
75
+ /**
76
+ * Render the toolbar with reduced padding, smaller icons, and a hidden
77
+ * "X keys" badge. Use for embedded contexts where the JSON body is
78
+ * tiny (e.g. error responses with 2 keys) and the default toolbar
79
+ * dwarfs the content. Default `false`.
80
+ */
81
+ compactHeader?: boolean;
82
+
83
+ /** Extra class on the root container. */
84
+ className?: string;
85
+
86
+ /**
87
+ * Filename used for the optional Download action. Default `'data.json'`.
88
+ * Ignored when `actions` doesn't include `'download'`.
89
+ */
90
+ downloadFilename?: string;
91
+ }
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { createLazyComponent, LoadingFallback } from '../../../components/lazy-wrapper';
3
+ import { createLazyComponent, LoadingFallback } from '../../../common/lazy-wrapper';
4
4
  import type { KanbanProps } from './types';
5
5
 
6
6
  export const LazyKanban = createLazyComponent<KanbanProps>(
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { createLazyComponent, LoadingFallback } from '../../../components/lazy-wrapper';
3
+ import { createLazyComponent, LoadingFallback } from '../../../common/lazy-wrapper';
4
4
  import type { ListboxRootProps } from './types';
5
5
 
6
6
  export const LazyListbox = createLazyComponent<ListboxRootProps>(
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { createLazyComponent, LoadingFallback } from '../../../components/lazy-wrapper';
3
+ import { createLazyComponent, LoadingFallback } from '../../../common/lazy-wrapper';
4
4
  import type { MasonryProps } from './types';
5
5
 
6
6
  export const LazyMasonry = createLazyComponent<MasonryProps>(
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { createLazyComponent, LoadingFallback } from '../../../components/lazy-wrapper';
3
+ import { createLazyComponent, LoadingFallback } from '../../../common/lazy-wrapper';
4
4
  import type { TimelineProps } from './types';
5
5
 
6
6
  export const LazyTimeline = createLazyComponent<TimelineProps>(
@@ -180,17 +180,6 @@ function TreeRowRaw<T>({ row, className }: TreeRowProps<T>) {
180
180
  }}
181
181
  {...(dnd.active ? draggable.listeners : {})}
182
182
  {...(dnd.active ? draggable.attributes : {})}
183
- // Block the browser's native "click moves focus into the
184
- // focusable target" behaviour. Tree owns its own focus model
185
- // (arrow keys drive `setFocus`, click only selects + activates),
186
- // and stealing focus on every click stops downstream auto-focus
187
- // patterns from working — e.g. clicking a file in a tree-plus-
188
- // preview layout would let the row grab focus after the preview
189
- // viewer tries to take it. The synthetic `onClick` below still
190
- // fires; only the focus side-effect of mousedown is suppressed.
191
- onMouseDown={(e) => {
192
- if (e.button === 0) e.preventDefault();
193
- }}
194
183
  onClick={handleClick}
195
184
  onDoubleClick={handleDoubleClick}
196
185
  onContextMenu={handleContextMenu}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { createLazyComponent, LoadingFallback } from '../../../components/lazy-wrapper';
3
+ import { createLazyComponent, LoadingFallback } from '../../../common/lazy-wrapper';
4
4
  import type { TreeRootProps } from './types';
5
5
 
6
6
  export const LazyTree = createLazyComponent<TreeRootProps<unknown>>(
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import * as React from 'react';
14
- import { createLazyComponent, MapLoadingFallback } from '../../../components';
14
+ import { createLazyComponent, MapLoadingFallback } from '../../../common';
15
15
  import type { MapContainerProps } from './components';
16
16
 
17
17
  // ============================================================================
@@ -3,8 +3,8 @@
3
3
  import React, { useRef } from 'react';
4
4
 
5
5
  import { useResolvedTheme } from '@djangocfg/ui-core/hooks';
6
- import { FloatingToolbar } from '../../../components/FloatingToolbar';
7
- import { CopyAction, FullscreenAction } from '../../../components/FloatingToolbar/actions';
6
+ import { FloatingToolbar } from '../../../common/FloatingToolbar';
7
+ import { CopyAction, FullscreenAction } from '../../../common/FloatingToolbar/actions';
8
8
  import { MermaidErrorPanel } from './components/MermaidErrorPanel';
9
9
  import { MermaidFullscreenModal } from './components/MermaidFullscreenModal';
10
10
  import { useMermaidFullscreen } from './hooks/useMermaidFullscreen';
@@ -10,7 +10,7 @@
10
10
  * import Mermaid from '@djangocfg/ui-tools/mermaid'
11
11
  */
12
12
 
13
- import { createLazyComponent, CardLoadingFallback } from '../../../components';
13
+ import { createLazyComponent, CardLoadingFallback } from '../../../common';
14
14
  import type { MermaidProps } from './index';
15
15
 
16
16
  // ============================================================================