@prunellejs/ui 0.7.3 → 0.7.4

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/llms.txt CHANGED
@@ -50,7 +50,7 @@ export default defineConfig({
50
50
  - `Menu`: `{ id?, label, items: Array<{ id, label, href?, disabled?, onSelect? }>, variant?, onSelect? }`.
51
51
  - `Select`: `{ id?, options: Array<{ value, label, disabled? }>, value?: Signal<string>, defaultValue?, name?, placeholder?, ariaLabel?, onChange? }`. With no `value` or `defaultValue` it shows `placeholder` and submits `""` until the user picks. Outside a `Field` or `<label for>` it needs `ariaLabel`, or `prunelle check` warns `rgaa/form-label`.
52
52
  - `CommandPalette`: `{ id?, items?: CommandItem[], source?: CommandSource, shortcutKey? ('k'), open?: Signal<boolean>, onSelect?, ...labels }` (`source` is a lazy search function or `{ search(query) }`, e.g. `createSearchSource()` from `@prunellejs/search/client`, invoked only once opened).
53
- - `DataTable`: `{ rows, columns: Array<{ key, label, sortable? }>, rowKey? ('id'; every row needs a unique key, or the table throws), locale? (sort order; `<html lang>`), onSelect?(keys) (the selected keys, each time they change), rowLabelKey? (first column: names each row's checkbox), pageSize? (10), searchable? (true), selectable? (false), ...labels }`. With `selectable`, the header checkbox selects or clears every row the filter shows. A sort is announced (`ascendingLabel`, `descendingLabel`), and so is the page. `Sort is numeric and accent-aware (`Intl.Collator`), search and `CommandPalette` ignore case and accents, and the selection drops rows that leave `rows`. `createDataTable()` also has `setSelected(keys, on)` and `onSelect`.
53
+ - `DataTable`: `{ rows, columns: Array<{ key, label, sortable? }>, rowKey? ('id'; every row needs a unique key, or the table throws), locale? (sort order; `<html lang>`), onSelect?(keys) (the selected keys, each time they change), rowLabelKey? (first column: names each row's checkbox), pageSize? (10), searchable? (true), selectable? (false), ...labels }`. With `selectable`, the header checkbox selects or clears every row the filter shows. A sort is announced (`ascendingLabel`, `descendingLabel`), and so is the page. Sort is numeric and accent-aware (`Intl.Collator`), search and `CommandPalette` ignore case and accents, and the selection drops rows that leave `rows`. `createDataTable()` also has `setSelected(keys, on)` and `onSelect`.
54
54
  - `Toaster` + `toast`: mount `<Toaster dismissLabel? />` once in `_layout.tsx`; call `toast.show|info|success|warning|danger|error(title, description?, durationMs?)`, `toast.dismiss(id)`, `toast.clear()`. A `danger`/`error` toast stays until dismissed and the others stay 4.5 to 15 s by text length, unless `durationMs` is given (`0` keeps it). Hovering or focusing the stack pauses every timer, which then resumes with the time it had left; Escape closes the focused toast, and focus moves to the next toast, else back where it was.
55
55
 
56
56
  ## Example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prunellejs/ui",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
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.3"
32
+ "prunelle": "^0.7.4"
33
33
  }
34
34
  }
@@ -9,7 +9,13 @@ 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 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
12
+ const COMMENT_SRC = '//[^\\n]*|/\\*[\\s\\S]*?\\*/'
13
+ const WS_SRC = `(?:\\s|${COMMENT_SRC})*`
14
+ const NAMED_LIST_SRC = `\\{(?:[^/{}]|${COMMENT_SRC}|/(?![/*]))*\\}`
15
+ const IMPORT_EXPORT_RE = new RegExp(
16
+ `\\b(?:import\\b${WS_SRC}((?!type\\b)[A-Za-z_$][\\w$]*(?:${WS_SRC},${WS_SRC}(?:\\*${WS_SRC}as${WS_SRC}[A-Za-z_$][\\w$]*|${NAMED_LIST_SRC}))?|\\*${WS_SRC}as${WS_SRC}[A-Za-z_$][\\w$]*|${NAMED_LIST_SRC})|export\\b${WS_SRC}(\\*(?:${WS_SRC}as${WS_SRC}[A-Za-z_$][\\w$]*)?|${NAMED_LIST_SRC}))${WS_SRC}\\bfrom${WS_SRC}['"]([^'"]+)['"]`,
17
+ 'g',
18
+ )
13
19
  const NAMED_LIST_RE = /\{([\s\S]*?)\}/
14
20
  const NAMESPACE_RE = /^\s*\*(?:\s+as\s+[A-Za-z_$][\w$]*)?\s*$|,\s*\*\s+as\s+[A-Za-z_$][\w$]*/
15
21
  const COMMENT_RE = /\/\/[^\n]*|\/\*[\s\S]*?\*\//g
@@ -69,7 +75,7 @@ function scanSingleFile(file: string): FileUiScan {
69
75
  let all = false
70
76
 
71
77
  for (const match of code.matchAll(IMPORT_EXPORT_RE)) {
72
- const clause = (match[1] ?? match[2])!
78
+ const clause = ((match[1] ?? match[2])!).replace(COMMENT_RE, ' ')
73
79
  const source = match[3]!
74
80
  const fromPrunelle = source === 'prunelle'
75
81
  if (!fromPrunelle && !isUiImportSource(source))
@@ -80,7 +86,7 @@ function scanSingleFile(file: string): FileUiScan {
80
86
  }
81
87
  const named = NAMED_LIST_RE.exec(clause)
82
88
  if (named !== null) {
83
- for (const rawSpec of named[1]!.replace(COMMENT_RE, '').split(',')) {
89
+ for (const rawSpec of named[1]!.split(',')) {
84
90
  const spec = rawSpec.trim()
85
91
  if (spec === '' || /^type\s+/.test(spec))
86
92
  continue