@spartan-ng/brain 0.0.1-alpha.538 → 0.0.1-alpha.539

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.
@@ -11,6 +11,5 @@ export * from './lib/brn-autocomplete-item';
11
11
  export * from './lib/brn-autocomplete-item.token';
12
12
  export * from './lib/brn-autocomplete-list';
13
13
  export * from './lib/brn-autocomplete-search-input';
14
- export * from './lib/brn-autocomplete-search-input.token';
15
14
  export * from './lib/brn-autocomplete.token';
16
15
  export declare const BrnAutocompleteImports: readonly [typeof BrnAutocomplete, typeof BrnAutocompleteEmpty, typeof BrnAutocompleteGroup, typeof BrnAutocompleteItem, typeof BrnAutocompleteList, typeof BrnAutocompleteSearchInput];
@@ -1,24 +1,13 @@
1
- import { ElementRef, Renderer2 } from '@angular/core';
2
- import { DefaultValueAccessor } from '@angular/forms';
3
1
  import * as i0 from "@angular/core";
4
- export declare class BrnAutocompleteSearchInput extends DefaultValueAccessor {
5
- private readonly elementRef;
2
+ export declare class BrnAutocompleteSearchInput {
6
3
  private readonly _autocomplete;
7
- /** The initial value of the search input */
8
- readonly value: import("@angular/core").ModelSignal<string>;
9
- /** Emitted when the value changes */
10
- readonly valueChange: import("@angular/core").OutputEmitterRef<string>;
11
4
  /** Whether the autocomplete panel is expanded */
12
5
  protected readonly _isExpanded: import("@angular/core").Signal<boolean>;
13
6
  /** The id of the active option */
14
7
  protected readonly _activeDescendant: import("@angular/core").WritableSignal<string | undefined>;
15
- constructor(renderer: Renderer2, elementRef: ElementRef, compositionMode: boolean);
16
- /** Listen for changes to the input value */
17
- protected onInput(): void;
8
+ constructor();
18
9
  /** Listen for keydown events */
19
10
  protected onKeyDown(event: KeyboardEvent): void;
20
- /** CONROL VALUE ACCESSOR */
21
- writeValue(value: string | null): void;
22
- static ɵfac: i0.ɵɵFactoryDeclaration<BrnAutocompleteSearchInput, [null, null, { optional: true; }]>;
23
- static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAutocompleteSearchInput, "input[brnAutocompleteSearchInput]", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "valueChange": "valueChange"; }, never, never, true, never>;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<BrnAutocompleteSearchInput, never>;
12
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAutocompleteSearchInput, "input[brnAutocompleteSearchInput]", never, {}, {}, never, never, true, never>;
24
13
  }
