vue-stack-tabs 1.3.1 → 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/README.en.md +119 -52
- package/README.md +103 -42
- package/README.ru.md +125 -54
- package/dist/{src/lib/StackTabs.vue.d.ts → StackTabs.vue.d.ts} +5 -5
- package/dist/{src/lib/components → components}/ContextMenu/index.vue.d.ts +1 -1
- package/dist/components/StackKeepAlive/emptyPlaceholder.d.ts +3 -0
- package/dist/{src/lib/components → components}/TabHeader/TabHeaderItem.vue.d.ts +9 -0
- package/dist/{src/lib/components → components}/TabHeader/index.vue.d.ts +3 -3
- package/dist/{src/lib/hooks → hooks}/stackTabsContext.d.ts +5 -2
- package/dist/hooks/tabPanel/pageComponentFactory.d.ts +23 -0
- package/dist/{src/lib/hooks → hooks}/tabPanel/refresh.d.ts +6 -3
- package/dist/{src/lib/hooks → hooks}/tabPanel/scroll.d.ts +2 -0
- package/dist/hooks/tabPanel/tabStore.d.ts +69 -0
- package/dist/hooks/useScrollShadow.d.ts +20 -0
- package/dist/{src/lib/hooks → hooks}/useTabActions.d.ts +7 -2
- package/dist/{src/lib/hooks → hooks}/useTabEventBus.d.ts +2 -1
- package/dist/{src/lib/hooks → hooks}/useTabPanel.d.ts +16 -4
- package/dist/iframe-bridge.mjs +1 -1
- package/dist/index.d.ts +22 -6
- package/dist/{src/lib/model → model}/TabModel.d.ts +21 -0
- package/dist/nuxt/module.mjs +10 -6
- package/dist/nuxt/runtime/plugin.mjs +1600 -4
- package/dist/style.css +1 -1
- package/dist/utils/iframeBridge.d.ts +7 -1
- package/dist/{src/lib/utils → utils}/scrollUtils.d.ts +7 -1
- package/dist/{src/lib/versionLogger.d.ts → versionLogger.d.ts} +1 -1
- package/dist/vue-stack-tabs.css +1 -1
- package/dist/vue-stack-tabs.es.js +1 -1
- package/package.json +64 -40
- package/src/lib/StackTabs.vue +16 -3
- package/src/lib/assets/style/common/var.scss +2 -0
- package/src/lib/assets/style/stackTab.scss +17 -3
- package/src/lib/components/ContextMenu/index.vue +12 -3
- package/src/lib/components/PageLoading.vue +10 -2
- package/src/lib/components/StackKeepAlive/StackCacheRenderer.vue +3 -9
- package/src/lib/components/StackKeepAlive/emptyPlaceholder.tsx +18 -0
- package/src/lib/components/TabHeader/index.vue +4 -3
- package/src/lib/hooks/stackTabsContext.ts +23 -18
- package/src/lib/hooks/tabPanel/pageComponentFactory.tsx +136 -0
- package/src/lib/hooks/tabPanel/refresh.ts +20 -13
- package/src/lib/hooks/tabPanel/scroll.ts +110 -7
- package/src/lib/hooks/tabPanel/session.ts +29 -3
- package/src/lib/hooks/tabPanel/tabStore.ts +595 -0
- package/src/lib/hooks/useContextMenu.ts +57 -11
- package/src/lib/hooks/useIframeManager.ts +18 -2
- package/src/lib/hooks/useScrollShadow.ts +124 -0
- package/src/lib/hooks/useTabActions.ts +18 -8
- package/src/lib/hooks/useTabEventBus.ts +5 -3
- package/src/lib/hooks/useTabPanel.tsx +183 -302
- package/src/lib/hooks/useTabRouter.ts +42 -38
- package/src/lib/i18n/index.ts +3 -3
- package/src/lib/model/TabModel.ts +40 -1
- package/src/lib/nuxt/module.ts +10 -3
- package/src/lib/nuxt/runtime/plugin.ts +13 -2
- package/src/lib/utils/iframeBridge.ts +9 -1
- package/src/lib/utils/scrollUtils.ts +35 -2
- package/src/lib/utils/tabInfoEncoder.ts +21 -8
- package/src/lib/utils/urlParser.ts +3 -1
- package/src/lib/versionLogger.ts +6 -2
- package/dist/favicon.svg +0 -10
- package/dist/iframe-bridge.html +0 -77
- package/dist/iframe-child.html +0 -88
- package/dist/nuxt/favicon.svg +0 -10
- package/dist/nuxt/iframe-bridge.html +0 -77
- package/dist/nuxt/iframe-child.html +0 -88
- package/dist/nuxt/plugin.mjs +0 -9
- package/dist/src/lib/iframe-bridge.d.ts +0 -8
- package/dist/src/lib/index.d.ts +0 -22
- package/dist/src/lib/nuxt/module.d.ts +0 -6
- package/dist/src/lib/nuxt/runtime/plugin.client.d.ts +0 -2
- package/dist/src/lib/nuxt/runtime/plugin.d.ts +0 -2
- package/dist/src/lib/utils/iframeBridge.d.ts +0 -39
- package/src/lib/nuxt/runtime/plugin.client.ts +0 -10
- /package/dist/{src/lib/components → components}/ContextMenu/ContextMenuItem.vue.d.ts +0 -0
- /package/dist/{src/lib/components → components}/PageLoading.vue.d.ts +0 -0
- /package/dist/{src/lib/components → components}/StackKeepAlive/StackCacheRenderer.vue.d.ts +0 -0
- /package/dist/{src/lib/components → components}/StackKeepAlive/StackKeepAlive.vue.d.ts +0 -0
- /package/dist/{src/lib/components → components}/TabHeader/TabHeaderButton.vue.d.ts +0 -0
- /package/dist/{src/lib/components → components}/TabHeader/TabHeaderScroll.vue.d.ts +0 -0
- /package/dist/{src/lib/hooks → hooks}/tabPanel/evict.d.ts +0 -0
- /package/dist/{src/lib/hooks → hooks}/tabPanel/navigationTransaction.d.ts +0 -0
- /package/dist/{src/lib/hooks → hooks}/tabPanel/session.d.ts +0 -0
- /package/dist/{src/lib/hooks → hooks}/tabPanel/state.d.ts +0 -0
- /package/dist/{src/lib/hooks → hooks}/useContextMenu.d.ts +0 -0
- /package/dist/{src/lib/hooks → hooks}/useIframeManager.d.ts +0 -0
- /package/dist/{src/lib/hooks → hooks}/useTabLoading.d.ts +0 -0
- /package/dist/{src/lib/hooks → hooks}/useTabRouter.d.ts +0 -0
- /package/dist/{src/lib/i18n → i18n}/index.d.ts +0 -0
- /package/dist/{src/lib/i18n → i18n}/lang/en.d.ts +0 -0
- /package/dist/{src/lib/i18n → i18n}/lang/zh-CN.d.ts +0 -0
- /package/dist/{src/lib/i18n → i18n}/stackTabsLocale.d.ts +0 -0
- /package/dist/{src/lib/iframe.vue.d.ts → iframe.vue.d.ts} +0 -0
- /package/dist/{src/lib/utils → utils}/stackTabsA11y.d.ts +0 -0
- /package/dist/{src/lib/utils → utils}/stackTabsMessage.d.ts +0 -0
- /package/dist/{src/lib/utils → utils}/tabInfoEncoder.d.ts +0 -0
- /package/dist/{src/lib/utils → utils}/typeGuards.d.ts +0 -0
- /package/dist/{src/lib/utils → utils}/urlParser.d.ts +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
2
|
import { Emitter, EventType } from 'mitt';
|
|
3
|
+
import { StackTabsRuntimeContext } from './stackTabsContext';
|
|
3
4
|
declare module '@vue/runtime-core' {
|
|
4
5
|
interface ComponentCustomProperties {
|
|
5
6
|
$layerEmitter: Emitter<TabEventPayloadMap>;
|
|
@@ -28,4 +29,4 @@ export interface TabEventPayloadMap extends Record<EventType, unknown> {
|
|
|
28
29
|
}
|
|
29
30
|
export declare const tabEmitterKey: InjectionKey<Emitter<TabEventPayloadMap>>;
|
|
30
31
|
/** 获取标签事件总线,用于组件间通信 */
|
|
31
|
-
export declare const useTabEmitter: () => Emitter<TabEventPayloadMap>;
|
|
32
|
+
export declare const useTabEmitter: (runtimeContext?: StackTabsRuntimeContext) => Emitter<TabEventPayloadMap>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ITabData, ITabItem } from '../model/TabModel';
|
|
1
|
+
import { ITabData, ITabItem, ITabPage } from '../model/TabModel';
|
|
2
2
|
import { DefineComponent, VNode } from 'vue';
|
|
3
3
|
import { RouteLocationNormalizedLoaded } from 'vue-router';
|
|
4
|
+
import { StackTabsRuntimeContext } from './stackTabsContext';
|
|
4
5
|
/** 规范化路径(nginx 等可能加尾部斜杠) */
|
|
5
6
|
export declare const normalizePathForCache: (route: RouteLocationNormalizedLoaded) => string;
|
|
6
|
-
declare const _default: () => {
|
|
7
|
+
declare const _default: (providedRuntimeContext?: StackTabsRuntimeContext) => {
|
|
7
8
|
tabs: import('vue').Ref<ITabItem[], ITabItem[]>;
|
|
8
9
|
caches: import('vue').ShallowRef<string[]>;
|
|
9
10
|
refreshKey: import('vue').Ref<number, number>;
|
|
@@ -21,7 +22,17 @@ declare const _default: () => {
|
|
|
21
22
|
addCache: (cacheName: string) => void;
|
|
22
23
|
removeCache: (cacheName: string) => void;
|
|
23
24
|
getTab: (id: string) => ITabItem | null;
|
|
25
|
+
getActiveTab: () => ITabItem | null;
|
|
26
|
+
getTopPage: (tabId: string) => ITabPage | null;
|
|
27
|
+
getPages: (tabId: string) => readonly ITabPage[];
|
|
28
|
+
getPageSnapshot: (tabId: string) => ITabPage[];
|
|
29
|
+
moveTab: (id: string, targetIndex: number) => boolean;
|
|
24
30
|
addTab: (tab: ITabItem) => void;
|
|
31
|
+
appendPage: (tabId: string, page: ITabPage) => void;
|
|
32
|
+
popPages: (tabId: string, steps: number) => ITabPage[];
|
|
33
|
+
replacePages: (tabId: string, pages: readonly ITabPage[]) => void;
|
|
34
|
+
clearPages: (tabId: string) => void;
|
|
35
|
+
updatePage: (tabId: string, pageId: string, patch: import('./tabPanel/tabStore').PagePatch) => boolean;
|
|
25
36
|
removeTab: (id: string) => string;
|
|
26
37
|
removeAllTabs: () => void;
|
|
27
38
|
removeLeftTabs: (id: string) => void;
|
|
@@ -30,12 +41,13 @@ declare const _default: () => {
|
|
|
30
41
|
hasTab: (id: string) => boolean;
|
|
31
42
|
renewTab: (tab: ITabData) => (() => void) | undefined;
|
|
32
43
|
addPage: (route: RouteLocationNormalizedLoaded, component?: VNode | null) => DefineComponent;
|
|
33
|
-
addComponent: (id: string,
|
|
44
|
+
addComponent: (id: string, component: DefineComponent) => void;
|
|
34
45
|
getComponent: (id: string) => DefineComponent | undefined;
|
|
35
|
-
removeComponent: (id: string) =>
|
|
46
|
+
removeComponent: (id: string) => void;
|
|
36
47
|
markCacheForEviction: (cacheName: string) => void;
|
|
37
48
|
evictMarkedCaches: () => void;
|
|
38
49
|
evictPageCache: (cacheName: string) => void;
|
|
50
|
+
clearTabEvictionMarks: () => void;
|
|
39
51
|
refreshTab: (id: string) => void;
|
|
40
52
|
refreshAllTabs: () => void;
|
|
41
53
|
iframeRefreshKeys: import('vue').Ref<Record<string, number>, Record<string, number>>;
|
package/dist/iframe-bridge.mjs
CHANGED
|
@@ -4,7 +4,7 @@ function n() {
|
|
|
4
4
|
return window.location.origin;
|
|
5
5
|
}
|
|
6
6
|
function r(e, r = {}) {
|
|
7
|
-
typeof window
|
|
7
|
+
typeof window < "u" && window.parent && window.parent.postMessage({
|
|
8
8
|
type: t,
|
|
9
9
|
payload: e
|
|
10
10
|
}, r.targetOrigin ?? n());
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { LocaleMessageOption } from './i18n';
|
|
3
|
+
import { default as StackTab } from './StackTabs.vue';
|
|
4
|
+
import { default as IFrame } from './iframe.vue';
|
|
5
|
+
import { default as useTabLoading } from './hooks/useTabLoading';
|
|
6
|
+
import { default as useTabRouter } from './hooks/useTabRouter';
|
|
7
|
+
import { default as useTabActions } from './hooks/useTabActions';
|
|
8
|
+
import { default as TabHeaderButton } from './components/TabHeader/TabHeaderButton.vue';
|
|
9
|
+
export type VueStackTabsPluginOptions = LocaleMessageOption[];
|
|
10
|
+
export * from './model/TabModel';
|
|
11
|
+
declare module '@vue/runtime-core' {
|
|
12
|
+
interface GlobalComponents {
|
|
13
|
+
VueStackTabs: typeof StackTab;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export { IFrame, useTabActions, useTabLoading, useTabRouter, TabHeaderButton, StackTab, StackTab as VueStackTabs };
|
|
17
|
+
export { postOpenTab, onRefreshRequest, MSG_REFRESH, MSG_OPEN_TAB } from './utils/iframeBridge';
|
|
18
|
+
export type { IframeOpenTabPayload } from './utils/iframeBridge';
|
|
19
|
+
declare const _default: {
|
|
20
|
+
install(Vue: App, options?: VueStackTabsPluginOptions): void;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
@@ -88,6 +88,27 @@ export declare class Stack<T> {
|
|
|
88
88
|
clear(): void;
|
|
89
89
|
list(): T[];
|
|
90
90
|
readonlyList(): readonly T[];
|
|
91
|
+
/**
|
|
92
|
+
* 查找首个匹配的元素。
|
|
93
|
+
* @returns 匹配的元素,未找到返回 undefined。
|
|
94
|
+
*/
|
|
95
|
+
find(predicate: (element: T, index: number) => boolean): T | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* 查找首个匹配元素的索引,未找到返回 -1。
|
|
98
|
+
*/
|
|
99
|
+
findIndex(predicate: (element: T, index: number) => boolean): number;
|
|
100
|
+
/**
|
|
101
|
+
* 返回所有匹配元素组成的浅拷贝数组。
|
|
102
|
+
*/
|
|
103
|
+
filter(predicate: (element: T, index: number) => boolean): T[];
|
|
104
|
+
/**
|
|
105
|
+
* 是否存在任意匹配元素。
|
|
106
|
+
*/
|
|
107
|
+
some(predicate: (element: T, index: number) => boolean): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* 从顶到底反向遍历每个元素,便于实现「从栈顶开始找」等场景。
|
|
110
|
+
*/
|
|
111
|
+
forEachTopDown(visit: (element: T, index: number) => void): void;
|
|
91
112
|
toJSON(): T[];
|
|
92
113
|
toString(): string;
|
|
93
114
|
}
|
package/dist/nuxt/module.mjs
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addComponent as e, addImports as t, addPlugin as n, createResolver as r, defineNuxtModule as i } from "nuxt/kit";
|
|
2
2
|
//#region src/lib/nuxt/module.ts
|
|
3
|
-
var
|
|
3
|
+
var a = i({
|
|
4
4
|
meta: {
|
|
5
5
|
name: "vue-stack-tabs",
|
|
6
6
|
configKey: "vueStackTabs"
|
|
7
7
|
},
|
|
8
8
|
defaults: { locale: "zh-CN" },
|
|
9
|
-
setup(
|
|
10
|
-
let { resolve:
|
|
11
|
-
|
|
9
|
+
setup(i, a) {
|
|
10
|
+
let { resolve: o } = r(import.meta.url);
|
|
11
|
+
a.options.runtimeConfig.public.vueStackTabs = { locale: i.locale }, n({ src: o("./runtime/plugin") }), e({
|
|
12
|
+
name: "VueStackTabs",
|
|
13
|
+
export: "VueStackTabs",
|
|
14
|
+
filePath: o("../index.ts")
|
|
15
|
+
}), t([
|
|
12
16
|
{
|
|
13
17
|
name: "useTabActions",
|
|
14
18
|
from: "vue-stack-tabs"
|
|
@@ -25,4 +29,4 @@ var i = r({
|
|
|
25
29
|
}
|
|
26
30
|
});
|
|
27
31
|
//#endregion
|
|
28
|
-
export {
|
|
32
|
+
export { a as default };
|