@diegopluna/narvi 0.0.2 → 0.1.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 +17 -6
- package/dist/base.css +96 -0
- package/dist/components/activity/ActivityTrigger.svelte +2 -3
- package/dist/components/app-shell/AppShellHeader.svelte +2 -3
- package/dist/components/app-shell/AppShellSidebar.svelte +6 -6
- package/dist/components/approval/Approval.svelte +8 -4
- package/dist/components/button/Button.svelte +15 -18
- package/dist/components/card/Card.svelte +10 -13
- package/dist/components/checkbox/Checkbox.svelte +16 -13
- 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/styles.js +3 -3
- package/dist/components/composer/ComposerAttachment.svelte +4 -6
- package/dist/components/composer/ComposerModelPicker.svelte +8 -10
- package/dist/components/composer/ComposerRoot.svelte +7 -6
- package/dist/components/composer/ComposerSubmit.svelte +4 -5
- package/dist/components/composer/ComposerToggle.svelte +11 -11
- package/dist/components/conversation/ConversationScrollButton.svelte +6 -8
- package/dist/components/dialog/DialogContent.svelte +5 -1
- package/dist/components/dialog/styles.d.ts +0 -23
- package/dist/components/dialog/styles.js +7 -43
- package/dist/components/grid/Grid.svelte +111 -0
- package/dist/components/grid/Grid.svelte.d.ts +27 -0
- 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/link/Link.svelte +2 -4
- package/dist/components/message/MessageAction.svelte +2 -3
- package/dist/components/message/MessageActions.svelte +2 -3
- package/dist/components/message/MessageCopy.svelte +4 -5
- package/dist/components/message/MessageRoot.svelte +3 -4
- package/dist/components/message/MessageTime.svelte +2 -3
- package/dist/components/plan/Plan.svelte +3 -4
- package/dist/components/progress/Progress.svelte +4 -6
- package/dist/components/rail/RailItem.svelte +9 -9
- package/dist/components/reasoning/ReasoningTrigger.svelte +2 -3
- package/dist/components/resize-handle/ResizeHandle.svelte +3 -5
- 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 +5 -9
- 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 +8 -6
- package/dist/components/sidebar/SidebarGroup.svelte +5 -3
- package/dist/components/sidebar/SidebarItem.svelte +10 -8
- package/dist/components/slider/Slider.svelte +199 -0
- package/dist/components/slider/Slider.svelte.d.ts +55 -0
- package/dist/components/stack/Stack.svelte +37 -44
- package/dist/components/stack/Stack.svelte.d.ts +12 -6
- package/dist/components/suggestions/SuggestionsItem.svelte +7 -9
- package/dist/components/switch/Switch.svelte +8 -12
- package/dist/components/tabs/Tabs.svelte +3 -6
- package/dist/components/text/Text.svelte +47 -5
- package/dist/components/text/Text.svelte.d.ts +8 -2
- package/dist/components/toast/Toaster.svelte +7 -5
- 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/ToolTrigger.svelte +4 -6
- package/dist/components/tooltip/TooltipContent.svelte +6 -3
- package/dist/components/work-fold/WorkFold.svelte +12 -25
- package/dist/components/work-fold/WorkFold.svelte.d.ts +1 -1
- package/dist/index.d.ts +23 -3
- package/dist/index.js +21 -2
- package/dist/internal/Chevron.svelte +2 -3
- package/dist/internal/Collapse.svelte +6 -5
- package/dist/internal/Collapse.svelte.d.ts +2 -1
- package/dist/internal/control.js +4 -4
- package/dist/internal/layer.js +6 -8
- package/dist/internal/layout.d.ts +13 -0
- package/dist/internal/layout.js +453 -0
- package/dist/internal/responsive.d.ts +45 -0
- package/dist/internal/responsive.js +42 -0
- package/dist/internal/sx.d.ts +30 -3
- package/dist/internal/sx.js +17 -0
- package/dist/internal/toggle.d.ts +74 -0
- package/dist/internal/toggle.js +87 -0
- package/dist/media.stylex.d.ts +52 -0
- package/dist/media.stylex.js +53 -0
- package/dist/tokens.stylex.d.ts +15 -0
- package/dist/tokens.stylex.js +20 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.js +10 -2
- package/package.json +7 -2
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import * as stylex from '@stylexjs/stylex';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
import {
|
|
6
|
+
alignStyles,
|
|
7
|
+
columnsStyles,
|
|
8
|
+
gapStyles,
|
|
9
|
+
type Align,
|
|
10
|
+
type Columns,
|
|
11
|
+
type Gap
|
|
12
|
+
} from '../../internal/layout.js';
|
|
13
|
+
import {
|
|
14
|
+
breakpoints,
|
|
15
|
+
isByBreakpoint,
|
|
16
|
+
responsive,
|
|
17
|
+
type Responsive
|
|
18
|
+
} from '../../internal/responsive.js';
|
|
19
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
20
|
+
|
|
21
|
+
/** Steps on the 4px spacing scale: `4` is 16px. */
|
|
22
|
+
export type GridGap = Gap;
|
|
23
|
+
export type GridAlign = Align;
|
|
24
|
+
/**
|
|
25
|
+
* A number of equal columns, from 1 to 12, or a `grid-template-columns` value of your own,
|
|
26
|
+
* such as `'1.15fr 1fr'` or `'repeat(auto-fill, minmax(14rem, 1fr))'`.
|
|
27
|
+
*/
|
|
28
|
+
export type GridColumns = Columns | (string & {});
|
|
29
|
+
|
|
30
|
+
export type GridProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
31
|
+
/** Element to render. A `ul` or `ol` loses its markers and indent. */
|
|
32
|
+
as?: 'div' | 'section' | 'article' | 'nav' | 'header' | 'footer' | 'main' | 'ul' | 'ol' | 'li';
|
|
33
|
+
/** Columns. Like every layout prop, a value or values by breakpoint. */
|
|
34
|
+
columns?: Responsive<GridColumns>;
|
|
35
|
+
gap?: Responsive<GridGap>;
|
|
36
|
+
/** Alignment of each item in its cell, on the block axis. Items stretch by default. */
|
|
37
|
+
align?: Responsive<GridAlign>;
|
|
38
|
+
sx?: Sx;
|
|
39
|
+
children?: Snippet;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const styles = stylex.create({
|
|
43
|
+
base: {
|
|
44
|
+
display: 'grid',
|
|
45
|
+
boxSizing: 'border-box',
|
|
46
|
+
minWidth: 0,
|
|
47
|
+
margin: 0,
|
|
48
|
+
padding: 0,
|
|
49
|
+
listStyleType: 'none'
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// A template of your own cannot be known at build time. It is set as a custom property,
|
|
54
|
+
// inline, and read by the same static rules as a count. (Always a custom property: StyleX's
|
|
55
|
+
// `attrs` misnames the inline variable of a dynamic style on a camel-cased property.)
|
|
56
|
+
const templates = stylex.create({
|
|
57
|
+
default: (template: string) => ({ '--narvi-columns': template }),
|
|
58
|
+
sm: (template: string) => ({ '--narvi-columns-sm': template }),
|
|
59
|
+
md: (template: string) => ({ '--narvi-columns-md': template }),
|
|
60
|
+
lg: (template: string) => ({ '--narvi-columns-lg': template }),
|
|
61
|
+
xl: (template: string) => ({ '--narvi-columns-xl': template })
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const isCount = (value: GridColumns): value is Columns => typeof value === 'number';
|
|
65
|
+
|
|
66
|
+
function columnStyles(columns: Responsive<GridColumns> | undefined) {
|
|
67
|
+
if (!isByBreakpoint(columns)) {
|
|
68
|
+
const value = columns ?? 1;
|
|
69
|
+
return isCount(value)
|
|
70
|
+
? [columnsStyles.fixed[value]]
|
|
71
|
+
: [columnsStyles.chain, templates.default(value)];
|
|
72
|
+
}
|
|
73
|
+
const result: unknown[] = [columnsStyles.chain];
|
|
74
|
+
for (const at of ['default', ...breakpoints] as const) {
|
|
75
|
+
const value = at === 'default' ? (columns.default ?? 1) : columns[at];
|
|
76
|
+
if (value === undefined) continue;
|
|
77
|
+
result.push(isCount(value) ? columnsStyles.set[at][value] : templates[at](value));
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<script lang="ts">
|
|
84
|
+
let {
|
|
85
|
+
as = 'div',
|
|
86
|
+
columns = 1,
|
|
87
|
+
gap = 4,
|
|
88
|
+
align,
|
|
89
|
+
sx,
|
|
90
|
+
class: className,
|
|
91
|
+
children,
|
|
92
|
+
...rest
|
|
93
|
+
}: GridProps = $props();
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<svelte:element
|
|
97
|
+
this={as}
|
|
98
|
+
{...rest}
|
|
99
|
+
{...attrs(
|
|
100
|
+
[
|
|
101
|
+
styles.base,
|
|
102
|
+
columnStyles(columns) as ReadonlyArray<Readonly<Record<string, unknown>>>,
|
|
103
|
+
responsive(gap, 4, gapStyles),
|
|
104
|
+
responsive(align, undefined, alignStyles),
|
|
105
|
+
sx
|
|
106
|
+
],
|
|
107
|
+
className
|
|
108
|
+
)}
|
|
109
|
+
>
|
|
110
|
+
{@render children?.()}
|
|
111
|
+
</svelte:element>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Align, type Columns, type Gap } from '../../internal/layout.js';
|
|
4
|
+
import { type Responsive } from '../../internal/responsive.js';
|
|
5
|
+
import { type Sx } from '../../internal/sx.js';
|
|
6
|
+
/** Steps on the 4px spacing scale: `4` is 16px. */
|
|
7
|
+
export type GridGap = Gap;
|
|
8
|
+
export type GridAlign = Align;
|
|
9
|
+
/**
|
|
10
|
+
* A number of equal columns, from 1 to 12, or a `grid-template-columns` value of your own,
|
|
11
|
+
* such as `'1.15fr 1fr'` or `'repeat(auto-fill, minmax(14rem, 1fr))'`.
|
|
12
|
+
*/
|
|
13
|
+
export type GridColumns = Columns | (string & {});
|
|
14
|
+
export type GridProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
15
|
+
/** Element to render. A `ul` or `ol` loses its markers and indent. */
|
|
16
|
+
as?: 'div' | 'section' | 'article' | 'nav' | 'header' | 'footer' | 'main' | 'ul' | 'ol' | 'li';
|
|
17
|
+
/** Columns. Like every layout prop, a value or values by breakpoint. */
|
|
18
|
+
columns?: Responsive<GridColumns>;
|
|
19
|
+
gap?: Responsive<GridGap>;
|
|
20
|
+
/** Alignment of each item in its cell, on the block axis. Items stretch by default. */
|
|
21
|
+
align?: Responsive<GridAlign>;
|
|
22
|
+
sx?: Sx;
|
|
23
|
+
children?: Snippet;
|
|
24
|
+
};
|
|
25
|
+
declare const Grid: import("svelte").Component<GridProps, {}, "">;
|
|
26
|
+
type Grid = ReturnType<typeof Grid>;
|
|
27
|
+
export default Grid;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { LinkPreview } from 'bits-ui';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import { layer } from '../../internal/layer.js';
|
|
6
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
|
+
|
|
8
|
+
export type HoverCardContentProps = Omit<LinkPreview.ContentProps, 'children' | 'child'> & {
|
|
9
|
+
sx?: Sx;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const styles = stylex.create({
|
|
14
|
+
// A card of its own content: a preview of a thread, a file, a person
|
|
15
|
+
card: {
|
|
16
|
+
width: '20rem',
|
|
17
|
+
minWidth: 0,
|
|
18
|
+
padding: '0.75rem'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
let {
|
|
25
|
+
side = 'bottom',
|
|
26
|
+
sideOffset = 6,
|
|
27
|
+
collisionPadding = 8,
|
|
28
|
+
align = 'start',
|
|
29
|
+
ref = $bindable(null),
|
|
30
|
+
sx,
|
|
31
|
+
class: className,
|
|
32
|
+
children,
|
|
33
|
+
...rest
|
|
34
|
+
}: HoverCardContentProps = $props();
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<LinkPreview.Portal>
|
|
38
|
+
<LinkPreview.Content
|
|
39
|
+
bind:ref
|
|
40
|
+
{side}
|
|
41
|
+
{sideOffset}
|
|
42
|
+
{collisionPadding}
|
|
43
|
+
{align}
|
|
44
|
+
data-slot="hover-card"
|
|
45
|
+
{...rest}
|
|
46
|
+
{...attrs([layer.surface, styles.card, sx], className)}
|
|
47
|
+
>
|
|
48
|
+
{@render children?.()}
|
|
49
|
+
</LinkPreview.Content>
|
|
50
|
+
</LinkPreview.Portal>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LinkPreview } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type HoverCardContentProps = Omit<LinkPreview.ContentProps, 'children' | 'child'> & {
|
|
5
|
+
sx?: Sx;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
};
|
|
8
|
+
declare const HoverCardContent: import("svelte").Component<HoverCardContentProps, {}, "ref">;
|
|
9
|
+
type HoverCardContent = ReturnType<typeof HoverCardContent>;
|
|
10
|
+
export default HoverCardContent;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { LinkPreview } from 'bits-ui';
|
|
3
|
+
|
|
4
|
+
export type HoverCardRootProps = LinkPreview.RootProps;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
// A card should not spring up as the pointer crosses on its way somewhere
|
|
9
|
+
// else, so it waits half a second; it lingers a moment on the way out, so the
|
|
10
|
+
// pointer can travel from the trigger into it.
|
|
11
|
+
let {
|
|
12
|
+
open = $bindable(false),
|
|
13
|
+
openDelay = 500,
|
|
14
|
+
closeDelay = 150,
|
|
15
|
+
children,
|
|
16
|
+
...rest
|
|
17
|
+
}: HoverCardRootProps = $props();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<LinkPreview.Root bind:open {openDelay} {closeDelay} {...rest}>
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</LinkPreview.Root>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LinkPreview } from 'bits-ui';
|
|
2
|
+
export type HoverCardRootProps = LinkPreview.RootProps;
|
|
3
|
+
declare const HoverCardRoot: import("svelte").Component<import("bits-ui").LinkPreviewRootPropsWithoutHTML, {}, "open">;
|
|
4
|
+
type HoverCardRoot = ReturnType<typeof HoverCardRoot>;
|
|
5
|
+
export default HoverCardRoot;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LinkPreview } from 'bits-ui';
|
|
2
|
+
import Content from './HoverCardContent.svelte';
|
|
3
|
+
import Root from './HoverCardRoot.svelte';
|
|
4
|
+
declare const Trigger: import("svelte").Component<LinkPreview.TriggerProps, {}, "ref">;
|
|
5
|
+
export { Root, Trigger, Content };
|
|
6
|
+
export type { HoverCardContentProps } from './HoverCardContent.svelte';
|
|
7
|
+
export type { HoverCardRootProps } from './HoverCardRoot.svelte';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LinkPreview } from 'bits-ui';
|
|
2
|
+
import Content from './HoverCardContent.svelte';
|
|
3
|
+
import Root from './HoverCardRoot.svelte';
|
|
4
|
+
// Behaviour only: bits-ui's own part. It renders a link; pass `child` to make
|
|
5
|
+
// another element the trigger.
|
|
6
|
+
const Trigger = LinkPreview.Trigger;
|
|
7
|
+
export { Root, Trigger, Content };
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
5
5
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
6
|
import { colors, motion } from '../../tokens.stylex.js';
|
|
7
|
+
import { media } from '../../media.stylex.js';
|
|
7
8
|
|
|
8
9
|
export type LinkProps = Omit<HTMLAnchorAttributes, 'children'> & {
|
|
9
10
|
href: string;
|
|
@@ -16,9 +17,6 @@
|
|
|
16
17
|
children?: Snippet;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
// StyleX needs this in the same file to evaluate it at build time
|
|
20
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
21
|
-
|
|
22
20
|
const styles = stylex.create({
|
|
23
21
|
base: {
|
|
24
22
|
borderRadius: '0.1875rem',
|
|
@@ -28,7 +26,7 @@
|
|
|
28
26
|
textUnderlineOffset: '0.2em',
|
|
29
27
|
textDecorationColor: {
|
|
30
28
|
default: 'color-mix(in oklch, currentColor 35%, transparent)',
|
|
31
|
-
':hover': { default: null, [
|
|
29
|
+
':hover': { default: null, [media.hover]: 'currentColor' }
|
|
32
30
|
},
|
|
33
31
|
outlineWidth: '2px',
|
|
34
32
|
outlineStyle: { default: 'none', ':focus-visible': 'solid' },
|
|
@@ -3,6 +3,7 @@
|
|
|
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 { media } from '../../media.stylex.js';
|
|
6
7
|
import Button, { type ButtonProps } from '../button/Button.svelte';
|
|
7
8
|
|
|
8
9
|
export type MessageActionProps = Omit<
|
|
@@ -19,14 +20,12 @@
|
|
|
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: {
|
|
@@ -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
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import Glyph from '../../internal/Glyph.svelte';
|
|
4
4
|
import type { Sx } from '../../internal/sx.js';
|
|
5
5
|
import { colors, motion } from '../../tokens.stylex.js';
|
|
6
|
+
import { media } from '../../media.stylex.js';
|
|
6
7
|
import MessageAction, { type MessageActionProps } from './MessageAction.svelte';
|
|
7
8
|
|
|
8
9
|
export type MessageCopyProps = Omit<
|
|
@@ -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: {
|
|
@@ -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,8 +18,6 @@
|
|
|
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',
|
|
@@ -28,7 +27,7 @@
|
|
|
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
|
|
@@ -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',
|
|
@@ -104,8 +103,8 @@
|
|
|
104
103
|
borderRadius: radius.full,
|
|
105
104
|
color: colors.textSubtle,
|
|
106
105
|
opacity: { default: 1, '@starting-style': 0 },
|
|
107
|
-
scale: { default: null, [
|
|
108
|
-
transitionProperty: { default: 'opacity', [
|
|
106
|
+
scale: { default: null, [media.motion]: { default: 1, '@starting-style': 0.6 } },
|
|
107
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, scale' },
|
|
109
108
|
transitionDuration: motion.slow,
|
|
110
109
|
transitionTimingFunction: motion.easeOut
|
|
111
110
|
},
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { loop } from '../../internal/loop.js';
|
|
5
5
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
6
|
import { colors, motion, 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,9 +13,6 @@
|
|
|
12
13
|
sx?: Sx;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
16
|
-
const FORCED = '@media (forced-colors: active)';
|
|
17
|
-
|
|
18
16
|
// The bar of an unknown amount sweeps across on Narvi's shared clock, easing in
|
|
19
17
|
// and out. With reduced motion it breathes in place instead.
|
|
20
18
|
const ease = (t: number) => (t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2);
|
|
@@ -67,7 +65,7 @@
|
|
|
67
65
|
borderRadius: radius.full,
|
|
68
66
|
backgroundImage: {
|
|
69
67
|
default: `linear-gradient(90deg, ${colors.ithilStrong}, ${colors.ithil})`,
|
|
70
|
-
[
|
|
68
|
+
[media.forcedColors]: 'linear-gradient(Highlight, Highlight)'
|
|
71
69
|
},
|
|
72
70
|
forcedColorAdjust: 'none'
|
|
73
71
|
},
|
|
@@ -78,12 +76,12 @@
|
|
|
78
76
|
default: 'calc(var(--narvi-progress) - 100%) 0',
|
|
79
77
|
':dir(rtl)': 'calc(100% - var(--narvi-progress)) 0'
|
|
80
78
|
},
|
|
81
|
-
transitionProperty: { default: 'none', [
|
|
79
|
+
transitionProperty: { default: 'none', [media.motion]: 'translate' },
|
|
82
80
|
transitionDuration: motion.slow,
|
|
83
81
|
transitionTimingFunction: motion.easeOut
|
|
84
82
|
},
|
|
85
83
|
unknown: {
|
|
86
|
-
width: { default: '100%', [
|
|
84
|
+
width: { default: '100%', [media.motion]: '40%' }
|
|
87
85
|
}
|
|
88
86
|
});
|
|
89
87
|
</script>
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { shared } from '../../internal/shared.js';
|
|
5
5
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
6
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
7
|
+
import { media } from '../../media.stylex.js';
|
|
7
8
|
import * as Tooltip from '../tooltip/index.js';
|
|
8
9
|
|
|
9
10
|
export type RailItemProps = {
|
|
@@ -23,10 +24,6 @@
|
|
|
23
24
|
children?: Snippet;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
27
|
-
const FORCED = '@media (forced-colors: active)';
|
|
28
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
29
|
-
|
|
30
27
|
const styles = stylex.create({
|
|
31
28
|
item: {
|
|
32
29
|
position: 'relative',
|
|
@@ -41,16 +38,19 @@
|
|
|
41
38
|
borderRadius: radius.lg,
|
|
42
39
|
backgroundColor: {
|
|
43
40
|
default: 'transparent',
|
|
44
|
-
':hover': { default: null, [
|
|
41
|
+
':hover': { default: null, [media.hover]: colors.hover }
|
|
42
|
+
},
|
|
43
|
+
color: {
|
|
44
|
+
default: colors.textSubtle,
|
|
45
|
+
':hover': { default: null, [media.hover]: colors.text }
|
|
45
46
|
},
|
|
46
|
-
color: { default: colors.textSubtle, ':hover': { default: null, [HOVER]: colors.text } },
|
|
47
47
|
cursor: 'pointer',
|
|
48
48
|
textDecoration: 'none',
|
|
49
49
|
WebkitTapHighlightColor: 'transparent',
|
|
50
|
-
scale: { default: null, ':active': { default: null, [
|
|
50
|
+
scale: { default: null, ':active': { default: null, [media.motion]: 0.95 } },
|
|
51
51
|
transitionProperty: {
|
|
52
52
|
default: 'background-color, color',
|
|
53
|
-
[
|
|
53
|
+
[media.motion]: 'background-color, color, scale'
|
|
54
54
|
},
|
|
55
55
|
transitionDuration: motion.fast,
|
|
56
56
|
transitionTimingFunction: 'ease'
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
bottom: '25%',
|
|
69
69
|
width: '2px',
|
|
70
70
|
borderRadius: '2px',
|
|
71
|
-
backgroundColor: { default: colors.ithil, [
|
|
71
|
+
backgroundColor: { default: colors.ithil, [media.forcedColors]: 'Highlight' },
|
|
72
72
|
boxShadow: `0 0 8px ${colors.glow}`,
|
|
73
73
|
forcedColorAdjust: 'none'
|
|
74
74
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
7
|
import Tile from '../../internal/Tile.svelte';
|
|
8
8
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
9
|
+
import { media } from '../../media.stylex.js';
|
|
9
10
|
import Shimmer from '../shimmer/Shimmer.svelte';
|
|
10
11
|
import { getReasoningContext } from './context.js';
|
|
11
12
|
|
|
@@ -19,8 +20,6 @@
|
|
|
19
20
|
children?: Snippet<[{ streaming: boolean; duration: number | undefined }]>;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
23
|
-
|
|
24
23
|
const styles = stylex.create({
|
|
25
24
|
trigger: {
|
|
26
25
|
display: 'inline-flex',
|
|
@@ -35,7 +34,7 @@
|
|
|
35
34
|
backgroundColor: 'transparent',
|
|
36
35
|
color: {
|
|
37
36
|
default: colors.textMuted,
|
|
38
|
-
':hover': { default: null, [
|
|
37
|
+
':hover': { default: null, [media.hover]: colors.text }
|
|
39
38
|
},
|
|
40
39
|
fontFamily: 'inherit',
|
|
41
40
|
fontSize: font.sizeMd,
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
12
12
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
13
13
|
import { colors, motion } from '../../tokens.stylex.js';
|
|
14
|
+
import { media } from '../../media.stylex.js';
|
|
14
15
|
|
|
15
16
|
export type ResizeHandleProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
16
17
|
/** The size, in pixels. Bindable. */
|
|
@@ -37,9 +38,6 @@
|
|
|
37
38
|
sx?: Sx;
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
41
|
-
const FORCED = '@media (forced-colors: active)';
|
|
42
|
-
|
|
43
41
|
const styles = stylex.create({
|
|
44
42
|
// An 8px target with a 1px line in the middle, lit when it is reached
|
|
45
43
|
handle: {
|
|
@@ -54,9 +52,9 @@
|
|
|
54
52
|
position: 'absolute',
|
|
55
53
|
backgroundColor: {
|
|
56
54
|
default: 'transparent',
|
|
57
|
-
':hover': { default: null, [
|
|
55
|
+
':hover': { default: null, [media.hover]: colors.ithil },
|
|
58
56
|
':focus-visible': colors.focusRing,
|
|
59
|
-
[
|
|
57
|
+
[media.forcedColors]: 'CanvasText'
|
|
60
58
|
},
|
|
61
59
|
boxShadow: { default: null, ':hover': `0 0 8px ${colors.glow}` },
|
|
62
60
|
transitionProperty: 'background-color',
|