@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,83 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { Collapsible } from 'bits-ui';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import Chevron from '../../internal/Chevron.svelte';
|
|
6
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
|
+
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
8
|
+
import { media } from '../../media.stylex.js';
|
|
9
|
+
import { getCollapsibleContext } from './context.js';
|
|
10
|
+
|
|
11
|
+
export type CollapsibleTriggerProps = Omit<Collapsible.TriggerProps, 'children'> & {
|
|
12
|
+
/** Shows the chevron after the label, pointing down while open. */
|
|
13
|
+
chevron?: boolean;
|
|
14
|
+
sx?: Sx;
|
|
15
|
+
/** The label. Pass `child` instead to make your own control the trigger. */
|
|
16
|
+
children?: Snippet;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const styles = stylex.create({
|
|
20
|
+
// A quiet line of text that names what folds, like Reasoning's and WorkFold's
|
|
21
|
+
trigger: {
|
|
22
|
+
display: 'inline-flex',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
alignSelf: 'flex-start',
|
|
25
|
+
gap: '0.25rem',
|
|
26
|
+
maxWidth: '100%',
|
|
27
|
+
minHeight: '1.75rem',
|
|
28
|
+
margin: 0,
|
|
29
|
+
padding: 0,
|
|
30
|
+
borderWidth: 0,
|
|
31
|
+
borderRadius: radius.xs,
|
|
32
|
+
backgroundColor: 'transparent',
|
|
33
|
+
color: { default: colors.textMuted, ':hover': { default: null, [media.hover]: colors.text } },
|
|
34
|
+
fontFamily: 'inherit',
|
|
35
|
+
fontSize: font.sizeMd,
|
|
36
|
+
fontWeight: font.weightMedium,
|
|
37
|
+
lineHeight: font.leadingSnug,
|
|
38
|
+
textAlign: 'start',
|
|
39
|
+
cursor: { default: 'pointer', ':disabled': 'not-allowed' },
|
|
40
|
+
opacity: { default: 1, ':disabled': 0.5 },
|
|
41
|
+
WebkitTapHighlightColor: 'transparent',
|
|
42
|
+
WebkitAppRegion: 'no-drag',
|
|
43
|
+
outlineStyle: 'solid',
|
|
44
|
+
outlineWidth: { default: 0, ':focus-visible': '2px' },
|
|
45
|
+
outlineColor: colors.focusRing,
|
|
46
|
+
outlineOffset: '2px',
|
|
47
|
+
transitionProperty: 'color',
|
|
48
|
+
transitionDuration: motion.fast,
|
|
49
|
+
transitionTimingFunction: 'ease'
|
|
50
|
+
},
|
|
51
|
+
chevron: { display: 'grid', color: colors.textSubtle }
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<script lang="ts">
|
|
56
|
+
let {
|
|
57
|
+
chevron = true,
|
|
58
|
+
ref = $bindable(null),
|
|
59
|
+
sx,
|
|
60
|
+
class: className,
|
|
61
|
+
child,
|
|
62
|
+
children,
|
|
63
|
+
...rest
|
|
64
|
+
}: CollapsibleTriggerProps = $props();
|
|
65
|
+
|
|
66
|
+
const collapsible = getCollapsibleContext('Trigger');
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
{#if child}
|
|
70
|
+
<Collapsible.Trigger bind:ref {child} {...rest} />
|
|
71
|
+
{:else}
|
|
72
|
+
<Collapsible.Trigger
|
|
73
|
+
bind:ref
|
|
74
|
+
data-slot="collapsible-trigger"
|
|
75
|
+
{...rest}
|
|
76
|
+
{...attrs([styles.trigger, sx], className)}
|
|
77
|
+
>
|
|
78
|
+
{@render children?.()}
|
|
79
|
+
{#if chevron}
|
|
80
|
+
<span {...stylex.attrs(styles.chevron)}><Chevron open={collapsible.open} size={12} /></span>
|
|
81
|
+
{/if}
|
|
82
|
+
</Collapsible.Trigger>
|
|
83
|
+
{/if}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Collapsible } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type CollapsibleTriggerProps = Omit<Collapsible.TriggerProps, 'children'> & {
|
|
5
|
+
/** Shows the chevron after the label, pointing down while open. */
|
|
6
|
+
chevron?: boolean;
|
|
7
|
+
sx?: Sx;
|
|
8
|
+
/** The label. Pass `child` instead to make your own control the trigger. */
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
};
|
|
11
|
+
declare const CollapsibleTrigger: import("svelte").Component<CollapsibleTriggerProps, {}, "ref">;
|
|
12
|
+
type CollapsibleTrigger = ReturnType<typeof CollapsibleTrigger>;
|
|
13
|
+
export default CollapsibleTrigger;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
const KEY = Symbol('narvi.collapsible');
|
|
3
|
+
export function setCollapsibleContext(context) {
|
|
4
|
+
setContext(KEY, context);
|
|
5
|
+
}
|
|
6
|
+
export function getCollapsibleContext(part) {
|
|
7
|
+
const context = getContext(KEY);
|
|
8
|
+
if (!context)
|
|
9
|
+
throw new Error(`<Collapsible.${part}> must be placed inside <Collapsible.Root>.`);
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Content from './CollapsibleContent.svelte';
|
|
2
|
+
import Root from './CollapsibleRoot.svelte';
|
|
3
|
+
import Trigger from './CollapsibleTrigger.svelte';
|
|
4
|
+
export { Root, Trigger, Content };
|
|
5
|
+
export type { CollapsibleContentProps } from './CollapsibleContent.svelte';
|
|
6
|
+
export type { CollapsibleRootProps } from './CollapsibleRoot.svelte';
|
|
7
|
+
export type { CollapsibleTriggerProps } from './CollapsibleTrigger.svelte';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
2
|
import { colors, font, radius, space } from '../../tokens.stylex.js';
|
|
3
|
+
import { media } from '../../media.stylex.js';
|
|
3
4
|
const SELECTED = ':is([data-selected])';
|
|
4
|
-
const FORCED = '@media (forced-colors: active)';
|
|
5
5
|
export const command = stylex.create({
|
|
6
6
|
root: {
|
|
7
7
|
display: 'flex',
|
|
@@ -56,7 +56,7 @@ export const command = stylex.create({
|
|
|
56
56
|
userSelect: 'none',
|
|
57
57
|
backgroundColor: {
|
|
58
58
|
default: 'transparent',
|
|
59
|
-
[SELECTED]: { default: colors.hover, [
|
|
59
|
+
[SELECTED]: { default: colors.hover, [media.forcedColors]: 'Highlight' }
|
|
60
60
|
},
|
|
61
61
|
forcedColorAdjust: 'none'
|
|
62
62
|
},
|
|
@@ -101,7 +101,7 @@ export const command = stylex.create({
|
|
|
101
101
|
backgroundColor: colors.bgRaised,
|
|
102
102
|
boxShadow: `inset 0 0 0 1px ${colors.lineStrong}, inset 0 1px 0 ${colors.highlight}, 0 32px 80px -16px rgb(0 0 0 / 0.55)`,
|
|
103
103
|
outlineStyle: 'solid',
|
|
104
|
-
outlineWidth: { default: 0, [
|
|
104
|
+
outlineWidth: { default: 0, [media.forcedColors]: '1px' },
|
|
105
105
|
outlineColor: 'CanvasText'
|
|
106
106
|
},
|
|
107
107
|
overlay: {
|
|
@@ -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 { useComposer } from './context.js';
|
|
9
10
|
|
|
10
11
|
export type ComposerAttachmentProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
@@ -21,9 +22,6 @@
|
|
|
21
22
|
return `${(bytes / 1_000_000).toFixed(1)} MB`;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
25
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
26
|
-
|
|
27
25
|
const styles = stylex.create({
|
|
28
26
|
// A chip: the thumbnail's radius plus the padding, so the corners sit concentric
|
|
29
27
|
chip: {
|
|
@@ -42,8 +40,8 @@
|
|
|
42
40
|
boxShadow: `inset 0 0 0 1px ${colors.line}`,
|
|
43
41
|
cursor: 'default',
|
|
44
42
|
opacity: { default: 1, '@starting-style': 0 },
|
|
45
|
-
scale: { default: null, [
|
|
46
|
-
transitionProperty: { default: 'opacity', [
|
|
43
|
+
scale: { default: null, [media.motion]: { default: 1, '@starting-style': 0.94 } },
|
|
44
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, scale' },
|
|
47
45
|
transitionDuration: motion.base,
|
|
48
46
|
transitionTimingFunction: motion.easeOut
|
|
49
47
|
},
|
|
@@ -103,7 +101,7 @@
|
|
|
103
101
|
boxShadow: `inset 0 0 0 1px ${colors.lineStrong}, 0 1px 2px ${colors.shade}`,
|
|
104
102
|
color: {
|
|
105
103
|
default: colors.textMuted,
|
|
106
|
-
':hover': { default: null, [
|
|
104
|
+
':hover': { default: null, [media.hover]: colors.text }
|
|
107
105
|
},
|
|
108
106
|
cursor: 'pointer',
|
|
109
107
|
WebkitTapHighlightColor: 'transparent',
|
|
@@ -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 { getComposerContext } from './context.js';
|
|
9
10
|
|
|
10
11
|
export type ComposerModel = {
|
|
@@ -31,9 +32,6 @@
|
|
|
31
32
|
ref?: HTMLButtonElement | null;
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
35
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
36
|
-
const FORCED = '@media (forced-colors: active)';
|
|
37
35
|
const GAP = 6;
|
|
38
36
|
const MARGIN = 8;
|
|
39
37
|
|
|
@@ -52,11 +50,11 @@
|
|
|
52
50
|
borderRadius: `calc(${radius.xl} * 4 / 3)`,
|
|
53
51
|
backgroundColor: {
|
|
54
52
|
default: 'transparent',
|
|
55
|
-
':hover': { default: null, [
|
|
53
|
+
':hover': { default: null, [media.hover]: colors.hover }
|
|
56
54
|
},
|
|
57
55
|
color: {
|
|
58
56
|
default: colors.textMuted,
|
|
59
|
-
':hover': { default: null, [
|
|
57
|
+
':hover': { default: null, [media.hover]: colors.text }
|
|
60
58
|
},
|
|
61
59
|
fontFamily: 'inherit',
|
|
62
60
|
fontSize: font.sizeSm,
|
|
@@ -103,17 +101,17 @@
|
|
|
103
101
|
fontFamily: font.body,
|
|
104
102
|
scrollbarWidth: 'thin',
|
|
105
103
|
outlineStyle: 'solid',
|
|
106
|
-
outlineWidth: { default: 0, [
|
|
104
|
+
outlineWidth: { default: 0, [media.forcedColors]: '1px' },
|
|
107
105
|
outlineColor: 'CanvasText',
|
|
108
106
|
transformOrigin: 'var(--narvi-picker-origin, top left)',
|
|
109
107
|
opacity: { default: 0, ':popover-open': { default: 1, '@starting-style': 0 } },
|
|
110
108
|
scale: {
|
|
111
109
|
default: null,
|
|
112
|
-
[
|
|
110
|
+
[media.motion]: { default: 0.97, ':popover-open': { default: 1, '@starting-style': 0.97 } }
|
|
113
111
|
},
|
|
114
112
|
transitionProperty: {
|
|
115
113
|
default: 'opacity, display, overlay',
|
|
116
|
-
[
|
|
114
|
+
[media.motion]: 'opacity, scale, display, overlay'
|
|
117
115
|
},
|
|
118
116
|
transitionBehavior: 'allow-discrete',
|
|
119
117
|
transitionDuration: { default: '100ms', ':popover-open': '160ms' },
|
|
@@ -158,8 +156,8 @@
|
|
|
158
156
|
// The option the keyboard or pointer is on. No transition: it follows the
|
|
159
157
|
// arrow keys, which are pressed many times in a row.
|
|
160
158
|
active: {
|
|
161
|
-
backgroundColor: { default: colors.hover, [
|
|
162
|
-
color: { default: null, [
|
|
159
|
+
backgroundColor: { default: colors.hover, [media.forcedColors]: 'Highlight' },
|
|
160
|
+
color: { default: null, [media.forcedColors]: 'HighlightText' },
|
|
163
161
|
forcedColorAdjust: 'none'
|
|
164
162
|
},
|
|
165
163
|
optionDisabled: {
|
|
@@ -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 {
|
|
9
10
|
accepts,
|
|
10
11
|
setComposerContext,
|
|
@@ -49,9 +50,6 @@
|
|
|
49
50
|
children?: Snippet;
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
const FORCED = '@media (forced-colors: active)';
|
|
53
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
54
|
-
|
|
55
53
|
const styles = stylex.create({
|
|
56
54
|
root: {
|
|
57
55
|
position: 'relative',
|
|
@@ -74,7 +72,10 @@
|
|
|
74
72
|
':focus-within': `inset 0 0 0 1px ${colors.edge}, inset 0 1px 0 ${colors.highlight}, 0 1px 2px ${colors.shade}, 0 16px 32px -20px ${colors.shade}`
|
|
75
73
|
},
|
|
76
74
|
// In forced colours the shadow is gone; the outline is the edge, and thickens with focus
|
|
77
|
-
outlineWidth: {
|
|
75
|
+
outlineWidth: {
|
|
76
|
+
default: '1px',
|
|
77
|
+
[media.forcedColors]: { default: '1px', ':focus-within': '2px' }
|
|
78
|
+
},
|
|
78
79
|
transitionProperty: 'box-shadow',
|
|
79
80
|
transitionDuration: motion.base,
|
|
80
81
|
transitionTimingFunction: 'ease'
|
|
@@ -99,8 +100,8 @@
|
|
|
99
100
|
fontWeight: font.weightMedium,
|
|
100
101
|
pointerEvents: 'none',
|
|
101
102
|
opacity: { default: 1, '@starting-style': 0 },
|
|
102
|
-
scale: { default: null, [
|
|
103
|
-
transitionProperty: { default: 'opacity', [
|
|
103
|
+
scale: { default: null, [media.motion]: { default: 1, '@starting-style': 0.98 } },
|
|
104
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, scale' },
|
|
104
105
|
transitionDuration: motion.base,
|
|
105
106
|
transitionTimingFunction: motion.easeOut
|
|
106
107
|
},
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { loop } from '../../internal/loop.js';
|
|
5
5
|
import 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
|
import Button, { type ButtonProps } from '../button/Button.svelte';
|
|
8
9
|
import { useComposer } from './context.js';
|
|
9
10
|
|
|
@@ -19,8 +20,6 @@
|
|
|
19
20
|
ref?: HTMLButtonElement | null;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
23
|
-
|
|
24
23
|
// While the reply has not started, an arc circles the square, on the shared clock
|
|
25
24
|
const spin = loop(
|
|
26
25
|
(reduced) => (reduced ? 2400 : 900),
|
|
@@ -54,14 +53,14 @@
|
|
|
54
53
|
gridArea: '1 / 1',
|
|
55
54
|
display: 'grid',
|
|
56
55
|
placeItems: 'center',
|
|
57
|
-
transitionProperty: { default: 'opacity', [
|
|
56
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, scale, filter' },
|
|
58
57
|
transitionDuration: motion.slow,
|
|
59
58
|
transitionTimingFunction: motion.easeOut
|
|
60
59
|
},
|
|
61
60
|
gone: {
|
|
62
61
|
opacity: 0,
|
|
63
|
-
scale: { default: null, [
|
|
64
|
-
filter: { default: null, [
|
|
62
|
+
scale: { default: null, [media.motion]: 0.5 },
|
|
63
|
+
filter: { default: null, [media.motion]: 'blur(2px)' }
|
|
65
64
|
},
|
|
66
65
|
// While the reply has not started, an arc circles the square
|
|
67
66
|
ring: {
|
|
@@ -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 { useComposer } from './context.js';
|
|
9
10
|
|
|
10
11
|
export type ComposerToggleProps = Omit<HTMLButtonAttributes, 'children'> & {
|
|
@@ -16,10 +17,6 @@
|
|
|
16
17
|
children?: Snippet;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
20
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
21
|
-
const FORCED = '@media (forced-colors: active)';
|
|
22
|
-
|
|
23
20
|
const styles = stylex.create({
|
|
24
21
|
toggle: {
|
|
25
22
|
display: 'inline-flex',
|
|
@@ -33,12 +30,12 @@
|
|
|
33
30
|
borderRadius: `calc(${radius.xl} * 4 / 3)`,
|
|
34
31
|
backgroundColor: {
|
|
35
32
|
default: 'transparent',
|
|
36
|
-
':hover': { default: null, [
|
|
33
|
+
':hover': { default: null, [media.hover]: colors.hover }
|
|
37
34
|
},
|
|
38
35
|
boxShadow: `inset 0 0 0 1px ${colors.line}`,
|
|
39
36
|
color: {
|
|
40
37
|
default: colors.textMuted,
|
|
41
|
-
':hover': { default: null, [
|
|
38
|
+
':hover': { default: null, [media.hover]: colors.text }
|
|
42
39
|
},
|
|
43
40
|
fontFamily: 'inherit',
|
|
44
41
|
fontSize: font.sizeSm,
|
|
@@ -48,13 +45,16 @@
|
|
|
48
45
|
cursor: { default: 'pointer', ':disabled': 'not-allowed' },
|
|
49
46
|
opacity: { default: 1, ':disabled': 0.5 },
|
|
50
47
|
WebkitTapHighlightColor: 'transparent',
|
|
51
|
-
scale: { default: null, ':active': { default: null, [
|
|
48
|
+
scale: { default: null, ':active': { default: null, [media.motion]: 0.96 } },
|
|
52
49
|
transitionProperty: {
|
|
53
50
|
default: 'background-color, color, box-shadow',
|
|
54
|
-
[
|
|
51
|
+
[media.motion]: 'scale, background-color, color, box-shadow'
|
|
55
52
|
},
|
|
56
53
|
transitionDuration: motion.base,
|
|
57
|
-
transitionTimingFunction: {
|
|
54
|
+
transitionTimingFunction: {
|
|
55
|
+
default: 'ease',
|
|
56
|
+
[media.motion]: `${motion.easeOut}, ease, ease, ease`
|
|
57
|
+
}
|
|
58
58
|
},
|
|
59
59
|
// The icon leads, so the pill is a touch tighter on that side
|
|
60
60
|
withIcon: { paddingInlineStart: '0.5rem' },
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
on: {
|
|
63
63
|
backgroundColor: {
|
|
64
64
|
default: colors.ithilSoft,
|
|
65
|
-
':hover': { default: null, [
|
|
65
|
+
':hover': { default: null, [media.hover]: colors.focusHalo }
|
|
66
66
|
},
|
|
67
67
|
boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.ithil} 35%, transparent)`,
|
|
68
|
-
color: { default: colors.ithil, ':hover': colors.ithil, [
|
|
68
|
+
color: { default: colors.ithil, ':hover': colors.ithil, [media.forcedColors]: 'Highlight' }
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
</script>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { shared } from '../../internal/shared.js';
|
|
7
7
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
8
8
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
9
|
+
import { media } from '../../media.stylex.js';
|
|
9
10
|
import { useConversation } from './context.js';
|
|
10
11
|
|
|
11
12
|
export type ConversationScrollButtonProps = Omit<HTMLButtonAttributes, 'children'> & {
|
|
@@ -17,9 +18,6 @@
|
|
|
17
18
|
children?: Snippet;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
21
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
22
|
-
|
|
23
21
|
const styles = stylex.create({
|
|
24
22
|
button: {
|
|
25
23
|
position: 'absolute',
|
|
@@ -40,7 +38,7 @@
|
|
|
40
38
|
backgroundColor: colors.bgRaised,
|
|
41
39
|
color: {
|
|
42
40
|
default: colors.textMuted,
|
|
43
|
-
':hover': { default: null, [
|
|
41
|
+
':hover': { default: null, [media.hover]: colors.text }
|
|
44
42
|
},
|
|
45
43
|
boxShadow: `inset 0 0 0 1px ${colors.lineStrong}, inset 0 1px 0 ${colors.highlight}, 0 1px 2px ${colors.shade}, 0 8px 20px -8px ${colors.shade}`,
|
|
46
44
|
fontFamily: font.body,
|
|
@@ -53,10 +51,10 @@
|
|
|
53
51
|
// It rises into place, and drops away a little faster than it came
|
|
54
52
|
opacity: 1,
|
|
55
53
|
translate: '0 0',
|
|
56
|
-
scale: { default: null, ':active': { default: null, [
|
|
54
|
+
scale: { default: null, ':active': { default: null, [media.motion]: 0.96 } },
|
|
57
55
|
transitionProperty: {
|
|
58
56
|
default: 'opacity, color',
|
|
59
|
-
[
|
|
57
|
+
[media.motion]: 'opacity, translate, scale, color'
|
|
60
58
|
},
|
|
61
59
|
transitionDuration: motion.slow,
|
|
62
60
|
transitionTimingFunction: motion.easeOut
|
|
@@ -67,8 +65,8 @@
|
|
|
67
65
|
},
|
|
68
66
|
hidden: {
|
|
69
67
|
opacity: 0,
|
|
70
|
-
translate: { default: null, [
|
|
71
|
-
scale: { default: null, [
|
|
68
|
+
translate: { default: null, [media.motion]: '0 8px' },
|
|
69
|
+
scale: { default: null, [media.motion]: 0.94 },
|
|
72
70
|
pointerEvents: 'none',
|
|
73
71
|
transitionDuration: motion.base
|
|
74
72
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import Glyph from '../../internal/Glyph.svelte';
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
7
|
import Button from '../button/Button.svelte';
|
|
8
|
+
import { sheet } from '../sheet/styles.js';
|
|
8
9
|
import { dialog } from './styles.js';
|
|
9
10
|
|
|
10
11
|
export type DialogContentProps = Omit<Dialog.ContentProps, 'children' | 'child'> & {
|
|
@@ -37,7 +38,10 @@
|
|
|
37
38
|
<Dialog.Content
|
|
38
39
|
data-slot="dialog-content"
|
|
39
40
|
{...rest}
|
|
40
|
-
{...attrs(
|
|
41
|
+
{...attrs(
|
|
42
|
+
[dialog.content, side ? [sheet.sheet, sheet.md, sheet[side]] : dialog[size], sx],
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
41
45
|
>
|
|
42
46
|
{@render children?.()}
|
|
43
47
|
{#if closeLabel}
|
|
@@ -48,29 +48,6 @@ export declare const dialog: Readonly<{
|
|
|
48
48
|
readonly lg: Readonly<{
|
|
49
49
|
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "44rem">;
|
|
50
50
|
}>;
|
|
51
|
-
readonly sheet: Readonly<{
|
|
52
|
-
readonly top: stylex.StyleXClassNameFor<"top", 0>;
|
|
53
|
-
readonly bottom: stylex.StyleXClassNameFor<"bottom", 0>;
|
|
54
|
-
readonly width: stylex.StyleXClassNameFor<"width", "min(26rem, calc(100vw - 2rem))">;
|
|
55
|
-
readonly maxHeight: stylex.StyleXClassNameFor<"maxHeight", "none">;
|
|
56
|
-
readonly marginInline: stylex.StyleXClassNameFor<"marginInline", 0>;
|
|
57
|
-
readonly translate: stylex.StyleXClassNameFor<"translate", "none">;
|
|
58
|
-
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", 0>;
|
|
59
|
-
readonly scale: stylex.StyleXClassNameFor<"scale", null>;
|
|
60
|
-
readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "opacity" | "opacity, translate">;
|
|
61
|
-
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
62
|
-
readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", "cubic-bezier(0.32, 0.72, 0, 1)">;
|
|
63
|
-
}>;
|
|
64
|
-
readonly end: Readonly<{
|
|
65
|
-
readonly insetInlineStart: stylex.StyleXClassNameFor<"insetInlineStart", "auto">;
|
|
66
|
-
readonly insetInlineEnd: stylex.StyleXClassNameFor<"insetInlineEnd", 0>;
|
|
67
|
-
readonly translate: stylex.StyleXClassNameFor<"translate", "0 0" | "100% 0" | null>;
|
|
68
|
-
}>;
|
|
69
|
-
readonly start: Readonly<{
|
|
70
|
-
readonly insetInlineStart: stylex.StyleXClassNameFor<"insetInlineStart", 0>;
|
|
71
|
-
readonly insetInlineEnd: stylex.StyleXClassNameFor<"insetInlineEnd", "auto">;
|
|
72
|
-
readonly translate: stylex.StyleXClassNameFor<"translate", "0 0" | "-100% 0" | null>;
|
|
73
|
-
}>;
|
|
74
51
|
readonly header: Readonly<{
|
|
75
52
|
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
76
53
|
readonly flexDirection: stylex.StyleXClassNameFor<"flexDirection", "column">;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
2
|
import { colors, font, motion, radius, space } from '../../tokens.stylex.js';
|
|
3
|
-
|
|
4
|
-
const FORCED = '@media (forced-colors: active)';
|
|
3
|
+
import { media } from '../../media.stylex.js';
|
|
5
4
|
const CLOSED = ':is([data-state="closed"])';
|
|
6
5
|
export const dialog = stylex.create({
|
|
7
6
|
overlay: {
|
|
@@ -36,56 +35,21 @@ export const dialog = stylex.create({
|
|
|
36
35
|
fontSize: font.sizeMd,
|
|
37
36
|
lineHeight: font.leadingNormal,
|
|
38
37
|
outlineStyle: 'solid',
|
|
39
|
-
outlineWidth: { default: 0, [
|
|
38
|
+
outlineWidth: { default: 0, [media.forcedColors]: '1px' },
|
|
40
39
|
outlineColor: 'CanvasText',
|
|
41
40
|
// A modal is not tied to a trigger, so it grows from its own centre
|
|
42
41
|
opacity: { default: 1, '@starting-style': 0, [CLOSED]: 0 },
|
|
43
|
-
scale: {
|
|
44
|
-
|
|
42
|
+
scale: {
|
|
43
|
+
default: null,
|
|
44
|
+
[media.motion]: { default: 1, '@starting-style': 0.96, [CLOSED]: 0.98 }
|
|
45
|
+
},
|
|
46
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, scale' },
|
|
45
47
|
transitionDuration: { default: motion.base, [CLOSED]: motion.fast },
|
|
46
48
|
transitionTimingFunction: motion.easeOut
|
|
47
49
|
},
|
|
48
50
|
sm: { maxWidth: '24rem' },
|
|
49
51
|
md: { maxWidth: '32rem' },
|
|
50
52
|
lg: { maxWidth: '44rem' },
|
|
51
|
-
// A sheet: the full height of the window, along one edge
|
|
52
|
-
sheet: {
|
|
53
|
-
top: 0,
|
|
54
|
-
bottom: 0,
|
|
55
|
-
width: 'min(26rem, calc(100vw - 2rem))',
|
|
56
|
-
maxHeight: 'none',
|
|
57
|
-
marginInline: 0,
|
|
58
|
-
translate: 'none',
|
|
59
|
-
borderRadius: 0,
|
|
60
|
-
scale: null,
|
|
61
|
-
transitionProperty: { default: 'opacity', [MOTION]: 'opacity, translate' },
|
|
62
|
-
transitionDuration: { default: motion.slow, [CLOSED]: motion.base },
|
|
63
|
-
transitionTimingFunction: 'cubic-bezier(0.32, 0.72, 0, 1)'
|
|
64
|
-
},
|
|
65
|
-
end: {
|
|
66
|
-
insetInlineStart: 'auto',
|
|
67
|
-
insetInlineEnd: 0,
|
|
68
|
-
translate: {
|
|
69
|
-
default: null,
|
|
70
|
-
[MOTION]: {
|
|
71
|
-
default: '0 0',
|
|
72
|
-
'@starting-style': '100% 0',
|
|
73
|
-
[CLOSED]: '100% 0'
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
start: {
|
|
78
|
-
insetInlineStart: 0,
|
|
79
|
-
insetInlineEnd: 'auto',
|
|
80
|
-
translate: {
|
|
81
|
-
default: null,
|
|
82
|
-
[MOTION]: {
|
|
83
|
-
default: '0 0',
|
|
84
|
-
'@starting-style': '-100% 0',
|
|
85
|
-
[CLOSED]: '-100% 0'
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
53
|
header: {
|
|
90
54
|
display: 'flex',
|
|
91
55
|
flexDirection: 'column',
|