aliascss 1.4.4 → 1.4.7
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/aliascss.config.js +32 -32
- package/dist/aliascss.js +1 -1
- package/lib/compilers/color.js +5 -5
- package/lib/compilers/gradient.js +3 -3
- package/lib/compilers/stringAndContent.js +2 -1
- package/lib/component-elements.d.ts +155 -0
- package/lib/component-elements.js +223 -0
- package/lib/config.d.ts +1 -0
- package/lib/config.js +2 -1
- package/lib/css-properties-all.js +337 -202
- package/lib/custom-css-compilers.js +54 -54
- package/lib/extras-elements.d.ts +87 -0
- package/lib/extras-elements.js +184 -0
- package/lib/form-elements.d.ts +75 -0
- package/lib/form-elements.js +186 -0
- package/lib/layout-elements.d.ts +59 -0
- package/lib/layout-elements.js +113 -0
- package/lib/nav-elements.d.ts +71 -0
- package/lib/nav-elements.js +243 -0
- package/lib/node/compileFile-bk.d.ts +27 -0
- package/lib/node/compileFile-bk.js +379 -0
- package/lib/node/compileFile.d.ts +11 -11
- package/lib/node/compileFile.js +170 -235
- package/lib/prebuild.d.ts +520 -12
- package/lib/prebuild.js +9 -852
- package/lib/prefix/PseudoPrefixNew.js +301 -16
- package/lib/prefix/attribute-selector.js +4 -2
- package/lib/prefix/pseudoSelectorNew.js +184 -49
- package/lib/prefix/responsive.d.ts +13 -9
- package/lib/prefix/responsive.js +131 -9
- package/lib/returnPropertyAndValue.js +9 -4
- package/lib/returnStatement-bk.d.ts +5 -0
- package/lib/returnStatement-bk.js +311 -0
- package/lib/returnStatement.js +165 -2
- package/lib/static/customStaticClassNames.js +35 -35
- package/lib/static/staticClassNamesAlias.js +18 -16
- package/lib/table-elements.d.ts +39 -0
- package/lib/table-elements.js +90 -0
- package/lib/utils/helper.d.ts +6 -0
- package/lib/utils/helper.js +52 -0
- package/lib/x-classes/x-bundle.d.ts +563 -0
- package/lib/x-classes/x-bundle.js +11 -0
- package/lib/x-classes/x-comps.d.ts +87 -0
- package/lib/x-classes/x-comps.js +189 -0
- package/lib/x-classes/x-extras.d.ts +155 -0
- package/lib/x-classes/x-extras.js +223 -0
- package/lib/x-classes/x-form-components.d.ts +75 -0
- package/lib/x-classes/x-form-components.js +186 -0
- package/lib/x-classes/x-helper-components.d.ts +63 -0
- package/lib/x-classes/x-helper-components.js +91 -0
- package/lib/x-classes/x-layout-components.d.ts +59 -0
- package/lib/x-classes/x-layout-components.js +113 -0
- package/lib/x-classes/x-menu.d.ts +23 -0
- package/lib/x-classes/x-menu.js +55 -0
- package/lib/x-classes/x-navs.d.ts +71 -0
- package/lib/x-classes/x-navs.js +243 -0
- package/lib/x-classes/x-table.d.ts +39 -0
- package/lib/x-classes/x-table.js +90 -0
- package/lib/x-classes/x-theme.d.ts +15 -0
- package/lib/x-classes/x-theme.js +32 -0
- package/lib/x-imports.d.ts +31 -0
- package/lib/x-imports.js +748 -0
- package/package.json +1 -1
package/lib/compilers/color.js
CHANGED
|
@@ -36,15 +36,15 @@ export default function color(color, custom) {
|
|
|
36
36
|
// custom-color try replacing -
|
|
37
37
|
if (custom.colors.hasOwnProperty(color.replace(/-/g, ''))) {
|
|
38
38
|
if (alpha !== null)
|
|
39
|
-
return `oklch(from ${color.replace(/-/g, '')} l c h/${alpha} )`;
|
|
39
|
+
return `oklch(from ${custom.colors[color.replace(/-/g, '')]} l c h/${alpha} )`;
|
|
40
40
|
return custom.colors[color.replace(/-/g, '')];
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
// hexadecimal =+ alpha 00-ff
|
|
44
|
-
if (/^[0-9a-fA-F]{3,8}$/.test(color)) {
|
|
44
|
+
if (/^[#]?[0-9a-fA-F]{3,8}$/.test(color)) {
|
|
45
45
|
if (alpha !== null)
|
|
46
|
-
return `oklch(from #${color} l c h/${alpha} )`;
|
|
47
|
-
return `#${color}`;
|
|
46
|
+
return `oklch(from #${color.replace("#", '')} l c h/${alpha} )`;
|
|
47
|
+
return `#${color.replace("#", '')}`;
|
|
48
48
|
// Name
|
|
49
49
|
}
|
|
50
50
|
else if (/^[a-zA-Z]+$/.test(color)) {
|
|
@@ -94,7 +94,7 @@ export default function color(color, custom) {
|
|
|
94
94
|
}
|
|
95
95
|
else if (/^p3-/.test(color)) {
|
|
96
96
|
if (color.replace(/p3/, '').match(/^--/))
|
|
97
|
-
return `color(display-p3
|
|
97
|
+
return `color(display-p3 var(${color.replace(/p3/, '')})`;
|
|
98
98
|
return replaceLast(`color(display-p3 ${color.replace(/p3/, '').replace(/^-/, '').replace(/-/g, ' ').replace('d', '.')
|
|
99
99
|
.replace(/([0-9])p/g, '$1%')})`, 4, " ", " / ");
|
|
100
100
|
}
|
|
@@ -94,11 +94,11 @@ const alias = {
|
|
|
94
94
|
l: 'left',
|
|
95
95
|
left: 'left',
|
|
96
96
|
'top-left': 'top left',
|
|
97
|
-
'top-right': 'top
|
|
97
|
+
'top-right': 'top right',
|
|
98
98
|
'bottom-right': 'bottom right',
|
|
99
99
|
'bottom-left': 'bottom left',
|
|
100
100
|
'left-top': 'left top',
|
|
101
|
-
'right-top': '
|
|
101
|
+
'right-top': 'right top',
|
|
102
102
|
'right-bottom': 'right bottom',
|
|
103
103
|
'left-bottom': 'left bottom',
|
|
104
104
|
tl: 'top left',
|
|
@@ -106,7 +106,7 @@ const alias = {
|
|
|
106
106
|
br: 'bottom right',
|
|
107
107
|
bl: 'bottom left',
|
|
108
108
|
lt: 'left top',
|
|
109
|
-
rt: '
|
|
109
|
+
rt: 'right top',
|
|
110
110
|
rb: 'right bottom',
|
|
111
111
|
lb: 'left bottom',
|
|
112
112
|
tor: 'to right',
|
|
@@ -5,7 +5,8 @@ export function string(str, custom) {
|
|
|
5
5
|
export default function content(str) {
|
|
6
6
|
// for CSS entities
|
|
7
7
|
if (str.match(/^_/)) {
|
|
8
|
-
return "'
|
|
8
|
+
// return '"' + str.split("_").join(" \\").trim() + '"';
|
|
9
|
+
return '"' + str.slice(1).split('_').map(c => '\\' + c).join('') + '"';
|
|
9
10
|
}
|
|
10
11
|
str = str.replace(/^[-]/, '');
|
|
11
12
|
// attr() or counter()
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
declare const components: {
|
|
2
|
+
'x-card': {
|
|
3
|
+
type: string;
|
|
4
|
+
statement: string;
|
|
5
|
+
};
|
|
6
|
+
'x-card-header': {
|
|
7
|
+
type: string;
|
|
8
|
+
statement: string;
|
|
9
|
+
};
|
|
10
|
+
'x-card-body': {
|
|
11
|
+
type: string;
|
|
12
|
+
statement: string;
|
|
13
|
+
};
|
|
14
|
+
'x-card-footer': {
|
|
15
|
+
type: string;
|
|
16
|
+
statement: string;
|
|
17
|
+
};
|
|
18
|
+
'x-card-media': {
|
|
19
|
+
type: string;
|
|
20
|
+
statement: string;
|
|
21
|
+
};
|
|
22
|
+
'x-card-title': {
|
|
23
|
+
type: string;
|
|
24
|
+
statement: string;
|
|
25
|
+
};
|
|
26
|
+
'x-card-description': {
|
|
27
|
+
type: string;
|
|
28
|
+
statement: string;
|
|
29
|
+
};
|
|
30
|
+
'x-card-elevated': {
|
|
31
|
+
type: string;
|
|
32
|
+
statement: string;
|
|
33
|
+
};
|
|
34
|
+
'x-card-flat': {
|
|
35
|
+
type: string;
|
|
36
|
+
statement: string;
|
|
37
|
+
};
|
|
38
|
+
'x-card-interactive': {
|
|
39
|
+
type: string;
|
|
40
|
+
statement: string;
|
|
41
|
+
};
|
|
42
|
+
'x-badge': {
|
|
43
|
+
type: string;
|
|
44
|
+
statement: string;
|
|
45
|
+
};
|
|
46
|
+
'x-badge-primary': {
|
|
47
|
+
type: string;
|
|
48
|
+
statement: string;
|
|
49
|
+
};
|
|
50
|
+
'x-badge-success': {
|
|
51
|
+
type: string;
|
|
52
|
+
statement: string;
|
|
53
|
+
};
|
|
54
|
+
'x-badge-warning': {
|
|
55
|
+
type: string;
|
|
56
|
+
statement: string;
|
|
57
|
+
};
|
|
58
|
+
'x-badge-error': {
|
|
59
|
+
type: string;
|
|
60
|
+
statement: string;
|
|
61
|
+
};
|
|
62
|
+
'x-badge-info': {
|
|
63
|
+
type: string;
|
|
64
|
+
statement: string;
|
|
65
|
+
};
|
|
66
|
+
'x-badge-dot': {
|
|
67
|
+
type: string;
|
|
68
|
+
statement: string;
|
|
69
|
+
};
|
|
70
|
+
'x-badge-sm': {
|
|
71
|
+
type: string;
|
|
72
|
+
statement: string;
|
|
73
|
+
};
|
|
74
|
+
'x-badge-lg': {
|
|
75
|
+
type: string;
|
|
76
|
+
statement: string;
|
|
77
|
+
};
|
|
78
|
+
'x-badge-square': {
|
|
79
|
+
type: string;
|
|
80
|
+
statement: string;
|
|
81
|
+
};
|
|
82
|
+
'x-alert': {
|
|
83
|
+
type: string;
|
|
84
|
+
statement: string;
|
|
85
|
+
};
|
|
86
|
+
'x-alert-title': {
|
|
87
|
+
type: string;
|
|
88
|
+
statement: string;
|
|
89
|
+
};
|
|
90
|
+
'x-alert-info': {
|
|
91
|
+
type: string;
|
|
92
|
+
statement: string;
|
|
93
|
+
};
|
|
94
|
+
'x-alert-success': {
|
|
95
|
+
type: string;
|
|
96
|
+
statement: string;
|
|
97
|
+
};
|
|
98
|
+
'x-alert-warning': {
|
|
99
|
+
type: string;
|
|
100
|
+
statement: string;
|
|
101
|
+
};
|
|
102
|
+
'x-alert-error': {
|
|
103
|
+
type: string;
|
|
104
|
+
statement: string;
|
|
105
|
+
};
|
|
106
|
+
'x-alert-accent': {
|
|
107
|
+
type: string;
|
|
108
|
+
statement: string;
|
|
109
|
+
};
|
|
110
|
+
'x-dialog': {
|
|
111
|
+
type: string;
|
|
112
|
+
statement: string;
|
|
113
|
+
};
|
|
114
|
+
'x-dialog-header': {
|
|
115
|
+
type: string;
|
|
116
|
+
statement: string;
|
|
117
|
+
};
|
|
118
|
+
'x-dialog-title': {
|
|
119
|
+
type: string;
|
|
120
|
+
statement: string;
|
|
121
|
+
};
|
|
122
|
+
'x-dialog-body': {
|
|
123
|
+
type: string;
|
|
124
|
+
statement: string;
|
|
125
|
+
};
|
|
126
|
+
'x-dialog-footer': {
|
|
127
|
+
type: string;
|
|
128
|
+
statement: string;
|
|
129
|
+
};
|
|
130
|
+
'x-dialog-sm': {
|
|
131
|
+
type: string;
|
|
132
|
+
statement: string;
|
|
133
|
+
};
|
|
134
|
+
'x-dialog-lg': {
|
|
135
|
+
type: string;
|
|
136
|
+
statement: string;
|
|
137
|
+
};
|
|
138
|
+
'x-dialog-sheet': {
|
|
139
|
+
type: string;
|
|
140
|
+
statement: string;
|
|
141
|
+
};
|
|
142
|
+
'x-accordion-group': {
|
|
143
|
+
type: string;
|
|
144
|
+
statement: string;
|
|
145
|
+
};
|
|
146
|
+
'x-accordion': {
|
|
147
|
+
type: string;
|
|
148
|
+
statement: string;
|
|
149
|
+
};
|
|
150
|
+
'x-accordion-content': {
|
|
151
|
+
type: string;
|
|
152
|
+
statement: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
export default components;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// AliasCSS components: card, badge, alert, dialog, accordion
|
|
2
|
+
// ------------------------------------------------------------------
|
|
3
|
+
// Same conventions as the form and table components:
|
|
4
|
+
// - styles live in @components, so plain utilities always override them
|
|
5
|
+
// - everything is themeable through --x-* variables with token fallbacks
|
|
6
|
+
// - variants mostly just set variables, so they combine freely
|
|
7
|
+
// ------------------------------------------------------------------
|
|
8
|
+
const components = {
|
|
9
|
+
// ================================================================
|
|
10
|
+
// CARD
|
|
11
|
+
// <article class="x-card">
|
|
12
|
+
// <img class="x-card-media" src="…" alt="">
|
|
13
|
+
// <header class="x-card-header">
|
|
14
|
+
// <div><h3 class="x-card-title">Title</h3><p class="x-card-description">Subtitle</p></div>
|
|
15
|
+
// </header>
|
|
16
|
+
// <div class="x-card-body">…</div>
|
|
17
|
+
// <footer class="x-card-footer">…buttons…</footer>
|
|
18
|
+
// </article>
|
|
19
|
+
// Variants: x-card-elevated, x-card-flat, x-card-interactive
|
|
20
|
+
// Vars: --x-card-bg, --x-card-color, --x-card-border-color, --x-card-divider-color,
|
|
21
|
+
// --x-card-radius, --x-card-padding (as (20px) or (16px_20px)), --x-card-shadow
|
|
22
|
+
// ================================================================
|
|
23
|
+
'x-card': {
|
|
24
|
+
type: 'statement',
|
|
25
|
+
statement: `
|
|
26
|
+
@components[d-flex,flex-direction-column,box-sizing-border-box,overflow-hidden,bgc--x-card-bg:white,c--x-card-color:gray900,border-width-1px,border-style-solid,border-color--x-card-border-color:gray200,br--x-card-radius:12px,box-shadow(var(--x-card-shadow,none))]
|
|
27
|
+
`
|
|
28
|
+
},
|
|
29
|
+
'x-card-header': {
|
|
30
|
+
type: 'statement',
|
|
31
|
+
statement: `@components[d-flex,aifs,jcsb,g-12px,padding(var(--x-card-padding,20px)),border-bottom-width-1px,border-bottom-style-solid,border-bottom-color--x-card-divider-color:gray200]`
|
|
32
|
+
},
|
|
33
|
+
'x-card-body': {
|
|
34
|
+
type: 'statement',
|
|
35
|
+
statement: `@components[padding(var(--x-card-padding,20px)),flex-grow-1]`
|
|
36
|
+
},
|
|
37
|
+
'x-card-footer': {
|
|
38
|
+
type: 'statement',
|
|
39
|
+
statement: `@components[d-flex,aic,jc-flex-end,g-8px,padding(var(--x-card-padding,20px)),border-top-width-1px,border-top-style-solid,border-top-color--x-card-divider-color:gray200]`
|
|
40
|
+
},
|
|
41
|
+
'x-card-media': {
|
|
42
|
+
type: 'statement',
|
|
43
|
+
statement: `@components[d-block,w-100%,object-fit-cover,aspect-ratio--x-card-media-ratio:16/9]`
|
|
44
|
+
},
|
|
45
|
+
'x-card-title': {
|
|
46
|
+
type: 'statement',
|
|
47
|
+
statement: `@components[m-0,fs-16px,fw-600,lh-24px]`
|
|
48
|
+
},
|
|
49
|
+
'x-card-description': {
|
|
50
|
+
type: 'statement',
|
|
51
|
+
statement: `@components[m-0,fs-14px,lh-20px,c--x-card-muted-color:gray500]`
|
|
52
|
+
},
|
|
53
|
+
'x-card-elevated': {
|
|
54
|
+
type: 'statement',
|
|
55
|
+
statement: `--x-card-border-color:transparent --x-card-shadow:(0_1px_3px_rgb(16_24_40_/_0.1),0_1px_2px_rgb(16_24_40_/_0.06))`
|
|
56
|
+
},
|
|
57
|
+
'x-card-flat': {
|
|
58
|
+
type: 'statement',
|
|
59
|
+
statement: `--x-card-border-color:transparent --x-card-bg:gray50`
|
|
60
|
+
},
|
|
61
|
+
// Whole card is clickable (e.g. contains a stretched link)
|
|
62
|
+
'x-card-interactive': {
|
|
63
|
+
type: 'statement',
|
|
64
|
+
statement: `
|
|
65
|
+
@components[cursor-pointer,transition-property-transform__box-shadow__border-color,transition-duration-0.2s]
|
|
66
|
+
@components--hover[tf-translateY--2px,border-color--x-card-hover-border-color:gray300,box-shadow(0_12px_24px_-6px_rgb(16_24_40_/_0.12))]
|
|
67
|
+
@components--focus-within[outline-style-solid,outline-width-2px,outline-color--x-form-accent-color:primary600,outline-offset-2px]
|
|
68
|
+
@motion-reduce--hover-tf-none
|
|
69
|
+
`
|
|
70
|
+
},
|
|
71
|
+
// ================================================================
|
|
72
|
+
// BADGE
|
|
73
|
+
// <span class="x-badge x-badge-success x-badge-dot">Active</span>
|
|
74
|
+
// Colors: x-badge-primary, -success, -warning, -error, -info (default is neutral gray)
|
|
75
|
+
// Options: x-badge-dot (status dot), x-badge-sm, x-badge-lg, x-badge-square
|
|
76
|
+
// Vars: --x-badge-bg, --x-badge-color, --x-badge-border-color, --x-badge-height, --x-badge-radius
|
|
77
|
+
// ================================================================
|
|
78
|
+
'x-badge': {
|
|
79
|
+
type: 'statement',
|
|
80
|
+
statement: `@components[d-inline-flex,aic,g-6px,h--x-badge-height:22px,padding-inline--x-badge-padding:8px,box-sizing-border-box,br--x-badge-radius:999px,fs--x-badge-font-size:12px,fw-500,lh-1,white-space-nowrap,vertical-align-middle,bgc--x-badge-bg:gray100,c--x-badge-color:gray700,border-width-1px,border-style-solid,border-color--x-badge-border-color:gray200]`
|
|
81
|
+
},
|
|
82
|
+
'x-badge-primary': { type: 'statement', statement: `--x-badge-bg:primary50 --x-badge-color:primary700 --x-badge-border-color:primary200` },
|
|
83
|
+
'x-badge-success': { type: 'statement', statement: `--x-badge-bg:success50 --x-badge-color:success700 --x-badge-border-color:success200` },
|
|
84
|
+
'x-badge-warning': { type: 'statement', statement: `--x-badge-bg:warning50 --x-badge-color:warning700 --x-badge-border-color:warning200` },
|
|
85
|
+
'x-badge-error': { type: 'statement', statement: `--x-badge-bg:error50 --x-badge-color:error700 --x-badge-border-color:error200` },
|
|
86
|
+
'x-badge-info': { type: 'statement', statement: `--x-badge-bg:blue50 --x-badge-color:blue700 --x-badge-border-color:blue200` },
|
|
87
|
+
'x-badge-dot': {
|
|
88
|
+
type: 'statement',
|
|
89
|
+
statement: `@components--before[cont,flex-shrink-0,w-6px,h-6px,br-50%,bgc-currentColor]`
|
|
90
|
+
},
|
|
91
|
+
'x-badge-sm': { type: 'statement', statement: `--x-badge-height:18px --x-badge-padding:6px --x-badge-font-size:11px` },
|
|
92
|
+
'x-badge-lg': { type: 'statement', statement: `--x-badge-height:26px --x-badge-padding:10px --x-badge-font-size:14px` },
|
|
93
|
+
'x-badge-square': { type: 'statement', statement: `--x-badge-radius:6px` },
|
|
94
|
+
// ================================================================
|
|
95
|
+
// ALERT
|
|
96
|
+
// <div class="x-alert x-alert-warning" role="alert">
|
|
97
|
+
// <svg …></svg> (optional icon)
|
|
98
|
+
// <div>
|
|
99
|
+
// <p class="x-alert-title">Heads up</p>
|
|
100
|
+
// <p>Message text.</p>
|
|
101
|
+
// </div>
|
|
102
|
+
// </div>
|
|
103
|
+
// Colors: x-alert-info, -success, -warning, -error (default is neutral)
|
|
104
|
+
// Options: x-alert-accent (thick left border)
|
|
105
|
+
// Vars: --x-alert-bg, --x-alert-color, --x-alert-border-color, --x-alert-icon-color, --x-alert-radius
|
|
106
|
+
// ================================================================
|
|
107
|
+
'x-alert': {
|
|
108
|
+
type: 'statement',
|
|
109
|
+
statement: `
|
|
110
|
+
@components[d-flex,aifs,g-12px,p-14px-16px,box-sizing-border-box,br--x-alert-radius:10px,fs-14px,lh-20px,bgc--x-alert-bg:gray50,c--x-alert-color:gray700,border-width-1px,border-style-solid,border-color--x-alert-border-color:gray200]
|
|
111
|
+
@components_svg[flex-shrink-0,w-20px,h-20px,c--x-alert-icon-color:gray500]
|
|
112
|
+
@components_p-m-0
|
|
113
|
+
`
|
|
114
|
+
},
|
|
115
|
+
'x-alert-title': {
|
|
116
|
+
type: 'statement',
|
|
117
|
+
statement: `@components[fw-600,margin-bottom-2px]`
|
|
118
|
+
},
|
|
119
|
+
'x-alert-info': { type: 'statement', statement: `--x-alert-bg:blue50 --x-alert-color:blue800 --x-alert-border-color:blue200 --x-alert-icon-color:blue600` },
|
|
120
|
+
'x-alert-success': { type: 'statement', statement: `--x-alert-bg:success50 --x-alert-color:success800 --x-alert-border-color:success200 --x-alert-icon-color:success600` },
|
|
121
|
+
'x-alert-warning': { type: 'statement', statement: `--x-alert-bg:warning50 --x-alert-color:warning800 --x-alert-border-color:warning200 --x-alert-icon-color:warning600` },
|
|
122
|
+
'x-alert-error': { type: 'statement', statement: `--x-alert-bg:error50 --x-alert-color:error800 --x-alert-border-color:error200 --x-alert-icon-color:error600` },
|
|
123
|
+
'x-alert-accent': {
|
|
124
|
+
type: 'statement',
|
|
125
|
+
statement: `@components-[class][border-left-width-4px,border-left-color--x-alert-icon-color:gray500]`
|
|
126
|
+
},
|
|
127
|
+
// ================================================================
|
|
128
|
+
// DIALOG (native <dialog>)
|
|
129
|
+
// <dialog class="x-dialog" id="confirm">
|
|
130
|
+
// <header class="x-dialog-header">
|
|
131
|
+
// <h2 class="x-dialog-title">Delete project?</h2>
|
|
132
|
+
// <form method="dialog"><button class="x-button x-button-ghost x-button-icon x-button-sm" aria-label="Close">✕</button></form>
|
|
133
|
+
// </header>
|
|
134
|
+
// <div class="x-dialog-body">…</div>
|
|
135
|
+
// <footer class="x-dialog-footer">
|
|
136
|
+
// <form method="dialog"><button class="x-button x-button-secondary">Cancel</button></form>
|
|
137
|
+
// <button class="x-button x-button-danger">Delete</button>
|
|
138
|
+
// </footer>
|
|
139
|
+
// </dialog>
|
|
140
|
+
// Open: dialog.showModal() (or <button commandfor="confirm" command="show-modal"> in supporting browsers)
|
|
141
|
+
// Close: any <form method="dialog"> button, Esc, or dialog.close()
|
|
142
|
+
// Variants: x-dialog-sheet (slides in from the right), x-dialog-sm, x-dialog-lg
|
|
143
|
+
// Vars: --x-dialog-width, --x-dialog-padding, --x-dialog-radius, --x-dialog-bg, --x-dialog-color,
|
|
144
|
+
// --x-dialog-border-color, --x-dialog-backdrop-bg, --x-dialog-from (closed transform)
|
|
145
|
+
// ================================================================
|
|
146
|
+
'x-dialog': {
|
|
147
|
+
type: 'statement',
|
|
148
|
+
statement: `
|
|
149
|
+
@components[w--x-dialog-width:480px,xw(calc(100vw_-_32px)),xh(calc(100dvh_-_32px)),p-0,box-sizing-border-box,overflow-auto,bgc--x-dialog-bg:white,c--x-dialog-color:gray900,border-width-1px,border-style-solid,border-color--x-dialog-border-color:gray200,br--x-dialog-radius:16px,box-shadow(0_24px_48px_-12px_rgb(16_24_40_/_0.18))]
|
|
150
|
+
@components[o-0,transform(var(--x-dialog-from,scale(0.96))),transition-property-opacity__transform__display__overlay,transition-duration-0.2s,transition-timing-function-ease-out,transition-behavior-allow-discrete]
|
|
151
|
+
@components-[open][o-1,tf-none]
|
|
152
|
+
@[components,starting-style]-[open][o-0,transform(var(--x-dialog-from,scale(0.96)))]
|
|
153
|
+
@components--backdrop[bgc--x-dialog-backdrop-bg:gray950/0.5,bf-blur-2px,o-0,transition-property-opacity__display__overlay,transition-duration-0.2s,transition-behavior-allow-discrete]
|
|
154
|
+
@components-[open]--backdrop-o-1
|
|
155
|
+
@[components,starting-style]-[open]--backdrop-o-0
|
|
156
|
+
@motion-reduce[transition-duration-0s,--backdrop-transition-duration-0s]
|
|
157
|
+
`
|
|
158
|
+
},
|
|
159
|
+
'x-dialog-header': {
|
|
160
|
+
type: 'statement',
|
|
161
|
+
statement: `@components[d-flex,aifs,jcsb,g-16px,padding(var(--x-dialog-padding,24px)),padding-bottom-0px]`
|
|
162
|
+
},
|
|
163
|
+
'x-dialog-title': {
|
|
164
|
+
type: 'statement',
|
|
165
|
+
statement: `@components[m-0,fs-18px,fw-600,lh-28px]`
|
|
166
|
+
},
|
|
167
|
+
'x-dialog-body': {
|
|
168
|
+
type: 'statement',
|
|
169
|
+
statement: `@components[padding(var(--x-dialog-padding,24px)),fs-14px,lh-22px,c--x-dialog-muted-color:gray600]`
|
|
170
|
+
},
|
|
171
|
+
'x-dialog-footer': {
|
|
172
|
+
type: 'statement',
|
|
173
|
+
statement: `
|
|
174
|
+
@components[d-flex,aic,jc-flex-end,g-12px,padding(var(--x-dialog-padding,24px)),padding-top-0px]
|
|
175
|
+
@components_form-display(contents)
|
|
176
|
+
`
|
|
177
|
+
},
|
|
178
|
+
'x-dialog-sm': { type: 'statement', statement: `--x-dialog-width:360px` },
|
|
179
|
+
'x-dialog-lg': { type: 'statement', statement: `--x-dialog-width:720px` },
|
|
180
|
+
'x-dialog-sheet': {
|
|
181
|
+
type: 'statement',
|
|
182
|
+
statement: `
|
|
183
|
+
--x-dialog-width:420px
|
|
184
|
+
--x-dialog-from:(translateX(100%))
|
|
185
|
+
@components-[class][m-0px-0px-0px-auto,h-100dvh,xh-none,br-0px,border-width-0px,border-left-width-1px]
|
|
186
|
+
`
|
|
187
|
+
},
|
|
188
|
+
// ================================================================
|
|
189
|
+
// ACCORDION (native <details>/<summary>)
|
|
190
|
+
// <div class="x-accordion-group">
|
|
191
|
+
// <details class="x-accordion" name="faq"> (same name = only one open at a time)
|
|
192
|
+
// <summary>Question</summary>
|
|
193
|
+
// <div class="x-accordion-content">Answer…</div>
|
|
194
|
+
// </details>
|
|
195
|
+
// </div>
|
|
196
|
+
// Vars: --x-accordion-border-color, --x-accordion-padding (as (16px_0)), --x-accordion-content-color
|
|
197
|
+
// Smooth height animation needs the `interpolate-size` property entry and a browser
|
|
198
|
+
// that supports ::details-content; elsewhere it simply opens without animation.
|
|
199
|
+
// ================================================================
|
|
200
|
+
'x-accordion-group': {
|
|
201
|
+
type: 'statement',
|
|
202
|
+
statement: `@components[border-top-width-1px,border-top-style-solid,border-top-color--x-accordion-border-color:gray200]`
|
|
203
|
+
},
|
|
204
|
+
'x-accordion': {
|
|
205
|
+
type: 'statement',
|
|
206
|
+
statement: `
|
|
207
|
+
@components[interpolate-size-allow-keywords,border-bottom-width-1px,border-bottom-style-solid,border-bottom-color--x-accordion-border-color:gray200]
|
|
208
|
+
@components__summary[d-flex,aic,jcsb,g-12px,padding(var(--x-accordion-padding,16px_0)),fs-15px,fw-500,lh-22px,list-style-none,cursor-pointer,user-select-none]
|
|
209
|
+
@components__summary--after[cont,flex-shrink-0,w-8px,h-8px,margin-right-4px,border-style-solid,border-color-currentColor,border-width-0px-2px-2px-0px,tf-rotate-45deg,transition-property-transform,transition-duration-0.2s]
|
|
210
|
+
@components-[open]__summary--after-tf-rotate--135deg
|
|
211
|
+
@components__summary--focus-visible[outline-style-solid,outline-width-2px,outline-color--x-form-accent-color:primary600,outline-offset-2px]
|
|
212
|
+
@components-@(::details-content)[h-0,overflow-clip,transition-property-height__content-visibility,transition-duration-0.25s,transition-behavior-allow-discrete]
|
|
213
|
+
@components-[open]@(::details-content)-h-auto
|
|
214
|
+
@motion-reduce__summary--after-transition-duration-0s
|
|
215
|
+
@motion-reduce-@(::details-content)-transition-duration-0s
|
|
216
|
+
`
|
|
217
|
+
},
|
|
218
|
+
'x-accordion-content': {
|
|
219
|
+
type: 'statement',
|
|
220
|
+
statement: `@components[padding-bottom-16px,fs-14px,lh-22px,c--x-accordion-content-color:gray600]`
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
export default components;
|
package/lib/config.d.ts
CHANGED
package/lib/config.js
CHANGED
|
@@ -14,6 +14,7 @@ const config = {
|
|
|
14
14
|
matchRegExpWithColonKeyFrame: /[\s](?:(keyframes[-_:][\w-]+))=[\s*]?(?:["']\W+\s*(?:\w+)\()?["']([^'"]+)['"]/,
|
|
15
15
|
createExtractorRegex: (fname) => new RegExp('(?:' + fname + ')' + "[\\s*]?(`|\\([" + `"'])` + "([^'`" + '"]+)' + "(`|" + `["']` + "\\))"),
|
|
16
16
|
createCSSModuleRegex: (fname) => new RegExp("(?:" + fname + ")\\[[`'" + '"]([^`"' + "']+)(?:[`'" + '"]\\])'),
|
|
17
|
+
asRegExpMatcher: /b/,
|
|
17
18
|
// globalValues:['initial:ini','inherit:in','unset:un', 'revert:re','revert-layer:rl'],
|
|
18
19
|
globalValues: ['initial', 'inherit', 'unset', 'revert', 'revert-layer'],
|
|
19
20
|
// makeStaticGlobalValues:(property:string,alias?:string)=>{
|
|
@@ -36,7 +37,7 @@ const config = {
|
|
|
36
37
|
`var(--space-24,${24 / 4}rem):24`,
|
|
37
38
|
`var(--space-32,${32 / 4}rem):32`,
|
|
38
39
|
],
|
|
39
|
-
remUnitsNegative: [`calc( -1 * var(--space-1,${
|
|
40
|
+
remUnitsNegative: [`calc( -1 * var(--space-1,${1 / 4}rem)):-1`, // calc( -1 * var(--mt))
|
|
40
41
|
`calc( -1 * var(--space-2,${2 / 4}rem)):-2`,
|
|
41
42
|
`calc( -1 * var(--space-3,${3 / 4}rem)):-3`,
|
|
42
43
|
`calc( -1 * var(--space-4,${4 / 4}rem)):-4`,
|