@wirekyt/angular 0.0.28 → 0.0.29

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.
@@ -0,0 +1,567 @@
1
+ import * as popover from '@wirekyt/dom/machines/popover';
2
+ export { anatomy as popoverAnatomy } from '@wirekyt/dom/machines/popover';
3
+ import * as i0 from '@angular/core';
4
+ import { InjectionToken, inject, input, model, booleanAttribute, output, EnvironmentInjector, Injector, forwardRef, Directive, computed, DestroyRef, Renderer2, ElementRef, TemplateRef, ViewContainerRef, effect, untracked } from '@angular/core';
5
+ import { injectLocale, injectEnvironment, createId, useMachine, buildRootCarrier, bindProps } from '@wirekyt/angular';
6
+ import { PresenceBase, PRESENCE_CONTEXT, injectPresenceContext } from '@wirekyt/angular/presence';
7
+
8
+ const POPOVER_CONTEXT = new InjectionToken("WIREKYT.POPOVER_CONTEXT");
9
+ function injectPopoverContext() {
10
+ return inject(POPOVER_CONTEXT);
11
+ }
12
+ const POPOVER_CONTEXT_CARRIER = new InjectionToken("WIREKYT.POPOVER_CONTEXT_CARRIER");
13
+ function injectPopoverContextCarrier() {
14
+ return inject(POPOVER_CONTEXT_CARRIER);
15
+ }
16
+ const POPOVER_RENDER_STRATEGY_CONTEXT = new InjectionToken("WIREKYT.POPOVER_RENDER_STRATEGY_CONTEXT");
17
+ function injectPopoverRenderStrategyContext() {
18
+ return inject(POPOVER_RENDER_STRATEGY_CONTEXT);
19
+ }
20
+
21
+ function usePopover(options) {
22
+ const locale = injectLocale();
23
+ const environment = injectEnvironment();
24
+ const fallbackId = createId();
25
+ return useMachine({
26
+ machine: popover.machine,
27
+ context: () => {
28
+ const props = options.context();
29
+ return {
30
+ ...props,
31
+ dir: locale.dir,
32
+ getRootNode: environment.getRootNode,
33
+ id: props.id ?? fallbackId,
34
+ };
35
+ },
36
+ connect: (service, normalize) => popover.connect(service, normalize),
37
+ });
38
+ }
39
+
40
+ class PopoverRoot extends PresenceBase {
41
+ id = input(undefined, /* @ts-ignore */
42
+ ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
43
+ ids = input(undefined, /* @ts-ignore */
44
+ ...(ngDevMode ? [{ debugName: "ids" }] : /* istanbul ignore next */ []));
45
+ open = model(undefined, /* @ts-ignore */
46
+ ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
47
+ defaultOpen = input(false, { ...(ngDevMode ? { debugName: "defaultOpen" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
48
+ modal = input(false, { ...(ngDevMode ? { debugName: "modal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
49
+ portalled = input(true, { ...(ngDevMode ? { debugName: "portalled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
50
+ autoFocus = input(true, { ...(ngDevMode ? { debugName: "autoFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
51
+ restoreFocus = input(true, { ...(ngDevMode ? { debugName: "restoreFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
52
+ closeOnInteractOutside = input(true, { ...(ngDevMode ? { debugName: "closeOnInteractOutside" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
53
+ closeOnEscape = input(true, { ...(ngDevMode ? { debugName: "closeOnEscape" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
54
+ positioning = input(undefined, /* @ts-ignore */
55
+ ...(ngDevMode ? [{ debugName: "positioning" }] : /* istanbul ignore next */ []));
56
+ initialFocusEl = input(undefined, /* @ts-ignore */
57
+ ...(ngDevMode ? [{ debugName: "initialFocusEl" }] : /* istanbul ignore next */ []));
58
+ finalFocusEl = input(undefined, /* @ts-ignore */
59
+ ...(ngDevMode ? [{ debugName: "finalFocusEl" }] : /* istanbul ignore next */ []));
60
+ persistentElements = input(undefined, /* @ts-ignore */
61
+ ...(ngDevMode ? [{ debugName: "persistentElements" }] : /* istanbul ignore next */ []));
62
+ translations = input(undefined, /* @ts-ignore */
63
+ ...(ngDevMode ? [{ debugName: "translations" }] : /* istanbul ignore next */ []));
64
+ triggerValue = model(undefined, /* @ts-ignore */
65
+ ...(ngDevMode ? [{ debugName: "triggerValue" }] : /* istanbul ignore next */ []));
66
+ defaultTriggerValue = input(undefined, /* @ts-ignore */
67
+ ...(ngDevMode ? [{ debugName: "defaultTriggerValue" }] : /* istanbul ignore next */ []));
68
+ escapeKeyDown = output();
69
+ focusOutside = output();
70
+ interactOutside = output();
71
+ pointerDownOutside = output();
72
+ requestDismiss = output();
73
+ openChangeDetails = output();
74
+ triggerValueChangeDetails = output();
75
+ machine = usePopover({
76
+ context: () => ({
77
+ id: this.id(),
78
+ ids: this.ids(),
79
+ open: this.open(),
80
+ defaultOpen: this.defaultOpen(),
81
+ modal: this.modal(),
82
+ portalled: this.portalled(),
83
+ autoFocus: this.autoFocus(),
84
+ restoreFocus: this.restoreFocus(),
85
+ closeOnInteractOutside: this.closeOnInteractOutside(),
86
+ closeOnEscape: this.closeOnEscape(),
87
+ positioning: this.positioning(),
88
+ initialFocusEl: this.initialFocusEl(),
89
+ finalFocusEl: this.finalFocusEl(),
90
+ persistentElements: this.persistentElements(),
91
+ translations: this.translations(),
92
+ triggerValue: this.triggerValue(),
93
+ defaultTriggerValue: this.defaultTriggerValue(),
94
+ onOpenChange: (details) => {
95
+ if (this.open() !== details.open) {
96
+ this.open.set(details.open);
97
+ }
98
+ this.openChangeDetails.emit(details);
99
+ },
100
+ onTriggerValueChange: (details) => {
101
+ if (this.triggerValue() !== details.value) {
102
+ this.triggerValue.set(details.value);
103
+ }
104
+ this.triggerValueChangeDetails.emit(details);
105
+ },
106
+ onEscapeKeyDown: (event) => this.escapeKeyDown.emit(event),
107
+ onFocusOutside: (event) => this.focusOutside.emit(event),
108
+ onInteractOutside: (event) => this.interactOutside.emit(event),
109
+ onPointerDownOutside: (event) => this.pointerDownOutside.emit(event),
110
+ onRequestDismiss: (event) => this.requestDismiss.emit(event),
111
+ }),
112
+ });
113
+ state = this.machine.state;
114
+ api = this.machine.api;
115
+ service = this.machine.service;
116
+ send = this.machine.send;
117
+ presence = this.createPresence(() => this.api().open);
118
+ contextCarrier = buildRootCarrier({
119
+ providers: [
120
+ { provide: PRESENCE_CONTEXT, useValue: this.presence },
121
+ { provide: POPOVER_RENDER_STRATEGY_CONTEXT, useValue: this },
122
+ ],
123
+ root: this,
124
+ rootToken: POPOVER_CONTEXT,
125
+ originInjector: inject(Injector),
126
+ environmentInjector: inject(EnvironmentInjector),
127
+ });
128
+ getContextCarrier() {
129
+ return this.contextCarrier;
130
+ }
131
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverRoot, deps: null, target: i0.ɵɵFactoryTarget.Directive });
132
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: PopoverRoot, isStandalone: true, selector: "[popover-root]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ids: { classPropertyName: "ids", publicName: "ids", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, defaultOpen: { classPropertyName: "defaultOpen", publicName: "defaultOpen", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, portalled: { classPropertyName: "portalled", publicName: "portalled", isSignal: true, isRequired: false, transformFunction: null }, autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, restoreFocus: { classPropertyName: "restoreFocus", publicName: "restoreFocus", isSignal: true, isRequired: false, transformFunction: null }, closeOnInteractOutside: { classPropertyName: "closeOnInteractOutside", publicName: "closeOnInteractOutside", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, positioning: { classPropertyName: "positioning", publicName: "positioning", isSignal: true, isRequired: false, transformFunction: null }, initialFocusEl: { classPropertyName: "initialFocusEl", publicName: "initialFocusEl", isSignal: true, isRequired: false, transformFunction: null }, finalFocusEl: { classPropertyName: "finalFocusEl", publicName: "finalFocusEl", isSignal: true, isRequired: false, transformFunction: null }, persistentElements: { classPropertyName: "persistentElements", publicName: "persistentElements", isSignal: true, isRequired: false, transformFunction: null }, translations: { classPropertyName: "translations", publicName: "translations", isSignal: true, isRequired: false, transformFunction: null }, triggerValue: { classPropertyName: "triggerValue", publicName: "triggerValue", isSignal: true, isRequired: false, transformFunction: null }, defaultTriggerValue: { classPropertyName: "defaultTriggerValue", publicName: "defaultTriggerValue", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", triggerValue: "triggerValueChange", escapeKeyDown: "escapeKeyDown", focusOutside: "focusOutside", interactOutside: "interactOutside", pointerDownOutside: "pointerDownOutside", requestDismiss: "requestDismiss", openChangeDetails: "openChangeDetails", triggerValueChangeDetails: "triggerValueChangeDetails" }, providers: [
133
+ {
134
+ provide: PRESENCE_CONTEXT,
135
+ useFactory: (root) => root.presence,
136
+ deps: [forwardRef(() => PopoverRoot)],
137
+ },
138
+ {
139
+ provide: POPOVER_RENDER_STRATEGY_CONTEXT,
140
+ useExisting: forwardRef(() => PopoverRoot),
141
+ },
142
+ { provide: POPOVER_CONTEXT, useExisting: forwardRef(() => PopoverRoot) },
143
+ {
144
+ provide: POPOVER_CONTEXT_CARRIER,
145
+ useFactory: (root) => root.getContextCarrier(),
146
+ deps: [forwardRef(() => PopoverRoot)],
147
+ },
148
+ ], exportAs: ["popoverRoot"], usesInheritance: true, ngImport: i0 });
149
+ }
150
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverRoot, decorators: [{
151
+ type: Directive,
152
+ args: [{
153
+ selector: "[popover-root]",
154
+ standalone: true,
155
+ exportAs: "popoverRoot",
156
+ providers: [
157
+ {
158
+ provide: PRESENCE_CONTEXT,
159
+ useFactory: (root) => root.presence,
160
+ deps: [forwardRef(() => PopoverRoot)],
161
+ },
162
+ {
163
+ provide: POPOVER_RENDER_STRATEGY_CONTEXT,
164
+ useExisting: forwardRef(() => PopoverRoot),
165
+ },
166
+ { provide: POPOVER_CONTEXT, useExisting: forwardRef(() => PopoverRoot) },
167
+ {
168
+ provide: POPOVER_CONTEXT_CARRIER,
169
+ useFactory: (root) => root.getContextCarrier(),
170
+ deps: [forwardRef(() => PopoverRoot)],
171
+ },
172
+ ],
173
+ }]
174
+ }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ids: [{ type: i0.Input, args: [{ isSignal: true, alias: "ids", required: false }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], defaultOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultOpen", required: false }] }], modal: [{ type: i0.Input, args: [{ isSignal: true, alias: "modal", required: false }] }], portalled: [{ type: i0.Input, args: [{ isSignal: true, alias: "portalled", required: false }] }], autoFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFocus", required: false }] }], restoreFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "restoreFocus", required: false }] }], closeOnInteractOutside: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnInteractOutside", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], positioning: [{ type: i0.Input, args: [{ isSignal: true, alias: "positioning", required: false }] }], initialFocusEl: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialFocusEl", required: false }] }], finalFocusEl: [{ type: i0.Input, args: [{ isSignal: true, alias: "finalFocusEl", required: false }] }], persistentElements: [{ type: i0.Input, args: [{ isSignal: true, alias: "persistentElements", required: false }] }], translations: [{ type: i0.Input, args: [{ isSignal: true, alias: "translations", required: false }] }], triggerValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "triggerValue", required: false }] }, { type: i0.Output, args: ["triggerValueChange"] }], defaultTriggerValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultTriggerValue", required: false }] }], escapeKeyDown: [{ type: i0.Output, args: ["escapeKeyDown"] }], focusOutside: [{ type: i0.Output, args: ["focusOutside"] }], interactOutside: [{ type: i0.Output, args: ["interactOutside"] }], pointerDownOutside: [{ type: i0.Output, args: ["pointerDownOutside"] }], requestDismiss: [{ type: i0.Output, args: ["requestDismiss"] }], openChangeDetails: [{ type: i0.Output, args: ["openChangeDetails"] }], triggerValueChangeDetails: [{ type: i0.Output, args: ["triggerValueChangeDetails"] }] } });
175
+
176
+ class PopoverRootProvider extends PresenceBase {
177
+ value = input.required(/* @ts-ignore */
178
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
179
+ state = computed(() => this.value().state(), /* @ts-ignore */
180
+ ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
181
+ api = computed(() => this.value().api(), /* @ts-ignore */
182
+ ...(ngDevMode ? [{ debugName: "api" }] : /* istanbul ignore next */ []));
183
+ send = (event) => this.value().send(event);
184
+ get service() {
185
+ return this.value().service;
186
+ }
187
+ presence = this.createPresence(() => {
188
+ try {
189
+ return this.api().open;
190
+ }
191
+ catch {
192
+ return false;
193
+ }
194
+ });
195
+ contextCarrier = buildRootCarrier({
196
+ providers: [
197
+ { provide: PRESENCE_CONTEXT, useValue: this.presence },
198
+ { provide: POPOVER_RENDER_STRATEGY_CONTEXT, useValue: this },
199
+ ],
200
+ root: this,
201
+ rootToken: POPOVER_CONTEXT,
202
+ originInjector: inject(Injector),
203
+ environmentInjector: inject(EnvironmentInjector),
204
+ });
205
+ getContextCarrier() {
206
+ return this.contextCarrier;
207
+ }
208
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverRootProvider, deps: null, target: i0.ɵɵFactoryTarget.Directive });
209
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: PopoverRootProvider, isStandalone: true, selector: "[popover-root-provider]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
210
+ {
211
+ provide: PRESENCE_CONTEXT,
212
+ useFactory: (provider) => provider.presence,
213
+ deps: [forwardRef(() => PopoverRootProvider)],
214
+ },
215
+ {
216
+ provide: POPOVER_RENDER_STRATEGY_CONTEXT,
217
+ useExisting: forwardRef(() => PopoverRootProvider),
218
+ },
219
+ { provide: POPOVER_CONTEXT, useExisting: forwardRef(() => PopoverRootProvider) },
220
+ {
221
+ provide: POPOVER_CONTEXT_CARRIER,
222
+ useFactory: (provider) => provider.getContextCarrier(),
223
+ deps: [forwardRef(() => PopoverRootProvider)],
224
+ },
225
+ ], exportAs: ["popoverRootProvider"], usesInheritance: true, ngImport: i0 });
226
+ }
227
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverRootProvider, decorators: [{
228
+ type: Directive,
229
+ args: [{
230
+ selector: "[popover-root-provider]",
231
+ standalone: true,
232
+ exportAs: "popoverRootProvider",
233
+ providers: [
234
+ {
235
+ provide: PRESENCE_CONTEXT,
236
+ useFactory: (provider) => provider.presence,
237
+ deps: [forwardRef(() => PopoverRootProvider)],
238
+ },
239
+ {
240
+ provide: POPOVER_RENDER_STRATEGY_CONTEXT,
241
+ useExisting: forwardRef(() => PopoverRootProvider),
242
+ },
243
+ { provide: POPOVER_CONTEXT, useExisting: forwardRef(() => PopoverRootProvider) },
244
+ {
245
+ provide: POPOVER_CONTEXT_CARRIER,
246
+ useFactory: (provider) => provider.getContextCarrier(),
247
+ deps: [forwardRef(() => PopoverRootProvider)],
248
+ },
249
+ ],
250
+ }]
251
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
252
+
253
+ class PopoverTrigger {
254
+ value = input(undefined, /* @ts-ignore */
255
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
256
+ constructor() {
257
+ const context = injectPopoverContext();
258
+ const presence = injectPresenceContext();
259
+ bindProps({
260
+ elementRef: inject(ElementRef),
261
+ renderer: inject(Renderer2),
262
+ destroyRef: inject(DestroyRef),
263
+ props: () => {
264
+ const props = context.api().getTriggerProps({ value: this.value() });
265
+ return {
266
+ ...props,
267
+ "aria-controls": presence.unmounted() ? undefined : props["aria-controls"],
268
+ };
269
+ },
270
+ });
271
+ }
272
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
273
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: PopoverTrigger, isStandalone: true, selector: "[popover-trigger]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["popoverTrigger"], ngImport: i0 });
274
+ }
275
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverTrigger, decorators: [{
276
+ type: Directive,
277
+ args: [{
278
+ selector: "[popover-trigger]",
279
+ standalone: true,
280
+ exportAs: "popoverTrigger",
281
+ }]
282
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
283
+
284
+ class PopoverAnchor {
285
+ constructor() {
286
+ const context = injectPopoverContext();
287
+ bindProps({
288
+ elementRef: inject(ElementRef),
289
+ renderer: inject(Renderer2),
290
+ destroyRef: inject(DestroyRef),
291
+ props: () => context.api().getAnchorProps(),
292
+ });
293
+ }
294
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverAnchor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
295
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: PopoverAnchor, isStandalone: true, selector: "[popover-anchor]", exportAs: ["popoverAnchor"], ngImport: i0 });
296
+ }
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverAnchor, decorators: [{
298
+ type: Directive,
299
+ args: [{
300
+ selector: "[popover-anchor]",
301
+ standalone: true,
302
+ exportAs: "popoverAnchor",
303
+ }]
304
+ }], ctorParameters: () => [] });
305
+
306
+ class PopoverPositioner {
307
+ constructor() {
308
+ const context = injectPopoverContext();
309
+ const presence = injectPresenceContext();
310
+ const template = inject((TemplateRef), { optional: true });
311
+ const container = inject(ViewContainerRef);
312
+ const host = inject(ElementRef);
313
+ const elementRef = template ? { nativeElement: null } : host;
314
+ let view;
315
+ effect(() => {
316
+ const unmounted = presence.unmounted();
317
+ if (template) {
318
+ if (unmounted) {
319
+ elementRef.nativeElement = null;
320
+ container.clear();
321
+ view = undefined;
322
+ }
323
+ else if (!view) {
324
+ view = container.createEmbeddedView(template);
325
+ elementRef.nativeElement =
326
+ view.rootNodes.find((node) => node.nodeType === 1) ?? null;
327
+ }
328
+ }
329
+ });
330
+ bindProps({
331
+ elementRef,
332
+ renderer: inject(Renderer2),
333
+ destroyRef: inject(DestroyRef),
334
+ props: () => {
335
+ const unmounted = presence.unmounted();
336
+ return { ...context.api().getPositionerProps(), hidden: unmounted };
337
+ },
338
+ });
339
+ }
340
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverPositioner, deps: [], target: i0.ɵɵFactoryTarget.Directive });
341
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: PopoverPositioner, isStandalone: true, selector: "[popover-positioner]", exportAs: ["popoverPositioner"], ngImport: i0 });
342
+ }
343
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverPositioner, decorators: [{
344
+ type: Directive,
345
+ args: [{
346
+ selector: "[popover-positioner]",
347
+ standalone: true,
348
+ exportAs: "popoverPositioner",
349
+ }]
350
+ }], ctorParameters: () => [] });
351
+
352
+ class PopoverContent {
353
+ constructor() {
354
+ const context = injectPopoverContext();
355
+ const presence = injectPresenceContext();
356
+ const template = inject((TemplateRef), { optional: true });
357
+ const container = inject(ViewContainerRef);
358
+ const host = inject(ElementRef);
359
+ const elementRef = template ? { nativeElement: null } : host;
360
+ let view;
361
+ effect(() => {
362
+ const unmounted = presence.unmounted();
363
+ if (template) {
364
+ if (unmounted) {
365
+ elementRef.nativeElement = null;
366
+ container.clear();
367
+ view = undefined;
368
+ }
369
+ else if (!view) {
370
+ view = container.createEmbeddedView(template);
371
+ elementRef.nativeElement =
372
+ view.rootNodes.find((node) => node.nodeType === 1) ?? null;
373
+ }
374
+ }
375
+ untracked(() => presence.setNode(elementRef.nativeElement));
376
+ });
377
+ bindProps({
378
+ elementRef,
379
+ renderer: inject(Renderer2),
380
+ destroyRef: inject(DestroyRef),
381
+ props: () => {
382
+ presence.unmounted();
383
+ return { ...context.api().getContentProps(), ...presence.getPresenceProps() };
384
+ },
385
+ });
386
+ }
387
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
388
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: PopoverContent, isStandalone: true, selector: "[popover-content]", exportAs: ["popoverContent"], ngImport: i0 });
389
+ }
390
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverContent, decorators: [{
391
+ type: Directive,
392
+ args: [{
393
+ selector: "[popover-content]",
394
+ standalone: true,
395
+ exportAs: "popoverContent",
396
+ }]
397
+ }], ctorParameters: () => [] });
398
+
399
+ class PopoverTitle {
400
+ constructor() {
401
+ const context = injectPopoverContext();
402
+ bindProps({
403
+ elementRef: inject(ElementRef),
404
+ renderer: inject(Renderer2),
405
+ destroyRef: inject(DestroyRef),
406
+ props: () => context.api().getTitleProps(),
407
+ });
408
+ }
409
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
410
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: PopoverTitle, isStandalone: true, selector: "[popover-title]", exportAs: ["popoverTitle"], ngImport: i0 });
411
+ }
412
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverTitle, decorators: [{
413
+ type: Directive,
414
+ args: [{
415
+ selector: "[popover-title]",
416
+ standalone: true,
417
+ exportAs: "popoverTitle",
418
+ }]
419
+ }], ctorParameters: () => [] });
420
+
421
+ class PopoverDescription {
422
+ constructor() {
423
+ const context = injectPopoverContext();
424
+ bindProps({
425
+ elementRef: inject(ElementRef),
426
+ renderer: inject(Renderer2),
427
+ destroyRef: inject(DestroyRef),
428
+ props: () => context.api().getDescriptionProps(),
429
+ });
430
+ }
431
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive });
432
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: PopoverDescription, isStandalone: true, selector: "[popover-description]", exportAs: ["popoverDescription"], ngImport: i0 });
433
+ }
434
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverDescription, decorators: [{
435
+ type: Directive,
436
+ args: [{
437
+ selector: "[popover-description]",
438
+ standalone: true,
439
+ exportAs: "popoverDescription",
440
+ }]
441
+ }], ctorParameters: () => [] });
442
+
443
+ class PopoverCloseTrigger {
444
+ constructor() {
445
+ const context = injectPopoverContext();
446
+ bindProps({
447
+ elementRef: inject(ElementRef),
448
+ renderer: inject(Renderer2),
449
+ destroyRef: inject(DestroyRef),
450
+ props: () => context.api().getCloseTriggerProps(),
451
+ });
452
+ }
453
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverCloseTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
454
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: PopoverCloseTrigger, isStandalone: true, selector: "[popover-close-trigger]", exportAs: ["popoverCloseTrigger"], ngImport: i0 });
455
+ }
456
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverCloseTrigger, decorators: [{
457
+ type: Directive,
458
+ args: [{
459
+ selector: "[popover-close-trigger]",
460
+ standalone: true,
461
+ exportAs: "popoverCloseTrigger",
462
+ }]
463
+ }], ctorParameters: () => [] });
464
+
465
+ class PopoverIndicator {
466
+ constructor() {
467
+ const context = injectPopoverContext();
468
+ bindProps({
469
+ elementRef: inject(ElementRef),
470
+ renderer: inject(Renderer2),
471
+ destroyRef: inject(DestroyRef),
472
+ props: () => context.api().getIndicatorProps(),
473
+ });
474
+ }
475
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverIndicator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
476
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: PopoverIndicator, isStandalone: true, selector: "[popover-indicator]", exportAs: ["popoverIndicator"], ngImport: i0 });
477
+ }
478
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverIndicator, decorators: [{
479
+ type: Directive,
480
+ args: [{
481
+ selector: "[popover-indicator]",
482
+ standalone: true,
483
+ exportAs: "popoverIndicator",
484
+ }]
485
+ }], ctorParameters: () => [] });
486
+
487
+ class PopoverArrow {
488
+ constructor() {
489
+ const context = injectPopoverContext();
490
+ bindProps({
491
+ elementRef: inject(ElementRef),
492
+ renderer: inject(Renderer2),
493
+ destroyRef: inject(DestroyRef),
494
+ props: () => context.api().getArrowProps(),
495
+ });
496
+ }
497
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverArrow, deps: [], target: i0.ɵɵFactoryTarget.Directive });
498
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: PopoverArrow, isStandalone: true, selector: "[popover-arrow]", exportAs: ["popoverArrow"], ngImport: i0 });
499
+ }
500
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverArrow, decorators: [{
501
+ type: Directive,
502
+ args: [{
503
+ selector: "[popover-arrow]",
504
+ standalone: true,
505
+ exportAs: "popoverArrow",
506
+ }]
507
+ }], ctorParameters: () => [] });
508
+
509
+ class PopoverArrowTip {
510
+ constructor() {
511
+ const context = injectPopoverContext();
512
+ bindProps({
513
+ elementRef: inject(ElementRef),
514
+ renderer: inject(Renderer2),
515
+ destroyRef: inject(DestroyRef),
516
+ props: () => context.api().getArrowTipProps(),
517
+ });
518
+ }
519
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverArrowTip, deps: [], target: i0.ɵɵFactoryTarget.Directive });
520
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: PopoverArrowTip, isStandalone: true, selector: "[popover-arrow-tip]", exportAs: ["popoverArrowTip"], ngImport: i0 });
521
+ }
522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverArrowTip, decorators: [{
523
+ type: Directive,
524
+ args: [{
525
+ selector: "[popover-arrow-tip]",
526
+ standalone: true,
527
+ exportAs: "popoverArrowTip",
528
+ }]
529
+ }], ctorParameters: () => [] });
530
+
531
+ class PopoverContext {
532
+ static ngTemplateContextGuard(_directive, context) {
533
+ void context;
534
+ return true;
535
+ }
536
+ popover = injectPopoverContext();
537
+ templateRef = inject(TemplateRef);
538
+ viewContainer = inject(ViewContainerRef);
539
+ constructor() {
540
+ const view = this.viewContainer.createEmbeddedView(this.templateRef, {
541
+ $implicit: this.popover.api,
542
+ api: this.popover.api,
543
+ });
544
+ effect(() => {
545
+ this.popover.api();
546
+ view.detectChanges();
547
+ });
548
+ inject(DestroyRef).onDestroy(() => view.destroy());
549
+ }
550
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverContext, deps: [], target: i0.ɵɵFactoryTarget.Directive });
551
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: PopoverContext, isStandalone: true, selector: "[popover-context]", exportAs: ["popoverContext"], ngImport: i0 });
552
+ }
553
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: PopoverContext, decorators: [{
554
+ type: Directive,
555
+ args: [{
556
+ selector: "[popover-context]",
557
+ standalone: true,
558
+ exportAs: "popoverContext",
559
+ }]
560
+ }], ctorParameters: () => [] });
561
+
562
+ /**
563
+ * Generated bundle index. Do not edit.
564
+ */
565
+
566
+ export { POPOVER_CONTEXT, POPOVER_CONTEXT_CARRIER, POPOVER_RENDER_STRATEGY_CONTEXT, PopoverAnchor, PopoverArrow, PopoverArrowTip, PopoverCloseTrigger, PopoverContent, PopoverContext, PopoverDescription, PopoverIndicator, PopoverPositioner, PopoverRoot, PopoverRootProvider, PopoverTitle, PopoverTrigger, injectPopoverContext, injectPopoverContextCarrier, injectPopoverRenderStrategyContext, usePopover };
567
+ //# sourceMappingURL=wirekyt-angular-popover.mjs.map