@univerjs/slides 0.1.10 → 0.1.12

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