@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.
- package/dist/audio-player/index.cjs +1 -2
- package/dist/audio-player/index.cjs.map +1 -1
- package/dist/audio-player/index.d.cts +3 -11
- package/dist/audio-player/index.d.ts +3 -11
- package/dist/audio-player/index.mjs +1 -2
- package/dist/audio-player/index.mjs.map +1 -1
- package/dist/file-icon/index.cjs +3 -3
- package/dist/file-icon/index.cjs.map +1 -1
- package/dist/file-icon/index.mjs +3 -3
- package/dist/file-icon/index.mjs.map +1 -1
- package/dist/tree/index.cjs +0 -3
- package/dist/tree/index.cjs.map +1 -1
- package/dist/tree/index.mjs +0 -3
- package/dist/tree/index.mjs.map +1 -1
- package/package.json +117 -36
- package/src/common/FloatingToolbar/actions/CopyAction.tsx +31 -0
- package/src/{components → common}/FloatingToolbar/actions/DownloadAction.tsx +15 -10
- package/src/common/FloatingToolbar/actions/ExpandAction.tsx +33 -0
- package/src/common/FloatingToolbar/actions/FullscreenAction.tsx +38 -0
- package/src/{components → common}/FloatingToolbar/index.tsx +39 -0
- package/src/lib/http.ts +64 -0
- package/src/tools/chat/index.ts +1 -1
- package/src/tools/chat/launcher/ChatFAB.tsx +66 -74
- package/src/tools/chat/launcher/header/ChatHeaderActionButton.tsx +2 -3
- package/src/tools/chat/lazy.tsx +1 -1
- package/src/tools/chat/messages/MessageBubble.tsx +1 -1
- package/src/tools/chat/messages/blocks/builtin.tsx +1 -1
- package/src/tools/chat/messages/blocks/renderers/CodeBlock.tsx +2 -2
- package/src/tools/chat/messages/blocks/renderers/JsonBlock.tsx +12 -1
- package/src/tools/data/DataGrid/lazy.tsx +1 -1
- package/src/tools/data/DataTable/lazy.tsx +1 -1
- package/src/tools/data/JsonTree/JsonViewer.tsx +720 -0
- package/src/tools/data/JsonTree/README.md +126 -73
- package/src/tools/data/JsonTree/index.tsx +3 -95
- package/src/tools/data/JsonTree/lazy.tsx +10 -50
- package/src/tools/data/JsonTree/types.ts +82 -63
- package/src/tools/data/Kanban/lazy.tsx +1 -1
- package/src/tools/data/Listbox/lazy.tsx +1 -1
- package/src/tools/data/Masonry/lazy.tsx +1 -1
- package/src/tools/data/Timeline/lazy.tsx +1 -1
- package/src/tools/data/Tree/components/TreeRow.tsx +0 -11
- package/src/tools/data/Tree/lazy.tsx +1 -1
- package/src/tools/dev/Map/lazy.tsx +1 -1
- package/src/tools/dev/Mermaid/Mermaid.client.tsx +2 -2
- package/src/tools/dev/Mermaid/lazy.tsx +1 -1
- package/src/tools/dev/api/ApiRefTable/ApiRefTable.tsx +65 -0
- package/src/tools/dev/api/ApiRefTable/README.md +31 -0
- package/src/tools/dev/api/ApiRefTable/components/Row.tsx +96 -0
- package/src/tools/dev/api/ApiRefTable/components/TypeDisplay.tsx +44 -0
- package/src/tools/dev/api/ApiRefTable/index.ts +6 -0
- package/src/tools/dev/api/ApiRefTable/lazy.tsx +21 -0
- package/src/tools/dev/api/ApiRefTable/types.ts +82 -0
- package/src/tools/dev/api/ApiRefTable/utils.ts +42 -0
- package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/ApiIntroSection.tsx +1 -1
- package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/CodeSamples/index.tsx +1 -1
- package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Header/index.tsx +1 -1
- package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Responses/ResponseBody.tsx +7 -21
- package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/RequestPanel.tsx +1 -1
- package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/PrettyView.tsx +13 -19
- package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/types.ts +1 -1
- package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/lazy.tsx +1 -1
- package/src/tools/dev/api/RequestViewer/README.md +33 -0
- package/src/tools/dev/api/RequestViewer/RequestViewer.tsx +121 -0
- package/src/tools/dev/api/RequestViewer/components/BodyTab.tsx +44 -0
- package/src/tools/dev/api/RequestViewer/components/EmptyState.tsx +13 -0
- package/src/tools/dev/api/RequestViewer/components/HeadersTab.tsx +78 -0
- package/src/tools/dev/api/RequestViewer/components/TimingTab.tsx +113 -0
- package/src/tools/dev/api/RequestViewer/components/utils.ts +31 -0
- package/src/tools/dev/api/RequestViewer/index.ts +16 -0
- package/src/tools/dev/api/RequestViewer/lazy.tsx +30 -0
- package/src/tools/dev/api/RequestViewer/types.ts +81 -0
- package/src/tools/dev/code/DiffViewer/DiffViewer.tsx +144 -0
- package/src/tools/dev/code/DiffViewer/README.md +33 -0
- package/src/tools/dev/code/DiffViewer/components/CopyButton.tsx +49 -0
- package/src/tools/dev/code/DiffViewer/components/DiffLineContent.tsx +48 -0
- package/src/tools/dev/code/DiffViewer/components/SplitView.tsx +220 -0
- package/src/tools/dev/code/DiffViewer/components/UnifiedView.tsx +154 -0
- package/src/tools/dev/code/DiffViewer/hooks/useDiff.ts +47 -0
- package/src/tools/dev/code/DiffViewer/hooks/useHighlighter.ts +54 -0
- package/src/tools/dev/code/DiffViewer/index.ts +22 -0
- package/src/tools/dev/code/DiffViewer/lazy.tsx +22 -0
- package/src/tools/dev/code/DiffViewer/types.ts +109 -0
- package/src/tools/dev/code/DiffViewer/utils/computeDiff.ts +159 -0
- package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/CollapseToggle.tsx +1 -1
- package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/MarkdownMessage.tsx +1 -1
- package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/components.tsx +2 -2
- package/src/tools/dev/{PrettyCode → code/PrettyCode}/PrettyCode.client.tsx +2 -2
- package/src/tools/dev/{PrettyCode → code/PrettyCode}/lazy.tsx +1 -1
- package/src/tools/dev/ops/EnvTable/EnvTable.tsx +228 -0
- package/src/tools/dev/ops/EnvTable/README.md +29 -0
- package/src/tools/dev/ops/EnvTable/hooks/useEnvMask.ts +121 -0
- package/src/tools/dev/ops/EnvTable/index.ts +12 -0
- package/src/tools/dev/ops/EnvTable/lazy.tsx +21 -0
- package/src/tools/dev/ops/EnvTable/types.ts +76 -0
- package/src/tools/dev/ops/LogViewer/LogViewer.tsx +194 -0
- package/src/tools/dev/ops/LogViewer/README.md +30 -0
- package/src/tools/dev/ops/LogViewer/components/LogRow.tsx +151 -0
- package/src/tools/dev/ops/LogViewer/components/Toolbar.tsx +199 -0
- package/src/tools/dev/ops/LogViewer/hooks/useAutoScroll.ts +68 -0
- package/src/tools/dev/ops/LogViewer/hooks/useLogFilter.ts +58 -0
- package/src/tools/dev/ops/LogViewer/index.ts +18 -0
- package/src/tools/dev/ops/LogViewer/lazy.tsx +25 -0
- package/src/tools/dev/ops/LogViewer/types.ts +142 -0
- package/src/tools/dev/ops/LogViewer/utils/ansi.ts +231 -0
- package/src/tools/forms/CodeEditor/components/Editor.tsx +19 -0
- package/src/tools/forms/CodeEditor/hooks/useEditorTheme.ts +13 -73
- package/src/tools/forms/CodeEditor/lazy.tsx +1 -1
- package/src/tools/forms/CodeEditor/types/index.ts +7 -0
- package/src/tools/forms/FileUpload/lazy.tsx +1 -1
- package/src/tools/forms/JsonEditor/JsonEditor.tsx +115 -0
- package/src/tools/forms/JsonEditor/index.ts +1 -0
- package/src/tools/forms/JsonEditor/lazy.tsx +24 -0
- package/src/tools/forms/JsonForm/index.ts +1 -1
- package/src/tools/forms/JsonForm/lazy.tsx +1 -1
- package/src/tools/forms/MarkdownEditor/MarkdownEditor.tsx +40 -0
- package/src/tools/forms/MarkdownEditor/lazy.tsx +1 -1
- package/src/tools/forms/MarkdownEditor/styles.css +174 -21
- package/src/tools/forms/NotionEditor/CustomKeymap.ts +48 -0
- package/src/tools/forms/NotionEditor/LinkDialog.tsx +133 -0
- package/src/tools/forms/NotionEditor/NotionEditor.tsx +304 -0
- package/src/tools/forms/NotionEditor/README.md +237 -0
- package/src/tools/forms/NotionEditor/SlashExtension.ts +32 -0
- package/src/tools/forms/NotionEditor/SlashList.tsx +136 -0
- package/src/tools/forms/NotionEditor/TaskItemView.tsx +41 -0
- package/src/tools/forms/NotionEditor/createSlashSuggestion.ts +121 -0
- package/src/tools/forms/NotionEditor/extensions.ts +105 -0
- package/src/tools/forms/NotionEditor/index.ts +1 -0
- package/src/tools/forms/NotionEditor/lazy.tsx +44 -0
- package/src/tools/forms/NotionEditor/slashItems.ts +159 -0
- package/src/tools/forms/NotionEditor/styles.css +478 -0
- package/src/tools/forms/NotionEditor/types.ts +28 -0
- package/src/tools/index.ts +153 -13
- package/src/tools/input/Combobox/lazy.tsx +1 -1
- package/src/tools/input/CronScheduler/components/CronPreview.README.md +28 -0
- package/src/tools/input/CronScheduler/components/CronPreview.tsx +136 -0
- package/src/tools/input/CronScheduler/components/index.ts +3 -0
- package/src/tools/input/CronScheduler/index.tsx +5 -1
- package/src/tools/input/CronScheduler/lazy.tsx +5 -1
- package/src/tools/input/CronScheduler/utils/cron-next-runs.ts +122 -0
- package/src/tools/input/CronScheduler/utils/index.ts +1 -0
- package/src/tools/input/Scroller/lazy.tsx +1 -1
- package/src/tools/input/Sortable/lazy.tsx +1 -1
- package/src/tools/input/SpeechRecognition/lazy.tsx +1 -1
- package/src/tools/input/SpeechRecognition/widgets/VoiceComposerSlot.tsx +41 -36
- package/src/tools/media/AudioPlayer/PlayerShell.tsx +3 -11
- package/src/tools/media/AudioPlayer/types.ts +4 -11
- package/src/tools/media/ImageViewer/components/ImageToolbar.tsx +58 -47
- package/src/tools/media/ImageViewer/components/ImageViewer.tsx +35 -19
- package/src/tools/media/ImageViewer/lazy.tsx +1 -1
- package/src/tools/media/ImageViewer/types.ts +4 -0
- package/src/tools/media/LottiePlayer/lazy.tsx +1 -1
- package/src/tools/media/VideoPlayer/VideoPlayer.tsx +47 -1
- package/src/tools/media/VideoPlayer/parts/fullscreen.tsx +21 -4
- package/src/tools/media/VideoPlayer/parts/pip.tsx +21 -4
- package/src/tools/media/VideoPlayer/parts/play-button.tsx +21 -4
- package/src/tools/media/VideoPlayer/parts/playback-rate.tsx +19 -3
- package/src/tools/media/VideoPlayer/parts/volume.tsx +237 -18
- package/src/tools/media/VideoPlayer/styles/video-player.css +87 -7
- package/src/tools/media/VideoPlayer/types.ts +4 -0
- package/src/tools/overlay/ResponsiveDialog/lazy.tsx +1 -1
- package/src/tools/overlay/ScrollSpy/lazy.tsx +1 -1
- package/src/tools/overlay/SelectionToolbar/lazy.tsx +1 -1
- package/src/tools/overlay/Tour/lazy.tsx +1 -1
- package/src/tools/visual/Marquee/lazy.tsx +1 -1
- package/src/tools/visual/QRCode/lazy.tsx +1 -1
- package/src/tools/visual/charts/ActivityGraph/ActivityGraph.tsx +195 -0
- package/src/tools/visual/charts/ActivityGraph/README.md +28 -0
- package/src/tools/visual/charts/ActivityGraph/index.ts +8 -0
- package/src/tools/visual/charts/ActivityGraph/lazy.tsx +21 -0
- package/src/tools/visual/charts/ActivityGraph/types.ts +59 -0
- package/src/tools/visual/charts/ActivityGraph/utils.ts +88 -0
- package/src/tools/visual/charts/CommitGraph/CommitGraph.tsx +80 -0
- package/src/tools/visual/charts/CommitGraph/README.md +28 -0
- package/src/tools/visual/charts/CommitGraph/components/CommitDetail.tsx +107 -0
- package/src/tools/visual/charts/CommitGraph/components/CommitRow.tsx +122 -0
- package/src/tools/visual/charts/CommitGraph/components/Rails.tsx +171 -0
- package/src/tools/visual/charts/CommitGraph/hooks/useGraphLayout.ts +169 -0
- package/src/tools/visual/charts/CommitGraph/hooks/useLaneColors.ts +45 -0
- package/src/tools/visual/charts/CommitGraph/index.ts +14 -0
- package/src/tools/visual/charts/CommitGraph/lazy.tsx +25 -0
- package/src/tools/visual/charts/CommitGraph/types.ts +85 -0
- package/src/tools/visual/charts/CommitGraph/utils.ts +53 -0
- package/src/tools/visual/{Gauge → charts/Gauge}/lazy.tsx +1 -1
- package/src/tools/visual/charts/Sparkline/README.md +29 -0
- package/src/tools/visual/charts/Sparkline/Sparkline.tsx +217 -0
- package/src/tools/visual/charts/Sparkline/index.ts +9 -0
- package/src/tools/visual/charts/Sparkline/lazy.tsx +26 -0
- package/src/tools/visual/charts/Sparkline/types.ts +58 -0
- package/src/tools/visual/design/ColorPalette/ColorPalette.tsx +129 -0
- package/src/tools/visual/design/ColorPalette/README.md +34 -0
- package/src/tools/visual/design/ColorPalette/components/Swatch.tsx +102 -0
- package/src/tools/visual/design/ColorPalette/hooks/useCopyToClipboard.ts +41 -0
- package/src/tools/visual/design/ColorPalette/index.ts +12 -0
- package/src/tools/visual/design/ColorPalette/lazy.tsx +21 -0
- package/src/tools/visual/design/ColorPalette/types.ts +63 -0
- package/src/tools/visual/design/ColorPalette/utils.ts +83 -0
- package/src/tools/visual/{ColorPicker → design/ColorPicker}/lazy.tsx +1 -1
- package/src/tools/visual/{FileIcon → design/FileIcon}/treeAdapter.tsx +1 -1
- package/src/tools/visual/{Fps → indicators/Fps}/lazy.tsx +1 -1
- package/src/tools/visual/{Rating → indicators/Rating}/lazy.tsx +1 -1
- package/src/tools/visual/indicators/StatusIndicator/README.md +28 -0
- package/src/tools/visual/indicators/StatusIndicator/StatusIndicator.tsx +83 -0
- package/src/tools/visual/indicators/StatusIndicator/index.ts +14 -0
- package/src/tools/visual/indicators/StatusIndicator/lazy.tsx +21 -0
- package/src/tools/visual/indicators/StatusIndicator/types.ts +133 -0
- package/src/components/FloatingToolbar/actions/CopyAction.tsx +0 -22
- package/src/components/FloatingToolbar/actions/ExpandAction.tsx +0 -25
- package/src/components/FloatingToolbar/actions/FullscreenAction.tsx +0 -30
- package/src/tools/data/JsonTree/components/JsonContent.tsx +0 -197
- package/src/tools/data/JsonTree/hooks/useJsonExpand.ts +0 -50
- /package/src/{components → common}/FloatingToolbar/FloatingToolbar.css +0 -0
- /package/src/{components → common}/FloatingToolbar/actions/index.ts +0 -0
- /package/src/{components → common}/FloatingToolbar/hooks/useElementCorner.ts +0 -0
- /package/src/{components → common}/FloatingToolbar/hooks/useScrollIsolation.ts +0 -0
- /package/src/{components → common}/index.ts +0 -0
- /package/src/{components → common}/lazy-wrapper.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/README.md +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/DocsView.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/CodeSamples/LanguageTabs.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/CodeSamples/useCodeSnippet.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Header/MetaActions.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Header/MethodBadge.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Header/PathDisplay.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Parameters/ParamGroup.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Parameters/ParamRow.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Parameters/index.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/RequestBody/index.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Responses/ResponseRow.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Responses/StatusTag.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Responses/index.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/SchemaFields/FieldRow.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/SchemaFields/buildTree.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/SchemaFields/index.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/SchemaFields/types.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Section/SectionHeader.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Section/defaults.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/Section/index.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/context.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/hooks/useSectionHash.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/index.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/store/index.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/store/selectors.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/EndpointDoc/types.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/SchemaCopyMenu.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/BrandHeader.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/CategoryBlock.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/EndpointRow.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/SchemaSection.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/SearchInput.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/SidebarBody.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/Toolbar.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/buildVM.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/index.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/types.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/Sidebar/useDebouncedValue.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/SlideInPlayground.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/TryItSheet.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/anchor.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/grouping.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/index.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/sidebarLabel.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/index.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/BodyFormEditor.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/EndpointDraftSync.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/EndpointResetButton.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/PreviewView.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/RawView.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/StatusBar.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/ViewTabs.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/detectContent.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/index.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ResponsePanel/useResponseView.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/SendButton.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/ui.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/constants.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/context/PlaygroundContext.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/hooks/index.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/hooks/useDocsUrlSync.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/hooks/useEndpointDraft.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/hooks/useMobile.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/hooks/useOpenApiSchema.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/index.tsx +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/types.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/apiKeyManager.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/codeSamples.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/formatters.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/index.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/operationToHar.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/sampler.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/schemaExport.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/scrollParent.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/url.ts +0 -0
- /package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/utils/versionManager.ts +0 -0
- /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/ActionRow.tsx +0 -0
- /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/ChatMessageRow.tsx +0 -0
- /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/CodeBlock.tsx +0 -0
- /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/README.md +0 -0
- /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/index.ts +0 -0
- /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/linkRules.ts +0 -0
- /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/plainText.ts +0 -0
- /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/sanitize.ts +0 -0
- /package/src/tools/dev/{MarkdownMessage → code/MarkdownMessage}/types.ts +0 -0
- /package/src/tools/dev/{PrettyCode → code/PrettyCode}/README.md +0 -0
- /package/src/tools/dev/{PrettyCode → code/PrettyCode}/index.tsx +0 -0
- /package/src/tools/dev/{PrettyCode → code/PrettyCode}/registerPrismLanguages.ts +0 -0
- /package/src/tools/visual/{Gauge → charts/Gauge}/Gauge.tsx +0 -0
- /package/src/tools/visual/{Gauge → charts/Gauge}/index.ts +0 -0
- /package/src/tools/visual/{Gauge → charts/Gauge}/types.ts +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/ColorPicker.tsx +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/context/ColorPickerContext.tsx +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/context/ColorPickerStore.tsx +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/context/index.ts +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/index.ts +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/lib/color-utils.ts +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerAlphaSlider.tsx +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerArea.tsx +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerEyeDropper.tsx +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerFormatSelect.tsx +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerHueSlider.tsx +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerInput.tsx +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/ColorPickerSwatch.tsx +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/parts/index.ts +0 -0
- /package/src/tools/visual/{ColorPicker → design/ColorPicker}/types.ts +0 -0
- /package/src/tools/visual/{FileIcon → design/FileIcon}/FileIcon.tsx +0 -0
- /package/src/tools/visual/{FileIcon → design/FileIcon}/get-file-icon.ts +0 -0
- /package/src/tools/visual/{FileIcon → design/FileIcon}/icons/icon-data.ts +0 -0
- /package/src/tools/visual/{FileIcon → design/FileIcon}/index.ts +0 -0
- /package/src/tools/visual/{FileIcon → design/FileIcon}/loader.ts +0 -0
- /package/src/tools/visual/{FileIcon → design/FileIcon}/specialFolders.ts +0 -0
- /package/src/tools/visual/{Fps → indicators/Fps}/Fps.tsx +0 -0
- /package/src/tools/visual/{Fps → indicators/Fps}/index.ts +0 -0
- /package/src/tools/visual/{Fps → indicators/Fps}/types.ts +0 -0
- /package/src/tools/visual/{Rating → indicators/Rating}/Rating.tsx +0 -0
- /package/src/tools/visual/{Rating → indicators/Rating}/index.ts +0 -0
- /package/src/tools/visual/{Rating → indicators/Rating}/types.ts +0 -0
|
@@ -1,89 +1,142 @@
|
|
|
1
1
|
# JsonTree
|
|
2
2
|
|
|
3
|
-
Interactive JSON
|
|
3
|
+
Interactive JSON viewer with collapsible nodes, search, copy-path, and a
|
|
4
|
+
hover-revealed toolbar (ChatGPT-style).
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
```tsx
|
|
7
|
+
import { JsonTree } from '@djangocfg/ui-tools/json-tree';
|
|
6
8
|
|
|
7
|
-
JsonTree
|
|
8
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
57
|
+
### When to override which
|
|
18
58
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
##
|
|
68
|
+
## Theme
|
|
33
69
|
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
38
|
-
|
|
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
|
-
|
|
41
|
-
<JsonTree data={myObject} mode="compact" />
|
|
79
|
+
## Search
|
|
42
80
|
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3
|
+
/** Public surface for `@djangocfg/ui-tools/json-tree`. */
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
*
|
|
4
|
+
* `@djangocfg/ui-tools/json-tree` subpath entrypoint.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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 '../../../
|
|
14
|
-
import type {
|
|
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 {
|
|
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('./
|
|
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
|
-
|
|
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
|
|
10
|
+
export type JsonValue =
|
|
11
|
+
| string
|
|
12
|
+
| number
|
|
13
|
+
| boolean
|
|
14
|
+
| null
|
|
15
|
+
| JsonValue[]
|
|
16
|
+
| { [key: string]: JsonValue };
|
|
4
17
|
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
31
|
-
|
|
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
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
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
|
-
|
|
46
|
+
toolbar?: 'auto' | 'always' | 'never';
|
|
47
|
+
|
|
39
48
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
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
|
-
|
|
46
|
-
config?: JsonTreeConfig;
|
|
47
|
-
/** Override for react-json-tree props */
|
|
48
|
-
jsonTreeProps?: Partial<CommonExternalProps>;
|
|
49
|
-
}
|
|
53
|
+
actions?: readonly JsonAction[];
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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 '../../../
|
|
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 '../../../
|
|
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 '../../../
|
|
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 '../../../
|
|
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 '../../../
|
|
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 '../../../
|
|
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 '../../../
|
|
7
|
-
import { CopyAction, FullscreenAction } from '../../../
|
|
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 '../../../
|
|
13
|
+
import { createLazyComponent, CardLoadingFallback } from '../../../common';
|
|
14
14
|
import type { MermaidProps } from './index';
|
|
15
15
|
|
|
16
16
|
// ============================================================================
|