@deepseek-ai/dsh-client-ui-primitives 0.2.3-alpha.1 → 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/Menu.tsx
DELETED
|
@@ -1,656 +0,0 @@
|
|
|
1
|
-
import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
|
2
|
-
import type { CSSProperties, ReactNode, RefObject } from 'react'
|
|
3
|
-
import { createPortal } from 'react-dom'
|
|
4
|
-
import clsx from 'clsx'
|
|
5
|
-
import { useMenuSubmenu, menuHoverAllowed } from './useMenuSubmenu.ts'
|
|
6
|
-
import { MenuRow, menuIconColumns, renderMenuDecoration } from './MenuRow.tsx'
|
|
7
|
-
import { SubmenuPanel } from './SubmenuPanel.tsx'
|
|
8
|
-
import { usePointerGrace } from './pointer-grace.ts'
|
|
9
|
-
import { isBehindModal } from './useModalLayer.ts'
|
|
10
|
-
import { observeComposition } from './keyboard-composition.ts'
|
|
11
|
-
import { focusWithoutRing } from './focus.ts'
|
|
12
|
-
import { touchModality } from './input-modality.ts'
|
|
13
|
-
import { MenuSurface } from './MenuSurface.tsx'
|
|
14
|
-
import { SearchField } from './SearchField.tsx'
|
|
15
|
-
import css from './Menu.module.css'
|
|
16
|
-
|
|
17
|
-
/** Selectable row (optionally with a nested submenu). */
|
|
18
|
-
export interface MenuItem {
|
|
19
|
-
id: string
|
|
20
|
-
label: ReactNode
|
|
21
|
-
disabled?: boolean
|
|
22
|
-
/** Effective binding supplied by the command owner; omitted for unbound actions. */
|
|
23
|
-
shortcut?: { keys: readonly string[]; aria?: string | undefined }
|
|
24
|
-
/** Leading icon (figma .Menu_cell gap 8). */
|
|
25
|
-
icon?: ReactNode
|
|
26
|
-
/** Destructive row: error-colored text/icon and danger hover fill. */
|
|
27
|
-
danger?: boolean
|
|
28
|
-
/** Child choices opened by hover, focus, click, or ArrowRight; placement follows available space. */
|
|
29
|
-
submenu?: readonly MenuEntry[]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** Hairline between item groups (not selectable). */
|
|
33
|
-
export interface MenuSeparator {
|
|
34
|
-
type: 'separator'
|
|
35
|
-
id: string
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** Non-interactive heading row above a group of items. */
|
|
39
|
-
export interface MenuLabel {
|
|
40
|
-
type: 'label'
|
|
41
|
-
id: string
|
|
42
|
-
text: string
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** One primary-menu entry: a row, a separator, or a heading label. */
|
|
46
|
-
export type MenuEntry = MenuItem | MenuSeparator | MenuLabel
|
|
47
|
-
|
|
48
|
-
/** Props for one component-rendered menu row. */
|
|
49
|
-
export interface MenuItemButtonProps {
|
|
50
|
-
/** Visible row label. */
|
|
51
|
-
children: ReactNode
|
|
52
|
-
/** Effective binding supplied by the command owner; omitted for unbound actions. */
|
|
53
|
-
shortcut?: MenuItem['shortcut']
|
|
54
|
-
/** Leading icon (figma .Menu_cell gap 8). */
|
|
55
|
-
icon?: ReactNode
|
|
56
|
-
/** Whether this row identifies the currently displayed page or view. */
|
|
57
|
-
current?: boolean
|
|
58
|
-
/** Whether the row cannot be activated. */
|
|
59
|
-
disabled?: boolean
|
|
60
|
-
/**
|
|
61
|
-
* Why the disabled row cannot be activated. The row then stays hoverable and
|
|
62
|
-
* focusable, shows the reason in a tooltip, and exposes it as the row's
|
|
63
|
-
* description; an enabled row ignores it.
|
|
64
|
-
*/
|
|
65
|
-
disabledReason?: string | undefined
|
|
66
|
-
/** Destructive row: error-colored text/icon and danger hover fill. */
|
|
67
|
-
danger?: boolean
|
|
68
|
-
/**
|
|
69
|
-
* Start a new group: a hairline above this row, the same one a
|
|
70
|
-
* `{ type: 'separator' }` data entry draws. It comes and goes with the row,
|
|
71
|
-
* so a row that renders nothing leaves no stray line; a data separator
|
|
72
|
-
* directly before it draws no second line, and the list's first row draws none.
|
|
73
|
-
*/
|
|
74
|
-
separatorBefore?: boolean
|
|
75
|
-
/** Row activation (click, Enter, or Tab on the focused row). */
|
|
76
|
-
onSelect: () => void
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Render one `role="menuitem"` row for a {@link Menu} whose rows are
|
|
81
|
-
* components rather than `items` data: the same markup and styling as a data
|
|
82
|
-
* row, so it joins the list's keyboard walk and post-selection focus return
|
|
83
|
-
* without any shared state. Closing the menu stays the owner's decision, as
|
|
84
|
-
* it is for data rows.
|
|
85
|
-
* @param props.children - visible row label.
|
|
86
|
-
* @param props.shortcut - effective key labels and accessible combination.
|
|
87
|
-
* @param props.icon - optional leading icon.
|
|
88
|
-
* @param props.current - whether the row identifies the currently displayed page or view.
|
|
89
|
-
* @param props.disabled - whether the row cannot be activated.
|
|
90
|
-
* @param props.disabledReason - why a disabled row cannot be activated, shown in a tooltip and read as its description.
|
|
91
|
-
* @param props.danger - whether to use the destructive row colors.
|
|
92
|
-
* @param props.separatorBefore - whether this row starts a new group (hairline above it).
|
|
93
|
-
* @param props.onSelect - row activation callback.
|
|
94
|
-
* @returns one menu-item row.
|
|
95
|
-
*/
|
|
96
|
-
export function MenuItemButton({ onSelect, ...props }: MenuItemButtonProps) {
|
|
97
|
-
return <MenuRow {...props} decorativeIcon={false} onClick={onSelect} />
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/** Buttons reachable by keyboard within a menu row group. */
|
|
101
|
-
function menuButtons(container: HTMLElement | null): HTMLButtonElement[] {
|
|
102
|
-
return Array.from(container?.querySelectorAll<HTMLButtonElement>('button:not(:disabled)') ?? [])
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Render an anchored dropdown menu. While the list is open its keys mirror the
|
|
107
|
-
* composer's: Tab settles the focused row — from the trigger, Tab enters the
|
|
108
|
-
* list instead — and Escape or Shift+Tab close it and return focus to the
|
|
109
|
-
* anchor's first button, and selecting a row does the same — the rows unmount
|
|
110
|
-
* with the list. Only a keyboard on the trigger or inside the list is
|
|
111
|
-
* intercepted; Tab presses elsewhere on the page stay the browser's. Escape
|
|
112
|
-
* first returns from a visible child, while ArrowRight enters and ArrowLeft returns.
|
|
113
|
-
* When neither side fits, click or ArrowRight opens a single-panel child page;
|
|
114
|
-
* focus alone retains the parent page.
|
|
115
|
-
* @param props.contextual - cursor positioning, context dismissal, and per-divider icon alignment.
|
|
116
|
-
* @param props.exiting - retain an inert popup during dismissal or replacement fade.
|
|
117
|
-
* @param props.returnFocus - original control captured before asynchronous menu preparation.
|
|
118
|
-
* @param props.isExternalTrigger - recognizes external controls whose pointer presses should not dismiss;
|
|
119
|
-
* omitted, every press outside the anchor and menu panels dismisses.
|
|
120
|
-
* @param props.autoFocus - focus the first focusable row on open when `search` is omitted.
|
|
121
|
-
* With `search`, the search settings determine initial focus. Arrow keys navigate either way.
|
|
122
|
-
* @param props.open - whether the list is showing (owner-controlled).
|
|
123
|
-
* @param props.anchor - the trigger element (rendered in place).
|
|
124
|
-
* @param props.items - selectable data rows and optional separators (default none; with no `children` either, the list is empty).
|
|
125
|
-
* @param props.submenuBackLabel - localized single-panel return label; omitted uses the caller's
|
|
126
|
-
* parent-row label beside a back arrow, without selecting that row.
|
|
127
|
-
* @param props.selectedId - row shown as selected.
|
|
128
|
-
* @param props.selectedIds - rows shown as selected when a menu contains independent option groups.
|
|
129
|
-
* @param props.onSelect - data-row activation callback (not called for disabled rows or submenu parents that only open children).
|
|
130
|
-
* @param props.onClose - invoked on outside click, on activating another popup
|
|
131
|
-
* trigger (an `aria-haspopup` control outside this menu that
|
|
132
|
-
* `isExternalTrigger` does not claim) even when that trigger stops its
|
|
133
|
-
* pointer presses, on Escape, or on a window blur that moved focus into an
|
|
134
|
-
* iframe (the only signal a pointerdown inside a cross-origin iframe leaves).
|
|
135
|
-
* @param props.align - list alignment against the anchor (default 'start').
|
|
136
|
-
* @param props.side - open below (`bottom`, default) or above (`top`) the anchor.
|
|
137
|
-
* @param props.portal - render the list into document.body, fixed-positioned
|
|
138
|
-
* with CSS anchor positioning; it follows browser zoom and may exceed the
|
|
139
|
-
* visual viewport. Use when an ancestor's overflow clipping would crop the
|
|
140
|
-
* in-place list; default false keeps the pure-CSS in-place behavior.
|
|
141
|
-
* @param props.closeOnPointerLeave - close the list once the pointer has left
|
|
142
|
-
* both trigger and list for the pointer grace (default false keeps it open
|
|
143
|
-
* until outside click/Escape/selection). The grace makes the 4px trigger->list
|
|
144
|
-
* gap and a brief overshoot survivable; coming back cancels the close.
|
|
145
|
-
* @param props.dense - reduce vertical row spacing without changing the standard typography or card width.
|
|
146
|
-
* @param props.compact - use reduced menu typography and spacing.
|
|
147
|
-
* @param props.anchorRef - external element used as the CSS anchor in portal mode.
|
|
148
|
-
* @param props.anchorPoint - client viewport coordinates captured when a context menu opens.
|
|
149
|
-
* @param props.minWidthFromAnchor - in portal mode, keep the menu at least as wide as its anchor, bounded by viewport margins.
|
|
150
|
-
* @param props.footer - rows pinned below the scrolling items area, separated
|
|
151
|
-
* by a hairline; contextual menus reuse an explicit leading separator. These rows stay visible while the items above scroll.
|
|
152
|
-
* @param props.search - controlled field above the rows. It focuses on open unless
|
|
153
|
-
* `skipAutoFocusOnTouch` is set and opened by touch. Enter activates the first available
|
|
154
|
-
* result in the scrolling rows. `clearLabel` enables a clear button that restores input focus.
|
|
155
|
-
* The owner filters `items` and provides the labels and empty message.
|
|
156
|
-
* @param props.maxVisibleRows - cap the scrolling viewport at this many row heights.
|
|
157
|
-
* @param props.children - component rows rendered after `items` in the same
|
|
158
|
-
* list, each a `role="menuitem"` button such as {@link MenuItemButton}; they
|
|
159
|
-
* share the keyboard walk, the submenu exclusivity, and the post-selection
|
|
160
|
-
* focus return.
|
|
161
|
-
* @param props.selection - how a selected row is marked: a trailing check
|
|
162
|
-
* (`'check'`, default — figma .Menu_cell) or the hover fill held on the row
|
|
163
|
-
* with no check (`'fill'`, for icon-labelled rows where a trailing glyph
|
|
164
|
-
* crowds the cell).
|
|
165
|
-
* @param props.className - extra class on the anchor wrapper span.
|
|
166
|
-
* @param props.listClassName - extra class on the dropdown card itself; the
|
|
167
|
-
* only style hook that reaches a portaled list, which renders under
|
|
168
|
-
* document.body outside the owner's DOM subtree.
|
|
169
|
-
* @returns anchor wrapper with the conditional list.
|
|
170
|
-
*/
|
|
171
|
-
export function Menu({ open, anchor, items = [], children, submenuBackLabel, selectedId, selectedIds, onSelect, onClose, align = 'start', side = 'bottom', portal = false, closeOnPointerLeave = false, dense = false, compact = false, autoFocus = false, selection = 'check', anchorRef, anchorPoint, minWidthFromAnchor = false, footer, search, maxVisibleRows, className, listClassName, contextual = false, exiting, returnFocus, isExternalTrigger }: {
|
|
172
|
-
open: boolean
|
|
173
|
-
/** Pointer-positioned popup: cursor clearance, grouped icons, and context gestures. */
|
|
174
|
-
contextual?: boolean
|
|
175
|
-
/** Recognizes external triggers exempt from outside dismissal; omitted exempts no external nodes. */
|
|
176
|
-
isExternalTrigger?: (node: Node) => boolean
|
|
177
|
-
/** Resolve the original control for focus restoration and inert/hidden dismissal. */
|
|
178
|
-
returnFocus?: (() => HTMLElement | null) | undefined
|
|
179
|
-
/** Retain a dismissed context popup during its short fade. */
|
|
180
|
-
exiting?: 'dismiss' | 'replace' | undefined
|
|
181
|
-
autoFocus?: boolean
|
|
182
|
-
anchor: ReactNode
|
|
183
|
-
items?: readonly MenuEntry[]
|
|
184
|
-
/** Localized return action; omitted uses the caller's parent label with a back arrow. */
|
|
185
|
-
submenuBackLabel?: string | undefined
|
|
186
|
-
children?: ReactNode
|
|
187
|
-
footer?: readonly MenuEntry[]
|
|
188
|
-
search?: {
|
|
189
|
-
label: string
|
|
190
|
-
/** Localized label for the optional clear button. */
|
|
191
|
-
clearLabel?: string | undefined
|
|
192
|
-
value: string
|
|
193
|
-
onChange: (value: string) => void
|
|
194
|
-
emptyMessage?: string | undefined
|
|
195
|
-
/** Leave the search field unfocused when touch opens the menu. */
|
|
196
|
-
skipAutoFocusOnTouch?: boolean
|
|
197
|
-
} | undefined
|
|
198
|
-
maxVisibleRows?: number | undefined
|
|
199
|
-
selectedId?: string | undefined
|
|
200
|
-
selectedIds?: readonly string[] | undefined
|
|
201
|
-
onSelect?: (id: string) => void
|
|
202
|
-
onClose: () => void
|
|
203
|
-
align?: 'start' | 'end'
|
|
204
|
-
side?: 'bottom' | 'top' | 'right'
|
|
205
|
-
portal?: boolean
|
|
206
|
-
closeOnPointerLeave?: boolean
|
|
207
|
-
dense?: boolean
|
|
208
|
-
compact?: boolean
|
|
209
|
-
selection?: 'check' | 'fill'
|
|
210
|
-
anchorRef?: RefObject<HTMLElement | null> | undefined
|
|
211
|
-
/** Client coordinates captured for this opening; Safari offsets are applied once. */
|
|
212
|
-
anchorPoint?: { readonly x: number; readonly y: number } | undefined
|
|
213
|
-
minWidthFromAnchor?: boolean
|
|
214
|
-
className?: string | undefined
|
|
215
|
-
listClassName?: string | undefined
|
|
216
|
-
}) {
|
|
217
|
-
const rootRef = useRef<HTMLSpanElement>(null)
|
|
218
|
-
const listRef = useRef<HTMLDivElement>(null)
|
|
219
|
-
const searchRowsRef = useRef<HTMLDivElement>(null)
|
|
220
|
-
const viewportRef = useRef<HTMLDivElement>(null)
|
|
221
|
-
const searchFieldRef = useRef<HTMLDivElement>(null)
|
|
222
|
-
const searchRef = useRef<HTMLInputElement>(null)
|
|
223
|
-
const hasSearch = search !== undefined
|
|
224
|
-
const hasSearchClear = search?.clearLabel !== undefined
|
|
225
|
-
const skipAutoFocusOnTouch = search?.skipAutoFocusOnTouch === true
|
|
226
|
-
const openedByTouch = useRef(false)
|
|
227
|
-
const menuId = useId()
|
|
228
|
-
const pointX = anchorPoint?.x
|
|
229
|
-
const pointY = anchorPoint?.y
|
|
230
|
-
const point = useMemo(() => {
|
|
231
|
-
if (pointX === undefined || pointY === undefined) return undefined
|
|
232
|
-
// WebKit reports client coordinates from the visual origin; fixed CSS uses
|
|
233
|
-
// the layout origin. Subsequent panning must not move this captured point.
|
|
234
|
-
const visualOrigin = open && typeof window.CSS !== 'undefined'
|
|
235
|
-
&& window.CSS.supports('-webkit-backdrop-filter', 'none')
|
|
236
|
-
const viewport = visualOrigin ? window.visualViewport : undefined
|
|
237
|
-
return { x: pointX + (viewport?.offsetLeft ?? 0), y: pointY + (viewport?.offsetTop ?? 0) }
|
|
238
|
-
}, [open, pointX, pointY])
|
|
239
|
-
useLayoutEffect(() => {
|
|
240
|
-
const trigger = returnFocus?.()
|
|
241
|
-
if (!open || !contextual || trigger == null) return
|
|
242
|
-
const previous = trigger.getAttribute('aria-controls')
|
|
243
|
-
trigger.setAttribute('aria-controls', [previous, menuId].filter(Boolean).join(' '))
|
|
244
|
-
return () => {
|
|
245
|
-
if (previous === null) trigger.removeAttribute('aria-controls')
|
|
246
|
-
else trigger.setAttribute('aria-controls', previous)
|
|
247
|
-
}
|
|
248
|
-
}, [open, contextual, returnFocus, menuId])
|
|
249
|
-
/** Index the arrow walk last focused, the resume point when focus left the rows. */
|
|
250
|
-
const walkIndex = useRef<number | null>(null)
|
|
251
|
-
/**
|
|
252
|
-
* The control that had the keyboard when this menu opened — its own trigger,
|
|
253
|
-
* which an anchor that wraps several controls (a split button) would not be
|
|
254
|
-
* able to name by position.
|
|
255
|
-
*/
|
|
256
|
-
const triggerRef = useRef<HTMLElement | null>(null)
|
|
257
|
-
const selectingWithTab = useRef(false)
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Hand the keyboard back to the trigger that opened the menu — or, when the
|
|
261
|
-
* anchor never held it, to the anchor's first button. Focus left on a removed
|
|
262
|
-
* row otherwise falls to the page body, where the next Tab restarts from the
|
|
263
|
-
* top of the page.
|
|
264
|
-
* @param navigation - whether explicit keyboard traversal should retain its focus indicator.
|
|
265
|
-
*/
|
|
266
|
-
const refocusAnchor = (navigation = false): void => {
|
|
267
|
-
const remembered = triggerRef.current
|
|
268
|
-
const trigger = returnFocus?.() ?? (remembered?.isConnected ? remembered : anchorRef?.current) ?? null
|
|
269
|
-
const target = trigger !== null && document.contains(trigger) && !(trigger as HTMLButtonElement).disabled
|
|
270
|
-
? trigger : rootRef.current?.querySelector<HTMLButtonElement>('button:not(:disabled)')
|
|
271
|
-
if (target == null) return
|
|
272
|
-
if (navigation) target.focus()
|
|
273
|
-
else focusWithoutRing(target)
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Post-selection focus, for the paths where the rows unmount with the list.
|
|
278
|
-
* A selection whose owner keeps the menu open is left alone, and so is an
|
|
279
|
-
* owner that moved focus itself (a presented file card hands it to its
|
|
280
|
-
* preview button): only a keyboard left on the closing list (or on the body
|
|
281
|
-
* its removal produced) comes back to the trigger.
|
|
282
|
-
*/
|
|
283
|
-
const refocusAfterSelection = (): void => {
|
|
284
|
-
const navigation = selectingWithTab.current
|
|
285
|
-
queueMicrotask(() => {
|
|
286
|
-
if (openRef.current && exitingRef.current === undefined) return
|
|
287
|
-
const active = document.activeElement
|
|
288
|
-
if (active === null || active === document.body || listRef.current?.contains(active) === true
|
|
289
|
-
|| submenu.contains(active)) refocusAnchor(navigation)
|
|
290
|
-
})
|
|
291
|
-
}
|
|
292
|
-
const exitingRef = useRef(exiting)
|
|
293
|
-
exitingRef.current = exiting
|
|
294
|
-
const openRef = useRef(open)
|
|
295
|
-
openRef.current = open
|
|
296
|
-
const submenu = useMenuSubmenu({ open: open && exiting === undefined, items, footer, listRef, searchRowsRef, refocusAnchor })
|
|
297
|
-
const submenuEvents = useRef<Pick<typeof submenu, 'contains' | 'activeList' | 'returnToParent'>>(submenu)
|
|
298
|
-
submenuEvents.current = submenu
|
|
299
|
-
const close = useRef(onClose)
|
|
300
|
-
close.current = onClose
|
|
301
|
-
const anchorName = `--dsh-menu-trigger-${menuId.replaceAll(':', '')}`
|
|
302
|
-
const [externalAnchor, setExternalAnchor] = useState<HTMLElement | null>(null)
|
|
303
|
-
const positioned = !portal || anchorRef === undefined || externalAnchor !== null
|
|
304
|
-
// External refs can attach after this component or replace their element
|
|
305
|
-
// without changing ref identity. Publish the anchor after all refs commit.
|
|
306
|
-
useEffect(() => {
|
|
307
|
-
if (!open || !portal || anchorRef === undefined) {
|
|
308
|
-
setExternalAnchor(null)
|
|
309
|
-
return
|
|
310
|
-
}
|
|
311
|
-
const element = anchorRef.current
|
|
312
|
-
setExternalAnchor(element)
|
|
313
|
-
if (element === null) return
|
|
314
|
-
const previous = element.style.getPropertyValue('anchor-name')
|
|
315
|
-
const priority = element.style.getPropertyPriority('anchor-name')
|
|
316
|
-
element.style.setProperty('anchor-name', anchorName)
|
|
317
|
-
return () => { element.style.setProperty('anchor-name', previous, priority) }
|
|
318
|
-
})
|
|
319
|
-
useEffect(() => {
|
|
320
|
-
if (!open || !portal || exiting !== undefined) return
|
|
321
|
-
const currentAnchor = (): HTMLElement | null => returnFocus?.() ?? (anchorRef === undefined ? rootRef.current : anchorRef.current)
|
|
322
|
-
const element = currentAnchor()
|
|
323
|
-
if (element === null) return
|
|
324
|
-
let dismissed = false
|
|
325
|
-
const check = (): void => {
|
|
326
|
-
const current = currentAnchor()
|
|
327
|
-
if (dismissed || (current !== null && current.isConnected && current.closest('[inert], [hidden]') === null)) return
|
|
328
|
-
dismissed = true
|
|
329
|
-
close.current()
|
|
330
|
-
}
|
|
331
|
-
const observer = new MutationObserver(check)
|
|
332
|
-
observer.observe(element.ownerDocument.documentElement, {
|
|
333
|
-
subtree: true, childList: true, attributes: true, attributeFilter: ['inert', 'hidden'],
|
|
334
|
-
})
|
|
335
|
-
check()
|
|
336
|
-
return () => { observer.disconnect() }
|
|
337
|
-
}, [open, portal, exiting, anchorRef, externalAnchor, returnFocus])
|
|
338
|
-
const { arm: armClose, cancel: cancelClose } = usePointerGrace(onClose)
|
|
339
|
-
|
|
340
|
-
// Opening remembers where the keyboard was, so closing can hand it back to
|
|
341
|
-
// that control — an anchor wrapping several (a split button) cannot be asked
|
|
342
|
-
// for it by position. Declared before the autoFocus effect so the capture
|
|
343
|
-
// sees the trigger, not the row autoFocus is about to focus.
|
|
344
|
-
useEffect(() => {
|
|
345
|
-
if (!open) return
|
|
346
|
-
openedByTouch.current = touchModality()
|
|
347
|
-
const active = document.activeElement
|
|
348
|
-
triggerRef.current = active instanceof HTMLElement && active !== document.body
|
|
349
|
-
&& (anchorRef !== undefined || anchorPoint !== undefined || rootRef.current?.contains(active) === true)
|
|
350
|
-
? active : null
|
|
351
|
-
}, [open])
|
|
352
|
-
|
|
353
|
-
useEffect(() => {
|
|
354
|
-
if (open && positioned && exiting === undefined && hasSearch
|
|
355
|
-
&& !(skipAutoFocusOnTouch && openedByTouch.current)
|
|
356
|
-
&& !isBehindModal(triggerRef.current ?? rootRef.current)) {
|
|
357
|
-
searchRef.current?.focus({ preventScroll: true })
|
|
358
|
-
}
|
|
359
|
-
}, [open, positioned, exiting, hasSearch, skipAutoFocusOnTouch])
|
|
360
|
-
|
|
361
|
-
useEffect(() => {
|
|
362
|
-
if (!open || !positioned || exiting !== undefined || !autoFocus || hasSearch
|
|
363
|
-
|| listRef.current?.contains(document.activeElement) || submenu.contains(document.activeElement)) return
|
|
364
|
-
const first = menuButtons(listRef.current)[0]
|
|
365
|
-
walkIndex.current = first === undefined ? null : 0
|
|
366
|
-
if (first !== undefined) focusWithoutRing(first)
|
|
367
|
-
}, [open, autoFocus, hasSearch, items.length, footer?.length, positioned, exiting])
|
|
368
|
-
|
|
369
|
-
useEffect(() => {
|
|
370
|
-
if (!open || exiting !== undefined) {
|
|
371
|
-
walkIndex.current = null
|
|
372
|
-
return
|
|
373
|
-
}
|
|
374
|
-
const composition = observeComposition(document)
|
|
375
|
-
const onPointerDown = (e: PointerEvent) => {
|
|
376
|
-
if (!(e.target instanceof Node) || (contextual && e.button === 2)) return
|
|
377
|
-
// The portaled list is outside the anchor subtree; check both.
|
|
378
|
-
if (rootRef.current?.contains(e.target) === true || anchorRef?.current?.contains(e.target) === true) return
|
|
379
|
-
if (isExternalTrigger?.(e.target) === true) return
|
|
380
|
-
if (listRef.current?.contains(e.target) === true || submenuEvents.current.contains(e.target)) return
|
|
381
|
-
onClose()
|
|
382
|
-
}
|
|
383
|
-
// Activating another popup trigger closes this menu even when that trigger
|
|
384
|
-
// isolates its presses from its owners, as the shared context-menu button
|
|
385
|
-
// does: its pointerdown never reaches the listener above, so the
|
|
386
|
-
// activating click is caught in the capture phase instead.
|
|
387
|
-
const onOtherTrigger = (e: MouseEvent) => {
|
|
388
|
-
const trigger = e.target instanceof Element ? e.target.closest('[aria-haspopup]') : null
|
|
389
|
-
if (trigger === null || rootRef.current?.contains(trigger) === true || anchorRef?.current?.contains(trigger) === true) return
|
|
390
|
-
if (isExternalTrigger?.(trigger) === true) return
|
|
391
|
-
if (listRef.current?.contains(trigger) === true || submenuEvents.current.contains(trigger)) return
|
|
392
|
-
onClose()
|
|
393
|
-
}
|
|
394
|
-
const onKeyDown = (e: KeyboardEvent) => {
|
|
395
|
-
if (composition.guards(e) || isBehindModal(triggerRef.current ?? rootRef.current)
|
|
396
|
-
|| e.defaultPrevented || e.ctrlKey || e.altKey || e.metaKey) return
|
|
397
|
-
// Where the keyboard is, computed once: the menu owns it when it holds a
|
|
398
|
-
// row or sits on its anchor region.
|
|
399
|
-
const focused = document.activeElement
|
|
400
|
-
const inSearch = focused !== null && focused === searchRef.current
|
|
401
|
-
const onClearSearch = !inSearch && searchFieldRef.current?.contains(focused) === true
|
|
402
|
-
const insideList = listRef.current?.contains(focused) === true || submenuEvents.current.contains(focused)
|
|
403
|
-
const anchored = focused === returnFocus?.() || anchorRef?.current?.contains(focused) === true
|
|
404
|
-
|| rootRef.current?.contains(focused) === true || insideList || (hasSearch && focused === triggerRef.current)
|
|
405
|
-
if (inSearch && e.key === 'Enter' && !e.shiftKey) {
|
|
406
|
-
e.preventDefault()
|
|
407
|
-
if (!e.repeat) menuButtons(viewportRef.current).find(button =>
|
|
408
|
-
button.getAttribute('role') === 'menuitem' && button.getAttribute('aria-disabled') !== 'true')?.click()
|
|
409
|
-
return
|
|
410
|
-
}
|
|
411
|
-
if (e.key === 'Escape' && !e.shiftKey) {
|
|
412
|
-
e.preventDefault()
|
|
413
|
-
if (e.repeat) return
|
|
414
|
-
if (submenuEvents.current.returnToParent()) return
|
|
415
|
-
// Closing hands the keyboard back when the menu had it — and, as this
|
|
416
|
-
// primitive always did for autoFocus menus, when it held the keyboard
|
|
417
|
-
// and lost it again (a row that unmounted under it).
|
|
418
|
-
onClose()
|
|
419
|
-
if (anchored || autoFocus) refocusAnchor()
|
|
420
|
-
}
|
|
421
|
-
if (e.key === 'ArrowLeft' && anchored && submenuEvents.current.returnToParent()) {
|
|
422
|
-
e.preventDefault()
|
|
423
|
-
return
|
|
424
|
-
}
|
|
425
|
-
if (e.key === 'ArrowRight' && insideList && focused instanceof HTMLButtonElement
|
|
426
|
-
&& focused.getAttribute('aria-haspopup') === 'menu') {
|
|
427
|
-
e.preventDefault()
|
|
428
|
-
focused.click()
|
|
429
|
-
return
|
|
430
|
-
}
|
|
431
|
-
// Tab settles like Enter and Shift+Tab leaves like Escape, so a menu's
|
|
432
|
-
// keys mean what they mean in the composer. Only a keyboard already on
|
|
433
|
-
// the trigger or inside the list is intercepted: Tab elsewhere on the
|
|
434
|
-
// page keeps the browser's traversal even while a menu is open.
|
|
435
|
-
if (e.key === 'Tab') {
|
|
436
|
-
const list = submenuEvents.current.activeList(focused)
|
|
437
|
-
if (list === null || !anchored) return
|
|
438
|
-
if ((!e.shiftKey && inSearch && hasSearchClear) || (e.shiftKey && onClearSearch)) return
|
|
439
|
-
if (e.shiftKey) {
|
|
440
|
-
e.preventDefault()
|
|
441
|
-
onClose()
|
|
442
|
-
refocusAnchor(true)
|
|
443
|
-
return
|
|
444
|
-
}
|
|
445
|
-
// Tab settles a focused row. Other controls inside the list keep
|
|
446
|
-
// native traversal unless they belong to the search field.
|
|
447
|
-
if (insideList && !inSearch && !onClearSearch) {
|
|
448
|
-
if (focused instanceof Element && focused.getAttribute('role') === 'menuitem') {
|
|
449
|
-
e.preventDefault()
|
|
450
|
-
if (focused.getAttribute('aria-disabled') === 'true') {
|
|
451
|
-
onClose()
|
|
452
|
-
refocusAnchor(true)
|
|
453
|
-
return
|
|
454
|
-
}
|
|
455
|
-
selectingWithTab.current = true
|
|
456
|
-
try { (focused as HTMLElement).click() }
|
|
457
|
-
finally { selectingWithTab.current = false }
|
|
458
|
-
}
|
|
459
|
-
return
|
|
460
|
-
}
|
|
461
|
-
const row = menuButtons(list)[0]
|
|
462
|
-
if (row === undefined) {
|
|
463
|
-
if (inSearch || onClearSearch) {
|
|
464
|
-
e.preventDefault()
|
|
465
|
-
searchRef.current?.focus()
|
|
466
|
-
}
|
|
467
|
-
return
|
|
468
|
-
}
|
|
469
|
-
e.preventDefault()
|
|
470
|
-
row.focus()
|
|
471
|
-
walkIndex.current = 0
|
|
472
|
-
return
|
|
473
|
-
}
|
|
474
|
-
// Arrows walk the list whether or not the menu focused its first item on
|
|
475
|
-
// open, so `autoFocus` chooses only that entry behavior. A keyboard still
|
|
476
|
-
// on the anchor enters at the end the step comes from — unless it already
|
|
477
|
-
// walked, in which case the walk resumes where it left off. The walk resumes
|
|
478
|
-
// from where it last put focus, not from `document.activeElement`: a row
|
|
479
|
-
// that refused focus (a hidden portal frame, a detached node) would
|
|
480
|
-
// otherwise re-enter at the near end on every press and the walk would
|
|
481
|
-
// alternate between two rows.
|
|
482
|
-
if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(e.key)) return
|
|
483
|
-
if (inSearch && (e.key === 'Home' || e.key === 'End')) return
|
|
484
|
-
const list = submenuEvents.current.activeList(focused)
|
|
485
|
-
if (list === null || !anchored) return
|
|
486
|
-
const buttons = menuButtons(list)
|
|
487
|
-
if (buttons.length === 0) return
|
|
488
|
-
const index = buttons.indexOf(focused as HTMLButtonElement)
|
|
489
|
-
const from = index >= 0 ? index : inSearch || onClearSearch ? null : walkIndex.current
|
|
490
|
-
const next = e.key === 'Home' ? 0 : e.key === 'End' ? buttons.length - 1
|
|
491
|
-
: from === null
|
|
492
|
-
? (e.key === 'ArrowDown' ? 0 : buttons.length - 1)
|
|
493
|
-
: (from + (e.key === 'ArrowDown' ? 1 : -1) + buttons.length) % buttons.length
|
|
494
|
-
e.preventDefault()
|
|
495
|
-
walkIndex.current = next
|
|
496
|
-
buttons[next]?.focus()
|
|
497
|
-
}
|
|
498
|
-
// A pointerdown inside a cross-origin iframe (a sandboxed HTML preview)
|
|
499
|
-
// never reaches this document; the focus move it causes blurs the window
|
|
500
|
-
// instead. Only that case closes: an app or tab switch leaves the
|
|
501
|
-
// document's focus where it was, so activeElement is not an iframe.
|
|
502
|
-
const onWindowBlur = () => {
|
|
503
|
-
if (document.activeElement instanceof HTMLIFrameElement) onClose()
|
|
504
|
-
}
|
|
505
|
-
document.addEventListener('pointerdown', onPointerDown)
|
|
506
|
-
document.addEventListener('click', onOtherTrigger, true)
|
|
507
|
-
const onEscape = (event: KeyboardEvent): void => { if (event.key === 'Escape') onKeyDown(event) }
|
|
508
|
-
const onOtherKey = (event: KeyboardEvent): void => { if (event.key !== 'Escape') onKeyDown(event) }
|
|
509
|
-
document.addEventListener('keydown', onOtherKey)
|
|
510
|
-
document.addEventListener('keydown', onEscape, true)
|
|
511
|
-
window.addEventListener('blur', onWindowBlur)
|
|
512
|
-
return () => {
|
|
513
|
-
composition.dispose()
|
|
514
|
-
document.removeEventListener('pointerdown', onPointerDown)
|
|
515
|
-
document.removeEventListener('click', onOtherTrigger, true)
|
|
516
|
-
document.removeEventListener('keydown', onOtherKey)
|
|
517
|
-
document.removeEventListener('keydown', onEscape, true)
|
|
518
|
-
window.removeEventListener('blur', onWindowBlur)
|
|
519
|
-
}
|
|
520
|
-
}, [open, onClose, autoFocus, hasSearch, hasSearchClear, contextual, exiting, anchorRef, returnFocus, isExternalTrigger])
|
|
521
|
-
|
|
522
|
-
useLayoutEffect(() => {
|
|
523
|
-
if (exiting === 'dismiss' && listRef.current?.contains(document.activeElement)) refocusAnchor()
|
|
524
|
-
}, [exiting])
|
|
525
|
-
|
|
526
|
-
// A close from selection/Escape/outside click outruns a pending grace close;
|
|
527
|
-
// left armed it would shut a list reopened inside the grace window. Its own
|
|
528
|
-
// effect, not the listener effect above: that one re-runs on every `onClose`
|
|
529
|
-
// identity change and would cancel the grace mid-transit.
|
|
530
|
-
useEffect(() => {
|
|
531
|
-
if (!open) cancelClose()
|
|
532
|
-
}, [open, cancelClose])
|
|
533
|
-
|
|
534
|
-
const itemColumns = menuIconColumns(items, contextual)
|
|
535
|
-
const footerColumns = menuIconColumns(footer ?? [], contextual)
|
|
536
|
-
const renderEntry = (entry: MenuEntry, columns: ReadonlySet<MenuEntry>) => {
|
|
537
|
-
if ('type' in entry) return renderMenuDecoration(entry)
|
|
538
|
-
const hasSub = entry.submenu !== undefined && entry.submenu.length > 0
|
|
539
|
-
return <MenuRow key={entry.id} icon={entry.icon} reserveIcon={columns.has(entry)}
|
|
540
|
-
disabled={entry.disabled} danger={entry.danger} shortcut={entry.shortcut}
|
|
541
|
-
selected={entry.id === selectedId || selectedIds?.includes(entry.id) === true} selection={selection}
|
|
542
|
-
aria-haspopup={hasSub ? 'menu' : undefined}
|
|
543
|
-
aria-expanded={hasSub ? submenu.entry?.id === entry.id && !submenu.hidden : undefined}
|
|
544
|
-
wrapperProps={hasSub ? {
|
|
545
|
-
onPointerEnter: (event) => {
|
|
546
|
-
if (!menuHoverAllowed(event) || entry.disabled) return
|
|
547
|
-
const trigger = event.currentTarget.querySelector<HTMLButtonElement>('button')
|
|
548
|
-
if (trigger !== null) submenu.openChild(entry.id, trigger)
|
|
549
|
-
},
|
|
550
|
-
onPointerLeave: (event) => { if (menuHoverAllowed(event)) submenu.leave() },
|
|
551
|
-
} : undefined}
|
|
552
|
-
onFocus={hasSub ? (event) => { submenu.focusParent(entry.id, event.currentTarget) } : undefined}
|
|
553
|
-
onClick={(event) => {
|
|
554
|
-
if (hasSub) submenu.openChild(entry.id, event.currentTarget, true)
|
|
555
|
-
else onSelect?.(entry.id)
|
|
556
|
-
}}>{entry.label}</MenuRow>
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
const rows = <>
|
|
560
|
-
<div ref={viewportRef} className={css.viewport} role="presentation">
|
|
561
|
-
{items.map(entry => renderEntry(entry, itemColumns))}
|
|
562
|
-
{children}
|
|
563
|
-
</div>
|
|
564
|
-
{footer !== undefined && footer.length > 0 && (
|
|
565
|
-
<div className={css.footer} role="presentation">
|
|
566
|
-
{footer.map(entry => renderEntry(entry, footerColumns))}
|
|
567
|
-
</div>
|
|
568
|
-
)}
|
|
569
|
-
</>
|
|
570
|
-
const visible = exiting === undefined && !submenu.page
|
|
571
|
-
const cardStyle: CSSProperties & { '--dsh-menu-visible-rows'?: number } = {
|
|
572
|
-
positionAnchor: portal ? anchorName : undefined,
|
|
573
|
-
...(maxVisibleRows === undefined ? {} : { '--dsh-menu-visible-rows': maxVisibleRows }),
|
|
574
|
-
}
|
|
575
|
-
const updateSearch = (value: string): void => {
|
|
576
|
-
if (viewportRef.current !== null) viewportRef.current.scrollTop = 0
|
|
577
|
-
search?.onChange(value)
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
const list = open && positioned && (
|
|
581
|
-
<MenuSurface compact={compact} id={contextual ? menuId : undefined}
|
|
582
|
-
ref={listRef}
|
|
583
|
-
className={clsx(css.list, listClassName, dense && css.denseList, compact && css.compactList, css.scrollable, submenu.page && css.parentPage, portal && css.portal, side === 'top' && !portal && css.sideTop, align === 'end' && !portal && css.alignEnd)}
|
|
584
|
-
style={cardStyle}
|
|
585
|
-
data-anchor-side={portal ? side : undefined}
|
|
586
|
-
data-anchor-align={portal ? align : undefined}
|
|
587
|
-
data-match-anchor-width={portal && minWidthFromAnchor ? '' : undefined}
|
|
588
|
-
data-menu-popup={visible && hasSearch ? '' : undefined}
|
|
589
|
-
role={visible && !hasSearch ? 'menu' : undefined}
|
|
590
|
-
aria-hidden={visible ? undefined : true}
|
|
591
|
-
data-context-menu={contextual ? '' : undefined}
|
|
592
|
-
phase={contextual ? exiting ?? 'enter' : undefined}
|
|
593
|
-
// React portals bubble synthetic events through the REACT tree: without
|
|
594
|
-
// this stop, an item click re-fires the anchor row's own onClick
|
|
595
|
-
// (open/toggle) after onSelect. The same bubble is where every row's
|
|
596
|
-
// activation lands — data rows and component rows alike — so the
|
|
597
|
-
// post-selection focus return is decided once here, after the row's
|
|
598
|
-
// own handler ran; a submenu parent only opened its card.
|
|
599
|
-
onClick={(e) => {
|
|
600
|
-
e.stopPropagation()
|
|
601
|
-
const row = e.target instanceof Element ? e.target.closest('button[role="menuitem"]') : null
|
|
602
|
-
if (row !== null && row.getAttribute('aria-haspopup') !== 'menu') refocusAfterSelection()
|
|
603
|
-
}}
|
|
604
|
-
onContextMenu={contextual ? (event) => {
|
|
605
|
-
event.preventDefault(); event.stopPropagation(); onClose()
|
|
606
|
-
} : undefined}
|
|
607
|
-
onPointerOver={(event) => { if (menuHoverAllowed(event)) submenu.collapseFrom(event) }}
|
|
608
|
-
onFocus={submenu.collapseFrom}
|
|
609
|
-
>
|
|
610
|
-
{/* Child cards anchor to this unscrolled box, which matches the card itself. */}
|
|
611
|
-
{submenu.entry !== undefined && <span aria-hidden="true" className={css.submenuAnchor} style={{ anchorName: submenu.parentAnchor }} />}
|
|
612
|
-
{search === undefined ? rows : <>
|
|
613
|
-
<SearchField
|
|
614
|
-
inputRef={searchRef}
|
|
615
|
-
rootRef={searchFieldRef}
|
|
616
|
-
className={css.search}
|
|
617
|
-
role="searchbox"
|
|
618
|
-
aria-label={search.label}
|
|
619
|
-
placeholder={search.label}
|
|
620
|
-
value={search.value}
|
|
621
|
-
onChange={updateSearch}
|
|
622
|
-
clearLabel={search.clearLabel}
|
|
623
|
-
onClear={() => {
|
|
624
|
-
updateSearch('')
|
|
625
|
-
searchRef.current?.focus({ preventScroll: true })
|
|
626
|
-
}}
|
|
627
|
-
/>
|
|
628
|
-
{search.emptyMessage !== undefined && items.length === 0 && <div role="status" className={css.searchStatus}>{search.emptyMessage}</div>}
|
|
629
|
-
<div ref={searchRowsRef} className={css.searchRows}
|
|
630
|
-
role={visible && (items.length > 0 || children != null || !!footer?.length) ? 'menu' : undefined}>{rows}</div>
|
|
631
|
-
</>}
|
|
632
|
-
</MenuSurface>
|
|
633
|
-
)
|
|
634
|
-
|
|
635
|
-
// Pointer-leave dismissal watches the WRAPPER, not the list: React's
|
|
636
|
-
// enter/leave traversal runs over the React tree, so trigger and portaled
|
|
637
|
-
// list are one region here. Aiming back at the trigger, or crossing the 4px
|
|
638
|
-
// gap between them, therefore never counts as leaving.
|
|
639
|
-
return (
|
|
640
|
-
<span
|
|
641
|
-
ref={rootRef}
|
|
642
|
-
className={clsx(css.root, className)}
|
|
643
|
-
style={{ anchorName: anchorRef === undefined ? anchorName : undefined, ...(point === undefined ? {} : {
|
|
644
|
-
position: 'fixed', left: point.x, top: point.y, width: 0, height: 0,
|
|
645
|
-
}) }}
|
|
646
|
-
onPointerEnter={closeOnPointerLeave ? cancelClose : undefined}
|
|
647
|
-
onPointerLeave={closeOnPointerLeave ? (event) => { if (open && menuHoverAllowed(event)) armClose() } : undefined}
|
|
648
|
-
>
|
|
649
|
-
{anchor}
|
|
650
|
-
{portal ? (list !== false && createPortal(list, document.body)) : list}
|
|
651
|
-
{open && exiting === undefined && submenu.entry !== undefined && <SubmenuPanel key={submenu.entry.id}
|
|
652
|
-
entry={submenu.entry} submenu={submenu} compact={compact} dense={dense} contextual={contextual}
|
|
653
|
-
backLabel={submenuBackLabel ?? submenu.entry.label} onSelect={onSelect} onClose={onClose} afterSelection={refocusAfterSelection} />}
|
|
654
|
-
</span>
|
|
655
|
-
)
|
|
656
|
-
}
|