nhanh-pure-function 3.0.6-beta.2 → 3.0.6-beta.3

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.
Files changed (49) hide show
  1. package/dist/Animate/index.d.ts +45 -0
  2. package/dist/Animate/type.d.ts +0 -0
  3. package/dist/Blob/index.d.ts +10 -0
  4. package/dist/Blob/type.d.ts +0 -0
  5. package/dist/Browser/index.d.ts +77 -0
  6. package/dist/Browser/type.d.ts +0 -0
  7. package/dist/Canvas/LayerGroup/index.d.ts +30 -0
  8. package/dist/Canvas/LayerGroup/layer.d.ts +44 -0
  9. package/dist/Canvas/OverlayGroup/arc.d.ts +97 -0
  10. package/dist/Canvas/OverlayGroup/arcTo.d.ts +50 -0
  11. package/dist/Canvas/OverlayGroup/bezierCurve.d.ts +1 -0
  12. package/dist/Canvas/OverlayGroup/custom.d.ts +24 -0
  13. package/dist/Canvas/OverlayGroup/ellipse.d.ts +1 -0
  14. package/dist/Canvas/OverlayGroup/index.d.ts +31 -0
  15. package/dist/Canvas/OverlayGroup/line.d.ts +31 -0
  16. package/dist/Canvas/OverlayGroup/point.d.ts +40 -0
  17. package/dist/Canvas/OverlayGroup/polygon.d.ts +46 -0
  18. package/dist/Canvas/OverlayGroup/public/geometricBoundary.d.ts +70 -0
  19. package/dist/Canvas/OverlayGroup/public/overlay.d.ts +174 -0
  20. package/dist/Canvas/OverlayGroup/text.d.ts +27 -0
  21. package/dist/Canvas/core/axis.d.ts +42 -0
  22. package/dist/Canvas/core/basedata.d.ts +177 -0
  23. package/dist/Canvas/core/draw.d.ts +34 -0
  24. package/dist/Canvas/core/event.d.ts +77 -0
  25. package/dist/Canvas/core/quikmethod.d.ts +104 -0
  26. package/dist/Canvas/core/style.d.ts +22 -0
  27. package/dist/Canvas/index.d.ts +69 -0
  28. package/dist/Canvas/index.types.d.ts +14 -0
  29. package/dist/Canvas/public/basedata.d.ts +64 -0
  30. package/dist/Canvas/public/eventController.d.ts +111 -0
  31. package/dist/Canvas/public/eventControllerBasedata.d.ts +62 -0
  32. package/dist/Canvas/public/tools.d.ts +6 -0
  33. package/dist/Constant.d.ts +256 -0
  34. package/dist/Element/index.d.ts +108 -0
  35. package/dist/Element/type.d.ts +33 -0
  36. package/dist/File/index.d.ts +29 -0
  37. package/dist/File/type.d.ts +0 -0
  38. package/dist/Format/index.d.ts +75 -0
  39. package/dist/Format/type.d.ts +0 -0
  40. package/dist/Math/index.d.ts +56 -0
  41. package/dist/Math/type.d.ts +0 -0
  42. package/dist/Utility/index.d.ts +90 -0
  43. package/dist/Utility/type.d.ts +10 -0
  44. package/dist/Valid/index.d.ts +125 -0
  45. package/dist/Valid/type.d.ts +6 -0
  46. package/dist/index.cjs.js +9 -0
  47. package/dist/index.d.ts +44 -0
  48. package/dist/index.es.js +6177 -0
  49. package/package.json +1 -1
