@ibiz-template/vue3-components 0.7.41-alpha.45 → 0.7.41-alpha.46

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 (72) hide show
  1. package/dist/{index-DgqTP4Vw.js → index-B0XiEslO.js} +1 -1
  2. package/dist/{index-Dr0VM8iS.js → index-B6kaPJDO.js} +1 -1
  3. package/dist/{index-yLzheFmH.js → index-DTj1Yy9-.js} +4 -4
  4. package/dist/index.min.css +1 -1
  5. package/dist/index.system.min.js +1 -1
  6. package/dist/{wang-editor-homqxACE.js → wang-editor-CRTv7Ujm.js} +1 -1
  7. package/dist/{xlsx-util-C5MBICNN.js → xlsx-util-CqW4WJ9G.js} +1 -1
  8. package/es/common/button-list/button-list.css +1 -1
  9. package/es/index.mjs +1 -0
  10. package/es/locale/en/index.mjs +13 -0
  11. package/es/locale/zh-CN/index.mjs +13 -0
  12. package/es/node_modules/.pnpm/modern-screenshot@4.6.7/node_modules/modern-screenshot/dist/index.mjs +1652 -0
  13. package/es/util/ai-chat-util/ai-chat-util.mjs +21 -21
  14. package/es/util/app-util/app-util.mjs +2 -4
  15. package/es/util/index.mjs +1 -0
  16. package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +3 -3
  17. package/es/util/screen-shot-util/screen-shot/components/index.mjs +3 -0
  18. package/es/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.css +1 -0
  19. package/es/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.mjs +113 -0
  20. package/es/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.css +1 -0
  21. package/es/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.mjs +105 -0
  22. package/es/util/screen-shot-util/screen-shot/constant/index.mjs +172 -0
  23. package/es/util/screen-shot-util/screen-shot/controller/index.mjs +3 -0
  24. package/es/util/screen-shot-util/screen-shot/controller/screen-shot.controller.mjs +366 -0
  25. package/es/util/screen-shot-util/screen-shot/controller/screen-shot.store.mjs +51 -0
  26. package/es/util/screen-shot-util/screen-shot/icon/icon.mjs +90 -0
  27. package/es/util/screen-shot-util/screen-shot/icon/index.mjs +3 -0
  28. package/es/util/screen-shot-util/screen-shot/index.mjs +4 -0
  29. package/es/util/screen-shot-util/screen-shot/module/draw-arrow.mjs +109 -0
  30. package/es/util/screen-shot-util/screen-shot/module/draw-circle.mjs +25 -0
  31. package/es/util/screen-shot-util/screen-shot/module/draw-mosaic.mjs +54 -0
  32. package/es/util/screen-shot-util/screen-shot/module/draw-pencil.mjs +15 -0
  33. package/es/util/screen-shot-util/screen-shot/module/draw-rectangle.mjs +12 -0
  34. package/es/util/screen-shot-util/screen-shot/module/draw-text.mjs +12 -0
  35. package/es/util/screen-shot-util/screen-shot/module/index.mjs +8 -0
  36. package/es/util/screen-shot-util/screen-shot/type/index.mjs +16 -0
  37. package/es/util/screen-shot-util/screen-shot/util/index.mjs +8 -0
  38. package/es/util/screen-shot-util/screen-shot-util.mjs +67 -0
  39. package/es/web-app/main.mjs +2 -0
  40. package/lib/common/button-list/button-list.css +1 -1
  41. package/lib/index.cjs +2 -0
  42. package/lib/locale/en/index.cjs +13 -0
  43. package/lib/locale/zh-CN/index.cjs +13 -0
  44. package/lib/node_modules/.pnpm/modern-screenshot@4.6.7/node_modules/modern-screenshot/dist/index.cjs +1667 -0
  45. package/lib/util/ai-chat-util/ai-chat-util.cjs +21 -21
  46. package/lib/util/app-util/app-util.cjs +2 -4
  47. package/lib/util/index.cjs +2 -0
  48. package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +3 -3
  49. package/lib/util/screen-shot-util/screen-shot/components/index.cjs +7 -0
  50. package/lib/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.cjs +115 -0
  51. package/lib/util/screen-shot-util/screen-shot/components/screen-shot/screen-shot.css +1 -0
  52. package/lib/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.cjs +107 -0
  53. package/lib/util/screen-shot-util/screen-shot/components/screen-shot-toolbar/screen-shot-toolbar.css +1 -0
  54. package/lib/util/screen-shot-util/screen-shot/constant/index.cjs +174 -0
  55. package/lib/util/screen-shot-util/screen-shot/controller/index.cjs +7 -0
  56. package/lib/util/screen-shot-util/screen-shot/controller/screen-shot.controller.cjs +368 -0
  57. package/lib/util/screen-shot-util/screen-shot/controller/screen-shot.store.cjs +53 -0
  58. package/lib/util/screen-shot-util/screen-shot/icon/icon.cjs +100 -0
  59. package/lib/util/screen-shot-util/screen-shot/icon/index.cjs +15 -0
  60. package/lib/util/screen-shot-util/screen-shot/index.cjs +8 -0
  61. package/lib/util/screen-shot-util/screen-shot/module/draw-arrow.cjs +111 -0
  62. package/lib/util/screen-shot-util/screen-shot/module/draw-circle.cjs +27 -0
  63. package/lib/util/screen-shot-util/screen-shot/module/draw-mosaic.cjs +56 -0
  64. package/lib/util/screen-shot-util/screen-shot/module/draw-pencil.cjs +18 -0
  65. package/lib/util/screen-shot-util/screen-shot/module/draw-rectangle.cjs +14 -0
  66. package/lib/util/screen-shot-util/screen-shot/module/draw-text.cjs +14 -0
  67. package/lib/util/screen-shot-util/screen-shot/module/index.cjs +18 -0
  68. package/lib/util/screen-shot-util/screen-shot/type/index.cjs +18 -0
  69. package/lib/util/screen-shot-util/screen-shot/util/index.cjs +10 -0
  70. package/lib/util/screen-shot-util/screen-shot-util.cjs +69 -0
  71. package/lib/web-app/main.cjs +2 -0
  72. package/package.json +6 -5
