@deepseek-ai/dsh-client-ui-primitives 0.2.2-rc.1 → 0.2.2-rc.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 +16 -16
- package/README.md +21 -14
- package/README.zh.md +21 -14
- package/lib/HoverCard.module.css +8 -3
- package/lib/JsonTree.module.css +7 -17
- package/lib/Menu.module.css +157 -37
- package/lib/Modal.module.css +16 -0
- package/lib/QuotePreview.module.css +37 -0
- package/lib/RiskConfirmation.module.css +11 -37
- package/lib/Toast.module.css +2 -3
- package/lib/Tooltip.module.css +2 -1
- package/lib/index.js +1453 -774
- package/lib/index.js.map +1 -0
- package/lib/markdown/CodeBlock.module.css +64 -0
- package/lib/markdown/MarkdownText.module.css +20 -1
- package/lib/types/AnimatedRows.d.ts +3 -0
- package/lib/types/AnimatedRows.d.ts.map +1 -0
- package/lib/types/AnimatedRows.js.map +1 -0
- package/lib/types/BrandWordmark.d.ts.map +1 -0
- package/lib/types/BrandWordmark.js.map +1 -0
- package/lib/types/Button.d.ts.map +1 -0
- package/lib/types/Button.js.map +1 -0
- package/lib/types/Checkbox.d.ts +3 -1
- package/lib/types/Checkbox.d.ts.map +1 -0
- package/lib/types/Checkbox.js.map +1 -0
- package/lib/types/CodeFileIcon.d.ts.map +1 -0
- package/lib/types/CodeFileIcon.js.map +1 -0
- package/lib/types/CodeToolbar.d.ts.map +1 -0
- package/lib/types/CodeToolbar.js.map +1 -0
- package/lib/types/CommandText.d.ts.map +1 -0
- package/lib/types/CommandText.js.map +1 -0
- package/lib/types/ConfigField.d.ts.map +1 -0
- package/lib/types/ConfigField.js.map +1 -0
- package/lib/types/ConnectionIndicator.d.ts.map +1 -0
- package/lib/types/ConnectionIndicator.js.map +1 -0
- package/lib/types/DetailDocument.d.ts.map +1 -0
- package/lib/types/DetailDocument.js.map +1 -0
- package/lib/types/DiffBlock.d.ts.map +1 -0
- package/lib/types/DiffBlock.js.map +1 -0
- package/lib/types/DisclosureRow.d.ts.map +1 -0
- package/lib/types/DisclosureRow.js.map +1 -0
- package/lib/types/DraggableImage.d.ts.map +1 -0
- package/lib/types/DraggableImage.js.map +1 -0
- package/lib/types/FileTypeIcon.d.ts.map +1 -0
- package/lib/types/FileTypeIcon.js.map +1 -0
- package/lib/types/FishLogo.d.ts.map +1 -0
- package/lib/types/FishLogo.js.map +1 -0
- package/lib/types/FoldToggle.d.ts.map +1 -0
- package/lib/types/FoldToggle.js.map +1 -0
- package/lib/types/HoverCard.d.ts.map +1 -0
- package/lib/types/HoverCard.js.map +1 -0
- package/lib/types/HoverCardGroup.d.ts.map +1 -0
- package/lib/types/HoverCardGroup.js.map +1 -0
- package/lib/types/ImageLightbox.d.ts.map +1 -0
- package/lib/types/ImageLightbox.js.map +1 -0
- package/lib/types/ImagePreview.d.ts.map +1 -0
- package/lib/types/ImagePreview.js.map +1 -0
- package/lib/types/InlineEditor.d.ts.map +1 -0
- package/lib/types/InlineEditor.js.map +1 -0
- package/lib/types/Input.d.ts.map +1 -0
- package/lib/types/Input.js.map +1 -0
- package/lib/types/JsonTree.d.ts.map +1 -0
- package/lib/types/JsonTree.js.map +1 -0
- package/lib/types/LinkIcon.d.ts.map +1 -0
- package/lib/types/LinkIcon.js.map +1 -0
- package/lib/types/Menu.d.ts +26 -14
- package/lib/types/Menu.d.ts.map +1 -0
- package/lib/types/Menu.js.map +1 -0
- package/lib/types/MenuGroup.d.ts.map +1 -0
- package/lib/types/MenuGroup.js.map +1 -0
- package/lib/types/MenuRow.d.ts +37 -0
- package/lib/types/MenuRow.d.ts.map +1 -0
- package/lib/types/MenuRow.js.map +1 -0
- package/lib/types/MenuSurface.d.ts.map +1 -0
- package/lib/types/MenuSurface.js.map +1 -0
- package/lib/types/Modal.d.ts +3 -1
- package/lib/types/Modal.d.ts.map +1 -0
- package/lib/types/Modal.js.map +1 -0
- package/lib/types/PathLabel.d.ts.map +1 -0
- package/lib/types/PathLabel.js.map +1 -0
- package/lib/types/PermissionIcon.d.ts.map +1 -0
- package/lib/types/PermissionIcon.js.map +1 -0
- package/lib/types/Pill.d.ts.map +1 -0
- package/lib/types/Pill.js.map +1 -0
- package/lib/types/QuotePreview.d.ts +17 -4
- package/lib/types/QuotePreview.d.ts.map +1 -0
- package/lib/types/QuotePreview.js.map +1 -0
- package/lib/types/ReadBlock.d.ts.map +1 -0
- package/lib/types/ReadBlock.js.map +1 -0
- package/lib/types/ReferenceIcon.d.ts.map +1 -0
- package/lib/types/ReferenceIcon.js.map +1 -0
- package/lib/types/RiskConfirmation.d.ts.map +1 -0
- package/lib/types/RiskConfirmation.js.map +1 -0
- package/lib/types/SearchBlock.d.ts.map +1 -0
- package/lib/types/SearchBlock.js.map +1 -0
- package/lib/types/SegmentedControl.d.ts.map +1 -0
- package/lib/types/SegmentedControl.js.map +1 -0
- package/lib/types/SegmentedTabs.d.ts.map +1 -0
- package/lib/types/SegmentedTabs.js.map +1 -0
- package/lib/types/ShortcutKeys.d.ts.map +1 -0
- package/lib/types/ShortcutKeys.js.map +1 -0
- package/lib/types/SiteGlyph.d.ts.map +1 -0
- package/lib/types/SiteGlyph.js.map +1 -0
- package/lib/types/StateDot.d.ts.map +1 -0
- package/lib/types/StateDot.js.map +1 -0
- package/lib/types/SubmenuPanel.d.ts +19 -0
- package/lib/types/SubmenuPanel.d.ts.map +1 -0
- package/lib/types/SubmenuPanel.js.map +1 -0
- package/lib/types/Switch.d.ts.map +1 -0
- package/lib/types/Switch.js.map +1 -0
- package/lib/types/Tag.d.ts.map +1 -0
- package/lib/types/Tag.js.map +1 -0
- package/lib/types/TerminalBlock.d.ts.map +1 -0
- package/lib/types/TerminalBlock.js.map +1 -0
- package/lib/types/TextShimmer.d.ts.map +1 -0
- package/lib/types/TextShimmer.js.map +1 -0
- package/lib/types/Toast.d.ts.map +1 -0
- package/lib/types/Toast.js.map +1 -0
- package/lib/types/Tooltip.d.ts.map +1 -0
- package/lib/types/Tooltip.js.map +1 -0
- package/lib/types/UserMessageBubble.d.ts.map +1 -0
- package/lib/types/UserMessageBubble.js.map +1 -0
- package/lib/types/WebBlock.d.ts.map +1 -0
- package/lib/types/WebBlock.js.map +1 -0
- package/lib/types/ZoomControls.d.ts.map +1 -0
- package/lib/types/ZoomControls.js.map +1 -0
- package/lib/types/ansi.d.ts.map +1 -0
- package/lib/types/ansi.js.map +1 -0
- package/lib/types/clipboard.d.ts.map +1 -0
- package/lib/types/clipboard.js.map +1 -0
- package/lib/types/code-file-icon-artwork.d.ts.map +1 -0
- package/lib/types/code-file-icon-artwork.js.map +1 -0
- package/lib/types/code-file-types.d.ts.map +1 -0
- package/lib/types/code-file-types.js.map +1 -0
- package/lib/types/code-highlighting.d.ts.map +1 -0
- package/lib/types/code-highlighting.js.map +1 -0
- package/lib/types/darwin-desktop.d.ts.map +1 -0
- package/lib/types/darwin-desktop.js.map +1 -0
- package/lib/types/document-zoom.d.ts.map +1 -0
- package/lib/types/document-zoom.js.map +1 -0
- package/lib/types/file-drag-actions.d.ts.map +1 -0
- package/lib/types/file-drag-actions.js.map +1 -0
- package/lib/types/file-size.d.ts.map +1 -0
- package/lib/types/file-size.js.map +1 -0
- package/lib/types/focus.d.ts.map +1 -0
- package/lib/types/focus.js.map +1 -0
- package/lib/types/guide-artwork.d.ts.map +1 -0
- package/lib/types/guide-artwork.js.map +1 -0
- package/lib/types/head-tail-cap.d.ts.map +1 -0
- package/lib/types/head-tail-cap.js.map +1 -0
- package/lib/types/icons/artwork.d.ts +16 -0
- package/lib/types/icons/artwork.d.ts.map +1 -0
- package/lib/types/icons/artwork.js.map +1 -0
- package/lib/types/icons/index.d.ts +16 -0
- package/lib/types/icons/index.d.ts.map +1 -0
- package/lib/types/icons/index.js.map +1 -0
- package/lib/types/icons/props.d.ts.map +1 -0
- package/lib/types/icons/props.js.map +1 -0
- package/lib/types/icons/shared-artwork.d.ts.map +1 -0
- package/lib/types/icons/shared-artwork.js.map +1 -0
- package/lib/types/image-drag.d.ts.map +1 -0
- package/lib/types/image-drag.js.map +1 -0
- package/lib/types/index.d.ts +5 -4
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/input-modality.d.ts.map +1 -0
- package/lib/types/input-modality.js.map +1 -0
- package/lib/types/keyboard-composition.d.ts.map +1 -0
- package/lib/types/keyboard-composition.js.map +1 -0
- package/lib/types/markdown/CodeBlock.d.ts +8 -1
- package/lib/types/markdown/CodeBlock.d.ts.map +1 -0
- package/lib/types/markdown/CodeBlock.js.map +1 -0
- package/lib/types/markdown/FenceBlocks.d.ts +31 -0
- package/lib/types/markdown/FenceBlocks.d.ts.map +1 -0
- package/lib/types/markdown/FenceBlocks.js.map +1 -0
- package/lib/types/markdown/JsonBlock.d.ts.map +1 -0
- package/lib/types/markdown/JsonBlock.js.map +1 -0
- package/lib/types/markdown/MarkdownDelegate.d.ts +23 -1
- package/lib/types/markdown/MarkdownDelegate.d.ts.map +1 -0
- package/lib/types/markdown/MarkdownDelegate.js.map +1 -0
- package/lib/types/markdown/MarkdownText.d.ts +2 -0
- package/lib/types/markdown/MarkdownText.d.ts.map +1 -0
- package/lib/types/markdown/MarkdownText.js.map +1 -0
- package/lib/types/markdown/cjkFriendlyStrong.d.ts.map +1 -0
- package/lib/types/markdown/cjkFriendlyStrong.js.map +1 -0
- package/lib/types/markdown/copy-tex.d.ts +14 -0
- package/lib/types/markdown/copy-tex.d.ts.map +1 -0
- package/lib/types/markdown/copy-tex.js.map +1 -0
- package/lib/types/markdown/diff-fence.d.ts +58 -0
- package/lib/types/markdown/diff-fence.d.ts.map +1 -0
- package/lib/types/markdown/diff-fence.js.map +1 -0
- package/lib/types/markdown/file-link.d.ts.map +1 -0
- package/lib/types/markdown/file-link.js.map +1 -0
- package/lib/types/markdown/highlight.d.ts +18 -0
- package/lib/types/markdown/highlight.d.ts.map +1 -0
- package/lib/types/markdown/highlight.js.map +1 -0
- package/lib/types/markdown/incremental.d.ts.map +1 -0
- package/lib/types/markdown/incremental.js.map +1 -0
- package/lib/types/markdown/katex.d.ts.map +1 -0
- package/lib/types/markdown/katex.js.map +1 -0
- package/lib/types/markdown/local-image-syntax.d.ts.map +1 -0
- package/lib/types/markdown/local-image-syntax.js.map +1 -0
- package/lib/types/markdown/mathCompatibility.d.ts.map +1 -0
- package/lib/types/markdown/mathCompatibility.js.map +1 -0
- package/lib/types/markdown/parse.d.ts.map +1 -0
- package/lib/types/markdown/parse.js.map +1 -0
- package/lib/types/markdown/plain-text.d.ts.map +1 -0
- package/lib/types/markdown/plain-text.js.map +1 -0
- package/lib/types/markdown/quote-text.d.ts.map +1 -0
- package/lib/types/markdown/quote-text.js.map +1 -0
- package/lib/types/markdown/render.d.ts.map +1 -0
- package/lib/types/markdown/render.js.map +1 -0
- package/lib/types/markdown/useViewportHighlighting.d.ts.map +1 -0
- package/lib/types/markdown/useViewportHighlighting.js.map +1 -0
- package/lib/types/markdown/windows-path-destinations.d.ts.map +1 -0
- package/lib/types/markdown/windows-path-destinations.js.map +1 -0
- package/lib/types/menu-submenu-position.d.ts +15 -0
- package/lib/types/menu-submenu-position.d.ts.map +1 -0
- package/lib/types/menu-submenu-position.js.map +1 -0
- package/lib/types/overlay-top-margin.d.ts.map +1 -0
- package/lib/types/overlay-top-margin.js.map +1 -0
- package/lib/types/plugin-artwork.d.ts.map +1 -0
- package/lib/types/plugin-artwork.js.map +1 -0
- package/lib/types/pointer-grace.d.ts.map +1 -0
- package/lib/types/pointer-grace.js.map +1 -0
- package/lib/types/rank-by-name.d.ts.map +1 -0
- package/lib/types/rank-by-name.js.map +1 -0
- package/lib/types/relative-time.d.ts.map +1 -0
- package/lib/types/relative-time.js.map +1 -0
- package/lib/types/settings-form/SettingsForm.d.ts.map +1 -0
- package/lib/types/settings-form/SettingsForm.js.map +1 -0
- package/lib/types/settings-form/fields.d.ts.map +1 -0
- package/lib/types/settings-form/fields.js.map +1 -0
- package/lib/types/settings-form/form-model.d.ts.map +1 -0
- package/lib/types/settings-form/form-model.js.map +1 -0
- package/lib/types/tooltip-placement.d.ts.map +1 -0
- package/lib/types/tooltip-placement.js.map +1 -0
- package/lib/types/use-clipboard-copy.d.ts.map +1 -0
- package/lib/types/use-clipboard-copy.js.map +1 -0
- package/lib/types/useAnchoredMaxHeight.d.ts.map +1 -0
- package/lib/types/useAnchoredMaxHeight.js.map +1 -0
- package/lib/types/useDismissOnOutsidePointer.d.ts.map +1 -0
- package/lib/types/useDismissOnOutsidePointer.js.map +1 -0
- package/lib/types/useMenuSubmenu.d.ts +43 -0
- package/lib/types/useMenuSubmenu.d.ts.map +1 -0
- package/lib/types/useMenuSubmenu.js.map +1 -0
- package/lib/types/useModalLayer.d.ts.map +1 -0
- package/lib/types/useModalLayer.js.map +1 -0
- package/lib/types/useRowDragPreview.d.ts.map +1 -0
- package/lib/types/useRowDragPreview.js.map +1 -0
- package/lib/types/user-text.d.ts.map +1 -0
- package/lib/types/user-text.js.map +1 -0
- package/package.json +9 -6
- package/src/AnimatedRows.module.css +7 -0
- package/src/AnimatedRows.tsx +195 -0
- package/src/BrandWordmark.tsx +59 -0
- package/src/Button.module.css +84 -0
- package/src/Button.tsx +36 -0
- package/src/Checkbox.module.css +28 -0
- package/src/Checkbox.tsx +34 -0
- package/src/CodeCard.module.css +85 -0
- package/src/CodeFileIcon.tsx +28 -0
- package/src/CodeToolbar.tsx +62 -0
- package/src/CommandText.module.css +12 -0
- package/src/CommandText.tsx +46 -0
- package/src/ConfigField.module.css +12 -0
- package/src/ConfigField.tsx +53 -0
- package/src/ConnectionIndicator.module.css +120 -0
- package/src/ConnectionIndicator.tsx +103 -0
- package/src/DetailDocument.module.css +67 -0
- package/src/DetailDocument.tsx +120 -0
- package/src/DiffBlock.module.css +82 -0
- package/src/DiffBlock.tsx +221 -0
- package/src/DisclosureRow.module.css +115 -0
- package/src/DisclosureRow.tsx +124 -0
- package/src/DraggableImage.tsx +26 -0
- package/src/FileTypeIcon.module.css +50 -0
- package/src/FileTypeIcon.tsx +285 -0
- package/src/FishLogo.tsx +28 -0
- package/src/FoldToggle.tsx +33 -0
- package/src/HoverCard.module.css +108 -0
- package/src/HoverCard.tsx +356 -0
- package/src/HoverCardGroup.tsx +77 -0
- package/src/ImageLightbox.module.css +54 -0
- package/src/ImageLightbox.tsx +72 -0
- package/src/ImagePreview.module.css +24 -0
- package/src/ImagePreview.tsx +36 -0
- package/src/InlineEditor.module.css +23 -0
- package/src/InlineEditor.tsx +69 -0
- package/src/Input.module.css +38 -0
- package/src/Input.tsx +24 -0
- package/src/JsonTree.module.css +371 -0
- package/src/JsonTree.tsx +850 -0
- package/src/LinkIcon.tsx +118 -0
- package/src/Menu.module.css +443 -0
- package/src/Menu.tsx +553 -0
- package/src/MenuGroup.module.css +37 -0
- package/src/MenuGroup.tsx +103 -0
- package/src/MenuRow.tsx +89 -0
- package/src/MenuSurface.module.css +65 -0
- package/src/MenuSurface.tsx +54 -0
- package/src/Modal.module.css +147 -0
- package/src/Modal.tsx +96 -0
- package/src/PathLabel.module.css +28 -0
- package/src/PathLabel.tsx +41 -0
- package/src/PermissionIcon.tsx +119 -0
- package/src/Pill.module.css +30 -0
- package/src/Pill.tsx +36 -0
- package/src/QuotePreview.module.css +138 -0
- package/src/QuotePreview.tsx +133 -0
- package/src/ReadBlock.module.css +45 -0
- package/src/ReadBlock.tsx +151 -0
- package/src/ReferenceIcon.tsx +49 -0
- package/src/RiskConfirmation.module.css +47 -0
- package/src/RiskConfirmation.tsx +79 -0
- package/src/RowDragPreview.module.css +12 -0
- package/src/SearchBlock.module.css +114 -0
- package/src/SearchBlock.tsx +281 -0
- package/src/SegmentedControl.module.css +81 -0
- package/src/SegmentedControl.tsx +140 -0
- package/src/SegmentedTabs.module.css +77 -0
- package/src/SegmentedTabs.tsx +84 -0
- package/src/ShortcutKeys.module.css +33 -0
- package/src/ShortcutKeys.tsx +12 -0
- package/src/SiteGlyph.tsx +149 -0
- package/src/StateDot.module.css +100 -0
- package/src/StateDot.tsx +77 -0
- package/src/SubmenuPanel.tsx +51 -0
- package/src/Switch.module.css +49 -0
- package/src/Switch.tsx +42 -0
- package/src/Tag.module.css +57 -0
- package/src/Tag.tsx +42 -0
- package/src/TerminalBlock.module.css +207 -0
- package/src/TerminalBlock.tsx +294 -0
- package/src/TextShimmer.module.css +88 -0
- package/src/TextShimmer.tsx +58 -0
- package/src/Toast.module.css +102 -0
- package/src/Toast.tsx +101 -0
- package/src/Tooltip.module.css +68 -0
- package/src/Tooltip.tsx +273 -0
- package/src/UserMessageBubble.module.css +11 -0
- package/src/UserMessageBubble.tsx +16 -0
- package/src/WebBlock.module.css +153 -0
- package/src/WebBlock.tsx +196 -0
- package/src/ZoomControls.module.css +54 -0
- package/src/ZoomControls.tsx +92 -0
- package/src/ansi.ts +447 -0
- package/src/clipboard.ts +47 -0
- package/src/code-file-icon-artwork.manifest.json +71 -0
- package/src/code-file-icon-artwork.ts +60 -0
- package/src/code-file-types.ts +340 -0
- package/src/code-highlighting.ts +25 -0
- package/src/css-modules.d.ts +6 -0
- package/src/darwin-desktop.ts +11 -0
- package/src/document-zoom.ts +12 -0
- package/src/file-drag-actions.ts +29 -0
- package/src/file-size.ts +16 -0
- package/src/focus.ts +44 -0
- package/src/guide-artwork.tsx +32 -0
- package/src/head-tail-cap.ts +27 -0
- package/src/icons/artwork.ts +157 -0
- package/src/icons/index.tsx +640 -0
- package/src/icons/props.ts +8 -0
- package/src/icons/shared-artwork.tsx +71 -0
- package/src/image-drag.ts +84 -0
- package/src/index.ts +142 -0
- package/src/input-modality.ts +59 -0
- package/src/keyboard-composition.ts +36 -0
- package/src/markdown/CodeBlock.module.css +209 -0
- package/src/markdown/CodeBlock.tsx +268 -0
- package/src/markdown/FenceBlocks.tsx +51 -0
- package/src/markdown/JsonBlock.module.css +34 -0
- package/src/markdown/JsonBlock.tsx +36 -0
- package/src/markdown/MarkdownDelegate.tsx +102 -0
- package/src/markdown/MarkdownText.module.css +511 -0
- package/src/markdown/MarkdownText.tsx +218 -0
- package/src/markdown/cjkFriendlyStrong.ts +83 -0
- package/src/markdown/copy-tex.ts +53 -0
- package/src/markdown/diff-fence.ts +212 -0
- package/src/markdown/file-link.ts +45 -0
- package/src/markdown/highlight.ts +689 -0
- package/src/markdown/incremental.ts +360 -0
- package/src/markdown/katex.tsx +90 -0
- package/src/markdown/local-image-syntax.ts +29 -0
- package/src/markdown/mathCompatibility.ts +349 -0
- package/src/markdown/parse.ts +49 -0
- package/src/markdown/plain-text.ts +121 -0
- package/src/markdown/quote-text.ts +10 -0
- package/src/markdown/render.tsx +834 -0
- package/src/markdown/useViewportHighlighting.ts +72 -0
- package/src/markdown/windows-path-destinations.ts +34 -0
- package/src/menu-submenu-position.ts +20 -0
- package/src/overlay-top-margin.ts +18 -0
- package/src/plugin-artwork.tsx +110 -0
- package/src/pointer-grace.ts +47 -0
- package/src/rank-by-name.ts +93 -0
- package/src/relative-time.ts +36 -0
- package/src/settings-form/SettingsForm.module.css +53 -0
- package/src/settings-form/SettingsForm.tsx +74 -0
- package/src/settings-form/fields.module.css +153 -0
- package/src/settings-form/fields.tsx +151 -0
- package/src/settings-form/form-model.ts +393 -0
- package/src/tooltip-placement.ts +60 -0
- package/src/use-clipboard-copy.ts +44 -0
- package/src/useAnchoredMaxHeight.ts +45 -0
- package/src/useDismissOnOutsidePointer.ts +34 -0
- package/src/useMenuSubmenu.ts +182 -0
- package/src/useModalLayer.ts +108 -0
- package/src/useRowDragPreview.ts +76 -0
- package/src/user-text.module.css +46 -0
- package/src/user-text.tsx +67 -0
- package/lib/types/useAnchoredPosition.d.ts +0 -36
package/lib/index.js
CHANGED
|
@@ -10,9 +10,9 @@ import css$5 from "./RowDragPreview.module.css";
|
|
|
10
10
|
import css$6 from "./Button.module.css";
|
|
11
11
|
import { createPortal } from "react-dom";
|
|
12
12
|
import css$7 from "./ShortcutKeys.module.css";
|
|
13
|
-
import css$8 from "./
|
|
14
|
-
import css$9 from "./
|
|
15
|
-
import css$10 from "./
|
|
13
|
+
import css$8 from "./Tooltip.module.css";
|
|
14
|
+
import css$9 from "./Menu.module.css";
|
|
15
|
+
import css$10 from "./MenuSurface.module.css";
|
|
16
16
|
import css$11 from "./ZoomControls.module.css";
|
|
17
17
|
import css$12 from "./Pill.module.css";
|
|
18
18
|
import css$13 from "./SegmentedTabs.module.css";
|
|
@@ -99,6 +99,10 @@ const ICON_REGULAR_STROKE = 1;
|
|
|
99
99
|
const ICON_MEDIUM_STROKE = 1.3;
|
|
100
100
|
/** Default artwork keyed by glyph name; symbol ids derive from these keys. */
|
|
101
101
|
const ICON_ARTWORK = {
|
|
102
|
+
"layers-outline": {
|
|
103
|
+
size: 16,
|
|
104
|
+
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="${strokeWidth}" stroke-linecap="round" stroke-linejoin="round"><path d="M8.481371 2.304371 a1.159971 1.159971 0 0 0-.962742 0 L2.547971 4.566371 a.580029 .580029 0 0 0 0 1.0614 l4.9764 2.267829 a1.159971 1.159971 0 0 0 .962829 0 l4.9764-2.262 a.580029 .580029 0 0 0 0-1.0614Z" stroke="currentColor"></path><path d="M2.199971 8 a.580029 .580029 0 0 0 .336429 .527829 l4.987971 2.267742 a1.159971 1.159971 0 0 0 .957 0 l4.9764-2.262 A.580029 .580029 0 0 0 13.800029 8" stroke="currentColor"></path><path d="M2.199971 10.899971 a.580029 .580029 0 0 0 .336429 .527829 l4.987971 2.267829 a1.159971 1.159971 0 0 0 .957 0 l4.9764-2.262 A.580029 .580029 0 0 0 13.800029 10.899971" stroke="currentColor"></path></svg>`
|
|
105
|
+
},
|
|
102
106
|
"save-outline": {
|
|
103
107
|
size: 16,
|
|
104
108
|
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="${strokeWidth}" stroke-linejoin="round"><path d="M2.5 1.5h8l3 3v9a1 1 0 0 1-1 1h-10a1 1 0 0 1-1-1v-11a1 1 0 0 1 1-1Z"></path><path d="M4.5 1.5v4h6v-4M4 14.5v-6h7v6"></path></svg>`
|
|
@@ -111,6 +115,14 @@ const ICON_ARTWORK = {
|
|
|
111
115
|
size: 16,
|
|
112
116
|
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="${strokeWidth}"><path d="M6.58727 11.8586C9.55061 11.8586 11.9529 9.45637 11.9529 6.49304C11.9529 3.5297 9.55061 1.12744 6.58727 1.12744C3.62394 1.12744 1.22168 3.5297 1.22168 6.49304C1.22168 9.45637 3.62394 11.8586 6.58727 11.8586Z" stroke="currentColor"></path><path d="M10.2991 10.3933L14.7783 14.8725" stroke="currentColor"></path></svg>`
|
|
113
117
|
},
|
|
118
|
+
"eye-outline": {
|
|
119
|
+
size: 16,
|
|
120
|
+
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="${strokeWidth}"><path d="M1.5 8C3.36 4.41 5.52 2.63 8 2.63C10.48 2.63 12.64 4.41 14.5 8C12.64 11.59 10.48 13.37 8 13.37C5.52 13.37 3.36 11.59 1.5 8Z" stroke="currentColor"></path><circle cx="8" cy="8" r="2.25" stroke="currentColor"></circle></svg>`
|
|
121
|
+
},
|
|
122
|
+
"eye-off-outline": {
|
|
123
|
+
size: 16,
|
|
124
|
+
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="${strokeWidth}"><path d="M2.25 2.25L13.75 13.75" stroke="currentColor"></path><path d="M6.35 3.03C6.88 2.76 7.42 2.63 8 2.63C10.48 2.63 12.64 4.41 14.5 8C13.75 9.48 12.95 10.6 12.08 11.36" stroke="currentColor"></path><path d="M10.28 12.81C9.54 13.19 8.78 13.37 8 13.37C5.52 13.37 3.36 11.59 1.5 8C2.26 6.49 3.08 5.36 3.97 4.6" stroke="currentColor"></path><path d="M6.55 6.55A2.05 2.05 0 0 0 9.45 9.45" stroke="currentColor"></path></svg>`
|
|
125
|
+
},
|
|
114
126
|
"globe-outline": {
|
|
115
127
|
size: 14,
|
|
116
128
|
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="${strokeWidth}"><path d="M7.99986 14.0887C11.3626 14.0887 14.0886 11.3627 14.0886 7.99998C14.0886 4.63727 11.3626 1.91125 7.99986 1.91125C4.63715 1.91125 1.91113 4.63727 1.91113 7.99998C1.91113 11.3627 4.63715 14.0887 7.99986 14.0887Z" stroke="currentColor"></path><path d="M2.34619 8H13.6538" stroke="currentColor" stroke-linecap="square"></path><path d="M7.99976 14.0889C9.23509 14.0889 10.1743 11.3629 10.1743 8.00006C10.1743 4.63739 9.23509 1.91138 7.99976 1.91138" stroke="currentColor"></path><path d="M7.99973 14.0889C6.76445 14.0889 5.8252 11.3629 5.8252 8.00006C5.8252 4.63739 6.76445 1.91138 7.99973 1.91138" stroke="currentColor"></path></svg>`
|
|
@@ -257,7 +269,7 @@ const ICON_ARTWORK = {
|
|
|
257
269
|
},
|
|
258
270
|
"users-outline": {
|
|
259
271
|
size: 16,
|
|
260
|
-
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="${strokeWidth}"><path d="M6 8.
|
|
272
|
+
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="${strokeWidth}"><path d="M6.18 8.2275C7.5620898 8.2275 8.6825 7.1070898 8.6825 5.725C8.6825 4.3429102 7.5620898 3.2225 6.18 3.2225C4.7979102 3.2225 3.6775 4.3429102 3.6775 5.725C3.6775 7.1070898 4.7979102 8.2275 6.18 8.2275Z" stroke="currentColor"></path><path d="M1.63 13.915C1.63 11.185 3.905 10.0475 6.18 10.0475C8.455 10.0475 10.73 11.185 10.73 13.915" stroke="currentColor"></path><path d="M10.275 3.359C11.3215 3.7685 12.0495 4.6785 12.0495 5.725C12.0495 6.7715 11.3215 7.6815 10.275 8.091" stroke="currentColor"></path><path d="M12.004 10.366C13.369 11.003 14.37 12.186 14.37 13.915" stroke="currentColor"></path></svg>`
|
|
261
273
|
},
|
|
262
274
|
"paper-plane-outline": {
|
|
263
275
|
size: 14,
|
|
@@ -279,6 +291,10 @@ const ICON_ARTWORK = {
|
|
|
279
291
|
size: 16,
|
|
280
292
|
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="${strokeWidth}"><path d="M8 1.95317V10.0469" stroke="currentColor"></path><path d="M4.25 6.29688L8 10.0469L11.75 6.29688" stroke="currentColor"></path><path d="M1.5 10.0469V13.158C1.5 13.3937 1.60536 13.6198 1.79289 13.7865C1.98043 13.9532 2.23478 14.0469 2.5 14.0469H13.5C13.7652 14.0469 14.0196 13.9532 14.2071 13.7865C14.3946 13.6198 14.5 13.3937 14.5 13.158V10.0469" stroke="currentColor"></path></svg>`
|
|
281
293
|
},
|
|
294
|
+
"upload-outline": {
|
|
295
|
+
size: 16,
|
|
296
|
+
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="${strokeWidth}"><path d="M8 10.0469V1.95317" stroke="currentColor"></path><path d="M4.25 5.70317L8 1.95317L11.75 5.70317" stroke="currentColor"></path><path d="M1.5 10.0469V13.158C1.5 13.3937 1.60536 13.6198 1.79289 13.7865C1.98043 13.9532 2.23478 14.0469 2.5 14.0469H13.5C13.7652 14.0469 14.0196 13.9532 14.2071 13.7865C14.3946 13.6198 14.5 13.3937 14.5 13.158V10.0469" stroke="currentColor"></path></svg>`
|
|
297
|
+
},
|
|
282
298
|
"play-outline": {
|
|
283
299
|
size: 16,
|
|
284
300
|
svg: (strokeWidth) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke-width="${strokeWidth}"><path d="M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5Z" stroke="currentColor"></path><path d="M10.3329 7.91346C10.3996 7.95195 10.3996 8.04818 10.3329 8.08667L6.78304 10.1362C6.71638 10.1747 6.63304 10.1266 6.63304 10.0496L6.63304 5.95055C6.63304 5.87357 6.71638 5.82546 6.78304 5.86395L10.3329 7.91346Z" stroke="currentColor"></path></svg>`
|
|
@@ -531,6 +547,10 @@ function productIcon(glyph, weight) {
|
|
|
531
547
|
children: jsx("use", { href: `#${id}` })
|
|
532
548
|
});
|
|
533
549
|
}
|
|
550
|
+
/** Regular one-pixel IconLayersOutline artwork. */
|
|
551
|
+
const IconLayersOutlineRegular = productIcon("layers-outline", "regular");
|
|
552
|
+
/** Medium IconLayersOutline artwork with a 1.3px stroke. */
|
|
553
|
+
const IconLayersOutlineMedium = productIcon("layers-outline", "medium");
|
|
534
554
|
/** Regular one-pixel IconNewChatOutline artwork. */
|
|
535
555
|
const IconNewChatOutlineRegular = productIcon("new-chat-outline", "regular");
|
|
536
556
|
/** Medium IconNewChatOutline artwork with a 1.3px stroke. */
|
|
@@ -539,6 +559,14 @@ const IconNewChatOutlineMedium = productIcon("new-chat-outline", "medium");
|
|
|
539
559
|
const IconSearchOutlineRegular = productIcon("search-outline", "regular");
|
|
540
560
|
/** Medium IconSearchOutline artwork with a 1.3px stroke. */
|
|
541
561
|
const IconSearchOutlineMedium = productIcon("search-outline", "medium");
|
|
562
|
+
/** Regular one-pixel IconEyeOutline artwork. */
|
|
563
|
+
const IconEyeOutlineRegular = productIcon("eye-outline", "regular");
|
|
564
|
+
/** Medium IconEyeOutline artwork with a 1.3px stroke. */
|
|
565
|
+
const IconEyeOutlineMedium = productIcon("eye-outline", "medium");
|
|
566
|
+
/** Regular one-pixel IconEyeOffOutline artwork. */
|
|
567
|
+
const IconEyeOffOutlineRegular = productIcon("eye-off-outline", "regular");
|
|
568
|
+
/** Medium IconEyeOffOutline artwork with a 1.3px stroke. */
|
|
569
|
+
const IconEyeOffOutlineMedium = productIcon("eye-off-outline", "medium");
|
|
542
570
|
/** Regular one-pixel IconGlobeOutline artwork. */
|
|
543
571
|
const IconGlobeOutlineRegular = productIcon("globe-outline", "regular");
|
|
544
572
|
/** Medium IconGlobeOutline artwork with a 1.3px stroke. */
|
|
@@ -707,6 +735,10 @@ const IconLoadingOutlineMedium = productIcon("loading-outline", "medium");
|
|
|
707
735
|
const IconDownloadOutlineRegular = productIcon("download-outline", "regular");
|
|
708
736
|
/** Medium IconDownloadOutline artwork with a 1.3px stroke. */
|
|
709
737
|
const IconDownloadOutlineMedium = productIcon("download-outline", "medium");
|
|
738
|
+
/** Regular one-pixel IconUploadOutline artwork: the download tray with the arrow pointing up. */
|
|
739
|
+
const IconUploadOutlineRegular = productIcon("upload-outline", "regular");
|
|
740
|
+
/** Medium IconUploadOutline artwork with a 1.3px stroke. */
|
|
741
|
+
const IconUploadOutlineMedium = productIcon("upload-outline", "medium");
|
|
710
742
|
/** Regular one-pixel IconPlayOutline artwork. */
|
|
711
743
|
const IconPlayOutlineRegular = productIcon("play-outline", "regular");
|
|
712
744
|
/** Medium IconPlayOutline artwork with a 1.3px stroke. */
|
|
@@ -1116,11 +1148,21 @@ const ROW_GLIDE_MS = 200;
|
|
|
1116
1148
|
function sameRows(previous, next) {
|
|
1117
1149
|
return previous.rowKeys.length === next.rowKeys.length && previous.rowKeys.every((key, index) => key === next.rowKeys[index]);
|
|
1118
1150
|
}
|
|
1151
|
+
function visibleViewport(list) {
|
|
1152
|
+
const rect = list.getBoundingClientRect();
|
|
1153
|
+
return {
|
|
1154
|
+
top: Math.max(0, rect.top),
|
|
1155
|
+
bottom: Math.min(window.innerHeight, rect.bottom),
|
|
1156
|
+
left: Math.max(0, rect.left),
|
|
1157
|
+
right: Math.min(window.innerWidth, rect.right)
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1119
1160
|
function intersects(row, viewport) {
|
|
1120
1161
|
return row.bottom > viewport.top && row.top < viewport.bottom && row.right > viewport.left && row.left < viewport.right;
|
|
1121
1162
|
}
|
|
1122
1163
|
/**
|
|
1123
1164
|
* Animates keyed rows only when their rendered membership or order changes.
|
|
1165
|
+
* Rows must intersect both the list and the browser window before or after the commit.
|
|
1124
1166
|
* Motion starts after the first pointer or keyboard input inside the mounted list.
|
|
1125
1167
|
* The parent supplies a positioned container for the inert exit overlay.
|
|
1126
1168
|
*/
|
|
@@ -1133,7 +1175,7 @@ var AnimatedRows = class extends Component {
|
|
|
1133
1175
|
getSnapshotBeforeUpdate(previous) {
|
|
1134
1176
|
const list = this.list.current;
|
|
1135
1177
|
if (!this.armed || sameRows(previous, this.props) || previous.resetKey !== this.props.resetKey || !previous.ready || !this.props.ready || list === null || typeof list.animate !== "function" || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return null;
|
|
1136
|
-
const viewport = list
|
|
1178
|
+
const viewport = visibleViewport(list);
|
|
1137
1179
|
const positions = this.readPositions();
|
|
1138
1180
|
const nextKeys = new Set(this.props.rowKeys);
|
|
1139
1181
|
const removed = /* @__PURE__ */ new Map();
|
|
@@ -1149,6 +1191,7 @@ var AnimatedRows = class extends Component {
|
|
|
1149
1191
|
});
|
|
1150
1192
|
}
|
|
1151
1193
|
return {
|
|
1194
|
+
viewport,
|
|
1152
1195
|
positions,
|
|
1153
1196
|
removed
|
|
1154
1197
|
};
|
|
@@ -1161,13 +1204,13 @@ var AnimatedRows = class extends Component {
|
|
|
1161
1204
|
this.cancelMovements();
|
|
1162
1205
|
const list = this.list.current;
|
|
1163
1206
|
const overlay = this.overlay.current;
|
|
1164
|
-
const viewport = list
|
|
1207
|
+
const viewport = visibleViewport(list);
|
|
1165
1208
|
const origin = overlay.getBoundingClientRect();
|
|
1166
1209
|
const positions = this.readPositions();
|
|
1167
1210
|
for (const [key, row] of positions) {
|
|
1168
1211
|
this.removeExit(key);
|
|
1169
1212
|
const previousRow = snapshot.positions.get(key);
|
|
1170
|
-
if (!intersects(row.rect, viewport) && (previousRow === void 0 || !intersects(previousRow.rect, viewport))) continue;
|
|
1213
|
+
if (!intersects(row.rect, viewport) && (previousRow === void 0 || !intersects(previousRow.rect, snapshot.viewport))) continue;
|
|
1171
1214
|
if (previousRow === void 0) {
|
|
1172
1215
|
this.move(row.element, [{ opacity: 0 }, { opacity: 1 }], ROW_FADE_MS);
|
|
1173
1216
|
continue;
|
|
@@ -1365,137 +1408,18 @@ const Button = forwardRef(function Button({ variant = "ghost", size = "md", icon
|
|
|
1365
1408
|
}), children]
|
|
1366
1409
|
});
|
|
1367
1410
|
});
|
|
1368
|
-
//#endregion
|
|
1369
|
-
//#region lib/types/overlay-top-margin.js
|
|
1370
|
-
/** Shared viewport inset for overlays, derived from the desktop frame's reserved top strip. */
|
|
1371
1411
|
/**
|
|
1372
|
-
*
|
|
1373
|
-
*
|
|
1374
|
-
* @param
|
|
1375
|
-
*
|
|
1376
|
-
*
|
|
1377
|
-
* @
|
|
1378
|
-
* @returns the frame clearance plus 20px (20px in fullscreen), capped by a visible `anchor`, but never below `min`.
|
|
1412
|
+
* Report whether neither side of the parent card can hold the child card.
|
|
1413
|
+
* CSS anchors place the side card and flip it; this decision only selects the page layout.
|
|
1414
|
+
* @param parent - Parent card rectangle in client coordinates.
|
|
1415
|
+
* @param width - Natural child card width.
|
|
1416
|
+
* @param viewportWidth - Layout viewport width.
|
|
1417
|
+
* @returns true when the child must replace the parent page.
|
|
1379
1418
|
*/
|
|
1380
|
-
function
|
|
1381
|
-
const
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1384
|
-
const cap = anchor !== void 0 && anchor.top >= 0 ? anchor.bottom + gap : Number.POSITIVE_INFINITY;
|
|
1385
|
-
return Math.max(min, Math.min((root.hasAttribute("data-fullscreen") ? 0 : clearance) + 20, cap));
|
|
1386
|
-
}
|
|
1387
|
-
//#endregion
|
|
1388
|
-
//#region lib/types/useAnchoredPosition.js
|
|
1389
|
-
/** Synchronous placement for body-portaled panels with a viewport fixed-position containing block. */
|
|
1390
|
-
/**
|
|
1391
|
-
* Keep a fixed panel aligned and constrained to the visible viewport.
|
|
1392
|
-
* Panel CSS consumes `--dsh-anchored-max-width` and `--dsh-anchored-max-height` for size limits.
|
|
1393
|
-
* The hook owns those inline variables and optional min-width while open, restoring them on cleanup.
|
|
1394
|
-
* @param options - Open state, element refs, placement, and optional host rect or content change key.
|
|
1395
|
-
* @returns Fixed left/top coordinates, or null while closed or awaiting an anchor; the first measurement completes before paint.
|
|
1396
|
-
*/
|
|
1397
|
-
function useAnchoredPosition(options) {
|
|
1398
|
-
const { open, anchorRef, panelRef, side = "bottom", align = "start", gap, margin, getAnchorRect, layoutKey, minWidthFromAnchor = false, frameClearance = true } = options;
|
|
1399
|
-
const [position, setPosition] = useState(null);
|
|
1400
|
-
useLayoutEffect(() => {
|
|
1401
|
-
if (!open) {
|
|
1402
|
-
setPosition(null);
|
|
1403
|
-
return;
|
|
1404
|
-
}
|
|
1405
|
-
const anchor = anchorRef.current;
|
|
1406
|
-
const panel = panelRef.current;
|
|
1407
|
-
if (anchor === null || panel === null) return;
|
|
1408
|
-
const win = anchor.ownerDocument.defaultView;
|
|
1409
|
-
if (win === null) return;
|
|
1410
|
-
const viewport = win.visualViewport;
|
|
1411
|
-
const visualOrigin = typeof win.CSS !== "undefined" && win.CSS.supports("-webkit-backdrop-filter", "none");
|
|
1412
|
-
const previous = [
|
|
1413
|
-
"--dsh-anchored-max-width",
|
|
1414
|
-
"--dsh-anchored-max-height",
|
|
1415
|
-
...minWidthFromAnchor ? ["min-width"] : []
|
|
1416
|
-
].map((name) => [
|
|
1417
|
-
name,
|
|
1418
|
-
panel.style.getPropertyValue(name),
|
|
1419
|
-
panel.style.getPropertyPriority(name)
|
|
1420
|
-
]);
|
|
1421
|
-
let active = true;
|
|
1422
|
-
let lastRect = null;
|
|
1423
|
-
const readRect = () => getAnchorRect === void 0 ? anchor.getBoundingClientRect() : getAnchorRect();
|
|
1424
|
-
const place = (rect) => {
|
|
1425
|
-
lastRect = rect === null ? null : {
|
|
1426
|
-
x: rect.x,
|
|
1427
|
-
y: rect.y,
|
|
1428
|
-
width: rect.width,
|
|
1429
|
-
height: rect.height
|
|
1430
|
-
};
|
|
1431
|
-
let next = null;
|
|
1432
|
-
if (rect !== null) {
|
|
1433
|
-
const x = viewport?.offsetLeft ?? 0;
|
|
1434
|
-
const y = viewport?.offsetTop ?? 0;
|
|
1435
|
-
const width = viewport?.width ?? (anchor.ownerDocument.documentElement.clientWidth || win.innerWidth);
|
|
1436
|
-
const height = viewport?.height ?? (anchor.ownerDocument.documentElement.clientHeight || win.innerHeight);
|
|
1437
|
-
const topMargin = frameClearance ? overlayTopMargin(margin, rect, gap) : margin;
|
|
1438
|
-
const maxWidth = Math.max(0, width - margin * 2);
|
|
1439
|
-
panel.style.setProperty("--dsh-anchored-max-width", `${maxWidth}px`);
|
|
1440
|
-
panel.style.setProperty("--dsh-anchored-max-height", `${Math.max(0, height - topMargin - margin)}px`);
|
|
1441
|
-
if (minWidthFromAnchor) panel.style.minWidth = `${Math.min(rect.width, maxWidth)}px`;
|
|
1442
|
-
const panelWidth = panel.offsetWidth;
|
|
1443
|
-
const panelHeight = panel.offsetHeight;
|
|
1444
|
-
const offsetX = visualOrigin ? x : 0;
|
|
1445
|
-
const offsetY = visualOrigin ? y : 0;
|
|
1446
|
-
const left = offsetX + (side === "right" ? rect.right + gap : align === "end" ? rect.right - panelWidth : rect.left);
|
|
1447
|
-
const top = offsetY + (side === "right" ? rect.top : side === "top" ? rect.top - gap - panelHeight : rect.bottom + gap);
|
|
1448
|
-
next = {
|
|
1449
|
-
left: Math.max(x + margin, Math.min(left, x + width - margin - panelWidth)),
|
|
1450
|
-
top: Math.max(y + topMargin, Math.min(top, y + height - margin - panelHeight))
|
|
1451
|
-
};
|
|
1452
|
-
}
|
|
1453
|
-
setPosition((current) => current?.left === next?.left && current?.top === next?.top ? current : next);
|
|
1454
|
-
};
|
|
1455
|
-
const update = () => {
|
|
1456
|
-
if (!active) return;
|
|
1457
|
-
place(readRect());
|
|
1458
|
-
};
|
|
1459
|
-
update();
|
|
1460
|
-
win.addEventListener("scroll", update, true);
|
|
1461
|
-
win.addEventListener("resize", update);
|
|
1462
|
-
viewport?.addEventListener("scroll", update);
|
|
1463
|
-
viewport?.addEventListener("resize", update);
|
|
1464
|
-
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
|
|
1465
|
-
observer?.observe(anchor);
|
|
1466
|
-
observer?.observe(panel);
|
|
1467
|
-
let frame = 0;
|
|
1468
|
-
const track = () => {
|
|
1469
|
-
if (!active) return;
|
|
1470
|
-
const rect = readRect();
|
|
1471
|
-
if (rect?.x !== lastRect?.x || rect?.y !== lastRect?.y || rect?.width !== lastRect?.width || rect?.height !== lastRect?.height) place(rect);
|
|
1472
|
-
frame = win.requestAnimationFrame(track);
|
|
1473
|
-
};
|
|
1474
|
-
frame = win.requestAnimationFrame(track);
|
|
1475
|
-
return () => {
|
|
1476
|
-
active = false;
|
|
1477
|
-
win.cancelAnimationFrame(frame);
|
|
1478
|
-
observer?.disconnect();
|
|
1479
|
-
win.removeEventListener("scroll", update, true);
|
|
1480
|
-
win.removeEventListener("resize", update);
|
|
1481
|
-
viewport?.removeEventListener("scroll", update);
|
|
1482
|
-
viewport?.removeEventListener("resize", update);
|
|
1483
|
-
for (const [name, value, priority] of previous) panel.style.setProperty(name, value, priority);
|
|
1484
|
-
};
|
|
1485
|
-
}, [
|
|
1486
|
-
open,
|
|
1487
|
-
anchorRef,
|
|
1488
|
-
panelRef,
|
|
1489
|
-
side,
|
|
1490
|
-
align,
|
|
1491
|
-
gap,
|
|
1492
|
-
margin,
|
|
1493
|
-
getAnchorRect,
|
|
1494
|
-
layoutKey,
|
|
1495
|
-
minWidthFromAnchor,
|
|
1496
|
-
frameClearance
|
|
1497
|
-
]);
|
|
1498
|
-
return position;
|
|
1419
|
+
function submenuNeedsPage(parent, width, viewportWidth) {
|
|
1420
|
+
const right = parent.right + 4 + width <= viewportWidth - 12;
|
|
1421
|
+
const left = parent.left - 4 - width >= 12;
|
|
1422
|
+
return !right && !left;
|
|
1499
1423
|
}
|
|
1500
1424
|
/**
|
|
1501
1425
|
* Delay a pointer-dismissed popup's close so the pointer can cross the gap
|
|
@@ -1527,339 +1451,265 @@ function usePointerGrace(close) {
|
|
|
1527
1451
|
};
|
|
1528
1452
|
}
|
|
1529
1453
|
//#endregion
|
|
1530
|
-
//#region lib/types/
|
|
1531
|
-
/**
|
|
1532
|
-
/**
|
|
1533
|
-
*
|
|
1534
|
-
* @
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1454
|
+
//#region lib/types/useMenuSubmenu.js
|
|
1455
|
+
/** Owns one menu's child layout mode, pointer grace, and focus transitions. */
|
|
1456
|
+
/** Whether a pointer event can request hover interactions.
|
|
1457
|
+
* @param event - current pointer, including mixed-input touch events.
|
|
1458
|
+
* @returns true for non-touch input with an available hover device.
|
|
1459
|
+
*/
|
|
1460
|
+
function menuHoverAllowed(event) {
|
|
1461
|
+
return event.pointerType !== "touch" && window.matchMedia("(any-hover: hover)").matches;
|
|
1462
|
+
}
|
|
1463
|
+
/** Manage a single child card without owning the root menu's document listeners.
|
|
1464
|
+
* @param options - current entries, root lifetime, and fallback focus destination.
|
|
1465
|
+
* @returns child rendering data and narrow interaction operations.
|
|
1466
|
+
*/
|
|
1467
|
+
function useMenuSubmenu(options) {
|
|
1468
|
+
const { open, items, footer, listRef, refocusAnchor } = options;
|
|
1469
|
+
const [expanded, setExpanded] = useState(null);
|
|
1470
|
+
const panelRef = useRef(null);
|
|
1471
|
+
const pendingFocus = useRef(null);
|
|
1472
|
+
const entry = [...items, ...footer ?? []].find((item) => !("type" in item) && item.id === expanded?.id && item.disabled !== true && item.submenu !== void 0 && item.submenu.length > 0);
|
|
1473
|
+
const trigger = expanded?.trigger ?? null;
|
|
1474
|
+
const parentAnchor = `--dsh-submenu-parent-${useId().replaceAll(":", "")}`;
|
|
1475
|
+
const [needsPage, setNeedsPage] = useState(null);
|
|
1476
|
+
const contains = (node) => panelRef.current?.contains(node) === true;
|
|
1477
|
+
const invalidated = expanded !== null && entry === void 0;
|
|
1478
|
+
const active = document.activeElement;
|
|
1479
|
+
const restoreInvalidatedFocus = open && invalidated && (contains(active) || trigger === active);
|
|
1480
|
+
const backWasFocused = contains(active) && active?.hasAttribute("data-menu-back") === true;
|
|
1481
|
+
const measured = needsPage !== null;
|
|
1482
|
+
const page = entry !== void 0 && expanded?.activated === true && needsPage === true;
|
|
1483
|
+
const hidden = !measured || needsPage && !page;
|
|
1484
|
+
const visible = open && entry !== void 0;
|
|
1485
|
+
useLayoutEffect(() => {
|
|
1486
|
+
const panel = panelRef.current;
|
|
1487
|
+
const parent = listRef.current;
|
|
1488
|
+
if (!visible || panel === null || parent === null || trigger === null) {
|
|
1489
|
+
setNeedsPage(null);
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
const measureRow = () => {
|
|
1493
|
+
panel.style.setProperty("--dsh-submenu-row-offset", `${trigger.getBoundingClientRect().top - parent.getBoundingClientRect().top}px`);
|
|
1494
|
+
};
|
|
1495
|
+
const measure = () => {
|
|
1496
|
+
const layout = panel.getAttribute("data-submenu-layout");
|
|
1497
|
+
panel.removeAttribute("data-submenu-layout");
|
|
1498
|
+
const width = panel.offsetWidth;
|
|
1499
|
+
panel.style.setProperty("--dsh-submenu-height", `${panel.offsetHeight}px`);
|
|
1500
|
+
if (layout !== null) panel.setAttribute("data-submenu-layout", layout);
|
|
1501
|
+
measureRow();
|
|
1502
|
+
const viewport = document.documentElement.clientWidth || window.innerWidth;
|
|
1503
|
+
setNeedsPage(submenuNeedsPage(parent.getBoundingClientRect(), width, viewport));
|
|
1504
|
+
};
|
|
1505
|
+
measure();
|
|
1506
|
+
window.addEventListener("resize", measure);
|
|
1507
|
+
parent.addEventListener("scroll", measureRow, true);
|
|
1508
|
+
const observer = new ResizeObserver(measure);
|
|
1509
|
+
for (const element of [
|
|
1510
|
+
parent,
|
|
1511
|
+
trigger,
|
|
1512
|
+
panel
|
|
1513
|
+
]) observer.observe(element);
|
|
1514
|
+
return () => {
|
|
1515
|
+
window.removeEventListener("resize", measure);
|
|
1516
|
+
parent.removeEventListener("scroll", measureRow, true);
|
|
1517
|
+
observer.disconnect();
|
|
1518
|
+
};
|
|
1519
|
+
}, [
|
|
1520
|
+
visible,
|
|
1521
|
+
entry,
|
|
1522
|
+
trigger,
|
|
1523
|
+
listRef
|
|
1524
|
+
]);
|
|
1525
|
+
const focusFirstChild = () => {
|
|
1526
|
+
const panel = panelRef.current;
|
|
1527
|
+
(panel?.querySelector("button[role=\"menuitem\"]:not(:disabled):not([data-menu-back])") ?? panel?.querySelector("button:not(:disabled)"))?.focus();
|
|
1542
1528
|
};
|
|
1543
|
-
const
|
|
1544
|
-
|
|
1545
|
-
|
|
1529
|
+
const returnToParent = () => {
|
|
1530
|
+
cancelClose();
|
|
1531
|
+
pendingFocus.current = trigger;
|
|
1532
|
+
setExpanded(null);
|
|
1546
1533
|
};
|
|
1547
|
-
const
|
|
1548
|
-
|
|
1534
|
+
const collapse = () => {
|
|
1535
|
+
cancelClose();
|
|
1536
|
+
if (contains(document.activeElement)) returnToParent();
|
|
1537
|
+
else setExpanded(null);
|
|
1549
1538
|
};
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1552
|
-
|
|
1539
|
+
const { arm: armClose, cancel: cancelClose } = usePointerGrace(() => {
|
|
1540
|
+
if (!page) collapse();
|
|
1541
|
+
});
|
|
1542
|
+
const openChild = (id, target, enter = false) => {
|
|
1543
|
+
cancelClose();
|
|
1544
|
+
if (trigger !== target && contains(document.activeElement)) {
|
|
1545
|
+
pendingFocus.current = target;
|
|
1546
|
+
target.focus();
|
|
1547
|
+
pendingFocus.current = null;
|
|
1548
|
+
}
|
|
1549
|
+
pendingFocus.current = enter ? "child" : null;
|
|
1550
|
+
setExpanded((current) => current?.id === id ? enter && !current.activated ? {
|
|
1551
|
+
...current,
|
|
1552
|
+
activated: true
|
|
1553
|
+
} : current : {
|
|
1554
|
+
id,
|
|
1555
|
+
trigger: target,
|
|
1556
|
+
activated: enter
|
|
1557
|
+
});
|
|
1558
|
+
if (enter) focusFirstChild();
|
|
1559
|
+
};
|
|
1560
|
+
useLayoutEffect(() => {
|
|
1561
|
+
if (!open || invalidated) {
|
|
1562
|
+
cancelClose();
|
|
1563
|
+
pendingFocus.current = null;
|
|
1564
|
+
setExpanded(null);
|
|
1565
|
+
if (restoreInvalidatedFocus && (document.activeElement === document.body || document.activeElement === trigger)) {
|
|
1566
|
+
const target = trigger?.isConnected === true && !trigger.disabled ? trigger : listRef.current?.querySelector("button:not(:disabled)");
|
|
1567
|
+
pendingFocus.current = target ?? null;
|
|
1568
|
+
if (target != null) target.focus();
|
|
1569
|
+
else refocusAnchor();
|
|
1570
|
+
pendingFocus.current = null;
|
|
1571
|
+
}
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
if (entry === void 0 && pendingFocus.current instanceof HTMLButtonElement) {
|
|
1575
|
+
pendingFocus.current.focus();
|
|
1576
|
+
pendingFocus.current = null;
|
|
1577
|
+
}
|
|
1578
|
+
if (entry === void 0 || hidden) return;
|
|
1579
|
+
if (pendingFocus.current === "child" || page && listRef.current?.contains(document.activeElement) || !page && backWasFocused) {
|
|
1580
|
+
focusFirstChild();
|
|
1581
|
+
pendingFocus.current = null;
|
|
1582
|
+
}
|
|
1583
|
+
}, [
|
|
1584
|
+
open,
|
|
1585
|
+
entry,
|
|
1586
|
+
needsPage,
|
|
1587
|
+
page,
|
|
1588
|
+
hidden,
|
|
1589
|
+
invalidated,
|
|
1590
|
+
restoreInvalidatedFocus,
|
|
1591
|
+
backWasFocused,
|
|
1592
|
+
cancelClose
|
|
1593
|
+
]);
|
|
1594
|
+
const collapseFrom = (event) => {
|
|
1595
|
+
const row = event.target.closest("button[role=\"menuitem\"]");
|
|
1596
|
+
if (row === null || row.getAttribute("aria-haspopup") === "menu") return;
|
|
1597
|
+
if (row.closest("[role=\"menu\"]") === event.currentTarget) collapse();
|
|
1553
1598
|
};
|
|
1554
|
-
document.addEventListener("compositionstart", start, true);
|
|
1555
|
-
document.addEventListener("compositionend", end, true);
|
|
1556
|
-
document.addEventListener("keyup", release, true);
|
|
1557
|
-
document.defaultView?.addEventListener("blur", blur);
|
|
1558
1599
|
return {
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1600
|
+
entry,
|
|
1601
|
+
panelRef,
|
|
1602
|
+
parentAnchor,
|
|
1603
|
+
measured,
|
|
1604
|
+
page,
|
|
1605
|
+
hidden,
|
|
1606
|
+
contains,
|
|
1607
|
+
activeList: (focused) => page || contains(focused) ? panelRef.current : listRef.current,
|
|
1608
|
+
returnToParent: () => {
|
|
1609
|
+
if (entry === void 0 || hidden) return false;
|
|
1610
|
+
returnToParent();
|
|
1611
|
+
return true;
|
|
1563
1612
|
},
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1613
|
+
openChild,
|
|
1614
|
+
focusParent: (id, target) => {
|
|
1615
|
+
if (pendingFocus.current !== target) openChild(id, target);
|
|
1616
|
+
},
|
|
1617
|
+
leave: () => {
|
|
1618
|
+
if (!page) armClose();
|
|
1619
|
+
},
|
|
1620
|
+
cancelClose,
|
|
1621
|
+
collapseFrom
|
|
1570
1622
|
};
|
|
1571
1623
|
}
|
|
1572
1624
|
//#endregion
|
|
1573
|
-
//#region lib/types/
|
|
1574
|
-
/**
|
|
1575
|
-
const releases = /* @__PURE__ */ new WeakMap();
|
|
1576
|
-
const navigationKeys = new Set([
|
|
1577
|
-
"Tab",
|
|
1578
|
-
"ArrowUp",
|
|
1579
|
-
"ArrowDown",
|
|
1580
|
-
"ArrowLeft",
|
|
1581
|
-
"ArrowRight",
|
|
1582
|
-
"Home",
|
|
1583
|
-
"End"
|
|
1584
|
-
]);
|
|
1585
|
-
let mobileDevice;
|
|
1625
|
+
//#region lib/types/ShortcutKeys.js
|
|
1626
|
+
/** Shared shortcut keycaps; callers supply the effective platform presentation. */
|
|
1586
1627
|
/**
|
|
1587
|
-
*
|
|
1588
|
-
*
|
|
1589
|
-
*
|
|
1590
|
-
* @returns true for recognized mobile devices; false for other devices, including unrecognized UAs.
|
|
1628
|
+
* Render one command's keycaps without owning binding defaults or localized copy.
|
|
1629
|
+
* @param props - effective key labels, presentation variant and optional interaction styling.
|
|
1630
|
+
* @returns unboxed keys by default, or tooltip keycaps with plus-separated combinations grouped together.
|
|
1591
1631
|
*/
|
|
1592
|
-
function
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1632
|
+
function ShortcutKeys({ keys, variant = "plain", className }) {
|
|
1633
|
+
return jsx("span", {
|
|
1634
|
+
className: clsx(css$7.keys, variant === "tooltip" && css$7.tooltip, variant === "tooltip" && keys.includes("+") && css$7.joined, className),
|
|
1635
|
+
children: keys.map((key, index) => jsx("kbd", {
|
|
1636
|
+
className: key === "+" ? css$7.separator : css$7.key,
|
|
1637
|
+
children: key
|
|
1638
|
+
}, index))
|
|
1639
|
+
});
|
|
1597
1640
|
}
|
|
1641
|
+
//#endregion
|
|
1642
|
+
//#region lib/types/tooltip-placement.js
|
|
1643
|
+
const opposite = {
|
|
1644
|
+
right: "left",
|
|
1645
|
+
left: "right",
|
|
1646
|
+
top: "bottom",
|
|
1647
|
+
bottom: "top"
|
|
1648
|
+
};
|
|
1598
1649
|
/**
|
|
1599
|
-
*
|
|
1600
|
-
*
|
|
1601
|
-
*
|
|
1602
|
-
* @param element - control or container receiving automatic focus.
|
|
1603
|
-
* @param options - browser focus options, including scroll preservation.
|
|
1650
|
+
* Prefer the requested side, its opposite, then perpendicular sides without covering the anchor.
|
|
1651
|
+
* @param input - Observed dimensions, anchor edges, viewport and requested placement; horizontal gaps remain 10px.
|
|
1652
|
+
* @returns Border-box coordinates and the selected side; if no side fits, a viewport-bounded fallback.
|
|
1604
1653
|
*/
|
|
1605
|
-
function
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1654
|
+
function placeTooltip(input) {
|
|
1655
|
+
const { anchor, viewportWidth, viewportHeight, side, align, gap } = input;
|
|
1656
|
+
let { width, height } = input;
|
|
1657
|
+
const margin = 12;
|
|
1658
|
+
const maxWidth = Math.max(0, viewportWidth - margin * 2);
|
|
1659
|
+
const maxHeight = Math.max(0, viewportHeight - margin * 2);
|
|
1660
|
+
width = Math.min(width, maxWidth);
|
|
1661
|
+
height = Math.min(height, maxHeight);
|
|
1662
|
+
const clampX = (x) => Math.max(margin, Math.min(x, viewportWidth - margin - width));
|
|
1663
|
+
const clampY = (y) => Math.max(margin, Math.min(y, viewportHeight - margin - height));
|
|
1664
|
+
const horizontal = side === "right" || side === "left";
|
|
1665
|
+
const candidates = [
|
|
1666
|
+
side,
|
|
1667
|
+
opposite[side],
|
|
1668
|
+
...horizontal ? ["bottom", "top"] : ["right", "left"]
|
|
1669
|
+
];
|
|
1670
|
+
const positions = {
|
|
1671
|
+
right: {
|
|
1672
|
+
left: anchor.right + 10,
|
|
1673
|
+
top: clampY((anchor.top + anchor.bottom - height) / 2)
|
|
1674
|
+
},
|
|
1675
|
+
left: {
|
|
1676
|
+
left: anchor.left - 10 - width,
|
|
1677
|
+
top: clampY((anchor.top + anchor.bottom - height) / 2)
|
|
1678
|
+
},
|
|
1679
|
+
bottom: {
|
|
1680
|
+
left: clampX(align === "end" ? anchor.right - width : (anchor.left + anchor.right - width) / 2),
|
|
1681
|
+
top: anchor.bottom + gap
|
|
1682
|
+
},
|
|
1683
|
+
top: {
|
|
1684
|
+
left: clampX(align === "end" ? anchor.right - width : (anchor.left + anchor.right - width) / 2),
|
|
1685
|
+
top: anchor.top - gap - height
|
|
1686
|
+
}
|
|
1612
1687
|
};
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1688
|
+
for (const candidate of candidates) {
|
|
1689
|
+
const position = positions[candidate];
|
|
1690
|
+
if (position.left >= margin && position.top >= margin && position.left + width <= viewportWidth - margin && position.top + height <= viewportHeight - margin) return {
|
|
1691
|
+
...position,
|
|
1692
|
+
side: candidate,
|
|
1693
|
+
width,
|
|
1694
|
+
height,
|
|
1695
|
+
overflow: false
|
|
1696
|
+
};
|
|
1697
|
+
}
|
|
1698
|
+
const position = positions[side];
|
|
1699
|
+
return {
|
|
1700
|
+
left: clampX(position.left),
|
|
1701
|
+
top: clampY(position.top),
|
|
1702
|
+
side,
|
|
1703
|
+
width,
|
|
1704
|
+
height,
|
|
1705
|
+
overflow: true
|
|
1615
1706
|
};
|
|
1616
|
-
releases.set(element, release);
|
|
1617
|
-
element.setAttribute("data-dsh-automatic-focus", "");
|
|
1618
|
-
element.addEventListener("blur", release);
|
|
1619
|
-
element.addEventListener("keydown", navigate, true);
|
|
1620
|
-
element.focus(options);
|
|
1621
|
-
if (!element.matches(":focus")) release();
|
|
1622
1707
|
}
|
|
1623
1708
|
//#endregion
|
|
1624
|
-
//#region lib/types/
|
|
1625
|
-
/** Shared modal keyboard ownership and focus lifetime. */
|
|
1626
|
-
/** Dialog and menu elements whose document order determines foreground shortcut ownership. */
|
|
1627
|
-
const modalSelector = "[role=\"dialog\"][aria-modal=\"true\"], [role=\"menu\"]";
|
|
1628
|
-
const layers = /* @__PURE__ */ new WeakMap();
|
|
1709
|
+
//#region lib/types/useDismissOnOutsidePointer.js
|
|
1629
1710
|
/**
|
|
1630
|
-
*
|
|
1631
|
-
*
|
|
1632
|
-
* @param document - product document whose modal owns the close command.
|
|
1633
|
-
*/
|
|
1634
|
-
function closeTopModal(document) {
|
|
1635
|
-
const top = layers.get(document)?.at(-1);
|
|
1636
|
-
if (top === void 0) return;
|
|
1637
|
-
if ([...document.querySelectorAll("[role=\"dialog\"][aria-modal=\"true\"], [role=\"menu\"]")].at(-1) === top.element) top.close();
|
|
1638
|
-
}
|
|
1639
|
-
/**
|
|
1640
|
-
* Whether an anchor belongs behind the current modal and must yield keyboard input.
|
|
1641
|
-
* @param anchor - local control owning the input handler.
|
|
1642
|
-
* @returns true when another modal owns the foreground.
|
|
1643
|
-
*/
|
|
1644
|
-
function isBehindModal(anchor) {
|
|
1645
|
-
if (anchor === null) return false;
|
|
1646
|
-
const top = layers.get(anchor.ownerDocument)?.at(-1);
|
|
1647
|
-
return top !== void 0 && !top.element.contains(anchor);
|
|
1648
|
-
}
|
|
1649
|
-
const focusable = "button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), a[href], [tabindex=\"0\"]";
|
|
1650
|
-
/**
|
|
1651
|
-
* Give only the top modal Escape and Tab ownership, then restore its previous focus.
|
|
1652
|
-
* Automatic entry and return focus omit outlines; keyboard traversal retains its indicators.
|
|
1653
|
-
* Controls mounted with the dialog use data-modal-autofocus for initial focus;
|
|
1654
|
-
* React autoFocus runs before this layer can capture the invoking control.
|
|
1655
|
-
* Local menus handle their Escape during capture before this bubble listener.
|
|
1656
|
-
* @param dialog - mounted dialog element.
|
|
1657
|
-
* @param open - whether this layer is active.
|
|
1658
|
-
* @param onClose - top-layer Escape or application close action.
|
|
1659
|
-
*/
|
|
1660
|
-
function useModalLayer(dialog, open, onClose) {
|
|
1661
|
-
const close = useRef(onClose);
|
|
1662
|
-
const pendingRestore = useRef(void 0);
|
|
1663
|
-
close.current = onClose;
|
|
1664
|
-
useLayoutEffect(() => {
|
|
1665
|
-
const target = pendingRestore.current;
|
|
1666
|
-
pendingRestore.current = void 0;
|
|
1667
|
-
const element = dialog.current;
|
|
1668
|
-
if (!open && element?.contains(element.ownerDocument.activeElement) && target?.isConnected && !target.closest("[inert], [hidden]") && !isBehindModal(target)) focusWithoutRing(target, { preventScroll: true });
|
|
1669
|
-
if (!open || element === null) return;
|
|
1670
|
-
const document = element.ownerDocument;
|
|
1671
|
-
const composition = observeComposition(document);
|
|
1672
|
-
const previous = document.activeElement;
|
|
1673
|
-
const stack = layers.get(document) ?? [];
|
|
1674
|
-
layers.set(document, stack);
|
|
1675
|
-
const layer = {
|
|
1676
|
-
element,
|
|
1677
|
-
close: () => {
|
|
1678
|
-
close.current();
|
|
1679
|
-
}
|
|
1680
|
-
};
|
|
1681
|
-
stack.push(layer);
|
|
1682
|
-
const initial = element.querySelector("[data-modal-autofocus]") ?? element.querySelector(focusable) ?? element;
|
|
1683
|
-
if (!element.contains(document.activeElement)) focusWithoutRing(initial);
|
|
1684
|
-
const keydown = (event) => {
|
|
1685
|
-
const composing = composition.guards(event);
|
|
1686
|
-
if (stack.at(-1) !== layer || event.defaultPrevented || composing || event.ctrlKey || event.altKey || event.metaKey) return;
|
|
1687
|
-
if (event.key === "Escape" && !event.shiftKey) {
|
|
1688
|
-
event.preventDefault();
|
|
1689
|
-
if (!event.repeat) close.current();
|
|
1690
|
-
}
|
|
1691
|
-
if (event.key !== "Tab") return;
|
|
1692
|
-
if (document.activeElement?.closest("[role=\"menu\"]")) return;
|
|
1693
|
-
const items = [...element.querySelectorAll(focusable)].filter((item) => !item.closest("[inert], [hidden]"));
|
|
1694
|
-
const first = items[0] ?? element;
|
|
1695
|
-
const last = items.at(-1) ?? element;
|
|
1696
|
-
const atEdge = event.shiftKey ? document.activeElement === first : document.activeElement === last;
|
|
1697
|
-
if (document.activeElement === element || !element.contains(document.activeElement) || atEdge) {
|
|
1698
|
-
event.preventDefault();
|
|
1699
|
-
(event.shiftKey ? last : first).focus();
|
|
1700
|
-
}
|
|
1701
|
-
};
|
|
1702
|
-
document.addEventListener("keydown", keydown);
|
|
1703
|
-
return () => {
|
|
1704
|
-
composition.dispose();
|
|
1705
|
-
const wasTop = stack.at(-1) === layer;
|
|
1706
|
-
stack.splice(stack.indexOf(layer), 1);
|
|
1707
|
-
document.removeEventListener("keydown", keydown);
|
|
1708
|
-
if (stack.length === 0) layers.delete(document);
|
|
1709
|
-
if (wasTop) {
|
|
1710
|
-
const target = previous instanceof HTMLElement && previous.isConnected ? previous : stack.at(-1)?.element;
|
|
1711
|
-
if (target !== void 0) {
|
|
1712
|
-
pendingRestore.current = target;
|
|
1713
|
-
focusWithoutRing(target);
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
};
|
|
1717
|
-
}, [dialog, open]);
|
|
1718
|
-
}
|
|
1719
|
-
//#endregion
|
|
1720
|
-
//#region lib/types/ShortcutKeys.js
|
|
1721
|
-
/** Shared shortcut keycaps; callers supply the effective platform presentation. */
|
|
1722
|
-
/**
|
|
1723
|
-
* Render one command's keycaps without owning binding defaults or localized copy.
|
|
1724
|
-
* @param props - effective key labels, presentation variant and optional interaction styling.
|
|
1725
|
-
* @returns unboxed keys by default, or tooltip keycaps with plus-separated combinations grouped together.
|
|
1726
|
-
*/
|
|
1727
|
-
function ShortcutKeys({ keys, variant = "plain", className }) {
|
|
1728
|
-
return jsx("span", {
|
|
1729
|
-
className: clsx(css$7.keys, variant === "tooltip" && css$7.tooltip, variant === "tooltip" && keys.includes("+") && css$7.joined, className),
|
|
1730
|
-
children: keys.map((key, index) => jsx("kbd", {
|
|
1731
|
-
className: key === "+" ? css$7.separator : css$7.key,
|
|
1732
|
-
children: key
|
|
1733
|
-
}, index))
|
|
1734
|
-
});
|
|
1735
|
-
}
|
|
1736
|
-
//#endregion
|
|
1737
|
-
//#region lib/types/MenuSurface.js
|
|
1738
|
-
/** Shared menu material and the macOS backing that lets Chromium blur transparent windows. */
|
|
1739
|
-
/** Context-menu transition durations in milliseconds, shared with its lifecycle owner. */
|
|
1740
|
-
const MENU_TRANSITION_MS = Object.freeze({
|
|
1741
|
-
enter: 40,
|
|
1742
|
-
dismiss: 80,
|
|
1743
|
-
replace: 10,
|
|
1744
|
-
prepare: 20
|
|
1745
|
-
});
|
|
1746
|
-
/**
|
|
1747
|
-
* Paint a menu and, on macOS, an opaque backing behind the page content within its bounds.
|
|
1748
|
-
* CSS anchors keep each backing aligned during placement, resizing, and nested-menu movement.
|
|
1749
|
-
* @param props - Div content and placement, and compact geometry.
|
|
1750
|
-
* @param ref - The visible menu div, excluding the non-interactive backing.
|
|
1751
|
-
* @returns Menu content plus a backing portal removed with the menu.
|
|
1752
|
-
*/
|
|
1753
|
-
const MenuSurface = forwardRef(function MenuSurface({ compact = false, phase, className, style, children, ...props }, ref) {
|
|
1754
|
-
const id = useId();
|
|
1755
|
-
const backingRef = useRef(null);
|
|
1756
|
-
useLayoutEffect(() => {
|
|
1757
|
-
document.body.appendChild(backingRef.current);
|
|
1758
|
-
}, []);
|
|
1759
|
-
const anchorStyle = {
|
|
1760
|
-
"--dsh-menu-anchor": `--dsh-menu-${id.replaceAll(":", "")}`,
|
|
1761
|
-
"--dsh-menu-enter": `${MENU_TRANSITION_MS.enter}ms`,
|
|
1762
|
-
"--dsh-menu-dismiss": `${MENU_TRANSITION_MS.dismiss}ms`,
|
|
1763
|
-
"--dsh-menu-replace": `${MENU_TRANSITION_MS.replace}ms`
|
|
1764
|
-
};
|
|
1765
|
-
return jsxs(Fragment, { children: [jsxs("div", {
|
|
1766
|
-
...props,
|
|
1767
|
-
ref,
|
|
1768
|
-
"data-menu-material": "translucent",
|
|
1769
|
-
"data-menu-phase": phase,
|
|
1770
|
-
className: clsx(css$8.surface, compact && css$8.compact, className),
|
|
1771
|
-
style: {
|
|
1772
|
-
...style,
|
|
1773
|
-
...anchorStyle
|
|
1774
|
-
},
|
|
1775
|
-
children: [jsx("div", {
|
|
1776
|
-
"aria-hidden": "true",
|
|
1777
|
-
className: css$8.material
|
|
1778
|
-
}), children]
|
|
1779
|
-
}), createPortal(jsx("div", {
|
|
1780
|
-
ref: backingRef,
|
|
1781
|
-
"aria-hidden": "true",
|
|
1782
|
-
"data-menu-backing": "",
|
|
1783
|
-
"data-menu-phase": phase,
|
|
1784
|
-
className: clsx(css$8.backing, compact && css$8.compact),
|
|
1785
|
-
style: {
|
|
1786
|
-
...anchorStyle,
|
|
1787
|
-
visibility: style?.visibility
|
|
1788
|
-
}
|
|
1789
|
-
}), document.body)] });
|
|
1790
|
-
});
|
|
1791
|
-
//#endregion
|
|
1792
|
-
//#region lib/types/tooltip-placement.js
|
|
1793
|
-
const opposite = {
|
|
1794
|
-
right: "left",
|
|
1795
|
-
left: "right",
|
|
1796
|
-
top: "bottom",
|
|
1797
|
-
bottom: "top"
|
|
1798
|
-
};
|
|
1799
|
-
/**
|
|
1800
|
-
* Prefer the requested side, its opposite, then perpendicular sides without covering the anchor.
|
|
1801
|
-
* @param input - Observed dimensions, anchor edges, viewport and requested placement; horizontal gaps remain 10px.
|
|
1802
|
-
* @returns Border-box coordinates and the selected side; if no side fits, a viewport-bounded fallback.
|
|
1803
|
-
*/
|
|
1804
|
-
function placeTooltip(input) {
|
|
1805
|
-
const { anchor, viewportWidth, viewportHeight, side, align, gap } = input;
|
|
1806
|
-
let { width, height } = input;
|
|
1807
|
-
const margin = 12;
|
|
1808
|
-
const maxWidth = Math.max(0, viewportWidth - margin * 2);
|
|
1809
|
-
const maxHeight = Math.max(0, viewportHeight - margin * 2);
|
|
1810
|
-
width = Math.min(width, maxWidth);
|
|
1811
|
-
height = Math.min(height, maxHeight);
|
|
1812
|
-
const clampX = (x) => Math.max(margin, Math.min(x, viewportWidth - margin - width));
|
|
1813
|
-
const clampY = (y) => Math.max(margin, Math.min(y, viewportHeight - margin - height));
|
|
1814
|
-
const horizontal = side === "right" || side === "left";
|
|
1815
|
-
const candidates = [
|
|
1816
|
-
side,
|
|
1817
|
-
opposite[side],
|
|
1818
|
-
...horizontal ? ["bottom", "top"] : ["right", "left"]
|
|
1819
|
-
];
|
|
1820
|
-
const positions = {
|
|
1821
|
-
right: {
|
|
1822
|
-
left: anchor.right + 10,
|
|
1823
|
-
top: clampY((anchor.top + anchor.bottom - height) / 2)
|
|
1824
|
-
},
|
|
1825
|
-
left: {
|
|
1826
|
-
left: anchor.left - 10 - width,
|
|
1827
|
-
top: clampY((anchor.top + anchor.bottom - height) / 2)
|
|
1828
|
-
},
|
|
1829
|
-
bottom: {
|
|
1830
|
-
left: clampX(align === "end" ? anchor.right - width : (anchor.left + anchor.right - width) / 2),
|
|
1831
|
-
top: anchor.bottom + gap
|
|
1832
|
-
},
|
|
1833
|
-
top: {
|
|
1834
|
-
left: clampX(align === "end" ? anchor.right - width : (anchor.left + anchor.right - width) / 2),
|
|
1835
|
-
top: anchor.top - gap - height
|
|
1836
|
-
}
|
|
1837
|
-
};
|
|
1838
|
-
for (const candidate of candidates) {
|
|
1839
|
-
const position = positions[candidate];
|
|
1840
|
-
if (position.left >= margin && position.top >= margin && position.left + width <= viewportWidth - margin && position.top + height <= viewportHeight - margin) return {
|
|
1841
|
-
...position,
|
|
1842
|
-
side: candidate,
|
|
1843
|
-
width,
|
|
1844
|
-
height,
|
|
1845
|
-
overflow: false
|
|
1846
|
-
};
|
|
1847
|
-
}
|
|
1848
|
-
const position = positions[side];
|
|
1849
|
-
return {
|
|
1850
|
-
left: clampX(position.left),
|
|
1851
|
-
top: clampY(position.top),
|
|
1852
|
-
side,
|
|
1853
|
-
width,
|
|
1854
|
-
height,
|
|
1855
|
-
overflow: true
|
|
1856
|
-
};
|
|
1857
|
-
}
|
|
1858
|
-
//#endregion
|
|
1859
|
-
//#region lib/types/useDismissOnOutsidePointer.js
|
|
1860
|
-
/**
|
|
1861
|
-
* Outside-pointer dismissal for trigger-owned popovers (jobs list, Cordis
|
|
1862
|
-
* panel): while the surface is open, a pointerdown outside the root closes it.
|
|
1711
|
+
* Outside-pointer dismissal for trigger-owned popovers (jobs list, Cordis
|
|
1712
|
+
* panel): while the surface is open, a pointerdown outside the root closes it.
|
|
1863
1713
|
*/
|
|
1864
1714
|
/**
|
|
1865
1715
|
* Close an open popover when a pointerdown lands outside its root element.
|
|
@@ -2152,7 +2002,7 @@ function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayM
|
|
|
2152
2002
|
const content = visible && !suppressed && jsxs("span", {
|
|
2153
2003
|
ref: bubble,
|
|
2154
2004
|
id: openOnClick ? id : void 0,
|
|
2155
|
-
className: css$
|
|
2005
|
+
className: css$8.bubble,
|
|
2156
2006
|
"data-side": side,
|
|
2157
2007
|
"data-portal": portal || void 0,
|
|
2158
2008
|
"data-pinned": pinned || void 0,
|
|
@@ -2167,7 +2017,7 @@ function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayM
|
|
|
2167
2017
|
role: "tooltip",
|
|
2168
2018
|
"aria-label": shortcutKeys?.length ? [resolvedLabel, shortcutKeys.join(" ")].filter(Boolean).join(" ") : void 0,
|
|
2169
2019
|
children: [resolvedLabel && jsx("span", {
|
|
2170
|
-
className: css$
|
|
2020
|
+
className: css$8.label,
|
|
2171
2021
|
children: resolvedLabel
|
|
2172
2022
|
}), shortcutKeys !== void 0 && shortcutKeys.length > 0 && jsx(ShortcutKeys, {
|
|
2173
2023
|
keys: shortcutKeys,
|
|
@@ -2220,32 +2070,21 @@ function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayM
|
|
|
2220
2070
|
});
|
|
2221
2071
|
}
|
|
2222
2072
|
//#endregion
|
|
2223
|
-
//#region lib/types/
|
|
2224
|
-
/**
|
|
2225
|
-
|
|
2226
|
-
*
|
|
2227
|
-
*
|
|
2228
|
-
* without any shared state. Closing the menu stays the owner's decision, as
|
|
2229
|
-
* it is for data rows.
|
|
2230
|
-
* @param props.children - visible row label.
|
|
2231
|
-
* @param props.shortcut - effective key labels and accessible combination.
|
|
2232
|
-
* @param props.icon - optional leading icon.
|
|
2233
|
-
* @param props.current - whether the row identifies the currently displayed page or view.
|
|
2234
|
-
* @param props.disabled - whether the row cannot be activated.
|
|
2235
|
-
* @param props.disabledReason - why a disabled row cannot be activated, shown in a tooltip and read as its description.
|
|
2236
|
-
* @param props.danger - whether to use the destructive row colors.
|
|
2237
|
-
* @param props.separatorBefore - whether this row starts a new group (hairline above it).
|
|
2238
|
-
* @param props.onSelect - row activation callback.
|
|
2239
|
-
* @returns one menu-item row.
|
|
2073
|
+
//#region lib/types/MenuRow.js
|
|
2074
|
+
/** Package-internal row presentation shared by component, data, and child menu entries. */
|
|
2075
|
+
/** Render a focus-stable row with optional selection, shortcut, and disabled explanation.
|
|
2076
|
+
* @param props - row content, native button events, and optional pointer wrapper events.
|
|
2077
|
+
* @returns one menu item; explained disabled rows remain focusable but never activate.
|
|
2240
2078
|
*/
|
|
2241
|
-
function
|
|
2079
|
+
function MenuRow({ children, icon, shortcut, current, disabled = false, disabledReason, danger, separatorBefore, selected, selection = "check", reserveIcon, decorativeIcon = true, wrapperProps, ...button }) {
|
|
2242
2080
|
const reasonId = useId();
|
|
2243
2081
|
const explained = disabled && disabledReason !== void 0;
|
|
2244
2082
|
return jsxs("div", {
|
|
2245
|
-
|
|
2083
|
+
...wrapperProps,
|
|
2084
|
+
className: css$9.itemWrap,
|
|
2246
2085
|
children: [
|
|
2247
2086
|
separatorBefore && jsx("div", {
|
|
2248
|
-
className: css$
|
|
2087
|
+
className: css$9.separator,
|
|
2249
2088
|
role: "separator"
|
|
2250
2089
|
}),
|
|
2251
2090
|
jsx(Tooltip, {
|
|
@@ -2256,31 +2095,38 @@ function MenuItemButton({ children, shortcut, icon, current, disabled = false, d
|
|
|
2256
2095
|
maxWidth: 300,
|
|
2257
2096
|
portal: true,
|
|
2258
2097
|
children: jsxs("button", {
|
|
2098
|
+
...button,
|
|
2259
2099
|
type: "button",
|
|
2260
2100
|
role: "menuitem",
|
|
2261
|
-
className: clsx(css$
|
|
2101
|
+
className: clsx(css$9.item, selected && (selection === "fill" ? css$9.selectedFill : css$9.selected), danger && css$9.danger),
|
|
2262
2102
|
disabled: disabled && !explained,
|
|
2263
2103
|
"aria-disabled": explained || void 0,
|
|
2264
2104
|
"aria-describedby": explained ? reasonId : void 0,
|
|
2265
2105
|
"aria-keyshortcuts": shortcut?.aria,
|
|
2266
2106
|
"aria-current": current === true ? "page" : void 0,
|
|
2267
|
-
onClick: explained ? void 0 :
|
|
2107
|
+
onClick: explained ? void 0 : button.onClick,
|
|
2268
2108
|
children: [
|
|
2269
|
-
icon !== void 0 && jsx("span", {
|
|
2270
|
-
|
|
2109
|
+
(icon !== void 0 || reserveIcon) && jsx("span", {
|
|
2110
|
+
"aria-hidden": decorativeIcon || void 0,
|
|
2111
|
+
className: css$9.itemIcon,
|
|
2271
2112
|
children: icon
|
|
2272
2113
|
}),
|
|
2273
2114
|
jsx("span", {
|
|
2274
|
-
className: css$
|
|
2115
|
+
className: css$9.itemLabel,
|
|
2275
2116
|
children
|
|
2276
2117
|
}),
|
|
2277
2118
|
shortcut !== void 0 && jsx("span", {
|
|
2278
2119
|
"aria-hidden": "true",
|
|
2279
|
-
className: css$
|
|
2120
|
+
className: css$9.shortcut,
|
|
2280
2121
|
children: jsx(ShortcutKeys, {
|
|
2281
2122
|
keys: shortcut.keys,
|
|
2282
|
-
className: css$
|
|
2123
|
+
className: css$9.shortcutKeys
|
|
2283
2124
|
})
|
|
2125
|
+
}),
|
|
2126
|
+
selected && selection === "check" && jsx(IconCheckOutlineRegular, { className: css$9.check }),
|
|
2127
|
+
button["aria-haspopup"] === "menu" && jsx(IconChevronRightOutlineRegular, {
|
|
2128
|
+
"aria-hidden": "true",
|
|
2129
|
+
className: css$9.check
|
|
2284
2130
|
})
|
|
2285
2131
|
]
|
|
2286
2132
|
})
|
|
@@ -2293,46 +2139,391 @@ function MenuItemButton({ children, shortcut, icon, current, disabled = false, d
|
|
|
2293
2139
|
]
|
|
2294
2140
|
});
|
|
2295
2141
|
}
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
/** Mark icon columns within each separator-delimited data group. */
|
|
2303
|
-
function iconColumns(entries, contextual) {
|
|
2142
|
+
/** Mark icon columns within each separator-delimited data group.
|
|
2143
|
+
* @param entries - entries in one menu area.
|
|
2144
|
+
* @param contextual - whether to align grouped context-menu icons.
|
|
2145
|
+
* @returns entries that reserve a leading icon column.
|
|
2146
|
+
*/
|
|
2147
|
+
function menuIconColumns(entries, contextual) {
|
|
2304
2148
|
const aligned = /* @__PURE__ */ new Set();
|
|
2305
2149
|
if (!contextual) return aligned;
|
|
2306
2150
|
let group = [];
|
|
2307
2151
|
const finish = () => {
|
|
2308
|
-
if (group.some((entry) => !
|
|
2152
|
+
if (group.some((entry) => !("type" in entry) && entry.icon !== void 0)) for (const entry of group) aligned.add(entry);
|
|
2309
2153
|
group = [];
|
|
2310
2154
|
};
|
|
2311
|
-
for (const entry of entries) if (
|
|
2155
|
+
for (const entry of entries) if ("type" in entry && entry.type === "separator") finish();
|
|
2312
2156
|
else group.push(entry);
|
|
2313
2157
|
finish();
|
|
2314
2158
|
return aligned;
|
|
2315
2159
|
}
|
|
2316
|
-
/**
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2160
|
+
/** Render a separator or group heading outside the keyboard walk.
|
|
2161
|
+
* @param entry - non-interactive menu entry.
|
|
2162
|
+
* @returns the corresponding element.
|
|
2163
|
+
*/
|
|
2164
|
+
function renderMenuDecoration(entry) {
|
|
2165
|
+
return entry.type === "separator" ? jsx("div", {
|
|
2166
|
+
className: css$9.separator,
|
|
2167
|
+
role: "separator"
|
|
2168
|
+
}, entry.id) : jsx("div", {
|
|
2169
|
+
className: css$9.label,
|
|
2170
|
+
role: "presentation",
|
|
2171
|
+
children: entry.text
|
|
2172
|
+
}, entry.id);
|
|
2173
|
+
}
|
|
2174
|
+
//#endregion
|
|
2175
|
+
//#region lib/types/MenuSurface.js
|
|
2176
|
+
/** Shared menu material and the macOS backing that lets Chromium blur transparent windows. */
|
|
2177
|
+
/** Context-menu transition durations in milliseconds, shared with its lifecycle owner. */
|
|
2178
|
+
const MENU_TRANSITION_MS = Object.freeze({
|
|
2179
|
+
enter: 40,
|
|
2180
|
+
dismiss: 80,
|
|
2181
|
+
replace: 10,
|
|
2182
|
+
prepare: 20
|
|
2183
|
+
});
|
|
2184
|
+
/**
|
|
2185
|
+
* Paint a menu and, on macOS, an opaque backing behind the page content within its bounds.
|
|
2186
|
+
* CSS anchors keep each backing aligned during placement, resizing, and nested-menu movement.
|
|
2187
|
+
* @param props - Div content and placement, and compact geometry.
|
|
2188
|
+
* @param ref - The visible menu div, excluding the non-interactive backing.
|
|
2189
|
+
* @returns Menu content plus a backing portal removed with the menu.
|
|
2190
|
+
*/
|
|
2191
|
+
const MenuSurface = forwardRef(function MenuSurface({ compact = false, phase, className, style, children, ...props }, ref) {
|
|
2192
|
+
const id = useId();
|
|
2193
|
+
const backingRef = useRef(null);
|
|
2194
|
+
useLayoutEffect(() => {
|
|
2195
|
+
document.body.appendChild(backingRef.current);
|
|
2196
|
+
}, []);
|
|
2197
|
+
const anchorStyle = {
|
|
2198
|
+
"--dsh-menu-anchor": `--dsh-menu-${id.replaceAll(":", "")}`,
|
|
2199
|
+
"--dsh-menu-enter": `${MENU_TRANSITION_MS.enter}ms`,
|
|
2200
|
+
"--dsh-menu-dismiss": `${MENU_TRANSITION_MS.dismiss}ms`,
|
|
2201
|
+
"--dsh-menu-replace": `${MENU_TRANSITION_MS.replace}ms`
|
|
2202
|
+
};
|
|
2203
|
+
return jsxs(Fragment, { children: [jsxs("div", {
|
|
2204
|
+
...props,
|
|
2205
|
+
ref,
|
|
2206
|
+
"data-menu-material": "translucent",
|
|
2207
|
+
"data-menu-phase": phase,
|
|
2208
|
+
className: clsx(css$10.surface, compact && css$10.compact, className),
|
|
2209
|
+
style: {
|
|
2210
|
+
...style,
|
|
2211
|
+
...anchorStyle
|
|
2212
|
+
},
|
|
2213
|
+
children: [jsx("div", {
|
|
2214
|
+
"aria-hidden": "true",
|
|
2215
|
+
className: css$10.material
|
|
2216
|
+
}), children]
|
|
2217
|
+
}), createPortal(jsx("div", {
|
|
2218
|
+
ref: backingRef,
|
|
2219
|
+
"aria-hidden": "true",
|
|
2220
|
+
"data-menu-backing": "",
|
|
2221
|
+
"data-menu-phase": phase,
|
|
2222
|
+
className: clsx(css$10.backing, compact && css$10.compact),
|
|
2223
|
+
style: {
|
|
2224
|
+
...anchorStyle,
|
|
2225
|
+
visibility: style?.visibility
|
|
2226
|
+
}
|
|
2227
|
+
}), document.body)] });
|
|
2228
|
+
});
|
|
2229
|
+
//#endregion
|
|
2230
|
+
//#region lib/types/SubmenuPanel.js
|
|
2231
|
+
/** Name the parent card anchor, and hide the child card until its layout is known. */
|
|
2232
|
+
function anchors(submenu, hidden) {
|
|
2233
|
+
return {
|
|
2234
|
+
"--dsh-submenu-parent": submenu.parentAnchor,
|
|
2235
|
+
...hidden ? { visibility: "hidden" } : {}
|
|
2236
|
+
};
|
|
2237
|
+
}
|
|
2238
|
+
/** Render one child list with a non-selecting back row in single-page placement.
|
|
2239
|
+
* @param props - active entry, submenu operations, and shared row presentation options.
|
|
2240
|
+
* @returns a body portal that preserves child DOM identity across placement changes.
|
|
2241
|
+
*/
|
|
2242
|
+
function SubmenuPanel({ entry, submenu, compact, dense, contextual, backLabel, onSelect, onClose, afterSelection }) {
|
|
2243
|
+
const columns = menuIconColumns(entry.submenu, contextual);
|
|
2244
|
+
return createPortal(jsxs(MenuSurface, {
|
|
2245
|
+
ref: submenu.panelRef,
|
|
2246
|
+
compact,
|
|
2247
|
+
className: clsx(css$9.submenu, css$9.scrollable, dense && css$9.denseList, compact && css$9.compactList),
|
|
2248
|
+
style: anchors(submenu, submenu.hidden),
|
|
2249
|
+
"data-submenu-layout": submenu.measured ? submenu.page ? "page" : "side" : void 0,
|
|
2250
|
+
"data-contextual": contextual ? "" : void 0,
|
|
2251
|
+
role: "menu",
|
|
2252
|
+
onPointerEnter: submenu.cancelClose,
|
|
2253
|
+
onPointerLeave: (event) => {
|
|
2254
|
+
if (menuHoverAllowed(event)) submenu.leave();
|
|
2255
|
+
},
|
|
2256
|
+
onContextMenu: contextual ? (event) => {
|
|
2257
|
+
event.preventDefault();
|
|
2258
|
+
event.stopPropagation();
|
|
2259
|
+
onClose();
|
|
2260
|
+
} : void 0,
|
|
2261
|
+
onClick: (event) => {
|
|
2262
|
+
event.stopPropagation();
|
|
2263
|
+
afterSelection();
|
|
2264
|
+
},
|
|
2265
|
+
children: [submenu.page && jsxs(Fragment, { children: [jsx(MenuRow, {
|
|
2266
|
+
"data-menu-back": "",
|
|
2267
|
+
icon: jsx(IconChevronLeftOutlineRegular, { className: css$9.check }),
|
|
2268
|
+
onClick: submenu.returnToParent,
|
|
2269
|
+
children: backLabel
|
|
2270
|
+
}), jsx("div", {
|
|
2271
|
+
className: css$9.separator,
|
|
2272
|
+
role: "separator"
|
|
2273
|
+
})] }), jsx("div", {
|
|
2274
|
+
className: css$9.viewport,
|
|
2275
|
+
role: "presentation",
|
|
2276
|
+
children: entry.submenu.map((sub) => "type" in sub ? renderMenuDecoration(sub) : jsx(MenuRow, {
|
|
2277
|
+
icon: sub.icon,
|
|
2278
|
+
reserveIcon: columns.has(sub),
|
|
2279
|
+
disabled: sub.disabled,
|
|
2280
|
+
danger: sub.danger,
|
|
2281
|
+
shortcut: sub.shortcut,
|
|
2282
|
+
onClick: () => {
|
|
2283
|
+
onSelect?.(sub.id);
|
|
2284
|
+
},
|
|
2285
|
+
children: sub.label
|
|
2286
|
+
}, sub.id))
|
|
2287
|
+
})]
|
|
2288
|
+
}), document.body);
|
|
2289
|
+
}
|
|
2290
|
+
//#endregion
|
|
2291
|
+
//#region lib/types/keyboard-composition.js
|
|
2292
|
+
/** Composition lifetime for local keyboard handlers, including a late closing keydown. */
|
|
2293
|
+
/**
|
|
2294
|
+
* Observe composition until its closing key is released or consumed.
|
|
2295
|
+
* @param document - document whose input events belong to the caller.
|
|
2296
|
+
* @returns an event guard and a disposer for all listeners.
|
|
2297
|
+
*/
|
|
2298
|
+
function observeComposition(document) {
|
|
2299
|
+
let composing = false;
|
|
2300
|
+
let ended = false;
|
|
2301
|
+
const start = () => {
|
|
2302
|
+
composing = true;
|
|
2303
|
+
};
|
|
2304
|
+
const end = () => {
|
|
2305
|
+
composing = false;
|
|
2306
|
+
ended = true;
|
|
2307
|
+
};
|
|
2308
|
+
const release = () => {
|
|
2309
|
+
ended = false;
|
|
2310
|
+
};
|
|
2311
|
+
const blur = () => {
|
|
2312
|
+
composing = false;
|
|
2313
|
+
ended = false;
|
|
2314
|
+
};
|
|
2315
|
+
document.addEventListener("compositionstart", start, true);
|
|
2316
|
+
document.addEventListener("compositionend", end, true);
|
|
2317
|
+
document.addEventListener("keyup", release, true);
|
|
2318
|
+
document.defaultView?.addEventListener("blur", blur);
|
|
2319
|
+
return {
|
|
2320
|
+
guards: (event) => {
|
|
2321
|
+
const guarded = composing || ended || event.isComposing || event.keyCode === 229;
|
|
2322
|
+
ended = false;
|
|
2323
|
+
return guarded;
|
|
2324
|
+
},
|
|
2325
|
+
dispose: () => {
|
|
2326
|
+
document.removeEventListener("compositionstart", start, true);
|
|
2327
|
+
document.removeEventListener("compositionend", end, true);
|
|
2328
|
+
document.removeEventListener("keyup", release, true);
|
|
2329
|
+
document.defaultView?.removeEventListener("blur", blur);
|
|
2330
|
+
}
|
|
2331
|
+
};
|
|
2332
|
+
}
|
|
2333
|
+
//#endregion
|
|
2334
|
+
//#region lib/types/focus.js
|
|
2335
|
+
/** Mobile-device detection and automatic focus presentation. */
|
|
2336
|
+
const releases = /* @__PURE__ */ new WeakMap();
|
|
2337
|
+
const navigationKeys = new Set([
|
|
2338
|
+
"Tab",
|
|
2339
|
+
"ArrowUp",
|
|
2340
|
+
"ArrowDown",
|
|
2341
|
+
"ArrowLeft",
|
|
2342
|
+
"ArrowRight",
|
|
2343
|
+
"Home",
|
|
2344
|
+
"End"
|
|
2345
|
+
]);
|
|
2346
|
+
let mobileDevice;
|
|
2347
|
+
/**
|
|
2348
|
+
* Identify iOS and Android phones and tablets from the current browser's device information.
|
|
2349
|
+
* MacIntel with multiple touch points identifies desktop-mode iPads.
|
|
2350
|
+
* The first result is shared by all callers until the page reloads.
|
|
2351
|
+
* @returns true for recognized mobile devices; false for other devices, including unrecognized UAs.
|
|
2352
|
+
*/
|
|
2353
|
+
function isMobileDevice() {
|
|
2354
|
+
if (mobileDevice !== void 0) return mobileDevice;
|
|
2355
|
+
const { userAgent, platform, maxTouchPoints } = navigator;
|
|
2356
|
+
mobileDevice = /Android|iPhone|iPad|iPod/i.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
|
|
2357
|
+
return mobileDevice;
|
|
2358
|
+
}
|
|
2359
|
+
/**
|
|
2360
|
+
* Focus an automatic destination without a focus outline until keyboard navigation or blur.
|
|
2361
|
+
* The theme suppresses outlines while data-dsh-automatic-focus is present; borders and shadows remain intact.
|
|
2362
|
+
* Tab and directional navigation restore normal focus styling.
|
|
2363
|
+
* @param element - control or container receiving automatic focus.
|
|
2364
|
+
* @param options - browser focus options, including scroll preservation.
|
|
2365
|
+
*/
|
|
2366
|
+
function focusWithoutRing(element, options) {
|
|
2367
|
+
releases.get(element)?.();
|
|
2368
|
+
const release = () => {
|
|
2369
|
+
element.removeAttribute("data-dsh-automatic-focus");
|
|
2370
|
+
element.removeEventListener("blur", release);
|
|
2371
|
+
element.removeEventListener("keydown", navigate, true);
|
|
2372
|
+
releases.delete(element);
|
|
2373
|
+
};
|
|
2374
|
+
const navigate = (event) => {
|
|
2375
|
+
if (!event.isComposing && !event.ctrlKey && !event.altKey && !event.metaKey && navigationKeys.has(event.key)) release();
|
|
2376
|
+
};
|
|
2377
|
+
releases.set(element, release);
|
|
2378
|
+
element.setAttribute("data-dsh-automatic-focus", "");
|
|
2379
|
+
element.addEventListener("blur", release);
|
|
2380
|
+
element.addEventListener("keydown", navigate, true);
|
|
2381
|
+
element.focus(options);
|
|
2382
|
+
if (!element.matches(":focus")) release();
|
|
2383
|
+
}
|
|
2384
|
+
//#endregion
|
|
2385
|
+
//#region lib/types/useModalLayer.js
|
|
2386
|
+
/** Shared modal keyboard ownership and focus lifetime. */
|
|
2387
|
+
/** Dialog and menu elements whose document order determines foreground shortcut ownership. */
|
|
2388
|
+
const modalSelector = "[role=\"dialog\"][aria-modal=\"true\"], [role=\"menu\"]";
|
|
2389
|
+
const layers = /* @__PURE__ */ new WeakMap();
|
|
2390
|
+
/**
|
|
2391
|
+
* Request closure of the foreground registered modal using its current onClose callback.
|
|
2392
|
+
* A newer menu or unregistered dialog blocks dismissal of the modal behind it.
|
|
2393
|
+
* @param document - product document whose modal owns the close command.
|
|
2394
|
+
*/
|
|
2395
|
+
function closeTopModal(document) {
|
|
2396
|
+
const top = layers.get(document)?.at(-1);
|
|
2397
|
+
if (top === void 0) return;
|
|
2398
|
+
if ([...document.querySelectorAll("[role=\"dialog\"][aria-modal=\"true\"], [role=\"menu\"]")].at(-1) === top.element) top.close();
|
|
2399
|
+
}
|
|
2400
|
+
/**
|
|
2401
|
+
* Whether an anchor belongs behind the current modal and must yield keyboard input.
|
|
2402
|
+
* @param anchor - local control owning the input handler.
|
|
2403
|
+
* @returns true when another modal owns the foreground.
|
|
2404
|
+
*/
|
|
2405
|
+
function isBehindModal(anchor) {
|
|
2406
|
+
if (anchor === null) return false;
|
|
2407
|
+
const top = layers.get(anchor.ownerDocument)?.at(-1);
|
|
2408
|
+
return top !== void 0 && !top.element.contains(anchor);
|
|
2409
|
+
}
|
|
2410
|
+
const focusable = "button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), a[href], [tabindex=\"0\"]";
|
|
2411
|
+
/**
|
|
2412
|
+
* Give only the top modal Escape and Tab ownership, then restore its previous focus.
|
|
2413
|
+
* Automatic entry and return focus omit outlines; keyboard traversal retains its indicators.
|
|
2414
|
+
* Controls mounted with the dialog use data-modal-autofocus for initial focus;
|
|
2415
|
+
* React autoFocus runs before this layer can capture the invoking control.
|
|
2416
|
+
* Local menus handle their Escape during capture before this bubble listener.
|
|
2417
|
+
* @param dialog - mounted dialog element.
|
|
2418
|
+
* @param open - whether this layer is active.
|
|
2419
|
+
* @param onClose - top-layer Escape or application close action.
|
|
2420
|
+
*/
|
|
2421
|
+
function useModalLayer(dialog, open, onClose) {
|
|
2422
|
+
const close = useRef(onClose);
|
|
2423
|
+
const pendingRestore = useRef(void 0);
|
|
2424
|
+
close.current = onClose;
|
|
2425
|
+
useLayoutEffect(() => {
|
|
2426
|
+
const target = pendingRestore.current;
|
|
2427
|
+
pendingRestore.current = void 0;
|
|
2428
|
+
const element = dialog.current;
|
|
2429
|
+
if (!open && element?.contains(element.ownerDocument.activeElement) && target?.isConnected && !target.closest("[inert], [hidden]") && !isBehindModal(target)) focusWithoutRing(target, { preventScroll: true });
|
|
2430
|
+
if (!open || element === null) return;
|
|
2431
|
+
const document = element.ownerDocument;
|
|
2432
|
+
const composition = observeComposition(document);
|
|
2433
|
+
const previous = document.activeElement;
|
|
2434
|
+
const stack = layers.get(document) ?? [];
|
|
2435
|
+
layers.set(document, stack);
|
|
2436
|
+
const layer = {
|
|
2437
|
+
element,
|
|
2438
|
+
close: () => {
|
|
2439
|
+
close.current();
|
|
2440
|
+
}
|
|
2441
|
+
};
|
|
2442
|
+
stack.push(layer);
|
|
2443
|
+
const initial = element.querySelector("[data-modal-autofocus]") ?? element.querySelector(focusable) ?? element;
|
|
2444
|
+
if (!element.contains(document.activeElement)) focusWithoutRing(initial);
|
|
2445
|
+
const keydown = (event) => {
|
|
2446
|
+
const composing = composition.guards(event);
|
|
2447
|
+
if (stack.at(-1) !== layer || event.defaultPrevented || composing || event.ctrlKey || event.altKey || event.metaKey) return;
|
|
2448
|
+
if (event.key === "Escape" && !event.shiftKey) {
|
|
2449
|
+
event.preventDefault();
|
|
2450
|
+
if (!event.repeat) close.current();
|
|
2451
|
+
}
|
|
2452
|
+
if (event.key !== "Tab") return;
|
|
2453
|
+
if (document.activeElement?.closest("[role=\"menu\"]")) return;
|
|
2454
|
+
const items = [...element.querySelectorAll(focusable)].filter((item) => !item.closest("[inert], [hidden]"));
|
|
2455
|
+
const first = items[0] ?? element;
|
|
2456
|
+
const last = items.at(-1) ?? element;
|
|
2457
|
+
const atEdge = event.shiftKey ? document.activeElement === first : document.activeElement === last;
|
|
2458
|
+
if (document.activeElement === element || !element.contains(document.activeElement) || atEdge) {
|
|
2459
|
+
event.preventDefault();
|
|
2460
|
+
(event.shiftKey ? last : first).focus();
|
|
2461
|
+
}
|
|
2462
|
+
};
|
|
2463
|
+
document.addEventListener("keydown", keydown);
|
|
2464
|
+
return () => {
|
|
2465
|
+
composition.dispose();
|
|
2466
|
+
const wasTop = stack.at(-1) === layer;
|
|
2467
|
+
stack.splice(stack.indexOf(layer), 1);
|
|
2468
|
+
document.removeEventListener("keydown", keydown);
|
|
2469
|
+
if (stack.length === 0) layers.delete(document);
|
|
2470
|
+
if (wasTop) {
|
|
2471
|
+
const target = previous instanceof HTMLElement && previous.isConnected ? previous : stack.at(-1)?.element;
|
|
2472
|
+
if (target !== void 0) {
|
|
2473
|
+
pendingRestore.current = target;
|
|
2474
|
+
focusWithoutRing(target);
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
};
|
|
2478
|
+
}, [dialog, open]);
|
|
2479
|
+
}
|
|
2480
|
+
//#endregion
|
|
2481
|
+
//#region lib/types/Menu.js
|
|
2482
|
+
/**
|
|
2483
|
+
* Render one `role="menuitem"` row for a {@link Menu} whose rows are
|
|
2484
|
+
* components rather than `items` data: the same markup and styling as a data
|
|
2485
|
+
* row, so it joins the list's keyboard walk and post-selection focus return
|
|
2486
|
+
* without any shared state. Closing the menu stays the owner's decision, as
|
|
2487
|
+
* it is for data rows.
|
|
2488
|
+
* @param props.children - visible row label.
|
|
2489
|
+
* @param props.shortcut - effective key labels and accessible combination.
|
|
2490
|
+
* @param props.icon - optional leading icon.
|
|
2491
|
+
* @param props.current - whether the row identifies the currently displayed page or view.
|
|
2492
|
+
* @param props.disabled - whether the row cannot be activated.
|
|
2493
|
+
* @param props.disabledReason - why a disabled row cannot be activated, shown in a tooltip and read as its description.
|
|
2494
|
+
* @param props.danger - whether to use the destructive row colors.
|
|
2495
|
+
* @param props.separatorBefore - whether this row starts a new group (hairline above it).
|
|
2496
|
+
* @param props.onSelect - row activation callback.
|
|
2497
|
+
* @returns one menu-item row.
|
|
2498
|
+
*/
|
|
2499
|
+
function MenuItemButton({ onSelect, ...props }) {
|
|
2500
|
+
return jsx(MenuRow, {
|
|
2501
|
+
...props,
|
|
2502
|
+
decorativeIcon: false,
|
|
2503
|
+
onClick: onSelect
|
|
2504
|
+
});
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* Render an anchored dropdown menu. While the list is open its keys mirror the
|
|
2508
|
+
* composer's: Tab settles the focused row — from the trigger, Tab enters the
|
|
2509
|
+
* list instead — and Escape or Shift+Tab close it and return focus to the
|
|
2510
|
+
* anchor's first button, and selecting a row does the same — the rows unmount
|
|
2511
|
+
* with the list. Only a keyboard on the trigger or inside the list is
|
|
2512
|
+
* intercepted; Tab presses elsewhere on the page stay the browser's. Escape
|
|
2513
|
+
* first returns from a visible child, while ArrowRight enters and ArrowLeft returns.
|
|
2514
|
+
* When neither side fits, click or ArrowRight opens a single-panel child page;
|
|
2515
|
+
* focus alone retains the parent page.
|
|
2329
2516
|
* @param props.contextual - cursor positioning, context dismissal, and per-divider icon alignment.
|
|
2330
2517
|
* @param props.exiting - retain an inert popup during dismissal or replacement fade.
|
|
2331
2518
|
* @param props.returnFocus - original control captured before asynchronous menu preparation.
|
|
2519
|
+
* @param props.isExternalTrigger - recognizes external controls whose pointer presses should not dismiss;
|
|
2520
|
+
* omitted, every press outside the anchor and menu panels dismisses.
|
|
2332
2521
|
* @param props.autoFocus - focus the first item on open; the arrow keys walk the list either way.
|
|
2333
2522
|
* @param props.open - whether the list is showing (owner-controlled).
|
|
2334
2523
|
* @param props.anchor - the trigger element (rendered in place).
|
|
2335
2524
|
* @param props.items - selectable data rows and optional separators (default none; with no `children` either, the list is empty).
|
|
2525
|
+
* @param props.submenuBackLabel - localized single-panel return label; omitted uses the caller's
|
|
2526
|
+
* parent-row label beside a back arrow, without selecting that row.
|
|
2336
2527
|
* @param props.selectedId - row shown as selected.
|
|
2337
2528
|
* @param props.selectedIds - rows shown as selected when a menu contains independent option groups.
|
|
2338
2529
|
* @param props.onSelect - data-row activation callback (not called for disabled rows or submenu parents that only open children).
|
|
@@ -2342,8 +2533,8 @@ const MEASURE_STYLE = {
|
|
|
2342
2533
|
* @param props.align - list alignment against the anchor (default 'start').
|
|
2343
2534
|
* @param props.side - open below (`bottom`, default) or above (`top`) the anchor.
|
|
2344
2535
|
* @param props.portal - render the list into document.body, fixed-positioned
|
|
2345
|
-
*
|
|
2346
|
-
*
|
|
2536
|
+
* with CSS anchor positioning; it follows browser zoom and may exceed the
|
|
2537
|
+
* visual viewport. Use when an ancestor's overflow clipping would crop the
|
|
2347
2538
|
* in-place list; default false keeps the pure-CSS in-place behavior.
|
|
2348
2539
|
* @param props.closeOnPointerLeave - close the list once the pointer has left
|
|
2349
2540
|
* both trigger and list for the pointer grace (default false keeps it open
|
|
@@ -2351,12 +2542,8 @@ const MEASURE_STYLE = {
|
|
|
2351
2542
|
* gap and a brief overshoot survivable; coming back cancels the close.
|
|
2352
2543
|
* @param props.dense - reduce vertical row spacing without changing the standard typography or card width.
|
|
2353
2544
|
* @param props.compact - use reduced menu typography and spacing.
|
|
2354
|
-
* @param props.
|
|
2355
|
-
*
|
|
2356
|
-
* Menu's own wrapper span. Required when the wrapper isn't itself laid out at
|
|
2357
|
-
* the trigger (render-prop anchors, effect-positioned proxies — measuring the
|
|
2358
|
-
* wrapper there races the host's layout effects). Called while tracking the
|
|
2359
|
-
* anchor and on scroll/resize; return null to defer placement.
|
|
2545
|
+
* @param props.anchorRef - external element used as the CSS anchor in portal mode.
|
|
2546
|
+
* @param props.anchorPoint - client viewport coordinates captured when a context menu opens.
|
|
2360
2547
|
* @param props.minWidthFromAnchor - in portal mode, keep the menu at least as wide as its anchor, bounded by viewport margins.
|
|
2361
2548
|
* @param props.footer - rows pinned below the scrolling items area, separated
|
|
2362
2549
|
* by a hairline; contextual menus reuse an explicit leading separator. These rows stay visible while the items above scroll.
|
|
@@ -2374,10 +2561,24 @@ const MEASURE_STYLE = {
|
|
|
2374
2561
|
* document.body outside the owner's DOM subtree.
|
|
2375
2562
|
* @returns anchor wrapper with the conditional list.
|
|
2376
2563
|
*/
|
|
2377
|
-
function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onSelect, onClose, align = "start", side = "bottom", portal = false, closeOnPointerLeave = false, dense = false, compact = false, autoFocus = false, selection = "check",
|
|
2564
|
+
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, className, listClassName, contextual = false, exiting, returnFocus, isExternalTrigger }) {
|
|
2378
2565
|
const rootRef = useRef(null);
|
|
2379
2566
|
const listRef = useRef(null);
|
|
2380
2567
|
const menuId = useId();
|
|
2568
|
+
const pointX = anchorPoint?.x;
|
|
2569
|
+
const pointY = anchorPoint?.y;
|
|
2570
|
+
const point = useMemo(() => {
|
|
2571
|
+
if (pointX === void 0 || pointY === void 0) return void 0;
|
|
2572
|
+
const viewport = open && typeof window.CSS !== "undefined" && window.CSS.supports("-webkit-backdrop-filter", "none") ? window.visualViewport : void 0;
|
|
2573
|
+
return {
|
|
2574
|
+
x: pointX + (viewport?.offsetLeft ?? 0),
|
|
2575
|
+
y: pointY + (viewport?.offsetTop ?? 0)
|
|
2576
|
+
};
|
|
2577
|
+
}, [
|
|
2578
|
+
open,
|
|
2579
|
+
pointX,
|
|
2580
|
+
pointY
|
|
2581
|
+
]);
|
|
2381
2582
|
useLayoutEffect(() => {
|
|
2382
2583
|
const trigger = returnFocus?.();
|
|
2383
2584
|
if (!open || !contextual || trigger == null) return;
|
|
@@ -2410,7 +2611,8 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2410
2611
|
* @param navigation - whether explicit keyboard traversal should retain its focus indicator.
|
|
2411
2612
|
*/
|
|
2412
2613
|
const refocusAnchor = (navigation = false) => {
|
|
2413
|
-
const
|
|
2614
|
+
const remembered = triggerRef.current;
|
|
2615
|
+
const trigger = returnFocus?.() ?? (remembered?.isConnected ? remembered : anchorRef?.current) ?? null;
|
|
2414
2616
|
const target = trigger !== null && document.contains(trigger) && !trigger.disabled ? trigger : rootRef.current?.querySelector("button:not(:disabled)");
|
|
2415
2617
|
if (target == null) return;
|
|
2416
2618
|
if (navigation) target.focus();
|
|
@@ -2428,46 +2630,81 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2428
2630
|
queueMicrotask(() => {
|
|
2429
2631
|
if (openRef.current && exitingRef.current === void 0) return;
|
|
2430
2632
|
const active = document.activeElement;
|
|
2431
|
-
if (active === null || active === document.body || listRef.current?.contains(active) === true) refocusAnchor(navigation);
|
|
2633
|
+
if (active === null || active === document.body || listRef.current?.contains(active) === true || submenu.contains(active)) refocusAnchor(navigation);
|
|
2432
2634
|
});
|
|
2433
2635
|
};
|
|
2434
2636
|
const exitingRef = useRef(exiting);
|
|
2435
2637
|
exitingRef.current = exiting;
|
|
2436
2638
|
const openRef = useRef(open);
|
|
2437
2639
|
openRef.current = open;
|
|
2438
|
-
const
|
|
2640
|
+
const submenu = useMenuSubmenu({
|
|
2641
|
+
open: open && exiting === void 0,
|
|
2642
|
+
items,
|
|
2643
|
+
footer,
|
|
2644
|
+
listRef,
|
|
2645
|
+
refocusAnchor
|
|
2646
|
+
});
|
|
2647
|
+
const submenuEvents = useRef(submenu);
|
|
2648
|
+
submenuEvents.current = submenu;
|
|
2439
2649
|
const close = useRef(onClose);
|
|
2440
2650
|
close.current = onClose;
|
|
2441
|
-
const
|
|
2442
|
-
const
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2651
|
+
const anchorName = `--dsh-menu-trigger-${menuId.replaceAll(":", "")}`;
|
|
2652
|
+
const [externalAnchor, setExternalAnchor] = useState(null);
|
|
2653
|
+
const positioned = !portal || anchorRef === void 0 || externalAnchor !== null;
|
|
2654
|
+
useEffect(() => {
|
|
2655
|
+
if (!open || !portal || anchorRef === void 0) {
|
|
2656
|
+
setExternalAnchor(null);
|
|
2657
|
+
return;
|
|
2446
2658
|
}
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
gap: 4,
|
|
2457
|
-
margin: 12,
|
|
2458
|
-
frameClearance: !contextual,
|
|
2459
|
-
minWidthFromAnchor,
|
|
2460
|
-
getAnchorRect: readAnchor
|
|
2659
|
+
const element = anchorRef.current;
|
|
2660
|
+
setExternalAnchor(element);
|
|
2661
|
+
if (element === null) return;
|
|
2662
|
+
const previous = element.style.getPropertyValue("anchor-name");
|
|
2663
|
+
const priority = element.style.getPropertyPriority("anchor-name");
|
|
2664
|
+
element.style.setProperty("anchor-name", anchorName);
|
|
2665
|
+
return () => {
|
|
2666
|
+
element.style.setProperty("anchor-name", previous, priority);
|
|
2667
|
+
};
|
|
2461
2668
|
});
|
|
2462
|
-
|
|
2669
|
+
useEffect(() => {
|
|
2670
|
+
if (!open || !portal || exiting !== void 0) return;
|
|
2671
|
+
const currentAnchor = () => returnFocus?.() ?? (anchorRef === void 0 ? rootRef.current : anchorRef.current);
|
|
2672
|
+
const element = currentAnchor();
|
|
2673
|
+
if (element === null) return;
|
|
2674
|
+
let dismissed = false;
|
|
2675
|
+
const check = () => {
|
|
2676
|
+
const current = currentAnchor();
|
|
2677
|
+
if (dismissed || current !== null && current.isConnected && current.closest("[inert], [hidden]") === null) return;
|
|
2678
|
+
dismissed = true;
|
|
2679
|
+
close.current();
|
|
2680
|
+
};
|
|
2681
|
+
const observer = new MutationObserver(check);
|
|
2682
|
+
observer.observe(element.ownerDocument.documentElement, {
|
|
2683
|
+
subtree: true,
|
|
2684
|
+
childList: true,
|
|
2685
|
+
attributes: true,
|
|
2686
|
+
attributeFilter: ["inert", "hidden"]
|
|
2687
|
+
});
|
|
2688
|
+
check();
|
|
2689
|
+
return () => {
|
|
2690
|
+
observer.disconnect();
|
|
2691
|
+
};
|
|
2692
|
+
}, [
|
|
2693
|
+
open,
|
|
2694
|
+
portal,
|
|
2695
|
+
exiting,
|
|
2696
|
+
anchorRef,
|
|
2697
|
+
externalAnchor,
|
|
2698
|
+
returnFocus
|
|
2699
|
+
]);
|
|
2463
2700
|
const { arm: armClose, cancel: cancelClose } = usePointerGrace(onClose);
|
|
2464
2701
|
useEffect(() => {
|
|
2465
2702
|
if (!open) return;
|
|
2466
2703
|
const active = document.activeElement;
|
|
2467
|
-
triggerRef.current = active instanceof HTMLElement && (
|
|
2704
|
+
triggerRef.current = active instanceof HTMLElement && active !== document.body && (anchorRef !== void 0 || anchorPoint !== void 0 || rootRef.current?.contains(active) === true) ? active : null;
|
|
2468
2705
|
}, [open]);
|
|
2469
2706
|
useEffect(() => {
|
|
2470
|
-
if (!open || exiting !== void 0 || !autoFocus ||
|
|
2707
|
+
if (!open || !positioned || exiting !== void 0 || !autoFocus || listRef.current?.contains(document.activeElement) || submenu.contains(document.activeElement)) return;
|
|
2471
2708
|
const first = listRef.current?.querySelector("button:not(:disabled)");
|
|
2472
2709
|
walkIndex.current = first === void 0 || first === null ? null : 0;
|
|
2473
2710
|
if (first != null) focusWithoutRing(first);
|
|
@@ -2481,30 +2718,40 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2481
2718
|
]);
|
|
2482
2719
|
useEffect(() => {
|
|
2483
2720
|
if (!open || exiting !== void 0) {
|
|
2484
|
-
setOpenSubmenuId(null);
|
|
2485
2721
|
walkIndex.current = null;
|
|
2486
2722
|
return;
|
|
2487
2723
|
}
|
|
2488
2724
|
const composition = observeComposition(document);
|
|
2489
2725
|
const onPointerDown = (e) => {
|
|
2490
2726
|
if (!(e.target instanceof Node) || contextual && e.button === 2) return;
|
|
2491
|
-
if (rootRef.current?.contains(e.target) === true) return;
|
|
2492
|
-
if (
|
|
2727
|
+
if (rootRef.current?.contains(e.target) === true || anchorRef?.current?.contains(e.target) === true) return;
|
|
2728
|
+
if (isExternalTrigger?.(e.target) === true) return;
|
|
2729
|
+
if (listRef.current?.contains(e.target) === true || submenuEvents.current.contains(e.target)) return;
|
|
2493
2730
|
onClose();
|
|
2494
2731
|
};
|
|
2495
2732
|
const onKeyDown = (e) => {
|
|
2496
2733
|
if (composition.guards(e) || isBehindModal(triggerRef.current ?? rootRef.current) || e.defaultPrevented || e.ctrlKey || e.altKey || e.metaKey) return;
|
|
2497
2734
|
const focused = document.activeElement;
|
|
2498
|
-
const insideList = listRef.current?.contains(focused) === true;
|
|
2499
|
-
const anchored = focused === returnFocus?.() || rootRef.current?.contains(focused) === true || insideList;
|
|
2735
|
+
const insideList = listRef.current?.contains(focused) === true || submenuEvents.current.contains(focused);
|
|
2736
|
+
const anchored = focused === returnFocus?.() || anchorRef?.current?.contains(focused) === true || rootRef.current?.contains(focused) === true || insideList;
|
|
2500
2737
|
if (e.key === "Escape" && !e.shiftKey) {
|
|
2501
2738
|
e.preventDefault();
|
|
2502
2739
|
if (e.repeat) return;
|
|
2740
|
+
if (submenuEvents.current.returnToParent()) return;
|
|
2503
2741
|
onClose();
|
|
2504
2742
|
if (anchored || autoFocus) refocusAnchor();
|
|
2505
2743
|
}
|
|
2744
|
+
if (e.key === "ArrowLeft" && anchored && submenuEvents.current.returnToParent()) {
|
|
2745
|
+
e.preventDefault();
|
|
2746
|
+
return;
|
|
2747
|
+
}
|
|
2748
|
+
if (e.key === "ArrowRight" && insideList && focused instanceof HTMLButtonElement && focused.getAttribute("aria-haspopup") === "menu") {
|
|
2749
|
+
e.preventDefault();
|
|
2750
|
+
focused.click();
|
|
2751
|
+
return;
|
|
2752
|
+
}
|
|
2506
2753
|
if (e.key === "Tab") {
|
|
2507
|
-
const list =
|
|
2754
|
+
const list = submenuEvents.current.activeList(focused);
|
|
2508
2755
|
if (list === null || !anchored) return;
|
|
2509
2756
|
if (e.shiftKey) {
|
|
2510
2757
|
e.preventDefault();
|
|
@@ -2542,7 +2789,7 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2542
2789
|
"Home",
|
|
2543
2790
|
"End"
|
|
2544
2791
|
].includes(e.key)) return;
|
|
2545
|
-
const list =
|
|
2792
|
+
const list = submenuEvents.current.activeList(focused);
|
|
2546
2793
|
if (list === null || !anchored) return;
|
|
2547
2794
|
const buttons = Array.from(list.querySelectorAll("button:not(:disabled)"));
|
|
2548
2795
|
if (buttons.length === 0) return;
|
|
@@ -2578,7 +2825,10 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2578
2825
|
onClose,
|
|
2579
2826
|
autoFocus,
|
|
2580
2827
|
contextual,
|
|
2581
|
-
exiting
|
|
2828
|
+
exiting,
|
|
2829
|
+
anchorRef,
|
|
2830
|
+
returnFocus,
|
|
2831
|
+
isExternalTrigger
|
|
2582
2832
|
]);
|
|
2583
2833
|
useLayoutEffect(() => {
|
|
2584
2834
|
if (exiting === "dismiss" && listRef.current?.contains(document.activeElement)) refocusAnchor();
|
|
@@ -2586,126 +2836,52 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2586
2836
|
useEffect(() => {
|
|
2587
2837
|
if (!open) cancelClose();
|
|
2588
2838
|
}, [open, cancelClose]);
|
|
2589
|
-
const
|
|
2590
|
-
const
|
|
2591
|
-
const footerColumns = iconColumns(footer ?? [], contextual);
|
|
2839
|
+
const itemColumns = menuIconColumns(items, contextual);
|
|
2840
|
+
const footerColumns = menuIconColumns(footer ?? [], contextual);
|
|
2592
2841
|
const renderEntry = (entry, columns) => {
|
|
2593
|
-
if (
|
|
2594
|
-
className: css$10.separator,
|
|
2595
|
-
role: "separator"
|
|
2596
|
-
}, entry.id);
|
|
2597
|
-
if (isLabel(entry)) return jsx("div", {
|
|
2598
|
-
className: css$10.label,
|
|
2599
|
-
role: "presentation",
|
|
2600
|
-
children: entry.text
|
|
2601
|
-
}, entry.id);
|
|
2842
|
+
if ("type" in entry) return renderMenuDecoration(entry);
|
|
2602
2843
|
const hasSub = entry.submenu !== void 0 && entry.submenu.length > 0;
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
disabled: entry.disabled,
|
|
2619
|
-
"aria-keyshortcuts": entry.shortcut?.aria,
|
|
2620
|
-
"aria-haspopup": hasSub ? "menu" : void 0,
|
|
2621
|
-
"aria-expanded": hasSub ? subOpen : void 0,
|
|
2622
|
-
onFocus: hasSub ? () => {
|
|
2623
|
-
setOpenSubmenuId(entry.id);
|
|
2624
|
-
} : void 0,
|
|
2625
|
-
onClick: () => {
|
|
2626
|
-
if (hasSub) {
|
|
2627
|
-
setOpenSubmenuId(entry.id);
|
|
2628
|
-
return;
|
|
2629
|
-
}
|
|
2630
|
-
onSelect?.(entry.id);
|
|
2844
|
+
return jsx(MenuRow, {
|
|
2845
|
+
icon: entry.icon,
|
|
2846
|
+
reserveIcon: columns.has(entry),
|
|
2847
|
+
disabled: entry.disabled,
|
|
2848
|
+
danger: entry.danger,
|
|
2849
|
+
shortcut: entry.shortcut,
|
|
2850
|
+
selected: entry.id === selectedId || selectedIds?.includes(entry.id) === true,
|
|
2851
|
+
selection,
|
|
2852
|
+
"aria-haspopup": hasSub ? "menu" : void 0,
|
|
2853
|
+
"aria-expanded": hasSub ? submenu.entry?.id === entry.id && !submenu.hidden : void 0,
|
|
2854
|
+
wrapperProps: hasSub ? {
|
|
2855
|
+
onPointerEnter: (event) => {
|
|
2856
|
+
if (!menuHoverAllowed(event) || entry.disabled) return;
|
|
2857
|
+
const trigger = event.currentTarget.querySelector("button");
|
|
2858
|
+
if (trigger !== null) submenu.openChild(entry.id, trigger);
|
|
2631
2859
|
},
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
className: css$10.shortcut,
|
|
2645
|
-
children: jsx(ShortcutKeys, {
|
|
2646
|
-
keys: entry.shortcut.keys,
|
|
2647
|
-
className: css$10.shortcutKeys
|
|
2648
|
-
})
|
|
2649
|
-
}),
|
|
2650
|
-
selected && selection === "check" && jsx(IconCheckOutlineRegular, { className: css$10.check })
|
|
2651
|
-
]
|
|
2652
|
-
}), subOpen && entry.submenu !== void 0 && jsx(MenuSurface, {
|
|
2653
|
-
compact,
|
|
2654
|
-
className: clsx(css$10.submenu, compact && css$10.compactList),
|
|
2655
|
-
role: "menu",
|
|
2656
|
-
children: entry.submenu.map((sub) => isSeparator(sub) ? jsx("div", {
|
|
2657
|
-
className: css$10.separator,
|
|
2658
|
-
role: "separator"
|
|
2659
|
-
}, sub.id) : isLabel(sub) ? jsx("div", {
|
|
2660
|
-
className: css$10.label,
|
|
2661
|
-
children: sub.text
|
|
2662
|
-
}, sub.id) : jsxs("button", {
|
|
2663
|
-
type: "button",
|
|
2664
|
-
role: "menuitem",
|
|
2665
|
-
className: css$10.item,
|
|
2666
|
-
disabled: sub.disabled,
|
|
2667
|
-
"aria-keyshortcuts": sub.shortcut?.aria,
|
|
2668
|
-
onClick: () => {
|
|
2669
|
-
onSelect?.(sub.id);
|
|
2670
|
-
refocusAfterSelection();
|
|
2671
|
-
},
|
|
2672
|
-
children: [
|
|
2673
|
-
(sub.icon !== void 0 || subColumns.has(sub)) && jsx("span", {
|
|
2674
|
-
"aria-hidden": "true",
|
|
2675
|
-
className: css$10.itemIcon,
|
|
2676
|
-
children: sub.icon
|
|
2677
|
-
}),
|
|
2678
|
-
jsx("span", {
|
|
2679
|
-
className: css$10.itemLabel,
|
|
2680
|
-
children: sub.label
|
|
2681
|
-
}),
|
|
2682
|
-
sub.shortcut !== void 0 && jsx("span", {
|
|
2683
|
-
"aria-hidden": "true",
|
|
2684
|
-
className: css$10.shortcut,
|
|
2685
|
-
children: jsx(ShortcutKeys, {
|
|
2686
|
-
keys: sub.shortcut.keys,
|
|
2687
|
-
className: css$10.shortcutKeys
|
|
2688
|
-
})
|
|
2689
|
-
})
|
|
2690
|
-
]
|
|
2691
|
-
}, sub.id))
|
|
2692
|
-
})]
|
|
2860
|
+
onPointerLeave: (event) => {
|
|
2861
|
+
if (menuHoverAllowed(event)) submenu.leave();
|
|
2862
|
+
}
|
|
2863
|
+
} : void 0,
|
|
2864
|
+
onFocus: hasSub ? (event) => {
|
|
2865
|
+
submenu.focusParent(entry.id, event.currentTarget);
|
|
2866
|
+
} : void 0,
|
|
2867
|
+
onClick: (event) => {
|
|
2868
|
+
if (hasSub) submenu.openChild(entry.id, event.currentTarget, true);
|
|
2869
|
+
else onSelect?.(entry.id);
|
|
2870
|
+
},
|
|
2871
|
+
children: entry.label
|
|
2693
2872
|
}, entry.id);
|
|
2694
2873
|
};
|
|
2695
|
-
const
|
|
2696
|
-
const row = e.target instanceof Element ? e.target.closest("button[role=\"menuitem\"]") : null;
|
|
2697
|
-
if (row === null || row.getAttribute("aria-haspopup") === "menu") return;
|
|
2698
|
-
if (row.closest("[role=\"menu\"]") !== e.currentTarget) return;
|
|
2699
|
-
setOpenSubmenuId(null);
|
|
2700
|
-
};
|
|
2701
|
-
const list = open && jsxs(MenuSurface, {
|
|
2874
|
+
const list = open && positioned && jsxs(MenuSurface, {
|
|
2702
2875
|
compact,
|
|
2703
2876
|
id: contextual ? menuId : void 0,
|
|
2704
2877
|
ref: listRef,
|
|
2705
|
-
className: clsx(css$
|
|
2706
|
-
style: portal ?
|
|
2707
|
-
|
|
2708
|
-
"
|
|
2878
|
+
className: clsx(css$9.list, listClassName, dense && css$9.denseList, compact && css$9.compactList, css$9.scrollable, submenu.page && css$9.parentPage, portal && css$9.portal, side === "top" && !portal && css$9.sideTop, align === "end" && !portal && css$9.alignEnd),
|
|
2879
|
+
style: portal ? { positionAnchor: anchorName } : void 0,
|
|
2880
|
+
"data-anchor-side": portal ? side : void 0,
|
|
2881
|
+
"data-anchor-align": portal ? align : void 0,
|
|
2882
|
+
"data-match-anchor-width": portal && minWidthFromAnchor ? "" : void 0,
|
|
2883
|
+
role: exiting === void 0 && !submenu.page ? "menu" : void 0,
|
|
2884
|
+
"aria-hidden": exiting === void 0 && !submenu.page ? void 0 : true,
|
|
2709
2885
|
"data-context-menu": contextual ? "" : void 0,
|
|
2710
2886
|
phase: contextual ? exiting ?? "enter" : void 0,
|
|
2711
2887
|
onClick: (e) => {
|
|
@@ -2718,26 +2894,60 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2718
2894
|
event.stopPropagation();
|
|
2719
2895
|
onClose();
|
|
2720
2896
|
} : void 0,
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2897
|
+
onPointerOver: (event) => {
|
|
2898
|
+
if (menuHoverAllowed(event)) submenu.collapseFrom(event);
|
|
2899
|
+
},
|
|
2900
|
+
onFocus: submenu.collapseFrom,
|
|
2901
|
+
children: [
|
|
2902
|
+
submenu.entry !== void 0 && jsx("span", {
|
|
2903
|
+
"aria-hidden": "true",
|
|
2904
|
+
className: css$9.submenuAnchor,
|
|
2905
|
+
style: { anchorName: submenu.parentAnchor }
|
|
2906
|
+
}),
|
|
2907
|
+
jsxs("div", {
|
|
2908
|
+
className: css$9.viewport,
|
|
2909
|
+
role: "presentation",
|
|
2910
|
+
children: [items.map((entry) => renderEntry(entry, itemColumns)), children]
|
|
2911
|
+
}),
|
|
2912
|
+
footer !== void 0 && footer.length > 0 && jsx("div", {
|
|
2913
|
+
className: css$9.footer,
|
|
2914
|
+
role: "presentation",
|
|
2915
|
+
children: footer.map((entry) => renderEntry(entry, footerColumns))
|
|
2916
|
+
})
|
|
2917
|
+
]
|
|
2732
2918
|
});
|
|
2733
2919
|
return jsxs("span", {
|
|
2734
2920
|
ref: rootRef,
|
|
2735
|
-
className: clsx(css$
|
|
2921
|
+
className: clsx(css$9.root, className),
|
|
2922
|
+
style: {
|
|
2923
|
+
anchorName: anchorRef === void 0 ? anchorName : void 0,
|
|
2924
|
+
...point === void 0 ? {} : {
|
|
2925
|
+
position: "fixed",
|
|
2926
|
+
left: point.x,
|
|
2927
|
+
top: point.y,
|
|
2928
|
+
width: 0,
|
|
2929
|
+
height: 0
|
|
2930
|
+
}
|
|
2931
|
+
},
|
|
2736
2932
|
onPointerEnter: closeOnPointerLeave ? cancelClose : void 0,
|
|
2737
|
-
onPointerLeave: closeOnPointerLeave ? () => {
|
|
2738
|
-
if (open) armClose();
|
|
2933
|
+
onPointerLeave: closeOnPointerLeave ? (event) => {
|
|
2934
|
+
if (open && menuHoverAllowed(event)) armClose();
|
|
2739
2935
|
} : void 0,
|
|
2740
|
-
children: [
|
|
2936
|
+
children: [
|
|
2937
|
+
anchor,
|
|
2938
|
+
portal ? list !== false && createPortal(list, document.body) : list,
|
|
2939
|
+
open && exiting === void 0 && submenu.entry !== void 0 && jsx(SubmenuPanel, {
|
|
2940
|
+
entry: submenu.entry,
|
|
2941
|
+
submenu,
|
|
2942
|
+
compact,
|
|
2943
|
+
dense,
|
|
2944
|
+
contextual,
|
|
2945
|
+
backLabel: submenuBackLabel ?? submenu.entry.label,
|
|
2946
|
+
onSelect,
|
|
2947
|
+
onClose,
|
|
2948
|
+
afterSelection: refocusAfterSelection
|
|
2949
|
+
}, submenu.entry.id)
|
|
2950
|
+
]
|
|
2741
2951
|
});
|
|
2742
2952
|
}
|
|
2743
2953
|
//#endregion
|
|
@@ -3184,9 +3394,10 @@ function SegmentedControl({ id, value, options, onChange, label, disabled = fals
|
|
|
3184
3394
|
* @param props.disabled - whether the control refuses changes.
|
|
3185
3395
|
* @param props.title - optional localized hover text.
|
|
3186
3396
|
* @param props.className - extra class for the label's placement.
|
|
3397
|
+
* @param props.modalAutofocus - designate the input for the owning Modal's initial focus without React autoFocus.
|
|
3187
3398
|
* @returns the label containing its checkbox.
|
|
3188
3399
|
*/
|
|
3189
|
-
function Checkbox({ checked, onChange, label, disabled = false, title, className }) {
|
|
3400
|
+
function Checkbox({ checked, onChange, label, disabled = false, title, className, modalAutofocus = false }) {
|
|
3190
3401
|
return jsxs("label", {
|
|
3191
3402
|
className: clsx(css$18.checkbox, className),
|
|
3192
3403
|
title,
|
|
@@ -3194,6 +3405,7 @@ function Checkbox({ checked, onChange, label, disabled = false, title, className
|
|
|
3194
3405
|
type: "checkbox",
|
|
3195
3406
|
checked,
|
|
3196
3407
|
disabled,
|
|
3408
|
+
"data-modal-autofocus": modalAutofocus || void 0,
|
|
3197
3409
|
onChange: (event) => {
|
|
3198
3410
|
onChange(event.target.checked);
|
|
3199
3411
|
}
|
|
@@ -3395,6 +3607,25 @@ function observeStickyMenuGroups(viewport) {
|
|
|
3395
3607
|
};
|
|
3396
3608
|
}
|
|
3397
3609
|
//#endregion
|
|
3610
|
+
//#region lib/types/overlay-top-margin.js
|
|
3611
|
+
/** Shared viewport inset for overlays, derived from the desktop frame's reserved top strip. */
|
|
3612
|
+
/**
|
|
3613
|
+
* Resolve the top margin an overlay keeps from the viewport edge.
|
|
3614
|
+
* @param min - the overlay's own viewport margin in px, used as the floor.
|
|
3615
|
+
* @param anchor - the overlay's anchor rect in viewport coordinates. While the anchor's top edge is inside the
|
|
3616
|
+
* viewport, the margin never exceeds `anchor.bottom + gap`, so an overlay opened from a control inside the top strip
|
|
3617
|
+
* stays next to it.
|
|
3618
|
+
* @param gap - the distance the overlay keeps below `anchor`.
|
|
3619
|
+
* @returns the frame clearance plus 20px (20px in fullscreen), capped by a visible `anchor`, but never below `min`.
|
|
3620
|
+
*/
|
|
3621
|
+
function overlayTopMargin(min, anchor, gap = 0) {
|
|
3622
|
+
const root = document.documentElement;
|
|
3623
|
+
const clearance = Number.parseFloat(getComputedStyle(root).getPropertyValue("--dsh-frame-top-clearance"));
|
|
3624
|
+
if (Number.isNaN(clearance)) return min;
|
|
3625
|
+
const cap = anchor !== void 0 && anchor.top >= 0 ? anchor.bottom + gap : Number.POSITIVE_INFINITY;
|
|
3626
|
+
return Math.max(min, Math.min((root.hasAttribute("data-fullscreen") ? 0 : clearance) + 20, cap));
|
|
3627
|
+
}
|
|
3628
|
+
//#endregion
|
|
3398
3629
|
//#region lib/types/useAnchoredMaxHeight.js
|
|
3399
3630
|
/**
|
|
3400
3631
|
* Viewport-fit hook for bottom-anchored overlays (slash menu, popupSelect):
|
|
@@ -3916,6 +4147,7 @@ function HoverCard({ anchor, content, openDelayMs = 500, disabled = false, group
|
|
|
3916
4147
|
* @param props.onClose - application close command, Escape, or mask click; while a menu is open inside the
|
|
3917
4148
|
* dialog, Escape belongs to that menu first.
|
|
3918
4149
|
* @param props.title - dialog heading (aria-label in every mode).
|
|
4150
|
+
* @param props.tone - warning adds an amber title icon and compact title-to-body spacing; ignored for headless dialogs.
|
|
3919
4151
|
* @param props.closeLabel - localized accessible close-button label.
|
|
3920
4152
|
* @param props.description - optional supporting sentence under the title.
|
|
3921
4153
|
* @param props.children - dialog body; mark its initial-focus control with
|
|
@@ -3930,7 +4162,7 @@ function HoverCard({ anchor, content, openDelayMs = 500, disabled = false, group
|
|
|
3930
4162
|
* @param props.onKeyDownCapture - handle a nested dialog's keys before the document Escape listeners.
|
|
3931
4163
|
* @returns null when closed; otherwise the overlay tree.
|
|
3932
4164
|
*/
|
|
3933
|
-
function Modal({ open, onClose, title, closeLabel, description, children, footer, className, contentClassName, onKeyDownCapture, headless = false, backdropBlur = true, shortcutModal }) {
|
|
4165
|
+
function Modal({ open, onClose, title, closeLabel, description, children, footer, className, contentClassName, onKeyDownCapture, headless = false, backdropBlur = true, shortcutModal, tone }) {
|
|
3934
4166
|
const dialog = useRef(null);
|
|
3935
4167
|
useModalLayer(dialog, open, onClose);
|
|
3936
4168
|
if (!open) return null;
|
|
@@ -3947,7 +4179,7 @@ function Modal({ open, onClose, title, closeLabel, description, children, footer
|
|
|
3947
4179
|
ref: dialog,
|
|
3948
4180
|
tabIndex: -1,
|
|
3949
4181
|
"data-shortcut-modal": shortcutModal,
|
|
3950
|
-
className: clsx(css$23.dialog, className),
|
|
4182
|
+
className: clsx(css$23.dialog, !headless && tone === "warning" && css$23.warning, className),
|
|
3951
4183
|
role: "dialog",
|
|
3952
4184
|
"aria-modal": "true",
|
|
3953
4185
|
"aria-label": title,
|
|
@@ -3956,9 +4188,13 @@ function Modal({ open, onClose, title, closeLabel, description, children, footer
|
|
|
3956
4188
|
children: [
|
|
3957
4189
|
jsxs("div", {
|
|
3958
4190
|
className: css$23.header,
|
|
3959
|
-
children: [
|
|
4191
|
+
children: [jsxs("h2", {
|
|
3960
4192
|
className: css$23.title,
|
|
3961
|
-
children:
|
|
4193
|
+
children: [tone === "warning" && jsx(IconWarningOutlineRegular, {
|
|
4194
|
+
size: 18,
|
|
4195
|
+
className: css$23.warningIcon,
|
|
4196
|
+
"aria-hidden": "true"
|
|
4197
|
+
}), title]
|
|
3962
4198
|
}), jsx("button", {
|
|
3963
4199
|
type: "button",
|
|
3964
4200
|
className: css$23.close,
|
|
@@ -3998,6 +4234,7 @@ function RiskConfirmation({ open, title, description, acknowledgeLabel, cancelLa
|
|
|
3998
4234
|
open,
|
|
3999
4235
|
onClose: onCancel,
|
|
4000
4236
|
title,
|
|
4237
|
+
tone: "warning",
|
|
4001
4238
|
closeLabel,
|
|
4002
4239
|
className: css$24.confirmation ?? "",
|
|
4003
4240
|
contentClassName: css$24.confirmationContent ?? "",
|
|
@@ -4013,23 +4250,16 @@ function RiskConfirmation({ open, title, description, acknowledgeLabel, cancelLa
|
|
|
4013
4250
|
onClick: onConfirm,
|
|
4014
4251
|
children: confirmLabel
|
|
4015
4252
|
})] }),
|
|
4016
|
-
children: [
|
|
4017
|
-
className: css$24.
|
|
4018
|
-
children:
|
|
4019
|
-
|
|
4020
|
-
className: css$24.warningIcon
|
|
4021
|
-
}), jsx("p", { children: description })]
|
|
4022
|
-
}), jsxs("label", {
|
|
4253
|
+
children: [jsx("p", {
|
|
4254
|
+
className: css$24.description,
|
|
4255
|
+
children: description
|
|
4256
|
+
}), jsx(Checkbox, {
|
|
4023
4257
|
className: css$24.acknowledgement,
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
onChange: (event) => {
|
|
4030
|
-
onAcknowledgedChange(event.currentTarget.checked);
|
|
4031
|
-
}
|
|
4032
|
-
}), jsx("span", { children: acknowledgeLabel })]
|
|
4258
|
+
checked: acknowledged,
|
|
4259
|
+
disabled,
|
|
4260
|
+
modalAutofocus: true,
|
|
4261
|
+
label: acknowledgeLabel,
|
|
4262
|
+
onChange: onAcknowledgedChange
|
|
4033
4263
|
})]
|
|
4034
4264
|
});
|
|
4035
4265
|
}
|
|
@@ -4775,7 +5005,7 @@ const CODE_FILE_TYPE_SET = new Set([
|
|
|
4775
5005
|
"yaml",
|
|
4776
5006
|
"zig"
|
|
4777
5007
|
]);
|
|
4778
|
-
const FILE_NAME_TYPES = {
|
|
5008
|
+
const FILE_NAME_TYPES = new Map(Object.entries({
|
|
4779
5009
|
".bash_profile": "shell",
|
|
4780
5010
|
".bashrc": "shell",
|
|
4781
5011
|
".env": "env",
|
|
@@ -4804,7 +5034,7 @@ const FILE_NAME_TYPES = {
|
|
|
4804
5034
|
"package.json": "node",
|
|
4805
5035
|
"podfile": "ruby",
|
|
4806
5036
|
"rakefile": "ruby"
|
|
4807
|
-
};
|
|
5037
|
+
}));
|
|
4808
5038
|
const FILE_NAME_PREFIX_TYPES = [["dockerfile.", "docker"], [".env.", "env"]];
|
|
4809
5039
|
const FILE_NAME_SUFFIX_TYPES = [
|
|
4810
5040
|
[".component.ts", "angular"],
|
|
@@ -4817,7 +5047,7 @@ const FILE_NAME_SUFFIX_TYPES = [
|
|
|
4817
5047
|
[".interceptor.ts", "angular"],
|
|
4818
5048
|
[".dockerfile", "docker"]
|
|
4819
5049
|
];
|
|
4820
|
-
const EXTENSION_TYPES$1 = {
|
|
5050
|
+
const EXTENSION_TYPES$1 = new Map(Object.entries({
|
|
4821
5051
|
"bash": "shell",
|
|
4822
5052
|
"c": "c",
|
|
4823
5053
|
"c++": "cpp",
|
|
@@ -4925,7 +5155,7 @@ const EXTENSION_TYPES$1 = {
|
|
|
4925
5155
|
"yml": "yaml",
|
|
4926
5156
|
"zig": "zig",
|
|
4927
5157
|
"zsh": "shell"
|
|
4928
|
-
};
|
|
5158
|
+
}));
|
|
4929
5159
|
const LINK_CODE_EXTENSIONS = new Set([
|
|
4930
5160
|
"ts",
|
|
4931
5161
|
"tsx",
|
|
@@ -5021,18 +5251,18 @@ function isLinkCodeExtension(extension) {
|
|
|
5021
5251
|
* @returns The detailed code type, or null when the traditional file classifier owns the path.
|
|
5022
5252
|
*/
|
|
5023
5253
|
function classifyCodeFileType(name, extension, context) {
|
|
5024
|
-
const exact = FILE_NAME_TYPES
|
|
5254
|
+
const exact = FILE_NAME_TYPES.get(name);
|
|
5025
5255
|
if (exact !== void 0) return exact;
|
|
5026
5256
|
for (const [prefix, type] of FILE_NAME_PREFIX_TYPES) if (name.startsWith(prefix)) return type;
|
|
5027
5257
|
for (const [suffix, type] of FILE_NAME_SUFFIX_TYPES) if (name.endsWith(suffix)) return type;
|
|
5028
5258
|
if (extension === "dart" && context !== void 0) {
|
|
5029
5259
|
if ((Object.entries(context.files).find(([path]) => basename$1(path).toLowerCase() === "pubspec.yaml")?.[1])?.includes("flutter:") === true) return "flutter";
|
|
5030
5260
|
}
|
|
5031
|
-
return EXTENSION_TYPES$1
|
|
5261
|
+
return EXTENSION_TYPES$1.get(extension) ?? null;
|
|
5032
5262
|
}
|
|
5033
5263
|
//#endregion
|
|
5034
5264
|
//#region lib/types/FileTypeIcon.js
|
|
5035
|
-
const EXTENSION_TYPES = {
|
|
5265
|
+
const EXTENSION_TYPES = new Map(Object.entries({
|
|
5036
5266
|
scss: "code",
|
|
5037
5267
|
sass: "code",
|
|
5038
5268
|
less: "code",
|
|
@@ -5089,12 +5319,12 @@ const EXTENSION_TYPES = {
|
|
|
5089
5319
|
ots: "excel",
|
|
5090
5320
|
fods: "excel",
|
|
5091
5321
|
numbers: "excel"
|
|
5092
|
-
};
|
|
5093
|
-
const NAME_TYPES = {
|
|
5322
|
+
}));
|
|
5323
|
+
const NAME_TYPES = new Map(Object.entries({
|
|
5094
5324
|
changelog: "markdown",
|
|
5095
5325
|
contributing: "markdown",
|
|
5096
5326
|
readme: "markdown"
|
|
5097
|
-
};
|
|
5327
|
+
}));
|
|
5098
5328
|
function basename(path) {
|
|
5099
5329
|
return path.slice(Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")) + 1);
|
|
5100
5330
|
}
|
|
@@ -5120,7 +5350,7 @@ function fileExtension(path) {
|
|
|
5120
5350
|
function classifyFileType(path, context) {
|
|
5121
5351
|
const name = basename(path).toLowerCase();
|
|
5122
5352
|
const extension = fileExtension(name).toLowerCase();
|
|
5123
|
-
return classifyCodeFileType(name, extension, context) ?? NAME_TYPES
|
|
5353
|
+
return classifyCodeFileType(name, extension, context) ?? NAME_TYPES.get(name) ?? EXTENSION_TYPES.get(extension) ?? "other";
|
|
5124
5354
|
}
|
|
5125
5355
|
const FILE_BODY = "M8.48924 28H19.5108C21.6479 28 22.7165 28 23.5594 27.6509C24.6833 27.1853 25.5762 26.2924 26.0417 25.1685C26.3909 24.3256 26.3909 23.257 26.3909 21.1199V8.79443C26.3909 8.32877 26.3909 8.09593 26.3471 7.87507C26.2887 7.58058 26.173 7.30042 26.0067 7.05048C25.882 6.86303 25.7177 6.69799 25.3893 6.36792L20.0611 1.01354C19.7304 0.681235 19.5651 0.515081 19.3769 0.38885C19.126 0.220541 18.8443 0.103463 18.5481 0.0443412C18.3259 0 18.0915 0 17.6226 0H8.48924C6.35209 0 5.28351 0 4.4406 0.349145C3.31672 0.814671 2.4238 1.70759 1.95828 2.83147C1.60913 3.67438 1.60913 4.74296 1.60913 6.88011V21.1199C1.60913 23.257 1.60913 24.3256 1.95828 25.1685C2.4238 26.2924 3.31672 27.1853 4.4406 27.6509C5.28351 28 6.35209 28 8.48924 28Z";
|
|
5126
5356
|
const FILE_FOLD = "M26.3909 7.37445L19.0525 0V3.77445C19.0525 4.89271 19.0525 5.45184 19.2352 5.89289C19.4788 6.48096 19.946 6.94818 20.5341 7.19176C20.9751 7.37445 21.5342 7.37445 22.6525 7.37445H26.3909Z";
|
|
@@ -6473,6 +6703,58 @@ function patchGoGrammar(grammars) {
|
|
|
6473
6703
|
repository
|
|
6474
6704
|
} : grammar);
|
|
6475
6705
|
}
|
|
6706
|
+
/** The Perl grammar's bare `/…/` rule begins a match only after these characters or at line start. */
|
|
6707
|
+
const PERL_FIND_BEGIN = "(?<=[\\&({|~]|if|unless|^)\\s*((/))";
|
|
6708
|
+
/**
|
|
6709
|
+
* Words after which a Perl `/` starts a match rather than a division. A word
|
|
6710
|
+
* counts only when no identifier character, sigil, `>`, `:` or `-` precedes it,
|
|
6711
|
+
* so `$split / 2` and `$obj->return / 2` stay divisions. Each word is a
|
|
6712
|
+
* separate fixed-length lookbehind alternative because the JavaScript engine's
|
|
6713
|
+
* Oniguruma translator rejects nested lookbehinds.
|
|
6714
|
+
*/
|
|
6715
|
+
const PERL_FIND_WORDS = [
|
|
6716
|
+
"if",
|
|
6717
|
+
"unless",
|
|
6718
|
+
"split",
|
|
6719
|
+
"grep",
|
|
6720
|
+
"and",
|
|
6721
|
+
"or",
|
|
6722
|
+
"not",
|
|
6723
|
+
"return",
|
|
6724
|
+
"while",
|
|
6725
|
+
"until"
|
|
6726
|
+
];
|
|
6727
|
+
/**
|
|
6728
|
+
* Widen the vendored Perl grammar's bare `/…/` match rule, which begins only
|
|
6729
|
+
* after `&`, `(`, `{`, `|`, `~`, `if`, `unless` or at line start. Elsewhere,
|
|
6730
|
+
* such as `split /^---\s*$/m, $text`, the pattern body tokenizes as code: its
|
|
6731
|
+
* `m,` opens an `m` match delimited by commas that runs to the end of the
|
|
6732
|
+
* source. The patched rule also begins after `,`, `!`, `=` and `=>`, and after
|
|
6733
|
+
* the list operators `split` and `grep`, the low-precedence operators `and`,
|
|
6734
|
+
* `or` and `not`, and `return`, `while`, `until`, `if` and `unless` when no
|
|
6735
|
+
* identifier character, sigil, `>`, `:` or `-` precedes the word. The upstream
|
|
6736
|
+
* textmate/perl.tmbundle grammar, which `@shikijs/langs` 4.4.3 ships through
|
|
6737
|
+
* VS Code, has the same rule.
|
|
6738
|
+
* @param grammars - the `@shikijs/langs/perl` default export, left unmodified.
|
|
6739
|
+
* @returns copies of `grammars` with that rule's begin replaced in the `perl` grammar.
|
|
6740
|
+
* @throws When the module has no `perl` grammar or that grammar has no or several
|
|
6741
|
+
* top-level rules with the vendored begin pattern. The lazy load then rejects
|
|
6742
|
+
* unhandled and Perl code renders as plain text.
|
|
6743
|
+
*/
|
|
6744
|
+
function patchPerlGrammar(grammars) {
|
|
6745
|
+
const perl = grammars.find((grammar) => grammar.name === "perl");
|
|
6746
|
+
const rules = perl?.patterns.filter((rule) => rule.begin === PERL_FIND_BEGIN) ?? [];
|
|
6747
|
+
if (perl === void 0 || rules.length !== 1) throw new Error(`ui-primitives: expected exactly one Perl match rule to patch, found ${rules.length}; update or delete the patch`);
|
|
6748
|
+
const begin = `(?<=[\\&({|~,!=]|=>|^|${PERL_FIND_WORDS.flatMap((word) => [`[^\\w$@%&>:-]${word}`, `^${word}`]).join("|")})\\s*((/))`;
|
|
6749
|
+
const patterns = perl.patterns.map((rule) => rule === rules[0] ? {
|
|
6750
|
+
...rule,
|
|
6751
|
+
begin
|
|
6752
|
+
} : rule);
|
|
6753
|
+
return grammars.map((grammar) => grammar === perl ? {
|
|
6754
|
+
...perl,
|
|
6755
|
+
patterns
|
|
6756
|
+
} : grammar);
|
|
6757
|
+
}
|
|
6476
6758
|
/**
|
|
6477
6759
|
* The non-boot extension grammars, each behind a dynamic import so its module
|
|
6478
6760
|
* stays out of the boot chunk until a code surface renders that language.
|
|
@@ -6528,7 +6810,7 @@ const LAZY_GRAMMARS = new Map([
|
|
|
6528
6810
|
["haskell", () => import("@shikijs/langs/haskell")],
|
|
6529
6811
|
["fsharp", () => import("@shikijs/langs/fsharp")],
|
|
6530
6812
|
["vb", () => import("@shikijs/langs/vb")],
|
|
6531
|
-
["perl", () => import("@shikijs/langs/perl")],
|
|
6813
|
+
["perl", async () => ({ default: patchPerlGrammar((await import("@shikijs/langs/perl")).default) })],
|
|
6532
6814
|
["verilog", () => import("@shikijs/langs/verilog")],
|
|
6533
6815
|
["system-verilog", () => import("@shikijs/langs/system-verilog")],
|
|
6534
6816
|
["graphql", () => import("@shikijs/langs/graphql")],
|
|
@@ -7252,7 +7534,7 @@ function JsonCopyAction({ store, target, persistent, labels, onCopy, onClose })
|
|
|
7252
7534
|
onCopy(target, mode);
|
|
7253
7535
|
},
|
|
7254
7536
|
onClose,
|
|
7255
|
-
|
|
7537
|
+
anchorRef: buttonRef
|
|
7256
7538
|
})
|
|
7257
7539
|
});
|
|
7258
7540
|
}
|
|
@@ -9137,6 +9419,55 @@ function SearchBlock(props) {
|
|
|
9137
9419
|
});
|
|
9138
9420
|
}
|
|
9139
9421
|
//#endregion
|
|
9422
|
+
//#region lib/types/markdown/copy-tex.js
|
|
9423
|
+
/** Clipboard projection that copies rendered KaTeX formulas as their TeX source. */
|
|
9424
|
+
/** The whole formula around a node, including the display wrapper that marks display math. */
|
|
9425
|
+
function closestFormula(node) {
|
|
9426
|
+
const element = node instanceof Element ? node : node.parentElement;
|
|
9427
|
+
return element?.closest(".katex-display") ?? element?.closest(".katex") ?? null;
|
|
9428
|
+
}
|
|
9429
|
+
/**
|
|
9430
|
+
* Rewrite a copy whose selection lies inside one rendered Markdown document and
|
|
9431
|
+
* includes rendered math, so each formula becomes its trimmed TeX source,
|
|
9432
|
+
* delimited as `$…$` inline and `$$…$$` for display math, in both the
|
|
9433
|
+
* plain-text and HTML clipboard data. A selection endpoint inside a formula
|
|
9434
|
+
* extends to the whole formula in the clipboard only; the visible selection is
|
|
9435
|
+
* unchanged. A copy without math, a selection reaching outside `root`, and a
|
|
9436
|
+
* copy whose default an inner listener already prevented keep their data.
|
|
9437
|
+
* @param event - Native copy event.
|
|
9438
|
+
* @param root - The rendered Markdown document root.
|
|
9439
|
+
*/
|
|
9440
|
+
function copyKatexAsTex(event, root) {
|
|
9441
|
+
const selection = root.ownerDocument.getSelection();
|
|
9442
|
+
if (event.defaultPrevented || event.clipboardData === null || selection === null || selection.rangeCount !== 1 || selection.isCollapsed) return;
|
|
9443
|
+
const range = selection.getRangeAt(0).cloneRange();
|
|
9444
|
+
if (!root.contains(range.commonAncestorContainer)) return;
|
|
9445
|
+
const startFormula = closestFormula(range.startContainer);
|
|
9446
|
+
if (startFormula !== null) range.setStartBefore(startFormula);
|
|
9447
|
+
const endFormula = closestFormula(range.endContainer);
|
|
9448
|
+
if (endFormula !== null) range.setEndAfter(endFormula);
|
|
9449
|
+
const fragment = range.cloneContents();
|
|
9450
|
+
const formulas = [...fragment.querySelectorAll(".katex")];
|
|
9451
|
+
if (formulas.length === 0) return;
|
|
9452
|
+
for (const formula of formulas) {
|
|
9453
|
+
const tex = formula.querySelector("annotation[encoding=\"application/x-tex\"]")?.textContent.trim();
|
|
9454
|
+
if (tex === void 0) continue;
|
|
9455
|
+
const delimiter = formula.closest(".katex-display") === null ? "$" : "$$";
|
|
9456
|
+
formula.replaceWith(`${delimiter}${tex}${delimiter}`);
|
|
9457
|
+
}
|
|
9458
|
+
const container = root.ownerDocument.createElement("div");
|
|
9459
|
+
container.style.cssText = "position:fixed;top:0;left:-100000px;pointer-events:none";
|
|
9460
|
+
container.append(fragment);
|
|
9461
|
+
root.append(container);
|
|
9462
|
+
try {
|
|
9463
|
+
event.clipboardData.setData("text/plain", container.innerText);
|
|
9464
|
+
event.clipboardData.setData("text/html", container.innerHTML);
|
|
9465
|
+
} finally {
|
|
9466
|
+
container.remove();
|
|
9467
|
+
}
|
|
9468
|
+
event.preventDefault();
|
|
9469
|
+
}
|
|
9470
|
+
//#endregion
|
|
9140
9471
|
//#region lib/types/markdown/incremental.js
|
|
9141
9472
|
/**
|
|
9142
9473
|
* Incremental block-level markdown parsing for an append-only text stream.
|
|
@@ -9866,6 +10197,224 @@ function parseGfmWithMath(text) {
|
|
|
9866
10197
|
}), text);
|
|
9867
10198
|
}
|
|
9868
10199
|
//#endregion
|
|
10200
|
+
//#region lib/types/markdown/diff-fence.js
|
|
10201
|
+
/** Unified-diff row parsing and per-file body tokenization for markdown fences. @module dsh-client-ui-primitives/markdown/diff-fence */
|
|
10202
|
+
/** Fence info strings rendered as a unified diff instead of grammar-highlighted code. */
|
|
10203
|
+
const DIFF_FENCE_LANGUAGES = new Set(["diff", "patch"]);
|
|
10204
|
+
/**
|
|
10205
|
+
* Whether a fence info string selects diff row rendering.
|
|
10206
|
+
* @param lang - the fence info string, case-insensitively compared.
|
|
10207
|
+
* @returns whether the fence is a unified diff.
|
|
10208
|
+
*/
|
|
10209
|
+
function isDiffFenceLanguage(lang) {
|
|
10210
|
+
return lang !== void 0 && DIFF_FENCE_LANGUAGES.has(lang.toLowerCase());
|
|
10211
|
+
}
|
|
10212
|
+
/** File-level chrome a unified diff carries above and between hunks. */
|
|
10213
|
+
const DIFF_META_PREFIXES = [
|
|
10214
|
+
"diff --git ",
|
|
10215
|
+
"index ",
|
|
10216
|
+
"old mode ",
|
|
10217
|
+
"new mode ",
|
|
10218
|
+
"new file mode ",
|
|
10219
|
+
"deleted file mode ",
|
|
10220
|
+
"similarity index ",
|
|
10221
|
+
"dissimilarity index ",
|
|
10222
|
+
"rename from ",
|
|
10223
|
+
"rename to ",
|
|
10224
|
+
"copy from ",
|
|
10225
|
+
"copy to ",
|
|
10226
|
+
"Binary files ",
|
|
10227
|
+
"GIT binary patch",
|
|
10228
|
+
"\\ No newline"
|
|
10229
|
+
];
|
|
10230
|
+
/** Hunk header with both line counts; a missing count means one line. */
|
|
10231
|
+
const HUNK_HEADER = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/u;
|
|
10232
|
+
/**
|
|
10233
|
+
* Parse a hunk header's line budget.
|
|
10234
|
+
* @param raw - the `@@ -a,b +c,d @@` line.
|
|
10235
|
+
* @returns the remaining line counts, or `undefined` for a malformed header.
|
|
10236
|
+
*/
|
|
10237
|
+
function hunkRemainder(raw) {
|
|
10238
|
+
const match = HUNK_HEADER.exec(raw);
|
|
10239
|
+
if (match === null) return void 0;
|
|
10240
|
+
return {
|
|
10241
|
+
old: match[2] === void 0 ? 1 : Number(match[2]),
|
|
10242
|
+
new: match[4] === void 0 ? 1 : Number(match[4])
|
|
10243
|
+
};
|
|
10244
|
+
}
|
|
10245
|
+
/** Whether a raw line is file-level chrome rather than hunk content. */
|
|
10246
|
+
function isDiffMeta(raw) {
|
|
10247
|
+
return DIFF_META_PREFIXES.some((prefix) => raw.startsWith(prefix));
|
|
10248
|
+
}
|
|
10249
|
+
/**
|
|
10250
|
+
* Resolve the inner language a `---`/`+++` header names.
|
|
10251
|
+
* @param raw - the header line.
|
|
10252
|
+
* @returns the language id, or `undefined` for `/dev/null` or an unknown path.
|
|
10253
|
+
*/
|
|
10254
|
+
function headerLanguage(raw) {
|
|
10255
|
+
const path = raw.slice(4).replace(/\t.*$/u, "").trim();
|
|
10256
|
+
const unquoted = path.startsWith("\"") && path.endsWith("\"") ? path.slice(1, -1).replace(/\\(["\\])/gu, "$1") : path;
|
|
10257
|
+
if (unquoted === "" || unquoted === "/dev/null") return void 0;
|
|
10258
|
+
return languageForPath(unquoted.replace(/^[ab]\//u, ""));
|
|
10259
|
+
}
|
|
10260
|
+
/**
|
|
10261
|
+
* Split a unified diff into rows without losing a byte (copy reads the DOM).
|
|
10262
|
+
*
|
|
10263
|
+
* The hunk header's line budget ends a hunk, so a following `---` / `+++` file
|
|
10264
|
+
* header is chrome again — both for a concatenated `git diff` and for `diff -u`
|
|
10265
|
+
* output without `diff --git` lines. A malformed header keeps the row until the
|
|
10266
|
+
* next `diff --git`, matching how authored fences are rendered.
|
|
10267
|
+
* @param code - the fence body, display-trimmed.
|
|
10268
|
+
* @returns the rows and each file section's language.
|
|
10269
|
+
*/
|
|
10270
|
+
function parseDiffFence(code) {
|
|
10271
|
+
const rows = [];
|
|
10272
|
+
const languages = /* @__PURE__ */ new Map();
|
|
10273
|
+
let inHunk = false;
|
|
10274
|
+
let remainder;
|
|
10275
|
+
let file = -1;
|
|
10276
|
+
const push = (row) => {
|
|
10277
|
+
rows.push({
|
|
10278
|
+
...row,
|
|
10279
|
+
file
|
|
10280
|
+
});
|
|
10281
|
+
};
|
|
10282
|
+
for (const raw of code.split("\n")) {
|
|
10283
|
+
if (raw.startsWith("diff --git ")) {
|
|
10284
|
+
inHunk = false;
|
|
10285
|
+
remainder = void 0;
|
|
10286
|
+
push({
|
|
10287
|
+
kind: "meta",
|
|
10288
|
+
marker: "",
|
|
10289
|
+
body: "",
|
|
10290
|
+
raw
|
|
10291
|
+
});
|
|
10292
|
+
continue;
|
|
10293
|
+
}
|
|
10294
|
+
if (raw.startsWith("@@")) {
|
|
10295
|
+
inHunk = true;
|
|
10296
|
+
remainder = hunkRemainder(raw);
|
|
10297
|
+
push({
|
|
10298
|
+
kind: "hunk",
|
|
10299
|
+
marker: "",
|
|
10300
|
+
body: "",
|
|
10301
|
+
raw
|
|
10302
|
+
});
|
|
10303
|
+
continue;
|
|
10304
|
+
}
|
|
10305
|
+
if (!inHunk && (raw.startsWith("--- ") || raw.startsWith("+++ "))) {
|
|
10306
|
+
if (raw.startsWith("--- ")) file += 1;
|
|
10307
|
+
const language = headerLanguage(raw);
|
|
10308
|
+
if (language !== void 0) languages.set(file, language);
|
|
10309
|
+
push({
|
|
10310
|
+
kind: "meta",
|
|
10311
|
+
marker: "",
|
|
10312
|
+
body: "",
|
|
10313
|
+
raw
|
|
10314
|
+
});
|
|
10315
|
+
continue;
|
|
10316
|
+
}
|
|
10317
|
+
if (isDiffMeta(raw)) {
|
|
10318
|
+
push({
|
|
10319
|
+
kind: "meta",
|
|
10320
|
+
marker: "",
|
|
10321
|
+
body: "",
|
|
10322
|
+
raw
|
|
10323
|
+
});
|
|
10324
|
+
continue;
|
|
10325
|
+
}
|
|
10326
|
+
if (raw.startsWith("+")) {
|
|
10327
|
+
if (remainder !== void 0) remainder.new -= 1;
|
|
10328
|
+
push({
|
|
10329
|
+
kind: "add",
|
|
10330
|
+
marker: "+",
|
|
10331
|
+
body: raw.slice(1),
|
|
10332
|
+
raw
|
|
10333
|
+
});
|
|
10334
|
+
} else if (raw.startsWith("-")) {
|
|
10335
|
+
if (remainder !== void 0) remainder.old -= 1;
|
|
10336
|
+
push({
|
|
10337
|
+
kind: "del",
|
|
10338
|
+
marker: "-",
|
|
10339
|
+
body: raw.slice(1),
|
|
10340
|
+
raw
|
|
10341
|
+
});
|
|
10342
|
+
} else if (raw.startsWith(" ")) {
|
|
10343
|
+
if (remainder !== void 0) {
|
|
10344
|
+
remainder.old -= 1;
|
|
10345
|
+
remainder.new -= 1;
|
|
10346
|
+
}
|
|
10347
|
+
push({
|
|
10348
|
+
kind: "context",
|
|
10349
|
+
marker: " ",
|
|
10350
|
+
body: raw.slice(1),
|
|
10351
|
+
raw
|
|
10352
|
+
});
|
|
10353
|
+
} else push({
|
|
10354
|
+
kind: "context",
|
|
10355
|
+
marker: "",
|
|
10356
|
+
body: raw,
|
|
10357
|
+
raw
|
|
10358
|
+
});
|
|
10359
|
+
if (inHunk && remainder !== void 0 && remainder.old <= 0 && remainder.new <= 0) inHunk = false;
|
|
10360
|
+
}
|
|
10361
|
+
return {
|
|
10362
|
+
rows,
|
|
10363
|
+
languages
|
|
10364
|
+
};
|
|
10365
|
+
}
|
|
10366
|
+
/**
|
|
10367
|
+
* Whether a row carries code the body highlighter tokenizes.
|
|
10368
|
+
* @param row - the parsed row.
|
|
10369
|
+
* @returns whether the row has tokenizable body text.
|
|
10370
|
+
*/
|
|
10371
|
+
function isDiffContent(row) {
|
|
10372
|
+
return row.kind === "add" || row.kind === "del" || row.kind === "context";
|
|
10373
|
+
}
|
|
10374
|
+
/**
|
|
10375
|
+
* Tokenize each file's old side (context and deletions) and new side (context
|
|
10376
|
+
* and additions) separately, so an unterminated comment or string in a removed
|
|
10377
|
+
* line cannot color the added lines and one file's grammar never applies to the
|
|
10378
|
+
* next. Context rows keep the old-side runs.
|
|
10379
|
+
* @param diff - parsed fence rows and per-file languages.
|
|
10380
|
+
* @returns token runs per content-row index, or `undefined` when no body has a
|
|
10381
|
+
* loaded grammar and the caller should render plain text.
|
|
10382
|
+
*/
|
|
10383
|
+
function diffFenceTokens(diff) {
|
|
10384
|
+
const groups = /* @__PURE__ */ new Map();
|
|
10385
|
+
for (const [index, row] of diff.rows.entries()) {
|
|
10386
|
+
if (!isDiffContent(row)) continue;
|
|
10387
|
+
const sides = row.kind === "del" ? ["old"] : row.kind === "add" ? ["new"] : ["old", "new"];
|
|
10388
|
+
for (const side of sides) {
|
|
10389
|
+
const key = `${row.file}:${side}`;
|
|
10390
|
+
const entry = {
|
|
10391
|
+
row: index,
|
|
10392
|
+
body: row.body,
|
|
10393
|
+
kind: row.kind
|
|
10394
|
+
};
|
|
10395
|
+
const list = groups.get(key);
|
|
10396
|
+
if (list === void 0) groups.set(key, [entry]);
|
|
10397
|
+
else list.push(entry);
|
|
10398
|
+
}
|
|
10399
|
+
}
|
|
10400
|
+
if (groups.size === 0) return void 0;
|
|
10401
|
+
const tokens = /* @__PURE__ */ new Map();
|
|
10402
|
+
let highlighted = false;
|
|
10403
|
+
for (const [key, entries] of groups) {
|
|
10404
|
+
const separator = key.lastIndexOf(":");
|
|
10405
|
+
const language = diff.languages.get(Number(key.slice(0, separator)));
|
|
10406
|
+
const side = key.slice(separator + 1);
|
|
10407
|
+
const lines = highlightLines(entries.map((entry) => entry.body).join("\n"), language);
|
|
10408
|
+
if (lines === void 0) continue;
|
|
10409
|
+
highlighted = true;
|
|
10410
|
+
entries.forEach((entry, lineIndex) => {
|
|
10411
|
+
const line = lines[lineIndex] ?? [];
|
|
10412
|
+
if (side === "old" || entry.kind === "add") tokens.set(entry.row, line);
|
|
10413
|
+
});
|
|
10414
|
+
}
|
|
10415
|
+
return highlighted ? tokens : void 0;
|
|
10416
|
+
}
|
|
10417
|
+
//#endregion
|
|
9869
10418
|
//#region lib/types/markdown/CodeBlock.js
|
|
9870
10419
|
/**
|
|
9871
10420
|
* The `pre` attributes shiki's HTML arm emits for the css-variables theme,
|
|
@@ -9883,6 +10432,28 @@ const SHIKI_PRE_PROPS = {
|
|
|
9883
10432
|
};
|
|
9884
10433
|
/** Completed-line group size; React reconciles groups while the DOM remains line-for-line identical. */
|
|
9885
10434
|
const STREAMING_LINE_GROUP_SIZE = 32;
|
|
10435
|
+
/** Line class per row kind; context rows keep the block's default ink. */
|
|
10436
|
+
const DIFF_ROW_CLASS = {
|
|
10437
|
+
add: css$37.diffAdd,
|
|
10438
|
+
del: css$37.diffDel,
|
|
10439
|
+
hunk: css$37.diffHunk,
|
|
10440
|
+
meta: css$37.diffMeta,
|
|
10441
|
+
context: css$37.diffContext
|
|
10442
|
+
};
|
|
10443
|
+
/** One diff row: optional marker column, then the body with its token colors. */
|
|
10444
|
+
function renderDiffRow(row, index, tokens) {
|
|
10445
|
+
const kindClass = DIFF_ROW_CLASS[row.kind];
|
|
10446
|
+
return jsxs(Fragment$1, { children: [index > 0 && "\n", jsx("span", {
|
|
10447
|
+
className: clsx("line", css$37.diffLine, kindClass),
|
|
10448
|
+
children: isDiffContent(row) ? jsxs(Fragment$1, { children: [jsx("span", {
|
|
10449
|
+
className: css$37.diffMarker,
|
|
10450
|
+
children: row.marker
|
|
10451
|
+
}), tokens === void 0 ? row.body : tokens.map((span, spanIndex) => jsx("span", {
|
|
10452
|
+
style: span.style,
|
|
10453
|
+
children: span.text
|
|
10454
|
+
}, spanIndex))] }) : row.raw
|
|
10455
|
+
})] }, index);
|
|
10456
|
+
}
|
|
9886
10457
|
function renderLine(line, index) {
|
|
9887
10458
|
return jsxs(Fragment$1, { children: [index > 0 && "\n", jsx("span", {
|
|
9888
10459
|
className: "line",
|
|
@@ -9892,17 +10463,27 @@ function renderLine(line, index) {
|
|
|
9892
10463
|
}, spanIndex))
|
|
9893
10464
|
})] }, index);
|
|
9894
10465
|
}
|
|
9895
|
-
function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers = false, showHeader = true, copyLabel, copiedLabel, toolbarLabels, wrap }) {
|
|
10466
|
+
function CodeBlock({ code, lang, diff, streaming, className, contentRef, lineNumbers = false, showHeader = true, copyLabel, copiedLabel, toolbarLabels, wrap }) {
|
|
9896
10467
|
const trimmed = code.endsWith("\n") ? code.slice(0, -1) : code;
|
|
10468
|
+
const diffRows = useMemo(() => diff ?? isDiffFenceLanguage(lang) ? parseDiffFence(trimmed) : void 0, [
|
|
10469
|
+
trimmed,
|
|
10470
|
+
lang,
|
|
10471
|
+
diff
|
|
10472
|
+
]);
|
|
9897
10473
|
const sourceLines = lineNumbers ? trimmed.split("\n") : void 0;
|
|
9898
10474
|
const rootRef = useRef(null);
|
|
9899
|
-
const highlighting = useViewportHighlighting(rootRef, lang);
|
|
10475
|
+
const highlighting = useViewportHighlighting(rootRef, diffRows === void 0 ? lang : "diff");
|
|
9900
10476
|
const loaded = useSyncExternalStore(subscribeGrammarLoaded, grammarLoadCount, grammarLoadCount);
|
|
10477
|
+
const diffTokens = useMemo(() => diffRows === void 0 || !highlighting ? void 0 : diffFenceTokens(diffRows), [
|
|
10478
|
+
diffRows,
|
|
10479
|
+
highlighting,
|
|
10480
|
+
loaded
|
|
10481
|
+
]);
|
|
9901
10482
|
const sessionRef = useRef(null);
|
|
9902
10483
|
const lineCacheRef = useRef(null);
|
|
9903
10484
|
const settledRef = useRef(false);
|
|
9904
10485
|
const streamedBody = useMemo(() => {
|
|
9905
|
-
if (!highlighting) {
|
|
10486
|
+
if (!highlighting || diffRows !== void 0) {
|
|
9906
10487
|
sessionRef.current = null;
|
|
9907
10488
|
lineCacheRef.current = null;
|
|
9908
10489
|
settledRef.current = false;
|
|
@@ -9964,11 +10545,13 @@ function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers =
|
|
|
9964
10545
|
}, [
|
|
9965
10546
|
streaming,
|
|
9966
10547
|
highlighting,
|
|
10548
|
+
diffRows,
|
|
9967
10549
|
trimmed,
|
|
9968
10550
|
lang,
|
|
9969
10551
|
loaded
|
|
9970
10552
|
]);
|
|
9971
|
-
const html = useMemo(() => highlighting && streaming !== true && streamedBody === void 0 ? highlightToHtml(trimmed, lang) : void 0, [
|
|
10553
|
+
const html = useMemo(() => diffRows === void 0 && highlighting && streaming !== true && streamedBody === void 0 ? highlightToHtml(trimmed, lang) : void 0, [
|
|
10554
|
+
diffRows,
|
|
9972
10555
|
streaming,
|
|
9973
10556
|
highlighting,
|
|
9974
10557
|
streamedBody,
|
|
@@ -9989,7 +10572,10 @@ function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers =
|
|
|
9989
10572
|
}, 1e3);
|
|
9990
10573
|
});
|
|
9991
10574
|
}, [copied, trimmed]);
|
|
9992
|
-
const body =
|
|
10575
|
+
const body = diffRows !== void 0 ? jsx("pre", {
|
|
10576
|
+
className: css$37.plain,
|
|
10577
|
+
children: jsx("code", { children: diffRows.rows.map((row, index) => renderDiffRow(row, index, diffTokens?.get(index))) })
|
|
10578
|
+
}) : streamedBody !== void 0 ? streamedBody : html === void 0 ? jsx("pre", {
|
|
9993
10579
|
className: css$37.plain,
|
|
9994
10580
|
children: jsx("code", { children: sourceLines === void 0 ? trimmed : sourceLines.map((line, index) => jsxs(Fragment$1, { children: [index > 0 && "\n", jsx("span", {
|
|
9995
10581
|
className: "line",
|
|
@@ -9998,7 +10584,7 @@ function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers =
|
|
|
9998
10584
|
}) : jsx("div", { dangerouslySetInnerHTML: { __html: html } });
|
|
9999
10585
|
return jsxs("div", {
|
|
10000
10586
|
ref: rootRef,
|
|
10001
|
-
className: clsx(css$37.block, "md-code-block", lineNumbers && css$37.numbered, toolbarLabels !== void 0 && css$37.card, className),
|
|
10587
|
+
className: clsx(css$37.block, "md-code-block", lineNumbers && css$37.numbered, diffRows !== void 0 && !lineNumbers && css$37.diffFence, toolbarLabels !== void 0 && css$37.card, className),
|
|
10002
10588
|
"data-line-numbers": lineNumbers || void 0,
|
|
10003
10589
|
"data-code-wrap": toolbarLabels === void 0 ? void 0 : wrapped,
|
|
10004
10590
|
style: sourceLines === void 0 ? void 0 : { "--dsl-code-block-line-number-width": `${Math.max(2, String(sourceLines.length).length)}ch` },
|
|
@@ -10041,53 +10627,6 @@ function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers =
|
|
|
10041
10627
|
});
|
|
10042
10628
|
}
|
|
10043
10629
|
//#endregion
|
|
10044
|
-
//#region lib/types/markdown/file-link.js
|
|
10045
|
-
/** Local Markdown destinations accepted by the file-preview callback. */
|
|
10046
|
-
/**
|
|
10047
|
-
* Recognize a relative, rooted, or absolute Windows path before URL parsing.
|
|
10048
|
-
* @param value - A decoded or URI-normalized destination.
|
|
10049
|
-
* @returns Whether a filesystem prefix makes the destination unambiguous.
|
|
10050
|
-
*/
|
|
10051
|
-
function isExplicitFilePath(value) {
|
|
10052
|
-
return /^(?:[\\/]|\.{1,2}[\\/]|[a-z]:[\\/])/i.test(value);
|
|
10053
|
-
}
|
|
10054
|
-
/**
|
|
10055
|
-
* Decode a file destination with a fragment, line range, or line/column suffix.
|
|
10056
|
-
* Explicit relative, slash/backslash-rooted, and Windows drive paths take
|
|
10057
|
-
* precedence over URLs. Other parseable absolute URLs are not file links.
|
|
10058
|
-
* Fragments take precedence over colon suffixes; invalid locations open the
|
|
10059
|
-
* file without selecting a line. Columns are consumed but not selected.
|
|
10060
|
-
* Percent-encode literal `?`, `#`, and numeric colon suffixes in filenames.
|
|
10061
|
-
* @param value - Parsed Markdown link destination.
|
|
10062
|
-
* @returns A local path and optional first line, or undefined for URLs,
|
|
10063
|
-
* fragment-only links, queries, malformed escapes, or control characters.
|
|
10064
|
-
*/
|
|
10065
|
-
function parseFileLink(value) {
|
|
10066
|
-
const hash = value.indexOf("#");
|
|
10067
|
-
const destination = hash < 0 ? value : value.slice(0, hash);
|
|
10068
|
-
if (destination.includes("?")) return void 0;
|
|
10069
|
-
let path;
|
|
10070
|
-
try {
|
|
10071
|
-
path = decodeURIComponent(destination);
|
|
10072
|
-
} catch (_error) {
|
|
10073
|
-
return;
|
|
10074
|
-
}
|
|
10075
|
-
if (path.length === 0 || /[\u0000-\u001f\u007f]/.test(path)) return void 0;
|
|
10076
|
-
if (!isExplicitFilePath(path) && URL.canParse(path)) return void 0;
|
|
10077
|
-
const suffix = hash < 0 ? /:(\d+)(?::\d+|-(\d+))?$/.exec(destination) : null;
|
|
10078
|
-
if (suffix !== null) path = path.slice(0, -suffix[0].length);
|
|
10079
|
-
if (path.length === 0) return void 0;
|
|
10080
|
-
const match = suffix ?? (hash < 0 ? null : /^L(\d+)(?:-L(\d+))?$/.exec(value.slice(hash + 1)));
|
|
10081
|
-
if (match === null) return { path };
|
|
10082
|
-
const line = Number(match[1]);
|
|
10083
|
-
const end = match[2] === void 0 ? line : Number(match[2]);
|
|
10084
|
-
if (!Number.isSafeInteger(line) || !Number.isSafeInteger(end) || line < 1 || end < line) return { path };
|
|
10085
|
-
return {
|
|
10086
|
-
path,
|
|
10087
|
-
line
|
|
10088
|
-
};
|
|
10089
|
-
}
|
|
10090
|
-
//#endregion
|
|
10091
10630
|
//#region lib/types/markdown/katex.js
|
|
10092
10631
|
/**
|
|
10093
10632
|
* TeX-to-React via KaTeX, replicating the rehype-katex pipeline this renderer
|
|
@@ -10169,6 +10708,79 @@ function renderTexToReact(value, displayMode) {
|
|
|
10169
10708
|
return [...new DOMParser().parseFromString(html, "text/html").body.childNodes].map(domToReact);
|
|
10170
10709
|
}
|
|
10171
10710
|
//#endregion
|
|
10711
|
+
//#region lib/types/markdown/FenceBlocks.js
|
|
10712
|
+
/**
|
|
10713
|
+
* Render one fence body as a code block.
|
|
10714
|
+
* @param props - fence language, body, streaming state, chrome labels, and diff choice.
|
|
10715
|
+
* @returns the code block.
|
|
10716
|
+
*/
|
|
10717
|
+
function FenceCodeBlock({ lang, code, streaming, labels, diff }) {
|
|
10718
|
+
return jsx(CodeBlock, {
|
|
10719
|
+
code: `${code}\n`,
|
|
10720
|
+
lang,
|
|
10721
|
+
streaming,
|
|
10722
|
+
diff,
|
|
10723
|
+
copyLabel: labels.copyLabel,
|
|
10724
|
+
copiedLabel: labels.copiedLabel,
|
|
10725
|
+
toolbarLabels: labels.toolbarLabels
|
|
10726
|
+
});
|
|
10727
|
+
}
|
|
10728
|
+
/**
|
|
10729
|
+
* Render one `math` fence body as display TeX.
|
|
10730
|
+
* @param props - the fence body without its closing newline.
|
|
10731
|
+
* @returns the typeset formula.
|
|
10732
|
+
*/
|
|
10733
|
+
function FenceMathBlock({ code }) {
|
|
10734
|
+
return jsx(Fragment, { children: renderTexToReact(`${code}\n`, true) });
|
|
10735
|
+
}
|
|
10736
|
+
//#endregion
|
|
10737
|
+
//#region lib/types/markdown/file-link.js
|
|
10738
|
+
/** Local Markdown destinations accepted by the file-preview callback. */
|
|
10739
|
+
/**
|
|
10740
|
+
* Recognize a relative, rooted, or absolute Windows path before URL parsing.
|
|
10741
|
+
* @param value - A decoded or URI-normalized destination.
|
|
10742
|
+
* @returns Whether a filesystem prefix makes the destination unambiguous.
|
|
10743
|
+
*/
|
|
10744
|
+
function isExplicitFilePath(value) {
|
|
10745
|
+
return /^(?:[\\/]|\.{1,2}[\\/]|[a-z]:[\\/])/i.test(value);
|
|
10746
|
+
}
|
|
10747
|
+
/**
|
|
10748
|
+
* Decode a file destination with a fragment, line range, or line/column suffix.
|
|
10749
|
+
* Explicit relative, slash/backslash-rooted, and Windows drive paths take
|
|
10750
|
+
* precedence over URLs. Other parseable absolute URLs are not file links.
|
|
10751
|
+
* Fragments take precedence over colon suffixes; invalid locations open the
|
|
10752
|
+
* file without selecting a line. Columns are consumed but not selected.
|
|
10753
|
+
* Percent-encode literal `?`, `#`, and numeric colon suffixes in filenames.
|
|
10754
|
+
* @param value - Parsed Markdown link destination.
|
|
10755
|
+
* @returns A local path and optional first line, or undefined for URLs,
|
|
10756
|
+
* fragment-only links, queries, malformed escapes, or control characters.
|
|
10757
|
+
*/
|
|
10758
|
+
function parseFileLink(value) {
|
|
10759
|
+
const hash = value.indexOf("#");
|
|
10760
|
+
const destination = hash < 0 ? value : value.slice(0, hash);
|
|
10761
|
+
if (destination.includes("?")) return void 0;
|
|
10762
|
+
let path;
|
|
10763
|
+
try {
|
|
10764
|
+
path = decodeURIComponent(destination);
|
|
10765
|
+
} catch (_error) {
|
|
10766
|
+
return;
|
|
10767
|
+
}
|
|
10768
|
+
if (path.length === 0 || /[\u0000-\u001f\u007f]/.test(path)) return void 0;
|
|
10769
|
+
if (!isExplicitFilePath(path) && URL.canParse(path)) return void 0;
|
|
10770
|
+
const suffix = hash < 0 ? /:(\d+)(?::\d+|-(\d+))?$/.exec(destination) : null;
|
|
10771
|
+
if (suffix !== null) path = path.slice(0, -suffix[0].length);
|
|
10772
|
+
if (path.length === 0) return void 0;
|
|
10773
|
+
const match = suffix ?? (hash < 0 ? null : /^L(\d+)(?:-L(\d+))?$/.exec(value.slice(hash + 1)));
|
|
10774
|
+
if (match === null) return { path };
|
|
10775
|
+
const line = Number(match[1]);
|
|
10776
|
+
const end = match[2] === void 0 ? line : Number(match[2]);
|
|
10777
|
+
if (!Number.isSafeInteger(line) || !Number.isSafeInteger(end) || line < 1 || end < line) return { path };
|
|
10778
|
+
return {
|
|
10779
|
+
path,
|
|
10780
|
+
line
|
|
10781
|
+
};
|
|
10782
|
+
}
|
|
10783
|
+
//#endregion
|
|
10172
10784
|
//#region lib/types/markdown/MarkdownDelegate.js
|
|
10173
10785
|
/** Consumer-owned navigation for Markdown links. */
|
|
10174
10786
|
const MarkdownDelegateContext = createContext({});
|
|
@@ -10178,17 +10790,19 @@ const MarkdownDelegateContext = createContext({});
|
|
|
10178
10790
|
* @param props - Child tree and its file and HTTP(S) link handlers.
|
|
10179
10791
|
* @returns the scoped child tree.
|
|
10180
10792
|
*/
|
|
10181
|
-
function MarkdownDelegateProvider({ children, openExternalLink, openFile, fileImages, getTriggerProps }) {
|
|
10793
|
+
function MarkdownDelegateProvider({ children, openExternalLink, openFile, fileImages, getTriggerProps, renderCode }) {
|
|
10182
10794
|
const delegate = useMemo(() => ({
|
|
10183
10795
|
openExternalLink,
|
|
10184
10796
|
openFile,
|
|
10185
10797
|
fileImages,
|
|
10186
|
-
getTriggerProps
|
|
10798
|
+
getTriggerProps,
|
|
10799
|
+
renderCode
|
|
10187
10800
|
}), [
|
|
10188
10801
|
openExternalLink,
|
|
10189
10802
|
openFile,
|
|
10190
10803
|
fileImages,
|
|
10191
|
-
getTriggerProps
|
|
10804
|
+
getTriggerProps,
|
|
10805
|
+
renderCode
|
|
10192
10806
|
]);
|
|
10193
10807
|
return jsx(MarkdownDelegateContext.Provider, {
|
|
10194
10808
|
value: delegate,
|
|
@@ -10517,16 +11131,44 @@ function renderCode(node, key, context) {
|
|
|
10517
11131
|
const language = node.lang ?? void 0;
|
|
10518
11132
|
if (node.value === "") return jsx("pre", { children: jsx("code", { className: language === void 0 ? void 0 : `language-${language}` }) }, key);
|
|
10519
11133
|
const lang = language === void 0 ? void 0 : /^[\w-]+/.exec(language)?.[0];
|
|
10520
|
-
if (
|
|
10521
|
-
|
|
10522
|
-
|
|
11134
|
+
if (lang === void 0) return jsx(FenceCodeBlock, {
|
|
11135
|
+
code: node.value,
|
|
11136
|
+
streaming: context.streaming,
|
|
11137
|
+
labels: context.labels.code
|
|
11138
|
+
}, key);
|
|
11139
|
+
return jsx(MarkdownFenceSeat, {
|
|
10523
11140
|
lang,
|
|
11141
|
+
meta: node.meta ?? void 0,
|
|
11142
|
+
code: node.value,
|
|
10524
11143
|
streaming: context.streaming,
|
|
10525
|
-
|
|
10526
|
-
copiedLabel: context.labels.code.copiedLabel,
|
|
10527
|
-
toolbarLabels: context.labels.code.toolbarLabels
|
|
11144
|
+
labels: context.labels.code
|
|
10528
11145
|
}, key);
|
|
10529
11146
|
}
|
|
11147
|
+
/**
|
|
11148
|
+
* One fence whose language is final: the delegate's renderer when the owner
|
|
11149
|
+
* supplies one, otherwise the built-in math and code blocks. Reading the
|
|
11150
|
+
* delegate in this Component rather than in the render pass lets cached
|
|
11151
|
+
* streaming elements follow a provider change.
|
|
11152
|
+
*/
|
|
11153
|
+
function MarkdownFenceSeat({ lang, meta, code, streaming, labels }) {
|
|
11154
|
+
const { renderCode } = useMarkdownDelegate();
|
|
11155
|
+
if (renderCode !== void 0) return jsx("div", {
|
|
11156
|
+
className: markdownCss.fenceSeat,
|
|
11157
|
+
children: renderCode({
|
|
11158
|
+
lang: lang.toLowerCase(),
|
|
11159
|
+
code,
|
|
11160
|
+
streaming,
|
|
11161
|
+
meta
|
|
11162
|
+
})
|
|
11163
|
+
});
|
|
11164
|
+
if (!streaming && lang === "math") return jsx(FenceMathBlock, { code });
|
|
11165
|
+
return jsx(FenceCodeBlock, {
|
|
11166
|
+
lang,
|
|
11167
|
+
code,
|
|
11168
|
+
streaming,
|
|
11169
|
+
labels
|
|
11170
|
+
});
|
|
11171
|
+
}
|
|
10530
11172
|
/** A list is loose when it or any of its items is spread; every item then keeps its paragraphs. */
|
|
10531
11173
|
function listLoose(list) {
|
|
10532
11174
|
return (list.spread ?? false) || list.children.some(listItemLoose);
|
|
@@ -11020,6 +11662,8 @@ var StreamingRenderer = class {
|
|
|
11020
11662
|
* including `#L24` / `#L24-L30` fragments and `:24` / `:24-30` / `:24:5` suffixes
|
|
11021
11663
|
* (ranges open at their first line, columns are ignored, and invalid locations
|
|
11022
11664
|
* open only the file; see the README for URL/path classification).
|
|
11665
|
+
* Copying a selection inside the document writes selected formulas as
|
|
11666
|
+
* `$…$` / `$$…$$` TeX source.
|
|
11023
11667
|
* @returns A GFM document with TeX math rendered through KaTeX; raw HTML never
|
|
11024
11668
|
* renders as markup, and unsafe protocols are disabled. Local links without an opener remain text;
|
|
11025
11669
|
* absolute HTTP(S) images render directly.
|
|
@@ -11049,6 +11693,9 @@ const MarkdownText = memo(function MarkdownText({ text, streaming = false, label
|
|
|
11049
11693
|
className: clsx(markdownCss.markdown, variant === "compact" && markdownCss.compact),
|
|
11050
11694
|
"data-text-interaction-source": textInteractionSource ? "" : void 0,
|
|
11051
11695
|
"data-markdown-variant": variant === "compact" ? variant : void 0,
|
|
11696
|
+
onCopy: (event) => {
|
|
11697
|
+
copyKatexAsTex(event.nativeEvent, event.currentTarget);
|
|
11698
|
+
},
|
|
11052
11699
|
children
|
|
11053
11700
|
});
|
|
11054
11701
|
});
|
|
@@ -11737,10 +12384,10 @@ function QuoteMarkIcon({ className }) {
|
|
|
11737
12384
|
/**
|
|
11738
12385
|
* Render one width-capped quote preview shared by editable drafts and sent messages.
|
|
11739
12386
|
* Clipped excerpts open a content-sized, scrollable popover that fits within the viewport.
|
|
11740
|
-
* @param props - selected text and optional localized removal action.
|
|
11741
|
-
* @returns a non-navigating quote preview with a full-text popover only while clipped.
|
|
12387
|
+
* @param props - selected text, optional summary, and optional localized removal action.
|
|
12388
|
+
* @returns a non-navigating quote preview with a full-text popover only while clipped, or a summary popover.
|
|
11742
12389
|
*/
|
|
11743
|
-
function QuotePreview({ text, removal }) {
|
|
12390
|
+
function QuotePreview({ text, summary, removal }) {
|
|
11744
12391
|
const sourceRef = useRef(null);
|
|
11745
12392
|
const [truncated, setTruncated] = useState(false);
|
|
11746
12393
|
useLayoutEffect(() => {
|
|
@@ -11791,7 +12438,21 @@ function QuotePreview({ text, removal }) {
|
|
|
11791
12438
|
ref: sourceRef,
|
|
11792
12439
|
className: css$43.source,
|
|
11793
12440
|
"data-quote-preview-text": "",
|
|
11794
|
-
children: text
|
|
12441
|
+
children: summary === void 0 ? text : jsxs(Fragment, { children: [
|
|
12442
|
+
jsx("span", {
|
|
12443
|
+
"aria-hidden": "true",
|
|
12444
|
+
children: summary.label
|
|
12445
|
+
}),
|
|
12446
|
+
jsx("span", {
|
|
12447
|
+
className: css$43.visuallyHidden,
|
|
12448
|
+
children: summary.detail === void 0 ? summary.title : `${summary.title} ${summary.detail}`
|
|
12449
|
+
}),
|
|
12450
|
+
" ",
|
|
12451
|
+
jsx("span", {
|
|
12452
|
+
className: css$43.inlineBody,
|
|
12453
|
+
children: summary.body
|
|
12454
|
+
})
|
|
12455
|
+
] })
|
|
11795
12456
|
})]
|
|
11796
12457
|
});
|
|
11797
12458
|
return jsx(HoverCard, {
|
|
@@ -11799,13 +12460,31 @@ function QuotePreview({ text, removal }) {
|
|
|
11799
12460
|
grouped: true,
|
|
11800
12461
|
fitContent: true,
|
|
11801
12462
|
openDelayMs: 0,
|
|
11802
|
-
disabled: !truncated,
|
|
12463
|
+
disabled: summary === void 0 && !truncated,
|
|
11803
12464
|
anchor: preview,
|
|
11804
|
-
content: jsx("span", {
|
|
12465
|
+
content: summary === void 0 ? jsx("span", {
|
|
11805
12466
|
className: css$43.popoverText,
|
|
11806
12467
|
"data-quote-popover": "",
|
|
11807
12468
|
"aria-hidden": "true",
|
|
11808
12469
|
children: text
|
|
12470
|
+
}) : jsxs("span", {
|
|
12471
|
+
className: css$43.summary,
|
|
12472
|
+
"data-quote-popover": "",
|
|
12473
|
+
"aria-hidden": "true",
|
|
12474
|
+
children: [
|
|
12475
|
+
jsx("span", {
|
|
12476
|
+
className: css$43.summaryTitle,
|
|
12477
|
+
children: summary.title
|
|
12478
|
+
}),
|
|
12479
|
+
summary.detail !== void 0 && jsx("span", {
|
|
12480
|
+
className: css$43.summaryDetail,
|
|
12481
|
+
children: summary.detail
|
|
12482
|
+
}),
|
|
12483
|
+
jsx("span", {
|
|
12484
|
+
className: css$43.summaryBody,
|
|
12485
|
+
children: summary.body
|
|
12486
|
+
})
|
|
12487
|
+
]
|
|
11809
12488
|
})
|
|
11810
12489
|
});
|
|
11811
12490
|
}
|
|
@@ -11821,6 +12500,6 @@ function formatQuoteText(text) {
|
|
|
11821
12500
|
return text.replace(/\r\n?/gu, "\n").split("\n").map((line) => `> ${line}`).join("\n");
|
|
11822
12501
|
}
|
|
11823
12502
|
//#endregion
|
|
11824
|
-
export { AnimatedRows, BrandWordmark, Button, CODE_HIGHLIGHT_EXTENSIONS, Checkbox, CodeBlock, CommandText, ConnectionIndicator, DEFAULT_DIFF_MAX_LINES, DEFAULT_READ_MAX_LINES, DEFAULT_SEARCH_MAX_LINES, DEFAULT_TERMINAL_MAX_LINES, DOCUMENT_ZOOM, DetailDocument, DiffBlock, DisclosureRow, DraggableImage, FISH_LOGO_PATH, FISH_LOGO_VIEWBOX, FileTypeIcon, FishLogo, GuideArtworkBrowser, GuideArtworkFiles, HoverCard, HoverCardGroup, ICON_MEDIUM_STROKE, ICON_REGULAR_STROKE, ICON_SYMBOLS, IconAgentPresetOutlineMedium, IconAgentPresetOutlineRegular, IconAlarmClockOutlineMedium, IconAlarmClockOutlineRegular, IconApiOutlineMedium, IconApiOutlineRegular, IconAppsAddOutlineMedium, IconAppsAddOutlineRegular, IconArchiveCheckOutlineMedium, IconArchiveCheckOutlineRegular, IconArchiveOffOutlineMedium, IconArchiveOffOutlineRegular, IconArchiveOutlineMedium, IconArchiveOutlineRegular, IconBranchOutlineMedium, IconBranchOutlineRegular, IconBrowseOutlineMedium, IconBrowseOutlineRegular, IconCheckCircleFillMedium, IconCheckCircleFillRegular, IconCheckCircleOutlineMedium, IconCheckCircleOutlineRegular, IconCheckOutlineMedium, IconCheckOutlineRegular, IconChecklistOutlineMedium, IconChecklistOutlineRegular, IconChevronDownOutlineMedium, IconChevronDownOutlineRegular, IconChevronLeftOutlineMedium, IconChevronLeftOutlineRegular, IconChevronRightOutlineMedium, IconChevronRightOutlineRegular, IconChevronUpOutlineMedium, IconChevronUpOutlineRegular, IconChevronsUpDownOutlineMedium, IconChevronsUpDownOutlineRegular, IconClockOutlineMedium, IconClockOutlineRegular, IconCloseCircleFillMedium, IconCloseCircleFillRegular, IconCloseFillMedium, IconCloseFillRegular, IconCloseOutlineMedium, IconCloseOutlineRegular, IconCodeOutlineMedium, IconCodeOutlineRegular, IconCompactOutlineMedium, IconCompactOutlineRegular, IconCompareSplitOutlineMedium, IconCompareSplitOutlineRegular, IconContextInjectionOutlineMedium, IconContextInjectionOutlineRegular, IconCopyOutlineMedium, IconCopyOutlineRegular, IconCordisPluginOutlineMedium, IconCordisPluginOutlineRegular, IconDarkOutlineMedium, IconDarkOutlineRegular, IconDataOutlineMedium, IconDataOutlineRegular, IconDatabaseOutlineMedium, IconDatabaseOutlineRegular, IconDeliverDocMedium, IconDeliverDocRegular, IconDislikeFillMedium, IconDislikeFillRegular, IconDislikeOutlineMedium, IconDislikeOutlineRegular, IconDownloadOutlineMedium, IconDownloadOutlineRegular, IconDragHandleOutlineMedium, IconDragHandleOutlineRegular, IconEditOutlineMedium, IconEditOutlineRegular, IconEllipsisOutlineMedium, IconEllipsisOutlineRegular, IconEnhanceOutlineMedium, IconEnhanceOutlineRegular, IconFlatListOutlineMedium, IconFlatListOutlineRegular, IconFolderCloseMedium, IconFolderCloseRegular, IconFolderOpenMedium, IconFolderOpenOutlineMedium, IconFolderOpenOutlineRegular, IconFolderOpenRegular, IconFollowsystemOutlineMedium, IconFollowsystemOutlineRegular, IconFullscreenOutlineMedium, IconFullscreenOutlineRegular, IconGaugeOutlineMedium, IconGaugeOutlineRegular, IconGlobeOutlineMedium, IconGlobeOutlineRegular, IconGoalOutlineMedium, IconGoalOutlineRegular, IconInfoOutlineMedium, IconInfoOutlineRegular, IconInspectOutlineMedium, IconInspectOutlineRegular, IconLightOutlineMedium, IconLightOutlineRegular, IconLikeFillMedium, IconLikeFillRegular, IconLikeOutlineMedium, IconLikeOutlineRegular, IconLinkOutlineMedium, IconLinkOutlineRegular, IconListPenOutlineMedium, IconListPenOutlineRegular, IconLoadingOutlineMedium, IconLoadingOutlineRegular, IconMicrophoneOutlineMedium, IconMicrophoneOutlineRegular, IconNewChatOutlineMedium, IconNewChatOutlineRegular, IconNowrapFillMedium, IconNowrapFillRegular, IconPanelLeftOutlineMedium, IconPanelLeftOutlineRegular, IconPaperPlaneOutlineMedium, IconPaperPlaneOutlineRegular, IconPaperclipOutlineMedium, IconPaperclipOutlineRegular, IconPauseOutlineMedium, IconPauseOutlineRegular, IconPersonalizationOutlineMedium, IconPersonalizationOutlineRegular, IconPinFillMedium, IconPinFillRegular, IconPinOutlineMedium, IconPinOutlineRegular, IconPlanOutlineMedium, IconPlanOutlineRegular, IconPlayOutlineMedium, IconPlayOutlineRegular, IconPluginPinwheelOutlineMedium, IconPluginPinwheelOutlineRegular, IconPlusOutlineMedium, IconPlusOutlineRegular, IconProjectAddOutlineMedium, IconProjectAddOutlineRegular, IconQuestionOutlineMedium, IconQuestionOutlineRegular, IconQueueOutlineMedium, IconQueueOutlineRegular, IconRefreshOutlineMedium, IconRefreshOutlineRegular, IconRightUpOutlineMedium, IconRightUpOutlineRegular, IconSaveOutlineMedium, IconSaveOutlineRegular, IconSearchOutlineMedium, IconSearchOutlineRegular, IconSendOutlineMedium, IconSendOutlineRegular, IconSettingsOutlineMedium, IconSettingsOutlineRegular, IconShareOutlineMedium, IconShareOutlineRegular, IconShieldOutlineMedium, IconShieldOutlineRegular, IconSkillOutlineMedium, IconSkillOutlineRegular, IconSlidersTwoOutlineMedium, IconSlidersTwoOutlineRegular, IconSparkleMedium, IconSparkleRegular, IconStopFillMedium, IconStopFillRegular, IconThinkOutlineMedium, IconThinkOutlineRegular, IconTrashOutlineMedium, IconTrashOutlineRegular, IconTreeCornerMedium, IconTreeCornerRegular, IconTriangleRightFillMedium, IconTriangleRightFillRegular, IconUnarchiveOutlineMedium, IconUnarchiveOutlineRegular, IconUserOutlineMedium, IconUserOutlineRegular, IconUsersOutlineMedium, IconUsersOutlineRegular, IconWarningOutlineMedium, IconWarningOutlineRegular, IconWarningTriangleOutlineMedium, IconWarningTriangleOutlineRegular, IconWorkspaceTreeOutlineMedium, IconWorkspaceTreeOutlineRegular, IconWrapFillMedium, IconWrapFillRegular, IconWrapLinesOutlineMedium, IconWrapLinesOutlineRegular, ImageLightbox, InlineEditor, Input, JsonBlock, JsonTree, LinkIconMedium, LinkIconRegular, MENU_TRANSITION_MS, MarkdownDelegateProvider, MarkdownText, Menu, MenuGroup, MenuItemButton, MenuSurface, Modal, PathLabel, PermissionIconAutoReviewMedium, PermissionIconAutoReviewRegular, PermissionIconFullAccessMedium, PermissionIconFullAccessRegular, PermissionIconReadOnlyMedium, PermissionIconReadOnlyRegular, PermissionIconWorkspaceWriteMedium, PermissionIconWorkspaceWriteRegular, Pill, PluginArtworkDefault, PluginArtworkLoop, PluginArtworkSearch, PluginArtworkSubagent, PluginArtworkTerminal, QuotePreview, ReadBlock, ReferenceChip, ReferenceIconMedium, ReferenceIconRegular, RiskConfirmation, SHIELD_OUTLINE_PATH, SearchBlock, SegmentedControl, SegmentedTabs, SettingsForm, SettingsFormModel, SettingsSecretField, SettingsValueField, ShortcutKeys, StateDot, Switch, Tag, TerminalBlock, TextShimmer, Toast, Tooltip, UserMessageBubble, UserTextRun, WebBlock, ZoomControls, classifyFileType, classifyLinkPath, closeTopModal, detailDocumentState, diffTotals, extractMarkdownPlainText, fileExtension, fileSizeText, focusWithoutRing, formatQuoteText, isBehindModal, isDarwinDesktop, isMobileDevice, languageForPath, modalSelector, observeComposition, observeStickyMenuGroups, pointerModality, rankByName, relativeTime, settingsNumberField, settingsTextField, useAnchoredMaxHeight,
|
|
12503
|
+
export { AnimatedRows, BrandWordmark, Button, CODE_HIGHLIGHT_EXTENSIONS, Checkbox, CodeBlock, CommandText, ConnectionIndicator, DEFAULT_DIFF_MAX_LINES, DEFAULT_READ_MAX_LINES, DEFAULT_SEARCH_MAX_LINES, DEFAULT_TERMINAL_MAX_LINES, DOCUMENT_ZOOM, DetailDocument, DiffBlock, DisclosureRow, DraggableImage, FISH_LOGO_PATH, FISH_LOGO_VIEWBOX, FenceCodeBlock, FenceMathBlock, FileTypeIcon, FishLogo, GuideArtworkBrowser, GuideArtworkFiles, HoverCard, HoverCardGroup, ICON_MEDIUM_STROKE, ICON_REGULAR_STROKE, ICON_SYMBOLS, IconAgentPresetOutlineMedium, IconAgentPresetOutlineRegular, IconAlarmClockOutlineMedium, IconAlarmClockOutlineRegular, IconApiOutlineMedium, IconApiOutlineRegular, IconAppsAddOutlineMedium, IconAppsAddOutlineRegular, IconArchiveCheckOutlineMedium, IconArchiveCheckOutlineRegular, IconArchiveOffOutlineMedium, IconArchiveOffOutlineRegular, IconArchiveOutlineMedium, IconArchiveOutlineRegular, IconBranchOutlineMedium, IconBranchOutlineRegular, IconBrowseOutlineMedium, IconBrowseOutlineRegular, IconCheckCircleFillMedium, IconCheckCircleFillRegular, IconCheckCircleOutlineMedium, IconCheckCircleOutlineRegular, IconCheckOutlineMedium, IconCheckOutlineRegular, IconChecklistOutlineMedium, IconChecklistOutlineRegular, IconChevronDownOutlineMedium, IconChevronDownOutlineRegular, IconChevronLeftOutlineMedium, IconChevronLeftOutlineRegular, IconChevronRightOutlineMedium, IconChevronRightOutlineRegular, IconChevronUpOutlineMedium, IconChevronUpOutlineRegular, IconChevronsUpDownOutlineMedium, IconChevronsUpDownOutlineRegular, IconClockOutlineMedium, IconClockOutlineRegular, IconCloseCircleFillMedium, IconCloseCircleFillRegular, IconCloseFillMedium, IconCloseFillRegular, IconCloseOutlineMedium, IconCloseOutlineRegular, IconCodeOutlineMedium, IconCodeOutlineRegular, IconCompactOutlineMedium, IconCompactOutlineRegular, IconCompareSplitOutlineMedium, IconCompareSplitOutlineRegular, IconContextInjectionOutlineMedium, IconContextInjectionOutlineRegular, IconCopyOutlineMedium, IconCopyOutlineRegular, IconCordisPluginOutlineMedium, IconCordisPluginOutlineRegular, IconDarkOutlineMedium, IconDarkOutlineRegular, IconDataOutlineMedium, IconDataOutlineRegular, IconDatabaseOutlineMedium, IconDatabaseOutlineRegular, IconDeliverDocMedium, IconDeliverDocRegular, IconDislikeFillMedium, IconDislikeFillRegular, IconDislikeOutlineMedium, IconDislikeOutlineRegular, IconDownloadOutlineMedium, IconDownloadOutlineRegular, IconDragHandleOutlineMedium, IconDragHandleOutlineRegular, IconEditOutlineMedium, IconEditOutlineRegular, IconEllipsisOutlineMedium, IconEllipsisOutlineRegular, IconEnhanceOutlineMedium, IconEnhanceOutlineRegular, IconEyeOffOutlineMedium, IconEyeOffOutlineRegular, IconEyeOutlineMedium, IconEyeOutlineRegular, IconFlatListOutlineMedium, IconFlatListOutlineRegular, IconFolderCloseMedium, IconFolderCloseRegular, IconFolderOpenMedium, IconFolderOpenOutlineMedium, IconFolderOpenOutlineRegular, IconFolderOpenRegular, IconFollowsystemOutlineMedium, IconFollowsystemOutlineRegular, IconFullscreenOutlineMedium, IconFullscreenOutlineRegular, IconGaugeOutlineMedium, IconGaugeOutlineRegular, IconGlobeOutlineMedium, IconGlobeOutlineRegular, IconGoalOutlineMedium, IconGoalOutlineRegular, IconInfoOutlineMedium, IconInfoOutlineRegular, IconInspectOutlineMedium, IconInspectOutlineRegular, IconLayersOutlineMedium, IconLayersOutlineRegular, IconLightOutlineMedium, IconLightOutlineRegular, IconLikeFillMedium, IconLikeFillRegular, IconLikeOutlineMedium, IconLikeOutlineRegular, IconLinkOutlineMedium, IconLinkOutlineRegular, IconListPenOutlineMedium, IconListPenOutlineRegular, IconLoadingOutlineMedium, IconLoadingOutlineRegular, IconMicrophoneOutlineMedium, IconMicrophoneOutlineRegular, IconNewChatOutlineMedium, IconNewChatOutlineRegular, IconNowrapFillMedium, IconNowrapFillRegular, IconPanelLeftOutlineMedium, IconPanelLeftOutlineRegular, IconPaperPlaneOutlineMedium, IconPaperPlaneOutlineRegular, IconPaperclipOutlineMedium, IconPaperclipOutlineRegular, IconPauseOutlineMedium, IconPauseOutlineRegular, IconPersonalizationOutlineMedium, IconPersonalizationOutlineRegular, IconPinFillMedium, IconPinFillRegular, IconPinOutlineMedium, IconPinOutlineRegular, IconPlanOutlineMedium, IconPlanOutlineRegular, IconPlayOutlineMedium, IconPlayOutlineRegular, IconPluginPinwheelOutlineMedium, IconPluginPinwheelOutlineRegular, IconPlusOutlineMedium, IconPlusOutlineRegular, IconProjectAddOutlineMedium, IconProjectAddOutlineRegular, IconQuestionOutlineMedium, IconQuestionOutlineRegular, IconQueueOutlineMedium, IconQueueOutlineRegular, IconRefreshOutlineMedium, IconRefreshOutlineRegular, IconRightUpOutlineMedium, IconRightUpOutlineRegular, IconSaveOutlineMedium, IconSaveOutlineRegular, IconSearchOutlineMedium, IconSearchOutlineRegular, IconSendOutlineMedium, IconSendOutlineRegular, IconSettingsOutlineMedium, IconSettingsOutlineRegular, IconShareOutlineMedium, IconShareOutlineRegular, IconShieldOutlineMedium, IconShieldOutlineRegular, IconSkillOutlineMedium, IconSkillOutlineRegular, IconSlidersTwoOutlineMedium, IconSlidersTwoOutlineRegular, IconSparkleMedium, IconSparkleRegular, IconStopFillMedium, IconStopFillRegular, IconThinkOutlineMedium, IconThinkOutlineRegular, IconTrashOutlineMedium, IconTrashOutlineRegular, IconTreeCornerMedium, IconTreeCornerRegular, IconTriangleRightFillMedium, IconTriangleRightFillRegular, IconUnarchiveOutlineMedium, IconUnarchiveOutlineRegular, IconUploadOutlineMedium, IconUploadOutlineRegular, IconUserOutlineMedium, IconUserOutlineRegular, IconUsersOutlineMedium, IconUsersOutlineRegular, IconWarningOutlineMedium, IconWarningOutlineRegular, IconWarningTriangleOutlineMedium, IconWarningTriangleOutlineRegular, IconWorkspaceTreeOutlineMedium, IconWorkspaceTreeOutlineRegular, IconWrapFillMedium, IconWrapFillRegular, IconWrapLinesOutlineMedium, IconWrapLinesOutlineRegular, ImageLightbox, InlineEditor, Input, JsonBlock, JsonTree, LinkIconMedium, LinkIconRegular, MENU_TRANSITION_MS, MarkdownDelegateProvider, MarkdownText, Menu, MenuGroup, MenuItemButton, MenuSurface, Modal, PathLabel, PermissionIconAutoReviewMedium, PermissionIconAutoReviewRegular, PermissionIconFullAccessMedium, PermissionIconFullAccessRegular, PermissionIconReadOnlyMedium, PermissionIconReadOnlyRegular, PermissionIconWorkspaceWriteMedium, PermissionIconWorkspaceWriteRegular, Pill, PluginArtworkDefault, PluginArtworkLoop, PluginArtworkSearch, PluginArtworkSubagent, PluginArtworkTerminal, QuotePreview, ReadBlock, ReferenceChip, ReferenceIconMedium, ReferenceIconRegular, RiskConfirmation, SHIELD_OUTLINE_PATH, SearchBlock, SegmentedControl, SegmentedTabs, SettingsForm, SettingsFormModel, SettingsSecretField, SettingsValueField, ShortcutKeys, StateDot, Switch, Tag, TerminalBlock, TextShimmer, Toast, Tooltip, UserMessageBubble, UserTextRun, WebBlock, ZoomControls, classifyFileType, classifyLinkPath, closeTopModal, detailDocumentState, diffTotals, extractMarkdownPlainText, fileExtension, fileSizeText, focusWithoutRing, formatQuoteText, isBehindModal, isDarwinDesktop, isMobileDevice, languageForPath, modalSelector, observeComposition, observeStickyMenuGroups, pointerModality, rankByName, relativeTime, settingsNumberField, settingsTextField, useAnchoredMaxHeight, useClipboardCopy, useCodeHighlighter, useDetailDocumentLabels, useDismissOnOutsidePointer, useMarkdownDelegate, useModalLayer, usePointerGrace, useRowDragPreview, writeClipboard };
|
|
11825
12504
|
|
|
11826
12505
|
//# sourceMappingURL=index.js.map
|