@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 +235 -88
- package/dist/style.css +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ToolbarBase as
|
|
5
|
-
import { resolveComponent as
|
|
6
|
-
const
|
|
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:
|
|
9
|
-
ToolbarBase:
|
|
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
|
|
29
|
+
return H();
|
|
19
30
|
}
|
|
20
|
-
},
|
|
21
|
-
const
|
|
22
|
-
for (const [
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
},
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
return
|
|
29
|
-
default:
|
|
30
|
-
|
|
31
|
-
|
|
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:
|
|
47
|
+
content: e.historyState.back ? "撤销" : "没有要撤销的"
|
|
37
48
|
}, {
|
|
38
|
-
reference:
|
|
39
|
-
|
|
40
|
-
class:
|
|
41
|
-
onClick:
|
|
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
|
-
|
|
44
|
-
name:
|
|
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
|
-
|
|
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:
|
|
66
|
+
content: e.historyState.forward ? "恢复" : "没有要恢复的"
|
|
56
67
|
}, {
|
|
57
|
-
reference:
|
|
58
|
-
|
|
59
|
-
class:
|
|
60
|
-
onClick:
|
|
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
|
-
|
|
63
|
-
name:
|
|
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
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
106
|
+
n = JSON.parse(e);
|
|
89
107
|
} catch {
|
|
90
|
-
|
|
108
|
+
n = {};
|
|
91
109
|
}
|
|
92
|
-
return
|
|
93
|
-
},
|
|
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
|
-
}),
|
|
98
|
-
let
|
|
99
|
-
t.index <
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
() =>
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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:
|
|
126
|
-
forward:
|
|
127
|
-
go:
|
|
128
|
-
addHistory:
|
|
129
|
-
}),
|
|
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:
|
|
279
|
+
apis: L(),
|
|
133
280
|
composable: {
|
|
134
|
-
name:
|
|
281
|
+
name: O.useHistory
|
|
135
282
|
}
|
|
136
|
-
},
|
|
137
|
-
...
|
|
138
|
-
entry:
|
|
139
|
-
metas: [
|
|
283
|
+
}, X = {
|
|
284
|
+
...M,
|
|
285
|
+
entry: K,
|
|
286
|
+
metas: [R]
|
|
140
287
|
};
|
|
141
288
|
export {
|
|
142
|
-
|
|
143
|
-
|
|
289
|
+
R as HistoryService,
|
|
290
|
+
X as default
|
|
144
291
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.redo-undo-wrap[data-v-
|
|
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.
|
|
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.
|
|
29
|
-
"@opentiny/tiny-engine-meta-register": "2.
|
|
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.
|
|
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": "
|
|
41
|
+
"gitHead": "ae59c82734d79f650c9221cb9702714814b099c8"
|
|
42
42
|
}
|