@leafer/core 1.3.2 → 1.4.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/core.cjs CHANGED
@@ -1535,10 +1535,10 @@ const DataHelper = {
1535
1535
  Object.keys(merge).forEach(key => {
1536
1536
  var _a, _b;
1537
1537
  value = merge[key];
1538
- if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
1538
+ if ((value === null || value === undefined ? undefined : value.constructor) === Object && ((_a = t[key]) === null || _a === undefined ? undefined : _a.constructor) === Object)
1539
1539
  return assign(t[key], merge[key], exclude && exclude[key]);
1540
1540
  if (exclude && (key in exclude)) {
1541
- if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
1541
+ if (((_b = exclude[key]) === null || _b === undefined ? undefined : _b.constructor) === Object)
1542
1542
  assign(t[key] = {}, merge[key], exclude[key]);
1543
1543
  return;
1544
1544
  }
@@ -1707,7 +1707,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1707
1707
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1708
1708
  PERFORMANCE OF THIS SOFTWARE.
1709
1709
  ***************************************************************************** */
1710
- /* global Reflect, Promise, SuppressedError, Symbol */
1710
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1711
1711
 
1712
1712
 
1713
1713
  function __decorate(decorators, target, key, desc) {
@@ -1775,7 +1775,7 @@ class Canvas {
1775
1775
  }
1776
1776
  setTransform(_a, _b, _c, _d, _e, _f) { }
1777
1777
  resetTransform() { }
1778
- getTransform() { return void 0; }
1778
+ getTransform() { return undefined; }
1779
1779
  save() { }
1780
1780
  restore() { }
1781
1781
  transform(a, b, c, d, e, f) {
@@ -1832,12 +1832,12 @@ class Canvas {
1832
1832
  ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { }
1833
1833
  rect(_x, _y, _width, _height) { }
1834
1834
  roundRect(_x, _y, _width, _height, _radius) { }
1835
- createConicGradient(_startAngle, _x, _y) { return void 0; }
1836
- createLinearGradient(_x0, _y0, _x1, _y1) { return void 0; }
1837
- createPattern(_image, _repetition) { return void 0; }
1838
- createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return void 0; }
1835
+ createConicGradient(_startAngle, _x, _y) { return undefined; }
1836
+ createLinearGradient(_x0, _y0, _x1, _y1) { return undefined; }
1837
+ createPattern(_image, _repetition) { return undefined; }
1838
+ createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return undefined; }
1839
1839
  fillText(_text, _x, _y, _maxWidth) { }
1840
- measureText(_text) { return void 0; }
1840
+ measureText(_text) { return undefined; }
1841
1841
  strokeText(_text, _x, _y, _maxWidth) { }
1842
1842
  destroy() {
1843
1843
  this.context = null;
@@ -1845,79 +1845,79 @@ class Canvas {
1845
1845
  }
1846
1846
  __decorate([
1847
1847
  contextAttr('imageSmoothingEnabled')
1848
- ], Canvas.prototype, "smooth", void 0);
1848
+ ], Canvas.prototype, "smooth", undefined);
1849
1849
  __decorate([
1850
1850
  contextAttr('imageSmoothingQuality')
1851
- ], Canvas.prototype, "smoothLevel", void 0);
1851
+ ], Canvas.prototype, "smoothLevel", undefined);
1852
1852
  __decorate([
1853
1853
  contextAttr('globalAlpha')
1854
- ], Canvas.prototype, "opacity", void 0);
1854
+ ], Canvas.prototype, "opacity", undefined);
1855
1855
  __decorate([
1856
1856
  contextAttr()
1857
- ], Canvas.prototype, "fillStyle", void 0);
1857
+ ], Canvas.prototype, "fillStyle", undefined);
1858
1858
  __decorate([
1859
1859
  contextAttr()
1860
- ], Canvas.prototype, "strokeStyle", void 0);
1860
+ ], Canvas.prototype, "strokeStyle", undefined);
1861
1861
  __decorate([
1862
1862
  contextAttr('lineWidth')
1863
- ], Canvas.prototype, "strokeWidth", void 0);
1863
+ ], Canvas.prototype, "strokeWidth", undefined);
1864
1864
  __decorate([
1865
1865
  contextAttr('lineCap')
1866
- ], Canvas.prototype, "strokeCap", void 0);
1866
+ ], Canvas.prototype, "strokeCap", undefined);
1867
1867
  __decorate([
1868
1868
  contextAttr('lineJoin')
1869
- ], Canvas.prototype, "strokeJoin", void 0);
1869
+ ], Canvas.prototype, "strokeJoin", undefined);
1870
1870
  __decorate([
1871
1871
  contextAttr('lineDashOffset')
1872
- ], Canvas.prototype, "dashOffset", void 0);
1872
+ ], Canvas.prototype, "dashOffset", undefined);
1873
1873
  __decorate([
1874
1874
  contextAttr()
1875
- ], Canvas.prototype, "miterLimit", void 0);
1875
+ ], Canvas.prototype, "miterLimit", undefined);
1876
1876
  __decorate([
1877
1877
  contextAttr()
1878
- ], Canvas.prototype, "shadowBlur", void 0);
1878
+ ], Canvas.prototype, "shadowBlur", undefined);
1879
1879
  __decorate([
1880
1880
  contextAttr()
1881
- ], Canvas.prototype, "shadowColor", void 0);
1881
+ ], Canvas.prototype, "shadowColor", undefined);
1882
1882
  __decorate([
1883
1883
  contextAttr()
1884
- ], Canvas.prototype, "shadowOffsetX", void 0);
1884
+ ], Canvas.prototype, "shadowOffsetX", undefined);
1885
1885
  __decorate([
1886
1886
  contextAttr()
1887
- ], Canvas.prototype, "shadowOffsetY", void 0);
1887
+ ], Canvas.prototype, "shadowOffsetY", undefined);
1888
1888
  __decorate([
1889
1889
  contextAttr()
1890
- ], Canvas.prototype, "filter", void 0);
1890
+ ], Canvas.prototype, "filter", undefined);
1891
1891
  __decorate([
1892
1892
  contextAttr()
1893
- ], Canvas.prototype, "font", void 0);
1893
+ ], Canvas.prototype, "font", undefined);
1894
1894
  __decorate([
1895
1895
  contextAttr()
1896
- ], Canvas.prototype, "fontKerning", void 0);
1896
+ ], Canvas.prototype, "fontKerning", undefined);
1897
1897
  __decorate([
1898
1898
  contextAttr()
1899
- ], Canvas.prototype, "fontStretch", void 0);
1899
+ ], Canvas.prototype, "fontStretch", undefined);
1900
1900
  __decorate([
1901
1901
  contextAttr()
1902
- ], Canvas.prototype, "fontVariantCaps", void 0);
1902
+ ], Canvas.prototype, "fontVariantCaps", undefined);
1903
1903
  __decorate([
1904
1904
  contextAttr()
1905
- ], Canvas.prototype, "textAlign", void 0);
1905
+ ], Canvas.prototype, "textAlign", undefined);
1906
1906
  __decorate([
1907
1907
  contextAttr()
1908
- ], Canvas.prototype, "textBaseline", void 0);
1908
+ ], Canvas.prototype, "textBaseline", undefined);
1909
1909
  __decorate([
1910
1910
  contextAttr()
1911
- ], Canvas.prototype, "textRendering", void 0);
1911
+ ], Canvas.prototype, "textRendering", undefined);
1912
1912
  __decorate([
1913
1913
  contextAttr()
1914
- ], Canvas.prototype, "wordSpacing", void 0);
1914
+ ], Canvas.prototype, "wordSpacing", undefined);
1915
1915
  __decorate([
1916
1916
  contextAttr()
1917
- ], Canvas.prototype, "letterSpacing", void 0);
1917
+ ], Canvas.prototype, "letterSpacing", undefined);
1918
1918
  __decorate([
1919
1919
  contextAttr()
1920
- ], Canvas.prototype, "direction", void 0);
1920
+ ], Canvas.prototype, "direction", undefined);
1921
1921
  __decorate([
1922
1922
  contextMethod()
1923
1923
  ], Canvas.prototype, "setTransform", null);
