Skip to content

Commit c9f3e0c

Browse files
committed
docs: api updates
1 parent 9a8520f commit c9f3e0c

File tree

9 files changed

+303
-1017
lines changed

9 files changed

+303
-1017
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
"chalk": "^5.3.0",
3434
"enquirer": "^2.4.1",
3535
"execa": "^8.0.1",
36-
"globby": "^14.0.0",
36+
"globby": "^14.0.1",
3737
"lint-staged": "^15.2.0",
3838
"minimist": "^1.2.8",
3939
"p-series": "^3.0.0",
4040
"prettier": "^2.8.8",
4141
"semver": "^7.5.4",
42-
"typedoc": "^0.25.3",
42+
"typedoc": "^0.25.8",
4343
"typedoc-plugin-markdown": "^3.17.1",
4444
"typescript": "~5.3.3",
4545
"yorkie": "^2.0.0"

packages/docs/api/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ ___
132132

133133
`Const` **RouterView**: () => \{ `$props`: `AllowedComponentProps` & `ComponentCustomProps` & `VNodeProps` & [`RouterViewProps`](interfaces/RouterViewProps.md) ; `$slots`: \{ `default?`: (`__namedParameters`: \{ `Component`: `VNode`\<`RendererNode`, `RendererElement`, \{ `[key: string]`: `any`; }\> ; `route`: [`RouteLocationNormalizedLoaded`](interfaces/RouteLocationNormalizedLoaded.md) }) => `VNode`\<`RendererNode`, `RendererElement`, \{ `[key: string]`: `any`; }\>[] } }
134134

135+
Component to display the current route the user is at.
136+
135137
#### Type declaration
136138

137139
**new RouterView**(): `Object`

packages/docs/api/interfaces/Router.md

