@opentiny/tiny-engine-toolbar-media 2.6.0 → 2.7.0-alpha.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.
package/dist/index.js CHANGED
@@ -1,15 +1,25 @@
1
1
  import "./style.css";
2
- import { ref as _, computed as B, reactive as X, toRaw as Y, watch as E, watchEffect as Z, onMounted as $, onUnmounted as ee, resolveComponent as f, createBlock as T, openBlock as v, withCtx as c, createElementVNode as t, createCommentVNode as W, createElementBlock as I, Fragment as te, renderList as ne, normalizeClass as ie, createVNode as g, createTextVNode as D, toDisplayString as r } from "vue";
3
- import { Switch as oe, Input as ae, Popover as le } from "@opentiny/vue";
4
- import { IconWebPlus as N } from "@opentiny/vue-icon";
5
- import { useLayout as V, useCanvas as F } from "@opentiny/tiny-engine-meta-register";
6
- import { ToolbarBase as se } from "@opentiny/tiny-engine-common";
7
- const de = {
2
+ import { useLayout as h, useCanvas as _, callEntry as V, useCompile as X } from "@opentiny/tiny-engine-meta-register";
3
+ import { ref as q, computed as Y, reactive as ee, toRaw as te, watch as Z, watchEffect as ae, onMounted as ne, onUnmounted as ie, resolveComponent as O, createBlock as z, openBlock as L, withCtx as F, createElementVNode as o, createCommentVNode as R, createElementBlock as G, Fragment as oe, renderList as le, normalizeClass as se, createVNode as j, createTextVNode as H, toDisplayString as B } from "vue";
4
+ import { Switch as de, Input as ce, Popover as re } from "@opentiny/vue";
5
+ import { IconWebPlus as y } from "@opentiny/vue-icon";
6
+ import { ToolbarBase as U } from "@opentiny/tiny-engine-common";
7
+ const J = {
8
+ id: "engine.toolbars.media",
9
+ type: "toolbars",
10
+ title: "media",
11
+ options: {
12
+ icon: {
13
+ default: ""
14
+ },
15
+ renderType: "slot"
16
+ }
17
+ }, me = {
8
18
  components: {
9
- TinyPopover: le,
10
- TinyInput: ae,
11
- TinySwitch: oe,
12
- ToolbarBase: se
19
+ TinyPopover: re,
20
+ TinyInput: ce,
21
+ TinySwitch: de,
22
+ ToolbarBase: U
13
23
  },
14
24
  props: {
15
25
  data: {
@@ -25,9 +35,15 @@ const de = {
25
35
  default: () => ({})
26
36
  }
27
37
  },
28
- setup(h, { emit: n }) {
29
- let d = null, i = "", p = "";
30
- const { layoutState: w } = V(), u = _(!1), b = _(!1), m = _(!1), { getCanvasType: y } = F().canvasApi.value, C = _((y == null ? void 0 : y()) === "absolute"), o = B(() => V().getDimension()), x = B(() => o.value.scale * 100), a = X({
38
+ setup(m, {
39
+ emit: e
40
+ }) {
41
+ let l = null, t = "", s = "";
42
+ const {
43
+ layoutState: p
44
+ } = h(), d = q(!1), u = q(!1), c = q(!1), {
45
+ getCanvasType: x
46
+ } = _().canvasApi.value, w = q((x == null ? void 0 : x()) === "absolute"), a = Y(() => h().getDimension()), r = Y(() => a.value.scale * 100), n = ee({
31
47
  activeIndex: 0,
32
48
  guideValue: "",
33
49
  width: "",
@@ -36,345 +52,909 @@ const de = {
36
52
  viewWidth: null,
37
53
  moreData: {
38
54
  title: "添加大断点",
39
- list: [
40
- {
41
- icon: N(),
42
- text: "1280px"
43
- },
44
- {
45
- icon: N(),
46
- text: "1440px"
47
- },
48
- {
49
- icon: N(),
50
- text: "1920px"
51
- }
52
- ],
55
+ list: [{
56
+ icon: y(),
57
+ text: "1280px"
58
+ }, {
59
+ icon: y(),
60
+ text: "1440px"
61
+ }, {
62
+ icon: y(),
63
+ text: "1920px"
64
+ }],
53
65
  tips: "将鼠标悬停在断点上以了解更多信息"
54
66
  },
55
67
  textData: {
56
68
  title: "画布设置",
57
69
  width: "宽度",
58
70
  scale: "缩放",
59
- list: [
60
- {
61
- text: "自由布局"
62
- }
63
- ],
71
+ list: [{
72
+ text: "自由布局"
73
+ }],
64
74
  vision: "视觉预览"
65
75
  },
66
- guideOptions: [
67
- {
68
- value: "选项1",
69
- label: "No guide"
70
- },
71
- {
72
- value: "选项2",
73
- label: "Line guide(960px)"
74
- },
75
- {
76
- value: "选项3",
77
- label: "Filled guide(960px)"
78
- }
79
- ],
80
- media: [
81
- {
82
- idx: 0,
83
- view: "mdx",
84
- icon: "IconDesktopView",
85
- liked: "desktop-large",
86
- width: "1920px",
87
- minWidth: "1200px",
88
- maxWidth: "1920px",
89
- title: "大屏",
90
- subTitle: "1200px 及以上",
91
- content: "此处添加的样式将适用于 1200 像素及以上,除非它们在更大的断点处进行编辑。",
92
- enContent: "Style added here will apply at 1200px and up,unless they′re edited at a larger breakpoint."
93
- },
94
- {
95
- idx: 1,
96
- view: "desktop",
97
- icon: "IconDesktopView",
98
- liked: "laptop-cut-corner",
99
- width: "1200px",
100
- minWidth: "992px",
101
- maxWidth: "1200px",
102
- title: "PC 端",
103
- subTitle: "基本断点",
104
- content: "桌面端样式适用于所有断点,除非它们在更大或更小的断点处进行编辑,在这里开始你的布局。",
105
- enContent: "Desktop styles apply at all breakpoints,unless they′re edited at a larger or smaller breakpoints. Start your stying here."
106
- },
107
- {
108
- idx: 2,
109
- view: "tablet",
110
- icon: "IconTabletView",
111
- liked: "tablet-portrait",
112
- width: "992px",
113
- minWidth: "768px",
114
- maxWidth: "992px",
115
- title: "平板",
116
- subTitle: "992px 及以下",
117
- content: "此处添加的样式将适用于 992 像素及以下,除非它们在较小的断点处进行编辑。",
118
- enContent: "styles added here will apply at 992px and down,unless they′re edited at smaller breakpoints."
119
- },
120
- {
121
- idx: 3,
122
- view: "lanMobile",
123
- icon: "IconMobileView",
124
- liked: "mobile-landscape",
125
- width: "768px",
126
- minWidth: "480px",
127
- maxWidth: "768px",
128
- title: "手机横屏",
129
- subTitle: "768px 及以下",
130
- content: "此处添加的样式将适用于 768 像素及以下,除非它们在较小的断点处进行编辑。",
131
- enContent: "styles added here will apply at 768px and down,unless they′re edited at smaller breakpoints."
132
- },
133
- {
134
- idx: 4,
135
- view: "mobile",
136
- icon: "IconMobileView",
137
- liked: "mobile-portrai",
138
- width: "480px",
139
- minWidth: "240px",
140
- maxWidth: "480px",
141
- title: "手机竖屏",
142
- subTitle: "480px 及以下",
143
- content: "此处添加的样式将适用于 480 像素及以下。",
144
- enContent: "styles added here will apply at 480px and down."
145
- }
146
- ]
147
- }), L = () => {
148
- b.value = !1;
149
- }, O = () => {
150
- d = setTimeout(() => {
151
- u.value = !0;
76
+ guideOptions: [{
77
+ value: "选项1",
78
+ label: "No guide"
79
+ }, {
80
+ value: "选项2",
81
+ label: "Line guide(960px)"
82
+ }, {
83
+ value: "选项3",
84
+ label: "Filled guide(960px)"
85
+ }],
86
+ media: [{
87
+ idx: 0,
88
+ view: "mdx",
89
+ icon: "IconDesktopView",
90
+ liked: "desktop-large",
91
+ width: "1920px",
92
+ minWidth: "1200px",
93
+ maxWidth: "1920px",
94
+ title: "大屏",
95
+ subTitle: "1200px 及以上",
96
+ content: "此处添加的样式将适用于 1200 像素及以上,除非它们在更大的断点处进行编辑。",
97
+ enContent: "Style added here will apply at 1200px and up,unless they′re edited at a larger breakpoint."
98
+ }, {
99
+ idx: 1,
100
+ view: "desktop",
101
+ icon: "IconDesktopView",
102
+ liked: "laptop-cut-corner",
103
+ width: "1200px",
104
+ minWidth: "992px",
105
+ maxWidth: "1200px",
106
+ title: "PC 端",
107
+ subTitle: "基本断点",
108
+ content: "桌面端样式适用于所有断点,除非它们在更大或更小的断点处进行编辑,在这里开始你的布局。",
109
+ enContent: "Desktop styles apply at all breakpoints,unless they′re edited at a larger or smaller breakpoints. Start your stying here."
110
+ }, {
111
+ idx: 2,
112
+ view: "tablet",
113
+ icon: "IconTabletView",
114
+ liked: "tablet-portrait",
115
+ width: "992px",
116
+ minWidth: "768px",
117
+ maxWidth: "992px",
118
+ title: "平板",
119
+ subTitle: "992px 及以下",
120
+ content: "此处添加的样式将适用于 992 像素及以下,除非它们在较小的断点处进行编辑。",
121
+ enContent: "styles added here will apply at 992px and down,unless they′re edited at smaller breakpoints."
122
+ }, {
123
+ idx: 3,
124
+ view: "lanMobile",
125
+ icon: "IconMobileView",
126
+ liked: "mobile-landscape",
127
+ width: "768px",
128
+ minWidth: "480px",
129
+ maxWidth: "768px",
130
+ title: "手机横屏",
131
+ subTitle: "768px 及以下",
132
+ content: "此处添加的样式将适用于 768 像素及以下,除非它们在较小的断点处进行编辑。",
133
+ enContent: "styles added here will apply at 768px and down,unless they′re edited at smaller breakpoints."
134
+ }, {
135
+ idx: 4,
136
+ view: "mobile",
137
+ icon: "IconMobileView",
138
+ liked: "mobile-portrai",
139
+ width: "480px",
140
+ minWidth: "240px",
141
+ maxWidth: "480px",
142
+ title: "手机竖屏",
143
+ subTitle: "480px 及以下",
144
+ content: "此处添加的样式将适用于 480 像素及以下。",
145
+ enContent: "styles added here will apply at 480px and down."
146
+ }]
147
+ }), C = V(() => {
148
+ u.value = !1;
149
+ }, {
150
+ metaData: {
151
+ id: "engine.toolbars.media.Main.hide"
152
+ },
153
+ ctx: () => ({
154
+ props: m,
155
+ emit: e,
156
+ timer: l,
157
+ prevWidthVal: t,
158
+ prevScaleVal: s,
159
+ layoutState: p,
160
+ visible: d,
161
+ active: u,
162
+ flag: c,
163
+ getCanvasType: x,
164
+ isAbsolute: w,
165
+ dimension: a,
166
+ scale: r,
167
+ state: n,
168
+ hide: C,
169
+ showTips: k,
170
+ hideTips: D,
171
+ showPopover: T,
172
+ hidePopover: M,
173
+ closePopover: g,
174
+ mediaMap: v,
175
+ setViewPort: f,
176
+ activeView: W,
177
+ breakpoints: I,
178
+ widthChange: P,
179
+ scaleChange: N,
180
+ changeCanvasType: S,
181
+ mode: E,
182
+ IconWebPlus: y,
183
+ useLayout: h,
184
+ useCanvas: _,
185
+ ToolbarBase: U
186
+ })
187
+ }), k = V(() => {
188
+ l = setTimeout(() => {
189
+ d.value = !0;
152
190
  }, 1e3);
153
- }, U = () => {
154
- u.value = !1, clearTimeout(d);
155
- }, j = () => {
156
- w.toolbars.visiblePopover = !0, m.value = !0;
157
- }, q = () => {
158
- w.toolbars.visiblePopover = !1, m.value = !1;
159
- }, P = (e) => {
160
- const l = document.querySelector(".reference-text"), s = l == null ? void 0 : l.contains(e.target);
161
- l !== e.target && !s && (w.toolbars.visiblePopover = !1);
162
- }, k = a.media.reduce((e, l, s) => (e[l.view] = { ...Y(l), index: s }, e), {}), S = (e) => {
163
- h.isCanvas ? V().setDimension({
164
- deviceType: e.view,
165
- width: e.width,
166
- minWidth: e.minWidth,
167
- maxWidth: e.maxWidth
168
- }) : (a.activeIndex = e.idx, n("setViewPort", e.width));
169
- }, z = (e, l) => {
170
- const s = k[l];
171
- V().setDimension({
172
- deviceType: s.view,
173
- width: e ? `${e}px` : s.width,
174
- minWidth: s.minWidth,
175
- maxWidth: s.maxWidth
191
+ }, {
192
+ metaData: {
193
+ id: "engine.toolbars.media.Main.showTips"
194
+ },
195
+ ctx: () => ({
196
+ props: m,
197
+ emit: e,
198
+ timer: l,
199
+ prevWidthVal: t,
200
+ prevScaleVal: s,
201
+ layoutState: p,
202
+ visible: d,
203
+ active: u,
204
+ flag: c,
205
+ getCanvasType: x,
206
+ isAbsolute: w,
207
+ dimension: a,
208
+ scale: r,
209
+ state: n,
210
+ hide: C,
211
+ showTips: k,
212
+ hideTips: D,
213
+ showPopover: T,
214
+ hidePopover: M,
215
+ closePopover: g,
216
+ mediaMap: v,
217
+ setViewPort: f,
218
+ activeView: W,
219
+ breakpoints: I,
220
+ widthChange: P,
221
+ scaleChange: N,
222
+ changeCanvasType: S,
223
+ mode: E,
224
+ IconWebPlus: y,
225
+ useLayout: h,
226
+ useCanvas: _,
227
+ ToolbarBase: U
228
+ })
229
+ }), D = V(() => {
230
+ d.value = !1, clearTimeout(l);
231
+ }, {
232
+ metaData: {
233
+ id: "engine.toolbars.media.Main.hideTips"
234
+ },
235
+ ctx: () => ({
236
+ props: m,
237
+ emit: e,
238
+ timer: l,
239
+ prevWidthVal: t,
240
+ prevScaleVal: s,
241
+ layoutState: p,
242
+ visible: d,
243
+ active: u,
244
+ flag: c,
245
+ getCanvasType: x,
246
+ isAbsolute: w,
247
+ dimension: a,
248
+ scale: r,
249
+ state: n,
250
+ hide: C,
251
+ showTips: k,
252
+ hideTips: D,
253
+ showPopover: T,
254
+ hidePopover: M,
255
+ closePopover: g,
256
+ mediaMap: v,
257
+ setViewPort: f,
258
+ activeView: W,
259
+ breakpoints: I,
260
+ widthChange: P,
261
+ scaleChange: N,
262
+ changeCanvasType: S,
263
+ mode: E,
264
+ IconWebPlus: y,
265
+ useLayout: h,
266
+ useCanvas: _,
267
+ ToolbarBase: U
268
+ })
269
+ }), T = V(() => {
270
+ p.toolbars.visiblePopover = !0, c.value = !0;
271
+ }, {
272
+ metaData: {
273
+ id: "engine.toolbars.media.Main.showPopover"
274
+ },
275
+ ctx: () => ({
276
+ props: m,
277
+ emit: e,
278
+ timer: l,
279
+ prevWidthVal: t,
280
+ prevScaleVal: s,
281
+ layoutState: p,
282
+ visible: d,
283
+ active: u,
284
+ flag: c,
285
+ getCanvasType: x,
286
+ isAbsolute: w,
287
+ dimension: a,
288
+ scale: r,
289
+ state: n,
290
+ hide: C,
291
+ showTips: k,
292
+ hideTips: D,
293
+ showPopover: T,
294
+ hidePopover: M,
295
+ closePopover: g,
296
+ mediaMap: v,
297
+ setViewPort: f,
298
+ activeView: W,
299
+ breakpoints: I,
300
+ widthChange: P,
301
+ scaleChange: N,
302
+ changeCanvasType: S,
303
+ mode: E,
304
+ IconWebPlus: y,
305
+ useLayout: h,
306
+ useCanvas: _,
307
+ ToolbarBase: U
308
+ })
309
+ }), M = V(() => {
310
+ p.toolbars.visiblePopover = !1, c.value = !1;
311
+ }, {
312
+ metaData: {
313
+ id: "engine.toolbars.media.Main.hidePopover"
314
+ },
315
+ ctx: () => ({
316
+ props: m,
317
+ emit: e,
318
+ timer: l,
319
+ prevWidthVal: t,
320
+ prevScaleVal: s,
321
+ layoutState: p,
322
+ visible: d,
323
+ active: u,
324
+ flag: c,
325
+ getCanvasType: x,
326
+ isAbsolute: w,
327
+ dimension: a,
328
+ scale: r,
329
+ state: n,
330
+ hide: C,
331
+ showTips: k,
332
+ hideTips: D,
333
+ showPopover: T,
334
+ hidePopover: M,
335
+ closePopover: g,
336
+ mediaMap: v,
337
+ setViewPort: f,
338
+ activeView: W,
339
+ breakpoints: I,
340
+ widthChange: P,
341
+ scaleChange: N,
342
+ changeCanvasType: S,
343
+ mode: E,
344
+ IconWebPlus: y,
345
+ useLayout: h,
346
+ useCanvas: _,
347
+ ToolbarBase: U
348
+ })
349
+ }), g = V((i) => {
350
+ const b = document.querySelector(".reference-text"), A = b == null ? void 0 : b.contains(i.target);
351
+ b !== i.target && !A && (p.toolbars.visiblePopover = !1);
352
+ }, {
353
+ metaData: {
354
+ id: "engine.toolbars.media.Main.closePopover"
355
+ },
356
+ ctx: () => ({
357
+ props: m,
358
+ emit: e,
359
+ timer: l,
360
+ prevWidthVal: t,
361
+ prevScaleVal: s,
362
+ layoutState: p,
363
+ visible: d,
364
+ active: u,
365
+ flag: c,
366
+ getCanvasType: x,
367
+ isAbsolute: w,
368
+ dimension: a,
369
+ scale: r,
370
+ state: n,
371
+ hide: C,
372
+ showTips: k,
373
+ hideTips: D,
374
+ showPopover: T,
375
+ hidePopover: M,
376
+ closePopover: g,
377
+ mediaMap: v,
378
+ setViewPort: f,
379
+ activeView: W,
380
+ breakpoints: I,
381
+ widthChange: P,
382
+ scaleChange: N,
383
+ changeCanvasType: S,
384
+ mode: E,
385
+ IconWebPlus: y,
386
+ useLayout: h,
387
+ useCanvas: _,
388
+ ToolbarBase: U
389
+ })
390
+ }), v = n.media.reduce((i, b, A) => (i[b.view] = {
391
+ ...te(b),
392
+ index: A
393
+ }, i), {}), f = V((i) => {
394
+ m.isCanvas ? h().setDimension({
395
+ deviceType: i.view,
396
+ width: i.width,
397
+ minWidth: i.minWidth,
398
+ maxWidth: i.maxWidth
399
+ }) : (n.activeIndex = i.idx, e("setViewPort", i.width));
400
+ }, {
401
+ metaData: {
402
+ id: "engine.toolbars.media.Main.setViewPort"
403
+ },
404
+ ctx: () => ({
405
+ props: m,
406
+ emit: e,
407
+ timer: l,
408
+ prevWidthVal: t,
409
+ prevScaleVal: s,
410
+ layoutState: p,
411
+ visible: d,
412
+ active: u,
413
+ flag: c,
414
+ getCanvasType: x,
415
+ isAbsolute: w,
416
+ dimension: a,
417
+ scale: r,
418
+ state: n,
419
+ hide: C,
420
+ showTips: k,
421
+ hideTips: D,
422
+ showPopover: T,
423
+ hidePopover: M,
424
+ closePopover: g,
425
+ mediaMap: v,
426
+ setViewPort: f,
427
+ activeView: W,
428
+ breakpoints: I,
429
+ widthChange: P,
430
+ scaleChange: N,
431
+ changeCanvasType: S,
432
+ mode: E,
433
+ IconWebPlus: y,
434
+ useLayout: h,
435
+ useCanvas: _,
436
+ ToolbarBase: U
437
+ })
438
+ }), W = V((i, b) => {
439
+ const A = v[b];
440
+ h().setDimension({
441
+ deviceType: A.view,
442
+ width: i ? `${i}px` : A.width,
443
+ minWidth: A.minWidth,
444
+ maxWidth: A.maxWidth
176
445
  });
177
- }, R = [
178
- { type: "mobile", min: 240, max: 480 },
179
- { type: "lanMobile", min: 480, max: 768 },
180
- { type: "tablet", min: 768, max: 992 },
181
- { type: "desktop", min: 992, max: 1200 },
182
- { type: "mdx", min: 1200, max: 1920 }
183
- ], G = (e) => {
184
- var M;
185
- const l = /^\d+$/;
186
- String(e).match(l) ? Number(e) < 240 ? a.width = 240 : Number(e) > 1920 ? a.width = 1920 : a.width = e : a.width = i || parseInt(o.value.width, 10);
187
- const s = Number(a.width), Q = ((M = R.find((A) => A.min <= s && s <= A.max)) == null ? void 0 : M.type) || "desktop";
188
- z(s, Q);
189
- }, H = (e) => {
190
- const l = k.mdx, s = /^\d+(\.\d+)?$/;
191
- String(e).match(s) ? Number(e) > 100 ? a.scaleValue = 100 : Number(e) < 20 ? a.scaleValue = 20 : a.scaleValue = e : a.scaleValue = p || parseInt(l.scale), a.scaleValue = Number(a.scaleValue).toFixed(2), V().setDimension({
192
- scale: Number(a.scaleValue) / 100
446
+ }, {
447
+ metaData: {
448
+ id: "engine.toolbars.media.Main.activeView"
449
+ },
450
+ ctx: () => ({
451
+ props: m,
452
+ emit: e,
453
+ timer: l,
454
+ prevWidthVal: t,
455
+ prevScaleVal: s,
456
+ layoutState: p,
457
+ visible: d,
458
+ active: u,
459
+ flag: c,
460
+ getCanvasType: x,
461
+ isAbsolute: w,
462
+ dimension: a,
463
+ scale: r,
464
+ state: n,
465
+ hide: C,
466
+ showTips: k,
467
+ hideTips: D,
468
+ showPopover: T,
469
+ hidePopover: M,
470
+ closePopover: g,
471
+ mediaMap: v,
472
+ setViewPort: f,
473
+ activeView: W,
474
+ breakpoints: I,
475
+ widthChange: P,
476
+ scaleChange: N,
477
+ changeCanvasType: S,
478
+ mode: E,
479
+ IconWebPlus: y,
480
+ useLayout: h,
481
+ useCanvas: _,
482
+ ToolbarBase: U
483
+ })
484
+ }), I = [{
485
+ type: "mobile",
486
+ min: 240,
487
+ max: 480
488
+ }, {
489
+ type: "lanMobile",
490
+ min: 480,
491
+ max: 768
492
+ }, {
493
+ type: "tablet",
494
+ min: 768,
495
+ max: 992
496
+ }, {
497
+ type: "desktop",
498
+ min: 992,
499
+ max: 1200
500
+ }, {
501
+ type: "mdx",
502
+ min: 1200,
503
+ max: 1920
504
+ }], P = V((i) => {
505
+ var K;
506
+ const b = /^\d+$/;
507
+ String(i).match(b) ? Number(i) < 240 ? n.width = 240 : Number(i) > 1920 ? n.width = 1920 : n.width = i : n.width = t || parseInt(a.value.width, 10);
508
+ const A = Number(n.width), $ = ((K = I.find((Q) => Q.min <= A && A <= Q.max)) == null ? void 0 : K.type) || "desktop";
509
+ W(A, $);
510
+ }, {
511
+ metaData: {
512
+ id: "engine.toolbars.media.Main.widthChange"
513
+ },
514
+ ctx: () => ({
515
+ props: m,
516
+ emit: e,
517
+ timer: l,
518
+ prevWidthVal: t,
519
+ prevScaleVal: s,
520
+ layoutState: p,
521
+ visible: d,
522
+ active: u,
523
+ flag: c,
524
+ getCanvasType: x,
525
+ isAbsolute: w,
526
+ dimension: a,
527
+ scale: r,
528
+ state: n,
529
+ hide: C,
530
+ showTips: k,
531
+ hideTips: D,
532
+ showPopover: T,
533
+ hidePopover: M,
534
+ closePopover: g,
535
+ mediaMap: v,
536
+ setViewPort: f,
537
+ activeView: W,
538
+ breakpoints: I,
539
+ widthChange: P,
540
+ scaleChange: N,
541
+ changeCanvasType: S,
542
+ mode: E,
543
+ IconWebPlus: y,
544
+ useLayout: h,
545
+ useCanvas: _,
546
+ ToolbarBase: U
547
+ })
548
+ }), N = V((i) => {
549
+ const b = v.mdx, A = /^\d+(\.\d+)?$/;
550
+ String(i).match(A) ? Number(i) > 100 ? n.scaleValue = 100 : Number(i) < 20 ? n.scaleValue = 20 : n.scaleValue = i : n.scaleValue = s || parseInt(b.scale), n.scaleValue = Number(n.scaleValue).toFixed(2), h().setDimension({
551
+ scale: Number(n.scaleValue) / 100
193
552
  });
194
- }, J = (e) => {
195
- const { setCanvasType: l } = F().canvasApi.value;
196
- l(e ? "absolute" : "normal");
197
- };
198
- E(
199
- () => o.value.deviceType,
200
- (e) => {
201
- a.activeIndex = k[e].index, a.readonly = e !== "mdx";
553
+ }, {
554
+ metaData: {
555
+ id: "engine.toolbars.media.Main.scaleChange"
202
556
  },
203
- { immediate: !0 }
204
- ), Z(() => {
205
- a.scaleValue = x.value.toFixed(2), p = x.value;
206
- }), E(
207
- () => o.value.width,
208
- (e) => {
209
- const l = parseInt(e, 10);
210
- Number.isInteger(l) && (a.width = l, i = l);
211
- }
212
- ), $(() => {
213
- document.addEventListener("click", P);
214
- }), ee(() => {
215
- document.removeEventListener("click", P);
557
+ ctx: () => ({
558
+ props: m,
559
+ emit: e,
560
+ timer: l,
561
+ prevWidthVal: t,
562
+ prevScaleVal: s,
563
+ layoutState: p,
564
+ visible: d,
565
+ active: u,
566
+ flag: c,
567
+ getCanvasType: x,
568
+ isAbsolute: w,
569
+ dimension: a,
570
+ scale: r,
571
+ state: n,
572
+ hide: C,
573
+ showTips: k,
574
+ hideTips: D,
575
+ showPopover: T,
576
+ hidePopover: M,
577
+ closePopover: g,
578
+ mediaMap: v,
579
+ setViewPort: f,
580
+ activeView: W,
581
+ breakpoints: I,
582
+ widthChange: P,
583
+ scaleChange: N,
584
+ changeCanvasType: S,
585
+ mode: E,
586
+ IconWebPlus: y,
587
+ useLayout: h,
588
+ useCanvas: _,
589
+ ToolbarBase: U
590
+ })
591
+ }), S = V((i) => {
592
+ const {
593
+ setCanvasType: b
594
+ } = _().canvasApi.value;
595
+ b(i ? "absolute" : "normal");
596
+ }, {
597
+ metaData: {
598
+ id: "engine.toolbars.media.Main.changeCanvasType"
599
+ },
600
+ ctx: () => ({
601
+ props: m,
602
+ emit: e,
603
+ timer: l,
604
+ prevWidthVal: t,
605
+ prevScaleVal: s,
606
+ layoutState: p,
607
+ visible: d,
608
+ active: u,
609
+ flag: c,
610
+ getCanvasType: x,
611
+ isAbsolute: w,
612
+ dimension: a,
613
+ scale: r,
614
+ state: n,
615
+ hide: C,
616
+ showTips: k,
617
+ hideTips: D,
618
+ showPopover: T,
619
+ hidePopover: M,
620
+ closePopover: g,
621
+ mediaMap: v,
622
+ setViewPort: f,
623
+ activeView: W,
624
+ breakpoints: I,
625
+ widthChange: P,
626
+ scaleChange: N,
627
+ changeCanvasType: S,
628
+ mode: E,
629
+ IconWebPlus: y,
630
+ useLayout: h,
631
+ useCanvas: _,
632
+ ToolbarBase: U
633
+ })
216
634
  });
217
- const K = o.value.deviceType || "desktop";
218
- return S(k[K]), {
219
- scale: x,
220
- state: a,
221
- active: b,
222
- flag: m,
223
- hide: L,
224
- layoutState: w,
225
- visible: u,
226
- showTips: O,
227
- hideTips: U,
228
- timer: d,
229
- dimension: o,
230
- setViewPort: S,
231
- showPopover: j,
232
- hidePopover: q,
233
- widthChange: G,
234
- scaleChange: H,
235
- isAbsolute: C,
236
- changeCanvasType: J
635
+ Z(() => a.value.deviceType, (i) => {
636
+ n.activeIndex = v[i].index, n.readonly = i !== "mdx";
637
+ }, {
638
+ immediate: !0
639
+ }), ae(() => {
640
+ n.scaleValue = r.value.toFixed(2), s = r.value;
641
+ }), Z(() => a.value.width, (i) => {
642
+ const b = parseInt(i, 10);
643
+ Number.isInteger(b) && (n.width = b, t = b);
644
+ }), ne(V(V(() => {
645
+ document.addEventListener("click", g);
646
+ }, {
647
+ metaData: {
648
+ id: "engine.toolbars.media.Main.onMounted[0]"
649
+ },
650
+ ctx: () => ({
651
+ props: m,
652
+ emit: e,
653
+ timer: l,
654
+ prevWidthVal: t,
655
+ prevScaleVal: s,
656
+ layoutState: p,
657
+ visible: d,
658
+ active: u,
659
+ flag: c,
660
+ getCanvasType: x,
661
+ isAbsolute: w,
662
+ dimension: a,
663
+ scale: r,
664
+ state: n,
665
+ hide: C,
666
+ showTips: k,
667
+ hideTips: D,
668
+ showPopover: T,
669
+ hidePopover: M,
670
+ closePopover: g,
671
+ mediaMap: v,
672
+ setViewPort: f,
673
+ activeView: W,
674
+ breakpoints: I,
675
+ widthChange: P,
676
+ scaleChange: N,
677
+ changeCanvasType: S,
678
+ mode: E,
679
+ IconWebPlus: y,
680
+ useLayout: h,
681
+ useCanvas: _,
682
+ ToolbarBase: U
683
+ })
684
+ }), {
685
+ metaData: {
686
+ id: "engine.toolbars.media.Main.onMounted[0]"
687
+ },
688
+ ctx: () => ({
689
+ props: m,
690
+ emit: e,
691
+ timer: l,
692
+ prevWidthVal: t,
693
+ prevScaleVal: s,
694
+ layoutState: p,
695
+ visible: d,
696
+ active: u,
697
+ flag: c,
698
+ getCanvasType: x,
699
+ isAbsolute: w,
700
+ dimension: a,
701
+ scale: r,
702
+ state: n,
703
+ hide: C,
704
+ showTips: k,
705
+ hideTips: D,
706
+ showPopover: T,
707
+ hidePopover: M,
708
+ closePopover: g,
709
+ mediaMap: v,
710
+ setViewPort: f,
711
+ activeView: W,
712
+ breakpoints: I,
713
+ widthChange: P,
714
+ scaleChange: N,
715
+ changeCanvasType: S,
716
+ mode: E,
717
+ _callEntry: V,
718
+ _useCompile: X,
719
+ _metaData: J,
720
+ IconWebPlus: y,
721
+ useLayout: h,
722
+ useCanvas: _,
723
+ ToolbarBase: U
724
+ })
725
+ })), ie(V(V(() => {
726
+ document.removeEventListener("click", g);
727
+ }, {
728
+ metaData: {
729
+ id: "engine.toolbars.media.Main.onUnmounted[0]"
730
+ },
731
+ ctx: () => ({
732
+ props: m,
733
+ emit: e,
734
+ timer: l,
735
+ prevWidthVal: t,
736
+ prevScaleVal: s,
737
+ layoutState: p,
738
+ visible: d,
739
+ active: u,
740
+ flag: c,
741
+ getCanvasType: x,
742
+ isAbsolute: w,
743
+ dimension: a,
744
+ scale: r,
745
+ state: n,
746
+ hide: C,
747
+ showTips: k,
748
+ hideTips: D,
749
+ showPopover: T,
750
+ hidePopover: M,
751
+ closePopover: g,
752
+ mediaMap: v,
753
+ setViewPort: f,
754
+ activeView: W,
755
+ breakpoints: I,
756
+ widthChange: P,
757
+ scaleChange: N,
758
+ changeCanvasType: S,
759
+ mode: E,
760
+ IconWebPlus: y,
761
+ useLayout: h,
762
+ useCanvas: _,
763
+ ToolbarBase: U
764
+ })
765
+ }), {
766
+ metaData: {
767
+ id: "engine.toolbars.media.Main.onUnmounted[0]"
768
+ },
769
+ ctx: () => ({
770
+ props: m,
771
+ emit: e,
772
+ timer: l,
773
+ prevWidthVal: t,
774
+ prevScaleVal: s,
775
+ layoutState: p,
776
+ visible: d,
777
+ active: u,
778
+ flag: c,
779
+ getCanvasType: x,
780
+ isAbsolute: w,
781
+ dimension: a,
782
+ scale: r,
783
+ state: n,
784
+ hide: C,
785
+ showTips: k,
786
+ hideTips: D,
787
+ showPopover: T,
788
+ hidePopover: M,
789
+ closePopover: g,
790
+ mediaMap: v,
791
+ setViewPort: f,
792
+ activeView: W,
793
+ breakpoints: I,
794
+ widthChange: P,
795
+ scaleChange: N,
796
+ changeCanvasType: S,
797
+ mode: E,
798
+ _callEntry: V,
799
+ _useCompile: X,
800
+ _metaData: J,
801
+ IconWebPlus: y,
802
+ useLayout: h,
803
+ useCanvas: _,
804
+ ToolbarBase: U
805
+ })
806
+ }));
807
+ const E = a.value.deviceType || "desktop";
808
+ return f(v[E]), {
809
+ scale: r,
810
+ state: n,
811
+ active: u,
812
+ flag: c,
813
+ hide: C,
814
+ layoutState: p,
815
+ visible: d,
816
+ showTips: k,
817
+ hideTips: D,
818
+ timer: l,
819
+ dimension: a,
820
+ setViewPort: f,
821
+ showPopover: T,
822
+ hidePopover: M,
823
+ widthChange: P,
824
+ scaleChange: N,
825
+ isAbsolute: w,
826
+ changeCanvasType: S
237
827
  };
238
828
  }
239
- }, re = (h, n) => {
240
- const d = h.__vccOpts || h;
241
- for (const [i, p] of n)
242
- d[i] = p;
243
- return d;
244
- }, ce = { class: "toolbar-wrap" }, pe = { class: "toolbar-icon-wrap" }, ue = ["onClick"], me = { class: "media-content" }, xe = { class: "media-title" }, ve = {
829
+ }, pe = (m, e) => {
830
+ const l = m.__vccOpts || m;
831
+ for (const [t, s] of e)
832
+ l[t] = s;
833
+ return l;
834
+ }, ue = { class: "toolbar-wrap" }, xe = { class: "toolbar-icon-wrap" }, he = ["onClick"], ve = { class: "media-content" }, be = { class: "media-title" }, we = {
245
835
  key: 0,
246
836
  class: "sub-title"
247
- }, he = { class: "content" }, we = {
837
+ }, ye = { class: "content" }, ge = {
248
838
  class: "reference-text",
249
839
  title: "画布设置"
250
- }, be = { class: "content-wrap text-content" }, ye = { class: "title text-title" }, fe = { class: "setting" };
251
- function ge(h, n, d, i, p, w) {
252
- const u = f("svg-icon"), b = f("tiny-popover"), m = f("tiny-input"), y = f("tiny-switch"), C = f("toolbar-base");
253
- return v(), T(C, { options: d.options }, {
254
- default: c(() => [
255
- t("div", ce, [
256
- t("div", pe, [
257
- (v(!0), I(te, null, ne(i.state.media, (o, x) => (v(), I("span", {
258
- key: x,
259
- class: ie(["icon", { active: i.state.activeIndex === x, "is-rotate": o.view === "lanMobile" }]),
260
- onClick: (a) => i.setViewPort(o)
840
+ }, fe = { class: "content-wrap text-content" }, _e = { class: "title text-title" }, Ve = { class: "setting" };
841
+ function Ce(m, e, l, t, s, p) {
842
+ const d = O("svg-icon"), u = O("tiny-popover"), c = O("tiny-input"), x = O("tiny-switch"), w = O("toolbar-base");
843
+ return L(), z(w, { options: l.options }, {
844
+ default: F(() => [
845
+ o("div", ue, [
846
+ o("div", xe, [
847
+ (L(!0), G(oe, null, le(t.state.media, (a, r) => (L(), G("span", {
848
+ key: r,
849
+ class: se(["icon", { active: t.state.activeIndex === r, "is-rotate": a.view === "lanMobile" }]),
850
+ onClick: (n) => t.setViewPort(a)
261
851
  }, [
262
- g(b, {
852
+ j(u, {
263
853
  trigger: "hover",
264
854
  width: "260",
265
855
  "append-to-body": "",
266
856
  "open-delay": 1e3,
267
857
  "popper-class": "media-icon-popover"
268
858
  }, {
269
- reference: c(() => [
270
- g(u, {
271
- name: o.liked,
859
+ reference: F(() => [
860
+ j(d, {
861
+ name: a.liked,
272
862
  class: "media-icon"
273
863
  }, null, 8, ["name"])
274
864
  ]),
275
- default: c(() => [
276
- t("div", me, [
277
- t("div", xe, [
278
- t("div", null, [
279
- D(r(o.title) + " ", 1),
280
- o.subTitle ? (v(), I("span", ve, [
281
- n[3] || (n[3] = D(" (")),
282
- o.view === "desktop" ? (v(), T(u, {
865
+ default: F(() => [
866
+ o("div", ve, [
867
+ o("div", be, [
868
+ o("div", null, [
869
+ H(B(a.title) + " ", 1),
870
+ a.subTitle ? (L(), G("span", we, [
871
+ e[3] || (e[3] = H(" (")),
872
+ a.view === "desktop" ? (L(), z(d, {
283
873
  key: 0,
284
874
  name: "stars"
285
- })) : W("", !0),
286
- t("span", null, r(o.subTitle), 1),
287
- n[4] || (n[4] = D(") "))
288
- ])) : W("", !0)
875
+ })) : R("", !0),
876
+ o("span", null, B(a.subTitle), 1),
877
+ e[4] || (e[4] = H(") "))
878
+ ])) : R("", !0)
289
879
  ])
290
880
  ]),
291
- t("div", he, r(o.content), 1)
881
+ o("div", ye, B(a.content), 1)
292
882
  ])
293
883
  ]),
294
884
  _: 2
295
885
  }, 1024)
296
- ], 10, ue))), 128))
886
+ ], 10, he))), 128))
297
887
  ]),
298
- d.isCanvas ? (v(), T(b, {
888
+ l.isCanvas ? (L(), z(u, {
299
889
  key: 0,
300
890
  width: "200",
301
891
  trigger: "click",
302
892
  "popper-class": "toolbar-media-popper"
303
893
  }, {
304
- reference: c(() => [
305
- t("span", we, [
306
- t("span", null, [
307
- t("span", null, r(parseInt(i.state.width)), 1),
308
- n[5] || (n[5] = t("span", { class: "symbol" }, "px", -1))
894
+ reference: F(() => [
895
+ o("span", ge, [
896
+ o("span", null, [
897
+ o("span", null, B(parseInt(t.state.width)), 1),
898
+ e[5] || (e[5] = o("span", { class: "symbol" }, "px", -1))
309
899
  ]),
310
- t("span", null, [
311
- t("span", null, r(i.scale.toFixed(2)), 1),
312
- n[6] || (n[6] = t("span", { class: "symbol" }, "%", -1))
900
+ o("span", null, [
901
+ o("span", null, B(t.scale.toFixed(2)), 1),
902
+ e[6] || (e[6] = o("span", { class: "symbol" }, "%", -1))
313
903
  ])
314
904
  ])
315
905
  ]),
316
- default: c(() => [
317
- t("div", be, [
318
- t("div", ye, r(i.state.textData.title), 1),
319
- t("div", fe, [
320
- t("div", null, [
321
- t("label", null, r(i.state.textData.width), 1),
322
- g(m, {
323
- modelValue: i.state.width,
324
- "onUpdate:modelValue": n[0] || (n[0] = (o) => i.state.width = o),
325
- onChange: i.widthChange
906
+ default: F(() => [
907
+ o("div", fe, [
908
+ o("div", _e, B(t.state.textData.title), 1),
909
+ o("div", Ve, [
910
+ o("div", null, [
911
+ o("label", null, B(t.state.textData.width), 1),
912
+ j(c, {
913
+ modelValue: t.state.width,
914
+ "onUpdate:modelValue": e[0] || (e[0] = (a) => t.state.width = a),
915
+ onChange: t.widthChange
326
916
  }, {
327
- suffix: c(() => n[7] || (n[7] = [
328
- t("span", null, "px", -1)
917
+ suffix: F(() => e[7] || (e[7] = [
918
+ o("span", null, "px", -1)
329
919
  ])),
330
920
  _: 1
331
921
  }, 8, ["modelValue", "onChange"])
332
922
  ]),
333
- t("div", null, [
334
- t("label", null, r(i.state.textData.scale), 1),
335
- g(m, {
336
- modelValue: i.state.scaleValue,
337
- "onUpdate:modelValue": n[1] || (n[1] = (o) => i.state.scaleValue = o),
338
- readonly: i.state.readonly,
339
- onChange: i.scaleChange
923
+ o("div", null, [
924
+ o("label", null, B(t.state.textData.scale), 1),
925
+ j(c, {
926
+ modelValue: t.state.scaleValue,
927
+ "onUpdate:modelValue": e[1] || (e[1] = (a) => t.state.scaleValue = a),
928
+ readonly: t.state.readonly,
929
+ onChange: t.scaleChange
340
930
  }, {
341
- suffix: c(() => n[8] || (n[8] = [
342
- t("span", null, "%", -1)
931
+ suffix: F(() => e[8] || (e[8] = [
932
+ o("span", null, "%", -1)
343
933
  ])),
344
934
  _: 1
345
935
  }, 8, ["modelValue", "readonly", "onChange"])
346
936
  ]),
347
- t("div", null, [
348
- n[9] || (n[9] = t("label", null, r("自由布局"), -1)),
349
- g(y, {
350
- modelValue: i.isAbsolute,
351
- "onUpdate:modelValue": n[2] || (n[2] = (o) => i.isAbsolute = o),
352
- onChange: i.changeCanvasType
937
+ o("div", null, [
938
+ e[9] || (e[9] = o("label", null, B("自由布局"), -1)),
939
+ j(x, {
940
+ modelValue: t.isAbsolute,
941
+ "onUpdate:modelValue": e[2] || (e[2] = (a) => t.isAbsolute = a),
942
+ onChange: t.changeCanvasType
353
943
  }, null, 8, ["modelValue", "onChange"])
354
944
  ])
355
945
  ])
356
946
  ])
357
947
  ]),
358
948
  _: 1
359
- })) : W("", !0)
949
+ })) : R("", !0)
360
950
  ])
361
951
  ]),
362
952
  _: 1
363
953
  }, 8, ["options"]);
364
954
  }
365
- const Ve = /* @__PURE__ */ re(de, [["render", ge], ["__scopeId", "data-v-9173161d"]]), ke = {
366
- id: "engine.toolbars.media",
367
- type: "toolbars",
368
- title: "media",
369
- options: {
370
- icon: {
371
- default: ""
372
- },
373
- renderType: "slot"
374
- }
375
- }, Ne = {
376
- ...ke,
377
- entry: Ve
955
+ const ke = /* @__PURE__ */ pe(me, [["render", Ce], ["__scopeId", "data-v-da625a27"]]), Ne = {
956
+ ...J,
957
+ entry: ke
378
958
  };
379
959
  export {
380
960
  Ne as default