@simonbackx/vue-app-navigation 2.13.0 → 2.14.1

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,6 +384,10 @@ class HistoryManagerStatic {
384
384
  state.title = title;
385
385
  } else {
386
386
  const state = this.states[index];
387
+ if (!state) {
388
+ console.error("Search state with index ", index, "not found");
389
+ return;
390
+ }
387
391
  if (state.index !== index) {
388
392
  console.error("Search state with index ", index, "but received state with index", state.index);
389
393
  return;
@@ -1231,15 +1235,11 @@ const _sfc_main$4 = defineComponent({
1231
1235
  emits: ["didPush", "didPop", "showDetail", "present"],
1232
1236
  data() {
1233
1237
  const savedInternalScrollPositions = [];
1234
- const savedScrollPositions = [];
1235
1238
  const components = [];
1236
1239
  return {
1237
1240
  components,
1238
1241
  mainComponent: null,
1239
1242
  transitionName: "none",
1240
- savedScrollPositions,
1241
- nextScrollPosition: 0,
1242
- previousScrollPosition: 0,
1243
1243
  nextInternalScrollPosition: 0,
1244
1244
  savedInternalScrollPositions,
1245
1245
  // Because push/pop is async, it can cause issues if we call it multiple times after each other
@@ -1373,7 +1373,7 @@ const _sfc_main$4 = defineComponent({
1373
1373
  async push(options) {
1374
1374
  return await this.runQueue(async () => {
1375
1375
  var _a;
1376
- if (options.components.length == 0) {
1376
+ if (options.components.length === 0) {
1377
1377
  console.error("Missing component when pushing");
1378
1378
  return;
1379
1379
  }
@@ -1403,19 +1403,11 @@ const _sfc_main$4 = defineComponent({
1403
1403
  if (!animated) {
1404
1404
  this.transitionName = "none";
1405
1405
  } else {
1406
- this.transitionName = this.animationType == "modal" ? "modal-push" : options.reverse ? "pop" : "push";
1406
+ this.transitionName = this.animationType === "modal" ? "modal-push" : options.reverse ? "pop" : "push";
1407
1407
  }
1408
1408
  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
1409
  const internalClientHeight = internalScrollElement == null ? void 0 : internalScrollElement.clientHeight;
1415
- this.previousScrollPosition = 0;
1416
- this.savedScrollPositions.push(this.previousScrollPosition + clientHeight);
1417
1410
  this.savedInternalScrollPositions.push(((internalScrollElement == null ? void 0 : internalScrollElement.scrollTop) ?? 0) + (internalClientHeight ?? 0));
1418
- this.nextScrollPosition = 0;
1419
1411
  this.nextInternalScrollPosition = 0;
1420
1412
  if (animated) {
1421
1413
  this.freezeSize();
@@ -1522,11 +1514,10 @@ const _sfc_main$4 = defineComponent({
1522
1514
  }
1523
1515
  }
1524
1516
  }
1525
- this.previousScrollPosition = 0;
1526
1517
  if (!animated) {
1527
1518
  this.transitionName = "none";
1528
1519
  } else {
1529
- this.transitionName = this.animationType == "modal" ? "modal-pop" : "pop";
1520
+ this.transitionName = this.animationType === "modal" ? "modal-pop" : "pop";
1530
1521
  this.freezeSize();
1531
1522
  }
1532
1523
  const popped = this.components.splice(this.components.length - count, count);
@@ -1535,7 +1526,6 @@ const _sfc_main$4 = defineComponent({
1535
1526
  comp.keepAlive = true;
1536
1527
  }
1537
1528
  }
1538
- this.nextScrollPosition = 0;
1539
1529
  this.nextInternalScrollPosition = Math.max(0, this.savedInternalScrollPositions.pop() ?? 0);
1540
1530
  this.mainComponent = this.components[this.components.length - 1];
1541
1531
  this.mainComponent.returnToHistoryIndex();
@@ -1574,7 +1564,6 @@ const _sfc_main$4 = defineComponent({
1574
1564
  },
1575
1565
  enter(element, done) {
1576
1566
  if (this.transitionName === "none") {
1577
- this.getScrollElement().scrollTop = this.nextScrollPosition;
1578
1567
  const internal = this.getInternalScrollElement(element);
1579
1568
  if (internal) {
1580
1569
  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.1",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./dist/index.js",