@prunellejs/ui 0.1.1 → 0.5.3

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.
Files changed (60) hide show
  1. package/llms.txt +9 -3
  2. package/package.json +2 -2
  3. package/src/CommandPalette.tsx +120 -67
  4. package/src/DataTable.tsx +27 -17
  5. package/src/Dialog.tsx +29 -13
  6. package/src/Menu.tsx +10 -8
  7. package/src/Select.tsx +16 -6
  8. package/src/Toaster.tsx +112 -2
  9. package/src/behaviors.ts +108 -6
  10. package/src/index.ts +1 -1
  11. package/src/plugin.ts +96 -32
  12. package/src/styles/bare.css +21 -312
  13. package/src/styles/base.css +55 -0
  14. package/src/styles/components/accordion.css +10 -0
  15. package/src/styles/components/badge.css +6 -0
  16. package/src/styles/components/button.css +11 -0
  17. package/src/styles/components/card.css +5 -0
  18. package/src/styles/components/checkbox.css +11 -0
  19. package/src/styles/components/command.css +25 -0
  20. package/src/styles/components/datatable.css +9 -0
  21. package/src/styles/components/dialog.css +16 -0
  22. package/src/styles/components/drawer.css +29 -0
  23. package/src/styles/components/field.css +8 -0
  24. package/src/styles/components/layout.css +69 -0
  25. package/src/styles/components/menu.css +21 -0
  26. package/src/styles/components/notice.css +5 -0
  27. package/src/styles/components/popover.css +8 -0
  28. package/src/styles/components/progress.css +14 -0
  29. package/src/styles/components/radio-group.css +11 -0
  30. package/src/styles/components/select.css +25 -0
  31. package/src/styles/components/switch.css +42 -0
  32. package/src/styles/components/tabs.css +4 -0
  33. package/src/styles/components/toast.css +28 -0
  34. package/src/styles/grammars/console.css +113 -256
  35. package/src/styles/grammars/editorial.css +99 -270
  36. package/src/styles/grammars/orbit.css +118 -388
  37. package/src/styles/grammars/prunelle.css +157 -360
  38. package/src/styles/grammars/soft.css +103 -237
  39. package/src/styles/grammars/workshop.css +104 -246
  40. package/src/styles/scan.ts +137 -0
  41. package/src/styles/split.ts +381 -0
  42. package/src/styles/theme.css +21 -0
  43. package/src/styles/themed/accordion.css +20 -0
  44. package/src/styles/themed/badge.css +20 -0
  45. package/src/styles/themed/button.css +21 -0
  46. package/src/styles/themed/card.css +23 -0
  47. package/src/styles/themed/checkbox.css +4 -0
  48. package/src/styles/themed/command.css +33 -0
  49. package/src/styles/themed/datatable.css +28 -0
  50. package/src/styles/themed/dialog.css +13 -0
  51. package/src/styles/themed/drawer.css +13 -0
  52. package/src/styles/themed/field.css +22 -0
  53. package/src/styles/themed/menu.css +21 -0
  54. package/src/styles/themed/notice.css +17 -0
  55. package/src/styles/themed/popover.css +11 -0
  56. package/src/styles/themed/radio-group.css +12 -0
  57. package/src/styles/themed/select.css +32 -0
  58. package/src/styles/themed/switch.css +18 -0
  59. package/src/styles/themed/tabs.css +17 -0
  60. package/src/styles/themed/toast.css +18 -0
