@opentiny/tiny-engine-toolbar-redoundo 2.5.0-alpha.0 → 2.5.0-alpha.2

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,23 +1,12 @@
1
1
  import "./style.css";
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 = {
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 = {
18
7
  components: {
19
- TinyPopover: A,
20
- ToolbarBase: N
8
+ TinyPopover: w,
9
+ ToolbarBase: k
21
10
  },
22
11
  props: {
23
12
  options: {
@@ -26,52 +15,52 @@ const M = {
26
15
  }
27
16
  },
28
17
  setup() {
29
- return H();
18
+ return S();
30
19
  }
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(_, {
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, {
43
32
  trigger: "hover",
44
33
  "open-delay": 1e3,
45
34
  "popper-class": "toolbar-right-popover",
46
35
  "append-to-body": "",
47
- content: e.historyState.back ? "撤销" : "没有要撤销的"
36
+ content: o.historyState.back ? "撤销" : "没有要撤销的"
48
37
  }, {
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))
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))
53
42
  }, [
54
- h(k, {
55
- name: c.options.icon.undo
43
+ a(f, {
44
+ name: r.options.icon.undo
56
45
  }, null, 8, ["name"])
57
46
  ], 2)
58
47
  ]),
59
48
  _: 1
60
49
  }, 8, ["content"]),
61
- h(_, {
50
+ a(y, {
62
51
  trigger: "hover",
63
52
  "open-delay": 1e3,
64
53
  "popper-class": "toolbar-right-popover",
65
54
  "append-to-body": "",
66
- content: e.historyState.forward ? "恢复" : "没有要恢复的"
55
+ content: o.historyState.forward ? "恢复" : "没有要恢复的"
67
56
  }, {
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))
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))
72
61
  }, [
73
- h(k, {
74
- name: c.options.icon.redo
62
+ a(f, {
63
+ name: r.options.icon.redo
75
64
  }, null, 8, ["name"])
76
65
  ], 2)
77
66
  ]),
@@ -82,210 +71,74 @@ function I(e, n, c, g, x, q) {
82
71
  _: 1
83
72
  }, 8, ["options"]);
84
73
  }
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;
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;
105
87
  try {
106
- n = JSON.parse(e);
88
+ e = JSON.parse(o);
107
89
  } catch {
108
- n = {};
90
+ e = {};
109
91
  }
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({
92
+ return e;
93
+ }, n = [], b = 5, t = H({
130
94
  index: 0,
131
95
  back: !1,
132
96
  forward: !1
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, {
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, {
224
110
  index: 0,
225
111
  back: !1,
226
112
  forward: !1
227
113
  });
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 = () => ({
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 = () => ({
271
124
  historyState: t,
272
- back: u,
273
- forward: y,
274
- go: r,
275
- addHistory: f
276
- }), R = {
125
+ back: V,
126
+ forward: $,
127
+ go: l,
128
+ addHistory: I
129
+ }), L = {
277
130
  id: "engine.service.history",
278
131
  type: "MetaService",
279
- apis: L(),
132
+ apis: K(),
280
133
  composable: {
281
- name: O.useHistory
134
+ name: _.useHistory
282
135
  }
283
- }, X = {
284
- ...M,
285
- entry: K,
286
- metas: [R]
136
+ }, W = {
137
+ ...E,
138
+ entry: j,
139
+ metas: [L]
287
140
  };
288
141
  export {
289
- R as HistoryService,
290
- X as default
142
+ L as HistoryService,
143
+ W as default
291
144
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
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)}
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)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-redoundo",
3
- "version": "2.5.0-alpha.0",
3
+ "version": "2.5.0-alpha.2",
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.5.0-alpha.0",
29
- "@opentiny/tiny-engine-meta-register": "2.5.0-alpha.0"
28
+ "@opentiny/tiny-engine-common": "2.5.0-alpha.2",
29
+ "@opentiny/tiny-engine-meta-register": "2.5.0-alpha.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.0",
32
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.2",
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": "ae59c82734d79f650c9221cb9702714814b099c8"
41
+ "gitHead": "f5707c379397bffc9a63c50c695f3ee3340ad0c6"
42
42
  }