@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
|
@@ -6,18 +6,17 @@
|
|
|
6
6
|
<script lang="ts" module>
|
|
7
7
|
import * as stylex from '@stylexjs/stylex';
|
|
8
8
|
import type { Snippet } from 'svelte';
|
|
9
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
9
|
+
import type { ClassValue, HTMLAttributes } from 'svelte/elements';
|
|
10
10
|
import { attrs, type Sx } from './sx.js';
|
|
11
11
|
import { motion } from '../tokens.stylex.js';
|
|
12
|
-
|
|
13
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
12
|
+
import { media } from '../media.stylex.js';
|
|
14
13
|
|
|
15
14
|
const styles = stylex.create({
|
|
16
15
|
region: {
|
|
17
16
|
display: 'grid',
|
|
18
17
|
gridTemplateRows: '0fr',
|
|
19
18
|
opacity: 0,
|
|
20
|
-
transitionProperty: { default: 'opacity', [
|
|
19
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'grid-template-rows, opacity' },
|
|
21
20
|
transitionDuration: motion.slow,
|
|
22
21
|
transitionTimingFunction: motion.easeOut
|
|
23
22
|
},
|
|
@@ -37,6 +36,7 @@
|
|
|
37
36
|
open,
|
|
38
37
|
sx,
|
|
39
38
|
innerSx,
|
|
39
|
+
innerClass,
|
|
40
40
|
class: className,
|
|
41
41
|
children,
|
|
42
42
|
...rest
|
|
@@ -44,13 +44,14 @@
|
|
|
44
44
|
open: boolean;
|
|
45
45
|
sx?: Sx;
|
|
46
46
|
innerSx?: Sx;
|
|
47
|
+
innerClass?: ClassValue | null;
|
|
47
48
|
children?: Snippet;
|
|
48
49
|
} = $props();
|
|
49
50
|
</script>
|
|
50
51
|
|
|
51
52
|
<div inert={!open} {...rest} {...attrs([styles.region, open && styles.open, sx], className)}>
|
|
52
53
|
<div {...stylex.attrs(styles.inner)}>
|
|
53
|
-
<div {...
|
|
54
|
+
<div {...attrs([innerSx], innerClass)}>
|
|
54
55
|
{@render children?.()}
|
|
55
56
|
</div>
|
|
56
57
|
</div>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { ClassValue, HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import { type Sx } from './sx.js';
|
|
4
4
|
type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
5
5
|
open: boolean;
|
|
6
6
|
sx?: Sx;
|
|
7
7
|
innerSx?: Sx;
|
|
8
|
+
innerClass?: ClassValue | null;
|
|
8
9
|
children?: Snippet;
|
|
9
10
|
};
|
|
10
11
|
declare const Collapse: import("svelte").Component<$$ComponentProps, {}, "">;
|
package/dist/internal/control.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
2
|
import { colors, font, motion, radius } from '../tokens.stylex.js';
|
|
3
|
-
|
|
3
|
+
import { media } from '../media.stylex.js';
|
|
4
4
|
/** Shared look for text-entry controls: Input and Textarea. A recess with a 3:1 edge. */
|
|
5
5
|
export const control = stylex.create({
|
|
6
6
|
base: {
|
|
@@ -16,7 +16,7 @@ export const control = stylex.create({
|
|
|
16
16
|
borderStyle: 'solid',
|
|
17
17
|
borderColor: {
|
|
18
18
|
default: colors.edge,
|
|
19
|
-
':hover': { default: null, [
|
|
19
|
+
':hover': { default: null, [media.hover]: colors.edgeHover },
|
|
20
20
|
':focus-visible': colors.focusRing
|
|
21
21
|
},
|
|
22
22
|
borderRadius: radius.md,
|
|
@@ -28,7 +28,7 @@ export const control = stylex.create({
|
|
|
28
28
|
color: colors.text,
|
|
29
29
|
fontFamily: font.body,
|
|
30
30
|
// 16px on touch devices stops iOS from zooming the page on focus
|
|
31
|
-
fontSize: { default: font.sizeMd,
|
|
31
|
+
fontSize: { default: font.sizeMd, [media.coarse]: '1rem' },
|
|
32
32
|
lineHeight: font.leadingSnug,
|
|
33
33
|
appearance: 'none',
|
|
34
34
|
opacity: { default: 1, ':disabled': 0.5 },
|
|
@@ -59,7 +59,7 @@ export const control = stylex.create({
|
|
|
59
59
|
minHeight: '28px',
|
|
60
60
|
paddingInline: '8px',
|
|
61
61
|
borderRadius: radius.sm,
|
|
62
|
-
fontSize: { default: font.sizeSm,
|
|
62
|
+
fontSize: { default: font.sizeSm, [media.coarse]: '1rem' }
|
|
63
63
|
},
|
|
64
64
|
md: {
|
|
65
65
|
minHeight: '34px',
|
package/dist/internal/layer.js
CHANGED
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as stylex from '@stylexjs/stylex';
|
|
9
9
|
import { colors, font, motion, radius } from '../tokens.stylex.js';
|
|
10
|
-
|
|
11
|
-
const FORCED = '@media (forced-colors: active)';
|
|
12
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
10
|
+
import { media } from '../media.stylex.js';
|
|
13
11
|
const CLOSED = ':is([data-state="closed"])';
|
|
14
12
|
const HIGHLIGHTED = ':is([data-highlighted])';
|
|
15
13
|
const DISABLED = ':is([data-disabled])';
|
|
@@ -34,15 +32,15 @@ export const layer = stylex.create({
|
|
|
34
32
|
lineHeight: font.leadingSnug,
|
|
35
33
|
scrollbarWidth: 'thin',
|
|
36
34
|
outlineStyle: 'solid',
|
|
37
|
-
outlineWidth: { default: 0, [
|
|
35
|
+
outlineWidth: { default: 0, [media.forcedColors]: '1px' },
|
|
38
36
|
outlineColor: 'CanvasText',
|
|
39
37
|
transformOrigin: 'var(--bits-floating-transform-origin, top)',
|
|
40
38
|
opacity: { default: 1, '@starting-style': 0, [CLOSED]: 0 },
|
|
41
39
|
scale: {
|
|
42
40
|
default: null,
|
|
43
|
-
[
|
|
41
|
+
[media.motion]: { default: 1, '@starting-style': 0.97, [CLOSED]: 0.97 }
|
|
44
42
|
},
|
|
45
|
-
transitionProperty: { default: 'opacity', [
|
|
43
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, scale' },
|
|
46
44
|
transitionDuration: { default: motion.fast, [CLOSED]: '80ms' },
|
|
47
45
|
transitionTimingFunction: motion.easeOut
|
|
48
46
|
},
|
|
@@ -65,7 +63,7 @@ export const layer = stylex.create({
|
|
|
65
63
|
// row, so it moves at once
|
|
66
64
|
backgroundColor: {
|
|
67
65
|
default: 'transparent',
|
|
68
|
-
[HIGHLIGHTED]: { default: colors.hover, [
|
|
66
|
+
[HIGHLIGHTED]: { default: colors.hover, [media.forcedColors]: 'Highlight' }
|
|
69
67
|
},
|
|
70
68
|
forcedColorAdjust: 'none'
|
|
71
69
|
},
|
|
@@ -123,7 +121,7 @@ export const layer = stylex.create({
|
|
|
123
121
|
hoverable: {
|
|
124
122
|
backgroundColor: {
|
|
125
123
|
default: 'transparent',
|
|
126
|
-
':hover': { default: null, [
|
|
124
|
+
':hover': { default: null, [media.hover]: colors.hover }
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ResponsiveStyles } from './responsive.js';
|
|
2
|
+
export type Gap = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16;
|
|
3
|
+
export declare const gapStyles: ResponsiveStyles<Gap>;
|
|
4
|
+
export type Align = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
5
|
+
export declare const alignStyles: ResponsiveStyles<Align>;
|
|
6
|
+
export type Direction = 'column' | 'row';
|
|
7
|
+
export declare const directionStyles: ResponsiveStyles<Direction>;
|
|
8
|
+
export type Justify = 'start' | 'center' | 'end' | 'between';
|
|
9
|
+
export declare const justifyStyles: ResponsiveStyles<Justify>;
|
|
10
|
+
export type Wrap = 'wrap' | 'nowrap';
|
|
11
|
+
export declare const wrapStyles: ResponsiveStyles<Wrap>;
|
|
12
|
+
export type Columns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
13
|
+
export declare const columnsStyles: ResponsiveStyles<Columns>;
|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import { media } from '../media.stylex.js';
|
|
3
|
+
import { space } from '../tokens.stylex.js';
|
|
4
|
+
const gapFixed = stylex.create({
|
|
5
|
+
0: { gap: 0 },
|
|
6
|
+
1: { gap: space.x1 },
|
|
7
|
+
2: { gap: space.x2 },
|
|
8
|
+
3: { gap: space.x3 },
|
|
9
|
+
4: { gap: space.x4 },
|
|
10
|
+
5: { gap: space.x5 },
|
|
11
|
+
6: { gap: space.x6 },
|
|
12
|
+
8: { gap: space.x8 },
|
|
13
|
+
10: { gap: space.x10 },
|
|
14
|
+
12: { gap: space.x12 },
|
|
15
|
+
16: { gap: space.x16 }
|
|
16
|
+
});
|
|
17
|
+
const gapChain = stylex.create({
|
|
18
|
+
chain: {
|
|
19
|
+
'--narvi-gap': 'initial',
|
|
20
|
+
'--narvi-gap-sm': 'initial',
|
|
21
|
+
'--narvi-gap-md': 'initial',
|
|
22
|
+
'--narvi-gap-lg': 'initial',
|
|
23
|
+
'--narvi-gap-xl': 'initial',
|
|
24
|
+
gap: {
|
|
25
|
+
default: 'var(--narvi-gap)',
|
|
26
|
+
[media.sm]: 'var(--narvi-gap-sm, var(--narvi-gap))',
|
|
27
|
+
[media.md]: 'var(--narvi-gap-md, var(--narvi-gap-sm, var(--narvi-gap)))',
|
|
28
|
+
[media.lg]: 'var(--narvi-gap-lg, var(--narvi-gap-md, var(--narvi-gap-sm, var(--narvi-gap))))',
|
|
29
|
+
[media.xl]: 'var(--narvi-gap-xl, var(--narvi-gap-lg, var(--narvi-gap-md, var(--narvi-gap-sm, var(--narvi-gap)))))'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const gapDefault = stylex.create({
|
|
34
|
+
0: { '--narvi-gap': '0px' },
|
|
35
|
+
1: { '--narvi-gap': space.x1 },
|
|
36
|
+
2: { '--narvi-gap': space.x2 },
|
|
37
|
+
3: { '--narvi-gap': space.x3 },
|
|
38
|
+
4: { '--narvi-gap': space.x4 },
|
|
39
|
+
5: { '--narvi-gap': space.x5 },
|
|
40
|
+
6: { '--narvi-gap': space.x6 },
|
|
41
|
+
8: { '--narvi-gap': space.x8 },
|
|
42
|
+
10: { '--narvi-gap': space.x10 },
|
|
43
|
+
12: { '--narvi-gap': space.x12 },
|
|
44
|
+
16: { '--narvi-gap': space.x16 }
|
|
45
|
+
});
|
|
46
|
+
const gapSm = stylex.create({
|
|
47
|
+
0: { '--narvi-gap-sm': '0px' },
|
|
48
|
+
1: { '--narvi-gap-sm': space.x1 },
|
|
49
|
+
2: { '--narvi-gap-sm': space.x2 },
|
|
50
|
+
3: { '--narvi-gap-sm': space.x3 },
|
|
51
|
+
4: { '--narvi-gap-sm': space.x4 },
|
|
52
|
+
5: { '--narvi-gap-sm': space.x5 },
|
|
53
|
+
6: { '--narvi-gap-sm': space.x6 },
|
|
54
|
+
8: { '--narvi-gap-sm': space.x8 },
|
|
55
|
+
10: { '--narvi-gap-sm': space.x10 },
|
|
56
|
+
12: { '--narvi-gap-sm': space.x12 },
|
|
57
|
+
16: { '--narvi-gap-sm': space.x16 }
|
|
58
|
+
});
|
|
59
|
+
const gapMd = stylex.create({
|
|
60
|
+
0: { '--narvi-gap-md': '0px' },
|
|
61
|
+
1: { '--narvi-gap-md': space.x1 },
|
|
62
|
+
2: { '--narvi-gap-md': space.x2 },
|
|
63
|
+
3: { '--narvi-gap-md': space.x3 },
|
|
64
|
+
4: { '--narvi-gap-md': space.x4 },
|
|
65
|
+
5: { '--narvi-gap-md': space.x5 },
|
|
66
|
+
6: { '--narvi-gap-md': space.x6 },
|
|
67
|
+
8: { '--narvi-gap-md': space.x8 },
|
|
68
|
+
10: { '--narvi-gap-md': space.x10 },
|
|
69
|
+
12: { '--narvi-gap-md': space.x12 },
|
|
70
|
+
16: { '--narvi-gap-md': space.x16 }
|
|
71
|
+
});
|
|
72
|
+
const gapLg = stylex.create({
|
|
73
|
+
0: { '--narvi-gap-lg': '0px' },
|
|
74
|
+
1: { '--narvi-gap-lg': space.x1 },
|
|
75
|
+
2: { '--narvi-gap-lg': space.x2 },
|
|
76
|
+
3: { '--narvi-gap-lg': space.x3 },
|
|
77
|
+
4: { '--narvi-gap-lg': space.x4 },
|
|
78
|
+
5: { '--narvi-gap-lg': space.x5 },
|
|
79
|
+
6: { '--narvi-gap-lg': space.x6 },
|
|
80
|
+
8: { '--narvi-gap-lg': space.x8 },
|
|
81
|
+
10: { '--narvi-gap-lg': space.x10 },
|
|
82
|
+
12: { '--narvi-gap-lg': space.x12 },
|
|
83
|
+
16: { '--narvi-gap-lg': space.x16 }
|
|
84
|
+
});
|
|
85
|
+
const gapXl = stylex.create({
|
|
86
|
+
0: { '--narvi-gap-xl': '0px' },
|
|
87
|
+
1: { '--narvi-gap-xl': space.x1 },
|
|
88
|
+
2: { '--narvi-gap-xl': space.x2 },
|
|
89
|
+
3: { '--narvi-gap-xl': space.x3 },
|
|
90
|
+
4: { '--narvi-gap-xl': space.x4 },
|
|
91
|
+
5: { '--narvi-gap-xl': space.x5 },
|
|
92
|
+
6: { '--narvi-gap-xl': space.x6 },
|
|
93
|
+
8: { '--narvi-gap-xl': space.x8 },
|
|
94
|
+
10: { '--narvi-gap-xl': space.x10 },
|
|
95
|
+
12: { '--narvi-gap-xl': space.x12 },
|
|
96
|
+
16: { '--narvi-gap-xl': space.x16 }
|
|
97
|
+
});
|
|
98
|
+
export const gapStyles = {
|
|
99
|
+
fixed: gapFixed,
|
|
100
|
+
chain: gapChain.chain,
|
|
101
|
+
set: {
|
|
102
|
+
default: gapDefault,
|
|
103
|
+
sm: gapSm,
|
|
104
|
+
md: gapMd,
|
|
105
|
+
lg: gapLg,
|
|
106
|
+
xl: gapXl
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const alignFixed = stylex.create({
|
|
110
|
+
start: { alignItems: 'flex-start' },
|
|
111
|
+
center: { alignItems: 'center' },
|
|
112
|
+
end: { alignItems: 'flex-end' },
|
|
113
|
+
stretch: { alignItems: 'stretch' },
|
|
114
|
+
baseline: { alignItems: 'baseline' }
|
|
115
|
+
});
|
|
116
|
+
const alignChain = stylex.create({
|
|
117
|
+
chain: {
|
|
118
|
+
'--narvi-align': 'initial',
|
|
119
|
+
'--narvi-align-sm': 'initial',
|
|
120
|
+
'--narvi-align-md': 'initial',
|
|
121
|
+
'--narvi-align-lg': 'initial',
|
|
122
|
+
'--narvi-align-xl': 'initial',
|
|
123
|
+
alignItems: {
|
|
124
|
+
default: 'var(--narvi-align)',
|
|
125
|
+
[media.sm]: 'var(--narvi-align-sm, var(--narvi-align))',
|
|
126
|
+
[media.md]: 'var(--narvi-align-md, var(--narvi-align-sm, var(--narvi-align)))',
|
|
127
|
+
[media.lg]: 'var(--narvi-align-lg, var(--narvi-align-md, var(--narvi-align-sm, var(--narvi-align))))',
|
|
128
|
+
[media.xl]: 'var(--narvi-align-xl, var(--narvi-align-lg, var(--narvi-align-md, var(--narvi-align-sm, var(--narvi-align)))))'
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
const alignDefault = stylex.create({
|
|
133
|
+
start: { '--narvi-align': 'flex-start' },
|
|
134
|
+
center: { '--narvi-align': 'center' },
|
|
135
|
+
end: { '--narvi-align': 'flex-end' },
|
|
136
|
+
stretch: { '--narvi-align': 'stretch' },
|
|
137
|
+
baseline: { '--narvi-align': 'baseline' }
|
|
138
|
+
});
|
|
139
|
+
const alignSm = stylex.create({
|
|
140
|
+
start: { '--narvi-align-sm': 'flex-start' },
|
|
141
|
+
center: { '--narvi-align-sm': 'center' },
|
|
142
|
+
end: { '--narvi-align-sm': 'flex-end' },
|
|
143
|
+
stretch: { '--narvi-align-sm': 'stretch' },
|
|
144
|
+
baseline: { '--narvi-align-sm': 'baseline' }
|
|
145
|
+
});
|
|
146
|
+
const alignMd = stylex.create({
|
|
147
|
+
start: { '--narvi-align-md': 'flex-start' },
|
|
148
|
+
center: { '--narvi-align-md': 'center' },
|
|
149
|
+
end: { '--narvi-align-md': 'flex-end' },
|
|
150
|
+
stretch: { '--narvi-align-md': 'stretch' },
|
|
151
|
+
baseline: { '--narvi-align-md': 'baseline' }
|
|
152
|
+
});
|
|
153
|
+
const alignLg = stylex.create({
|
|
154
|
+
start: { '--narvi-align-lg': 'flex-start' },
|
|
155
|
+
center: { '--narvi-align-lg': 'center' },
|
|
156
|
+
end: { '--narvi-align-lg': 'flex-end' },
|
|
157
|
+
stretch: { '--narvi-align-lg': 'stretch' },
|
|
158
|
+
baseline: { '--narvi-align-lg': 'baseline' }
|
|
159
|
+
});
|
|
160
|
+
const alignXl = stylex.create({
|
|
161
|
+
start: { '--narvi-align-xl': 'flex-start' },
|
|
162
|
+
center: { '--narvi-align-xl': 'center' },
|
|
163
|
+
end: { '--narvi-align-xl': 'flex-end' },
|
|
164
|
+
stretch: { '--narvi-align-xl': 'stretch' },
|
|
165
|
+
baseline: { '--narvi-align-xl': 'baseline' }
|
|
166
|
+
});
|
|
167
|
+
export const alignStyles = {
|
|
168
|
+
fixed: alignFixed,
|
|
169
|
+
chain: alignChain.chain,
|
|
170
|
+
set: {
|
|
171
|
+
default: alignDefault,
|
|
172
|
+
sm: alignSm,
|
|
173
|
+
md: alignMd,
|
|
174
|
+
lg: alignLg,
|
|
175
|
+
xl: alignXl
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const directionFixed = stylex.create({
|
|
179
|
+
column: { flexDirection: 'column' },
|
|
180
|
+
row: { flexDirection: 'row' }
|
|
181
|
+
});
|
|
182
|
+
const directionChain = stylex.create({
|
|
183
|
+
chain: {
|
|
184
|
+
'--narvi-direction': 'initial',
|
|
185
|
+
'--narvi-direction-sm': 'initial',
|
|
186
|
+
'--narvi-direction-md': 'initial',
|
|
187
|
+
'--narvi-direction-lg': 'initial',
|
|
188
|
+
'--narvi-direction-xl': 'initial',
|
|
189
|
+
flexDirection: {
|
|
190
|
+
default: 'var(--narvi-direction)',
|
|
191
|
+
[media.sm]: 'var(--narvi-direction-sm, var(--narvi-direction))',
|
|
192
|
+
[media.md]: 'var(--narvi-direction-md, var(--narvi-direction-sm, var(--narvi-direction)))',
|
|
193
|
+
[media.lg]: 'var(--narvi-direction-lg, var(--narvi-direction-md, var(--narvi-direction-sm, var(--narvi-direction))))',
|
|
194
|
+
[media.xl]: 'var(--narvi-direction-xl, var(--narvi-direction-lg, var(--narvi-direction-md, var(--narvi-direction-sm, var(--narvi-direction)))))'
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
const directionDefault = stylex.create({
|
|
199
|
+
column: { '--narvi-direction': 'column' },
|
|
200
|
+
row: { '--narvi-direction': 'row' }
|
|
201
|
+
});
|
|
202
|
+
const directionSm = stylex.create({
|
|
203
|
+
column: { '--narvi-direction-sm': 'column' },
|
|
204
|
+
row: { '--narvi-direction-sm': 'row' }
|
|
205
|
+
});
|
|
206
|
+
const directionMd = stylex.create({
|
|
207
|
+
column: { '--narvi-direction-md': 'column' },
|
|
208
|
+
row: { '--narvi-direction-md': 'row' }
|
|
209
|
+
});
|
|
210
|
+
const directionLg = stylex.create({
|
|
211
|
+
column: { '--narvi-direction-lg': 'column' },
|
|
212
|
+
row: { '--narvi-direction-lg': 'row' }
|
|
213
|
+
});
|
|
214
|
+
const directionXl = stylex.create({
|
|
215
|
+
column: { '--narvi-direction-xl': 'column' },
|
|
216
|
+
row: { '--narvi-direction-xl': 'row' }
|
|
217
|
+
});
|
|
218
|
+
export const directionStyles = {
|
|
219
|
+
fixed: directionFixed,
|
|
220
|
+
chain: directionChain.chain,
|
|
221
|
+
set: {
|
|
222
|
+
default: directionDefault,
|
|
223
|
+
sm: directionSm,
|
|
224
|
+
md: directionMd,
|
|
225
|
+
lg: directionLg,
|
|
226
|
+
xl: directionXl
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
const justifyFixed = stylex.create({
|
|
230
|
+
start: { justifyContent: 'flex-start' },
|
|
231
|
+
center: { justifyContent: 'center' },
|
|
232
|
+
end: { justifyContent: 'flex-end' },
|
|
233
|
+
between: { justifyContent: 'space-between' }
|
|
234
|
+
});
|
|
235
|
+
const justifyChain = stylex.create({
|
|
236
|
+
chain: {
|
|
237
|
+
'--narvi-justify': 'initial',
|
|
238
|
+
'--narvi-justify-sm': 'initial',
|
|
239
|
+
'--narvi-justify-md': 'initial',
|
|
240
|
+
'--narvi-justify-lg': 'initial',
|
|
241
|
+
'--narvi-justify-xl': 'initial',
|
|
242
|
+
justifyContent: {
|
|
243
|
+
default: 'var(--narvi-justify)',
|
|
244
|
+
[media.sm]: 'var(--narvi-justify-sm, var(--narvi-justify))',
|
|
245
|
+
[media.md]: 'var(--narvi-justify-md, var(--narvi-justify-sm, var(--narvi-justify)))',
|
|
246
|
+
[media.lg]: 'var(--narvi-justify-lg, var(--narvi-justify-md, var(--narvi-justify-sm, var(--narvi-justify))))',
|
|
247
|
+
[media.xl]: 'var(--narvi-justify-xl, var(--narvi-justify-lg, var(--narvi-justify-md, var(--narvi-justify-sm, var(--narvi-justify)))))'
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
const justifyDefault = stylex.create({
|
|
252
|
+
start: { '--narvi-justify': 'flex-start' },
|
|
253
|
+
center: { '--narvi-justify': 'center' },
|
|
254
|
+
end: { '--narvi-justify': 'flex-end' },
|
|
255
|
+
between: { '--narvi-justify': 'space-between' }
|
|
256
|
+
});
|
|
257
|
+
const justifySm = stylex.create({
|
|
258
|
+
start: { '--narvi-justify-sm': 'flex-start' },
|
|
259
|
+
center: { '--narvi-justify-sm': 'center' },
|
|
260
|
+
end: { '--narvi-justify-sm': 'flex-end' },
|
|
261
|
+
between: { '--narvi-justify-sm': 'space-between' }
|
|
262
|
+
});
|
|
263
|
+
const justifyMd = stylex.create({
|
|
264
|
+
start: { '--narvi-justify-md': 'flex-start' },
|
|
265
|
+
center: { '--narvi-justify-md': 'center' },
|
|
266
|
+
end: { '--narvi-justify-md': 'flex-end' },
|
|
267
|
+
between: { '--narvi-justify-md': 'space-between' }
|
|
268
|
+
});
|
|
269
|
+
const justifyLg = stylex.create({
|
|
270
|
+
start: { '--narvi-justify-lg': 'flex-start' },
|
|
271
|
+
center: { '--narvi-justify-lg': 'center' },
|
|
272
|
+
end: { '--narvi-justify-lg': 'flex-end' },
|
|
273
|
+
between: { '--narvi-justify-lg': 'space-between' }
|
|
274
|
+
});
|
|
275
|
+
const justifyXl = stylex.create({
|
|
276
|
+
start: { '--narvi-justify-xl': 'flex-start' },
|
|
277
|
+
center: { '--narvi-justify-xl': 'center' },
|
|
278
|
+
end: { '--narvi-justify-xl': 'flex-end' },
|
|
279
|
+
between: { '--narvi-justify-xl': 'space-between' }
|
|
280
|
+
});
|
|
281
|
+
export const justifyStyles = {
|
|
282
|
+
fixed: justifyFixed,
|
|
283
|
+
chain: justifyChain.chain,
|
|
284
|
+
set: {
|
|
285
|
+
default: justifyDefault,
|
|
286
|
+
sm: justifySm,
|
|
287
|
+
md: justifyMd,
|
|
288
|
+
lg: justifyLg,
|
|
289
|
+
xl: justifyXl
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
const wrapFixed = stylex.create({
|
|
293
|
+
wrap: { flexWrap: 'wrap' },
|
|
294
|
+
nowrap: { flexWrap: 'nowrap' }
|
|
295
|
+
});
|
|
296
|
+
const wrapChain = stylex.create({
|
|
297
|
+
chain: {
|
|
298
|
+
'--narvi-wrap': 'initial',
|
|
299
|
+
'--narvi-wrap-sm': 'initial',
|
|
300
|
+
'--narvi-wrap-md': 'initial',
|
|
301
|
+
'--narvi-wrap-lg': 'initial',
|
|
302
|
+
'--narvi-wrap-xl': 'initial',
|
|
303
|
+
flexWrap: {
|
|
304
|
+
default: 'var(--narvi-wrap)',
|
|
305
|
+
[media.sm]: 'var(--narvi-wrap-sm, var(--narvi-wrap))',
|
|
306
|
+
[media.md]: 'var(--narvi-wrap-md, var(--narvi-wrap-sm, var(--narvi-wrap)))',
|
|
307
|
+
[media.lg]: 'var(--narvi-wrap-lg, var(--narvi-wrap-md, var(--narvi-wrap-sm, var(--narvi-wrap))))',
|
|
308
|
+
[media.xl]: 'var(--narvi-wrap-xl, var(--narvi-wrap-lg, var(--narvi-wrap-md, var(--narvi-wrap-sm, var(--narvi-wrap)))))'
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
const wrapDefault = stylex.create({
|
|
313
|
+
wrap: { '--narvi-wrap': 'wrap' },
|
|
314
|
+
nowrap: { '--narvi-wrap': 'nowrap' }
|
|
315
|
+
});
|
|
316
|
+
const wrapSm = stylex.create({
|
|
317
|
+
wrap: { '--narvi-wrap-sm': 'wrap' },
|
|
318
|
+
nowrap: { '--narvi-wrap-sm': 'nowrap' }
|
|
319
|
+
});
|
|
320
|
+
const wrapMd = stylex.create({
|
|
321
|
+
wrap: { '--narvi-wrap-md': 'wrap' },
|
|
322
|
+
nowrap: { '--narvi-wrap-md': 'nowrap' }
|
|
323
|
+
});
|
|
324
|
+
const wrapLg = stylex.create({
|
|
325
|
+
wrap: { '--narvi-wrap-lg': 'wrap' },
|
|
326
|
+
nowrap: { '--narvi-wrap-lg': 'nowrap' }
|
|
327
|
+
});
|
|
328
|
+
const wrapXl = stylex.create({
|
|
329
|
+
wrap: { '--narvi-wrap-xl': 'wrap' },
|
|
330
|
+
nowrap: { '--narvi-wrap-xl': 'nowrap' }
|
|
331
|
+
});
|
|
332
|
+
export const wrapStyles = {
|
|
333
|
+
fixed: wrapFixed,
|
|
334
|
+
chain: wrapChain.chain,
|
|
335
|
+
set: {
|
|
336
|
+
default: wrapDefault,
|
|
337
|
+
sm: wrapSm,
|
|
338
|
+
md: wrapMd,
|
|
339
|
+
lg: wrapLg,
|
|
340
|
+
xl: wrapXl
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
const columnsFixed = stylex.create({
|
|
344
|
+
1: { gridTemplateColumns: 'repeat(1, minmax(0, 1fr))' },
|
|
345
|
+
2: { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' },
|
|
346
|
+
3: { gridTemplateColumns: 'repeat(3, minmax(0, 1fr))' },
|
|
347
|
+
4: { gridTemplateColumns: 'repeat(4, minmax(0, 1fr))' },
|
|
348
|
+
5: { gridTemplateColumns: 'repeat(5, minmax(0, 1fr))' },
|
|
349
|
+
6: { gridTemplateColumns: 'repeat(6, minmax(0, 1fr))' },
|
|
350
|
+
7: { gridTemplateColumns: 'repeat(7, minmax(0, 1fr))' },
|
|
351
|
+
8: { gridTemplateColumns: 'repeat(8, minmax(0, 1fr))' },
|
|
352
|
+
9: { gridTemplateColumns: 'repeat(9, minmax(0, 1fr))' },
|
|
353
|
+
10: { gridTemplateColumns: 'repeat(10, minmax(0, 1fr))' },
|
|
354
|
+
11: { gridTemplateColumns: 'repeat(11, minmax(0, 1fr))' },
|
|
355
|
+
12: { gridTemplateColumns: 'repeat(12, minmax(0, 1fr))' }
|
|
356
|
+
});
|
|
357
|
+
const columnsChain = stylex.create({
|
|
358
|
+
chain: {
|
|
359
|
+
'--narvi-columns': 'initial',
|
|
360
|
+
'--narvi-columns-sm': 'initial',
|
|
361
|
+
'--narvi-columns-md': 'initial',
|
|
362
|
+
'--narvi-columns-lg': 'initial',
|
|
363
|
+
'--narvi-columns-xl': 'initial',
|
|
364
|
+
gridTemplateColumns: {
|
|
365
|
+
default: 'var(--narvi-columns)',
|
|
366
|
+
[media.sm]: 'var(--narvi-columns-sm, var(--narvi-columns))',
|
|
367
|
+
[media.md]: 'var(--narvi-columns-md, var(--narvi-columns-sm, var(--narvi-columns)))',
|
|
368
|
+
[media.lg]: 'var(--narvi-columns-lg, var(--narvi-columns-md, var(--narvi-columns-sm, var(--narvi-columns))))',
|
|
369
|
+
[media.xl]: 'var(--narvi-columns-xl, var(--narvi-columns-lg, var(--narvi-columns-md, var(--narvi-columns-sm, var(--narvi-columns)))))'
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
const columnsDefault = stylex.create({
|
|
374
|
+
1: { '--narvi-columns': 'repeat(1, minmax(0, 1fr))' },
|
|
375
|
+
2: { '--narvi-columns': 'repeat(2, minmax(0, 1fr))' },
|
|
376
|
+
3: { '--narvi-columns': 'repeat(3, minmax(0, 1fr))' },
|
|
377
|
+
4: { '--narvi-columns': 'repeat(4, minmax(0, 1fr))' },
|
|
378
|
+
5: { '--narvi-columns': 'repeat(5, minmax(0, 1fr))' },
|
|
379
|
+
6: { '--narvi-columns': 'repeat(6, minmax(0, 1fr))' },
|
|
380
|
+
7: { '--narvi-columns': 'repeat(7, minmax(0, 1fr))' },
|
|
381
|
+
8: { '--narvi-columns': 'repeat(8, minmax(0, 1fr))' },
|
|
382
|
+
9: { '--narvi-columns': 'repeat(9, minmax(0, 1fr))' },
|
|
383
|
+
10: { '--narvi-columns': 'repeat(10, minmax(0, 1fr))' },
|
|
384
|
+
11: { '--narvi-columns': 'repeat(11, minmax(0, 1fr))' },
|
|
385
|
+
12: { '--narvi-columns': 'repeat(12, minmax(0, 1fr))' }
|
|
386
|
+
});
|
|
387
|
+
const columnsSm = stylex.create({
|
|
388
|
+
1: { '--narvi-columns-sm': 'repeat(1, minmax(0, 1fr))' },
|
|
389
|
+
2: { '--narvi-columns-sm': 'repeat(2, minmax(0, 1fr))' },
|
|
390
|
+
3: { '--narvi-columns-sm': 'repeat(3, minmax(0, 1fr))' },
|
|
391
|
+
4: { '--narvi-columns-sm': 'repeat(4, minmax(0, 1fr))' },
|
|
392
|
+
5: { '--narvi-columns-sm': 'repeat(5, minmax(0, 1fr))' },
|
|
393
|
+
6: { '--narvi-columns-sm': 'repeat(6, minmax(0, 1fr))' },
|
|
394
|
+
7: { '--narvi-columns-sm': 'repeat(7, minmax(0, 1fr))' },
|
|
395
|
+
8: { '--narvi-columns-sm': 'repeat(8, minmax(0, 1fr))' },
|
|
396
|
+
9: { '--narvi-columns-sm': 'repeat(9, minmax(0, 1fr))' },
|
|
397
|
+
10: { '--narvi-columns-sm': 'repeat(10, minmax(0, 1fr))' },
|
|
398
|
+
11: { '--narvi-columns-sm': 'repeat(11, minmax(0, 1fr))' },
|
|
399
|
+
12: { '--narvi-columns-sm': 'repeat(12, minmax(0, 1fr))' }
|
|
400
|
+
});
|
|
401
|
+
const columnsMd = stylex.create({
|
|
402
|
+
1: { '--narvi-columns-md': 'repeat(1, minmax(0, 1fr))' },
|
|
403
|
+
2: { '--narvi-columns-md': 'repeat(2, minmax(0, 1fr))' },
|
|
404
|
+
3: { '--narvi-columns-md': 'repeat(3, minmax(0, 1fr))' },
|
|
405
|
+
4: { '--narvi-columns-md': 'repeat(4, minmax(0, 1fr))' },
|
|
406
|
+
5: { '--narvi-columns-md': 'repeat(5, minmax(0, 1fr))' },
|
|
407
|
+
6: { '--narvi-columns-md': 'repeat(6, minmax(0, 1fr))' },
|
|
408
|
+
7: { '--narvi-columns-md': 'repeat(7, minmax(0, 1fr))' },
|
|
409
|
+
8: { '--narvi-columns-md': 'repeat(8, minmax(0, 1fr))' },
|
|
410
|
+
9: { '--narvi-columns-md': 'repeat(9, minmax(0, 1fr))' },
|
|
411
|
+
10: { '--narvi-columns-md': 'repeat(10, minmax(0, 1fr))' },
|
|
412
|
+
11: { '--narvi-columns-md': 'repeat(11, minmax(0, 1fr))' },
|
|
413
|
+
12: { '--narvi-columns-md': 'repeat(12, minmax(0, 1fr))' }
|
|
414
|
+
});
|
|
415
|
+
const columnsLg = stylex.create({
|
|
416
|
+
1: { '--narvi-columns-lg': 'repeat(1, minmax(0, 1fr))' },
|
|
417
|
+
2: { '--narvi-columns-lg': 'repeat(2, minmax(0, 1fr))' },
|
|
418
|
+
3: { '--narvi-columns-lg': 'repeat(3, minmax(0, 1fr))' },
|
|
419
|
+
4: { '--narvi-columns-lg': 'repeat(4, minmax(0, 1fr))' },
|
|
420
|
+
5: { '--narvi-columns-lg': 'repeat(5, minmax(0, 1fr))' },
|
|
421
|
+
6: { '--narvi-columns-lg': 'repeat(6, minmax(0, 1fr))' },
|
|
422
|
+
7: { '--narvi-columns-lg': 'repeat(7, minmax(0, 1fr))' },
|
|
423
|
+
8: { '--narvi-columns-lg': 'repeat(8, minmax(0, 1fr))' },
|
|
424
|
+
9: { '--narvi-columns-lg': 'repeat(9, minmax(0, 1fr))' },
|
|
425
|
+
10: { '--narvi-columns-lg': 'repeat(10, minmax(0, 1fr))' },
|
|
426
|
+
11: { '--narvi-columns-lg': 'repeat(11, minmax(0, 1fr))' },
|
|
427
|
+
12: { '--narvi-columns-lg': 'repeat(12, minmax(0, 1fr))' }
|
|
428
|
+
});
|
|
429
|
+
const columnsXl = stylex.create({
|
|
430
|
+
1: { '--narvi-columns-xl': 'repeat(1, minmax(0, 1fr))' },
|
|
431
|
+
2: { '--narvi-columns-xl': 'repeat(2, minmax(0, 1fr))' },
|
|
432
|
+
3: { '--narvi-columns-xl': 'repeat(3, minmax(0, 1fr))' },
|
|
433
|
+
4: { '--narvi-columns-xl': 'repeat(4, minmax(0, 1fr))' },
|
|
434
|
+
5: { '--narvi-columns-xl': 'repeat(5, minmax(0, 1fr))' },
|
|
435
|
+
6: { '--narvi-columns-xl': 'repeat(6, minmax(0, 1fr))' },
|
|
436
|
+
7: { '--narvi-columns-xl': 'repeat(7, minmax(0, 1fr))' },
|
|
437
|
+
8: { '--narvi-columns-xl': 'repeat(8, minmax(0, 1fr))' },
|
|
438
|
+
9: { '--narvi-columns-xl': 'repeat(9, minmax(0, 1fr))' },
|
|
439
|
+
10: { '--narvi-columns-xl': 'repeat(10, minmax(0, 1fr))' },
|
|
440
|
+
11: { '--narvi-columns-xl': 'repeat(11, minmax(0, 1fr))' },
|
|
441
|
+
12: { '--narvi-columns-xl': 'repeat(12, minmax(0, 1fr))' }
|
|
442
|
+
});
|
|
443
|
+
export const columnsStyles = {
|
|
444
|
+
fixed: columnsFixed,
|
|
445
|
+
chain: columnsChain.chain,
|
|
446
|
+
set: {
|
|
447
|
+
default: columnsDefault,
|
|
448
|
+
sm: columnsSm,
|
|
449
|
+
md: columnsMd,
|
|
450
|
+
lg: columnsLg,
|
|
451
|
+
xl: columnsXl
|
|
452
|
+
}
|
|
453
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout props that take a value, or one value per breakpoint:
|
|
3
|
+
* `gap={4}` or `gap={{ default: 4, lg: 8 }}`.
|
|
4
|
+
*
|
|
5
|
+
* StyleX merges styles one property at a time, so a style for `lg` cannot sit on top of
|
|
6
|
+
* the default: it would replace it. A responsive prop therefore applies one static rule
|
|
7
|
+
* that reads custom properties, one per breakpoint, each falling back to the one below:
|
|
8
|
+
*
|
|
9
|
+
* ```css
|
|
10
|
+
* gap: var(--narvi-gap);
|
|
11
|
+
* @media (min-width: 640px) { gap: var(--narvi-gap-sm, var(--narvi-gap)) }
|
|
12
|
+
* …
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* and one static class per value and breakpoint, which sets one of those properties. The
|
|
16
|
+
* same rule resets every one of them to `initial`, so a layout never inherits its parent's.
|
|
17
|
+
* No styles are made at runtime. A plain value takes a plain class, as before.
|
|
18
|
+
*/
|
|
19
|
+
/** The breakpoints of `media`: `sm` 640px, `md` 768px, `lg` 1024px, `xl` 1280px. */
|
|
20
|
+
export type Breakpoint = 'sm' | 'md' | 'lg' | 'xl';
|
|
21
|
+
export declare const breakpoints: ReadonlyArray<Breakpoint>;
|
|
22
|
+
/** A value, or values by breakpoint. Each applies from its breakpoint up, until a larger one. */
|
|
23
|
+
export type Responsive<T> = T | Readonly<{
|
|
24
|
+
default?: T;
|
|
25
|
+
} & {
|
|
26
|
+
[B in Breakpoint]?: T;
|
|
27
|
+
}>;
|
|
28
|
+
/** A compiled style, as `stylex.create` returns it. */
|
|
29
|
+
type Style = Readonly<Record<string, unknown>>;
|
|
30
|
+
/** The styles a responsive prop is built from. */
|
|
31
|
+
export type ResponsiveStyles<T extends PropertyKey> = {
|
|
32
|
+
/** For a plain value. */
|
|
33
|
+
fixed: Readonly<Record<T, Style>>;
|
|
34
|
+
/** The rule that reads the custom properties and resets them. */
|
|
35
|
+
chain: Style;
|
|
36
|
+
/** Sets the custom property for each breakpoint, `default` included. */
|
|
37
|
+
set: Readonly<Record<'default' | Breakpoint, Readonly<Record<T, Style>>>>;
|
|
38
|
+
};
|
|
39
|
+
export declare function isByBreakpoint<T>(value: Responsive<T> | undefined): value is Exclude<Responsive<T>, T>;
|
|
40
|
+
/**
|
|
41
|
+
* The styles for one prop. `fallback` stands in for a missing value, and for a missing
|
|
42
|
+
* `default` in values by breakpoint.
|
|
43
|
+
*/
|
|
44
|
+
export declare function responsive<T extends PropertyKey>(value: Responsive<T> | undefined, fallback: T | undefined, styles: ResponsiveStyles<T>): Style[];
|
|
45
|
+
export {};
|