@radiantabyss/vue 3.3.2 → 3.3.3

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": "@radiantabyss/vue",
3
- "version": "3.3.2",
3
+ "version": "3.3.3",
4
4
  "author": "radiantabyss.com",
5
5
  "license": "ISC",
6
6
  "eslintConfig": {
@@ -1,3 +1,4 @@
1
+ import { nextTick, watch } from 'vue';
1
2
  import { createRouter, createWebHistory } from 'vue-router';
2
3
  import Str from './../Support/Str';
3
4
  import Actions from './Actions';
@@ -74,9 +75,29 @@ export default async () => {
74
75
  //change document title
75
76
  let title = to.name.replace(/\//g, ' / ').replace(/Action$/, '');
76
77
  if ( to.meta.settings.title ) {
77
- title = typeof to.meta.settings.title == 'function' ? to.meta.settings.title() : to.meta.settings.title;
78
+ if ( typeof to.meta.settings.title == 'function' ) {
79
+ nextTick(async () => {
80
+ let instance = to.matched[to.matched.length - 1]?.instances?.default;
81
+ if ( !instance ) {
82
+ return;
83
+ }
84
+
85
+ watch(
86
+ () => ({ ...instance.$data }),
87
+ async () => {
88
+ document.title = await to.meta.settings.title.call(instance);
89
+ },
90
+ { deep: true }
91
+ );
92
+ });
93
+ }
94
+ else {
95
+ document.title = to.meta.settings.title;
96
+ }
97
+ }
98
+ else {
99
+ document.title = `${title} :: ${import.meta.env.VITE_NAME}`;
78
100
  }
79
- document.title = `${title} :: ${import.meta.env.VITE_NAME}`;
80
101
  });
81
102
 
82
103
  return { Router, RouteFiles };