@opentiny/tiny-engine-toolbar-redoundo 2.0.0-alpha.2 → 2.0.0-alpha.3

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,76 +1,88 @@
1
1
  import "./style.css";
2
- import { Popover as b } from "@opentiny/vue";
3
- import { useHistory as _, useCanvas as s, HOOK_NAME as S } from "@opentiny/tiny-engine-meta-register";
4
- import { resolveComponent as u, openBlock as w, createElementBlock as k, createVNode as a, withCtx as y, createElementVNode as g, normalizeClass as v, reactive as x, watch as H, isProxy as C, toRaw as O } from "vue";
5
- const I = (e, o) => {
2
+ import { Popover as S } from "@opentiny/vue";
3
+ import { useHistory as w, useCanvas as s, HOOK_NAME as _ } from "@opentiny/tiny-engine-meta-register";
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) => {
6
7
  const r = e.__vccOpts || e;
7
- for (const [d, p] of o)
8
- r[d] = p;
8
+ for (const [f, u] of o)
9
+ r[f] = u;
9
10
  return r;
10
- }, N = {
11
+ }, P = {
11
12
  components: {
12
- TinyPopover: b
13
+ TinyPopover: S,
14
+ ToolbarBase: k
13
15
  },
14
16
  props: {
15
- undoIcon: {
16
- type: String,
17
- default: "undo"
18
- },
19
- redoIcon: {
20
- type: String,
21
- default: "redo"
17
+ options: {
18
+ type: Object,
19
+ default: () => ({})
22
20
  }
23
21
  },
24
22
  setup() {
25
- return _();
23
+ return w();
26
24
  }
27
- }, A = { class: "redo-undo-wrap" };
28
- function E(e, o, r, d, p, L) {
29
- const l = u("svg-icon"), f = u("tiny-popover");
30
- return w(), k("span", A, [
31
- a(f, {
32
- trigger: "hover",
33
- "open-delay": 1e3,
34
- "popper-class": "toolbar-right-popover",
35
- "append-to-body": "",
36
- content: e.historyState.back ? "撤销" : "没有要撤销的"
37
- }, {
38
- reference: y(() => [
39
- g("span", {
40
- class: v(["icon-wrap", "undo", { disabled: !e.historyState.back }]),
41
- onClick: o[0] || (o[0] = (...i) => e.back && e.back(...i))
42
- }, [
43
- a(l, { name: r.undoIcon }, null, 8, ["name"])
44
- ], 2)
45
- ]),
46
- _: 1
47
- }, 8, ["content"]),
48
- a(f, {
49
- trigger: "hover",
50
- "open-delay": 1e3,
51
- "popper-class": "toolbar-right-popover",
52
- "append-to-body": "",
53
- content: e.historyState.forward ? "恢复" : "没有要恢复的"
54
- }, {
55
- reference: y(() => [
56
- g("span", {
57
- class: v(["icon-wrap", "redo", e.historyState.forward ? "" : "disabled"]),
58
- onClick: o[1] || (o[1] = (...i) => e.forward && e.forward(...i))
59
- }, [
60
- a(l, { name: r.redoIcon }, null, 8, ["name"])
61
- ], 2)
62
- ]),
63
- _: 1
64
- }, 8, ["content"])
65
- ]);
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 }, {
29
+ default: p(() => [
30
+ d("span", T, [
31
+ a(m, {
32
+ trigger: "hover",
33
+ "open-delay": 1e3,
34
+ "popper-class": "toolbar-right-popover",
35
+ "append-to-body": "",
36
+ content: e.historyState.back ? "撤销" : "没有要撤销的"
37
+ }, {
38
+ reference: p(() => [
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))
42
+ }, [
43
+ a(y, {
44
+ name: r.options.icon.undo
45
+ }, null, 8, ["name"])
46
+ ], 2)
47
+ ]),
48
+ _: 1
49
+ }, 8, ["content"]),
50
+ a(m, {
51
+ trigger: "hover",
52
+ "open-delay": 1e3,
53
+ "popper-class": "toolbar-right-popover",
54
+ "append-to-body": "",
55
+ content: e.historyState.forward ? "恢复" : "没有要恢复的"
56
+ }, {
57
+ reference: p(() => [
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))
61
+ }, [
62
+ a(y, {
63
+ name: r.options.icon.redo
64
+ }, null, 8, ["name"])
65
+ ], 2)
66
+ ]),
67
+ _: 1
68
+ }, 8, ["content"])
69
+ ])
70
+ ]),
71
+ _: 1
72
+ }, 8, ["options"]);
66
73
  }
