@histoire/vendors 0.17.17 → 1.0.0-alpha.2

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 (216) hide show
  1. package/dist/client/b-floating-vue.js +2175 -2150
  2. package/dist/client/b-iconify.js +663 -850
  3. package/dist/client/b-pinia.js +130 -68
  4. package/dist/client/b-scroll.js +3 -52
  5. package/dist/client/b-vue-router.js +385 -237
  6. package/dist/client/b-vue-use.js +4578 -3115
  7. package/dist/client/b-vue.js +1 -1
  8. package/dist/client/index.js +162 -20
  9. package/dist/client/node_modules/@babel/helper-string-parser/package.json +31 -0
  10. package/dist/client/node_modules/@babel/helper-validator-identifier/package.json +31 -0
  11. package/dist/client/node_modules/@babel/parser/package.json +10 -6
  12. package/dist/client/node_modules/@babel/parser/typings/babel-parser.d.ts +167 -188
  13. package/dist/client/node_modules/@babel/types/lib/index-legacy.d.ts +2786 -0
  14. package/dist/client/node_modules/@babel/types/lib/index.d.ts +3286 -0
  15. package/dist/client/node_modules/@babel/types/package.json +39 -0
  16. package/dist/client/node_modules/@floating-ui/core/dist/floating-ui.core.d.ts +525 -0
  17. package/dist/client/node_modules/@floating-ui/core/package.json +32 -39
  18. package/dist/client/node_modules/@floating-ui/dom/package.json +23 -24
  19. package/dist/client/node_modules/@floating-ui/dom/src/autoUpdate.d.ts +31 -0
  20. package/dist/client/node_modules/@floating-ui/dom/src/index.d.ts +11 -7
  21. package/dist/client/node_modules/@floating-ui/dom/src/platform.d.ts +1 -1
  22. package/dist/client/node_modules/@floating-ui/dom/src/types.d.ts +121 -20
  23. package/dist/client/node_modules/@floating-ui/dom/src/utils/getBoundingClientRect.d.ts +1 -1
  24. package/dist/client/node_modules/@floating-ui/dom/src/utils/getClippingRect.d.ts +12 -0
  25. package/dist/client/node_modules/@floating-ui/dom/src/utils/getCssDimensions.d.ts +4 -0
  26. package/dist/client/node_modules/@floating-ui/dom/src/utils/getDimensions.d.ts +1 -1
  27. package/dist/client/node_modules/@floating-ui/dom/src/utils/getNearestOverflowAncestor.d.ts +1 -0
  28. package/dist/client/node_modules/@floating-ui/dom/src/utils/getOverflowAncestors.d.ts +3 -0
  29. package/dist/client/node_modules/@floating-ui/dom/src/utils/getScale.d.ts +7 -0
  30. package/dist/client/node_modules/@floating-ui/dom/src/utils/getViewportRect.d.ts +2 -2
  31. package/dist/client/node_modules/@floating-ui/dom/src/utils/getWindowScrollBarX.d.ts +1 -1
  32. package/dist/client/node_modules/@floating-ui/dom/src/utils/is.d.ts +3 -1
  33. package/dist/client/node_modules/@floating-ui/dom/src/utils/unwrapElement.d.ts +2 -0
  34. package/dist/client/node_modules/@floating-ui/dom/src/utils/userAgent.d.ts +1 -0
  35. package/dist/client/node_modules/@floating-ui/dom/src/utils/window.d.ts +1 -2
  36. package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.ts +103 -0
  37. package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.ts +47 -0
  38. package/dist/client/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.d.ts +47 -0
  39. package/dist/client/node_modules/@floating-ui/utils/dom/package.json +6 -0
  40. package/dist/client/node_modules/@floating-ui/utils/package.json +70 -0
  41. package/dist/client/node_modules/@iconify/types/package.json +23 -0
  42. package/dist/client/node_modules/@iconify/types/provider.d.ts +44 -0
  43. package/dist/client/node_modules/@iconify/types/types.d.ts +272 -0
  44. package/dist/client/node_modules/@iconify/vue/dist/iconify.d.ts +122 -327
  45. package/dist/client/node_modules/@iconify/vue/dist/offline.d.ts +36 -269
  46. package/dist/client/node_modules/@iconify/vue/package.json +64 -60
  47. package/dist/client/node_modules/@jridgewell/sourcemap-codec/dist/types/scopes.d.ts +49 -0
  48. package/dist/client/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts +2 -0
  49. package/dist/client/node_modules/@jridgewell/sourcemap-codec/dist/types/strings.d.ts +15 -0
  50. package/dist/client/node_modules/@jridgewell/sourcemap-codec/dist/types/vlq.d.ts +6 -0
  51. package/dist/client/node_modules/@jridgewell/sourcemap-codec/package.json +3 -2
  52. package/dist/client/node_modules/@types/web-bluetooth/index.d.ts +33 -14
  53. package/dist/client/node_modules/@types/web-bluetooth/package.json +12 -12
  54. package/dist/client/node_modules/@vue/compiler-core/dist/compiler-core.d.ts +218 -125
  55. package/dist/client/node_modules/@vue/compiler-core/package.json +20 -5
  56. package/dist/client/node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts +6 -3
  57. package/dist/client/node_modules/@vue/compiler-dom/package.json +17 -3
  58. package/dist/client/node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts +35 -25
  59. package/dist/client/node_modules/@vue/compiler-sfc/package.json +27 -18
  60. package/dist/client/node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts +2 -2
  61. package/dist/client/node_modules/@vue/compiler-ssr/package.json +3 -3
  62. package/dist/client/node_modules/@vue/devtools-api/package.json +1 -1
  63. package/dist/client/node_modules/@vue/reactivity/dist/reactivity.d.ts +268 -166
  64. package/dist/client/node_modules/@vue/reactivity/package.json +16 -2
  65. package/dist/client/node_modules/@vue/runtime-core/dist/runtime-core.d.ts +728 -529
  66. package/dist/client/node_modules/@vue/runtime-core/package.json +17 -3
  67. package/dist/client/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +195 -86
  68. package/dist/client/node_modules/@vue/runtime-dom/package.json +22 -4
  69. package/dist/client/node_modules/@vue/server-renderer/dist/server-renderer.d.ts +4 -8
  70. package/dist/client/node_modules/@vue/server-renderer/package.json +18 -4
  71. package/dist/client/node_modules/@vue/shared/dist/shared.d.ts +45 -30
  72. package/dist/client/node_modules/@vue/shared/package.json +15 -1
  73. package/dist/client/node_modules/@vueuse/core/index.d.ts +2323 -666
  74. package/dist/client/node_modules/@vueuse/core/package.json +22 -12
  75. package/dist/client/node_modules/@vueuse/metadata/index.d.ts +7 -5
  76. package/dist/client/node_modules/@vueuse/metadata/package.json +14 -7
  77. package/dist/client/node_modules/@vueuse/shared/index.d.ts +451 -280
  78. package/dist/client/node_modules/@vueuse/shared/package.json +17 -6
  79. package/dist/client/node_modules/compute-scroll-into-view/dist/index.d.ts +75 -0
  80. package/dist/client/node_modules/compute-scroll-into-view/package.json +35 -45
  81. package/dist/client/node_modules/entities/lib/decode.d.ts +211 -0
  82. package/dist/client/node_modules/entities/lib/decode_codepoint.d.ts +19 -0
  83. package/dist/client/node_modules/entities/lib/encode.d.ts +22 -0
  84. package/dist/client/node_modules/entities/lib/escape.d.ts +43 -0
  85. package/dist/client/node_modules/entities/lib/esm/decode.d.ts +211 -0
  86. package/dist/client/node_modules/entities/lib/esm/decode_codepoint.d.ts +19 -0
  87. package/dist/client/node_modules/entities/lib/esm/encode.d.ts +22 -0
  88. package/dist/client/node_modules/entities/lib/esm/escape.d.ts +43 -0
  89. package/dist/client/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +3 -0
  90. package/dist/client/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +3 -0
  91. package/dist/client/node_modules/entities/lib/esm/generated/encode-html.d.ts +8 -0
  92. package/dist/client/node_modules/entities/lib/esm/index.d.ts +96 -0
  93. package/dist/client/node_modules/entities/lib/esm/package.json +1 -0
  94. package/dist/client/node_modules/entities/lib/generated/decode-data-html.d.ts +3 -0
  95. package/dist/client/node_modules/entities/lib/generated/decode-data-xml.d.ts +3 -0
  96. package/dist/client/node_modules/entities/lib/generated/encode-html.d.ts +8 -0
  97. package/dist/client/node_modules/entities/lib/index.d.ts +96 -0
  98. package/dist/client/node_modules/entities/package.json +90 -0
  99. package/dist/client/node_modules/floating-vue/dist/components/Dropdown.d.ts +398 -0
  100. package/dist/client/node_modules/floating-vue/dist/components/Menu.d.ts +398 -0
  101. package/dist/client/node_modules/floating-vue/dist/components/Popper.d.ts +225 -105
  102. package/dist/client/node_modules/floating-vue/dist/components/Popper.vue.d.ts +471 -364
  103. package/dist/client/node_modules/floating-vue/dist/components/PopperContent.vue.d.ts +14 -25
  104. package/dist/client/node_modules/floating-vue/dist/components/PopperWrapper.vue.d.ts +392 -6
  105. package/dist/client/node_modules/floating-vue/dist/components/Tooltip.d.ts +398 -0
  106. package/dist/client/node_modules/floating-vue/dist/components/TooltipDirective.vue.d.ts +49 -10
  107. package/dist/client/node_modules/floating-vue/dist/config.d.ts +1 -1
  108. package/dist/client/node_modules/floating-vue/dist/index.d.ts +2071 -247
  109. package/dist/client/node_modules/floating-vue/dist/util/events.d.ts +2 -0
  110. package/dist/client/node_modules/floating-vue/dist/util/popper.d.ts +1 -1
  111. package/dist/client/node_modules/floating-vue/package.json +42 -33
  112. package/dist/client/node_modules/magic-string/dist/magic-string.cjs.d.ts +250 -229
  113. package/dist/client/node_modules/magic-string/package.json +24 -26
  114. package/dist/client/node_modules/nanoid/package.json +1 -1
  115. package/dist/client/node_modules/picocolors/package.json +2 -2
  116. package/dist/client/node_modules/picocolors/types.d.ts +51 -0
  117. package/dist/client/node_modules/pinia/dist/pinia.d.ts +116 -37
  118. package/dist/client/node_modules/pinia/package.json +7 -11
  119. package/dist/client/node_modules/postcss/lib/at-rule.d.ts +22 -19
  120. package/dist/client/node_modules/postcss/lib/comment.d.ts +6 -5
  121. package/dist/client/node_modules/postcss/lib/container.d.ts +72 -82
  122. package/dist/client/node_modules/postcss/lib/css-syntax-error.d.ts +1 -1
  123. package/dist/client/node_modules/postcss/lib/declaration.d.ts +16 -13
  124. package/dist/client/node_modules/postcss/lib/document.d.ts +4 -4
  125. package/dist/client/node_modules/postcss/lib/input.d.ts +28 -16
  126. package/dist/client/node_modules/postcss/lib/lazy-result.d.ts +40 -40
  127. package/dist/client/node_modules/postcss/lib/list.d.ts +5 -2
  128. package/dist/client/node_modules/postcss/lib/no-work-result.d.ts +5 -5
  129. package/dist/client/node_modules/postcss/lib/node.d.ts +19 -14
  130. package/dist/client/node_modules/postcss/lib/postcss.d.ts +25 -8
  131. package/dist/client/node_modules/postcss/lib/processor.d.ts +1 -1
  132. package/dist/client/node_modules/postcss/lib/result.d.ts +10 -11
  133. package/dist/client/node_modules/postcss/lib/root.d.ts +4 -4
  134. package/dist/client/node_modules/postcss/lib/rule.d.ts +22 -13
  135. package/dist/client/node_modules/postcss/package.json +4 -4
  136. package/dist/client/node_modules/scroll-into-view-if-needed/dist/index.d.ts +79 -0
  137. package/dist/client/node_modules/scroll-into-view-if-needed/package.json +28 -67
  138. package/dist/client/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
  139. package/dist/client/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
  140. package/dist/client/node_modules/source-map-js/lib/source-node.d.ts +1 -0
  141. package/dist/client/node_modules/source-map-js/package.json +1 -1
  142. package/dist/client/node_modules/source-map-js/source-map.d.ts +88 -99
  143. package/dist/client/node_modules/vue/dist/vue.d.ts +0 -4
  144. package/dist/client/node_modules/vue/jsx-runtime/index.d.ts +2 -1
  145. package/dist/client/node_modules/vue/jsx.d.ts +2 -1
  146. package/dist/client/node_modules/vue/package.json +13 -14
  147. package/dist/client/node_modules/{pinia/node_modules/vue-demi → vue-demi}/package.json +1 -1
  148. package/dist/client/node_modules/vue-router/dist/vue-router.d.ts +410 -81
  149. package/dist/client/node_modules/vue-router/package.json +66 -37
  150. package/dist/client/node_modules/vue-router/vue-router-auto-routes.d.ts +4 -0
  151. package/dist/client/node_modules/vue-router/vue-router-auto.d.ts +4 -0
  152. package/dist/client/vue.runtime.esm-bundler.js +6458 -4714
  153. package/package.json +17 -17
  154. package/rollup.config.mjs +6 -6
  155. package/dist/client/index2.js +0 -168
  156. package/dist/client/node_modules/@floating-ui/core/index.d.ts +0 -1
  157. package/dist/client/node_modules/@floating-ui/core/src/_babel.d.ts +0 -1
  158. package/dist/client/node_modules/@floating-ui/core/src/computeCoordsFromPlacement.d.ts +0 -4
  159. package/dist/client/node_modules/@floating-ui/core/src/computePosition.d.ts +0 -2
  160. package/dist/client/node_modules/@floating-ui/core/src/detectOverflow.d.ts +0 -9
  161. package/dist/client/node_modules/@floating-ui/core/src/enums.d.ts +0 -4
  162. package/dist/client/node_modules/@floating-ui/core/src/index.d.ts +0 -11
  163. package/dist/client/node_modules/@floating-ui/core/src/middleware/arrow.d.ts +0 -6
  164. package/dist/client/node_modules/@floating-ui/core/src/middleware/autoPlacement.d.ts +0 -9
  165. package/dist/client/node_modules/@floating-ui/core/src/middleware/flip.d.ts +0 -10
  166. package/dist/client/node_modules/@floating-ui/core/src/middleware/hide.d.ts +0 -2
  167. package/dist/client/node_modules/@floating-ui/core/src/middleware/inline.d.ts +0 -5
  168. package/dist/client/node_modules/@floating-ui/core/src/middleware/offset.d.ts +0 -21
  169. package/dist/client/node_modules/@floating-ui/core/src/middleware/shift.d.ts +0 -32
  170. package/dist/client/node_modules/@floating-ui/core/src/middleware/size.d.ts +0 -6
  171. package/dist/client/node_modules/@floating-ui/core/src/types.d.ts +0 -148
  172. package/dist/client/node_modules/@floating-ui/core/src/utils/expandPaddingObject.d.ts +0 -2
  173. package/dist/client/node_modules/@floating-ui/core/src/utils/getAlignment.d.ts +0 -2
  174. package/dist/client/node_modules/@floating-ui/core/src/utils/getAlignmentSides.d.ts +0 -5
  175. package/dist/client/node_modules/@floating-ui/core/src/utils/getBasePlacement.d.ts +0 -2
  176. package/dist/client/node_modules/@floating-ui/core/src/utils/getCrossAxis.d.ts +0 -2
  177. package/dist/client/node_modules/@floating-ui/core/src/utils/getExpandedPlacements.d.ts +0 -2
  178. package/dist/client/node_modules/@floating-ui/core/src/utils/getLengthFromAxis.d.ts +0 -2
  179. package/dist/client/node_modules/@floating-ui/core/src/utils/getMainAxisFromPlacement.d.ts +0 -2
  180. package/dist/client/node_modules/@floating-ui/core/src/utils/getOppositeAlignmentPlacement.d.ts +0 -2
  181. package/dist/client/node_modules/@floating-ui/core/src/utils/getOppositePlacement.d.ts +0 -1
  182. package/dist/client/node_modules/@floating-ui/core/src/utils/getPaddingObject.d.ts +0 -2
  183. package/dist/client/node_modules/@floating-ui/core/src/utils/math.d.ts +0 -2
  184. package/dist/client/node_modules/@floating-ui/core/src/utils/rectToClientRect.d.ts +0 -2
  185. package/dist/client/node_modules/@floating-ui/core/src/utils/within.d.ts +0 -1
  186. package/dist/client/node_modules/@floating-ui/dom/src/utils/contains.d.ts +0 -1
  187. package/dist/client/node_modules/@floating-ui/dom/src/utils/getClippingClientRect.d.ts +0 -6
  188. package/dist/client/node_modules/@floating-ui/dom/src/utils/getScrollParent.d.ts +0 -1
  189. package/dist/client/node_modules/@floating-ui/dom/src/utils/getScrollParents.d.ts +0 -1
  190. package/dist/client/node_modules/@vue/reactivity-transform/dist/reactivity-transform.d.ts +0 -43
  191. package/dist/client/node_modules/@vue/reactivity-transform/package.json +0 -41
  192. package/dist/client/node_modules/@vueuse/core/node_modules/vue-demi/package.json +0 -47
  193. package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/index.d.ts +0 -22
  194. package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/v2/index.d.ts +0 -33
  195. package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/v2.7/index.d.ts +0 -38
  196. package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/lib/v3/index.d.ts +0 -22
  197. package/dist/client/node_modules/@vueuse/shared/node_modules/vue-demi/package.json +0 -47
  198. package/dist/client/node_modules/compute-scroll-into-view/typings/index.d.ts +0 -19
  199. package/dist/client/node_modules/floating-vue/dist/components/Dropdown.vue.d.ts +0 -25
  200. package/dist/client/node_modules/floating-vue/dist/components/Menu.vue.d.ts +0 -25
  201. package/dist/client/node_modules/floating-vue/dist/components/Tooltip.vue.d.ts +0 -25
  202. package/dist/client/node_modules/floating-vue/src/global-shim.d.ts +0 -1
  203. package/dist/client/node_modules/floating-vue/src/vue-shim.d.ts +0 -5
  204. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/index.d.ts +0 -22
  205. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v2/index.d.ts +0 -33
  206. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v2.7/index.d.ts +0 -38
  207. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v3/index.d.ts +0 -22
  208. package/dist/client/node_modules/scroll-into-view-if-needed/typings/index.d.ts +0 -13
  209. package/dist/client/node_modules/scroll-into-view-if-needed/typings/types.d.ts +0 -19
  210. package/dist/client/node_modules/vue/macros-global.d.ts +0 -19
  211. package/dist/client/node_modules/vue/macros.d.ts +0 -112
  212. package/dist/client/node_modules/vue/ref-macros.d.ts +0 -2
  213. /package/dist/client/node_modules/{@vueuse/core/node_modules/vue-demi → vue-demi}/lib/index.d.ts +0 -0
  214. /package/dist/client/node_modules/{@vueuse/core/node_modules/vue-demi → vue-demi}/lib/v2/index.d.ts +0 -0
  215. /package/dist/client/node_modules/{@vueuse/core/node_modules/vue-demi → vue-demi}/lib/v2.7/index.d.ts +0 -0
  216. /package/dist/client/node_modules/{@vueuse/core/node_modules/vue-demi → vue-demi}/lib/v3/index.d.ts +0 -0
