@deepseek-ai/dsh-client-ui-primitives 0.2.3-alpha.2 → 0.2.3-alpha.3
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/README.i18n.yaml +14 -14
- package/README.md +20 -19
- package/README.zh.md +20 -19
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_AMS-Regular-34494743736f.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Caligraphic-Bold-5bfa49cac46c.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Caligraphic-Regular-9f8077e0b38a.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Fraktur-Bold-f98f89272eca.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Fraktur-Regular-a5764c6e2784.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Main-Bold-31050a1b1b12.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Main-BoldItalic-a4a4905b8b12.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Main-Italic-c9b2b5ffd2f2.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Main-Regular-c884086c25ce.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Math-BoldItalic-8fcb9d2de65a.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Math-Italic-db4883d0cff9.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_SansSerif-Bold-886e61797a52.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_SansSerif-Italic-3d5fa3cb309f.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_SansSerif-Regular-e45d5f4f4a7f.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Script-Regular-63b80959f1fc.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Size1-Regular-57fa599974a1.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Size2-Regular-ee18713634a3.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Size3-Regular-19a7caadfb66.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Size4-Regular-9bed17fb92f2.woff2 +0 -0
- package/lib/assets/vendor/katex/dist/fonts/KaTeX_Typewriter-Regular-7a08883fffc6.woff2 +0 -0
- package/lib/client.asciidoc.js +3 -0
- package/lib/client.asciidoc.js.map +1 -0
- package/lib/client.bat.js +3 -0
- package/lib/client.bat.js.map +1 -0
- package/lib/client.bibtex.js +3 -0
- package/lib/client.bibtex.js.map +1 -0
- package/lib/client.c.js +3 -0
- package/lib/client.c.js.map +1 -0
- package/lib/client.clojure.js +3 -0
- package/lib/client.clojure.js.map +1 -0
- package/lib/client.cmake.js +3 -0
- package/lib/client.cmake.js.map +1 -0
- package/lib/client.cpp.js +3 -0
- package/lib/client.cpp.js.map +1 -0
- package/lib/client.csharp.js +3 -0
- package/lib/client.csharp.js.map +1 -0
- package/lib/client.css.js +3 -0
- package/lib/client.css.js.map +1 -0
- package/lib/client.csv.js +3 -0
- package/lib/client.csv.js.map +1 -0
- package/lib/client.dart.js +3 -0
- package/lib/client.dart.js.map +1 -0
- package/lib/client.diff.js +3 -0
- package/lib/client.diff.js.map +1 -0
- package/lib/client.dotenv.js +3 -0
- package/lib/client.dotenv.js.map +1 -0
- package/lib/client.elixir.js +3 -0
- package/lib/client.elixir.js.map +1 -0
- package/lib/client.erlang.js +3 -0
- package/lib/client.erlang.js.map +1 -0
- package/lib/client.fish.js +3 -0
- package/lib/client.fish.js.map +1 -0
- package/lib/client.fsharp.js +3 -0
- package/lib/client.fsharp.js.map +1 -0
- package/lib/client.go.js +3 -0
- package/lib/client.go.js.map +1 -0
- package/lib/client.graphql.js +3 -0
- package/lib/client.graphql.js.map +1 -0
- package/lib/client.groovy.js +3 -0
- package/lib/client.groovy.js.map +1 -0
- package/lib/client.haskell.js +3 -0
- package/lib/client.haskell.js.map +1 -0
- package/lib/client.hcl.js +3 -0
- package/lib/client.hcl.js.map +1 -0
- package/lib/client.html-derivative.js +3 -0
- package/lib/client.html-derivative.js.map +1 -0
- package/lib/client.html.js +3 -0
- package/lib/client.html.js.map +1 -0
- package/lib/client.http.js +3 -0
- package/lib/client.http.js.map +1 -0
- package/lib/client.ini.js +3 -0
- package/lib/client.ini.js.map +1 -0
- package/lib/client.java.js +3 -0
- package/lib/client.java.js.map +1 -0
- package/lib/client.javascript.js +3 -0
- package/lib/client.javascript.js.map +1 -0
- package/lib/client.js +489 -0
- package/lib/client.js.map +1 -0
- package/lib/client.julia.js +3 -0
- package/lib/client.julia.js.map +1 -0
- package/lib/client.kotlin.js +3 -0
- package/lib/client.kotlin.js.map +1 -0
- package/lib/client.latex.js +3 -0
- package/lib/client.latex.js.map +1 -0
- package/lib/client.less.js +3 -0
- package/lib/client.less.js.map +1 -0
- package/lib/client.log.js +3 -0
- package/lib/client.log.js.map +1 -0
- package/lib/client.lua.js +3 -0
- package/lib/client.lua.js.map +1 -0
- package/lib/client.make.js +3 -0
- package/lib/client.make.js.map +1 -0
- package/lib/client.markdown.js +3 -0
- package/lib/client.markdown.js.map +1 -0
- package/lib/client.mdx.js +3 -0
- package/lib/client.mdx.js.map +1 -0
- package/lib/client.nix.js +3 -0
- package/lib/client.nix.js.map +1 -0
- package/lib/client.perl.js +3 -0
- package/lib/client.perl.js.map +1 -0
- package/lib/client.php.js +3 -0
- package/lib/client.php.js.map +1 -0
- package/lib/client.powershell.js +3 -0
- package/lib/client.powershell.js.map +1 -0
- package/lib/client.proto.js +3 -0
- package/lib/client.proto.js.map +1 -0
- package/lib/client.python.js +3 -0
- package/lib/client.python.js.map +1 -0
- package/lib/client.r.js +3 -0
- package/lib/client.r.js.map +1 -0
- package/lib/client.rst.js +3 -0
- package/lib/client.rst.js.map +1 -0
- package/lib/client.ruby.js +3 -0
- package/lib/client.ruby.js.map +1 -0
- package/lib/client.rust.js +3 -0
- package/lib/client.rust.js.map +1 -0
- package/lib/client.scala.js +3 -0
- package/lib/client.scala.js.map +1 -0
- package/lib/client.scss.js +3 -0
- package/lib/client.scss.js.map +1 -0
- package/lib/client.sql.js +3 -0
- package/lib/client.sql.js.map +1 -0
- package/lib/client.svelte.js +3 -0
- package/lib/client.svelte.js.map +1 -0
- package/lib/client.swift.js +3 -0
- package/lib/client.swift.js.map +1 -0
- package/lib/client.system-verilog.js +3 -0
- package/lib/client.system-verilog.js.map +1 -0
- package/lib/client.toml.js +3 -0
- package/lib/client.toml.js.map +1 -0
- package/lib/client.vb.js +3 -0
- package/lib/client.vb.js.map +1 -0
- package/lib/client.verilog.js +3 -0
- package/lib/client.verilog.js.map +1 -0
- package/lib/client.vue.js +3 -0
- package/lib/client.vue.js.map +1 -0
- package/lib/client.xml.js +3 -0
- package/lib/client.xml.js.map +1 -0
- package/lib/client.yaml.js +3 -0
- package/lib/client.yaml.js.map +1 -0
- package/lib/index.js +10 -14594
- package/lib/types/client/AnimatedRows.d.ts.map +1 -0
- package/lib/types/client/AnimatedRows.js.map +1 -0
- package/lib/types/client/BrandWordmark.d.ts.map +1 -0
- package/lib/types/client/BrandWordmark.js.map +1 -0
- package/lib/types/client/Button.d.ts.map +1 -0
- package/lib/types/client/Button.js.map +1 -0
- package/lib/types/client/Checkbox.d.ts.map +1 -0
- package/lib/types/client/Checkbox.js.map +1 -0
- package/lib/types/client/CodeFileIcon.d.ts.map +1 -0
- package/lib/types/client/CodeFileIcon.js.map +1 -0
- package/lib/types/client/CodeToolbar.d.ts.map +1 -0
- package/lib/types/client/CodeToolbar.js.map +1 -0
- package/lib/types/client/CommandText.d.ts.map +1 -0
- package/lib/types/client/CommandText.js.map +1 -0
- package/lib/types/client/ConfigField.d.ts.map +1 -0
- package/lib/types/client/ConfigField.js.map +1 -0
- package/lib/types/client/ConnectionIndicator.d.ts.map +1 -0
- package/lib/types/client/ConnectionIndicator.js.map +1 -0
- package/lib/types/client/DetailDocument.d.ts.map +1 -0
- package/lib/types/client/DetailDocument.js.map +1 -0
- package/lib/types/client/DiffBlock.d.ts.map +1 -0
- package/lib/types/client/DiffBlock.js.map +1 -0
- package/lib/types/client/DisclosureRow.d.ts.map +1 -0
- package/lib/types/client/DisclosureRow.js.map +1 -0
- package/lib/types/client/DraggableImage.d.ts.map +1 -0
- package/lib/types/client/DraggableImage.js.map +1 -0
- package/lib/types/client/FileTypeIcon.d.ts.map +1 -0
- package/lib/types/client/FileTypeIcon.js.map +1 -0
- package/lib/types/client/FishLogo.d.ts.map +1 -0
- package/lib/types/client/FishLogo.js.map +1 -0
- package/lib/types/client/FoldToggle.d.ts.map +1 -0
- package/lib/types/client/FoldToggle.js.map +1 -0
- package/lib/types/client/HoverCard.d.ts.map +1 -0
- package/lib/types/client/HoverCard.js.map +1 -0
- package/lib/types/client/HoverCardGroup.d.ts.map +1 -0
- package/lib/types/client/HoverCardGroup.js.map +1 -0
- package/lib/types/client/ImageLightbox.d.ts.map +1 -0
- package/lib/types/client/ImageLightbox.js.map +1 -0
- package/lib/types/client/ImagePreview.d.ts.map +1 -0
- package/lib/types/client/ImagePreview.js.map +1 -0
- package/lib/types/client/InlineEditor.d.ts.map +1 -0
- package/lib/types/client/InlineEditor.js.map +1 -0
- package/lib/types/client/Input.d.ts.map +1 -0
- package/lib/types/client/Input.js.map +1 -0
- package/lib/types/client/InspectButton.d.ts +18 -0
- package/lib/types/client/InspectButton.d.ts.map +1 -0
- package/lib/types/client/InspectButton.js.map +1 -0
- package/lib/types/client/JsonTree.d.ts.map +1 -0
- package/lib/types/client/JsonTree.js.map +1 -0
- package/lib/types/client/LinkIcon.d.ts.map +1 -0
- package/lib/types/client/LinkIcon.js.map +1 -0
- package/lib/types/client/Marquee.d.ts.map +1 -0
- package/lib/types/client/Marquee.js.map +1 -0
- package/lib/types/client/Menu.d.ts.map +1 -0
- package/lib/types/client/Menu.js.map +1 -0
- package/lib/types/client/MenuGroup.d.ts.map +1 -0
- package/lib/types/client/MenuGroup.js.map +1 -0
- package/lib/types/client/MenuRow.d.ts.map +1 -0
- package/lib/types/client/MenuRow.js.map +1 -0
- package/lib/types/client/MenuSurface.d.ts.map +1 -0
- package/lib/types/client/MenuSurface.js.map +1 -0
- package/lib/types/client/Modal.d.ts.map +1 -0
- package/lib/types/client/Modal.js.map +1 -0
- package/lib/types/client/PathLabel.d.ts.map +1 -0
- package/lib/types/client/PathLabel.js.map +1 -0
- package/lib/types/client/PermissionIcon.d.ts.map +1 -0
- package/lib/types/client/PermissionIcon.js.map +1 -0
- package/lib/types/client/Pill.d.ts.map +1 -0
- package/lib/types/client/Pill.js.map +1 -0
- package/lib/types/client/QuotePreview.d.ts +38 -0
- package/lib/types/client/QuotePreview.d.ts.map +1 -0
- package/lib/types/client/QuotePreview.js.map +1 -0
- package/lib/types/client/ReadBlock.d.ts.map +1 -0
- package/lib/types/client/ReadBlock.js.map +1 -0
- package/lib/types/client/ReferenceIcon.d.ts.map +1 -0
- package/lib/types/client/ReferenceIcon.js.map +1 -0
- package/lib/types/client/RiskConfirmation.d.ts.map +1 -0
- package/lib/types/client/RiskConfirmation.js.map +1 -0
- package/lib/types/client/SearchBlock.d.ts.map +1 -0
- package/lib/types/client/SearchBlock.js.map +1 -0
- package/lib/types/client/SearchField.d.ts.map +1 -0
- package/lib/types/client/SearchField.js.map +1 -0
- package/lib/types/client/SegmentedControl.d.ts.map +1 -0
- package/lib/types/client/SegmentedControl.js.map +1 -0
- package/lib/types/client/SegmentedTabs.d.ts.map +1 -0
- package/lib/types/client/SegmentedTabs.js.map +1 -0
- package/lib/types/client/ShortcutKeys.d.ts.map +1 -0
- package/lib/types/client/ShortcutKeys.js.map +1 -0
- package/lib/types/client/SiteGlyph.d.ts.map +1 -0
- package/lib/types/client/SiteGlyph.js.map +1 -0
- package/lib/types/client/StateDot.d.ts.map +1 -0
- package/lib/types/client/StateDot.js.map +1 -0
- package/lib/types/client/SubmenuPanel.d.ts.map +1 -0
- package/lib/types/client/SubmenuPanel.js.map +1 -0
- package/lib/types/client/Switch.d.ts.map +1 -0
- package/lib/types/client/Switch.js.map +1 -0
- package/lib/types/client/Tag.d.ts.map +1 -0
- package/lib/types/client/Tag.js.map +1 -0
- package/lib/types/client/TerminalBlock.d.ts.map +1 -0
- package/lib/types/client/TerminalBlock.js.map +1 -0
- package/lib/types/client/TextShimmer.d.ts.map +1 -0
- package/lib/types/client/TextShimmer.js.map +1 -0
- package/lib/types/client/Toast.d.ts.map +1 -0
- package/lib/types/client/Toast.js.map +1 -0
- package/lib/types/client/Tooltip.d.ts.map +1 -0
- package/lib/types/client/Tooltip.js.map +1 -0
- package/lib/types/client/UserMessageBubble.d.ts.map +1 -0
- package/lib/types/client/UserMessageBubble.js.map +1 -0
- package/lib/types/client/WebBlock.d.ts.map +1 -0
- package/lib/types/client/WebBlock.js.map +1 -0
- package/lib/types/client/ZoomControls.d.ts.map +1 -0
- package/lib/types/client/ZoomControls.js.map +1 -0
- package/lib/types/client/ansi.d.ts.map +1 -0
- package/lib/types/client/ansi.js.map +1 -0
- package/lib/types/client/clipboard.d.ts.map +1 -0
- package/lib/types/client/clipboard.js.map +1 -0
- package/lib/types/client/code-file-icon-artwork.d.ts.map +1 -0
- package/lib/types/client/code-file-icon-artwork.js.map +1 -0
- package/lib/types/client/code-file-types.d.ts.map +1 -0
- package/lib/types/client/code-file-types.js.map +1 -0
- package/lib/types/client/code-highlighting.d.ts.map +1 -0
- package/lib/types/client/code-highlighting.js.map +1 -0
- package/lib/types/client/darwin-desktop.d.ts.map +1 -0
- package/lib/types/client/darwin-desktop.js.map +1 -0
- package/lib/types/client/document-zoom.d.ts.map +1 -0
- package/lib/types/client/document-zoom.js.map +1 -0
- package/lib/types/client/file-drag-actions.d.ts.map +1 -0
- package/lib/types/client/file-drag-actions.js.map +1 -0
- package/lib/types/client/file-size.d.ts.map +1 -0
- package/lib/types/client/file-size.js.map +1 -0
- package/lib/types/client/focus.d.ts.map +1 -0
- package/lib/types/client/focus.js.map +1 -0
- package/lib/types/client/guide-artwork.d.ts.map +1 -0
- package/lib/types/client/guide-artwork.js.map +1 -0
- package/lib/types/client/head-tail-cap.d.ts.map +1 -0
- package/lib/types/client/head-tail-cap.js.map +1 -0
- package/lib/types/client/icons/artwork.d.ts +475 -0
- package/lib/types/client/icons/artwork.d.ts.map +1 -0
- package/lib/types/client/icons/artwork.js.map +1 -0
- package/lib/types/client/icons/index.d.ts +450 -0
- package/lib/types/client/icons/index.d.ts.map +1 -0
- package/lib/types/client/icons/index.js.map +1 -0
- package/lib/types/client/icons/props.d.ts.map +1 -0
- package/lib/types/client/icons/props.js.map +1 -0
- package/lib/types/client/icons/shared-artwork.d.ts.map +1 -0
- package/lib/types/client/icons/shared-artwork.js.map +1 -0
- package/lib/types/client/image-drag.d.ts.map +1 -0
- package/lib/types/client/image-drag.js.map +1 -0
- package/lib/types/client/index.d.ts +128 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/index.js.map +1 -0
- package/lib/types/client/input-modality.d.ts.map +1 -0
- package/lib/types/client/input-modality.js.map +1 -0
- package/lib/types/client/keyboard-composition.d.ts.map +1 -0
- package/lib/types/client/keyboard-composition.js.map +1 -0
- package/lib/types/client/markdown/CodeBlock.d.ts.map +1 -0
- package/lib/types/client/markdown/CodeBlock.js.map +1 -0
- package/lib/types/client/markdown/FenceBlocks.d.ts.map +1 -0
- package/lib/types/client/markdown/FenceBlocks.js.map +1 -0
- package/lib/types/client/markdown/JsonBlock.d.ts.map +1 -0
- package/lib/types/client/markdown/JsonBlock.js.map +1 -0
- package/lib/types/client/markdown/MarkdownDelegate.d.ts.map +1 -0
- package/lib/types/client/markdown/MarkdownDelegate.js.map +1 -0
- package/lib/types/client/markdown/MarkdownText.d.ts.map +1 -0
- package/lib/types/client/markdown/MarkdownText.js.map +1 -0
- package/lib/types/client/markdown/cjkFriendlyStrong.d.ts.map +1 -0
- package/lib/types/client/markdown/cjkFriendlyStrong.js.map +1 -0
- package/lib/types/client/markdown/copy-tex.d.ts.map +1 -0
- package/lib/types/client/markdown/copy-tex.js.map +1 -0
- package/lib/types/client/markdown/diff-fence.d.ts.map +1 -0
- package/lib/types/client/markdown/diff-fence.js.map +1 -0
- package/lib/types/client/markdown/file-link.d.ts.map +1 -0
- package/lib/types/client/markdown/file-link.js.map +1 -0
- package/lib/types/client/markdown/highlight.d.ts.map +1 -0
- package/lib/types/client/markdown/highlight.js.map +1 -0
- package/lib/types/client/markdown/incremental.d.ts.map +1 -0
- package/lib/types/client/markdown/incremental.js.map +1 -0
- package/lib/types/client/markdown/katex.d.ts.map +1 -0
- package/lib/types/client/markdown/katex.js.map +1 -0
- package/lib/types/client/markdown/local-image-syntax.d.ts.map +1 -0
- package/lib/types/client/markdown/local-image-syntax.js.map +1 -0
- package/lib/types/client/markdown/mathCompatibility.d.ts.map +1 -0
- package/lib/types/client/markdown/mathCompatibility.js.map +1 -0
- package/lib/types/client/markdown/parse.d.ts.map +1 -0
- package/lib/types/client/markdown/parse.js.map +1 -0
- package/lib/types/client/markdown/plain-text.d.ts.map +1 -0
- package/lib/types/client/markdown/plain-text.js.map +1 -0
- package/lib/types/client/markdown/quote-text.d.ts.map +1 -0
- package/lib/types/client/markdown/quote-text.js.map +1 -0
- package/lib/types/client/markdown/render.d.ts.map +1 -0
- package/lib/types/client/markdown/render.js.map +1 -0
- package/lib/types/client/markdown/useViewportHighlighting.d.ts +11 -0
- package/lib/types/client/markdown/useViewportHighlighting.d.ts.map +1 -0
- package/lib/types/client/markdown/useViewportHighlighting.js.map +1 -0
- package/lib/types/client/markdown/windows-path-destinations.d.ts.map +1 -0
- package/lib/types/client/markdown/windows-path-destinations.js.map +1 -0
- package/lib/types/client/menu-submenu-position.d.ts.map +1 -0
- package/lib/types/client/menu-submenu-position.js.map +1 -0
- package/lib/types/client/overlay-top-margin.d.ts.map +1 -0
- package/lib/types/client/overlay-top-margin.js.map +1 -0
- package/lib/types/client/plugin-artwork.d.ts.map +1 -0
- package/lib/types/client/plugin-artwork.js.map +1 -0
- package/lib/types/client/pointer-grace.d.ts.map +1 -0
- package/lib/types/client/pointer-grace.js.map +1 -0
- package/lib/types/client/relative-time.d.ts.map +1 -0
- package/lib/types/client/relative-time.js.map +1 -0
- package/lib/types/client/settings-form/SettingsForm.d.ts.map +1 -0
- package/lib/types/client/settings-form/SettingsForm.js.map +1 -0
- package/lib/types/client/settings-form/fields.d.ts.map +1 -0
- package/lib/types/client/settings-form/fields.js.map +1 -0
- package/lib/types/client/settings-form/form-model.d.ts.map +1 -0
- package/lib/types/client/settings-form/form-model.js.map +1 -0
- package/lib/types/client/tooltip-placement.d.ts.map +1 -0
- package/lib/types/client/tooltip-placement.js.map +1 -0
- package/lib/types/client/use-clipboard-copy.d.ts.map +1 -0
- package/lib/types/client/use-clipboard-copy.js.map +1 -0
- package/lib/types/client/useAnchoredMaxHeight.d.ts +14 -0
- package/lib/types/client/useAnchoredMaxHeight.d.ts.map +1 -0
- package/lib/types/client/useAnchoredMaxHeight.js.map +1 -0
- package/lib/types/client/useDismissOnOutsidePointer.d.ts.map +1 -0
- package/lib/types/client/useDismissOnOutsidePointer.js.map +1 -0
- package/lib/types/client/useMenuSubmenu.d.ts +44 -0
- package/lib/types/client/useMenuSubmenu.d.ts.map +1 -0
- package/lib/types/client/useMenuSubmenu.js.map +1 -0
- package/lib/types/client/useModalLayer.d.ts.map +1 -0
- package/lib/types/client/useModalLayer.js.map +1 -0
- package/lib/types/client/useRowDragPreview.d.ts.map +1 -0
- package/lib/types/client/useRowDragPreview.js.map +1 -0
- package/lib/types/client/user-text.d.ts.map +1 -0
- package/lib/types/client/user-text.js.map +1 -0
- package/locale/de.json +6 -0
- package/locale/en.json +5 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +28 -12
- package/src/client/CodeFileIcon.tsx +28 -0
- package/src/client/HoverCard.tsx +360 -0
- package/src/client/InspectButton.module.css +47 -0
- package/src/client/InspectButton.tsx +29 -0
- package/src/client/JsonTree.tsx +850 -0
- package/src/client/Menu.module.css +491 -0
- package/src/client/Menu.tsx +656 -0
- package/src/client/MenuSurface.tsx +54 -0
- package/src/client/QuotePreview.tsx +116 -0
- package/src/client/RiskConfirmation.module.css +54 -0
- package/src/client/TextShimmer.tsx +64 -0
- package/src/client/Tooltip.tsx +282 -0
- package/src/client/icons/artwork.ts +169 -0
- package/src/client/icons/index.tsx +694 -0
- package/src/client/image-drag.ts +84 -0
- package/src/client/index.ts +148 -0
- package/src/client/markdown/MarkdownText.module.css +612 -0
- package/src/client/markdown/useViewportHighlighting.ts +72 -0
- package/src/client/plugin-artwork.tsx +110 -0
- package/src/client/useAnchoredMaxHeight.ts +45 -0
- package/src/client/useMenuSubmenu.ts +185 -0
- package/src/index.js +12 -0
- package/lib/index.js.map +0 -1
- package/lib/types/AnimatedRows.d.ts.map +0 -1
- package/lib/types/AnimatedRows.js.map +0 -1
- package/lib/types/BrandWordmark.d.ts.map +0 -1
- package/lib/types/BrandWordmark.js.map +0 -1
- package/lib/types/Button.d.ts.map +0 -1
- package/lib/types/Button.js.map +0 -1
- package/lib/types/Checkbox.d.ts.map +0 -1
- package/lib/types/Checkbox.js.map +0 -1
- package/lib/types/CodeFileIcon.d.ts.map +0 -1
- package/lib/types/CodeFileIcon.js.map +0 -1
- package/lib/types/CodeToolbar.d.ts.map +0 -1
- package/lib/types/CodeToolbar.js.map +0 -1
- package/lib/types/CommandText.d.ts.map +0 -1
- package/lib/types/CommandText.js.map +0 -1
- package/lib/types/ConfigField.d.ts.map +0 -1
- package/lib/types/ConfigField.js.map +0 -1
- package/lib/types/ConnectionIndicator.d.ts.map +0 -1
- package/lib/types/ConnectionIndicator.js.map +0 -1
- package/lib/types/DetailDocument.d.ts.map +0 -1
- package/lib/types/DetailDocument.js.map +0 -1
- package/lib/types/DiffBlock.d.ts.map +0 -1
- package/lib/types/DiffBlock.js.map +0 -1
- package/lib/types/DisclosureRow.d.ts.map +0 -1
- package/lib/types/DisclosureRow.js.map +0 -1
- package/lib/types/DraggableImage.d.ts.map +0 -1
- package/lib/types/DraggableImage.js.map +0 -1
- package/lib/types/FileTypeIcon.d.ts.map +0 -1
- package/lib/types/FileTypeIcon.js.map +0 -1
- package/lib/types/FishLogo.d.ts.map +0 -1
- package/lib/types/FishLogo.js.map +0 -1
- package/lib/types/FoldToggle.d.ts.map +0 -1
- package/lib/types/FoldToggle.js.map +0 -1
- package/lib/types/HoverCard.d.ts.map +0 -1
- package/lib/types/HoverCard.js.map +0 -1
- package/lib/types/HoverCardGroup.d.ts.map +0 -1
- package/lib/types/HoverCardGroup.js.map +0 -1
- package/lib/types/ImageLightbox.d.ts.map +0 -1
- package/lib/types/ImageLightbox.js.map +0 -1
- package/lib/types/ImagePreview.d.ts.map +0 -1
- package/lib/types/ImagePreview.js.map +0 -1
- package/lib/types/InlineEditor.d.ts.map +0 -1
- package/lib/types/InlineEditor.js.map +0 -1
- package/lib/types/Input.d.ts.map +0 -1
- package/lib/types/Input.js.map +0 -1
- package/lib/types/JsonTree.d.ts.map +0 -1
- package/lib/types/JsonTree.js.map +0 -1
- package/lib/types/LinkIcon.d.ts.map +0 -1
- package/lib/types/LinkIcon.js.map +0 -1
- package/lib/types/Marquee.d.ts.map +0 -1
- package/lib/types/Marquee.js.map +0 -1
- package/lib/types/Menu.d.ts.map +0 -1
- package/lib/types/Menu.js.map +0 -1
- package/lib/types/MenuGroup.d.ts.map +0 -1
- package/lib/types/MenuGroup.js.map +0 -1
- package/lib/types/MenuRow.d.ts.map +0 -1
- package/lib/types/MenuRow.js.map +0 -1
- package/lib/types/MenuSurface.d.ts.map +0 -1
- package/lib/types/MenuSurface.js.map +0 -1
- package/lib/types/Modal.d.ts.map +0 -1
- package/lib/types/Modal.js.map +0 -1
- package/lib/types/PathLabel.d.ts.map +0 -1
- package/lib/types/PathLabel.js.map +0 -1
- package/lib/types/PermissionIcon.d.ts.map +0 -1
- package/lib/types/PermissionIcon.js.map +0 -1
- package/lib/types/Pill.d.ts.map +0 -1
- package/lib/types/Pill.js.map +0 -1
- package/lib/types/QuotePreview.d.ts +0 -37
- package/lib/types/QuotePreview.d.ts.map +0 -1
- package/lib/types/QuotePreview.js.map +0 -1
- package/lib/types/ReadBlock.d.ts.map +0 -1
- package/lib/types/ReadBlock.js.map +0 -1
- package/lib/types/ReferenceIcon.d.ts.map +0 -1
- package/lib/types/ReferenceIcon.js.map +0 -1
- package/lib/types/RiskConfirmation.d.ts.map +0 -1
- package/lib/types/RiskConfirmation.js.map +0 -1
- package/lib/types/SearchBlock.d.ts.map +0 -1
- package/lib/types/SearchBlock.js.map +0 -1
- package/lib/types/SearchField.d.ts.map +0 -1
- package/lib/types/SearchField.js.map +0 -1
- package/lib/types/SegmentedControl.d.ts.map +0 -1
- package/lib/types/SegmentedControl.js.map +0 -1
- package/lib/types/SegmentedTabs.d.ts.map +0 -1
- package/lib/types/SegmentedTabs.js.map +0 -1
- package/lib/types/ShortcutKeys.d.ts.map +0 -1
- package/lib/types/ShortcutKeys.js.map +0 -1
- package/lib/types/SiteGlyph.d.ts.map +0 -1
- package/lib/types/SiteGlyph.js.map +0 -1
- package/lib/types/StateDot.d.ts.map +0 -1
- package/lib/types/StateDot.js.map +0 -1
- package/lib/types/SubmenuPanel.d.ts.map +0 -1
- package/lib/types/SubmenuPanel.js.map +0 -1
- package/lib/types/Switch.d.ts.map +0 -1
- package/lib/types/Switch.js.map +0 -1
- package/lib/types/Tag.d.ts.map +0 -1
- package/lib/types/Tag.js.map +0 -1
- package/lib/types/TerminalBlock.d.ts.map +0 -1
- package/lib/types/TerminalBlock.js.map +0 -1
- package/lib/types/TextShimmer.d.ts.map +0 -1
- package/lib/types/TextShimmer.js.map +0 -1
- package/lib/types/Toast.d.ts.map +0 -1
- package/lib/types/Toast.js.map +0 -1
- package/lib/types/Tooltip.d.ts.map +0 -1
- package/lib/types/Tooltip.js.map +0 -1
- package/lib/types/UserMessageBubble.d.ts.map +0 -1
- package/lib/types/UserMessageBubble.js.map +0 -1
- package/lib/types/WebBlock.d.ts.map +0 -1
- package/lib/types/WebBlock.js.map +0 -1
- package/lib/types/ZoomControls.d.ts.map +0 -1
- package/lib/types/ZoomControls.js.map +0 -1
- package/lib/types/ansi.d.ts.map +0 -1
- package/lib/types/ansi.js.map +0 -1
- package/lib/types/clipboard.d.ts.map +0 -1
- package/lib/types/clipboard.js.map +0 -1
- package/lib/types/code-file-icon-artwork.d.ts.map +0 -1
- package/lib/types/code-file-icon-artwork.js.map +0 -1
- package/lib/types/code-file-types.d.ts.map +0 -1
- package/lib/types/code-file-types.js.map +0 -1
- package/lib/types/code-highlighting.d.ts.map +0 -1
- package/lib/types/code-highlighting.js.map +0 -1
- package/lib/types/darwin-desktop.d.ts.map +0 -1
- package/lib/types/darwin-desktop.js.map +0 -1
- package/lib/types/document-zoom.d.ts.map +0 -1
- package/lib/types/document-zoom.js.map +0 -1
- package/lib/types/file-drag-actions.d.ts.map +0 -1
- package/lib/types/file-drag-actions.js.map +0 -1
- package/lib/types/file-size.d.ts.map +0 -1
- package/lib/types/file-size.js.map +0 -1
- package/lib/types/focus.d.ts.map +0 -1
- package/lib/types/focus.js.map +0 -1
- package/lib/types/guide-artwork.d.ts.map +0 -1
- package/lib/types/guide-artwork.js.map +0 -1
- package/lib/types/head-tail-cap.d.ts.map +0 -1
- package/lib/types/head-tail-cap.js.map +0 -1
- package/lib/types/icons/artwork.d.ts +0 -454
- package/lib/types/icons/artwork.d.ts.map +0 -1
- package/lib/types/icons/artwork.js.map +0 -1
- package/lib/types/icons/index.d.ts +0 -430
- package/lib/types/icons/index.d.ts.map +0 -1
- package/lib/types/icons/index.js.map +0 -1
- package/lib/types/icons/props.d.ts.map +0 -1
- package/lib/types/icons/props.js.map +0 -1
- package/lib/types/icons/shared-artwork.d.ts.map +0 -1
- package/lib/types/icons/shared-artwork.js.map +0 -1
- package/lib/types/image-drag.d.ts.map +0 -1
- package/lib/types/image-drag.js.map +0 -1
- package/lib/types/index.d.ts +0 -124
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/index.js.map +0 -1
- package/lib/types/input-modality.d.ts.map +0 -1
- package/lib/types/input-modality.js.map +0 -1
- package/lib/types/keyboard-composition.d.ts.map +0 -1
- package/lib/types/keyboard-composition.js.map +0 -1
- package/lib/types/markdown/CodeBlock.d.ts.map +0 -1
- package/lib/types/markdown/CodeBlock.js.map +0 -1
- package/lib/types/markdown/FenceBlocks.d.ts.map +0 -1
- package/lib/types/markdown/FenceBlocks.js.map +0 -1
- package/lib/types/markdown/JsonBlock.d.ts.map +0 -1
- package/lib/types/markdown/JsonBlock.js.map +0 -1
- package/lib/types/markdown/MarkdownDelegate.d.ts.map +0 -1
- package/lib/types/markdown/MarkdownDelegate.js.map +0 -1
- package/lib/types/markdown/MarkdownText.d.ts.map +0 -1
- package/lib/types/markdown/MarkdownText.js.map +0 -1
- package/lib/types/markdown/cjkFriendlyStrong.d.ts.map +0 -1
- package/lib/types/markdown/cjkFriendlyStrong.js.map +0 -1
- package/lib/types/markdown/copy-tex.d.ts.map +0 -1
- package/lib/types/markdown/copy-tex.js.map +0 -1
- package/lib/types/markdown/diff-fence.d.ts.map +0 -1
- package/lib/types/markdown/diff-fence.js.map +0 -1
- package/lib/types/markdown/file-link.d.ts.map +0 -1
- package/lib/types/markdown/file-link.js.map +0 -1
- package/lib/types/markdown/highlight.d.ts.map +0 -1
- package/lib/types/markdown/highlight.js.map +0 -1
- package/lib/types/markdown/incremental.d.ts.map +0 -1
- package/lib/types/markdown/incremental.js.map +0 -1
- package/lib/types/markdown/katex.d.ts.map +0 -1
- package/lib/types/markdown/katex.js.map +0 -1
- package/lib/types/markdown/local-image-syntax.d.ts.map +0 -1
- package/lib/types/markdown/local-image-syntax.js.map +0 -1
- package/lib/types/markdown/mathCompatibility.d.ts.map +0 -1
- package/lib/types/markdown/mathCompatibility.js.map +0 -1
- package/lib/types/markdown/parse.d.ts.map +0 -1
- package/lib/types/markdown/parse.js.map +0 -1
- package/lib/types/markdown/plain-text.d.ts.map +0 -1
- package/lib/types/markdown/plain-text.js.map +0 -1
- package/lib/types/markdown/quote-text.d.ts.map +0 -1
- package/lib/types/markdown/quote-text.js.map +0 -1
- package/lib/types/markdown/render.d.ts.map +0 -1
- package/lib/types/markdown/render.js.map +0 -1
- package/lib/types/markdown/useViewportHighlighting.d.ts +0 -11
- package/lib/types/markdown/useViewportHighlighting.d.ts.map +0 -1
- package/lib/types/markdown/useViewportHighlighting.js.map +0 -1
- package/lib/types/markdown/windows-path-destinations.d.ts.map +0 -1
- package/lib/types/markdown/windows-path-destinations.js.map +0 -1
- package/lib/types/menu-submenu-position.d.ts.map +0 -1
- package/lib/types/menu-submenu-position.js.map +0 -1
- package/lib/types/overlay-top-margin.d.ts.map +0 -1
- package/lib/types/overlay-top-margin.js.map +0 -1
- package/lib/types/plugin-artwork.d.ts.map +0 -1
- package/lib/types/plugin-artwork.js.map +0 -1
- package/lib/types/pointer-grace.d.ts.map +0 -1
- package/lib/types/pointer-grace.js.map +0 -1
- package/lib/types/relative-time.d.ts.map +0 -1
- package/lib/types/relative-time.js.map +0 -1
- package/lib/types/settings-form/SettingsForm.d.ts.map +0 -1
- package/lib/types/settings-form/SettingsForm.js.map +0 -1
- package/lib/types/settings-form/fields.d.ts.map +0 -1
- package/lib/types/settings-form/fields.js.map +0 -1
- package/lib/types/settings-form/form-model.d.ts.map +0 -1
- package/lib/types/settings-form/form-model.js.map +0 -1
- package/lib/types/tooltip-placement.d.ts.map +0 -1
- package/lib/types/tooltip-placement.js.map +0 -1
- package/lib/types/use-clipboard-copy.d.ts.map +0 -1
- package/lib/types/use-clipboard-copy.js.map +0 -1
- package/lib/types/useAnchoredMaxHeight.d.ts +0 -14
- package/lib/types/useAnchoredMaxHeight.d.ts.map +0 -1
- package/lib/types/useAnchoredMaxHeight.js.map +0 -1
- package/lib/types/useDismissOnOutsidePointer.d.ts.map +0 -1
- package/lib/types/useDismissOnOutsidePointer.js.map +0 -1
- package/lib/types/useMenuSubmenu.d.ts +0 -44
- package/lib/types/useMenuSubmenu.d.ts.map +0 -1
- package/lib/types/useMenuSubmenu.js.map +0 -1
- package/lib/types/useModalLayer.d.ts.map +0 -1
- package/lib/types/useModalLayer.js.map +0 -1
- package/lib/types/useRowDragPreview.d.ts.map +0 -1
- package/lib/types/useRowDragPreview.js.map +0 -1
- package/lib/types/user-text.d.ts.map +0 -1
- package/lib/types/user-text.js.map +0 -1
- package/src/CodeFileIcon.tsx +0 -28
- package/src/HoverCard.tsx +0 -360
- package/src/JsonTree.tsx +0 -850
- package/src/Menu.module.css +0 -473
- package/src/Menu.tsx +0 -656
- package/src/MenuSurface.tsx +0 -54
- package/src/QuotePreview.tsx +0 -133
- package/src/RiskConfirmation.module.css +0 -52
- package/src/TextShimmer.tsx +0 -58
- package/src/Tooltip.tsx +0 -273
- package/src/icons/artwork.ts +0 -161
- package/src/icons/index.tsx +0 -664
- package/src/image-drag.ts +0 -84
- package/src/index.ts +0 -143
- package/src/markdown/MarkdownText.module.css +0 -522
- package/src/markdown/useViewportHighlighting.ts +0 -72
- package/src/plugin-artwork.tsx +0 -110
- package/src/useAnchoredMaxHeight.ts +0 -45
- package/src/useMenuSubmenu.ts +0 -185
- /package/lib/types/{AnimatedRows.d.ts → client/AnimatedRows.d.ts} +0 -0
- /package/lib/types/{BrandWordmark.d.ts → client/BrandWordmark.d.ts} +0 -0
- /package/lib/types/{Button.d.ts → client/Button.d.ts} +0 -0
- /package/lib/types/{Checkbox.d.ts → client/Checkbox.d.ts} +0 -0
- /package/lib/types/{CodeFileIcon.d.ts → client/CodeFileIcon.d.ts} +0 -0
- /package/lib/types/{CodeToolbar.d.ts → client/CodeToolbar.d.ts} +0 -0
- /package/lib/types/{CommandText.d.ts → client/CommandText.d.ts} +0 -0
- /package/lib/types/{ConfigField.d.ts → client/ConfigField.d.ts} +0 -0
- /package/lib/types/{ConnectionIndicator.d.ts → client/ConnectionIndicator.d.ts} +0 -0
- /package/lib/types/{DetailDocument.d.ts → client/DetailDocument.d.ts} +0 -0
- /package/lib/types/{DiffBlock.d.ts → client/DiffBlock.d.ts} +0 -0
- /package/lib/types/{DisclosureRow.d.ts → client/DisclosureRow.d.ts} +0 -0
- /package/lib/types/{DraggableImage.d.ts → client/DraggableImage.d.ts} +0 -0
- /package/lib/types/{FileTypeIcon.d.ts → client/FileTypeIcon.d.ts} +0 -0
- /package/lib/types/{FishLogo.d.ts → client/FishLogo.d.ts} +0 -0
- /package/lib/types/{FoldToggle.d.ts → client/FoldToggle.d.ts} +0 -0
- /package/lib/types/{HoverCard.d.ts → client/HoverCard.d.ts} +0 -0
- /package/lib/types/{HoverCardGroup.d.ts → client/HoverCardGroup.d.ts} +0 -0
- /package/lib/types/{ImageLightbox.d.ts → client/ImageLightbox.d.ts} +0 -0
- /package/lib/types/{ImagePreview.d.ts → client/ImagePreview.d.ts} +0 -0
- /package/lib/types/{InlineEditor.d.ts → client/InlineEditor.d.ts} +0 -0
- /package/lib/types/{Input.d.ts → client/Input.d.ts} +0 -0
- /package/lib/types/{JsonTree.d.ts → client/JsonTree.d.ts} +0 -0
- /package/lib/types/{LinkIcon.d.ts → client/LinkIcon.d.ts} +0 -0
- /package/lib/types/{Marquee.d.ts → client/Marquee.d.ts} +0 -0
- /package/lib/types/{Menu.d.ts → client/Menu.d.ts} +0 -0
- /package/lib/types/{MenuGroup.d.ts → client/MenuGroup.d.ts} +0 -0
- /package/lib/types/{MenuRow.d.ts → client/MenuRow.d.ts} +0 -0
- /package/lib/types/{MenuSurface.d.ts → client/MenuSurface.d.ts} +0 -0
- /package/lib/types/{Modal.d.ts → client/Modal.d.ts} +0 -0
- /package/lib/types/{PathLabel.d.ts → client/PathLabel.d.ts} +0 -0
- /package/lib/types/{PermissionIcon.d.ts → client/PermissionIcon.d.ts} +0 -0
- /package/lib/types/{Pill.d.ts → client/Pill.d.ts} +0 -0
- /package/lib/types/{ReadBlock.d.ts → client/ReadBlock.d.ts} +0 -0
- /package/lib/types/{ReferenceIcon.d.ts → client/ReferenceIcon.d.ts} +0 -0
- /package/lib/types/{RiskConfirmation.d.ts → client/RiskConfirmation.d.ts} +0 -0
- /package/lib/types/{SearchBlock.d.ts → client/SearchBlock.d.ts} +0 -0
- /package/lib/types/{SearchField.d.ts → client/SearchField.d.ts} +0 -0
- /package/lib/types/{SegmentedControl.d.ts → client/SegmentedControl.d.ts} +0 -0
- /package/lib/types/{SegmentedTabs.d.ts → client/SegmentedTabs.d.ts} +0 -0
- /package/lib/types/{ShortcutKeys.d.ts → client/ShortcutKeys.d.ts} +0 -0
- /package/lib/types/{SiteGlyph.d.ts → client/SiteGlyph.d.ts} +0 -0
- /package/lib/types/{StateDot.d.ts → client/StateDot.d.ts} +0 -0
- /package/lib/types/{SubmenuPanel.d.ts → client/SubmenuPanel.d.ts} +0 -0
- /package/lib/types/{Switch.d.ts → client/Switch.d.ts} +0 -0
- /package/lib/types/{Tag.d.ts → client/Tag.d.ts} +0 -0
- /package/lib/types/{TerminalBlock.d.ts → client/TerminalBlock.d.ts} +0 -0
- /package/lib/types/{TextShimmer.d.ts → client/TextShimmer.d.ts} +0 -0
- /package/lib/types/{Toast.d.ts → client/Toast.d.ts} +0 -0
- /package/lib/types/{Tooltip.d.ts → client/Tooltip.d.ts} +0 -0
- /package/lib/types/{UserMessageBubble.d.ts → client/UserMessageBubble.d.ts} +0 -0
- /package/lib/types/{WebBlock.d.ts → client/WebBlock.d.ts} +0 -0
- /package/lib/types/{ZoomControls.d.ts → client/ZoomControls.d.ts} +0 -0
- /package/lib/types/{ansi.d.ts → client/ansi.d.ts} +0 -0
- /package/lib/types/{clipboard.d.ts → client/clipboard.d.ts} +0 -0
- /package/lib/types/{code-file-icon-artwork.d.ts → client/code-file-icon-artwork.d.ts} +0 -0
- /package/lib/types/{code-file-types.d.ts → client/code-file-types.d.ts} +0 -0
- /package/lib/types/{code-highlighting.d.ts → client/code-highlighting.d.ts} +0 -0
- /package/lib/types/{darwin-desktop.d.ts → client/darwin-desktop.d.ts} +0 -0
- /package/lib/types/{document-zoom.d.ts → client/document-zoom.d.ts} +0 -0
- /package/lib/types/{file-drag-actions.d.ts → client/file-drag-actions.d.ts} +0 -0
- /package/lib/types/{file-size.d.ts → client/file-size.d.ts} +0 -0
- /package/lib/types/{focus.d.ts → client/focus.d.ts} +0 -0
- /package/lib/types/{guide-artwork.d.ts → client/guide-artwork.d.ts} +0 -0
- /package/lib/types/{head-tail-cap.d.ts → client/head-tail-cap.d.ts} +0 -0
- /package/lib/types/{icons → client/icons}/props.d.ts +0 -0
- /package/lib/types/{icons → client/icons}/shared-artwork.d.ts +0 -0
- /package/lib/types/{image-drag.d.ts → client/image-drag.d.ts} +0 -0
- /package/lib/types/{input-modality.d.ts → client/input-modality.d.ts} +0 -0
- /package/lib/types/{keyboard-composition.d.ts → client/keyboard-composition.d.ts} +0 -0
- /package/lib/types/{markdown → client/markdown}/CodeBlock.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/FenceBlocks.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/JsonBlock.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/MarkdownDelegate.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/MarkdownText.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/cjkFriendlyStrong.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/copy-tex.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/diff-fence.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/file-link.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/highlight.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/incremental.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/katex.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/local-image-syntax.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/mathCompatibility.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/parse.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/plain-text.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/quote-text.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/render.d.ts +0 -0
- /package/lib/types/{markdown → client/markdown}/windows-path-destinations.d.ts +0 -0
- /package/lib/types/{menu-submenu-position.d.ts → client/menu-submenu-position.d.ts} +0 -0
- /package/lib/types/{overlay-top-margin.d.ts → client/overlay-top-margin.d.ts} +0 -0
- /package/lib/types/{plugin-artwork.d.ts → client/plugin-artwork.d.ts} +0 -0
- /package/lib/types/{pointer-grace.d.ts → client/pointer-grace.d.ts} +0 -0
- /package/lib/types/{relative-time.d.ts → client/relative-time.d.ts} +0 -0
- /package/lib/types/{settings-form → client/settings-form}/SettingsForm.d.ts +0 -0
- /package/lib/types/{settings-form → client/settings-form}/fields.d.ts +0 -0
- /package/lib/types/{settings-form → client/settings-form}/form-model.d.ts +0 -0
- /package/lib/types/{tooltip-placement.d.ts → client/tooltip-placement.d.ts} +0 -0
- /package/lib/types/{use-clipboard-copy.d.ts → client/use-clipboard-copy.d.ts} +0 -0
- /package/lib/types/{useDismissOnOutsidePointer.d.ts → client/useDismissOnOutsidePointer.d.ts} +0 -0
- /package/lib/types/{useModalLayer.d.ts → client/useModalLayer.d.ts} +0 -0
- /package/lib/types/{useRowDragPreview.d.ts → client/useRowDragPreview.d.ts} +0 -0
- /package/lib/types/{user-text.d.ts → client/user-text.d.ts} +0 -0
- /package/src/{AnimatedRows.module.css → client/AnimatedRows.module.css} +0 -0
- /package/src/{AnimatedRows.tsx → client/AnimatedRows.tsx} +0 -0
- /package/src/{BrandWordmark.tsx → client/BrandWordmark.tsx} +0 -0
- /package/src/{Button.module.css → client/Button.module.css} +0 -0
- /package/src/{Button.tsx → client/Button.tsx} +0 -0
- /package/src/{Checkbox.module.css → client/Checkbox.module.css} +0 -0
- /package/src/{Checkbox.tsx → client/Checkbox.tsx} +0 -0
- /package/src/{CodeCard.module.css → client/CodeCard.module.css} +0 -0
- /package/src/{CodeToolbar.tsx → client/CodeToolbar.tsx} +0 -0
- /package/src/{CommandText.module.css → client/CommandText.module.css} +0 -0
- /package/src/{CommandText.tsx → client/CommandText.tsx} +0 -0
- /package/src/{ConfigField.module.css → client/ConfigField.module.css} +0 -0
- /package/src/{ConfigField.tsx → client/ConfigField.tsx} +0 -0
- /package/src/{ConnectionIndicator.module.css → client/ConnectionIndicator.module.css} +0 -0
- /package/src/{ConnectionIndicator.tsx → client/ConnectionIndicator.tsx} +0 -0
- /package/src/{DetailDocument.module.css → client/DetailDocument.module.css} +0 -0
- /package/src/{DetailDocument.tsx → client/DetailDocument.tsx} +0 -0
- /package/src/{DiffBlock.module.css → client/DiffBlock.module.css} +0 -0
- /package/src/{DiffBlock.tsx → client/DiffBlock.tsx} +0 -0
- /package/src/{DisclosureRow.module.css → client/DisclosureRow.module.css} +0 -0
- /package/src/{DisclosureRow.tsx → client/DisclosureRow.tsx} +0 -0
- /package/src/{DraggableImage.tsx → client/DraggableImage.tsx} +0 -0
- /package/src/{FileTypeIcon.module.css → client/FileTypeIcon.module.css} +0 -0
- /package/src/{FileTypeIcon.tsx → client/FileTypeIcon.tsx} +0 -0
- /package/src/{FishLogo.tsx → client/FishLogo.tsx} +0 -0
- /package/src/{FoldToggle.tsx → client/FoldToggle.tsx} +0 -0
- /package/src/{HoverCard.module.css → client/HoverCard.module.css} +0 -0
- /package/src/{HoverCardGroup.tsx → client/HoverCardGroup.tsx} +0 -0
- /package/src/{ImageLightbox.module.css → client/ImageLightbox.module.css} +0 -0
- /package/src/{ImageLightbox.tsx → client/ImageLightbox.tsx} +0 -0
- /package/src/{ImagePreview.module.css → client/ImagePreview.module.css} +0 -0
- /package/src/{ImagePreview.tsx → client/ImagePreview.tsx} +0 -0
- /package/src/{InlineEditor.module.css → client/InlineEditor.module.css} +0 -0
- /package/src/{InlineEditor.tsx → client/InlineEditor.tsx} +0 -0
- /package/src/{Input.module.css → client/Input.module.css} +0 -0
- /package/src/{Input.tsx → client/Input.tsx} +0 -0
- /package/src/{JsonTree.module.css → client/JsonTree.module.css} +0 -0
- /package/src/{LinkIcon.tsx → client/LinkIcon.tsx} +0 -0
- /package/src/{Marquee.module.css → client/Marquee.module.css} +0 -0
- /package/src/{Marquee.tsx → client/Marquee.tsx} +0 -0
- /package/src/{MenuGroup.module.css → client/MenuGroup.module.css} +0 -0
- /package/src/{MenuGroup.tsx → client/MenuGroup.tsx} +0 -0
- /package/src/{MenuRow.tsx → client/MenuRow.tsx} +0 -0
- /package/src/{MenuSurface.module.css → client/MenuSurface.module.css} +0 -0
- /package/src/{Modal.module.css → client/Modal.module.css} +0 -0
- /package/src/{Modal.tsx → client/Modal.tsx} +0 -0
- /package/src/{PathLabel.module.css → client/PathLabel.module.css} +0 -0
- /package/src/{PathLabel.tsx → client/PathLabel.tsx} +0 -0
- /package/src/{PermissionIcon.tsx → client/PermissionIcon.tsx} +0 -0
- /package/src/{Pill.module.css → client/Pill.module.css} +0 -0
- /package/src/{Pill.tsx → client/Pill.tsx} +0 -0
- /package/src/{QuotePreview.module.css → client/QuotePreview.module.css} +0 -0
- /package/src/{ReadBlock.module.css → client/ReadBlock.module.css} +0 -0
- /package/src/{ReadBlock.tsx → client/ReadBlock.tsx} +0 -0
- /package/src/{ReferenceIcon.tsx → client/ReferenceIcon.tsx} +0 -0
- /package/src/{RiskConfirmation.tsx → client/RiskConfirmation.tsx} +0 -0
- /package/src/{RowDragPreview.module.css → client/RowDragPreview.module.css} +0 -0
- /package/src/{SearchBlock.module.css → client/SearchBlock.module.css} +0 -0
- /package/src/{SearchBlock.tsx → client/SearchBlock.tsx} +0 -0
- /package/src/{SearchField.module.css → client/SearchField.module.css} +0 -0
- /package/src/{SearchField.tsx → client/SearchField.tsx} +0 -0
- /package/src/{SegmentedControl.module.css → client/SegmentedControl.module.css} +0 -0
- /package/src/{SegmentedControl.tsx → client/SegmentedControl.tsx} +0 -0
- /package/src/{SegmentedTabs.module.css → client/SegmentedTabs.module.css} +0 -0
- /package/src/{SegmentedTabs.tsx → client/SegmentedTabs.tsx} +0 -0
- /package/src/{ShortcutKeys.module.css → client/ShortcutKeys.module.css} +0 -0
- /package/src/{ShortcutKeys.tsx → client/ShortcutKeys.tsx} +0 -0
- /package/src/{SiteGlyph.tsx → client/SiteGlyph.tsx} +0 -0
- /package/src/{StateDot.module.css → client/StateDot.module.css} +0 -0
- /package/src/{StateDot.tsx → client/StateDot.tsx} +0 -0
- /package/src/{SubmenuPanel.tsx → client/SubmenuPanel.tsx} +0 -0
- /package/src/{Switch.module.css → client/Switch.module.css} +0 -0
- /package/src/{Switch.tsx → client/Switch.tsx} +0 -0
- /package/src/{Tag.module.css → client/Tag.module.css} +0 -0
- /package/src/{Tag.tsx → client/Tag.tsx} +0 -0
- /package/src/{TerminalBlock.module.css → client/TerminalBlock.module.css} +0 -0
- /package/src/{TerminalBlock.tsx → client/TerminalBlock.tsx} +0 -0
- /package/src/{TextShimmer.module.css → client/TextShimmer.module.css} +0 -0
- /package/src/{Toast.module.css → client/Toast.module.css} +0 -0
- /package/src/{Toast.tsx → client/Toast.tsx} +0 -0
- /package/src/{Tooltip.module.css → client/Tooltip.module.css} +0 -0
- /package/src/{UserMessageBubble.module.css → client/UserMessageBubble.module.css} +0 -0
- /package/src/{UserMessageBubble.tsx → client/UserMessageBubble.tsx} +0 -0
- /package/src/{WebBlock.module.css → client/WebBlock.module.css} +0 -0
- /package/src/{WebBlock.tsx → client/WebBlock.tsx} +0 -0
- /package/src/{ZoomControls.module.css → client/ZoomControls.module.css} +0 -0
- /package/src/{ZoomControls.tsx → client/ZoomControls.tsx} +0 -0
- /package/src/{ansi.ts → client/ansi.ts} +0 -0
- /package/src/{clipboard.ts → client/clipboard.ts} +0 -0
- /package/src/{code-file-icon-artwork.manifest.json → client/code-file-icon-artwork.manifest.json} +0 -0
- /package/src/{code-file-icon-artwork.ts → client/code-file-icon-artwork.ts} +0 -0
- /package/src/{code-file-types.ts → client/code-file-types.ts} +0 -0
- /package/src/{code-highlighting.ts → client/code-highlighting.ts} +0 -0
- /package/src/{css-modules.d.ts → client/css-modules.d.ts} +0 -0
- /package/src/{darwin-desktop.ts → client/darwin-desktop.ts} +0 -0
- /package/src/{document-zoom.ts → client/document-zoom.ts} +0 -0
- /package/src/{file-drag-actions.ts → client/file-drag-actions.ts} +0 -0
- /package/src/{file-size.ts → client/file-size.ts} +0 -0
- /package/src/{focus.ts → client/focus.ts} +0 -0
- /package/src/{guide-artwork.tsx → client/guide-artwork.tsx} +0 -0
- /package/src/{head-tail-cap.ts → client/head-tail-cap.ts} +0 -0
- /package/src/{icons → client/icons}/props.ts +0 -0
- /package/src/{icons → client/icons}/shared-artwork.tsx +0 -0
- /package/src/{input-modality.ts → client/input-modality.ts} +0 -0
- /package/src/{keyboard-composition.ts → client/keyboard-composition.ts} +0 -0
- /package/src/{markdown → client/markdown}/CodeBlock.module.css +0 -0
- /package/src/{markdown → client/markdown}/CodeBlock.tsx +0 -0
- /package/src/{markdown → client/markdown}/FenceBlocks.tsx +0 -0
- /package/src/{markdown → client/markdown}/JsonBlock.module.css +0 -0
- /package/src/{markdown → client/markdown}/JsonBlock.tsx +0 -0
- /package/src/{markdown → client/markdown}/MarkdownDelegate.tsx +0 -0
- /package/src/{markdown → client/markdown}/MarkdownText.tsx +0 -0
- /package/src/{markdown → client/markdown}/cjkFriendlyStrong.ts +0 -0
- /package/src/{markdown → client/markdown}/copy-tex.ts +0 -0
- /package/src/{markdown → client/markdown}/diff-fence.ts +0 -0
- /package/src/{markdown → client/markdown}/file-link.ts +0 -0
- /package/src/{markdown → client/markdown}/highlight.ts +0 -0
- /package/src/{markdown → client/markdown}/incremental.ts +0 -0
- /package/src/{markdown → client/markdown}/katex.tsx +0 -0
- /package/src/{markdown → client/markdown}/local-image-syntax.ts +0 -0
- /package/src/{markdown → client/markdown}/mathCompatibility.ts +0 -0
- /package/src/{markdown → client/markdown}/parse.ts +0 -0
- /package/src/{markdown → client/markdown}/plain-text.ts +0 -0
- /package/src/{markdown → client/markdown}/quote-text.ts +0 -0
- /package/src/{markdown → client/markdown}/render.tsx +0 -0
- /package/src/{markdown → client/markdown}/windows-path-destinations.ts +0 -0
- /package/src/{menu-submenu-position.ts → client/menu-submenu-position.ts} +0 -0
- /package/src/{overlay-top-margin.ts → client/overlay-top-margin.ts} +0 -0
- /package/src/{pointer-grace.ts → client/pointer-grace.ts} +0 -0
- /package/src/{relative-time.ts → client/relative-time.ts} +0 -0
- /package/src/{settings-form → client/settings-form}/SettingsForm.module.css +0 -0
- /package/src/{settings-form → client/settings-form}/SettingsForm.tsx +0 -0
- /package/src/{settings-form → client/settings-form}/fields.module.css +0 -0
- /package/src/{settings-form → client/settings-form}/fields.tsx +0 -0
- /package/src/{settings-form → client/settings-form}/form-model.ts +0 -0
- /package/src/{tooltip-placement.ts → client/tooltip-placement.ts} +0 -0
- /package/src/{use-clipboard-copy.ts → client/use-clipboard-copy.ts} +0 -0
- /package/src/{useDismissOnOutsidePointer.ts → client/useDismissOnOutsidePointer.ts} +0 -0
- /package/src/{useModalLayer.ts → client/useModalLayer.ts} +0 -0
- /package/src/{useRowDragPreview.ts → client/useRowDragPreview.ts} +0 -0
- /package/src/{user-text.module.css → client/user-text.module.css} +0 -0
- /package/src/{user-text.tsx → client/user-text.tsx} +0 -0
package/src/JsonTree.tsx
DELETED
|
@@ -1,850 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx'
|
|
2
|
-
import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react'
|
|
3
|
-
import type {
|
|
4
|
-
CSSProperties,
|
|
5
|
-
KeyboardEvent as ReactKeyboardEvent,
|
|
6
|
-
MouseEvent as ReactMouseEvent,
|
|
7
|
-
ReactNode,
|
|
8
|
-
} from 'react'
|
|
9
|
-
import { IconCheckOutlineRegular, IconCopyOutlineRegular, IconWrapLinesOutlineRegular } from './icons/index.tsx'
|
|
10
|
-
import { Menu } from './Menu.tsx'
|
|
11
|
-
import type { MenuEntry } from './Menu.tsx'
|
|
12
|
-
import css from './JsonTree.module.css'
|
|
13
|
-
|
|
14
|
-
const OBJECT_PREVIEW_LIMIT = 4
|
|
15
|
-
const ARRAY_PREVIEW_LIMIT = 5
|
|
16
|
-
const PREVIEW_DEPTH_LIMIT = 2
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Display copy for the tree's copy affordance; the owner passes localized
|
|
20
|
-
* labels (this package is cordis-free, so copy arrives via props).
|
|
21
|
-
*/
|
|
22
|
-
export interface JsonTreeLabels {
|
|
23
|
-
/** Menu item: copy the raw primitive value. */
|
|
24
|
-
copyValue: string
|
|
25
|
-
/** Menu item: copy the value as compact JSON (primitive rows). */
|
|
26
|
-
copyJson: string
|
|
27
|
-
/** Menu item: copy the property path. */
|
|
28
|
-
copyPath: string
|
|
29
|
-
/** Menu item: copy the value as pretty-printed JSON. */
|
|
30
|
-
copyPrettyJson: string
|
|
31
|
-
/** Menu item: copy the value as compact JSON (object rows). */
|
|
32
|
-
copyCompactJson: string
|
|
33
|
-
/** Copy-button state label after a successful copy. */
|
|
34
|
-
copied: string
|
|
35
|
-
/** Copy-button state label after a failed copy. */
|
|
36
|
-
copyFailed: string
|
|
37
|
-
/** Expander aria label while expanded. */
|
|
38
|
-
collapseNode: string
|
|
39
|
-
/** Expander aria label while collapsed. */
|
|
40
|
-
expandNode: string
|
|
41
|
-
/** Copy-button tooltip, given the current action label. */
|
|
42
|
-
copyButtonTitle: (action: string) => string
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function valueCopyMenuItems(labels: JsonTreeLabels): readonly MenuEntry[] {
|
|
46
|
-
return [
|
|
47
|
-
{ id: 'value', label: labels.copyValue },
|
|
48
|
-
{ id: 'json', label: labels.copyJson },
|
|
49
|
-
{ id: 'path', label: labels.copyPath },
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function objectCopyMenuItems(labels: JsonTreeLabels): readonly MenuEntry[] {
|
|
54
|
-
return [
|
|
55
|
-
{ id: 'prettyJson', label: labels.copyPrettyJson },
|
|
56
|
-
{ id: 'json', label: labels.copyCompactJson },
|
|
57
|
-
{ id: 'path', label: labels.copyPath },
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
type JsonPath = readonly (number | string)[]
|
|
62
|
-
|
|
63
|
-
interface RowTarget {
|
|
64
|
-
path: JsonPath
|
|
65
|
-
value: unknown
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
type CopyMode = 'json' | 'path' | 'prettyJson' | 'value'
|
|
69
|
-
|
|
70
|
-
interface CopySnapshot {
|
|
71
|
-
id: string
|
|
72
|
-
target: RowTarget
|
|
73
|
-
state: 'idle' | 'copied' | 'failed'
|
|
74
|
-
menuOpen: boolean
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** Notify only the old and new row actions; JSON values do not subscribe to hover state. */
|
|
78
|
-
function createCopyStore() {
|
|
79
|
-
let current: CopySnapshot | undefined
|
|
80
|
-
const listeners = new Map<string, Set<() => void>>()
|
|
81
|
-
return {
|
|
82
|
-
get: () => current,
|
|
83
|
-
set(next: CopySnapshot | undefined) {
|
|
84
|
-
const previous = current?.id
|
|
85
|
-
current = next
|
|
86
|
-
for (const id of new Set([previous, next?.id])) {
|
|
87
|
-
if (id === undefined) continue
|
|
88
|
-
for (const listener of listeners.get(id) ?? []) listener()
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
subscribe(id: string, listener: () => void) {
|
|
92
|
-
let row = listeners.get(id)
|
|
93
|
-
if (row === undefined) listeners.set(id, row = new Set())
|
|
94
|
-
row.add(listener)
|
|
95
|
-
return () => {
|
|
96
|
-
row.delete(listener)
|
|
97
|
-
if (row.size === 0) listeners.delete(id)
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function JsonCopyAction({ store, target, persistent, labels, onCopy, onClose }: {
|
|
104
|
-
store: ReturnType<typeof createCopyStore>
|
|
105
|
-
target: RowTarget
|
|
106
|
-
persistent: boolean
|
|
107
|
-
labels: JsonTreeLabels
|
|
108
|
-
onCopy: (target: RowTarget, mode: CopyMode) => Promise<void>
|
|
109
|
-
onClose: () => void
|
|
110
|
-
}) {
|
|
111
|
-
const id = pathId(target.path)
|
|
112
|
-
const subscribe = useCallback((listener: () => void) => store.subscribe(id, listener), [id, store])
|
|
113
|
-
const getSnapshot = () => {
|
|
114
|
-
const current = store.get()
|
|
115
|
-
return current?.id === id ? current : undefined
|
|
116
|
-
}
|
|
117
|
-
const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot)
|
|
118
|
-
const buttonRef = useRef<HTMLButtonElement>(null)
|
|
119
|
-
const state = snapshot?.state ?? 'idle'
|
|
120
|
-
const object = typeof target.value === 'object' && target.value !== null
|
|
121
|
-
const copyTitle = state === 'copied'
|
|
122
|
-
? labels.copied
|
|
123
|
-
: state === 'failed'
|
|
124
|
-
? labels.copyFailed
|
|
125
|
-
: object ? labels.copyPrettyJson : labels.copyValue
|
|
126
|
-
return (
|
|
127
|
-
<span className={css.copySlot}>
|
|
128
|
-
{(persistent || snapshot !== undefined) && (
|
|
129
|
-
<Menu
|
|
130
|
-
open={snapshot?.menuOpen === true}
|
|
131
|
-
compact
|
|
132
|
-
portal
|
|
133
|
-
align="end"
|
|
134
|
-
anchor={(
|
|
135
|
-
<button
|
|
136
|
-
ref={buttonRef}
|
|
137
|
-
type="button"
|
|
138
|
-
className={css.actionButton}
|
|
139
|
-
data-json-copy-button
|
|
140
|
-
data-state={state}
|
|
141
|
-
aria-label={copyTitle}
|
|
142
|
-
title={labels.copyButtonTitle(copyTitle)}
|
|
143
|
-
onClick={() => void onCopy(target, object ? 'prettyJson' : 'value')}
|
|
144
|
-
onContextMenu={(event) => {
|
|
145
|
-
event.preventDefault()
|
|
146
|
-
event.stopPropagation()
|
|
147
|
-
store.set({ id, target, state, menuOpen: true })
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
150
|
-
{state === 'copied'
|
|
151
|
-
? <IconCheckOutlineRegular size={12} />
|
|
152
|
-
: <IconCopyOutlineRegular size={12} />}
|
|
153
|
-
</button>
|
|
154
|
-
)}
|
|
155
|
-
items={object ? objectCopyMenuItems(labels) : valueCopyMenuItems(labels)}
|
|
156
|
-
onSelect={(mode) => {
|
|
157
|
-
void onCopy(target, mode as CopyMode)
|
|
158
|
-
}}
|
|
159
|
-
onClose={onClose}
|
|
160
|
-
anchorRef={buttonRef}
|
|
161
|
-
/>
|
|
162
|
-
)}
|
|
163
|
-
</span>
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function isExpandableValue(value: unknown): value is object | unknown[] {
|
|
168
|
-
return typeof value === 'object' && value !== null && !(value instanceof Date)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function entriesOf(value: object | unknown[]): readonly (readonly [string, unknown])[] {
|
|
172
|
-
if (Array.isArray(value)) {
|
|
173
|
-
return value.map((item, index) => [String(index), item] as const)
|
|
174
|
-
}
|
|
175
|
-
return Object.keys(value).map(key => [
|
|
176
|
-
key,
|
|
177
|
-
(value as Record<string, unknown>)[key],
|
|
178
|
-
] as const)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function bracketOf(value: object | unknown[]): readonly [string, string] {
|
|
182
|
-
return Array.isArray(value) ? ['[', ']'] : ['{', '}']
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function previewPrimitive(value: unknown): ReactNode {
|
|
186
|
-
if (value === null) return <span className={css.keywordValue}>null</span>
|
|
187
|
-
if (typeof value === 'string') {
|
|
188
|
-
return <span className={css.stringValue}>{JSON.stringify(value)}</span>
|
|
189
|
-
}
|
|
190
|
-
if (typeof value === 'number') {
|
|
191
|
-
return <span className={css.numberValue}>{String(value)}</span>
|
|
192
|
-
}
|
|
193
|
-
if (typeof value === 'boolean') {
|
|
194
|
-
return <span className={css.keywordValue}>{String(value)}</span>
|
|
195
|
-
}
|
|
196
|
-
if (typeof value === 'bigint') {
|
|
197
|
-
return <span className={css.otherValue}>{value.toString()}</span>
|
|
198
|
-
}
|
|
199
|
-
if (typeof value === 'undefined') {
|
|
200
|
-
return <span className={css.otherValue}>undefined</span>
|
|
201
|
-
}
|
|
202
|
-
if (typeof value === 'symbol') {
|
|
203
|
-
return <span className={css.otherValue}>{value.description ?? 'Symbol'}</span>
|
|
204
|
-
}
|
|
205
|
-
if (typeof value === 'function') {
|
|
206
|
-
return <span className={css.otherValue}>{value.name || 'Function'}</span>
|
|
207
|
-
}
|
|
208
|
-
return null
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function previewValue(value: unknown, depth: number): ReactNode {
|
|
212
|
-
if (!isExpandableValue(value)) return previewPrimitive(value)
|
|
213
|
-
|
|
214
|
-
const array = Array.isArray(value)
|
|
215
|
-
const entries = entriesOf(value)
|
|
216
|
-
const limit = array ? ARRAY_PREVIEW_LIMIT : OBJECT_PREVIEW_LIMIT
|
|
217
|
-
const visible = entries.slice(0, limit)
|
|
218
|
-
const [open, close] = bracketOf(value)
|
|
219
|
-
|
|
220
|
-
return (
|
|
221
|
-
<>
|
|
222
|
-
<span className={css.punctuation}>{open}</span>
|
|
223
|
-
{depth >= PREVIEW_DEPTH_LIMIT
|
|
224
|
-
? <span className={css.previewEllipsis}>…</span>
|
|
225
|
-
: visible.map(([key, item], index) => (
|
|
226
|
-
<span key={key}>
|
|
227
|
-
{index > 0 && <span className={css.punctuation}>, </span>}
|
|
228
|
-
{!array && (
|
|
229
|
-
<>
|
|
230
|
-
<span className={css.previewProperty}>{key}</span>
|
|
231
|
-
<span className={css.punctuation}>: </span>
|
|
232
|
-
</>
|
|
233
|
-
)}
|
|
234
|
-
{previewValue(item, depth + 1)}
|
|
235
|
-
</span>
|
|
236
|
-
))}
|
|
237
|
-
{depth < PREVIEW_DEPTH_LIMIT && entries.length > limit && (
|
|
238
|
-
<span className={css.previewEllipsis}>, …</span>
|
|
239
|
-
)}
|
|
240
|
-
<span className={css.punctuation}>{close}</span>
|
|
241
|
-
</>
|
|
242
|
-
)
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function primitiveValue(value: unknown): ReactNode {
|
|
246
|
-
if (value === null) return <span className={css.keywordValue}>null</span>
|
|
247
|
-
if (typeof value === 'string') {
|
|
248
|
-
return <span className={css.stringValue}>{JSON.stringify(value)}</span>
|
|
249
|
-
}
|
|
250
|
-
if (typeof value === 'boolean') {
|
|
251
|
-
return <span className={css.keywordValue}>{String(value)}</span>
|
|
252
|
-
}
|
|
253
|
-
if (typeof value === 'number') {
|
|
254
|
-
return <span className={css.numberValue}>{String(value)}</span>
|
|
255
|
-
}
|
|
256
|
-
if (typeof value === 'bigint') {
|
|
257
|
-
return <span className={css.numberValue}>{`${value.toString()}n`}</span>
|
|
258
|
-
}
|
|
259
|
-
if (value instanceof Date) {
|
|
260
|
-
return <span className={css.otherValue}>{value.toISOString()}</span>
|
|
261
|
-
}
|
|
262
|
-
if (typeof value === 'function') {
|
|
263
|
-
return <span className={css.otherValue}>function() {'{ }'}</span>
|
|
264
|
-
}
|
|
265
|
-
if (typeof value === 'undefined') {
|
|
266
|
-
return <span className={css.otherValue}>undefined</span>
|
|
267
|
-
}
|
|
268
|
-
return <span className={css.otherValue}>{(value as symbol).toString()}</span>
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function fieldText(field: string): string {
|
|
272
|
-
return field === '' ? '""' : field
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
function pathId(path: JsonPath): string {
|
|
276
|
-
return path.map(part => (
|
|
277
|
-
typeof part === 'number' ? `n${String(part)}` : `s${String(part.length)}:${part}`
|
|
278
|
-
)).join('/')
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function claimFocus(button: HTMLElement): void {
|
|
282
|
-
button.focus()
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function moveFocus(button: HTMLElement, direction: -1 | 1): void {
|
|
286
|
-
const tree = button.closest<HTMLElement>('[role="tree"]')
|
|
287
|
-
/* v8 ignore next -- JsonTree attaches expander handlers only beneath its owning role=tree. */
|
|
288
|
-
if (tree === null) return
|
|
289
|
-
const expanders = Array.from(tree.querySelectorAll<HTMLElement>('[data-json-expander]'))
|
|
290
|
-
const current = expanders.indexOf(button)
|
|
291
|
-
/* v8 ignore next -- the current expander is a member of the queried non-empty set. */
|
|
292
|
-
if (current < 0 || expanders.length === 0) return
|
|
293
|
-
const next = (current + direction + expanders.length) % expanders.length
|
|
294
|
-
const nextExpander = expanders[next]
|
|
295
|
-
/* v8 ignore next -- modulo over the non-empty expander set always resolves a member. */
|
|
296
|
-
if (nextExpander !== undefined) claimFocus(nextExpander)
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function NodeField({
|
|
300
|
-
field,
|
|
301
|
-
expandable,
|
|
302
|
-
onToggle,
|
|
303
|
-
}: {
|
|
304
|
-
field: string | undefined
|
|
305
|
-
expandable: boolean
|
|
306
|
-
onToggle: () => void
|
|
307
|
-
}) {
|
|
308
|
-
if (field === undefined) return null
|
|
309
|
-
return (
|
|
310
|
-
<span
|
|
311
|
-
className={clsx(css.label, expandable && css.clickableLabel)}
|
|
312
|
-
onClick={expandable ? onToggle : undefined}
|
|
313
|
-
>
|
|
314
|
-
{fieldText(field)}:
|
|
315
|
-
</span>
|
|
316
|
-
)
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
interface JsonTreeNodeProps {
|
|
320
|
-
collapsedStringLines: number
|
|
321
|
-
stringWrapping: JsonTreeProps['stringWrapping']
|
|
322
|
-
field?: string
|
|
323
|
-
initialExpanded: boolean
|
|
324
|
-
labels: JsonTreeLabels
|
|
325
|
-
lastElement: boolean
|
|
326
|
-
onClaimTabStop: (id: string) => void
|
|
327
|
-
onRowHover: (row: HTMLElement, target: RowTarget) => void
|
|
328
|
-
path: JsonPath
|
|
329
|
-
renderCopy: ((target: RowTarget, persistent?: boolean) => ReactNode) | undefined
|
|
330
|
-
tabStopId: string | null
|
|
331
|
-
value: unknown
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function JsonString({
|
|
335
|
-
collapsedStringLines,
|
|
336
|
-
stringWrapping,
|
|
337
|
-
field,
|
|
338
|
-
labels,
|
|
339
|
-
lastElement,
|
|
340
|
-
renderCopy,
|
|
341
|
-
value,
|
|
342
|
-
}: {
|
|
343
|
-
collapsedStringLines: number
|
|
344
|
-
stringWrapping: JsonTreeProps['stringWrapping']
|
|
345
|
-
field: string | undefined
|
|
346
|
-
labels: JsonTreeLabels
|
|
347
|
-
lastElement: boolean
|
|
348
|
-
renderCopy: ((persistent?: boolean) => ReactNode) | undefined
|
|
349
|
-
value: string
|
|
350
|
-
}) {
|
|
351
|
-
const contentsId = useId()
|
|
352
|
-
const contentRef = useRef<HTMLSpanElement>(null)
|
|
353
|
-
const rawRef = useRef<HTMLPreElement>(null)
|
|
354
|
-
const [expanded, setExpanded] = useState(false)
|
|
355
|
-
const [wrapped, setWrapped] = useState(false)
|
|
356
|
-
const [truncated, setTruncated] = useState(false)
|
|
357
|
-
|
|
358
|
-
useLayoutEffect(() => {
|
|
359
|
-
if (expanded) return
|
|
360
|
-
const content = contentRef.current as HTMLSpanElement
|
|
361
|
-
const measure = () => {
|
|
362
|
-
const lineHeight = Number.parseFloat(getComputedStyle(content).lineHeight)
|
|
363
|
-
setTruncated(content.scrollHeight > lineHeight * collapsedStringLines)
|
|
364
|
-
}
|
|
365
|
-
measure()
|
|
366
|
-
if (typeof ResizeObserver === 'undefined') return
|
|
367
|
-
const observer = new ResizeObserver(measure)
|
|
368
|
-
observer.observe(content)
|
|
369
|
-
return () => { observer.disconnect() }
|
|
370
|
-
}, [collapsedStringLines, expanded, field, lastElement, value])
|
|
371
|
-
|
|
372
|
-
useLayoutEffect(() => {
|
|
373
|
-
if (!expanded) return
|
|
374
|
-
const raw = rawRef.current as HTMLPreElement
|
|
375
|
-
// Keep raw text within the window and clipping ancestors outside the tree.
|
|
376
|
-
// Capture scrolling because an ancestor can move the string without resizing it.
|
|
377
|
-
const clips: HTMLElement[] = []
|
|
378
|
-
const tree = raw.closest<HTMLElement>(`.${css.root}`) as HTMLElement
|
|
379
|
-
for (let parent = tree.parentElement; parent !== null; parent = parent.parentElement) {
|
|
380
|
-
if (/auto|scroll|hidden|clip/.test(getComputedStyle(parent).overflowY)) clips.push(parent)
|
|
381
|
-
}
|
|
382
|
-
const measure = () => {
|
|
383
|
-
let top = 0
|
|
384
|
-
let bottom = window.innerHeight
|
|
385
|
-
for (const clip of clips) {
|
|
386
|
-
const rect = clip.getBoundingClientRect()
|
|
387
|
-
const style = getComputedStyle(clip)
|
|
388
|
-
top = Math.max(top, rect.top + clip.clientTop)
|
|
389
|
-
bottom = Math.min(bottom, rect.top + clip.clientTop + clip.clientHeight
|
|
390
|
-
- Number.parseFloat(style.paddingBottom))
|
|
391
|
-
}
|
|
392
|
-
const available = bottom - Math.max(top, raw.getBoundingClientRect().top)
|
|
393
|
-
raw.style.maxHeight = `${Math.max(16, available - 4)}px`
|
|
394
|
-
}
|
|
395
|
-
measure()
|
|
396
|
-
const observer = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(measure)
|
|
397
|
-
observer?.observe(raw)
|
|
398
|
-
for (const clip of clips) observer?.observe(clip)
|
|
399
|
-
window.addEventListener('resize', measure)
|
|
400
|
-
window.addEventListener('scroll', measure, true)
|
|
401
|
-
return () => {
|
|
402
|
-
observer?.disconnect()
|
|
403
|
-
window.removeEventListener('resize', measure)
|
|
404
|
-
window.removeEventListener('scroll', measure, true)
|
|
405
|
-
}
|
|
406
|
-
}, [expanded, value])
|
|
407
|
-
|
|
408
|
-
if (expanded) {
|
|
409
|
-
const fieldId = `${contentsId}-field`
|
|
410
|
-
return (
|
|
411
|
-
<div className={css.stringField} data-expanded>
|
|
412
|
-
{field !== undefined && <span id={fieldId} className={css.label}>{fieldText(field)}:</span>}
|
|
413
|
-
<pre
|
|
414
|
-
ref={rawRef}
|
|
415
|
-
id={contentsId}
|
|
416
|
-
className={css.stringRaw}
|
|
417
|
-
data-wrap={wrapped}
|
|
418
|
-
tabIndex={0}
|
|
419
|
-
aria-labelledby={field === undefined ? undefined : fieldId}
|
|
420
|
-
>
|
|
421
|
-
{value}
|
|
422
|
-
</pre>
|
|
423
|
-
{!lastElement && <span className={css.punctuation}>,</span>}
|
|
424
|
-
<div className={css.stringActions}>
|
|
425
|
-
{stringWrapping !== undefined && (
|
|
426
|
-
<button
|
|
427
|
-
type="button"
|
|
428
|
-
className={css.actionButton}
|
|
429
|
-
aria-label={stringWrapping.label}
|
|
430
|
-
title={stringWrapping.label}
|
|
431
|
-
aria-pressed={wrapped}
|
|
432
|
-
aria-controls={contentsId}
|
|
433
|
-
onClick={() => {
|
|
434
|
-
const next = !wrapped
|
|
435
|
-
setWrapped(next)
|
|
436
|
-
stringWrapping.setDefault(next)
|
|
437
|
-
}}
|
|
438
|
-
>
|
|
439
|
-
<IconWrapLinesOutlineRegular size={12} />
|
|
440
|
-
</button>
|
|
441
|
-
)}
|
|
442
|
-
<button
|
|
443
|
-
type="button"
|
|
444
|
-
className={css.actionButton}
|
|
445
|
-
aria-label={labels.collapseNode}
|
|
446
|
-
title={labels.collapseNode}
|
|
447
|
-
aria-expanded
|
|
448
|
-
aria-controls={contentsId}
|
|
449
|
-
onClick={() => { setExpanded(false) }}
|
|
450
|
-
>
|
|
451
|
-
<svg
|
|
452
|
-
width="12"
|
|
453
|
-
height="12"
|
|
454
|
-
viewBox="0 0 16 16"
|
|
455
|
-
fill="none"
|
|
456
|
-
stroke="currentColor"
|
|
457
|
-
aria-hidden="true"
|
|
458
|
-
>
|
|
459
|
-
<path d="M9.5 1.5V6.5H14.5M1.5 9.5H6.5V14.5" />
|
|
460
|
-
</svg>
|
|
461
|
-
</button>
|
|
462
|
-
{renderCopy?.(true)}
|
|
463
|
-
</div>
|
|
464
|
-
</div>
|
|
465
|
-
)
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
return (
|
|
469
|
-
<>
|
|
470
|
-
{renderCopy?.()}
|
|
471
|
-
<span className={css.stringField} data-expanded={expanded}>
|
|
472
|
-
<span ref={contentRef} id={contentsId} className={css.stringText}>
|
|
473
|
-
{truncated && (
|
|
474
|
-
<span className={css.stringToggleSlot}>
|
|
475
|
-
<button
|
|
476
|
-
type="button"
|
|
477
|
-
className={css.stringToggle}
|
|
478
|
-
aria-label={labels.expandNode}
|
|
479
|
-
aria-expanded={false}
|
|
480
|
-
aria-controls={contentsId}
|
|
481
|
-
onClick={() => {
|
|
482
|
-
setWrapped(stringWrapping?.getDefault() ?? false)
|
|
483
|
-
setExpanded(true)
|
|
484
|
-
}}
|
|
485
|
-
>
|
|
486
|
-
<span aria-hidden="true">…</span>{labels.expandNode}
|
|
487
|
-
</button>
|
|
488
|
-
</span>
|
|
489
|
-
)}
|
|
490
|
-
{field !== undefined && <span className={css.label}>{fieldText(field)}:</span>}
|
|
491
|
-
{primitiveValue(value)}
|
|
492
|
-
{!lastElement && <span className={css.punctuation}>,</span>}
|
|
493
|
-
</span>
|
|
494
|
-
</span>
|
|
495
|
-
</>
|
|
496
|
-
)
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
function JsonTreeNode({
|
|
500
|
-
collapsedStringLines,
|
|
501
|
-
stringWrapping,
|
|
502
|
-
field,
|
|
503
|
-
initialExpanded,
|
|
504
|
-
labels,
|
|
505
|
-
lastElement,
|
|
506
|
-
onClaimTabStop,
|
|
507
|
-
onRowHover,
|
|
508
|
-
path,
|
|
509
|
-
renderCopy,
|
|
510
|
-
tabStopId,
|
|
511
|
-
value,
|
|
512
|
-
}: JsonTreeNodeProps) {
|
|
513
|
-
const contentsId = useId()
|
|
514
|
-
const expanderRef = useRef<HTMLSpanElement>(null)
|
|
515
|
-
const [expanded, setExpanded] = useState(initialExpanded)
|
|
516
|
-
const nodeId = pathId(path)
|
|
517
|
-
const container = isExpandableValue(value)
|
|
518
|
-
const entries = container ? entriesOf(value) : []
|
|
519
|
-
const expandable = entries.length > 0
|
|
520
|
-
|
|
521
|
-
const toggle = () => {
|
|
522
|
-
setExpanded(current => !current)
|
|
523
|
-
claimFocus(expanderRef.current as HTMLSpanElement)
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
const onExpanderKeyDown = (event: ReactKeyboardEvent<HTMLSpanElement>) => {
|
|
527
|
-
if (event.key === 'ArrowRight' || event.key === 'ArrowLeft') {
|
|
528
|
-
event.preventDefault()
|
|
529
|
-
setExpanded(event.key === 'ArrowRight')
|
|
530
|
-
return
|
|
531
|
-
}
|
|
532
|
-
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
|
533
|
-
event.preventDefault()
|
|
534
|
-
moveFocus(event.currentTarget, event.key === 'ArrowUp' ? -1 : 1)
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
const row = (children: ReactNode, ariaExpanded?: boolean) => (
|
|
539
|
-
<div
|
|
540
|
-
className={css.row}
|
|
541
|
-
role="treeitem"
|
|
542
|
-
aria-expanded={ariaExpanded}
|
|
543
|
-
onMouseOver={(event) => {
|
|
544
|
-
event.stopPropagation()
|
|
545
|
-
onRowHover(event.currentTarget, { path, value })
|
|
546
|
-
}}
|
|
547
|
-
>
|
|
548
|
-
{typeof value !== 'string' && renderCopy?.({ path, value })}
|
|
549
|
-
{children}
|
|
550
|
-
</div>
|
|
551
|
-
)
|
|
552
|
-
|
|
553
|
-
if (typeof value === 'string') {
|
|
554
|
-
return row(
|
|
555
|
-
<JsonString
|
|
556
|
-
collapsedStringLines={collapsedStringLines}
|
|
557
|
-
stringWrapping={stringWrapping}
|
|
558
|
-
field={field}
|
|
559
|
-
value={value}
|
|
560
|
-
labels={labels}
|
|
561
|
-
lastElement={lastElement}
|
|
562
|
-
renderCopy={renderCopy === undefined ? undefined : persistent => renderCopy({ path, value }, persistent)}
|
|
563
|
-
/>,
|
|
564
|
-
)
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
if (!container) {
|
|
568
|
-
return row((
|
|
569
|
-
<>
|
|
570
|
-
<NodeField field={field} expandable={false} onToggle={toggle} />
|
|
571
|
-
{primitiveValue(value)}
|
|
572
|
-
{!lastElement && <span className={css.punctuation}>,</span>}
|
|
573
|
-
</>
|
|
574
|
-
))
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
const [open, close] = bracketOf(value)
|
|
578
|
-
if (!expandable) {
|
|
579
|
-
return row((
|
|
580
|
-
<>
|
|
581
|
-
<NodeField field={field} expandable={false} onToggle={toggle} />
|
|
582
|
-
<span className={css.punctuation}>{open}</span>
|
|
583
|
-
<span className={css.punctuation}>{close}</span>
|
|
584
|
-
{!lastElement && <span className={css.punctuation}>,</span>}
|
|
585
|
-
</>
|
|
586
|
-
))
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
return row((
|
|
590
|
-
<>
|
|
591
|
-
<span
|
|
592
|
-
ref={expanderRef}
|
|
593
|
-
className={clsx(css.expander, expanded ? css.collapseIcon : css.expandIcon)}
|
|
594
|
-
data-json-expander
|
|
595
|
-
role="button"
|
|
596
|
-
aria-label={expanded ? labels.collapseNode : labels.expandNode}
|
|
597
|
-
aria-expanded={expanded}
|
|
598
|
-
aria-controls={expanded ? contentsId : undefined}
|
|
599
|
-
tabIndex={tabStopId === nodeId ? 0 : -1}
|
|
600
|
-
onFocus={() => { onClaimTabStop(nodeId) }}
|
|
601
|
-
onClick={toggle}
|
|
602
|
-
onKeyDown={onExpanderKeyDown}
|
|
603
|
-
/>
|
|
604
|
-
<span className={css.summary}>
|
|
605
|
-
<NodeField field={field} expandable onToggle={toggle} />
|
|
606
|
-
<span className={css.preview}>{previewValue(value, 0)}</span>
|
|
607
|
-
{!lastElement && <span className={css.punctuation}>,</span>}
|
|
608
|
-
</span>
|
|
609
|
-
{expanded && (
|
|
610
|
-
<ul id={contentsId} role="group" className={css.children}>
|
|
611
|
-
{entries.map(([key, item], index) => (
|
|
612
|
-
<JsonTreeNode
|
|
613
|
-
key={key}
|
|
614
|
-
collapsedStringLines={collapsedStringLines}
|
|
615
|
-
stringWrapping={stringWrapping}
|
|
616
|
-
field={key}
|
|
617
|
-
value={item}
|
|
618
|
-
path={[...path, Array.isArray(value) ? index : key]}
|
|
619
|
-
labels={labels}
|
|
620
|
-
lastElement={index === entries.length - 1}
|
|
621
|
-
initialExpanded={false}
|
|
622
|
-
tabStopId={tabStopId}
|
|
623
|
-
onClaimTabStop={onClaimTabStop}
|
|
624
|
-
onRowHover={onRowHover}
|
|
625
|
-
renderCopy={renderCopy}
|
|
626
|
-
/>
|
|
627
|
-
))}
|
|
628
|
-
</ul>
|
|
629
|
-
)}
|
|
630
|
-
</>
|
|
631
|
-
), expanded)
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
function formattedPath(path: JsonPath): string {
|
|
635
|
-
return path.reduce<string>((result, part) => {
|
|
636
|
-
if (typeof part === 'number') return `${result}[${String(part)}]`
|
|
637
|
-
return /^[A-Za-z_$][\w$]*$/.test(part)
|
|
638
|
-
? `${result}.${part}`
|
|
639
|
-
: `${result}[${JSON.stringify(part)}]`
|
|
640
|
-
}, '$')
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
function copyText(target: RowTarget, mode: CopyMode): string {
|
|
644
|
-
if (mode === 'path') return formattedPath(target.path)
|
|
645
|
-
if (mode === 'prettyJson') return JSON.stringify(target.value, null, 2)
|
|
646
|
-
if (mode === 'json') return JSON.stringify(target.value)
|
|
647
|
-
if (typeof target.value === 'string') return target.value
|
|
648
|
-
if (typeof target.value === 'undefined') return 'undefined'
|
|
649
|
-
if (typeof target.value === 'bigint') return target.value.toString()
|
|
650
|
-
if (typeof target.value === 'symbol') return target.value.description ?? 'Symbol'
|
|
651
|
-
if (typeof target.value === 'function') return target.value.name || 'Function'
|
|
652
|
-
return JSON.stringify(target.value)
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
/** Props for the read-only, token-themed JSON tree. */
|
|
656
|
-
export interface JsonTreeProps {
|
|
657
|
-
/** Parsed JSON object or array. */
|
|
658
|
-
data: object | unknown[]
|
|
659
|
-
/** Accessible label for the tree. */
|
|
660
|
-
label: string
|
|
661
|
-
/** Optional positioning class owned by the caller. */
|
|
662
|
-
className?: string | undefined
|
|
663
|
-
/** Maximum visible lines per collapsed string; defaults to 3. */
|
|
664
|
-
collapsedStringLines?: number
|
|
665
|
-
/** Optional wrap toggle; each expansion reads the shared default without changing other open strings. */
|
|
666
|
-
stringWrapping?: {
|
|
667
|
-
/** Localized label for the wrapping toggle. */
|
|
668
|
-
label: string
|
|
669
|
-
/** Read the wrapping preference when a string is expanded. @returns Whether to wrap long lines. */
|
|
670
|
-
getDefault: () => boolean
|
|
671
|
-
/** Remember a user toggle for future expansions. @param wrapped - Whether to wrap long lines. */
|
|
672
|
-
setDefault: (wrapped: boolean) => void
|
|
673
|
-
} | undefined
|
|
674
|
-
/** Whether JSON rows expose copy actions. */
|
|
675
|
-
copyable?: boolean
|
|
676
|
-
/** Whether the top-level object or array is always expanded. */
|
|
677
|
-
expandTopLevel?: boolean
|
|
678
|
-
/** Localized display copy supplied by the owning render site. */
|
|
679
|
-
labels: JsonTreeLabels
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
/**
|
|
683
|
-
* Render parsed JSON as a compact, keyboard-accessible inspector tree.
|
|
684
|
-
* @param props - Parsed data, accessible label, and display options.
|
|
685
|
-
* @returns A read-only JSON tree with an optionally fixed-open top level.
|
|
686
|
-
*/
|
|
687
|
-
export function JsonTree({
|
|
688
|
-
data,
|
|
689
|
-
label,
|
|
690
|
-
className,
|
|
691
|
-
collapsedStringLines = 3,
|
|
692
|
-
stringWrapping,
|
|
693
|
-
copyable = true,
|
|
694
|
-
expandTopLevel = true,
|
|
695
|
-
labels,
|
|
696
|
-
}: JsonTreeProps) {
|
|
697
|
-
const rootEntries = entriesOf(data)
|
|
698
|
-
const firstExpandableIndex = rootEntries.findIndex(([, value]) => (
|
|
699
|
-
isExpandableValue(value) && entriesOf(value).length > 0
|
|
700
|
-
))
|
|
701
|
-
const firstExpandableEntry = rootEntries[firstExpandableIndex]
|
|
702
|
-
const initialTabStopId = expandTopLevel
|
|
703
|
-
? firstExpandableEntry === undefined
|
|
704
|
-
? null
|
|
705
|
-
: pathId([Array.isArray(data) ? firstExpandableIndex : firstExpandableEntry[0]])
|
|
706
|
-
: isExpandableValue(data) && rootEntries.length > 0 ? pathId([]) : null
|
|
707
|
-
const activeRowRef = useRef<HTMLElement>()
|
|
708
|
-
const resetTimer = useRef<ReturnType<typeof setTimeout>>()
|
|
709
|
-
const copySequence = useRef(0)
|
|
710
|
-
const [copyStore] = useState(createCopyStore)
|
|
711
|
-
const [tabStopId, setTabStopId] = useState<string | null>(initialTabStopId)
|
|
712
|
-
|
|
713
|
-
const setActiveRow = (row: HTMLElement | undefined) => {
|
|
714
|
-
activeRowRef.current?.removeAttribute('data-json-copy-active')
|
|
715
|
-
activeRowRef.current = row
|
|
716
|
-
row?.setAttribute('data-json-copy-active', '')
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
const clearCopyTarget = () => {
|
|
720
|
-
copySequence.current += 1
|
|
721
|
-
if (resetTimer.current !== undefined) clearTimeout(resetTimer.current)
|
|
722
|
-
setActiveRow(undefined)
|
|
723
|
-
copyStore.set(undefined)
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
useEffect(() => () => {
|
|
727
|
-
copySequence.current += 1
|
|
728
|
-
if (resetTimer.current !== undefined) clearTimeout(resetTimer.current)
|
|
729
|
-
activeRowRef.current?.removeAttribute('data-json-copy-active')
|
|
730
|
-
}, [])
|
|
731
|
-
|
|
732
|
-
useEffect(() => {
|
|
733
|
-
clearCopyTarget()
|
|
734
|
-
setTabStopId(initialTabStopId)
|
|
735
|
-
}, [data, expandTopLevel, initialTabStopId])
|
|
736
|
-
|
|
737
|
-
const handleRowHover = (row: HTMLElement, target: RowTarget) => {
|
|
738
|
-
if (!copyable || copyStore.get()?.menuOpen) return
|
|
739
|
-
if (activeRowRef.current === row) return
|
|
740
|
-
setActiveRow(row)
|
|
741
|
-
copyStore.set({ id: pathId(target.path), target, state: 'idle', menuOpen: false })
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
const handleRootMouseOver = (event: ReactMouseEvent<HTMLDivElement>) => {
|
|
745
|
-
if (!copyable || copyStore.get()?.menuOpen) return
|
|
746
|
-
/* v8 ignore next -- browser mouse events delivered through React target an Element. */
|
|
747
|
-
if (!(event.target instanceof Element)) return
|
|
748
|
-
if (event.target.closest('[data-json-copy-button]') === null) clearCopyTarget()
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
const copy = async (target: RowTarget, mode: CopyMode) => {
|
|
752
|
-
const sequence = ++copySequence.current
|
|
753
|
-
const snapshot: CopySnapshot = {
|
|
754
|
-
id: pathId(target.path), target, state: 'idle', menuOpen: false,
|
|
755
|
-
}
|
|
756
|
-
copyStore.set(snapshot)
|
|
757
|
-
let state: CopySnapshot['state']
|
|
758
|
-
try {
|
|
759
|
-
await navigator.clipboard.writeText(copyText(target, mode))
|
|
760
|
-
state = 'copied'
|
|
761
|
-
} catch {
|
|
762
|
-
state = 'failed'
|
|
763
|
-
}
|
|
764
|
-
const current = copyStore.get()
|
|
765
|
-
if (sequence !== copySequence.current || current?.target !== target) return
|
|
766
|
-
copyStore.set({ ...current, state })
|
|
767
|
-
if (resetTimer.current !== undefined) clearTimeout(resetTimer.current)
|
|
768
|
-
resetTimer.current = setTimeout(() => {
|
|
769
|
-
const current = copyStore.get()
|
|
770
|
-
if (current?.target === target) copyStore.set({ ...current, state: 'idle' })
|
|
771
|
-
}, 1_500)
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
const [rootOpen, rootClose] = bracketOf(data)
|
|
775
|
-
const renderCopy = copyable ? (target: RowTarget, persistent = false) => (
|
|
776
|
-
<JsonCopyAction store={copyStore} target={target} persistent={persistent} labels={labels}
|
|
777
|
-
onCopy={copy} onClose={clearCopyTarget} />
|
|
778
|
-
) : undefined
|
|
779
|
-
|
|
780
|
-
return (
|
|
781
|
-
<div
|
|
782
|
-
className={clsx(css.root, className)}
|
|
783
|
-
style={{ '--json-tree-collapsed-lines': collapsedStringLines } as CSSProperties}
|
|
784
|
-
onMouseOver={handleRootMouseOver}
|
|
785
|
-
onMouseLeave={() => {
|
|
786
|
-
if (!copyStore.get()?.menuOpen) clearCopyTarget()
|
|
787
|
-
}}
|
|
788
|
-
>
|
|
789
|
-
{expandTopLevel
|
|
790
|
-
? (
|
|
791
|
-
<div className={css.expandedTopLevel}>
|
|
792
|
-
<div
|
|
793
|
-
className={clsx(css.row, css.topLevelBracket)}
|
|
794
|
-
data-json-root-row
|
|
795
|
-
onMouseOver={(event) => {
|
|
796
|
-
event.stopPropagation()
|
|
797
|
-
handleRowHover(event.currentTarget, { path: [], value: data })
|
|
798
|
-
}}
|
|
799
|
-
>
|
|
800
|
-
{renderCopy?.({ path: [], value: data })}
|
|
801
|
-
<span className={css.punctuation}>{rootOpen}</span>
|
|
802
|
-
</div>
|
|
803
|
-
<div
|
|
804
|
-
aria-label={label}
|
|
805
|
-
className={clsx(css.container, css.expandedTopLevelContainer)}
|
|
806
|
-
role="tree"
|
|
807
|
-
>
|
|
808
|
-
{rootEntries.map(([key, value], index) => (
|
|
809
|
-
<JsonTreeNode
|
|
810
|
-
key={key}
|
|
811
|
-
collapsedStringLines={collapsedStringLines}
|
|
812
|
-
stringWrapping={stringWrapping}
|
|
813
|
-
field={key}
|
|
814
|
-
value={value}
|
|
815
|
-
path={[Array.isArray(data) ? index : key]}
|
|
816
|
-
labels={labels}
|
|
817
|
-
lastElement={index === rootEntries.length - 1}
|
|
818
|
-
initialExpanded={false}
|
|
819
|
-
tabStopId={tabStopId}
|
|
820
|
-
onClaimTabStop={setTabStopId}
|
|
821
|
-
onRowHover={handleRowHover}
|
|
822
|
-
renderCopy={renderCopy}
|
|
823
|
-
/>
|
|
824
|
-
))}
|
|
825
|
-
</div>
|
|
826
|
-
<div className={clsx(css.row, css.topLevelBracket)}>
|
|
827
|
-
<span className={css.punctuation}>{rootClose}</span>
|
|
828
|
-
</div>
|
|
829
|
-
</div>
|
|
830
|
-
)
|
|
831
|
-
: (
|
|
832
|
-
<div aria-label={label} className={css.container} role="tree">
|
|
833
|
-
<JsonTreeNode
|
|
834
|
-
collapsedStringLines={collapsedStringLines}
|
|
835
|
-
stringWrapping={stringWrapping}
|
|
836
|
-
value={data}
|
|
837
|
-
path={[]}
|
|
838
|
-
labels={labels}
|
|
839
|
-
lastElement
|
|
840
|
-
initialExpanded
|
|
841
|
-
tabStopId={tabStopId}
|
|
842
|
-
onClaimTabStop={setTabStopId}
|
|
843
|
-
onRowHover={handleRowHover}
|
|
844
|
-
renderCopy={renderCopy}
|
|
845
|
-
/>
|
|
846
|
-
</div>
|
|
847
|
-
)}
|
|
848
|
-
</div>
|
|
849
|
-
)
|
|
850
|
-
}
|