@spartan-ng/brain 0.0.1-alpha.602 → 0.0.1-alpha.603

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.
@@ -295,7 +295,7 @@ function areArraysSameByElRef(arr1, arr2) {
295
295
  return arr1.every((item, index) => item === arr2[index]);
296
296
  }
297
297
  class BrnNavigationMenu {
298
- _directionality = inject(Directionality);
298
+ _dir = inject(Directionality);
299
299
  _zone = inject(NgZone);
300
300
  _destroy$ = new Subject();
301
301
  el = inject(ElementRef);
@@ -312,10 +312,8 @@ class BrnNavigationMenu {
312
312
  * How much time a user has to enter another trigger without incurring a delay again.
313
313
  */
314
314
  skipDelayDuration = input(300);
315
- /**
316
- * The reading direction of the menu when applicable.
317
- */
318
- dir = input();
315
+ /** internal **/
316
+ direction = this._dir.valueSignal;
319
317
  /**
320
318
  * The orientation of the menu.
321
319
  */
@@ -332,7 +330,7 @@ class BrnNavigationMenu {
332
330
  _linkMenuItems = computed(() => this.menuItems().filter((i) => i.focusable() instanceof BrnNavigationMenuLink));
333
331
  _keyManager = computed(() => {
334
332
  return new FocusKeyManager(this._triggersAndLinks())
335
- .withHorizontalOrientation(this._dir())
333
+ .withHorizontalOrientation(this.direction())
336
334
  .withHomeAndEnd()
337
335
  .withPageUpDown()
338
336
  .withWrap()
@@ -342,17 +340,7 @@ class BrnNavigationMenu {
342
340
  _hovered$ = merge(createHoverObservable(this.el.nativeElement, this._zone, this._destroy$).pipe(map((e) => e.hover)), this._reset$).pipe(startWith(undefined));
343
341
  _contentHovered$ = merge(toObservable(this._navAndSubnavMenuItems).pipe(switchMap((menuItems) => merge(...menuItems.map((mi) => mi.contentHovered$)))), this._reset$).pipe(startWith(undefined));
344
342
  previousValue = computedPrevious(this.value);
345
- _dir$ = toObservable(this.dir);
346
- /**
347
- * The reading direction of the menu when applicable.
348
- * If input is not passed, inherits globally from Directionality or assumes LTR (left-to-right) reading mode.
349
- */
350
- _dir = toSignal(combineLatest([
351
- this._dir$.pipe(startWith(undefined)),
352
- this._directionality.change.pipe(startWith(undefined)),
353
- of('ltr'),
354
- ]).pipe(map(([dir, dirChange, fallback]) => dir ?? dirChange ?? fallback)), { requireSync: true });
355
- context = computed(() => ({ orientation: this.orientation(), dir: this._dir() }));
343
+ context = computed(() => ({ orientation: this.orientation(), dir: this.direction() }));
356
344
  constructor() {
357
345
  effect(() => {
358
346
  const isOpen = this.value() !== undefined;
@@ -392,7 +380,7 @@ class BrnNavigationMenu {
392
380
  clearTimeout(this._skipDelayTimerRef);
393
381
  }
394
382
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: BrnNavigationMenu, deps: [], target: i0.ɵɵFactoryTarget.Directive });
395
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.0.7", type: BrnNavigationMenu, isStandalone: true, selector: "nav[brnNavigationMenu]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, delayDuration: { classPropertyName: "delayDuration", publicName: "delayDuration", isSignal: true, isRequired: false, transformFunction: null }, skipDelayDuration: { classPropertyName: "skipDelayDuration", publicName: "skipDelayDuration", 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 } }, outputs: { value: "valueChange" }, host: { attributes: { "aria-label": "Main", "data-slot": "navigation-menu" }, listeners: { "keydown": "handleKeydown($event)" }, properties: { "attr.data-orientation": "orientation()", "attr.dir": "_dir()" } }, providers: [provideBrnNavigationMenu(BrnNavigationMenu)], queries: [{ propertyName: "_navAndSubnavMenuItems", predicate: BrnNavigationMenuItem, descendants: true, isSignal: true }], ngImport: i0 });
383
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.0.7", type: BrnNavigationMenu, isStandalone: true, selector: "nav[brnNavigationMenu]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, delayDuration: { classPropertyName: "delayDuration", publicName: "delayDuration", isSignal: true, isRequired: false, transformFunction: null }, skipDelayDuration: { classPropertyName: "skipDelayDuration", publicName: "skipDelayDuration", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "aria-label": "Main", "data-slot": "navigation-menu" }, listeners: { "keydown": "handleKeydown($event)" }, properties: { "attr.data-orientation": "orientation()", "attr.dir": "direction()" } }, providers: [provideBrnNavigationMenu(BrnNavigationMenu)], queries: [{ propertyName: "_navAndSubnavMenuItems", predicate: BrnNavigationMenuItem, descendants: true, isSignal: true }], ngImport: i0 });
396
384
  }
397
385
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: BrnNavigationMenu, decorators: [{
398
386
  type: Directive,
@@ -402,7 +390,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
402
390
  host: {
403
391
  '(keydown)': 'handleKeydown($event)',
404
392
  '[attr.data-orientation]': 'orientation()',
405
- '[attr.dir]': '_dir()',
393
+ '[attr.dir]': 'direction()',
406
394
  'aria-label': 'Main',
407
395
  'data-slot': 'navigation-menu',
408
396
  },