@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
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Adapted from jalcoui (MIT) — github.com/jal-co/ui
|
|
2
|
+
//
|
|
3
|
+
// API reference / props table with per-token type colorization,
|
|
4
|
+
// expand-on-click description rows, and an optional `Default` column.
|
|
5
|
+
//
|
|
6
|
+
// Port notes:
|
|
7
|
+
// - Type-token colors map to semantic tokens (CONTRACT §2, AUDIT §6):
|
|
8
|
+
// string→success, number→warning, boolean→info, function→destructive,
|
|
9
|
+
// reactnode→info, enum→categorical (chart-3 var), nullish→muted-fg,
|
|
10
|
+
// primary→primary.
|
|
11
|
+
// - Required marker switched from a trailing `?` (optional indicator
|
|
12
|
+
// in the source) to a leading `*` in `text-destructive` for required
|
|
13
|
+
// rows; optionals keep the muted `?`.
|
|
14
|
+
// - Default-value chip is monospace on `bg-muted/40 border-border`.
|
|
15
|
+
// - No nested providers (CONTRACT §5); no motion (CONTRACT §4).
|
|
16
|
+
|
|
17
|
+
'use client';
|
|
18
|
+
|
|
19
|
+
import * as React from 'react';
|
|
20
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
21
|
+
import type { ApiRefTableProps } from './types';
|
|
22
|
+
import { Row } from './components/Row';
|
|
23
|
+
|
|
24
|
+
export function ApiRefTable({
|
|
25
|
+
title,
|
|
26
|
+
props: rows,
|
|
27
|
+
nameLabel = 'Prop',
|
|
28
|
+
showDefaults,
|
|
29
|
+
emptyMessage = 'No parameters.',
|
|
30
|
+
className,
|
|
31
|
+
...rest
|
|
32
|
+
}: ApiRefTableProps) {
|
|
33
|
+
const showDefault = showDefaults ?? rows.some((r) => r.defaultValue != null);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
data-slot="api-ref-table"
|
|
38
|
+
className={cn(
|
|
39
|
+
'overflow-hidden rounded-xl border border-border bg-card shadow-sm',
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
{...rest}
|
|
43
|
+
>
|
|
44
|
+
{title && (
|
|
45
|
+
<div className="border-b border-border/40 px-4 py-3">
|
|
46
|
+
<h3 className="text-lg font-semibold tracking-tight text-foreground">{title}</h3>
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
49
|
+
<div className="flex items-center gap-4 border-b border-border/40 bg-muted/40 px-4 py-2.5 text-sm font-medium text-muted-foreground">
|
|
50
|
+
<span className="min-w-[180px] shrink-0">{nameLabel}</span>
|
|
51
|
+
<span className="flex-1 min-w-0">Type</span>
|
|
52
|
+
{showDefault && <span className="min-w-[100px] shrink-0">Default</span>}
|
|
53
|
+
{/* spacer matching the chevron column to keep header cells aligned */}
|
|
54
|
+
<span className="size-4 shrink-0" aria-hidden="true" />
|
|
55
|
+
</div>
|
|
56
|
+
{rows.length === 0 ? (
|
|
57
|
+
<div className="px-4 py-6 text-center text-sm text-muted-foreground">
|
|
58
|
+
{emptyMessage}
|
|
59
|
+
</div>
|
|
60
|
+
) : (
|
|
61
|
+
rows.map((prop) => <Row key={prop.name} prop={prop} showDefault={showDefault} />)
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# ApiRefTable
|
|
2
|
+
|
|
3
|
+
Reference table for component props / function parameters. Per-token type colorization, optional default column, click-to-expand description + long-form type.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { ApiRefTable } from '@djangocfg/ui-tools/api-ref-table';
|
|
7
|
+
|
|
8
|
+
<ApiRefTable
|
|
9
|
+
title="ButtonProps"
|
|
10
|
+
props={[
|
|
11
|
+
{ name: 'variant', type: "'solid' | 'outline'", defaultValue: "'solid'", description: 'Visual variant.' },
|
|
12
|
+
{ name: 'onClick', type: '(e: MouseEvent) => void', required: true },
|
|
13
|
+
]}
|
|
14
|
+
/>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|---|---|---|---|
|
|
21
|
+
| `props` | `ApiProp[]` | — | Rows. Each row: `{ name, type, required?, defaultValue?, description?, fullType? }`. |
|
|
22
|
+
| `title` | `string` | — | Heading above the column strip. |
|
|
23
|
+
| `nameLabel` | `string` | `'Prop'` | Leftmost column header (e.g. `'Param'`, `'Field'`). |
|
|
24
|
+
| `showDefaults` | `boolean` | auto | Render the `Default` column. Auto when any row has `defaultValue`. |
|
|
25
|
+
| `emptyMessage` | `string` | `'No parameters.'` | Empty state. |
|
|
26
|
+
|
|
27
|
+
Storybook: `apps/storybook/stories/ui-tools/dev/ApiRefTable.stories.tsx`
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
Adapted from jalcoui (MIT).
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Adapted from jalcoui (MIT) — github.com/jal-co/ui
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
7
|
+
import type { ApiProp } from '../types';
|
|
8
|
+
import { TypeDisplay } from './TypeDisplay';
|
|
9
|
+
|
|
10
|
+
interface RowProps {
|
|
11
|
+
prop: ApiProp;
|
|
12
|
+
showDefault: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Single parameter row. Click to expand `description` / `fullType` when
|
|
17
|
+
* either is present; otherwise the button is rendered disabled so the
|
|
18
|
+
* row stays keyboard-accessible but doesn't pretend to be interactive.
|
|
19
|
+
*/
|
|
20
|
+
export function Row({ prop, showDefault }: RowProps) {
|
|
21
|
+
const [open, setOpen] = React.useState(false);
|
|
22
|
+
const hasDetails = Boolean(prop.description || prop.fullType);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="border-b border-border/40 last:border-b-0" data-slot="api-ref-row">
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
onClick={() => hasDetails && setOpen((v) => !v)}
|
|
29
|
+
disabled={!hasDetails}
|
|
30
|
+
className={cn(
|
|
31
|
+
'flex w-full items-center gap-4 px-4 py-3 text-left transition-colors',
|
|
32
|
+
hasDetails && 'cursor-pointer hover:bg-muted/30',
|
|
33
|
+
!hasDetails && 'cursor-default',
|
|
34
|
+
)}
|
|
35
|
+
aria-expanded={hasDetails ? open : undefined}
|
|
36
|
+
>
|
|
37
|
+
<span className="min-w-[180px] shrink-0 font-mono text-sm">
|
|
38
|
+
<span className="text-foreground">{prop.name}</span>
|
|
39
|
+
{prop.required ? (
|
|
40
|
+
<span className="ml-0.5 text-destructive" aria-label="required">
|
|
41
|
+
*
|
|
42
|
+
</span>
|
|
43
|
+
) : (
|
|
44
|
+
<span className="text-muted-foreground" aria-hidden="true">
|
|
45
|
+
?
|
|
46
|
+
</span>
|
|
47
|
+
)}
|
|
48
|
+
</span>
|
|
49
|
+
<span className="flex-1 min-w-0">
|
|
50
|
+
<TypeDisplay type={prop.type} />
|
|
51
|
+
</span>
|
|
52
|
+
{showDefault && (
|
|
53
|
+
<code
|
|
54
|
+
className={cn(
|
|
55
|
+
'min-w-[100px] shrink-0 font-mono text-xs',
|
|
56
|
+
prop.defaultValue ? 'text-foreground' : 'text-muted-foreground',
|
|
57
|
+
)}
|
|
58
|
+
data-slot="api-ref-default"
|
|
59
|
+
>
|
|
60
|
+
{prop.defaultValue ?? '—'}
|
|
61
|
+
</code>
|
|
62
|
+
)}
|
|
63
|
+
{hasDetails && (
|
|
64
|
+
<svg
|
|
65
|
+
viewBox="0 0 24 24"
|
|
66
|
+
fill="none"
|
|
67
|
+
stroke="currentColor"
|
|
68
|
+
strokeWidth={2}
|
|
69
|
+
strokeLinecap="round"
|
|
70
|
+
strokeLinejoin="round"
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
className={cn(
|
|
73
|
+
'size-4 shrink-0 text-muted-foreground transition-transform',
|
|
74
|
+
open && 'rotate-180',
|
|
75
|
+
)}
|
|
76
|
+
>
|
|
77
|
+
<path d="m6 9 6 6 6-6" />
|
|
78
|
+
</svg>
|
|
79
|
+
)}
|
|
80
|
+
</button>
|
|
81
|
+
{open && hasDetails && (
|
|
82
|
+
<div className="space-y-2 border-t border-border/30 bg-muted/20 px-4 py-3">
|
|
83
|
+
{prop.description && (
|
|
84
|
+
<p className="text-sm text-muted-foreground">{prop.description}</p>
|
|
85
|
+
)}
|
|
86
|
+
{prop.fullType && (
|
|
87
|
+
<div className="flex items-baseline gap-6">
|
|
88
|
+
<span className="shrink-0 text-sm text-muted-foreground">Type</span>
|
|
89
|
+
<TypeDisplay type={prop.fullType} />
|
|
90
|
+
</div>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
)}
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Adapted from jalcoui (MIT) — github.com/jal-co/ui
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
7
|
+
import { TYPE_TAG_CLASSES } from '../types';
|
|
8
|
+
import { classifyTypeToken, splitTypeSignature } from '../utils';
|
|
9
|
+
|
|
10
|
+
interface TypeDisplayProps {
|
|
11
|
+
type: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Render a type signature with per-token semantic colorization. Splits
|
|
17
|
+
* on `|`, classifies each token via {@link classifyTypeToken}, and maps
|
|
18
|
+
* the classification to a semantic `text-*` token from
|
|
19
|
+
* {@link TYPE_TAG_CLASSES}.
|
|
20
|
+
*/
|
|
21
|
+
export function TypeDisplay({ type, className }: TypeDisplayProps) {
|
|
22
|
+
const parts = React.useMemo(() => splitTypeSignature(type), [type]);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<span className={cn('font-mono text-sm', className)} data-slot="api-ref-type">
|
|
26
|
+
{parts.map((part, i) => {
|
|
27
|
+
const trimmed = part.trim();
|
|
28
|
+
if (trimmed === '|') {
|
|
29
|
+
return (
|
|
30
|
+
<span key={i} className="text-muted-foreground">
|
|
31
|
+
{' | '}
|
|
32
|
+
</span>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
const tag = classifyTypeToken(trimmed);
|
|
36
|
+
return (
|
|
37
|
+
<span key={i} className={TYPE_TAG_CLASSES[tag]} data-type-tag={tag}>
|
|
38
|
+
{trimmed}
|
|
39
|
+
</span>
|
|
40
|
+
);
|
|
41
|
+
})}
|
|
42
|
+
</span>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Adapted from jalcoui (MIT) — github.com/jal-co/ui
|
|
2
|
+
|
|
3
|
+
export { ApiRefTable } from './ApiRefTable';
|
|
4
|
+
export { TYPE_TAG_CLASSES } from './types';
|
|
5
|
+
export { classifyTypeToken, splitTypeSignature } from './utils';
|
|
6
|
+
export type { ApiProp, ApiRefTableProps, TypeTag } from './types';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Adapted from jalcoui (MIT) — github.com/jal-co/ui
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import { createLazyComponent } from '../../../../common/lazy-wrapper';
|
|
6
|
+
import type { ApiRefTableProps } from './types';
|
|
7
|
+
|
|
8
|
+
export const LazyApiRefTable = createLazyComponent<ApiRefTableProps>(
|
|
9
|
+
() => import('./ApiRefTable').then((mod) => ({ default: mod.ApiRefTable })),
|
|
10
|
+
{
|
|
11
|
+
displayName: 'LazyApiRefTable',
|
|
12
|
+
fallback: (
|
|
13
|
+
<div
|
|
14
|
+
data-slot="api-ref-table-skeleton"
|
|
15
|
+
className="h-48 w-full animate-pulse rounded-xl border border-border bg-muted"
|
|
16
|
+
/>
|
|
17
|
+
),
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export type { ApiRefTableProps, ApiProp, TypeTag } from './types';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Adapted from jalcoui (MIT) — github.com/jal-co/ui
|
|
2
|
+
|
|
3
|
+
import type * as React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Single parameter / prop entry rendered as one row of the table.
|
|
7
|
+
*
|
|
8
|
+
* The minimum required shape is `{ name, type }`. Everything else is
|
|
9
|
+
* optional metadata that toggles UI affordances:
|
|
10
|
+
*
|
|
11
|
+
* - `required` — when `false` (or omitted), the name is rendered with a
|
|
12
|
+
* trailing `?` muted marker. When `true`, a `*` in `text-destructive`
|
|
13
|
+
* marks the row.
|
|
14
|
+
* - `defaultValue` — surfaces a `Default` column cell rendered in
|
|
15
|
+
* `font-mono` on a `bg-muted/40` chip.
|
|
16
|
+
* - `description` / `fullType` — expand-on-click body. The row is only
|
|
17
|
+
* interactive when at least one of these is present.
|
|
18
|
+
*/
|
|
19
|
+
export interface ApiProp {
|
|
20
|
+
/** Prop / parameter identifier (left column). */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Compact type signature, e.g. `string | number`. Rendered with per-token colorization. */
|
|
23
|
+
type: string;
|
|
24
|
+
/** When `true`, mark as required with a `*` destructive marker. Defaults to `false`. */
|
|
25
|
+
required?: boolean;
|
|
26
|
+
/** Default value, shown in a monospace chip. */
|
|
27
|
+
defaultValue?: string;
|
|
28
|
+
/** Short description, shown in the expanded body. */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Long/expanded type signature, shown in the expanded body. */
|
|
31
|
+
fullType?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Semantic tag for a single type token (the bits between `|` separators).
|
|
36
|
+
* Maps to a `text-*` semantic token in {@link TYPE_TAG_CLASSES}.
|
|
37
|
+
*/
|
|
38
|
+
export type TypeTag =
|
|
39
|
+
| 'string'
|
|
40
|
+
| 'number'
|
|
41
|
+
| 'boolean'
|
|
42
|
+
| 'function'
|
|
43
|
+
| 'reactnode'
|
|
44
|
+
| 'enum'
|
|
45
|
+
| 'nullish'
|
|
46
|
+
| 'primary'
|
|
47
|
+
| 'other';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Tailwind classes per type-tag. All resolve to semantic / categorical
|
|
51
|
+
* tokens — never raw color scales (CONTRACT §2, AUDIT §6).
|
|
52
|
+
*
|
|
53
|
+
* `enum` routes through the `chart-3` CSS variable so it follows the
|
|
54
|
+
* active theme preset's categorical palette rather than a status color.
|
|
55
|
+
*/
|
|
56
|
+
export const TYPE_TAG_CLASSES: Record<TypeTag, string> = {
|
|
57
|
+
string: 'text-success',
|
|
58
|
+
number: 'text-warning',
|
|
59
|
+
boolean: 'text-info',
|
|
60
|
+
function: 'text-destructive',
|
|
61
|
+
reactnode: 'text-info',
|
|
62
|
+
enum: 'text-[hsl(var(--chart-3))]',
|
|
63
|
+
nullish: 'text-muted-foreground',
|
|
64
|
+
primary: 'text-primary',
|
|
65
|
+
other: 'text-success',
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export interface ApiRefTableProps extends Omit<React.ComponentProps<'div'>, 'children'> {
|
|
69
|
+
/** Heading rendered above the column header strip. */
|
|
70
|
+
title?: string;
|
|
71
|
+
/** Parameter / prop rows. */
|
|
72
|
+
props: ApiProp[];
|
|
73
|
+
/**
|
|
74
|
+
* Label for the leftmost column header. Defaults to `Prop`.
|
|
75
|
+
* Override for non-React contexts ("Param", "Field", "Argument").
|
|
76
|
+
*/
|
|
77
|
+
nameLabel?: string;
|
|
78
|
+
/** Render the `Default` column. Defaults to `true` when any row has a `defaultValue`. */
|
|
79
|
+
showDefaults?: boolean;
|
|
80
|
+
/** Message shown when `props` is empty. Defaults to `No parameters.`. */
|
|
81
|
+
emptyMessage?: string;
|
|
82
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Adapted from jalcoui (MIT) — github.com/jal-co/ui
|
|
2
|
+
|
|
3
|
+
import type { TypeTag } from './types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Classify a single type token (e.g. `string`, `number[]`, `MyType<X>`,
|
|
7
|
+
* `null`) into a semantic {@link TypeTag}. The classification is
|
|
8
|
+
* intentionally loose — it only sees the bare token and ignores generic
|
|
9
|
+
* parameters / array brackets / optional `?`.
|
|
10
|
+
*/
|
|
11
|
+
export function classifyTypeToken(token: string): TypeTag {
|
|
12
|
+
const base = token.replace(/[[\]?]/g, '').split('<')[0].trim().toLowerCase();
|
|
13
|
+
|
|
14
|
+
if (!base) return 'other';
|
|
15
|
+
if (base === 'string') return 'string';
|
|
16
|
+
if (base === 'number' || base === 'bigint') return 'number';
|
|
17
|
+
if (base === 'boolean' || base === 'true' || base === 'false') return 'boolean';
|
|
18
|
+
if (base === 'function' || base === '() => void' || base.endsWith('=> void')) return 'function';
|
|
19
|
+
if (base === 'reactnode' || base === 'react.reactnode' || base === 'jsx.element' || base === 'reactelement') {
|
|
20
|
+
return 'reactnode';
|
|
21
|
+
}
|
|
22
|
+
if (base === 'null' || base === 'undefined' || base === 'void' || base === 'never') {
|
|
23
|
+
return 'nullish';
|
|
24
|
+
}
|
|
25
|
+
// String literal like `"foo"` or `'bar'` → enum-ish categorical.
|
|
26
|
+
if ((base.startsWith('"') && base.endsWith('"')) || (base.startsWith("'") && base.endsWith("'"))) {
|
|
27
|
+
return 'enum';
|
|
28
|
+
}
|
|
29
|
+
// Numeric literal → also categorical (discriminated unions).
|
|
30
|
+
if (/^-?\d+(\.\d+)?$/.test(base)) return 'enum';
|
|
31
|
+
|
|
32
|
+
return 'other';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Split a compound type signature on `|` separators, preserving the
|
|
37
|
+
* separator tokens so the renderer can colorize the divider with the
|
|
38
|
+
* muted foreground.
|
|
39
|
+
*/
|
|
40
|
+
export function splitTypeSignature(type: string): string[] {
|
|
41
|
+
return type.split(/(\s*\|\s*)/).filter((part) => part.length > 0);
|
|
42
|
+
}
|
package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/DocsLayout/ApiIntroSection.tsx
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
|
-
import { MarkdownMessage } from '
|
|
5
|
+
import { MarkdownMessage } from '../../../../code/MarkdownMessage';
|
|
6
6
|
import type { ApiEndpoint, OpenApiInfo, OpenApiSchema } from '../../types';
|
|
7
7
|
import { SchemaCopyMenu } from './SchemaCopyMenu';
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import PrettyCode from '
|
|
3
|
+
import PrettyCode from '../../../../../../code/PrettyCode';
|
|
4
4
|
import type { ApiEndpoint } from '../../../../types';
|
|
5
5
|
import { useEndpointDocContext } from '../context';
|
|
6
6
|
import { useEndpointDocStore } from '../store';
|
|
@@ -5,7 +5,7 @@ import React, { useCallback, useMemo, useState } from 'react';
|
|
|
5
5
|
|
|
6
6
|
import { Button } from '@djangocfg/ui-core/components';
|
|
7
7
|
|
|
8
|
-
import { MarkdownMessage } from '
|
|
8
|
+
import { MarkdownMessage } from '../../../../../../code/MarkdownMessage';
|
|
9
9
|
import type { ApiEndpoint } from '../../../../types';
|
|
10
10
|
import { endpointToMarkdown } from '../../../../utils/schemaExport';
|
|
11
11
|
import type { SectionId } from '../types';
|
|
@@ -4,24 +4,7 @@ import { useMemo } from 'react';
|
|
|
4
4
|
|
|
5
5
|
import { CopyButton } from '@djangocfg/ui-core/components';
|
|
6
6
|
|
|
7
|
-
import JsonTree from '
|
|
8
|
-
|
|
9
|
-
// Compact, read-only JsonTree config. Docs longread is space-constrained
|
|
10
|
-
// so we ship less chrome than the interactive ``ResponsePanel`` — copy
|
|
11
|
-
// button lives outside the tree (on the row header) and collection-info
|
|
12
|
-
// stays on so long arrays don't silently truncate.
|
|
13
|
-
const EXAMPLE_JSON_TREE_CONFIG = {
|
|
14
|
-
maxAutoExpandDepth: 2,
|
|
15
|
-
maxAutoExpandArrayItems: 5,
|
|
16
|
-
maxAutoExpandObjectKeys: 8,
|
|
17
|
-
maxStringLength: 160,
|
|
18
|
-
collectionLimit: 25,
|
|
19
|
-
showCollectionInfo: true,
|
|
20
|
-
showExpandControls: false,
|
|
21
|
-
showActionButtons: false,
|
|
22
|
-
preserveKeyOrder: true,
|
|
23
|
-
className: 'border-0 rounded-none',
|
|
24
|
-
} as const;
|
|
7
|
+
import { JsonTree } from '../../../../../../../data/JsonTree';
|
|
25
8
|
|
|
26
9
|
interface ResponseBodyProps {
|
|
27
10
|
example: string;
|
|
@@ -60,11 +43,14 @@ export function ResponseBody({ example, contentType }: ResponseBodyProps) {
|
|
|
60
43
|
</CopyButton>
|
|
61
44
|
</div>
|
|
62
45
|
{parsed != null ? (
|
|
46
|
+
// Docs longread is space-constrained: no toolbar (Copy
|
|
47
|
+
// lives on the row header above), no border (host owns
|
|
48
|
+
// it), shallow auto-expand.
|
|
63
49
|
<JsonTree
|
|
64
|
-
title=""
|
|
65
50
|
data={parsed}
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
toolbar="never"
|
|
52
|
+
bordered={false}
|
|
53
|
+
defaultExpandedDepth={1}
|
|
68
54
|
/>
|
|
69
55
|
) : (
|
|
70
56
|
<pre className="p-3 text-[11px] font-mono text-foreground/70 whitespace-pre-wrap break-all leading-relaxed">
|
package/src/tools/dev/{OpenapiViewer → api/OpenapiViewer}/components/shared/RequestPanel.tsx
RENAMED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@djangocfg/ui-core/components';
|
|
12
12
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
13
13
|
|
|
14
|
-
import PrettyCode from '
|
|
14
|
+
import PrettyCode from '../../../../code/PrettyCode';
|
|
15
15
|
import { usePlaygroundContext } from '../../context/PlaygroundContext';
|
|
16
16
|
import { findApiKeyById, isValidJson, parseRequestHeaders } from '../../utils';
|
|
17
17
|
import { resolveAbsolute } from '../../utils/url';
|
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import JsonTree from '
|
|
4
|
-
import PrettyCode from '
|
|
3
|
+
import { JsonTree } from '../../../../../../data/JsonTree';
|
|
4
|
+
import PrettyCode from '../../../../../code/PrettyCode';
|
|
5
5
|
import type { DetectedContent } from './types';
|
|
6
6
|
|
|
7
|
-
// JsonTree config — same shape as the interactive docs example view
|
|
8
|
-
// but with ``showActionButtons: false`` because the copy button in the
|
|
9
|
-
// StatusBar already covers that flow.
|
|
10
|
-
const JSON_TREE_CONFIG = {
|
|
11
|
-
maxAutoExpandDepth: 2,
|
|
12
|
-
maxAutoExpandArrayItems: 10,
|
|
13
|
-
maxAutoExpandObjectKeys: 5,
|
|
14
|
-
maxStringLength: 200,
|
|
15
|
-
collectionLimit: 50,
|
|
16
|
-
showCollectionInfo: true,
|
|
17
|
-
showExpandControls: true,
|
|
18
|
-
showActionButtons: false,
|
|
19
|
-
preserveKeyOrder: true,
|
|
20
|
-
className: 'border-0 rounded-none',
|
|
21
|
-
} as const;
|
|
22
|
-
|
|
23
7
|
interface PrettyViewProps {
|
|
24
8
|
/** Parsed JSON tree when the body was JSON. */
|
|
25
9
|
treeData: unknown;
|
|
@@ -35,7 +19,17 @@ interface PrettyViewProps {
|
|
|
35
19
|
* scroll, no floating toolbar fighting the surrounding layout. */
|
|
36
20
|
export function PrettyView({ treeData, rawText, detected }: PrettyViewProps) {
|
|
37
21
|
if (detected.kind === 'json' && treeData != null) {
|
|
38
|
-
|
|
22
|
+
// StatusBar already exposes "Copy", so we drop the action from
|
|
23
|
+
// the toolbar — only expand/search remain. `bordered={false}` +
|
|
24
|
+
// host pane owns the frame.
|
|
25
|
+
return (
|
|
26
|
+
<JsonTree
|
|
27
|
+
title="Response Body"
|
|
28
|
+
data={treeData}
|
|
29
|
+
actions={['search', 'expand']}
|
|
30
|
+
bordered={false}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
39
33
|
}
|
|
40
34
|
if (!rawText) {
|
|
41
35
|
return (
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { createLazyComponent } from '
|
|
14
|
+
import { createLazyComponent } from '../../../../common';
|
|
15
15
|
import { PlaygroundProvider } from './context/PlaygroundContext';
|
|
16
16
|
import type { ApiKey, PlaygroundConfig, SchemaSource } from './types';
|
|
17
17
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# RequestViewer
|
|
2
|
+
|
|
3
|
+
HTTP request inspector. Tabs for headers / body / timing. Method + status pills routed through `lib/http` (`statusColor`, `methodColor`) so colors match OpenapiViewer.
|
|
4
|
+
|
|
5
|
+
The viewer never fetches — pass an already-executed `NetworkRequest`.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { RequestViewer } from '@djangocfg/ui-tools/request-viewer';
|
|
9
|
+
|
|
10
|
+
<RequestViewer
|
|
11
|
+
request={{
|
|
12
|
+
method: 'POST',
|
|
13
|
+
url: 'https://api.example.com/v1/users',
|
|
14
|
+
status: 201,
|
|
15
|
+
requestHeaders: [{ name: 'Content-Type', value: 'application/json' }],
|
|
16
|
+
responseBody: '{"id":"u_42"}',
|
|
17
|
+
duration: 142,
|
|
18
|
+
}}
|
|
19
|
+
/>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
|---|---|---|---|
|
|
26
|
+
| `request` | `NetworkRequest` | — | Captured request: `method`, `url`, `status`, headers, body, timing, etc. |
|
|
27
|
+
| `defaultTab` | `'headers' \| 'body' \| 'timing'` | `'headers'` | Initial active tab. |
|
|
28
|
+
|
|
29
|
+
Storybook: `apps/storybook/stories/ui-tools/dev/RequestViewer.stories.tsx`
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
Adapted from jalcoui (MIT).
|