@diegopluna/narvi 0.0.2 → 0.2.0
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.md +116 -44
- package/dist/base.css +96 -0
- package/dist/color.d.ts +1 -1
- package/dist/color.js +1 -1
- package/dist/components/activity/ActivityContent.svelte +3 -15
- package/dist/components/activity/ActivityStep.svelte +12 -12
- package/dist/components/activity/ActivityThought.svelte +4 -4
- package/dist/components/activity/ActivityTrigger.svelte +5 -6
- package/dist/components/app-shell/AppShellBar.svelte +89 -0
- package/dist/components/app-shell/AppShellBar.svelte.d.ts +20 -0
- package/dist/components/app-shell/AppShellHeader.svelte +17 -17
- package/dist/components/app-shell/AppShellHeader.svelte.d.ts +2 -2
- package/dist/components/app-shell/AppShellMain.svelte +4 -20
- package/dist/components/app-shell/AppShellPanel.svelte +21 -19
- package/dist/components/app-shell/AppShellPanes.svelte +58 -0
- package/dist/components/app-shell/AppShellPanes.svelte.d.ts +11 -0
- package/dist/components/app-shell/AppShellRail.svelte +85 -0
- package/dist/components/app-shell/AppShellRail.svelte.d.ts +11 -0
- package/dist/components/app-shell/AppShellRoot.svelte +50 -24
- package/dist/components/app-shell/AppShellRoot.svelte.d.ts +8 -6
- package/dist/components/app-shell/AppShellSheet.svelte +95 -0
- package/dist/components/app-shell/AppShellSheet.svelte.d.ts +17 -0
- package/dist/components/app-shell/AppShellSidebar.svelte +41 -65
- package/dist/components/app-shell/AppShellSidebar.svelte.d.ts +1 -5
- package/dist/components/app-shell/AppShellToggle.svelte +62 -23
- package/dist/components/app-shell/AppShellToggle.svelte.d.ts +2 -0
- package/dist/components/app-shell/context.d.ts +6 -0
- package/dist/components/app-shell/index.d.ts +9 -1
- package/dist/components/app-shell/index.js +5 -1
- package/dist/components/approval/Approval.svelte +99 -23
- package/dist/components/approval/Approval.svelte.d.ts +7 -0
- package/dist/components/avatar/AvatarFallback.svelte +1 -2
- package/dist/components/avatar/AvatarRoot.svelte +2 -2
- package/dist/components/badge/Badge.svelte +5 -5
- package/dist/components/button/Button.svelte +227 -51
- package/dist/components/button/Button.svelte.d.ts +38 -2
- package/dist/components/card/Card.svelte +19 -33
- package/dist/components/change-stats/ChangeStats.svelte +1 -2
- package/dist/components/changes-summary/ChangesSummary.svelte +14 -15
- package/dist/components/checkbox/Checkbox.svelte +31 -25
- package/dist/components/checkbox/Checkbox.svelte.d.ts +5 -0
- package/dist/components/code/Code.svelte +1 -2
- package/dist/components/collapsible/CollapsibleContent.svelte +38 -0
- package/dist/components/collapsible/CollapsibleContent.svelte.d.ts +11 -0
- package/dist/components/collapsible/CollapsibleRoot.svelte +44 -0
- package/dist/components/collapsible/CollapsibleRoot.svelte.d.ts +11 -0
- package/dist/components/collapsible/CollapsibleTrigger.svelte +83 -0
- package/dist/components/collapsible/CollapsibleTrigger.svelte.d.ts +13 -0
- package/dist/components/collapsible/context.d.ts +5 -0
- package/dist/components/collapsible/context.js +11 -0
- package/dist/components/collapsible/index.d.ts +7 -0
- package/dist/components/collapsible/index.js +4 -0
- package/dist/components/command/CommandItem.svelte +1 -1
- package/dist/components/command/styles.d.ts +3 -2
- package/dist/components/command/styles.js +15 -12
- package/dist/components/composer/ComposerAttachButton.svelte +1 -1
- package/dist/components/composer/ComposerAttachment.svelte +13 -18
- package/dist/components/composer/ComposerModelPicker.svelte +24 -28
- package/dist/components/composer/ComposerRoot.svelte +15 -13
- package/dist/components/composer/ComposerSubmit.svelte +12 -20
- package/dist/components/composer/ComposerTextarea.svelte +1 -1
- package/dist/components/composer/ComposerToggle.svelte +16 -18
- package/dist/components/composer/ComposerTray.svelte +78 -0
- package/dist/components/composer/ComposerTray.svelte.d.ts +15 -0
- package/dist/components/composer/index.d.ts +3 -1
- package/dist/components/composer/index.js +3 -2
- package/dist/components/conversation/ConversationContent.svelte +3 -2
- package/dist/components/conversation/ConversationEmpty.svelte +1 -1
- package/dist/components/conversation/ConversationScrollButton.svelte +9 -11
- package/dist/components/dialog/ConfirmDialog.svelte +1 -1
- package/dist/components/dialog/DialogContent.svelte +5 -1
- package/dist/components/dialog/styles.d.ts +2 -26
- package/dist/components/dialog/styles.js +12 -49
- package/dist/components/divider/Divider.svelte +3 -3
- package/dist/components/empty-state/EmptyState.svelte +4 -5
- package/dist/components/field/Field.svelte +4 -4
- package/dist/components/frame/Frame.svelte +6 -7
- package/dist/components/frame/Frame.svelte.d.ts +1 -1
- package/dist/components/grid/Grid.svelte +111 -0
- package/dist/components/grid/Grid.svelte.d.ts +27 -0
- package/dist/components/heading/Heading.svelte +2 -2
- package/dist/components/hover-card/HoverCardContent.svelte +50 -0
- package/dist/components/hover-card/HoverCardContent.svelte.d.ts +10 -0
- package/dist/components/hover-card/HoverCardRoot.svelte +22 -0
- package/dist/components/hover-card/HoverCardRoot.svelte.d.ts +5 -0
- package/dist/components/hover-card/index.d.ts +7 -0
- package/dist/components/hover-card/index.js +7 -0
- package/dist/components/kbd/Kbd.svelte +12 -7
- package/dist/components/link/Link.svelte +9 -7
- package/dist/components/link/Link.svelte.d.ts +4 -1
- package/dist/components/markdown/Markdown.svelte +714 -0
- package/dist/components/markdown/Markdown.svelte.d.ts +80 -0
- package/dist/components/markdown/MarkdownBlock.svelte +231 -0
- package/dist/components/markdown/MarkdownBlock.svelte.d.ts +11 -0
- package/dist/components/markdown/MarkdownBlocks.svelte +115 -0
- package/dist/components/markdown/MarkdownBlocks.svelte.d.ts +15 -0
- package/dist/components/markdown/MarkdownCode.svelte +583 -0
- package/dist/components/markdown/MarkdownCode.svelte.d.ts +23 -0
- package/dist/components/markdown/MarkdownDiagram.svelte +310 -0
- package/dist/components/markdown/MarkdownDiagram.svelte.d.ts +6 -0
- package/dist/components/markdown/MarkdownFile.svelte +134 -0
- package/dist/components/markdown/MarkdownFile.svelte.d.ts +19 -0
- package/dist/components/markdown/MarkdownFootnotes.svelte +61 -0
- package/dist/components/markdown/MarkdownFootnotes.svelte.d.ts +8 -0
- package/dist/components/markdown/MarkdownFresh.svelte +69 -0
- package/dist/components/markdown/MarkdownFresh.svelte.d.ts +6 -0
- package/dist/components/markdown/MarkdownHtml.svelte +72 -0
- package/dist/components/markdown/MarkdownHtml.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownImage.svelte +150 -0
- package/dist/components/markdown/MarkdownImage.svelte.d.ts +8 -0
- package/dist/components/markdown/MarkdownInlines.svelte +225 -0
- package/dist/components/markdown/MarkdownInlines.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownLink.svelte +120 -0
- package/dist/components/markdown/MarkdownLink.svelte.d.ts +25 -0
- package/dist/components/markdown/MarkdownMath.svelte +138 -0
- package/dist/components/markdown/MarkdownMath.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownTable.svelte +265 -0
- package/dist/components/markdown/MarkdownTable.svelte.d.ts +17 -0
- package/dist/components/markdown/caret.d.ts +14 -0
- package/dist/components/markdown/caret.js +67 -0
- package/dist/components/markdown/context.d.ts +93 -0
- package/dist/components/markdown/context.js +128 -0
- package/dist/components/markdown/copy.d.ts +13 -0
- package/dist/components/markdown/copy.js +74 -0
- package/dist/components/markdown/hidden.d.ts +12 -0
- package/dist/components/markdown/hidden.js +31 -0
- package/dist/components/markdown/kept.d.ts +32 -0
- package/dist/components/markdown/kept.js +71 -0
- package/dist/components/markdown/labels.d.ts +46 -0
- package/dist/components/markdown/labels.js +35 -0
- package/dist/components/markdown/save.d.ts +11 -0
- package/dist/components/markdown/save.js +58 -0
- package/dist/components/markdown/scrollable.d.ts +24 -0
- package/dist/components/markdown/scrollable.js +152 -0
- package/dist/components/markdown/static.d.ts +37 -0
- package/dist/components/markdown/static.js +233 -0
- package/dist/components/markdown/styles.d.ts +328 -0
- package/dist/components/markdown/styles.js +302 -0
- package/dist/components/menu/MenuRadioItem.svelte +3 -3
- package/dist/components/menu/index.d.ts +23 -0
- package/dist/components/menu/index.js +3 -1
- package/dist/components/message/MessageAction.svelte +24 -5
- package/dist/components/message/MessageAction.svelte.d.ts +9 -0
- package/dist/components/message/MessageActions.svelte +2 -3
- package/dist/components/message/MessageContent.svelte +2 -3
- package/dist/components/message/MessageCopy.svelte +66 -8
- package/dist/components/message/MessageCopy.svelte.d.ts +17 -1
- package/dist/components/message/MessageHeader.svelte +3 -3
- package/dist/components/message/MessagePending.svelte +1 -1
- package/dist/components/message/MessageRoot.svelte +3 -4
- package/dist/components/message/MessageTime.svelte +3 -4
- package/dist/components/notice/Notice.svelte +14 -10
- package/dist/components/plan/Plan.svelte +25 -21
- package/dist/components/progress/Progress.svelte +34 -38
- package/dist/components/questionnaire/Questionnaire.svelte +19 -22
- package/dist/components/queued-message/QueuedMessage.svelte +14 -7
- package/dist/components/rail/RailItem.svelte +43 -40
- package/dist/components/rail/RailItem.svelte.d.ts +3 -1
- package/dist/components/rail/RailRoot.svelte +18 -4
- package/dist/components/rail/RailRoot.svelte.d.ts +1 -1
- package/dist/components/rail/RailSeparator.svelte +17 -0
- package/dist/components/rail/RailSeparator.svelte.d.ts +18 -0
- package/dist/components/rail/index.d.ts +2 -1
- package/dist/components/rail/index.js +2 -1
- package/dist/components/reasoning/ReasoningContent.svelte +4 -8
- package/dist/components/reasoning/ReasoningTrigger.svelte +4 -5
- package/dist/components/resize-handle/ResizeHandle.svelte +4 -7
- package/dist/components/reveal/Reveal.svelte +89 -0
- package/dist/components/reveal/Reveal.svelte.d.ts +17 -0
- package/dist/components/reveal/revealed.d.ts +38 -0
- package/dist/components/reveal/revealed.js +79 -0
- package/dist/components/segmented/SegmentedControl.svelte +11 -16
- package/dist/components/select/Select.svelte +1 -1
- package/dist/components/separator/Separator.svelte +1 -1
- package/dist/components/settings-row/SettingsRow.svelte +5 -5
- package/dist/components/sheet/SheetContent.svelte +63 -0
- package/dist/components/sheet/SheetContent.svelte.d.ts +18 -0
- package/dist/components/sheet/index.d.ts +12 -0
- package/dist/components/sheet/index.js +12 -0
- package/dist/components/sheet/styles.d.ts +51 -0
- package/dist/components/sheet/styles.js +65 -0
- package/dist/components/shimmer/Shimmer.svelte +41 -26
- package/dist/components/sidebar/SidebarContent.svelte +1 -1
- package/dist/components/sidebar/SidebarFolder.svelte +142 -0
- package/dist/components/sidebar/SidebarFolder.svelte.d.ts +19 -0
- package/dist/components/sidebar/SidebarFooter.svelte +1 -1
- package/dist/components/sidebar/SidebarGroup.svelte +41 -35
- package/dist/components/sidebar/SidebarGroup.svelte.d.ts +3 -3
- package/dist/components/sidebar/SidebarHeader.svelte +12 -6
- package/dist/components/sidebar/SidebarHeader.svelte.d.ts +4 -1
- package/dist/components/sidebar/SidebarItem.svelte +34 -38
- package/dist/components/sidebar/SidebarRoot.svelte +62 -0
- package/dist/components/sidebar/SidebarRoot.svelte.d.ts +14 -0
- package/dist/components/sidebar/index.d.ts +5 -1
- package/dist/components/sidebar/index.js +3 -1
- package/dist/components/skeleton/Skeleton.svelte +26 -15
- package/dist/components/slider/Slider.svelte +200 -0
- package/dist/components/slider/Slider.svelte.d.ts +55 -0
- package/dist/components/spinner/Spinner.svelte +4 -11
- package/dist/components/stack/Stack.svelte +37 -44
- package/dist/components/stack/Stack.svelte.d.ts +12 -6
- package/dist/components/status-indicator/StatusIndicator.svelte +1 -1
- package/dist/components/suggestions/SuggestionsItem.svelte +11 -13
- package/dist/components/switch/Switch.svelte +16 -25
- package/dist/components/tab-strip/TabStrip.svelte +340 -0
- package/dist/components/tab-strip/TabStrip.svelte.d.ts +31 -0
- package/dist/components/tabs/Tabs.svelte +15 -14
- package/dist/components/tabs/Tabs.svelte.d.ts +4 -0
- package/dist/components/text/Text.svelte +64 -14
- package/dist/components/text/Text.svelte.d.ts +13 -3
- package/dist/components/toast/Toaster.svelte +12 -10
- package/dist/components/toggle/Toggle.svelte +40 -0
- package/dist/components/toggle/Toggle.svelte.d.ts +15 -0
- package/dist/components/toggle-group/ToggleGroupItem.svelte +37 -0
- package/dist/components/toggle-group/ToggleGroupItem.svelte.d.ts +12 -0
- package/dist/components/toggle-group/ToggleGroupRoot.svelte +95 -0
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +33 -0
- package/dist/components/toggle-group/context.d.ts +6 -0
- package/dist/components/toggle-group/context.js +11 -0
- package/dist/components/toggle-group/index.d.ts +5 -0
- package/dist/components/toggle-group/index.js +3 -0
- package/dist/components/tool/ToolContent.svelte +3 -8
- package/dist/components/tool/ToolSection.svelte +4 -5
- package/dist/components/tool/ToolTrigger.svelte +14 -15
- package/dist/components/tooltip/TooltipContent.svelte +9 -6
- package/dist/components/work-fold/WorkFold.svelte +17 -34
- package/dist/components/work-fold/WorkFold.svelte.d.ts +1 -1
- package/dist/index.d.ts +38 -10
- package/dist/index.js +38 -12
- package/dist/internal/Chevron.svelte +2 -3
- package/dist/internal/Code.svelte +3 -4
- package/dist/internal/Collapse.svelte +6 -5
- package/dist/internal/Collapse.svelte.d.ts +2 -1
- package/dist/internal/Glyph.svelte +16 -0
- package/dist/internal/Glyph.svelte.d.ts +6 -0
- package/dist/internal/Tile.svelte +17 -37
- package/dist/internal/control.d.ts +4 -4
- package/dist/internal/control.js +21 -18
- package/dist/internal/layer.d.ts +3 -5
- package/dist/internal/layer.js +14 -18
- package/dist/internal/layout.d.ts +13 -0
- package/dist/internal/layout.js +453 -0
- package/dist/internal/markers.stylex.d.ts +8 -0
- package/dist/internal/markers.stylex.js +4 -0
- package/dist/internal/plugin-order.d.ts +8 -0
- package/dist/internal/plugin-order.js +16 -0
- package/dist/internal/responsive.d.ts +45 -0
- package/dist/internal/responsive.js +42 -0
- package/dist/internal/roving.js +5 -2
- package/dist/internal/shared.d.ts +8 -1
- package/dist/internal/shared.js +21 -5
- package/dist/internal/sx.d.ts +31 -4
- package/dist/internal/sx.js +17 -0
- package/dist/internal/toggle.d.ts +73 -0
- package/dist/internal/toggle.js +83 -0
- package/dist/internal/visible.d.ts +32 -0
- package/dist/internal/visible.js +44 -0
- package/dist/markdown/ast.d.ts +209 -0
- package/dist/markdown/ast.js +10 -0
- package/dist/markdown/blocks.d.ts +177 -0
- package/dist/markdown/blocks.js +1489 -0
- package/dist/markdown/code-info.d.ts +10 -0
- package/dist/markdown/code-info.js +16 -0
- package/dist/markdown/common.d.ts +25 -0
- package/dist/markdown/common.js +107 -0
- package/dist/markdown/diagrams.d.ts +2 -0
- package/dist/markdown/diagrams.js +18 -0
- package/dist/markdown/file-paths.d.ts +29 -0
- package/dist/markdown/file-paths.js +80 -0
- package/dist/markdown/files.d.ts +16 -0
- package/dist/markdown/files.js +133 -0
- package/dist/markdown/highlight.d.ts +30 -0
- package/dist/markdown/highlight.js +127 -0
- package/dist/markdown/html.d.ts +23 -0
- package/dist/markdown/html.js +289 -0
- package/dist/markdown/images.d.ts +15 -0
- package/dist/markdown/images.js +45 -0
- package/dist/markdown/index.d.ts +12 -0
- package/dist/markdown/index.js +5 -0
- package/dist/markdown/inlines.d.ts +48 -0
- package/dist/markdown/inlines.js +1714 -0
- package/dist/markdown/math.d.ts +2 -0
- package/dist/markdown/math.js +22 -0
- package/dist/markdown/parse.d.ts +81 -0
- package/dist/markdown/parse.js +204 -0
- package/dist/markdown/plugin.d.ts +178 -0
- package/dist/markdown/plugin.js +160 -0
- package/dist/markdown/sanitize.d.ts +78 -0
- package/dist/markdown/sanitize.js +522 -0
- package/dist/markdown/share.d.ts +12 -0
- package/dist/markdown/share.js +59 -0
- package/dist/markdown/table.d.ts +13 -0
- package/dist/markdown/table.js +60 -0
- package/dist/media.stylex.d.ts +52 -0
- package/dist/media.stylex.js +53 -0
- package/dist/preset.d.ts +40 -16
- package/dist/preset.js +169 -51
- package/dist/tokens.stylex.d.ts +70 -37
- package/dist/tokens.stylex.js +127 -62
- package/dist/typography.d.ts +48 -0
- package/dist/typography.js +55 -0
- package/dist/vite.d.ts +9 -1
- package/dist/vite.js +37 -4
- package/package.json +58 -6
- package/skills/building-ui/SKILL.md +242 -0
- package/skills/building-ui/references/components.md +207 -0
- package/skills/markdown/SKILL.md +452 -0
- package/skills/markdown/references/plugins.md +103 -0
- package/skills/setup/SKILL.md +191 -0
- package/skills/styling/SKILL.md +269 -0
- package/skills/theming/SKILL.md +184 -0
- package/dist/internal/loop.d.ts +0 -35
- package/dist/internal/loop.js +0 -72
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { shared } from '../../internal/shared.js';
|
|
7
7
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
8
8
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
9
|
+
import { media } from '../../media.stylex.js';
|
|
9
10
|
import { useConversation } from './context.js';
|
|
10
11
|
|
|
11
12
|
export type ConversationScrollButtonProps = Omit<HTMLButtonAttributes, 'children'> & {
|
|
@@ -17,9 +18,6 @@
|
|
|
17
18
|
children?: Snippet;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
21
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
22
|
-
|
|
23
21
|
const styles = stylex.create({
|
|
24
22
|
button: {
|
|
25
23
|
position: 'absolute',
|
|
@@ -36,15 +34,15 @@
|
|
|
36
34
|
marginInline: 'auto',
|
|
37
35
|
paddingInline: '0.5rem',
|
|
38
36
|
borderWidth: 0,
|
|
39
|
-
borderRadius: radius.
|
|
37
|
+
borderRadius: radius.pill,
|
|
40
38
|
backgroundColor: colors.bgRaised,
|
|
41
39
|
color: {
|
|
42
40
|
default: colors.textMuted,
|
|
43
|
-
':hover': { default: null, [
|
|
41
|
+
':hover': { default: null, [media.hover]: colors.text }
|
|
44
42
|
},
|
|
45
|
-
boxShadow: `inset 0 0 0 1px ${colors.
|
|
43
|
+
boxShadow: `inset 0 0 0 1px ${colors.borderStrong}, 0 8px 20px -8px ${colors.shadow}`,
|
|
46
44
|
fontFamily: font.body,
|
|
47
|
-
fontSize: font.
|
|
45
|
+
fontSize: font.sizeMeta,
|
|
48
46
|
fontWeight: font.weightMedium,
|
|
49
47
|
lineHeight: 1,
|
|
50
48
|
whiteSpace: 'nowrap',
|
|
@@ -53,10 +51,10 @@
|
|
|
53
51
|
// It rises into place, and drops away a little faster than it came
|
|
54
52
|
opacity: 1,
|
|
55
53
|
translate: '0 0',
|
|
56
|
-
scale: { default: null, ':active': { default: null, [
|
|
54
|
+
scale: { default: null, ':active': { default: null, [media.motion]: 0.96 } },
|
|
57
55
|
transitionProperty: {
|
|
58
56
|
default: 'opacity, color',
|
|
59
|
-
[
|
|
57
|
+
[media.motion]: 'opacity, translate, scale, color'
|
|
60
58
|
},
|
|
61
59
|
transitionDuration: motion.slow,
|
|
62
60
|
transitionTimingFunction: motion.easeOut
|
|
@@ -67,8 +65,8 @@
|
|
|
67
65
|
},
|
|
68
66
|
hidden: {
|
|
69
67
|
opacity: 0,
|
|
70
|
-
translate: { default: null, [
|
|
71
|
-
scale: { default: null, [
|
|
68
|
+
translate: { default: null, [media.motion]: '0 8px' },
|
|
69
|
+
scale: { default: null, [media.motion]: 0.94 },
|
|
72
70
|
pointerEvents: 'none',
|
|
73
71
|
transitionDuration: motion.base
|
|
74
72
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import Glyph from '../../internal/Glyph.svelte';
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
7
|
import Button from '../button/Button.svelte';
|
|
8
|
+
import { sheet } from '../sheet/styles.js';
|
|
8
9
|
import { dialog } from './styles.js';
|
|
9
10
|
|
|
10
11
|
export type DialogContentProps = Omit<Dialog.ContentProps, 'children' | 'child'> & {
|
|
@@ -37,7 +38,10 @@
|
|
|
37
38
|
<Dialog.Content
|
|
38
39
|
data-slot="dialog-content"
|
|
39
40
|
{...rest}
|
|
40
|
-
{...attrs(
|
|
41
|
+
{...attrs(
|
|
42
|
+
[dialog.content, side ? [sheet.sheet, sheet.md, sheet[side]] : dialog[size], sx],
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
41
45
|
>
|
|
42
46
|
{@render children?.()}
|
|
43
47
|
{#if closeLabel}
|
|
@@ -4,8 +4,7 @@ export declare const dialog: Readonly<{
|
|
|
4
4
|
readonly position: stylex.StyleXClassNameFor<"position", "fixed">;
|
|
5
5
|
readonly inset: stylex.StyleXClassNameFor<"inset", 0>;
|
|
6
6
|
readonly zIndex: stylex.StyleXClassNameFor<"zIndex", 50>;
|
|
7
|
-
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor",
|
|
8
|
-
readonly backdropFilter: stylex.StyleXClassNameFor<"backdropFilter", "blur(2px)">;
|
|
7
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
9
8
|
readonly opacity: stylex.StyleXClassNameFor<"opacity", 0 | 1>;
|
|
10
9
|
readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "opacity">;
|
|
11
10
|
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
@@ -25,7 +24,7 @@ export declare const dialog: Readonly<{
|
|
|
25
24
|
readonly translate: stylex.StyleXClassNameFor<"translate", "0 -50%">;
|
|
26
25
|
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
27
26
|
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
28
|
-
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", `inset 0 0 0 1px ${stylex.StyleXVar<string>},
|
|
27
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", `inset 0 0 0 1px ${stylex.StyleXVar<string>}, 0 24px 64px -16px ${stylex.StyleXVar<string>}`>;
|
|
29
28
|
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
30
29
|
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
|
|
31
30
|
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
@@ -48,29 +47,6 @@ export declare const dialog: Readonly<{
|
|
|
48
47
|
readonly lg: Readonly<{
|
|
49
48
|
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "44rem">;
|
|
50
49
|
}>;
|
|
51
|
-
readonly sheet: Readonly<{
|
|
52
|
-
readonly top: stylex.StyleXClassNameFor<"top", 0>;
|
|
53
|
-
readonly bottom: stylex.StyleXClassNameFor<"bottom", 0>;
|
|
54
|
-
readonly width: stylex.StyleXClassNameFor<"width", "min(26rem, calc(100vw - 2rem))">;
|
|
55
|
-
readonly maxHeight: stylex.StyleXClassNameFor<"maxHeight", "none">;
|
|
56
|
-
readonly marginInline: stylex.StyleXClassNameFor<"marginInline", 0>;
|
|
57
|
-
readonly translate: stylex.StyleXClassNameFor<"translate", "none">;
|
|
58
|
-
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", 0>;
|
|
59
|
-
readonly scale: stylex.StyleXClassNameFor<"scale", null>;
|
|
60
|
-
readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "opacity" | "opacity, translate">;
|
|
61
|
-
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
62
|
-
readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", "cubic-bezier(0.32, 0.72, 0, 1)">;
|
|
63
|
-
}>;
|
|
64
|
-
readonly end: Readonly<{
|
|
65
|
-
readonly insetInlineStart: stylex.StyleXClassNameFor<"insetInlineStart", "auto">;
|
|
66
|
-
readonly insetInlineEnd: stylex.StyleXClassNameFor<"insetInlineEnd", 0>;
|
|
67
|
-
readonly translate: stylex.StyleXClassNameFor<"translate", "0 0" | "100% 0" | null>;
|
|
68
|
-
}>;
|
|
69
|
-
readonly start: Readonly<{
|
|
70
|
-
readonly insetInlineStart: stylex.StyleXClassNameFor<"insetInlineStart", 0>;
|
|
71
|
-
readonly insetInlineEnd: stylex.StyleXClassNameFor<"insetInlineEnd", "auto">;
|
|
72
|
-
readonly translate: stylex.StyleXClassNameFor<"translate", "0 0" | "-100% 0" | null>;
|
|
73
|
-
}>;
|
|
74
50
|
readonly header: Readonly<{
|
|
75
51
|
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
76
52
|
readonly flexDirection: stylex.StyleXClassNameFor<"flexDirection", "column">;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
2
|
import { colors, font, motion, radius, space } from '../../tokens.stylex.js';
|
|
3
|
-
|
|
4
|
-
const FORCED = '@media (forced-colors: active)';
|
|
3
|
+
import { media } from '../../media.stylex.js';
|
|
5
4
|
const CLOSED = ':is([data-state="closed"])';
|
|
6
5
|
export const dialog = stylex.create({
|
|
7
6
|
overlay: {
|
|
8
7
|
position: 'fixed',
|
|
9
8
|
inset: 0,
|
|
10
9
|
zIndex: 50,
|
|
11
|
-
backgroundColor:
|
|
12
|
-
backdropFilter: 'blur(2px)',
|
|
10
|
+
backgroundColor: colors.scrim,
|
|
13
11
|
opacity: { default: 1, '@starting-style': 0, [CLOSED]: 0 },
|
|
14
12
|
transitionProperty: 'opacity',
|
|
15
13
|
transitionDuration: { default: motion.base, [CLOSED]: motion.fast },
|
|
@@ -30,62 +28,27 @@ export const dialog = stylex.create({
|
|
|
30
28
|
translate: '0 -50%',
|
|
31
29
|
borderRadius: radius.frame,
|
|
32
30
|
backgroundColor: colors.bgRaised,
|
|
33
|
-
boxShadow: `inset 0 0 0 1px ${colors.
|
|
31
|
+
boxShadow: `inset 0 0 0 1px ${colors.borderStrong}, 0 24px 64px -16px ${colors.shadow}`,
|
|
34
32
|
color: colors.text,
|
|
35
33
|
fontFamily: font.body,
|
|
36
|
-
fontSize: font.
|
|
34
|
+
fontSize: font.sizeBody,
|
|
37
35
|
lineHeight: font.leadingNormal,
|
|
38
36
|
outlineStyle: 'solid',
|
|
39
|
-
outlineWidth: { default: 0, [
|
|
37
|
+
outlineWidth: { default: 0, [media.forcedColors]: '1px' },
|
|
40
38
|
outlineColor: 'CanvasText',
|
|
41
39
|
// A modal is not tied to a trigger, so it grows from its own centre
|
|
42
40
|
opacity: { default: 1, '@starting-style': 0, [CLOSED]: 0 },
|
|
43
|
-
scale: {
|
|
44
|
-
|
|
41
|
+
scale: {
|
|
42
|
+
default: null,
|
|
43
|
+
[media.motion]: { default: 1, '@starting-style': 0.96, [CLOSED]: 0.98 }
|
|
44
|
+
},
|
|
45
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, scale' },
|
|
45
46
|
transitionDuration: { default: motion.base, [CLOSED]: motion.fast },
|
|
46
47
|
transitionTimingFunction: motion.easeOut
|
|
47
48
|
},
|
|
48
49
|
sm: { maxWidth: '24rem' },
|
|
49
50
|
md: { maxWidth: '32rem' },
|
|
50
51
|
lg: { maxWidth: '44rem' },
|
|
51
|
-
// A sheet: the full height of the window, along one edge
|
|
52
|
-
sheet: {
|
|
53
|
-
top: 0,
|
|
54
|
-
bottom: 0,
|
|
55
|
-
width: 'min(26rem, calc(100vw - 2rem))',
|
|
56
|
-
maxHeight: 'none',
|
|
57
|
-
marginInline: 0,
|
|
58
|
-
translate: 'none',
|
|
59
|
-
borderRadius: 0,
|
|
60
|
-
scale: null,
|
|
61
|
-
transitionProperty: { default: 'opacity', [MOTION]: 'opacity, translate' },
|
|
62
|
-
transitionDuration: { default: motion.slow, [CLOSED]: motion.base },
|
|
63
|
-
transitionTimingFunction: 'cubic-bezier(0.32, 0.72, 0, 1)'
|
|
64
|
-
},
|
|
65
|
-
end: {
|
|
66
|
-
insetInlineStart: 'auto',
|
|
67
|
-
insetInlineEnd: 0,
|
|
68
|
-
translate: {
|
|
69
|
-
default: null,
|
|
70
|
-
[MOTION]: {
|
|
71
|
-
default: '0 0',
|
|
72
|
-
'@starting-style': '100% 0',
|
|
73
|
-
[CLOSED]: '100% 0'
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
start: {
|
|
78
|
-
insetInlineStart: 0,
|
|
79
|
-
insetInlineEnd: 'auto',
|
|
80
|
-
translate: {
|
|
81
|
-
default: null,
|
|
82
|
-
[MOTION]: {
|
|
83
|
-
default: '0 0',
|
|
84
|
-
'@starting-style': '-100% 0',
|
|
85
|
-
[CLOSED]: '-100% 0'
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
52
|
header: {
|
|
90
53
|
display: 'flex',
|
|
91
54
|
flexDirection: 'column',
|
|
@@ -99,14 +62,14 @@ export const dialog = stylex.create({
|
|
|
99
62
|
title: {
|
|
100
63
|
margin: 0,
|
|
101
64
|
color: colors.text,
|
|
102
|
-
fontSize: font.
|
|
65
|
+
fontSize: font.sizeTitle,
|
|
103
66
|
fontWeight: font.weightSemibold,
|
|
104
67
|
lineHeight: font.leadingSnug
|
|
105
68
|
},
|
|
106
69
|
description: {
|
|
107
70
|
margin: 0,
|
|
108
71
|
color: colors.textMuted,
|
|
109
|
-
fontSize: font.
|
|
72
|
+
fontSize: font.sizeBody,
|
|
110
73
|
lineHeight: font.leadingNormal
|
|
111
74
|
},
|
|
112
75
|
body: {
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
alignItems: 'center',
|
|
19
19
|
gap: '0.75rem',
|
|
20
20
|
color: colors.textSubtle,
|
|
21
|
-
fontSize: font.
|
|
21
|
+
fontSize: font.sizeCaption,
|
|
22
22
|
fontWeight: font.weightMedium,
|
|
23
23
|
whiteSpace: 'nowrap',
|
|
24
|
-
'::before': { content: '""', flexGrow: 1, height: '1px', backgroundColor: colors.
|
|
25
|
-
'::after': { content: '""', flexGrow: 1, height: '1px', backgroundColor: colors.
|
|
24
|
+
'::before': { content: '""', flexGrow: 1, height: '1px', backgroundColor: colors.border },
|
|
25
|
+
'::after': { content: '""', flexGrow: 1, height: '1px', backgroundColor: colors.border }
|
|
26
26
|
},
|
|
27
27
|
label: { display: 'inline-flex', alignItems: 'center', gap: '0.375rem' }
|
|
28
28
|
});
|
|
@@ -34,22 +34,21 @@
|
|
|
34
34
|
width: '2.75rem',
|
|
35
35
|
height: '2.75rem',
|
|
36
36
|
marginBottom: space.x2,
|
|
37
|
-
borderRadius: radius.
|
|
38
|
-
backgroundColor: colors.
|
|
39
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}`,
|
|
37
|
+
borderRadius: radius.card,
|
|
38
|
+
backgroundColor: colors.fillSunken,
|
|
40
39
|
color: colors.textMuted
|
|
41
40
|
},
|
|
42
41
|
title: {
|
|
43
42
|
margin: 0,
|
|
44
43
|
color: colors.text,
|
|
45
|
-
fontSize: font.
|
|
44
|
+
fontSize: font.sizeReading,
|
|
46
45
|
fontWeight: font.weightSemibold
|
|
47
46
|
},
|
|
48
47
|
description: {
|
|
49
48
|
maxWidth: '26rem',
|
|
50
49
|
margin: 0,
|
|
51
50
|
color: colors.textMuted,
|
|
52
|
-
fontSize: font.
|
|
51
|
+
fontSize: font.sizeBody,
|
|
53
52
|
lineHeight: font.leadingNormal
|
|
54
53
|
},
|
|
55
54
|
actions: {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
label: {
|
|
42
42
|
color: colors.text,
|
|
43
|
-
fontSize: font.
|
|
43
|
+
fontSize: font.sizeMeta,
|
|
44
44
|
fontWeight: font.weightMedium,
|
|
45
45
|
lineHeight: font.leadingSnug
|
|
46
46
|
},
|
|
@@ -53,20 +53,20 @@
|
|
|
53
53
|
},
|
|
54
54
|
optional: {
|
|
55
55
|
color: colors.textSubtle,
|
|
56
|
-
fontSize: font.
|
|
56
|
+
fontSize: font.sizeMeta,
|
|
57
57
|
lineHeight: font.leadingSnug
|
|
58
58
|
},
|
|
59
59
|
description: {
|
|
60
60
|
margin: 0,
|
|
61
61
|
color: colors.textSubtle,
|
|
62
|
-
fontSize: font.
|
|
62
|
+
fontSize: font.sizeCaption,
|
|
63
63
|
lineHeight: font.leadingSnug,
|
|
64
64
|
textWrap: 'pretty'
|
|
65
65
|
},
|
|
66
66
|
error: {
|
|
67
67
|
margin: 0,
|
|
68
68
|
color: colors.danger,
|
|
69
|
-
fontSize: font.
|
|
69
|
+
fontSize: font.sizeCaption,
|
|
70
70
|
lineHeight: font.leadingSnug,
|
|
71
71
|
textWrap: 'pretty'
|
|
72
72
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
as?: 'div' | 'section' | 'article';
|
|
12
12
|
/** Heading shown above the content. */
|
|
13
13
|
title?: string;
|
|
14
|
-
/** A short note at the far end of the header
|
|
14
|
+
/** A short note at the far end of the header. */
|
|
15
15
|
tag?: string;
|
|
16
16
|
/** Heading level for the title. */
|
|
17
17
|
level?: 2 | 3 | 4 | 5 | 6;
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const styles = stylex.create({
|
|
24
|
-
// A tray around an inset panel
|
|
24
|
+
// A tray around an inset panel: a flat fill, so the panel's own edge is the only line.
|
|
25
|
+
// Its radius is the Card's radius plus this padding.
|
|
25
26
|
root: {
|
|
26
27
|
display: 'flex',
|
|
27
28
|
flexDirection: 'column',
|
|
@@ -29,8 +30,7 @@
|
|
|
29
30
|
minWidth: 0,
|
|
30
31
|
padding: '0.3125rem',
|
|
31
32
|
borderRadius: radius.frame,
|
|
32
|
-
backgroundColor: colors.
|
|
33
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}, inset 0 1px 0 ${colors.highlight}`,
|
|
33
|
+
backgroundColor: colors.fillMuted,
|
|
34
34
|
color: colors.text,
|
|
35
35
|
fontFamily: font.body
|
|
36
36
|
},
|
|
@@ -46,15 +46,14 @@
|
|
|
46
46
|
flexGrow: 1,
|
|
47
47
|
minWidth: 0,
|
|
48
48
|
margin: 0,
|
|
49
|
-
fontSize: font.
|
|
49
|
+
fontSize: font.sizeBody,
|
|
50
50
|
fontWeight: font.weightMedium,
|
|
51
51
|
lineHeight: font.leadingSnug
|
|
52
52
|
},
|
|
53
53
|
tag: {
|
|
54
54
|
flexShrink: 0,
|
|
55
55
|
color: colors.textSubtle,
|
|
56
|
-
|
|
57
|
-
fontSize: font.sizeXs,
|
|
56
|
+
fontSize: font.sizeCaption,
|
|
58
57
|
lineHeight: 1
|
|
59
58
|
}
|
|
60
59
|
});
|
|
@@ -6,7 +6,7 @@ export type FrameProps = Omit<HTMLAttributes<HTMLElement>, 'children' | 'title'>
|
|
|
6
6
|
as?: 'div' | 'section' | 'article';
|
|
7
7
|
/** Heading shown above the content. */
|
|
8
8
|
title?: string;
|
|
9
|
-
/** A short note at the far end of the header
|
|
9
|
+
/** A short note at the far end of the header. */
|
|
10
10
|
tag?: string;
|
|
11
11
|
/** Heading level for the title. */
|
|
12
12
|
level?: 2 | 3 | 4 | 5 | 6;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
import {
|
|
6
|
+
alignStyles,
|
|
7
|
+
columnsStyles,
|
|
8
|
+
gapStyles,
|
|
9
|
+
type Align,
|
|
10
|
+
type Columns,
|
|
11
|
+
type Gap
|
|
12
|
+
} from '../../internal/layout.js';
|
|
13
|
+
import {
|
|
14
|
+
breakpoints,
|
|
15
|
+
isByBreakpoint,
|
|
16
|
+
responsive,
|
|
17
|
+
type Responsive
|
|
18
|
+
} from '../../internal/responsive.js';
|
|
19
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
20
|
+
|
|
21
|
+
/** Steps on the 4px spacing scale: `4` is 16px. */
|
|
22
|
+
export type GridGap = Gap;
|
|
23
|
+
export type GridAlign = Align;
|
|
24
|
+
/**
|
|
25
|
+
* A number of equal columns, from 1 to 12, or a `grid-template-columns` value of your own,
|
|
26
|
+
* such as `'1.15fr 1fr'` or `'repeat(auto-fill, minmax(14rem, 1fr))'`.
|
|
27
|
+
*/
|
|
28
|
+
export type GridColumns = Columns | (string & {});
|
|
29
|
+
|
|
30
|
+
export type GridProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
31
|
+
/** Element to render. A `ul` or `ol` loses its markers and indent. */
|
|
32
|
+
as?: 'div' | 'section' | 'article' | 'nav' | 'header' | 'footer' | 'main' | 'ul' | 'ol' | 'li';
|
|
33
|
+
/** Columns. Like every layout prop, a value or values by breakpoint. */
|
|
34
|
+
columns?: Responsive<GridColumns>;
|
|
35
|
+
gap?: Responsive<GridGap>;
|
|
36
|
+
/** Alignment of each item in its cell, on the block axis. Items stretch by default. */
|
|
37
|
+
align?: Responsive<GridAlign>;
|
|
38
|
+
sx?: Sx;
|
|
39
|
+
children?: Snippet;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const styles = stylex.create({
|
|
43
|
+
base: {
|
|
44
|
+
display: 'grid',
|
|
45
|
+
boxSizing: 'border-box',
|
|
46
|
+
minWidth: 0,
|
|
47
|
+
margin: 0,
|
|
48
|
+
padding: 0,
|
|
49
|
+
listStyleType: 'none'
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// A template of your own cannot be known at build time. It is set as a custom property,
|
|
54
|
+
// inline, and read by the same static rules as a count. (Always a custom property: StyleX's
|
|
55
|
+
// `attrs` misnames the inline variable of a dynamic style on a camel-cased property.)
|
|
56
|
+
const templates = stylex.create({
|
|
57
|
+
default: (template: string) => ({ '--narvi-columns': template }),
|
|
58
|
+
sm: (template: string) => ({ '--narvi-columns-sm': template }),
|
|
59
|
+
md: (template: string) => ({ '--narvi-columns-md': template }),
|
|
60
|
+
lg: (template: string) => ({ '--narvi-columns-lg': template }),
|
|
61
|
+
xl: (template: string) => ({ '--narvi-columns-xl': template })
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const isCount = (value: GridColumns): value is Columns => typeof value === 'number';
|
|
65
|
+
|
|
66
|
+
function columnStyles(columns: Responsive<GridColumns> | undefined) {
|
|
67
|
+
if (!isByBreakpoint(columns)) {
|
|
68
|
+
const value = columns ?? 1;
|
|
69
|
+
return isCount(value)
|
|
70
|
+
? [columnsStyles.fixed[value]]
|
|
71
|
+
: [columnsStyles.chain, templates.default(value)];
|
|
72
|
+
}
|
|
73
|
+
const result: unknown[] = [columnsStyles.chain];
|
|
74
|
+
for (const at of ['default', ...breakpoints] as const) {
|
|
75
|
+
const value = at === 'default' ? (columns.default ?? 1) : columns[at];
|
|
76
|
+
if (value === undefined) continue;
|
|
77
|
+
result.push(isCount(value) ? columnsStyles.set[at][value] : templates[at](value));
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<script lang="ts">
|
|
84
|
+
let {
|
|
85
|
+
as = 'div',
|
|
86
|
+
columns = 1,
|
|
87
|
+
gap = 4,
|
|
88
|
+
align,
|
|
89
|
+
sx,
|
|
90
|
+
class: className,
|
|
91
|
+
children,
|
|
92
|
+
...rest
|
|
93
|
+
}: GridProps = $props();
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<svelte:element
|
|
97
|
+
this={as}
|
|
98
|
+
{...rest}
|
|
99
|
+
{...attrs(
|
|
100
|
+
[
|
|
101
|
+
styles.base,
|
|
102
|
+
columnStyles(columns) as ReadonlyArray<Readonly<Record<string, unknown>>>,
|
|
103
|
+
responsive(gap, 4, gapStyles),
|
|
104
|
+
responsive(align, undefined, alignStyles),
|
|
105
|
+
sx
|
|
106
|
+
],
|
|
107
|
+
className
|
|
108
|
+
)}
|
|
109
|
+
>
|
|
110
|
+
{@render children?.()}
|
|
111
|
+
</svelte:element>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Align, type Columns, type Gap } from '../../internal/layout.js';
|
|
4
|
+
import { type Responsive } from '../../internal/responsive.js';
|
|
5
|
+
import { type Sx } from '../../internal/sx.js';
|
|
6
|
+
/** Steps on the 4px spacing scale: `4` is 16px. */
|
|
7
|
+
export type GridGap = Gap;
|
|
8
|
+
export type GridAlign = Align;
|
|
9
|
+
/**
|
|
10
|
+
* A number of equal columns, from 1 to 12, or a `grid-template-columns` value of your own,
|
|
11
|
+
* such as `'1.15fr 1fr'` or `'repeat(auto-fill, minmax(14rem, 1fr))'`.
|
|
12
|
+
*/
|
|
13
|
+
export type GridColumns = Columns | (string & {});
|
|
14
|
+
export type GridProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
15
|
+
/** Element to render. A `ul` or `ol` loses its markers and indent. */
|
|
16
|
+
as?: 'div' | 'section' | 'article' | 'nav' | 'header' | 'footer' | 'main' | 'ul' | 'ol' | 'li';
|
|
17
|
+
/** Columns. Like every layout prop, a value or values by breakpoint. */
|
|
18
|
+
columns?: Responsive<GridColumns>;
|
|
19
|
+
gap?: Responsive<GridGap>;
|
|
20
|
+
/** Alignment of each item in its cell, on the block axis. Items stretch by default. */
|
|
21
|
+
align?: Responsive<GridAlign>;
|
|
22
|
+
sx?: Sx;
|
|
23
|
+
children?: Snippet;
|
|
24
|
+
};
|
|
25
|
+
declare const Grid: import("svelte").Component<GridProps, {}, "">;
|
|
26
|
+
type Grid = ReturnType<typeof Grid>;
|
|
27
|
+
export default Grid;
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
const sizes = stylex.create({
|
|
42
|
-
sm: { fontSize: font.
|
|
43
|
-
md: { fontSize: font.
|
|
42
|
+
sm: { fontSize: font.sizeBody },
|
|
43
|
+
md: { fontSize: font.sizeReading },
|
|
44
44
|
lg: { fontSize: '1.125rem', letterSpacing: '-0.01em' },
|
|
45
45
|
xl: { fontSize: '1.625rem' },
|
|
46
46
|
'2xl': { fontSize: '2.125rem' },
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { LinkPreview } from 'bits-ui';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import { layer } from '../../internal/layer.js';
|
|
6
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
|
+
|
|
8
|
+
export type HoverCardContentProps = Omit<LinkPreview.ContentProps, 'children' | 'child'> & {
|
|
9
|
+
sx?: Sx;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const styles = stylex.create({
|
|
14
|
+
// A card of its own content: a preview of a thread, a file, a person
|
|
15
|
+
card: {
|
|
16
|
+
width: '20rem',
|
|
17
|
+
minWidth: 0,
|
|
18
|
+
padding: '0.75rem'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
let {
|
|
25
|
+
side = 'bottom',
|
|
26
|
+
sideOffset = 6,
|
|
27
|
+
collisionPadding = 8,
|
|
28
|
+
align = 'start',
|
|
29
|
+
ref = $bindable(null),
|
|
30
|
+
sx,
|
|
31
|
+
class: className,
|
|
32
|
+
children,
|
|
33
|
+
...rest
|
|
34
|
+
}: HoverCardContentProps = $props();
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<LinkPreview.Portal>
|
|
38
|
+
<LinkPreview.Content
|
|
39
|
+
bind:ref
|
|
40
|
+
{side}
|
|
41
|
+
{sideOffset}
|
|
42
|
+
{collisionPadding}
|
|
43
|
+
{align}
|
|
44
|
+
data-slot="hover-card"
|
|
45
|
+
{...rest}
|
|
46
|
+
{...attrs([layer.surface, styles.card, sx], className)}
|
|
47
|
+
>
|
|
48
|
+
{@render children?.()}
|
|
49
|
+
</LinkPreview.Content>
|
|
50
|
+
</LinkPreview.Portal>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LinkPreview } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type HoverCardContentProps = Omit<LinkPreview.ContentProps, 'children' | 'child'> & {
|
|
5
|
+
sx?: Sx;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
};
|
|
8
|
+
declare const HoverCardContent: import("svelte").Component<HoverCardContentProps, {}, "ref">;
|
|
9
|
+
type HoverCardContent = ReturnType<typeof HoverCardContent>;
|
|
10
|
+
export default HoverCardContent;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { LinkPreview } from 'bits-ui';
|
|
3
|
+
|
|
4
|
+
export type HoverCardRootProps = LinkPreview.RootProps;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
// A card should not spring up as the pointer crosses on its way somewhere
|
|
9
|
+
// else, so it waits half a second; it lingers a moment on the way out, so the
|
|
10
|
+
// pointer can travel from the trigger into it.
|
|
11
|
+
let {
|
|
12
|
+
open = $bindable(false),
|
|
13
|
+
openDelay = 500,
|
|
14
|
+
closeDelay = 150,
|
|
15
|
+
children,
|
|
16
|
+
...rest
|
|
17
|
+
}: HoverCardRootProps = $props();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<LinkPreview.Root bind:open {openDelay} {closeDelay} {...rest}>
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</LinkPreview.Root>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LinkPreview } from 'bits-ui';
|
|
2
|
+
export type HoverCardRootProps = LinkPreview.RootProps;
|
|
3
|
+
declare const HoverCardRoot: import("svelte").Component<import("bits-ui").LinkPreviewRootPropsWithoutHTML, {}, "open">;
|
|
4
|
+
type HoverCardRoot = ReturnType<typeof HoverCardRoot>;
|
|
5
|
+
export default HoverCardRoot;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LinkPreview } from 'bits-ui';
|
|
2
|
+
import Content from './HoverCardContent.svelte';
|
|
3
|
+
import Root from './HoverCardRoot.svelte';
|
|
4
|
+
declare const Trigger: import("svelte").Component<LinkPreview.TriggerProps, {}, "ref">;
|
|
5
|
+
export { Root, Trigger, Content };
|
|
6
|
+
export type { HoverCardContentProps } from './HoverCardContent.svelte';
|
|
7
|
+
export type { HoverCardRootProps } from './HoverCardRoot.svelte';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LinkPreview } from 'bits-ui';
|
|
2
|
+
import Content from './HoverCardContent.svelte';
|
|
3
|
+
import Root from './HoverCardRoot.svelte';
|
|
4
|
+
// Behaviour only: bits-ui's own part. It renders a link; pass `child` to make
|
|
5
|
+
// another element the trigger.
|
|
6
|
+
const Trigger = LinkPreview.Trigger;
|
|
7
|
+
export { Root, Trigger, Content };
|