@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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DropdownMenu } from 'bits-ui';
|
|
2
|
+
import CheckboxItem from './MenuCheckboxItem.svelte';
|
|
3
|
+
import Content from './MenuContent.svelte';
|
|
4
|
+
import Item from './MenuItem.svelte';
|
|
5
|
+
import Label from './MenuLabel.svelte';
|
|
6
|
+
import RadioItem from './MenuRadioItem.svelte';
|
|
7
|
+
import Separator from './MenuSeparator.svelte';
|
|
8
|
+
import SubContent from './MenuSubContent.svelte';
|
|
9
|
+
import SubTrigger from './MenuSubTrigger.svelte';
|
|
10
|
+
declare const Root: typeof DropdownMenu.Root;
|
|
11
|
+
declare const Trigger: typeof DropdownMenu.Trigger;
|
|
12
|
+
declare const Group: typeof DropdownMenu.Group;
|
|
13
|
+
declare const RadioGroup: typeof DropdownMenu.RadioGroup;
|
|
14
|
+
declare const Sub: typeof DropdownMenu.Sub;
|
|
15
|
+
export { Root, Trigger, Content, Item, CheckboxItem, RadioGroup, RadioItem, Group, Label, Separator, Sub, SubTrigger, SubContent };
|
|
16
|
+
export type { MenuCheckboxItemProps } from './MenuCheckboxItem.svelte';
|
|
17
|
+
export type { MenuContentProps } from './MenuContent.svelte';
|
|
18
|
+
export type { MenuItemProps } from './MenuItem.svelte';
|
|
19
|
+
export type { MenuLabelProps } from './MenuLabel.svelte';
|
|
20
|
+
export type { MenuRadioItemProps } from './MenuRadioItem.svelte';
|
|
21
|
+
export type { MenuSeparatorProps } from './MenuSeparator.svelte';
|
|
22
|
+
export type { MenuSubContentProps } from './MenuSubContent.svelte';
|
|
23
|
+
export type { MenuSubTriggerProps } from './MenuSubTrigger.svelte';
|
|
@@ -7,7 +7,9 @@ import RadioItem from './MenuRadioItem.svelte';
|
|
|
7
7
|
import Separator from './MenuSeparator.svelte';
|
|
8
8
|
import SubContent from './MenuSubContent.svelte';
|
|
9
9
|
import SubTrigger from './MenuSubTrigger.svelte';
|
|
10
|
-
// Behaviour only, with nothing to style: bits-ui's own parts
|
|
10
|
+
// Behaviour only, with nothing to style: bits-ui's own parts. The annotations are needed:
|
|
11
|
+
// without them TypeScript cannot name Root's inferred type (TS2883), and svelte-package
|
|
12
|
+
// silently leaves this module's declarations out of the package.
|
|
11
13
|
const Root = DropdownMenu.Root;
|
|
12
14
|
const Trigger = DropdownMenu.Trigger;
|
|
13
15
|
const Group = DropdownMenu.Group;
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { Sx } from '../../internal/sx.js';
|
|
5
5
|
import { colors } from '../../tokens.stylex.js';
|
|
6
|
-
import
|
|
6
|
+
import { media } from '../../media.stylex.js';
|
|
7
|
+
import Button, { buttonHtml, type ButtonProps } from '../button/Button.svelte';
|
|
7
8
|
|
|
8
9
|
export type MessageActionProps = Omit<
|
|
9
10
|
ButtonProps,
|
|
@@ -19,21 +20,39 @@
|
|
|
19
20
|
children?: Snippet;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
23
|
-
|
|
24
23
|
const styles = stylex.create({
|
|
25
24
|
// Quieter than a ghost button: these sit under every reply
|
|
26
25
|
action: {
|
|
27
26
|
color: {
|
|
28
27
|
default: colors.textSubtle,
|
|
29
|
-
':hover': { default: null, [
|
|
28
|
+
':hover': { default: null, [media.hover]: colors.text }
|
|
30
29
|
}
|
|
31
30
|
},
|
|
32
31
|
pressed: {
|
|
33
32
|
color: colors.text,
|
|
34
|
-
backgroundColor: colors.
|
|
33
|
+
backgroundColor: colors.fillSelected
|
|
35
34
|
}
|
|
36
35
|
});
|
|
36
|
+
|
|
37
|
+
/** An action as markup, as the component draws it. `label` and `attributes` are escaped already. */
|
|
38
|
+
export function actionHtml(options: {
|
|
39
|
+
label: string;
|
|
40
|
+
attributes?: string;
|
|
41
|
+
sx?: Sx;
|
|
42
|
+
inner: string;
|
|
43
|
+
/** As `buttonHtml` takes it: the button and its icon, with nothing between. */
|
|
44
|
+
bare?: boolean;
|
|
45
|
+
}): string {
|
|
46
|
+
return buttonHtml({
|
|
47
|
+
bare: options.bare,
|
|
48
|
+
variant: 'ghost',
|
|
49
|
+
size: 'sm',
|
|
50
|
+
iconOnly: true,
|
|
51
|
+
sx: [styles.action, options.sx],
|
|
52
|
+
attributes: ` aria-label="${options.label}" data-slot="message-action"${options.attributes ?? ''}`,
|
|
53
|
+
inner: options.inner
|
|
54
|
+
});
|
|
55
|
+
}
|
|
37
56
|
</script>
|
|
38
57
|
|
|
39
58
|
<script lang="ts">
|
|
@@ -11,6 +11,15 @@ export type MessageActionProps = Omit<ButtonProps, 'children' | 'variant' | 'siz
|
|
|
11
11
|
/** A 16px icon. */
|
|
12
12
|
children?: Snippet;
|
|
13
13
|
};
|
|
14
|
+
/** An action as markup, as the component draws it. `label` and `attributes` are escaped already. */
|
|
15
|
+
export declare function actionHtml(options: {
|
|
16
|
+
label: string;
|
|
17
|
+
attributes?: string;
|
|
18
|
+
sx?: Sx;
|
|
19
|
+
inner: string;
|
|
20
|
+
/** As `buttonHtml` takes it: the button and its icon, with nothing between. */
|
|
21
|
+
bare?: boolean;
|
|
22
|
+
}): string;
|
|
14
23
|
declare const MessageAction: import("svelte").Component<MessageActionProps, {}, "ref">;
|
|
15
24
|
type MessageAction = ReturnType<typeof MessageAction>;
|
|
16
25
|
export default MessageAction;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { messageMarker } from '../../internal/markers.stylex.js';
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
7
|
import { motion } from '../../tokens.stylex.js';
|
|
8
|
+
import { media } from '../../media.stylex.js';
|
|
8
9
|
import { getMessageContext } from './context.js';
|
|
9
10
|
|
|
10
11
|
export type MessageActionsProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
@@ -21,8 +22,6 @@
|
|
|
21
22
|
children?: Snippet;
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
const FINE = '@media (hover: hover) and (pointer: fine)';
|
|
25
|
-
|
|
26
25
|
const styles = stylex.create({
|
|
27
26
|
actions: {
|
|
28
27
|
display: 'flex',
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
hover: {
|
|
37
36
|
opacity: {
|
|
38
37
|
default: 1,
|
|
39
|
-
[
|
|
38
|
+
[media.hover]: {
|
|
40
39
|
default: 0,
|
|
41
40
|
':focus-within': 1,
|
|
42
41
|
[stylex.when.ancestor(':hover', messageMarker)]: 1
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
gap: '0.75rem',
|
|
23
23
|
minWidth: 0,
|
|
24
24
|
// A size for reading at length: a step up from interface text
|
|
25
|
-
fontSize: font.
|
|
25
|
+
fontSize: font.sizeReading,
|
|
26
26
|
lineHeight: font.leadingNormal,
|
|
27
27
|
overflowWrap: 'break-word'
|
|
28
28
|
},
|
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
paddingBlock: '0.5625rem',
|
|
33
33
|
paddingInline: '0.875rem',
|
|
34
34
|
borderRadius: radius.frame,
|
|
35
|
-
backgroundColor: colors.
|
|
36
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}, 0 1px 2px ${colors.shade}`,
|
|
35
|
+
backgroundColor: colors.fillMuted,
|
|
37
36
|
whiteSpace: 'pre-wrap',
|
|
38
37
|
overflowWrap: 'anywhere'
|
|
39
38
|
},
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import * as stylex from '@stylexjs/stylex';
|
|
3
|
-
import Glyph from '../../internal/Glyph.svelte';
|
|
4
|
-
import type
|
|
3
|
+
import Glyph, { glyphHtml } from '../../internal/Glyph.svelte';
|
|
4
|
+
import { classes, type Sx } from '../../internal/sx.js';
|
|
5
5
|
import { colors, motion } from '../../tokens.stylex.js';
|
|
6
|
-
import
|
|
6
|
+
import { media } from '../../media.stylex.js';
|
|
7
|
+
import MessageAction, { actionHtml, type MessageActionProps } from './MessageAction.svelte';
|
|
7
8
|
|
|
8
9
|
export type MessageCopyProps = Omit<
|
|
9
10
|
MessageActionProps,
|
|
@@ -20,8 +21,6 @@
|
|
|
20
21
|
sx?: Sx;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
24
|
-
|
|
25
24
|
const styles = stylex.create({
|
|
26
25
|
stack: {
|
|
27
26
|
display: 'grid',
|
|
@@ -32,14 +31,14 @@
|
|
|
32
31
|
icon: {
|
|
33
32
|
gridArea: '1 / 1',
|
|
34
33
|
display: 'grid',
|
|
35
|
-
transitionProperty: { default: 'opacity', [
|
|
34
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, scale, filter' },
|
|
36
35
|
transitionDuration: motion.base,
|
|
37
36
|
transitionTimingFunction: motion.easeOut
|
|
38
37
|
},
|
|
39
38
|
gone: {
|
|
40
39
|
opacity: 0,
|
|
41
|
-
scale: { default: null, [
|
|
42
|
-
filter: { default: null, [
|
|
40
|
+
scale: { default: null, [media.motion]: 0.6 },
|
|
41
|
+
filter: { default: null, [media.motion]: 'blur(2px)' }
|
|
43
42
|
},
|
|
44
43
|
check: { color: colors.text },
|
|
45
44
|
status: {
|
|
@@ -51,6 +50,65 @@
|
|
|
51
50
|
whiteSpace: 'nowrap'
|
|
52
51
|
}
|
|
53
52
|
});
|
|
53
|
+
|
|
54
|
+
const arrive = stylex.keyframes({
|
|
55
|
+
from: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },
|
|
56
|
+
to: { opacity: 1, scale: 1, filter: 'blur(0)' }
|
|
57
|
+
});
|
|
58
|
+
const lean = stylex.create({
|
|
59
|
+
// An icon that has just taken another's place: it arrives as the component's does
|
|
60
|
+
arrived: {
|
|
61
|
+
animationName: { default: null, [media.motion]: arrive },
|
|
62
|
+
animationDuration: motion.base,
|
|
63
|
+
animationTimingFunction: motion.easeOut
|
|
64
|
+
},
|
|
65
|
+
check: { color: colors.text }
|
|
66
|
+
});
|
|
67
|
+
const arrivedClass = classes(lean.arrived);
|
|
68
|
+
const arrivedCheckClass = classes(lean.arrived, lean.check);
|
|
69
|
+
const statusClass = classes(styles.status);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A copy button as markup, with the status that says "Copied" after it: a button and its
|
|
73
|
+
* icon, and nothing else. The tick is not there until something is copied (`showCopied`):
|
|
74
|
+
* a page of code blocks has a copy button for each, and nearly none of them is pressed.
|
|
75
|
+
* `label` and `attributes` are escaped already.
|
|
76
|
+
*/
|
|
77
|
+
export function copyHtml(options: { label: string; attributes?: string; sx?: Sx }): string {
|
|
78
|
+
return (
|
|
79
|
+
actionHtml({ ...options, bare: true, inner: glyphHtml('copy') }) +
|
|
80
|
+
`<span role="status" class="${statusClass}"></span>`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const putBack = new WeakMap<Element, ReturnType<typeof setTimeout>>();
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Shows a copy button written by `copyHtml` as having copied, and puts it back two seconds
|
|
88
|
+
* later: the icon turns into a tick, and the status after it says so.
|
|
89
|
+
*/
|
|
90
|
+
export function showCopied(button: Element, copiedLabel: string): void {
|
|
91
|
+
const set = (copied: boolean) => {
|
|
92
|
+
button.querySelector(':scope > svg')?.remove();
|
|
93
|
+
button.insertAdjacentHTML(
|
|
94
|
+
'afterbegin',
|
|
95
|
+
copied ? glyphHtml('check', 16, 1.75) : glyphHtml('copy')
|
|
96
|
+
);
|
|
97
|
+
button.firstElementChild?.setAttribute('class', copied ? arrivedCheckClass : arrivedClass);
|
|
98
|
+
if (copied) button.setAttribute('data-copied', 'true');
|
|
99
|
+
else button.removeAttribute('data-copied');
|
|
100
|
+
const status = button.nextElementSibling;
|
|
101
|
+
if (status?.getAttribute('role') === 'status') status.textContent = copied ? copiedLabel : '';
|
|
102
|
+
};
|
|
103
|
+
clearTimeout(putBack.get(button));
|
|
104
|
+
set(true);
|
|
105
|
+
putBack.set(
|
|
106
|
+
button,
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
if (button.isConnected) set(false);
|
|
109
|
+
}, 2000)
|
|
110
|
+
);
|
|
111
|
+
}
|
|
54
112
|
</script>
|
|
55
113
|
|
|
56
114
|
<script lang="ts">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Sx } from '../../internal/sx.js';
|
|
2
2
|
import { type MessageActionProps } from './MessageAction.svelte';
|
|
3
3
|
export type MessageCopyProps = Omit<MessageActionProps, 'children' | 'value' | 'label' | 'onclick'> & {
|
|
4
4
|
onclick?: (event: MouseEvent) => void;
|
|
@@ -11,6 +11,22 @@ export type MessageCopyProps = Omit<MessageActionProps, 'children' | 'value' | '
|
|
|
11
11
|
oncopy?: (text: string) => void;
|
|
12
12
|
sx?: Sx;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* A copy button as markup, with the status that says "Copied" after it: a button and its
|
|
16
|
+
* icon, and nothing else. The tick is not there until something is copied (`showCopied`):
|
|
17
|
+
* a page of code blocks has a copy button for each, and nearly none of them is pressed.
|
|
18
|
+
* `label` and `attributes` are escaped already.
|
|
19
|
+
*/
|
|
20
|
+
export declare function copyHtml(options: {
|
|
21
|
+
label: string;
|
|
22
|
+
attributes?: string;
|
|
23
|
+
sx?: Sx;
|
|
24
|
+
}): string;
|
|
25
|
+
/**
|
|
26
|
+
* Shows a copy button written by `copyHtml` as having copied, and puts it back two seconds
|
|
27
|
+
* later: the icon turns into a tick, and the status after it says so.
|
|
28
|
+
*/
|
|
29
|
+
export declare function showCopied(button: Element, copiedLabel: string): void;
|
|
14
30
|
declare const MessageCopy: import("svelte").Component<MessageCopyProps, {}, "">;
|
|
15
31
|
type MessageCopy = ReturnType<typeof MessageCopy>;
|
|
16
32
|
export default MessageCopy;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
Who is speaking: a mark, a name, and a word more, such as the model or the
|
|
3
3
|
time. The default mark is the arch of the doors, which lights up while the
|
|
4
|
-
reply is arriving
|
|
4
|
+
reply is arriving.
|
|
5
5
|
-->
|
|
6
6
|
<script lang="ts" module>
|
|
7
7
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
textOverflow: 'ellipsis',
|
|
38
38
|
whiteSpace: 'nowrap',
|
|
39
39
|
color: colors.text,
|
|
40
|
-
fontSize: font.
|
|
40
|
+
fontSize: font.sizeMeta,
|
|
41
41
|
fontWeight: font.weightSemibold
|
|
42
42
|
},
|
|
43
43
|
meta: {
|
|
44
44
|
flexShrink: 0,
|
|
45
45
|
color: colors.textSubtle,
|
|
46
|
-
fontSize: font.
|
|
46
|
+
fontSize: font.sizeCaption,
|
|
47
47
|
fontVariantNumeric: 'tabular-nums'
|
|
48
48
|
}
|
|
49
49
|
});
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { messageMarker } from '../../internal/markers.stylex.js';
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
7
|
import { colors, font } from '../../tokens.stylex.js';
|
|
8
|
+
import { media } from '../../media.stylex.js';
|
|
8
9
|
import { setMessageContext, type MessageFrom } from './context.js';
|
|
9
10
|
|
|
10
11
|
export type MessageRootProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
@@ -21,8 +22,6 @@
|
|
|
21
22
|
children?: Snippet;
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
const FINE = '@media (hover: hover) and (pointer: fine)';
|
|
25
|
-
|
|
26
25
|
const styles = stylex.create({
|
|
27
26
|
root: {
|
|
28
27
|
display: 'flex',
|
|
@@ -37,8 +36,8 @@
|
|
|
37
36
|
// actions sit beside the bubble, at its foot, so they take no height.
|
|
38
37
|
user: {
|
|
39
38
|
alignItems: 'flex-end',
|
|
40
|
-
flexDirection: { default: 'column', [
|
|
41
|
-
gap: { default: '0.375rem', [
|
|
39
|
+
flexDirection: { default: 'column', [media.hover]: 'row-reverse' },
|
|
40
|
+
gap: { default: '0.375rem', [media.hover]: '0.25rem' },
|
|
42
41
|
marginBlockStart: { default: '1.5rem', ':first-child': 0 }
|
|
43
42
|
},
|
|
44
43
|
assistant: { alignItems: 'stretch' }
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { messageMarker } from '../../internal/markers.stylex.js';
|
|
8
8
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
9
9
|
import { colors, font, motion } from '../../tokens.stylex.js';
|
|
10
|
+
import { media } from '../../media.stylex.js';
|
|
10
11
|
|
|
11
12
|
export type MessageTimeProps = {
|
|
12
13
|
/** When it was sent. */
|
|
@@ -17,18 +18,16 @@
|
|
|
17
18
|
class?: string;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
const FINE = '@media (hover: hover) and (pointer: fine)';
|
|
21
|
-
|
|
22
21
|
const styles = stylex.create({
|
|
23
22
|
time: {
|
|
24
23
|
paddingInline: '0.375rem',
|
|
25
24
|
color: colors.textSubtle,
|
|
26
|
-
fontSize: font.
|
|
25
|
+
fontSize: font.sizeCaption,
|
|
27
26
|
fontVariantNumeric: 'tabular-nums',
|
|
28
27
|
whiteSpace: 'nowrap',
|
|
29
28
|
opacity: {
|
|
30
29
|
default: 1,
|
|
31
|
-
[
|
|
30
|
+
[media.hover]: {
|
|
32
31
|
default: 0,
|
|
33
32
|
[stylex.when.ancestor(':hover', messageMarker)]: 1,
|
|
34
33
|
[stylex.when.ancestor(':focus-within', messageMarker)]: 1
|
|
@@ -41,25 +41,29 @@
|
|
|
41
41
|
columnGap: '0.625rem',
|
|
42
42
|
paddingBlock: '0.625rem',
|
|
43
43
|
paddingInline: '0.75rem',
|
|
44
|
-
borderRadius: radius.
|
|
45
|
-
fontSize: font.
|
|
44
|
+
borderRadius: radius.panel,
|
|
45
|
+
fontSize: font.sizeBody,
|
|
46
46
|
lineHeight: font.leadingSnug
|
|
47
47
|
},
|
|
48
48
|
neutral: {
|
|
49
|
-
backgroundColor: colors.
|
|
50
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}`,
|
|
49
|
+
backgroundColor: colors.fillSunken,
|
|
51
50
|
color: colors.text
|
|
52
51
|
},
|
|
53
|
-
info: { backgroundColor: colors.
|
|
54
|
-
success: { backgroundColor: colors.successSoft, color: colors.
|
|
55
|
-
warning: { backgroundColor: colors.warningSoft, color: colors.
|
|
56
|
-
danger: { backgroundColor: colors.dangerSoft, color: colors.
|
|
52
|
+
info: { backgroundColor: colors.accentSoft, color: colors.text },
|
|
53
|
+
success: { backgroundColor: colors.successSoft, color: colors.successText },
|
|
54
|
+
warning: { backgroundColor: colors.warningSoft, color: colors.warningText },
|
|
55
|
+
danger: { backgroundColor: colors.dangerSoft, color: colors.dangerText },
|
|
57
56
|
icon: { display: 'grid', placeItems: 'center', width: '1rem', height: '1lh' },
|
|
58
57
|
iconNeutral: { color: colors.textMuted },
|
|
59
|
-
iconInfo: { color: colors.
|
|
58
|
+
iconInfo: { color: colors.accent },
|
|
60
59
|
text: { display: 'flex', flexDirection: 'column', gap: '0.125rem', minWidth: 0 },
|
|
61
60
|
title: { fontWeight: font.weightMedium },
|
|
62
|
-
detail: {
|
|
61
|
+
detail: {
|
|
62
|
+
opacity: 0.85,
|
|
63
|
+
fontSize: font.sizeMeta,
|
|
64
|
+
userSelect: 'text',
|
|
65
|
+
overflowWrap: 'anywhere'
|
|
66
|
+
},
|
|
63
67
|
actions: { display: 'flex', alignItems: 'center', gap: '0.25rem', marginBlock: '-0.25rem' }
|
|
64
68
|
});
|
|
65
69
|
</script>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { shared } from '../../internal/shared.js';
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
7
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
8
|
+
import { media } from '../../media.stylex.js';
|
|
8
9
|
import Spinner from '../spinner/Spinner.svelte';
|
|
9
10
|
|
|
10
11
|
export type PlanStepStatus = 'pending' | 'active' | 'done' | 'skipped';
|
|
@@ -20,8 +21,6 @@
|
|
|
20
21
|
class?: string;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
24
|
-
|
|
25
24
|
const styles = stylex.create({
|
|
26
25
|
plan: {
|
|
27
26
|
display: 'flex',
|
|
@@ -30,9 +29,8 @@
|
|
|
30
29
|
paddingTop: '0.75rem',
|
|
31
30
|
paddingBottom: '0.5rem',
|
|
32
31
|
paddingInline: '0.5rem',
|
|
33
|
-
borderRadius: radius.
|
|
34
|
-
|
|
35
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}, inset 0 1px 0 ${colors.highlight}, 0 1px 2px ${colors.shade}`
|
|
32
|
+
borderRadius: radius.panel,
|
|
33
|
+
boxShadow: `inset 0 0 0 1px ${colors.border}`
|
|
36
34
|
},
|
|
37
35
|
head: {
|
|
38
36
|
display: 'flex',
|
|
@@ -44,7 +42,7 @@
|
|
|
44
42
|
},
|
|
45
43
|
title: {
|
|
46
44
|
color: colors.text,
|
|
47
|
-
fontSize: font.
|
|
45
|
+
fontSize: font.sizeMeta,
|
|
48
46
|
fontWeight: font.weightSemibold
|
|
49
47
|
},
|
|
50
48
|
// One segment per step: lit as each is done, half-lit while one is under way
|
|
@@ -56,14 +54,14 @@
|
|
|
56
54
|
segment: {
|
|
57
55
|
flexGrow: 1,
|
|
58
56
|
height: '0.1875rem',
|
|
59
|
-
borderRadius: radius.
|
|
60
|
-
backgroundColor: colors.
|
|
57
|
+
borderRadius: radius.pill,
|
|
58
|
+
backgroundColor: colors.border,
|
|
61
59
|
transitionProperty: 'background-color, box-shadow',
|
|
62
60
|
transitionDuration: motion.slow,
|
|
63
61
|
transitionTimingFunction: 'ease'
|
|
64
62
|
},
|
|
65
|
-
segmentDone: { backgroundColor: colors.
|
|
66
|
-
segmentActive: { backgroundColor: `color-mix(in oklab, ${colors.
|
|
63
|
+
segmentDone: { backgroundColor: colors.accent },
|
|
64
|
+
segmentActive: { backgroundColor: `color-mix(in oklab, ${colors.accent} 40%, transparent)` },
|
|
67
65
|
steps: {
|
|
68
66
|
display: 'flex',
|
|
69
67
|
flexDirection: 'column',
|
|
@@ -78,9 +76,9 @@
|
|
|
78
76
|
gap: '0.625rem',
|
|
79
77
|
minHeight: '1.875rem',
|
|
80
78
|
paddingInline: '0.375rem',
|
|
81
|
-
borderRadius: radius.
|
|
79
|
+
borderRadius: radius.control,
|
|
82
80
|
color: colors.textMuted,
|
|
83
|
-
fontSize: font.
|
|
81
|
+
fontSize: font.sizeBody,
|
|
84
82
|
lineHeight: font.leadingSnug,
|
|
85
83
|
transitionProperty: 'color, background-color',
|
|
86
84
|
transitionDuration: motion.base,
|
|
@@ -88,7 +86,7 @@
|
|
|
88
86
|
},
|
|
89
87
|
// The step under way sits in a band of moonlight
|
|
90
88
|
active: {
|
|
91
|
-
backgroundColor: colors.
|
|
89
|
+
backgroundColor: colors.accentSoft,
|
|
92
90
|
color: colors.text,
|
|
93
91
|
fontWeight: font.weightMedium
|
|
94
92
|
},
|
|
@@ -101,19 +99,25 @@
|
|
|
101
99
|
boxSizing: 'border-box',
|
|
102
100
|
width: '1rem',
|
|
103
101
|
height: '1rem',
|
|
104
|
-
borderRadius: radius.
|
|
102
|
+
borderRadius: radius.pill,
|
|
105
103
|
color: colors.textSubtle,
|
|
106
104
|
opacity: { default: 1, '@starting-style': 0 },
|
|
107
|
-
scale: { default: null, [
|
|
108
|
-
transitionProperty: { default: 'opacity', [
|
|
105
|
+
scale: { default: null, [media.motion]: { default: 1, '@starting-style': 0.6 } },
|
|
106
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, scale' },
|
|
109
107
|
transitionDuration: motion.slow,
|
|
110
108
|
transitionTimingFunction: motion.easeOut
|
|
111
109
|
},
|
|
112
|
-
iconActive: { color: colors.
|
|
110
|
+
iconActive: { color: colors.accent },
|
|
113
111
|
// Done: a solid green seal with the tick cut out of it
|
|
114
112
|
iconDone: { backgroundColor: colors.success, color: colors.bgRaised },
|
|
115
|
-
iconSkipped: { boxShadow: `inset 0 0 0 1px ${colors.
|
|
116
|
-
|
|
113
|
+
iconSkipped: { boxShadow: `inset 0 0 0 1px ${colors.borderStrong}` },
|
|
114
|
+
// Set off by room, not a dot
|
|
115
|
+
skipped: {
|
|
116
|
+
marginInlineStart: '0.5rem',
|
|
117
|
+
color: colors.textSubtle,
|
|
118
|
+
fontSize: font.sizeMeta,
|
|
119
|
+
fontWeight: font.weightRegular
|
|
120
|
+
},
|
|
117
121
|
hidden: {
|
|
118
122
|
position: 'absolute',
|
|
119
123
|
width: '1px',
|
|
@@ -186,8 +190,8 @@
|
|
|
186
190
|
</span>
|
|
187
191
|
{/key}
|
|
188
192
|
<span>
|
|
189
|
-
{step.label}{#if step.status === 'skipped'}<span {...stylex.attrs(styles.skipped)}
|
|
190
|
-
|
|
193
|
+
{step.label}{#if step.status === 'skipped'}<span {...stylex.attrs(styles.skipped)}
|
|
194
|
+
>{skippedLabel}</span
|
|
191
195
|
>{:else if step.status === 'done'}<span {...stylex.attrs(styles.hidden)}>
|
|
192
196
|
(done)</span
|
|
193
197
|
>{/if}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import * as stylex from '@stylexjs/stylex';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
import { loop } from '../../internal/loop.js';
|
|
5
4
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
|
-
import {
|
|
5
|
+
import { whileVisible } from '../../internal/visible.js';
|
|
6
|
+
import { colors, motion, play, radius } from '../../tokens.stylex.js';
|
|
7
|
+
import { media } from '../../media.stylex.js';
|
|
7
8
|
|
|
8
9
|
export type ProgressProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
9
10
|
/** How far along, from 0 to `max`. Leave out while the amount is unknown. */
|
|
@@ -12,31 +13,18 @@
|
|
|
12
13
|
sx?: Sx;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
0.35 + 0.65 * (0.5 - 0.5 * Math.cos(progress * 2 * Math.PI))
|
|
28
|
-
);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const at = -100 + 350 * ease(progress);
|
|
32
|
-
element.style.opacity = '';
|
|
33
|
-
element.style.translate = `${rtl ? -at : at}% 0`;
|
|
34
|
-
},
|
|
35
|
-
(element) => {
|
|
36
|
-
element.style.translate = '';
|
|
37
|
-
element.style.opacity = '';
|
|
38
|
-
}
|
|
39
|
-
);
|
|
16
|
+
// The bar of an unknown amount crosses the track, stepped, and only while it can be
|
|
17
|
+
// seen. With less motion asked for it fills the track and breathes in place instead.
|
|
18
|
+
const sweep = stylex.keyframes({ from: { translate: '-100% 0' }, to: { translate: '250% 0' } });
|
|
19
|
+
const sweepRtl = stylex.keyframes({
|
|
20
|
+
from: { translate: '100% 0' },
|
|
21
|
+
to: { translate: '-250% 0' }
|
|
22
|
+
});
|
|
23
|
+
const breathe = stylex.keyframes({
|
|
24
|
+
'0%': { opacity: 1 },
|
|
25
|
+
'50%': { opacity: 0.35 },
|
|
26
|
+
'100%': { opacity: 1 }
|
|
27
|
+
});
|
|
40
28
|
|
|
41
29
|
const styles = stylex.create({
|
|
42
30
|
track: {
|
|
@@ -44,9 +32,8 @@
|
|
|
44
32
|
boxSizing: 'border-box',
|
|
45
33
|
width: '100%',
|
|
46
34
|
height: '0.25rem',
|
|
47
|
-
borderRadius: radius.
|
|
48
|
-
backgroundColor: colors.
|
|
49
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}`,
|
|
35
|
+
borderRadius: radius.pill,
|
|
36
|
+
backgroundColor: colors.fillSunken,
|
|
50
37
|
outlineStyle: 'solid',
|
|
51
38
|
outlineWidth: '1px',
|
|
52
39
|
outlineColor: 'transparent'
|
|
@@ -57,17 +44,18 @@
|
|
|
57
44
|
position: 'absolute',
|
|
58
45
|
inset: 0,
|
|
59
46
|
overflow: 'hidden',
|
|
60
|
-
borderRadius: radius.
|
|
61
|
-
filter: `drop-shadow(0 0 4px ${colors.glow})`
|
|
47
|
+
borderRadius: radius.pill
|
|
62
48
|
},
|
|
63
49
|
fill: {
|
|
64
50
|
display: 'block',
|
|
65
51
|
width: '100%',
|
|
66
52
|
height: '100%',
|
|
67
|
-
borderRadius: radius.
|
|
53
|
+
borderRadius: radius.pill,
|
|
54
|
+
backgroundColor: colors.accent,
|
|
55
|
+
// Forced colours drop a background colour, not an image
|
|
68
56
|
backgroundImage: {
|
|
69
|
-
default:
|
|
70
|
-
[
|
|
57
|
+
default: 'none',
|
|
58
|
+
[media.forcedColors]: 'linear-gradient(Highlight, Highlight)'
|
|
71
59
|
},
|
|
72
60
|
forcedColorAdjust: 'none'
|
|
73
61
|
},
|
|
@@ -78,12 +66,20 @@
|
|
|
78
66
|
default: 'calc(var(--narvi-progress) - 100%) 0',
|
|
79
67
|
':dir(rtl)': 'calc(100% - var(--narvi-progress)) 0'
|
|
80
68
|
},
|
|
81
|
-
transitionProperty: { default: 'none', [
|
|
69
|
+
transitionProperty: { default: 'none', [media.motion]: 'translate' },
|
|
82
70
|
transitionDuration: motion.slow,
|
|
83
71
|
transitionTimingFunction: motion.easeOut
|
|
84
72
|
},
|
|
85
73
|
unknown: {
|
|
86
|
-
width: { default: '100%', [
|
|
74
|
+
width: { default: '100%', [media.motion]: '40%' },
|
|
75
|
+
animationName: {
|
|
76
|
+
default: breathe,
|
|
77
|
+
[media.motion]: { default: sweep, ':dir(rtl)': sweepRtl }
|
|
78
|
+
},
|
|
79
|
+
animationDuration: { default: '2s', [media.motion]: '1.4s' },
|
|
80
|
+
animationTimingFunction: { default: 'steps(12)', [media.motion]: 'steps(28)' },
|
|
81
|
+
animationIterationCount: 'infinite',
|
|
82
|
+
animationPlayState: play.whileVisible
|
|
87
83
|
}
|
|
88
84
|
});
|
|
89
85
|
</script>
|
|
@@ -107,7 +103,7 @@
|
|
|
107
103
|
<span
|
|
108
104
|
{...stylex.attrs(styles.fill, known ? styles.known : styles.unknown)}
|
|
109
105
|
style:--narvi-progress={known ? `${percent}%` : undefined}
|
|
110
|
-
{@attach !known &&
|
|
106
|
+
{@attach !known && whileVisible}
|
|
111
107
|
></span>
|
|
112
108
|
</span>
|
|
113
109
|
</div>
|