vue-stack-tabs 0.1.51 → 1.0.1
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/README.md +717 -3
- package/dist/index.d.ts +3 -0
- package/dist/src/lib/StackTabs.vue.d.ts +33 -161
- package/dist/src/lib/components/ContextMenu/ContextMenuItem.vue.d.ts +6 -6
- package/dist/src/lib/components/ContextMenu/index.vue.d.ts +14 -14
- package/dist/src/lib/components/PageLoading.vue.d.ts +5 -5
- package/dist/src/lib/components/TabHeader/TabHeaderButton.vue.d.ts +24 -15
- package/dist/src/lib/components/TabHeader/TabHeaderItem.vue.d.ts +10 -8
- package/dist/src/lib/components/TabHeader/TabHeaderScroll.vue.d.ts +31 -13
- package/dist/src/lib/components/TabHeader/index.vue.d.ts +172 -20
- package/dist/src/lib/hooks/tabPanel/evict.d.ts +24 -0
- package/dist/src/lib/hooks/tabPanel/evict.spec.d.ts +1 -0
- package/dist/src/lib/hooks/tabPanel/scroll.d.ts +8 -0
- package/dist/src/lib/hooks/tabPanel/session.d.ts +9 -0
- package/dist/src/lib/hooks/tabPanel/state.d.ts +77 -0
- package/dist/src/lib/hooks/useContextMenu.d.ts +6 -1
- package/dist/src/lib/hooks/useTabActions.d.ts +68 -0
- package/dist/src/lib/hooks/{useTabMitt.d.ts → useTabEventBus.d.ts} +4 -3
- package/dist/src/lib/hooks/useTabLoading.d.ts +6 -0
- package/dist/src/lib/hooks/{useTabpanel.d.ts → useTabPanel.d.ts} +20 -14
- package/dist/src/lib/hooks/useTabPanel.spec.d.ts +1 -0
- package/dist/src/lib/hooks/useTabRouter.d.ts +14 -5
- package/dist/src/lib/i18n/index.d.ts +1 -1
- package/dist/src/lib/i18n/lang/en.d.ts +1 -0
- package/dist/src/lib/i18n/lang/zh-CN.d.ts +1 -0
- package/dist/src/lib/index.d.ts +5 -4
- package/dist/src/lib/model/TabModel.d.ts +20 -3
- package/dist/src/lib/model/TabModel.spec.d.ts +1 -0
- package/dist/src/lib/utils/iframeBridge.d.ts +31 -0
- package/dist/src/lib/utils/iframeBridge.spec.d.ts +1 -0
- package/dist/src/lib/utils/scrollUtils.d.ts +28 -0
- package/dist/src/lib/utils/tabInfoEncoder.d.ts +19 -0
- package/dist/src/lib/utils/tabInfoEncoder.spec.d.ts +1 -0
- package/dist/src/lib/utils/urlParser.d.ts +19 -0
- package/dist/src/lib/utils/urlParser.spec.d.ts +1 -0
- package/dist/src/lib/versionLogger.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/vue-stack-tabs.css +1 -0
- package/dist/vue-stack-tabs.es.js +1795 -1679
- package/dist/vue-stack-tabs.umd.js +1 -5
- package/package.json +76 -39
- package/src/lib/StackTabs.vue +222 -47
- package/src/lib/assets/image/open.svg +1 -0
- package/src/lib/assets/style/common/var.scss +1 -1
- package/src/lib/assets/style/icon.scss +6 -0
- package/src/lib/assets/style/stackTab.scss +46 -3
- package/src/lib/assets/style/transition.scss +63 -62
- package/src/lib/components/ContextMenu/ContextMenuItem.vue +7 -0
- package/src/lib/components/ContextMenu/index.vue +50 -38
- package/src/lib/components/PageLoading.vue +30 -10
- package/src/lib/components/TabHeader/TabHeaderButton.vue +12 -3
- package/src/lib/components/TabHeader/TabHeaderItem.vue +31 -27
- package/src/lib/components/TabHeader/TabHeaderScroll.vue +83 -77
- package/src/lib/components/TabHeader/index.vue +45 -40
- package/src/lib/hooks/tabPanel/evict.spec.ts +85 -0
- package/src/lib/hooks/tabPanel/evict.ts +57 -0
- package/src/lib/hooks/tabPanel/scroll.ts +52 -0
- package/src/lib/hooks/tabPanel/session.ts +33 -0
- package/src/lib/hooks/tabPanel/state.ts +52 -0
- package/src/lib/hooks/useContextMenu.ts +22 -20
- package/src/lib/hooks/useTabActions.ts +148 -0
- package/src/lib/hooks/useTabEventBus.ts +31 -0
- package/src/lib/hooks/useTabLoading.ts +12 -4
- package/src/lib/hooks/useTabPanel.spec.ts +34 -0
- package/src/lib/hooks/useTabPanel.tsx +546 -0
- package/src/lib/hooks/useTabRouter.ts +114 -103
- package/src/lib/i18n/index.ts +14 -18
- package/src/lib/i18n/lang/en.ts +2 -1
- package/src/lib/i18n/lang/zh-CN.ts +2 -1
- package/src/lib/iframe.vue +6 -0
- package/src/lib/index.ts +27 -8
- package/src/lib/model/TabModel.spec.ts +40 -0
- package/src/lib/model/TabModel.ts +22 -9
- package/src/lib/nuxt/module.d.ts +19 -0
- package/src/lib/nuxt/module.ts +34 -0
- package/src/lib/nuxt/runtime/plugin.client.ts +11 -0
- package/src/lib/utils/iframeBridge.spec.ts +37 -0
- package/src/lib/utils/iframeBridge.ts +52 -0
- package/src/lib/utils/{TabScrollHelper.ts → scrollUtils.ts} +23 -29
- package/src/lib/utils/tabInfoEncoder.spec.ts +42 -0
- package/src/lib/utils/tabInfoEncoder.ts +65 -0
- package/src/lib/utils/urlParser.spec.ts +45 -0
- package/src/lib/utils/urlParser.ts +42 -0
- package/src/lib/{banner.ts → versionLogger.ts} +4 -5
- package/dist/src/lib/banner.d.ts +0 -2
- package/dist/src/lib/hooks/useStackTab.d.ts +0 -11
- package/dist/src/lib/utils/TabIdHelper.d.ts +0 -11
- package/dist/src/lib/utils/TabScrollHelper.d.ts +0 -33
- package/dist/src/lib/utils/UriHelper.d.ts +0 -4
- package/src/lib/hooks/useStackTab.ts +0 -119
- package/src/lib/hooks/useTabMitt.ts +0 -30
- package/src/lib/hooks/useTabpanel.tsx +0 -708
- package/src/lib/utils/TabIdHelper.ts +0 -70
- package/src/lib/utils/UriHelper.ts +0 -22
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { ITabBase } from '../model/TabModel'
|
|
2
|
-
import { compressToEncodedURIComponent, decompressFromEncodedURIComponent } from 'lz-string'
|
|
3
|
-
import Hex from 'hex-encoding'
|
|
4
|
-
import { blake3 } from '@noble/hashes/blake3'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* compress tab info to string
|
|
8
|
-
* format:
|
|
9
|
-
* {tab id}{current timestamp}{tab name}{tab closable}
|
|
10
|
-
* @param tabData
|
|
11
|
-
*/
|
|
12
|
-
export const encodeTabInfo = (tabData: ITabBase): string => {
|
|
13
|
-
// const info: ITabBase = {
|
|
14
|
-
// id: tabData.id,
|
|
15
|
-
// title: tabData.title,
|
|
16
|
-
// iframe: tabData.iframe,
|
|
17
|
-
// closable: tabData.closable,
|
|
18
|
-
// refreshable: tabData.refreshable
|
|
19
|
-
// }
|
|
20
|
-
const info = `${tabData.id}|${tabData.title}|${tabData.iframe ? 'Y' : 'N'}|${tabData.closable ? 'Y' : 'N'}|${tabData.refreshable ? 'Y' : 'N'}`
|
|
21
|
-
return compressToEncodedURIComponent(info)
|
|
22
|
-
// const compressed = await compress(new TextEncoder().encode(info))
|
|
23
|
-
// return fromUint8Array(compressed, true)
|
|
24
|
-
// return compressToEncodedURIComponent(
|
|
25
|
-
// `${tabData.id}|${tabData.title}|${tabData.iframe ? 'Y' : 'N'}|${tabData.closable ? 'Y' : 'N'}|${tabData.refreshable ? 'Y' : 'N'}`
|
|
26
|
-
// )
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const decodeTabInfo = (tab: string): ITabBase => {
|
|
30
|
-
// const decompressed = await decompress(toUint8Array(tab))
|
|
31
|
-
const tabString = decompressFromEncodedURIComponent(tab)
|
|
32
|
-
// const tabString = new TextDecoder().decode(decompressed)
|
|
33
|
-
// return JSON.parse(new TextDecoder().decode(decompressed))
|
|
34
|
-
// const tabString = decompressFromEncodedURIComponent(tab)
|
|
35
|
-
const tabValues: string[] = tabString.split('|')
|
|
36
|
-
return {
|
|
37
|
-
id: tabValues[0],
|
|
38
|
-
title: tabValues[1],
|
|
39
|
-
iframe: tabValues[2] === 'Y',
|
|
40
|
-
closable: tabValues[3] === 'Y',
|
|
41
|
-
refreshable: tabValues[4] === 'Y'
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const createPageId = (tabId: string, path: string, query: Object): string => {
|
|
46
|
-
const queryArray = []
|
|
47
|
-
console.log(query)
|
|
48
|
-
type ObjectKey = keyof typeof query
|
|
49
|
-
for (const key in query) {
|
|
50
|
-
if (!key.startsWith('__')) {
|
|
51
|
-
queryArray.push({
|
|
52
|
-
key,
|
|
53
|
-
value: query[key as ObjectKey]
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
queryArray.sort((a, b) => {
|
|
58
|
-
let result = 0
|
|
59
|
-
if (a.key > b.key) {
|
|
60
|
-
result = 1
|
|
61
|
-
} else if (a.key < b.key) {
|
|
62
|
-
result = -1
|
|
63
|
-
}
|
|
64
|
-
return result
|
|
65
|
-
})
|
|
66
|
-
const hash = blake3(`${tabId}|${path}|${JSON.stringify(queryArray)}`)
|
|
67
|
-
return Hex.encode(hash)
|
|
68
|
-
// return uuidv5(`${tabId}|${path}|${JSON.stringify(queryArray)}`, uuidv5.URL).replaceAll('-', '')
|
|
69
|
-
// return await blake3(`${tabId}|${path}|${JSON.stringify(queryArray)}`)
|
|
70
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const uriDecode = (uri: string) => {
|
|
2
|
-
const uris = uri.split('?')
|
|
3
|
-
if (uris.length <= 1) {
|
|
4
|
-
return {
|
|
5
|
-
path: uris[0],
|
|
6
|
-
query: {}
|
|
7
|
-
}
|
|
8
|
-
} else {
|
|
9
|
-
const arr = uris[1].split('&')
|
|
10
|
-
const query: Record<string, string> = {}
|
|
11
|
-
for (const item of arr) {
|
|
12
|
-
const kv = item.split('=')
|
|
13
|
-
if (kv[1] !== null && kv[1] !== undefined && kv[1] !== '') {
|
|
14
|
-
query[kv[0]] = kv[1]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
path: uris[0],
|
|
19
|
-
query
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|