zimjs 17.2.7 → 17.2.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "17.2.7",
3
+ "version": "17.2.9",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -747,11 +747,12 @@ EXAMPLE
747
747
  const array = ["happy", "sad", "spooked"];
748
748
  const randomFromArray = shuffle(array)[0];
749
749
  // this will be randomized each time it is run
750
+ // or use ZIM pluck()
750
751
  END EXAMPLE
751
752
 
752
753
  EXAMPLE
753
754
  const array = shuffle(["happy", "sad", "spooked"]);
754
- for (let i=0; i<array.length, i++) zog(array[i]);
755
+ loop(array, feeling=>{zog(feeling);});
755
756
  // this will get random and unique elements of the array
756
757
  END EXAMPLE
757
758
 
@@ -1652,7 +1653,7 @@ call - the function to call
1652
1653
  if the obj is an object literal then the first and second parameters are the property name and property value at the current index
1653
1654
  if the obj is an string then the first parameter is the letter
1654
1655
  if the obj is an HTMLCollection then the first parameter is the tag
1655
- if the obj is a Container then the first paramter is the child
1656
+ if the obj is a Container then the first parameter is the child
1656
1657
  reverse - (default false) set to true to run the loop backwards to 0
1657
1658
  interval - (default 0) set to a number of seconds between each loop
1658
1659
  use return NEXT to go immediately to the next interval
@@ -1721,13 +1722,13 @@ RETURNS any value returned from the loop - or true if no value is returned from
1721
1722
  i = start-i;
1722
1723
 
1723
1724
  if (type=="number") {
1724
- r = call(i, total, start, end, obj);
1725
+ r = call(i, total, start, end, obj, io);
1725
1726
  } else if (type=="array" || type=="string") {
1726
- r = call(obj[i], i, total, start, end, obj);
1727
+ r = call(obj[i], i, total, start, end, obj, io);
1727
1728
  } else if (type=="Dictionary") {
1728
- r = call(obj[i], vals[i], i, total, start, end, obj);
1729
+ r = call(obj[i], vals[i], i, total, start, end, obj, io);
1729
1730
  } else { // nodelist
1730
- r = call(obj.item(i), i, total, start, end, obj);
1731
+ r = call(obj.item(i), i, total, start, end, obj, io);
1731
1732
  }
1732
1733
 
1733
1734
  if (r == 'next') io.next();
@@ -1762,7 +1763,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
1762
1763
  } else if (type=="array" || type=="string") {
1763
1764
  r = call(obj[i], i, total, start, end, obj, io);
1764
1765
  } else if (type=="Dictionary") {
1765
- r = call(obj[i], vals[i], i, total, start, end, obj);
1766
+ r = call(obj[i], vals[i], i, total, start, end, obj, io);
1766
1767
  } else { // nodelist or htmlcollection
1767
1768
  r = call(obj.item(i), i, total, start, end, obj, io);
1768
1769
  }
@@ -1799,7 +1800,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
1799
1800
  if (step) i *= step;
1800
1801
  i = start-i;
1801
1802
 
1802
- r = call(props[i], obj[props[i]], i, total, start, end, obj);
1803
+ r = call(props[i], obj[props[i]], i, total, start, end, obj, io);
1803
1804
 
1804
1805
  if (r == 'next') io.next();
1805
1806
  else if (typeof r != 'undefined') {
@@ -1820,7 +1821,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
1820
1821
  if (!immediate) i--;
1821
1822
  if (step != 1) i = -start + i*step;
1822
1823
 
1823
- r = call(props[i], obj[props[i]], i, total, start, end, obj);
1824
+ r = call(props[i], obj[props[i]], i, total, start, end, obj, io);
1824
1825
 
1825
1826
  if (r == 'next') io.next();
1826
1827
  else if (typeof r != 'undefined') {
@@ -2104,7 +2105,7 @@ pauseTimeLeft - if paused, get how much time is left once unpaused
2104
2105
  setTimeout(function() {
2105
2106
  (call)(obj);
2106
2107
  checkTotal();
2107
- }, 10);
2108
+ }, 5);
2108
2109
  }
2109
2110
  function checkTotal() {
2110
2111
  if (total == -1) return;
@@ -5433,7 +5434,7 @@ speed = 0;
5433
5434
  zog(sign(speed)); // 0
5434
5435
 
5435
5436
  speed = -20;
5436
- zog(sSign(speed)); // -1
5437
+ zog(sign(speed)); // -1
5437
5438
  END EXAMPLE
5438
5439
 
5439
5440
  PARAMETERS
@@ -8878,18 +8879,20 @@ Might have set these on CreateJS DisplayObject
8878
8879
  });
