targetj 1.1.5 → 1.1.7

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/Export.js CHANGED
@@ -24,6 +24,7 @@ export * from "./build/ParticleChild.js";
24
24
  export * from "./build/ParticleRenderer.js";
25
25
  export * from "./build/ParticleRuntime.js";
26
26
  export * from "./build/ParticleUtil.js";
27
+ export * from "./build/HtmlToCanvas.js";
27
28
 
28
29
  import * as AppModule from "./build/App.js";
29
30
  import * as TModelModule from "./build/TModel.js";
@@ -51,6 +52,7 @@ import * as ParticleChildModule from "./build/ParticleChild.js";
51
52
  import * as ParticleRendererModule from "./build/ParticleRenderer.js";
52
53
  import * as ParticleRuntimeModule from "./build/ParticleRuntime.js";
53
54
  import * as ParticleUtilModule from "./build/ParticleUtil.js";
55
+ import * as HtmlToCanvasModule from "./build/HtmlToCanvas.js";
54
56
 
55
57
  const TargetJS = {
56
58
  ...AppModule,
@@ -78,7 +80,8 @@ const TargetJS = {
78
80
  ...ParticleChildModule,
79
81
  ...ParticleRendererModule,
80
82
  ...ParticleRuntimeModule,
81
- ...ParticleUtilModule
83
+ ...ParticleUtilModule,
84
+ ...HtmlToCanvas
82
85
  };
83
86
 
84
87
  if (typeof window !== "undefined") {
package/build/$Dom.js CHANGED
@@ -697,14 +697,24 @@ var $Dom = /*#__PURE__*/function () {
697
697
  }).join('&');
698
698
  }
