@simonbackx/vue-app-navigation 2.13.0 → 2.14.0

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.
package/dist/index.js CHANGED
@@ -384,7 +384,7 @@ class HistoryManagerStatic {
384
384
  state.title = title;
385
385
  } else {
386
386
  const state = this.states[index];
387
- if (state.index !== index) {
387
+ if (!state || state.index !== index) {
388
388
  console.error("Search state with index ", index, "but received state with index", state.index);
389
389
  return;
390
390
  }
@@ -1231,15 +1231,11 @@ const _sfc_main$4 = defineComponent({
1231
1231
  emits: ["didPush", "didPop", "showDetail", "present"],
1232
1232
  data() {
1233
1233
  const savedInternalScrollPositions = [];
1234
- const savedScrollPositions = [];
1235
1234
  const components = [];
1236
1235
  return {
1237
1236
  components,
1238
1237
  mainComponent: null,
1239
1238
  transitionName: "none",
1240
- savedScrollPositions,
1241
- nextScrollPosition: 0,
1242
- previousScrollPosition: 0,
1243
1239
  nextInternalScrollPosition: 0,
1244
1240
  savedInternalScrollPositions,
1245
1241
  // Because push/pop is async, it can cause issues if we call it multiple times after each other
@@ -1373,7 +1369,7 @@ const _sfc_main$4 = defineComponent({
1373
1369
  async push(options) {
1374
1370
  return await this.runQueue(async () => {
1375
1371
  var _a;
1376
- if (options.components.length == 0) {
1372
+ if (options.components.length === 0) {
1377
1373
  console.error("Missing component when pushing");
1378
1374
  return;
1379
1375
  }
@@ -1403,19 +1399,11 @@ const _sfc_main$4 = defineComponent({
1403
1399
  if (!animated) {
1404
1400
  this.transitionName = "none";
1405
1401
  } else {
1406
- this.transitionName = this.animationType == "modal" ? "modal-push" : options.reverse ? "pop" : "push";
1402
+ this.transitionName = this.animationType === "modal" ? "modal-push" : options.reverse ? "pop" : "push";
1407
1403
  }
1408
1404
  const internalScrollElement = this.getInternalScrollElement();
1409
- const w = window;
1410
- let clientHeight = document.documentElement.clientHeight;
1411
- if (w.visualViewport) {
1412
- clientHeight = w.visualViewport.height;
1413
- }
1414
1405
  const internalClientHeight = internalScrollElement == null ? void 0 : internalScrollElement.clientHeight;
1415
- this.previousScrollPosition = 0;
1416
- this.savedScrollPositions.push(this.previousScrollPosition + clientHeight);
1417
1406
  this.savedInternalScrollPositions.push(((internalScrollElement == null ? void 0 : internalScrollElement.scrollTop) ?? 0) + (internalClientHeight ?? 0));
1418
- this.nextScrollPosition = 0;
1419
1407
  this.nextInternalScrollPosition = 0;
1420
1408
  if (animated) {
1421
1409
  this.freezeSize();
@@ -1522,11 +1510,10 @@ const _sfc_main$4 = defineComponent({
1522
1510
  }
1523
1511
  }
1524
1512
  }
1525
- this.previousScrollPosition = 0;
1526
1513
  if (!animated) {
1527
1514
  this.transitionName = "none";
1528
1515
  } else {
1529
- this.transitionName = this.animationType == "modal" ? "modal-pop" : "pop";
1516
+ this.transitionName = this.animationType === "modal" ? "modal-pop" : "pop";
1530
1517
  this.freezeSize();
1531
1518
  }
1532
1519
  const popped = this.components.splice(this.components.length - count, count);
@@ -1535,7 +1522,6 @@ const _sfc_main$4 = defineComponent({
1535
1522
  comp.keepAlive = true;
1536
1523
  }
1537
1524
  }
1538
- this.nextScrollPosition = 0;
1539
1525
  this.nextInternalScrollPosition = Math.max(0, this.savedInternalScrollPositions.pop() ?? 0);
1540
1526
  this.mainComponent = this.components[this.components.length - 1];
1541
1527
  this.mainComponent.returnToHistoryIndex();
@@ -1574,7 +1560,6 @@ const _sfc_main$4 = defineComponent({
1574
1560
  },
1575
1561
  enter(element, done) {
1576
1562
  if (this.transitionName === "none") {
1577
- this.getScrollElement().scrollTop = this.nextScrollPosition;
1578
1563
  const internal = this.getInternalScrollElement(element);
1579
1564
  if (internal) {
1580
1565
  internal.scrollTop = Math.max(0, this.nextInternalScrollPosition - internal.clientHeight);
@@ -24,9 +24,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
24
24
  components: ComponentWithPropertiesType[];
25
25
  mainComponent: ComponentWithPropertiesType | null;
26
26
  transitionName: string;
27
- savedScrollPositions: number[];
28
- nextScrollPosition: number;
29
- previousScrollPosition: number;
30
27
  nextInternalScrollPosition: number;
31
28
  savedInternalScrollPositions: number[];
32
29
  asyncQueue: (() => Promise<void>)[];
@@ -133,9 +130,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
133
130
  components: ComponentWithPropertiesType[];
134
131
  mainComponent: ComponentWithPropertiesType | null;
135
132
  transitionName: string;
136
- savedScrollPositions: number[];
137
- nextScrollPosition: number;
138
- previousScrollPosition: number;
139
133
  nextInternalScrollPosition: number;
140
134
  savedInternalScrollPositions: number[];
141
135
  asyncQueue: (() => Promise<void>)[];
@@ -236,9 +230,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
236
230
  components: ComponentWithPropertiesType[];
237
231
  mainComponent: ComponentWithPropertiesType | null;
238
232
  transitionName: string;
239
- savedScrollPositions: number[];
240
- nextScrollPosition: number;
241
- previousScrollPosition: number;
242
233
  nextInternalScrollPosition: number;
243
234
  savedInternalScrollPositions: number[];
244
235
  asyncQueue: (() => Promise<void>)[];
@@ -69,9 +69,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
69
69
  components: ComponentWithPropertiesType[];
70
70
  mainComponent: ComponentWithPropertiesType | null;
71
71
  transitionName: string;
72
- savedScrollPositions: number[];
73
- nextScrollPosition: number;
74
- previousScrollPosition: number;
75
72
  nextInternalScrollPosition: number;
76
73
  savedInternalScrollPositions: number[];
77
74
  asyncQueue: (() => Promise<void>)[];
@@ -178,9 +175,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
178
175
  components: ComponentWithPropertiesType[];
179
176
  mainComponent: ComponentWithPropertiesType | null;
180
177
  transitionName: string;
181
- savedScrollPositions: number[];
182
- nextScrollPosition: number;
183
- previousScrollPosition: number;
184
178
  nextInternalScrollPosition: number;
185
179
  savedInternalScrollPositions: number[];
186
180
  asyncQueue: (() => Promise<void>)[];
@@ -281,9 +275,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
281
275
  components: ComponentWithPropertiesType[];
282
276
  mainComponent: ComponentWithPropertiesType | null;
283
277
  transitionName: string;
284
- savedScrollPositions: number[];
285
- nextScrollPosition: number;
286
- previousScrollPosition: number;
287
278
  nextInternalScrollPosition: number;
288
279
  savedInternalScrollPositions: number[];
289
280
  asyncQueue: (() => Promise<void>)[];
@@ -404,9 +395,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
404
395
  components: ComponentWithPropertiesType[];
405
396
  mainComponent: ComponentWithPropertiesType | null;
406
397
  transitionName: string;
407
- savedScrollPositions: number[];
408
- nextScrollPosition: number;
409
- previousScrollPosition: number;
410
398
  nextInternalScrollPosition: number;
411
399
  savedInternalScrollPositions: number[];
412
400
  asyncQueue: (() => Promise<void>)[];
@@ -513,9 +501,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
513
501
  components: ComponentWithPropertiesType[];
514
502
  mainComponent: ComponentWithPropertiesType | null;
515
503
  transitionName: string;
516
- savedScrollPositions: number[];
517
- nextScrollPosition: number;
518
- previousScrollPosition: number;
519
504
  nextInternalScrollPosition: number;
520
505
  savedInternalScrollPositions: number[];
521
506
  asyncQueue: (() => Promise<void>)[];
@@ -616,9 +601,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
616
601
  components: ComponentWithPropertiesType[];
617
602
  mainComponent: ComponentWithPropertiesType | null;
618
603
  transitionName: string;
619
- savedScrollPositions: number[];
620
- nextScrollPosition: number;
621
- previousScrollPosition: number;
622
604
  nextInternalScrollPosition: number;
623
605
  savedInternalScrollPositions: number[];
624
606
  asyncQueue: (() => Promise<void>)[];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@simonbackx/vue-app-navigation",
3
3
  "main": "./dist/index.js",
4
4
  "types": "./dist/index.d.ts",
5
- "version": "2.13.0",
5
+ "version": "2.14.0",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./dist/index.js",