@poveste/vendors 0.15.0 → 0.16.1

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.
Files changed (423) hide show
  1. package/README.md +15 -1
  2. package/iconify.d.ts +5 -0
  3. package/iconify.js +5 -0
  4. package/package.json +39 -34
  5. package/pinia.d.ts +5 -0
  6. package/pinia.js +5 -0
  7. package/vue-router.d.ts +5 -0
  8. package/vue-router.js +5 -0
  9. package/vue-use.d.ts +5 -0
  10. package/vue-use.js +5 -0
  11. package/vue.d.ts +5 -0
  12. package/vue.js +9 -0
  13. package/dist/client/b-floating-vue.d.ts +0 -3
  14. package/dist/client/b-floating-vue.js +0 -3377
  15. package/dist/client/b-iconify.d.ts +0 -1
  16. package/dist/client/b-iconify.js +0 -1896
  17. package/dist/client/b-pinia.d.ts +0 -1
  18. package/dist/client/b-pinia.js +0 -1492
  19. package/dist/client/b-scroll.d.ts +0 -2
  20. package/dist/client/b-scroll.js +0 -7
  21. package/dist/client/b-vue-router.d.ts +0 -1
  22. package/dist/client/b-vue-router.js +0 -3058
  23. package/dist/client/b-vue-use.d.ts +0 -1
  24. package/dist/client/b-vue-use.js +0 -10774
  25. package/dist/client/b-vue.d.ts +0 -1
  26. package/dist/client/b-vue.js +0 -1
  27. package/dist/client/devtools-api.js +0 -6568
  28. package/dist/client/index.js +0 -185
  29. package/dist/client/node_modules/@babel/helper-string-parser/package.json +0 -31
  30. package/dist/client/node_modules/@babel/helper-validator-identifier/package.json +0 -31
  31. package/dist/client/node_modules/@babel/parser/package.json +0 -50
  32. package/dist/client/node_modules/@babel/parser/typings/babel-parser.d.ts +0 -262
  33. package/dist/client/node_modules/@babel/types/lib/index-legacy.d.ts +0 -2796
  34. package/dist/client/node_modules/@babel/types/lib/index.d.ts +0 -3616
  35. package/dist/client/node_modules/@babel/types/package.json +0 -39
  36. package/dist/client/node_modules/@floating-ui/core/dist/floating-ui.core.d.mts +0 -535
  37. package/dist/client/node_modules/@floating-ui/core/dist/floating-ui.core.d.ts +0 -535
  38. package/dist/client/node_modules/@floating-ui/core/package.json +0 -63
  39. package/dist/client/node_modules/@floating-ui/dom/index.d.ts +0 -1
  40. package/dist/client/node_modules/@floating-ui/dom/package.json +0 -74
  41. package/dist/client/node_modules/@floating-ui/dom/src/autoUpdate.d.ts +0 -31
  42. package/dist/client/node_modules/@floating-ui/dom/src/index.d.ts +0 -11
  43. package/dist/client/node_modules/@floating-ui/dom/src/platform.d.ts +0 -2
  44. package/dist/client/node_modules/@floating-ui/dom/src/types.d.ts +0 -128
  45. package/dist/client/node_modules/@floating-ui/dom/src/utils/convertOffsetParentRelativeRectToViewportRelativeRect.d.ts +0 -6
  46. package/dist/client/node_modules/@floating-ui/dom/src/utils/getBoundingClientRect.d.ts +0 -2
  47. package/dist/client/node_modules/@floating-ui/dom/src/utils/getClippingRect.d.ts +0 -12
  48. package/dist/client/node_modules/@floating-ui/dom/src/utils/getComputedStyle.d.ts +0 -1
  49. package/dist/client/node_modules/@floating-ui/dom/src/utils/getCssDimensions.d.ts +0 -4
  50. package/dist/client/node_modules/@floating-ui/dom/src/utils/getDimensions.d.ts +0 -2
  51. package/dist/client/node_modules/@floating-ui/dom/src/utils/getDocumentElement.d.ts +0 -1
  52. package/dist/client/node_modules/@floating-ui/dom/src/utils/getDocumentRect.d.ts +0 -2
  53. package/dist/client/node_modules/@floating-ui/dom/src/utils/getNearestOverflowAncestor.d.ts +0 -1
  54. package/dist/client/node_modules/@floating-ui/dom/src/utils/getNodeName.d.ts +0 -1
  55. package/dist/client/node_modules/@floating-ui/dom/src/utils/getNodeScroll.d.ts +0 -2
  56. package/dist/client/node_modules/@floating-ui/dom/src/utils/getOffsetParent.d.ts +0 -1
  57. package/dist/client/node_modules/@floating-ui/dom/src/utils/getOverflowAncestors.d.ts +0 -3
  58. package/dist/client/node_modules/@floating-ui/dom/src/utils/getParentNode.d.ts +0 -1
  59. package/dist/client/node_modules/@floating-ui/dom/src/utils/getRectRelativeToOffsetParent.d.ts +0 -2
  60. package/dist/client/node_modules/@floating-ui/dom/src/utils/getScale.d.ts +0 -7
  61. package/dist/client/node_modules/@floating-ui/dom/src/utils/getViewportRect.d.ts +0 -2
  62. package/dist/client/node_modules/@floating-ui/dom/src/utils/getWindowScrollBarX.d.ts +0 -1
  63. package/dist/client/node_modules/@floating-ui/dom/src/utils/is.d.ts +0 -17
  64. package/dist/client/node_modules/@floating-ui/dom/src/utils/math.d.ts +0 -3
  65. package/dist/client/node_modules/@floating-ui/dom/src/utils/unwrapElement.d.ts +0 -2
  66. package/dist/client/node_modules/@floating-ui/dom/src/utils/userAgent.d.ts +0 -1
  67. package/dist/client/node_modules/@floating-ui/dom/src/utils/window.d.ts +0 -1
  68. package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.mts +0 -105
  69. package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.ts +0 -105
  70. package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.mts +0 -47
  71. package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.ts +0 -47
  72. package/dist/client/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.d.ts +0 -47
  73. package/dist/client/node_modules/@floating-ui/utils/dom/package.json +0 -6
  74. package/dist/client/node_modules/@floating-ui/utils/package.json +0 -70
  75. package/dist/client/node_modules/@iconify/types/package.json +0 -23
  76. package/dist/client/node_modules/@iconify/types/provider.d.ts +0 -44
  77. package/dist/client/node_modules/@iconify/types/types.d.ts +0 -272
  78. package/dist/client/node_modules/@iconify/vue/dist/iconify.d.ts +0 -420
  79. package/dist/client/node_modules/@iconify/vue/dist/offline.d.ts +0 -109
  80. package/dist/client/node_modules/@iconify/vue/offline/package.json +0 -14
  81. package/dist/client/node_modules/@iconify/vue/package.json +0 -62
  82. package/dist/client/node_modules/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +0 -88
  83. package/dist/client/node_modules/@jridgewell/gen-mapping/dist/types/set-array.d.ts +0 -32
  84. package/dist/client/node_modules/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +0 -12
  85. package/dist/client/node_modules/@jridgewell/gen-mapping/dist/types/types.d.ts +0 -43
  86. package/dist/client/node_modules/@jridgewell/gen-mapping/package.json +0 -67
  87. package/dist/client/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts +0 -89
  88. package/dist/client/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts +0 -33
  89. package/dist/client/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts +0 -13
  90. package/dist/client/node_modules/@jridgewell/gen-mapping/types/types.d.mts +0 -44
  91. package/dist/client/node_modules/@jridgewell/remapping/package.json +0 -71
  92. package/dist/client/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.mts +0 -15
  93. package/dist/client/node_modules/@jridgewell/remapping/types/remapping.d.mts +0 -21
  94. package/dist/client/node_modules/@jridgewell/remapping/types/source-map-tree.d.mts +0 -46
  95. package/dist/client/node_modules/@jridgewell/remapping/types/source-map.d.mts +0 -19
  96. package/dist/client/node_modules/@jridgewell/remapping/types/types.d.mts +0 -16
  97. package/dist/client/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts +0 -4
  98. package/dist/client/node_modules/@jridgewell/resolve-uri/package.json +0 -69
  99. package/dist/client/node_modules/@jridgewell/sourcemap-codec/package.json +0 -64
  100. package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/range-mappings.d.mts +0 -5
  101. package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts +0 -50
  102. package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +0 -11
  103. package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts +0 -16
  104. package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +0 -9
  105. package/dist/client/node_modules/@jridgewell/trace-mapping/package.json +0 -67
  106. package/dist/client/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts +0 -33
  107. package/dist/client/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts +0 -4
  108. package/dist/client/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts +0 -9
  109. package/dist/client/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts +0 -4
  110. package/dist/client/node_modules/@jridgewell/trace-mapping/types/sort.d.mts +0 -4
  111. package/dist/client/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts +0 -17
  112. package/dist/client/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts +0 -5
  113. package/dist/client/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts +0 -80
  114. package/dist/client/node_modules/@jridgewell/trace-mapping/types/types.d.mts +0 -107
  115. package/dist/client/node_modules/@types/web-bluetooth/index.d.ts +0 -265
  116. package/dist/client/node_modules/@types/web-bluetooth/package.json +0 -46
  117. package/dist/client/node_modules/@vue/compiler-core/dist/compiler-core.d.ts +0 -1120
  118. package/dist/client/node_modules/@vue/compiler-core/package.json +0 -58
  119. package/dist/client/node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts +0 -45
  120. package/dist/client/node_modules/@vue/compiler-dom/package.json +0 -57
  121. package/dist/client/node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts +0 -487
  122. package/dist/client/node_modules/@vue/compiler-sfc/package.json +0 -67
  123. package/dist/client/node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts +0 -4
  124. package/dist/client/node_modules/@vue/compiler-ssr/package.json +0 -34
  125. package/dist/client/node_modules/@vue/devtools-api/dist/index-node.d.ts +0 -11
  126. package/dist/client/node_modules/@vue/devtools-api/dist/index.d.ts +0 -2
  127. package/dist/client/node_modules/@vue/devtools-api/package.json +0 -38
  128. package/dist/client/node_modules/@vue/devtools-kit/dist/index.d.ts +0 -1170
  129. package/dist/client/node_modules/@vue/devtools-kit/global.d.ts +0 -20
  130. package/dist/client/node_modules/@vue/devtools-kit/package.json +0 -44
  131. package/dist/client/node_modules/@vue/devtools-kit/types.d.ts +0 -2
  132. package/dist/client/node_modules/@vue/devtools-shared/dist/index.d.ts +0 -40
  133. package/dist/client/node_modules/@vue/devtools-shared/package.json +0 -33
  134. package/dist/client/node_modules/@vue/reactivity/dist/reactivity.d.ts +0 -757
  135. package/dist/client/node_modules/@vue/reactivity/package.json +0 -55
  136. package/dist/client/node_modules/@vue/runtime-core/dist/runtime-core.d.ts +0 -1868
  137. package/dist/client/node_modules/@vue/runtime-core/package.json +0 -52
  138. package/dist/client/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +0 -1452
  139. package/dist/client/node_modules/@vue/runtime-dom/package.json +0 -60
  140. package/dist/client/node_modules/@vue/server-renderer/dist/server-renderer.d.ts +0 -65
  141. package/dist/client/node_modules/@vue/server-renderer/package.json +0 -53
  142. package/dist/client/node_modules/@vue/shared/dist/shared.d.ts +0 -334
  143. package/dist/client/node_modules/@vue/shared/package.json +0 -47
  144. package/dist/client/node_modules/@vue-macros/common/dist/index.d.ts +0 -124
  145. package/dist/client/node_modules/@vue-macros/common/package.json +0 -63
  146. package/dist/client/node_modules/@vueuse/core/dist/index.d.ts +0 -5860
  147. package/dist/client/node_modules/@vueuse/core/dist/metadata.d.mts +0 -1
  148. package/dist/client/node_modules/@vueuse/core/package.json +0 -56
  149. package/dist/client/node_modules/@vueuse/metadata/dist/index.d.ts +0 -81
  150. package/dist/client/node_modules/@vueuse/metadata/package.json +0 -41
  151. package/dist/client/node_modules/@vueuse/shared/dist/index.d.ts +0 -1511
  152. package/dist/client/node_modules/@vueuse/shared/package.json +0 -45
  153. package/dist/client/node_modules/acorn/dist/acorn.d.mts +0 -897
  154. package/dist/client/node_modules/acorn/dist/acorn.d.ts +0 -897
  155. package/dist/client/node_modules/acorn/package.json +0 -50
  156. package/dist/client/node_modules/ast-kit/dist/index.d.ts +0 -380
  157. package/dist/client/node_modules/ast-kit/package.json +0 -63
  158. package/dist/client/node_modules/ast-walker-scope/dist/index.d.mts +0 -51
  159. package/dist/client/node_modules/ast-walker-scope/package.json +0 -60
  160. package/dist/client/node_modules/birpc/dist/index.d.mts +0 -215
  161. package/dist/client/node_modules/birpc/dist/index.d.ts +0 -215
  162. package/dist/client/node_modules/birpc/package.json +0 -57
  163. package/dist/client/node_modules/chokidar/handler.d.ts +0 -90
  164. package/dist/client/node_modules/chokidar/index.d.ts +0 -217
  165. package/dist/client/node_modules/chokidar/package.json +0 -63
  166. package/dist/client/node_modules/compute-scroll-into-view/dist/index.d.ts +0 -75
  167. package/dist/client/node_modules/compute-scroll-into-view/package.json +0 -82
  168. package/dist/client/node_modules/confbox/dist/_chunks/_format.d.mts +0 -25
  169. package/dist/client/node_modules/confbox/dist/index.d.mts +0 -34
  170. package/dist/client/node_modules/confbox/dist/ini.d.mts +0 -62
  171. package/dist/client/node_modules/confbox/dist/json5.d.mts +0 -59
  172. package/dist/client/node_modules/confbox/dist/jsonc.d.mts +0 -41
  173. package/dist/client/node_modules/confbox/dist/toml.d.mts +0 -23
  174. package/dist/client/node_modules/confbox/dist/yaml.d.mts +0 -96
  175. package/dist/client/node_modules/confbox/package.json +0 -67
  176. package/dist/client/node_modules/csstype/index.d.ts +0 -22569
  177. package/dist/client/node_modules/csstype/package.json +0 -70
  178. package/dist/client/node_modules/entities/decode.d.ts +0 -3
  179. package/dist/client/node_modules/entities/dist/commonjs/decode-codepoint.d.ts +0 -19
  180. package/dist/client/node_modules/entities/dist/commonjs/decode.d.ts +0 -205
  181. package/dist/client/node_modules/entities/dist/commonjs/encode.d.ts +0 -22
  182. package/dist/client/node_modules/entities/dist/commonjs/escape.d.ts +0 -46
  183. package/dist/client/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts +0 -2
  184. package/dist/client/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts +0 -2
  185. package/dist/client/node_modules/entities/dist/commonjs/generated/encode-html.d.ts +0 -3
  186. package/dist/client/node_modules/entities/dist/commonjs/index.d.ts +0 -96
  187. package/dist/client/node_modules/entities/dist/commonjs/internal/bin-trie-flags.d.ts +0 -17
  188. package/dist/client/node_modules/entities/dist/commonjs/internal/decode-shared.d.ts +0 -2
  189. package/dist/client/node_modules/entities/dist/commonjs/internal/encode-shared.d.ts +0 -32
  190. package/dist/client/node_modules/entities/dist/commonjs/package.json +0 -3
  191. package/dist/client/node_modules/entities/dist/esm/decode-codepoint.d.ts +0 -19
  192. package/dist/client/node_modules/entities/dist/esm/decode.d.ts +0 -205
  193. package/dist/client/node_modules/entities/dist/esm/encode.d.ts +0 -22
  194. package/dist/client/node_modules/entities/dist/esm/escape.d.ts +0 -46
  195. package/dist/client/node_modules/entities/dist/esm/generated/decode-data-html.d.ts +0 -2
  196. package/dist/client/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts +0 -2
  197. package/dist/client/node_modules/entities/dist/esm/generated/encode-html.d.ts +0 -3
  198. package/dist/client/node_modules/entities/dist/esm/index.d.ts +0 -96
  199. package/dist/client/node_modules/entities/dist/esm/internal/bin-trie-flags.d.ts +0 -17
  200. package/dist/client/node_modules/entities/dist/esm/internal/decode-shared.d.ts +0 -2
  201. package/dist/client/node_modules/entities/dist/esm/internal/encode-shared.d.ts +0 -32
  202. package/dist/client/node_modules/entities/dist/esm/package.json +0 -3
  203. package/dist/client/node_modules/entities/escape.d.ts +0 -3
  204. package/dist/client/node_modules/entities/package.json +0 -120
  205. package/dist/client/node_modules/estree-walker/dist/esm/package.json +0 -1
  206. package/dist/client/node_modules/estree-walker/package.json +0 -37
  207. package/dist/client/node_modules/estree-walker/src/package.json +0 -1
  208. package/dist/client/node_modules/estree-walker/types/async.d.ts +0 -53
  209. package/dist/client/node_modules/estree-walker/types/index.d.ts +0 -56
  210. package/dist/client/node_modules/estree-walker/types/sync.d.ts +0 -53
  211. package/dist/client/node_modules/estree-walker/types/walker.d.ts +0 -37
  212. package/dist/client/node_modules/exsolve/dist/index.d.mts +0 -66
  213. package/dist/client/node_modules/exsolve/package.json +0 -42
  214. package/dist/client/node_modules/fdir/dist/index.d.mts +0 -155
  215. package/dist/client/node_modules/fdir/package.json +0 -103
  216. package/dist/client/node_modules/floating-vue/dist/components/Dropdown.d.ts +0 -398
  217. package/dist/client/node_modules/floating-vue/dist/components/Menu.d.ts +0 -398
  218. package/dist/client/node_modules/floating-vue/dist/components/Popper.d.ts +0 -495
  219. package/dist/client/node_modules/floating-vue/dist/components/Popper.vue.d.ts +0 -474
  220. package/dist/client/node_modules/floating-vue/dist/components/PopperContent.vue.d.ts +0 -37
  221. package/dist/client/node_modules/floating-vue/dist/components/PopperMethods.d.ts +0 -9
  222. package/dist/client/node_modules/floating-vue/dist/components/PopperWrapper.vue.d.ts +0 -414
  223. package/dist/client/node_modules/floating-vue/dist/components/ThemeClass.d.ts +0 -6
  224. package/dist/client/node_modules/floating-vue/dist/components/Tooltip.d.ts +0 -398
  225. package/dist/client/node_modules/floating-vue/dist/components/TooltipDirective.vue.d.ts +0 -67
  226. package/dist/client/node_modules/floating-vue/dist/config.d.ts +0 -11
  227. package/dist/client/node_modules/floating-vue/dist/directives/v-close-popper.d.ts +0 -13
  228. package/dist/client/node_modules/floating-vue/dist/directives/v-tooltip.d.ts +0 -27
  229. package/dist/client/node_modules/floating-vue/dist/directives/v-tooltip.spec.d.ts +0 -1
  230. package/dist/client/node_modules/floating-vue/dist/index.d.ts +0 -2239
  231. package/dist/client/node_modules/floating-vue/dist/util/assign-deep.d.ts +0 -1
  232. package/dist/client/node_modules/floating-vue/dist/util/env.d.ts +0 -2
  233. package/dist/client/node_modules/floating-vue/dist/util/events.d.ts +0 -14
  234. package/dist/client/node_modules/floating-vue/dist/util/frame.d.ts +0 -1
  235. package/dist/client/node_modules/floating-vue/dist/util/lang.d.ts +0 -1
  236. package/dist/client/node_modules/floating-vue/dist/util/popper.d.ts +0 -3
  237. package/dist/client/node_modules/floating-vue/package.json +0 -80
  238. package/dist/client/node_modules/hookable/dist/index.d.ts +0 -103
  239. package/dist/client/node_modules/hookable/package.json +0 -49
  240. package/dist/client/node_modules/local-pkg/dist/index.d.mts +0 -42
  241. package/dist/client/node_modules/local-pkg/dist/index.d.ts +0 -42
  242. package/dist/client/node_modules/local-pkg/package.json +0 -65
  243. package/dist/client/node_modules/magic-string/dist/magic-string.cjs.d.ts +0 -289
  244. package/dist/client/node_modules/magic-string/dist/magic-string.es.d.mts +0 -289
  245. package/dist/client/node_modules/magic-string/package.json +0 -67
  246. package/dist/client/node_modules/magic-string-ast/dist/index.d.ts +0 -67
  247. package/dist/client/node_modules/magic-string-ast/package.json +0 -64
  248. package/dist/client/node_modules/mlly/dist/index.d.mts +0 -564
  249. package/dist/client/node_modules/mlly/dist/index.d.ts +0 -564
  250. package/dist/client/node_modules/mlly/node_modules/confbox/dist/index.d.mts +0 -32
  251. package/dist/client/node_modules/mlly/node_modules/confbox/dist/index.d.ts +0 -32
  252. package/dist/client/node_modules/mlly/node_modules/confbox/dist/json5.d.mts +0 -58
  253. package/dist/client/node_modules/mlly/node_modules/confbox/dist/json5.d.ts +0 -58
  254. package/dist/client/node_modules/mlly/node_modules/confbox/dist/jsonc.d.mts +0 -41
  255. package/dist/client/node_modules/mlly/node_modules/confbox/dist/jsonc.d.ts +0 -41
  256. package/dist/client/node_modules/mlly/node_modules/confbox/dist/shared/confbox.9745c98f.d.mts +0 -24
  257. package/dist/client/node_modules/mlly/node_modules/confbox/dist/shared/confbox.9745c98f.d.ts +0 -24
  258. package/dist/client/node_modules/mlly/node_modules/confbox/dist/toml.d.mts +0 -22
  259. package/dist/client/node_modules/mlly/node_modules/confbox/dist/toml.d.ts +0 -22
  260. package/dist/client/node_modules/mlly/node_modules/confbox/dist/yaml.d.mts +0 -95
  261. package/dist/client/node_modules/mlly/node_modules/confbox/dist/yaml.d.ts +0 -95
  262. package/dist/client/node_modules/mlly/node_modules/confbox/json5.d.ts +0 -2
  263. package/dist/client/node_modules/mlly/node_modules/confbox/jsonc.d.ts +0 -2
  264. package/dist/client/node_modules/mlly/node_modules/confbox/package.json +0 -86
  265. package/dist/client/node_modules/mlly/node_modules/confbox/toml.d.ts +0 -2
  266. package/dist/client/node_modules/mlly/node_modules/confbox/yaml.d.ts +0 -2
  267. package/dist/client/node_modules/mlly/node_modules/pkg-types/dist/index.d.mts +0 -411
  268. package/dist/client/node_modules/mlly/node_modules/pkg-types/dist/index.d.ts +0 -411
  269. package/dist/client/node_modules/mlly/node_modules/pkg-types/package.json +0 -47
  270. package/dist/client/node_modules/mlly/package.json +0 -55
  271. package/dist/client/node_modules/muggle-string/out/base.d.ts +0 -6
  272. package/dist/client/node_modules/muggle-string/out/basic.d.ts +0 -6
  273. package/dist/client/node_modules/muggle-string/out/binarySearch.d.ts +0 -1
  274. package/dist/client/node_modules/muggle-string/out/common.d.ts +0 -9
  275. package/dist/client/node_modules/muggle-string/out/getLength.d.ts +0 -2
  276. package/dist/client/node_modules/muggle-string/out/index.d.ts +0 -10
  277. package/dist/client/node_modules/muggle-string/out/map.d.ts +0 -3
  278. package/dist/client/node_modules/muggle-string/out/overwriteSource.d.ts +0 -3
  279. package/dist/client/node_modules/muggle-string/out/replace.d.ts +0 -3
  280. package/dist/client/node_modules/muggle-string/out/segment.d.ts +0 -6
  281. package/dist/client/node_modules/muggle-string/out/sourceBased.d.ts +0 -3
  282. package/dist/client/node_modules/muggle-string/out/toString.d.ts +0 -2
  283. package/dist/client/node_modules/muggle-string/out/track.d.ts +0 -6
  284. package/dist/client/node_modules/muggle-string/out/types.d.ts +0 -16
  285. package/dist/client/node_modules/muggle-string/package.json +0 -22
  286. package/dist/client/node_modules/nanoid/async/index.d.ts +0 -56
  287. package/dist/client/node_modules/nanoid/async/package.json +0 -12
  288. package/dist/client/node_modules/nanoid/index.d.ts +0 -91
  289. package/dist/client/node_modules/nanoid/non-secure/index.d.ts +0 -33
  290. package/dist/client/node_modules/nanoid/non-secure/package.json +0 -6
  291. package/dist/client/node_modules/nanoid/package.json +0 -89
  292. package/dist/client/node_modules/nanoid/url-alphabet/package.json +0 -6
  293. package/dist/client/node_modules/nostics/dist/diagnostic-wduO7saY.d.mts +0 -295
  294. package/dist/client/node_modules/nostics/dist/formatters/ansi.d.mts +0 -15
  295. package/dist/client/node_modules/nostics/dist/formatters/json.d.mts +0 -7
  296. package/dist/client/node_modules/nostics/dist/index.d.mts +0 -51
  297. package/dist/client/node_modules/nostics/dist/reporters/dev.d.mts +0 -13
  298. package/dist/client/node_modules/nostics/dist/reporters/fetch.d.mts +0 -11
  299. package/dist/client/node_modules/nostics/dist/reporters/node.d.mts +0 -43
  300. package/dist/client/node_modules/nostics/package.json +0 -125
  301. package/dist/client/node_modules/pathe/dist/index.d.mts +0 -47
  302. package/dist/client/node_modules/pathe/dist/index.d.ts +0 -47
  303. package/dist/client/node_modules/pathe/dist/utils.d.mts +0 -32
  304. package/dist/client/node_modules/pathe/dist/utils.d.ts +0 -32
  305. package/dist/client/node_modules/pathe/package.json +0 -61
  306. package/dist/client/node_modules/pathe/utils.d.ts +0 -1
  307. package/dist/client/node_modules/perfect-debounce/dist/index.d.mts +0 -49
  308. package/dist/client/node_modules/perfect-debounce/package.json +0 -41
  309. package/dist/client/node_modules/picocolors/package.json +0 -25
  310. package/dist/client/node_modules/picocolors/picocolors.d.ts +0 -5
  311. package/dist/client/node_modules/picocolors/types.d.ts +0 -51
  312. package/dist/client/node_modules/picomatch/package.json +0 -83
  313. package/dist/client/node_modules/pinia/dist/pinia.d.ts +0 -955
  314. package/dist/client/node_modules/pinia/package.json +0 -82
  315. package/dist/client/node_modules/pkg-types/dist/index.d.mts +0 -695
  316. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/_chunks/_format.d.mts +0 -22
  317. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/_chunks/libs/js-yaml.d.mts +0 -33
  318. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/index.d.mts +0 -7
  319. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/ini.d.mts +0 -59
  320. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/json.d.mts +0 -25
  321. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/json5.d.mts +0 -55
  322. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/jsonc.d.mts +0 -29
  323. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/toml.d.mts +0 -20
  324. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/yaml.d.mts +0 -101
  325. package/dist/client/node_modules/pkg-types/node_modules/confbox/package.json +0 -68
  326. package/dist/client/node_modules/pkg-types/package.json +0 -47
  327. package/dist/client/node_modules/postcss/lib/at-rule.d.ts +0 -139
  328. package/dist/client/node_modules/postcss/lib/comment.d.ts +0 -67
  329. package/dist/client/node_modules/postcss/lib/container.d.ts +0 -474
  330. package/dist/client/node_modules/postcss/lib/css-syntax-error.d.ts +0 -247
  331. package/dist/client/node_modules/postcss/lib/declaration.d.ts +0 -150
  332. package/dist/client/node_modules/postcss/lib/document.d.ts +0 -68
  333. package/dist/client/node_modules/postcss/lib/fromJSON.d.ts +0 -9
  334. package/dist/client/node_modules/postcss/lib/input.d.ts +0 -226
  335. package/dist/client/node_modules/postcss/lib/lazy-result.d.ts +0 -189
  336. package/dist/client/node_modules/postcss/lib/list.d.ts +0 -60
  337. package/dist/client/node_modules/postcss/lib/no-work-result.d.ts +0 -45
  338. package/dist/client/node_modules/postcss/lib/node.d.ts +0 -555
  339. package/dist/client/node_modules/postcss/lib/parse.d.ts +0 -9
  340. package/dist/client/node_modules/postcss/lib/postcss.d.mts +0 -66
  341. package/dist/client/node_modules/postcss/lib/postcss.d.ts +0 -464
  342. package/dist/client/node_modules/postcss/lib/previous-map.d.ts +0 -80
  343. package/dist/client/node_modules/postcss/lib/processor.d.ts +0 -114
  344. package/dist/client/node_modules/postcss/lib/result.d.ts +0 -204
  345. package/dist/client/node_modules/postcss/lib/root.d.ts +0 -86
  346. package/dist/client/node_modules/postcss/lib/rule.d.ts +0 -126
  347. package/dist/client/node_modules/postcss/lib/stringifier.d.ts +0 -45
  348. package/dist/client/node_modules/postcss/lib/stringify.d.ts +0 -9
  349. package/dist/client/node_modules/postcss/lib/warning.d.ts +0 -146
  350. package/dist/client/node_modules/postcss/package.json +0 -88
  351. package/dist/client/node_modules/quansync/dist/index.d.mts +0 -22
  352. package/dist/client/node_modules/quansync/dist/index.d.ts +0 -22
  353. package/dist/client/node_modules/quansync/dist/macro.d.mts +0 -18
  354. package/dist/client/node_modules/quansync/dist/macro.d.ts +0 -18
  355. package/dist/client/node_modules/quansync/dist/types.d.mts +0 -27
  356. package/dist/client/node_modules/quansync/dist/types.d.ts +0 -27
  357. package/dist/client/node_modules/quansync/package.json +0 -95
  358. package/dist/client/node_modules/readdirp/index.d.ts +0 -117
  359. package/dist/client/node_modules/readdirp/package.json +0 -62
  360. package/dist/client/node_modules/scroll-into-view-if-needed/dist/index.d.ts +0 -79
  361. package/dist/client/node_modules/scroll-into-view-if-needed/package.json +0 -80
  362. package/dist/client/node_modules/scule/dist/index.d.mts +0 -57
  363. package/dist/client/node_modules/scule/dist/index.d.ts +0 -57
  364. package/dist/client/node_modules/scule/package.json +0 -43
  365. package/dist/client/node_modules/source-map-js/lib/source-map-consumer.d.ts +0 -1
  366. package/dist/client/node_modules/source-map-js/lib/source-map-generator.d.ts +0 -1
  367. package/dist/client/node_modules/source-map-js/lib/source-node.d.ts +0 -1
  368. package/dist/client/node_modules/source-map-js/package.json +0 -71
  369. package/dist/client/node_modules/source-map-js/source-map.d.ts +0 -104
  370. package/dist/client/node_modules/tinyglobby/dist/index.d.mts +0 -148
  371. package/dist/client/node_modules/tinyglobby/package.json +0 -70
  372. package/dist/client/node_modules/ufo/dist/index.d.mts +0 -714
  373. package/dist/client/node_modules/ufo/dist/index.d.ts +0 -714
  374. package/dist/client/node_modules/ufo/package.json +0 -48
  375. package/dist/client/node_modules/unplugin/dist/index.d.mts +0 -241
  376. package/dist/client/node_modules/unplugin/dist/rspack/loaders/load.d.mts +0 -4
  377. package/dist/client/node_modules/unplugin/dist/rspack/loaders/transform.d.mts +0 -4
  378. package/dist/client/node_modules/unplugin/dist/webpack/loaders/load.d.mts +0 -4
  379. package/dist/client/node_modules/unplugin/dist/webpack/loaders/transform.d.mts +0 -4
  380. package/dist/client/node_modules/unplugin/package.json +0 -146
  381. package/dist/client/node_modules/unplugin-utils/dist/index.d.ts +0 -31
  382. package/dist/client/node_modules/unplugin-utils/package.json +0 -61
  383. package/dist/client/node_modules/vue/compiler-sfc/index.d.mts +0 -1
  384. package/dist/client/node_modules/vue/compiler-sfc/index.d.ts +0 -1
  385. package/dist/client/node_modules/vue/compiler-sfc/package.json +0 -4
  386. package/dist/client/node_modules/vue/dist/vue.d.mts +0 -7
  387. package/dist/client/node_modules/vue/dist/vue.d.ts +0 -7
  388. package/dist/client/node_modules/vue/jsx-runtime/index.d.ts +0 -25
  389. package/dist/client/node_modules/vue/jsx-runtime/package.json +0 -5
  390. package/dist/client/node_modules/vue/jsx.d.ts +0 -22
  391. package/dist/client/node_modules/vue/package.json +0 -112
  392. package/dist/client/node_modules/vue/server-renderer/index.d.mts +0 -1
  393. package/dist/client/node_modules/vue/server-renderer/index.d.ts +0 -1
  394. package/dist/client/node_modules/vue/server-renderer/package.json +0 -4
  395. package/dist/client/node_modules/vue-resize/package.json +0 -77
  396. package/dist/client/node_modules/vue-router/dist/experimental/index.d.ts +0 -7
  397. package/dist/client/node_modules/vue-router/dist/experimental/pinia-colada.d.ts +0 -151
  398. package/dist/client/node_modules/vue-router/dist/index-D7ja2BKs.d.ts +0 -3293
  399. package/dist/client/node_modules/vue-router/dist/options-CwYZKRl4.d.mts +0 -2923
  400. package/dist/client/node_modules/vue-router/dist/unplugin/esbuild.d.mts +0 -10
  401. package/dist/client/node_modules/vue-router/dist/unplugin/index.d.mts +0 -62
  402. package/dist/client/node_modules/vue-router/dist/unplugin/options.d.mts +0 -7
  403. package/dist/client/node_modules/vue-router/dist/unplugin/rolldown.d.mts +0 -10
  404. package/dist/client/node_modules/vue-router/dist/unplugin/rollup.d.mts +0 -10
  405. package/dist/client/node_modules/vue-router/dist/unplugin/types.d.mts +0 -7
  406. package/dist/client/node_modules/vue-router/dist/unplugin/vite.d.mts +0 -10
  407. package/dist/client/node_modules/vue-router/dist/unplugin/webpack.d.mts +0 -10
  408. package/dist/client/node_modules/vue-router/dist/vue-router.d.ts +0 -7
  409. package/dist/client/node_modules/vue-router/package.json +0 -211
  410. package/dist/client/node_modules/vue-router/vue-router-auto-resolver.d.mts +0 -27
  411. package/dist/client/node_modules/vue-router/vue-router-auto-routes.d.mts +0 -53
  412. package/dist/client/node_modules/vue-router/vue-router-auto.d.ts +0 -2
  413. package/dist/client/node_modules/webpack-virtual-modules/lib/index.d.ts +0 -15
  414. package/dist/client/node_modules/webpack-virtual-modules/lib/virtual-stats.d.ts +0 -11
  415. package/dist/client/node_modules/webpack-virtual-modules/package.json +0 -82
  416. package/dist/client/vue.runtime.esm-bundler.js +0 -13389
  417. package/src/client/b-floating-vue.ts +0 -5
  418. package/src/client/b-iconify.ts +0 -1
  419. package/src/client/b-pinia.ts +0 -1
  420. package/src/client/b-scroll.ts +0 -4
  421. package/src/client/b-vue-router.ts +0 -1
  422. package/src/client/b-vue-use.ts +0 -1
  423. package/src/client/b-vue.ts +0 -1
