@motifx-community/ui 0.1.0-beta.11 → 0.1.0-beta.13

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.
Files changed (198) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/dist/components/combobox/ComboBox.d.ts +5 -0
  3. package/dist/components/combobox/combo-box-props.d.ts +6 -0
  4. package/dist/components/datagrid/DataGrid.d.ts +4 -1
  5. package/dist/components/datagrid/grid-lookup.d.ts +8 -0
  6. package/dist/components/datagrid/model/FilterModel.d.ts +5 -0
  7. package/dist/components/datagrid/model/LookupTexts.d.ts +2 -0
  8. package/dist/components/datagrid/model/LookupValues.d.ts +4 -0
  9. package/dist/components/datagrid/view/ActionWidths.d.ts +13 -3
  10. package/dist/components/datagrid/view/ColumnStyles.d.ts +3 -1
  11. package/dist/components/datagrid/view/GridRow.d.ts +1 -1
  12. package/dist/components/dropdown/DropDown.d.ts +5 -0
  13. package/dist/components/dropdown/drop-down-props.d.ts +11 -2
  14. package/dist/components/filterbuilder/filter-builder-lookup.d.ts +3 -0
  15. package/dist/components/listbox/ListBox.d.ts +5 -0
  16. package/dist/components/listbox/item-template.d.ts +4 -0
  17. package/dist/components/listbox/list-box-props.d.ts +6 -0
  18. package/dist/components/listbox/select-all-state.d.ts +1 -1
  19. package/dist/components/ribbonmenu/RibbonKeyHints.d.ts +1 -0
  20. package/dist/components/tabdocs/DocumentTab.d.ts +0 -1
  21. package/dist/components/tabdocs/PhoneBar.d.ts +0 -1
  22. package/dist/components/tagbox/TagBox.d.ts +5 -0
  23. package/dist/components/tagbox/tag-box-props.d.ts +6 -0
  24. package/dist/components/toolbar/Toolbar.d.ts +8 -0
  25. package/dist/components/treeview/TreeView.d.ts +8 -4
  26. package/dist/components/treeview/tree-view-item-template.d.ts +4 -0
  27. package/dist/core/measure/after-frame.d.ts +7 -0
  28. package/dist/core/measure/drawn.d.ts +7 -0
  29. package/dist/core/measure/index.d.ts +1 -1
  30. package/dist/core/show-icon.d.ts +3 -3
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +652 -312
  33. package/dist/index.js.map +1 -1
  34. package/dist/parts/data/DataItems.d.ts +24 -0
  35. package/dist/parts/data/KeyedItems.d.ts +31 -5
  36. package/dist/parts/data/normalize-key.d.ts +7 -0
  37. package/dist/parts/list/OptionList.d.ts +4 -3
  38. package/dist/parts/list/option-parts.d.ts +1 -1
  39. package/dist/styles.css +74 -23
  40. package/docs/accordion.md +1 -1
  41. package/docs/actionsheet.md +1 -1
  42. package/docs/appbar.md +1 -1
  43. package/docs/appmenu-api.md +1 -1
  44. package/docs/appmenu-programmatic.md +1 -1
  45. package/docs/appmenu-search.md +1 -1
  46. package/docs/appmenu.md +1 -1
  47. package/docs/avatar.md +1 -1
  48. package/docs/badge.md +1 -1
  49. package/docs/bar-gauge-angles.md +1 -1
  50. package/docs/bar-gauge-data.md +1 -1
  51. package/docs/bar-gauge-labels.md +1 -1
  52. package/docs/bar-gauge.md +1 -1
  53. package/docs/barcode.md +1 -1
  54. package/docs/bottomnavigation.md +1 -1
  55. package/docs/bottomsheet.md +1 -1
  56. package/docs/breadcrumb.md +1 -1
  57. package/docs/button.md +1 -1
  58. package/docs/buttongroup.md +1 -1
  59. package/docs/buttons.md +1 -1
  60. package/docs/calendar.md +1 -1
  61. package/docs/card.md +1 -1
  62. package/docs/chart-bars.md +1 -1
  63. package/docs/chart-candles.md +1 -1
  64. package/docs/chart-funnel.md +1 -1
  65. package/docs/chart-heatmap.md +1 -1
  66. package/docs/chart-lines.md +1 -1
  67. package/docs/chart-live.md +1 -1
  68. package/docs/chart-pie.md +1 -1
  69. package/docs/chart-radar.md +1 -1
  70. package/docs/chart-ranges.md +1 -1
  71. package/docs/chart-references.md +1 -1
  72. package/docs/chart-scatter.md +1 -1
  73. package/docs/chart-waterfall.md +1 -1
  74. package/docs/chart-zoom.md +1 -1
  75. package/docs/chart.md +1 -1
  76. package/docs/checkbox.md +1 -1
  77. package/docs/chip.md +1 -1
  78. package/docs/choice.md +1 -1
  79. package/docs/colorbox.md +1 -1
  80. package/docs/combobox.md +2 -1
  81. package/docs/commands.md +1 -1
  82. package/docs/control.md +1 -1
  83. package/docs/data.md +1 -1
  84. package/docs/datagrid-api.md +1 -1
  85. package/docs/datagrid-bands.md +1 -1
  86. package/docs/datagrid-drag-select.md +1 -1
  87. package/docs/datagrid-drag.md +1 -1
  88. package/docs/datagrid-editing.md +1 -1
  89. package/docs/datagrid-filtering.md +1 -1
  90. package/docs/datagrid-forms.md +1 -1
  91. package/docs/datagrid-grouping.md +1 -1
  92. package/docs/datagrid-layout.md +1 -1
  93. package/docs/datagrid-lookups.md +4 -1
  94. package/docs/datagrid-master-detail.md +1 -1
  95. package/docs/datagrid-scrolling.md +1 -1
  96. package/docs/datagrid-selection.md +1 -1
  97. package/docs/datagrid.md +1 -1
  98. package/docs/datebox.md +1 -1
  99. package/docs/daterangebox.md +1 -1
  100. package/docs/display.md +1 -1
  101. package/docs/draggable.md +1 -1
  102. package/docs/drawer.md +1 -1
  103. package/docs/dropdown.md +4 -3
  104. package/docs/editors.md +1 -1
  105. package/docs/feedback.md +1 -1
  106. package/docs/fileuploader.md +1 -1
  107. package/docs/filterbuilder.md +1 -1
  108. package/docs/formlayout.md +1 -1
  109. package/docs/foundations.md +1 -1
  110. package/docs/gallery.md +1 -1
  111. package/docs/gauge-base.md +1 -1
  112. package/docs/gauge-circular.md +1 -1
  113. package/docs/gauge-dashboards.md +1 -1
  114. package/docs/gauge-linear.md +1 -1
  115. package/docs/gauge-markers.md +1 -1
  116. package/docs/gauge-marks.md +1 -1
  117. package/docs/gauge-ranges.md +1 -1
  118. package/docs/gauge-scales.md +1 -1
  119. package/docs/gauge.md +1 -1
  120. package/docs/home.md +1 -1
  121. package/docs/keyboard.md +1 -1
  122. package/docs/language.md +1 -1
  123. package/docs/layout.md +1 -1
  124. package/docs/listbox.md +4 -3
  125. package/docs/loadpanel.md +1 -1
  126. package/docs/lookup.md +1 -1
  127. package/docs/menus-api.md +1 -1
  128. package/docs/menus-context.md +1 -1
  129. package/docs/menus-customization.md +1 -1
  130. package/docs/menus-merging.md +1 -1
  131. package/docs/menus-programmatic.md +1 -1
  132. package/docs/menus.md +1 -1
  133. package/docs/multiview.md +1 -1
  134. package/docs/navigation.md +1 -1
  135. package/docs/numberbox.md +1 -1
  136. package/docs/otpinput.md +1 -1
  137. package/docs/pagination.md +1 -1
  138. package/docs/popover.md +1 -1
  139. package/docs/progress.md +1 -1
  140. package/docs/qrcode.md +1 -1
  141. package/docs/radiogroup.md +1 -1
  142. package/docs/rating.md +1 -1
  143. package/docs/resizable.md +1 -1
  144. package/docs/ribbonmenu-api.md +1 -1
  145. package/docs/ribbonmenu-commands.md +1 -1
  146. package/docs/ribbonmenu-customization.md +1 -1
  147. package/docs/ribbonmenu-display.md +3 -3
  148. package/docs/ribbonmenu-layouts.md +1 -1
  149. package/docs/ribbonmenu-programmatic.md +1 -1
  150. package/docs/ribbonmenu.md +1 -1
  151. package/docs/scheduler-agenda.md +1 -1
  152. package/docs/scheduler-big-data.md +1 -1
  153. package/docs/scheduler-editing.md +1 -1
  154. package/docs/scheduler-form.md +1 -1
  155. package/docs/scheduler-icalendar.md +1 -1
  156. package/docs/scheduler-mobile.md +1 -1
  157. package/docs/scheduler-recurrence.md +1 -1
  158. package/docs/scheduler-resources.md +1 -1
  159. package/docs/scheduler-timeline.md +1 -1
  160. package/docs/scheduler.md +1 -1
  161. package/docs/scrollview.md +1 -1
  162. package/docs/shortcuteditor.md +1 -1
  163. package/docs/showcase-home.md +1 -1
  164. package/docs/showcase.md +1 -1
  165. package/docs/signature.md +1 -1
  166. package/docs/skeleton.md +1 -1
  167. package/docs/slider.md +1 -1
  168. package/docs/sortable.md +1 -1
  169. package/docs/sparkline.md +1 -1
  170. package/docs/speeddial.md +1 -1
  171. package/docs/splitter.md +1 -1
  172. package/docs/stepper.md +1 -1
  173. package/docs/switch.md +1 -1
  174. package/docs/tabdocs-dock.md +1 -1
  175. package/docs/tabdocs-drag.md +1 -1
  176. package/docs/tabdocs-menus.md +1 -1
  177. package/docs/tabdocs-mobile.md +1 -1
  178. package/docs/tabdocs-tabs.md +1 -1
  179. package/docs/tabdocs-windows.md +1 -1
  180. package/docs/tabdocs-workspace.md +1 -1
  181. package/docs/tabdocs.md +1 -1
  182. package/docs/tabs.md +1 -1
  183. package/docs/tagbox.md +4 -3
  184. package/docs/textarea.md +1 -1
  185. package/docs/textbox.md +1 -1
  186. package/docs/tileview.md +1 -1
  187. package/docs/timeline.md +1 -1
  188. package/docs/toast.md +1 -1
  189. package/docs/tokens.md +1 -1
  190. package/docs/toolbar.md +1 -1
  191. package/docs/tooltip.md +1 -1
  192. package/docs/treeview.md +3 -3
  193. package/docs/validationsummary.md +1 -1
  194. package/docs/window.md +1 -1
  195. package/docs/wizard.md +1 -1
  196. package/llms-full.txt +174 -167
  197. package/llms.txt +1 -1
  198. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -6,6 +6,90 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.0-beta.13] - 2026-11-17
