@univerjs/slides 0.1.12 → 0.1.13

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/es/index.js CHANGED
@@ -1,15 +1,14 @@
1
- var Re = Object.defineProperty;
2
- var xe = (a, e, r) => e in a ? Re(a, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[e] = r;
3
- var h = (a, e, r) => (xe(a, typeof e != "symbol" ? e + "" : e, r), r);
4
- import { Registry as Ce, LocaleService as ne, PageElementType as F, DocumentDataModel as je, getColorStyle as te, ShapeType as fe, SlideDataModel as Me, IContextService as Le, ObjectMatrix as Ne, Styles as ze, Worksheet as Ve, sortRules as Xe, OnLifecycle as Ae, LifecycleStages as Ue, RxDisposable as We, UniverInstanceType as M, debounce as $e, IUniverInstanceService as Pe, Plugin as He } from "@univerjs/core";
5
- import { Liquid as Ye, DocumentViewModel as Fe, DocumentSkeleton as Be, Documents as Ke, SceneViewer as me, Scene as ie, Viewport as X, EVENT_TYPE as pe, ScrollBar as ue, Rect as Y, Picture as Te, PageLayoutType as ve, RichText as ke, Slide as Oe, SpreadsheetSkeleton as qe, Spreadsheet as Ge, SpreadsheetRowHeader as Ze, SpreadsheetColumnHeader as Je, getColor as we, IRenderManagerService as Qe, IRenderingEngine as et } from "@univerjs/engine-render";
6
- import { Inject as A, Injector as se } from "@wendellhu/redi";
1
+ var Ee = Object.defineProperty;
2
+ var xe = (s, e, r) => e in s ? Ee(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
3
+ var u = (s, e, r) => (xe(s, typeof e != "symbol" ? e + "" : e, r), r);
4
+ import { Registry as Ce, LocaleService as ne, PageElementType as F, DocumentDataModel as je, getColorStyle as te, BasicShapes as fe, SlideDataModel as Me, IContextService as Xe, ObjectMatrix as Le, Styles as Ve, Worksheet as ze, sortRules as Ne, OnLifecycle as Ae, LifecycleStages as Ye, RxDisposable as We, UniverInstanceType as X, debounce as Ue, IUniverInstanceService as be, Plugin as $e } from "@univerjs/core";
5
+ import { Liquid as He, DocumentViewModel as Fe, DocumentSkeleton as Be, Documents as Ke, SceneViewer as me, Scene as ie, Viewport as N, EVENT_TYPE as ue, ScrollBar as pe, Rect as H, Image as Te, PageLayoutType as ve, RichText as ke, Slide as Oe, SpreadsheetSkeleton as qe, Spreadsheet as Ge, SpreadsheetRowHeader as Ze, SpreadsheetColumnHeader as Je, getColor as we, IRenderManagerService as Qe, IRenderingEngine as et } from "@univerjs/engine-render";
6
+ import { Inject as A, Injector as ae } from "@wendellhu/redi";
7
7
  import { takeUntil as Se } from "rxjs";
8
- const Yt = {}, tt = {}, Ft = {};
9
8
  class B {
10
9
  constructor() {
11
- h(this, "zIndex", 0);
12
- h(this, "viewKey", null);
10
+ u(this, "zIndex", 0);
11
+ u(this, "viewKey", null);
13
12
  }
14
13
  check(e) {
15
14
  if (e === this.viewKey)
@@ -18,18 +17,18 @@ class B {
18
17
  create(e) {
19
18
  }
20
19
  }
21
- const $ = Ce.create();
22
- var rt = Object.defineProperty, nt = Object.getOwnPropertyDescriptor, it = (a, e, r, n) => {
23
- for (var t = n > 1 ? void 0 : n ? nt(e, r) : e, s = a.length - 1, i; s >= 0; s--)
24
- (i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
25
- return n && t && rt(e, r, t), t;
26
- }, st = (a, e) => (r, n) => e(r, n, a);
20
+ const U = Ce.create();
21
+ var tt = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, nt = (s, e, r, n) => {
22
+ for (var t = n > 1 ? void 0 : n ? rt(e, r) : e, a = s.length - 1, i; a >= 0; a--)
23
+ (i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
24
+ return n && t && tt(e, r, t), t;
25
+ }, it = (s, e) => (r, n) => e(r, n, s);
27
26
  let le = class extends B {
28
27
  constructor(e) {
29
28
  super();
30
- h(this, "zIndex", 5);
31
- h(this, "viewKey", F.DOCUMENT);
32
- h(this, "_liquid", new Ye());
29
+ u(this, "zIndex", 5);
30
+ u(this, "viewKey", F.DOCUMENT);
31
+ u(this, "_liquid", new He());
33
32
  this._localeService = e;
34
33
  }
35
34
  check(e) {
@@ -42,92 +41,92 @@ let le = class extends B {
42
41
  const {
43
42
  id: n,
44
43
  zIndex: t,
45
- left: s = 0,
44
+ left: a = 0,
46
45
  top: i = 0,
47
46
  width: o,
48
47
  height: c,
49
48
  angle: l,
50
- scaleX: g,
51
- scaleY: p,
52
- skewX: d,
53
- skewY: u,
54
- flipX: _,
55
- flipY: f,
56
- title: y,
57
- description: E,
49
+ scaleX: f,
50
+ scaleY: h,
51
+ skewX: g,
52
+ skewY: d,
53
+ flipX: p,
54
+ flipY: _,
55
+ title: D,
56
+ description: y,
58
57
  document: T
59
58
  } = e;
60
59
  if (T == null)
61
60
  return;
62
- const P = new je(T), w = new Fe(P), I = Be.create(w, this._localeService), S = new Ke("__DocsRender__", I);
61
+ const b = new je(T), w = new Fe(b), I = Be.create(w, this._localeService), S = new Ke("__DocsRender__", I);
63
62
  I.calculate();
64
- const D = new me("__DocsViewer__" + n, {
63
+ const R = new me("__DocsViewer__" + n, {
65
64
  top: i,
66
- left: s,
65
+ left: a,
67
66
  width: o,
68
67
  height: c,
69
68
  zIndex: t,
70
69
  angle: l,
71
- scaleX: g,
72
- scaleY: p,
73
- skewX: d,
74
- skewY: u,
75
- flipX: _,
76
- flipY: f,
77
- isTransformer: !0
78
- }), v = new ie("__DocsScene__" + n, D), b = new X("__DocsViewPort_" + n, v, {
70
+ scaleX: f,
71
+ scaleY: h,
72
+ skewX: g,
73
+ skewY: d,
74
+ flipX: p,
75
+ flipY: _
76
+ }), v = new ie("__DocsScene__" + n, R), P = new N("__DocsViewPort_" + n, v, {
79
77
  left: 0,
80
78
  top: 0,
81
79
  bottom: 0,
82
80
  right: 0,
81
+ isRelativeX: !0,
82
+ isRelativeY: !0,
83
83
  isWheelPreventDefaultX: !0
84
84
  });
85
- v.attachControl(), v.on(pe.wheel, (N, W) => {
86
- const O = N;
85
+ v.attachControl(), v.on(ue.wheel, (j, W) => {
86
+ const O = j;
87
87
  if (O.ctrlKey) {
88
88
  const z = Math.abs(O.deltaX);
89
89
  let x = z < 40 ? 0.2 : z < 80 ? 0.4 : 0.2;
90
90
  x *= O.deltaY > 0 ? -1 : 1, v.scaleX < 1 && (x /= 2), v.scaleX + x > 4 ? v.scale(4, 4) : v.scaleX + x < 0.1 ? v.scale(0.1, 0.1) : (O.deltaY > 0, O.preventDefault());
91
91
  } else
92
- b.onMouseWheel(O, W);
93
- }), new ue(b, {
92
+ P.onMouseWheel(O, W);
93
+ }), new pe(P, {
94
94
  mainScene: r
95
95
  }), v.addObject(S);
96
96
  const m = I.getActualSize();
97
97
  S.resize(m.actualWidth, m.actualHeight), v.resize(m.actualWidth, m.actualHeight + 200);
98
- const R = (k = S.getSkeleton()) == null ? void 0 : k.getPageSize();
99
- S.onPageRenderObservable.add((N) => {
100
- const { page: W, pageLeft: O, pageTop: z, ctx: x } = N, { width: q, height: G, marginBottom: ae, marginLeft: j, marginRight: Z, marginTop: J } = W;
101
- x.save(), x.translate(O - 0.5, z - 0.5), Y.drawWith(x, {
102
- width: (R == null ? void 0 : R.width) || q,
103
- height: (R == null ? void 0 : R.height) || G,
98
+ const E = (k = S.getSkeleton()) == null ? void 0 : k.getPageSize();
99
+ S.onPageRenderObservable.add((j) => {
100
+ const { page: W, pageLeft: O, pageTop: z, ctx: x } = j, { width: q, height: G, marginBottom: se, marginLeft: M, marginRight: Z, marginTop: J } = W;
101
+ x.save(), x.translate(O - 0.5, z - 0.5), H.drawWith(x, {
102
+ width: (E == null ? void 0 : E.width) || q,
103
+ height: (E == null ? void 0 : E.height) || G,
104
104
  strokeWidth: 1,
105
105
  stroke: "rgba(198,198,198, 1)",
106
106
  fill: "rgba(255,255,255, 1)",
107
107
  zIndex: 3
108
108
  }), x.restore();
109
109
  });
110
- const { left: H, top: U } = S, L = I.getSkeletonData();
110
+ const { left: $, top: Y } = S, L = I.getSkeletonData();
111
111
  if (L == null)
112
112
  return;
113
113
  const { pages: C } = L, V = [], K = /* @__PURE__ */ new Map();
114
114
  this._recalculateSizeBySkeleton(S, v, I);
115
- for (let N = 0, W = C.length; N < W; N++) {
116
- const O = C[N], { skeDrawings: z, marginLeft: x, marginTop: q, pageWidth: G, pageHeight: ae } = O;
117
- this._liquid.translatePagePadding(O), z.forEach((j) => {
118
- const { aLeft: Z, aTop: J, height: De, width: ye, drawingOrigin: Xt } = j, Ee = new Te(j.objectId, {
119
- // url: objectTransform.imageProperties?.contentUrl || '',
120
- left: Z + H + this._liquid.x,
121
- top: J + U + this._liquid.y,
122
- width: ye,
123
- height: De,
124
- zIndex: 11,
125
- isTransformer: !0
115
+ for (let j = 0, W = C.length; j < W; j++) {
116
+ const O = C[j], { skeDrawings: z, marginLeft: x, marginTop: q, pageWidth: G, pageHeight: se } = O;
117
+ this._liquid.translatePagePadding(O), z.forEach((M) => {
118
+ const { aLeft: Z, aTop: J, height: Re, width: De, drawingOrigin: zt } = M, ye = new Te(M.drawingId, {
119
+ // url: docTransform.imageProperties?.contentUrl || '',
120
+ left: Z + $ + this._liquid.x,
121
+ top: J + Y + this._liquid.y,
122
+ width: De,
123
+ height: Re,
124
+ zIndex: 11
126
125
  });
127
- K.set(j.objectId, {
126
+ K.set(M.drawingId, {
128
127
  marginLeft: this._liquid.x,
129
128
  marginTop: this._liquid.y
130
- }), V.push(Ee);
129
+ }), V.push(ye);
131
130
  }), this._liquid.translatePage(
132
131
  O,
133
132
  S.pageLayoutType,
@@ -135,63 +134,65 @@ let le = class extends B {
135
134
  S.pageMarginTop
136
135
  );
137
136
  }
138
- return v.openTransformer(), v.addObjects(V), (_e = v.getTransformer()) == null || _e.onChangingObservable.add((N) => {
139
- const { objects: W } = N;
137
+ return v.addObjects(V), V.forEach((j) => {
138
+ v.attachTransformerTo(j);
139
+ }), (_e = v.getTransformer()) == null || _e.onChangingObservable.add((j) => {
140
+ const { objects: W } = j;
140
141
  W.forEach((O) => {
141
- const { oKey: z, left: x, top: q, height: G, width: ae } = O, j = K.get(z), Z = (j == null ? void 0 : j.marginLeft) || 0, J = (j == null ? void 0 : j.marginTop) || 0;
142
+ const { oKey: z, left: x, top: q, height: G, width: se } = O, M = K.get(z), Z = (M == null ? void 0 : M.marginLeft) || 0, J = (M == null ? void 0 : M.marginTop) || 0;
142
143
  I == null || I.getViewModel().getDataModel().updateDrawing(z, {
143
- left: x - H - Z,
144
- top: q - U - J,
144
+ left: x - $ - Z,
145
+ top: q - Y - J,
145
146
  height: G,
146
- width: ae
147
+ width: se
147
148
  });
148
149
  }), I == null || I.calculate();
149
- }), v.closeTransformer(), this._calculatePagePosition(S, v, b), D;
150
+ }), this._calculatePagePosition(S, v, P), R;
150
151
  }
151
152
  _recalculateSizeBySkeleton(e, r, n) {
152
153
  var o;
153
154
  const t = (o = n.getSkeletonData()) == null ? void 0 : o.pages;
154
155
  if (t == null)
155
156
  return;
156
- let s = 0, i = 0;
157
+ let a = 0, i = 0;
157
158
  for (let c = 0, l = t.length; c < l; c++) {
158
- const g = t[c], { pageWidth: p, pageHeight: d } = g;
159
- e.pageLayoutType === ve.VERTICAL ? (i += d, i += e.pageMarginTop, c === l - 1 && (i += e.pageMarginTop), s = Math.max(s, p)) : e.pageLayoutType === ve.HORIZONTAL && (s += p, c !== l - 1 && (s += e.pageMarginLeft), i = Math.max(i, d));
159
+ const f = t[c], { pageWidth: h, pageHeight: g } = f;
160
+ e.pageLayoutType === ve.VERTICAL ? (i += g, i += e.pageMarginTop, c === l - 1 && (i += e.pageMarginTop), a = Math.max(a, h)) : e.pageLayoutType === ve.HORIZONTAL && (a += h, c !== l - 1 && (a += e.pageMarginLeft), i = Math.max(i, g));
160
161
  }
161
- e.resize(s, i), r.resize(s, i);
162
+ e.resize(a, i), r.resize(a, i);
162
163
  }
163
164
  _calculatePagePosition(e, r, n, t = 1) {
164
- const s = r == null ? void 0 : r.getParent(), { width: i, height: o, pageMarginLeft: c, pageMarginTop: l } = e;
165
- if (s == null || i === Number.POSITIVE_INFINITY || o === Number.POSITIVE_INFINITY)
165
+ const a = r == null ? void 0 : r.getParent(), { width: i, height: o, pageMarginLeft: c, pageMarginTop: l } = e;
166
+ if (a == null || i === Number.POSITIVE_INFINITY || o === Number.POSITIVE_INFINITY)
166
167
  return;
167
- const { width: g, height: p } = s;
168
- let d = 0, u = 0, _ = 0, f = 0, y = Number.POSITIVE_INFINITY;
169
- if (g > (i + c * 2) * t ? (d = g / 2 - i * t / 2, d /= t, _ = (g - c * 2) / t, y = 0) : (d = c, _ = i + c * 2, y = (_ - g / t) / 2), p > o ? (u = p / 2 - o / 2, f = (p - l * 2) / t) : (u = l, f = o + l * 2), r.resize(_, f + 200), e.translate(d, u), y !== Number.POSITIVE_INFINITY && n != null) {
170
- const E = n.getBarScroll(y, 0).x;
168
+ const { width: f, height: h } = a;
169
+ let g = 0, d = 0, p = 0, _ = 0, D = Number.POSITIVE_INFINITY;
170
+ if (f > (i + c * 2) * t ? (g = f / 2 - i * t / 2, g /= t, p = (f - c * 2) / t, D = 0) : (g = c, p = i + c * 2, D = (p - f / t) / 2), h > o ? (d = h / 2 - o / 2, _ = (h - l * 2) / t) : (d = l, _ = o + l * 2), r.resize(p, _ + 200), e.translate(g, d), D !== Number.POSITIVE_INFINITY && n != null) {
171
+ const y = n.getBarScroll(D, 0).x;
171
172
  n.scrollTo({
172
- x: E
173
+ x: y
173
174
  });
174
175
  }
175
176
  return this;
176
177
  }
177
178
  };
178
- le = it([
179
- st(0, A(ne))
179
+ le = nt([
180
+ it(0, A(ne))
180
181
  ], le);
181
182
  class at {
182
183
  constructor() {
183
- h(this, "zIndex", 5);
184
+ u(this, "zIndex", 5);
184
185
  }
185
186
  create(e) {
186
187
  return e.createInstance(le);
187
188
  }
188
189
  }
189
- $.add(new at());
190
- class ct extends B {
190
+ U.add(new at());
191
+ class st extends B {
191
192
  constructor() {
192
193
  super(...arguments);
193
- h(this, "zIndex", 1);
194
- h(this, "viewKey", F.IMAGE);
194
+ u(this, "zIndex", 1);
195
+ u(this, "viewKey", F.IMAGE);
195
196
  }
196
197
  check(r) {
197
198
  if (r === this.viewKey)
@@ -201,59 +202,58 @@ class ct extends B {
201
202
  const {
202
203
  id: n,
203
204
  zIndex: t,
204
- left: s = 0,
205
+ left: a = 0,
205
206
  top: i = 0,
206
207
  width: o,
207
208
  height: c,
208
209
  angle: l,
209
- scaleX: g,
210
- scaleY: p,
211
- skewX: d,
212
- skewY: u,
213
- flipX: _,
214
- flipY: f,
215
- title: y,
216
- description: E,
210
+ scaleX: f,
211
+ scaleY: h,
212
+ skewX: g,
213
+ skewY: d,
214
+ flipX: p,
215
+ flipY: _,
216
+ title: D,
217
+ description: y,
217
218
  image: T = {}
218
- } = r, { imageProperties: P, placeholder: w, link: I } = T, S = (P == null ? void 0 : P.contentUrl) || "";
219
+ } = r, { imageProperties: b, placeholder: w, link: I } = T, S = (b == null ? void 0 : b.contentUrl) || "";
219
220
  return new Te(n, {
220
221
  url: S,
221
222
  top: i,
222
- left: s,
223
+ left: a,
223
224
  width: o,
224
225
  height: c,
225
226
  zIndex: t,
226
227
  angle: l,
227
- scaleX: g,
228
- scaleY: p,
229
- skewX: d,
230
- skewY: u,
231
- flipX: _,
232
- flipY: f,
233
- isTransformer: !0,
228
+ scaleX: f,
229
+ scaleY: h,
230
+ skewX: g,
231
+ skewY: d,
232
+ flipX: p,
233
+ flipY: _,
234
234
  forceRender: !0
235
235
  });
236
236
  }
237
237
  }
238
- class ot {
238
+ class ct {
239
239
  constructor() {
240
- h(this, "zIndex", 4);
240
+ u(this, "zIndex", 4);
241
241
  }
242
242
  create(e) {
243
- return e.createInstance(ct);
243
+ return e.createInstance(st);
244
244
  }
245
245
  }
246
- $.add(new ot());
247
- var lt = Object.defineProperty, dt = Object.getOwnPropertyDescriptor, ht = (a, e, r, n) => {
248
- for (var t = n > 1 ? void 0 : n ? dt(e, r) : e, s = a.length - 1, i; s >= 0; s--)
249
- (i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
250
- return n && t && lt(e, r, t), t;
251
- }, gt = (a, e) => (r, n) => e(r, n, a);
246
+ U.add(new ct());
247
+ var ot = Object.defineProperty, lt = Object.getOwnPropertyDescriptor, dt = (s, e, r, n) => {
248
+ for (var t = n > 1 ? void 0 : n ? lt(e, r) : e, a = s.length - 1, i; a >= 0; a--)
249
+ (i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
250
+ return n && t && ot(e, r, t), t;
251
+ }, ht = (s, e) => (r, n) => e(r, n, s);
252
252
  let de = class extends B {
253
253
  constructor(e) {
254
254
  super();
255
- h(this, "zIndex", 2);
256
- h(this, "viewKey", F.TEXT);
255
+ u(this, "zIndex", 2);
256
+ u(this, "viewKey", F.TEXT);
257
257
  this._localeService = e;
258
258
  }
259
259
  check(e) {
@@ -264,58 +264,57 @@ let de = class extends B {
264
264
  const {
265
265
  id: n,
266
266
  zIndex: t,
267
- left: s = 0,
267
+ left: a = 0,
268
268
  top: i = 0,
269
269
  width: o,
270
270
  height: c,
271
271
  angle: l,
272
- scaleX: g,
273
- scaleY: p,
274
- skewX: d,
275
- skewY: u,
276
- flipX: _,
277
- flipY: f,
278
- title: y,
279
- description: E,
272
+ scaleX: f,
273
+ scaleY: h,
274
+ skewX: g,
275
+ skewY: d,
276
+ flipX: p,
277
+ flipY: _,
278
+ title: D,
279
+ description: y,
280
280
  richText: T = {}
281
- } = e, { text: P, ff: w, fs: I, it: S, bl: D, ul: v, st: b, ol: m, bg: R, bd: H, cl: U, rich: L } = T;
281
+ } = e, { text: b, ff: w, fs: I, it: S, bl: R, ul: v, st: P, ol: m, bg: E, bd: $, cl: Y, rich: L } = T;
282
282
  let C = {
283
283
  top: i,
284
- left: s,
284
+ left: a,
285
285
  width: o,
286
286
  height: c,
287
287
  zIndex: t,
288
288
  angle: l,
289
- scaleX: g,
290
- scaleY: p,
291
- skewX: d,
292
- skewY: u,
293
- flipX: _,
294
- flipY: f,
295
- isTransformer: !0,
289
+ scaleX: f,
290
+ scaleY: h,
291
+ skewX: g,
292
+ skewY: d,
293
+ flipX: p,
294
+ flipY: _,
296
295
  forceRender: !0
297
296
  }, V = !1;
298
- if (P != null ? (C = { ...C, text: P, ff: w, fs: I, it: S, bl: D, ul: v, st: b, ol: m, bg: R, bd: H, cl: U }, V = !0) : L != null && (C = { ...C, richText: L }, V = !0), V !== !1)
297
+ if (b != null ? (C = { ...C, text: b, ff: w, fs: I, it: S, bl: R, ul: v, st: P, ol: m, bg: E, bd: $, cl: Y }, V = !0) : L != null && (C = { ...C, richText: L }, V = !0), V !== !1)
299
298
  return new ke(this._localeService, n, C);
300
299
  }
301
300
  };
302
- de = ht([
303
- gt(0, A(ne))
301
+ de = dt([
302
+ ht(0, A(ne))
304
303
  ], de);
305
- class pt {
304
+ class gt {
306
305
  constructor() {
307
- h(this, "zIndex", 0);
306
+ u(this, "zIndex", 0);
308
307
  }
309
308
  create(e) {
310
309
  return e.createInstance(de);
311
310
  }
312
311
  }
313
- $.add(new pt());
312
+ U.add(new gt());
314
313
  class ut extends B {
315
314
  constructor() {
316
315
  super(...arguments);
317
- h(this, "zIndex", 2);
318
- h(this, "viewKey", F.SHAPE);
316
+ u(this, "zIndex", 2);
317
+ u(this, "viewKey", F.SHAPE);
319
318
  }
320
319
  check(r) {
321
320
  if (r === this.viewKey)
@@ -325,87 +324,85 @@ class ut extends B {
325
324
  const {
326
325
  id: n,
327
326
  zIndex: t,
328
- left: s = 0,
327
+ left: a = 0,
329
328
  top: i = 0,
330
329
  width: o,
331
330
  height: c,
332
331
  angle: l,
333
- scaleX: g,
334
- scaleY: p,
335
- skewX: d,
336
- skewY: u,
337
- flipX: _,
338
- flipY: f,
339
- title: y,
340
- description: E
341
- } = r, { shapeType: T, text: P, shapeProperties: w, placeholder: I, link: S } = r.shape || {}, D = w == null ? "" : te(w.shapeBackgroundFill) || "rgba(255,255,255,1)", v = w == null ? void 0 : w.outline, b = {};
332
+ scaleX: f,
333
+ scaleY: h,
334
+ skewX: g,
335
+ skewY: d,
336
+ flipX: p,
337
+ flipY: _,
338
+ title: D,
339
+ description: y
340
+ } = r, { shapeType: T, text: b, shapeProperties: w, placeholder: I, link: S } = r.shape || {}, R = w == null ? "" : te(w.shapeBackgroundFill) || "rgba(255,255,255,1)", v = w == null ? void 0 : w.outline, P = {};
342
341
  if (v) {
343
- const { outlineFill: m, weight: R } = v;
344
- b.strokeWidth = R, b.stroke = te(m) || "rgba(0,0,0,1)";
342
+ const { outlineFill: m, weight: E } = v;
343
+ P.strokeWidth = E, P.stroke = te(m) || "rgba(0,0,0,1)";
345
344
  }
346
- if (T === fe.RECTANGLE)
347
- return new Y(n, {
348
- fill: D,
345
+ if (T === fe.Rect)
346
+ return new H(n, {
347
+ fill: R,
349
348
  top: i,
350
- left: s,
349
+ left: a,
351
350
  width: o,
352
351
  height: c,
353
352
  zIndex: t,
354
353
  angle: l,
355
- scaleX: g,
356
- scaleY: p,
357
- skewX: d,
358
- skewY: u,
359
- flipX: _,
360
- flipY: f,
361
- isTransformer: !0,
354
+ scaleX: f,
355
+ scaleY: h,
356
+ skewX: g,
357
+ skewY: d,
358
+ flipX: p,
359
+ flipY: _,
362
360
  forceRender: !0,
363
- ...b
361
+ ...P
364
362
  });
365
- if (T === fe.ROUND_RECTANGLE) {
363
+ if (T === fe.RoundRect) {
366
364
  const m = (w == null ? void 0 : w.radius) || 0;
367
- return new Y(n, {
368
- fill: D,
365
+ return new H(n, {
366
+ fill: R,
369
367
  top: i,
370
- left: s,
368
+ left: a,
371
369
  width: o,
372
370
  height: c,
373
371
  zIndex: t,
374
372
  angle: l,
375
- scaleX: g,
376
- scaleY: p,
377
- skewX: d,
378
- skewY: u,
379
- flipX: _,
380
- flipY: f,
381
- isTransformer: !0,
373
+ scaleX: f,
374
+ scaleY: h,
375
+ skewX: g,
376
+ skewY: d,
377
+ flipX: p,
378
+ flipY: _,
382
379
  forceRender: !0,
383
380
  radius: m,
384
- ...b
381
+ ...P
385
382
  });
386
383
  }
387
384
  }
388
385
  }
389
- class _t {
386
+ class pt {
390
387
  constructor() {
391
- h(this, "zIndex", 2);
388
+ u(this, "zIndex", 2);
392
389
  }
393
390
  create(e) {
394
391
  return e.createInstance(ut);
395
392
  }
396
393
  }
397
- $.add(new _t());
398
- var ft = Object.defineProperty, vt = Object.getOwnPropertyDescriptor, wt = (a, e, r, n) => {
399
- for (var t = n > 1 ? void 0 : n ? vt(e, r) : e, s = a.length - 1, i; s >= 0; s--)
400
- (i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
401
- return n && t && ft(e, r, t), t;
402
- }, St = (a, e) => (r, n) => e(r, n, a);
394
+ U.add(new pt());
395
+ var _t = Object.defineProperty, ft = Object.getOwnPropertyDescriptor, vt = (s, e, r, n) => {
396
+ for (var t = n > 1 ? void 0 : n ? ft(e, r) : e, a = s.length - 1, i; a >= 0; a--)
397
+ (i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
398
+ return n && t && _t(e, r, t), t;
399
+ }, wt = (s, e) => (r, n) => e(r, n, s);
403
400
  let he = class extends B {
404
401
  constructor(e) {
405
402
  super();
406
- h(this, "zIndex", 6);
407
- h(this, "viewKey", F.SLIDE);
408
- h(this, "_ObjectProvider", null);
403
+ u(this, "zIndex", 6);
404
+ u(this, "viewKey", F.SLIDE);
405
+ u(this, "_ObjectProvider", null);
409
406
  this._injector = e;
410
407
  }
411
408
  check(e) {
@@ -416,70 +413,73 @@ let he = class extends B {
416
413
  const {
417
414
  id: n,
418
415
  zIndex: t,
419
- left: s = 0,
416
+ left: a = 0,
420
417
  top: i = 0,
421
418
  width: o,
422
419
  height: c,
423
420
  angle: l,
424
- scaleX: g,
425
- scaleY: p,
426
- skewX: d,
427
- skewY: u,
428
- flipX: _,
429
- flipY: f,
430
- title: y,
431
- description: E,
421
+ scaleX: f,
422
+ scaleY: h,
423
+ skewX: g,
424
+ skewY: d,
425
+ flipX: p,
426
+ flipY: _,
427
+ title: D,
428
+ description: y,
432
429
  slide: T
433
430
  } = e;
434
431
  if (T == null)
435
432
  return;
436
- const P = new Me(T), w = new Oe("__SLIDERender__" + n, {
433
+ const b = new Me(T), w = new Oe("__SLIDERender__" + n, {
437
434
  top: i,
438
- left: s,
435
+ left: a,
439
436
  width: o,
440
437
  height: c,
441
438
  zIndex: t,
442
439
  angle: l,
443
- scaleX: g,
444
- scaleY: p,
445
- skewX: d,
446
- skewY: u,
447
- flipX: _,
448
- flipY: f,
449
- isTransformer: !1,
440
+ scaleX: f,
441
+ scaleY: h,
442
+ skewX: g,
443
+ skewY: d,
444
+ flipX: p,
445
+ flipY: _,
450
446
  forceRender: !0
451
447
  });
452
448
  w.enableNav(), w.enableSelectedClipElement();
453
- const I = P.getPageOrder(), S = P.getPages();
449
+ const I = b.getPageOrder(), S = b.getPages();
454
450
  if (!I || !S)
455
451
  return w;
456
452
  this._ObjectProvider = new re(this._injector);
457
- for (let D = 0, v = I.length; D < v; D++) {
458
- const b = S[I[D]], { id: m } = b;
459
- w.addPage(this._createScene(m, w, b, r, P));
453
+ for (let R = 0, v = I.length; R < v; R++) {
454
+ const P = S[I[R]], { id: m } = P;
455
+ w.addPage(this._createScene(m, w, P, r, b));
460
456
  }
461
457
  return w.activeFirstPage(), w;
462
458
  }
463
- _createScene(e, r, n, t, s) {
464
- var u;
459
+ _createScene(e, r, n, t, a) {
460
+ var d;
465
461
  const { width: i, height: o } = r, c = new ie(e, r, {
466
462
  width: i,
467
463
  height: o
468
464
  });
469
- new X(`PageViewer_${e}`, c, {
465
+ new N(`PageViewer_${e}`, c, {
470
466
  left: 0,
471
467
  top: 0,
472
468
  bottom: 0,
473
- right: 0
469
+ right: 0,
470
+ isRelativeX: !0,
471
+ isRelativeY: !0
474
472
  }).closeClip();
475
- const { pageElements: g, pageBackgroundFill: p } = n, d = (u = this._ObjectProvider) == null ? void 0 : u.convertToRenderObjects(g, t);
476
- return c.openTransformer(), this._addBackgroundRect(c, p, s), c.addObjects(d), c;
473
+ const { pageElements: f, pageBackgroundFill: h } = n, g = (d = this._ObjectProvider) == null ? void 0 : d.convertToRenderObjects(f, t);
474
+ return this._addBackgroundRect(c, h, a), c.addObjects(g), g == null || g.forEach((p) => {
475
+ c.attachTransformerTo(p);
476
+ }), c;
477
477
  }
478
478
  _addBackgroundRect(e, r, n) {
479
- const t = n.getPageSize(), { width: s = 0, height: i = 0 } = t, o = new Y("canvas", {
479
+ const t = n.getPageSize(), { width: a = 0, height: i = 0 } = t, o = new H("canvas", {
480
480
  left: 0,
481
481
  top: 0,
482
- width: s,
482
+ width: a,
483
483
  height: i,
484
484
  strokeWidth: 1,
485
485
  stroke: "rgba(198,198,198, 1)",
@@ -490,202 +490,207 @@ let he = class extends B {
490
490
  e.addObject(o, 0);
491
491
  }
492
492
  };
493
- he = wt([
494
- St(0, A(se))
493
+ he = vt([
494
+ wt(0, A(ae))
495
495
  ], he);
496
- class It {
496
+ class St {
497
497
  constructor() {
498
- h(this, "zIndex", 6);
498
+ u(this, "zIndex", 6);
499
499
  }
500
500
  create(e) {
501
501
  return e.createInstance(he);
502
502
  }
503
503
  }
504
- $.add(new It());
505
- var bt = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, mt = (a, e, r, n) => {
506
- for (var t = n > 1 ? void 0 : n ? Pt(e, r) : e, s = a.length - 1, i; s >= 0; s--)
507
- (i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
508
- return n && t && bt(e, r, t), t;
509
- }, Ie = (a, e) => (r, n) => e(r, n, a);
504
+ U.add(new St());
505
+ var It = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, bt = (s, e, r, n) => {
506
+ for (var t = n > 1 ? void 0 : n ? Pt(e, r) : e, a = s.length - 1, i; a >= 0; a--)
507
+ (i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
508
+ return n && t && It(e, r, t), t;
509
+ }, Ie = (s, e) => (r, n) => e(r, n, s);
510
510
  let ge = class extends B {
511
511
  constructor(e, r) {
512
512
  super();
513
- h(this, "zIndex", 4);
514
- h(this, "viewKey", F.SPREADSHEET);
513
+ u(this, "zIndex", 4);
514
+ u(this, "viewKey", F.SPREADSHEET);
515
515
  this._localeService = e, this._contextService = r;
516
516
  }
517
517
  check(e) {
518
518
  if (e === this.viewKey)
519
519
  return this;
520
520
  }
521
+ // eslint-disable-next-line max-lines-per-function
521
522
  convert(e, r) {
522
523
  const {
523
524
  id: n,
524
525
  zIndex: t,
525
- left: s = 0,
526
+ left: a = 0,
526
527
  top: i = 0,
527
528
  width: o,
528
529
  height: c,
529
530
  angle: l,
530
- scaleX: g,
531
- scaleY: p,
532
- skewX: d,
533
- skewY: u,
534
- flipX: _,
535
- flipY: f,
536
- spreadsheet: y
531
+ scaleX: f,
532
+ scaleY: h,
533
+ skewX: g,
534
+ skewY: d,
535
+ flipX: p,
536
+ flipY: _,
537
+ spreadsheet: D
537
538
  } = e;
538
- if (y == null)
539
+ if (D == null)
539
540
  return;
540
- const { worksheet: E, styles: T } = y, { cellData: P } = E, w = new Ne(P), I = new ze(T), S = new qe(
541
- new Ve(n, E, I),
541
+ const { worksheet: y, styles: T } = D, { cellData: b } = y, w = new Le(b), I = new Ve(T), S = new qe(
542
+ new ze(n, y, I),
542
543
  // FIXME: worksheet in slide doesn't has a Worksheet object
543
- E,
544
+ y,
544
545
  w,
545
546
  I,
546
547
  this._localeService,
547
548
  this._contextService
548
- ), { rowTotalHeight: D, columnTotalWidth: v, rowHeaderWidth: b, columnHeaderHeight: m } = S, R = v + E.rowHeader.width || 0, H = D + E.columnHeader.height || 0, U = new me("spreadInSlideSceneViewer" + n, {
549
+ ), { rowTotalHeight: R, columnTotalWidth: v, rowHeaderWidth: P, columnHeaderHeight: m } = S, E = v + y.rowHeader.width || 0, $ = R + y.columnHeader.height || 0, Y = new me("spreadInSlideSceneViewer" + n, {
549
550
  top: i,
550
- left: s,
551
+ left: a,
551
552
  width: o,
552
553
  height: c,
553
554
  zIndex: t,
554
555
  angle: l,
555
- scaleX: g,
556
- scaleY: p,
557
- skewX: d,
558
- skewY: u,
559
- flipX: _,
560
- flipY: f,
561
- isTransformer: !0,
556
+ scaleX: f,
557
+ scaleY: h,
558
+ skewX: g,
559
+ skewY: d,
560
+ flipX: p,
561
+ flipY: _,
562
562
  forceRender: !0
563
- }), L = new ie("spreadInSlideScene" + n, U, {
564
- width: R,
565
- height: H
563
+ }), L = new ie("spreadInSlideScene" + n, Y, {
564
+ width: E,
565
+ height: $
566
566
  });
567
- this._updateViewport(n, b, m, L, r);
568
- const C = new Ge("testSheetViewer", S, !1), V = new Ze("spreadInSlideRow", S), K = new Je("spreadInSlideColumn", S), k = new Y("spreadInSlideLeftTop", {
567
+ this._updateViewport(n, P, m, L, r);
568
+ const C = new Ge("testSheetViewer", S, !1), V = new Ze("spreadInSlideRow", S), K = new Je("spreadInSlideColumn", S), k = new H("spreadInSlideLeftTop", {
569
569
  zIndex: 2,
570
570
  left: -1,
571
571
  top: -1,
572
- width: b,
572
+ width: P,
573
573
  height: m,
574
574
  fill: we([248, 249, 250]),
575
575
  stroke: we([217, 217, 217]),
576
576
  strokeWidth: 1
577
577
  });
578
- return C.zIndex = 10, L.addObjects([C], 1), L.addObjects([V, K, k], 2), U;
578
+ return C.zIndex = 10, L.addObjects([C], 1), L.addObjects([V, K, k], 2), Y;
579
579
  }
580
- _updateViewport(e, r, n, t, s) {
581
- if (s == null)
580
+ // eslint-disable-next-line max-lines-per-function
581
+ _updateViewport(e, r, n, t, a) {
582
+ if (a == null)
582
583
  return;
583
- const i = r * t.scaleX, o = n * t.scaleY, c = new X("spreadInSlideViewMain" + e, t, {
584
+ const i = r * t.scaleX, o = n * t.scaleY, c = new N("spreadInSlideViewMain" + e, t, {
584
585
  left: i,
585
586
  top: o,
586
587
  bottom: 0,
587
588
  right: 0,
589
+ isRelativeX: !0,
590
+ isRelativeY: !0,
588
591
  isWheelPreventDefaultX: !0
589
- }), l = new X("spreadInSlideViewTop" + e, t, {
592
+ }), l = new N("spreadInSlideViewTop" + e, t, {
590
593
  left: i,
591
594
  height: o,
592
595
  top: 0,
593
596
  right: 0,
597
+ isRelativeX: !0,
594
598
  isWheelPreventDefaultX: !0
595
- }), g = new X("spreadInSlideViewLeft" + e, t, {
599
+ }), f = new N("spreadInSlideViewLeft" + e, t, {
596
600
  left: 0,
597
601
  bottom: 0,
598
602
  top: o,
599
603
  width: i,
604
+ isRelativeY: !0,
600
605
  isWheelPreventDefaultX: !0
601
606
  });
602
- new X("spreadInSlideViewLeftTop" + e, t, {
607
+ new N("spreadInSlideViewLeftTop" + e, t, {
603
608
  left: 0,
604
609
  top: 0,
605
610
  width: i,
606
611
  height: o,
607
612
  isWheelPreventDefaultX: !0
608
- }), c.onScrollAfterObserver.add((p) => {
609
- const { scrollX: d, scrollY: u, actualScrollX: _, actualScrollY: f } = p;
613
+ }), c.onScrollAfterObserver.add((h) => {
614
+ const { scrollX: g, scrollY: d, actualScrollX: p, actualScrollY: _ } = h;
610
615
  l.updateScroll({
611
- scrollX: d,
612
- actualScrollX: _
613
- }), g.updateScroll({
614
- scrollY: u,
615
- actualScrollY: f
616
+ scrollX: g,
617
+ actualScrollX: p
618
+ }), f.updateScroll({
619
+ scrollY: d,
620
+ actualScrollY: _
616
621
  });
617
- }), t.attachControl(), new ue(c, {
618
- mainScene: s
619
- }), t.on(pe.wheel, (p, d) => {
620
- const u = p;
621
- if (u.ctrlKey) {
622
- const _ = Math.abs(u.deltaX);
623
- let f = _ < 40 ? 0.05 : _ < 80 ? 0.02 : 0.01;
624
- f *= u.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (f /= 2), t.scaleX + f > 4 ? t.scale(4, 4) : t.scaleX + f < 0.1 ? t.scale(0.1, 0.1) : (t.scaleBy(f, f), u.preventDefault());
622
+ }), t.attachControl(), new pe(c, {
623
+ mainScene: a
624
+ }), t.on(ue.wheel, (h, g) => {
625
+ const d = h;
626
+ if (d.ctrlKey) {
627
+ const p = Math.abs(d.deltaX);
628
+ let _ = p < 40 ? 0.05 : p < 80 ? 0.02 : 0.01;
629
+ _ *= d.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (_ /= 2), t.scaleX + _ > 4 ? t.scale(4, 4) : t.scaleX + _ < 0.1 ? t.scale(0.1, 0.1) : (t.scaleBy(_, _), d.preventDefault());
625
630
  } else
626
- c.onMouseWheel(u, d);
631
+ c.onMouseWheel(d, g);
627
632
  });
628
633
  }
629
634
  };
630
- ge = mt([
635
+ ge = bt([
631
636
  Ie(0, A(ne)),
632
- Ie(1, Le)
637
+ Ie(1, Xe)
633
638
  ], ge);
634
- class Tt {
639
+ class mt {
635
640
  constructor() {
636
- h(this, "zIndex", 4);
641
+ u(this, "zIndex", 4);
637
642
  }
638
643
  create(e) {
639
644
  return e.createInstance(ge);
640
645
  }
641
646
  }
642
- $.add(new Tt());
643
- var Ot = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, yt = (a, e, r, n) => {
644
- for (var t = n > 1 ? void 0 : n ? Dt(e, r) : e, s = a.length - 1, i; s >= 0; s--)
645
- (i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
646
- return n && t && Ot(e, r, t), t;
647
- }, Et = (a, e) => (r, n) => e(r, n, a);
647
+ U.add(new mt());
648
+ var Tt = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Rt = (s, e, r, n) => {
649
+ for (var t = n > 1 ? void 0 : n ? Ot(e, r) : e, a = s.length - 1, i; a >= 0; a--)
650
+ (i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
651
+ return n && t && Tt(e, r, t), t;
652
+ }, Dt = (s, e) => (r, n) => e(r, n, s);
648
653
  let re = class {
649
- constructor(a) {
650
- h(this, "_adaptors", []);
651
- this._injector = a, this._adaptorLoader();
654
+ constructor(s) {
655
+ u(this, "_adaptors", []);
656
+ this._injector = s, this._adaptorLoader();
652
657
  }
653
- convertToRenderObjects(a, e) {
654
- const r = Object.keys(a), n = [];
658
+ convertToRenderObjects(s, e) {
659
+ const r = Object.keys(s), n = [];
655
660
  return r.forEach((t) => {
656
- const s = a[t], i = this._executor(s, e);
661
+ const a = s[t], i = this._executor(a, e);
657
662
  i != null && n.push(i);
658
663
  }), n;
659
664
  }
660
- _executor(a, e) {
665
+ _executor(s, e) {
661
666
  var t;
662
- const { id: r, type: n } = a;
663
- for (const s of this._adaptors) {
664
- const i = (t = s.check(n)) == null ? void 0 : t.convert(a, e);
667
+ const { id: r, type: n } = s;
668
+ for (const a of this._adaptors) {
669
+ const i = (t = a.check(n)) == null ? void 0 : t.convert(s, e);
665
670
  if (i != null)
666
671
  return i;
667
672
  }
668
673
  }
669
674
  _adaptorLoader() {
670
- $.getData().sort(Xe).forEach((a) => {
671
- this._adaptors.push(a.create(this._injector));
675
+ U.getData().sort(Ne).forEach((s) => {
676
+ this._adaptors.push(s.create(this._injector));
672
677
  });
673
678
  }
674
679
  };
675
- re = yt([
676
- Et(0, A(se))
680
+ re = Rt([
681
+ Dt(0, A(ae))
677
682
  ], re);
678
- var Rt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, Ct = (a, e, r, n) => {
679
- for (var t = n > 1 ? void 0 : n ? xt(e, r) : e, s = a.length - 1, i; s >= 0; s--)
680
- (i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
681
- return n && t && Rt(e, r, t), t;
682
- }, ce = (a, e) => (r, n) => e(r, n, a), jt = /* @__PURE__ */ ((a) => (a.COMPONENT = "__slideRender__", a.SCENE = "__mainScene__", a.VIEW = "__mainView__", a))(jt || {});
683
+ var yt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, xt = (s, e, r, n) => {
684
+ for (var t = n > 1 ? void 0 : n ? Et(e, r) : e, a = s.length - 1, i; a >= 0; a--)
685
+ (i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
686
+ return n && t && yt(e, r, t), t;
687
+ }, ce = (s, e) => (r, n) => e(r, n, s), Ct = /* @__PURE__ */ ((s) => (s.COMPONENT = "__slideRender__", s.SCENE = "__mainScene__", s.VIEW = "__mainView__", s))(Ct || {});
683
688
  let ee = class extends We {
684
689
  constructor(e, r, n) {
685
690
  super();
686
- h(this, "_objectProvider", null);
687
- h(this, "_activePageId", "");
688
- h(this, "_refreshThumb", $e(() => {
691
+ u(this, "_objectProvider", null);
692
+ u(this, "_activePageId", "");
693
+ u(this, "_refreshThumb", Ue(() => {
689
694
  this.createThumbs();
690
695
  }, 300));
691
696
  this._univerInstanceService = e, this._injector = r, this._renderManagerService = n, this._initializeDependencies(this._injector), this._initialize();
@@ -693,14 +698,14 @@ let ee = class extends We {
693
698
  _initialize() {
694
699
  this._renderManagerService.createRender$.pipe(Se(this.dispose$)).subscribe((e) => {
695
700
  this._create(e);
696
- }), this._univerInstanceService.getCurrentTypeOfUnit$(M.UNIVER_SLIDE).pipe(Se(this.dispose$)).subscribe((e) => {
701
+ }), this._univerInstanceService.getCurrentTypeOfUnit$(X.UNIVER_SLIDE).pipe(Se(this.dispose$)).subscribe((e) => {
697
702
  this._create(e == null ? void 0 : e.getUnitId());
698
- }), this._univerInstanceService.getAllUnitsForType(M.UNIVER_SLIDE).forEach((e) => {
703
+ }), this._univerInstanceService.getAllUnitsForType(X.UNIVER_SLIDE).forEach((e) => {
699
704
  this._create(e.getUnitId());
700
705
  });
701
706
  }
702
707
  activePage(e) {
703
- const r = this._univerInstanceService.getCurrentUnitForType(M.UNIVER_SLIDE);
708
+ const r = this._univerInstanceService.getCurrentUnitForType(X.UNIVER_SLIDE);
704
709
  let n;
705
710
  if (e)
706
711
  n = r.getPage(e);
@@ -713,74 +718,77 @@ let ee = class extends We {
713
718
  const t = this._currentRender();
714
719
  if (n == null || t == null || t.mainComponent == null)
715
720
  return;
716
- const { id: s } = n, i = t.mainComponent;
717
- if (this._activePageId = e, i != null && i.hasPage(s)) {
718
- i.changePage(s);
721
+ const { id: a } = n, i = t.mainComponent;
722
+ if (this._activePageId = e, i != null && i.hasPage(a)) {
723
+ i.changePage(a);
719
724
  return;
720
725
  }
721
- this._createScene(s, n);
726
+ this._createScene(a, n);
722
727
  }
723
728
  _scrollToCenter() {
724
729
  var c;
725
730
  const e = (c = this._currentRender()) == null ? void 0 : c.scene, r = e == null ? void 0 : e.getViewport("__mainView__"), n = this._getCenterPositionViewPort(e);
726
731
  if (!r || !n)
727
732
  return;
728
- const { left: t, top: s } = n, { x: i, y: o } = r.getBarScroll(t, s);
733
+ const { left: t, top: a } = n, { x: i, y: o } = r.getBarScroll(t, a);
729
734
  r.scrollTo({
730
735
  x: i,
731
736
  y: o
732
737
  });
733
738
  }
734
739
  _create(e) {
735
- e == null || this._univerInstanceService.getUnit(e, M.UNIVER_SLIDE) == null || this._renderManagerService.has(e) || this._addNewRender(e);
740
+ e == null || this._univerInstanceService.getUnit(e, X.UNIVER_SLIDE) == null || this._renderManagerService.has(e) || this._addNewRender(e);
736
741
  }
737
742
  _currentRender() {
738
- const e = this._univerInstanceService.getCurrentUnitForType(M.UNIVER_SLIDE);
743
+ const e = this._univerInstanceService.getCurrentUnitForType(X.UNIVER_SLIDE);
739
744
  return this._renderManagerService.getRenderById(e.getUnitId());
740
745
  }
746
+ // eslint-disable-next-line max-lines-per-function
741
747
  _addNewRender(e) {
742
- const r = this._univerInstanceService.getUnit(e, M.UNIVER_SLIDE);
748
+ const r = this._univerInstanceService.getUnit(e, X.UNIVER_SLIDE);
743
749
  if (r == null)
744
750
  return;
745
751
  this._renderManagerService.createRender(e);
746
752
  const n = this._renderManagerService.getRenderById(e);
747
753
  if (n == null)
748
754
  return;
749
- const { scene: t, engine: s } = n;
750
- s.onTransformChangeObservable.addOnce(() => {
751
- this._scrollToCenter();
752
- }), s.onTransformChangeObservable.add(() => {
755
+ const { scene: t, engine: a } = n, i = a.onTransformChangeObservable.add(() => {
756
+ this._scrollToCenter(), i == null || i.dispose();
757
+ });
758
+ a.onTransformChangeObservable.add(() => {
753
759
  setTimeout(() => {
754
760
  this.createThumbs();
755
761
  }, 300);
756
762
  }), t.resize(2400, 1800);
757
- const i = new X("__mainView__", t, {
763
+ const o = new N("__mainView__", t, {
758
764
  left: 0,
759
765
  top: 0,
760
766
  bottom: 0,
761
767
  right: 0,
768
+ isRelativeX: !0,
769
+ isRelativeY: !0,
762
770
  isWheelPreventDefaultX: !0
763
771
  });
764
- t.attachControl(), t.on(pe.wheel, (c, l) => {
765
- const g = c;
766
- if (g.ctrlKey) {
767
- const p = Math.abs(g.deltaX);
768
- let d = p < 40 ? 0.2 : p < 80 ? 0.4 : 0.2;
769
- d *= g.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (d /= 2), t.scaleX + d > 4 ? t.scale(4, 4) : t.scaleX + d < 0.1 ? t.scale(0.1, 0.1) : (g.deltaY > 0, g.preventDefault());
772
+ t.attachControl(), t.on(ue.wheel, (l, f) => {
773
+ const h = l;
774
+ if (h.ctrlKey) {
775
+ const g = Math.abs(h.deltaX);
776
+ let d = g < 40 ? 0.2 : g < 80 ? 0.4 : 0.2;
777
+ d *= h.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (d /= 2), t.scaleX + d > 4 ? t.scale(4, 4) : t.scaleX + d < 0.1 ? t.scale(0.1, 0.1) : (h.deltaY > 0, h.preventDefault());
770
778
  } else
771
- i.onMouseWheel(g, l);
779
+ o.onMouseWheel(h, f);
772
780
  }), t.onFileLoadedObservable.add(() => {
773
781
  this._refreshThumb();
774
- }), ue.attachTo(i), this._renderManagerService.setCurrent(e);
775
- const o = this._createSlide(t);
776
- n.mainComponent = o, n.components.set("__slideRender__", o), this._createSlidePages(r, o), s.runRenderLoop(() => {
782
+ }), pe.attachTo(o), this._renderManagerService.setCurrent(e);
783
+ const c = this._createSlide(t);
784
+ n.mainComponent = c, n.components.set("__slideRender__", c), this._createSlidePages(r, c), a.runRenderLoop(() => {
777
785
  t.render();
778
- const c = document.getElementById("app");
779
- c && (c.innerText = `fps:${Math.round(s.getFps()).toString()}`);
786
+ const l = document.getElementById("app");
787
+ l && (l.innerText = `fps:${Math.round(a.getFps()).toString()}`);
780
788
  });
781
789
  }
782
790
  _createSlide(e) {
783
- const r = this._univerInstanceService.getCurrentUnitForType(M.UNIVER_SLIDE), { width: n, height: t } = e, s = r.getPageSize(), { width: i = 100, height: o = 100 } = s, c = new Oe("__slideRender__", {
791
+ const r = this._univerInstanceService.getCurrentUnitForType(X.UNIVER_SLIDE), { width: n, height: t } = e, a = r.getPageSize(), { width: i = 100, height: o = 100 } = a, c = new Oe("__slideRender__", {
784
792
  left: (n - i) / 2,
785
793
  top: (t - o) / 2,
786
794
  width: i,
@@ -790,10 +798,10 @@ let ee = class extends We {
790
798
  return c.enableNav(), c.enableSelectedClipElement(), e.addObject(c), c;
791
799
  }
792
800
  _addBackgroundRect(e, r) {
793
- const t = this._univerInstanceService.getCurrentUnitForType(M.UNIVER_SLIDE).getPageSize(), { width: s = 0, height: i = 0 } = t, o = new Y("canvas", {
801
+ const t = this._univerInstanceService.getCurrentUnitForType(X.UNIVER_SLIDE).getPageSize(), { width: a = 0, height: i = 0 } = t, o = new H("canvas", {
794
802
  left: 0,
795
803
  top: 0,
796
- width: s,
804
+ width: a,
797
805
  height: i,
798
806
  strokeWidth: 1,
799
807
  stroke: "rgba(198,198,198, 1)",
@@ -806,9 +814,9 @@ let ee = class extends We {
806
814
  _getCenterPositionViewPort(e) {
807
815
  if (!e)
808
816
  return { left: 0, top: 0 };
809
- const { width: r, height: n } = e, t = e.getEngine(), s = (t == null ? void 0 : t.width) || 0, i = (t == null ? void 0 : t.height) || 0;
817
+ const { width: r, height: n } = e, t = e.getEngine(), a = (t == null ? void 0 : t.width) || 0, i = (t == null ? void 0 : t.height) || 0;
810
818
  return {
811
- left: (r - s) / 2,
819
+ left: (r - a) / 2,
812
820
  top: (n - i) / 2
813
821
  };
814
822
  }
@@ -819,23 +827,23 @@ let ee = class extends We {
819
827
  const { engine: t } = n;
820
828
  if (t == null)
821
829
  return;
822
- const { width: s, height: i } = r, { width: o = s, height: c = i } = t, l = t.getCanvas().getContext();
823
- r.renderToThumb(l, e, o / s, c / i);
830
+ const { width: a, height: i } = r, { width: o = a, height: c = i } = t, l = t.getCanvas().getContext();
831
+ r.renderToThumb(l, e, o / a, c / i);
824
832
  }
825
833
  _createSlidePages(e, r) {
826
834
  const n = e.getPages(), t = e.getPageOrder();
827
835
  if (!(!n || !t) && t.length !== 0) {
828
- for (let s = 0, i = t.length; s < i; s++) {
829
- const o = t[s];
836
+ for (let a = 0, i = t.length; a < i; a++) {
837
+ const o = t[a];
830
838
  this._createScene(o, n[o]), this._createThumb(o);
831
839
  }
832
840
  this._activePageId = t[0], r.activeFirstPage();
833
841
  }
834
842
  }
835
843
  createThumbs() {
836
- const r = this._univerInstanceService.getCurrentUnitForType(M.UNIVER_SLIDE).getPageOrder(), n = this._currentRender();
844
+ const r = this._univerInstanceService.getCurrentUnitForType(X.UNIVER_SLIDE).getPageOrder(), n = this._currentRender();
837
845
  if (!(!r || !n) && r.length !== 0)
838
- for (let t = 0, s = r.length; t < s; t++) {
846
+ for (let t = 0, a = r.length; t < a; t++) {
839
847
  const i = r[t];
840
848
  this._thumbSceneRender(i, n.mainComponent);
841
849
  }
@@ -847,24 +855,28 @@ let ee = class extends We {
847
855
  const n = this._currentRender();
848
856
  if (!n || !this._objectProvider)
849
857
  return;
850
- const { scene: t, mainComponent: s } = n, i = s, { width: o, height: c } = i, l = new ie(e, i, {
858
+ const { scene: t, mainComponent: a } = n, i = a, { width: o, height: c } = i, l = new ie(e, i, {
851
859
  width: o,
852
860
  height: c
853
861
  });
854
- new X(`PageViewer_${e}`, l, {
862
+ new N(`PageViewer_${e}`, l, {
855
863
  left: 0,
856
864
  top: 0,
857
865
  bottom: 0,
858
- right: 0
866
+ right: 0,
867
+ isRelativeX: !0,
868
+ isRelativeY: !0
859
869
  }).closeClip();
860
- const { pageElements: p, pageBackgroundFill: d } = r, u = this._objectProvider.convertToRenderObjects(p, t);
861
- if (!u || !i)
870
+ const { pageElements: h, pageBackgroundFill: g } = r, d = this._objectProvider.convertToRenderObjects(h, t);
871
+ if (!d || !i)
862
872
  return;
863
- l.openTransformer(), this._addBackgroundRect(l, d), l.addObjects(u);
864
- const _ = l.getTransformer();
865
- return _ == null || _.onChangeEndObservable.add(() => {
873
+ this._addBackgroundRect(l, g), l.addObjects(d), d.forEach((_) => {
874
+ l.attachTransformerTo(_);
875
+ });
876
+ const p = l.getTransformer();
877
+ return p == null || p.onChangeEndObservable.add(() => {
866
878
  this._thumbSceneRender(this._activePageId, i);
867
- }), _ == null || _.onClearControlObservable.add(() => {
879
+ }), p == null || p.onClearControlObservable.add(() => {
868
880
  this._thumbSceneRender(this._activePageId, i);
869
881
  }), i.addPage(l), l;
870
882
  }
@@ -872,31 +884,29 @@ let ee = class extends We {
872
884
  this._objectProvider = e.createInstance(re);
873
885
  }
874
886
  };
875
- ee = Ct([
876
- Ae(Ue.Ready, ee),
877
- ce(0, Pe),
878
- ce(1, A(se)),
887
+ ee = xt([
888
+ Ae(Ye.Ready, ee),
889
+ ce(0, be),
890
+ ce(1, A(ae)),
879
891
  ce(2, Qe)
880
892
  ], ee);
881
- var Mt = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, Nt = (a, e, r, n) => {
882
- for (var t = n > 1 ? void 0 : n ? Lt(e, r) : e, s = a.length - 1, i; s >= 0; s--)
883
- (i = a[s]) && (t = (n ? i(e, r, t) : i(t)) || t);
884
- return n && t && Mt(e, r, t), t;
885
- }, oe = (a, e) => (r, n) => e(r, n, a);
886
- const zt = {}, Vt = "slides";
893
+ var jt = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, Xt = (s, e, r, n) => {
894
+ for (var t = n > 1 ? void 0 : n ? Mt(e, r) : e, a = s.length - 1, i; a >= 0; a--)
895
+ (i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
896
+ return n && t && jt(e, r, t), t;
897
+ }, oe = (s, e) => (r, n) => e(r, n, s);
898
+ const Lt = {}, Vt = "slides";
887
899
  var Q;
888
- let be = (Q = class extends He {
900
+ let Pe = (Q = class extends $e {
889
901
  constructor(e = {}, r, n, t) {
890
902
  super();
891
- h(this, "_config");
892
- h(this, "_canvasEngine", null);
893
- h(this, "_canvasView", null);
894
- this._univerInstanceService = r, this._localeService = n, this._injector = t, this._config = Object.assign(zt, e), this._initializeDependencies(this._injector);
903
+ u(this, "_config");
904
+ u(this, "_canvasEngine", null);
905
+ u(this, "_canvasView", null);
906
+ this._univerInstanceService = r, this._localeService = n, this._injector = t, this._config = Object.assign(Lt, e), this._initializeDependencies(this._injector);
895
907
  }
896
908
  initialize() {
897
- this._localeService.load({
898
- zhCN: tt
899
- }), this.initCanvasEngine();
909
+ this.initCanvasEngine();
900
910
  }
901
911
  getConfig() {
902
912
  return this._config;
@@ -918,17 +928,14 @@ let be = (Q = class extends He {
918
928
  e.add(n);
919
929
  });
920
930
  }
921
- }, h(Q, "pluginName", Vt), h(Q, "type", M.UNIVER_SLIDE), Q);
922
- be = Nt([
923
- oe(1, Pe),
931
+ }, u(Q, "pluginName", Vt), u(Q, "type", X.UNIVER_SLIDE), Q);
932
+ Pe = Xt([
933
+ oe(1, be),
924
934
  oe(2, A(ne)),
925
- oe(3, A(se))
926
- ], be);
935
+ oe(3, A(ae))
936
+ ], Pe);
927
937
  export {
928
938
  ee as CanvasView,
929
- jt as SLIDE_KEY,
930
- be as UniverSlidesPlugin,
931
- Yt as enUS,
932
- Ft as ruRU,
933
- tt as zhCN
939
+ Ct as SLIDE_KEY,
940
+ Pe as UniverSlidesPlugin
934
941
  };