67
- const M = /* @__PURE__ */ I(N, [["render", E], ["__scopeId", "data-v-f52aff49"]]), P = {
74
+ const E = /* @__PURE__ */ B(P, [["render", j], ["__scopeId", "data-v-dc6af9aa"]]), J = {
68
75
  id: "engine.toolbars.redoundo",
69
76
  type: "toolbars",
70
77
  title: "redoundo",
71
- icon: "",
72
- align: "right"
73
- }, $ = (e) => (C(e) && (e = O(e)), JSON.stringify(e)), B = (e) => {
78
+ options: {
79
+ icon: {
80
+ undo: "undo",
81
+ redo: "redo"
82
+ },
83
+ renderType: "slot"
84
+ }
85
+ }, M = (e) => (N(e) && (e = A(e)), JSON.stringify(e)), V = (e) => {
74
86
  let o;
75
87
  try {
76
88
  o = JSON.parse(e);
@@ -78,55 +90,55 @@ const M = /* @__PURE__ */ I(N, [["render", E], ["__scopeId", "data-v-f52aff49"]]
78
90
  o = {};
79
91
  }
80
92
  return o;
81
- }, n = [], m = 5, t = x({
93
+ }, n = [], v = 5, t = O({
82
94
  index: 0,
83
95
  back: !1,
84
96
  forward: !1
85
- }), h = (e) => {
97
+ }), g = (e) => {
86
98
  let o = n.length;
87
- t.index < o - 1 && (n.splice(t.index + 1), o = n.length), o >= m && n.splice(0, o - m + 1), n.push($(e)), t.index = n.length - 1;
88
- }, c = (e, o) => {
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) => {
89
101
  var r;
90
- t.index = t.index + e, (r = s().canvasApi.value) == null || r.setSchema(B(n[t.index])), typeof o == "boolean" && n.splice(1, 1);
91
- }, J = () => {
92
- t.back && (c(-1), s().setSaved(!1));
93
- }, V = () => {
94
- t.forward && (c(1), s().setSaved(t.index === n.length - 1));
95
- }, j = () => {
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));
105
+ }, z = () => {
106
+ t.forward && (l(1), s().setSaved(t.index === n.length - 1));
107
+ }, D = () => {
96
108
  n.splice(0), Object.assign(t, {
97
109
  index: 0,
98
110
  back: !1,
99
111
  forward: !1
100
112
  });
101
- }, z = (e) => {
113
+ }, I = (e) => {
102
114
  var o;
103
- e ? (j(), h(e)) : (s().setSaved(!1), h((o = s().canvasApi.value) == null ? void 0 : o.getSchema()));
115
+ e ? (D(), g(e)) : (s().setSaved(!1), g((o = s().canvasApi.value) == null ? void 0 : o.getSchema()));
104
116
  };