-43
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ Add a new [route record](../index.md#RouteRecordRaw) as the child of an existing
5353

5454
▸ (): `void`
5555

56-
Add a new [route record](../index.md#RouteRecordRaw) as the child of an existing route.
57-
5856
##### Returns
5957

6058
`void`
@@ -75,8 +73,6 @@ Add a new [route record](../index.md#RouteRecordRaw) to the router.
7573

7674
▸ (): `void`
7775

78-
Add a new [route record](../index.md#RouteRecordRaw) to the router.
79-
8076
##### Returns
8177

8278
`void`
@@ -104,25 +100,10 @@ a function that removes the registered hook
104100

105101
▸ (): `void`
106102

107-
Add a navigation hook that is executed after every navigation. Returns a
108-
function that removes the registered hook.
109-
110103
##### Returns
111104

112105
`void`
113106

114-
a function that removes the registered hook
115-
116-
**`Example`**
117-
118-
```js
119-
router.afterEach((to, from, failure) => {
120-
if (isNavigationFailure(failure)) {
121-
console.log('failed navigation', failure)
122-
}
123-
})
124-
```
125-
126107
**`Example`**
127108

128109
```js
@@ -167,9 +148,6 @@ function that removes the registered guard.
167148

168149
▸ (): `void`
169150

170-
Add a navigation guard that executes before any navigation. Returns a
171-
function that removes the registered guard.
172-
173151
##### Returns
174152

175153
`void`
@@ -199,25 +177,10 @@ a function that removes the registered guard
199177

200178
▸ (): `void`
201179

202-
Add a navigation guard that executes before navigation is about to be
203-
resolved. At this state all component have been fetched and other
204-
navigation guards have been successful. Returns a function that removes the
205-
registered guard.
206-
207180
##### Returns
208181

209182
`void`
210183

211-
a function that removes the registered guard
212-
213-
**`Example`**
214-
215-
```js
216-
router.beforeResolve(to => {
217-
if (to.meta.requiresAuth && !isAuthenticated) return false
218-
})
219-
```
220-
221184
**`Example`**
222185

223186
```js
@@ -332,12 +295,6 @@ is required to render a route.
332295

333296
▸ (): `void`
334297

335-
Adds an error handler that is called every time a non caught error happens
336-
during navigation. This includes errors thrown synchronously and
337-
asynchronously, errors returned or passed to `next` in any navigation
338-
guard, and errors occurred when trying to resolve an async component that
339-
is required to render a route.
340-
341298
##### Returns
342299

343300
`void`

packages/docs/api/interfaces/RouterHistory.md

-7
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,10 @@ a callback to remove the listener
116116

117117
▸ (): `void`
118118

119-
Attach a listener to the History implementation that is triggered when the
120-
navigation is triggered from outside (like the Browser back and forward
121-
buttons) or when passing `true` to RouterHistory.back and
122-
RouterHistory.forward
123-
124119
##### Returns
125120

126121
`void`
127122

128-
a callback to remove the listener
129-
130123
___
131124

132125
### push

packages/docs/api/interfaces/RouterOptions.md

+20
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@ ___
7575

7676
`Optional` **parseQuery**: (`search`: `string`) => [`LocationQuery`](../index.md#LocationQuery)
7777

78+
Custom implementation to parse a query. See its counterpart,
79+
[RouterOptions.stringifyQuery](RouterOptions.md#stringifyQuery).
80+
81+
**`Example`**
82+
83+
Let's say you want to use the [qs package](https://github.com/ljharb/qs)
84+
to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
85+
```js
86+
import qs from 'qs'
87+
88+
createRouter({
89+
// other options...
90+
parseQuery: qs.parse,
91+
stringifyQuery: qs.stringify,
92+
})
93+
```
94+
7895
#### Type declaration
7996

8097
▸ (`search`): [`LocationQuery`](../index.md#LocationQuery)
@@ -170,6 +187,9 @@ ___
170187

171188
`Optional` **stringifyQuery**: (`query`: [`LocationQueryRaw`](../index.md#LocationQueryRaw)) => `string`
172189

190+
Custom implementation to stringify a query object. Should not prepend a leading `?`.
191+
[parseQuery](RouterOptions.md#parseQuery) counterpart to handle query parsing.
192+
173193
#### Type declaration
174194

175195
▸ (`query`): `string`

packages/docs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"docs:preview": "vitepress preview ."
1414
},
1515
"dependencies": {
16-
"simple-git": "^3.18.0",
17-
"vitepress": "1.0.0-rc.35",
16+
"simple-git": "^3.22.0",
17+
"vitepress": "1.0.0-rc.42",
1818
"vitepress-translation-helper": "^0.1.3",
1919
"vue-router": "workspace:*"
2020
}

packages/playground/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"vue": "^3.4.19"
1313
},
1414
"devDependencies": {
15-
"@types/node": "^20.10.4",
15+
"@types/node": "^20.11.17",
1616
"@vitejs/plugin-vue": "^5.0.4",
1717
"@vue/compiler-sfc": "^3.4.19",
1818
"@vue/tsconfig": "^0.5.1",

packages/router/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@
118118
"@vue/devtools-api": "^6.5.1"
119119
},
120120
"devDependencies": {
121-
"@microsoft/api-extractor": "^7.38.5",
121+
"@microsoft/api-extractor": "^7.40.1",
122122
"@rollup/plugin-alias": "^5.1.0",
123123
"@rollup/plugin-commonjs": "^25.0.7",
124124
"@rollup/plugin-node-resolve": "^15.2.3",
125125
"@rollup/plugin-replace": "^5.0.5",
126126
"@rollup/plugin-terser": "^0.4.4",
127127
"@sucrase/jest-plugin": "^3.0.0",
128-
"@types/jest": "^29.5.11",
128+
"@types/jest": "^29.5.12",
129129
"@types/jsdom": "^21.1.6",
130130
"@types/nightwatch": "^2.3.30",
131131
"@vitejs/plugin-vue": "^5.0.4",

0 commit comments

Comments
 (0)