8879
8880
 
8880
8881
  var frame;
8881
- var adCheck;
8882
+ var addCheck;
8882
8883
  that.on("mousedown", function (e) {
8883
- if (e.target.stage) {
8884
- frame = e.target.stage.frame;
8885
- if (frame.allowDefault) {
8886
- adCheck = true;
8887
- frame.allowDefault = false;
8884
+ if (e && e.nativeEvent && e.nativeEvent.touches) {
8885
+ if (e.target.stage) {
8886
+ frame = e.target.stage.frame;
8887
+ if (frame.allowDefault) {
8888
+ addCheck = true;
8889
+ frame.allowDefault = false;
8890
+ }
8888
8891
  }
8889
- }
8892
+ }
8890
8893
  });
8891
8894
  that.on("pressup", function () {
8892
- if (frame && adCheck) frame.allowDefault = true;
8895
+ if (frame && addCheck) frame.allowDefault = true;
8893
8896
  });
8894
8897
 
8895
8898
  // EFFECTS
@@ -9755,7 +9758,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
9755
9758
  return that.cjsContainer_getBounds();
9756
9759
  };
9757
9760
 
9758
- this.disposeAllChildren = function() {
9761
+ this.disposeAllChildren = function() {
9759
9762
  for (var i=this.numChildren-1; i>=0; i--) {
9760
9763
  var child = this.getChildAt(i)
9761
9764
  if (child.dispose) child.dispose();
@@ -9780,7 +9783,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
9780
9783
  return (!zot(this[prop]) || Object.prototype.hasOwnProperty.call(this,prop));
9781
9784
  };
9782
9785
  };
9783
- zim.Container.prototype.dispose = function(disposing) {
9786
+ zim.Container.prototype.dispose = function(disposing) {
9784
9787
  recursiveDispose(this, disposing);
9785
9788
  return true;
9786
9789
  };
@@ -27344,7 +27347,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
27344
27347
  return p2;
27345
27348
  };
27346
27349
  };
27347
- zim.extend(zim.Pane, zim.Container, "clone", "zimContainer", false);
27350
+ zim.extend(zim.Pane, zim.Container, ["clone", "dispose"], "zimContainer", false);
27348
27351
  //-58
27349
27352
 
27350
27353
  /*--
@@ -28953,8 +28956,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
28953
28956
  stageEvent = stage.on("stagemousemove", function (e) {
28954
28957
  // that.windowMouseX = e.stageX/zim.scaX;
28955
28958
  // that.windowMouseY = e.stageY/zim.scaY;
28956
- that.windowMouseX = stage.frame.mouseX;
28957
- that.windowMouseY = stage.frame.mouseY;
28959
+ if (stage && stage.frame) {
28960
+ that.windowMouseX = stage.frame.mouseX;
28961
+ that.windowMouseY = stage.frame.mouseY;
28962
+ }
28958
28963
  });
28959
28964
  });
28960
28965
 
@@ -31397,7 +31402,7 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
31397
31402
  // that.dispatchEvent(e);
31398
31403
  });
31399
31404
  that.label.on("blinker", function () {
31400
-
31405
+
31401
31406
  // Pettis Brandon code '23
31402
31407
  var thatX = that.localToGlobal(0,0).x; // Get the global X of that.
31403
31408
  var thatFull = thatX + width-paddingH-label.blinker.width; // Get the global coordinates of the far right corner.
@@ -31666,6 +31671,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
31666
31671
  this.hiddenInput.pattern = "[^(0-9).\-+*/%$]*";
31667
31672
  this.hiddenInput.inputmode = "numeric";
31668
31673
  }
31674
+ var that = this;
31669
31675
 
31670
31676
  if (maxLength > 0) this.hiddenInput.maxLength = maxLength;
31671
31677
  this.hiddenInput.autocapitalize = "off";
@@ -31783,14 +31789,18 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
31783
31789
  this.hiddenInput.select();
31784
31790
  this.positionBlinkerAndSelection();
31785
31791
  }
