@navecss/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ATOMS.md +109 -0
- package/CONSUMER-ATOMS.md +332 -0
- package/LICENSE +21 -0
- package/README.md +264 -0
- package/dist/atomic.css +288 -0
- package/dist/atoms.d.ts +413 -0
- package/dist/atoms.js +1 -0
- package/dist/chunk-BVON7XKC.js +394 -0
- package/dist/cx.d.ts +72 -0
- package/dist/cx.js +9 -0
- package/dist/index.css +48 -0
- package/dist/layers.css +15 -0
- package/dist/no-tokens.css +52 -0
- package/dist/postcss.d.ts +64 -0
- package/dist/postcss.js +228 -0
- package/dist/reset.css +346 -0
- package/package.json +93 -0
package/dist/atoms.d.ts
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
type CSSDeclarations = Record<string, string>;
|
|
2
|
+
type PseudoMap = Record<string, CSSDeclarations>;
|
|
3
|
+
interface MediaBlock {
|
|
4
|
+
declarations?: CSSDeclarations;
|
|
5
|
+
pseudos?: PseudoMap;
|
|
6
|
+
}
|
|
7
|
+
interface AtomDefinition {
|
|
8
|
+
declarations: CSSDeclarations;
|
|
9
|
+
pseudos?: PseudoMap;
|
|
10
|
+
media?: Record<string, MediaBlock>;
|
|
11
|
+
container?: Record<string, MediaBlock>;
|
|
12
|
+
}
|
|
13
|
+
declare const atoms: {
|
|
14
|
+
readonly flex: {
|
|
15
|
+
readonly declarations: {
|
|
16
|
+
readonly display: "flex";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly inlineFlex: {
|
|
20
|
+
readonly declarations: {
|
|
21
|
+
readonly display: "inline-flex";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
readonly grid: {
|
|
25
|
+
readonly declarations: {
|
|
26
|
+
readonly display: "grid";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly block: {
|
|
30
|
+
readonly declarations: {
|
|
31
|
+
readonly display: "block";
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly inlineBlock: {
|
|
35
|
+
readonly declarations: {
|
|
36
|
+
readonly display: "inline-block";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly hidden: {
|
|
40
|
+
readonly declarations: {
|
|
41
|
+
readonly display: "none";
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
readonly flexCol: {
|
|
45
|
+
readonly declarations: {
|
|
46
|
+
readonly 'flex-direction': "column";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly flexWrap: {
|
|
50
|
+
readonly declarations: {
|
|
51
|
+
readonly 'flex-wrap': "wrap";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly itemsCenter: {
|
|
55
|
+
readonly declarations: {
|
|
56
|
+
readonly 'align-items': "center";
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
readonly itemsStart: {
|
|
60
|
+
readonly declarations: {
|
|
61
|
+
readonly 'align-items': "flex-start";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly itemsEnd: {
|
|
65
|
+
readonly declarations: {
|
|
66
|
+
readonly 'align-items': "flex-end";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
readonly justifyCenter: {
|
|
70
|
+
readonly declarations: {
|
|
71
|
+
readonly 'justify-content': "center";
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
readonly justifyBetween: {
|
|
75
|
+
readonly declarations: {
|
|
76
|
+
readonly 'justify-content': "space-between";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly justifyEnd: {
|
|
80
|
+
readonly declarations: {
|
|
81
|
+
readonly 'justify-content': "flex-end";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
readonly flexGrow: {
|
|
85
|
+
readonly declarations: {
|
|
86
|
+
readonly 'flex-grow': "1";
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
readonly flexShrink0: {
|
|
90
|
+
readonly declarations: {
|
|
91
|
+
readonly 'flex-shrink': "0";
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
readonly gap: {
|
|
95
|
+
readonly declarations: {
|
|
96
|
+
readonly gap: "var(--nave-spacing-content-md)";
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
readonly relative: {
|
|
100
|
+
readonly declarations: {
|
|
101
|
+
readonly position: "relative";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
readonly absolute: {
|
|
105
|
+
readonly declarations: {
|
|
106
|
+
readonly position: "absolute";
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
readonly insetFull: {
|
|
110
|
+
readonly declarations: {
|
|
111
|
+
readonly inset: "0";
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
readonly wFull: {
|
|
115
|
+
readonly declarations: {
|
|
116
|
+
readonly width: "100%";
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
readonly hFull: {
|
|
120
|
+
readonly declarations: {
|
|
121
|
+
readonly height: "100%";
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
readonly minW0: {
|
|
125
|
+
readonly declarations: {
|
|
126
|
+
readonly 'min-width': "0";
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
readonly truncate: {
|
|
130
|
+
readonly declarations: {
|
|
131
|
+
readonly overflow: "hidden";
|
|
132
|
+
readonly 'text-overflow': "ellipsis";
|
|
133
|
+
readonly 'white-space': "nowrap";
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* srOnly — visually hidden, accessible to screen readers.
|
|
138
|
+
* Every property in the shared declaration set is load-bearing: the 1x1 box
|
|
139
|
+
* stays in the accessibility tree where display: none would not, the box is
|
|
140
|
+
* 1px rather than 0 because a zero-size box is dropped from that tree by some
|
|
141
|
+
* assistive technology, the negative margin cancels it out of layout flow,
|
|
142
|
+
* clip-path is used rather than clip so it keeps working if a consumer
|
|
143
|
+
* overrides position, and nowrap stops long text rendering as a visible
|
|
144
|
+
* column of single characters. Do not simplify.
|
|
145
|
+
*/
|
|
146
|
+
readonly srOnly: {
|
|
147
|
+
readonly declarations: CSSDeclarations;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* srOnlyFocusable — srOnly that reveals itself when it (or a descendant)
|
|
151
|
+
* receives keyboard focus. The skip-link pattern needs this: an element
|
|
152
|
+
* hidden until it receives keyboard focus. Plain srOnly on a skip link
|
|
153
|
+
* produces a focusable element that is permanently invisible, so a
|
|
154
|
+
* keyboard user tabs into apparent nothingness.
|
|
155
|
+
*
|
|
156
|
+
* :focus-visible — the element itself is the focusable (e.g. the skip
|
|
157
|
+
* link anchor carries this atom directly).
|
|
158
|
+
* :focus-within — the hidden element wraps the focusable rather than
|
|
159
|
+
* being it.
|
|
160
|
+
*/
|
|
161
|
+
readonly srOnlyFocusable: {
|
|
162
|
+
readonly declarations: CSSDeclarations;
|
|
163
|
+
readonly pseudos: {
|
|
164
|
+
readonly ':focus-visible': CSSDeclarations;
|
|
165
|
+
readonly ':focus-within': CSSDeclarations;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
readonly noWrap: {
|
|
169
|
+
readonly declarations: {
|
|
170
|
+
readonly 'white-space': "nowrap";
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
readonly breakWord: {
|
|
174
|
+
readonly declarations: {
|
|
175
|
+
readonly 'overflow-wrap': "break-word";
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
readonly textLeft: {
|
|
179
|
+
readonly declarations: {
|
|
180
|
+
readonly 'text-align': "left";
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
readonly textCenter: {
|
|
184
|
+
readonly declarations: {
|
|
185
|
+
readonly 'text-align': "center";
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
readonly textRight: {
|
|
189
|
+
readonly declarations: {
|
|
190
|
+
readonly 'text-align': "right";
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* interactive — base for any clickable non-button element.
|
|
195
|
+
* -webkit-tap-highlight-color removes the grey tap flash on iOS/Android.
|
|
196
|
+
* -webkit-user-select is required alongside user-select: every released Safari and every
|
|
197
|
+
* iOS browser (all WebKit-based, regardless of the label on the tin) reads only the
|
|
198
|
+
* prefixed property; the unprefixed one is Safari-preview-only per BCD.
|
|
199
|
+
*/
|
|
200
|
+
readonly interactive: {
|
|
201
|
+
readonly declarations: {
|
|
202
|
+
readonly cursor: "pointer";
|
|
203
|
+
readonly '-webkit-user-select': "none";
|
|
204
|
+
readonly 'user-select': "none";
|
|
205
|
+
readonly '-webkit-tap-highlight-color': "transparent";
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* focusRing — keyboard focus indicator.
|
|
210
|
+
* :focus-visible — keyboard users see it, mouse users do not.
|
|
211
|
+
*/
|
|
212
|
+
readonly focusRing: {
|
|
213
|
+
readonly declarations: {
|
|
214
|
+
readonly outline: "none";
|
|
215
|
+
};
|
|
216
|
+
readonly pseudos: {
|
|
217
|
+
readonly ':focus-visible': {
|
|
218
|
+
readonly outline: "var(--nave-border-width-focus) solid var(--nave-color-border-focus)";
|
|
219
|
+
readonly 'outline-offset': "2px";
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* disabledState — visual + behavioural disabled treatment.
|
|
225
|
+
* Applies from either the native `disabled` attribute or
|
|
226
|
+
* `aria-disabled="true"`. On the aria-disabled branch the element stays
|
|
227
|
+
* focusable by design: this atom only blocks pointer activation
|
|
228
|
+
* (pointer-events: none), so the component's own activation handler must
|
|
229
|
+
* also check the attribute and no-op on Enter and Space, since CSS cannot
|
|
230
|
+
* prevent keyboard activation.
|
|
231
|
+
*
|
|
232
|
+
* Expresses disablement through the dedicated disabled colour tokens
|
|
233
|
+
* (content.disabled, border.disabled) rather than a blanket opacity: a
|
|
234
|
+
* uniform dim composites everything the element paints, including a
|
|
235
|
+
* focusRing outline on the aria-disabled branch.
|
|
236
|
+
* `color` also carries inline icons (reset.css's `svg:not([fill])
|
|
237
|
+
* { fill: currentcolor }`); `border-color` is inert on a borderless
|
|
238
|
+
* element. Deliberately silent on `background-color`: the atom cannot
|
|
239
|
+
* know whether the element is a filled control, a ghost button, a link
|
|
240
|
+
* or a label, so a filled control's disabled fill is a component
|
|
241
|
+
* obligation, not this atom's.
|
|
242
|
+
*
|
|
243
|
+
* No `cursor` here: `pointer-events: none` stops the element from ever being hit-tested,
|
|
244
|
+
* so a `cursor` declared on it can never paint (the browser resolves the pointer against
|
|
245
|
+
* whatever is underneath instead). That is equally true of reset.css's
|
|
246
|
+
* `[disabled], [aria-disabled='true'] { cursor: not-allowed }` on an element carrying this
|
|
247
|
+
* atom: while the atom applies, no cursor paints on that element at all. The reset rule
|
|
248
|
+
* serves the disabled elements that do NOT carry this atom. What is removed here is a
|
|
249
|
+
* declaration that never rendered, so nothing a user sees changes.
|
|
250
|
+
*/
|
|
251
|
+
readonly disabledState: {
|
|
252
|
+
readonly declarations: {};
|
|
253
|
+
readonly pseudos: {
|
|
254
|
+
readonly ':disabled, [aria-disabled="true"]': {
|
|
255
|
+
readonly color: "var(--nave-color-content-disabled)";
|
|
256
|
+
readonly 'border-color': "var(--nave-color-border-disabled)";
|
|
257
|
+
readonly 'pointer-events': "none";
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
readonly rounded: {
|
|
262
|
+
readonly declarations: {
|
|
263
|
+
readonly 'border-radius': "var(--nave-radius-control)";
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
readonly roundedCard: {
|
|
267
|
+
readonly declarations: {
|
|
268
|
+
readonly 'border-radius': "var(--nave-radius-card)";
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
readonly roundedFull: {
|
|
272
|
+
readonly declarations: {
|
|
273
|
+
readonly 'border-radius': "var(--nave-radius-full)";
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
readonly border: {
|
|
277
|
+
readonly declarations: {
|
|
278
|
+
readonly border: "var(--nave-border-width-sm) solid var(--nave-color-border-default)";
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
readonly overflowHidden: {
|
|
282
|
+
readonly declarations: {
|
|
283
|
+
readonly overflow: "hidden";
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
readonly overflowAuto: {
|
|
287
|
+
readonly declarations: {
|
|
288
|
+
readonly overflow: "auto";
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
readonly transition: {
|
|
292
|
+
readonly declarations: {
|
|
293
|
+
readonly 'transition-property': "color, background-color, border-color, opacity, box-shadow";
|
|
294
|
+
readonly 'transition-duration': "var(--nave-motion-duration-base)";
|
|
295
|
+
readonly 'transition-timing-function': "var(--nave-motion-easing-standard)";
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* container
|
|
300
|
+
* Establishes an inline-size containment context.
|
|
301
|
+
* Apply to the wrapper of any component that uses @container queries.
|
|
302
|
+
* Required — container queries have no effect without a containment ancestor.
|
|
303
|
+
*/
|
|
304
|
+
readonly container: {
|
|
305
|
+
readonly declarations: {
|
|
306
|
+
readonly 'container-type': "inline-size";
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* hidePhoneOnly
|
|
311
|
+
* Hidden on phone. Visible on tablet portrait and above.
|
|
312
|
+
* Use for: elements that have a dedicated phone replacement.
|
|
313
|
+
*/
|
|
314
|
+
readonly hidePhoneOnly: {
|
|
315
|
+
readonly declarations: {};
|
|
316
|
+
readonly media: {
|
|
317
|
+
readonly "(width < 37.5em)": {
|
|
318
|
+
readonly declarations: {
|
|
319
|
+
readonly display: "none";
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* hideTabletPortraitUp
|
|
326
|
+
* Hidden on tablet portrait and above. Visible on phone only.
|
|
327
|
+
* Use for: mobile-only elements (hamburger triggers, bottom nav, etc.)
|
|
328
|
+
*/
|
|
329
|
+
readonly hideTabletPortraitUp: {
|
|
330
|
+
readonly declarations: {};
|
|
331
|
+
readonly media: {
|
|
332
|
+
readonly "(width >= 37.5em)": {
|
|
333
|
+
readonly declarations: {
|
|
334
|
+
readonly display: "none";
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* hideTabletLandscapeUp
|
|
341
|
+
* Hidden on tablet landscape and above. Visible on phone and tablet portrait.
|
|
342
|
+
* Use for: compact tablet navigation that gives way to a full desktop nav.
|
|
343
|
+
*/
|
|
344
|
+
readonly hideTabletLandscapeUp: {
|
|
345
|
+
readonly declarations: {};
|
|
346
|
+
readonly media: {
|
|
347
|
+
readonly "(width >= 56.25em)": {
|
|
348
|
+
readonly declarations: {
|
|
349
|
+
readonly display: "none";
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* hideDesktopUp
|
|
356
|
+
* Hidden on desktop and above. Visible on tablet landscape and below.
|
|
357
|
+
* Use for: mobile/tablet UI that has a desktop structural replacement.
|
|
358
|
+
*/
|
|
359
|
+
readonly hideDesktopUp: {
|
|
360
|
+
readonly declarations: {};
|
|
361
|
+
readonly media: {
|
|
362
|
+
readonly "(width >= 75em)": {
|
|
363
|
+
readonly declarations: {
|
|
364
|
+
readonly display: "none";
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
* stackPhoneOnly
|
|
371
|
+
* flex-direction: column on phone. Assumes the element is display: flex.
|
|
372
|
+
* Use for: button groups, form rows, icon+label pairs that stack on mobile.
|
|
373
|
+
*/
|
|
374
|
+
readonly stackPhoneOnly: {
|
|
375
|
+
readonly declarations: {};
|
|
376
|
+
readonly media: {
|
|
377
|
+
readonly "(width < 37.5em)": {
|
|
378
|
+
readonly declarations: {
|
|
379
|
+
readonly 'flex-direction': "column";
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* wFullPhoneOnly
|
|
386
|
+
* width: 100% on phone only.
|
|
387
|
+
* Use for: buttons and inputs that should be full-width on mobile.
|
|
388
|
+
*/
|
|
389
|
+
readonly wFullPhoneOnly: {
|
|
390
|
+
readonly declarations: {};
|
|
391
|
+
readonly media: {
|
|
392
|
+
readonly "(width < 37.5em)": {
|
|
393
|
+
readonly declarations: {
|
|
394
|
+
readonly width: "100%";
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
type AtomName = keyof typeof atoms;
|
|
401
|
+
/**
|
|
402
|
+
* Converts a camelCase atom name to its nave-kebab-case CSS class name.
|
|
403
|
+
* focusRing → nave-focus-ring
|
|
404
|
+
*/
|
|
405
|
+
declare const toClassName: (name: AtomName) => string;
|
|
406
|
+
/**
|
|
407
|
+
* Map of atom name → global CSS class name.
|
|
408
|
+
* Used by cx() and the PostCSS plugin.
|
|
409
|
+
* Only covers Nave built-in atoms — consumer atoms are @nave-directive only.
|
|
410
|
+
*/
|
|
411
|
+
declare const atomClassMap: Record<AtomName, string>;
|
|
412
|
+
|
|
413
|
+
export { type AtomDefinition, type AtomName, atomClassMap, atoms, toClassName };
|
package/dist/atoms.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { atomClassMap, atoms, toClassName } from './chunk-BVON7XKC.js';
|