@molecule/app-list-item-row-angular 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -43
- package/dist/list-item-row.component.d.ts +15 -30
- package/dist/list-item-row.component.d.ts.map +1 -1
- package/dist/list-item-row.component.js +25 -48
- package/dist/list-item-row.component.js.map +1 -1
- package/package.json +7 -7
- package/dist/slot-dom.d.ts +0 -60
- package/dist/slot-dom.d.ts.map +0 -1
- package/dist/slot-dom.js +0 -108
- package/dist/slot-dom.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-28T22:54:26.906Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-list-item-row-angular
|
|
@@ -155,13 +155,15 @@ The node props are projected slots: `title` renders inside the title line,
|
|
|
155
155
|
`subtitle` inside its line, `metadata` inside its line, `leading` inside the
|
|
156
156
|
leading `<div>` and `actions` inside the right-side `<div>`. String inputs
|
|
157
157
|
render as text instead — React's truthiness branch applies: an empty string
|
|
158
|
-
renders nothing. The conditionally-rendered wrappers
|
|
159
|
-
|
|
158
|
+
renders nothing. The conditionally-rendered wrappers are taken out of the DOM
|
|
159
|
+
when React renders nothing ({@link setElementPresent}) in
|
|
160
|
+
{@link ListItemRow.reconcile}.
|
|
160
161
|
|
|
161
162
|
```typescript
|
|
162
163
|
@Component({
|
|
163
164
|
selector: 'div[mol-list-item-row]',
|
|
164
165
|
standalone: true,
|
|
166
|
+
hostDirectives: [MolPlacement],
|
|
165
167
|
imports: [OptimisticToggleButton],
|
|
166
168
|
inputs: [
|
|
167
169
|
'title',
|
|
@@ -244,47 +246,47 @@ in {@link ListItemRow.ngAfterViewInit}.
|
|
|
244
246
|
<ng-content select="[slot=actions]"></ng-content>
|
|
245
247
|
</div>`,
|
|
246
248
|
})
|
|
247
|
-
export class ListItemRow
|
|
249
|
+
export class ListItemRow {
|
|
250
|
+
/** Title — first line (string/number renders as text; nodes are `[slot=title]` content). */
|
|
248
251
|
title?: unknown
|
|
252
|
+
/** Optional second line (string/number as text; nodes are `[slot=subtitle]` content). */
|
|
249
253
|
subtitle?: unknown
|
|
254
|
+
/** Optional third line (string/number as text; nodes are `[slot=metadata]` content). */
|
|
250
255
|
metadata?: unknown
|
|
256
|
+
/** Optional leading slot — icon, avatar, thumbnail (`[slot=leading]` content, or text). */
|
|
251
257
|
leading?: unknown
|
|
252
258
|
/** Optional right-side actions (`[slot=actions]` content, or text). */
|
|
253
259
|
actions?: unknown
|
|
254
260
|
toggle?: ListItemRowProps['toggle']
|
|
255
261
|
/** Called when the row is activated (React's `onClick`, called bare). */
|
|
256
262
|
onClick?: () => void
|
|
263
|
+
/** When true, sets `aria-current="true"` on the row — no built-in visual highlight. */
|
|
257
264
|
selected?: boolean
|
|
265
|
+
/** When true, renders in a disabled visual state and disables the open button. */
|
|
258
266
|
disabled?: boolean
|
|
259
267
|
/** Dense vs comfortable spacing. */
|
|
260
268
|
density?: 'comfortable' | 'compact'
|
|
261
269
|
/** Extra classes. */
|
|
262
270
|
className?: string
|
|
263
271
|
|
|
272
|
+
/** Next value of the module-wide instance counter (React `useId()`'s counterpart). */
|
|
264
273
|
private static nextNameId = 0
|
|
265
274
|
|
|
275
|
+
/** The title line's id — the open button's `aria-labelledby` (React's `useId`). */
|
|
266
276
|
readonly nameId = `list-item-row-title-${ListItemRow.nextNameId++}`
|
|
267
277
|
|
|
268
|
-
/** The leading wrapper (
|
|
278
|
+
/** The leading wrapper (absent when no leading value and the slot is empty). */
|
|
269
279
|
@ViewChild('leadingWrap') leadingWrap?: ElementRef<HTMLElement>
|
|
270
|
-
/** The subtitle line (
|
|
280
|
+
/** The subtitle line (absent when no subtitle value and the slot is empty). */
|
|
271
281
|
@ViewChild('subtitleWrap') subtitleWrap?: ElementRef<HTMLElement>
|
|
272
|
-
/** The metadata line (
|
|
282
|
+
/** The metadata line (absent when no metadata value and the slot is empty). */
|
|
273
283
|
@ViewChild('metadataWrap') metadataWrap?: ElementRef<HTMLElement>
|
|
274
|
-
/** The actions wrapper (
|
|
284
|
+
/** The actions wrapper (absent when no actions value and the slot is empty). */
|
|
275
285
|
@ViewChild('actionsWrap') actionsWrap?: ElementRef<HTMLElement>
|
|
276
286
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
/** Whether the subtitle slot holds content (read once with the slots). */
|
|
281
|
-
private hasSubtitleSlot = false
|
|
282
|
-
/** Whether the metadata slot holds content (read once with the slots). */
|
|
283
|
-
private hasMetadataSlot = false
|
|
284
|
-
/** Whether the actions slot holds content (read once with the slots). */
|
|
285
|
-
private hasActionsSlot = false
|
|
286
|
-
|
|
287
|
-
private readonly guard = new SlotGuard(inject(ElementRef), inject(Renderer2))
|
|
287
|
+
constructor() {
|
|
288
|
+
usePlacement((hasContent) => this.reconcile(hasContent))
|
|
289
|
+
}
|
|
288
290
|
|
|
289
291
|
/** The current class map. */
|
|
290
292
|
cm(): UIClassMap {
|
|
@@ -333,6 +335,7 @@ export class ListItemRow implements AfterViewInit, AfterViewChecked {
|
|
|
333
335
|
return this.cm().cn(this.cm().shrink0, this.cm().position('relative'))
|
|
334
336
|
}
|
|
335
337
|
|
|
338
|
+
/** Computes the title line's class (`cm.textSize('sm')` + `cm.fontWeight('semibold')`). */
|
|
336
339
|
titleClass(): string {
|
|
337
340
|
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('semibold'))
|
|
338
341
|
}
|
|
@@ -379,44 +382,29 @@ export class ListItemRow implements AfterViewInit, AfterViewChecked {
|
|
|
379
382
|
: ''
|
|
380
383
|
}
|
|
381
384
|
|
|
385
|
+
/** Runs the row's open action, the way React forwards the open button's click (bare, no event). */
|
|
382
386
|
handleClick(): void {
|
|
383
387
|
if (this.disabled) return
|
|
384
388
|
this.onClick?.()
|
|
385
389
|
}
|
|
386
390
|
|
|
387
|
-
|
|
388
|
-
this.reconcile()
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
ngAfterViewChecked(): void {
|
|
392
|
-
this.reconcile()
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
private reconcile(): void {
|
|
391
|
+
private reconcile(hasContent: SlotReader): void {
|
|
396
392
|
const leading = this.leadingWrap?.nativeElement
|
|
397
393
|
const subtitle = this.subtitleWrap?.nativeElement
|
|
398
394
|
const metadata = this.metadataWrap?.nativeElement
|
|
399
395
|
const actions = this.actionsWrap?.nativeElement
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
this.hasActionsSlot = hasNodes(actions)
|
|
405
|
-
this.slotsRead = true
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
this.guard.toggle(leading, this.leadingText() !== '' || this.hasLeadingSlot)
|
|
409
|
-
this.guard.toggle(subtitle, this.subtitleText() !== '' || this.hasSubtitleSlot)
|
|
410
|
-
this.guard.toggle(metadata, this.metadataText() !== '' || this.hasMetadataSlot)
|
|
411
|
-
this.guard.toggle(
|
|
396
|
+
setElementPresent(leading, this.leadingText() !== '' || hasContent(leading))
|
|
397
|
+
setElementPresent(subtitle, this.subtitleText() !== '' || hasContent(subtitle))
|
|
398
|
+
setElementPresent(metadata, this.metadataText() !== '' || hasContent(metadata))
|
|
399
|
+
setElementPresent(
|
|
412
400
|
actions,
|
|
413
|
-
this.actionsText() !== '' ||
|
|
401
|
+
this.actionsText() !== '' || hasContent(actions) || Boolean(this.toggle),
|
|
414
402
|
)
|
|
415
403
|
}
|
|
416
404
|
}
|
|
417
405
|
```
|
|
418
406
|
|
|
419
|
-
_(Member comments are shortened to their first sentence, and the
|
|
407
|
+
_(Member comments are shortened to their first sentence, and the 8 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-list-item-row-angular/dist/list-item-row.component.d.ts`.)_
|
|
420
408
|
|
|
421
409
|
## Injection Notes
|
|
422
410
|
|
|
@@ -427,7 +415,7 @@ Peer dependencies:
|
|
|
427
415
|
- `@angular/common` ^22.0.0
|
|
428
416
|
- `@angular/core` ^22.0.0
|
|
429
417
|
- `@angular/platform-browser` ^22.0.0
|
|
430
|
-
- `@molecule/app-angular` ^3.
|
|
418
|
+
- `@molecule/app-angular` ^3.13.0 || ^4.0.0
|
|
431
419
|
- `@molecule/app-ui` ^1.0.1
|
|
432
420
|
- `@molecule/app-ui-angular` ^1.1.0
|
|
433
421
|
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { type
|
|
6
|
+
import { type ElementRef } from '@angular/core';
|
|
7
7
|
import type { UIClassMap } from '@molecule/app-ui';
|
|
8
8
|
import type { ListItemRowProps } from './types.js';
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
10
|
+
import * as i1 from "@molecule/app-angular";
|
|
10
11
|
/**
|
|
11
12
|
* ListItemRow component.
|
|
12
13
|
*
|
|
@@ -29,10 +30,11 @@ import * as i0 from "@angular/core";
|
|
|
29
30
|
* `subtitle` inside its line, `metadata` inside its line, `leading` inside the
|
|
30
31
|
* leading `<div>` and `actions` inside the right-side `<div>`. String inputs
|
|
31
32
|
* render as text instead — React's truthiness branch applies: an empty string
|
|
32
|
-
* renders nothing. The conditionally-rendered wrappers
|
|
33
|
-
*
|
|
33
|
+
* renders nothing. The conditionally-rendered wrappers are taken out of the DOM
|
|
34
|
+
* when React renders nothing ({@link setElementPresent}) in
|
|
35
|
+
* {@link ListItemRow.reconcile}.
|
|
34
36
|
*/
|
|
35
|
-
export declare class ListItemRow
|
|
37
|
+
export declare class ListItemRow {
|
|
36
38
|
/** Title — first line (string/number renders as text; nodes are `[slot=title]` content). */
|
|
37
39
|
title?: unknown;
|
|
38
40
|
/** Optional second line (string/number as text; nodes are `[slot=subtitle]` content). */
|
|
@@ -63,25 +65,15 @@ export declare class ListItemRow implements AfterViewInit, AfterViewChecked {
|
|
|
63
65
|
private static nextNameId;
|
|
64
66
|
/** The title line's id — the open button's `aria-labelledby` (React's `useId`). */
|
|
65
67
|
readonly nameId: string;
|
|
66
|
-
/** The leading wrapper (
|
|
68
|
+
/** The leading wrapper (absent when no leading value and the slot is empty). */
|
|
67
69
|
leadingWrap?: ElementRef<HTMLElement>;
|
|
68
|
-
/** The subtitle line (
|
|
70
|
+
/** The subtitle line (absent when no subtitle value and the slot is empty). */
|
|
69
71
|
subtitleWrap?: ElementRef<HTMLElement>;
|
|
70
|
-
/** The metadata line (
|
|
72
|
+
/** The metadata line (absent when no metadata value and the slot is empty). */
|
|
71
73
|
metadataWrap?: ElementRef<HTMLElement>;
|
|
72
|
-
/** The actions wrapper (
|
|
74
|
+
/** The actions wrapper (absent when no actions value and the slot is empty). */
|
|
73
75
|
actionsWrap?: ElementRef<HTMLElement>;
|
|
74
|
-
|
|
75
|
-
private slotsRead;
|
|
76
|
-
/** Whether the leading slot holds content (read once with the slots). */
|
|
77
|
-
private hasLeadingSlot;
|
|
78
|
-
/** Whether the subtitle slot holds content (read once with the slots). */
|
|
79
|
-
private hasSubtitleSlot;
|
|
80
|
-
/** Whether the metadata slot holds content (read once with the slots). */
|
|
81
|
-
private hasMetadataSlot;
|
|
82
|
-
/** Whether the actions slot holds content (read once with the slots). */
|
|
83
|
-
private hasActionsSlot;
|
|
84
|
-
private readonly guard;
|
|
76
|
+
constructor();
|
|
85
77
|
/**
|
|
86
78
|
* The current class map.
|
|
87
79
|
* @returns The UIClassMap.
|
|
@@ -179,22 +171,15 @@ export declare class ListItemRow implements AfterViewInit, AfterViewChecked {
|
|
|
179
171
|
* synthetic one.
|
|
180
172
|
*/
|
|
181
173
|
handleClick(): void;
|
|
182
|
-
/** Reads slot presence (view queries resolve only at view init) and reconciles the wrappers. */
|
|
183
|
-
ngAfterViewInit(): void;
|
|
184
|
-
/**
|
|
185
|
-
* Re-reconciles after every view refresh (a props step may add or remove a
|
|
186
|
-
* value): the wrappers are toggled on the values the template just
|
|
187
|
-
* rendered, so a later props step lands in one pass.
|
|
188
|
-
*/
|
|
189
|
-
ngAfterViewChecked(): void;
|
|
190
174
|
/**
|
|
191
175
|
* Applies React's conditions: the leading, subtitle, metadata and actions
|
|
192
176
|
* wrappers render only when their input holds text or their slot holds
|
|
193
|
-
* projected content.
|
|
194
|
-
*
|
|
177
|
+
* projected content.
|
|
178
|
+
*
|
|
179
|
+
* @param hasContent - Reads whether a slot has content.
|
|
195
180
|
*/
|
|
196
181
|
private reconcile;
|
|
197
182
|
static ɵfac: i0.ɵɵFactoryDeclaration<ListItemRow, never>;
|
|
198
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ListItemRow, "div[mol-list-item-row]", never, { "title": { "alias": "title"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "metadata": { "alias": "metadata"; "required": false; }; "leading": { "alias": "leading"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; "toggle": { "alias": "toggle"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "density": { "alias": "density"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=leading]", "[slot=title]", "[slot=subtitle]", "[slot=metadata]", "[slot=actions]"], true,
|
|
183
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ListItemRow, "div[mol-list-item-row]", never, { "title": { "alias": "title"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "metadata": { "alias": "metadata"; "required": false; }; "leading": { "alias": "leading"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; "toggle": { "alias": "toggle"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "density": { "alias": "density"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=leading]", "[slot=title]", "[slot=subtitle]", "[slot=metadata]", "[slot=actions]"], true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
199
184
|
}
|
|
200
185
|
//# sourceMappingURL=list-item-row.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item-row.component.d.ts","sourceRoot":"","sources":["../src/list-item-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"list-item-row.component.d.ts","sourceRoot":"","sources":["../src/list-item-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAa,KAAK,UAAU,EAAa,MAAM,eAAe,CAAA;AAQrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;;;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAsFa,WAAW;IACtB,4FAA4F;IAC5F,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,yFAAyF;IACzF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,oGAAoG;IACpG,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,8EAA8E;IAC9E,OAAO,CAA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@@ -3,11 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { Component,
|
|
6
|
+
import { Component, ViewChild } from '@angular/core';
|
|
7
|
+
import { MolPlacement, setElementPresent, usePlacement, } from '@molecule/app-angular';
|
|
7
8
|
import { getClassMap } from '@molecule/app-ui';
|
|
8
9
|
import { OptimisticToggleButton } from '@molecule/app-ui-angular';
|
|
9
|
-
import { hasNodes, SlotGuard } from './slot-dom.js';
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
11
|
+
import * as i1 from "@molecule/app-angular";
|
|
11
12
|
const _c0 = ["leadingWrap"];
|
|
12
13
|
const _c1 = ["subtitleWrap"];
|
|
13
14
|
const _c2 = ["metadataWrap"];
|
|
@@ -91,8 +92,9 @@ function ListItemRow_Conditional_20_Template(rf, ctx) { if (rf & 1) {
|
|
|
91
92
|
* `subtitle` inside its line, `metadata` inside its line, `leading` inside the
|
|
92
93
|
* leading `<div>` and `actions` inside the right-side `<div>`. String inputs
|
|
93
94
|
* render as text instead — React's truthiness branch applies: an empty string
|
|
94
|
-
* renders nothing. The conditionally-rendered wrappers
|
|
95
|
-
*
|
|
95
|
+
* renders nothing. The conditionally-rendered wrappers are taken out of the DOM
|
|
96
|
+
* when React renders nothing ({@link setElementPresent}) in
|
|
97
|
+
* {@link ListItemRow.reconcile}.
|
|
96
98
|
*/
|
|
97
99
|
export class ListItemRow {
|
|
98
100
|
/** Title — first line (string/number renders as text; nodes are `[slot=title]` content). */
|
|
@@ -125,25 +127,17 @@ export class ListItemRow {
|
|
|
125
127
|
static nextNameId = 0;
|
|
126
128
|
/** The title line's id — the open button's `aria-labelledby` (React's `useId`). */
|
|
127
129
|
nameId = `list-item-row-title-${ListItemRow.nextNameId++}`;
|
|
128
|
-
/** The leading wrapper (
|
|
130
|
+
/** The leading wrapper (absent when no leading value and the slot is empty). */
|
|
129
131
|
leadingWrap;
|
|
130
|
-
/** The subtitle line (
|
|
132
|
+
/** The subtitle line (absent when no subtitle value and the slot is empty). */
|
|
131
133
|
subtitleWrap;
|
|
132
|
-
/** The metadata line (
|
|
134
|
+
/** The metadata line (absent when no metadata value and the slot is empty). */
|
|
133
135
|
metadataWrap;
|
|
134
|
-
/** The actions wrapper (
|
|
136
|
+
/** The actions wrapper (absent when no actions value and the slot is empty). */
|
|
135
137
|
actionsWrap;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
hasLeadingSlot = false;
|
|
140
|
-
/** Whether the subtitle slot holds content (read once with the slots). */
|
|
141
|
-
hasSubtitleSlot = false;
|
|
142
|
-
/** Whether the metadata slot holds content (read once with the slots). */
|
|
143
|
-
hasMetadataSlot = false;
|
|
144
|
-
/** Whether the actions slot holds content (read once with the slots). */
|
|
145
|
-
hasActionsSlot = false;
|
|
146
|
-
guard = new SlotGuard(inject(ElementRef), inject(Renderer2));
|
|
138
|
+
constructor() {
|
|
139
|
+
usePlacement((hasContent) => this.reconcile(hasContent));
|
|
140
|
+
}
|
|
147
141
|
/**
|
|
148
142
|
* The current class map.
|
|
149
143
|
* @returns The UIClassMap.
|
|
@@ -287,40 +281,22 @@ export class ListItemRow {
|
|
|
287
281
|
return;
|
|
288
282
|
this.onClick?.();
|
|
289
283
|
}
|
|
290
|
-
/** Reads slot presence (view queries resolve only at view init) and reconciles the wrappers. */
|
|
291
|
-
ngAfterViewInit() {
|
|
292
|
-
this.reconcile();
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Re-reconciles after every view refresh (a props step may add or remove a
|
|
296
|
-
* value): the wrappers are toggled on the values the template just
|
|
297
|
-
* rendered, so a later props step lands in one pass.
|
|
298
|
-
*/
|
|
299
|
-
ngAfterViewChecked() {
|
|
300
|
-
this.reconcile();
|
|
301
|
-
}
|
|
302
284
|
/**
|
|
303
285
|
* Applies React's conditions: the leading, subtitle, metadata and actions
|
|
304
286
|
* wrappers render only when their input holds text or their slot holds
|
|
305
|
-
* projected content.
|
|
306
|
-
*
|
|
287
|
+
* projected content.
|
|
288
|
+
*
|
|
289
|
+
* @param hasContent - Reads whether a slot has content.
|
|
307
290
|
*/
|
|
308
|
-
reconcile() {
|
|
291
|
+
reconcile(hasContent) {
|
|
309
292
|
const leading = this.leadingWrap?.nativeElement;
|
|
310
293
|
const subtitle = this.subtitleWrap?.nativeElement;
|
|
311
294
|
const metadata = this.metadataWrap?.nativeElement;
|
|
312
295
|
const actions = this.actionsWrap?.nativeElement;
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
this.hasActionsSlot = hasNodes(actions);
|
|
318
|
-
this.slotsRead = true;
|
|
319
|
-
}
|
|
320
|
-
this.guard.toggle(leading, this.leadingText() !== '' || this.hasLeadingSlot);
|
|
321
|
-
this.guard.toggle(subtitle, this.subtitleText() !== '' || this.hasSubtitleSlot);
|
|
322
|
-
this.guard.toggle(metadata, this.metadataText() !== '' || this.hasMetadataSlot);
|
|
323
|
-
this.guard.toggle(actions, this.actionsText() !== '' || this.hasActionsSlot || Boolean(this.toggle));
|
|
296
|
+
setElementPresent(leading, this.leadingText() !== '' || hasContent(leading));
|
|
297
|
+
setElementPresent(subtitle, this.subtitleText() !== '' || hasContent(subtitle));
|
|
298
|
+
setElementPresent(metadata, this.metadataText() !== '' || hasContent(metadata));
|
|
299
|
+
setElementPresent(actions, this.actionsText() !== '' || hasContent(actions) || Boolean(this.toggle));
|
|
324
300
|
}
|
|
325
301
|
static ɵfac = function ListItemRow_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ListItemRow)(); };
|
|
326
302
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ListItemRow, selectors: [["div", "mol-list-item-row", ""]], viewQuery: function ListItemRow_Query(rf, ctx) { if (rf & 1) {
|
|
@@ -335,7 +311,7 @@ export class ListItemRow {
|
|
|
335
311
|
i0.ɵɵattribute("aria-current", ctx.selected ? "true" : null)("aria-disabled", ctx.disabled ?? null);
|
|
336
312
|
i0.ɵɵclassMap(ctx.classes());
|
|
337
313
|
i0.ɵɵstyleProp("opacity", ctx.disabled ? 0.5 : null);
|
|
338
|
-
} }, inputs: { title: "title", subtitle: "subtitle", metadata: "metadata", leading: "leading", actions: "actions", toggle: "toggle", onClick: "onClick", selected: "selected", disabled: "disabled", density: "density", className: "className" }, ngContentSelectors: _c5, decls: 22, vars: 20, consts: [["leadingWrap", ""], ["subtitleWrap", ""], ["metadataWrap", ""], ["actionsWrap", ""], ["type", "button", "data-mol-id", "list-item-row-open", 2, "background", "transparent", "border", "medium", "padding", "0px", 3, "class"], ["mol-optimistic-toggle-button", "", 3, "value", "commit", "onError", "variant", "color", "size", "fullWidth", "disabled", "className", "testId"], ["type", "button", "data-mol-id", "list-item-row-open", 2, "background", "transparent", "border", "medium", "padding", "0px", 3, "click"], ["slot", "activeLabel"], ["slot", "inactiveLabel"]], template: function ListItemRow_Template(rf, ctx) { if (rf & 1) {
|
|
314
|
+
} }, inputs: { title: "title", subtitle: "subtitle", metadata: "metadata", leading: "leading", actions: "actions", toggle: "toggle", onClick: "onClick", selected: "selected", disabled: "disabled", density: "density", className: "className" }, features: [i0.ɵɵHostDirectivesFeature([i1.MolPlacement])], ngContentSelectors: _c5, decls: 22, vars: 20, consts: [["leadingWrap", ""], ["subtitleWrap", ""], ["metadataWrap", ""], ["actionsWrap", ""], ["type", "button", "data-mol-id", "list-item-row-open", 2, "background", "transparent", "border", "medium", "padding", "0px", 3, "class"], ["mol-optimistic-toggle-button", "", 3, "value", "commit", "onError", "variant", "color", "size", "fullWidth", "disabled", "className", "testId"], ["type", "button", "data-mol-id", "list-item-row-open", 2, "background", "transparent", "border", "medium", "padding", "0px", 3, "click"], ["slot", "activeLabel"], ["slot", "inactiveLabel"]], template: function ListItemRow_Template(rf, ctx) { if (rf & 1) {
|
|
339
315
|
i0.ɵɵprojectionDef(_c4);
|
|
340
316
|
i0.ɵɵconditionalCreate(0, ListItemRow_Conditional_0_Template, 1, 4, "button", 4);
|
|
341
317
|
i0.ɵɵelementStart(1, "div", null, 0);
|
|
@@ -393,6 +369,7 @@ export class ListItemRow {
|
|
|
393
369
|
args: [{
|
|
394
370
|
selector: 'div[mol-list-item-row]',
|
|
395
371
|
standalone: true,
|
|
372
|
+
hostDirectives: [MolPlacement],
|
|
396
373
|
imports: [OptimisticToggleButton],
|
|
397
374
|
inputs: [
|
|
398
375
|
'title',
|
|
@@ -475,7 +452,7 @@ export class ListItemRow {
|
|
|
475
452
|
<ng-content select="[slot=actions]"></ng-content>
|
|
476
453
|
</div>`,
|
|
477
454
|
}]
|
|
478
|
-
}],
|
|
455
|
+
}], () => [], { leadingWrap: [{
|
|
479
456
|
type: ViewChild,
|
|
480
457
|
args: ['leadingWrap']
|
|
481
458
|
}], subtitleWrap: [{
|
|
@@ -488,5 +465,5 @@ export class ListItemRow {
|
|
|
488
465
|
type: ViewChild,
|
|
489
466
|
args: ['actionsWrap']
|
|
490
467
|
}] }); })();
|
|
491
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ListItemRow, { className: "ListItemRow", filePath: "list-item-row.component.ts", lineNumber:
|
|
468
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ListItemRow, { className: "ListItemRow", filePath: "list-item-row.component.ts", lineNumber: 133 }); })();
|
|
492
469
|
//# sourceMappingURL=list-item-row.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item-row.component.js","sourceRoot":"","sources":["../src/list-item-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"list-item-row.component.js","sourceRoot":"","sources":["../src/list-item-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAmB,SAAS,EAAE,MAAM,eAAe,CAAA;AAErE,OAAO,EACL,YAAY,EACZ,iBAAiB,EAEjB,YAAY,GACb,MAAM,uBAAuB,CA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AsB;YAAtB,+BAAsB;YACgB,cAAsB;YAAtB,+BAAsB;;YAC7D,cAEC;YAFD,0CAEC;YAGgB,eAAyB;YAAzB,kCAAyB;YAC1C,eAEC;YAFD,8CAEC;YAGgB,eAAyB;YAAzB,kCAAyB;YAC1C,eAEC;YAFD,8CAEC;YAIa,eAAwB;YAAxB,iCAAwB;YACxC,eAiBC;YAjBD,sCAiBC;YACD,cAEC;YAFD,6CAEC;4BA9EK,sBAAsB;;iFAkFrB,WAAW;cAtFvB,SAAS;eAAC;gBACT,QAAQ,EAAE,wBAAwB;gBAClC,UAAU,EAAE,IAAI;gBAChB,cAAc,EAAE,CAAC,YAAY,CAAC;gBAC9B,OAAO,EAAE,CAAC,sBAAsB,CAAC;gBACjC,MAAM,EAAE;oBACN,OAAO;oBACP,UAAU;oBACV,UAAU;oBACV,SAAS;oBACT,SAAS;oBACT,QAAQ;oBACR,SAAS;oBACT,UAAU;oBACV,UAAU;oBACV,SAAS;oBACT,WAAW;iBACZ;gBACD,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;oBACtB,qBAAqB,EAAE,+BAA+B;oBACtD,sBAAsB,EAAE,uBAAuB;oBAC/C,iBAAiB,EAAE,4BAA4B;iBAChD;gBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA4DD;aACV;;kBAoCE,SAAS;mBAAC,aAAa;;kBAEvB,SAAS;mBAAC,cAAc;;kBAExB,SAAS;mBAAC,cAAc;;kBAExB,SAAS;mBAAC,aAAa;;kFAzCb,WAAW"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-list-item-row-angular",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Thumbnail + title + subtitle + metadata + actions row (nav lists, mobile menus)",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-list-item-row-angular",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@angular/common": "^22.0.0",
|
|
46
46
|
"@angular/core": "^22.0.0",
|
|
47
47
|
"@angular/platform-browser": "^22.0.0",
|
|
48
|
-
"@molecule/app-angular": "^3.
|
|
48
|
+
"@molecule/app-angular": "^3.13.0 || ^4.0.0",
|
|
49
49
|
"@molecule/app-ui": "^1.0.1",
|
|
50
50
|
"@molecule/app-ui-angular": "^1.1.0"
|
|
51
51
|
},
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
"@angular/compiler-cli": "22.2.3",
|
|
56
56
|
"@angular/core": "22.2.3",
|
|
57
57
|
"@angular/platform-browser": "22.2.3",
|
|
58
|
-
"@molecule/app-angular": "
|
|
58
|
+
"@molecule/app-angular": "4.0.0",
|
|
59
59
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
|
-
"@molecule/app-i18n": "1.
|
|
60
|
+
"@molecule/app-i18n": "1.4.0",
|
|
61
61
|
"@molecule/app-icons": "1.0.4",
|
|
62
|
-
"@molecule/app-ui": "1.
|
|
63
|
-
"@molecule/app-ui-angular": "1.
|
|
62
|
+
"@molecule/app-ui": "1.17.0",
|
|
63
|
+
"@molecule/app-ui-angular": "1.13.3",
|
|
64
64
|
"@types/node": "26.6.5",
|
|
65
|
-
"jsdom": "
|
|
65
|
+
"jsdom": "31.0.1",
|
|
66
66
|
"rxjs": "7.8.2",
|
|
67
67
|
"typescript": "6.0.3",
|
|
68
68
|
"vitest": "4.1.12",
|
package/dist/slot-dom.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DOM helpers for the projected-slot wrappers of {@link ListItemRow}.
|
|
3
|
-
*
|
|
4
|
-
* React renders the `leading`, `subtitle`, `metadata` and `actions` wrappers
|
|
5
|
-
* conditionally (`{expr && <div>…}`). Angular projection needs always-mounted
|
|
6
|
-
* `<ng-content>` capture points, so the wrappers live in the template
|
|
7
|
-
* unconditionally and {@link SlotGuard.toggle} reconciles them against React's
|
|
8
|
-
* DOM: a wrapper with nothing to show is detached (an anchor comment keeps its
|
|
9
|
-
* position stable for a later re-attach when a later props step fills it).
|
|
10
|
-
*
|
|
11
|
-
* @module
|
|
12
|
-
*/
|
|
13
|
-
import type { ElementRef, Renderer2 } from '@angular/core';
|
|
14
|
-
/**
|
|
15
|
-
* Whether a wrapper holds any element or non-whitespace text node — the input
|
|
16
|
-
* text the template's `@if` rendered, or the projected slot content.
|
|
17
|
-
*
|
|
18
|
-
* @param el - The wrapper element.
|
|
19
|
-
* @returns True when at least one rendered node exists.
|
|
20
|
-
*/
|
|
21
|
-
export declare const hasNodes: (el: Element | undefined | null) => boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Attaches or detaches one projected-slot wrapper against what React renders.
|
|
24
|
-
* Idempotent, anchored in the wrapper's current parent (default: the component
|
|
25
|
-
* host); the contents move with the wrapper.
|
|
26
|
-
*/
|
|
27
|
-
export declare class SlotGuard {
|
|
28
|
-
private readonly host;
|
|
29
|
-
private readonly renderer;
|
|
30
|
-
private readonly anchors;
|
|
31
|
-
/** Where each detached wrapper belongs: its parent when it was last attached. */
|
|
32
|
-
private readonly homes;
|
|
33
|
-
/**
|
|
34
|
-
* Creates the guard.
|
|
35
|
-
*
|
|
36
|
-
* @param host - The component host element (default anchor parent).
|
|
37
|
-
* @param renderer - The DOM renderer.
|
|
38
|
-
*/
|
|
39
|
-
constructor(host: ElementRef<HTMLElement>, renderer: Renderer2);
|
|
40
|
-
/**
|
|
41
|
-
* Attaches or detaches the element (contents move with it). A detached
|
|
42
|
-
* element re-attaches to the parent it had when it was last attached — not
|
|
43
|
-
* to the host: a detached wrapper has no `parentElement`, and React's DOM
|
|
44
|
-
* keeps its position inside the component tree.
|
|
45
|
-
*
|
|
46
|
-
* @param el - The wrapper element.
|
|
47
|
-
* @param shouldAttach - Whether it should be in the DOM.
|
|
48
|
-
*/
|
|
49
|
-
toggle(el: Element | undefined | null, shouldAttach: boolean): void;
|
|
50
|
-
/**
|
|
51
|
-
* Returns the wrapper's anchor comment in `parent`, creating (or replacing
|
|
52
|
-
* a stale one) where the wrapper sits.
|
|
53
|
-
*
|
|
54
|
-
* @param parent - The anchor's parent.
|
|
55
|
-
* @param el - The wrapper the anchor stands for.
|
|
56
|
-
* @returns The connected anchor comment.
|
|
57
|
-
*/
|
|
58
|
-
private anchorIn;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=slot-dom.d.ts.map
|
package/dist/slot-dom.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot-dom.d.ts","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,IAAI,OAAO,GAAG,SAAS,GAAG,IAAI,KAAG,OAOzD,CAAA;AAED;;;;GAIG;AACH,qBAAa,SAAS;IAYlB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAZ3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IACtD,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA2B;IAEjD;;;;;OAKG;gBAEgB,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,EAC7B,QAAQ,EAAE,SAAS;IAGtC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,EAAE,YAAY,EAAE,OAAO,GAAG,IAAI;IAuBnE;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ;CASjB"}
|
package/dist/slot-dom.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DOM helpers for the projected-slot wrappers of {@link ListItemRow}.
|
|
3
|
-
*
|
|
4
|
-
* React renders the `leading`, `subtitle`, `metadata` and `actions` wrappers
|
|
5
|
-
* conditionally (`{expr && <div>…}`). Angular projection needs always-mounted
|
|
6
|
-
* `<ng-content>` capture points, so the wrappers live in the template
|
|
7
|
-
* unconditionally and {@link SlotGuard.toggle} reconciles them against React's
|
|
8
|
-
* DOM: a wrapper with nothing to show is detached (an anchor comment keeps its
|
|
9
|
-
* position stable for a later re-attach when a later props step fills it).
|
|
10
|
-
*
|
|
11
|
-
* @module
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Whether a wrapper holds any element or non-whitespace text node — the input
|
|
15
|
-
* text the template's `@if` rendered, or the projected slot content.
|
|
16
|
-
*
|
|
17
|
-
* @param el - The wrapper element.
|
|
18
|
-
* @returns True when at least one rendered node exists.
|
|
19
|
-
*/
|
|
20
|
-
export const hasNodes = (el) => {
|
|
21
|
-
if (!el)
|
|
22
|
-
return false;
|
|
23
|
-
for (const node of Array.from(el.childNodes)) {
|
|
24
|
-
if (node.nodeType === 1)
|
|
25
|
-
return true;
|
|
26
|
-
if (node.nodeType === 3 && (node.textContent ?? '').trim())
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
return false;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Attaches or detaches one projected-slot wrapper against what React renders.
|
|
33
|
-
* Idempotent, anchored in the wrapper's current parent (default: the component
|
|
34
|
-
* host); the contents move with the wrapper.
|
|
35
|
-
*/
|
|
36
|
-
export class SlotGuard {
|
|
37
|
-
host;
|
|
38
|
-
renderer;
|
|
39
|
-
anchors = new Map();
|
|
40
|
-
/** Where each detached wrapper belongs: its parent when it was last attached. */
|
|
41
|
-
homes = new Map();
|
|
42
|
-
/**
|
|
43
|
-
* Creates the guard.
|
|
44
|
-
*
|
|
45
|
-
* @param host - The component host element (default anchor parent).
|
|
46
|
-
* @param renderer - The DOM renderer.
|
|
47
|
-
*/
|
|
48
|
-
constructor(host, renderer) {
|
|
49
|
-
this.host = host;
|
|
50
|
-
this.renderer = renderer;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Attaches or detaches the element (contents move with it). A detached
|
|
54
|
-
* element re-attaches to the parent it had when it was last attached — not
|
|
55
|
-
* to the host: a detached wrapper has no `parentElement`, and React's DOM
|
|
56
|
-
* keeps its position inside the component tree.
|
|
57
|
-
*
|
|
58
|
-
* @param el - The wrapper element.
|
|
59
|
-
* @param shouldAttach - Whether it should be in the DOM.
|
|
60
|
-
*/
|
|
61
|
-
toggle(el, shouldAttach) {
|
|
62
|
-
if (!el)
|
|
63
|
-
return;
|
|
64
|
-
if (el.parentElement)
|
|
65
|
-
this.homes.set(el, el.parentElement);
|
|
66
|
-
const parent = this.homes.get(el) ?? el.parentElement ?? this.host.nativeElement;
|
|
67
|
-
if (shouldAttach && !el.isConnected) {
|
|
68
|
-
const anchor = this.anchors.get(el);
|
|
69
|
-
if (anchor?.isConnected && anchor.parentNode === parent) {
|
|
70
|
-
parent.insertBefore(el, anchor);
|
|
71
|
-
this.renderer.removeChild(parent, anchor);
|
|
72
|
-
this.anchors.delete(el);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
if (anchor?.isConnected)
|
|
76
|
-
this.renderer.removeChild(anchor.parentNode, anchor);
|
|
77
|
-
this.anchors.delete(el);
|
|
78
|
-
parent.appendChild(el);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else if (!shouldAttach && el.isConnected) {
|
|
82
|
-
// A placeholder comment keeps the re-insertion position stable; the
|
|
83
|
-
// conformance normalizer strips comment nodes, so it never shows.
|
|
84
|
-
this.anchorIn(parent, el);
|
|
85
|
-
this.renderer.removeChild(parent, el);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Returns the wrapper's anchor comment in `parent`, creating (or replacing
|
|
90
|
-
* a stale one) where the wrapper sits.
|
|
91
|
-
*
|
|
92
|
-
* @param parent - The anchor's parent.
|
|
93
|
-
* @param el - The wrapper the anchor stands for.
|
|
94
|
-
* @returns The connected anchor comment.
|
|
95
|
-
*/
|
|
96
|
-
anchorIn(parent, el) {
|
|
97
|
-
const existing = this.anchors.get(el);
|
|
98
|
-
if (existing?.isConnected && existing.parentNode === parent)
|
|
99
|
-
return existing;
|
|
100
|
-
if (existing)
|
|
101
|
-
this.anchors.delete(el);
|
|
102
|
-
const created = this.renderer.createComment('slot');
|
|
103
|
-
parent.insertBefore(created, el.isConnected ? el : null);
|
|
104
|
-
this.anchors.set(el, created);
|
|
105
|
-
return created;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=slot-dom.js.map
|
package/dist/slot-dom.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot-dom.js","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAA8B,EAAW,EAAE;IAClE,IAAI,CAAC,EAAE;QAAE,OAAO,KAAK,CAAA;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QACpC,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YAAE,OAAO,IAAI,CAAA;IACzE,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAYD;IACA;IAZF,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAA;IACtD,iFAAiF;IAChE,KAAK,GAAG,IAAI,GAAG,EAAiB,CAAA;IAEjD;;;;;OAKG;IACH,YACmB,IAA6B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