@rak200/ui 0.5.1 → 0.6.1
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/README.md +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +1 -2
- package/dist/checkbox.js.map +1 -1
- package/dist/dialog.js +4 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts +5 -6
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +7 -9
- package/dist/input.js.map +1 -1
- package/dist/menu.js +2 -2
- package/dist/radio.js +1 -1
- package/dist/select.js +3 -3
- package/dist/tokens.js +3 -3
- package/dist/tokens.js.map +1 -1
- package/dist/tooltip.d.ts +3 -4
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +65 -20
- package/dist/tooltip.js.map +1 -1
- package/package.json +8 -5
- package/dist/field.d.ts +0 -54
- package/dist/field.d.ts.map +0 -1
- package/dist/field.js +0 -252
- package/dist/field.js.map +0 -1
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ schemes rather than one.
|
|
|
77
77
|
|
|
78
78
|
## Status
|
|
79
79
|
|
|
80
|
-
**v0.**
|
|
80
|
+
**v0.** Eighteen components — `<ui-button>`, `<ui-card>`, `<ui-dialog>`, `<ui-input>`,
|
|
81
81
|
`<ui-textarea>`, `<ui-checkbox>`, `<ui-switch>`, `<ui-select>`, `<ui-option>`, `<ui-optgroup>`,
|
|
82
82
|
`<ui-radio-group>`, `<ui-radio>`, `<ui-tooltip>`, `<ui-toaster>`, `<ui-toast>`, `<ui-menu>`,
|
|
83
83
|
`<ui-table>` and `<ui-icon>` — the token layer
|
package/dist/checkbox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../src/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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IAI7C,iFAAiF;IACjF,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIpD,uEAAuE;IACvE,IAAI,IAAI,IAAI,eAAe,GAAG,IAAI,CAEjC;IAED,+DAA+D;IAC/D,IAAI,QAAQ,IAAI,aAAa,CAE5B;IAED,gFAAgF;IAChF,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAEQ,MAAM,IAAI,cAAc;IAIjC;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc;CAwBrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,UAAW,SAAQ,QAAQ;IACpC,gBAAyB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAGjC;IAEF;;;;;;OAMG;IACH,aAAa,UAAS;IAEtB,gBAAyB,MAAM,EAAE,SAAS,EAAE,CA6C1C;IAEO,MAAM,IAAI,cAAc;IAIxB,OAAO,IAAI,IAAI;IAKxB;;;;OAIG;cACgB,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;CAI3D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,QAAS,SAAQ,QAAQ;IAClC,gBAAyB,MAAM,EAAE,SAAS,EAAE,CAuC1C;IAEF,mBAA4B,WAAW,EAAE,MAAM,CAAY;CAC9D;AAWD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,aAAa,EAAE,UAAU,CAAC;QAC1B,WAAW,EAAE,QAAQ,CAAC;KACzB;CACJ"}
|
package/dist/checkbox.js
CHANGED
|
@@ -136,8 +136,7 @@ const toggle = css `
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/* Read off the control's own aria-invalid rather than off a host attribute, which is
|
|
139
|
-
the same source a screen reader uses
|
|
140
|
-
ui-field was the one writing it. One property now feeds all three — the boundary,
|
|
139
|
+
the same source a screen reader uses. One property now feeds all three — the boundary,
|
|
141
140
|
the message and setValidity — so they cannot disagree. Only the boundary moves; a
|
|
142
141
|
red fill on a switch would read as *on*.
|
|
143
142
|
|
package/dist/checkbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../src/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuC,MAAM,KAAK,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;GASG;AACH,MAAM,IAAI,GAAG,GAAG,CAAA,kBAAkB,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,IAAI,GAAG,GAAG,CAAA,sOAAsO,CAAC;AAEvP,uFAAuF;AACvF,MAAM,KAAK,GAAG,GAAG,CAAA,6BAA6B,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;oBAQE,SAAS,CAAC,YAAY,CAAC;uBACpB,SAAS,CAAC,WAAW,CAAC;;;;;;;;;;;;eAY9B,SAAS,CAAC,YAAY,CAAC;;iBAErB,SAAS,CAAC,iBAAiB,CAAC;;;;;;;;;;sBAUvB,IAAI;4BACE,SAAS,CAAC,oBAAoB,CAAC;;4BAE/B,SAAS,CAAC,mBAAmB,CAAC;;;;;;+BAM3B,SAAS,CAAC,qBAAqB,CAAC,IAAI,SAAS,CAAC,mBAAmB,CAAC;2BACtE,SAAS,CAAC,qBAAqB,CAAC,IAAI,SAAS,CAAC,mBAAmB,CAAC;;;;4BAIjE,SAAS,CAAC,mBAAmB,CAAC;wBAClC,SAAS,CAAC,mBAAmB,CAAC;;;;;;;;;;wBAU9B,SAAS,CAAC,iBAAiB,CAAC;;;;4BAIxB,SAAS,CAAC,yBAAyB,CAAC;wBACxC,SAAS,CAAC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AM,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACgB,IAAI,CAAC,OAAyB;QAC7C,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAC/C,CAAC;;AAGL;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,QAAS,SAAQ,QAAQ;IAAtC;;QA0CgC,gBAAW,GAAW,QAAQ,CAAC;IAC/D,CAAC;aA1C4B,WAAM,GAAgB;QAC3C,MAAM;QACN,GAAG,CAAA;;oCAEyB,IAAI;;;iCAGP,IAAI;;;;;;;oCAOD,SAAS,CAAC,mBAAmB,CAAC;;;;;;;sBAO5C,SAAS,CAAC,oBAAoB,CAAC;;;wCAGb,IAAI;4CACA,IAAI;;uCAET,SAAS,CAAC,qBAAqB,CAAC;0BAC7C,SAAS,CAAC,mBAAmB,CAAC;mCACrB,SAAS,CAAC,qBAAqB,CAAC;0BACzC,SAAS,CAAC,mBAAmB,CAAC;0CACd,SAAS,CAAC,qBAAqB,CAAC;0BAChD,SAAS,CAAC,mBAAmB,CAAC;;;;mDAIL,IAAI;;SAE9C;KACJ,AAvC8B,CAuC7B;;AAKN,yFAAyF;AACzF,yFAAyF;AACzF,yFAAyF;AACzF,oEAAoE;AACpE,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;AAEjD,0EAA0E;AAC1E,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC"}
|
package/dist/dialog.js
CHANGED
|
@@ -410,10 +410,10 @@ export class UiDialog extends LitElement {
|
|
|
410
410
|
* **A copy of the text rather than a reference to the element, and that is forced.**
|
|
411
411
|
* APG names a modal with `aria-labelledby` pointing at its heading, and an IDREF does
|
|
412
412
|
* not cross a shadow boundary — so a `<dialog>` in this shadow root cannot point at a
|
|
413
|
-
* heading in the host's tree.
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
413
|
+
* heading in the host's tree. Every other component answers that by rendering both ends
|
|
414
|
+
* itself; a dialog cannot, because the element that has to reach the top layer is the
|
|
415
|
+
* one this component renders. What does cross is a string, so the name is copied and
|
|
416
|
+
* the observer above keeps the copy honest.
|
|
417
417
|
*/
|
|
418
418
|
#label() {
|
|
419
419
|
const title = this.querySelector(':scope > [slot="title"]');
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export { UiButton, type ButtonVariant } from './button.js';
|
|
|
2
2
|
export { UiCard } from './card.js';
|
|
3
3
|
export { UiCheckbox, UiSwitch } from './checkbox.js';
|
|
4
4
|
export { UiDialog } from './dialog.js';
|
|
5
|
-
export { UiField } from './field.js';
|
|
6
5
|
export { UiIcon, register } from './icon.js';
|
|
7
6
|
export { UiInput, UiTextarea } from './input.js';
|
|
8
7
|
export { UiMenu } from './menu.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACH,MAAM,EACN,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,eAAe,EACf,KAAK,KAAK,EACV,KAAK,YAAY,GACpB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@ export { UiButton } from './button.js';
|
|
|
2
2
|
export { UiCard } from './card.js';
|
|
3
3
|
export { UiCheckbox, UiSwitch } from './checkbox.js';
|
|
4
4
|
export { UiDialog } from './dialog.js';
|
|
5
|
-
export { UiField } from './field.js';
|
|
6
5
|
export { UiIcon, register } from './icon.js';
|
|
7
6
|
export { UiInput, UiTextarea } from './input.js';
|
|
8
7
|
export { UiMenu } from './menu.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAyB,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAqB,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACH,MAAM,EACN,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,eAAe,GAGlB,MAAM,aAAa,CAAC"}
|
package/dist/input.d.ts
CHANGED
|
@@ -3,9 +3,8 @@ import { LitElement, nothing, type CSSResult, type TemplateResult } from 'lit';
|
|
|
3
3
|
* A styled native form control, and the wiring that used to sit around it.
|
|
4
4
|
*
|
|
5
5
|
* **The control is this element's**, rendered into its shadow root together with its
|
|
6
|
-
* label, its help text and its message
|
|
7
|
-
*
|
|
8
|
-
* attributes.
|
|
6
|
+
* label, its help text and its message, so every IDREF resolves in one tree scope. What a
|
|
7
|
+
* host writes is the tag and its attributes.
|
|
9
8
|
*
|
|
10
9
|
* **The element is the form control**, through `ElementInternals`: an `<input>` in a
|
|
11
10
|
* shadow root has no form owner, so the value reaches a submit because this element passes
|
|
@@ -166,7 +165,7 @@ declare class UiTextField extends LitElement {
|
|
|
166
165
|
* **The error is described before the help**, and the help is not replaced by it: a
|
|
167
166
|
* screen reader announces descriptions in order, and help text is usually the format
|
|
168
167
|
* requirement — which is the very suggestion a reader needs in order to recover
|
|
169
|
-
* (WCAG 3.3.3).
|
|
168
|
+
* (WCAG 3.3.3).
|
|
170
169
|
*/
|
|
171
170
|
protected frame(control: TemplateResult): TemplateResult;
|
|
172
171
|
/** The ids describing the control, in the order a reader needs them. */
|
|
@@ -179,8 +178,8 @@ declare class UiTextField extends LitElement {
|
|
|
179
178
|
*
|
|
180
179
|
* **You write the tag, not a control.** RFC 0005 reversed the rule this element was built
|
|
181
180
|
* on: the `<input>`, its `<label>`, its help text and its message are rendered together in
|
|
182
|
-
* one shadow root, so
|
|
183
|
-
*
|
|
181
|
+
* one shadow root, so every IDREF resolves and nothing is left to wire from outside. The
|
|
182
|
+
* attributes below are the platform's own, and the ones it computes with —
|
|
184
183
|
* `type`, `pattern`, `min`, `max`, `step` — are handed to a real `<input>` that validates
|
|
185
184
|
* them itself.
|
|
186
185
|
*
|
package/dist/input.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AA6H1F;;;;;;;;;;;;;GAaG;AACH,cAAM,WAAY,SAAQ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;IAmBxD,wEAAwE;IACxE,SAAS,CAAC,SAAS,IAAI,MAAM,GAAG,OAAO,OAAO;IAQ9C,iFAAiF;IACjF,SAAS,CAAC,OAAO,IAAI,MAAM,GAAG,OAAO,OAAO;CAG/C;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,OAAQ,SAAQ,WAAW;IACpC,gBAAyB,MAAM,EAAE,SAAS,CAAS;IAEnD,gBAAyB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAQjC;IAEF,+EAA+E;IAC/E,IAAI,SAAU;IAEd,iFAAiF;IACjF,SAAS,SAAM;IAEf,gFAAgF;IAChF,OAAO,SAAM;IAEb,2CAA2C;IAC3C,GAAG,SAAM;IAET,4CAA4C;IAC5C,GAAG,SAAM;IAET,wDAAwD;IACxD,IAAI,SAAM;IAED,MAAM,IAAI,cAAc;CA2BpC;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,UAAW,SAAQ,WAAW;IACvC,gBAAyB,MAAM,EAAE,SAAS,EAAE,CAQ1C;IAEF,gBAAyB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAGjC;IAEF,qFAAqF;IACrF,IAAI,SAAM;IAED,MAAM,IAAI,cAAc;CAsBpC;AAWD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,UAAU,EAAE,OAAO,CAAC;QACpB,aAAa,EAAE,UAAU,CAAC;KAC7B;CACJ"}
|
package/dist/input.js
CHANGED
|
@@ -19,7 +19,7 @@ const field = css `
|
|
|
19
19
|
font-family: ${reference('--ui-font')};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
/* The rhythm
|
|
22
|
+
/* The vertical rhythm between the label, the control and whatever is under it. */
|
|
23
23
|
.stack {
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: column;
|
|
@@ -88,8 +88,7 @@ const field = css `
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/* Read off the control's own aria-invalid rather than off a host attribute: it is the
|
|
91
|
-
same source a screen reader uses
|
|
92
|
-
ui-field was the one writing it. Not :host([error]) — a reflected string property
|
|
91
|
+
same source a screen reader uses. Not :host([error]) — a reflected string property
|
|
93
92
|
whose default is empty puts an empty attribute on the host, and an
|
|
94
93
|
attribute-presence selector matches every element. Measured on ui-checkbox. */
|
|
95
94
|
input[aria-invalid='true'],
|
|
@@ -125,9 +124,8 @@ function attribute(value) {
|
|
|
125
124
|
* A styled native form control, and the wiring that used to sit around it.
|
|
126
125
|
*
|
|
127
126
|
* **The control is this element's**, rendered into its shadow root together with its
|
|
128
|
-
* label, its help text and its message
|
|
129
|
-
*
|
|
130
|
-
* attributes.
|
|
127
|
+
* label, its help text and its message, so every IDREF resolves in one tree scope. What a
|
|
128
|
+
* host writes is the tag and its attributes.
|
|
131
129
|
*
|
|
132
130
|
* **The element is the form control**, through `ElementInternals`: an `<input>` in a
|
|
133
131
|
* shadow root has no form owner, so the value reaches a submit because this element passes
|
|
@@ -289,7 +287,7 @@ class UiTextField extends LitElement {
|
|
|
289
287
|
* **The error is described before the help**, and the help is not replaced by it: a
|
|
290
288
|
* screen reader announces descriptions in order, and help text is usually the format
|
|
291
289
|
* requirement — which is the very suggestion a reader needs in order to recover
|
|
292
|
-
* (WCAG 3.3.3).
|
|
290
|
+
* (WCAG 3.3.3).
|
|
293
291
|
*/
|
|
294
292
|
frame(control) {
|
|
295
293
|
return html `
|
|
@@ -321,8 +319,8 @@ class UiTextField extends LitElement {
|
|
|
321
319
|
*
|
|
322
320
|
* **You write the tag, not a control.** RFC 0005 reversed the rule this element was built
|
|
323
321
|
* on: the `<input>`, its `<label>`, its help text and its message are rendered together in
|
|
324
|
-
* one shadow root, so
|
|
325
|
-
*
|
|
322
|
+
* one shadow root, so every IDREF resolves and nothing is left to wire from outside. The
|
|
323
|
+
* attributes below are the platform's own, and the ones it computes with —
|
|
326
324
|
* `type`, `pattern`, `min`, `max`, `step` — are handed to a real `<input>` that validates
|
|
327
325
|
* them itself.
|
|
328
326
|
*
|
package/dist/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuC,MAAM,KAAK,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,KAAK,GAAG,GAAG,CAAA;;;uBAGM,SAAS,CAAC,WAAW,CAAC;;;;;;;oBAOzB,SAAS,CAAC,YAAY,CAAC;;;;iBAI1B,SAAS,CAAC,iBAAiB,CAAC;;;;;;;;uBAQtB,SAAS,CAAC,WAAW,CAAC;iBAC5B,SAAS,CAAC,iBAAiB,CAAC;sBACvB,SAAS,CAAC,oBAAoB,CAAC;4BACzB,SAAS,CAAC,mBAAmB,CAAC;yBACjC,SAAS,CAAC,aAAa,CAAC;mBAC9B,SAAS,CAAC,YAAY,CAAC;;;;mCAIP,SAAS,CAAC,qBAAqB,CAAC;cACrD,SAAS,CAAC,mBAAmB,CAAC;;;;;iBAK3B,SAAS,CAAC,uBAAuB,CAAC;;;;;;;;;;;;;;;;wBAgB3B,SAAS,CAAC,iBAAiB,CAAC;;;;;;;6BAOvB,SAAS,CAAC,kBAAkB,CAAC;;;;;;;;;;;iBAWzC,SAAS,CAAC,uBAAuB,CAAC
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuC,MAAM,KAAK,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,KAAK,GAAG,GAAG,CA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CAAC;8BACb,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC;+BAC1B,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC;4BAC/B,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;4BACzB,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;uBAC9B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;4BACf,IAAI,CAAC,QAAQ;4BACb,IAAI,CAAC,QAAQ;4BACb,IAAI,CAAC,QAAQ;+BACV,IAAI,CAAC,OAAO,EAAE;mCACV,IAAI,CAAC,SAAS,EAAE;yBAC1B,IAAI,CAAC,KAAK;0BACT,IAAI,CAAC,OAAO;;SAE7B,CAAC,CAAC;IACP,CAAC;;AAGL,yFAAyF;AACzF,yFAAyF;AACzF,yFAAyF;AACzF,oEAAoE;AACpE,cAAc,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAE3C,0EAA0E;AAC1E,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC"}
|
package/dist/menu.js
CHANGED
|
@@ -4,8 +4,8 @@ import { reference } from './reference.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* The panel's id, and it needs no counter behind it.
|
|
6
6
|
*
|
|
7
|
-
* `src/tooltip.ts`
|
|
8
|
-
*
|
|
7
|
+
* `src/tooltip.ts` numbers its own, because the element it points at is the host's and
|
|
8
|
+
* shares the document's tree scope. Both ends of this reference are
|
|
9
9
|
* rendered here, so the id is scoped to one shadow root and two menus on a page cannot
|
|
10
10
|
* collide — which is the same property that lets `aria-controls` resolve at all.
|
|
11
11
|
*/
|
package/dist/radio.js
CHANGED
|
@@ -173,7 +173,7 @@ export class UiRadioGroup extends LitElement {
|
|
|
173
173
|
font-family: ${reference('--ui-font')};
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
/* The rhythm
|
|
176
|
+
/* The vertical rhythm between the label, the set and whatever is under it. */
|
|
177
177
|
.stack {
|
|
178
178
|
display: flex;
|
|
179
179
|
flex-direction: column;
|
package/dist/select.js
CHANGED
|
@@ -318,9 +318,9 @@ export class UiSelect extends LitElement {
|
|
|
318
318
|
border-color: ${reference('--ui-color-danger')};
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
/* The rhythm
|
|
322
|
-
|
|
323
|
-
|
|
321
|
+
/* The vertical rhythm, written out here rather than shared with src/input.ts for
|
|
322
|
+
the reason the docblock above gives about the box — and compared by
|
|
323
|
+
tests/select.test.ts on the same terms. */
|
|
324
324
|
.stack {
|
|
325
325
|
display: flex;
|
|
326
326
|
flex-direction: column;
|
package/dist/tokens.js
CHANGED
|
@@ -119,8 +119,8 @@ export const tokens = [
|
|
|
119
119
|
'--ui-elevation-100',
|
|
120
120
|
// The type scale, arriving with `ui-table` — the category `ROADMAP.md` said would, and
|
|
121
121
|
// the last one the v0 surface expects. It arrives to fix a defect rather than to
|
|
122
|
-
// anticipate one: `
|
|
123
|
-
//
|
|
122
|
+
// anticipate one: `font-size: 0.875em` was written out in three places across the form
|
|
123
|
+
// controls and `src/tooltip.ts`, all three agreeing and nothing comparing them — the shape
|
|
124
124
|
// `src/reference.ts` records finding in thirteen hand-copied fallbacks, and the thing
|
|
125
125
|
// `ARCHITECTURE.md` forbids in writing, since a hardcoded value is a decision a host
|
|
126
126
|
// cannot override.
|
|
@@ -221,7 +221,7 @@ export const defaults = {
|
|
|
221
221
|
// hue. Both clear **4.5:1** against the surface rather than the 3:1 a coloured edge
|
|
222
222
|
// would owe, because the floor a value has to clear is the strictest use it is put to
|
|
223
223
|
// and nothing stops a host using one as text — `--ui-color-danger` was chosen the same
|
|
224
|
-
// way and is text in
|
|
224
|
+
// way and is text in every control's message today.
|
|
225
225
|
//
|
|
226
226
|
// The warning is the same amber as `--ui-color-focus`, and the two arrived at it
|
|
227
227
|
// independently: both are *the darkest amber that clears its floor in both schemes*,
|
package/dist/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceR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ACF,4EAA4E;IAC5E,qFAAqF;IACrF,sFAAsF;IACtF,sFAAsF;IACtF,mFAAmF;IACnF,uBAAuB;IACvB,oBAAoB;IACpB,uFAAuF;IACvF,iFAAiF;IACjF,uFAAuF;IACvF,
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,mBAAmB;IACnB,4BAA4B;IAC5B,oBAAoB;IACpB,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,qFAAqF;IACrF,uFAAuF;IACvF,mFAAmF;IACnF,cAAc;IACd,EAAE;IACF,oFAAoF;IACpF,+EAA+E;IAC/E,6EAA6E;IAC7E,oBAAoB;IACpB,oBAAoB;IACpB,oFAAoF;IACpF,mFAAmF;IACnF,kFAAkF;IAClF,iFAAiF;IACjF,oFAAoF;IACpF,wEAAwE;IACxE,EAAE;IACF,iFAAiF;IACjF,oFAAoF;IACpF,iFAAiF;IACjF,qFAAqF;IACrF,+EAA+E;IAC/E,kBAAkB;IAClB,aAAa;IACb,YAAY;IACZ,WAAW;IACX,kFAAkF;IAClF,sFAAsF;IACtF,+CAA+C;IAC/C,EAAE;IACF,uFAAuF;IACvF,sFAAsF;IACtF,uFAAuF;IACvF,oFAAoF;IACpF,4CAA4C;IAC5C,mBAAmB;IACnB,mBAAmB;IACnB,qFAAqF;IACrF,oFAAoF;IACpF,sFAAsF;IACtF,qDAAqD;IACrD,EAAE;IACF,uFAAuF;IACvF,uFAAuF;IACvF,mFAAmF;IACnF,qEAAqE;IACrE,mBAAmB;IACnB,kBAAkB;IAClB,oFAAoF;IACpF,mFAAmF;IACnF,mFAAmF;IACnF,2BAA2B;IAC3B,EAAE;IACF,mFAAmF;IACnF,kFAAkF;IAClF,6EAA6E;IAC7E,EAAE;IACF,8EAA8E;IAC9E,sFAAsF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SAAS,GAAG,CAAC,GAAG,MAAM,EAAE,GAAG,aAAa,CAAC;SAC1C,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;SAC7C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,WAAW,CAAC;SACvC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEhB,OAAO;QACH,yCAAyC,OAAO,KAAK;QACrD,yDAAyD,SAAS,UAAU;KAC/E,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACnB,CAAC"}
|
package/dist/tooltip.d.ts
CHANGED
|
@@ -2,10 +2,9 @@ import { LitElement, type TemplateResult } from 'lit';
|
|
|
2
2
|
/**
|
|
3
3
|
* Supplementary text on hover and on keyboard focus.
|
|
4
4
|
*
|
|
5
|
-
* **Everything is slotted**,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* with no `slot`; the tip is `slot="tip"`.
|
|
5
|
+
* **Everything is slotted**, for a measured reason: an IDREF does not cross a shadow
|
|
6
|
+
* boundary, so a tip rendered in here could not be the target of the trigger's
|
|
7
|
+
* `aria-describedby`. The trigger is the child with no `slot`; the tip is `slot="tip"`.
|
|
9
8
|
*
|
|
10
9
|
* ## What the platform does, and what is left
|
|
11
10
|
*
|
package/dist/tooltip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../src/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAkBjE
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../src/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAkBjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,qBAAa,SAAU,SAAQ,UAAU;;IACrC,gBAAyB,MAAM,0BAkD7B;IA8EO,iBAAiB,IAAI,IAAI;IAqBzB,oBAAoB,IAAI,IAAI;IAU5B,MAAM,IAAI,cAAc;CAmNpC;AAQD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,YAAY,EAAE,SAAS,CAAC;KAC3B;CACJ"}
|
package/dist/tooltip.js
CHANGED
|
@@ -15,10 +15,9 @@ const focusable = 'a[href], button, input, select, textarea, [tabindex]';
|
|
|
15
15
|
/**
|
|
16
16
|
* Supplementary text on hover and on keyboard focus.
|
|
17
17
|
*
|
|
18
|
-
* **Everything is slotted**,
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* with no `slot`; the tip is `slot="tip"`.
|
|
18
|
+
* **Everything is slotted**, for a measured reason: an IDREF does not cross a shadow
|
|
19
|
+
* boundary, so a tip rendered in here could not be the target of the trigger's
|
|
20
|
+
* `aria-describedby`. The trigger is the child with no `slot`; the tip is `slot="tip"`.
|
|
22
21
|
*
|
|
23
22
|
* ## What the platform does, and what is left
|
|
24
23
|
*
|
|
@@ -125,6 +124,16 @@ export class UiTooltip extends LitElement {
|
|
|
125
124
|
`; }
|
|
126
125
|
/** Whether the tip is currently shown, which decides what the listeners cost. */
|
|
127
126
|
#shown = false;
|
|
127
|
+
/**
|
|
128
|
+
* Whether the reader dismissed the tip and has not left the trigger since.
|
|
129
|
+
*
|
|
130
|
+
* Separate from {@link UiTooltip.#shown}, because hidden and dismissed are not the same
|
|
131
|
+
* state and 1.4.13 only asks about the second. Without it a dismissal survives exactly
|
|
132
|
+
* as long as nothing moves focus — measured on `<ui-menu>`, where Escape closes the menu,
|
|
133
|
+
* the component restores focus to the trigger it rendered, and the tip came back in the
|
|
134
|
+
* same turn as the key that shut it. #169
|
|
135
|
+
*/
|
|
136
|
+
#dismissed = false;
|
|
128
137
|
/**
|
|
129
138
|
* What is watching while the tip is open, dropped in one call when it closes.
|
|
130
139
|
*
|
|
@@ -132,10 +141,9 @@ export class UiTooltip extends LitElement {
|
|
|
132
141
|
* per-frame: a page holding fifty tooltips would run fifty no-op scroll handlers for
|
|
133
142
|
* every frame of every scroll, and at most one tooltip is ever open.
|
|
134
143
|
*
|
|
135
|
-
* Built here rather than on the first show so it is never absent
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* never opened.
|
|
144
|
+
* Built here rather than on the first show so it is never absent: a close that has to
|
|
145
|
+
* ask whether the controller exists is a branch no test can reach, because nothing
|
|
146
|
+
* closes what was never opened.
|
|
139
147
|
*/
|
|
140
148
|
#watching = new AbortController();
|
|
141
149
|
/** Re-places the tip under anything that moves the trigger while it is open. */
|
|
@@ -148,11 +156,28 @@ export class UiTooltip extends LitElement {
|
|
|
148
156
|
* On the document rather than on this element: a tip shown by the pointer leaves the
|
|
149
157
|
* focus wherever it was, so a key listener bound here would never hear the key that is
|
|
150
158
|
* supposed to dismiss it.
|
|
159
|
+
*
|
|
160
|
+
* **The key is claimed when it dismissed something, and left alone when it did not.**
|
|
161
|
+
* One Escape reaches every layer at once: unclaimed, it shut the tip and closed the
|
|
162
|
+
* `<ui-dialog>` around it in the same press — and 1.4.13 wants a dismissal that does
|
|
163
|
+
* *not* move focus, where closing a modal returns focus to whatever opened it. Claiming
|
|
164
|
+
* it gives the reader the convention they already have, the topmost thing closing
|
|
165
|
+
* first, and the next press reaching the next layer down. **Nothing tests whether there
|
|
166
|
+
* was something to dismiss**, because this listener only exists while there is: it is
|
|
167
|
+
* added on show and dropped on hide, so an Escape with no tip open never reaches here.
|
|
168
|
+
*
|
|
169
|
+
* `preventDefault()` and nothing else: the close request is the key's default action,
|
|
170
|
+
* so cancelling it here is enough — measured, against both a modal `<dialog>` and a
|
|
171
|
+
* `popover="auto"`, from this listener's own bubble phase. `stopPropagation()` would
|
|
172
|
+
* add nothing at the document and would take the key from anything else listening.
|
|
151
173
|
*/
|
|
152
174
|
#dismiss = (event) => {
|
|
153
|
-
if (event.key
|
|
154
|
-
|
|
175
|
+
if (event.key !== 'Escape') {
|
|
176
|
+
return;
|
|
155
177
|
}
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
this.#dismissed = true;
|
|
180
|
+
this.#hide();
|
|
156
181
|
};
|
|
157
182
|
/**
|
|
158
183
|
* Takes every listener off at once, and the reason is not brevity.
|
|
@@ -213,10 +238,10 @@ export class UiTooltip extends LitElement {
|
|
|
213
238
|
* the element rather than mutating it — and a tip that is only wired the first time is
|
|
214
239
|
* one that stops being announced at a moment nothing reports.
|
|
215
240
|
*
|
|
216
|
-
* A `role` or an `id` the host wrote is never overwritten
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
241
|
+
* A `role` or an `id` the host wrote is never overwritten. `aria-describedby` is
|
|
242
|
+
* **added to** rather than replaced: the trigger may already be described by something
|
|
243
|
+
* this element cannot see, and a description that silently replaced another is the
|
|
244
|
+
* failure nobody sees.
|
|
220
245
|
*/
|
|
221
246
|
#associate = () => {
|
|
222
247
|
const trigger = this.#trigger();
|
|
@@ -227,8 +252,7 @@ export class UiTooltip extends LitElement {
|
|
|
227
252
|
if (tip.id === '') {
|
|
228
253
|
// Stryker disable next-line UpdateOperator: two tooltips on one page must get
|
|
229
254
|
// different ids, and a decrementing counter delivers that as well as an
|
|
230
|
-
// incrementing one. No input distinguishes them — an equivalent mutant
|
|
231
|
-
// same one `src/field.ts` carries beside its own counter.
|
|
255
|
+
// incrementing one. No input distinguishes them — an equivalent mutant.
|
|
232
256
|
tip.id = `ui-tooltip-${String(++sequence)}`;
|
|
233
257
|
}
|
|
234
258
|
if (!tip.hasAttribute('role')) {
|
|
@@ -263,8 +287,8 @@ export class UiTooltip extends LitElement {
|
|
|
263
287
|
}
|
|
264
288
|
console.warn(`<ui-tooltip> described <${trigger.localName}>, and the description will not ` +
|
|
265
289
|
`arrive: it focuses a control inside its own shadow root, which an id in ` +
|
|
266
|
-
`your tree cannot reach.
|
|
267
|
-
`
|
|
290
|
+
`your tree cannot reach. Where the text has to be announced, the trigger has ` +
|
|
291
|
+
`to be a control you wrote — a native <button>, <a href> or form control.`);
|
|
268
292
|
}
|
|
269
293
|
/**
|
|
270
294
|
* Shows on the pointer, except the pointer a touch screen reports.
|
|
@@ -281,13 +305,34 @@ export class UiTooltip extends LitElement {
|
|
|
281
305
|
#onFocus = () => {
|
|
282
306
|
this.#show();
|
|
283
307
|
};
|
|
284
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Closes when the reader really leaves, and only then.
|
|
310
|
+
*
|
|
311
|
+
* **A `focusout` here does not mean focus left.** It also fires when focus moves between
|
|
312
|
+
* two nodes inside this element that retarget differently — `<ui-menu>` opening its own
|
|
313
|
+
* slotted items is the case in this package — and treating that as a departure closed
|
|
314
|
+
* and reopened the tip on one keystroke. `relatedTarget` is where focus went, so a node
|
|
315
|
+
* this element still contains means nothing left. A `pointerleave` never fires with the
|
|
316
|
+
* pointer still inside, so the same guard is simply true there.
|
|
317
|
+
*
|
|
318
|
+
* A departure is also what clears the dismissal: 1.4.13 asks that dismissed content stay
|
|
319
|
+
* dismissed until the trigger is left, not until the next event of any kind.
|
|
320
|
+
*/
|
|
321
|
+
#onLeave = (event) => {
|
|
322
|
+
if (this.#holds(event.relatedTarget)) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
this.#dismissed = false;
|
|
285
326
|
this.#hide();
|
|
286
327
|
};
|
|
328
|
+
/** Whether a node focus or the pointer moved to is still inside this element. */
|
|
329
|
+
#holds(node) {
|
|
330
|
+
return node instanceof Node && this.contains(node);
|
|
331
|
+
}
|
|
287
332
|
/** Opens the tip and starts watching whatever can move its trigger. */
|
|
288
333
|
#show() {
|
|
289
334
|
const tip = this.#tip();
|
|
290
|
-
if (tip === undefined || this.#shown) {
|
|
335
|
+
if (tip === undefined || this.#shown || this.#dismissed) {
|
|
291
336
|
return;
|
|
292
337
|
}
|
|
293
338
|
this.#shown = true;
|
package/dist/tooltip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../src/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,+DAA+D;AAC/D,IAAI,QAAQ,GAAG,CAAC,CAAC;AAEjB,iFAAiF;AACjF,MAAM,IAAI,GAAG,WAAW,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,SAAS,GAAG,sDAAsD,CAAC;AAEzE
|
|
1
|
+
{"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../src/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,+DAA+D;AAC/D,IAAI,QAAQ,GAAG,CAAC,CAAC;AAEjB,iFAAiF;AACjF,MAAM,IAAI,GAAG,WAAW,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,SAAS,GAAG,sDAAsD,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,OAAO,SAAU,SAAQ,UAAU;aACZ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;oCAoBL,SAAS,CAAC,YAAY,CAAC;4BAC/B,SAAS,CAAC,YAAY,CAAC,SAAS,SAAS,CAAC,YAAY,CAAC;2BACxD,SAAS,CAAC,WAAW,CAAC;yBACxB,SAAS,CAAC,sBAAsB,CAAC;;;;qBAIrC,SAAS,CAAC,iBAAiB,CA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E,GAAG,CAAC,KAAK,CAAC,gBAAgB,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC;IACtE,CAAC;;AAGL,yFAAyF;AACzF,yFAAyF;AACzF,yFAAyF;AACzF,oEAAoE;AACpE,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rak200/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Host-agnostic custom-element UI components for the rak200 ecosystem",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "rak200 <rak.ricardo@windowslive.com>",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"fix": "prettier --write . && eslint --fix .",
|
|
44
44
|
"analyse": "tsc --noEmit && eslint .",
|
|
45
45
|
"test": "vitest run",
|
|
46
|
-
"coverage": "coverage-floor",
|
|
46
|
+
"coverage": "coverage-floor --drop-prefix src/icons/",
|
|
47
47
|
"scan": "rak200-scan",
|
|
48
|
-
"mutation": "
|
|
48
|
+
"mutation": "rak200-mutate --drop-prefix src/icons/",
|
|
49
49
|
"build": "tsc -p tsconfig.icons.json && tsc -p tsconfig.build.json",
|
|
50
50
|
"storybook": "storybook dev -p 6006",
|
|
51
51
|
"build-storybook": "storybook build"
|
|
@@ -54,12 +54,15 @@
|
|
|
54
54
|
"lit": "^3.3.3"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@rak200/coding-standard-ts": "github:rak200/coding-standard-ts#0.4.
|
|
57
|
+
"@rak200/coding-standard-ts": "github:rak200/coding-standard-ts#0.4.13",
|
|
58
58
|
"@storybook/addon-a11y": "^10.5.8",
|
|
59
59
|
"@storybook/web-components-vite": "^10.5.8",
|
|
60
60
|
"@types/node": "^26.1.2",
|
|
61
|
-
"@vitest/browser-playwright": "^4.
|
|
61
|
+
"@vitest/browser-playwright": "^4.0.0",
|
|
62
62
|
"axe-core": "^4.13.0",
|
|
63
63
|
"storybook": "^10.5.8"
|
|
64
|
+
},
|
|
65
|
+
"overrides": {
|
|
66
|
+
"vitest": "^4.1.10"
|
|
64
67
|
}
|
|
65
68
|
}
|
package/dist/field.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
-
/**
|
|
3
|
-
* Form plumbing: a label bound to a control, help and error text bound through
|
|
4
|
-
* `aria-describedby`, and `aria-invalid` while the field is in error.
|
|
5
|
-
*
|
|
6
|
-
* Written once here rather than per control that needs it, because copies of one wiring are
|
|
7
|
-
* copies of one chance to get it subtly wrong.
|
|
8
|
-
*
|
|
9
|
-
* **None of this package's own form controls are among them any more.** `<ui-checkbox>`,
|
|
10
|
-
* `<ui-switch>`, `<ui-input>`, `<ui-textarea>` and `<ui-select>` each render their label, their
|
|
11
|
-
* message and their `aria-invalid` beside the control, in one tree scope, so there is nothing
|
|
12
|
-
* scattered here to point at anything. What is left is a control the host wrote, and
|
|
13
|
-
* {@link UiRadioGroup}, which is named by reference rather than by containment.
|
|
14
|
-
*
|
|
15
|
-
* **Everything is slotted, and that is forced rather than chosen.** An ARIA relationship
|
|
16
|
-
* by IDREF does not cross a shadow boundary: a `<label for>` rendered in this element's
|
|
17
|
-
* shadow root leaves `control.labels` empty, and an `aria-describedby` pointing into it
|
|
18
|
-
* dangles. So the label, the control, the help and the error all live in the host's tree,
|
|
19
|
-
* where the association is the platform's job — and this element only generates the ids
|
|
20
|
-
* and points them at each other.
|
|
21
|
-
*
|
|
22
|
-
* **The control may sit below a wrapper**, and the same constraint is why: `<ui-input>` is
|
|
23
|
-
* a box around a control that had to stay in the light DOM, so this element looks through
|
|
24
|
-
* it. See {@link UiField.#control} — and the one wrapper it does *not* look through, which
|
|
25
|
-
* is a wrapper carrying a `role`, because a group is the control rather than a box for one.
|
|
26
|
-
*
|
|
27
|
-
* **Not every control can be labelled the platform's way**, and `<ui-radio-group>` is the
|
|
28
|
-
* first that cannot: `<label for>` reaches a labelable element and nothing else, so the
|
|
29
|
-
* name arrives as `aria-labelledby` there. See {@link UiField.#name}.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```html
|
|
33
|
-
* <ui-field>
|
|
34
|
-
* <label slot="label">Amount</label>
|
|
35
|
-
* <input type="number" />
|
|
36
|
-
* <span slot="help">In BRL, two decimals.</span>
|
|
37
|
-
* <span slot="error">Amount is required.</span>
|
|
38
|
-
* </ui-field>
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare class UiField extends LitElement {
|
|
42
|
-
#private;
|
|
43
|
-
static readonly styles: import("lit").CSSResult;
|
|
44
|
-
connectedCallback(): void;
|
|
45
|
-
disconnectedCallback(): void;
|
|
46
|
-
firstUpdated(): void;
|
|
47
|
-
render(): TemplateResult;
|
|
48
|
-
}
|
|
49
|
-
declare global {
|
|
50
|
-
interface HTMLElementTagNameMap {
|
|
51
|
-
'ui-field': UiField;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=field.d.ts.map
|
package/dist/field.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../src/field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAMjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,OAAQ,SAAQ,UAAU;;IACnC,gBAAyB,MAAM,0BAuB7B;IAeO,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAK5B,YAAY,IAAI,IAAI;IAIpB,MAAM,IAAI,cAAc;CAiLpC;AAQD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,UAAU,EAAE,OAAO,CAAC;KACvB;CACJ"}
|
package/dist/field.js
DELETED
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import { LitElement, css, html } from 'lit';
|
|
2
|
-
import { reference } from './reference.js';
|
|
3
|
-
/** Distinguishes one field's generated ids from another's. */
|
|
4
|
-
let sequence = 0;
|
|
5
|
-
/**
|
|
6
|
-
* Form plumbing: a label bound to a control, help and error text bound through
|
|
7
|
-
* `aria-describedby`, and `aria-invalid` while the field is in error.
|
|
8
|
-
*
|
|
9
|
-
* Written once here rather than per control that needs it, because copies of one wiring are
|
|
10
|
-
* copies of one chance to get it subtly wrong.
|
|
11
|
-
*
|
|
12
|
-
* **None of this package's own form controls are among them any more.** `<ui-checkbox>`,
|
|
13
|
-
* `<ui-switch>`, `<ui-input>`, `<ui-textarea>` and `<ui-select>` each render their label, their
|
|
14
|
-
* message and their `aria-invalid` beside the control, in one tree scope, so there is nothing
|
|
15
|
-
* scattered here to point at anything. What is left is a control the host wrote, and
|
|
16
|
-
* {@link UiRadioGroup}, which is named by reference rather than by containment.
|
|
17
|
-
*
|
|
18
|
-
* **Everything is slotted, and that is forced rather than chosen.** An ARIA relationship
|
|
19
|
-
* by IDREF does not cross a shadow boundary: a `<label for>` rendered in this element's
|
|
20
|
-
* shadow root leaves `control.labels` empty, and an `aria-describedby` pointing into it
|
|
21
|
-
* dangles. So the label, the control, the help and the error all live in the host's tree,
|
|
22
|
-
* where the association is the platform's job — and this element only generates the ids
|
|
23
|
-
* and points them at each other.
|
|
24
|
-
*
|
|
25
|
-
* **The control may sit below a wrapper**, and the same constraint is why: `<ui-input>` is
|
|
26
|
-
* a box around a control that had to stay in the light DOM, so this element looks through
|
|
27
|
-
* it. See {@link UiField.#control} — and the one wrapper it does *not* look through, which
|
|
28
|
-
* is a wrapper carrying a `role`, because a group is the control rather than a box for one.
|
|
29
|
-
*
|
|
30
|
-
* **Not every control can be labelled the platform's way**, and `<ui-radio-group>` is the
|
|
31
|
-
* first that cannot: `<label for>` reaches a labelable element and nothing else, so the
|
|
32
|
-
* name arrives as `aria-labelledby` there. See {@link UiField.#name}.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```html
|
|
36
|
-
* <ui-field>
|
|
37
|
-
* <label slot="label">Amount</label>
|
|
38
|
-
* <input type="number" />
|
|
39
|
-
* <span slot="help">In BRL, two decimals.</span>
|
|
40
|
-
* <span slot="error">Amount is required.</span>
|
|
41
|
-
* </ui-field>
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export class UiField extends LitElement {
|
|
45
|
-
static { this.styles = css `
|
|
46
|
-
:host {
|
|
47
|
-
display: block;
|
|
48
|
-
font-family: ${reference('--ui-font')};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.stack {
|
|
52
|
-
display: flex;
|
|
53
|
-
flex-direction: column;
|
|
54
|
-
gap: calc(${reference('--ui-space')} / 2);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
slot[name='help']::slotted(*) {
|
|
58
|
-
color: ${reference('--ui-color-text')};
|
|
59
|
-
font-size: ${reference('--ui-text-supporting')};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/* Colour is not the only cue — the error text says what is wrong, and
|
|
63
|
-
aria-invalid marks the control regardless of styling. */
|
|
64
|
-
slot[name='error']::slotted(*) {
|
|
65
|
-
color: ${reference('--ui-color-danger')};
|
|
66
|
-
font-size: ${reference('--ui-text-supporting')};
|
|
67
|
-
}
|
|
68
|
-
`; }
|
|
69
|
-
/** The prefix for this instance's generated ids, allocated on first association. */
|
|
70
|
-
#uid;
|
|
71
|
-
/**
|
|
72
|
-
* Watches the light DOM for anything that changes the association.
|
|
73
|
-
*
|
|
74
|
-
* Built here rather than on connection so it is never absent: a disconnect that has to
|
|
75
|
-
* ask whether the observer exists is a branch no test can reach.
|
|
76
|
-
*/
|
|
77
|
-
#observer = new MutationObserver(() => {
|
|
78
|
-
this.#associate();
|
|
79
|
-
});
|
|
80
|
-
connectedCallback() {
|
|
81
|
-
super.connectedCallback();
|
|
82
|
-
// The host may swap the error text without adding or removing an element, which is
|
|
83
|
-
// what a re-render looks like from here — so characterData matters as much as
|
|
84
|
-
// childList, and both can happen below a wrapper.
|
|
85
|
-
this.#observer.observe(this, { childList: true, characterData: true, subtree: true });
|
|
86
|
-
}
|
|
87
|
-
disconnectedCallback() {
|
|
88
|
-
this.#observer.disconnect();
|
|
89
|
-
super.disconnectedCallback();
|
|
90
|
-
}
|
|
91
|
-
firstUpdated() {
|
|
92
|
-
this.#associate();
|
|
93
|
-
}
|
|
94
|
-
render() {
|
|
95
|
-
return html `
|
|
96
|
-
<div class="stack" part="stack">
|
|
97
|
-
<slot name="label"></slot>
|
|
98
|
-
<slot></slot>
|
|
99
|
-
<slot name="help"></slot>
|
|
100
|
-
<slot name="error"></slot>
|
|
101
|
-
</div>
|
|
102
|
-
`;
|
|
103
|
-
}
|
|
104
|
-
/** The light-DOM child filling a slot, or `undefined` when nothing does. */
|
|
105
|
-
#slotted(name) {
|
|
106
|
-
const selector = name === null ? ':scope > :not([slot])' : `:scope > [slot='${name}']`;
|
|
107
|
-
const found = this.querySelector(selector);
|
|
108
|
-
return found instanceof HTMLElement ? found : undefined;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* The control this field is about, which a wrapper may stand in front of.
|
|
112
|
-
*
|
|
113
|
-
* A host who boxes their control in an element of their own — a layout `<div>`, a
|
|
114
|
-
* widget from somewhere else — leaves the label pointing at the box rather than at the
|
|
115
|
-
* thing the browser focuses, and a `<label for>` aimed at anything that is not labelable
|
|
116
|
-
* names nothing, which axe reports at critical impact.
|
|
117
|
-
*
|
|
118
|
-
* A control written as a direct child matches nothing to descend into and is returned
|
|
119
|
-
* as it is.
|
|
120
|
-
*/
|
|
121
|
-
#control() {
|
|
122
|
-
const slotted = this.#slotted(null);
|
|
123
|
-
// A slotted element carrying a `role` is claiming to *be* the widget rather than to
|
|
124
|
-
// box one, and the descent stops there. `role="radiogroup"` is the case that shows
|
|
125
|
-
// why: the thing to name is the group, and looking through it would reach the first
|
|
126
|
-
// radio, naming one option and leaving the group anonymous.
|
|
127
|
-
if (slotted?.hasAttribute('role') === true) {
|
|
128
|
-
return slotted;
|
|
129
|
-
}
|
|
130
|
-
return slotted?.querySelector('input, textarea, select') ?? slotted;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Points the label, the help and the error at the control.
|
|
134
|
-
*
|
|
135
|
-
* A host-supplied `id` is never overwritten — it may already be referenced by something
|
|
136
|
-
* this element cannot see.
|
|
137
|
-
*/
|
|
138
|
-
#associate() {
|
|
139
|
-
const control = this.#control();
|
|
140
|
-
if (control === undefined) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
// Stryker disable next-line UpdateOperator: the contract is that two fields on one
|
|
144
|
-
// page get different ids, and a decrementing counter delivers that as well as an
|
|
145
|
-
// incrementing one — `ui-field--1` is as valid an id as `ui-field-1`. No input
|
|
146
|
-
// distinguishes the two, so this is an equivalent mutant rather than a weak test.
|
|
147
|
-
const uid = (this.#uid ??= `ui-field-${String(++sequence)}`);
|
|
148
|
-
if (control.id === '') {
|
|
149
|
-
control.id = `${uid}-control`;
|
|
150
|
-
}
|
|
151
|
-
this.#name(control, this.#slotted('label'), `${uid}-label`);
|
|
152
|
-
const help = this.#describer(this.#slotted('help'), `${uid}-help`);
|
|
153
|
-
const error = this.#describer(this.#slotted('error'), `${uid}-error`);
|
|
154
|
-
// The error comes first: a screen reader announces descriptions in order, and the
|
|
155
|
-
// user needs to know what is wrong before reading how the value should look.
|
|
156
|
-
//
|
|
157
|
-
// The error SUPPLEMENTS the help rather than replacing it. Help text is usually the
|
|
158
|
-
// format requirement, which is exactly the error suggestion the user needs in order
|
|
159
|
-
// to recover (WCAG 3.3.3) — dropping it at the moment it becomes useful is the
|
|
160
|
-
// opposite of helping.
|
|
161
|
-
//
|
|
162
|
-
// And a description this field did not write survives all of it, which is the same
|
|
163
|
-
// courtesy the `id` above gets and for the same reason: something this element
|
|
164
|
-
// cannot see may have put it there. `<ui-tooltip>` is the first to do so, and it
|
|
165
|
-
// was measured being erased — not on the first association, which runs before the
|
|
166
|
-
// tooltip wires, but on the next one, when a re-render moves the help text and the
|
|
167
|
-
// list is rebuilt from what this field alone knows about.
|
|
168
|
-
const described = [error, help, ...this.#foreign(control, uid, [error, help])].filter((id) => id !== undefined);
|
|
169
|
-
if (described.length > 0) {
|
|
170
|
-
control.setAttribute('aria-describedby', described.join(' '));
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
control.removeAttribute('aria-describedby');
|
|
174
|
-
}
|
|
175
|
-
if (error === undefined) {
|
|
176
|
-
control.removeAttribute('aria-invalid');
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
control.setAttribute('aria-invalid', 'true');
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* The ids already describing `control` that this field is not responsible for.
|
|
184
|
-
*
|
|
185
|
-
* Everything it could have written is excluded rather than remembered: the two ids it
|
|
186
|
-
* generates from `uid`, and whatever the help and error elements are called right now,
|
|
187
|
-
* which may be ids the host supplied. What is left belongs to somebody else and is
|
|
188
|
-
* carried forward in place rather than dropped.
|
|
189
|
-
*/
|
|
190
|
-
#foreign(control, uid, mine) {
|
|
191
|
-
const written = new Set([...mine, `${uid}-help`, `${uid}-error`]);
|
|
192
|
-
return (control.getAttribute('aria-describedby') ?? '')
|
|
193
|
-
.split(' ')
|
|
194
|
-
.filter((id) => id !== '' && !written.has(id));
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Gives the control its accessible name from whatever fills the label slot.
|
|
198
|
-
*
|
|
199
|
-
* **`<label for>` is preferred wherever it reaches**, because it is the platform's own
|
|
200
|
-
* association and it does two things `aria-labelledby` does not: it names the control
|
|
201
|
-
* and it makes the label a click target for it. It only reaches a **labelable**
|
|
202
|
-
* element, though, and an element carrying a role is not one — a `<label for>` aimed at
|
|
203
|
-
* a custom element labels nothing, which axe reports at critical impact.
|
|
204
|
-
*
|
|
205
|
-
* Which elements are labelable is asked of the platform rather than listed here: those
|
|
206
|
-
* are exactly the ones it gives a `labels` collection to. A list kept in this file
|
|
207
|
-
* would be one the next labelable element ages out of, silently.
|
|
208
|
-
*
|
|
209
|
-
* The name is dropped when the slot empties, the way `aria-describedby` is: a group
|
|
210
|
-
* left pointing at a label that is no longer there has a dangling IDREF, which is the
|
|
211
|
-
* one failure mode nobody sees — the group simply stops having a name.
|
|
212
|
-
*
|
|
213
|
-
* @param fallbackId - Given to the label only on the path that needs one to point at.
|
|
214
|
-
* A host-supplied id survives, the same way the control's and the describers' do.
|
|
215
|
-
*/
|
|
216
|
-
#name(control, label, fallbackId) {
|
|
217
|
-
if ('labels' in control) {
|
|
218
|
-
if (label instanceof HTMLLabelElement) {
|
|
219
|
-
label.htmlFor = control.id;
|
|
220
|
-
}
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (label === undefined) {
|
|
224
|
-
control.removeAttribute('aria-labelledby');
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
if (label.id === '') {
|
|
228
|
-
label.id = fallbackId;
|
|
229
|
-
}
|
|
230
|
-
control.setAttribute('aria-labelledby', label.id);
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* The id to describe the control by, or `undefined` when the element is absent or has
|
|
234
|
-
* nothing to say. An element rendered empty — the shape a framework produces for
|
|
235
|
-
* "no error yet" — must not mark the control invalid.
|
|
236
|
-
*/
|
|
237
|
-
#describer(element, fallbackId) {
|
|
238
|
-
if (element === undefined || element.textContent.trim() === '') {
|
|
239
|
-
return undefined;
|
|
240
|
-
}
|
|
241
|
-
if (element.id === '') {
|
|
242
|
-
element.id = fallbackId;
|
|
243
|
-
}
|
|
244
|
-
return element.id;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
// Stryker disable next-line StringLiteral: the registration runs once, at import, inside
|
|
248
|
-
// the warm process Stryker switches mutants in — so by the time a mutant on this line is
|
|
249
|
-
// active the element is already defined under the original name, and no test can observe
|
|
250
|
-
// the change. Outside the runner's reach, not an equivalent mutant.
|
|
251
|
-
customElements.define('ui-field', UiField);
|
|
252
|
-
//# sourceMappingURL=field.js.map
|
package/dist/field.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sourceRoot":"","sources":["../src/field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,8DAA8D;AAC9D,IAAI,QAAQ,GAAG,CAAC,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,OAAO,OAAQ,SAAQ,UAAU;aACV,WAAM,GAAG,GAAG,CAAA;;;2BAGd,SAAS,CAAC,WAAW,CAAC;;;;;;wBAMzB,SAAS,CAAC,YAAY,CAAC;;;;qBAI1B,SAAS,CAAC,iBAAiB,CAAC;yBACxB,SAAS,CAAC,sBAAsB,CAAC;;;;;;qBAMrC,SAAS,CAAC,mBAAmB,CAAC;yBAC1B,SAAS,CAAC,sBAAsB,CAAC;;KAErD,CAAC;IAEF,oFAAoF;IACpF,IAAI,CAAU;IAEd;;;;;OAKG;IACM,SAAS,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE;QAC3C,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC;IAEM,iBAAiB;QACtB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,mFAAmF;QACnF,8EAA8E;QAC9E,kDAAkD;QAClD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1F,CAAC;IAEQ,oBAAoB;QACzB,IAAI,C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