@@ -8,12 +8,10 @@ export declare class BrnAutocomplete<T> {
8
8
  readonly id: import("@angular/core").InputSignal<string>;
9
9
  /** when the selection has changed */
10
10
  readonly valueChange: import("@angular/core").OutputEmitterRef<T>;
11
- /** @internal The search query */
12
- readonly search: import("@angular/core").Signal<string>;
11
+ /** when the selection has been cleared */
12
+ readonly selectionCleared: import("@angular/core").OutputEmitterRef<void>;
13
13
  /** Access the popover if present */
14
14
  private readonly _brnPopover;
15
- /** Access the search input if present */
16
- private readonly _searchInput;
17
15
  /** @internal The focus strategy when opening */
18
16
  private readonly _focus;
19
17
  /** @internal Access all the items within the autocomplete */
@@ -28,5 +26,5 @@ export declare class BrnAutocomplete<T> {
28
26
  close(): void;
29
27
  toggle(): void;
30
28
  static ɵfac: i0.ɵɵFactoryDeclaration<BrnAutocomplete<any>, never>;
31
- static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAutocomplete<any>, "[brnAutocomplete]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; }, ["_searchInput", "items"], never, true, never>;
29
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAutocomplete<any>, "[brnAutocomplete]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "selectionCleared": "selectionCleared"; }, ["items"], never, true, never>;
32
30
  }
@@ -0,0 +1,9 @@
1
+ import type { Signal } from '@angular/core';
2
+ /**
3
+ * Creates a debounced version of a source signal.
4
+ *
5
+ * @param source - The input signal to debounce.
6
+ * @param delay - Debounce time in milliseconds.
7
+ * @returns A new signal that updates only after the source has stopped changing for `delay` ms.
8
+ */
9
+ export declare function debouncedSignal<T>(source: Signal<T>, delay: number): Signal<T>;
package/core/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './helpers/computed-previous';
2
2
  export * from './helpers/create-hover-observable';
3
3
  export * from './helpers/custom-element-class-settable';
4
+ export * from './helpers/debounced-signal';
4
5
  export * from './helpers/dev-mode';
5
6
  export * from './helpers/exposes-side';
6
7
  export * from './helpers/exposes-state';
@@ -1,22 +1,16 @@
1
1
  import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
2
2
  import * as i0 from '@angular/core';
3
- import { InjectionToken, inject, model, output, signal, effect, forwardRef, Optional, Inject, Directive, Injector, input, computed, contentChild, contentChildren, untracked, TemplateRef, ViewContainerRef, PLATFORM_ID, ElementRef, booleanAttribute } from '@angular/core';
3
+ import { InjectionToken, inject, Injector, input, output, signal, contentChildren, computed, effect, untracked, Directive, TemplateRef, ViewContainerRef, PLATFORM_ID, ElementRef, booleanAttribute } from '@angular/core';
4
4
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
5
  import { BrnPopover } from '@spartan-ng/brain/popover';
6
- import { DefaultValueAccessor, COMPOSITION_BUFFER_MODE, NG_VALUE_ACCESSOR } from '@angular/forms';
7
- import { startWith } from 'rxjs/operators';
8
6
  import { isPlatformBrowser } from '@angular/common';
7
+ import { startWith } from 'rxjs/operators';
9
8
 
10
9
  const BrnAutocompleteItemToken = new InjectionToken('BrnAutocompleteItemToken');
11
10
  function provideBrnAutocompleteItem(autocomplete) {
12
11
  return { provide: BrnAutocompleteItemToken, useExisting: autocomplete };
13
12
  }
14
13
 
15
- const BrnAutocompleteSearchInputToken = new InjectionToken('BrnAutocompleteSearchInputToken');
16
- function provideBrnAutocompleteSearchInput(autocomplete) {
17
- return { provide: BrnAutocompleteSearchInputToken, useExisting: autocomplete };
18
- }
19
-
20
14
  const BrnAutocompleteToken = new InjectionToken('BrnAutocompleteToken');
21
15
  function provideBrnAutocomplete(autocomplete) {
22
16
  return { provide: BrnAutocompleteToken, useExisting: autocomplete };
@@ -25,97 +19,6 @@ function injectBrnAutocomplete() {
25
19
  return inject(BrnAutocompleteToken);
26
20
  }
27
21
 
28
- class BrnAutocompleteSearchInput extends DefaultValueAccessor {
29
- elementRef;
30
- _autocomplete = injectBrnAutocomplete();
31
- /** The initial value of the search input */
32
- value = model('');
33
- /** Emitted when the value changes */
34
- valueChange = output();
35
- /** Whether the autocomplete panel is expanded */
36
- _isExpanded = this._autocomplete.isExpanded;
37
- /** The id of the active option */
38
- _activeDescendant = signal(undefined);
39
- constructor(renderer, elementRef, compositionMode) {
40
- super(renderer, elementRef, compositionMode);
41
- this.elementRef = elementRef;
42
- this._autocomplete.keyManager.change
43
- .pipe(startWith(this._autocomplete.keyManager.activeItemIndex), takeUntilDestroyed())
44
- .subscribe(() => this._activeDescendant.set(this._autocomplete.keyManager.activeItem?.id()));
45
- effect(() => {
46
- const value = this.value();
47
- this.elementRef.nativeElement.value = value;
48
- this.valueChange.emit(value);
49
- });
50
- }
51
- /** Listen for changes to the input value */
52
- onInput() {
53
- this.value.set(this.elementRef.nativeElement.value);
54
- }
55
- /** Listen for keydown events */
56
- onKeyDown(event) {
57
- if (event.key === 'Enter') {
58
- // prevent form submission if inside a form
59
- event.preventDefault();
60
- }
61
- if (!this._isExpanded()) {
62
- if (event.key === 'ArrowDown') {
63
- this._autocomplete.open('first');
64
- }
65
- if (event.key === 'ArrowUp') {
66
- this._autocomplete.open('last');
67
- }
68
- if (event.key === 'Escape') {
69
- this.value.set('');
70
- }
71
- }
72
- this._autocomplete.keyManager.onKeydown(event);
73
- }
74
- /** CONROL VALUE ACCESSOR */
75
- writeValue(value) {
76
- super.writeValue(value);
77
- if (value) {
78
- this.value.set(value);
79
- }
80
- }
81
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAutocompleteSearchInput, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: COMPOSITION_BUFFER_MODE, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
82
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnAutocompleteSearchInput, isStandalone: true, selector: "input[brnAutocompleteSearchInput]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange" }, host: { attributes: { "role": "combobox", "aria-autocomplete": "list" }, listeners: { "keydown": "onKeyDown($event)", "input": "onInput()" }, properties: { "attr.aria-activedescendant": "_activeDescendant()", "attr.aria-expanded": "_isExpanded()" } }, providers: [
83
- provideBrnAutocompleteSearchInput(BrnAutocompleteSearchInput),
84
- {
85
- provide: NG_VALUE_ACCESSOR,
86
- useExisting: forwardRef((() => BrnAutocompleteSearchInput)),
87
- multi: true,
88
- },
89
- ], usesInheritance: true, ngImport: i0 });
90
- }
91
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAutocompleteSearchInput, decorators: [{
92
- type: Directive,
93
- args: [{
94
- selector: 'input[brnAutocompleteSearchInput]',
95
- providers: [
96
- provideBrnAutocompleteSearchInput(BrnAutocompleteSearchInput),
97
- {
98
- provide: NG_VALUE_ACCESSOR,
99
- useExisting: forwardRef((() => BrnAutocompleteSearchInput)),
100
- multi: true,
101
- },
102
- ],
103
- host: {
104
- role: 'combobox',
105
- 'aria-autocomplete': 'list',
106
- '[attr.aria-activedescendant]': '_activeDescendant()',
107
- '[attr.aria-expanded]': '_isExpanded()',
108
- '(keydown)': 'onKeyDown($event)',
109
- '(input)': 'onInput()',
110
- },
111
- }]
112
- }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: undefined, decorators: [{
113
- type: Optional
114
- }, {
115
- type: Inject,
116
- args: [COMPOSITION_BUFFER_MODE]
117
- }] }] });
118
-
119
22
  class BrnAutocomplete {
120
23
  static _id = 0;
121
24
  _injector = inject(Injector);
@@ -123,14 +26,10 @@ class BrnAutocomplete {
123
26
  id = input(`brn-autocomplete-${++BrnAutocomplete._id}`);
124
27
  /** when the selection has changed */
125
28
  valueChange = output();
126
- /** @internal The search query */
127
- search = computed(() => this._searchInput()?.value() ?? '');
29
+ /** when the selection has been cleared */
30
+ selectionCleared = output();
128
31
  /** Access the popover if present */
129
32
  _brnPopover = inject(BrnPopover, { optional: true });
130
- /** Access the search input if present */
131
- _searchInput = contentChild(BrnAutocompleteSearchInput, {
132
- descendants: true,
133
- });
134
33
  /** @internal The focus strategy when opening */
135
34
  _focus = signal('first');
136
35
  /** @internal Access all the items within the autocomplete */
@@ -182,7 +81,7 @@ class BrnAutocomplete {
182
81
  this.isExpanded() ? this.close() : this.open();
183
82
  }
184
83
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Directive });
185
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnAutocomplete, isStandalone: true, selector: "[brnAutocomplete]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "keydown.enter": "selectActiveItem()" }, properties: { "id": "id()" } }, providers: [provideBrnAutocomplete(BrnAutocomplete)], queries: [{ propertyName: "_searchInput", first: true, predicate: BrnAutocompleteSearchInput, descendants: true, isSignal: true }, { propertyName: "items", predicate: BrnAutocompleteItemToken, descendants: true, isSignal: true }], ngImport: i0 });
84
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnAutocomplete, isStandalone: true, selector: "[brnAutocomplete]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", selectionCleared: "selectionCleared" }, host: { listeners: { "keydown.enter": "selectActiveItem()" }, properties: { "id": "id()" } }, providers: [provideBrnAutocomplete(BrnAutocomplete)], queries: [{ propertyName: "items", predicate: BrnAutocompleteItemToken, descendants: true, isSignal: true }], ngImport: i0 });
186
85
  }
187
86
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAutocomplete, decorators: [{
188
87
  type: Directive,
@@ -332,6 +231,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
332
231
  }]
333
232
  }] });
334
233
 