@@ -0,0 +1,69 @@
1
+ import { default as QuickMethod } from './core/quikmethod';
2
+ import { default as LayerGroup } from './LayerGroup';
3
+ import { default as OverlayGroup, OverlayType } from './OverlayGroup';
4
+ import { default as Layer } from './LayerGroup/layer';
5
+ import { default as Point } from './OverlayGroup/point';
6
+ import { default as Text } from './OverlayGroup/text';
7
+ import { default as Line } from './OverlayGroup/line';
8
+ import { default as Polygon } from './OverlayGroup/polygon';
9
+ import { default as Custom } from './OverlayGroup/custom';
10
+ import { default as Arc } from './OverlayGroup/arc';
11
+ import { default as ArcTo } from './OverlayGroup/arcTo';
12
+ export type * from './index.types';
13
+ type ConstructorOption = ConstructorParameters<typeof QuickMethod>[0] & {
14
+ /** 轴线显示属性 */
15
+ axisShow?: Parameters<_Canvas["toggleAxis"]>[0];
16
+ };
17
+ /**
18
+ * 你好啊你好的画布工具类
19
+ * 提供图形绘制、动态渲染等画布相关功能,支持复杂场景下的可视化展示
20
+ *
21
+ * 使用示例:
22
+ * - GitHub演示:
23
+ * - 基础画布: https://adminnhanh.github.io/nhanh-frontend-view/#/canvas/_Canvas
24
+ * - 动态图表(月牙定理): https://adminnhanh.github.io/nhanh-frontend-view/#/math/DynamicDiagram/%E6%9C%88%E7%89%99%E5%AE%9A%E7%90%86
25
+ * - 阿里云演示:
26
+ * - 基础画布: https://nhanh.xin/#/canvas/_Canvas
27
+ * - 动态图表(月牙定理): https://nhanh.xin/#/math/DynamicDiagram/%E6%9C%88%E7%89%99%E5%AE%9A%E7%90%86
28
+ */
29
+ export declare class _Canvas extends QuickMethod {
30
+ /** 图层群组 */
31
+ static LayerGroup: typeof LayerGroup;
32
+ /** 图层 */
33
+ static Layer: typeof Layer;
34
+ /** 覆盖物群组 */
35
+ static OverlayGroup: typeof OverlayGroup;
36
+ /** 文字 */
37
+ static Text: typeof Text;
38
+ /** 点位 */
39
+ static Point: typeof Point;
40
+ /** 线段 */
41
+ static Line: typeof Line;
42
+ /** 多边形 */
43
+ static Polygon: typeof Polygon;
44
+ /** 自定义绘制 */
45
+ static Custom: typeof Custom;
46
+ /** 圆弧 */
47
+ static Arc: typeof Arc;
48
+ /** 圆角 */
49
+ static ArcTo: typeof ArcTo;
50
+ constructor(option: ConstructorOption);
51
+ private initLayerGroups;
52
+ /** 获取图层群组 集合 */
53
+ gteLayerGroups(key?: string): LayerGroup | undefined;
54
+ /** 设置图层群组 */
55
+ setLayerGroup(layerGroup: LayerGroup): void;
56
+ /** 移除图层群组 */
57
+ removeLayerGroup(layerGroup: LayerGroup): void;
58
+ /** 添加图层 */
59
+ addLayer(layers: DeepArray<Layer>): void;
60
+ /** 移除图层 */
61
+ removeLayer(layers: DeepArray<Layer>): void;
62
+ /** 添加覆盖物 */
63
+ addOverlay(overlays: DeepArray<OverlayType>): void;
64
+ /** 移除覆盖物 */
65
+ removeOverlay(overlays: DeepArray<OverlayType>): void;
66
+ /** 销毁 */
67
+ destroy(): void;
68
+ }
69
+ export default _Canvas;
@@ -0,0 +1,14 @@
1
+ import { default as LayerGroup } from './LayerGroup';
2
+ import { default as OverlayGroup, OverlayType } from './OverlayGroup';
3
+ import { default as Layer } from './LayerGroup/layer';
4
+ import { default as Point } from './OverlayGroup/point';
5
+ import { default as Text } from './OverlayGroup/text';
6
+ import { default as Line } from './OverlayGroup/line';
7
+ import { default as Polygon } from './OverlayGroup/polygon';
8
+ import { default as Axis } from './core/axis';
9
+ import { default as Custom } from './OverlayGroup/custom';
10
+ import { default as Arc } from './OverlayGroup/arc';
11
+ import { default as ArcTo } from './OverlayGroup/arcTo';
12
+ import { EventHandler } from './public/eventController';
13
+ import { default as Overlay } from './OverlayGroup/public/overlay';
14
+ export type { LayerGroup, OverlayGroup, Layer, OverlayType, Overlay, Point, Text, Line, Polygon, Axis, Custom, Arc, ArcTo, EventHandler, };
@@ -0,0 +1,64 @@
1
+ import { default as _Canvas } from '..';
2
+ declare abstract class Base<T extends Base<T>> {
3
+ /** 父级 */
4
+ parent?: T;
5
+ /** 名称 */
6
+ name: string;
7
+ /** 自定义扩展数据 */
8
+ extData?: any;
9
+ /** 主画布 */
10
+ mainCanvas?: _Canvas;
11
+ private _isRecalculate;
12
+ /** 是否需要重新计算坐标 */
13
+ get isRecalculate(): boolean;
14
+ set isRecalculate(isRecalculate: boolean);
15
+ /** 是否是同一个主画布 */
16
+ equalsMainCanvas(mainCanvas?: _Canvas): boolean;
17
+ /** 设置主画布 */
18
+ setMainCanvas(mainCanvas?: _Canvas): void;
19
+ /** 通知重新加载 */
20
+ notifyReload?: (needForceExecute?: boolean) => void;
21
+ /** 设置通知重新加载 */
22
+ abstract setNotifyReload(notifyReload?: () => void): void;
23
+ }
24
+ declare abstract class Show<T extends Show<T>> extends Base<T> {
25
+ private _isVisible;
26
+ /** 是否显示 */
27
+ get isVisible(): boolean;
28
+ set isVisible(isVisible: boolean);
29
+ /** 是否继承父级透明度 */
30
+ protected inheritOpacity: boolean;
31
+ private _opacity;
32
+ /** 透明度 */
33
+ get opacity(): number | undefined;
34
+ set opacity(opacity: number | undefined);
35
+ private _scaleRange?;
36
+ /** 显示范围 缩放比例 */
37
+ get scaleRange(): [number, number] | undefined;
38
+ set scaleRange(scaleRange: [number, number] | undefined);
39
+ /** 是否需要渲染 */
40
+ shouldRender(): boolean;
41
+ }
42
+ interface BaseDataOptions {
43
+ /** 父级 */
44
+ parent?: BaseData<any>;
45
+ /** 名称 */
46
+ name?: string;
47
+ /** 自定义扩展数据 */
48
+ extData?: any;
49
+ /** 主画布 */
50
+ mainCanvas?: _Canvas;
51
+ /** 通知重新加载 */
52
+ notifyReload?: (needForceExecute?: boolean) => void;
53
+ /** 是否显示 */
54
+ isVisible?: boolean;
55
+ /** 透明度 */
56
+ opacity?: number;
57
+ /** 显示范围 缩放比例 */
58
+ scaleRange?: [number, number];
59
+ }
60
+ /** 基础数据 公共 */
61
+ export default abstract class BaseData<T extends BaseData<T>> extends Show<T> {
62
+ constructor(options: BaseDataOptions);
63
+ }
64
+ export {};
@@ -0,0 +1,111 @@
1
+ import { default as EventControllerBasedata } from './eventControllerBasedata';
2
+ declare class _CanvasEvent<T = undefined> {
3
+ readonly data: T;
4
+ private propagationStopped;
5
+ constructor(data: T);
6
+ stopPropagation(): void;
7
+ get canPropagate(): boolean;
8
+ }
9
+ type State = {
10
+ state: boolean;
11
+ oldState: boolean;
12
+ };
13
+ type EventMap = {
14
+ wheel: number;
15
+ down: State;
16
+ contextmenu: State;
17
+ click: State;
18
+ doubleClick: State;
19
+ hover: State;
20
+ dragg: {
21
+ offsetX: number;
22
+ offsetY: number;
23
+ };
24
+ };
25
+ export type EventHandler<T extends keyof EventMap> = (event: _CanvasEvent<EventMap[T]>, mouseEvent?: MouseEvent) => void;
26
+ export default abstract class EventController extends EventControllerBasedata<EventController> {
27
+ /** 事件管理器 */
28
+ private readonly listeners;
29
+ /** 添加事件监听器 */
30
+ addEventListener<T extends keyof EventMap>(type: T, handler: EventHandler<T>): void;
31
+ /** 移除事件监听器 */
32
+ removeEventListener<T extends keyof EventMap>(type: T, handler: EventHandler<T>): void;
33
+ /** 共享事件状态集合 控制器 */
34
+ private sharedControllers;
35
+ /** 注册指定类型的共享事件状态集合 */
36
+ registerControllers(type: keyof EventMap, controllers: EventController[]): void;
37
+ /** 检查指定类型下是否存在特定控制器 */
38
+ hasController(type: keyof EventMap, controller: EventController): boolean | undefined;
39
+ private trigger;
40
+ private updateStates;
41
+ private _eventDate;
42
+ private _clearEventDate;
43
+ private checkEventDate;
44
+ private _isHover;
45
+ /** 是否触发悬停 */
46
+ get isHover(): boolean;
47
+ /**
48
+ * 接收悬停状态变更通知(由外部事件处理器判断后调用)
49
+ * @param state - 当前悬停状态(true:进入元素 / false:离开元素)
50
+ * @param [event] - 可选的关联鼠标事件对象
51
+ */
52
+ notifyHover: (state: boolean, event?: MouseEvent) => false | void;
53
+ private _isDown;
54
+ /** 是否触发按下 */
55
+ get isDown(): boolean;
56
+ /**
57
+ * 接收鼠标按下状态变更通知(由外部事件处理器判断后调用)
58
+ * @param state - 当前按下状态(true:按下开始 / false:按下结束)
59
+ * @param [event] - 可选的关联鼠标事件对象
60
+ */
61
+ notifyDown: (state: boolean, event?: MouseEvent) => false | void;
62
+ private _isContextmenu;
63
+ /** 是否触发右击 */
64
+ get isContextmenu(): boolean;
65
+ /**
66
+ * 接收右键菜单触发通知(由外部事件处理器判断后调用)
67
+ * @param state - 右键触发状态(true: 右键开始 / false: 右键结束)
68
+ * @param [event] - 可选的关联鼠标事件对象
69
+ */
70
+ notifyContextmenu: (state: boolean, event?: MouseEvent) => false | void;
71
+ private _isClick;
72
+ /** 是否触发点击 */
73
+ get isClick(): boolean;
74
+ /** 点击时间 */
75
+ private clickTimestamp;
76
+ /** 双击判定,两次点击之间的间隔(毫秒) */
77
+ doubleClickInterval: number;
78
+ /**
79
+ * 接收单击动作通知(由外部事件处理器判断点击动作后调用)
80
+ * @param state - 点击状态(true: 单击开始 / false: 单击结束)
81
+ * @param [event] - 可选的关联鼠标事件对象
82
+ */
83
+ notifyClick: (state: boolean, event?: MouseEvent) => void;
84
+ private _isDblClick;
85
+ /** 是否触发双击 */
86
+ get isDblClick(): boolean;
87
+ /**
88
+ * 接收双击动作通知(由外部事件处理器判断双击动作后调用)
89
+ * @param state - 双击状态(true: 双击开始 / false: 双击结束)
90
+ * @param [event] - 可选的关联鼠标事件对象
91
+ */
92
+ notifyDoubleClick: (state: boolean, event?: MouseEvent) => false | void;
93
+ /**
94
+ * 接收拖拽位置更新通知(由外部事件处理器判断拖拽动作后调用)
95
+ * @param position - 当前拖拽位置坐标
96
+ * @param position.offsetX - 相对于元素X轴的偏移量
97
+ * @param position.offsetY - 相对于元素Y轴的偏移量
98
+ * @param [event] - 可选的关联鼠标事件对象
99
+ */
100
+ notifyDragg: (position: {
101
+ offsetX: number;
102
+ offsetY: number;
103
+ }, event?: MouseEvent) => false | void;
104
+ /**
105
+ * 接收滚轮滚动通知(由外部事件处理器判断滚轮动作后调用)
106
+ * @param step - 滚轮滚动步长(正数:向上滚动 / 负数:向下滚动)
107
+ * @param [event] - 可选的关联滚轮事件对象
108
+ */
109
+ notifyWheel: (step: number, event?: WheelEvent) => false | void;
110
+ }
111
+ export {};
@@ -0,0 +1,62 @@
1
+ import { default as BaseData } from './basedata';
2
+ type EventControllerOptions<T extends EventControllerBasedata<T>> = ConstructorParameters<typeof BaseData<EventControllerBasedata<T>>>[0] & {
3
+ /** 是否可以触发交互事件 */
4
+ isInteractive?: boolean;
5
+ /** 是否可以触发悬停事件 */
6
+ isHoverable?: boolean;
7
+ /** 是否可以触发按下事件 */
8
+ isDownable?: boolean;
9
+ /** 是否可以触发右击事件 */
10
+ isContextmenuable?: boolean;
11
+ /** 是否可以触发点击事件 */
12
+ isClickable?: boolean;
13
+ /** 是否可以触发双击事件 */
14
+ isDoubleClickable?: boolean;
15
+ /** 是否可以触发拖动事件 */
16
+ isDraggable?: boolean;
17
+ /** 是否可以触发滚轮滚动事件 */
18
+ isWheelable?: boolean;
19
+ };
20
+ export default abstract class EventControllerBasedata<T extends EventControllerBasedata<T>> extends BaseData<T> {
21
+ private _isInteractive;
22
+ /** 是否可以触发交互事件 */
23
+ get isInteractive(): boolean;
24
+ set isInteractive(value: boolean);
25
+ private _isHoverable;
26
+ /** 是否可以触发悬停事件 */
27
+ get isHoverable(): boolean;
28
+ set isHoverable(value: boolean);
29
+ private _isDownable;
30
+ /** 是否可以触发按下事件 */
31
+ get isDownable(): boolean;
32
+ set isDownable(value: boolean);
33
+ private _isContextmenuable;
34
+ /** 是否可以触发右击事件 */
35
+ get isContextmenuable(): boolean;
36
+ set isContextmenuable(value: boolean);
37
+ private _isClickable;
38
+ /** 是否可以触发点击事件 */
39
+ get isClickable(): boolean;
40
+ set isClickable(value: boolean);
41
+ private _isDoubleClickable;
42
+ /** 是否可以触发双击事件 */
43
+ get isDoubleClickable(): boolean;
44
+ set isDoubleClickable(value: boolean);
45
+ private _isDraggable;
46
+ /** 是否可以触发拖动事件 */
47
+ get isDraggable(): boolean;
48
+ set isDraggable(value: boolean);
49
+ private _isWheelable;
50
+ /** 是否可以触发滚轮滚动事件 */
51
+ get isWheelable(): boolean;
52
+ set isWheelable(value: boolean);
53
+ /**
54
+ * 通用属性获取方法
55
+ * @param parentProp 父级属性名
56
+ * @param ownValue 当前实例的属性值
57
+ * @param checkInteractive 是否检查交互状态(isInteractive 属性专用)
58
+ */
59
+ private getPropValue;
60
+ constructor(options: EventControllerOptions<T>);
61
+ }
62
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare class _Number {
2
+ static add(a: number, b: number): number;
3
+ static sub(a: number, b: number): number;
4
+ static mul(a: number, b: number): number;
5
+ static div(a: number, b: number): number;
6
+ }
@@ -0,0 +1,256 @@
1
+ export declare const EXTENSION_TO_MIME: {
2
+ ".mp3": string;
3
+ ".mp4": string;
4
+ ".m4a": string;
5
+ ".aac": string;
6
+ ".ogg": string;
7
+ ".wav": string;
8
+ ".flac": string;
9
+ ".opus": string;
10
+ ".webm": string;
11
+ ".avi": string;
12
+ ".mov": string;
13
+ ".wmv": string;
14
+ ".png": string;
15
+ ".jpg": string;
16
+ ".jpeg": string;
17
+ ".gif": string;
18
+ ".bmp": string;
19
+ ".tiff": string;
20
+ ".ico": string;
21
+ ".svg": string;
22
+ ".webp": string;
23
+ ".heif": string;
24
+ ".heic": string;
25
+ ".json": string;
26
+ ".xml": string;
27
+ ".html": string;
28
+ ".htm": string;
29
+ ".css": string;
30
+ ".js": string;
31
+ ".ts": string;
32
+ ".csv": string;
33
+ ".tsv": string;
34
+ ".txt": string;
35
+ ".md": string;
36
+ ".rtf": string;
37
+ ".pdf": string;
38
+ ".zip": string;
39
+ ".rar": string;
40
+ ".tar": string;
41
+ ".gz": string;
42
+ ".7z": string;
43
+ ".exe": string;
44
+ ".apk": string;
45
+ ".doc": string;
46
+ ".docx": string;
47
+ ".xls": string;
48
+ ".xlsx": string;
49
+ ".ppt": string;
50
+ ".pptx": string;
51
+ ".odt": string;
52
+ ".ods": string;
53
+ ".odp": string;
54
+ ".jsonld": string;
55
+ ".yaml": string;
56
+ ".yml": string;
57
+ ".woff": string;
58
+ ".woff2": string;
59
+ ".ttf": string;
60
+ ".otf": string;
61
+ ".eot": string;
62
+ ".map": string;
63
+ };
64
+ /** 文件扩展名对应的MIME类型 */
65
+ export declare const FILE_EXTENSIONS: {
66
+ image: string[];
67
+ ppt: string[];
68
+ word: string[];
69
+ excel: string[];
70
+ pdf: string[];
71
+ text: string[];
72
+ audio: string[];
73
+ video: string[];
74
+ archive: string[];
75
+ code: string[];
76
+ font: string[];
77
+ database: string[];
78
+ markup: string[];
79
+ configuration: string[];
80
+ logs: string[];
81
+ script: string[];
82
+ };
83
+ /** 文件扩展名 */
84
+ export type FileType = keyof typeof FILE_EXTENSIONS;
85
+ /** 单位标签 */
86
+ export declare const UNIT_LABELS: readonly ["", "万", "亿", "兆", "京", "垓", "秭", "穰", "沟", "涧", "正", "载", "极"];
87
+ /** 浏览器窗口目标 */
88
+ export declare const WINDOW_TARGET: readonly ["_self", "_blank", "_parent", "_top"];
89
+ /** 浏览器窗口目标类型 */
90
+ export type WindowTarget = (typeof WINDOW_TARGET)[number];
91
+ /** 纸张尺寸 */
92
+ export declare const PAPER_SIZE_DEFINITIONS: {
93
+ readonly Letter: {
94
+ readonly width: 215.9;
95
+ readonly height: 279.4;
96
+ };
97
+ readonly Legal: {
98
+ readonly width: 215.9;
99
+ readonly height: 355.6;
100
+ };
101
+ readonly Tabloid: {
102
+ readonly width: 279.4;
103
+ readonly height: 431.8;
104
+ };
105
+ readonly Ledger: {
106
+ readonly width: 431.8;
107
+ readonly height: 279.4;
108
+ };
109
+ readonly Executive: {
110
+ readonly width: 184.2;
111
+ readonly height: 266.7;
112
+ };
113
+ readonly Folio: {
114
+ readonly width: 215.9;
115
+ readonly height: 330.2;
116
+ };
117
+ readonly Quarto: {
118
+ readonly width: 215;
119
+ readonly height: 275;
120
+ };
121
+ readonly "Government-Letter": {
122
+ readonly width: 203.2;
123
+ readonly height: 266.7;
124
+ };
125
+ readonly A0: {
126
+ readonly width: 841;
127
+ readonly height: 1189;
128
+ };
129
+ readonly A1: {
130
+ readonly width: 594;
131
+ readonly height: 841;
132
+ };
133
+ readonly A2: {
134
+ readonly width: 420;
135
+ readonly height: 594;
136
+ };
137
+ readonly A3: {
138
+ readonly width: 297;
139
+ readonly height: 420;
140
+ };
141
+ readonly A4: {
142
+ readonly width: 210;
143
+ readonly height: 297;
144
+ };
145
+ readonly A5: {
146
+ readonly width: 148;
147
+ readonly height: 210;
148
+ };
149
+ readonly A6: {
150
+ readonly width: 105;
151
+ readonly height: 148;
152
+ };
153
+ readonly A7: {
154
+ readonly width: 74;
155
+ readonly height: 105;
156
+ };
157
+ readonly A8: {
158
+ readonly width: 52;
159
+ readonly height: 74;
160
+ };
161
+ readonly A9: {
162
+ readonly width: 37;
163
+ readonly height: 52;
164
+ };
165
+ readonly A10: {
166
+ readonly width: 26;
167
+ readonly height: 37;
168
+ };
169
+ readonly B0: {
170
+ readonly width: 1000;
171
+ readonly height: 1414;
172
+ };
173
+ readonly B1: {
174
+ readonly width: 707;
175
+ readonly height: 1000;
176
+ };
177
+ readonly B2: {
178
+ readonly width: 500;
179
+ readonly height: 707;
180
+ };
181
+ readonly B3: {
182
+ readonly width: 353;
183
+ readonly height: 500;
184
+ };
185
+ readonly B4: {
186
+ readonly width: 250;
187
+ readonly height: 353;
188
+ };
189
+ readonly B5: {
190
+ readonly width: 176;
191
+ readonly height: 250;
192
+ };
193
+ readonly B6: {
194
+ readonly width: 125;
195
+ readonly height: 176;
196
+ };
197
+ readonly B7: {
198
+ readonly width: 88;
199
+ readonly height: 125;
200
+ };
201
+ readonly B8: {
202
+ readonly width: 62;
203
+ readonly height: 88;
204
+ };
205
+ readonly B9: {
206
+ readonly width: 44;
207
+ readonly height: 62;
208
+ };
209
+ readonly B10: {
210
+ readonly width: 31;
211
+ readonly height: 44;
212
+ };
213
+ readonly C0: {
214
+ readonly width: 917;
215
+ readonly height: 1297;
216
+ };
217
+ readonly C1: {
218
+ readonly width: 648;
219
+ readonly height: 917;
220
+ };
221
+ readonly C2: {
222
+ readonly width: 458;
223
+ readonly height: 648;
224
+ };
225
+ readonly C3: {
226
+ readonly width: 324;
227
+ readonly height: 458;
228
+ };
229
+ readonly C4: {
230
+ readonly width: 229;
231
+ readonly height: 324;
232
+ };
233
+ readonly C5: {
234
+ readonly width: 162;
235
+ readonly height: 229;
236
+ };
237
+ readonly C6: {
238
+ readonly width: 114;
239
+ readonly height: 162;
240
+ };
241
+ readonly C7: {
242
+ readonly width: 81;
243
+ readonly height: 114;
244
+ };
245
+ readonly C8: {
246
+ readonly width: 57;
247
+ readonly height: 81;
248
+ };
249
+ };
250
+ /** 纸张尺寸 */
251
+ export type PaperType = keyof typeof PAPER_SIZE_DEFINITIONS;
252
+ /** 纸张尺寸列表 */
253
+ export declare const PAPER_SIZE_OPTIONS: {
254
+ value: string;
255
+ label: string;
256
+ }[];
@@ -0,0 +1,108 @@
1
+ import { DragOption, LocalDragOptions, UiLibrary } from './type';
2
+ /**
3
+ * 滚动结束监听器
4
+ * @param {(trigger: "vertical" | "horizontal") => void} callback
5
+ */
6
+ export declare function _Element_ScrollEndListener(callback: (trigger: "vertical" | "horizontal") => void): (payload: Event) => void;
7
+ /**
8
+ * 点击非指定dom(包含子级dom)时执行 callback
9
+ * @param querySelector 允许点击的 dom 顶层祖先元素选择器
10
+ * @param callback 满足条件时执行的回调
11
+ *
12
+ * @param options 其他配置
13
+ * @param options.uiLibrary 项目使用的 ui库 , 用于排除 ui库 创建的元素 , 避免点击 ui库 创建的元素时意外的执行 callback
14
+ * @param options.isClickAllowed 是否允许该点击 ( 如果不确定可以返回 undefined )
15
+ */
16
+ export declare function _Element_CloseOnOutsideClick(querySelector: string[], callback: Function, options?: {
17
+ uiLibrary?: UiLibrary[];
18
+ isClickAllowed?: (event: MouseEvent) => boolean | undefined;
19
+ }): void;
20
+ /** 拖拽dom */
21
+ export declare class _Element_Drag {
22
+ #private;
23
+ init(dom: HTMLElement, option?: DragOption): void;
24
+ finish(): void;
25
+ bindOrUnbindEvent(type: "bind" | "unbind"): void;
26
+ alterLocation(): void;
27
+ mousedown(event: Event): void;
28
+ mousemove(event: Event): void;
29
+ mouseup(): void;
30
+ }
31
+ /** 局部拖拽 计算位置距离/百分比 */
32
+ export declare class _Element_LocalDrag {
33
+ #private;
34
+ init(parentDom: HTMLElement, options?: LocalDragOptions): void;
35
+ finish(): void;
36
+ bindOrUnbindEvent(type: "bind" | "unbind"): void;
37
+ updateValue(): {
38
+ top: number;
39
+ left: number;
40
+ percentage: {
41
+ top: number;
42
+ left: number;
43
+ };
44
+ };
45
+ alterLocation(): void;
46
+ mousedown(event: Event): void;
47
+ mousemove(event: Event): void;
48
+ mouseup(): void;
49
+ }
50
+ /** 进入全屏模式 */
51
+ export declare function _Element_EnterFullscreen(element?: HTMLElement | string): Promise<void>;
52
+ /** 退出全屏模式 */
53
+ export declare function _Element_ExitFullscreen(): Promise<void>;
54
+ /** 判断是否处于全屏模式 */
55
+ export declare function _Element_IsFullscreen(element?: HTMLElement | string): boolean;
56
+ /**
57
+ * 返回一个用于切换全屏模式的函数
58
+ * @param {HTMLElement} content - 需要进入全屏的元素
59
+ * 该函数通过检查不同浏览器的特定方法来实现全屏切换
60
+ */
61
+ export declare function _Element_Fullscreen(element?: HTMLElement | string): () => void;
62
+ /**
63
+ * 元素全屏状态观察器
64
+ * 监听元素的全屏状态变化,并通过回调函数通知状态改变
65
+ * @param notify - 全屏状态变化回调函数,接收一个布尔值参数表示当前是否为全屏状态
66
+ * @param selectors - 要观察的元素或元素选择器,默认为document.documentElement
67
+ * @returns 返回一个清理函数,调用后可移除所有事件监听器
68
+ */
69
+ export declare function _Element_FullscreenObserver(notify: (isFull: boolean) => void, selectors?: HTMLElement | string): () => void;
70
+ /**
71
+ * 单位转换 12** -> **px
72
+ * @param {string} width
73
+ * @returns 对应的单位为px的宽
74
+ */
75
+ export declare function _Element_GetOtherSizeInPixels(width: string, target?: HTMLElement): number;
76
+ /**
77
+ * 根据给定的宽高比和目标元素或尺寸,计算画布的尺寸
78
+ * 此函数旨在适应不同场景下,如何根据宽高比约束,计算出适合的画布大小
79
+ *
80
+ * @param aspectRatio 宽高比,表示期望的画布宽度与高度的比例
81
+ * @param target 目标元素或尺寸,可以是DOM元素、选择器字符串或尺寸数组
82
+ * @returns 返回计算后的画布尺寸,格式为[宽度, 高度]
83
+ */
84
+ export declare function _Element_CalculateCanvasSize(aspectRatio: number, target: Element | string | [number, number]): number[] | undefined;
85
+ /**
86
+ * 异步加载图片,并返回图片对象及其宽高比
87
+ * @param src 图片的URL地址
88
+ * @param timeout 超时时间,单位为毫秒,默认为5000ms
89
+ * @returns 一个Promise对象,包含加载的图片对象及其宽高比
90
+ */
91
+ export declare function _Element_LoadImage(src: string, timeout?: number): Promise<[HTMLImageElement, number]>;
92
+ /**
93
+ * 检查指定dom内所有图片的加载状态并返回结果
94
+ * @param id - 图片ID
95
+ * @returns - 图片加载状态信息
96
+ */
97
+ export declare function _Element_CheckImagesLoaded(id: string): Promise<{
98
+ /** 是否全部加载完成 */
99
+ allLoaded: boolean;
100
+ /** 成功加载的图片数量 */
101
+ loaded: number;
102
+ /** 加载失败的图片数量 */
103
+ failed: number;
104
+ /** 总图片数量 */
105
+ total: number;
106
+ /** 加载失败的图片列表 */
107
+ errors: HTMLImageElement[];
108
+ }>;