@spartan-ng/brain 0.0.1-alpha.555 → 0.0.1-alpha.556

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.
@@ -1,5 +1,10 @@
1
- import { BrnAccordion, BrnAccordionItem, BrnAccordionTrigger } from './lib/brn-accordion';
1
+ import { BrnAccordion } from './lib/brn-accordion';
2
2
  import { BrnAccordionContent } from './lib/brn-accordion-content';
3
+ import { BrnAccordionItem } from './lib/brn-accordion-item';
4
+ import { BrnAccordionTrigger } from './lib/brn-accordion-trigger';
3
5
  export * from './lib/brn-accordion';
4
6
  export * from './lib/brn-accordion-content';
7
+ export * from './lib/brn-accordion-item';
8
+ export * from './lib/brn-accordion-token';
9
+ export * from './lib/brn-accordion-trigger';
5
10
  export declare const BrnAccordionImports: readonly [typeof BrnAccordion, typeof BrnAccordionContent, typeof BrnAccordionItem, typeof BrnAccordionTrigger];
@@ -1,10 +1,10 @@
1
1
  import * as i0 from "@angular/core";
2
2
  export declare class BrnAccordionContent {
3
+ private readonly _config;
3
4
  private readonly _item;
4
5
  private readonly _elementRef;
5
6
  protected readonly _width: import("@angular/core").WritableSignal<number | null>;
6
7
  protected readonly _height: import("@angular/core").WritableSignal<number | null>;
7
- protected readonly _dimensionsInitiated: import("@angular/core").WritableSignal<boolean>;
8
8
  protected readonly _inert: import("@angular/core").Signal<true | undefined>;
9
9
  readonly state: import("@angular/core").Signal<"open" | "closed">;
10
10
  readonly id: string;
@@ -14,13 +14,7 @@ export declare class BrnAccordionContent {
14
14
  * @default 'overflow: hidden'
15
15
  */
16
16
  readonly style: import("@angular/core").InputSignal<string>;
17
- /**
18
- * The style to be applied to the host element while the dimensions are being calculated.
19
- * @default 'opacity: 0'
20
- */
21
- readonly styleWhileDimensionsAreInitiating: import("@angular/core").InputSignal<string>;
22
- protected readonly _mutableStyle: import("@angular/core").WritableSignal<string>;
23
17
  constructor();
24
18
  static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionContent, never>;
25
- static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionContent, "brn-accordion-content,[brnAccordionContent]", never, { "style": { "alias": "style"; "required": false; "isSignal": true; }; "styleWhileDimensionsAreInitiating": { "alias": "styleWhileDimensionsAreInitiating"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
19
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionContent, "brn-accordion-content,[brnAccordionContent]", never, { "style": { "alias": "style"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
26
20
  }
@@ -0,0 +1,28 @@
1
+ import { BooleanInput } from '@angular/cdk/coercion';
2
+ import * as i0 from "@angular/core";
3
+ export declare class BrnAccordionItem {
4
+ private static _itemIdGenerator;
5
+ readonly id: number;
6
+ private readonly _accordion;
7
+ /**
8
+ * Whether the item is opened or closed.
9
+ * @default false
10
+ */
11
+ readonly isOpened: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
12
+ /**
13
+ * Computed state of the item, either 'open' or 'closed'
14
+ * @default closed
15
+ */
16
+ readonly state: import("@angular/core").Signal<"open" | "closed">;
17
+ /**
18
+ * Emits boolean when the item is opened or closed.
19
+ */
20
+ readonly stateChange: import("@angular/core").OutputEmitterRef<"open" | "closed">;
21
+ /**
22
+ * Emits state change when item is opened or closed
23
+ */
24
+ readonly openedChange: import("@angular/core").OutputEmitterRef<boolean>;
25
+ constructor();
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionItem, never>;
27
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionItem, "[brnAccordionItem]", ["brnAccordionItem"], { "isOpened": { "alias": "isOpened"; "required": false; "isSignal": true; }; }, { "stateChange": "stateChange"; "openedChange": "openedChange"; }, never, never, true, never>;
28
+ }
@@ -0,0 +1,19 @@
1
+ import { type ExistingProvider, InjectionToken, type Type, type ValueProvider } from '@angular/core';
2
+ import type { MeasurementDisplay } from '@spartan-ng/brain/core';
3
+ import type { BrnAccordion } from './brn-accordion';
4
+ import type { BrnAccordionItem } from './brn-accordion-item';
5
+ export declare const BrnAccordionToken: InjectionToken<BrnAccordion>;
6
+ export declare function injectBrnAccordion(): BrnAccordion;
7
+ export declare function provideBrnAccordion(accordion: Type<BrnAccordion>): ExistingProvider;
8
+ export declare const BrnAccordionItemToken: InjectionToken<BrnAccordionItem>;
9
+ export declare function injectBrnAccordionItem(): BrnAccordionItem;
10
+ export declare function provideBrnAccordionItem(item: Type<BrnAccordionItem>): ExistingProvider;
11
+ export interface BrBrnAccordionConfig {
12
+ /**
13
+ * The display style to use when measuring element dimensions.
14
+ * @default 'block'
15
+ */
16
+ measurementDisplay: MeasurementDisplay;
17
+ }
18
+ export declare function provideBrnAccordionConfig(config: Partial<BrBrnAccordionConfig>): ValueProvider;
19
+ export declare function injectBrnAccordionConfig(): BrBrnAccordionConfig;
@@ -0,0 +1,16 @@
1
+ import type { FocusableOption } from '@angular/cdk/a11y';
2
+ import * as i0 from "@angular/core";
3
+ export declare class BrnAccordionTrigger implements FocusableOption {
4
+ private readonly _accordion;
5
+ private readonly _item;
6
+ private readonly _el;
7
+ readonly state: import("@angular/core").Signal<"open" | "closed">;
8
+ readonly id: string;
9
+ readonly ariaControls: string;
10
+ constructor();
11
+ protected toggle(event: Event): void;
12
+ focus(): void;
13
+ private validateAriaStructure;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionTrigger, never>;
15
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionTrigger, "[brnAccordionTrigger]", never, {}, {}, never, never, true, never>;
16
+ }
@@ -1,47 +1,6 @@
1
- import { type FocusableOption } from '@angular/cdk/a11y';
2
- import { type BooleanInput } from '@angular/cdk/coercion';
3
1
  import { type AfterContentInit, type OnDestroy } from '@angular/core';
2
+ import { BrnAccordionTrigger } from './brn-accordion-trigger';
4
3
  import * as i0 from "@angular/core";
5
- export declare class BrnAccordionItem {
6
- private static _itemIdGenerator;
7
- readonly id: number;
8
- private readonly _accordion;
9
- /**
10
- * Whether the item is opened or closed.
11
- * @default false
12
- */
13
- readonly isOpened: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
14
- /**
15
- * Computed state of the item, either 'open' or 'closed'
16
- * @default closed
17
- */
18
- readonly state: import("@angular/core").Signal<"open" | "closed">;
19
- /**
20
- * Emits boolean when the item is opened or closed.
21
- */
22
- readonly stateChange: import("@angular/core").OutputEmitterRef<"open" | "closed">;
23
- /**
24
- * Emits state change when item is opened or closed
25
- */
26
- readonly openedChange: import("@angular/core").OutputEmitterRef<boolean>;
27
- constructor();
28
- static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionItem, never>;
29
- static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionItem, "[brnAccordionItem]", ["brnAccordionItem"], { "isOpened": { "alias": "isOpened"; "required": false; "isSignal": true; }; }, { "stateChange": "stateChange"; "openedChange": "openedChange"; }, never, never, true, never>;
30
- }
31
- export declare class BrnAccordionTrigger implements FocusableOption {
32
- private readonly _accordion;
33
- private readonly _item;
34
- private readonly _el;
35
- readonly state: import("@angular/core").Signal<"open" | "closed">;
36
- readonly id: string;
37
- readonly ariaControls: string;
38
- constructor();
39
- protected toggle(event: Event): void;
40
- focus(): void;
41
- private validateAriaStructure;
42
- static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionTrigger, never>;
43
- static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionTrigger, "[brnAccordionTrigger]", never, {}, {}, never, never, true, never>;
44
- }
45
4
  export declare class BrnAccordion implements AfterContentInit, OnDestroy {
46
5
  private readonly _el;
47
6
  private readonly _focusMonitor;
@@ -3,5 +3,6 @@ import { BrnCollapsibleContent } from './lib/brn-collapsible-content';
3
3
  import { BrnCollapsibleTrigger } from './lib/brn-collapsible-trigger';
4
4
  export * from './lib/brn-collapsible';
5
5
  export * from './lib/brn-collapsible-content';
6
+ export * from './lib/brn-collapsible-token';
6
7
  export * from './lib/brn-collapsible-trigger';
7
8
  export declare const BrnCollapsibleImports: readonly [typeof BrnCollapsible, typeof BrnCollapsibleTrigger, typeof BrnCollapsibleContent];
@@ -1,18 +1,15 @@
1
- import { type OnInit } from '@angular/core';
2
- import { BrnCollapsible } from './brn-collapsible';
3
1
  import * as i0 from "@angular/core";
4
- export declare class BrnCollapsibleContent implements OnInit {
5
- protected readonly _collapsible: BrnCollapsible | null;
2
+ export declare class BrnCollapsibleContent {
3
+ private readonly _config;
6
4
  private readonly _elementRef;
7
- private readonly _platformId;
5
+ protected readonly _collapsible: import("@spartan-ng/brain/collapsible").BrnCollapsible | null;
6
+ protected readonly _width: import("@angular/core").WritableSignal<number | null>;
7
+ protected readonly _height: import("@angular/core").WritableSignal<number | null>;
8
8
  /**
9
9
  * The id of the collapsible content element.
10
10
  */
11
11
  readonly id: import("@angular/core").InputSignal<string | null | undefined>;
12
- protected readonly _width: import("@angular/core").WritableSignal<number | null>;
13
- protected readonly _height: import("@angular/core").WritableSignal<number | null>;
14
12
  constructor();
15
- ngOnInit(): void;
16
13
  static ɵfac: i0.ɵɵFactoryDeclaration<BrnCollapsibleContent, never>;
17
- static ɵcmp: i0.ɵɵComponentDeclaration<BrnCollapsibleContent, "brn-collapsible-content", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
14
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCollapsibleContent, "[brnCollapsibleContent],brn-collapsible-content", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
18
15
  }
@@ -0,0 +1,16 @@
1
+ import type { ValueProvider } from '@angular/core';
2
+ import { type ExistingProvider, InjectionToken, type Type } from '@angular/core';
3
+ import type { MeasurementDisplay } from '@spartan-ng/brain/core';
4
+ import type { BrnCollapsible } from './brn-collapsible';
5
+ export declare const BrnCollapsibleToken: InjectionToken<BrnCollapsible>;
6
+ export declare function injectBrnCollapsible(): BrnCollapsible | null;
7
+ export declare function provideBrnCollapsible(collapsible: Type<BrnCollapsible>): ExistingProvider;
8
+ export interface BrCollapsibleConfig {
9
+ /**
10
+ * The display style to use when measuring element dimensions.
11
+ * @default 'block'
12
+ */
13
+ measurementDisplay: MeasurementDisplay;
14
+ }
15
+ export declare function provideBrnCollapsibleConfig(config: Partial<BrCollapsibleConfig>): ValueProvider;
16
+ export declare function injectBrnCollapsibleConfig(): BrCollapsibleConfig;
@@ -1,9 +1,9 @@
1
- import { BrnCollapsible } from './brn-collapsible';
2
1
  import * as i0 from "@angular/core";
3
2
  export declare class BrnCollapsibleTrigger {
4
- protected readonly _collapsible: BrnCollapsible | null;
3
+ protected readonly _collapsible: import("@spartan-ng/brain/collapsible").BrnCollapsible | null;
4
+ readonly type: import("@angular/core").InputSignal<"button" | "submit" | "reset">;
5
5
  constructor();
6
6
  toggle(): void;
7
7
  static ɵfac: i0.ɵɵFactoryDeclaration<BrnCollapsibleTrigger, never>;
8
- static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCollapsibleTrigger, "button[brnCollapsibleTrigger]", never, {}, {}, never, never, true, never>;
8
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCollapsibleTrigger, "button[brnCollapsibleTrigger]", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
9
9
  }
@@ -7,6 +7,10 @@ export declare class BrnCollapsible {
7
7
  * The expanded or collapsed state of the collapsible component.
8
8
  */
9
9
  readonly expanded: import("@angular/core").ModelSignal<boolean>;
10
+ /**
11
+ * The current state of the collapsible component as 'open' or 'closed'.
12
+ */
13
+ readonly state: import("@angular/core").Signal<BrnCollapsibleState>;
10
14
  /**
11
15
  * The disabled state of the collapsible component.
12
16
  */
@@ -16,5 +20,5 @@ export declare class BrnCollapsible {
16
20
  */
17
21
  toggle(): void;
18
22
  static ɵfac: i0.ɵɵFactoryDeclaration<BrnCollapsible, never>;
19
- static ɵcmp: i0.ɵɵComponentDeclaration<BrnCollapsible, "brn-collapsible", never, { "expanded": { "alias": "expanded"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "expanded": "expandedChange"; }, never, ["*"], true, never>;
23
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCollapsible, "[brnCollapsible],brn-collapsible", never, { "expanded": { "alias": "expanded"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "expanded": "expandedChange"; }, never, never, true, never>;
20
24
  }
@@ -0,0 +1,5 @@
1
+ export type MeasurementDisplay = 'block' | 'inline-block' | 'flex' | 'grid' | 'table' | 'contents' | (string & {});
2
+ export declare const measureDimensions: (elementToMeasure: HTMLElement, measurementDisplay: MeasurementDisplay) => {
3
+ width: number;
4
+ height: number;
5
+ };
package/core/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './helpers/debounced-signal';
5
5
  export * from './helpers/dev-mode';
6
6
  export * from './helpers/exposes-side';
7
7
  export * from './helpers/exposes-state';
8
+ export * from './helpers/measure-dimensions';
8
9
  export * from './helpers/table-classes-settable';
9
10
  export * from './helpers/wait-for-element-animations';
10
11
  export * from './helpers/zone-free';
@@ -1,71 +1,39 @@
1
1
  import { FocusMonitor, FocusKeyManager } from '@angular/cdk/a11y';
2
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
3
2
  import * as i0 from '@angular/core';
4
- import { inject, input, computed, output, effect, untracked, Directive, ElementRef, isDevMode, signal, contentChildren, linkedSignal, afterNextRender } from '@angular/core';
3
+ import { InjectionToken, inject, ElementRef, isDevMode, Directive, computed, signal, contentChildren, input, afterNextRender, output, effect, untracked } from '@angular/core';
5
4
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
5
  import { fromEvent } from 'rxjs';
6
+ import { measureDimensions } from '@spartan-ng/brain/core';
7
+ import { coerceBooleanProperty } from '@angular/cdk/coercion';
7
8
 
8
- class BrnAccordionItem {
9
- static _itemIdGenerator = 0;
10
- id = ++BrnAccordionItem._itemIdGenerator;
11
- _accordion = inject(BrnAccordion);
12
- /**
13
- * Whether the item is opened or closed.
14
- * @default false
15
- */
16
- isOpened = input(false, { transform: coerceBooleanProperty });
17
- /**
18
- * Computed state of the item, either 'open' or 'closed'
19
- * @default closed
20
- */
21
- state = computed(() => (this._accordion.openItemIds().includes(this.id) ? 'open' : 'closed'));
22
- /**
23
- * Emits boolean when the item is opened or closed.
24
- */
25
- stateChange = output();
26
- /**
27
- * Emits state change when item is opened or closed
28
- */
29
- openedChange = output();
30
- constructor() {
31
- if (!this._accordion) {
32
- throw Error('Accordion item can only be used inside an Accordion. Add brnAccordion to ancestor.');
33
- }
34
- effect(() => {
35
- const state = this.state();
36
- untracked(() => {
37
- this.stateChange.emit(state);
38
- this.openedChange.emit(state === 'open');
39
- });
40
- });
41
- effect(() => {
42
- const isOpened = this.isOpened();
43
- untracked(() => {
44
- if (isOpened) {
45
- this._accordion.openItem(this.id);
46
- }
47
- else {
48
- this._accordion.closeItem(this.id);
49
- }
50
- });
51
- });
52
- }
53
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
54
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnAccordionItem, isStandalone: true, selector: "[brnAccordionItem]", inputs: { isOpened: { classPropertyName: "isOpened", publicName: "isOpened", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stateChange: "stateChange", openedChange: "openedChange" }, host: { properties: { "attr.data-state": "state()" } }, exportAs: ["brnAccordionItem"], ngImport: i0 });
9
+ const BrnAccordionToken = new InjectionToken('BrnAccordionToken');
10
+ function injectBrnAccordion() {
11
+ return inject(BrnAccordionToken);
55
12
  }
56
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionItem, decorators: [{
57
- type: Directive,
58
- args: [{
59
- selector: '[brnAccordionItem]',
60
- host: {
61
- '[attr.data-state]': 'state()',
62
- },
63
- exportAs: 'brnAccordionItem',
64
- }]
65
- }], ctorParameters: () => [] });
13
+ function provideBrnAccordion(accordion) {
14
+ return { provide: BrnAccordionToken, useExisting: accordion };
15
+ }
16
+ const BrnAccordionItemToken = new InjectionToken('BrnAccordionItemToken');
17
+ function injectBrnAccordionItem() {
18
+ return inject(BrnAccordionItemToken);
19
+ }
20
+ function provideBrnAccordionItem(item) {
21
+ return { provide: BrnAccordionItemToken, useExisting: item };
22
+ }
23
+ const defaultConfig = {
24
+ measurementDisplay: 'block',
25
+ };
26
+ const BrnAccordionConfigToken = new InjectionToken('BrnBrnAccordionConfig');
27
+ function provideBrnAccordionConfig(config) {
28
+ return { provide: BrnAccordionConfigToken, useValue: { ...defaultConfig, ...config } };
29
+ }
30
+ function injectBrnAccordionConfig() {
31
+ return inject(BrnAccordionConfigToken, { optional: true }) ?? defaultConfig;
32
+ }
33
+
66
34
  class BrnAccordionTrigger {
67
- _accordion = inject(BrnAccordion);
68
- _item = inject(BrnAccordionItem);
35
+ _accordion = injectBrnAccordion();
36
+ _item = injectBrnAccordionItem();
69
37
  _el = inject((ElementRef));
70
38
  state = this._item.state;
71
39
  id = `brn-accordion-trigger-${this._item.id}`;
@@ -136,6 +104,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
136
104
  },
137
105
  }]
138
106
  }], ctorParameters: () => [] });
107
+
139
108
  const HORIZONTAL_KEYS_TO_PREVENT_DEFAULT = [
140
109
  'ArrowLeft',
141
110
  'ArrowRight',
@@ -254,7 +223,7 @@ class BrnAccordion {
254
223
  }
255
224
  }
256
225
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordion, deps: [], target: i0.ɵɵFactoryTarget.Directive });
257
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnAccordion, isStandalone: true, selector: "[brnAccordion]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-state": "state()", "attr.data-orientation": "orientation()" } }, queries: [{ propertyName: "triggers", predicate: BrnAccordionTrigger, descendants: true, isSignal: true }], exportAs: ["brnAccordion"], ngImport: i0 });
226
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnAccordion, isStandalone: true, selector: "[brnAccordion]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-state": "state()", "attr.data-orientation": "orientation()" } }, providers: [provideBrnAccordion(BrnAccordion)], queries: [{ propertyName: "triggers", predicate: BrnAccordionTrigger, descendants: true, isSignal: true }], exportAs: ["brnAccordion"], ngImport: i0 });
258
227
  }
