@deepseek-ai/dsh-client-ui-primitives 0.2.2-alpha.3 → 0.2.2-rc.2
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 +1447 -776
- 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 +12 -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 +12 -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 +11 -8
- 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 +156 -0
- package/src/icons/index.tsx +634 -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,
|
|
@@ -531,6 +543,10 @@ function productIcon(glyph, weight) {
|
|
|
531
543
|
children: jsx("use", { href: `#${id}` })
|
|
532
544
|
});
|
|
533
545
|
}
|
|
546
|
+
/** Regular one-pixel IconLayersOutline artwork. */
|
|
547
|
+
const IconLayersOutlineRegular = productIcon("layers-outline", "regular");
|
|
548
|
+
/** Medium IconLayersOutline artwork with a 1.3px stroke. */
|
|
549
|
+
const IconLayersOutlineMedium = productIcon("layers-outline", "medium");
|
|
534
550
|
/** Regular one-pixel IconNewChatOutline artwork. */
|
|
535
551
|
const IconNewChatOutlineRegular = productIcon("new-chat-outline", "regular");
|
|
536
552
|
/** Medium IconNewChatOutline artwork with a 1.3px stroke. */
|
|
@@ -539,6 +555,14 @@ const IconNewChatOutlineMedium = productIcon("new-chat-outline", "medium");
|
|
|
539
555
|
const IconSearchOutlineRegular = productIcon("search-outline", "regular");
|
|
540
556
|
/** Medium IconSearchOutline artwork with a 1.3px stroke. */
|
|
541
557
|
const IconSearchOutlineMedium = productIcon("search-outline", "medium");
|
|
558
|
+
/** Regular one-pixel IconEyeOutline artwork. */
|
|
559
|
+
const IconEyeOutlineRegular = productIcon("eye-outline", "regular");
|
|
560
|
+
/** Medium IconEyeOutline artwork with a 1.3px stroke. */
|
|
561
|
+
const IconEyeOutlineMedium = productIcon("eye-outline", "medium");
|
|
562
|
+
/** Regular one-pixel IconEyeOffOutline artwork. */
|
|
563
|
+
const IconEyeOffOutlineRegular = productIcon("eye-off-outline", "regular");
|
|
564
|
+
/** Medium IconEyeOffOutline artwork with a 1.3px stroke. */
|
|
565
|
+
const IconEyeOffOutlineMedium = productIcon("eye-off-outline", "medium");
|
|
542
566
|
/** Regular one-pixel IconGlobeOutline artwork. */
|
|
543
567
|
const IconGlobeOutlineRegular = productIcon("globe-outline", "regular");
|
|
544
568
|
/** Medium IconGlobeOutline artwork with a 1.3px stroke. */
|
|
@@ -1116,11 +1140,21 @@ const ROW_GLIDE_MS = 200;
|
|
|
1116
1140
|
function sameRows(previous, next) {
|
|
1117
1141
|
return previous.rowKeys.length === next.rowKeys.length && previous.rowKeys.every((key, index) => key === next.rowKeys[index]);
|
|
1118
1142
|
}
|
|
1143
|
+
function visibleViewport(list) {
|
|
1144
|
+
const rect = list.getBoundingClientRect();
|
|
1145
|
+
return {
|
|
1146
|
+
top: Math.max(0, rect.top),
|
|
1147
|
+
bottom: Math.min(window.innerHeight, rect.bottom),
|
|
1148
|
+
left: Math.max(0, rect.left),
|
|
1149
|
+
right: Math.min(window.innerWidth, rect.right)
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1119
1152
|
function intersects(row, viewport) {
|
|
1120
1153
|
return row.bottom > viewport.top && row.top < viewport.bottom && row.right > viewport.left && row.left < viewport.right;
|
|
1121
1154
|
}
|
|
1122
1155
|
/**
|
|
1123
1156
|
* Animates keyed rows only when their rendered membership or order changes.
|
|
1157
|
+
* Rows must intersect both the list and the browser window before or after the commit.
|
|
1124
1158
|
* Motion starts after the first pointer or keyboard input inside the mounted list.
|
|
1125
1159
|
* The parent supplies a positioned container for the inert exit overlay.
|
|
1126
1160
|
*/
|
|
@@ -1133,7 +1167,7 @@ var AnimatedRows = class extends Component {
|
|
|
1133
1167
|
getSnapshotBeforeUpdate(previous) {
|
|
1134
1168
|
const list = this.list.current;
|
|
1135
1169
|
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
|
|
1170
|
+
const viewport = visibleViewport(list);
|
|
1137
1171
|
const positions = this.readPositions();
|
|
1138
1172
|
const nextKeys = new Set(this.props.rowKeys);
|
|
1139
1173
|
const removed = /* @__PURE__ */ new Map();
|
|
@@ -1149,6 +1183,7 @@ var AnimatedRows = class extends Component {
|
|
|
1149
1183
|
});
|
|
1150
1184
|
}
|
|
1151
1185
|
return {
|
|
1186
|
+
viewport,
|
|
1152
1187
|
positions,
|
|
1153
1188
|
removed
|
|
1154
1189
|
};
|
|
@@ -1161,13 +1196,13 @@ var AnimatedRows = class extends Component {
|
|
|
1161
1196
|
this.cancelMovements();
|
|
1162
1197
|
const list = this.list.current;
|
|
1163
1198
|
const overlay = this.overlay.current;
|
|
1164
|
-
const viewport = list
|
|
1199
|
+
const viewport = visibleViewport(list);
|
|
1165
1200
|
const origin = overlay.getBoundingClientRect();
|
|
1166
1201
|
const positions = this.readPositions();
|
|
1167
1202
|
for (const [key, row] of positions) {
|
|
1168
1203
|
this.removeExit(key);
|
|
1169
1204
|
const previousRow = snapshot.positions.get(key);
|
|
1170
|
-
if (!intersects(row.rect, viewport) && (previousRow === void 0 || !intersects(previousRow.rect, viewport))) continue;
|
|
1205
|
+
if (!intersects(row.rect, viewport) && (previousRow === void 0 || !intersects(previousRow.rect, snapshot.viewport))) continue;
|
|
1171
1206
|
if (previousRow === void 0) {
|
|
1172
1207
|
this.move(row.element, [{ opacity: 0 }, { opacity: 1 }], ROW_FADE_MS);
|
|
1173
1208
|
continue;
|
|
@@ -1365,137 +1400,18 @@ const Button = forwardRef(function Button({ variant = "ghost", size = "md", icon
|
|
|
1365
1400
|
}), children]
|
|
1366
1401
|
});
|
|
1367
1402
|
});
|
|
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
1403
|
/**
|
|
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`.
|
|
1404
|
+
* Report whether neither side of the parent card can hold the child card.
|
|
1405
|
+
* CSS anchors place the side card and flip it; this decision only selects the page layout.
|
|
1406
|
+
* @param parent - Parent card rectangle in client coordinates.
|
|
1407
|
+
* @param width - Natural child card width.
|
|
1408
|
+
* @param viewportWidth - Layout viewport width.
|
|
1409
|
+
* @returns true when the child must replace the parent page.
|
|
1379
1410
|
*/
|
|
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;
|
|
1411
|
+
function submenuNeedsPage(parent, width, viewportWidth) {
|
|
1412
|
+
const right = parent.right + 4 + width <= viewportWidth - 12;
|
|
1413
|
+
const left = parent.left - 4 - width >= 12;
|
|
1414
|
+
return !right && !left;
|
|
1499
1415
|
}
|
|
1500
1416
|
/**
|
|
1501
1417
|
* Delay a pointer-dismissed popup's close so the pointer can cross the gap
|
|
@@ -1527,339 +1443,265 @@ function usePointerGrace(close) {
|
|
|
1527
1443
|
};
|
|
1528
1444
|
}
|
|
1529
1445
|
//#endregion
|
|
1530
|
-
//#region lib/types/
|
|
1531
|
-
/**
|
|
1532
|
-
/**
|
|
1533
|
-
*
|
|
1534
|
-
* @
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1446
|
+
//#region lib/types/useMenuSubmenu.js
|
|
1447
|
+
/** Owns one menu's child layout mode, pointer grace, and focus transitions. */
|
|
1448
|
+
/** Whether a pointer event can request hover interactions.
|
|
1449
|
+
* @param event - current pointer, including mixed-input touch events.
|
|
1450
|
+
* @returns true for non-touch input with an available hover device.
|
|
1451
|
+
*/
|
|
1452
|
+
function menuHoverAllowed(event) {
|
|
1453
|
+
return event.pointerType !== "touch" && window.matchMedia("(any-hover: hover)").matches;
|
|
1454
|
+
}
|
|
1455
|
+
/** Manage a single child card without owning the root menu's document listeners.
|
|
1456
|
+
* @param options - current entries, root lifetime, and fallback focus destination.
|
|
1457
|
+
* @returns child rendering data and narrow interaction operations.
|
|
1458
|
+
*/
|
|
1459
|
+
function useMenuSubmenu(options) {
|
|
1460
|
+
const { open, items, footer, listRef, refocusAnchor } = options;
|
|
1461
|
+
const [expanded, setExpanded] = useState(null);
|
|
1462
|
+
const panelRef = useRef(null);
|
|
1463
|
+
const pendingFocus = useRef(null);
|
|
1464
|
+
const entry = [...items, ...footer ?? []].find((item) => !("type" in item) && item.id === expanded?.id && item.disabled !== true && item.submenu !== void 0 && item.submenu.length > 0);
|
|
1465
|
+
const trigger = expanded?.trigger ?? null;
|
|
1466
|
+
const parentAnchor = `--dsh-submenu-parent-${useId().replaceAll(":", "")}`;
|
|
1467
|
+
const [needsPage, setNeedsPage] = useState(null);
|
|
1468
|
+
const contains = (node) => panelRef.current?.contains(node) === true;
|
|
1469
|
+
const invalidated = expanded !== null && entry === void 0;
|
|
1470
|
+
const active = document.activeElement;
|
|
1471
|
+
const restoreInvalidatedFocus = open && invalidated && (contains(active) || trigger === active);
|
|
1472
|
+
const backWasFocused = contains(active) && active?.hasAttribute("data-menu-back") === true;
|
|
1473
|
+
const measured = needsPage !== null;
|
|
1474
|
+
const page = entry !== void 0 && expanded?.activated === true && needsPage === true;
|
|
1475
|
+
const hidden = !measured || needsPage && !page;
|
|
1476
|
+
const visible = open && entry !== void 0;
|
|
1477
|
+
useLayoutEffect(() => {
|
|
1478
|
+
const panel = panelRef.current;
|
|
1479
|
+
const parent = listRef.current;
|
|
1480
|
+
if (!visible || panel === null || parent === null || trigger === null) {
|
|
1481
|
+
setNeedsPage(null);
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
const measureRow = () => {
|
|
1485
|
+
panel.style.setProperty("--dsh-submenu-row-offset", `${trigger.getBoundingClientRect().top - parent.getBoundingClientRect().top}px`);
|
|
1486
|
+
};
|
|
1487
|
+
const measure = () => {
|
|
1488
|
+
const layout = panel.getAttribute("data-submenu-layout");
|
|
1489
|
+
panel.removeAttribute("data-submenu-layout");
|
|
1490
|
+
const width = panel.offsetWidth;
|
|
1491
|
+
panel.style.setProperty("--dsh-submenu-height", `${panel.offsetHeight}px`);
|
|
1492
|
+
if (layout !== null) panel.setAttribute("data-submenu-layout", layout);
|
|
1493
|
+
measureRow();
|
|
1494
|
+
const viewport = document.documentElement.clientWidth || window.innerWidth;
|
|
1495
|
+
setNeedsPage(submenuNeedsPage(parent.getBoundingClientRect(), width, viewport));
|
|
1496
|
+
};
|
|
1497
|
+
measure();
|
|
1498
|
+
window.addEventListener("resize", measure);
|
|
1499
|
+
parent.addEventListener("scroll", measureRow, true);
|
|
1500
|
+
const observer = new ResizeObserver(measure);
|
|
1501
|
+
for (const element of [
|
|
1502
|
+
parent,
|
|
1503
|
+
trigger,
|
|
1504
|
+
panel
|
|
1505
|
+
]) observer.observe(element);
|
|
1506
|
+
return () => {
|
|
1507
|
+
window.removeEventListener("resize", measure);
|
|
1508
|
+
parent.removeEventListener("scroll", measureRow, true);
|
|
1509
|
+
observer.disconnect();
|
|
1510
|
+
};
|
|
1511
|
+
}, [
|
|
1512
|
+
visible,
|
|
1513
|
+
entry,
|
|
1514
|
+
trigger,
|
|
1515
|
+
listRef
|
|
1516
|
+
]);
|
|
1517
|
+
const focusFirstChild = () => {
|
|
1518
|
+
const panel = panelRef.current;
|
|
1519
|
+
(panel?.querySelector("button[role=\"menuitem\"]:not(:disabled):not([data-menu-back])") ?? panel?.querySelector("button:not(:disabled)"))?.focus();
|
|
1542
1520
|
};
|
|
1543
|
-
const
|
|
1544
|
-
|
|
1545
|
-
|
|
1521
|
+
const returnToParent = () => {
|
|
1522
|
+
cancelClose();
|
|
1523
|
+
pendingFocus.current = trigger;
|
|
1524
|
+
setExpanded(null);
|
|
1546
1525
|
};
|
|
1547
|
-
const
|
|
1548
|
-
|
|
1526
|
+
const collapse = () => {
|
|
1527
|
+
cancelClose();
|
|
1528
|
+
if (contains(document.activeElement)) returnToParent();
|
|
1529
|
+
else setExpanded(null);
|
|
1549
1530
|
};
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1552
|
-
|
|
1531
|
+
const { arm: armClose, cancel: cancelClose } = usePointerGrace(() => {
|
|
1532
|
+
if (!page) collapse();
|
|
1533
|
+
});
|
|
1534
|
+
const openChild = (id, target, enter = false) => {
|
|
1535
|
+
cancelClose();
|
|
1536
|
+
if (trigger !== target && contains(document.activeElement)) {
|
|
1537
|
+
pendingFocus.current = target;
|
|
1538
|
+
target.focus();
|
|
1539
|
+
pendingFocus.current = null;
|
|
1540
|
+
}
|
|
1541
|
+
pendingFocus.current = enter ? "child" : null;
|
|
1542
|
+
setExpanded((current) => current?.id === id ? enter && !current.activated ? {
|
|
1543
|
+
...current,
|
|
1544
|
+
activated: true
|
|
1545
|
+
} : current : {
|
|
1546
|
+
id,
|
|
1547
|
+
trigger: target,
|
|
1548
|
+
activated: enter
|
|
1549
|
+
});
|
|
1550
|
+
if (enter) focusFirstChild();
|
|
1551
|
+
};
|
|
1552
|
+
useLayoutEffect(() => {
|
|
1553
|
+
if (!open || invalidated) {
|
|
1554
|
+
cancelClose();
|
|
1555
|
+
pendingFocus.current = null;
|
|
1556
|
+
setExpanded(null);
|
|
1557
|
+
if (restoreInvalidatedFocus && (document.activeElement === document.body || document.activeElement === trigger)) {
|
|
1558
|
+
const target = trigger?.isConnected === true && !trigger.disabled ? trigger : listRef.current?.querySelector("button:not(:disabled)");
|
|
1559
|
+
pendingFocus.current = target ?? null;
|
|
1560
|
+
if (target != null) target.focus();
|
|
1561
|
+
else refocusAnchor();
|
|
1562
|
+
pendingFocus.current = null;
|
|
1563
|
+
}
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1566
|
+
if (entry === void 0 && pendingFocus.current instanceof HTMLButtonElement) {
|
|
1567
|
+
pendingFocus.current.focus();
|
|
1568
|
+
pendingFocus.current = null;
|
|
1569
|
+
}
|
|
1570
|
+
if (entry === void 0 || hidden) return;
|
|
1571
|
+
if (pendingFocus.current === "child" || page && listRef.current?.contains(document.activeElement) || !page && backWasFocused) {
|
|
1572
|
+
focusFirstChild();
|
|
1573
|
+
pendingFocus.current = null;
|
|
1574
|
+
}
|
|
1575
|
+
}, [
|
|
1576
|
+
open,
|
|
1577
|
+
entry,
|
|
1578
|
+
needsPage,
|
|
1579
|
+
page,
|
|
1580
|
+
hidden,
|
|
1581
|
+
invalidated,
|
|
1582
|
+
restoreInvalidatedFocus,
|
|
1583
|
+
backWasFocused,
|
|
1584
|
+
cancelClose
|
|
1585
|
+
]);
|
|
1586
|
+
const collapseFrom = (event) => {
|
|
1587
|
+
const row = event.target.closest("button[role=\"menuitem\"]");
|
|
1588
|
+
if (row === null || row.getAttribute("aria-haspopup") === "menu") return;
|
|
1589
|
+
if (row.closest("[role=\"menu\"]") === event.currentTarget) collapse();
|
|
1553
1590
|
};
|
|
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
1591
|
return {
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1592
|
+
entry,
|
|
1593
|
+
panelRef,
|
|
1594
|
+
parentAnchor,
|
|
1595
|
+
measured,
|
|
1596
|
+
page,
|
|
1597
|
+
hidden,
|
|
1598
|
+
contains,
|
|
1599
|
+
activeList: (focused) => page || contains(focused) ? panelRef.current : listRef.current,
|
|
1600
|
+
returnToParent: () => {
|
|
1601
|
+
if (entry === void 0 || hidden) return false;
|
|
1602
|
+
returnToParent();
|
|
1603
|
+
return true;
|
|
1563
1604
|
},
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1605
|
+
openChild,
|
|
1606
|
+
focusParent: (id, target) => {
|
|
1607
|
+
if (pendingFocus.current !== target) openChild(id, target);
|
|
1608
|
+
},
|
|
1609
|
+
leave: () => {
|
|
1610
|
+
if (!page) armClose();
|
|
1611
|
+
},
|
|
1612
|
+
cancelClose,
|
|
1613
|
+
collapseFrom
|
|
1570
1614
|
};
|
|
1571
1615
|
}
|
|
1572
1616
|
//#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;
|
|
1617
|
+
//#region lib/types/ShortcutKeys.js
|
|
1618
|
+
/** Shared shortcut keycaps; callers supply the effective platform presentation. */
|
|
1586
1619
|
/**
|
|
1587
|
-
*
|
|
1588
|
-
*
|
|
1589
|
-
*
|
|
1590
|
-
* @returns true for recognized mobile devices; false for other devices, including unrecognized UAs.
|
|
1620
|
+
* Render one command's keycaps without owning binding defaults or localized copy.
|
|
1621
|
+
* @param props - effective key labels, presentation variant and optional interaction styling.
|
|
1622
|
+
* @returns unboxed keys by default, or tooltip keycaps with plus-separated combinations grouped together.
|
|
1591
1623
|
*/
|
|
1592
|
-
function
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1624
|
+
function ShortcutKeys({ keys, variant = "plain", className }) {
|
|
1625
|
+
return jsx("span", {
|
|
1626
|
+
className: clsx(css$7.keys, variant === "tooltip" && css$7.tooltip, variant === "tooltip" && keys.includes("+") && css$7.joined, className),
|
|
1627
|
+
children: keys.map((key, index) => jsx("kbd", {
|
|
1628
|
+
className: key === "+" ? css$7.separator : css$7.key,
|
|
1629
|
+
children: key
|
|
1630
|
+
}, index))
|
|
1631
|
+
});
|
|
1597
1632
|
}
|
|
1633
|
+
//#endregion
|
|
1634
|
+
//#region lib/types/tooltip-placement.js
|
|
1635
|
+
const opposite = {
|
|
1636
|
+
right: "left",
|
|
1637
|
+
left: "right",
|
|
1638
|
+
top: "bottom",
|
|
1639
|
+
bottom: "top"
|
|
1640
|
+
};
|
|
1598
1641
|
/**
|
|
1599
|
-
*
|
|
1600
|
-
*
|
|
1601
|
-
*
|
|
1602
|
-
* @param element - control or container receiving automatic focus.
|
|
1603
|
-
* @param options - browser focus options, including scroll preservation.
|
|
1642
|
+
* Prefer the requested side, its opposite, then perpendicular sides without covering the anchor.
|
|
1643
|
+
* @param input - Observed dimensions, anchor edges, viewport and requested placement; horizontal gaps remain 10px.
|
|
1644
|
+
* @returns Border-box coordinates and the selected side; if no side fits, a viewport-bounded fallback.
|
|
1604
1645
|
*/
|
|
1605
|
-
function
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1646
|
+
function placeTooltip(input) {
|
|
1647
|
+
const { anchor, viewportWidth, viewportHeight, side, align, gap } = input;
|
|
1648
|
+
let { width, height } = input;
|
|
1649
|
+
const margin = 12;
|
|
1650
|
+
const maxWidth = Math.max(0, viewportWidth - margin * 2);
|
|
1651
|
+
const maxHeight = Math.max(0, viewportHeight - margin * 2);
|
|
1652
|
+
width = Math.min(width, maxWidth);
|
|
1653
|
+
height = Math.min(height, maxHeight);
|
|
1654
|
+
const clampX = (x) => Math.max(margin, Math.min(x, viewportWidth - margin - width));
|
|
1655
|
+
const clampY = (y) => Math.max(margin, Math.min(y, viewportHeight - margin - height));
|
|
1656
|
+
const horizontal = side === "right" || side === "left";
|
|
1657
|
+
const candidates = [
|
|
1658
|
+
side,
|
|
1659
|
+
opposite[side],
|
|
1660
|
+
...horizontal ? ["bottom", "top"] : ["right", "left"]
|
|
1661
|
+
];
|
|
1662
|
+
const positions = {
|
|
1663
|
+
right: {
|
|
1664
|
+
left: anchor.right + 10,
|
|
1665
|
+
top: clampY((anchor.top + anchor.bottom - height) / 2)
|
|
1666
|
+
},
|
|
1667
|
+
left: {
|
|
1668
|
+
left: anchor.left - 10 - width,
|
|
1669
|
+
top: clampY((anchor.top + anchor.bottom - height) / 2)
|
|
1670
|
+
},
|
|
1671
|
+
bottom: {
|
|
1672
|
+
left: clampX(align === "end" ? anchor.right - width : (anchor.left + anchor.right - width) / 2),
|
|
1673
|
+
top: anchor.bottom + gap
|
|
1674
|
+
},
|
|
1675
|
+
top: {
|
|
1676
|
+
left: clampX(align === "end" ? anchor.right - width : (anchor.left + anchor.right - width) / 2),
|
|
1677
|
+
top: anchor.top - gap - height
|
|
1678
|
+
}
|
|
1612
1679
|
};
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1680
|
+
for (const candidate of candidates) {
|
|
1681
|
+
const position = positions[candidate];
|
|
1682
|
+
if (position.left >= margin && position.top >= margin && position.left + width <= viewportWidth - margin && position.top + height <= viewportHeight - margin) return {
|
|
1683
|
+
...position,
|
|
1684
|
+
side: candidate,
|
|
1685
|
+
width,
|
|
1686
|
+
height,
|
|
1687
|
+
overflow: false
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
const position = positions[side];
|
|
1691
|
+
return {
|
|
1692
|
+
left: clampX(position.left),
|
|
1693
|
+
top: clampY(position.top),
|
|
1694
|
+
side,
|
|
1695
|
+
width,
|
|
1696
|
+
height,
|
|
1697
|
+
overflow: true
|
|
1615
1698
|
};
|
|
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
1699
|
}
|
|
1623
1700
|
//#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();
|
|
1701
|
+
//#region lib/types/useDismissOnOutsidePointer.js
|
|
1629
1702
|
/**
|
|
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.
|
|
1703
|
+
* Outside-pointer dismissal for trigger-owned popovers (jobs list, Cordis
|
|
1704
|
+
* panel): while the surface is open, a pointerdown outside the root closes it.
|
|
1863
1705
|
*/
|
|
1864
1706
|
/**
|
|
1865
1707
|
* Close an open popover when a pointerdown lands outside its root element.
|
|
@@ -2152,7 +1994,7 @@ function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayM
|
|
|
2152
1994
|
const content = visible && !suppressed && jsxs("span", {
|
|
2153
1995
|
ref: bubble,
|
|
2154
1996
|
id: openOnClick ? id : void 0,
|
|
2155
|
-
className: css$
|
|
1997
|
+
className: css$8.bubble,
|
|
2156
1998
|
"data-side": side,
|
|
2157
1999
|
"data-portal": portal || void 0,
|
|
2158
2000
|
"data-pinned": pinned || void 0,
|
|
@@ -2167,7 +2009,7 @@ function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayM
|
|
|
2167
2009
|
role: "tooltip",
|
|
2168
2010
|
"aria-label": shortcutKeys?.length ? [resolvedLabel, shortcutKeys.join(" ")].filter(Boolean).join(" ") : void 0,
|
|
2169
2011
|
children: [resolvedLabel && jsx("span", {
|
|
2170
|
-
className: css$
|
|
2012
|
+
className: css$8.label,
|
|
2171
2013
|
children: resolvedLabel
|
|
2172
2014
|
}), shortcutKeys !== void 0 && shortcutKeys.length > 0 && jsx(ShortcutKeys, {
|
|
2173
2015
|
keys: shortcutKeys,
|
|
@@ -2220,32 +2062,21 @@ function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayM
|
|
|
2220
2062
|
});
|
|
2221
2063
|
}
|
|
2222
2064
|
//#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.
|
|
2065
|
+
//#region lib/types/MenuRow.js
|
|
2066
|
+
/** Package-internal row presentation shared by component, data, and child menu entries. */
|
|
2067
|
+
/** Render a focus-stable row with optional selection, shortcut, and disabled explanation.
|
|
2068
|
+
* @param props - row content, native button events, and optional pointer wrapper events.
|
|
2069
|
+
* @returns one menu item; explained disabled rows remain focusable but never activate.
|
|
2240
2070
|
*/
|
|
2241
|
-
function
|
|
2071
|
+
function MenuRow({ children, icon, shortcut, current, disabled = false, disabledReason, danger, separatorBefore, selected, selection = "check", reserveIcon, decorativeIcon = true, wrapperProps, ...button }) {
|
|
2242
2072
|
const reasonId = useId();
|
|
2243
2073
|
const explained = disabled && disabledReason !== void 0;
|
|
2244
2074
|
return jsxs("div", {
|
|
2245
|
-
|
|
2075
|
+
...wrapperProps,
|
|
2076
|
+
className: css$9.itemWrap,
|
|
2246
2077
|
children: [
|
|
2247
2078
|
separatorBefore && jsx("div", {
|
|
2248
|
-
className: css$
|
|
2079
|
+
className: css$9.separator,
|
|
2249
2080
|
role: "separator"
|
|
2250
2081
|
}),
|
|
2251
2082
|
jsx(Tooltip, {
|
|
@@ -2256,31 +2087,38 @@ function MenuItemButton({ children, shortcut, icon, current, disabled = false, d
|
|
|
2256
2087
|
maxWidth: 300,
|
|
2257
2088
|
portal: true,
|
|
2258
2089
|
children: jsxs("button", {
|
|
2090
|
+
...button,
|
|
2259
2091
|
type: "button",
|
|
2260
2092
|
role: "menuitem",
|
|
2261
|
-
className: clsx(css$
|
|
2093
|
+
className: clsx(css$9.item, selected && (selection === "fill" ? css$9.selectedFill : css$9.selected), danger && css$9.danger),
|
|
2262
2094
|
disabled: disabled && !explained,
|
|
2263
2095
|
"aria-disabled": explained || void 0,
|
|
2264
2096
|
"aria-describedby": explained ? reasonId : void 0,
|
|
2265
2097
|
"aria-keyshortcuts": shortcut?.aria,
|
|
2266
2098
|
"aria-current": current === true ? "page" : void 0,
|
|
2267
|
-
onClick: explained ? void 0 :
|
|
2099
|
+
onClick: explained ? void 0 : button.onClick,
|
|
2268
2100
|
children: [
|
|
2269
|
-
icon !== void 0 && jsx("span", {
|
|
2270
|
-
|
|
2101
|
+
(icon !== void 0 || reserveIcon) && jsx("span", {
|
|
2102
|
+
"aria-hidden": decorativeIcon || void 0,
|
|
2103
|
+
className: css$9.itemIcon,
|
|
2271
2104
|
children: icon
|
|
2272
2105
|
}),
|
|
2273
2106
|
jsx("span", {
|
|
2274
|
-
className: css$
|
|
2107
|
+
className: css$9.itemLabel,
|
|
2275
2108
|
children
|
|
2276
2109
|
}),
|
|
2277
2110
|
shortcut !== void 0 && jsx("span", {
|
|
2278
2111
|
"aria-hidden": "true",
|
|
2279
|
-
className: css$
|
|
2112
|
+
className: css$9.shortcut,
|
|
2280
2113
|
children: jsx(ShortcutKeys, {
|
|
2281
2114
|
keys: shortcut.keys,
|
|
2282
|
-
className: css$
|
|
2115
|
+
className: css$9.shortcutKeys
|
|
2283
2116
|
})
|
|
2117
|
+
}),
|
|
2118
|
+
selected && selection === "check" && jsx(IconCheckOutlineRegular, { className: css$9.check }),
|
|
2119
|
+
button["aria-haspopup"] === "menu" && jsx(IconChevronRightOutlineRegular, {
|
|
2120
|
+
"aria-hidden": "true",
|
|
2121
|
+
className: css$9.check
|
|
2284
2122
|
})
|
|
2285
2123
|
]
|
|
2286
2124
|
})
|
|
@@ -2293,46 +2131,391 @@ function MenuItemButton({ children, shortcut, icon, current, disabled = false, d
|
|
|
2293
2131
|
]
|
|
2294
2132
|
});
|
|
2295
2133
|
}
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
/** Mark icon columns within each separator-delimited data group. */
|
|
2303
|
-
function iconColumns(entries, contextual) {
|
|
2134
|
+
/** Mark icon columns within each separator-delimited data group.
|
|
2135
|
+
* @param entries - entries in one menu area.
|
|
2136
|
+
* @param contextual - whether to align grouped context-menu icons.
|
|
2137
|
+
* @returns entries that reserve a leading icon column.
|
|
2138
|
+
*/
|
|
2139
|
+
function menuIconColumns(entries, contextual) {
|
|
2304
2140
|
const aligned = /* @__PURE__ */ new Set();
|
|
2305
2141
|
if (!contextual) return aligned;
|
|
2306
2142
|
let group = [];
|
|
2307
2143
|
const finish = () => {
|
|
2308
|
-
if (group.some((entry) => !
|
|
2144
|
+
if (group.some((entry) => !("type" in entry) && entry.icon !== void 0)) for (const entry of group) aligned.add(entry);
|
|
2309
2145
|
group = [];
|
|
2310
2146
|
};
|
|
2311
|
-
for (const entry of entries) if (
|
|
2147
|
+
for (const entry of entries) if ("type" in entry && entry.type === "separator") finish();
|
|
2312
2148
|
else group.push(entry);
|
|
2313
2149
|
finish();
|
|
2314
2150
|
return aligned;
|
|
2315
2151
|
}
|
|
2316
|
-
/**
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2152
|
+
/** Render a separator or group heading outside the keyboard walk.
|
|
2153
|
+
* @param entry - non-interactive menu entry.
|
|
2154
|
+
* @returns the corresponding element.
|
|
2155
|
+
*/
|
|
2156
|
+
function renderMenuDecoration(entry) {
|
|
2157
|
+
return entry.type === "separator" ? jsx("div", {
|
|
2158
|
+
className: css$9.separator,
|
|
2159
|
+
role: "separator"
|
|
2160
|
+
}, entry.id) : jsx("div", {
|
|
2161
|
+
className: css$9.label,
|
|
2162
|
+
role: "presentation",
|
|
2163
|
+
children: entry.text
|
|
2164
|
+
}, entry.id);
|
|
2165
|
+
}
|
|
2166
|
+
//#endregion
|
|
2167
|
+
//#region lib/types/MenuSurface.js
|
|
2168
|
+
/** Shared menu material and the macOS backing that lets Chromium blur transparent windows. */
|
|
2169
|
+
/** Context-menu transition durations in milliseconds, shared with its lifecycle owner. */
|
|
2170
|
+
const MENU_TRANSITION_MS = Object.freeze({
|
|
2171
|
+
enter: 40,
|
|
2172
|
+
dismiss: 80,
|
|
2173
|
+
replace: 10,
|
|
2174
|
+
prepare: 20
|
|
2175
|
+
});
|
|
2176
|
+
/**
|
|
2177
|
+
* Paint a menu and, on macOS, an opaque backing behind the page content within its bounds.
|
|
2178
|
+
* CSS anchors keep each backing aligned during placement, resizing, and nested-menu movement.
|
|
2179
|
+
* @param props - Div content and placement, and compact geometry.
|
|
2180
|
+
* @param ref - The visible menu div, excluding the non-interactive backing.
|
|
2181
|
+
* @returns Menu content plus a backing portal removed with the menu.
|
|
2182
|
+
*/
|
|
2183
|
+
const MenuSurface = forwardRef(function MenuSurface({ compact = false, phase, className, style, children, ...props }, ref) {
|
|
2184
|
+
const id = useId();
|
|
2185
|
+
const backingRef = useRef(null);
|
|
2186
|
+
useLayoutEffect(() => {
|
|
2187
|
+
document.body.appendChild(backingRef.current);
|
|
2188
|
+
}, []);
|
|
2189
|
+
const anchorStyle = {
|
|
2190
|
+
"--dsh-menu-anchor": `--dsh-menu-${id.replaceAll(":", "")}`,
|
|
2191
|
+
"--dsh-menu-enter": `${MENU_TRANSITION_MS.enter}ms`,
|
|
2192
|
+
"--dsh-menu-dismiss": `${MENU_TRANSITION_MS.dismiss}ms`,
|
|
2193
|
+
"--dsh-menu-replace": `${MENU_TRANSITION_MS.replace}ms`
|
|
2194
|
+
};
|
|
2195
|
+
return jsxs(Fragment, { children: [jsxs("div", {
|
|
2196
|
+
...props,
|
|
2197
|
+
ref,
|
|
2198
|
+
"data-menu-material": "translucent",
|
|
2199
|
+
"data-menu-phase": phase,
|
|
2200
|
+
className: clsx(css$10.surface, compact && css$10.compact, className),
|
|
2201
|
+
style: {
|
|
2202
|
+
...style,
|
|
2203
|
+
...anchorStyle
|
|
2204
|
+
},
|
|
2205
|
+
children: [jsx("div", {
|
|
2206
|
+
"aria-hidden": "true",
|
|
2207
|
+
className: css$10.material
|
|
2208
|
+
}), children]
|
|
2209
|
+
}), createPortal(jsx("div", {
|
|
2210
|
+
ref: backingRef,
|
|
2211
|
+
"aria-hidden": "true",
|
|
2212
|
+
"data-menu-backing": "",
|
|
2213
|
+
"data-menu-phase": phase,
|
|
2214
|
+
className: clsx(css$10.backing, compact && css$10.compact),
|
|
2215
|
+
style: {
|
|
2216
|
+
...anchorStyle,
|
|
2217
|
+
visibility: style?.visibility
|
|
2218
|
+
}
|
|
2219
|
+
}), document.body)] });
|
|
2220
|
+
});
|
|
2221
|
+
//#endregion
|
|
2222
|
+
//#region lib/types/SubmenuPanel.js
|
|
2223
|
+
/** Name the parent card anchor, and hide the child card until its layout is known. */
|
|
2224
|
+
function anchors(submenu, hidden) {
|
|
2225
|
+
return {
|
|
2226
|
+
"--dsh-submenu-parent": submenu.parentAnchor,
|
|
2227
|
+
...hidden ? { visibility: "hidden" } : {}
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
/** Render one child list with a non-selecting back row in single-page placement.
|
|
2231
|
+
* @param props - active entry, submenu operations, and shared row presentation options.
|
|
2232
|
+
* @returns a body portal that preserves child DOM identity across placement changes.
|
|
2233
|
+
*/
|
|
2234
|
+
function SubmenuPanel({ entry, submenu, compact, dense, contextual, backLabel, onSelect, onClose, afterSelection }) {
|
|
2235
|
+
const columns = menuIconColumns(entry.submenu, contextual);
|
|
2236
|
+
return createPortal(jsxs(MenuSurface, {
|
|
2237
|
+
ref: submenu.panelRef,
|
|
2238
|
+
compact,
|
|
2239
|
+
className: clsx(css$9.submenu, css$9.scrollable, dense && css$9.denseList, compact && css$9.compactList),
|
|
2240
|
+
style: anchors(submenu, submenu.hidden),
|
|
2241
|
+
"data-submenu-layout": submenu.measured ? submenu.page ? "page" : "side" : void 0,
|
|
2242
|
+
"data-contextual": contextual ? "" : void 0,
|
|
2243
|
+
role: "menu",
|
|
2244
|
+
onPointerEnter: submenu.cancelClose,
|
|
2245
|
+
onPointerLeave: (event) => {
|
|
2246
|
+
if (menuHoverAllowed(event)) submenu.leave();
|
|
2247
|
+
},
|
|
2248
|
+
onContextMenu: contextual ? (event) => {
|
|
2249
|
+
event.preventDefault();
|
|
2250
|
+
event.stopPropagation();
|
|
2251
|
+
onClose();
|
|
2252
|
+
} : void 0,
|
|
2253
|
+
onClick: (event) => {
|
|
2254
|
+
event.stopPropagation();
|
|
2255
|
+
afterSelection();
|
|
2256
|
+
},
|
|
2257
|
+
children: [submenu.page && jsxs(Fragment, { children: [jsx(MenuRow, {
|
|
2258
|
+
"data-menu-back": "",
|
|
2259
|
+
icon: jsx(IconChevronLeftOutlineRegular, { className: css$9.check }),
|
|
2260
|
+
onClick: submenu.returnToParent,
|
|
2261
|
+
children: backLabel
|
|
2262
|
+
}), jsx("div", {
|
|
2263
|
+
className: css$9.separator,
|
|
2264
|
+
role: "separator"
|
|
2265
|
+
})] }), jsx("div", {
|
|
2266
|
+
className: css$9.viewport,
|
|
2267
|
+
role: "presentation",
|
|
2268
|
+
children: entry.submenu.map((sub) => "type" in sub ? renderMenuDecoration(sub) : jsx(MenuRow, {
|
|
2269
|
+
icon: sub.icon,
|
|
2270
|
+
reserveIcon: columns.has(sub),
|
|
2271
|
+
disabled: sub.disabled,
|
|
2272
|
+
danger: sub.danger,
|
|
2273
|
+
shortcut: sub.shortcut,
|
|
2274
|
+
onClick: () => {
|
|
2275
|
+
onSelect?.(sub.id);
|
|
2276
|
+
},
|
|
2277
|
+
children: sub.label
|
|
2278
|
+
}, sub.id))
|
|
2279
|
+
})]
|
|
2280
|
+
}), document.body);
|
|
2281
|
+
}
|
|
2282
|
+
//#endregion
|
|
2283
|
+
//#region lib/types/keyboard-composition.js
|
|
2284
|
+
/** Composition lifetime for local keyboard handlers, including a late closing keydown. */
|
|
2285
|
+
/**
|
|
2286
|
+
* Observe composition until its closing key is released or consumed.
|
|
2287
|
+
* @param document - document whose input events belong to the caller.
|
|
2288
|
+
* @returns an event guard and a disposer for all listeners.
|
|
2289
|
+
*/
|
|
2290
|
+
function observeComposition(document) {
|
|
2291
|
+
let composing = false;
|
|
2292
|
+
let ended = false;
|
|
2293
|
+
const start = () => {
|
|
2294
|
+
composing = true;
|
|
2295
|
+
};
|
|
2296
|
+
const end = () => {
|
|
2297
|
+
composing = false;
|
|
2298
|
+
ended = true;
|
|
2299
|
+
};
|
|
2300
|
+
const release = () => {
|
|
2301
|
+
ended = false;
|
|
2302
|
+
};
|
|
2303
|
+
const blur = () => {
|
|
2304
|
+
composing = false;
|
|
2305
|
+
ended = false;
|
|
2306
|
+
};
|
|
2307
|
+
document.addEventListener("compositionstart", start, true);
|
|
2308
|
+
document.addEventListener("compositionend", end, true);
|
|
2309
|
+
document.addEventListener("keyup", release, true);
|
|
2310
|
+
document.defaultView?.addEventListener("blur", blur);
|
|
2311
|
+
return {
|
|
2312
|
+
guards: (event) => {
|
|
2313
|
+
const guarded = composing || ended || event.isComposing || event.keyCode === 229;
|
|
2314
|
+
ended = false;
|
|
2315
|
+
return guarded;
|
|
2316
|
+
},
|
|
2317
|
+
dispose: () => {
|
|
2318
|
+
document.removeEventListener("compositionstart", start, true);
|
|
2319
|
+
document.removeEventListener("compositionend", end, true);
|
|
2320
|
+
document.removeEventListener("keyup", release, true);
|
|
2321
|
+
document.defaultView?.removeEventListener("blur", blur);
|
|
2322
|
+
}
|
|
2323
|
+
};
|
|
2324
|
+
}
|
|
2325
|
+
//#endregion
|
|
2326
|
+
//#region lib/types/focus.js
|
|
2327
|
+
/** Mobile-device detection and automatic focus presentation. */
|
|
2328
|
+
const releases = /* @__PURE__ */ new WeakMap();
|
|
2329
|
+
const navigationKeys = new Set([
|
|
2330
|
+
"Tab",
|
|
2331
|
+
"ArrowUp",
|
|
2332
|
+
"ArrowDown",
|
|
2333
|
+
"ArrowLeft",
|
|
2334
|
+
"ArrowRight",
|
|
2335
|
+
"Home",
|
|
2336
|
+
"End"
|
|
2337
|
+
]);
|
|
2338
|
+
let mobileDevice;
|
|
2339
|
+
/**
|
|
2340
|
+
* Identify iOS and Android phones and tablets from the current browser's device information.
|
|
2341
|
+
* MacIntel with multiple touch points identifies desktop-mode iPads.
|
|
2342
|
+
* The first result is shared by all callers until the page reloads.
|
|
2343
|
+
* @returns true for recognized mobile devices; false for other devices, including unrecognized UAs.
|
|
2344
|
+
*/
|
|
2345
|
+
function isMobileDevice() {
|
|
2346
|
+
if (mobileDevice !== void 0) return mobileDevice;
|
|
2347
|
+
const { userAgent, platform, maxTouchPoints } = navigator;
|
|
2348
|
+
mobileDevice = /Android|iPhone|iPad|iPod/i.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
|
|
2349
|
+
return mobileDevice;
|
|
2350
|
+
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Focus an automatic destination without a focus outline until keyboard navigation or blur.
|
|
2353
|
+
* The theme suppresses outlines while data-dsh-automatic-focus is present; borders and shadows remain intact.
|
|
2354
|
+
* Tab and directional navigation restore normal focus styling.
|
|
2355
|
+
* @param element - control or container receiving automatic focus.
|
|
2356
|
+
* @param options - browser focus options, including scroll preservation.
|
|
2357
|
+
*/
|
|
2358
|
+
function focusWithoutRing(element, options) {
|
|
2359
|
+
releases.get(element)?.();
|
|
2360
|
+
const release = () => {
|
|
2361
|
+
element.removeAttribute("data-dsh-automatic-focus");
|
|
2362
|
+
element.removeEventListener("blur", release);
|
|
2363
|
+
element.removeEventListener("keydown", navigate, true);
|
|
2364
|
+
releases.delete(element);
|
|
2365
|
+
};
|
|
2366
|
+
const navigate = (event) => {
|
|
2367
|
+
if (!event.isComposing && !event.ctrlKey && !event.altKey && !event.metaKey && navigationKeys.has(event.key)) release();
|
|
2368
|
+
};
|
|
2369
|
+
releases.set(element, release);
|
|
2370
|
+
element.setAttribute("data-dsh-automatic-focus", "");
|
|
2371
|
+
element.addEventListener("blur", release);
|
|
2372
|
+
element.addEventListener("keydown", navigate, true);
|
|
2373
|
+
element.focus(options);
|
|
2374
|
+
if (!element.matches(":focus")) release();
|
|
2375
|
+
}
|
|
2376
|
+
//#endregion
|
|
2377
|
+
//#region lib/types/useModalLayer.js
|
|
2378
|
+
/** Shared modal keyboard ownership and focus lifetime. */
|
|
2379
|
+
/** Dialog and menu elements whose document order determines foreground shortcut ownership. */
|
|
2380
|
+
const modalSelector = "[role=\"dialog\"][aria-modal=\"true\"], [role=\"menu\"]";
|
|
2381
|
+
const layers = /* @__PURE__ */ new WeakMap();
|
|
2382
|
+
/**
|
|
2383
|
+
* Request closure of the foreground registered modal using its current onClose callback.
|
|
2384
|
+
* A newer menu or unregistered dialog blocks dismissal of the modal behind it.
|
|
2385
|
+
* @param document - product document whose modal owns the close command.
|
|
2386
|
+
*/
|
|
2387
|
+
function closeTopModal(document) {
|
|
2388
|
+
const top = layers.get(document)?.at(-1);
|
|
2389
|
+
if (top === void 0) return;
|
|
2390
|
+
if ([...document.querySelectorAll("[role=\"dialog\"][aria-modal=\"true\"], [role=\"menu\"]")].at(-1) === top.element) top.close();
|
|
2391
|
+
}
|
|
2392
|
+
/**
|
|
2393
|
+
* Whether an anchor belongs behind the current modal and must yield keyboard input.
|
|
2394
|
+
* @param anchor - local control owning the input handler.
|
|
2395
|
+
* @returns true when another modal owns the foreground.
|
|
2396
|
+
*/
|
|
2397
|
+
function isBehindModal(anchor) {
|
|
2398
|
+
if (anchor === null) return false;
|
|
2399
|
+
const top = layers.get(anchor.ownerDocument)?.at(-1);
|
|
2400
|
+
return top !== void 0 && !top.element.contains(anchor);
|
|
2401
|
+
}
|
|
2402
|
+
const focusable = "button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), a[href], [tabindex=\"0\"]";
|
|
2403
|
+
/**
|
|
2404
|
+
* Give only the top modal Escape and Tab ownership, then restore its previous focus.
|
|
2405
|
+
* Automatic entry and return focus omit outlines; keyboard traversal retains its indicators.
|
|
2406
|
+
* Controls mounted with the dialog use data-modal-autofocus for initial focus;
|
|
2407
|
+
* React autoFocus runs before this layer can capture the invoking control.
|
|
2408
|
+
* Local menus handle their Escape during capture before this bubble listener.
|
|
2409
|
+
* @param dialog - mounted dialog element.
|
|
2410
|
+
* @param open - whether this layer is active.
|
|
2411
|
+
* @param onClose - top-layer Escape or application close action.
|
|
2412
|
+
*/
|
|
2413
|
+
function useModalLayer(dialog, open, onClose) {
|
|
2414
|
+
const close = useRef(onClose);
|
|
2415
|
+
const pendingRestore = useRef(void 0);
|
|
2416
|
+
close.current = onClose;
|
|
2417
|
+
useLayoutEffect(() => {
|
|
2418
|
+
const target = pendingRestore.current;
|
|
2419
|
+
pendingRestore.current = void 0;
|
|
2420
|
+
const element = dialog.current;
|
|
2421
|
+
if (!open && element?.contains(element.ownerDocument.activeElement) && target?.isConnected && !target.closest("[inert], [hidden]") && !isBehindModal(target)) focusWithoutRing(target, { preventScroll: true });
|
|
2422
|
+
if (!open || element === null) return;
|
|
2423
|
+
const document = element.ownerDocument;
|
|
2424
|
+
const composition = observeComposition(document);
|
|
2425
|
+
const previous = document.activeElement;
|
|
2426
|
+
const stack = layers.get(document) ?? [];
|
|
2427
|
+
layers.set(document, stack);
|
|
2428
|
+
const layer = {
|
|
2429
|
+
element,
|
|
2430
|
+
close: () => {
|
|
2431
|
+
close.current();
|
|
2432
|
+
}
|
|
2433
|
+
};
|
|
2434
|
+
stack.push(layer);
|
|
2435
|
+
const initial = element.querySelector("[data-modal-autofocus]") ?? element.querySelector(focusable) ?? element;
|
|
2436
|
+
if (!element.contains(document.activeElement)) focusWithoutRing(initial);
|
|
2437
|
+
const keydown = (event) => {
|
|
2438
|
+
const composing = composition.guards(event);
|
|
2439
|
+
if (stack.at(-1) !== layer || event.defaultPrevented || composing || event.ctrlKey || event.altKey || event.metaKey) return;
|
|
2440
|
+
if (event.key === "Escape" && !event.shiftKey) {
|
|
2441
|
+
event.preventDefault();
|
|
2442
|
+
if (!event.repeat) close.current();
|
|
2443
|
+
}
|
|
2444
|
+
if (event.key !== "Tab") return;
|
|
2445
|
+
if (document.activeElement?.closest("[role=\"menu\"]")) return;
|
|
2446
|
+
const items = [...element.querySelectorAll(focusable)].filter((item) => !item.closest("[inert], [hidden]"));
|
|
2447
|
+
const first = items[0] ?? element;
|
|
2448
|
+
const last = items.at(-1) ?? element;
|
|
2449
|
+
const atEdge = event.shiftKey ? document.activeElement === first : document.activeElement === last;
|
|
2450
|
+
if (document.activeElement === element || !element.contains(document.activeElement) || atEdge) {
|
|
2451
|
+
event.preventDefault();
|
|
2452
|
+
(event.shiftKey ? last : first).focus();
|
|
2453
|
+
}
|
|
2454
|
+
};
|
|
2455
|
+
document.addEventListener("keydown", keydown);
|
|
2456
|
+
return () => {
|
|
2457
|
+
composition.dispose();
|
|
2458
|
+
const wasTop = stack.at(-1) === layer;
|
|
2459
|
+
stack.splice(stack.indexOf(layer), 1);
|
|
2460
|
+
document.removeEventListener("keydown", keydown);
|
|
2461
|
+
if (stack.length === 0) layers.delete(document);
|
|
2462
|
+
if (wasTop) {
|
|
2463
|
+
const target = previous instanceof HTMLElement && previous.isConnected ? previous : stack.at(-1)?.element;
|
|
2464
|
+
if (target !== void 0) {
|
|
2465
|
+
pendingRestore.current = target;
|
|
2466
|
+
focusWithoutRing(target);
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
};
|
|
2470
|
+
}, [dialog, open]);
|
|
2471
|
+
}
|
|
2472
|
+
//#endregion
|
|
2473
|
+
//#region lib/types/Menu.js
|
|
2474
|
+
/**
|
|
2475
|
+
* Render one `role="menuitem"` row for a {@link Menu} whose rows are
|
|
2476
|
+
* components rather than `items` data: the same markup and styling as a data
|
|
2477
|
+
* row, so it joins the list's keyboard walk and post-selection focus return
|
|
2478
|
+
* without any shared state. Closing the menu stays the owner's decision, as
|
|
2479
|
+
* it is for data rows.
|
|
2480
|
+
* @param props.children - visible row label.
|
|
2481
|
+
* @param props.shortcut - effective key labels and accessible combination.
|
|
2482
|
+
* @param props.icon - optional leading icon.
|
|
2483
|
+
* @param props.current - whether the row identifies the currently displayed page or view.
|
|
2484
|
+
* @param props.disabled - whether the row cannot be activated.
|
|
2485
|
+
* @param props.disabledReason - why a disabled row cannot be activated, shown in a tooltip and read as its description.
|
|
2486
|
+
* @param props.danger - whether to use the destructive row colors.
|
|
2487
|
+
* @param props.separatorBefore - whether this row starts a new group (hairline above it).
|
|
2488
|
+
* @param props.onSelect - row activation callback.
|
|
2489
|
+
* @returns one menu-item row.
|
|
2490
|
+
*/
|
|
2491
|
+
function MenuItemButton({ onSelect, ...props }) {
|
|
2492
|
+
return jsx(MenuRow, {
|
|
2493
|
+
...props,
|
|
2494
|
+
decorativeIcon: false,
|
|
2495
|
+
onClick: onSelect
|
|
2496
|
+
});
|
|
2497
|
+
}
|
|
2498
|
+
/**
|
|
2499
|
+
* Render an anchored dropdown menu. While the list is open its keys mirror the
|
|
2500
|
+
* composer's: Tab settles the focused row — from the trigger, Tab enters the
|
|
2501
|
+
* list instead — and Escape or Shift+Tab close it and return focus to the
|
|
2502
|
+
* anchor's first button, and selecting a row does the same — the rows unmount
|
|
2503
|
+
* with the list. Only a keyboard on the trigger or inside the list is
|
|
2504
|
+
* intercepted; Tab presses elsewhere on the page stay the browser's. Escape
|
|
2505
|
+
* first returns from a visible child, while ArrowRight enters and ArrowLeft returns.
|
|
2506
|
+
* When neither side fits, click or ArrowRight opens a single-panel child page;
|
|
2507
|
+
* focus alone retains the parent page.
|
|
2508
|
+
* @param props.contextual - cursor positioning, context dismissal, and per-divider icon alignment.
|
|
2509
|
+
* @param props.exiting - retain an inert popup during dismissal or replacement fade.
|
|
2331
2510
|
* @param props.returnFocus - original control captured before asynchronous menu preparation.
|
|
2511
|
+
* @param props.isExternalTrigger - recognizes external controls whose pointer presses should not dismiss;
|
|
2512
|
+
* omitted, every press outside the anchor and menu panels dismisses.
|
|
2332
2513
|
* @param props.autoFocus - focus the first item on open; the arrow keys walk the list either way.
|
|
2333
2514
|
* @param props.open - whether the list is showing (owner-controlled).
|
|
2334
2515
|
* @param props.anchor - the trigger element (rendered in place).
|
|
2335
2516
|
* @param props.items - selectable data rows and optional separators (default none; with no `children` either, the list is empty).
|
|
2517
|
+
* @param props.submenuBackLabel - localized single-panel return label; omitted uses the caller's
|
|
2518
|
+
* parent-row label beside a back arrow, without selecting that row.
|
|
2336
2519
|
* @param props.selectedId - row shown as selected.
|
|
2337
2520
|
* @param props.selectedIds - rows shown as selected when a menu contains independent option groups.
|
|
2338
2521
|
* @param props.onSelect - data-row activation callback (not called for disabled rows or submenu parents that only open children).
|
|
@@ -2342,8 +2525,8 @@ const MEASURE_STYLE = {
|
|
|
2342
2525
|
* @param props.align - list alignment against the anchor (default 'start').
|
|
2343
2526
|
* @param props.side - open below (`bottom`, default) or above (`top`) the anchor.
|
|
2344
2527
|
* @param props.portal - render the list into document.body, fixed-positioned
|
|
2345
|
-
*
|
|
2346
|
-
*
|
|
2528
|
+
* with CSS anchor positioning; it follows browser zoom and may exceed the
|
|
2529
|
+
* visual viewport. Use when an ancestor's overflow clipping would crop the
|
|
2347
2530
|
* in-place list; default false keeps the pure-CSS in-place behavior.
|
|
2348
2531
|
* @param props.closeOnPointerLeave - close the list once the pointer has left
|
|
2349
2532
|
* both trigger and list for the pointer grace (default false keeps it open
|
|
@@ -2351,12 +2534,8 @@ const MEASURE_STYLE = {
|
|
|
2351
2534
|
* gap and a brief overshoot survivable; coming back cancels the close.
|
|
2352
2535
|
* @param props.dense - reduce vertical row spacing without changing the standard typography or card width.
|
|
2353
2536
|
* @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.
|
|
2537
|
+
* @param props.anchorRef - external element used as the CSS anchor in portal mode.
|
|
2538
|
+
* @param props.anchorPoint - client viewport coordinates captured when a context menu opens.
|
|
2360
2539
|
* @param props.minWidthFromAnchor - in portal mode, keep the menu at least as wide as its anchor, bounded by viewport margins.
|
|
2361
2540
|
* @param props.footer - rows pinned below the scrolling items area, separated
|
|
2362
2541
|
* by a hairline; contextual menus reuse an explicit leading separator. These rows stay visible while the items above scroll.
|
|
@@ -2374,10 +2553,24 @@ const MEASURE_STYLE = {
|
|
|
2374
2553
|
* document.body outside the owner's DOM subtree.
|
|
2375
2554
|
* @returns anchor wrapper with the conditional list.
|
|
2376
2555
|
*/
|
|
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",
|
|
2556
|
+
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
2557
|
const rootRef = useRef(null);
|
|
2379
2558
|
const listRef = useRef(null);
|
|
2380
2559
|
const menuId = useId();
|
|
2560
|
+
const pointX = anchorPoint?.x;
|
|
2561
|
+
const pointY = anchorPoint?.y;
|
|
2562
|
+
const point = useMemo(() => {
|
|
2563
|
+
if (pointX === void 0 || pointY === void 0) return void 0;
|
|
2564
|
+
const viewport = open && typeof window.CSS !== "undefined" && window.CSS.supports("-webkit-backdrop-filter", "none") ? window.visualViewport : void 0;
|
|
2565
|
+
return {
|
|
2566
|
+
x: pointX + (viewport?.offsetLeft ?? 0),
|
|
2567
|
+
y: pointY + (viewport?.offsetTop ?? 0)
|
|
2568
|
+
};
|
|
2569
|
+
}, [
|
|
2570
|
+
open,
|
|
2571
|
+
pointX,
|
|
2572
|
+
pointY
|
|
2573
|
+
]);
|
|
2381
2574
|
useLayoutEffect(() => {
|
|
2382
2575
|
const trigger = returnFocus?.();
|
|
2383
2576
|
if (!open || !contextual || trigger == null) return;
|
|
@@ -2410,7 +2603,8 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2410
2603
|
* @param navigation - whether explicit keyboard traversal should retain its focus indicator.
|
|
2411
2604
|
*/
|
|
2412
2605
|
const refocusAnchor = (navigation = false) => {
|
|
2413
|
-
const
|
|
2606
|
+
const remembered = triggerRef.current;
|
|
2607
|
+
const trigger = returnFocus?.() ?? (remembered?.isConnected ? remembered : anchorRef?.current) ?? null;
|
|
2414
2608
|
const target = trigger !== null && document.contains(trigger) && !trigger.disabled ? trigger : rootRef.current?.querySelector("button:not(:disabled)");
|
|
2415
2609
|
if (target == null) return;
|
|
2416
2610
|
if (navigation) target.focus();
|
|
@@ -2428,46 +2622,81 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2428
2622
|
queueMicrotask(() => {
|
|
2429
2623
|
if (openRef.current && exitingRef.current === void 0) return;
|
|
2430
2624
|
const active = document.activeElement;
|
|
2431
|
-
if (active === null || active === document.body || listRef.current?.contains(active) === true) refocusAnchor(navigation);
|
|
2625
|
+
if (active === null || active === document.body || listRef.current?.contains(active) === true || submenu.contains(active)) refocusAnchor(navigation);
|
|
2432
2626
|
});
|
|
2433
2627
|
};
|
|
2434
2628
|
const exitingRef = useRef(exiting);
|
|
2435
2629
|
exitingRef.current = exiting;
|
|
2436
2630
|
const openRef = useRef(open);
|
|
2437
2631
|
openRef.current = open;
|
|
2438
|
-
const
|
|
2632
|
+
const submenu = useMenuSubmenu({
|
|
2633
|
+
open: open && exiting === void 0,
|
|
2634
|
+
items,
|
|
2635
|
+
footer,
|
|
2636
|
+
listRef,
|
|
2637
|
+
refocusAnchor
|
|
2638
|
+
});
|
|
2639
|
+
const submenuEvents = useRef(submenu);
|
|
2640
|
+
submenuEvents.current = submenu;
|
|
2439
2641
|
const close = useRef(onClose);
|
|
2440
2642
|
close.current = onClose;
|
|
2441
|
-
const
|
|
2442
|
-
const
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2643
|
+
const anchorName = `--dsh-menu-trigger-${menuId.replaceAll(":", "")}`;
|
|
2644
|
+
const [externalAnchor, setExternalAnchor] = useState(null);
|
|
2645
|
+
const positioned = !portal || anchorRef === void 0 || externalAnchor !== null;
|
|
2646
|
+
useEffect(() => {
|
|
2647
|
+
if (!open || !portal || anchorRef === void 0) {
|
|
2648
|
+
setExternalAnchor(null);
|
|
2649
|
+
return;
|
|
2446
2650
|
}
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
gap: 4,
|
|
2457
|
-
margin: 12,
|
|
2458
|
-
frameClearance: !contextual,
|
|
2459
|
-
minWidthFromAnchor,
|
|
2460
|
-
getAnchorRect: readAnchor
|
|
2651
|
+
const element = anchorRef.current;
|
|
2652
|
+
setExternalAnchor(element);
|
|
2653
|
+
if (element === null) return;
|
|
2654
|
+
const previous = element.style.getPropertyValue("anchor-name");
|
|
2655
|
+
const priority = element.style.getPropertyPriority("anchor-name");
|
|
2656
|
+
element.style.setProperty("anchor-name", anchorName);
|
|
2657
|
+
return () => {
|
|
2658
|
+
element.style.setProperty("anchor-name", previous, priority);
|
|
2659
|
+
};
|
|
2461
2660
|
});
|
|
2462
|
-
|
|
2661
|
+
useEffect(() => {
|
|
2662
|
+
if (!open || !portal || exiting !== void 0) return;
|
|
2663
|
+
const currentAnchor = () => returnFocus?.() ?? (anchorRef === void 0 ? rootRef.current : anchorRef.current);
|
|
2664
|
+
const element = currentAnchor();
|
|
2665
|
+
if (element === null) return;
|
|
2666
|
+
let dismissed = false;
|
|
2667
|
+
const check = () => {
|
|
2668
|
+
const current = currentAnchor();
|
|
2669
|
+
if (dismissed || current !== null && current.isConnected && current.closest("[inert], [hidden]") === null) return;
|
|
2670
|
+
dismissed = true;
|
|
2671
|
+
close.current();
|
|
2672
|
+
};
|
|
2673
|
+
const observer = new MutationObserver(check);
|
|
2674
|
+
observer.observe(element.ownerDocument.documentElement, {
|
|
2675
|
+
subtree: true,
|
|
2676
|
+
childList: true,
|
|
2677
|
+
attributes: true,
|
|
2678
|
+
attributeFilter: ["inert", "hidden"]
|
|
2679
|
+
});
|
|
2680
|
+
check();
|
|
2681
|
+
return () => {
|
|
2682
|
+
observer.disconnect();
|
|
2683
|
+
};
|
|
2684
|
+
}, [
|
|
2685
|
+
open,
|
|
2686
|
+
portal,
|
|
2687
|
+
exiting,
|
|
2688
|
+
anchorRef,
|
|
2689
|
+
externalAnchor,
|
|
2690
|
+
returnFocus
|
|
2691
|
+
]);
|
|
2463
2692
|
const { arm: armClose, cancel: cancelClose } = usePointerGrace(onClose);
|
|
2464
2693
|
useEffect(() => {
|
|
2465
2694
|
if (!open) return;
|
|
2466
2695
|
const active = document.activeElement;
|
|
2467
|
-
triggerRef.current = active instanceof HTMLElement && (
|
|
2696
|
+
triggerRef.current = active instanceof HTMLElement && active !== document.body && (anchorRef !== void 0 || anchorPoint !== void 0 || rootRef.current?.contains(active) === true) ? active : null;
|
|
2468
2697
|
}, [open]);
|
|
2469
2698
|
useEffect(() => {
|
|
2470
|
-
if (!open || exiting !== void 0 || !autoFocus ||
|
|
2699
|
+
if (!open || !positioned || exiting !== void 0 || !autoFocus || listRef.current?.contains(document.activeElement) || submenu.contains(document.activeElement)) return;
|
|
2471
2700
|
const first = listRef.current?.querySelector("button:not(:disabled)");
|
|
2472
2701
|
walkIndex.current = first === void 0 || first === null ? null : 0;
|
|
2473
2702
|
if (first != null) focusWithoutRing(first);
|
|
@@ -2481,30 +2710,40 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2481
2710
|
]);
|
|
2482
2711
|
useEffect(() => {
|
|
2483
2712
|
if (!open || exiting !== void 0) {
|
|
2484
|
-
setOpenSubmenuId(null);
|
|
2485
2713
|
walkIndex.current = null;
|
|
2486
2714
|
return;
|
|
2487
2715
|
}
|
|
2488
2716
|
const composition = observeComposition(document);
|
|
2489
2717
|
const onPointerDown = (e) => {
|
|
2490
2718
|
if (!(e.target instanceof Node) || contextual && e.button === 2) return;
|
|
2491
|
-
if (rootRef.current?.contains(e.target) === true) return;
|
|
2492
|
-
if (
|
|
2719
|
+
if (rootRef.current?.contains(e.target) === true || anchorRef?.current?.contains(e.target) === true) return;
|
|
2720
|
+
if (isExternalTrigger?.(e.target) === true) return;
|
|
2721
|
+
if (listRef.current?.contains(e.target) === true || submenuEvents.current.contains(e.target)) return;
|
|
2493
2722
|
onClose();
|
|
2494
2723
|
};
|
|
2495
2724
|
const onKeyDown = (e) => {
|
|
2496
2725
|
if (composition.guards(e) || isBehindModal(triggerRef.current ?? rootRef.current) || e.defaultPrevented || e.ctrlKey || e.altKey || e.metaKey) return;
|
|
2497
2726
|
const focused = document.activeElement;
|
|
2498
|
-
const insideList = listRef.current?.contains(focused) === true;
|
|
2499
|
-
const anchored = focused === returnFocus?.() || rootRef.current?.contains(focused) === true || insideList;
|
|
2727
|
+
const insideList = listRef.current?.contains(focused) === true || submenuEvents.current.contains(focused);
|
|
2728
|
+
const anchored = focused === returnFocus?.() || anchorRef?.current?.contains(focused) === true || rootRef.current?.contains(focused) === true || insideList;
|
|
2500
2729
|
if (e.key === "Escape" && !e.shiftKey) {
|
|
2501
2730
|
e.preventDefault();
|
|
2502
2731
|
if (e.repeat) return;
|
|
2732
|
+
if (submenuEvents.current.returnToParent()) return;
|
|
2503
2733
|
onClose();
|
|
2504
2734
|
if (anchored || autoFocus) refocusAnchor();
|
|
2505
2735
|
}
|
|
2736
|
+
if (e.key === "ArrowLeft" && anchored && submenuEvents.current.returnToParent()) {
|
|
2737
|
+
e.preventDefault();
|
|
2738
|
+
return;
|
|
2739
|
+
}
|
|
2740
|
+
if (e.key === "ArrowRight" && insideList && focused instanceof HTMLButtonElement && focused.getAttribute("aria-haspopup") === "menu") {
|
|
2741
|
+
e.preventDefault();
|
|
2742
|
+
focused.click();
|
|
2743
|
+
return;
|
|
2744
|
+
}
|
|
2506
2745
|
if (e.key === "Tab") {
|
|
2507
|
-
const list =
|
|
2746
|
+
const list = submenuEvents.current.activeList(focused);
|
|
2508
2747
|
if (list === null || !anchored) return;
|
|
2509
2748
|
if (e.shiftKey) {
|
|
2510
2749
|
e.preventDefault();
|
|
@@ -2542,7 +2781,7 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2542
2781
|
"Home",
|
|
2543
2782
|
"End"
|
|
2544
2783
|
].includes(e.key)) return;
|
|
2545
|
-
const list =
|
|
2784
|
+
const list = submenuEvents.current.activeList(focused);
|
|
2546
2785
|
if (list === null || !anchored) return;
|
|
2547
2786
|
const buttons = Array.from(list.querySelectorAll("button:not(:disabled)"));
|
|
2548
2787
|
if (buttons.length === 0) return;
|
|
@@ -2578,7 +2817,10 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2578
2817
|
onClose,
|
|
2579
2818
|
autoFocus,
|
|
2580
2819
|
contextual,
|
|
2581
|
-
exiting
|
|
2820
|
+
exiting,
|
|
2821
|
+
anchorRef,
|
|
2822
|
+
returnFocus,
|
|
2823
|
+
isExternalTrigger
|
|
2582
2824
|
]);
|
|
2583
2825
|
useLayoutEffect(() => {
|
|
2584
2826
|
if (exiting === "dismiss" && listRef.current?.contains(document.activeElement)) refocusAnchor();
|
|
@@ -2586,126 +2828,52 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2586
2828
|
useEffect(() => {
|
|
2587
2829
|
if (!open) cancelClose();
|
|
2588
2830
|
}, [open, cancelClose]);
|
|
2589
|
-
const
|
|
2590
|
-
const
|
|
2591
|
-
const footerColumns = iconColumns(footer ?? [], contextual);
|
|
2831
|
+
const itemColumns = menuIconColumns(items, contextual);
|
|
2832
|
+
const footerColumns = menuIconColumns(footer ?? [], contextual);
|
|
2592
2833
|
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);
|
|
2834
|
+
if ("type" in entry) return renderMenuDecoration(entry);
|
|
2602
2835
|
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);
|
|
2836
|
+
return jsx(MenuRow, {
|
|
2837
|
+
icon: entry.icon,
|
|
2838
|
+
reserveIcon: columns.has(entry),
|
|
2839
|
+
disabled: entry.disabled,
|
|
2840
|
+
danger: entry.danger,
|
|
2841
|
+
shortcut: entry.shortcut,
|
|
2842
|
+
selected: entry.id === selectedId || selectedIds?.includes(entry.id) === true,
|
|
2843
|
+
selection,
|
|
2844
|
+
"aria-haspopup": hasSub ? "menu" : void 0,
|
|
2845
|
+
"aria-expanded": hasSub ? submenu.entry?.id === entry.id && !submenu.hidden : void 0,
|
|
2846
|
+
wrapperProps: hasSub ? {
|
|
2847
|
+
onPointerEnter: (event) => {
|
|
2848
|
+
if (!menuHoverAllowed(event) || entry.disabled) return;
|
|
2849
|
+
const trigger = event.currentTarget.querySelector("button");
|
|
2850
|
+
if (trigger !== null) submenu.openChild(entry.id, trigger);
|
|
2631
2851
|
},
|
|
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
|
-
})]
|
|
2852
|
+
onPointerLeave: (event) => {
|
|
2853
|
+
if (menuHoverAllowed(event)) submenu.leave();
|
|
2854
|
+
}
|
|
2855
|
+
} : void 0,
|
|
2856
|
+
onFocus: hasSub ? (event) => {
|
|
2857
|
+
submenu.focusParent(entry.id, event.currentTarget);
|
|
2858
|
+
} : void 0,
|
|
2859
|
+
onClick: (event) => {
|
|
2860
|
+
if (hasSub) submenu.openChild(entry.id, event.currentTarget, true);
|
|
2861
|
+
else onSelect?.(entry.id);
|
|
2862
|
+
},
|
|
2863
|
+
children: entry.label
|
|
2693
2864
|
}, entry.id);
|
|
2694
2865
|
};
|
|
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, {
|
|
2866
|
+
const list = open && positioned && jsxs(MenuSurface, {
|
|
2702
2867
|
compact,
|
|
2703
2868
|
id: contextual ? menuId : void 0,
|
|
2704
2869
|
ref: listRef,
|
|
2705
|
-
className: clsx(css$
|
|
2706
|
-
style: portal ?
|
|
2707
|
-
|
|
2708
|
-
"
|
|
2870
|
+
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),
|
|
2871
|
+
style: portal ? { positionAnchor: anchorName } : void 0,
|
|
2872
|
+
"data-anchor-side": portal ? side : void 0,
|
|
2873
|
+
"data-anchor-align": portal ? align : void 0,
|
|
2874
|
+
"data-match-anchor-width": portal && minWidthFromAnchor ? "" : void 0,
|
|
2875
|
+
role: exiting === void 0 && !submenu.page ? "menu" : void 0,
|
|
2876
|
+
"aria-hidden": exiting === void 0 && !submenu.page ? void 0 : true,
|
|
2709
2877
|
"data-context-menu": contextual ? "" : void 0,
|
|
2710
2878
|
phase: contextual ? exiting ?? "enter" : void 0,
|
|
2711
2879
|
onClick: (e) => {
|
|
@@ -2718,26 +2886,60 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
|
|
|
2718
2886
|
event.stopPropagation();
|
|
2719
2887
|
onClose();
|
|
2720
2888
|
} : void 0,
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2889
|
+
onPointerOver: (event) => {
|
|
2890
|
+
if (menuHoverAllowed(event)) submenu.collapseFrom(event);
|
|
2891
|
+
},
|
|
2892
|
+
onFocus: submenu.collapseFrom,
|
|
2893
|
+
children: [
|
|
2894
|
+
submenu.entry !== void 0 && jsx("span", {
|
|
2895
|
+
"aria-hidden": "true",
|
|
2896
|
+
className: css$9.submenuAnchor,
|
|
2897
|
+
style: { anchorName: submenu.parentAnchor }
|
|
2898
|
+
}),
|
|
2899
|
+
jsxs("div", {
|
|
2900
|
+
className: css$9.viewport,
|
|
2901
|
+
role: "presentation",
|
|
2902
|
+
children: [items.map((entry) => renderEntry(entry, itemColumns)), children]
|
|
2903
|
+
}),
|
|
2904
|
+
footer !== void 0 && footer.length > 0 && jsx("div", {
|
|
2905
|
+
className: css$9.footer,
|
|
2906
|
+
role: "presentation",
|
|
2907
|
+
children: footer.map((entry) => renderEntry(entry, footerColumns))
|
|
2908
|
+
})
|
|
2909
|
+
]
|
|
2732
2910
|
});
|
|
2733
2911
|
return jsxs("span", {
|
|
2734
2912
|
ref: rootRef,
|
|
2735
|
-
className: clsx(css$
|
|
2913
|
+
className: clsx(css$9.root, className),
|
|
2914
|
+
style: {
|
|
2915
|
+
anchorName: anchorRef === void 0 ? anchorName : void 0,
|
|
2916
|
+
...point === void 0 ? {} : {
|
|
2917
|
+
position: "fixed",
|
|
2918
|
+
left: point.x,
|
|
2919
|
+
top: point.y,
|
|
2920
|
+
width: 0,
|
|
2921
|
+
height: 0
|
|
2922
|
+
}
|
|
2923
|
+
},
|
|
2736
2924
|
onPointerEnter: closeOnPointerLeave ? cancelClose : void 0,
|
|
2737
|
-
onPointerLeave: closeOnPointerLeave ? () => {
|
|
2738
|
-
if (open) armClose();
|
|
2925
|
+
onPointerLeave: closeOnPointerLeave ? (event) => {
|
|
2926
|
+
if (open && menuHoverAllowed(event)) armClose();
|
|
2739
2927
|
} : void 0,
|
|
2740
|
-
children: [
|
|
2928
|
+
children: [
|
|
2929
|
+
anchor,
|
|
2930
|
+
portal ? list !== false && createPortal(list, document.body) : list,
|
|
2931
|
+
open && exiting === void 0 && submenu.entry !== void 0 && jsx(SubmenuPanel, {
|
|
2932
|
+
entry: submenu.entry,
|
|
2933
|
+
submenu,
|
|
2934
|
+
compact,
|
|
2935
|
+
dense,
|
|
2936
|
+
contextual,
|
|
2937
|
+
backLabel: submenuBackLabel ?? submenu.entry.label,
|
|
2938
|
+
onSelect,
|
|
2939
|
+
onClose,
|
|
2940
|
+
afterSelection: refocusAfterSelection
|
|
2941
|
+
}, submenu.entry.id)
|
|
2942
|
+
]
|
|
2741
2943
|
});
|
|
2742
2944
|
}
|
|
2743
2945
|
//#endregion
|
|
@@ -3184,9 +3386,10 @@ function SegmentedControl({ id, value, options, onChange, label, disabled = fals
|
|
|
3184
3386
|
* @param props.disabled - whether the control refuses changes.
|
|
3185
3387
|
* @param props.title - optional localized hover text.
|
|
3186
3388
|
* @param props.className - extra class for the label's placement.
|
|
3389
|
+
* @param props.modalAutofocus - designate the input for the owning Modal's initial focus without React autoFocus.
|
|
3187
3390
|
* @returns the label containing its checkbox.
|
|
3188
3391
|
*/
|
|
3189
|
-
function Checkbox({ checked, onChange, label, disabled = false, title, className }) {
|
|
3392
|
+
function Checkbox({ checked, onChange, label, disabled = false, title, className, modalAutofocus = false }) {
|
|
3190
3393
|
return jsxs("label", {
|
|
3191
3394
|
className: clsx(css$18.checkbox, className),
|
|
3192
3395
|
title,
|
|
@@ -3194,6 +3397,7 @@ function Checkbox({ checked, onChange, label, disabled = false, title, className
|
|
|
3194
3397
|
type: "checkbox",
|
|
3195
3398
|
checked,
|
|
3196
3399
|
disabled,
|
|
3400
|
+
"data-modal-autofocus": modalAutofocus || void 0,
|
|
3197
3401
|
onChange: (event) => {
|
|
3198
3402
|
onChange(event.target.checked);
|
|
3199
3403
|
}
|
|
@@ -3395,6 +3599,25 @@ function observeStickyMenuGroups(viewport) {
|
|
|
3395
3599
|
};
|
|
3396
3600
|
}
|
|
3397
3601
|
//#endregion
|
|
3602
|
+
//#region lib/types/overlay-top-margin.js
|
|
3603
|
+
/** Shared viewport inset for overlays, derived from the desktop frame's reserved top strip. */
|
|
3604
|
+
/**
|
|
3605
|
+
* Resolve the top margin an overlay keeps from the viewport edge.
|
|
3606
|
+
* @param min - the overlay's own viewport margin in px, used as the floor.
|
|
3607
|
+
* @param anchor - the overlay's anchor rect in viewport coordinates. While the anchor's top edge is inside the
|
|
3608
|
+
* viewport, the margin never exceeds `anchor.bottom + gap`, so an overlay opened from a control inside the top strip
|
|
3609
|
+
* stays next to it.
|
|
3610
|
+
* @param gap - the distance the overlay keeps below `anchor`.
|
|
3611
|
+
* @returns the frame clearance plus 20px (20px in fullscreen), capped by a visible `anchor`, but never below `min`.
|
|
3612
|
+
*/
|
|
3613
|
+
function overlayTopMargin(min, anchor, gap = 0) {
|
|
3614
|
+
const root = document.documentElement;
|
|
3615
|
+
const clearance = Number.parseFloat(getComputedStyle(root).getPropertyValue("--dsh-frame-top-clearance"));
|
|
3616
|
+
if (Number.isNaN(clearance)) return min;
|
|
3617
|
+
const cap = anchor !== void 0 && anchor.top >= 0 ? anchor.bottom + gap : Number.POSITIVE_INFINITY;
|
|
3618
|
+
return Math.max(min, Math.min((root.hasAttribute("data-fullscreen") ? 0 : clearance) + 20, cap));
|
|
3619
|
+
}
|
|
3620
|
+
//#endregion
|
|
3398
3621
|
//#region lib/types/useAnchoredMaxHeight.js
|
|
3399
3622
|
/**
|
|
3400
3623
|
* Viewport-fit hook for bottom-anchored overlays (slash menu, popupSelect):
|
|
@@ -3916,6 +4139,7 @@ function HoverCard({ anchor, content, openDelayMs = 500, disabled = false, group
|
|
|
3916
4139
|
* @param props.onClose - application close command, Escape, or mask click; while a menu is open inside the
|
|
3917
4140
|
* dialog, Escape belongs to that menu first.
|
|
3918
4141
|
* @param props.title - dialog heading (aria-label in every mode).
|
|
4142
|
+
* @param props.tone - warning adds an amber title icon and compact title-to-body spacing; ignored for headless dialogs.
|
|
3919
4143
|
* @param props.closeLabel - localized accessible close-button label.
|
|
3920
4144
|
* @param props.description - optional supporting sentence under the title.
|
|
3921
4145
|
* @param props.children - dialog body; mark its initial-focus control with
|
|
@@ -3930,7 +4154,7 @@ function HoverCard({ anchor, content, openDelayMs = 500, disabled = false, group
|
|
|
3930
4154
|
* @param props.onKeyDownCapture - handle a nested dialog's keys before the document Escape listeners.
|
|
3931
4155
|
* @returns null when closed; otherwise the overlay tree.
|
|
3932
4156
|
*/
|
|
3933
|
-
function Modal({ open, onClose, title, closeLabel, description, children, footer, className, contentClassName, onKeyDownCapture, headless = false, backdropBlur = true, shortcutModal }) {
|
|
4157
|
+
function Modal({ open, onClose, title, closeLabel, description, children, footer, className, contentClassName, onKeyDownCapture, headless = false, backdropBlur = true, shortcutModal, tone }) {
|
|
3934
4158
|
const dialog = useRef(null);
|
|
3935
4159
|
useModalLayer(dialog, open, onClose);
|
|
3936
4160
|
if (!open) return null;
|
|
@@ -3947,7 +4171,7 @@ function Modal({ open, onClose, title, closeLabel, description, children, footer
|
|
|
3947
4171
|
ref: dialog,
|
|
3948
4172
|
tabIndex: -1,
|
|
3949
4173
|
"data-shortcut-modal": shortcutModal,
|
|
3950
|
-
className: clsx(css$23.dialog, className),
|
|
4174
|
+
className: clsx(css$23.dialog, !headless && tone === "warning" && css$23.warning, className),
|
|
3951
4175
|
role: "dialog",
|
|
3952
4176
|
"aria-modal": "true",
|
|
3953
4177
|
"aria-label": title,
|
|
@@ -3956,9 +4180,13 @@ function Modal({ open, onClose, title, closeLabel, description, children, footer
|
|
|
3956
4180
|
children: [
|
|
3957
4181
|
jsxs("div", {
|
|
3958
4182
|
className: css$23.header,
|
|
3959
|
-
children: [
|
|
4183
|
+
children: [jsxs("h2", {
|
|
3960
4184
|
className: css$23.title,
|
|
3961
|
-
children:
|
|
4185
|
+
children: [tone === "warning" && jsx(IconWarningOutlineRegular, {
|
|
4186
|
+
size: 18,
|
|
4187
|
+
className: css$23.warningIcon,
|
|
4188
|
+
"aria-hidden": "true"
|
|
4189
|
+
}), title]
|
|
3962
4190
|
}), jsx("button", {
|
|
3963
4191
|
type: "button",
|
|
3964
4192
|
className: css$23.close,
|
|
@@ -3998,6 +4226,7 @@ function RiskConfirmation({ open, title, description, acknowledgeLabel, cancelLa
|
|
|
3998
4226
|
open,
|
|
3999
4227
|
onClose: onCancel,
|
|
4000
4228
|
title,
|
|
4229
|
+
tone: "warning",
|
|
4001
4230
|
closeLabel,
|
|
4002
4231
|
className: css$24.confirmation ?? "",
|
|
4003
4232
|
contentClassName: css$24.confirmationContent ?? "",
|
|
@@ -4013,23 +4242,16 @@ function RiskConfirmation({ open, title, description, acknowledgeLabel, cancelLa
|
|
|
4013
4242
|
onClick: onConfirm,
|
|
4014
4243
|
children: confirmLabel
|
|
4015
4244
|
})] }),
|
|
4016
|
-
children: [
|
|
4017
|
-
className: css$24.
|
|
4018
|
-
children:
|
|
4019
|
-
|
|
4020
|
-
className: css$24.warningIcon
|
|
4021
|
-
}), jsx("p", { children: description })]
|
|
4022
|
-
}), jsxs("label", {
|
|
4245
|
+
children: [jsx("p", {
|
|
4246
|
+
className: css$24.description,
|
|
4247
|
+
children: description
|
|
4248
|
+
}), jsx(Checkbox, {
|
|
4023
4249
|
className: css$24.acknowledgement,
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
onChange: (event) => {
|
|
4030
|
-
onAcknowledgedChange(event.currentTarget.checked);
|
|
4031
|
-
}
|
|
4032
|
-
}), jsx("span", { children: acknowledgeLabel })]
|
|
4250
|
+
checked: acknowledged,
|
|
4251
|
+
disabled,
|
|
4252
|
+
modalAutofocus: true,
|
|
4253
|
+
label: acknowledgeLabel,
|
|
4254
|
+
onChange: onAcknowledgedChange
|
|
4033
4255
|
})]
|
|
4034
4256
|
});
|
|
4035
4257
|
}
|
|
@@ -4775,7 +4997,7 @@ const CODE_FILE_TYPE_SET = new Set([
|
|
|
4775
4997
|
"yaml",
|
|
4776
4998
|
"zig"
|
|
4777
4999
|
]);
|
|
4778
|
-
const FILE_NAME_TYPES = {
|
|
5000
|
+
const FILE_NAME_TYPES = new Map(Object.entries({
|
|
4779
5001
|
".bash_profile": "shell",
|
|
4780
5002
|
".bashrc": "shell",
|
|
4781
5003
|
".env": "env",
|
|
@@ -4804,7 +5026,7 @@ const FILE_NAME_TYPES = {
|
|
|
4804
5026
|
"package.json": "node",
|
|
4805
5027
|
"podfile": "ruby",
|
|
4806
5028
|
"rakefile": "ruby"
|
|
4807
|
-
};
|
|
5029
|
+
}));
|
|
4808
5030
|
const FILE_NAME_PREFIX_TYPES = [["dockerfile.", "docker"], [".env.", "env"]];
|
|
4809
5031
|
const FILE_NAME_SUFFIX_TYPES = [
|
|
4810
5032
|
[".component.ts", "angular"],
|
|
@@ -4817,7 +5039,7 @@ const FILE_NAME_SUFFIX_TYPES = [
|
|
|
4817
5039
|
[".interceptor.ts", "angular"],
|
|
4818
5040
|
[".dockerfile", "docker"]
|
|
4819
5041
|
];
|
|
4820
|
-
const EXTENSION_TYPES$1 = {
|
|
5042
|
+
const EXTENSION_TYPES$1 = new Map(Object.entries({
|
|
4821
5043
|
"bash": "shell",
|
|
4822
5044
|
"c": "c",
|
|
4823
5045
|
"c++": "cpp",
|
|
@@ -4925,7 +5147,7 @@ const EXTENSION_TYPES$1 = {
|
|
|
4925
5147
|
"yml": "yaml",
|
|
4926
5148
|
"zig": "zig",
|
|
4927
5149
|
"zsh": "shell"
|
|
4928
|
-
};
|
|
5150
|
+
}));
|
|
4929
5151
|
const LINK_CODE_EXTENSIONS = new Set([
|
|
4930
5152
|
"ts",
|
|
4931
5153
|
"tsx",
|
|
@@ -5021,18 +5243,18 @@ function isLinkCodeExtension(extension) {
|
|
|
5021
5243
|
* @returns The detailed code type, or null when the traditional file classifier owns the path.
|
|
5022
5244
|
*/
|
|
5023
5245
|
function classifyCodeFileType(name, extension, context) {
|
|
5024
|
-
const exact = FILE_NAME_TYPES
|
|
5246
|
+
const exact = FILE_NAME_TYPES.get(name);
|
|
5025
5247
|
if (exact !== void 0) return exact;
|
|
5026
5248
|
for (const [prefix, type] of FILE_NAME_PREFIX_TYPES) if (name.startsWith(prefix)) return type;
|
|
5027
5249
|
for (const [suffix, type] of FILE_NAME_SUFFIX_TYPES) if (name.endsWith(suffix)) return type;
|
|
5028
5250
|
if (extension === "dart" && context !== void 0) {
|
|
5029
5251
|
if ((Object.entries(context.files).find(([path]) => basename$1(path).toLowerCase() === "pubspec.yaml")?.[1])?.includes("flutter:") === true) return "flutter";
|
|
5030
5252
|
}
|
|
5031
|
-
return EXTENSION_TYPES$1
|
|
5253
|
+
return EXTENSION_TYPES$1.get(extension) ?? null;
|
|
5032
5254
|
}
|
|
5033
5255
|
//#endregion
|
|
5034
5256
|
//#region lib/types/FileTypeIcon.js
|
|
5035
|
-
const EXTENSION_TYPES = {
|
|
5257
|
+
const EXTENSION_TYPES = new Map(Object.entries({
|
|
5036
5258
|
scss: "code",
|
|
5037
5259
|
sass: "code",
|
|
5038
5260
|
less: "code",
|
|
@@ -5089,12 +5311,12 @@ const EXTENSION_TYPES = {
|
|
|
5089
5311
|
ots: "excel",
|
|
5090
5312
|
fods: "excel",
|
|
5091
5313
|
numbers: "excel"
|
|
5092
|
-
};
|
|
5093
|
-
const NAME_TYPES = {
|
|
5314
|
+
}));
|
|
5315
|
+
const NAME_TYPES = new Map(Object.entries({
|
|
5094
5316
|
changelog: "markdown",
|
|
5095
5317
|
contributing: "markdown",
|
|
5096
5318
|
readme: "markdown"
|
|
5097
|
-
};
|
|
5319
|
+
}));
|
|
5098
5320
|
function basename(path) {
|
|
5099
5321
|
return path.slice(Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")) + 1);
|
|
5100
5322
|
}
|
|
@@ -5120,7 +5342,7 @@ function fileExtension(path) {
|
|
|
5120
5342
|
function classifyFileType(path, context) {
|
|
5121
5343
|
const name = basename(path).toLowerCase();
|
|
5122
5344
|
const extension = fileExtension(name).toLowerCase();
|
|
5123
|
-
return classifyCodeFileType(name, extension, context) ?? NAME_TYPES
|
|
5345
|
+
return classifyCodeFileType(name, extension, context) ?? NAME_TYPES.get(name) ?? EXTENSION_TYPES.get(extension) ?? "other";
|
|
5124
5346
|
}
|
|
5125
5347
|
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
5348
|
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 +6695,58 @@ function patchGoGrammar(grammars) {
|
|
|
6473
6695
|
repository
|
|
6474
6696
|
} : grammar);
|
|
6475
6697
|
}
|
|
6698
|
+
/** The Perl grammar's bare `/…/` rule begins a match only after these characters or at line start. */
|
|
6699
|
+
const PERL_FIND_BEGIN = "(?<=[\\&({|~]|if|unless|^)\\s*((/))";
|
|
6700
|
+
/**
|
|
6701
|
+
* Words after which a Perl `/` starts a match rather than a division. A word
|
|
6702
|
+
* counts only when no identifier character, sigil, `>`, `:` or `-` precedes it,
|
|
6703
|
+
* so `$split / 2` and `$obj->return / 2` stay divisions. Each word is a
|
|
6704
|
+
* separate fixed-length lookbehind alternative because the JavaScript engine's
|
|
6705
|
+
* Oniguruma translator rejects nested lookbehinds.
|
|
6706
|
+
*/
|
|
6707
|
+
const PERL_FIND_WORDS = [
|
|
6708
|
+
"if",
|
|
6709
|
+
"unless",
|
|
6710
|
+
"split",
|
|
6711
|
+
"grep",
|
|
6712
|
+
"and",
|
|
6713
|
+
"or",
|
|
6714
|
+
"not",
|
|
6715
|
+
"return",
|
|
6716
|
+
"while",
|
|
6717
|
+
"until"
|
|
6718
|
+
];
|
|
6719
|
+
/**
|
|
6720
|
+
* Widen the vendored Perl grammar's bare `/…/` match rule, which begins only
|
|
6721
|
+
* after `&`, `(`, `{`, `|`, `~`, `if`, `unless` or at line start. Elsewhere,
|
|
6722
|
+
* such as `split /^---\s*$/m, $text`, the pattern body tokenizes as code: its
|
|
6723
|
+
* `m,` opens an `m` match delimited by commas that runs to the end of the
|
|
6724
|
+
* source. The patched rule also begins after `,`, `!`, `=` and `=>`, and after
|
|
6725
|
+
* the list operators `split` and `grep`, the low-precedence operators `and`,
|
|
6726
|
+
* `or` and `not`, and `return`, `while`, `until`, `if` and `unless` when no
|
|
6727
|
+
* identifier character, sigil, `>`, `:` or `-` precedes the word. The upstream
|
|
6728
|
+
* textmate/perl.tmbundle grammar, which `@shikijs/langs` 4.4.3 ships through
|
|
6729
|
+
* VS Code, has the same rule.
|
|
6730
|
+
* @param grammars - the `@shikijs/langs/perl` default export, left unmodified.
|
|
6731
|
+
* @returns copies of `grammars` with that rule's begin replaced in the `perl` grammar.
|
|
6732
|
+
* @throws When the module has no `perl` grammar or that grammar has no or several
|
|
6733
|
+
* top-level rules with the vendored begin pattern. The lazy load then rejects
|
|
6734
|
+
* unhandled and Perl code renders as plain text.
|
|
6735
|
+
*/
|
|
6736
|
+
function patchPerlGrammar(grammars) {
|
|
6737
|
+
const perl = grammars.find((grammar) => grammar.name === "perl");
|
|
6738
|
+
const rules = perl?.patterns.filter((rule) => rule.begin === PERL_FIND_BEGIN) ?? [];
|
|
6739
|
+
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`);
|
|
6740
|
+
const begin = `(?<=[\\&({|~,!=]|=>|^|${PERL_FIND_WORDS.flatMap((word) => [`[^\\w$@%&>:-]${word}`, `^${word}`]).join("|")})\\s*((/))`;
|
|
6741
|
+
const patterns = perl.patterns.map((rule) => rule === rules[0] ? {
|
|
6742
|
+
...rule,
|
|
6743
|
+
begin
|
|
6744
|
+
} : rule);
|
|
6745
|
+
return grammars.map((grammar) => grammar === perl ? {
|
|
6746
|
+
...perl,
|
|
6747
|
+
patterns
|
|
6748
|
+
} : grammar);
|
|
6749
|
+
}
|
|
6476
6750
|
/**
|
|
6477
6751
|
* The non-boot extension grammars, each behind a dynamic import so its module
|
|
6478
6752
|
* stays out of the boot chunk until a code surface renders that language.
|
|
@@ -6528,7 +6802,7 @@ const LAZY_GRAMMARS = new Map([
|
|
|
6528
6802
|
["haskell", () => import("@shikijs/langs/haskell")],
|
|
6529
6803
|
["fsharp", () => import("@shikijs/langs/fsharp")],
|
|
6530
6804
|
["vb", () => import("@shikijs/langs/vb")],
|
|
6531
|
-
["perl", () => import("@shikijs/langs/perl")],
|
|
6805
|
+
["perl", async () => ({ default: patchPerlGrammar((await import("@shikijs/langs/perl")).default) })],
|
|
6532
6806
|
["verilog", () => import("@shikijs/langs/verilog")],
|
|
6533
6807
|
["system-verilog", () => import("@shikijs/langs/system-verilog")],
|
|
6534
6808
|
["graphql", () => import("@shikijs/langs/graphql")],
|
|
@@ -7252,7 +7526,7 @@ function JsonCopyAction({ store, target, persistent, labels, onCopy, onClose })
|
|
|
7252
7526
|
onCopy(target, mode);
|
|
7253
7527
|
},
|
|
7254
7528
|
onClose,
|
|
7255
|
-
|
|
7529
|
+
anchorRef: buttonRef
|
|
7256
7530
|
})
|
|
7257
7531
|
});
|
|
7258
7532
|
}
|
|
@@ -9137,6 +9411,55 @@ function SearchBlock(props) {
|
|
|
9137
9411
|
});
|
|
9138
9412
|
}
|
|
9139
9413
|
//#endregion
|
|
9414
|
+
//#region lib/types/markdown/copy-tex.js
|
|
9415
|
+
/** Clipboard projection that copies rendered KaTeX formulas as their TeX source. */
|
|
9416
|
+
/** The whole formula around a node, including the display wrapper that marks display math. */
|
|
9417
|
+
function closestFormula(node) {
|
|
9418
|
+
const element = node instanceof Element ? node : node.parentElement;
|
|
9419
|
+
return element?.closest(".katex-display") ?? element?.closest(".katex") ?? null;
|
|
9420
|
+
}
|
|
9421
|
+
/**
|
|
9422
|
+
* Rewrite a copy whose selection lies inside one rendered Markdown document and
|
|
9423
|
+
* includes rendered math, so each formula becomes its trimmed TeX source,
|
|
9424
|
+
* delimited as `$…$` inline and `$$…$$` for display math, in both the
|
|
9425
|
+
* plain-text and HTML clipboard data. A selection endpoint inside a formula
|
|
9426
|
+
* extends to the whole formula in the clipboard only; the visible selection is
|
|
9427
|
+
* unchanged. A copy without math, a selection reaching outside `root`, and a
|
|
9428
|
+
* copy whose default an inner listener already prevented keep their data.
|
|
9429
|
+
* @param event - Native copy event.
|
|
9430
|
+
* @param root - The rendered Markdown document root.
|
|
9431
|
+
*/
|
|
9432
|
+
function copyKatexAsTex(event, root) {
|
|
9433
|
+
const selection = root.ownerDocument.getSelection();
|
|
9434
|
+
if (event.defaultPrevented || event.clipboardData === null || selection === null || selection.rangeCount !== 1 || selection.isCollapsed) return;
|
|
9435
|
+
const range = selection.getRangeAt(0).cloneRange();
|
|
9436
|
+
if (!root.contains(range.commonAncestorContainer)) return;
|
|
9437
|
+
const startFormula = closestFormula(range.startContainer);
|
|
9438
|
+
if (startFormula !== null) range.setStartBefore(startFormula);
|
|
9439
|
+
const endFormula = closestFormula(range.endContainer);
|
|
9440
|
+
if (endFormula !== null) range.setEndAfter(endFormula);
|
|
9441
|
+
const fragment = range.cloneContents();
|
|
9442
|
+
const formulas = [...fragment.querySelectorAll(".katex")];
|
|
9443
|
+
if (formulas.length === 0) return;
|
|
9444
|
+
for (const formula of formulas) {
|
|
9445
|
+
const tex = formula.querySelector("annotation[encoding=\"application/x-tex\"]")?.textContent.trim();
|
|
9446
|
+
if (tex === void 0) continue;
|
|
9447
|
+
const delimiter = formula.closest(".katex-display") === null ? "$" : "$$";
|
|
9448
|
+
formula.replaceWith(`${delimiter}${tex}${delimiter}`);
|
|
9449
|
+
}
|
|
9450
|
+
const container = root.ownerDocument.createElement("div");
|
|
9451
|
+
container.style.cssText = "position:fixed;top:0;left:-100000px;pointer-events:none";
|
|
9452
|
+
container.append(fragment);
|
|
9453
|
+
root.append(container);
|
|
9454
|
+
try {
|
|
9455
|
+
event.clipboardData.setData("text/plain", container.innerText);
|
|
9456
|
+
event.clipboardData.setData("text/html", container.innerHTML);
|
|
9457
|
+
} finally {
|
|
9458
|
+
container.remove();
|
|
9459
|
+
}
|
|
9460
|
+
event.preventDefault();
|
|
9461
|
+
}
|
|
9462
|
+
//#endregion
|
|
9140
9463
|
//#region lib/types/markdown/incremental.js
|
|
9141
9464
|
/**
|
|
9142
9465
|
* Incremental block-level markdown parsing for an append-only text stream.
|
|
@@ -9866,6 +10189,224 @@ function parseGfmWithMath(text) {
|
|
|
9866
10189
|
}), text);
|
|
9867
10190
|
}
|
|
9868
10191
|
//#endregion
|
|
10192
|
+
//#region lib/types/markdown/diff-fence.js
|
|
10193
|
+
/** Unified-diff row parsing and per-file body tokenization for markdown fences. @module dsh-client-ui-primitives/markdown/diff-fence */
|
|
10194
|
+
/** Fence info strings rendered as a unified diff instead of grammar-highlighted code. */
|
|
10195
|
+
const DIFF_FENCE_LANGUAGES = new Set(["diff", "patch"]);
|
|
10196
|
+
/**
|
|
10197
|
+
* Whether a fence info string selects diff row rendering.
|
|
10198
|
+
* @param lang - the fence info string, case-insensitively compared.
|
|
10199
|
+
* @returns whether the fence is a unified diff.
|
|
10200
|
+
*/
|
|
10201
|
+
function isDiffFenceLanguage(lang) {
|
|
10202
|
+
return lang !== void 0 && DIFF_FENCE_LANGUAGES.has(lang.toLowerCase());
|
|
10203
|
+
}
|
|
10204
|
+
/** File-level chrome a unified diff carries above and between hunks. */
|
|
10205
|
+
const DIFF_META_PREFIXES = [
|
|
10206
|
+
"diff --git ",
|
|
10207
|
+
"index ",
|
|
10208
|
+
"old mode ",
|
|
10209
|
+
"new mode ",
|
|
10210
|
+
"new file mode ",
|
|
10211
|
+
"deleted file mode ",
|
|
10212
|
+
"similarity index ",
|
|
10213
|
+
"dissimilarity index ",
|
|
10214
|
+
"rename from ",
|
|
10215
|
+
"rename to ",
|
|
10216
|
+
"copy from ",
|
|
10217
|
+
"copy to ",
|
|
10218
|
+
"Binary files ",
|
|
10219
|
+
"GIT binary patch",
|
|
10220
|
+
"\\ No newline"
|
|
10221
|
+
];
|
|
10222
|
+
/** Hunk header with both line counts; a missing count means one line. */
|
|
10223
|
+
const HUNK_HEADER = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/u;
|
|
10224
|
+
/**
|
|
10225
|
+
* Parse a hunk header's line budget.
|
|
10226
|
+
* @param raw - the `@@ -a,b +c,d @@` line.
|
|
10227
|
+
* @returns the remaining line counts, or `undefined` for a malformed header.
|
|
10228
|
+
*/
|
|
10229
|
+
function hunkRemainder(raw) {
|
|
10230
|
+
const match = HUNK_HEADER.exec(raw);
|
|
10231
|
+
if (match === null) return void 0;
|
|
10232
|
+
return {
|
|
10233
|
+
old: match[2] === void 0 ? 1 : Number(match[2]),
|
|
10234
|
+
new: match[4] === void 0 ? 1 : Number(match[4])
|
|
10235
|
+
};
|
|
10236
|
+
}
|
|
10237
|
+
/** Whether a raw line is file-level chrome rather than hunk content. */
|
|
10238
|
+
function isDiffMeta(raw) {
|
|
10239
|
+
return DIFF_META_PREFIXES.some((prefix) => raw.startsWith(prefix));
|
|
10240
|
+
}
|
|
10241
|
+
/**
|
|
10242
|
+
* Resolve the inner language a `---`/`+++` header names.
|
|
10243
|
+
* @param raw - the header line.
|
|
10244
|
+
* @returns the language id, or `undefined` for `/dev/null` or an unknown path.
|
|
10245
|
+
*/
|
|
10246
|
+
function headerLanguage(raw) {
|
|
10247
|
+
const path = raw.slice(4).replace(/\t.*$/u, "").trim();
|
|
10248
|
+
const unquoted = path.startsWith("\"") && path.endsWith("\"") ? path.slice(1, -1).replace(/\\(["\\])/gu, "$1") : path;
|
|
10249
|
+
if (unquoted === "" || unquoted === "/dev/null") return void 0;
|
|
10250
|
+
return languageForPath(unquoted.replace(/^[ab]\//u, ""));
|
|
10251
|
+
}
|
|
10252
|
+
/**
|
|
10253
|
+
* Split a unified diff into rows without losing a byte (copy reads the DOM).
|
|
10254
|
+
*
|
|
10255
|
+
* The hunk header's line budget ends a hunk, so a following `---` / `+++` file
|
|
10256
|
+
* header is chrome again — both for a concatenated `git diff` and for `diff -u`
|
|
10257
|
+
* output without `diff --git` lines. A malformed header keeps the row until the
|
|
10258
|
+
* next `diff --git`, matching how authored fences are rendered.
|
|
10259
|
+
* @param code - the fence body, display-trimmed.
|
|
10260
|
+
* @returns the rows and each file section's language.
|
|
10261
|
+
*/
|
|
10262
|
+
function parseDiffFence(code) {
|
|
10263
|
+
const rows = [];
|
|
10264
|
+
const languages = /* @__PURE__ */ new Map();
|
|
10265
|
+
let inHunk = false;
|
|
10266
|
+
let remainder;
|
|
10267
|
+
let file = -1;
|
|
10268
|
+
const push = (row) => {
|
|
10269
|
+
rows.push({
|
|
10270
|
+
...row,
|
|
10271
|
+
file
|
|
10272
|
+
});
|
|
10273
|
+
};
|
|
10274
|
+
for (const raw of code.split("\n")) {
|
|
10275
|
+
if (raw.startsWith("diff --git ")) {
|
|
10276
|
+
inHunk = false;
|
|
10277
|
+
remainder = void 0;
|
|
10278
|
+
push({
|
|
10279
|
+
kind: "meta",
|
|
10280
|
+
marker: "",
|
|
10281
|
+
body: "",
|
|
10282
|
+
raw
|
|
10283
|
+
});
|
|
10284
|
+
continue;
|
|
10285
|
+
}
|
|
10286
|
+
if (raw.startsWith("@@")) {
|
|
10287
|
+
inHunk = true;
|
|
10288
|
+
remainder = hunkRemainder(raw);
|
|
10289
|
+
push({
|
|
10290
|
+
kind: "hunk",
|
|
10291
|
+
marker: "",
|
|
10292
|
+
body: "",
|
|
10293
|
+
raw
|
|
10294
|
+
});
|
|
10295
|
+
continue;
|
|
10296
|
+
}
|
|
10297
|
+
if (!inHunk && (raw.startsWith("--- ") || raw.startsWith("+++ "))) {
|
|
10298
|
+
if (raw.startsWith("--- ")) file += 1;
|
|
10299
|
+
const language = headerLanguage(raw);
|
|
10300
|
+
if (language !== void 0) languages.set(file, language);
|
|
10301
|
+
push({
|
|
10302
|
+
kind: "meta",
|
|
10303
|
+
marker: "",
|
|
10304
|
+
body: "",
|
|
10305
|
+
raw
|
|
10306
|
+
});
|
|
10307
|
+
continue;
|
|
10308
|
+
}
|
|
10309
|
+
if (isDiffMeta(raw)) {
|
|
10310
|
+
push({
|
|
10311
|
+
kind: "meta",
|
|
10312
|
+
marker: "",
|
|
10313
|
+
body: "",
|
|
10314
|
+
raw
|
|
10315
|
+
});
|
|
10316
|
+
continue;
|
|
10317
|
+
}
|
|
10318
|
+
if (raw.startsWith("+")) {
|
|
10319
|
+
if (remainder !== void 0) remainder.new -= 1;
|
|
10320
|
+
push({
|
|
10321
|
+
kind: "add",
|
|
10322
|
+
marker: "+",
|
|
10323
|
+
body: raw.slice(1),
|
|
10324
|
+
raw
|
|
10325
|
+
});
|
|
10326
|
+
} else if (raw.startsWith("-")) {
|
|
10327
|
+
if (remainder !== void 0) remainder.old -= 1;
|
|
10328
|
+
push({
|
|
10329
|
+
kind: "del",
|
|
10330
|
+
marker: "-",
|
|
10331
|
+
body: raw.slice(1),
|
|
10332
|
+
raw
|
|
10333
|
+
});
|
|
10334
|
+
} else if (raw.startsWith(" ")) {
|
|
10335
|
+
if (remainder !== void 0) {
|
|
10336
|
+
remainder.old -= 1;
|
|
10337
|
+
remainder.new -= 1;
|
|
10338
|
+
}
|
|
10339
|
+
push({
|
|
10340
|
+
kind: "context",
|
|
10341
|
+
marker: " ",
|
|
10342
|
+
body: raw.slice(1),
|
|
10343
|
+
raw
|
|
10344
|
+
});
|
|
10345
|
+
} else push({
|
|
10346
|
+
kind: "context",
|
|
10347
|
+
marker: "",
|
|
10348
|
+
body: raw,
|
|
10349
|
+
raw
|
|
10350
|
+
});
|
|
10351
|
+
if (inHunk && remainder !== void 0 && remainder.old <= 0 && remainder.new <= 0) inHunk = false;
|
|
10352
|
+
}
|
|
10353
|
+
return {
|
|
10354
|
+
rows,
|
|
10355
|
+
languages
|
|
10356
|
+
};
|
|
10357
|
+
}
|
|
10358
|
+
/**
|
|
10359
|
+
* Whether a row carries code the body highlighter tokenizes.
|
|
10360
|
+
* @param row - the parsed row.
|
|
10361
|
+
* @returns whether the row has tokenizable body text.
|
|
10362
|
+
*/
|
|
10363
|
+
function isDiffContent(row) {
|
|
10364
|
+
return row.kind === "add" || row.kind === "del" || row.kind === "context";
|
|
10365
|
+
}
|
|
10366
|
+
/**
|
|
10367
|
+
* Tokenize each file's old side (context and deletions) and new side (context
|
|
10368
|
+
* and additions) separately, so an unterminated comment or string in a removed
|
|
10369
|
+
* line cannot color the added lines and one file's grammar never applies to the
|
|
10370
|
+
* next. Context rows keep the old-side runs.
|
|
10371
|
+
* @param diff - parsed fence rows and per-file languages.
|
|
10372
|
+
* @returns token runs per content-row index, or `undefined` when no body has a
|
|
10373
|
+
* loaded grammar and the caller should render plain text.
|
|
10374
|
+
*/
|
|
10375
|
+
function diffFenceTokens(diff) {
|
|
10376
|
+
const groups = /* @__PURE__ */ new Map();
|
|
10377
|
+
for (const [index, row] of diff.rows.entries()) {
|
|
10378
|
+
if (!isDiffContent(row)) continue;
|
|
10379
|
+
const sides = row.kind === "del" ? ["old"] : row.kind === "add" ? ["new"] : ["old", "new"];
|
|
10380
|
+
for (const side of sides) {
|
|
10381
|
+
const key = `${row.file}:${side}`;
|
|
10382
|
+
const entry = {
|
|
10383
|
+
row: index,
|
|
10384
|
+
body: row.body,
|
|
10385
|
+
kind: row.kind
|
|
10386
|
+
};
|
|
10387
|
+
const list = groups.get(key);
|
|
10388
|
+
if (list === void 0) groups.set(key, [entry]);
|
|
10389
|
+
else list.push(entry);
|
|
10390
|
+
}
|
|
10391
|
+
}
|
|
10392
|
+
if (groups.size === 0) return void 0;
|
|
10393
|
+
const tokens = /* @__PURE__ */ new Map();
|
|
10394
|
+
let highlighted = false;
|
|
10395
|
+
for (const [key, entries] of groups) {
|
|
10396
|
+
const separator = key.lastIndexOf(":");
|
|
10397
|
+
const language = diff.languages.get(Number(key.slice(0, separator)));
|
|
10398
|
+
const side = key.slice(separator + 1);
|
|
10399
|
+
const lines = highlightLines(entries.map((entry) => entry.body).join("\n"), language);
|
|
10400
|
+
if (lines === void 0) continue;
|
|
10401
|
+
highlighted = true;
|
|
10402
|
+
entries.forEach((entry, lineIndex) => {
|
|
10403
|
+
const line = lines[lineIndex] ?? [];
|
|
10404
|
+
if (side === "old" || entry.kind === "add") tokens.set(entry.row, line);
|
|
10405
|
+
});
|
|
10406
|
+
}
|
|
10407
|
+
return highlighted ? tokens : void 0;
|
|
10408
|
+
}
|
|
10409
|
+
//#endregion
|
|
9869
10410
|
//#region lib/types/markdown/CodeBlock.js
|
|
9870
10411
|
/**
|
|
9871
10412
|
* The `pre` attributes shiki's HTML arm emits for the css-variables theme,
|
|
@@ -9883,6 +10424,28 @@ const SHIKI_PRE_PROPS = {
|
|
|
9883
10424
|
};
|
|
9884
10425
|
/** Completed-line group size; React reconciles groups while the DOM remains line-for-line identical. */
|
|
9885
10426
|
const STREAMING_LINE_GROUP_SIZE = 32;
|
|
10427
|
+
/** Line class per row kind; context rows keep the block's default ink. */
|
|
10428
|
+
const DIFF_ROW_CLASS = {
|
|
10429
|
+
add: css$37.diffAdd,
|
|
10430
|
+
del: css$37.diffDel,
|
|
10431
|
+
hunk: css$37.diffHunk,
|
|
10432
|
+
meta: css$37.diffMeta,
|
|
10433
|
+
context: css$37.diffContext
|
|
10434
|
+
};
|
|
10435
|
+
/** One diff row: optional marker column, then the body with its token colors. */
|
|
10436
|
+
function renderDiffRow(row, index, tokens) {
|
|
10437
|
+
const kindClass = DIFF_ROW_CLASS[row.kind];
|
|
10438
|
+
return jsxs(Fragment$1, { children: [index > 0 && "\n", jsx("span", {
|
|
10439
|
+
className: clsx("line", css$37.diffLine, kindClass),
|
|
10440
|
+
children: isDiffContent(row) ? jsxs(Fragment$1, { children: [jsx("span", {
|
|
10441
|
+
className: css$37.diffMarker,
|
|
10442
|
+
children: row.marker
|
|
10443
|
+
}), tokens === void 0 ? row.body : tokens.map((span, spanIndex) => jsx("span", {
|
|
10444
|
+
style: span.style,
|
|
10445
|
+
children: span.text
|
|
10446
|
+
}, spanIndex))] }) : row.raw
|
|
10447
|
+
})] }, index);
|
|
10448
|
+
}
|
|
9886
10449
|
function renderLine(line, index) {
|
|
9887
10450
|
return jsxs(Fragment$1, { children: [index > 0 && "\n", jsx("span", {
|
|
9888
10451
|
className: "line",
|
|
@@ -9892,17 +10455,27 @@ function renderLine(line, index) {
|
|
|
9892
10455
|
}, spanIndex))
|
|
9893
10456
|
})] }, index);
|
|
9894
10457
|
}
|
|
9895
|
-
function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers = false, showHeader = true, copyLabel, copiedLabel, toolbarLabels, wrap }) {
|
|
10458
|
+
function CodeBlock({ code, lang, diff, streaming, className, contentRef, lineNumbers = false, showHeader = true, copyLabel, copiedLabel, toolbarLabels, wrap }) {
|
|
9896
10459
|
const trimmed = code.endsWith("\n") ? code.slice(0, -1) : code;
|
|
10460
|
+
const diffRows = useMemo(() => diff ?? isDiffFenceLanguage(lang) ? parseDiffFence(trimmed) : void 0, [
|
|
10461
|
+
trimmed,
|
|
10462
|
+
lang,
|
|
10463
|
+
diff
|
|
10464
|
+
]);
|
|
9897
10465
|
const sourceLines = lineNumbers ? trimmed.split("\n") : void 0;
|
|
9898
10466
|
const rootRef = useRef(null);
|
|
9899
|
-
const highlighting = useViewportHighlighting(rootRef, lang);
|
|
10467
|
+
const highlighting = useViewportHighlighting(rootRef, diffRows === void 0 ? lang : "diff");
|
|
9900
10468
|
const loaded = useSyncExternalStore(subscribeGrammarLoaded, grammarLoadCount, grammarLoadCount);
|
|
10469
|
+
const diffTokens = useMemo(() => diffRows === void 0 || !highlighting ? void 0 : diffFenceTokens(diffRows), [
|
|
10470
|
+
diffRows,
|
|
10471
|
+
highlighting,
|
|
10472
|
+
loaded
|
|
10473
|
+
]);
|
|
9901
10474
|
const sessionRef = useRef(null);
|
|
9902
10475
|
const lineCacheRef = useRef(null);
|
|
9903
10476
|
const settledRef = useRef(false);
|
|
9904
10477
|
const streamedBody = useMemo(() => {
|
|
9905
|
-
if (!highlighting) {
|
|
10478
|
+
if (!highlighting || diffRows !== void 0) {
|
|
9906
10479
|
sessionRef.current = null;
|
|
9907
10480
|
lineCacheRef.current = null;
|
|
9908
10481
|
settledRef.current = false;
|
|
@@ -9964,11 +10537,13 @@ function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers =
|
|
|
9964
10537
|
}, [
|
|
9965
10538
|
streaming,
|
|
9966
10539
|
highlighting,
|
|
10540
|
+
diffRows,
|
|
9967
10541
|
trimmed,
|
|
9968
10542
|
lang,
|
|
9969
10543
|
loaded
|
|
9970
10544
|
]);
|
|
9971
|
-
const html = useMemo(() => highlighting && streaming !== true && streamedBody === void 0 ? highlightToHtml(trimmed, lang) : void 0, [
|
|
10545
|
+
const html = useMemo(() => diffRows === void 0 && highlighting && streaming !== true && streamedBody === void 0 ? highlightToHtml(trimmed, lang) : void 0, [
|
|
10546
|
+
diffRows,
|
|
9972
10547
|
streaming,
|
|
9973
10548
|
highlighting,
|
|
9974
10549
|
streamedBody,
|
|
@@ -9989,7 +10564,10 @@ function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers =
|
|
|
9989
10564
|
}, 1e3);
|
|
9990
10565
|
});
|
|
9991
10566
|
}, [copied, trimmed]);
|
|
9992
|
-
const body =
|
|
10567
|
+
const body = diffRows !== void 0 ? jsx("pre", {
|
|
10568
|
+
className: css$37.plain,
|
|
10569
|
+
children: jsx("code", { children: diffRows.rows.map((row, index) => renderDiffRow(row, index, diffTokens?.get(index))) })
|
|
10570
|
+
}) : streamedBody !== void 0 ? streamedBody : html === void 0 ? jsx("pre", {
|
|
9993
10571
|
className: css$37.plain,
|
|
9994
10572
|
children: jsx("code", { children: sourceLines === void 0 ? trimmed : sourceLines.map((line, index) => jsxs(Fragment$1, { children: [index > 0 && "\n", jsx("span", {
|
|
9995
10573
|
className: "line",
|
|
@@ -9998,7 +10576,7 @@ function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers =
|
|
|
9998
10576
|
}) : jsx("div", { dangerouslySetInnerHTML: { __html: html } });
|
|
9999
10577
|
return jsxs("div", {
|
|
10000
10578
|
ref: rootRef,
|
|
10001
|
-
className: clsx(css$37.block, "md-code-block", lineNumbers && css$37.numbered, toolbarLabels !== void 0 && css$37.card, className),
|
|
10579
|
+
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
10580
|
"data-line-numbers": lineNumbers || void 0,
|
|
10003
10581
|
"data-code-wrap": toolbarLabels === void 0 ? void 0 : wrapped,
|
|
10004
10582
|
style: sourceLines === void 0 ? void 0 : { "--dsl-code-block-line-number-width": `${Math.max(2, String(sourceLines.length).length)}ch` },
|
|
@@ -10041,53 +10619,6 @@ function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers =
|
|
|
10041
10619
|
});
|
|
10042
10620
|
}
|
|
10043
10621
|
//#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
10622
|
//#region lib/types/markdown/katex.js
|
|
10092
10623
|
/**
|
|
10093
10624
|
* TeX-to-React via KaTeX, replicating the rehype-katex pipeline this renderer
|
|
@@ -10169,6 +10700,79 @@ function renderTexToReact(value, displayMode) {
|
|
|
10169
10700
|
return [...new DOMParser().parseFromString(html, "text/html").body.childNodes].map(domToReact);
|
|
10170
10701
|
}
|
|
10171
10702
|
//#endregion
|
|
10703
|
+
//#region lib/types/markdown/FenceBlocks.js
|
|
10704
|
+
/**
|
|
10705
|
+
* Render one fence body as a code block.
|
|
10706
|
+
* @param props - fence language, body, streaming state, chrome labels, and diff choice.
|
|
10707
|
+
* @returns the code block.
|
|
10708
|
+
*/
|
|
10709
|
+
function FenceCodeBlock({ lang, code, streaming, labels, diff }) {
|
|
10710
|
+
return jsx(CodeBlock, {
|
|
10711
|
+
code: `${code}\n`,
|
|
10712
|
+
lang,
|
|
10713
|
+
streaming,
|
|
10714
|
+
diff,
|
|
10715
|
+
copyLabel: labels.copyLabel,
|
|
10716
|
+
copiedLabel: labels.copiedLabel,
|
|
10717
|
+
toolbarLabels: labels.toolbarLabels
|
|
10718
|
+
});
|
|
10719
|
+
}
|
|
10720
|
+
/**
|
|
10721
|
+
* Render one `math` fence body as display TeX.
|
|
10722
|
+
* @param props - the fence body without its closing newline.
|
|
10723
|
+
* @returns the typeset formula.
|
|
10724
|
+
*/
|
|
10725
|
+
function FenceMathBlock({ code }) {
|
|
10726
|
+
return jsx(Fragment, { children: renderTexToReact(`${code}\n`, true) });
|
|
10727
|
+
}
|
|
10728
|
+
//#endregion
|
|
10729
|
+
//#region lib/types/markdown/file-link.js
|
|
10730
|
+
/** Local Markdown destinations accepted by the file-preview callback. */
|
|
10731
|
+
/**
|
|
10732
|
+
* Recognize a relative, rooted, or absolute Windows path before URL parsing.
|
|
10733
|
+
* @param value - A decoded or URI-normalized destination.
|
|
10734
|
+
* @returns Whether a filesystem prefix makes the destination unambiguous.
|
|
10735
|
+
*/
|
|
10736
|
+
function isExplicitFilePath(value) {
|
|
10737
|
+
return /^(?:[\\/]|\.{1,2}[\\/]|[a-z]:[\\/])/i.test(value);
|
|
10738
|
+
}
|
|
10739
|
+
/**
|
|
10740
|
+
* Decode a file destination with a fragment, line range, or line/column suffix.
|
|
10741
|
+
* Explicit relative, slash/backslash-rooted, and Windows drive paths take
|
|
10742
|
+
* precedence over URLs. Other parseable absolute URLs are not file links.
|
|
10743
|
+
* Fragments take precedence over colon suffixes; invalid locations open the
|
|
10744
|
+
* file without selecting a line. Columns are consumed but not selected.
|
|
10745
|
+
* Percent-encode literal `?`, `#`, and numeric colon suffixes in filenames.
|
|
10746
|
+
* @param value - Parsed Markdown link destination.
|
|
10747
|
+
* @returns A local path and optional first line, or undefined for URLs,
|
|
10748
|
+
* fragment-only links, queries, malformed escapes, or control characters.
|
|
10749
|
+
*/
|
|
10750
|
+
function parseFileLink(value) {
|
|
10751
|
+
const hash = value.indexOf("#");
|
|
10752
|
+
const destination = hash < 0 ? value : value.slice(0, hash);
|
|
10753
|
+
if (destination.includes("?")) return void 0;
|
|
10754
|
+
let path;
|
|
10755
|
+
try {
|
|
10756
|
+
path = decodeURIComponent(destination);
|
|
10757
|
+
} catch (_error) {
|
|
10758
|
+
return;
|
|
10759
|
+
}
|
|
10760
|
+
if (path.length === 0 || /[\u0000-\u001f\u007f]/.test(path)) return void 0;
|
|
10761
|
+
if (!isExplicitFilePath(path) && URL.canParse(path)) return void 0;
|
|
10762
|
+
const suffix = hash < 0 ? /:(\d+)(?::\d+|-(\d+))?$/.exec(destination) : null;
|
|
10763
|
+
if (suffix !== null) path = path.slice(0, -suffix[0].length);
|
|
10764
|
+
if (path.length === 0) return void 0;
|
|
10765
|
+
const match = suffix ?? (hash < 0 ? null : /^L(\d+)(?:-L(\d+))?$/.exec(value.slice(hash + 1)));
|
|
10766
|
+
if (match === null) return { path };
|
|
10767
|
+
const line = Number(match[1]);
|
|
10768
|
+
const end = match[2] === void 0 ? line : Number(match[2]);
|
|
10769
|
+
if (!Number.isSafeInteger(line) || !Number.isSafeInteger(end) || line < 1 || end < line) return { path };
|
|
10770
|
+
return {
|
|
10771
|
+
path,
|
|
10772
|
+
line
|
|
10773
|
+
};
|
|
10774
|
+
}
|
|
10775
|
+
//#endregion
|
|
10172
10776
|
//#region lib/types/markdown/MarkdownDelegate.js
|
|
10173
10777
|
/** Consumer-owned navigation for Markdown links. */
|
|
10174
10778
|
const MarkdownDelegateContext = createContext({});
|
|
@@ -10178,17 +10782,19 @@ const MarkdownDelegateContext = createContext({});
|
|
|
10178
10782
|
* @param props - Child tree and its file and HTTP(S) link handlers.
|
|
10179
10783
|
* @returns the scoped child tree.
|
|
10180
10784
|
*/
|
|
10181
|
-
function MarkdownDelegateProvider({ children, openExternalLink, openFile, fileImages, getTriggerProps }) {
|
|
10785
|
+
function MarkdownDelegateProvider({ children, openExternalLink, openFile, fileImages, getTriggerProps, renderCode }) {
|
|
10182
10786
|
const delegate = useMemo(() => ({
|
|
10183
10787
|
openExternalLink,
|
|
10184
10788
|
openFile,
|
|
10185
10789
|
fileImages,
|
|
10186
|
-
getTriggerProps
|
|
10790
|
+
getTriggerProps,
|
|
10791
|
+
renderCode
|
|
10187
10792
|
}), [
|
|
10188
10793
|
openExternalLink,
|
|
10189
10794
|
openFile,
|
|
10190
10795
|
fileImages,
|
|
10191
|
-
getTriggerProps
|
|
10796
|
+
getTriggerProps,
|
|
10797
|
+
renderCode
|
|
10192
10798
|
]);
|
|
10193
10799
|
return jsx(MarkdownDelegateContext.Provider, {
|
|
10194
10800
|
value: delegate,
|
|
@@ -10517,16 +11123,44 @@ function renderCode(node, key, context) {
|
|
|
10517
11123
|
const language = node.lang ?? void 0;
|
|
10518
11124
|
if (node.value === "") return jsx("pre", { children: jsx("code", { className: language === void 0 ? void 0 : `language-${language}` }) }, key);
|
|
10519
11125
|
const lang = language === void 0 ? void 0 : /^[\w-]+/.exec(language)?.[0];
|
|
10520
|
-
if (
|
|
10521
|
-
|
|
10522
|
-
|
|
11126
|
+
if (lang === void 0) return jsx(FenceCodeBlock, {
|
|
11127
|
+
code: node.value,
|
|
11128
|
+
streaming: context.streaming,
|
|
11129
|
+
labels: context.labels.code
|
|
11130
|
+
}, key);
|
|
11131
|
+
return jsx(MarkdownFenceSeat, {
|
|
10523
11132
|
lang,
|
|
11133
|
+
meta: node.meta ?? void 0,
|
|
11134
|
+
code: node.value,
|
|
10524
11135
|
streaming: context.streaming,
|
|
10525
|
-
|
|
10526
|
-
copiedLabel: context.labels.code.copiedLabel,
|
|
10527
|
-
toolbarLabels: context.labels.code.toolbarLabels
|
|
11136
|
+
labels: context.labels.code
|
|
10528
11137
|
}, key);
|
|
10529
11138
|
}
|
|
11139
|
+
/**
|
|
11140
|
+
* One fence whose language is final: the delegate's renderer when the owner
|
|
11141
|
+
* supplies one, otherwise the built-in math and code blocks. Reading the
|
|
11142
|
+
* delegate in this Component rather than in the render pass lets cached
|
|
11143
|
+
* streaming elements follow a provider change.
|
|
11144
|
+
*/
|
|
11145
|
+
function MarkdownFenceSeat({ lang, meta, code, streaming, labels }) {
|
|
11146
|
+
const { renderCode } = useMarkdownDelegate();
|
|
11147
|
+
if (renderCode !== void 0) return jsx("div", {
|
|
11148
|
+
className: markdownCss.fenceSeat,
|
|
11149
|
+
children: renderCode({
|
|
11150
|
+
lang: lang.toLowerCase(),
|
|
11151
|
+
code,
|
|
11152
|
+
streaming,
|
|
11153
|
+
meta
|
|
11154
|
+
})
|
|
11155
|
+
});
|
|
11156
|
+
if (!streaming && lang === "math") return jsx(FenceMathBlock, { code });
|
|
11157
|
+
return jsx(FenceCodeBlock, {
|
|
11158
|
+
lang,
|
|
11159
|
+
code,
|
|
11160
|
+
streaming,
|
|
11161
|
+
labels
|
|
11162
|
+
});
|
|
11163
|
+
}
|
|
10530
11164
|
/** A list is loose when it or any of its items is spread; every item then keeps its paragraphs. */
|
|
10531
11165
|
function listLoose(list) {
|
|
10532
11166
|
return (list.spread ?? false) || list.children.some(listItemLoose);
|
|
@@ -11020,6 +11654,8 @@ var StreamingRenderer = class {
|
|
|
11020
11654
|
* including `#L24` / `#L24-L30` fragments and `:24` / `:24-30` / `:24:5` suffixes
|
|
11021
11655
|
* (ranges open at their first line, columns are ignored, and invalid locations
|
|
11022
11656
|
* open only the file; see the README for URL/path classification).
|
|
11657
|
+
* Copying a selection inside the document writes selected formulas as
|
|
11658
|
+
* `$…$` / `$$…$$` TeX source.
|
|
11023
11659
|
* @returns A GFM document with TeX math rendered through KaTeX; raw HTML never
|
|
11024
11660
|
* renders as markup, and unsafe protocols are disabled. Local links without an opener remain text;
|
|
11025
11661
|
* absolute HTTP(S) images render directly.
|
|
@@ -11049,6 +11685,9 @@ const MarkdownText = memo(function MarkdownText({ text, streaming = false, label
|
|
|
11049
11685
|
className: clsx(markdownCss.markdown, variant === "compact" && markdownCss.compact),
|
|
11050
11686
|
"data-text-interaction-source": textInteractionSource ? "" : void 0,
|
|
11051
11687
|
"data-markdown-variant": variant === "compact" ? variant : void 0,
|
|
11688
|
+
onCopy: (event) => {
|
|
11689
|
+
copyKatexAsTex(event.nativeEvent, event.currentTarget);
|
|
11690
|
+
},
|
|
11052
11691
|
children
|
|
11053
11692
|
});
|
|
11054
11693
|
});
|
|
@@ -11737,10 +12376,10 @@ function QuoteMarkIcon({ className }) {
|
|
|
11737
12376
|
/**
|
|
11738
12377
|
* Render one width-capped quote preview shared by editable drafts and sent messages.
|
|
11739
12378
|
* 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.
|
|
12379
|
+
* @param props - selected text, optional summary, and optional localized removal action.
|
|
12380
|
+
* @returns a non-navigating quote preview with a full-text popover only while clipped, or a summary popover.
|
|
11742
12381
|
*/
|
|
11743
|
-
function QuotePreview({ text, removal }) {
|
|
12382
|
+
function QuotePreview({ text, summary, removal }) {
|
|
11744
12383
|
const sourceRef = useRef(null);
|
|
11745
12384
|
const [truncated, setTruncated] = useState(false);
|
|
11746
12385
|
useLayoutEffect(() => {
|
|
@@ -11791,7 +12430,21 @@ function QuotePreview({ text, removal }) {
|
|
|
11791
12430
|
ref: sourceRef,
|
|
11792
12431
|
className: css$43.source,
|
|
11793
12432
|
"data-quote-preview-text": "",
|
|
11794
|
-
children: text
|
|
12433
|
+
children: summary === void 0 ? text : jsxs(Fragment, { children: [
|
|
12434
|
+
jsx("span", {
|
|
12435
|
+
"aria-hidden": "true",
|
|
12436
|
+
children: summary.label
|
|
12437
|
+
}),
|
|
12438
|
+
jsx("span", {
|
|
12439
|
+
className: css$43.visuallyHidden,
|
|
12440
|
+
children: summary.detail === void 0 ? summary.title : `${summary.title} ${summary.detail}`
|
|
12441
|
+
}),
|
|
12442
|
+
" ",
|
|
12443
|
+
jsx("span", {
|
|
12444
|
+
className: css$43.inlineBody,
|
|
12445
|
+
children: summary.body
|
|
12446
|
+
})
|
|
12447
|
+
] })
|
|
11795
12448
|
})]
|
|
11796
12449
|
});
|
|
11797
12450
|
return jsx(HoverCard, {
|
|
@@ -11799,13 +12452,31 @@ function QuotePreview({ text, removal }) {
|
|
|
11799
12452
|
grouped: true,
|
|
11800
12453
|
fitContent: true,
|
|
11801
12454
|
openDelayMs: 0,
|
|
11802
|
-
disabled: !truncated,
|
|
12455
|
+
disabled: summary === void 0 && !truncated,
|
|
11803
12456
|
anchor: preview,
|
|
11804
|
-
content: jsx("span", {
|
|
12457
|
+
content: summary === void 0 ? jsx("span", {
|
|
11805
12458
|
className: css$43.popoverText,
|
|
11806
12459
|
"data-quote-popover": "",
|
|
11807
12460
|
"aria-hidden": "true",
|
|
11808
12461
|
children: text
|
|
12462
|
+
}) : jsxs("span", {
|
|
12463
|
+
className: css$43.summary,
|
|
12464
|
+
"data-quote-popover": "",
|
|
12465
|
+
"aria-hidden": "true",
|
|
12466
|
+
children: [
|
|
12467
|
+
jsx("span", {
|
|
12468
|
+
className: css$43.summaryTitle,
|
|
12469
|
+
children: summary.title
|
|
12470
|
+
}),
|
|
12471
|
+
summary.detail !== void 0 && jsx("span", {
|
|
12472
|
+
className: css$43.summaryDetail,
|
|
12473
|
+
children: summary.detail
|
|
12474
|
+
}),
|
|
12475
|
+
jsx("span", {
|
|
12476
|
+
className: css$43.summaryBody,
|
|
12477
|
+
children: summary.body
|
|
12478
|
+
})
|
|
12479
|
+
]
|
|
11809
12480
|
})
|
|
11810
12481
|
});
|
|
11811
12482
|
}
|
|
@@ -11821,6 +12492,6 @@ function formatQuoteText(text) {
|
|
|
11821
12492
|
return text.replace(/\r\n?/gu, "\n").split("\n").map((line) => `> ${line}`).join("\n");
|
|
11822
12493
|
}
|
|
11823
12494
|
//#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,
|
|
12495
|
+
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, 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
12496
|
|
|
11826
12497
|
//# sourceMappingURL=index.js.map
|