@camaradesuk/m3e-angular 0.2.0-alpha.6 → 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,
|
|
4011
|
-
* into it shows the expanded rail as a non-modal overlay; leaving it (200ms grace
|
|
4012
|
-
* pointer), focus leaving it or Escape ends the peek. `expanded` does not change. Has no
|
|
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
|
-
|
|
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
|
-
/**
|
|
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;
|