typewritingclass 0.2.2 → 0.2.6

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 (139) hide show
  1. package/dist/borders-pzt8w5Wv.d.cts +24 -0
  2. package/dist/borders-pzt8w5Wv.d.ts +24 -0
  3. package/dist/chunk-34VD2OBF.cjs +74 -0
  4. package/dist/chunk-6CEDQ6GF.cjs +36 -0
  5. package/dist/chunk-75ZPJI57.cjs +9 -0
  6. package/dist/chunk-ATLK64TQ.js +85 -0
  7. package/dist/chunk-BAZLFQIV.cjs +85 -0
  8. package/dist/chunk-CB7B6PHY.cjs +19 -0
  9. package/dist/chunk-EBHM46CV.cjs +25 -0
  10. package/dist/chunk-IL3LVS32.js +36 -0
  11. package/dist/chunk-JKT74FUK.js +25 -0
  12. package/dist/chunk-L3IF2OVA.cjs +354 -0
  13. package/{src/theme/animations.ts → dist/chunk-L7AJQJBR.js} +16 -8
  14. package/dist/chunk-LARVCDO3.js +113 -0
  15. package/dist/chunk-M34ZK4IV.cjs +53 -0
  16. package/dist/chunk-MLKGABMK.js +9 -0
  17. package/dist/chunk-PBQX6PVK.js +80 -0
  18. package/dist/chunk-PTY5FTFB.cjs +80 -0
  19. package/dist/chunk-T776FXQK.js +53 -0
  20. package/dist/chunk-TAAEIXRF.js +74 -0
  21. package/dist/chunk-TUUH2FJY.cjs +39 -0
  22. package/dist/chunk-U2LSMKZS.js +60 -0
  23. package/dist/chunk-UUUE7HRN.cjs +60 -0
  24. package/dist/chunk-UUVUSZJS.cjs +113 -0
  25. package/dist/chunk-XEHQXLQR.js +354 -0
  26. package/dist/chunk-YHDPOIUZ.js +39 -0
  27. package/dist/colors-MvgcZKUW.d.cts +72 -0
  28. package/dist/colors-MvgcZKUW.d.ts +72 -0
  29. package/dist/index.cjs +2944 -0
  30. package/dist/index.d.cts +3542 -0
  31. package/dist/index.d.ts +3542 -0
  32. package/dist/index.js +2944 -0
  33. package/{src/theme/inject-theme.ts → dist/inject-theme-CTzyfQH0.d.cts} +4 -20
  34. package/dist/inject-theme-CTzyfQH0.d.ts +65 -0
  35. package/dist/inject.cjs +32 -0
  36. package/dist/inject.d.cts +2 -0
  37. package/dist/inject.d.ts +2 -0
  38. package/dist/inject.js +32 -0
  39. package/dist/rule.cjs +19 -0
  40. package/{src/rule.ts → dist/rule.d.cts} +10 -79
  41. package/dist/rule.d.ts +133 -0
  42. package/dist/rule.js +19 -0
  43. package/dist/runtime.cjs +9 -0
  44. package/{src/runtime.ts → dist/runtime.d.cts} +4 -7
  45. package/dist/runtime.d.ts +33 -0
  46. package/dist/runtime.js +9 -0
  47. package/dist/shadows-CWViP1Zk.d.cts +22 -0
  48. package/dist/shadows-CWViP1Zk.d.ts +22 -0
  49. package/dist/sizes-CS9iz8YG.d.cts +46 -0
  50. package/dist/sizes-CS9iz8YG.d.ts +46 -0
  51. package/dist/theme/animations.cjs +15 -0
  52. package/dist/theme/animations.d.cts +12 -0
  53. package/dist/theme/animations.d.ts +12 -0
  54. package/dist/theme/animations.js +15 -0
  55. package/dist/theme/borders.cjs +23 -0
  56. package/dist/theme/borders.d.cts +1 -0
  57. package/dist/theme/borders.d.ts +1 -0
  58. package/dist/theme/borders.js +23 -0
  59. package/dist/theme/colors.cjs +57 -0
  60. package/dist/theme/colors.d.cts +1 -0
  61. package/dist/theme/colors.d.ts +1 -0
  62. package/dist/theme/colors.js +57 -0
  63. package/dist/theme/createTheme.cjs +7 -0
  64. package/dist/theme/createTheme.d.cts +133 -0
  65. package/dist/theme/createTheme.d.ts +133 -0
  66. package/dist/theme/createTheme.js +7 -0
  67. package/dist/theme/filters.cjs +9 -0
  68. package/dist/theme/filters.d.cts +21 -0
  69. package/dist/theme/filters.d.ts +21 -0
  70. package/dist/theme/filters.js +9 -0
  71. package/dist/theme/index.cjs +35 -0
  72. package/dist/theme/index.d.cts +18 -0
  73. package/dist/theme/index.d.ts +18 -0
  74. package/dist/theme/index.js +35 -0
  75. package/dist/theme/shadows.cjs +21 -0
  76. package/dist/theme/shadows.d.cts +1 -0
  77. package/dist/theme/shadows.d.ts +1 -0
  78. package/dist/theme/shadows.js +21 -0
  79. package/dist/theme/sizes.cjs +21 -0
  80. package/dist/theme/sizes.d.cts +1 -0
  81. package/dist/theme/sizes.d.ts +1 -0
  82. package/dist/theme/sizes.js +21 -0
  83. package/dist/theme/typography.cjs +55 -0
  84. package/dist/theme/typography.d.cts +1 -0
  85. package/dist/theme/typography.d.ts +1 -0
  86. package/dist/theme/typography.js +55 -0
  87. package/dist/types-FfRD4Hbd.d.cts +346 -0
  88. package/dist/types-FfRD4Hbd.d.ts +346 -0
  89. package/dist/typography-C8wipcCK.d.cts +87 -0
  90. package/dist/typography-C8wipcCK.d.ts +87 -0
  91. package/package.json +117 -33
  92. package/src/css.ts +0 -140
  93. package/src/cx.ts +0 -105
  94. package/src/dcx.ts +0 -79
  95. package/src/dynamic.ts +0 -117
  96. package/src/hash.ts +0 -55
  97. package/src/index.ts +0 -139
  98. package/src/inject.ts +0 -86
  99. package/src/layer.ts +0 -81
  100. package/src/modifiers/aria.ts +0 -15
  101. package/src/modifiers/colorScheme.ts +0 -32
  102. package/src/modifiers/data.ts +0 -6
  103. package/src/modifiers/direction.ts +0 -5
  104. package/src/modifiers/group.ts +0 -21
  105. package/src/modifiers/index.ts +0 -17
  106. package/src/modifiers/media.ts +0 -11
  107. package/src/modifiers/peer.ts +0 -24
  108. package/src/modifiers/pseudo.ts +0 -183
  109. package/src/modifiers/pseudoElements.ts +0 -26
  110. package/src/modifiers/responsive.ts +0 -110
  111. package/src/modifiers/supports.ts +0 -6
  112. package/src/registry.ts +0 -171
  113. package/src/theme/borders.ts +0 -9
  114. package/src/theme/colors.ts +0 -326
  115. package/src/theme/createTheme.ts +0 -238
  116. package/src/theme/filters.ts +0 -20
  117. package/src/theme/index.ts +0 -9
  118. package/src/theme/shadows.ts +0 -8
  119. package/src/theme/sizes.ts +0 -37
  120. package/src/theme/spacing.ts +0 -44
  121. package/src/theme/typography.ts +0 -72
  122. package/src/tw.ts +0 -967
  123. package/src/types.ts +0 -273
  124. package/src/utilities/accessibility.ts +0 -33
  125. package/src/utilities/backgrounds.ts +0 -87
  126. package/src/utilities/borders.ts +0 -629
  127. package/src/utilities/colors.ts +0 -151
  128. package/src/utilities/effects.ts +0 -181
  129. package/src/utilities/filters.ts +0 -113
  130. package/src/utilities/index.ts +0 -57
  131. package/src/utilities/interactivity.ts +0 -254
  132. package/src/utilities/layout.ts +0 -1194
  133. package/src/utilities/spacing.ts +0 -681
  134. package/src/utilities/svg.ts +0 -35
  135. package/src/utilities/tables.ts +0 -54
  136. package/src/utilities/transforms.ts +0 -88
  137. package/src/utilities/transitions.ts +0 -107
  138. package/src/utilities/typography.ts +0 -387
  139. package/src/when.ts +0 -63
