@skyservice-developers/vue-dev-kit 1.4.0 → 1.4.2
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/vue2/style.css +1 -1
- package/dist/vue2/vue-dev-kit.cjs +1 -1
- package/dist/vue2/vue-dev-kit.js +250 -241
- package/dist/vue3/style.css +1 -1
- package/dist/vue3/vue-dev-kit.cjs +1 -1
- package/dist/vue3/vue-dev-kit.js +534 -521
- package/package.json +1 -1
- package/src/vue2/components/Header.vue +24 -8
- package/src/vue3/components/Header.vue +35 -4
package/package.json
CHANGED
|
@@ -158,12 +158,7 @@ export default {
|
|
|
158
158
|
// Load componentStats from parent
|
|
159
159
|
getParentLocalStorage('componentStats').then((data) => {
|
|
160
160
|
if (data != null) {
|
|
161
|
-
|
|
162
|
-
const parsed = typeof data === 'string' ? JSON.parse(data) : data
|
|
163
|
-
if (parsed?.pages) {
|
|
164
|
-
this.localStorageItems = Object.values(parsed.pages)
|
|
165
|
-
}
|
|
166
|
-
} catch {}
|
|
161
|
+
this.loadParentComponentStats(data)
|
|
167
162
|
}
|
|
168
163
|
})
|
|
169
164
|
}
|
|
@@ -182,11 +177,32 @@ export default {
|
|
|
182
177
|
sendToParent({ type: 'setRocketMode', value: restore })
|
|
183
178
|
}
|
|
184
179
|
},
|
|
185
|
-
|
|
180
|
+
findPreviousPage() {
|
|
181
|
+
return this.sortedItems.find(item => item.name !== this.trackPageName)
|
|
182
|
+
},
|
|
183
|
+
loadParentComponentStats(data) {
|
|
184
|
+
try {
|
|
185
|
+
const parsed = typeof data === 'string' ? JSON.parse(data) : data
|
|
186
|
+
if (parsed?.pages) {
|
|
187
|
+
this.localStorageItems = Object.values(parsed.pages)
|
|
188
|
+
}
|
|
189
|
+
} catch {}
|
|
190
|
+
},
|
|
191
|
+
async handleBack() {
|
|
186
192
|
if (this.backEvent) return this.backEvent()
|
|
187
193
|
|
|
188
194
|
// Navigate to the last visited page that isn't the current one
|
|
189
|
-
|
|
195
|
+
let previousPage = this.findPreviousPage()
|
|
196
|
+
|
|
197
|
+
// If history not loaded yet, try fetching from parent
|
|
198
|
+
if (!previousPage && isInIframe()) {
|
|
199
|
+
const data = await getParentLocalStorage('componentStats')
|
|
200
|
+
if (data) {
|
|
201
|
+
this.loadParentComponentStats(data)
|
|
202
|
+
previousPage = this.findPreviousPage()
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
190
206
|
if (previousPage) {
|
|
191
207
|
this.restoreRocketMode()
|
|
192
208
|
sendToParent({ type: 'navigate', path: previousPage.path })
|
|
@@ -174,20 +174,26 @@ if (isInIframe()) {
|
|
|
174
174
|
|
|
175
175
|
function loadComponentStats(raw) {
|
|
176
176
|
try {
|
|
177
|
-
if (!raw) return
|
|
177
|
+
if (!raw) { console.log('[Header] loadComponentStats: raw is empty'); return }
|
|
178
178
|
const data = typeof raw === 'string' ? JSON.parse(raw) : raw
|
|
179
179
|
if (data?.pages) {
|
|
180
180
|
localStorageItems.value = Object.values(data.pages)
|
|
181
|
+
console.log('[Header] loadComponentStats: loaded', localStorageItems.value.length, 'items', localStorageItems.value.map(i => i.name))
|
|
182
|
+
} else {
|
|
183
|
+
console.log('[Header] loadComponentStats: no pages in data', data)
|
|
181
184
|
}
|
|
182
|
-
} catch {}
|
|
185
|
+
} catch (e) { console.error('[Header] loadComponentStats error:', e) }
|
|
183
186
|
}
|
|
184
187
|
|
|
185
188
|
// Load from local localStorage first
|
|
189
|
+
console.log('[Header] localStorage componentStats:', localStorage['componentStats'] ? 'exists' : 'empty')
|
|
186
190
|
loadComponentStats(localStorage['componentStats'])
|
|
187
191
|
|
|
188
192
|
// If in iframe, request from parent and update
|
|
189
193
|
if (isInIframe()) {
|
|
194
|
+
console.log('[Header] requesting componentStats from parent...')
|
|
190
195
|
getParentLocalStorage('componentStats').then((data) => {
|
|
196
|
+
console.log('[Header] componentStats from parent:', data != null ? 'received' : 'null', data)
|
|
191
197
|
if (data != null) {
|
|
192
198
|
localStorage.setItem('componentStats', JSON.stringify(data))
|
|
193
199
|
loadComponentStats(data)
|
|
@@ -265,17 +271,42 @@ const restoreRocketMode = () => {
|
|
|
265
271
|
}
|
|
266
272
|
}
|
|
267
273
|
|
|
268
|
-
const
|
|
274
|
+
const findPreviousPage = () => {
|
|
275
|
+
return sortedItems.value.find(item => item.name !== props.trackPageName)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const handleBack = async () => {
|
|
279
|
+
console.log('[Header] handleBack called')
|
|
280
|
+
console.log('[Header] backEvent:', !!props.backEvent)
|
|
269
281
|
if (props.backEvent) return props.backEvent()
|
|
270
282
|
|
|
283
|
+
console.log('[Header] trackPageName:', props.trackPageName)
|
|
284
|
+
console.log('[Header] sortedItems:', sortedItems.value.length, 'items', sortedItems.value.map(i => ({ name: i.name, path: i.path?.substring(0, 50) })))
|
|
285
|
+
|
|
271
286
|
// Navigate to the last visited page that isn't the current one
|
|
272
|
-
|
|
287
|
+
let previousPage = findPreviousPage()
|
|
288
|
+
console.log('[Header] findPreviousPage (cached):', previousPage ? previousPage.name + ' → ' + previousPage.path?.substring(0, 50) : 'NOT FOUND')
|
|
289
|
+
|
|
290
|
+
// If history not loaded yet, try fetching from parent
|
|
291
|
+
if (!previousPage && isInIframe()) {
|
|
292
|
+
console.log('[Header] no cached history, fetching from parent...')
|
|
293
|
+
const data = await getParentLocalStorage('componentStats')
|
|
294
|
+
console.log('[Header] fresh componentStats:', data)
|
|
295
|
+
if (data) {
|
|
296
|
+
loadComponentStats(data)
|
|
297
|
+
previousPage = findPreviousPage()
|
|
298
|
+
console.log('[Header] findPreviousPage (fresh):', previousPage ? previousPage.name : 'NOT FOUND')
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
273
302
|
if (previousPage) {
|
|
303
|
+
console.log('[Header] → NAVIGATE to', previousPage.path)
|
|
274
304
|
restoreRocketMode()
|
|
275
305
|
sendToParent({ type: 'navigate', path: previousPage.path })
|
|
276
306
|
return
|
|
277
307
|
}
|
|
278
308
|
|
|
309
|
+
console.log('[Header] → EXIT (no previous page found)')
|
|
279
310
|
restoreRocketMode()
|
|
280
311
|
sendToParent({ type: 'exit' })
|
|
281
312
|
}
|