zcw-shared 1.23.0 → 1.25.0

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.
@@ -0,0 +1,6 @@
1
+ import type { Placement } from '../../../types/placement';
2
+ import type { Rect, Coords } from '../../../types/geometry';
3
+ export declare function computePosition(placement: Placement, reference: Rect, floating: {
4
+ width: number;
5
+ height: number;
6
+ }, scrollOffset: Coords): Coords;
@@ -0,0 +1,49 @@
1
+ import { getBasePlacement } from './getBasePlacement';
2
+ import { getAlignment } from './getAlignment';
3
+ export function computePosition(placement, reference, floating, scrollOffset) {
4
+ const basePlacement = getBasePlacement(placement);
5
+ const alignment = getAlignment(placement);
6
+ let x = reference.x;
7
+ let y = reference.y;
8
+ switch (basePlacement) {
9
+ case 'top':
10
+ x = x + reference.width / 2 - floating.width / 2;
11
+ y = reference.y - floating.height;
12
+ break;
13
+ case 'bottom':
14
+ x = x + reference.width / 2 - floating.width / 2;
15
+ y = reference.y + reference.height;
16
+ break;
17
+ case 'left':
18
+ x = x - floating.width;
19
+ y = y + reference.height / 2 - floating.height / 2;
20
+ break;
21
+ case 'right':
22
+ x = x + reference.width;
23
+ y = y + reference.height / 2 - floating.height / 2;
24
+ break;
25
+ }
26
+ if (alignment) {
27
+ if (basePlacement === 'top' || basePlacement === 'bottom') {
28
+ if (alignment === 'start') {
29
+ x = reference.x;
30
+ }
31
+ else if (alignment === 'end') {
32
+ x = reference.x + reference.width - floating.width;
33
+ }
34
+ }
35
+ else {
36
+ if (alignment === 'start') {
37
+ y = reference.y;
38
+ }
39
+ else if (alignment === 'end') {
40
+ y = reference.y + reference.height - floating.height;
41
+ }
42
+ }
43
+ }
44
+ return {
45
+ x: x + scrollOffset.x,
46
+ y: y + scrollOffset.y,
47
+ };
48
+ }
49
+ //# sourceMappingURL=computePosition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computePosition.js","sourceRoot":"","sources":["../../../src/functions/dom/computePosition.ts"],"names":[],"mapp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,CAAC;QACd,IAAI,aAAa,KAAK,KAAK,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;YAE1D,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;gBAC1B,CAAC,GAAG,SAAS,CAAC,CAAC,CAAA;YACjB,CAAC;iBAAM,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;gBAC/B,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAA;YACpD,CAAC;QACH,CAAC;aAAM,CAAC;YAEN,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;gBAC1B,CAAC,GAAG,SAAS,CAAC,CAAC,CAAA;YACjB,CAAC;iBAAM,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;gBAC/B,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAA;YACtD,CAAC;QACH,CAAC;IACH,CAAC;IAGD,OAAO;QACL,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC;QACrB,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC;KACtB,CAAA;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Placement, Alignment } from '../../../types/placement';
2
+ export declare function getAlignment(placement: Placement): Alignment | null;
@@ -0,0 +1,5 @@
1
+ export function getAlignment(placement) {
2
+ const parts = placement.split('-');
3
+ return parts.length > 1 ? parts[1] : null;
4
+ }
5
+ //# sourceMappingURL=getAlignment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAlignment.js","sourceRoot":"","sources":["../../../src/functions/dom/getAlignment.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,YAAY,CAAC,SAAoB;IAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAClC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAE,KAAK,CAAC,CAAC,CAAe,CAAC,CAAC,CAAC,IAAI,CAAA;AAC1D,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Placement, BasePlacement } from '../../../types/placement';
2
+ export declare function getBasePlacement(placement: Placement): BasePlacement;
@@ -0,0 +1,4 @@
1
+ export function getBasePlacement(placement) {
2
+ return placement.split('-')[0];
3
+ }
4
+ //# sourceMappingURL=getBasePlacement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBasePlacement.js","sourceRoot":"","sources":["../../../src/functions/dom/getBasePlacement.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,gBAAgB,CAAC,SAAoB;IACnD,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAkB,CAAA;AACjD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Placement } from '../../../types/placement';
2
+ export declare function getCrossAxisFlip(placement: Placement): Placement;
@@ -0,0 +1,11 @@
1
+ import { getBasePlacement } from './getBasePlacement';
2
+ import { getAlignment } from './getAlignment';
3
+ export function getCrossAxisFlip(placement) {
4
+ const basePlacement = getBasePlacement(placement);
5
+ const alignment = getAlignment(placement);
6
+ if (!alignment)
7
+ return placement;
8
+ const newAlignment = alignment === 'start' ? 'end' : 'start';
9
+ return `${basePlacement}-${newAlignment}`;
10
+ }
11
+ //# sourceMappingURL=getCrossAxisFlip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCrossAxisFlip.js","sourceRoot":"","sources":["../../../src/functions/dom/getCrossAxisFlip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAmB7C,MAAM,UAAU,gBAAgB,CAAC,SAAoB;IACnD,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAA;IACjD,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;IAEzC,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAA;IAEhC,MAAM,YAAY,GAAc,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;IACvE,OAAO,GAAG,aAAa,IAAI,YAAY,EAAe,CAAA;AACxD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Placement } from '../../../types/placement';
2
+ export declare function getFlipPlacements(placement: Placement): Placement[];
@@ -0,0 +1,13 @@
1
+ import { getBasePlacement } from './getBasePlacement';
2
+ import { getAlignment } from './getAlignment';
3
+ export function getFlipPlacements(placement) {
4
+ const basePlacement = getBasePlacement(placement);
5
+ const alignment = getAlignment(placement);
6
+ const allBasePlacements = ['top', 'right', 'bottom', 'left'];
7
+ const otherBasePlacements = allBasePlacements.filter(p => p !== basePlacement);
8
+ if (!alignment) {
9
+ return otherBasePlacements;
10
+ }
11
+ return otherBasePlacements.map(base => `${base}-${alignment}`);
12
+ }
13
+ //# sourceMappingURL=getFlipPlacements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFlipPlacements.js","sourceRoot":"","sources":["../../../src/functions/dom/getFlipPlacements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAiB7C,MAAM,UAAU,iBAAiB,CAAC,SAAoB;IACpD,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAA;IACjD,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;IAEzC,MAAM,iBAAiB,GAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;IAC7E,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,CAAA;IAE9E,IAAI,CAAC,SAAS,EAAE,CAAC;QAEf,OAAO,mBAAkC,CAAA;IAC3C,CAAC;IAGD,OAAO,mBAAmB,CAAC,GAAG,CAC5B,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,IAAI,SAAS,EAAe,CAC5C,CAAA;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Placement } from '../../../types/placement';
2
+ export declare function getMainAxisFlip(placement: Placement): Placement;
@@ -0,0 +1,17 @@
1
+ import { getBasePlacement } from './getBasePlacement';
2
+ import { getAlignment } from './getAlignment';
3
+ export function getMainAxisFlip(placement) {
4
+ const basePlacement = getBasePlacement(placement);
5
+ const alignment = getAlignment(placement);
6
+ const flips = {
7
+ top: 'bottom',
8
+ bottom: 'top',
9
+ left: 'right',
10
+ right: 'left',
11
+ };
12
+ const flippedBase = flips[basePlacement];
13
+ return alignment
14
+ ? `${flippedBase}-${alignment}`
15
+ : flippedBase;
16
+ }
17
+ //# sourceMappingURL=getMainAxisFlip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMainAxisFlip.js","sourceRoot":"","sources":["../../../src/functions/dom/getMainAxisFlip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAkB7C,MAAM,UAAU,eAAe,CAAC,SAAoB;IAClD,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAA;IACjD,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;IAEzC,MAAM,KAAK,GAAyC;QAClD,GAAG,EAAE,QAAQ;QACb,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,MAAM;KACd,CAAA;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,CAAA;IACxC,OAAO,SAAS;QACd,CAAC,CAAE,GAAG,WAAW,IAAI,SAAS,EAAgB;QAC9C,CAAC,CAAE,WAAyB,CAAA;AAChC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Placement } from '../../../types/placement';
2
+ export declare function isValidPlacement(placement: string): placement is Placement;
@@ -0,0 +1,16 @@
1
+ export function isValidPlacement(placement) {
2
+ const validBasePlacements = ['top', 'right', 'bottom', 'left'];
3
+ const validAlignments = ['start', 'end'];
4
+ const parts = placement.split('-');
5
+ if (parts.length > 2 || parts.length === 0) {
6
+ return false;
7
+ }
8
+ if (!validBasePlacements.includes(parts[0])) {
9
+ return false;
10
+ }
11
+ if (parts.length === 2 && !validAlignments.includes(parts[1])) {
12
+ return false;
13
+ }
14
+ return true;
15
+ }
16
+ //# sourceMappingURL=isValidPlacement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isValidPlacement.js","sourceRoot":"","sources":["../../../src/functions/dom/isValidPlacement.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,MAAM,mBAAmB,GAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;IAC/E,MAAM,eAAe,GAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAGrD,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAClC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3C,OAAO,KAAK,CAAA;IACd,CAAC;IAGD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAkB,CAAC,EAAE,CAAC;QAC7D,OAAO,KAAK,CAAA;IACd,CAAC;IAGD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAc,CAAC,EAAE,CAAC;QAC3E,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { UnwrapRef } from '../../../references/vue.d';
2
+ import type { VueCompositionAPI } from '../../../types/vue.d';
3
+ import type { CreateThrottledEventListenerDeps } from '../../functions/dom/createThrottledEventListener';
4
+ export interface StateData {
5
+ visible: boolean;
6
+ }
7
+ export type State = UnwrapRef<StateData>;
8
+ export interface UseAutoUpdateDeps extends CreateThrottledEventListenerDeps {
9
+ watch: VueCompositionAPI['watch'];
10
+ }
11
+ export interface UseAutoUpdateOptions {
12
+ state: State;
13
+ update: () => void;
14
+ throttleMs?: number;
15
+ }
16
+ export interface UseAutoUpdateReturn {
17
+ destroy: () => void;
18
+ }
19
+ export declare function useAutoUpdate(options: UseAutoUpdateOptions, deps: UseAutoUpdateDeps): UseAutoUpdateReturn;
@@ -0,0 +1,41 @@
1
+ import { createThrottledEventListener } from '../../functions/dom/createThrottledEventListener';
2
+ export function useAutoUpdate(options, deps) {
3
+ const { state, update, throttleMs = 0 } = options;
4
+ let resizeCleanup = null;
5
+ let scrollCleanup = null;
6
+ const stopAutoUpdateWatch = deps.watch(() => state.visible, (visible) => {
7
+ if (visible) {
8
+ if (!resizeCleanup) {
9
+ resizeCleanup = createThrottledEventListener('resize', update, throttleMs, deps);
10
+ }
11
+ if (!scrollCleanup) {
12
+ scrollCleanup = createThrottledEventListener('scroll', update, throttleMs, deps);
13
+ }
14
+ }
15
+ else {
16
+ if (resizeCleanup) {
17
+ resizeCleanup();
18
+ resizeCleanup = null;
19
+ }
20
+ if (scrollCleanup) {
21
+ scrollCleanup();
22
+ scrollCleanup = null;
23
+ }
24
+ }
25
+ }, { immediate: true });
26
+ const destroy = () => {
27
+ try {
28
+ stopAutoUpdateWatch();
29
+ resizeCleanup?.();
30
+ scrollCleanup?.();
31
+ }
32
+ finally {
33
+ resizeCleanup = null;
34
+ scrollCleanup = null;
35
+ }
36
+ };
37
+ return {
38
+ destroy,
39
+ };
40
+ }
41
+ //# sourceMappingURL=useAutoUpdate.js.map
@@ -0,0 +1 @@
1
+ {"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aAAa,GAAG,IAAI,CAAA;YACpB,aAAa,GAAG,IAAI,CAAA;QACtB,CAAC;IACH,CAAC,CAAA;IAED,OAAO;QACL,OAAO;KACR,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcw-shared",
3
- "version": "1.23.0",
3
+ "version": "1.25.0",
4
4
  "files": [
5
5
  "references",
6
6
  "dist",
@@ -119,12 +119,19 @@
119
119
  "./functions/design-tokens/generateVariables": "./dist/functions/design-tokens/generateVariables.js",
120
120
  "./functions/design-tokens/mixColors": "./dist/functions/design-tokens/mixColors.js",
121
121
  "./functions/design-tokens/parseDesignTokens": "./dist/functions/design-tokens/parseDesignTokens.js",
122
+ "./functions/dom/computePosition": "./dist/functions/dom/computePosition.js",
122
123
  "./functions/dom/createThrottledEventListener": "./dist/functions/dom/createThrottledEventListener.js",
123
124
  "./functions/dom/demonstrateResourceLoading": "./dist/functions/dom/demonstrateResourceLoading.js",
124
125
  "./functions/dom/detectOverflow": "./dist/functions/dom/detectOverflow.js",
126
+ "./functions/dom/getAlignment": "./dist/functions/dom/getAlignment.js",
127
+ "./functions/dom/getBasePlacement": "./dist/functions/dom/getBasePlacement.js",
128
+ "./functions/dom/getCrossAxisFlip": "./dist/functions/dom/getCrossAxisFlip.js",
125
129
  "./functions/dom/getElementRect": "./dist/functions/dom/getElementRect.js",
130
+ "./functions/dom/getFlipPlacements": "./dist/functions/dom/getFlipPlacements.js",
131
+ "./functions/dom/getMainAxisFlip": "./dist/functions/dom/getMainAxisFlip.js",
126
132
  "./functions/dom/getRelativePosition": "./dist/functions/dom/getRelativePosition.js",
127
133
  "./functions/dom/getViewportRect": "./dist/functions/dom/getViewportRect.js",
134
+ "./functions/dom/isValidPlacement": "./dist/functions/dom/isValidPlacement.js",
128
135
  "./functions/file/formatFileSize": "./dist/functions/file/formatFileSize.js",
129
136
  "./functions/file/getFileExtension": "./dist/functions/file/getFileExtension.js",
130
137
  "./functions/functional/compose": "./dist/functions/functional/compose.js",
@@ -258,6 +265,7 @@
258
265
  "./vue-hooks/browser/useScreenWakeLock": "./dist/vue-hooks/browser/useScreenWakeLock.js",
259
266
  "./vue-hooks/browser/useShare": "./dist/vue-hooks/browser/useShare.js",
260
267
  "./vue-hooks/browser/useVibration": "./dist/vue-hooks/browser/useVibration.js",
268
+ "./vue-hooks/dom/useAutoUpdate": "./dist/vue-hooks/dom/useAutoUpdate.js",
261
269
  "./vue-hooks/dom/useClickOutside": "./dist/vue-hooks/dom/useClickOutside.js",
262
270
  "./vue-hooks/dom/useDraggable": "./dist/vue-hooks/dom/useDraggable.js",
263
271
  "./vue-hooks/dom/useEventListener": "./dist/vue-hooks/dom/useEventListener.js",
@@ -285,6 +293,7 @@
285
293
  "./types/color": "./types/color.d.ts",
286
294
  "./types/design-system": "./types/design-system.d.ts",
287
295
  "./types/geometry": "./types/geometry.d.ts",
296
+ "./types/placement": "./types/placement.d.ts",
288
297
  "./types/platform": "./types/platform.d.ts",
289
298
  "./types/reactive": "./types/reactive.d.ts",
290
299
  "./types/semver": "./types/semver.d.ts",
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 基础定位方向类型
3
+ */
4
+ export type BasePlacement = 'top' | 'right' | 'bottom' | 'left'
5
+
6
+ /**
7
+ * 对齐方式类型
8
+ */
9
+ export type Alignment = 'start' | 'end'
10
+
11
+ /**
12
+ * 弹出层位置类型
13
+ */
14
+ export type Placement = BasePlacement | `${BasePlacement}-${Alignment}`
15
+
package/types/vue.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ColorReference } from './design-system.d'
2
- import type { Ref, InjectionKey } from '../references/vue.d'
2
+ import type { Ref, InjectionKey, WatchStopHandle } from '../references/vue.d'
3
3
 
4
4
  /**
5
5
  * Vue Composition API 通用接口
@@ -19,7 +19,7 @@ export interface VueCompositionAPI {
19
19
  /** 注入依赖 */
20
20
  inject?: <T>(key: InjectionKey<T> | string, defaultValue?: T) => T | undefined
21
21
  /** 监听响应式数据变化 */
22
- watch?: (source: any, callback: () => void, options?: { deep?: boolean; flush?: string }) => void
22
+ watch?: <T>(source: (() => T) | Ref<T>, callback: (newValue: T, oldValue: T) => void, options?: { deep?: boolean; flush?: string; immediate?: boolean }) => WatchStopHandle
23
23
  }
24
24
 
25
25
  /**