targetj 1.0.122 → 1.0.124

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
@@ -1,8 +1,8 @@
1
- # TargetJ: JavaScript UI framework and library
1
+ # TargetJ: JavaScript UI framework and library - Programming the Front-End with a New Paradigm
2
2
 
3
- Welcome to TargetJ, a powerful JavaScript UI framework and library designed to simplify development and animation, and you might find that it redefines front-end development. (https://targetj.io)
3
+ Welcome to TargetJ, a powerful JavaScript UI framework and library that you might find redefines front-end development. (https://targetj.io)
4
4
 
5
- TargetJ distinguishes itself by introducing a novel concept known as 'targets', which forms its core. Targets are used as the main building blocks of components instead of direct variables and methods. Each component in TargetJ is a set of targets. Targets are employed across all aspects of the program. They are used in animation, controlling program flow, loading data from external APIs, handling user events, and more.
5
+ TargetJ distinguishes itself by introducing a novel concept known as 'targets,' which forms its core. Targets give methods and variable assignments life cycles and the autonomy to operate independently, with various callbacks to adapt to changes, mimicking the behavior of living cells. This opens a new paradigm in programming.
6
6
 
7
7
  ### Installation
8
8
 
@@ -11,24 +11,24 @@ To install TargetJ, run the following command in your terminal:
11
11
  ```bash
12
12
  npm install targetj
13
13
  ```
14
+ ## What are targets?
14
15
 
15
- ## Why TargetJ?
16
-
17
- Imagine building a single-page web app using a unified approach for API integration, animations, event handling, and more—without having to manage asynchronous calls, loops, callbacks, promises, timeouts, state management, CSS, HTML attributes, tags, or HTML nesting. That’s exactly what TargetJ offers: it simplifies the entire development process with a new, simplified paradigm.
18
-
19
- ## Can I integrate TargetJ as a library into my existing page?
20
- Yes, you can integrate TargetJ as a library into your existing page! TargetJ is designed to be flexible and works seamlessly with other libraries and frameworks, allowing you to enhance your page with minimal changes. You can find an example at the end of this page.
16
+ Targets are used as the main building blocks of components instead of direct variables and methods. Each component in TargetJ is a set of targets. Targets are employed across all aspects of the program. They are used in animation, controlling program flow, loading data from external APIs, handling user events, and more.
21
17
 
22
- ## What are targets?
18
+ Targets provide a unified interface for variable assignments and methods, enabling them to operate autonomously. For example, targets give variables the ability to iterate in steps until reaching a specified value, rather than being immediately assigned. Targets can include pauses between these steps, track the progress of other variables, and manage their life cycles dynamically. Methods can execute themselves under specific conditions, control the number of executions, and more.
23
19
 
24
- Targets provide a unified interface for variable assignments and methods, giving them life cycles and the autonomy to operate independently, with various callbacks to adapt to changes, mimicking the behavior of living cells.
20
+ ## Why TargetJ?
25
21
 
26
- For variable assignments, targets enhance functionality by giving them the ability to iterate in steps until they reach the specified value, rather than being immediately assigned their values. They can introduce pauses between iterations and offer callbacks to monitor progress, track the progress of other variables, and manage their life cycles accordingly. Similarly, targets enhance methods by allowing them to manage their own life cycles. They can execute themselves under specific conditions, control the number of executions, and offer the same capabilities as those provided to variables.
22
+ Imagine building a single-page web app using a unified approach for API integration, animations, event handling, and more—without having to manage asynchronous calls, loops, callbacks, promises, timeouts, state management, CSS, HTML attributes, tags, or HTML nesting. That’s exactly what TargetJ offers: it simplifies the entire development process with a new, simplified approach.
27
23
 
28
24
  ## Do I still need HTML and CSS files?
29
25
 
30
26
  No, static HTML or CSS files are not necessary. We believe they introduce complexity, brittleness, and act as an intermediary that diverts focus from the end application. It's better to reduce the gap between the application and the user experience. In TargetJ, HTML elements, styles, and attributes are written as targets, enabling them to function independently while at the same time being well integrated with the other logic targets of the application. This provides a flexible and fluid medium for creating new user experiences that would otherwise be difficult to achieve.
31
27
 
28
+ ## Can I integrate TargetJ as a library into my existing page?
29
+
30
+ Yes, you can integrate TargetJ as a library into your existing page! TargetJ is designed to work as either a library or a framework. It was developed to be flexible and compatible with other libraries and frameworks, allowing you to enhance your page with minimal changes. You can find an example at the end of this page.
31
+
32
32
  ## What does a target consist of?
33
33
 
34
34
  Each target consists of the following:
@@ -57,6 +57,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
57
57
  touch: null,
58
58
  scrollLeft: null,
59
59
  scrollTop: null,
60
+ swipe: null,
60
61
  pinch: null,
61
62
  enterEvent: null,
62
63
  leaveEvent: null,
@@ -337,9 +338,10 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
337
338
  value: function findEventHandlers(_ref) {
338
339
  var tmodel = _ref.tmodel,
339
340
  eventType = _ref.eventType;
340
- var touchHandler, scrollLeftHandler, scrollTopHandler, pinchHandler, focusHandler;
341
+ var touchHandler, swipeHandler, scrollLeftHandler, scrollTopHandler, pinchHandler, focusHandler;
341
342
  if (tmodel) {
342
343
  touchHandler = _SearchUtil.SearchUtil.findFirstTouchHandler(tmodel);
344
+ swipeHandler = _SearchUtil.SearchUtil.findFirstSwipeHandler(tmodel);
343
345
  scrollLeftHandler = _SearchUtil.SearchUtil.findFirstScrollLeftHandler(tmodel, eventType);
344
346
  scrollTopHandler = _SearchUtil.SearchUtil.findFirstScrollTopHandler(tmodel, eventType);
345
347
  pinchHandler = _SearchUtil.SearchUtil.findFirstPinchHandler(tmodel);
@@ -357,6 +359,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
357
359
  this.currentHandlers.blur = this.currentHandlers.focus;
358
360
  }
359
361
  this.currentHandlers.touch = touchHandler;
362
+ this.currentHandlers.swipe = swipeHandler;
360
363
  this.currentHandlers.scrollLeft = scrollLeftHandler;
361
364
  this.currentHandlers.scrollTop = scrollTopHandler;
362
365
  this.currentHandlers.pinch = pinchHandler;
@@ -454,8 +457,8 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
454
457
  this.cursor.x = this.start0.x;
455
458
  this.cursor.y = this.start0.y;
456
459
  this.findEventHandlers(this.lastEvent);
457
- this.swipeStartX = this.start0.x - ((_this$currentHandlers = this.currentHandlers.touch) === null || _this$currentHandlers === void 0 ? void 0 : _this$currentHandlers.getX());
458
- this.swipeStartY = this.start0.y - ((_this$currentHandlers2 = this.currentHandlers.touch) === null || _this$currentHandlers2 === void 0 ? void 0 : _this$currentHandlers2.getY());
460
+ this.swipeStartX = this.start0.x - ((_this$currentHandlers = this.currentHandlers.swipe) === null || _this$currentHandlers === void 0 ? void 0 : _this$currentHandlers.getX());
461
+ this.swipeStartY = this.start0.y - ((_this$currentHandlers2 = this.currentHandlers.swipe) === null || _this$currentHandlers2 === void 0 ? void 0 : _this$currentHandlers2.getY());
459
462
  event.stopPropagation();
460
463
  if (this.ignoreStartEvents) {
461
464
  return;
@@ -520,12 +523,17 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
520
523
  this.currentTouch.key = event.which || event.keyCode;
521
524
  break;
522
525
  case 'resize':
523
- (0, _App.tRoot)().val('width', (0, _App.tRoot)().targets.width());
524
- (0, _App.tRoot)().val('height', (0, _App.tRoot)().targets.height());
526
+ this.resizeRoot();
525
527
  break;
526
528
  }
527
529
  (0, _App.getRunScheduler)().schedule(0, "".concat(originalName, "-").concat(eventName, "-").concat((event.target.tagName || "").toUpperCase()));
528
530
  }
531
+ }, {
532
+ key: "resizeRoot",
533
+ value: function resizeRoot() {
534
+ (0, _App.tRoot)().val('width', (0, _App.tRoot)().targets.width());
535
+ (0, _App.tRoot)().val('height', (0, _App.tRoot)().targets.height());
536
+ }
529
537
  }, {
530
538
  key: "preventDefault",
531
539
  value: function preventDefault(tmodel, eventName) {
@@ -680,7 +688,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
680
688
  }, {
681
689
  key: "hasDelta",
682
690
  value: function hasDelta() {
683
- return Math.abs(this.deltaX()) >= 1 || Math.abs(this.deltaY()) >= 1;
691
+ return Math.abs(this.deltaX()) >= 0 || Math.abs(this.deltaY()) >= 0;
684
692
  }
685
693
  }, {
686
694
  key: "isEndEvent",
@@ -85,6 +85,8 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
85
85
  }, {
86
86
  key: "onPageClose",
87
87
  value: function onPageClose(visibles) {
88
+ (0, _App.getLocationManager)().resizeLastUpdate = _TUtil.TUtil.now();
89
+ (0, _App.getEvents)().resizeRoot();
88
90
  visibles.forEach(function (tmodel) {
89
91
  (0, _App.getLocationManager)().runEventTargets(tmodel, ['onPageClose', 'onResize']);
90
92
  });
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.RunScheduler = void 0;
7
7
  var _TUtil = require("./TUtil.js");
8
8
  var _App = require("./App.js");
9
- var _TargetExecutor = require("./TargetExecutor.js");
10
9
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11
10
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
12
11
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
@@ -32,8 +31,6 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
32
31
  this.rerunId = '';
33
32
  this.delayProcess = undefined;
34
33
  this.resetting = false;
35
- this.rerunQueue = [];
36
- this.isRunningRerun = false;
37
34
  }
38
35
  return _createClass(RunScheduler, [{
39
36
  key: "resetRuns",
@@ -60,9 +57,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
60
57
  this.rerunId = '';
61
58
  this.delayProcess = undefined;
62
59
  this.resetting = false;
63
- this.rerunQueue = [];
64
- this.isRunningRerun = false;
65
- case 14:
60
+ case 12:
66
61
  case "end":
67
62
  return _context.stop();
68
63
  }
@@ -101,7 +96,6 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
101
96
  this.runId = runId;
102
97
  this.runningFlag = true;
103
98
  this.runStartTime = _TUtil.TUtil.now();
104
- _TargetExecutor.TargetExecutor.needsRerun = false;
105
99
  (0, _App.getEvents)().captureEvents();
106
100
  if ((0, _App.getManager)().doneTargets.length > 0) {
107
101
  (0, _App.getManager)().completeDoneTModels();
@@ -120,7 +114,8 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
120
114
  }
121
115
  }
122
116
  if (_App.tApp.debugLevel === 1) {
123
- _TUtil.TUtil.log(true)("Request from: ".concat(runId, " delay: ").concat(delay, " ").concat(runningStep, " ").concat(this.domProcessing));
117
+ var _this$delayProcess2;
118
+ _TUtil.TUtil.log(true)("Request from: ".concat(runId, " dly: ").concat(delay, " step:").concat(runningStep, " dom:").concat(this.domProcessing, " runs:").concat(this.nextRuns.length, " D:").concat((_this$delayProcess2 = this.delayProcess) === null || _this$delayProcess2 === void 0 ? void 0 : _this$delayProcess2.delay));
124
119
  }
125
120
  if (this.domProcessing === 0) {
126
121
  this.needsRerun();
@@ -130,36 +125,13 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
130
125
  key: "needsRerun",
131
126
  value: function needsRerun() {
132
127
  this.runningFlag = false;
133
- if (this.rerunQueue.length > 0) {
134
- return;
135
- }
136
128
  if (this.rerunId) {
137
- this.rerunQueue.push(this.rerunId);
129
+ this.schedule(1, "rerun-".concat(this.rerunId));
138
130
  } else if (!this.delayProcess || this.delayProcess.delay > 15) {
139
131
  if ((0, _App.getEvents)().eventQueue.length > 0) {
140
132
  this.schedule(15, "events-".concat((0, _App.getEvents)().eventQueue.length));
141
- } else if (_TargetExecutor.TargetExecutor.needsRerun) {
142
- this.schedule(15, 'targetExecutor-needsRerun');
143
133
  }
144
134
  }
145
- if (this.rerunQueue.length > 0 && !this.isRunningRerun) {
146
- this.processRerunQueue();
147
- }
148
- }
149
- }, {
150
- key: "doesExecuterNeedsRerun",
151
- value: function doesExecuterNeedsRerun() {
152
- return _TargetExecutor.TargetExecutor.needsRerun;
153
- }
154
- }, {
155
- key: "processRerunQueue",
156
- value: function processRerunQueue() {
157
- this.isRunningRerun = true;
158
- while (this.rerunQueue.length > 0) {
159
- var nextRunId = this.rerunQueue.shift();
160
- this.run(0, nextRunId);
161
- }
162
- this.isRunningRerun = false;
163
135
  }
164
136
  }, {
165
137
  key: "domOperations",
@@ -198,23 +170,39 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
198
170
  key: "setDelayProcess",
199
171
  value: function setDelayProcess(runId, insertTime, runTime, delay) {
200
172
  var _this3 = this;
201
- this.delayProcess = {
202
- runId: runId,
203
- insertTime: insertTime,
204
- runTime: runTime,
205
- delay: delay,
206
- timeoutId: setTimeout(function () {
207
- _this3.run(delay, runId);
208
- var nextRun = _this3.nextRuns.length > 0 ? _this3.nextRuns.shift() : undefined;
209
- if (nextRun) {
210
- var now = _TUtil.TUtil.now();
211
- var newDelay = Math.max(0, nextRun.delay - (now - nextRun.insertTime));
212
- _this3.setDelayProcess(nextRun.runId, nextRun.insertTime, now + newDelay, newDelay);
213
- } else {
214
- _this3.delayProcess = undefined;
215
- }
216
- }, delay)
217
- };
173
+ if (delay > 0) {
174
+ this.delayProcess = {
175
+ runId: runId,
176
+ insertTime: insertTime,
177
+ runTime: runTime,
178
+ delay: delay,
179
+ timeoutId: setTimeout(function () {
180
+ _this3.run(delay, runId);
181
+ _this3.executeNextRun();
182
+ }, delay)
183
+ };
184
+ } else {
185
+ this.delayProcess = {
186
+ runId: runId,
187
+ insertTime: insertTime,
188
+ runTime: runTime,
189
+ delay: 0
190
+ };
191
+ this.run(delay, runId);
192
+ this.executeNextRun();
193
+ }
194
+ }
195
+ }, {
196
+ key: "executeNextRun",
197
+ value: function executeNextRun() {
198
+ var nextRun = this.nextRuns.length > 0 ? this.nextRuns.shift() : undefined;
199
+ if (nextRun) {
200
+ var now = _TUtil.TUtil.now();
201
+ var newDelay = nextRun.delay - (now - nextRun.insertTime);
202
+ this.setDelayProcess(nextRun.runId, nextRun.insertTime, now + newDelay, newDelay);
203
+ } else {
204
+ this.delayProcess = undefined;
205
+ }
218
206
  }
219
207
  }, {
220
208
  key: "delayRun",
@@ -71,6 +71,13 @@ var SearchUtil = exports.SearchUtil = /*#__PURE__*/function () {
71
71
  eventName: 'scrollLeft'
72
72
  });
73
73
  }
74
+ }, {
75
+ key: "findFirstSwipeHandler",
76
+ value: function findFirstSwipeHandler(tmodel) {
77
+ return this.findFirstHandler(tmodel, {
78
+ eventName: 'swipe'
79
+ });
80
+ }
74
81
  }, {
75
82
  key: "findFirstTouchHandler",
76
83
  value: function findFirstTouchHandler(tmodel) {
@@ -11,10 +11,10 @@ var _App = require("./App.js");
11
11
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
12
12
  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; }
13
13
  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; }
14
+ 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; }
14
15
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
15
16
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
16
17
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
17
- 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; }
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
19
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
20
  /**
@@ -61,9 +61,6 @@ var TargetExecutor = exports.TargetExecutor = /*#__PURE__*/function () {
61
61
  tmodel.addToStyleTargetList(key);
62
62
  tmodel.setTargetMethodName(key, 'value');
63
63
  tmodel.updateTargetStatus(key);
64
- if (tmodel.isTargetUpdating(key) || tmodel.isTargetActive(key)) {
65
- TargetExecutor.needsRerun = true;
66
- }
67
64
  }