259
228
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordion, decorators: [{
260
229
  type: Directive,
@@ -264,31 +233,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
264
233
  '[attr.data-state]': 'state()',
265
234
  '[attr.data-orientation]': 'orientation()',
266
235
  },
236
+ providers: [provideBrnAccordion(BrnAccordion)],
267
237
  exportAs: 'brnAccordion',
268
238
  }]
269
239
  }] });
270
240
 
271
241
  class BrnAccordionContent {
272
- _item = inject(BrnAccordionItem);
242
+ _config = injectBrnAccordionConfig();
243
+ _item = injectBrnAccordionItem();
273
244
  _elementRef = inject(ElementRef);
274
245
  _width = signal(null);
275
246
  _height = signal(null);
276
- _dimensionsInitiated = signal(false);
277
- _inert = computed(() => (this.state() === 'closed' ? true : undefined));
278
- state = this._item.state;
279
- id = `brn-accordion-content-${this._item.id}`;
280
- ariaLabeledBy = `brn-accordion-trigger-${this._item.id}`;
247
+ _inert = computed(() => (this.state?.() === 'closed' ? true : undefined));
248
+ state = this._item?.state;
249
+ id = `brn-accordion-content-${this._item?.id}`;
250
+ ariaLabeledBy = `brn-accordion-trigger-${this._item?.id}`;
281
251
  /**
282
252
  * The style to be applied to the host element after the dimensions are calculated.
283
253
  * @default 'overflow: hidden'
284
254
  */
285
255
  style = input('overflow: hidden');
286
- /**
287
- * The style to be applied to the host element while the dimensions are being calculated.
288
- * @default 'opacity: 0'
289
- */
290
- styleWhileDimensionsAreInitiating = input('overflow: hidden');
291
- _mutableStyle = linkedSignal(() => this._dimensionsInitiated() ? this.style() : this.styleWhileDimensionsAreInitiating());
292
256
  constructor() {
293
257
  if (!this._item) {
294
258
  throw Error('Accordion Content can only be used inside an AccordionItem. Add brnAccordionItem to parent.');
@@ -297,37 +261,96 @@ class BrnAccordionContent {
297
261
  const content = this._elementRef.nativeElement.firstChild;
298
262
  if (!content)
299
263
  return;
300
- const { width, height } = content.getBoundingClientRect();
264
+ const { width, height } = measureDimensions(content, this._config.measurementDisplay);
301
265
  this._width.set(width);
302
266
  this._height.set(height);
303
- this._dimensionsInitiated.set(true);
304
267
  });
305
268
  }
306
269
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
307
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnAccordionContent, isStandalone: true, selector: "brn-accordion-content,[brnAccordionContent]", inputs: { style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, styleWhileDimensionsAreInitiating: { classPropertyName: "styleWhileDimensionsAreInitiating", publicName: "styleWhileDimensionsAreInitiating", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "region" }, properties: { "attr.data-state": "state()", "attr.aria-labelledby": "ariaLabeledBy", "id": "id", "style.--brn-accordion-content-width.px": "_width()", "style.--brn-accordion-content-height.px": "_height()", "attr.inert": "_inert()", "attr.style": "_mutableStyle()" } }, ngImport: i0 });
270
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnAccordionContent, isStandalone: true, selector: "brn-accordion-content,[brnAccordionContent]", inputs: { style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "region" }, properties: { "attr.data-state": "state?.()", "attr.aria-labelledby": "ariaLabeledBy", "id": "id", "style.--brn-accordion-content-width.px": "_width()", "style.--brn-accordion-content-height.px": "_height()", "attr.inert": "_inert()", "attr.style": "style()" } }, ngImport: i0 });
308
271
  }
309
272
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionContent, decorators: [{
310
273
  type: Directive,
311
274
  args: [{
312
275
  selector: 'brn-accordion-content,[brnAccordionContent]',
313
276
  host: {
314
- '[attr.data-state]': 'state()',
277
+ '[attr.data-state]': 'state?.()',
315
278
  '[attr.aria-labelledby]': 'ariaLabeledBy',
316
279
  role: 'region',
317
280
  '[id]': 'id',
318
281
  '[style.--brn-accordion-content-width.px]': '_width()',
319
282
  '[style.--brn-accordion-content-height.px]': '_height()',
320
283
  '[attr.inert]': '_inert()',
321
- '[attr.style]': '_mutableStyle()',
284
+ '[attr.style]': 'style()',
322
285
  },
323
286
  }]
324
287
  }], ctorParameters: () => [] });
325
288
 
289
+ class BrnAccordionItem {
290
+ static _itemIdGenerator = 0;
291
+ id = ++BrnAccordionItem._itemIdGenerator;
292
+ _accordion = injectBrnAccordion();
293
+ /**
294
+ * Whether the item is opened or closed.
295
+ * @default false
296
+ */
297
+ isOpened = input(false, { transform: coerceBooleanProperty });
298
+ /**
299
+ * Computed state of the item, either 'open' or 'closed'
300
+ * @default closed
301
+ */
302
+ state = computed(() => (this._accordion.openItemIds()?.includes(this.id) ? 'open' : 'closed'));
303
+ /**
304
+ * Emits boolean when the item is opened or closed.
305
+ */
306
+ stateChange = output();
307
+ /**
308
+ * Emits state change when item is opened or closed
309
+ */
310
+ openedChange = output();
311
+ constructor() {
312
+ if (!this._accordion) {
313
+ throw Error('Accordion item can only be used inside an Accordion. Add brnAccordion to ancestor.');
314
+ }
315
+ effect(() => {
316
+ const state = this.state();
317
+ untracked(() => {
318
+ this.stateChange.emit(state);
319
+ this.openedChange.emit(state === 'open');
320
+ });
321
+ });
322
+ effect(() => {
323
+ const isOpened = this.isOpened();
324
+ untracked(() => {
325
+ if (isOpened) {
326
+ this._accordion.openItem(this.id);
327
+ }
328
+ else {
329
+ this._accordion.closeItem(this.id);
330
+ }
331
+ });
332
+ });
333
+ }
334
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
335
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnAccordionItem, isStandalone: true, selector: "[brnAccordionItem]", inputs: { isOpened: { classPropertyName: "isOpened", publicName: "isOpened", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stateChange: "stateChange", openedChange: "openedChange" }, host: { properties: { "attr.data-state": "state()" } }, providers: [provideBrnAccordionItem(BrnAccordionItem)], exportAs: ["brnAccordionItem"], ngImport: i0 });
336
+ }
337
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionItem, decorators: [{
338
+ type: Directive,
339
+ args: [{
340
+ selector: '[brnAccordionItem]',
341
+ host: {
342
+ '[attr.data-state]': 'state()',
343
+ },
344
+ providers: [provideBrnAccordionItem(BrnAccordionItem)],
345
+ exportAs: 'brnAccordionItem',
346
+ }]
347
+ }], ctorParameters: () => [] });
348
+
326
349
  const BrnAccordionImports = [BrnAccordion, BrnAccordionContent, BrnAccordionItem, BrnAccordionTrigger];
327
350
 
328
351
  /**
329
352
  * Generated bundle index. Do not edit.
330
353
  */
331
354
 
