@pinegrow/vite-plugin 3.0.0-beta.107 → 3.0.0-beta.109
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/dist/vue/index.js +3 -80
- package/package.json +1 -1
package/dist/vue/index.js
CHANGED
|
@@ -19,92 +19,15 @@ export function usePinegrow() {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const pgIdToElComputed = computed(() => {
|
|
23
|
-
const pgIds = {}
|
|
24
|
-
for (let [el, elCacheNodes] of elCache.entries()) {
|
|
25
|
-
if (el.isConnected) {
|
|
26
|
-
elCacheNodes.forEach(elCacheObj => {
|
|
27
|
-
if (
|
|
28
|
-
// elCacheObj.vnode.el.isConnected &&
|
|
29
|
-
elCacheObj.instance.isMounted &&
|
|
30
|
-
!elCacheObj.instance.isUnmounted &&
|
|
31
|
-
elCacheObj.pgId &&
|
|
32
|
-
(!elCacheObj.rootEl || elCacheObj.isRootFragment)
|
|
33
|
-
) {
|
|
34
|
-
if (!pgIds[elCacheObj.pgId]) {
|
|
35
|
-
pgIds[elCacheObj.pgId] = []
|
|
36
|
-
}
|
|
37
|
-
if (elCacheObj.key === undefined || elCacheObj.key === null) {
|
|
38
|
-
pgIds[elCacheObj.pgId].push(elCacheObj)
|
|
39
|
-
} else {
|
|
40
|
-
pgIds[elCacheObj.pgId].push([elCacheObj.key, elCacheObj])
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return pgIds
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
const localComponentToElComputed = computed(() => {
|
|
50
|
-
const localComponents = {}
|
|
51
|
-
for (let [el, elCacheNodes] of elCache.entries()) {
|
|
52
|
-
if (el.isConnected) {
|
|
53
|
-
elCacheNodes.forEach(elCacheObj => {
|
|
54
|
-
if (
|
|
55
|
-
// elCacheObj.vnode.el.isConnected &&
|
|
56
|
-
elCacheObj.instance.isMounted &&
|
|
57
|
-
!elCacheObj.instance.isUnmounted &&
|
|
58
|
-
elCacheObj.localFile
|
|
59
|
-
// && !elCacheObj.isIsland
|
|
60
|
-
// && (!elCacheObj.rootEl || elCacheObj.isRootFragment)
|
|
61
|
-
) {
|
|
62
|
-
if (!localComponents[elCacheObj.localFile]) {
|
|
63
|
-
localComponents[elCacheObj.localFile] = []
|
|
64
|
-
}
|
|
65
|
-
// There might be a elCache that was hydrated, and has the ile-root as a parent. If it was already there, then update the iles-root instead of adding a new node
|
|
66
|
-
const possibleIslandRootIndex = localComponents[elCacheObj.localFile].findIndex(
|
|
67
|
-
prevElCacheObj =>
|
|
68
|
-
prevElCacheObj.isIsland &&
|
|
69
|
-
prevElCacheObj.firstEl?.firstElementChild === elCacheObj.el
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
if (possibleIslandRootIndex > -1) {
|
|
73
|
-
const pgId = localComponents[elCacheObj.localFile][possibleIslandRootIndex].pgId
|
|
74
|
-
localComponents[elCacheObj.localFile][possibleIslandRootIndex] =
|
|
75
|
-
enrichWithComponentName({ ...elCacheObj, pgId }, elCacheObj.localFile)
|
|
76
|
-
} else {
|
|
77
|
-
localComponents[elCacheObj.localFile].push(
|
|
78
|
-
enrichWithComponentName(elCacheObj, elCacheObj.localFile)
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return localComponents
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
const appTree = computed(() => {
|
|
89
|
-
const appTreeNodes = Object.values(localComponentToElComputed.value).reduce(
|
|
90
|
-
(acc, localComponent) => [...acc, ...localComponent],
|
|
91
|
-
[]
|
|
92
|
-
)
|
|
93
|
-
const appTreeNodesSorted = appTreeNodes.sort((a, b) =>
|
|
94
|
-
a.el.compareDocumentPosition(b.el) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1
|
|
95
|
-
)
|
|
96
|
-
return appTreeNodesSorted
|
|
97
|
-
})
|
|
98
|
-
|
|
99
22
|
winObj.pinegrow = {
|
|
100
23
|
elCache,
|
|
101
24
|
// // Uncomment these two to test locally
|
|
102
25
|
// elCacheErrHandlerFn,
|
|
103
26
|
// elUpdateHanderFn,
|
|
104
27
|
// rootFragmentToPgIdComputed,
|
|
105
|
-
pgIdToElComputed,
|
|
106
|
-
localComponentToElComputed,
|
|
107
|
-
appTree,
|
|
28
|
+
// pgIdToElComputed,
|
|
29
|
+
// localComponentToElComputed,
|
|
30
|
+
// appTree,
|
|
108
31
|
}
|
|
109
32
|
}
|
|
110
33
|
}
|