@diegopluna/narvi 0.0.1 → 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.
Files changed (112) hide show
  1. package/README.md +27 -8
  2. package/dist/base.css +96 -0
  3. package/dist/color.d.ts +38 -0
  4. package/dist/color.js +88 -0
  5. package/dist/components/activity/ActivityTrigger.svelte +2 -3
  6. package/dist/components/app-shell/AppShellHeader.svelte +2 -3
  7. package/dist/components/app-shell/AppShellSidebar.svelte +6 -6
  8. package/dist/components/approval/Approval.svelte +8 -4
  9. package/dist/components/button/Button.svelte +15 -18
  10. package/dist/components/card/Card.svelte +98 -12
  11. package/dist/components/card/Card.svelte.d.ts +8 -3
  12. package/dist/components/checkbox/Checkbox.svelte +16 -13
  13. package/dist/components/collapsible/CollapsibleContent.svelte +38 -0
  14. package/dist/components/collapsible/CollapsibleContent.svelte.d.ts +11 -0
  15. package/dist/components/collapsible/CollapsibleRoot.svelte +44 -0
  16. package/dist/components/collapsible/CollapsibleRoot.svelte.d.ts +11 -0
  17. package/dist/components/collapsible/CollapsibleTrigger.svelte +83 -0
  18. package/dist/components/collapsible/CollapsibleTrigger.svelte.d.ts +13 -0
  19. package/dist/components/collapsible/context.d.ts +5 -0
  20. package/dist/components/collapsible/context.js +11 -0
  21. package/dist/components/collapsible/index.d.ts +7 -0
  22. package/dist/components/collapsible/index.js +4 -0
  23. package/dist/components/command/styles.js +3 -3
  24. package/dist/components/composer/ComposerAttachment.svelte +4 -6
  25. package/dist/components/composer/ComposerModelPicker.svelte +8 -10
  26. package/dist/components/composer/ComposerRoot.svelte +7 -6
  27. package/dist/components/composer/ComposerSubmit.svelte +4 -5
  28. package/dist/components/composer/ComposerToggle.svelte +11 -11
  29. package/dist/components/conversation/ConversationScrollButton.svelte +6 -8
  30. package/dist/components/dialog/DialogContent.svelte +5 -1
  31. package/dist/components/dialog/styles.d.ts +0 -23
  32. package/dist/components/dialog/styles.js +7 -43
  33. package/dist/components/grid/Grid.svelte +111 -0
  34. package/dist/components/grid/Grid.svelte.d.ts +27 -0
  35. package/dist/components/hover-card/HoverCardContent.svelte +50 -0
  36. package/dist/components/hover-card/HoverCardContent.svelte.d.ts +10 -0
  37. package/dist/components/hover-card/HoverCardRoot.svelte +22 -0
  38. package/dist/components/hover-card/HoverCardRoot.svelte.d.ts +5 -0
  39. package/dist/components/hover-card/index.d.ts +7 -0
  40. package/dist/components/hover-card/index.js +7 -0
  41. package/dist/components/link/Link.svelte +2 -4
  42. package/dist/components/message/MessageAction.svelte +2 -3
  43. package/dist/components/message/MessageActions.svelte +2 -3
  44. package/dist/components/message/MessageCopy.svelte +4 -5
  45. package/dist/components/message/MessageRoot.svelte +3 -4
  46. package/dist/components/message/MessageTime.svelte +2 -3
  47. package/dist/components/plan/Plan.svelte +3 -4
  48. package/dist/components/progress/Progress.svelte +4 -6
  49. package/dist/components/rail/RailItem.svelte +9 -9
  50. package/dist/components/reasoning/ReasoningTrigger.svelte +2 -3
  51. package/dist/components/resize-handle/ResizeHandle.svelte +3 -5
  52. package/dist/components/reveal/Reveal.svelte +89 -0
  53. package/dist/components/reveal/Reveal.svelte.d.ts +17 -0
  54. package/dist/components/reveal/revealed.d.ts +38 -0
  55. package/dist/components/reveal/revealed.js +79 -0
  56. package/dist/components/segmented/SegmentedControl.svelte +5 -9
  57. package/dist/components/sheet/SheetContent.svelte +63 -0
  58. package/dist/components/sheet/SheetContent.svelte.d.ts +18 -0
  59. package/dist/components/sheet/index.d.ts +12 -0
  60. package/dist/components/sheet/index.js +12 -0
  61. package/dist/components/sheet/styles.d.ts +51 -0
  62. package/dist/components/sheet/styles.js +65 -0
  63. package/dist/components/shimmer/Shimmer.svelte +8 -6
  64. package/dist/components/sidebar/SidebarGroup.svelte +5 -3
  65. package/dist/components/sidebar/SidebarItem.svelte +10 -8
  66. package/dist/components/slider/Slider.svelte +199 -0
  67. package/dist/components/slider/Slider.svelte.d.ts +55 -0
  68. package/dist/components/stack/Stack.svelte +37 -44
  69. package/dist/components/stack/Stack.svelte.d.ts +12 -6
  70. package/dist/components/suggestions/SuggestionsItem.svelte +7 -9
  71. package/dist/components/switch/Switch.svelte +8 -12
  72. package/dist/components/tabs/Tabs.svelte +3 -6
  73. package/dist/components/text/Text.svelte +47 -5
  74. package/dist/components/text/Text.svelte.d.ts +8 -2
  75. package/dist/components/toast/Toaster.svelte +7 -5
  76. package/dist/components/toggle/Toggle.svelte +40 -0
  77. package/dist/components/toggle/Toggle.svelte.d.ts +15 -0
  78. package/dist/components/toggle-group/ToggleGroupItem.svelte +37 -0
  79. package/dist/components/toggle-group/ToggleGroupItem.svelte.d.ts +12 -0
  80. package/dist/components/toggle-group/ToggleGroupRoot.svelte +95 -0
  81. package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +33 -0
  82. package/dist/components/toggle-group/context.d.ts +6 -0
  83. package/dist/components/toggle-group/context.js +11 -0
  84. package/dist/components/toggle-group/index.d.ts +5 -0
  85. package/dist/components/toggle-group/index.js +3 -0
  86. package/dist/components/tool/ToolTrigger.svelte +4 -6
  87. package/dist/components/tooltip/TooltipContent.svelte +6 -3
  88. package/dist/components/work-fold/WorkFold.svelte +12 -25
  89. package/dist/components/work-fold/WorkFold.svelte.d.ts +1 -1
  90. package/dist/index.d.ts +25 -3
  91. package/dist/index.js +24 -2
  92. package/dist/internal/Chevron.svelte +2 -3
  93. package/dist/internal/Collapse.svelte +6 -5
  94. package/dist/internal/Collapse.svelte.d.ts +2 -1
  95. package/dist/internal/control.js +4 -4
  96. package/dist/internal/layer.js +6 -8
  97. package/dist/internal/layout.d.ts +13 -0
  98. package/dist/internal/layout.js +453 -0
  99. package/dist/internal/responsive.d.ts +45 -0
  100. package/dist/internal/responsive.js +42 -0
  101. package/dist/internal/sx.d.ts +39 -4
  102. package/dist/internal/sx.js +17 -0
  103. package/dist/internal/toggle.d.ts +74 -0
  104. package/dist/internal/toggle.js +87 -0
  105. package/dist/media.stylex.d.ts +52 -0
  106. package/dist/media.stylex.js +53 -0
  107. package/dist/preset.js +9 -3
  108. package/dist/tokens.stylex.d.ts +15 -0
  109. package/dist/tokens.stylex.js +24 -2
  110. package/dist/vite.d.ts +27 -3
  111. package/dist/vite.js +25 -3
  112. package/package.json +14 -5