699
699
  xhr.onreadystatechange = function () {
700
- if (xhr.readyState === 4) {
701
- if (xhr.status === 200) {
702
- var response = query.dataType === 'json' ? JSON.parse(this.responseText) : this.responseText;
703
- query.success(response);
704
- } else {
705
- query.error(xhr.status);
700
+ if (xhr.readyState !== 4) {
701
+ return;
702
+ }
703
+ if (xhr.status < 200 || xhr.status >= 300) {
704
+ query.error(xhr.status);
705
+ return;
706
+ }
707
+ var response = xhr.responseText;
708
+ if (query.dataType === 'json') {
709
+ try {
710
+ response = response.trim() ? JSON.parse(response) : null;
711
+ } catch (error) {
712
+ console.error('Invalid JSON response:', xhr.responseURL, error);
713
+ query.error(error);
714
+ return;
706
715
  }
707
716
  }
717
+ query.success(response);
708
718
  };
709
719
  if (query.type === 'POST') {
710
720
  xhr.open(query.type, query.url, true);
@@ -3,6 +3,8 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
3
3
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
4
4
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
5
5
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
8
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
9
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
10
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -301,7 +303,23 @@ var BaseModel = /*#__PURE__*/function () {
301
303
  if (doesNextTargetUsePrevValue || isInactiveKey || isExternalEvent || isInternalEvent || targetType === 'object' || targetType === 'function') {
302
304
  if (!TUtil.isDefined(target.value) && !TargetParser.isChildObjectTarget(key, target) && !TargetParser.isIntervalTarget(target)) {
303
305
  needsTargetExecution = true;
304
- target = TargetUtil.wrapTarget(this, target, key);
306
+ var value = _objectSpread({}, target);
307
+ target = TargetUtil.wrapTarget(this, value, key);
308
+ var _iterator = _createForOfIteratorHelper(TargetData.lifecycleCallbackSet),
309
+ _step;
310
+ try {
311
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
312
+ var name = _step.value;
313
+ if (Object.hasOwn(value, name)) {
314
+ target[name] = value[name];
315
+ delete value[name];
316
+ }
317
+ }
318
+ } catch (err) {
319
+ _iterator.e(err);
320
+ } finally {
321
+ _iterator.f();
322
+ }
305
323
  }
306
324
  TargetUtil.bindTarget(this, key, prevKey, nextKey, keyIndex);
307
325
  }
@@ -816,12 +834,12 @@ var BaseModel = /*#__PURE__*/function () {
816
834
  return false;
817
835
  }
818
836
  var activated = false;
819
- var _iterator = _createForOfIteratorHelper(this.passiveTargetList),
820
- _step;
837
+ var _iterator2 = _createForOfIteratorHelper(this.passiveTargetList),
838
+ _step2;
821
839
  try {
822
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
840
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
823
841
  var _this$animatingMap;
824
- var key = _step.value;
842
+ var key = _step2.value;
825
843
  if (!this.isTargetPassiveLoop(key)) {
826
844
  continue;
827
845
  }
@@ -836,9 +854,9 @@ var BaseModel = /*#__PURE__*/function () {
836
854
  activated = true;
837
855
  }
838
856
  } catch (err) {
839
- _iterator.e(err);
857
+ _iterator2.e(err);
840
858
  } finally {
841
- _iterator.f();
859
+ _iterator2.f();
842
860
  }
843
861
  return activated;
844
862
  }
@@ -1104,12 +1122,12 @@ var BaseModel = /*#__PURE__*/function () {
1104
1122
  value: function hasUpdatingImperativeTargets(originalTargetName) {
1105
1123
  var _this$updatingTargetL;
1106
1124
  var updatingList = [].concat(_toConsumableArray((_this$updatingTargetL = this.updatingTargetList) !== null && _this$updatingTargetL !== void 0 ? _this$updatingTargetL : []), _toConsumableArray(this.hasAnimatingTargets() ? _toConsumableArray(this.animatingMap.keys()) : []));
1107
- var _iterator2 = _createForOfIteratorHelper(updatingList),
1108
- _step2;
1125
+ var _iterator3 = _createForOfIteratorHelper(updatingList),
1126
+ _step3;
1109
1127
  try {
1110
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1128
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1111
1129
  var _this$targetValues$ta;
1112
- var target = _step2.value;
1130
+ var target = _step3.value;
1113
1131
  if (!this.isTargetImperative(target)) {
1114
1132
  continue;
1115
1133
  }
@@ -1118,9 +1136,9 @@ var BaseModel = /*#__PURE__*/function () {
1118
1136
  }
1119
1137
  }
1120
1138
  } catch (err) {
1121
- _iterator2.e(err);
1139
+ _iterator3.e(err);
1122
1140
  } finally {
1123
- _iterator2.f();
1141
+ _iterator3.f();
1124
1142
  }
1125
1143
  return false;
1126
1144
  }
@@ -1130,12 +1148,12 @@ var BaseModel = /*#__PURE__*/function () {
1130
1148
  var _this$updatingTargetL2;
1131
1149
  var updatingList = [].concat(_toConsumableArray((_this$updatingTargetL2 = this.updatingTargetList) !== null && _this$updatingTargetL2 !== void 0 ? _this$updatingTargetL2 : []), _toConsumableArray(this.hasAnimatingTargets() ? _toConsumableArray(this.animatingMap.keys()) : []));
1132
1150
  var targets = [];
1133
- var _iterator3 = _createForOfIteratorHelper(updatingList),
1134
- _step3;
1151
+ var _iterator4 = _createForOfIteratorHelper(updatingList),
1152
+ _step4;
1135
1153
  try {
1136
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1154
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1137
1155
  var _this$targetValues$ta2;
1138
- var target = _step3.value;
1156
+ var target = _step4.value;
1139
1157
  if (!this.isTargetImperative(target)) {
1140
1158
  continue;
1141
1159
  }
@@ -1144,9 +1162,9 @@ var BaseModel = /*#__PURE__*/function () {
1144
1162
  }
1145
1163
  }
1146
1164
  } catch (err) {
1147
- _iterator3.e(err);
1165
+ _iterator4.e(err);
1148
1166
  } finally {
1149
- _iterator3.f();
1167
+ _iterator4.f();
1150
1168
  }
1151
1169
  return targets;
1152
1170
  }
package/build/TModel.js CHANGED
@@ -34,7 +34,7 @@ import { DomInit } from "./DomInit.js";
34
34
  import { StateUtil } from "./StateUtil.js";
35
35
  import { TModelFactory } from "./TModelFactory.js";
36
36
  import { ParticleExplode } from "./ParticleExplode.js";
37
- import { HtmlToCanvas } from "./htmlToCanvas.js";
37
+ import { HtmlToCanvas } from "./HtmlToCanvas.js";
38
38
 
39
39
  /**
40
40
  * It provides the base class for all objects in an app where targets are defined.
package/build/index.js CHANGED
@@ -23,4 +23,5 @@ export * from "./ParticleTModel.js";
23
23
  export * from "./ParticleChild.js";
24
24
  export * from "./ParticleRenderer.js";
25
25
  export * from "./ParticleRuntime.js";
26
- export * from "./ParticleUtil.js";
26
+ export * from "./ParticleUtil.js";
27
+ export * from "./HtmlToCanvas.js";