@bamboocss/preset-base 1.31.0 → 1.33.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/dist/index.cjs +38 -209
- package/dist/index.d.cts +5 -187
- package/dist/index.d.mts +5 -187
- package/dist/index.mjs +38 -209
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -117,6 +117,18 @@ const conditions = {
|
|
|
117
117
|
function definePattern(config) {
|
|
118
118
|
return config;
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* The one flexbox pattern. `stack`, `vstack`, `hstack` and `wrap` were this with defaults frozen
|
|
122
|
+
* — `stack` added `direction: 'column'` and an 8px gap, the two axis-named ones additionally
|
|
123
|
+
* hard-coded `align: 'center'` and dropped `direction` from the props, and `wrap` set
|
|
124
|
+
* `flexWrap: 'wrap'`. Five names, one transform, and four of them a superset of the fifth only in
|
|
125
|
+
* what they assumed for you.
|
|
126
|
+
*
|
|
127
|
+
* `gap` is deliberately not listed here and does not need to be: anything absent from
|
|
128
|
+
* `properties` still arrives as an ordinary style prop, so `flex({ gap: '6' })` types and folds
|
|
129
|
+
* exactly as it did through `stack`. What goes with the old names is the implicit `gap: '8px'`,
|
|
130
|
+
* which was a design opinion no call site asked for.
|
|
131
|
+
*/
|
|
120
132
|
const flex = definePattern({
|
|
121
133
|
properties: {
|
|
122
134
|
align: {
|
|
@@ -163,89 +175,6 @@ const flex = definePattern({
|
|
|
163
175
|
};
|
|
164
176
|
}
|
|
165
177
|
});
|
|
166
|
-
const stack = definePattern({
|
|
167
|
-
properties: {
|
|
168
|
-
align: {
|
|
169
|
-
type: "property",
|
|
170
|
-
value: "alignItems"
|
|
171
|
-
},
|
|
172
|
-
justify: {
|
|
173
|
-
type: "property",
|
|
174
|
-
value: "justifyContent"
|
|
175
|
-
},
|
|
176
|
-
direction: {
|
|
177
|
-
type: "property",
|
|
178
|
-
value: "flexDirection"
|
|
179
|
-
},
|
|
180
|
-
gap: {
|
|
181
|
-
type: "property",
|
|
182
|
-
value: "gap"
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
defaultValues: {
|
|
186
|
-
direction: "column",
|
|
187
|
-
gap: "8px"
|
|
188
|
-
},
|
|
189
|
-
transform(props) {
|
|
190
|
-
const { align, justify, direction, gap, ...rest } = props;
|
|
191
|
-
return {
|
|
192
|
-
display: "flex",
|
|
193
|
-
flexDirection: direction,
|
|
194
|
-
alignItems: align,
|
|
195
|
-
justifyContent: justify,
|
|
196
|
-
gap,
|
|
197
|
-
...rest
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
const vstack = definePattern({
|
|
202
|
-
properties: {
|
|
203
|
-
justify: {
|
|
204
|
-
type: "property",
|
|
205
|
-
value: "justifyContent"
|
|
206
|
-
},
|
|
207
|
-
gap: {
|
|
208
|
-
type: "property",
|
|
209
|
-
value: "gap"
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
defaultValues: { gap: "8px" },
|
|
213
|
-
transform(props) {
|
|
214
|
-
const { justify, gap, ...rest } = props;
|
|
215
|
-
return {
|
|
216
|
-
display: "flex",
|
|
217
|
-
alignItems: "center",
|
|
218
|
-
justifyContent: justify,
|
|
219
|
-
gap,
|
|
220
|
-
flexDirection: "column",
|
|
221
|
-
...rest
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
const hstack = definePattern({
|
|
226
|
-
properties: {
|
|
227
|
-
justify: {
|
|
228
|
-
type: "property",
|
|
229
|
-
value: "justifyContent"
|
|
230
|
-
},
|
|
231
|
-
gap: {
|
|
232
|
-
type: "property",
|
|
233
|
-
value: "gap"
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
defaultValues: { gap: "8px" },
|
|
237
|
-
transform(props) {
|
|
238
|
-
const { justify, gap, ...rest } = props;
|
|
239
|
-
return {
|
|
240
|
-
display: "flex",
|
|
241
|
-
alignItems: "center",
|
|
242
|
-
justifyContent: justify,
|
|
243
|
-
gap,
|
|
244
|
-
flexDirection: "row",
|
|
245
|
-
...rest
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
178
|
const spacer = definePattern({
|
|
250
179
|
properties: { size: {
|
|
251
180
|
type: "token",
|
|
@@ -264,43 +193,6 @@ const spacer = definePattern({
|
|
|
264
193
|
};
|
|
265
194
|
}
|
|
266
195
|
});
|
|
267
|
-
const circle = definePattern({
|
|
268
|
-
properties: { size: {
|
|
269
|
-
type: "property",
|
|
270
|
-
value: "width"
|
|
271
|
-
} },
|
|
272
|
-
transform(props) {
|
|
273
|
-
const { size, ...rest } = props;
|
|
274
|
-
return {
|
|
275
|
-
display: "flex",
|
|
276
|
-
alignItems: "center",
|
|
277
|
-
justifyContent: "center",
|
|
278
|
-
flex: "0 0 auto",
|
|
279
|
-
width: size,
|
|
280
|
-
height: size,
|
|
281
|
-
borderRadius: "9999px",
|
|
282
|
-
...rest
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
const square = definePattern({
|
|
287
|
-
properties: { size: {
|
|
288
|
-
type: "property",
|
|
289
|
-
value: "width"
|
|
290
|
-
} },
|
|
291
|
-
transform(props) {
|
|
292
|
-
const { size, ...rest } = props;
|
|
293
|
-
return {
|
|
294
|
-
display: "flex",
|
|
295
|
-
alignItems: "center",
|
|
296
|
-
justifyContent: "center",
|
|
297
|
-
flex: "0 0 auto",
|
|
298
|
-
width: size,
|
|
299
|
-
height: size,
|
|
300
|
-
...rest
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
196
|
const grid = definePattern({
|
|
305
197
|
properties: {
|
|
306
198
|
gap: {
|
|
@@ -361,43 +253,6 @@ const gridItem = definePattern({
|
|
|
361
253
|
};
|
|
362
254
|
}
|
|
363
255
|
});
|
|
364
|
-
const wrap = definePattern({
|
|
365
|
-
properties: {
|
|
366
|
-
gap: {
|
|
367
|
-
type: "property",
|
|
368
|
-
value: "gap"
|
|
369
|
-
},
|
|
370
|
-
rowGap: {
|
|
371
|
-
type: "property",
|
|
372
|
-
value: "gap"
|
|
373
|
-
},
|
|
374
|
-
columnGap: {
|
|
375
|
-
type: "property",
|
|
376
|
-
value: "gap"
|
|
377
|
-
},
|
|
378
|
-
align: {
|
|
379
|
-
type: "property",
|
|
380
|
-
value: "alignItems"
|
|
381
|
-
},
|
|
382
|
-
justify: {
|
|
383
|
-
type: "property",
|
|
384
|
-
value: "justifyContent"
|
|
385
|
-
}
|
|
386
|
-
},
|
|
387
|
-
transform(props) {
|
|
388
|
-
const { columnGap, rowGap, gap = columnGap || rowGap ? void 0 : "8px", align, justify, ...rest } = props;
|
|
389
|
-
return {
|
|
390
|
-
display: "flex",
|
|
391
|
-
flexWrap: "wrap",
|
|
392
|
-
alignItems: align,
|
|
393
|
-
justifyContent: justify,
|
|
394
|
-
gap,
|
|
395
|
-
columnGap,
|
|
396
|
-
rowGap,
|
|
397
|
-
...rest
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
256
|
const container$1 = definePattern({ transform(props) {
|
|
402
257
|
return {
|
|
403
258
|
position: "relative",
|
|
@@ -411,14 +266,34 @@ const container$1 = definePattern({ transform(props) {
|
|
|
411
266
|
...props
|
|
412
267
|
};
|
|
413
268
|
} });
|
|
269
|
+
/**
|
|
270
|
+
* Absorbs what `square` and `circle` used to be. `square({ size })` is `center({ size })`, and
|
|
271
|
+
* `circle({ size })` is `center({ size, borderRadius: 'full' })` — `borderRadius` is an ordinary
|
|
272
|
+
* style prop, so the rounded case needs nothing here beyond the size the square case already
|
|
273
|
+
* wanted. Three patterns whose transforms differed by one declaration is three names to learn
|
|
274
|
+
* and three places for `alignItems: center` to drift.
|
|
275
|
+
*
|
|
276
|
+
* `flex: '0 0 auto'` rides with `size` rather than being unconditional: it is what stops a sized
|
|
277
|
+
* box from being shrunk by a flex parent, so it is meaningless without one, and applying it to
|
|
278
|
+
* an unsized `center` would change how every existing call lays out inside a flex row.
|
|
279
|
+
*/
|
|
414
280
|
const center = definePattern({
|
|
415
|
-
properties: {
|
|
281
|
+
properties: {
|
|
282
|
+
inline: { type: "boolean" },
|
|
283
|
+
size: {
|
|
284
|
+
type: "property",
|
|
285
|
+
value: "width"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
416
288
|
transform(props) {
|
|
417
|
-
const { inline, ...rest } = props;
|
|
289
|
+
const { inline, size, ...rest } = props;
|
|
418
290
|
return {
|
|
419
291
|
display: inline ? "inline-flex" : "flex",
|
|
420
292
|
alignItems: "center",
|
|
421
293
|
justifyContent: "center",
|
|
294
|
+
flex: size == null ? void 0 : "0 0 auto",
|
|
295
|
+
width: size,
|
|
296
|
+
height: size,
|
|
422
297
|
...rest
|
|
423
298
|
};
|
|
424
299
|
}
|
|
@@ -487,12 +362,7 @@ const divider = definePattern({
|
|
|
487
362
|
});
|
|
488
363
|
const patterns = {
|
|
489
364
|
flex,
|
|
490
|
-
stack,
|
|
491
|
-
vstack,
|
|
492
|
-
hstack,
|
|
493
365
|
spacer,
|
|
494
|
-
square,
|
|
495
|
-
circle,
|
|
496
366
|
center,
|
|
497
367
|
linkOverlay: definePattern({ transform(props) {
|
|
498
368
|
return {
|
|
@@ -509,7 +379,6 @@ const patterns = {
|
|
|
509
379
|
aspectRatio,
|
|
510
380
|
grid,
|
|
511
381
|
gridItem,
|
|
512
|
-
wrap,
|
|
513
382
|
container: container$1,
|
|
514
383
|
divider,
|
|
515
384
|
float: definePattern({
|
|
@@ -634,28 +503,6 @@ const patterns = {
|
|
|
634
503
|
...rest
|
|
635
504
|
};
|
|
636
505
|
}
|
|
637
|
-
}),
|
|
638
|
-
cq: definePattern({
|
|
639
|
-
properties: {
|
|
640
|
-
name: {
|
|
641
|
-
type: "token",
|
|
642
|
-
value: "containerNames",
|
|
643
|
-
property: "containerName"
|
|
644
|
-
},
|
|
645
|
-
type: {
|
|
646
|
-
type: "property",
|
|
647
|
-
value: "containerType"
|
|
648
|
-
}
|
|
649
|
-
},
|
|
650
|
-
defaultValues: { type: "inline-size" },
|
|
651
|
-
transform(props) {
|
|
652
|
-
const { name, type, ...rest } = props;
|
|
653
|
-
return {
|
|
654
|
-
containerType: type,
|
|
655
|
-
containerName: name,
|
|
656
|
-
...rest
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
506
|
})
|
|
660
507
|
};
|
|
661
508
|
//#endregion
|
|
@@ -1095,28 +942,10 @@ const cursor = { cursor: {
|
|
|
1095
942
|
} };
|
|
1096
943
|
//#endregion
|
|
1097
944
|
//#region src/utilities/display.ts
|
|
1098
|
-
const display = {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
},
|
|
1103
|
-
hideFrom: {
|
|
1104
|
-
className: "hide",
|
|
1105
|
-
values: "breakpoints",
|
|
1106
|
-
group: "Display",
|
|
1107
|
-
transform(value, { raw, token }) {
|
|
1108
|
-
return { [token.raw(`breakpoints.${raw}`) ? `@breakpoint ${raw}` : `@media (width >= ${value})`]: { display: "none" } };
|
|
1109
|
-
}
|
|
1110
|
-
},
|
|
1111
|
-
hideBelow: {
|
|
1112
|
-
className: "show",
|
|
1113
|
-
values: "breakpoints",
|
|
1114
|
-
group: "Display",
|
|
1115
|
-
transform(value, { raw, token }) {
|
|
1116
|
-
return { [token.raw(`breakpoints.${raw}`) ? `@breakpoint ${raw}Down` : `@media (width < ${value})`]: { display: "none" } };
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
};
|
|
945
|
+
const display = { display: {
|
|
946
|
+
className: "d",
|
|
947
|
+
group: "Display"
|
|
948
|
+
} };
|
|
1120
949
|
//#endregion
|
|
1121
950
|
//#region src/utilities/divide.ts
|
|
1122
951
|
const divideColor = createColorMixTransform("borderColor");
|
package/dist/index.d.cts
CHANGED
|
@@ -158,93 +158,6 @@ declare const preset: {
|
|
|
158
158
|
flexShrink: any;
|
|
159
159
|
};
|
|
160
160
|
};
|
|
161
|
-
stack: {
|
|
162
|
-
properties: {
|
|
163
|
-
align: {
|
|
164
|
-
type: "property";
|
|
165
|
-
value: "alignItems";
|
|
166
|
-
};
|
|
167
|
-
justify: {
|
|
168
|
-
type: "property";
|
|
169
|
-
value: "justifyContent";
|
|
170
|
-
};
|
|
171
|
-
direction: {
|
|
172
|
-
type: "property";
|
|
173
|
-
value: "flexDirection";
|
|
174
|
-
};
|
|
175
|
-
gap: {
|
|
176
|
-
type: "property";
|
|
177
|
-
value: "gap";
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
defaultValues: {
|
|
181
|
-
direction: string;
|
|
182
|
-
gap: string;
|
|
183
|
-
};
|
|
184
|
-
transform(props: {
|
|
185
|
-
[x: string]: any;
|
|
186
|
-
[x: number]: any;
|
|
187
|
-
[x: string & Record<never, never>]: any;
|
|
188
|
-
}): {
|
|
189
|
-
display: "flex";
|
|
190
|
-
flexDirection: any;
|
|
191
|
-
alignItems: any;
|
|
192
|
-
justifyContent: any;
|
|
193
|
-
gap: any;
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
vstack: {
|
|
197
|
-
properties: {
|
|
198
|
-
justify: {
|
|
199
|
-
type: "property";
|
|
200
|
-
value: "justifyContent";
|
|
201
|
-
};
|
|
202
|
-
gap: {
|
|
203
|
-
type: "property";
|
|
204
|
-
value: "gap";
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
defaultValues: {
|
|
208
|
-
gap: string;
|
|
209
|
-
};
|
|
210
|
-
transform(props: {
|
|
211
|
-
[x: string]: any;
|
|
212
|
-
[x: number]: any;
|
|
213
|
-
[x: string & Record<never, never>]: any;
|
|
214
|
-
}): {
|
|
215
|
-
display: "flex";
|
|
216
|
-
alignItems: "center";
|
|
217
|
-
justifyContent: any;
|
|
218
|
-
gap: any;
|
|
219
|
-
flexDirection: "column";
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
hstack: {
|
|
223
|
-
properties: {
|
|
224
|
-
justify: {
|
|
225
|
-
type: "property";
|
|
226
|
-
value: "justifyContent";
|
|
227
|
-
};
|
|
228
|
-
gap: {
|
|
229
|
-
type: "property";
|
|
230
|
-
value: "gap";
|
|
231
|
-
};
|
|
232
|
-
};
|
|
233
|
-
defaultValues: {
|
|
234
|
-
gap: string;
|
|
235
|
-
};
|
|
236
|
-
transform(props: {
|
|
237
|
-
[x: string]: any;
|
|
238
|
-
[x: number]: any;
|
|
239
|
-
[x: string & Record<never, never>]: any;
|
|
240
|
-
}): {
|
|
241
|
-
display: "flex";
|
|
242
|
-
alignItems: "center";
|
|
243
|
-
justifyContent: any;
|
|
244
|
-
gap: any;
|
|
245
|
-
flexDirection: "row";
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
161
|
spacer: {
|
|
249
162
|
properties: {
|
|
250
163
|
size: {
|
|
@@ -267,28 +180,11 @@ declare const preset: {
|
|
|
267
180
|
flex: any;
|
|
268
181
|
};
|
|
269
182
|
};
|
|
270
|
-
|
|
183
|
+
center: {
|
|
271
184
|
properties: {
|
|
272
|
-
|
|
273
|
-
type: "
|
|
274
|
-
value: "width";
|
|
185
|
+
inline: {
|
|
186
|
+
type: "boolean";
|
|
275
187
|
};
|
|
276
|
-
};
|
|
277
|
-
transform(props: {
|
|
278
|
-
[x: string]: any;
|
|
279
|
-
[x: number]: any;
|
|
280
|
-
[x: string & Record<never, never>]: any;
|
|
281
|
-
}): {
|
|
282
|
-
display: "flex";
|
|
283
|
-
alignItems: "center";
|
|
284
|
-
justifyContent: "center";
|
|
285
|
-
flex: "0 0 auto";
|
|
286
|
-
width: any;
|
|
287
|
-
height: any;
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
circle: {
|
|
291
|
-
properties: {
|
|
292
188
|
size: {
|
|
293
189
|
type: "property";
|
|
294
190
|
value: "width";
|
|
@@ -299,29 +195,12 @@ declare const preset: {
|
|
|
299
195
|
[x: number]: any;
|
|
300
196
|
[x: string & Record<never, never>]: any;
|
|
301
197
|
}): {
|
|
302
|
-
display: "flex";
|
|
198
|
+
display: "flex" | "inline-flex";
|
|
303
199
|
alignItems: "center";
|
|
304
200
|
justifyContent: "center";
|
|
305
|
-
flex: "0 0 auto";
|
|
201
|
+
flex: "0 0 auto" | undefined;
|
|
306
202
|
width: any;
|
|
307
203
|
height: any;
|
|
308
|
-
borderRadius: "9999px";
|
|
309
|
-
};
|
|
310
|
-
};
|
|
311
|
-
center: {
|
|
312
|
-
properties: {
|
|
313
|
-
inline: {
|
|
314
|
-
type: "boolean";
|
|
315
|
-
};
|
|
316
|
-
};
|
|
317
|
-
transform(props: {
|
|
318
|
-
[x: string]: any;
|
|
319
|
-
[x: number]: any;
|
|
320
|
-
[x: string & Record<never, never>]: any;
|
|
321
|
-
}): {
|
|
322
|
-
display: "flex" | "inline-flex";
|
|
323
|
-
alignItems: "center";
|
|
324
|
-
justifyContent: "center";
|
|
325
204
|
};
|
|
326
205
|
};
|
|
327
206
|
linkOverlay: {
|
|
@@ -453,43 +332,6 @@ declare const preset: {
|
|
|
453
332
|
gridRowEnd: any;
|
|
454
333
|
};
|
|
455
334
|
};
|
|
456
|
-
wrap: {
|
|
457
|
-
properties: {
|
|
458
|
-
gap: {
|
|
459
|
-
type: "property";
|
|
460
|
-
value: "gap";
|
|
461
|
-
};
|
|
462
|
-
rowGap: {
|
|
463
|
-
type: "property";
|
|
464
|
-
value: "gap";
|
|
465
|
-
};
|
|
466
|
-
columnGap: {
|
|
467
|
-
type: "property";
|
|
468
|
-
value: "gap";
|
|
469
|
-
};
|
|
470
|
-
align: {
|
|
471
|
-
type: "property";
|
|
472
|
-
value: "alignItems";
|
|
473
|
-
};
|
|
474
|
-
justify: {
|
|
475
|
-
type: "property";
|
|
476
|
-
value: "justifyContent";
|
|
477
|
-
};
|
|
478
|
-
};
|
|
479
|
-
transform(props: {
|
|
480
|
-
[x: string]: any;
|
|
481
|
-
[x: number]: any;
|
|
482
|
-
[x: string & Record<never, never>]: any;
|
|
483
|
-
}): {
|
|
484
|
-
display: "flex";
|
|
485
|
-
flexWrap: "wrap";
|
|
486
|
-
alignItems: any;
|
|
487
|
-
justifyContent: any;
|
|
488
|
-
gap: any;
|
|
489
|
-
columnGap: any;
|
|
490
|
-
rowGap: any;
|
|
491
|
-
};
|
|
492
|
-
};
|
|
493
335
|
container: {
|
|
494
336
|
transform(props: {
|
|
495
337
|
[x: string]: any;
|
|
@@ -623,30 +465,6 @@ declare const preset: {
|
|
|
623
465
|
marginBlock: "calc(var(--bleed-y, 0) * -1)";
|
|
624
466
|
};
|
|
625
467
|
};
|
|
626
|
-
cq: {
|
|
627
|
-
properties: {
|
|
628
|
-
name: {
|
|
629
|
-
type: "token";
|
|
630
|
-
value: "containerNames";
|
|
631
|
-
property: "containerName";
|
|
632
|
-
};
|
|
633
|
-
type: {
|
|
634
|
-
type: "property";
|
|
635
|
-
value: "containerType";
|
|
636
|
-
};
|
|
637
|
-
};
|
|
638
|
-
defaultValues: {
|
|
639
|
-
type: string;
|
|
640
|
-
};
|
|
641
|
-
transform(props: {
|
|
642
|
-
[x: string]: any;
|
|
643
|
-
[x: number]: any;
|
|
644
|
-
[x: string & Record<never, never>]: any;
|
|
645
|
-
}): {
|
|
646
|
-
containerType: any;
|
|
647
|
-
containerName: any;
|
|
648
|
-
};
|
|
649
|
-
};
|
|
650
468
|
};
|
|
651
469
|
};
|
|
652
470
|
//#endregion
|
package/dist/index.d.mts
CHANGED
|
@@ -158,93 +158,6 @@ declare const preset: {
|
|
|
158
158
|
flexShrink: any;
|
|
159
159
|
};
|
|
160
160
|
};
|
|
161
|
-
stack: {
|
|
162
|
-
properties: {
|
|
163
|
-
align: {
|
|
164
|
-
type: "property";
|
|
165
|
-
value: "alignItems";
|
|
166
|
-
};
|
|
167
|
-
justify: {
|
|
168
|
-
type: "property";
|
|
169
|
-
value: "justifyContent";
|
|
170
|
-
};
|
|
171
|
-
direction: {
|
|
172
|
-
type: "property";
|
|
173
|
-
value: "flexDirection";
|
|
174
|
-
};
|
|
175
|
-
gap: {
|
|
176
|
-
type: "property";
|
|
177
|
-
value: "gap";
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
defaultValues: {
|
|
181
|
-
direction: string;
|
|
182
|
-
gap: string;
|
|
183
|
-
};
|
|
184
|
-
transform(props: {
|
|
185
|
-
[x: string]: any;
|
|
186
|
-
[x: number]: any;
|
|
187
|
-
[x: string & Record<never, never>]: any;
|
|
188
|
-
}): {
|
|
189
|
-
display: "flex";
|
|
190
|
-
flexDirection: any;
|
|
191
|
-
alignItems: any;
|
|
192
|
-
justifyContent: any;
|
|
193
|
-
gap: any;
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
vstack: {
|
|
197
|
-
properties: {
|
|
198
|
-
justify: {
|
|
199
|
-
type: "property";
|
|
200
|
-
value: "justifyContent";
|
|
201
|
-
};
|
|
202
|
-
gap: {
|
|
203
|
-
type: "property";
|
|
204
|
-
value: "gap";
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
defaultValues: {
|
|
208
|
-
gap: string;
|
|
209
|
-
};
|
|
210
|
-
transform(props: {
|
|
211
|
-
[x: string]: any;
|
|
212
|
-
[x: number]: any;
|
|
213
|
-
[x: string & Record<never, never>]: any;
|
|
214
|
-
}): {
|
|
215
|
-
display: "flex";
|
|
216
|
-
alignItems: "center";
|
|
217
|
-
justifyContent: any;
|
|
218
|
-
gap: any;
|
|
219
|
-
flexDirection: "column";
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
hstack: {
|
|
223
|
-
properties: {
|
|
224
|
-
justify: {
|
|
225
|
-
type: "property";
|
|
226
|
-
value: "justifyContent";
|
|
227
|
-
};
|
|
228
|
-
gap: {
|
|
229
|
-
type: "property";
|
|
230
|
-
value: "gap";
|
|
231
|
-
};
|
|
232
|
-
};
|
|
233
|
-
defaultValues: {
|
|
234
|
-
gap: string;
|
|
235
|
-
};
|
|
236
|
-
transform(props: {
|
|
237
|
-
[x: string]: any;
|
|
238
|
-
[x: number]: any;
|
|
239
|
-
[x: string & Record<never, never>]: any;
|
|
240
|
-
}): {
|
|
241
|
-
display: "flex";
|
|
242
|
-
alignItems: "center";
|
|
243
|
-
justifyContent: any;
|
|
244
|
-
gap: any;
|
|
245
|
-
flexDirection: "row";
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
161
|
spacer: {
|
|
249
162
|
properties: {
|
|
250
163
|
size: {
|
|
@@ -267,28 +180,11 @@ declare const preset: {
|
|
|
267
180
|
flex: any;
|
|
268
181
|
};
|
|
269
182
|
};
|
|
270
|
-
|
|
183
|
+
center: {
|
|
271
184
|
properties: {
|
|
272
|
-
|
|
273
|
-
type: "
|
|
274
|
-
value: "width";
|
|
185
|
+
inline: {
|
|
186
|
+
type: "boolean";
|
|
275
187
|
};
|
|
276
|
-
};
|
|
277
|
-
transform(props: {
|
|
278
|
-
[x: string]: any;
|
|
279
|
-
[x: number]: any;
|
|
280
|
-
[x: string & Record<never, never>]: any;
|
|
281
|
-
}): {
|
|
282
|
-
display: "flex";
|
|
283
|
-
alignItems: "center";
|
|
284
|
-
justifyContent: "center";
|
|
285
|
-
flex: "0 0 auto";
|
|
286
|
-
width: any;
|
|
287
|
-
height: any;
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
circle: {
|
|
291
|
-
properties: {
|
|
292
188
|
size: {
|
|
293
189
|
type: "property";
|
|
294
190
|
value: "width";
|
|
@@ -299,29 +195,12 @@ declare const preset: {
|
|
|
299
195
|
[x: number]: any;
|
|
300
196
|
[x: string & Record<never, never>]: any;
|
|
301
197
|
}): {
|
|
302
|
-
display: "flex";
|
|
198
|
+
display: "flex" | "inline-flex";
|
|
303
199
|
alignItems: "center";
|
|
304
200
|
justifyContent: "center";
|
|
305
|
-
flex: "0 0 auto";
|
|
201
|
+
flex: "0 0 auto" | undefined;
|
|
306
202
|
width: any;
|
|
307
203
|
height: any;
|
|
308
|
-
borderRadius: "9999px";
|
|
309
|
-
};
|
|
310
|
-
};
|
|
311
|
-
center: {
|
|
312
|
-
properties: {
|
|
313
|
-
inline: {
|
|
314
|
-
type: "boolean";
|
|
315
|
-
};
|
|
316
|
-
};
|
|
317
|
-
transform(props: {
|
|
318
|
-
[x: string]: any;
|
|
319
|
-
[x: number]: any;
|
|
320
|
-
[x: string & Record<never, never>]: any;
|
|
321
|
-
}): {
|
|
322
|
-
display: "flex" | "inline-flex";
|
|
323
|
-
alignItems: "center";
|
|
324
|
-
justifyContent: "center";
|
|
325
204
|
};
|
|
326
205
|
};
|
|
327
206
|
linkOverlay: {
|
|
@@ -453,43 +332,6 @@ declare const preset: {
|
|
|
453
332
|
gridRowEnd: any;
|
|
454
333
|
};
|
|
455
334
|
};
|
|
456
|
-
wrap: {
|
|
457
|
-
properties: {
|
|
458
|
-
gap: {
|
|
459
|
-
type: "property";
|
|
460
|
-
value: "gap";
|
|
461
|
-
};
|
|
462
|
-
rowGap: {
|
|
463
|
-
type: "property";
|
|
464
|
-
value: "gap";
|
|
465
|
-
};
|
|
466
|
-
columnGap: {
|
|
467
|
-
type: "property";
|
|
468
|
-
value: "gap";
|
|
469
|
-
};
|
|
470
|
-
align: {
|
|
471
|
-
type: "property";
|
|
472
|
-
value: "alignItems";
|
|
473
|
-
};
|
|
474
|
-
justify: {
|
|
475
|
-
type: "property";
|
|
476
|
-
value: "justifyContent";
|
|
477
|
-
};
|
|
478
|
-
};
|
|
479
|
-
transform(props: {
|
|
480
|
-
[x: string]: any;
|
|
481
|
-
[x: number]: any;
|
|
482
|
-
[x: string & Record<never, never>]: any;
|
|
483
|
-
}): {
|
|
484
|
-
display: "flex";
|
|
485
|
-
flexWrap: "wrap";
|
|
486
|
-
alignItems: any;
|
|
487
|
-
justifyContent: any;
|
|
488
|
-
gap: any;
|
|
489
|
-
columnGap: any;
|
|
490
|
-
rowGap: any;
|
|
491
|
-
};
|
|
492
|
-
};
|
|
493
335
|
container: {
|
|
494
336
|
transform(props: {
|
|
495
337
|
[x: string]: any;
|
|
@@ -623,30 +465,6 @@ declare const preset: {
|
|
|
623
465
|
marginBlock: "calc(var(--bleed-y, 0) * -1)";
|
|
624
466
|
};
|
|
625
467
|
};
|
|
626
|
-
cq: {
|
|
627
|
-
properties: {
|
|
628
|
-
name: {
|
|
629
|
-
type: "token";
|
|
630
|
-
value: "containerNames";
|
|
631
|
-
property: "containerName";
|
|
632
|
-
};
|
|
633
|
-
type: {
|
|
634
|
-
type: "property";
|
|
635
|
-
value: "containerType";
|
|
636
|
-
};
|
|
637
|
-
};
|
|
638
|
-
defaultValues: {
|
|
639
|
-
type: string;
|
|
640
|
-
};
|
|
641
|
-
transform(props: {
|
|
642
|
-
[x: string]: any;
|
|
643
|
-
[x: number]: any;
|
|
644
|
-
[x: string & Record<never, never>]: any;
|
|
645
|
-
}): {
|
|
646
|
-
containerType: any;
|
|
647
|
-
containerName: any;
|
|
648
|
-
};
|
|
649
|
-
};
|
|
650
468
|
};
|
|
651
469
|
};
|
|
652
470
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -113,6 +113,18 @@ const conditions = {
|
|
|
113
113
|
function definePattern(config) {
|
|
114
114
|
return config;
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* The one flexbox pattern. `stack`, `vstack`, `hstack` and `wrap` were this with defaults frozen
|
|
118
|
+
* — `stack` added `direction: 'column'` and an 8px gap, the two axis-named ones additionally
|
|
119
|
+
* hard-coded `align: 'center'` and dropped `direction` from the props, and `wrap` set
|
|
120
|
+
* `flexWrap: 'wrap'`. Five names, one transform, and four of them a superset of the fifth only in
|
|
121
|
+
* what they assumed for you.
|
|
122
|
+
*
|
|
123
|
+
* `gap` is deliberately not listed here and does not need to be: anything absent from
|
|
124
|
+
* `properties` still arrives as an ordinary style prop, so `flex({ gap: '6' })` types and folds
|
|
125
|
+
* exactly as it did through `stack`. What goes with the old names is the implicit `gap: '8px'`,
|
|
126
|
+
* which was a design opinion no call site asked for.
|
|
127
|
+
*/
|
|
116
128
|
const flex = definePattern({
|
|
117
129
|
properties: {
|
|
118
130
|
align: {
|
|
@@ -159,89 +171,6 @@ const flex = definePattern({
|
|
|
159
171
|
};
|
|
160
172
|
}
|
|
161
173
|
});
|
|
162
|
-
const stack = definePattern({
|
|
163
|
-
properties: {
|
|
164
|
-
align: {
|
|
165
|
-
type: "property",
|
|
166
|
-
value: "alignItems"
|
|
167
|
-
},
|
|
168
|
-
justify: {
|
|
169
|
-
type: "property",
|
|
170
|
-
value: "justifyContent"
|
|
171
|
-
},
|
|
172
|
-
direction: {
|
|
173
|
-
type: "property",
|
|
174
|
-
value: "flexDirection"
|
|
175
|
-
},
|
|
176
|
-
gap: {
|
|
177
|
-
type: "property",
|
|
178
|
-
value: "gap"
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
defaultValues: {
|
|
182
|
-
direction: "column",
|
|
183
|
-
gap: "8px"
|
|
184
|
-
},
|
|
185
|
-
transform(props) {
|
|
186
|
-
const { align, justify, direction, gap, ...rest } = props;
|
|
187
|
-
return {
|
|
188
|
-
display: "flex",
|
|
189
|
-
flexDirection: direction,
|
|
190
|
-
alignItems: align,
|
|
191
|
-
justifyContent: justify,
|
|
192
|
-
gap,
|
|
193
|
-
...rest
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
const vstack = definePattern({
|
|
198
|
-
properties: {
|
|
199
|
-
justify: {
|
|
200
|
-
type: "property",
|
|
201
|
-
value: "justifyContent"
|
|
202
|
-
},
|
|
203
|
-
gap: {
|
|
204
|
-
type: "property",
|
|
205
|
-
value: "gap"
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
defaultValues: { gap: "8px" },
|
|
209
|
-
transform(props) {
|
|
210
|
-
const { justify, gap, ...rest } = props;
|
|
211
|
-
return {
|
|
212
|
-
display: "flex",
|
|
213
|
-
alignItems: "center",
|
|
214
|
-
justifyContent: justify,
|
|
215
|
-
gap,
|
|
216
|
-
flexDirection: "column",
|
|
217
|
-
...rest
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
const hstack = definePattern({
|
|
222
|
-
properties: {
|
|
223
|
-
justify: {
|
|
224
|
-
type: "property",
|
|
225
|
-
value: "justifyContent"
|
|
226
|
-
},
|
|
227
|
-
gap: {
|
|
228
|
-
type: "property",
|
|
229
|
-
value: "gap"
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
defaultValues: { gap: "8px" },
|
|
233
|
-
transform(props) {
|
|
234
|
-
const { justify, gap, ...rest } = props;
|
|
235
|
-
return {
|
|
236
|
-
display: "flex",
|
|
237
|
-
alignItems: "center",
|
|
238
|
-
justifyContent: justify,
|
|
239
|
-
gap,
|
|
240
|
-
flexDirection: "row",
|
|
241
|
-
...rest
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
174
|
const spacer = definePattern({
|
|
246
175
|
properties: { size: {
|
|
247
176
|
type: "token",
|
|
@@ -260,43 +189,6 @@ const spacer = definePattern({
|
|
|
260
189
|
};
|
|
261
190
|
}
|
|
262
191
|
});
|
|
263
|
-
const circle = definePattern({
|
|
264
|
-
properties: { size: {
|
|
265
|
-
type: "property",
|
|
266
|
-
value: "width"
|
|
267
|
-
} },
|
|
268
|
-
transform(props) {
|
|
269
|
-
const { size, ...rest } = props;
|
|
270
|
-
return {
|
|
271
|
-
display: "flex",
|
|
272
|
-
alignItems: "center",
|
|
273
|
-
justifyContent: "center",
|
|
274
|
-
flex: "0 0 auto",
|
|
275
|
-
width: size,
|
|
276
|
-
height: size,
|
|
277
|
-
borderRadius: "9999px",
|
|
278
|
-
...rest
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
const square = definePattern({
|
|
283
|
-
properties: { size: {
|
|
284
|
-
type: "property",
|
|
285
|
-
value: "width"
|
|
286
|
-
} },
|
|
287
|
-
transform(props) {
|
|
288
|
-
const { size, ...rest } = props;
|
|
289
|
-
return {
|
|
290
|
-
display: "flex",
|
|
291
|
-
alignItems: "center",
|
|
292
|
-
justifyContent: "center",
|
|
293
|
-
flex: "0 0 auto",
|
|
294
|
-
width: size,
|
|
295
|
-
height: size,
|
|
296
|
-
...rest
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
192
|
const grid = definePattern({
|
|
301
193
|
properties: {
|
|
302
194
|
gap: {
|
|
@@ -357,43 +249,6 @@ const gridItem = definePattern({
|
|
|
357
249
|
};
|
|
358
250
|
}
|
|
359
251
|
});
|
|
360
|
-
const wrap = definePattern({
|
|
361
|
-
properties: {
|
|
362
|
-
gap: {
|
|
363
|
-
type: "property",
|
|
364
|
-
value: "gap"
|
|
365
|
-
},
|
|
366
|
-
rowGap: {
|
|
367
|
-
type: "property",
|
|
368
|
-
value: "gap"
|
|
369
|
-
},
|
|
370
|
-
columnGap: {
|
|
371
|
-
type: "property",
|
|
372
|
-
value: "gap"
|
|
373
|
-
},
|
|
374
|
-
align: {
|
|
375
|
-
type: "property",
|
|
376
|
-
value: "alignItems"
|
|
377
|
-
},
|
|
378
|
-
justify: {
|
|
379
|
-
type: "property",
|
|
380
|
-
value: "justifyContent"
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
transform(props) {
|
|
384
|
-
const { columnGap, rowGap, gap = columnGap || rowGap ? void 0 : "8px", align, justify, ...rest } = props;
|
|
385
|
-
return {
|
|
386
|
-
display: "flex",
|
|
387
|
-
flexWrap: "wrap",
|
|
388
|
-
alignItems: align,
|
|
389
|
-
justifyContent: justify,
|
|
390
|
-
gap,
|
|
391
|
-
columnGap,
|
|
392
|
-
rowGap,
|
|
393
|
-
...rest
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
252
|
const container$1 = definePattern({ transform(props) {
|
|
398
253
|
return {
|
|
399
254
|
position: "relative",
|
|
@@ -407,14 +262,34 @@ const container$1 = definePattern({ transform(props) {
|
|
|
407
262
|
...props
|
|
408
263
|
};
|
|
409
264
|
} });
|
|
265
|
+
/**
|
|
266
|
+
* Absorbs what `square` and `circle` used to be. `square({ size })` is `center({ size })`, and
|
|
267
|
+
* `circle({ size })` is `center({ size, borderRadius: 'full' })` — `borderRadius` is an ordinary
|
|
268
|
+
* style prop, so the rounded case needs nothing here beyond the size the square case already
|
|
269
|
+
* wanted. Three patterns whose transforms differed by one declaration is three names to learn
|
|
270
|
+
* and three places for `alignItems: center` to drift.
|
|
271
|
+
*
|
|
272
|
+
* `flex: '0 0 auto'` rides with `size` rather than being unconditional: it is what stops a sized
|
|
273
|
+
* box from being shrunk by a flex parent, so it is meaningless without one, and applying it to
|
|
274
|
+
* an unsized `center` would change how every existing call lays out inside a flex row.
|
|
275
|
+
*/
|
|
410
276
|
const center = definePattern({
|
|
411
|
-
properties: {
|
|
277
|
+
properties: {
|
|
278
|
+
inline: { type: "boolean" },
|
|
279
|
+
size: {
|
|
280
|
+
type: "property",
|
|
281
|
+
value: "width"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
412
284
|
transform(props) {
|
|
413
|
-
const { inline, ...rest } = props;
|
|
285
|
+
const { inline, size, ...rest } = props;
|
|
414
286
|
return {
|
|
415
287
|
display: inline ? "inline-flex" : "flex",
|
|
416
288
|
alignItems: "center",
|
|
417
289
|
justifyContent: "center",
|
|
290
|
+
flex: size == null ? void 0 : "0 0 auto",
|
|
291
|
+
width: size,
|
|
292
|
+
height: size,
|
|
418
293
|
...rest
|
|
419
294
|
};
|
|
420
295
|
}
|
|
@@ -483,12 +358,7 @@ const divider = definePattern({
|
|
|
483
358
|
});
|
|
484
359
|
const patterns = {
|
|
485
360
|
flex,
|
|
486
|
-
stack,
|
|
487
|
-
vstack,
|
|
488
|
-
hstack,
|
|
489
361
|
spacer,
|
|
490
|
-
square,
|
|
491
|
-
circle,
|
|
492
362
|
center,
|
|
493
363
|
linkOverlay: definePattern({ transform(props) {
|
|
494
364
|
return {
|
|
@@ -505,7 +375,6 @@ const patterns = {
|
|
|
505
375
|
aspectRatio,
|
|
506
376
|
grid,
|
|
507
377
|
gridItem,
|
|
508
|
-
wrap,
|
|
509
378
|
container: container$1,
|
|
510
379
|
divider,
|
|
511
380
|
float: definePattern({
|
|
@@ -630,28 +499,6 @@ const patterns = {
|
|
|
630
499
|
...rest
|
|
631
500
|
};
|
|
632
501
|
}
|
|
633
|
-
}),
|
|
634
|
-
cq: definePattern({
|
|
635
|
-
properties: {
|
|
636
|
-
name: {
|
|
637
|
-
type: "token",
|
|
638
|
-
value: "containerNames",
|
|
639
|
-
property: "containerName"
|
|
640
|
-
},
|
|
641
|
-
type: {
|
|
642
|
-
type: "property",
|
|
643
|
-
value: "containerType"
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
defaultValues: { type: "inline-size" },
|
|
647
|
-
transform(props) {
|
|
648
|
-
const { name, type, ...rest } = props;
|
|
649
|
-
return {
|
|
650
|
-
containerType: type,
|
|
651
|
-
containerName: name,
|
|
652
|
-
...rest
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
502
|
})
|
|
656
503
|
};
|
|
657
504
|
//#endregion
|
|
@@ -1091,28 +938,10 @@ const cursor = { cursor: {
|
|
|
1091
938
|
} };
|
|
1092
939
|
//#endregion
|
|
1093
940
|
//#region src/utilities/display.ts
|
|
1094
|
-
const display = {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
},
|
|
1099
|
-
hideFrom: {
|
|
1100
|
-
className: "hide",
|
|
1101
|
-
values: "breakpoints",
|
|
1102
|
-
group: "Display",
|
|
1103
|
-
transform(value, { raw, token }) {
|
|
1104
|
-
return { [token.raw(`breakpoints.${raw}`) ? `@breakpoint ${raw}` : `@media (width >= ${value})`]: { display: "none" } };
|
|
1105
|
-
}
|
|
1106
|
-
},
|
|
1107
|
-
hideBelow: {
|
|
1108
|
-
className: "show",
|
|
1109
|
-
values: "breakpoints",
|
|
1110
|
-
group: "Display",
|
|
1111
|
-
transform(value, { raw, token }) {
|
|
1112
|
-
return { [token.raw(`breakpoints.${raw}`) ? `@breakpoint ${raw}Down` : `@media (width < ${value})`]: { display: "none" } };
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
};
|
|
941
|
+
const display = { display: {
|
|
942
|
+
className: "d",
|
|
943
|
+
group: "Display"
|
|
944
|
+
} };
|
|
1116
945
|
//#endregion
|
|
1117
946
|
//#region src/utilities/divide.ts
|
|
1118
947
|
const divideColor = createColorMixTransform("borderColor");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/preset-base",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33.0",
|
|
4
4
|
"description": "The base preset for Bamboo CSS that contains the conditions and utilities",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@bamboocss/types": "1.
|
|
36
|
+
"@bamboocss/types": "1.33.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsdown src/index.ts --format=esm,cjs --dts",
|