@adia-ai/web-components 0.6.37 → 0.6.38
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/CHANGELOG.md +20 -0
- package/components/accordion/accordion-item.a2ui.json +3 -0
- package/components/accordion/accordion-item.yaml +5 -0
- package/components/action-list/action-item.a2ui.json +5 -1
- package/components/action-list/action-item.yaml +7 -0
- package/components/card/card.a2ui.json +17 -1
- package/components/card/card.yaml +24 -1
- package/components/empty-state/empty-state.a2ui.json +9 -0
- package/components/empty-state/empty-state.yaml +15 -0
- package/components/feed/feed-item.a2ui.json +5 -0
- package/components/feed/feed-item.yaml +10 -0
- package/components/field/field.a2ui.json +6 -0
- package/components/field/field.yaml +10 -0
- package/components/index.js +2 -0
- package/components/inline-edit/inline-edit.a2ui.json +159 -0
- package/components/inline-edit/inline-edit.class.js +184 -0
- package/components/inline-edit/inline-edit.css +62 -0
- package/components/inline-edit/inline-edit.d.ts +52 -0
- package/components/inline-edit/inline-edit.js +12 -0
- package/components/inline-edit/inline-edit.yaml +125 -0
- package/components/list/list-item.a2ui.json +8 -1
- package/components/list/list-item.yaml +12 -0
- package/components/list/list.css +36 -6
- package/components/mark/mark.a2ui.json +109 -0
- package/components/mark/mark.class.js +22 -0
- package/components/mark/mark.css +39 -0
- package/components/mark/mark.d.ts +27 -0
- package/components/mark/mark.js +12 -0
- package/components/mark/mark.yaml +87 -0
- package/components/modal/modal.a2ui.json +9 -0
- package/components/modal/modal.yaml +14 -0
- package/components/nav-group/nav-group.a2ui.json +3 -0
- package/components/nav-group/nav-group.yaml +5 -0
- package/components/nav-item/nav-item.a2ui.json +3 -0
- package/components/nav-item/nav-item.yaml +5 -0
- package/components/segmented/segmented.class.js +10 -2
- package/components/select/select.a2ui.json +3 -0
- package/components/select/select.yaml +5 -0
- package/components/slider/slider.a2ui.json +6 -0
- package/components/slider/slider.yaml +10 -0
- package/components/stat/stat.css +18 -14
- package/components/stepper/stepper-item.a2ui.json +3 -0
- package/components/stepper/stepper-item.yaml +5 -0
- package/components/timeline/timeline-item.a2ui.json +8 -1
- package/components/timeline/timeline-item.yaml +12 -0
- package/components/tree/tree-item.a2ui.json +5 -1
- package/components/tree/tree-item.yaml +7 -0
- package/components/tree/tree.a2ui.json +3 -0
- package/components/tree/tree.yaml +5 -0
- package/dist/web-components.min.css +1 -1
- package/dist/web-components.min.js +74 -74
- package/package.json +1 -1
- package/styles/components.css +2 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<inline-edit-ui>` — Click-to-edit text in place. Renders as static text until clicked /
|
|
3
|
+
focused + Enter, then becomes editable. Enter or blur commits; Escape
|
|
4
|
+
cancels and restores the original value. Form-participating.
|
|
5
|
+
|
|
6
|
+
Use for editable titles, breadcrumb labels, table-cell text fields,
|
|
7
|
+
draft document names — any case where a user expects to edit text
|
|
8
|
+
without opening a separate dialog or input. Distinct from `<input-ui>`
|
|
9
|
+
(always-editable chrome) and from `<field-ui>` (stacked label + input
|
|
10
|
+
composition). inline-edit reads as text in static state.
|
|
11
|
+
|
|
12
|
+
*
|
|
13
|
+
* @see https://ui-kit.exe.xyz/site/components/inline-edit
|
|
14
|
+
*
|
|
15
|
+
* Type declarations generated by scripts/build/dts-codegen.mjs from
|
|
16
|
+
* the component's `.a2ui.json` sidecar(s). Edit the source `.yaml`,
|
|
17
|
+
* run `npm run build:components`, then `npm run codegen:dts` to
|
|
18
|
+
* regenerate; or hand-author this file fully if rich event types are
|
|
19
|
+
* needed beyond what the yaml `events:` block can express.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { UIElement } from '../../core/element.js';
|
|
23
|
+
|
|
24
|
+
export type InlineEditCancelEvent = CustomEvent<unknown>;
|
|
25
|
+
export type InlineEditChangeEvent = CustomEvent<unknown>;
|
|
26
|
+
export type InlineEditEditEndEvent = CustomEvent<unknown>;
|
|
27
|
+
export type InlineEditEditStartEvent = CustomEvent<unknown>;
|
|
28
|
+
|
|
29
|
+
export class UIInlineEdit extends UIElement {
|
|
30
|
+
/** When to commit pending edits. `blur` (default) — saves on focusout
|
|
31
|
+
or Enter. `enter` — Enter saves, blur cancels (returns to original).
|
|
32
|
+
`manual` — only programmatic `commitEdit()` saves.
|
|
33
|
+
*/
|
|
34
|
+
commit: 'blur' | 'enter' | 'manual';
|
|
35
|
+
/** Reflected state — `true` when the element is actively being edited.
|
|
36
|
+
Toggles automatically on click / Enter / blur / Escape; rarely set
|
|
37
|
+
by consumers. Listen to `edit-start` / `edit-end` events instead.
|
|
38
|
+
*/
|
|
39
|
+
editing: boolean;
|
|
40
|
+
/** Hint text shown when the value is empty (inline-edit reads this in the static state). */
|
|
41
|
+
placeholder: string;
|
|
42
|
+
|
|
43
|
+
addEventListener<K extends keyof HTMLElementEventMap>(
|
|
44
|
+
type: K,
|
|
45
|
+
listener: (this: UIInlineEdit, ev: HTMLElementEventMap[K]) => unknown,
|
|
46
|
+
options?: boolean | AddEventListenerOptions,
|
|
47
|
+
): void;
|
|
48
|
+
addEventListener(type: 'cancel', listener: (ev: InlineEditCancelEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
49
|
+
addEventListener(type: 'change', listener: (ev: InlineEditChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
50
|
+
addEventListener(type: 'edit-end', listener: (ev: InlineEditEditEndEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
51
|
+
addEventListener(type: 'edit-start', listener: (ev: InlineEditEditStartEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<inline-edit-ui>` — auto-registers the tag on import.
|
|
3
|
+
*
|
|
4
|
+
* @see ../../USAGE.md#registration--auto-vs-explicit
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { defineIfFree } from '../../core/register.js';
|
|
8
|
+
import { UIInlineEdit } from './inline-edit.class.js';
|
|
9
|
+
|
|
10
|
+
defineIfFree('inline-edit-ui', UIInlineEdit);
|
|
11
|
+
|
|
12
|
+
export { UIInlineEdit };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
$schema: ../../../../scripts/schemas/component.yaml.schema.json
|
|
2
|
+
name: UIInlineEdit
|
|
3
|
+
tag: inline-edit-ui
|
|
4
|
+
status: stable
|
|
5
|
+
component: InlineEdit
|
|
6
|
+
category: form
|
|
7
|
+
version: 1
|
|
8
|
+
description: |
|
|
9
|
+
Click-to-edit text in place. Renders as static text until clicked /
|
|
10
|
+
focused + Enter, then becomes editable. Enter or blur commits; Escape
|
|
11
|
+
cancels and restores the original value. Form-participating.
|
|
12
|
+
|
|
13
|
+
Use for editable titles, breadcrumb labels, table-cell text fields,
|
|
14
|
+
draft document names — any case where a user expects to edit text
|
|
15
|
+
without opening a separate dialog or input. Distinct from `<input-ui>`
|
|
16
|
+
(always-editable chrome) and from `<field-ui>` (stacked label + input
|
|
17
|
+
composition). inline-edit reads as text in static state.
|
|
18
|
+
props:
|
|
19
|
+
placeholder:
|
|
20
|
+
description: Hint text shown when the value is empty (inline-edit reads this in the static state).
|
|
21
|
+
type: string
|
|
22
|
+
default: Click to edit
|
|
23
|
+
reflect: true
|
|
24
|
+
editing:
|
|
25
|
+
description: |
|
|
26
|
+
Reflected state — `true` when the element is actively being edited.
|
|
27
|
+
Toggles automatically on click / Enter / blur / Escape; rarely set
|
|
28
|
+
by consumers. Listen to `edit-start` / `edit-end` events instead.
|
|
29
|
+
type: boolean
|
|
30
|
+
default: false
|
|
31
|
+
reflect: true
|
|
32
|
+
commit:
|
|
33
|
+
description: |
|
|
34
|
+
When to commit pending edits. `blur` (default) — saves on focusout
|
|
35
|
+
or Enter. `enter` — Enter saves, blur cancels (returns to original).
|
|
36
|
+
`manual` — only programmatic `commitEdit()` saves.
|
|
37
|
+
type: string
|
|
38
|
+
default: blur
|
|
39
|
+
enum:
|
|
40
|
+
- blur
|
|
41
|
+
- enter
|
|
42
|
+
- manual
|
|
43
|
+
reflect: true
|
|
44
|
+
events:
|
|
45
|
+
change:
|
|
46
|
+
description: 'Fired after a successful commit. detail = { value, oldValue }. Bubbles.'
|
|
47
|
+
cancel:
|
|
48
|
+
description: 'Fired when Escape (or blur with commit=enter) restores the original. Bubbles.'
|
|
49
|
+
edit-start:
|
|
50
|
+
description: 'Fired when entering edit mode. Bubbles.'
|
|
51
|
+
edit-end:
|
|
52
|
+
description: 'Fired when leaving edit mode. detail = { committed: boolean }. Bubbles.'
|
|
53
|
+
slots: {}
|
|
54
|
+
states:
|
|
55
|
+
- name: idle
|
|
56
|
+
description: Static — text reads as plain text with a hover hint.
|
|
57
|
+
- name: hover
|
|
58
|
+
description: Hover affordance — subtle background tint signals editability.
|
|
59
|
+
- name: editing
|
|
60
|
+
description: contenteditable — host is the input surface; outline + caret.
|
|
61
|
+
- name: empty
|
|
62
|
+
description: Value is empty and not editing — placeholder text renders.
|
|
63
|
+
- name: disabled
|
|
64
|
+
description: Locked; click + keyboard activation are no-ops.
|
|
65
|
+
traits: []
|
|
66
|
+
tokens:
|
|
67
|
+
--inline-edit-bg-hover:
|
|
68
|
+
description: Background tint on hover (idle state).
|
|
69
|
+
default: var(--a-bg-muted)
|
|
70
|
+
--inline-edit-bg-edit:
|
|
71
|
+
description: Background while editing.
|
|
72
|
+
default: var(--a-bg)
|
|
73
|
+
--inline-edit-outline:
|
|
74
|
+
description: Outline color in the editing state.
|
|
75
|
+
default: var(--a-accent-strong)
|
|
76
|
+
--inline-edit-placeholder:
|
|
77
|
+
description: Placeholder text color in empty-static state.
|
|
78
|
+
default: var(--a-fg-subtle)
|
|
79
|
+
--inline-edit-px:
|
|
80
|
+
description: Horizontal padding (inner gutter so hover tint reads as a pill, not a flush block).
|
|
81
|
+
default: var(--a-space-1)
|
|
82
|
+
--inline-edit-py:
|
|
83
|
+
description: Vertical padding.
|
|
84
|
+
default: var(--a-space-0-5)
|
|
85
|
+
--inline-edit-radius:
|
|
86
|
+
description: Border-radius for the hover / editing chrome.
|
|
87
|
+
default: var(--a-radius-sm)
|
|
88
|
+
a2ui:
|
|
89
|
+
rules:
|
|
90
|
+
- rule: 'Use inline-edit-ui for click-to-edit titles, draft names, table-cell text, breadcrumb labels — anywhere the user expects to edit text without opening a dialog.'
|
|
91
|
+
reason: 'Primary use case — inline rename/edit.'
|
|
92
|
+
- rule: 'inline-edit-ui IS form-participating (extends UIFormElement). Pair with a hidden <form> + name="..." to submit edits as a field.'
|
|
93
|
+
reason: 'Form participation contract.'
|
|
94
|
+
- rule: 'Distinct from <input-ui> (always shows input chrome) and from <field-ui> (stacked label + input composition). inline-edit reads as text in the static state.'
|
|
95
|
+
reason: 'Sibling-component boundary.'
|
|
96
|
+
- rule: 'Listen to `change` event (detail.value, detail.oldValue) for commit; `cancel` for Escape. Default commit=blur saves on focusout + Enter.'
|
|
97
|
+
reason: 'Event-handling contract.'
|
|
98
|
+
anti_patterns:
|
|
99
|
+
- wrong: '<input-ui value="Title" name="title" variant="ghost">'
|
|
100
|
+
why: 'Ghost variant still renders input chrome (border on focus). Looks like a control, not text.'
|
|
101
|
+
fix: '<inline-edit-ui value="Title" name="title"> — reads as text in static state; chrome only appears while editing.'
|
|
102
|
+
- wrong: '<text-ui contenteditable>Title</text-ui>'
|
|
103
|
+
why: 'No state machine — no commit/cancel semantics, no form participation, no a11y wiring.'
|
|
104
|
+
fix: '<inline-edit-ui value="Title">'
|
|
105
|
+
examples:
|
|
106
|
+
- name: editable-title
|
|
107
|
+
description: A draft document title that becomes editable on click.
|
|
108
|
+
a2ui: |
|
|
109
|
+
[{ "id": "title", "component": "InlineEdit", "value": "Untitled draft" }]
|
|
110
|
+
keywords:
|
|
111
|
+
- inline-edit
|
|
112
|
+
- editable
|
|
113
|
+
- click-to-edit
|
|
114
|
+
- rename
|
|
115
|
+
- edit-in-place
|
|
116
|
+
synonyms:
|
|
117
|
+
inline-edit:
|
|
118
|
+
- editable
|
|
119
|
+
- click-to-edit
|
|
120
|
+
- edit-in-place
|
|
121
|
+
- rename-in-place
|
|
122
|
+
related:
|
|
123
|
+
- input
|
|
124
|
+
- field
|
|
125
|
+
- text
|
|
@@ -53,7 +53,14 @@
|
|
|
53
53
|
"MenuItem",
|
|
54
54
|
"TreeItem"
|
|
55
55
|
],
|
|
56
|
-
"slots": {
|
|
56
|
+
"slots": {
|
|
57
|
+
"description": {
|
|
58
|
+
"description": "Override slot for richer description markup than the plain [description] attribute string (inline links, code spans, multiple lines). Renders beneath the primary text at body-subtle typography."
|
|
59
|
+
},
|
|
60
|
+
"icon": {
|
|
61
|
+
"description": "Override the [icon] glyph with a custom slotted element (e.g. a colored <icon-ui>, an image, or an avatar-ui). Mutually exclusive with the [icon] attribute — slot child wins if both are present."
|
|
62
|
+
}
|
|
63
|
+
},
|
|
57
64
|
"states": [],
|
|
58
65
|
"status": "stable",
|
|
59
66
|
"synonyms": {
|
|
@@ -29,6 +29,18 @@ props:
|
|
|
29
29
|
description: Secondary line below the primary text. Subtle color.
|
|
30
30
|
type: string
|
|
31
31
|
|
|
32
|
+
slots:
|
|
33
|
+
icon:
|
|
34
|
+
description: >-
|
|
35
|
+
Override the [icon] glyph with a custom slotted element (e.g. a colored
|
|
36
|
+
<icon-ui>, an image, or an avatar-ui). Mutually exclusive with the
|
|
37
|
+
[icon] attribute — slot child wins if both are present.
|
|
38
|
+
description:
|
|
39
|
+
description: >-
|
|
40
|
+
Override slot for richer description markup than the plain [description]
|
|
41
|
+
attribute string (inline links, code spans, multiple lines). Renders
|
|
42
|
+
beneath the primary text at body-subtle typography.
|
|
43
|
+
|
|
32
44
|
keywords:
|
|
33
45
|
- list-item
|
|
34
46
|
- list-row
|
package/components/list/list.css
CHANGED
|
@@ -126,19 +126,27 @@
|
|
|
126
126
|
min-height: var(--a-space-6);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
/* Slot positioning uses descendant (not direct-child >) because the
|
|
130
|
+
template engine wraps `${...}` conditional renders in
|
|
131
|
+
<span style="display:contents"> housekeeping nodes — so slot="…"
|
|
132
|
+
children land as grandchildren in template-rendered hosts.
|
|
133
|
+
display:contents makes the wrapper layout-transparent (the grid
|
|
134
|
+
places the inner element), but CSS selectors still see the wrapper
|
|
135
|
+
as a real node. Descendant selectors handle both shapes (direct
|
|
136
|
+
authored children + template-engine-wrapped conditionals). */
|
|
137
|
+
:scope [slot="icon"] {
|
|
130
138
|
grid-column: 1;
|
|
131
139
|
grid-row: 1 / -1;
|
|
132
140
|
align-self: center;
|
|
133
141
|
color: var(--list-item-icon-color);
|
|
134
142
|
}
|
|
135
143
|
|
|
136
|
-
:scope
|
|
144
|
+
:scope [slot="text"] {
|
|
137
145
|
grid-column: 2;
|
|
138
146
|
grid-row: 1;
|
|
139
147
|
}
|
|
140
148
|
|
|
141
|
-
:scope
|
|
149
|
+
:scope [slot="description"] {
|
|
142
150
|
grid-column: 2;
|
|
143
151
|
grid-row: 2;
|
|
144
152
|
color: var(--list-item-desc-color);
|
|
@@ -146,11 +154,33 @@
|
|
|
146
154
|
line-height: 1.3;
|
|
147
155
|
}
|
|
148
156
|
|
|
157
|
+
/* When a [slot="action"] child is present, the grid becomes 3-column:
|
|
158
|
+
icon | content | action. The :has() selector promotes the template
|
|
159
|
+
only when an action exists, so 2-column layouts stay unaffected.
|
|
160
|
+
Action is right-aligned + vertically centered (spans both content rows).
|
|
161
|
+
Used by onboarding-checklist-ui item rows + any consumer that needs an
|
|
162
|
+
end-aligned action button on a list-item row.
|
|
163
|
+
NOTE: NOT using `> [slot="action"]` (direct-child) — the template
|
|
164
|
+
engine wraps conditional `${...}` renders in <span style="display:
|
|
165
|
+
contents"> housekeeping nodes, so slot="action" lands as a grandchild
|
|
166
|
+
in template-rendered hosts. display:contents makes the wrapper a
|
|
167
|
+
transparent grid pass-through at layout time, but CSS selectors still
|
|
168
|
+
see it as a node. Descendant combinator handles both shapes. */
|
|
169
|
+
:scope:has([slot="action"]) {
|
|
170
|
+
grid-template-columns: auto 1fr auto;
|
|
171
|
+
}
|
|
172
|
+
:scope [slot="action"] {
|
|
173
|
+
grid-column: 3;
|
|
174
|
+
grid-row: 1 / -1;
|
|
175
|
+
align-self: center;
|
|
176
|
+
justify-self: end;
|
|
177
|
+
}
|
|
178
|
+
|
|
149
179
|
/* Custom-content escape hatch — consumer authored a [slot="content"]
|
|
150
180
|
child, the auto-stamp early-returned, and the consumer owns the
|
|
151
181
|
full body. Span all columns so the consumer's layout isn't boxed
|
|
152
182
|
into the content column. */
|
|
153
|
-
:scope
|
|
183
|
+
:scope [slot="content"] {
|
|
154
184
|
grid-column: 1 / -1;
|
|
155
185
|
}
|
|
156
186
|
|
|
@@ -167,8 +197,8 @@
|
|
|
167
197
|
box-shadow: inset 2px 0 0 var(--a-accent-strong);
|
|
168
198
|
}
|
|
169
199
|
|
|
170
|
-
:scope[data-active]
|
|
171
|
-
:scope[data-active]
|
|
200
|
+
:scope[data-active] [slot="icon"],
|
|
201
|
+
:scope[data-active] [slot="description"] {
|
|
172
202
|
color: var(--a-accent-strong);
|
|
173
203
|
}
|
|
174
204
|
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://adiaui.dev/a2ui/v0_9/components/Mark.json",
|
|
4
|
+
"title": "Mark",
|
|
5
|
+
"description": "Highlighted inline text — token-driven theme-aware wrapper around the\nnative `<mark>` semantic. Use for search-result match highlighting,\ndiff additions in prose, \"new since last visit\" emphasis, and any\ninline text that needs a visual rail without changing its weight.\n\nDistinct from `<text-ui strong>` (semantic emphasis via weight) and\nfrom `<tag-ui>` (block-shaped pill chrome). mark-ui keeps the inline\ntext flow intact — same line-height, same baseline — just paints a\nbackground highlight behind the matched span.\n",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"allOf": [
|
|
8
|
+
{
|
|
9
|
+
"$ref": "common_types.json#/$defs/ComponentCommon"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"$ref": "common_types.json#/$defs/CatalogComponentCommon"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"properties": {
|
|
16
|
+
"component": {
|
|
17
|
+
"const": "Mark"
|
|
18
|
+
},
|
|
19
|
+
"variant": {
|
|
20
|
+
"description": "Highlight color variant. Default `warning` is the conventional yellow-marker tone.",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"enum": [
|
|
23
|
+
"warning",
|
|
24
|
+
"info",
|
|
25
|
+
"success",
|
|
26
|
+
"danger",
|
|
27
|
+
"muted"
|
|
28
|
+
],
|
|
29
|
+
"default": "warning"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": [
|
|
33
|
+
"component"
|
|
34
|
+
],
|
|
35
|
+
"unevaluatedProperties": false,
|
|
36
|
+
"x-adiaui": {
|
|
37
|
+
"anti_patterns": [
|
|
38
|
+
{
|
|
39
|
+
"fix": "<mark-ui>matched</mark-ui> — same semantic role but theme-aware.",
|
|
40
|
+
"why": "Native <mark> uses UA default (yellow-on-white) that doesn't adapt to theme — invisible in dark mode + jarring in light mode.",
|
|
41
|
+
"wrong": "<mark>matched</mark>"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"category": "typography",
|
|
45
|
+
"composes": [],
|
|
46
|
+
"events": {},
|
|
47
|
+
"examples": [
|
|
48
|
+
{
|
|
49
|
+
"description": "Highlight the search query within a result title.",
|
|
50
|
+
"a2ui": "[\n { \"id\": \"row\", \"component\": \"Row\", \"children\": [\"pre\", \"mk\", \"post\"] },\n { \"id\": \"pre\", \"component\": \"Text\", \"textContent\": \"Quarterly \" },\n { \"id\": \"mk\", \"component\": \"Mark\", \"textContent\": \"revenue\" },\n { \"id\": \"post\", \"component\": \"Text\", \"textContent\": \" report — Q4 2025\" }\n]\n",
|
|
51
|
+
"name": "search-match"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"keywords": [
|
|
55
|
+
"mark",
|
|
56
|
+
"highlight",
|
|
57
|
+
"search-match",
|
|
58
|
+
"emphasis"
|
|
59
|
+
],
|
|
60
|
+
"name": "UIMark",
|
|
61
|
+
"related": [
|
|
62
|
+
"text",
|
|
63
|
+
"tag"
|
|
64
|
+
],
|
|
65
|
+
"slots": {
|
|
66
|
+
"default": {
|
|
67
|
+
"description": "The text content to highlight (plain text or inline elements)."
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"states": [
|
|
71
|
+
{
|
|
72
|
+
"description": "Default — highlighted background painted behind the slotted text.",
|
|
73
|
+
"name": "idle"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"status": "stable",
|
|
77
|
+
"synonyms": {
|
|
78
|
+
"highlight": [
|
|
79
|
+
"mark",
|
|
80
|
+
"emphasis"
|
|
81
|
+
],
|
|
82
|
+
"search-match": [
|
|
83
|
+
"mark",
|
|
84
|
+
"highlight"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"tag": "mark-ui",
|
|
88
|
+
"tokens": {
|
|
89
|
+
"--mark-bg": {
|
|
90
|
+
"description": "Background color of the highlight.",
|
|
91
|
+
"default": "var(--a-warning-muted)"
|
|
92
|
+
},
|
|
93
|
+
"--mark-fg": {
|
|
94
|
+
"description": "Foreground (text) color inside the highlight.",
|
|
95
|
+
"default": "var(--a-warning-text)"
|
|
96
|
+
},
|
|
97
|
+
"--mark-px": {
|
|
98
|
+
"description": "Horizontal padding around the highlighted text.",
|
|
99
|
+
"default": "var(--a-space-0-5)"
|
|
100
|
+
},
|
|
101
|
+
"--mark-radius": {
|
|
102
|
+
"description": "Border radius of the highlight box.",
|
|
103
|
+
"default": "var(--a-radius-xs)"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"traits": [],
|
|
107
|
+
"version": 1
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<mark-ui>` — token-driven inline text highlight (search-match,
|
|
3
|
+
* "new since", diff prose). Theme-aware wrapper around the native
|
|
4
|
+
* `<mark>` semantic role. Pure CSS atom — no template, no JS behavior.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { UIElement } from '../../core/element.js';
|
|
8
|
+
|
|
9
|
+
export class UIMark extends UIElement {
|
|
10
|
+
static properties = {
|
|
11
|
+
variant: { type: String, default: 'warning', reflect: true }, // warning | info | success | danger | muted
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
static template = () => null;
|
|
15
|
+
|
|
16
|
+
connected() {
|
|
17
|
+
super.connected();
|
|
18
|
+
// Inherit the <mark> role for screen readers — "highlighted" / "marked"
|
|
19
|
+
// is the conventional AT announcement for search matches.
|
|
20
|
+
if (!this.hasAttribute('role')) this.setAttribute('role', 'mark');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@scope (mark-ui) {
|
|
2
|
+
:where(:scope) {
|
|
3
|
+
--mark-bg-default: var(--a-warning-muted);
|
|
4
|
+
--mark-fg-default: var(--a-warning-text);
|
|
5
|
+
--mark-px-default: var(--a-space-0-5);
|
|
6
|
+
--mark-radius-default: var(--a-radius-xs);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:scope {
|
|
10
|
+
/* Inline so it sits in normal text flow without breaking baselines.
|
|
11
|
+
Padding-inline only — vertical padding would push line-height. */
|
|
12
|
+
display: inline;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
padding-inline: var(--mark-px, var(--mark-px-default));
|
|
15
|
+
background: var(--mark-bg, var(--mark-bg-default));
|
|
16
|
+
color: var(--mark-fg, var(--mark-fg-default));
|
|
17
|
+
border-radius: var(--mark-radius, var(--mark-radius-default));
|
|
18
|
+
/* Preserve text decoration from ancestors (e.g. link underlines) */
|
|
19
|
+
text-decoration: inherit;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Variants — same role × state pair as alert-ui / tag-ui */
|
|
23
|
+
:scope[variant="info"] {
|
|
24
|
+
--mark-bg-default: var(--a-info-muted);
|
|
25
|
+
--mark-fg-default: var(--a-info-text);
|
|
26
|
+
}
|
|
27
|
+
:scope[variant="success"] {
|
|
28
|
+
--mark-bg-default: var(--a-success-muted);
|
|
29
|
+
--mark-fg-default: var(--a-success-text);
|
|
30
|
+
}
|
|
31
|
+
:scope[variant="danger"] {
|
|
32
|
+
--mark-bg-default: var(--a-danger-muted);
|
|
33
|
+
--mark-fg-default: var(--a-danger-text);
|
|
34
|
+
}
|
|
35
|
+
:scope[variant="muted"] {
|
|
36
|
+
--mark-bg-default: var(--a-bg-muted);
|
|
37
|
+
--mark-fg-default: var(--a-fg);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<mark-ui>` — Highlighted inline text — token-driven theme-aware wrapper around the
|
|
3
|
+
native `<mark>` semantic. Use for search-result match highlighting,
|
|
4
|
+
diff additions in prose, "new since last visit" emphasis, and any
|
|
5
|
+
inline text that needs a visual rail without changing its weight.
|
|
6
|
+
|
|
7
|
+
Distinct from `<text-ui strong>` (semantic emphasis via weight) and
|
|
8
|
+
from `<tag-ui>` (block-shaped pill chrome). mark-ui keeps the inline
|
|
9
|
+
text flow intact — same line-height, same baseline — just paints a
|
|
10
|
+
background highlight behind the matched span.
|
|
11
|
+
|
|
12
|
+
*
|
|
13
|
+
* @see https://ui-kit.exe.xyz/site/components/mark
|
|
14
|
+
*
|
|
15
|
+
* Type declarations generated by scripts/build/dts-codegen.mjs from
|
|
16
|
+
* the component's `.a2ui.json` sidecar(s). Edit the source `.yaml`,
|
|
17
|
+
* run `npm run build:components`, then `npm run codegen:dts` to
|
|
18
|
+
* regenerate; or hand-author this file fully if rich event types are
|
|
19
|
+
* needed beyond what the yaml `events:` block can express.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { UIElement } from '../../core/element.js';
|
|
23
|
+
|
|
24
|
+
export class UIMark extends UIElement {
|
|
25
|
+
/** Highlight color variant. Default `warning` is the conventional yellow-marker tone. */
|
|
26
|
+
variant: 'warning' | 'info' | 'success' | 'danger' | 'muted';
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<mark-ui>` — auto-registers the tag on import.
|
|
3
|
+
*
|
|
4
|
+
* @see ../../USAGE.md#registration--auto-vs-explicit
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { defineIfFree } from '../../core/register.js';
|
|
8
|
+
import { UIMark } from './mark.class.js';
|
|
9
|
+
|
|
10
|
+
defineIfFree('mark-ui', UIMark);
|
|
11
|
+
|
|
12
|
+
export { UIMark };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
$schema: ../../../../scripts/schemas/component.yaml.schema.json
|
|
2
|
+
name: UIMark
|
|
3
|
+
tag: mark-ui
|
|
4
|
+
status: stable
|
|
5
|
+
component: Mark
|
|
6
|
+
category: typography
|
|
7
|
+
version: 1
|
|
8
|
+
description: |
|
|
9
|
+
Highlighted inline text — token-driven theme-aware wrapper around the
|
|
10
|
+
native `<mark>` semantic. Use for search-result match highlighting,
|
|
11
|
+
diff additions in prose, "new since last visit" emphasis, and any
|
|
12
|
+
inline text that needs a visual rail without changing its weight.
|
|
13
|
+
|
|
14
|
+
Distinct from `<text-ui strong>` (semantic emphasis via weight) and
|
|
15
|
+
from `<tag-ui>` (block-shaped pill chrome). mark-ui keeps the inline
|
|
16
|
+
text flow intact — same line-height, same baseline — just paints a
|
|
17
|
+
background highlight behind the matched span.
|
|
18
|
+
props:
|
|
19
|
+
variant:
|
|
20
|
+
description: Highlight color variant. Default `warning` is the conventional yellow-marker tone.
|
|
21
|
+
type: string
|
|
22
|
+
default: warning
|
|
23
|
+
enum:
|
|
24
|
+
- warning
|
|
25
|
+
- info
|
|
26
|
+
- success
|
|
27
|
+
- danger
|
|
28
|
+
- muted
|
|
29
|
+
reflect: true
|
|
30
|
+
events: {}
|
|
31
|
+
slots:
|
|
32
|
+
default:
|
|
33
|
+
description: The text content to highlight (plain text or inline elements).
|
|
34
|
+
states:
|
|
35
|
+
- name: idle
|
|
36
|
+
description: Default — highlighted background painted behind the slotted text.
|
|
37
|
+
traits: []
|
|
38
|
+
tokens:
|
|
39
|
+
--mark-bg:
|
|
40
|
+
description: Background color of the highlight.
|
|
41
|
+
default: var(--a-warning-muted)
|
|
42
|
+
--mark-fg:
|
|
43
|
+
description: Foreground (text) color inside the highlight.
|
|
44
|
+
default: var(--a-warning-text)
|
|
45
|
+
--mark-px:
|
|
46
|
+
description: Horizontal padding around the highlighted text.
|
|
47
|
+
default: var(--a-space-0-5)
|
|
48
|
+
--mark-radius:
|
|
49
|
+
description: Border radius of the highlight box.
|
|
50
|
+
default: var(--a-radius-xs)
|
|
51
|
+
a2ui:
|
|
52
|
+
rules:
|
|
53
|
+
- rule: 'Use mark-ui for search-result match highlighting — wrap the matched substring in <mark-ui> within the surrounding text. Inline; preserves text flow.'
|
|
54
|
+
reason: 'Search-result highlight pattern.'
|
|
55
|
+
- rule: 'variant=warning (default) is the conventional yellow-marker tone; info for brand-color highlights; success for "new since" / "added" emphasis; danger for "removed" / "deleted-line" in diff prose.'
|
|
56
|
+
reason: 'Semantic variant vocabulary.'
|
|
57
|
+
- rule: 'Distinct from <text-ui strong> (weight emphasis), <tag-ui> (block pill), <code-ui> (monospace). mark-ui is specifically the "visual rail behind matched text" use case.'
|
|
58
|
+
reason: 'Sibling-component boundary.'
|
|
59
|
+
anti_patterns:
|
|
60
|
+
- wrong: '<mark>matched</mark>'
|
|
61
|
+
why: 'Native <mark> uses UA default (yellow-on-white) that doesn''t adapt to theme — invisible in dark mode + jarring in light mode.'
|
|
62
|
+
fix: '<mark-ui>matched</mark-ui> — same semantic role but theme-aware.'
|
|
63
|
+
examples:
|
|
64
|
+
- name: search-match
|
|
65
|
+
description: Highlight the search query within a result title.
|
|
66
|
+
a2ui: |
|
|
67
|
+
[
|
|
68
|
+
{ "id": "row", "component": "Row", "children": ["pre", "mk", "post"] },
|
|
69
|
+
{ "id": "pre", "component": "Text", "textContent": "Quarterly " },
|
|
70
|
+
{ "id": "mk", "component": "Mark", "textContent": "revenue" },
|
|
71
|
+
{ "id": "post", "component": "Text", "textContent": " report — Q4 2025" }
|
|
72
|
+
]
|
|
73
|
+
keywords:
|
|
74
|
+
- mark
|
|
75
|
+
- highlight
|
|
76
|
+
- search-match
|
|
77
|
+
- emphasis
|
|
78
|
+
synonyms:
|
|
79
|
+
highlight:
|
|
80
|
+
- mark
|
|
81
|
+
- emphasis
|
|
82
|
+
search-match:
|
|
83
|
+
- mark
|
|
84
|
+
- highlight
|
|
85
|
+
related:
|
|
86
|
+
- text
|
|
87
|
+
- tag
|
|
@@ -76,6 +76,15 @@
|
|
|
76
76
|
"slots": {
|
|
77
77
|
"default": {
|
|
78
78
|
"description": "Content placed inside the modal surface. Accepts any elements (card-ui, command-ui, custom markup)."
|
|
79
|
+
},
|
|
80
|
+
"body": {
|
|
81
|
+
"description": "Main body region for prose, forms, or arbitrary content. Sits between header and footer; scrolls when content overflows."
|
|
82
|
+
},
|
|
83
|
+
"footer": {
|
|
84
|
+
"description": "Optional footer region rendered below the body, typically for action buttons. Author-fills with Confirm / Cancel buttons or similar trailing affordances."
|
|
85
|
+
},
|
|
86
|
+
"header": {
|
|
87
|
+
"description": "Optional header region rendered above the body. Author-fillable with title + supporting markup. CSS positions it at the top of the modal surface with consistent padding + the dismiss-close affordance."
|
|
79
88
|
}
|
|
80
89
|
},
|
|
81
90
|
"states": [
|
|
@@ -45,6 +45,20 @@ events:
|
|
|
45
45
|
slots:
|
|
46
46
|
default:
|
|
47
47
|
description: Content placed inside the modal surface. Accepts any elements (card-ui, command-ui, custom markup).
|
|
48
|
+
header:
|
|
49
|
+
description: >-
|
|
50
|
+
Optional header region rendered above the body. Author-fillable with
|
|
51
|
+
title + supporting markup. CSS positions it at the top of the modal
|
|
52
|
+
surface with consistent padding + the dismiss-close affordance.
|
|
53
|
+
body:
|
|
54
|
+
description: >-
|
|
55
|
+
Main body region for prose, forms, or arbitrary content. Sits between
|
|
56
|
+
header and footer; scrolls when content overflows.
|
|
57
|
+
footer:
|
|
58
|
+
description: >-
|
|
59
|
+
Optional footer region rendered below the body, typically for action
|
|
60
|
+
buttons. Author-fills with Confirm / Cancel buttons or similar trailing
|
|
61
|
+
affordances.
|
|
48
62
|
states:
|
|
49
63
|
- name: idle
|
|
50
64
|
description: Default, ready for interaction.
|
|
@@ -98,6 +98,9 @@
|
|
|
98
98
|
},
|
|
99
99
|
"header": {
|
|
100
100
|
"description": "Optional custom header. Auto-generated when missing."
|
|
101
|
+
},
|
|
102
|
+
"icon": {
|
|
103
|
+
"description": "Override the leading [icon] glyph in the auto-generated header with a custom slotted element. Mutually exclusive with the [icon] attribute."
|
|
101
104
|
}
|
|
102
105
|
},
|
|
103
106
|
"states": [
|
|
@@ -63,6 +63,11 @@ slots:
|
|
|
63
63
|
description: "Children — typically <nav-item-ui> rows."
|
|
64
64
|
header:
|
|
65
65
|
description: "Optional custom header. Auto-generated when missing."
|
|
66
|
+
icon:
|
|
67
|
+
description: >-
|
|
68
|
+
Override the leading [icon] glyph in the auto-generated header
|
|
69
|
+
with a custom slotted element. Mutually exclusive with the [icon]
|
|
70
|
+
attribute.
|
|
66
71
|
|
|
67
72
|
states:
|
|
68
73
|
- name: closed
|