aliascss 1.4.5 → 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/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/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
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// AliasCSS form components
|
|
2
|
+
// ------------------------------------------------------------------
|
|
3
|
+
// Paste the entries into your prebuilt statements object.
|
|
4
|
+
//
|
|
5
|
+
// Design:
|
|
6
|
+
// - Resets live in @base, styles in @components, so any plain utility
|
|
7
|
+
// class (unlayered) on the element always overrides them.
|
|
8
|
+
// - Everything is themeable through CSS variables with token fallbacks.
|
|
9
|
+
// Set them once on :root (or a wrapper / dark-mode block) to re-theme
|
|
10
|
+
// every control; set them on one element to change just that element.
|
|
11
|
+
//
|
|
12
|
+
// Shared variables (all optional):
|
|
13
|
+
// --x-form-height control height (40px)
|
|
14
|
+
// --x-form-radius corner radius (8px)
|
|
15
|
+
// --x-form-font-size input text size (16px, avoids iOS zoom)
|
|
16
|
+
// --x-form-bg control background (slateTheme1)
|
|
17
|
+
// --x-form-color text color (slateTheme12)
|
|
18
|
+
// --x-form-border-color border (slateTheme7)
|
|
19
|
+
// --x-form-border-hover-color (slateTheme8)
|
|
20
|
+
// --x-form-placeholder-color (slateTheme9)
|
|
21
|
+
// --x-form-accent-color focus / checked / primary (accentRA1000, follows --accentColor)
|
|
22
|
+
// --x-form-ring-color focus ring (accentRATheme400)
|
|
23
|
+
// --x-form-error-color invalid state (redTheme11)
|
|
24
|
+
// --x-form-error-ring-color (redTheme5)
|
|
25
|
+
// --x-form-disabled-bg / --x-form-disabled-color (slateTheme3 / slateTheme10)
|
|
26
|
+
// --x-form-label-color / --x-form-hint-color (slateTheme12 / slateTheme11)
|
|
27
|
+
// ------------------------------------------------------------------
|
|
28
|
+
const focusVisible = `@components--focus-visible[outline-style-solid,outline-width-2px,outline-color--x-form-accent-color:accentRA1000,outline-offset-2px]`;
|
|
29
|
+
// Shared text-field styles (x-input, x-textarea, x-select)
|
|
30
|
+
const field = `
|
|
31
|
+
@base-all-unset
|
|
32
|
+
@components[d-block,w-100%,h--x-form-height:40px,p-0px-12px,box-sizing-border-box,br--x-form-radius:8px,border-width-1px,border-style-solid,border-color--x-form-border-color:slateTheme7,bgc--x-form-bg:slateTheme1,c--x-form-color:slateTheme12,fs--x-form-font-size:16px,lh-1.5,cursor-text,transition-property-border-color__box-shadow,transition-duration-0.15s]
|
|
33
|
+
--ring-width:3px
|
|
34
|
+
@components--placeholder-c--x-form-placeholder-color:slateTheme9
|
|
35
|
+
@components--enabled--hover-border-color--x-form-border-hover-color:slateTheme8
|
|
36
|
+
@components--focus[border-color--x-form-accent-color:accentRA1000,ring--x-form-ring-color:accentRATheme400]
|
|
37
|
+
@components--user-invalid-border-color--x-form-error-color:redTheme11
|
|
38
|
+
@components-[aria-invalid=true]-border-color--x-form-error-color:redTheme11
|
|
39
|
+
@components--user-invalid--focus-ring--x-form-error-ring-color:redTheme5
|
|
40
|
+
@components-[aria-invalid=true]--focus-ring--x-form-error-ring-color:redTheme5
|
|
41
|
+
@components--disabled[bgc--x-form-disabled-bg:slateTheme3,c--x-form-disabled-color:slateTheme10,cursor-not-allowed]
|
|
42
|
+
`;
|
|
43
|
+
// Shared checkbox / radio box styles
|
|
44
|
+
const choiceBox = `
|
|
45
|
+
@base-[appearance-none,m-0]
|
|
46
|
+
@components[d-inline-grid,place-content-center,flex-shrink-0,w--x-check-size:18px,h--x-check-size:18px,box-sizing-border-box,border-width-1px,border-style-solid,border-color--x-form-border-color:slateTheme7,bgc--x-form-bg:slateTheme1,cursor-pointer,transition-property-background-color__border-color,transition-duration-0.15s]
|
|
47
|
+
@components--checked[bgc--x-form-accent-color:accentRA1000,border-color--x-form-accent-color:accentRA1000]
|
|
48
|
+
${focusVisible}
|
|
49
|
+
@components--disabled[o-0.5,cursor-not-allowed]
|
|
50
|
+
`;
|
|
51
|
+
const formComponents = {
|
|
52
|
+
// ---------------- Button ----------------
|
|
53
|
+
// <button class="x-button">Save</button>
|
|
54
|
+
// Variants: x-button-secondary, x-button-ghost, x-button-danger
|
|
55
|
+
// Sizes: x-button-sm, x-button-lg, x-button-icon
|
|
56
|
+
'x-button': {
|
|
57
|
+
type: 'statement',
|
|
58
|
+
statement: `
|
|
59
|
+
@base-all-unset
|
|
60
|
+
@components[d-inline-flex,aic,jcc,g-8px,box-sizing-border-box,h--x-form-height:40px,padding-inline--x-button-padding:16px,br--x-form-radius:8px,border-width-1px,border-style-solid,border-color--x-button-border-color:transparent,bgc--x-button-bg:accentRA1000,c--x-button-color:white,fs--x-button-font-size:15px,fw-600,lh-1,white-space-nowrap,user-select-none,cursor-pointer,transition-property-background-color__border-color__color__transform,transition-duration-0.15s]
|
|
61
|
+
@components--enabled--hover-bgc--x-button-hover-bg:accentRA1100
|
|
62
|
+
@components--enabled--active-tf-scale-0.98
|
|
63
|
+
${focusVisible}
|
|
64
|
+
@components--disabled[o-0.5,cursor-not-allowed]
|
|
65
|
+
@components-[aria-disabled=true][o-0.5,cursor-not-allowed,pointer-events-none]
|
|
66
|
+
`
|
|
67
|
+
},
|
|
68
|
+
'x-button-secondary': {
|
|
69
|
+
type: 'statement',
|
|
70
|
+
statement: `--x-button-bg:slateTheme1 --x-button-hover-bg:slateTheme3 --x-button-color:slateTheme12 --x-button-border-color:slateTheme7`
|
|
71
|
+
},
|
|
72
|
+
'x-button-ghost': {
|
|
73
|
+
type: 'statement',
|
|
74
|
+
statement: `--x-button-bg:transparent --x-button-hover-bg:slateTheme3 --x-button-color:slateTheme12 --x-button-border-color:transparent`
|
|
75
|
+
},
|
|
76
|
+
'x-button-danger': {
|
|
77
|
+
type: 'statement',
|
|
78
|
+
statement: `--x-button-bg:redTheme9 --x-button-hover-bg:redTheme10 --x-button-color:white --x-button-border-color:transparent`
|
|
79
|
+
},
|
|
80
|
+
'x-button-sm': {
|
|
81
|
+
type: 'statement',
|
|
82
|
+
statement: `--x-form-height:32px --x-button-padding:12px --x-button-font-size:14px`
|
|
83
|
+
},
|
|
84
|
+
'x-button-lg': {
|
|
85
|
+
type: 'statement',
|
|
86
|
+
statement: `--x-form-height:48px --x-button-padding:20px --x-button-font-size:16px`
|
|
87
|
+
},
|
|
88
|
+
'x-button-icon': {
|
|
89
|
+
// square icon-only button: <button class="x-button x-button-icon" aria-label="Close">…</button>
|
|
90
|
+
type: 'statement',
|
|
91
|
+
statement: `--x-button-padding:0px w--x-form-height:40px`
|
|
92
|
+
},
|
|
93
|
+
// ---------------- Text fields ----------------
|
|
94
|
+
// <input class="x-input" type="email">
|
|
95
|
+
'x-input': {
|
|
96
|
+
type: 'statement',
|
|
97
|
+
statement: field
|
|
98
|
+
},
|
|
99
|
+
// <textarea class="x-textarea"></textarea>
|
|
100
|
+
'x-textarea': {
|
|
101
|
+
type: 'statement',
|
|
102
|
+
statement: `
|
|
103
|
+
${field}
|
|
104
|
+
@components[h-auto,mh--x-textarea-min-height:96px,p-10px-12px,resize-vertical]
|
|
105
|
+
`
|
|
106
|
+
},
|
|
107
|
+
// <select class="x-select">…</select>
|
|
108
|
+
'x-select': {
|
|
109
|
+
type: 'statement',
|
|
110
|
+
statement: `
|
|
111
|
+
${field}
|
|
112
|
+
@components[d-flex,aic,cursor-pointer,padding-right-36px,background-repeat-no-repeat]
|
|
113
|
+
@components-background-image(linear-gradient(45deg,transparent_50%,currentColor_50%),linear-gradient(135deg,currentColor_50%,transparent_50%))
|
|
114
|
+
@components-background-position(calc(100%_-_19px)_50%,calc(100%_-_14px)_50%)
|
|
115
|
+
@components-background-size(5px_5px,5px_5px)
|
|
116
|
+
`
|
|
117
|
+
},
|
|
118
|
+
// ---------------- Checkbox / radio / switch ----------------
|
|
119
|
+
// <input type="checkbox" class="x-checkbox">
|
|
120
|
+
'x-checkbox': {
|
|
121
|
+
type: 'statement',
|
|
122
|
+
statement: `
|
|
123
|
+
${choiceBox}
|
|
124
|
+
@components-br--x-check-radius:4px
|
|
125
|
+
@components--before[cont,w(calc(var(--x-check-size,18px)*0.6)),h(calc(var(--x-check-size,18px)*0.6)),bgc--x-check-mark-color:white,clip-path(polygon(14%_44%,0_65%,50%_100%,100%_16%,80%_0%,43%_62%)),tf-scale-0,transition-property-transform,transition-duration-0.15s]
|
|
126
|
+
@components--checked--before-tf-scale-1
|
|
127
|
+
@components--indeterminate[bgc--x-form-accent-color:accentRA1000,border-color--x-form-accent-color:accentRA1000]
|
|
128
|
+
@components--indeterminate--before[tf-scale-1,clip-path(inset(40%_0))]
|
|
129
|
+
`
|
|
130
|
+
},
|
|
131
|
+
// <input type="radio" class="x-radio">
|
|
132
|
+
'x-radio': {
|
|
133
|
+
type: 'statement',
|
|
134
|
+
statement: `
|
|
135
|
+
${choiceBox}
|
|
136
|
+
@components-br-50%
|
|
137
|
+
@components--before[cont,w(calc(var(--x-check-size,18px)*0.45)),h(calc(var(--x-check-size,18px)*0.45)),br-50%,bgc--x-check-mark-color:white,tf-scale-0,transition-property-transform,transition-duration-0.15s]
|
|
138
|
+
@components--checked--before-tf-scale-1
|
|
139
|
+
`
|
|
140
|
+
},
|
|
141
|
+
// <input type="checkbox" role="switch" class="x-switch">
|
|
142
|
+
'x-switch': {
|
|
143
|
+
type: 'statement',
|
|
144
|
+
statement: `
|
|
145
|
+
@base-[appearance-none,m-0]
|
|
146
|
+
@components[position-relative,d-inline-block,flex-shrink-0,w--x-switch-width:36px,h--x-switch-height:20px,box-sizing-border-box,br-999px,bgc--x-switch-bg:slateTheme6,cursor-pointer,transition-property-background-color,transition-duration-0.2s]
|
|
147
|
+
@components--before[cont,position-absolute,t-2px,l-2px,w(calc(var(--x-switch-height,20px)_-_4px)),h(calc(var(--x-switch-height,20px)_-_4px)),br-50%,bgc--x-switch-thumb-color:white,bxs-0px-1px-2px-black/0.2,transition-property-transform,transition-duration-0.2s]
|
|
148
|
+
@components--checked-bgc--x-form-accent-color:accentRA1000
|
|
149
|
+
@components--checked--before-transform(translateX(calc(var(--x-switch-width,36px)_-_var(--x-switch-height,20px))))
|
|
150
|
+
${focusVisible}
|
|
151
|
+
@components--disabled[o-0.5,cursor-not-allowed]
|
|
152
|
+
`
|
|
153
|
+
},
|
|
154
|
+
// ---------------- Layout helpers ----------------
|
|
155
|
+
// <div class="x-field">
|
|
156
|
+
// <label class="x-label" for="email">Email</label>
|
|
157
|
+
// <input class="x-input" id="email">
|
|
158
|
+
// <p class="x-hint">We'll never share it.</p>
|
|
159
|
+
// </div>
|
|
160
|
+
'x-field': {
|
|
161
|
+
type: 'statement',
|
|
162
|
+
statement: `@components[d-flex,flex-direction-column,g-6px]`
|
|
163
|
+
},
|
|
164
|
+
'x-label': {
|
|
165
|
+
type: 'statement',
|
|
166
|
+
statement: `@components[fs-14px,fw-500,lh-20px,c--x-form-label-color:slateTheme12]`
|
|
167
|
+
},
|
|
168
|
+
'x-hint': {
|
|
169
|
+
type: 'statement',
|
|
170
|
+
statement: `@components[m-0,fs-13px,lh-18px,c--x-form-hint-color:slateTheme11]`
|
|
171
|
+
},
|
|
172
|
+
'x-error-text': {
|
|
173
|
+
type: 'statement',
|
|
174
|
+
statement: `@components[m-0,fs-13px,lh-18px,c--x-form-error-color:redTheme11]`
|
|
175
|
+
},
|
|
176
|
+
// Label wrapping a checkbox / radio / switch:
|
|
177
|
+
// <label class="x-choice"><input type="checkbox" class="x-checkbox"> Remember me</label>
|
|
178
|
+
'x-choice': {
|
|
179
|
+
type: 'statement',
|
|
180
|
+
statement: `
|
|
181
|
+
@components[d-inline-flex,aic,g-8px,fs-14px,lh-20px,c--x-form-color:slateTheme12,cursor-pointer]
|
|
182
|
+
@components--has(_input--disabled)[o-0.5,cursor-not-allowed]
|
|
183
|
+
`
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
export default formComponents;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
declare const absoluteComponents: {
|
|
2
|
+
'x-absolute-0': {
|
|
3
|
+
type: string;
|
|
4
|
+
statement: string;
|
|
5
|
+
};
|
|
6
|
+
'x-absolute-top': {
|
|
7
|
+
type: string;
|
|
8
|
+
statement: string;
|
|
9
|
+
};
|
|
10
|
+
'x-absolute-bottom': {
|
|
11
|
+
type: string;
|
|
12
|
+
statement: string;
|
|
13
|
+
};
|
|
14
|
+
'x-absolute-left': {
|
|
15
|
+
type: string;
|
|
16
|
+
statement: string;
|
|
17
|
+
};
|
|
18
|
+
'x-absolute-right': {
|
|
19
|
+
type: string;
|
|
20
|
+
statement: string;
|
|
21
|
+
};
|
|
22
|
+
'x-divider': {
|
|
23
|
+
type: string;
|
|
24
|
+
statement: string;
|
|
25
|
+
};
|
|
26
|
+
'x-divider-vertical': {
|
|
27
|
+
type: string;
|
|
28
|
+
statement: string;
|
|
29
|
+
};
|
|
30
|
+
'x-divider-text': {
|
|
31
|
+
type: string;
|
|
32
|
+
statement: string;
|
|
33
|
+
};
|
|
34
|
+
'x-divider-text-start': {
|
|
35
|
+
type: string;
|
|
36
|
+
statement: string;
|
|
37
|
+
};
|
|
38
|
+
'x-divider-text-end': {
|
|
39
|
+
type: string;
|
|
40
|
+
statement: string;
|
|
41
|
+
};
|
|
42
|
+
'x-arrow': {
|
|
43
|
+
type: string;
|
|
44
|
+
statement: string;
|
|
45
|
+
};
|
|
46
|
+
'x-arrow-down': {
|
|
47
|
+
type: string;
|
|
48
|
+
statement: string;
|
|
49
|
+
};
|
|
50
|
+
'x-arrow-up': {
|
|
51
|
+
type: string;
|
|
52
|
+
statement: string;
|
|
53
|
+
};
|
|
54
|
+
'x-arrow-right': {
|
|
55
|
+
type: string;
|
|
56
|
+
statement: string;
|
|
57
|
+
};
|
|
58
|
+
'x-arrow-left': {
|
|
59
|
+
type: string;
|
|
60
|
+
statement: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export default absoluteComponents;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// ------------------------------------------------------------------
|
|
2
|
+
// x-absolute: absolutely positioned panels that slide in from an edge.
|
|
3
|
+
//
|
|
4
|
+
// <div class="position-relative overflow-hidden"> parent clips the panel
|
|
5
|
+
// <aside class="x-absolute-left" data-absolute-hide>…</aside>
|
|
6
|
+
// </div>
|
|
7
|
+
//
|
|
8
|
+
// Hide: add the class x-absolute-hide or the attribute data-absolute-hide;
|
|
9
|
+
// remove it to slide the panel in. Hidden panels are also visibility:hidden,
|
|
10
|
+
// so they can't be focused, clicked or read by screen readers.
|
|
11
|
+
//
|
|
12
|
+
// vars: --x-absolute-duration (0.35s)
|
|
13
|
+
// --x-absolute-from off-screen position, set by each edge class
|
|
14
|
+
// ------------------------------------------------------------------
|
|
15
|
+
const slide = `
|
|
16
|
+
@components[position-absolute,transition-property-translate__visibility,transition-duration--x-absolute-duration:0.35s,transition-timing-function(cubic-bezier(0.16,1,0.3,1))]
|
|
17
|
+
@components-[class~=x-absolute-hide][translate(var(--x-absolute-from)),visibility-hidden]
|
|
18
|
+
@components-[data-absolute-hide][translate(var(--x-absolute-from)),visibility-hidden]
|
|
19
|
+
@motion-reduce-transition-duration-0s
|
|
20
|
+
`;
|
|
21
|
+
const absoluteComponents = {
|
|
22
|
+
// Fill the nearest positioned parent
|
|
23
|
+
'x-absolute-0': {
|
|
24
|
+
type: 'statement',
|
|
25
|
+
statement: `@components[position-absolute,inset-0]`
|
|
26
|
+
},
|
|
27
|
+
'x-absolute-top': {
|
|
28
|
+
type: 'statement',
|
|
29
|
+
statement: `--x-absolute-from:(0_-100%) ${slide} @components[t-0,l-0,r-0]`
|
|
30
|
+
},
|
|
31
|
+
'x-absolute-bottom': {
|
|
32
|
+
type: 'statement',
|
|
33
|
+
statement: `--x-absolute-from:(0_100%) ${slide} @components[btm-0,l-0,r-0]`
|
|
34
|
+
},
|
|
35
|
+
'x-absolute-left': {
|
|
36
|
+
type: 'statement',
|
|
37
|
+
statement: `--x-absolute-from:(-100%_0) ${slide} @components[t-0,btm-0,l-0]`
|
|
38
|
+
},
|
|
39
|
+
'x-absolute-right': {
|
|
40
|
+
type: 'statement',
|
|
41
|
+
statement: `--x-absolute-from:(100%_0) ${slide} @components[t-0,btm-0,r-0]`
|
|
42
|
+
},
|
|
43
|
+
// ------------------------------------------------------------------
|
|
44
|
+
// Dividers
|
|
45
|
+
// <hr class="x-divider">
|
|
46
|
+
// <div class="x-divider-vertical"></div> inside a flex row
|
|
47
|
+
// <div class="x-divider-text" role="separator">or</div>
|
|
48
|
+
// <div class="x-divider-text x-divider-text-start">Section</div>
|
|
49
|
+
//
|
|
50
|
+
// vars: --x-divider-color (slateTheme6), --x-divider-width (1px),
|
|
51
|
+
// --x-divider-style (solid), --x-divider-space (16px, margin around it)
|
|
52
|
+
// ------------------------------------------------------------------
|
|
53
|
+
'x-divider': {
|
|
54
|
+
type: 'statement',
|
|
55
|
+
statement: `
|
|
56
|
+
@base-[b-0,m-0]
|
|
57
|
+
@components[d-block,h-0,box-sizing-border-box,margin-block--x-divider-space:16px,border-top-width--x-divider-width:1px,border-top-style--x-divider-style:solid,border-top-color--x-divider-color:slateTheme6]
|
|
58
|
+
`
|
|
59
|
+
},
|
|
60
|
+
'x-divider-vertical': {
|
|
61
|
+
type: 'statement',
|
|
62
|
+
statement: `
|
|
63
|
+
@base-[b-0,m-0]
|
|
64
|
+
@components[align-self-stretch,flex-shrink-0,w-0,margin-inline--x-divider-space:16px,border-inline-start-width--x-divider-width:1px,border-inline-start-style--x-divider-style:solid,border-inline-start-color--x-divider-color:slateTheme6]
|
|
65
|
+
`
|
|
66
|
+
},
|
|
67
|
+
'x-divider-text': {
|
|
68
|
+
type: 'statement',
|
|
69
|
+
statement: `
|
|
70
|
+
@components[d-flex,aic,g--x-divider-gap:12px,margin-block--x-divider-space:16px,fs-14px,c--x-divider-text-color:slateTheme11,white-space-nowrap]
|
|
71
|
+
@components--before[cont,flex-grow--x-divider-before:1,h--x-divider-width:1px,bgc--x-divider-color:slateTheme6]
|
|
72
|
+
@components--after[cont,flex-grow--x-divider-after:1,h--x-divider-width:1px,bgc--x-divider-color:slateTheme6]
|
|
73
|
+
`
|
|
74
|
+
},
|
|
75
|
+
// Label near the start or end instead of centered
|
|
76
|
+
'x-divider-text-start': { type: 'statement', statement: `--x-divider-before:(0) --x-divider-gap:12px @components--before-w-24px` },
|
|
77
|
+
'x-divider-text-end': { type: 'statement', statement: `--x-divider-after:(0) @components--after-w-24px` },
|
|
78
|
+
// Other Helper
|
|
79
|
+
'x-arrow': {
|
|
80
|
+
type: 'statement',
|
|
81
|
+
statement: `
|
|
82
|
+
@components[d-inline-block,flex-shrink-0,vertical-align-middle,w--x-arrow-size:0.5em,h--x-arrow-size:0.5em,box-sizing-border-box,border-style-solid,border-color--x-arrow-color:currentColor,border-width(0_var(--x-arrow-width,2px)_var(--x-arrow-width,2px)_0),rotate(var(--x-arrow-rotate,45deg)),translate(var(--x-arrow-shift,0_-25%)),transition-property-rotate__translate,transition-duration--x-arrow-duration:0.2s,pointer-events-none]
|
|
83
|
+
@motion-reduce-transition-duration-0s
|
|
84
|
+
`
|
|
85
|
+
},
|
|
86
|
+
'x-arrow-down': { type: 'statement', statement: `--x-arrow-rotate:(45deg) --x-arrow-shift:(0_-25%)` },
|
|
87
|
+
'x-arrow-up': { type: 'statement', statement: `--x-arrow-rotate:(-135deg) --x-arrow-shift:(0_25%)` },
|
|
88
|
+
'x-arrow-right': { type: 'statement', statement: `--x-arrow-rotate:(-45deg) --x-arrow-shift:(-25%_0)` },
|
|
89
|
+
'x-arrow-left': { type: 'statement', statement: `--x-arrow-rotate:(135deg) --x-arrow-shift:(25%_0)` },
|
|
90
|
+
};
|
|
91
|
+
export default absoluteComponents;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
declare const layout: {
|
|
2
|
+
'x-stack': {
|
|
3
|
+
type: string;
|
|
4
|
+
statement: string;
|
|
5
|
+
};
|
|
6
|
+
'x-stack-end': {
|
|
7
|
+
type: string;
|
|
8
|
+
statement: string;
|
|
9
|
+
};
|
|
10
|
+
'x-cluster': {
|
|
11
|
+
type: string;
|
|
12
|
+
statement: string;
|
|
13
|
+
};
|
|
14
|
+
'x-cluster-end': {
|
|
15
|
+
type: string;
|
|
16
|
+
statement: string;
|
|
17
|
+
};
|
|
18
|
+
'x-center': {
|
|
19
|
+
type: string;
|
|
20
|
+
statement: string;
|
|
21
|
+
};
|
|
22
|
+
'x-grid': {
|
|
23
|
+
type: string;
|
|
24
|
+
statement: string;
|
|
25
|
+
};
|
|
26
|
+
'x-grid-fit': {
|
|
27
|
+
type: string;
|
|
28
|
+
statement: string;
|
|
29
|
+
};
|
|
30
|
+
'x-switcher': {
|
|
31
|
+
type: string;
|
|
32
|
+
statement: string;
|
|
33
|
+
};
|
|
34
|
+
'x-sidebar': {
|
|
35
|
+
type: string;
|
|
36
|
+
statement: string;
|
|
37
|
+
};
|
|
38
|
+
'x-sidebar-right': {
|
|
39
|
+
type: string;
|
|
40
|
+
statement: string;
|
|
41
|
+
};
|
|
42
|
+
'x-cover': {
|
|
43
|
+
type: string;
|
|
44
|
+
statement: string;
|
|
45
|
+
};
|
|
46
|
+
'x-cover-center': {
|
|
47
|
+
type: string;
|
|
48
|
+
statement: string;
|
|
49
|
+
};
|
|
50
|
+
'x-frame': {
|
|
51
|
+
type: string;
|
|
52
|
+
statement: string;
|
|
53
|
+
};
|
|
54
|
+
'x-reel': {
|
|
55
|
+
type: string;
|
|
56
|
+
statement: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export default layout;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// AliasCSS layout primitives
|
|
2
|
+
// ------------------------------------------------------------------
|
|
3
|
+
// Small, composable layouts that adapt to the space they're given,
|
|
4
|
+
// so most pages need far fewer @xs/@sm/@md classes.
|
|
5
|
+
//
|
|
6
|
+
// x-stack vertical flow with consistent gap (x-stack-end pushes an item to the bottom)
|
|
7
|
+
// x-cluster wrapping row of items (tags, buttons) (x-cluster-end pushes an item to the right)
|
|
8
|
+
// x-center centered max-width container with side gutters
|
|
9
|
+
// x-grid auto-filling responsive grid (x-grid-fit stretches items when there are few)
|
|
10
|
+
// x-switcher row of equal items that becomes a column below a threshold width
|
|
11
|
+
// x-sidebar sidebar + content, wraps when content gets too narrow (x-sidebar-right flips it)
|
|
12
|
+
// x-cover full-height section with a vertically centered child (x-cover-center)
|
|
13
|
+
// x-frame fixed aspect-ratio crop for images/video
|
|
14
|
+
// x-reel horizontal scrolling strip with snap
|
|
15
|
+
//
|
|
16
|
+
// Everything is in @components, so plain utilities override it:
|
|
17
|
+
// class="x-stack g-24px" or class="x-grid g-8px"
|
|
18
|
+
// Or set the variables, e.g. class="x-grid --x-grid-min:180px".
|
|
19
|
+
// Note: custom properties inherit, so a variable set on an outer layout
|
|
20
|
+
// also reaches nested layouts of the same kind. Plain utilities don't have that issue.
|
|
21
|
+
// ------------------------------------------------------------------
|
|
22
|
+
const layout = {
|
|
23
|
+
// <div class="x-stack">…</div> vars: --x-stack-gap (16px)
|
|
24
|
+
'x-stack': {
|
|
25
|
+
type: 'statement',
|
|
26
|
+
statement: `@components[d-flex,flex-direction-column,g--x-stack-gap:16px]`
|
|
27
|
+
},
|
|
28
|
+
'x-stack-end': {
|
|
29
|
+
type: 'statement',
|
|
30
|
+
statement: `@components[margin-block-start-auto]`
|
|
31
|
+
},
|
|
32
|
+
// <div class="x-cluster">…</div> vars: --x-cluster-gap (12px), --x-cluster-justify, --x-cluster-align
|
|
33
|
+
'x-cluster': {
|
|
34
|
+
type: 'statement',
|
|
35
|
+
statement: `@components[d-flex,flex-wrap-wrap,align-items--x-cluster-align:center,justify-content--x-cluster-justify:flex-start,g--x-cluster-gap:12px]`
|
|
36
|
+
},
|
|
37
|
+
'x-cluster-end': {
|
|
38
|
+
type: 'statement',
|
|
39
|
+
statement: `@components[margin-inline-start-auto]`
|
|
40
|
+
},
|
|
41
|
+
// <div class="x-center">…</div> vars: --x-center-max (960px), --x-center-gutter (16px)
|
|
42
|
+
'x-center': {
|
|
43
|
+
type: 'statement',
|
|
44
|
+
statement: `@components[box-sizing-content-box,max-inline-size--x-center-max:960px,margin-inline-auto,padding-inline--x-center-gutter:16px]`
|
|
45
|
+
},
|
|
46
|
+
// <div class="x-grid">…cards…</div> vars: --x-grid-min (240px), --x-grid-gap (16px)
|
|
47
|
+
// auto-fill keeps empty tracks (items keep their size); x-grid-fit uses auto-fit (items stretch).
|
|
48
|
+
'x-grid': {
|
|
49
|
+
type: 'statement',
|
|
50
|
+
statement: `@components[d-grid,g--x-grid-gap:16px,grid-template-columns(repeat(auto-fill,minmax(min(var(--x-grid-min,240px),100%),1fr)))]`
|
|
51
|
+
},
|
|
52
|
+
'x-grid-fit': {
|
|
53
|
+
type: 'statement',
|
|
54
|
+
statement: `@components-[class]-grid-template-columns(repeat(auto-fit,minmax(min(var(--x-grid-min,240px),100%),1fr)))`
|
|
55
|
+
},
|
|
56
|
+
// <div class="x-switcher"><div>A</div><div>B</div><div>C</div></div>
|
|
57
|
+
// Items sit in a row while the container is wider than the threshold, otherwise they stack.
|
|
58
|
+
// vars: --x-switcher-threshold (640px), --x-switcher-gap (16px)
|
|
59
|
+
'x-switcher': {
|
|
60
|
+
type: 'statement',
|
|
61
|
+
statement: `
|
|
62
|
+
@components[d-flex,flex-wrap-wrap,g--x-switcher-gap:16px]
|
|
63
|
+
@components__all[flex-grow-1,flex-basis(calc((var(--x-switcher-threshold,640px)_-_100%)_*_999))]
|
|
64
|
+
`
|
|
65
|
+
},
|
|
66
|
+
// <div class="x-sidebar"><aside>Sidebar</aside><main>Content</main></div>
|
|
67
|
+
// vars: --x-sidebar-width (280px), --x-sidebar-content-min (60%), --x-sidebar-gap (24px)
|
|
68
|
+
'x-sidebar': {
|
|
69
|
+
type: 'statement',
|
|
70
|
+
statement: `
|
|
71
|
+
@components[d-flex,flex-wrap-wrap,g--x-sidebar-gap:24px]
|
|
72
|
+
@components__all--first-child[flex-grow-1,flex-basis--x-sidebar-width:280px]
|
|
73
|
+
@components__all--last-child[flex-grow-999,flex-basis-0px,min-inline-size--x-sidebar-content-min:60%]
|
|
74
|
+
`
|
|
75
|
+
},
|
|
76
|
+
// <div class="x-sidebar x-sidebar-right"><main>Content</main><aside>Sidebar</aside></div>
|
|
77
|
+
'x-sidebar-right': {
|
|
78
|
+
type: 'statement',
|
|
79
|
+
statement: `
|
|
80
|
+
@components-[class]__all--first-child[flex-grow-999,flex-basis-0px,min-inline-size--x-sidebar-content-min:60%]
|
|
81
|
+
@components-[class]__all--last-child[flex-grow-1,flex-basis--x-sidebar-width:280px,min-inline-size(auto)]
|
|
82
|
+
`
|
|
83
|
+
},
|
|
84
|
+
// <section class="x-cover"><header>…</header><h1 class="x-cover-center">Hero</h1><footer>…</footer></section>
|
|
85
|
+
// vars: --x-cover-min-height (100dvh), --x-cover-padding (16px), --x-cover-gap (16px)
|
|
86
|
+
'x-cover': {
|
|
87
|
+
type: 'statement',
|
|
88
|
+
statement: `@components[d-flex,flex-direction-column,box-sizing-border-box,mh--x-cover-min-height:100dvh,padding--x-cover-padding:16px,g--x-cover-gap:16px]`
|
|
89
|
+
},
|
|
90
|
+
'x-cover-center': {
|
|
91
|
+
type: 'statement',
|
|
92
|
+
statement: `@components[margin-block-auto]`
|
|
93
|
+
},
|
|
94
|
+
// <div class="x-frame"><img src="…" alt=""></div> vars: --x-frame-ratio (16/9)
|
|
95
|
+
'x-frame': {
|
|
96
|
+
type: 'statement',
|
|
97
|
+
statement: `
|
|
98
|
+
@components[d-flex,jcc,aic,overflow-hidden,aspect-ratio--x-frame-ratio:16/9]
|
|
99
|
+
@components__img[w-100%,h-100%,object-fit-cover]
|
|
100
|
+
@components__video[w-100%,h-100%,object-fit-cover]
|
|
101
|
+
`
|
|
102
|
+
},
|
|
103
|
+
// <div class="x-reel"><div>…</div><div>…</div>…</div>
|
|
104
|
+
// vars: --x-reel-item-width (280px), --x-reel-gap (16px)
|
|
105
|
+
'x-reel': {
|
|
106
|
+
type: 'statement',
|
|
107
|
+
statement: `
|
|
108
|
+
@components[d-flex,g--x-reel-gap:16px,overflow-x-auto,overscroll-behavior-inline-contain,scroll-snap-type-x-mandatory,padding-block-end-8px]
|
|
109
|
+
@components__all[flex(0_0_var(--x-reel-item-width,280px)),scroll-snap-align-start]
|
|
110
|
+
`
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
export default layout;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const menuComponents: {
|
|
2
|
+
'x-menu': {
|
|
3
|
+
type: string;
|
|
4
|
+
statement: string;
|
|
5
|
+
};
|
|
6
|
+
'x-menu-sm': {
|
|
7
|
+
type: string;
|
|
8
|
+
statement: string;
|
|
9
|
+
};
|
|
10
|
+
'x-menu-lg': {
|
|
11
|
+
type: string;
|
|
12
|
+
statement: string;
|
|
13
|
+
};
|
|
14
|
+
'x-menu-bold': {
|
|
15
|
+
type: string;
|
|
16
|
+
statement: string;
|
|
17
|
+
};
|
|
18
|
+
'x-menu-plain': {
|
|
19
|
+
type: string;
|
|
20
|
+
statement: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default menuComponents;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// ------------------------------------------------------------------
|
|
2
|
+
// x-menu: menu button whose three bars fold into an X.
|
|
3
|
+
//
|
|
4
|
+
// <button class="x-menu" aria-label="Menu" aria-expanded="false" aria-controls="site-nav"></button>
|
|
5
|
+
//
|
|
6
|
+
// Open state: aria-expanded="true" (recommended, it is also what screen readers read)
|
|
7
|
+
// or the class x-menu-open when the button is not a toggle you control with ARIA.
|
|
8
|
+
//
|
|
9
|
+
// Animation: closed → open, the outer bars slide to the middle, the middle bar shrinks,
|
|
10
|
+
// then the outer bars rotate. Open → closed plays it in reverse.
|
|
11
|
+
//
|
|
12
|
+
// Sizes: x-menu-sm (32px), x-menu (40px), x-menu-lg (48px)
|
|
13
|
+
// Options: x-menu-bold (3px bars), x-menu-plain (no hover background)
|
|
14
|
+
//
|
|
15
|
+
// vars: --x-menu-size (40px) button width/height (tap target)
|
|
16
|
+
// --x-menu-icon-width (20px) bar length
|
|
17
|
+
// --x-menu-bar (2px) bar thickness
|
|
18
|
+
// --x-menu-gap (6px) distance from the middle bar to the outer bars
|
|
19
|
+
// --x-menu-radius (8px) button corner radius
|
|
20
|
+
// --x-menu-color (slateTheme12) bars follow this text color
|
|
21
|
+
// --x-menu-bg (transparent), --x-menu-hover-bg (slateTheme3)
|
|
22
|
+
// --x-menu-duration (0.15s) length of each of the two animation steps
|
|
23
|
+
// ------------------------------------------------------------------
|
|
24
|
+
const dur = `var(--x-menu-duration,0.15s)`;
|
|
25
|
+
// Open-state rules, shared by [aria-expanded=true] and .x-menu-open
|
|
26
|
+
const openState = (sel) => `
|
|
27
|
+
@components-${sel}[background-size(0_var(--x-menu-bar,2px)),transition-delay-0s]
|
|
28
|
+
@components-${sel}--before[translate(0_0),rotate(45deg),transition-delay(0s,${dur})]
|
|
29
|
+
@components-${sel}--after[translate(0_0),rotate(-45deg),transition-delay(0s,${dur})]`;
|
|
30
|
+
const bar = `cont,position-absolute,inset-0,m-auto,w--x-menu-icon-width:20px,h--x-menu-bar:2px,br-999px,bgc-currentColor,transition-property-translate__rotate,transition-duration--x-menu-duration:0.15s,transition-delay(${dur},0s)`;
|
|
31
|
+
const menuComponents = {
|
|
32
|
+
'x-menu': {
|
|
33
|
+
type: 'statement',
|
|
34
|
+
statement: `
|
|
35
|
+
--x-menu-shift:(calc(var(--x-menu-gap,6px)_*_-1))
|
|
36
|
+
@base-all-unset
|
|
37
|
+
@components[position-relative,d-inline-block,flex-shrink-0,w--x-menu-size:40px,h--x-menu-size:40px,box-sizing-border-box,br--x-menu-radius:8px,c--x-menu-color:slateTheme12,bgc--x-menu-bg:transparent,background-image(linear-gradient(currentColor,currentColor)),background-size(var(--x-menu-icon-width,20px)_var(--x-menu-bar,2px)),background-position-center,background-repeat-no-repeat,cursor-pointer,user-select-none,transition-property-background-color__background-size,transition-duration--x-menu-duration:0.15s,transition-delay(0s,${dur})]
|
|
38
|
+
@components--before[${bar},translate(0_var(--x-menu-shift))]
|
|
39
|
+
@components--after[${bar},translate(0_var(--x-menu-gap,6px))]
|
|
40
|
+
@components--hover-bgc--x-menu-hover-bg:slateTheme3
|
|
41
|
+
@components--focus-visible[outline-style-solid,outline-width-2px,outline-color--x-form-accent-color:accentRA1000,outline-offset-2px]
|
|
42
|
+
@components--disabled[o-0.5,cursor-not-allowed]
|
|
43
|
+
${openState('[aria-expanded=true]')}
|
|
44
|
+
${openState('[class~=x-menu-open]')}
|
|
45
|
+
@motion-reduce[transition-duration-0s,transition-delay-0s]
|
|
46
|
+
@motion-reduce--before[transition-duration-0s,transition-delay-0s]
|
|
47
|
+
@motion-reduce--after[transition-duration-0s,transition-delay-0s]
|
|
48
|
+
`
|
|
49
|
+
},
|
|
50
|
+
'x-menu-sm': { type: 'statement', statement: `--x-menu-size:32px --x-menu-icon-width:16px --x-menu-gap:5px --x-menu-radius:6px` },
|
|
51
|
+
'x-menu-lg': { type: 'statement', statement: `--x-menu-size:48px --x-menu-icon-width:24px --x-menu-gap:7px --x-menu-radius:10px` },
|
|
52
|
+
'x-menu-bold': { type: 'statement', statement: `--x-menu-bar:3px` },
|
|
53
|
+
'x-menu-plain': { type: 'statement', statement: `--x-menu-hover-bg:transparent` },
|
|
54
|
+
};
|
|
55
|
+
export default menuComponents;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
declare const navContent: {
|
|
2
|
+
'x-tab-list': {
|
|
3
|
+
type: string;
|
|
4
|
+
statement: string;
|
|
5
|
+
};
|
|
6
|
+
'x-tab': {
|
|
7
|
+
type: string;
|
|
8
|
+
statement: string;
|
|
9
|
+
};
|
|
10
|
+
'x-tab-panel': {
|
|
11
|
+
type: string;
|
|
12
|
+
statement: string;
|
|
13
|
+
};
|
|
14
|
+
'x-tab-list-pills': {
|
|
15
|
+
type: string;
|
|
16
|
+
statement: string;
|
|
17
|
+
};
|
|
18
|
+
'x-breadcrumb': {
|
|
19
|
+
type: string;
|
|
20
|
+
statement: string;
|
|
21
|
+
};
|
|
22
|
+
'x-pagination': {
|
|
23
|
+
type: string;
|
|
24
|
+
statement: string;
|
|
25
|
+
};
|
|
26
|
+
'x-dropdown': {
|
|
27
|
+
type: string;
|
|
28
|
+
statement: string;
|
|
29
|
+
};
|
|
30
|
+
'x-dropdown-item': {
|
|
31
|
+
type: string;
|
|
32
|
+
statement: string;
|
|
33
|
+
};
|
|
34
|
+
'x-dropdown-item-danger': {
|
|
35
|
+
type: string;
|
|
36
|
+
statement: string;
|
|
37
|
+
};
|
|
38
|
+
'x-dropdown-divider': {
|
|
39
|
+
type: string;
|
|
40
|
+
statement: string;
|
|
41
|
+
};
|
|
42
|
+
'x-dropdown-label': {
|
|
43
|
+
type: string;
|
|
44
|
+
statement: string;
|
|
45
|
+
};
|
|
46
|
+
'x-prose': {
|
|
47
|
+
type: string;
|
|
48
|
+
statement: string;
|
|
49
|
+
};
|
|
50
|
+
'x-prose-sm': {
|
|
51
|
+
type: string;
|
|
52
|
+
statement: string;
|
|
53
|
+
};
|
|
54
|
+
'x-prose-lg': {
|
|
55
|
+
type: string;
|
|
56
|
+
statement: string;
|
|
57
|
+
};
|
|
58
|
+
'x-kbd': {
|
|
59
|
+
type: string;
|
|
60
|
+
statement: string;
|
|
61
|
+
};
|
|
62
|
+
'x-code': {
|
|
63
|
+
type: string;
|
|
64
|
+
statement: string;
|
|
65
|
+
};
|
|
66
|
+
'x-code-block': {
|
|
67
|
+
type: string;
|
|
68
|
+
statement: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export default navContent;
|