vue-stack-tabs 0.1.0 → 0.1.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/style.css +1 -1
- package/dist/vue-stack-tabs.es.js +7373 -5250
- package/dist/vue-stack-tabs.umd.js +14 -14
- package/package.json +16 -14
- package/src/lib/StackTabs.vue +7 -15
- package/src/lib/components/ContextMenu/ContextMenuItem.vue +1 -1
- package/src/lib/components/ContextMenu/index.vue +6 -6
- package/src/lib/components/TabHeader/index.vue +9 -9
- package/src/lib/hooks/useContextMenu.ts +1 -1
- package/src/lib/hooks/useStackTab.ts +4 -4
- package/src/lib/hooks/useTabpanel.tsx +4 -4
- package/src/lib/iframe.vue +1 -1
- package/src/lib/index.ts +2 -4
- package/src/lib/utils/TabIdHelper.ts +1 -7
- package/types/hooks/useStackTab.d.ts +1 -0
- package/types/index.d.ts +1 -1
- package/types/utils/TabIdHelper.d.ts +10 -0
- package/types/utils/UriHelper.d.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-stack-tabs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Vue.js component for router tab.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"dist",
|
|
10
10
|
"types"
|
|
11
11
|
],
|
|
12
|
-
"main": "dist/vue-stack-tabs.
|
|
12
|
+
"main": "dist/vue-stack-tabs.umd.js",
|
|
13
|
+
"module": "dist/vue-stack-tabs.es.js",
|
|
13
14
|
"types": "types/index.d.ts",
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
@@ -38,44 +39,45 @@
|
|
|
38
39
|
"lz-string": "^1.5.0",
|
|
39
40
|
"ulidx": "^2.3.0",
|
|
40
41
|
"uuid": "^9.0.1",
|
|
41
|
-
"vue-i18n": "^9.
|
|
42
|
+
"vue-i18n": "^9.10.1",
|
|
43
|
+
"vue-loading-overlay": "^6.0.4"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@mdit/plugin-tasklist": "^0.8.0",
|
|
47
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
45
48
|
"@rushstack/eslint-patch": "^1.7.2",
|
|
46
49
|
"@tsconfig/node21": "^21.0.1",
|
|
47
50
|
"@types/lodash-es": "^4.17.12",
|
|
48
|
-
"@types/node": "^20.11.
|
|
51
|
+
"@types/node": "^20.11.25",
|
|
49
52
|
"@types/uuid": "^9.0.8",
|
|
50
53
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
51
54
|
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
52
55
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
53
56
|
"@vue/eslint-config-typescript": "^12.0.0",
|
|
54
|
-
"@vue/runtime-core": "^3.4.
|
|
57
|
+
"@vue/runtime-core": "^3.4.21",
|
|
55
58
|
"@vue/tsconfig": "^0.5.1",
|
|
56
|
-
"element-plus": "^2.
|
|
57
|
-
"eslint": "^8.
|
|
59
|
+
"element-plus": "^2.6.0",
|
|
60
|
+
"eslint": "^8.57.0",
|
|
58
61
|
"eslint-plugin-prettier": "^5.1.3",
|
|
59
|
-
"eslint-plugin-vue": "^9.
|
|
62
|
+
"eslint-plugin-vue": "^9.22.0",
|
|
60
63
|
"js-base64": "^3.7.7",
|
|
61
64
|
"markdown-it": "^14.0.0",
|
|
62
65
|
"normalize.css": "^8.0.1",
|
|
63
66
|
"npm-run-all2": "^6.1.2",
|
|
64
|
-
"pinia": "^2.1.7",
|
|
65
67
|
"prettier": "^3.2.5",
|
|
66
68
|
"sass": "^1.71.1",
|
|
67
69
|
"sass-loader": "^14.1.1",
|
|
68
70
|
"typescript": "~5.3.3",
|
|
69
71
|
"unplugin-auto-import": "^0.17.5",
|
|
70
72
|
"unplugin-vue-components": "^0.26.0",
|
|
71
|
-
"vite": "^5.1.
|
|
73
|
+
"vite": "^5.1.5",
|
|
72
74
|
"vite-plugin-dts": "^3.7.3",
|
|
73
75
|
"vite-plugin-package-version": "^1.1.0",
|
|
76
|
+
"vite-plugin-require-transform": "^1.0.21",
|
|
74
77
|
"vitepress": "1.0.0-rc.44",
|
|
75
|
-
"vue": "^
|
|
76
|
-
"vue-
|
|
77
|
-
"vue
|
|
78
|
-
"vue-tsc": "^1.8.27"
|
|
78
|
+
"vue-tsc": "^1.8.27",
|
|
79
|
+
"vue-router": "^4.3.0",
|
|
80
|
+
"vue": "^3.4.21"
|
|
79
81
|
},
|
|
80
82
|
"scripts": {
|
|
81
83
|
"docs:dev": "vitepress dev docs",
|
package/src/lib/StackTabs.vue
CHANGED
|
@@ -40,22 +40,14 @@
|
|
|
40
40
|
|
|
41
41
|
<script lang="tsx" setup>
|
|
42
42
|
import 'vue-loading-overlay/dist/css/index.css'
|
|
43
|
-
import {
|
|
44
|
-
|
|
45
|
-
onBeforeMount,
|
|
46
|
-
onUnmounted,
|
|
47
|
-
provide,
|
|
48
|
-
ref,
|
|
49
|
-
type VNode,
|
|
50
|
-
watch
|
|
51
|
-
} from 'vue'
|
|
52
|
-
import type { TransitionProps } from 'vue'
|
|
43
|
+
import { onBeforeMount, onUnmounted, provide, ref, watch } from 'vue'
|
|
44
|
+
import type { TransitionProps, DefineComponent, VNode } from 'vue'
|
|
53
45
|
import { type RouteLocationNormalizedLoaded, useRouter } from 'vue-router'
|
|
54
|
-
import { getMaxZIndex } from '
|
|
55
|
-
import { type ITabData, TabScrollMode } from '
|
|
56
|
-
import TabHeader from '
|
|
57
|
-
import useTabpanel from '
|
|
58
|
-
import useStackTab from '
|
|
46
|
+
import { getMaxZIndex } from './utils/TabScrollHelper'
|
|
47
|
+
import { type ITabData, TabScrollMode } from './model/TabModel'
|
|
48
|
+
import TabHeader from './components/TabHeader/index.vue'
|
|
49
|
+
import useTabpanel from './hooks/useTabpanel'
|
|
50
|
+
import useStackTab from './hooks/useStackTab'
|
|
59
51
|
const { tabs, pageShown, caches, addPage, destroy, initial } = useTabpanel()
|
|
60
52
|
const emit = defineEmits(['onActive'])
|
|
61
53
|
const props = withDefaults(
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</template>
|
|
63
63
|
|
|
64
|
-
<script setup lang="ts"
|
|
64
|
+
<script setup lang="ts">
|
|
65
65
|
import { ref, onMounted, reactive } from 'vue'
|
|
66
|
-
import type { ITabItem, IContextMenu } from '
|
|
67
|
-
import localeI18n from '
|
|
68
|
-
import { getMaxZIndex } from '
|
|
69
|
-
import useTabpanel from '
|
|
70
|
-
import ContextMenuItem from '
|
|
66
|
+
import type { ITabItem, IContextMenu } from '../../model/TabModel'
|
|
67
|
+
import localeI18n from '../../i18n'
|
|
68
|
+
import { getMaxZIndex } from '../../utils/TabScrollHelper'
|
|
69
|
+
import useTabpanel from '../../hooks/useTabpanel'
|
|
70
|
+
import ContextMenuItem from './ContextMenuItem.vue'
|
|
71
71
|
// const emit = defineEmits(['close', 'closeAll', 'closeLeft', 'closeRight', 'refresh', 'refreshAll'])
|
|
72
72
|
const props = withDefaults(
|
|
73
73
|
defineProps<{
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
<script lang="ts" setup>
|
|
54
54
|
import { inject, computed, ref } from 'vue'
|
|
55
55
|
import type { TransitionProps, Ref } from 'vue'
|
|
56
|
-
import { TabScrollMode } from '
|
|
57
|
-
import type { ITabItem } from '
|
|
58
|
-
import ContextMenu from '
|
|
59
|
-
import useContextMenu from '
|
|
60
|
-
import localeI18n from '
|
|
61
|
-
import useTabpanel from '
|
|
62
|
-
import TabHeaderItem from '
|
|
63
|
-
import TabHeaderScroll from '
|
|
64
|
-
import TabHeaderButton from '
|
|
56
|
+
import { TabScrollMode } from '../../model/TabModel'
|
|
57
|
+
import type { ITabItem } from '../../model/TabModel'
|
|
58
|
+
import ContextMenu from './index.vue'
|
|
59
|
+
import useContextMenu from '../../hooks/useContextMenu'
|
|
60
|
+
import localeI18n from '../../i18n'
|
|
61
|
+
import useTabpanel from '../../hooks/useTabpanel'
|
|
62
|
+
import TabHeaderItem from './TabHeaderItem.vue'
|
|
63
|
+
import TabHeaderScroll from './TabHeaderScroll.vue'
|
|
64
|
+
import TabHeaderButton from './TabHeaderButton.vue'
|
|
65
65
|
// @ts-ignore
|
|
66
66
|
const { t } = localeI18n().getI18n()
|
|
67
67
|
const maximum = inject<boolean>('maximum')
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useRouter } from 'vue-router'
|
|
2
|
-
import useTabpanel from '
|
|
2
|
+
import useTabpanel from '../hooks/useTabpanel'
|
|
3
3
|
import { throttle } from 'lodash-es'
|
|
4
|
-
import type { ITabData } from '
|
|
4
|
+
import type { ITabData } from '../model/TabModel'
|
|
5
5
|
import { defu } from 'defu'
|
|
6
|
-
import { encodeTabInfo } from '
|
|
7
|
-
import { uriDecode } from '
|
|
6
|
+
import { encodeTabInfo } from '../utils/TabIdHelper'
|
|
7
|
+
import { uriDecode } from '../utils/UriHelper'
|
|
8
8
|
import { ulid } from 'ulidx'
|
|
9
9
|
let iframePath: string
|
|
10
10
|
export default () => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { ITabData, ITabItem, ITabPage } from '
|
|
1
|
+
import type { ITabData, ITabItem, ITabPage } from '../model/TabModel'
|
|
2
2
|
import { defineComponent, onActivated, onUnmounted, ref, unref } from 'vue'
|
|
3
3
|
import type { DefineComponent, VNode } from 'vue'
|
|
4
4
|
import { useRouter } from 'vue-router'
|
|
5
5
|
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
|
6
6
|
import { ulid } from 'ulidx'
|
|
7
|
-
import { encodeTabInfo, createPageId, decodeTabInfo } from '
|
|
7
|
+
import { encodeTabInfo, createPageId, decodeTabInfo } from '../utils/TabIdHelper'
|
|
8
8
|
import { defu } from 'defu'
|
|
9
|
-
import { Stack } from '
|
|
10
|
-
import { uriDecode } from '
|
|
9
|
+
import { Stack } from '../model/TabModel'
|
|
10
|
+
import { uriDecode } from '../utils/UriHelper'
|
|
11
11
|
|
|
12
12
|
const tabs = ref<ITabItem[]>([])
|
|
13
13
|
const defaultTabs: ITabItem[] = []
|
package/src/lib/iframe.vue
CHANGED
package/src/lib/index.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { App } from 'vue'
|
|
2
2
|
import { createI18n } from 'vue-i18n'
|
|
3
3
|
import StackTab from './StackTabs.vue'
|
|
4
|
-
// import VueEmttier from './hooks/useMitt'
|
|
5
4
|
import tabVersion from './banner'
|
|
6
|
-
// import './assets/style/index.scss'
|
|
7
|
-
// import 'vue-loading-overlay/dist/css/index.css'
|
|
8
5
|
import IFrame from './iframe.vue'
|
|
9
6
|
import useTabLoading from './hooks/useTabLoading'
|
|
10
7
|
import useTabRouter from './hooks/useTabRouter'
|
|
@@ -15,8 +12,9 @@ const i18n = createI18n({
|
|
|
15
12
|
locale: 'zh-CN',
|
|
16
13
|
fallbackLocale: 'en-US'
|
|
17
14
|
})
|
|
18
|
-
|
|
15
|
+
|
|
19
16
|
export * from './model/TabModel'
|
|
17
|
+
export { IFrame, useTabLoading, useTabRouter, useStackTab }
|
|
20
18
|
export default {
|
|
21
19
|
install(app: App): void {
|
|
22
20
|
tabVersion(import.meta.env.PACKAGE_VERSION)
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
// import { blake3 } from 'hash-wasm'
|
|
3
|
-
// import { compress, decompress } from 'brotli-compress'
|
|
4
|
-
// import { fromUint8Array } from 'js-base64'
|
|
5
|
-
// import { compress, decompress } from 'lzw-compressor'
|
|
6
|
-
import type { ITabBase } from '@/lib/model/TabModel'
|
|
1
|
+
import type { ITabBase } from '../model/TabModel'
|
|
7
2
|
import { compressToEncodedURIComponent, decompressFromEncodedURIComponent } from 'lz-string'
|
|
8
|
-
// import { v5 as uuidv5 } from 'uuid'
|
|
9
3
|
import Hex from 'hex-encoding'
|
|
10
4
|
import { blake3 } from '@noble/hashes/blake3'
|
|
11
5
|
|
package/types/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import IFrame from './iframe.vue';
|
|
|
2
2
|
import useTabLoading from './hooks/useTabLoading';
|
|
3
3
|
import useTabRouter from './hooks/useTabRouter';
|
|
4
4
|
import useStackTab from './hooks/useStackTab';
|
|
5
|
-
export { IFrame, useTabLoading, useTabRouter, useStackTab };
|
|
6
5
|
export * from './model/TabModel';
|
|
6
|
+
export { IFrame, useTabLoading, useTabRouter, useStackTab };
|
|
7
7
|
declare const _default: {
|
|
8
8
|
install(app: App): void;
|
|
9
9
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ITabBase } from '../model/TabModel';
|
|
2
|
+
/**
|
|
3
|
+
* compress tab info to string
|
|
4
|
+
* format:
|
|
5
|
+
* {tab id}{current timestamp}{tab name}{tab closable}
|
|
6
|
+
* @param tabData
|
|
7
|
+
*/
|
|
8
|
+
export declare const encodeTabInfo: (tabData: ITabBase) => string;
|
|
9
|
+
export declare const decodeTabInfo: (tab: string) => ITabBase;
|
|
10
|
+
export declare const createPageId: (tabId: string, path: string, query: Object) => string;
|