@@ -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 {};
@@ -0,0 +1,42 @@
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
+ export const breakpoints = ['sm', 'md', 'lg', 'xl'];
20
+ export function isByBreakpoint(value) {
21
+ return typeof value === 'object' && value !== null;
22
+ }
23
+ /**
24
+ * The styles for one prop. `fallback` stands in for a missing value, and for a missing
25
+ * `default` in values by breakpoint.
26
+ */
27
+ export function responsive(value, fallback, styles) {
28
+ if (!isByBreakpoint(value)) {
29
+ const resolved = value ?? fallback;
30
+ return resolved === undefined ? [] : [styles.fixed[resolved]];
31
+ }
32
+ const result = [styles.chain];
33
+ const base = value.default ?? fallback;
34
+ if (base !== undefined)
35
+ result.push(styles.set.default[base]);
36
+ for (const breakpoint of breakpoints) {
37
+ const at = value[breakpoint];
38
+ if (at !== undefined)
39
+ result.push(styles.set[breakpoint][at]);
40
+ }
41
+ return result;
42
+ }
@@ -1,8 +1,28 @@
1
- import type { StyleXStyles } from '@stylexjs/stylex';
1
+ import type { StyleXArray, StyleXClassNameFor, StyleXStyles } from '@stylexjs/stylex';
2
2
  import type { ClassValue } from 'svelte/elements';