@@ -1,10 +1,33 @@
1
- import { i as isVue2, s as set, d as del } from './index.js';
2
- import { s as setupDevtoolsPlugin } from './index2.js';
3
- import { y as hasInjectionContext, z as inject, A as toRaw, B as unref, C as watch, D as markRaw, E as effectScope, u as ref, G as isRef, H as isReactive, I as getCurrentScope, J as onScopeDispose, K as toRefs, L as computed, b as nextTick, M as reactive, N as toRef, O as getCurrentInstance } from './vue.runtime.esm-bundler.js';
1
+ import { y as hasInjectionContext, z as inject, A as toRaw, B as watch, C as unref, D as markRaw, E as effectScope, u as ref, G as isRef, H as isReactive, I as getCurrentScope, J as onScopeDispose, K as toRefs, L as computed, M as reactive, b as nextTick, N as toRef, O as getCurrentInstance } from './vue.runtime.esm-bundler.js';
2
+ import { s as setupDevtoolsPlugin } from './index.js';
3
+
4
+ var isVue2 = false;
5
+ var isVue3 = true;
6
+ var Vue2 = undefined;
7
+
8
+ function install() {}
9
+
10
+ function set(target, key, val) {
11
+ if (Array.isArray(target)) {
12
+ target.length = Math.max(target.length, key);
13
+ target.splice(key, 1, val);
14
+ return val
15
+ }
16
+ target[key] = val;
17
+ return val
18
+ }
19
+
20
+ function del(target, key) {
21
+ if (Array.isArray(target)) {
22
+ target.splice(key, 1);
23
+ return
24
+ }
25
+ delete target[key];
26
+ }
4
27
 
