@opentiny/tiny-engine-toolbar-redoundo 2.0.0 → 2.1.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.
Files changed (2) hide show
  1. package/dist/index.js +43 -45
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -2,13 +2,13 @@ import "./style.css";
2
2
  import { Popover as S } from "@opentiny/vue";
3
3
  import { useHistory as w, useCanvas as s, HOOK_NAME as _ } from "@opentiny/tiny-engine-meta-register";
4
4
  import { ToolbarBase as k } from "@opentiny/tiny-engine-common";
5
- import { resolveComponent as c, openBlock as x, createBlock as H, withCtx as p, createElementVNode as d, createVNode as a, normalizeClass as b, reactive as O, watch as C, isProxy as N, toRaw as A } from "vue";
6
- const B = (e, o) => {
7
- const r = e.__vccOpts || e;
8
- for (const [f, u] of o)
9
- r[f] = u;
5
+ import { resolveComponent as c, openBlock as x, createBlock as H, withCtx as p, createElementVNode as d, createVNode as a, normalizeClass as b, reactive as O, watch as C, isProxy as N, toRaw as B } from "vue";
6
+ const P = (o, e) => {
7
+ const r = o.__vccOpts || o;
8
+ for (const [f, y] of e)
9
+ r[f] = y;
10
10
  return r;
11
- }, P = {
11
+ }, T = {
12
12
  components: {
13
13
  TinyPopover: S,
14
14
  ToolbarBase: k
@@ -22,44 +22,44 @@ const B = (e, o) => {
22
22
  setup() {
23
23
  return w();
24
24
  }
25
- }, T = { class: "redo-undo-wrap" };
26
- function j(e, o, r, f, u, R) {
27
- const y = c("svg-icon"), m = c("tiny-popover"), h = c("toolbar-base");
28
- return x(), H(h, { options: r.options }, {
25
+ }, j = { class: "redo-undo-wrap" };
26
+ function E(o, e, r, f, y, R) {
27
+ const m = c("svg-icon"), u = c("tiny-popover"), v = c("toolbar-base");
28
+ return x(), H(v, { options: r.options }, {
29
29
  default: p(() => [
30
- d("span", T, [
31
- a(m, {
30
+ d("span", j, [
31
+ a(u, {
32
32
  trigger: "hover",
33
33
  "open-delay": 1e3,
34
34
  "popper-class": "toolbar-right-popover",
35
35
  "append-to-body": "",
36
- content: e.historyState.back ? "撤销" : "没有要撤销的"
36
+ content: o.historyState.back ? "撤销" : "没有要撤销的"
37
37
  }, {
38
38
  reference: p(() => [
39
39
  d("span", {
40
- class: b(["icon-wrap", "undo", { disabled: !e.historyState.back }]),
41
- onClick: o[0] || (o[0] = (...i) => e.back && e.back(...i))
40
+ class: b(["icon-wrap", "undo", { disabled: !o.historyState.back }]),
41
+ onClick: e[0] || (e[0] = (...i) => o.back && o.back(...i))
42
42
  }, [
43
- a(y, {
43
+ a(m, {
44
44
  name: r.options.icon.undo
45
45
  }, null, 8, ["name"])
46
46
  ], 2)
47
47
  ]),
48
48
  _: 1
49
49
  }, 8, ["content"]),
50
- a(m, {
50
+ a(u, {
51
51
  trigger: "hover",
52
52
  "open-delay": 1e3,
53
53
  "popper-class": "toolbar-right-popover",
54
54
  "append-to-body": "",
55
- content: e.historyState.forward ? "恢复" : "没有要恢复的"
55
+ content: o.historyState.forward ? "恢复" : "没有要恢复的"
56
56
  }, {
57
57
  reference: p(() => [
58
58
  d("span", {
59
- class: b(["icon-wrap", "redo", e.historyState.forward ? "" : "disabled"]),
60
- onClick: o[1] || (o[1] = (...i) => e.forward && e.forward(...i))
59
+ class: b(["icon-wrap", "redo", o.historyState.forward ? "" : "disabled"]),
60
+ onClick: e[1] || (e[1] = (...i) => o.forward && o.forward(...i))
61
61
  }, [
62
- a(y, {
62
+ a(m, {
63
63
  name: r.options.icon.redo
64
64
  }, null, 8, ["name"])
65
65
  ], 2)
@@ -71,7 +71,7 @@ function j(e, o, r, f, u, R) {
71
71
  _: 1
72
72
  }, 8, ["options"]);
73
73
  }
74
- const E = /* @__PURE__ */ B(P, [["render", j], ["__scopeId", "data-v-dc6af9aa"]]), J = {
74
+ const J = /* @__PURE__ */ P(T, [["render", E], ["__scopeId", "data-v-dc6af9aa"]]), M = {
75
75
  id: "engine.toolbars.redoundo",
76
76
  type: "toolbars",
77
77
  title: "redoundo",
@@ -82,27 +82,26 @@ const E = /* @__PURE__ */ B(P, [["render", j], ["__scopeId", "data-v-dc6af9aa"]]
82
82
  },
83
83
  renderType: "slot"
84
84
  }
85
- }, M = (e) => (N(e) && (e = A(e)), JSON.stringify(e)), V = (e) => {
86
- let o;
85
+ }, V = (o) => (N(o) && (o = B(o)), JSON.stringify(o)), $ = (o) => {
86
+ let e;
87
87
  try {
88
- o = JSON.parse(e);
88
+ e = JSON.parse(o);
89
89
  } catch {
90
- o = {};
90
+ e = {};
91
91
  }
92
- return o;
93
- }, n = [], v = 5, t = O({
92
+ return e;
93
+ }, n = [], g = 5, t = O({
94
94
  index: 0,
95
95
  back: !1,
96
96
  forward: !1
97
- }), g = (e) => {
98
- let o = n.length;
99
- t.index < o - 1 && (n.splice(t.index + 1), o = n.length), o >= v && n.splice(0, o - v + 1), n.push(M(e)), t.index = n.length - 1;
100
- }, l = (e, o) => {
101
- var r;
102
- t.index = t.index + e, (r = s().canvasApi.value) == null || r.setSchema(V(n[t.index])), typeof o == "boolean" && n.splice(1, 1);
103
- }, $ = () => {
104
- t.back && (l(-1), s().setSaved(!1));
97
+ }), h = (o) => {
98
+ let e = n.length;
99
+ t.index < e - 1 && (n.splice(t.index + 1), e = n.length), e >= g && n.splice(0, e - g + 1), n.push(V(o)), t.index = n.length - 1;
100
+ }, l = (o, e) => {
101
+ t.index = t.index + o, s().importSchema($(n[t.index])), typeof e == "boolean" && n.splice(1, 1);
105
102
  }, z = () => {
103
+ t.back && (l(-1), s().setSaved(!1));
104
+ }, A = () => {
106
105
  t.forward && (l(1), s().setSaved(t.index === n.length - 1));
107
106
  }, D = () => {
108
107
  n.splice(0), Object.assign(t, {
@@ -110,20 +109,19 @@ const E = /* @__PURE__ */ B(P, [["render", j], ["__scopeId", "data-v-dc6af9aa"]]
110
109
  back: !1,
111
110
  forward: !1
112
111
  });
113
- }, I = (e) => {
114
- var o;
115
- e ? (D(), g(e)) : (s().setSaved(!1), g((o = s().canvasApi.value) == null ? void 0 : o.getSchema()));
112
+ }, I = (o) => {
113
+ o ? (D(), h(o)) : (s().setSaved(!1), h(s().getSchema()));
116
114
  };
117
115
  C(
118
116
  () => t.index,
119
- (e) => {
120
- t.back = e > 0, t.forward = e < n.length - 1;
117
+ (o) => {
118
+ t.back = o > 0, t.forward = o < n.length - 1;
121
119
  }
122
120
  );
123
121
  const K = () => ({
124
122
  historyState: t,
125
- back: $,
126
- forward: z,
123
+ back: z,
124
+ forward: A,
127
125
  go: l,
128
126
  addHistory: I
129
127
  }), L = {
@@ -134,8 +132,8 @@ const K = () => ({
134
132
  name: _.useHistory
135
133
  }
136
134
  }, W = {
137
- ...J,
138
- entry: E,
135
+ ...M,
136
+ entry: J,
139
137
  metas: [L]
140
138
  };
141
139
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-redoundo",
3
- "version": "2.0.0",
3
+ "version": "2.1.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.0.0",
29
- "@opentiny/tiny-engine-meta-register": "2.0.0"
28
+ "@opentiny/tiny-engine-common": "2.1.0",
29
+ "@opentiny/tiny-engine-meta-register": "2.1.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0",
32
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.1.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.14.0",
39
39
  "vue": "^3.4.15"
40
40
  },
41
- "gitHead": "26b32b2236bb85d8113158fd1475884aa99a9657"
41
+ "gitHead": "faf3072c75ea5024689972e2a687916e084c156f"
42
42
  }