@adia-ai/web-components 0.8.41 → 0.8.42
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 +21 -0
- package/MIGRATION.md +187 -0
- package/USAGE.md +4 -4
- package/components/action-list/action-item.a2ui.json +8 -3
- package/components/action-list/action-item.yaml +25 -7
- package/components/action-list/action-list.class.js +68 -6
- package/components/action-list/action-list.d.ts +3 -1
- package/components/chart/chart.a2ui.json +18 -3
- package/components/chart/chart.class.js +58 -16
- package/components/chart/chart.d.ts +9 -3
- package/components/chart/chart.yaml +35 -3
- package/components/chart-legend/chart-legend.a2ui.json +6 -1
- package/components/chart-legend/chart-legend.class.js +59 -6
- package/components/chart-legend/chart-legend.css +5 -2
- package/components/chart-legend/chart-legend.d.ts +3 -1
- package/components/chart-legend/chart-legend.yaml +15 -1
- package/components/color-area/color-area.a2ui.json +148 -0
- package/components/color-area/color-area.class.js +657 -0
- package/components/color-area/color-area.css +188 -0
- package/components/color-area/color-area.d.ts +66 -0
- package/components/color-area/color-area.examples.md +19 -0
- package/components/color-area/color-area.js +17 -0
- package/components/color-area/color-area.yaml +183 -0
- package/components/color-input/color-input.a2ui.json +5 -5
- package/components/color-input/color-input.class.js +9 -6
- package/components/color-input/color-input.css +1 -1
- package/components/color-input/color-input.js +2 -2
- package/components/color-input/color-input.yaml +14 -12
- package/components/color-picker/color-picker.a2ui.json +15 -12
- package/components/color-picker/color-picker.class.js +24 -633
- package/components/color-picker/color-picker.css +14 -182
- package/components/color-picker/color-picker.yaml +41 -41
- package/components/description-list/description-list.a2ui.json +1 -1
- package/components/description-list/description-list.css +1 -1
- package/components/description-list/description-list.d.ts +1 -1
- package/components/description-list/description-list.yaml +1 -1
- package/components/field/field.a2ui.json +1 -1
- package/components/field/field.class.js +4 -1
- package/components/field/field.yaml +1 -1
- package/components/index.js +1 -0
- package/components/integration-card/integration-card.examples.md +2 -1
- package/components/menu/menu-item.a2ui.json +8 -3
- package/components/menu/menu-item.yaml +24 -3
- package/components/menu/menu.class.js +34 -6
- package/components/menu/menu.d.ts +3 -1
- package/components/pane/pane.a2ui.json +11 -1
- package/components/pane/pane.class.js +32 -3
- package/components/pane/pane.css +15 -10
- package/components/pane/pane.d.ts +10 -7
- package/components/pane/pane.yaml +15 -1
- package/components/swatch/swatch.yaml +1 -1
- package/components/table-toolbar/table-toolbar.class.js +15 -3
- package/core/icons.js +5 -0
- package/custom-elements.json +191 -16
- package/dist/theme-provider.min.js +1 -1
- package/dist/web-components.min.css +1 -1
- package/dist/web-components.min.js +89 -89
- package/dist/web-components.sheet.js +1 -1
- package/index.d.ts +12 -1
- package/package.json +1 -1
- package/patterns/admin-shell/admin-shell.examples.html +2 -2
- package/patterns/form-system/form-system.examples.html +1 -1
- package/styles/components.css +1 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/* ADR-0063 (gh#1563) — `@scope` matches by literal tag name, not JS
|
|
2
|
+
* prototype chain: `<color-picker-ui>` subclasses `UIColorArea` (see
|
|
3
|
+
* ../color-picker/color-picker.class.js) but needs its OWN tag named in
|
|
4
|
+
* this scope root to actually receive the styling — same shape as
|
|
5
|
+
* calendar-picker.css's `@scope (calendar-picker-ui, datetime-picker-ui)`
|
|
6
|
+
* for its own deprecated alias. */
|
|
7
|
+
@scope (color-area-ui, color-picker-ui) {
|
|
8
|
+
:where(:scope) {
|
|
9
|
+
/* ── Tokens ── */
|
|
10
|
+
--color-area-gap: var(--a-space-2);
|
|
11
|
+
--color-area-area-height: 10rem;
|
|
12
|
+
--color-area-area-radius: var(--a-radius-md);
|
|
13
|
+
--color-area-track-height: 0.75rem;
|
|
14
|
+
--color-area-track-radius: var(--a-radius-full);
|
|
15
|
+
--color-area-thumb-size: 1.125rem;
|
|
16
|
+
--color-area-thumb-border: 2px solid var(--a-chrome-border);
|
|
17
|
+
--color-area-thumb-shadow: 0 0 0 1px var(--a-chrome-ring-subtle), 0 2px 4px var(--a-chrome-shadow-soft);
|
|
18
|
+
--color-area-font: var(--a-font-family-code);
|
|
19
|
+
--color-area-font-size: var(--a-ui-sm);
|
|
20
|
+
--color-area-fg: var(--md-sys-color-neutral-on-surface);
|
|
21
|
+
--color-area-label-fg: var(--a-fg-muted);
|
|
22
|
+
--color-area-border: var(--md-sys-color-neutral-outline-variant);
|
|
23
|
+
--color-area-output-bg: var(--a-bg-muted);
|
|
24
|
+
--color-area-output-radius: var(--a-radius-sm);
|
|
25
|
+
--color-area-fg-disabled: var(--a-ui-text-disabled);
|
|
26
|
+
|
|
27
|
+
/* ── Spacing ── */
|
|
28
|
+
--color-area-gap-sm: var(--a-space-1);
|
|
29
|
+
--color-area-pad-sm: var(--a-space-2);
|
|
30
|
+
|
|
31
|
+
/* ── Interactive ── */
|
|
32
|
+
--color-area-focus-color: var(--md-sys-color-primary);
|
|
33
|
+
--color-area-disabled-border: var(--md-sys-color-neutral-outline-variant);
|
|
34
|
+
|
|
35
|
+
/* ── Transitions ── */
|
|
36
|
+
--color-area-duration: var(--a-duration-fast);
|
|
37
|
+
--color-area-easing: var(--a-easing);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:scope {
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: var(--color-area-gap);
|
|
45
|
+
width: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* ═══════ 2D Color Area ═══════ */
|
|
49
|
+
|
|
50
|
+
[data-area] {
|
|
51
|
+
position: relative;
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: var(--color-area-area-height);
|
|
54
|
+
border-radius: var(--color-area-area-radius);
|
|
55
|
+
border: 1px solid var(--color-area-border);
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
cursor: crosshair;
|
|
58
|
+
touch-action: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[data-area]:focus-visible {
|
|
62
|
+
outline: 2px solid var(--color-area-focus-color);
|
|
63
|
+
outline-offset: 2px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[data-area] canvas {
|
|
67
|
+
image-rendering: auto;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-area-thumb] {
|
|
71
|
+
position: absolute;
|
|
72
|
+
width: var(--color-area-thumb-size);
|
|
73
|
+
height: var(--color-area-thumb-size);
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
border: var(--color-area-thumb-border);
|
|
76
|
+
box-shadow: var(--color-area-thumb-shadow);
|
|
77
|
+
transform: translate(-50%, -50%);
|
|
78
|
+
pointer-events: none;
|
|
79
|
+
z-index: 1;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* ═══════ Slider Rows (H / C / L) ═══════ */
|
|
83
|
+
|
|
84
|
+
[data-sliders] {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
gap: var(--color-area-gap-sm);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* ═══════ Hue Track ═══════ */
|
|
91
|
+
|
|
92
|
+
[data-hue-track] {
|
|
93
|
+
position: relative;
|
|
94
|
+
width: 100%;
|
|
95
|
+
height: var(--color-area-track-height);
|
|
96
|
+
border-radius: var(--color-area-track-radius);
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
touch-action: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
[data-hue-track]:focus-visible {
|
|
102
|
+
outline: 2px solid var(--color-area-focus-color);
|
|
103
|
+
outline-offset: 2px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
[data-hue-thumb] {
|
|
107
|
+
position: absolute;
|
|
108
|
+
top: 50%;
|
|
109
|
+
width: var(--color-area-thumb-size);
|
|
110
|
+
height: var(--color-area-thumb-size);
|
|
111
|
+
border-radius: 50%;
|
|
112
|
+
border: var(--color-area-thumb-border);
|
|
113
|
+
box-shadow: var(--color-area-thumb-shadow);
|
|
114
|
+
transform: translate(-50%, -50%);
|
|
115
|
+
pointer-events: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* ═══════ Output Values ═══════ */
|
|
119
|
+
|
|
120
|
+
[data-output] {
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
gap: var(--color-area-gap-sm);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[data-output-group] {
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
gap: var(--color-area-gap-sm);
|
|
130
|
+
padding: var(--color-area-gap-sm) var(--color-area-pad-sm);
|
|
131
|
+
background: var(--color-area-output-bg);
|
|
132
|
+
border-radius: var(--color-area-output-radius);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
[data-output-value] {
|
|
136
|
+
font-family: var(--color-area-font);
|
|
137
|
+
font-size: var(--color-area-font-size);
|
|
138
|
+
color: var(--color-area-fg);
|
|
139
|
+
user-select: all;
|
|
140
|
+
-webkit-user-select: all;
|
|
141
|
+
flex: 1;
|
|
142
|
+
min-width: 0;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
text-overflow: ellipsis;
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Copy button */
|
|
149
|
+
[data-copy] {
|
|
150
|
+
flex-shrink: 0;
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
background: none;
|
|
155
|
+
border: none;
|
|
156
|
+
padding: 0;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
color: var(--color-area-label-fg);
|
|
159
|
+
transition: color var(--color-area-duration) var(--color-area-easing);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
[data-copy]:hover {
|
|
163
|
+
color: var(--color-area-fg);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
[data-copy] icon-ui {
|
|
167
|
+
--a-icon-size: var(--color-area-font-size);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* ═══════ Disabled ═══════ */
|
|
171
|
+
|
|
172
|
+
:scope[disabled] {
|
|
173
|
+
pointer-events: none;
|
|
174
|
+
color: var(--color-area-fg-disabled);
|
|
175
|
+
}
|
|
176
|
+
:scope[disabled] [data-area],
|
|
177
|
+
:scope[disabled] [data-hue-track] {
|
|
178
|
+
filter: grayscale(1);
|
|
179
|
+
cursor: not-allowed;
|
|
180
|
+
}
|
|
181
|
+
:scope[disabled] slider-ui {
|
|
182
|
+
--slider-fill-bg: var(--color-area-disabled-border);
|
|
183
|
+
--slider-thumb-bg: var(--color-area-disabled-border);
|
|
184
|
+
}
|
|
185
|
+
:scope[disabled] [data-output-value] {
|
|
186
|
+
color: var(--color-area-fg-disabled);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<color-area-ui>` — OKLCH-native color picker with 2D area and H/C/L sliders. Form-associated input emitting OKLCH color strings; canonical color authoring surface in the AdiaUI token system. Use for color input in design tools or theming UIs; for simple color swatches use <swatch-ui> or <color-input-ui> instead. Renamed from `<color-picker-ui>` (ADR-0063, gh#1563 — `-picker` is reserved for the outer trigger + popover composite shape; this is the inline substrate, mirroring <calendar-grid-ui>'s naming precedent). `<color-picker-ui>` is now a thin deprecated alias subclassing this component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://ui-kit.exe.xyz/site/components/color-area
|
|
5
|
+
*
|
|
6
|
+
* Type declarations generated by scripts/build/dts-codegen.mjs from
|
|
7
|
+
* the component's `.a2ui.json` sidecar(s). Edit the source `.yaml`,
|
|
8
|
+
* run `npm run build:components`, then `npm run codegen:dts` to
|
|
9
|
+
* regenerate; or hand-author this file fully if rich event types are
|
|
10
|
+
* needed beyond what the yaml `events:` block can express.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { UIElement } from '../../core/element.js';
|
|
14
|
+
|
|
15
|
+
export type ColorAreaChangeEvent = CustomEvent<unknown>;
|
|
16
|
+
export interface ColorAreaConstraintClampEventDetail {
|
|
17
|
+
/** Array of `{ axis, requested, clamped, reason }` objects. axis is
|
|
18
|
+
one of "l" / "c" / "h". reason names the triggering constraint
|
|
19
|
+
prop. Empty arrays are never emitted.
|
|
20
|
+
*/
|
|
21
|
+
clamps: unknown[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type ColorAreaConstraintClampEvent = CustomEvent<ColorAreaConstraintClampEventDetail>;
|
|
25
|
+
export type ColorAreaInputEvent = CustomEvent<unknown>;
|
|
26
|
+
|
|
27
|
+
export class UIColorArea extends UIElement {
|
|
28
|
+
/** Reference hue (degrees) for the [hue-drift-max] constraint. Default
|
|
29
|
+
NaN — falls back to the picker's hue at first commit so the consumer
|
|
30
|
+
can pre-seed the picker and constrain drift from that initial value.
|
|
31
|
+
*/
|
|
32
|
+
baseHue: number;
|
|
33
|
+
/** Disables all interaction */
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
/** Output format for the value property */
|
|
36
|
+
format: 'hex' | 'oklch';
|
|
37
|
+
/** Generation constraint — maximum allowed signed-shortest-path hue
|
|
38
|
+
deviation (degrees) from [base-hue] (or the first-committed hue
|
|
39
|
+
if [base-hue] is unset). Default NaN (no constraint). Wrap-aware
|
|
40
|
+
so a drift of 350 degrees resolves as -10.
|
|
41
|
+
*/
|
|
42
|
+
hueDriftMax: number;
|
|
43
|
+
/** Generation constraint (v0.4.9 §99h, FEEDBACK-02 #7) — clamp the
|
|
44
|
+
OKLCH chroma channel to at most this value before commit. Out-of-
|
|
45
|
+
bound mutations round-trip to the nearest in-bound equivalent +
|
|
46
|
+
fire `constraint-clamp`. Default Infinity (no constraint).
|
|
47
|
+
*/
|
|
48
|
+
maxChroma: number;
|
|
49
|
+
/** Generation constraint — clamp OKLCH lightness to at most this value (0..1). Default 1 (no constraint). */
|
|
50
|
+
maxL: number;
|
|
51
|
+
/** Generation constraint — clamp OKLCH lightness to at least this value (0..1). Default 0 (no constraint). */
|
|
52
|
+
minL: number;
|
|
53
|
+
/** Form field name */
|
|
54
|
+
name: string;
|
|
55
|
+
/** Current color as hex string */
|
|
56
|
+
value: string;
|
|
57
|
+
|
|
58
|
+
addEventListener(type: 'change', listener: (ev: ColorAreaChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
59
|
+
addEventListener(type: 'constraint-clamp', listener: (ev: ColorAreaConstraintClampEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
60
|
+
addEventListener(type: 'input', listener: (ev: ColorAreaInputEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
61
|
+
addEventListener<K extends keyof HTMLElementEventMap>(
|
|
62
|
+
type: K,
|
|
63
|
+
listener: (this: UIColorArea, ev: HTMLElementEventMap[K]) => unknown,
|
|
64
|
+
options?: boolean | AddEventListenerOptions,
|
|
65
|
+
): void;
|
|
66
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# color-area — Examples
|
|
2
|
+
|
|
3
|
+
## Default
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<color-area-ui></color-area-ui>
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Pre-set Colors
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<color-area-ui value="#3b82f6"></color-area-ui>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## disabled
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<color-area-ui value="#3b82f6" disabled></color-area-ui>
|
|
19
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<color-area-ui>` — auto-registers the tag on import.
|
|
3
|
+
*
|
|
4
|
+
* For non-side-effect class import (test isolation, tag override), use
|
|
5
|
+
* the `class` subpath:
|
|
6
|
+
*
|
|
7
|
+
* import { UIColorArea } from '@adia-ai/web-components/components/color-area/class';
|
|
8
|
+
*
|
|
9
|
+
* @see ../../USAGE.md#registration--auto-vs-explicit
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { defineIfFree } from '../../core/register.js';
|
|
13
|
+
import { UIColorArea } from './color-area.class.js';
|
|
14
|
+
|
|
15
|
+
defineIfFree('color-area-ui', UIColorArea);
|
|
16
|
+
|
|
17
|
+
export { UIColorArea };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Generated by scripts/migrate-yamls-to-v1.mjs — migrated to v1 contract.
|
|
2
|
+
# Edit this file; run `npm run build:components` to regenerate a2ui.json.
|
|
3
|
+
$schema: ../../../../scripts/schemas/component.yaml.schema.json
|
|
4
|
+
name: UIColorArea
|
|
5
|
+
tag: color-area-ui
|
|
6
|
+
status: stable
|
|
7
|
+
component: ColorArea
|
|
8
|
+
category: input
|
|
9
|
+
version: 1
|
|
10
|
+
description: >-
|
|
11
|
+
OKLCH-native color picker with 2D area and H/C/L sliders.
|
|
12
|
+
Form-associated input emitting OKLCH color strings; canonical color
|
|
13
|
+
authoring surface in the AdiaUI token system. Use for color input in
|
|
14
|
+
design tools or theming UIs; for simple color swatches use <swatch-ui>
|
|
15
|
+
or <color-input-ui> instead. Renamed from `<color-picker-ui>`
|
|
16
|
+
(ADR-0063, gh#1563 — `-picker` is reserved for the outer trigger +
|
|
17
|
+
popover composite shape; this is the inline substrate, mirroring
|
|
18
|
+
<calendar-grid-ui>'s naming precedent). `<color-picker-ui>` is now a
|
|
19
|
+
thin deprecated alias subclassing this component.
|
|
20
|
+
# Per ADR-0027 — primitives that programmatically create other primitives
|
|
21
|
+
# do NOT auto-import them. Consumer (or demo shell) must explicitly import.
|
|
22
|
+
composes:
|
|
23
|
+
- slider-ui
|
|
24
|
+
props:
|
|
25
|
+
name:
|
|
26
|
+
description: Form field name
|
|
27
|
+
type: string
|
|
28
|
+
default: ""
|
|
29
|
+
disabled:
|
|
30
|
+
description: Disables all interaction
|
|
31
|
+
type: boolean
|
|
32
|
+
default: false
|
|
33
|
+
reflect: true
|
|
34
|
+
format:
|
|
35
|
+
description: Output format for the value property
|
|
36
|
+
type: string
|
|
37
|
+
default: hex
|
|
38
|
+
enum:
|
|
39
|
+
- hex
|
|
40
|
+
- oklch
|
|
41
|
+
value:
|
|
42
|
+
description: Current color as hex string
|
|
43
|
+
type: string
|
|
44
|
+
default: "#3b82f6"
|
|
45
|
+
maxChroma:
|
|
46
|
+
description: |
|
|
47
|
+
Generation constraint (v0.4.9 §99h, FEEDBACK-02 #7) — clamp the
|
|
48
|
+
OKLCH chroma channel to at most this value before commit. Out-of-
|
|
49
|
+
bound mutations round-trip to the nearest in-bound equivalent +
|
|
50
|
+
fire `constraint-clamp`. Default Infinity (no constraint).
|
|
51
|
+
type: number
|
|
52
|
+
default: Infinity
|
|
53
|
+
reflect: true
|
|
54
|
+
maxL:
|
|
55
|
+
description: Generation constraint — clamp OKLCH lightness to at most this value (0..1). Default 1 (no constraint).
|
|
56
|
+
type: number
|
|
57
|
+
default: 1
|
|
58
|
+
reflect: true
|
|
59
|
+
minL:
|
|
60
|
+
description: Generation constraint — clamp OKLCH lightness to at least this value (0..1). Default 0 (no constraint).
|
|
61
|
+
type: number
|
|
62
|
+
default: 0
|
|
63
|
+
reflect: true
|
|
64
|
+
hueDriftMax:
|
|
65
|
+
description: |
|
|
66
|
+
Generation constraint — maximum allowed signed-shortest-path hue
|
|
67
|
+
deviation (degrees) from [base-hue] (or the first-committed hue
|
|
68
|
+
if [base-hue] is unset). Default NaN (no constraint). Wrap-aware
|
|
69
|
+
so a drift of 350 degrees resolves as -10.
|
|
70
|
+
type: number
|
|
71
|
+
default: NaN
|
|
72
|
+
reflect: true
|
|
73
|
+
baseHue:
|
|
74
|
+
description: |
|
|
75
|
+
Reference hue (degrees) for the [hue-drift-max] constraint. Default
|
|
76
|
+
NaN — falls back to the picker's hue at first commit so the consumer
|
|
77
|
+
can pre-seed the picker and constrain drift from that initial value.
|
|
78
|
+
type: number
|
|
79
|
+
default: NaN
|
|
80
|
+
reflect: true
|
|
81
|
+
events:
|
|
82
|
+
change:
|
|
83
|
+
description: Fired on every color change
|
|
84
|
+
input:
|
|
85
|
+
description: Fired during continuous interaction (drag)
|
|
86
|
+
constraint-clamp:
|
|
87
|
+
description: |
|
|
88
|
+
Fired immediately before `change` / `input` when one or more
|
|
89
|
+
consumer-declared constraints (max-chroma / max-l / min-l /
|
|
90
|
+
hue-drift-max) clamped a channel away from the user-requested
|
|
91
|
+
value. detail.clamps is an array of axis-specific clamp records.
|
|
92
|
+
detail:
|
|
93
|
+
clamps:
|
|
94
|
+
type: array
|
|
95
|
+
description: |
|
|
96
|
+
Array of `{ axis, requested, clamped, reason }` objects. axis is
|
|
97
|
+
one of "l" / "c" / "h". reason names the triggering constraint
|
|
98
|
+
prop. Empty arrays are never emitted.
|
|
99
|
+
slots: {}
|
|
100
|
+
states:
|
|
101
|
+
- name: idle
|
|
102
|
+
description: Default, ready for interaction.
|
|
103
|
+
- name: disabled
|
|
104
|
+
description: Non-interactive; dimmed.
|
|
105
|
+
attribute: disabled
|
|
106
|
+
traits: []
|
|
107
|
+
tokens: {}
|
|
108
|
+
requiredIcons:
|
|
109
|
+
- copy
|
|
110
|
+
- check
|
|
111
|
+
- warning
|
|
112
|
+
a2ui:
|
|
113
|
+
rules:
|
|
114
|
+
- rule: 'OKLCH-native color picker with 2D color area + H/C/L sliders. Form-associated; emits OKLCH color strings.'
|
|
115
|
+
reason: 'Canonical color-authoring surface.'
|
|
116
|
+
- rule: 'For simple color swatches (read-only display) use <swatch-ui>; for hex/rgb text input use <color-input-ui>.'
|
|
117
|
+
reason: 'Surface boundary.'
|
|
118
|
+
- rule: 'Renamed from <color-picker-ui> (ADR-0063, gh#1563); the old tag is a deprecated alias that still works — new generation should reach for ColorArea directly.'
|
|
119
|
+
reason: 'Picker-naming convention: -picker names the outer trigger+popover composite, never the inline substrate.'
|
|
120
|
+
- rule: 'Output format defaults to oklch(); set format= to override (hex, rgb, hsl).'
|
|
121
|
+
reason: 'Format knob.'
|
|
122
|
+
anti_patterns: []
|
|
123
|
+
examples:
|
|
124
|
+
- name: color-area-demo
|
|
125
|
+
description: Color picker card with a color picker component for selecting colors with swatches.
|
|
126
|
+
a2ui: >-
|
|
127
|
+
[
|
|
128
|
+
{
|
|
129
|
+
"id": "root",
|
|
130
|
+
"component": "Card",
|
|
131
|
+
"children": [
|
|
132
|
+
"sec"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "sec",
|
|
137
|
+
"component": "Section",
|
|
138
|
+
"children": [
|
|
139
|
+
"cp"
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"id": "cp",
|
|
144
|
+
"component": "ColorArea",
|
|
145
|
+
"value": "#6366f1"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
- name: color-area-panel
|
|
149
|
+
description: Color picker with swatch selection in a card.
|
|
150
|
+
a2ui: >-
|
|
151
|
+
[
|
|
152
|
+
{
|
|
153
|
+
"id": "root",
|
|
154
|
+
"component": "Card",
|
|
155
|
+
"children": [
|
|
156
|
+
"sec"
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"id": "sec",
|
|
161
|
+
"component": "Section",
|
|
162
|
+
"children": [
|
|
163
|
+
"cp"
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"id": "cp",
|
|
168
|
+
"component": "ColorArea",
|
|
169
|
+
"value": "#3b82f6"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
keywords:
|
|
173
|
+
- colorarea
|
|
174
|
+
- color-area
|
|
175
|
+
- colorpicker
|
|
176
|
+
- color-picker
|
|
177
|
+
- color
|
|
178
|
+
- picker
|
|
179
|
+
synonyms:
|
|
180
|
+
color-area: [color-canvas, color-surface, swatch-picker, color-picker]
|
|
181
|
+
related:
|
|
182
|
+
- grid
|
|
183
|
+
- button
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://adiaui.dev/a2ui/v0_9/components/ColorInput.json",
|
|
4
4
|
"title": "ColorInput",
|
|
5
|
-
"description": "Compact form-bearing color input — opens a popover-anchored\n`<color-
|
|
5
|
+
"description": "Compact form-bearing color input — opens a popover-anchored\n`<color-area-ui>` from an inline swatch button. §302 (v0.5.12,\nFEEDBACK-29 re-bucket from v0.6.0). Canonicalizes the USAGE.md §221f\nOption B recipe (popover + button + color-area) into a single\nform-associated tag for inline form contexts (settings drawer \"source\ncolor\" field, swatch-row inline-edit, etc.). Composes `<color-area-ui>`\n(ADR-0063, gh#1563 — renamed from `<color-picker-ui>`, which is now a\ndeprecated alias); `color-input-ui`'s own tag/name is unaffected.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"allOf": [
|
|
8
8
|
{
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"default": "NaN"
|
|
42
42
|
},
|
|
43
43
|
"maxChroma": {
|
|
44
|
-
"description": "Generation constraint forwarded to the inner `<color-
|
|
44
|
+
"description": "Generation constraint forwarded to the inner `<color-area-ui>` (v0.5.13\n§-TBD, FB-33 §1). Clamp the OKLCH chroma channel to at most this value.\nDefault Infinity (no constraint).\n",
|
|
45
45
|
"type": "number",
|
|
46
46
|
"default": "Infinity"
|
|
47
47
|
},
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"default": false
|
|
67
67
|
},
|
|
68
68
|
"placement": {
|
|
69
|
-
"description": "Popover placement relative to the trigger. Default `bottom` centers the color-
|
|
69
|
+
"description": "Popover placement relative to the trigger. Default `bottom` centers the color-area panel under the swatch button (ADR-0034 Rule 2 — panel wider than trigger).",
|
|
70
70
|
"type": "string",
|
|
71
71
|
"enum": [
|
|
72
72
|
"top",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"composes": [
|
|
97
97
|
"button-ui",
|
|
98
98
|
"popover-ui",
|
|
99
|
-
"color-
|
|
99
|
+
"color-area-ui"
|
|
100
100
|
],
|
|
101
101
|
"events": {
|
|
102
102
|
"change": {
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
"name": "UIColorInput",
|
|
178
178
|
"parts": {},
|
|
179
179
|
"related": [
|
|
180
|
-
"color-
|
|
180
|
+
"color-area",
|
|
181
181
|
"popover",
|
|
182
182
|
"button",
|
|
183
183
|
"swatch"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Compact form-bearing color input. §302 (v0.5.12, FEEDBACK-29 re-bucket).
|
|
19
19
|
*
|
|
20
|
-
* Canonicalizes the USAGE.md §221f recipe (popover + button + color-
|
|
20
|
+
* Canonicalizes the USAGE.md §221f recipe (popover + button + color-area)
|
|
21
21
|
* into a single form-associated tag. Builds its inner DOM in `connected()`
|
|
22
22
|
* as light-DOM children:
|
|
23
23
|
*
|
|
@@ -27,10 +27,13 @@
|
|
|
27
27
|
* <span class="color-input__swatch"></span>
|
|
28
28
|
* <span class="color-input__value"></span>
|
|
29
29
|
* </button-ui>
|
|
30
|
-
* <color-
|
|
30
|
+
* <color-area-ui slot="content"></color-area-ui>
|
|
31
31
|
* </popover-ui>
|
|
32
32
|
* </color-input-ui>
|
|
33
33
|
*
|
|
34
|
+
* Composes `<color-area-ui>` (ADR-0063, gh#1563 — renamed from
|
|
35
|
+
* `<color-picker-ui>`, which is now a deprecated alias).
|
|
36
|
+
*
|
|
34
37
|
* Form-associated via UIFormElement + ElementInternals.
|
|
35
38
|
*/
|
|
36
39
|
|
|
@@ -44,7 +47,7 @@ export class UIColorInput extends UIFormElement {
|
|
|
44
47
|
format: { type: String, default: 'hex', reflect: true },
|
|
45
48
|
placement: { type: String, default: 'bottom', reflect: true }, // ADR-0034 Rule 2: color picker panel >> swatch trigger
|
|
46
49
|
open: { type: Boolean, default: false, reflect: true },
|
|
47
|
-
// Generation-constraint props forwarded to the inner <color-
|
|
50
|
+
// Generation-constraint props forwarded to the inner <color-area-ui>.
|
|
48
51
|
// v0.5.13 §-TBD (FB-33 §1) — full parity with color-picker's 5 constraint
|
|
49
52
|
// props (`maxChroma` / `maxL` / `minL` / `hueDriftMax` / `baseHue`) so
|
|
50
53
|
// <color-input-ui> adoption doesn't force a UX regression on consumers
|
|
@@ -105,7 +108,7 @@ export class UIColorInput extends UIFormElement {
|
|
|
105
108
|
if (this.firstElementChild) {
|
|
106
109
|
this.#popover = this.querySelector(':scope > popover-ui');
|
|
107
110
|
this.#button = this.querySelector(':scope > popover-ui > button-ui[slot="trigger"]');
|
|
108
|
-
this.#picker = this.querySelector(':scope > popover-ui > color-
|
|
111
|
+
this.#picker = this.querySelector(':scope > popover-ui > color-area-ui[slot="content"]');
|
|
109
112
|
this.#swatch = this.querySelector('.color-input__swatch');
|
|
110
113
|
this.#valueLabel = this.querySelector('.color-input__value');
|
|
111
114
|
if (this.#popover && this.#button && this.#picker) return;
|
|
@@ -130,7 +133,7 @@ export class UIColorInput extends UIFormElement {
|
|
|
130
133
|
|
|
131
134
|
button.append(swatch, valueLabel);
|
|
132
135
|
|
|
133
|
-
const picker = document.createElement('color-
|
|
136
|
+
const picker = document.createElement('color-area-ui');
|
|
134
137
|
picker.setAttribute('slot', 'content');
|
|
135
138
|
picker.setAttribute('format', this.format);
|
|
136
139
|
picker.setAttribute('value', this.value);
|
|
@@ -197,7 +200,7 @@ export class UIColorInput extends UIFormElement {
|
|
|
197
200
|
this.#syncFromValue();
|
|
198
201
|
// Forward the inner picker's parsed OKLCH channel scalars (v0.5.13 §-TBD,
|
|
199
202
|
// FB-33 §1-adjacent). Consumers writing OKLCH-native logic get the parsed
|
|
200
|
-
// {l, c, h} for free, matching <color-
|
|
203
|
+
// {l, c, h} for free, matching <color-area-ui>'s detail shape.
|
|
201
204
|
this.dispatchEvent(new CustomEvent(kind, {
|
|
202
205
|
bubbles: true,
|
|
203
206
|
composed: true,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* <color-input-ui> — compact form-bearing color input.
|
|
3
3
|
*
|
|
4
4
|
* §302 (v0.5.12, FEEDBACK-29 re-bucket). Light-DOM composition of
|
|
5
|
-
* <popover-ui> + <button-ui> + <color-
|
|
5
|
+
* <popover-ui> + <button-ui> + <color-area-ui>. The host element
|
|
6
6
|
* carries form-control sizing tokens; inner button + popover keep
|
|
7
7
|
* their own primitive styling.
|
|
8
8
|
*/
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
* import { UIColorInput } from '@adia-ai/web-components/components/color-input/class';
|
|
8
8
|
*
|
|
9
9
|
* Per ADR-0027, this module does NOT auto-import the composed primitives
|
|
10
|
-
* (`<popover-ui>`, `<button-ui>`, `<color-
|
|
10
|
+
* (`<popover-ui>`, `<button-ui>`, `<color-area-ui>`). Consumers must
|
|
11
11
|
* register them explicitly before mounting `<color-input-ui>`:
|
|
12
12
|
*
|
|
13
13
|
* import '@adia-ai/web-components/components/popover';
|
|
14
14
|
* import '@adia-ai/web-components/components/button';
|
|
15
|
-
* import '@adia-ai/web-components/components/color-
|
|
15
|
+
* import '@adia-ai/web-components/components/color-area';
|
|
16
16
|
* import '@adia-ai/web-components/components/color-input';
|
|
17
17
|
*
|
|
18
18
|
* @see ../../USAGE.md#registration--auto-vs-explicit
|