@@ -0,0 +1,381 @@
1
+ // Per-component CSS assembly and grammar splitting for @prunellejs/ui.
2
+ // Keeps `base.css`, structural `components/*.css`, tokenized `themed/*.css`, and thin `grammars/*.css`
3
+ // composable both as full self-contained sheets and as minimal per-route component subsets.
4
+
5
+ import { existsSync, readFileSync } from 'node:fs'
6
+ import { join } from 'node:path'
7
+
8
+ export type GrammarName = 'bare' | 'editorial' | 'workshop' | 'console' | 'soft' | 'orbit' | 'prunelle'
9
+
10
+ export const GRAMMAR_NAMES: readonly GrammarName[] = ['bare', 'editorial', 'workshop', 'console', 'soft', 'orbit', 'prunelle']
11
+
12
+ export const UI_COMPONENT_PARTS = [
13
+ 'layout',
14
+ 'button',
15
+ 'card',
16
+ 'badge',
17
+ 'notice',
18
+ 'field',
19
+ 'checkbox',
20
+ 'switch',
21
+ 'radio-group',
22
+ 'progress',
23
+ 'accordion',
24
+ 'tabs',
25
+ 'dialog',
26
+ 'drawer',
27
+ 'command',
28
+ 'popover',
29
+ 'menu',
30
+ 'select',
31
+ 'toast',
32
+ 'datatable',
33
+ ] as const
34
+
35
+ export type UiComponentPart = (typeof UI_COMPONENT_PARTS)[number]
36
+
37
+ const PART_SET = new Set<string>(UI_COMPONENT_PARTS)
38
+
39
+ /** Maps every `@prunellejs/ui` TSX/runtime export to the CSS component parts it renders (including transitive parts). */
40
+ export const UI_EXPORT_TO_PARTS: Readonly<Record<string, readonly UiComponentPart[]>> = {
41
+ Stack: ['layout'],
42
+ Cluster: ['layout'],
43
+ Grid: ['layout'],
44
+ Sidebar: ['layout'],
45
+ Split: ['layout'],
46
+ Button: ['button'],
47
+ Card: ['card'],
48
+ CardHeader: ['card'],
49
+ CardBody: ['card'],
50
+ CardFooter: ['card'],
51
+ Badge: ['badge'],
52
+ Notice: ['notice'],
53
+ Field: ['field'],
54
+ Checkbox: ['checkbox'],
55
+ Switch: ['switch'],
56
+ RadioGroup: ['radio-group'],
57
+ Progress: ['progress'],
58
+ Accordion: ['accordion'],
59
+ AccordionItem: ['accordion'],
60
+ Popover: ['popover', 'button'],
61
+ Dialog: ['dialog', 'button', 'layout'],
62
+ ControlledDialog: ['dialog', 'button', 'layout'],
63
+ Drawer: ['drawer', 'button', 'layout'],
64
+ ControlledDrawer: ['drawer', 'button', 'layout'],
65
+ Tabs: ['tabs'],
66
+ Menu: ['menu', 'button'],
67
+ Select: ['select'],
68
+ CommandPalette: ['command', 'button'],
69
+ DataTable: ['datatable', 'layout', 'button'],
70
+ Toaster: ['toast'],
71
+ toast: ['toast'],
72
+ }
73
+
74
+ const STYLES_DIR = import.meta.dir
75
+
76
+ export function grammarCssPath(grammar: GrammarName): string {
77
+ return grammar === 'bare'
78
+ ? join(STYLES_DIR, 'bare.css')
79
+ : join(STYLES_DIR, 'grammars', `${grammar}.css`)
80
+ }
81
+
82
+ interface TaggedBlock {
83
+ css: string
84
+ parts: readonly UiComponentPart[] | null
85
+ }
86
+
87
+ interface ParsedGrammar {
88
+ header: string
89
+ topRules: TaggedBlock[]
90
+ baseBlocks: string[]
91
+ partBlocks: TaggedBlock[]
92
+ }
93
+
94
+ const DATA_UI_RE = /\[data-ui="([^"]+)"\]/g
95
+ const DATA_LAYOUT_RE = /\[data-layout(?:="[^"]*")?\]/
96
+ const PART_TAG_RE = /\/\*\s*@part:\s*([^*]+?)\s*\*\//
97
+ const LEADING_COMMENT_RE = /^\s*(\/\*[\s\S]*?\*\/)/
98
+
99
+ function resolveDataUiPart(name: string): UiComponentPart | undefined {
100
+ if (name === 'table')
101
+ return 'datatable'
102
+ if (name === 'toaster')
103
+ return 'toast'
104
+ return PART_SET.has(name) ? (name as UiComponentPart) : undefined
105
+ }
106
+
107
+ function detectBlockParts(prelude: string, partComment: string | undefined): readonly UiComponentPart[] | null {
108
+ if (partComment !== undefined) {
109
+ const tagged = partComment
110
+ .split(',')
111
+ .map(s => s.trim())
112
+ .filter((s): s is UiComponentPart => PART_SET.has(s))
113
+ return tagged.length > 0 ? tagged : null
114
+ }
115
+ const found = new Set<UiComponentPart>()
116
+ if (DATA_LAYOUT_RE.test(prelude))
117
+ found.add('layout')
118
+ for (const match of prelude.matchAll(DATA_UI_RE)) {
119
+ const part = resolveDataUiPart(match[1]!)
120
+ if (part !== undefined)
121
+ found.add(part)
122
+ }
123
+ return found.size > 0 ? [...found] : null
124
+ }
125
+
126
+ interface RawBlock {
127
+ prelude: string
128
+ full: string
129
+ partComment: string | undefined
130
+ }
131
+
132
+ function scanTopBlocks(css: string): RawBlock[] {
133
+ const blocks: RawBlock[] = []
134
+ let i = 0
135
+ const n = css.length
136
+ let pendingPart: string | undefined
137
+
138
+ while (i < n) {
139
+ while (i < n && /\s/.test(css[i]!))
140
+ i++
141
+ if (i >= n)
142
+ break
143
+ if (css[i] === '/' && css[i + 1] === '*') {
144
+ const end = css.indexOf('*/', i + 2)
145
+ const commentEnd = end === -1 ? n : end + 2
146
+ const comment = css.slice(i, commentEnd)
147
+ const tag = comment.match(PART_TAG_RE)
148
+ if (tag !== null)
149
+ pendingPart = tag[1]
150
+ i = commentEnd
151
+ continue
152
+ }
153
+
154
+ const start = i
155
+ let depth = 0
156
+ let braceStart = -1
157
+ let quote: string | null = null
158
+
159
+ while (i < n) {
160
+ const ch = css[i]!
161
+ if (quote !== null) {
162
+ if (ch === '\\')
163
+ i++
164
+ else if (ch === quote)
165
+ quote = null
166
+ }
167
+ else if (ch === '"' || ch === '\'') {
168
+ quote = ch
169
+ }
170
+ else if (ch === '/' && css[i + 1] === '*') {
171
+ const end = css.indexOf('*/', i + 2)
172
+ i = end === -1 ? n - 1 : end + 1
173
+ }
174
+ else if (ch === '{') {
175
+ if (depth === 0)
176
+ braceStart = i
177
+ depth++
178
+ }
179
+ else if (ch === '}') {
180
+ depth--
181
+ if (depth === 0) {
182
+ i++
183
+ break
184
+ }
185
+ }
186
+ else if (ch === ';' && depth === 0) {
187
+ i++
188
+ break
189
+ }
190
+ i++
191
+ }
192
+
193
+ const full = css.slice(start, i).trim()
194
+ if (full.length > 0 && !full.startsWith('@import')) {
195
+ const prelude = braceStart === -1 ? full : css.slice(start, braceStart).trim()
196
+ blocks.push({ prelude, full, partComment: pendingPart })
197
+ }
198
+ pendingPart = undefined
199
+ }
200
+ return blocks
201
+ }
202
+
203
+ function unwrapLayerKui(css: string): string {
204
+ const blocks = scanTopBlocks(css)
205
+ const inner: string[] = []
206
+ for (const b of blocks) {
207
+ if (/^@layer\s+kui\b/.test(b.prelude)) {
208
+ const open = b.full.indexOf('{')
209
+ const close = b.full.lastIndexOf('}')
210
+ if (open !== -1 && close > open)
211
+ inner.push(b.full.slice(open + 1, close).trim())
212
+ }
213
+ else {
214
+ inner.push(b.full)
215
+ }
216
+ }
217
+ return inner.join('\n')
218
+ }
219
+
220
+ let cachedBaseBody: string | undefined
221
+ const cachedComponentBodies = new Map<UiComponentPart, string>()
222
+ const cachedThemedBodies = new Map<UiComponentPart, string | null>()
223
+ const cachedGrammars = new Map<GrammarName, ParsedGrammar>()
224
+
225
+ function readBaseBody(): string {
226
+ if (cachedBaseBody === undefined)
227
+ cachedBaseBody = unwrapLayerKui(readFileSync(join(STYLES_DIR, 'base.css'), 'utf8'))
228
+ return cachedBaseBody
229
+ }
230
+
231
+ function readComponentBody(part: UiComponentPart): string {
232
+ let body = cachedComponentBodies.get(part)
233
+ if (body === undefined) {
234
+ body = unwrapLayerKui(readFileSync(join(STYLES_DIR, 'components', `${part}.css`), 'utf8'))
235
+ cachedComponentBodies.set(part, body)
236
+ }
237
+ return body
238
+ }
239
+
240
+ function readThemedBody(part: UiComponentPart): string | null {
241
+ let body = cachedThemedBodies.get(part)
242
+ if (body === undefined) {
243
+ const file = join(STYLES_DIR, 'themed', `${part}.css`)
244
+ body = existsSync(file) ? unwrapLayerKui(readFileSync(file, 'utf8')) : null
245
+ cachedThemedBodies.set(part, body)
246
+ }
247
+ return body
248
+ }
249
+
250
+ function parseGrammar(grammar: GrammarName): ParsedGrammar {
251
+ const existing = cachedGrammars.get(grammar)
252
+ if (existing !== undefined)
253
+ return existing
254
+
255
+ const raw = readFileSync(grammarCssPath(grammar), 'utf8')
256
+ const header = raw.match(LEADING_COMMENT_RE)?.[1] ?? ''
257
+ if (grammar === 'bare') {
258
+ const parsed: ParsedGrammar = { header, topRules: [], baseBlocks: [], partBlocks: [] }
259
+ cachedGrammars.set(grammar, parsed)
260
+ return parsed
261
+ }
262
+
263
+ const topRules: TaggedBlock[] = []
264
+ const baseBlocks: string[] = []
265
+ const partBlocks: TaggedBlock[] = []
266
+
267
+ for (const top of scanTopBlocks(raw)) {
268
+ if (/^@layer\s+kui\b/.test(top.prelude)) {
269
+ const open = top.full.indexOf('{')
270
+ const close = top.full.lastIndexOf('}')
271
+ if (open === -1 || close <= open)
272
+ continue
273
+ const inner = top.full.slice(open + 1, close)
274
+ for (const blk of scanTopBlocks(inner)) {
275
+ const parts = detectBlockParts(blk.prelude, blk.partComment)
276
+ if (parts === null)
277
+ baseBlocks.push(blk.full)
278
+ else
279
+ partBlocks.push({ css: blk.full, parts })
280
+ }
281
+ }
282
+ else {
283
+ topRules.push({ css: top.full, parts: detectBlockParts(top.prelude, top.partComment) })
284
+ }
285
+ }
286
+
287
+ const parsed: ParsedGrammar = { header, topRules, baseBlocks, partBlocks }
288
+ cachedGrammars.set(grammar, parsed)
289
+ return parsed
290
+ }
291
+
292
+ function matchesAnyPart(blockParts: readonly UiComponentPart[] | null, wanted: ReadonlySet<UiComponentPart>): boolean {
293
+ if (blockParts === null)
294
+ return false
295
+ for (const p of blockParts) {
296
+ if (wanted.has(p))
297
+ return true
298
+ }
299
+ return false
300
+ }
301
+
302
+ /** Returns `base.css` plus the grammar's global tokens & root/body rules (excluding component-specific blocks). */
303
+ export function renderGrammarBaseCss(grammar: GrammarName): string {
304
+ const parsed = parseGrammar(grammar)
305
+ const out: string[] = []
306
+ if (parsed.header)
307
+ out.push(parsed.header)
308
+ for (const rule of parsed.topRules) {
309
+ if (rule.parts === null)
310
+ out.push(rule.css)
311
+ }
312
+ const layerBody = [readBaseBody(), ...parsed.baseBlocks].filter(Boolean).join('\n\n')
313
+ out.push(`@layer kui {\n${layerBody}\n}`)
314
+ return `${out.join('\n\n')}\n`
315
+ }
316
+
317
+ /** Returns ONLY the component CSS (structural + tokenized + grammar overrides) for `parts`, in deterministic cascade order inside `@layer kui`. */
318
+ export function renderGrammarPartsCss(grammar: GrammarName, parts: Iterable<UiComponentPart>): string {
319
+ const wanted = new Set<UiComponentPart>()
320
+ for (const p of parts) {
321
+ if (PART_SET.has(p))
322
+ wanted.add(p)
323
+ }
324
+ if (wanted.size === 0)
325
+ return ''
326
+
327
+ const ordered = UI_COMPONENT_PARTS.filter(p => wanted.has(p))
328
+ const parsed = parseGrammar(grammar)
329
+ const out: string[] = []
330
+
331
+ for (const rule of parsed.topRules) {
332
+ if (matchesAnyPart(rule.parts, wanted))
333
+ out.push(rule.css)
334
+ }
335
+
336
+ const layerChunks: string[] = []
337
+ for (const part of ordered)
338
+ layerChunks.push(readComponentBody(part))
339
+
340
+ if (grammar !== 'bare') {
341
+ for (const part of ordered) {
342
+ const themed = readThemedBody(part)
343
+ if (themed !== null)
344
+ layerChunks.push(themed)
345
+ }
346
+ for (const blk of parsed.partBlocks) {
347
+ if (matchesAnyPart(blk.parts, wanted))
348
+ layerChunks.push(blk.css)
349
+ }
350
+ }
351
+
352
+ out.push(`@layer kui {\n${layerChunks.filter(Boolean).join('\n\n')}\n}`)
353
+ return `${out.join('\n\n')}\n`
354
+ }
355
+
356
+ /** Returns the complete self-contained CSS source for a grammar (with all `@import`s resolved). */
357
+ export function renderGrammarCss(grammar: GrammarName): string {
358
+ const parsed = parseGrammar(grammar)
359
+ const out: string[] = []
360
+ if (parsed.header)
361
+ out.push(parsed.header)
362
+ for (const rule of parsed.topRules)
363
+ out.push(rule.css)
364
+
365
+ const layerChunks: string[] = [readBaseBody(), ...parsed.baseBlocks]
366
+ for (const part of UI_COMPONENT_PARTS)
367
+ layerChunks.push(readComponentBody(part))
368
+
369
+ if (grammar !== 'bare') {
370
+ for (const part of UI_COMPONENT_PARTS) {
371
+ const themed = readThemedBody(part)
372
+ if (themed !== null)
373
+ layerChunks.push(themed)
374
+ }
375
+ for (const blk of parsed.partBlocks)
376
+ layerChunks.push(blk.css)
377
+ }
378
+
379
+ out.push(`@layer kui {\n${layerChunks.filter(Boolean).join('\n\n')}\n}`)
380
+ return `${out.join('\n\n')}\n`
381
+ }
@@ -0,0 +1,21 @@
1
+ /* @prunellejs/ui tokenized component layer: shared by all 6 themed grammars inside @layer kui. */
2
+
3
+ @import './bare.css';
4
+ @import './themed/button.css';
5
+ @import './themed/card.css';
6
+ @import './themed/badge.css';
7
+ @import './themed/notice.css';
8
+ @import './themed/field.css';
9
+ @import './themed/checkbox.css';
10
+ @import './themed/switch.css';
11
+ @import './themed/radio-group.css';
12
+ @import './themed/accordion.css';
13
+ @import './themed/tabs.css';
14
+ @import './themed/dialog.css';
15
+ @import './themed/drawer.css';
16
+ @import './themed/command.css';
17
+ @import './themed/popover.css';
18
+ @import './themed/menu.css';
19
+ @import './themed/select.css';
20
+ @import './themed/toast.css';
21
+ @import './themed/datatable.css';
@@ -0,0 +1,20 @@
1
+ @layer kui {
2
+ [data-ui="accordion"] details {
3
+ border: var(--ui-acc-bd, none);
4
+ border-bottom: var(--ui-acc-bb, var(--ui-acc-bd, none));
5
+ border-radius: var(--ui-acc-r, 0);
6
+ background: var(--ui-acc-bg, transparent);
7
+ padding: var(--ui-acc-ipad, 0);
8
+ & + details { margin-block-start: var(--ui-acc-gap, 0); }
9
+ }
10
+ [data-ui="accordion"] summary[data-part="trigger"] {
11
+ justify-content: var(--ui-acc-jc, space-between);
12
+ gap: 0.5rem;
13
+ padding: var(--ui-acc-tpad, 0.85rem 0);
14
+ font: var(--ui-acc-tf, 600 1rem/1.3 var(--ui-font-body));
15
+ color: var(--ui-ink);
16
+ &::after { content: var(--ui-acc-m, none); color: var(--ui-muted); font-family: var(--ui-font-body); }
17
+ }
18
+ [data-ui="accordion"] details[open] summary[data-part="trigger"]::after { content: var(--ui-acc-mo, var(--ui-acc-m, none)); }
19
+ [data-ui="accordion"] [data-part="content"] { padding: var(--ui-acc-cpad, 0 0 1rem); color: var(--ui-muted); }
20
+ }
@@ -0,0 +1,20 @@
1
+ @layer kui {
2
+ [data-ui="badge"] {
3
+ font: var(--ui-badge-f, 600 0.74rem/1 var(--ui-font-body));
4
+ padding: var(--ui-badge-pad, 0.25rem 0.55rem);
5
+ border: var(--ui-badge-bd, none);
6
+ border-radius: var(--ui-badge-r, var(--ui-radius));
7
+ background: var(--ui-badge-bg, transparent);
8
+ color: var(--ui-badge-fg, var(--ui-muted));
9
+
10
+ &[data-tone="accent"] { --ui-tone: var(--ui-accent); }
11
+ &[data-tone="success"] { --ui-tone: var(--ui-success); }
12
+ &[data-tone="warning"] { --ui-tone: var(--ui-warning); }
13
+ &[data-tone="danger"] { --ui-tone: var(--ui-danger); }
14
+ &[data-tone] {
15
+ color: var(--ui-badge-tfg, var(--ui-tone));
16
+ background: color-mix(in srgb, var(--ui-tone) var(--ui-badge-tbg, 0%), transparent);
17
+ border-color: color-mix(in srgb, var(--ui-tone) var(--ui-badge-tbd, 100%), var(--ui-badge-tbd0, transparent));
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,21 @@
1
+ @layer kui {
2
+ [data-ui="button"] {
3
+ gap: var(--ui-btn-gap, 0.5rem);
4
+ min-block-size: max(var(--ui-touch-min, 0px), var(--ui-btn-h, 0px));
5
+ font: var(--ui-btn-f, 500 0.88rem/1 var(--ui-font-body));
6
+ padding: var(--ui-btn-pad, 0.6rem 1.1rem);
7
+ border-radius: var(--ui-btn-r, var(--ui-radius));
8
+ border: var(--ui-btn-bd, 1px solid var(--ui-line-strong));
9
+ background: var(--ui-btn-bg, var(--ui-surface));
10
+ color: var(--ui-btn-fg, var(--ui-ink));
11
+ transition: background var(--ui-motion), color var(--ui-motion), border-color var(--ui-motion), box-shadow var(--ui-motion), transform var(--ui-motion);
12
+
13
+ &:disabled { opacity: 0.45; }
14
+ &[data-variant="outline"] { background: transparent; color: var(--ui-ink); border-color: var(--ui-line-strong); }
15
+ &[data-variant="ghost"] { background: transparent; border-color: transparent; color: var(--ui-ink); box-shadow: none; }
16
+ &[data-tone="accent"] { background: var(--ui-accent-fill, var(--ui-accent)); border-color: var(--ui-accent-fill, var(--ui-accent)); color: var(--ui-on-accent); text-decoration: none; }
17
+ &[data-tone="danger"] { background: var(--ui-danger); border-color: var(--ui-danger); color: var(--ui-on-accent); }
18
+ &[data-size="sm"] { min-block-size: max(var(--ui-touch-min, 0px), var(--ui-btn-sm-h, 0px)); font-size: var(--ui-btn-sm-fs, 0.8rem); padding: var(--ui-btn-sm-pad, 0.45rem 0.85rem); }
19
+ &[data-size="lg"] { min-block-size: max(var(--ui-touch-min, 0px), var(--ui-btn-lg-h, 0px)); font-size: var(--ui-btn-lg-fs, 0.98rem); padding: var(--ui-btn-lg-pad, 0.85rem 1.5rem); }
20
+ }
21
+ }
@@ -0,0 +1,23 @@
1
+ @layer kui {
2
+ [data-ui="card"] {
3
+ border: var(--ui-card-bd, 1px solid var(--ui-line));
4
+ border-radius: var(--ui-radius);
5
+ background: var(--ui-card-bg, var(--ui-surface));
6
+ color: var(--ui-ink);
7
+ padding: var(--ui-card-pad, 1.15rem 1.25rem);
8
+ font-family: var(--ui-font-body);
9
+
10
+ & [data-part="header"] {
11
+ font: var(--ui-card-hf, 600 1.05rem/1.3 var(--ui-font-display, var(--ui-font-body)));
12
+ margin-block-end: var(--ui-card-hmb, 0.7rem);
13
+ padding-block-end: var(--ui-card-hpb, 0);
14
+ border-bottom: var(--ui-card-hbd, none);
15
+ }
16
+ & [data-part="footer"] {
17
+ margin-block-start: var(--ui-card-fmt, 1rem);
18
+ padding-block-start: var(--ui-card-fpt, 0);
19
+ border-top: var(--ui-card-fbd, none);
20
+ color: var(--ui-muted);
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,4 @@
1
+ @layer kui {
2
+ [data-ui="checkbox"] { font-size: var(--ui-chk-fs, inherit); }
3
+ [data-ui="checkbox"] input { accent-color: var(--ui-chk-acc, var(--ui-accent-fill, var(--ui-accent))); }
4
+ }
@@ -0,0 +1,33 @@
1
+ @layer kui {
2
+ dialog[data-ui="command"] {
3
+ border: var(--ui-dlg-bd, 1px solid var(--ui-line-strong));
4
+ border-radius: var(--ui-dlg-r, var(--ui-radius));
5
+ background: var(--ui-dlg-bg, var(--ui-surface));
6
+ color: var(--ui-ink);
7
+ box-shadow: var(--ui-dlg-sh, none);
8
+ font-family: var(--ui-font-body);
9
+
10
+ & [data-part="input"] {
11
+ border: 0;
12
+ border-bottom: var(--ui-cmd-ibb, 1px solid var(--ui-line));
13
+ background: var(--ui-cmd-ibg, transparent);
14
+ color: var(--ui-ink);
15
+ padding: var(--ui-cmd-ipad, 0.85rem 1rem);
16
+ font: var(--ui-cmd-if, 400 0.95rem/1.35 var(--ui-font-body));
17
+ font-size: max(var(--ui-input-floor, 0px), var(--ui-cmd-ifs, 0.95rem));
18
+ &:focus-visible { border-bottom-color: var(--ui-accent); }
19
+ }
20
+ & [data-part="list"] { padding: var(--ui-cmd-lpad, 0.35rem); }
21
+ & [data-part="item"] {
22
+ border: 0;
23
+ border-radius: var(--ui-radius-inner, 0);
24
+ background: transparent;
25
+ color: var(--ui-ink);
26
+ padding: var(--ui-cmd-mpad, 0.5rem 0.7rem);
27
+ font: var(--ui-cmd-mf, 500 0.88rem/1.3 var(--ui-font-body));
28
+ &[data-highlighted="true"] { background: var(--ui-cmd-hbg, var(--ui-surface)); color: var(--ui-cmd-hfg, inherit); }
29
+ }
30
+ & [data-part="kbd"] { font-size: 0.74rem; color: var(--ui-muted); border: 1px solid var(--ui-line); border-radius: var(--ui-radius-inner, 0); padding: 0.1rem 0.35rem; }
31
+ & [data-part="empty"] { padding: 0.9rem 1rem; margin: 0; color: var(--ui-muted); }
32
+ }
33
+ }
@@ -0,0 +1,28 @@
1
+ @layer kui {
2
+ [data-ui="datatable"] {
3
+ font-size: var(--ui-tbl-fs, inherit);
4
+ & [data-part="search"] {
5
+ min-block-size: max(var(--ui-touch-min, 0px), var(--ui-srch-h, 0px));
6
+ border: var(--ui-srch-bd, 1px solid var(--ui-line-strong));
7
+ border-radius: var(--ui-srch-r, var(--ui-radius-inner, var(--ui-radius)));
8
+ background: var(--ui-srch-bg, var(--ui-surface));
9
+ color: var(--ui-ink);
10
+ padding: var(--ui-srch-pad, 0.42rem 0.68rem);
11
+ font: var(--ui-srch-f, 400 0.88rem/1.3 var(--ui-font-body));
12
+ font-size: max(var(--ui-input-floor, 0px), var(--ui-srch-fs, 0.88rem));
13
+ &:focus { border-color: var(--ui-accent); }
14
+ }
15
+ & [data-part="meta"] { font-size: 0.8rem; color: var(--ui-muted); }
16
+ & tr[data-selected="true"] { background: var(--ui-tbl-sel, color-mix(in srgb, var(--ui-accent) 14%, transparent)); }
17
+ & [data-part="sort"][data-active="true"] { color: var(--ui-accent); }
18
+ }
19
+
20
+ table[data-ui="table"],
21
+ [data-ui="datatable"] table {
22
+ border: var(--ui-tbl-bd, none);
23
+ background: var(--ui-tbl-bg, transparent);
24
+ font-size: var(--ui-tbl-fs, inherit);
25
+ & th { border-bottom: var(--ui-th-bb, 1px solid var(--ui-line)); padding: var(--ui-th-pad, 0.55rem 0.65rem); font-size: 0.78rem; text-align: start; }
26
+ & td { border-bottom: var(--ui-td-bb, 1px solid var(--ui-line)); padding: var(--ui-td-pad, 0.6rem 0.65rem); }
27
+ }
28
+ }
@@ -0,0 +1,13 @@
1
+ @layer kui {
2
+ dialog[data-ui="dialog"] {
3
+ border: var(--ui-dlg-bd, 1px solid var(--ui-line-strong));
4
+ border-radius: var(--ui-dlg-r, var(--ui-radius));
5
+ background: var(--ui-dlg-bg, var(--ui-surface));
6
+ color: var(--ui-ink);
7
+ box-shadow: var(--ui-dlg-sh, none);
8
+ font-family: var(--ui-font-body);
9
+ & > [data-part="panel"] { padding: var(--ui-dlg-pad, 1.5rem); }
10
+ & [data-part="title"] { margin: 0 0 0.5rem; font: var(--ui-dlg-tf, 600 1.25rem/1.25 var(--ui-font-display, var(--ui-font-body))); }
11
+ & [data-part="description"] { color: var(--ui-muted); font-size: 0.875rem; }
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ @layer kui {
2
+ dialog[data-ui="drawer"] {
3
+ border: var(--ui-dlg-bd, 1px solid var(--ui-line-strong));
4
+ border-radius: 0;
5
+ background: var(--ui-dlg-bg, var(--ui-surface));
6
+ color: var(--ui-ink);
7
+ box-shadow: var(--ui-dlg-sh, none);
8
+ font-family: var(--ui-font-body);
9
+ & > [data-part="panel"] { padding: var(--ui-drw-pad, var(--ui-dlg-pad, 1.5rem)); }
10
+ & [data-part="title"] { margin: 0 0 0.5rem; font: var(--ui-dlg-tf, 600 1.25rem/1.25 var(--ui-font-display, var(--ui-font-body))); }
11
+ & [data-part="description"] { color: var(--ui-muted); font-size: 0.875rem; }
12
+ }
13
+ }
@@ -0,0 +1,22 @@
1
+ @layer kui {
2
+ [data-ui="field"] {
3
+ gap: var(--ui-fld-gap, 0.35rem);
4
+
5
+ & [data-part="label"] { font: var(--ui-fld-lf, 600 0.8rem/1.2 var(--ui-font-body)); color: var(--ui-fld-lfg, var(--ui-ink)); }
6
+ & :is(input:not([type="checkbox"], [type="radio"]), textarea, select) {
7
+ min-block-size: max(var(--ui-touch-min, 0px), var(--ui-in-h, 0px));
8
+ font: var(--ui-in-f, 400 0.95rem/1.4 var(--ui-font-body));
9
+ font-size: max(var(--ui-input-floor, 0px), var(--ui-in-fs, 0.95rem));
10
+ color: var(--ui-ink);
11
+ background: var(--ui-in-bg, var(--ui-surface));
12
+ border: var(--ui-in-bd, 1px solid var(--ui-line-strong));
13
+ border-radius: var(--ui-in-r, var(--ui-radius-inner, var(--ui-radius)));
14
+ padding: var(--ui-in-pad, 0.5rem 0.75rem);
15
+ transition: border-color var(--ui-motion), box-shadow var(--ui-motion);
16
+ }
17
+ & :is(input:not([type="checkbox"], [type="radio"]), textarea, select):focus { border-color: var(--ui-in-fbd, var(--ui-accent)); }
18
+ & [aria-invalid="true"] { border-color: var(--ui-danger); }
19
+ & [data-part="hint"] { margin: 0; font-size: var(--ui-fld-ms, 0.82rem); color: var(--ui-muted); }
20
+ & [data-part="error"] { margin: 0; font-size: var(--ui-fld-ms, 0.82rem); color: var(--ui-danger); }
21
+ }
22
+ }
@@ -0,0 +1,21 @@
1
+ @layer kui {
2
+ [data-ui="menu"] [data-part="content"] {
3
+ background: var(--ui-pop-bg, var(--ui-surface));
4
+ color: var(--ui-ink);
5
+ border: var(--ui-pop-bd, 1px solid var(--ui-line));
6
+ border-radius: var(--ui-radius);
7
+ box-shadow: var(--ui-pop-sh, none);
8
+ padding: var(--ui-pop-pad, 0.35rem);
9
+ min-inline-size: var(--ui-pop-w, 12rem);
10
+ }
11
+ [data-ui="menu"] [data-part="item"] {
12
+ background: transparent;
13
+ border: 0;
14
+ border-radius: var(--ui-it-r, var(--ui-radius-inner, 0));
15
+ padding: var(--ui-it-pad, 0.45rem 0.65rem);
16
+ font: var(--ui-it-f, 500 0.88rem/1.3 var(--ui-font-body));
17
+ color: var(--ui-ink);
18
+ &:hover, &[data-highlighted="true"] { background: var(--ui-it-hbg, var(--ui-surface)); }
19
+ &[data-selected="true"] { color: var(--ui-accent); }
20
+ }
21
+ }
@@ -0,0 +1,17 @@
1
+ @layer kui {
2
+ [data-ui="notice"] {
3
+ --ui-tone: var(--ui-accent);
4
+ border-style: solid;
5
+ border-width: var(--ui-notice-bw, 0);
6
+ border-color: var(--ui-line, transparent);
7
+ border-radius: var(--ui-radius);
8
+ background: var(--ui-notice-bg, var(--ui-surface));
9
+ color: var(--ui-notice-fg, var(--ui-ink));
10
+ padding: var(--ui-notice-pad, 0.75rem 1.05rem);
11
+
12
+ &[data-tone="accent"] { --ui-tone: var(--ui-accent); }
13
+ &[data-tone="success"] { --ui-tone: var(--ui-success); }
14
+ &[data-tone="warning"] { --ui-tone: var(--ui-warning); }
15
+ &[data-tone="danger"] { --ui-tone: var(--ui-danger); }
16
+ }
17
+ }
@@ -0,0 +1,11 @@
1
+ @layer kui {
2
+ [data-ui="popover"][popover] {
3
+ background: var(--ui-pop-bg, var(--ui-surface));
4
+ color: var(--ui-ink);
5
+ border: var(--ui-pop-bd, 1px solid var(--ui-line));
6
+ border-radius: var(--ui-radius);
7
+ box-shadow: var(--ui-pop-sh, none);
8
+ padding: var(--ui-pop-pad, 0.35rem);
9
+ min-inline-size: var(--ui-pop-w, 12rem);
10
+ }
11
+ }
@@ -0,0 +1,12 @@
1
+ @layer kui {
2
+ [data-ui="radio-group"] input { accent-color: var(--ui-chk-acc, var(--ui-accent-fill, var(--ui-accent))); }
3
+ [data-ui="radio-group"] [data-part="legend"] {
4
+ font: var(--ui-rg-lf, 600 0.8rem/1.2 var(--ui-font-body));
5
+ text-transform: var(--ui-rg-lc, none);
6
+ letter-spacing: var(--ui-rg-lt, normal);
7
+ color: var(--ui-rg-lfg, var(--ui-muted));
8
+ margin-block-end: var(--ui-rg-lmb, 0.45rem);
9
+ }
10
+ [data-ui="radio-group"] [data-part="option"] { font-size: var(--ui-chk-fs, inherit); }
11
+ [data-ui="radio-group"] [data-part="hint"] { font-size: var(--ui-rg-hs, 0.8rem); color: var(--ui-muted); }
12
+ }