@leafer-game/miniapp 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$e = 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
  class LeaferCanvas extends LeaferCanvasBase {
5995
6007
  get allowBackgroundColor() { return false; }
@@ -7127,8 +7139,8 @@ const PaintGradient = {};
7127
7139
  const Effect = {};
7128
7140
  const Export = {};
7129
7141
  const State = {
7130
- setStyleName(_leaf, _styleName, _value) { return needPlugin('state'); },
7131
- set(_leaf, _stateName) { return needPlugin('state'); }
7142
+ setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
7143
+ set(_leaf, _stateName) { return Plugin.need('state'); }
7132
7144
  };
7133
7145
  const Transition = {
7134
7146
  list: {},
@@ -7629,7 +7641,7 @@ let UI = UI_1 = class UI extends Leaf {
7629
7641
  drawer.rect(x, y, width, height);
7630
7642
  }
7631
7643
  animate(_keyframe, _options, _type, _isTemp) {
7632
- return needPlugin('animate');
7644
+ return Plugin.need('animate');
7633
7645
  }
7634
7646
  killAnimate(_type) { }
7635
7647
  export(filename, options) {
@@ -8028,10 +8040,13 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8028
8040
  const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
8029
8041
  Object.keys(data).forEach(key => this[key] = data[key]);
8030
8042
  }
8031
- forceRender(bounds) {
8032
- this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
8033
- if (this.viewReady)
8034
- this.renderer.render();
8043
+ forceRender(bounds, sync) {
8044
+ const { renderer } = this;
8045
+ if (renderer) {
8046
+ renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
8047
+ if (this.viewReady)
8048
+ sync ? renderer.render() : renderer.update();
8049
+ }
8035
8050
  }
8036
8051
  requestRender(change = false) {
8037
8052
  if (this.renderer)
@@ -8207,7 +8222,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8207
8222
  this.requestRender();
8208
8223
  }
8209
8224
  zoom(_zoomType, _padding, _fixedScale) {
8210
- return needPlugin('view');
8225
+ return Plugin.need('view');
8211
8226
  }
8212
8227
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
8213
8228
  getValidScale(changeScale) { return changeScale; }
@@ -9020,8 +9035,8 @@ let App = class App extends Leafer {
9020
9035
  super.lockLayout();
9021
9036
  this.children.forEach(leafer => leafer.lockLayout());
9022
9037
  }
9023
- forceRender(bounds) {
9024
- this.children.forEach(leafer => leafer.forceRender(bounds));
9038
+ forceRender(bounds, sync) {
9039
+ this.children.forEach(leafer => leafer.forceRender(bounds, sync));
9025
9040
  }
9026
9041
  addLeafer(merge) {
9027
9042
  const leafer = new Leafer(merge);
@@ -12214,6 +12229,8 @@ Robot = __decorate([
12214
12229
  registerUI()
12215
12230
  ], Robot);
12216
12231
 
12232
+ Plugin.add('robot');
12233
+
12217
12234
  function stateType(defaultValue, styleName) {
12218
12235
  return decorateLeafAttr(defaultValue, (key) => attr({
12219
12236
  set(value) {
@@ -12483,6 +12500,7 @@ function checkState(stateName, leaf, button) {
12483
12500
  return !!find;
12484
12501
  }
12485
12502
 
12503
+ Plugin.add('state');
12486
12504
  State.animateExcludes = {
12487
12505
  animation: 1,
12488
12506
  animationOut: 1,
@@ -13359,6 +13377,7 @@ function hsla(h, s, l, a = 1) {
13359
13377
  return { r: round$1(r * 255), g: round$1(g * 255), b: round$1(b * 255), a };
13360
13378
  }
13361
13379
 
13380
+ Plugin.add('color');
13362
13381
  ColorConvert.object = colorToRGBA;
13363
13382
 
13364
13383
  const { round } = Math;
@@ -13420,6 +13439,8 @@ function shadow(from, to, t) {
13420
13439
  };
13421
13440
  }
13422
13441
 
13442
+ Plugin.add('animate');
13443
+ setTimeout(() => Plugin.check('color', true));
13423
13444
  State.canAnimate = true;
13424
13445
  Object.assign(Transition, TransitionModule);
13425
13446
  Object.assign(Transition.list, TransitionList);
@@ -13692,6 +13713,7 @@ function motionPathType(defaultValue) {
13692
13713
  }));
13693
13714
  }
13694
13715
 
13716
+ Plugin.add('motion-path');
13695
13717
  Transition.register('motion', function (from, to, t, target) {
13696
13718
  if (!from)
13697
13719
  from = 0;
@@ -13817,4 +13839,4 @@ if (platform === 'ios') {
13817
13839
  };
13818
13840
  }
13819
13841
 
13820
- 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, 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 };
13842
+ 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, 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 };