332
- export { BrnAccordion, BrnAccordionContent, BrnAccordionImports, BrnAccordionItem, BrnAccordionTrigger };
355
+ export { BrnAccordion, BrnAccordionContent, BrnAccordionImports, BrnAccordionItem, BrnAccordionItemToken, BrnAccordionToken, BrnAccordionTrigger, injectBrnAccordion, injectBrnAccordionConfig, injectBrnAccordionItem, provideBrnAccordion, provideBrnAccordionConfig, provideBrnAccordionItem };
333
356
  //# sourceMappingURL=spartan-ng-brain-accordion.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-accordion.mjs","sources":["../../../../libs/brain/accordion/src/lib/brn-accordion.ts","../../../../libs/brain/accordion/src/lib/brn-accordion-content.ts","../../../../libs/brain/accordion/src/index.ts","../../../../libs/brain/accordion/src/spartan-ng-brain-accordion.ts"],"sourcesContent":["import { type FocusableOption, FocusKeyManager, FocusMonitor } from '@angular/cdk/a11y';\nimport { type BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n\ttype AfterContentInit,\n\tcomputed,\n\tcontentChildren,\n\tDirective,\n\teffect,\n\tElementRef,\n\tinject,\n\tinput,\n\tisDevMode,\n\ttype OnDestroy,\n\toutput,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromEvent } from 'rxjs';\n\n@Directive({\n\tselector: '[brnAccordionItem]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t},\n\texportAs: 'brnAccordionItem',\n})\nexport class BrnAccordionItem {\n\tprivate static _itemIdGenerator = 0;\n\tpublic readonly id = ++BrnAccordionItem._itemIdGenerator;\n\tprivate readonly _accordion = inject(BrnAccordion);\n\t/**\n\t * Whether the item is opened or closed.\n\t * @default false\n\t */\n\tpublic readonly isOpened = input<boolean, BooleanInput>(false, { transform: coerceBooleanProperty });\n\t/**\n\t * Computed state of the item, either 'open' or 'closed'\n\t * @default closed\n\t */\n\tpublic readonly state = computed(() => (this._accordion.openItemIds().includes(this.id) ? 'open' : 'closed'));\n\t/**\n\t * Emits boolean when the item is opened or closed.\n\t */\n\tpublic readonly stateChange = output<'open' | 'closed'>();\n\t/**\n\t * Emits state change when item is opened or closed\n\t */\n\tpublic readonly openedChange = output<boolean>();\n\n\tconstructor() {\n\t\tif (!this._accordion) {\n\t\t\tthrow Error('Accordion item can only be used inside an Accordion. Add brnAccordion to ancestor.');\n\t\t}\n\t\teffect(() => {\n\t\t\tconst state = this.state();\n\t\t\tuntracked(() => {\n\t\t\t\tthis.stateChange.emit(state);\n\t\t\t\tthis.openedChange.emit(state === 'open');\n\t\t\t});\n\t\t});\n\t\teffect(() => {\n\t\t\tconst isOpened = this.isOpened();\n\t\t\tuntracked(() => {\n\t\t\t\tif (isOpened) {\n\t\t\t\t\tthis._accordion.openItem(this.id);\n\t\t\t\t} else {\n\t\t\t\t\tthis._accordion.closeItem(this.id);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n\n@Directive({\n\tselector: '[brnAccordionTrigger]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.aria-expanded]': 'state() === \"open\"',\n\t\t'[attr.aria-controls]': 'ariaControls',\n\t\t'[id]': 'id',\n\t\t'[attr.role]': '\"button\"',\n\t\t'(click)': 'toggle($event)',\n\t\t'(keyup.space)': 'toggle($event)',\n\t\t'(keyup.enter)': 'toggle($event)',\n\t},\n})\nexport class BrnAccordionTrigger implements FocusableOption {\n\tprivate readonly _accordion = inject(BrnAccordion);\n\tprivate readonly _item = inject(BrnAccordionItem);\n\tprivate readonly _el = inject(ElementRef<HTMLElement>);\n\n\tpublic readonly state = this._item.state;\n\tpublic readonly id = `brn-accordion-trigger-${this._item.id}`;\n\tpublic readonly ariaControls = `brn-accordion-content-${this._item.id}`;\n\tconstructor() {\n\t\tif (!this._accordion) throw Error('Accordion trigger requires a parent Accordion.');\n\t\tif (!this._item) throw Error('Accordion trigger requires a parent AccordionItem.');\n\t\tthis.validateAriaStructure();\n\n\t\tfromEvent(this._el.nativeElement, 'focus')\n\t\t\t.pipe(takeUntilDestroyed())\n\t\t\t.subscribe(() => {\n\t\t\t\tthis._accordion.setActiveItem(this);\n\t\t\t});\n\t}\n\n\tprotected toggle(event: Event): void {\n\t\tevent.preventDefault();\n\t\tthis._accordion.toggleItem(this._item.id);\n\t}\n\n\tpublic focus() {\n\t\tthis._el.nativeElement.focus();\n\t}\n\n\tprivate validateAriaStructure(): void {\n\t\tconst element = this._el.nativeElement;\n\n\t\tconst isButton = element.tagName === 'BUTTON';\n\t\tconst hasButtonRole = element.getAttribute('role') === 'button';\n\n\t\tif (!isButton && !hasButtonRole) {\n\t\t\tthrow Error(\n\t\t\t\t`BrnAccordionTrigger: The trigger element must be a <button> or have role=\"button\". ` +\n\t\t\t\t\t`Found: <${element.tagName.toLowerCase()}>`,\n\t\t\t);\n\t\t}\n\n\t\tconst parent = element.parentElement;\n\t\tif (!parent) {\n\t\t\tconst message = 'BrnAccordionTrigger: The trigger button must be wrapped in a heading element.';\n\t\t\tif (isDevMode()) {\n\t\t\t\tthrow Error(message);\n\t\t\t} else {\n\t\t\t\tconsole.warn(message);\n\t\t\t}\n\t\t}\n\n\t\tconst isNativeHeading = /^H[1-6]$/.test(parent.tagName);\n\t\tconst hasHeadingRole = parent.getAttribute('role') === 'heading';\n\n\t\tif (!isNativeHeading && !hasHeadingRole) {\n\t\t\tthrow Error(\n\t\t\t\t`BrnAccordionTrigger: The trigger button must be wrapped in a heading element ` +\n\t\t\t\t\t`(h1-h6) or an element with role=\"heading\". Found parent: <${parent.tagName.toLowerCase()}>`,\n\t\t\t);\n\t\t}\n\n\t\tif (hasHeadingRole && !parent.hasAttribute('aria-level')) {\n\t\t\tthrow Error('BrnAccordionTrigger: Elements with role=\"heading\" must have an aria-level attribute.');\n\t\t}\n\t}\n}\n\nconst HORIZONTAL_KEYS_TO_PREVENT_DEFAULT = [\n\t'ArrowLeft',\n\t'ArrowRight',\n\t'PageDown',\n\t'PageUp',\n\t'Home',\n\t'End',\n\t' ',\n\t'Enter',\n] as const;\n\nconst VERTICAL_KEYS_TO_PREVENT_DEFAULT = [\n\t'ArrowUp',\n\t'ArrowDown',\n\t'PageDown',\n\t'PageUp',\n\t'Home',\n\t'End',\n\t' ',\n\t'Enter',\n] as const;\n\n@Directive({\n\tselector: '[brnAccordion]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.data-orientation]': 'orientation()',\n\t},\n\texportAs: 'brnAccordion',\n})\nexport class BrnAccordion implements AfterContentInit, OnDestroy {\n\tprivate readonly _el = inject(ElementRef<HTMLElement>);\n\tprivate readonly _focusMonitor = inject(FocusMonitor);\n\tprivate readonly _keyManager = computed(() =>\n\t\tnew FocusKeyManager<BrnAccordionTrigger>(this.triggers())\n\t\t\t.withHomeAndEnd()\n\t\t\t.withPageUpDown()\n\t\t\t.withWrap()\n\t\t\t.withHorizontalOrientation(this.orientation() === 'vertical' ? null : (this.dir() ?? 'ltr'))\n\t\t\t.withVerticalOrientation(this.orientation() === 'vertical'),\n\t);\n\n\tprivate readonly _focused = signal<boolean>(false);\n\tprivate readonly _openItemIds = signal<number[]>([]);\n\tpublic readonly openItemIds = this._openItemIds.asReadonly();\n\tpublic readonly state = computed(() => (this._openItemIds().length > 0 ? 'open' : 'closed'));\n\n\tpublic readonly triggers = contentChildren(BrnAccordionTrigger, { descendants: true });\n\n\t/**\n\t * Whether the accordion is in single or multiple mode.\n\t * @default 'single'\n\t */\n\tpublic readonly type = input<'single' | 'multiple'>('single');\n\t/**\n\t * The direction of the accordion, either 'ltr' (left-to-right) or 'rtl' (right-to-left).\n\t * @default null\n\t */\n\tpublic readonly dir = input<'ltr' | 'rtl' | null>(null);\n\t/**\n\t * The orientation of the accordion, either 'horizontal' or 'vertical'.\n\t * @default 'vertical'\n\t */\n\tpublic readonly orientation = input<'horizontal' | 'vertical'>('vertical');\n\n\tpublic ngAfterContentInit() {\n\t\tthis._el.nativeElement.addEventListener('keydown', (event: KeyboardEvent) => {\n\t\t\tif (this.shouldIgnoreEvent(event)) return;\n\t\t\tthis._keyManager()?.onKeydown(event);\n\t\t\tthis.preventDefaultEvents(event);\n\t\t});\n\t\tthis._focusMonitor.monitor(this._el, true).subscribe((origin) => this._focused.set(origin !== null));\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._focusMonitor.stopMonitoring(this._el);\n\t}\n\n\tpublic setActiveItem(item: BrnAccordionTrigger) {\n\t\tthis._keyManager()?.setActiveItem(item);\n\t}\n\n\tpublic toggleItem(id: number) {\n\t\tif (this._openItemIds().includes(id)) {\n\t\t\tthis.closeItem(id);\n\t\t\treturn;\n\t\t}\n\t\tthis.openItem(id);\n\t}\n\n\tpublic openItem(id: number) {\n\t\tif (this.type() === 'single') {\n\t\t\tthis._openItemIds.set([id]);\n\t\t\treturn;\n\t\t}\n\t\tthis._openItemIds.update((ids) => (ids.includes(id) ? ids : [...ids, id]));\n\t}\n\n\tpublic closeItem(id: number) {\n\t\tthis._openItemIds.update((ids) => ids.filter((openId) => openId !== id));\n\t}\n\n\tprivate isEditableTarget(el: EventTarget | null): boolean {\n\t\tconst node = el as HTMLElement | null;\n\t\tif (!node) return false;\n\n\t\tconst tag = node.tagName;\n\t\tif (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return true;\n\t\tif (node.isContentEditable) return true;\n\n\t\tconst role = node.getAttribute?.('role') ?? '';\n\t\tif (/^(textbox|searchbox|combobox|listbox|grid|tree|menu|spinbutton|slider)$/.test(role)) return true;\n\n\t\tconst editableAncestor = node.closest?.(\n\t\t\t'input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"], ' +\n\t\t\t\t'[role=\"textbox\"], [role=\"searchbox\"], [role=\"combobox\"], [role=\"listbox\"], ' +\n\t\t\t\t'[role=\"grid\"], [role=\"tree\"], [role=\"menu\"], [role=\"spinbutton\"], [role=\"slider\"]',\n\t\t);\n\t\treturn !!editableAncestor;\n\t}\n\n\tprivate shouldIgnoreEvent(e: KeyboardEvent): boolean {\n\t\tif (e.defaultPrevented) return true; // another handler already acted\n\t\tif (e.ctrlKey || e.metaKey || e.altKey) return true; // let shortcuts through\n\t\treturn this.isEditableTarget(e.target); // don't steal from editable/ARIA widgets\n\t}\n\n\tprivate preventDefaultEvents(event: KeyboardEvent) {\n\t\tif (event.defaultPrevented) return;\n\t\tif (!this._focused()) return;\n\t\tif (!('key' in event)) return;\n\n\t\tconst keys: readonly string[] =\n\t\t\tthis.orientation() === 'horizontal' ? HORIZONTAL_KEYS_TO_PREVENT_DEFAULT : VERTICAL_KEYS_TO_PREVENT_DEFAULT;\n\n\t\tif (keys.includes(event.key) && event.code !== 'NumpadEnter') {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n}\n","import { Directive, ElementRef, afterNextRender, computed, inject, input, linkedSignal, signal } from '@angular/core';\nimport { BrnAccordionItem } from './brn-accordion';\n\n@Directive({\n\tselector: 'brn-accordion-content,[brnAccordionContent]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.aria-labelledby]': 'ariaLabeledBy',\n\t\trole: 'region',\n\t\t'[id]': 'id',\n\t\t'[style.--brn-accordion-content-width.px]': '_width()',\n\t\t'[style.--brn-accordion-content-height.px]': '_height()',\n\t\t'[attr.inert]': '_inert()',\n\t\t'[attr.style]': '_mutableStyle()',\n\t},\n})\nexport class BrnAccordionContent {\n\tprivate readonly _item = inject(BrnAccordionItem);\n\tprivate readonly _elementRef = inject(ElementRef);\n\n\tprotected readonly _width = signal<number | null>(null);\n\tprotected readonly _height = signal<number | null>(null);\n\tprotected readonly _dimensionsInitiated = signal(false);\n\tprotected readonly _inert = computed(() => (this.state() === 'closed' ? true : undefined));\n\n\tpublic readonly state = this._item.state;\n\tpublic readonly id = `brn-accordion-content-${this._item.id}`;\n\tpublic readonly ariaLabeledBy = `brn-accordion-trigger-${this._item.id}`;\n\t/**\n\t * The style to be applied to the host element after the dimensions are calculated.\n\t * @default 'overflow: hidden'\n\t */\n\tpublic readonly style = input<string>('overflow: hidden');\n\t/**\n\t * The style to be applied to the host element while the dimensions are being calculated.\n\t * @default 'opacity: 0'\n\t */\n\tpublic readonly styleWhileDimensionsAreInitiating = input<string>('overflow: hidden');\n\tprotected readonly _mutableStyle = linkedSignal(() =>\n\t\tthis._dimensionsInitiated() ? this.style() : this.styleWhileDimensionsAreInitiating(),\n\t);\n\n\tconstructor() {\n\t\tif (!this._item) {\n\t\t\tthrow Error('Accordion Content can only be used inside an AccordionItem. Add brnAccordionItem to parent.');\n\t\t}\n\t\tafterNextRender(() => {\n\t\t\tconst content = this._elementRef.nativeElement.firstChild as HTMLElement | null;\n\t\t\tif (!content) return;\n\t\t\tconst { width, height } = content.getBoundingClientRect();\n\t\t\tthis._width.set(width);\n\t\t\tthis._height.set(height);\n\t\t\tthis._dimensionsInitiated.set(true);\n\t\t});\n\t}\n}\n","import { BrnAccordion, BrnAccordionItem, BrnAccordionTrigger } from './lib/brn-accordion';\nimport { BrnAccordionContent } from './lib/brn-accordion-content';\n\nexport * from './lib/brn-accordion';\nexport * from './lib/brn-accordion-content';\n\nexport const BrnAccordionImports = [BrnAccordion, BrnAccordionContent, BrnAccordionItem, BrnAccordionTrigger] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MA2Ba,gBAAgB,CAAA;AACpB,IAAA,OAAO,gBAAgB,GAAG,CAAC;AACnB,IAAA,EAAE,GAAG,EAAE,gBAAgB,CAAC,gBAAgB;AACvC,IAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC;AAClD;;;AAGG;IACa,QAAQ,GAAG,KAAK,CAA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,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,iCAAA,EAAA,EAAA,iBAAA,EAAA,mCAAA,EAAA,UAAA,EAAA,mCAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,sBAAA,EAAA,eAAA,EAAA,IAAA,EAAA,IAAA,EAAA,wCAAA,EAAA,UAAA,EAAA,yCAAA,EAAA,WAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,iBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAb/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,6CAA6C;AACvD,oBAAA,IAAI,EAAE;AACL,wBAAA,mBAAmB,EAAE,SAAS;AAC9B,wBAAA,wBAAwB,EAAE,eAAe;AACzC,wBAAA,IAAI,EAAE,QAAQ;AACd,wBAAA,MAAM,EAAE,IAAI;AACZ,wBAAA,0CAA0C,EAAE,UAAU;AACtD,wBAAA,2CAA2C,EAAE,WAAW;AACxD,wBAAA,cAAc,EAAE,UAAU;AAC1B,wBAAA,cAAc,EAAE,iBAAiB;AACjC,qBAAA;AACD,iBAAA;;;ACTM,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB;;ACN5G;;AAEG;;;;"}