68
65
  }, {
69
66
  key: "assignListTarget",
@@ -148,5 +145,4 @@ var TargetExecutor = exports.TargetExecutor = /*#__PURE__*/function () {
148
145
  }
149
146
  }
150
147
  }]);
151
- }();
152
- _defineProperty(TargetExecutor, "needsRerun", false);
148
+ }();
@@ -63,7 +63,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
63
63
  return;
64
64
  }
65
65
  if (tmodel.isExecuted(key) && tmodel.getTargetStep(key) === tmodel.getTargetSteps(key)) {
66
- if (tmodel.isScheduledPending(key)) {
66
+ if (tmodel.isScheduledPending(key) && (0, _App.getRunScheduler)().nextRuns.length > 0) {
67
67
  return;
68
68
  }
69
69
  var schedulePeriod = _TargetUtil.TargetUtil.scheduleExecution(tmodel, key);
@@ -117,10 +117,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
117
117
  try {
118
118
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
119
119
  var key = _step2.value;
120
- if (tmodel.isScheduledPending(key)) {
121
- continue;
122
- }
123
- if (!tmodel.hasDom() && tmodel.allStyleTargetMap[key]) {
120
+ if (tmodel.isScheduledPending(key) && (0, _App.getRunScheduler)().nextRuns.length > 0) {
124
121
  continue;
125
122
  }
126
123
  schedulePeriod = _TargetUtil.TargetUtil.scheduleExecution(tmodel, key);
@@ -465,6 +465,12 @@ _defineProperty(TargetUtil, "touchEventMap", {
465
465
  onTouchEnd: function onTouchEnd(tmodel) {
466
466
  return (0, _App.getEvents)().isEndEvent() && (0, _App.getEvents)().containsTouchHandler(tmodel);
467
467
  },
468
+ onEnterEvent: function onEnterEvent(tmodel) {
469
+ return (0, _App.getEvents)().isEnterEventHandler(tmodel);
470
+ },
471
+ onLeaveEvent: function onLeaveEvent(tmodel) {
472
+ return (0, _App.getEvents)().isLeaveEventHandler(tmodel);
473
+ },
468
474
  onSwipeEvent: function onSwipeEvent(tmodel) {
469
475
  return (0, _App.getEvents)().containsTouchHandler(tmodel) && (0, _App.getEvents)().isSwipeEvent();
470
476
  },
@@ -473,12 +479,6 @@ _defineProperty(TargetUtil, "touchEventMap", {
473
479
  },
474
480
  onTouchEvent: function onTouchEvent(tmodel) {
475
481
  return (0, _App.getEvents)().isTouchHandler(tmodel);
476
- },
477
- onEnterEvent: function onEnterEvent(tmodel) {
478
- return (0, _App.getEvents)().isEnterEventHandler(tmodel);
479
- },
480
- onLeaveEvent: function onLeaveEvent(tmodel) {
481
- return (0, _App.getEvents)().isLeaveEventHandler(tmodel);
482
482
  }
483
483
  });
484
484
  _defineProperty(TargetUtil, "internalEventMap", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "targetj",
3
- "version": "1.0.122",
3
+ "version": "1.0.124",
4
4
  "keywords": [
5
5
  "targetj"
6
6
  ],