@nanahoshi/mona-ui 0.51.0 → 0.52.0

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/llms.txt CHANGED
@@ -93,6 +93,7 @@ Mona UI is an Angular component library styled with Tailwind CSS 4. Its componen
93
93
  - [Pager](docs/pager.md): Pagination controls with page buttons, a page-size selector and a page-jump input.
94
94
  - [QR Code](docs/qr-code.md): Encodes text or a URL as a scannable QR code, with logo overlays and PNG, SVG and PDF export.
95
95
  - [Sortable](docs/sortable.md): Lets users reorder any list by dragging or with the keyboard, and move items between connected lists.
96
+ - [Tile View](docs/tile-view.md): A collection as tiles in rows that fill the width, virtualized, with file-explorer selection.
96
97
  - [Timeline](docs/timeline.md): Dated events along a line, down the page or across it, with cards that can open and close.
97
98
  - [Tree View](docs/tree-view.md): Hierarchical data as an expandable, keyboard-navigable tree.
98
99
 
@@ -253,6 +254,7 @@ Mona UI is an Angular component library styled with Tailwind CSS 4. Its componen
253
254
  - [`@nanahoshi/mona-ui/text-area`](docs/api/text-area.md): 1 export, in full.
254
255
  - [`@nanahoshi/mona-ui/text-box`](docs/api/text-box.md): 6 exports, in full.
255
256
  - [`@nanahoshi/mona-ui/theme`](docs/api/theme.md): 54 exports, in full.
257
+ - [`@nanahoshi/mona-ui/tile-view`](docs/api/tile-view.md): 6 exports, in full.
256
258
  - [`@nanahoshi/mona-ui/time-picker`](docs/api/time-picker.md): 2 exports, in full.
257
259
  - [`@nanahoshi/mona-ui/time-selector`](docs/api/time-selector.md): 2 exports, in full.
258
260
  - [`@nanahoshi/mona-ui/timeline`](docs/api/timeline.md): 7 exports, in full.
package/package.json CHANGED
@@ -448,6 +448,10 @@
448
448
  "types": "./types/nanahoshi-mona-ui-timeline.d.ts",
449
449
  "default": "./fesm2022/nanahoshi-mona-ui-timeline.mjs"
450
450
  },
451
+ "./tile-view": {
452
+ "types": "./types/nanahoshi-mona-ui-tile-view.d.ts",
453
+ "default": "./fesm2022/nanahoshi-mona-ui-tile-view.mjs"
454
+ },
451
455
  "./toolbar": {
452
456
  "types": "./types/nanahoshi-mona-ui-toolbar.d.ts",
453
457
  "default": "./fesm2022/nanahoshi-mona-ui-toolbar.mjs"
@@ -552,5 +556,5 @@
552
556
  "default": "./package.json"
553
557
  }
554
558
  },