10
+
11
+ Needs `@motifx/core` 1.2.0-rc.31.
12
+
13
+ ### Fixed
14
+
15
+ - A template's cleanup runs with its host whole, when the item is drawn again and when its control goes (#3). The
16
+ cleanup an `itemTemplate` (`ListBox`, `ComboBox`, `DropDown`, `Lookup`, `TagBox`, `TreeView`), a `fieldTemplate`
17
+ (`DropDown`, `Lookup`) or a `tagTemplate` (`TagBox`) returns was kept by the control and called by hand: on a redraw
18
+ with the host alive, and when the control, its owner or the tab holding it went, after the host was already
19
+ disposed, so a cleanup that touched the host threw once per drawn row. Every drawing now has a host of its own, the
20
+ cleanup is given to that host, and it runs as the host goes, the same way in both cases. A template that only adds
21
+ components to its host needs no cleanup: they go with the host.
22
+ - `DropDown` and `Lookup` draw the value once as they are built: the field was drawn, then drawn again for the data
23
+ source given (none included), so a `fieldTemplate` ran twice and its cleanup once in between. With a data source,
24
+ the first drawing wrote the key itself before the source was there.
25
+ - A `DataGrid` inside another `DataGrid` (in a row's details, in a cell) keeps its own columns and its own look (#4).
26
+ A grid wrote the rules of its columns, and its stylesheet the rules for its states, with descendant selectors, so
27
+ they reached the rows of a grid inside it too. A column the outer grid does not show (its own selection column
28
+ among them) was hidden inside as well, and the cells after it moved into the wrong tracks; a column's alignment,
29
+ its pinning and, with virtual columns, its track went to the same field inside; and the outer grid's `striped`,
30
+ `selection`, `headerButtons: 'always'` and its loading or empty state showed on the rows, the headers and the body
31
+ inside. The column rules now find the rows through the parts that hold them (`data-grid-id` is on the head, the
32
+ body and the foot, no longer on `.mx-data-grid`), and a rule that depends on a state of the grid, a row or a cell
33
+ goes on by child combinators only. A grid that holds no grid looks as it did.
34
+ - A `striped` `DataGrid` shows the row under the pointer, the active row and a new row on its odd rows too. The
35
+ stripe's rule outweighed theirs, so every second row kept its stripe under the pointer and as the active row. The
36
+ stripe now comes first and weighs no more than they do; the even rows, a selected row and a grid without stripes
37
+ look as they did.
38
+
39
+ ### Changed
40
+
41
+ - `OptionParts.text` is a new part each time an option's drawing changes, and `OptionList.bindText` returns nothing:
42
+ the binding goes with the text part it writes.
43
+
44
+ ## [0.1.0-beta.12] - 2026-11-14
45
+
46
+ Needs `@motifx/core` 1.2.0-rc.30.
47
+
48
+ ### Added
49
+
50
+ - `normalizeKey` on a `DataGrid` lookup column, `DropDown`, `TagBox`, `ComboBox`, `ListBox` and a `FilterBuilder`
51
+ lookup (the `NormalizeKey` type): keys equal once normalized are one key, such as
52
+ `(k) => (typeof k === 'string' ? k.trimEnd() : k)` for codes a database pads with spaces. It spares the requests a
53
+ source that compares keys its own way needs (below), and it is the rule for in-memory items, where no source decides.
54
+ One function per source keeps one shared cache.
55
+
56
+ ### Fixed
57
+
58
+ - Lookup keys a data source compares its own way are matched to their items (#2): a database that disregards trailing
59
+ spaces (`char(n)` codes such as `'A '` against `'A'`), case (an ID written in capitals) or accents, or reads `'007'`
60
+ as `7`. When a batch leaves keys unmatched while the source returned items no key matched exactly, or items that
61
+ differ from a key only in such a way, those keys are asked for one by one, and what the source returns for a key is
62
+ that key's item; a key the source does not have stays missing with no request more. A lookup cell shows the item's
63
+ text instead of the key, its editor shows it and its list marks it, the filter row and the header filter list it
64
+ (only "(All)" was listed when a server grouped by padded keys), and keys matched to one item are one entry there,
65
+ which filters by all of them. `DropDown`, `TagBox`, `ComboBox` and `ListBox` over a data source mark the item of such
66
+ a value, and picking it again in a `TagBox` or a multiple `ListBox` takes the value out instead of adding the item a
67
+ second time. The row's value is never changed: an editor writes another value only when another item is picked.
68
+ - `TagBox` and `ListBox` with a `dataSource` ask for a value on no loaded page by their `valueField`, as `DropDown` and
69
+ `ComboBox` do, instead of by the adapter's key.
70
+
71
+ - `RibbonMenu` key hints: the letter of the button before the tabs (Alt, then F) ends the hints, as a command does,
72
+ instead of going on to the commands of the selected tab over the app menu it opened; Escape then reaches that menu
73
+ and closes it. A quick command's digit ends them too. A command that holds a field and has no text takes its letters
74
+ from the field's label (and its access key), instead of `?1`.
75
+
76
+ - `DataGrid` keeps focus in the grid when the column of the focused header leaves (a header dropped on the group
77
+ panel, a column hidden): focus goes to the cell that is active then. Before, it fell to the page and the focus guard
78
+ moved it to the next button after the grid, with two forced style recalcs on the way. Moving focus between cells no
79
+ longer changes the tab index of the cell that still has focus, which made the browser work out the page's style.
80
+
81
+ - `Toolbar` sized by its items takes back the items it put in the "more" menu when what holds it grows (an `AppBar`'s
82
+ actions in a window made narrow, then wide again). The bar keeps asking for the room of all its items, also of the
83
+ ones in the menu, through a hidden part that takes no room on the bar; so it grows with what holds it, and its size
84
+ notice puts the items back. The `AppBar`'s actions keep to the end, with that room before them.
85
+
86
+ - `DataGrid` and `Toolbar` no longer make the browser lay the page out from script when they first show ("Forced
87
+ reflow" in the console, about 30 to 60 ms on a page with grids). Their first measure waits until the page is drawn,
88
+ and every measure asked for that frame reads in one go before any of them writes. A grid's row action buttons stay out
89
+ of sight in their place until their widths are known, as before.
90
+ - A scroll event no longer reads the scrolled element at once (it could lay out a page written since the last frame):
91
+ the element is read once the frame is drawn, and at once only when its place is asked before that.
92
+
9
93
  ## [0.1.0-beta.11] - 2026-11-14
10
94
 
11
95
  ### Fixed
@@ -1,6 +1,7 @@
1
1
  import { type Bind, type ComponentBase, type Event as MotifEvent, type IBaseProp } from '@motifx/core';
2
2
  import type { data } from '@motifx-community/data';
3
3
  import { DataItems } from '../../parts/data/DataItems';
4
+ import type { NormalizeKey } from '../../parts/data/normalize-key';
4
5
  import { Field } from '../../parts/field/Field';
5
6
  import type { ItemField } from '../../parts/list/item-field';
6
7
  import type { PopupCloseReason } from '../../parts/popup/popup-close-reason';
@@ -26,6 +27,8 @@ export declare class ComboBox<T = unknown, V = unknown> extends Field<V | null,
26
27
  set textField(value: Bind<ItemField<T>>);
27
28
  get valueField(): ItemField<T> | undefined;
28
29
  set valueField(value: Bind<ItemField<T>>);
30
+ get normalizeKey(): NormalizeKey | undefined;
31
+ set normalizeKey(value: Bind<NormalizeKey>);
29
32
  get iconField(): ItemField<T> | undefined;
30
33
  set iconField(value: Bind<ItemField<T>>);
31
34
  get groupField(): ItemField<T> | undefined;
@@ -79,6 +82,8 @@ export declare class ComboBox<T = unknown, V = unknown> extends Field<V | null,
79
82
  /** The text shown for a value that has no item. */
80
83
  protected textOfValue(value: V | null): string;
81
84
  protected itemText(item: T): string;
85
+ /** The test for the item of `value`: the same value, the same once normalized, or the one the data source matched to it. */
86
+ private holderOf;
82
87
  protected itemValue(item: T): unknown;
83
88
  /** The value of text that matches no item, with `acceptCustomValue`. */
84
89
  protected customValue(text: string): V | null;
@@ -1,6 +1,7 @@
1
1
  import type { Bind, ComponentBase } from '@motifx/core';
2
2
  import type { data } from '@motifx-community/data';
3
3
  import type { FieldProps } from '../../parts/field/field-props';
4
+ import type { NormalizeKey } from '../../parts/data/normalize-key';
4
5
  import type { ItemField } from '../../parts/list/item-field';
5
6
  import type { PopupCloseReason } from '../../parts/popup/popup-close-reason';
6
7
  /** Props of `ComboBox`, in addition to the field props. Each prop is also a settable, reactive property. */
@@ -11,6 +12,11 @@ export interface ComboBoxProps<T, V> extends FieldProps<V | null> {
11
12
  dataSource?: Bind<data.DataSource<T, unknown> | null>;
12
13
  textField?: Bind<ItemField<T>>;
13
14
  valueField?: Bind<ItemField<T>>;
15
+ /**
16
+ * Values equal once normalized are one value (`NormalizeKey`). Without it, the item of a value a data source compares
17
+ * its own way (`'A '` for `'A'`, a different case) is still found: the source is asked for it and decides.
18
+ */
19
+ normalizeKey?: Bind<NormalizeKey>;
14
20
  iconField?: Bind<ItemField<T>>;
15
21
  /** Applies to in-memory items only. */
16
22
  groupField?: Bind<ItemField<T>>;
@@ -994,7 +994,10 @@ export declare class DataGrid<T = any> extends Control<HTMLDivElement, DataGridP
994
994
  private headerCellOf;
995
995
  /** The buttons of a row's actions cell that show, in order, the "more" button last. */
996
996
  private actionButtons;
997
- /** Exactly one cell is in the tab order: the active one. */
997
+ /**
998
+ * Exactly one cell is in the tab order: the active one. `leave: false` keeps the one it was in the tab order, for the
999
+ * caller to take it out once focus has left it (`focusActive`).
1000
+ */
998
1001
  private syncTabStop;
999
1002
  private setActive;
1000
1003
  /** Asks `onFocusedRowChanging` and `onFocusedCellChanging` before the active cell moves; whether it may. */
@@ -1,5 +1,6 @@
1
1
  import type { Bind } from '@motifx/core';
2
2
  import type { data } from '@motifx-community/data';
3
+ import type { NormalizeKey } from '../../parts/data/normalize-key';
3
4
  /**
4
5
  * The source of a lookup column's text: the cell holds a key (a customer id), and the grid displays the
5
6
  * text of its item (the customer's name). The items can be on a different service from the rows, over
@@ -16,6 +17,13 @@ export interface GridLookup<T = any> {
16
17
  * array of plain values, the value itself.
17
18
  */
18
19
  valueField?: string;
20
+ /**
21
+ * Keys equal once normalized are one key (`NormalizeKey`), such as `(k) => (typeof k === 'string' ? k.trimEnd() : k)`
22
+ * for codes a database pads with spaces. Without it, a key the source compares its own way (`'A '` for `'A'`, a
23
+ * different case) is still matched: the source is asked for it and decides. Give it to spare those requests, and for
24
+ * an in-memory array, where no source decides. Give one function wherever the source is used, so they share a cache.
25
+ */
26
+ normalizeKey?: NormalizeKey;
19
27
  /** The displayed text: a field of the item or a function of it. The default is the value. */
20
28
  textField?: string | ((item: any) => string);
21
29
  /** The fields the editor and the text search cover. By default, `textField` when it is a field. */
@@ -27,6 +27,11 @@ export declare class FilterModel<T> {
27
27
  typed: boolean;
28
28
  /** How a column's header filter value filters when not by being equal (a range, an expression); the grid gives it. */
29
29
  conditionOf: (field: string) => ((value: unknown) => data.FilterExpression | null) | null;
30
+ /**
31
+ * The keys a lookup column's chosen key stands with: the keys its list showed as one item (the source matched them to
32
+ * it); a key alone otherwise. The grid gives it.
33
+ */
34
+ keysOf: (field: string, value: unknown) => readonly unknown[];
30
35
  /** Whether the filter row and the header filters are part of the filter value (`filterSyncEnabled`); the grid gives it. */
31
36
  sync: () => boolean;
32
37
  private searchPart;
@@ -29,6 +29,8 @@ export declare class LookupTexts<T> {
29
29
  });
30
30
  /** The cache of a lookup column's source now (the source may be a tracked function). */
31
31
  items(col: GridColumn<T>): KeyedItems<any> | null;
32
+ /** The string a key of the column is kept under: by its cache (`normalizeKey`), else as it is. */
33
+ private keyOf;
32
34
  /** The text of an item: `textField`, else its `text`, else its value. */
33
35
  textOf(col: GridColumn<T>, item: unknown): string;
34
36
  /** How the column's items are searched by text; `entered` holds the values entered in the row. */
@@ -10,7 +10,11 @@ import type { GridModel } from './GridModel';
10
10
  */
11
11
  export declare class LookupValues<T> {
12
12
  private readonly model;
13
+ /** By column, the keys each entry of its last list stands for, when the source matched more than one key to its item. */
14
+ private readonly merged;
13
15
  constructor(model: GridModel<T>);
16
+ /** The keys `value` stands with in the column's list (see `FilterModel.keysOf`): itself alone, unless its entry holds several. */
17
+ keysOf(field: string, value: unknown): readonly unknown[];
14
18
  /** The filter of the other columns (and the source's own), which a synced list honors. */
15
19
  otherFilter(field: string): data.FilterExpression | null;
16
20
  /** The list as a data source a `DropDown` or `ListBox` reads; `first` is the entry put before the values. */
@@ -3,13 +3,17 @@ import type { ResolvedAction } from './resolved-action';
3
3
  /**
4
4
  * Widths of action buttons, measured once per action (its id, text and look) in a hidden cell and
5
5
  * kept, so fitting a row's buttons only adds numbers: scrolling triggers no layout. An action not
6
- * measured yet counts 0 and is measured with the window's next reads; `measured` then asks the rows
7
- * to fit their buttons again. A width of 0 (the grid is not shown yet) is not kept.
6
+ * measured yet counts 0 and is measured once the page is drawn, with everything asked in that frame:
7
+ * read then, it lays nothing out. `waiting` tells while it waits (the rows keep their buttons out of
8
+ * sight meanwhile) and `measured` then asks the rows to fit their buttons again. A width of 0 (the
9
+ * grid is not shown yet) is not kept.
8
10
  */
9
11
  export declare class ActionWidths {
10
12
  private readonly host;
11
13
  /** Runs after new widths are kept. */
12
14
  private readonly measured;
15
+ /** Tells whether buttons wait to be measured. */
16
+ private readonly waiting;
13
17
  private readonly widths;
14
18
  private frameSize;
15
19
  private box;
@@ -17,9 +21,13 @@ export declare class ActionWidths {
17
21
  private readonly probes;
18
22
  /** The "more" button waiting for the next read, with the cell's padding and gap. */
19
23
  private moreProbe;
24
+ /** Takes back the read that waits for the page to be drawn. */
25
+ private pending;
20
26
  constructor(host: () => ComponentBase | null,
21
27
  /** Runs after new widths are kept. */
22
- measured?: () => void);
28
+ measured?: () => void,
29
+ /** Tells whether buttons wait to be measured. */
30
+ waiting?: (on: boolean) => void);
23
31
  /** Measure again (the density changed). */
24
32
  clear(): void;
25
33
  width<T>(a: ResolvedAction<T>): number;
@@ -29,6 +37,8 @@ export declare class ActionWidths {
29
37
  gap: number;
30
38
  more: number;
31
39
  };
40
+ /** One read for everything asked before the page is drawn; a window that lays nothing out (a test document) reads with its next round. */
41
+ private ask;
32
42
  private readonly read;
33
43
  private readonly write;
34
44
  private cell;
@@ -4,7 +4,9 @@ import type { StickyOffset } from '../model/sticky-offset';
4
4
  /**
5
5
  * Per-column CSS of one grid: columns not shown, alignment and sticky offsets, written as rules keyed
6
6
  * by `data-field` (a pinned band's header by `data-band`, at the offset of its columns). Changing a width or pinning a column rewrites this sheet only; no cell gets a
7
- * binding of its own and no row is touched. A constructable stylesheet adopted by the document (or
7
+ * binding of its own and no row is touched. A rule finds the rows through the parts that hold them (the head, the body,
8
+ * the foot, the copy of a dragged row), which carry the grid's id, and goes on by child combinators only: the rows of a
9
+ * grid inside this one (in a row's details, in a cell) are that grid's. A constructable stylesheet adopted by the document (or
8
10
  * shadow root) where there is one, which also works under a strict Content Security Policy; else a
9
11
  * `<style>` element inside the grid.
10
12
  */
@@ -1,6 +1,6 @@
1
1
  import { Component } from '@motifx/core';
2
2
  import type { CellTipTarget } from './cell-tip-target';
3
- import { KeyedItems } from '../../../parts/data/KeyedItems';
3
+ import type { KeyedItems } from '../../../parts/data/KeyedItems';
4
4
  import type { GridModel } from '../model/GridModel';
5
5
  import type { ActionWidths } from './ActionWidths';
6
6
  import { RowActions } from './RowActions';
@@ -7,6 +7,7 @@ import type { OptionParts } from '../../parts/list/option-parts';
7
7
  import { Popup } from '../../parts/popup/Popup';
8
8
  import type { PopupCloseReason } from '../../parts/popup/popup-close-reason';
9
9
  import type { DropDownProps } from './drop-down-props';
10
+ import type { NormalizeKey } from '../../parts/data/normalize-key';
10
11
  type Template<T> = ((item: T, host: ComponentBase<HTMLElement>) => (() => void) | void) | null;
11
12
  type OptionDrawer<T> = ((item: T, option: OptionParts) => (() => void) | void) | null;
12
13
  /**
@@ -30,6 +31,8 @@ export declare class DropDown<T = unknown, V = unknown> extends Field<V | null,
30
31
  set textField(value: Bind<ItemField<T>>);
31
32
  get valueField(): ItemField<T> | undefined;
32
33
  set valueField(value: Bind<ItemField<T>>);
34
+ get normalizeKey(): NormalizeKey | undefined;
35
+ set normalizeKey(value: Bind<NormalizeKey>);
33
36
  get iconField(): ItemField<T> | undefined;
34
37
  set iconField(value: Bind<ItemField<T>>);
35
38
  get groupField(): ItemField<T> | undefined;
@@ -90,6 +93,8 @@ export declare class DropDown<T = unknown, V = unknown> extends Field<V | null,
90
93
  private get dropParts();
91
94
  private itemText;
92
95
  private itemValue;
96
+ /** The test for the item of `value`: the same value, the same once normalized, or the one the data source matched to it. */
97
+ private holderOf;
93
98
  private indexOfValue;
94
99
  /** The item of `value`: among the items in memory, or the one known from a data source (asked by key when needed). */
95
100
  private itemOfValue;
@@ -1,6 +1,7 @@
1
1
  import type { Bind, ComponentBase } from '@motifx/core';
2
2
  import type { data } from '@motifx-community/data';
3
3
  import type { FieldProps } from '../../parts/field/field-props';
4
+ import type { NormalizeKey } from '../../parts/data/normalize-key';
4
5
  import type { ItemField } from '../../parts/list/item-field';
5
6
  import type { PopupCloseReason } from '../../parts/popup/popup-close-reason';
6
7
  /** Props of `DropDown`, in addition to the field props. Each prop is also a settable, reactive property. */
@@ -23,6 +24,11 @@ export interface DropDownProps<T, V> extends FieldProps<V | null> {
23
24
  textField?: Bind<ItemField<T>>;
24
25
  /** The default is `'value'` when the object has one, and the item itself otherwise. */
25
26
  valueField?: Bind<ItemField<T>>;
27
+ /**
28
+ * Values equal once normalized are one value (`NormalizeKey`). Without it, the item of a value a data source compares
29
+ * its own way (`'A '` for `'A'`, a different case) is still found: the source is asked for it and decides.
30
+ */
31
+ normalizeKey?: Bind<NormalizeKey>;
26
32
  iconField?: Bind<ItemField<T>>;
27
33
  /** Options in the same group appear together under its name. */
28
34
  groupField?: Bind<ItemField<T>>;
@@ -33,9 +39,12 @@ export interface DropDownProps<T, V> extends FieldProps<V | null> {
33
39
  /** The default is `'contains'`. */
34
40
  searchMode?: Bind<'contains' | 'startswith'>;
35
41
  clearButton?: Bind<boolean>;
36
- /** Customizes how an option is drawn. It can return a cleanup function. */
42
+ /** Customizes how an option is drawn. It can return a cleanup function, run as `host` goes (see `ItemTemplate`). */
37
43
  itemTemplate?: Bind<((item: T, host: ComponentBase<HTMLElement>) => (() => void) | void) | null>;
38
- /** Customizes how the selected item is drawn in the field. It can return a cleanup function. */
44
+ /**
45
+ * Customizes how the selected item is drawn in the field, into a `host` made for each drawing. It can return a
46
+ * cleanup function, run as `host` goes: the value drawn again or the box gone (see `ItemTemplate`).
47
+ */
39
48
  fieldTemplate?: Bind<((item: T, host: ComponentBase<HTMLElement>) => (() => void) | void) | null>;
40
49
  /** The list is at least as wide as the field. The default is `true`. */
41
50
  matchWidth?: Bind<boolean>;
@@ -1,5 +1,6 @@
1
1
  import type { Bind } from '@motifx/core';
2
2
  import type { data } from '@motifx-community/data';
3
+ import type { NormalizeKey } from '../../parts/data/normalize-key';
3
4
  /** The values of a lookup field come from a list: a drop-down of its items, or a tag box for "is any of". */
4
5
  export interface FilterBuilderLookup {
5
6
  /** The items: a data source, searched on its service, or an in-memory array. */
@@ -9,6 +10,8 @@ export interface FilterBuilderLookup {
9
10
  * plain values.
10
11
  */
11
12
  valueField?: string;
13
+ /** Keys equal once normalized are one key (`NormalizeKey`); see `GridLookup.normalizeKey`. */
14
+ normalizeKey?: NormalizeKey;
12
15
  /** The display text: an item field or a function of the item. The default is the value. */
13
16
  textField?: string | ((item: any) => string);
14
17
  /** Shows a clear button in the drop-down. The default is `false`. */
@@ -1,6 +1,7 @@
1
1
  import { type Bind, type ComponentBase, type IBaseProp } from '@motifx/core';
2
2
  import type { data } from '@motifx-community/data';
3
3
  import { DataItems } from '../../parts/data/DataItems';
4
+ import type { NormalizeKey } from '../../parts/data/normalize-key';
4
5
  import { Field } from '../../parts/field/Field';
5
6
  import type { ItemField } from '../../parts/list/item-field';
6
7
  import { TextBox } from '../textbox/TextBox';
@@ -26,6 +27,8 @@ export declare class ListBox<T = unknown, V = unknown> extends Field<V | V[] | n
26
27
  set textField(value: Bind<ItemField<T>>);
27
28
  get valueField(): ItemField<T> | undefined;
28
29
  set valueField(value: Bind<ItemField<T>>);
30
+ get normalizeKey(): NormalizeKey | undefined;
31
+ set normalizeKey(value: Bind<NormalizeKey>);
29
32
  get iconField(): ItemField<T> | undefined;
30
33
  set iconField(value: Bind<ItemField<T>>);
31
34
  get groupField(): ItemField<T> | undefined;
@@ -76,6 +79,8 @@ export declare class ListBox<T = unknown, V = unknown> extends Field<V | V[] | n
76
79
  protected sameValue(a: V | V[] | null, b: V | V[] | null): boolean;
77
80
  protected renderValue(value: V | V[] | null): void;
78
81
  protected itemText(item: T): string;
82
+ /** Whether `item` is chosen: its value is, or a chosen value stands for it (`DataItems.sameItem`). */
83
+ private isChosen;
79
84
  protected itemValue(item: T): unknown;
80
85
  private get listParts();
81
86
  private setUpList;
@@ -2,6 +2,10 @@ import type { ComponentBase } from '@motifx/core';
2
2
  /**
3
3
  * Draws an item instead of its text. It can return a cleanup function.
4
4
  *
5
+ * The host is the drawing's own: it goes when the item is drawn again or its list goes, with what was added to it,
6
+ * so a template that only adds components needs no cleanup. The cleanup is for what lives outside the host (a
7
+ * subscription, a timer); it is given to the host and runs once as the host goes, after what the host held.
8
+ *
5
9
  * @param host The place the item goes in: add your components to its `controls`, or give it a text.
6
10
  */
7
11
  export type ItemTemplate<T> = (item: T, host: ComponentBase<HTMLElement>) => (() => void) | void;
@@ -1,6 +1,7 @@
1
1
  import type { Bind } from '@motifx/core';
2
2
  import type { data } from '@motifx-community/data';
3
3
  import type { FieldProps } from '../../parts/field/field-props';
4
+ import type { NormalizeKey } from '../../parts/data/normalize-key';
4
5
  import type { ItemField } from '../../parts/list/item-field';
5
6
  import type { ItemTemplate } from './item-template';
6
7
  import type { ListSelectionMode } from './list-selection-mode';
@@ -12,6 +13,11 @@ export interface ListBoxProps<T, V> extends FieldProps<V | V[] | null> {
12
13
  dataSource?: Bind<data.DataSource<T, unknown> | null>;
13
14
  textField?: Bind<ItemField<T>>;
14
15
  valueField?: Bind<ItemField<T>>;
16
+ /**
17
+ * Values equal once normalized are one value (`NormalizeKey`). Without it, the item of a value a data source compares
18
+ * its own way (`'A '` for `'A'`, a different case) is still found: the source is asked for it and decides.
19
+ */
20
+ normalizeKey?: Bind<NormalizeKey>;
15
21
  iconField?: Bind<ItemField<T>>;
16
22
  /** Applies to in-memory items only. */
17
23
  groupField?: Bind<ItemField<T>>;
@@ -1,3 +1,3 @@
1
1
  import type { DataItems } from '../../parts/data/DataItems';
2
2
  /** Whether the items the list shows are all chosen (`true`), none of them (`false`) or some (`'mixed'`). */
3
- export declare function selectAllState<T>(items: DataItems<T>, chosen: ReadonlySet<unknown>, valueOf: (item: T) => unknown, enabledOf: (item: T) => boolean): boolean | 'mixed';
3
+ export declare function selectAllState<T>(items: DataItems<T>, chosen: ReadonlySet<unknown>, isChosen: (item: T) => boolean, enabledOf: (item: T) => boolean): boolean | 'mixed';
@@ -6,6 +6,7 @@ export interface KeyHint {
6
6
  keys: string;
7
7
  text: string;
8
8
  press: () => void;
9
+ tab?: boolean;
9
10
  opens?: () => InnerHints;
10
11
  }
11
12
  /** The hints of what a hint opened, drawn in its own surface. */
@@ -25,7 +25,6 @@ export declare class DocumentTab {
25
25
  private readonly status;
26
26
  private description;
27
27
  private icon;
28
- private releaseIcon;
29
28
  private badge;
30
29
  private tooltip;
31
30
  private tipHolder;
@@ -16,7 +16,6 @@ export declare class PhoneBar {
16
16
  private readonly unsaved;
17
17
  private readonly close;
18
18
  private readonly count;
19
- private releaseIcon;
20
19
  private shown;
21
20
  private swipe;
22
21
  constructor(manager: TabDocumentManager, presenter: TabPresenter);
@@ -1,6 +1,7 @@
1
1
  import { type Bind, type ComponentBase, type Event as MotifEvent, type IBaseProp } from '@motifx/core';
2
2
  import type { data } from '@motifx-community/data';
3
3
  import { DataItems } from '../../parts/data/DataItems';
4
+ import type { NormalizeKey } from '../../parts/data/normalize-key';
4
5
  import { Field } from '../../parts/field/Field';
5
6
  import type { ItemField } from '../../parts/list/item-field';
6
7
  import type { PopupCloseReason } from '../../parts/popup/popup-close-reason';
@@ -25,6 +26,8 @@ export declare class TagBox<T = unknown, V = unknown> extends Field<V[], TagBoxP
25
26
  set textField(value: Bind<ItemField<T>>);
26
27
  get valueField(): ItemField<T> | undefined;
27
28
  set valueField(value: Bind<ItemField<T>>);
29
+ get normalizeKey(): NormalizeKey | undefined;
30
+ set normalizeKey(value: Bind<NormalizeKey>);
28
31
  get iconField(): ItemField<T> | undefined;
29
32
  set iconField(value: Bind<ItemField<T>>);
30
33
  get groupField(): ItemField<T> | undefined;
@@ -98,6 +101,8 @@ export declare class TagBox<T = unknown, V = unknown> extends Field<V[], TagBoxP
98
101
  protected sameValue(a: V[], b: V[]): boolean;
99
102
  protected renderValue(value: V[]): void;
100
103
  protected itemText(item: T): string;
104
+ /** Whether `item` is chosen: its value is, or a chosen value stands for it (`DataItems.sameItem`). */
105
+ private isChosen;
101
106
  protected itemValue(item: T): unknown;
102
107
  /** The text of a tag whose value has no item. */
103
108
  protected textOfValue(value: V): string;
@@ -1,6 +1,7 @@
1
1
  import type { Bind } from '@motifx/core';
2
2
  import type { data } from '@motifx-community/data';
3
3
  import type { FieldProps } from '../../parts/field/field-props';
4
+ import type { NormalizeKey } from '../../parts/data/normalize-key';
4
5
  import type { ItemField } from '../../parts/list/item-field';
5
6
  import type { PopupCloseReason } from '../../parts/popup/popup-close-reason';
6
7
  import type { ItemTemplate } from '../listbox/item-template';
@@ -12,6 +13,11 @@ export interface TagBoxProps<T, V> extends FieldProps<V[]> {
12
13
  dataSource?: Bind<data.DataSource<T, unknown> | null>;
13
14
  textField?: Bind<ItemField<T>>;
14
15
  valueField?: Bind<ItemField<T>>;
16
+ /**
17
+ * Values equal once normalized are one value (`NormalizeKey`). Without it, the item of a value a data source compares
18
+ * its own way (`'A '` for `'A'`, a different case) is still found: the source is asked for it and decides.
19
+ */
20
+ normalizeKey?: Bind<NormalizeKey>;
15
21
  iconField?: Bind<ItemField<T>>;
16
22
  /** Applies to in-memory items only. */
17
23
  groupField?: Bind<ItemField<T>>;
@@ -107,6 +107,14 @@ export declare class Toolbar extends Control<HTMLDivElement, ToolbarProps> {
107
107
  private readonly readBar;
108
108
  /** Moves into the "more" menu what does not fit (and what always goes there). */
109
109
  private readonly fit;
110
+ /**
111
+ * Keeps the room of the parts put in the "more" menu in the bar's own size, so it still asks what holds it for the
112
+ * room of every part: a hidden part as long as they are, which takes no room on the bar (it grows by a millionth of
113
+ * the room to spare). A bar sized by its parts then grows when what holds it does, and its size notice puts them
114
+ * back; without it, the bar would stay as small as the parts left on it.
115
+ */
116
+ private keepRoom;
117
+ private makeReserve;
110
118
  private showOverflow;
111
119
  /**
112
120
  * Runs in the fit's write: when something has to go, the "more" button is shown, and measured there the first time
@@ -195,7 +195,7 @@ export declare class TreeView<T = unknown> extends Control<HTMLDivElement, TreeV
195
195
  private takeRows;
196
196
  /** The row drawn before for `row`'s key, kept for its new node when what it was drawn with stays; null otherwise. */
197
197
  private keepRow;
198
- /** Lets go of the rows drawn before that were not kept. */
198
+ /** Lets go of the rows drawn before that were not kept: each goes with what it holds, its template's cleanup too. */
199
199
  private dropRows;
200
200
  private addGroup;
201
201
  /**
@@ -214,7 +214,10 @@ export declare class TreeView<T = unknown> extends Control<HTMLDivElement, TreeV
214
214
  private space;
215
215
  private measure;
216
216
  private itemPart;
217
- /** The parts of a row, not kept by the tree yet; what takes its icon and template away again goes to `releases`. */
217
+ /**
218
+ * The parts of a row, not kept by the tree yet. The icon and what the template drew go with the row; the template's
219
+ * cleanup, given to the text part it drew in, runs as the core disposes the row.
220
+ */
218
221
  private rowParts;
219
222
  /** A row's states: level and place, open, selected, checked, enabled, loading. */
220
223
  private renderItem;
@@ -227,9 +230,10 @@ export declare class TreeView<T = unknown> extends Control<HTMLDivElement, TreeV
227
230
  private renderRoving;
228
231
  private renderLook;
229
232
  private renderSearch;
230
- /** Lets go of the row drawn for `node`: what its icon and template hold is released, and the tree keeps it no longer. */
233
+ /** The tree keeps the row drawn for `node` no longer; the row goes with what it holds when it is taken out. */
231
234
  private forget;
232
- private releaseAll;
235
+ /** The tree keeps no row drawn so far, the hidden ones included; they go when the rows are taken out. */
236
+ private forgetAll;
233
237
  private scrollToRow;
234
238
  private focusRow;
235
239
  private listen;
@@ -2,6 +2,10 @@ import type { ComponentBase } from '@motifx/core';
2
2
  /**
3
3
  * Draws the content of a row instead of its text. It can return a cleanup function.
4
4
  *
5
+ * The host goes with its row (drawn again, or the tree gone; a closed row's rows stay drawn), with what was added to
6
+ * it, so a template that only adds components needs no cleanup. The cleanup is for what lives outside the host (a
7
+ * subscription, a timer); it is given to the host and runs once as the host goes, after what the host held.
8
+ *
5
9
  * @param host The place the content goes in: add your components to its `controls`, or give it a text.
6
10
  */
7
11
  export type TreeViewItemTemplate<T> = (item: T, host: ComponentBase<HTMLElement>) => (() => void) | void;
@@ -0,0 +1,7 @@
1
+ import type { View } from './view';
2
+ /**
3
+ * Runs `then` in a task after the next frame of `view`: the frame's own work (style, layout, paint) is done by then, so
4
+ * reading or moving focus there lays nothing out. A window that draws no frames runs it on a timer. Returns what takes
5
+ * it back.
6
+ */
7
+ export declare function afterFrame(view: View, then: () => void): () => void;
@@ -5,3 +5,10 @@ import { type ComponentBase } from '@motifx/core';
5
5
  * runs for an owner disposed by then. Returns what takes it back.
6
6
  */
7
7
  export declare function afterDrawn(owner: ComponentBase, then: () => void): () => void;
8
+ /**
9
+ * Reads once the window of `owner` has drawn its next frame, in one run with every other measure asked for that frame:
10
+ * the page is laid out by then and the reads come before the writes, so nothing is laid out to read. What `write`
11
+ * writes shows a frame later. For a first measure that can wait a frame (a part that clips what does not fit until
12
+ * then). Returns what takes it back.
13
+ */
14
+ export declare function measureAfterDrawn<T>(owner: ComponentBase, read: () => T, write: (value: T) => void): () => void;
@@ -14,7 +14,7 @@ export type { Size } from './size';
14
14
  export type { SizeBox } from './size-box';
15
15
  export type { Viewport } from './viewport-rect';
16
16
  export { everyFrame } from './every-frame';
17
- export { afterDrawn } from './drawn';
17
+ export { afterDrawn, measureAfterDrawn } from './drawn';
18
18
  export { componentAt, shareAlong, visibleRectOf } from './hits';
19
19
  export { lengthOf, probeLengths } from './lengths';
20
20
  export { onLookChange } from './look';
@@ -1,7 +1,7 @@
1
1
  import type { ComponentBase } from '@motifx/core';
2
2
  import type { IconSource } from './icon-source';
3
3
  /**
4
- * Shows an icon in `into`, a part of the kit: an `<img>` for an address, or the app's component. Returns what takes
5
- * it away again (removed and disposed).
4
+ * Shows an icon in `into`, a part of the kit: an `<img>` for an address, or the app's component. It goes with `into`;
5
+ * `clearParts(into)` takes it out for another one.
6
6
  */
7
- export declare function showIcon(source: IconSource, into: ComponentBase): () => void;
7
+ export declare function showIcon(source: IconSource, into: ComponentBase): void;
package/dist/index.d.ts CHANGED
@@ -108,6 +108,7 @@ export type { ItemSource } from './parts/list/item-source';
108
108
  export { DataItems } from './parts/data/DataItems';
109
109
  export { KeyedItems } from './parts/data/KeyedItems';
110
110
  export type { KeyedItem } from './parts/data/keyed-item';
111
+ export type { NormalizeKey } from './parts/data/normalize-key';
111
112
  export type { TextSearch } from './parts/data/text-search';
112
113
  export { readItemField } from './parts/list/read-item-field';
113
114
  export type { ItemField } from './parts/list/item-field';