@pinegrow/vite-plugin 3.0.0-beta.141 → 3.0.0-beta.143

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/dist/vue/index.js +4 -103
  2. package/package.json +3 -2
package/dist/vue/index.js CHANGED
@@ -28,111 +28,12 @@ export function usePinegrow() {
28
28
  }
29
29
  }
30
30
 
31
- const pgIdToElComputed = computed(() => {
32
- const pgIds = {}
33
- for (let [el, elCacheNodes] of elCache.entries()) {
34
- if (el.isConnected) {
35
- elCacheNodes.forEach(elCacheObj => {
36
- if (
37
- // elCacheObj.vnode.el.isConnected &&
38
- elCacheObj.instance.isMounted &&
39
- !elCacheObj.instance.isUnmounted &&
40
- elCacheObj.pgId &&
41
- (!elCacheObj.rootEl ||
42
- elCacheObj.isRootFragment ||
43
- (elCacheObj.rootEl && elCacheObj.rootEl === elCacheObj.el.parentNode))
44
- ) {
45
- if (!pgIds[elCacheObj.pgId]) {
46
- pgIds[elCacheObj.pgId] = []
47
- }
48
- if (elCacheObj.key === undefined || elCacheObj.key === null) {
49
- pgIds[elCacheObj.pgId].push(elCacheObj)
50
- } else {
51
- pgIds[elCacheObj.pgId].push([elCacheObj.key, elCacheObj])
52
- }
53
- }
54
- })
55
- }
56
- }
57
- return pgIds
58
- })
59
-
60
- const localComponentToElComputed = computed(() => {
61
- const localComponents = {}
62
- for (let [el, elCacheNodes] of elCache.entries()) {
63
- if (el.isConnected) {
64
- elCacheNodes.forEach(elCacheObj => {
65
- if (
66
- // elCacheObj.vnode.el.isConnected &&
67
- elCacheObj.instance.isMounted &&
68
- !elCacheObj.instance.isUnmounted &&
69
- elCacheObj.localFile
70
- // && !elCacheObj.isIsland
71
- // && (!elCacheObj.rootEl ||
72
- // elCacheObj.isRootFragment ||
73
- // (elCacheObj.rootEl && elCacheObj.rootEl === elCacheObj.el.parentNode))
74
- ) {
75
- if (!localComponents[elCacheObj.localFile]) {
76
- localComponents[elCacheObj.localFile] = []
77
- }
78
- // 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
79
- const possibleIslandRootIndex = localComponents[elCacheObj.localFile].findIndex(
80
- prevElCacheObj =>
81
- prevElCacheObj.isIsland &&
82
- prevElCacheObj.firstEl?.firstElementChild === elCacheObj.el
83
- )
84
-
85
- if (possibleIslandRootIndex > -1) {
86
- const pgId = localComponents[elCacheObj.localFile][possibleIslandRootIndex].pgId
87
- localComponents[elCacheObj.localFile][possibleIslandRootIndex] =
88
- enrichWithComponentName({ ...elCacheObj, pgId }, elCacheObj.localFile)
89
- } else {
90
- localComponents[elCacheObj.localFile].push(
91
- enrichWithComponentName(elCacheObj, elCacheObj.localFile)
92
- )
93
- }
94
- }
95
- })
96
- }
97
- }
98
- return localComponents
99
- })
100
-
101
- const appTree = computed(() => {
102
- const appTreeNodes = Object.values(localComponentToElComputed.value).reduce((acc, elCacheNodes) => {
103
- const filteredElCacheNodes = []
104
- elCacheNodes.forEach(elCacheObj => {
105
- // If Island and already hydrated, then remove it off
106
- if (elCacheObj.isIsland) {
107
- const childEl = elCacheObj.firstEl.firstElementChild
108
- if (childEl) {
109
- if (elCache.has(childEl)) {
110
- // Hydrated, don't include
111
- return
112
- }
113
- // const childElCacheObj = elCache.get(childEl)
114
- // if (childElCacheObj) {
115
- // childElCacheObj.pgId = elCacheObj.pgId
116
- // // Hydrated, don't include
117
- // return
118
- // }
119
- }
120
- }
121
- filteredElCacheNodes.push(elCacheObj)
122
- })
123
- return [...acc, ...filteredElCacheNodes]
124
- }, [])
125
- const appTreeNodesSorted = appTreeNodes.sort((a, b) =>
126
- a.el.compareDocumentPosition(b.el) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1
127
- )
128
- return appTreeNodesSorted
129
- })
130
-
131
31
  winObj.pinegrow = {
132
32
  elCache,
133
- pgIdToElComputed,
134
- localComponentToElComputed,
135
- appTree,
33
+ // pgIdToElComputed,
34
+ // localComponentToElComputed,
35
+ // appTree,
36
+ reactiveFromContext: reactive,
136
37
  refFromContext: ref,
137
38
  computedFromContext: computed,
138
39
  watchFromContext: watch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinegrow/vite-plugin",
3
- "version": "3.0.0-beta.141",
3
+ "version": "3.0.0-beta.143",
4
4
  "description": "Pinegrow Vite Plugin",
5
5
  "type": "module",
6
6
  "files": [
@@ -13,7 +13,8 @@
13
13
  "exports": {
14
14
  ".": {
15
15
  "import": "./dist/index.cjs",
16
- "require": "./dist/index.cjs"
16
+ "require": "./dist/index.cjs",
17
+ "types": "./types.d.ts"
17
18
  },
18
19
  "./dev": {
19
20
  "import": "./src/index.js",