31792
+ this.hiddenInput.addEventListener("paste", function() {
31793
+ setTimeout(function() {
31794
+ that.hiddenInput.setSelectionRange(that.hiddenInput.selectionStart, that.hiddenInput.selectionEnd, rtl?"forward":"backward");
31795
+ }, 50);
31796
+ });
31786
31797
  this.positionBlinkerAndSelection = function() {
31787
31798
  // ZIM NFT 01 Patch any le or rtl
31788
31799
  var le = this.text.length;
31789
31800
  if (this.focus) {
31790
31801
  var paddingH = this.backing || this.background ? this.paddingH : 0;
31791
31802
  var paddingV = this.backing || this.background ? this.paddingV : 0;
31792
-
31793
- if (this.hiddenInput.selectionStart !== this.hiddenInput.selectionEnd || le == 0) {
31803
+ if (this.hiddenInput.selectionStart !== this.hiddenInput.selectionEnd || le == 0) {
31794
31804
  var startX, endX;
31795
31805
  if (rtl) {
31796
31806
  startX = this.textWidthArray[le-this.hiddenInput.selectionStart]
@@ -33792,11 +33802,11 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
33792
33802
  return that.cloneProps(new zim.List(width, originalHeight, zim.copy(that.originalList, true), viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, originalBorderColor, originalBorderWidth, padding, zim.copy(corner), swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, index, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, closeOthers, drop, dropTargets, dropSelf, dropCopy, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, dropHitTest, dropFull, dropSnap, dropEnd, dropScale, dropWidth, dropHeight, selectedIndex, style, this.group, inherit));
33793
33803
  };
33794
33804
  this.dispose = function(a,b,disposing) {
33795
- if (!disposing) {
33805
+ // if (!disposing) {
33796
33806
  if (that.stageToggleEvent) stage.off("stagemousedown", that.stageToggleEvent);
33797
33807
  if (that.organizer) that.organizer.dispose();
33798
33808
  this.zimWindow_dispose();
33799
- }
33809
+ // }
33800
33810
  // that.tabs = that.selected = selected = that.originalList = list = that.organizer = null;
33801
33811
  return true;
33802
33812
  };
@@ -58961,13 +58971,13 @@ RETURNS any value returned from the loop - or true if no value is returned from
58961
58971
  if (step) i *= step;
58962
58972
  i = start-i;
58963
58973
  if (type=="number") {
58964
- r = call(i, total, start, end, obj);
58974
+ r = call(i, total, start, end, obj, io);
58965
58975
  } else if (type=="array" || type=="string") {
58966
- r = call(obj[i], i, total, start, end, obj);
58976
+ r = call(obj[i], i, total, start, end, obj, io);
58967
58977
  } else if (type=="Dictionary") {
58968
- r = call(obj[i], vals[i], i, total, start, end, obj);
58978
+ r = call(obj[i], vals[i], i, total, start, end, obj, io);
58969
58979
  } else { // nodelist
58970
- r = call(obj.item(i), i, total, start, end, obj);
58980
+ r = call(obj.item(i), i, total, start, end, obj, io);
58971
58981
  }
58972
58982
 
58973
58983
  if (r == 'next') io.next();
@@ -59002,7 +59012,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
59002
59012
  } else if (type=="array" || type=="string") {
59003
59013
  r = call(obj[i], i, total, start, end, obj, io);
59004
59014
  } else if (type=="Dictionary") {
59005
- r = call(obj[i], vals[i], i, total, start, end, obj);
59015
+ r = call(obj[i], vals[i], i, total, start, end, obj, io);
59006
59016
  } else { // nodelist or htmlcollection
59007
59017
  r = call(obj.item(i), i, total, start, end, obj, io);
59008
59018
  }
@@ -59039,7 +59049,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
59039
59049
  if (step) i *= step;
59040
59050
  i = start-i;
59041
59051
 
59042
- r = call(props[i], obj[props[i]], i, total, start, end, obj);
59052
+ r = call(props[i], obj[props[i]], i, total, start, end, obj, io);
59043
59053
 
59044
59054
  if (r == 'next') io.next();
59045
59055
  else if (typeof r != 'undefined') {
@@ -59060,7 +59070,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
59060
59070
  if (!immediate) i--;
59061
59071
  if (step != 1) i = -start + i*step;
59062
59072
 
59063
- r = call(props[i], obj[props[i]], i, total, start, end, obj);
59073
+ r = call(props[i], obj[props[i]], i, total, start, end, obj, io);
59064
59074
 
59065
59075
  if (r == 'next') io.next();
59066
59076
  else if (typeof r != 'undefined') {
@@ -59088,7 +59098,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
59088
59098
  if (step) i *= step;
59089
59099
  i = start-i;
59090
59100
 
59091
- r = call(obj.getChildAt(i), i, total, start, end, obj);
59101
+ r = call(obj.getChildAt(i), i, total, start, end, obj, io);
59092
59102
 
59093
59103
  if (r == 'next') io.next();
59094
59104
  else if (typeof r != 'undefined') {
@@ -59109,7 +59119,7 @@ RETURNS any value returned from the loop - or true if no value is returned from
59109
59119
  if (!immediate) i--;
59110
59120
  if (step != 1) i = -start + i*step;
59111
59121
 
59112
- r = call(obj.getChildAt(i), i, total, start, end, obj);
59122
+ r = call(obj.getChildAt(i), i, total, start, end, obj, io);
59113
59123
 
59114
59124
  if (r == 'next') io.next();
59115
59125
  else if (typeof r != 'undefined') {
@@ -65059,7 +65069,8 @@ note: the item is not the event object target - as that is the tile
65059
65069
  var rowSpacings;
65060
65070
  var widthScaling = 1;
65061
65071
  var heightScaling = 1;
65062
-
65072
+
65073
+
65063
65074
  function resize(width, height) {
65064
65075
 
65065
65076
  if (that.normalized) that.resetOriginalReg();
@@ -69074,6 +69085,7 @@ function apply () {
69074
69085
  window.addEventListener("pointerdown", that.doPointerDown);
69075
69086
  function doDown(e) {
69076
69087
 
69088
+
69077
69089
  if (!that.raycast) return;
69078
69090
 
69079
69091
  if (XR) {
@@ -69115,6 +69127,7 @@ function apply () {
69115
69127
  break;
69116
69128
  }
69117
69129
  }
69130
+
69118
69131
  if (material
69119
69132
  && material.map
69120
69133
  && material.map.source
@@ -69123,11 +69136,12 @@ function apply () {
69123
69136
  && material.userData.ta_content
69124
69137
  ) {
69125
69138
  currentDown = obj;
69139
+
69126
69140
  var content = material.userData.ta_content;
69127
69141
  that.pointerData.mousedown = true;
69128
- doRaycast(content, intersects[i], material.userData.ta_flipped);
69129
- createjs.handleRemotePointer(that.pointerData.x, that.pointerData.y, "down", e, stage, e.pointerId);
69130
-
69142
+
69143
+ doRaycast(content, intersects[i], material.userData.ta_flipped);
69144
+ createjs.handleRemotePointer(that.pointerData.x, that.pointerData.y, "down", e, stage, e.pointerId);
69131
69145
  if (controls && controls.maxAzimuthAngle && content) {
69132
69146
  if (content.backingOrbit) {
69133
69147
  var p = content.globalToLocal(frame.mouseX, frame.mouseY);
@@ -69140,6 +69154,7 @@ function apply () {
69140
69154
  }
69141
69155
  }
69142
69156
  var e2 = new createjs.Event("raydown");
69157
+
69143
69158
  e2.mesh = that.mesh = obj;
69144
69159
  e2.material = that.material = material;
69145
69160
  e2.textureActive = that.textureActive = content;
@@ -76643,10 +76658,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
76643
76658
  if (zot(backPress)) backPress = DS.backPress!=null?DS.backPress:true;
76644
76659
  if (zot(reverse)) reverse = DS.reverse!=null?DS.reverse:false;
76645
76660
  if (zot(continuous)) continuous = DS.continuous!=null?DS.continuous:false;
76646
- var startFlipped = flipped;
76647
-
76661
+
76648
76662
  this.flipped = flipped;
76649
- var that = this;
76663
+ var that = this;
76650
76664
 
76651
76665
  front.centerReg(this);
76652
76666
  var obj;
@@ -76670,13 +76684,13 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
76670
76684
 
76671
76685
  this.flip = function(state, time) {
76672
76686
  if (state == that.flipped) return;
76673
- if (!that.flipped) spin(startFlipped?back:front,startFlipped?front:back,1,time);
76674
- else spin(startFlipped?front:back,startFlipped?back:front,-1,time);
76687
+ if (that.flipped) spin(back,front,-1,time);
76688
+ else spin(front,back,1,time);
76675
76689
  };
76676
76690
  function spin(f, b, d, t) { // current front, back, direction
76677
76691
  if (zot(d)) d = 1;
76678
76692
  d *= reverse?-1:1;
76679
- if (continuous) d = reverse?startFlipped?1:-1:startFlipped?-1:1;
76693
+ if (continuous) d = reverse?-1:1;
76680
76694
  if (zot(t)) t = time;
76681
76695
  that.flipped = !that.flipped;
76682
76696
  that.dispatchEvent("flip");
@@ -76716,6 +76730,11 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
76716
76730
  });
76717
76731
  }
76718
76732
 
76733
+ if (flipped) {
76734
+ that.flipped = false;
76735
+ that.flip(true, 0);
76736
+ }
76737
+
76719
76738
  if (style!==false) zim.styleTransforms(this, DS);
76720
76739
  this.clone = function() {
76721
76740
  return that.cloneProps(new zim.Flipper(front.clone(), back.clone(), interactive, time, vertical, flipped, easeRoot, frontPress, backPress, reverse, continuous, style, this.group, inherit));
@@ -87208,7 +87227,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
87208
87227
  [127.55,73.3, "#A1E543","AAjLSIAAp6IEiAAIAAJ6gAlELOIAAp2IEiAAIAAJ2gAlEihIAAowIKEAAIAAIwg"],
87209
87228
  [32.55,73.05, "#B545E4","Ak6LQIAA2fIJ1AAIAAWfg"]
87210
87229
  ];
87211
- var icon = new zim.Rectangle(200,200);
87230
+ var icon = new zim.Rectangle(200,200,color);
87212
87231
  zim.loop(data, function (d) {
87213
87232
  var s = new zim.Shape().f(d[2]).p(d[3]);
87214
87233
  s.setTransform(d[0]+20,d[1]+27);
@@ -91623,10 +91642,10 @@ pause(state) - pause or unpause the gif
91623
91642
  see also the startPaused parameter
91624
91643
  stop() - stop the gif (same as dispose())
91625
91644
  keyout(color, tolerance, replacement) - remove color from Bitmap and a tolerance between 0-1
91626
- the default color is "#389b26" which is a medium dark green
91627
- the default tolerance is .1 - the higher the tolerance the less sensitive the keying process - so more colors will be removed similar to the provided color
91628
- color and tolerance can be an array of colors and tolerances (or just one tolerance if all are the same)
91629
- replacement (default clear) a color to replace the keyed out color with or an optional array to match the colors array if an array is used
91645
+ the default color is "#389b26" which is a medium dark green
91646
+ the default tolerance is .1 - the higher the tolerance the less sensitive the keying process - so more colors will be removed similar to the provided color
91647
+ color and tolerance can be an array of colors and tolerances (or just one tolerance if all are the same)
91648
+ replacement (default clear) a color to replace the keyed out color with or an optional array to match the colors array if an array is used
91630
91649
  reset() - restarts the GIF
91631
91650
  dispose() - delete the GIF and remove Ticker
91632
91651
 
@@ -95739,4 +95758,4 @@ export let Ticker = zim.Ticker;
95739
95758
  export let Style = zim.Style;
95740
95759
  export let assets = zim.assets;
95741
95760
  export let assetIDs = zim.assetIDs;
95742
- export let ZIMON = zim.ZIMON;
95761
+ export let ZIMON = zim.ZIMON;
@@ -3202,8 +3202,8 @@ declare namespace zim {
3202
3202
  constructor()
3203
3203
  }
3204
3204
  export class Layout extends createjs.EventDispatcher {
3205
- constructor(config_or_holder: Stage | Container, regions: {}[], lastMargin?: number | string, lastMarginMin?: number, backgroundColor?: color, vertical?: boolean, regionShape?: boolean, scalingObject?: Stage | Container, hideKey?: string, style?: boolean, group?: string, inherit?: {})
3206
- constructor(config: { holder: Stage | Container, regions: {}[], lastMargin?: number | string, lastMarginMin?: number, backgroundColor?: color, vertical?: boolean, regionShape?: boolean, scalingObject?: Stage | Container, hideKey?: string, style?: boolean, group?: string, inherit?: {} })
3205
+ constructor(config_or_holder: Stage | Container, regions: {}[], lastMargin?: number | string, lastMarginMin?: number, backgroundColor?: color, vertical?: boolean, showRegions?: boolean, scalingObject?: Stage | Container, hideKey?: string, style?: boolean, group?: string, inherit?: {})
3206
+ constructor(config: { holder: Stage | Container, regions: {}[], lastMargin?: number | string, lastMarginMin?: number, backgroundColor?: color, vertical?: boolean, showRegions?: boolean, scalingObject?: Stage | Container, hideKey?: string, style?: boolean, group?: string, inherit?: {} })
3207
3207
  resize(): void
3208
3208
  dispose(): boolean
3209
3209
  addShape(shape: Shape): void