@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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
.bubble {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: safe center;
|
|
4
|
+
gap: 8px;
|
|
5
|
+
position: fixed;
|
|
6
|
+
z-index: 100;
|
|
7
|
+
/* Fixed-position shrink-to-fit measures only the space from `left` to the
|
|
8
|
+
viewport edge, so anchors near the right edge would wrap early;
|
|
9
|
+
max-content sizes by the label alone, capped at half the viewport. */
|
|
10
|
+
width: max-content;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
max-width: min(50vw, calc(100vw - 24px));
|
|
13
|
+
max-height: calc(100vh - 24px);
|
|
14
|
+
overflow: auto;
|
|
15
|
+
padding: 3px 7px;
|
|
16
|
+
border-radius: var(--dsw-radius-sm);
|
|
17
|
+
background: var(--dsw-alias-tooltip-bg);
|
|
18
|
+
color: var(--dsw-alias-tooltip-label);
|
|
19
|
+
font-size: 13px;
|
|
20
|
+
line-height: 20px;
|
|
21
|
+
white-space: pre-line;
|
|
22
|
+
/* Unbreakable tokens (URLs, paths) must not push past max-width. */
|
|
23
|
+
overflow-wrap: break-word;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
animation: tooltip-in 150ms var(--ds-ease-in-out);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.bubble[data-portal] { z-index: 1100; }
|
|
29
|
+
:global(:where(html[data-platform='darwin'])) .bubble { -webkit-app-region: no-drag; }
|
|
30
|
+
.bubble[data-pinned] { pointer-events: auto; }
|
|
31
|
+
.label { min-width: 0; }
|
|
32
|
+
|
|
33
|
+
/* A 16px keycap centered beside a 20px label has 5px of vertical clearance. */
|
|
34
|
+
.bubble[data-has-shortcut] { padding-inline-end: 5px; }
|
|
35
|
+
.bubble[data-has-shortcut]:not(:has(.label)) { padding: 3px; }
|
|
36
|
+
|
|
37
|
+
.bubble[data-side='right'],
|
|
38
|
+
.bubble[data-side='left'] {
|
|
39
|
+
transform: translateY(-50%);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.bubble[data-side='bottom'] {
|
|
43
|
+
transform: translateX(-50%);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.bubble[data-side='top'] {
|
|
47
|
+
transform: translate(-50%, -100%);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* End alignment: `left` carries the anchor's right edge, so the bubble sits
|
|
51
|
+
fully left of it instead of centering. */
|
|
52
|
+
.bubble[data-side='bottom'][data-align='end'] {
|
|
53
|
+
transform: translateX(-100%);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.bubble[data-side='top'][data-align='end'] {
|
|
57
|
+
transform: translate(-100%, -100%);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@keyframes tooltip-in {
|
|
61
|
+
from { opacity: 0; }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@media (prefers-reduced-motion: reduce) {
|
|
65
|
+
.bubble {
|
|
66
|
+
animation: none;
|
|
67
|
+
}
|
|
68
|
+
}
|
package/src/Tooltip.tsx
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/** Anchor-preserving tooltips; an optional body portal escapes clipping containers and stacking contexts that cap the bubble's z-index. */
|
|
2
|
+
|
|
3
|
+
import { cloneElement, createContext, useCallback, useContext, useEffect, useId, useRef, useState } from 'react'
|
|
4
|
+
import type { FocusEventHandler, MouseEventHandler, MutableRefObject, PointerEventHandler, ReactElement, Ref } from 'react'
|
|
5
|
+
import { createPortal } from 'react-dom'
|
|
6
|
+
import { ShortcutKeys } from './ShortcutKeys.tsx'
|
|
7
|
+
import { placeTooltip, type TooltipSide } from './tooltip-placement.ts'
|
|
8
|
+
import { useDismissOnOutsidePointer } from './useDismissOnOutsidePointer.ts'
|
|
9
|
+
import css from './Tooltip.module.css'
|
|
10
|
+
// Tooltips take the wide answer — any key returns to the keyboard. Focus rings read the
|
|
11
|
+
// narrower `data-input-modality` attribute the same module publishes.
|
|
12
|
+
import { pointerModality } from './input-modality.ts'
|
|
13
|
+
|
|
14
|
+
export type { TooltipSide } from './tooltip-placement.ts'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Suppression channel for nested tooltips: a visible descendant tooltip
|
|
18
|
+
* withdraws the enclosing tooltip while its bubble is shown.
|
|
19
|
+
*/
|
|
20
|
+
export const TooltipSuppression = createContext<((suppressed: boolean) => void) | null>(null)
|
|
21
|
+
|
|
22
|
+
/** Props Tooltip injects into its anchor child; the child's own handlers are chained ahead of the tooltip's. */
|
|
23
|
+
interface AnchorProps {
|
|
24
|
+
'aria-describedby'?: string | undefined
|
|
25
|
+
ref?: Ref<HTMLElement> | undefined
|
|
26
|
+
onPointerEnter?: PointerEventHandler | undefined
|
|
27
|
+
onPointerLeave?: PointerEventHandler | undefined
|
|
28
|
+
onPointerDown?: PointerEventHandler | undefined
|
|
29
|
+
onClick?: MouseEventHandler | undefined
|
|
30
|
+
onFocus?: FocusEventHandler | undefined
|
|
31
|
+
onBlur?: FocusEventHandler | undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type TooltipLabel = string | (() => string)
|
|
35
|
+
|
|
36
|
+
function clipped(anchor: HTMLElement): boolean {
|
|
37
|
+
return [anchor, ...anchor.querySelectorAll<HTMLElement>('*')]
|
|
38
|
+
.some(el => el instanceof HTMLElement && el.scrollWidth > el.clientWidth)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Attach a hover/focus tooltip to an anchor element.
|
|
43
|
+
* @param props.label - bubble text, or a resolver evaluated only while visible; an empty string shows only shortcut keys.
|
|
44
|
+
* @param props.shortcutKeys - effective key labels rendered as platform-formatted keycaps after optional text.
|
|
45
|
+
* @param props.side - preferred placement (default 'right'); fitting tries the opposite then perpendicular sides.
|
|
46
|
+
* @param props.align - horizontal anchor-edge alignment for 'bottom'/'top' bubbles: 'end' pins
|
|
47
|
+
* the bubble's right edge to the anchor's (for anchors beside other hover surfaces the centered
|
|
48
|
+
* bubble would overlap); default 'center'. Horizontal placements ignore it.
|
|
49
|
+
* @param props.portal - render the bubble under document.body, so an ancestor's clipping or its
|
|
50
|
+
* stacking context (which confines the bubble's z-index to that context) cannot hide it.
|
|
51
|
+
* @param props.delayMs - hover delay in milliseconds (default 0).
|
|
52
|
+
* @param props.focusDelayMs - keyboard focus delay in milliseconds (default 0); blur, click,
|
|
53
|
+
* mouse leave, disabling, and unmount cancel a pending show.
|
|
54
|
+
* @param props.gap - anchor-to-bubble distance in pixels for 'bottom'/'top' bubbles (default 8);
|
|
55
|
+
* horizontal placements use 10px, including after a flip.
|
|
56
|
+
* @param props.disabled - suppress the bubble while true; the anchor renders identically so
|
|
57
|
+
* toggling never remounts it (which would cut its CSS transitions).
|
|
58
|
+
* @param props.maxWidth - bubble width cap in pixels, for labels long enough that the default
|
|
59
|
+
* half-viewport cap would render a slab wider than the surface the anchor sits on; always bounded by viewport margins.
|
|
60
|
+
* @param props.openOnClick - clicking or tapping also pins the bubble for reading; another click, Escape,
|
|
61
|
+
* Tab, or an outside pointerdown dismisses it. Defaults to false for ordinary action tooltips.
|
|
62
|
+
* @param props.onlyWhenClipped - show the bubble only when the anchor or an HTML element inside it
|
|
63
|
+
* overflows horizontally, measured when the bubble is about to show; for labels that repeat
|
|
64
|
+
* text an ellipsis may cut off. Defaults to false.
|
|
65
|
+
* @param props.children - a single anchor element; its own ref (callback or object) is forwarded alongside the tooltip's.
|
|
66
|
+
* @returns the cloned anchor plus a fixed-position bubble, optionally portaled to the body.
|
|
67
|
+
* The bubble stays hidden until ResizeObserver supplies its size for viewport fitting; clicking the
|
|
68
|
+
* anchor dismisses the bubble unless openOnClick is enabled, and focus arriving after a pointer
|
|
69
|
+
* interaction (a closing menu refocusing its trigger) never raises it. Touch cannot trigger hover
|
|
70
|
+
* tooltips; tapping still invokes the child's action and can open an openOnClick explanation.
|
|
71
|
+
* When no side fits, the viewport-bounded fallback may overlap the anchor; oversized content is scrollable when pinned.
|
|
72
|
+
*/
|
|
73
|
+
export function Tooltip({ label, shortcutKeys, side = 'right', align = 'center', delayMs = 0, focusDelayMs = 0, gap = 8, disabled = false, portal = false, maxWidth, openOnClick = false, onlyWhenClipped = false, children }: { label: TooltipLabel; shortcutKeys?: readonly string[] | undefined; side?: TooltipSide; align?: 'center' | 'end'; delayMs?: number; focusDelayMs?: number; gap?: number; disabled?: boolean; portal?: boolean; maxWidth?: number; openOnClick?: boolean; onlyWhenClipped?: boolean; children: ReactElement<AnchorProps> }) {
|
|
74
|
+
const id = useId()
|
|
75
|
+
const [pinned, setPinned] = useState(false)
|
|
76
|
+
const anchor = useRef<HTMLElement | null>(null)
|
|
77
|
+
// React 18 keeps the element's ref outside props; forward it so wrapping an
|
|
78
|
+
// anchor in Tooltip never silently severs the owner's ref.
|
|
79
|
+
const childRef = (children as ReactElement<AnchorProps> & { ref?: Ref<HTMLElement> }).ref
|
|
80
|
+
const mergedRef = useCallback((el: HTMLElement | null) => {
|
|
81
|
+
anchor.current = el
|
|
82
|
+
if (typeof childRef === 'function') childRef(el)
|
|
83
|
+
else if (childRef != null) (childRef as MutableRefObject<HTMLElement | null>).current = el
|
|
84
|
+
}, [childRef])
|
|
85
|
+
const [pos, setPos] = useState<DOMRect | null>(null)
|
|
86
|
+
const bubble = useRef<HTMLSpanElement | null>(null)
|
|
87
|
+
const resolvedLabel = pos === null
|
|
88
|
+
? null
|
|
89
|
+
: typeof label === 'function' ? label() : label
|
|
90
|
+
const showTimer = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
91
|
+
// Hover and focus are independent triggers: the bubble hides only after
|
|
92
|
+
// BOTH clear (hovering away from a focused anchor must not drop it).
|
|
93
|
+
const triggers = useRef({ hover: false, focus: false })
|
|
94
|
+
|
|
95
|
+
// A nested tooltip's bubble owns the pointer position, so this tooltip
|
|
96
|
+
// withdraws its own while a descendant shows one; the state below is set by
|
|
97
|
+
// the descendants this tooltip wraps. Announcing on every visibility change
|
|
98
|
+
// covers hide, disable, and unmount; show() also announces synchronously so
|
|
99
|
+
// a nested pair shown in one commit never paints both bubbles.
|
|
100
|
+
const suppressAncestors = useContext(TooltipSuppression)
|
|
101
|
+
const [suppressed, setSuppressed] = useState(false)
|
|
102
|
+
const announce = useCallback((active: boolean) => { suppressAncestors?.(active) }, [suppressAncestors])
|
|
103
|
+
const visible = pos !== null && !disabled
|
|
104
|
+
// ResizeObserver supplies the laid-out border box; fitting never reads
|
|
105
|
+
// geometry after a position write or needs a React commit to flip sides.
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
const el = bubble.current
|
|
108
|
+
if (pos === null || !visible || suppressed || el === null) return
|
|
109
|
+
let size: ResizeObserverSize | undefined
|
|
110
|
+
let anchorRect = pos
|
|
111
|
+
const fit = () => {
|
|
112
|
+
if (size === undefined) return
|
|
113
|
+
const placement = placeTooltip({
|
|
114
|
+
anchor: anchorRect, width: size.inlineSize, height: size.blockSize,
|
|
115
|
+
viewportWidth: window.innerWidth, viewportHeight: window.innerHeight, side, align, gap,
|
|
116
|
+
})
|
|
117
|
+
const horizontal = placement.side === 'right' || placement.side === 'left'
|
|
118
|
+
const offsetX = horizontal ? 0 : align === 'end' ? placement.width : placement.width / 2
|
|
119
|
+
const offsetY = horizontal ? placement.height / 2 : placement.side === 'top' ? placement.height : 0
|
|
120
|
+
el.style.left = `${placement.left + offsetX}px`
|
|
121
|
+
el.style.top = `${placement.top + offsetY}px`
|
|
122
|
+
el.dataset.side = placement.side
|
|
123
|
+
el.style.visibility = 'visible'
|
|
124
|
+
}
|
|
125
|
+
const onResize = () => {
|
|
126
|
+
if (anchor.current !== null) anchorRect = anchor.current.getBoundingClientRect()
|
|
127
|
+
fit()
|
|
128
|
+
}
|
|
129
|
+
const observer = new ResizeObserver((entries) => {
|
|
130
|
+
size = entries[0]?.borderBoxSize[0]
|
|
131
|
+
fit()
|
|
132
|
+
})
|
|
133
|
+
observer.observe(el, { box: 'border-box' })
|
|
134
|
+
window.addEventListener('resize', onResize)
|
|
135
|
+
return () => {
|
|
136
|
+
observer.disconnect()
|
|
137
|
+
window.removeEventListener('resize', onResize)
|
|
138
|
+
}
|
|
139
|
+
}, [align, gap, pos, side, suppressed, visible])
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
announce(visible)
|
|
142
|
+
return () => { announce(false) }
|
|
143
|
+
}, [announce, visible])
|
|
144
|
+
|
|
145
|
+
// Disabling mid-hover (e.g. clicking a rail control expands the sidebar)
|
|
146
|
+
// must drop an already-visible bubble: no mouseleave fires.
|
|
147
|
+
const cancelShow = useCallback(() => {
|
|
148
|
+
if (showTimer.current === null) return
|
|
149
|
+
clearTimeout(showTimer.current)
|
|
150
|
+
showTimer.current = null
|
|
151
|
+
}, [])
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (pinned && (disabled || !openOnClick)) setPinned(false)
|
|
154
|
+
if (disabled) {
|
|
155
|
+
cancelShow()
|
|
156
|
+
triggers.current = { hover: false, focus: false }
|
|
157
|
+
setPos(null)
|
|
158
|
+
}
|
|
159
|
+
return cancelShow
|
|
160
|
+
}, [cancelShow, disabled, openOnClick, pinned])
|
|
161
|
+
|
|
162
|
+
const show = () => {
|
|
163
|
+
if (disabled) return
|
|
164
|
+
const el = anchor.current
|
|
165
|
+
/* v8 ignore next -- the ref is attached by event time: events fire on the cloned anchor. */
|
|
166
|
+
if (el === null) return
|
|
167
|
+
if (onlyWhenClipped && !clipped(el)) return
|
|
168
|
+
setPos(el.getBoundingClientRect())
|
|
169
|
+
announce(true)
|
|
170
|
+
}
|
|
171
|
+
const showAfterDelay = (delay: number) => {
|
|
172
|
+
cancelShow()
|
|
173
|
+
if (delay <= 0) {
|
|
174
|
+
show()
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
showTimer.current = setTimeout(() => {
|
|
178
|
+
showTimer.current = null
|
|
179
|
+
show()
|
|
180
|
+
}, delay)
|
|
181
|
+
}
|
|
182
|
+
const withdraw = useCallback(() => {
|
|
183
|
+
setPinned(false)
|
|
184
|
+
setPos(null)
|
|
185
|
+
announce(false)
|
|
186
|
+
}, [announce])
|
|
187
|
+
const hide = () => {
|
|
188
|
+
cancelShow()
|
|
189
|
+
if (!triggers.current.hover && !triggers.current.focus && !pinned) withdraw()
|
|
190
|
+
}
|
|
191
|
+
const dismiss = useCallback(() => {
|
|
192
|
+
cancelShow()
|
|
193
|
+
triggers.current = { hover: false, focus: false }
|
|
194
|
+
withdraw()
|
|
195
|
+
}, [cancelShow, withdraw])
|
|
196
|
+
useDismissOnOutsidePointer(anchor, openOnClick && visible, dismiss, bubble)
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
if (!openOnClick || !visible) return
|
|
199
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
200
|
+
if (event.key !== 'Escape' && event.key !== 'Tab') return
|
|
201
|
+
if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation() }
|
|
202
|
+
dismiss()
|
|
203
|
+
}
|
|
204
|
+
document.addEventListener('keydown', onKeyDown, true)
|
|
205
|
+
return () => { document.removeEventListener('keydown', onKeyDown, true) }
|
|
206
|
+
}, [dismiss, openOnClick, visible])
|
|
207
|
+
|
|
208
|
+
const content = visible && !suppressed && (
|
|
209
|
+
<span
|
|
210
|
+
ref={bubble}
|
|
211
|
+
id={openOnClick ? id : undefined}
|
|
212
|
+
className={css.bubble}
|
|
213
|
+
data-side={side}
|
|
214
|
+
data-portal={portal || undefined}
|
|
215
|
+
data-pinned={pinned || undefined}
|
|
216
|
+
data-align={align}
|
|
217
|
+
data-has-shortcut={shortcutKeys?.length ? true : undefined}
|
|
218
|
+
style={{ left: pos.left, top: pos.top, visibility: 'hidden', ...maxWidth === undefined ? {} : { maxWidth: `min(${maxWidth}px, calc(100vw - 24px))` } }}
|
|
219
|
+
role="tooltip"
|
|
220
|
+
aria-label={shortcutKeys?.length ? [resolvedLabel, shortcutKeys.join(' ')].filter(Boolean).join(' ') : undefined}
|
|
221
|
+
>
|
|
222
|
+
{resolvedLabel && <span className={css.label}>{resolvedLabel}</span>}
|
|
223
|
+
{shortcutKeys !== undefined && shortcutKeys.length > 0 && <ShortcutKeys keys={shortcutKeys} variant="tooltip" />}
|
|
224
|
+
</span>
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
<TooltipSuppression.Provider value={setSuppressed}>
|
|
229
|
+
{cloneElement(children, {
|
|
230
|
+
ref: mergedRef,
|
|
231
|
+
'aria-describedby': openOnClick && visible
|
|
232
|
+
? [children.props['aria-describedby'], id].filter(Boolean).join(' ')
|
|
233
|
+
: children.props['aria-describedby'],
|
|
234
|
+
onPointerEnter: (e) => {
|
|
235
|
+
children.props.onPointerEnter?.(e)
|
|
236
|
+
if (e.pointerType === 'touch') return
|
|
237
|
+
// iOS can emit mouse entry when a tapped control replaces its icon.
|
|
238
|
+
if (e.pointerType === 'mouse' && !window.matchMedia('(any-hover: hover)').matches) return
|
|
239
|
+
triggers.current.hover = true
|
|
240
|
+
showAfterDelay(delayMs)
|
|
241
|
+
},
|
|
242
|
+
onPointerLeave: (e) => {
|
|
243
|
+
children.props.onPointerLeave?.(e)
|
|
244
|
+
triggers.current.hover = false
|
|
245
|
+
cancelShow()
|
|
246
|
+
if (!pinned) withdraw()
|
|
247
|
+
},
|
|
248
|
+
onPointerDown: (e) => {
|
|
249
|
+
children.props.onPointerDown?.(e)
|
|
250
|
+
if (e.pointerType === 'touch' && !pinned) dismiss()
|
|
251
|
+
},
|
|
252
|
+
// Activating an ordinary action dismisses the bubble: it often changes
|
|
253
|
+
// what the anchor now does (pin → unpin), and the click leaves the
|
|
254
|
+
// anchor focused, which would otherwise pin the relabelled bubble up.
|
|
255
|
+
onClick: (e) => {
|
|
256
|
+
children.props.onClick?.(e)
|
|
257
|
+
triggers.current.focus = false
|
|
258
|
+
cancelShow()
|
|
259
|
+
if (openOnClick && !disabled && !pinned) { setPinned(true); show() }
|
|
260
|
+
else withdraw()
|
|
261
|
+
},
|
|
262
|
+
onFocus: (e) => {
|
|
263
|
+
children.props.onFocus?.(e)
|
|
264
|
+
if (pointerModality()) return
|
|
265
|
+
triggers.current.focus = true
|
|
266
|
+
showAfterDelay(focusDelayMs)
|
|
267
|
+
},
|
|
268
|
+
onBlur: (e) => { children.props.onBlur?.(e); triggers.current.focus = false; hide() },
|
|
269
|
+
})}
|
|
270
|
+
{portal ? (content !== false && createPortal(content, document.body)) : content}
|
|
271
|
+
</TooltipSuppression.Provider>
|
|
272
|
+
)
|
|
273
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
.bubble {
|
|
2
|
+
max-width: 100%;
|
|
3
|
+
background: var(--dsw-specific-bubble);
|
|
4
|
+
border-radius: var(--dsw-radius-xl);
|
|
5
|
+
padding: 10px 16px;
|
|
6
|
+
font-size: var(--dsh-content-font-size, 14px);
|
|
7
|
+
line-height: calc(22px + var(--dsh-content-font-delta, 0px));
|
|
8
|
+
color: var(--dsw-alias-label-primary);
|
|
9
|
+
white-space: pre-wrap;
|
|
10
|
+
word-break: break-word;
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Shared user-message background, typography, and content inset. */
|
|
2
|
+
import type { ComponentPropsWithoutRef } from 'react'
|
|
3
|
+
import clsx from 'clsx'
|
|
4
|
+
import css from './UserMessageBubble.module.css'
|
|
5
|
+
|
|
6
|
+
/** Native div attributes for user-authored message content. */
|
|
7
|
+
export type UserMessageBubbleProps = ComponentPropsWithoutRef<'div'>
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Render user-style message content without row placement or actions.
|
|
11
|
+
* @param props - Native div attributes and the caller-owned content.
|
|
12
|
+
* @returns A theme-aware message surface that wraps its content.
|
|
13
|
+
*/
|
|
14
|
+
export function UserMessageBubble({ className, ...props }: UserMessageBubbleProps) {
|
|
15
|
+
return <div {...props} className={clsx(css.bubble, className)} />
|
|
16
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
.block {
|
|
2
|
+
--dsl-web-radius: var(--dsw-radius-lg);
|
|
3
|
+
|
|
4
|
+
margin: 16px 0;
|
|
5
|
+
padding: 12px 14px;
|
|
6
|
+
color: var(--dsw-alias-label-primary);
|
|
7
|
+
background: var(--dsw-alias-markdown-code-block);
|
|
8
|
+
border-radius: var(--dsl-web-radius);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* The provider answer reads as body prose above the citation list; its own
|
|
12
|
+
MarkdownText margins are trimmed so the list sits tight under it. */
|
|
13
|
+
.answer {
|
|
14
|
+
margin-bottom: 8px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.answer > :global(div) > :first-child {
|
|
18
|
+
margin-top: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.answer > :global(div) > :last-child {
|
|
22
|
+
margin-bottom: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* The citation list: ordered so each source reads as a numbered reference. The
|
|
26
|
+
whole list — the sources the tool returned, matching what the model saw —
|
|
27
|
+
renders here; a max-height caps the card so a long list scrolls in place
|
|
28
|
+
rather than growing the card unbounded. The height is a design constant of the
|
|
29
|
+
card's geometry, not a deployment choice, so it lives here rather than a plugin
|
|
30
|
+
config field.
|
|
31
|
+
|
|
32
|
+
`overflow-y` makes this a scroll container, which also clips inline-start
|
|
33
|
+
overflow: a marker wider than `padding-left` loses its leading digits with no
|
|
34
|
+
way to scroll them back. Markers are right-aligned to the content edge, so the
|
|
35
|
+
padding must fit the widest one the list can produce. `searchMaxResults` is an
|
|
36
|
+
unbounded positive integer, so the padding is sized in `em` — against this
|
|
37
|
+
element's own font, the one a marker inherits — to hold a three-digit marker
|
|
38
|
+
(`999. ` measures 2.35em in the app font stack) plus the gap the one-digit
|
|
39
|
+
case already had. */
|
|
40
|
+
.sources {
|
|
41
|
+
margin: 0;
|
|
42
|
+
padding-left: 2.5em;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: 10px;
|
|
46
|
+
max-height: 320px;
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.source {
|
|
51
|
+
min-width: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.sourceLink {
|
|
55
|
+
color: var(--dsw-alias-link);
|
|
56
|
+
font-size: 14px;
|
|
57
|
+
font-weight: 500;
|
|
58
|
+
line-height: 20px;
|
|
59
|
+
word-break: break-word;
|
|
60
|
+
text-decoration: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Leading URL glyph inside source and fetch links; rides the link color.
|
|
64
|
+
1.1em follows each link's own font size. */
|
|
65
|
+
.linkIcon {
|
|
66
|
+
width: 1.1em;
|
|
67
|
+
height: 1.1em;
|
|
68
|
+
vertical-align: -0.25em;
|
|
69
|
+
margin-right: 5px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.sourceLink:focus-visible {
|
|
73
|
+
text-decoration: underline dotted;
|
|
74
|
+
text-underline-offset: 3px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media (hover: hover) {
|
|
78
|
+
.sourceLink:hover {
|
|
79
|
+
text-decoration: underline dotted;
|
|
80
|
+
text-underline-offset: 3px;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.snippet {
|
|
85
|
+
margin-top: 2px;
|
|
86
|
+
color: var(--dsw-alias-label-secondary);
|
|
87
|
+
font-size: 13px;
|
|
88
|
+
line-height: 19px;
|
|
89
|
+
word-break: break-word;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.published {
|
|
93
|
+
margin-top: 2px;
|
|
94
|
+
color: var(--dsw-alias-label-tertiary);
|
|
95
|
+
font: var(--dsw-font-xs-13);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.truncated {
|
|
99
|
+
margin-top: 8px;
|
|
100
|
+
color: var(--dsw-alias-label-tertiary);
|
|
101
|
+
font: var(--dsw-font-xs-13);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.empty {
|
|
105
|
+
color: var(--dsw-alias-label-secondary);
|
|
106
|
+
font: var(--dsw-font-xs-13);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* The fetch card is a compact summary: the URL over a status/truncation row. */
|
|
110
|
+
.fetch {
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
gap: 6px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.fetchUrl {
|
|
117
|
+
color: var(--dsw-alias-link);
|
|
118
|
+
font-family: var(--ds-font-family-code);
|
|
119
|
+
font-size: 13px;
|
|
120
|
+
font-weight: 500;
|
|
121
|
+
line-height: 19px;
|
|
122
|
+
word-break: break-all;
|
|
123
|
+
text-decoration: none;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.fetchUrl:focus-visible {
|
|
127
|
+
text-decoration: underline dotted;
|
|
128
|
+
text-underline-offset: 3px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@media (hover: hover) {
|
|
132
|
+
.fetchUrl:hover {
|
|
133
|
+
text-decoration: underline dotted;
|
|
134
|
+
text-underline-offset: 3px;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.fetchMeta {
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: baseline;
|
|
141
|
+
gap: 12px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.status {
|
|
145
|
+
color: var(--dsw-alias-label-secondary);
|
|
146
|
+
font: var(--dsw-font-xs-13);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* The fetch card's truncation note sits inline beside the status, so it drops
|
|
150
|
+
the search card's top margin. */
|
|
151
|
+
.fetch .truncated {
|
|
152
|
+
margin-top: 0;
|
|
153
|
+
}
|