105
- H(
117
+ C(
106
118
  () => t.index,
107
119
  (e) => {
108
120
  t.back = e > 0, t.forward = e < n.length - 1;
109
121
  }
110
122
  );
111
- const D = () => ({
123
+ const K = () => ({
112
124
  historyState: t,
113
- back: J,
114
- forward: V,
115
- go: c,
116
- addHistory: z
117
- }), K = {
125
+ back: $,
126
+ forward: z,
127
+ go: l,
128
+ addHistory: I
129
+ }), L = {
118
130
  id: "engine.service.history",
119
131
  type: "MetaService",
120
- apis: D(),
132
+ apis: K(),
121
133
  composable: {
122
- name: S.useHistory
134
+ name: _.useHistory
123
135
  }
124
- }, G = {
125
- ...P,
126
- entry: M,
127
- metas: [K]
136
+ }, W = {
137
+ ...J,
138
+ entry: E,
139
+ metas: [L]
128
140
  };
129
141
  export {
130
- K as HistoryService,
131
- G as default
142
+ L as HistoryService,
143
+ W as default
132
144
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .redo-undo-wrap[data-v-f52aff49]{display:flex}.redo-undo-wrap[data-v-f52aff49] .icon-wrap{display:inline-flex;align-items:center;justify-content:center;height:32px;width:32px;border-radius:6px}.redo-undo-wrap[data-v-f52aff49] .icon-wrap svg{color:var(--ti-lowcode-toolbar-title-color);font-size:20px}.redo-undo-wrap[data-v-f52aff49] .icon-wrap.disabled{cursor:not-allowed}.redo-undo-wrap[data-v-f52aff49] .icon-wrap.disabled svg{color:var(--ti-lowcode-disabled-color)}.redo-undo-wrap[data-v-f52aff49] .icon-wrap:not(.disabled):hover{background:var(--ti-lowcode-toolbar-view-active-bg)}.redo-undo-wrap[data-v-f52aff49] .icon-wrap:not(.disabled):hover svg{color:var(--ti-lowcode-toolbar-active-color)}.redo-undo-wrap[data-v-f52aff49] .icon-wrap.redo{margin-left:-5px}
1
+ .redo-undo-wrap[data-v-dc6af9aa]{display:flex}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap{display:inline-flex;align-items:center;justify-content:center;height:32px;width:32px;border-radius:6px}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap svg{color:var(--ti-lowcode-toolbar-title-color);font-size:20px}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap.disabled{cursor:not-allowed}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap.disabled svg{color:var(--ti-lowcode-disabled-color)}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap:not(.disabled):hover{background:var(--ti-lowcode-toolbar-view-active-bg)}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap:not(.disabled):hover svg{color:var(--ti-lowcode-toolbar-active-color)}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap.redo{margin-left:-5px}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-redoundo",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
7
  "scripts": {
8
8
  "build": "vite build"
9
9
  },
10
+ "type": "module",
10
11
  "main": "dist/index.js",
11
12
  "module": "dist/index.js",
12
13
  "files": [
@@ -24,17 +25,18 @@
24
25
  "license": "MIT",
25
26
  "homepage": "https://opentiny.design/tiny-engine",
26
27
  "dependencies": {
27
- "@opentiny/tiny-engine-meta-register": "2.0.0-alpha.2"
28
+ "@opentiny/tiny-engine-common": "2.0.0-alpha.3",
29
+ "@opentiny/tiny-engine-meta-register": "2.0.0-alpha.3"
28
30
  },
29
31
  "devDependencies": {
30
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-alpha.2",
31
- "@vitejs/plugin-vue": "^4.2.3",
32
- "@vitejs/plugin-vue-jsx": "^3.1.0",
33
- "vite": "^4.3.7"
32
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-alpha.3",
33
+ "@vitejs/plugin-vue": "^5.1.2",
34
+ "@vitejs/plugin-vue-jsx": "^4.0.1",
35
+ "vite": "^5.4.2"
34
36
  },
35
37
  "peerDependencies": {
36
38
  "@opentiny/vue": "^3.14.0",
37
39
  "vue": "^3.4.15"
38
40
  },
39
- "gitHead": "695ecd00f21aa39965a9ddb02590ae274f92cd8e"
41
+ "gitHead": "20aba1ffa81a1633feec954e3146586193c18f22"
40
42
  }