@diegopluna/narvi 0.0.0-stage → 0.0.1
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 +82 -2
- package/dist/components/activity/ActivityContent.svelte +55 -0
- package/dist/components/activity/ActivityContent.svelte.d.ts +11 -0
- package/dist/components/activity/ActivityRoot.svelte +66 -0
- package/dist/components/activity/ActivityRoot.svelte.d.ts +17 -0
- package/dist/components/activity/ActivityStep.svelte +157 -0
- package/dist/components/activity/ActivityStep.svelte.d.ts +26 -0
- package/dist/components/activity/ActivityThought.svelte +60 -0
- package/dist/components/activity/ActivityThought.svelte.d.ts +10 -0
- package/dist/components/activity/ActivityTrigger.svelte +103 -0
- package/dist/components/activity/ActivityTrigger.svelte.d.ts +20 -0
- package/dist/components/activity/context.d.ts +7 -0
- package/dist/components/activity/context.js +11 -0
- package/dist/components/activity/index.d.ts +11 -0
- package/dist/components/activity/index.js +6 -0
- package/dist/components/announcer/Announcer.svelte +84 -0
- package/dist/components/announcer/Announcer.svelte.d.ts +13 -0
- package/dist/components/app-shell/AppShellHeader.svelte +54 -0
- package/dist/components/app-shell/AppShellHeader.svelte.d.ts +15 -0
- package/dist/components/app-shell/AppShellMain.svelte +49 -0
- package/dist/components/app-shell/AppShellMain.svelte.d.ts +11 -0
- package/dist/components/app-shell/AppShellPanel.svelte +107 -0
- package/dist/components/app-shell/AppShellPanel.svelte.d.ts +18 -0
- package/dist/components/app-shell/AppShellRoot.svelte +136 -0
- package/dist/components/app-shell/AppShellRoot.svelte.d.ts +28 -0
- package/dist/components/app-shell/AppShellSidebar.svelte +192 -0
- package/dist/components/app-shell/AppShellSidebar.svelte.d.ts +17 -0
- package/dist/components/app-shell/AppShellToggle.svelte +50 -0
- package/dist/components/app-shell/AppShellToggle.svelte.d.ts +10 -0
- package/dist/components/app-shell/context.d.ts +15 -0
- package/dist/components/app-shell/context.js +15 -0
- package/dist/components/app-shell/index.d.ts +15 -0
- package/dist/components/app-shell/index.js +8 -0
- package/dist/components/approval/Approval.svelte +213 -0
- package/dist/components/approval/Approval.svelte.d.ts +38 -0
- package/dist/components/avatar/AvatarFallback.svelte +73 -0
- package/dist/components/avatar/AvatarFallback.svelte.d.ts +11 -0
- package/dist/components/avatar/AvatarImage.svelte +75 -0
- package/dist/components/avatar/AvatarImage.svelte.d.ts +11 -0
- package/dist/components/avatar/AvatarRoot.svelte +108 -0
- package/dist/components/avatar/AvatarRoot.svelte.d.ts +19 -0
- package/dist/components/avatar/context.d.ts +11 -0
- package/dist/components/avatar/context.js +11 -0
- package/dist/components/avatar/index.d.ts +7 -0
- package/dist/components/avatar/index.js +6 -0
- package/dist/components/badge/Badge.svelte +78 -0
- package/dist/components/badge/Badge.svelte.d.ts +15 -0
- package/dist/components/button/Button.svelte +270 -0
- package/dist/components/button/Button.svelte.d.ts +22 -0
- package/dist/components/card/Card.svelte +65 -0
- package/dist/components/card/Card.svelte.d.ts +15 -0
- package/dist/components/change-stats/ChangeStats.svelte +52 -0
- package/dist/components/change-stats/ChangeStats.svelte.d.ts +14 -0
- package/dist/components/changes-summary/ChangesSummary.svelte +152 -0
- package/dist/components/changes-summary/ChangesSummary.svelte.d.ts +20 -0
- package/dist/components/checkbox/Checkbox.svelte +178 -0
- package/dist/components/checkbox/Checkbox.svelte.d.ts +19 -0
- package/dist/components/code/Code.svelte +33 -0
- package/dist/components/code/Code.svelte.d.ts +10 -0
- package/dist/components/command/CommandDialog.svelte +37 -0
- package/dist/components/command/CommandDialog.svelte.d.ts +12 -0
- package/dist/components/command/CommandEmpty.svelte +20 -0
- package/dist/components/command/CommandEmpty.svelte.d.ts +11 -0
- package/dist/components/command/CommandFooter.svelte +25 -0
- package/dist/components/command/CommandFooter.svelte.d.ts +11 -0
- package/dist/components/command/CommandGroup.svelte +25 -0
- package/dist/components/command/CommandGroup.svelte.d.ts +12 -0
- package/dist/components/command/CommandInput.svelte +33 -0
- package/dist/components/command/CommandInput.svelte.d.ts +8 -0
- package/dist/components/command/CommandItem.svelte +49 -0
- package/dist/components/command/CommandItem.svelte.d.ts +16 -0
- package/dist/components/command/CommandList.svelte +21 -0
- package/dist/components/command/CommandList.svelte.d.ts +10 -0
- package/dist/components/command/CommandRoot.svelte +20 -0
- package/dist/components/command/CommandRoot.svelte.d.ts +11 -0
- package/dist/components/command/index.d.ts +20 -0
- package/dist/components/command/index.js +12 -0
- package/dist/components/command/styles.d.ts +117 -0
- package/dist/components/command/styles.js +121 -0
- package/dist/components/composer/ComposerAttachButton.svelte +55 -0
- package/dist/components/composer/ComposerAttachButton.svelte.d.ts +14 -0
- package/dist/components/composer/ComposerAttachment.svelte +173 -0
- package/dist/components/composer/ComposerAttachment.svelte.d.ts +13 -0
- package/dist/components/composer/ComposerAttachments.svelte +63 -0
- package/dist/components/composer/ComposerAttachments.svelte.d.ts +13 -0
- package/dist/components/composer/ComposerModelPicker.svelte +475 -0
- package/dist/components/composer/ComposerModelPicker.svelte.d.ts +27 -0
- package/dist/components/composer/ComposerRoot.svelte +315 -0
- package/dist/components/composer/ComposerRoot.svelte.d.ts +42 -0
- package/dist/components/composer/ComposerSubmit.svelte +131 -0
- package/dist/components/composer/ComposerSubmit.svelte.d.ts +13 -0
- package/dist/components/composer/ComposerTextarea.svelte +109 -0
- package/dist/components/composer/ComposerTextarea.svelte.d.ts +9 -0
- package/dist/components/composer/ComposerToggle.svelte +106 -0
- package/dist/components/composer/ComposerToggle.svelte.d.ts +14 -0
- package/dist/components/composer/ComposerToolbar.svelte +29 -0
- package/dist/components/composer/ComposerToolbar.svelte.d.ts +11 -0
- package/dist/components/composer/context.d.ts +53 -0
- package/dist/components/composer/context.js +32 -0
- package/dist/components/composer/index.d.ts +21 -0
- package/dist/components/composer/index.js +13 -0
- package/dist/components/conversation/ConversationContent.svelte +94 -0
- package/dist/components/conversation/ConversationContent.svelte.d.ts +15 -0
- package/dist/components/conversation/ConversationEmpty.svelte +89 -0
- package/dist/components/conversation/ConversationEmpty.svelte.d.ts +16 -0
- package/dist/components/conversation/ConversationRoot.svelte +237 -0
- package/dist/components/conversation/ConversationRoot.svelte.d.ts +20 -0
- package/dist/components/conversation/ConversationScrollButton.svelte +114 -0
- package/dist/components/conversation/ConversationScrollButton.svelte.d.ts +14 -0
- package/dist/components/conversation/context.d.ts +28 -0
- package/dist/components/conversation/context.js +15 -0
- package/dist/components/conversation/index.d.ts +11 -0
- package/dist/components/conversation/index.js +8 -0
- package/dist/components/conversation/scrolling.d.ts +25 -0
- package/dist/components/conversation/scrolling.js +60 -0
- package/dist/components/dev-styles/DevStyles.svelte +21 -0
- package/dist/components/dev-styles/DevStyles.svelte.d.ts +3 -0
- package/dist/components/dialog/ConfirmDialog.svelte +157 -0
- package/dist/components/dialog/ConfirmDialog.svelte.d.ts +31 -0
- package/dist/components/dialog/DialogBody.svelte +19 -0
- package/dist/components/dialog/DialogBody.svelte.d.ts +10 -0
- package/dist/components/dialog/DialogContent.svelte +55 -0
- package/dist/components/dialog/DialogContent.svelte.d.ts +17 -0
- package/dist/components/dialog/DialogDescription.svelte +23 -0
- package/dist/components/dialog/DialogDescription.svelte.d.ts +10 -0
- package/dist/components/dialog/DialogFooter.svelte +19 -0
- package/dist/components/dialog/DialogFooter.svelte.d.ts +10 -0
- package/dist/components/dialog/DialogHeader.svelte +19 -0
- package/dist/components/dialog/DialogHeader.svelte.d.ts +10 -0
- package/dist/components/dialog/DialogTitle.svelte +20 -0
- package/dist/components/dialog/DialogTitle.svelte.d.ts +10 -0
- package/dist/components/dialog/index.d.ts +17 -0
- package/dist/components/dialog/index.js +12 -0
- package/dist/components/dialog/styles.d.ts +120 -0
- package/dist/components/dialog/styles.js +136 -0
- package/dist/components/divider/Divider.svelte +42 -0
- package/dist/components/divider/Divider.svelte.d.ts +11 -0
- package/dist/components/empty-state/EmptyState.svelte +82 -0
- package/dist/components/empty-state/EmptyState.svelte.d.ts +15 -0
- package/dist/components/field/Field.svelte +132 -0
- package/dist/components/field/Field.svelte.d.ts +23 -0
- package/dist/components/field/context.d.ts +12 -0
- package/dist/components/field/context.js +9 -0
- package/dist/components/frame/Frame.svelte +88 -0
- package/dist/components/frame/Frame.svelte.d.ts +19 -0
- package/dist/components/heading/Heading.svelte +82 -0
- package/dist/components/heading/Heading.svelte.d.ts +16 -0
- package/dist/components/input/Input.svelte +47 -0
- package/dist/components/input/Input.svelte.d.ts +14 -0
- package/dist/components/kbd/Kbd.svelte +40 -0
- package/dist/components/kbd/Kbd.svelte.d.ts +11 -0
- package/dist/components/link/Link.svelte +68 -0
- package/dist/components/link/Link.svelte.d.ts +16 -0
- package/dist/components/menu/ContextMenuContent.svelte +33 -0
- package/dist/components/menu/ContextMenuContent.svelte.d.ts +11 -0
- package/dist/components/menu/ContextMenuTrigger.svelte +44 -0
- package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +11 -0
- package/dist/components/menu/MenuCheckboxItem.svelte +43 -0
- package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +11 -0
- package/dist/components/menu/MenuContent.svelte +36 -0
- package/dist/components/menu/MenuContent.svelte.d.ts +10 -0
- package/dist/components/menu/MenuItem.svelte +41 -0
- package/dist/components/menu/MenuItem.svelte.d.ts +16 -0
- package/dist/components/menu/MenuLabel.svelte +24 -0
- package/dist/components/menu/MenuLabel.svelte.d.ts +10 -0
- package/dist/components/menu/MenuRadioItem.svelte +54 -0
- package/dist/components/menu/MenuRadioItem.svelte.d.ts +12 -0
- package/dist/components/menu/MenuSeparator.svelte +19 -0
- package/dist/components/menu/MenuSeparator.svelte.d.ts +8 -0
- package/dist/components/menu/MenuSubContent.svelte +34 -0
- package/dist/components/menu/MenuSubContent.svelte.d.ts +10 -0
- package/dist/components/menu/MenuSubTrigger.svelte +35 -0
- package/dist/components/menu/MenuSubTrigger.svelte.d.ts +11 -0
- package/dist/components/menu/context-menu.d.ts +11 -0
- package/dist/components/menu/context-menu.js +10 -0
- package/dist/components/menu/index.js +16 -0
- package/dist/components/message/MessageAction.svelte +62 -0
- package/dist/components/message/MessageAction.svelte.d.ts +16 -0
- package/dist/components/message/MessageActions.svelte +77 -0
- package/dist/components/message/MessageActions.svelte.d.ts +19 -0
- package/dist/components/message/MessageContent.svelte +68 -0
- package/dist/components/message/MessageContent.svelte.d.ts +12 -0
- package/dist/components/message/MessageCopy.svelte +106 -0
- package/dist/components/message/MessageCopy.svelte.d.ts +16 -0
- package/dist/components/message/MessageHeader.svelte +74 -0
- package/dist/components/message/MessageHeader.svelte.d.ts +15 -0
- package/dist/components/message/MessagePending.svelte +44 -0
- package/dist/components/message/MessagePending.svelte.d.ts +10 -0
- package/dist/components/message/MessageRoot.svelte +79 -0
- package/dist/components/message/MessageRoot.svelte.d.ts +20 -0
- package/dist/components/message/MessageTime.svelte +58 -0
- package/dist/components/message/MessageTime.svelte.d.ts +12 -0
- package/dist/components/message/context.d.ts +7 -0
- package/dist/components/message/context.js +11 -0
- package/dist/components/message/index.d.ts +18 -0
- package/dist/components/message/index.js +11 -0
- package/dist/components/notice/Notice.svelte +111 -0
- package/dist/components/notice/Notice.svelte.d.ts +26 -0
- package/dist/components/plan/Plan.svelte +198 -0
- package/dist/components/plan/Plan.svelte.d.ts +18 -0
- package/dist/components/popover/PopoverContent.svelte +42 -0
- package/dist/components/popover/PopoverContent.svelte.d.ts +10 -0
- package/dist/components/popover/index.d.ts +7 -0
- package/dist/components/popover/index.js +7 -0
- package/dist/components/progress/Progress.svelte +113 -0
- package/dist/components/progress/Progress.svelte.d.ts +11 -0
- package/dist/components/questionnaire/Questionnaire.svelte +315 -0
- package/dist/components/questionnaire/Questionnaire.svelte.d.ts +33 -0
- package/dist/components/queued-message/QueuedMessage.svelte +133 -0
- package/dist/components/queued-message/QueuedMessage.svelte.d.ts +23 -0
- package/dist/components/rail/RailItem.svelte +170 -0
- package/dist/components/rail/RailItem.svelte.d.ts +21 -0
- package/dist/components/rail/RailRoot.svelte +46 -0
- package/dist/components/rail/RailRoot.svelte.d.ts +13 -0
- package/dist/components/rail/RailSpacer.svelte +2 -0
- package/dist/components/rail/RailSpacer.svelte.d.ts +26 -0
- package/dist/components/rail/index.d.ts +6 -0
- package/dist/components/rail/index.js +4 -0
- package/dist/components/reasoning/ReasoningContent.svelte +56 -0
- package/dist/components/reasoning/ReasoningContent.svelte.d.ts +12 -0
- package/dist/components/reasoning/ReasoningRoot.svelte +102 -0
- package/dist/components/reasoning/ReasoningRoot.svelte.d.ts +25 -0
- package/dist/components/reasoning/ReasoningTrigger.svelte +106 -0
- package/dist/components/reasoning/ReasoningTrigger.svelte.d.ts +18 -0
- package/dist/components/reasoning/context.d.ts +8 -0
- package/dist/components/reasoning/context.js +11 -0
- package/dist/components/reasoning/index.d.ts +7 -0
- package/dist/components/reasoning/index.js +6 -0
- package/dist/components/resize-handle/ResizeHandle.svelte +177 -0
- package/dist/components/resize-handle/ResizeHandle.svelte.d.ts +29 -0
- package/dist/components/rolling-text/RollingText.svelte +51 -0
- package/dist/components/rolling-text/RollingText.svelte.d.ts +11 -0
- package/dist/components/segmented/SegmentedControl.svelte +171 -0
- package/dist/components/segmented/SegmentedControl.svelte.d.ts +20 -0
- package/dist/components/select/Select.svelte +146 -0
- package/dist/components/select/Select.svelte.d.ts +31 -0
- package/dist/components/separator/Separator.svelte +48 -0
- package/dist/components/separator/Separator.svelte.d.ts +11 -0
- package/dist/components/settings-row/SettingsRow.svelte +97 -0
- package/dist/components/settings-row/SettingsRow.svelte.d.ts +21 -0
- package/dist/components/shimmer/Shimmer.svelte +66 -0
- package/dist/components/shimmer/Shimmer.svelte.d.ts +12 -0
- package/dist/components/sidebar/SidebarContent.svelte +70 -0
- package/dist/components/sidebar/SidebarContent.svelte.d.ts +13 -0
- package/dist/components/sidebar/SidebarFooter.svelte +33 -0
- package/dist/components/sidebar/SidebarFooter.svelte.d.ts +10 -0
- package/dist/components/sidebar/SidebarGroup.svelte +123 -0
- package/dist/components/sidebar/SidebarGroup.svelte.d.ts +19 -0
- package/dist/components/sidebar/SidebarHeader.svelte +39 -0
- package/dist/components/sidebar/SidebarHeader.svelte.d.ts +12 -0
- package/dist/components/sidebar/SidebarItem.svelte +236 -0
- package/dist/components/sidebar/SidebarItem.svelte.d.ts +27 -0
- package/dist/components/sidebar/index.d.ts +11 -0
- package/dist/components/sidebar/index.js +6 -0
- package/dist/components/skeleton/Skeleton.svelte +61 -0
- package/dist/components/skeleton/Skeleton.svelte.d.ts +13 -0
- package/dist/components/spinner/Spinner.svelte +57 -0
- package/dist/components/spinner/Spinner.svelte.d.ts +12 -0
- package/dist/components/stack/Stack.svelte +99 -0
- package/dist/components/stack/Stack.svelte.d.ts +19 -0
- package/dist/components/status-indicator/StatusIndicator.svelte +97 -0
- package/dist/components/status-indicator/StatusIndicator.svelte.d.ts +14 -0
- package/dist/components/suggestions/SuggestionsItem.svelte +104 -0
- package/dist/components/suggestions/SuggestionsItem.svelte.d.ts +14 -0
- package/dist/components/suggestions/SuggestionsRoot.svelte +80 -0
- package/dist/components/suggestions/SuggestionsRoot.svelte.d.ts +20 -0
- package/dist/components/suggestions/context.d.ts +7 -0
- package/dist/components/suggestions/context.js +8 -0
- package/dist/components/suggestions/index.d.ts +5 -0
- package/dist/components/suggestions/index.js +5 -0
- package/dist/components/switch/Switch.svelte +175 -0
- package/dist/components/switch/Switch.svelte.d.ts +17 -0
- package/dist/components/tabs/Tabs.svelte +170 -0
- package/dist/components/tabs/Tabs.svelte.d.ts +22 -0
- package/dist/components/text/Text.svelte +88 -0
- package/dist/components/text/Text.svelte.d.ts +20 -0
- package/dist/components/textarea/Textarea.svelte +64 -0
- package/dist/components/textarea/Textarea.svelte.d.ts +13 -0
- package/dist/components/theme/Theme.svelte +49 -0
- package/dist/components/theme/Theme.svelte.d.ts +25 -0
- package/dist/components/toast/Toaster.svelte +223 -0
- package/dist/components/toast/Toaster.svelte.d.ts +9 -0
- package/dist/components/toast/toasts.svelte.d.ts +55 -0
- package/dist/components/toast/toasts.svelte.js +66 -0
- package/dist/components/tool/ToolContent.svelte +51 -0
- package/dist/components/tool/ToolContent.svelte.d.ts +11 -0
- package/dist/components/tool/ToolInput.svelte +21 -0
- package/dist/components/tool/ToolInput.svelte.d.ts +14 -0
- package/dist/components/tool/ToolOutput.svelte +33 -0
- package/dist/components/tool/ToolOutput.svelte.d.ts +16 -0
- package/dist/components/tool/ToolRoot.svelte +94 -0
- package/dist/components/tool/ToolRoot.svelte.d.ts +23 -0
- package/dist/components/tool/ToolSection.svelte +102 -0
- package/dist/components/tool/ToolSection.svelte.d.ts +16 -0
- package/dist/components/tool/ToolTrigger.svelte +191 -0
- package/dist/components/tool/ToolTrigger.svelte.d.ts +14 -0
- package/dist/components/tool/context.d.ts +18 -0
- package/dist/components/tool/context.js +11 -0
- package/dist/components/tool/index.d.ts +12 -0
- package/dist/components/tool/index.js +8 -0
- package/dist/components/tooltip/TooltipContent.svelte +76 -0
- package/dist/components/tooltip/TooltipContent.svelte.d.ts +12 -0
- package/dist/components/tooltip/TooltipRoot.svelte +37 -0
- package/dist/components/tooltip/TooltipRoot.svelte.d.ts +10 -0
- package/dist/components/tooltip/TooltipTrigger.svelte +25 -0
- package/dist/components/tooltip/TooltipTrigger.svelte.d.ts +5 -0
- package/dist/components/tooltip/index.d.ts +13 -0
- package/dist/components/tooltip/index.js +10 -0
- package/dist/components/tooltip/intent.d.ts +2 -0
- package/dist/components/tooltip/intent.js +29 -0
- package/dist/components/work-fold/WorkFold.svelte +100 -0
- package/dist/components/work-fold/WorkFold.svelte.d.ts +15 -0
- package/dist/index.d.ts +127 -0
- package/dist/index.js +93 -0
- package/dist/internal/Chevron.svelte +28 -0
- package/dist/internal/Chevron.svelte.d.ts +7 -0
- package/dist/internal/Code.svelte +70 -0
- package/dist/internal/Code.svelte.d.ts +10 -0
- package/dist/internal/Collapse.svelte +57 -0
- package/dist/internal/Collapse.svelte.d.ts +12 -0
- package/dist/internal/Glyph.svelte +89 -0
- package/dist/internal/Glyph.svelte.d.ts +37 -0
- package/dist/internal/Tile.svelte +86 -0
- package/dist/internal/Tile.svelte.d.ts +15 -0
- package/dist/internal/control.d.ts +58 -0
- package/dist/internal/control.js +74 -0
- package/dist/internal/disclosure.d.ts +7 -0
- package/dist/internal/disclosure.js +1 -0
- package/dist/internal/json.d.ts +13 -0
- package/dist/internal/json.js +51 -0
- package/dist/internal/kinds.d.ts +9 -0
- package/dist/internal/kinds.js +25 -0
- package/dist/internal/layer.d.ts +103 -0
- package/dist/internal/layer.js +129 -0
- package/dist/internal/loop.d.ts +35 -0
- package/dist/internal/loop.js +72 -0
- package/dist/internal/markers.stylex.d.ts +14 -0
- package/dist/internal/markers.stylex.js +10 -0
- package/dist/internal/roving.d.ts +17 -0
- package/dist/internal/roving.js +68 -0
- package/dist/internal/shared.d.ts +36 -0
- package/dist/internal/shared.js +44 -0
- package/dist/internal/sx.d.ts +14 -0
- package/dist/internal/sx.js +11 -0
- package/dist/preset.d.ts +102 -0
- package/dist/preset.js +334 -0
- package/dist/tokens.stylex.d.ts +104 -0
- package/dist/tokens.stylex.js +125 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.js +58 -0
- package/package.json +123 -5
|
@@ -0,0 +1,65 @@
|
|
|
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 { shared } from '../../internal/shared.js';
|
|
6
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
|
+
import { colors, font, radius, space } from '../../tokens.stylex.js';
|
|
8
|
+
|
|
9
|
+
export type CardVariant = 'raised' | 'outlined' | 'filled';
|
|
10
|
+
export type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
11
|
+
|
|
12
|
+
export type CardProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
13
|
+
variant?: CardVariant;
|
|
14
|
+
padding?: CardPadding;
|
|
15
|
+
sx?: Sx;
|
|
16
|
+
ref?: HTMLDivElement | null;
|
|
17
|
+
children?: Snippet;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const styles = stylex.create({
|
|
21
|
+
base: {
|
|
22
|
+
boxSizing: 'border-box',
|
|
23
|
+
minWidth: 0,
|
|
24
|
+
borderRadius: radius.xl,
|
|
25
|
+
color: colors.text,
|
|
26
|
+
fontFamily: font.body
|
|
27
|
+
},
|
|
28
|
+
raised: {
|
|
29
|
+
backgroundColor: colors.bgRaised,
|
|
30
|
+
boxShadow: `inset 0 0 0 1px ${colors.line}, 0 1px 2px ${colors.shade}, 0 12px 24px -16px ${colors.shade}`
|
|
31
|
+
},
|
|
32
|
+
outlined: {
|
|
33
|
+
backgroundColor: colors.bgRaised,
|
|
34
|
+
boxShadow: `inset 0 0 0 1px ${colors.line}`
|
|
35
|
+
},
|
|
36
|
+
filled: {
|
|
37
|
+
backgroundColor: colors.well,
|
|
38
|
+
boxShadow: `inset 0 0 0 1px ${colors.line}, inset 0 1px 2px ${colors.shade}`
|
|
39
|
+
},
|
|
40
|
+
none: { padding: 0 },
|
|
41
|
+
sm: { padding: space.x3 },
|
|
42
|
+
md: { padding: '1.125rem' },
|
|
43
|
+
lg: { padding: space.x6 }
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<script lang="ts">
|
|
48
|
+
let {
|
|
49
|
+
variant = 'raised',
|
|
50
|
+
padding = 'md',
|
|
51
|
+
sx,
|
|
52
|
+
class: className,
|
|
53
|
+
ref = $bindable(null),
|
|
54
|
+
children,
|
|
55
|
+
...rest
|
|
56
|
+
}: CardProps = $props();
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<div
|
|
60
|
+
bind:this={ref}
|
|
61
|
+
{...rest}
|
|
62
|
+
{...attrs([styles.base, shared.edged, styles[variant], styles[padding], sx], className)}
|
|
63
|
+
>
|
|
64
|
+
{@render children?.()}
|
|
65
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type CardVariant = 'raised' | 'outlined' | 'filled';
|
|
5
|
+
export type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
6
|
+
export type CardProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
7
|
+
variant?: CardVariant;
|
|
8
|
+
padding?: CardPadding;
|
|
9
|
+
sx?: Sx;
|
|
10
|
+
ref?: HTMLDivElement | null;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
};
|
|
13
|
+
declare const Card: import("svelte").Component<CardProps, {}, "ref">;
|
|
14
|
+
type Card = ReturnType<typeof Card>;
|
|
15
|
+
export default Card;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!-- Lines added and removed, as +12 −3, in figures that line up. -->
|
|
2
|
+
<script lang="ts" module>
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
5
|
+
import { colors, font } from '../../tokens.stylex.js';
|
|
6
|
+
|
|
7
|
+
export type ChangeStatsProps = {
|
|
8
|
+
additions: number;
|
|
9
|
+
deletions: number;
|
|
10
|
+
/** Leaves out a side that is zero. */
|
|
11
|
+
hideZero?: boolean;
|
|
12
|
+
/** How the change is said to assistive technology. */
|
|
13
|
+
label?: (additions: number, deletions: number) => string;
|
|
14
|
+
sx?: Sx;
|
|
15
|
+
class?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const styles = stylex.create({
|
|
19
|
+
stats: {
|
|
20
|
+
display: 'inline-flex',
|
|
21
|
+
gap: '0.375rem',
|
|
22
|
+
fontFamily: font.mono,
|
|
23
|
+
fontSize: font.sizeXs,
|
|
24
|
+
fontVariantNumeric: 'tabular-nums',
|
|
25
|
+
whiteSpace: 'nowrap'
|
|
26
|
+
},
|
|
27
|
+
added: { color: colors.success },
|
|
28
|
+
removed: { color: colors.danger }
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<script lang="ts">
|
|
33
|
+
let {
|
|
34
|
+
additions,
|
|
35
|
+
deletions,
|
|
36
|
+
hideZero = false,
|
|
37
|
+
label = (a, d) => `${a} ${a === 1 ? 'line' : 'lines'} added, ${d} removed`,
|
|
38
|
+
sx,
|
|
39
|
+
class: className
|
|
40
|
+
}: ChangeStatsProps = $props();
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<span
|
|
44
|
+
role="img"
|
|
45
|
+
aria-label={label(additions, deletions)}
|
|
46
|
+
data-slot="change-stats"
|
|
47
|
+
{...attrs([styles.stats, sx], className)}
|
|
48
|
+
>
|
|
49
|
+
{#if !(hideZero && additions === 0)}<span {...stylex.attrs(styles.added)}>+{additions}</span>{/if}
|
|
50
|
+
{#if !(hideZero && deletions === 0)}<span {...stylex.attrs(styles.removed)}>−{deletions}</span
|
|
51
|
+
>{/if}
|
|
52
|
+
</span>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Sx } from '../../internal/sx.js';
|
|
2
|
+
export type ChangeStatsProps = {
|
|
3
|
+
additions: number;
|
|
4
|
+
deletions: number;
|
|
5
|
+
/** Leaves out a side that is zero. */
|
|
6
|
+
hideZero?: boolean;
|
|
7
|
+
/** How the change is said to assistive technology. */
|
|
8
|
+
label?: (additions: number, deletions: number) => string;
|
|
9
|
+
sx?: Sx;
|
|
10
|
+
class?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const ChangeStats: import("svelte").Component<ChangeStatsProps, {}, "">;
|
|
13
|
+
type ChangeStats = ReturnType<typeof ChangeStats>;
|
|
14
|
+
export default ChangeStats;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<!-- What a turn changed: how many files, how many lines, which, and a way into the diff. -->
|
|
2
|
+
<script lang="ts" module>
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
5
|
+
import { colors, font, radius } from '../../tokens.stylex.js';
|
|
6
|
+
import Button from '../button/Button.svelte';
|
|
7
|
+
import ChangeStats from '../change-stats/ChangeStats.svelte';
|
|
8
|
+
|
|
9
|
+
export type ChangedFile = {
|
|
10
|
+
path: string;
|
|
11
|
+
additions: number;
|
|
12
|
+
deletions: number;
|
|
13
|
+
status?: 'added' | 'modified' | 'deleted' | 'renamed';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type ChangesSummaryProps = {
|
|
17
|
+
files: ChangedFile[];
|
|
18
|
+
/** Opens the diff, at a file when one is given. */
|
|
19
|
+
onopen?: (path?: string) => void;
|
|
20
|
+
openLabel?: string;
|
|
21
|
+
/** How the count is said: "3 files changed". */
|
|
22
|
+
title?: (count: number) => string;
|
|
23
|
+
sx?: Sx;
|
|
24
|
+
class?: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const STATUS = { added: 'A', modified: 'M', deleted: 'D', renamed: 'R' } as const;
|
|
28
|
+
|
|
29
|
+
const styles = stylex.create({
|
|
30
|
+
card: {
|
|
31
|
+
display: 'flex',
|
|
32
|
+
flexDirection: 'column',
|
|
33
|
+
overflow: 'hidden',
|
|
34
|
+
borderRadius: radius.lg,
|
|
35
|
+
backgroundColor: colors.surface,
|
|
36
|
+
boxShadow: `inset 0 0 0 1px ${colors.line}`
|
|
37
|
+
},
|
|
38
|
+
head: {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
gap: '0.75rem',
|
|
42
|
+
minHeight: '2.5rem',
|
|
43
|
+
paddingInlineStart: '0.75rem',
|
|
44
|
+
paddingInlineEnd: '0.375rem',
|
|
45
|
+
borderBottomWidth: '1px',
|
|
46
|
+
borderBottomStyle: 'solid',
|
|
47
|
+
borderBottomColor: colors.line
|
|
48
|
+
},
|
|
49
|
+
title: { flexGrow: 1, margin: 0, fontSize: font.sizeMd, fontWeight: font.weightMedium },
|
|
50
|
+
list: { margin: 0, padding: '0.25rem', listStyleType: 'none' },
|
|
51
|
+
file: {
|
|
52
|
+
display: 'flex',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
gap: '0.5rem',
|
|
55
|
+
width: '100%',
|
|
56
|
+
minHeight: '1.875rem',
|
|
57
|
+
margin: 0,
|
|
58
|
+
paddingInline: '0.5rem',
|
|
59
|
+
borderWidth: 0,
|
|
60
|
+
borderRadius: radius.md,
|
|
61
|
+
backgroundColor: {
|
|
62
|
+
default: 'transparent',
|
|
63
|
+
':hover': { default: null, '@media (hover: hover)': colors.hover }
|
|
64
|
+
},
|
|
65
|
+
color: colors.textMuted,
|
|
66
|
+
fontFamily: font.mono,
|
|
67
|
+
fontSize: font.sizeXs,
|
|
68
|
+
textAlign: 'start',
|
|
69
|
+
cursor: 'pointer',
|
|
70
|
+
outlineStyle: 'solid',
|
|
71
|
+
outlineWidth: { default: 0, ':focus-visible': '2px' },
|
|
72
|
+
outlineColor: colors.focusRing,
|
|
73
|
+
outlineOffset: '-2px'
|
|
74
|
+
},
|
|
75
|
+
// The change, as a letter on a wash of its colour: added in green, deleted
|
|
76
|
+
// in red, modified and renamed in amber
|
|
77
|
+
mark: {
|
|
78
|
+
display: 'grid',
|
|
79
|
+
placeItems: 'center',
|
|
80
|
+
flexShrink: 0,
|
|
81
|
+
width: '1.125rem',
|
|
82
|
+
height: '1.125rem',
|
|
83
|
+
borderRadius: radius.xs,
|
|
84
|
+
fontSize: '0.6875rem',
|
|
85
|
+
fontWeight: font.weightSemibold
|
|
86
|
+
},
|
|
87
|
+
added: { backgroundColor: colors.successSoft, color: colors.successInk },
|
|
88
|
+
modified: { backgroundColor: colors.warningSoft, color: colors.warningInk },
|
|
89
|
+
renamed: { backgroundColor: colors.warningSoft, color: colors.warningInk },
|
|
90
|
+
deleted: { backgroundColor: colors.dangerSoft, color: colors.dangerInk },
|
|
91
|
+
// The file name, the part to read first
|
|
92
|
+
name: { color: colors.text },
|
|
93
|
+
// Long paths lose their start, which matters least, not their file name
|
|
94
|
+
path: {
|
|
95
|
+
flexGrow: 1,
|
|
96
|
+
minWidth: 0,
|
|
97
|
+
overflow: 'hidden',
|
|
98
|
+
textOverflow: 'ellipsis',
|
|
99
|
+
whiteSpace: 'nowrap',
|
|
100
|
+
direction: 'rtl',
|
|
101
|
+
textAlign: 'left'
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<script lang="ts">
|
|
107
|
+
let {
|
|
108
|
+
files,
|
|
109
|
+
onopen,
|
|
110
|
+
openLabel = 'Open diff',
|
|
111
|
+
title = (count) => `${count} ${count === 1 ? 'file' : 'files'} changed`,
|
|
112
|
+
sx,
|
|
113
|
+
class: className
|
|
114
|
+
}: ChangesSummaryProps = $props();
|
|
115
|
+
|
|
116
|
+
const additions = $derived(files.reduce((sum, file) => sum + file.additions, 0));
|
|
117
|
+
const deletions = $derived(files.reduce((sum, file) => sum + file.deletions, 0));
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<section
|
|
121
|
+
aria-label={title(files.length)}
|
|
122
|
+
data-slot="changes-summary"
|
|
123
|
+
{...attrs([styles.card, sx], className)}
|
|
124
|
+
>
|
|
125
|
+
<div {...stylex.attrs(styles.head)}>
|
|
126
|
+
<p {...stylex.attrs(styles.title)}>{title(files.length)}</p>
|
|
127
|
+
<ChangeStats {additions} {deletions} />
|
|
128
|
+
{#if onopen}<Button size="sm" variant="ghost" onclick={() => onopen?.()}>{openLabel}</Button
|
|
129
|
+
>{/if}
|
|
130
|
+
</div>
|
|
131
|
+
<ul {...stylex.attrs(styles.list)}>
|
|
132
|
+
{#each files as file (file.path)}
|
|
133
|
+
{@const cut = file.path.lastIndexOf('/') + 1}
|
|
134
|
+
<li>
|
|
135
|
+
<button type="button" {...stylex.attrs(styles.file)} onclick={() => onopen?.(file.path)}>
|
|
136
|
+
{#if file.status}<span
|
|
137
|
+
aria-hidden="true"
|
|
138
|
+
{...stylex.attrs(styles.mark, styles[file.status])}>{STATUS[file.status]}</span
|
|
139
|
+
>{/if}
|
|
140
|
+
<span {...stylex.attrs(styles.path)}
|
|
141
|
+
><bdi
|
|
142
|
+
>{file.path.slice(0, cut)}<span {...stylex.attrs(styles.name)}
|
|
143
|
+
>{file.path.slice(cut)}</span
|
|
144
|
+
></bdi
|
|
145
|
+
></span
|
|
146
|
+
>
|
|
147
|
+
<ChangeStats additions={file.additions} deletions={file.deletions} hideZero />
|
|
148
|
+
</button>
|
|
149
|
+
</li>
|
|
150
|
+
{/each}
|
|
151
|
+
</ul>
|
|
152
|
+
</section>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Sx } from '../../internal/sx.js';
|
|
2
|
+
export type ChangedFile = {
|
|
3
|
+
path: string;
|
|
4
|
+
additions: number;
|
|
5
|
+
deletions: number;
|
|
6
|
+
status?: 'added' | 'modified' | 'deleted' | 'renamed';
|
|
7
|
+
};
|
|
8
|
+
export type ChangesSummaryProps = {
|
|
9
|
+
files: ChangedFile[];
|
|
10
|
+
/** Opens the diff, at a file when one is given. */
|
|
11
|
+
onopen?: (path?: string) => void;
|
|
12
|
+
openLabel?: string;
|
|
13
|
+
/** How the count is said: "3 files changed". */
|
|
14
|
+
title?: (count: number) => string;
|
|
15
|
+
sx?: Sx;
|
|
16
|
+
class?: string;
|
|
17
|
+
};
|
|
18
|
+
declare const ChangesSummary: import("svelte").Component<ChangesSummaryProps, {}, "">;
|
|
19
|
+
type ChangesSummary = ReturnType<typeof ChangesSummary>;
|
|
20
|
+
export default ChangesSummary;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
5
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
|
+
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
7
|
+
|
|
8
|
+
export type CheckboxProps = Omit<HTMLInputAttributes, 'type' | 'children'> & {
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
/** Shows a dash for a partially selected group. Cleared when the user toggles the box. */
|
|
11
|
+
indeterminate?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** A second, quieter line under the label. */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Applied to the outermost element: the label when there is one, else the input. */
|
|
16
|
+
sx?: Sx;
|
|
17
|
+
ref?: HTMLInputElement | null;
|
|
18
|
+
/** Label content. Without it, give the checkbox an `aria-label`. */
|
|
19
|
+
children?: Snippet;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// StyleX needs these in the same file to evaluate them at build time
|
|
23
|
+
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
24
|
+
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
25
|
+
const FORCED = '@media (forced-colors: active)';
|
|
26
|
+
|
|
27
|
+
const CHECK = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.5 5 9l4.5-6'/%3E%3C/svg%3E")`;
|
|
28
|
+
const DASH = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M2.5 6h7'/%3E%3C/svg%3E")`;
|
|
29
|
+
|
|
30
|
+
const styles = stylex.create({
|
|
31
|
+
root: {
|
|
32
|
+
display: 'inline-flex',
|
|
33
|
+
alignItems: 'flex-start',
|
|
34
|
+
gap: '0.625rem',
|
|
35
|
+
color: colors.text,
|
|
36
|
+
fontFamily: font.body,
|
|
37
|
+
fontSize: font.sizeMd,
|
|
38
|
+
lineHeight: '1.25rem',
|
|
39
|
+
cursor: 'pointer',
|
|
40
|
+
WebkitTapHighlightColor: 'transparent'
|
|
41
|
+
},
|
|
42
|
+
rootDisabled: {
|
|
43
|
+
color: colors.textSubtle,
|
|
44
|
+
cursor: 'not-allowed'
|
|
45
|
+
},
|
|
46
|
+
description: {
|
|
47
|
+
display: 'block',
|
|
48
|
+
color: colors.textSubtle,
|
|
49
|
+
fontSize: font.sizeXs,
|
|
50
|
+
lineHeight: font.leadingSnug
|
|
51
|
+
},
|
|
52
|
+
input: {
|
|
53
|
+
position: 'relative',
|
|
54
|
+
display: 'inline-grid',
|
|
55
|
+
placeContent: 'center',
|
|
56
|
+
flexShrink: 0,
|
|
57
|
+
boxSizing: 'border-box',
|
|
58
|
+
width: '1rem',
|
|
59
|
+
height: '1rem',
|
|
60
|
+
margin: 0,
|
|
61
|
+
// Centre the 16px box on the label's 20px first line
|
|
62
|
+
marginBlock: '2px',
|
|
63
|
+
borderWidth: '1px',
|
|
64
|
+
borderStyle: 'solid',
|
|
65
|
+
borderRadius: radius.xs,
|
|
66
|
+
borderColor: {
|
|
67
|
+
default: colors.edge,
|
|
68
|
+
':hover': { default: null, [HOVER]: colors.edgeHover },
|
|
69
|
+
':checked': 'transparent',
|
|
70
|
+
':indeterminate': 'transparent',
|
|
71
|
+
[FORCED]: 'ButtonText'
|
|
72
|
+
},
|
|
73
|
+
backgroundColor: { default: colors.well, [FORCED]: 'Canvas' },
|
|
74
|
+
backgroundOrigin: 'border-box',
|
|
75
|
+
backgroundImage: {
|
|
76
|
+
default: 'none',
|
|
77
|
+
':checked': `linear-gradient(180deg, ${colors.ithil}, ${colors.ithilStrong})`,
|
|
78
|
+
':indeterminate': `linear-gradient(180deg, ${colors.ithil}, ${colors.ithilStrong})`,
|
|
79
|
+
[FORCED]: {
|
|
80
|
+
default: 'none',
|
|
81
|
+
':checked': 'linear-gradient(Highlight, Highlight)',
|
|
82
|
+
':indeterminate': 'linear-gradient(Highlight, Highlight)'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
boxShadow: {
|
|
86
|
+
default: `inset 0 1px 2px ${colors.shade}`,
|
|
87
|
+
':checked': `inset 0 1px 0 rgb(255 255 255 / 0.4), 0 0 6px ${colors.glow}`,
|
|
88
|
+
':indeterminate': `inset 0 1px 0 rgb(255 255 255 / 0.4), 0 0 6px ${colors.glow}`
|
|
89
|
+
},
|
|
90
|
+
forcedColorAdjust: 'none',
|
|
91
|
+
appearance: 'none',
|
|
92
|
+
cursor: { default: 'pointer', ':disabled': 'not-allowed' },
|
|
93
|
+
opacity: { default: 1, ':disabled': 0.5 },
|
|
94
|
+
outlineStyle: 'solid',
|
|
95
|
+
outlineWidth: { default: 0, ':focus-visible': '2px' },
|
|
96
|
+
outlineColor: colors.focusRing,
|
|
97
|
+
outlineOffset: '2px',
|
|
98
|
+
transitionProperty: 'border-color',
|
|
99
|
+
transitionDuration: motion.base,
|
|
100
|
+
transitionTimingFunction: 'ease',
|
|
101
|
+
'::before': {
|
|
102
|
+
content: '""',
|
|
103
|
+
width: '0.625rem',
|
|
104
|
+
height: '0.625rem',
|
|
105
|
+
backgroundColor: { default: colors.onIthil, [FORCED]: 'HighlightText' },
|
|
106
|
+
maskImage: { default: CHECK, ':indeterminate': DASH },
|
|
107
|
+
maskSize: 'contain',
|
|
108
|
+
maskRepeat: 'no-repeat',
|
|
109
|
+
maskPosition: 'center',
|
|
110
|
+
opacity: { default: 0, ':checked': 1, ':indeterminate': 1 },
|
|
111
|
+
// The mark settles in from just under full size, with a touch of blur to
|
|
112
|
+
// soften the swap. It never grows from nothing, and it is quick: boxes
|
|
113
|
+
// get ticked many times a day.
|
|
114
|
+
scale: { default: null, [MOTION]: { default: 0.9, ':checked': 1, ':indeterminate': 1 } },
|
|
115
|
+
filter: {
|
|
116
|
+
default: null,
|
|
117
|
+
[MOTION]: { default: 'blur(2px)', ':checked': 'blur(0px)', ':indeterminate': 'blur(0px)' }
|
|
118
|
+
},
|
|
119
|
+
transitionProperty: { default: 'opacity', [MOTION]: 'opacity, scale, filter' },
|
|
120
|
+
transitionDuration: motion.fast,
|
|
121
|
+
transitionTimingFunction: motion.easeOut
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
// Without a label, extend the hit area to 40px
|
|
125
|
+
standalone: {
|
|
126
|
+
marginBlock: 0,
|
|
127
|
+
'::after': {
|
|
128
|
+
content: '""',
|
|
129
|
+
position: 'absolute',
|
|
130
|
+
inset: '-13px'
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<script lang="ts">
|
|
137
|
+
let {
|
|
138
|
+
checked = $bindable(false),
|
|
139
|
+
indeterminate = $bindable(false),
|
|
140
|
+
disabled = false,
|
|
141
|
+
description,
|
|
142
|
+
sx,
|
|
143
|
+
class: className,
|
|
144
|
+
ref = $bindable(null),
|
|
145
|
+
children,
|
|
146
|
+
...rest
|
|
147
|
+
}: CheckboxProps = $props();
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
{#if children}
|
|
151
|
+
<label {...attrs([styles.root, disabled && styles.rootDisabled, sx], className)}>
|
|
152
|
+
<input
|
|
153
|
+
bind:this={ref}
|
|
154
|
+
bind:checked
|
|
155
|
+
bind:indeterminate
|
|
156
|
+
type="checkbox"
|
|
157
|
+
{disabled}
|
|
158
|
+
{...rest}
|
|
159
|
+
{...stylex.attrs(styles.input)}
|
|
160
|
+
/>
|
|
161
|
+
<span>
|
|
162
|
+
{@render children()}
|
|
163
|
+
{#if description}
|
|
164
|
+
<span {...stylex.attrs(styles.description)}>{description}</span>
|
|
165
|
+
{/if}
|
|
166
|
+
</span>
|
|
167
|
+
</label>
|
|
168
|
+
{:else}
|
|
169
|
+
<input
|
|
170
|
+
bind:this={ref}
|
|
171
|
+
bind:checked
|
|
172
|
+
bind:indeterminate
|
|
173
|
+
type="checkbox"
|
|
174
|
+
{disabled}
|
|
175
|
+
{...rest}
|
|
176
|
+
{...attrs([styles.input, styles.standalone, sx], className)}
|
|
177
|
+
/>
|
|
178
|
+
{/if}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type CheckboxProps = Omit<HTMLInputAttributes, 'type' | 'children'> & {
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
/** Shows a dash for a partially selected group. Cleared when the user toggles the box. */
|
|
7
|
+
indeterminate?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** A second, quieter line under the label. */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Applied to the outermost element: the label when there is one, else the input. */
|
|
12
|
+
sx?: Sx;
|
|
13
|
+
ref?: HTMLInputElement | null;
|
|
14
|
+
/** Label content. Without it, give the checkbox an `aria-label`. */
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
};
|
|
17
|
+
declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "ref" | "checked" | "indeterminate">;
|
|
18
|
+
type Checkbox = ReturnType<typeof Checkbox>;
|
|
19
|
+
export default Checkbox;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { attrs, type Sx } from '../../internal/sx.js';
|
|
6
|
+
import { colors, font } from '../../tokens.stylex.js';
|
|
7
|
+
|
|
8
|
+
export type CodeProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
9
|
+
sx?: Sx;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const styles = stylex.create({
|
|
14
|
+
base: {
|
|
15
|
+
paddingBlock: '0.125em',
|
|
16
|
+
paddingInline: '0.35em',
|
|
17
|
+
borderRadius: '0.35em',
|
|
18
|
+
backgroundColor: colors.surfaceRaised,
|
|
19
|
+
boxShadow: `inset 0 0 0 1px ${colors.line}`,
|
|
20
|
+
color: colors.text,
|
|
21
|
+
fontFamily: font.mono,
|
|
22
|
+
fontSize: '0.875em',
|
|
23
|
+
fontVariantLigatures: 'none',
|
|
24
|
+
overflowWrap: 'break-word'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
let { sx, class: className, children, ...rest }: CodeProps = $props();
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<code {...rest} {...attrs([styles.base, sx], className)}>{@render children?.()}</code>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type CodeProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
5
|
+
sx?: Sx;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
};
|
|
8
|
+
declare const Code: import("svelte").Component<CodeProps, {}, "">;
|
|
9
|
+
type Code = ReturnType<typeof Code>;
|
|
10
|
+
export default Code;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
The command palette: a search field over everything the app can do, in a
|
|
3
|
+
dialog of its own. Wire the shortcut that opens it, usually ⌘K, in your app.
|
|
4
|
+
-->
|
|
5
|
+
<script lang="ts" module>
|
|
6
|
+
import { Dialog } from 'bits-ui';
|
|
7
|
+
import * as stylex from '@stylexjs/stylex';
|
|
8
|
+
import type { Snippet } from 'svelte';
|
|
9
|
+
import { command } from './styles.js';
|
|
10
|
+
|
|
11
|
+
export type CommandDialogProps = {
|
|
12
|
+
/** Whether it is open. Bindable. */
|
|
13
|
+
open?: boolean;
|
|
14
|
+
/** What the palette is, for assistive technology. */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** A Command.Root with its Input, List and Footer. */
|
|
17
|
+
children?: Snippet;
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
let {
|
|
23
|
+
open = $bindable(false),
|
|
24
|
+
label = 'Command palette',
|
|
25
|
+
children
|
|
26
|
+
}: CommandDialogProps = $props();
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<Dialog.Root bind:open>
|
|
30
|
+
<Dialog.Portal>
|
|
31
|
+
<Dialog.Overlay {...stylex.attrs(command.overlay)} />
|
|
32
|
+
<Dialog.Content data-slot="command-dialog" {...stylex.attrs(command.dialog)}>
|
|
33
|
+
<Dialog.Title {...stylex.attrs(command.hidden)}>{label}</Dialog.Title>
|
|
34
|
+
{@render children?.()}
|
|
35
|
+
</Dialog.Content>
|
|
36
|
+
</Dialog.Portal>
|
|
37
|
+
</Dialog.Root>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type CommandDialogProps = {
|
|
3
|
+
/** Whether it is open. Bindable. */
|
|
4
|
+
open?: boolean;
|
|
5
|
+
/** What the palette is, for assistive technology. */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** A Command.Root with its Input, List and Footer. */
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
};
|
|
10
|
+
declare const CommandDialog: import("svelte").Component<CommandDialogProps, {}, "open">;
|
|
11
|
+
type CommandDialog = ReturnType<typeof CommandDialog>;
|
|
12
|
+
export default CommandDialog;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { Command } from 'bits-ui';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
5
|
+
import { command } from './styles.js';
|
|
6
|
+
|
|
7
|
+
export type CommandEmptyProps = Omit<Command.EmptyProps, 'children' | 'child'> & {
|
|
8
|
+
sx?: Sx;
|
|
9
|
+
/** What to say when nothing matches. Say what was searched for, and what to try. */
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
let { sx, class: className, children, ...rest }: CommandEmptyProps = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<Command.Empty data-slot="command-empty" {...rest} {...attrs([command.empty, sx], className)}>
|
|
19
|
+
{#if children}{@render children()}{:else}Nothing matches.{/if}
|
|
20
|
+
</Command.Empty>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type CommandEmptyProps = Omit<Command.EmptyProps, 'children' | 'child'> & {
|
|
5
|
+
sx?: Sx;
|
|
6
|
+
/** What to say when nothing matches. Say what was searched for, and what to try. */
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
};
|
|
9
|
+
declare const CommandEmpty: import("svelte").Component<CommandEmptyProps, {}, "">;
|
|
10
|
+
type CommandEmpty = ReturnType<typeof CommandEmpty>;
|
|
11
|
+
export default CommandEmpty;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
5
|
+
import { command } from './styles.js';
|
|
6
|
+
|
|
7
|
+
export type CommandFooterProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
8
|
+
sx?: Sx;
|
|
9
|
+
/** Hints for the keys, such as "↑↓ to move". */
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
let { sx, class: className, children, ...rest }: CommandFooterProps = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div
|
|
19
|
+
data-slot="command-footer"
|
|
20
|
+
aria-hidden="true"
|
|
21
|
+
{...rest}
|
|
22
|
+
{...attrs([command.footer, sx], className)}
|
|
23
|
+
>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</div>
|