@camaradesuk/m3e-angular 0.2.0-alpha.5 → 0.2.0-alpha.7

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.
@@ -3960,6 +3960,22 @@ class MatExpNavigationRail {
3960
3960
  _wasPeeking = false;
3961
3961
  _peekOpenTimer;
3962
3962
  _peekCloseTimer;
3963
+ /**
3964
+ * Where a mouse or pen pointer entered the drawer, until it first really moves there. Hover
3965
+ * intent starts on that movement, so a rail that scrolls or resizes under a still pointer never
3966
+ * peeks, and each entry opens at most one hover peek (after Escape, a new peek needs a new entry).
3967
+ */
3968
+ _hoverEntry = null;
3969
+ /**
3970
+ * The mouse or pen pointer's position at its current and previous moves anywhere in the
3971
+ * document, recorded in the capture phase so content that stops propagation cannot hide them.
3972
+ * NaN until known.
3973
+ */
3974
+ _pointerX = NaN;
3975
+ _pointerY = NaN;
3976
+ _previousPointerX = NaN;
3977
+ _previousPointerY = NaN;
3978
+ _zone = inject(NgZone);
3963
3979
  /** The last element focused inside the panel, for a peek that hides it as it ends. */
3964
3980
  _peekFocus = null;
3965
3981
  _rescuingPeekFocus = false;
@@ -4007,10 +4023,10 @@ class MatExpNavigationRail {
4007
4023
  collapsedLayout = input(this._options.collapsedLayout, /* @ts-ignore */
4008
4024
  ...(ngDevMode ? [{ debugName: "collapsedLayout" }] : /* istanbul ignore next */ []));
4009
4025
  /**
4010
- * Peek: while collapsed, hovering the rail (mouse or pen, after 120ms) or moving keyboard focus
4011
- * into it shows the expanded rail as a non-modal overlay; leaving it (200ms grace for the
4012
- * pointer), focus leaving it or Escape ends the peek. `expanded` does not change. Has no effect
4013
- * with `hideOnCollapse`. @default false
4026
+ * Peek: while collapsed, hovering the rail (a mouse or pen moving over it, then 120ms) or moving
4027
+ * keyboard focus into it shows the expanded rail as a non-modal overlay; leaving it (200ms grace
4028
+ * for the pointer), focus leaving it or Escape ends the peek. `expanded` does not change. Has no
4029
+ * effect with `hideOnCollapse`. @default false
4014
4030
  */
4015
4031
  peek = input(this._options.peek, { ...(ngDevMode ? { debugName: "peek" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
4016
4032
  /** Whether peek applies now: enabled, collapsed and not hidden. */
@@ -4132,7 +4148,33 @@ class MatExpNavigationRail {
4132
4148
  this._wasPeeking = peeking;
4133
4149
  });
4134
4150
  afterEveryRender(() => this._syncTabStop());
4135
- inject(DestroyRef).onDestroy(() => {
4151
+ // Pointer movement is listened to natively, outside Angular's zone: only the first move after
4152
+ // an entry does any work, so moves must not run change detection.
4153
+ const destroyRef = inject(DestroyRef);
4154
+ afterNextRender(() => {
4155
+ const drawer = this._drawerElement().nativeElement;
4156
+ const onMove = (event) => this._onPointerMove(event);
4157
+ // Tracked even while peek is off (two number writes per move), so the first hover after
4158
+ // turning it on still knows where the pointer came from.
4159
+ const track = (event) => {
4160
+ if (event.pointerType !== 'mouse' && event.pointerType !== 'pen')
4161
+ return;
4162
+ this._previousPointerX = this._pointerX;
4163
+ this._previousPointerY = this._pointerY;
4164
+ this._pointerX = event.clientX;
4165
+ this._pointerY = event.clientY;
4166
+ };
4167
+ const capture = { capture: true, passive: true };
4168
+ this._zone.runOutsideAngular(() => {
4169
+ drawer.addEventListener('pointermove', onMove, { passive: true });
4170
+ this._document.addEventListener('pointermove', track, capture);
4171
+ });
4172
+ destroyRef.onDestroy(() => {
4173
+ drawer.removeEventListener('pointermove', onMove);
4174
+ this._document.removeEventListener('pointermove', track, capture);
4175
+ });
4176
+ });
4177
+ destroyRef.onDestroy(() => {
4136
4178
  this._clearPeekTimers();
4137
4179
  if (this._wasModal)
4138
4180
  this._restoreFocus();
@@ -4270,7 +4312,10 @@ class MatExpNavigationRail {
4270
4312
  }
4271
4313
  this._endPeek();
4272
4314
  }
4273
- /** @internal Mouse or pen hover opens a peek after a short intent delay. Touch never peeks. */
4315
+ /**
4316
+ * @internal Mouse or pen hover opens a peek after a short intent delay, counted from the
4317
+ * pointer's first movement over the rail. Touch never peeks.
4318
+ */
4274
4319
  _onPointerEnter(event) {
4275
4320
  if (event.pointerType !== 'mouse' && event.pointerType !== 'pen')
4276
4321
  return;
@@ -4278,16 +4323,40 @@ class MatExpNavigationRail {
4278
4323
  this._peekCloseTimer = undefined;
4279
4324
  if (!this._canPeek() || this._peekRequested() || this._peekOpenTimer !== undefined)
4280
4325
  return;
4326
+ this._hoverEntry = { x: event.clientX, y: event.clientY };
4327
+ }
4328
+ _onPointerMove(event) {
4329
+ const entry = this._hoverEntry;
4330
+ if (!entry || (event.pointerType !== 'mouse' && event.pointerType !== 'pen'))
4331
+ return;
4332
+ // WebKit refreshes hover after a scroll with a move that repeats the pointer's last position
4333
+ // with no movement. A real move comes from somewhere else, though WebKit may report no
4334
+ // movement for it either, so compare with the previous position (or the entry point).
4335
+ const known = !Number.isNaN(this._previousPointerX);
4336
+ const fromX = known ? this._previousPointerX : entry.x;
4337
+ const fromY = known ? this._previousPointerY : entry.y;
4338
+ const moved = (event.movementX ?? 0) !== 0 ||
4339
+ (event.movementY ?? 0) !== 0 ||
4340
+ event.clientX !== fromX ||
4341
+ event.clientY !== fromY;
4342
+ if (!moved)
4343
+ return;
4344
+ this._hoverEntry = null;
4345
+ if (!this._canPeek() || this._peekRequested() || this._peekOpenTimer !== undefined)
4346
+ return;
4347
+ // Scheduled from the out-of-zone listener: re-enter the zone to open, so zone-based apps that
4348
+ // ignore changes made outside it still render the peek.
4281
4349
  this._peekOpenTimer = setTimeout(() => {
4282
4350
  this._peekOpenTimer = undefined;
4283
4351
  if (this._canPeek())
4284
- this._peekRequested.set(true);
4352
+ this._zone.run(() => this._peekRequested.set(true));
4285
4353
  }, PEEK_OPEN_DELAY);
4286
4354
  }
4287
4355
  /** @internal */
4288
4356
  _onPointerLeave(event) {
4289
4357
  if (event.pointerType !== 'mouse' && event.pointerType !== 'pen')
4290
4358
  return;
4359
+ this._hoverEntry = null;
4291
4360
  clearTimeout(this._peekOpenTimer);
4292
4361
  this._peekOpenTimer = undefined;
4293
4362
  if (!this.peeking() || this._peekCloseTimer !== undefined)
@@ -4538,6 +4607,7 @@ class MatExpNavigationRail {
4538
4607
  this._peekRequested.set(false);
4539
4608
  }
4540
4609
  _clearPeekTimers() {
4610
+ this._hoverEntry = null;
4541
4611
  clearTimeout(this._peekOpenTimer);
4542
4612
  clearTimeout(this._peekCloseTimer);
4543
4613
  this._peekOpenTimer = this._peekCloseTimer = undefined;
@@ -5193,6 +5263,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
5193
5263
  const options$1 = matExpCreateOptions({
5194
5264
  motion: 'system',
5195
5265
  closeLabel: 'Close dialog',
5266
+ adaptiveWidth: undefined,
5196
5267
  compactActions: 'header',
5197
5268
  });
5198
5269
  const MAT_EXP_DIALOG_OPTIONS = options$1.token;
@@ -6519,6 +6590,13 @@ class MatExpDialogContainer extends CdkDialogContainer {
6519
6590
  /* Capture after the spring completes. */
6520
6591
  }
6521
6592
  _contentAttached() {
6593
+ const width = this._context.mode === 'adaptive' ? this._context.adaptiveWidth : undefined;
6594
+ if (width) {
6595
+ const pane = this._cdkRef.overlayRef.overlayElement.style;
6596
+ pane.setProperty('--mat-exp-dialog-adaptive-width', width);
6597
+ // An explicit width also wins over the stepper's own wider dialog default.
6598
+ pane.setProperty('--mat-exp-stepper-dialog-width', width);
6599
+ }
6522
6600
  super._contentAttached();
6523
6601
  afterNextRender(() => {
6524
6602
  if (this._destroyed || this._closing)
@@ -6570,11 +6648,11 @@ class MatExpDialogContainer extends CdkDialogContainer {
6570
6648
  super.ngOnDestroy();
6571
6649
  }
6572
6650
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpDialogContainer, deps: null, target: i0.ɵɵFactoryTarget.Component });
6573
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.2.3", type: MatExpDialogContainer, isStandalone: true, selector: "mat-exp-dialog-container", host: { styleAttribute: "visibility: hidden", classAttribute: "mat-exp-dialog-container" }, usesInheritance: true, ngImport: i0, template: '<div class="mat-exp-dialog-surface"><div class="mat-exp-dialog-content-viewport"><ng-template cdkPortalOutlet /></div></div>', isInline: true, styles: [".mat-exp-dialog-panel{--mat-dialog-container-color: var(--mat-sys-surface-container-high);--mat-dialog-container-shape: var(--mat-sys-corner-extra-large);--mat-dialog-container-min-width: min(280px, 100vw - 32px);--mat-dialog-actions-padding: 1.5rem;--mat-dialog-content-padding: 1.5rem;--mat-dialog-with-actions-content-padding: 1.5rem 1.5rem 0;max-height:calc(100dvh - 48px)}.mat-exp-dialog-panel.mat-exp-dialog-adaptive{width:min(560px,100% - 32px)}@media(max-width:599px){.mat-exp-dialog-panel.mat-exp-dialog-adaptive{--mat-dialog-container-shape: 0;--mat-dialog-container-min-width: 0;--mat-dialog-container-max-width: 100%;--mat-dialog-container-small-max-width: 100%;width:100%;min-width:0;max-width:100%;height:100dvh;max-height:100dvh}}.mat-exp-dialog-no-motion *{transition-duration:0s!important;animation-duration:0s!important}@media(prefers-reduced-motion:reduce){.mat-exp-dialog-panel *,.mat-exp-dialog-backdrop{transition-duration:0s!important;animation-duration:0s!important}}.mat-exp-dialog-panel{min-width:var(--mat-dialog-container-min-width, min(280px, 100vw - 32px));max-width:var(--mat-dialog-container-max-width, min(560px, 100vw - 32px))}.mat-exp-dialog-container,.mat-exp-dialog-surface,.mat-exp-dialog-content-viewport{display:block;box-sizing:border-box;width:100%;height:100%;max-height:inherit;min-height:0}.mat-exp-dialog-container{outline:none}.mat-exp-dialog-surface{position:relative;overflow:hidden;background:var(--mat-dialog-container-color, var(--mat-sys-surface-container-high));color:var(--mat-sys-on-surface);border-radius:var(--mat-dialog-container-shape, 28px);transform-origin:top left;box-shadow:var(--mat-sys-level3)}.mat-exp-dialog-component-host{display:contents}.mat-exp-dialog-content-viewport{display:flex;flex-direction:column}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
6651
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.2.3", type: MatExpDialogContainer, isStandalone: true, selector: "mat-exp-dialog-container", host: { styleAttribute: "visibility: hidden", classAttribute: "mat-exp-dialog-container" }, usesInheritance: true, ngImport: i0, template: '<div class="mat-exp-dialog-surface"><div class="mat-exp-dialog-content-viewport"><ng-template cdkPortalOutlet /></div></div>', isInline: true, styles: [".mat-exp-dialog-panel{--mat-dialog-container-color: var(--mat-sys-surface-container-high);--mat-dialog-container-shape: var(--mat-sys-corner-extra-large);--mat-dialog-container-min-width: min(280px, 100vw - 32px);--mat-dialog-actions-padding: 1.5rem;--mat-dialog-content-padding: 1.5rem;--mat-dialog-with-actions-content-padding: 1.5rem 1.5rem 0;max-height:calc(100dvh - 48px)}.mat-exp-dialog-panel.mat-exp-dialog-adaptive{width:min(var(--mat-exp-dialog-adaptive-width, 560px),100% - 32px);max-width:calc(100% - 32px)}@media(max-width:599px){.mat-exp-dialog-panel.mat-exp-dialog-adaptive{--mat-dialog-container-shape: 0;--mat-dialog-container-min-width: 0;--mat-dialog-container-max-width: 100%;--mat-dialog-container-small-max-width: 100%;width:100%;min-width:0;max-width:100%;height:100dvh;max-height:100dvh}}.mat-exp-dialog-no-motion *{transition-duration:0s!important;animation-duration:0s!important}@media(prefers-reduced-motion:reduce){.mat-exp-dialog-panel *,.mat-exp-dialog-backdrop{transition-duration:0s!important;animation-duration:0s!important}}.mat-exp-dialog-panel{min-width:var(--mat-dialog-container-min-width, min(280px, 100vw - 32px));max-width:var(--mat-dialog-container-max-width, min(560px, 100vw - 32px))}.mat-exp-dialog-container,.mat-exp-dialog-surface,.mat-exp-dialog-content-viewport{display:block;box-sizing:border-box;width:100%;height:100%;max-height:inherit;min-height:0}.mat-exp-dialog-container{outline:none}.mat-exp-dialog-surface{position:relative;overflow:hidden;background:var(--mat-dialog-container-color, var(--mat-sys-surface-container-high));color:var(--mat-sys-on-surface);border-radius:var(--mat-dialog-container-shape, 28px);transform-origin:top left;box-shadow:var(--mat-sys-level3)}.mat-exp-dialog-component-host{display:contents}.mat-exp-dialog-content-viewport{display:flex;flex-direction:column}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
6574
6652
  }
6575
6653
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpDialogContainer, decorators: [{
6576
6654
  type: Component,
6577
- args: [{ selector: 'mat-exp-dialog-container', imports: [CdkPortalOutlet], template: '<div class="mat-exp-dialog-surface"><div class="mat-exp-dialog-content-viewport"><ng-template cdkPortalOutlet /></div></div>', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'mat-exp-dialog-container', style: 'visibility: hidden' }, styles: [".mat-exp-dialog-panel{--mat-dialog-container-color: var(--mat-sys-surface-container-high);--mat-dialog-container-shape: var(--mat-sys-corner-extra-large);--mat-dialog-container-min-width: min(280px, 100vw - 32px);--mat-dialog-actions-padding: 1.5rem;--mat-dialog-content-padding: 1.5rem;--mat-dialog-with-actions-content-padding: 1.5rem 1.5rem 0;max-height:calc(100dvh - 48px)}.mat-exp-dialog-panel.mat-exp-dialog-adaptive{width:min(560px,100% - 32px)}@media(max-width:599px){.mat-exp-dialog-panel.mat-exp-dialog-adaptive{--mat-dialog-container-shape: 0;--mat-dialog-container-min-width: 0;--mat-dialog-container-max-width: 100%;--mat-dialog-container-small-max-width: 100%;width:100%;min-width:0;max-width:100%;height:100dvh;max-height:100dvh}}.mat-exp-dialog-no-motion *{transition-duration:0s!important;animation-duration:0s!important}@media(prefers-reduced-motion:reduce){.mat-exp-dialog-panel *,.mat-exp-dialog-backdrop{transition-duration:0s!important;animation-duration:0s!important}}.mat-exp-dialog-panel{min-width:var(--mat-dialog-container-min-width, min(280px, 100vw - 32px));max-width:var(--mat-dialog-container-max-width, min(560px, 100vw - 32px))}.mat-exp-dialog-container,.mat-exp-dialog-surface,.mat-exp-dialog-content-viewport{display:block;box-sizing:border-box;width:100%;height:100%;max-height:inherit;min-height:0}.mat-exp-dialog-container{outline:none}.mat-exp-dialog-surface{position:relative;overflow:hidden;background:var(--mat-dialog-container-color, var(--mat-sys-surface-container-high));color:var(--mat-sys-on-surface);border-radius:var(--mat-dialog-container-shape, 28px);transform-origin:top left;box-shadow:var(--mat-sys-level3)}.mat-exp-dialog-component-host{display:contents}.mat-exp-dialog-content-viewport{display:flex;flex-direction:column}\n"] }]
6655
+ args: [{ selector: 'mat-exp-dialog-container', imports: [CdkPortalOutlet], template: '<div class="mat-exp-dialog-surface"><div class="mat-exp-dialog-content-viewport"><ng-template cdkPortalOutlet /></div></div>', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'mat-exp-dialog-container', style: 'visibility: hidden' }, styles: [".mat-exp-dialog-panel{--mat-dialog-container-color: var(--mat-sys-surface-container-high);--mat-dialog-container-shape: var(--mat-sys-corner-extra-large);--mat-dialog-container-min-width: min(280px, 100vw - 32px);--mat-dialog-actions-padding: 1.5rem;--mat-dialog-content-padding: 1.5rem;--mat-dialog-with-actions-content-padding: 1.5rem 1.5rem 0;max-height:calc(100dvh - 48px)}.mat-exp-dialog-panel.mat-exp-dialog-adaptive{width:min(var(--mat-exp-dialog-adaptive-width, 560px),100% - 32px);max-width:calc(100% - 32px)}@media(max-width:599px){.mat-exp-dialog-panel.mat-exp-dialog-adaptive{--mat-dialog-container-shape: 0;--mat-dialog-container-min-width: 0;--mat-dialog-container-max-width: 100%;--mat-dialog-container-small-max-width: 100%;width:100%;min-width:0;max-width:100%;height:100dvh;max-height:100dvh}}.mat-exp-dialog-no-motion *{transition-duration:0s!important;animation-duration:0s!important}@media(prefers-reduced-motion:reduce){.mat-exp-dialog-panel *,.mat-exp-dialog-backdrop{transition-duration:0s!important;animation-duration:0s!important}}.mat-exp-dialog-panel{min-width:var(--mat-dialog-container-min-width, min(280px, 100vw - 32px));max-width:var(--mat-dialog-container-max-width, min(560px, 100vw - 32px))}.mat-exp-dialog-container,.mat-exp-dialog-surface,.mat-exp-dialog-content-viewport{display:block;box-sizing:border-box;width:100%;height:100%;max-height:inherit;min-height:0}.mat-exp-dialog-container{outline:none}.mat-exp-dialog-surface{position:relative;overflow:hidden;background:var(--mat-dialog-container-color, var(--mat-sys-surface-container-high));color:var(--mat-sys-on-surface);border-radius:var(--mat-dialog-container-shape, 28px);transform-origin:top left;box-shadow:var(--mat-sys-level3)}.mat-exp-dialog-component-host{display:contents}.mat-exp-dialog-content-viewport{display:flex;flex-direction:column}\n"] }]
6578
6656
  }] });
6579
6657
 
6580
6658
  /** Explicit close action for content opened by MatExpDialog. */
@@ -6723,6 +6801,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
6723
6801
  }] });
6724
6802
 
6725
6803
  let nextConfirmationId = 0;
6804
+ /** Width keywords that are valid CSS but not a <length-percentage> inside min(). */
6805
+ const NON_LENGTH_WIDTH = /^(?:auto|inherit|initial|unset|revert(?:-layer)?|stretch|(?:min-|max-|fit-)content)$|^fit-content\(/i;
6726
6806
  /** Opens CDK-backed spring-driven dialogs with a typed alert/adaptive presentation contract. */
6727
6807
  class MatExpDialog {
6728
6808
  /** @internal */
@@ -6783,9 +6863,18 @@ class MatExpDialog {
6783
6863
  if (config.mode === 'alert' && (!config.role || !config.ariaDescribedBy?.trim())) {
6784
6864
  throw new Error('Alert mode requires an explicit role and ariaDescribedBy.');
6785
6865
  }
6786
- const { mode, title, motion = this._options.motion, closeLabel = this._options.closeLabel, origin, compactActions = this._options.compactActions, ...native } = config;
6866
+ const { mode, title, motion = this._options.motion, closeLabel = this._options.closeLabel, origin, adaptiveWidth = this._options.adaptiveWidth, compactActions = this._options.compactActions, ...native } = config;
6787
6867
  if (mode === 'adaptive' && !closeLabel.trim())
6788
6868
  throw new Error('Adaptive mode requires a non-empty closeLabel.');
6869
+ if (mode === 'adaptive' &&
6870
+ adaptiveWidth !== undefined &&
6871
+ (!adaptiveWidth.trim() ||
6872
+ NON_LENGTH_WIDTH.test(adaptiveWidth.trim()) ||
6873
+ // Inside min() only a <length-percentage> is valid; 'auto' or 'inherit' are not.
6874
+ (typeof CSS !== 'undefined' &&
6875
+ !(CSS.supports('width', adaptiveWidth) &&
6876
+ CSS.supports('width', `min(${adaptiveWidth}, 1px)`)))))
6877
+ throw new Error('Adaptive mode requires a valid CSS adaptiveWidth.');
6789
6878
  if (compactActions !== 'header' && compactActions !== 'footer')
6790
6879
  throw new Error("compactActions must be 'header' or 'footer'.");
6791
6880
  const effective = { ...this._nativeDefaults, ...native };
@@ -6795,7 +6884,7 @@ class MatExpDialog {
6795
6884
  providers: [
6796
6885
  {
6797
6886
  provide: MAT_EXP_DIALOG_CONTEXT,
6798
- useValue: { mode, title, closeLabel, motion, origin, compactActions },
6887
+ useValue: { mode, title, closeLabel, motion, adaptiveWidth, origin, compactActions },
6799
6888
  },
6800
6889
  ],
6801
6890
  });
@@ -6809,7 +6898,7 @@ class MatExpDialog {
6809
6898
  motion,
6810
6899
  closeLabel,
6811
6900
  origin,
6812
- ...(mode === 'adaptive' ? { compactActions } : {}),
6901
+ ...(mode === 'adaptive' ? { adaptiveWidth, compactActions } : {}),
6813
6902
  };
6814
6903
  this._dialog.open(component, {
6815
6904
  ...effective,