234
+ class BrnAutocompleteSearchInput {
235
+ _autocomplete = injectBrnAutocomplete();
236
+ /** Whether the autocomplete panel is expanded */
237
+ _isExpanded = this._autocomplete.isExpanded;
238
+ /** The id of the active option */
239
+ _activeDescendant = signal(undefined);
240
+ constructor() {
241
+ this._autocomplete.keyManager.change
242
+ .pipe(startWith(this._autocomplete.keyManager.activeItemIndex), takeUntilDestroyed())
243
+ .subscribe(() => {
244
+ this._activeDescendant.set(this._autocomplete.keyManager.activeItem?.id());
245
+ });
246
+ }
247
+ /** Listen for keydown events */
248
+ onKeyDown(event) {
249
+ if (event.key === 'Enter') {
250
+ // prevent form submission if inside a form
251
+ event.preventDefault();
252
+ }
253
+ if (!this._isExpanded()) {
254
+ if (event.key === 'ArrowDown') {
255
+ this._autocomplete.open('first');
256
+ }
257
+ if (event.key === 'ArrowUp') {
258
+ this._autocomplete.open('last');
259
+ }
260
+ if (event.key === 'Escape') {
261
+ this._autocomplete.selectionCleared.emit();
262
+ }
263
+ }
264
+ this._autocomplete.keyManager.onKeydown(event);
265
+ }
266
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAutocompleteSearchInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
267
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnAutocompleteSearchInput, isStandalone: true, selector: "input[brnAutocompleteSearchInput]", host: { attributes: { "role": "combobox", "aria-autocomplete": "list" }, listeners: { "keydown": "onKeyDown($event)" }, properties: { "attr.aria-activedescendant": "_activeDescendant()", "attr.aria-expanded": "_isExpanded()" } }, ngImport: i0 });
268
+ }
269
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAutocompleteSearchInput, decorators: [{
270
+ type: Directive,
271
+ args: [{
272
+ selector: 'input[brnAutocompleteSearchInput]',
273
+ host: {
274
+ role: 'combobox',
275
+ 'aria-autocomplete': 'list',
276
+ '[attr.aria-activedescendant]': '_activeDescendant()',
277
+ '[attr.aria-expanded]': '_isExpanded()',
278
+ '(keydown)': 'onKeyDown($event)',
279
+ },
280
+ }]
281
+ }], ctorParameters: () => [] });
282
+
335
283
  const BrnAutocompleteImports = [
336
284
  BrnAutocomplete,
337
285
  BrnAutocompleteEmpty,
@@ -345,5 +293,5 @@ const BrnAutocompleteImports = [
345
293
  * Generated bundle index. Do not edit.
346
294
  */
347
295
 
348
- export { BrnAutocomplete, BrnAutocompleteEmpty, BrnAutocompleteGroup, BrnAutocompleteImports, BrnAutocompleteItem, BrnAutocompleteItemToken, BrnAutocompleteList, BrnAutocompleteSearchInput, BrnAutocompleteSearchInputToken, BrnAutocompleteToken, injectBrnAutocomplete, provideBrnAutocomplete, provideBrnAutocompleteItem, provideBrnAutocompleteSearchInput };
296
+ export { BrnAutocomplete, BrnAutocompleteEmpty, BrnAutocompleteGroup, BrnAutocompleteImports, BrnAutocompleteItem, BrnAutocompleteItemToken, BrnAutocompleteList, BrnAutocompleteSearchInput, BrnAutocompleteToken, injectBrnAutocomplete, provideBrnAutocomplete, provideBrnAutocompleteItem };
349
297
  //# sourceMappingURL=spartan-ng-brain-autocomplete.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-autocomplete.mjs","sources":["../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-item.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-search-input.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-search-input.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-empty.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-group.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-item.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-list.ts","../../../../libs/brain/autocomplete/src/index.ts","../../../../libs/brain/autocomplete/src/spartan-ng-brain-autocomplete.ts"],"sourcesContent":["import { type ExistingProvider, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocompleteItem } from './brn-autocomplete-item';\n\nexport const BrnAutocompleteItemToken = new InjectionToken<BrnAutocompleteItem<unknown>>('BrnAutocompleteItemToken');\n\nexport function provideBrnAutocompleteItem<T>(autocomplete: Type<BrnAutocompleteItem<T>>): ExistingProvider {\n\treturn { provide: BrnAutocompleteItemToken, useExisting: autocomplete };\n}\n","import { type ExistingProvider, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocompleteSearchInput } from './brn-autocomplete-search-input';\n\nexport const BrnAutocompleteSearchInputToken = new InjectionToken<BrnAutocompleteSearchInput>(\n\t'BrnAutocompleteSearchInputToken',\n);\n\nexport function provideBrnAutocompleteSearchInput(autocomplete: Type<BrnAutocompleteSearchInput>): ExistingProvider {\n\treturn { provide: BrnAutocompleteSearchInputToken, useExisting: autocomplete };\n}\n","import { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocomplete } from './brn-autocomplete';\n\nexport const BrnAutocompleteToken = new InjectionToken<BrnAutocomplete<unknown>>('BrnAutocompleteToken');\n\nexport function provideBrnAutocomplete<T>(autocomplete: Type<BrnAutocomplete<T>>): ExistingProvider {\n\treturn { provide: BrnAutocompleteToken, useExisting: autocomplete };\n}\n\nexport function injectBrnAutocomplete<T>(): BrnAutocomplete<T> {\n\treturn inject(BrnAutocompleteToken) as BrnAutocomplete<T>;\n}\n","import {\n\tDirective,\n\teffect,\n\tElementRef,\n\tforwardRef,\n\tInject,\n\tmodel,\n\tOptional,\n\toutput,\n\tRenderer2,\n\tsignal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { COMPOSITION_BUFFER_MODE, DefaultValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { startWith } from 'rxjs/operators';\nimport { provideBrnAutocompleteSearchInput } from './brn-autocomplete-search-input.token';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: 'input[brnAutocompleteSearchInput]',\n\tproviders: [\n\t\tprovideBrnAutocompleteSearchInput(BrnAutocompleteSearchInput),\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: forwardRef(() => BrnAutocompleteSearchInput),\n\t\t\tmulti: true,\n\t\t},\n\t],\n\thost: {\n\t\trole: 'combobox',\n\t\t'aria-autocomplete': 'list',\n\t\t'[attr.aria-activedescendant]': '_activeDescendant()',\n\t\t'[attr.aria-expanded]': '_isExpanded()',\n\t\t'(keydown)': 'onKeyDown($event)',\n\t\t'(input)': 'onInput()',\n\t},\n})\nexport class BrnAutocompleteSearchInput extends DefaultValueAccessor {\n\tprivate readonly _autocomplete = injectBrnAutocomplete();\n\n\t/** The initial value of the search input */\n\tpublic readonly value = model<string>('');\n\n\t/** Emitted when the value changes */\n\tpublic readonly valueChange = output<string>();\n\n\t/** Whether the autocomplete panel is expanded */\n\tprotected readonly _isExpanded = this._autocomplete.isExpanded;\n\n\t/** The id of the active option */\n\tprotected readonly _activeDescendant = signal<string | undefined>(undefined);\n\n\tconstructor(\n\t\trenderer: Renderer2,\n\t\tprivate readonly elementRef: ElementRef,\n\t\t@Optional() @Inject(COMPOSITION_BUFFER_MODE) compositionMode: boolean,\n\t) {\n\t\tsuper(renderer, elementRef, compositionMode);\n\t\tthis._autocomplete.keyManager.change\n\t\t\t.pipe(startWith(this._autocomplete.keyManager.activeItemIndex), takeUntilDestroyed())\n\t\t\t.subscribe(() => this._activeDescendant.set(this._autocomplete.keyManager.activeItem?.id()));\n\n\t\teffect(() => {\n\t\t\tconst value = this.value();\n\t\t\tthis.elementRef.nativeElement.value = value;\n\t\t\tthis.valueChange.emit(value);\n\t\t});\n\t}\n\t/** Listen for changes to the input value */\n\tprotected onInput(): void {\n\t\tthis.value.set(this.elementRef.nativeElement.value);\n\t}\n\n\t/** Listen for keydown events */\n\tprotected onKeyDown(event: KeyboardEvent): void {\n\t\tif (event.key === 'Enter') {\n\t\t\t// prevent form submission if inside a form\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tif (!this._isExpanded()) {\n\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\tthis._autocomplete.open('first');\n\t\t\t}\n\n\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\tthis._autocomplete.open('last');\n\t\t\t}\n\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\tthis.value.set('');\n\t\t\t}\n\t\t}\n\n\t\tthis._autocomplete.keyManager.onKeydown(event);\n\t}\n\n\t/** CONROL VALUE ACCESSOR */\n\toverride writeValue(value: string | null): void {\n\t\tsuper.writeValue(value);\n\t\tif (value) {\n\t\t\tthis.value.set(value);\n\t\t}\n\t}\n}\n","import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';\nimport {\n\tcomputed,\n\tcontentChild,\n\tcontentChildren,\n\tDirective,\n\teffect,\n\tinject,\n\tInjector,\n\tinput,\n\toutput,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { BrnPopover } from '@spartan-ng/brain/popover';\nimport type { BrnAutocompleteItem } from './brn-autocomplete-item';\nimport { BrnAutocompleteItemToken } from './brn-autocomplete-item.token';\nimport { BrnAutocompleteSearchInput } from './brn-autocomplete-search-input';\nimport { provideBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: '[brnAutocomplete]',\n\tproviders: [provideBrnAutocomplete(BrnAutocomplete)],\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'(keydown.enter)': 'selectActiveItem()',\n\t},\n})\nexport class BrnAutocomplete<T> {\n\tprivate static _id = 0;\n\n\tprivate readonly _injector = inject(Injector);\n\n\t/** The id of the autocomplete */\n\tpublic readonly id = input<string>(`brn-autocomplete-${++BrnAutocomplete._id}`);\n\n\t/** when the selection has changed */\n\tpublic readonly valueChange = output<T>();\n\n\t/** @internal The search query */\n\tpublic readonly search = computed(() => this._searchInput()?.value() ?? '');\n\n\t/** Access the popover if present */\n\tprivate readonly _brnPopover = inject(BrnPopover, { optional: true });\n\n\t/** Access the search input if present */\n\tprivate readonly _searchInput = contentChild(BrnAutocompleteSearchInput, {\n\t\tdescendants: true,\n\t});\n\n\t/** @internal The focus strategy when opening */\n\tprivate readonly _focus = signal<'first' | 'last'>('first');\n\n\t/** @internal Access all the items within the autocomplete */\n\tpublic readonly items = contentChildren<BrnAutocompleteItem<T>>(BrnAutocompleteItemToken, {\n\t\tdescendants: true,\n\t});\n\n\t/** @internal The key manager for managing active descendant */\n\tpublic readonly keyManager = new ActiveDescendantKeyManager(this.items, this._injector);\n\n\t/** @internal Whether the autocomplete is expanded */\n\tpublic readonly isExpanded = computed(() => this._brnPopover?.stateComputed() === 'open');\n\n\tconstructor() {\n\t\tthis.keyManager\n\t\t\t.withVerticalOrientation()\n\t\t\t.withHomeAndEnd()\n\t\t\t.withWrap()\n\t\t\t.skipPredicate((item) => item.disabled);\n\n\t\teffect(() => {\n\t\t\tconst items = this.items();\n\t\t\tconst focus = this._focus();\n\n\t\t\tuntracked(() => {\n\t\t\t\tif (!items.length) return;\n\n\t\t\t\tconst activeItem = this.keyManager.activeItem;\n\n\t\t\t\tif (!activeItem || !items.includes(activeItem)) {\n\t\t\t\t\tfocus === 'first' ? this.keyManager.setFirstItemActive() : this.keyManager.setLastItemActive();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tthis.keyManager.change.pipe(takeUntilDestroyed()).subscribe(() => {\n\t\t\tconst value = this.keyManager.activeItem?.value();\n\t\t\tif (value) {\n\t\t\t\tthis.valueChange.emit(value);\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected selectActiveItem(): void {\n\t\tif (this._brnPopover?.stateComputed() === 'open') {\n\t\t\tthis.keyManager.activeItem?.selected.emit();\n\t\t}\n\t}\n\n\topen(focus: 'first' | 'last' = 'first') {\n\t\tthis._brnPopover?.open();\n\t\tthis._focus.set(focus);\n\t}\n\n\tclose() {\n\t\tthis._brnPopover?.close();\n\t}\n\n\ttoggle() {\n\t\tthis.isExpanded() ? this.close() : this.open();\n\t}\n}\n","import { computed, Directive, effect, inject, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: '[brnAutocompleteEmpty]',\n})\nexport class BrnAutocompleteEmpty {\n\tprivate readonly _templateRef = inject<TemplateRef<void>>(TemplateRef);\n\tprivate readonly _viewContainerRef = inject(ViewContainerRef);\n\tprivate readonly _autocomplete = injectBrnAutocomplete();\n\n\t/** Determine if the autocomplete has any items */\n\tprivate readonly _visible = computed(() => this._autocomplete.items().length > 0);\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tif (this._visible()) {\n\t\t\t\tthis._viewContainerRef.clear();\n\t\t\t} else {\n\t\t\t\tthis._viewContainerRef.createEmbeddedView(this._templateRef);\n\t\t\t}\n\t\t});\n\t}\n}\n","import { Directive, input } from '@angular/core';\n\n@Directive({\n\tselector: '[brnAutocompleteGroup]',\n\thost: {\n\t\trole: 'group',\n\t\t'[id]': 'id()',\n\t},\n})\nexport class BrnAutocompleteGroup {\n\tprivate static _id = 0;\n\n\t/** The id of the autocomplete list */\n\tpublic readonly id = input<string>(`brn-autocomplete-group-${++BrnAutocompleteGroup._id}`);\n}\n","import type { Highlightable } from '@angular/cdk/a11y';\nimport type { BooleanInput } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport { booleanAttribute, Directive, ElementRef, inject, input, output, PLATFORM_ID, signal } from '@angular/core';\nimport { provideBrnAutocompleteItem } from './brn-autocomplete-item.token';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: 'button[brnAutocompleteItem]',\n\tproviders: [provideBrnAutocompleteItem(BrnAutocompleteItem)],\n\thost: {\n\t\ttype: 'button',\n\t\trole: 'option',\n\t\ttabIndex: '-1',\n\t\t'[id]': 'id()',\n\t\t'[attr.disabled]': '_disabled() ? true : null',\n\t\t'[attr.data-disabled]': '_disabled() ? \"\" : null',\n\t\t'[attr.data-value]': 'value()',\n\t\t'[attr.aria-selected]': '_active()',\n\t\t'[attr.data-selected]': \"_active() ? '' : null\",\n\t\t'(click)': 'onClick()',\n\t\t'(mouseenter)': 'activate()',\n\t},\n})\nexport class BrnAutocompleteItem<T> implements Highlightable {\n\tprivate static _id = 0;\n\n\tprivate readonly _platform = inject(PLATFORM_ID);\n\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n\t/** Access the autocomplete component */\n\tprivate readonly _autocomplete = injectBrnAutocomplete<T>();\n\n\t/** A unique id for the item */\n\tpublic readonly id = input(`brn-autocomplete-item-${++BrnAutocompleteItem._id}`);\n\n\t/** The value this item represents. */\n\tpublic readonly value = input.required<T>();\n\n\t/** Whether the item is disabled. */\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tpublic readonly _disabled = input<boolean, BooleanInput>(false, {\n\t\talias: 'disabled',\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** Expose disabled as a value - used by the Highlightable interface */\n\tpublic get disabled() {\n\t\treturn this._disabled();\n\t}\n\n\t/** Whether the item is selected. */\n\tprotected readonly _active = signal(false);\n\n\t/** Emits when the item is selected. */\n\tpublic readonly selected = output<void>();\n\n\t/** @internal Get the display value */\n\tpublic getLabel(): string {\n\t\treturn this._elementRef.nativeElement.textContent?.trim() ?? '';\n\t}\n\n\t/** @internal */\n\tsetActiveStyles(): void {\n\t\tthis._active.set(true);\n\n\t\t// ensure the item is in view\n\t\tif (isPlatformBrowser(this._platform)) {\n\t\t\tthis._elementRef.nativeElement.scrollIntoView({ block: 'nearest' });\n\t\t}\n\t}\n\n\t/** @internal */\n\tsetInactiveStyles(): void {\n\t\tthis._active.set(false);\n\t}\n\n\tprotected onClick(): void {\n\t\tthis._autocomplete.keyManager.setActiveItem(this);\n\t\tthis.selected.emit();\n\t}\n\n\tprotected activate(): void {\n\t\tif (this._disabled()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._autocomplete.keyManager.setActiveItem(this);\n\t}\n}\n","import { Directive, input } from '@angular/core';\n\n@Directive({\n\tselector: '[brnAutocompleteList]',\n\thost: {\n\t\trole: 'listbox',\n\t\t'[id]': 'id()',\n\t},\n})\nexport class BrnAutocompleteList {\n\tprivate static _id = 0;\n\n\t/** The id of the command list */\n\tpublic readonly id = input<string>(`brn-autocomplete-list-${++BrnAutocompleteList._id}`);\n}\n","import { BrnAutocomplete } from './lib/brn-autocomplete';\nimport { BrnAutocompleteEmpty } from './lib/brn-autocomplete-empty';\nimport { BrnAutocompleteGroup } from './lib/brn-autocomplete-group';\nimport { BrnAutocompleteItem } from './lib/brn-autocomplete-item';\nimport { BrnAutocompleteList } from './lib/brn-autocomplete-list';\nimport { BrnAutocompleteSearchInput } from './lib/brn-autocomplete-search-input';\n\nexport * from './lib/brn-autocomplete';\nexport * from './lib/brn-autocomplete-empty';\nexport * from './lib/brn-autocomplete-group';\nexport * from './lib/brn-autocomplete-item';\nexport * from './lib/brn-autocomplete-item.token';\nexport * from './lib/brn-autocomplete-list';\nexport * from './lib/brn-autocomplete-search-input';\nexport * from './lib/brn-autocomplete-search-input.token';\nexport * from './lib/brn-autocomplete.token';\n\nexport const BrnAutocompleteImports = [\n\tBrnAutocomplete,\n\tBrnAutocompleteEmpty,\n\tBrnAutocompleteGroup,\n\tBrnAutocompleteItem,\n\tBrnAutocompleteList,\n\tBrnAutocompleteSearchInput,\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAGa,wBAAwB,GAAG,IAAI,cAAc,CAA+B,0BAA0B;AAE7G,SAAU,0BAA0B,CAAI,YAA0C,EAAA;IACvF,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,YAAY,EAAE;AACxE;;MCJa,+BAA+B,GAAG,IAAI,cAAc,CAChE,iCAAiC;AAG5B,SAAU,iCAAiC,CAAC,YAA8C,EAAA;IAC/F,OAAO,EAAE,OAAO,EAAE,+BAA+B,EAAE,WAAW,EAAE,YAAY,EAAE;AAC/E;;MCNa,oBAAoB,GAAG,IAAI,cAAc,CAA2B,sBAAsB;AAEjG,SAAU,sBAAsB,CAAI,YAAsC,EAAA;IAC/E,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE;AACpE;SAEgB,qBAAqB,GAAA;AACpC,IAAA,OAAO,MAAM,CAAC,oBAAoB,CAAuB;AAC1D;;AC0BM,MAAO,0BAA2B,SAAQ,oBAAoB,CAAA;AAiBjD,IAAA,UAAA;IAhBD,aAAa,GAAG,qBAAqB,EAAE;;AAGxC,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;;IAGzB,WAAW,GAAG,MAAM,EAAU;;AAG3B,IAAA,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU;;AAG3C,IAAA,iBAAiB,GAAG,MAAM,CAAqB,SAAS,CAAC;AAE5E,IAAA,WAAA,CACC,QAAmB,EACF,UAAsB,EACM,eAAwB,EAAA;AAErE,QAAA,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC;QAH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A,uBAAA,EAAA,MAAA,EAAA,EAAA,EAAA,EAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,SAAA,EAAA,EAAA,UAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAP/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,uBAAuB;AACjC,oBAAA,IAAI,EAAE;AACL,wBAAA,IAAI,EAAE,SAAS;AACf,wBAAA,MAAM,EAAE,MAAM;AACd,qBAAA;AACD,iBAAA;;;ACSM,MAAM,sBAAsB,GAAG;IACrC,eAAe;IACf,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,mBAAmB;IACnB,0BAA0B;;;ACvB3B;;AAEG;;;;"}
1
+ {"version":3,"file":"spartan-ng-brain-autocomplete.mjs","sources":["../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-item.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-empty.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-group.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-item.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-list.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-search-input.ts","../../../../libs/brain/autocomplete/src/index.ts","../../../../libs/brain/autocomplete/src/spartan-ng-brain-autocomplete.ts"],"sourcesContent":["import { type ExistingProvider, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocompleteItem } from './brn-autocomplete-item';\n\nexport const BrnAutocompleteItemToken = new InjectionToken<BrnAutocompleteItem<unknown>>('BrnAutocompleteItemToken');\n\nexport function provideBrnAutocompleteItem<T>(autocomplete: Type<BrnAutocompleteItem<T>>): ExistingProvider {\n\treturn { provide: BrnAutocompleteItemToken, useExisting: autocomplete };\n}\n","import { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocomplete } from './brn-autocomplete';\n\nexport const BrnAutocompleteToken = new InjectionToken<BrnAutocomplete<unknown>>('BrnAutocompleteToken');\n\nexport function provideBrnAutocomplete<T>(autocomplete: Type<BrnAutocomplete<T>>): ExistingProvider {\n\treturn { provide: BrnAutocompleteToken, useExisting: autocomplete };\n}\n\nexport function injectBrnAutocomplete<T>(): BrnAutocomplete<T> {\n\treturn inject(BrnAutocompleteToken) as BrnAutocomplete<T>;\n}\n","import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';\nimport {\n\tcomputed,\n\tcontentChildren,\n\tDirective,\n\teffect,\n\tinject,\n\tInjector,\n\tinput,\n\toutput,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { BrnPopover } from '@spartan-ng/brain/popover';\nimport type { BrnAutocompleteItem } from './brn-autocomplete-item';\nimport { BrnAutocompleteItemToken } from './brn-autocomplete-item.token';\nimport { provideBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: '[brnAutocomplete]',\n\tproviders: [provideBrnAutocomplete(BrnAutocomplete)],\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'(keydown.enter)': 'selectActiveItem()',\n\t},\n})\nexport class BrnAutocomplete<T> {\n\tprivate static _id = 0;\n\n\tprivate readonly _injector = inject(Injector);\n\n\t/** The id of the autocomplete */\n\tpublic readonly id = input<string>(`brn-autocomplete-${++BrnAutocomplete._id}`);\n\n\t/** when the selection has changed */\n\tpublic readonly valueChange = output<T>();\n\n\t/** when the selection has been cleared */\n\tpublic readonly selectionCleared = output<void>();\n\n\t/** Access the popover if present */\n\tprivate readonly _brnPopover = inject(BrnPopover, { optional: true });\n\n\t/** @internal The focus strategy when opening */\n\tprivate readonly _focus = signal<'first' | 'last'>('first');\n\n\t/** @internal Access all the items within the autocomplete */\n\tpublic readonly items = contentChildren<BrnAutocompleteItem<T>>(BrnAutocompleteItemToken, {\n\t\tdescendants: true,\n\t});\n\n\t/** @internal The key manager for managing active descendant */\n\tpublic readonly keyManager = new ActiveDescendantKeyManager(this.items, this._injector);\n\n\t/** @internal Whether the autocomplete is expanded */\n\tpublic readonly isExpanded = computed(() => this._brnPopover?.stateComputed() === 'open');\n\n\tconstructor() {\n\t\tthis.keyManager\n\t\t\t.withVerticalOrientation()\n\t\t\t.withHomeAndEnd()\n\t\t\t.withWrap()\n\t\t\t.skipPredicate((item) => item.disabled);\n\n\t\teffect(() => {\n\t\t\tconst items = this.items();\n\t\t\tconst focus = this._focus();\n\n\t\t\tuntracked(() => {\n\t\t\t\tif (!items.length) return;\n\n\t\t\t\tconst activeItem = this.keyManager.activeItem;\n\n\t\t\t\tif (!activeItem || !items.includes(activeItem)) {\n\t\t\t\t\tfocus === 'first' ? this.keyManager.setFirstItemActive() : this.keyManager.setLastItemActive();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tthis.keyManager.change.pipe(takeUntilDestroyed()).subscribe(() => {\n\t\t\tconst value = this.keyManager.activeItem?.value();\n\t\t\tif (value) {\n\t\t\t\tthis.valueChange.emit(value);\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected selectActiveItem(): void {\n\t\tif (this._brnPopover?.stateComputed() === 'open') {\n\t\t\tthis.keyManager.activeItem?.selected.emit();\n\t\t}\n\t}\n\n\topen(focus: 'first' | 'last' = 'first') {\n\t\tthis._brnPopover?.open();\n\t\tthis._focus.set(focus);\n\t}\n\n\tclose() {\n\t\tthis._brnPopover?.close();\n\t}\n\n\ttoggle() {\n\t\tthis.isExpanded() ? this.close() : this.open();\n\t}\n}\n","import { computed, Directive, effect, inject, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: '[brnAutocompleteEmpty]',\n})\nexport class BrnAutocompleteEmpty {\n\tprivate readonly _templateRef = inject<TemplateRef<void>>(TemplateRef);\n\tprivate readonly _viewContainerRef = inject(ViewContainerRef);\n\tprivate readonly _autocomplete = injectBrnAutocomplete();\n\n\t/** Determine if the autocomplete has any items */\n\tprivate readonly _visible = computed(() => this._autocomplete.items().length > 0);\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tif (this._visible()) {\n\t\t\t\tthis._viewContainerRef.clear();\n\t\t\t} else {\n\t\t\t\tthis._viewContainerRef.createEmbeddedView(this._templateRef);\n\t\t\t}\n\t\t});\n\t}\n}\n","import { Directive, input } from '@angular/core';\n\n@Directive({\n\tselector: '[brnAutocompleteGroup]',\n\thost: {\n\t\trole: 'group',\n\t\t'[id]': 'id()',\n\t},\n})\nexport class BrnAutocompleteGroup {\n\tprivate static _id = 0;\n\n\t/** The id of the autocomplete list */\n\tpublic readonly id = input<string>(`brn-autocomplete-group-${++BrnAutocompleteGroup._id}`);\n}\n","import type { Highlightable } from '@angular/cdk/a11y';\nimport type { BooleanInput } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport { booleanAttribute, Directive, ElementRef, inject, input, output, PLATFORM_ID, signal } from '@angular/core';\nimport { provideBrnAutocompleteItem } from './brn-autocomplete-item.token';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: 'button[brnAutocompleteItem]',\n\tproviders: [provideBrnAutocompleteItem(BrnAutocompleteItem)],\n\thost: {\n\t\ttype: 'button',\n\t\trole: 'option',\n\t\ttabIndex: '-1',\n\t\t'[id]': 'id()',\n\t\t'[attr.disabled]': '_disabled() ? true : null',\n\t\t'[attr.data-disabled]': '_disabled() ? \"\" : null',\n\t\t'[attr.data-value]': 'value()',\n\t\t'[attr.aria-selected]': '_active()',\n\t\t'[attr.data-selected]': \"_active() ? '' : null\",\n\t\t'(click)': 'onClick()',\n\t\t'(mouseenter)': 'activate()',\n\t},\n})\nexport class BrnAutocompleteItem<T> implements Highlightable {\n\tprivate static _id = 0;\n\n\tprivate readonly _platform = inject(PLATFORM_ID);\n\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n\t/** Access the autocomplete component */\n\tprivate readonly _autocomplete = injectBrnAutocomplete<T>();\n\n\t/** A unique id for the item */\n\tpublic readonly id = input(`brn-autocomplete-item-${++BrnAutocompleteItem._id}`);\n\n\t/** The value this item represents. */\n\tpublic readonly value = input.required<T>();\n\n\t/** Whether the item is disabled. */\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tpublic readonly _disabled = input<boolean, BooleanInput>(false, {\n\t\talias: 'disabled',\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** Expose disabled as a value - used by the Highlightable interface */\n\tpublic get disabled() {\n\t\treturn this._disabled();\n\t}\n\n\t/** Whether the item is selected. */\n\tprotected readonly _active = signal(false);\n\n\t/** Emits when the item is selected. */\n\tpublic readonly selected = output<void>();\n\n\t/** @internal Get the display value */\n\tpublic getLabel(): string {\n\t\treturn this._elementRef.nativeElement.textContent?.trim() ?? '';\n\t}\n\n\t/** @internal */\n\tsetActiveStyles(): void {\n\t\tthis._active.set(true);\n\n\t\t// ensure the item is in view\n\t\tif (isPlatformBrowser(this._platform)) {\n\t\t\tthis._elementRef.nativeElement.scrollIntoView({ block: 'nearest' });\n\t\t}\n\t}\n\n\t/** @internal */\n\tsetInactiveStyles(): void {\n\t\tthis._active.set(false);\n\t}\n\n\tprotected onClick(): void {\n\t\tthis._autocomplete.keyManager.setActiveItem(this);\n\t\tthis.selected.emit();\n\t}\n\n\tprotected activate(): void {\n\t\tif (this._disabled()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._autocomplete.keyManager.setActiveItem(this);\n\t}\n}\n","import { Directive, input } from '@angular/core';\n\n@Directive({\n\tselector: '[brnAutocompleteList]',\n\thost: {\n\t\trole: 'listbox',\n\t\t'[id]': 'id()',\n\t},\n})\nexport class BrnAutocompleteList {\n\tprivate static _id = 0;\n\n\t/** The id of the command list */\n\tpublic readonly id = input<string>(`brn-autocomplete-list-${++BrnAutocompleteList._id}`);\n}\n","import { Directive, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { startWith } from 'rxjs/operators';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: 'input[brnAutocompleteSearchInput]',\n\thost: {\n\t\trole: 'combobox',\n\t\t'aria-autocomplete': 'list',\n\t\t'[attr.aria-activedescendant]': '_activeDescendant()',\n\t\t'[attr.aria-expanded]': '_isExpanded()',\n\t\t'(keydown)': 'onKeyDown($event)',\n\t},\n})\nexport class BrnAutocompleteSearchInput {\n\tprivate readonly _autocomplete = injectBrnAutocomplete();\n\n\t/** Whether the autocomplete panel is expanded */\n\tprotected readonly _isExpanded = this._autocomplete.isExpanded;\n\n\t/** The id of the active option */\n\tprotected readonly _activeDescendant = signal<string | undefined>(undefined);\n\n\tconstructor() {\n\t\tthis._autocomplete.keyManager.change\n\t\t\t.pipe(startWith(this._autocomplete.keyManager.activeItemIndex), takeUntilDestroyed())\n\t\t\t.subscribe(() => {\n\t\t\t\tthis._activeDescendant.set(this._autocomplete.keyManager.activeItem?.id());\n\t\t\t});\n\t}\n\n\t/** Listen for keydown events */\n\tprotected onKeyDown(event: KeyboardEvent): void {\n\t\tif (event.key === 'Enter') {\n\t\t\t// prevent form submission if inside a form\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tif (!this._isExpanded()) {\n\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\tthis._autocomplete.open('first');\n\t\t\t}\n\n\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\tthis._autocomplete.open('last');\n\t\t\t}\n\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\tthis._autocomplete.selectionCleared.emit();\n\t\t\t}\n\t\t}\n\n\t\tthis._autocomplete.keyManager.onKeydown(event);\n\t}\n}\n","import { BrnAutocomplete } from './lib/brn-autocomplete';\nimport { BrnAutocompleteEmpty } from './lib/brn-autocomplete-empty';\nimport { BrnAutocompleteGroup } from './lib/brn-autocomplete-group';\nimport { BrnAutocompleteItem } from './lib/brn-autocomplete-item';\nimport { BrnAutocompleteList } from './lib/brn-autocomplete-list';\nimport { BrnAutocompleteSearchInput } from './lib/brn-autocomplete-search-input';\n\nexport * from './lib/brn-autocomplete';\nexport * from './lib/brn-autocomplete-empty';\nexport * from './lib/brn-autocomplete-group';\nexport * from './lib/brn-autocomplete-item';\nexport * from './lib/brn-autocomplete-item.token';\nexport * from './lib/brn-autocomplete-list';\nexport * from './lib/brn-autocomplete-search-input';\nexport * from './lib/brn-autocomplete.token';\n\nexport const BrnAutocompleteImports = [\n\tBrnAutocomplete,\n\tBrnAutocompleteEmpty,\n\tBrnAutocompleteGroup,\n\tBrnAutocompleteItem,\n\tBrnAutocompleteList,\n\tBrnAutocompleteSearchInput,\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAGa,wBAAwB,GAAG,IAAI,cAAc,CAA+B,0BAA0B;AAE7G,SAAU,0BAA0B,CAAI,YAA0C,EAAA;IACvF,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,YAAY,EAAE;AACxE;;MCJa,oBAAoB,GAAG,IAAI,cAAc,CAA2B,sBAAsB;AAEjG,SAAU,sBAAsB,CAAI,YAAsC,EAAA;IAC/E,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE;AACpE;SAEgB,qBAAqB,GAAA;AACpC,IAAA,OAAO,MAAM,CAAC,oBAAoB,CAAuB;AAC1D;;MCgBa,eAAe,CAAA;AACnB,IAAA,OAAO,GAAG,GAAG,CAAC;AA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MAAM,sBAAsB,GAAG;IACrC,eAAe;IACf,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,mBAAmB;IACnB,0BAA0B;;;ACtB3B;;AAEG;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { untracked, computed, InjectionToken, forwardRef, inject } from '@angular/core';
2
2
  import { Observable, pipe, merge, fromEvent } from 'rxjs';
3
- import { map, filter, distinctUntilChanged, takeUntil } from 'rxjs/operators';
3
+ import { map, filter, distinctUntilChanged, takeUntil, debounceTime } from 'rxjs/operators';
4
+ import { toObservable, toSignal } from '@angular/core/rxjs-interop';
4
5
 
5
6
  /**
6
7
  * Returns a signal that emits the previous value of the given signal.
@@ -89,6 +90,19 @@ function createInjectionToken(description) {
89
90
 
90
91
  const [injectCustomClassSettable, provideCustomClassSettable, provideCustomClassSettableExisting, SET_CLASS_TO_CUSTOM_ELEMENT_TOKEN,] = createInjectionToken('@spartan-ng SET_CLASS_TO_CUSTOM_ELEMENT_TOKEN');
91
92
 
93
+ /**
94
+ * Creates a debounced version of a source signal.
95
+ *
96
+ * @param source - The input signal to debounce.
97
+ * @param delay - Debounce time in milliseconds.
98
+ * @returns A new signal that updates only after the source has stopped changing for `delay` ms.
99
+ */
100
+ function debouncedSignal(source, delay) {
101
+ const source$ = toObservable(source);
102
+ const debounced$ = source$.pipe(debounceTime(delay), distinctUntilChanged());
103
+ return toSignal(debounced$, { initialValue: source() });
104
+ }
105
+
92
106
  /**
93
107
  * Set by Angular to true when in development mode.
94
108
  * Allows for tree-shaking code that is only used in development.
@@ -128,5 +142,5 @@ async function waitForElementAnimations(el) {
128
142
  * Generated bundle index. Do not edit.
129
143
  */
130
144
 
131
- export { EXPOSES_SIDE_TOKEN, EXPOSES_STATE_TOKEN, SET_CLASS_TO_CUSTOM_ELEMENT_TOKEN, SET_TABLE_CLASSES_TOKEN, brnDevMode, brnZoneFree, brnZoneFull, brnZoneOptimized, computedPrevious, createHoverObservable, injectCustomClassSettable, injectExposedSideProvider, injectExposesStateProvider, injectTableClassesSettable, isElement, provideCustomClassSettable, provideCustomClassSettableExisting, provideExposedSideProvider, provideExposedSideProviderExisting, provideExposesStateProvider, provideExposesStateProviderExisting, provideTableClassesSettable, provideTableClassesSettableExisting, waitForElementAnimations };
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 };
132
146
  //# 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/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","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,C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kCAAkC,EAClC,kBAAkB,EAClB,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/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,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"0.0.1-alpha.538",
3
+ "version": "0.0.1-alpha.539",
4
4
  "sideEffects": false,
5
5
  "exports": {
6
6
  "./hlm-tailwind-preset": {
@@ -26,18 +26,14 @@
26
26
  "types": "./autocomplete/index.d.ts",
27
27
  "default": "./fesm2022/spartan-ng-brain-autocomplete.mjs"
28
28
  },
29
- "./avatar": {
30
- "types": "./avatar/index.d.ts",
31
- "default": "./fesm2022/spartan-ng-brain-avatar.mjs"
29
+ "./calendar": {
30
+ "types": "./calendar/index.d.ts",
31
+ "default": "./fesm2022/spartan-ng-brain-calendar.mjs"
32
32
  },
33
33
  "./button": {
34
34
  "types": "./button/index.d.ts",
35
35
  "default": "./fesm2022/spartan-ng-brain-button.mjs"
36
36
  },
37
- "./calendar": {
38
- "types": "./calendar/index.d.ts",
39
- "default": "./fesm2022/spartan-ng-brain-calendar.mjs"
40
- },
41
37
  "./checkbox": {
42
38
  "types": "./checkbox/index.d.ts",
43
39
  "default": "./fesm2022/spartan-ng-brain-checkbox.mjs"
@@ -46,6 +42,10 @@
46
42
  "types": "./collapsible/index.d.ts",
47
43
  "default": "./fesm2022/spartan-ng-brain-collapsible.mjs"
48
44
  },
45
+ "./avatar": {
46
+ "types": "./avatar/index.d.ts",
47
+ "default": "./fesm2022/spartan-ng-brain-avatar.mjs"
48
+ },
49
49
  "./command": {
50
50
  "types": "./command/index.d.ts",
51
51
  "default": "./fesm2022/spartan-ng-brain-command.mjs"
@@ -98,22 +98,22 @@
98
98
  "types": "./popover/index.d.ts",
99
99
  "default": "./fesm2022/spartan-ng-brain-popover.mjs"
100
100
  },
101
- "./progress": {
102
- "types": "./progress/index.d.ts",
103
- "default": "./fesm2022/spartan-ng-brain-progress.mjs"
104
- },
105
101
  "./radio-group": {
106
102
  "types": "./radio-group/index.d.ts",
107
103
  "default": "./fesm2022/spartan-ng-brain-radio-group.mjs"
108
104
  },
109
- "./resizable": {
110
- "types": "./resizable/index.d.ts",
111
- "default": "./fesm2022/spartan-ng-brain-resizable.mjs"
105
+ "./progress": {
106
+ "types": "./progress/index.d.ts",
107
+ "default": "./fesm2022/spartan-ng-brain-progress.mjs"
112
108
  },
113
109
  "./select": {
114
110
  "types": "./select/index.d.ts",
115
111
  "default": "./fesm2022/spartan-ng-brain-select.mjs"
116
112
  },
113
+ "./resizable": {
114
+ "types": "./resizable/index.d.ts",
115
+ "default": "./fesm2022/spartan-ng-brain-resizable.mjs"
116
+ },
117
117
  "./separator": {
118
118
  "types": "./separator/index.d.ts",
119
119
  "default": "./fesm2022/spartan-ng-brain-separator.mjs"
@@ -126,17 +126,13 @@
126
126
  "types": "./slider/index.d.ts",
127
127
  "default": "./fesm2022/spartan-ng-brain-slider.mjs"
128
128
  },
129
- "./switch": {
130
- "types": "./switch/index.d.ts",
131
- "default": "./fesm2022/spartan-ng-brain-switch.mjs"
132
- },
133
129
  "./tabs": {
134
130
  "types": "./tabs/index.d.ts",
135
131
  "default": "./fesm2022/spartan-ng-brain-tabs.mjs"
136
132
  },
137
- "./toggle": {
138
- "types": "./toggle/index.d.ts",
139
- "default": "./fesm2022/spartan-ng-brain-toggle.mjs"
133
+ "./switch": {
134
+ "types": "./switch/index.d.ts",
135
+ "default": "./fesm2022/spartan-ng-brain-switch.mjs"
140
136
  },
141
137
  "./toggle-group": {
142
138
  "types": "./toggle-group/index.d.ts",
@@ -145,6 +141,10 @@
145
141
  "./tooltip": {
146
142
  "types": "./tooltip/index.d.ts",
147
143
  "default": "./fesm2022/spartan-ng-brain-tooltip.mjs"
144
+ },
145
+ "./toggle": {
146
+ "types": "./toggle/index.d.ts",
147
+ "default": "./fesm2022/spartan-ng-brain-toggle.mjs"
148
148
  }
149
149
  },
150
150
  "peerDependencies": {
@@ -1,4 +0,0 @@
1
- import { type ExistingProvider, InjectionToken, type Type } from '@angular/core';
2
- import type { BrnAutocompleteSearchInput } from './brn-autocomplete-search-input';
3
- export declare const BrnAutocompleteSearchInputToken: InjectionToken<BrnAutocompleteSearchInput>;
4
- export declare function provideBrnAutocompleteSearchInput(autocomplete: Type<BrnAutocompleteSearchInput>): ExistingProvider;