@@ -0,0 +1,366 @@
1
+ import { domToCanvas } from '../../../../node_modules/.pnpm/modern-screenshot@4.6.7/node_modules/modern-screenshot/dist/index.mjs';
2
+ import { ScreenShotStore } from './screen-shot.store.mjs';
3
+ import { ToolbarItemType } from '../type/index.mjs';
4
+ import '../module/index.mjs';
5
+ import { getMousePosition } from '../util/index.mjs';
6
+ import { DrawArrow } from '../module/draw-arrow.mjs';
7
+ import { drawText } from '../module/draw-text.mjs';
8
+ import { initPencil, drawPencil } from '../module/draw-pencil.mjs';
9
+ import { drawMosaic } from '../module/draw-mosaic.mjs';
10
+ import { drawCircle } from '../module/draw-circle.mjs';
11
+ import { drawRectangle } from '../module/draw-rectangle.mjs';
12
+
13
+ "use strict";
14
+ var __defProp = Object.defineProperty;
15
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
+ var __publicField = (obj, key, value) => {
17
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
18
+ return value;
19
+ };
20
+ class ScreenShotController {
21
+ /**
22
+ * Creates an instance of ScreenShotController.
23
+ * @memberof ScreenShotController
24
+ */
25
+ constructor() {
26
+ /**
27
+ * @description 状态对象
28
+ * @type {ScreenShotState}
29
+ * @memberof ScreenShotController
30
+ */
31
+ __publicField(this, "store");
32
+ /**
33
+ * @description 当前工具
34
+ * @private
35
+ * @type {ToolbarItemType}
36
+ * @memberof ScreenShotController
37
+ */
38
+ __publicField(this, "toolName");
39
+ /**
40
+ * @description 画笔配置
41
+ * @private
42
+ * @type {IBrushOption}
43
+ * @memberof ScreenShotController
44
+ */
45
+ __publicField(this, "brushOption");
46
+ /**
47
+ * @description 画布上下文
48
+ * @private
49
+ * @type {(CanvasRenderingContext2D | undefined)}
50
+ * @memberof ScreenShotController
51
+ */
52
+ __publicField(this, "canvasCtx");
53
+ /**
54
+ * @description 绘制状态
55
+ * @private
56
+ * @type {boolean}
57
+ * @memberof ScreenShotController
58
+ */
59
+ __publicField(this, "drawing", false);
60
+ /**
61
+ * @description 最大可撤销次数
62
+ * @private
63
+ * @type {number}
64
+ * @memberof ScreenShotController
65
+ */
66
+ __publicField(this, "maxUndoNum", 15);
67
+ /**
68
+ * @description 文本输入框位置
69
+ * @private
70
+ * @type {IMousePosition}
71
+ * @memberof ScreenShotController
72
+ */
73
+ __publicField(this, "textInputInfo", {
74
+ mouseX: 0,
75
+ mouseY: 0,
76
+ size: 14,
77
+ color: "#F53340"
78
+ });
79
+ /**
80
+ * @description 图形位置参数
81
+ * @private
82
+ * @type {IMousePosition}
83
+ * @memberof ScreenShotController
84
+ */
85
+ __publicField(this, "drawGraphPosition", {
86
+ mouseX: 0,
87
+ mouseY: 0
88
+ });
89
+ /**
90
+ * @description 递增变粗箭头的实现
91
+ * @private
92
+ * @memberof ScreenShotController
93
+ */
94
+ __publicField(this, "drawArrow", new DrawArrow());
95
+ this.store = new ScreenShotStore();
96
+ }
97
+ /**
98
+ * @description 显示最新的画布状态
99
+ * @private
100
+ * @memberof ScreenShotController
101
+ */
102
+ showLastHistory() {
103
+ if (!this.canvasCtx)
104
+ return;
105
+ if (this.store.history.value.length <= 0)
106
+ this.addHistory();
107
+ const data = this.store.history.value[this.store.history.value.length - 1].data;
108
+ this.canvasCtx.putImageData(data, 0, 0);
109
+ }
110
+ /**
111
+ * @description 添加历史
112
+ * @private
113
+ * @memberof ScreenShotController
114
+ */
115
+ addHistory() {
116
+ if (!this.store.canvasElement.value || !this.canvasCtx)
117
+ return;
118
+ if (this.store.history.value.length > this.maxUndoNum)
119
+ this.store.history.value.shift();
120
+ const controller = this.store.canvasElement.value;
121
+ this.store.history.value.push({
122
+ data: this.canvasCtx.getImageData(
123
+ 0,
124
+ 0,
125
+ controller.width,
126
+ controller.height
127
+ )
128
+ });
129
+ }
130
+ /**
131
+ * @description 回退历史
132
+ * @private
133
+ * @memberof ScreenShotController
134
+ */
135
+ goBackToHistory() {
136
+ var _a;
137
+ if (!this.store.history.value.length)
138
+ return;
139
+ this.store.history.value.pop();
140
+ const data = (_a = this.store.history.value[this.store.history.value.length - 1]) == null ? void 0 : _a.data;
141
+ if (this.canvasCtx && data)
142
+ this.canvasCtx.putImageData(data, 0, 0);
143
+ }
144
+ /**
145
+ * @description 启用文本编辑
146
+ * @private
147
+ * @param {number} X
148
+ * @param {number} Y
149
+ * @returns {*} {void}
150
+ * @memberof ScreenShotController
151
+ */
152
+ enableTextEditing(event) {
153
+ const element = this.store.textInputElement.value;
154
+ if (!this.canvasCtx || !element || !this.brushOption)
155
+ return;
156
+ this.showLastHistory();
157
+ this.store.textStatus.value = true;
158
+ const { clientX, clientY } = event;
159
+ const { mouseX, mouseY, size, color } = this.textInputInfo;
160
+ const position = getMousePosition(event);
161
+ if (element.innerText && mouseX !== 0 && mouseY !== 0 && mouseX !== position.mouseX && mouseY !== position.mouseY) {
162
+ drawText(
163
+ element.innerText,
164
+ this.textInputInfo.mouseX,
165
+ this.textInputInfo.mouseY,
166
+ color,
167
+ size,
168
+ this.canvasCtx
169
+ );
170
+ element.innerText = "";
171
+ this.addHistory();
172
+ }
173
+ element.style.fontFamily = "none";
174
+ element.style.left = "".concat(clientX, "px");
175
+ element.style.fontSize = "".concat(this.brushOption.size, "px");
176
+ element.style.color = this.brushOption.color;
177
+ setTimeout(() => {
178
+ const containerHeight = element.offsetHeight;
179
+ element.style.top = "".concat(clientY - Math.floor(containerHeight / 2), "px");
180
+ element.focus();
181
+ this.textInputInfo = {
182
+ mouseX: position.mouseX,
183
+ mouseY: position.mouseY,
184
+ size: this.brushOption.size,
185
+ color: this.brushOption.color
186
+ };
187
+ });
188
+ }
189
+ /**
190
+ * @description 结束文本编辑
191
+ * @private
192
+ * @returns {*} {void}
193
+ * @memberof ScreenShotController
194
+ */
195
+ endTextEditing() {
196
+ const element = this.store.textInputElement.value;
197
+ if (!element || !this.canvasCtx)
198
+ return;
199
+ if (element.innerText) {
200
+ const { mouseX, mouseY, size, color } = this.textInputInfo;
201
+ drawText(element.innerText, mouseX, mouseY, color, size, this.canvasCtx);
202
+ this.addHistory();
203
+ }
204
+ element.innerHTML = "";
205
+ this.store.textStatus.value = false;
206
+ }
207
+ /**
208
+ * @description DOM生成Canvas
209
+ * @param {HTMLElement} el DOM元素
210
+ * @param {{ container?: HTMLElement; itemClassName?: string }} opts 如果需针对dom内部滚动容器截图,则需配置:滚动容器,滚动容器项类名,用以排除非可视区元素
211
+ * @returns {*} {Promise<void>}
212
+ * @memberof ScreenShotController
213
+ */
214
+ async domToCanvas(el, opts) {
215
+ var _a;
216
+ this.store.isLoading.value = true;
217
+ const { container, itemClassName } = opts;
218
+ const containerRect = container == null ? void 0 : container.getBoundingClientRect();
219
+ const canvas = await domToCanvas(el, {
220
+ scale: window.devicePixelRatio || 1,
221
+ quality: 1,
222
+ filter: (node) => {
223
+ var _a2, _b;
224
+ if (containerRect && itemClassName) {
225
+ const element = node;
226
+ if ((container == null ? void 0 : container.contains(element)) && ((_a2 = element.classList) == null ? void 0 : _a2.contains(itemClassName))) {
227
+ const elementRect = (_b = element.getBoundingClientRect) == null ? void 0 : _b.call(element);
228
+ if (elementRect)
229
+ return elementRect.bottom > containerRect.top && elementRect.top < containerRect.bottom && elementRect.right > containerRect.left && elementRect.left < containerRect.right;
230
+ }
231
+ }
232
+ return true;
233
+ }
234
+ });
235
+ this.canvasCtx = (_a = this.store.canvasElement.value) == null ? void 0 : _a.getContext("2d");
236
+ if (this.canvasCtx) {
237
+ this.store.canvasElement.value.width = canvas.width;
238
+ this.store.canvasElement.value.height = canvas.height;
239
+ this.store.canvasElement.value.style.top = "".concat(el.offsetTop, "px");
240
+ this.store.canvasElement.value.style.left = "".concat(el.offsetLeft, "px");
241
+ this.canvasCtx.drawImage(canvas, 0, 0);
242
+ }
243
+ this.store.isLoading.value = false;
244
+ this.store.toolbarStatus.value = true;
245
+ }
246
+ /**
247
+ * @description 工具点击
248
+ * @param {ToolbarItemType} toolName
249
+ * @param {IBrushOption} opt
250
+ * @memberof ScreenShotController
251
+ */
252
+ onToolClick(toolName, opt) {
253
+ if (toolName === ToolbarItemType.DRAWDOWN)
254
+ this.goBackToHistory();
255
+ this.brushOption = opt;
256
+ this.toolName = toolName;
257
+ this.endTextEditing();
258
+ }
259
+ /**
260
+ * @description 鼠标按下
261
+ * @param {MouseEvent} event
262
+ * @memberof ScreenShotController
263
+ */
264
+ mouseDownEvent(event) {
265
+ if (event.button !== 0 || !this.toolName || this.toolName === ToolbarItemType.DRAWDOWN || !this.canvasCtx)
266
+ return;
267
+ this.drawing = true;
268
+ const { mouseX, mouseY } = getMousePosition(event);
269
+ Object.assign(this.drawGraphPosition, {
270
+ mouseX,
271
+ mouseY
272
+ });
273
+ switch (this.toolName) {
274
+ case ToolbarItemType.BRUSH:
275
+ initPencil(this.canvasCtx, mouseX, mouseY);
276
+ break;
277
+ case ToolbarItemType.TEXT:
278
+ this.enableTextEditing(event);
279
+ break;
280
+ default:
281
+ break;
282
+ }
283
+ }
284
+ /**
285
+ * @description 鼠标移动
286
+ * @param {MouseEvent} event
287
+ * @returns {*} {void}
288
+ * @memberof ScreenShotController
289
+ */
290
+ mouseMoveEvent(event) {
291
+ if (!this.toolName || !this.drawing || !this.canvasCtx || !this.brushOption)
292
+ return;
293
+ const { mouseX, mouseY } = getMousePosition(event);
294
+ const { mouseX: startX, mouseY: startY } = this.drawGraphPosition;
295
+ if (this.toolName !== ToolbarItemType.MOSAIC)
296
+ this.showLastHistory();
297
+ switch (this.toolName) {
298
+ case ToolbarItemType.BRUSH:
299
+ drawPencil(
300
+ this.canvasCtx,
301
+ mouseX,
302
+ mouseY,
303
+ this.brushOption.size,
304
+ this.brushOption.color
305
+ );
306
+ break;
307
+ case ToolbarItemType.RECT:
308
+ drawRectangle(
309
+ startX,
310
+ startY,
311
+ mouseX - startX,
312
+ mouseY - startY,
313
+ this.brushOption.color,
314
+ this.brushOption.size,
315
+ this.canvasCtx
316
+ );
317
+ break;
318
+ case ToolbarItemType.CIRCLE:
319
+ drawCircle(
320
+ this.canvasCtx,
321
+ mouseX,
322
+ mouseY,
323
+ startX,
324
+ startY,
325
+ this.brushOption.size,
326
+ this.brushOption.color
327
+ );
328
+ break;
329
+ case ToolbarItemType.ARROW:
330
+ this.drawArrow.draw(
331
+ this.canvasCtx,
332
+ startX,
333
+ startY,
334
+ mouseX,
335
+ mouseY,
336
+ this.brushOption.color
337
+ );
338
+ break;
339
+ case ToolbarItemType.MOSAIC:
340
+ drawMosaic(
341
+ mouseX - 10,
342
+ mouseY - 10,
343
+ this.brushOption.size,
344
+ 5,
345
+ this.canvasCtx
346
+ );
347
+ break;
348
+ default:
349
+ break;
350
+ }
351
+ }
352
+ /**
353
+ * @description 鼠标抬起
354
+ * @returns {*} {void}
355
+ * @memberof ScreenShotController
356
+ */
357
+ mouseUpEvent() {
358
+ this.drawing = false;
359
+ if (!this.toolName || this.toolName === ToolbarItemType.DRAWDOWN || !this.canvasCtx)
360
+ return;
361
+ if (this.toolName !== ToolbarItemType.TEXT)
362
+ this.addHistory();
363
+ }
364
+ }
365
+
366
+ export { ScreenShotController };
@@ -0,0 +1,51 @@
1
+ import { ref } from 'vue';
2
+
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => {
7
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
+ return value;
9
+ };
10
+ class ScreenShotStore {
11
+ constructor() {
12
+ /**
13
+ * @description 画布元素
14
+ * @type {(Ref<HTMLCanvasElement | undefined>)}
15
+ * @memberof ScreenShotStore
16
+ */
17
+ __publicField(this, "canvasElement", ref(void 0));
18
+ /**
19
+ * @description 文本输入框颜色
20
+ * @type {(Ref<HTMLCanvasElement | undefined>)}
21
+ * @memberof ScreenShotStore
22
+ */
23
+ __publicField(this, "textInputElement", ref(void 0));
24
+ /**
25
+ * @description 加载状态
26
+ * @type {Ref<boolean>}
27
+ * @memberof ScreenShotStore
28
+ */
29
+ __publicField(this, "isLoading", ref(false));
30
+ /**
31
+ * @description 文本状态
32
+ * @type {Ref<boolean>}
33
+ * @memberof ScreenShotStore
34
+ */
35
+ __publicField(this, "textStatus", ref(false));
36
+ /**
37
+ * @description 工具栏状态
38
+ * @type {Ref<boolean>}
39
+ * @memberof ScreenShotStore
40
+ */
41
+ __publicField(this, "toolbarStatus", ref(false));
42
+ /**
43
+ * @description 历史
44
+ * @type {Ref<{ data: ImageData }[]>}
45
+ * @memberof ScreenShotStore
46
+ */
47
+ __publicField(this, "history", ref([]));
48
+ }
49
+ }
50
+
51
+ export { ScreenShotStore };
@@ -0,0 +1,90 @@
1
+ import { createVNode } from 'vue';
2
+
3
+ "use strict";
4
+ const BrushIcon = createVNode("svg", {
5
+ "viewBox": "0 0 1024 1024",
6
+ "version": "1.1",
7
+ "xmlns": "http://www.w3.org/2000/svg",
8
+ "p-id": "72848"
9
+ }, [createVNode("path", {
10
+ "d": "M1.704 971.096l77.824-281.16L746.568 23.12c30.992-30.992 70.944-30.64 101.76 0l152.56 152.544c30.64 30.648 30.992 70.592 0 101.76L334.192 944.4l-281.52 77.824c-38.744 8.096-58.888-12.048-50.968-51.136z m668.76-769.952l152.56 152.368 101.76-101.752c26.336-26.168 24.616-26 0-50.792l-101.76-101.584c-24.112-26-26.352-26-50.8 0l-101.76 101.76z m-483.488 483.28l152.552 152.552L772.056 404.48 619.496 251.92 186.976 684.432zM78.672 945.28l210.064-57.504-152.56-152.544-57.504 210.048z",
11
+ "p-id": "72849"
12
+ }, null)]);
13
+ const RectIcon = createVNode("svg", {
14
+ "viewBox": "0 0 1024 1024",
15
+ "version": "1.1",
16
+ "xmlns": "http://www.w3.org/2000/svg",
17
+ "p-id": "64858"
18
+ }, [createVNode("path", {
19
+ "d": "M26.962385 997.037615v-970.07523h970.07523v970.07523h-970.07523z m913.011981-913.011981h-855.948732v855.948732h855.948732v-855.948732z",
20
+ "p-id": "64859"
21
+ }, null)]);
22
+ const CircleIcon = createVNode("svg", {
23
+ "viewBox": "0 0 1024 1024",
24
+ "version": "1.1",
25
+ "xmlns": "http://www.w3.org/2000/svg",
26
+ "p-id": "65871"
27
+ }, [createVNode("path", {
28
+ "d": "M510.633 120.298c52.92 0 104.269 10.302 152.555 30.725 46.625 19.729 88.611 47.922 124.562 83.795 36.041 35.963 64.295 77.773 83.977 124.293 20.468 48.182 30.791 99.42 30.791 152.231 0 52.806-10.323 104.044-30.791 152.225-19.767 46.524-48.022 88.419-83.977 124.293-36.041 35.963-77.937 64.156-124.562 83.795-48.286 20.424-99.635 30.725-152.555 30.725-52.926 0-104.274-10.301-152.561-30.725-46.621-19.724-88.611-47.918-124.562-83.795-36.041-35.963-64.295-77.768-83.977-124.293-20.467-48.182-30.791-99.42-30.791-152.225 0-52.811 10.324-104.049 30.791-152.231 19.771-46.52 48.026-88.419 83.977-124.293 35.951-35.873 77.941-64.156 124.562-83.795 48.287-20.423 99.636-30.725 152.561-30.725m0-55.862c-247.382 0-447.873 200.058-447.873 446.905 0 246.842 200.491 446.9 447.873 446.9 247.377 0 447.868-200.058 447.868-446.9 0-246.847-200.491-446.905-447.868-446.905z m0 0",
29
+ "p-id": "65872"
30
+ }, null)]);
31
+ const MarkerIcon = createVNode("svg", {
32
+ "preserveAspectRatio": "none",
33
+ "viewBox": "0 0 1024 1024",
34
+ "version": "1.1",
35
+ "xmlns": "http://www.w3.org/2000/svg",
36
+ "p-id": "55036"
37
+ }, [createVNode("path", {
38
+ "d": "M512.01893 1.779421c-282.28432 0-511.110289 228.82597-511.110289 511.110289s228.82597 511.110289 511.110289 511.110289c282.26539 0 511.091359-228.82597 511.091359-511.110289S794.28432 1.779421 512.01893 1.779421zM512 986.139979c-261.366658 0-473.250268-211.88361-473.250268-473.250268 0-261.385588 211.88361-473.250268 473.250268-473.250268 261.385588 0 473.269198 211.88361 473.269198 473.250268C985.269198 774.237439 773.385588 986.139979 512 986.139979zM406.90058 399.309646l0 56.790032c40.207343-16.544829 71.574371-33.108589 94.063223-49.691278l0 269.752653 58.550523 0L559.514327 301.706511l-44.353015 0C502.118534 341.932784 466.037934 374.454542 406.90058 399.309646z",
39
+ "p-id": "55037"
40
+ }, null)]);
41
+ const TextIcon = createVNode("svg", {
42
+ "preserveAspectRatio": "none",
43
+ "viewBox": "0 0 1024 1024",
44
+ "version": "1.1",
45
+ "xmlns": "http://www.w3.org/2000/svg",
46
+ "p-id": "17173"
47
+ }, [createVNode("path", {
48
+ "d": "M832 896H730.56l-72.576-210.24H361.856L293.44 896H192l270.848-768h98.24L832 896zM629.504 598.976L522.112 279.68c-3.392-10.176-7.04-28.096-11.008-53.504H508.8c-3.392 23.168-7.232 40.96-11.456 53.504l-106.56 319.296h238.72z",
49
+ "p-id": "17174"
50
+ }, null)]);
51
+ const ArrowIcon = createVNode("svg", {
52
+ "preserveAspectRatio": "none",
53
+ "viewBox": "0 0 1024 1024",
54
+ "version": "1.1",
55
+ "xmlns": "http://www.w3.org/2000/svg",
56
+ "p-id": "23296"
57
+ }, [createVNode("path", {
58
+ "d": "M738.133333 256L230.4 763.733333l29.866667 29.866667L768 285.866667V554.666667h42.666667V213.333333h-341.333334v42.666667h268.8z",
59
+ "p-id": "23297"
60
+ }, null)]);
61
+ const AIIcon = createVNode("svg", {
62
+ "version": "1.1",
63
+ "xmlns": "http://www.w3.org/2000/svg",
64
+ "preserveAspectRatio": "none",
65
+ "viewBox": "0 0 1024 1024"
66
+ }, [createVNode("path", {
67
+ "d": "M274.344554 173.673875c16.429399 0 30.950568 8.00526 39.956484 20.338945a34.906655 34.906655 0 0 1 14.660796 15.754537l1.117013 2.815803 210.138065 597.927736c6.795162 19.268474-5.329083 40.817516-27.041022 48.147913-20.641469 6.95806-42.493035-1.419537-50.451753-18.803052l-1.117013-2.815803-54.477653-154.939008H134.997185L80.566074 837.039954c-6.771891 19.268474-29.856826 28.949253-51.568765 21.618855-20.641469-6.981331-32.602816-26.761769-27.925325-45.239025l0.861031-2.908888L212.047809 212.58316c4.025901-11.426112 13.799764-19.477914 25.598214-22.619512 9.029188-10.006575 22.107548-16.289773 36.67526-16.289773z m386.416675 169.460176c21.828295 0 39.723774 10.890876 41.469106 24.713912l0.116356 2.210755v461.652153c0 14.893506-18.616883 26.947938-41.585462 26.947938-21.805024 0-39.700503-10.890876-41.422565-24.737183l-0.162897-2.210755V370.081989c0-14.870235 18.616883-26.924667 41.585462-26.924667z m-389.697901-48.171184L163.620643 600.628812h214.88537l-107.442685-305.665945z m602.163076-206.181978a12.566396 12.566396 0 0 1 8.144887 8.051802l32.509731 99.041817 101.694723 36.07021a12.566396 12.566396 0 0 1-0.791218 23.922695l-99.53051 27.995137-30.857483 97.552467a12.566396 12.566396 0 0 1-23.899423 0.116355l-32.509732-99.018546-98.669479-31.322905a12.566396 12.566396 0 0 1-0.186169-23.876152l97.505924-32.812256 30.834212-97.529195a12.566396 12.566396 0 0 1 15.754537-8.191429zM649.544557 0.513593c2.676177 0.884302 4.770576 3.025243 5.608336 5.724692l18.523798 59.294772 60.970292 20.66474a8.796477 8.796477 0 0 1-0.325796 16.755194l-60.73758 18.058377-19.780438 59.550754a8.796477 8.796477 0 0 1-16.731924-0.162898l-18.523798-59.271501-59.062061-17.825665a8.796477 8.796477 0 0 1-0.395609-16.708653l59.574025-20.943993 19.780438-59.574025a8.796477 8.796477 0 0 1 11.100317-5.561794z"
68
+ }, null)]);
69
+ const MosaicIcon = createVNode("svg", {
70
+ "class": "icon",
71
+ "viewBox": "0 0 1024 1024",
72
+ "version": "1.1",
73
+ "xmlns": "http://www.w3.org/2000/svg",
74
+ "p-id": "73852"
75
+ }, [createVNode("path", {
76
+ "d": "M512 64h448v896H64V64h448z m192 64h-192v384h384V128h-192zM320 512H128v384h384V512h-192z",
77
+ "p-id": "73853"
78
+ }, null)]);
79
+ const DrawdownIcon = createVNode("svg", {
80
+ "class": "icon",
81
+ "viewBox": "0 0 1024 1024",
82
+ "version": "1.1",
83
+ "xmlns": "http://www.w3.org/2000/svg",
84
+ "p-id": "80469"
85
+ }, [createVNode("path", {
86
+ "d": "M341.333333 298.666667v170.666666L85.333333 256l256-213.333333v170.666666h213.333334a341.333333 341.333333 0 1 1 0 682.666667H170.666667v-85.333333h384a256 256 0 0 0 0-512H341.333333z",
87
+ "p-id": "80470"
88
+ }, null)]);
89
+
90
+ export { AIIcon, ArrowIcon, BrushIcon, CircleIcon, DrawdownIcon, MarkerIcon, MosaicIcon, RectIcon, TextIcon };
@@ -0,0 +1,3 @@
1
+ export { AIIcon, ArrowIcon, BrushIcon, CircleIcon, DrawdownIcon, MarkerIcon, MosaicIcon, RectIcon, TextIcon } from './icon.mjs';
2
+
3
+ "use strict";
@@ -0,0 +1,4 @@
1
+ import './components/index.mjs';
2
+ export { ScreenShot } from './components/screen-shot/screen-shot.mjs';
3
+
4
+ "use strict";
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => {
5
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ return value;
7
+ };
8
+ class DrawArrow {
9
+ constructor() {
10
+ // 起始点与结束点
11
+ __publicField(this, "beginPoint", { x: 0, y: 0 });
12
+ __publicField(this, "stopPoint", { x: 0, y: 0 });
13
+ // 多边形的尺寸信息
14
+ __publicField(this, "polygonVertex", []);
15
+ // 起点与X轴之间的夹角角度值
16
+ __publicField(this, "angle", 0);
17
+ // 箭头信息
18
+ __publicField(this, "arrowInfo", {
19
+ edgeLen: 50,
20
+ // 箭头的头部长度
21
+ angle: 30
22
+ // 箭头的头部角度
23
+ });
24
+ }
25
+ /**
26
+ * 绘制箭头
27
+ * @param ctx 需要进行绘制的画布
28
+ * @param originX 鼠标按下时的x轴坐标
29
+ * @param originY 鼠标按下式的y轴坐标
30
+ * @param x 当前鼠标x轴坐标
31
+ * @param y 当前鼠标y轴坐标
32
+ * @param color 箭头颜色
33
+ */
34
+ draw(ctx, originX, originY, x, y, color) {
35
+ this.beginPoint.x = originX;
36
+ this.beginPoint.y = originY;
37
+ this.stopPoint.x = x;
38
+ this.stopPoint.y = y;
39
+ this.arrowCord(this.beginPoint, this.stopPoint);
40
+ this.sideCord();
41
+ this.drawArrow(ctx, color);
42
+ }
43
+ // 在画布上画出递增变粗的箭头
44
+ drawArrow(ctx, color) {
45
+ ctx.fillStyle = color;
46
+ ctx.beginPath();
47
+ ctx.moveTo(this.polygonVertex[0], this.polygonVertex[1]);
48
+ ctx.lineTo(this.polygonVertex[2], this.polygonVertex[3]);
49
+ ctx.lineTo(this.polygonVertex[4], this.polygonVertex[5]);
50
+ ctx.lineTo(this.polygonVertex[6], this.polygonVertex[7]);
51
+ ctx.lineTo(this.polygonVertex[8], this.polygonVertex[9]);
52
+ ctx.lineTo(this.polygonVertex[10], this.polygonVertex[11]);
53
+ ctx.closePath();
54
+ ctx.fill();
55
+ }
56
+ /**
57
+ * 设置箭头的相关绘制信息
58
+ * @param edgeLen 长度
59
+ * @param angle 角度
60
+ * @private
61
+ */
62
+ setArrowInfo(edgeLen, angle) {
63
+ this.arrowInfo.edgeLen = edgeLen;
64
+ this.arrowInfo.angle = angle;
65
+ }
66
+ // 计算箭头尺寸
67
+ dynArrowSize() {
68
+ const x = this.stopPoint.x - this.beginPoint.x;
69
+ const y = this.stopPoint.y - this.beginPoint.y;
70
+ const length = Math.sqrt(x ** 2 + y ** 2);
71
+ if (length < 50) {
72
+ this.arrowInfo.edgeLen = length / 2;
73
+ } else if (length < 250) {
74
+ this.arrowInfo.edgeLen /= 2;
75
+ } else if (length < 500) {
76
+ this.arrowInfo.edgeLen = this.arrowInfo.edgeLen * length / 500;
77
+ }
78
+ }
79
+ // 计算起点与X轴之间的夹角角度值
80
+ getRadian(beginPoint, stopPoint) {
81
+ this.angle = Math.atan2(stopPoint.y - beginPoint.y, stopPoint.x - beginPoint.x) / Math.PI * 180;
82
+ this.setArrowInfo(50, 30);
83
+ this.dynArrowSize();
84
+ }
85
+ // 计算箭头底边两个点位置信息
86
+ arrowCord(beginPoint, stopPoint) {
87
+ this.polygonVertex[0] = beginPoint.x;
88
+ this.polygonVertex[1] = beginPoint.y;
89
+ this.polygonVertex[6] = stopPoint.x;
90
+ this.polygonVertex[7] = stopPoint.y;
91
+ this.getRadian(beginPoint, stopPoint);
92
+ this.polygonVertex[8] = stopPoint.x - this.arrowInfo.edgeLen * Math.cos(Math.PI / 180 * (this.angle + this.arrowInfo.angle));
93
+ this.polygonVertex[9] = stopPoint.y - this.arrowInfo.edgeLen * Math.sin(Math.PI / 180 * (this.angle + this.arrowInfo.angle));
94
+ this.polygonVertex[4] = stopPoint.x - this.arrowInfo.edgeLen * Math.cos(Math.PI / 180 * (this.angle - this.arrowInfo.angle));
95
+ this.polygonVertex[5] = stopPoint.y - this.arrowInfo.edgeLen * Math.sin(Math.PI / 180 * (this.angle - this.arrowInfo.angle));
96
+ }
97
+ // 计算另两个底边侧面点
98
+ sideCord() {
99
+ const midpoint = { x: 0, y: 0 };
100
+ midpoint.x = (this.polygonVertex[4] + this.polygonVertex[8]) / 2;
101
+ midpoint.y = (this.polygonVertex[5] + this.polygonVertex[9]) / 2;
102
+ this.polygonVertex[2] = (this.polygonVertex[4] + midpoint.x) / 2;
103
+ this.polygonVertex[3] = (this.polygonVertex[5] + midpoint.y) / 2;
104
+ this.polygonVertex[10] = (this.polygonVertex[8] + midpoint.x) / 2;
105
+ this.polygonVertex[11] = (this.polygonVertex[9] + midpoint.y) / 2;
106
+ }
107
+ }
108
+
109
+ export { DrawArrow };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ function drawCircle(context, mouseX, mouseY, mouseStartX, mouseStartY, borderWidth, color) {
3
+ const startX = mouseX < mouseStartX ? mouseX : mouseStartX;
4
+ const startY = mouseY < mouseStartY ? mouseY : mouseStartY;
5
+ const endX = mouseX >= mouseStartX ? mouseX : mouseStartX;
6
+ const endY = mouseY >= mouseStartY ? mouseY : mouseStartY;
7
+ const radiusX = (endX - startX) * 0.5;
8
+ const radiusY = (endY - startY) * 0.5;
9
+ const centerX = startX + radiusX;
10
+ const centerY = startY + radiusY;
11
+ context.save();
12
+ context.beginPath();
13
+ context.lineWidth = borderWidth;
14
+ context.strokeStyle = color;
15
+ if (typeof context.ellipse === "function") {
16
+ context.ellipse(centerX, centerY, radiusX, radiusY, 0, 0, 2 * Math.PI);
17
+ } else {
18
+ throw new Error("\u4F60\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301ellipse\uFF0C\u65E0\u6CD5\u7ED8\u5236\u692D\u5706");
19
+ }
20
+ context.stroke();
21
+ context.closePath();
22
+ context.restore();
23
+ }
24
+
25
+ export { drawCircle };