@ckui/core 0.1.0-next.1 → 0.1.0-next.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 CHANGED
@@ -145,15 +145,133 @@ text, a direct `svg` child (an icon, shown before the text), or both; font-icon
145
145
 
146
146
  The group is as tall as the control height of its size and every segment is that tall to hit (44px for
147
147
  `sm` and `md` under a coarse pointer, 60px at `xl`). The selected segment is marked by a raised indicator
148
- with its own 3:1 border, not by colour alone. Labels that do not fit are cut with an ellipsis, the full
149
- text stays in the accessible name. Component tokens: `--ck-segmented-bg`, `--ck-segmented-border-color`,
150
- `--ck-segmented-fg`, `--ck-segmented-indicator-bg`, `--ck-segmented-indicator-fg`,
151
- `--ck-segmented-radius` and `--ck-segmented-padding`.
148
+ with its own 3:1 border, not by colour alone, and it slides to a new selection over
149
+ `--ck-duration-normal` (not under reduced motion, and not when it first appears). A segment is as wide
150
+ as an equal share of the group or its label (with icon and padding), whichever is larger, so a long
151
+ label never cuts a short neighbour's share: its column grows and the others shrink. Only when the
152
+ labels at their natural width cannot fit together does the group switch to equal columns and cut the
153
+ labels with an ellipsis (the full text stays in the accessible name); it never overflows its
154
+ container, and goes back to content widths as soon as there is room, also when only a label, the size or a loading font changes. Component tokens:
155
+ `--ck-segmented-bg`, `--ck-segmented-border-color`, `--ck-segmented-fg`,
156
+ `--ck-segmented-indicator-bg`, `--ck-segmented-indicator-fg`, `--ck-segmented-radius`,
157
+ `--ck-segmented-padding` (the gap around the indicator) and `--ck-segmented-padding-inline`
158
+ (horizontal padding of a segment, for a tighter control; the size's control padding by default).
152
159
 
153
160
  Global element styles: a global `:focus-visible { outline: … }` beats the layered control and draws a
154
161
  second ring on the segment itself. Keep it off the segments (`:focus-visible:not(.ck-segment)`) or put
155
162
  resets in a layer declared before ckui: `@layer reset, ckui;`.
156
163
 
164
+ ## Badge
165
+
166
+ ```ts
167
+ import { CK_BADGE_IMPORTS } from '@ckui/core/badge';
168
+ ```
169
+
170
+ ```html
171
+ <ck-badge tone="success" dot>Connected</ck-badge>
172
+ <ck-badge tone="danger">
173
+ <svg
174
+ ckBadgeIcon
175
+ viewBox="0 0 16 16"
176
+ fill="none"
177
+ stroke="currentColor"
178
+ stroke-width="2"
179
+ stroke-linecap="round"
180
+ stroke-linejoin="round"
181
+ >
182
+ <path d="M8 3v6M8 12.5v.5" />
183
+ </svg>
184
+ Upload failed
185
+ </ck-badge>
186
+ ```
187
+
188
+ `ck-badge` is a small, non-interactive status pill (`CkBadge`, `CkBadgeIcon`). Inputs: `tone` (`neutral`
189
+ default, `success`, `warning`, `danger`), `dot` (a leading dot in the text colour) and `size` (`md`, a 1.5rem
190
+ pill, default; `sm`, 1.25rem, for dense lists). `ckBadgeIcon` on a projected `svg` makes it the leading icon,
191
+ drawn one em wide and hidden from assistive technology. The badge never wraps: text that does not fit its
192
+ container is cut with an ellipsis.
193
+
194
+ A badge has no role and is not a live region. The text has to state the status, since a dot, an icon or a
195
+ colour alone says nothing to a screen reader, and development builds warn about a badge without text. When a
196
+ change must be heard, announce it yourself, for instance in a `role="status"` element or a toast. Component
197
+ tokens: `--ck-badge-bg`, `--ck-badge-fg`, `--ck-badge-dot` (the dot's own colour, default the text colour; a coloured dot is decoration, so the text must still state the status) and `--ck-badge-radius` (they apply to every tone; scope them by `.ck-badge--<tone>` to restyle one tone).
198
+
199
+ Global element styles: a global rule such as `span { overflow: visible }` (no truncation) or
200
+ `svg { inline-size: 100% }` (a huge icon) beats the layered badge. Scope it away from the badge or put
201
+ resets in a layer declared before ckui: `@layer reset, ckui;`.
202
+
203
+ ## Progress
204
+
205
+ ```ts
206
+ import { CkProgress } from '@ckui/core/progress';
207
+ ```
208
+
209
+ ```html
210
+ <ck-progress aria-label="Upload" [value]="percent()" />
211
+ <ck-progress
212
+ aria-label="Workout"
213
+ [value]="step()"
214
+ [max]="7"
215
+ [valueText]="'Step ' + step() + ' of 7'"
216
+ />
217
+ <ck-progress aria-label="Connecting" [value]="null" />
218
+ ```
219
+
220
+ `ck-progress` is a horizontal progress bar (`CkProgress`, `role="progressbar"`). Inputs: `value` (a number
221
+ from 0 to `max`; below 0 counts as 0 and above `max` as `max`; `null`, `undefined`, `NaN` or any non-number
222
+ shows the indeterminate bar without `aria-valuenow`), `max` (default 100; anything that is not a finite number
223
+ above 0 counts as 100) and `valueText` (`aria-valuetext`, e.g. "Step 2 of 7"). The bar needs an `aria-label`
224
+ or `aria-labelledby` (development builds warn without one) and is not a live region: announce milestones
225
+ yourself.
226
+
227
+ The fill grows with a transform from the start edge (mirrored in right-to-left text) over
228
+ `--ck-duration-normal`, and not at all under `prefers-reduced-motion`, where the indeterminate bar is a still,
229
+ half-width fill. In forced colors the track gets an outline and the fill is `Highlight`. Component tokens:
230
+ `--ck-progress-track`, `--ck-progress-fill`, `--ck-progress-thickness` and `--ck-progress-radius`; keep the
231
+ fill at 3:1 against the track.
232
+
233
+ ## Stepper
234
+
235
+ ```ts
236
+ import { CkStepper } from '@ckui/core/stepper';
237
+ ```
238
+
239
+ ```html
240
+ <ck-stepper aria-label="FTP" unit="W" [min]="50" [max]="600" [step]="5" [(value)]="ftp" />
241
+ <ck-stepper
242
+ aria-label="FTP"
243
+ decrementLabel="FTP minus 5"
244
+ incrementLabel="FTP plus 5"
245
+ [formControl]="ftp"
246
+ />
247
+ ```
248
+
249
+ `ck-stepper` is a number field with a minus and a plus button (`CkStepper`, a form control for Reactive Forms,
250
+ `ngModel` and Signal Forms). The value is a `number` or `null`. Inputs: `min`, `max`, `step` (default 1, counted
251
+ from `min`; it also sets the fraction digits), `largeStep` (Page Up/Down, default 10 steps), `unit` (text after the
252
+ value, read as part of the value text: "250 W"), `size`, `readonly`, `disabled`, `decrementLabel` and
253
+ `incrementLabel` (per-instance names for the buttons; the defaults come from the labels token).
254
+
255
+ The value is a real text input with `role="spinbutton"` and the only tab stop; the buttons are outside the tab
256
+ order. Name it with `aria-label` or `aria-labelledby` on `ck-stepper` (they are inputs and move onto the input
257
+ element, like `aria-describedby` for a hint or an error; bind them as `[aria-label]`) or wrap it in a `<label>`;
258
+ development builds warn without a name. The input uses `inputmode="decimal"`, and `text` when `min` is below 0. Arrow
259
+ Up/Down step, Page Up/Down move by `largeStep`, Home/End jump to `min`/`max` when set. Typed text is read on Enter or
260
+ blur: it is parsed with the locale (`LOCALE_ID`; both `.` and `,` count as a decimal mark), clamped, snapped to the
261
+ step, and text that is no number goes back to the last value. An empty field is `null`; from `null` the first arrow
262
+ or button press starts at `min`, else at 0. A held button repeats after 400 ms, every 80 ms, and by five steps after
263
+ two seconds; it stops on release, on leaving the button and at a limit. A `min` above `max` pins the value to `min`,
264
+ and a `step` that is 0, negative or not a number counts as 1; development builds warn about both. `(valueChange)`
265
+ fires once per user change and never for a programmatic write.
266
+
267
+ The buttons are squares of the control height (44px or more on a coarse pointer, 60px at `xl`). Component tokens:
268
+ `--ck-stepper-bg`, `--ck-stepper-border-color`, `--ck-stepper-radius` and `--ck-stepper-value-width` (default: as
269
+ wide as the formatted `min` and `max`).
270
+
271
+ Global element styles: an unlayered `button { border: … }` or `input { … }` beats the layered parts, and a global
272
+ `:focus-visible { outline: … }` draws a second ring on the input. Keep them off the stepper
273
+ (`button:not(.ck-stepper__button)`) or put resets in a layer declared before ckui: `@layer reset, ckui;`.
274
+
157
275
  ## Toast
158
276
 
159
277
  ```ts
@@ -0,0 +1,169 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, PLATFORM_ID, ViewEncapsulation, afterNextRender, booleanAttribute, computed, inject, input } from "@angular/core";
3
+ import { isPlatformBrowser } from "@angular/common";
4
+ const TONES = [
5
+ "neutral",
6
+ "success",
7
+ "warning",
8
+ "danger"
9
+ ];
10
+ const SIZES = ["sm", "md"];
11
+ var CkBadgeIcon = class CkBadgeIcon {
12
+ static ɵfac = i0.ɵɵngDeclareFactory({
13
+ minVersion: "12.0.0",
14
+ version: "22.2.4",
15
+ ngImport: i0,
16
+ type: CkBadgeIcon,
17
+ deps: [],
18
+ target: i0.ɵɵFactoryTarget.Directive
19
+ });
20
+ static ɵdir = i0.ɵɵngDeclareDirective({
21
+ minVersion: "14.0.0",
22
+ version: "22.2.4",
23
+ type: CkBadgeIcon,
24
+ isStandalone: true,
25
+ selector: "[ckBadgeIcon]",
26
+ host: {
27
+ attributes: { "aria-hidden": "true" },
28
+ classAttribute: "ck-badge__icon"
29
+ },
30
+ ngImport: i0
31
+ });
32
+ };
33
+ i0.ɵɵngDeclareClassMetadata({
34
+ minVersion: "12.0.0",
35
+ version: "22.2.4",
36
+ ngImport: i0,
37
+ type: CkBadgeIcon,
38
+ decorators: [{
39
+ type: Directive,
40
+ args: [{
41
+ selector: "[ckBadgeIcon]",
42
+ host: {
43
+ class: "ck-badge__icon",
44
+ "aria-hidden": "true"
45
+ }
46
+ }]
47
+ }]
48
+ });
49
+ var CkBadge = class CkBadge {
50
+ tone = input("neutral", ...ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []);
51
+ dot = input(false, {
52
+ ...ngDevMode ? { debugName: "dot" } : /* istanbul ignore next */ {},
53
+ transform: booleanAttribute
54
+ });
55
+ size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
56
+ element = inject(ElementRef).nativeElement;
57
+ modifierClasses = computed(() => {
58
+ return `ck-badge ck-badge--${TONES.includes(this.tone()) ? this.tone() : "neutral"} ck-badge--${SIZES.includes(this.size()) ? this.size() : "md"}`;
59
+ }, ...ngDevMode ? [{ debugName: "modifierClasses" }] : /* istanbul ignore next */ []);
60
+ constructor() {
61
+ if (typeof ngDevMode !== "undefined" && ngDevMode && isPlatformBrowser(inject(PLATFORM_ID))) {
62
+ let destroyed = false;
63
+ inject(DestroyRef).onDestroy(() => destroyed = true);
64
+ afterNextRender(() => {
65
+ const text = this.element.querySelector(".ck-badge__text");
66
+ if (!destroyed && (text?.textContent ?? "").trim() === "") console.warn("[ckui] ck-badge has no text. The text must state the status; a dot or an icon alone is colour alone.", this.element);
67
+ });
68
+ }
69
+ }
70
+ static ɵfac = i0.ɵɵngDeclareFactory({
71
+ minVersion: "12.0.0",
72
+ version: "22.2.4",
73
+ ngImport: i0,
74
+ type: CkBadge,
75
+ deps: [],
76
+ target: i0.ɵɵFactoryTarget.Component
77
+ });
78
+ static ɵcmp = i0.ɵɵngDeclareComponent({
79
+ minVersion: "17.0.0",
80
+ version: "22.2.4",
81
+ type: CkBadge,
82
+ isStandalone: true,
83
+ selector: "ck-badge",
84
+ inputs: {
85
+ tone: {
86
+ classPropertyName: "tone",
87
+ publicName: "tone",
88
+ isSignal: true,
89
+ isRequired: false,
90
+ transformFunction: null
91
+ },
92
+ dot: {
93
+ classPropertyName: "dot",
94
+ publicName: "dot",
95
+ isSignal: true,
96
+ isRequired: false,
97
+ transformFunction: null
98
+ },
99
+ size: {
100
+ classPropertyName: "size",
101
+ publicName: "size",
102
+ isSignal: true,
103
+ isRequired: false,
104
+ transformFunction: null
105
+ }
106
+ },
107
+ host: { properties: { "class": "modifierClasses()" } },
108
+ ngImport: i0,
109
+ template: `@if (dot()) {
110
+ <span class="ck-badge__dot" aria-hidden="true"></span>
111
+ }
112
+ <ng-content select="[ckBadgeIcon]" /><span class="ck-badge__text"><ng-content /></span>`,
113
+ isInline: true,
114
+ styles: ["@layer ckui{.ck-badge{--_ck-badge-bg: var(--ck-color-control);--_ck-badge-fg: var(--ck-color-fg);--_ck-badge-height: 1.5rem;--_ck-badge-font-size: var(--ck-font-size-sm);--_ck-badge-padding-inline: var(--ck-space-2);--_ck-badge-gap: calc(var(--ck-space-1) * 1.5);display:inline-flex;align-items:center;gap:var(--_ck-badge-gap);box-sizing:border-box;min-inline-size:0;max-inline-size:100%;block-size:var(--_ck-badge-height);padding-inline:var(--_ck-badge-padding-inline);border-radius:var(--ck-badge-radius, var(--ck-radius-full));background:var(--ck-badge-bg, var(--_ck-badge-bg));color:var(--ck-badge-fg, var(--_ck-badge-fg));color-scheme:var(--ck-color-scheme);font-family:inherit;font-size:var(--_ck-badge-font-size);font-weight:var(--ck-font-weight-semibold);font-variant-numeric:var(--ck-font-variant-numeric);line-height:var(--ck-line-height-tight);white-space:nowrap;vertical-align:middle}.ck-badge--sm{--_ck-badge-height: 1.25rem;--_ck-badge-font-size: var(--ck-font-size-xs);--_ck-badge-padding-inline: calc(var(--ck-space-1) * 1.5);--_ck-badge-gap: var(--ck-space-1)}.ck-badge--success{--_ck-badge-fg: var(--ck-color-success-fg)}.ck-badge--warning{--_ck-badge-fg: var(--ck-color-warning-fg)}.ck-badge--danger{--_ck-badge-bg: var(--ck-color-danger);--_ck-badge-fg: var(--ck-color-on-danger)}.ck-badge__text{display:block;min-inline-size:0;overflow:hidden;text-overflow:ellipsis}.ck-badge__dot{flex:none;inline-size:.5em;block-size:.5em;border-radius:var(--ck-radius-full);background:var(--ck-badge-dot, currentColor)}.ck-badge__icon{flex:none;inline-size:1em;block-size:1em}@media(forced-colors:active){.ck-badge{border:1px solid CanvasText}.ck-badge__dot{forced-color-adjust:none;background:CanvasText}}}\n"],
115
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
116
+ encapsulation: i0.ViewEncapsulation.None
117
+ });
118
+ };
119
+ i0.ɵɵngDeclareClassMetadata({
120
+ minVersion: "12.0.0",
121
+ version: "22.2.4",
122
+ ngImport: i0,
123
+ type: CkBadge,
124
+ decorators: [{
125
+ type: Component,
126
+ args: [{
127
+ selector: "ck-badge",
128
+ changeDetection: ChangeDetectionStrategy.OnPush,
129
+ encapsulation: ViewEncapsulation.None,
130
+ host: { "[class]": "modifierClasses()" },
131
+ template: `@if (dot()) {
132
+ <span class="ck-badge__dot" aria-hidden="true"></span>
133
+ }
134
+ <ng-content select="[ckBadgeIcon]" /><span class="ck-badge__text"><ng-content /></span>`,
135
+ styles: ["@layer ckui{.ck-badge{--_ck-badge-bg: var(--ck-color-control);--_ck-badge-fg: var(--ck-color-fg);--_ck-badge-height: 1.5rem;--_ck-badge-font-size: var(--ck-font-size-sm);--_ck-badge-padding-inline: var(--ck-space-2);--_ck-badge-gap: calc(var(--ck-space-1) * 1.5);display:inline-flex;align-items:center;gap:var(--_ck-badge-gap);box-sizing:border-box;min-inline-size:0;max-inline-size:100%;block-size:var(--_ck-badge-height);padding-inline:var(--_ck-badge-padding-inline);border-radius:var(--ck-badge-radius, var(--ck-radius-full));background:var(--ck-badge-bg, var(--_ck-badge-bg));color:var(--ck-badge-fg, var(--_ck-badge-fg));color-scheme:var(--ck-color-scheme);font-family:inherit;font-size:var(--_ck-badge-font-size);font-weight:var(--ck-font-weight-semibold);font-variant-numeric:var(--ck-font-variant-numeric);line-height:var(--ck-line-height-tight);white-space:nowrap;vertical-align:middle}.ck-badge--sm{--_ck-badge-height: 1.25rem;--_ck-badge-font-size: var(--ck-font-size-xs);--_ck-badge-padding-inline: calc(var(--ck-space-1) * 1.5);--_ck-badge-gap: var(--ck-space-1)}.ck-badge--success{--_ck-badge-fg: var(--ck-color-success-fg)}.ck-badge--warning{--_ck-badge-fg: var(--ck-color-warning-fg)}.ck-badge--danger{--_ck-badge-bg: var(--ck-color-danger);--_ck-badge-fg: var(--ck-color-on-danger)}.ck-badge__text{display:block;min-inline-size:0;overflow:hidden;text-overflow:ellipsis}.ck-badge__dot{flex:none;inline-size:.5em;block-size:.5em;border-radius:var(--ck-radius-full);background:var(--ck-badge-dot, currentColor)}.ck-badge__icon{flex:none;inline-size:1em;block-size:1em}@media(forced-colors:active){.ck-badge{border:1px solid CanvasText}.ck-badge__dot{forced-color-adjust:none;background:CanvasText}}}\n"]
136
+ }]
137
+ }],
138
+ ctorParameters: () => [],
139
+ propDecorators: {
140
+ tone: [{
141
+ type: i0.Input,
142
+ args: [{
143
+ isSignal: true,
144
+ alias: "tone",
145
+ required: false
146
+ }]
147
+ }],
148
+ dot: [{
149
+ type: i0.Input,
150
+ args: [{
151
+ isSignal: true,
152
+ alias: "dot",
153
+ required: false
154
+ }]
155
+ }],
156
+ size: [{
157
+ type: i0.Input,
158
+ args: [{
159
+ isSignal: true,
160
+ alias: "size",
161
+ required: false
162
+ }]
163
+ }]
164
+ }
165
+ });
166
+ const CK_BADGE_IMPORTS = [CkBadge, CkBadgeIcon];
167
+ export { CK_BADGE_IMPORTS, CkBadge, CkBadgeIcon };
168
+
169
+ //# sourceMappingURL=ckui-core-badge.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ckui-core-badge.mjs","names":[],"sources":["../../../../projects/core/badge/badge.ts","../../../../projects/core/badge/index.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n Directive,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\ndeclare const ngDevMode: unknown;\n\nexport type CkBadgeTone = 'neutral' | 'success' | 'warning' | 'danger';\nexport type CkBadgeSize = 'sm' | 'md';\n\nconst TONES: readonly CkBadgeTone[] = ['neutral', 'success', 'warning', 'danger'];\nconst SIZES: readonly CkBadgeSize[] = ['sm', 'md'];\n\n/** Marks a projected element (usually an `svg`) as the badge's leading icon. It is decorative. */\n@Directive({\n selector: '[ckBadgeIcon]',\n host: { class: 'ck-badge__icon', 'aria-hidden': 'true' },\n})\nexport class CkBadgeIcon {}\n\n/**\n * A small, non-interactive status label: a pill with text, an optional leading dot or icon. It is\n * not a live region and has no role; the text must say what the status is, colour never does.\n */\n@Component({\n selector: 'ck-badge',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'modifierClasses()',\n },\n template: `@if (dot()) {\n <span class=\"ck-badge__dot\" aria-hidden=\"true\"></span>\n }\n <ng-content select=\"[ckBadgeIcon]\" /><span class=\"ck-badge__text\"><ng-content /></span>`,\n styleUrl: './badge.css',\n})\nexport class CkBadge {\n /** Colours of the badge. An unknown value falls back to `neutral`. */\n readonly tone = input<CkBadgeTone>('neutral');\n /** Adds a leading dot in the text colour. */\n readonly dot = input(false, { transform: booleanAttribute });\n /** `md` is a 1.5rem pill, `sm` a smaller one for dense lists. An unknown value falls back to `md`. */\n readonly size = input<CkBadgeSize>('md');\n\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n protected readonly modifierClasses = computed(() => {\n const tone = TONES.includes(this.tone()) ? this.tone() : 'neutral';\n const size = SIZES.includes(this.size()) ? this.size() : 'md';\n return `ck-badge ck-badge--${tone} ck-badge--${size}`;\n });\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode && isPlatformBrowser(inject(PLATFORM_ID))) {\n let destroyed = false;\n inject(DestroyRef).onDestroy(() => (destroyed = true));\n afterNextRender(() => {\n const text = this.element.querySelector('.ck-badge__text');\n if (!destroyed && (text?.textContent ?? '').trim() === '') {\n console.warn(\n '[ckui] ck-badge has no text. The text must state the status; a dot or an icon alone is colour alone.',\n this.element,\n );\n }\n });\n }\n }\n}\n","import { CkBadge, CkBadgeIcon } from './badge';\n\nexport type { CkBadgeSize, CkBadgeTone } from './badge';\nexport { CkBadge, CkBadgeIcon } from './badge';\n\n/** Everything a template needs for a badge: `imports: [CK_BADGE_IMPORTS]`. */\nexport const CK_BADGE_IMPORTS = [CkBadge, CkBadgeIcon] as const;\n"],"mappings":";;;AAqBA,MAAM,QAAgC;CAAC;CAAW;CAAW;CAAW;AAAQ;AAChF,MAAM,QAAgC,CAAC,MAAM,IAAI;AAOjD,IAAa,cAAb,MAAa,YAAW;CAAX,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAW,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAX,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAW,cAAA;EAAA,UAAA;EAAA,MAAA;GAAA,YAAA,EAAA,eAAA,OAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;CAAA,C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AA;CAAP,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAO,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,KAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA,EAAA,YAAA,EAAA,SAAA,oBAAA,EAAA;EAAA,UAAA;EAAA,UANR;;;;EAGgF,UAAA;EAAA,QAAA,CAAA,srDAAA;EAAA,iBAAA,GAAA,wBAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAG/E,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EAbnB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAU,iBACH,wBAAwB;GAAM,eAChC,kBAAkB;GAAI,MAC/B,EACJ,WAAW,oBACZ;GAAA,UACS;;;;GAGgF,QAAA,CAAA,srDAAA;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACvC5F,MAAa,mBAAmB,CAAC,SAAS,WAAW"}
@@ -2,10 +2,11 @@ import { isPlatformBrowser } from "@angular/common";
2
2
  import * as i0 from "@angular/core";
3
3
  import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, Injectable, InjectionToken, Injector, PLATFORM_ID, Renderer2, TemplateRef, ViewContainerRef, ViewEncapsulation, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, effect, inject, input, model, output, signal, untracked } from "@angular/core";