1
+ {"version":3,"file":"spartan-ng-brain-accordion.mjs","sources":["../../../../libs/brain/accordion/src/lib/brn-accordion-token.ts","../../../../libs/brain/accordion/src/lib/brn-accordion-trigger.ts","../../../../libs/brain/accordion/src/lib/brn-accordion.ts","../../../../libs/brain/accordion/src/lib/brn-accordion-content.ts","../../../../libs/brain/accordion/src/lib/brn-accordion-item.ts","../../../../libs/brain/accordion/src/index.ts","../../../../libs/brain/accordion/src/spartan-ng-brain-accordion.ts"],"sourcesContent":["import { type ExistingProvider, inject, InjectionToken, type Type, type ValueProvider } from '@angular/core';\nimport type { MeasurementDisplay } from '@spartan-ng/brain/core';\nimport type { BrnAccordion } from './brn-accordion';\nimport type { BrnAccordionItem } from './brn-accordion-item';\n\nexport const BrnAccordionToken = new InjectionToken<BrnAccordion>('BrnAccordionToken');\n\nexport function injectBrnAccordion() {\n\treturn inject(BrnAccordionToken);\n}\n\nexport function provideBrnAccordion(accordion: Type<BrnAccordion>): ExistingProvider {\n\treturn { provide: BrnAccordionToken, useExisting: accordion };\n}\n\nexport const BrnAccordionItemToken = new InjectionToken<BrnAccordionItem>('BrnAccordionItemToken');\n\nexport function injectBrnAccordionItem() {\n\treturn inject(BrnAccordionItemToken);\n}\n\nexport function provideBrnAccordionItem(item: Type<BrnAccordionItem>): ExistingProvider {\n\treturn { provide: BrnAccordionItemToken, useExisting: item };\n}\n\nexport interface BrBrnAccordionConfig {\n\t/**\n\t * The display style to use when measuring element dimensions.\n\t * @default 'block'\n\t */\n\tmeasurementDisplay: MeasurementDisplay;\n}\n\nconst defaultConfig: BrBrnAccordionConfig = {\n\tmeasurementDisplay: 'block',\n};\n\nconst BrnAccordionConfigToken = new InjectionToken<BrBrnAccordionConfig>('BrnBrnAccordionConfig');\n\nexport function provideBrnAccordionConfig(config: Partial<BrBrnAccordionConfig>): ValueProvider {\n\treturn { provide: BrnAccordionConfigToken, useValue: { ...defaultConfig, ...config } };\n}\n\nexport function injectBrnAccordionConfig(): BrBrnAccordionConfig {\n\treturn inject(BrnAccordionConfigToken, { optional: true }) ?? defaultConfig;\n}\n","import type { FocusableOption } from '@angular/cdk/a11y';\nimport { Directive, ElementRef, inject, isDevMode } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromEvent } from 'rxjs';\nimport { injectBrnAccordion, injectBrnAccordionItem } from './brn-accordion-token';\n\n@Directive({\n\tselector: '[brnAccordionTrigger]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.aria-expanded]': 'state() === \"open\"',\n\t\t'[attr.aria-controls]': 'ariaControls',\n\t\t'[id]': 'id',\n\t\t'[attr.role]': '\"button\"',\n\t\t'(click)': 'toggle($event)',\n\t\t'(keyup.space)': 'toggle($event)',\n\t\t'(keyup.enter)': 'toggle($event)',\n\t},\n})\nexport class BrnAccordionTrigger implements FocusableOption {\n\tprivate readonly _accordion = injectBrnAccordion();\n\tprivate readonly _item = injectBrnAccordionItem();\n\tprivate readonly _el = inject(ElementRef<HTMLElement>);\n\n\tpublic readonly state = this._item.state;\n\tpublic readonly id = `brn-accordion-trigger-${this._item.id}`;\n\tpublic readonly ariaControls = `brn-accordion-content-${this._item.id}`;\n\tconstructor() {\n\t\tif (!this._accordion) throw Error('Accordion trigger requires a parent Accordion.');\n\t\tif (!this._item) throw Error('Accordion trigger requires a parent AccordionItem.');\n\t\tthis.validateAriaStructure();\n\n\t\tfromEvent(this._el.nativeElement, 'focus')\n\t\t\t.pipe(takeUntilDestroyed())\n\t\t\t.subscribe(() => {\n\t\t\t\tthis._accordion.setActiveItem(this);\n\t\t\t});\n\t}\n\n\tprotected toggle(event: Event): void {\n\t\tevent.preventDefault();\n\t\tthis._accordion.toggleItem(this._item.id);\n\t}\n\n\tpublic focus() {\n\t\tthis._el.nativeElement.focus();\n\t}\n\n\tprivate validateAriaStructure(): void {\n\t\tconst element = this._el.nativeElement;\n\n\t\tconst isButton = element.tagName === 'BUTTON';\n\t\tconst hasButtonRole = element.getAttribute('role') === 'button';\n\n\t\tif (!isButton && !hasButtonRole) {\n\t\t\tthrow Error(\n\t\t\t\t`BrnAccordionTrigger: The trigger element must be a <button> or have role=\"button\". ` +\n\t\t\t\t\t`Found: <${element.tagName.toLowerCase()}>`,\n\t\t\t);\n\t\t}\n\n\t\tconst parent = element.parentElement;\n\t\tif (!parent) {\n\t\t\tconst message = 'BrnAccordionTrigger: The trigger button must be wrapped in a heading element.';\n\t\t\tif (isDevMode()) {\n\t\t\t\tthrow Error(message);\n\t\t\t} else {\n\t\t\t\tconsole.warn(message);\n\t\t\t}\n\t\t}\n\n\t\tconst isNativeHeading = /^H[1-6]$/.test(parent.tagName);\n\t\tconst hasHeadingRole = parent.getAttribute('role') === 'heading';\n\n\t\tif (!isNativeHeading && !hasHeadingRole) {\n\t\t\tthrow Error(\n\t\t\t\t`BrnAccordionTrigger: The trigger button must be wrapped in a heading element ` +\n\t\t\t\t\t`(h1-h6) or an element with role=\"heading\". Found parent: <${parent.tagName.toLowerCase()}>`,\n\t\t\t);\n\t\t}\n\n\t\tif (hasHeadingRole && !parent.hasAttribute('aria-level')) {\n\t\t\tthrow Error('BrnAccordionTrigger: Elements with role=\"heading\" must have an aria-level attribute.');\n\t\t}\n\t}\n}\n","import { FocusKeyManager, FocusMonitor } from '@angular/cdk/a11y';\nimport {\n\ttype AfterContentInit,\n\tcomputed,\n\tcontentChildren,\n\tDirective,\n\tElementRef,\n\tinject,\n\tinput,\n\ttype OnDestroy,\n\tsignal,\n} from '@angular/core';\nimport { provideBrnAccordion } from './brn-accordion-token';\nimport { BrnAccordionTrigger } from './brn-accordion-trigger';\n\nconst HORIZONTAL_KEYS_TO_PREVENT_DEFAULT = [\n\t'ArrowLeft',\n\t'ArrowRight',\n\t'PageDown',\n\t'PageUp',\n\t'Home',\n\t'End',\n\t' ',\n\t'Enter',\n] as const;\n\nconst VERTICAL_KEYS_TO_PREVENT_DEFAULT = [\n\t'ArrowUp',\n\t'ArrowDown',\n\t'PageDown',\n\t'PageUp',\n\t'Home',\n\t'End',\n\t' ',\n\t'Enter',\n] as const;\n\n@Directive({\n\tselector: '[brnAccordion]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.data-orientation]': 'orientation()',\n\t},\n\tproviders: [provideBrnAccordion(BrnAccordion)],\n\texportAs: 'brnAccordion',\n})\nexport class BrnAccordion implements AfterContentInit, OnDestroy {\n\tprivate readonly _el = inject(ElementRef<HTMLElement>);\n\tprivate readonly _focusMonitor = inject(FocusMonitor);\n\tprivate readonly _keyManager = computed(() =>\n\t\tnew FocusKeyManager<BrnAccordionTrigger>(this.triggers())\n\t\t\t.withHomeAndEnd()\n\t\t\t.withPageUpDown()\n\t\t\t.withWrap()\n\t\t\t.withHorizontalOrientation(this.orientation() === 'vertical' ? null : (this.dir() ?? 'ltr'))\n\t\t\t.withVerticalOrientation(this.orientation() === 'vertical'),\n\t);\n\n\tprivate readonly _focused = signal<boolean>(false);\n\tprivate readonly _openItemIds = signal<number[]>([]);\n\tpublic readonly openItemIds = this._openItemIds.asReadonly();\n\tpublic readonly state = computed(() => (this._openItemIds().length > 0 ? 'open' : 'closed'));\n\n\tpublic readonly triggers = contentChildren(BrnAccordionTrigger, { descendants: true });\n\n\t/**\n\t * Whether the accordion is in single or multiple mode.\n\t * @default 'single'\n\t */\n\tpublic readonly type = input<'single' | 'multiple'>('single');\n\t/**\n\t * The direction of the accordion, either 'ltr' (left-to-right) or 'rtl' (right-to-left).\n\t * @default null\n\t */\n\tpublic readonly dir = input<'ltr' | 'rtl' | null>(null);\n\t/**\n\t * The orientation of the accordion, either 'horizontal' or 'vertical'.\n\t * @default 'vertical'\n\t */\n\tpublic readonly orientation = input<'horizontal' | 'vertical'>('vertical');\n\n\tpublic ngAfterContentInit() {\n\t\tthis._el.nativeElement.addEventListener('keydown', (event: KeyboardEvent) => {\n\t\t\tif (this.shouldIgnoreEvent(event)) return;\n\t\t\tthis._keyManager()?.onKeydown(event);\n\t\t\tthis.preventDefaultEvents(event);\n\t\t});\n\t\tthis._focusMonitor.monitor(this._el, true).subscribe((origin) => this._focused.set(origin !== null));\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._focusMonitor.stopMonitoring(this._el);\n\t}\n\n\tpublic setActiveItem(item: BrnAccordionTrigger) {\n\t\tthis._keyManager()?.setActiveItem(item);\n\t}\n\n\tpublic toggleItem(id: number) {\n\t\tif (this._openItemIds().includes(id)) {\n\t\t\tthis.closeItem(id);\n\t\t\treturn;\n\t\t}\n\t\tthis.openItem(id);\n\t}\n\n\tpublic openItem(id: number) {\n\t\tif (this.type() === 'single') {\n\t\t\tthis._openItemIds.set([id]);\n\t\t\treturn;\n\t\t}\n\t\tthis._openItemIds.update((ids) => (ids.includes(id) ? ids : [...ids, id]));\n\t}\n\n\tpublic closeItem(id: number) {\n\t\tthis._openItemIds.update((ids) => ids.filter((openId) => openId !== id));\n\t}\n\n\tprivate isEditableTarget(el: EventTarget | null): boolean {\n\t\tconst node = el as HTMLElement | null;\n\t\tif (!node) return false;\n\n\t\tconst tag = node.tagName;\n\t\tif (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return true;\n\t\tif (node.isContentEditable) return true;\n\n\t\tconst role = node.getAttribute?.('role') ?? '';\n\t\tif (/^(textbox|searchbox|combobox|listbox|grid|tree|menu|spinbutton|slider)$/.test(role)) return true;\n\n\t\tconst editableAncestor = node.closest?.(\n\t\t\t'input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"], ' +\n\t\t\t\t'[role=\"textbox\"], [role=\"searchbox\"], [role=\"combobox\"], [role=\"listbox\"], ' +\n\t\t\t\t'[role=\"grid\"], [role=\"tree\"], [role=\"menu\"], [role=\"spinbutton\"], [role=\"slider\"]',\n\t\t);\n\t\treturn !!editableAncestor;\n\t}\n\n\tprivate shouldIgnoreEvent(e: KeyboardEvent): boolean {\n\t\tif (e.defaultPrevented) return true; // another handler already acted\n\t\tif (e.ctrlKey || e.metaKey || e.altKey) return true; // let shortcuts through\n\t\treturn this.isEditableTarget(e.target); // don't steal from editable/ARIA widgets\n\t}\n\n\tprivate preventDefaultEvents(event: KeyboardEvent) {\n\t\tif (event.defaultPrevented) return;\n\t\tif (!this._focused()) return;\n\t\tif (!('key' in event)) return;\n\n\t\tconst keys: readonly string[] =\n\t\t\tthis.orientation() === 'horizontal' ? HORIZONTAL_KEYS_TO_PREVENT_DEFAULT : VERTICAL_KEYS_TO_PREVENT_DEFAULT;\n\n\t\tif (keys.includes(event.key) && event.code !== 'NumpadEnter') {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n}\n","import { Directive, ElementRef, afterNextRender, computed, inject, input, signal } from '@angular/core';\nimport { measureDimensions } from '@spartan-ng/brain/core';\nimport { injectBrnAccordionConfig, injectBrnAccordionItem } from './brn-accordion-token';\n\n@Directive({\n\tselector: 'brn-accordion-content,[brnAccordionContent]',\n\thost: {\n\t\t'[attr.data-state]': 'state?.()',\n\t\t'[attr.aria-labelledby]': 'ariaLabeledBy',\n\t\trole: 'region',\n\t\t'[id]': 'id',\n\t\t'[style.--brn-accordion-content-width.px]': '_width()',\n\t\t'[style.--brn-accordion-content-height.px]': '_height()',\n\t\t'[attr.inert]': '_inert()',\n\t\t'[attr.style]': 'style()',\n\t},\n})\nexport class BrnAccordionContent {\n\tprivate readonly _config = injectBrnAccordionConfig();\n\tprivate readonly _item = injectBrnAccordionItem();\n\tprivate readonly _elementRef = inject(ElementRef);\n\n\tprotected readonly _width = signal<number | null>(null);\n\tprotected readonly _height = signal<number | null>(null);\n\tprotected readonly _inert = computed(() => (this.state?.() === 'closed' ? true : undefined));\n\n\tpublic readonly state = this._item?.state;\n\tpublic readonly id = `brn-accordion-content-${this._item?.id}`;\n\tpublic readonly ariaLabeledBy = `brn-accordion-trigger-${this._item?.id}`;\n\t/**\n\t * The style to be applied to the host element after the dimensions are calculated.\n\t * @default 'overflow: hidden'\n\t */\n\tpublic readonly style = input<string>('overflow: hidden');\n\n\tconstructor() {\n\t\tif (!this._item) {\n\t\t\tthrow Error('Accordion Content can only be used inside an AccordionItem. Add brnAccordionItem to parent.');\n\t\t}\n\t\tafterNextRender(() => {\n\t\t\tconst content = this._elementRef.nativeElement.firstChild as HTMLElement | null;\n\t\t\tif (!content) return;\n\n\t\t\tconst { width, height } = measureDimensions(content, this._config.measurementDisplay);\n\t\t\tthis._width.set(width);\n\t\t\tthis._height.set(height);\n\t\t});\n\t}\n}\n","import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { computed, Directive, effect, input, output, untracked } from '@angular/core';\nimport { injectBrnAccordion, provideBrnAccordionItem } from './brn-accordion-token';\n\n@Directive({\n\tselector: '[brnAccordionItem]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t},\n\tproviders: [provideBrnAccordionItem(BrnAccordionItem)],\n\texportAs: 'brnAccordionItem',\n})\nexport class BrnAccordionItem {\n\tprivate static _itemIdGenerator = 0;\n\tpublic readonly id = ++BrnAccordionItem._itemIdGenerator;\n\tprivate readonly _accordion = injectBrnAccordion();\n\t/**\n\t * Whether the item is opened or closed.\n\t * @default false\n\t */\n\tpublic readonly isOpened = input<boolean, BooleanInput>(false, { transform: coerceBooleanProperty });\n\t/**\n\t * Computed state of the item, either 'open' or 'closed'\n\t * @default closed\n\t */\n\tpublic readonly state = computed(() => (this._accordion.openItemIds()?.includes(this.id) ? 'open' : 'closed'));\n\t/**\n\t * Emits boolean when the item is opened or closed.\n\t */\n\tpublic readonly stateChange = output<'open' | 'closed'>();\n\t/**\n\t * Emits state change when item is opened or closed\n\t */\n\tpublic readonly openedChange = output<boolean>();\n\n\tconstructor() {\n\t\tif (!this._accordion) {\n\t\t\tthrow Error('Accordion item can only be used inside an Accordion. Add brnAccordion to ancestor.');\n\t\t}\n\t\teffect(() => {\n\t\t\tconst state = this.state();\n\t\t\tuntracked(() => {\n\t\t\t\tthis.stateChange.emit(state);\n\t\t\t\tthis.openedChange.emit(state === 'open');\n\t\t\t});\n\t\t});\n\t\teffect(() => {\n\t\t\tconst isOpened = this.isOpened();\n\t\t\tuntracked(() => {\n\t\t\t\tif (isOpened) {\n\t\t\t\t\tthis._accordion.openItem(this.id);\n\t\t\t\t} else {\n\t\t\t\t\tthis._accordion.closeItem(this.id);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n","import { BrnAccordion } from './lib/brn-accordion';\nimport { BrnAccordionContent } from './lib/brn-accordion-content';\nimport { BrnAccordionItem } from './lib/brn-accordion-item';\nimport { BrnAccordionTrigger } from './lib/brn-accordion-trigger';\n\nexport * from './lib/brn-accordion';\nexport * from './lib/brn-accordion-content';\nexport * from './lib/brn-accordion-item';\nexport * from './lib/brn-accordion-token';\nexport * from './lib/brn-accordion-trigger';\n\nexport const BrnAccordionImports = [BrnAccordion, BrnAccordionContent, BrnAccordionItem, BrnAccordionTrigger] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAKa,iBAAiB,GAAG,IAAI,cAAc,CAAe,mBAAmB;SAErE,kBAAkB,GAAA;AACjC,IAAA,OAAO,MAAM,CAAC,iBAAiB,CAAC;AACjC;AAEM,SAAU,mBAAmB,CAAC,SAA6B,EAAA;IAChE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE;AAC9D;MAEa,qBAAqB,GAAG,IAAI,cAAc,CAAmB,uBAAuB;SAEjF,sBAAsB,GAAA;AACrC,IAAA,OAAO,MAAM,CAAC,qBAAqB,CAAC;AACrC;AAEM,SAAU,uBAAuB,CAAC,IAA4B,EAAA;IACnE,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,IAAI,EAAE;AAC7D;AAUA,MAAM,aAAa,GAAyB;AAC3C,IAAA,kBAAkB,EAAE,OAAO;CAC3B;AAED,MAAM,uBAAuB,GAAG,IAAI,cAAc,CAAuB,uBAAuB,CAAC;AAE3F,SAAU,yBAAyB,CAAC,MAAqC,EAAA;AAC9E,IAAA,OAAO,EAAE,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,EAAE,EAAE;AACvF;SAEgB,wBAAwB,GAAA;AACvC,IAAA,OAAO,MAAM,CAAC,uBAAuB,EAAE,EAAE,QA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BAAA;;;ACAM,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB;;ACX5G;;AAEG;;;;"}
@@ -1,6 +1,24 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, model, input, booleanAttribute, ChangeDetectionStrategy, Component, inject, ElementRef, PLATFORM_ID, effect, untracked, Directive } from '@angular/core';
3
- import { isPlatformServer } from '@angular/common';
2
+ import { InjectionToken, inject, signal, model, computed, input, booleanAttribute, Directive, ElementRef, effect, untracked, afterNextRender } from '@angular/core';
3
+ import { measureDimensions } from '@spartan-ng/brain/core';
4
+
5
+ const BrnCollapsibleToken = new InjectionToken('BrnCollapsibleToken');
6
+ function injectBrnCollapsible() {
7
+ return inject(BrnCollapsibleToken, { optional: true });
8
+ }
9
+ function provideBrnCollapsible(collapsible) {
10
+ return { provide: BrnCollapsibleToken, useExisting: collapsible };
11
+ }
12
+ const defaultConfig = {
13
+ measurementDisplay: 'block',
14
+ };
15
+ const BrnCollapsibleConfigToken = new InjectionToken('BrnCollapsibleConfig');
16
+ function provideBrnCollapsibleConfig(config) {
17
+ return { provide: BrnCollapsibleConfigToken, useValue: { ...defaultConfig, ...config } };
18
+ }
19
+ function injectBrnCollapsibleConfig() {
20
+ return inject(BrnCollapsibleConfigToken, { optional: true }) ?? defaultConfig;
21
+ }
4
22
 
