pinia-react 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -40,6 +40,10 @@ interface StoreDefinition<Id extends string = string, S extends StateTree = Stat
40
40
  * Id of the store. Used by map helpers.
41
41
  */
42
42
  $id: Id;
43
+ /**
44
+ * Return to store for use within non-functional components
45
+ */
46
+ $getStore: () => Store<Id, S, G, A>;
43
47
  }
44
48
  type PiniaPluginContext<Id extends string = string, S extends StateTree = StateTree, G = _GettersTree<S>, A = _ActionsTree> = {
45
49
  options: DefineStoreOptions<Id, S, G, A>;
package/dist/index.js CHANGED
@@ -152,6 +152,11 @@ function defineStore(id, options) {
152
152
  return store;
153
153
  }
154
154
  useStore.$id = id;
155
+ useStore.$getStore = () => {
156
+ if (!pinia._store.has(id)) createStore();
157
+ const store = pinia._store.get(id);
158
+ return store;
159
+ };
155
160
  return useStore;
156
161
  }
157
162
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinia-react",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "homepage": "https://github.com/savageKarl/pinia-react#readme",
6
6
  "bugs": {