targetj 1.0.156 → 1.0.158

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/README.md CHANGED
@@ -417,6 +417,8 @@ If you inspect the HTML elements in the browser's developer tools, you'll notice
417
417
  import { App, getEvents, fetch, getScreenWidth, getScreenHeight } from "targetj";
418
418
 
419
419
  App({
420
+ domHolder: true,
421
+ preventDefault: true,
420
422
  containerOverflowMode: "always",
421
423
  children() {
422
424
  const childrenCount = this.getChildren().length;
@@ -40,34 +40,212 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
40
40
  var uniqueId = _App.App.getOid(this.type);
41
41
  this.oid = uniqueId.oid;
42
42
  this.oidNum = uniqueId.num;
43
- this.targetValues = {};
44
- this.actualValues = {};
45
- this.lastActualValues = {};
46
- this.activeTargetList = [];
47
- this.activeTargetMap = {};
48
- this.updatingTargetList = [];
49
- this.updatingTargetMap = {};
50
- this.updatingChildrenList = [];
51
- this.updatingChildrenMap = {};
52
- this.activeChildrenList = [];
53
- this.activeChildrenMap = {};
54
- this.externalEventList = [];
55
- this.externalEventMap = {};
56
- this.internalEventList = [];
57
- this.internalEventMap = {};
58
- this.coreTargets = [];
59
- this.allStyleTargetList = [];
60
- this.allStyleTargetMap = {};
61
- this.styleTargetList = [];
62
- this.styleTargetMap = {};
63
- this.asyncStyleTargetList = [];
64
- this.asyncStyleTargetMap = {};
65
- this.activatedTargets = [];
66
- this.targetExecutionCount = 0;
67
- this.parent = null;
68
- this.targetMethodMap = {};
43
+ this._state = {};
69
44
  }
70
45
  return _createClass(BaseModel, [{
46
+ key: "state",
47
+ value: function state() {
48
+ return this._state;
49
+ }
50
+ }, {
51
+ key: "targetValues",
52
+ get: function get() {
53
+ var _this$state, _this$state$targetVal;
54
+ return (_this$state$targetVal = (_this$state = this.state()).targetValues) !== null && _this$state$targetVal !== void 0 ? _this$state$targetVal : _this$state.targetValues = {};
55
+ },
56
+ set: function set(val) {
57
+ this.state().targetValues = val;
58
+ }
59
+ }, {
60
+ key: "actualValues",
61
+ get: function get() {
62
+ var _this$state2, _this$state2$actualVa;
63
+ return (_this$state2$actualVa = (_this$state2 = this.state()).actualValues) !== null && _this$state2$actualVa !== void 0 ? _this$state2$actualVa : _this$state2.actualValues = {};
64
+ },
65
+ set: function set(val) {
66
+ this.state().actualValues = val;
67
+ }
68
+ }, {
69
+ key: "lastActualValues",
70
+ get: function get() {
71
+ var _this$state3, _this$state3$lastActu;
72
+ return (_this$state3$lastActu = (_this$state3 = this.state()).lastActualValues) !== null && _this$state3$lastActu !== void 0 ? _this$state3$lastActu : _this$state3.lastActualValues = {};
73
+ }
74
+ }, {
75
+ key: "activeTargetList",
76
+ get: function get() {
77
+ var _this$state4, _this$state4$activeTa;
78
+ return (_this$state4$activeTa = (_this$state4 = this.state()).activeTargetList) !== null && _this$state4$activeTa !== void 0 ? _this$state4$activeTa : _this$state4.activeTargetList = [];
79
+ },
80
+ set: function set(val) {
81
+ this.state().activeTargetList = val;
82
+ }
83
+ }, {
84
+ key: "activeTargetMap",
85
+ get: function get() {
86
+ var _this$state5, _this$state5$activeTa;
87
+ return (_this$state5$activeTa = (_this$state5 = this.state()).activeTargetMap) !== null && _this$state5$activeTa !== void 0 ? _this$state5$activeTa : _this$state5.activeTargetMap = {};
88
+ },
89
+ set: function set(val) {
90
+ this.state().activeTargetMap = val;
91
+ }
92
+ }, {
93
+ key: "updatingTargetList",
94
+ get: function get() {
95
+ var _this$state6, _this$state6$updating;
96
+ return (_this$state6$updating = (_this$state6 = this.state()).updatingTargetList) !== null && _this$state6$updating !== void 0 ? _this$state6$updating : _this$state6.updatingTargetList = [];
97
+ }
98
+ }, {
99
+ key: "updatingTargetMap",
100
+ get: function get() {
101
+ var _this$state7, _this$state7$updating;
102
+ return (_this$state7$updating = (_this$state7 = this.state()).updatingTargetMap) !== null && _this$state7$updating !== void 0 ? _this$state7$updating : _this$state7.updatingTargetMap = {};
103
+ }
104
+ }, {
105
+ key: "updatingChildrenList",
106
+ get: function get() {
107
+ var _this$state8, _this$state8$updating;
108
+ return (_this$state8$updating = (_this$state8 = this.state()).updatingChildrenList) !== null && _this$state8$updating !== void 0 ? _this$state8$updating : _this$state8.updatingChildrenList = [];
109
+ }
110
+ }, {
111
+ key: "updatingChildrenMap",
112
+ get: function get() {
113
+ var _this$state9, _this$state9$updating;
114
+ return (_this$state9$updating = (_this$state9 = this.state()).updatingChildrenMap) !== null && _this$state9$updating !== void 0 ? _this$state9$updating : _this$state9.updatingChildrenMap = {};
115
+ }
116
+ }, {
117
+ key: "activeChildrenList",
118
+ get: function get() {
119
+ var _this$state10, _this$state10$activeC;
120
+ return (_this$state10$activeC = (_this$state10 = this.state()).activeChildrenList) !== null && _this$state10$activeC !== void 0 ? _this$state10$activeC : _this$state10.activeChildrenList = [];
121
+ }
122
+ }, {
123
+ key: "activeChildrenMap",
124
+ get: function get() {
125
+ var _this$state11, _this$state11$activeC;
126
+ return (_this$state11$activeC = (_this$state11 = this.state()).activeChildrenMap) !== null && _this$state11$activeC !== void 0 ? _this$state11$activeC : _this$state11.activeChildrenMap = {};
127
+ }
128
+ }, {
129
+ key: "externalEventList",
130
+ get: function get() {
131
+ var _this$state12, _this$state12$externa;
132
+ return (_this$state12$externa = (_this$state12 = this.state()).externalEventList) !== null && _this$state12$externa !== void 0 ? _this$state12$externa : _this$state12.externalEventList = [];
133
+ }
134
+ }, {
135
+ key: "externalEventMap",
136
+ get: function get() {
137
+ var _this$state13, _this$state13$externa;
138
+ return (_this$state13$externa = (_this$state13 = this.state()).externalEventMap) !== null && _this$state13$externa !== void 0 ? _this$state13$externa : _this$state13.externalEventMap = {};
139
+ }
140
+ }, {
141
+ key: "internalEventList",
142
+ get: function get() {
143
+ var _this$state14, _this$state14$interna;
144
+ return (_this$state14$interna = (_this$state14 = this.state()).internalEventList) !== null && _this$state14$interna !== void 0 ? _this$state14$interna : _this$state14.internalEventList = [];
145
+ }
146
+ }, {
147
+ key: "internalEventMap",
148
+ get: function get() {
149
+ var _this$state15, _this$state15$interna;
150
+ return (_this$state15$interna = (_this$state15 = this.state()).internalEventMap) !== null && _this$state15$interna !== void 0 ? _this$state15$interna : _this$state15.internalEventMap = {};
151
+ }
152
+ }, {
153
+ key: "coreTargets",
154
+ get: function get() {
155
+ var _this$state16, _this$state16$coreTar;
156
+ return (_this$state16$coreTar = (_this$state16 = this.state()).coreTargets) !== null && _this$state16$coreTar !== void 0 ? _this$state16$coreTar : _this$state16.coreTargets = [];
157
+ }
158
+ }, {
159
+ key: "allStyleTargetList",
160
+ get: function get() {
161
+ var _this$state17, _this$state17$allStyl;
162
+ return (_this$state17$allStyl = (_this$state17 = this.state()).allStyleTargetList) !== null && _this$state17$allStyl !== void 0 ? _this$state17$allStyl : _this$state17.allStyleTargetList = [];
163
+ }
164
+ }, {
165
+ key: "allStyleTargetMap",
166
+ get: function get() {
167
+ var _this$state18, _this$state18$allStyl;
168
+ return (_this$state18$allStyl = (_this$state18 = this.state()).allStyleTargetMap) !== null && _this$state18$allStyl !== void 0 ? _this$state18$allStyl : _this$state18.allStyleTargetMap = {};
169
+ }
170
+ }, {
171
+ key: "styleTargetList",
172
+ get: function get() {
173
+ var _this$state19, _this$state19$styleTa;
174
+ return (_this$state19$styleTa = (_this$state19 = this.state()).styleTargetList) !== null && _this$state19$styleTa !== void 0 ? _this$state19$styleTa : _this$state19.styleTargetList = [];
175
+ }
176
+ }, {
177
+ key: "styleTargetMap",
178
+ get: function get() {
179
+ var _this$state20, _this$state20$styleTa;
180
+ return (_this$state20$styleTa = (_this$state20 = this.state()).styleTargetMap) !== null && _this$state20$styleTa !== void 0 ? _this$state20$styleTa : _this$state20.styleTargetMap = {};
181
+ }
182
+ }, {
183
+ key: "asyncStyleTargetList",
184
+ get: function get() {
185
+ var _this$state21, _this$state21$asyncSt;
186
+ return (_this$state21$asyncSt = (_this$state21 = this.state()).asyncStyleTargetList) !== null && _this$state21$asyncSt !== void 0 ? _this$state21$asyncSt : _this$state21.asyncStyleTargetList = [];
187
+ }
188
+ }, {
189
+ key: "asyncStyleTargetMap",
190
+ get: function get() {
191
+ var _this$state22, _this$state22$asyncSt;
192
+ return (_this$state22$asyncSt = (_this$state22 = this.state()).asyncStyleTargetMap) !== null && _this$state22$asyncSt !== void 0 ? _this$state22$asyncSt : _this$state22.asyncStyleTargetMap = {};
193
+ }
194
+ }, {
195
+ key: "activatedTargets",
196
+ get: function get() {
197
+ var _this$state23, _this$state23$activat;
198
+ return (_this$state23$activat = (_this$state23 = this.state()).activatedTargets) !== null && _this$state23$activat !== void 0 ? _this$state23$activat : _this$state23.activatedTargets = [];
199
+ }
200
+ }, {
201
+ key: "targetMethodMap",
202
+ get: function get() {
203
+ var _this$state24, _this$state24$targetM;
204
+ return (_this$state24$targetM = (_this$state24 = this.state()).targetMethodMap) !== null && _this$state24$targetM !== void 0 ? _this$state24$targetM : _this$state24.targetMethodMap = [];
205
+ }
206
+ }, {
207
+ key: "targetExecutionCount",
208
+ get: function get() {
209
+ var _this$state25, _this$state25$targetE;
210
+ return (_this$state25$targetE = (_this$state25 = this.state()).targetExecutionCount) !== null && _this$state25$targetE !== void 0 ? _this$state25$targetE : _this$state25.targetExecutionCount = 0;
211
+ },
212
+ set: function set(val) {
213
+ this.state().targetExecutionCount = val;
214
+ }
215
+ }, {
216
+ key: "addedChildren",
217
+ get: function get() {
218
+ var _this$state26, _this$state26$addedCh;
219
+ return (_this$state26$addedCh = (_this$state26 = this.state()).addedChildren) !== null && _this$state26$addedCh !== void 0 ? _this$state26$addedCh : _this$state26.addedChildren = [];
220
+ }
221
+ }, {
222
+ key: "deletedChildren",
223
+ get: function get() {
224
+ var _this$state27, _this$state27$deleted;
225
+ return (_this$state27$deleted = (_this$state27 = this.state()).deletedChildren) !== null && _this$state27$deleted !== void 0 ? _this$state27$deleted : _this$state27.deletedChildren = [];
226
+ }
227
+ }, {
228
+ key: "movedChildren",
229
+ get: function get() {
230
+ var _this$state28, _this$state28$movedCh;
231
+ return (_this$state28$movedCh = (_this$state28 = this.state()).movedChildren) !== null && _this$state28$movedCh !== void 0 ? _this$state28$movedCh : _this$state28.movedChildren = [];
232
+ }
233
+ }, {
234
+ key: "lastChildrenUpdate",
235
+ get: function get() {
236
+ var _this$state29, _this$state29$lastChi;
237
+ return (_this$state29$lastChi = (_this$state29 = this.state()).lastChildrenUpdate) !== null && _this$state29$lastChi !== void 0 ? _this$state29$lastChi : _this$state29.lastChildrenUpdate = {
238
+ additions: [],
239
+ deletions: []
240
+ };
241
+ }
242
+ }, {
243
+ key: "visibleChildren",
244
+ get: function get() {
245
+ var _this$state30, _this$state30$visible;
246
+ return (_this$state30$visible = (_this$state30 = this.state()).visibleChildren) !== null && _this$state30$visible !== void 0 ? _this$state30$visible : _this$state30.visibleChildren = [];
247
+ }
248
+ }, {
71
249
  key: "getParent",
72
250
  value: function getParent() {
73
251
  return this.parent;
@@ -780,27 +958,11 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
780
958
  }, {
781
959
  key: "getCoreTargets",
782
960
  value: function getCoreTargets() {
783
- return _TUtil.TUtil.isDefined(this.val('coreTargets')) ? this.val('coreTargets') : this.coreTargets;
784
- }
785
- }, {
786
- key: "getExternalEventList",
787
- value: function getExternalEventList() {
788
- return this.externalEventList;
789
- }
790
- }, {
791
- key: "getInternalEventList",
792
- value: function getInternalEventList() {
793
- return this.internalEventList;
794
- }
795
- }, {
796
- key: "hasExternalEvents",
797
- value: function hasExternalEvents() {
798
- return this.getExternalEventList().length > 0;
799
- }
800
- }, {
801
- key: "getExternalEventMap",
802
- value: function getExternalEventMap() {
803
- return this.externalEventMap;
961
+ var explicit = this.val('coreTargets');
962
+ if (_TUtil.TUtil.isDefined(explicit)) {
963
+ return explicit;
964
+ }
965
+ return this.state().coreTargets;
804
966
  }
805
967
  }, {
806
968
  key: "setTargetMethodName",
@@ -117,18 +117,26 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
117
117
  }, {
118
118
  key: "attachEvents",
119
119
  value: function attachEvents(tmodels) {
120
- var _this6 = this;
121
120
  var _iterator = _createForOfIteratorHelper(tmodels),
122
121
  _step;
123
122
  try {
124
- var _loop = function _loop() {
125
- var tmodel = _step.value;
126
- tmodel.getExternalEventList().forEach(function (targetName) {
127
- _this6.attachTargetEvents(tmodel, targetName);
128
- });
129
- };
130
123
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
131
- _loop();
124
+ var tmodel = _step.value;
125
+ var externalList = tmodel.state().externalEventList;
126
+ if ((externalList === null || externalList === void 0 ? void 0 : externalList.length) > 0) {
127
+ var _iterator2 = _createForOfIteratorHelper(externalList),
128
+ _step2;
129
+ try {
130
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
131
+ var targetName = _step2.value;
132
+ this.attachTargetEvents(tmodel, targetName);
133
+ }
134
+ } catch (err) {
135
+ _iterator2.e(err);
136
+ } finally {
137
+ _iterator2.f();
138
+ }
139
+ }
132
140
  }
133
141
  } catch (err) {
134
142
  _iterator.e(err);
@@ -139,7 +147,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
139
147
  }, {
140
148
  key: "attachTargetEvents",
141
149
  value: function attachTargetEvents(tmodel, targetName) {
142
- var _this7 = this;
150
+ var _this6 = this;
143
151
  var targetKey = "".concat(tmodel.oid, " ").concat(targetName);
144
152
  if (!tmodel.hasDom() || this.eventTargetMap[targetKey] && this.eventTargetMap[targetKey] === tmodel.$dom) {
145
153
  return;
@@ -152,9 +160,9 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
152
160
  var eventKey = "".concat(tmodel.oid, " ").concat(key);
153
161
  var eventItem = eventMap[key];
154
162
  var $dom = eventItem.windowEvent ? _App.tApp.$window : tmodel.$dom;
155
- $dom.detachEvent(key, _this7.bindedHandleEvent);
156
- $dom.addEvent(key, _this7.bindedHandleEvent);
157
- _this7.attachedEventMap[eventKey] = {
163
+ $dom.detachEvent(key, _this6.bindedHandleEvent);
164
+ $dom.addEvent(key, _this6.bindedHandleEvent);
165
+ _this6.attachedEventMap[eventKey] = {
158
166
  $dom: $dom,
159
167
  event: key
160
168
  };
@@ -164,14 +172,14 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
164
172
  }, {
165
173
  key: "detachAll",
166
174
  value: function detachAll() {
167
- var _this8 = this;
175
+ var _this7 = this;
168
176
  var eventKeys = Object.keys(this.attachedEventMap);
169
177
  eventKeys.forEach(function (eventKey) {
170
- var _this8$attachedEventM = _this8.attachedEventMap[eventKey],
171
- $dom = _this8$attachedEventM.$dom,
172
- event = _this8$attachedEventM.event;
178
+ var _this7$attachedEventM = _this7.attachedEventMap[eventKey],
179
+ $dom = _this7$attachedEventM.$dom,
180
+ event = _this7$attachedEventM.event;
173
181
  if ($dom.exists()) {
174
- $dom.detachEvent(event, _this8.bindedHandleEvent);
182
+ $dom.detachEvent(event, _this7.bindedHandleEvent);
175
183
  }
176
184
  });
177
185
  this.attachedEventMap = {};
@@ -155,12 +155,14 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
155
155
  }
156
156
  _this3.addToLocationList(child);
157
157
  }
158
- child.getCoreTargets().forEach(function (target) {
159
- if (child.isTargetEnabled(target) && !child.isTargetUpdating(target) && !child.isTargetImperative(target)) {
160
- _TargetExecutor.TargetExecutor.executeDeclarativeTarget(child, target, child.getTargetCycle(target));
161
- }
162
- ;
163
- });
158
+ var coreTargets = child.getCoreTargets();
159
+ if (coreTargets) {
160
+ coreTargets.forEach(function (target) {
161
+ if (child.isTargetEnabled(target) && !child.isTargetUpdating(target) && !child.isTargetImperative(target)) {
162
+ _TargetExecutor.TargetExecutor.executeDeclarativeTarget(child, target, child.getTargetCycle(target));
163
+ }
164
+ });
165
+ }
164
166
  if (!child.isTargetImperative('x') && !child.targets['x'] || !_TUtil.TUtil.isDefined(child.targetValues.x)) {
165
167
  child.val('x', child.x);
166
168
  }
@@ -252,11 +254,23 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
252
254
  value: function checkExternalEvents(tmodel) {
253
255
  var eventTargets = [];
254
256
  var eventMap = _TargetData.TargetData.allEventMap;
255
- tmodel.getExternalEventList().forEach(function (targetName) {
256
- if (eventMap[targetName](tmodel)) {
257
- eventTargets.push(targetName);
257
+ var externalList = tmodel.state().externalEventList;
258
+ if ((externalList === null || externalList === void 0 ? void 0 : externalList.length) > 0) {
259
+ var _iterator3 = _createForOfIteratorHelper(externalList),
260
+ _step3;
261
+ try {
262
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
263
+ var targetName = _step3.value;
264
+ if (eventMap[targetName](tmodel)) {
265
+ eventTargets.push(targetName);
266
+ }
267
+ }
268
+ } catch (err) {
269
+ _iterator3.e(err);
270
+ } finally {
271
+ _iterator3.f();
258
272
  }
259
- });
273
+ }
260
274
  this.runEventTargets(tmodel, eventTargets);
261
275
  }
262
276
  }, {
@@ -264,11 +278,23 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
264
278
  value: function checkInternalEvents(tmodel) {
265
279
  var eventTargets = [];
266
280
  var eventMap = _TargetData.TargetData.internalEventMap;
267
- tmodel.getInternalEventList().forEach(function (targetName) {
268
- if (eventMap[targetName](tmodel)) {
269
- eventTargets.push(targetName);
281
+ var internalList = tmodel.state().internalEventList;
282
+ if ((internalList === null || internalList === void 0 ? void 0 : internalList.length) > 0) {
283
+ var _iterator4 = _createForOfIteratorHelper(internalList),
284
+ _step4;
285
+ try {
286
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
287
+ var targetName = _step4.value;
288
+ if (eventMap[targetName](tmodel)) {
289
+ eventTargets.push(targetName);
290
+ }
291
+ }
292
+ } catch (err) {
293
+ _iterator4.e(err);
294
+ } finally {
295
+ _iterator4.f();
270
296
  }
271
- });
297
+ }
272
298
  this.runEventTargets(tmodel, eventTargets);
273
299
  }
274
300
  }, {
@@ -135,7 +135,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
135
135
  _App.tApp.tRoot.$dom = new _$Dom.$Dom('#tgjs-root');
136
136
  this.pageCache[document.URL] = {
137
137
  link: document.URL,
138
- htms: _App.tApp.tRoot.$dom.innerHTML(),
138
+ html: _App.tApp.tRoot.$dom.innerHTML(),
139
139
  oids: _objectSpread({}, _App.App.oids),
140
140
  visibleList: _toConsumableArray(_App.tApp.manager.lists.visible),
141
141
  tRoot: _App.tApp.tRoot
package/build/TModel.js CHANGED
@@ -32,13 +32,6 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
32
32
  var _this;
33
33
  _classCallCheck(this, TModel);
34
34
  _this = _callSuper(this, TModel, [type, targets]);
35
- _this.addedChildren = [];
36
- _this.deletedChildren = [];
37
- _this.movedChildren = [];
38
- _this.lastChildrenUpdate = {
39
- additions: [],
40
- deletions: []
41
- };
42
35
  _this.allChildrenList = [];
43
36
  _this.allChildrenMap = {};
44
37
  _this.childrenUpdateFlag = false;
@@ -57,7 +50,6 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
57
50
  _this.transformMap = {};
58
51
  _this.visibilityStatus = undefined;
59
52
  _this.isNowInvisible = false;
60
- _this.visibleChildren = [];
61
53
  _this.hasDomNow = false;
62
54
  _this.isNowVisible = false;
63
55
  _this.currentStatus = 'new';
@@ -167,8 +159,12 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
167
159
  }, {
168
160
  key: "getChildren",
169
161
  value: function getChildren() {
170
- var _this3 = this;
171
- if (this.deletedChildren.length > 0) {
162
+ var _state$deletedChildre,
163
+ _this3 = this,
164
+ _state$addedChildren,
165
+ _state$movedChildren;
166
+ var state = this.state();
167
+ if (((_state$deletedChildre = state.deletedChildren) === null || _state$deletedChildre === void 0 ? void 0 : _state$deletedChildre.length) > 0) {
172
168
  this.deletedChildren.forEach(function (child) {
173
169
  if (_this3.allChildrenMap[child.oid]) {
174
170
  var index = _this3.allChildrenList.indexOf(child);
@@ -179,7 +175,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
179
175
  });
180
176
  this.deletedChildren.length = 0;
181
177
  }
182
- if (this.addedChildren.length > 0) {
178
+ if (((_state$addedChildren = state.addedChildren) === null || _state$addedChildren === void 0 ? void 0 : _state$addedChildren.length) > 0) {
183
179
  this.addedChildren.sort(function (a, b) {
184
180
  return a.index - b.index;
185
181
  });
@@ -205,7 +201,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
205
201
  });
206
202
  this.addedChildren.length = 0;
207
203
  }
208
- if (this.movedChildren.length > 0) {
204
+ if (((_state$movedChildren = state.movedChildren) === null || _state$movedChildren === void 0 ? void 0 : _state$movedChildren.length) > 0) {
209
205
  this.movedChildren.sort(function (a, b) {
210
206
  return a.index - b.index;
211
207
  });
@@ -263,8 +259,8 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
263
259
  value: function removeAll() {
264
260
  this.allChildrenList = [];
265
261
  this.allChildrenMap = {};
266
- this.updatingChildrenList.length = 0;
267
- this.updatingChildrenMap = {};
262
+ this.state().updatingChildrenList = [];
263
+ this.state().updatingChildrenMap = {};
268
264
  if (this.hasDom()) {
269
265
  this.$dom.deleteAll();
270
266
  }
@@ -556,7 +552,8 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
556
552
  }, {
557
553
  key: "canHandleEvent",
558
554
  value: function canHandleEvent(eventName) {
559
- return this.getExternalEventMap()[eventName];
555
+ var _this$state$externalE, _this$state$externalE2;
556
+ return (_this$state$externalE = (_this$state$externalE2 = this.state().externalEventMap) === null || _this$state$externalE2 === void 0 ? void 0 : _this$state$externalE2[eventName]) !== null && _this$state$externalE !== void 0 ? _this$state$externalE : false;
560
557
  }
561
558
  }, {
562
559
  key: "preventDefault",
@@ -86,7 +86,8 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
86
86
  try {
87
87
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
88
88
  var tmodel = _step.value;
89
- if (tmodel.getParent() && !tmodel.getParent().allChildrenMap[tmodel.oid]) {
89
+ var parent = tmodel.getParent();
90
+ if (parent && !parent.allChildrenMap[tmodel.oid]) {
90
91
  if (tmodel.hasDom() && !this.lists.invisibleDom.includes(tmodel)) {
91
92
  this.lists.invisibleDom.push(tmodel);
92
93
  }
@@ -106,24 +107,26 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
106
107
  this.visibleTypeMap[tmodel.type].push(tmodel);
107
108
  }
108
109
  if (visible || tmodel.isActivated()) {
110
+ var _state$updatingTarget, _state$activeTargetLi, _state$activeChildren;
109
111
  this.needsRerender(tmodel);
110
112
  this.needsRestyle(tmodel);
111
113
  this.needsReattach(tmodel);
112
114
  this.needsRelocation(tmodel);
113
- if (tmodel.updatingTargetList.length > 0) {
115
+ var state = tmodel.state();
116
+ if (((_state$updatingTarget = state.updatingTargetList) === null || _state$updatingTarget === void 0 ? void 0 : _state$updatingTarget.length) > 0) {
114
117
  this.lists.updatingTModels.push(tmodel);
115
- this.lists.updatingTargets = [].concat(_toConsumableArray(this.lists.updatingTargets), _toConsumableArray(tmodel.updatingTargetList));
118
+ this.lists.updatingTargets = [].concat(_toConsumableArray(this.lists.updatingTargets), _toConsumableArray(state.updatingTargetList));
116
119
  }
117
- if (tmodel.activeTargetList.length > 0) {
120
+ if (((_state$activeTargetLi = state.activeTargetList) === null || _state$activeTargetLi === void 0 ? void 0 : _state$activeTargetLi.length) > 0) {
118
121
  this.lists.activeTModels.push(tmodel);
119
- this.lists.activeTargets = [].concat(_toConsumableArray(this.lists.activeTargets), _toConsumableArray(tmodel.activeTargetList));
122
+ this.lists.activeTargets = [].concat(_toConsumableArray(this.lists.activeTargets), _toConsumableArray(state.activeTargetList));
120
123
  }
121
- if (tmodel.activeChildrenList.length > 0) {
122
- this.lists.activeTModels = [].concat(_toConsumableArray(this.lists.activeTModels), _toConsumableArray(tmodel.activeChildrenList));
124
+ if (((_state$activeChildren = state.activeChildrenList) === null || _state$activeChildren === void 0 ? void 0 : _state$activeChildren.length) > 0) {
125
+ this.lists.activeTModels = [].concat(_toConsumableArray(this.lists.activeTModels), _toConsumableArray(state.activeChildrenList));
123
126
  }
124
- if (Object.keys(tmodel.targetMethodMap).length > 0) {
125
- this.targetMethodMap[tmodel.oid] = _objectSpread({}, tmodel.targetMethodMap);
126
- tmodel.targetMethodMap = {};
127
+ if (state.targetMethodMap && Object.keys(state.targetMethodMap).length > 0) {
128
+ this.targetMethodMap[tmodel.oid] = _objectSpread({}, state.targetMethodMap);
129
+ state.targetMethodMap = {};
127
130
  }
128
131
  tmodel.deactivate();
129
132
  }
@@ -137,8 +137,8 @@ var TModelUtil = exports.TModelUtil = /*#__PURE__*/function () {
137
137
  if (transformUpdate) {
138
138
  tmodel.$dom.transform(TModelUtil.getTransformString(tmodel));
139
139
  }
140
- tmodel.styleTargetMap = {};
141
- tmodel.styleTargetList.length = 0;
140
+ tmodel.state().styleTargetMap = {};
141
+ tmodel.state().styleTargetList = [];
142
142
  }
143
143
  }, {
144
144
  key: "setWidthFromDom",
@@ -236,8 +236,8 @@ var TModelUtil = exports.TModelUtil = /*#__PURE__*/function () {
236
236
  }
237
237
  }
238
238
  });
239
- tmodel.asyncStyleTargetMap = {};
240
- tmodel.asyncStyleTargetList.length = 0;
239
+ tmodel.state().asyncStyleTargetMap = {};
240
+ tmodel.state().asyncStyleTargetList = [];
241
241
  }
242
242
  }, {
243
243
  key: "getTransformString",
package/build/index.js ADDED
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _App = require("./App.js");
7
+ Object.keys(_App).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _App[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _App[key];
14
+ }
15
+ });
16
+ });
17
+ var _TModel = require("./TModel.js");
18
+ Object.keys(_TModel).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _TModel[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _TModel[key];
25
+ }
26
+ });
27
+ });
28
+ var _Moves = require("./Moves.js");
29
+ Object.keys(_Moves).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _Moves[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _Moves[key];
36
+ }
37
+ });
38
+ });
39
+ var _SearchUtil = require("./SearchUtil.js");
40
+ Object.keys(_SearchUtil).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _SearchUtil[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function get() {
46
+ return _SearchUtil[key];
47
+ }
48
+ });
49
+ });
50
+ var _TargetData = require("./TargetData.js");
51
+ Object.keys(_TargetData).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _TargetData[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function get() {
57
+ return _TargetData[key];
58
+ }
59
+ });
60
+ });
61
+ var _TargetUtil = require("./TargetUtil.js");
62
+ Object.keys(_TargetUtil).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _TargetUtil[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function get() {
68
+ return _TargetUtil[key];
69
+ }
70
+ });
71
+ });
72
+ var _TModelUtil = require("./TModelUtil.js");
73
+ Object.keys(_TModelUtil).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _TModelUtil[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function get() {
79
+ return _TModelUtil[key];
80
+ }
81
+ });
82
+ });
83
+ var _TUtil = require("./TUtil.js");
84
+ Object.keys(_TUtil).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _TUtil[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function get() {
90
+ return _TUtil[key];
91
+ }
92
+ });
93
+ });
94
+ var _$Dom = require("./$Dom.js");
95
+ Object.keys(_$Dom).forEach(function (key) {
96
+ if (key === "default" || key === "__esModule") return;
97
+ if (key in exports && exports[key] === _$Dom[key]) return;
98
+ Object.defineProperty(exports, key, {
99
+ enumerable: true,
100
+ get: function get() {
101
+ return _$Dom[key];
102
+ }
103
+ });
104
+ });
105
+ var _Bracket = require("./Bracket.js");
106
+ Object.keys(_Bracket).forEach(function (key) {
107
+ if (key === "default" || key === "__esModule") return;
108
+ if (key in exports && exports[key] === _Bracket[key]) return;
109
+ Object.defineProperty(exports, key, {
110
+ enumerable: true,
111
+ get: function get() {
112
+ return _Bracket[key];
113
+ }
114
+ });
115
+ });
116
+ var _BracketGenerator = require("./BracketGenerator.js");
117
+ Object.keys(_BracketGenerator).forEach(function (key) {
118
+ if (key === "default" || key === "__esModule") return;
119
+ if (key in exports && exports[key] === _BracketGenerator[key]) return;
120
+ Object.defineProperty(exports, key, {
121
+ enumerable: true,
122
+ get: function get() {
123
+ return _BracketGenerator[key];
124
+ }
125
+ });
126
+ });
127
+ var _ColorUtil = require("./ColorUtil.js");
128
+ Object.keys(_ColorUtil).forEach(function (key) {
129
+ if (key === "default" || key === "__esModule") return;
130
+ if (key in exports && exports[key] === _ColorUtil[key]) return;
131
+ Object.defineProperty(exports, key, {
132
+ enumerable: true,
133
+ get: function get() {
134
+ return _ColorUtil[key];
135
+ }
136
+ });
137
+ });
138
+ var _Easing = require("./Easing.js");
139
+ Object.keys(_Easing).forEach(function (key) {
140
+ if (key === "default" || key === "__esModule") return;
141
+ if (key in exports && exports[key] === _Easing[key]) return;
142
+ Object.defineProperty(exports, key, {
143
+ enumerable: true,
144
+ get: function get() {
145
+ return _Easing[key];
146
+ }
147
+ });
148
+ });
149
+ var _TargetExecutor = require("./TargetExecutor.js");
150
+ Object.keys(_TargetExecutor).forEach(function (key) {
151
+ if (key === "default" || key === "__esModule") return;
152
+ if (key in exports && exports[key] === _TargetExecutor[key]) return;
153
+ Object.defineProperty(exports, key, {
154
+ enumerable: true,
155
+ get: function get() {
156
+ return _TargetExecutor[key];
157
+ }
158
+ });
159
+ });
package/package.json CHANGED
@@ -1,28 +1,34 @@
1
1
  {
2
2
  "name": "targetj",
3
- "version": "1.0.156",
4
- "keywords": [
5
- "targetjs"
6
- ],
7
- "main": "Export.js",
8
- "contributors": [
9
- "ahmad.wasfi"
10
- ],
3
+ "version": "1.0.158",
11
4
  "description": "TargetJS is a JavaScript framework designed for creating animated and efficient web user interfaces.",
5
+ "keywords": ["targetjs"],
6
+ "main": "Export.js",
7
+ "homepage": "https://targetjs.io",
8
+ "license": "MIT",
12
9
  "repository": {
13
10
  "type": "git",
14
11
  "url": "git+https://github.com/livetrails/targetjs.git"
15
12
  },
16
- "license": "MIT",
17
13
  "bugs": {
18
14
  "url": "https://github.com/livetrails/targetjs/issues"
19
15
  },
16
+ "contributors": [
17
+ {
18
+ "name": "Ahmad Wasfi"
19
+ }
20
+ ],
20
21
  "scripts": {
21
22
  "prod": "webpack --mode production",
22
23
  "dev": "webpack --mode development",
23
24
  "build": "babel src --out-dir build"
24
25
  },
25
- "homepage": "http://targetjs.io",
26
+ "files": [
27
+ "Export.js",
28
+ "build/",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
26
32
  "devDependencies": {
27
33
  "@babel/cli": "^7.25.6",
28
34
  "@babel/core": "^7.25.2",
@@ -31,7 +37,6 @@
31
37
  "babel-loader": "^9.1.0",
32
38
  "eslint-webpack-plugin": "^4.2.0",
33
39
  "webpack": "^5.91.0",
34
- "webpack-cli": "^5.1.4",
35
- "wepback": "^1.0.0"
40
+ "webpack-cli": "^5.1.4"
36
41
  }
37
42
  }
File without changes