leafer-game 1.1.2 → 1.2.1

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.
@@ -1402,9 +1402,21 @@ const Run = {
1402
1402
  };
1403
1403
  const R = Run;
1404
1404
 
1405
- function needPlugin(name) {
1406
- console.error('need plugin: @leafer-in/' + name);
1407
- }
1405
+ const Plugin = {
1406
+ list: {},
1407
+ add(name) {
1408
+ this.list[name] = true;
1409
+ },
1410
+ check(name, tip) {
1411
+ const rs = this.list[name];
1412
+ if (!rs && tip)
1413
+ this.need(name);
1414
+ return rs;
1415
+ },
1416
+ need(name) {
1417
+ console.error('need plugin: @leafer-in/' + name);
1418
+ }
1419
+ };
1408
1420
 
1409
1421
  const debug$f = Debug.get('UICreator');
1410
1422
  const UICreator = {
@@ -5419,7 +5431,7 @@ let Leaf = class Leaf {
5419
5431
  this.__[attrName] = value === undefined ? null : undefined;
5420
5432
  this[attrName] = value;
5421
5433
  }
5422
- forceRender(_bounds) {
5434
+ forceRender(_bounds, _sync) {
5423
5435
  this.forceUpdate('surface');
5424
5436
  }
5425
5437
  __updateWorldMatrix() { }
@@ -5629,10 +5641,10 @@ let Leaf = class Leaf {
5629
5641
  __updatePath() { }
5630
5642
  __updateRenderPath() { }
5631
5643
  getMotionPathData() {
5632
- return needPlugin('path');
5644
+ return Plugin.need('path');
5633
5645
  }
5634
5646
  getMotionPoint(_motionDistance) {
5635
- return needPlugin('path');
5647
+ return Plugin.need('path');
5636
5648
  }
5637
5649
  getMotionTotal() {
5638
5650
  return 0;
@@ -5989,7 +6001,7 @@ class LeafLevelList {
5989
6001
  }
5990
6002
  }
5991
6003
 
5992
- const version = "1.1.1";
6004
+ const version = "1.2.1";
5993
6005
 
5994
6006
  const debug$6 = Debug.get('LeaferCanvas');
5995
6007
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7160,8 +7172,8 @@ const PaintGradient = {};
7160
7172
  const Effect = {};
7161
7173
  const Export = {};
7162
7174
  const State = {
7163
- setStyleName(_leaf, _styleName, _value) { return needPlugin('state'); },
7164
- set(_leaf, _stateName) { return needPlugin('state'); }
7175
+ setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
7176
+ set(_leaf, _stateName) { return Plugin.need('state'); }
7165
7177
  };
7166
7178
  const Transition = {
7167
7179
  list: {},
@@ -7662,7 +7674,7 @@ let UI = UI_1 = class UI extends Leaf {
7662
7674
  drawer.rect(x, y, width, height);
7663
7675
  }
7664
7676
  animate(_keyframe, _options, _type, _isTemp) {
7665
- return needPlugin('animate');
7677
+ return Plugin.need('animate');
7666
7678
  }
7667
7679
  killAnimate(_type) { }
7668
7680
  export(filename, options) {
@@ -8061,10 +8073,13 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8061
8073
  const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
8062
8074
  Object.keys(data).forEach(key => this[key] = data[key]);
8063
8075
  }
8064
- forceRender(bounds) {
8065
- this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
8066
- if (this.viewReady)
8067
- this.renderer.render();
8076
+ forceRender(bounds, sync) {
8077
+ const { renderer } = this;
8078
+ if (renderer) {
8079
+ renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
8080
+ if (this.viewReady)
8081
+ sync ? renderer.render() : renderer.update();
8082
+ }
8068
8083
  }
8069
8084
  requestRender(change = false) {
8070
8085
  if (this.renderer)
@@ -8240,7 +8255,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8240
8255
  this.requestRender();
8241
8256
  }
8242
8257
  zoom(_zoomType, _padding, _fixedScale) {
8243
- return needPlugin('view');
8258
+ return Plugin.need('view');
8244
8259
  }
8245
8260
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
8246
8261
  getValidScale(changeScale) { return changeScale; }
@@ -9053,8 +9068,8 @@ let App = class App extends Leafer {
9053
9068
  super.lockLayout();
9054
9069
  this.children.forEach(leafer => leafer.lockLayout());
9055
9070
  }
9056
- forceRender(bounds) {
9057
- this.children.forEach(leafer => leafer.forceRender(bounds));
9071
+ forceRender(bounds, sync) {
9072
+ this.children.forEach(leafer => leafer.forceRender(bounds, sync));
9058
9073
  }
9059
9074
  addLeafer(merge) {
9060
9075
  const leafer = new Leafer(merge);
@@ -12439,6 +12454,8 @@ Robot = __decorate([
12439
12454
  registerUI()
12440
12455
  ], Robot);
12441
12456
 
12457
+ Plugin.add('robot');
12458
+
12442
12459
  function stateType(defaultValue, styleName) {
12443
12460
  return decorateLeafAttr(defaultValue, (key) => attr({
12444
12461
  set(value) {
@@ -12708,6 +12725,7 @@ function checkState(stateName, leaf, button) {
12708
12725
  return !!find;
12709
12726
  }
12710
12727
 
12728
+ Plugin.add('state');
12711
12729
  State.animateExcludes = {
12712
12730
  animation: 1,
12713
12731
  animationOut: 1,
@@ -13584,6 +13602,7 @@ function hsla(h, s, l, a = 1) {
13584
13602
  return { r: round$1(r * 255), g: round$1(g * 255), b: round$1(b * 255), a };
13585
13603
  }
13586
13604
 
13605
+ Plugin.add('color');
13587
13606
  ColorConvert.object = colorToRGBA;
13588
13607
 
13589
13608
  const { round } = Math;
@@ -13645,6 +13664,8 @@ function shadow(from, to, t) {
13645
13664
  };
13646
13665
  }
13647
13666
 
13667
+ Plugin.add('animate');
13668
+ setTimeout(() => Plugin.check('color', true));
13648
13669
  State.canAnimate = true;
13649
13670
  Object.assign(Transition, TransitionModule);
13650
13671
  Object.assign(Transition.list, TransitionList);
@@ -13917,6 +13938,7 @@ function motionPathType(defaultValue) {
13917
13938
  }));
13918
13939
  }
13919
13940
 
13941
+ Plugin.add('motion-path');
13920
13942
  Transition.register('motion', function (from, to, t, target) {
13921
13943
  if (!from)
13922
13944
  from = 0;
@@ -14018,4 +14040,4 @@ function getMotionPathData(leaf) {
14018
14040
  return data.__pathForMotion = HighCurveHelper.getMotionPathData(leaf.getPath(true, true));
14019
14041
  }
14020
14042
 
14021
- export { AlignHelper, Animate, AnimateEasing, AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Robot, RobotData, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, motionPathType, naturalBoundsType, needPlugin, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$4 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
14043
+ export { AlignHelper, Animate, AnimateEasing, AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Robot, RobotData, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$4 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };