targetj 1.0.154 → 1.0.156

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
@@ -5,7 +5,7 @@
5
5
  [![Stars](https://img.shields.io/github/stars/livetrails/targetjs.svg)](https://github.com/livetrails/targetjs/stargazers)
6
6
  [![npm version](https://img.shields.io/npm/v/targetj.svg)](https://www.npmjs.com/package/targetj)
7
7
 
8
- TargetJS is a modern JavaScript UI framework designed to simplify front-end development by introducing a unique paradigm centered around Targets, which function as **enhanced variables and methods** with **lifecycles**. This approach provides a unified solution for UI rendering, animations, API interactions, state management, and event handling, leading to more compact code and a stronger focus on user experience. TargetJS is also a highly performant web framework, as shown in the [framework benchmark](https://krausest.github.io/js-framework-benchmark/current.html).
8
+ TargetJS is a modern JavaScript UI framework designed to simplify front-end development by introducing a unique paradigm based on literal objects and extending their properties and methods with lifecycles and functional pipelines. The framework provides a unified solution for UI rendering, animations, API interactions, state management, and event handling, leading to more compact code and a stronger focus on user experience. TargetJS is also a highly performant web framework, as shown in the [framework benchmark](https://krausest.github.io/js-framework-benchmark/current.html).
9
9
  ## What Problems Does TargetJS Solve?
10
10
 
11
11
  TargetJS addresses several common pain points in front-end development:
@@ -55,7 +55,7 @@ npm install targetj
55
55
 
56
56
  ## Key Features and Concepts
57
57
 
58
- * **Targets:** The fundamental building blocks of TargetJS. Targets provide a unified interface for variables and methods with built-in lifecycles. They can:
58
+ * **Targets:** The fundamental building blocks of TargetJS. Targets provide a unified interface for properties and methods with built-in lifecycles. They can:
59
59
  * Iterate towards values (useful for animations and transitions).
60
60
  * Execute conditionally.
61
61
  * Manage repeated executions.
@@ -70,7 +70,7 @@ npm install targetj
70
70
 
71
71
  * **Unique computational paradigm:** TargetJS introduces a novel computational model by integrating multiple paradigms: Turing Completeness, the Von Neumann Execution Model, and Functional Programming. This results in:
72
72
 
73
- * Deterministic Execution Flow: Targets execute based on their activation order, initially following their order in the code. They run in sequence as part of the task processing cycle. Everything in TargetJS is synchronous, and targets cannot be called directly.
73
+ * Deterministic Execution Flow: Targets execute based on their activation order, initially following their order in the code. They run in sequence as part of the framework execution cycle. Everything in TargetJS is synchronous, and targets cannot be called directly.
74
74
  * Powerful Functional Pipeline: Targets can be structured as a functional pipeline with enhanced capabilities.
75
75
 
76
76
  * **Easy Integration:** Can be used as a library within existing projects.
@@ -109,11 +109,11 @@ In this example, we load one user and display its name.
109
109
  ![first example](https://targetjs.io/img/quick2_4.gif)
110
110
 
111
111
  ```bash
112
- import { App, getLoader } from "targetj";
112
+ import { App, fetch } from "targetj";
113
113
 
114
114
  App({
115
115
  loadUser() {
116
- getLoader().fetch(this, "https://targetjs.io/api/randomUser", { id: "user0" });
116
+ fetch(this, "https://targetjs.io/api/randomUser", { id: "user0" });
117
117
  },
118
118
  _html$() {
119
119
  return this.prevTargetValue.name;
@@ -132,12 +132,12 @@ TargetJS ensures that API results are processed in the same sequence as the API
132
132
  ![first example](https://targetjs.io/img/quick3_1.gif)
133
133
 
134
134
  ```bash
135
- import { App, getLoader } from "targetj";
135
+ import { App, fetch } from "targetj";
136
136
 
137
137
  App({
138
138
  loadUsers() {
139
- getLoader().fetch(this, "https://targetjs.io/api/randomUser", { id: "user0" });
140
- getLoader().fetch(this, "https://targetjs.io/api/randomUser", { id: "user1" });
139
+ fetch(this, "https://targetjs.io/api/randomUser", { id: "user0" });
140
+ fetch(this, "https://targetjs.io/api/randomUser", { id: "user1" });
141
141
  },
142
142
  _children$() {
143
143
  return {
@@ -152,32 +152,39 @@ App({
152
152
 
153
153
  ## Comparison with Other UI Frameworks
154
154
 
155
- | Feature | TargetJS | Reactive Model Frameworks |
156
- |--------------------------------------|-----------------------------------------------------------------|------------------------------------------------------|
157
- | **Component Basic Structure** | Components consist of Targets, providing a unified interface for methods and variables. | Components consist of methods and variables.
158
- | **Execution Order** | Components consist of Targets, providing a unified interface for methods and variables. | Primarily data-driven, less predictable. |
159
- | **Function Calls** | Targets cannot be called directly. Execution is part of a task cycle. | Functions execute reactively or are called imperatively. |
160
- | **Autonomous Execution** | Targets can self-activate and operate autonomously. | Functions do not execute autonomously. |
161
- | **Execution Pipeline** | Targets can form controlled pipelines; a target can activate when the preceding target executes or completes. | Functions are called whenever dependencies update. Execution order is not based on code appearance. |
162
- | **Event Handling** | Primarily by activating Targets, making event handling consistent with the core execution model. | Events are handled through event listeners, subscriptions, or reactive bindings. |
163
- | **State Management** | Unified within Targets; no external state libraries needed. | State is often managed through reactive stores. |
164
- | **UI Organization and Animation** | UI controlled by Targets; styles incorporated directly. Animations handled directly by Targets, with step-by-step updates. | Component-based rendering and reactivity. Animations via CSS transitions, JavaScript, or external libraries. |
165
- | **HTML and Nesting** | Minimal HTML reliance; code is the primary driver. Dynamic nesting. | HTML structure is an integral part of UI frameworks. Components and templates define static layouts; JSX or templates are used.|
166
- | **CSS Handling** | CSS is optional; styles can be incorporated directly as Targets. | External stylesheets, CSS-in-JS, or utility-first CSS (e.g., Tailwind). Styles are often separate from logic. |
167
- | **API Calls** | Can be chained in a pipeline; the bottom target activates only when each call is completed in the order invoked or when all calls are complete. | Usually handled with Promises, async/await, or reactive effects; less structured execution. |
168
- | **Large List Performance** | Optimized with an internal tree structure; monitors only the visible branch. | Can require careful optimization for very large lists (e.g., virtualization).
169
- | **Workflow development** | Targets offer a unified solution for UI , animation, event handling, API calls, and state management. | Multiple technologies, commands, and approaches.
170
- | **Execution control by time** | TargetJS enables easy sequencing and parallelization for complex UI behaviors. | Not easily accomplished.
155
+ | Feature | TargetJS | Reactive Model Frameworks |
156
+ |--------------------------------------|------------------------------------------------------------------------|-------------------------------------------------------------------|
157
+ | **Component Basic Structure** | Provides a unified interface where methods and properties are treated identically. | Methods and variables are distinct. |
158
+ | **Execution Order** | Targets are executed based on their activation order, which initially follows their appearance in the code. They run in a sequential and predictable manner. | Less predictable. |
159
+ | **Function Calls** | Targets cannot be called directly. Execution is part of a framework execution cycle, ensuring synchronization. | Functions can be called directly and are less synchronous. |
160
+ | **Autonomous Execution** | Targets can self-activate and operate autonomously, and have the ability to schedule their execution by time. | Functions do not execute autonomously. Control flow with time is difficult. |
161
+ | **Execution Pipeline** | Targets can form controlled pipelines; a target can activate when the preceding target executes or completes. | Function pipelines are limited. |
162
+ | **Event Handling** | By activating targets, event handling becomes synchronous and consistent with the core execution model. | Events are handled asynchronously. |
163
+ | **State Management** | Unified within targets; no external state libraries needed. | State management is often an issue. |
164
+ | **Animations** | Animations are handled directly by targets and are consistent with the rest of the program. | CSS transitions or external libraries. |
165
+ | **HTML and Nesting** | Built to enhance HTML elements with any logic and is less reliant on HTML blocks. | HTML structure is an integral part of UI frameworks. |
166
+ | **CSS Handling** | CSS is optional; styles can be incorporated directly as targets. | Styles are often separate from logic. |
167
+ | **API Calls** | API results are synchronous and can be chained in a pipeline. | Usually handled with Promises, async/await, less structured execution. |
168
+ | **Large List Performance** | Optimized with an internal tree structure; monitors only the visible branch. | Can require careful optimization. |
169
+ | **Workflow Development** | Targets offer a unified solution for UI, animation, event handling, API calls, and state management. | Multiple technologies and approaches. |
170
+ | **Execution Control by Time** | TargetJS enables easy sequencing and parallelization for complex UI behaviors. | Not easily accomplished. |
171
+
171
172
 
172
173
  ## The Core of TargetJS
173
174
 
174
- TargetJS utilizes literal JavaScript objects for target definitions, providing a compact and readable format. Targets offer a unified interface that encompasses both properties and functions.
175
- TargetJS leverages ES2015's guaranteed property order to ensure that target execution follows the order in which the code is written.
175
+ TargetJS utilizes literal JavaScript objects for target definitions, providing a compact and readable format. The core principles are:
176
+
177
+ - Provide an internal wrapper (called "targets") for both properties and methods of the literal object.
178
+ - Execute targets sequentially, in the order they are written leveraging ES2015's guaranteed property order.
179
+ - Enable functional pipelines between adjacent targets.
180
+ - Add lifecycles, looping, and timing to targets, enabling them to execute or re-execute based on conditions or time.
181
+
182
+ That's the basic idea. Learn more [here](https://dev.to/ahmad_wasfi_f88513699c56d/targetjs-rethinking-ui-with-declarative-synchronous-pipelines-5bbi).
176
183
 
177
184
  ## Anatomy of a Target
178
185
 
179
186
  Each target consists of the following:
180
- 1. Target Value and Actual Value. The target value refers to the value assigned to a variable or the output produced by the `value()` method associated with the target defined in your program. The actual value is the value used by the rest of the application. When the target value differs from the actual value, TargetJS iteratively updates the actual value until it matches the target value. This process is managed by two additional variables: `step`, which dictates the number of iterations, and `interval`, which specifies the duration (in milliseconds) the system waits before executing the next iteration.
187
+ 1. Target Value and Actual Value. The target value refers to the value assigned to a property or the output produced by the `value()` method associated with the target defined in your program. The actual value is the value used by the rest of the application. When the target value differs from the actual value, TargetJS iteratively updates the actual value until it matches the target value. This process is managed by two additional variables: `step`, which dictates the number of iterations, and `interval`, which specifies the duration (in milliseconds) the system waits before executing the next iteration.
181
188
 
182
189
  2. State: Targets have four states that control their lifecycles: `active`, `inactive`, `updating`, and `complete`.
183
190
  - `active`: This is the default state for all targets. It indicates that the target is ready to be executed, and the target value needs to be initialized from the variable it represents or its `value()` method needs to be executed to calculate its output.
@@ -196,7 +203,7 @@ All methods and properties are optional, but they play integral roles in making
196
203
  If defined, value is the primary target method that will be executed. The target value will be calculated based on the result of this method.
197
204
 
198
205
  2. **Prefix `_` to the target name**
199
- It indicates that the target is in an inactive state and must be activated by an event or ther targets.
206
+ It indicates that the target is in an inactive state and must be activated by an event or other targets.
200
207
 
201
208
  3. **active**
202
209
  This is only a property. It indicates whether the target is ready for execution. When set to false, it behaves similarly to a `_ `prefix. By default, all targets are active, so setting it to true is unnecessary.
@@ -229,7 +236,7 @@ By default, the actual value is updated immediately after the target value. The
229
236
  An easing function that operates when steps are defined. It controls how the actual value is updated in relation to the steps.
230
237
 
231
238
  9. **onValueChange**
232
- This callbak is triggered whenever there is a change returned by the target method, which is called value().
239
+ This callback is triggered whenever there is a change returned by the target method, which is called value().
233
240
 
234
241
  10. **onStepsEnd**
235
242
  This method is invoked only after the final step of updating the actual value is completed, assuming the target has a defined steps value.
@@ -407,7 +414,7 @@ If you inspect the HTML elements in the browser's developer tools, you'll notice
407
414
  ![Single page app](https://targetjs.io/img/infiniteScrolling11.gif)
408
415
 
409
416
  ```bash
410
- import { App, getEvents, getLoader, getScreenWidth, getScreenHeight } from "targetj";
417
+ import { App, getEvents, fetch, getScreenWidth, getScreenHeight } from "targetj";
411
418
 
412
419
  App({
413
420
  containerOverflowMode: "always",
@@ -429,7 +436,7 @@ App({
429
436
  },
430
437
  _load$() {
431
438
  this.prevTargetValue.forEach(data =>
432
- getLoader().fetch(this, "https://targetjs.io/api/randomUser", { id: data.oid }));
439
+ fetch(this, "https://targetjs.io/api/randomUser", { id: data.oid }));
433
440
  },
434
441
  _populate$$() {
435
442
  this.prevTargetValue.forEach((data) => this.getChildByOid(data.id).setTarget("html", data.name));
@@ -519,7 +526,7 @@ App({
519
526
  },
520
527
  page2() {
521
528
  return {
522
- ...this.val('page').targets,
529
+ ...this.val('page'),
523
530
  background: "#B388FF",
524
531
  html: 'page2'
525
532
  };
package/build/$Dom.js CHANGED
@@ -302,6 +302,11 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
302
302
  value: function outerHTML(html) {
303
303
  this.element.outerHTML = html;
304
304
  }
305
+ }, {
306
+ key: "isEmpty",
307
+ value: function isEmpty() {
308
+ return this.element.innerHTML === '';
309
+ }
305
310
  }, {
306
311
  key: "innerHTML",
307
312
  value: function innerHTML(html) {
@@ -391,7 +396,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
391
396
  }, {
392
397
  key: "stamp",
393
398
  value: function stamp() {
394
- this.attr('data-tgt', 'true');
399
+ this.attr('data-tgjs', 'true');
395
400
  }
396
401
  }], [{
397
402
  key: "createTemplate",
@@ -404,7 +409,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
404
409
  }, {
405
410
  key: "getAllStamped",
406
411
  value: function getAllStamped() {
407
- return document.querySelectorAll('[data-tgt="true"]');
412
+ return document.querySelectorAll('[data-tgjs="true"]');
408
413
  }
409
414
  }, {
410
415
  key: "query",
package/build/App.js CHANGED
@@ -4,7 +4,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.tRoot = exports.tApp = exports.isRunning = exports.getVisibles = exports.getScreenWidth = exports.getScreenHeight = exports.getRunScheduler = exports.getResizeLastUpdate = exports.getPager = exports.getManager = exports.getLocationManager = exports.getLoader = exports.getEvents = exports.getBrowser = exports.App = void 0;
7
+ exports.tRoot = exports.tApp = exports.isRunning = exports.getVisibles = exports.getScreenWidth = exports.getScreenHeight = exports.getRunScheduler = exports.getResizeLastUpdate = exports.getPager = exports.getManager = exports.getLocationManager = exports.getLoader = exports.getEvents = exports.getBrowser = exports.fetchImage = exports.fetch = exports.App = void 0;
8
8
  var _$Dom = require("./$Dom.js");
9
9
  var _TModel = require("./TModel.js");
10
10
  var _Browser = require("./Browser.js");
@@ -15,6 +15,7 @@ var _PageManager = require("./PageManager.js");
15
15
  var _TModelManager = require("./TModelManager.js");
16
16
  var _RunScheduler = require("./RunScheduler.js");
17
17
  var _TargetManager = require("./TargetManager.js");
18
+ var _TargetExecutor = require("./TargetExecutor.js");
18
19
  var _TUtil = require("./TUtil.js");
19
20
  var _SearchUtil = require("./SearchUtil.js");
20
21
  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; }
@@ -27,6 +28,7 @@ var AppFn = function AppFn(firstChild) {
27
28
  my.debugLevel = 0;
28
29
  my.runningFlag = false;
29
30
  my.resizeLastUpdate = 0;
31
+ my.pageIsEmpty = false;
30
32
  my.init = function () {
31
33
  my.browser = new _Browser.Browser();
32
34
  my.browser.setup();
@@ -46,15 +48,15 @@ var AppFn = function AppFn(firstChild) {
46
48
  my.tRootFactory = function () {
47
49
  var tmodel = new _TModel.TModel('tRoot', {
48
50
  start: function start() {
49
- if (!_$Dom.$Dom.query('#tj-root')) {
51
+ if (!_$Dom.$Dom.query('#tgjs-root')) {
50
52
  this.$dom = new _$Dom.$Dom();
51
53
  this.$dom.create('div');
52
- this.$dom.setSelector('#tj-root');
53
- this.$dom.setId('#tj-root');
54
+ this.$dom.setSelector('#tgjs-root');
55
+ this.$dom.setId('#tgjs-root');
54
56
  this.$dom.attr("tabindex", "0");
55
57
  new _$Dom.$Dom('body').insertFirst$Dom(this.$dom);
56
58
  } else {
57
- this.$dom = new _$Dom.$Dom('#tj-root');
59
+ this.$dom = new _$Dom.$Dom('#tgjs-root');
58
60
  }
59
61
  },
60
62
  styling: false,
@@ -102,17 +104,20 @@ var AppFn = function AppFn(firstChild) {
102
104
  while (1) switch (_context.prev = _context.next) {
103
105
  case 0:
104
106
  my.runningFlag = false;
107
+ _TargetExecutor.TargetExecutor.executeDeclarativeTarget(my.tRoot, 'width');
108
+ _TargetExecutor.TargetExecutor.executeDeclarativeTarget(my.tRoot, 'height');
105
109
  my.events.detachAll();
106
110
  my.events.detachWindowEvents();
107
111
  my.events.attachWindowEvents();
108
112
  my.events.clearAll();
109
- _context.next = 7;
113
+ my.events.attachEvents(my.manager.lists.visible);
114
+ _context.next = 10;
110
115
  return my.runScheduler.resetRuns();
111
- case 7:
116
+ case 10:
112
117
  my.runningFlag = true;
113
118
  my.runScheduler.schedule(0, "appStart");
114
119
  return _context.abrupt("return", my);
115
- case 10:
120
+ case 13:
116
121
  case "end":
117
122
  return _context.stop();
118
123
  }
@@ -164,8 +169,7 @@ var App = exports.App = function App(tmodel) {
164
169
  };
165
170
  App.oids = {};
166
171
  App.getOid = function (type) {
167
- var _App$tRoot;
168
- var oids = type === 'Bracket' ? App.oids : (App === null || App === void 0 || (_App$tRoot = App.tRoot) === null || _App$tRoot === void 0 ? void 0 : _App$tRoot.oids) || App.oids;
172
+ var oids = App.oids;
169
173
  if (!_TUtil.TUtil.isDefined(oids[type])) {
170
174
  oids[type] = 0;
171
175
  }
@@ -194,36 +198,44 @@ var getLoader = exports.getLoader = function getLoader() {
194
198
  var _tApp4;
195
199
  return (_tApp4 = tApp) === null || _tApp4 === void 0 ? void 0 : _tApp4.loader;
196
200
  };
197
- var getManager = exports.getManager = function getManager() {
201
+ var fetch = exports.fetch = function fetch(tmodel, url, query, cacheId) {
198
202
  var _tApp5;
199
- return (_tApp5 = tApp) === null || _tApp5 === void 0 ? void 0 : _tApp5.manager;
203
+ return (_tApp5 = tApp) === null || _tApp5 === void 0 || (_tApp5 = _tApp5.loader) === null || _tApp5 === void 0 ? void 0 : _tApp5.fetch(tmodel, url, query, cacheId);
200
204
  };
201
- var getRunScheduler = exports.getRunScheduler = function getRunScheduler() {
205
+ var fetchImage = exports.fetchImage = function fetchImage(tmodel, src, cacheId) {
202
206
  var _tApp6;
203
- return (_tApp6 = tApp) === null || _tApp6 === void 0 ? void 0 : _tApp6.runScheduler;
207
+ return (_tApp6 = tApp) === null || _tApp6 === void 0 || (_tApp6 = _tApp6.loader) === null || _tApp6 === void 0 ? void 0 : _tApp6.fetchImage(tmodel, src, cacheId);
204
208
  };
205
- var getLocationManager = exports.getLocationManager = function getLocationManager() {
209
+ var getManager = exports.getManager = function getManager() {
206
210
  var _tApp7;
207
- return (_tApp7 = tApp) === null || _tApp7 === void 0 ? void 0 : _tApp7.locationManager;
211
+ return (_tApp7 = tApp) === null || _tApp7 === void 0 ? void 0 : _tApp7.manager;
208
212
  };
209
- var getBrowser = exports.getBrowser = function getBrowser() {
213
+ var getRunScheduler = exports.getRunScheduler = function getRunScheduler() {
210
214
  var _tApp8;
211
- return (_tApp8 = tApp) === null || _tApp8 === void 0 ? void 0 : _tApp8.browser;
215
+ return (_tApp8 = tApp) === null || _tApp8 === void 0 ? void 0 : _tApp8.runScheduler;
216
+ };
217
+ var getLocationManager = exports.getLocationManager = function getLocationManager() {
218
+ var _tApp9;
219
+ return (_tApp9 = tApp) === null || _tApp9 === void 0 ? void 0 : _tApp9.locationManager;
220
+ };
221
+ var getBrowser = exports.getBrowser = function getBrowser() {
222
+ var _tApp10;
223
+ return (_tApp10 = tApp) === null || _tApp10 === void 0 ? void 0 : _tApp10.browser;
212
224
  };
213
225
  var getScreenWidth = exports.getScreenWidth = function getScreenWidth() {
214
- var _tApp$tRoot$getWidth, _tApp9;
215
- return (_tApp$tRoot$getWidth = (_tApp9 = tApp) === null || _tApp9 === void 0 || (_tApp9 = _tApp9.tRoot) === null || _tApp9 === void 0 ? void 0 : _tApp9.getWidth()) !== null && _tApp$tRoot$getWidth !== void 0 ? _tApp$tRoot$getWidth : 0;
226
+ var _tApp$tRoot$getWidth, _tApp11;
227
+ return (_tApp$tRoot$getWidth = (_tApp11 = tApp) === null || _tApp11 === void 0 || (_tApp11 = _tApp11.tRoot) === null || _tApp11 === void 0 ? void 0 : _tApp11.getWidth()) !== null && _tApp$tRoot$getWidth !== void 0 ? _tApp$tRoot$getWidth : 0;
216
228
  };
217
229
  var getScreenHeight = exports.getScreenHeight = function getScreenHeight() {
218
- var _tApp$tRoot$getHeight, _tApp10;
219
- return (_tApp$tRoot$getHeight = (_tApp10 = tApp) === null || _tApp10 === void 0 || (_tApp10 = _tApp10.tRoot) === null || _tApp10 === void 0 ? void 0 : _tApp10.getHeight()) !== null && _tApp$tRoot$getHeight !== void 0 ? _tApp$tRoot$getHeight : 0;
230
+ var _tApp$tRoot$getHeight, _tApp12;
231
+ return (_tApp$tRoot$getHeight = (_tApp12 = tApp) === null || _tApp12 === void 0 || (_tApp12 = _tApp12.tRoot) === null || _tApp12 === void 0 ? void 0 : _tApp12.getHeight()) !== null && _tApp$tRoot$getHeight !== void 0 ? _tApp$tRoot$getHeight : 0;
220
232
  };
221
233
  var getVisibles = exports.getVisibles = function getVisibles() {
222
- var _tApp11;
223
- return (_tApp11 = tApp) === null || _tApp11 === void 0 || (_tApp11 = _tApp11.manager) === null || _tApp11 === void 0 ? void 0 : _tApp11.lists.visible;
234
+ var _tApp13;
235
+ return (_tApp13 = tApp) === null || _tApp13 === void 0 || (_tApp13 = _tApp13.manager) === null || _tApp13 === void 0 ? void 0 : _tApp13.lists.visible;
224
236
  };
225
237
  var getResizeLastUpdate = exports.getResizeLastUpdate = function getResizeLastUpdate() {
226
- var _tApp12;
227
- return (_tApp12 = tApp) === null || _tApp12 === void 0 ? void 0 : _tApp12.resizeLastUpdate;
238
+ var _tApp14;
239
+ return (_tApp14 = tApp) === null || _tApp14 === void 0 ? void 0 : _tApp14.resizeLastUpdate;
228
240
  };
229
241
  window.t = window.t || _SearchUtil.SearchUtil.find;
@@ -51,8 +51,10 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
51
51
  this.updatingChildrenMap = {};
52
52
  this.activeChildrenList = [];
53
53
  this.activeChildrenMap = {};
54
- this.eventTargetList = [];
55
- this.eventTargetMap = {};
54
+ this.externalEventList = [];
55
+ this.externalEventMap = {};
56
+ this.internalEventList = [];
57
+ this.internalEventMap = {};
56
58
  this.coreTargets = [];
57
59
  this.allStyleTargetList = [];
58
60
  this.allStyleTargetMap = {};
@@ -78,10 +80,10 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
78
80
  this.targetValues = {};
79
81
  this.activeTargetMap = {};
80
82
  this.activeTargetList = [];
81
- var targetNames = Object.keys(this.targets);
83
+ this.originalTargetNames = Object.keys(this.targets);
82
84
  var domExists = _$Dom.$Dom.query("#".concat(this.oid));
83
85
  if (!domExists && !this.excludeDefaultStyling()) {
84
- Object.entries(_TModelUtil.TModelUtil.defaultTargetStyles()).forEach(function (_ref) {
86
+ Object.entries(_TargetData.TargetData.defaultTargetStyles).forEach(function (_ref) {
85
87
  var _ref2 = _slicedToArray(_ref, 2),
86
88
  key = _ref2[0],
87
89
  value = _ref2[1];
@@ -91,14 +93,17 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
91
93
  });
92
94
  } else if (domExists && !_TUtil.TUtil.isDefined(this.targets['reuseDomDefinition'])) {
93
95
  this.targets['reuseDomDefinition'] = true;
96
+ this.targets['excludeX'] = true;
97
+ this.targets['excludeY'] = true;
98
+ this.targets['position'] = 'relative';
94
99
  }
95
100
  Object.keys(this.targets).forEach(function (key) {
96
- _this.processNewTarget(key, targetNames);
101
+ _this.processNewTarget(key);
97
102
  });
98
103
  }
99
104
  }, {
100
105
  key: "processNewTarget",
101
- value: function processNewTarget(key, targetNames) {
106
+ value: function processNewTarget(key) {
102
107
  var target = this.targets[key];
103
108
  var cleanKey = _TargetUtil.TargetUtil.getTargetName(key);
104
109
  if (!_TUtil.TUtil.isDefined(target)) {
@@ -112,12 +117,19 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
112
117
  };
113
118
  target = this.targets[key];
114
119
  }
115
- _TargetUtil.TargetUtil.bindTarget(this, key, targetNames);
120
+ _TargetUtil.TargetUtil.bindTarget(this, key, this.originalTargetNames);
116
121
  }
117
- if (_TargetData.TargetData.allEventMap[cleanKey] || _TargetData.TargetData.internalEventMap[cleanKey]) {
118
- if (!this.eventTargetMap[cleanKey]) {
119
- this.eventTargetList.push(cleanKey);
120
- this.eventTargetMap[cleanKey] = true;
122
+ if (_TargetData.TargetData.allEventMap[cleanKey]) {
123
+ if (!this.externalEventMap[cleanKey]) {
124
+ this.externalEventList.push(cleanKey);
125
+ this.externalEventMap[cleanKey] = true;
126
+ target.active = false;
127
+ }
128
+ }
129
+ if (_TargetData.TargetData.internalEventMap[cleanKey]) {
130
+ if (!this.internalEventMap[cleanKey]) {
131
+ this.internalEventList.push(cleanKey);
132
+ this.internalEventMap[cleanKey] = true;
121
133
  target.active = false;
122
134
  }
123
135
  }
@@ -136,9 +148,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
136
148
  if (_TUtil.TUtil.isDefined(target.initialValue)) {
137
149
  this.val(key, target.initialValue);
138
150
  }
139
- if (!isInactiveKey) {
140
- this.addToStyleTargetList(key);
141
- }
151
+ this.addToStyleTargetList(key);
142
152
  if (_TargetData.TargetData.coreTargetMap[key] && !this.coreTargets.includes(key)) {
143
153
  this.coreTargets.push(key);
144
154
  }
@@ -168,7 +178,6 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
168
178
  key: "deactivate",
169
179
  value: function deactivate() {
170
180
  this.currentStatus = undefined;
171
- this.activatedTargets.length = 0;
172
181
  }
173
182
  }, {
174
183
  key: "shouldExecuteCyclesInParallel",
@@ -480,11 +489,16 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
480
489
  }
481
490
  }, {
482
491
  key: "incrementTargetStep",
483
- value: function incrementTargetStep(key) {
484
- if (this.targetValues[key]) {
485
- this.targetValues[key].step++;
492
+ value: function incrementTargetStep(key, now, lastUpdate, interval, steps) {
493
+ var targetValue = this.targetValues[key];
494
+ if (!targetValue) {
495
+ return;
486
496
  }
487
- return this.targetValues[key].step;
497
+ var stepInterval = interval || 8;
498
+ var elapsed = now - lastUpdate;
499
+ var stepIncrement = Math.max(1, Math.floor(elapsed / stepInterval));
500
+ targetValue.step = Math.min(steps, targetValue.step + stepIncrement);
501
+ return targetValue.step;
488
502
  }
489
503
  }, {
490
504
  key: "getTargetCycles",
@@ -544,11 +558,6 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
544
558
  var targetValue = this.targetValues[key];
545
559
  return (targetValue === null || targetValue === void 0 ? void 0 : targetValue.interval) || 0;
546
560
  }
547
- }, {
548
- key: "getTargetEventFunctions",
549
- value: function getTargetEventFunctions(key) {
550
- return this.targetValues[key] ? this.targetValues[key].events : undefined;
551
- }
552
561
  }, {
553
562
  key: "setTarget",
554
563
  value: function setTarget(key, value, steps, interval, easing) {
@@ -773,6 +782,26 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
773
782
  value: function getCoreTargets() {
774
783
  return _TUtil.TUtil.isDefined(this.val('coreTargets')) ? this.val('coreTargets') : this.coreTargets;
775
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;
804
+ }
776
805
  }, {
777
806
  key: "setTargetMethodName",
778
807
  value: function setTargetMethodName(targetName, methodName) {