555
- "version": "0.51.0"
559
+ "version": "0.52.0"
556
560
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "module": "../fesm2022/nanahoshi-mona-ui-tile-view.mjs",
3
+ "typings": "../types/nanahoshi-mona-ui-tile-view.d.ts",
4
+ "types": "../types/nanahoshi-mona-ui-tile-view.d.ts"
5
+ }
@@ -1806,7 +1806,6 @@ declare class GridService {
1806
1806
  readonly groupableOptions: import("@angular/core").WritableSignal<GroupableOptions>;
1807
1807
  readonly hasFooter: import("@angular/core").Signal<boolean>;
1808
1808
  readonly hasLeftLockedColumns: import("@angular/core").Signal<boolean>;
1809
- readonly hasLiveScrollbarGutterWidth: import("@angular/core").Signal<boolean>;
1810
1809
  /** How many group rows sit above the column headers: the deepest `mona-grid-column-group` nesting shown. */
1811
1810
  readonly headerGroupDepth: import("@angular/core").Signal<number>;
1812
1811
  /** The rows of column group headers, outermost first; empty without groups. */
@@ -1964,6 +1963,8 @@ declare class GridService {
1964
1963
  handleRowClick(event: GridSelectionModifiers, row: Row): void;
1965
1964
  handleSingleSelection(event: GridSelectionModifiers, row: Row): void;
1966
1965
  isCellInRange(rowUid: string, columnId: string): boolean;
1966
+ /** Whether the user gave the column its width, by resizing it or through restored state. */
1967
+ isColumnSizedByUser(columnId: string): boolean;
1967
1968
  isGroupCollapsed(groupKey: string): boolean;
1968
1969
  /** Whether a selection value came from the `selectedKeys` input rather than from the user. */
1969
1970
  isLoadedSelection(keys: ImmutableSet<unknown>): boolean;
@@ -1991,6 +1992,8 @@ declare class GridService {
1991
1992
  loadSorts(sorts: Iterable<SortDescriptor> | null | undefined): void;
1992
1993
  /** Sets the expanded tree rows from the `expandedKeys` input, without reporting a change. */
1993
1994
  loadTreeExpandedKeys(keys: Iterable<unknown> | null | undefined): void;
1995
+ /** Records that the user gave the column its width, which `fitView` then keeps as the grid's width changes. */
1996
+ markColumnSizedByUser(columnId: string): void;
1994
1997
  moveGroupColumn(column: Column, moveAs: "prev" | "next"): void;
1995
1998
  normalizeRenderedWidth(width: number): number;
1996
1999
  /** Ends an update whose row left the data or the view; the cancel can't be prevented. */
@@ -2286,9 +2289,11 @@ export declare class GridComponent<T> implements GridVariantInput {
2286
2289
  */
2287
2290
  readonly pageSizeValues: import("@angular/core").InputSignal<number[]>;
2288
2291
  /**
2289
- * @description The method to be used to set initial column widths.
2292
+ * @description The method to be used to size the columns that have no `width`.
2290
2293
  * It can be the following values:
2291
- * - `fitView`: The columns will be resized to fit the available width.
2294
+ * - `fitView`: The columns share the width the other columns leave, and follow the grid's width as it changes,
2295
+ * such as when the window is resized. A column the user resized, or whose width came from restored state,
2296
+ * keeps its width.
2292
2297
  * - `auto`: The columns will be resized based on the content.
2293
2298
  * - A number representing the width of the columns. All columns except the columns with a specified width
2294
2299
  * will have the same width.
@@ -2375,6 +2380,10 @@ export declare class GridComponent<T> implements GridVariantInput {
2375
2380
  protected openColumnFilterMenu(column: Column): void;
2376
2381
  private clampCalculatedWidth;
2377
2382
  private clearDragState;
2383
+ /**
2384
+ * fitView: shares the header's width, less the structural columns and the columns that keep their width, among
2385
+ * the columns that have no `width` and that the user didn't size.
2386
+ */
2378
2387
  private createFitViewWidthMap;
2379
2388
  private getColumnLockBucket;
2380
2389
  private getTableColumnHeaderCellList;
@@ -2385,7 +2394,6 @@ export declare class GridComponent<T> implements GridVariantInput {
2385
2394
  private setDataEffect;
2386
2395
  /** An edit whose row was replaced follows the new data; one whose row left the data or the view ends. */
2387
2396
  private setEditSessionEffect;
2388
- private setFitViewScrollbarSyncEffect;
2389
2397
  private setFooterScrollElementEffect;
2390
2398
  private setGridDetailEffect;
2391
2399
  private setInitialCalculatedWidthOfColumns;
@@ -0,0 +1,314 @@
1
+ import * as i0 from "@angular/core";
2
+ import { TemplateRef } from "@angular/core";
3
+ import { VariantProps } from "class-variance-authority";
4
+ import { VariantInputs } from "@nanahoshi/mona-ui/internal";
5
+ import { CdkVirtualScrollViewport } from "@angular/cdk/scrolling";
6
+ /** A tile was activated: double-clicked, or Enter was pressed on it. */
7
+ interface TileViewItemActivateEvent<T> {
8
+ /** The activated data item. */
9
+ readonly item: T;
10
+ /** The double-click or the key press, so modifier keys can change what activating does. */
11
+ readonly originalEvent: MouseEvent | KeyboardEvent;
12
+ }
13
+ /** The context of a `monaTileViewItemTemplate`: the data item, as `let-item`, and the tile's state. */
14
+ interface TileViewItemTemplateContext<T> {
15
+ /** The data item. */
16
+ readonly $implicit: T;
17
+ /** Whether the tile is the active one, which the keyboard moves from. */
18
+ readonly active: boolean;
19
+ /** The item's position among the items, from 0. */
20
+ readonly index: number;
21
+ /** Whether the item is selected. */
22
+ readonly selected: boolean;
23
+ /**
24
+ * A number no other rendered tile has, which a tile scrolling into view takes over from one that scrolled away.
25
+ * Key work that a newer tile should replace by it, such as a picture request, so that fast scrolling leaves only
26
+ * the tiles in view waiting. It changes when the view's size does.
27
+ */
28
+ readonly slot: number;
29
+ }
30
+ /**
31
+ * How tiles are selected: not at all, one at a time, or several, as in a file explorer, with Ctrl and Shift.
32
+ */
33
+ type TileViewSelectionMode = "multiple" | "none" | "single";
34
+ declare const tileViewBaseThemeVariants: (props?: ({
35
+ rounded?: "small" | "none" | "large" | "medium" | null | undefined;
36
+ size?: "small" | "large" | "medium" | null | undefined;
37
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
38
+ type TileViewBaseVariantProps = VariantProps<typeof tileViewBaseThemeVariants>;
39
+ type TileViewVariantInputs = VariantInputs<TileViewBaseVariantProps>;
40
+ /** A tile of a row, as the template renders it. */
41
+ interface TileCell<T> {
42
+ readonly index: number;
43
+ readonly item: T;
44
+ readonly key: unknown;
45
+ }
46
+ /**
47
+ * A collection shown as tiles of one size, in rows that fill the width, like the icons of a file explorer. Only the
48
+ * rows in view are rendered, so it stays fast with tens of thousands of items. It is one Tab stop: the arrow keys
49
+ * move in two dimensions, and selection works as in a file explorer, with Ctrl and Shift.
50
+ */
51
+ export declare class TileViewComponent<T = unknown> implements TileViewVariantInputs {
52
+ #private;
53
+ /** The active tile's id, while the view has the focus and the tile is rendered. */
54
+ protected readonly activeDescendant: import("@angular/core").Signal<string | null>;
55
+ /** The active tile's index: the keyboard moves from it, and Enter activates it. -1 when there is none. */
56
+ protected readonly activeIndex: import("@angular/core").Signal<number>;
57
+ protected readonly baseClasses: import("@angular/core").Signal<string>;
58
+ protected readonly columnCount: import("@angular/core").Signal<number>;
59
+ protected readonly count: import("@angular/core").Signal<number>;
60
+ protected readonly itemTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
61
+ /** How far past the edges rows are rendered: at least a row, refilled to two. */
62
+ protected readonly maxBufferPx: import("@angular/core").Signal<number>;
63
+ protected readonly messages: import("@angular/core").Signal<import("@nanahoshi/mona-ui/i18n").MonaListMessages>;
64
+ protected readonly minBufferPx: import("@angular/core").Signal<number>;
65
+ protected readonly noDataId: string;
66
+ protected readonly noDataTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
67
+ protected readonly role: import("@angular/core").Signal<"listbox" | "list">;
68
+ protected readonly rowHeight: import("@angular/core").Signal<number>;
69
+ /** The items in rows of as many tiles as fit. */
70
+ protected readonly rows: import("@angular/core").Signal<TileCell<T>[][]>;
71
+ /**
72
+ * How many tiles can be rendered at once: the rows in view and the buffers on both sides, as the fixed-size
73
+ * strategy fills them, with a row to spare at each end for a partly visible one. Rendered tiles are consecutive,
74
+ * so their indices modulo this are all different.
75
+ */
76
+ protected readonly slotCount: import("@angular/core").Signal<number>;
77
+ /** Polite status text: loading, or the empty state, unless a no-data template says it in its own words. */
78
+ protected readonly statusText: import("@angular/core").Signal<string>;
79
+ protected readonly tileRole: import("@angular/core").Signal<"option" | "listitem">;
80
+ protected readonly viewport: import("@angular/core").Signal<CdkVirtualScrollViewport>;
81
+ protected readonly viewportClasses: import("@angular/core").Signal<string>;
82
+ /**
83
+ * @description Accessible name of the tiles' listbox. Describe what the tiles show.
84
+ * @default ""
85
+ */
86
+ readonly ariaLabel: import("@angular/core").InputSignal<string>;
87
+ /**
88
+ * @description Id of the element that names the tiles' listbox, as an alternative to `aria-label`.
89
+ * @default ""
90
+ */
91
+ readonly ariaLabelledBy: import("@angular/core").InputSignal<string>;
92
+ /**
93
+ * @description How many tiles a row holds: as many as fit the width, or a fixed number.
94
+ * @default auto
95
+ */
96
+ readonly columns: import("@angular/core").InputSignal<number | "auto">;
97
+ /**
98
+ * @description Space between tiles, and around them, in pixels.
99
+ * @default 4
100
+ */
101
+ readonly gap: import("@angular/core").InputSignal<number>;
102
+ /**
103
+ * @description Emitted when a tile is double-clicked, or Enter is pressed on the active tile, with the item and
104
+ * the event, so modifier keys can change what activating does.
105
+ */
106
+ readonly itemActivate: import("@angular/core").OutputEmitterRef<TileViewItemActivateEvent<T>>;
107
+ /**
108
+ * @description Property name or function that gives each item's key, which `selectedKeys` holds and tiles are
109
+ * tracked by. Keys must be unique. Without it, the item itself is its key.
110
+ * @default ""
111
+ */
112
+ readonly itemKey: import("@angular/core").InputSignal<string | ((item: T) => unknown)>;
113
+ /**
114
+ * @description Collection of items to show as tiles.
115
+ * @default []
116
+ */
117
+ readonly items: import("@angular/core").InputSignal<Iterable<T>>;
118
+ /**
119
+ * @description Marks the tiles as loading: the listbox gets `aria-busy` and a polite "Loading" status.
120
+ * @default false
121
+ */
122
+ readonly loading: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
123
+ /**
124
+ * @description Border-radius preset applied to the component.
125
+ * @default medium
126
+ */
127
+ readonly rounded: import("@angular/core").InputSignal<"small" | "none" | "large" | "medium" | null | undefined>;
128
+ /**
129
+ * @description Keys of the selected items. Changes the user makes are emitted through `selectedKeysChange`, so
130
+ * `[(selectedKeys)]` works; keys set here aren't emitted back. When they leave the active tile unselected, the
131
+ * first selected tile becomes active and is scrolled into view.
132
+ * @default []
133
+ */
134
+ readonly selectedKeys: import("@angular/core").ModelSignal<readonly unknown[]>;
135
+ /**
136
+ * @description How tiles are selected. `"multiple"` works as in a file explorer: a click selects one tile,
137
+ * Ctrl+click toggles one, Shift+click selects a range, and Ctrl+A selects all. `"none"` makes the tiles a plain
138
+ * list.
139
+ * @default single
140
+ */
141
+ readonly selectionMode: import("@angular/core").InputSignal<TileViewSelectionMode>;
142
+ /**
143
+ * @description Size preset controlling the component's text size.
144
+ * @default medium
145
+ */
146
+ readonly size: import("@angular/core").InputSignal<"small" | "large" | "medium" | null | undefined>;
147
+ /**
148
+ * @description Property name or function that gives an item's text, which typeahead matches and a tile shows
149
+ * without an item template. Without it, the item itself is converted to text.
150
+ * @default ""
151
+ */
152
+ readonly textField: import("@angular/core").InputSignal<string | ((item: T) => string)>;
153
+ /**
154
+ * @description Height of every tile, in pixels. Tiles must all be this tall for scrolling to stay accurate.
155
+ * @default 112
156
+ */
157
+ readonly tileHeight: import("@angular/core").InputSignal<number>;
158
+ /**
159
+ * @description Width of every tile, in pixels.
160
+ * @default 112
161
+ */
162
+ readonly tileWidth: import("@angular/core").InputSignal<number>;
163
+ /**
164
+ * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
165
+ * @default ""
166
+ */
167
+ readonly userClass: import("@angular/core").InputSignal<string>;
168
+ constructor();
169
+ /**
170
+ * Scrolls the tile of the item with this key into view, if it isn't in view already.
171
+ * @param key The item's key, as `itemKey` gives it.
172
+ */
173
+ scrollToItem(key: unknown): void;
174
+ protected contextOf(cell: TileCell<T>): TileViewItemTemplateContext<T>;
175
+ protected isSelected(cell: TileCell<T>): boolean;
176
+ protected onBlur(): void;
177
+ protected onFocus(): void;
178
+ protected onKeydown(event: KeyboardEvent): void;
179
+ protected onPointerDown(): void;
180
+ protected onTileClick(event: MouseEvent, index: number): void;
181
+ protected onTileDoubleClick(event: MouseEvent, index: number): void;
182
+ /** A click on no tile clears the selection, as in a file explorer, unless Ctrl or Shift is held. */
183
+ protected onViewportClick(event: MouseEvent): void;
184
+ protected textOf(item: T): string;
185
+ protected tileClasses(cell: TileCell<T>): string;
186
+ protected tileId(index: number): string;
187
+ protected trackRow(index: number): number;
188
+ /** Typeahead: the next tile whose text starts with what was typed, from the active one on. */
189
+ private findByText;
190
+ private focusViewport;
191
+ private matchesFocusVisible;
192
+ /** The keyboard moved the active tile: it scrolls into view and, unless Ctrl is held, is selected. */
193
+ private moveTo;
194
+ private observeViewport;
195
+ /** Reports a selection the user made, unless it is the one there already. */
196
+ private report;
197
+ private scrollToIndex;
198
+ /**
199
+ * Selects as a file explorer does. A click or a key alone selects the one tile; Shift selects from the anchor to
200
+ * it, and Ctrl with Shift adds that range. Ctrl+click toggles a tile.
201
+ */
202
+ private select;
203
+ /** Space selects the active tile, adding it to the selection; Ctrl+Space toggles it. */
204
+ private selectWithSpace;
205
+ private setActive;
206
+ static ɵfac: i0.ɵɵFactoryDeclaration<TileViewComponent<any>, never>;
207
+ static ɵcmp: i0.ɵɵComponentDeclaration<TileViewComponent<any>, "mona-tile-view", never, {
208
+ "ariaLabel": {
209
+ "alias": "aria-label";
210
+ "required": false;
211
+ "isSignal": true;
212
+ };
213
+ "ariaLabelledBy": {
214
+ "alias": "aria-labelledby";
215
+ "required": false;
216
+ "isSignal": true;
217
+ };
218
+ "columns": {
219
+ "alias": "columns";
220
+ "required": false;
221
+ "isSignal": true;
222
+ };
223
+ "gap": {
224
+ "alias": "gap";
225
+ "required": false;
226
+ "isSignal": true;
227
+ };
228
+ "itemKey": {
229
+ "alias": "itemKey";
230
+ "required": false;
231
+ "isSignal": true;
232
+ };
233
+ "items": {
234
+ "alias": "items";
235
+ "required": false;
236
+ "isSignal": true;
237
+ };
238
+ "loading": {
239
+ "alias": "loading";
240
+ "required": false;
241
+ "isSignal": true;
242
+ };
243
+ "rounded": {
244
+ "alias": "rounded";
245
+ "required": false;
246
+ "isSignal": true;
247
+ };
248
+ "selectedKeys": {
249
+ "alias": "selectedKeys";
250
+ "required": false;
251
+ "isSignal": true;
252
+ };
253
+ "selectionMode": {
254
+ "alias": "selectionMode";
255
+ "required": false;
256
+ "isSignal": true;
257
+ };
258
+ "size": {
259
+ "alias": "size";
260
+ "required": false;
261
+ "isSignal": true;
262
+ };
263
+ "textField": {
264
+ "alias": "textField";
265
+ "required": false;
266
+ "isSignal": true;
267
+ };
268
+ "tileHeight": {
269
+ "alias": "tileHeight";
270
+ "required": false;
271
+ "isSignal": true;
272
+ };
273
+ "tileWidth": {
274
+ "alias": "tileWidth";
275
+ "required": false;
276
+ "isSignal": true;
277
+ };
278
+ "userClass": {
279
+ "alias": "class";
280
+ "required": false;
281
+ "isSignal": true;
282
+ };
283
+ }, {
284
+ "itemActivate": "itemActivate";
285
+ "selectedKeys": "selectedKeysChange";
286
+ }, ["itemTemplate", "noDataTemplate"], never, true, never>;
287
+ }
288
+ /**
289
+ * Template for each tile of a tile view. The data item is the template's implicit value (`let-item`), and `selected`,
290
+ * `active` and `index` describe the tile. Bind the tile view's items to `monaTileViewItemTemplateOf` to type the item;
291
+ * without it, the item is `any` in templates.
292
+ */
293
+ export declare class TileViewItemTemplateDirective<T = any> {
294
+ /**
295
+ * @description The tile view's items, used only to type the template's item. Optional.
296
+ * @default null
297
+ */
298
+ readonly monaTileViewItemTemplateOf: import("@angular/core").InputSignal<Iterable<T> | null | undefined>;
299
+ static ngTemplateContextGuard<T>(_directive: TileViewItemTemplateDirective<T>, _context: unknown): _context is TileViewItemTemplateContext<T>;
300
+ static ɵfac: i0.ɵɵFactoryDeclaration<TileViewItemTemplateDirective<any>, never>;
301
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TileViewItemTemplateDirective<any>, "ng-template[monaTileViewItemTemplate]", never, {
302
+ "monaTileViewItemTemplateOf": {
303
+ "alias": "monaTileViewItemTemplateOf";
304
+ "required": false;
305
+ "isSignal": true;
306
+ };
307
+ }, {}, never, never, true, never>;
308
+ }
309
+ /** Template shown in place of the tiles while there are no items. */
310
+ export declare class TileViewNoDataTemplateDirective {
311
+ static ɵfac: i0.ɵɵFactoryDeclaration<TileViewNoDataTemplateDirective, never>;
312
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TileViewNoDataTemplateDirective, "ng-template[monaTileViewNoDataTemplate]", never, {}, {}, never, never, true, never>;
313
+ }
314
+ export type { TileViewItemActivateEvent, TileViewItemTemplateContext, TileViewSelectionMode };