wave-ui 3.18.1 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wave-ui",
3
- "version": "3.18.1",
3
+ "version": "3.19.0",
4
4
  "description": "A UI framework for Vue.js 3 (and 2) with only the bright side. :sunny:",
5
5
  "author": "Antoni Andre <antoniandre.web@gmail.com>",
6
6
  "homepage": "https://antoniandre.github.io/wave-ui",
@@ -131,7 +131,7 @@ export default class WaveUI {
131
131
  else $waveui.switchTheme(config.theme, true)
132
132
 
133
133
  injectCSSInDOM($waveui)
134
- injectNotifManagerInDOM(wApp, components, $waveui)
134
+ injectNotifManagerInDOM(app)
135
135
 
136
136
  // This mixin must only run once, we can delete it.
137
137
  app._context.mixins.find(mixin => mixin.mounted && delete mixin.mounted)
@@ -1,4 +1,4 @@
1
- import { createApp, defineComponent } from 'vue'
1
+ import { h, render } from 'vue'
2
2
  import WNotificationManager from '../components/w-notification-manager.vue'
3
3
 
4
4
  export class NotificationManager {
@@ -56,24 +56,17 @@ export class NotificationManager {
56
56
  /**
57
57
  * Injects the w-notification-manager in the DOM programmatically so the user does not have to do it.
58
58
  *
59
- * @param {Object} wApp The DOM element where to mount the w-notification-manager.
60
- * @param {Object} components All the Wave UI components to provide to the w-notification-manager,
61
- * so it can also use them.
62
- * @param {Object} $waveui the injected reactive instance of the WaveUI class.
59
+ * @param {Object} app The Vue app instance.
63
60
  */
64
- export const injectNotifManagerInDOM = (wApp, components, $waveui) => {
61
+ export const injectNotifManagerInDOM = app => {
65
62
  const div = document.createElement('div')
66
- wApp.appendChild(div)
63
+ document.body.appendChild(div) // Attach to body before teleporting.
67
64
 
68
- const WNotifManager = createApp(defineComponent({
69
- ...WNotificationManager,
70
- inject: ['$waveui']
71
- })).provide('$waveui', $waveui)
65
+ // Create a VNode for WNotificationManager and assign app._context to inherit global components.
66
+ const vnode = h(WNotificationManager)
67
+ vnode.appContext = app._context // ! \ Attach app context to inherit global components & provide()!
72
68
 
73
- for (const id in components) {
74
- const component = components[id]
75
- WNotifManager.component(component.name, { ...component, inject: ['$waveui'] })
76
- }
77
- WNotifManager.mount(div)
78
- div.remove() // The WNotificationManager contains a teleport to .w-app.
69
+ render(vnode, div) // Render inside the main app scope.
70
+
71
+ div.remove() // The WNotificationManager component teleports itself inside `.w-app`.
79
72
  }