5
28
  /*!
6
- * pinia v2.1.7
7
- * (c) 2023 Eduardo San Martin Morote
29
+ * pinia v2.3.1
30
+ * (c) 2025 Eduardo San Martin Morote
8
31
  * @license MIT
9
32
  */
10
33
 
@@ -66,13 +89,6 @@ var MutationType;
66
89
  })(MutationType || (MutationType = {}));
67
90
 
68
91
  const IS_CLIENT = typeof window !== 'undefined';
69
- /**
70
- * Should we add the devtools plugins.
71
- * - only if dev mode or forced through the prod devtools flag
72
- * - not in test
73
- * - only if window exists (could change in the future)
74
- */
75
- const USE_DEVTOOLS = ((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test') && IS_CLIENT;
76
92
 
77
93
  /*
78
94
  * FileSaver.js A saveAs() FileSaver implementation.
@@ -135,8 +151,7 @@ function click(node) {
135
151
  node.dispatchEvent(evt);
136
152
  }
137
153
  }
138
- const _navigator =
139
- typeof navigator === 'object' ? navigator : { userAgent: '' };
154
+ const _navigator = typeof navigator === 'object' ? navigator : { userAgent: '' };
140
155
  // Detect WebView inside a native macOS app by ruling out all browsers
141
156
  // We just need to check for 'Safari' because all other browsers (besides Firefox) include that too
142
157
  // https://www.whatismybrowser.com/guides/the-latest-user-agent/macos
@@ -662,6 +677,8 @@ function registerPiniaDevtools(app, pinia) {
662
677
  : stores).map(formatStoreForInspectorTree);
663
678
  }
664
679
  });
680
+ // Expose pinia instance as $pinia to window
681
+ globalThis.$pinia = pinia;
665
682
  api.on.getInspectorState((payload) => {
666
683
  if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
667
684
  const inspectedStore = payload.nodeId === PINIA_ROOT_ID
@@ -673,6 +690,9 @@ function registerPiniaDevtools(app, pinia) {
673
690
  return;
674
691
  }
675
692
  if (inspectedStore) {
693
+ // Expose selected store as $store to window
694
+ if (payload.nodeId !== PINIA_ROOT_ID)
695
+ globalThis.$store = toRaw(inspectedStore);
676
696
  payload.state = formatStoreForInspectorState(inspectedStore);
677
697
  }
678
698
  }
@@ -951,13 +971,16 @@ function devtoolsPlugin({ app, store, options }) {
951
971
  }
952
972
  // detect option api vs setup api
953
973
  store._isOptionsAPI = !!options.state;
954
- patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);
955
- // Upgrade the HMR to also update the new actions
956
- const originalHotUpdate = store._hotUpdate;
957
- toRaw(store)._hotUpdate = function (newStore) {
958
- originalHotUpdate.apply(this, arguments);
959
- patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);
960
- };
974
+ // Do not overwrite actions mocked by @pinia/testing (#2298)
975
+ if (!store._p._testing) {
976
+ patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);
977
+ // Upgrade the HMR to also update the new actions
978
+ const originalHotUpdate = store._hotUpdate;
979
+ toRaw(store)._hotUpdate = function (newStore) {
980
+ originalHotUpdate.apply(this, arguments);
981
+ patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);
982
+ };
983
+ }
961
984
  addStoreToDevtools(app,
962
985
  // FIXME: is there a way to allow the assignment from Store<Id, S, G, A> to StoreGeneric?
963
986
  store);
@@ -984,7 +1007,7 @@ function createPinia() {
984
1007
  app.provide(piniaSymbol, pinia);
985
1008
  app.config.globalProperties.$pinia = pinia;
986
1009
  /* istanbul ignore else */
987
- if (USE_DEVTOOLS) {
1010
+ if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {
988
1011
  registerPiniaDevtools(app, pinia);
989
1012
  }
990
1013
  toBeInstalled.forEach((plugin) => _p.push(plugin));
@@ -1010,11 +1033,26 @@ function createPinia() {
1010
1033
  });
1011
1034
  // pinia devtools rely on dev only features so they cannot be forced unless
1012
1035
  // the dev build of Vue is used. Avoid old browsers like IE11.
1013
- if (USE_DEVTOOLS && typeof Proxy !== 'undefined') {
1036
+ if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT && typeof Proxy !== 'undefined') {
1014
1037
  pinia.use(devtoolsPlugin);
1015
1038
  }
1016
1039
  return pinia;
1017
1040
  }
1041
+ /**
1042
+ * Dispose a Pinia instance by stopping its effectScope and removing the state, plugins and stores. This is mostly
1043
+ * useful in tests, with both a testing pinia or a regular pinia and in applications that use multiple pinia instances.
1044
+ * Once disposed, the pinia instance cannot be used anymore.
1045
+ *
1046
+ * @param pinia - pinia instance
1047
+ */
1048
+ function disposePinia(pinia) {
1049
+ pinia._e.stop();
1050
+ pinia._s.clear();
1051
+ pinia._p.splice(0);
1052
+ pinia.state.value = {};
1053
+ // @ts-expect-error: non valid
1054
+ pinia._a = null;
1055
+ }
1018
1056
 
1019
1057
  /**
1020
1058
  * Checks if a function is a `StoreDefinition`.
@@ -1134,13 +1172,23 @@ function triggerSubscriptions(subscriptions, ...args) {
1134
1172
  }
1135
1173
 
1136
1174
  const fallbackRunWithContext = (fn) => fn();
1175
+ /**
1176
+ * Marks a function as an action for `$onAction`
1177
+ * @internal
1178
+ */
1179
+ const ACTION_MARKER = Symbol();
1180
+ /**
1181
+ * Action name symbol. Allows to add a name to an action after defining it
1182
+ * @internal
1183
+ */
1184
+ const ACTION_NAME = Symbol();
1137
1185
  function mergeReactiveObjects(target, patchToApply) {
1138
1186
  // Handle Map instances
1139
1187
  if (target instanceof Map && patchToApply instanceof Map) {
1140
1188
  patchToApply.forEach((value, key) => target.set(key, value));
1141
1189
  }
1142
- // Handle Set instances
1143
- if (target instanceof Set && patchToApply instanceof Set) {
1190
+ else if (target instanceof Set && patchToApply instanceof Set) {
1191
+ // Handle Set instances
1144
1192
  patchToApply.forEach(target.add, target);
1145
1193
  }
1146
1194
  // no need to go through symbols because they cannot be serialized anyway
@@ -1169,7 +1217,6 @@ function mergeReactiveObjects(target, patchToApply) {
1169
1217
  const skipHydrateSymbol = (process.env.NODE_ENV !== 'production')
1170
1218
  ? Symbol('pinia:skipHydration')
1171
1219
  : /* istanbul ignore next */ Symbol();
1172
- const skipHydrateMap = /*#__PURE__*/ new WeakMap();
1173
1220
  /**
1174
1221
  * Tells Pinia to skip the hydration process of a given object. This is useful in setup stores (only) when you return a
1175
1222
  * stateful object in the store but it isn't really state. e.g. returning a router instance in a setup store.
@@ -1178,10 +1225,7 @@ const skipHydrateMap = /*#__PURE__*/ new WeakMap();
1178
1225
  * @returns obj
1179
1226
  */
1180
1227
  function skipHydrate(obj) {
1181
- return isVue2
1182
- ? // in @vue/composition-api, the refs are sealed so defineProperty doesn't work...
1183
- /* istanbul ignore next */ skipHydrateMap.set(obj, 1) && obj
1184
- : Object.defineProperty(obj, skipHydrateSymbol, {});
1228
+ return Object.defineProperty(obj, skipHydrateSymbol, {});
1185
1229
  }
1186
1230
  /**
1187
1231
  * Returns whether a value should be hydrated
@@ -1190,9 +1234,7 @@ function skipHydrate(obj) {
1190
1234
  * @returns true if `obj` should be hydrated
1191
1235
  */
1192
1236
  function shouldHydrate(obj) {
1193
- return isVue2
1194
- ? /* istanbul ignore next */ !skipHydrateMap.has(obj)
1195
- : !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
1237
+ return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
1196
1238
  }
1197
1239
  const { assign } = Object;
1198
1240
  function isComputed(o) {
@@ -1226,7 +1268,7 @@ function createOptionsStore(id, options, pinia, hot) {
1226
1268
  // it was created just before
1227
1269
  const store = pinia._s.get(id);
1228
1270
  // allow cross using stores
1229
- /* istanbul ignore next */
1271
+ /* istanbul ignore if */
1230
1272
  if (isVue2 && !store._r)
1231
1273
  return;
1232
1274
  // @ts-expect-error
@@ -1248,10 +1290,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1248
1290
  throw new Error('Pinia destroyed');
1249
1291
  }
1250
1292
  // watcher options for $subscribe
1251
- const $subscribeOptions = {
1252
- deep: true,
1253
- // flush: 'post',
1254
- };
1293
+ const $subscribeOptions = { deep: true };
1255
1294
  /* istanbul ignore else */
1256
1295
  if ((process.env.NODE_ENV !== 'production') && !isVue2) {
1257
1296
  $subscribeOptions.onTrigger = (event) => {
@@ -1335,6 +1374,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1335
1374
  const newState = state ? state() : {};
1336
1375
  // we use a patch to group all changes into one single subscription
1337
1376
  this.$patch(($state) => {
1377
+ // @ts-expect-error: FIXME: shouldn't error?
1338
1378
  assign($state, newState);
1339
1379
  });
1340
1380
  }
@@ -1351,14 +1391,16 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1351
1391
  pinia._s.delete($id);
1352
1392
  }
1353
1393
  /**
1354
- * Wraps an action to handle subscriptions.
1355
- *
1394
+ * Helper that wraps function so it can be tracked with $onAction
1395
+ * @param fn - action to wrap
1356
1396
  * @param name - name of the action
1357
- * @param action - action to wrap
1358
- * @returns a wrapped action to handle subscriptions
1359
1397
  */
1360
- function wrapAction(name, action) {
1361
- return function () {
1398
+ const action = (fn, name = '') => {
1399
+ if (ACTION_MARKER in fn) {
1400
+ fn[ACTION_NAME] = name;
1401
+ return fn;
1402
+ }
1403
+ const wrappedAction = function () {
1362
1404
  setActivePinia(pinia);
1363
1405
  const args = Array.from(arguments);
1364
1406
  const afterCallbackList = [];
@@ -1372,14 +1414,14 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1372
1414
  // @ts-expect-error
1373
1415
  triggerSubscriptions(actionSubscriptions, {
1374
1416
  args,
1375
- name,
1417
+ name: wrappedAction[ACTION_NAME],
1376
1418
  store,
1377
1419
  after,
1378
1420
  onError,
1379
1421
  });
1380
1422
  let ret;
1381
1423
  try {
1382
- ret = action.apply(this && this.$id === $id ? this : store, args);
1424
+ ret = fn.apply(this && this.$id === $id ? this : store, args);
1383
1425
  // handle sync errors
1384
1426
  }
1385
1427
  catch (error) {
@@ -1401,7 +1443,12 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1401
1443
  triggerSubscriptions(afterCallbackList, ret);
1402
1444
  return ret;
1403
1445
  };
1404
- }
1446
+ wrappedAction[ACTION_MARKER] = true;
1447
+ wrappedAction[ACTION_NAME] = name; // will be set later
1448
+ // @ts-expect-error: we are intentionally limiting the returned type to just Fn
1449
+ // because all the added properties are internals that are exposed through `$onAction()` only
1450
+ return wrappedAction;
1451
+ };
1405
1452
  const _hmrPayload = /*#__PURE__*/ markRaw({
1406
1453
  actions: {},
1407
1454
  getters: {},
@@ -1435,7 +1482,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1435
1482
  // start as non ready
1436
1483
  partialStore._r = false;
1437
1484
  }
1438
- const store = reactive((process.env.NODE_ENV !== 'production') || USE_DEVTOOLS
1485
+ 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)
1439
1486
  ? assign({
1440
1487
  _hmrPayload,
1441
1488
  _customProperties: markRaw(new Set()), // devtools custom properties
@@ -1449,7 +1496,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1449
1496
  pinia._s.set($id, store);
1450
1497
  const runWithContext = (pinia._a && pinia._a.runWithContext) || fallbackRunWithContext;
1451
1498
  // TODO: idea create skipSerialize that marks properties as non serializable and they are skipped
1452
- const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(setup)));
1499
+ const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(() => setup({ action }))));
1453
1500
  // overwrite existing actions to support $onAction
1454
1501
  for (const key in setupStore) {
1455
1502
  const prop = setupStore[key];
@@ -1488,8 +1535,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1488
1535
  // action
1489
1536
  }
1490
1537
  else if (typeof prop === 'function') {
1491
- // @ts-expect-error: we are overriding the function we avoid wrapping if
1492
- const actionValue = (process.env.NODE_ENV !== 'production') && hot ? prop : wrapAction(key, prop);
1538
+ const actionValue = (process.env.NODE_ENV !== 'production') && hot ? prop : action(prop, key);
1493
1539
  // this a hot module replacement store because the hotUpdate method needs
1494
1540
  // to do it with the right context
1495
1541
  /* istanbul ignore if */
@@ -1548,6 +1594,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1548
1594
  throw new Error('cannot set hotState');
1549
1595
  }
1550
1596
  $patch(($state) => {
1597
+ // @ts-expect-error: FIXME: shouldn't error?
1551
1598
  assign($state, state);
1552
1599
  });
1553
1600
  },
@@ -1590,8 +1637,8 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1590
1637
  isListening = true;
1591
1638
  });
1592
1639
  for (const actionName in newStore._hmrPayload.actions) {
1593
- const action = newStore[actionName];
1594
- set(store, actionName, wrapAction(actionName, action));
1640
+ const actionFn = newStore[actionName];
1641
+ set(store, actionName, action(actionFn, actionName));
1595
1642
  }
1596
1643
  // TODO: does this work in both setup and option store?
1597
1644
  for (const getterName in newStore._hmrPayload.getters) {
@@ -1623,7 +1670,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1623
1670
  store._hotUpdating = false;
1624
1671
  });
1625
1672
  }
1626
- if (USE_DEVTOOLS) {
1673
+ if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {
1627
1674
  const nonEnumerable = {
1628
1675
  writable: true,
1629
1676
  configurable: true,
@@ -1642,9 +1689,9 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1642
1689
  // apply all plugins
1643
1690
  pinia._p.forEach((extender) => {
1644
1691
  /* istanbul ignore else */
1645
- if (USE_DEVTOOLS) {
1692
+ if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {
1646
1693
  const extensions = scope.run(() => extender({
1647
- store,
1694
+ store: store,
1648
1695
  app: pinia._a,
1649
1696
  pinia,
1650
1697
  options: optionsForPlugin,
@@ -1654,7 +1701,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1654
1701
  }
1655
1702
  else {
1656
1703
  assign(store, scope.run(() => extender({
1657
- store,
1704
+ store: store,
1658
1705
  app: pinia._a,
1659
1706
  pinia,
1660
1707
  options: optionsForPlugin,
@@ -1680,6 +1727,8 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
1680
1727
  isSyncListening = true;
1681
1728
  return store;
1682
1729
  }
1730
+ // allows unused stores to be tree shaken
1731
+ /*! #__NO_SIDE_EFFECTS__ */
1683
1732
  function defineStore(
1684
1733
  // TODO: add proper types from above
1685
1734
  idOrOptions, setup, setupOptions) {
@@ -1821,6 +1870,7 @@ function mapState(useStore, keysOrMapper) {
1821
1870
  return Array.isArray(keysOrMapper)
1822
1871
  ? keysOrMapper.reduce((reduced, key) => {
1823
1872
  reduced[key] = function () {
1873
+ // @ts-expect-error: FIXME: should work?
1824
1874
  return useStore(this.$pinia)[key];
1825
1875
  };
1826
1876
  return reduced;
@@ -1834,7 +1884,8 @@ function mapState(useStore, keysOrMapper) {
1834
1884
  // function
1835
1885
  return typeof storeKey === 'function'
1836
1886
  ? storeKey.call(this, store)
1837
- : store[storeKey];
1887
+ : // @ts-expect-error: FIXME: should work?
1888
+ store[storeKey];
1838
1889
  };
1839
1890
  return reduced;
1840
1891
  }, {});
@@ -1857,6 +1908,7 @@ function mapActions(useStore, keysOrMapper) {
1857
1908
  ? keysOrMapper.reduce((reduced, key) => {
1858
1909
  // @ts-expect-error
1859
1910
  reduced[key] = function (...args) {
1911
+ // @ts-expect-error: FIXME: should work?
1860
1912
  return useStore(this.$pinia)[key](...args);
1861
1913
  };
1862
1914
  return reduced;
@@ -1864,6 +1916,7 @@ function mapActions(useStore, keysOrMapper) {
1864
1916
  : Object.keys(keysOrMapper).reduce((reduced, key) => {
1865
1917
  // @ts-expect-error
1866
1918
  reduced[key] = function (...args) {
1919
+ // @ts-expect-error: FIXME: should work?
1867
1920
  return useStore(this.$pinia)[keysOrMapper[key]](...args);
1868
1921
  };
1869
1922
  return reduced;
@@ -1880,26 +1933,22 @@ function mapActions(useStore, keysOrMapper) {
1880
1933
  function mapWritableState(useStore, keysOrMapper) {
1881
1934
  return Array.isArray(keysOrMapper)
1882
1935
  ? keysOrMapper.reduce((reduced, key) => {
1883
- // @ts-ignore
1884
1936
  reduced[key] = {
1885
1937
  get() {
1886
1938
  return useStore(this.$pinia)[key];
1887
1939
  },
1888
1940
  set(value) {
1889
- // it's easier to type it here as any
1890
1941
  return (useStore(this.$pinia)[key] = value);
1891
1942
  },
1892
1943
  };
1893
1944
  return reduced;
1894
1945
  }, {})
1895
1946
  : Object.keys(keysOrMapper).reduce((reduced, key) => {
1896
- // @ts-ignore
1897
1947
  reduced[key] = {
1898
1948
  get() {
1899
1949
  return useStore(this.$pinia)[keysOrMapper[key]];
1900
1950
  },
1901
1951
  set(value) {
1902
- // it's easier to type it here as any
1903
1952
  return (useStore(this.$pinia)[keysOrMapper[key]] = value);
1904
1953
  },
1905
1954
  };
@@ -1923,11 +1972,24 @@ function storeToRefs(store) {
1923
1972
  return toRefs(store);
1924
1973
  }
1925
1974
  else {
1926
- store = toRaw(store);
1975
+ const rawStore = toRaw(store);
1927
1976
  const refs = {};
1928
- for (const key in store) {
1929
- const value = store[key];
1930
- if (isRef(value) || isReactive(value)) {
1977
+ for (const key in rawStore) {
1978
+ const value = rawStore[key];
1979
+ // There is no native method to check for a computed
1980
+ // https://github.com/vuejs/core/pull/4165
1981
+ if (value.effect) {
1982
+ // @ts-expect-error: too hard to type correctly
1983
+ refs[key] =
1984
+ // ...
1985
+ computed({
1986
+ get: () => store[key],
1987
+ set(value) {
1988
+ store[key] = value;
1989
+ },
1990
+ });
1991
+ }
1992
+ else if (isRef(value) || isReactive(value)) {
1931
1993
  // @ts-expect-error: the key is state or getter
1932
1994
  refs[key] =
1933
1995
  // ---
@@ -1990,7 +2052,7 @@ const PiniaVuePlugin = function (_Vue) {
1990
2052
  // installing pinia's plugin
1991
2053
  setActivePinia(pinia);
1992
2054
  }
1993
- if (USE_DEVTOOLS) {
2055
+ if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {
1994
2056
  registerPiniaDevtools(pinia._a, pinia);
1995
2057
  }
1996
2058
  }
@@ -2004,4 +2066,4 @@ const PiniaVuePlugin = function (_Vue) {
2004
2066
  });
2005
2067
  };
2006
2068
 
2007
- export { MutationType, PiniaVuePlugin, acceptHMRUpdate, createPinia, defineStore, getActivePinia, mapActions, mapGetters, mapState, mapStores, mapWritableState, setActivePinia, setMapStoreSuffix, skipHydrate, storeToRefs };
2069
+ export { MutationType, PiniaVuePlugin, acceptHMRUpdate, createPinia, defineStore, disposePinia, getActivePinia, mapActions, mapGetters, mapState, mapStores, mapWritableState, setActivePinia, setMapStoreSuffix, shouldHydrate, skipHydrate, storeToRefs };
@@ -1,56 +1,7 @@
1
- function t(t){return "object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return (!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return !1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}var i=function(e,i){var o=window,l=i.scrollMode,d=i.block,f=i.inline,h=i.boundary,u=i.skipOverflowHiddenElements,s="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var a,c,g=document.scrollingElement||document.documentElement,p=[],m=e;t(m)&&s(m);){if((m=null==(c=(a=m).parentElement)?a.getRootNode().host||null:c)===g){p.push(m);break}null!=m&&m===document.body&&n(m)&&!n(document.documentElement)||null!=m&&n(m,u)&&p.push(m);}for(var w=o.visualViewport?o.visualViewport.width:innerWidth,v=o.visualViewport?o.visualViewport.height:innerHeight,W=window.scrollX||pageXOffset,H=window.scrollY||pageYOffset,b=e.getBoundingClientRect(),y=b.height,E=b.width,M=b.top,V=b.right,x=b.bottom,I=b.left,C="start"===d||"nearest"===d?M:"end"===d?x:M+y/2,R="center"===f?I+E/2:"end"===f?V:I,T=[],k=0;k<p.length;k++){var B=p[k],D=B.getBoundingClientRect(),O=D.height,X=D.width,Y=D.top,L=D.right,S=D.bottom,j=D.left;if("if-needed"===l&&M>=0&&I>=0&&x<=v&&V<=w&&M>=Y&&x<=S&&I>=j&&V<=L)return T;var N=getComputedStyle(B),q=parseInt(N.borderLeftWidth,10),z=parseInt(N.borderTopWidth,10),A=parseInt(N.borderRightWidth,10),F=parseInt(N.borderBottomWidth,10),G=0,J=0,K="offsetWidth"in B?B.offsetWidth-B.clientWidth-q-A:0,P="offsetHeight"in B?B.offsetHeight-B.clientHeight-z-F:0,Q="offsetWidth"in B?0===B.offsetWidth?0:X/B.offsetWidth:0,U="offsetHeight"in B?0===B.offsetHeight?0:O/B.offsetHeight:0;if(g===B)G="start"===d?C:"end"===d?C-v:"nearest"===d?r(H,H+v,v,z,F,H+C,H+C+y,y):C-v/2,J="start"===f?R:"center"===f?R-w/2:"end"===f?R-w:r(W,W+w,w,q,A,W+R,W+R+E,E),G=Math.max(0,G+H),J=Math.max(0,J+W);else {G="start"===d?C-Y-z:"end"===d?C-S+F+P:"nearest"===d?r(Y,S,O,z,F+P,C,C+y,y):C-(Y+O/2)+P/2,J="start"===f?R-j-q:"center"===f?R-(j+X/2)+K/2:"end"===f?R-L+A+K:r(j,L,X,q,A+K,R,R+E,E);var Z=B.scrollLeft,$=B.scrollTop;C+=$-(G=Math.max(0,Math.min($+G/U,B.scrollHeight-O/U+P))),R+=Z-(J=Math.max(0,Math.min(Z+J/Q,B.scrollWidth-X/Q+K)));}T.push({el:B,top:G,left:J});}return T};
1
+ const t=t=>"object"==typeof t&&null!=t&&1===t.nodeType,e$1=(t,e)=>(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e$1(o.overflowY,n)||e$1(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return !1},o$1=(t,e,n,o,l,r,i,s)=>r<t&&i>e||r>t&&i<e?0:r<=t&&s<=n||i>=e&&s>=n?r-t-o:i>e&&s<n||r<t&&s>n?i-e+l:0,l=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},r=(e,r)=>{var i,s,d,h;if("undefined"==typeof document)return [];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=r,p="function"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&p(W);){if(W=l(W),W===m){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W);}const b=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,H=null!=(h=null==(d=window.visualViewport)?void 0:d.height)?h:innerHeight,{scrollX:y,scrollY:M}=window,{height:v,width:E,top:x,right:C,bottom:I,left:R}=e.getBoundingClientRect(),{top:T,right:B,bottom:F,left:V}=(t=>{const e=window.getComputedStyle(t);return {top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(e);let k="start"===f||"nearest"===f?x-T:"end"===f?I+F:x+v/2-T+F,D="center"===u?R+E/2-V+B:"end"===u?C+B:R-V;const L=[];for(let t=0;t<w.length;t++){const e=w[t],{height:l,width:r,top:i,right:s,bottom:d,left:h}=e.getBoundingClientRect();if("if-needed"===c&&x>=0&&R>=0&&I<=H&&C<=b&&(e===m&&!n(e)||x>=i&&I<=d&&R>=h&&C<=s))return L;const a=getComputedStyle(e),g=parseInt(a.borderLeftWidth,10),p=parseInt(a.borderTopWidth,10),W=parseInt(a.borderRightWidth,10),T=parseInt(a.borderBottomWidth,10);let B=0,F=0;const V="offsetWidth"in e?e.offsetWidth-e.clientWidth-g-W:0,S="offsetHeight"in e?e.offsetHeight-e.clientHeight-p-T:0,X="offsetWidth"in e?0===e.offsetWidth?0:r/e.offsetWidth:0,Y="offsetHeight"in e?0===e.offsetHeight?0:l/e.offsetHeight:0;if(m===e)B="start"===f?k:"end"===f?k-H:"nearest"===f?o$1(M,M+H,H,p,T,M+k,M+k+v,v):k-H/2,F="start"===u?D:"center"===u?D-b/2:"end"===u?D-b:o$1(y,y+b,b,g,W,y+D,y+D+E,E),B=Math.max(0,B+M),F=Math.max(0,F+y);else {B="start"===f?k-i-p:"end"===f?k-d+T+S:"nearest"===f?o$1(i,d,l,p,T+S,k,k+v,v):k-(i+l/2)+S/2,F="start"===u?D-h-g:"center"===u?D-(h+r/2)+V/2:"end"===u?D-s+W+V:o$1(h,s,r,g,W+V,D,D+E,E);const{scrollLeft:t,scrollTop:n}=e;B=0===Y?0:Math.max(0,Math.min(n+B/Y,e.scrollHeight-l/Y+S)),F=0===X?0:Math.max(0,Math.min(t+F/X,e.scrollWidth-r/X+V)),k+=n-B,D+=t-F;}L.push({el:e,top:B,left:F});}return L};
2
2
 
3
- function isOptionsObject(options) {
4
- return options === Object(options) && Object.keys(options).length !== 0;
5
- }
6
- function defaultBehavior(actions, behavior) {
7
- if (behavior === void 0) {
8
- behavior = 'auto';
9
- }
10
- var canSmoothScroll = ('scrollBehavior' in document.body.style);
11
- actions.forEach(function (_ref) {
12
- var el = _ref.el,
13
- top = _ref.top,
14
- left = _ref.left;
15
- if (el.scroll && canSmoothScroll) {
16
- el.scroll({
17
- top: top,
18
- left: left,
19
- behavior: behavior
20
- });
21
- } else {
22
- el.scrollTop = top;
23
- el.scrollLeft = left;
24
- }
25
- });
26
- }
27
- function getOptions(options) {
28
- if (options === false) {
29
- return {
30
- block: 'end',
31
- inline: 'nearest'
32
- };
33
- }
34
- if (isOptionsObject(options)) {
35
- return options;
36
- }
37
- return {
38
- block: 'start',
39
- inline: 'nearest'
40
- };
41
- }
42
- function scrollIntoView(target, options) {
43
- var isTargetAttached = target.isConnected || target.ownerDocument.documentElement.contains(target);
44
- if (isOptionsObject(options) && typeof options.behavior === 'function') {
45
- return options.behavior(isTargetAttached ? i(target, options) : []);
46
- }
47
- if (!isTargetAttached) {
48
- return;
49
- }
50
- var computeOptions = getOptions(options);
51
- return defaultBehavior(i(target, computeOptions), computeOptions.behavior);
52
- }
3
+ const o=t=>!1===t?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&0!==Object.keys(t).length)(t)?t:{block:"start",inline:"nearest"};function e(e,r$1){if(!e.isConnected||!(t=>{let o=t;for(;o&&o.parentNode;){if(o.parentNode===document)return !0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode;}return !1})(e))return;const n=(t=>{const o=window.getComputedStyle(t);return {top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(e);if((t=>"object"==typeof t&&"function"==typeof t.behavior)(r$1))return r$1.behavior(r(e,r$1));const l="boolean"==typeof r$1||null==r$1?void 0:r$1.behavior;for(const{el:a,top:i,left:s}of r(e,o(r$1))){const t=i-n.top+n.bottom,o=s-n.left+n.right;a.scroll({top:t,left:o,behavior:l});}}
53
4
 
54
5
  // eslint-disable-next-line import/no-named-default
55
6
 
56
- export { scrollIntoView as default };
7
+ export { e as default };