Skip to content

Commit

Permalink
docs: api updates
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Feb 21, 2024
1 parent 9a8520f commit c9f3e0c
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 1,017 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
"chalk": "^5.3.0",
"enquirer": "^2.4.1",
"execa": "^8.0.1",
"globby": "^14.0.0",
"globby": "^14.0.1",
"lint-staged": "^15.2.0",
"minimist": "^1.2.8",
"p-series": "^3.0.0",
"prettier": "^2.8.8",
"semver": "^7.5.4",
"typedoc": "^0.25.3",
"typedoc": "^0.25.8",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "~5.3.3",
"yorkie": "^2.0.0"
Expand Down
2 changes: 2 additions & 0 deletions packages/docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ ___

`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`; }\>[] } }

Component to display the current route the user is at.

#### Type declaration

**new RouterView**(): `Object`
Expand Down
43 changes: 0 additions & 43 deletions packages/docs/api/interfaces/Router.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ Add a new [route record](../index.md#RouteRecordRaw) as the child of an existing

▸ (): `void`

Add a new [route record](../index.md#RouteRecordRaw) as the child of an existing route.

##### Returns

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

▸ (): `void`

Add a new [route record](../index.md#RouteRecordRaw) to the router.

##### Returns

`void`
Expand Down Expand Up @@ -104,25 +100,10 @@ a function that removes the registered hook

▸ (): `void`

Add a navigation hook that is executed after every navigation. Returns a
function that removes the registered hook.

##### Returns

`void`

a function that removes the registered hook

**`Example`**

```js
router.afterEach((to, from, failure) => {
if (isNavigationFailure(failure)) {
console.log('failed navigation', failure)
}
})
```

**`Example`**

```js
Expand Down Expand Up @@ -167,9 +148,6 @@ function that removes the registered guard.

▸ (): `void`

Add a navigation guard that executes before any navigation. Returns a
function that removes the registered guard.

##### Returns

`void`
Expand Down Expand Up @@ -199,25 +177,10 @@ a function that removes the registered guard

▸ (): `void`

Add a navigation guard that executes before navigation is about to be
resolved. At this state all component have been fetched and other
navigation guards have been successful. Returns a function that removes the
registered guard.

##### Returns

`void`

a function that removes the registered guard

**`Example`**

```js
router.beforeResolve(to => {
if (to.meta.requiresAuth && !isAuthenticated) return false
})
```

**`Example`**

```js
Expand Down Expand Up @@ -332,12 +295,6 @@ is required to render a route.

▸ (): `void`

Adds an error handler that is called every time a non caught error happens
during navigation. This includes errors thrown synchronously and
asynchronously, errors returned or passed to `next` in any navigation
guard, and errors occurred when trying to resolve an async component that
is required to render a route.

##### Returns

`void`
Expand Down
7 changes: 0 additions & 7 deletions packages/docs/api/interfaces/RouterHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,10 @@ a callback to remove the listener

▸ (): `void`

Attach a listener to the History implementation that is triggered when the
navigation is triggered from outside (like the Browser back and forward
buttons) or when passing `true` to RouterHistory.back and
RouterHistory.forward

##### Returns

`void`

a callback to remove the listener

___

### push
Expand Down
20 changes: 20 additions & 0 deletions packages/docs/api/interfaces/RouterOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ ___

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

Custom implementation to parse a query. See its counterpart,
[RouterOptions.stringifyQuery](RouterOptions.md#stringifyQuery).

**`Example`**

Let's say you want to use the [qs package](https://github.com/ljharb/qs)
to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
```js
import qs from 'qs'

createRouter({
// other options...
parseQuery: qs.parse,
stringifyQuery: qs.stringify,
})
```

#### Type declaration

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

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

Custom implementation to stringify a query object. Should not prepend a leading `?`.
[parseQuery](RouterOptions.md#parseQuery) counterpart to handle query parsing.

#### Type declaration

▸ (`query`): `string`
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"docs:preview": "vitepress preview ."
},
"dependencies": {
"simple-git": "^3.18.0",
"vitepress": "1.0.0-rc.35",
"simple-git": "^3.22.0",
"vitepress": "1.0.0-rc.42",
"vitepress-translation-helper": "^0.1.3",
"vue-router": "workspace:*"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vue": "^3.4.19"
},
"devDependencies": {
"@types/node": "^20.10.4",
"@types/node": "^20.11.17",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/compiler-sfc": "^3.4.19",
"@vue/tsconfig": "^0.5.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@
"@vue/devtools-api": "^6.5.1"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.38.5",
"@microsoft/api-extractor": "^7.40.1",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-terser": "^0.4.4",
"@sucrase/jest-plugin": "^3.0.0",
"@types/jest": "^29.5.11",
"@types/jest": "^29.5.12",
"@types/jsdom": "^21.1.6",
"@types/nightwatch": "^2.3.30",
"@vitejs/plugin-vue": "^5.0.4",
Expand Down
Loading

0 comments on commit c9f3e0c

Please sign in to comment.