@opentiny/tiny-engine-toolbar-redoundo 2.4.0 → 2.5.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,12 +1,23 @@
1
1
  import "./style.css";
2
- import { Popover as w } from "@opentiny/vue";
3
- import { useHistory as S, useCanvas as h, HOOK_NAME as _ } from "@opentiny/tiny-engine-meta-register";
4
- import { ToolbarBase as k } from "@opentiny/tiny-engine-common";
5
- import { resolveComponent as c, createBlock as C, openBlock as x, withCtx as p, createElementVNode as d, createVNode as a, normalizeClass as m, reactive as H, watch as O, isProxy as A, toRaw as N } from "vue";
6
- const B = {
2
+ import { useHistory as H, callEntry as m, useCanvas as i, HOOK_NAME as O } from "@opentiny/tiny-engine-meta-register";
3
+ import { Popover as A } from "@opentiny/vue";
4
+ import { ToolbarBase as N } from "@opentiny/tiny-engine-common";
5
+ import { resolveComponent as v, createBlock as B, openBlock as E, withCtx as S, createElementVNode as w, createVNode as h, normalizeClass as D, isProxy as P, toRaw as T, reactive as j, watch as J } from "vue";
6
+ const M = {
7
+ id: "engine.toolbars.redoundo",
8
+ type: "toolbars",
9
+ title: "redoundo",
10
+ options: {
11
+ icon: {
12
+ undo: "undo",
13
+ redo: "redo"
14
+ },
15
+ renderType: "slot"
16
+ }
17
+ }, V = {
7
18
  components: {
8
- TinyPopover: w,
9
- ToolbarBase: k
19
+ TinyPopover: A,
20
+ ToolbarBase: N
10
21
  },
11
22
  props: {
12
23
  options: {
@@ -15,52 +26,52 @@ const B = {
15
26
  }
16
27
  },
17
28
  setup() {
18
- return S();
29
+ return H();
19
30
  }
20
- }, D = (o, e) => {
21
- const r = o.__vccOpts || o;
22
- for (const [s, u] of e)
23
- r[s] = u;
24
- return r;
25
- }, P = { class: "redo-undo-wrap" };
26
- function T(o, e, r, s, u, R) {
27
- const f = c("svg-icon"), y = c("tiny-popover"), v = c("toolbar-base");
28
- return x(), C(v, { options: r.options }, {
29
- default: p(() => [
30
- d("span", P, [
31
- a(y, {
31
+ }, $ = (e, n) => {
32
+ const c = e.__vccOpts || e;
33
+ for (const [g, x] of n)
34
+ c[g] = x;
35
+ return c;
36
+ }, z = { class: "redo-undo-wrap" };
37
+ function I(e, n, c, g, x, q) {
38
+ const k = v("svg-icon"), _ = v("tiny-popover"), C = v("toolbar-base");
39
+ return E(), B(C, { options: c.options }, {
40
+ default: S(() => [
41
+ w("span", z, [
42
+ h(_, {
32
43
  trigger: "hover",
33
44
  "open-delay": 1e3,
34
45
  "popper-class": "toolbar-right-popover",
35
46
  "append-to-body": "",
36
- content: o.historyState.back ? "撤销" : "没有要撤销的"
47
+ content: e.historyState.back ? "撤销" : "没有要撤销的"
37
48
  }, {
38
- reference: p(() => [
39
- d("span", {
40
- class: m(["icon-wrap", "undo", { disabled: !o.historyState.back }]),
41
- onClick: e[0] || (e[0] = (...i) => o.back && o.back(...i))
49
+ reference: S(() => [
50
+ w("span", {
51
+ class: D(["icon-wrap", "undo", { disabled: !e.historyState.back }]),
52
+ onClick: n[0] || (n[0] = (...b) => e.back && e.back(...b))
42
53
  }, [
43
- a(f, {
44
- name: r.options.icon.undo
54
+ h(k, {
55
+ name: c.options.icon.undo
45
56
  }, null, 8, ["name"])
46
57
  ], 2)
47
58
  ]),
48
59
  _: 1
49
60
  }, 8, ["content"]),
50
- a(y, {
61
+ h(_, {
51
62
  trigger: "hover",
52
63
  "open-delay": 1e3,
53
64
  "popper-class": "toolbar-right-popover",
54
65
  "append-to-body": "",
55
- content: o.historyState.forward ? "恢复" : "没有要恢复的"
66
+ content: e.historyState.forward ? "恢复" : "没有要恢复的"
56
67
  }, {
57
- reference: p(() => [
58
- d("span", {
59
- class: m(["icon-wrap", "redo", o.historyState.forward ? "" : "disabled"]),
60
- onClick: e[1] || (e[1] = (...i) => o.forward && o.forward(...i))
68
+ reference: S(() => [
69
+ w("span", {
70
+ class: D(["icon-wrap", "redo", e.historyState.forward ? "" : "disabled"]),
71
+ onClick: n[1] || (n[1] = (...b) => e.forward && e.forward(...b))
61
72
  }, [
62
- a(f, {
63
- name: r.options.icon.redo
73
+ h(k, {
74
+ name: c.options.icon.redo
64
75
  }, null, 8, ["name"])
65
76
  ], 2)
66
77
  ]),
@@ -71,74 +82,210 @@ function T(o, e, r, s, u, R) {
71
82
  _: 1
72
83
  }, 8, ["options"]);
73
84
  }
74
- const j = /* @__PURE__ */ D(B, [["render", T], ["__scopeId", "data-v-479fa39e"]]), E = {
75
- id: "engine.toolbars.redoundo",
76
- type: "toolbars",
77
- title: "redoundo",
78
- options: {
79
- icon: {
80
- undo: "undo",
81
- redo: "redo"
82
- },
83
- renderType: "slot"
84
- }
85
- }, J = (o) => (A(o) && (o = N(o)), JSON.stringify(o)), M = (o) => {
86
- let e;
85
+ const K = /* @__PURE__ */ $(V, [["render", I], ["__scopeId", "data-v-20883111"]]), d = m((e) => (P(e) && (e = T(e)), JSON.stringify(e)), {
86
+ metaData: {
87
+ id: "engine.service.history.schema2String"
88
+ },
89
+ ctx: () => ({
90
+ useCanvas: i,
91
+ schema2String: d,
92
+ string2Schema: p,
93
+ list: o,
94
+ maxLength: a,
95
+ historyState: t,
96
+ push: s,
97
+ go: r,
98
+ back: u,
99
+ forward: y,
100
+ clear: l,
101
+ addHistory: f
102
+ })
103
+ }), p = m((e) => {
104
+ let n;
87
105
  try {
88
- e = JSON.parse(o);
106
+ n = JSON.parse(e);
89
107
  } catch {
90
- e = {};
108
+ n = {};
91
109
  }
92
- return e;
93
- }, n = [], b = 5, t = H({
110
+ return n;
111
+ }, {
112
+ metaData: {
113
+ id: "engine.service.history.string2Schema"
114
+ },
115
+ ctx: () => ({
116
+ useCanvas: i,
117
+ schema2String: d,
118
+ string2Schema: p,
119
+ list: o,
120
+ maxLength: a,
121
+ historyState: t,
122
+ push: s,
123
+ go: r,
124
+ back: u,
125
+ forward: y,
126
+ clear: l,
127
+ addHistory: f
128
+ })
129
+ }), o = [], a = 5, t = j({
94
130
  index: 0,
95
131
  back: !1,
96
132
  forward: !1
97
- }), g = (o) => {
98
- let e = n.length;
99
- t.index < e - 1 && (n.splice(t.index + 1), e = n.length), e >= b && n.splice(0, e - b + 1), n.push(J(o)), t.index = n.length - 1;
100
- }, l = (o, e) => {
101
- t.index = t.index + o;
102
- const { pageState: r, resetCanvasState: s } = h();
103
- s({ ...r, pageSchema: M(n[t.index]) }), typeof e == "boolean" && n.splice(1, 1);
104
- }, V = () => {
105
- t.back && l(-1);
106
- }, $ = () => {
107
- t.forward && l(1);
108
- }, z = () => {
109
- n.splice(0), Object.assign(t, {
133
+ }), s = m((e) => {
134
+ let n = o.length;
135
+ t.index < n - 1 && (o.splice(t.index + 1), n = o.length), n >= a && o.splice(0, n - a + 1), o.push(d(e)), t.index = o.length - 1;
136
+ }, {
137
+ metaData: {
138
+ id: "engine.service.history.push"
139
+ },
140
+ ctx: () => ({
141
+ useCanvas: i,
142
+ schema2String: d,
143
+ string2Schema: p,
144
+ list: o,
145
+ maxLength: a,
146
+ historyState: t,
147
+ push: s,
148
+ go: r,
149
+ back: u,
150
+ forward: y,
151
+ clear: l,
152
+ addHistory: f
153
+ })
154
+ }), r = m((e, n) => {
155
+ t.index = t.index + e;
156
+ const {
157
+ pageState: c,
158
+ resetCanvasState: g
159
+ } = i();
160
+ g({
161
+ ...c,
162
+ pageSchema: p(o[t.index])
163
+ }), typeof n == "boolean" && o.splice(1, 1);
164
+ }, {
165
+ metaData: {
166
+ id: "engine.service.history.go"
167
+ },
168
+ ctx: () => ({
169
+ useCanvas: i,
170
+ schema2String: d,
171
+ string2Schema: p,
172
+ list: o,
173
+ maxLength: a,
174
+ historyState: t,
175
+ push: s,
176
+ go: r,
177
+ back: u,
178
+ forward: y,
179
+ clear: l,
180
+ addHistory: f
181
+ })
182
+ }), u = m(() => {
183
+ t.back && r(-1);
184
+ }, {
185
+ metaData: {
186
+ id: "engine.service.history.back"
187
+ },
188
+ ctx: () => ({
189
+ useCanvas: i,
190
+ schema2String: d,
191
+ string2Schema: p,
192
+ list: o,
193
+ maxLength: a,
194
+ historyState: t,
195
+ push: s,
196
+ go: r,
197
+ back: u,
198
+ forward: y,
199
+ clear: l,
200
+ addHistory: f
201
+ })
202
+ }), y = m(() => {
203
+ t.forward && r(1);
204
+ }, {
205
+ metaData: {
206
+ id: "engine.service.history.forward"
207
+ },
208
+ ctx: () => ({
209
+ useCanvas: i,
210
+ schema2String: d,
211
+ string2Schema: p,
212
+ list: o,
213
+ maxLength: a,
214
+ historyState: t,
215
+ push: s,
216
+ go: r,
217
+ back: u,
218
+ forward: y,
219
+ clear: l,
220
+ addHistory: f
221
+ })
222
+ }), l = m(() => {
223
+ o.splice(0), Object.assign(t, {
110
224
  index: 0,
111
225
  back: !1,
112
226
  forward: !1
113
227
  });
114
- }, I = (o) => {
115
- o ? (z(), g(o)) : g(h().getSchema());
116
- };
117
- O(
118
- () => t.index,
119
- (o) => {
120
- t.back = o > 0, t.forward = o < n.length - 1;
121
- }
122
- );
123
- const K = () => ({
228
+ }, {
229
+ metaData: {
230
+ id: "engine.service.history.clear"
231
+ },
232
+ ctx: () => ({
233
+ useCanvas: i,
234
+ schema2String: d,
235
+ string2Schema: p,
236
+ list: o,
237
+ maxLength: a,
238
+ historyState: t,
239
+ push: s,
240
+ go: r,
241
+ back: u,
242
+ forward: y,
243
+ clear: l,
244
+ addHistory: f
245
+ })
246
+ }), f = m((e) => {
247
+ e ? (l(), s(e)) : s(i().getSchema());
248
+ }, {
249
+ metaData: {
250
+ id: "engine.service.history.addHistory"
251
+ },
252
+ ctx: () => ({
253
+ useCanvas: i,
254
+ schema2String: d,
255
+ string2Schema: p,
256
+ list: o,
257
+ maxLength: a,
258
+ historyState: t,
259
+ push: s,
260
+ go: r,
261
+ back: u,
262
+ forward: y,
263
+ clear: l,
264
+ addHistory: f
265
+ })
266
+ });
267
+ J(() => t.index, (e) => {
268
+ t.back = e > 0, t.forward = e < o.length - 1;
269
+ });
270
+ const L = () => ({
124
271
  historyState: t,
125
- back: V,
126
- forward: $,
127
- go: l,
128
- addHistory: I
129
- }), L = {
272
+ back: u,
273
+ forward: y,
274
+ go: r,
275
+ addHistory: f
276
+ }), R = {
130
277
  id: "engine.service.history",
131
278
  type: "MetaService",
132
- apis: K(),
279
+ apis: L(),
133
280
  composable: {
134
- name: _.useHistory
281
+ name: O.useHistory
135
282
  }
136
- }, W = {
137
- ...E,
138
- entry: j,
139
- metas: [L]
283
+ }, X = {
284
+ ...M,
285
+ entry: K,
286
+ metas: [R]
140
287
  };
141
288
  export {
142
- L as HistoryService,
143
- W as default
289
+ R as HistoryService,
290
+ X as default
144
291
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .redo-undo-wrap[data-v-479fa39e]{display:flex}.redo-undo-wrap[data-v-479fa39e] .icon-wrap{display:inline-flex;align-items:center;justify-content:center;height:32px;width:32px;border-radius:6px}.redo-undo-wrap[data-v-479fa39e] .icon-wrap svg{color:var(--te-toolbars-redoundo-text-color);font-size:20px}.redo-undo-wrap[data-v-479fa39e] .icon-wrap.disabled{cursor:not-allowed}.redo-undo-wrap[data-v-479fa39e] .icon-wrap.disabled svg{color:var(--te-toolbars-redoundo-text-color-disabled)}.redo-undo-wrap[data-v-479fa39e] .icon-wrap:not(.disabled):hover{background:var(--te-toolbars-redoundo-bg-color-active)}.redo-undo-wrap[data-v-479fa39e] .icon-wrap:not(.disabled):hover svg{color:var(--te-toolbars-redoundo-icon-color-hover)}.redo-undo-wrap[data-v-479fa39e] .icon-wrap.redo{margin-left:-5px}:root{--te-toolbars-redoundo-text-color: var(--te-common-text-primary);--te-toolbars-redoundo-text-color-disabled: var(--te-common-text-disabled);--te-toolbars-redoundo-bg-color-active: var(--te-common-bg-prompt);--te-toolbars-redoundo-icon-color-hover: var(--te-common-icon-hover)}
1
+ .redo-undo-wrap[data-v-20883111]{display:flex}.redo-undo-wrap[data-v-20883111] .icon-wrap{display:inline-flex;align-items:center;justify-content:center;height:32px;width:32px;border-radius:6px}.redo-undo-wrap[data-v-20883111] .icon-wrap svg{color:var(--te-toolbars-redoundo-text-color);font-size:20px}.redo-undo-wrap[data-v-20883111] .icon-wrap.disabled{cursor:not-allowed}.redo-undo-wrap[data-v-20883111] .icon-wrap.disabled svg{color:var(--te-toolbars-redoundo-text-color-disabled)}.redo-undo-wrap[data-v-20883111] .icon-wrap:not(.disabled):hover{background:var(--te-toolbars-redoundo-bg-color-active)}.redo-undo-wrap[data-v-20883111] .icon-wrap:not(.disabled):hover svg{color:var(--te-toolbars-redoundo-icon-color-hover)}.redo-undo-wrap[data-v-20883111] .icon-wrap.redo{margin-left:-5px}:root{--te-toolbars-redoundo-text-color: var(--te-common-text-primary);--te-toolbars-redoundo-text-color-disabled: var(--te-common-text-disabled);--te-toolbars-redoundo-bg-color-active: var(--te-common-bg-prompt);--te-toolbars-redoundo-icon-color-hover: var(--te-common-icon-hover)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-redoundo",
3
- "version": "2.4.0",
3
+ "version": "2.5.0-alpha.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -25,11 +25,11 @@
25
25
  "license": "MIT",
26
26
  "homepage": "https://opentiny.design/tiny-engine",
27
27
  "dependencies": {
28
- "@opentiny/tiny-engine-common": "2.4.0",
29
- "@opentiny/tiny-engine-meta-register": "2.4.0"
28
+ "@opentiny/tiny-engine-common": "2.5.0-alpha.0",
29
+ "@opentiny/tiny-engine-meta-register": "2.5.0-alpha.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.4.0",
32
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.0",
33
33
  "@vitejs/plugin-vue": "^5.1.2",
34
34
  "@vitejs/plugin-vue-jsx": "^4.0.1",
35
35
  "vite": "^5.4.2"
@@ -38,5 +38,5 @@
38
38
  "@opentiny/vue": "^3.20.0",
39
39
  "vue": "^3.4.15"
40
40
  },
41
- "gitHead": "477aa411da11a4f95712e3e5c251d97cae23f4ad"
41
+ "gitHead": "ae59c82734d79f650c9221cb9702714814b099c8"
42
42
  }