@leafer-ui/node 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.cjs CHANGED
@@ -84,8 +84,8 @@ function useCanvas(canvasType, power) {
84
84
  core.Platform.origin = {
85
85
  createCanvas: (width, height, format) => new Canvas(width, height, format),
86
86
  canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(mineType(type), quality),
87
- canvasToBolb: (canvas, type, quality) => __awaiter(this, undefined, undefined, function* () { return canvas.toBuffer(mineType(type), quality); }),
88
- canvasSaveAs: (canvas, filename, quality) => __awaiter(this, undefined, undefined, function* () { return fs.writeFileSync(filename, canvas.toBuffer(mineType(fileType(filename)), quality)); }),
87
+ canvasToBolb: (canvas, type, quality) => __awaiter(this, void 0, void 0, function* () { return canvas.toBuffer(mineType(type), quality); }),
88
+ canvasSaveAs: (canvas, filename, quality) => __awaiter(this, void 0, void 0, function* () { return fs.writeFileSync(filename, canvas.toBuffer(mineType(fileType(filename)), quality)); }),
89
89
  download(_url, _filename) { return undefined; },
90
90
  loadImage(src) { return loadImage(core.Platform.image.getRealURL(src)); }
91
91
  };
@@ -360,7 +360,7 @@ class Layouter {
360
360
  }
361
361
  partLayout() {
362
362
  var _a;
363
- if (!((_a = this.__updatedList) === null || _a === undefined ? undefined : _a.length))
363
+ if (!((_a = this.__updatedList) === null || _a === void 0 ? void 0 : _a.length))
364
364
  return;
365
365
  const t = core.Run.start('PartLayout');
366
366
  const { target, __updatedList: updateList } = this;
@@ -825,9 +825,10 @@ class Selector {
825
825
  this.finder = core.Creator.finder && core.Creator.finder();
826
826
  }
827
827
  getByPoint(hitPoint, hitRadius, options) {
828
- if (core.Platform.backgrounder && this.target)
829
- this.target.updateLayout();
830
- return this.picker.getByPoint(hitPoint, hitRadius, options);
828
+ const { target, picker } = this;
829
+ if (core.Platform.backgrounder)
830
+ target && target.updateLayout();
831
+ return picker.getByPoint(hitPoint, hitRadius, options);
831
832
  }
832
833
  getBy(condition, branch, one, options) {
833
834
  return this.finder ? this.finder.getBy(condition, branch, one, options) : core.Plugin.need('find');
@@ -1206,7 +1207,7 @@ function getPatternData(paint, box, image) {
1206
1207
  box = tempBox.set(box).shrink(paint.padding);
1207
1208
  if (paint.mode === 'strench')
1208
1209
  paint.mode = 'stretch';
1209
- const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
1210
+ const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1210
1211
  const sameBox = box.width === width && box.height === height;
1211
1212
  const data = { mode };
1212
1213
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1269,6 +1270,8 @@ function getPatternData(paint, box, image) {
1269
1270
  data.height = height;
1270
1271
  if (opacity)
1271
1272
  data.opacity = opacity;
1273
+ if (filters)
1274
+ data.filters = filters;
1272
1275
  if (repeat)
1273
1276
  data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
1274
1277
  return data;
@@ -1371,7 +1374,7 @@ function createPattern(ui, paint, pixelRatio) {
1371
1374
  scaleX = abs$1(scaleX);
1372
1375
  scaleY = abs$1(scaleY);
1373
1376
  const { image, data } = paint;
1374
- let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
1377
+ let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1375
1378
  if (sx) {
1376
1379
  imageMatrix = get$1();
1377
1380
  copy$1(imageMatrix, transform);
@@ -1414,7 +1417,7 @@ function createPattern(ui, paint, pixelRatio) {
1414
1417
  }
1415
1418
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
1416
1419
  }
1417
- const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
1420
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, data.opacity, data.filters);
1418
1421
  const pattern = image.getPattern(canvas, repeat || (core.Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
1419
1422
  paint.style = pattern;
1420
1423
  paint.patternId = id;
@@ -1458,7 +1461,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1458
1461
  canvas.opacity *= data.opacity;
1459
1462
  if (data.transform)
1460
1463
  canvas.transform(data.transform);
1461
- canvas.drawImage(paint.image.view, 0, 0, data.width, data.height);
1464
+ canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
1462
1465
  canvas.restore();
1463
1466
  return true;
1464
1467
  }
@@ -1468,7 +1471,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
1468
1471
  }
1469
1472
  else {
1470
1473
  if (!paint.patternTask) {
1471
- paint.patternTask = core.ImageManager.patternTasker.add(() => __awaiter(this, undefined, undefined, function* () {
1474
+ paint.patternTask = core.ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
1472
1475
  paint.patternTask = null;
1473
1476
  if (canvas.bounds.hit(ui.__nowWorld))
1474
1477
  createPattern(ui, paint, pixelRatio);
@@ -2376,7 +2379,7 @@ const ExportModule = {
2376
2379
  const { leafer } = leaf;
2377
2380
  if (leafer) {
2378
2381
  checkLazy(leaf);
2379
- leafer.waitViewCompleted(() => __awaiter(this, undefined, undefined, function* () {
2382
+ leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
2380
2383
  let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
2381
2384
  const { worldTransform, isLeafer, isFrame } = leaf;
2382
2385
  const { slice, trim, padding, onCanvas } = options;
@@ -2478,7 +2481,7 @@ function addTask(task) {
2478
2481
  if (!tasker)
2479
2482
  tasker = new draw.TaskProcessor();
2480
2483
  return new Promise((resolve) => {
2481
- tasker.add(() => __awaiter(this, undefined, undefined, function* () { return yield task(resolve); }), { parallel: false });
2484
+ tasker.add(() => __awaiter(this, void 0, void 0, function* () { return yield task(resolve); }), { parallel: false });
2482
2485
  });
2483
2486
  }
2484
2487
  function checkLazy(leaf) {