5
23
  let collapsibleContentIdSequence = 0;
6
24
  class BrnCollapsible {
@@ -9,6 +27,10 @@ class BrnCollapsible {
9
27
  * The expanded or collapsed state of the collapsible component.
10
28
  */
11
29
  expanded = model(false);
30
+ /**
31
+ * The current state of the collapsible component as 'open' or 'closed'.
32
+ */
33
+ state = computed(() => (this.expanded() ? 'open' : 'closed'));
12
34
  /**
13
35
  * The disabled state of the collapsible component.
14
36
  */
@@ -17,38 +39,36 @@ class BrnCollapsible {
17
39
  * Toggles the expanded state of the collapsible component.
18
40
  */
19
41
  toggle() {
42
+ if (this.disabled()) {
43
+ return;
44
+ }
20
45
  this.expanded.update((expanded) => !expanded);
21
46
  }
22
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCollapsible, deps: [], target: i0.ɵɵFactoryTarget.Component });
23
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: BrnCollapsible, isStandalone: true, selector: "brn-collapsible", inputs: { expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { properties: { "attr.data-state": "expanded() ? \"open\" : \"closed\"", "attr.disabled": "disabled() ? true : undefined" } }, ngImport: i0, template: `
24
- <ng-content />
25
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
47
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCollapsible, deps: [], target: i0.ɵɵFactoryTarget.Directive });
48
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCollapsible, isStandalone: true, selector: "[brnCollapsible],brn-collapsible", inputs: { expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { properties: { "attr.data-state": "state()", "attr.disabled": "disabled() ? true : undefined" } }, providers: [provideBrnCollapsible(BrnCollapsible)], ngImport: i0 });
26
49
  }
27
50
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCollapsible, decorators: [{
28
- type: Component,
51
+ type: Directive,
29
52
  args: [{
30
- selector: 'brn-collapsible',
53
+ selector: '[brnCollapsible],brn-collapsible',
31
54
  host: {
32
- '[attr.data-state]': 'expanded() ? "open" : "closed"',
55
+ '[attr.data-state]': 'state()',
33
56
  '[attr.disabled]': 'disabled() ? true : undefined',
34
57
  },
35
- template: `
36
- <ng-content />
37
- `,
38
- changeDetection: ChangeDetectionStrategy.OnPush,
58
+ providers: [provideBrnCollapsible(BrnCollapsible)],
39
59
  }]
40
60
  }] });
41
61
 
42
62
  class BrnCollapsibleContent {
43
- _collapsible = inject(BrnCollapsible, { optional: true });
63
+ _config = injectBrnCollapsibleConfig();
44
64
  _elementRef = inject(ElementRef);
45
- _platformId = inject(PLATFORM_ID);
65
+ _collapsible = injectBrnCollapsible();
66
+ _width = signal(null);
67
+ _height = signal(null);
46
68
  /**
47
69
  * The id of the collapsible content element.
48
70
  */
49
71
  id = input();
50
- _width = signal(null);
51
- _height = signal(null);
52
72
  constructor() {
53
73
  if (!this._collapsible) {
54
74
  throw Error('Collapsible trigger directive can only be used inside a brn-collapsible element.');
@@ -60,45 +80,32 @@ class BrnCollapsibleContent {
60
80
  return;
61
81
  untracked(() => collapsible.contentId.set(id));
62
82
  });
83
+ afterNextRender(() => {
84
+ const { width, height } = measureDimensions(this._elementRef.nativeElement, this._config.measurementDisplay);
85
+ this._width.set(width);
86
+ this._height.set(height);
87
+ });
63
88
  }
64
- ngOnInit() {
65
- if (isPlatformServer(this._platformId)) {
66
- return;
67
- }
68
- // ensure the element is not hidden when measuring its size
69
- this._elementRef.nativeElement.hidden = false;
70
- const { width, height } = this._elementRef.nativeElement.getBoundingClientRect();
71
- this._width.set(width);
72
- this._height.set(height);
73
- // we force the element to be hidden again if collapsed after measuring its size
74
- // this is handled by the host binding, but it can cause a flicker if we don't do this here manually
75
- this._elementRef.nativeElement.hidden = this._collapsible?.expanded() ?? false;
76
- }
77
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCollapsibleContent, deps: [], target: i0.ɵɵFactoryTarget.Component });
78
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: BrnCollapsibleContent, isStandalone: true, selector: "brn-collapsible-content", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "hidden": "!_collapsible?.expanded()", "attr.data-state": "_collapsible?.expanded() ? \"open\" : \"closed\"", "id": "_collapsible?.contentId()", "style.--brn-collapsible-content-width.px": "_width()", "style.--brn-collapsible-content-height.px": "_height()" } }, ngImport: i0, template: `
79
- <ng-content />
80
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
89
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCollapsibleContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
90
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCollapsibleContent, isStandalone: true, selector: "[brnCollapsibleContent],brn-collapsible-content", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.inert": "_collapsible?.state() === 'closed' ? true : undefined", "attr.data-state": "_collapsible?.state()", "id": "_collapsible?.contentId()", "style.--brn-collapsible-content-width.px": "_width()", "style.--brn-collapsible-content-height.px": "_height()" } }, ngImport: i0 });
81
91
  }
82
92
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCollapsibleContent, decorators: [{
83
- type: Component,
93
+ type: Directive,
84
94
  args: [{
85
- selector: 'brn-collapsible-content',
95
+ selector: '[brnCollapsibleContent],brn-collapsible-content',
86
96
  host: {
87
- '[hidden]': '!_collapsible?.expanded()',
88
- '[attr.data-state]': '_collapsible?.expanded() ? "open" : "closed"',
97
+ '[attr.inert]': "_collapsible?.state() === 'closed' ? true : undefined",
98
+ '[attr.data-state]': '_collapsible?.state()',
89
99
  '[id]': '_collapsible?.contentId()',
90
100
  '[style.--brn-collapsible-content-width.px]': '_width()',
91
101
  '[style.--brn-collapsible-content-height.px]': '_height()',
92
102
  },
93
- template: `
94
- <ng-content />
95
- `,
96
- changeDetection: ChangeDetectionStrategy.OnPush,
97
103
  }]
98
104
  }], ctorParameters: () => [] });
99
105
 
100
106
  class BrnCollapsibleTrigger {
101
- _collapsible = inject(BrnCollapsible, { optional: true });
107
+ _collapsible = injectBrnCollapsible();
108
+ type = input('button');
102
109
  constructor() {
103
110
  if (!this._collapsible) {
104
111
  throw Error('Collapsible trigger directive can only be used inside a brn-collapsible element.');
@@ -108,17 +115,18 @@ class BrnCollapsibleTrigger {
108
115
  this._collapsible?.toggle();
109
116
  }
110
117
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCollapsibleTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
111
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCollapsibleTrigger, isStandalone: true, selector: "button[brnCollapsibleTrigger]", host: { listeners: { "click": "toggle()" }, properties: { "attr.data-state": "_collapsible?.expanded() ? \"open\" : \"closed\"", "attr.disabled": "_collapsible?.disabled() ? true : undefined", "attr.aria-expanded": "_collapsible?.expanded()", "attr.aria-controls": "_collapsible?.contentId()" } }, ngImport: i0 });
118
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCollapsibleTrigger, isStandalone: true, selector: "button[brnCollapsibleTrigger]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "toggle()" }, properties: { "attr.data-state": "_collapsible?.state()", "attr.disabled": "_collapsible?.disabled() ? true : undefined", "attr.aria-expanded": "_collapsible?.expanded()", "attr.aria-controls": "_collapsible?.contentId()", "type": "type()" } }, ngImport: i0 });
112
119
  }