3
- /** Styles a consumer can pass to a component's `sx` prop. */
4
- export type Sx = StyleXStyles;
5
- type StyleArg = StyleXStyles | Readonly<Record<string, unknown>>;
3
+ /**
4
+ * A style that only sets custom properties, such as `{ '--primary': colors.ithil }`.
5
+ * `StyleXStyles` lists the CSS properties it knows, and TypeScript rejects an object
6
+ * that shares none of them, so a style of custom properties alone needs its own type.
7
+ */
8
+ type CustomProperties = Readonly<{
9
+ [name: `--${string}`]: StyleXClassNameFor<string, unknown>;
10
+ }>;
11
+ /**
12
+ * A marker, from `stylex.defaultMarker()` or a `stylex.defineMarker()` of your own. On an
13
+ * element, it makes that element the ancestor that `stylex.when.ancestor(':hover', marker)`
14
+ * in a descendant's styles waits on: a hover group.
15
+ */
16
+ export type Marker = Readonly<{
17
+ marker: StyleXClassNameFor<'marker', unknown>;
18
+ }>;
19
+ /**
20
+ * Styles a consumer can pass to a component's `sx` prop: compiled StyleX styles, styles of
21
+ * custom properties alone, and markers, nested in arrays as deep as you like. `false`, `null`
22
+ * and `undefined` are skipped, so `cond && styles.x` works.
23
+ */
24
+ export type Sx = StyleXArray<StyleXStyles | CustomProperties | Marker>;
25
+ type StyleArg = Sx | Readonly<Record<string, unknown>> | ReadonlyArray<StyleArg>;
6
26
  /**
7
27
  * Resolves StyleX styles to element attributes and appends a consumer `class`.
8
28
  * Later styles win, so pass the consumer's `sx` last.
@@ -11,4 +31,19 @@ export declare function attrs(styles: ReadonlyArray<StyleArg>, className?: Class
11
31
  class?: ClassValue;
12
32
  style?: string;
13
33
  };
34
+ /**
35
+ * Styles as attributes to spread onto an element or a component that takes `class` and
36
+ * `style` but no `sx`: `<Mark {...sx(styles.mark, active && styles.lit)} />`. Like `sx`,
37
+ * it takes markers, and later styles win.
38
+ */
39
+ export declare function sx(...styles: ReadonlyArray<Sx>): {
40
+ class?: string;
41
+ style?: string;
42
+ };
43
+ /**
44
+ * Styles as one class string, for a prop that takes only a class, such as `iconClass`, or
45
+ * for joining with classes of your own. Empty when no style applies. Dynamic styles (those
46
+ * created from a function) also set inline `style`, which this drops; use `sx()` for those.
47
+ */
48
+ export declare function classes(...styles: ReadonlyArray<Sx>): string;
14
49
  export {};
@@ -9,3 +9,20 @@ export function attrs(styles, className) {
9
9
  return resolved;
10
10
  return { ...resolved, class: [resolved.class, className] };
11
11
  }
12
+ /**
13
+ * Styles as attributes to spread onto an element or a component that takes `class` and
14
+ * `style` but no `sx`: `<Mark {...sx(styles.mark, active && styles.lit)} />`. Like `sx`,
15
+ * it takes markers, and later styles win.
16
+ */
17
+ export function sx(...styles) {
18
+ const { class: className, style } = stylex.attrs(...styles);
19
+ return { ...(className ? { class: className } : {}), ...(style ? { style } : {}) };
20
+ }
21
+ /**
22
+ * Styles as one class string, for a prop that takes only a class, such as `iconClass`, or
23
+ * for joining with classes of your own. Empty when no style applies. Dynamic styles (those
24
+ * created from a function) also set inline `style`, which this drops; use `sx()` for those.
25
+ */
26
+ export function classes(...styles) {
27
+ return stylex.attrs(...styles).class ?? '';
28
+ }