@simonbackx/vue-app-navigation 2.8.2 → 2.9.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
|
@@ -137,9 +137,9 @@ const _UrlHelper = class _UrlHelper {
|
|
|
137
137
|
return matchPath(this.getParts(), this.getSearchParams(), template, params);
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
|
-
/**
|
|
140
|
+
/**
|
|
141
141
|
* Use this for the universal fixed prefix
|
|
142
|
-
*
|
|
142
|
+
*
|
|
143
143
|
* Always remove this prefix when getting an url, and add it when doing setUrl.
|
|
144
144
|
* When you want to host an app in a subdirectory
|
|
145
145
|
* Slashes are added automatically on the sides if needed
|
|
@@ -235,6 +235,13 @@ class HistoryManagerStatic {
|
|
|
235
235
|
this.runQueue();
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
+
waitForQueue() {
|
|
239
|
+
return new Promise((resolve) => {
|
|
240
|
+
this.addToQueue(() => {
|
|
241
|
+
resolve();
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
}
|
|
238
245
|
runQueue() {
|
|
239
246
|
this.isQueueRunning = true;
|
|
240
247
|
const action = this.historyQueue.shift();
|
|
@@ -304,6 +311,7 @@ class HistoryManagerStatic {
|
|
|
304
311
|
}
|
|
305
312
|
const didJustLoadPage = Date.now() - this.pageLoadedAt < 1e3 * 5;
|
|
306
313
|
this.changeUrlTimeout = setTimeout(() => {
|
|
314
|
+
this.changeUrlTimeout = null;
|
|
307
315
|
if (this.counter !== count || state.url !== url) {
|
|
308
316
|
return;
|
|
309
317
|
}
|
|
@@ -341,18 +349,24 @@ class HistoryManagerStatic {
|
|
|
341
349
|
}
|
|
342
350
|
}
|
|
343
351
|
// Call this when url formatting or prefix has changed
|
|
344
|
-
updateUrl() {
|
|
352
|
+
async updateUrl() {
|
|
345
353
|
if (!this.active) {
|
|
346
354
|
return;
|
|
347
355
|
}
|
|
348
356
|
if (this.changeUrlTimeout) {
|
|
357
|
+
await this.waitForQueue();
|
|
349
358
|
return;
|
|
350
359
|
}
|
|
360
|
+
const state = this.states[this.states.length - 1];
|
|
361
|
+
const count = state.index;
|
|
351
362
|
this.addToQueue(() => {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
363
|
+
if (this.counter !== count) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const formattedUrl = this.resolveUrl(count);
|
|
367
|
+
history.replaceState({ counter: count }, "", formattedUrl);
|
|
355
368
|
});
|
|
369
|
+
await this.waitForQueue();
|
|
356
370
|
}
|
|
357
371
|
formatTitle(title) {
|
|
358
372
|
return title + (this.titleSuffix ? " | " + this.titleSuffix : "");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HistoryUrl } from './HistoryManager';
|
|
2
2
|
import { ComponentInternalInstance, ComponentPublicInstance, Raw, VNode } from 'vue';
|
|
3
3
|
|
|
4
|
-
export type ModalDisplayStyle =
|
|
4
|
+
export type ModalDisplayStyle = 'cover' | 'popup' | 'overlay' | 'sheet' | 'side-view';
|
|
5
5
|
export declare function useCurrentComponent(): ComponentWithPropertiesType | null;
|
|
6
6
|
export declare function getExposeProxy(instance: ComponentInternalInstance | null | undefined): ComponentPublicInstance | undefined;
|
|
7
7
|
export declare function forAllRoots(root: ComponentWithProperties, handler: (root: ComponentWithPropertiesType) => void, alreadyProcessed?: Set<ComponentWithPropertiesType>): void;
|
|
@@ -28,12 +28,13 @@ declare class HistoryManagerStatic {
|
|
|
28
28
|
removeListener(owner: unknown): void;
|
|
29
29
|
callListeners(): void;
|
|
30
30
|
private addToQueue;
|
|
31
|
+
private waitForQueue;
|
|
31
32
|
private runQueue;
|
|
32
33
|
private go;
|
|
33
34
|
getStateUrl(index: number): string;
|
|
34
35
|
resolveUrl(index: number): string;
|
|
35
36
|
setUrl(url: HistoryUrl, title?: string, index?: number): void;
|
|
36
|
-
updateUrl(): void
|
|
37
|
+
updateUrl(): Promise<void>;
|
|
37
38
|
formatTitle(title: string): string;
|
|
38
39
|
/**
|
|
39
40
|
* Set the saved title for a given state. If that state is the current one, it will also get set immediately
|
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.
|
|
5
|
+
"version": "2.9.0",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"import": "./dist/index.js",
|
|
@@ -24,22 +24,20 @@
|
|
|
24
24
|
"build": "vite build",
|
|
25
25
|
"dev": "vite serve test --mode development",
|
|
26
26
|
"build:dev": "vite build --mode development",
|
|
27
|
-
"lint": "eslint
|
|
27
|
+
"lint": "eslint"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"type": "module",
|
|
33
33
|
"devDependencies": {
|
|
34
|
+
"@eslint/js": "^9.11.1",
|
|
34
35
|
"@types/node": "^20.12.7",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
36
|
-
"@typescript-eslint/parser": "^7.7.1",
|
|
37
36
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
38
37
|
"@vue/eslint-config-typescript": "^13.0.0",
|
|
39
38
|
"@vue/runtime-core": "^3.5.12",
|
|
40
|
-
"eslint": "^
|
|
41
|
-
"eslint-plugin-
|
|
42
|
-
"eslint-plugin-vue": "^9.25.0",
|
|
39
|
+
"eslint": "^9.11.1",
|
|
40
|
+
"eslint-plugin-stamhoofd": "^2.74.0",
|
|
43
41
|
"sass": "^1.32.4",
|
|
44
42
|
"tslib": "^2.6.2",
|
|
45
43
|
"typescript": "^5.6.2",
|