@prunellejs/ui 0.7.1 → 0.7.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prunellejs/ui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Platform-first headless UI primitives and pure CSS @layer kui Style Grammars for Prunelle",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"directory": "packages/ui"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"prunelle": "^0.7.
|
|
32
|
+
"prunelle": "^0.7.3"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/DataTable.tsx
CHANGED
|
@@ -175,6 +175,7 @@ export function DataTable(props: DataTableProps) {
|
|
|
175
175
|
<input
|
|
176
176
|
type="checkbox"
|
|
177
177
|
aria-label={selectAllLabel}
|
|
178
|
+
disabled={table.filtered.value.length === 0}
|
|
178
179
|
checked={allShownSelected()}
|
|
179
180
|
ref={(el: HTMLInputElement) => effect(() => { el.indeterminate = someShownSelected() && !allShownSelected() })}
|
|
180
181
|
onChange={() => table.setSelected(shownKeys(), !allShownSelected())}
|
package/src/styles/base.css
CHANGED
|
@@ -56,6 +56,8 @@
|
|
|
56
56
|
/* Windows high contrast drops backgrounds and box-shadows, so each state drawn with them is redrawn with system colors, here and in each component's themed sheet; `:root` outranks the themed and grammar rules. */
|
|
57
57
|
@media (forced-colors: active) {
|
|
58
58
|
:root [data-ui] [data-highlighted="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
|
|
59
|
-
:root [data-ui][data-disabled="true"]
|
|
59
|
+
:root [data-ui][data-disabled="true"],
|
|
60
|
+
:root [data-ui][aria-disabled="true"],
|
|
61
|
+
:root [data-ui] [data-disabled="true"] { color: GrayText; }
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
--ui-btn-sm-pad: 0.3rem 0.55rem;
|
|
33
33
|
--ui-btn-lg-fs: 0.85rem;
|
|
34
34
|
--ui-btn-lg-pad: 0.6rem 1rem;
|
|
35
|
-
&:hover:not(:disabled) { border-color: var(--ui-accent); color: var(--ui-accent); }
|
|
36
|
-
&[data-tone="accent"]:hover:not(:disabled) { color: var(--ui-on-accent); filter: brightness(1.08); }
|
|
37
|
-
&[data-tone="danger"] { background: color-mix(in srgb, var(--ui-danger) 12%, transparent); color: var(--ui-danger); &:hover:not(:disabled) { background: var(--ui-danger); color: var(--ui-on-accent); } }
|
|
35
|
+
&:hover:not(:disabled, [aria-disabled="true"]) { border-color: var(--ui-accent); color: var(--ui-accent); }
|
|
36
|
+
&[data-tone="accent"]:hover:not(:disabled, [aria-disabled="true"]) { color: var(--ui-on-accent); filter: brightness(1.08); }
|
|
37
|
+
&[data-tone="danger"] { background: color-mix(in srgb, var(--ui-danger) 12%, transparent); color: var(--ui-danger); &:hover:not(:disabled, [aria-disabled="true"]) { background: var(--ui-danger); color: var(--ui-on-accent); } }
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
[data-ui="card"] {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
--ui-btn-bd: 1px solid var(--ui-ink);
|
|
31
31
|
--ui-btn-bg: var(--ui-ink);
|
|
32
32
|
--ui-btn-fg: var(--ui-paper);
|
|
33
|
-
&:hover:not(:disabled) { background: transparent; color: var(--ui-ink); }
|
|
34
|
-
&[data-tone="accent"]:hover:not(:disabled) { background: transparent; color: var(--ui-accent); }
|
|
35
|
-
&[data-variant="outline"]:hover:not(:disabled) { border-color: var(--ui-ink); }
|
|
33
|
+
&:hover:not(:disabled, [aria-disabled="true"]) { background: transparent; color: var(--ui-ink); }
|
|
34
|
+
&[data-tone="accent"]:hover:not(:disabled, [aria-disabled="true"]) { background: transparent; color: var(--ui-accent); }
|
|
35
|
+
&[data-variant="outline"]:hover:not(:disabled, [aria-disabled="true"]) { border-color: var(--ui-ink); }
|
|
36
36
|
&[data-variant="ghost"] { border-bottom: 1px solid var(--ui-line); padding-inline: 0.15rem; }
|
|
37
|
-
&[data-variant="ghost"]:hover:not(:disabled) { border-bottom-color: var(--ui-ink); }
|
|
37
|
+
&[data-variant="ghost"]:hover:not(:disabled, [aria-disabled="true"]) { border-bottom-color: var(--ui-ink); }
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
[data-ui="card"] {
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
--ui-danger: light-dark(#b42318, #f58a8a);
|
|
33
33
|
--ui-iris: light-dark(#7a3667, #e5c068);
|
|
34
34
|
--ui-pupil: light-dark(#18111d, #130e16);
|
|
35
|
+
--ui-tst-accent: light-dark(#e5c068, #7a3667);
|
|
36
|
+
--ui-tst-success: light-dark(#7cc79a, #2c6b3a);
|
|
37
|
+
--ui-tst-warning: light-dark(#f2a65a, #7d5c00);
|
|
38
|
+
--ui-tst-danger: light-dark(#f58a8a, #b42318);
|
|
35
39
|
--ui-font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
|
|
36
40
|
--ui-font-body: 'Segoe UI Variable Text', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Noto Sans', Cantarell, Ubuntu, Arial, sans-serif;
|
|
37
41
|
--ui-font-mono: ui-monospace, 'Cascadia Code', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
|
|
@@ -58,23 +62,23 @@
|
|
|
58
62
|
min-inline-size: var(--ui-touch-min, auto);
|
|
59
63
|
white-space: nowrap;
|
|
60
64
|
box-shadow: inset 0 0 0 1px var(--ui-line-strong);
|
|
61
|
-
&:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--ui-ink); }
|
|
65
|
+
&:hover:not(:disabled, [aria-disabled="true"]) { box-shadow: inset 0 0 0 1px var(--ui-ink); }
|
|
62
66
|
&[data-variant="ghost"] {
|
|
63
67
|
padding-inline: 2px;
|
|
64
68
|
text-decoration: underline 1px var(--ui-accent);
|
|
65
69
|
text-underline-offset: 5px;
|
|
66
|
-
&:hover:not(:disabled) { box-shadow: none; text-decoration-thickness: 2px; }
|
|
70
|
+
&:hover:not(:disabled, [aria-disabled="true"]) { box-shadow: none; text-decoration-thickness: 2px; }
|
|
67
71
|
}
|
|
68
72
|
&[data-tone="accent"] {
|
|
69
73
|
box-shadow: none;
|
|
70
74
|
color: var(--ui-on-primary);
|
|
71
|
-
&:hover:not(:disabled) { box-shadow: none; background: color-mix(in srgb, var(--ui-accent-fill) 86%, var(--ui-paper)); }
|
|
75
|
+
&:hover:not(:disabled, [aria-disabled="true"]) { box-shadow: none; background: color-mix(in srgb, var(--ui-accent-fill) 86%, var(--ui-paper)); }
|
|
72
76
|
}
|
|
73
77
|
&[data-tone="danger"] {
|
|
74
78
|
background: transparent;
|
|
75
79
|
box-shadow: inset 0 0 0 1px var(--ui-danger);
|
|
76
80
|
color: var(--ui-danger);
|
|
77
|
-
&:hover:not(:disabled) { background: var(--ui-danger); box-shadow: none; color: var(--ui-on-accent); }
|
|
81
|
+
&:hover:not(:disabled, [aria-disabled="true"]) { background: var(--ui-danger); box-shadow: none; color: var(--ui-on-accent); }
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
|
|
@@ -188,10 +192,10 @@
|
|
|
188
192
|
--ui-tst-pad: 10px 14px;
|
|
189
193
|
font: 400 0.8125rem/1.45 var(--ui-font-body);
|
|
190
194
|
&[data-tone] { box-shadow: inset 3px 0 0 var(--ui-tone); }
|
|
191
|
-
&[data-tone="accent"] { --ui-tone:
|
|
192
|
-
&[data-tone="success"] { --ui-tone:
|
|
193
|
-
&[data-tone="warning"] { --ui-tone:
|
|
194
|
-
&[data-tone="danger"] { --ui-tone:
|
|
195
|
+
&[data-tone="accent"] { --ui-tone: var(--ui-tst-accent); }
|
|
196
|
+
&[data-tone="success"] { --ui-tone: var(--ui-tst-success); }
|
|
197
|
+
&[data-tone="warning"] { --ui-tone: var(--ui-tst-warning); }
|
|
198
|
+
&[data-tone="danger"] { --ui-tone: var(--ui-tst-danger); }
|
|
195
199
|
}
|
|
196
200
|
|
|
197
201
|
[data-ui="checkbox"] {
|
package/src/styles/scan.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Static scanner detecting which `@prunellejs/ui` component parts a set of source files renders.
|
|
2
|
-
// Checks
|
|
2
|
+
// Checks imports and re-exports from `@prunellejs/ui` plus literal `data-ui="..."` / `data-layout="..."` attributes.
|
|
3
3
|
|
|
4
4
|
import type { UiComponentPart } from './split'
|
|
5
5
|
import { existsSync, readFileSync } from 'node:fs'
|
|
@@ -9,9 +9,10 @@ import { UI_COMPONENT_PARTS, UI_EXPORT_TO_PARTS } from './split'
|
|
|
9
9
|
const PART_SET = new Set<string>(UI_COMPONENT_PARTS)
|
|
10
10
|
const UI_SRC_DIR = resolve(import.meta.dir, '..')
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const IMPORT_EXPORT_RE = /\b(?:import\b\s*((?!type\b)[A-Za-z_$][\w$]*(?:\s*,\s*(?:\*\s+as\s+[A-Za-z_$][\w$]*|\{[^{}]*\}))?|\*\s+as\s+[A-Za-z_$][\w$]*|\{[^{}]*\})|export\b\s*(\*(?:\s+as\s+[A-Za-z_$][\w$]*)?|\{[^{}]*\}))\s*\bfrom\s*['"]([^'"]+)['"]/g
|
|
13
13
|
const NAMED_LIST_RE = /\{([\s\S]*?)\}/
|
|
14
|
-
const NAMESPACE_RE =
|
|
14
|
+
const NAMESPACE_RE = /^\s*\*(?:\s+as\s+[A-Za-z_$][\w$]*)?\s*$|,\s*\*\s+as\s+[A-Za-z_$][\w$]*/
|
|
15
|
+
const COMMENT_RE = /\/\/[^\n]*|\/\*[\s\S]*?\*\//g
|
|
15
16
|
const DATA_UI_ATTR_RE = /\bdata-ui\s*=\s*(?:["']([^"']+)["']|\{([^}]*)\})/g
|
|
16
17
|
const DATA_LAYOUT_ATTR_RE = /\bdata-layout\s*=/
|
|
17
18
|
const STATIC_QUOTED_RE = /^\s*["']([^"']+)["']\s*$/
|
|
@@ -67,9 +68,9 @@ function scanSingleFile(file: string): FileUiScan {
|
|
|
67
68
|
const parts = new Set<UiComponentPart>()
|
|
68
69
|
let all = false
|
|
69
70
|
|
|
70
|
-
for (const match of code.matchAll(
|
|
71
|
-
const clause = match[1]!
|
|
72
|
-
const source = match[
|
|
71
|
+
for (const match of code.matchAll(IMPORT_EXPORT_RE)) {
|
|
72
|
+
const clause = (match[1] ?? match[2])!
|
|
73
|
+
const source = match[3]!
|
|
73
74
|
const fromPrunelle = source === 'prunelle'
|
|
74
75
|
if (!fromPrunelle && !isUiImportSource(source))
|
|
75
76
|
continue
|
|
@@ -79,9 +80,9 @@ function scanSingleFile(file: string): FileUiScan {
|
|
|
79
80
|
}
|
|
80
81
|
const named = NAMED_LIST_RE.exec(clause)
|
|
81
82
|
if (named !== null) {
|
|
82
|
-
for (const rawSpec of named[1]!.split(',')) {
|
|
83
|
+
for (const rawSpec of named[1]!.replace(COMMENT_RE, '').split(',')) {
|
|
83
84
|
const spec = rawSpec.trim()
|
|
84
|
-
if (spec === '' || spec
|
|
85
|
+
if (spec === '' || /^type\s+/.test(spec))
|
|
85
86
|
continue
|
|
86
87
|
const imported = spec.split(/\s+as\s+/)[0]!.trim()
|
|
87
88
|
const mapped = (fromPrunelle ? PRUNELLE_EXPORT_TO_PARTS : UI_EXPORT_TO_PARTS)[imported]
|