vue-multi-router 0.1.2 → 0.1.3
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/README.md +307 -291
- package/dist/index.d.ts +20 -20
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,291 +1,307 @@
|
|
|
1
|
-
# vue-multi-router
|
|
2
|
-
|
|
3
|
-
Vue 3 Multi Router that allows you to have multiple routers in your application.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/vue-multi-router)
|
|
6
|
-
[](https://www.typescriptlang.org/)
|
|
7
|
-
[](https://vuejs.org/)
|
|
8
|
-
[](https://bundlephobia.com/package/vue-multi-router)
|
|
9
|
-
[](https://github.com/lviobio/vue-multi-router/issues)
|
|
10
|
-
[](https://github.com/lviobio/vue-multi-router)
|
|
11
|
-

|
|
12
|
-

|
|
13
|
-
[](https://codecov.io/gh/lviobio/vue-multi-router)
|
|
14
|
-
[](https://lviobio.github.io/vue-multi-router/)
|
|
15
|
-
|
|
16
|
-
## Live Demo
|
|
17
|
-
|
|
18
|
-
🚀 **[Try the interactive playground](https://lviobio.github.io/vue-multi-router)**
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install vue-multi-router
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Features
|
|
27
|
-
|
|
28
|
-
- **Multiple Independent Routers** - Run multiple Vue Router instances simultaneously in a single app
|
|
29
|
-
- **Context-Based Navigation** - Each routing context maintains its own navigation history
|
|
30
|
-
- **Browser History Integration** - Back/forward buttons work across contexts with proper URL updates
|
|
31
|
-
- **Session Persistence** - Context states persist across page reloads via SessionStorage or other implementations
|
|
32
|
-
- **TypeScript Support** - Full type definitions included
|
|
33
|
-
- **Composable API** - Easy-to-use composables for accessing router state
|
|
34
|
-
|
|
35
|
-
##
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
- `
|
|
198
|
-
- `
|
|
199
|
-
- `
|
|
200
|
-
- `
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
<
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
#
|
|
283
|
-
npm run
|
|
284
|
-
|
|
285
|
-
#
|
|
286
|
-
npm run
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
1
|
+
# vue-multi-router
|
|
2
|
+
|
|
3
|
+
Vue 3 Multi Router that allows you to have multiple routers in your application.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/vue-multi-router)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://vuejs.org/)
|
|
8
|
+
[](https://bundlephobia.com/package/vue-multi-router)
|
|
9
|
+
[](https://github.com/lviobio/vue-multi-router/issues)
|
|
10
|
+
[](https://github.com/lviobio/vue-multi-router)
|
|
11
|
+

|
|
12
|
+

|
|
13
|
+
[](https://codecov.io/gh/lviobio/vue-multi-router)
|
|
14
|
+
[](https://lviobio.github.io/vue-multi-router/)
|
|
15
|
+
|
|
16
|
+
## Live Demo
|
|
17
|
+
|
|
18
|
+
🚀 **[Try the interactive playground](https://lviobio.github.io/vue-multi-router)**
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install vue-multi-router
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- ✅ **Multiple Independent Routers** - Run multiple Vue Router instances simultaneously in a single app
|
|
29
|
+
- ✅ **Context-Based Navigation** - Each routing context maintains its own navigation history
|
|
30
|
+
- ✅ **Browser History Integration** - Back/forward buttons work across contexts with proper URL updates
|
|
31
|
+
- ✅ **Session Persistence** - Context states persist across page reloads via SessionStorage or other implementations
|
|
32
|
+
- ✅ **TypeScript Support** - Full type definitions included
|
|
33
|
+
- ✅ **Composable API** - Easy-to-use composables for accessing router state
|
|
34
|
+
|
|
35
|
+
## Motivation
|
|
36
|
+
|
|
37
|
+
Vue Router is designed around a single-router-per-app model. That works well for most applications, but falls short when your UI needs **multiple independent navigation areas** — each with its own route, history stack, and back/forward behavior.
|
|
38
|
+
|
|
39
|
+
Think of:
|
|
40
|
+
|
|
41
|
+
- **Dashboard applications** with several panels, each displaying a different page
|
|
42
|
+
- **Desktop-like UIs** with floating or tiled windows that navigate independently
|
|
43
|
+
- **Tabbed interfaces** where each tab has its own browsing history
|
|
44
|
+
- **Multi-pane editors** (email clients, admin tools) with a sidebar, list, and detail view that all route separately
|
|
45
|
+
|
|
46
|
+
Without vue-multi-router you'd have to juggle manual `<component :is>` switching, duplicate router instances with conflicting URL ownership, or complex query-parameter schemes — all of which break browser history and become hard to maintain.
|
|
47
|
+
|
|
48
|
+
vue-multi-router solves this by letting you wrap any part of your template in a `<MultiRouterContext>`. Each context gets its own virtual navigation stack while sharing a single set of route definitions and a single browser URL. The library manages history entries so that the browser back/forward buttons work correctly across every context, and state is persisted through page reloads via SessionStorage.
|
|
49
|
+
|
|
50
|
+
## Basic Usage
|
|
51
|
+
|
|
52
|
+
### 1. Create Multi Router
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// router.ts
|
|
56
|
+
import { createMultiRouter } from 'vue-multi-router'
|
|
57
|
+
import { createWebHistory } from 'vue-router'
|
|
58
|
+
|
|
59
|
+
export const multiRouter = createMultiRouter({
|
|
60
|
+
history: createWebHistory(),
|
|
61
|
+
routes: [
|
|
62
|
+
{
|
|
63
|
+
path: '/',
|
|
64
|
+
component: () => import('./views/Layout.vue'),
|
|
65
|
+
children: [
|
|
66
|
+
{ path: 'home', component: () => import('./views/Home.vue') },
|
|
67
|
+
{ path: 'about', component: () => import('./views/About.vue') },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
})
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 2. Install Plugin
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// main.ts
|
|
78
|
+
import { createApp } from 'vue'
|
|
79
|
+
import App from './App.vue'
|
|
80
|
+
import { multiRouter } from './router'
|
|
81
|
+
|
|
82
|
+
const app = createApp(App)
|
|
83
|
+
app.use(multiRouter)
|
|
84
|
+
app.mount('#app')
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Define Contexts
|
|
88
|
+
|
|
89
|
+
```vue
|
|
90
|
+
<!-- App.vue -->
|
|
91
|
+
<template>
|
|
92
|
+
<MultiRouterContext type="main" name="main" default>
|
|
93
|
+
<RouterView />
|
|
94
|
+
</MultiRouterContext>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
<script setup>
|
|
98
|
+
import { MultiRouterContext } from 'vue-multi-router'
|
|
99
|
+
</script>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`MultiRouterContext` acts as an activator by default — clicking anywhere inside it activates the context. No extra wrapper needed.
|
|
103
|
+
|
|
104
|
+
### 4. Create Additional Contexts
|
|
105
|
+
|
|
106
|
+
```vue
|
|
107
|
+
<!-- Panels.vue -->
|
|
108
|
+
<template>
|
|
109
|
+
<div v-for="panel in panels" :key="panel.id">
|
|
110
|
+
<MultiRouterContext type="panel" :name="`panel-${panel.id}`" initial-location="/home">
|
|
111
|
+
<RouterView />
|
|
112
|
+
</MultiRouterContext>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## API Reference
|
|
118
|
+
|
|
119
|
+
### `createMultiRouter(options)`
|
|
120
|
+
|
|
121
|
+
Creates a multi-router instance.
|
|
122
|
+
|
|
123
|
+
**Options:**
|
|
124
|
+
|
|
125
|
+
- `history: RouterHistory` - Vue Router history instance
|
|
126
|
+
- `routes: RouteRecordRaw[]` - Route definitions (same as Vue Router)
|
|
127
|
+
- `historyOptions?: MultiRouterHistoryManagerOptions` - History management options
|
|
128
|
+
|
|
129
|
+
### Route Meta Options
|
|
130
|
+
|
|
131
|
+
**`multiRouterRoot: boolean`**
|
|
132
|
+
|
|
133
|
+
Marks a route as the root for context rendering. When a context navigates to a nested route, `RouterView` inside the context will start rendering from the route marked with `multiRouterRoot: true`, skipping parent routes.
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
const routes = [
|
|
137
|
+
{
|
|
138
|
+
path: '/dashboard',
|
|
139
|
+
component: DashboardLayout,
|
|
140
|
+
children: [
|
|
141
|
+
{
|
|
142
|
+
path: 'panels',
|
|
143
|
+
component: PanelsContainer,
|
|
144
|
+
children: [
|
|
145
|
+
{
|
|
146
|
+
path: 'content',
|
|
147
|
+
component: PanelContent,
|
|
148
|
+
meta: { multiRouterRoot: true }, // Context renders from here
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
This is useful when contexts are nested inside shared layouts but should render independently from their root component.
|
|
158
|
+
|
|
159
|
+
### `<MultiRouterContext>`
|
|
160
|
+
|
|
161
|
+
Component that defines a routing context boundary. By default, it also acts as an activator — clicking inside the context activates it.
|
|
162
|
+
|
|
163
|
+
**Props:**
|
|
164
|
+
|
|
165
|
+
- `type: string` - Context type identifier (for debugging/organization)
|
|
166
|
+
- `name: string` - Unique context identifier
|
|
167
|
+
- `location?: string` - Force specific location (overrides storage)
|
|
168
|
+
- `initial-location?: string` - Initial location for new contexts
|
|
169
|
+
- `history-enabled?: boolean` - Whether to track in browser history (default: `true`)
|
|
170
|
+
- `default?: boolean` - Activate by default if no saved context exists
|
|
171
|
+
- `activator?: boolean` - Whether to activate context on mousedown (default: `true`). Set to `false` to opt out of built-in activation behavior
|
|
172
|
+
- `prevent-class?: string` - CSS class that prevents activation on click, useful if you want to prevent activation on click of a button that destroys the context
|
|
173
|
+
|
|
174
|
+
To disable the built-in activator:
|
|
175
|
+
|
|
176
|
+
```vue
|
|
177
|
+
<MultiRouterContext type="panel" name="panel-1" :activator="false">
|
|
178
|
+
<!-- manage activation manually -->
|
|
179
|
+
</MultiRouterContext>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### `<MultiRouterContextActivator>`
|
|
183
|
+
|
|
184
|
+
Standalone wrapper component that activates context on user interaction. Useful for advanced cases where you need fine-grained control over which element triggers activation, separate from the `MultiRouterContext` boundary.
|
|
185
|
+
|
|
186
|
+
**Props:**
|
|
187
|
+
|
|
188
|
+
- `prevent-class?: string` - CSS class that prevents activation on click
|
|
189
|
+
- `as?: string` - HTML element to render as wrapper (default: fragment/div)
|
|
190
|
+
|
|
191
|
+
### `useMultiRouter()`
|
|
192
|
+
|
|
193
|
+
Composable for accessing multi-router outside a context.
|
|
194
|
+
|
|
195
|
+
**Returns:**
|
|
196
|
+
|
|
197
|
+
- `activeContextKey: ComputedRef<string | undefined>` - Currently active context
|
|
198
|
+
- `activeHistoryContextKey: ComputedRef<string | undefined>` - Context controlling browser URL
|
|
199
|
+
- `setActive(contextKey: string, updateHistory?: boolean): void` - Activate a context
|
|
200
|
+
- `hasContext(contextKey: string): boolean` - Check if context exists
|
|
201
|
+
|
|
202
|
+
### `useMultiRouterContext()`
|
|
203
|
+
|
|
204
|
+
Composable for use inside a `MultiRouterContext`.
|
|
205
|
+
|
|
206
|
+
**Returns:**
|
|
207
|
+
|
|
208
|
+
- `manager: useMultiRouter()` - MultiRouter manager instance
|
|
209
|
+
- `contextKey: string` - This context's key
|
|
210
|
+
- `isActive: ComputedRef<boolean>` - Whether this context is active
|
|
211
|
+
- `isHistoryActive: ComputedRef<boolean>` - Whether this context controls browser URL
|
|
212
|
+
- `activeContextKey: ComputedRef<string>` - Currently active context key
|
|
213
|
+
- `activeHistoryContextKey: ComputedRef<string>` - Currently active history context key
|
|
214
|
+
- `historyEnabled: ComputedRef<boolean>` - Whether history is enabled for this context
|
|
215
|
+
- `activate(updateHistory?: boolean): void` - Activate this context
|
|
216
|
+
- `setActive(contextKey: string, updateHistory?: boolean): void` - Activate a context
|
|
217
|
+
- `hasContext(contextKey: string): boolean` - Check if context exists
|
|
218
|
+
|
|
219
|
+
## Examples
|
|
220
|
+
|
|
221
|
+
### Cards with Query Parameters
|
|
222
|
+
|
|
223
|
+
```vue
|
|
224
|
+
<template>
|
|
225
|
+
<div v-for="card in cards" :key="card.id">
|
|
226
|
+
<MultiRouterContext
|
|
227
|
+
type="card"
|
|
228
|
+
:name="`card-${card.id}`"
|
|
229
|
+
initial-location="/card/content"
|
|
230
|
+
:history-enabled="false"
|
|
231
|
+
>
|
|
232
|
+
<CardContent @close="removeCard(card.id)" />
|
|
233
|
+
</MultiRouterContext>
|
|
234
|
+
</div>
|
|
235
|
+
</template>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Accessing Route in Context
|
|
239
|
+
|
|
240
|
+
```vue
|
|
241
|
+
<script setup>
|
|
242
|
+
import { useRouter, useRoute } from 'vue-router'
|
|
243
|
+
|
|
244
|
+
const router = useRouter()
|
|
245
|
+
const route = useRoute()
|
|
246
|
+
|
|
247
|
+
// Navigate within this context
|
|
248
|
+
function goToPage(path) {
|
|
249
|
+
router.push(path)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Access query params
|
|
253
|
+
const searchQuery = computed(() => route.query.q)
|
|
254
|
+
</script>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Peer Dependencies
|
|
258
|
+
|
|
259
|
+
- `vue`: ^3.0.0
|
|
260
|
+
- `vue-router`: ^4.0.0 || ^5.0.0
|
|
261
|
+
|
|
262
|
+
## License
|
|
263
|
+
|
|
264
|
+
MIT
|
|
265
|
+
|
|
266
|
+
## Development
|
|
267
|
+
|
|
268
|
+
### Running Playground Locally
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Development mode (hot reload)
|
|
272
|
+
npm run play
|
|
273
|
+
|
|
274
|
+
# Production preview
|
|
275
|
+
npm run build:playground
|
|
276
|
+
npm run preview:playground
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Building
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# Build library
|
|
283
|
+
npm run build
|
|
284
|
+
|
|
285
|
+
# Build playground for deployment
|
|
286
|
+
npm run build:playground
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Testing & Quality
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
# Run all checks
|
|
293
|
+
npm run check
|
|
294
|
+
|
|
295
|
+
# Type checking
|
|
296
|
+
npm run ts:check
|
|
297
|
+
|
|
298
|
+
# Linting
|
|
299
|
+
npm run lint
|
|
300
|
+
|
|
301
|
+
# Formatting
|
|
302
|
+
npm run format
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Contributing
|
|
306
|
+
|
|
307
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
2
|
import { App, InjectionKey, PropType } from "vue";
|
|
3
3
|
import { Router, RouterHistory, RouterOptions } from "vue-router";
|
|
4
4
|
|
|
@@ -175,7 +175,7 @@ declare function onMultiRouterContextActivate(callback: (name: string) => void):
|
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/components/MultiRouterContext.vue.d.ts
|
|
177
177
|
declare const _default: typeof __VLS_export$1;
|
|
178
|
-
declare const __VLS_export$1:
|
|
178
|
+
declare const __VLS_export$1: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
179
179
|
type: {
|
|
180
180
|
type: StringConstructor;
|
|
181
181
|
required: true;
|
|
@@ -228,9 +228,9 @@ declare const __VLS_export$1: vue7.DefineComponent<vue7.ExtractPropTypes<{
|
|
|
228
228
|
type: PropType<string | null>;
|
|
229
229
|
default: null;
|
|
230
230
|
};
|
|
231
|
-
}>, () =>
|
|
231
|
+
}>, () => vue0.VNode<vue0.RendererNode, vue0.RendererElement, {
|
|
232
232
|
[key: string]: any;
|
|
233
|
-
}>, {}, {}, {},
|
|
233
|
+
}>, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<vue0.ExtractPropTypes<{
|
|
234
234
|
type: {
|
|
235
235
|
type: StringConstructor;
|
|
236
236
|
required: true;
|
|
@@ -288,11 +288,11 @@ declare const __VLS_export$1: vue7.DefineComponent<vue7.ExtractPropTypes<{
|
|
|
288
288
|
default: boolean;
|
|
289
289
|
activator: boolean;
|
|
290
290
|
preventClass: string | null;
|
|
291
|
-
}, {}, {}, {}, string,
|
|
291
|
+
}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
|
|
292
292
|
//#endregion
|
|
293
293
|
//#region src/components/MultiRouterContextActivator.vue.d.ts
|
|
294
294
|
declare const _default$1: typeof __VLS_export;
|
|
295
|
-
declare const __VLS_export:
|
|
295
|
+
declare const __VLS_export: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
296
296
|
as: {
|
|
297
297
|
type: PropType<string | null>;
|
|
298
298
|
default: null;
|
|
@@ -302,11 +302,11 @@ declare const __VLS_export: vue7.DefineComponent<vue7.ExtractPropTypes<{
|
|
|
302
302
|
default: null;
|
|
303
303
|
required: false;
|
|
304
304
|
};
|
|
305
|
-
}>, (() =>
|
|
305
|
+
}>, (() => vue0.VNode<vue0.RendererNode, vue0.RendererElement, {
|
|
306
306
|
[key: string]: any;
|
|
307
|
-
}>[] | undefined) | (() =>
|
|
307
|
+
}>[] | undefined) | (() => vue0.VNode<vue0.RendererNode, vue0.RendererElement, {
|
|
308
308
|
[key: string]: any;
|
|
309
|
-
}>), {}, {}, {},
|
|
309
|
+
}>), {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<vue0.ExtractPropTypes<{
|
|
310
310
|
as: {
|
|
311
311
|
type: PropType<string | null>;
|
|
312
312
|
default: null;
|
|
@@ -319,7 +319,7 @@ declare const __VLS_export: vue7.DefineComponent<vue7.ExtractPropTypes<{
|
|
|
319
319
|
}>> & Readonly<{}>, {
|
|
320
320
|
preventClass: string | null;
|
|
321
321
|
as: string | null;
|
|
322
|
-
}, {}, {}, {}, string,
|
|
322
|
+
}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/contextManager.d.ts
|
|
325
325
|
type ContextInterface = {
|
|
@@ -349,9 +349,9 @@ declare class MultiRouterManagerInstance {
|
|
|
349
349
|
constructor(app: App, historyManagerOptions: HistoryManagerOptions, makeRouter: MakeRouterFn);
|
|
350
350
|
getHistoryManager(): MultiRouterHistoryManager;
|
|
351
351
|
getActiveContext(): ActiveContextInterface | undefined;
|
|
352
|
-
getActiveContextRef():
|
|
352
|
+
getActiveContextRef(): vue0.ShallowRef<ActiveContextInterface | undefined, ActiveContextInterface | undefined>;
|
|
353
353
|
getActiveHistoryContext(): ActiveContextInterface | undefined;
|
|
354
|
-
getActiveHistoryContextRef():
|
|
354
|
+
getActiveHistoryContextRef(): vue0.ShallowRef<ActiveContextInterface | undefined, ActiveContextInterface | undefined>;
|
|
355
355
|
setActive(key: string, updateHistory: boolean): boolean;
|
|
356
356
|
clearHistoryContext(key: string): void;
|
|
357
357
|
markAsStarted(): void;
|
|
@@ -381,9 +381,9 @@ declare class MultiRouterManagerInstance {
|
|
|
381
381
|
*/
|
|
382
382
|
declare function useMultiRouter(): {
|
|
383
383
|
manager: MultiRouterManagerInstance;
|
|
384
|
-
activeContext:
|
|
385
|
-
activeContextKey:
|
|
386
|
-
activeHistoryContextKey:
|
|
384
|
+
activeContext: vue0.ComputedRef<ActiveContextInterface | undefined>;
|
|
385
|
+
activeContextKey: vue0.ComputedRef<string | undefined>;
|
|
386
|
+
activeHistoryContextKey: vue0.ComputedRef<string | undefined>;
|
|
387
387
|
setActive: (contextKey: string, updateHistory?: boolean) => void;
|
|
388
388
|
hasContext: (contextKey: string) => boolean;
|
|
389
389
|
};
|
|
@@ -392,11 +392,11 @@ declare function useMultiRouter(): {
|
|
|
392
392
|
declare function useMultiRouterContext(): {
|
|
393
393
|
manager: MultiRouterManagerInstance;
|
|
394
394
|
contextKey: string;
|
|
395
|
-
isActive:
|
|
396
|
-
isHistoryActive:
|
|
397
|
-
activeContextKey:
|
|
398
|
-
activeHistoryContextKey:
|
|
399
|
-
historyEnabled:
|
|
395
|
+
isActive: vue0.ComputedRef<boolean>;
|
|
396
|
+
isHistoryActive: vue0.ComputedRef<boolean>;
|
|
397
|
+
activeContextKey: vue0.ComputedRef<string | undefined>;
|
|
398
|
+
activeHistoryContextKey: vue0.ComputedRef<string | undefined>;
|
|
399
|
+
historyEnabled: vue0.ComputedRef<boolean>;
|
|
400
400
|
activate: (updateHistory?: boolean) => void;
|
|
401
401
|
setActive: (contextKey: string, updateHistory?: boolean) => void;
|
|
402
402
|
hasContext: (contextKey: string) => boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-multi-router",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3",
|
|
5
5
|
"description": "Vue 3 multi router",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"vue": "^3.5.0",
|
|
51
|
-
"vue-router": "^4.0.0"
|
|
51
|
+
"vue-router": "^4.0.0 || ^5.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"vitepress": "^1.6.3",
|