@@ -1,629 +0,0 @@
1
- import type { StyleRule } from '../types.ts'
2
- import type { DynamicValue } from '../dynamic.ts'
3
- import { createRule, createDynamicRule, wrapWithSelectorTemplate } from '../rule.ts'
4
- import * as borderRadii from '../theme/borders.ts'
5
- import { isDynamic } from '../dynamic.ts'
6
- import { resolveColor } from './colors.ts'
7
-
8
- function px(value: string | number): string {
9
- return typeof value === 'number' ? `${value}px` : value
10
- }
11
-
12
- const radiusMap: Record<string, string> = {
13
- none: borderRadii.none, sm: borderRadii.sm, DEFAULT: borderRadii.DEFAULT,
14
- md: borderRadii.md, lg: borderRadii.lg, xl: borderRadii.xl,
15
- '2xl': borderRadii._2xl, '3xl': borderRadii._3xl, full: borderRadii.full,
16
- }
17
-
18
- function resolveRadius(value?: string | DynamicValue): string {
19
- if (value == null) return borderRadii.DEFAULT
20
- if (typeof value === 'string') return radiusMap[value] ?? value
21
- return value as unknown as string // DynamicValue handled before this
22
- }
23
-
24
- /**
25
- * Sets the `border-radius` on all corners of an element.
26
- *
27
- * When called without arguments, uses the default border radius (`0.25rem`).
28
- * Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
29
- *
30
- * @param value - Optional CSS border-radius string (`'0.5rem'`, `'9999px'`) or `dynamic()` value. Defaults to `'0.25rem'`.
31
- * @returns A {@link StyleRule} that sets `border-radius`.
32
- *
33
- * @example Default radius
34
- * ```ts
35
- * import { cx, rounded } from 'typewritingclass'
36
- *
37
- * cx(rounded())
38
- * // CSS: border-radius: 0.25rem;
39
- * ```
40
- *
41
- * @example Custom radius
42
- * ```ts
43
- * cx(rounded('0.5rem'))
44
- * // CSS: border-radius: 0.5rem;
45
- * ```
46
- *
47
- * @example Full rounding (pill shape)
48
- * ```ts
49
- * cx(rounded('9999px'))
50
- * // CSS: border-radius: 9999px;
51
- * ```
52
- *
53
- * @example Dynamic value
54
- * ```ts
55
- * import { dcx, rounded, dynamic } from 'typewritingclass'
56
- *
57
- * const { className, style } = dcx(rounded(dynamic(radius)))
58
- * // CSS: border-radius: var(--twc-d0);
59
- * // style: { '--twc-d0': radius }
60
- * ```
61
- */
62
- export function rounded(value?: string | DynamicValue): StyleRule {
63
- if (isDynamic(value)) {
64
- return createDynamicRule(
65
- { 'border-radius': `var(${value.__id})` },
66
- { [value.__id]: String(value.__value) },
67
- )
68
- }
69
- return createRule({ 'border-radius': resolveRadius(value) })
70
- }
71
-
72
- /**
73
- * Sets the `border-radius` on the top-left and top-right corners of an element.
74
- *
75
- * When called without arguments, uses the default border radius (`0.25rem`).
76
- * Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
77
- *
78
- * @param value - Optional CSS border-radius string (`'0.5rem'`) or `dynamic()` value. Defaults to `'0.25rem'`.
79
- * @returns A {@link StyleRule} that sets `border-top-left-radius` and `border-top-right-radius`.
80
- *
81
- * @example Default radius
82
- * ```ts
83
- * import { cx, roundedT } from 'typewritingclass'
84
- *
85
- * cx(roundedT())
86
- * // CSS: border-top-left-radius: 0.25rem; border-top-right-radius: 0.25rem;
87
- * ```
88
- *
89
- * @example Custom radius
90
- * ```ts
91
- * cx(roundedT('1rem'))
92
- * // CSS: border-top-left-radius: 1rem; border-top-right-radius: 1rem;
93
- * ```
94
- *
95
- * @example Dynamic value
96
- * ```ts
97
- * import { dcx, roundedT, dynamic } from 'typewritingclass'
98
- *
99
- * const { className, style } = dcx(roundedT(dynamic(radius)))
100
- * // CSS: border-top-left-radius: var(--twc-d0); border-top-right-radius: var(--twc-d0);
101
- * // style: { '--twc-d0': radius }
102
- * ```
103
- */
104
- export function roundedT(value?: string | DynamicValue): StyleRule {
105
- if (isDynamic(value)) {
106
- return createDynamicRule(
107
- { 'border-top-left-radius': `var(${value.__id})`, 'border-top-right-radius': `var(${value.__id})` },
108
- { [value.__id]: String(value.__value) },
109
- )
110
- }
111
- const v = resolveRadius(value)
112
- return createRule({ 'border-top-left-radius': v, 'border-top-right-radius': v })
113
- }
114
-
115
- /**
116
- * Sets the `border-radius` on the bottom-left and bottom-right corners of an element.
117
- *
118
- * When called without arguments, uses the default border radius (`0.25rem`).
119
- * Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
120
- *
121
- * @param value - Optional CSS border-radius string (`'0.5rem'`) or `dynamic()` value. Defaults to `'0.25rem'`.
122
- * @returns A {@link StyleRule} that sets `border-bottom-left-radius` and `border-bottom-right-radius`.
123
- *
124
- * @example Default radius
125
- * ```ts
126
- * import { cx, roundedB } from 'typewritingclass'
127
- *
128
- * cx(roundedB())
129
- * // CSS: border-bottom-left-radius: 0.25rem; border-bottom-right-radius: 0.25rem;
130
- * ```
131
- *
132
- * @example Custom radius
133
- * ```ts
134
- * cx(roundedB('1rem'))
135
- * // CSS: border-bottom-left-radius: 1rem; border-bottom-right-radius: 1rem;
136
- * ```
137
- *
138
- * @example Dynamic value
139
- * ```ts
140
- * import { dcx, roundedB, dynamic } from 'typewritingclass'
141
- *
142
- * const { className, style } = dcx(roundedB(dynamic(radius)))
143
- * // CSS: border-bottom-left-radius: var(--twc-d0); border-bottom-right-radius: var(--twc-d0);
144
- * // style: { '--twc-d0': radius }
145
- * ```
146
- */
147
- export function roundedB(value?: string | DynamicValue): StyleRule {
148
- if (isDynamic(value)) {
149
- return createDynamicRule(
150
- { 'border-bottom-left-radius': `var(${value.__id})`, 'border-bottom-right-radius': `var(${value.__id})` },
151
- { [value.__id]: String(value.__value) },
152
- )
153
- }
154
- const v = resolveRadius(value)
155
- return createRule({ 'border-bottom-left-radius': v, 'border-bottom-right-radius': v })
156
- }
157
-
158
- /**
159
- * Sets the `border-radius` on the top-left and bottom-left corners of an element.
160
- *
161
- * When called without arguments, uses the default border radius (`0.25rem`).
162
- * Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
163
- *
164
- * @param value - Optional CSS border-radius string (`'0.5rem'`) or `dynamic()` value. Defaults to `'0.25rem'`.
165
- * @returns A {@link StyleRule} that sets `border-top-left-radius` and `border-bottom-left-radius`.
166
- *
167
- * @example Default radius
168
- * ```ts
169
- * import { cx, roundedL } from 'typewritingclass'
170
- *
171
- * cx(roundedL())
172
- * // CSS: border-top-left-radius: 0.25rem; border-bottom-left-radius: 0.25rem;
173
- * ```
174
- *
175
- * @example Custom radius
176
- * ```ts
177
- * cx(roundedL('0.75rem'))
178
- * // CSS: border-top-left-radius: 0.75rem; border-bottom-left-radius: 0.75rem;
179
- * ```
180
- *
181
- * @example Dynamic value
182
- * ```ts
183
- * import { dcx, roundedL, dynamic } from 'typewritingclass'
184
- *
185
- * const { className, style } = dcx(roundedL(dynamic(radius)))
186
- * // CSS: border-top-left-radius: var(--twc-d0); border-bottom-left-radius: var(--twc-d0);
187
- * // style: { '--twc-d0': radius }
188
- * ```
189
- */
190
- export function roundedL(value?: string | DynamicValue): StyleRule {
191
- if (isDynamic(value)) {
192
- return createDynamicRule(
193
- { 'border-top-left-radius': `var(${value.__id})`, 'border-bottom-left-radius': `var(${value.__id})` },
194
- { [value.__id]: String(value.__value) },
195
- )
196
- }
197
- const v = resolveRadius(value)
198
- return createRule({ 'border-top-left-radius': v, 'border-bottom-left-radius': v })
199
- }
200
-
201
- /**
202
- * Sets the `border-radius` on the top-right and bottom-right corners of an element.
203
- *
204
- * When called without arguments, uses the default border radius (`0.25rem`).
205
- * Accepts an optional raw CSS string or a {@link DynamicValue} for runtime values.
206
- *
207
- * @param value - Optional CSS border-radius string (`'0.5rem'`) or `dynamic()` value. Defaults to `'0.25rem'`.
208
- * @returns A {@link StyleRule} that sets `border-top-right-radius` and `border-bottom-right-radius`.
209
- *
210
- * @example Default radius
211
- * ```ts
212
- * import { cx, roundedR } from 'typewritingclass'
213
- *
214
- * cx(roundedR())
215
- * // CSS: border-top-right-radius: 0.25rem; border-bottom-right-radius: 0.25rem;
216
- * ```
217
- *
218
- * @example Custom radius
219
- * ```ts
220
- * cx(roundedR('0.75rem'))
221
- * // CSS: border-top-right-radius: 0.75rem; border-bottom-right-radius: 0.75rem;
222
- * ```
223
- *
224
- * @example Dynamic value
225
- * ```ts
226
- * import { dcx, roundedR, dynamic } from 'typewritingclass'
227
- *
228
- * const { className, style } = dcx(roundedR(dynamic(radius)))
229
- * // CSS: border-top-right-radius: var(--twc-d0); border-bottom-right-radius: var(--twc-d0);
230
- * // style: { '--twc-d0': radius }
231
- * ```
232
- */
233
- export function roundedR(value?: string | DynamicValue): StyleRule {
234
- if (isDynamic(value)) {
235
- return createDynamicRule(
236
- { 'border-top-right-radius': `var(${value.__id})`, 'border-bottom-right-radius': `var(${value.__id})` },
237
- { [value.__id]: String(value.__value) },
238
- )
239
- }
240
- const v = resolveRadius(value)
241
- return createRule({ 'border-top-right-radius': v, 'border-bottom-right-radius': v })
242
- }
243
-
244
- /**
245
- * Sets a solid border on all sides of an element.
246
- *
247
- * When called without arguments, defaults to `1px` width. Sets both
248
- * `border-width` and `border-style: solid`.
249
- *
250
- * @param width - Optional CSS border-width string (`'2px'`). Defaults to `'1px'`.
251
- * @returns A {@link StyleRule} that sets `border-width` and `border-style`.
252
- *
253
- * @example Default width
254
- * ```ts
255
- * import { cx, border } from 'typewritingclass'
256
- *
257
- * cx(border())
258
- * // CSS: border-width: 1px; border-style: solid;
259
- * ```
260
- *
261
- * @example Custom width
262
- * ```ts
263
- * cx(border('2px'))
264
- * // CSS: border-width: 2px; border-style: solid;
265
- * ```
266
- */
267
- export function border(width?: string | number): StyleRule {
268
- return createRule({ 'border-width': width != null ? px(width) : '1px', 'border-style': 'solid' })
269
- }
270
-
271
- /**
272
- * Sets a solid border on the top side of an element.
273
- *
274
- * When called without arguments, defaults to `1px` width. Sets both
275
- * `border-top-width` and `border-style: solid`.
276
- *
277
- * @param width - Optional CSS border-width string (`'2px'`). Defaults to `'1px'`.
278
- * @returns A {@link StyleRule} that sets `border-top-width` and `border-style`.
279
- *
280
- * @example Default width
281
- * ```ts
282
- * import { cx, borderT } from 'typewritingclass'
283
- *
284
- * cx(borderT())
285
- * // CSS: border-top-width: 1px; border-style: solid;
286
- * ```
287
- *
288
- * @example Custom width
289
- * ```ts
290
- * cx(borderT('2px'))
291
- * // CSS: border-top-width: 2px; border-style: solid;
292
- * ```
293
- */
294
- export function borderT(width?: string | number): StyleRule {
295
- return createRule({ 'border-top-width': width != null ? px(width) : '1px', 'border-style': 'solid' })
296
- }
297
-
298
- /**
299
- * Sets a solid border on the right side of an element.
300
- *
301
- * When called without arguments, defaults to `1px` width. Sets both
302
- * `border-right-width` and `border-style: solid`.
303
- *
304
- * @param width - Optional CSS border-width string (`'2px'`). Defaults to `'1px'`.
305
- * @returns A {@link StyleRule} that sets `border-right-width` and `border-style`.
306
- *
307
- * @example Default width
308
- * ```ts
309
- * import { cx, borderR } from 'typewritingclass'
310
- *
311
- * cx(borderR())
312
- * // CSS: border-right-width: 1px; border-style: solid;
313
- * ```
314
- *
315
- * @example Custom width
316
- * ```ts
317
- * cx(borderR('3px'))
318
- * // CSS: border-right-width: 3px; border-style: solid;
319
- * ```
320
- */
321
- export function borderR(width?: string | number): StyleRule {
322
- return createRule({ 'border-right-width': width != null ? px(width) : '1px', 'border-style': 'solid' })
323
- }
324
-
325
- /**
326
- * Sets a solid border on the bottom side of an element.
327
- *
328
- * When called without arguments, defaults to `1px` width. Sets both
329
- * `border-bottom-width` and `border-style: solid`.
330
- *
331
- * @param width - Optional CSS border-width string (`'2px'`). Defaults to `'1px'`.
332
- * @returns A {@link StyleRule} that sets `border-bottom-width` and `border-style`.
333
- *
334
- * @example Default width
335
- * ```ts
336
- * import { cx, borderB } from 'typewritingclass'
337
- *
338
- * cx(borderB())
339
- * // CSS: border-bottom-width: 1px; border-style: solid;
340
- * ```
341
- *
342
- * @example Custom width
343
- * ```ts
344
- * cx(borderB('2px'))
345
- * // CSS: border-bottom-width: 2px; border-style: solid;
346
- * ```
347
- */
348
- export function borderB(width?: string | number): StyleRule {
349
- return createRule({ 'border-bottom-width': width != null ? px(width) : '1px', 'border-style': 'solid' })
350
- }
351
-
352
- /**
353
- * Sets a solid border on the left side of an element.
354
- *
355
- * When called without arguments, defaults to `1px` width. Sets both
356
- * `border-left-width` and `border-style: solid`.
357
- *
358
- * @param width - Optional CSS border-width string (`'2px'`). Defaults to `'1px'`.
359
- * @returns A {@link StyleRule} that sets `border-left-width` and `border-style`.
360
- *
361
- * @example Default width
362
- * ```ts
363
- * import { cx, borderL } from 'typewritingclass'
364
- *
365
- * cx(borderL())
366
- * // CSS: border-left-width: 1px; border-style: solid;
367
- * ```
368
- *
369
- * @example Custom width
370
- * ```ts
371
- * cx(borderL('4px'))
372
- * // CSS: border-left-width: 4px; border-style: solid;
373
- * ```
374
- */
375
- export function borderL(width?: string | number): StyleRule {
376
- return createRule({ 'border-left-width': width != null ? px(width) : '1px', 'border-style': 'solid' })
377
- }
378
-
379
- /**
380
- * Creates a focus-ring-style `box-shadow` around an element.
381
- *
382
- * When called without arguments, defaults to `3px` width and `#3b82f6` (blue) color.
383
- * Produces a `box-shadow` with zero offset and zero blur, acting as an outline alternative.
384
- *
385
- * @param width - Optional ring width string (`'2px'`). Defaults to `'3px'`.
386
- * @param color - Optional ring color string (`'#ef4444'`). Defaults to `'#3b82f6'`.
387
- * @returns A {@link StyleRule} that sets `box-shadow`.
388
- *
389
- * @example Default ring
390
- * ```ts
391
- * import { cx, ring } from 'typewritingclass'
392
- *
393
- * cx(ring())
394
- * // CSS: box-shadow: 0 0 0 3px #3b82f6;
395
- * ```
396
- *
397
- * @example Custom width and color
398
- * ```ts
399
- * cx(ring('2px', '#ef4444'))
400
- * // CSS: box-shadow: 0 0 0 2px #ef4444;
401
- * ```
402
- *
403
- * @example Custom width only
404
- * ```ts
405
- * cx(ring('1px'))
406
- * // CSS: box-shadow: 0 0 0 1px #3b82f6;
407
- * ```
408
- */
409
- export function ring(width?: string | number, color?: string): StyleRule {
410
- const w = width != null ? px(width) : '3px'
411
- const c = color ?? '#3b82f6'
412
- return createRule({ 'box-shadow': `0 0 0 ${w} ${c}` })
413
- }
414
-
415
- // --- Individual corner radius utilities ---
416
-
417
- export function roundedTL(value?: string | DynamicValue): StyleRule {
418
- if (isDynamic(value)) {
419
- return createDynamicRule(
420
- { 'border-top-left-radius': `var(${value.__id})` },
421
- { [value.__id]: String(value.__value) },
422
- )
423
- }
424
- return createRule({ 'border-top-left-radius': resolveRadius(value) })
425
- }
426
-
427
- export function roundedTR(value?: string | DynamicValue): StyleRule {
428
- if (isDynamic(value)) {
429
- return createDynamicRule(
430
- { 'border-top-right-radius': `var(${value.__id})` },
431
- { [value.__id]: String(value.__value) },
432
- )
433
- }
434
- return createRule({ 'border-top-right-radius': resolveRadius(value) })
435
- }
436
-
437
- export function roundedBR(value?: string | DynamicValue): StyleRule {
438
- if (isDynamic(value)) {
439
- return createDynamicRule(
440
- { 'border-bottom-right-radius': `var(${value.__id})` },
441
- { [value.__id]: String(value.__value) },
442
- )
443
- }
444
- return createRule({ 'border-bottom-right-radius': resolveRadius(value) })
445
- }
446
-
447
- export function roundedBL(value?: string | DynamicValue): StyleRule {
448
- if (isDynamic(value)) {
449
- return createDynamicRule(
450
- { 'border-bottom-left-radius': `var(${value.__id})` },
451
- { [value.__id]: String(value.__value) },
452
- )
453
- }
454
- return createRule({ 'border-bottom-left-radius': resolveRadius(value) })
455
- }
456
-
457
- export function roundedSS(value?: string | DynamicValue): StyleRule {
458
- if (isDynamic(value)) {
459
- return createDynamicRule(
460
- { 'border-start-start-radius': `var(${value.__id})`, 'border-end-start-radius': `var(${value.__id})` },
461
- { [value.__id]: String(value.__value) },
462
- )
463
- }
464
- const v = resolveRadius(value)
465
- return createRule({ 'border-start-start-radius': v, 'border-end-start-radius': v })
466
- }
467
-
468
- export function roundedSE(value?: string | DynamicValue): StyleRule {
469
- if (isDynamic(value)) {
470
- return createDynamicRule(
471
- { 'border-start-end-radius': `var(${value.__id})`, 'border-end-end-radius': `var(${value.__id})` },
472
- { [value.__id]: String(value.__value) },
473
- )
474
- }
475
- const v = resolveRadius(value)
476
- return createRule({ 'border-start-end-radius': v, 'border-end-end-radius': v })
477
- }
478
-
479
- export function roundedEE(value?: string | DynamicValue): StyleRule {
480
- if (isDynamic(value)) {
481
- return createDynamicRule(
482
- { 'border-start-end-radius': `var(${value.__id})`, 'border-end-end-radius': `var(${value.__id})` },
483
- { [value.__id]: String(value.__value) },
484
- )
485
- }
486
- const v = resolveRadius(value)
487
- return createRule({ 'border-start-end-radius': v, 'border-end-end-radius': v })
488
- }
489
-
490
- export function roundedES(value?: string | DynamicValue): StyleRule {
491
- if (isDynamic(value)) {
492
- return createDynamicRule(
493
- { 'border-end-start-radius': `var(${value.__id})`, 'border-start-start-radius': `var(${value.__id})` },
494
- { [value.__id]: String(value.__value) },
495
- )
496
- }
497
- const v = resolveRadius(value)
498
- return createRule({ 'border-end-start-radius': v, 'border-start-start-radius': v })
499
- }
500
-
501
- // --- Directional border width utilities ---
502
-
503
- export function borderX(width?: string | number): StyleRule {
504
- const w = width != null ? px(width) : '1px'
505
- return createRule({ 'border-left-width': w, 'border-right-width': w, 'border-style': 'solid' })
506
- }
507
-
508
- export function borderY(width?: string | number): StyleRule {
509
- const w = width != null ? px(width) : '1px'
510
- return createRule({ 'border-top-width': w, 'border-bottom-width': w, 'border-style': 'solid' })
511
- }
512
-
513
- export function borderS(width?: string | number): StyleRule {
514
- return createRule({ 'border-inline-start-width': width != null ? px(width) : '1px', 'border-style': 'solid' })
515
- }
516
-
517
- export function borderE(width?: string | number): StyleRule {
518
- return createRule({ 'border-inline-end-width': width != null ? px(width) : '1px', 'border-style': 'solid' })
519
- }
520
-
521
- export function borderStyle(value: string): StyleRule {
522
- return createRule({ 'border-style': value })
523
- }
524
-
525
- // --- Outline utilities ---
526
-
527
- export function outlineWidth(value: string | number): StyleRule {
528
- return createRule({ 'outline-width': px(value) })
529
- }
530
-
531
- export function outlineColor(value: string | DynamicValue): StyleRule {
532
- if (isDynamic(value)) {
533
- return createDynamicRule(
534
- { 'outline-color': `var(${value.__id})` },
535
- { [value.__id]: String(value.__value) },
536
- )
537
- }
538
- return createRule({ 'outline-color': resolveColor(value) })
539
- }
540
-
541
- export function outlineStyle(value: string): StyleRule {
542
- return createRule({ 'outline-style': value })
543
- }
544
-
545
- export function outlineOffset(value: string | number): StyleRule {
546
- return createRule({ 'outline-offset': px(value) })
547
- }
548
-
549
- export function outline(width?: string | number, style?: string, color?: string): StyleRule {
550
- const decls: Record<string, string> = {}
551
- decls['outline-width'] = width != null ? px(width) : '2px'
552
- decls['outline-style'] = style ?? 'solid'
553
- if (color) decls['outline-color'] = color
554
- return createRule(decls)
555
- }
556
-
557
- export function outlineNone(): StyleRule {
558
- return createRule({ outline: '2px solid transparent', 'outline-offset': '2px' })
559
- }
560
-
561
- // --- Ring utilities ---
562
-
563
- export function ringInset(): StyleRule {
564
- return createRule({ '--twc-ring-inset': 'inset' })
565
- }
566
-
567
- export function ringColor(value: string | DynamicValue): StyleRule {
568
- if (isDynamic(value)) {
569
- return createDynamicRule(
570
- { '--twc-ring-color': `var(${value.__id})` },
571
- { [value.__id]: String(value.__value) },
572
- )
573
- }
574
- return createRule({ '--twc-ring-color': resolveColor(value) })
575
- }
576
-
577
- export function ringOffsetWidth(value: string | number): StyleRule {
578
- return createRule({ '--twc-ring-offset-width': px(value) })
579
- }
580
-
581
- export function ringOffsetColor(value: string | DynamicValue): StyleRule {
582
- if (isDynamic(value)) {
583
- return createDynamicRule(
584
- { '--twc-ring-offset-color': `var(${value.__id})` },
585
- { [value.__id]: String(value.__value) },
586
- )
587
- }
588
- return createRule({ '--twc-ring-offset-color': resolveColor(value) })
589
- }
590
-
591
- // --- Divide utilities (selector-template-based) ---
592
-
593
- export function divideX(width?: string | number): StyleRule {
594
- const rule = createRule({ 'border-left-width': width != null ? px(width) : '1px', 'border-style': 'solid' })
595
- return wrapWithSelectorTemplate(rule, '& > :not([hidden]) ~ :not([hidden])')
596
- }
597
-
598
- export function divideY(width?: string | number): StyleRule {
599
- const rule = createRule({ 'border-top-width': width != null ? px(width) : '1px', 'border-style': 'solid' })
600
- return wrapWithSelectorTemplate(rule, '& > :not([hidden]) ~ :not([hidden])')
601
- }
602
-
603
- export function divideColor(value: string | DynamicValue): StyleRule {
604
- let rule: StyleRule
605
- if (isDynamic(value)) {
606
- rule = createDynamicRule(
607
- { 'border-color': `var(${value.__id})` },
608
- { [value.__id]: String(value.__value) },
609
- )
610
- } else {
611
- rule = createRule({ 'border-color': resolveColor(value) })
612
- }
613
- return wrapWithSelectorTemplate(rule, '& > :not([hidden]) ~ :not([hidden])')
614
- }
615
-
616
- export function divideStyle(value: string): StyleRule {
617
- const rule = createRule({ 'border-style': value })
618
- return wrapWithSelectorTemplate(rule, '& > :not([hidden]) ~ :not([hidden])')
619
- }
620
-
621
- export function divideXReverse(): StyleRule {
622
- const rule = createRule({ '--twc-divide-x-reverse': '1' })
623
- return wrapWithSelectorTemplate(rule, '& > :not([hidden]) ~ :not([hidden])')
624
- }
625
-
626
- export function divideYReverse(): StyleRule {
627
- const rule = createRule({ '--twc-divide-y-reverse': '1' })
628
- return wrapWithSelectorTemplate(rule, '& > :not([hidden]) ~ :not([hidden])')
629
- }