@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,38 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
/**
|
|
3
|
+
* Styles for what sits inside a `Reveal`, which follow it in as it is reached. Each moves
|
|
4
|
+
* only on the way in, so hiding below the fold is instant, and only for readers who have
|
|
5
|
+
* not asked for less motion. Each also waits for the Reveal's own `delay`.
|
|
6
|
+
*
|
|
7
|
+
* Apply them with `sx` on a component, or spread `sx(...)` onto an element:
|
|
8
|
+
* `<path pathLength="1" {...sx(revealed.drawIn)} />`.
|
|
9
|
+
*
|
|
10
|
+
* Fine-tune them with custom properties, set on the element or anywhere above it:
|
|
11
|
+
* - `--narvi-draw-delay`, `--narvi-fade-delay` and `--narvi-sweep-delay`: a wait of its own,
|
|
12
|
+
* after the Reveal's
|
|
13
|
+
* - `--narvi-sweep-from`: where a sweep starts, as a dash offset (`1`, a whole turn, by default)
|
|
14
|
+
*/
|
|
15
|
+
export declare const revealed: Readonly<{
|
|
16
|
+
readonly drawIn: Readonly<{
|
|
17
|
+
readonly strokeDasharray: stylex.StyleXClassNameFor<"strokeDasharray", 1>;
|
|
18
|
+
readonly strokeDashoffset: stylex.StyleXClassNameFor<"strokeDashoffset", 0 | 1>;
|
|
19
|
+
readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "stroke-dashoffset">;
|
|
20
|
+
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
21
|
+
readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", string>;
|
|
22
|
+
readonly transitionDelay: stylex.StyleXClassNameFor<"transitionDelay", "0s" | "calc(var(--narvi-reveal-delay, 0ms) + var(--narvi-draw-delay, 0ms))">;
|
|
23
|
+
}>;
|
|
24
|
+
readonly fadeAfter: Readonly<{
|
|
25
|
+
readonly opacity: stylex.StyleXClassNameFor<"opacity", 0 | null>;
|
|
26
|
+
readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "opacity">;
|
|
27
|
+
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
28
|
+
readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", string>;
|
|
29
|
+
readonly transitionDelay: stylex.StyleXClassNameFor<"transitionDelay", "0s" | `calc(var(--narvi-reveal-delay, 0ms) + var(--narvi-fade-delay, ${stylex.StyleXVar<string>}))`>;
|
|
30
|
+
}>;
|
|
31
|
+
readonly sweep: Readonly<{
|
|
32
|
+
readonly strokeDashoffset: stylex.StyleXClassNameFor<"strokeDashoffset", 0 | "var(--narvi-sweep-from, 1)">;
|
|
33
|
+
readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "stroke-dashoffset">;
|
|
34
|
+
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
35
|
+
readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", string>;
|
|
36
|
+
readonly transitionDelay: stylex.StyleXClassNameFor<"transitionDelay", "0s" | "calc(var(--narvi-reveal-delay, 0ms) + var(--narvi-sweep-delay, 0ms))">;
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import { media } from '../../media.stylex.js';
|
|
3
|
+
import { pageMotion } from '../../tokens.stylex.js';
|
|
4
|
+
/**
|
|
5
|
+
* Styles for what sits inside a `Reveal`, which follow it in as it is reached. Each moves
|
|
6
|
+
* only on the way in, so hiding below the fold is instant, and only for readers who have
|
|
7
|
+
* not asked for less motion. Each also waits for the Reveal's own `delay`.
|
|
8
|
+
*
|
|
9
|
+
* Apply them with `sx` on a component, or spread `sx(...)` onto an element:
|
|
10
|
+
* `<path pathLength="1" {...sx(revealed.drawIn)} />`.
|
|
11
|
+
*
|
|
12
|
+
* Fine-tune them with custom properties, set on the element or anywhere above it:
|
|
13
|
+
* - `--narvi-draw-delay`, `--narvi-fade-delay` and `--narvi-sweep-delay`: a wait of its own,
|
|
14
|
+
* after the Reveal's
|
|
15
|
+
* - `--narvi-sweep-from`: where a sweep starts, as a dash offset (`1`, a whole turn, by default)
|
|
16
|
+
*/
|
|
17
|
+
export const revealed = stylex.create({
|
|
18
|
+
/**
|
|
19
|
+
* Draws a stroke in, end to end. Give the path, line or circle `pathLength="1"`, so its
|
|
20
|
+
* length is 1 whatever its size.
|
|
21
|
+
*/
|
|
22
|
+
drawIn: {
|
|
23
|
+
strokeDasharray: 1,
|
|
24
|
+
strokeDashoffset: { default: 0, [stylex.when.ancestor('[data-reveal=hidden]')]: 1 },
|
|
25
|
+
transitionProperty: 'stroke-dashoffset',
|
|
26
|
+
transitionDuration: {
|
|
27
|
+
default: '0s',
|
|
28
|
+
[stylex.when.ancestor('[data-reveal=shown]')]: {
|
|
29
|
+
default: '0s',
|
|
30
|
+
[media.motion]: pageMotion.longest
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
transitionTimingFunction: pageMotion.ease,
|
|
34
|
+
transitionDelay: {
|
|
35
|
+
default: '0s',
|
|
36
|
+
[stylex.when.ancestor('[data-reveal=shown]')]: 'calc(var(--narvi-reveal-delay, 0ms) + var(--narvi-draw-delay, 0ms))'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
/** Fades in once a drawing is well under way: a mark or a label that sits on it. */
|
|
40
|
+
fadeAfter: {
|
|
41
|
+
opacity: { default: null, [stylex.when.ancestor('[data-reveal=hidden]')]: 0 },
|
|
42
|
+
transitionProperty: 'opacity',
|
|
43
|
+
transitionDuration: {
|
|
44
|
+
default: '0s',
|
|
45
|
+
[stylex.when.ancestor('[data-reveal=shown]')]: {
|
|
46
|
+
default: '0s',
|
|
47
|
+
[media.motion]: pageMotion.long
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
transitionTimingFunction: pageMotion.ease,
|
|
51
|
+
transitionDelay: {
|
|
52
|
+
default: '0s',
|
|
53
|
+
[stylex.when.ancestor('[data-reveal=shown]')]: `calc(var(--narvi-reveal-delay, 0ms) + var(--narvi-fade-delay, ${pageMotion.long}))`
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Runs a dash round its path into place. Give it `pathLength="1"` and a dash of your own,
|
|
58
|
+
* such as `stroke-dasharray="0.25 0.75"`: a lit stretch of a ring, or a comet on a line.
|
|
59
|
+
*/
|
|
60
|
+
sweep: {
|
|
61
|
+
strokeDashoffset: {
|
|
62
|
+
default: 0,
|
|
63
|
+
[stylex.when.ancestor('[data-reveal=hidden]')]: 'var(--narvi-sweep-from, 1)'
|
|
64
|
+
},
|
|
65
|
+
transitionProperty: 'stroke-dashoffset',
|
|
66
|
+
transitionDuration: {
|
|
67
|
+
default: '0s',
|
|
68
|
+
[stylex.when.ancestor('[data-reveal=shown]')]: {
|
|
69
|
+
default: '0s',
|
|
70
|
+
[media.motion]: pageMotion.longest
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
transitionTimingFunction: pageMotion.ease,
|
|
74
|
+
transitionDelay: {
|
|
75
|
+
default: '0s',
|
|
76
|
+
[stylex.when.ancestor('[data-reveal=shown]')]: 'calc(var(--narvi-reveal-delay, 0ms) + var(--narvi-sweep-delay, 0ms))'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
5
5
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
6
|
+
import { media } from '../../media.stylex.js';
|
|
6
7
|
|
|
7
8
|
export type SegmentedOption = { value: string; label: string; disabled?: boolean };
|
|
8
9
|
|
|
@@ -17,11 +18,6 @@
|
|
|
17
18
|
sx?: Sx;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
// StyleX needs these in the same file to evaluate them at build time
|
|
21
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
22
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
23
|
-
const FORCED = '@media (forced-colors: active)';
|
|
24
|
-
|
|
25
21
|
const styles = stylex.create({
|
|
26
22
|
root: {
|
|
27
23
|
WebkitAppRegion: 'no-drag',
|
|
@@ -31,9 +27,8 @@
|
|
|
31
27
|
gridAutoColumns: '1fr',
|
|
32
28
|
boxSizing: 'border-box',
|
|
33
29
|
padding: '0.1875rem',
|
|
34
|
-
borderRadius: `calc(${radius.
|
|
35
|
-
backgroundColor: colors.
|
|
36
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}, inset 0 1px 2px ${colors.shade}`,
|
|
30
|
+
borderRadius: `calc(${radius.item} + 0.1875rem)`,
|
|
31
|
+
backgroundColor: colors.fillSunken,
|
|
37
32
|
fontFamily: font.body,
|
|
38
33
|
outlineStyle: 'solid',
|
|
39
34
|
outlineWidth: '1px',
|
|
@@ -53,17 +48,17 @@
|
|
|
53
48
|
default: 'calc(var(--narvi-seg-index) * 100%) 0',
|
|
54
49
|
':dir(rtl)': 'calc(var(--narvi-seg-index) * -100%) 0'
|
|
55
50
|
},
|
|
56
|
-
borderRadius: radius.
|
|
57
|
-
backgroundColor: { default: colors.
|
|
58
|
-
boxShadow: `inset 0 0 0 1px ${colors.
|
|
51
|
+
borderRadius: radius.item,
|
|
52
|
+
backgroundColor: { default: colors.bgRaised, [media.forcedColors]: 'Canvas' },
|
|
53
|
+
boxShadow: `inset 0 0 0 1px ${colors.border}`,
|
|
59
54
|
outlineStyle: 'solid',
|
|
60
55
|
outlineWidth: '2px',
|
|
61
56
|
outlineOffset: '-2px',
|
|
62
|
-
outlineColor: { default: 'transparent', [
|
|
57
|
+
outlineColor: { default: 'transparent', [media.forcedColors]: 'Highlight' },
|
|
63
58
|
forcedColorAdjust: 'none'
|
|
64
59
|
},
|
|
65
60
|
thumbSlides: {
|
|
66
|
-
transitionProperty: { default: 'none', [
|
|
61
|
+
transitionProperty: { default: 'none', [media.motion]: 'translate' },
|
|
67
62
|
transitionDuration: motion.slow,
|
|
68
63
|
transitionTimingFunction: motion.easeInOut
|
|
69
64
|
},
|
|
@@ -92,13 +87,13 @@
|
|
|
92
87
|
placeItems: 'center',
|
|
93
88
|
minHeight: '1.75rem',
|
|
94
89
|
paddingInline: '0.75rem',
|
|
95
|
-
borderRadius: radius.
|
|
90
|
+
borderRadius: radius.item,
|
|
96
91
|
color: {
|
|
97
92
|
default: colors.textMuted,
|
|
98
|
-
':hover': { default: null, [
|
|
93
|
+
':hover': { default: null, [media.hover]: colors.text },
|
|
99
94
|
[stylex.when.siblingBefore(':checked')]: colors.text
|
|
100
95
|
},
|
|
101
|
-
fontSize: font.
|
|
96
|
+
fontSize: font.sizeBody,
|
|
102
97
|
fontWeight: {
|
|
103
98
|
default: font.weightMedium,
|
|
104
99
|
[stylex.when.siblingBefore(':checked')]: font.weightSemibold
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
placeholder: { color: colors.textSubtle },
|
|
58
58
|
selector: { display: 'grid', flexShrink: 0, color: colors.textSubtle },
|
|
59
|
-
check: { display: 'grid', marginInlineStart: 'auto', color: colors.
|
|
59
|
+
check: { display: 'grid', marginInlineStart: 'auto', color: colors.accent }
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
type Group = { name: string | undefined; options: SelectOption[] };
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
paddingBlock: space.x4,
|
|
35
35
|
borderBottomWidth: '1px',
|
|
36
36
|
borderBottomStyle: 'solid',
|
|
37
|
-
borderBottomColor: colors.
|
|
37
|
+
borderBottomColor: colors.border
|
|
38
38
|
},
|
|
39
39
|
text: { display: 'flex', flexDirection: 'column', gap: '0.125rem', minWidth: 0 },
|
|
40
|
-
label: { color: colors.text, fontSize: font.
|
|
40
|
+
label: { color: colors.text, fontSize: font.sizeBody, fontWeight: font.weightMedium },
|
|
41
41
|
description: {
|
|
42
42
|
margin: 0,
|
|
43
43
|
color: colors.textMuted,
|
|
44
|
-
fontSize: font.
|
|
44
|
+
fontSize: font.sizeMeta,
|
|
45
45
|
lineHeight: font.leadingSnug
|
|
46
46
|
},
|
|
47
47
|
control: {
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
alignItems: { default: 'flex-start', [WIDE]: 'flex-end' },
|
|
51
51
|
gap: '0.375rem'
|
|
52
52
|
},
|
|
53
|
-
note: { margin: 0, fontSize: font.
|
|
53
|
+
note: { margin: 0, fontSize: font.sizeMeta, lineHeight: font.leadingSnug },
|
|
54
54
|
error: { color: colors.danger },
|
|
55
|
-
warning: { color: colors.
|
|
55
|
+
warning: { color: colors.warningText }
|
|
56
56
|
});
|
|
57
57
|
</script>
|
|
58
58
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { Dialog } from 'bits-ui';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import Glyph from '../../internal/Glyph.svelte';
|
|
6
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
|
+
import Button from '../button/Button.svelte';
|
|
8
|
+
import { dialog } from '../dialog/styles.js';
|
|
9
|
+
import { sheet } from './styles.js';
|
|
10
|
+
|
|
11
|
+
export type SheetSide = 'start' | 'end' | 'top' | 'bottom';
|
|
12
|
+
|
|
13
|
+
export type SheetContentProps = Omit<Dialog.ContentProps, 'children' | 'child'> & {
|
|
14
|
+
/** The edge it slides in from. `start` and `end` follow the writing direction. */
|
|
15
|
+
side?: SheetSide;
|
|
16
|
+
/** How wide a sheet along the start or end is: 20, 26 or 36rem. */
|
|
17
|
+
size?: 'sm' | 'md' | 'lg';
|
|
18
|
+
/** Accessible name of the close button in the corner. `null` leaves it out. */
|
|
19
|
+
closeLabel?: string | null;
|
|
20
|
+
sx?: Sx;
|
|
21
|
+
/** A Sheet.Header, a Sheet.Body and a Sheet.Footer. */
|
|
22
|
+
children?: Snippet;
|
|
23
|
+
};
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<script lang="ts">
|
|
27
|
+
let {
|
|
28
|
+
side = 'end',
|
|
29
|
+
size = 'md',
|
|
30
|
+
closeLabel = 'Close',
|
|
31
|
+
ref = $bindable(null),
|
|
32
|
+
sx,
|
|
33
|
+
class: className,
|
|
34
|
+
children,
|
|
35
|
+
...rest
|
|
36
|
+
}: SheetContentProps = $props();
|
|
37
|
+
|
|
38
|
+
const across = $derived(side === 'start' || side === 'end');
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<Dialog.Portal>
|
|
42
|
+
<Dialog.Overlay data-slot="sheet-overlay" {...stylex.attrs(dialog.overlay)} />
|
|
43
|
+
<Dialog.Content
|
|
44
|
+
bind:ref
|
|
45
|
+
data-slot="sheet"
|
|
46
|
+
data-side={side}
|
|
47
|
+
{...rest}
|
|
48
|
+
{...attrs([dialog.content, sheet.sheet, across && sheet[size], sheet[side], sx], className)}
|
|
49
|
+
>
|
|
50
|
+
{@render children?.()}
|
|
51
|
+
{#if closeLabel}
|
|
52
|
+
<span {...stylex.attrs(dialog.close)}>
|
|
53
|
+
<Dialog.Close>
|
|
54
|
+
{#snippet child({ props })}
|
|
55
|
+
<Button {...props} variant="ghost" size="sm" iconOnly aria-label={closeLabel}>
|
|
56
|
+
<Glyph name="close" />
|
|
57
|
+
</Button>
|
|
58
|
+
{/snippet}
|
|
59
|
+
</Dialog.Close>
|
|
60
|
+
</span>
|
|
61
|
+
{/if}
|
|
62
|
+
</Dialog.Content>
|
|
63
|
+
</Dialog.Portal>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Dialog } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type SheetSide = 'start' | 'end' | 'top' | 'bottom';
|
|
5
|
+
export type SheetContentProps = Omit<Dialog.ContentProps, 'children' | 'child'> & {
|
|
6
|
+
/** The edge it slides in from. `start` and `end` follow the writing direction. */
|
|
7
|
+
side?: SheetSide;
|
|
8
|
+
/** How wide a sheet along the start or end is: 20, 26 or 36rem. */
|
|
9
|
+
size?: 'sm' | 'md' | 'lg';
|
|
10
|
+
/** Accessible name of the close button in the corner. `null` leaves it out. */
|
|
11
|
+
closeLabel?: string | null;
|
|
12
|
+
sx?: Sx;
|
|
13
|
+
/** A Sheet.Header, a Sheet.Body and a Sheet.Footer. */
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
};
|
|
16
|
+
declare const SheetContent: import("svelte").Component<SheetContentProps, {}, "ref">;
|
|
17
|
+
type SheetContent = ReturnType<typeof SheetContent>;
|
|
18
|
+
export default SheetContent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Dialog } from 'bits-ui';
|
|
2
|
+
import Body from '../dialog/DialogBody.svelte';
|
|
3
|
+
import Description from '../dialog/DialogDescription.svelte';
|
|
4
|
+
import Footer from '../dialog/DialogFooter.svelte';
|
|
5
|
+
import Header from '../dialog/DialogHeader.svelte';
|
|
6
|
+
import Title from '../dialog/DialogTitle.svelte';
|
|
7
|
+
import Content from './SheetContent.svelte';
|
|
8
|
+
declare const Root: import("svelte").Component<import("bits-ui").AlertDialogRootPropsWithoutHTML, {}, "open">;
|
|
9
|
+
declare const Trigger: import("svelte").Component<Dialog.TriggerProps, {}, "ref">;
|
|
10
|
+
declare const Close: import("svelte").Component<Dialog.TriggerProps, {}, "ref">;
|
|
11
|
+
export { Root, Trigger, Content, Header, Title, Description, Body, Footer, Close };
|
|
12
|
+
export type { SheetContentProps, SheetSide } from './SheetContent.svelte';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Dialog } from 'bits-ui';
|
|
2
|
+
import Body from '../dialog/DialogBody.svelte';
|
|
3
|
+
import Description from '../dialog/DialogDescription.svelte';
|
|
4
|
+
import Footer from '../dialog/DialogFooter.svelte';
|
|
5
|
+
import Header from '../dialog/DialogHeader.svelte';
|
|
6
|
+
import Title from '../dialog/DialogTitle.svelte';
|
|
7
|
+
import Content from './SheetContent.svelte';
|
|
8
|
+
// A sheet is a dialog along an edge: the same behaviour and the same parts
|
|
9
|
+
const Root = Dialog.Root;
|
|
10
|
+
const Trigger = Dialog.Trigger;
|
|
11
|
+
const Close = Dialog.Close;
|
|
12
|
+
export { Root, Trigger, Content, Header, Title, Description, Body, Footer, Close };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
/** Laid over Dialog's content: a panel along one edge of the window, which it slides in from. */
|
|
3
|
+
export declare const sheet: Readonly<{
|
|
4
|
+
readonly sheet: Readonly<{
|
|
5
|
+
readonly maxHeight: stylex.StyleXClassNameFor<"maxHeight", "none">;
|
|
6
|
+
readonly marginInline: stylex.StyleXClassNameFor<"marginInline", 0>;
|
|
7
|
+
readonly translate: stylex.StyleXClassNameFor<"translate", "none">;
|
|
8
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", 0>;
|
|
9
|
+
readonly scale: stylex.StyleXClassNameFor<"scale", null>;
|
|
10
|
+
readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "opacity" | "opacity, translate">;
|
|
11
|
+
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
12
|
+
readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", "cubic-bezier(0.32, 0.72, 0, 1)">;
|
|
13
|
+
}>;
|
|
14
|
+
readonly sm: Readonly<{
|
|
15
|
+
readonly width: stylex.StyleXClassNameFor<"width", "min(20rem, calc(100vw - 2rem))">;
|
|
16
|
+
}>;
|
|
17
|
+
readonly md: Readonly<{
|
|
18
|
+
readonly width: stylex.StyleXClassNameFor<"width", "min(26rem, calc(100vw - 2rem))">;
|
|
19
|
+
}>;
|
|
20
|
+
readonly lg: Readonly<{
|
|
21
|
+
readonly width: stylex.StyleXClassNameFor<"width", "min(36rem, calc(100vw - 2rem))">;
|
|
22
|
+
}>;
|
|
23
|
+
readonly end: Readonly<{
|
|
24
|
+
readonly top: stylex.StyleXClassNameFor<"top", 0>;
|
|
25
|
+
readonly bottom: stylex.StyleXClassNameFor<"bottom", 0>;
|
|
26
|
+
readonly insetInlineStart: stylex.StyleXClassNameFor<"insetInlineStart", "auto">;
|
|
27
|
+
readonly insetInlineEnd: stylex.StyleXClassNameFor<"insetInlineEnd", 0>;
|
|
28
|
+
readonly translate: stylex.StyleXClassNameFor<"translate", "0 0" | "100% 0" | null>;
|
|
29
|
+
}>;
|
|
30
|
+
readonly start: Readonly<{
|
|
31
|
+
readonly top: stylex.StyleXClassNameFor<"top", 0>;
|
|
32
|
+
readonly bottom: stylex.StyleXClassNameFor<"bottom", 0>;
|
|
33
|
+
readonly insetInlineStart: stylex.StyleXClassNameFor<"insetInlineStart", 0>;
|
|
34
|
+
readonly insetInlineEnd: stylex.StyleXClassNameFor<"insetInlineEnd", "auto">;
|
|
35
|
+
readonly translate: stylex.StyleXClassNameFor<"translate", "0 0" | "-100% 0" | null>;
|
|
36
|
+
}>;
|
|
37
|
+
readonly top: Readonly<{
|
|
38
|
+
readonly top: stylex.StyleXClassNameFor<"top", 0>;
|
|
39
|
+
readonly bottom: stylex.StyleXClassNameFor<"bottom", "auto">;
|
|
40
|
+
readonly width: stylex.StyleXClassNameFor<"width", "100%">;
|
|
41
|
+
readonly maxHeight: stylex.StyleXClassNameFor<"maxHeight", "calc(100dvh - 4rem)">;
|
|
42
|
+
readonly translate: stylex.StyleXClassNameFor<"translate", "0 0" | "0 -100%" | null>;
|
|
43
|
+
}>;
|
|
44
|
+
readonly bottom: Readonly<{
|
|
45
|
+
readonly top: stylex.StyleXClassNameFor<"top", "auto">;
|
|
46
|
+
readonly bottom: stylex.StyleXClassNameFor<"bottom", 0>;
|
|
47
|
+
readonly width: stylex.StyleXClassNameFor<"width", "100%">;
|
|
48
|
+
readonly maxHeight: stylex.StyleXClassNameFor<"maxHeight", "calc(100dvh - 4rem)">;
|
|
49
|
+
readonly translate: stylex.StyleXClassNameFor<"translate", "0 0" | "0 100%" | null>;
|
|
50
|
+
}>;
|
|
51
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import { motion } from '../../tokens.stylex.js';
|
|
3
|
+
import { media } from '../../media.stylex.js';
|
|
4
|
+
const CLOSED = ':is([data-state="closed"])';
|
|
5
|
+
// iOS's drawer curve: it leaves the edge quickly and settles long
|
|
6
|
+
const DRAWER = 'cubic-bezier(0.32, 0.72, 0, 1)';
|
|
7
|
+
/** Laid over Dialog's content: a panel along one edge of the window, which it slides in from. */
|
|
8
|
+
export const sheet = stylex.create({
|
|
9
|
+
sheet: {
|
|
10
|
+
maxHeight: 'none',
|
|
11
|
+
marginInline: 0,
|
|
12
|
+
translate: 'none',
|
|
13
|
+
borderRadius: 0,
|
|
14
|
+
scale: null,
|
|
15
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, translate' },
|
|
16
|
+
transitionDuration: { default: motion.slow, [CLOSED]: motion.base },
|
|
17
|
+
transitionTimingFunction: DRAWER
|
|
18
|
+
},
|
|
19
|
+
// Widths of a sheet along the start or end
|
|
20
|
+
sm: { width: 'min(20rem, calc(100vw - 2rem))' },
|
|
21
|
+
md: { width: 'min(26rem, calc(100vw - 2rem))' },
|
|
22
|
+
lg: { width: 'min(36rem, calc(100vw - 2rem))' },
|
|
23
|
+
end: {
|
|
24
|
+
top: 0,
|
|
25
|
+
bottom: 0,
|
|
26
|
+
insetInlineStart: 'auto',
|
|
27
|
+
insetInlineEnd: 0,
|
|
28
|
+
translate: {
|
|
29
|
+
default: null,
|
|
30
|
+
[media.motion]: { default: '0 0', '@starting-style': '100% 0', [CLOSED]: '100% 0' }
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
start: {
|
|
34
|
+
top: 0,
|
|
35
|
+
bottom: 0,
|
|
36
|
+
insetInlineStart: 0,
|
|
37
|
+
insetInlineEnd: 'auto',
|
|
38
|
+
translate: {
|
|
39
|
+
default: null,
|
|
40
|
+
[media.motion]: { default: '0 0', '@starting-style': '-100% 0', [CLOSED]: '-100% 0' }
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
// Along the top or bottom it runs the full width, as tall as its content, and
|
|
44
|
+
// never more than the window less 4rem, so the page it covers still shows
|
|
45
|
+
top: {
|
|
46
|
+
top: 0,
|
|
47
|
+
bottom: 'auto',
|
|
48
|
+
width: '100%',
|
|
49
|
+
maxHeight: 'calc(100dvh - 4rem)',
|
|
50
|
+
translate: {
|
|
51
|
+
default: null,
|
|
52
|
+
[media.motion]: { default: '0 0', '@starting-style': '0 -100%', [CLOSED]: '0 -100%' }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
bottom: {
|
|
56
|
+
top: 'auto',
|
|
57
|
+
bottom: 0,
|
|
58
|
+
width: '100%',
|
|
59
|
+
maxHeight: 'calc(100dvh - 4rem)',
|
|
60
|
+
translate: {
|
|
61
|
+
default: null,
|
|
62
|
+
[media.motion]: { default: '0 0', '@starting-style': '0 100%', [CLOSED]: '0 100%' }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import * as stylex from '@stylexjs/stylex';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
-
import { loop } from '../../internal/loop.js';
|
|
6
5
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
|
-
import {
|
|
6
|
+
import { whileVisible } from '../../internal/visible.js';
|
|
7
|
+
import { colors, play } from '../../tokens.stylex.js';
|
|
8
|
+
import { media } from '../../media.stylex.js';
|
|
8
9
|
|
|
9
10
|
export type ShimmerProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
|
|
10
11
|
/** Turn it off to show the text plainly, for example once the work is done. */
|
|
@@ -13,42 +14,56 @@
|
|
|
13
14
|
children?: Snippet;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
const
|
|
17
|
+
// A band of light crosses the line, start to end
|
|
18
|
+
const glint = stylex.keyframes({
|
|
19
|
+
from: { backgroundPosition: '100% 0' },
|
|
20
|
+
to: { backgroundPosition: '0% 0' }
|
|
21
|
+
});
|
|
22
|
+
const glintRtl = stylex.keyframes({
|
|
23
|
+
from: { backgroundPosition: '0% 0' },
|
|
24
|
+
to: { backgroundPosition: '100% 0' }
|
|
25
|
+
});
|
|
26
|
+
// With less motion asked for, the text breathes in place instead
|
|
27
|
+
const breathe = stylex.keyframes({
|
|
28
|
+
'0%': { opacity: 1 },
|
|
29
|
+
'50%': { opacity: 0.55 },
|
|
30
|
+
'100%': { opacity: 1 }
|
|
31
|
+
});
|
|
18
32
|
|
|
19
33
|
const styles = stylex.create({
|
|
20
34
|
// Inline, so it wraps and truncates like the text around it
|
|
21
35
|
base: {
|
|
22
36
|
display: 'inline'
|
|
23
37
|
},
|
|
24
|
-
//
|
|
38
|
+
// The letters are only half there until a band of the accent passes over them
|
|
25
39
|
active: {
|
|
26
|
-
color: {
|
|
40
|
+
color: {
|
|
41
|
+
default: 'transparent',
|
|
42
|
+
[media.reducedMotion]: colors.textMuted,
|
|
43
|
+
[media.forcedColors]: 'CanvasText'
|
|
44
|
+
},
|
|
27
45
|
backgroundImage: {
|
|
28
|
-
default: `linear-gradient(90deg, ${colors.textSubtle} 0%, ${colors.textSubtle} 40%, ${colors.
|
|
29
|
-
[
|
|
30
|
-
[
|
|
46
|
+
default: `linear-gradient(90deg, ${colors.textSubtle} 0%, ${colors.textSubtle} 40%, ${colors.accent} 50%, ${colors.textSubtle} 60%, ${colors.textSubtle} 100%)`,
|
|
47
|
+
[media.reducedMotion]: 'none',
|
|
48
|
+
[media.forcedColors]: 'none'
|
|
31
49
|
},
|
|
32
50
|
backgroundSize: '300% 100%',
|
|
33
51
|
backgroundClip: 'text',
|
|
34
|
-
WebkitBackgroundClip: 'text'
|
|
52
|
+
WebkitBackgroundClip: 'text',
|
|
53
|
+
// Stepped: thirty frames in 2.2 seconds is about fourteen a second, which reads as
|
|
54
|
+
// smooth for a slow band of light and leaves the display's other frames alone
|
|
55
|
+
animationName: {
|
|
56
|
+
default: glint,
|
|
57
|
+
':dir(rtl)': glintRtl,
|
|
58
|
+
[media.reducedMotion]: breathe,
|
|
59
|
+
[media.forcedColors]: 'none'
|
|
60
|
+
},
|
|
61
|
+
animationDuration: { default: '2.2s', [media.reducedMotion]: '2s' },
|
|
62
|
+
animationTimingFunction: { default: 'steps(30)', [media.reducedMotion]: 'steps(12)' },
|
|
63
|
+
animationIterationCount: 'infinite',
|
|
64
|
+
animationPlayState: play.whileVisible
|
|
35
65
|
}
|
|
36
66
|
});
|
|
37
|
-
|
|
38
|
-
// The band of light crosses the line every 2.2 seconds, on Narvi's shared clock.
|
|
39
|
-
// With reduced motion the text breathes in place instead.
|
|
40
|
-
const glint = loop(
|
|
41
|
-
(reduced) => (reduced ? 2000 : 2200),
|
|
42
|
-
(element, { progress, reduced, rtl }) => {
|
|
43
|
-
if (reduced) {
|
|
44
|
-
element.style.backgroundPosition = '';
|
|
45
|
-
element.style.opacity = String(0.775 + 0.225 * Math.cos(progress * 2 * Math.PI));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
element.style.opacity = '';
|
|
49
|
-
element.style.backgroundPosition = `${rtl ? progress * 100 : 100 - progress * 100}% 0`;
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
67
|
</script>
|
|
53
68
|
|
|
54
69
|
<script lang="ts">
|
|
@@ -60,7 +75,7 @@
|
|
|
60
75
|
data-active={active || undefined}
|
|
61
76
|
{...rest}
|
|
62
77
|
{...attrs([styles.base, active && styles.active, sx], className)}
|
|
63
|
-
{@attach active &&
|
|
78
|
+
{@attach active && whileVisible}
|
|
64
79
|
>
|
|
65
80
|
{@render children?.()}
|
|
66
81
|
</span>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
paddingInline: '0.5rem',
|
|
24
24
|
paddingBottom: '0.75rem',
|
|
25
25
|
scrollbarWidth: 'thin',
|
|
26
|
-
scrollbarColor: `${colors.
|
|
26
|
+
scrollbarColor: `${colors.borderStrong} transparent`,
|
|
27
27
|
// The list fades at an edge with more beyond it
|
|
28
28
|
maskImage:
|
|
29
29
|
'linear-gradient(to bottom, transparent, #000 var(--narvi-fade-start, 0px), #000 calc(100% - var(--narvi-fade-end, 0px)), transparent)'
|