@gridkitjs/forms-dom 0.0.0-dev-20261206115313 → 0.0.0-dev-20261206150419

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AbortFactory, TypeaheadRow, DisabledOptions, PopupOpenReason, PopupCloseReason, FieldController, FormsMessages, WritingDirection, VisibleRange, Schedule, StepDirection, StepSize, SegmentContext, SegmentState } from '@gridkitjs/forms-core';
1
+ import { AbortFactory, FieldController, TypeaheadRow, DisabledOptions, PopupOpenReason, PopupCloseReason, FormsMessages, WritingDirection, VisibleRange, Schedule, StepDirection, StepSize, SegmentContext, SegmentState } from '@gridkitjs/forms-core';
2
2
 
3
3
  /**
4
4
  * The browser's `AbortController` as a forms-core `AbortFactory`: each call
@@ -78,6 +78,66 @@ interface AttachedFocusGroup {
78
78
  */
79
79
  declare function attachFocusGroup(root: HTMLElement, initialOptions: FocusGroupOptions): AttachedFocusGroup;
80
80
 
81
+ interface RovingFocusOptions {
82
+ /** The selector of the stops inside the root. A disabled one is passed over. */
83
+ readonly items: string;
84
+ /** Which arrow keys move: ← and → (mirrored right to left), ↑ and ↓, or all four. */
85
+ readonly orientation: "horizontal" | "vertical" | "both";
86
+ /** Whether a move past the last stop lands on the first, and back. */
87
+ readonly wrap: boolean;
88
+ /**
89
+ * Whether the root is one tab stop: the stop focus was last on holds
90
+ * `tabindex="0"`, the others `-1`. False leaves every stop at `-1`, for
91
+ * stops reached from another control (a combobox's chips). Default true.
92
+ */
93
+ readonly tabStop?: boolean | undefined;
94
+ /** A key moved focus to `item`: radio behaviour selects it here. */
95
+ readonly onMove?: ((item: HTMLElement, nativeEvent: KeyboardEvent) => void) | undefined;
96
+ /**
97
+ * A key it does not take on the stop holding focus: one with no move, or
98
+ * a move past an end without `wrap` (→ past the last chip returns to the
99
+ * combobox).
100
+ */
101
+ readonly onKey?: ((item: HTMLElement, nativeEvent: KeyboardEvent) => void) | undefined;
102
+ }
103
+ interface AttachedRovingFocus {
104
+ /** Replaces the options, from the next key on. */
105
+ readonly setOptions: (options: RovingFocusOptions) => void;
106
+ /** Focuses `item`, one of the stops, making it the tab stop. */
107
+ readonly focusItem: (item: HTMLElement) => void;
108
+ /** Removes the listeners and the observer; the stops keep their `tabindex`. */
109
+ readonly detach: () => void;
110
+ }
111
+ /**
112
+ * Makes the stops inside `root` (a toolbar's buttons, a list of chips) one
113
+ * group the arrow keys move focus through, as the WAI-ARIA roving
114
+ * `tabindex` pattern does: the arrows of `orientation` move to the
115
+ * previous or next stop, Home and End to the first and last, each taking
116
+ * focus and, with `tabStop`, `tabindex="0"`. Stops come and go as the page
117
+ * changes; an observer keeps one of them the tab stop.
118
+ *
119
+ * It holds its listeners on the root, the observer and the stop focus was
120
+ * last on; `detach` releases them.
121
+ */
122
+ declare function attachRovingFocus(root: HTMLElement, initialOptions: RovingFocusOptions): AttachedRovingFocus;
123
+
124
+ /** What `attachValidityCarrier` reads of the field. */
125
+ type ValidityController = Pick<FieldController<unknown>, "getMessages" | "subscribe">;
126
+ interface AttachedValidityCarrier {
127
+ /** Removes the listeners and clears the carrier's custom validity. */
128
+ readonly detach: () => void;
129
+ }
130
+ /**
131
+ * Makes `carrier`, a visually hidden `<input>` the renderer drew beside a
132
+ * control that cannot take constraint validation (a `<button
133
+ * role="combobox">`), hold the field's first error as its custom
134
+ * validity, shown or not yet, so a plain `<form>` refuses to submit. The
135
+ * browser, or a form, focusing the carrier to report it moves focus on to
136
+ * `control`. The renderer gives the carrier no `name`, `tabindex="-1"`
137
+ * and `aria-hidden="true"`, so it is neither submitted nor reached.
138
+ */
139
+ declare function attachValidityCarrier(carrier: HTMLInputElement, control: HTMLElement, controller: ValidityController): AttachedValidityCarrier;
140
+
81
141
  /**
82
142
  * The first control of `form`, in document order, that holds an invalid
83
143
  * value: a field showing an error, which forms sets as the control's
@@ -130,6 +190,37 @@ interface AttachedFitCount {
130
190
  */