@@ -1,1492 +0,0 @@
1
- import { hasInjectionContext, inject, toRaw, isRef, isReadonly, watch, unref, markRaw, effectScope, ref, isReactive, getCurrentScope, onScopeDispose, toRefs, computed, nextTick, reactive, toRef, getCurrentInstance } from './vue.runtime.esm-bundler.js';
2
- import { defineDiagnostics, createConsoleReporter } from './index.js';
3
- import { setupDevToolsPlugin } from './devtools-api.js';
4
-
5
- /*!
6
- * pinia v4.0.3
7
- * (c) 2026 Eduardo San Martin Morote
8
- * @license MIT
9
- */
10
- //#region src/env.ts
11
- const IS_CLIENT = typeof window !== "undefined";
12
- //#endregion
13
- //#region src/diagnostics.ts
14
- /**
15
- * Catalog of user-facing Pinia diagnostics. Each handle builds a diagnostic
16
- * and runs the reporters. All call sites are dev-only (`__DEV__` guarded or
17
- * HMR), so production builds drop the calls and tree-shake this catalog.
18
- */
19
- const diagnostics = /*#__PURE__*/ defineDiagnostics({
20
- reporters: [/*#__PURE__*/ createConsoleReporter()],
21
- codes: {
22
- PINIA_R1001: {
23
- why: "Directly pass all stores to \"mapStores()\" without putting them in an array. This will fail in production.",
24
- fix: "Replace mapStores([useAuthStore, useCartStore]) with mapStores(useAuthStore, useCartStore).",
25
- docs: "https://pinia.vuejs.org/cookbook/options-api.html#Giving-access-to-the-whole-store"
26
- },
27
- PINIA_R1002: {
28
- why: (p) => `A getter cannot have the same name as another state property. Found "${p.name}" in store "${p.id}".`,
29
- fix: "Rename either the getter or the state property.",
30
- docs: "https://pinia.vuejs.org/core-concepts/getters.html#Accessing-other-getters"
31
- },
32
- PINIA_R1003: {
33
- why: (p) => `The "state" must be a plain object. Found in store "${p.id}".`,
34
- fix: "Return a plain object, e.g. avoid state: () => new MyClass().",
35
- docs: "https://pinia.vuejs.org/core-concepts/state.html#State"
36
- },
37
- PINIA_R1004: {
38
- why: "Pinia instance not found in context. This falls back to the global activePinia, which exposes you to cross-request pollution on the server.",
39
- fix: "\"useStore()\" is a composable and follows the same rules: call it at the top of setup() (or another composable), or pass the pinia instance explicitly when used outside of a component.",
40
- docs: "https://pinia.vuejs.org/ssr/#Using-the-store-outside-of-setup-"
41
- },
42
- PINIA_R1005: {
43
- why: (p) => `The store id changed from "${p.from}" to "${p.to}", forcing a reload.`,
44
- docs: "https://pinia.vuejs.org/cookbook/hot-module-replacement.html#HMR-Hot-Module-Replacement-"
45
- },
46
- PINIA_R1006: {
47
- why: (p) => `Property "${p.key}" of store "${p.id}" is not reactive (not a ref, reactive object, or shallowRef), so storeToRefs() ignores it.`,
48
- fix: "If it should be reactive state, wrap it with ref(), reactive(), or shallowRef(). If it is an intentional non-reactive property, wrap it with markRaw() so storeToRefs() skips it explicitly.",
49
- docs: "https://pinia.vuejs.org/core-concepts/plugins.html#Adding-new-external-properties"
50
- },
51
- PINIA_R1007: {
52
- why: (p) => `The same callback was passed to "$subscribe()" of store "${p.id}" more than once. Subscriptions are deduplicated, so the duplicate is ignored.`,
53
- fix: "Subscribe each callback only once. If you need to resubscribe, call the returned function to remove the previous subscription first, or create a new function.",
54
- docs: "https://pinia.vuejs.org/core-concepts/state.html#Subscribing-to-the-state"
55
- }
56
- }
57
- });
58
- //#endregion
59
- //#region src/rootStore.ts
60
- /**
61
- * setActivePinia must be called to handle SSR at the top of functions like
62
- * `fetch`, `setup`, `serverPrefetch` and others
63
- */
64
- let activePinia;
65
- /**
66
- * Sets or unsets the active pinia. Used in SSR and internally when calling
67
- * actions and getters
68
- *
69
- * @param pinia - Pinia instance
70
- */
71
- const setActivePinia = (pinia) => activePinia = pinia;
72
- /**
73
- * Get the currently active pinia if there is any.
74
- */
75
- const getActivePinia = process.env.NODE_ENV !== "production" ? () => {
76
- const pinia = hasInjectionContext() && inject(piniaSymbol);
77
- if (!pinia && !IS_CLIENT) diagnostics.PINIA_R1004({}, { method: "error" });
78
- return pinia || activePinia;
79
- } : () => hasInjectionContext() && inject(piniaSymbol) || activePinia;
80
- /**
81
- * Symbol used to provide/inject the pinia instance in the app. Used internally
82
- * and exposed for testing purposes and edge cases like storybook. Could break
83
- * in a minor, **USE AT YOUR OWN RISK**.
84
- *
85
- * For context, see:
86
- * - https://github.com/vuejs/pinia/issues/870
87
- * - https://github.com/vuejs/pinia/pull/2973
88
- *
89
- * @internal
90
- */
91
- const piniaSymbol = process.env.NODE_ENV !== "production" ? Symbol("pinia") : /* istanbul ignore next */ Symbol();
92
- //#endregion
93
- //#region src/types.ts
94
- function isPlainObject(o) {
95
- return o && typeof o === "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON !== "function";
96
- }
97
- /**
98
- * Possible types for SubscriptionCallback
99
- */
100
- let MutationType = /* @__PURE__ */ function(MutationType) {
101
- /**
102
- * Direct mutation of the state:
103
- *
104
- * - `store.name = 'new name'`
105
- * - `store.$state.name = 'new name'`
106
- * - `store.list.push('new item')`
107
- */
108
- MutationType["direct"] = "direct";
109
- /**
110
- * Mutated the state with `$patch` and an object
111
- *
112
- * - `store.$patch({ name: 'newName' })`
113
- */
114
- MutationType["patchObject"] = "patch object";
115
- /**
116
- * Mutated the state with `$patch` and a function
117
- *
118
- * - `store.$patch(state => state.name = 'newName')`
119
- */
120
- MutationType["patchFunction"] = "patch function";
121
- return MutationType;
122
- }({});
123
- //#endregion
124
- //#region src/devtools/file-saver.ts
125
- const _global = /*#__PURE__*/ (() => typeof window === "object" && window.window === window ? window : typeof self === "object" && self.self === self ? self : typeof global === "object" && global.global === global ? global : typeof globalThis === "object" ? globalThis : { HTMLElement: null })();
126
- function bom(blob, { autoBom = false } = {}) {
127
- if (autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) return new Blob([String.fromCharCode(65279), blob], { type: blob.type });
128
- return blob;
129
- }
130
- function download(url, name, opts) {
131
- const xhr = new XMLHttpRequest();
132
- xhr.open("GET", url);
133
- xhr.responseType = "blob";
134
- xhr.onload = function() {
135
- saveAs(xhr.response, name, opts);
136
- };
137
- xhr.onerror = function() {
138
- console.error("could not download file");
139
- };
140
- xhr.send();
141
- }
142
- function corsEnabled(url) {
143
- const xhr = new XMLHttpRequest();
144
- xhr.open("HEAD", url, false);
145
- try {
146
- xhr.send();
147
- } catch (e) {}
148
- return xhr.status >= 200 && xhr.status <= 299;
149
- }
150
- function click(node) {
151
- try {
152
- node.dispatchEvent(new MouseEvent("click"));
153
- } catch (e) {
154
- const evt = new MouseEvent("click", {
155
- bubbles: true,
156
- cancelable: true,
157
- view: window,
158
- detail: 0,
159
- screenX: 80,
160
- screenY: 20,
161
- clientX: 80,
162
- clientY: 20,
163
- ctrlKey: false,
164
- altKey: false,
165
- shiftKey: false,
166
- metaKey: false,
167
- button: 0,
168
- relatedTarget: null
169
- });
170
- node.dispatchEvent(evt);
171
- }
172
- }
173
- const _navigator = typeof navigator === "object" ? navigator : { userAgent: "" };
174
- const isMacOSWebView = /*#__PURE__*/ (() => /Macintosh/.test(_navigator.userAgent) && /AppleWebKit/.test(_navigator.userAgent) && !/Safari/.test(_navigator.userAgent))();
175
- const saveAs = !IS_CLIENT ? () => {} : typeof HTMLAnchorElement !== "undefined" && "download" in HTMLAnchorElement.prototype && !isMacOSWebView ? downloadSaveAs : "msSaveOrOpenBlob" in _navigator ? msSaveAs : fileSaverSaveAs;
176
- function downloadSaveAs(blob, name = "download", opts) {
177
- const a = document.createElement("a");
178
- a.download = name;
179
- a.rel = "noopener";
180
- if (typeof blob === "string") {
181
- a.href = blob;
182
- if (a.origin !== location.origin) if (corsEnabled(a.href)) download(blob, name, opts);
183
- else {
184
- a.target = "_blank";
185
- click(a);
186
- }
187
- else click(a);
188
- } else {
189
- a.href = URL.createObjectURL(blob);
190
- setTimeout(function() {
191
- URL.revokeObjectURL(a.href);
192
- }, 4e4);
193
- setTimeout(function() {
194
- click(a);
195
- }, 0);
196
- }
197
- }
198
- function msSaveAs(blob, name = "download", opts) {
199
- if (typeof blob === "string") if (corsEnabled(blob)) download(blob, name, opts);
200
- else {
201
- const a = document.createElement("a");
202
- a.href = blob;
203
- a.target = "_blank";
204
- setTimeout(function() {
205
- click(a);
206
- });
207
- }
208
- else navigator.msSaveOrOpenBlob(bom(blob, opts), name);
209
- }
210
- function fileSaverSaveAs(blob, name, opts, popup) {
211
- popup = popup || open("", "_blank");
212
- if (popup) popup.document.title = popup.document.body.innerText = "downloading...";
213
- if (typeof blob === "string") return download(blob, name, opts);
214
- const force = blob.type === "application/octet-stream";
215
- const isSafari = /constructor/i.test(String(_global.HTMLElement)) || "safari" in _global;
216
- const isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent);
217
- if ((isChromeIOS || force && isSafari || isMacOSWebView) && typeof FileReader !== "undefined") {
218
- const reader = new FileReader();
219
- reader.onloadend = function() {
220
- let url = reader.result;
221
- if (typeof url !== "string") {
222
- popup = null;
223
- throw new Error("Wrong reader.result type");
224
- }
225
- url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, "data:attachment/file;");
226
- if (popup) popup.location.href = url;
227
- else location.assign(url);
228
- popup = null;
229
- };
230
- reader.readAsDataURL(blob);
231
- } else {
232
- const url = URL.createObjectURL(blob);
233
- if (popup) popup.location.assign(url);
234
- else location.href = url;
235
- popup = null;
236
- setTimeout(function() {
237
- URL.revokeObjectURL(url);
238
- }, 4e4);
239
- }
240
- }
241
- //#endregion
242
- //#region src/devtools/utils.ts
243
- /**
244
- * Shows a toast or console.log
245
- *
246
- * @param message - message to log
247
- * @param type - different color of the tooltip
248
- */
249
- function toastMessage(message, type) {
250
- const piniaMessage = "🍍 " + message;
251
- if (type === "error") console.error(piniaMessage);
252
- else if (type === "warn") console.warn(piniaMessage);
253
- else console.debug(piniaMessage);
254
- }
255
- function isPinia(o) {
256
- return "_a" in o && "install" in o;
257
- }
258
- /**
259
- * Detects if a store getter is a writable computed (has a setter) so it can be
260
- * edited from devtools.
261
- */
262
- function isWritableComputed(store, key) {
263
- const rawProp = toRaw(store)[key];
264
- return isRef(rawProp) && !isReadonly(rawProp);
265
- }
266
- //#endregion
267
- //#region src/devtools/actions.ts
268
- /**
269
- * This file contain devtools actions, they are not Pinia actions.
270
- */
271
- function checkClipboardAccess() {
272
- if (!("clipboard" in navigator)) {
273
- toastMessage(`Your browser doesn't support the Clipboard API`, "error");
274
- return true;
275
- }
276
- }
277
- function checkNotFocusedError(error) {
278
- if (error instanceof Error && error.message.toLowerCase().includes("document is not focused")) {
279
- toastMessage("You need to activate the \"Emulate a focused page\" setting in the \"Rendering\" panel of devtools.", "warn");
280
- return true;
281
- }
282
- return false;
283
- }
284
- async function actionGlobalCopyState(pinia) {
285
- if (checkClipboardAccess()) return;
286
- try {
287
- await navigator.clipboard.writeText(JSON.stringify(pinia.state.value));
288
- toastMessage("Global state copied to clipboard.");
289
- } catch (error) {
290
- if (checkNotFocusedError(error)) return;
291
- toastMessage(`Failed to serialize the state. Check the console for more details.`, "error");
292
- console.error(error);
293
- }
294
- }
295
- async function actionGlobalPasteState(pinia) {
296
- if (checkClipboardAccess()) return;
297
- try {
298
- loadStoresState(pinia, JSON.parse(await navigator.clipboard.readText()));
299
- toastMessage("Global state pasted from clipboard.");
300
- } catch (error) {
301
- if (checkNotFocusedError(error)) return;
302
- toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, "error");
303
- console.error(error);
304
- }
305
- }
306
- async function actionGlobalSaveState(pinia) {
307
- try {
308
- saveAs(new Blob([JSON.stringify(pinia.state.value)], { type: "text/plain;charset=utf-8" }), "pinia-state.json");
309
- } catch (error) {
310
- toastMessage(`Failed to export the state as JSON. Check the console for more details.`, "error");
311
- console.error(error);
312
- }
313
- }
314
- let fileInput;
315
- function getFileOpener() {
316
- if (!fileInput) {
317
- fileInput = document.createElement("input");
318
- fileInput.type = "file";
319
- fileInput.accept = ".json";
320
- }
321
- function openFile() {
322
- return new Promise((resolve, reject) => {
323
- fileInput.onchange = async () => {
324
- const files = fileInput.files;
325
- if (!files) return resolve(null);
326
- const file = files.item(0);
327
- if (!file) return resolve(null);
328
- return resolve({
329
- text: await file.text(),
330
- file
331
- });
332
- };
333
- fileInput.oncancel = () => resolve(null);
334
- fileInput.onerror = reject;
335
- fileInput.click();
336
- });
337
- }
338
- return openFile;
339
- }
340
- async function actionGlobalOpenStateFile(pinia) {
341
- try {
342
- const result = await getFileOpener()();
343
- if (!result) return;
344
- const { text, file } = result;
345
- loadStoresState(pinia, JSON.parse(text));
346
- toastMessage(`Global state imported from "${file.name}".`);
347
- } catch (error) {
348
- toastMessage(`Failed to import the state from JSON. Check the console for more details.`, "error");
349
- console.error(error);
350
- }
351
- }
352
- function loadStoresState(pinia, state) {
353
- for (const key in state) {
354
- const storeState = pinia.state.value[key];
355
- if (storeState) Object.assign(storeState, state[key]);
356
- else pinia.state.value[key] = state[key];
357
- }
358
- }
359
- //#endregion
360
- //#region src/devtools/formatting.ts
361
- function formatDisplay(display) {
362
- return { _custom: { display } };
363
- }
364
- const PINIA_ROOT_LABEL = "🍍 Pinia (root)";
365
- const PINIA_ROOT_ID = "_root";
366
- function formatStoreForInspectorTree(store) {
367
- return isPinia(store) ? {
368
- id: PINIA_ROOT_ID,
369
- label: PINIA_ROOT_LABEL
370
- } : {
371
- id: store.$id,
372
- label: store.$id
373
- };
374
- }
375
- function formatStoreForInspectorState(store) {
376
- if (isPinia(store)) {
377
- const storeNames = Array.from(store._s.keys());
378
- const storeMap = store._s;
379
- return {
380
- state: storeNames.map((storeId) => ({
381
- editable: true,
382
- key: storeId,
383
- value: store.state.value[storeId]
384
- })),
385
- getters: storeNames.filter((id) => storeMap.get(id)._getters).map((id) => {
386
- const store = storeMap.get(id);
387
- return {
388
- editable: false,
389
- key: id,
390
- value: store._getters.reduce((getters, key) => {
391
- getters[key] = store[key];
392
- return getters;
393
- }, {})
394
- };
395
- })
396
- };
397
- }
398
- const state = { state: Object.keys(store.$state).map((key) => ({
399
- editable: true,
400
- key,
401
- value: store.$state[key]
402
- })) };
403
- if (store._getters && store._getters.length) state.getters = store._getters.map((getterName) => ({
404
- editable: isWritableComputed(store, getterName),
405
- key: getterName,
406
- value: store[getterName]
407
- }));
408
- if (store._customProperties.size) state.customProperties = Array.from(store._customProperties).map((key) => ({
409
- editable: true,
410
- key,
411
- value: store[key]
412
- }));
413
- return state;
414
- }
415
- function formatEventData(events) {
416
- if (!events) return {};
417
- if (Array.isArray(events)) return events.reduce((data, event) => {
418
- data.keys.push(event.key);
419
- data.operations.push(event.type);
420
- data.oldValue[event.key] = event.oldValue;
421
- data.newValue[event.key] = event.newValue;
422
- return data;
423
- }, {
424
- oldValue: {},
425
- keys: [],
426
- operations: [],
427
- newValue: {}
428
- });
429
- else return {
430
- operation: formatDisplay(events.type),
431
- key: formatDisplay(events.key),
432
- oldValue: events.oldValue,
433
- newValue: events.newValue
434
- };
435
- }
436
- function formatMutationType(type) {
437
- switch (type) {
438
- case "direct": return "mutation";
439
- case "patch function": return "$patch";
440
- case "patch object": return "$patch";
441
- default: return "unknown";
442
- }
443
- }
444
- //#endregion
445
- //#region src/devtools/plugin.ts
446
- let isTimelineActive = true;
447
- const componentStateTypes = [];
448
- const MUTATIONS_LAYER_ID = "pinia:mutations";
449
- const INSPECTOR_ID = "pinia";
450
- const { assign: assign$1 } = Object;
451
- /**
452
- * Gets the displayed name of a store in devtools
453
- *
454
- * @param id - id of the store
455
- * @returns a formatted string
456
- */
457
- const getStoreType = (id) => "🍍 " + id;
458
- /**
459
- * Add the pinia plugin without any store. Allows displaying a Pinia plugin tab
460
- * as soon as it is added to the application.
461
- *
462
- * @param app - Vue application
463
- * @param pinia - pinia instance
464
- */
465
- function registerPiniaDevtools(app, pinia) {
466
- setupDevToolsPlugin({
467
- id: "dev.esm.pinia",
468
- label: "Pinia 🍍",
469
- logo: "https://pinia.vuejs.org/logo.svg",
470
- packageName: "pinia",
471
- homepage: "https://pinia.vuejs.org",
472
- componentStateTypes,
473
- app
474
- }, (api) => {
475
- if (typeof api.now !== "function") toastMessage("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.");
476
- api.addTimelineLayer({
477
- id: MUTATIONS_LAYER_ID,
478
- label: `Pinia 🍍`,
479
- color: 15064968
480
- });
481
- api.addInspector({
482
- id: INSPECTOR_ID,
483
- label: "Pinia 🍍",
484
- icon: "storage",
485
- treeFilterPlaceholder: "Search stores",
486
- actions: [
487
- {
488
- icon: "content_copy",
489
- action: () => {
490
- actionGlobalCopyState(pinia);
491
- },
492
- tooltip: "Serialize and copy the state"
493
- },
494
- {
495
- icon: "content_paste",
496
- action: async () => {
497
- await actionGlobalPasteState(pinia);
498
- api.sendInspectorTree(INSPECTOR_ID);
499
- api.sendInspectorState(INSPECTOR_ID);
500
- },
501
- tooltip: "Replace the state with the content of your clipboard"
502
- },
503
- {
504
- icon: "save",
505
- action: () => {
506
- actionGlobalSaveState(pinia);
507
- },
508
- tooltip: "Save the state as a JSON file"
509
- },
510
- {
511
- icon: "folder_open",
512
- action: async () => {
513
- await actionGlobalOpenStateFile(pinia);
514
- api.sendInspectorTree(INSPECTOR_ID);
515
- api.sendInspectorState(INSPECTOR_ID);
516
- },
517
- tooltip: "Import the state from a JSON file"
518
- }
519
- ],
520
- nodeActions: [{
521
- icon: "restore",
522
- tooltip: "Reset the state (with \"$reset\")",
523
- action: (nodeId) => {
524
- const store = pinia._s.get(nodeId);
525
- if (!store) toastMessage(`Cannot reset "${nodeId}" store because it wasn't found.`, "warn");
526
- else if (typeof store.$reset !== "function") toastMessage(`Cannot reset "${nodeId}" store because it doesn't have a "$reset" method implemented.`, "warn");
527
- else {
528
- store.$reset();
529
- toastMessage(`Store "${nodeId}" reset.`);
530
- }
531
- }
532
- }]
533
- });
534
- api.on.inspectComponent((payload) => {
535
- const proxy = payload.componentInstance && payload.componentInstance.proxy;
536
- if (proxy && proxy._pStores) {
537
- const piniaStores = payload.componentInstance.proxy._pStores;
538
- Object.values(piniaStores).forEach((store) => {
539
- payload.instanceData.state.push({
540
- type: getStoreType(store.$id),
541
- key: "state",
542
- editable: true,
543
- value: store._isOptionsAPI ? { _custom: {
544
- value: toRaw(store.$state),
545
- actions: [{
546
- icon: "restore",
547
- tooltip: "Reset the state of this store",
548
- action: () => store.$reset()
549
- }]
550
- } } : Object.keys(store.$state).reduce((state, key) => {
551
- state[key] = store.$state[key];
552
- return state;
553
- }, {})
554
- });
555
- if (store._getters && store._getters.length) payload.instanceData.state.push({
556
- type: getStoreType(store.$id),
557
- key: "getters",
558
- editable: false,
559
- value: store._getters.reduce((getters, key) => {
560
- try {
561
- getters[key] = store[key];
562
- } catch (error) {
563
- getters[key] = error;
564
- }
565
- return getters;
566
- }, {})
567
- });
568
- });
569
- }
570
- });
571
- api.on.getInspectorTree((payload) => {
572
- if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
573
- let stores = [pinia];
574
- stores = stores.concat(Array.from(pinia._s.values()));
575
- payload.rootNodes = (payload.filter ? stores.filter((store) => "$id" in store ? store.$id.toLowerCase().includes(payload.filter.toLowerCase()) : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase())) : stores).map(formatStoreForInspectorTree);
576
- }
577
- });
578
- globalThis.$pinia = pinia;
579
- api.on.getInspectorState((payload) => {
580
- if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
581
- const inspectedStore = payload.nodeId === "_root" ? pinia : pinia._s.get(payload.nodeId);
582
- if (!inspectedStore) return;
583
- if (inspectedStore) {
584
- if (payload.nodeId !== "_root") globalThis.$store = toRaw(inspectedStore);
585
- payload.state = formatStoreForInspectorState(inspectedStore);
586
- }
587
- }
588
- });
589
- api.on.editInspectorState((payload) => {
590
- if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
591
- const inspectedStore = payload.nodeId === "_root" ? pinia : pinia._s.get(payload.nodeId);
592
- if (!inspectedStore) return toastMessage(`store "${payload.nodeId}" not found`, "error");
593
- const { path } = payload;
594
- if (!isPinia(inspectedStore)) {
595
- if (path.length !== 1 || !inspectedStore._customProperties.has(path[0]) && !isWritableComputed(inspectedStore, path[0]) || path[0] in inspectedStore.$state) path.unshift("$state");
596
- } else path.unshift("state");
597
- isTimelineActive = false;
598
- payload.set(inspectedStore, path, payload.state.value);
599
- isTimelineActive = true;
600
- }
601
- });
602
- api.on.editComponentState((payload) => {
603
- if (payload.type.startsWith("🍍")) {
604
- const storeId = payload.type.replace(/^🍍\s*/, "");
605
- const store = pinia._s.get(storeId);
606
- if (!store) return toastMessage(`store "${storeId}" not found`, "error");
607
- const { path } = payload;
608
- if (path[0] !== "state") return toastMessage(`Invalid path for store "${storeId}":\n${path}\nOnly state can be modified.`);
609
- path[0] = "$state";
610
- isTimelineActive = false;
611
- payload.set(store, path, payload.state.value);
612
- isTimelineActive = true;
613
- }
614
- });
615
- });
616
- }
617
- function addStoreToDevtools(app, store) {
618
- if (!componentStateTypes.includes(getStoreType(store.$id))) componentStateTypes.push(getStoreType(store.$id));
619
- setupDevToolsPlugin({
620
- id: "dev.esm.pinia",
621
- label: "Pinia 🍍",
622
- logo: "https://pinia.vuejs.org/logo.svg",
623
- packageName: "pinia",
624
- homepage: "https://pinia.vuejs.org",
625
- componentStateTypes,
626
- app,
627
- settings: { logStoreChanges: {
628
- label: "Notify about new/deleted stores",
629
- type: "boolean",
630
- defaultValue: true
631
- } }
632
- }, (api) => {
633
- const now = typeof api.now === "function" ? api.now.bind(api) : Date.now;
634
- store.$onAction(({ after, onError, name, args }) => {
635
- const groupId = runningActionId++;
636
- api.addTimelineEvent({
637
- layerId: MUTATIONS_LAYER_ID,
638
- event: {
639
- time: now(),
640
- title: "🛫 " + name,
641
- subtitle: "start",
642
- data: {
643
- store: formatDisplay(store.$id),
644
- action: formatDisplay(name),
645
- args
646
- },
647
- groupId
648
- }
649
- });
650
- after((result) => {
651
- activeAction = void 0;
652
- api.addTimelineEvent({
653
- layerId: MUTATIONS_LAYER_ID,
654
- event: {
655
- time: now(),
656
- title: "🛬 " + name,
657
- subtitle: "end",
658
- data: {
659
- store: formatDisplay(store.$id),
660
- action: formatDisplay(name),
661
- args,
662
- result
663
- },
664
- groupId
665
- }
666
- });
667
- });
668
- onError((error) => {
669
- activeAction = void 0;
670
- api.addTimelineEvent({
671
- layerId: MUTATIONS_LAYER_ID,
672
- event: {
673
- time: now(),
674
- logType: "error",
675
- title: "💥 " + name,
676
- subtitle: "end",
677
- data: {
678
- store: formatDisplay(store.$id),
679
- action: formatDisplay(name),
680
- args,
681
- error
682
- },
683
- groupId
684
- }
685
- });
686
- });
687
- }, true);
688
- store._customProperties.forEach((name) => {
689
- watch(() => unref(store[name]), (newValue, oldValue) => {
690
- api.notifyComponentUpdate();
691
- api.sendInspectorState(INSPECTOR_ID);
692
- if (isTimelineActive) api.addTimelineEvent({
693
- layerId: MUTATIONS_LAYER_ID,
694
- event: {
695
- time: now(),
696
- title: "Change",
697
- subtitle: name,
698
- data: {
699
- newValue,
700
- oldValue
701
- },
702
- groupId: activeAction
703
- }
704
- });
705
- }, { deep: true });
706
- });
707
- store.$subscribe(({ events, type }, state) => {
708
- api.notifyComponentUpdate();
709
- api.sendInspectorState(INSPECTOR_ID);
710
- if (!isTimelineActive) return;
711
- const eventData = {
712
- time: now(),
713
- title: formatMutationType(type),
714
- data: assign$1({ store: formatDisplay(store.$id) }, formatEventData(events)),
715
- groupId: activeAction
716
- };
717
- if (type === "patch function") eventData.subtitle = "⤵️";
718
- else if (type === "patch object") eventData.subtitle = "🧩";
719
- else if (events && !Array.isArray(events)) eventData.subtitle = events.type;
720
- if (events) eventData.data["rawEvent(s)"] = { _custom: {
721
- display: "DebuggerEvent",
722
- type: "object",
723
- tooltip: "raw DebuggerEvent[]",
724
- value: events
725
- } };
726
- api.addTimelineEvent({
727
- layerId: MUTATIONS_LAYER_ID,
728
- event: eventData
729
- });
730
- }, {
731
- detached: true,
732
- flush: "sync"
733
- });
734
- const hotUpdate = store._hotUpdate;
735
- store._hotUpdate = markRaw((newStore) => {
736
- hotUpdate(newStore);
737
- api.addTimelineEvent({
738
- layerId: MUTATIONS_LAYER_ID,
739
- event: {
740
- time: now(),
741
- title: "🔥 " + store.$id,
742
- subtitle: "HMR update",
743
- data: {
744
- store: formatDisplay(store.$id),
745
- info: formatDisplay(`HMR update`)
746
- }
747
- }
748
- });
749
- api.notifyComponentUpdate();
750
- api.sendInspectorTree(INSPECTOR_ID);
751
- api.sendInspectorState(INSPECTOR_ID);
752
- });
753
- const { $dispose } = store;
754
- store.$dispose = () => {
755
- $dispose();
756
- api.notifyComponentUpdate();
757
- api.sendInspectorTree(INSPECTOR_ID);
758
- api.sendInspectorState(INSPECTOR_ID);
759
- api.getSettings().logStoreChanges && toastMessage(`Disposed "${store.$id}" store 🗑`);
760
- };
761
- api.notifyComponentUpdate();
762
- api.sendInspectorTree(INSPECTOR_ID);
763
- api.sendInspectorState(INSPECTOR_ID);
764
- api.getSettings().logStoreChanges && toastMessage(`"${store.$id}" store installed 🆕`);
765
- });
766
- }
767
- let runningActionId = 0;
768
- let activeAction;
769
- /**
770
- * Patches a store to enable action grouping in devtools by wrapping the store with a Proxy that is passed as the
771
- * context of all actions, allowing us to set `runningAction` on each access and effectively associating any state
772
- * mutation to the action.
773
- *
774
- * @param store - store to patch
775
- * @param actionNames - list of actionst to patch
776
- */
777
- function patchActionForGrouping(store, actionNames, wrapWithProxy) {
778
- const actions = actionNames.reduce((storeActions, actionName) => {
779
- storeActions[actionName] = toRaw(store)[actionName];
780
- return storeActions;
781
- }, {});
782
- for (const actionName in actions) store[actionName] = function() {
783
- const _actionId = runningActionId;
784
- const trackedStore = wrapWithProxy ? new Proxy(store, {
785
- get(...args) {
786
- activeAction = _actionId;
787
- return Reflect.get(...args);
788
- },
789
- set(...args) {
790
- activeAction = _actionId;
791
- return Reflect.set(...args);
792
- }
793
- }) : store;
794
- activeAction = _actionId;
795
- const retValue = actions[actionName].apply(trackedStore, arguments);
796
- activeAction = void 0;
797
- return retValue;
798
- };
799
- }
800
- /**
801
- * pinia.use(devtoolsPlugin)
802
- */
803
- function devtoolsPlugin({ app, store, options }) {
804
- if (store.$id.startsWith("__hot:")) return;
805
- store._isOptionsAPI = !!options.state;
806
- if (!store._p._testing) {
807
- patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);
808
- const originalHotUpdate = store._hotUpdate;
809
- toRaw(store)._hotUpdate = function(newStore) {
810
- originalHotUpdate.apply(this, arguments);
811
- patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);
812
- };
813
- }
814
- addStoreToDevtools(app, store);
815
- }
816
- //#endregion
817
- //#region src/createPinia.ts
818
- /**
819
- * Creates a Pinia instance to be used by the application
820
- */
821
- function createPinia() {
822
- const scope = effectScope(true);
823
- const state = scope.run(() => ref({}));
824
- let _p = [];
825
- let toBeInstalled = [];
826
- const pinia = markRaw({
827
- install(app) {
828
- setActivePinia(pinia);
829
- pinia._a = app;
830
- app.provide(piniaSymbol, pinia);
831
- app.config.globalProperties.$pinia = pinia;
832
- /* istanbul ignore else */
833
- if ((process.env.NODE_ENV !== "production" || typeof __VUE_PROD_DEVTOOLS__ !== "undefined" && __VUE_PROD_DEVTOOLS__) && !(process.env.NODE_ENV === "test") && IS_CLIENT) registerPiniaDevtools(app, pinia);
834
- toBeInstalled.forEach((plugin) => _p.push(plugin));
835
- toBeInstalled = [];
836
- },
837
- use(plugin) {
838
- if (!this._a) toBeInstalled.push(plugin);
839
- else _p.push(plugin);
840
- return this;
841
- },
842
- _p,
843
- _a: null,
844
- _e: scope,
845
- _s: /* @__PURE__ */ new Map(),
846
- state
847
- });
848
- if ((process.env.NODE_ENV !== "production" || typeof __VUE_PROD_DEVTOOLS__ !== "undefined" && __VUE_PROD_DEVTOOLS__) && !(process.env.NODE_ENV === "test") && IS_CLIENT && typeof Proxy !== "undefined") pinia.use(devtoolsPlugin);
849
- return pinia;
850
- }
851
- /**
852
- * Dispose a Pinia instance by stopping its effectScope and removing the state, plugins and stores. This is mostly
853
- * useful in tests, with both a testing pinia or a regular pinia and in applications that use multiple pinia instances.
854
- * Once disposed, the pinia instance cannot be used anymore.
855
- *
856
- * @param pinia - pinia instance
857
- */
858
- function disposePinia(pinia) {
859
- pinia._e.stop();
860
- pinia._s.clear();
861
- pinia._p.splice(0);
862
- pinia.state.value = {};
863
- pinia._a = null;
864
- }
865
- //#endregion
866
- //#region src/hmr.ts
867
- /**
868
- * Checks if a function is a `StoreDefinition`.
869
- *
870
- * @param fn - object to test
871
- * @returns true if `fn` is a StoreDefinition
872
- */
873
- const isUseStore = (fn) => {
874
- return typeof fn === "function" && typeof fn.$id === "string";
875
- };
876
- /**
877
- * Mutates in place `newState` with `oldState` to _hot update_ it. It will
878
- * remove any key not existing in `newState` and recursively merge plain
879
- * objects.
880
- *
881
- * @param newState - new state object to be patched
882
- * @param oldState - old state that should be used to patch newState
883
- * @returns - newState
884
- */
885
- function patchObject(newState, oldState) {
886
- for (const key in oldState) {
887
- const subPatch = oldState[key];
888
- if (!(key in newState)) continue;
889
- const targetValue = newState[key];
890
- if (isPlainObject(targetValue) && isPlainObject(subPatch) && !isRef(subPatch) && !isReactive(subPatch)) newState[key] = patchObject(targetValue, subPatch);
891
- else newState[key] = subPatch;
892
- }
893
- return newState;
894
- }
895
- /**
896
- * Creates an _accept_ function to pass to `import.meta.hot` in Vite applications.
897
- *
898
- * @example
899
- * ```js
900
- * const useUser = defineStore(...)
901
- * if (import.meta.hot) {
902
- * import.meta.hot.accept(acceptHMRUpdate(useUser, import.meta.hot))
903
- * }
904
- * ```
905
- *
906
- * @param initialUseStore - return of the defineStore to hot update
907
- * @param hot - `import.meta.hot`
908
- */
909
- function acceptHMRUpdate(initialUseStore, hot) {
910
- if (!(process.env.NODE_ENV !== "production")) return () => {};
911
- return (newModule) => {
912
- const pinia = hot.data.pinia || initialUseStore._pinia;
913
- if (!pinia) return;
914
- hot.data.pinia = pinia;
915
- for (const exportName in newModule) {
916
- const useStore = newModule[exportName];
917
- if (isUseStore(useStore) && pinia._s.has(useStore.$id)) {
918
- const id = useStore.$id;
919
- if (id !== initialUseStore.$id) {
920
- diagnostics.PINIA_R1005({
921
- from: initialUseStore.$id,
922
- to: id
923
- });
924
- return hot.invalidate();
925
- }
926
- const existingStore = pinia._s.get(id);
927
- if (!existingStore) {
928
- console.log(`[Pinia]: skipping hmr because store doesn't exist yet`);
929
- return;
930
- }
931
- useStore(pinia, existingStore);
932
- }
933
- }
934
- };
935
- }
936
- //#endregion
937
- //#region src/subscriptions.ts
938
- const noop = () => {};
939
- function addSubscription(subscriptions, callback, detached, onCleanup = noop) {
940
- subscriptions.add(callback);
941
- const removeSubscription = () => {
942
- subscriptions.delete(callback) && onCleanup();
943
- };
944
- if (!detached && getCurrentScope()) onScopeDispose(removeSubscription);
945
- return removeSubscription;
946
- }
947
- function triggerSubscriptions(subscriptions, ...args) {
948
- subscriptions.forEach((callback) => {
949
- callback(...args);
950
- });
951
- }
952
- //#endregion
953
- //#region src/store.ts
954
- const fallbackRunWithContext = (fn) => fn();
955
- /**
956
- * Marks a function as an action for `$onAction`
957
- * @internal
958
- */
959
- const ACTION_MARKER = Symbol();
960
- /**
961
- * Action name symbol. Allows to add a name to an action after defining it
962
- * @internal
963
- */
964
- const ACTION_NAME = Symbol();
965
- function mergeReactiveObjects(target, patchToApply) {
966
- if (target instanceof Map && patchToApply instanceof Map) patchToApply.forEach((value, key) => target.set(key, value));
967
- else if (target instanceof Set && patchToApply instanceof Set) patchToApply.forEach(target.add, target);
968
- for (const key in patchToApply) {
969
- if (!Object.hasOwn(patchToApply, key)) continue;
970
- const subPatch = patchToApply[key];
971
- const targetValue = target[key];
972
- if (isPlainObject(targetValue) && isPlainObject(subPatch) && Object.hasOwn(target, key) && !isRef(subPatch) && !isReactive(subPatch)) target[key] = mergeReactiveObjects(targetValue, subPatch);
973
- else target[key] = subPatch;
974
- }
975
- return target;
976
- }
977
- const skipHydrateSymbol = process.env.NODE_ENV !== "production" ? Symbol("pinia:skipHydration") : /* istanbul ignore next */ Symbol();
978
- /**
979
- * Tells Pinia to skip the hydration process of a given object. This is useful in setup stores (only) when you return a
980
- * stateful object in the store but it isn't really state. e.g. returning a router instance in a setup store.
981
- *
982
- * @param obj - target object
983
- * @returns obj
984
- */
985
- function skipHydrate(obj) {
986
- return Object.defineProperty(obj, skipHydrateSymbol, {});
987
- }
988
- /**
989
- * Returns whether a value should be hydrated
990
- *
991
- * @param obj - target variable
992
- * @returns true if `obj` should be hydrated
993
- */
994
- function shouldHydrate(obj) {
995
- return !obj || typeof obj !== "object" || !Object.hasOwn(obj, skipHydrateSymbol);
996
- }
997
- const { assign } = Object;
998
- function isComputed(o) {
999
- return !!(isRef(o) && o.effect);
1000
- }
1001
- function createOptionsStore(id, options, pinia, hot) {
1002
- const { state, actions, getters } = options;
1003
- const initialState = pinia.state.value[id];
1004
- let store;
1005
- function setup() {
1006
- if (!initialState && (!(process.env.NODE_ENV !== "production") || !hot))
1007
- /* istanbul ignore if */
1008
- pinia.state.value[id] = state ? state() : {};
1009
- const localState = process.env.NODE_ENV !== "production" && hot ? toRefs(ref(state ? state() : {}).value) : toRefs(pinia.state.value[id]);
1010
- return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {
1011
- if (process.env.NODE_ENV !== "production" && name in localState) diagnostics.PINIA_R1002({
1012
- name,
1013
- id
1014
- });
1015
- computedGetters[name] = markRaw(computed(() => {
1016
- setActivePinia(pinia);
1017
- const store = pinia._s.get(id);
1018
- return getters[name].call(store, store);
1019
- }));
1020
- return computedGetters;
1021
- }, {}));
1022
- }
1023
- store = createSetupStore(id, setup, options, pinia, hot, true);
1024
- return store;
1025
- }
1026
- function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
1027
- let scope;
1028
- const optionsForPlugin = assign({ actions: {} }, options);
1029
- /* istanbul ignore if */
1030
- if (process.env.NODE_ENV !== "production" && !pinia._e.active) throw new Error("Pinia destroyed");
1031
- const $subscribeOptions = { deep: true };
1032
- /* istanbul ignore else */
1033
- if (process.env.NODE_ENV !== "production") $subscribeOptions.onTrigger = (event) => {
1034
- /* istanbul ignore else */
1035
- if (isListening) debuggerEvents = event;
1036
- else if (isListening === false && !store._hotUpdating)
1037
- /* istanbul ignore else */
1038
- if (Array.isArray(debuggerEvents)) debuggerEvents.push(event);
1039
- else console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.");
1040
- };
1041
- let isListening;
1042
- let isSyncListening;
1043
- let subscriptions = /* @__PURE__ */ new Set();
1044
- let actionSubscriptions = /* @__PURE__ */ new Set();
1045
- let debuggerEvents;
1046
- const initialState = pinia.state.value[$id];
1047
- if (!isOptionsStore && !initialState && (!(process.env.NODE_ENV !== "production") || !hot))
1048
- /* istanbul ignore if */
1049
- pinia.state.value[$id] = {};
1050
- const hotState = /*#__PURE__*/ ref({});
1051
- let activeListener;
1052
- function $patch(partialStateOrMutator) {
1053
- let subscriptionMutation;
1054
- isListening = isSyncListening = false;
1055
- /* istanbul ignore else */
1056
- if (process.env.NODE_ENV !== "production") debuggerEvents = [];
1057
- if (typeof partialStateOrMutator === "function") {
1058
- partialStateOrMutator(pinia.state.value[$id]);
1059
- subscriptionMutation = {
1060
- type: "patch function",
1061
- storeId: $id,
1062
- events: debuggerEvents
1063
- };
1064
- } else {
1065
- mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
1066
- subscriptionMutation = {
1067
- type: "patch object",
1068
- payload: partialStateOrMutator,
1069
- storeId: $id,
1070
- events: debuggerEvents
1071
- };
1072
- }
1073
- const myListenerId = activeListener = Symbol();
1074
- nextTick().then(() => {
1075
- if (activeListener === myListenerId) isListening = true;
1076
- });
1077
- isSyncListening = true;
1078
- triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
1079
- }
1080
- const $reset = isOptionsStore ? function $reset() {
1081
- const { state } = options;
1082
- const newState = state ? state() : {};
1083
- this.$patch(($state) => {
1084
- assign($state, newState);
1085
- });
1086
- } : process.env.NODE_ENV !== "production" ? () => {
1087
- throw new Error(`🍍: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
1088
- } : noop;
1089
- function $dispose() {
1090
- scope.stop();
1091
- subscriptions.clear();
1092
- actionSubscriptions.clear();
1093
- pinia._s.delete($id);
1094
- }
1095
- /**
1096
- * Helper that wraps function so it can be tracked with $onAction
1097
- * @param fn - action to wrap
1098
- * @param name - name of the action
1099
- */
1100
- const action = (fn, name = "") => {
1101
- if (ACTION_MARKER in fn) {
1102
- fn[ACTION_NAME] = name;
1103
- return fn;
1104
- }
1105
- const wrappedAction = function() {
1106
- setActivePinia(pinia);
1107
- const args = Array.from(arguments);
1108
- const afterCallbackSet = /* @__PURE__ */ new Set();
1109
- const onErrorCallbackSet = /* @__PURE__ */ new Set();
1110
- function after(callback) {
1111
- afterCallbackSet.add(callback);
1112
- }
1113
- function onError(callback) {
1114
- onErrorCallbackSet.add(callback);
1115
- }
1116
- triggerSubscriptions(actionSubscriptions, {
1117
- args,
1118
- name: wrappedAction[ACTION_NAME],
1119
- store,
1120
- after,
1121
- onError
1122
- });
1123
- let ret;
1124
- try {
1125
- ret = fn.apply(this && this.$id === $id ? this : store, args);
1126
- } catch (error) {
1127
- triggerSubscriptions(onErrorCallbackSet, error);
1128
- throw error;
1129
- }
1130
- if (ret instanceof Promise) return ret.then((value) => {
1131
- triggerSubscriptions(afterCallbackSet, value);
1132
- return value;
1133
- }).catch((error) => {
1134
- triggerSubscriptions(onErrorCallbackSet, error);
1135
- return Promise.reject(error);
1136
- });
1137
- triggerSubscriptions(afterCallbackSet, ret);
1138
- return ret;
1139
- };
1140
- wrappedAction[ACTION_MARKER] = true;
1141
- wrappedAction[ACTION_NAME] = name;
1142
- return wrappedAction;
1143
- };
1144
- const _hmrPayload = /*#__PURE__*/ markRaw({
1145
- actions: {},
1146
- getters: {},
1147
- state: [],
1148
- hotState
1149
- });
1150
- const partialStore = {
1151
- _p: pinia,
1152
- $id,
1153
- $onAction: addSubscription.bind(null, actionSubscriptions),
1154
- $patch,
1155
- $reset,
1156
- $subscribe(callback, options = {}) {
1157
- if (subscriptions.has(callback)) {
1158
- if (process.env.NODE_ENV !== "production") diagnostics.PINIA_R1007({ id: $id });
1159
- return noop;
1160
- }
1161
- const removeSubscription = addSubscription(subscriptions, callback, options.detached, () => stopWatcher());
1162
- const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {
1163
- if (options.flush === "sync" ? isSyncListening : isListening) callback({
1164
- storeId: $id,
1165
- type: "direct",
1166
- events: debuggerEvents
1167
- }, state);
1168
- }, assign({}, $subscribeOptions, options)));
1169
- return removeSubscription;
1170
- },
1171
- $dispose
1172
- };
1173
- const store = reactive(process.env.NODE_ENV !== "production" || (process.env.NODE_ENV !== "production" || typeof __VUE_PROD_DEVTOOLS__ !== "undefined" && __VUE_PROD_DEVTOOLS__) && !(process.env.NODE_ENV === "test") && IS_CLIENT ? assign({
1174
- _hmrPayload,
1175
- _customProperties: markRaw(/* @__PURE__ */ new Set())
1176
- }, partialStore) : partialStore);
1177
- pinia._s.set($id, store);
1178
- const setupStore = (pinia._a && pinia._a.runWithContext || fallbackRunWithContext)(() => pinia._e.run(() => (scope = effectScope()).run(() => setup({ action }))));
1179
- for (const key in setupStore) {
1180
- const prop = setupStore[key];
1181
- if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {
1182
- if (process.env.NODE_ENV !== "production" && hot) hotState.value[key] = toRef(setupStore, key);
1183
- else if (!isOptionsStore) {
1184
- if (initialState && shouldHydrate(prop)) if (isRef(prop)) prop.value = initialState[key];
1185
- else {
1186
- if (prop instanceof Set || prop instanceof Map) prop.clear();
1187
- mergeReactiveObjects(prop, initialState[key]);
1188
- }
1189
- pinia.state.value[$id][key] = prop;
1190
- }
1191
- /* istanbul ignore else */
1192
- if (process.env.NODE_ENV !== "production") _hmrPayload.state.push(key);
1193
- } else if (typeof prop === "function") {
1194
- setupStore[key] = process.env.NODE_ENV !== "production" && hot ? prop : action(prop, key);
1195
- /* istanbul ignore else */
1196
- if (process.env.NODE_ENV !== "production") _hmrPayload.actions[key] = prop;
1197
- optionsForPlugin.actions[key] = prop;
1198
- } else if (process.env.NODE_ENV !== "production") {
1199
- if (isComputed(prop)) {
1200
- _hmrPayload.getters[key] = isOptionsStore ? options.getters[key] : prop;
1201
- if (IS_CLIENT) (setupStore._getters || (setupStore._getters = markRaw([]))).push(key);
1202
- }
1203
- }
1204
- }
1205
- /* istanbul ignore if */
1206
- assign(store, setupStore);
1207
- assign(toRaw(store), setupStore);
1208
- Object.defineProperty(store, "$state", {
1209
- get: () => process.env.NODE_ENV !== "production" && hot ? hotState.value : pinia.state.value[$id],
1210
- set: (state) => {
1211
- /* istanbul ignore if */
1212
- if (process.env.NODE_ENV !== "production" && hot) throw new Error("cannot set hotState");
1213
- $patch(($state) => {
1214
- assign($state, state);
1215
- });
1216
- }
1217
- });
1218
- /* istanbul ignore else */
1219
- if (process.env.NODE_ENV !== "production") store._hotUpdate = markRaw((newStore) => {
1220
- store._hotUpdating = true;
1221
- newStore._hmrPayload.state.forEach((stateKey) => {
1222
- if (stateKey in store.$state) {
1223
- const newStateTarget = newStore.$state[stateKey];
1224
- const oldStateSource = store.$state[stateKey];
1225
- if (isOptionsStore && typeof newStateTarget === "object" && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) patchObject(newStateTarget, oldStateSource);
1226
- else newStore.$state[stateKey] = oldStateSource;
1227
- }
1228
- store[stateKey] = toRef(newStore.$state, stateKey);
1229
- });
1230
- Object.keys(store.$state).forEach((stateKey) => {
1231
- if (!(stateKey in newStore.$state)) delete store[stateKey];
1232
- });
1233
- isListening = false;
1234
- isSyncListening = false;
1235
- pinia.state.value[$id] = toRef(newStore._hmrPayload, "hotState");
1236
- isSyncListening = true;
1237
- nextTick().then(() => {
1238
- isListening = true;
1239
- });
1240
- for (const actionName in newStore._hmrPayload.actions) {
1241
- const actionFn = newStore[actionName];
1242
- store[actionName] = action(actionFn, actionName);
1243
- }
1244
- for (const getterName in newStore._hmrPayload.getters) {
1245
- const getter = newStore._hmrPayload.getters[getterName];
1246
- const getterValue = isOptionsStore ? computed(() => {
1247
- setActivePinia(pinia);
1248
- return getter.call(store, store);
1249
- }) : getter;
1250
- store[getterName] = getterValue;
1251
- }
1252
- Object.keys(store._hmrPayload.getters).forEach((key) => {
1253
- if (!(key in newStore._hmrPayload.getters)) delete store[key];
1254
- });
1255
- Object.keys(store._hmrPayload.actions).forEach((key) => {
1256
- if (!(key in newStore._hmrPayload.actions)) delete store[key];
1257
- });
1258
- store._hmrPayload = newStore._hmrPayload;
1259
- store._getters = newStore._getters;
1260
- store._hotUpdating = false;
1261
- });
1262
- if ((process.env.NODE_ENV !== "production" || typeof __VUE_PROD_DEVTOOLS__ !== "undefined" && __VUE_PROD_DEVTOOLS__) && !(process.env.NODE_ENV === "test") && IS_CLIENT) {
1263
- const nonEnumerable = {
1264
- writable: true,
1265
- configurable: true,
1266
- enumerable: false
1267
- };
1268
- [
1269
- "_p",
1270
- "_hmrPayload",
1271
- "_getters",
1272
- "_customProperties"
1273
- ].forEach((p) => {
1274
- Object.defineProperty(store, p, assign({ value: store[p] }, nonEnumerable));
1275
- });
1276
- }
1277
- pinia._p.forEach((extender) => {
1278
- const extensions = scope.run(() => extender({
1279
- store,
1280
- app: pinia._a,
1281
- pinia,
1282
- options: optionsForPlugin
1283
- }));
1284
- /* istanbul ignore else */
1285
- if ((process.env.NODE_ENV !== "production" || typeof __VUE_PROD_DEVTOOLS__ !== "undefined" && __VUE_PROD_DEVTOOLS__) && !(process.env.NODE_ENV === "test") && IS_CLIENT) Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));
1286
- if (process.env.NODE_ENV !== "production") for (const key in extensions) {
1287
- const value = extensions[key];
1288
- if (typeof value === "object" && !isRef(value) && !isReactive(value) && !value?.__v_skip) diagnostics.PINIA_R1006({
1289
- key,
1290
- id: $id
1291
- });
1292
- }
1293
- assign(store, extensions);
1294
- });
1295
- if (process.env.NODE_ENV !== "production" && store.$state && typeof store.$state === "object" && typeof store.$state.constructor === "function" && !store.$state.constructor.toString().includes("[native code]")) diagnostics.PINIA_R1003({ id: store.$id });
1296
- if (initialState && isOptionsStore && options.hydrate) options.hydrate(store.$state, initialState);
1297
- isListening = true;
1298
- isSyncListening = true;
1299
- return store;
1300
- }
1301
- /*! #__NO_SIDE_EFFECTS__ */
1302
- function defineStore(id, setup, setupOptions) {
1303
- let options;
1304
- const isSetupStore = typeof setup === "function";
1305
- options = isSetupStore ? setupOptions : setup;
1306
- function useStore(pinia, hot) {
1307
- const hasContext = hasInjectionContext();
1308
- pinia = (process.env.NODE_ENV === "test" && activePinia && activePinia._testing ? null : pinia) || (hasContext ? inject(piniaSymbol, null) : null);
1309
- if (pinia) setActivePinia(pinia);
1310
- if (process.env.NODE_ENV !== "production" && !activePinia) throw new Error("[🍍]: \"getActivePinia()\" was called but there was no active Pinia. Are you trying to use a store before calling \"app.use(pinia)\"?\nSee https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\nThis will fail in production.");
1311
- pinia = activePinia;
1312
- if (!pinia._s.has(id)) {
1313
- if (isSetupStore) createSetupStore(id, setup, options, pinia);
1314
- else createOptionsStore(id, options, pinia);
1315
- /* istanbul ignore else */
1316
- if (process.env.NODE_ENV !== "production") useStore._pinia = pinia;
1317
- }
1318
- const store = pinia._s.get(id);
1319
- if (process.env.NODE_ENV !== "production" && hot) {
1320
- const hotId = "__hot:" + id;
1321
- const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);
1322
- hot._hotUpdate(newStore);
1323
- delete pinia.state.value[hotId];
1324
- pinia._s.delete(hotId);
1325
- }
1326
- if (process.env.NODE_ENV !== "production" && IS_CLIENT) {
1327
- const currentInstance = getCurrentInstance();
1328
- if (currentInstance && currentInstance.proxy && !hot) {
1329
- const vm = currentInstance.proxy;
1330
- const cache = "_pStores" in vm ? vm._pStores : vm._pStores = {};
1331
- cache[id] = store;
1332
- }
1333
- }
1334
- return store;
1335
- }
1336
- useStore.$id = id;
1337
- return useStore;
1338
- }
1339
- //#endregion
1340
- //#region src/mapHelpers.ts
1341
- let mapStoreSuffix = "Store";
1342
- /**
1343
- * Changes the suffix added by `mapStores()`. Can be set to an empty string.
1344
- * Defaults to `"Store"`. Make sure to extend the MapStoresCustomization
1345
- * interface if you are using TypeScript.
1346
- *
1347
- * @param suffix - new suffix
1348
- */
1349
- function setMapStoreSuffix(suffix) {
1350
- mapStoreSuffix = suffix;
1351
- }
1352
- /**
1353
- * Allows using stores without the composition API (`setup()`) by generating an
1354
- * object to be spread in the `computed` field of a component. It accepts a list
1355
- * of store definitions.
1356
- *
1357
- * @example
1358
- * ```js
1359
- * export default {
1360
- * computed: {
1361
- * // other computed properties
1362
- * ...mapStores(useUserStore, useCartStore)
1363
- * },
1364
- *
1365
- * created() {
1366
- * this.userStore // store with id "user"
1367
- * this.cartStore // store with id "cart"
1368
- * }
1369
- * }
1370
- * ```
1371
- *
1372
- * @param stores - list of stores to map to an object
1373
- */
1374
- function mapStores(...stores) {
1375
- if (process.env.NODE_ENV !== "production" && Array.isArray(stores[0])) {
1376
- diagnostics.PINIA_R1001();
1377
- stores = stores[0];
1378
- }
1379
- return stores.reduce((reduced, useStore) => {
1380
- reduced[useStore.$id + mapStoreSuffix] = function() {
1381
- return useStore(this.$pinia);
1382
- };
1383
- return reduced;
1384
- }, {});
1385
- }
1386
- /**
1387
- * Allows using state and getters from one store without using the composition
1388
- * API (`setup()`) by generating an object to be spread in the `computed` field
1389
- * of a component.
1390
- *
1391
- * @param useStore - store to map from
1392
- * @param keysOrMapper - array or object
1393
- */
1394
- function mapState(useStore, keysOrMapper) {
1395
- return Array.isArray(keysOrMapper) ? keysOrMapper.reduce((reduced, key) => {
1396
- reduced[key] = function() {
1397
- return useStore(this.$pinia)[key];
1398
- };
1399
- return reduced;
1400
- }, {}) : Object.keys(keysOrMapper).reduce((reduced, key) => {
1401
- reduced[key] = function() {
1402
- const store = useStore(this.$pinia);
1403
- const storeKey = keysOrMapper[key];
1404
- return typeof storeKey === "function" ? storeKey.call(this, store) : store[storeKey];
1405
- };
1406
- return reduced;
1407
- }, {});
1408
- }
1409
- /**
1410
- * Alias for `mapState()`. You should use `mapState()` instead.
1411
- * @deprecated use `mapState()` instead.
1412
- */
1413
- const mapGetters = mapState;
1414
- /**
1415
- * Allows directly using actions from your store without using the composition
1416
- * API (`setup()`) by generating an object to be spread in the `methods` field
1417
- * of a component.
1418
- *
1419
- * @param useStore - store to map from
1420
- * @param keysOrMapper - array or object
1421
- */
1422
- function mapActions(useStore, keysOrMapper) {
1423
- return Array.isArray(keysOrMapper) ? keysOrMapper.reduce((reduced, key) => {
1424
- reduced[key] = function(...args) {
1425
- return useStore(this.$pinia)[key](...args);
1426
- };
1427
- return reduced;
1428
- }, {}) : Object.keys(keysOrMapper).reduce((reduced, key) => {
1429
- reduced[key] = function(...args) {
1430
- return useStore(this.$pinia)[keysOrMapper[key]](...args);
1431
- };
1432
- return reduced;
1433
- }, {});
1434
- }
1435
- /**
1436
- * Allows using state and getters from one store without using the composition
1437
- * API (`setup()`) by generating an object to be spread in the `computed` field
1438
- * of a component.
1439
- *
1440
- * @param useStore - store to map from
1441
- * @param keysOrMapper - array or object
1442
- */
1443
- function mapWritableState(useStore, keysOrMapper) {
1444
- return Array.isArray(keysOrMapper) ? keysOrMapper.reduce((reduced, key) => {
1445
- reduced[key] = {
1446
- get() {
1447
- return useStore(this.$pinia)[key];
1448
- },
1449
- set(value) {
1450
- return useStore(this.$pinia)[key] = value;
1451
- }
1452
- };
1453
- return reduced;
1454
- }, {}) : Object.keys(keysOrMapper).reduce((reduced, key) => {
1455
- reduced[key] = {
1456
- get() {
1457
- return useStore(this.$pinia)[keysOrMapper[key]];
1458
- },
1459
- set(value) {
1460
- return useStore(this.$pinia)[keysOrMapper[key]] = value;
1461
- }
1462
- };
1463
- return reduced;
1464
- }, {});
1465
- }
1466
- //#endregion
1467
- //#region src/storeToRefs.ts
1468
- /**
1469
- * Creates an object of references with all the state, getters, and plugin-added
1470
- * state properties of the store. Similar to `toRefs()` but specifically
1471
- * designed for Pinia stores so methods and non reactive properties are
1472
- * completely ignored.
1473
- *
1474
- * @param store - store to extract the refs from
1475
- */
1476
- function storeToRefs(store) {
1477
- const rawStore = toRaw(store);
1478
- const refs = {};
1479
- for (const key in rawStore) {
1480
- const value = rawStore[key];
1481
- if (value?.effect) refs[key] = computed({
1482
- get: () => store[key],
1483
- set(value) {
1484
- store[key] = value;
1485
- }
1486
- });
1487
- else if (isRef(value) || isReactive(value)) refs[key] = toRef(store, key);
1488
- }
1489
- return refs;
1490
- }
1491
-
1492
- export { MutationType, acceptHMRUpdate, createPinia, defineStore, disposePinia, getActivePinia, mapActions, mapGetters, mapState, mapStores, mapWritableState, piniaSymbol, setActivePinia, setMapStoreSuffix, shouldHydrate, skipHydrate, storeToRefs };