113
120
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCollapsibleTrigger, decorators: [{
114
121
  type: Directive,
115
122
  args: [{
116
123
  selector: 'button[brnCollapsibleTrigger]',
117
124
  host: {
118
- '[attr.data-state]': '_collapsible?.expanded() ? "open" : "closed"',
125
+ '[attr.data-state]': '_collapsible?.state()',
119
126
  '[attr.disabled]': '_collapsible?.disabled() ? true : undefined',
120
127
  '[attr.aria-expanded]': '_collapsible?.expanded()',
121
128
  '[attr.aria-controls]': '_collapsible?.contentId()',
129
+ '[type]': 'type()',
122
130
  '(click)': 'toggle()',
123
131
  },
124
132
  }]
@@ -130,5 +138,5 @@ const BrnCollapsibleImports = [BrnCollapsible, BrnCollapsibleTrigger, BrnCollaps
130
138
  * Generated bundle index. Do not edit.
131
139
  */
132
140
 
133
- export { BrnCollapsible, BrnCollapsibleContent, BrnCollapsibleImports, BrnCollapsibleTrigger };
141
+ export { BrnCollapsible, BrnCollapsibleContent, BrnCollapsibleImports, BrnCollapsibleToken, BrnCollapsibleTrigger, injectBrnCollapsible, injectBrnCollapsibleConfig, provideBrnCollapsible, provideBrnCollapsibleConfig };
134
142
  //# sourceMappingURL=spartan-ng-brain-collapsible.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-collapsible.mjs","sources":["../../../../libs/brain/collapsible/src/lib/brn-collapsible.ts","../../../../libs/brain/collapsible/src/lib/brn-collapsible-content.ts","../../../../libs/brain/collapsible/src/lib/brn-collapsible-trigger.ts","../../../../libs/brain/collapsible/src/index.ts","../../../../libs/brain/collapsible/src/spartan-ng-brain-collapsible.ts"],"sourcesContent":["import type { BooleanInput } from '@angular/cdk/coercion';\nimport { ChangeDetectionStrategy, Component, booleanAttribute, input, model, signal } from '@angular/core';\n\nlet collapsibleContentIdSequence = 0;\n\nexport type BrnCollapsibleState = 'open' | 'closed';\n\n@Component({\n\tselector: 'brn-collapsible',\n\thost: {\n\t\t'[attr.data-state]': 'expanded() ? \"open\" : \"closed\"',\n\t\t'[attr.disabled]': 'disabled() ? true : undefined',\n\t},\n\ttemplate: `\n\t\t<ng-content />\n\t`,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnCollapsible {\n\tpublic readonly contentId = signal(`brn-collapsible-content-${++collapsibleContentIdSequence}`);\n\n\t/**\n\t * The expanded or collapsed state of the collapsible component.\n\t */\n\tpublic readonly expanded = model<boolean>(false);\n\n\t/**\n\t * The disabled state of the collapsible component.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Toggles the expanded state of the collapsible component.\n\t */\n\tpublic toggle(): void {\n\t\tthis.expanded.update((expanded) => !expanded);\n\t}\n}\n","import { isPlatformServer } from '@angular/common';\nimport {\n\tChangeDetectionStrategy,\n\tComponent,\n\tElementRef,\n\ttype OnInit,\n\tPLATFORM_ID,\n\teffect,\n\tinject,\n\tinput,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { BrnCollapsible } from './brn-collapsible';\n\n@Component({\n\tselector: 'brn-collapsible-content',\n\thost: {\n\t\t'[hidden]': '!_collapsible?.expanded()',\n\t\t'[attr.data-state]': '_collapsible?.expanded() ? \"open\" : \"closed\"',\n\t\t'[id]': '_collapsible?.contentId()',\n\t\t'[style.--brn-collapsible-content-width.px]': '_width()',\n\t\t'[style.--brn-collapsible-content-height.px]': '_height()',\n\t},\n\ttemplate: `\n\t\t<ng-content />\n\t`,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnCollapsibleContent implements OnInit {\n\tprotected readonly _collapsible = inject(BrnCollapsible, { optional: true });\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\tprivate readonly _platformId = inject(PLATFORM_ID);\n\t/**\n\t * The id of the collapsible content element.\n\t */\n\tpublic readonly id = input<string | null | undefined>();\n\tprotected readonly _width = signal<number | null>(null);\n\tprotected readonly _height = signal<number | null>(null);\n\n\tconstructor() {\n\t\tif (!this._collapsible) {\n\t\t\tthrow Error('Collapsible trigger directive can only be used inside a brn-collapsible element.');\n\t\t}\n\n\t\teffect(() => {\n\t\t\tconst id = this.id();\n\t\t\tconst collapsible = this._collapsible;\n\t\t\tif (!id || !collapsible) return;\n\t\t\tuntracked(() => collapsible.contentId.set(id));\n\t\t});\n\t}\n\n\tngOnInit(): void {\n\t\tif (isPlatformServer(this._platformId)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// ensure the element is not hidden when measuring its size\n\t\tthis._elementRef.nativeElement.hidden = false;\n\n\t\tconst { width, height } = this._elementRef.nativeElement.getBoundingClientRect();\n\t\tthis._width.set(width);\n\t\tthis._height.set(height);\n\n\t\t// we force the element to be hidden again if collapsed after measuring its size\n\t\t// this is handled by the host binding, but it can cause a flicker if we don't do this here manually\n\t\tthis._elementRef.nativeElement.hidden = this._collapsible?.expanded() ?? false;\n\t}\n}\n","import { Directive, inject } from '@angular/core';\nimport { BrnCollapsible } from './brn-collapsible';\n\n@Directive({\n\tselector: 'button[brnCollapsibleTrigger]',\n\thost: {\n\t\t'[attr.data-state]': '_collapsible?.expanded() ? \"open\" : \"closed\"',\n\t\t'[attr.disabled]': '_collapsible?.disabled() ? true : undefined',\n\t\t'[attr.aria-expanded]': '_collapsible?.expanded()',\n\t\t'[attr.aria-controls]': '_collapsible?.contentId()',\n\t\t'(click)': 'toggle()',\n\t},\n})\nexport class BrnCollapsibleTrigger {\n\tprotected readonly _collapsible = inject(BrnCollapsible, { optional: true });\n\n\tconstructor() {\n\t\tif (!this._collapsible) {\n\t\t\tthrow Error('Collapsible trigger directive can only be used inside a brn-collapsible element.');\n\t\t}\n\t}\n\n\ttoggle(): void {\n\t\tthis._collapsible?.toggle();\n\t}\n}\n","import { BrnCollapsible } from './lib/brn-collapsible';\nimport { BrnCollapsibleContent } from './lib/brn-collapsible-content';\nimport { BrnCollapsibleTrigger } from './lib/brn-collapsible-trigger';\n\nexport * from './lib/brn-collapsible';\nexport * from './lib/brn-collapsible-content';\nexport * from './lib/brn-collapsible-trigger';\n\nexport const BrnCollapsibleImports = [BrnCollapsible, BrnCollapsibleTrigger, BrnCollapsibleContent] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA,IAAI,4BAA4B,GAAG,CAAC;MAevB,cAAc,CAAA;IACV,SAAS,GAAG,MAAM,CAAC,CAAA,wBAAA,EAA2B,EAAE,4BAA4B,CAAA,CAAE,CAAC;AAE/F;;AAEG;AACa,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;AAEhD;;AAEG;IACa,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAE/F;;AAEG;IACI,MAAM,GAAA;AACZ,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,QAAQ,KAAK,CAAC,QAAQ,CAAC;;0HAjBlC,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAd,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OA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,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAVjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,+BAA+B;AACzC,oBAAA,IAAI,EAAE;AACL,wBAAA,mBAAmB,EAAE,8CAA8C;AACnE,wBAAA,iBAAiB,EAAE,6CAA6C;AAChE,wBAAA,sBAAsB,EAAE,0BAA0B;AAClD,wBAAA,sBAAsB,EAAE,2BAA2B;AACnD,wBAAA,SAAS,EAAE,UAAU;AACrB,qBAAA;AACD,iBAAA;;;ACJM,MAAM,qBAAqB,GAAG,CAAC,cAAc,EAAE,qBAAqB,EAAE,qBAAqB;;ACRlG;;AAEG;;;;"}
1
+ {"version":3,"file":"spartan-ng-brain-collapsible.mjs","sources":["../../../../libs/brain/collapsible/src/lib/brn-collapsible-token.ts","../../../../libs/brain/collapsible/src/lib/brn-collapsible.ts","../../../../libs/brain/collapsible/src/lib/brn-collapsible-content.ts","../../../../libs/brain/collapsible/src/lib/brn-collapsible-trigger.ts","../../../../libs/brain/collapsible/src/index.ts","../../../../libs/brain/collapsible/src/spartan-ng-brain-collapsible.ts"],"sourcesContent":["import type { ValueProvider } from '@angular/core';\nimport { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { MeasurementDisplay } from '@spartan-ng/brain/core';\nimport type { BrnCollapsible } from './brn-collapsible';\n\nexport const BrnCollapsibleToken = new InjectionToken<BrnCollapsible>('BrnCollapsibleToken');\n\nexport function injectBrnCollapsible() {\n\treturn inject(BrnCollapsibleToken, { optional: true });\n}\n\nexport function provideBrnCollapsible(collapsible: Type<BrnCollapsible>): ExistingProvider {\n\treturn { provide: BrnCollapsibleToken, useExisting: collapsible };\n}\n\nexport interface BrCollapsibleConfig {\n\t/**\n\t * The display style to use when measuring element dimensions.\n\t * @default 'block'\n\t */\n\tmeasurementDisplay: MeasurementDisplay;\n}\n\nconst defaultConfig: BrCollapsibleConfig = {\n\tmeasurementDisplay: 'block',\n};\n\nconst BrnCollapsibleConfigToken = new InjectionToken<BrCollapsibleConfig>('BrnCollapsibleConfig');\n\nexport function provideBrnCollapsibleConfig(config: Partial<BrCollapsibleConfig>): ValueProvider {\n\treturn { provide: BrnCollapsibleConfigToken, useValue: { ...defaultConfig, ...config } };\n}\n\nexport function injectBrnCollapsibleConfig(): BrCollapsibleConfig {\n\treturn inject(BrnCollapsibleConfigToken, { optional: true }) ?? defaultConfig;\n}\n","import type { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, computed, input, model, signal } from '@angular/core';\nimport { provideBrnCollapsible } from './brn-collapsible-token';\n\nlet collapsibleContentIdSequence = 0;\n\nexport type BrnCollapsibleState = 'open' | 'closed';\n\n@Directive({\n\tselector: '[brnCollapsible],brn-collapsible',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.disabled]': 'disabled() ? true : undefined',\n\t},\n\tproviders: [provideBrnCollapsible(BrnCollapsible)],\n})\nexport class BrnCollapsible {\n\tpublic readonly contentId = signal(`brn-collapsible-content-${++collapsibleContentIdSequence}`);\n\n\t/**\n\t * The expanded or collapsed state of the collapsible component.\n\t */\n\tpublic readonly expanded = model<boolean>(false);\n\n\t/**\n\t * The current state of the collapsible component as 'open' or 'closed'.\n\t */\n\tpublic readonly state = computed<BrnCollapsibleState>(() => (this.expanded() ? 'open' : 'closed'));\n\n\t/**\n\t * The disabled state of the collapsible component.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Toggles the expanded state of the collapsible component.\n\t */\n\tpublic toggle(): void {\n\t\tif (this.disabled()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.expanded.update((expanded) => !expanded);\n\t}\n}\n","import { Directive, ElementRef, afterNextRender, effect, inject, input, signal, untracked } from '@angular/core';\nimport { measureDimensions } from '@spartan-ng/brain/core';\nimport { injectBrnCollapsible, injectBrnCollapsibleConfig } from './brn-collapsible-token';\n\n@Directive({\n\tselector: '[brnCollapsibleContent],brn-collapsible-content',\n\thost: {\n\t\t'[attr.inert]': \"_collapsible?.state() === 'closed' ? true : undefined\",\n\t\t'[attr.data-state]': '_collapsible?.state()',\n\t\t'[id]': '_collapsible?.contentId()',\n\t\t'[style.--brn-collapsible-content-width.px]': '_width()',\n\t\t'[style.--brn-collapsible-content-height.px]': '_height()',\n\t},\n})\nexport class BrnCollapsibleContent {\n\tprivate readonly _config = injectBrnCollapsibleConfig();\n\tprivate readonly _elementRef = inject<ElementRef>(ElementRef);\n\tprotected readonly _collapsible = injectBrnCollapsible();\n\n\tprotected readonly _width = signal<number | null>(null);\n\tprotected readonly _height = signal<number | null>(null);\n\n\t/**\n\t * The id of the collapsible content element.\n\t */\n\tpublic readonly id = input<string | null | undefined>();\n\n\tconstructor() {\n\t\tif (!this._collapsible) {\n\t\t\tthrow Error('Collapsible trigger directive can only be used inside a brn-collapsible element.');\n\t\t}\n\n\t\teffect(() => {\n\t\t\tconst id = this.id();\n\t\t\tconst collapsible = this._collapsible;\n\t\t\tif (!id || !collapsible) return;\n\t\t\tuntracked(() => collapsible.contentId.set(id));\n\t\t});\n\n\t\tafterNextRender(() => {\n\t\t\tconst { width, height } = measureDimensions(this._elementRef.nativeElement, this._config.measurementDisplay);\n\t\t\tthis._width.set(width);\n\t\t\tthis._height.set(height);\n\t\t});\n\t}\n}\n","import { Directive, input } from '@angular/core';\nimport { injectBrnCollapsible } from './brn-collapsible-token';\n\n@Directive({\n\tselector: 'button[brnCollapsibleTrigger]',\n\thost: {\n\t\t'[attr.data-state]': '_collapsible?.state()',\n\t\t'[attr.disabled]': '_collapsible?.disabled() ? true : undefined',\n\t\t'[attr.aria-expanded]': '_collapsible?.expanded()',\n\t\t'[attr.aria-controls]': '_collapsible?.contentId()',\n\t\t'[type]': 'type()',\n\t\t'(click)': 'toggle()',\n\t},\n})\nexport class BrnCollapsibleTrigger {\n\tprotected readonly _collapsible = injectBrnCollapsible();\n\n\tpublic readonly type = input<'button' | 'submit' | 'reset'>('button');\n\n\tconstructor() {\n\t\tif (!this._collapsible) {\n\t\t\tthrow Error('Collapsible trigger directive can only be used inside a brn-collapsible element.');\n\t\t}\n\t}\n\n\ttoggle(): void {\n\t\tthis._collapsible?.toggle();\n\t}\n}\n","import { BrnCollapsible } from './lib/brn-collapsible';\nimport { BrnCollapsibleContent } from './lib/brn-collapsible-content';\nimport { BrnCollapsibleTrigger } from './lib/brn-collapsible-trigger';\n\nexport * from './lib/brn-collapsible';\nexport * from './lib/brn-collapsible-content';\nexport * from './lib/brn-collapsible-token';\nexport * from './lib/brn-collapsible-trigger';\n\nexport const BrnCollapsibleImports = [BrnCollapsible, BrnCollapsibleTrigger, BrnCollapsibleContent] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAKa,mBAAmB,GAAG,IAAI,cAAc,CAAiB,qBAAqB;SAE3E,oBAAoB,GAAA;IACnC,OAAO,MAAM,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACvD;AAEM,SAAU,qBAAqB,CAAC,WAAiC,EAAA;IACtE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,WAAW,EAAE;AAClE;AAUA,MAAM,aAAa,GAAwB;AAC1C,IAAA,kBAAkB,EAAE,OAAO;CAC3B;AAED,MAAM,yBAAyB,GAAG,IAAI,cAAc,CAAsB,sBAAsB,CAAC;AAE3F,SAAU,2BAA2B,CAAC,MAAoC,EAAA;AAC/E,IAAA,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,QAAQ,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,EAAE,EAAE;AACzF;SAEgB,0BAA0B,GAAA;AACzC,IAAA,OAAO,MAAM,CAAC,yBAAyB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,aAAa;AAC9E;;AC/BA,IAA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IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,UAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,uBAAA,EAAA,eAAA,EAAA,6CAAA,EAAA,oBAAA,EAAA,0BAAA,EAAA,oBAAA,EAAA,2BAAA,EAAA,MAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAXjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,+BAA+B;AACzC,oBAAA,IAAI,EAAE;AACL,wBAAA,mBAAmB,EAAE,uBAAuB;AAC5C,wBAAA,iBAAiB,EAAE,6CAA6C;AAChE,wBAAA,sBAAsB,EAAE,0BAA0B;AAClD,wBAAA,sBAAsB,EAAE,2BAA2B;AACnD,wBAAA,QAAQ,EAAE,QAAQ;AAClB,wBAAA,SAAS,EAAE,UAAU;AACrB,qBAAA;AACD,iBAAA;;;ACJM,MAAM,qBAAqB,GAAG,CAAC,cAAc,EAAE,qBAAqB,EAAE,qBAAqB;;ACTlG;;AAEG;;;;"}
@@ -113,6 +113,20 @@ const [injectExposedSideProvider, provideExposedSideProvider, provideExposedSide
113
113
 
114
114
  const [injectExposesStateProvider, provideExposesStateProvider, provideExposesStateProviderExisting, EXPOSES_STATE_TOKEN,] = createInjectionToken('@spartan-ng EXPOSES_STATE_TOKEN');
115
115
 
116
+ const measureDimensions = (elementToMeasure, measurementDisplay) => {
117
+ const previousHeight = elementToMeasure.style.height;
118
+ const previousDisplay = elementToMeasure.style.display;
119
+ const previousHidden = elementToMeasure.hidden;
120
+ elementToMeasure.hidden = false;
121
+ elementToMeasure.style.height = 'auto';
122
+ elementToMeasure.style.display = previousDisplay === 'hidden' ? measurementDisplay : previousDisplay;
123
+ const { width, height } = elementToMeasure.getBoundingClientRect();
124
+ elementToMeasure.hidden = previousHidden;
125
+ elementToMeasure.style.display = previousDisplay;
126
+ elementToMeasure.style.height = previousHeight;
127
+ return { width, height };
128
+ };
129
+
116
130
  const [injectTableClassesSettable, provideTableClassesSettable, provideTableClassesSettableExisting, SET_TABLE_CLASSES_TOKEN,] = createInjectionToken('@spartan-ng SET_TABLE_CLASSES_TOKEN');
117
131
 
118
132
  /**
@@ -142,5 +156,5 @@ async function waitForElementAnimations(el) {
142
156
  * Generated bundle index. Do not edit.
143
157
  */
144
158
 
145
- export { EXPOSES_SIDE_TOKEN, EXPOSES_STATE_TOKEN, SET_CLASS_TO_CUSTOM_ELEMENT_TOKEN, SET_TABLE_CLASSES_TOKEN, brnDevMode, brnZoneFree, brnZoneFull, brnZoneOptimized, computedPrevious, createHoverObservable, debouncedSignal, injectCustomClassSettable, injectExposedSideProvider, injectExposesStateProvider, injectTableClassesSettable, isElement, provideCustomClassSettable, provideCustomClassSettableExisting, provideExposedSideProvider, provideExposedSideProviderExisting, provideExposesStateProvider, provideExposesStateProviderExisting, provideTableClassesSettable, provideTableClassesSettableExisting, waitForElementAnimations };
159
+ export { EXPOSES_SIDE_TOKEN, EXPOSES_STATE_TOKEN, SET_CLASS_TO_CUSTOM_ELEMENT_TOKEN, SET_TABLE_CLASSES_TOKEN, brnDevMode, brnZoneFree, brnZoneFull, brnZoneOptimized, computedPrevious, createHoverObservable, debouncedSignal, injectCustomClassSettable, injectExposedSideProvider, injectExposesStateProvider, injectTableClassesSettable, isElement, measureDimensions, provideCustomClassSettable, provideCustomClassSettableExisting, provideExposedSideProvider, provideExposedSideProviderExisting, provideExposesStateProvider, provideExposesStateProviderExisting, provideTableClassesSettable, provideTableClassesSettableExisting, waitForElementAnimations };
146
160
  //# sourceMappingURL=spartan-ng-brain-core.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-core.mjs","sources":["../../../../libs/brain/core/src/helpers/computed-previous.ts","../../../../libs/brain/core/src/helpers/zone-free.ts","../../../../libs/brain/core/src/helpers/create-hover-observable.ts","../../../../libs/brain/core/src/helpers/create-injection-token.ts","../../../../libs/brain/core/src/helpers/custom-element-class-settable.ts","../../../../libs/brain/core/src/helpers/debounced-signal.ts","../../../../libs/brain/core/src/helpers/dev-mode.ts","../../../../libs/brain/core/src/helpers/exposes-side.ts","../../../../libs/brain/core/src/helpers/exposes-state.ts","../../../../libs/brain/core/src/helpers/table-classes-settable.ts","../../../../libs/brain/core/src/helpers/wait-for-element-animations.ts","../../../../libs/brain/core/src/spartan-ng-brain-core.ts"],"sourcesContent":["import { computed, type Signal, untracked } from '@angular/core';\n\n/**\n * Returns a signal that emits the previous value of the given signal.\n * The first time the signal is emitted, the previous value will be the same as the current value.\n *\n * @example\n * ```ts\n * const value = signal(0);\n * const previous = computedPrevious(value);\n *\n * effect(() => {\n * console.log('Current value:', value());\n * console.log('Previous value:', previous());\n * });\n *\n * Logs:\n * // Current value: 0\n * // Previous value: 0\n *\n * value.set(1);\n *\n * Logs:\n * // Current value: 1\n * // Previous value: 0\n *\n * value.set(2);\n *\n * Logs:\n * // Current value: 2\n * // Previous value: 1\n *```\n *\n * @param computation Signal to compute previous value for\n * @returns Signal that emits previous value of `s`\n */\nexport function computedPrevious<T>(computation: Signal<T>): Signal<T> {\n\tlet current = null as T;\n\tlet previous = untracked(() => computation()); // initial value is the current value\n\n\treturn computed(() => {\n\t\tcurrent = computation();\n\t\tconst result = previous;\n\t\tprevious = current;\n\t\treturn result;\n\t});\n}\n","/**\n * We are building on shoulders of giants here and use the implementation provided by the incredible TaigaUI\n * team: https://github.com/taiga-family/taiga-ui/blob/main/projects/cdk/observables/zone-free.ts#L22\n * Check them out! Give them a try! Leave a star! Their work is incredible!\n */\nimport type { NgZone } from '@angular/core';\nimport { type MonoTypeOperatorFunction, Observable, pipe } from 'rxjs';\n\nexport function brnZoneFull<T>(zone: NgZone): MonoTypeOperatorFunction<T> {\n\treturn (source) =>\n\t\tnew Observable((subscriber) =>\n\t\t\tsource.subscribe({\n\t\t\t\tnext: (value) => zone.run(() => subscriber.next(value)),\n\t\t\t\terror: (error: unknown) => zone.run(() => subscriber.error(error)),\n\t\t\t\tcomplete: () => zone.run(() => subscriber.complete()),\n\t\t\t}),\n\t\t);\n}\n\nexport function brnZoneFree<T>(zone: NgZone): MonoTypeOperatorFunction<T> {\n\treturn (source) => new Observable((subscriber) => zone.runOutsideAngular(() => source.subscribe(subscriber)));\n}\n\nexport function brnZoneOptimized<T>(zone: NgZone): MonoTypeOperatorFunction<T> {\n\treturn pipe(brnZoneFree(zone), brnZoneFull(zone));\n}\n","import type { NgZone } from '@angular/core';\nimport { type Observable, type Subject, fromEvent, merge } from 'rxjs';\nimport { distinctUntilChanged, filter, map, takeUntil } from 'rxjs/operators';\nimport { brnZoneOptimized } from './zone-free';\n\nfunction movedOut({ currentTarget, relatedTarget }: MouseEvent): boolean {\n\treturn !isElement(relatedTarget) || !isElement(currentTarget) || !currentTarget.contains(relatedTarget);\n}\n\nexport function isElement(node?: Element | EventTarget | Node | null): node is Element {\n\treturn !!node && 'nodeType' in node && node.nodeType === Node.ELEMENT_NODE;\n}\n\nexport const createHoverObservable = (\n\tnativeElement: HTMLElement,\n\tzone: NgZone,\n\tdestroyed$: Subject<void>,\n): Observable<{ hover: boolean; relatedTarget?: EventTarget | null }> => {\n\treturn merge(\n\t\tfromEvent(nativeElement, 'mouseenter').pipe(map(() => ({ hover: true }))),\n\t\tfromEvent<MouseEvent>(nativeElement, 'mouseleave').pipe(\n\t\t\tmap((e) => ({ hover: false, relatedTarget: e.relatedTarget })),\n\t\t),\n\t\t// Hello, Safari\n\t\tfromEvent<MouseEvent>(nativeElement, 'mouseout').pipe(\n\t\t\tfilter(movedOut),\n\t\t\tmap((e) => ({ hover: false, relatedTarget: e.relatedTarget })),\n\t\t),\n\t).pipe(distinctUntilChanged(), brnZoneOptimized(zone), takeUntil(destroyed$));\n};\n","import { type InjectOptions, InjectionToken, type Provider, type Type, forwardRef, inject } from '@angular/core';\n\ntype InjectFn<TTokenValue> = {\n\t(): TTokenValue;\n\t(injectOptions: InjectOptions & { optional?: false }): TTokenValue;\n\t(injectOptions: InjectOptions & { optional: true }): TTokenValue | null;\n};\n\ntype ProvideFn<TTokenValue> = (value: TTokenValue) => Provider;\n\ntype ProvideExistingFn<TTokenValue> = (valueFactory: () => Type<TTokenValue>) => Provider;\n\nexport type CreateInjectionTokenReturn<TTokenValue> = [\n\tInjectFn<TTokenValue>,\n\tProvideFn<TTokenValue>,\n\tProvideExistingFn<TTokenValue>,\n\tInjectionToken<TTokenValue>,\n];\n\nexport function createInjectionToken<TTokenValue>(description: string): CreateInjectionTokenReturn<TTokenValue> {\n\tconst token = new InjectionToken<TTokenValue>(description);\n\n\tconst provideFn = (value: TTokenValue) => {\n\t\treturn { provide: token, useValue: value };\n\t};\n\n\tconst provideExistingFn = (value: () => TTokenValue) => {\n\t\treturn { provide: token, useExisting: forwardRef(value) };\n\t};\n\n\tconst injectFn = (options: InjectOptions = {}) => {\n\t\treturn inject(token, options);\n\t};\n\n\treturn [injectFn, provideFn, provideExistingFn, token] as CreateInjectionTokenReturn<TTokenValue>;\n}\n","import { createInjectionToken } from './create-injection-token';\n\nexport interface CustomElementClassSettable {\n\tsetClassToCustomElement: (newClass: string) => void;\n}\n\nexport const [\n\tinjectCustomClassSettable,\n\tprovideCustomClassSettable,\n\tprovideCustomClassSettableExisting,\n\tSET_CLASS_TO_CUSTOM_ELEMENT_TOKEN,\n] = createInjectionToken<CustomElementClassSettable>('@spartan-ng SET_CLASS_TO_CUSTOM_ELEMENT_TOKEN');\n","import type { Signal } from '@angular/core';\nimport { toObservable, toSignal } from '@angular/core/rxjs-interop';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\n/**\n * Creates a debounced version of a source signal.\n *\n * @param source - The input signal to debounce.\n * @param delay - Debounce time in milliseconds.\n * @returns A new signal that updates only after the source has stopped changing for `delay` ms.\n */\nexport function debouncedSignal<T>(source: Signal<T>, delay: number): Signal<T> {\n\tconst source$ = toObservable(source);\n\n\tconst debounced$ = source$.pipe(debounceTime(delay), distinctUntilChanged());\n\n\treturn toSignal(debounced$, { initialValue: source() });\n}\n","declare const ngDevMode: boolean;\n/**\n * Set by Angular to true when in development mode.\n * Allows for tree-shaking code that is only used in development.\n */\nexport const brnDevMode = ngDevMode;\n","import type { Signal } from '@angular/core';\nimport { createInjectionToken } from './create-injection-token';\n\nexport interface ExposesSide {\n\tside: Signal<'top' | 'bottom' | 'left' | 'right'>;\n}\n\nexport const [\n\tinjectExposedSideProvider,\n\tprovideExposedSideProvider,\n\tprovideExposedSideProviderExisting,\n\tEXPOSES_SIDE_TOKEN,\n] = createInjectionToken<ExposesSide>('@spartan-ng EXPOSES_SIDE_TOKEN');\n","import type { Signal } from '@angular/core';\nimport { createInjectionToken } from './create-injection-token';\n\nexport interface ExposesState {\n\tstate: Signal<'open' | 'closed'>;\n}\n\nexport const [\n\tinjectExposesStateProvider,\n\tprovideExposesStateProvider,\n\tprovideExposesStateProviderExisting,\n\tEXPOSES_STATE_TOKEN,\n] = createInjectionToken<ExposesState>('@spartan-ng EXPOSES_STATE_TOKEN');\n","import { createInjectionToken } from './create-injection-token';\n\nexport interface TableClassesSettable {\n\tsetTableClasses: (classes: Partial<{ table: string; headerRow: string; bodyRow: string }>) => void;\n}\n\nexport const [\n\tinjectTableClassesSettable,\n\tprovideTableClassesSettable,\n\tprovideTableClassesSettableExisting,\n\tSET_TABLE_CLASSES_TOKEN,\n] = createInjectionToken<TableClassesSettable>('@spartan-ng SET_TABLE_CLASSES_TOKEN');\n","/**\n * Waits for all animations (including subtree) within the given element to finish.\n * Ignores animations canceled with an AbortError.\n */\nexport async function waitForElementAnimations(el: HTMLElement): Promise<void> {\n\t// Wait a tick to allow newly triggered animations to start\n\tawait new Promise<void>((resolve) => setTimeout(resolve, 0));\n\n\tconst animationFillMode = el.style.animationFillMode;\n\tconst animations = el.getAnimations({ subtree: true });\n\tel.style.animationFillMode = 'forwards';\n\n\tawait Promise.all(\n\t\tanimations.map((animation) =>\n\t\t\tanimation.finished.catch((err) => {\n\t\t\t\t// Ignore AbortError from canceled animations (treated as \"finished\")\n\t\t\t\tif (!(err instanceof Error && err.name === 'AbortError')) {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\n\t\t\t\treturn animation;\n\t\t\t}),\n\t\t),\n\t);\n\n\tsetTimeout(() => {\n\t\tif (el.style.animationFillMode === 'forwards') el.style.animationFillMode = animationFillMode;\n\t});\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AACG,SAAU,gBAAgB,CAAI,WAAsB,EAAA;IACzD,IAAI,OAAO,GAAG,IAAS;AACvB,IAAA,IAAI,QAAQ,GAAG,SAAS,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC;IAE9C,OAAO,QAAQ,CAAC,MAAK;QACpB,OAAO,GAAG,WAAW,EAAE;QACvB,MAAM,MAAM,GAAG,QAAQ;QACvB,QAAQ,GAAG,OAAO;AAClB,QAAA,OAAO,MAAM;AACd,KAAC,CAAC;AACH;;ACtCM,SAAU,WAAW,CAAI,IAAY,EAAA;AAC1C,IAAA,OAAO,CAAC,MAAM,KACb,IAAI,UAAU,CAAC,CAAC,UAAU,KACzB,MAAM,CAAC,SAAS,CAAC;AAChB,QAAA,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,GAAG,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACvD,QAAA,KAAK,EAAE,CAAC,KAAc,KAAK,IAAI,CAAC,GAAG,CAAC,MAAM,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,QAAA,QAAQ,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC;AACrD,KAAA,CAAC,CACF;AACH;AAEM,SAAU,WAAW,CAAI,IAAY,EAAA;AAC1C,IAAA,OAAO,CAAC,MAAM,KAAK,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GAAG,oBAAoB,CAAc,gCAAgC;;ACL/D,MAAM,CACZ,0BAA0B,EAC1B,2BAA2B,EAC3B,mCAAmC,EACnC,mBAAmB,EACnB,GAAG,oBAAoB,CAAe,iCAAiC;;ACNjE,MAAM,CACZ,0BAA0B,EAC1B,2BAA2B,EAC3B,mCAAmC,EACnC,uBAAuB,EACvB,GAAG,oBAAoB,CAAuB,qCAAqC;;ACXpF;;;AAGG;AACI,eAAe,wBAAwB,CAAC,EAAe,EAAA;;AAE7D,IAAA,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAE5D,IAAA,MAAM,iBAAiB,GAAG,EAAE,CAAC,KAAK,CAAC,iBAAiB;AACpD,IAAA,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACtD,IAAA,EAAE,CAAC,KAAK,CAAC,iBAAiB,GAAG,UAAU;IAEvC,MAAM,OAAO,CAAC,GAAG,CAChB,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,KACxB,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,KAAI;;AAEhC,QAAA,IAAI,EAAE,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE;AACzD,YAAA,MAAM,GAAG;;AAGV,QAAA,OAAO,SAAS;KAChB,CAAC,CACF,CACD;IAED,UAAU,CAAC,MAAK;AACf,QAAA,IAAI,EAAE,CAAC,KAAK,CAAC,iBAAiB,KAAK,UAAU;AAAE,YAAA,EAAE,CAAC,KAAK,CAAC,iBAAiB,GAAG,iBAAiB;AAC9F,KAAC,CAAC;AACH;;AC5BA;;AAEG;;;;"}
1
+ {"version":3,"file":"spartan-ng-brain-core.mjs","sources":["../../../../libs/brain/core/src/helpers/computed-previous.ts","../../../../libs/brain/core/src/helpers/zone-free.ts","../../../../libs/brain/core/src/helpers/create-hover-observable.ts","../../../../libs/brain/core/src/helpers/create-injection-token.ts","../../../../libs/brain/core/src/helpers/custom-element-class-settable.ts","../../../../libs/brain/core/src/helpers/debounced-signal.ts","../../../../libs/brain/core/src/helpers/dev-mode.ts","../../../../libs/brain/core/src/helpers/exposes-side.ts","../../../../libs/brain/core/src/helpers/exposes-state.ts","../../../../libs/brain/core/src/helpers/measure-dimensions.ts","../../../../libs/brain/core/src/helpers/table-classes-settable.ts","../../../../libs/brain/core/src/helpers/wait-for-element-animations.ts","../../../../libs/brain/core/src/spartan-ng-brain-core.ts"],"sourcesContent":["import { computed, type Signal, untracked } from '@angular/core';\n\n/**\n * Returns a signal that emits the previous value of the given signal.\n * The first time the signal is emitted, the previous value will be the same as the current value.\n *\n * @example\n * ```ts\n * const value = signal(0);\n * const previous = computedPrevious(value);\n *\n * effect(() => {\n * console.log('Current value:', value());\n * console.log('Previous value:', previous());\n * });\n *\n * Logs:\n * // Current value: 0\n * // Previous value: 0\n *\n * value.set(1);\n *\n * Logs:\n * // Current value: 1\n * // Previous value: 0\n *\n * value.set(2);\n *\n * Logs:\n * // Current value: 2\n * // Previous value: 1\n *```\n *\n * @param computation Signal to compute previous value for\n * @returns Signal that emits previous value of `s`\n */\nexport function computedPrevious<T>(computation: Signal<T>): Signal<T> {\n\tlet current = null as T;\n\tlet previous = untracked(() => computation()); // initial value is the current value\n\n\treturn computed(() => {\n\t\tcurrent = computation();\n\t\tconst result = previous;\n\t\tprevious = current;\n\t\treturn result;\n\t});\n}\n","/**\n * We are building on shoulders of giants here and use the implementation provided by the incredible TaigaUI\n * team: https://github.com/taiga-family/taiga-ui/blob/main/projects/cdk/observables/zone-free.ts#L22\n * Check them out! Give them a try! Leave a star! Their work is incredible!\n */\nimport type { NgZone } from '@angular/core';\nimport { type MonoTypeOperatorFunction, Observable, pipe } from 'rxjs';\n\nexport function brnZoneFull<T>(zone: NgZone): MonoTypeOperatorFunction<T> {\n\treturn (source) =>\n\t\tnew Observable((subscriber) =>\n\t\t\tsource.subscribe({\n\t\t\t\tnext: (value) => zone.run(() => subscriber.next(value)),\n\t\t\t\terror: (error: unknown) => zone.run(() => subscriber.error(error)),\n\t\t\t\tcomplete: () => zone.run(() => subscriber.complete()),\n\t\t\t}),\n\t\t);\n}\n\nexport function brnZoneFree<T>(zone: NgZone): MonoTypeOperatorFunction<T> {\n\treturn (source) => new Observable((subscriber) => zone.runOutsideAngular(() => source.subscribe(subscriber)));\n}\n\nexport function brnZoneOptimized<T>(zone: NgZone): MonoTypeOperatorFunction<T> {\n\treturn pipe(brnZoneFree(zone), brnZoneFull(zone));\n}\n","import type { NgZone } from '@angular/core';\nimport { type Observable, type Subject, fromEvent, merge } from 'rxjs';\nimport { distinctUntilChanged, filter, map, takeUntil } from 'rxjs/operators';\nimport { brnZoneOptimized } from './zone-free';\n\nfunction movedOut({ currentTarget, relatedTarget }: MouseEvent): boolean {\n\treturn !isElement(relatedTarget) || !isElement(currentTarget) || !currentTarget.contains(relatedTarget);\n}\n\nexport function isElement(node?: Element | EventTarget | Node | null): node is Element {\n\treturn !!node && 'nodeType' in node && node.nodeType === Node.ELEMENT_NODE;\n}\n\nexport const createHoverObservable = (\n\tnativeElement: HTMLElement,\n\tzone: NgZone,\n\tdestroyed$: Subject<void>,\n): Observable<{ hover: boolean; relatedTarget?: EventTarget | null }> => {\n\treturn merge(\n\t\tfromEvent(nativeElement, 'mouseenter').pipe(map(() => ({ hover: true }))),\n\t\tfromEvent<MouseEvent>(nativeElement, 'mouseleave').pipe(\n\t\t\tmap((e) => ({ hover: false, relatedTarget: e.relatedTarget })),\n\t\t),\n\t\t// Hello, Safari\n\t\tfromEvent<MouseEvent>(nativeElement, 'mouseout').pipe(\n\t\t\tfilter(movedOut),\n\t\t\tmap((e) => ({ hover: false, relatedTarget: e.relatedTarget })),\n\t\t),\n\t).pipe(distinctUntilChanged(), brnZoneOptimized(zone), takeUntil(destroyed$));\n};\n","import { type InjectOptions, InjectionToken, type Provider, type Type, forwardRef, inject } from '@angular/core';\n\ntype InjectFn<TTokenValue> = {\n\t(): TTokenValue;\n\t(injectOptions: InjectOptions & { optional?: false }): TTokenValue;\n\t(injectOptions: InjectOptions & { optional: true }): TTokenValue | null;\n};\n\ntype ProvideFn<TTokenValue> = (value: TTokenValue) => Provider;\n\ntype ProvideExistingFn<TTokenValue> = (valueFactory: () => Type<TTokenValue>) => Provider;\n\nexport type CreateInjectionTokenReturn<TTokenValue> = [\n\tInjectFn<TTokenValue>,\n\tProvideFn<TTokenValue>,\n\tProvideExistingFn<TTokenValue>,\n\tInjectionToken<TTokenValue>,\n];\n\nexport function createInjectionToken<TTokenValue>(description: string): CreateInjectionTokenReturn<TTokenValue> {\n\tconst token = new InjectionToken<TTokenValue>(description);\n\n\tconst provideFn = (value: TTokenValue) => {\n\t\treturn { provide: token, useValue: value };\n\t};\n\n\tconst provideExistingFn = (value: () => TTokenValue) => {\n\t\treturn { provide: token, useExisting: forwardRef(value) };\n\t};\n\n\tconst injectFn = (options: InjectOptions = {}) => {\n\t\treturn inject(token, options);\n\t};\n\n\treturn [injectFn, provideFn, provideExistingFn, token] as CreateInjectionTokenReturn<TTokenValue>;\n}\n","import { createInjectionToken } from './create-injection-token';\n\nexport interface CustomElementClassSettable {\n\tsetClassToCustomElement: (newClass: string) => void;\n}\n\nexport const [\n\tinjectCustomClassSettable,\n\tprovideCustomClassSettable,\n\tprovideCustomClassSettableExisting,\n\tSET_CLASS_TO_CUSTOM_ELEMENT_TOKEN,\n] = createInjectionToken<CustomElementClassSettable>('@spartan-ng SET_CLASS_TO_CUSTOM_ELEMENT_TOKEN');\n","import type { Signal } from '@angular/core';\nimport { toObservable, toSignal } from '@angular/core/rxjs-interop';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\n/**\n * Creates a debounced version of a source signal.\n *\n * @param source - The input signal to debounce.\n * @param delay - Debounce time in milliseconds.\n * @returns A new signal that updates only after the source has stopped changing for `delay` ms.\n */\nexport function debouncedSignal<T>(source: Signal<T>, delay: number): Signal<T> {\n\tconst source$ = toObservable(source);\n\n\tconst debounced$ = source$.pipe(debounceTime(delay), distinctUntilChanged());\n\n\treturn toSignal(debounced$, { initialValue: source() });\n}\n","declare const ngDevMode: boolean;\n/**\n * Set by Angular to true when in development mode.\n * Allows for tree-shaking code that is only used in development.\n */\nexport const brnDevMode = ngDevMode;\n","import type { Signal } from '@angular/core';\nimport { createInjectionToken } from './create-injection-token';\n\nexport interface ExposesSide {\n\tside: Signal<'top' | 'bottom' | 'left' | 'right'>;\n}\n\nexport const [\n\tinjectExposedSideProvider,\n\tprovideExposedSideProvider,\n\tprovideExposedSideProviderExisting,\n\tEXPOSES_SIDE_TOKEN,\n] = createInjectionToken<ExposesSide>('@spartan-ng EXPOSES_SIDE_TOKEN');\n","import type { Signal } from '@angular/core';\nimport { createInjectionToken } from './create-injection-token';\n\nexport interface ExposesState {\n\tstate: Signal<'open' | 'closed'>;\n}\n\nexport const [\n\tinjectExposesStateProvider,\n\tprovideExposesStateProvider,\n\tprovideExposesStateProviderExisting,\n\tEXPOSES_STATE_TOKEN,\n] = createInjectionToken<ExposesState>('@spartan-ng EXPOSES_STATE_TOKEN');\n","export type MeasurementDisplay = 'block' | 'inline-block' | 'flex' | 'grid' | 'table' | 'contents' | (string & {});\n\nexport const measureDimensions = (elementToMeasure: HTMLElement, measurementDisplay: MeasurementDisplay) => {\n\tconst previousHeight = elementToMeasure.style.height;\n\tconst previousDisplay = elementToMeasure.style.display;\n\tconst previousHidden = elementToMeasure.hidden;\n\n\telementToMeasure.hidden = false;\n\telementToMeasure.style.height = 'auto';\n\telementToMeasure.style.display = previousDisplay === 'hidden' ? measurementDisplay : previousDisplay;\n\n\tconst { width, height } = elementToMeasure.getBoundingClientRect();\n\n\telementToMeasure.hidden = previousHidden;\n\telementToMeasure.style.display = previousDisplay;\n\telementToMeasure.style.height = previousHeight;\n\n\treturn { width, height };\n};\n","import { createInjectionToken } from './create-injection-token';\n\nexport interface TableClassesSettable {\n\tsetTableClasses: (classes: Partial<{ table: string; headerRow: string; bodyRow: string }>) => void;\n}\n\nexport const [\n\tinjectTableClassesSettable,\n\tprovideTableClassesSettable,\n\tprovideTableClassesSettableExisting,\n\tSET_TABLE_CLASSES_TOKEN,\n] = createInjectionToken<TableClassesSettable>('@spartan-ng SET_TABLE_CLASSES_TOKEN');\n","/**\n * Waits for all animations (including subtree) within the given element to finish.\n * Ignores animations canceled with an AbortError.\n */\nexport async function waitForElementAnimations(el: HTMLElement): Promise<void> {\n\t// Wait a tick to allow newly triggered animations to start\n\tawait new Promise<void>((resolve) => setTimeout(resolve, 0));\n\n\tconst animationFillMode = el.style.animationFillMode;\n\tconst animations = el.getAnimations({ subtree: true });\n\tel.style.animationFillMode = 'forwards';\n\n\tawait Promise.all(\n\t\tanimations.map((animation) =>\n\t\t\tanimation.finished.catch((err) => {\n\t\t\t\t// Ignore AbortError from canceled animations (treated as \"finished\")\n\t\t\t\tif (!(err instanceof Error && err.name === 'AbortError')) {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\n\t\t\t\treturn animation;\n\t\t\t}),\n\t\t),\n\t);\n\n\tsetTimeout(() => {\n\t\tif (el.style.animationFillMode === 'forwards') el.style.animationFillMode = animationFillMode;\n\t});\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AACG,SAAU,gBAAgB,CAAI,WAAsB,EAAA;IACzD,IAAI,OAAO,GAAG,IAAS;AACvB,IAAA,IAAI,QAAQ,GAAG,SAAS,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC;IAE9C,OAAO,QAAQ,CAAC,MAAK;QACpB,OAAO,GAAG,WAAW,EAAE;QACvB,MAAM,MAAM,GAAG,QAAQ;QACvB,QAAQ,GAAG,OAAO;AAClB,QAAA,OAAO,MAAM;AACd,KAAC,CAAC;AACH;;ACtCM,SAAU,WAAW,CAAI,IAAY,EAAA;AAC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"sideEffects": false,
5
5
  "exports": {
6
6
  "./hlm-tailwind-preset": {