131
191
  declare function attachFitCount(root: HTMLElement, { max, onCount }: FitCountOptions): AttachedFitCount;
132
192
 
193
+ interface OverflowCountOptions {
194
+ /** The selector of the items counted, inside the container: the chips. */
195
+ readonly items: string;
196
+ /**
197
+ * The selector of the element kept at the end of the line when not every
198
+ * item fits ("+3"), inside the container; its width is kept free.
199
+ * `null` for none.
200
+ */
201
+ readonly reserve: string | null;
202
+ /** Called with how many items fit on the line now, and again whenever that changes. */
203
+ readonly onCount: (count: number) => void;
204
+ }
205
+ interface AttachedOverflowCount {
206
+ /** Stops watching. */
207
+ readonly detach: () => void;
208
+ }
209
+ /**
210
+ * Counts how many of the items in `container`, in order, fit on its one
211
+ * line with its column gap between them: every one when all fit, else as
212
+ * many as leave room for the reserve element after them. What chips show
213
+ * before "+3 more". It measures every item, so the renderer keeps the ones
214
+ * it hides in the page and out of the line (`position: absolute` and
215
+ * `visibility: hidden`), at their own width.
216
+ *
217
+ * It recounts whenever the container, an item or the reserve changes
218
+ * width (a `ResizeObserver`) and as items come and go (a
219
+ * `MutationObserver`), and calls `onCount` only when the count changes.
220
+ * It holds both observers and the last count; `detach` disconnects them.
221
+ */
222
+ declare function attachOverflowCount(container: HTMLElement, { items, reserve, onCount }: OverflowCountOptions): AttachedOverflowCount;
223
+
133
224
  interface ChecklistOptions {
134
225
  /**
135
226
  * The item at `index` — its place in the whole list — asks to be checked
@@ -355,6 +446,18 @@ interface ComboboxOptions {
355
446
  * a select-only button, whose keys all go to the list.
356
447
  */
357
448
  readonly editable: boolean;
449
+ /**
450
+ * Whether the combobox calls the controller's `focus`, `blur`,
451
+ * `commit` and `revert` itself: a control no text pipeline drives, as a
452
+ * select-only button, or a search box whose text is only a query (a select
453
+ * with several values, whose chips hold its value). Default `!editable`.
454
+ */
455
+ readonly drivesField?: boolean | undefined;
456
+ /**
457
+ * Focus moving to an element this accepts stays in the field (a chip's
458
+ * remove button): the popup closes, but the field is not left.
459
+ */
460
+ readonly isInside?: ((element: Element) => boolean) | undefined;
358
461
  /** Several values: Shift with the arrows and Ctrl+A reach a select-only list. */
359
462
  readonly multiple: boolean;
360
463
  /** Tab with the popup open chooses the active row, with one value. */
@@ -399,7 +502,10 @@ interface AttachedCombobox {
399
502
  * `attachTextInput` sees it and skips it.
400
503
  * - A select-only control calls the controller's `focus` and `blur`,
401
504
  * commits on Tab (staying when the commit is refused), and reverts on
402
- * Escape while closed. A text box leaves those to `attachTextInput`.
505
+ * Escape while closed; so does a search box with `drivesField`, which
506
+ * also commits on Enter while closed. Another text box leaves those to
507
+ * `attachTextInput`. Focus moving to an element `isInside` accepts
508
+ * closes the popup without leaving the field.
403
509
  * - It prevents `mousedown` on the panel, which keeps focus in the control
404
510
  * and still lets the click through (WebKit sends no click after a tap
405
511
  * whose `pointerdown` was prevented).
@@ -878,6 +984,12 @@ interface TextInputOptions {
878
984
  interface AttachedTextInput {
879
985
  /** Replaces the options, from the next event on. */
880
986
  readonly setOptions: (options: TextInputOptions) => void;
987
+ /**
988
+ * Writes the controller's text into the control again: for text that
989
+ * changed while the field did not, such as a choice's label arriving
990
+ * after its key. Never while an input method composes.
991
+ */
992
+ readonly refresh: () => void;
881
993
  /**
882
994
  * Removes every listener and clears the control's custom validity. The
883
995
  * controller is left as it is, so another control can be attached to it.
@@ -1067,4 +1179,4 @@ declare function attachSegments<V, D extends object>(group: HTMLElement, control
1067
1179
  */
1068
1180
  declare function writingDirection(element: Element): WritingDirection;
1069
1181
 
1070
- export { type AttachedAutoGrow, type AttachedChecklist, type AttachedCombobox, type AttachedFitCount, type AttachedFocusGroup, type AttachedHoldRepeat, type AttachedListbox, type AttachedSegments, type AttachedStepKeys, type AttachedTextInput, type AttachedToggle, type AutoGrowOptions, type ChecklistOptions, type ChoiceAnnouncer, type ChoiceAnnouncerOptions, type ComboboxController, type ComboboxOptions, type FitCountOptions, type FocusGroupOptions, type HoldRepeatOptions, type HoldRepeatState, type ListboxActivation, type ListboxAlign, type ListboxChoice, type ListboxFocus, type ListboxOptions, type ListboxRow, type LiveAnnouncer, type LiveAnnouncerOptions, type OverlayAlign, type OverlayAnchor, type OverlayDismissReason, type OverlayInitialFocus, type OverlayOptions, type OverlayPlacement, type OverlayPlacementOptions, type OverlayPosition, type OverlayRect, type OverlaySide, type OverlaySize, type RowVirtualizer, type RowVirtualizerOptions, type SegmentsController, type SegmentsOptions, type StepKeysOptions, type TextControl, type TextInputController, type TextInputOptions, type ToggleOptions, abortSignals, attachAutoGrow, attachChecklist, attachCombobox, attachEnterNavigation, attachFitCount, attachFocusGroup, attachHoldRepeat, attachListbox, attachOverlay, attachSegments, attachStepKeys, attachTextInput, attachToggle, compareDocumentOrder, createChoiceAnnouncer, createLiveAnnouncer, createRowVirtualizer, findFirstInvalidControl, focusTargetIn, placeOverlay, scheduleTimeout, writingDirection };
1182
+ export { type AttachedAutoGrow, type AttachedChecklist, type AttachedCombobox, type AttachedFitCount, type AttachedFocusGroup, type AttachedHoldRepeat, type AttachedListbox, type AttachedOverflowCount, type AttachedRovingFocus, type AttachedSegments, type AttachedStepKeys, type AttachedTextInput, type AttachedToggle, type AttachedValidityCarrier, type AutoGrowOptions, type ChecklistOptions, type ChoiceAnnouncer, type ChoiceAnnouncerOptions, type ComboboxController, type ComboboxOptions, type FitCountOptions, type FocusGroupOptions, type HoldRepeatOptions, type HoldRepeatState, type ListboxActivation, type ListboxAlign, type ListboxChoice, type ListboxFocus, type ListboxOptions, type ListboxRow, type LiveAnnouncer, type LiveAnnouncerOptions, type OverflowCountOptions, type OverlayAlign, type OverlayAnchor, type OverlayDismissReason, type OverlayInitialFocus, type OverlayOptions, type OverlayPlacement, type OverlayPlacementOptions, type OverlayPosition, type OverlayRect, type OverlaySide, type OverlaySize, type RovingFocusOptions, type RowVirtualizer, type RowVirtualizerOptions, type SegmentsController, type SegmentsOptions, type StepKeysOptions, type TextControl, type TextInputController, type TextInputOptions, type ToggleOptions, type ValidityController, abortSignals, attachAutoGrow, attachChecklist, attachCombobox, attachEnterNavigation, attachFitCount, attachFocusGroup, attachHoldRepeat, attachListbox, attachOverflowCount, attachOverlay, attachRovingFocus, attachSegments, attachStepKeys, attachTextInput, attachToggle, attachValidityCarrier, compareDocumentOrder, createChoiceAnnouncer, createLiveAnnouncer, createRowVirtualizer, findFirstInvalidControl, focusTargetIn, placeOverlay, scheduleTimeout, writingDirection };
package/dist/index.js CHANGED
@@ -119,6 +119,160 @@ function attachFocusGroup(root, initialOptions) {
119
119
  };
120
120
  }
121
121
 
122
+ // src/writingDirection.ts
123
+ function writingDirection(element) {
124
+ return getComputedStyle(element).direction === "rtl" ? "rtl" : "ltr";
125
+ }
126
+
127
+ // src/form/attachRovingFocus.ts
128
+ function attachRovingFocus(root, initialOptions) {
129
+ let options = initialOptions;
130
+ let current = null;
131
+ const events = new AbortController();
132
+ const { signal } = events;
133
+ function stops() {
134
+ return Array.from(root.querySelectorAll(options.items)).filter(
135
+ (item) => !item.matches(":disabled")
136
+ );
137
+ }
138
+ function stopOf(target2) {
139
+ if (!(target2 instanceof Element)) {
140
+ return null;
141
+ }
142
+ const item = target2.closest(options.items);
143
+ return item !== null && root.contains(item) ? item : null;
144
+ }
145
+ function setTabStops() {
146
+ const all = stops();
147
+ if (current !== null && !all.includes(current)) {
148
+ current = null;
149
+ }
150
+ const stop = options.tabStop === false ? null : current ?? all[0];
151
+ for (const item of all) {
152
+ item.tabIndex = item === stop ? 0 : -1;
153
+ }
154
+ }
155
+ function focusItem(item) {
156
+ current = item;
157
+ setTabStops();
158
+ item.focus();
159
+ }
160
+ function stepOf(event) {
161
+ const { orientation } = options;
162
+ const across = orientation !== "vertical";
163
+ const down = orientation !== "horizontal";
164
+ const rtl = writingDirection(root) === "rtl";
165
+ switch (event.key) {
166
+ case "ArrowLeft":
167
+ return across ? rtl ? "next" : "previous" : null;
168
+ case "ArrowRight":
169
+ return across ? rtl ? "previous" : "next" : null;
170
+ case "ArrowUp":
171
+ return down ? "previous" : null;
172
+ case "ArrowDown":
173
+ return down ? "next" : null;
174
+ case "Home":
175
+ return "first";
176
+ case "End":
177
+ return "last";
178
+ default:
179
+ return null;
180
+ }
181
+ }
182
+ function target(all, from, step) {
183
+ switch (step) {
184
+ case "first":
185
+ return all[0];
186
+ case "last":
187
+ return all.at(-1);
188
+ case "previous":
189
+ return from > 0 ? all[from - 1] : options.wrap ? all.at(-1) : void 0;
190
+ case "next":
191
+ return from < all.length - 1 ? all[from + 1] : options.wrap ? all[0] : void 0;
192
+ }
193
+ }
194
+ function onKeyDown(event) {
195
+ const item = stopOf(event.target);
196
+ if (item === null || event.defaultPrevented) {
197
+ return;
198
+ }
199
+ const modified = event.ctrlKey || event.metaKey || event.altKey;
200
+ const step = modified ? null : stepOf(event);
201
+ const all = stops();
202
+ const next = step === null ? void 0 : target(all, all.indexOf(item), step);
203
+ if (next === void 0) {
204
+ options.onKey?.(item, event);
205
+ return;
206
+ }
207
+ event.preventDefault();
208
+ if (next !== item) {
209
+ focusItem(next);
210
+ options.onMove?.(next, event);
211
+ }
212
+ }
213
+ function onFocusIn(event) {
214
+ const item = stopOf(event.target);
215
+ if (item !== null && item !== current) {
216
+ current = item;
217
+ setTabStops();
218
+ }
219
+ }
220
+ const observer = new MutationObserver(setTabStops);
221
+ observer.observe(root, { childList: true, subtree: true });
222
+ root.addEventListener("keydown", onKeyDown, { signal });
223
+ root.addEventListener("focusin", onFocusIn, { signal });
224
+ setTabStops();
225
+ return {
226
+ setOptions(next) {
227
+ options = next;
228
+ setTabStops();
229
+ },
230
+ focusItem,
231
+ detach() {
232
+ events.abort();
233
+ observer.disconnect();
234
+ current = null;
235
+ }
236
+ };
237
+ }
238
+
239
+ // src/form/attachValidityCarrier.ts
240
+ function firstErrorText(messages) {
241
+ return messages.find((message) => message.severity === "error")?.text ?? "";
242
+ }
243
+ function attachValidityCarrier(carrier, control, controller) {
244
+ let customValidity = "";
245
+ const events = new AbortController();
246
+ function render() {
247
+ const validity = firstErrorText(controller.getMessages());
248
+ if (validity !== customValidity) {
249
+ customValidity = validity;
250
+ carrier.setCustomValidity(validity);
251
+ }
252
+ }
253
+ carrier.addEventListener(
254
+ "focus",
255
+ () => {
256
+ control.focus();
257
+ },
258
+ { signal: events.signal }
259
+ );
260
+ const unsubscribe = controller.subscribe(render);
261
+ render();
262
+ let attached = true;
263
+ return {
264
+ detach() {
265
+ if (!attached) {
266
+ return;
267
+ }
268
+ attached = false;
269
+ events.abort();
270
+ unsubscribe();
271
+ carrier.setCustomValidity("");
272
+ }
273
+ };
274
+ }
275
+
122
276
  // src/form/formControls.ts
123
277
  var ENTER_MOVES_FROM = /* @__PURE__ */ new Set([
124
278
  "text",
@@ -224,6 +378,82 @@ function attachFitCount(root, { max, onCount }) {
224
378
  };
225
379
  }
226
380
 
381
+ // src/layout/attachOverflowCount.ts
382
+ function pixels2(value) {
383
+ const parsed = Number.parseFloat(value);
384
+ return Number.isNaN(parsed) ? 0 : parsed;
385
+ }
386
+ function attachOverflowCount(container, { items, reserve, onCount }) {
387
+ let count = null;
388
+ const watched = /* @__PURE__ */ new Set();
389
+ function measure() {
390
+ const style = getComputedStyle(container);
391
+ const gap = pixels2(style.columnGap);
392
+ const room = container.clientWidth - pixels2(style.paddingInlineStart) - pixels2(style.paddingInlineEnd);
393
+ const widths = Array.from(
394
+ container.querySelectorAll(items),
395
+ (item) => item.getBoundingClientRect().width
396
+ );
397
+ const all = widths.reduce(
398
+ (sum, width, index) => sum + width + (index > 0 ? gap : 0),
399
+ 0
400
+ );
401
+ let next = widths.length;
402
+ if (all > room) {
403
+ const kept = reserve === null ? null : container.querySelector(reserve);
404
+ const free = room - (kept === null ? 0 : kept.getBoundingClientRect().width + gap);
405
+ let used = 0;
406
+ next = 0;
407
+ for (const width of widths) {
408
+ const after = used + (next > 0 ? gap : 0) + width;
409
+ if (after > free) {
410
+ break;
411
+ }
412
+ used = after;
413
+ next += 1;
414
+ }
415
+ }
416
+ if (next !== count) {
417
+ count = next;
418
+ onCount(next);
419
+ }
420
+ }
421
+ const sizes = new ResizeObserver(measure);
422
+ function watch() {
423
+ const now = /* @__PURE__ */ new Set([
424
+ container,
425
+ ...container.querySelectorAll(items),
426
+ ...reserve === null ? [] : container.querySelectorAll(reserve)
427
+ ]);
428
+ for (const element of watched) {
429
+ if (!now.has(element)) {
430
+ sizes.unobserve(element);
431
+ watched.delete(element);
432
+ }
433
+ }
434
+ for (const element of now) {
435
+ if (!watched.has(element)) {
436
+ sizes.observe(element);
437
+ watched.add(element);
438
+ }
439
+ }
440
+ }
441
+ const changes = new MutationObserver(() => {
442
+ watch();
443
+ measure();
444
+ });
445
+ changes.observe(container, { childList: true, subtree: true });
446
+ watch();
447
+ measure();
448
+ return {
449
+ detach: () => {
450
+ sizes.disconnect();
451
+ changes.disconnect();
452
+ watched.clear();
453
+ }
454
+ };
455
+ }
456
+
227
457
  // src/listbox/attachChecklist.ts
228
458
  var ITEM = "[data-gridkit-checklist-item]";
229
459
  var INDEX = "data-gridkit-checklist-index";
@@ -387,11 +617,6 @@ function attachChecklist(list, options) {
387
617
  };
388
618
  }
389
619
 
390
- // src/writingDirection.ts
391
- function writingDirection(element) {
392
- return getComputedStyle(element).direction === "rtl" ? "rtl" : "ltr";
393
- }
394
-
395
620
  // src/listbox/attachCombobox.ts
396
621
  var OPEN_KEYS = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "F4"]);
397
622
  var SELECT_ONLY_OPEN_KEYS = /* @__PURE__ */ new Set(["Enter", " ", "Home", "End"]);
@@ -417,6 +642,7 @@ function attachCombobox(control, controller, initialOptions) {
417
642
  const events = new AbortController();
418
643
  const { signal } = events;
419
644
  const isOpen = () => options.listbox !== null;
645
+ const drivesField = () => options.drivesField ?? !options.editable;
420
646
  function writeAria() {
421
647
  if (!attached) {
422
648
  return;
@@ -491,7 +717,7 @@ function attachCombobox(control, controller, initialOptions) {
491
717
  function onClosedKey(event) {
492
718
  const { editable } = options;
493
719
  if (event.key === "Escape") {
494
- return !editable && controller.revert(event);
720
+ return drivesField() && controller.revert(event);
495
721
  }
496
722
  if (event.ctrlKey || event.metaKey) {
497
723
  return false;
@@ -500,6 +726,10 @@ function attachCombobox(control, controller, initialOptions) {
500
726
  requestOpen("keyboard", event);
501
727
  return true;
502
728
  }
729
+ if (editable && drivesField() && event.key === "Enter" && !event.altKey && !event.shiftKey) {
730
+ controller.commit("enter", event);
731
+ return true;
732
+ }
503
733
  if (!editable && isPrintable(event) && !options.readOnly) {
504
734
  pendingKeys.push(event);
505
735
  requestOpen("typing", event);
@@ -549,7 +779,7 @@ function attachCombobox(control, controller, initialOptions) {
549
779
  if (isOpen()) {
550
780
  options.onCloseRequest("blur", event);
551
781
  }
552
- if (!options.editable && controller.commit("tab", event).kind === "refused") {
782
+ if (drivesField() && controller.commit("tab", event).kind === "refused") {
553
783
  event.preventDefault();
554
784
  }
555
785
  }
@@ -580,7 +810,7 @@ function attachCombobox(control, controller, initialOptions) {
580
810
  }
581
811
  }
582
812
  function onFocus(event) {
583
- if (!options.editable) {
813
+ if (drivesField()) {
584
814
  controller.focus(event);
585
815
  }
586
816
  }
@@ -589,7 +819,9 @@ function attachCombobox(control, controller, initialOptions) {
589
819
  if (isOpen()) {
590
820
  options.onCloseRequest("blur", event);
591
821
  }
592
- if (!options.editable) {
822
+ const to = event.relatedTarget;
823
+ const staying = to instanceof Element && (options.isInside?.(to) ?? false);
824
+ if (drivesField() && !staying) {
593
825
  controller.blur(event);
594
826
  }
595
827
  }
@@ -600,7 +832,7 @@ function attachCombobox(control, controller, initialOptions) {
600
832
  control.addEventListener("blur", onBlur, { signal });
601
833
  connect(options, null);
602
834
  writeAria();
603
- if (!options.editable && hasFocus(control)) {
835
+ if (drivesField() && hasFocus(control)) {
604
836
  controller.focus(null);
605
837
  }
606
838
  return {
@@ -1786,7 +2018,7 @@ function attachStepKeys(control, initialOptions) {
1786
2018
  }
1787
2019
 
1788
2020
  // src/text/attachAutoGrow.ts
1789
- function pixels2(value) {
2021
+ function pixels3(value) {
1790
2022
  const parsed = Number.parseFloat(value);
1791
2023
  return Number.isNaN(parsed) ? 0 : parsed;
1792
2024
  }
@@ -1802,9 +2034,9 @@ function attachAutoGrow(textarea, initialOptions) {
1802
2034
  return;
1803
2035
  }
1804
2036
  const style = getComputedStyle(textarea);
1805
- const lineHeight = style.lineHeight === "normal" ? pixels2(style.fontSize) * NORMAL_LINE_HEIGHT : pixels2(style.lineHeight);
1806
- const padding = pixels2(style.paddingTop) + pixels2(style.paddingBottom);
1807
- const border = pixels2(style.borderTopWidth) + pixels2(style.borderBottomWidth);
2037
+ const lineHeight = style.lineHeight === "normal" ? pixels3(style.fontSize) * NORMAL_LINE_HEIGHT : pixels3(style.lineHeight);
2038
+ const padding = pixels3(style.paddingTop) + pixels3(style.paddingBottom);
2039
+ const border = pixels3(style.borderTopWidth) + pixels3(style.borderBottomWidth);
1808
2040
  const min = Math.max(1, options.minRows) * lineHeight;
1809
2041
  const max = Math.max(options.minRows, options.maxRows) * lineHeight;
1810
2042
  textarea.style.height = "0px";
@@ -1956,9 +2188,6 @@ function snapshot(control) {
1956
2188
  function caretFromEnd(previousText, caret, nextText) {
1957
2189
  return Math.max(0, nextText.length - (previousText.length - caret));
1958
2190
  }
1959
- function errorText(messages) {
1960
- return messages.find((message) => message.severity === "error")?.text ?? "";
1961
- }
1962
2191
  function attachTextInput(control, controller, initialOptions = {}) {
1963
2192
  let options = initialOptions;
1964
2193
  let state = READY2;
@@ -2025,7 +2254,7 @@ function attachTextInput(control, controller, initialOptions = {}) {
2025
2254
  if (control.value !== text) {
2026
2255
  writeText(text);
2027
2256
  }
2028
- const validity = errorText(controller.getMessages());
2257
+ const validity = firstErrorText(controller.getMessages());
2029
2258
  if (validity !== customValidity) {
2030
2259
  customValidity = validity;
2031
2260
  control.setCustomValidity(validity);
@@ -2338,6 +2567,7 @@ function attachTextInput(control, controller, initialOptions = {}) {
2338
2567
  setOptions: (next) => {
2339
2568
  options = next;
2340
2569
  },
2570
+ refresh: render,
2341
2571
  detach: () => {
2342
2572
  if (state.kind === "detached") {
2343
2573
  return;
@@ -2351,16 +2581,11 @@ function attachTextInput(control, controller, initialOptions = {}) {
2351
2581
  }
2352
2582
 
2353
2583
  // src/toggle/attachToggle.ts
2354
- import {
2355
- nextCheckedValue
2356
- } from "@gridkitjs/forms-core";
2584
+ import { nextCheckedValue } from "@gridkitjs/forms-core";
2357
2585
  function hasFocus4(control) {
2358
2586
  const root = control.getRootNode();
2359
2587
  return (root instanceof Document || root instanceof ShadowRoot) && root.activeElement === control;
2360
2588
  }
2361
- function errorText2(messages) {
2362
- return messages.find((message) => message.severity === "error")?.text ?? "";
2363
- }
2364
2589
  function attachToggle(control, controller, initialOptions = {}) {
2365
2590
  let options = initialOptions;
2366
2591
  let attached = true;
@@ -2375,7 +2600,7 @@ function attachToggle(control, controller, initialOptions = {}) {
2375
2600
  const { value } = controller.getState();
2376
2601
  control.checked = value === true;
2377
2602
  control.indeterminate = value === null;
2378
- const validity = errorText2(controller.getMessages());
2603
+ const validity = firstErrorText(controller.getMessages());
2379
2604
  if (validity !== customValidity) {
2380
2605
  customValidity = validity;
2381
2606
  control.setCustomValidity(validity);
@@ -3057,11 +3282,14 @@ export {
3057
3282
  attachFocusGroup,
3058
3283
  attachHoldRepeat,
3059
3284
  attachListbox,
3285
+ attachOverflowCount,
3060
3286
  attachOverlay,
3287
+ attachRovingFocus,
3061
3288
  attachSegments,
3062
3289
  attachStepKeys,
3063
3290
  attachTextInput,
3064
3291
  attachToggle,
3292
+ attachValidityCarrier,
3065
3293
  compareDocumentOrder,
3066
3294
  createChoiceAnnouncer,
3067
3295
  createLiveAnnouncer,