@wippy-fe/webcomponent-vue 0.0.12 → 0.0.14

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 (2) hide show
  1. package/package.json +3 -3
  2. package/src/vue-element.ts +10 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wippy-fe/webcomponent-vue",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Vue 3 integration layer for Wippy web components — extends @wippy-fe/webcomponent-core with reactive props, Pinia, and provider injection.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -10,10 +10,10 @@
10
10
  "package.json"
11
11
  ],
12
12
  "dependencies": {
13
- "@wippy-fe/webcomponent-core": "^0.0.12"
13
+ "@wippy-fe/webcomponent-core": "^0.0.14"
14
14
  },
15
15
  "peerDependencies": {
16
- "@wippy-fe/proxy": "^0.0.12",
16
+ "@wippy-fe/proxy": "^0.0.14",
17
17
  "@iconify/vue": "^5.0.0",
18
18
  "pinia": "^2.1.0",
19
19
  "vue": "^3.5.0"
@@ -1,4 +1,5 @@
1
1
  import type { App, Component, Ref } from 'vue'
2
+ import type { PiniaPlugin } from 'pinia'
2
3
  import { WippyElement } from '@wippy-fe/webcomponent-core'
3
4
  import { createPinia } from 'pinia'
4
5
  import { createApp, ref } from 'vue'
@@ -12,6 +13,8 @@ export interface WippyVueElementConfig {
12
13
  rootComponent: Component
13
14
  /** Additional Vue plugins to install (beyond Pinia which is always installed). */
14
15
  plugins?: Array<{ install: (app: App) => void }>
16
+ /** Pinia plugins to install (e.g., createWippyPersist()). */
17
+ piniaPlugins?: PiniaPlugin[]
15
18
  /** Extra providers to inject into the Vue app. */
16
19
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
20
  providers?: (app: App, element: WippyVueElement<any, any>) => void
@@ -80,9 +83,14 @@ export abstract class WippyVueElement<
80
83
  this.emitEvent('invalid', { message: error })
81
84
  }
82
85
 
83
- // 2. Create Vue app
86
+ // 2. Create Vue app + Pinia
84
87
  this._vueApp = createApp(vueConfig.rootComponent)
85
- this._vueApp.use(createPinia())
88
+ const pinia = createPinia()
89
+ if (vueConfig.piniaPlugins) {
90
+ for (const plugin of vueConfig.piniaPlugins)
91
+ pinia.use(plugin)
92
+ }
93
+ this._vueApp.use(pinia)
86
94
 
87
95
  // 3. Install extra plugins
88
96
  if (vueConfig.plugins) {