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