@univerjs/slides 0.17.0 → 0.18.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/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -759
- package/lib/index.js +1 -759
- package/lib/types/basics/demo-data.d.ts +16 -1
- package/lib/types/plugin.d.ts +17 -1
- package/lib/types/views/render/adaptor.d.ts +18 -2
- package/lib/types/views/render/adaptors/docs-adaptor.d.ts +17 -1
- package/lib/types/views/render/adaptors/image-adaptor.d.ts +17 -1
- package/lib/types/views/render/adaptors/rich-text-adaptor.d.ts +19 -2
- package/lib/types/views/render/adaptors/shape-adaptor.d.ts +17 -1
- package/lib/types/views/render/adaptors/slide-adaptor.d.ts +17 -1
- package/lib/types/views/render/adaptors/spreadsheet-adaptor.d.ts +17 -1
- package/lib/types/views/render/object-provider.d.ts +18 -2
- package/lib/umd/index.js +1 -1
- package/package.json +8 -7
package/lib/index.js
CHANGED
|
@@ -1,759 +1 @@
|
|
|
1
|
-
var Pe = Object.defineProperty;
|
|
2
|
-
var be = (r, e, i) => e in r ? Pe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[e] = i;
|
|
3
|
-
var h = (r, e, i) => be(r, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
-
import { Plugin as De, merge as Oe, UniverInstanceType as Ee, Inject as H, Injector as G, IConfigService as _e, Registry as ke, LocaleService as oe, PageElementType as $, DocumentDataModel as Ve, getColorStyle as re, BasicShapes as ee, sortRules as je, SlideDataModel as Me, IContextService as Re, Styles as Xe, Worksheet as ze } from "@univerjs/core";
|
|
5
|
-
import { IRenderingEngine as Le, IRenderManagerService as Ae, Liquid as Ne, DocumentViewModel as He, DocumentSkeleton as We, Documents as Ce, SceneViewer as ve, Scene as le, Viewport as Y, ScrollBar as Se, Image as Ie, PageLayoutType as ge, RichText as Ye, Rect as q, Circle as $e, Slide as Fe, SpreadsheetSkeleton as Ke, Spreadsheet as Be, SpreadsheetRowHeader as Ue, SpreadsheetColumnHeader as qe, getColor as pe } from "@univerjs/engine-render";
|
|
6
|
-
const Ge = "@univerjs/slides", Ze = "0.17.0", ue = {
|
|
7
|
-
name: Ge,
|
|
8
|
-
version: Ze
|
|
9
|
-
}, Je = "slides.config", fe = {};
|
|
10
|
-
var Qe = Object.getOwnPropertyDescriptor, et = (r, e, i, n) => {
|
|
11
|
-
for (var t = n > 1 ? void 0 : n ? Qe(e, i) : e, a = r.length - 1, s; a >= 0; a--)
|
|
12
|
-
(s = r[a]) && (t = s(t) || t);
|
|
13
|
-
return t;
|
|
14
|
-
}, te = (r, e) => (i, n) => e(i, n, r), C;
|
|
15
|
-
let we = (C = class extends De {
|
|
16
|
-
// private _canvasView: CanvasView | null = null;
|
|
17
|
-
constructor(e = fe, i, n, t) {
|
|
18
|
-
super();
|
|
19
|
-
h(this, "_canvasEngine", null);
|
|
20
|
-
this._config = e, this._injector = i, this._renderManagerService = n, this._configService = t;
|
|
21
|
-
const { ...a } = Oe(
|
|
22
|
-
{},
|
|
23
|
-
fe,
|
|
24
|
-
this._config
|
|
25
|
-
);
|
|
26
|
-
this._configService.setConfig(Je, a), this._initializeDependencies(this._injector);
|
|
27
|
-
}
|
|
28
|
-
initialize() {
|
|
29
|
-
this.initCanvasEngine();
|
|
30
|
-
}
|
|
31
|
-
onReady() {
|
|
32
|
-
}
|
|
33
|
-
getConfig() {
|
|
34
|
-
return this._config;
|
|
35
|
-
}
|
|
36
|
-
initCanvasEngine() {
|
|
37
|
-
this._canvasEngine = this._injector.get(Le);
|
|
38
|
-
}
|
|
39
|
-
onRendered() {
|
|
40
|
-
this.initialize();
|
|
41
|
-
}
|
|
42
|
-
getCanvasEngine() {
|
|
43
|
-
return this._canvasEngine;
|
|
44
|
-
}
|
|
45
|
-
_initializeDependencies(e) {
|
|
46
|
-
[
|
|
47
|
-
// [CanvasView],
|
|
48
|
-
// [DocSelectionManagerService],
|
|
49
|
-
].forEach((n) => {
|
|
50
|
-
e.add(n);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}, h(C, "pluginName", "UNIVER_SLIDES_PLUGIN"), h(C, "packageName", ue.name), h(C, "version", ue.version), h(C, "type", Ee.UNIVER_SLIDE), C);
|
|
54
|
-
we = et([
|
|
55
|
-
te(1, H(G)),
|
|
56
|
-
te(2, Ae),
|
|
57
|
-
te(3, _e)
|
|
58
|
-
], we);
|
|
59
|
-
class F {
|
|
60
|
-
constructor() {
|
|
61
|
-
h(this, "zIndex", 0);
|
|
62
|
-
h(this, "viewKey", null);
|
|
63
|
-
}
|
|
64
|
-
check(e) {
|
|
65
|
-
if (e === this.viewKey)
|
|
66
|
-
return this;
|
|
67
|
-
}
|
|
68
|
-
create(e) {
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
const W = ke.create();
|
|
72
|
-
var tt = Object.getOwnPropertyDescriptor, rt = (r, e, i, n) => {
|
|
73
|
-
for (var t = n > 1 ? void 0 : n ? tt(e, i) : e, a = r.length - 1, s; a >= 0; a--)
|
|
74
|
-
(s = r[a]) && (t = s(t) || t);
|
|
75
|
-
return t;
|
|
76
|
-
}, it = (r, e) => (i, n) => e(i, n, r);
|
|
77
|
-
let ie = class extends F {
|
|
78
|
-
constructor(e) {
|
|
79
|
-
super();
|
|
80
|
-
h(this, "zIndex", 5);
|
|
81
|
-
h(this, "viewKey", $.DOCUMENT);
|
|
82
|
-
h(this, "_liquid", new Ne());
|
|
83
|
-
this._localeService = e;
|
|
84
|
-
}
|
|
85
|
-
check(e) {
|
|
86
|
-
if (e === this.viewKey)
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
// eslint-disable-next-line max-lines-per-function
|
|
90
|
-
convert(e, i) {
|
|
91
|
-
var de, he;
|
|
92
|
-
const {
|
|
93
|
-
id: n,
|
|
94
|
-
zIndex: t,
|
|
95
|
-
left: a = 0,
|
|
96
|
-
top: s = 0,
|
|
97
|
-
width: l,
|
|
98
|
-
height: c,
|
|
99
|
-
angle: _,
|
|
100
|
-
scaleX: v,
|
|
101
|
-
scaleY: p,
|
|
102
|
-
skewX: d,
|
|
103
|
-
skewY: g,
|
|
104
|
-
flipX: f,
|
|
105
|
-
flipY: u,
|
|
106
|
-
title: D,
|
|
107
|
-
description: j,
|
|
108
|
-
document: m
|
|
109
|
-
} = e;
|
|
110
|
-
if (m == null)
|
|
111
|
-
return;
|
|
112
|
-
const x = new Ve(m), o = new He(x), S = We.create(o, this._localeService), I = new Ce("__DocsRender__", S);
|
|
113
|
-
S.calculate();
|
|
114
|
-
const P = new ve("__DocsViewer__" + n, {
|
|
115
|
-
top: s,
|
|
116
|
-
left: a,
|
|
117
|
-
width: l,
|
|
118
|
-
height: c,
|
|
119
|
-
zIndex: t,
|
|
120
|
-
angle: _,
|
|
121
|
-
scaleX: v,
|
|
122
|
-
scaleY: p,
|
|
123
|
-
skewX: d,
|
|
124
|
-
skewY: g,
|
|
125
|
-
flipX: f,
|
|
126
|
-
flipY: u
|
|
127
|
-
}), w = new le("__DocsScene__" + n, P), T = new Y("__DocsViewPort_" + n, w, {
|
|
128
|
-
left: 0,
|
|
129
|
-
top: 0,
|
|
130
|
-
bottom: 0,
|
|
131
|
-
right: 0,
|
|
132
|
-
explicitViewportWidthSet: !1,
|
|
133
|
-
explicitViewportHeightSet: !1,
|
|
134
|
-
isWheelPreventDefaultX: !0
|
|
135
|
-
});
|
|
136
|
-
w.attachControl(), w.onMouseWheel$.subscribeEvent((E, N) => {
|
|
137
|
-
const b = E;
|
|
138
|
-
if (b.ctrlKey) {
|
|
139
|
-
const R = Math.abs(b.deltaX);
|
|
140
|
-
let k = R < 40 ? 0.2 : R < 80 ? 0.4 : 0.2;
|
|
141
|
-
k *= b.deltaY > 0 ? -1 : 1, w.scaleX < 1 && (k /= 2), w.scaleX + k > 4 ? w.scale(4, 4) : w.scaleX + k < 0.1 ? w.scale(0.1, 0.1) : (b.deltaY > 0, b.preventDefault());
|
|
142
|
-
} else
|
|
143
|
-
T.onMouseWheel(b, N);
|
|
144
|
-
}), new Se(T, {
|
|
145
|
-
mainScene: i
|
|
146
|
-
}), w.addObject(I);
|
|
147
|
-
const y = S.getActualSize();
|
|
148
|
-
I.resize(y.actualWidth, y.actualHeight), w.resize(y.actualWidth, y.actualHeight + 200), (de = I.getSkeleton()) == null || de.getPageSize(), I.pageRender$.subscribe((E) => {
|
|
149
|
-
const { page: N, pageLeft: b, pageTop: R, ctx: k } = E, { width: Z, height: J, marginBottom: Q, marginLeft: V, marginRight: K, marginTop: B } = N;
|
|
150
|
-
k.save(), k.translate(b - 0.5, R - 0.5), k.restore();
|
|
151
|
-
});
|
|
152
|
-
const { left: M, top: X } = I, L = S.getSkeletonData();
|
|
153
|
-
if (L == null)
|
|
154
|
-
return;
|
|
155
|
-
const { pages: A } = L, O = [], z = /* @__PURE__ */ new Map();
|
|
156
|
-
this._recalculateSizeBySkeleton(I, w, S);
|
|
157
|
-
for (let E = 0, N = A.length; E < N; E++) {
|
|
158
|
-
const b = A[E], { skeDrawings: R, marginLeft: k, marginTop: Z, pageWidth: J, pageHeight: Q } = b;
|
|
159
|
-
this._liquid.translatePagePadding(b), R.forEach((V) => {
|
|
160
|
-
const { aLeft: K, aTop: B, height: xe, width: Te, drawingOrigin: ye } = V, { docTransform: Pt } = ye, me = new Ie(V.drawingId, {
|
|
161
|
-
// url: docTransform.imageProperties?.contentUrl || '',
|
|
162
|
-
left: K + M + this._liquid.x,
|
|
163
|
-
top: B + X + this._liquid.y,
|
|
164
|
-
width: Te,
|
|
165
|
-
height: xe,
|
|
166
|
-
zIndex: 11
|
|
167
|
-
});
|
|
168
|
-
z.set(V.drawingId, {
|
|
169
|
-
marginLeft: this._liquid.x,
|
|
170
|
-
marginTop: this._liquid.y
|
|
171
|
-
}), O.push(me);
|
|
172
|
-
}), this._liquid.translatePage(
|
|
173
|
-
b,
|
|
174
|
-
I.pageLayoutType,
|
|
175
|
-
I.pageMarginLeft,
|
|
176
|
-
I.pageMarginTop
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
return w.addObjects(O), O.forEach((E) => {
|
|
180
|
-
w.attachTransformerTo(E);
|
|
181
|
-
}), (he = w.getTransformer()) == null || he.changing$.subscribe((E) => {
|
|
182
|
-
const { objects: N } = E;
|
|
183
|
-
N.forEach((b) => {
|
|
184
|
-
const { oKey: R, left: k, top: Z, height: J, width: Q } = b, V = z.get(R), K = (V == null ? void 0 : V.marginLeft) || 0, B = (V == null ? void 0 : V.marginTop) || 0;
|
|
185
|
-
S == null || S.getViewModel().getDataModel().updateDrawing(R, {
|
|
186
|
-
left: k - M - K,
|
|
187
|
-
top: Z - X - B,
|
|
188
|
-
height: J,
|
|
189
|
-
width: Q
|
|
190
|
-
});
|
|
191
|
-
}), S == null || S.calculate();
|
|
192
|
-
}), this._calculatePagePosition(I, w, T), P;
|
|
193
|
-
}
|
|
194
|
-
_recalculateSizeBySkeleton(e, i, n) {
|
|
195
|
-
var l;
|
|
196
|
-
const t = (l = n.getSkeletonData()) == null ? void 0 : l.pages;
|
|
197
|
-
if (t == null)
|
|
198
|
-
return;
|
|
199
|
-
let a = 0, s = 0;
|
|
200
|
-
for (let c = 0, _ = t.length; c < _; c++) {
|
|
201
|
-
const v = t[c], { pageWidth: p, pageHeight: d } = v;
|
|
202
|
-
e.pageLayoutType === ge.VERTICAL ? (s += d, s += e.pageMarginTop, c === _ - 1 && (s += e.pageMarginTop), a = Math.max(a, p)) : e.pageLayoutType === ge.HORIZONTAL && (a += p, c !== _ - 1 && (a += e.pageMarginLeft), s = Math.max(s, d));
|
|
203
|
-
}
|
|
204
|
-
e.resize(a, s), i.resize(a, s);
|
|
205
|
-
}
|
|
206
|
-
_calculatePagePosition(e, i, n, t = 1) {
|
|
207
|
-
const a = i == null ? void 0 : i.getParent(), { width: s, height: l, pageMarginLeft: c, pageMarginTop: _ } = e;
|
|
208
|
-
if (a == null || s === Number.POSITIVE_INFINITY || l === Number.POSITIVE_INFINITY)
|
|
209
|
-
return;
|
|
210
|
-
const { width: v, height: p } = a;
|
|
211
|
-
let d = 0, g = 0, f = 0, u = 0, D = Number.POSITIVE_INFINITY;
|
|
212
|
-
if (v > (s + c * 2) * t ? (d = v / 2 - s * t / 2, d /= t, f = (v - c * 2) / t, D = 0) : (d = c, f = s + c * 2, D = (f - v / t) / 2), p > l ? (g = p / 2 - l / 2, u = (p - _ * 2) / t) : (g = _, u = l + _ * 2), i.resize(f, u + 200), e.translate(d, g), D !== Number.POSITIVE_INFINITY && n != null) {
|
|
213
|
-
const j = n.transScroll2ViewportScrollValue(D, 0).x;
|
|
214
|
-
n.scrollToBarPos({
|
|
215
|
-
x: j
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
return this;
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
ie = rt([
|
|
222
|
-
it(0, H(oe))
|
|
223
|
-
], ie);
|
|
224
|
-
class nt {
|
|
225
|
-
constructor() {
|
|
226
|
-
h(this, "zIndex", 5);
|
|
227
|
-
}
|
|
228
|
-
create(e) {
|
|
229
|
-
return e.createInstance(ie);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
W.add(new nt());
|
|
233
|
-
class at extends F {
|
|
234
|
-
constructor() {
|
|
235
|
-
super(...arguments);
|
|
236
|
-
h(this, "zIndex", 1);
|
|
237
|
-
h(this, "viewKey", $.IMAGE);
|
|
238
|
-
}
|
|
239
|
-
check(i) {
|
|
240
|
-
if (i === this.viewKey)
|
|
241
|
-
return this;
|
|
242
|
-
}
|
|
243
|
-
convert(i) {
|
|
244
|
-
const {
|
|
245
|
-
id: n,
|
|
246
|
-
zIndex: t,
|
|
247
|
-
left: a = 0,
|
|
248
|
-
top: s = 0,
|
|
249
|
-
width: l,
|
|
250
|
-
height: c,
|
|
251
|
-
angle: _,
|
|
252
|
-
scaleX: v,
|
|
253
|
-
scaleY: p,
|
|
254
|
-
skewX: d,
|
|
255
|
-
skewY: g,
|
|
256
|
-
flipX: f,
|
|
257
|
-
flipY: u,
|
|
258
|
-
title: D,
|
|
259
|
-
description: j,
|
|
260
|
-
image: m = {}
|
|
261
|
-
} = i, { imageProperties: x, placeholder: o, link: S } = m, I = (x == null ? void 0 : x.contentUrl) || "";
|
|
262
|
-
return new Ie(n, {
|
|
263
|
-
url: I,
|
|
264
|
-
top: s,
|
|
265
|
-
left: a,
|
|
266
|
-
width: l,
|
|
267
|
-
height: c,
|
|
268
|
-
zIndex: t,
|
|
269
|
-
angle: _,
|
|
270
|
-
scaleX: v,
|
|
271
|
-
scaleY: p,
|
|
272
|
-
skewX: d,
|
|
273
|
-
skewY: g,
|
|
274
|
-
flipX: f,
|
|
275
|
-
flipY: u,
|
|
276
|
-
forceRender: !0
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
class st {
|
|
281
|
-
constructor() {
|
|
282
|
-
h(this, "zIndex", 4);
|
|
283
|
-
}
|
|
284
|
-
create(e) {
|
|
285
|
-
return e.createInstance(at);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
W.add(new st());
|
|
289
|
-
var ct = Object.getOwnPropertyDescriptor, ot = (r, e, i, n) => {
|
|
290
|
-
for (var t = n > 1 ? void 0 : n ? ct(e, i) : e, a = r.length - 1, s; a >= 0; a--)
|
|
291
|
-
(s = r[a]) && (t = s(t) || t);
|
|
292
|
-
return t;
|
|
293
|
-
}, lt = (r, e) => (i, n) => e(i, n, r);
|
|
294
|
-
let ne = class extends F {
|
|
295
|
-
constructor(e) {
|
|
296
|
-
super();
|
|
297
|
-
h(this, "zIndex", 2);
|
|
298
|
-
h(this, "viewKey", $.TEXT);
|
|
299
|
-
this._localeService = e;
|
|
300
|
-
}
|
|
301
|
-
check(e) {
|
|
302
|
-
if (e === this.viewKey)
|
|
303
|
-
return this;
|
|
304
|
-
}
|
|
305
|
-
convert(e, i) {
|
|
306
|
-
const {
|
|
307
|
-
id: n,
|
|
308
|
-
zIndex: t,
|
|
309
|
-
left: a = 0,
|
|
310
|
-
top: s = 0,
|
|
311
|
-
width: l,
|
|
312
|
-
height: c,
|
|
313
|
-
angle: _,
|
|
314
|
-
scaleX: v,
|
|
315
|
-
scaleY: p,
|
|
316
|
-
skewX: d,
|
|
317
|
-
skewY: g,
|
|
318
|
-
flipX: f,
|
|
319
|
-
flipY: u,
|
|
320
|
-
title: D,
|
|
321
|
-
description: j,
|
|
322
|
-
richText: m = {}
|
|
323
|
-
} = e, { text: x, ff: o, fs: S, it: I, bl: P, ul: w, st: T, ol: y, bg: M, bd: X, cl: L, rich: A } = m;
|
|
324
|
-
let O = {
|
|
325
|
-
top: s,
|
|
326
|
-
left: a,
|
|
327
|
-
width: l,
|
|
328
|
-
height: c,
|
|
329
|
-
zIndex: t,
|
|
330
|
-
angle: _,
|
|
331
|
-
scaleX: v,
|
|
332
|
-
scaleY: p,
|
|
333
|
-
skewX: d,
|
|
334
|
-
skewY: g,
|
|
335
|
-
flipX: f,
|
|
336
|
-
flipY: u,
|
|
337
|
-
forceRender: !0
|
|
338
|
-
}, z = !1;
|
|
339
|
-
if (x != null ? (O = { ...O, text: x, ff: o, fs: S, it: I, bl: P, ul: w, st: T, ol: y, bg: M, bd: X, cl: L }, z = !0) : A != null && (O = { ...O, richText: A }, z = !0), z !== !1)
|
|
340
|
-
return new Ye(this._localeService, n, O);
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
ne = ot([
|
|
344
|
-
lt(0, H(oe))
|
|
345
|
-
], ne);
|
|
346
|
-
class dt {
|
|
347
|
-
constructor() {
|
|
348
|
-
h(this, "zIndex", 0);
|
|
349
|
-
}
|
|
350
|
-
create(e) {
|
|
351
|
-
return e.createInstance(ne);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
W.add(new dt());
|
|
355
|
-
class ht extends F {
|
|
356
|
-
constructor() {
|
|
357
|
-
super(...arguments);
|
|
358
|
-
h(this, "zIndex", 2);
|
|
359
|
-
h(this, "viewKey", $.SHAPE);
|
|
360
|
-
}
|
|
361
|
-
check(i) {
|
|
362
|
-
if (i === this.viewKey)
|
|
363
|
-
return this;
|
|
364
|
-
}
|
|
365
|
-
convert(i) {
|
|
366
|
-
const {
|
|
367
|
-
id: n,
|
|
368
|
-
zIndex: t,
|
|
369
|
-
left: a = 0,
|
|
370
|
-
top: s = 0,
|
|
371
|
-
width: l,
|
|
372
|
-
height: c,
|
|
373
|
-
angle: _,
|
|
374
|
-
scaleX: v,
|
|
375
|
-
scaleY: p,
|
|
376
|
-
skewX: d,
|
|
377
|
-
skewY: g,
|
|
378
|
-
flipX: f,
|
|
379
|
-
flipY: u,
|
|
380
|
-
title: D,
|
|
381
|
-
description: j
|
|
382
|
-
} = i, { shapeType: m, text: x, shapeProperties: o, placeholder: S, link: I } = i.shape || {}, P = o == null ? "" : re(o.shapeBackgroundFill) || "rgba(255,255,255,1)", w = o == null ? void 0 : o.outline, T = {};
|
|
383
|
-
if (w) {
|
|
384
|
-
const { outlineFill: y, weight: M } = w;
|
|
385
|
-
T.strokeWidth = M, T.stroke = re(y) || "rgba(0,0,0,1)";
|
|
386
|
-
}
|
|
387
|
-
if (m === ee.Rect)
|
|
388
|
-
return new q(n, {
|
|
389
|
-
fill: P,
|
|
390
|
-
top: s,
|
|
391
|
-
left: a,
|
|
392
|
-
width: l,
|
|
393
|
-
height: c,
|
|
394
|
-
zIndex: t,
|
|
395
|
-
angle: _,
|
|
396
|
-
scaleX: v,
|
|
397
|
-
scaleY: p,
|
|
398
|
-
skewX: d,
|
|
399
|
-
skewY: g,
|
|
400
|
-
flipX: f,
|
|
401
|
-
flipY: u,
|
|
402
|
-
forceRender: !0,
|
|
403
|
-
...T
|
|
404
|
-
});
|
|
405
|
-
if (m === ee.RoundRect) {
|
|
406
|
-
const y = (o == null ? void 0 : o.radius) || 0;
|
|
407
|
-
return new q(n, {
|
|
408
|
-
fill: P,
|
|
409
|
-
top: s,
|
|
410
|
-
left: a,
|
|
411
|
-
width: l,
|
|
412
|
-
height: c,
|
|
413
|
-
zIndex: t,
|
|
414
|
-
angle: _,
|
|
415
|
-
scaleX: v,
|
|
416
|
-
scaleY: p,
|
|
417
|
-
skewX: d,
|
|
418
|
-
skewY: g,
|
|
419
|
-
flipX: f,
|
|
420
|
-
flipY: u,
|
|
421
|
-
forceRender: !0,
|
|
422
|
-
radius: y,
|
|
423
|
-
...T
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
if (m === ee.Ellipse) {
|
|
427
|
-
console.warn(o == null ? void 0 : o.radius);
|
|
428
|
-
const y = (o == null ? void 0 : o.radius) || 0;
|
|
429
|
-
return new $e(n, {
|
|
430
|
-
fill: P,
|
|
431
|
-
top: s,
|
|
432
|
-
left: a,
|
|
433
|
-
width: l,
|
|
434
|
-
height: c,
|
|
435
|
-
zIndex: t,
|
|
436
|
-
angle: _,
|
|
437
|
-
scaleX: v,
|
|
438
|
-
scaleY: p,
|
|
439
|
-
skewX: d,
|
|
440
|
-
skewY: g,
|
|
441
|
-
flipX: f,
|
|
442
|
-
flipY: u,
|
|
443
|
-
forceRender: !0,
|
|
444
|
-
radius: y,
|
|
445
|
-
...T
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
class gt {
|
|
451
|
-
constructor() {
|
|
452
|
-
h(this, "zIndex", 2);
|
|
453
|
-
}
|
|
454
|
-
create(e) {
|
|
455
|
-
return e.createInstance(ht);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
W.add(new gt());
|
|
459
|
-
var pt = Object.getOwnPropertyDescriptor, ut = (r, e, i, n) => {
|
|
460
|
-
for (var t = n > 1 ? void 0 : n ? pt(e, i) : e, a = r.length - 1, s; a >= 0; a--)
|
|
461
|
-
(s = r[a]) && (t = s(t) || t);
|
|
462
|
-
return t;
|
|
463
|
-
}, ft = (r, e) => (i, n) => e(i, n, r);
|
|
464
|
-
let ae = class {
|
|
465
|
-
constructor(r) {
|
|
466
|
-
h(this, "_adaptors", []);
|
|
467
|
-
this._injector = r, this._adaptorLoader();
|
|
468
|
-
}
|
|
469
|
-
convertToRenderObjects(r, e) {
|
|
470
|
-
const i = Object.keys(r), n = [];
|
|
471
|
-
return i.forEach((t) => {
|
|
472
|
-
const a = r[t], s = this._executor(a, e);
|
|
473
|
-
s != null && n.push(s);
|
|
474
|
-
}), n;
|
|
475
|
-
}
|
|
476
|
-
convertToRenderObject(r, e) {
|
|
477
|
-
return this._executor(r, e);
|
|
478
|
-
}
|
|
479
|
-
_executor(r, e) {
|
|
480
|
-
var t;
|
|
481
|
-
const { id: i, type: n } = r;
|
|
482
|
-
for (const a of this._adaptors) {
|
|
483
|
-
const s = (t = a.check(n)) == null ? void 0 : t.convert(r, e);
|
|
484
|
-
if (s != null)
|
|
485
|
-
return s;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
_adaptorLoader() {
|
|
489
|
-
W.getData().sort(je).forEach((r) => {
|
|
490
|
-
this._adaptors.push(r.create(this._injector));
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
ae = ut([
|
|
495
|
-
ft(0, H(G))
|
|
496
|
-
], ae);
|
|
497
|
-
var wt = Object.getOwnPropertyDescriptor, _t = (r, e, i, n) => {
|
|
498
|
-
for (var t = n > 1 ? void 0 : n ? wt(e, i) : e, a = r.length - 1, s; a >= 0; a--)
|
|
499
|
-
(s = r[a]) && (t = s(t) || t);
|
|
500
|
-
return t;
|
|
501
|
-
}, vt = (r, e) => (i, n) => e(i, n, r), St = /* @__PURE__ */ ((r) => (r.MAIN = "__SLIDERender__", r.SCENE_VIEWER = "__SLIDEViewer__", r.SCENE = "__SLIDEScene__", r.VIEWPORT = "__SLIDEViewPort_", r))(St || {});
|
|
502
|
-
let se = class extends F {
|
|
503
|
-
constructor(e) {
|
|
504
|
-
super();
|
|
505
|
-
h(this, "zIndex", 6);
|
|
506
|
-
h(this, "viewKey", $.SLIDE);
|
|
507
|
-
h(this, "_ObjectProvider", null);
|
|
508
|
-
this._injector = e;
|
|
509
|
-
}
|
|
510
|
-
check(e) {
|
|
511
|
-
if (e === this.viewKey)
|
|
512
|
-
return this;
|
|
513
|
-
}
|
|
514
|
-
convert(e, i) {
|
|
515
|
-
const {
|
|
516
|
-
id: n,
|
|
517
|
-
zIndex: t,
|
|
518
|
-
left: a = 0,
|
|
519
|
-
top: s = 0,
|
|
520
|
-
width: l,
|
|
521
|
-
height: c,
|
|
522
|
-
angle: _,
|
|
523
|
-
scaleX: v,
|
|
524
|
-
scaleY: p,
|
|
525
|
-
skewX: d,
|
|
526
|
-
skewY: g,
|
|
527
|
-
flipX: f,
|
|
528
|
-
flipY: u,
|
|
529
|
-
title: D,
|
|
530
|
-
description: j,
|
|
531
|
-
slide: m
|
|
532
|
-
} = e;
|
|
533
|
-
if (m == null)
|
|
534
|
-
return;
|
|
535
|
-
const x = new Me(m), o = new Fe("__SLIDERender__" + n, {
|
|
536
|
-
top: s,
|
|
537
|
-
left: a,
|
|
538
|
-
width: l,
|
|
539
|
-
height: c,
|
|
540
|
-
zIndex: t,
|
|
541
|
-
angle: _,
|
|
542
|
-
scaleX: v,
|
|
543
|
-
scaleY: p,
|
|
544
|
-
skewX: d,
|
|
545
|
-
skewY: g,
|
|
546
|
-
flipX: f,
|
|
547
|
-
flipY: u,
|
|
548
|
-
forceRender: !0
|
|
549
|
-
});
|
|
550
|
-
o.enableNav(), o.enableSelectedClipElement();
|
|
551
|
-
const S = x.getPageOrder(), I = x.getPages();
|
|
552
|
-
if (!S || !I)
|
|
553
|
-
return o;
|
|
554
|
-
this._ObjectProvider = new ae(this._injector);
|
|
555
|
-
for (let P = 0, w = S.length; P < w; P++) {
|
|
556
|
-
const T = I[S[P]], { id: y } = T;
|
|
557
|
-
o.addPageScene(this._createScene(y, o, T, i, x));
|
|
558
|
-
}
|
|
559
|
-
return o.activeFirstPage(), o;
|
|
560
|
-
}
|
|
561
|
-
_createScene(e, i, n, t, a) {
|
|
562
|
-
var g;
|
|
563
|
-
const { width: s, height: l } = i, c = new le(e, i, {
|
|
564
|
-
width: s,
|
|
565
|
-
height: l
|
|
566
|
-
});
|
|
567
|
-
new Y(`PageViewer_${e}`, c, {
|
|
568
|
-
left: 0,
|
|
569
|
-
top: 0,
|
|
570
|
-
bottom: 0,
|
|
571
|
-
right: 0,
|
|
572
|
-
explicitViewportWidthSet: !1,
|
|
573
|
-
explicitViewportHeightSet: !1
|
|
574
|
-
}).closeClip();
|
|
575
|
-
const { pageElements: v, pageBackgroundFill: p } = n, d = (g = this._ObjectProvider) == null ? void 0 : g.convertToRenderObjects(v, t);
|
|
576
|
-
return this._addBackgroundRect(c, p, a), c.addObjects(d), d == null || d.forEach((f) => {
|
|
577
|
-
c.attachTransformerTo(f);
|
|
578
|
-
}), c;
|
|
579
|
-
}
|
|
580
|
-
_addBackgroundRect(e, i, n) {
|
|
581
|
-
const t = n.getPageSize(), { width: a = 0, height: s = 0 } = t, l = new q("canvas", {
|
|
582
|
-
left: 0,
|
|
583
|
-
top: 0,
|
|
584
|
-
width: a,
|
|
585
|
-
height: s,
|
|
586
|
-
strokeWidth: 1,
|
|
587
|
-
stroke: "rgba(198,198,198, 1)",
|
|
588
|
-
fill: re(i) || "rgba(255,255,255, 1)",
|
|
589
|
-
zIndex: 0,
|
|
590
|
-
evented: !1
|
|
591
|
-
});
|
|
592
|
-
e.addObject(l, 0);
|
|
593
|
-
}
|
|
594
|
-
};
|
|
595
|
-
se = _t([
|
|
596
|
-
vt(0, H(G))
|
|
597
|
-
], se);
|
|
598
|
-
class It {
|
|
599
|
-
constructor() {
|
|
600
|
-
h(this, "zIndex", 6);
|
|
601
|
-
}
|
|
602
|
-
create(e) {
|
|
603
|
-
return e.createInstance(se);
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
W.add(new It());
|
|
607
|
-
var xt = Object.getOwnPropertyDescriptor, Tt = (r, e, i, n) => {
|
|
608
|
-
for (var t = n > 1 ? void 0 : n ? xt(e, i) : e, a = r.length - 1, s; a >= 0; a--)
|
|
609
|
-
(s = r[a]) && (t = s(t) || t);
|
|
610
|
-
return t;
|
|
611
|
-
}, U = (r, e) => (i, n) => e(i, n, r);
|
|
612
|
-
let ce = class extends F {
|
|
613
|
-
constructor(e, i, n, t) {
|
|
614
|
-
super();
|
|
615
|
-
h(this, "zIndex", 4);
|
|
616
|
-
h(this, "viewKey", $.SPREADSHEET);
|
|
617
|
-
this._localeService = e, this._contextService = i, this._configService = n, this._injector = t;
|
|
618
|
-
}
|
|
619
|
-
check(e) {
|
|
620
|
-
if (e === this.viewKey)
|
|
621
|
-
return this;
|
|
622
|
-
}
|
|
623
|
-
convert(e, i) {
|
|
624
|
-
const {
|
|
625
|
-
id: n,
|
|
626
|
-
zIndex: t,
|
|
627
|
-
left: a = 0,
|
|
628
|
-
top: s = 0,
|
|
629
|
-
width: l,
|
|
630
|
-
height: c,
|
|
631
|
-
angle: _,
|
|
632
|
-
scaleX: v,
|
|
633
|
-
scaleY: p,
|
|
634
|
-
skewX: d,
|
|
635
|
-
skewY: g,
|
|
636
|
-
flipX: f,
|
|
637
|
-
flipY: u,
|
|
638
|
-
spreadsheet: D
|
|
639
|
-
} = e;
|
|
640
|
-
if (D == null)
|
|
641
|
-
return;
|
|
642
|
-
const { worksheet: j, styles: m } = D, x = new Xe(m), o = new Ke(
|
|
643
|
-
new ze(n, j, x),
|
|
644
|
-
// FIXME: worksheet in slide doesn't has a Worksheet object
|
|
645
|
-
x,
|
|
646
|
-
this._localeService,
|
|
647
|
-
this._contextService,
|
|
648
|
-
this._configService,
|
|
649
|
-
this._injector
|
|
650
|
-
), { rowTotalHeight: S, columnTotalWidth: I, rowHeaderWidth: P, columnHeaderHeight: w } = o, T = I + j.rowHeader.width || 0, y = S + j.columnHeader.height || 0, M = new ve("spreadInSlideSceneViewer" + n, {
|
|
651
|
-
top: s,
|
|
652
|
-
left: a,
|
|
653
|
-
width: l,
|
|
654
|
-
height: c,
|
|
655
|
-
zIndex: t,
|
|
656
|
-
angle: _,
|
|
657
|
-
scaleX: v,
|
|
658
|
-
scaleY: p,
|
|
659
|
-
skewX: d,
|
|
660
|
-
skewY: g,
|
|
661
|
-
flipX: f,
|
|
662
|
-
flipY: u,
|
|
663
|
-
forceRender: !0
|
|
664
|
-
}), X = new le("spreadInSlideScene" + n, M, {
|
|
665
|
-
width: T,
|
|
666
|
-
height: y
|
|
667
|
-
});
|
|
668
|
-
this._updateViewport(n, P, w, X, i);
|
|
669
|
-
const L = new Be("testSheetViewer", o, !1), A = new Ue("spreadInSlideRow", o), O = new qe("spreadInSlideColumn", o), z = new q("spreadInSlideLeftTop", {
|
|
670
|
-
zIndex: 2,
|
|
671
|
-
left: -1,
|
|
672
|
-
top: -1,
|
|
673
|
-
width: P,
|
|
674
|
-
height: w,
|
|
675
|
-
fill: pe([248, 249, 250]),
|
|
676
|
-
stroke: pe([217, 217, 217]),
|
|
677
|
-
strokeWidth: 1
|
|
678
|
-
});
|
|
679
|
-
return L.zIndex = 10, X.addObjects([L], 1), X.addObjects([A, O, z], 2), M;
|
|
680
|
-
}
|
|
681
|
-
// eslint-disable-next-line max-lines-per-function
|
|
682
|
-
_updateViewport(e, i, n, t, a) {
|
|
683
|
-
if (a == null)
|
|
684
|
-
return;
|
|
685
|
-
const s = i * t.scaleX, l = n * t.scaleY, c = new Y("spreadInSlideViewMain" + e, t, {
|
|
686
|
-
left: s,
|
|
687
|
-
top: l,
|
|
688
|
-
bottom: 0,
|
|
689
|
-
right: 0,
|
|
690
|
-
explicitViewportWidthSet: !1,
|
|
691
|
-
explicitViewportHeightSet: !1,
|
|
692
|
-
isWheelPreventDefaultX: !0
|
|
693
|
-
}), _ = new Y("spreadInSlideViewTop" + e, t, {
|
|
694
|
-
left: s,
|
|
695
|
-
height: l,
|
|
696
|
-
top: 0,
|
|
697
|
-
right: 0,
|
|
698
|
-
explicitViewportWidthSet: !1,
|
|
699
|
-
isWheelPreventDefaultX: !0
|
|
700
|
-
}), v = new Y("spreadInSlideViewLeft" + e, t, {
|
|
701
|
-
left: 0,
|
|
702
|
-
bottom: 0,
|
|
703
|
-
top: l,
|
|
704
|
-
width: s,
|
|
705
|
-
explicitViewportHeightSet: !1,
|
|
706
|
-
isWheelPreventDefaultX: !0
|
|
707
|
-
});
|
|
708
|
-
new Y("spreadInSlideViewLeftTop" + e, t, {
|
|
709
|
-
left: 0,
|
|
710
|
-
top: 0,
|
|
711
|
-
width: s,
|
|
712
|
-
height: l,
|
|
713
|
-
isWheelPreventDefaultX: !0
|
|
714
|
-
}), c.onScrollAfter$.subscribeEvent((p) => {
|
|
715
|
-
const { scrollX: d, scrollY: g, viewportScrollX: f, viewportScrollY: u } = p;
|
|
716
|
-
_.updateScrollVal({
|
|
717
|
-
scrollX: d,
|
|
718
|
-
viewportScrollX: f
|
|
719
|
-
}), v.updateScrollVal({
|
|
720
|
-
scrollY: g,
|
|
721
|
-
viewportScrollY: u
|
|
722
|
-
});
|
|
723
|
-
}), t.attachControl(), new Se(c, {
|
|
724
|
-
mainScene: a
|
|
725
|
-
}), t.onMouseWheel$.subscribeEvent((p, d) => {
|
|
726
|
-
const g = p;
|
|
727
|
-
if (g.ctrlKey) {
|
|
728
|
-
const f = Math.abs(g.deltaX);
|
|
729
|
-
let u = f < 40 ? 0.05 : f < 80 ? 0.02 : 0.01;
|
|
730
|
-
u *= g.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (u /= 2), t.scaleX + u > 4 ? t.scale(4, 4) : t.scaleX + u < 0.1 ? t.scale(0.1, 0.1) : (t.scaleBy(u, u), g.preventDefault());
|
|
731
|
-
} else
|
|
732
|
-
c.onMouseWheel(g, d);
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
ce = Tt([
|
|
737
|
-
U(0, H(oe)),
|
|
738
|
-
U(1, Re),
|
|
739
|
-
U(2, _e),
|
|
740
|
-
U(3, H(G))
|
|
741
|
-
], ce);
|
|
742
|
-
class yt {
|
|
743
|
-
constructor() {
|
|
744
|
-
h(this, "zIndex", 4);
|
|
745
|
-
}
|
|
746
|
-
create(e) {
|
|
747
|
-
return e.createInstance(ce);
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
W.add(new yt());
|
|
751
|
-
var mt = /* @__PURE__ */ ((r) => (r.COMPONENT = "__slideRender__", r.SCENE = "__mainScene__", r.VIEW = "__mainView__", r))(mt || {});
|
|
752
|
-
export {
|
|
753
|
-
W as CanvasObjectProviderRegistry,
|
|
754
|
-
F as ObjectAdaptor,
|
|
755
|
-
ae as ObjectProvider,
|
|
756
|
-
mt as SLIDE_KEY,
|
|
757
|
-
St as SLIDE_VIEW_KEY,
|
|
758
|
-
we as UniverSlidesPlugin
|
|
759
|
-
};
|
|
1
|
+
import{BasicShapes as e,DocumentDataModel as t,IConfigService as n,IContextService as r,Inject as i,Injector as a,LocaleService as o,PageElementType as s,Plugin as c,Registry as l,SlideDataModel as u,Styles as d,UniverInstanceType as f,Worksheet as p,getColorStyle as m,merge as h,sortRules as g}from"@univerjs/core";import{Circle as _,DocumentSkeleton as v,DocumentViewModel as y,Documents as b,IRenderManagerService as x,IRenderingEngine as S,Image as C,Liquid as w,PageLayoutType as T,Rect as E,RichText as D,Scene as O,SceneViewer as k,ScrollBar as A,Slide as j,Spreadsheet as M,SpreadsheetColumnHeader as N,SpreadsheetRowHeader as P,SpreadsheetSkeleton as F,Viewport as I,getColor as L}from"@univerjs/engine-render";var R=`@univerjs/slides`,z=`0.18.0`;const B=`slides.config`;Symbol(B);const V={};function H(e){"@babel/helpers - typeof";return H=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},H(e)}function ee(e,t){if(H(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(H(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function te(e){var t=ee(e,`string`);return H(t)==`symbol`?t:t+``}function U(e,t,n){return(t=te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W(e,t){return function(n,r){t(n,r,e)}}function G(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let K=class extends c{constructor(e=V,t,n,r){super(),this._config=e,this._injector=t,this._renderManagerService=n,this._configService=r,U(this,`_canvasEngine`,null);let{...i}=h({},V,this._config);this._configService.setConfig(B,i),this._initializeDependencies(this._injector)}initialize(){this.initCanvasEngine()}onReady(){}getConfig(){return this._config}initCanvasEngine(){this._canvasEngine=this._injector.get(S)}onRendered(){this.initialize()}getCanvasEngine(){return this._canvasEngine}_initializeDependencies(e){[].forEach(t=>{e.add(t)})}};U(K,`pluginName`,`UNIVER_SLIDES_PLUGIN`),U(K,`packageName`,R),U(K,`version`,z),U(K,`type`,f.UNIVER_SLIDE),K=G([W(1,i(a)),W(2,x),W(3,n)],K);var q=class{constructor(){U(this,`zIndex`,0),U(this,`viewKey`,null)}check(e){if(e===this.viewKey)return this}create(e){}};const J=l.create();let Y=function(e){return e.MAIN=`__DocsRender__`,e.SCENE_VIEWER=`__DocsViewer__`,e.SCENE=`__DocsScene__`,e.VIEWPORT=`__DocsViewPort_`,e}({}),X=class extends q{constructor(e){super(),this._localeService=e,U(this,`zIndex`,5),U(this,`viewKey`,s.DOCUMENT),U(this,`_liquid`,new w)}check(e){if(e===this.viewKey)return this}convert(e,n){var r,i;let{id:a,zIndex:o,left:s=0,top:c=0,width:l,height:u,angle:d,scaleX:f,scaleY:p,skewX:m,skewY:h,flipX:g,flipY:_,title:x,description:S,document:w}=e;if(w==null)return;let T=new y(new t(w)),E=v.create(T,this._localeService),D=new b(Y.MAIN,E);E.calculate();let j=new k(Y.SCENE_VIEWER+a,{top:c,left:s,width:l,height:u,zIndex:o,angle:d,scaleX:f,scaleY:p,skewX:m,skewY:h,flipX:g,flipY:_}),M=new O(Y.SCENE+a,j),N=new I(Y.VIEWPORT+a,M,{left:0,top:0,bottom:0,right:0,explicitViewportWidthSet:!1,explicitViewportHeightSet:!1,isWheelPreventDefaultX:!0});M.attachControl(),M.onMouseWheel$.subscribeEvent((e,t)=>{let n=e;if(n.ctrlKey){let e=Math.abs(n.deltaX),t=e<40?.2:e<80?.4:.2;t*=n.deltaY>0?-1:1,M.scaleX<1&&(t/=2),M.scaleX+t>4?M.scale(4,4):M.scaleX+t<.1?M.scale(.1,.1):(n.deltaY,n.preventDefault())}else N.onMouseWheel(n,t)}),new A(N,{mainScene:n}),M.addObject(D);let P=E.getActualSize();D.resize(P.actualWidth,P.actualHeight),M.resize(P.actualWidth,P.actualHeight+200),(r=D.getSkeleton())==null||r.getPageSize(),D.pageRender$.subscribe(e=>{let{page:t,pageLeft:n,pageTop:r,ctx:i}=e,{width:a,height:o,marginBottom:s,marginLeft:c,marginRight:l,marginTop:u}=t;i.save(),i.translate(n-.5,r-.5),i.restore()});let{left:F,top:L}=D,R=E.getSkeletonData();if(R==null)return;let{pages:z}=R,B=[],V=new Map;this._recalculateSizeBySkeleton(D,M,E);for(let e=0,t=z.length;e<t;e++){let t=z[e],{skeDrawings:n,marginLeft:r,marginTop:i,pageWidth:a,pageHeight:o}=t;this._liquid.translatePagePadding(t),n.forEach(e=>{let{aLeft:t,aTop:n,height:r,width:i,drawingOrigin:a}=e,{docTransform:o}=a,s=new C(e.drawingId,{left:t+F+this._liquid.x,top:n+L+this._liquid.y,width:i,height:r,zIndex:11});V.set(e.drawingId,{marginLeft:this._liquid.x,marginTop:this._liquid.y}),B.push(s)}),this._liquid.translatePage(t,D.pageLayoutType,D.pageMarginLeft,D.pageMarginTop)}return M.addObjects(B),B.forEach(e=>{M.attachTransformerTo(e)}),(i=M.getTransformer())==null||i.changing$.subscribe(e=>{let{objects:t}=e;t.forEach(e=>{let{oKey:t,left:n,top:r,height:i,width:a}=e,o=V.get(t),s=(o==null?void 0:o.marginLeft)||0,c=(o==null?void 0:o.marginTop)||0;E==null||E.getViewModel().getDataModel().updateDrawing(t,{left:n-F-s,top:r-L-c,height:i,width:a})}),E==null||E.calculate()}),this._calculatePagePosition(D,M,N),j}_recalculateSizeBySkeleton(e,t,n){var r;let i=(r=n.getSkeletonData())==null?void 0:r.pages;if(i==null)return;let a=0,o=0;for(let t=0,n=i.length;t<n;t++){let{pageWidth:r,pageHeight:s}=i[t];e.pageLayoutType===T.VERTICAL?(o+=s,o+=e.pageMarginTop,t===n-1&&(o+=e.pageMarginTop),a=Math.max(a,r)):e.pageLayoutType===T.HORIZONTAL&&(a+=r,t!==n-1&&(a+=e.pageMarginLeft),o=Math.max(o,s))}e.resize(a,o),t.resize(a,o)}_calculatePagePosition(e,t,n,r=1){let i=t==null?void 0:t.getParent(),{width:a,height:o,pageMarginLeft:s,pageMarginTop:c}=e;if(i==null||a===1/0||o===1/0)return;let{width:l,height:u}=i,d=0,f=0,p=0,m=0,h=1/0;if(l>(a+s*2)*r?(d=l/2-a*r/2,d/=r,p=(l-s*2)/r,h=0):(d=s,p=a+s*2,h=(p-l/r)/2),u>o?(f=u/2-o/2,m=(u-c*2)/r):(f=c,m=o+c*2),t.resize(p,m+200),e.translate(d,f),h!==1/0&&n!=null){let e=n.transScroll2ViewportScrollValue(h,0).x;n.scrollToBarPos({x:e})}return this}};X=G([W(0,i(o))],X);var ne=class{constructor(){U(this,`zIndex`,5)}create(e){return e.createInstance(X)}};J.add(new ne);var re=class extends q{constructor(...e){super(...e),U(this,`zIndex`,1),U(this,`viewKey`,s.IMAGE)}check(e){if(e===this.viewKey)return this}convert(e){let{id:t,zIndex:n,left:r=0,top:i=0,width:a,height:o,angle:s,scaleX:c,scaleY:l,skewX:u,skewY:d,flipX:f,flipY:p,title:m,description:h,image:g={}}=e,{imageProperties:_,placeholder:v,link:y}=g;return new C(t,{url:(_==null?void 0:_.contentUrl)||``,top:i,left:r,width:a,height:o,zIndex:n,angle:s,scaleX:c,scaleY:l,skewX:u,skewY:d,flipX:f,flipY:p,forceRender:!0})}},ie=class{constructor(){U(this,`zIndex`,4)}create(e){return e.createInstance(re)}};J.add(new ie);let Z=class extends q{constructor(e){super(),this._localeService=e,U(this,`zIndex`,2),U(this,`viewKey`,s.TEXT)}check(e){if(e===this.viewKey)return this}convert(e,t){let{id:n,zIndex:r,left:i=0,top:a=0,width:o,height:s,angle:c,scaleX:l,scaleY:u,skewX:d,skewY:f,flipX:p,flipY:m,title:h,description:g,richText:_={}}=e,{text:v,ff:y,fs:b,it:x,bl:S,ul:C,st:w,ol:T,bg:E,bd:O,cl:k,rich:A}=_,j={top:a,left:i,width:o,height:s,zIndex:r,angle:c,scaleX:l,scaleY:u,skewX:d,skewY:f,flipX:p,flipY:m,forceRender:!0},M=!1;if(v==null?A!=null&&(j={...j,richText:A},M=!0):(j={...j,text:v,ff:y,fs:b,it:x,bl:S,ul:C,st:w,ol:T,bg:E,bd:O,cl:k},M=!0),M!==!1)return new D(this._localeService,n,j)}};Z=G([W(0,i(o))],Z);var ae=class{constructor(){U(this,`zIndex`,0)}create(e){return e.createInstance(Z)}};J.add(new ae);var oe=class extends q{constructor(...e){super(...e),U(this,`zIndex`,2),U(this,`viewKey`,s.SHAPE)}check(e){if(e===this.viewKey)return this}convert(t){let{id:n,zIndex:r,left:i=0,top:a=0,width:o,height:s,angle:c,scaleX:l,scaleY:u,skewX:d,skewY:f,flipX:p,flipY:h,title:g,description:v}=t,{shapeType:y,text:b,shapeProperties:x,placeholder:S,link:C}=t.shape||{},w=x==null?``:m(x.shapeBackgroundFill)||`rgba(255,255,255,1)`,T=x==null?void 0:x.outline,D={};if(T){let{outlineFill:e,weight:t}=T;D.strokeWidth=t,D.stroke=m(e)||`rgba(0,0,0,1)`}if(y===e.Rect)return new E(n,{fill:w,top:a,left:i,width:o,height:s,zIndex:r,angle:c,scaleX:l,scaleY:u,skewX:d,skewY:f,flipX:p,flipY:h,forceRender:!0,...D});if(y===e.RoundRect)return new E(n,{fill:w,top:a,left:i,width:o,height:s,zIndex:r,angle:c,scaleX:l,scaleY:u,skewX:d,skewY:f,flipX:p,flipY:h,forceRender:!0,radius:(x==null?void 0:x.radius)||0,...D});if(y===e.Ellipse)return console.warn(x==null?void 0:x.radius),new _(n,{fill:w,top:a,left:i,width:o,height:s,zIndex:r,angle:c,scaleX:l,scaleY:u,skewX:d,skewY:f,flipX:p,flipY:h,forceRender:!0,radius:(x==null?void 0:x.radius)||0,...D})}},se=class{constructor(){U(this,`zIndex`,2)}create(e){return e.createInstance(oe)}};J.add(new se);let Q=class{constructor(e){this._injector=e,U(this,`_adaptors`,[]),this._adaptorLoader()}convertToRenderObjects(e,t){let n=Object.keys(e),r=[];return n.forEach(n=>{let i=e[n],a=this._executor(i,t);a!=null&&r.push(a)}),r}convertToRenderObject(e,t){return this._executor(e,t)}_executor(e,t){let{id:n,type:r}=e;for(let n of this._adaptors){var i;let a=(i=n.check(r))==null?void 0:i.convert(e,t);if(a!=null)return a}}_adaptorLoader(){J.getData().sort(g).forEach(e=>{this._adaptors.push(e.create(this._injector))})}};Q=G([W(0,i(a))],Q);let ce=function(e){return e.MAIN=`__SLIDERender__`,e.SCENE_VIEWER=`__SLIDEViewer__`,e.SCENE=`__SLIDEScene__`,e.VIEWPORT=`__SLIDEViewPort_`,e}({}),le=class extends q{constructor(e){super(),this._injector=e,U(this,`zIndex`,6),U(this,`viewKey`,s.SLIDE),U(this,`_ObjectProvider`,null)}check(e){if(e===this.viewKey)return this}convert(e,t){let{id:n,zIndex:r,left:i=0,top:a=0,width:o,height:s,angle:c,scaleX:l,scaleY:d,skewX:f,skewY:p,flipX:m,flipY:h,title:g,description:_,slide:v}=e;if(v==null)return;let y=new u(v),b=new j(ce.MAIN+n,{top:a,left:i,width:o,height:s,zIndex:r,angle:c,scaleX:l,scaleY:d,skewX:f,skewY:p,flipX:m,flipY:h,forceRender:!0});b.enableNav(),b.enableSelectedClipElement();let x=y.getPageOrder(),S=y.getPages();if(!x||!S)return b;this._ObjectProvider=new Q(this._injector);for(let e=0,n=x.length;e<n;e++){let n=S[x[e]],{id:r}=n;b.addPageScene(this._createScene(r,b,n,t,y))}return b.activeFirstPage(),b}_createScene(e,t,n,r,i){var a;let{width:o,height:s}=t,c=new O(e,t,{width:o,height:s});new I(`PageViewer_${e}`,c,{left:0,top:0,bottom:0,right:0,explicitViewportWidthSet:!1,explicitViewportHeightSet:!1}).closeClip();let{pageElements:l,pageBackgroundFill:u}=n,d=(a=this._ObjectProvider)==null?void 0:a.convertToRenderObjects(l,r);return this._addBackgroundRect(c,u,i),c.addObjects(d),d==null||d.forEach(e=>{c.attachTransformerTo(e)}),c}_addBackgroundRect(e,t,n){let{width:r=0,height:i=0}=n.getPageSize(),a=new E(`canvas`,{left:0,top:0,width:r,height:i,strokeWidth:1,stroke:`rgba(198,198,198, 1)`,fill:m(t)||`rgba(255,255,255, 1)`,zIndex:0,evented:!1});e.addObject(a,0)}};le=G([W(0,i(a))],le);var ue=class{constructor(){U(this,`zIndex`,6)}create(e){return e.createInstance(le)}};J.add(new ue);var $=function(e){return e.MAIN=`spreadInSlide`,e.SCENE=`spreadInSlideScene`,e.SCENE_VIEWER=`spreadInSlideSceneViewer`,e.ROW=`spreadInSlideRow`,e.COLUMN=`spreadInSlideColumn`,e.LEFT_TOP=`spreadInSlideLeftTop`,e.VIEW_MAIN=`spreadInSlideViewMain`,e.VIEW_TOP=`spreadInSlideViewTop`,e.VIEW_LEFT=`spreadInSlideViewLeft`,e.VIEW_LEFT_TOP=`spreadInSlideViewLeftTop`,e}($||{});let de=class extends q{constructor(e,t,n,r){super(),this._localeService=e,this._contextService=t,this._configService=n,this._injector=r,U(this,`zIndex`,4),U(this,`viewKey`,s.SPREADSHEET)}check(e){if(e===this.viewKey)return this}convert(e,t){let{id:n,zIndex:r,left:i=0,top:a=0,width:o,height:s,angle:c,scaleX:l,scaleY:u,skewX:f,skewY:m,flipX:h,flipY:g,spreadsheet:_}=e;if(_==null)return;let{worksheet:v,styles:y}=_,b=new d(y),x=new F(new p(n,v,b),b,this._localeService,this._contextService,this._configService,this._injector),{rowTotalHeight:S,columnTotalWidth:C,rowHeaderWidth:w,columnHeaderHeight:T}=x,D=C+v.rowHeader.width||0,A=S+v.columnHeader.height||0,j=new k($.SCENE_VIEWER+n,{top:a,left:i,width:o,height:s,zIndex:r,angle:c,scaleX:l,scaleY:u,skewX:f,skewY:m,flipX:h,flipY:g,forceRender:!0}),I=new O($.SCENE+n,j,{width:D,height:A});this._updateViewport(n,w,T,I,t);let R=new M(`testSheetViewer`,x,!1),z=new P($.ROW,x),B=new N($.COLUMN,x),V=new E($.LEFT_TOP,{zIndex:2,left:-1,top:-1,width:w,height:T,fill:L([248,249,250]),stroke:L([217,217,217]),strokeWidth:1});return R.zIndex=10,I.addObjects([R],1),I.addObjects([z,B,V],2),j}_updateViewport(e,t,n,r,i){if(i==null)return;let a=t*r.scaleX,o=n*r.scaleY,s=new I($.VIEW_MAIN+e,r,{left:a,top:o,bottom:0,right:0,explicitViewportWidthSet:!1,explicitViewportHeightSet:!1,isWheelPreventDefaultX:!0}),c=new I($.VIEW_TOP+e,r,{left:a,height:o,top:0,right:0,explicitViewportWidthSet:!1,isWheelPreventDefaultX:!0}),l=new I($.VIEW_LEFT+e,r,{left:0,bottom:0,top:o,width:a,explicitViewportHeightSet:!1,isWheelPreventDefaultX:!0});new I($.VIEW_LEFT_TOP+e,r,{left:0,top:0,width:a,height:o,isWheelPreventDefaultX:!0}),s.onScrollAfter$.subscribeEvent(e=>{let{scrollX:t,scrollY:n,viewportScrollX:r,viewportScrollY:i}=e;c.updateScrollVal({scrollX:t,viewportScrollX:r}),l.updateScrollVal({scrollY:n,viewportScrollY:i})}),r.attachControl(),new A(s,{mainScene:i}),r.onMouseWheel$.subscribeEvent((e,t)=>{let n=e;if(n.ctrlKey){let e=Math.abs(n.deltaX),t=e<40?.05:e<80?.02:.01;t*=n.deltaY>0?-1:1,r.scaleX<1&&(t/=2),r.scaleX+t>4?r.scale(4,4):r.scaleX+t<.1?r.scale(.1,.1):(r.scaleBy(t,t),n.preventDefault())}else s.onMouseWheel(n,t)})}};de=G([W(0,i(o)),W(1,r),W(2,n),W(3,i(a))],de);var fe=class{constructor(){U(this,`zIndex`,4)}create(e){return e.createInstance(de)}};J.add(new fe);let pe=function(e){return e.COMPONENT=`__slideRender__`,e.SCENE=`__mainScene__`,e.VIEW=`__mainView__`,e}({});export{J as CanvasObjectProviderRegistry,q as ObjectAdaptor,Q as ObjectProvider,pe as SLIDE_KEY,ce as SLIDE_VIEW_KEY,K as UniverSlidesPlugin};
|