@toolmain/components 1.2.12 → 1.2.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/dist/index.d.ts CHANGED
@@ -638,9 +638,9 @@ export declare type DeliverParam = {
638
638
 
639
639
  export declare const DialogPanel: __VLS_WithSlots_4<typeof __VLS_component_4, __VLS_Slots_4>;
640
640
 
641
- declare type Dir = "horizontal" | "vertical" | "any";
641
+ export declare type Dir = "horizontal" | "vertical" | "any";
642
642
 
643
- declare interface DragAttr {
643
+ export declare interface DragAttr {
644
644
  /**
645
645
  * 元素x轴坐标
646
646
  */
@@ -762,6 +762,12 @@ declare interface EventBus<T extends Record<string, any>> {
762
762
 
763
763
  declare type EventBusCallback = (...args: any[]) => any;
764
764
 
765
+ export declare interface EventMap {
766
+ beforemove: (pos: DragAttr) => void;
767
+ aftermove: (pos: DragAttr) => void;
768
+ moving: (pos: DragAttr) => void;
769
+ }
770
+
765
771
  declare interface ExtendProps extends BaseProps {
766
772
  type: PropsType.Extend;
767
773
  extendType: string;
@@ -838,7 +844,11 @@ declare interface IconProps extends BaseProps {
838
844
  type: PropsType.Icon;
839
845
  }
840
846
 
841
- declare type InitType = "auto" | "inherit" | "initial" | "unset";
847
+ export declare function initDragAttr(): DragAttr;
848
+
849
+ export declare function initRect(): Rect;
850
+
851
+ export declare type InitType = "auto" | "inherit" | "initial" | "unset";
842
852
 
843
853
  declare interface JSONProps extends BaseProps {
844
854
  type: PropsType.JSON;
@@ -989,7 +999,7 @@ export declare interface MoveHook {
989
999
  scale?: (oldVal: FixedArray<number, 2>, newVal: FixedArray<number, 2>) => [FixedArray<number, 2>, FixedArray<number, 2>];
990
1000
  }
991
1001
 
992
- declare interface MoveOptions {
1002
+ export declare interface MoveOptions {
993
1003
  /**
994
1004
  * 移动方向
995
1005
  */
@@ -1001,6 +1011,23 @@ export declare type MoveParams = DragAttr & {
1001
1011
  translateY: number;
1002
1012
  };
1003
1013
 
1014
+ export declare interface MoveType {
1015
+ isMoving: () => boolean;
1016
+ setTarget: (target?: HTMLElement | null) => void;
1017
+ getTarget: () => HTMLElement | null | undefined;
1018
+ setDirection: (dir: Dir) => void;
1019
+ on: <K extends keyof EventMap>(event: K, cb: EventMap[K]) => void;
1020
+ once: <K extends keyof EventMap>(event: K, cb: EventMap[K]) => void;
1021
+ /**
1022
+ * every means the object will not listen the same event repeatly,but only one time.
1023
+ * it's not that after being triggerd,the event listener will be removed,it still exist.
1024
+ */
1025
+ every: <K extends keyof EventMap>(event: K, cb: EventMap[K]) => void;
1026
+ updateOption: (opt: MoveOptions) => void;
1027
+ disable: () => void;
1028
+ enable: () => void;
1029
+ }
1030
+
1004
1031
  declare class NodeTree {
1005
1032
  #private;
1006
1033
  constructor();
@@ -1229,6 +1256,17 @@ export declare type RawComponent = {
1229
1256
  version?: string;
1230
1257
  };
1231
1258
 
1259
+ export declare interface Rect {
1260
+ height: number;
1261
+ bottom: number;
1262
+ left: number;
1263
+ right: number;
1264
+ top: number;
1265
+ width: number;
1266
+ x: number;
1267
+ y: number;
1268
+ }
1269
+
1232
1270
  /**
1233
1271
  * 远程资源,贴图,视频等
1234
1272
  */
@@ -1458,6 +1496,18 @@ export declare enum Status {
1458
1496
  HIDDEN = "HIDDEN"
1459
1497
  }
1460
1498
 
1499
+ export declare interface Target {
1500
+ readonly ele?: HTMLElement | null;
1501
+ readonly rect: Rect;
1502
+ readonly attr: DragAttr;
1503
+ updateRect: () => void;
1504
+ setAttr: (newVal: DragAttr) => void;
1505
+ setTarget: (tar?: HTMLElement | null) => void;
1506
+ on: (event: string, cb: (attr: DragAttr) => void) => void;
1507
+ disable: () => void;
1508
+ enable: () => void;
1509
+ }
1510
+
1461
1511
  export declare type TargetData = {
1462
1512
  type: "TargetSrc";
1463
1513
  data: TargetSrc;
@@ -1649,6 +1699,8 @@ export declare function useKeyboard(): {
1649
1699
  dispose: () => void;
1650
1700
  };
1651
1701
 
1702
+ export declare function (): MoveType;
1703
+
1652
1704
  export declare const useScale: (data: {
1653
1705
  config: Ref<ScaleConfig>;
1654
1706
  targetEle: Readonly<Ref<HTMLElement | null | undefined>>;
package/dist/index.js CHANGED
@@ -20157,6 +20157,8 @@ export {
20157
20157
  Zs as hex2rgb,
20158
20158
  el as htmlTextConfig,
20159
20159
  uh as htmlTextLabel,
20160
+ Ss as initDragAttr,
20161
+ Es as initRect,
20160
20162
  dh as placeholderNode,
20161
20163
  Ri as placeholderRaw,
20162
20164
  Db as r2a,
@@ -20167,6 +20169,7 @@ export {
20167
20169
  Ob as useElement,
20168
20170
  ku as useHandle,
20169
20171
  Iu as useKeyboard,
20172
+ Tu as useMove,
20170
20173
  Ou as useScale,
20171
20174
  rb as useVarState
20172
20175
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolmain/components",
3
- "version": "1.2.12",
3
+ "version": "1.2.13",
4
4
  "description": "Convient components base on vue3",
5
5
  "license": "MIT",
6
6
  "type": "module",