@molecule/app-stage-timeline-angular 0.0.0-stage → 1.1.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/LICENSE +202 -0
- package/README.md +381 -2
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/stage-timeline.component.d.ts +159 -0
- package/dist/stage-timeline.component.d.ts.map +1 -0
- package/dist/stage-timeline.component.js +379 -0
- package/dist/stage-timeline.component.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +74 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular multi-stage horizontal progress timeline with a current-stage marker.
|
|
3
|
+
* Used by employee-onboarding, applicant-tracking, kanban-board status
|
|
4
|
+
* flows, and order-fulfillment progress trackers.
|
|
5
|
+
*
|
|
6
|
+
* Exports `<div mol-stage-timeline>` and `statusOf` — the Angular counterpart
|
|
7
|
+
* of `@molecule/app-stage-timeline-react`, with the same props (React names)
|
|
8
|
+
* and the same DOM for the same input.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { Component } from '@angular/core'
|
|
13
|
+
* import { StageTimeline } from '@molecule/app-stage-timeline-angular'
|
|
14
|
+
*
|
|
15
|
+
* @Component({
|
|
16
|
+
* selector: 'app-hiring',
|
|
17
|
+
* standalone: true,
|
|
18
|
+
* imports: [StageTimeline],
|
|
19
|
+
* template: `<div mol-stage-timeline [stages]="stages" [currentIndex]="2"></div>`,
|
|
20
|
+
* })
|
|
21
|
+
* export class HiringPage {
|
|
22
|
+
* stages = [
|
|
23
|
+
* { id: 'applied', label: 'Applied' },
|
|
24
|
+
* { id: 'screen', label: 'Phone Screen' },
|
|
25
|
+
* { id: 'onsite', label: 'On-site' },
|
|
26
|
+
* { id: 'offer', label: 'Offer' },
|
|
27
|
+
* ]
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* - Must render inside the app's i18n provider and with a ClassMap bond
|
|
33
|
+
* wired (`useTranslation()` / `getClassMap()` throw otherwise).
|
|
34
|
+
* - Colors are read from `--mol-color-primary`, `--mol-color-on-primary`,
|
|
35
|
+
* `--mol-color-primary-container`, `--mol-color-outline`,
|
|
36
|
+
* `--mol-color-surface(-variant)`, `--mol-color-on-surface(-variant)`
|
|
37
|
+
* CSS custom properties with hardcoded light-theme fallbacks
|
|
38
|
+
* (blue #3366ff, black-alpha grays). Define those `--mol-color-*`
|
|
39
|
+
* variables in your theme (both light and dark) or the timeline stays
|
|
40
|
+
* default-blue and looks wrong in dark mode.
|
|
41
|
+
* - `currentIndex` semantics: stages before it render completed, after
|
|
42
|
+
* it upcoming; pass `-1` for "not started" and `stages.length` for
|
|
43
|
+
* "all done".
|
|
44
|
+
* - Stage dots render as buttons but are disabled unless that stage has
|
|
45
|
+
* an `onClick`.
|
|
46
|
+
* - Node-valued stage fields (`label`, `subtitle`) are `ng-template`
|
|
47
|
+
* references or plain text, as React's `ReactNode` fields are.
|
|
48
|
+
* - Stages are tracked by `id` (`@for (… ; track stage.id)`), so a re-passed
|
|
49
|
+
* or re-ordered list keeps each marker's DOM the way React's `key` does.
|
|
50
|
+
*
|
|
51
|
+
* @module
|
|
52
|
+
*/
|
|
53
|
+
export * from './stage-timeline.component.js';
|
|
54
|
+
export * from './types.js';
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
|
+
import type { StageStatus, StageTimelineStage } from './types.js';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a stage's rendering status given its index and the current index.
|
|
7
|
+
*
|
|
8
|
+
* @param i - Zero-based stage index.
|
|
9
|
+
* @param currentIndex - Index of the current stage (`-1` = none, `len` = all done).
|
|
10
|
+
* @returns The rendering status for stage `i`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function statusOf(i: number, currentIndex: number): StageStatus;
|
|
13
|
+
/**
|
|
14
|
+
* StageTimeline component.
|
|
15
|
+
*
|
|
16
|
+
* Multi-stage horizontal progress timeline with a current-stage marker. The
|
|
17
|
+
* host IS the root `<div>` (`div[mol-stage-timeline]`), matching React's root
|
|
18
|
+
* exactly: `role="list"` + the accessible label on the host, the connector rail
|
|
19
|
+
* and one marker per stage inside it. Node-valued stage fields (`label`,
|
|
20
|
+
* `subtitle`) are `ng-template` references rendered through
|
|
21
|
+
* {@link NgTemplateOutlet}; string / number fields render as text.
|
|
22
|
+
*/
|
|
23
|
+
export declare class StageTimeline {
|
|
24
|
+
/** Ordered stages to render, left-to-right. */
|
|
25
|
+
stages: StageTimelineStage[];
|
|
26
|
+
/**
|
|
27
|
+
* Index of the current stage (React's `currentIndex`): stages before it render
|
|
28
|
+
* completed, after it upcoming; `-1` = none, `stages.length` = all done.
|
|
29
|
+
*/
|
|
30
|
+
currentIndex: number;
|
|
31
|
+
/** `data-mol-id` attribute for AI-agent selectors. */
|
|
32
|
+
dataMolId?: string;
|
|
33
|
+
/** Extra classes appended via the ClassMap `cn()` helper. */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** The i18n handle (locale-reactive), read in an injection context. */
|
|
36
|
+
private readonly i18n;
|
|
37
|
+
/**
|
|
38
|
+
* The current class map.
|
|
39
|
+
* @returns The UIClassMap.
|
|
40
|
+
*/
|
|
41
|
+
cm(): UIClassMap;
|
|
42
|
+
/**
|
|
43
|
+
* Computes the root's class list.
|
|
44
|
+
* @returns The class string.
|
|
45
|
+
*/
|
|
46
|
+
classes(): string;
|
|
47
|
+
/**
|
|
48
|
+
* The root's accessible label.
|
|
49
|
+
* @returns The translated group label.
|
|
50
|
+
*/
|
|
51
|
+
groupLabel(): string;
|
|
52
|
+
/**
|
|
53
|
+
* The root's inline style — the grid geometry has no ClassMap resolver — or
|
|
54
|
+
* no style at all for an empty stage list (React's early return).
|
|
55
|
+
* @returns The CSS text.
|
|
56
|
+
*/
|
|
57
|
+
rootStyle(): string;
|
|
58
|
+
/**
|
|
59
|
+
* The connector rail's inline style (hidden behind the dots).
|
|
60
|
+
* @returns The CSS text.
|
|
61
|
+
*/
|
|
62
|
+
railStyle(): string;
|
|
63
|
+
/**
|
|
64
|
+
* The rail's filled portion: how full it should be (0–100%).
|
|
65
|
+
* @returns The CSS text.
|
|
66
|
+
*/
|
|
67
|
+
fillStyle(): string;
|
|
68
|
+
/**
|
|
69
|
+
* A stage's rendering status.
|
|
70
|
+
* @param i - The stage's zero-based index.
|
|
71
|
+
* @returns Its status.
|
|
72
|
+
*/
|
|
73
|
+
statusOfIndex(i: number): StageStatus;
|
|
74
|
+
/**
|
|
75
|
+
* Whether a stage is the current one.
|
|
76
|
+
* @param i - The stage's zero-based index.
|
|
77
|
+
* @returns True for the current stage.
|
|
78
|
+
*/
|
|
79
|
+
isCurrent(i: number): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether a stage is completed.
|
|
82
|
+
* @param i - The stage's zero-based index.
|
|
83
|
+
* @returns True for a completed stage.
|
|
84
|
+
*/
|
|
85
|
+
isCompleted(i: number): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The marker's text: a tick for a completed stage, its position otherwise.
|
|
88
|
+
* @param i - The stage's zero-based index.
|
|
89
|
+
* @returns The text to render.
|
|
90
|
+
*/
|
|
91
|
+
dotText(i: number): string;
|
|
92
|
+
/**
|
|
93
|
+
* The stage's accessible label, built from React's i18n key and default
|
|
94
|
+
* message (only a plain string label is carried into it).
|
|
95
|
+
* @param stage - The stage.
|
|
96
|
+
* @param i - The stage's zero-based index.
|
|
97
|
+
* @returns The aria label.
|
|
98
|
+
*/
|
|
99
|
+
stageAria(stage: StageTimelineStage, i: number): string;
|
|
100
|
+
/**
|
|
101
|
+
* The wrapper column's inline style.
|
|
102
|
+
* @returns The CSS text.
|
|
103
|
+
*/
|
|
104
|
+
stageWrapperStyle(): string;
|
|
105
|
+
/**
|
|
106
|
+
* The dot's inline style — geometry and status colors have no ClassMap
|
|
107
|
+
* resolver, and every color is a `--mol-color-*` token.
|
|
108
|
+
* @param stage - The stage the dot belongs to.
|
|
109
|
+
* @param i - The stage's zero-based index.
|
|
110
|
+
* @returns The CSS text.
|
|
111
|
+
*/
|
|
112
|
+
dotStyle(stage: StageTimelineStage, i: number): string;
|
|
113
|
+
/**
|
|
114
|
+
* The label span's class list.
|
|
115
|
+
* @param i - The stage's zero-based index.
|
|
116
|
+
* @returns The class string.
|
|
117
|
+
*/
|
|
118
|
+
labelClasses(i: number): string;
|
|
119
|
+
/**
|
|
120
|
+
* The label span's inline style.
|
|
121
|
+
* @param i - The stage's zero-based index.
|
|
122
|
+
* @returns The CSS text.
|
|
123
|
+
*/
|
|
124
|
+
labelStyle(i: number): string;
|
|
125
|
+
/**
|
|
126
|
+
* The subtitle span's class list.
|
|
127
|
+
* @returns The class string.
|
|
128
|
+
*/
|
|
129
|
+
subtitleClasses(): string;
|
|
130
|
+
/**
|
|
131
|
+
* Calls a stage's own click handler with the native event, as React's
|
|
132
|
+
* `onClick={stage.onClick}` does.
|
|
133
|
+
* @param stage - The stage that was clicked.
|
|
134
|
+
* @param event - The click event.
|
|
135
|
+
*/
|
|
136
|
+
handleClick(stage: StageTimelineStage, event: Event): void;
|
|
137
|
+
/**
|
|
138
|
+
* Whether a stage field holds a node (an `ng-template` reference) rather than
|
|
139
|
+
* text.
|
|
140
|
+
* @param value - The stage field.
|
|
141
|
+
* @returns True when it renders through a template outlet.
|
|
142
|
+
*/
|
|
143
|
+
isTemplate(value: unknown): value is TemplateRef<unknown>;
|
|
144
|
+
/**
|
|
145
|
+
* Narrows a value to an embedded template.
|
|
146
|
+
* @param value - A stage field.
|
|
147
|
+
* @returns The template, or null.
|
|
148
|
+
*/
|
|
149
|
+
templateOf(value: unknown): TemplateRef<unknown> | null;
|
|
150
|
+
/**
|
|
151
|
+
* The text a stage field renders (React renders strings and numbers as text).
|
|
152
|
+
* @param value - The stage field.
|
|
153
|
+
* @returns The text, or `''` for a node value.
|
|
154
|
+
*/
|
|
155
|
+
textOf(value: unknown): string;
|
|
156
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StageTimeline, never>;
|
|
157
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<StageTimeline, "div[mol-stage-timeline]", never, { "stages": { "alias": "stages"; "required": false; }; "currentIndex": { "alias": "currentIndex"; "required": false; }; "dataMolId": { "alias": "dataMolId"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, never, true, never>;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=stage-timeline.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-timeline.component.d.ts","sourceRoot":"","sources":["../src/stage-timeline.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAa,WAAW,EAAE,MAAM,eAAe,CAAA;AAGtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;;AAEjE;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,WAAW,CAIrE;AAED;;;;;;;;;GASG;AACH,qBA4Ba,aAAa;IACxB,+CAA+C;IAC/C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KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAIzD;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;IAIvD;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;yCApPnB,aAAa;2CAAb,aAAa;CAuPzB"}
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StageTimeline component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component, TemplateRef } from '@angular/core';
|
|
8
|
+
import { useTranslation } from '@molecule/app-angular';
|
|
9
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
const _forTrack0 = ($index, $item) => $item.id;
|
|
12
|
+
function StageTimeline_Conditional_0_For_4_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
13
|
+
i0.ɵɵelementContainer(0, 7);
|
|
14
|
+
} if (rf & 2) {
|
|
15
|
+
const stage_r2 = i0.ɵɵnextContext().$implicit;
|
|
16
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
17
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r2.templateOf(stage_r2.label));
|
|
18
|
+
} }
|
|
19
|
+
function StageTimeline_Conditional_0_For_4_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
20
|
+
i0.ɵɵtext(0);
|
|
21
|
+
} if (rf & 2) {
|
|
22
|
+
const stage_r2 = i0.ɵɵnextContext().$implicit;
|
|
23
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
24
|
+
i0.ɵɵtextInterpolate(ctx_r2.textOf(stage_r2.label));
|
|
25
|
+
} }
|
|
26
|
+
function StageTimeline_Conditional_0_For_4_Conditional_6_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
27
|
+
i0.ɵɵelementContainer(0, 7);
|
|
28
|
+
} if (rf & 2) {
|
|
29
|
+
const stage_r2 = i0.ɵɵnextContext(2).$implicit;
|
|
30
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
31
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r2.templateOf(stage_r2.subtitle));
|
|
32
|
+
} }
|
|
33
|
+
function StageTimeline_Conditional_0_For_4_Conditional_6_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
34
|
+
i0.ɵɵtext(0);
|
|
35
|
+
} if (rf & 2) {
|
|
36
|
+
const stage_r2 = i0.ɵɵnextContext(2).$implicit;
|
|
37
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
38
|
+
i0.ɵɵtextInterpolate(ctx_r2.textOf(stage_r2.subtitle));
|
|
39
|
+
} }
|
|
40
|
+
function StageTimeline_Conditional_0_For_4_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
41
|
+
i0.ɵɵelementStart(0, "span", 9);
|
|
42
|
+
i0.ɵɵconditionalCreate(1, StageTimeline_Conditional_0_For_4_Conditional_6_Conditional_1_Template, 1, 1, "ng-container", 7)(2, StageTimeline_Conditional_0_For_4_Conditional_6_Conditional_2_Template, 1, 1);
|
|
43
|
+
i0.ɵɵelementEnd();
|
|
44
|
+
} if (rf & 2) {
|
|
45
|
+
const stage_r2 = i0.ɵɵnextContext().$implicit;
|
|
46
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
47
|
+
i0.ɵɵclassMap(ctx_r2.subtitleClasses());
|
|
48
|
+
i0.ɵɵadvance();
|
|
49
|
+
i0.ɵɵconditional(ctx_r2.isTemplate(stage_r2.subtitle) ? 1 : 2);
|
|
50
|
+
} }
|
|
51
|
+
function StageTimeline_Conditional_0_For_4_Template(rf, ctx) { if (rf & 1) {
|
|
52
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
53
|
+
i0.ɵɵelementStart(0, "div", 4)(1, "button", 5);
|
|
54
|
+
i0.ɵɵlistener("click", function StageTimeline_Conditional_0_For_4_Template_button_click_1_listener($event) { const stage_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.handleClick(stage_r2, $event)); });
|
|
55
|
+
i0.ɵɵtext(2);
|
|
56
|
+
i0.ɵɵelementEnd();
|
|
57
|
+
i0.ɵɵelementStart(3, "span", 6);
|
|
58
|
+
i0.ɵɵconditionalCreate(4, StageTimeline_Conditional_0_For_4_Conditional_4_Template, 1, 1, "ng-container", 7)(5, StageTimeline_Conditional_0_For_4_Conditional_5_Template, 1, 1);
|
|
59
|
+
i0.ɵɵelementEnd();
|
|
60
|
+
i0.ɵɵconditionalCreate(6, StageTimeline_Conditional_0_For_4_Conditional_6_Template, 3, 3, "span", 8);
|
|
61
|
+
i0.ɵɵelementEnd();
|
|
62
|
+
} if (rf & 2) {
|
|
63
|
+
const stage_r2 = ctx.$implicit;
|
|
64
|
+
const ɵ$index_8_r4 = ctx.$index;
|
|
65
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
66
|
+
i0.ɵɵstyleMap(ctx_r2.stageWrapperStyle());
|
|
67
|
+
i0.ɵɵattribute("data-stage-id", stage_r2.id)("data-stage-status", ctx_r2.statusOfIndex(ɵ$index_8_r4))("aria-current", ctx_r2.isCurrent(ɵ$index_8_r4) ? "step" : null)("aria-label", ctx_r2.stageAria(stage_r2, ɵ$index_8_r4));
|
|
68
|
+
i0.ɵɵadvance();
|
|
69
|
+
i0.ɵɵstyleMap(ctx_r2.dotStyle(stage_r2, ɵ$index_8_r4));
|
|
70
|
+
i0.ɵɵproperty("disabled", !stage_r2.onClick);
|
|
71
|
+
i0.ɵɵattribute("aria-label", ctx_r2.stageAria(stage_r2, ɵ$index_8_r4));
|
|
72
|
+
i0.ɵɵadvance();
|
|
73
|
+
i0.ɵɵtextInterpolate(ctx_r2.dotText(ɵ$index_8_r4));
|
|
74
|
+
i0.ɵɵadvance();
|
|
75
|
+
i0.ɵɵstyleMap(ctx_r2.labelStyle(ɵ$index_8_r4));
|
|
76
|
+
i0.ɵɵclassMap(ctx_r2.labelClasses(ɵ$index_8_r4));
|
|
77
|
+
i0.ɵɵadvance();
|
|
78
|
+
i0.ɵɵconditional(ctx_r2.isTemplate(stage_r2.label) ? 4 : 5);
|
|
79
|
+
i0.ɵɵadvance(2);
|
|
80
|
+
i0.ɵɵconditional(stage_r2.subtitle ? 6 : -1);
|
|
81
|
+
} }
|
|
82
|
+
function StageTimeline_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
83
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
84
|
+
i0.ɵɵelement(1, "div", 1)(2, "div", 2);
|
|
85
|
+
i0.ɵɵelementEnd();
|
|
86
|
+
i0.ɵɵrepeaterCreate(3, StageTimeline_Conditional_0_For_4_Template, 7, 17, "div", 3, _forTrack0);
|
|
87
|
+
} if (rf & 2) {
|
|
88
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
89
|
+
i0.ɵɵstyleMap(ctx_r2.railStyle());
|
|
90
|
+
i0.ɵɵadvance(2);
|
|
91
|
+
i0.ɵɵstyleMap(ctx_r2.fillStyle());
|
|
92
|
+
i0.ɵɵadvance();
|
|
93
|
+
i0.ɵɵrepeater(ctx_r2.stages);
|
|
94
|
+
} }
|
|
95
|
+
/**
|
|
96
|
+
* Resolve a stage's rendering status given its index and the current index.
|
|
97
|
+
*
|
|
98
|
+
* @param i - Zero-based stage index.
|
|
99
|
+
* @param currentIndex - Index of the current stage (`-1` = none, `len` = all done).
|
|
100
|
+
* @returns The rendering status for stage `i`.
|
|
101
|
+
*/
|
|
102
|
+
export function statusOf(i, currentIndex) {
|
|
103
|
+
if (i < currentIndex)
|
|
104
|
+
return 'completed';
|
|
105
|
+
if (i === currentIndex)
|
|
106
|
+
return 'current';
|
|
107
|
+
return 'upcoming';
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* StageTimeline component.
|
|
111
|
+
*
|
|
112
|
+
* Multi-stage horizontal progress timeline with a current-stage marker. The
|
|
113
|
+
* host IS the root `<div>` (`div[mol-stage-timeline]`), matching React's root
|
|
114
|
+
* exactly: `role="list"` + the accessible label on the host, the connector rail
|
|
115
|
+
* and one marker per stage inside it. Node-valued stage fields (`label`,
|
|
116
|
+
* `subtitle`) are `ng-template` references rendered through
|
|
117
|
+
* {@link NgTemplateOutlet}; string / number fields render as text.
|
|
118
|
+
*/
|
|
119
|
+
export class StageTimeline {
|
|
120
|
+
/** Ordered stages to render, left-to-right. */
|
|
121
|
+
stages = [];
|
|
122
|
+
/**
|
|
123
|
+
* Index of the current stage (React's `currentIndex`): stages before it render
|
|
124
|
+
* completed, after it upcoming; `-1` = none, `stages.length` = all done.
|
|
125
|
+
*/
|
|
126
|
+
currentIndex = 0;
|
|
127
|
+
/** `data-mol-id` attribute for AI-agent selectors. */
|
|
128
|
+
dataMolId;
|
|
129
|
+
/** Extra classes appended via the ClassMap `cn()` helper. */
|
|
130
|
+
className;
|
|
131
|
+
/** The i18n handle (locale-reactive), read in an injection context. */
|
|
132
|
+
i18n = useTranslation();
|
|
133
|
+
/**
|
|
134
|
+
* The current class map.
|
|
135
|
+
* @returns The UIClassMap.
|
|
136
|
+
*/
|
|
137
|
+
cm() {
|
|
138
|
+
return getClassMap();
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Computes the root's class list.
|
|
142
|
+
* @returns The class string.
|
|
143
|
+
*/
|
|
144
|
+
classes() {
|
|
145
|
+
return this.cm().cn(this.className);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The root's accessible label.
|
|
149
|
+
* @returns The translated group label.
|
|
150
|
+
*/
|
|
151
|
+
groupLabel() {
|
|
152
|
+
return this.i18n.t('stageTimeline.group', {}, { defaultValue: 'Stage timeline' });
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The root's inline style — the grid geometry has no ClassMap resolver — or
|
|
156
|
+
* no style at all for an empty stage list (React's early return).
|
|
157
|
+
* @returns The CSS text.
|
|
158
|
+
*/
|
|
159
|
+
rootStyle() {
|
|
160
|
+
if (this.stages.length === 0)
|
|
161
|
+
return '';
|
|
162
|
+
return `position: relative; display: grid; grid-template-columns: repeat(${this.stages.length}, minmax(0, 1fr)); align-items: start`;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The connector rail's inline style (hidden behind the dots).
|
|
166
|
+
* @returns The CSS text.
|
|
167
|
+
*/
|
|
168
|
+
railStyle() {
|
|
169
|
+
const inset = `${(0.5 / this.stages.length) * 100}%`;
|
|
170
|
+
return `position: absolute; top: 14px; left: ${inset}; right: ${inset}; height: 2px; pointer-events: none`;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The rail's filled portion: how full it should be (0–100%).
|
|
174
|
+
* @returns The CSS text.
|
|
175
|
+
*/
|
|
176
|
+
fillStyle() {
|
|
177
|
+
const denom = Math.max(1, this.stages.length - 1);
|
|
178
|
+
const fillRatio = Math.max(0, Math.min(1, this.currentIndex / denom));
|
|
179
|
+
return `position: absolute; top: 0px; bottom: 0px; left: 0px; width: ${fillRatio * 100}%; background: var(--mol-color-primary, #3366ff); transition: width 200ms ease`;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* A stage's rendering status.
|
|
183
|
+
* @param i - The stage's zero-based index.
|
|
184
|
+
* @returns Its status.
|
|
185
|
+
*/
|
|
186
|
+
statusOfIndex(i) {
|
|
187
|
+
return statusOf(i, this.currentIndex);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Whether a stage is the current one.
|
|
191
|
+
* @param i - The stage's zero-based index.
|
|
192
|
+
* @returns True for the current stage.
|
|
193
|
+
*/
|
|
194
|
+
isCurrent(i) {
|
|
195
|
+
return this.statusOfIndex(i) === 'current';
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Whether a stage is completed.
|
|
199
|
+
* @param i - The stage's zero-based index.
|
|
200
|
+
* @returns True for a completed stage.
|
|
201
|
+
*/
|
|
202
|
+
isCompleted(i) {
|
|
203
|
+
return this.statusOfIndex(i) === 'completed';
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The marker's text: a tick for a completed stage, its position otherwise.
|
|
207
|
+
* @param i - The stage's zero-based index.
|
|
208
|
+
* @returns The text to render.
|
|
209
|
+
*/
|
|
210
|
+
dotText(i) {
|
|
211
|
+
return this.isCompleted(i) ? '✓' : String(i + 1);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The stage's accessible label, built from React's i18n key and default
|
|
215
|
+
* message (only a plain string label is carried into it).
|
|
216
|
+
* @param stage - The stage.
|
|
217
|
+
* @param i - The stage's zero-based index.
|
|
218
|
+
* @returns The aria label.
|
|
219
|
+
*/
|
|
220
|
+
stageAria(stage, i) {
|
|
221
|
+
return this.i18n.t('stageTimeline.stage', {
|
|
222
|
+
label: typeof stage.label === 'string' ? stage.label : '',
|
|
223
|
+
index: i + 1,
|
|
224
|
+
total: this.stages.length,
|
|
225
|
+
status: this.statusOfIndex(i),
|
|
226
|
+
}, { defaultValue: 'Stage {{index}} of {{total}}: {{label}} ({{status}})' });
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The wrapper column's inline style.
|
|
230
|
+
* @returns The CSS text.
|
|
231
|
+
*/
|
|
232
|
+
stageWrapperStyle() {
|
|
233
|
+
return 'position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0px';
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* The dot's inline style — geometry and status colors have no ClassMap
|
|
237
|
+
* resolver, and every color is a `--mol-color-*` token.
|
|
238
|
+
* @param stage - The stage the dot belongs to.
|
|
239
|
+
* @param i - The stage's zero-based index.
|
|
240
|
+
* @returns The CSS text.
|
|
241
|
+
*/
|
|
242
|
+
dotStyle(stage, i) {
|
|
243
|
+
const completed = this.isCompleted(i);
|
|
244
|
+
const current = this.isCurrent(i);
|
|
245
|
+
const parts = [
|
|
246
|
+
'width: 28px',
|
|
247
|
+
'height: 28px',
|
|
248
|
+
'border-radius: 50%',
|
|
249
|
+
`border: 2px solid ${completed || current
|
|
250
|
+
? 'var(--mol-color-primary, #3366ff)'
|
|
251
|
+
: 'var(--mol-color-outline, rgba(0,0,0,0.25))'}`,
|
|
252
|
+
`background: ${completed
|
|
253
|
+
? 'var(--mol-color-primary, #3366ff)'
|
|
254
|
+
: current
|
|
255
|
+
? 'var(--mol-color-primary-container, rgba(51,102,255,0.18))'
|
|
256
|
+
: 'var(--mol-color-surface, transparent)'}`,
|
|
257
|
+
`color: ${completed ? 'var(--mol-color-on-primary, #fff)' : 'inherit'}`,
|
|
258
|
+
'display: inline-flex',
|
|
259
|
+
'align-items: center',
|
|
260
|
+
'justify-content: center',
|
|
261
|
+
'font-size: 14px',
|
|
262
|
+
'font-weight: 700',
|
|
263
|
+
`cursor: ${stage.onClick ? 'pointer' : 'default'}`,
|
|
264
|
+
];
|
|
265
|
+
if (current)
|
|
266
|
+
parts.push('box-shadow: 0 0 0 4px var(--mol-color-primary-container, rgba(51,102,255,0.18))');
|
|
267
|
+
parts.push('transition: box-shadow 200ms ease, background 200ms ease');
|
|
268
|
+
// React merges `{ ...dotStyle, padding: 0 }` onto the button.
|
|
269
|
+
parts.push('padding: 0px');
|
|
270
|
+
return parts.join('; ');
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The label span's class list.
|
|
274
|
+
* @param i - The stage's zero-based index.
|
|
275
|
+
* @returns The class string.
|
|
276
|
+
*/
|
|
277
|
+
labelClasses(i) {
|
|
278
|
+
const cm = this.cm();
|
|
279
|
+
return cm.cn(cm.textSize('xs'), cm.fontWeight(this.isCurrent(i) ? 'semibold' : 'normal'));
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The label span's inline style.
|
|
283
|
+
* @param i - The stage's zero-based index.
|
|
284
|
+
* @returns The CSS text.
|
|
285
|
+
*/
|
|
286
|
+
labelStyle(i) {
|
|
287
|
+
const color = this.isCurrent(i)
|
|
288
|
+
? 'var(--mol-color-primary, #3366ff)'
|
|
289
|
+
: this.isCompleted(i)
|
|
290
|
+
? 'var(--mol-color-on-surface, inherit)'
|
|
291
|
+
: 'var(--mol-color-on-surface-variant, #666)';
|
|
292
|
+
return `text-align: center; color: ${color}`;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* The subtitle span's class list.
|
|
296
|
+
* @returns The class string.
|
|
297
|
+
*/
|
|
298
|
+
subtitleClasses() {
|
|
299
|
+
return this.cm().textSize('xs');
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Calls a stage's own click handler with the native event, as React's
|
|
303
|
+
* `onClick={stage.onClick}` does.
|
|
304
|
+
* @param stage - The stage that was clicked.
|
|
305
|
+
* @param event - The click event.
|
|
306
|
+
*/
|
|
307
|
+
handleClick(stage, event) {
|
|
308
|
+
const onClick = stage.onClick;
|
|
309
|
+
onClick?.(event);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Whether a stage field holds a node (an `ng-template` reference) rather than
|
|
313
|
+
* text.
|
|
314
|
+
* @param value - The stage field.
|
|
315
|
+
* @returns True when it renders through a template outlet.
|
|
316
|
+
*/
|
|
317
|
+
isTemplate(value) {
|
|
318
|
+
return value instanceof TemplateRef;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Narrows a value to an embedded template.
|
|
322
|
+
* @param value - A stage field.
|
|
323
|
+
* @returns The template, or null.
|
|
324
|
+
*/
|
|
325
|
+
templateOf(value) {
|
|
326
|
+
return value instanceof TemplateRef ? value : null;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* The text a stage field renders (React renders strings and numbers as text).
|
|
330
|
+
* @param value - The stage field.
|
|
331
|
+
* @returns The text, or `''` for a node value.
|
|
332
|
+
*/
|
|
333
|
+
textOf(value) {
|
|
334
|
+
return typeof value === 'string' || typeof value === 'number' ? String(value) : '';
|
|
335
|
+
}
|
|
336
|
+
static ɵfac = function StageTimeline_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || StageTimeline)(); };
|
|
337
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: StageTimeline, selectors: [["div", "mol-stage-timeline", ""]], hostAttrs: ["role", "list"], hostVars: 6, hostBindings: function StageTimeline_HostBindings(rf, ctx) { if (rf & 2) {
|
|
338
|
+
i0.ɵɵattribute("data-mol-id", ctx.dataMolId ?? "stage-timeline")("aria-label", ctx.groupLabel());
|
|
339
|
+
i0.ɵɵstyleMap(ctx.rootStyle());
|
|
340
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
341
|
+
} }, inputs: { stages: "stages", currentIndex: "currentIndex", dataMolId: "dataMolId", className: "className" }, decls: 1, vars: 1, consts: [["aria-hidden", "true", "data-mol-id", "stage-timeline-rail"], [2, "position", "absolute", "inset", "0px", "background", "var(--mol-color-surface-variant, rgba(0,0,0,0.12))"], ["data-mol-id", "stage-timeline-rail-fill"], ["role", "listitem", "data-mol-id", "stage-timeline-stage", 3, "style"], ["role", "listitem", "data-mol-id", "stage-timeline-stage"], ["type", "button", "data-mol-id", "stage-timeline-dot", 3, "click", "disabled"], ["data-mol-id", "stage-timeline-label"], [3, "ngTemplateOutlet"], ["data-mol-id", "stage-timeline-subtitle", 2, "text-align", "center", "color", "var(--mol-color-on-surface-variant, #888)", 3, "class"], ["data-mol-id", "stage-timeline-subtitle", 2, "text-align", "center", "color", "var(--mol-color-on-surface-variant, #888)"]], template: function StageTimeline_Template(rf, ctx) { if (rf & 1) {
|
|
342
|
+
i0.ɵɵconditionalCreate(0, StageTimeline_Conditional_0_Template, 5, 4);
|
|
343
|
+
} if (rf & 2) {
|
|
344
|
+
i0.ɵɵconditional(ctx.stages.length > 0 ? 0 : -1);
|
|
345
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
346
|
+
}
|
|
347
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StageTimeline, [{
|
|
348
|
+
type: Component,
|
|
349
|
+
args: [{
|
|
350
|
+
selector: 'div[mol-stage-timeline]',
|
|
351
|
+
standalone: true,
|
|
352
|
+
imports: [NgTemplateOutlet],
|
|
353
|
+
inputs: ['stages', 'currentIndex', 'dataMolId', 'className'],
|
|
354
|
+
host: {
|
|
355
|
+
role: 'list',
|
|
356
|
+
'[class]': 'classes()',
|
|
357
|
+
'[attr.data-mol-id]': "dataMolId ?? 'stage-timeline'",
|
|
358
|
+
'[attr.aria-label]': 'groupLabel()',
|
|
359
|
+
'[style]': 'rootStyle()',
|
|
360
|
+
},
|
|
361
|
+
// prettier-ignore
|
|
362
|
+
template: `
|
|
363
|
+
@if (stages.length > 0) {
|
|
364
|
+
<div aria-hidden="true" [style]="railStyle()" data-mol-id="stage-timeline-rail"><div style="position: absolute; inset: 0px; background: var(--mol-color-surface-variant, rgba(0,0,0,0.12))"></div><div data-mol-id="stage-timeline-rail-fill" [style]="fillStyle()"></div></div>
|
|
365
|
+
@for (stage of stages; track stage.id; let i = $index) {
|
|
366
|
+
<div role="listitem" [attr.data-stage-id]="stage.id" [attr.data-stage-status]="statusOfIndex(i)" data-mol-id="stage-timeline-stage" [attr.aria-current]="isCurrent(i) ? 'step' : null" [attr.aria-label]="stageAria(stage, i)" [style]="stageWrapperStyle()">
|
|
367
|
+
<button type="button" (click)="handleClick(stage, $event)" [disabled]="!stage.onClick" [attr.aria-label]="stageAria(stage, i)" data-mol-id="stage-timeline-dot" [style]="dotStyle(stage, i)">{{ dotText(i) }}</button>
|
|
368
|
+
<span [class]="labelClasses(i)" data-mol-id="stage-timeline-label" [style]="labelStyle(i)">@if (isTemplate(stage.label)) {<ng-container [ngTemplateOutlet]="templateOf(stage.label)"></ng-container>}@else {{{ textOf(stage.label) }}}</span>
|
|
369
|
+
@if (stage.subtitle) {
|
|
370
|
+
<span [class]="subtitleClasses()" data-mol-id="stage-timeline-subtitle" style="text-align: center; color: var(--mol-color-on-surface-variant, #888)">@if (isTemplate(stage.subtitle)) {<ng-container [ngTemplateOutlet]="templateOf(stage.subtitle)"></ng-container>}@else {{{ textOf(stage.subtitle) }}}</span>
|
|
371
|
+
}
|
|
372
|
+
</div>
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
`,
|
|
376
|
+
}]
|
|
377
|
+
}], null, null); })();
|
|
378
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(StageTimeline, { className: "StageTimeline", filePath: "stage-timeline.component.ts", lineNumber: 67 }); })();
|
|
379
|
+
//# sourceMappingURL=stage-timeline.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-timeline.component.js","sourceRoot":"","sources":["../src/stage-timeline.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;;IA8CsF,2BAA0E;;;;IAA5D,oEAA4C;;;IAAwB,YAAyB;;;;IAAzB,mDAAyB;;;IAE5C,2BAA6E;;;;IAA/D,uEAA+C;;;IAAwB,YAA4B;;;;IAA5B,sDAA4B;;;IAAxS,+BAAqJ;IAAgH,AAAhH,0HAAkC,iFAAqF;IAA6B,iBAAO;;;;IAA1S,uCAA2B;IAAoH,cAAoJ;IAApJ,8DAAoJ;;;;IAH3S,AADF,8BAA6P,gBAC9D;IAAvK,yNAAS,oCAA0B,KAAC;IAAmI,YAAgB;IAAA,iBAAS;IACtN,+BAA2F;IAA0G,AAA1G,4GAA+B,mEAAkF;IAA0B,iBAAO;IAC7O,oGAAsB;IAGxB,iBAAM;;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ACpD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAc;QACnB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACpF,CAAC;uGAtPU,aAAa;6DAAb,aAAa;2DAAA,gBACb,gBADA,gBAAY;YAAZ,cAAA,eAAW,CAAE;YAAb,cAAA,aAAS,CAAI;;YAdtB,qEAAyB;;YAAzB,gDAWC;4BAtBO,gBAAgB;;iFAyBf,aAAa;cA5BzB,SAAS;eAAC;gBACT,QAAQ,EAAE,yBAAyB;gBACnC,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;gBAC3B,MAAM,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,CAAC;gBAC5D,IAAI,EAAE;oBACJ,IAAI,EAAE,MAAM;oBACZ,SAAS,EAAE,WAAW;oBACtB,oBAAoB,EAAE,+BAA+B;oBACrD,mBAAmB,EAAE,cAAc;oBACnC,SAAS,EAAE,aAAa;iBACzB;gBACD,kBAAkB;gBAClB,QAAQ,EAAE;;;;;;;;;;;;;GAaT;aACF;;kFACY,aAAa"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of `@molecule/app-stage-timeline-angular` — the Angular counterpart of
|
|
3
|
+
* `@molecule/app-stage-timeline-react`, same props and DOM.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { TemplateRef } from '@angular/core';
|
|
8
|
+
/** A single stage on the timeline. */
|
|
9
|
+
export interface StageTimelineStage {
|
|
10
|
+
/** Stable id (used as the render key + `data-stage-id`). */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Stage label: a template reference (a node), or text. */
|
|
13
|
+
label: string | number | TemplateRef<unknown>;
|
|
14
|
+
/** Optional secondary line (timestamp, owner, etc.): a template reference, or text. */
|
|
15
|
+
subtitle?: string | number | TemplateRef<unknown>;
|
|
16
|
+
/** Optional click handler. */
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
}
|
|
19
|
+
/** Per-stage rendering state. */
|
|
20
|
+
export type StageStatus = 'completed' | 'current' | 'upcoming';
|
|
21
|
+
/**
|
|
22
|
+
* Props accepted by {@link StageTimeline} — the same props
|
|
23
|
+
* `@molecule/app-stage-timeline-react` accepts. Node-valued stage fields
|
|
24
|
+
* (`label`, `subtitle`) are template references in Angular (an input cannot
|
|
25
|
+
* carry a node), or plain text.
|
|
26
|
+
*/
|
|
27
|
+
export interface StageTimelineProps {
|
|
28
|
+
/** Ordered stages to render, left-to-right. */
|
|
29
|
+
stages: StageTimelineStage[];
|
|
30
|
+
/**
|
|
31
|
+
* Index of the **current** stage (0-based). Stages before this index
|
|
32
|
+
* are rendered as `completed`; stages after are rendered as `upcoming`.
|
|
33
|
+
* Pass `-1` to render every stage as upcoming (e.g. before kickoff).
|
|
34
|
+
* Pass `stages.length` to render every stage as completed (process done).
|
|
35
|
+
*/
|
|
36
|
+
currentIndex: number;
|
|
37
|
+
/** `data-mol-id` attribute for AI-agent selectors. */
|
|
38
|
+
dataMolId?: string;
|
|
39
|
+
/** Extra classes appended via the ClassMap `cn()` helper. */
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,EAAE,EAAE,MAAM,CAAA;IACV,2DAA2D;IAC3D,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IAC7C,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACjD,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,iCAAiC;AACjC,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC5B;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|