@kerfjs/ui 5.0.0-beta.85 → 5.0.0-beta.87
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/ai/component-catalog.json +0 -1
- package/ai/component-composition.json +0 -1
- package/ai/components/value-table.md +1 -1
- package/ai/public-api-signatures-v1.md +1 -1
- package/ai/skill.md +17 -0
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/dist/{chunk-7TE6XDFI.js → chunk-B3TROLC2.js} +15 -2
- package/dist/chunk-B3TROLC2.js.map +1 -0
- package/dist/content-item.js +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/app-tab.css +8 -0
- package/dist/styles/components/data-display/value-table/value-table.css +5 -3
- package/dist/styles/components/navigation/app-tab/app-tab.css +8 -0
- package/dist/styles/components/navigation/tab-bar/tab-bar.css +4 -1
- package/dist/styles/tab-bar.css +4 -1
- package/dist/styles/value-table.css +5 -3
- package/dist/wire-catalog.js +10 -3
- package/dist/wire-catalog.js.map +1 -1
- package/dist/wire-content-items.js +29 -4
- package/dist/wire-content-items.js.map +1 -1
- package/docs/catalog.md +3 -2
- package/docs/component-contract.md +11 -1
- package/docs/design/templates/value-table/details-dark.svg +1 -1
- package/docs/design/templates/value-table/details.svg +1 -1
- package/docs/design/templates/value-table-dark.svg +1 -1
- package/docs/design/templates/value-table.svg +1 -1
- package/docs/webawesome-theme.md +13 -0
- package/llms.txt +16 -0
- package/package.json +2 -1
- package/dist/chunk-7TE6XDFI.js.map +0 -1
|
@@ -62,7 +62,7 @@ Public class hooks (select for layout placement only, never to change the compon
|
|
|
62
62
|
|
|
63
63
|
Never put `kui-value-table`, `kui-value-table__row`, `kui-value-table__icon`, `kui-value-table__label` on an element you write; render `ValueTable` instead (`KUI-L103`).
|
|
64
64
|
|
|
65
|
-
Public tokens it reads: `--kui-color-neutral-border-normal`, `--kui-color-surface-lowered`, `--kui-color-text`, `--kui-
|
|
65
|
+
Public tokens it reads: `--kui-color-neutral-border-normal`, `--kui-color-surface-lowered`, `--kui-color-text`, `--kui-font-weight-semibold`, `--kui-layout-inline-margin`, `--kui-layout-item-gap`, `--kui-layout-item-padding`, `--kui-space-2xs`, `--kui-value-table-background`, `--kui-value-table-border`, `--kui-value-table-icon-size`, `--kui-value-table-row-columns`, `--kui-value-table-row-padding-block`, `--kui-value-table-row-gap`. Set a token only where its public contract allows; prefer a prop.
|
|
66
66
|
|
|
67
67
|
Everything else is internal: `kerf-ui-analyze` reports private or unknown `.kui-*` selectors (`KUI-L001`, `KUI-L010`), unknown or private tokens (`KUI-L002`, `KUI-L012`), and any application rule that restyles the component, forced dimensions included (`KUI-L019`).
|
|
68
68
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Public API signatures for the UI authoring corpus
|
|
2
2
|
|
|
3
|
-
Generated from emitted declarations for `@kerfjs/ui@5.0.0-beta.
|
|
3
|
+
Generated from emitted declarations for `@kerfjs/ui@5.0.0-beta.87` and `kerfjs@5.0.0-beta.87`. This bounded reference covers only APIs used by the seven-task corpus. It is interface evidence, not an implementation or runtime guarantee.
|
|
4
4
|
|
|
5
5
|
## `@kerfjs/ui/css-values`
|
|
6
6
|
|
package/ai/skill.md
CHANGED
|
@@ -31,6 +31,21 @@ Use `info` for the role backed by the existing `--kui-color-brand-*` tokens.
|
|
|
31
31
|
Migrate Badge/Chip `tone="brand"` to `tone="info"`; `BadgeTone` and
|
|
32
32
|
`StateBannerTone` remain deprecated aliases of `SemanticTone`.
|
|
33
33
|
|
|
34
|
+
### Lowered surfaces are translucent
|
|
35
|
+
|
|
36
|
+
The sunken/lowered background is a semi-transparent color, not a solid canvas.
|
|
37
|
+
`--wa-color-surface-lowered` and its Kerf mirror
|
|
38
|
+
`--kui-color-surface-lowered` provide the shared tint;
|
|
39
|
+
`--kui-color-neutral-fill-quiet` uses that tint too. `SunkenPanel`, sunken
|
|
40
|
+
`Pane`/`Workbench`/`TabNavigator` surfaces, and Web Awesome
|
|
41
|
+
`appearance="sunken"` consume it through `--kui-sunken-panel-background` or
|
|
42
|
+
`--kui-wa-sunken-background` (their optional override tokens). Each painted
|
|
43
|
+
layer composites with everything beneath it. Use a separate lowered component
|
|
44
|
+
when its nested depth is intentional; do not paint the same visual surface
|
|
45
|
+
twice through a wrapper, a second background, or an unnecessary override.
|
|
46
|
+
Check the resulting contrast in both color schemes, especially over a custom
|
|
47
|
+
backdrop. See `../docs/webawesome-theme.md#contextual-transparency`.
|
|
48
|
+
|
|
34
49
|
## Components own their styles; configure, never override
|
|
35
50
|
|
|
36
51
|
This is the rule every Kerf UI surface follows, and applications and
|
|
@@ -271,6 +286,8 @@ clips focus painting; never restyle Select shadow parts from application CSS.
|
|
|
271
286
|
|
|
272
287
|
For application tabs, `AppTab presentation="icon-only"` retains its accessible `name`, `labelMaxWidth` truncates the visible name, and `attention` colors it through `--kui-app-tab-attention-color`. Configure TabBar strip geometry through public `--kui-tab-bar-strip-*` tokens.
|
|
273
288
|
|
|
289
|
+
`TabBar presentation="inspector"` uses the shared rounded rectangle radius for its strip and inset segmented tabs. Ordinary `presentation="segmented"` keeps pill strip ends and smaller corners between tabs; do not restyle AppTab to make one presentation match the other.
|
|
290
|
+
|
|
274
291
|
Set `AppTab dropTarget` while content is dragged over a tab to highlight the target without changing selection. Use `nameOverflow="visible"` for an inline loading treatment that needs the full visible name; the default is an ellipsis.
|
|
275
292
|
|
|
276
293
|
Set `pinned` on the first `AppTab` when it must stay visible while peers scroll. Keep it inside `TabBar` children so it remains in the tablist and roving focus order. Use `--kui-app-tab-pinned-background` for a non-default surrounding surface; the pinned backdrop must cover tabs beneath it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Web Awesome JSX signatures for the UI authoring corpus
|
|
2
2
|
|
|
3
|
-
Generated from the emitted `@kerfjs/ui@5.0.0-beta.
|
|
3
|
+
Generated from the emitted `@kerfjs/ui@5.0.0-beta.87` declaration boundary. Import `@kerfjs/ui/webawesome` for type effects when authoring direct `wa-*` JSX. The module emits no runtime behavior and does not register custom elements.
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
import { KerfCustomElement } from 'kerfjs/jsx-runtime';
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { filterDataAttributes } from './chunk-LAZLBC2Q.js';
|
|
2
2
|
import { jsx } from 'kerfjs/jsx-runtime';
|
|
3
3
|
|
|
4
|
+
function roleForSelectionMode(mode) {
|
|
5
|
+
switch (mode) {
|
|
6
|
+
case "single":
|
|
7
|
+
return "option";
|
|
8
|
+
case "multiple":
|
|
9
|
+
return "row";
|
|
10
|
+
case "none":
|
|
11
|
+
case "toggle":
|
|
12
|
+
return "button";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
4
15
|
var contentItemProtectedAttributes = /* @__PURE__ */ new Set([
|
|
5
16
|
"data-component",
|
|
6
17
|
"data-appearance",
|
|
@@ -64,6 +75,8 @@ function ContentItem({
|
|
|
64
75
|
"data-selected": selectionMode === "none" ? void 0 : String(selected),
|
|
65
76
|
"data-disabled": disabled ? "true" : void 0
|
|
66
77
|
} : {};
|
|
78
|
+
let role = ariaLabel ? "region" : void 0;
|
|
79
|
+
if (interactive) role = roleForSelectionMode(selectionMode);
|
|
67
80
|
return /* @__PURE__ */ jsx(
|
|
68
81
|
"div",
|
|
69
82
|
{
|
|
@@ -74,7 +87,7 @@ function ContentItem({
|
|
|
74
87
|
"data-component": "content-item",
|
|
75
88
|
"data-appearance": appearance,
|
|
76
89
|
"data-outlined": outlined ? "true" : void 0,
|
|
77
|
-
role
|
|
90
|
+
role,
|
|
78
91
|
"aria-label": ariaLabel,
|
|
79
92
|
"aria-selected": interactive && (selectionMode === "single" || selectionMode === "multiple") ? String(selected) : void 0,
|
|
80
93
|
"aria-pressed": interactive && selectionMode === "toggle" ? String(selected) : void 0,
|
|
@@ -88,4 +101,4 @@ function ContentItem({
|
|
|
88
101
|
|
|
89
102
|
export { ContentItem };
|
|
90
103
|
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
104
|
+
//# sourceMappingURL=chunk-B3TROLC2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/surfaces/content-item/content-item.tsx"],"names":[],"mappings":";;;AAkBA,SAAS,qBACP,IAAA,EAC6B;AAC7B,EAAA,QAAQ,IAAA;AAAM,IACZ,KAAK,QAAA;AACH,MAAA,OAAO,QAAA;AAAA,IACT,KAAK,UAAA;AACH,MAAA,OAAO,KAAA;AAAA,IACT,KAAK,MAAA;AAAA,IACL,KAAK,QAAA;AACH,MAAA,OAAO,QAAA;AAAA;AAEb;AAEA,IAAM,8BAAA,uBAAqC,GAAA,CAAI;AAAA,EAC7C,gBAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAC,CAAA;AACD,IAAM,8BAAA,uBAAqC,GAAA,CAAI;AAAA,EAC7C,gBAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA,kBAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA,qBAAA;AAAA,EACA;AACF,CAAC,CAAA;AAkGM,SAAS,WAAA,CAAY;AAAA,EAC1B,UAAA,GAAa,aAAA;AAAA,EACb,QAAA;AAAA,EACA,KAAA,GAAQ,MAAA;AAAA,EACR,KAAA,GAAQ,KAAA;AAAA,EACR,KAAA,GAAQ,SAAA;AAAA,EACR,KAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,QAAA,GAAW,KAAA;AAAA,EACX,QAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,MAAA;AAAA,EACA,MAAA;AAAA,EACA,aAAA,GAAgB,MAAA;AAAA,EAChB,QAAA,GAAW,KAAA;AAAA,EACX,QAAA,GAAW,KAAA;AAAA,EACX,SAAA,GAAY,EAAA;AAAA,EACZ,iBAAiB,EAAC;AAAA,EAClB;AACF,CAAA,EAAqB;AACnB,EAAA,MAAM,kBAAA,GAAqB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A,EAAe,WAAW,MAAA,GAAS,MAAA;AAAA,MACnC,IAAA;AAAA,MACA,YAAA,EAAY,SAAA;AAAA,MACZ,eAAA,EACE,gBACC,aAAA,KAAkB,QAAA,IAAY,kBAAkB,UAAA,CAAA,GAC7C,MAAA,CAAO,QAAQ,CAAA,GACf,MAAA;AAAA,MAEN,gBACE,WAAA,IAAe,aAAA,KAAkB,QAAA,GAAW,MAAA,CAAO,QAAQ,CAAA,GAAI,MAAA;AAAA,MAEjE,eAAA,EAAe,WAAA,IAAe,QAAA,GAAW,MAAA,GAAS,MAAA;AAAA,MAClD,UACE,WAAA,GACI,QAAA,GACE,OACA,GAAA,GACD,QAAA,KAAa,cAAc,IAAA,GAAO,MAAA,CAAA;AAAA,MAEzC,IAAA;AAAA,MAEC,QAAA,EAAA,WAAA,IAAe,kBAAkB,UAAA,mBAChC,GAAA,CAAC,SAAI,IAAA,EAAK,UAAA,EAAY,UAAS,CAAA,GAE/B;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-B3TROLC2.js","sourcesContent":["import type { KerfUiContent } from '../../../shared/content/semantic-content.js';\nimport { filterDataAttributes } from '../../../shared/dom/extension-attributes.js';\nimport type { SemanticTone } from '../../../shared/styles/semantic-tone.js';\n\nexport type { SemanticTone } from '../../../shared/styles/semantic-tone.js';\n\n/** Base surface treatment or semantic status colors. */\nexport type ContentItemAppearance = 'transparent' | 'surface' | SemanticTone;\n\n/** Whether the item's always-reserved 1px border is transparent or visible. */\nexport type ContentItemFrame = 'none' | 'framed';\n\n/** Corner shape: the 12px rounded rectangle or the 22px pill. */\nexport type ContentItemShape = 'rounded' | 'pill';\n/** `single` uses an option; `multiple` uses a grid row; `toggle` uses a pressed button. */\nexport type ContentItemSelectionMode =\n 'none' | 'single' | 'multiple' | 'toggle';\n\nfunction roleForSelectionMode(\n mode: ContentItemSelectionMode,\n): 'option' | 'row' | 'button' {\n switch (mode) {\n case 'single':\n return 'option';\n case 'multiple':\n return 'row';\n case 'none':\n case 'toggle':\n return 'button';\n }\n}\n\nconst contentItemProtectedAttributes = new Set([\n 'data-component',\n 'data-appearance',\n 'data-outlined',\n]);\nconst interactiveProtectedAttributes = new Set([\n 'data-component',\n 'data-appearance',\n 'data-outlined',\n 'data-action',\n 'data-item-id',\n 'data-interactive',\n 'data-selected',\n 'data-disabled',\n 'data-selection-mode',\n 'data-kui-pressed',\n]);\n\ntype ContentItemRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined> & {\n 'data-component'?: never;\n 'data-appearance'?: never;\n 'data-outlined'?: never;\n }\n>;\n\ntype ContentItemInteractiveRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined> & {\n 'data-component'?: never;\n 'data-appearance'?: never;\n 'data-outlined'?: never;\n 'data-action'?: never;\n 'data-item-id'?: never;\n 'data-interactive'?: never;\n 'data-selected'?: never;\n 'data-disabled'?: never;\n 'data-selection-mode'?: never;\n 'data-kui-pressed'?: never;\n }\n>;\n\ninterface ContentItemBaseProps {\n /**\n * Coordinated background, border, and foreground colors. `transparent`\n * preserves the surrounding surface; `surface` paints the base surface;\n * semantic values match StateBanner. Defaults to `transparent`.\n */\n appearance?: ContentItemAppearance;\n /** Item content; a plain string is allowed for bare copy. */\n children?: KerfUiContent | string;\n /**\n * `framed` paints the standard neutral border in the 1px the item always\n * reserves, so framing never changes geometry. Frame only an item that\n * marks a real distinction. Defaults to `none` (transparent border).\n */\n frame?: ContentItemFrame;\n /** Remove block padding and block borders while retaining inline geometry. */\n flush?: boolean;\n /** Corner shape. Defaults to `rounded`. */\n shape?: ContentItemShape;\n /** Native hover tooltip. */\n title?: string;\n /**\n * Names the item as a distinct region (`role=\"region\"`). Omit it for an\n * ordinary item, which stays a non-landmark grouping.\n */\n ariaLabel?: string;\n /**\n * Makes the item a programmatic focus target (`tabindex=\"-1\"`, never a tab\n * stop), for example the preferred initial focus of a NavStack view when\n * combined with `data-nav-focus` in `rootAttributes`.\n */\n focusTarget?: boolean;\n /** Keep the standard focus outline visible, such as for a drop target. */\n outlined?: boolean;\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\nexport type ContentItemProps = ContentItemBaseProps &\n (\n | {\n interactive?: false;\n action?: never;\n itemId?: never;\n selectionMode?: never;\n selected?: never;\n disabled?: never;\n /** Opt into keyboard (`0`) or programmatic (`-1`) focus. */\n tabIndex?: 0 | -1;\n /** Existing static `data-*` metadata remains available. */\n rootAttributes?: ContentItemRootAttributes;\n }\n | {\n /** Enable a keyboard reachable card; wire `wireContentItems` once on its containing root. */\n interactive: true;\n /** Delegated action dispatched by pointer, Enter, or Space. */\n action: string;\n itemId?: string;\n selectionMode?: ContentItemSelectionMode;\n selected?: boolean;\n disabled?: boolean;\n tabIndex?: never;\n /** Safe app metadata; interaction attributes are component-owned. */\n rootAttributes?: ContentItemInteractiveRootAttributes;\n }\n );\n\n/**\n * One self-contained `.kui-content` child: an 8px inline margin, a real 1px\n * border (transparent unless `framed`), 8px padding, and a rounded or pill\n * radius. It owns that whole geometry, so wrappers must not add more.\n */\nexport function ContentItem({\n appearance = 'transparent',\n children,\n frame = 'none',\n flush = false,\n shape = 'rounded',\n title,\n ariaLabel,\n focusTarget = false,\n outlined = false,\n tabIndex,\n interactive = false,\n action,\n itemId,\n selectionMode = 'none',\n selected = false,\n disabled = false,\n className = '',\n rootAttributes = {},\n slot,\n}: ContentItemProps) {\n const safeRootAttributes = filterDataAttributes(\n rootAttributes,\n interactive\n ? interactiveProtectedAttributes\n : contentItemProtectedAttributes,\n );\n if (interactive && !action) {\n throw new Error('Interactive ContentItem requires an action');\n }\n if (interactive && selected && selectionMode === 'none') {\n throw new Error('Selected ContentItem requires a selectionMode');\n }\n const cls = [\n 'kui-content-item',\n shape === 'pill' ? 'kui-content-item--pill' : '',\n frame === 'framed' ? 'kui-content-item--framed' : '',\n flush ? 'kui-content-item--flush' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n const interactiveAttributes = interactive\n ? {\n 'data-interactive': 'true',\n 'data-action': disabled ? undefined : action,\n 'data-item-id': itemId,\n 'data-selection-mode': selectionMode,\n 'data-selected':\n selectionMode === 'none' ? undefined : String(selected),\n 'data-disabled': disabled ? 'true' : undefined,\n }\n : {};\n let role: 'option' | 'row' | 'button' | 'region' | undefined = ariaLabel\n ? 'region'\n : undefined;\n if (interactive) role = roleForSelectionMode(selectionMode);\n return (\n <div\n {...safeRootAttributes}\n {...interactiveAttributes}\n class={cls}\n title={title}\n data-component=\"content-item\"\n data-appearance={appearance}\n data-outlined={outlined ? 'true' : undefined}\n role={role}\n aria-label={ariaLabel}\n aria-selected={\n interactive &&\n (selectionMode === 'single' || selectionMode === 'multiple')\n ? String(selected)\n : undefined\n }\n aria-pressed={\n interactive && selectionMode === 'toggle' ? String(selected) : undefined\n }\n aria-disabled={interactive && disabled ? 'true' : undefined}\n tabindex={\n interactive\n ? disabled\n ? '-1'\n : '0'\n : (tabIndex ?? (focusTarget ? '-1' : undefined))\n }\n slot={slot}\n >\n {interactive && selectionMode === 'multiple' ? (\n <div role=\"gridcell\">{children}</div>\n ) : (\n children\n )}\n </div>\n );\n}\n"]}
|
package/dist/content-item.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ export { LucideIcon } from './chunk-NP3FSLNX.js';
|
|
|
43
43
|
export { LoadingSpinner } from './chunk-YOKEL75M.js';
|
|
44
44
|
|
|
45
45
|
export { calc, colorVar, em, flex, foregroundColor, foregroundColorVar, lengthVar, pct, plus, px, rem, space, uiColor } from './chunk-U657IHFB.js';
|
|
46
|
-
export { ContentItem } from './chunk-
|
|
46
|
+
export { ContentItem } from './chunk-B3TROLC2.js';
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
//# sourceMappingURL=index.js.map
|
package/dist/styles/app-tab.css
CHANGED
|
@@ -94,6 +94,14 @@
|
|
|
94
94
|
border-radius: var(--kui-radius-s);
|
|
95
95
|
box-shadow: none;
|
|
96
96
|
}
|
|
97
|
+
.kui-tab-bar[data-presentation="inspector"]
|
|
98
|
+
.kui-app-tab[data-presentation="segmented"] {
|
|
99
|
+
border-radius: calc(
|
|
100
|
+
var(--kui-tab-bar-strip-radius, var(--kui-layout-rounded-radius)) -
|
|
101
|
+
var(--kui-tab-bar-strip-padding, 1px) -
|
|
102
|
+
var(--kui-tab-bar-strip-border-width, 1px)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
97
105
|
.kui-app-tab:hover {
|
|
98
106
|
border-color: var(--kui-color-neutral-border-normal);
|
|
99
107
|
background: var(--kui-app-tab-hover-background);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.kui-value-table {
|
|
2
|
-
--kui-value-table-background: var(--kui-color-surface-lowered);
|
|
3
2
|
--kui-value-table-border: var(--kui-color-neutral-border-normal);
|
|
4
3
|
--_kui-value-table-icon-size: var(--kui-value-table-icon-size, 1.5rem);
|
|
5
4
|
display: grid;
|
|
@@ -8,7 +7,10 @@
|
|
|
8
7
|
overflow: hidden;
|
|
9
8
|
border: 1px solid var(--kui-value-table-border);
|
|
10
9
|
border-radius: var(--kui-layout-rounded-radius, calc(1px + 0.6875rem));
|
|
11
|
-
background: var(
|
|
10
|
+
background: var(
|
|
11
|
+
--kui-value-table-background,
|
|
12
|
+
var(--kui-color-surface-lowered)
|
|
13
|
+
);
|
|
12
14
|
}
|
|
13
15
|
.kui-value-table__row {
|
|
14
16
|
--_kui-value-table-inline-padding: var(
|
|
@@ -68,7 +70,7 @@
|
|
|
68
70
|
max-width: 100%;
|
|
69
71
|
min-width: 0;
|
|
70
72
|
justify-self: start;
|
|
71
|
-
color: var(--kui-color-text
|
|
73
|
+
color: var(--kui-color-text);
|
|
72
74
|
align-items: center;
|
|
73
75
|
gap: var(--kui-layout-item-gap, 0.5rem);
|
|
74
76
|
}
|
|
@@ -94,6 +94,14 @@
|
|
|
94
94
|
border-radius: var(--kui-radius-s);
|
|
95
95
|
box-shadow: none;
|
|
96
96
|
}
|
|
97
|
+
.kui-tab-bar[data-presentation="inspector"]
|
|
98
|
+
.kui-app-tab[data-presentation="segmented"] {
|
|
99
|
+
border-radius: calc(
|
|
100
|
+
var(--kui-tab-bar-strip-radius, var(--kui-layout-rounded-radius)) -
|
|
101
|
+
var(--kui-tab-bar-strip-padding, 1px) -
|
|
102
|
+
var(--kui-tab-bar-strip-border-width, 1px)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
97
105
|
.kui-app-tab:hover {
|
|
98
106
|
border-color: var(--kui-color-neutral-border-normal);
|
|
99
107
|
background: var(--kui-app-tab-hover-background);
|
|
@@ -78,7 +78,10 @@
|
|
|
78
78
|
}
|
|
79
79
|
.kui-tab-bar[data-presentation="inspector"] .kui-tab-bar__tabs {
|
|
80
80
|
min-height: var(--kui-tab-bar-strip-min-height, 2.125rem);
|
|
81
|
-
border-radius: var(
|
|
81
|
+
border-radius: var(
|
|
82
|
+
--kui-tab-bar-strip-radius,
|
|
83
|
+
var(--kui-layout-rounded-radius)
|
|
84
|
+
);
|
|
82
85
|
}
|
|
83
86
|
.kui-tab-bar[data-trailing-placement="adjacent"] .kui-tab-bar__tabs {
|
|
84
87
|
flex: 0 1 auto;
|
package/dist/styles/tab-bar.css
CHANGED
|
@@ -78,7 +78,10 @@
|
|
|
78
78
|
}
|
|
79
79
|
.kui-tab-bar[data-presentation="inspector"] .kui-tab-bar__tabs {
|
|
80
80
|
min-height: var(--kui-tab-bar-strip-min-height, 2.125rem);
|
|
81
|
-
border-radius: var(
|
|
81
|
+
border-radius: var(
|
|
82
|
+
--kui-tab-bar-strip-radius,
|
|
83
|
+
var(--kui-layout-rounded-radius)
|
|
84
|
+
);
|
|
82
85
|
}
|
|
83
86
|
.kui-tab-bar[data-trailing-placement="adjacent"] .kui-tab-bar__tabs {
|
|
84
87
|
flex: 0 1 auto;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.kui-value-table {
|
|
2
|
-
--kui-value-table-background: var(--kui-color-surface-lowered);
|
|
3
2
|
--kui-value-table-border: var(--kui-color-neutral-border-normal);
|
|
4
3
|
--_kui-value-table-icon-size: var(--kui-value-table-icon-size, 1.5rem);
|
|
5
4
|
display: grid;
|
|
@@ -8,7 +7,10 @@
|
|
|
8
7
|
overflow: hidden;
|
|
9
8
|
border: 1px solid var(--kui-value-table-border);
|
|
10
9
|
border-radius: var(--kui-layout-rounded-radius, calc(1px + 0.6875rem));
|
|
11
|
-
background: var(
|
|
10
|
+
background: var(
|
|
11
|
+
--kui-value-table-background,
|
|
12
|
+
var(--kui-color-surface-lowered)
|
|
13
|
+
);
|
|
12
14
|
}
|
|
13
15
|
.kui-value-table__row {
|
|
14
16
|
--_kui-value-table-inline-padding: var(
|
|
@@ -68,7 +70,7 @@
|
|
|
68
70
|
max-width: 100%;
|
|
69
71
|
min-width: 0;
|
|
70
72
|
justify-self: start;
|
|
71
|
-
color: var(--kui-color-text
|
|
73
|
+
color: var(--kui-color-text);
|
|
72
74
|
align-items: center;
|
|
73
75
|
gap: var(--kui-layout-item-gap, 0.5rem);
|
|
74
76
|
}
|
package/dist/wire-catalog.js
CHANGED
|
@@ -28,7 +28,9 @@ function wireCatalogFilter(root) {
|
|
|
28
28
|
'[data-component="token-search-field"]'
|
|
29
29
|
);
|
|
30
30
|
field.dataset.catalogFilterActive = String(Boolean(query));
|
|
31
|
-
|
|
31
|
+
const placeholderVisible = String(!filterValue);
|
|
32
|
+
if (field.dataset.placeholderVisible !== placeholderVisible)
|
|
33
|
+
field.dataset.placeholderVisible = placeholderVisible;
|
|
32
34
|
const clear = field.querySelector(
|
|
33
35
|
'[data-action="catalog-clear-filter"]'
|
|
34
36
|
);
|
|
@@ -105,9 +107,14 @@ function wireCatalogFilter(root) {
|
|
|
105
107
|
root.addEventListener("input", onInput);
|
|
106
108
|
root.addEventListener("click", onClick);
|
|
107
109
|
const observer = new view.MutationObserver(() => {
|
|
108
|
-
if (
|
|
110
|
+
if (filterValue) apply();
|
|
111
|
+
});
|
|
112
|
+
observer.observe(root, {
|
|
113
|
+
attributes: true,
|
|
114
|
+
attributeFilter: ["data-placeholder-visible"],
|
|
115
|
+
childList: true,
|
|
116
|
+
subtree: true
|
|
109
117
|
});
|
|
110
|
-
observer.observe(root, { childList: true, subtree: true });
|
|
111
118
|
apply();
|
|
112
119
|
return () => {
|
|
113
120
|
root.removeEventListener("input", onInput);
|
package/dist/wire-catalog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/catalog/wiring/wire-catalog.ts"],"names":[],"mappings":";;;;;;;;;;AAgEA,IAAM,mBAAA,GAAsB,uBAAA;AAG5B,SAAS,kBAAkB,IAAA,EAA+B;AACxD,EAAA,MAAM,IAAA,GAAO,KAAK,aAAA,CAAc,WAAA;AAChC,EAAA,IAAI,WAAA,GAAc,EAAA;AAClB,EAAA,IAAI,KAAA,GAAQ,EAAA;AACZ,EAAA,IAAI,aAAA,GAAoC,IAAA;AACxC,EAAA,MAAM,UAAU,CAAC,IAAA,KAAiB,KAAK,iBAAA,EAAkB,CAAE,SAAS,KAAK,CAAA;AACzE,EAAA,MAAM,QAAQ,MAAM;AAClB,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,aAAA,CAA2B,uBAAuB,CAAA;AACtE,IAAA,MAAM,GAAA,GAAM,IAAA,CAAK,aAAA,CAA2B,wBAAwB,CAAA;AACpE,IAAA,IAAI,CAAC,MAAA,IAAU,CAAC,GAAA,EAAK;AACrB,IAAA,IAAI,WAAW,aAAA,EAAe;AAC5B,MAAA,aAAA,GAAgB,MAAA;AAChB,MAAA,IAAI,oBAAA,CAAqB,MAAM,CAAA,CAAE,KAAA,KAAU,WAAA;AACzC,QAAA,MAAA,CAAO,WAAA,GAAc,WAAA;AAAA,IACzB;AACA,IAAA,MAAM,QAAQ,MAAA,CAAO,OAAA;AAAA,MACnB;AAAA,KACF;AACA,IAAA,KAAA,CAAM,OAAA,CAAQ,mBAAA,GAAsB,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAC,CAAA;AACzD,IAAA,KAAA,CAAM,OAAA,CAAQ,kBAAA,GA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QAAA;AAAA,QAAS,IAAA;AAAA,QAAM,OAAA;AAAA,QAAS,iBAAiB,mBAAmB,CAAA,EAAA,CAAA;AAAA,QAAM,MAChE,eAAA;AAAgB;AAClB,KACF;AAAA,EACF;AACA,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,SAAA,CAAU,IAAA;AAAA,MACR,QAAA;AAAA,QAAS,IAAA;AAAA,QAAM,OAAA;AAAA,QAAS,iBAAiB,iBAAiB,CAAA,EAAA,CAAA;AAAA,QAAM,MAC9D,aAAA;AAAc;AAChB,KACF;AAAA,EACF;AACA,EAAA,IAAI,iBAAA,EAAmB;AACrB,IAAA,SAAA,CAAU,IAAA;AAAA,MACR,QAAA;AAAA,QAAS,IAAA;AAAA,QAAM,OAAA;AAAA,QAAS,iBAAiB,qBAAqB,CAAA,EAAA,CAAA;AAAA,QAAM,MAClE,iBAAA;AAAkB;AACpB,KACF;AAAA,EACF;AACA,EAAA,IAAI,SAAA,IAAa,WAAA;AACf,IAAA,SAAA,CAAU,IAAA;AAAA,MACR,cAAc,IAAA,EAAM;AAAA,QAClB,EAAA,EAAI,SAAA;AAAA,QACJ,MAAA,EAAQ;AAAA,UACN,QAAA,EAAU;AAAA,YACR,SAAA;AAAA,YACA,IAAA,EAAM,WAAA;AAAA,YACN,UAAA,EAAY;AAAA;AACd;AACF,OACD;AAAA,KACH;AACF,EAAA,OAAO,MAAM;AACX,IAAA,YAAA,IAAe;AACf,IAAA,KAAA,MAAW,OAAA,IAAW,SAAA,CAAU,MAAA,CAAO,CAAC,GAAG,OAAA,EAAQ;AAAA,EACrD,CAAA;AACF","file":"wire-catalog.js","sourcesContent":["import { delegate, type Signal } from 'kerfjs';\n\nimport { readTokenSearchField } from '../../components/forms/token-search-field/token-search-field.js';\nimport { wireWorkbench } from '../../components/layout/workbench/wiring/wire-workbench.js';\nimport { wireScrollDividers } from '../../wiring/wire-scroll-dividers.js';\n\nexport interface WireCatalogOptions {\n /** Invoked with the entry id when a sidebar item or a related-entry option is chosen. */\n onSelect: (id: string) => void;\n /** Invoked when the sidebar collapse/expand control is activated. */\n onToggleSidebar?: () => void;\n /** Invoked when the theme toggle is activated. */\n onToggleTheme?: () => void;\n /** Invoked when the secondary (ecosystem) group's disclosure toggle is activated. */\n onToggleSecondary?: () => void;\n /** When set, `?<urlParam>=<id>` is written on select via `history.replaceState`. */\n urlParam?: string;\n /**\n * Reveal the chosen sidebar row after selection. `true` uses desktop-safe\n * defaults; pass options to customize scroll alignment or the media guard.\n */\n revealSelection?: boolean | CatalogRevealOptions;\n selectAction?: string;\n toggleSidebarAction?: string;\n toggleThemeAction?: string;\n toggleSecondaryAction?: string;\n /**\n * The sidebar's app-owned collapsed flag. With it, the catalog's Workbench\n * sidebar is wired like any Workbench rail: it becomes a transient overlay\n * on a small screen (collapsed as the breakpoint applies, closed on Escape\n * or a press outside, focus handed back), and choosing an entry from the\n * open overlay closes it.\n */\n collapsed?: Signal<boolean>;\n /**\n * The app-owned sidebar width signal for a Catalog rendered with\n * `sidebar={{ resizable: true, size: sidebarSize.value }}`. Each committed\n * drag or keyboard resize is written to it.\n */\n sidebarSize?: Signal<number>;\n /**\n * With `sidebarSize`, load and save the width under this storage key so the\n * catalog remembers the user's sidebar width.\n */\n sidebarStorageKey?: string;\n /** The Catalog's `id`, when it is not the default `kui-catalog`. */\n id?: string;\n}\n\nexport interface CatalogRevealOptions {\n /** Scroll alignment within the sidebar. Default `'nearest'`. */\n block?: ScrollLogicalPosition;\n /** Cross-axis alignment. Default `'nearest'`. */\n inline?: ScrollLogicalPosition;\n /** Scroll behavior. Default `'auto'`. */\n behavior?: ScrollBehavior;\n /**\n * Only reveal when this media query matches. Defaults to the Catalog's\n * desktop layout; pass `false` to reveal at every viewport size.\n */\n media?: string | false;\n}\n\n// The Workbench keeps the sidebar inline above its `narrow` breakpoint (704px).\nconst catalogDesktopMedia = '(min-width: 44.01rem)';\n\n/** Keep the sidebar filter local to the shared Catalog, including across controlled rerenders. */\nfunction wireCatalogFilter(root: HTMLElement): () => void {\n const view = root.ownerDocument.defaultView!;\n let filterValue = '';\n let query = '';\n let currentEditor: HTMLElement | null = null;\n const matches = (name: string) => name.toLocaleLowerCase().includes(query);\n const apply = () => {\n const editor = root.querySelector<HTMLElement>('[data-catalog-filter]');\n const nav = root.querySelector<HTMLElement>('[data-catalog-sidebar]');\n if (!editor || !nav) return;\n if (editor !== currentEditor) {\n currentEditor = editor;\n if (readTokenSearchField(editor).query !== filterValue)\n editor.textContent = filterValue;\n }\n const field = editor.closest<HTMLElement>(\n '[data-component=\"token-search-field\"]',\n )!;\n field.dataset.catalogFilterActive = String(Boolean(query));\n field.dataset.placeholderVisible = String(!filterValue);\n const clear = field.querySelector<HTMLElement>(\n '[data-action=\"catalog-clear-filter\"]',\n )!;\n clear.style.display = query ? '' : 'none';\n nav.dataset.catalogFilterActive = String(Boolean(query));\n let visibleEntries = 0;\n for (const section of nav.querySelectorAll<HTMLElement>(\n '[data-catalog-section]',\n )) {\n const group = section.closest<HTMLElement>(\n '[data-catalog-secondary-group]',\n );\n const headingMatches =\n matches(section.dataset.catalogSection!) ||\n (group !== null && matches(group.dataset.catalogSecondaryGroup!));\n let sectionEntries = 0;\n for (const entry of section.querySelectorAll<HTMLElement>(\n '[data-catalog-entry-name]',\n )) {\n const visible =\n !query || headingMatches || matches(entry.dataset.catalogEntryName!);\n entry.hidden = !visible;\n if (visible) sectionEntries++;\n }\n section.hidden = Boolean(query) && sectionEntries === 0;\n visibleEntries += sectionEntries;\n }\n for (const group of nav.querySelectorAll<HTMLElement>(\n '[data-catalog-secondary-group]',\n )) {\n group.hidden =\n Boolean(query) &&\n !Array.from(\n group.querySelectorAll<HTMLElement>('[data-catalog-section]'),\n ).some((section) => !section.hidden);\n const toggle = group.querySelector<HTMLElement>('[aria-expanded]');\n const content = group.querySelector<HTMLElement>(\n '[data-catalog-secondary-collapsed]',\n );\n if (toggle && content) {\n const expanded = query\n ? !group.hidden\n : content.dataset.catalogSecondaryCollapsed !== 'true';\n toggle.setAttribute('aria-expanded', String(expanded));\n const arrow = toggle.querySelector<HTMLElement>(\n '[data-component=\"disclosure-arrow\"]',\n );\n if (arrow) {\n arrow.dataset.open = String(expanded);\n arrow.dataset.direction = expanded ? 'down' : 'right';\n arrow.style.setProperty(\n '--_kui-disclosure-arrow-rotation',\n expanded ? '90deg' : '0deg',\n );\n }\n }\n }\n const empty = nav.querySelector<HTMLElement>(\n '[data-catalog-filter-empty]',\n )!;\n empty.dataset.visible = String(Boolean(query) && visibleEntries === 0);\n };\n const onInput = (event: Event) => {\n const target = event.target as HTMLElement | null;\n const editor = target?.closest<HTMLElement>('[data-catalog-filter]');\n if (!editor || !root.contains(editor)) return;\n filterValue = readTokenSearchField(editor).query;\n query = filterValue.trim().toLocaleLowerCase();\n apply();\n };\n const onClick = (event: Event) => {\n const target = event.target as Element;\n if (!target.closest('[data-action=\"catalog-clear-filter\"]')) return;\n const editor = root.querySelector<HTMLElement>('[data-catalog-filter]')!;\n filterValue = '';\n query = '';\n editor.textContent = '';\n apply();\n editor.focus();\n };\n root.addEventListener('input', onInput);\n root.addEventListener('click', onClick);\n const observer = new view.MutationObserver(() => {\n if (query) apply();\n });\n observer.observe(root, { childList: true, subtree: true });\n apply();\n return () => {\n root.removeEventListener('input', onInput);\n root.removeEventListener('click', onClick);\n observer.disconnect();\n };\n}\n\n/**\n * Reveal one Catalog sidebar entry after the controlled render settles without\n * moving focus. Returns a cancellation function for rapid selection changes.\n */\nexport function revealCatalogEntry(\n root: HTMLElement,\n id: string,\n {\n block = 'nearest',\n inline = 'nearest',\n behavior = 'auto',\n media = catalogDesktopMedia,\n }: CatalogRevealOptions = {},\n): () => void {\n const view = root.ownerDocument.defaultView;\n if (!view || (media && !view.matchMedia(media).matches)) return () => {};\n const frame = view.requestAnimationFrame(() => {\n for (const item of root.querySelectorAll<HTMLElement>('[data-item-id]')) {\n if (item.dataset.itemId !== id) continue;\n item.scrollIntoView({ block, inline, behavior });\n break;\n }\n });\n return () => view.cancelAnimationFrame(frame);\n}\n\n/**\n * Wire a {@link Catalog}'s interactions with one delegated listener set: sidebar\n * item selection (and the related-entry popup menu), the sidebar collapse toggle, and\n * the theme toggle. The app owns the `active`/`collapsed`/`theme` signals and updates\n * them in the callbacks; optionally mirror the active id into the URL via `urlParam`.\n * It also wires the scroll dividers below root (`wireScrollDividers`), so the\n * catalog's panes and every example in it show their chrome dividers only\n * while scrolled. Returns a disposer.\n */\nexport function wireCatalog(\n root: HTMLElement,\n {\n onSelect,\n onToggleSidebar,\n onToggleTheme,\n onToggleSecondary,\n urlParam,\n revealSelection,\n selectAction = 'catalog-select',\n toggleSidebarAction = 'catalog-toggle-sidebar',\n toggleThemeAction = 'catalog-toggle-theme',\n toggleSecondaryAction = 'catalog-toggle-secondary',\n collapsed,\n sidebarSize,\n sidebarStorageKey,\n id: catalogId = 'kui-catalog',\n }: WireCatalogOptions,\n): () => void {\n let cancelReveal: (() => void) | undefined;\n const select = (id: string) => {\n onSelect(id);\n const view = root.ownerDocument.defaultView;\n if (urlParam && view) {\n const url = new URL(view.location.href);\n url.searchParams.set(urlParam, id);\n view.history.replaceState(null, '', url);\n }\n // An open overlay sidebar gives way to the entry just chosen from it.\n const rail = root.ownerDocument.getElementById(`${catalogId}-left-rail`);\n if (\n collapsed &&\n !collapsed.peek() &&\n rail &&\n root.ownerDocument.defaultView?.getComputedStyle(rail).position ===\n 'absolute'\n )\n collapsed.value = true;\n if (revealSelection) {\n cancelReveal?.();\n cancelReveal = revealCatalogEntry(\n root,\n id,\n revealSelection === true ? undefined : revealSelection,\n );\n }\n };\n\n const disposers: Array<() => void> = [\n wireScrollDividers(root),\n wireCatalogFilter(root),\n // Sidebar items AND the footer's related-entry popup-menu items both carry\n // `data-action={selectAction}` + `data-item-id`, so one delegated click covers both.\n delegate(\n root,\n 'click',\n `[data-action=\"${selectAction}\"]`,\n (_event, element) => {\n const id = (element as HTMLElement).dataset.itemId;\n if (id) select(id);\n },\n ),\n ];\n if (onToggleSidebar) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleSidebarAction}\"]`, () =>\n onToggleSidebar(),\n ),\n );\n }\n if (onToggleTheme) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleThemeAction}\"]`, () =>\n onToggleTheme(),\n ),\n );\n }\n if (onToggleSecondary) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleSecondaryAction}\"]`, () =>\n onToggleSecondary(),\n ),\n );\n }\n if (collapsed || sidebarSize)\n disposers.push(\n wireWorkbench(root, {\n id: catalogId,\n panels: {\n leftRail: {\n collapsed,\n size: sidebarSize,\n storageKey: sidebarStorageKey,\n },\n },\n }),\n );\n return () => {\n cancelReveal?.();\n for (const dispose of disposers.splice(0)) dispose();\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/catalog/wiring/wire-catalog.ts"],"names":[],"mappings":";;;;;;;;;;AAgEA,IAAM,mBAAA,GAAsB,uBAAA;AAG5B,SAAS,kBAAkB,IAAA,EAA+B;AACxD,EAAA,MAAM,IAAA,GAAO,KAAK,aAAA,CAAc,WAAA;AAChC,EAAA,IAAI,WAAA,GAAc,EAAA;AAClB,EAAA,IAAI,KAAA,GAAQ,EAAA;AACZ,EAAA,IAAI,aAAA,GAAoC,IAAA;AACxC,EAAA,MAAM,UAAU,CAAC,IAAA,KAAiB,KAAK,iBAAA,EAAkB,CAAE,SAAS,KAAK,CAAA;AACzE,EAAA,MAAM,QAAQ,MAAM;AAClB,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,aAAA,CAA2B,uBAAuB,CAAA;AACtE,IAAA,MAAM,GAAA,GAAM,IAAA,CAAK,aAAA,CAA2B,wBAAwB,CAAA;AACpE,IAAA,IAAI,CAAC,MAAA,IAAU,CAAC,GAAA,EAAK;AACrB,IAAA,IAAI,WAAW,aAAA,EAAe;AAC5B,MAAA,aAAA,GAAgB,MAAA;AAChB,MAAA,IAAI,oBAAA,CAAqB,MAAM,CAAA,CAAE,KAAA,KAAU,WAAA;AACz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;AAAA,YACN,UAAA,EAAY;AAAA;AACd;AACF,OACD;AAAA,KACH;AACF,EAAA,OAAO,MAAM;AACX,IAAA,YAAA,IAAe;AACf,IAAA,KAAA,MAAW,OAAA,IAAW,SAAA,CAAU,MAAA,CAAO,CAAC,GAAG,OAAA,EAAQ;AAAA,EACrD,CAAA;AACF","file":"wire-catalog.js","sourcesContent":["import { delegate, type Signal } from 'kerfjs';\n\nimport { readTokenSearchField } from '../../components/forms/token-search-field/token-search-field.js';\nimport { wireWorkbench } from '../../components/layout/workbench/wiring/wire-workbench.js';\nimport { wireScrollDividers } from '../../wiring/wire-scroll-dividers.js';\n\nexport interface WireCatalogOptions {\n /** Invoked with the entry id when a sidebar item or a related-entry option is chosen. */\n onSelect: (id: string) => void;\n /** Invoked when the sidebar collapse/expand control is activated. */\n onToggleSidebar?: () => void;\n /** Invoked when the theme toggle is activated. */\n onToggleTheme?: () => void;\n /** Invoked when the secondary (ecosystem) group's disclosure toggle is activated. */\n onToggleSecondary?: () => void;\n /** When set, `?<urlParam>=<id>` is written on select via `history.replaceState`. */\n urlParam?: string;\n /**\n * Reveal the chosen sidebar row after selection. `true` uses desktop-safe\n * defaults; pass options to customize scroll alignment or the media guard.\n */\n revealSelection?: boolean | CatalogRevealOptions;\n selectAction?: string;\n toggleSidebarAction?: string;\n toggleThemeAction?: string;\n toggleSecondaryAction?: string;\n /**\n * The sidebar's app-owned collapsed flag. With it, the catalog's Workbench\n * sidebar is wired like any Workbench rail: it becomes a transient overlay\n * on a small screen (collapsed as the breakpoint applies, closed on Escape\n * or a press outside, focus handed back), and choosing an entry from the\n * open overlay closes it.\n */\n collapsed?: Signal<boolean>;\n /**\n * The app-owned sidebar width signal for a Catalog rendered with\n * `sidebar={{ resizable: true, size: sidebarSize.value }}`. Each committed\n * drag or keyboard resize is written to it.\n */\n sidebarSize?: Signal<number>;\n /**\n * With `sidebarSize`, load and save the width under this storage key so the\n * catalog remembers the user's sidebar width.\n */\n sidebarStorageKey?: string;\n /** The Catalog's `id`, when it is not the default `kui-catalog`. */\n id?: string;\n}\n\nexport interface CatalogRevealOptions {\n /** Scroll alignment within the sidebar. Default `'nearest'`. */\n block?: ScrollLogicalPosition;\n /** Cross-axis alignment. Default `'nearest'`. */\n inline?: ScrollLogicalPosition;\n /** Scroll behavior. Default `'auto'`. */\n behavior?: ScrollBehavior;\n /**\n * Only reveal when this media query matches. Defaults to the Catalog's\n * desktop layout; pass `false` to reveal at every viewport size.\n */\n media?: string | false;\n}\n\n// The Workbench keeps the sidebar inline above its `narrow` breakpoint (704px).\nconst catalogDesktopMedia = '(min-width: 44.01rem)';\n\n/** Keep the sidebar filter local to the shared Catalog, including across controlled rerenders. */\nfunction wireCatalogFilter(root: HTMLElement): () => void {\n const view = root.ownerDocument.defaultView!;\n let filterValue = '';\n let query = '';\n let currentEditor: HTMLElement | null = null;\n const matches = (name: string) => name.toLocaleLowerCase().includes(query);\n const apply = () => {\n const editor = root.querySelector<HTMLElement>('[data-catalog-filter]');\n const nav = root.querySelector<HTMLElement>('[data-catalog-sidebar]');\n if (!editor || !nav) return;\n if (editor !== currentEditor) {\n currentEditor = editor;\n if (readTokenSearchField(editor).query !== filterValue)\n editor.textContent = filterValue;\n }\n const field = editor.closest<HTMLElement>(\n '[data-component=\"token-search-field\"]',\n )!;\n field.dataset.catalogFilterActive = String(Boolean(query));\n const placeholderVisible = String(!filterValue);\n if (field.dataset.placeholderVisible !== placeholderVisible)\n field.dataset.placeholderVisible = placeholderVisible;\n const clear = field.querySelector<HTMLElement>(\n '[data-action=\"catalog-clear-filter\"]',\n )!;\n clear.style.display = query ? '' : 'none';\n nav.dataset.catalogFilterActive = String(Boolean(query));\n let visibleEntries = 0;\n for (const section of nav.querySelectorAll<HTMLElement>(\n '[data-catalog-section]',\n )) {\n const group = section.closest<HTMLElement>(\n '[data-catalog-secondary-group]',\n );\n const headingMatches =\n matches(section.dataset.catalogSection!) ||\n (group !== null && matches(group.dataset.catalogSecondaryGroup!));\n let sectionEntries = 0;\n for (const entry of section.querySelectorAll<HTMLElement>(\n '[data-catalog-entry-name]',\n )) {\n const visible =\n !query || headingMatches || matches(entry.dataset.catalogEntryName!);\n entry.hidden = !visible;\n if (visible) sectionEntries++;\n }\n section.hidden = Boolean(query) && sectionEntries === 0;\n visibleEntries += sectionEntries;\n }\n for (const group of nav.querySelectorAll<HTMLElement>(\n '[data-catalog-secondary-group]',\n )) {\n group.hidden =\n Boolean(query) &&\n !Array.from(\n group.querySelectorAll<HTMLElement>('[data-catalog-section]'),\n ).some((section) => !section.hidden);\n const toggle = group.querySelector<HTMLElement>('[aria-expanded]');\n const content = group.querySelector<HTMLElement>(\n '[data-catalog-secondary-collapsed]',\n );\n if (toggle && content) {\n const expanded = query\n ? !group.hidden\n : content.dataset.catalogSecondaryCollapsed !== 'true';\n toggle.setAttribute('aria-expanded', String(expanded));\n const arrow = toggle.querySelector<HTMLElement>(\n '[data-component=\"disclosure-arrow\"]',\n );\n if (arrow) {\n arrow.dataset.open = String(expanded);\n arrow.dataset.direction = expanded ? 'down' : 'right';\n arrow.style.setProperty(\n '--_kui-disclosure-arrow-rotation',\n expanded ? '90deg' : '0deg',\n );\n }\n }\n }\n const empty = nav.querySelector<HTMLElement>(\n '[data-catalog-filter-empty]',\n )!;\n empty.dataset.visible = String(Boolean(query) && visibleEntries === 0);\n };\n const onInput = (event: Event) => {\n const target = event.target as HTMLElement | null;\n const editor = target?.closest<HTMLElement>('[data-catalog-filter]');\n if (!editor || !root.contains(editor)) return;\n filterValue = readTokenSearchField(editor).query;\n query = filterValue.trim().toLocaleLowerCase();\n apply();\n };\n const onClick = (event: Event) => {\n const target = event.target as Element;\n if (!target.closest('[data-action=\"catalog-clear-filter\"]')) return;\n const editor = root.querySelector<HTMLElement>('[data-catalog-filter]')!;\n filterValue = '';\n query = '';\n editor.textContent = '';\n apply();\n editor.focus();\n };\n root.addEventListener('input', onInput);\n root.addEventListener('click', onClick);\n const observer = new view.MutationObserver(() => {\n if (filterValue) apply();\n });\n observer.observe(root, {\n attributes: true,\n attributeFilter: ['data-placeholder-visible'],\n childList: true,\n subtree: true,\n });\n apply();\n return () => {\n root.removeEventListener('input', onInput);\n root.removeEventListener('click', onClick);\n observer.disconnect();\n };\n}\n\n/**\n * Reveal one Catalog sidebar entry after the controlled render settles without\n * moving focus. Returns a cancellation function for rapid selection changes.\n */\nexport function revealCatalogEntry(\n root: HTMLElement,\n id: string,\n {\n block = 'nearest',\n inline = 'nearest',\n behavior = 'auto',\n media = catalogDesktopMedia,\n }: CatalogRevealOptions = {},\n): () => void {\n const view = root.ownerDocument.defaultView;\n if (!view || (media && !view.matchMedia(media).matches)) return () => {};\n const frame = view.requestAnimationFrame(() => {\n for (const item of root.querySelectorAll<HTMLElement>('[data-item-id]')) {\n if (item.dataset.itemId !== id) continue;\n item.scrollIntoView({ block, inline, behavior });\n break;\n }\n });\n return () => view.cancelAnimationFrame(frame);\n}\n\n/**\n * Wire a {@link Catalog}'s interactions with one delegated listener set: sidebar\n * item selection (and the related-entry popup menu), the sidebar collapse toggle, and\n * the theme toggle. The app owns the `active`/`collapsed`/`theme` signals and updates\n * them in the callbacks; optionally mirror the active id into the URL via `urlParam`.\n * It also wires the scroll dividers below root (`wireScrollDividers`), so the\n * catalog's panes and every example in it show their chrome dividers only\n * while scrolled. Returns a disposer.\n */\nexport function wireCatalog(\n root: HTMLElement,\n {\n onSelect,\n onToggleSidebar,\n onToggleTheme,\n onToggleSecondary,\n urlParam,\n revealSelection,\n selectAction = 'catalog-select',\n toggleSidebarAction = 'catalog-toggle-sidebar',\n toggleThemeAction = 'catalog-toggle-theme',\n toggleSecondaryAction = 'catalog-toggle-secondary',\n collapsed,\n sidebarSize,\n sidebarStorageKey,\n id: catalogId = 'kui-catalog',\n }: WireCatalogOptions,\n): () => void {\n let cancelReveal: (() => void) | undefined;\n const select = (id: string) => {\n onSelect(id);\n const view = root.ownerDocument.defaultView;\n if (urlParam && view) {\n const url = new URL(view.location.href);\n url.searchParams.set(urlParam, id);\n view.history.replaceState(null, '', url);\n }\n // An open overlay sidebar gives way to the entry just chosen from it.\n const rail = root.ownerDocument.getElementById(`${catalogId}-left-rail`);\n if (\n collapsed &&\n !collapsed.peek() &&\n rail &&\n root.ownerDocument.defaultView?.getComputedStyle(rail).position ===\n 'absolute'\n )\n collapsed.value = true;\n if (revealSelection) {\n cancelReveal?.();\n cancelReveal = revealCatalogEntry(\n root,\n id,\n revealSelection === true ? undefined : revealSelection,\n );\n }\n };\n\n const disposers: Array<() => void> = [\n wireScrollDividers(root),\n wireCatalogFilter(root),\n // Sidebar items AND the footer's related-entry popup-menu items both carry\n // `data-action={selectAction}` + `data-item-id`, so one delegated click covers both.\n delegate(\n root,\n 'click',\n `[data-action=\"${selectAction}\"]`,\n (_event, element) => {\n const id = (element as HTMLElement).dataset.itemId;\n if (id) select(id);\n },\n ),\n ];\n if (onToggleSidebar) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleSidebarAction}\"]`, () =>\n onToggleSidebar(),\n ),\n );\n }\n if (onToggleTheme) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleThemeAction}\"]`, () =>\n onToggleTheme(),\n ),\n );\n }\n if (onToggleSecondary) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleSecondaryAction}\"]`, () =>\n onToggleSecondary(),\n ),\n );\n }\n if (collapsed || sidebarSize)\n disposers.push(\n wireWorkbench(root, {\n id: catalogId,\n panels: {\n leftRail: {\n collapsed,\n size: sidebarSize,\n storageKey: sidebarStorageKey,\n },\n },\n }),\n );\n return () => {\n cancelReveal?.();\n for (const dispose of disposers.splice(0)) dispose();\n };\n}\n"]}
|
|
@@ -10,9 +10,18 @@ function nextTile(item, rows, key) {
|
|
|
10
10
|
return { row, x: rect.left + rect.width / 2, y: rect.top };
|
|
11
11
|
});
|
|
12
12
|
const sameLine = (y) => Math.abs(y - current.top) < 1;
|
|
13
|
-
const directed = candidates.filter(
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const directed = candidates.filter(({ x, y }) => {
|
|
14
|
+
switch (key) {
|
|
15
|
+
case "ArrowLeft":
|
|
16
|
+
return sameLine(y) && x < centerX;
|
|
17
|
+
case "ArrowRight":
|
|
18
|
+
return sameLine(y) && x > centerX;
|
|
19
|
+
case "ArrowUp":
|
|
20
|
+
return y < current.top - 1;
|
|
21
|
+
default:
|
|
22
|
+
return y > current.top + 1;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
16
25
|
directed.sort((a, b) => {
|
|
17
26
|
if (key === "ArrowLeft") return b.x - a.x;
|
|
18
27
|
if (key === "ArrowRight") return a.x - b.x;
|
|
@@ -66,7 +75,23 @@ function wireContentItems(root) {
|
|
|
66
75
|
const index = rows.indexOf(item);
|
|
67
76
|
if (index < 0) return;
|
|
68
77
|
const isTileGrid = grid.getAttribute("data-component") === "grid";
|
|
69
|
-
|
|
78
|
+
let next;
|
|
79
|
+
switch (event.key) {
|
|
80
|
+
case "Home":
|
|
81
|
+
next = rows[0];
|
|
82
|
+
break;
|
|
83
|
+
case "End":
|
|
84
|
+
next = rows[rows.length - 1];
|
|
85
|
+
break;
|
|
86
|
+
case "ArrowDown":
|
|
87
|
+
case "ArrowUp":
|
|
88
|
+
next = isTileGrid ? nextTile(item, rows, event.key) : rows[index + (event.key === "ArrowDown" ? 1 : -1)];
|
|
89
|
+
break;
|
|
90
|
+
case "ArrowLeft":
|
|
91
|
+
case "ArrowRight":
|
|
92
|
+
next = isTileGrid ? nextTile(item, rows, event.key) : void 0;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
70
95
|
if (next) {
|
|
71
96
|
event.preventDefault();
|
|
72
97
|
next.focus();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/surfaces/content-item/wiring/wire-content-items.ts"],"names":[],"mappings":";AAAA,IAAM,aAAA,GACJ,0DAAA;AACF,IAAM,uBAAA,GACJ,qFAAA;AACF,IAAM,mBAAA,GAAsB,4CAAA;AAE5B,SAAS,QAAA,CACP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KAAA,EAAM;AAAA,EACf,CAAA;AAEA,EAAA,MAAM,QAAA,GAAW,CAAC,KAAA,KAAsB;AACtC,IAAA,IAAI,KAAA,CAAM,MAAA,KAAW,YAAA,EAAc,UAAA,EAAW;AAAA,EAChD,CAAA;AAEA,EAAA,IAAA,CAAK,gBAAA,CAAiB,WAAW,OAAO,CAAA;AACxC,EAAA,IAAA,CAAK,gBAAA,CAAiB,SAAS,KAAK,CAAA;AACpC,EAAA,IAAA,CAAK,gBAAA,CAAiB,YAAY,QAAQ,CAAA;AAC1C,EAAA,OAAO,MAAM;AACX,IAAA,UAAA,EAAW;AACX,IAAA,IAAA,CAAK,mBAAA,CAAoB,WAAW,OAAO,CAAA;AAC3C,IAAA,IAAA,CAAK,mBAAA,CAAoB,SAAS,KAAK,CAAA;AACvC,IAAA,IAAA,CAAK,mBAAA,CAAoB,YAAY,QAAQ,CAAA;AAAA,EAC/C,CAAA;AACF","file":"wire-content-items.js","sourcesContent":["const ITEM_SELECTOR =\n '[data-component=\"content-item\"][data-interactive=\"true\"]';\nconst NESTED_CONTROL_SELECTOR =\n 'button, a[href], input, select, textarea, [contenteditable=\"true\"], [role=\"button\"]';\nconst MULTI_GRID_SELECTOR = '[role=\"grid\"][aria-multiselectable=\"true\"]';\n\nfunction nextTile(\n item: HTMLElement,\n rows: HTMLElement[],\n key: string,\n): HTMLElement | undefined {\n const current = item.getBoundingClientRect();\n const centerX = current.left + current.width / 2;\n const candidates = rows\n .filter((row) => row !== item)\n .map((row) => {\n const rect = row.getBoundingClientRect();\n return { row, x: rect.left + rect.width / 2, y: rect.top };\n });\n const sameLine = (y: number) => Math.abs(y - current.top) < 1;\n const directed = candidates.filter(({ x, y }) =>\n key === 'ArrowLeft'\n ? sameLine(y) && x < centerX\n : key === 'ArrowRight'\n ? sameLine(y) && x > centerX\n : key === 'ArrowUp'\n ? y < current.top - 1\n : y > current.top + 1,\n );\n directed.sort((a, b) => {\n if (key === 'ArrowLeft') return b.x - a.x;\n if (key === 'ArrowRight') return a.x - b.x;\n const vertical = Math.abs(a.y - current.top) - Math.abs(b.y - current.top);\n return vertical || Math.abs(a.x - centerX) - Math.abs(b.x - centerX);\n });\n return directed[0]?.row;\n}\n\nfunction actionItem(root: HTMLElement, event: Event) {\n const target = event.target;\n if (!(target instanceof Element)) return null;\n const item = target.closest<HTMLElement>(ITEM_SELECTOR);\n if (!item || !root.contains(item) || item.dataset.disabled === 'true')\n return null;\n // Composed events expose native controls inside a custom element's shadow\n // root even though event.target is retargeted to its host here.\n for (const node of event.composedPath()) {\n if (node === item) break;\n if (node instanceof Element && node.matches(NESTED_CONTROL_SELECTOR))\n return null;\n }\n return item;\n}\n\n/** True when a card action originated on the card rather than a nested control. */\nexport function isContentItemActivation(\n event: Event,\n item: HTMLElement,\n): boolean {\n return actionItem(item, event) === item;\n}\n\n/**\n * Give interactive ContentItems native-like Enter/Space activation with one\n * delegated listener pair. Space activates on release and is cancelled if\n * focus moves; the item's own `data-action` still goes through the app's\n * ordinary delegated click handler. Returns a disposer.\n */\nexport function wireContentItems(root: HTMLElement): () => void {\n let pendingSpace: HTMLElement | null = null;\n\n const clearSpace = () => {\n pendingSpace?.removeAttribute('data-kui-pressed');\n pendingSpace = null;\n };\n\n const keydown = (event: KeyboardEvent) => {\n if (\n event.defaultPrevented ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey\n )\n return;\n const item = actionItem(root, event);\n if (!item) return;\n if (\n item.dataset.selectionMode === 'multiple' &&\n [\n 'ArrowDown',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n ].includes(event.key)\n ) {\n const grid = item.closest(MULTI_GRID_SELECTOR);\n if (!grid) return;\n const rows = Array.from(\n grid.querySelectorAll<HTMLElement>(\n `${ITEM_SELECTOR}[data-selection-mode=\"multiple\"]:not([data-disabled=\"true\"])`,\n ),\n ).filter((row) => row.closest(MULTI_GRID_SELECTOR) === grid);\n const index = rows.indexOf(item);\n if (index < 0) return;\n const isTileGrid = grid.getAttribute('data-component') === 'grid';\n const next =\n event.key === 'Home'\n ? rows[0]\n : event.key === 'End'\n ? rows[rows.length - 1]\n : isTileGrid\n ? nextTile(item, rows, event.key)\n : event.key === 'ArrowDown' || event.key === 'ArrowUp'\n ? rows[index + (event.key === 'ArrowDown' ? 1 : -1)]\n : undefined;\n if (next) {\n event.preventDefault();\n next.focus();\n }\n return;\n }\n if (event.key === 'Enter') {\n event.preventDefault();\n item.click();\n return;\n }\n if (event.key === ' ' || event.key === 'Spacebar') {\n event.preventDefault();\n if (event.repeat) return;\n clearSpace();\n pendingSpace = item;\n item.setAttribute('data-kui-pressed', 'true');\n }\n };\n\n const keyup = (event: KeyboardEvent) => {\n if (event.key !== ' ' && event.key !== 'Spacebar') return;\n const item = pendingSpace;\n if (!item) return;\n event.preventDefault();\n clearSpace();\n if (\n item === actionItem(root, event) &&\n item.ownerDocument.activeElement === item\n )\n item.click();\n };\n\n const focusout = (event: FocusEvent) => {\n if (event.target === pendingSpace) clearSpace();\n };\n\n root.addEventListener('keydown', keydown);\n root.addEventListener('keyup', keyup);\n root.addEventListener('focusout', focusout);\n return () => {\n clearSpace();\n root.removeEventListener('keydown', keydown);\n root.removeEventListener('keyup', keyup);\n root.removeEventListener('focusout', focusout);\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/surfaces/content-item/wiring/wire-content-items.ts"],"names":[],"mappings":";AAAA,IAAM,aAAA,GACJ,0DAAA;AACF,IAAM,uBAAA,GACJ,qFAAA;AACF,IAAM,mBAAA,GAAsB,4CAAA;AAE5B,SAAS,QAAA,CACP,IAAA,EACA,IAAA,EACA,GAAA,EACyB;AACzB,EAAA,MAAM,OAAA,GAAU,KAAK,qBAAA,EAAsB;AAC3C,EAAA,MAAM,OAAA,GAAU,OAAA,CAAQ,IAAA,GAAO,OAAA,CAAQ,KAAA,GAAQ,CAAA;AAC/C,EAAA,MAAM,UAAA,GAAa,IAAA,CAChB,MAAA,CAAO,CAAC,GAAA,KAA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AA,EAAM,KAAK,CAAA,IAC/B,IAAA,CAAK,cAAc,aAAA,KAAkB,IAAA;AAErC,MAAA,IAAA,CAAK,KAAA,EAAM;AAAA,EACf,CAAA;AAEA,EAAA,MAAM,QAAA,GAAW,CAAC,KAAA,KAAsB;AACtC,IAAA,IAAI,KAAA,CAAM,MAAA,KAAW,YAAA,EAAc,UAAA,EAAW;AAAA,EAChD,CAAA;AAEA,EAAA,IAAA,CAAK,gBAAA,CAAiB,WAAW,OAAO,CAAA;AACxC,EAAA,IAAA,CAAK,gBAAA,CAAiB,SAAS,KAAK,CAAA;AACpC,EAAA,IAAA,CAAK,gBAAA,CAAiB,YAAY,QAAQ,CAAA;AAC1C,EAAA,OAAO,MAAM;AACX,IAAA,UAAA,EAAW;AACX,IAAA,IAAA,CAAK,mBAAA,CAAoB,WAAW,OAAO,CAAA;AAC3C,IAAA,IAAA,CAAK,mBAAA,CAAoB,SAAS,KAAK,CAAA;AACvC,IAAA,IAAA,CAAK,mBAAA,CAAoB,YAAY,QAAQ,CAAA;AAAA,EAC/C,CAAA;AACF","file":"wire-content-items.js","sourcesContent":["const ITEM_SELECTOR =\n '[data-component=\"content-item\"][data-interactive=\"true\"]';\nconst NESTED_CONTROL_SELECTOR =\n 'button, a[href], input, select, textarea, [contenteditable=\"true\"], [role=\"button\"]';\nconst MULTI_GRID_SELECTOR = '[role=\"grid\"][aria-multiselectable=\"true\"]';\n\nfunction nextTile(\n item: HTMLElement,\n rows: HTMLElement[],\n key: string,\n): HTMLElement | undefined {\n const current = item.getBoundingClientRect();\n const centerX = current.left + current.width / 2;\n const candidates = rows\n .filter((row) => row !== item)\n .map((row) => {\n const rect = row.getBoundingClientRect();\n return { row, x: rect.left + rect.width / 2, y: rect.top };\n });\n const sameLine = (y: number) => Math.abs(y - current.top) < 1;\n const directed = candidates.filter(({ x, y }) => {\n switch (key) {\n case 'ArrowLeft':\n return sameLine(y) && x < centerX;\n case 'ArrowRight':\n return sameLine(y) && x > centerX;\n case 'ArrowUp':\n return y < current.top - 1;\n default:\n return y > current.top + 1;\n }\n });\n directed.sort((a, b) => {\n if (key === 'ArrowLeft') return b.x - a.x;\n if (key === 'ArrowRight') return a.x - b.x;\n const vertical = Math.abs(a.y - current.top) - Math.abs(b.y - current.top);\n return vertical || Math.abs(a.x - centerX) - Math.abs(b.x - centerX);\n });\n return directed[0]?.row;\n}\n\nfunction actionItem(root: HTMLElement, event: Event) {\n const target = event.target;\n if (!(target instanceof Element)) return null;\n const item = target.closest<HTMLElement>(ITEM_SELECTOR);\n if (!item || !root.contains(item) || item.dataset.disabled === 'true')\n return null;\n // Composed events expose native controls inside a custom element's shadow\n // root even though event.target is retargeted to its host here.\n for (const node of event.composedPath()) {\n if (node === item) break;\n if (node instanceof Element && node.matches(NESTED_CONTROL_SELECTOR))\n return null;\n }\n return item;\n}\n\n/** True when a card action originated on the card rather than a nested control. */\nexport function isContentItemActivation(\n event: Event,\n item: HTMLElement,\n): boolean {\n return actionItem(item, event) === item;\n}\n\n/**\n * Give interactive ContentItems native-like Enter/Space activation with one\n * delegated listener pair. Space activates on release and is cancelled if\n * focus moves; the item's own `data-action` still goes through the app's\n * ordinary delegated click handler. Returns a disposer.\n */\nexport function wireContentItems(root: HTMLElement): () => void {\n let pendingSpace: HTMLElement | null = null;\n\n const clearSpace = () => {\n pendingSpace?.removeAttribute('data-kui-pressed');\n pendingSpace = null;\n };\n\n const keydown = (event: KeyboardEvent) => {\n if (\n event.defaultPrevented ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey\n )\n return;\n const item = actionItem(root, event);\n if (!item) return;\n if (\n item.dataset.selectionMode === 'multiple' &&\n [\n 'ArrowDown',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n ].includes(event.key)\n ) {\n const grid = item.closest(MULTI_GRID_SELECTOR);\n if (!grid) return;\n const rows = Array.from(\n grid.querySelectorAll<HTMLElement>(\n `${ITEM_SELECTOR}[data-selection-mode=\"multiple\"]:not([data-disabled=\"true\"])`,\n ),\n ).filter((row) => row.closest(MULTI_GRID_SELECTOR) === grid);\n const index = rows.indexOf(item);\n if (index < 0) return;\n const isTileGrid = grid.getAttribute('data-component') === 'grid';\n let next: HTMLElement | undefined;\n switch (event.key) {\n case 'Home':\n next = rows[0];\n break;\n case 'End':\n next = rows[rows.length - 1];\n break;\n case 'ArrowDown':\n case 'ArrowUp':\n next = isTileGrid\n ? nextTile(item, rows, event.key)\n : rows[index + (event.key === 'ArrowDown' ? 1 : -1)];\n break;\n case 'ArrowLeft':\n case 'ArrowRight':\n next = isTileGrid ? nextTile(item, rows, event.key) : undefined;\n break;\n }\n if (next) {\n event.preventDefault();\n next.focus();\n }\n return;\n }\n if (event.key === 'Enter') {\n event.preventDefault();\n item.click();\n return;\n }\n if (event.key === ' ' || event.key === 'Spacebar') {\n event.preventDefault();\n if (event.repeat) return;\n clearSpace();\n pendingSpace = item;\n item.setAttribute('data-kui-pressed', 'true');\n }\n };\n\n const keyup = (event: KeyboardEvent) => {\n if (event.key !== ' ' && event.key !== 'Spacebar') return;\n const item = pendingSpace;\n if (!item) return;\n event.preventDefault();\n clearSpace();\n if (\n item === actionItem(root, event) &&\n item.ownerDocument.activeElement === item\n )\n item.click();\n };\n\n const focusout = (event: FocusEvent) => {\n if (event.target === pendingSpace) clearSpace();\n };\n\n root.addEventListener('keydown', keydown);\n root.addEventListener('keyup', keyup);\n root.addEventListener('focusout', focusout);\n return () => {\n clearSpace();\n root.removeEventListener('keydown', keydown);\n root.removeEventListener('keyup', keyup);\n root.removeEventListener('focusout', focusout);\n };\n}\n"]}
|
package/docs/catalog.md
CHANGED
|
@@ -61,8 +61,9 @@ filters entry names and section headings as text is typed,
|
|
|
61
61
|
ignoring case. A heading match shows all its entries; a matching secondary
|
|
62
62
|
group heading searches its sections too, even while that group is collapsed.
|
|
63
63
|
Empty sections disappear and an empty-result message appears when nothing
|
|
64
|
-
matches. The query survives controlled Catalog rerenders
|
|
65
|
-
|
|
64
|
+
matches. The query survives controlled Catalog rerenders, with the field's
|
|
65
|
+
placeholder hidden while text remains, and clears through the field's clear
|
|
66
|
+
action. Filtering does not change the selected
|
|
66
67
|
entry or its preview.
|
|
67
68
|
|
|
68
69
|
Per-entry `resources` render as "open in new tab" links in the footer, and
|
|
@@ -339,7 +339,10 @@ parent's name. `ResizableRegion` widens its edge extent by the unsafe inset a
|
|
|
339
339
|
split `SplitView` provides, and a `Skeleton` derives its fill from a solid
|
|
340
340
|
`Badge`'s on-solid color, both in their own stylesheets; an `AppTab` rounds its
|
|
341
341
|
outer corners in a segmented `TabBar` and shares a fill-allocated strip from
|
|
342
|
-
`app-tab.css`.
|
|
342
|
+
`app-tab.css`. An inspector `TabBar` uses the shared 12px rounded rectangle
|
|
343
|
+
radius on its strip; its segmented `AppTab` corners follow that strip's inner
|
|
344
|
+
curve, while an ordinary segmented strip keeps its pill ends and smaller
|
|
345
|
+
interior corners. A `PopupMenu` sizes
|
|
343
346
|
its trigger and applies a group's `menuInset` in its own stylesheet, and an
|
|
344
347
|
icon-only `Select` reads the control slot a `ToolbarControlGroup` provides
|
|
345
348
|
(`--_kui-toolbar-control-group-slot-*`). A parent may still style its own
|
|
@@ -671,6 +674,13 @@ value rather than running under it. A short label keeps its width beside a
|
|
|
671
674
|
long value, which wraps; when both are long they split the row, so neither is
|
|
672
675
|
starved.
|
|
673
676
|
|
|
677
|
+
`ValueTable` defaults to the shared lowered surface and uses the normal text
|
|
678
|
+
color for normal-weight labels, including when nested in a
|
|
679
|
+
sunken `Pane`. Set `--kui-value-table-background` on an application-owned
|
|
680
|
+
ancestor to change that surface for its tables; the table reads the inherited
|
|
681
|
+
token and falls back to the lowered surface when it is absent. The application
|
|
682
|
+
is responsible for checking text contrast when it supplies a custom background.
|
|
683
|
+
|
|
674
684
|
## Imports and side effects
|
|
675
685
|
|
|
676
686
|
Every component has an explicit JS and CSS subpath. In CSS-aware browser builds,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 460 220" width="460" height="220"><defs><clipPath id="cp0"><rect x="28" y="20" width="404" height="165.2"/></clipPath><clipPath id="ov1"><rect x="29" y="21" width="402" height="163.2" rx="11"/></clipPath><clipPath id="cp2"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="ct3"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="ct4"><rect x="241.7" y="32.4" width="181.3" height="18"/></clipPath><clipPath id="cp5"><rect x="37" y="70" width="24" height="24.2"/></clipPath><clipPath id="cp7"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="ct8"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="ct9"><rect x="253.1" y="73.2" width="169.9" height="18"/></clipPath><clipPath id="cp10"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="ct11"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="ct12"><rect x="222.2" y="114" width="200.8" height="18"/></clipPath><clipPath id="cp13"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="ct14"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="ct15"><rect x="230.9" y="154.8" width="192.1" height="18"/></clipPath></defs><g clip-path="url(#cp0)"><rect x="28" y="20" width="404" height="165.2" rx="12" fill="rgba(228,228,255,0.075)"/><rect x="28.5" y="20.5" width="403" height="164" rx="11.5" fill="none" stroke="rgba(253,253,255,0.196)" stroke-width="1"/></g><g clip-path="url(#ov1)"><g clip-path="url(#cp2)"><g clip-path="url(#ct3)"><text x="37" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 460 220" width="460" height="220"><defs><clipPath id="cp0"><rect x="28" y="20" width="404" height="165.2"/></clipPath><clipPath id="ov1"><rect x="29" y="21" width="402" height="163.2" rx="11"/></clipPath><clipPath id="cp2"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="ct3"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="ct4"><rect x="241.7" y="32.4" width="181.3" height="18"/></clipPath><clipPath id="cp5"><rect x="37" y="70" width="24" height="24.2"/></clipPath><clipPath id="cp7"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="ct8"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="ct9"><rect x="253.1" y="73.2" width="169.9" height="18"/></clipPath><clipPath id="cp10"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="ct11"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="ct12"><rect x="222.2" y="114" width="200.8" height="18"/></clipPath><clipPath id="cp13"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="ct14"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="ct15"><rect x="230.9" y="154.8" width="192.1" height="18"/></clipPath></defs><g clip-path="url(#cp0)"><rect x="28" y="20" width="404" height="165.2" rx="12" fill="rgba(228,228,255,0.075)"/><rect x="28.5" y="20.5" width="403" height="164" rx="11.5" fill="none" stroke="rgba(253,253,255,0.196)" stroke-width="1"/></g><g clip-path="url(#ov1)"><g clip-path="url(#cp2)"><g clip-path="url(#ct3)"><text x="37" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(245,245,247)">Status</text></g></g><text x="391.91" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(245,245,247)">Live</text></g><g clip-path="url(#ov1)"><g clip-path="url(#cp5)"><g color="rgb(245, 245, 247)"><clipPath id="svgic6"><rect x="37" y="70.2" width="24" height="24"/></clipPath><g clip-path="url(#svgic6)"><g transform="translate(37 70.188)"><path d="M12 15v5s3-.6 4-2c1-1.6 0-5 0-5" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(245, 245, 247)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M4.5 16.5c-1.5 1.3-2 5-2 5s3.7-.5 5-2c.7-.8.7-2.1 0-3a2 2 0 0 0-3 0" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(245, 245, 247)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M9 12a22 22 0 0 1 2-4 13 13 0 0 1 11-6c0 2.7-.8 7.5-6 11a22 22 0 0 1-4 2Z" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(245, 245, 247)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M9 12H4s.5-3 2-4c1.6-1 5 0 5 0" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(245, 245, 247)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/></g></g></g></g><g clip-path="url(#cp7)"><g clip-path="url(#ct8)"><text x="69" y="88.19" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(245,245,247)">Environment</text></g></g><text x="338.63" y="88.19" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(245,245,247)">Production</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="69" y1="62.5" x2="423" y2="62.5" stroke="rgba(253, 253, 255, 0.196)" stroke-width="1"/></g></g></g><g clip-path="url(#ov1)"><g clip-path="url(#cp10)"><g clip-path="url(#ct11)"><text x="37" y="128.98" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(245,245,247)">Region</text></g></g><text x="349.39" y="128.98" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(245,245,247)">us-east-1</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="37" y1="103.5" x2="423" y2="103.5" stroke="rgba(253, 253, 255, 0.196)" stroke-width="1"/></g></g></g><g clip-path="url(#ov1)"><g clip-path="url(#cp13)"><g clip-path="url(#ct14)"><text x="37" y="169.78" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(245,245,247)">Last deploy</text></g></g><text x="333.14" y="169.78" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(245,245,247)">2 hours ago</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="37" y1="143.5" x2="423" y2="143.5" stroke="rgba(253, 253, 255, 0.196)" stroke-width="1"/></g></g></g></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 460 220" width="460" height="220"><defs><clipPath id="cp0"><rect x="28" y="20" width="404" height="165.2"/></clipPath><clipPath id="ov1"><rect x="29" y="21" width="402" height="163.2" rx="11"/></clipPath><clipPath id="cp2"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="ct3"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="ct4"><rect x="241.7" y="32.4" width="181.3" height="18"/></clipPath><clipPath id="cp5"><rect x="37" y="70" width="24" height="24.2"/></clipPath><clipPath id="cp7"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="ct8"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="ct9"><rect x="253.1" y="73.2" width="169.9" height="18"/></clipPath><clipPath id="cp10"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="ct11"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="ct12"><rect x="222.2" y="114" width="200.8" height="18"/></clipPath><clipPath id="cp13"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="ct14"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="ct15"><rect x="230.9" y="154.8" width="192.1" height="18"/></clipPath></defs><g clip-path="url(#cp0)"><rect x="28" y="20" width="404" height="165.2" rx="12" fill="rgba(0,0,98,0.05)"/><rect x="28.5" y="20.5" width="403" height="164" rx="11.5" fill="none" stroke="rgba(0,0,28,0.18)" stroke-width="1"/></g><g clip-path="url(#ov1)"><g clip-path="url(#cp2)"><g clip-path="url(#ct3)"><text x="37" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 460 220" width="460" height="220"><defs><clipPath id="cp0"><rect x="28" y="20" width="404" height="165.2"/></clipPath><clipPath id="ov1"><rect x="29" y="21" width="402" height="163.2" rx="11"/></clipPath><clipPath id="cp2"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="ct3"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="ct4"><rect x="241.7" y="32.4" width="181.3" height="18"/></clipPath><clipPath id="cp5"><rect x="37" y="70" width="24" height="24.2"/></clipPath><clipPath id="cp7"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="ct8"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="ct9"><rect x="253.1" y="73.2" width="169.9" height="18"/></clipPath><clipPath id="cp10"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="ct11"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="ct12"><rect x="222.2" y="114" width="200.8" height="18"/></clipPath><clipPath id="cp13"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="ct14"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="ct15"><rect x="230.9" y="154.8" width="192.1" height="18"/></clipPath></defs><g clip-path="url(#cp0)"><rect x="28" y="20" width="404" height="165.2" rx="12" fill="rgba(0,0,98,0.05)"/><rect x="28.5" y="20.5" width="403" height="164" rx="11.5" fill="none" stroke="rgba(0,0,28,0.18)" stroke-width="1"/></g><g clip-path="url(#ov1)"><g clip-path="url(#cp2)"><g clip-path="url(#ct3)"><text x="37" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(29,29,31)">Status</text></g></g><text x="391.91" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(29,29,31)">Live</text></g><g clip-path="url(#ov1)"><g clip-path="url(#cp5)"><g color="rgb(29, 29, 31)"><clipPath id="svgic6"><rect x="37" y="70.2" width="24" height="24"/></clipPath><g clip-path="url(#svgic6)"><g transform="translate(37 70.188)"><path d="M12 15v5s3-.6 4-2c1-1.6 0-5 0-5" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(29, 29, 31)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M4.5 16.5c-1.5 1.3-2 5-2 5s3.7-.5 5-2c.7-.8.7-2.1 0-3a2 2 0 0 0-3 0" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(29, 29, 31)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M9 12a22 22 0 0 1 2-4 13 13 0 0 1 11-6c0 2.7-.8 7.5-6 11a22 22 0 0 1-4 2Z" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(29, 29, 31)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M9 12H4s.5-3 2-4c1.6-1 5 0 5 0" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(29, 29, 31)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/></g></g></g></g><g clip-path="url(#cp7)"><g clip-path="url(#ct8)"><text x="69" y="88.19" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(29,29,31)">Environment</text></g></g><text x="338.63" y="88.19" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(29,29,31)">Production</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="69" y1="62.5" x2="423" y2="62.5" stroke="rgba(0, 0, 28, 0.18)" stroke-width="1"/></g></g></g><g clip-path="url(#ov1)"><g clip-path="url(#cp10)"><g clip-path="url(#ct11)"><text x="37" y="128.98" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(29,29,31)">Region</text></g></g><text x="349.39" y="128.98" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(29,29,31)">us-east-1</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="37" y1="103.5" x2="423" y2="103.5" stroke="rgba(0, 0, 28, 0.18)" stroke-width="1"/></g></g></g><g clip-path="url(#ov1)"><g clip-path="url(#cp13)"><g clip-path="url(#ct14)"><text x="37" y="169.78" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(29,29,31)">Last deploy</text></g></g><text x="333.14" y="169.78" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(29,29,31)">2 hours ago</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="37" y1="143.5" x2="423" y2="143.5" stroke="rgba(0, 0, 28, 0.18)" stroke-width="1"/></g></g></g></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 492 274" width="492" height="274"><defs><clipPath id="cp0"><rect x="16" y="38" width="460" height="220"/></clipPath><clipPath id="ct1"><rect x="16" y="16" width="460" height="22"/></clipPath><clipPath id="irc2"><rect x="16" y="38" width="460" height="220" rx="0"/></clipPath></defs><rect x="0" y="0" width="492" height="274" rx="0" fill="rgb(28,28,30)"/><text x="16" y="28" font-family="system-ui, "-apple-system", sans-serif" font-size="12" font-weight="600" fill="rgb(174,174,178)">Key/value detail rows</text><g clip-path="url(#cp0)"><g clip-path="url(#irc2)"><clipPath id="svgimg3vclip"><rect x="16" y="38" width="460" height="220"/></clipPath><g clip-path="url(#svgimg3vclip)"><g transform="translate(16 38)"><defs><clipPath id="svgimg3cp0"><rect x="28" y="20" width="404" height="165.2"/></clipPath><clipPath id="svgimg3ov1"><rect x="29" y="21" width="402" height="163.2" rx="11"/></clipPath><clipPath id="svgimg3cp2"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="svgimg3ct3"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="svgimg3ct4"><rect x="241.7" y="32.4" width="181.3" height="18"/></clipPath><clipPath id="svgimg3cp5"><rect x="37" y="70" width="24" height="24.2"/></clipPath><clipPath id="svgimg3cp7"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="svgimg3ct8"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="svgimg3ct9"><rect x="253.1" y="73.2" width="169.9" height="18"/></clipPath><clipPath id="svgimg3cp10"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="svgimg3ct11"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="svgimg3ct12"><rect x="222.2" y="114" width="200.8" height="18"/></clipPath><clipPath id="svgimg3cp13"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="svgimg3ct14"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="svgimg3ct15"><rect x="230.9" y="154.8" width="192.1" height="18"/></clipPath></defs><g clip-path="url(#svgimg3cp0)"><rect x="28" y="20" width="404" height="165.2" rx="12" fill="rgba(228,228,255,0.075)"/><rect x="28.5" y="20.5" width="403" height="164" rx="11.5" fill="none" stroke="rgba(253,253,255,0.196)" stroke-width="1"/></g><g clip-path="url(#svgimg3ov1)"><g clip-path="url(#svgimg3cp2)"><g clip-path="url(#svgimg3ct3)"><text x="37" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 492 274" width="492" height="274"><defs><clipPath id="cp0"><rect x="16" y="38" width="460" height="220"/></clipPath><clipPath id="ct1"><rect x="16" y="16" width="460" height="22"/></clipPath><clipPath id="irc2"><rect x="16" y="38" width="460" height="220" rx="0"/></clipPath></defs><rect x="0" y="0" width="492" height="274" rx="0" fill="rgb(28,28,30)"/><text x="16" y="28" font-family="system-ui, "-apple-system", sans-serif" font-size="12" font-weight="600" fill="rgb(174,174,178)">Key/value detail rows</text><g clip-path="url(#cp0)"><g clip-path="url(#irc2)"><clipPath id="svgimg3vclip"><rect x="16" y="38" width="460" height="220"/></clipPath><g clip-path="url(#svgimg3vclip)"><g transform="translate(16 38)"><defs><clipPath id="svgimg3cp0"><rect x="28" y="20" width="404" height="165.2"/></clipPath><clipPath id="svgimg3ov1"><rect x="29" y="21" width="402" height="163.2" rx="11"/></clipPath><clipPath id="svgimg3cp2"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="svgimg3ct3"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="svgimg3ct4"><rect x="241.7" y="32.4" width="181.3" height="18"/></clipPath><clipPath id="svgimg3cp5"><rect x="37" y="70" width="24" height="24.2"/></clipPath><clipPath id="svgimg3cp7"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="svgimg3ct8"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="svgimg3ct9"><rect x="253.1" y="73.2" width="169.9" height="18"/></clipPath><clipPath id="svgimg3cp10"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="svgimg3ct11"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="svgimg3ct12"><rect x="222.2" y="114" width="200.8" height="18"/></clipPath><clipPath id="svgimg3cp13"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="svgimg3ct14"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="svgimg3ct15"><rect x="230.9" y="154.8" width="192.1" height="18"/></clipPath></defs><g clip-path="url(#svgimg3cp0)"><rect x="28" y="20" width="404" height="165.2" rx="12" fill="rgba(228,228,255,0.075)"/><rect x="28.5" y="20.5" width="403" height="164" rx="11.5" fill="none" stroke="rgba(253,253,255,0.196)" stroke-width="1"/></g><g clip-path="url(#svgimg3ov1)"><g clip-path="url(#svgimg3cp2)"><g clip-path="url(#svgimg3ct3)"><text x="37" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(245,245,247)">Status</text></g></g><text x="391.91" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(245,245,247)">Live</text></g><g clip-path="url(#svgimg3ov1)"><g clip-path="url(#svgimg3cp5)"><g color="rgb(245, 245, 247)"><clipPath id="svgimg3svgic6"><rect x="37" y="70.2" width="24" height="24"/></clipPath><g clip-path="url(#svgimg3svgic6)"><g transform="translate(37 70.188)"><path d="M12 15v5s3-.6 4-2c1-1.6 0-5 0-5" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(245, 245, 247)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M4.5 16.5c-1.5 1.3-2 5-2 5s3.7-.5 5-2c.7-.8.7-2.1 0-3a2 2 0 0 0-3 0" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(245, 245, 247)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M9 12a22 22 0 0 1 2-4 13 13 0 0 1 11-6c0 2.7-.8 7.5-6 11a22 22 0 0 1-4 2Z" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(245, 245, 247)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M9 12H4s.5-3 2-4c1.6-1 5 0 5 0" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(245, 245, 247)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/></g></g></g></g><g clip-path="url(#svgimg3cp7)"><g clip-path="url(#svgimg3ct8)"><text x="69" y="88.19" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(245,245,247)">Environment</text></g></g><text x="338.63" y="88.19" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(245,245,247)">Production</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="69" y1="62.5" x2="423" y2="62.5" stroke="rgba(253, 253, 255, 0.196)" stroke-width="1"/></g></g></g><g clip-path="url(#svgimg3ov1)"><g clip-path="url(#svgimg3cp10)"><g clip-path="url(#svgimg3ct11)"><text x="37" y="128.98" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(245,245,247)">Region</text></g></g><text x="349.39" y="128.98" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(245,245,247)">us-east-1</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="37" y1="103.5" x2="423" y2="103.5" stroke="rgba(253, 253, 255, 0.196)" stroke-width="1"/></g></g></g><g clip-path="url(#svgimg3ov1)"><g clip-path="url(#svgimg3cp13)"><g clip-path="url(#svgimg3ct14)"><text x="37" y="169.78" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(245,245,247)">Last deploy</text></g></g><text x="333.14" y="169.78" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(245,245,247)">2 hours ago</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="37" y1="143.5" x2="423" y2="143.5" stroke="rgba(253, 253, 255, 0.196)" stroke-width="1"/></g></g></g></g></g></g></g></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 492 274" width="492" height="274"><defs><clipPath id="cp0"><rect x="16" y="38" width="460" height="220"/></clipPath><clipPath id="ct1"><rect x="16" y="16" width="460" height="22"/></clipPath><clipPath id="irc2"><rect x="16" y="38" width="460" height="220" rx="0"/></clipPath></defs><rect x="0" y="0" width="492" height="274" rx="0" fill="rgb(255,255,255)"/><text x="16" y="28" font-family="system-ui, "-apple-system", sans-serif" font-size="12" font-weight="600" fill="rgb(110,110,115)">Key/value detail rows</text><g clip-path="url(#cp0)"><g clip-path="url(#irc2)"><clipPath id="svgimg3vclip"><rect x="16" y="38" width="460" height="220"/></clipPath><g clip-path="url(#svgimg3vclip)"><g transform="translate(16 38)"><defs><clipPath id="svgimg3cp0"><rect x="28" y="20" width="404" height="165.2"/></clipPath><clipPath id="svgimg3ov1"><rect x="29" y="21" width="402" height="163.2" rx="11"/></clipPath><clipPath id="svgimg3cp2"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="svgimg3ct3"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="svgimg3ct4"><rect x="241.7" y="32.4" width="181.3" height="18"/></clipPath><clipPath id="svgimg3cp5"><rect x="37" y="70" width="24" height="24.2"/></clipPath><clipPath id="svgimg3cp7"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="svgimg3ct8"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="svgimg3ct9"><rect x="253.1" y="73.2" width="169.9" height="18"/></clipPath><clipPath id="svgimg3cp10"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="svgimg3ct11"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="svgimg3ct12"><rect x="222.2" y="114" width="200.8" height="18"/></clipPath><clipPath id="svgimg3cp13"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="svgimg3ct14"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="svgimg3ct15"><rect x="230.9" y="154.8" width="192.1" height="18"/></clipPath></defs><g clip-path="url(#svgimg3cp0)"><rect x="28" y="20" width="404" height="165.2" rx="12" fill="rgba(0,0,98,0.05)"/><rect x="28.5" y="20.5" width="403" height="164" rx="11.5" fill="none" stroke="rgba(0,0,28,0.18)" stroke-width="1"/></g><g clip-path="url(#svgimg3ov1)"><g clip-path="url(#svgimg3cp2)"><g clip-path="url(#svgimg3ct3)"><text x="37" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 492 274" width="492" height="274"><defs><clipPath id="cp0"><rect x="16" y="38" width="460" height="220"/></clipPath><clipPath id="ct1"><rect x="16" y="16" width="460" height="22"/></clipPath><clipPath id="irc2"><rect x="16" y="38" width="460" height="220" rx="0"/></clipPath></defs><rect x="0" y="0" width="492" height="274" rx="0" fill="rgb(255,255,255)"/><text x="16" y="28" font-family="system-ui, "-apple-system", sans-serif" font-size="12" font-weight="600" fill="rgb(110,110,115)">Key/value detail rows</text><g clip-path="url(#cp0)"><g clip-path="url(#irc2)"><clipPath id="svgimg3vclip"><rect x="16" y="38" width="460" height="220"/></clipPath><g clip-path="url(#svgimg3vclip)"><g transform="translate(16 38)"><defs><clipPath id="svgimg3cp0"><rect x="28" y="20" width="404" height="165.2"/></clipPath><clipPath id="svgimg3ov1"><rect x="29" y="21" width="402" height="163.2" rx="11"/></clipPath><clipPath id="svgimg3cp2"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="svgimg3ct3"><rect x="37" y="32.4" width="46.5" height="18"/></clipPath><clipPath id="svgimg3ct4"><rect x="241.7" y="32.4" width="181.3" height="18"/></clipPath><clipPath id="svgimg3cp5"><rect x="37" y="70" width="24" height="24.2"/></clipPath><clipPath id="svgimg3cp7"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="svgimg3ct8"><rect x="69" y="73.2" width="90.6" height="18"/></clipPath><clipPath id="svgimg3ct9"><rect x="253.1" y="73.2" width="169.9" height="18"/></clipPath><clipPath id="svgimg3cp10"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="svgimg3ct11"><rect x="37" y="114" width="50" height="18"/></clipPath><clipPath id="svgimg3ct12"><rect x="222.2" y="114" width="200.8" height="18"/></clipPath><clipPath id="svgimg3cp13"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="svgimg3ct14"><rect x="37" y="154.8" width="83.7" height="18"/></clipPath><clipPath id="svgimg3ct15"><rect x="230.9" y="154.8" width="192.1" height="18"/></clipPath></defs><g clip-path="url(#svgimg3cp0)"><rect x="28" y="20" width="404" height="165.2" rx="12" fill="rgba(0,0,98,0.05)"/><rect x="28.5" y="20.5" width="403" height="164" rx="11.5" fill="none" stroke="rgba(0,0,28,0.18)" stroke-width="1"/></g><g clip-path="url(#svgimg3ov1)"><g clip-path="url(#svgimg3cp2)"><g clip-path="url(#svgimg3ct3)"><text x="37" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(29,29,31)">Status</text></g></g><text x="391.91" y="47.39" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(29,29,31)">Live</text></g><g clip-path="url(#svgimg3ov1)"><g clip-path="url(#svgimg3cp5)"><g color="rgb(29, 29, 31)"><clipPath id="svgimg3svgic6"><rect x="37" y="70.2" width="24" height="24"/></clipPath><g clip-path="url(#svgimg3svgic6)"><g transform="translate(37 70.188)"><path d="M12 15v5s3-.6 4-2c1-1.6 0-5 0-5" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(29, 29, 31)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M4.5 16.5c-1.5 1.3-2 5-2 5s3.7-.5 5-2c.7-.8.7-2.1 0-3a2 2 0 0 0-3 0" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(29, 29, 31)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M9 12a22 22 0 0 1 2-4 13 13 0 0 1 11-6c0 2.7-.8 7.5-6 11a22 22 0 0 1-4 2Z" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(29, 29, 31)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/><path d="M9 12H4s.5-3 2-4c1.6-1 5 0 5 0" style="marker:none;vector-effect:none;color-interpolation:srgb" fill="none" stroke="rgb(29, 29, 31)" stroke-width="2px" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="1" fill-opacity="1" opacity="1"/></g></g></g></g><g clip-path="url(#svgimg3cp7)"><g clip-path="url(#svgimg3ct8)"><text x="69" y="88.19" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(29,29,31)">Environment</text></g></g><text x="338.63" y="88.19" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(29,29,31)">Production</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="69" y1="62.5" x2="423" y2="62.5" stroke="rgba(0, 0, 28, 0.18)" stroke-width="1"/></g></g></g><g clip-path="url(#svgimg3ov1)"><g clip-path="url(#svgimg3cp10)"><g clip-path="url(#svgimg3ct11)"><text x="37" y="128.98" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(29,29,31)">Region</text></g></g><text x="349.39" y="128.98" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(29,29,31)">us-east-1</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="37" y1="103.5" x2="423" y2="103.5" stroke="rgba(0, 0, 28, 0.18)" stroke-width="1"/></g></g></g><g clip-path="url(#svgimg3ov1)"><g clip-path="url(#svgimg3cp13)"><g clip-path="url(#svgimg3ct14)"><text x="37" y="169.78" font-family="system-ui, "-apple-system", sans-serif" font-size="16" fill="rgb(29,29,31)">Last deploy</text></g></g><text x="333.14" y="169.78" font-family="system-ui, "-apple-system", sans-serif" font-size="16" font-weight="650" fill="rgb(29,29,31)">2 hours ago</text><g data-domotion-pseudo-source="blink-pseudo-fragment-v1" data-domotion-pseudo="::before" data-domotion-pseudo-owner="source-fragments"><g><line x1="37" y1="143.5" x2="423" y2="143.5" stroke="rgba(0, 0, 28, 0.18)" stroke-width="1"/></g></g></g></g></g></g></g></svg>
|
package/docs/webawesome-theme.md
CHANGED
|
@@ -149,6 +149,19 @@ is absent. Nested SunkenPanel, Pane, and Web Awesome sunken surfaces therefore
|
|
|
149
149
|
composite on their actual backdrop without application-owned depth wrappers
|
|
150
150
|
or component-token overrides.
|
|
151
151
|
|
|
152
|
+
The lowered tint is `--wa-color-surface-lowered` in the Web Awesome theme and
|
|
153
|
+
`--kui-color-surface-lowered` in the Kerf foundation fallback;
|
|
154
|
+
`--wa-color-neutral-fill-quiet` and `--kui-color-neutral-fill-quiet` share it.
|
|
155
|
+
`SunkenPanel`, sunken Pane, Workbench, and TabNavigator surfaces read it by
|
|
156
|
+
default through the optional `--kui-sunken-panel-background` override. Web
|
|
157
|
+
Awesome Accordion, Card, and Details with `appearance="sunken"` read it
|
|
158
|
+
through the optional `--kui-wa-sunken-background` override. These names do
|
|
159
|
+
not denote separate opaque colors or distinct depth levels. A deliberate
|
|
160
|
+
nested surface adds another translucent layer and can make hierarchy clearer;
|
|
161
|
+
avoid painting a second background on a wrapper that represents the same
|
|
162
|
+
surface. Inspect the composed result over the real backdrop in light and dark
|
|
163
|
+
modes.
|
|
164
|
+
|
|
152
165
|
The lowered light tint is `rgb(0 0 98.076923 / 0.05098)` (approximately
|
|
153
166
|
`#f2f2f7` over white); dark is `rgb(228.157895 228.157895 255 / 0.07451)`
|
|
154
167
|
(approximately `#111113` over black). Repeated layers darken in light mode
|
package/llms.txt
CHANGED
|
@@ -12,6 +12,18 @@ npm install kerfjs @kerfjs/ui # kerfjs is a peer; Web Awesome is an optional pee
|
|
|
12
12
|
Import each component from its own subpath (`@kerfjs/ui/list-item`, `@kerfjs/ui/toolbar`,
|
|
13
13
|
…); the browser build pulls that component's reachable CSS automatically, so do not
|
|
14
14
|
maintain a central style list. Configure JSX with `"jsxImportSource": "kerfjs"`.
|
|
15
|
+
|
|
16
|
+
The sunken/lowered background is semi-transparent: Web Awesome's
|
|
17
|
+
`--wa-color-surface-lowered` is mirrored by `--kui-color-surface-lowered` and
|
|
18
|
+
used by `--kui-color-neutral-fill-quiet`. `SunkenPanel`, sunken
|
|
19
|
+
`Pane`/`Workbench`/`TabNavigator` surfaces, and Web Awesome
|
|
20
|
+
`appearance="sunken"` use that tint by default through their optional
|
|
21
|
+
`--kui-sunken-panel-background` / `--kui-wa-sunken-background` override tokens.
|
|
22
|
+
Each layer composites over its backdrop. Intentional nested layers create
|
|
23
|
+
depth; avoid a wrapper or extra background that paints the same visual surface
|
|
24
|
+
twice. Check contrast in both color schemes over the actual backdrop. See
|
|
25
|
+
[contextual transparency](./docs/webawesome-theme.md#contextual-transparency).
|
|
26
|
+
|
|
15
27
|
For arbitrary interactive help or popup content, use `openAnchoredSurface` or
|
|
16
28
|
`openAnchoredSurfaceAt` from `@kerfjs/ui/anchored-surface`; see
|
|
17
29
|
[AnchoredSurface](./docs/anchored-surface.md). The app owns content and actions.
|
|
@@ -494,6 +506,10 @@ headingLevel`, `TokenSearchField clearIcon`, `ContentItem frame="framed"` for a
|
|
|
494
506
|
`dropTarget` highlights a drag-over without changing selection. `attention`
|
|
495
507
|
uses `--kui-app-tab-attention-color`. TabBar's public
|
|
496
508
|
`--kui-tab-bar-strip-*` tokens set compact strip geometry.
|
|
509
|
+
An inspector TabBar uses the shared rounded rectangle radius on its strip
|
|
510
|
+
and inset segmented tabs; an ordinary segmented TabBar keeps pill ends and
|
|
511
|
+
smaller interior tab corners. Configure the presentation instead of
|
|
512
|
+
restyling AppTab.
|
|
497
513
|
Set `pinned` on the first AppTab to keep it visible within a scrolling
|
|
498
514
|
tablist; it remains in keyboard order. Use `--kui-app-tab-pinned-background`
|
|
499
515
|
for the surrounding surface and keep that backdrop opaque.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kerfjs/ui",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.87",
|
|
4
4
|
"description": "Accessible, composable UI primitives for kerf applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -504,6 +504,7 @@
|
|
|
504
504
|
"@typescript-eslint/eslint-plugin": "^8.65.0",
|
|
505
505
|
"@typescript-eslint/parser": "^8.65.0",
|
|
506
506
|
"@vitest/coverage-v8": "4.1.11",
|
|
507
|
+
"axe-core": "^4.14.0",
|
|
507
508
|
"domotion-svg": "^0.30.1",
|
|
508
509
|
"esbuild": "^0.25.0",
|
|
509
510
|
"eslint": "^10.8.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/surfaces/content-item/content-item.tsx"],"names":[],"mappings":";;;AAkBA,IAAM,8BAAA,uBAAqC,GAAA,CAAI;AAAA,EAC7C,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,KAAa,cAAc,IAAA,GAAO,MAAA,CAAA;AAAA,MAEzC,IAAA;AAAA,MAEC,QAAA,EAAA,WAAA,IAAe,kBAAkB,UAAA,mBAChC,GAAA,CAAC,SAAI,IAAA,EAAK,UAAA,EAAY,UAAS,CAAA,GAE/B;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-7TE6XDFI.js","sourcesContent":["import type { KerfUiContent } from '../../../shared/content/semantic-content.js';\nimport { filterDataAttributes } from '../../../shared/dom/extension-attributes.js';\nimport type { SemanticTone } from '../../../shared/styles/semantic-tone.js';\n\nexport type { SemanticTone } from '../../../shared/styles/semantic-tone.js';\n\n/** Base surface treatment or semantic status colors. */\nexport type ContentItemAppearance = 'transparent' | 'surface' | SemanticTone;\n\n/** Whether the item's always-reserved 1px border is transparent or visible. */\nexport type ContentItemFrame = 'none' | 'framed';\n\n/** Corner shape: the 12px rounded rectangle or the 22px pill. */\nexport type ContentItemShape = 'rounded' | 'pill';\n/** `single` uses an option; `multiple` uses a grid row; `toggle` uses a pressed button. */\nexport type ContentItemSelectionMode =\n 'none' | 'single' | 'multiple' | 'toggle';\n\nconst contentItemProtectedAttributes = new Set([\n 'data-component',\n 'data-appearance',\n 'data-outlined',\n]);\nconst interactiveProtectedAttributes = new Set([\n 'data-component',\n 'data-appearance',\n 'data-outlined',\n 'data-action',\n 'data-item-id',\n 'data-interactive',\n 'data-selected',\n 'data-disabled',\n 'data-selection-mode',\n 'data-kui-pressed',\n]);\n\ntype ContentItemRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined> & {\n 'data-component'?: never;\n 'data-appearance'?: never;\n 'data-outlined'?: never;\n }\n>;\n\ntype ContentItemInteractiveRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined> & {\n 'data-component'?: never;\n 'data-appearance'?: never;\n 'data-outlined'?: never;\n 'data-action'?: never;\n 'data-item-id'?: never;\n 'data-interactive'?: never;\n 'data-selected'?: never;\n 'data-disabled'?: never;\n 'data-selection-mode'?: never;\n 'data-kui-pressed'?: never;\n }\n>;\n\ninterface ContentItemBaseProps {\n /**\n * Coordinated background, border, and foreground colors. `transparent`\n * preserves the surrounding surface; `surface` paints the base surface;\n * semantic values match StateBanner. Defaults to `transparent`.\n */\n appearance?: ContentItemAppearance;\n /** Item content; a plain string is allowed for bare copy. */\n children?: KerfUiContent | string;\n /**\n * `framed` paints the standard neutral border in the 1px the item always\n * reserves, so framing never changes geometry. Frame only an item that\n * marks a real distinction. Defaults to `none` (transparent border).\n */\n frame?: ContentItemFrame;\n /** Remove block padding and block borders while retaining inline geometry. */\n flush?: boolean;\n /** Corner shape. Defaults to `rounded`. */\n shape?: ContentItemShape;\n /** Native hover tooltip. */\n title?: string;\n /**\n * Names the item as a distinct region (`role=\"region\"`). Omit it for an\n * ordinary item, which stays a non-landmark grouping.\n */\n ariaLabel?: string;\n /**\n * Makes the item a programmatic focus target (`tabindex=\"-1\"`, never a tab\n * stop), for example the preferred initial focus of a NavStack view when\n * combined with `data-nav-focus` in `rootAttributes`.\n */\n focusTarget?: boolean;\n /** Keep the standard focus outline visible, such as for a drop target. */\n outlined?: boolean;\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\nexport type ContentItemProps = ContentItemBaseProps &\n (\n | {\n interactive?: false;\n action?: never;\n itemId?: never;\n selectionMode?: never;\n selected?: never;\n disabled?: never;\n /** Opt into keyboard (`0`) or programmatic (`-1`) focus. */\n tabIndex?: 0 | -1;\n /** Existing static `data-*` metadata remains available. */\n rootAttributes?: ContentItemRootAttributes;\n }\n | {\n /** Enable a keyboard reachable card; wire `wireContentItems` once on its containing root. */\n interactive: true;\n /** Delegated action dispatched by pointer, Enter, or Space. */\n action: string;\n itemId?: string;\n selectionMode?: ContentItemSelectionMode;\n selected?: boolean;\n disabled?: boolean;\n tabIndex?: never;\n /** Safe app metadata; interaction attributes are component-owned. */\n rootAttributes?: ContentItemInteractiveRootAttributes;\n }\n );\n\n/**\n * One self-contained `.kui-content` child: an 8px inline margin, a real 1px\n * border (transparent unless `framed`), 8px padding, and a rounded or pill\n * radius. It owns that whole geometry, so wrappers must not add more.\n */\nexport function ContentItem({\n appearance = 'transparent',\n children,\n frame = 'none',\n flush = false,\n shape = 'rounded',\n title,\n ariaLabel,\n focusTarget = false,\n outlined = false,\n tabIndex,\n interactive = false,\n action,\n itemId,\n selectionMode = 'none',\n selected = false,\n disabled = false,\n className = '',\n rootAttributes = {},\n slot,\n}: ContentItemProps) {\n const safeRootAttributes = filterDataAttributes(\n rootAttributes,\n interactive\n ? interactiveProtectedAttributes\n : contentItemProtectedAttributes,\n );\n if (interactive && !action) {\n throw new Error('Interactive ContentItem requires an action');\n }\n if (interactive && selected && selectionMode === 'none') {\n throw new Error('Selected ContentItem requires a selectionMode');\n }\n const cls = [\n 'kui-content-item',\n shape === 'pill' ? 'kui-content-item--pill' : '',\n frame === 'framed' ? 'kui-content-item--framed' : '',\n flush ? 'kui-content-item--flush' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n const interactiveAttributes = interactive\n ? {\n 'data-interactive': 'true',\n 'data-action': disabled ? undefined : action,\n 'data-item-id': itemId,\n 'data-selection-mode': selectionMode,\n 'data-selected':\n selectionMode === 'none' ? undefined : String(selected),\n 'data-disabled': disabled ? 'true' : undefined,\n }\n : {};\n return (\n <div\n {...safeRootAttributes}\n {...interactiveAttributes}\n class={cls}\n title={title}\n data-component=\"content-item\"\n data-appearance={appearance}\n data-outlined={outlined ? 'true' : undefined}\n role={\n interactive\n ? selectionMode === 'single'\n ? 'option'\n : selectionMode === 'multiple'\n ? 'row'\n : 'button'\n : ariaLabel\n ? 'region'\n : undefined\n }\n aria-label={ariaLabel}\n aria-selected={\n interactive &&\n (selectionMode === 'single' || selectionMode === 'multiple')\n ? String(selected)\n : undefined\n }\n aria-pressed={\n interactive && selectionMode === 'toggle' ? String(selected) : undefined\n }\n aria-disabled={interactive && disabled ? 'true' : undefined}\n tabindex={\n interactive\n ? disabled\n ? '-1'\n : '0'\n : (tabIndex ?? (focusTarget ? '-1' : undefined))\n }\n slot={slot}\n >\n {interactive && selectionMode === 'multiple' ? (\n <div role=\"gridcell\">{children}</div>\n ) : (\n children\n )}\n </div>\n );\n}\n"]}
|