]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: ignore api changes for the moment
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 28 Feb 2022 16:38:51 +0000 (17:38 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 28 Feb 2022 16:38:51 +0000 (17:38 +0100)
24 files changed:
netlify.toml
packages/docs/api/enums/pinia.MutationType.md [new file with mode: 0644]
packages/docs/api/index.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.DefineSetupStoreOptions.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.DefineStoreOptions.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.DefineStoreOptionsBase.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.DefineStoreOptionsInPlugin.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.MapStoresCustomization.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.Pinia.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.PiniaCustomProperties.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.PiniaCustomStateProperties.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.PiniaPlugin.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.PiniaPluginContext.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.StoreDefinition.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.StoreProperties.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationDirect.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchFunction.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchObject.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia._StoreWithState.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia._SubscriptionCallbackMutationBase.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia_testing.TestingOptions.md [new file with mode: 0644]
packages/docs/api/interfaces/pinia_testing.TestingPinia.md [new file with mode: 0644]
packages/docs/api/modules/pinia.md [new file with mode: 0644]
packages/docs/api/modules/pinia_testing.md [new file with mode: 0644]

index ab1e137dfe741f28aadd2c6267362b57d20e6cba..64e4ae0a770fe941f9b3d40d4b4b907bb33c3ee7 100644 (file)
@@ -1,4 +1,4 @@
 [build]
-command = "yarn run docs:api && yarn run docs:build"
+command = "yarn run docs:build"
 ignore = "./scripts/docs-check.sh"
 publish = "packages/docs/.vitepress/dist"
diff --git a/packages/docs/api/enums/pinia.MutationType.md b/packages/docs/api/enums/pinia.MutationType.md
new file mode 100644 (file)
index 0000000..cf1347a
--- /dev/null
@@ -0,0 +1,57 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / MutationType
+
+# Enumeration: MutationType
+
+[pinia](../modules/pinia.md).MutationType
+
+Possible types for SubscriptionCallback
+
+## Enumeration members
+
+### direct
+
+• **direct** = `"direct"`
+
+Direct mutation of the state:
+
+- `store.name = 'new name'`
+- `store.$state.name = 'new name'`
+- `store.list.push('new item')`
+
+#### Defined in
+
+[pinia/src/types.ts:50](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L50)
+
+___
+
+### patchFunction
+
+• **patchFunction** = `"patch function"`
+
+Mutated the state with `$patch` and a function
+
+- `store.$patch(state => state.name = 'newName')`
+
+#### Defined in
+
+[pinia/src/types.ts:64](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L64)
+
+___
+
+### patchObject
+
+• **patchObject** = `"patch object"`
+
+Mutated the state with `$patch` and an object
+
+- `store.$patch({ name: 'newName' })`
+
+#### Defined in
+
+[pinia/src/types.ts:57](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L57)
diff --git a/packages/docs/api/index.md b/packages/docs/api/index.md
new file mode 100644 (file)
index 0000000..fe54079
--- /dev/null
@@ -0,0 +1,8 @@
+API Documentation
+
+# API Documentation
+
+## Modules
+
+- [@pinia/testing](modules/pinia_testing.md)
+- [pinia](modules/pinia.md)
diff --git a/packages/docs/api/interfaces/pinia.DefineSetupStoreOptions.md b/packages/docs/api/interfaces/pinia.DefineSetupStoreOptions.md
new file mode 100644 (file)
index 0000000..e6557ae
--- /dev/null
@@ -0,0 +1,43 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / DefineSetupStoreOptions
+
+# Interface: DefineSetupStoreOptions<Id, S, G, A\>
+
+[pinia](../modules/pinia.md).DefineSetupStoreOptions
+
+Options parameter of `defineStore()` for setup stores. Can be extended to
+augment stores with the plugin API. @see [DefineStoreOptionsBase](pinia.DefineStoreOptionsBase.md).
+
+## Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `Id` | extends `string` |
+| `S` | extends [`StateTree`](../modules/pinia.md#statetree) |
+| `G` | `G` |
+| `A` | `A` |
+
+## Hierarchy
+
+- [`DefineStoreOptionsBase`](pinia.DefineStoreOptionsBase.md)<`S`, [`Store`](../modules/pinia.md#store)<`Id`, `S`, `G`, `A`\>\>
+
+  ↳ **`DefineSetupStoreOptions`**
+
+## Properties
+
+### actions
+
+• `Optional` **actions**: `A`
+
+Extracted actions. Added by useStore(). SHOULD NOT be added by the user when
+creating the store. Can be used in plugins to get the list of actions in a
+store defined with a setup function. Note this is always defined
+
+#### Defined in
+
+[pinia/src/types.ts:706](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L706)
diff --git a/packages/docs/api/interfaces/pinia.DefineStoreOptions.md b/packages/docs/api/interfaces/pinia.DefineStoreOptions.md
new file mode 100644 (file)
index 0000000..5bcaa90
--- /dev/null
@@ -0,0 +1,123 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / DefineStoreOptions
+
+# Interface: DefineStoreOptions<Id, S, G, A\>
+
+[pinia](../modules/pinia.md).DefineStoreOptions
+
+Options parameter of `defineStore()` for option stores. Can be extended to
+augment stores with the plugin API. @see [DefineStoreOptionsBase](pinia.DefineStoreOptionsBase.md).
+
+## Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `Id` | extends `string` |
+| `S` | extends [`StateTree`](../modules/pinia.md#statetree) |
+| `G` | `G` |
+| `A` | `A` |
+
+## Hierarchy
+
+- [`DefineStoreOptionsBase`](pinia.DefineStoreOptionsBase.md)<`S`, [`Store`](../modules/pinia.md#store)<`Id`, `S`, `G`, `A`\>\>
+
+  ↳ **`DefineStoreOptions`**
+
+## Properties
+
+### actions
+
+• `Optional` **actions**: `A` & `ThisType`<`A` & `UnwrapRef`<`S`\> & [`_StoreWithState`](pinia._StoreWithState.md)<`Id`, `S`, `G`, `A`\> & `_StoreWithGetters`<`G`\> & [`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), `_GettersTree`<[`StateTree`](../modules/pinia.md#statetree)\>, `_ActionsTree`\>\>
+
+Optional object of actions.
+
+#### Defined in
+
+[pinia/src/types.ts:654](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L654)
+
+___
+
+### getters
+
+• `Optional` **getters**: `G` & `ThisType`<`UnwrapRef`<`S`\> & `_StoreWithGetters`<`G`\> & [`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), `_GettersTree`<[`StateTree`](../modules/pinia.md#statetree)\>, `_ActionsTree`\>\> & `_GettersTree`<`S`\>
+
+Optional object of getters.
+
+#### Defined in
+
+[pinia/src/types.ts:647](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L647)
+
+___
+
+### id
+
+• **id**: `Id`
+
+Unique string key to identify the store across the application.
+
+#### Defined in
+
+[pinia/src/types.ts:636](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L636)
+
+## Methods
+
+### hydrate
+
+▸ `Optional` **hydrate**(`storeState`, `initialState`): `void`
+
+Allows hydrating the store during SSR when complex state (like client side only refs) are used in the store
+definition and copying the value from `pinia.state` isn't enough.
+
+**`example`**
+If in your `state`, you use any `customRef`s, any `computed`s, or any `ref`s that have a different value on
+Server and Client, you need to manually hydrate them. e.g., a custom ref that is stored in the local
+storage:
+
+```ts
+const useStore = defineStore('main', {
+  state: () => ({
+    n: useLocalStorage('key', 0)
+  }),
+  hydrate(storeState, initialState) {
+    // @ts-expect-error: https://github.com/microsoft/TypeScript/issues/43826
+    storeState.n = useLocalStorage('key', 0)
+  }
+})
+```
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `storeState` | `UnwrapRef`<`S`\> | the current state in the store |
+| `initialState` | `UnwrapRef`<`S`\> | initialState |
+
+#### Returns
+
+`void`
+
+#### Defined in
+
+[pinia/src/types.ts:687](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L687)
+
+___
+
+### state
+
+▸ `Optional` **state**(): `S`
+
+Function to create a fresh state. **Must be an arrow function** to ensure
+correct typings!
+
+#### Returns
+
+`S`
+
+#### Defined in
+
+[pinia/src/types.ts:642](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L642)
diff --git a/packages/docs/api/interfaces/pinia.DefineStoreOptionsBase.md b/packages/docs/api/interfaces/pinia.DefineStoreOptionsBase.md
new file mode 100644 (file)
index 0000000..7a319ed
--- /dev/null
@@ -0,0 +1,30 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / DefineStoreOptionsBase
+
+# Interface: DefineStoreOptionsBase<S, Store\>
+
+[pinia](../modules/pinia.md).DefineStoreOptionsBase
+
+Options passed to `defineStore()` that are common between option and setup
+stores. Extend this interface if you want to add custom options to both kinds
+of stores.
+
+## Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `S` | extends [`StateTree`](../modules/pinia.md#statetree) |
+| `Store` | `Store` |
+
+## Hierarchy
+
+- **`DefineStoreOptionsBase`**
+
+  ↳ [`DefineStoreOptions`](pinia.DefineStoreOptions.md)
+
+  ↳ [`DefineSetupStoreOptions`](pinia.DefineSetupStoreOptions.md)
diff --git a/packages/docs/api/interfaces/pinia.DefineStoreOptionsInPlugin.md b/packages/docs/api/interfaces/pinia.DefineStoreOptionsInPlugin.md
new file mode 100644 (file)
index 0000000..13689f5
--- /dev/null
@@ -0,0 +1,124 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / DefineStoreOptionsInPlugin
+
+# Interface: DefineStoreOptionsInPlugin<Id, S, G, A\>
+
+[pinia](../modules/pinia.md).DefineStoreOptionsInPlugin
+
+Available `options` when creating a pinia plugin.
+
+## Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `Id` | extends `string` |
+| `S` | extends [`StateTree`](../modules/pinia.md#statetree) |
+| `G` | `G` |
+| `A` | `A` |
+
+## Hierarchy
+
+- `Omit`<[`DefineStoreOptions`](pinia.DefineStoreOptions.md)<`Id`, `S`, `G`, `A`\>, ``"id"`` \| ``"actions"``\>
+
+  ↳ **`DefineStoreOptionsInPlugin`**
+
+## Properties
+
+### actions
+
+• **actions**: `A`
+
+Extracted object of actions. Added by useStore() when the store is built
+using the setup API, otherwise uses the one passed to `defineStore()`.
+Defaults to an empty object if no actions are defined.
+
+#### Defined in
+
+[pinia/src/types.ts:723](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L723)
+
+___
+
+### getters
+
+• `Optional` **getters**: `G` & `ThisType`<`UnwrapRef`<`S`\> & `_StoreWithGetters`<`G`\> & [`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), `_GettersTree`<[`StateTree`](../modules/pinia.md#statetree)\>, `_ActionsTree`\>\> & `_GettersTree`<`S`\>
+
+Optional object of getters.
+
+#### Inherited from
+
+Omit.getters
+
+#### Defined in
+
+[pinia/src/types.ts:647](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L647)
+
+## Methods
+
+### hydrate
+
+▸ `Optional` **hydrate**(`storeState`, `initialState`): `void`
+
+Allows hydrating the store during SSR when complex state (like client side only refs) are used in the store
+definition and copying the value from `pinia.state` isn't enough.
+
+**`example`**
+If in your `state`, you use any `customRef`s, any `computed`s, or any `ref`s that have a different value on
+Server and Client, you need to manually hydrate them. e.g., a custom ref that is stored in the local
+storage:
+
+```ts
+const useStore = defineStore('main', {
+  state: () => ({
+    n: useLocalStorage('key', 0)
+  }),
+  hydrate(storeState, initialState) {
+    // @ts-expect-error: https://github.com/microsoft/TypeScript/issues/43826
+    storeState.n = useLocalStorage('key', 0)
+  }
+})
+```
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `storeState` | `UnwrapRef`<`S`\> | the current state in the store |
+| `initialState` | `UnwrapRef`<`S`\> | initialState |
+
+#### Returns
+
+`void`
+
+#### Inherited from
+
+Omit.hydrate
+
+#### Defined in
+
+[pinia/src/types.ts:687](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L687)
+
+___
+
+### state
+
+▸ `Optional` **state**(): `S`
+
+Function to create a fresh state. **Must be an arrow function** to ensure
+correct typings!
+
+#### Returns
+
+`S`
+
+#### Inherited from
+
+Omit.state
+
+#### Defined in
+
+[pinia/src/types.ts:642](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L642)
diff --git a/packages/docs/api/interfaces/pinia.MapStoresCustomization.md b/packages/docs/api/interfaces/pinia.MapStoresCustomization.md
new file mode 100644 (file)
index 0000000..7271366
--- /dev/null
@@ -0,0 +1,16 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / MapStoresCustomization
+
+# Interface: MapStoresCustomization
+
+[pinia](../modules/pinia.md).MapStoresCustomization
+
+Interface to allow customizing map helpers. Extend this interface with the
+following properties:
+
+- `suffix`: string. Affects the suffix of `mapStores()`, defaults to `Store`.
diff --git a/packages/docs/api/interfaces/pinia.Pinia.md b/packages/docs/api/interfaces/pinia.Pinia.md
new file mode 100644 (file)
index 0000000..bc391fe
--- /dev/null
@@ -0,0 +1,73 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / Pinia
+
+# Interface: Pinia
+
+[pinia](../modules/pinia.md).Pinia
+
+Every application must own its own pinia to be able to create stores
+
+## Hierarchy
+
+- **`Pinia`**
+
+  ↳ [`TestingPinia`](pinia_testing.TestingPinia.md)
+
+## Properties
+
+### state
+
+• **state**: `Ref`<`Record`<`string`, [`StateTree`](../modules/pinia.md#statetree)\>\>
+
+root state
+
+#### Defined in
+
+[pinia/src/rootStore.ts:51](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L51)
+
+## Methods
+
+### install
+
+▸ **install**(`app`): `void`
+
+#### Parameters
+
+| Name | Type |
+| :------ | :------ |
+| `app` | `App`<`any`\> |
+
+#### Returns
+
+`void`
+
+#### Defined in
+
+[pinia/src/rootStore.ts:46](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L46)
+
+___
+
+### use
+
+▸ **use**(`plugin`): [`Pinia`](pinia.Pinia.md)
+
+Adds a store plugin to extend every store
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `plugin` | [`PiniaPlugin`](pinia.PiniaPlugin.md) | store plugin to add |
+
+#### Returns
+
+[`Pinia`](pinia.Pinia.md)
+
+#### Defined in
+
+[pinia/src/rootStore.ts:58](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L58)
diff --git a/packages/docs/api/interfaces/pinia.PiniaCustomProperties.md b/packages/docs/api/interfaces/pinia.PiniaCustomProperties.md
new file mode 100644 (file)
index 0000000..8743ec2
--- /dev/null
@@ -0,0 +1,144 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / PiniaCustomProperties
+
+# Interface: PiniaCustomProperties<Id, S, G, A\>
+
+[pinia](../modules/pinia.md).PiniaCustomProperties
+
+Interface to be extended by the user when they add properties through plugins.
+
+## Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `Id` | extends `string` = `string` |
+| `S` | extends [`StateTree`](../modules/pinia.md#statetree) = [`StateTree`](../modules/pinia.md#statetree) |
+| `G` | `_GettersTree`<`S`\> |
+| `A` | `_ActionsTree` |
+
+## Properties
+
+### $nuxt
+
+• **$nuxt**: `Context`
+
+Nuxt context.
+
+#### Defined in
+
+[nuxt/src/module.ts:68](https://github.com/posva/pinia/blob/46c50b2/packages/nuxt/src/module.ts#L68)
+
+___
+
+### double
+
+• **double**: `number`
+
+#### Defined in
+
+[pinia/__tests__/storePlugins.spec.ts:14](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/__tests__/storePlugins.spec.ts#L14)
+
+___
+
+### globalA
+
+• **globalA**: `string`
+
+#### Defined in
+
+[pinia/__tests__/storePlugins.spec.ts:11](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/__tests__/storePlugins.spec.ts#L11)
+
+___
+
+### globalB
+
+• **globalB**: `string`
+
+#### Defined in
+
+[pinia/__tests__/storePlugins.spec.ts:12](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/__tests__/storePlugins.spec.ts#L12)
+
+___
+
+### hasApp
+
+• **hasApp**: `boolean`
+
+#### Defined in
+
+[pinia/__tests__/storePlugins.spec.ts:9](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/__tests__/storePlugins.spec.ts#L9)
+
+___
+
+### idFromPlugin
+
+• **idFromPlugin**: `Id`
+
+#### Defined in
+
+[pinia/__tests__/storePlugins.spec.ts:10](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/__tests__/storePlugins.spec.ts#L10)
+
+___
+
+### pluginN
+
+• **pluginN**: `number`
+
+#### Defined in
+
+[pinia/__tests__/storePlugins.spec.ts:7](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/__tests__/storePlugins.spec.ts#L7)
+
+___
+
+### shared
+
+• **shared**: `number`
+
+#### Defined in
+
+[pinia/__tests__/storePlugins.spec.ts:13](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/__tests__/storePlugins.spec.ts#L13)
+
+___
+
+### uid
+
+• **uid**: `number`
+
+#### Defined in
+
+[pinia/__tests__/storePlugins.spec.ts:8](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/__tests__/storePlugins.spec.ts#L8)
+
+## Accessors
+
+### route
+
+• `get` **route**(): `RouteLocationNormalized`
+
+#### Returns
+
+`RouteLocationNormalized`
+
+#### Defined in
+
+[playground/src/main.ts:17](https://github.com/posva/pinia/blob/46c50b2/packages/playground/src/main.ts#L17)
+
+• `set` **route**(`value`): `void`
+
+#### Parameters
+
+| Name | Type |
+| :------ | :------ |
+| `value` | `RouteLocationNormalizedLoaded` \| `Ref`<`RouteLocationNormalizedLoaded`\> |
+
+#### Returns
+
+`void`
+
+#### Defined in
+
+[playground/src/main.ts:14](https://github.com/posva/pinia/blob/46c50b2/packages/playground/src/main.ts#L14)
diff --git a/packages/docs/api/interfaces/pinia.PiniaCustomStateProperties.md b/packages/docs/api/interfaces/pinia.PiniaCustomStateProperties.md
new file mode 100644 (file)
index 0000000..adc8533
--- /dev/null
@@ -0,0 +1,19 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / PiniaCustomStateProperties
+
+# Interface: PiniaCustomStateProperties<S\>
+
+[pinia](../modules/pinia.md).PiniaCustomStateProperties
+
+Properties that are added to every `store.$state` by `pinia.use()`.
+
+## Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `S` | extends [`StateTree`](../modules/pinia.md#statetree) = [`StateTree`](../modules/pinia.md#statetree) |
diff --git a/packages/docs/api/interfaces/pinia.PiniaPlugin.md b/packages/docs/api/interfaces/pinia.PiniaPlugin.md
new file mode 100644 (file)
index 0000000..bf2818c
--- /dev/null
@@ -0,0 +1,34 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / PiniaPlugin
+
+# Interface: PiniaPlugin
+
+[pinia](../modules/pinia.md).PiniaPlugin
+
+## Callable
+
+### PiniaPlugin
+
+▸ **PiniaPlugin**(`context`): `void` \| `Partial`<[`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), `_GettersTree`<[`StateTree`](../modules/pinia.md#statetree)\>, `_ActionsTree`\> & `PiniaCustomStateProperties`<[`StateTree`](../modules/pinia.md#statetree)\>\>
+
+Plugin to extend every store. Returns an object to extend the store or
+nothing.
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `context` | [`PiniaPluginContext`](pinia.PiniaPluginContext.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), `_GettersTree`<[`StateTree`](../modules/pinia.md#statetree)\>, `_ActionsTree`\> | Context |
+
+#### Returns
+
+`void` \| `Partial`<[`PiniaCustomProperties`](pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](../modules/pinia.md#statetree), `_GettersTree`<[`StateTree`](../modules/pinia.md#statetree)\>, `_ActionsTree`\> & `PiniaCustomStateProperties`<[`StateTree`](../modules/pinia.md#statetree)\>\>
+
+#### Defined in
+
+[pinia/src/rootStore.ts:140](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L140)
diff --git a/packages/docs/api/interfaces/pinia.PiniaPluginContext.md b/packages/docs/api/interfaces/pinia.PiniaPluginContext.md
new file mode 100644 (file)
index 0000000..c17aa15
--- /dev/null
@@ -0,0 +1,70 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / PiniaPluginContext
+
+# Interface: PiniaPluginContext<Id, S, G, A\>
+
+[pinia](../modules/pinia.md).PiniaPluginContext
+
+Context argument passed to Pinia plugins.
+
+## Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `Id` | extends `string` = `string` |
+| `S` | extends [`StateTree`](../modules/pinia.md#statetree) = [`StateTree`](../modules/pinia.md#statetree) |
+| `G` | `_GettersTree`<`S`\> |
+| `A` | `_ActionsTree` |
+
+## Properties
+
+### app
+
+• **app**: `App`<`any`\>
+
+Current app created with `Vue.createApp()`.
+
+#### Defined in
+
+[pinia/src/rootStore.ts:117](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L117)
+
+___
+
+### options
+
+• **options**: [`DefineStoreOptionsInPlugin`](pinia.DefineStoreOptionsInPlugin.md)<`Id`, `S`, `G`, `A`\>
+
+Current store being extended.
+
+#### Defined in
+
+[pinia/src/rootStore.ts:127](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L127)
+
+___
+
+### pinia
+
+• **pinia**: [`Pinia`](pinia.Pinia.md)
+
+pinia instance.
+
+#### Defined in
+
+[pinia/src/rootStore.ts:112](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L112)
+
+___
+
+### store
+
+• **store**: [`Store`](../modules/pinia.md#store)<`Id`, `S`, `G`, `A`\>
+
+Current store being extended.
+
+#### Defined in
+
+[pinia/src/rootStore.ts:122](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L122)
diff --git a/packages/docs/api/interfaces/pinia.StoreDefinition.md b/packages/docs/api/interfaces/pinia.StoreDefinition.md
new file mode 100644 (file)
index 0000000..933888d
--- /dev/null
@@ -0,0 +1,55 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / StoreDefinition
+
+# Interface: StoreDefinition<Id, S, G, A\>
+
+[pinia](../modules/pinia.md).StoreDefinition
+
+## Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `Id` | extends `string` = `string` |
+| `S` | extends [`StateTree`](../modules/pinia.md#statetree) = [`StateTree`](../modules/pinia.md#statetree) |
+| `G` | `_GettersTree`<`S`\> |
+| `A` | `_ActionsTree` |
+
+## Callable
+
+### StoreDefinition
+
+▸ **StoreDefinition**(`pinia?`, `hot?`): [`Store`](../modules/pinia.md#store)<`Id`, `S`, `G`, `A`\>
+
+Returns a store, creates it if necessary.
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `pinia?` | ``null`` \| [`Pinia`](pinia.Pinia.md) | Pinia instance to retrieve the store |
+| `hot?` | [`StoreGeneric`](../modules/pinia.md#storegeneric) | dev only hot module replacement |
+
+#### Returns
+
+[`Store`](../modules/pinia.md#store)<`Id`, `S`, `G`, `A`\>
+
+#### Defined in
+
+[pinia/src/types.ts:513](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L513)
+
+## Properties
+
+### $id
+
+• **$id**: `Id`
+
+Id of the store. Used by map helpers.
+
+#### Defined in
+
+[pinia/src/types.ts:518](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L518)
diff --git a/packages/docs/api/interfaces/pinia.StoreProperties.md b/packages/docs/api/interfaces/pinia.StoreProperties.md
new file mode 100644 (file)
index 0000000..f662fb7
--- /dev/null
@@ -0,0 +1,37 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / StoreProperties
+
+# Interface: StoreProperties<Id\>
+
+[pinia](../modules/pinia.md).StoreProperties
+
+Properties of a store.
+
+## Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `Id` | extends `string` |
+
+## Hierarchy
+
+- **`StoreProperties`**
+
+  ↳ [`_StoreWithState`](pinia._StoreWithState.md)
+
+## Properties
+
+### $id
+
+• **$id**: `Id`
+
+Unique identifier of the store
+
+#### Defined in
+
+[pinia/src/types.ts:265](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L265)
diff --git a/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationDirect.md b/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationDirect.md
new file mode 100644 (file)
index 0000000..2cc90de
--- /dev/null
@@ -0,0 +1,65 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / SubscriptionCallbackMutationDirect
+
+# Interface: SubscriptionCallbackMutationDirect
+
+[pinia](../modules/pinia.md).SubscriptionCallbackMutationDirect
+
+Context passed to a subscription callback when directly mutating the state of
+a store with `store.someState = newValue` or `store.$state.someState =
+newValue`.
+
+## Hierarchy
+
+- [`_SubscriptionCallbackMutationBase`](pinia._SubscriptionCallbackMutationBase.md)
+
+  ↳ **`SubscriptionCallbackMutationDirect`**
+
+## Properties
+
+### events
+
+• **events**: `DebuggerEvent`
+
+DEV ONLY. Different mutation calls.
+
+#### Defined in
+
+[pinia/src/types.ts:96](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L96)
+
+___
+
+### storeId
+
+• **storeId**: `string`
+
+`id` of the store doing the mutation.
+
+#### Inherited from
+
+[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[storeId](pinia._SubscriptionCallbackMutationBase.md#storeid)
+
+#### Defined in
+
+[pinia/src/types.ts:81](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L81)
+
+___
+
+### type
+
+• **type**: [`direct`](../enums/pinia.MutationType.md#direct)
+
+Type of the mutation.
+
+#### Overrides
+
+[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[type](pinia._SubscriptionCallbackMutationBase.md#type)
+
+#### Defined in
+
+[pinia/src/types.ts:91](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L91)
diff --git a/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchFunction.md b/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchFunction.md
new file mode 100644 (file)
index 0000000..d9881f9
--- /dev/null
@@ -0,0 +1,64 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / SubscriptionCallbackMutationPatchFunction
+
+# Interface: SubscriptionCallbackMutationPatchFunction
+
+[pinia](../modules/pinia.md).SubscriptionCallbackMutationPatchFunction
+
+Context passed to a subscription callback when `store.$patch()` is called
+with a function.
+
+## Hierarchy
+
+- [`_SubscriptionCallbackMutationBase`](pinia._SubscriptionCallbackMutationBase.md)
+
+  ↳ **`SubscriptionCallbackMutationPatchFunction`**
+
+## Properties
+
+### events
+
+• **events**: `DebuggerEvent`[]
+
+DEV ONLY. Array of all the mutations done inside of the callback.
+
+#### Defined in
+
+[pinia/src/types.ts:129](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L129)
+
+___
+
+### storeId
+
+• **storeId**: `string`
+
+`id` of the store doing the mutation.
+
+#### Inherited from
+
+[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[storeId](pinia._SubscriptionCallbackMutationBase.md#storeid)
+
+#### Defined in
+
+[pinia/src/types.ts:81](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L81)
+
+___
+
+### type
+
+• **type**: [`patchFunction`](../enums/pinia.MutationType.md#patchfunction)
+
+Type of the mutation.
+
+#### Overrides
+
+[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[type](pinia._SubscriptionCallbackMutationBase.md#type)
+
+#### Defined in
+
+[pinia/src/types.ts:124](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L124)
diff --git a/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchObject.md b/packages/docs/api/interfaces/pinia.SubscriptionCallbackMutationPatchObject.md
new file mode 100644 (file)
index 0000000..d4ab5df
--- /dev/null
@@ -0,0 +1,82 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / SubscriptionCallbackMutationPatchObject
+
+# Interface: SubscriptionCallbackMutationPatchObject<S\>
+
+[pinia](../modules/pinia.md).SubscriptionCallbackMutationPatchObject
+
+Context passed to a subscription callback when `store.$patch()` is called
+with an object.
+
+## Type parameters
+
+| Name |
+| :------ |
+| `S` |
+
+## Hierarchy
+
+- [`_SubscriptionCallbackMutationBase`](pinia._SubscriptionCallbackMutationBase.md)
+
+  ↳ **`SubscriptionCallbackMutationPatchObject`**
+
+## Properties
+
+### events
+
+• **events**: `DebuggerEvent`[]
+
+DEV ONLY. Array for patch calls.
+
+#### Defined in
+
+[pinia/src/types.ts:110](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L110)
+
+___
+
+### payload
+
+• **payload**: `_DeepPartial`<`S`\>
+
+Object passed to `store.$patch()`.
+
+#### Defined in
+
+[pinia/src/types.ts:115](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L115)
+
+___
+
+### storeId
+
+• **storeId**: `string`
+
+`id` of the store doing the mutation.
+
+#### Inherited from
+
+[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[storeId](pinia._SubscriptionCallbackMutationBase.md#storeid)
+
+#### Defined in
+
+[pinia/src/types.ts:81](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L81)
+
+___
+
+### type
+
+• **type**: [`patchObject`](../enums/pinia.MutationType.md#patchobject)
+
+Type of the mutation.
+
+#### Overrides
+
+[_SubscriptionCallbackMutationBase](pinia._SubscriptionCallbackMutationBase.md).[type](pinia._SubscriptionCallbackMutationBase.md#type)
+
+#### Defined in
+
+[pinia/src/types.ts:105](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L105)
diff --git a/packages/docs/api/interfaces/pinia._StoreWithState.md b/packages/docs/api/interfaces/pinia._StoreWithState.md
new file mode 100644 (file)
index 0000000..cedd754
--- /dev/null
@@ -0,0 +1,271 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / \_StoreWithState
+
+# Interface: \_StoreWithState<Id, S, G, A\>
+
+[pinia](../modules/pinia.md)._StoreWithState
+
+Base store with state and functions. Should not be used directly.
+
+## Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `Id` | extends `string` |
+| `S` | extends [`StateTree`](../modules/pinia.md#statetree) |
+| `G` | `G` |
+| `A` | `A` |
+
+## Hierarchy
+
+- [`StoreProperties`](pinia.StoreProperties.md)<`Id`\>
+
+  ↳ **`_StoreWithState`**
+
+## Properties
+
+### $id
+
+• **$id**: `Id`
+
+Unique identifier of the store
+
+#### Inherited from
+
+[StoreProperties](pinia.StoreProperties.md).[$id](pinia.StoreProperties.md#$id)
+
+#### Defined in
+
+[pinia/src/types.ts:265](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L265)
+
+___
+
+### $state
+
+• **$state**: `UnwrapRef`<`S`\> & `PiniaCustomStateProperties`<`S`\>
+
+State of the Store. Setting it will replace the whole state.
+
+#### Defined in
+
+[pinia/src/types.ts:337](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L337)
+
+## Methods
+
+### $dispose
+
+▸ **$dispose**(): `void`
+
+Stops the associated effect scope of the store and remove it from the store
+registry. Plugins can override this method to cleanup any added effects.
+e.g. devtools plugin stops displaying disposed stores from devtools.
+
+#### Returns
+
+`void`
+
+#### Defined in
+
+[pinia/src/types.ts:425](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L425)
+
+___
+
+### $onAction
+
+▸ **$onAction**(`callback`, `detached?`): () => `void`
+
+Setups a callback to be called every time an action is about to get
+invoked. The callback receives an object with all the relevant information
+of the invoked action:
+- `store`: the store it is invoked on
+- `name`: The name of the action
+- `args`: The parameters passed to the action
+
+On top of these, it receives two functions that allow setting up a callback
+once the action finishes or when it fails.
+
+It also returns a function to remove the callback. Note than when calling
+`store.$onAction()` inside of a component, it will be automatically cleanup
+up when the component gets unmounted unless `detached` is set to true.
+
+**`example`**
+
+```js
+store.$onAction(({ after, onError }) => {
+ // Here you could share variables between all of the hooks as well as
+ // setting up watchers and clean them up
+ after((resolvedValue) => {
+   // can be used to cleanup side effects
+.  // `resolvedValue` is the value returned by the action, if it's a
+.  // Promise, it will be the resolved value instead of the Promise
+ })
+ onError((error) => {
+   // can be used to pass up errors
+ })
+})
+```
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `callback` | [`StoreOnActionListener`](../modules/pinia.md#storeonactionlistener)<`Id`, `S`, `G`, `A`\> | callback called before every action |
+| `detached?` | `boolean` | detach the subscription from the context this is called from |
+
+#### Returns
+
+`fn`
+
+function that removes the watcher
+
+▸ (): `void`
+
+Setups a callback to be called every time an action is about to get
+invoked. The callback receives an object with all the relevant information
+of the invoked action:
+- `store`: the store it is invoked on
+- `name`: The name of the action
+- `args`: The parameters passed to the action
+
+On top of these, it receives two functions that allow setting up a callback
+once the action finishes or when it fails.
+
+It also returns a function to remove the callback. Note than when calling
+`store.$onAction()` inside of a component, it will be automatically cleanup
+up when the component gets unmounted unless `detached` is set to true.
+
+**`example`**
+
+```js
+store.$onAction(({ after, onError }) => {
+ // Here you could share variables between all of the hooks as well as
+ // setting up watchers and clean them up
+ after((resolvedValue) => {
+   // can be used to cleanup side effects
+.  // `resolvedValue` is the value returned by the action, if it's a
+.  // Promise, it will be the resolved value instead of the Promise
+ })
+ onError((error) => {
+   // can be used to pass up errors
+ })
+})
+```
+
+##### Returns
+
+`void`
+
+function that removes the watcher
+
+#### Defined in
+
+[pinia/src/types.ts:415](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L415)
+
+___
+
+### $patch
+
+▸ **$patch**(`partialState`): `void`
+
+Applies a state patch to current state. Allows passing nested values
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `partialState` | `_DeepPartial`<`UnwrapRef`<`S`\>\> | patch to apply to the state |
+
+#### Returns
+
+`void`
+
+#### Defined in
+
+[pinia/src/types.ts:344](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L344)
+
+▸ **$patch**<`F`\>(`stateMutator`): `void`
+
+Group multiple changes into one function. Useful when mutating objects like
+Sets or arrays and applying an object patch isn't practical, e.g. appending
+to an array. The function passed to `$patch()` **must be synchronous**.
+
+#### Type parameters
+
+| Name | Type |
+| :------ | :------ |
+| `F` | extends (`state`: `UnwrapRef`<`S`\>) => `any` |
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `stateMutator` | `ReturnType`<`F`\> extends `Promise`<`any`\> ? `never` : `F` | function that mutates `state`, cannot be async |
+
+#### Returns
+
+`void`
+
+#### Defined in
+
+[pinia/src/types.ts:353](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L353)
+
+___
+
+### $reset
+
+▸ **$reset**(): `void`
+
+Resets the store to its initial state by building a new state object.
+TODO: make this options only
+
+#### Returns
+
+`void`
+
+#### Defined in
+
+[pinia/src/types.ts:362](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L362)
+
+___
+
+### $subscribe
+
+▸ **$subscribe**(`callback`, `options?`): () => `void`
+
+Setups a callback to be called whenever the state changes. It also returns a function to remove the callback. Note
+than when calling `store.$subscribe()` inside of a component, it will be automatically cleanup up when the
+component gets unmounted unless `detached` is set to true.
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `callback` | [`SubscriptionCallback`](../modules/pinia.md#subscriptioncallback)<`S`\> | callback passed to the watcher |
+| `options?` | { `detached?`: `boolean`  } & `WatchOptions`<`boolean`\> | `watch` options + `detached` to detach the subscription from the context (usually a component) this is called from. Note that the `flush` option does not affect calls to `store.$patch()`. |
+
+#### Returns
+
+`fn`
+
+function that removes the watcher
+
+▸ (): `void`
+
+Setups a callback to be called whenever the state changes. It also returns a function to remove the callback. Note
+than when calling `store.$subscribe()` inside of a component, it will be automatically cleanup up when the
+component gets unmounted unless `detached` is set to true.
+
+##### Returns
+
+`void`
+
+function that removes the watcher
+
+#### Defined in
+
+[pinia/src/types.ts:374](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L374)
diff --git a/packages/docs/api/interfaces/pinia._SubscriptionCallbackMutationBase.md b/packages/docs/api/interfaces/pinia._SubscriptionCallbackMutationBase.md
new file mode 100644 (file)
index 0000000..ef598ee
--- /dev/null
@@ -0,0 +1,47 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [pinia](../modules/pinia.md) / \_SubscriptionCallbackMutationBase
+
+# Interface: \_SubscriptionCallbackMutationBase
+
+[pinia](../modules/pinia.md)._SubscriptionCallbackMutationBase
+
+Base type for the context passed to a subscription callback. Internal type.
+
+## Hierarchy
+
+- **`_SubscriptionCallbackMutationBase`**
+
+  ↳ [`SubscriptionCallbackMutationDirect`](pinia.SubscriptionCallbackMutationDirect.md)
+
+  ↳ [`SubscriptionCallbackMutationPatchFunction`](pinia.SubscriptionCallbackMutationPatchFunction.md)
+
+  ↳ [`SubscriptionCallbackMutationPatchObject`](pinia.SubscriptionCallbackMutationPatchObject.md)
+
+## Properties
+
+### storeId
+
+• **storeId**: `string`
+
+`id` of the store doing the mutation.
+
+#### Defined in
+
+[pinia/src/types.ts:81](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L81)
+
+___
+
+### type
+
+• **type**: [`MutationType`](../enums/pinia.MutationType.md)
+
+Type of the mutation.
+
+#### Defined in
+
+[pinia/src/types.ts:76](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L76)
diff --git a/packages/docs/api/interfaces/pinia_testing.TestingOptions.md b/packages/docs/api/interfaces/pinia_testing.TestingOptions.md
new file mode 100644 (file)
index 0000000..3899e7d
--- /dev/null
@@ -0,0 +1,117 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [@pinia/testing](../modules/pinia_testing.md) / TestingOptions
+
+# Interface: TestingOptions
+
+[@pinia/testing](../modules/pinia_testing.md).TestingOptions
+
+## Properties
+
+### fakeApp
+
+• `Optional` **fakeApp**: `boolean`
+
+Creates an empty App and calls `app.use(pinia)` with the created testing
+pinia. This is allows you to use plugins while unit testing stores as
+plugins **will wait for pinia to be installed in order to be executed**.
+Defaults to false.
+
+#### Defined in
+
+[testing/src/testing.ts:45](https://github.com/posva/pinia/blob/46c50b2/packages/testing/src/testing.ts#L45)
+
+___
+
+### initialState
+
+• `Optional` **initialState**: [`StateTree`](../modules/pinia.md#statetree)
+
+Allows defining a partial initial state of all your stores. This state gets applied after a store is created,
+allowing you to only set a few properties that are required in your test.
+
+#### Defined in
+
+[testing/src/testing.ts:15](https://github.com/posva/pinia/blob/46c50b2/packages/testing/src/testing.ts#L15)
+
+___
+
+### plugins
+
+• `Optional` **plugins**: [`PiniaPlugin`](pinia.PiniaPlugin.md)[]
+
+Plugins to be installed before the testing plugin. Add any plugins used in
+your application that will be used while testing.
+
+#### Defined in
+
+[testing/src/testing.ts:21](https://github.com/posva/pinia/blob/46c50b2/packages/testing/src/testing.ts#L21)
+
+___
+
+### stubActions
+
+• `Optional` **stubActions**: `boolean`
+
+When set to false, actions are only spied, they still get executed. When
+set to true, actions will be replaced with spies, resulting in their code
+not being executed. Defaults to true. NOTE: when providing `createSpy()`,
+it will **only** make the `fn` argument `undefined`. You still have to
+handle this in `createSpy()`.
+
+#### Defined in
+
+[testing/src/testing.ts:30](https://github.com/posva/pinia/blob/46c50b2/packages/testing/src/testing.ts#L30)
+
+___
+
+### stubPatch
+
+• `Optional` **stubPatch**: `boolean`
+
+When set to true, calls to `$patch()` won't change the state. Defaults to
+false. NOTE: when providing `createSpy()`, it will **only** make the `fn`
+argument `undefined`. You still have to handle this in `createSpy()`.
+
+#### Defined in
+
+[testing/src/testing.ts:37](https://github.com/posva/pinia/blob/46c50b2/packages/testing/src/testing.ts#L37)
+
+## Methods
+
+### createSpy
+
+▸ `Optional` **createSpy**(`fn?`): (...`args`: `any`[]) => `any`
+
+Function used to create a spy for actions and `$patch()`. Pre-configured
+with `jest.fn()` in jest projects.
+
+#### Parameters
+
+| Name | Type |
+| :------ | :------ |
+| `fn?` | (...`args`: `any`[]) => `any` |
+
+#### Returns
+
+`fn`
+
+▸ (...`args`): `any`
+
+##### Parameters
+
+| Name | Type |
+| :------ | :------ |
+| `...args` | `any`[] |
+
+##### Returns
+
+`any`
+
+#### Defined in
+
+[testing/src/testing.ts:51](https://github.com/posva/pinia/blob/46c50b2/packages/testing/src/testing.ts#L51)
diff --git a/packages/docs/api/interfaces/pinia_testing.TestingPinia.md b/packages/docs/api/interfaces/pinia_testing.TestingPinia.md
new file mode 100644 (file)
index 0000000..6d7e67f
--- /dev/null
@@ -0,0 +1,98 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / [@pinia/testing](../modules/pinia_testing.md) / TestingPinia
+
+# Interface: TestingPinia
+
+[@pinia/testing](../modules/pinia_testing.md).TestingPinia
+
+Pinia instance specifically designed for testing. Extends a regular
+[Pinia](pinia.Pinia.md) instance with test specific properties.
+
+## Hierarchy
+
+- [`Pinia`](pinia.Pinia.md)
+
+  ↳ **`TestingPinia`**
+
+## Properties
+
+### app
+
+• **app**: `App`<`any`\>
+
+App used by Pinia
+
+#### Defined in
+
+[testing/src/testing.ts:60](https://github.com/posva/pinia/blob/46c50b2/packages/testing/src/testing.ts#L60)
+
+___
+
+### state
+
+• **state**: `Ref`<`Record`<`string`, [`StateTree`](../modules/pinia.md#statetree)\>\>
+
+root state
+
+#### Inherited from
+
+[Pinia](pinia.Pinia.md).[state](pinia.Pinia.md#state)
+
+#### Defined in
+
+[pinia/src/rootStore.ts:51](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L51)
+
+## Methods
+
+### install
+
+▸ **install**(`app`): `void`
+
+#### Parameters
+
+| Name | Type |
+| :------ | :------ |
+| `app` | `App`<`any`\> |
+
+#### Returns
+
+`void`
+
+#### Inherited from
+
+[Pinia](pinia.Pinia.md).[install](pinia.Pinia.md#install)
+
+#### Defined in
+
+[pinia/src/rootStore.ts:46](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L46)
+
+___
+
+### use
+
+▸ **use**(`plugin`): [`Pinia`](pinia.Pinia.md)
+
+Adds a store plugin to extend every store
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `plugin` | [`PiniaPlugin`](pinia.PiniaPlugin.md) | store plugin to add |
+
+#### Returns
+
+[`Pinia`](pinia.Pinia.md)
+
+#### Inherited from
+
+[Pinia](pinia.Pinia.md).[use](pinia.Pinia.md#use)
+
+#### Defined in
+
+[pinia/src/rootStore.ts:58](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L58)
diff --git a/packages/docs/api/modules/pinia.md b/packages/docs/api/modules/pinia.md
new file mode 100644 (file)
index 0000000..d51244c
--- /dev/null
@@ -0,0 +1,953 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / pinia
+
+# Module: pinia
+
+## Enumerations
+
+- [MutationType](../enums/pinia.MutationType.md)
+
+## Interfaces
+
+- [DefineSetupStoreOptions](../interfaces/pinia.DefineSetupStoreOptions.md)
+- [DefineStoreOptions](../interfaces/pinia.DefineStoreOptions.md)
+- [DefineStoreOptionsBase](../interfaces/pinia.DefineStoreOptionsBase.md)
+- [DefineStoreOptionsInPlugin](../interfaces/pinia.DefineStoreOptionsInPlugin.md)
+- [MapStoresCustomization](../interfaces/pinia.MapStoresCustomization.md)
+- [Pinia](../interfaces/pinia.Pinia.md)
+- [PiniaCustomProperties](../interfaces/pinia.PiniaCustomProperties.md)
+- [PiniaCustomStateProperties](../interfaces/pinia.PiniaCustomStateProperties.md)
+- [PiniaPlugin](../interfaces/pinia.PiniaPlugin.md)
+- [PiniaPluginContext](../interfaces/pinia.PiniaPluginContext.md)
+- [StoreDefinition](../interfaces/pinia.StoreDefinition.md)
+- [StoreProperties](../interfaces/pinia.StoreProperties.md)
+- [SubscriptionCallbackMutationDirect](../interfaces/pinia.SubscriptionCallbackMutationDirect.md)
+- [SubscriptionCallbackMutationPatchFunction](../interfaces/pinia.SubscriptionCallbackMutationPatchFunction.md)
+- [SubscriptionCallbackMutationPatchObject](../interfaces/pinia.SubscriptionCallbackMutationPatchObject.md)
+- [\_StoreWithState](../interfaces/pinia._StoreWithState.md)
+- [\_SubscriptionCallbackMutationBase](../interfaces/pinia._SubscriptionCallbackMutationBase.md)
+
+## Type aliases
+
+### PiniaStorePlugin
+
+Ƭ **PiniaStorePlugin**: [`PiniaPlugin`](../interfaces/pinia.PiniaPlugin.md)
+
+Plugin to extend every store.
+
+**`deprecated`** use PiniaPlugin instead
+
+#### Defined in
+
+[pinia/src/rootStore.ts:149](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L149)
+
+___
+
+### StateTree
+
+Ƭ **StateTree**: `Record`<`string` \| `number` \| `symbol`, `any`\>
+
+Generic state of a Store
+
+#### Defined in
+
+[pinia/src/types.ts:13](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L13)
+
+___
+
+### Store
+
+Ƭ **Store**<`Id`, `S`, `G`, `A`\>: [`_StoreWithState`](../interfaces/pinia._StoreWithState.md)<`Id`, `S`, `G`, `A`\> & `UnwrapRef`<`S`\> & `_StoreWithGetters`<`G`\> & `_ActionsTree` extends `A` ? {} : `A` & [`PiniaCustomProperties`](../interfaces/pinia.PiniaCustomProperties.md)<`Id`, `S`, `G`, `A`\> & `PiniaCustomStateProperties`<`S`\>
+
+Store type to build a store.
+
+#### Type parameters
+
+| Name | Type                                           |
+| :--- | :--------------------------------------------- |
+| `Id` | extends `string` = `string`                    |
+| `S`  | extends [`StateTree`](pinia.md#statetree) = {} |
+| `G`  | {}                                             |
+| `A`  | {}                                             |
+
+#### Defined in
+
+[pinia/src/types.ts:472](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L472)
+
+___
+
+### StoreActions
+
+Ƭ **StoreActions**<`SS`\>: `SS` extends [`Store`](pinia.md#store)<`string`, [`StateTree`](pinia.md#statetree), `_GettersTree`<[`StateTree`](pinia.md#statetree)\>, infer A\> ? `A` : `_ExtractActionsFromSetupStore`<`SS`\>
+
+Extract the actions of a store type. Works with both a Setup Store or an
+Options Store.
+
+#### Type parameters
+
+| Name |
+| :--- |
+| `SS` |
+
+#### Defined in
+
+[pinia/src/store.ts:727](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/store.ts#L727)
+
+___
+
+### StoreGeneric
+
+Ƭ **StoreGeneric**: [`Store`](pinia.md#store)<`string`, [`StateTree`](pinia.md#statetree), `_GettersTree`<[`StateTree`](pinia.md#statetree)\>, `_ActionsTree`\>
+
+Generic and type-unsafe version of Store. Doesn't fail on access with
+strings, making it much easier to write generic functions that do not care
+about the kind of store that is passed.
+
+#### Defined in
+
+[pinia/src/types.ts:491](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L491)
+
+___
+
+### StoreGetters
+
+Ƭ **StoreGetters**<`SS`\>: `SS` extends [`Store`](pinia.md#store)<`string`, [`StateTree`](pinia.md#statetree), infer G, `_ActionsTree`\> ? `_StoreWithGetters`<`G`\> : `_ExtractGettersFromSetupStore`<`SS`\>
+
+Extract the getters of a store type. Works with both a Setup Store or an
+Options Store.
+
+#### Type parameters
+
+| Name |
+| :--- |
+| `SS` |
+
+#### Defined in
+
+[pinia/src/store.ts:740](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/store.ts#L740)
+
+___
+
+### StoreOnActionListener
+
+Ƭ **StoreOnActionListener**<`Id`, `S`, `G`, `A`\>: (`context`: [`StoreOnActionListenerContext`](pinia.md#storeonactionlistenercontext)<`Id`, `S`, `G`, {} extends `A` ? `_ActionsTree` : `A`\>) => `void`
+
+#### Type parameters
+
+| Name | Type                                      |
+| :--- | :---------------------------------------- |
+| `Id` | extends `string`                          |
+| `S`  | extends [`StateTree`](pinia.md#statetree) |
+| `G`  | `G`                                       |
+| `A`  | `A`                                       |
+
+#### Type declaration
+
+▸ (`context`): `void`
+
+Argument of `store.$onAction()`
+
+##### Parameters
+
+| Name      | Type                                                                                                                            |
+| :-------- | :------------------------------------------------------------------------------------------------------------------------------ |
+| `context` | [`StoreOnActionListenerContext`](pinia.md#storeonactionlistenercontext)<`Id`, `S`, `G`, {} extends `A` ? `_ActionsTree` : `A`\> |
+
+##### Returns
+
+`void`
+
+#### Defined in
+
+[pinia/src/types.ts:243](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L243)
+
+___
+
+### StoreOnActionListenerContext
+
+Ƭ **StoreOnActionListenerContext**<`Id`, `S`, `G`, `A`\>: `_ActionsTree` extends `A` ? `_StoreOnActionListenerContext`<[`StoreGeneric`](pinia.md#storegeneric), `string`, `_ActionsTree`\> : { [Name in keyof A]: Name extends string ? \_StoreOnActionListenerContext<Store<Id, S, G, A\>, Name, A\> : never }[keyof `A`]
+
+Context object passed to callbacks of `store.$onAction(context => {})`
+TODO: should have only the Id, the Store and Actions to generate the proper object
+
+#### Type parameters
+
+| Name | Type                                      |
+| :--- | :---------------------------------------- |
+| `Id` | extends `string`                          |
+| `S`  | extends [`StateTree`](pinia.md#statetree) |
+| `G`  | `G`                                       |
+| `A`  | `A`                                       |
+
+#### Defined in
+
+[pinia/src/types.ts:227](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L227)
+
+___
+
+### StoreState
+
+Ƭ **StoreState**<`SS`\>: `SS` extends [`Store`](pinia.md#store)<`string`, infer S, `_GettersTree`<[`StateTree`](pinia.md#statetree)\>, `_ActionsTree`\> ? `UnwrapRef`<`S`\> : `_ExtractStateFromSetupStore`<`SS`\>
+
+Extract the state of a store type. Works with both a Setup Store or an
+Options Store. Note this unwraps refs.
+
+#### Type parameters
+
+| Name |
+| :--- |
+| `SS` |
+
+#### Defined in
+
+[pinia/src/store.ts:753](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/store.ts#L753)
+
+___
+
+### SubscriptionCallback
+
+Ƭ **SubscriptionCallback**<`S`\>: (`mutation`: [`SubscriptionCallbackMutation`](pinia.md#subscriptioncallbackmutation)<`S`\>, `state`: `UnwrapRef`<`S`\>) => `void`
+
+#### Type parameters
+
+| Name |
+| :--- |
+| `S`  |
+
+#### Type declaration
+
+▸ (`mutation`, `state`): `void`
+
+Callback of a subscription
+
+##### Parameters
+
+| Name       | Type                                                                          |
+| :--------- | :---------------------------------------------------------------------------- |
+| `mutation` | [`SubscriptionCallbackMutation`](pinia.md#subscriptioncallbackmutation)<`S`\> |
+| `state`    | `UnwrapRef`<`S`\>                                                             |
+
+##### Returns
+
+`void`
+
+#### Defined in
+
+[pinia/src/types.ts:148](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L148)
+
+___
+
+### SubscriptionCallbackMutation
+
+Ƭ **SubscriptionCallbackMutation**<`S`\>: [`SubscriptionCallbackMutationDirect`](../interfaces/pinia.SubscriptionCallbackMutationDirect.md) \| [`SubscriptionCallbackMutationPatchObject`](../interfaces/pinia.SubscriptionCallbackMutationPatchObject.md)<`S`\> \| [`SubscriptionCallbackMutationPatchFunction`](../interfaces/pinia.SubscriptionCallbackMutationPatchFunction.md)
+
+Context object passed to a subscription callback.
+
+#### Type parameters
+
+| Name |
+| :--- |
+| `S`  |
+
+#### Defined in
+
+[pinia/src/types.ts:140](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L140)
+
+___
+
+### \_Awaited
+
+Ƭ **\_Awaited**<`T`\>: `T` extends ``null`` \| `undefined` ? `T` : `T` extends `object` & { `then`: (`onfulfilled`: `F`) => `any`  } ? `F` extends (`value`: infer V, ...`args`: `any`) => `any` ? [`_Awaited`](pinia.md#_awaited)<`V`\> : `never` : `T`
+
+#### Type parameters
+
+| Name |
+| :--- |
+| `T`  |
+
+#### Defined in
+
+[pinia/src/types.ts:164](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/types.ts#L164)
+
+## Variables
+
+### PiniaVuePlugin
+
+• **PiniaVuePlugin**: `Plugin`
+
+Vue 2 Plugin that must be installed for pinia to work. Note **you don't need
+this plugin if you are using Nuxt.js**. Use the `buildModule` instead:
+https://pinia.vuejs.org/ssr/nuxt.html.
+
+**`example`**
+```js
+import Vue from 'vue'
+import { PiniaVuePlugin, createPinia } from 'pinia'
+
+Vue.use(PiniaVuePlugin)
+const pinia = createPinia()
+
+new Vue({
+  el: '#app',
+  // ...
+  pinia,
+})
+```
+
+**`param`** `Vue` imported from 'vue'.
+
+#### Defined in
+
+[pinia/src/vue2-plugin.ts:28](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/vue2-plugin.ts#L28)
+
+## Functions
+
+### acceptHMRUpdate
+
+▸ **acceptHMRUpdate**(`initialUseStore`, `hot`): (`newModule`: `any`) => `any`
+
+Creates an _accept_ function to pass to `import.meta.hot` in Vite applications.
+
+**`example`**
+```js
+const useUser = defineStore(...)
+if (import.meta.hot) {
+  import.meta.hot.accept(acceptHMRUpdate(useUser, import.meta.hot))
+}
+```
+
+#### Parameters
+
+| Name              | Type                                                                                                                                                                          | Description                             |
+| :---------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------- |
+| `initialUseStore` | [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`string`, [`StateTree`](pinia.md#statetree), `_GettersTree`<[`StateTree`](pinia.md#statetree)\>, `_ActionsTree`\> | return of the defineStore to hot update |
+| `hot`             | `any`                                                                                                                                                                         | `import.meta.hot`                       |
+
+#### Returns
+
+`fn`
+
+▸ (`newModule`): `any`
+
+##### Parameters
+
+| Name        | Type  |
+| :---------- | :---- |
+| `newModule` | `any` |
+
+##### Returns
+
+`any`
+
+#### Defined in
+
+[pinia/src/hmr.ts:73](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/hmr.ts#L73)
+
+___
+
+### createPinia
+
+▸ **createPinia**(): [`Pinia`](../interfaces/pinia.Pinia.md)
+
+Creates a Pinia instance to be used by the application
+
+#### Returns
+
+[`Pinia`](../interfaces/pinia.Pinia.md)
+
+#### Defined in
+
+[pinia/src/createPinia.ts:10](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/createPinia.ts#L10)
+
+___
+
+### defineStore
+
+▸ **defineStore**<`Id`, `S`, `G`, `A`\>(`id`, `options`): [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\>
+
+Creates a `useStore` function that retrieves the store instance
+
+#### Type parameters
+
+| Name | Type                                           |
+| :--- | :--------------------------------------------- |
+| `Id` | extends `string`                               |
+| `S`  | extends [`StateTree`](pinia.md#statetree) = {} |
+| `G`  | extends `_GettersTree`<`S`\> = {}              |
+| `A`  | {}                                             |
+
+#### Parameters
+
+| Name      | Type                                                                                                       | Description                      |
+| :-------- | :--------------------------------------------------------------------------------------------------------- | :------------------------------- |
+| `id`      | `Id`                                                                                                       | id of the store (must be unique) |
+| `options` | `Omit`<[`DefineStoreOptions`](../interfaces/pinia.DefineStoreOptions.md)<`Id`, `S`, `G`, `A`\>, ``"id"``\> | options to define the store      |
+
+#### Returns
+
+[`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\>
+
+#### Defined in
+
+[pinia/src/store.ts:776](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/store.ts#L776)
+
+▸ **defineStore**<`Id`, `S`, `G`, `A`\>(`options`): [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\>
+
+Creates a `useStore` function that retrieves the store instance
+
+#### Type parameters
+
+| Name | Type                                           |
+| :--- | :--------------------------------------------- |
+| `Id` | extends `string`                               |
+| `S`  | extends [`StateTree`](pinia.md#statetree) = {} |
+| `G`  | extends `_GettersTree`<`S`\> = {}              |
+| `A`  | {}                                             |
+
+#### Parameters
+
+| Name      | Type                                                                                    | Description                 |
+| :-------- | :-------------------------------------------------------------------------------------- | :-------------------------- |
+| `options` | [`DefineStoreOptions`](../interfaces/pinia.DefineStoreOptions.md)<`Id`, `S`, `G`, `A`\> | options to define the store |
+
+#### Returns
+
+[`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\>
+
+#### Defined in
+
+[pinia/src/store.ts:792](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/store.ts#L792)
+
+▸ **defineStore**<`Id`, `SS`\>(`id`, `storeSetup`, `options?`): [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `_ExtractStateFromSetupStore`<`SS`\>, `_ExtractGettersFromSetupStore`<`SS`\>, `_ExtractActionsFromSetupStore`<`SS`\>\>
+
+Creates a `useStore` function that retrieves the store instance
+
+#### Type parameters
+
+| Name | Type             |
+| :--- | :--------------- |
+| `Id` | extends `string` |
+| `SS` | `SS`             |
+
+#### Parameters
+
+| Name         | Type                                                                                                                                                                                                     | Description                      |
+| :----------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------- |
+| `id`         | `Id`                                                                                                                                                                                                     | id of the store (must be unique) |
+| `storeSetup` | () => `SS`                                                                                                                                                                                               | function that defines the store  |
+| `options?`   | [`DefineSetupStoreOptions`](../interfaces/pinia.DefineSetupStoreOptions.md)<`Id`, `_ExtractStateFromSetupStore`<`SS`\>, `_ExtractGettersFromSetupStore`<`SS`\>, `_ExtractActionsFromSetupStore`<`SS`\>\> | extra options                    |
+
+#### Returns
+
+[`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `_ExtractStateFromSetupStore`<`SS`\>, `_ExtractGettersFromSetupStore`<`SS`\>, `_ExtractActionsFromSetupStore`<`SS`\>\>
+
+#### Defined in
+
+[pinia/src/store.ts:807](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/store.ts#L807)
+
+___
+
+### getActivePinia
+
+▸ `Const` **getActivePinia**(): `undefined` \| [`Pinia`](../interfaces/pinia.Pinia.md)
+
+Get the currently active pinia if there is any.
+
+#### Returns
+
+`undefined` \| [`Pinia`](../interfaces/pinia.Pinia.md)
+
+#### Defined in
+
+[pinia/src/rootStore.ts:39](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L39)
+
+___
+
+### mapActions
+
+▸ **mapActions**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): `_MapActionsObjectReturn`<`A`, `KeyMapper`\>
+
+Allows directly using actions from your store without using the composition
+API (`setup()`) by generating an object to be spread in the `methods` field
+of a component. The values of the object are the actions while the keys are
+the names of the resulting methods.
+
+**`example`**
+```js
+export default {
+  methods: {
+    // other methods properties
+    // useCounterStore has two actions named `increment` and `setCount`
+    ...mapActions(useCounterStore, { moar: 'increment', setIt: 'setCount' })
+  },
+
+  created() {
+    this.moar()
+    this.setIt(2)
+  }
+}
+```
+
+#### Type parameters
+
+| Name        | Type                                      |
+| :---------- | :---------------------------------------- |
+| `Id`        | extends `string`                          |
+| `S`         | extends [`StateTree`](pinia.md#statetree) |
+| `G`         | extends `_GettersTree`<`S`\>              |
+| `A`         | `A`                                       |
+| `KeyMapper` | extends `Record`<`string`, keyof `A`\>    |
+
+#### Parameters
+
+| Name        | Type                                                                              | Description                                |
+| :---------- | :-------------------------------------------------------------------------------- | :----------------------------------------- |
+| `useStore`  | [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\> | store to map from                          |
+| `keyMapper` | `KeyMapper`                                                                       | object to define new names for the actions |
+
+#### Returns
+
+`_MapActionsObjectReturn`<`A`, `KeyMapper`\>
+
+#### Defined in
+
+[pinia/src/mapHelpers.ts:326](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/mapHelpers.ts#L326)
+
+▸ **mapActions**<`Id`, `S`, `G`, `A`\>(`useStore`, `keys`): `_MapActionsReturn`<`A`\>
+
+Allows directly using actions from your store without using the composition
+API (`setup()`) by generating an object to be spread in the `methods` field
+of a component.
+
+**`example`**
+```js
+export default {
+  methods: {
+    // other methods properties
+    ...mapActions(useCounterStore, ['increment', 'setCount'])
+  },
+
+  created() {
+    this.increment()
+    this.setCount(2) // pass arguments as usual
+  }
+}
+```
+
+#### Type parameters
+
+| Name | Type                                      |
+| :--- | :---------------------------------------- |
+| `Id` | extends `string`                          |
+| `S`  | extends [`StateTree`](pinia.md#statetree) |
+| `G`  | extends `_GettersTree`<`S`\>              |
+| `A`  | `A`                                       |
+
+#### Parameters
+
+| Name       | Type                                                                              | Description                  |
+| :--------- | :-------------------------------------------------------------------------------- | :--------------------------- |
+| `useStore` | [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\> | store to map from            |
+| `keys`     | keyof `A`[]                                                                       | array of action names to map |
+
+#### Returns
+
+`_MapActionsReturn`<`A`\>
+
+#### Defined in
+
+[pinia/src/mapHelpers.ts:359](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/mapHelpers.ts#L359)
+
+___
+
+### mapGetters
+
+▸ `Const` **mapGetters**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): `_MapStateObjectReturn`<`Id`, `S`, `G`, `A`, `KeyMapper`\>
+
+Alias for `mapState()`. You should use `mapState()` instead.
+
+**`deprecated`** use `mapState()` instead.
+
+#### Type parameters
+
+| Name        | Type                                                                                                                       |
+| :---------- | :------------------------------------------------------------------------------------------------------------------------- |
+| `Id`        | extends `string`                                                                                                           |
+| `S`         | extends [`StateTree`](pinia.md#statetree)                                                                                  |
+| `G`         | extends `_GettersTree`<`S`\>                                                                                               |
+| `A`         | `A`                                                                                                                        |
+| `KeyMapper` | extends `Record`<`string`, keyof `S` \| keyof `G` \| (`store`: [`Store`](pinia.md#store)<`Id`, `S`, `G`, `A`\>) => `any`\> |
+
+#### Parameters
+
+| Name        | Type                                                                              |
+| :---------- | :-------------------------------------------------------------------------------- |
+| `useStore`  | [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\> |
+| `keyMapper` | `KeyMapper`                                                                       |
+
+#### Returns
+
+`_MapStateObjectReturn`<`Id`, `S`, `G`, `A`, `KeyMapper`\>
+
+#### Defined in
+
+[pinia/src/mapHelpers.ts:285](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/mapHelpers.ts#L285)
+
+▸ `Const` **mapGetters**<`Id`, `S`, `G`, `A`, `Keys`\>(`useStore`, `keys`): `_MapStateReturn`<`S`, `G`, `Keys`\>
+
+Alias for `mapState()`. You should use `mapState()` instead.
+
+**`deprecated`** use `mapState()` instead.
+
+#### Type parameters
+
+| Name   | Type                                      |
+| :----- | :---------------------------------------- |
+| `Id`   | extends `string`                          |
+| `S`    | extends [`StateTree`](pinia.md#statetree) |
+| `G`    | extends `_GettersTree`<`S`\>              |
+| `A`    | `A`                                       |
+| `Keys` | extends `string` \| `number` \| `symbol`  |
+
+#### Parameters
+
+| Name       | Type                                                                              |
+| :--------- | :-------------------------------------------------------------------------------- |
+| `useStore` | [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\> |
+| `keys`     | readonly `Keys`[]                                                                 |
+
+#### Returns
+
+`_MapStateReturn`<`S`, `G`, `Keys`\>
+
+#### Defined in
+
+[pinia/src/mapHelpers.ts:285](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/mapHelpers.ts#L285)
+
+___
+
+### mapState
+
+▸ **mapState**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): `_MapStateObjectReturn`<`Id`, `S`, `G`, `A`, `KeyMapper`\>
+
+Allows using state and getters from one store without using the composition
+API (`setup()`) by generating an object to be spread in the `computed` field
+of a component. The values of the object are the state properties/getters
+while the keys are the names of the resulting computed properties.
+Optionally, you can also pass a custom function that will receive the store
+as its first argument. Note that while it has access to the component
+instance via `this`, it won't be typed.
+
+**`example`**
+```js
+export default {
+  computed: {
+    // other computed properties
+    // useCounterStore has a state property named `count` and a getter `double`
+    ...mapState(useCounterStore, {
+      n: 'count',
+      triple: store => store.n * 3,
+      // note we can't use an arrow function if we want to use `this`
+      custom(store) {
+        return this.someComponentValue + store.n
+      },
+      doubleN: 'double'
+    })
+  },
+
+  created() {
+    this.n // 2
+    this.doubleN // 4
+  }
+}
+```
+
+#### Type parameters
+
+| Name        | Type                                                                                                                       |
+| :---------- | :------------------------------------------------------------------------------------------------------------------------- |
+| `Id`        | extends `string`                                                                                                           |
+| `S`         | extends [`StateTree`](pinia.md#statetree)                                                                                  |
+| `G`         | extends `_GettersTree`<`S`\>                                                                                               |
+| `A`         | `A`                                                                                                                        |
+| `KeyMapper` | extends `Record`<`string`, keyof `S` \| keyof `G` \| (`store`: [`Store`](pinia.md#store)<`Id`, `S`, `G`, `A`\>) => `any`\> |
+
+#### Parameters
+
+| Name        | Type                                                                              | Description                           |
+| :---------- | :-------------------------------------------------------------------------------- | :------------------------------------ |
+| `useStore`  | [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\> | store to map from                     |
+| `keyMapper` | `KeyMapper`                                                                       | object of state properties or getters |
+
+#### Returns
+
+`_MapStateObjectReturn`<`Id`, `S`, `G`, `A`, `KeyMapper`\>
+
+#### Defined in
+
+[pinia/src/mapHelpers.ts:194](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/mapHelpers.ts#L194)
+
+▸ **mapState**<`Id`, `S`, `G`, `A`, `Keys`\>(`useStore`, `keys`): `_MapStateReturn`<`S`, `G`, `Keys`\>
+
+Allows using state and getters from one store without using the composition
+API (`setup()`) by generating an object to be spread in the `computed` field
+of a component.
+
+**`example`**
+```js
+export default {
+  computed: {
+    // other computed properties
+    ...mapState(useCounterStore, ['count', 'double'])
+  },
+
+  created() {
+    this.count // 2
+    this.double // 4
+  }
+}
+```
+
+#### Type parameters
+
+| Name   | Type                                      |
+| :----- | :---------------------------------------- |
+| `Id`   | extends `string`                          |
+| `S`    | extends [`StateTree`](pinia.md#statetree) |
+| `G`    | extends `_GettersTree`<`S`\>              |
+| `A`    | `A`                                       |
+| `Keys` | extends `string` \| `number` \| `symbol`  |
+
+#### Parameters
+
+| Name       | Type                                                                              | Description                          |
+| :--------- | :-------------------------------------------------------------------------------- | :----------------------------------- |
+| `useStore` | [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\> | store to map from                    |
+| `keys`     | readonly `Keys`[]                                                                 | array of state properties or getters |
+
+#### Returns
+
+`_MapStateReturn`<`S`, `G`, `Keys`\>
+
+#### Defined in
+
+[pinia/src/mapHelpers.ts:231](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/mapHelpers.ts#L231)
+
+___
+
+### mapStores
+
+▸ **mapStores**<`Stores`\>(...`stores`): `_Spread`<`Stores`\>
+
+Allows using stores without the composition API (`setup()`) by generating an
+object to be spread in the `computed` field of a component. It accepts a list
+of store definitions.
+
+**`example`**
+```js
+export default {
+  computed: {
+    // other computed properties
+    ...mapStores(useUserStore, useCartStore)
+  },
+
+  created() {
+    this.userStore // store with id "user"
+    this.cartStore // store with id "cart"
+  }
+}
+```
+
+#### Type parameters
+
+| Name     | Type            |
+| :------- | :-------------- |
+| `Stores` | extends `any`[] |
+
+#### Parameters
+
+| Name        | Type          | Description                        |
+| :---------- | :------------ | :--------------------------------- |
+| `...stores` | [...Stores[]] | list of stores to map to an object |
+
+#### Returns
+
+`_Spread`<`Stores`\>
+
+#### Defined in
+
+[pinia/src/mapHelpers.ts:96](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/mapHelpers.ts#L96)
+
+___
+
+### mapWritableState
+
+▸ **mapWritableState**<`Id`, `S`, `G`, `A`, `KeyMapper`\>(`useStore`, `keyMapper`): `_MapWritableStateObjectReturn`<`S`, `KeyMapper`\>
+
+Same as `mapState()` but creates computed setters as well so the state can be
+modified. Differently from `mapState()`, only `state` properties can be
+added.
+
+#### Type parameters
+
+| Name        | Type                                      |
+| :---------- | :---------------------------------------- |
+| `Id`        | extends `string`                          |
+| `S`         | extends [`StateTree`](pinia.md#statetree) |
+| `G`         | extends `_GettersTree`<`S`\>              |
+| `A`         | `A`                                       |
+| `KeyMapper` | extends `Record`<`string`, keyof `S`\>    |
+
+#### Parameters
+
+| Name        | Type                                                                              | Description                |
+| :---------- | :-------------------------------------------------------------------------------- | :------------------------- |
+| `useStore`  | [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\> | store to map from          |
+| `keyMapper` | `KeyMapper`                                                                       | object of state properties |
+
+#### Returns
+
+`_MapWritableStateObjectReturn`<`S`, `KeyMapper`\>
+
+#### Defined in
+
+[pinia/src/mapHelpers.ts:440](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/mapHelpers.ts#L440)
+
+▸ **mapWritableState**<`Id`, `S`, `G`, `A`\>(`useStore`, `keys`): `_MapWritableStateReturn`<`S`\>
+
+Allows using state and getters from one store without using the composition
+API (`setup()`) by generating an object to be spread in the `computed` field
+of a component.
+
+#### Type parameters
+
+| Name | Type                                      |
+| :--- | :---------------------------------------- |
+| `Id` | extends `string`                          |
+| `S`  | extends [`StateTree`](pinia.md#statetree) |
+| `G`  | extends `_GettersTree`<`S`\>              |
+| `A`  | `A`                                       |
+
+#### Parameters
+
+| Name       | Type                                                                              | Description               |
+| :--------- | :-------------------------------------------------------------------------------- | :------------------------ |
+| `useStore` | [`StoreDefinition`](../interfaces/pinia.StoreDefinition.md)<`Id`, `S`, `G`, `A`\> | store to map from         |
+| `keys`     | keyof `S`[]                                                                       | array of state properties |
+
+#### Returns
+
+`_MapWritableStateReturn`<`S`\>
+
+#### Defined in
+
+[pinia/src/mapHelpers.ts:458](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/mapHelpers.ts#L458)
+
+___
+
+### setActivePinia
+
+▸ `Const` **setActivePinia**(`pinia`): `undefined` \| [`Pinia`](../interfaces/pinia.Pinia.md)
+
+Sets or unsets the active pinia. Used in SSR and internally when calling
+actions and getters
+
+#### Parameters
+
+| Name    | Type                                                   | Description    |
+| :------ | :----------------------------------------------------- | :------------- |
+| `pinia` | `undefined` \| [`Pinia`](../interfaces/pinia.Pinia.md) | Pinia instance |
+
+#### Returns
+
+`undefined` \| [`Pinia`](../interfaces/pinia.Pinia.md)
+
+#### Defined in
+
+[pinia/src/rootStore.ts:33](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/rootStore.ts#L33)
+
+___
+
+### setMapStoreSuffix
+
+▸ **setMapStoreSuffix**(`suffix`): `void`
+
+Changes the suffix added by `mapStores()`. Can be set to an empty string.
+Defaults to `"Store"`. Make sure to extend the MapStoresCustomization
+interface if you need are using TypeScript.
+
+#### Parameters
+
+| Name     | Type     | Description |
+| :------- | :------- | :---------- |
+| `suffix` | `string` | new suffix  |
+
+#### Returns
+
+`void`
+
+#### Defined in
+
+[pinia/src/mapHelpers.ts:66](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/mapHelpers.ts#L66)
+
+___
+
+### skipHydrate
+
+▸ **skipHydrate**<`T`\>(`obj`): `T`
+
+#### Type parameters
+
+| Name | Type  |
+| :--- | :---- |
+| `T`  | `any` |
+
+#### Parameters
+
+| Name  | Type |
+| :---- | :--- |
+| `obj` | `T`  |
+
+#### Returns
+
+`T`
+
+#### Defined in
+
+[pinia/src/store.ts:85](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/store.ts#L85)
+
+___
+
+### storeToRefs
+
+▸ **storeToRefs**<`SS`\>(`store`): `ToRefs`<[`StoreState`](pinia.md#storestate)<`SS`\> & [`StoreGetters`](pinia.md#storegetters)<`SS`\> & [`PiniaCustomStateProperties`](../interfaces/pinia.PiniaCustomStateProperties.md)<[`StoreState`](pinia.md#storestate)<`SS`\>\>\>
+
+Creates an object of references with all the state, getters, and plugin-added
+state properties of the store. Similar to `toRefs()` but specifically
+designed for Pinia stores so methods and non reactive properties are
+completely ignored.
+
+#### Type parameters
+
+| Name | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
+| :--- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `SS` | extends [`_StoreWithState`](../interfaces/pinia._StoreWithState.md)<`string`, [`StateTree`](pinia.md#statetree), `_GettersTree`<[`StateTree`](pinia.md#statetree)\>, `_ActionsTree`, `SS`\> & {} & `_StoreWithGetters`<`_GettersTree`<[`StateTree`](pinia.md#statetree)\>\> & [`PiniaCustomProperties`](../interfaces/pinia.PiniaCustomProperties.md)<`string`, [`StateTree`](pinia.md#statetree), `_GettersTree`<[`StateTree`](pinia.md#statetree)\>, `_ActionsTree`, `SS`\> & `PiniaCustomStateProperties`<[`StateTree`](pinia.md#statetree), `SS`\> |
+
+#### Parameters
+
+| Name    | Type | Description                    |
+| :------ | :--- | :----------------------------- |
+| `store` | `SS` | store to extract the refs from |
+
+#### Returns
+
+`ToRefs`<[`StoreState`](pinia.md#storestate)<`SS`\> & [`StoreGetters`](pinia.md#storegetters)<`SS`\> & [`PiniaCustomStateProperties`](../interfaces/pinia.PiniaCustomStateProperties.md)<[`StoreState`](pinia.md#storestate)<`SS`\>\>\>
+
+#### Defined in
+
+[pinia/src/storeToRefs.ts:13](https://github.com/posva/pinia/blob/46c50b2/packages/pinia/src/storeToRefs.ts#L13)
diff --git a/packages/docs/api/modules/pinia_testing.md b/packages/docs/api/modules/pinia_testing.md
new file mode 100644 (file)
index 0000000..541ecb2
--- /dev/null
@@ -0,0 +1,43 @@
+---
+sidebar: "auto"
+editLinks: false
+sidebarDepth: 3
+---
+
+[API Documentation](../index.md) / @pinia/testing
+
+# Module: @pinia/testing
+
+## Interfaces
+
+- [TestingOptions](../interfaces/pinia_testing.TestingOptions.md)
+- [TestingPinia](../interfaces/pinia_testing.TestingPinia.md)
+
+## Functions
+
+### createTestingPinia
+
+▸ **createTestingPinia**(`options?`): [`TestingPinia`](../interfaces/pinia_testing.TestingPinia.md)
+
+Creates a pinia instance designed for unit tests that **requires mocking**
+the stores. By default, **all actions are mocked** and therefore not
+executed. This allows you to unit test your store and components separately.
+You can change this with the `stubActions` option. If you are using jest,
+they are replaced with `jest.fn()`, otherwise, you must provide your own
+`createSpy` option.
+
+#### Parameters
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `options` | [`TestingOptions`](../interfaces/pinia_testing.TestingOptions.md) | options to configure the testing pinia |
+
+#### Returns
+
+[`TestingPinia`](../interfaces/pinia_testing.TestingPinia.md)
+
+a augmented pinia instance
+
+#### Defined in
+
+[testing/src/testing.ts:74](https://github.com/posva/pinia/blob/46c50b2/packages/testing/src/testing.ts#L74)