@kine-design/core 0.0.1-beta.11 → 0.0.1-beta.13
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/components/base/image/__tests__/useImage.test.ts +61 -0
- package/components/base/image/api.ts +2 -2
- package/components/base/image/index.ts +2 -2
- package/components/base/image/props.d.ts +15 -4
- package/components/base/image/useImage.ts +27 -16
- package/components/base/tooltip/api.ts +3 -2
- package/components/base/tooltip/index.ts +3 -2
- package/components/base/tooltip/props.d.ts +12 -6
- package/components/base/tooltip/useTooltip.ts +175 -56
- package/compositions/commandPalette/index.ts +11 -0
- package/compositions/commandPalette/types.ts +29 -0
- package/compositions/commandPalette/useCommandPalette.ts +135 -0
- package/compositions/contextMenu/index.ts +10 -0
- package/compositions/contextMenu/types.ts +21 -0
- package/compositions/contextMenu/useContextMenu.ts +101 -0
- package/compositions/editor/index.ts +18 -0
- package/compositions/editor/types.ts +147 -0
- package/compositions/editor/useEditor.ts +224 -0
- package/compositions/index.ts +15 -0
- package/compositions/overlay/index.ts +14 -0
- package/compositions/overlay/useOverlayStack.ts +146 -0
- package/compositions/peekView/index.ts +10 -0
- package/compositions/peekView/usePeekView.ts +99 -0
- package/compositions/theme/index.ts +17 -0
- package/compositions/theme/presets/compact.ts +117 -0
- package/compositions/theme/presets/dark.ts +113 -0
- package/compositions/theme/presets/index.ts +11 -0
- package/compositions/theme/presets/light.ts +113 -0
- package/compositions/theme/types.ts +46 -0
- package/compositions/theme/useTheme.ts +269 -0
- package/compositions/toast/index.ts +10 -0
- package/compositions/toast/useToast.ts +176 -0
- package/compositions/tooltip/index.ts +9 -0
- package/compositions/tooltip/useTooltip.ts +10 -0
- package/dist/components/base/image/index.d.ts +2 -2
- package/dist/components/base/image/useImage.d.ts +7 -0
- package/dist/components/base/tooltip/index.d.ts +1 -0
- package/dist/components/base/tooltip/useTooltip.d.ts +20 -17
- package/dist/compositions/commandPalette/index.d.ts +11 -0
- package/dist/compositions/commandPalette/types.d.ts +20 -0
- package/dist/compositions/commandPalette/useCommandPalette.d.ts +32 -0
- package/dist/compositions/contextMenu/index.d.ts +10 -0
- package/dist/compositions/contextMenu/types.d.ts +12 -0
- package/dist/compositions/contextMenu/useContextMenu.d.ts +52 -0
- package/dist/compositions/editor/index.d.ts +10 -0
- package/dist/compositions/editor/types.d.ts +132 -0
- package/dist/compositions/editor/useEditor.d.ts +13 -0
- package/dist/compositions/index.d.ts +15 -0
- package/dist/compositions/overlay/index.d.ts +10 -0
- package/dist/compositions/overlay/useOverlayStack.d.ts +188 -0
- package/dist/compositions/peekView/index.d.ts +10 -0
- package/dist/compositions/peekView/usePeekView.d.ts +16 -0
- package/dist/compositions/theme/index.d.ts +11 -0
- package/dist/compositions/theme/presets/compact.d.ts +6 -0
- package/dist/compositions/theme/presets/dark.d.ts +2 -0
- package/dist/compositions/theme/presets/index.d.ts +11 -0
- package/dist/compositions/theme/presets/light.d.ts +2 -0
- package/dist/compositions/theme/types.d.ts +41 -0
- package/dist/compositions/theme/useTheme.d.ts +167 -0
- package/dist/compositions/toast/index.d.ts +10 -0
- package/dist/compositions/toast/useToast.d.ts +71 -0
- package/dist/compositions/tooltip/index.d.ts +9 -0
- package/dist/compositions/tooltip/useTooltip.d.ts +10 -0
- package/dist/core.js +836 -56
- package/dist/index.d.ts +1 -0
- package/index.ts +2 -0
- package/package.json +13 -2
package/dist/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { computed, createVNode, inject, nextTick, onBeforeUnmount, onMounted, onUnmounted, provide, ref, shallowRef, toRef, triggerRef, watch } from "vue";
|
|
1
|
+
import { computed, createVNode, effectScope, getCurrentInstance, getCurrentScope, hasInjectionContext, inject, isReactive, isRef, markRaw, nextTick, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, provide, reactive, ref, shallowRef, toRaw, toRef, toRefs, triggerRef, watch } from "vue";
|
|
2
2
|
import * as _interactjsModule from "interactjs";
|
|
3
|
-
import { arrow, autoUpdate, computePosition } from "@floating-ui/dom";
|
|
3
|
+
import { arrow, autoUpdate, computePosition, flip, offset, shift } from "@floating-ui/dom";
|
|
4
4
|
import dayjs from "dayjs";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region components/base/avatar/index.ts
|
|
@@ -1895,6 +1895,10 @@ var props$36 = {
|
|
|
1895
1895
|
type: String,
|
|
1896
1896
|
default: "top"
|
|
1897
1897
|
},
|
|
1898
|
+
delay: {
|
|
1899
|
+
type: Number,
|
|
1900
|
+
default: 300
|
|
1901
|
+
},
|
|
1898
1902
|
disabled: {
|
|
1899
1903
|
type: Boolean,
|
|
1900
1904
|
default: false
|
|
@@ -1907,78 +1911,158 @@ var props$36 = {
|
|
|
1907
1911
|
//#endregion
|
|
1908
1912
|
//#region components/base/tooltip/useTooltip.ts
|
|
1909
1913
|
/**
|
|
1910
|
-
* @description tooltip composable
|
|
1914
|
+
* @description tooltip composable — manages show/hide with delay, positioning via usePopper, singleton, scroll/interaction dismissal
|
|
1911
1915
|
* @author 阿怪
|
|
1912
1916
|
* @date 2026/2/25
|
|
1913
|
-
* @version
|
|
1917
|
+
* @version v2.0.0
|
|
1914
1918
|
*
|
|
1915
1919
|
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
1916
1920
|
*/
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
function calcPosition(rect, tooltipEl, placement) {
|
|
1921
|
-
const gap = 8;
|
|
1922
|
-
const tooltipRect = tooltipEl.getBoundingClientRect();
|
|
1923
|
-
let left = 0;
|
|
1924
|
-
let top = 0;
|
|
1925
|
-
switch (placement) {
|
|
1926
|
-
case "top":
|
|
1927
|
-
left = rect.left + rect.width / 2 - tooltipRect.width / 2;
|
|
1928
|
-
top = rect.top - tooltipRect.height - gap;
|
|
1929
|
-
break;
|
|
1930
|
-
case "bottom":
|
|
1931
|
-
left = rect.left + rect.width / 2 - tooltipRect.width / 2;
|
|
1932
|
-
top = rect.bottom + gap;
|
|
1933
|
-
break;
|
|
1934
|
-
case "left":
|
|
1935
|
-
left = rect.left - tooltipRect.width - gap;
|
|
1936
|
-
top = rect.top + rect.height / 2 - tooltipRect.height / 2;
|
|
1937
|
-
break;
|
|
1938
|
-
case "right":
|
|
1939
|
-
left = rect.right + gap;
|
|
1940
|
-
top = rect.top + rect.height / 2 - tooltipRect.height / 2;
|
|
1941
|
-
break;
|
|
1942
|
-
}
|
|
1943
|
-
return {
|
|
1944
|
-
position: "fixed",
|
|
1945
|
-
left: `${left}px`,
|
|
1946
|
-
top: `${top}px`,
|
|
1947
|
-
zIndex: "9999"
|
|
1948
|
-
};
|
|
1949
|
-
}
|
|
1921
|
+
var HIDE_DELAY = 100;
|
|
1922
|
+
/** Singleton: only one tooltip visible at a time */
|
|
1923
|
+
var activeHide = null;
|
|
1950
1924
|
function useTooltip(props) {
|
|
1951
1925
|
const visible = ref(false);
|
|
1952
|
-
const
|
|
1926
|
+
const positionData = ref(null);
|
|
1953
1927
|
const triggerRef = ref(null);
|
|
1954
1928
|
const tooltipRef = ref(null);
|
|
1955
|
-
const
|
|
1929
|
+
const arrowRef = ref(null);
|
|
1930
|
+
let showTimer = null;
|
|
1931
|
+
let hideTimer = null;
|
|
1932
|
+
let popperCleanup = null;
|
|
1933
|
+
const tooltipId = `k-tooltip-${Math.random().toString(36).slice(2, 10)}`;
|
|
1934
|
+
/** Clean up popper auto-update subscription */
|
|
1935
|
+
const destroyPopper = () => {
|
|
1936
|
+
if (popperCleanup) {
|
|
1937
|
+
popperCleanup();
|
|
1938
|
+
popperCleanup = null;
|
|
1939
|
+
}
|
|
1940
|
+
};
|
|
1941
|
+
/** Immediately hide — no delay */
|
|
1942
|
+
const hideImmediate = () => {
|
|
1943
|
+
clearTimers();
|
|
1944
|
+
visible.value = false;
|
|
1945
|
+
positionData.value = null;
|
|
1946
|
+
destroyPopper();
|
|
1947
|
+
if (activeHide === hideImmediate) activeHide = null;
|
|
1948
|
+
removeInteractionListeners();
|
|
1949
|
+
removeScrollListeners();
|
|
1950
|
+
};
|
|
1951
|
+
/** Show tooltip after delay */
|
|
1952
|
+
const show = () => {
|
|
1956
1953
|
if (props.disabled) return;
|
|
1954
|
+
if (activeHide && activeHide !== hideImmediate) activeHide();
|
|
1955
|
+
if (hideTimer) {
|
|
1956
|
+
clearTimeout(hideTimer);
|
|
1957
|
+
hideTimer = null;
|
|
1958
|
+
}
|
|
1959
|
+
if (visible.value) return;
|
|
1960
|
+
const delay = props.delay ?? 300;
|
|
1961
|
+
showTimer = setTimeout(() => {
|
|
1962
|
+
showTimer = null;
|
|
1963
|
+
if (props.disabled) return;
|
|
1964
|
+
doShow();
|
|
1965
|
+
}, delay);
|
|
1966
|
+
};
|
|
1967
|
+
/** Actually display the tooltip and set up popper */
|
|
1968
|
+
const doShow = () => {
|
|
1957
1969
|
visible.value = true;
|
|
1958
|
-
|
|
1970
|
+
activeHide = hideImmediate;
|
|
1971
|
+
addInteractionListeners();
|
|
1972
|
+
addScrollListeners();
|
|
1973
|
+
};
|
|
1974
|
+
/** Initialize popper positioning — called after tooltip DOM is mounted */
|
|
1975
|
+
const initPopper = () => {
|
|
1959
1976
|
if (!triggerRef.value || !tooltipRef.value) return;
|
|
1960
|
-
|
|
1977
|
+
destroyPopper();
|
|
1978
|
+
const { clear } = usePopper(triggerRef.value, tooltipRef.value, (data) => {
|
|
1979
|
+
positionData.value = {
|
|
1980
|
+
style: { ...data.style },
|
|
1981
|
+
arrowStyle: { ...data.arrowStyle },
|
|
1982
|
+
placement: data.placement
|
|
1983
|
+
};
|
|
1984
|
+
}, arrowRef.value ?? void 0, {
|
|
1985
|
+
placement: props.placement,
|
|
1986
|
+
middleware: [
|
|
1987
|
+
offset(8),
|
|
1988
|
+
flip(),
|
|
1989
|
+
shift({ padding: 8 })
|
|
1990
|
+
]
|
|
1991
|
+
});
|
|
1992
|
+
popperCleanup = clear;
|
|
1961
1993
|
};
|
|
1994
|
+
/** Hide tooltip with a short delay (allows cursor to move between trigger and tooltip) */
|
|
1962
1995
|
const hide = () => {
|
|
1963
|
-
|
|
1964
|
-
|
|
1996
|
+
if (showTimer) {
|
|
1997
|
+
clearTimeout(showTimer);
|
|
1998
|
+
showTimer = null;
|
|
1999
|
+
}
|
|
2000
|
+
if (!visible.value) return;
|
|
2001
|
+
hideTimer = setTimeout(() => {
|
|
2002
|
+
hideTimer = null;
|
|
2003
|
+
hideImmediate();
|
|
2004
|
+
}, HIDE_DELAY);
|
|
2005
|
+
};
|
|
2006
|
+
const clearTimers = () => {
|
|
2007
|
+
if (showTimer) {
|
|
2008
|
+
clearTimeout(showTimer);
|
|
2009
|
+
showTimer = null;
|
|
2010
|
+
}
|
|
2011
|
+
if (hideTimer) {
|
|
2012
|
+
clearTimeout(hideTimer);
|
|
2013
|
+
hideTimer = null;
|
|
2014
|
+
}
|
|
2015
|
+
};
|
|
2016
|
+
const onInteraction = () => {
|
|
2017
|
+
hideImmediate();
|
|
1965
2018
|
};
|
|
2019
|
+
const addInteractionListeners = () => {
|
|
2020
|
+
document.addEventListener("mousedown", onInteraction, true);
|
|
2021
|
+
document.addEventListener("keydown", onInteraction, true);
|
|
2022
|
+
};
|
|
2023
|
+
const removeInteractionListeners = () => {
|
|
2024
|
+
document.removeEventListener("mousedown", onInteraction, true);
|
|
2025
|
+
document.removeEventListener("keydown", onInteraction, true);
|
|
2026
|
+
};
|
|
2027
|
+
const onScroll = () => {
|
|
2028
|
+
if (!triggerRef.value) {
|
|
2029
|
+
hideImmediate();
|
|
2030
|
+
return;
|
|
2031
|
+
}
|
|
2032
|
+
const rect = triggerRef.value.getBoundingClientRect();
|
|
2033
|
+
if (!(rect.bottom > 0 && rect.top < window.innerHeight && rect.right > 0 && rect.left < window.innerWidth)) hideImmediate();
|
|
2034
|
+
};
|
|
2035
|
+
const addScrollListeners = () => {
|
|
2036
|
+
window.addEventListener("scroll", onScroll, true);
|
|
2037
|
+
window.addEventListener("resize", onScroll, true);
|
|
2038
|
+
};
|
|
2039
|
+
const removeScrollListeners = () => {
|
|
2040
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
2041
|
+
window.removeEventListener("resize", onScroll, true);
|
|
2042
|
+
};
|
|
2043
|
+
onBeforeUnmount(() => {
|
|
2044
|
+
hideImmediate();
|
|
2045
|
+
});
|
|
1966
2046
|
return {
|
|
1967
2047
|
visible,
|
|
1968
|
-
|
|
2048
|
+
positionData,
|
|
1969
2049
|
triggerRef,
|
|
1970
2050
|
tooltipRef,
|
|
2051
|
+
arrowRef,
|
|
2052
|
+
tooltipId,
|
|
1971
2053
|
show,
|
|
1972
|
-
hide
|
|
2054
|
+
hide,
|
|
2055
|
+
hideImmediate,
|
|
2056
|
+
initPopper
|
|
1973
2057
|
};
|
|
1974
2058
|
}
|
|
1975
2059
|
//#endregion
|
|
1976
2060
|
//#region components/base/tooltip/index.ts
|
|
1977
2061
|
/**
|
|
1978
|
-
* @description tooltip core
|
|
2062
|
+
* @description tooltip core barrel export
|
|
1979
2063
|
* @author 阿怪
|
|
1980
2064
|
* @date 2026/2/25
|
|
1981
|
-
* @version
|
|
2065
|
+
* @version v2.0.0
|
|
1982
2066
|
*
|
|
1983
2067
|
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
1984
2068
|
*/
|
|
@@ -5305,13 +5389,34 @@ var props$8 = {
|
|
|
5305
5389
|
*
|
|
5306
5390
|
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
5307
5391
|
*/
|
|
5392
|
+
function normalizeItem(item) {
|
|
5393
|
+
if (typeof item === "string") return {
|
|
5394
|
+
src: item,
|
|
5395
|
+
type: "image"
|
|
5396
|
+
};
|
|
5397
|
+
return {
|
|
5398
|
+
src: item.src,
|
|
5399
|
+
type: item.type ?? "image"
|
|
5400
|
+
};
|
|
5401
|
+
}
|
|
5402
|
+
function getSrc(item) {
|
|
5403
|
+
return typeof item === "string" ? item : item.src;
|
|
5404
|
+
}
|
|
5308
5405
|
function useImage(props, emit) {
|
|
5309
5406
|
const status = ref("loading");
|
|
5310
5407
|
const previewVisible = ref(false);
|
|
5311
5408
|
const previewIndex = ref(0);
|
|
5312
5409
|
const previewScale = ref(1);
|
|
5313
5410
|
const previewRotate = ref(0);
|
|
5314
|
-
|
|
5411
|
+
const currentPreviewItem = computed(() => {
|
|
5412
|
+
const list = props.previewSrcList;
|
|
5413
|
+
if (!list || list.length === 0) return {
|
|
5414
|
+
src: "",
|
|
5415
|
+
type: "image"
|
|
5416
|
+
};
|
|
5417
|
+
return normalizeItem(list[previewIndex.value] ?? list[0]);
|
|
5418
|
+
});
|
|
5419
|
+
const currentPreviewIsVideo = computed(() => currentPreviewItem.value.type === "video");
|
|
5315
5420
|
const reset = () => {
|
|
5316
5421
|
status.value = "loading";
|
|
5317
5422
|
};
|
|
@@ -5323,10 +5428,9 @@ function useImage(props, emit) {
|
|
|
5323
5428
|
status.value = "error";
|
|
5324
5429
|
emit("error", e);
|
|
5325
5430
|
};
|
|
5326
|
-
/** 打开全屏预览,定位到 src 在 previewSrcList 中的位置 */
|
|
5327
5431
|
const openPreview = () => {
|
|
5328
5432
|
if (!props.previewSrcList || props.previewSrcList.length === 0) return;
|
|
5329
|
-
const idx = props.previewSrcList.
|
|
5433
|
+
const idx = props.previewSrcList.findIndex((item) => getSrc(item) === props.src);
|
|
5330
5434
|
previewIndex.value = idx >= 0 ? idx : 0;
|
|
5331
5435
|
previewScale.value = 1;
|
|
5332
5436
|
previewRotate.value = 0;
|
|
@@ -5335,7 +5439,6 @@ function useImage(props, emit) {
|
|
|
5335
5439
|
const closePreview = () => {
|
|
5336
5440
|
previewVisible.value = false;
|
|
5337
5441
|
};
|
|
5338
|
-
/** 预览切换到上一张 */
|
|
5339
5442
|
const previewPrev = () => {
|
|
5340
5443
|
const total = props.previewSrcList.length;
|
|
5341
5444
|
if (total === 0) return;
|
|
@@ -5344,7 +5447,6 @@ function useImage(props, emit) {
|
|
|
5344
5447
|
previewRotate.value = 0;
|
|
5345
5448
|
emit("switch", previewIndex.value);
|
|
5346
5449
|
};
|
|
5347
|
-
/** 预览切换到下一张 */
|
|
5348
5450
|
const previewNext = () => {
|
|
5349
5451
|
const total = props.previewSrcList.length;
|
|
5350
5452
|
if (total === 0) return;
|
|
@@ -5353,15 +5455,12 @@ function useImage(props, emit) {
|
|
|
5353
5455
|
previewRotate.value = 0;
|
|
5354
5456
|
emit("switch", previewIndex.value);
|
|
5355
5457
|
};
|
|
5356
|
-
/** 预览放大 */
|
|
5357
5458
|
const zoomIn = () => {
|
|
5358
5459
|
previewScale.value = Math.min(previewScale.value + .25, 5);
|
|
5359
5460
|
};
|
|
5360
|
-
/** 预览缩小 */
|
|
5361
5461
|
const zoomOut = () => {
|
|
5362
5462
|
previewScale.value = Math.max(previewScale.value - .25, .25);
|
|
5363
5463
|
};
|
|
5364
|
-
/** 顺时针旋转 90° */
|
|
5365
5464
|
const rotate = () => {
|
|
5366
5465
|
previewRotate.value = (previewRotate.value + 90) % 360;
|
|
5367
5466
|
};
|
|
@@ -5375,6 +5474,8 @@ function useImage(props, emit) {
|
|
|
5375
5474
|
previewIndex,
|
|
5376
5475
|
previewScale,
|
|
5377
5476
|
previewRotate,
|
|
5477
|
+
currentPreviewItem,
|
|
5478
|
+
currentPreviewIsVideo,
|
|
5378
5479
|
handleLoad,
|
|
5379
5480
|
handleError,
|
|
5380
5481
|
openPreview,
|
|
@@ -6320,6 +6421,685 @@ var AnchorCore = {
|
|
|
6320
6421
|
useAnchor
|
|
6321
6422
|
};
|
|
6322
6423
|
//#endregion
|
|
6424
|
+
//#region ../../node_modules/.pnpm/pinia@3.0.4_typescript@5.9.3_vue@3.5.30_typescript@5.9.3_/node_modules/pinia/dist/pinia.mjs
|
|
6425
|
+
/*!
|
|
6426
|
+
* pinia v3.0.4
|
|
6427
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
6428
|
+
* @license MIT
|
|
6429
|
+
*/
|
|
6430
|
+
var IS_CLIENT = typeof window !== "undefined";
|
|
6431
|
+
/**
|
|
6432
|
+
* setActivePinia must be called to handle SSR at the top of functions like
|
|
6433
|
+
* `fetch`, `setup`, `serverPrefetch` and others
|
|
6434
|
+
*/
|
|
6435
|
+
var activePinia;
|
|
6436
|
+
/**
|
|
6437
|
+
* Sets or unsets the active pinia. Used in SSR and internally when calling
|
|
6438
|
+
* actions and getters
|
|
6439
|
+
*
|
|
6440
|
+
* @param pinia - Pinia instance
|
|
6441
|
+
*/
|
|
6442
|
+
var setActivePinia = (pinia) => activePinia = pinia;
|
|
6443
|
+
process.env.NODE_ENV;
|
|
6444
|
+
var piniaSymbol = process.env.NODE_ENV !== "production" ? Symbol("pinia") : Symbol();
|
|
6445
|
+
function isPlainObject(o) {
|
|
6446
|
+
return o && typeof o === "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON !== "function";
|
|
6447
|
+
}
|
|
6448
|
+
/**
|
|
6449
|
+
* Possible types for SubscriptionCallback
|
|
6450
|
+
*/
|
|
6451
|
+
var MutationType;
|
|
6452
|
+
(function(MutationType) {
|
|
6453
|
+
/**
|
|
6454
|
+
* Direct mutation of the state:
|
|
6455
|
+
*
|
|
6456
|
+
* - `store.name = 'new name'`
|
|
6457
|
+
* - `store.$state.name = 'new name'`
|
|
6458
|
+
* - `store.list.push('new item')`
|
|
6459
|
+
*/
|
|
6460
|
+
MutationType["direct"] = "direct";
|
|
6461
|
+
/**
|
|
6462
|
+
* Mutated the state with `$patch` and an object
|
|
6463
|
+
*
|
|
6464
|
+
* - `store.$patch({ name: 'newName' })`
|
|
6465
|
+
*/
|
|
6466
|
+
MutationType["patchObject"] = "patch object";
|
|
6467
|
+
/**
|
|
6468
|
+
* Mutated the state with `$patch` and a function
|
|
6469
|
+
*
|
|
6470
|
+
* - `store.$patch(state => state.name = 'newName')`
|
|
6471
|
+
*/
|
|
6472
|
+
MutationType["patchFunction"] = "patch function";
|
|
6473
|
+
})(MutationType || (MutationType = {}));
|
|
6474
|
+
var _global = typeof window === "object" && window.window === window ? window : typeof self === "object" && self.self === self ? self : typeof global === "object" && global.global === global ? global : typeof globalThis === "object" ? globalThis : { HTMLElement: null };
|
|
6475
|
+
function bom(blob, { autoBom = false } = {}) {
|
|
6476
|
+
if (autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) return new Blob([String.fromCharCode(65279), blob], { type: blob.type });
|
|
6477
|
+
return blob;
|
|
6478
|
+
}
|
|
6479
|
+
function download(url, name, opts) {
|
|
6480
|
+
const xhr = new XMLHttpRequest();
|
|
6481
|
+
xhr.open("GET", url);
|
|
6482
|
+
xhr.responseType = "blob";
|
|
6483
|
+
xhr.onload = function() {
|
|
6484
|
+
saveAs(xhr.response, name, opts);
|
|
6485
|
+
};
|
|
6486
|
+
xhr.onerror = function() {
|
|
6487
|
+
console.error("could not download file");
|
|
6488
|
+
};
|
|
6489
|
+
xhr.send();
|
|
6490
|
+
}
|
|
6491
|
+
function corsEnabled(url) {
|
|
6492
|
+
const xhr = new XMLHttpRequest();
|
|
6493
|
+
xhr.open("HEAD", url, false);
|
|
6494
|
+
try {
|
|
6495
|
+
xhr.send();
|
|
6496
|
+
} catch (e) {}
|
|
6497
|
+
return xhr.status >= 200 && xhr.status <= 299;
|
|
6498
|
+
}
|
|
6499
|
+
function click(node) {
|
|
6500
|
+
try {
|
|
6501
|
+
node.dispatchEvent(new MouseEvent("click"));
|
|
6502
|
+
} catch (e) {
|
|
6503
|
+
const evt = new MouseEvent("click", {
|
|
6504
|
+
bubbles: true,
|
|
6505
|
+
cancelable: true,
|
|
6506
|
+
view: window,
|
|
6507
|
+
detail: 0,
|
|
6508
|
+
screenX: 80,
|
|
6509
|
+
screenY: 20,
|
|
6510
|
+
clientX: 80,
|
|
6511
|
+
clientY: 20,
|
|
6512
|
+
ctrlKey: false,
|
|
6513
|
+
altKey: false,
|
|
6514
|
+
shiftKey: false,
|
|
6515
|
+
metaKey: false,
|
|
6516
|
+
button: 0,
|
|
6517
|
+
relatedTarget: null
|
|
6518
|
+
});
|
|
6519
|
+
node.dispatchEvent(evt);
|
|
6520
|
+
}
|
|
6521
|
+
}
|
|
6522
|
+
var _navigator = typeof navigator === "object" ? navigator : { userAgent: "" };
|
|
6523
|
+
var isMacOSWebView = /Macintosh/.test(_navigator.userAgent) && /AppleWebKit/.test(_navigator.userAgent) && !/Safari/.test(_navigator.userAgent);
|
|
6524
|
+
var saveAs = !IS_CLIENT ? () => {} : typeof HTMLAnchorElement !== "undefined" && "download" in HTMLAnchorElement.prototype && !isMacOSWebView ? downloadSaveAs : "msSaveOrOpenBlob" in _navigator ? msSaveAs : fileSaverSaveAs;
|
|
6525
|
+
function downloadSaveAs(blob, name = "download", opts) {
|
|
6526
|
+
const a = document.createElement("a");
|
|
6527
|
+
a.download = name;
|
|
6528
|
+
a.rel = "noopener";
|
|
6529
|
+
if (typeof blob === "string") {
|
|
6530
|
+
a.href = blob;
|
|
6531
|
+
if (a.origin !== location.origin) if (corsEnabled(a.href)) download(blob, name, opts);
|
|
6532
|
+
else {
|
|
6533
|
+
a.target = "_blank";
|
|
6534
|
+
click(a);
|
|
6535
|
+
}
|
|
6536
|
+
else click(a);
|
|
6537
|
+
} else {
|
|
6538
|
+
a.href = URL.createObjectURL(blob);
|
|
6539
|
+
setTimeout(function() {
|
|
6540
|
+
URL.revokeObjectURL(a.href);
|
|
6541
|
+
}, 4e4);
|
|
6542
|
+
setTimeout(function() {
|
|
6543
|
+
click(a);
|
|
6544
|
+
}, 0);
|
|
6545
|
+
}
|
|
6546
|
+
}
|
|
6547
|
+
function msSaveAs(blob, name = "download", opts) {
|
|
6548
|
+
if (typeof blob === "string") if (corsEnabled(blob)) download(blob, name, opts);
|
|
6549
|
+
else {
|
|
6550
|
+
const a = document.createElement("a");
|
|
6551
|
+
a.href = blob;
|
|
6552
|
+
a.target = "_blank";
|
|
6553
|
+
setTimeout(function() {
|
|
6554
|
+
click(a);
|
|
6555
|
+
});
|
|
6556
|
+
}
|
|
6557
|
+
else navigator.msSaveOrOpenBlob(bom(blob, opts), name);
|
|
6558
|
+
}
|
|
6559
|
+
function fileSaverSaveAs(blob, name, opts, popup) {
|
|
6560
|
+
popup = popup || open("", "_blank");
|
|
6561
|
+
if (popup) popup.document.title = popup.document.body.innerText = "downloading...";
|
|
6562
|
+
if (typeof blob === "string") return download(blob, name, opts);
|
|
6563
|
+
const force = blob.type === "application/octet-stream";
|
|
6564
|
+
const isSafari = /constructor/i.test(String(_global.HTMLElement)) || "safari" in _global;
|
|
6565
|
+
const isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent);
|
|
6566
|
+
if ((isChromeIOS || force && isSafari || isMacOSWebView) && typeof FileReader !== "undefined") {
|
|
6567
|
+
const reader = new FileReader();
|
|
6568
|
+
reader.onloadend = function() {
|
|
6569
|
+
let url = reader.result;
|
|
6570
|
+
if (typeof url !== "string") {
|
|
6571
|
+
popup = null;
|
|
6572
|
+
throw new Error("Wrong reader.result type");
|
|
6573
|
+
}
|
|
6574
|
+
url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, "data:attachment/file;");
|
|
6575
|
+
if (popup) popup.location.href = url;
|
|
6576
|
+
else location.assign(url);
|
|
6577
|
+
popup = null;
|
|
6578
|
+
};
|
|
6579
|
+
reader.readAsDataURL(blob);
|
|
6580
|
+
} else {
|
|
6581
|
+
const url = URL.createObjectURL(blob);
|
|
6582
|
+
if (popup) popup.location.assign(url);
|
|
6583
|
+
else location.href = url;
|
|
6584
|
+
popup = null;
|
|
6585
|
+
setTimeout(function() {
|
|
6586
|
+
URL.revokeObjectURL(url);
|
|
6587
|
+
}, 4e4);
|
|
6588
|
+
}
|
|
6589
|
+
}
|
|
6590
|
+
var { assign: assign$1 } = Object;
|
|
6591
|
+
/**
|
|
6592
|
+
* Mutates in place `newState` with `oldState` to _hot update_ it. It will
|
|
6593
|
+
* remove any key not existing in `newState` and recursively merge plain
|
|
6594
|
+
* objects.
|
|
6595
|
+
*
|
|
6596
|
+
* @param newState - new state object to be patched
|
|
6597
|
+
* @param oldState - old state that should be used to patch newState
|
|
6598
|
+
* @returns - newState
|
|
6599
|
+
*/
|
|
6600
|
+
function patchObject(newState, oldState) {
|
|
6601
|
+
for (const key in oldState) {
|
|
6602
|
+
const subPatch = oldState[key];
|
|
6603
|
+
if (!(key in newState)) continue;
|
|
6604
|
+
const targetValue = newState[key];
|
|
6605
|
+
if (isPlainObject(targetValue) && isPlainObject(subPatch) && !isRef(subPatch) && !isReactive(subPatch)) newState[key] = patchObject(targetValue, subPatch);
|
|
6606
|
+
else newState[key] = subPatch;
|
|
6607
|
+
}
|
|
6608
|
+
return newState;
|
|
6609
|
+
}
|
|
6610
|
+
var noop = () => {};
|
|
6611
|
+
function addSubscription(subscriptions, callback, detached, onCleanup = noop) {
|
|
6612
|
+
subscriptions.add(callback);
|
|
6613
|
+
const removeSubscription = () => {
|
|
6614
|
+
subscriptions.delete(callback) && onCleanup();
|
|
6615
|
+
};
|
|
6616
|
+
if (!detached && getCurrentScope()) onScopeDispose(removeSubscription);
|
|
6617
|
+
return removeSubscription;
|
|
6618
|
+
}
|
|
6619
|
+
function triggerSubscriptions(subscriptions, ...args) {
|
|
6620
|
+
subscriptions.forEach((callback) => {
|
|
6621
|
+
callback(...args);
|
|
6622
|
+
});
|
|
6623
|
+
}
|
|
6624
|
+
var fallbackRunWithContext = (fn) => fn();
|
|
6625
|
+
/**
|
|
6626
|
+
* Marks a function as an action for `$onAction`
|
|
6627
|
+
* @internal
|
|
6628
|
+
*/
|
|
6629
|
+
var ACTION_MARKER = Symbol();
|
|
6630
|
+
/**
|
|
6631
|
+
* Action name symbol. Allows to add a name to an action after defining it
|
|
6632
|
+
* @internal
|
|
6633
|
+
*/
|
|
6634
|
+
var ACTION_NAME = Symbol();
|
|
6635
|
+
function mergeReactiveObjects(target, patchToApply) {
|
|
6636
|
+
if (target instanceof Map && patchToApply instanceof Map) patchToApply.forEach((value, key) => target.set(key, value));
|
|
6637
|
+
else if (target instanceof Set && patchToApply instanceof Set) patchToApply.forEach(target.add, target);
|
|
6638
|
+
for (const key in patchToApply) {
|
|
6639
|
+
if (!patchToApply.hasOwnProperty(key)) continue;
|
|
6640
|
+
const subPatch = patchToApply[key];
|
|
6641
|
+
const targetValue = target[key];
|
|
6642
|
+
if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !isRef(subPatch) && !isReactive(subPatch)) target[key] = mergeReactiveObjects(targetValue, subPatch);
|
|
6643
|
+
else target[key] = subPatch;
|
|
6644
|
+
}
|
|
6645
|
+
return target;
|
|
6646
|
+
}
|
|
6647
|
+
var skipHydrateSymbol = process.env.NODE_ENV !== "production" ? Symbol("pinia:skipHydration") : Symbol();
|
|
6648
|
+
/**
|
|
6649
|
+
* Returns whether a value should be hydrated
|
|
6650
|
+
*
|
|
6651
|
+
* @param obj - target variable
|
|
6652
|
+
* @returns true if `obj` should be hydrated
|
|
6653
|
+
*/
|
|
6654
|
+
function shouldHydrate(obj) {
|
|
6655
|
+
return !isPlainObject(obj) || !Object.prototype.hasOwnProperty.call(obj, skipHydrateSymbol);
|
|
6656
|
+
}
|
|
6657
|
+
var { assign } = Object;
|
|
6658
|
+
function isComputed(o) {
|
|
6659
|
+
return !!(isRef(o) && o.effect);
|
|
6660
|
+
}
|
|
6661
|
+
function createOptionsStore(id, options, pinia, hot) {
|
|
6662
|
+
const { state, actions, getters } = options;
|
|
6663
|
+
const initialState = pinia.state.value[id];
|
|
6664
|
+
let store;
|
|
6665
|
+
function setup() {
|
|
6666
|
+
if (!initialState && (!(process.env.NODE_ENV !== "production") || !hot))
|
|
6667
|
+
/* istanbul ignore if */
|
|
6668
|
+
pinia.state.value[id] = state ? state() : {};
|
|
6669
|
+
const localState = process.env.NODE_ENV !== "production" && hot ? toRefs(ref(state ? state() : {}).value) : toRefs(pinia.state.value[id]);
|
|
6670
|
+
return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {
|
|
6671
|
+
if (process.env.NODE_ENV !== "production" && name in localState) console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${name}" in store "${id}".`);
|
|
6672
|
+
computedGetters[name] = markRaw(computed(() => {
|
|
6673
|
+
setActivePinia(pinia);
|
|
6674
|
+
const store = pinia._s.get(id);
|
|
6675
|
+
return getters[name].call(store, store);
|
|
6676
|
+
}));
|
|
6677
|
+
return computedGetters;
|
|
6678
|
+
}, {}));
|
|
6679
|
+
}
|
|
6680
|
+
store = createSetupStore(id, setup, options, pinia, hot, true);
|
|
6681
|
+
return store;
|
|
6682
|
+
}
|
|
6683
|
+
function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
|
|
6684
|
+
let scope;
|
|
6685
|
+
const optionsForPlugin = assign({ actions: {} }, options);
|
|
6686
|
+
/* istanbul ignore if */
|
|
6687
|
+
if (process.env.NODE_ENV !== "production" && !pinia._e.active) throw new Error("Pinia destroyed");
|
|
6688
|
+
const $subscribeOptions = { deep: true };
|
|
6689
|
+
/* istanbul ignore else */
|
|
6690
|
+
if (process.env.NODE_ENV !== "production") $subscribeOptions.onTrigger = (event) => {
|
|
6691
|
+
/* istanbul ignore else */
|
|
6692
|
+
if (isListening) debuggerEvents = event;
|
|
6693
|
+
else if (isListening == false && !store._hotUpdating)
|
|
6694
|
+
/* istanbul ignore else */
|
|
6695
|
+
if (Array.isArray(debuggerEvents)) debuggerEvents.push(event);
|
|
6696
|
+
else console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.");
|
|
6697
|
+
};
|
|
6698
|
+
let isListening;
|
|
6699
|
+
let isSyncListening;
|
|
6700
|
+
let subscriptions = /* @__PURE__ */ new Set();
|
|
6701
|
+
let actionSubscriptions = /* @__PURE__ */ new Set();
|
|
6702
|
+
let debuggerEvents;
|
|
6703
|
+
const initialState = pinia.state.value[$id];
|
|
6704
|
+
if (!isOptionsStore && !initialState && (!(process.env.NODE_ENV !== "production") || !hot))
|
|
6705
|
+
/* istanbul ignore if */
|
|
6706
|
+
pinia.state.value[$id] = {};
|
|
6707
|
+
const hotState = ref({});
|
|
6708
|
+
let activeListener;
|
|
6709
|
+
function $patch(partialStateOrMutator) {
|
|
6710
|
+
let subscriptionMutation;
|
|
6711
|
+
isListening = isSyncListening = false;
|
|
6712
|
+
/* istanbul ignore else */
|
|
6713
|
+
if (process.env.NODE_ENV !== "production") debuggerEvents = [];
|
|
6714
|
+
if (typeof partialStateOrMutator === "function") {
|
|
6715
|
+
partialStateOrMutator(pinia.state.value[$id]);
|
|
6716
|
+
subscriptionMutation = {
|
|
6717
|
+
type: MutationType.patchFunction,
|
|
6718
|
+
storeId: $id,
|
|
6719
|
+
events: debuggerEvents
|
|
6720
|
+
};
|
|
6721
|
+
} else {
|
|
6722
|
+
mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
|
|
6723
|
+
subscriptionMutation = {
|
|
6724
|
+
type: MutationType.patchObject,
|
|
6725
|
+
payload: partialStateOrMutator,
|
|
6726
|
+
storeId: $id,
|
|
6727
|
+
events: debuggerEvents
|
|
6728
|
+
};
|
|
6729
|
+
}
|
|
6730
|
+
const myListenerId = activeListener = Symbol();
|
|
6731
|
+
nextTick().then(() => {
|
|
6732
|
+
if (activeListener === myListenerId) isListening = true;
|
|
6733
|
+
});
|
|
6734
|
+
isSyncListening = true;
|
|
6735
|
+
triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
|
|
6736
|
+
}
|
|
6737
|
+
const $reset = isOptionsStore ? function $reset() {
|
|
6738
|
+
const { state } = options;
|
|
6739
|
+
const newState = state ? state() : {};
|
|
6740
|
+
this.$patch(($state) => {
|
|
6741
|
+
assign($state, newState);
|
|
6742
|
+
});
|
|
6743
|
+
} : process.env.NODE_ENV !== "production" ? () => {
|
|
6744
|
+
throw new Error(`🍍: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
|
|
6745
|
+
} : noop;
|
|
6746
|
+
function $dispose() {
|
|
6747
|
+
scope.stop();
|
|
6748
|
+
subscriptions.clear();
|
|
6749
|
+
actionSubscriptions.clear();
|
|
6750
|
+
pinia._s.delete($id);
|
|
6751
|
+
}
|
|
6752
|
+
/**
|
|
6753
|
+
* Helper that wraps function so it can be tracked with $onAction
|
|
6754
|
+
* @param fn - action to wrap
|
|
6755
|
+
* @param name - name of the action
|
|
6756
|
+
*/
|
|
6757
|
+
const action = (fn, name = "") => {
|
|
6758
|
+
if (ACTION_MARKER in fn) {
|
|
6759
|
+
fn[ACTION_NAME] = name;
|
|
6760
|
+
return fn;
|
|
6761
|
+
}
|
|
6762
|
+
const wrappedAction = function() {
|
|
6763
|
+
setActivePinia(pinia);
|
|
6764
|
+
const args = Array.from(arguments);
|
|
6765
|
+
const afterCallbackSet = /* @__PURE__ */ new Set();
|
|
6766
|
+
const onErrorCallbackSet = /* @__PURE__ */ new Set();
|
|
6767
|
+
function after(callback) {
|
|
6768
|
+
afterCallbackSet.add(callback);
|
|
6769
|
+
}
|
|
6770
|
+
function onError(callback) {
|
|
6771
|
+
onErrorCallbackSet.add(callback);
|
|
6772
|
+
}
|
|
6773
|
+
triggerSubscriptions(actionSubscriptions, {
|
|
6774
|
+
args,
|
|
6775
|
+
name: wrappedAction[ACTION_NAME],
|
|
6776
|
+
store,
|
|
6777
|
+
after,
|
|
6778
|
+
onError
|
|
6779
|
+
});
|
|
6780
|
+
let ret;
|
|
6781
|
+
try {
|
|
6782
|
+
ret = fn.apply(this && this.$id === $id ? this : store, args);
|
|
6783
|
+
} catch (error) {
|
|
6784
|
+
triggerSubscriptions(onErrorCallbackSet, error);
|
|
6785
|
+
throw error;
|
|
6786
|
+
}
|
|
6787
|
+
if (ret instanceof Promise) return ret.then((value) => {
|
|
6788
|
+
triggerSubscriptions(afterCallbackSet, value);
|
|
6789
|
+
return value;
|
|
6790
|
+
}).catch((error) => {
|
|
6791
|
+
triggerSubscriptions(onErrorCallbackSet, error);
|
|
6792
|
+
return Promise.reject(error);
|
|
6793
|
+
});
|
|
6794
|
+
triggerSubscriptions(afterCallbackSet, ret);
|
|
6795
|
+
return ret;
|
|
6796
|
+
};
|
|
6797
|
+
wrappedAction[ACTION_MARKER] = true;
|
|
6798
|
+
wrappedAction[ACTION_NAME] = name;
|
|
6799
|
+
return wrappedAction;
|
|
6800
|
+
};
|
|
6801
|
+
const _hmrPayload = /* @__PURE__ */ markRaw({
|
|
6802
|
+
actions: {},
|
|
6803
|
+
getters: {},
|
|
6804
|
+
state: [],
|
|
6805
|
+
hotState
|
|
6806
|
+
});
|
|
6807
|
+
const partialStore = {
|
|
6808
|
+
_p: pinia,
|
|
6809
|
+
$id,
|
|
6810
|
+
$onAction: addSubscription.bind(null, actionSubscriptions),
|
|
6811
|
+
$patch,
|
|
6812
|
+
$reset,
|
|
6813
|
+
$subscribe(callback, options = {}) {
|
|
6814
|
+
const removeSubscription = addSubscription(subscriptions, callback, options.detached, () => stopWatcher());
|
|
6815
|
+
const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {
|
|
6816
|
+
if (options.flush === "sync" ? isSyncListening : isListening) callback({
|
|
6817
|
+
storeId: $id,
|
|
6818
|
+
type: MutationType.direct,
|
|
6819
|
+
events: debuggerEvents
|
|
6820
|
+
}, state);
|
|
6821
|
+
}, assign({}, $subscribeOptions, options)));
|
|
6822
|
+
return removeSubscription;
|
|
6823
|
+
},
|
|
6824
|
+
$dispose
|
|
6825
|
+
};
|
|
6826
|
+
const store = reactive(process.env.NODE_ENV !== "production" || (process.env.NODE_ENV !== "production" || false) && !(process.env.NODE_ENV === "test") && IS_CLIENT ? assign({
|
|
6827
|
+
_hmrPayload,
|
|
6828
|
+
_customProperties: markRaw(/* @__PURE__ */ new Set())
|
|
6829
|
+
}, partialStore) : partialStore);
|
|
6830
|
+
pinia._s.set($id, store);
|
|
6831
|
+
const setupStore = (pinia._a && pinia._a.runWithContext || fallbackRunWithContext)(() => pinia._e.run(() => (scope = effectScope()).run(() => setup({ action }))));
|
|
6832
|
+
for (const key in setupStore) {
|
|
6833
|
+
const prop = setupStore[key];
|
|
6834
|
+
if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {
|
|
6835
|
+
if (process.env.NODE_ENV !== "production" && hot) hotState.value[key] = toRef(setupStore, key);
|
|
6836
|
+
else if (!isOptionsStore) {
|
|
6837
|
+
if (initialState && shouldHydrate(prop)) if (isRef(prop)) prop.value = initialState[key];
|
|
6838
|
+
else mergeReactiveObjects(prop, initialState[key]);
|
|
6839
|
+
pinia.state.value[$id][key] = prop;
|
|
6840
|
+
}
|
|
6841
|
+
/* istanbul ignore else */
|
|
6842
|
+
if (process.env.NODE_ENV !== "production") _hmrPayload.state.push(key);
|
|
6843
|
+
} else if (typeof prop === "function") {
|
|
6844
|
+
setupStore[key] = process.env.NODE_ENV !== "production" && hot ? prop : action(prop, key);
|
|
6845
|
+
/* istanbul ignore else */
|
|
6846
|
+
if (process.env.NODE_ENV !== "production") _hmrPayload.actions[key] = prop;
|
|
6847
|
+
optionsForPlugin.actions[key] = prop;
|
|
6848
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
6849
|
+
if (isComputed(prop)) {
|
|
6850
|
+
_hmrPayload.getters[key] = isOptionsStore ? options.getters[key] : prop;
|
|
6851
|
+
if (IS_CLIENT) (setupStore._getters || (setupStore._getters = markRaw([]))).push(key);
|
|
6852
|
+
}
|
|
6853
|
+
}
|
|
6854
|
+
}
|
|
6855
|
+
/* istanbul ignore if */
|
|
6856
|
+
assign(store, setupStore);
|
|
6857
|
+
assign(toRaw(store), setupStore);
|
|
6858
|
+
Object.defineProperty(store, "$state", {
|
|
6859
|
+
get: () => process.env.NODE_ENV !== "production" && hot ? hotState.value : pinia.state.value[$id],
|
|
6860
|
+
set: (state) => {
|
|
6861
|
+
/* istanbul ignore if */
|
|
6862
|
+
if (process.env.NODE_ENV !== "production" && hot) throw new Error("cannot set hotState");
|
|
6863
|
+
$patch(($state) => {
|
|
6864
|
+
assign($state, state);
|
|
6865
|
+
});
|
|
6866
|
+
}
|
|
6867
|
+
});
|
|
6868
|
+
/* istanbul ignore else */
|
|
6869
|
+
if (process.env.NODE_ENV !== "production") store._hotUpdate = markRaw((newStore) => {
|
|
6870
|
+
store._hotUpdating = true;
|
|
6871
|
+
newStore._hmrPayload.state.forEach((stateKey) => {
|
|
6872
|
+
if (stateKey in store.$state) {
|
|
6873
|
+
const newStateTarget = newStore.$state[stateKey];
|
|
6874
|
+
const oldStateSource = store.$state[stateKey];
|
|
6875
|
+
if (typeof newStateTarget === "object" && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) patchObject(newStateTarget, oldStateSource);
|
|
6876
|
+
else newStore.$state[stateKey] = oldStateSource;
|
|
6877
|
+
}
|
|
6878
|
+
store[stateKey] = toRef(newStore.$state, stateKey);
|
|
6879
|
+
});
|
|
6880
|
+
Object.keys(store.$state).forEach((stateKey) => {
|
|
6881
|
+
if (!(stateKey in newStore.$state)) delete store[stateKey];
|
|
6882
|
+
});
|
|
6883
|
+
isListening = false;
|
|
6884
|
+
isSyncListening = false;
|
|
6885
|
+
pinia.state.value[$id] = toRef(newStore._hmrPayload, "hotState");
|
|
6886
|
+
isSyncListening = true;
|
|
6887
|
+
nextTick().then(() => {
|
|
6888
|
+
isListening = true;
|
|
6889
|
+
});
|
|
6890
|
+
for (const actionName in newStore._hmrPayload.actions) {
|
|
6891
|
+
const actionFn = newStore[actionName];
|
|
6892
|
+
store[actionName] = action(actionFn, actionName);
|
|
6893
|
+
}
|
|
6894
|
+
for (const getterName in newStore._hmrPayload.getters) {
|
|
6895
|
+
const getter = newStore._hmrPayload.getters[getterName];
|
|
6896
|
+
store[getterName] = isOptionsStore ? computed(() => {
|
|
6897
|
+
setActivePinia(pinia);
|
|
6898
|
+
return getter.call(store, store);
|
|
6899
|
+
}) : getter;
|
|
6900
|
+
}
|
|
6901
|
+
Object.keys(store._hmrPayload.getters).forEach((key) => {
|
|
6902
|
+
if (!(key in newStore._hmrPayload.getters)) delete store[key];
|
|
6903
|
+
});
|
|
6904
|
+
Object.keys(store._hmrPayload.actions).forEach((key) => {
|
|
6905
|
+
if (!(key in newStore._hmrPayload.actions)) delete store[key];
|
|
6906
|
+
});
|
|
6907
|
+
store._hmrPayload = newStore._hmrPayload;
|
|
6908
|
+
store._getters = newStore._getters;
|
|
6909
|
+
store._hotUpdating = false;
|
|
6910
|
+
});
|
|
6911
|
+
if ((process.env.NODE_ENV !== "production" || false) && !(process.env.NODE_ENV === "test") && IS_CLIENT) {
|
|
6912
|
+
const nonEnumerable = {
|
|
6913
|
+
writable: true,
|
|
6914
|
+
configurable: true,
|
|
6915
|
+
enumerable: false
|
|
6916
|
+
};
|
|
6917
|
+
[
|
|
6918
|
+
"_p",
|
|
6919
|
+
"_hmrPayload",
|
|
6920
|
+
"_getters",
|
|
6921
|
+
"_customProperties"
|
|
6922
|
+
].forEach((p) => {
|
|
6923
|
+
Object.defineProperty(store, p, assign({ value: store[p] }, nonEnumerable));
|
|
6924
|
+
});
|
|
6925
|
+
}
|
|
6926
|
+
pinia._p.forEach((extender) => {
|
|
6927
|
+
/* istanbul ignore else */
|
|
6928
|
+
if ((process.env.NODE_ENV !== "production" || false) && !(process.env.NODE_ENV === "test") && IS_CLIENT) {
|
|
6929
|
+
const extensions = scope.run(() => extender({
|
|
6930
|
+
store,
|
|
6931
|
+
app: pinia._a,
|
|
6932
|
+
pinia,
|
|
6933
|
+
options: optionsForPlugin
|
|
6934
|
+
}));
|
|
6935
|
+
Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));
|
|
6936
|
+
assign(store, extensions);
|
|
6937
|
+
} else assign(store, scope.run(() => extender({
|
|
6938
|
+
store,
|
|
6939
|
+
app: pinia._a,
|
|
6940
|
+
pinia,
|
|
6941
|
+
options: optionsForPlugin
|
|
6942
|
+
})));
|
|
6943
|
+
});
|
|
6944
|
+
if (process.env.NODE_ENV !== "production" && store.$state && typeof store.$state === "object" && typeof store.$state.constructor === "function" && !store.$state.constructor.toString().includes("[native code]")) console.warn(`[🍍]: The "state" must be a plain object. It cannot be
|
|
6945
|
+
state: () => new MyClass()
|
|
6946
|
+
Found in store "${store.$id}".`);
|
|
6947
|
+
if (initialState && isOptionsStore && options.hydrate) options.hydrate(store.$state, initialState);
|
|
6948
|
+
isListening = true;
|
|
6949
|
+
isSyncListening = true;
|
|
6950
|
+
return store;
|
|
6951
|
+
}
|
|
6952
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
6953
|
+
function defineStore(id, setup, setupOptions) {
|
|
6954
|
+
let options;
|
|
6955
|
+
const isSetupStore = typeof setup === "function";
|
|
6956
|
+
options = isSetupStore ? setupOptions : setup;
|
|
6957
|
+
function useStore(pinia, hot) {
|
|
6958
|
+
const hasContext = hasInjectionContext();
|
|
6959
|
+
pinia = (process.env.NODE_ENV === "test" && activePinia && activePinia._testing ? null : pinia) || (hasContext ? inject(piniaSymbol, null) : null);
|
|
6960
|
+
if (pinia) setActivePinia(pinia);
|
|
6961
|
+
if (process.env.NODE_ENV !== "production" && !activePinia) throw new Error("[🍍]: \"getActivePinia()\" was called but there was no active Pinia. Are you trying to use a store before calling \"app.use(pinia)\"?\nSee https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\nThis will fail in production.");
|
|
6962
|
+
pinia = activePinia;
|
|
6963
|
+
if (!pinia._s.has(id)) {
|
|
6964
|
+
if (isSetupStore) createSetupStore(id, setup, options, pinia);
|
|
6965
|
+
else createOptionsStore(id, options, pinia);
|
|
6966
|
+
/* istanbul ignore else */
|
|
6967
|
+
if (process.env.NODE_ENV !== "production") useStore._pinia = pinia;
|
|
6968
|
+
}
|
|
6969
|
+
const store = pinia._s.get(id);
|
|
6970
|
+
if (process.env.NODE_ENV !== "production" && hot) {
|
|
6971
|
+
const hotId = "__hot:" + id;
|
|
6972
|
+
const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);
|
|
6973
|
+
hot._hotUpdate(newStore);
|
|
6974
|
+
delete pinia.state.value[hotId];
|
|
6975
|
+
pinia._s.delete(hotId);
|
|
6976
|
+
}
|
|
6977
|
+
if (process.env.NODE_ENV !== "production" && IS_CLIENT) {
|
|
6978
|
+
const currentInstance = getCurrentInstance();
|
|
6979
|
+
if (currentInstance && currentInstance.proxy && !hot) {
|
|
6980
|
+
const vm = currentInstance.proxy;
|
|
6981
|
+
const cache = "_pStores" in vm ? vm._pStores : vm._pStores = {};
|
|
6982
|
+
cache[id] = store;
|
|
6983
|
+
}
|
|
6984
|
+
}
|
|
6985
|
+
return store;
|
|
6986
|
+
}
|
|
6987
|
+
useStore.$id = id;
|
|
6988
|
+
return useStore;
|
|
6989
|
+
}
|
|
6990
|
+
//#endregion
|
|
6991
|
+
//#region compositions/overlay/useOverlayStack.ts
|
|
6992
|
+
/**
|
|
6993
|
+
* @description overlay stack manager — unified z-index and ESC handling for all popups
|
|
6994
|
+
* @author kine-design
|
|
6995
|
+
* @date 2026/5/22 00:00
|
|
6996
|
+
* @version v1.0.0
|
|
6997
|
+
*
|
|
6998
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
6999
|
+
*/
|
|
7000
|
+
var Z_INDEX_BASE = 100;
|
|
7001
|
+
var idCounter = 0;
|
|
7002
|
+
var generateId = (type) => `overlay-${type}-${++idCounter}`;
|
|
7003
|
+
var useOverlayStackStore = defineStore("overlayStack", () => {
|
|
7004
|
+
const overlayStack = ref([]);
|
|
7005
|
+
const isEmpty = computed(() => overlayStack.value.length === 0);
|
|
7006
|
+
const topItem = computed(() => overlayStack.value.length > 0 ? overlayStack.value[overlayStack.value.length - 1] : void 0);
|
|
7007
|
+
const push = (item) => {
|
|
7008
|
+
const zIndex = overlayStack.value.length + Z_INDEX_BASE;
|
|
7009
|
+
const entry = {
|
|
7010
|
+
...item,
|
|
7011
|
+
zIndex
|
|
7012
|
+
};
|
|
7013
|
+
overlayStack.value.push(entry);
|
|
7014
|
+
return entry;
|
|
7015
|
+
};
|
|
7016
|
+
const pop = () => {
|
|
7017
|
+
const item = overlayStack.value.pop();
|
|
7018
|
+
if (item) item.close();
|
|
7019
|
+
return item;
|
|
7020
|
+
};
|
|
7021
|
+
const remove = (id) => {
|
|
7022
|
+
const index = overlayStack.value.findIndex((item) => item.id === id);
|
|
7023
|
+
if (index !== -1) {
|
|
7024
|
+
overlayStack.value.splice(index, 1);
|
|
7025
|
+
recalculateZIndices();
|
|
7026
|
+
}
|
|
7027
|
+
};
|
|
7028
|
+
const recalculateZIndices = () => {
|
|
7029
|
+
overlayStack.value.forEach((item, index) => {
|
|
7030
|
+
item.zIndex = index + Z_INDEX_BASE;
|
|
7031
|
+
});
|
|
7032
|
+
};
|
|
7033
|
+
const handleEsc = (e) => {
|
|
7034
|
+
if (e.key === "Escape" && !isEmpty.value) pop();
|
|
7035
|
+
};
|
|
7036
|
+
let listenerAttached = false;
|
|
7037
|
+
const attachEscListener = () => {
|
|
7038
|
+
if (!listenerAttached) {
|
|
7039
|
+
document.addEventListener("keydown", handleEsc);
|
|
7040
|
+
listenerAttached = true;
|
|
7041
|
+
}
|
|
7042
|
+
};
|
|
7043
|
+
const detachEscListener = () => {
|
|
7044
|
+
if (listenerAttached) {
|
|
7045
|
+
document.removeEventListener("keydown", handleEsc);
|
|
7046
|
+
listenerAttached = false;
|
|
7047
|
+
}
|
|
7048
|
+
};
|
|
7049
|
+
return {
|
|
7050
|
+
overlayStack,
|
|
7051
|
+
isEmpty,
|
|
7052
|
+
topItem,
|
|
7053
|
+
push,
|
|
7054
|
+
pop,
|
|
7055
|
+
remove,
|
|
7056
|
+
attachEscListener,
|
|
7057
|
+
detachEscListener
|
|
7058
|
+
};
|
|
7059
|
+
});
|
|
7060
|
+
function useOverlayStack() {
|
|
7061
|
+
const store = useOverlayStackStore();
|
|
7062
|
+
onMounted(() => {
|
|
7063
|
+
store.attachEscListener();
|
|
7064
|
+
});
|
|
7065
|
+
onBeforeUnmount(() => {
|
|
7066
|
+
store.detachEscListener();
|
|
7067
|
+
});
|
|
7068
|
+
return store;
|
|
7069
|
+
}
|
|
7070
|
+
function useOverlayItem(type) {
|
|
7071
|
+
const store = useOverlayStackStore();
|
|
7072
|
+
let itemId;
|
|
7073
|
+
const register = (closeFn) => {
|
|
7074
|
+
const id = generateId(type);
|
|
7075
|
+
const entry = store.push({
|
|
7076
|
+
id,
|
|
7077
|
+
type,
|
|
7078
|
+
close: closeFn
|
|
7079
|
+
});
|
|
7080
|
+
itemId = entry.id;
|
|
7081
|
+
return entry;
|
|
7082
|
+
};
|
|
7083
|
+
const unregister = () => {
|
|
7084
|
+
if (itemId) {
|
|
7085
|
+
store.remove(itemId);
|
|
7086
|
+
itemId = void 0;
|
|
7087
|
+
}
|
|
7088
|
+
};
|
|
7089
|
+
const currentZIndex = computed(() => {
|
|
7090
|
+
if (!itemId) return void 0;
|
|
7091
|
+
return store.overlayStack.find((i) => i.id === itemId)?.zIndex;
|
|
7092
|
+
});
|
|
7093
|
+
onBeforeUnmount(() => {
|
|
7094
|
+
unregister();
|
|
7095
|
+
});
|
|
7096
|
+
return {
|
|
7097
|
+
register,
|
|
7098
|
+
unregister,
|
|
7099
|
+
currentZIndex
|
|
7100
|
+
};
|
|
7101
|
+
}
|
|
7102
|
+
//#endregion
|
|
6323
7103
|
//#region locale/zh.ts
|
|
6324
7104
|
var zh = {
|
|
6325
7105
|
common: {
|
|
@@ -6776,4 +7556,4 @@ function getActiveLocaleMessages() {
|
|
|
6776
7556
|
return activeLocaleMessages;
|
|
6777
7557
|
}
|
|
6778
7558
|
//#endregion
|
|
6779
|
-
export { AffixCore, AlertCore, AnchorCore, AutoCompleteCore, AvatarCore, BackTopCore, BadgeCore, BorderCore, BreadcrumbCore, ButtonCore, CardCore, CarouselCore, CascaderCore, CheckboxCore, CollapseCore, ConfirmCore, DEFAULT_LOCALE, DEFAULT_MENU_CONFIG, DEFAULT_TREE_CONFIG, DarkModeCore, DatePickerCore, DescriptionsCore, DialogCore, DividerCore, DrawerCore, DropdownCore, EmptyCore, FormCore, GridCore, ImageCore, InputCore, InputNumberCore, KINE_LOCALE_KEY, LiCore, ListCore, LoadingCore, MenuCore, MessageCore, MessagePopoverCore, NotificationCore, PaginationCore, PopoverCore, ProgressCore, RadioCore, RateCore, ResultCore, SelectCore, SkeletonCore, SliderCore, SpaceCore, StepsCore, SwitchCore, TableColumnCore, TableCore, TabsCore, TagCore, TimelineCore, TooltipCore, TransferCore, Tree, TreeCore, VirtualListCore, createRadioId, en, fixKey, generateTimeColumn, getActiveLocaleMessages, getNewModelValue, initChecked, locales, setActiveLocaleMessages, toDayjs, treeNodeProps, props as treeProps, useDatePicker, useLocale, useMessageQueue, useNotificationQueue, usePagination, useTable, useTree, zh };
|
|
7559
|
+
export { AffixCore, AlertCore, AnchorCore, AutoCompleteCore, AvatarCore, BackTopCore, BadgeCore, BorderCore, BreadcrumbCore, ButtonCore, CardCore, CarouselCore, CascaderCore, CheckboxCore, CollapseCore, ConfirmCore, DEFAULT_LOCALE, DEFAULT_MENU_CONFIG, DEFAULT_TREE_CONFIG, DarkModeCore, DatePickerCore, DescriptionsCore, DialogCore, DividerCore, DrawerCore, DropdownCore, EmptyCore, FormCore, GridCore, ImageCore, InputCore, InputNumberCore, KINE_LOCALE_KEY, LiCore, ListCore, LoadingCore, MenuCore, MessageCore, MessagePopoverCore, NotificationCore, PaginationCore, PopoverCore, ProgressCore, RadioCore, RateCore, ResultCore, SelectCore, SkeletonCore, SliderCore, SpaceCore, StepsCore, SwitchCore, TableColumnCore, TableCore, TabsCore, TagCore, TimelineCore, TooltipCore, TransferCore, Tree, TreeCore, VirtualListCore, createRadioId, en, fixKey, generateTimeColumn, getActiveLocaleMessages, getNewModelValue, initChecked, locales, setActiveLocaleMessages, toDayjs, treeNodeProps, props as treeProps, useDatePicker, useLocale, useMessageQueue, useNotificationQueue, useOverlayItem, useOverlayStack, useOverlayStackStore, usePagination, useTable, useTree, zh };
|