4
4
  import { InteractivityChecker } from "@angular/cdk/a11y";
5
- import { CkIcon, CkOverlayHost, createCkId } from "@ckui/core/internal";
5
+ import { CkOverlayHost } from "@ckui/core/internal/overlay";
6
6
  import { CdkPortalOutlet, ComponentPortal, TemplatePortal } from "@angular/cdk/portal";
7
7
  import { CK_LABELS } from "@ckui/core";
8
8
  import { CkButton } from "@ckui/core/button";
9
+ import { CkIcon, createCkId } from "@ckui/core/internal";
9
10
  const CK_DIALOG_DATA = new InjectionToken("CK_DIALOG_DATA");
10
11
  var CkDialogIds = class {
11
12
  entries = signal([], ...ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []);
@@ -1 +1 @@
1
- {"version":3,"file":"ckui-core-dialog.mjs","names":[],"sources":["../../../../projects/core/dialog/config.ts","../../../../projects/core/dialog/dialog-context.ts","../../../../projects/core/dialog/dialog-ref.ts","../../../../projects/core/dialog/dialog-container.ts","../../../../projects/core/dialog/dialog.service.ts","../../../../projects/core/dialog/dialog.component.ts","../../../../projects/core/dialog/dialog-parts.ts","../../../../projects/core/dialog/index.ts"],"sourcesContent":["import { InjectionToken, Injector } from '@angular/core';\n\nexport type CkDialogRole = 'dialog' | 'alertdialog';\n/** Largest inline size of a modal dialog: 24, 32 or 48rem. */\nexport type CkDialogWidth = 'sm' | 'md' | 'lg';\n/** `auto` opens a sheet on a narrow screen with a coarse pointer, a centred modal otherwise. */\nexport type CkDialogMode = 'auto' | 'modal' | 'sheet';\n\nexport interface CkDialogConfig<D = unknown> {\n /** What the content gets from `inject(CK_DIALOG_DATA)`. */\n data?: D;\n /** `alertdialog` for a message the user has to answer. Default `dialog`. */\n role?: CkDialogRole;\n /** Default `md`. Under a sheet the dialog is as wide as the screen. */\n width?: CkDialogWidth;\n /** Escape, a click on the backdrop and a swipe down close the dialog. Default `true`. */\n dismissible?: boolean;\n /** Shows the close button next to the title. Default `true`. */\n closeButton?: boolean;\n /** Default `auto`, decided at the moment the dialog opens. */\n mode?: CkDialogMode;\n /** A sheet as tall as the screen allows instead of as tall as its content. Default `false`. */\n fullHeight?: boolean;\n /**\n * The parent injector of a component's content, for providers the app root doesn't have (route\n * level, or the opener's own): pass `inject(Injector)` from the opener. `CK_DIALOG_DATA` and\n * `CkDialogRef` are provided on top. Template content keeps the injector of its template.\n */\n injector?: Injector;\n /** The accessible name when the content has no `ckDialogTitle`. */\n ariaLabel?: string;\n}\n\n/** The `data` of the config, for a dialog opened with a component. */\nexport const CK_DIALOG_DATA = new InjectionToken<unknown>('CK_DIALOG_DATA');\n","import { InjectionToken, Signal, computed, signal } from '@angular/core';\nimport { CkDialogMode } from './config';\n\n/** The ids of every title (or description) in the dialog; the newest one names it. */\nexport class CkDialogIds {\n private readonly entries = signal<readonly Signal<string>[]>([]);\n readonly current = computed(() => this.entries().at(-1)?.() ?? null);\n\n /** Returns the function that takes the entry out again; it leaves the others alone. */\n add(id: Signal<string>): () => void {\n this.entries.update((entries) => [...entries, id]);\n return () => this.entries.update((entries) => entries.filter((entry) => entry !== id));\n }\n}\n\n/** What the building blocks inside a dialog tell the dialog: the ids that name it. */\nexport class CkDialogContext {\n readonly titles = new CkDialogIds();\n readonly descriptions = new CkDialogIds();\n readonly titleId = this.titles.current;\n readonly descriptionId = this.descriptions.current;\n /** Resolved when the dialog opens. */\n readonly mode = signal<Exclude<CkDialogMode, 'auto'>>('modal');\n}\n\nexport const CK_DIALOG_CONTEXT = new InjectionToken<CkDialogContext>('CK_DIALOG_CONTEXT');\n","/** What a `CkDialogRef` calls into; supplied by `CkDialog`, not by consumers. */\nexport interface CkDialogRefControls<R> {\n readonly closing: Promise<void>;\n readonly closed: Promise<R | undefined>;\n close(result: R | undefined): void;\n}\n\n/** Controls one open dialog. Returned by `CkDialog.open`, injected by its content; never constructed directly. */\nexport class CkDialogRef<R = unknown> {\n /**\n * Resolves once, after the dialog has left the screen, with the result of the first `close()`.\n * Escape, a click on the backdrop and a swipe resolve it with `undefined`, and so does destroying\n * the app.\n */\n readonly closed: Promise<R | undefined>;\n /**\n * Resolves once, the moment the dialog starts to close (before the leave animation), whatever\n * the cause. `closed` follows when it has left the screen.\n */\n readonly closing: Promise<void>;\n private readonly controls: CkDialogRefControls<R>;\n\n constructor(controls: CkDialogRefControls<R>) {\n this.controls = controls;\n this.closed = controls.closed;\n this.closing = controls.closing;\n }\n\n /** Closes the dialog. Only the first call counts; later ones, with another result too, do nothing. */\n close(result?: R): void {\n this.controls.close(result);\n }\n}\n","import { CdkPortalOutlet, ComponentPortal, Portal, TemplatePortal } from '@angular/cdk/portal';\nimport {\n ChangeDetectionStrategy,\n Component,\n ComponentRef,\n EmbeddedViewRef,\n InjectionToken,\n Injector,\n TemplateRef,\n ViewContainerRef,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { ComponentType } from '@angular/cdk/portal';\nimport { CK_LABELS } from '@ckui/core';\nimport { CkButton } from '@ckui/core/button';\nimport { CkIcon } from '@ckui/core/internal';\nimport { CK_DIALOG_CONTEXT } from './dialog-context';\nimport { CkDialogRef } from './dialog-ref';\n\n/** What the service hands the container: the consumer's content and the parts of the config it shows. */\nexport interface CkDialogContainerSetup {\n readonly content: ComponentType<unknown> | TemplateRef<unknown>;\n readonly closeButton: boolean;\n readonly dismissible: boolean;\n}\n\nexport const CK_DIALOG_SETUP = new InjectionToken<CkDialogContainerSetup>('CK_DIALOG_SETUP');\n\n/** The dialog's own element inside the overlay: the padding, the close button and the consumer's content. */\n@Component({\n selector: 'ck-dialog-container',\n imports: [CdkPortalOutlet, CkButton, CkIcon],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ck-dialog',\n '[class.ck-dialog--sheet]': 'context.mode() === \"sheet\"',\n '[class.ck-dialog--grab]': 'context.mode() === \"sheet\" && setup.dismissible',\n '[class.ck-dialog--has-close]': 'setup.closeButton',\n '[class.ck-dialog--no-title]': 'context.titleId() === null',\n },\n template: `\n <div class=\"ck-dialog__content\">\n <ng-template [cdkPortalOutlet]=\"portal\" (attached)=\"onAttached($event)\" />\n </div>\n @if (setup.closeButton) {\n <button\n ckButton\n type=\"button\"\n variant=\"ghost\"\n size=\"md\"\n iconOnly\n class=\"ck-dialog__close\"\n [attr.aria-label]=\"labels().close\"\n (click)=\"ref.close()\"\n >\n <ck-icon name=\"close\" />\n </button>\n }\n `,\n styleUrl: './dialog.css',\n})\nexport class CkDialogContainer {\n protected readonly context = inject(CK_DIALOG_CONTEXT);\n protected readonly setup = inject(CK_DIALOG_SETUP);\n protected readonly labels = inject(CK_LABELS);\n protected readonly ref = inject(CkDialogRef);\n\n protected readonly portal: Portal<unknown>;\n\n constructor() {\n const injector = inject(Injector);\n this.portal =\n this.setup.content instanceof TemplateRef\n ? new TemplatePortal(this.setup.content, inject(ViewContainerRef), undefined, injector)\n : new ComponentPortal(this.setup.content, null, injector);\n }\n\n /** A component's host element has to be a flex column too, or its body could not scroll. */\n protected onAttached(attached: ComponentRef<unknown> | EmbeddedViewRef<unknown> | null): void {\n if (attached && 'location' in attached) {\n (attached.location.nativeElement as HTMLElement).classList.add('ck-dialog__component');\n }\n }\n}\n","import { ComponentType } from '@angular/cdk/portal';\nimport { InteractivityChecker } from '@angular/cdk/a11y';\nimport {\n DestroyRef,\n EffectRef,\n Injectable,\n Injector,\n TemplateRef,\n effect,\n inject,\n} from '@angular/core';\nimport { CkOverlayHandle, CkOverlayHost } from '@ckui/core/internal';\nimport { CK_DIALOG_DATA, CkDialogConfig } from './config';\nimport { CK_DIALOG_CONTEXT, CkDialogContext } from './dialog-context';\nimport { CK_DIALOG_SETUP, CkDialogContainer } from './dialog-container';\nimport { CkDialogRef } from './dialog-ref';\n\ndeclare const ngDevMode: unknown;\n\nconst TABBABLE_CANDIDATES =\n 'a[href], button, input, select, textarea, summary, [tabindex], [contenteditable], audio[controls], video[controls]';\n\ninterface ActiveDialog {\n close(): void;\n /** Settles the result promise and stops everything that outlives the overlay. */\n destroy(): void;\n}\n\n/**\n * Opens modal dialogs, which become bottom sheets on a phone. Takes a component or a template as\n * content and returns a `CkDialogRef` that closes it and delivers the result.\n */\n@Injectable({ providedIn: 'root' })\nexport class CkDialog {\n private readonly overlay = inject(CkOverlayHost);\n private readonly checker = inject(InteractivityChecker);\n private readonly injector = inject(Injector);\n private readonly active = new Set<ActiveDialog>();\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n for (const dialog of [...this.active]) {\n dialog.destroy();\n }\n this.active.clear();\n });\n }\n\n /**\n * Opens a dialog. The content injects `CK_DIALOG_DATA` and `CkDialogRef`; a component sees the\n * app's providers, plus those of `config.injector` when given. On the server nothing is shown and\n * `closed` resolves with `undefined` at once.\n */\n open<C, D = unknown, R = unknown>(\n content: ComponentType<C> | TemplateRef<unknown>,\n config: CkDialogConfig<D> = {},\n ): CkDialogRef<R> {\n const dismissible = config.dismissible ?? true;\n const closeButton = config.closeButton ?? true;\n const context = new CkDialogContext();\n\n let resolveClosed: (result: R | undefined) => void = () => undefined;\n const closed = new Promise<R | undefined>((resolve) => (resolveClosed = resolve));\n let resolveClosing: () => void = () => undefined;\n const closing = new Promise<void>((resolve) => (resolveClosing = resolve));\n let handle: CkOverlayHandle | null = null;\n let requested = false;\n let result: R | undefined;\n let settled = false;\n let labelling: EffectRef | null = null;\n const dialog: ActiveDialog = { close: () => ref.close(), destroy: () => settle() };\n\n const settle = (): void => {\n if (settled) {\n return;\n }\n settled = true;\n resolveClosing();\n labelling?.destroy();\n this.active.delete(dialog);\n resolveClosed(result);\n };\n\n const ref = new CkDialogRef<R>({\n closed,\n closing,\n close: (value) => {\n if (requested) {\n return;\n }\n requested = true;\n result = value;\n resolveClosing();\n // Closed from the content's constructor, before the overlay exists: it closes right after opening.\n void handle?.close();\n },\n });\n\n this.active.add(dialog);\n\n const dialogInjector = Injector.create({\n parent: config.injector ?? this.injector,\n providers: [\n { provide: CK_DIALOG_CONTEXT, useValue: context },\n { provide: CkDialogRef, useValue: ref },\n { provide: CK_DIALOG_DATA, useValue: config.data },\n {\n provide: CK_DIALOG_SETUP,\n useValue: { content, closeButton, dismissible },\n },\n ],\n });\n\n try {\n handle = this.overlay.open(\n CkDialogContainer,\n {\n mode: config.mode ?? 'auto',\n dismissible,\n fullHeight: config.fullHeight ?? false,\n role: config.role ?? 'dialog',\n ariaLabel: config.ariaLabel,\n panelClass: ['ck-dialog-panel', `ck-dialog-panel--${config.width ?? 'md'}`],\n onDismissRequest: () => ref.close(),\n initialFocus: () => (handle ? this.initialFocus(handle.panel) : null),\n },\n dialogInjector,\n );\n } catch (error) {\n settle();\n throw error;\n }\n\n const opened = handle;\n context.mode.set(opened.mode);\n labelling = effect(\n () => {\n this.setAttribute(opened.panel, 'aria-labelledby', context.titleId());\n this.setAttribute(opened.panel, 'aria-describedby', context.descriptionId());\n },\n { injector: this.injector },\n );\n void opened.closed.then(settle);\n if (requested) {\n void opened.close();\n }\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n void opened.opened.then(() => {\n if (!settled && context.titleId() === null && !config.ariaLabel) {\n console.warn(\n 'CkDialog: the dialog has no accessible name. Add [ckDialogTitle] to a heading in its content or set `ariaLabel` in the config.',\n );\n }\n });\n }\n return ref;\n }\n\n /** Closes every open dialog as if each one's `close()` had been called without a result. */\n closeAll(): void {\n for (const dialog of [...this.active]) {\n dialog.close();\n }\n }\n\n private setAttribute(element: HTMLElement, name: string, value: string | null): void {\n if (value === null) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value);\n }\n }\n\n /**\n * The marked element, else the first tabbable one of the content (the close button comes last in\n * the DOM, and the scrolling body itself is skipped), else the panel.\n */\n private initialFocus(panel: HTMLElement): HTMLElement {\n const marked = Array.from(\n panel.querySelectorAll<HTMLElement>('[data-ck-dialog-initial-focus]'),\n ).find((candidate) => this.checker.isFocusable(candidate));\n if (marked) {\n return marked;\n }\n const content = panel.querySelector<HTMLElement>('.ck-dialog__content');\n const first = Array.from(\n content?.querySelectorAll<HTMLElement>(TABBABLE_CANDIDATES) ?? [],\n ).find(\n (candidate) =>\n !candidate.classList.contains('ck-dialog-body') && this.checker.isTabbable(candidate),\n );\n return first ?? panel;\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n PLATFORM_ID,\n TemplateRef,\n ViewEncapsulation,\n afterRenderEffect,\n booleanAttribute,\n contentChild,\n inject,\n input,\n model,\n output,\n untracked,\n} from '@angular/core';\nimport { CkDialogMode, CkDialogRole, CkDialogWidth } from './config';\nimport { CkDialogRef } from './dialog-ref';\nimport { CkDialog } from './dialog.service';\n\ndeclare const ngDevMode: unknown;\n\n/**\n * A dialog declared in a template. Its content is one `<ng-template>` that is only rendered while\n * `open` is true, so nothing in it exists while the dialog is closed. `[(open)]` follows the dialog:\n * Escape, the backdrop, the close button and `[ckDialogClose]` set it back to `false`.\n */\n@Component({\n selector: 'ck-dialog',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: { style: 'display: none' },\n template: ``,\n})\nexport class CkDialogComponent {\n readonly open = model(false);\n readonly role = input<CkDialogRole>('dialog');\n readonly width = input<CkDialogWidth>('md');\n readonly dismissible = input(true, { transform: booleanAttribute });\n readonly closeButton = input(true, { transform: booleanAttribute });\n readonly mode = input<CkDialogMode>('auto');\n readonly fullHeight = input(false, { transform: booleanAttribute });\n readonly ariaLabel = input<string | undefined>(undefined);\n /** Emits when the dialog has left the screen, with the result of `[ckDialogClose]`, else `undefined`. */\n readonly closed = output<unknown>();\n\n private readonly template = contentChild(TemplateRef);\n private readonly dialog = inject(CkDialog);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private ref: CkDialogRef | null = null;\n private destroyed = false;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.destroyed = true;\n this.ref?.close();\n this.ref = null;\n });\n // After render: never on the server, and never while a template is being checked.\n afterRenderEffect(() => {\n const wanted = this.open();\n if (!this.isBrowser) {\n return;\n }\n untracked(() => this.sync(wanted));\n });\n }\n\n private sync(wanted: boolean): void {\n if (wanted && !this.ref) {\n this.show();\n } else if (!wanted && this.ref) {\n const ref = this.ref;\n this.ref = null;\n ref.close();\n }\n }\n\n private show(): void {\n const template = this.template();\n if (!template) {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n console.warn('ck-dialog: put the content in an <ng-template> inside the element.');\n }\n this.open.set(false);\n return;\n }\n const ref = this.dialog.open(template, {\n role: this.role(),\n width: this.width(),\n dismissible: this.dismissible(),\n closeButton: this.closeButton(),\n mode: this.mode(),\n fullHeight: this.fullHeight(),\n ariaLabel: this.ariaLabel(),\n });\n this.ref = ref;\n // `open` follows the moment the close starts, so the opener can reopen during the leave animation.\n void ref.closing.then(() => {\n if (!this.destroyed && this.ref === ref) {\n this.ref = null;\n this.open.set(false);\n }\n });\n void ref.closed.then((result) => {\n if (!this.destroyed) {\n this.closed.emit(result);\n }\n });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n Directive,\n ElementRef,\n PLATFORM_ID,\n Renderer2,\n ViewEncapsulation,\n afterNextRender,\n inject,\n input,\n untracked,\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { createCkId } from '@ckui/core/internal';\nimport { CK_DIALOG_CONTEXT } from './dialog-context';\nimport { CkDialogRef } from './dialog-ref';\n\n/** Marks a heading as the title of the dialog: it names the dialog (`aria-labelledby`). */\n@Directive({\n selector: '[ckDialogTitle]',\n host: { class: 'ck-dialog__title', '[attr.id]': 'id()' },\n})\nexport class CkDialogTitle {\n /** Default: a generated id. */\n readonly id = input(createCkId('ck-dialog-title'));\n\n constructor() {\n const context = inject(CK_DIALOG_CONTEXT, { optional: true });\n if (context) {\n const remove = untracked(() => context.titles.add(this.id));\n inject(DestroyRef).onDestroy(() => untracked(remove));\n }\n }\n}\n\n/** Marks the text that explains the dialog: it describes it (`aria-describedby`). */\n@Directive({\n selector: '[ckDialogDescription]',\n host: { class: 'ck-dialog__description', '[attr.id]': 'id()' },\n})\nexport class CkDialogDescription {\n /** Default: a generated id. */\n readonly id = input(createCkId('ck-dialog-description'));\n\n constructor() {\n const context = inject(CK_DIALOG_CONTEXT, { optional: true });\n if (context) {\n const remove = untracked(() => context.descriptions.add(this.id));\n inject(DestroyRef).onDestroy(() => untracked(remove));\n }\n }\n}\n\n/** The part of a dialog that scrolls when the content is taller than the screen. */\n@Component({\n selector: 'ck-dialog-body',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: { class: 'ck-dialog-body' },\n template: `<div class=\"ck-dialog-body__inner\"><ng-content /></div>`,\n})\nexport class CkDialogBody {\n constructor() {\n const element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const renderer = inject(Renderer2);\n const destroyRef = inject(DestroyRef);\n let ownTabindex = false;\n\n // A region that scrolls must be reachable by keyboard, but only while it actually scrolls.\n const update = (): void => {\n const scrolls = element.scrollHeight > element.clientHeight + 1;\n if (scrolls && !element.hasAttribute('tabindex')) {\n renderer.setAttribute(element, 'tabindex', '0');\n ownTabindex = true;\n } else if (!scrolls && ownTabindex) {\n renderer.removeAttribute(element, 'tabindex');\n ownTabindex = false;\n }\n };\n\n if (isPlatformBrowser(inject(PLATFORM_ID))) {\n afterNextRender(() => {\n const Observer = element.ownerDocument.defaultView?.ResizeObserver;\n if (!Observer || destroyRef.destroyed) {\n return;\n }\n const observer = new Observer(update);\n observer.observe(element);\n observer.observe(element.firstElementChild!);\n destroyRef.onDestroy(() => observer.disconnect());\n update();\n });\n }\n }\n}\n\n/** The row of buttons at the bottom of a dialog. On a sheet they stack and fill the width. */\n@Component({\n selector: 'ck-dialog-actions',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: { class: 'ck-dialog-actions' },\n template: `<ng-content />`,\n})\nexport class CkDialogActions {}\n\n/** Closes the dialog with the bound value as its result when the element is clicked. */\n@Directive({\n selector: '[ckDialogClose]',\n host: { '(click)': 'close()' },\n})\nexport class CkDialogClose<R = unknown> {\n /** The result of the dialog; empty means `undefined`. */\n readonly result = input<R | '' | undefined>(undefined, { alias: 'ckDialogClose' });\n\n private readonly ref = inject<CkDialogRef<R>>(CkDialogRef, { optional: true });\n\n constructor() {\n const element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n // A native button in a form would submit it.\n if (element.tagName === 'BUTTON' && !element.hasAttribute('type')) {\n inject(Renderer2).setAttribute(element, 'type', 'button');\n }\n }\n\n protected close(): void {\n const result = this.result();\n this.ref?.close(result === '' ? undefined : result);\n }\n}\n\n/** Takes focus when the dialog opens, e.g. the least destructive action of an `alertdialog`. */\n@Directive({\n selector: '[ckDialogInitialFocus]',\n host: { 'data-ck-dialog-initial-focus': '' },\n})\nexport class CkDialogInitialFocus {}\n","import { CkDialogComponent } from './dialog.component';\nimport {\n CkDialogActions,\n CkDialogBody,\n CkDialogClose,\n CkDialogDescription,\n CkDialogInitialFocus,\n CkDialogTitle,\n} from './dialog-parts';\n\nexport type { CkDialogConfig, CkDialogMode, CkDialogRole, CkDialogWidth } from './config';\nexport { CK_DIALOG_DATA } from './config';\nexport { CkDialogRef } from './dialog-ref';\nexport { CkDialog } from './dialog.service';\nexport { CkDialogComponent } from './dialog.component';\nexport {\n CkDialogActions,\n CkDialogBody,\n CkDialogClose,\n CkDialogDescription,\n CkDialogInitialFocus,\n CkDialogTitle,\n} from './dialog-parts';\n\n/** Everything a template needs for a dialog: `imports: [CK_DIALOG_IMPORTS]`. */\nexport const CK_DIALOG_IMPORTS = [\n CkDialogComponent,\n CkDialogTitle,\n CkDialogDescription,\n CkDialogBody,\n CkDialogActions,\n CkDialogClose,\n CkDialogInitialFocus,\n] as const;\n"],"mappings":";;;;;;;;AAkCA,MAAa,iBAAiB,IAAI,eAAwB,gBAAgB;AC9B1E,IAAa,cAAb,MAAwB;CACL,UAAU,OAAkC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACvD,UAAU,eAAe,KAAK,QAAO,CAAE,CAAC,GAAG,EAAE,CAAC,GAAE,KAAM,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CA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A;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAJzB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM,EAAE,WAAW,UAAS;EAC7B,CAAA;;;;;;;;;;;;AA0BD,IAAa,uBAAb,MAAa,qBAAoB;CAApB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAoB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAApB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAoB,cAAA;EAAA,UAAA;EAAA,MAAA,EAAA,YAAA,EAAA,gCAAA,GAAA,EAAA;EAAA,UAAA;CAAA,CAAA;;AAApB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EAJhC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM,EAAE,gCAAgC,GAAE;EAC3C,CAAA;;;AChHD,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;AACQ"}
1
+ {"version":3,"file":"ckui-core-dialog.mjs","names":[],"sources":["../../../../projects/core/dialog/config.ts","../../../../projects/core/dialog/dialog-context.ts","../../../../projects/core/dialog/dialog-ref.ts","../../../../projects/core/dialog/dialog-container.ts","../../../../projects/core/dialog/dialog.service.ts","../../../../projects/core/dialog/dialog.component.ts","../../../../projects/core/dialog/dialog-parts.ts","../../../../projects/core/dialog/index.ts"],"sourcesContent":["import { InjectionToken, Injector } from '@angular/core';\n\nexport type CkDialogRole = 'dialog' | 'alertdialog';\n/** Largest inline size of a modal dialog: 24, 32 or 48rem. */\nexport type CkDialogWidth = 'sm' | 'md' | 'lg';\n/** `auto` opens a sheet on a narrow screen with a coarse pointer, a centred modal otherwise. */\nexport type CkDialogMode = 'auto' | 'modal' | 'sheet';\n\nexport interface CkDialogConfig<D = unknown> {\n /** What the content gets from `inject(CK_DIALOG_DATA)`. */\n data?: D;\n /** `alertdialog` for a message the user has to answer. Default `dialog`. */\n role?: CkDialogRole;\n /** Default `md`. Under a sheet the dialog is as wide as the screen. */\n width?: CkDialogWidth;\n /** Escape, a click on the backdrop and a swipe down close the dialog. Default `true`. */\n dismissible?: boolean;\n /** Shows the close button next to the title. Default `true`. */\n closeButton?: boolean;\n /** Default `auto`, decided at the moment the dialog opens. */\n mode?: CkDialogMode;\n /** A sheet as tall as the screen allows instead of as tall as its content. Default `false`. */\n fullHeight?: boolean;\n /**\n * The parent injector of a component's content, for providers the app root doesn't have (route\n * level, or the opener's own): pass `inject(Injector)` from the opener. `CK_DIALOG_DATA` and\n * `CkDialogRef` are provided on top. Template content keeps the injector of its template.\n */\n injector?: Injector;\n /** The accessible name when the content has no `ckDialogTitle`. */\n ariaLabel?: string;\n}\n\n/** The `data` of the config, for a dialog opened with a component. */\nexport const CK_DIALOG_DATA = new InjectionToken<unknown>('CK_DIALOG_DATA');\n","import { InjectionToken, Signal, computed, signal } from '@angular/core';\nimport { CkDialogMode } from './config';\n\n/** The ids of every title (or description) in the dialog; the newest one names it. */\nexport class CkDialogIds {\n private readonly entries = signal<readonly Signal<string>[]>([]);\n readonly current = computed(() => this.entries().at(-1)?.() ?? null);\n\n /** Returns the function that takes the entry out again; it leaves the others alone. */\n add(id: Signal<string>): () => void {\n this.entries.update((entries) => [...entries, id]);\n return () => this.entries.update((entries) => entries.filter((entry) => entry !== id));\n }\n}\n\n/** What the building blocks inside a dialog tell the dialog: the ids that name it. */\nexport class CkDialogContext {\n readonly titles = new CkDialogIds();\n readonly descriptions = new CkDialogIds();\n readonly titleId = this.titles.current;\n readonly descriptionId = this.descriptions.current;\n /** Resolved when the dialog opens. */\n readonly mode = signal<Exclude<CkDialogMode, 'auto'>>('modal');\n}\n\nexport const CK_DIALOG_CONTEXT = new InjectionToken<CkDialogContext>('CK_DIALOG_CONTEXT');\n","/** What a `CkDialogRef` calls into; supplied by `CkDialog`, not by consumers. */\nexport interface CkDialogRefControls<R> {\n readonly closing: Promise<void>;\n readonly closed: Promise<R | undefined>;\n close(result: R | undefined): void;\n}\n\n/** Controls one open dialog. Returned by `CkDialog.open`, injected by its content; never constructed directly. */\nexport class CkDialogRef<R = unknown> {\n /**\n * Resolves once, after the dialog has left the screen, with the result of the first `close()`.\n * Escape, a click on the backdrop and a swipe resolve it with `undefined`, and so does destroying\n * the app.\n */\n readonly closed: Promise<R | undefined>;\n /**\n * Resolves once, the moment the dialog starts to close (before the leave animation), whatever\n * the cause. `closed` follows when it has left the screen.\n */\n readonly closing: Promise<void>;\n private readonly controls: CkDialogRefControls<R>;\n\n constructor(controls: CkDialogRefControls<R>) {\n this.controls = controls;\n this.closed = controls.closed;\n this.closing = controls.closing;\n }\n\n /** Closes the dialog. Only the first call counts; later ones, with another result too, do nothing. */\n close(result?: R): void {\n this.controls.close(result);\n }\n}\n","import { CdkPortalOutlet, ComponentPortal, Portal, TemplatePortal } from '@angular/cdk/portal';\nimport {\n ChangeDetectionStrategy,\n Component,\n ComponentRef,\n EmbeddedViewRef,\n InjectionToken,\n Injector,\n TemplateRef,\n ViewContainerRef,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { ComponentType } from '@angular/cdk/portal';\nimport { CK_LABELS } from '@ckui/core';\nimport { CkButton } from '@ckui/core/button';\nimport { CkIcon } from '@ckui/core/internal';\nimport { CK_DIALOG_CONTEXT } from './dialog-context';\nimport { CkDialogRef } from './dialog-ref';\n\n/** What the service hands the container: the consumer's content and the parts of the config it shows. */\nexport interface CkDialogContainerSetup {\n readonly content: ComponentType<unknown> | TemplateRef<unknown>;\n readonly closeButton: boolean;\n readonly dismissible: boolean;\n}\n\nexport const CK_DIALOG_SETUP = new InjectionToken<CkDialogContainerSetup>('CK_DIALOG_SETUP');\n\n/** The dialog's own element inside the overlay: the padding, the close button and the consumer's content. */\n@Component({\n selector: 'ck-dialog-container',\n imports: [CdkPortalOutlet, CkButton, CkIcon],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ck-dialog',\n '[class.ck-dialog--sheet]': 'context.mode() === \"sheet\"',\n '[class.ck-dialog--grab]': 'context.mode() === \"sheet\" && setup.dismissible',\n '[class.ck-dialog--has-close]': 'setup.closeButton',\n '[class.ck-dialog--no-title]': 'context.titleId() === null',\n },\n template: `\n <div class=\"ck-dialog__content\">\n <ng-template [cdkPortalOutlet]=\"portal\" (attached)=\"onAttached($event)\" />\n </div>\n @if (setup.closeButton) {\n <button\n ckButton\n type=\"button\"\n variant=\"ghost\"\n size=\"md\"\n iconOnly\n class=\"ck-dialog__close\"\n [attr.aria-label]=\"labels().close\"\n (click)=\"ref.close()\"\n >\n <ck-icon name=\"close\" />\n </button>\n }\n `,\n styleUrl: './dialog.css',\n})\nexport class CkDialogContainer {\n protected readonly context = inject(CK_DIALOG_CONTEXT);\n protected readonly setup = inject(CK_DIALOG_SETUP);\n protected readonly labels = inject(CK_LABELS);\n protected readonly ref = inject(CkDialogRef);\n\n protected readonly portal: Portal<unknown>;\n\n constructor() {\n const injector = inject(Injector);\n this.portal =\n this.setup.content instanceof TemplateRef\n ? new TemplatePortal(this.setup.content, inject(ViewContainerRef), undefined, injector)\n : new ComponentPortal(this.setup.content, null, injector);\n }\n\n /** A component's host element has to be a flex column too, or its body could not scroll. */\n protected onAttached(attached: ComponentRef<unknown> | EmbeddedViewRef<unknown> | null): void {\n if (attached && 'location' in attached) {\n (attached.location.nativeElement as HTMLElement).classList.add('ck-dialog__component');\n }\n }\n}\n","import { ComponentType } from '@angular/cdk/portal';\nimport { InteractivityChecker } from '@angular/cdk/a11y';\nimport {\n DestroyRef,\n EffectRef,\n Injectable,\n Injector,\n TemplateRef,\n effect,\n inject,\n} from '@angular/core';\nimport { CkOverlayHandle, CkOverlayHost } from '@ckui/core/internal/overlay';\nimport { CK_DIALOG_DATA, CkDialogConfig } from './config';\nimport { CK_DIALOG_CONTEXT, CkDialogContext } from './dialog-context';\nimport { CK_DIALOG_SETUP, CkDialogContainer } from './dialog-container';\nimport { CkDialogRef } from './dialog-ref';\n\ndeclare const ngDevMode: unknown;\n\nconst TABBABLE_CANDIDATES =\n 'a[href], button, input, select, textarea, summary, [tabindex], [contenteditable], audio[controls], video[controls]';\n\ninterface ActiveDialog {\n close(): void;\n /** Settles the result promise and stops everything that outlives the overlay. */\n destroy(): void;\n}\n\n/**\n * Opens modal dialogs, which become bottom sheets on a phone. Takes a component or a template as\n * content and returns a `CkDialogRef` that closes it and delivers the result.\n */\n@Injectable({ providedIn: 'root' })\nexport class CkDialog {\n private readonly overlay = inject(CkOverlayHost);\n private readonly checker = inject(InteractivityChecker);\n private readonly injector = inject(Injector);\n private readonly active = new Set<ActiveDialog>();\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n for (const dialog of [...this.active]) {\n dialog.destroy();\n }\n this.active.clear();\n });\n }\n\n /**\n * Opens a dialog. The content injects `CK_DIALOG_DATA` and `CkDialogRef`; a component sees the\n * app's providers, plus those of `config.injector` when given. On the server nothing is shown and\n * `closed` resolves with `undefined` at once.\n */\n open<C, D = unknown, R = unknown>(\n content: ComponentType<C> | TemplateRef<unknown>,\n config: CkDialogConfig<D> = {},\n ): CkDialogRef<R> {\n const dismissible = config.dismissible ?? true;\n const closeButton = config.closeButton ?? true;\n const context = new CkDialogContext();\n\n let resolveClosed: (result: R | undefined) => void = () => undefined;\n const closed = new Promise<R | undefined>((resolve) => (resolveClosed = resolve));\n let resolveClosing: () => void = () => undefined;\n const closing = new Promise<void>((resolve) => (resolveClosing = resolve));\n let handle: CkOverlayHandle | null = null;\n let requested = false;\n let result: R | undefined;\n let settled = false;\n let labelling: EffectRef | null = null;\n const dialog: ActiveDialog = { close: () => ref.close(), destroy: () => settle() };\n\n const settle = (): void => {\n if (settled) {\n return;\n }\n settled = true;\n resolveClosing();\n labelling?.destroy();\n this.active.delete(dialog);\n resolveClosed(result);\n };\n\n const ref = new CkDialogRef<R>({\n closed,\n closing,\n close: (value) => {\n if (requested) {\n return;\n }\n requested = true;\n result = value;\n resolveClosing();\n // Closed from the content's constructor, before the overlay exists: it closes right after opening.\n void handle?.close();\n },\n });\n\n this.active.add(dialog);\n\n const dialogInjector = Injector.create({\n parent: config.injector ?? this.injector,\n providers: [\n { provide: CK_DIALOG_CONTEXT, useValue: context },\n { provide: CkDialogRef, useValue: ref },\n { provide: CK_DIALOG_DATA, useValue: config.data },\n {\n provide: CK_DIALOG_SETUP,\n useValue: { content, closeButton, dismissible },\n },\n ],\n });\n\n try {\n handle = this.overlay.open(\n CkDialogContainer,\n {\n mode: config.mode ?? 'auto',\n dismissible,\n fullHeight: config.fullHeight ?? false,\n role: config.role ?? 'dialog',\n ariaLabel: config.ariaLabel,\n panelClass: ['ck-dialog-panel', `ck-dialog-panel--${config.width ?? 'md'}`],\n onDismissRequest: () => ref.close(),\n initialFocus: () => (handle ? this.initialFocus(handle.panel) : null),\n },\n dialogInjector,\n );\n } catch (error) {\n settle();\n throw error;\n }\n\n const opened = handle;\n context.mode.set(opened.mode);\n labelling = effect(\n () => {\n this.setAttribute(opened.panel, 'aria-labelledby', context.titleId());\n this.setAttribute(opened.panel, 'aria-describedby', context.descriptionId());\n },\n { injector: this.injector },\n );\n void opened.closed.then(settle);\n if (requested) {\n void opened.close();\n }\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n void opened.opened.then(() => {\n if (!settled && context.titleId() === null && !config.ariaLabel) {\n console.warn(\n 'CkDialog: the dialog has no accessible name. Add [ckDialogTitle] to a heading in its content or set `ariaLabel` in the config.',\n );\n }\n });\n }\n return ref;\n }\n\n /** Closes every open dialog as if each one's `close()` had been called without a result. */\n closeAll(): void {\n for (const dialog of [...this.active]) {\n dialog.close();\n }\n }\n\n private setAttribute(element: HTMLElement, name: string, value: string | null): void {\n if (value === null) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value);\n }\n }\n\n /**\n * The marked element, else the first tabbable one of the content (the close button comes last in\n * the DOM, and the scrolling body itself is skipped), else the panel.\n */\n private initialFocus(panel: HTMLElement): HTMLElement {\n const marked = Array.from(\n panel.querySelectorAll<HTMLElement>('[data-ck-dialog-initial-focus]'),\n ).find((candidate) => this.checker.isFocusable(candidate));\n if (marked) {\n return marked;\n }\n const content = panel.querySelector<HTMLElement>('.ck-dialog__content');\n const first = Array.from(\n content?.querySelectorAll<HTMLElement>(TABBABLE_CANDIDATES) ?? [],\n ).find(\n (candidate) =>\n !candidate.classList.contains('ck-dialog-body') && this.checker.isTabbable(candidate),\n );\n return first ?? panel;\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n PLATFORM_ID,\n TemplateRef,\n ViewEncapsulation,\n afterRenderEffect,\n booleanAttribute,\n contentChild,\n inject,\n input,\n model,\n output,\n untracked,\n} from '@angular/core';\nimport { CkDialogMode, CkDialogRole, CkDialogWidth } from './config';\nimport { CkDialogRef } from './dialog-ref';\nimport { CkDialog } from './dialog.service';\n\ndeclare const ngDevMode: unknown;\n\n/**\n * A dialog declared in a template. Its content is one `<ng-template>` that is only rendered while\n * `open` is true, so nothing in it exists while the dialog is closed. `[(open)]` follows the dialog:\n * Escape, the backdrop, the close button and `[ckDialogClose]` set it back to `false`.\n */\n@Component({\n selector: 'ck-dialog',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: { style: 'display: none' },\n template: ``,\n})\nexport class CkDialogComponent {\n readonly open = model(false);\n readonly role = input<CkDialogRole>('dialog');\n readonly width = input<CkDialogWidth>('md');\n readonly dismissible = input(true, { transform: booleanAttribute });\n readonly closeButton = input(true, { transform: booleanAttribute });\n readonly mode = input<CkDialogMode>('auto');\n readonly fullHeight = input(false, { transform: booleanAttribute });\n readonly ariaLabel = input<string | undefined>(undefined);\n /** Emits when the dialog has left the screen, with the result of `[ckDialogClose]`, else `undefined`. */\n readonly closed = output<unknown>();\n\n private readonly template = contentChild(TemplateRef);\n private readonly dialog = inject(CkDialog);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private ref: CkDialogRef | null = null;\n private destroyed = false;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.destroyed = true;\n this.ref?.close();\n this.ref = null;\n });\n // After render: never on the server, and never while a template is being checked.\n afterRenderEffect(() => {\n const wanted = this.open();\n if (!this.isBrowser) {\n return;\n }\n untracked(() => this.sync(wanted));\n });\n }\n\n private sync(wanted: boolean): void {\n if (wanted && !this.ref) {\n this.show();\n } else if (!wanted && this.ref) {\n const ref = this.ref;\n this.ref = null;\n ref.close();\n }\n }\n\n private show(): void {\n const template = this.template();\n if (!template) {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n console.warn('ck-dialog: put the content in an <ng-template> inside the element.');\n }\n this.open.set(false);\n return;\n }\n const ref = this.dialog.open(template, {\n role: this.role(),\n width: this.width(),\n dismissible: this.dismissible(),\n closeButton: this.closeButton(),\n mode: this.mode(),\n fullHeight: this.fullHeight(),\n ariaLabel: this.ariaLabel(),\n });\n this.ref = ref;\n // `open` follows the moment the close starts, so the opener can reopen during the leave animation.\n void ref.closing.then(() => {\n if (!this.destroyed && this.ref === ref) {\n this.ref = null;\n this.open.set(false);\n }\n });\n void ref.closed.then((result) => {\n if (!this.destroyed) {\n this.closed.emit(result);\n }\n });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n Directive,\n ElementRef,\n PLATFORM_ID,\n Renderer2,\n ViewEncapsulation,\n afterNextRender,\n inject,\n input,\n untracked,\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { createCkId } from '@ckui/core/internal';\nimport { CK_DIALOG_CONTEXT } from './dialog-context';\nimport { CkDialogRef } from './dialog-ref';\n\n/** Marks a heading as the title of the dialog: it names the dialog (`aria-labelledby`). */\n@Directive({\n selector: '[ckDialogTitle]',\n host: { class: 'ck-dialog__title', '[attr.id]': 'id()' },\n})\nexport class CkDialogTitle {\n /** Default: a generated id. */\n readonly id = input(createCkId('ck-dialog-title'));\n\n constructor() {\n const context = inject(CK_DIALOG_CONTEXT, { optional: true });\n if (context) {\n const remove = untracked(() => context.titles.add(this.id));\n inject(DestroyRef).onDestroy(() => untracked(remove));\n }\n }\n}\n\n/** Marks the text that explains the dialog: it describes it (`aria-describedby`). */\n@Directive({\n selector: '[ckDialogDescription]',\n host: { class: 'ck-dialog__description', '[attr.id]': 'id()' },\n})\nexport class CkDialogDescription {\n /** Default: a generated id. */\n readonly id = input(createCkId('ck-dialog-description'));\n\n constructor() {\n const context = inject(CK_DIALOG_CONTEXT, { optional: true });\n if (context) {\n const remove = untracked(() => context.descriptions.add(this.id));\n inject(DestroyRef).onDestroy(() => untracked(remove));\n }\n }\n}\n\n/** The part of a dialog that scrolls when the content is taller than the screen. */\n@Component({\n selector: 'ck-dialog-body',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: { class: 'ck-dialog-body' },\n template: `<div class=\"ck-dialog-body__inner\"><ng-content /></div>`,\n})\nexport class CkDialogBody {\n constructor() {\n const element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const renderer = inject(Renderer2);\n const destroyRef = inject(DestroyRef);\n let ownTabindex = false;\n\n // A region that scrolls must be reachable by keyboard, but only while it actually scrolls.\n const update = (): void => {\n const scrolls = element.scrollHeight > element.clientHeight + 1;\n if (scrolls && !element.hasAttribute('tabindex')) {\n renderer.setAttribute(element, 'tabindex', '0');\n ownTabindex = true;\n } else if (!scrolls && ownTabindex) {\n renderer.removeAttribute(element, 'tabindex');\n ownTabindex = false;\n }\n };\n\n if (isPlatformBrowser(inject(PLATFORM_ID))) {\n afterNextRender(() => {\n const Observer = element.ownerDocument.defaultView?.ResizeObserver;\n if (!Observer || destroyRef.destroyed) {\n return;\n }\n const observer = new Observer(update);\n observer.observe(element);\n observer.observe(element.firstElementChild!);\n destroyRef.onDestroy(() => observer.disconnect());\n update();\n });\n }\n }\n}\n\n/** The row of buttons at the bottom of a dialog. On a sheet they stack and fill the width. */\n@Component({\n selector: 'ck-dialog-actions',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: { class: 'ck-dialog-actions' },\n template: `<ng-content />`,\n})\nexport class CkDialogActions {}\n\n/** Closes the dialog with the bound value as its result when the element is clicked. */\n@Directive({\n selector: '[ckDialogClose]',\n host: { '(click)': 'close()' },\n})\nexport class CkDialogClose<R = unknown> {\n /** The result of the dialog; empty means `undefined`. */\n readonly result = input<R | '' | undefined>(undefined, { alias: 'ckDialogClose' });\n\n private readonly ref = inject<CkDialogRef<R>>(CkDialogRef, { optional: true });\n\n constructor() {\n const element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n // A native button in a form would submit it.\n if (element.tagName === 'BUTTON' && !element.hasAttribute('type')) {\n inject(Renderer2).setAttribute(element, 'type', 'button');\n }\n }\n\n protected close(): void {\n const result = this.result();\n this.ref?.close(result === '' ? undefined : result);\n }\n}\n\n/** Takes focus when the dialog opens, e.g. the least destructive action of an `alertdialog`. */\n@Directive({\n selector: '[ckDialogInitialFocus]',\n host: { 'data-ck-dialog-initial-focus': '' },\n})\nexport class CkDialogInitialFocus {}\n","import { CkDialogComponent } from './dialog.component';\nimport {\n CkDialogActions,\n CkDialogBody,\n CkDialogClose,\n CkDialogDescription,\n CkDialogInitialFocus,\n CkDialogTitle,\n} from './dialog-parts';\n\nexport type { CkDialogConfig, CkDialogMode, CkDialogRole, CkDialogWidth } from './config';\nexport { CK_DIALOG_DATA } from './config';\nexport { CkDialogRef } from './dialog-ref';\nexport { CkDialog } from './dialog.service';\nexport { CkDialogComponent } from './dialog.component';\nexport {\n CkDialogActions,\n CkDialogBody,\n CkDialogClose,\n CkDialogDescription,\n CkDialogInitialFocus,\n CkDialogTitle,\n} from './dialog-parts';\n\n/** Everything a template needs for a dialog: `imports: [CK_DIALOG_IMPORTS]`. */\n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