leafer-game 1.1.2 → 1.2.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/dist/web.js CHANGED
@@ -1405,9 +1405,21 @@ var LeaferUI = (function (exports) {
1405
1405
  };
1406
1406
  const R = Run;
1407
1407
 
1408
- function needPlugin(name) {
1409
- console.error('need plugin: @leafer-in/' + name);
1410
- }
1408
+ const Plugin = {
1409
+ list: {},
1410
+ add(name) {
1411
+ this.list[name] = true;
1412
+ },
1413
+ check(name, tip) {
1414
+ const rs = this.list[name];
1415
+ if (!rs && tip)
1416
+ this.need(name);
1417
+ return rs;
1418
+ },
1419
+ need(name) {
1420
+ console.error('need plugin: @leafer-in/' + name);
1421
+ }
1422
+ };
1411
1423
 
1412
1424
  const debug$f = Debug.get('UICreator');
1413
1425
  const UICreator = {
@@ -5632,10 +5644,10 @@ var LeaferUI = (function (exports) {
5632
5644
  __updatePath() { }
5633
5645
  __updateRenderPath() { }
5634
5646
  getMotionPathData() {
5635
- return needPlugin('path');
5647
+ return Plugin.need('path');
5636
5648
  }
5637
5649
  getMotionPoint(_motionDistance) {
5638
- return needPlugin('path');
5650
+ return Plugin.need('path');
5639
5651
  }
5640
5652
  getMotionTotal() {
5641
5653
  return 0;
@@ -5992,7 +6004,7 @@ var LeaferUI = (function (exports) {
5992
6004
  }
5993
6005
  }
5994
6006
 
5995
- const version = "1.1.1";
6007
+ const version = "1.2.0";
5996
6008
 
5997
6009
  const debug$6 = Debug.get('LeaferCanvas');
5998
6010
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7163,8 +7175,8 @@ var LeaferUI = (function (exports) {
7163
7175
  const Effect = {};
7164
7176
  const Export = {};
7165
7177
  const State = {
7166
- setStyleName(_leaf, _styleName, _value) { return needPlugin('state'); },
7167
- set(_leaf, _stateName) { return needPlugin('state'); }
7178
+ setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
7179
+ set(_leaf, _stateName) { return Plugin.need('state'); }
7168
7180
  };
7169
7181
  const Transition = {
7170
7182
  list: {},
@@ -7665,7 +7677,7 @@ var LeaferUI = (function (exports) {
7665
7677
  drawer.rect(x, y, width, height);
7666
7678
  }
7667
7679
  animate(_keyframe, _options, _type, _isTemp) {
7668
- return needPlugin('animate');
7680
+ return Plugin.need('animate');
7669
7681
  }
7670
7682
  killAnimate(_type) { }
7671
7683
  export(filename, options) {
@@ -8243,7 +8255,7 @@ var LeaferUI = (function (exports) {
8243
8255
  this.requestRender();
8244
8256
  }
8245
8257
  zoom(_zoomType, _padding, _fixedScale) {
8246
- return needPlugin('view');
8258
+ return Plugin.need('view');
8247
8259
  }
8248
8260
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
8249
8261
  getValidScale(changeScale) { return changeScale; }
@@ -12442,6 +12454,8 @@ var LeaferUI = (function (exports) {
12442
12454
  registerUI()
12443
12455
  ], exports.Robot);
12444
12456
 
12457
+ Plugin.add('robot');
12458
+
12445
12459
  function stateType(defaultValue, styleName) {
12446
12460
  return decorateLeafAttr(defaultValue, (key) => attr({
12447
12461
  set(value) {
@@ -12711,6 +12725,7 @@ var LeaferUI = (function (exports) {
12711
12725
  return !!find;
12712
12726
  }
12713
12727
 
12728
+ Plugin.add('state');
12714
12729
  State.animateExcludes = {
12715
12730
  animation: 1,
12716
12731
  animationOut: 1,
@@ -13587,6 +13602,7 @@ var LeaferUI = (function (exports) {
13587
13602
  return { r: round$1(r * 255), g: round$1(g * 255), b: round$1(b * 255), a };
13588
13603
  }
13589
13604
 
13605
+ Plugin.add('color');
13590
13606
  ColorConvert.object = colorToRGBA;
13591
13607
 
13592
13608
  const { round } = Math;
@@ -13648,6 +13664,8 @@ var LeaferUI = (function (exports) {
13648
13664
  };
13649
13665
  }
13650
13666
 
13667
+ Plugin.add('animate');
13668
+ setTimeout(() => Plugin.check('color', true));
13651
13669
  State.canAnimate = true;
13652
13670
  Object.assign(Transition, TransitionModule);
13653
13671
  Object.assign(Transition.list, TransitionList);
@@ -13920,6 +13938,7 @@ var LeaferUI = (function (exports) {
13920
13938
  }));
13921
13939
  }
13922
13940
 
13941
+ Plugin.add('motion-path');
13923
13942
  Transition.register('motion', function (from, to, t, target) {
13924
13943
  if (!from)
13925
13944
  from = 0;
@@ -14108,6 +14127,7 @@ var LeaferUI = (function (exports) {
14108
14127
  exports.PathNumberCommandMap = PathNumberCommandMap;
14109
14128
  exports.PenData = PenData;
14110
14129
  exports.Platform = Platform;
14130
+ exports.Plugin = Plugin;
14111
14131
  exports.Point = Point;
14112
14132
  exports.PointHelper = PointHelper;
14113
14133
  exports.PointerButton = PointerButton;
@@ -14169,7 +14189,6 @@ var LeaferUI = (function (exports) {
14169
14189
  exports.maskType = maskType;
14170
14190
  exports.motionPathType = motionPathType;
14171
14191
  exports.naturalBoundsType = naturalBoundsType;
14172
- exports.needPlugin = needPlugin;
14173
14192
  exports.opacityType = opacityType;
14174
14193
  exports.pathInputType = pathInputType;
14175
14194
  exports.pathType = pathType;