@@ -3386,7 +3386,7 @@ class TaskItem {
3386
3386
  this.task = task;
3387
3387
  }
3388
3388
  run() {
3389
- return __awaiter(this, void 0, void 0, function* () {
3389
+ return __awaiter(this, undefined, undefined, function* () {
3390
3390
  try {
3391
3391
  if (this.task && !this.isComplete && this.parent.running)
3392
3392
  yield this.task();
@@ -3698,7 +3698,7 @@ class LeaferImage {
3698
3698
  load(onSuccess, onError) {
3699
3699
  if (!this.loading) {
3700
3700
  this.loading = true;
3701
- ImageManager.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
3701
+ ImageManager.tasker.add(() => __awaiter(this, undefined, undefined, function* () {
3702
3702
  return yield Platform.origin.loadImage(this.url).then((img) => {
3703
3703
  this.ready = true;
3704
3704
  this.width = img.naturalWidth || img.width;
@@ -3823,10 +3823,10 @@ function autoLayoutType(defaultValue) {
3823
3823
  return decorateLeafAttr(defaultValue, (key) => attr({
3824
3824
  set(value) {
3825
3825
  if (this.__setAttr(key, value)) {
3826
- this.__layout.matrixChanged || this.__layout.matrixChange();
3827
3826
  this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
3828
3827
  if (!this.__local)
3829
3828
  this.__layout.createLocal();
3829
+ doBoundsType(this);
3830
3830
  }
3831
3831
  }
3832
3832
  }));
@@ -4209,55 +4209,62 @@ const LeafHelper = {
4209
4209
  y += t.y;
4210
4210
  transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
4211
4211
  },
4212
- zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4213
- L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
4212
+ zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
4213
+ L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
4214
4214
  },
4215
- zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
4216
- copy$3(matrix, t.__localMatrix);
4215
+ zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
4216
+ const o = t.__localMatrix;
4217
+ if (typeof scaleY !== 'number') {
4218
+ if (scaleY)
4219
+ transition = scaleY;
4220
+ scaleY = scaleX;
4221
+ }
4222
+ copy$3(matrix, o);
4217
4223
  scaleOfOuter(matrix, origin, scaleX, scaleY);
4218
4224
  if (t.origin || t.around) {
4219
- L.setTransform(t, matrix, resize);
4225
+ L.setTransform(t, matrix, resize, transition);
4220
4226
  }
4221
4227
  else {
4222
- moveByMatrix(t, matrix);
4223
- t.scaleResize(scaleX, scaleY, resize !== true);
4228
+ const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
4229
+ if (transition && !resize)
4230
+ t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
4231
+ else
4232
+ t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
4224
4233
  }
4225
4234
  },
4226
- rotateOfWorld(t, origin, angle) {
4227
- L.rotateOfLocal(t, getTempLocal(t, origin), angle);
4235
+ rotateOfWorld(t, origin, angle, transition) {
4236
+ L.rotateOfLocal(t, getTempLocal(t, origin), angle, transition);
4228
4237
  },
4229
- rotateOfLocal(t, origin, angle) {
4230
- copy$3(matrix, t.__localMatrix);
4238
+ rotateOfLocal(t, origin, angle, transition) {
4239
+ const o = t.__localMatrix;
4240
+ copy$3(matrix, o);
4231
4241
  rotateOfOuter(matrix, origin, angle);
4232
- if (t.origin || t.around) {
4233
- L.setTransform(t, matrix);
4234
- }
4235
- else {
4236
- moveByMatrix(t, matrix);
4237
- t.rotation = MathHelper.formatRotation(t.rotation + angle);
4238
- }
4242
+ if (t.origin || t.around)
4243
+ L.setTransform(t, matrix, false, transition);
4244
+ else
4245
+ t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
4239
4246
  },
4240
- skewOfWorld(t, origin, skewX, skewY, resize) {
4241
- L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
4247
+ skewOfWorld(t, origin, skewX, skewY, resize, transition) {
4248
+ L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4242
4249
  },
4243
- skewOfLocal(t, origin, skewX, skewY = 0, resize) {
4250
+ skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4244
4251
  copy$3(matrix, t.__localMatrix);
4245
4252
  skewOfOuter(matrix, origin, skewX, skewY);
4246
- L.setTransform(t, matrix, resize);
4253
+ L.setTransform(t, matrix, resize, transition);
4247
4254
  },
4248
- transformWorld(t, transform, resize) {
4255
+ transformWorld(t, transform, resize, transition) {
4249
4256
  copy$3(matrix, t.worldTransform);
4250
4257
  multiplyParent$2(matrix, transform);
4251
4258
  if (t.parent)
4252
4259
  divideParent(matrix, t.parent.worldTransform);
4253
- L.setTransform(t, matrix, resize);
4260
+ L.setTransform(t, matrix, resize, transition);
4254
4261
  },
4255
- transform(t, transform, resize) {
4262
+ transform(t, transform, resize, transition) {
4256
4263
  copy$3(matrix, t.localTransform);
4257
4264
  multiplyParent$2(matrix, transform);
4258
- L.setTransform(t, matrix, resize);
4265
+ L.setTransform(t, matrix, resize, transition);
4259
4266
  },
4260
- setTransform(t, transform, resize) {
4267
+ setTransform(t, transform, resize, transition) {
4261
4268
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
4262
4269
  const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
4263
4270
  if (resize) {
@@ -4272,7 +4279,7 @@ const LeafHelper = {
4272
4279
  t.scaleResize(scaleX, scaleY, false);
4273
4280
  }
4274
4281
  else
4275
- t.set(layout);
4282
+ t.set(layout, transition);
4276
4283
  },
4277
4284
  getFlipTransform(t, axis) {
4278
4285
  const m = getMatrixData();
@@ -4309,11 +4316,6 @@ const LeafHelper = {
4309
4316
  };
4310
4317
  const L = LeafHelper;
4311
4318
  const { updateAllMatrix: updateAllMatrix$1, updateMatrix: updateMatrix$1, updateAllWorldOpacity, updateAllChange } = L;
4312
- function moveByMatrix(t, matrix) {
4313
- const { e, f } = t.__localMatrix;
4314
- t.x += matrix.e - e;
4315
- t.y += matrix.f - f;
4316
- }
4317
4319
  function getTempLocal(t, world) {
4318
4320
  t.__layout.update();
4319
4321
  return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
@@ -5177,8 +5179,7 @@ const LeafBounds = {
5177
5179
  __updateAutoLayout() {
5178
5180
  this.__layout.matrixChanged = true;
5179
5181
  if (this.isBranch) {
5180
- if (this.leaferIsReady)
5181
- this.leafer.layouter.addExtra(this);
5182
+ this.__extraUpdate();
5182
5183
  if (this.__.flow) {
5183
5184
  if (this.__layout.boxChanged)
5184
5185
  this.__updateFlowLayout();
@@ -5331,7 +5332,7 @@ exports.Leaf = class Leaf {
5331
5332
  get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
5332
5333
  get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
5333
5334
  get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
5334
- get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
5335
+ get __inLazyBounds() { return this.leaferIsCreated && this.leafer.lazyBounds.hit(this.__world); }
5335
5336
  get pathInputed() { return this.__.__pathInputed; }
5336
5337
  set event(map) { this.on(map); }
5337
5338
  constructor(data) {
@@ -5442,6 +5443,10 @@ exports.Leaf = class Leaf {
5442
5443
  forceRender(_bounds, _sync) {
5443
5444
  this.forceUpdate('surface');
5444
5445
  }
5446
+ __extraUpdate() {
5447
+ if (this.leaferIsReady)
5448
+ this.leafer.layouter.addExtra(this);
5449
+ }
5445
5450
  __updateWorldMatrix() { }
5446
5451
  __updateLocalMatrix() { }
5447
5452
  __updateWorldBounds() { }
@@ -5584,11 +5589,11 @@ exports.Leaf = class Leaf {
5584
5589
  const layer = this.leafer ? this.leafer.zoomLayer : this;
5585
5590
  return layer.getWorldPoint(page, relative, distance, change);
5586
5591
  }
5587
- setTransform(matrix, resize) {
5588
- setTransform(this, matrix, resize);
5592
+ setTransform(matrix, resize, transition) {
5593
+ setTransform(this, matrix, resize, transition);
5589
5594
  }
5590
- transform(matrix, resize) {
5591
- transform(this, matrix, resize);
5595
+ transform(matrix, resize, transition) {
5596
+ transform(this, matrix, resize, transition);
5592
5597
  }
5593
5598
  move(x, y, transition) {
5594
5599
  moveLocal(this, x, y, transition);
@@ -5596,32 +5601,32 @@ exports.Leaf = class Leaf {
5596
5601
  moveInner(x, y, transition) {
5597
5602
  moveWorld(this, x, y, true, transition);
5598
5603
  }
5599
- scaleOf(origin, scaleX, scaleY, resize) {
5600
- zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
5604
+ scaleOf(origin, scaleX, scaleY, resize, transition) {
5605
+ zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
5601
5606
  }
5602
- rotateOf(origin, rotation) {
5603
- rotateOfLocal(this, getLocalOrigin(this, origin), rotation);
5607
+ rotateOf(origin, rotation, transition) {
5608
+ rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
5604
5609
  }
5605
- skewOf(origin, skewX, skewY, resize) {
5606
- skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize);
5610
+ skewOf(origin, skewX, skewY, resize, transition) {
5611
+ skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
5607
5612
  }
5608
- transformWorld(worldTransform, resize) {
5609
- transformWorld(this, worldTransform, resize);
5613
+ transformWorld(worldTransform, resize, transition) {
5614
+ transformWorld(this, worldTransform, resize, transition);
5610
5615
  }
5611
5616
  moveWorld(x, y, transition) {
5612
5617
  moveWorld(this, x, y, false, transition);
5613
5618
  }
5614
- scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5615
- zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
5619
+ scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
5620
+ zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
5616
5621
  }
5617
5622
  rotateOfWorld(worldOrigin, rotation) {
5618
5623
  rotateOfWorld(this, worldOrigin, rotation);
5619
5624
  }
5620
- skewOfWorld(worldOrigin, skewX, skewY, resize) {
5621
- skewOfWorld(this, worldOrigin, skewX, skewY, resize);
5625
+ skewOfWorld(worldOrigin, skewX, skewY, resize, transition) {
5626
+ skewOfWorld(this, worldOrigin, skewX, skewY, resize, transition);
5622
5627
  }
5623
- flip(axis) {
5624
- transform(this, getFlipTransform(this, axis));
5628
+ flip(axis, transition) {
5629
+ transform(this, getFlipTransform(this, axis), false, transition);
5625
5630
  }
5626
5631
  scaleResize(scaleX, scaleY = scaleX, _noResize) {
5627
5632
  this.scaleX *= scaleX;
@@ -6009,7 +6014,7 @@ class LeafLevelList {
6009
6014
  }
6010
6015
  }
6011
6016
 
6012
- const version = "1.3.2";
6017
+ const version = "1.4.0";
6013
6018
 
6014
6019
  exports.AlignHelper = AlignHelper;
6015
6020
  exports.AroundHelper = AroundHelper;
@@ -6127,3 +6132,4 @@ exports.tempPoint = tempPoint$2;
6127
6132
  exports.useModule = useModule;
6128
6133
  exports.version = version;
6129
6134
  exports.visibleType = visibleType;
6135
+ //# sourceMappingURL=core.cjs.map