lituix 0.1.21 → 0.1.22
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/components.json +2 -2
- package/dist/components/lui-alert.d.ts +2 -0
- package/dist/components/lui-alert.d.ts.map +1 -1
- package/dist/components/lui-dialog.d.ts.map +1 -1
- package/dist/components/lui-table.d.ts.map +1 -1
- package/dist/index.browser.js +114 -101
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +142 -129
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +87 -74
- package/dist/index.mjs.map +3 -3
- package/llm.txt +266 -266
- package/llms-full.txt +444 -444
- package/llms.txt +70 -70
- package/package.json +89 -82
- package/recipes.json +111 -111
package/llms.txt
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
# litui
|
|
2
|
-
|
|
3
|
-
> Lit Web Components UI library with Storybook docs, native-style DOM events, overlay infrastructure, schema-driven forms, rich table/tree components, and imperative APIs (`dialog`, `toast`, `form`, `showContextMenu`).
|
|
4
|
-
|
|
5
|
-
## Project Summary
|
|
6
|
-
|
|
7
|
-
- Package: `litui`
|
|
8
|
-
- Stack: Lit 3, TypeScript, Storybook 10, Vite, esbuild
|
|
9
|
-
- Style system: CSS custom properties with `--lui-*` tokens
|
|
10
|
-
- Public components use `lui-*` custom elements
|
|
11
|
-
- Public events prefer native-style names like `click`, `input`, `change`, `select`, `open`, `close`, `submit`, `clear`
|
|
12
|
-
- Public data-source naming is unified to `source`, including `lui-form` field schema
|
|
13
|
-
|
|
14
|
-
## Read First
|
|
15
|
-
|
|
16
|
-
- `README.md` — overview, install, usage, theming, API naming
|
|
17
|
-
- `package.json` — scripts, build outputs, dependencies
|
|
18
|
-
- `components.json` — machine-readable index of every element, its properties,
|
|
19
|
-
events, parts and CSS custom properties. Generated from source by
|
|
20
|
-
`pnpm docs:llm`; trust it over the prose files below, which are hand-written
|
|
21
|
-
and can lag. A property whose `attribute` is `null` can only be set as a
|
|
22
|
-
property (`.source=${...}`), never as an attribute.
|
|
23
|
-
- `recipes.json` — hand-written composition recipes: which component fits a
|
|
24
|
-
situation, how to wire it, and what to reach for instead. Judgement rather
|
|
25
|
-
than inventory, so it is not generated. Read it before choosing between the
|
|
26
|
-
collection controls or the three alert-like surfaces.
|
|
27
|
-
- `src/index.ts` — complete public export surface
|
|
28
|
-
- `llm.txt` — concise repo guide for coding agents
|
|
29
|
-
- `llms-full.txt` — expanded component and architecture guide
|
|
30
|
-
|
|
31
|
-
## High-Value Stories
|
|
32
|
-
|
|
33
|
-
- `stories/lui-api-conventions.stories.ts`
|
|
34
|
-
- `stories/lui-form.stories.ts`
|
|
35
|
-
- `stories/lui-table.stories.ts`
|
|
36
|
-
- `stories/lui-tree.stories.ts`
|
|
37
|
-
- `stories/lui-dialog.stories.ts`
|
|
38
|
-
- `stories/lui-dropdown.stories.ts`
|
|
39
|
-
- `stories/lui-image.stories.ts`
|
|
40
|
-
- `stories/lui-config-provider.stories.ts`
|
|
41
|
-
|
|
42
|
-
## Main Public APIs
|
|
43
|
-
|
|
44
|
-
### Components
|
|
45
|
-
- Foundation/display: `lui-button`, `lui-button-group`, `lui-button-group-item`, `lui-icon`, `lui-text`, `lui-card`, `lui-tag`, `lui-badge`, `lui-statistic`, `lui-avatar`, `lui-avatar-group`, `lui-config-provider`
|
|
46
|
-
- Navigation/layout: `lui-tab`, `lui-tabs`, `lui-tab-panel`, `lui-breadcrumb`, `lui-breadcrumb-item`, `lui-pagination`, `lui-row`, `lui-col`, `lui-divider`, `lui-background`, `lui-scroll-area`, `lui-collapse`, `lui-collapse-item`
|
|
47
|
-
- Form: `lui-form`, `lui-form-item`, `lui-input`, `lui-input-number`, `lui-input-opt`, `lui-textarea`, `lui-select` (+ `lui-option`, `lui-option-group`), `lui-autocomplete`, `lui-cascader`, `lui-tree-select`, `lui-checkbox`, `lui-checkbox-group`, `lui-radio`, `lui-radio-group`, `lui-switch`, `lui-slider`, `lui-datepicker`, `lui-calendar`, `lui-date-range-picker`, `lui-file-input`, `lui-color-picker`, `lui-icon-picker`
|
|
48
|
-
- Overlay/menu: `lui-popover`, `lui-tooltip`, `lui-popconfirm`, `lui-dropdown`, `lui-dropmenu`, `lui-dialog`, `lui-drawer`, `lui-command-palette`, `lui-menu`, `lui-menu-item`, `lui-menu-divider`, `lui-context-menu`, `lui-overlay-root`
|
|
49
|
-
- Rich data/feedback: `lui-alert`, `lui-progress`, `lui-spinner`, `lui-skeleton`, `lui-toast`, `lui-empty-state`, `lui-image`, `lui-image-cropper`, `lui-qrcode`, `lui-table`, `lui-table-column`, `lui-tree`
|
|
50
|
-
|
|
51
|
-
### Imperative APIs
|
|
52
|
-
- `dialog`
|
|
53
|
-
- `toast`
|
|
54
|
-
- `form`
|
|
55
|
-
- `showContextMenu()`
|
|
56
|
-
- `createContextMenu()`
|
|
57
|
-
|
|
58
|
-
## Key Conventions
|
|
59
|
-
|
|
60
|
-
- Do not add legacy compatibility prop / event aliases back
|
|
61
|
-
- Keep Storybook props/controls/docs aligned with component code
|
|
62
|
-
- When changing visuals, verify both light and dark themes
|
|
63
|
-
- Overlay-related changes should consider `portal`, `overlayLayer`, `backdrop`, outside click behavior, and mount container rules
|
|
64
|
-
- If unsure whether an API is public, confirm it is exported from `src/index.ts`
|
|
65
|
-
|
|
66
|
-
## Validation Commands
|
|
67
|
-
|
|
68
|
-
- `pnpm -s typecheck`
|
|
69
|
-
- `pnpm -s build`
|
|
70
|
-
- `pnpm -s build-storybook`
|
|
1
|
+
# litui
|
|
2
|
+
|
|
3
|
+
> Lit Web Components UI library with Storybook docs, native-style DOM events, overlay infrastructure, schema-driven forms, rich table/tree components, and imperative APIs (`dialog`, `toast`, `form`, `showContextMenu`).
|
|
4
|
+
|
|
5
|
+
## Project Summary
|
|
6
|
+
|
|
7
|
+
- Package: `litui`
|
|
8
|
+
- Stack: Lit 3, TypeScript, Storybook 10, Vite, esbuild
|
|
9
|
+
- Style system: CSS custom properties with `--lui-*` tokens
|
|
10
|
+
- Public components use `lui-*` custom elements
|
|
11
|
+
- Public events prefer native-style names like `click`, `input`, `change`, `select`, `open`, `close`, `submit`, `clear`
|
|
12
|
+
- Public data-source naming is unified to `source`, including `lui-form` field schema
|
|
13
|
+
|
|
14
|
+
## Read First
|
|
15
|
+
|
|
16
|
+
- `README.md` — overview, install, usage, theming, API naming
|
|
17
|
+
- `package.json` — scripts, build outputs, dependencies
|
|
18
|
+
- `components.json` — machine-readable index of every element, its properties,
|
|
19
|
+
events, parts and CSS custom properties. Generated from source by
|
|
20
|
+
`pnpm docs:llm`; trust it over the prose files below, which are hand-written
|
|
21
|
+
and can lag. A property whose `attribute` is `null` can only be set as a
|
|
22
|
+
property (`.source=${...}`), never as an attribute.
|
|
23
|
+
- `recipes.json` — hand-written composition recipes: which component fits a
|
|
24
|
+
situation, how to wire it, and what to reach for instead. Judgement rather
|
|
25
|
+
than inventory, so it is not generated. Read it before choosing between the
|
|
26
|
+
collection controls or the three alert-like surfaces.
|
|
27
|
+
- `src/index.ts` — complete public export surface
|
|
28
|
+
- `llm.txt` — concise repo guide for coding agents
|
|
29
|
+
- `llms-full.txt` — expanded component and architecture guide
|
|
30
|
+
|
|
31
|
+
## High-Value Stories
|
|
32
|
+
|
|
33
|
+
- `stories/lui-api-conventions.stories.ts`
|
|
34
|
+
- `stories/lui-form.stories.ts`
|
|
35
|
+
- `stories/lui-table.stories.ts`
|
|
36
|
+
- `stories/lui-tree.stories.ts`
|
|
37
|
+
- `stories/lui-dialog.stories.ts`
|
|
38
|
+
- `stories/lui-dropdown.stories.ts`
|
|
39
|
+
- `stories/lui-image.stories.ts`
|
|
40
|
+
- `stories/lui-config-provider.stories.ts`
|
|
41
|
+
|
|
42
|
+
## Main Public APIs
|
|
43
|
+
|
|
44
|
+
### Components
|
|
45
|
+
- Foundation/display: `lui-button`, `lui-button-group`, `lui-button-group-item`, `lui-icon`, `lui-text`, `lui-card`, `lui-tag`, `lui-badge`, `lui-statistic`, `lui-avatar`, `lui-avatar-group`, `lui-config-provider`
|
|
46
|
+
- Navigation/layout: `lui-tab`, `lui-tabs`, `lui-tab-panel`, `lui-breadcrumb`, `lui-breadcrumb-item`, `lui-pagination`, `lui-row`, `lui-col`, `lui-divider`, `lui-background`, `lui-scroll-area`, `lui-collapse`, `lui-collapse-item`
|
|
47
|
+
- Form: `lui-form`, `lui-form-item`, `lui-input`, `lui-input-number`, `lui-input-opt`, `lui-textarea`, `lui-select` (+ `lui-option`, `lui-option-group`), `lui-autocomplete`, `lui-cascader`, `lui-tree-select`, `lui-checkbox`, `lui-checkbox-group`, `lui-radio`, `lui-radio-group`, `lui-switch`, `lui-slider`, `lui-datepicker`, `lui-calendar`, `lui-date-range-picker`, `lui-file-input`, `lui-color-picker`, `lui-icon-picker`
|
|
48
|
+
- Overlay/menu: `lui-popover`, `lui-tooltip`, `lui-popconfirm`, `lui-dropdown`, `lui-dropmenu`, `lui-dialog`, `lui-drawer`, `lui-command-palette`, `lui-menu`, `lui-menu-item`, `lui-menu-divider`, `lui-context-menu`, `lui-overlay-root`
|
|
49
|
+
- Rich data/feedback: `lui-alert`, `lui-progress`, `lui-spinner`, `lui-skeleton`, `lui-toast`, `lui-empty-state`, `lui-image`, `lui-image-cropper`, `lui-qrcode`, `lui-table`, `lui-table-column`, `lui-tree`
|
|
50
|
+
|
|
51
|
+
### Imperative APIs
|
|
52
|
+
- `dialog`
|
|
53
|
+
- `toast`
|
|
54
|
+
- `form`
|
|
55
|
+
- `showContextMenu()`
|
|
56
|
+
- `createContextMenu()`
|
|
57
|
+
|
|
58
|
+
## Key Conventions
|
|
59
|
+
|
|
60
|
+
- Do not add legacy compatibility prop / event aliases back
|
|
61
|
+
- Keep Storybook props/controls/docs aligned with component code
|
|
62
|
+
- When changing visuals, verify both light and dark themes
|
|
63
|
+
- Overlay-related changes should consider `portal`, `overlayLayer`, `backdrop`, outside click behavior, and mount container rules
|
|
64
|
+
- If unsure whether an API is public, confirm it is exported from `src/index.ts`
|
|
65
|
+
|
|
66
|
+
## Validation Commands
|
|
67
|
+
|
|
68
|
+
- `pnpm -s typecheck`
|
|
69
|
+
- `pnpm -s build`
|
|
70
|
+
- `pnpm -s build-storybook`
|
package/package.json
CHANGED
|
@@ -1,83 +1,90 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "lituix",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Framework-agnostic UI components based on Lit Web Components",
|
|
5
|
-
"main": "./dist/index.cjs",
|
|
6
|
-
"module": "./dist/index.mjs",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.mjs",
|
|
12
|
-
"require": "./dist/index.cjs",
|
|
13
|
-
"default": "./dist/index.mjs"
|
|
14
|
-
},
|
|
15
|
-
"./styles": "./dist/index.browser.css",
|
|
16
|
-
"./browser": "./dist/index.browser.js"
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"dist",
|
|
20
|
-
"README.md",
|
|
21
|
-
"llm.txt",
|
|
22
|
-
"llms.txt",
|
|
23
|
-
"llms-full.txt",
|
|
24
|
-
"components.json",
|
|
25
|
-
"recipes.json"
|
|
26
|
-
],
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "lituix",
|
|
3
|
+
"version": "0.1.22",
|
|
4
|
+
"description": "Framework-agnostic UI components based on Lit Web Components",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"default": "./dist/index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./styles": "./dist/index.browser.css",
|
|
16
|
+
"./browser": "./dist/index.browser.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"llm.txt",
|
|
22
|
+
"llms.txt",
|
|
23
|
+
"llms-full.txt",
|
|
24
|
+
"components.json",
|
|
25
|
+
"recipes.json"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build:esm": "cross-env BUILD_FORMAT=es node esbuild.config.js",
|
|
29
|
+
"build:cjs": "cross-env BUILD_FORMAT=cjs node esbuild.config.js",
|
|
30
|
+
"build:umd": "cross-env BUILD_FORMAT=umd node esbuild.config.js",
|
|
31
|
+
"build": "pnpm run build:types && pnpm run build:esm && pnpm run build:cjs && pnpm run build:umd",
|
|
32
|
+
"dev": "cross-env BUILD_FORMAT=es node esbuild.config.js --watch",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"storybook": "storybook dev --host 0.0.0.0 -p 6006 --no-open",
|
|
35
|
+
"build-storybook": "storybook build",
|
|
36
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
37
|
+
"pack:dry-run": "npm pack --dry-run",
|
|
38
|
+
"release:check": "pnpm docs:llm && pnpm typecheck && pnpm build && pnpm pack:dry-run",
|
|
39
|
+
"prepack": "pnpm build",
|
|
40
|
+
"prepublishOnly": "pnpm docs:llm && pnpm typecheck && pnpm build",
|
|
41
|
+
"docs:llm": "node scripts/generate-llm-docs.mjs"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"web-components",
|
|
45
|
+
"lit",
|
|
46
|
+
"ui-components",
|
|
47
|
+
"design-system"
|
|
48
|
+
],
|
|
49
|
+
"author": "ppnow",
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@floating-ui/dom": "^1.7.6",
|
|
53
|
+
"@iconify-json/lucide": "^1.2.104",
|
|
54
|
+
"@lit-labs/virtualizer": "^2.0.13",
|
|
55
|
+
"@lit/context": "^1.1.5",
|
|
56
|
+
"@panzoom/panzoom": "^4.6.2",
|
|
57
|
+
"@tanstack/lit-form": "^1.23.28",
|
|
58
|
+
"cropperjs": "^2.1.1",
|
|
59
|
+
"flatpickr": "^4.6.13",
|
|
60
|
+
"iconify-icon": "^3.0.2",
|
|
61
|
+
"interactjs": "^1.10.27",
|
|
62
|
+
"just-debounce-it": "^3.2.0",
|
|
63
|
+
"lit": "^3.3.1"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@storybook/addon-docs": "^10.5.10",
|
|
67
|
+
"@storybook/addon-links": "^10.5.10",
|
|
68
|
+
"@storybook/addon-themes": "^10.5.10",
|
|
69
|
+
"@storybook/web-components": "^10.5.10",
|
|
70
|
+
"@storybook/web-components-vite": "^10.5.10",
|
|
71
|
+
"@types/node": "^22.5.4",
|
|
72
|
+
"cross-env": "^7.0.3",
|
|
73
|
+
"esbuild": "^0.24.0",
|
|
74
|
+
"react": "^19.2.5",
|
|
75
|
+
"storybook": "^10.5.10",
|
|
76
|
+
"typescript": "^5.5.4",
|
|
77
|
+
"vite": "^6.4.2",
|
|
78
|
+
"zod": "^4.4.3"
|
|
79
|
+
},
|
|
80
|
+
"pnpm": {
|
|
81
|
+
"onlyBuiltDependencies": [
|
|
82
|
+
"esbuild"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"types": "./dist/index.d.ts",
|
|
86
|
+
"sideEffects": true,
|
|
87
|
+
"publishConfig": {
|
|
88
|
+
"access": "public"
|
|
89
|
+
}
|
|
83
90
|
}
|
package/recipes.json
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$comment": "Hand-written, unlike components.json which is generated from source. This is judgement -- which component fits a situation, how to wire it, and what to reach for instead -- and none of it can be derived. Every entry comes from a mistake actually made against this library.",
|
|
3
|
-
"conventions": [
|
|
4
|
-
{
|
|
5
|
-
"topic": "attribute versus property",
|
|
6
|
-
"rule": "An array, object or function can only be set as a property: `.source=${[...]}`, not `source=\"...\"`.",
|
|
7
|
-
"why": "An HTML attribute is an untyped string, so the wrong form typechecks, builds, and silently does nothing. components.json records \"attribute\": null for exactly these.",
|
|
8
|
-
"wrong": "<lui-tree default-expanded-keys='[\"src\"]'>",
|
|
9
|
-
"right": "<lui-tree .defaultExpandedKeys=${[\"src\"]}>"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"topic": "camelCase property, kebab attribute",
|
|
13
|
-
"rule": "From markup, a camelCase property is set by its kebab attribute name.",
|
|
14
|
-
"wrong": "<lui-textarea autosize>",
|
|
15
|
-
"right": "<lui-textarea auto-resize>"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"topic": "collection inputs",
|
|
19
|
-
"rule": "Anything taking a list of choices names it `source`, never `options` or `items`. Holds for lui-select and for lui-form field schemas.",
|
|
20
|
-
"wrong": ".options=${[...]}",
|
|
21
|
-
"right": ".source=${[...]}"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"topic": "reflected booleans",
|
|
25
|
-
"rule": "A boolean that reflects needs `type: Boolean`.",
|
|
26
|
-
"why": "Without it the value reflects as a string, so a closed control still carries open=\"false\" and every :host([open]) rule matches while it is off. This shipped twice: an arrow pointing up when closed, and a shimmer that could not be turned off.",
|
|
27
|
-
"right": "@property({ type: Boolean, reflect: true }) open = false;"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"topic": "icon on a button",
|
|
31
|
-
"rule": "lui-button takes an `icon` property. It is not a slot.",
|
|
32
|
-
"wrong": "<lui-button><lui-icon slot=\"icon\" name=\"plus\"></lui-icon></lui-button>",
|
|
33
|
-
"right": "<lui-button icon=\"plus\">New</lui-button>"
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
"recipes": [
|
|
37
|
-
{
|
|
38
|
-
"name": "Pick one value from a fixed list",
|
|
39
|
-
"use": ["lui-select"],
|
|
40
|
-
"how": "`.source` with label/value objects. Add `search` for a long list, `multiple` plus multiple-display=\"tag\" for several values.",
|
|
41
|
-
"instead-of": "lui-autocomplete, whose value is free text and need not come from the list at all."
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"name": "Type freely, with suggestions",
|
|
45
|
-
"use": ["lui-autocomplete"],
|
|
46
|
-
"how": "`.source` for suggestions; the value is whatever was typed. `.filter` may return a promise for a remote lookup -- results that arrive after the query moved on are dropped.",
|
|
47
|
-
"instead-of": "lui-select with search, which filters a fixed set and cannot accept an unlisted value."
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"name": "Pick a node from a hierarchy",
|
|
51
|
-
"use": ["lui-tree-select"],
|
|
52
|
-
"how": "`.nodes` in the lui-tree shape. mode=\"single\" maps to the tree's single selection, \"multiple\" to its checkboxes. The value is one key.",
|
|
53
|
-
"instead-of": "lui-cascader, when a leaf is meaningful without its ancestors."
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"name": "Pick a path, level by level",
|
|
57
|
-
"use": ["lui-cascader"],
|
|
58
|
-
"how": "`.nodes`, one column per level, value is the whole path array. Set change-on-select only if a partial path is a valid answer. `.childrenLoader` for lazy levels.",
|
|
59
|
-
"instead-of": "lui-tree-select, when the leaf means nothing without its ancestors -- region, category, org unit."
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"name": "Confirm a row action in place",
|
|
63
|
-
"use": ["lui-popconfirm", "lui-button"],
|
|
64
|
-
"how": "Wrap the trigger. Return a promise from `.onConfirm` to hold the button loading; a rejection leaves the panel open to retry. status=\"danger\" also makes the confirm button danger.",
|
|
65
|
-
"instead-of": "dialog.confirm(), which blocks the page -- too heavy for a per-row delete."
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"name": "Tell the user something that must persist",
|
|
69
|
-
"use": ["lui-alert"],
|
|
70
|
-
"how": "Inline and non-transient; it takes part in the layout. For a form error summary or a page banner. Actions go in the `actions` slot.",
|
|
71
|
-
"instead-of": "toast, which leaves on its own, and dialog.alert(), which blocks until acknowledged. All three are named alike and none is interchangeable."
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"name": "Show that something is loading",
|
|
75
|
-
"use": ["lui-spinner"],
|
|
76
|
-
"how": "Defaults to 1em so it tracks surrounding text. variant=\"track\" standalone, \"current\" inline with text. lui-button, lui-card and lui-tree already render it internally.",
|
|
77
|
-
"instead-of": "hand-rolling a CSS ring -- three components each had one before this was shared, at three sizes and two colour strategies."
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"name": "Compose lui-popover inside your own component",
|
|
81
|
-
"use": ["lui-popover", "../utils/portal-styles"],
|
|
82
|
-
"how": "Slot your panel in and pass `.portalStyleSources=${ownStyleSheets(this)}`.",
|
|
83
|
-
"why": "CSS scoping follows the tree a node currently lives in. The portal moves slotted content into the overlay root, where your shadow styles no longer apply: the panel keeps its markup and loses every rule. Three components shipped without this and their panels had never been styled in a browser.",
|
|
84
|
-
"see": "lui-popconfirm and lui-tooltip compose it this way; lui-select extends it instead and needs extra plumbing as a result."
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"name": "Give a floating surface its elevation",
|
|
88
|
-
"use": ["--lui-shadow-overlay"],
|
|
89
|
-
"how": "Every floating surface reads this one token. Retarget it to move them together; --lui-shadow-lg and -xl remain for opting a single surface out.",
|
|
90
|
-
"instead-of": "choosing an elevation step per component, which is how three different steps ended up across ten overlays."
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"name": "Build a control that opens a panel",
|
|
94
|
-
"use": ["../themes/control-shell", "../themes/option-row"],
|
|
95
|
-
"how": "Add the `control-shell` class to the closed box and `option-row` to each choice row, then set only what genuinely differs. A trailing arrow or clear button gets class=\"control-affordance\" with data-affordance=\"arrow\" or \"clear\", and the shell reserves room via --lui-control-gutter or -gutter-2.",
|
|
96
|
-
"why": "Five components had grown their own shell and four their own option row, disagreeing on padding, gap, height and what transitioned. The gutter arithmetic was wrong in all three places that did it by hand, so a clear button sat on top of the value text."
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"name": "Show a status colour or glyph",
|
|
100
|
-
"use": ["../utils/status"],
|
|
101
|
-
"how": "statusIcon(status) and statusColorVar(status). Canonical set is info/success/warning/danger; `error` and `exception` normalise onto danger, `normal` and `active` onto no status.",
|
|
102
|
-
"instead-of": "mapping status to an icon yourself -- Toast and Progress each did, and disagreed about which glyph meant success."
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"name": "Accept a size from the outside",
|
|
106
|
-
"use": ["../utils/format"],
|
|
107
|
-
"how": "toCssLength(value): converts a number or numeric string to px, passes a real length through untouched.",
|
|
108
|
-
"why": "An attribute is always a string, so size=\"24\" arrives unitless and emitting it as-is yields `width: 24`, which is invalid and collapses the element. Five components had this bug."
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$comment": "Hand-written, unlike components.json which is generated from source. This is judgement -- which component fits a situation, how to wire it, and what to reach for instead -- and none of it can be derived. Every entry comes from a mistake actually made against this library.",
|
|
3
|
+
"conventions": [
|
|
4
|
+
{
|
|
5
|
+
"topic": "attribute versus property",
|
|
6
|
+
"rule": "An array, object or function can only be set as a property: `.source=${[...]}`, not `source=\"...\"`.",
|
|
7
|
+
"why": "An HTML attribute is an untyped string, so the wrong form typechecks, builds, and silently does nothing. components.json records \"attribute\": null for exactly these.",
|
|
8
|
+
"wrong": "<lui-tree default-expanded-keys='[\"src\"]'>",
|
|
9
|
+
"right": "<lui-tree .defaultExpandedKeys=${[\"src\"]}>"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"topic": "camelCase property, kebab attribute",
|
|
13
|
+
"rule": "From markup, a camelCase property is set by its kebab attribute name.",
|
|
14
|
+
"wrong": "<lui-textarea autosize>",
|
|
15
|
+
"right": "<lui-textarea auto-resize>"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"topic": "collection inputs",
|
|
19
|
+
"rule": "Anything taking a list of choices names it `source`, never `options` or `items`. Holds for lui-select and for lui-form field schemas.",
|
|
20
|
+
"wrong": ".options=${[...]}",
|
|
21
|
+
"right": ".source=${[...]}"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"topic": "reflected booleans",
|
|
25
|
+
"rule": "A boolean that reflects needs `type: Boolean`.",
|
|
26
|
+
"why": "Without it the value reflects as a string, so a closed control still carries open=\"false\" and every :host([open]) rule matches while it is off. This shipped twice: an arrow pointing up when closed, and a shimmer that could not be turned off.",
|
|
27
|
+
"right": "@property({ type: Boolean, reflect: true }) open = false;"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"topic": "icon on a button",
|
|
31
|
+
"rule": "lui-button takes an `icon` property. It is not a slot.",
|
|
32
|
+
"wrong": "<lui-button><lui-icon slot=\"icon\" name=\"plus\"></lui-icon></lui-button>",
|
|
33
|
+
"right": "<lui-button icon=\"plus\">New</lui-button>"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"recipes": [
|
|
37
|
+
{
|
|
38
|
+
"name": "Pick one value from a fixed list",
|
|
39
|
+
"use": ["lui-select"],
|
|
40
|
+
"how": "`.source` with label/value objects. Add `search` for a long list, `multiple` plus multiple-display=\"tag\" for several values.",
|
|
41
|
+
"instead-of": "lui-autocomplete, whose value is free text and need not come from the list at all."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "Type freely, with suggestions",
|
|
45
|
+
"use": ["lui-autocomplete"],
|
|
46
|
+
"how": "`.source` for suggestions; the value is whatever was typed. `.filter` may return a promise for a remote lookup -- results that arrive after the query moved on are dropped.",
|
|
47
|
+
"instead-of": "lui-select with search, which filters a fixed set and cannot accept an unlisted value."
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "Pick a node from a hierarchy",
|
|
51
|
+
"use": ["lui-tree-select"],
|
|
52
|
+
"how": "`.nodes` in the lui-tree shape. mode=\"single\" maps to the tree's single selection, \"multiple\" to its checkboxes. The value is one key.",
|
|
53
|
+
"instead-of": "lui-cascader, when a leaf is meaningful without its ancestors."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "Pick a path, level by level",
|
|
57
|
+
"use": ["lui-cascader"],
|
|
58
|
+
"how": "`.nodes`, one column per level, value is the whole path array. Set change-on-select only if a partial path is a valid answer. `.childrenLoader` for lazy levels.",
|
|
59
|
+
"instead-of": "lui-tree-select, when the leaf means nothing without its ancestors -- region, category, org unit."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "Confirm a row action in place",
|
|
63
|
+
"use": ["lui-popconfirm", "lui-button"],
|
|
64
|
+
"how": "Wrap the trigger. Return a promise from `.onConfirm` to hold the button loading; a rejection leaves the panel open to retry. status=\"danger\" also makes the confirm button danger.",
|
|
65
|
+
"instead-of": "dialog.confirm(), which blocks the page -- too heavy for a per-row delete."
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "Tell the user something that must persist",
|
|
69
|
+
"use": ["lui-alert"],
|
|
70
|
+
"how": "Inline and non-transient; it takes part in the layout. For a form error summary or a page banner. Actions go in the `actions` slot.",
|
|
71
|
+
"instead-of": "toast, which leaves on its own, and dialog.alert(), which blocks until acknowledged. All three are named alike and none is interchangeable."
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "Show that something is loading",
|
|
75
|
+
"use": ["lui-spinner"],
|
|
76
|
+
"how": "Defaults to 1em so it tracks surrounding text. variant=\"track\" standalone, \"current\" inline with text. lui-button, lui-card and lui-tree already render it internally.",
|
|
77
|
+
"instead-of": "hand-rolling a CSS ring -- three components each had one before this was shared, at three sizes and two colour strategies."
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "Compose lui-popover inside your own component",
|
|
81
|
+
"use": ["lui-popover", "../utils/portal-styles"],
|
|
82
|
+
"how": "Slot your panel in and pass `.portalStyleSources=${ownStyleSheets(this)}`.",
|
|
83
|
+
"why": "CSS scoping follows the tree a node currently lives in. The portal moves slotted content into the overlay root, where your shadow styles no longer apply: the panel keeps its markup and loses every rule. Three components shipped without this and their panels had never been styled in a browser.",
|
|
84
|
+
"see": "lui-popconfirm and lui-tooltip compose it this way; lui-select extends it instead and needs extra plumbing as a result."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "Give a floating surface its elevation",
|
|
88
|
+
"use": ["--lui-shadow-overlay"],
|
|
89
|
+
"how": "Every floating surface reads this one token. Retarget it to move them together; --lui-shadow-lg and -xl remain for opting a single surface out.",
|
|
90
|
+
"instead-of": "choosing an elevation step per component, which is how three different steps ended up across ten overlays."
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "Build a control that opens a panel",
|
|
94
|
+
"use": ["../themes/control-shell", "../themes/option-row"],
|
|
95
|
+
"how": "Add the `control-shell` class to the closed box and `option-row` to each choice row, then set only what genuinely differs. A trailing arrow or clear button gets class=\"control-affordance\" with data-affordance=\"arrow\" or \"clear\", and the shell reserves room via --lui-control-gutter or -gutter-2.",
|
|
96
|
+
"why": "Five components had grown their own shell and four their own option row, disagreeing on padding, gap, height and what transitioned. The gutter arithmetic was wrong in all three places that did it by hand, so a clear button sat on top of the value text."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "Show a status colour or glyph",
|
|
100
|
+
"use": ["../utils/status"],
|
|
101
|
+
"how": "statusIcon(status) and statusColorVar(status). Canonical set is info/success/warning/danger; `error` and `exception` normalise onto danger, `normal` and `active` onto no status.",
|
|
102
|
+
"instead-of": "mapping status to an icon yourself -- Toast and Progress each did, and disagreed about which glyph meant success."
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "Accept a size from the outside",
|
|
106
|
+
"use": ["../utils/format"],
|
|
107
|
+
"how": "toCssLength(value): converts a number or numeric string to px, passes a real length through untouched.",
|
|
108
|
+
"why": "An attribute is always a string, so size=\"24\" arrives unitless and emitting it as-is yields `width: 24`, which is invalid and collapses the element. Five components had this bug."
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|