@alivecss/aliveui 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/cli.js +89 -26
- package/dist/index.js +100 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -28
- package/dist/index.mjs.map +1 -1
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +101 -28
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +101 -28
- package/dist/vite.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Modern interfaces are visually structured but temporally dead. AliveUI treats mo
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install @
|
|
12
|
+
npm install @alivecss/aliveui
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
---
|
|
@@ -23,7 +23,7 @@ Add to `postcss.config.js`:
|
|
|
23
23
|
```js
|
|
24
24
|
module.exports = {
|
|
25
25
|
plugins: {
|
|
26
|
-
'@
|
|
26
|
+
'@alivecss/aliveui': {
|
|
27
27
|
content: ['./src/**/*.{html,js,jsx,ts,tsx,vue,svelte}'],
|
|
28
28
|
},
|
|
29
29
|
},
|
|
@@ -41,19 +41,19 @@ In your CSS entry file:
|
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
43
|
# Create config
|
|
44
|
-
npx @
|
|
44
|
+
npx @alivecss/aliveui init
|
|
45
45
|
|
|
46
46
|
# Build once
|
|
47
|
-
npx @
|
|
47
|
+
npx @alivecss/aliveui build
|
|
48
48
|
|
|
49
49
|
# Watch mode
|
|
50
|
-
npx @
|
|
50
|
+
npx @alivecss/aliveui watch
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
Config file (`aliveui.config.js`):
|
|
54
54
|
|
|
55
55
|
```js
|
|
56
|
-
/** @type {import('@
|
|
56
|
+
/** @type {import('@alivecss/aliveui').AliveUIConfig} */
|
|
57
57
|
module.exports = {
|
|
58
58
|
content: ['./src/**/*.{html,js,jsx,ts,tsx}'],
|
|
59
59
|
output: './public/alive.css',
|
|
@@ -267,7 +267,7 @@ AliveUI ships three primitive components — thin semantic wrappers for common p
|
|
|
267
267
|
## Configuration
|
|
268
268
|
|
|
269
269
|
```js
|
|
270
|
-
/** @type {import('@
|
|
270
|
+
/** @type {import('@alivecss/aliveui').AliveUIConfig} */
|
|
271
271
|
module.exports = {
|
|
272
272
|
content: ['./src/**/*.{html,jsx,tsx}'],
|
|
273
273
|
output: './public/alive.css',
|
package/dist/cli.js
CHANGED
|
@@ -587,6 +587,42 @@ function generateBase(_config) {
|
|
|
587
587
|
box-sizing: border-box;
|
|
588
588
|
}
|
|
589
589
|
|
|
590
|
+
html {
|
|
591
|
+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
|
|
592
|
+
"Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
|
|
593
|
+
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
594
|
+
line-height: 1.5;
|
|
595
|
+
-webkit-text-size-adjust: 100%;
|
|
596
|
+
-moz-tab-size: 4;
|
|
597
|
+
tab-size: 4;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
body {
|
|
601
|
+
margin: 0;
|
|
602
|
+
line-height: inherit;
|
|
603
|
+
-webkit-font-smoothing: antialiased;
|
|
604
|
+
-moz-osx-font-smoothing: grayscale;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
button,
|
|
608
|
+
input,
|
|
609
|
+
optgroup,
|
|
610
|
+
select,
|
|
611
|
+
textarea {
|
|
612
|
+
font-family: inherit;
|
|
613
|
+
font-size: 100%;
|
|
614
|
+
font-weight: inherit;
|
|
615
|
+
line-height: inherit;
|
|
616
|
+
color: inherit;
|
|
617
|
+
margin: 0;
|
|
618
|
+
padding: 0;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
button,
|
|
622
|
+
select {
|
|
623
|
+
text-transform: none;
|
|
624
|
+
}
|
|
625
|
+
|
|
590
626
|
/* \u2500\u2500 Design tokens \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
591
627
|
:root {
|
|
592
628
|
/* Motion durations */
|
|
@@ -2672,9 +2708,23 @@ function matchTypography(cls, fontSize, fontWeight, lineHeight) {
|
|
|
2672
2708
|
}
|
|
2673
2709
|
|
|
2674
2710
|
// src/generator/layout.ts
|
|
2675
|
-
function
|
|
2711
|
+
function has2(obj, key) {
|
|
2712
|
+
return typeof obj[key] === "string";
|
|
2713
|
+
}
|
|
2714
|
+
function generateLayout(classes, config) {
|
|
2715
|
+
const { spacing } = config.theme;
|
|
2676
2716
|
const rules = [];
|
|
2677
2717
|
for (const cls of classes) {
|
|
2718
|
+
const spaceYMatch = cls.match(/^space-y-(.+)$/);
|
|
2719
|
+
if (spaceYMatch && has2(spacing, spaceYMatch[1])) {
|
|
2720
|
+
rules.push(`.${escapeSelector(cls)} > * + * { margin-top: ${spacing[spaceYMatch[1]]}; }`);
|
|
2721
|
+
continue;
|
|
2722
|
+
}
|
|
2723
|
+
const spaceXMatch = cls.match(/^space-x-(.+)$/);
|
|
2724
|
+
if (spaceXMatch && has2(spacing, spaceXMatch[1])) {
|
|
2725
|
+
rules.push(`.${escapeSelector(cls)} > * + * { margin-left: ${spacing[spaceXMatch[1]]}; }`);
|
|
2726
|
+
continue;
|
|
2727
|
+
}
|
|
2678
2728
|
const generated = matchLayout(cls);
|
|
2679
2729
|
if (generated) rules.push(generated);
|
|
2680
2730
|
}
|
|
@@ -2717,6 +2767,10 @@ function matchLayout(cls) {
|
|
|
2717
2767
|
if (cls === "flex-grow-0") return `.${cls} { flex-grow: 0; }`;
|
|
2718
2768
|
if (cls === "flex-shrink") return `.${cls} { flex-shrink: 1; }`;
|
|
2719
2769
|
if (cls === "flex-shrink-0") return `.${cls} { flex-shrink: 0; }`;
|
|
2770
|
+
if (cls === "grow") return `.${cls} { flex-grow: 1; }`;
|
|
2771
|
+
if (cls === "grow-0") return `.${cls} { flex-grow: 0; }`;
|
|
2772
|
+
if (cls === "shrink") return `.${cls} { flex-shrink: 1; }`;
|
|
2773
|
+
if (cls === "shrink-0") return `.${cls} { flex-shrink: 0; }`;
|
|
2720
2774
|
if (cls === "items-start") return `.${cls} { align-items: flex-start; }`;
|
|
2721
2775
|
if (cls === "items-end") return `.${cls} { align-items: flex-end; }`;
|
|
2722
2776
|
if (cls === "items-center") return `.${cls} { align-items: center; }`;
|
|
@@ -2893,7 +2947,7 @@ function matchLayout(cls) {
|
|
|
2893
2947
|
}
|
|
2894
2948
|
|
|
2895
2949
|
// src/generator/sizing.ts
|
|
2896
|
-
function
|
|
2950
|
+
function has3(obj, key) {
|
|
2897
2951
|
return typeof obj[key] === "string";
|
|
2898
2952
|
}
|
|
2899
2953
|
function generateSizing(classes, config) {
|
|
@@ -2944,8 +2998,8 @@ function matchSizing(cls, spacing) {
|
|
|
2944
2998
|
if (key === "min") return `.${cls} { width: min-content; }`;
|
|
2945
2999
|
if (key === "max") return `.${cls} { width: max-content; }`;
|
|
2946
3000
|
if (key === "fit") return `.${cls} { width: fit-content; }`;
|
|
2947
|
-
if (
|
|
2948
|
-
if (
|
|
3001
|
+
if (has3(fractions, key)) return `.${cls} { width: ${fractions[key]}; }`;
|
|
3002
|
+
if (has3(spacing, key)) return `.${cls} { width: ${spacing[key]}; }`;
|
|
2949
3003
|
}
|
|
2950
3004
|
const minWMatch = cls.match(/^min-w-(.+)$/);
|
|
2951
3005
|
if (minWMatch) {
|
|
@@ -2955,7 +3009,7 @@ function matchSizing(cls, spacing) {
|
|
|
2955
3009
|
if (key === "min") return `.${cls} { min-width: min-content; }`;
|
|
2956
3010
|
if (key === "max") return `.${cls} { min-width: max-content; }`;
|
|
2957
3011
|
if (key === "fit") return `.${cls} { min-width: fit-content; }`;
|
|
2958
|
-
if (
|
|
3012
|
+
if (has3(spacing, key)) return `.${cls} { min-width: ${spacing[key]}; }`;
|
|
2959
3013
|
}
|
|
2960
3014
|
const maxWMap = {
|
|
2961
3015
|
none: "none",
|
|
@@ -2982,7 +3036,7 @@ function matchSizing(cls, spacing) {
|
|
|
2982
3036
|
"screen-2xl": "1536px"
|
|
2983
3037
|
};
|
|
2984
3038
|
const maxWMatch = cls.match(/^max-w-(.+)$/);
|
|
2985
|
-
if (maxWMatch &&
|
|
3039
|
+
if (maxWMatch && has3(maxWMap, maxWMatch[1])) {
|
|
2986
3040
|
return `.${cls} { max-width: ${maxWMap[maxWMatch[1]]}; }`;
|
|
2987
3041
|
}
|
|
2988
3042
|
const hMatch = cls.match(/^h-(.+)$/);
|
|
@@ -2996,8 +3050,8 @@ function matchSizing(cls, spacing) {
|
|
|
2996
3050
|
if (key === "min") return `.${cls} { height: min-content; }`;
|
|
2997
3051
|
if (key === "max") return `.${cls} { height: max-content; }`;
|
|
2998
3052
|
if (key === "fit") return `.${cls} { height: fit-content; }`;
|
|
2999
|
-
if (
|
|
3000
|
-
if (
|
|
3053
|
+
if (has3(fractions, key)) return `.${cls} { height: ${fractions[key]}; }`;
|
|
3054
|
+
if (has3(spacing, key)) return `.${cls} { height: ${spacing[key]}; }`;
|
|
3001
3055
|
}
|
|
3002
3056
|
const minHMatch = cls.match(/^min-h-(.+)$/);
|
|
3003
3057
|
if (minHMatch) {
|
|
@@ -3008,7 +3062,7 @@ function matchSizing(cls, spacing) {
|
|
|
3008
3062
|
if (key === "svh") return `.${cls} { min-height: 100svh; }`;
|
|
3009
3063
|
if (key === "dvh") return `.${cls} { min-height: 100dvh; }`;
|
|
3010
3064
|
if (key === "fit") return `.${cls} { min-height: fit-content; }`;
|
|
3011
|
-
if (
|
|
3065
|
+
if (has3(spacing, key)) return `.${cls} { min-height: ${spacing[key]}; }`;
|
|
3012
3066
|
}
|
|
3013
3067
|
const maxHMatch = cls.match(/^max-h-(.+)$/);
|
|
3014
3068
|
if (maxHMatch) {
|
|
@@ -3019,13 +3073,22 @@ function matchSizing(cls, spacing) {
|
|
|
3019
3073
|
if (key === "svh") return `.${cls} { max-height: 100svh; }`;
|
|
3020
3074
|
if (key === "dvh") return `.${cls} { max-height: 100dvh; }`;
|
|
3021
3075
|
if (key === "fit") return `.${cls} { max-height: fit-content; }`;
|
|
3022
|
-
if (
|
|
3076
|
+
if (has3(spacing, key)) return `.${cls} { max-height: ${spacing[key]}; }`;
|
|
3077
|
+
}
|
|
3078
|
+
const basisMatch = cls.match(/^basis-(.+)$/);
|
|
3079
|
+
if (basisMatch) {
|
|
3080
|
+
const key = basisMatch[1];
|
|
3081
|
+
if (key === "auto") return `.${cls} { flex-basis: auto; }`;
|
|
3082
|
+
if (key === "full") return `.${cls} { flex-basis: 100%; }`;
|
|
3083
|
+
if (key === "0") return `.${cls} { flex-basis: 0px; }`;
|
|
3084
|
+
if (has3(fractions, key)) return `.${cls} { flex-basis: ${fractions[key]}; }`;
|
|
3085
|
+
if (has3(spacing, key)) return `.${cls} { flex-basis: ${spacing[key]}; }`;
|
|
3023
3086
|
}
|
|
3024
3087
|
return null;
|
|
3025
3088
|
}
|
|
3026
3089
|
|
|
3027
3090
|
// src/generator/effects.ts
|
|
3028
|
-
function
|
|
3091
|
+
function has4(obj, key) {
|
|
3029
3092
|
return typeof obj[key] === "string";
|
|
3030
3093
|
}
|
|
3031
3094
|
function generateEffects(classes, config) {
|
|
@@ -3039,7 +3102,7 @@ function generateEffects(classes, config) {
|
|
|
3039
3102
|
}
|
|
3040
3103
|
function matchEffects(cls, opacity, zIndex, boxShadow, borderRadius) {
|
|
3041
3104
|
const opacityMatch = cls.match(/^opacity-(.+)$/);
|
|
3042
|
-
if (opacityMatch &&
|
|
3105
|
+
if (opacityMatch && has4(opacity, opacityMatch[1])) {
|
|
3043
3106
|
return `.${cls} {
|
|
3044
3107
|
opacity: ${opacity[opacityMatch[1]]};
|
|
3045
3108
|
transition-property: opacity;
|
|
@@ -3048,47 +3111,47 @@ function matchEffects(cls, opacity, zIndex, boxShadow, borderRadius) {
|
|
|
3048
3111
|
}`;
|
|
3049
3112
|
}
|
|
3050
3113
|
const zMatch = cls.match(/^z-(.+)$/);
|
|
3051
|
-
if (zMatch &&
|
|
3114
|
+
if (zMatch && has4(zIndex, zMatch[1])) {
|
|
3052
3115
|
return `.${cls} { z-index: ${zIndex[zMatch[1]]}; }`;
|
|
3053
3116
|
}
|
|
3054
3117
|
const shadowMatch = cls.match(/^shadow(?:-(.+))?$/);
|
|
3055
3118
|
if (shadowMatch) {
|
|
3056
3119
|
const key = shadowMatch[1] ?? "DEFAULT";
|
|
3057
|
-
if (
|
|
3120
|
+
if (has4(boxShadow, key)) {
|
|
3058
3121
|
return `.${cls} { box-shadow: ${boxShadow[key]}; }`;
|
|
3059
3122
|
}
|
|
3060
|
-
if (!shadowMatch[1] &&
|
|
3123
|
+
if (!shadowMatch[1] && has4(boxShadow, "DEFAULT")) {
|
|
3061
3124
|
return `.${cls} { box-shadow: ${boxShadow["DEFAULT"]}; }`;
|
|
3062
3125
|
}
|
|
3063
3126
|
}
|
|
3064
3127
|
const roundedMatch = cls.match(/^rounded(?:-(.+))?$/);
|
|
3065
3128
|
if (roundedMatch) {
|
|
3066
3129
|
const key = roundedMatch[1] ?? "DEFAULT";
|
|
3067
|
-
if (
|
|
3068
|
-
if (!roundedMatch[1] &&
|
|
3130
|
+
if (has4(borderRadius, key)) return `.${cls} { border-radius: ${borderRadius[key]}; }`;
|
|
3131
|
+
if (!roundedMatch[1] && has4(borderRadius, "DEFAULT")) return `.${cls} { border-radius: ${borderRadius["DEFAULT"]}; }`;
|
|
3069
3132
|
}
|
|
3070
3133
|
const roundedTMatch = cls.match(/^rounded-t(?:-(.+))?$/);
|
|
3071
3134
|
if (roundedTMatch) {
|
|
3072
3135
|
const rkey = roundedTMatch[1] ?? "DEFAULT";
|
|
3073
|
-
const val =
|
|
3136
|
+
const val = has4(borderRadius, rkey) ? borderRadius[rkey] : has4(borderRadius, "DEFAULT") ? borderRadius["DEFAULT"] : null;
|
|
3074
3137
|
if (val) return `.${cls} { border-top-left-radius: ${val}; border-top-right-radius: ${val}; }`;
|
|
3075
3138
|
}
|
|
3076
3139
|
const roundedBMatch = cls.match(/^rounded-b(?:-(.+))?$/);
|
|
3077
3140
|
if (roundedBMatch) {
|
|
3078
3141
|
const rkey = roundedBMatch[1] ?? "DEFAULT";
|
|
3079
|
-
const val =
|
|
3142
|
+
const val = has4(borderRadius, rkey) ? borderRadius[rkey] : has4(borderRadius, "DEFAULT") ? borderRadius["DEFAULT"] : null;
|
|
3080
3143
|
if (val) return `.${cls} { border-bottom-left-radius: ${val}; border-bottom-right-radius: ${val}; }`;
|
|
3081
3144
|
}
|
|
3082
3145
|
const roundedLMatch = cls.match(/^rounded-l(?:-(.+))?$/);
|
|
3083
3146
|
if (roundedLMatch) {
|
|
3084
3147
|
const rkey = roundedLMatch[1] ?? "DEFAULT";
|
|
3085
|
-
const val =
|
|
3148
|
+
const val = has4(borderRadius, rkey) ? borderRadius[rkey] : has4(borderRadius, "DEFAULT") ? borderRadius["DEFAULT"] : null;
|
|
3086
3149
|
if (val) return `.${cls} { border-top-left-radius: ${val}; border-bottom-left-radius: ${val}; }`;
|
|
3087
3150
|
}
|
|
3088
3151
|
const roundedRMatch = cls.match(/^rounded-r(?:-(.+))?$/);
|
|
3089
3152
|
if (roundedRMatch) {
|
|
3090
3153
|
const rkey = roundedRMatch[1] ?? "DEFAULT";
|
|
3091
|
-
const val =
|
|
3154
|
+
const val = has4(borderRadius, rkey) ? borderRadius[rkey] : has4(borderRadius, "DEFAULT") ? borderRadius["DEFAULT"] : null;
|
|
3092
3155
|
if (val) return `.${cls} { border-top-right-radius: ${val}; border-bottom-right-radius: ${val}; }`;
|
|
3093
3156
|
}
|
|
3094
3157
|
if (cls === "border") return `.${cls} { border-width: 1px; border-style: solid; }`;
|
|
@@ -3142,15 +3205,15 @@ function matchEffects(cls, opacity, zIndex, boxShadow, borderRadius) {
|
|
|
3142
3205
|
"150": "1.5"
|
|
3143
3206
|
};
|
|
3144
3207
|
const scaleMatch = cls.match(/^scale-(\d+)$/);
|
|
3145
|
-
if (scaleMatch &&
|
|
3208
|
+
if (scaleMatch && has4(scaleMap, scaleMatch[1])) {
|
|
3146
3209
|
return `.${cls} { transform: scale(${scaleMap[scaleMatch[1]]}); }`;
|
|
3147
3210
|
}
|
|
3148
3211
|
const scaleXMatch = cls.match(/^scale-x-(\d+)$/);
|
|
3149
|
-
if (scaleXMatch &&
|
|
3212
|
+
if (scaleXMatch && has4(scaleMap, scaleXMatch[1])) {
|
|
3150
3213
|
return `.${cls} { transform: scaleX(${scaleMap[scaleXMatch[1]]}); }`;
|
|
3151
3214
|
}
|
|
3152
3215
|
const scaleYMatch = cls.match(/^scale-y-(\d+)$/);
|
|
3153
|
-
if (scaleYMatch &&
|
|
3216
|
+
if (scaleYMatch && has4(scaleMap, scaleYMatch[1])) {
|
|
3154
3217
|
return `.${cls} { transform: scaleY(${scaleMap[scaleYMatch[1]]}); }`;
|
|
3155
3218
|
}
|
|
3156
3219
|
const rotateMatch = cls.match(/^-?rotate-(\d+)$/);
|
|
@@ -3193,7 +3256,7 @@ function matchEffects(cls, opacity, zIndex, boxShadow, borderRadius) {
|
|
|
3193
3256
|
"3xl": "64px"
|
|
3194
3257
|
};
|
|
3195
3258
|
const key = blurMatch[1] ?? "DEFAULT";
|
|
3196
|
-
if (
|
|
3259
|
+
if (has4(blurMap, key)) return `.${cls} { filter: blur(${blurMap[key]}); }`;
|
|
3197
3260
|
}
|
|
3198
3261
|
const backdropBlurMatch = cls.match(/^backdrop-blur(?:-(.+))?$/);
|
|
3199
3262
|
if (backdropBlurMatch) {
|
|
@@ -3208,7 +3271,7 @@ function matchEffects(cls, opacity, zIndex, boxShadow, borderRadius) {
|
|
|
3208
3271
|
"3xl": "64px"
|
|
3209
3272
|
};
|
|
3210
3273
|
const key = backdropBlurMatch[1] ?? "DEFAULT";
|
|
3211
|
-
if (
|
|
3274
|
+
if (has4(blurMap, key)) return `.${cls} { backdrop-filter: blur(${blurMap[key]}); }`;
|
|
3212
3275
|
}
|
|
3213
3276
|
const arbOpacityMatch = cls.match(/^opacity-\[(.+)\]$/);
|
|
3214
3277
|
if (arbOpacityMatch) {
|
package/dist/index.js
CHANGED
|
@@ -595,6 +595,42 @@ function generateBase(_config) {
|
|
|
595
595
|
box-sizing: border-box;
|
|
596
596
|
}
|
|
597
597
|
|
|
598
|
+
html {
|
|
599
|
+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
|
|
600
|
+
"Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
|
|
601
|
+
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
602
|
+
line-height: 1.5;
|
|
603
|
+
-webkit-text-size-adjust: 100%;
|
|
604
|
+
-moz-tab-size: 4;
|
|
605
|
+
tab-size: 4;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
body {
|
|
609
|
+
margin: 0;
|
|
610
|
+
line-height: inherit;
|
|
611
|
+
-webkit-font-smoothing: antialiased;
|
|
612
|
+
-moz-osx-font-smoothing: grayscale;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
button,
|
|
616
|
+
input,
|
|
617
|
+
optgroup,
|
|
618
|
+
select,
|
|
619
|
+
textarea {
|
|
620
|
+
font-family: inherit;
|
|
621
|
+
font-size: 100%;
|
|
622
|
+
font-weight: inherit;
|
|
623
|
+
line-height: inherit;
|
|
624
|
+
color: inherit;
|
|
625
|
+
margin: 0;
|
|
626
|
+
padding: 0;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
button,
|
|
630
|
+
select {
|
|
631
|
+
text-transform: none;
|
|
632
|
+
}
|
|
633
|
+
|
|
598
634
|
/* \u2500\u2500 Design tokens \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
599
635
|
:root {
|
|
600
636
|
/* Motion durations */
|
|
@@ -2680,9 +2716,23 @@ function matchTypography(cls, fontSize, fontWeight, lineHeight) {
|
|
|
2680
2716
|
}
|
|
2681
2717
|
|
|
2682
2718
|
// src/generator/layout.ts
|
|
2683
|
-
function
|
|
2719
|
+
function has2(obj, key) {
|
|
2720
|
+
return typeof obj[key] === "string";
|
|
2721
|
+
}
|
|
2722
|
+
function generateLayout(classes, config) {
|
|
2723
|
+
const { spacing } = config.theme;
|
|
2684
2724
|
const rules = [];
|
|
2685
2725
|
for (const cls of classes) {
|
|
2726
|
+
const spaceYMatch = cls.match(/^space-y-(.+)$/);
|
|
2727
|
+
if (spaceYMatch && has2(spacing, spaceYMatch[1])) {
|
|
2728
|
+
rules.push(`.${escapeSelector(cls)} > * + * { margin-top: ${spacing[spaceYMatch[1]]}; }`);
|
|
2729
|
+
continue;
|
|
2730
|
+
}
|
|
2731
|
+
const spaceXMatch = cls.match(/^space-x-(.+)$/);
|
|
2732
|
+
if (spaceXMatch && has2(spacing, spaceXMatch[1])) {
|
|
2733
|
+
rules.push(`.${escapeSelector(cls)} > * + * { margin-left: ${spacing[spaceXMatch[1]]}; }`);
|
|
2734
|
+
continue;
|
|
2735
|
+
}
|
|
2686
2736
|
const generated = matchLayout(cls);
|
|
2687
2737
|
if (generated) rules.push(generated);
|
|
2688
2738
|
}
|
|
@@ -2725,6 +2775,10 @@ function matchLayout(cls) {
|
|
|
2725
2775
|
if (cls === "flex-grow-0") return `.${cls} { flex-grow: 0; }`;
|
|
2726
2776
|
if (cls === "flex-shrink") return `.${cls} { flex-shrink: 1; }`;
|
|
2727
2777
|
if (cls === "flex-shrink-0") return `.${cls} { flex-shrink: 0; }`;
|
|
2778
|
+
if (cls === "grow") return `.${cls} { flex-grow: 1; }`;
|
|
2779
|
+
if (cls === "grow-0") return `.${cls} { flex-grow: 0; }`;
|
|
2780
|
+
if (cls === "shrink") return `.${cls} { flex-shrink: 1; }`;
|
|
2781
|
+
if (cls === "shrink-0") return `.${cls} { flex-shrink: 0; }`;
|
|
2728
2782
|
if (cls === "items-start") return `.${cls} { align-items: flex-start; }`;
|
|
2729
2783
|
if (cls === "items-end") return `.${cls} { align-items: flex-end; }`;
|
|
2730
2784
|
if (cls === "items-center") return `.${cls} { align-items: center; }`;
|
|
@@ -2901,7 +2955,7 @@ function matchLayout(cls) {
|
|
|
2901
2955
|
}
|
|
2902
2956
|
|
|
2903
2957
|
// src/generator/sizing.ts
|
|
2904
|
-
function
|
|
2958
|
+
function has3(obj, key) {
|
|
2905
2959
|
return typeof obj[key] === "string";
|
|
2906
2960
|
}
|
|
2907
2961
|
function generateSizing(classes, config) {
|
|
@@ -2952,8 +3006,8 @@ function matchSizing(cls, spacing) {
|
|
|
2952
3006
|
if (key === "min") return `.${cls} { width: min-content; }`;
|
|
2953
3007
|
if (key === "max") return `.${cls} { width: max-content; }`;
|
|
2954
3008
|
if (key === "fit") return `.${cls} { width: fit-content; }`;
|
|
2955
|
-
if (
|
|
2956
|
-
if (
|
|
3009
|
+
if (has3(fractions, key)) return `.${cls} { width: ${fractions[key]}; }`;
|
|
3010
|
+
if (has3(spacing, key)) return `.${cls} { width: ${spacing[key]}; }`;
|
|
2957
3011
|
}
|
|
2958
3012
|
const minWMatch = cls.match(/^min-w-(.+)$/);
|
|
2959
3013
|
if (minWMatch) {
|
|
@@ -2963,7 +3017,7 @@ function matchSizing(cls, spacing) {
|
|
|
2963
3017
|
if (key === "min") return `.${cls} { min-width: min-content; }`;
|
|
2964
3018
|
if (key === "max") return `.${cls} { min-width: max-content; }`;
|
|
2965
3019
|
if (key === "fit") return `.${cls} { min-width: fit-content; }`;
|
|
2966
|
-
if (
|
|
3020
|
+
if (has3(spacing, key)) return `.${cls} { min-width: ${spacing[key]}; }`;
|
|
2967
3021
|
}
|
|
2968
3022
|
const maxWMap = {
|
|
2969
3023
|
none: "none",
|
|
@@ -2990,7 +3044,7 @@ function matchSizing(cls, spacing) {
|
|
|
2990
3044
|
"screen-2xl": "1536px"
|
|
2991
3045
|
};
|
|
2992
3046
|
const maxWMatch = cls.match(/^max-w-(.+)$/);
|
|
2993
|
-
if (maxWMatch &&
|
|
3047
|
+
if (maxWMatch && has3(maxWMap, maxWMatch[1])) {
|
|
2994
3048
|
return `.${cls} { max-width: ${maxWMap[maxWMatch[1]]}; }`;
|
|
2995
3049
|
}
|
|
2996
3050
|
const hMatch = cls.match(/^h-(.+)$/);
|
|
@@ -3004,8 +3058,8 @@ function matchSizing(cls, spacing) {
|
|
|
3004
3058
|
if (key === "min") return `.${cls} { height: min-content; }`;
|
|
3005
3059
|
if (key === "max") return `.${cls} { height: max-content; }`;
|
|
3006
3060
|
if (key === "fit") return `.${cls} { height: fit-content; }`;
|
|
3007
|
-
if (
|
|
3008
|
-
if (
|
|
3061
|
+
if (has3(fractions, key)) return `.${cls} { height: ${fractions[key]}; }`;
|
|
3062
|
+
if (has3(spacing, key)) return `.${cls} { height: ${spacing[key]}; }`;
|
|
3009
3063
|
}
|
|
3010
3064
|
const minHMatch = cls.match(/^min-h-(.+)$/);
|
|
3011
3065
|
if (minHMatch) {
|
|
@@ -3016,7 +3070,7 @@ function matchSizing(cls, spacing) {
|
|
|
3016
3070
|
if (key === "svh") return `.${cls} { min-height: 100svh; }`;
|
|
3017
3071
|
if (key === "dvh") return `.${cls} { min-height: 100dvh; }`;
|
|
3018
3072
|
if (key === "fit") return `.${cls} { min-height: fit-content; }`;
|
|
3019
|
-
if (
|
|
3073
|
+
if (has3(spacing, key)) return `.${cls} { min-height: ${spacing[key]}; }`;
|
|
3020
3074
|
}
|
|
3021
3075
|
const maxHMatch = cls.match(/^max-h-(.+)$/);
|
|
3022
3076
|
if (maxHMatch) {
|
|
@@ -3027,13 +3081,22 @@ function matchSizing(cls, spacing) {
|
|
|
3027
3081
|
if (key === "svh") return `.${cls} { max-height: 100svh; }`;
|
|
3028
3082
|
if (key === "dvh") return `.${cls} { max-height: 100dvh; }`;
|
|
3029
3083
|
if (key === "fit") return `.${cls} { max-height: fit-content; }`;
|
|
3030
|
-
if (
|
|
3084
|
+
if (has3(spacing, key)) return `.${cls} { max-height: ${spacing[key]}; }`;
|
|
3085
|
+
}
|
|
3086
|
+
const basisMatch = cls.match(/^basis-(.+)$/);
|
|
3087
|
+
if (basisMatch) {
|
|
3088
|
+
const key = basisMatch[1];
|
|
3089
|
+
if (key === "auto") return `.${cls} { flex-basis: auto; }`;
|
|
3090
|
+
if (key === "full") return `.${cls} { flex-basis: 100%; }`;
|
|
3091
|
+
if (key === "0") return `.${cls} { flex-basis: 0px; }`;
|
|
3092
|
+
if (has3(fractions, key)) return `.${cls} { flex-basis: ${fractions[key]}; }`;
|
|
3093
|
+
if (has3(spacing, key)) return `.${cls} { flex-basis: ${spacing[key]}; }`;
|
|
3031
3094
|
}
|
|
3032
3095
|
return null;
|
|
3033
3096
|
}
|
|
3034
3097
|
|
|
3035
3098
|
// src/generator/effects.ts
|
|
3036
|
-
function
|
|
3099
|
+
function has4(obj, key) {
|
|
3037
3100
|
return typeof obj[key] === "string";
|
|
3038
3101
|
}
|
|
3039
3102
|
function generateEffects(classes, config) {
|
|
@@ -3047,7 +3110,7 @@ function generateEffects(classes, config) {
|
|
|
3047
3110
|
}
|
|
3048
3111
|
function matchEffects(cls, opacity, zIndex, boxShadow, borderRadius) {
|
|
3049
3112
|
const opacityMatch = cls.match(/^opacity-(.+)$/);
|
|
3050
|
-
if (opacityMatch &&
|
|
3113
|
+
if (opacityMatch && has4(opacity, opacityMatch[1])) {
|
|
3051
3114
|
return `.${cls} {
|
|
3052
3115
|
opacity: ${opacity[opacityMatch[1]]};
|
|
3053
3116
|
transition-property: opacity;
|
|
@@ -3056,47 +3119,47 @@ function matchEffects(cls, opacity, zIndex, boxShadow, borderRadius) {
|
|
|
3056
3119
|
}`;
|
|
3057
3120
|
}
|
|
3058
3121
|
const zMatch = cls.match(/^z-(.+)$/);
|
|
3059
|
-
if (zMatch &&
|
|
3122
|
+
if (zMatch && has4(zIndex, zMatch[1])) {
|
|
3060
3123
|
return `.${cls} { z-index: ${zIndex[zMatch[1]]}; }`;
|
|
3061
3124
|
}
|
|
3062
3125
|
const shadowMatch = cls.match(/^shadow(?:-(.+))?$/);
|
|
3063
3126
|
if (shadowMatch) {
|
|
3064
3127
|
const key = shadowMatch[1] ?? "DEFAULT";
|
|
3065
|
-
if (
|
|
3128
|
+
if (has4(boxShadow, key)) {
|
|
3066
3129
|
return `.${cls} { box-shadow: ${boxShadow[key]}; }`;
|
|
3067
3130
|
}
|
|
3068
|
-
if (!shadowMatch[1] &&
|
|
3131
|
+
if (!shadowMatch[1] && has4(boxShadow, "DEFAULT")) {
|
|
3069
3132
|
return `.${cls} { box-shadow: ${boxShadow["DEFAULT"]}; }`;
|
|
3070
3133
|
}
|
|
3071
3134
|
}
|
|
3072
3135
|
const roundedMatch = cls.match(/^rounded(?:-(.+))?$/);
|
|
3073
3136
|
if (roundedMatch) {
|
|
3074
3137
|
const key = roundedMatch[1] ?? "DEFAULT";
|
|
3075
|
-
if (
|
|
3076
|
-
if (!roundedMatch[1] &&
|
|
3138
|
+
if (has4(borderRadius, key)) return `.${cls} { border-radius: ${borderRadius[key]}; }`;
|
|
3139
|
+
if (!roundedMatch[1] && has4(borderRadius, "DEFAULT")) return `.${cls} { border-radius: ${borderRadius["DEFAULT"]}; }`;
|
|
3077
3140
|
}
|
|
3078
3141
|
const roundedTMatch = cls.match(/^rounded-t(?:-(.+))?$/);
|
|
3079
3142
|
if (roundedTMatch) {
|
|
3080
3143
|
const rkey = roundedTMatch[1] ?? "DEFAULT";
|
|
3081
|
-
const val =
|
|
3144
|
+
const val = has4(borderRadius, rkey) ? borderRadius[rkey] : has4(borderRadius, "DEFAULT") ? borderRadius["DEFAULT"] : null;
|
|
3082
3145
|
if (val) return `.${cls} { border-top-left-radius: ${val}; border-top-right-radius: ${val}; }`;
|
|
3083
3146
|
}
|
|
3084
3147
|
const roundedBMatch = cls.match(/^rounded-b(?:-(.+))?$/);
|
|
3085
3148
|
if (roundedBMatch) {
|
|
3086
3149
|
const rkey = roundedBMatch[1] ?? "DEFAULT";
|
|
3087
|
-
const val =
|
|
3150
|
+
const val = has4(borderRadius, rkey) ? borderRadius[rkey] : has4(borderRadius, "DEFAULT") ? borderRadius["DEFAULT"] : null;
|
|
3088
3151
|
if (val) return `.${cls} { border-bottom-left-radius: ${val}; border-bottom-right-radius: ${val}; }`;
|
|
3089
3152
|
}
|
|
3090
3153
|
const roundedLMatch = cls.match(/^rounded-l(?:-(.+))?$/);
|
|
3091
3154
|
if (roundedLMatch) {
|
|
3092
3155
|
const rkey = roundedLMatch[1] ?? "DEFAULT";
|
|
3093
|
-
const val =
|
|
3156
|
+
const val = has4(borderRadius, rkey) ? borderRadius[rkey] : has4(borderRadius, "DEFAULT") ? borderRadius["DEFAULT"] : null;
|
|
3094
3157
|
if (val) return `.${cls} { border-top-left-radius: ${val}; border-bottom-left-radius: ${val}; }`;
|
|
3095
3158
|
}
|
|
3096
3159
|
const roundedRMatch = cls.match(/^rounded-r(?:-(.+))?$/);
|
|
3097
3160
|
if (roundedRMatch) {
|
|
3098
3161
|
const rkey = roundedRMatch[1] ?? "DEFAULT";
|
|
3099
|
-
const val =
|
|
3162
|
+
const val = has4(borderRadius, rkey) ? borderRadius[rkey] : has4(borderRadius, "DEFAULT") ? borderRadius["DEFAULT"] : null;
|
|
3100
3163
|
if (val) return `.${cls} { border-top-right-radius: ${val}; border-bottom-right-radius: ${val}; }`;
|
|
3101
3164
|
}
|
|
3102
3165
|
if (cls === "border") return `.${cls} { border-width: 1px; border-style: solid; }`;
|
|
@@ -3150,15 +3213,15 @@ function matchEffects(cls, opacity, zIndex, boxShadow, borderRadius) {
|
|
|
3150
3213
|
"150": "1.5"
|
|
3151
3214
|
};
|
|
3152
3215
|
const scaleMatch = cls.match(/^scale-(\d+)$/);
|
|
3153
|
-
if (scaleMatch &&
|
|
3216
|
+
if (scaleMatch && has4(scaleMap, scaleMatch[1])) {
|
|
3154
3217
|
return `.${cls} { transform: scale(${scaleMap[scaleMatch[1]]}); }`;
|
|
3155
3218
|
}
|
|
3156
3219
|
const scaleXMatch = cls.match(/^scale-x-(\d+)$/);
|
|
3157
|
-
if (scaleXMatch &&
|
|
3220
|
+
if (scaleXMatch && has4(scaleMap, scaleXMatch[1])) {
|
|
3158
3221
|
return `.${cls} { transform: scaleX(${scaleMap[scaleXMatch[1]]}); }`;
|
|
3159
3222
|
}
|
|
3160
3223
|
const scaleYMatch = cls.match(/^scale-y-(\d+)$/);
|
|
3161
|
-
if (scaleYMatch &&
|
|
3224
|
+
if (scaleYMatch && has4(scaleMap, scaleYMatch[1])) {
|
|
3162
3225
|
return `.${cls} { transform: scaleY(${scaleMap[scaleYMatch[1]]}); }`;
|
|
3163
3226
|
}
|
|
3164
3227
|
const rotateMatch = cls.match(/^-?rotate-(\d+)$/);
|
|
@@ -3201,7 +3264,7 @@ function matchEffects(cls, opacity, zIndex, boxShadow, borderRadius) {
|
|
|
3201
3264
|
"3xl": "64px"
|
|
3202
3265
|
};
|
|
3203
3266
|
const key = blurMatch[1] ?? "DEFAULT";
|
|
3204
|
-
if (
|
|
3267
|
+
if (has4(blurMap, key)) return `.${cls} { filter: blur(${blurMap[key]}); }`;
|
|
3205
3268
|
}
|
|
3206
3269
|
const backdropBlurMatch = cls.match(/^backdrop-blur(?:-(.+))?$/);
|
|
3207
3270
|
if (backdropBlurMatch) {
|
|
@@ -3216,7 +3279,7 @@ function matchEffects(cls, opacity, zIndex, boxShadow, borderRadius) {
|
|
|
3216
3279
|
"3xl": "64px"
|
|
3217
3280
|
};
|
|
3218
3281
|
const key = backdropBlurMatch[1] ?? "DEFAULT";
|
|
3219
|
-
if (
|
|
3282
|
+
if (has4(blurMap, key)) return `.${cls} { backdrop-filter: blur(${blurMap[key]}); }`;
|
|
3220
3283
|
}
|
|
3221
3284
|
const arbOpacityMatch = cls.match(/^opacity-\[(.+)\]$/);
|
|
3222
3285
|
if (arbOpacityMatch) {
|
|
@@ -3721,14 +3784,23 @@ var aliveui = (userConfig = {}) => {
|
|
|
3721
3784
|
postcssPlugin: "aliveui",
|
|
3722
3785
|
async Once(root, { result, postcss }) {
|
|
3723
3786
|
const classes = await scanContent(config);
|
|
3787
|
+
const hasAliveDirective = root.some((node) => node.type === "atrule" && node.name === "aliveui");
|
|
3788
|
+
if (hasAliveDirective) {
|
|
3789
|
+
const layerDecl = postcss.atRule({ name: "layer", params: "aliveui.base, aliveui.utilities" });
|
|
3790
|
+
root.prepend(layerDecl);
|
|
3791
|
+
}
|
|
3724
3792
|
root.walkAtRules("aliveui", (atRule) => {
|
|
3725
3793
|
const param = atRule.params.trim();
|
|
3726
3794
|
if (param === "base") {
|
|
3727
|
-
const css =
|
|
3795
|
+
const css = `@layer aliveui.base {
|
|
3796
|
+
${generateBase(config)}
|
|
3797
|
+
}`;
|
|
3728
3798
|
const parsed = postcss.parse(css, { from: atRule.source?.input.file });
|
|
3729
3799
|
atRule.replaceWith(parsed.nodes);
|
|
3730
3800
|
} else if (param === "utilities") {
|
|
3731
|
-
const css =
|
|
3801
|
+
const css = `@layer aliveui.utilities {
|
|
3802
|
+
${generateUtilities(classes, config)}
|
|
3803
|
+
}`;
|
|
3732
3804
|
const parsed = postcss.parse(css, { from: atRule.source?.input.file });
|
|
3733
3805
|
atRule.replaceWith(parsed.nodes);
|
|
3734
3806
|
} else {
|