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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-stack-tabs",
3
- "version": "0.1.0",
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.es.js",
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.9.1"
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.19",
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.19",
57
+ "@vue/runtime-core": "^3.4.21",
55
58
  "@vue/tsconfig": "^0.5.1",
56
- "element-plus": "^2.5.6",
57
- "eslint": "^8.56.0",
59
+ "element-plus": "^2.6.0",
60
+ "eslint": "^8.57.0",
58
61
  "eslint-plugin-prettier": "^5.1.3",
59
- "eslint-plugin-vue": "^9.21.1",
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.3",
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": "^3.4.19",
76
- "vue-loading-overlay": "^6.0.4",
77
- "vue-router": "^4.2.5",
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",
@@ -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
- type DefineComponent,
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 '@/lib/utils/TabScrollHelper'
55
- import { type ITabData, TabScrollMode } from '@/lib/model/TabModel'
56
- import TabHeader from '@/lib/components/TabHeader/index.vue'
57
- import useTabpanel from '@/lib/hooks/useTabpanel'
58
- import useStackTab from '@/lib/hooks/useStackTab'
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(
@@ -5,7 +5,7 @@
5
5
  </div>
6
6
  </template>
7
7
 
8
- <script setup lang="ts" name="StackTabContextMenuItem">
8
+ <script setup lang="ts">
9
9
  defineProps<{
10
10
  icon?: string
11
11
  title: string
@@ -61,13 +61,13 @@
61
61
  </div>
62
62
  </template>
63
63
 
64
- <script setup lang="ts" name="StackTabContextMenu">
64
+ <script setup lang="ts">
65
65
  import { ref, onMounted, reactive } from 'vue'
66
- import type { ITabItem, IContextMenu } from '@/lib/model/TabModel'
67
- import localeI18n from '@/lib/i18n'
68
- import { getMaxZIndex } from '@/lib/utils/TabScrollHelper'
69
- import useTabpanel from '@/lib/hooks/useTabpanel'
70
- import ContextMenuItem from '@/lib/components/ContextMenu/ContextMenuItem.vue'
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 '@/lib/model/TabModel'
57
- import type { ITabItem } from '@/lib/model/TabModel'
58
- import ContextMenu from '@/lib/components/ContextMenu/index.vue'
59
- import useContextMenu from '@/lib/hooks/useContextMenu'
60
- import localeI18n from '@/lib/i18n'
61
- import useTabpanel from '@/lib/hooks/useTabpanel'
62
- import TabHeaderItem from '@/lib/components/TabHeader/TabHeaderItem.vue'
63
- import TabHeaderScroll from '@/lib/components/TabHeader/TabHeaderScroll.vue'
64
- import TabHeaderButton from '@/lib/components/TabHeader/TabHeaderButton.vue'
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,5 +1,5 @@
1
1
  import { onUnmounted, onMounted, ref, reactive, nextTick } from 'vue'
2
- import type { ITabItem } from '@/lib/model/TabModel'
2
+ import type { ITabItem } from '../model/TabModel'
3
3
  export default () => {
4
4
  const contextMenuData = reactive({
5
5
  item: {},
@@ -1,10 +1,10 @@
1
1
  import { useRouter } from 'vue-router'
2
- import useTabpanel from '@/lib/hooks/useTabpanel'
2
+ import useTabpanel from '../hooks/useTabpanel'
3
3
  import { throttle } from 'lodash-es'
4
- import type { ITabData } from '@/lib/model/TabModel'
4
+ import type { ITabData } from '../model/TabModel'
5
5
  import { defu } from 'defu'
6
- import { encodeTabInfo } from '@/lib/utils/TabIdHelper'
7
- import { uriDecode } from '@/lib/utils/UriHelper'
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 '@/lib/model/TabModel'
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 '@/lib/utils/TabIdHelper'
7
+ import { encodeTabInfo, createPageId, decodeTabInfo } from '../utils/TabIdHelper'
8
8
  import { defu } from 'defu'
9
- import { Stack } from '@/lib/model/TabModel'
10
- import { uriDecode } from '@/lib/utils/UriHelper'
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[] = []
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import useTabRouter from '@/lib/hooks/useTabRouter'
2
+ import useTabRouter from './hooks/useTabRouter'
3
3
  useTabRouter()
4
4
  </script>
5
5
  <template>
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
- export { IFrame, useTabLoading, useTabRouter, useStackTab }
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
- // import { compressToEncodedURIComponent, decompressFromEncodedURIComponent } from 'lz-string'
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
 
@@ -1,4 +1,5 @@
1
1
  import { DebouncedFunc } from 'lodash-es';
2
+ import type { ITabData } from '../model/TabModel';
2
3
  declare const _default: () => {
3
4
  openNewTab: DebouncedFunc<(tab: ITabData) => Promise<any>>;
4
5
  setIFramePath: (path: string) => void;
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;
@@ -0,0 +1,4 @@
1
+ export declare const uriDecode: (uri: string) => {
2
+ path: string;
3
+ query: Record<string, string>;
4
+ };