targetj 1.0.169 → 1.0.170

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Export.js CHANGED
@@ -6,6 +6,7 @@ export * from "./build/TargetData.js";
6
6
  export * from "./build/TargetUtil.js";
7
7
  export * from "./build/TModelUtil.js";
8
8
  export * from "./build/TUtil.js";
9
+ export * from "./build/DomInit.js"
9
10
  export * from "./build/$Dom.js";
10
11
  export * from "./build/Bracket.js";
11
12
  export * from "./build/BracketGenerator.js";
@@ -21,6 +22,7 @@ import * as TargetData from './build/TargetData.js';
21
22
  import * as TargetUtil from './build/TargetUtil.js';
22
23
  import * as TModelUtil from './build/TModelUtil.js';
23
24
  import * as TUtil from './build/TUtil.js';
25
+ import * as DomInit from './build/DomInit.js';
24
26
  import * as Dom from './build/$Dom.js';
25
27
  import * as Bracket from './build/Bracket.js';
26
28
  import * as BracketGenerator from './build/BracketGenerator.js';
@@ -37,6 +39,7 @@ const TargetJS = {
37
39
  ...TargetUtil,
38
40
  ...TModelUtil,
39
41
  ...TUtil,
42
+ ...DomInit,
40
43
  ...Dom,
41
44
  ...Bracket,
42
45
  ...BracketGenerator,
package/README.md CHANGED
@@ -5,96 +5,39 @@
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 that simplifies front-end development. It introduces a unique paradigm: leveraging literal objects or HTML elements and extending their capabilities with built-in lifecycles and functional pipelines. The framework provides a unified solution for key aspects like UI rendering, animations, API interactions, state management, and event handling. This integrated approach leads to more compact code and allows for a stronger focus on user experience. TargetJS also supports backend generation of its specific HTML elements.
8
+ TargetJS is a modern JavaScript UI framework that simplifies front-end development. It provides a unified solution for key aspects like UI rendering, animations, APIs, state management, and event handling. This integrated approach leads to more compact code and allows for a stronger focus on user experience.
9
9
  Furthermore, it is also a highly performant web framework, as shown in the [framework benchmark](https://krausest.github.io/js-framework-benchmark/current.html).
10
10
  ## What Problems Does TargetJS Solve?
11
11
 
12
12
  TargetJS addresses several common pain points in front-end development:
13
13
 
14
- 1. **Complexity of Asynchronous Operations:** Traditional JavaScript often involves complex handling of asynchronous operations (Promises, callbacks, `async/await`). TargetJS addresses this by providing a structured, synchronous, and predictable execution flow, allowing developers to avoid asynchronous operations altogether.
15
- 2. **Scattered State Management:** Many frameworks require separate libraries or complex patterns for state management. In TargetJS, state management is inherently handled through its core concept of Targets, eliminating the need for direct state management.
16
- 3. **Boilerplate and Verbosity:** TargetJS aims to reduce boilerplate code. The code is compact and follows a predictable execution flow. Method calls are not allowed, and loops and conditional statements are rarely needed.
17
- 4. **Rigid Static Layer of HTML:** Many frameworks use HTML as the primary medium for generating the user interface. TargetJS minimizes reliance on traditional HTML and CSS, allowing JavaScript to be the primary player, resulting in a better and more dynamic user experience.
18
- 5. **Disjointed Development Workflow:** Developers often juggle multiple tools and concepts (UI libraries, animation libraries, state managers, event handlers). TargetJS provides a *unified* solution, simplifying the learning curve and development process.
19
- 6. **Difficult Animation Control:** TargetJS makes animations first-class citizens. It also provides fine-grained control without requiring external libraries.
20
- 7. **Complicated execution flow:** Other frameworks are based on reactive model which often lead to unpredictable execution flow while TargetJS execution is based on the order targets are written.
14
+ 1. **Scattered State Management:** Many frameworks require separate libraries or complex patterns for state management. In TargetJS, state management is inherently handled through its core concept of unifying both methods and variables eliminating the need for direct state management.
15
+ 2. **Complexity of Asynchronous Operations:** Traditional JavaScript often involves complex handling of asynchronous operations (Promises, callbacks, `async/await`). TargetJS addresses this by providing a structured synchronous execution avoiding asynchronous operations altogether.
16
+ 3. **Disjointed Development Workflow:** Developers often juggle multiple tools and concepts (UI libraries, animation libraries, state managers, event handlers). TargetJS provides a unified solution simplifying the learning curve and development process.
17
+ 4. **Rigid Static Layer of HTML:** Many frameworks use HTML as the primary medium for generating the user interface. TargetJS makes JavaScript the primary driver, either by running directly or through a handful of HTML elements extended with superpowers.
18
+ 5. **Boilerplate and Verbosity:** TargetJS aims to reduce boilerplate code. The code is compact and follows a predictable execution flow. Direct method calls are not allowed, and loops and conditional statements are rarely needed.
19
+ 6. **Difficult Animation Control:** TargetJS makes animations first-class citizens with fine-grained control.
20
+ 7. **Complicated execution flow:** Other frameworks are based on reactive model which often lead to unpredictable execution flow while TargetJS execution flow follows the order the code is written.
21
21
  8. **Performance Bottlenecks with Large Lists:** TargetJS optimizes rendering for large lists by using a tree structure that renders only the visible branches.
22
22
 
23
- ## Table of Contents
24
-
25
- 1. [Installation](#installation)
26
- 2. [Key Features and Concepts](#key-features-and-concepts)
27
- 5. Examples:
28
- - [Quick Example: Growing and Shrinking Box](#quick-example-growing-and-shrinking-box)
29
- - [Simple Loading API Example](#simple-loading-api-example)
30
- - [Loading Two Users Example](#loading-two-users-example)
31
- 6. [Comparison with Other UI Frameworks](#comparison-with-other-ui-frameworks)
32
- 7. [The Core of TargetJS](#the-core-of-targetjs)
33
- 8. [Anatomy of a Target](#anatomy-of-a-target)
34
- 9. [Target Methods](#target-methods)
35
- 10. [Target Variables](#target-variables)
36
- 11. More Examples:
37
- - [Basic Example](#basic-example)
38
- - [Declarative and Imperative Targets Example](#declarative-and-imperative-targets-example)
39
- - [Infinite Loading and Scrolling Example](#infinite-loading-and-scrolling-example)
40
- - [Simple SPA Example](#simple-spa-example)
41
- - [Using TargetJS as a Library Example](#using-targetjs-as-a-library-example)
42
- 12. [Special Target Names](#special-target-names)
43
- 13. [How to Debug in TargetJS](#how-to-debug-in-targetjs)
44
- 14. [Documentation](#documentation)
45
- 15. [License](#license)
46
- 16. [Contact](#contact)
47
- 17. [Call to Action](#call-to-action)
48
-
49
- ## **📦 Installation**
50
-
51
- Install TargetJS via npm (note that there is no 's' at the end):
52
-
53
- ```bash
54
- npm install targetj
55
- ```
56
-
57
- ## Key Features and Concepts
58
-
59
- * **Targets:** The fundamental building blocks of TargetJS. Targets provide a unified interface for properties and methods with built-in lifecycles. They can:
60
- * Iterate towards values (useful for animations and transitions).
61
- * Execute conditionally.
62
- * Manage repeated executions.
63
- * Control execution timing (useful for UI operations and advanced animations).
64
- * Form synchronous execution pipelines (similar to assembling Lego).
65
- * Track the execution progress of other targets.
66
- * Declarative execution (execution follows the way the code is written).
67
- * Compact code (No unnecessary function calls, minimal if statements and loops).
68
- * Manage their own state.
69
-
70
- * **Unified Approach:** Targets handle UI updates, API calls, animations, state, and events, reducing the need to learn and integrate multiple libraries.
71
-
72
- * **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:
73
-
74
- * 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.
75
- * Powerful Functional Pipeline: Targets can be structured as a functional pipeline with enhanced capabilities.
76
-
77
- * **Easy Integration:** Can be used as a library within existing projects.
78
-
79
23
  ## Examples
80
-
81
24
  ### Quick Example: Growing and Shrinking Box
82
25
 
83
26
  💡 What's happening here?
84
27
  - Targets run initially in the order they appear in the code, so `background` runs first, followed by `width`. The `_` prefix indicates that a target is inactive by default, meaning `height` does not run initially.
85
28
  - `background` sets the background to purple, and its lifecycle ends.
86
29
  - `width` animates from 100 → 250 → 100px, in 50 steps with 10ms pauses.
87
- - `height` follows `width` and scales dynamically with its value. The `$` postfix means it is activated each time the preceding target executes. `prevTargetValue` refers to the previous target's value, which in this case is `width`.
30
+ - `height` follows `width` and scales dynamically with its value. The `$` postfix creates a reactive pipeline where the target is triggered each time the preceding target runs. `prevTargetValue` refers to the previous target's value, which in this case is `width`.
88
31
 
89
32
  ![first example](https://targetjs.io/img/quick1_3.gif)
90
33
 
91
- ```bash
34
+ ```javascript
92
35
  import { App } from "targetj";
93
36
 
94
37
  App({
95
38
  background: "mediumpurple",
96
- width: [{ list: [100, 250, 100] }, 50, 10], // Target values, steps, interval
97
- _height$() { // activated when width executes
39
+ width: [{ list: [100, 250, 100] }, 50, 10], // width animates through 100 → 250 → 100, over 50 steps, 10ms interval
40
+ _height$() { // `$` creates a reactive pipeline: the `height` updates each time `width` executes
98
41
  return this.prevTargetValue / 2;
99
42
  }
100
43
  });
@@ -119,7 +62,7 @@ In this example, we load one user and display its name.
119
62
 
120
63
  ![first example](https://targetjs.io/img/quick2_4.gif)
121
64
 
122
- ```bash
65
+ ```javascript
123
66
  import { App } from "targetj";
124
67
 
125
68
  App({
@@ -145,11 +88,11 @@ In this example, we load two separate users and display two purple boxes, each c
145
88
 
146
89
  - `fetch` calls two APIs to retrieve details for two users.
147
90
  - `children` is a special target that adds new items to the parent each time it executes. Since the target name is prefixed with _, it is inactive by default. Because it ends with $, it executes every time an API call returns a result.
148
- TargetJS ensures that API results are processed in the same sequence as the API calls. For example, if the user1 API result arrives before user0, `children` will not execute until the result for user0 has been received.
91
+ - TargetJS ensures that API results are processed in the same sequence as the API calls. For example, if the user1 API result arrives before user0, `children` will not execute until the result for user0 has been received.
149
92
 
150
93
  ![first example](https://targetjs.io/img/quick3_1.gif)
151
94
 
152
- ```bash
95
+ ```javascript
153
96
  import { App, fetch } from "targetj";
154
97
 
155
98
  App({
@@ -178,6 +121,85 @@ Or in HTML:
178
121
  </div>
179
122
  ```
180
123
 
124
+ ## Table of Contents
125
+
126
+ 1. [Installation](#installation)
127
+ 2. [Key Features and Concepts](#key-features-and-concepts)
128
+ 6. [Comparison with Other UI Frameworks](#comparison-with-other-ui-frameworks)
129
+ 7. [The Core of TargetJS](#the-core-of-targetjs)
130
+ 8. [Anatomy of a Target](#anatomy-of-a-target)
131
+ 9. [Target Methods](#target-methods)
132
+ 10. [Target Variables](#target-variables)
133
+ 11. More Examples:
134
+ - [Basic Example](#basic-example)
135
+ - [Declarative and Imperative Targets Example](#declarative-and-imperative-targets-example)
136
+ - [Infinite Loading and Scrolling Example](#infinite-loading-and-scrolling-example)
137
+ - [Simple SPA Example](#simple-spa-example)
138
+ - [Using TargetJS as a Library Example](#using-targetjs-as-a-library-example)
139
+ 12. [Special Target Names](#special-target-names)
140
+ 13. [How to Debug in TargetJS](#how-to-debug-in-targetjs)
141
+ 14. [Documentation](#documentation)
142
+ 15. [License](#license)
143
+ 16. [Contact](#contact)
144
+ 17. [Call to Action](#call-to-action)
145
+
146
+ ## **📦 Installation**
147
+
148
+ **Via CDN**
149
+
150
+ Add the following `<script>` tag to your HTML to load TargetJS from a CDN (only 44KB compressed):
151
+
152
+ ```html
153
+ <script src="https://ltstaticfiles.s3.us-east-1.amazonaws.com/targetjs.js"></script>
154
+ ```
155
+
156
+ This will add `TargetJS` to the global `window` object, making it accessible throughout your JavaScript such as `TargetJS.App(YourApp)`.
157
+ You can also use it directly in your HTML with custom attributes:
158
+
159
+ ```html
160
+ <div
161
+ tg-background="red"
162
+ tg-width="[100, 50, 10]"
163
+ tg-height="[100, 50, 10]">
164
+ </div>
165
+ ```
166
+
167
+ **Via package manager**
168
+
169
+ Install TargetJS via npm (note: there's no "s" at the end):
170
+
171
+ ```bash
172
+ npm install targetj
173
+ ```
174
+
175
+ Then import it into your JavaScript code:
176
+
177
+ ```javascript
178
+ import { App } from "targetj";
179
+ ```
180
+
181
+ ## Key Features and Concepts
182
+
183
+ * **Targets:** The fundamental building blocks of TargetJS. Targets provide a unified interface for properties and methods with built-in lifecycles. They can:
184
+ * Iterate towards values (useful for animations and transitions).
185
+ * Execute conditionally.
186
+ * Manage repeated executions.
187
+ * Control execution timing (useful for UI operations and advanced animations).
188
+ * Form synchronous execution pipelines (similar to assembling Lego).
189
+ * Track the execution progress of other targets.
190
+ * Declarative execution (execution follows the way the code is written).
191
+ * Compact code (No unnecessary function calls, minimal if statements and loops).
192
+ * Manage their own state.
193
+
194
+ * **Unified Approach:** Targets handle UI updates, API calls, animations, state, and events, reducing the need to learn and integrate multiple libraries.
195
+
196
+ * **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:
197
+
198
+ * 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.
199
+ * Powerful Functional Pipeline: Targets can be structured as a functional pipeline with enhanced capabilities.
200
+
201
+ * **Easy Integration:** Can be used as a library within existing projects.
202
+
181
203
  ## Comparison with Other UI Frameworks
182
204
 
183
205
  | Feature | TargetJS | Reactive Model Frameworks |
@@ -202,13 +224,11 @@ Or in HTML:
202
224
 
203
225
  TargetJS utilizes literal JavaScript objects or HTML elements for target definitions, providing a compact and readable format. The core principles are:
204
226
 
205
- - Provide an internal wrapper (called "targets") for both properties and methods of the literal object.
206
- - Execute targets sequentially, in the order they are written leveraging ES2015's guaranteed property order.
207
- - Enable functional pipelines between adjacent targets.
208
- - Add lifecycles, looping, and timing to targets, enabling them to execute or re-execute based on conditions or time.
209
-
210
- That's the basic idea. Learn more [here](https://dev.to/ahmad_wasfi_f88513699c56d/targetjs-rethinking-ui-with-declarative-synchronous-pipelines-5bbi).
211
-
227
+ - Properties and methods are unified via an internal wrapper called "targets."
228
+ - Execute targets sequentially and predictably in the order they are written leveraging ES2015's guaranteed property order.
229
+ - Enable reactive pipelines between adjacent targets.
230
+ - Add lifecycles to targets enabling them to behave like living, responsive cells.
231
+
212
232
  ## Anatomy of a Target
213
233
 
214
234
  Each target consists of the following:
@@ -312,7 +332,7 @@ You can view a live example here: https://targetjs.io/examples/overview.html.
312
332
 
313
333
  **Object**
314
334
 
315
- ```bash
335
+ ```javascript
316
336
  import { App } from "targetj";
317
337
 
318
338
  App({
@@ -336,7 +356,7 @@ App({
336
356
  ```
337
357
  **Array**
338
358
 
339
- ```bash
359
+ ```javascript
340
360
  import { App } from "targetj";
341
361
 
342
362
  App({
@@ -348,7 +368,7 @@ App({
348
368
  ```
349
369
  **Imperative** (more in the next example)
350
370
 
351
- ```bash
371
+ ```javascript
352
372
  import { App } from "targetj";
353
373
 
354
374
  App({
@@ -362,7 +382,7 @@ App({
362
382
  ```
363
383
  **Imperative Multi-Targets**
364
384
 
365
- ```bash
385
+ ```javascript
366
386
  import { App } from "targetj";
367
387
 
368
388
  App({
@@ -404,7 +424,7 @@ introducing a 1-second pause. After that, `repeat` is executed, reactivating the
404
424
 
405
425
  ![declarative example](https://targetjs.io/img/declarative3.gif)
406
426
 
407
- ```bash
427
+ ```javascript
408
428
  import { App, getScreenWidth, getScreenHeight } from "targetj";
409
429
 
410
430
  App({
@@ -485,7 +505,7 @@ If you inspect the HTML elements in the browser's developer tools, you'll notice
485
505
 
486
506
  ![Single page app](https://targetjs.io/img/infiniteScrolling11.gif)
487
507
 
488
- ```bash
508
+ ```javascript
489
509
  import { App, getEvents, fetch, getScreenWidth, getScreenHeight } from "targetj";
490
510
 
491
511
  App({
@@ -581,7 +601,7 @@ You can now assemble your app by incorporating code segments from the examples o
581
601
 
582
602
  ![Single page app](https://targetjs.io/img/singlePage2.gif)
583
603
 
584
- ```bash
604
+ ```javascript
585
605
  import { App, getScreenHeight, getScreenWidth, getEvents, getPager } from "targetj";
586
606
 
587
607
  App({
@@ -756,7 +776,7 @@ The `rectTop`, `absY`, and `onWindowScroll` targets are used to track the visibl
756
776
 
757
777
  ![animation api example](https://targetjs.io/img/targetjsAsLibrary.gif)
758
778
 
759
- ```bash
779
+ ```javascript
760
780
  import { App, $Dom } from "targetj";
761
781
 
762
782
  App({
package/build/App.js CHANGED
@@ -17,6 +17,7 @@ var _RunScheduler = require("./RunScheduler.js");
17
17
  var _TargetManager = require("./TargetManager.js");
18
18
  var _TargetExecutor = require("./TargetExecutor.js");
19
19
  var _TUtil = require("./TUtil.js");
20
+ var _DomInit = require("./DomInit.js");
20
21
  var _SearchUtil = require("./SearchUtil.js");
21
22
  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; }
22
23
  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); }
@@ -50,27 +51,27 @@ var AppFn = function AppFn() {
50
51
  styling: false,
51
52
  domHolder: true,
52
53
  isVisible: true,
53
- width: function width() {
54
+ screenWidth: function screenWidth() {
54
55
  var width = _$Dom.$Dom.getScreenWidth();
55
- if (width !== tmodel.val('width')) {
56
+ if (width !== tmodel.val('screenWidth')) {
56
57
  my.resizeLastUpdate = _TUtil.TUtil.now();
57
58
  }
58
59
  return width;
59
60
  },
60
- height: function height() {
61
+ screenHeight: function screenHeight() {
61
62
  var height = _$Dom.$Dom.getScreenHeight();
62
- if (height !== tmodel.val('height')) {
63
+ if (height !== tmodel.val('screenHeight')) {
63
64
  my.resizeLastUpdate = _TUtil.TUtil.now();
64
65
  }
65
66
  return height;
66
67
  },
67
68
  initPageDom: function initPageDom() {
68
- _TUtil.TUtil.initPageDoms(this.$dom);
69
+ _DomInit.DomInit.initPageDoms(this.$dom);
69
70
  }
70
71
  });
71
72
  tmodel.$dom = _$Dom.$Dom.query('#tgjs-root') ? new _$Dom.$Dom('#tgjs-root') : new _$Dom.$Dom('body');
72
- tmodel.val('width', _$Dom.$Dom.getScreenWidth());
73
- tmodel.val('height', _$Dom.$Dom.getScreenHeight());
73
+ tmodel.val('screenWidth', _$Dom.$Dom.getScreenWidth());
74
+ tmodel.val('screenHeight', _$Dom.$Dom.getScreenHeight());
74
75
  if (my.tRoot) {
75
76
  my.tRoot.getChildren().forEach(function (t) {
76
77
  if (t.val('sourceDom')) {
@@ -93,8 +94,8 @@ var AppFn = function AppFn() {
93
94
  while (1) switch (_context.prev = _context.next) {
94
95
  case 0:
95
96
  my.runningFlag = false;
96
- _TargetExecutor.TargetExecutor.executeDeclarativeTarget(my.tRoot, 'width');
97
- _TargetExecutor.TargetExecutor.executeDeclarativeTarget(my.tRoot, 'height');
97
+ _TargetExecutor.TargetExecutor.executeDeclarativeTarget(my.tRoot, 'screenWidth');
98
+ _TargetExecutor.TargetExecutor.executeDeclarativeTarget(my.tRoot, 'screenHeight');
98
99
  my.events.detachAll();
99
100
  my.events.detachWindowEvents();
100
101
  my.events.attachWindowEvents();
@@ -220,12 +221,12 @@ var getBrowser = exports.getBrowser = function getBrowser() {
220
221
  return (_tApp10 = tApp) === null || _tApp10 === void 0 ? void 0 : _tApp10.browser;
221
222
  };
222
223
  var getScreenWidth = exports.getScreenWidth = function getScreenWidth() {
223
- var _tApp$tRoot$getWidth, _tApp11;
224
- 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;
224
+ var _tApp$tRoot$val, _tApp11;
225
+ return (_tApp$tRoot$val = (_tApp11 = tApp) === null || _tApp11 === void 0 || (_tApp11 = _tApp11.tRoot) === null || _tApp11 === void 0 ? void 0 : _tApp11.val('screenWidth')) !== null && _tApp$tRoot$val !== void 0 ? _tApp$tRoot$val : 0;
225
226
  };
226
227
  var getScreenHeight = exports.getScreenHeight = function getScreenHeight() {
227
- var _tApp$tRoot$getHeight, _tApp12;
228
- 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;
228
+ var _tApp$tRoot$val2, _tApp12;
229
+ return (_tApp$tRoot$val2 = (_tApp12 = tApp) === null || _tApp12 === void 0 || (_tApp12 = _tApp12.tRoot) === null || _tApp12 === void 0 ? void 0 : _tApp12.val('screenHeight')) !== null && _tApp$tRoot$val2 !== void 0 ? _tApp$tRoot$val2 : 0;
229
230
  };
230
231
  var getVisibles = exports.getVisibles = function getVisibles() {
231
232
  var _tApp13;
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DomInit = void 0;
7
+ var _$Dom = require("./$Dom.js");
8
+ var _TUtil = require("./TUtil.js");
9
+ var _App = require("./App.js");
10
+ var _TargetData = require("./TargetData.js");
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
+ 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
+ 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; }
15
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
16
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
17
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
18
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
19
+ 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); } }
20
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
21
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
22
+ 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); }
23
+ /**
24
+ *
25
+ * Map and bind dom elements to model structures
26
+ */
27
+ var DomInit = exports.DomInit = /*#__PURE__*/function () {
28
+ function DomInit() {
29
+ _classCallCheck(this, DomInit);
30
+ }
31
+ return _createClass(DomInit, null, [{
32
+ key: "initCacheDoms",
33
+ value: function initCacheDoms(visibleList) {
34
+ var elements = (0, _App.tRoot)().$dom.queryAll('[tg]');
35
+ visibleList.forEach(function (tmodel) {
36
+ tmodel.$dom = null;
37
+ });
38
+ var visibleMap = _TUtil.TUtil.list2map(visibleList.filter(function (item) {
39
+ return item.type !== 'BI';
40
+ }));
41
+ var _iterator = _createForOfIteratorHelper(elements),
42
+ _step;
43
+ try {
44
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
45
+ var element = _step.value;
46
+ var id = element.getAttribute("id");
47
+ var tmodel = visibleMap[id];
48
+ if (tmodel) {
49
+ tmodel.$dom = new _$Dom.$Dom("#".concat(id));
50
+ } else {
51
+ _$Dom.$Dom.detach(element);
52
+ }
53
+ }
54
+ } catch (err) {
55
+ _iterator.e(err);
56
+ } finally {
57
+ _iterator.f();
58
+ }
59
+ }
60
+ }, {
61
+ key: "initPageDoms",
62
+ value: function initPageDoms($dom) {
63
+ var elementToModel = new Map();
64
+ var elements = $dom.queryAll('*');
65
+ var _iterator2 = _createForOfIteratorHelper(elements),
66
+ _step2;
67
+ try {
68
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
69
+ var element = _step2.value;
70
+ var newModel = void 0;
71
+ var attrs = Array.from(element.attributes);
72
+ var isTargetElement = attrs.some(function (attr) {
73
+ return attr.name === 'tg' || attr.name.startsWith('tg-');
74
+ });
75
+ var attributeSet = {};
76
+ if (isTargetElement) {
77
+ var _iterator4 = _createForOfIteratorHelper(attrs),
78
+ _step4;
79
+ try {
80
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
81
+ var attr = _step4.value;
82
+ if (attr.name.startsWith("tg-")) {
83
+ var rawKey = attr.name.slice(3);
84
+ var key = _TargetData.TargetData.attributesToTargets[rawKey] || rawKey;
85
+ var rawValue = attr.value.trim();
86
+ var value = DomInit.parseString(rawValue);
87
+ attributeSet[key] = value;
88
+ }
89
+ }
90
+ } catch (err) {
91
+ _iterator4.e(err);
92
+ } finally {
93
+ _iterator4.f();
94
+ }
95
+ }
96
+ var parentEl = element.parentElement;
97
+ var parentModel = elementToModel.get(parentEl);
98
+ var id = void 0;
99
+ if (Object.keys(attributeSet).length > 0) {
100
+ id = element.getAttribute('id');
101
+ if (!id && !parentModel) {
102
+ id = _App.App.getOid('blank').oid;
103
+ element.setAttribute('id', id);
104
+ }
105
+ if (!element.getAttribute('tg')) {
106
+ element.setAttribute('tg', true);
107
+ }
108
+ newModel = _objectSpread({
109
+ id: id,
110
+ $dom: new _$Dom.$Dom(element)
111
+ }, attributeSet);
112
+ }
113
+ if (parentModel) {
114
+ if (!newModel) {
115
+ newModel = {
116
+ textOnly: false,
117
+ html: element.outerHTML,
118
+ $dom: new _$Dom.$Dom(element)
119
+ };
120
+ }
121
+ var childrenKey = DomInit.getChildrenKey(parentModel);
122
+ if (childrenKey) {
123
+ if (Array.isArray(parentModel[childrenKey].value)) {
124
+ parentModel[childrenKey].value.push(newModel);
125
+ } else if (typeof parentModel[childrenKey] === 'string') {
126
+ parentModel[childrenKey] = {
127
+ cycles: _TUtil.TUtil.isNumber(+parentModel[childrenKey]) ? +parentModel[childrenKey] : 0,
128
+ value: [newModel]
129
+ };
130
+ } else if (_typeof(parentModel[childrenKey]) === 'object') {
131
+ parentModel[childrenKey].value = [newModel];
132
+ }
133
+ } else {
134
+ parentModel._children$ = {
135
+ cycles: 0,
136
+ value: [newModel]
137
+ };
138
+ }
139
+ elementToModel.set(element, newModel);
140
+ } else if (newModel) {
141
+ elementToModel.set(element, newModel);
142
+ }
143
+ }
144
+ } catch (err) {
145
+ _iterator2.e(err);
146
+ } finally {
147
+ _iterator2.f();
148
+ }
149
+ var _iterator3 = _createForOfIteratorHelper(elementToModel.values()),
150
+ _step3;
151
+ try {
152
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
153
+ var _value = _step3.value;
154
+ var _parentEl = _value.$dom.element.parentElement;
155
+ var _parentModel = elementToModel.get(_parentEl);
156
+ if (_parentModel) {
157
+ _value.$dom.detach();
158
+ delete _value.$dom;
159
+ delete _value.id;
160
+ _value.shouldBeBracketed = false;
161
+ _value.otype = _value.id || (_parentModel.id || _App.App.getOid('blank').oid) + "_";
162
+ _value.isVisible = !_TUtil.TUtil.isDefined(_value.isVisible) ? function () {
163
+ return this.getParent().isVisible();
164
+ } : _value.isVisible;
165
+ _value.domParent = !_TUtil.TUtil.isDefined(_value.domParent) ? function () {
166
+ return this.getParent();
167
+ } : _value.domParent;
168
+ } else {
169
+ _value.isVisible = !_TUtil.TUtil.isDefined(_value.isVisible) ? true : _value.isVisible;
170
+ _value.sourceDom = true;
171
+ (0, _App.tRoot)().addChild(_value);
172
+ }
173
+ }
174
+ } catch (err) {
175
+ _iterator3.e(err);
176
+ } finally {
177
+ _iterator3.f();
178
+ }
179
+ }
180
+ }, {
181
+ key: "getChildrenKey",
182
+ value: function getChildrenKey(obj) {
183
+ for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) {
184
+ var key = _Object$keys[_i];
185
+ if (key.toLowerCase().includes("children")) {
186
+ return key;
187
+ }
188
+ }
189
+ return null;
190
+ }
191
+ }, {
192
+ key: "parseString",
193
+ value: function parseString(rawValue) {
194
+ if (typeof rawValue !== 'string') {
195
+ return rawValue;
196
+ }
197
+ var trimmed = rawValue.trim();
198
+ var isFunction = /^function\s*\([\s\S]*?\)\s*\{[\s\S]*\}$/m.test(trimmed) || /^\(?[\w\s,]*\)?\s*=>\s*(\{[\s\S]*\}|\S+)/m.test(trimmed);
199
+ var isObject = /^(\{[\s\S]*\}|\[[\s\S]*\])$/.test(trimmed);
200
+ if (!isObject && !isFunction && (trimmed.includes('return') || trimmed.includes('setTarget') || trimmed.includes('TargetJS.')) || trimmed.includes('addChild')) {
201
+ try {
202
+ return new Function(trimmed);
203
+ } catch (_unused) {}
204
+ }
205
+ if (isObject || isFunction) {
206
+ try {
207
+ return eval("(".concat(trimmed, ")"));
208
+ } catch (_unused2) {}
209
+ }
210
+ try {
211
+ return JSON.parse(trimmed);
212
+ } catch (_unused3) {}
213
+ return rawValue;
214
+ }
215
+ }]);
216
+ }();
@@ -452,8 +452,8 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
452
452
  }, {
453
453
  key: "resizeRoot",
454
454
  value: function resizeRoot() {
455
- _TargetExecutor.TargetExecutor.executeDeclarativeTarget((0, _App.tRoot)(), 'width');
456
- _TargetExecutor.TargetExecutor.executeDeclarativeTarget((0, _App.tRoot)(), 'height');
455
+ _TargetExecutor.TargetExecutor.executeDeclarativeTarget((0, _App.tRoot)(), 'screenWidth');
456
+ _TargetExecutor.TargetExecutor.executeDeclarativeTarget((0, _App.tRoot)(), 'screenHeight');
457
457
  }
458
458
  }, {
459
459
  key: "preventDefault",
@@ -138,9 +138,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
138
138
  }
139
139
  _this3.locationListStats.push(child.oid);
140
140
  viewport.setCurrentChild(child);
141
- if (!child.targets['excludeXYCalc']) {
142
- viewport.setLocation();
143
- }
141
+ viewport.setLocation();
144
142
  if (child.isIncluded() && container.manageChildTargetExecution(child, shouldCalculateChildTargets)) {
145
143
  _this3.calculateTargets(child);
146
144
  }
@@ -191,11 +189,11 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
191
189
  if (child.shouldCalculateChildren()) {
192
190
  _this3.calculateContainer(child, shouldCalculateChildTargets && container.shouldCalculateChildTargets() !== false);
193
191
  }
194
- if (!child.isTargetImperative('height') && !_TUtil.TUtil.isDefined(child.targets.height) && !_TUtil.TUtil.isDefined(child.targets.heightFromDom) && child.getContentHeight() > 0) {
192
+ if (!child.isTargetImperative('height') && !_TModelUtil.TModelUtil.isHeightDefined(child) && !_TUtil.TUtil.isDefined(child.targets.heightFromDom) && child.getContentHeight() > 0) {
195
193
  child.val('height', child.getContentHeight());
196
194
  child.addToStyleTargetList('height');
197
195
  }
198
- if (!child.isTargetImperative('width') && !_TUtil.TUtil.isDefined(child.targets.width) && !_TUtil.TUtil.isDefined(child.targets.widthFromDom) && child.getContentWidth() > 0) {
196
+ if (!child.isTargetImperative('width') && !_TModelUtil.TModelUtil.isWidthDefined(child) && !_TUtil.TUtil.isDefined(child.targets.widthFromDom) && child.getContentWidth() > 0) {
199
197
  child.val('width', child.getContentWidth());
200
198
  child.addToStyleTargetList('width');
201
199
  }
@@ -241,14 +239,18 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
241
239
  this.checkInternalEvents(tmodel);
242
240
  _App.tApp.targetManager.applyTargetValues(tmodel);
243
241
  _App.tApp.targetManager.setActualValues(tmodel);
244
- if (tmodel.hasDom()) {
245
- if (_TModelUtil.TModelUtil.shouldMeasureWidthFromDom(tmodel)) {
242
+ if (_TModelUtil.TModelUtil.shouldMeasureWidthFromDom(tmodel)) {
243
+ if (tmodel.hasDom()) {
246
244
  _TModelUtil.TModelUtil.setWidthFromDom(tmodel);
245
+ } else {
246
+ tmodel.addToActiveTargets('width');
247
247
  }
248
248
  }
249
- if (tmodel.hasDom()) {
250
- if (_TModelUtil.TModelUtil.shouldMeasureHeightFromDom(tmodel)) {
249
+ if (_TModelUtil.TModelUtil.shouldMeasureHeightFromDom(tmodel)) {
250
+ if (tmodel.hasDom()) {
251
251
  _TModelUtil.TModelUtil.setHeightFromDom(tmodel);
252
+ } else {
253
+ tmodel.addToActiveTargets('height');
252
254
  }
253
255
  }
254
256
  tmodel.isNowVisible = false;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.PageManager = void 0;
7
7
  var _TUtil = require("./TUtil.js");
8
8
  var _App = require("./App.js");
9
+ var _DomInit = require("./DomInit.js");
9
10
  var _$Dom = require("./$Dom.js");
10
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); }
11
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; }
@@ -40,7 +41,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
40
41
  value: function initPage(html) {
41
42
  _App.tApp.tRoot.$dom.outerHTML(html);
42
43
  _App.tApp.tRoot.$dom = _$Dom.$Dom.query('#tgjs-root') ? new _$Dom.$Dom('#tgjs-root') : new _$Dom.$Dom('body');
43
- _TUtil.TUtil.initPageDoms(_App.tApp.tRoot.$dom);
44
+ _DomInit.DomInit.initPageDoms(_App.tApp.tRoot.$dom);
44
45
  }
45
46
  }, {
46
47
  key: "openPage",
@@ -66,7 +67,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
66
67
  _App.App.oids = this.pageCache[link].oids;
67
68
  _App.tApp.tRoot.$dom = _$Dom.$Dom.query('#tgjs-root') ? new _$Dom.$Dom('#tgjs-root') : new _$Dom.$Dom('body');
68
69
  _App.tApp.tRoot.$dom.innerHTML(this.pageCache[link].html);
69
- _TUtil.TUtil.initCacheDoms(this.pageCache[link].visibleList);
70
+ _DomInit.DomInit.initCacheDoms(this.pageCache[link].visibleList);
70
71
  this.pageCache[link].visibleList.forEach(function (tmodel) {
71
72
  tmodel.visibilityStatus = undefined;
72
73
  });
@@ -57,12 +57,24 @@ var TModelUtil = exports.TModelUtil = /*#__PURE__*/function () {
57
57
  }, {
58
58
  key: "shouldMeasureHeightFromDom",
59
59
  value: function shouldMeasureHeightFromDom(tmodel) {
60
- return !tmodel.excludeDefaultStyling() && !_TUtil.TUtil.isDefined(tmodel.targetValues.height) && !_TUtil.TUtil.isDefined(tmodel.targets.height) && !tmodel.hasChildren() || !!tmodel.getTargetValue('heightFromDom');
60
+ return !tmodel.excludeDefaultStyling() && !_TUtil.TUtil.isDefined(tmodel.targetValues.height) && !TModelUtil.isHeightDefined(tmodel) && !tmodel.hasChildren() || !!tmodel.getTargetValue('heightFromDom');
61
61
  }
62
62
  }, {
63
63
  key: "shouldMeasureWidthFromDom",
64
64
  value: function shouldMeasureWidthFromDom(tmodel) {
65
- return !tmodel.excludeDefaultStyling() && !tmodel.reuseDomDefinition() && !_TUtil.TUtil.isDefined(tmodel.targetValues.width) && !_TUtil.TUtil.isDefined(tmodel.targets.width) && !tmodel.hasChildren() || !!tmodel.getTargetValue('widthFromDom');
65
+ return !tmodel.excludeDefaultStyling() && !tmodel.reuseDomDefinition() && !_TUtil.TUtil.isDefined(tmodel.targetValues.width) && !TModelUtil.isWidthDefined(tmodel) && !tmodel.hasChildren() || !!tmodel.getTargetValue('widthFromDom');
66
+ }
67
+ }, {
68
+ key: "isHeightDefined",
69
+ value: function isHeightDefined(tmodel) {
70
+ var _tmodel$targets$style;
71
+ return _TUtil.TUtil.isDefined(tmodel.targets.height) || _TUtil.TUtil.isDefined((_tmodel$targets$style = tmodel.targets.style) === null || _tmodel$targets$style === void 0 ? void 0 : _tmodel$targets$style.height);
72
+ }
73
+ }, {
74
+ key: "isWidthDefined",
75
+ value: function isWidthDefined(tmodel) {
76
+ var _tmodel$targets$style2;
77
+ return _TUtil.TUtil.isDefined(tmodel.targets.width) || _TUtil.TUtil.isDefined((_tmodel$targets$style2 = tmodel.targets.style) === null || _tmodel$targets$style2 === void 0 ? void 0 : _tmodel$targets$style2.width);
66
78
  }
67
79
  }, {
68
80
  key: "createDom",
@@ -211,7 +223,13 @@ var TModelUtil = exports.TModelUtil = /*#__PURE__*/function () {
211
223
  if (key === 'style') {
212
224
  var style = tmodel.getStyle();
213
225
  if (_TUtil.TUtil.isDefined(style) && tmodel.styleMap.style !== style) {
214
- tmodel.$dom.setStyleByMap(tmodel.getStyle());
226
+ tmodel.$dom.setStyleByMap(style);
227
+ if (style.height) {
228
+ tmodel.val('height', parseInt(style.height, 10));
229
+ }
230
+ if (style.width) {
231
+ tmodel.val('width', parseInt(style.width, 10));
232
+ }
215
233
  tmodel.styleMap.style = style;
216
234
  }
217
235
  } else if (key === 'attributes') {
package/build/TUtil.js CHANGED
@@ -4,19 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TUtil = void 0;
7
- var _$Dom = require("./$Dom.js");
8
7
  var _App = require("./App.js");
9
- var _TargetData = require("./TargetData.js");
8
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
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); }
10
10
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
11
11
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
13
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
13
14
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
14
- 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); }
15
- 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; }
16
- 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; }
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
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
19
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
20
15
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
21
16
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
22
17
  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); } }
@@ -62,190 +57,6 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
62
57
  child.val('isVisible', status.left && status.right && status.top && status.bottom);
63
58
  return child.val('isVisible');
64
59
  }
65
- }, {
66
- key: "initCacheDoms",
67
- value: function initCacheDoms(visibleList) {
68
- var elements = (0, _App.tRoot)().$dom.queryAll('[tg]');
69
- visibleList.forEach(function (tmodel) {
70
- tmodel.$dom = null;
71
- });
72
- var visibleMap = TUtil.list2map(visibleList.filter(function (item) {
73
- return item.type !== 'BI';
74
- }));
75
- var _iterator = _createForOfIteratorHelper(elements),
76
- _step;
77
- try {
78
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
79
- var element = _step.value;
80
- var id = element.getAttribute("id");
81
- var tmodel = visibleMap[id];
82
- if (tmodel) {
83
- tmodel.$dom = new _$Dom.$Dom("#".concat(id));
84
- } else {
85
- _$Dom.$Dom.detach(element);
86
- }
87
- }
88
- } catch (err) {
89
- _iterator.e(err);
90
- } finally {
91
- _iterator.f();
92
- }
93
- }
94
- }, {
95
- key: "initPageDoms",
96
- value: function initPageDoms($dom) {
97
- var elementToModel = new Map();
98
- var elements = $dom.queryAll('*');
99
- var _iterator2 = _createForOfIteratorHelper(elements),
100
- _step2;
101
- try {
102
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
103
- var element = _step2.value;
104
- var newModel = void 0;
105
- var attrs = Array.from(element.attributes);
106
- var isTargetElement = attrs.some(function (attr) {
107
- return attr.name === 'tg' || attr.name.startsWith('tg-');
108
- });
109
- var attributeSet = {};
110
- if (isTargetElement) {
111
- var _iterator4 = _createForOfIteratorHelper(attrs),
112
- _step4;
113
- try {
114
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
115
- var attr = _step4.value;
116
- if (attr.name.startsWith("tg-")) {
117
- var rawKey = attr.name.slice(3);
118
- var key = _TargetData.TargetData.attributesToTargets[rawKey] || rawKey;
119
- var rawValue = attr.value.trim();
120
- var value = TUtil.parseString(rawValue);
121
- attributeSet[key] = value;
122
- }
123
- }
124
- } catch (err) {
125
- _iterator4.e(err);
126
- } finally {
127
- _iterator4.f();
128
- }
129
- }
130
- var parentEl = element.parentElement;
131
- var parentModel = elementToModel.get(parentEl);
132
- var id = void 0;
133
- if (Object.keys(attributeSet).length > 0) {
134
- id = element.getAttribute('id');
135
- if (!id && !parentModel) {
136
- id = _App.App.getOid('blank').oid;
137
- element.setAttribute('id', id);
138
- }
139
- if (!element.getAttribute('tg')) {
140
- element.setAttribute('tg', true);
141
- }
142
- newModel = _objectSpread({
143
- id: id,
144
- $dom: new _$Dom.$Dom(element)
145
- }, attributeSet);
146
- }
147
- if (parentModel) {
148
- if (!newModel) {
149
- newModel = {
150
- textOnly: false,
151
- html: element.outerHTML,
152
- $dom: new _$Dom.$Dom(element)
153
- };
154
- }
155
- var childrenKey = TUtil.getChildrenKey(parentModel);
156
- if (childrenKey) {
157
- if (Array.isArray(parentModel[childrenKey].value)) {
158
- parentModel[childrenKey].value.push(newModel);
159
- } else if (typeof parentModel[childrenKey] === 'string') {
160
- parentModel[childrenKey] = {
161
- cycles: TUtil.isNumber(+parentModel[childrenKey]) ? +parentModel[childrenKey] : 0,
162
- value: [newModel]
163
- };
164
- } else if (_typeof(parentModel[childrenKey]) === 'object') {
165
- parentModel[childrenKey].value = [newModel];
166
- }
167
- } else {
168
- parentModel._children$ = {
169
- cycles: 0,
170
- value: [newModel]
171
- };
172
- }
173
- elementToModel.set(element, newModel);
174
- } else if (newModel) {
175
- elementToModel.set(element, newModel);
176
- }
177
- }
178
- } catch (err) {
179
- _iterator2.e(err);
180
- } finally {
181
- _iterator2.f();
182
- }
183
- var _iterator3 = _createForOfIteratorHelper(elementToModel.values()),
184
- _step3;
185
- try {
186
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
187
- var _value = _step3.value;
188
- var _parentEl = _value.$dom.element.parentElement;
189
- var _parentModel = elementToModel.get(_parentEl);
190
- if (_parentModel) {
191
- _value.$dom.detach();
192
- delete _value.$dom;
193
- delete _value.id;
194
- _value.shouldBeBracketed = false;
195
- _value.otype = _value.id || (_parentModel.id || _App.App.getOid('blank').oid) + "_";
196
- _value.isVisible = function () {
197
- return this.getParent().isVisible();
198
- };
199
- _value.domParent = function () {
200
- return this.getParent();
201
- };
202
- } else {
203
- _value.isVisible = true;
204
- _value.sourceDom = true;
205
- (0, _App.tRoot)().addChild(_value);
206
- }
207
- }
208
- } catch (err) {
209
- _iterator3.e(err);
210
- } finally {
211
- _iterator3.f();
212
- }
213
- }
214
- }, {
215
- key: "getChildrenKey",
216
- value: function getChildrenKey(obj) {
217
- for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) {
218
- var key = _Object$keys[_i];
219
- if (key.toLowerCase().includes("children")) {
220
- return key;
221
- }
222
- }
223
- return null;
224
- }
225
- }, {
226
- key: "parseString",
227
- value: function parseString(rawValue) {
228
- if (typeof rawValue !== 'string') {
229
- return rawValue;
230
- }
231
- var trimmed = rawValue.trim();
232
- var isFunction = /^function\s*\([\s\S]*?\)\s*\{[\s\S]*\}$/m.test(trimmed) || /^\(?[\w\s,]*\)?\s*=>\s*(\{[\s\S]*\}|\S+)/m.test(trimmed);
233
- var isObject = /^(\{[\s\S]*\}|\[[\s\S]*\])$/.test(trimmed);
234
- if (!isObject && !isFunction && (trimmed.includes('return') || trimmed.includes('setTarget') || trimmed.includes('TargetJS.'))) {
235
- try {
236
- return new Function(trimmed);
237
- } catch (_unused) {}
238
- }
239
- if (isObject || isFunction) {
240
- try {
241
- return eval("(".concat(trimmed, ")"));
242
- } catch (_unused2) {}
243
- }
244
- try {
245
- return JSON.parse(trimmed);
246
- } catch (_unused3) {}
247
- return rawValue;
248
- }
249
60
  }, {
250
61
  key: "contains",
251
62
  value: function contains(container, tmodel) {
@@ -382,11 +193,11 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
382
193
  var tmodel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _App.tRoot)();
383
194
  var tab = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
384
195
  var list = (0, _App.getLocationManager)().getChildren(tmodel);
385
- var _iterator5 = _createForOfIteratorHelper(list),
386
- _step5;
196
+ var _iterator = _createForOfIteratorHelper(list),
197
+ _step;
387
198
  try {
388
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
389
- var g = _step5.value;
199
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
200
+ var g = _step.value;
390
201
  var gtab = g.isVisible() ? tab + '| ' : tab + 'x ';
391
202
  if (g.type === 'BI') {
392
203
  console.log("".concat(gtab).concat(g.oid, " v:").concat(g.isVisible(), " x:").concat(Math.floor(g.getX()), " y:").concat(Math.floor(g.getY()), ", absY:").concat(Math.floor(g.absY), " yy:").concat(Math.floor(g.absY + g.getDomParent().absY), " w:").concat(Math.floor(g.getWidth()), " h:").concat(Math.floor(g.getHeight()), " hc:").concat(Math.floor(g.getContentHeight())));
@@ -398,9 +209,9 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
398
209
  }
399
210
  }
400
211
  } catch (err) {
401
- _iterator5.e(err);
212
+ _iterator.e(err);
402
213
  } finally {
403
- _iterator5.f();
214
+ _iterator.f();
404
215
  }
405
216
  }
406
217
  }]);
package/build/Viewport.js CHANGED
@@ -40,8 +40,10 @@ var Viewport = exports.Viewport = /*#__PURE__*/function () {
40
40
  }, {
41
41
  key: "setLocation",
42
42
  value: function setLocation() {
43
- this.currentChild.x = this.xNext + this.currentChild.getLeftMargin();
44
- this.currentChild.y = this.yNext + this.currentChild.getTopMargin();
43
+ if (!this.currentChild.targets['excludeXYCalc']) {
44
+ this.currentChild.x = this.xNext + this.currentChild.getLeftMargin();
45
+ this.currentChild.y = this.yNext + this.currentChild.getTopMargin();
46
+ }
45
47
  }
46
48
  }, {
47
49
  key: "isOverflow",
package/build/index.js CHANGED
@@ -91,6 +91,17 @@ Object.keys(_TUtil).forEach(function (key) {
91
91
  }
92
92
  });
93
93
  });
94
+ var _DomInit = require("./DomInit.js");
95
+ Object.keys(_DomInit).forEach(function (key) {
96
+ if (key === "default" || key === "__esModule") return;
97
+ if (key in exports && exports[key] === _DomInit[key]) return;
98
+ Object.defineProperty(exports, key, {
99
+ enumerable: true,
100
+ get: function get() {
101
+ return _DomInit[key];
102
+ }
103
+ });
104
+ });
94
105
  var _$Dom = require("./$Dom.js");
95
106
  Object.keys(_$Dom).forEach(function (key) {
96
107
  if (key === "default" || key === "__esModule") return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "targetj",
3
- "version": "1.0.169",
3
+ "version": "1.0.170",
4
4
  "description": "TargetJS is a JavaScript framework designed for creating animated and efficient web user interfaces.",
5
5
  "keywords": ["targetjs"],
6
6
  "main": "Export.js",
@@ -19,7 +19,7 @@
19
19
  }
20
20
  ],
21
21
  "scripts": {
22
- "prod": "webpack --mode production",
22
+ "prod": "webpack --mode production && gzip -kf ./dist/targetjs.js",
23
23
  "dev": "webpack --mode development",
24
24
  "build": "babel src --out-dir build"
25
25
  },
package/build/Dim.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Dim = void 0;
7
- 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); }
8
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
9
- 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); } }
10
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
11
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
- 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); }
13
- var Dim = exports.Dim = /*#__PURE__*/function () {
14
- function Dim() {
15
- _classCallCheck(this, Dim);
16
- this.screen = {
17
- x: 0,
18
- y: 0,
19
- width: 0,
20
- height: 0
21
- };
22
- }
23
- return _createClass(Dim, [{
24
- key: "measureScreen",
25
- value: function measureScreen() {
26
- this.screen.width = document.documentElement.clientWidth || document.body.clientWidth;
27
- this.screen.height = document.documentElement.clientHeight || document.body.clientHeight;
28
- return this;
29
- }
30
- }]);
31
- }();
package/build/Text.js DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Text = void 0;
7
- 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); }
8
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
9
- 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); } }
10
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
11
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
- 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); }
13
- var Text = exports.Text = /*#__PURE__*/function () {
14
- function Text(strings) {
15
- for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
16
- values[_key - 1] = arguments[_key];
17
- }
18
- _classCallCheck(this, Text);
19
- var processedLiterals = strings.map(function (str, i) {
20
- return "".concat(str.trim()).concat(values[i] !== undefined ? values[i] : '');
21
- });
22
- this.template = strings.raw[0];
23
- this.text = processedLiterals.join('');
24
- this.textLiterals = strings.join('');
25
- this.literals = strings;
26
- this.values = values;
27
- }
28
- return _createClass(Text, [{
29
- key: "populateElement",
30
- value: function populateElement(element) {
31
- var _this = this;
32
- var valuePointer = 0;
33
- element.childNodes.forEach(function (node) {
34
- if (node.nodeType === Node.TEXT_NODE) {
35
- node.innerText = _this.values[valuePointer++];
36
- } else if (node.nodeType === Node.ELEMENT_NODE) {
37
- Text.populateElement(node);
38
- }
39
- });
40
- }
41
- }], [{
42
- key: "match",
43
- value: function match(tmodel, domTemplate) {
44
- if (tmodel.getBaseElement() === domTemplate.baseElement) {
45
- if (domTemplate.text instanceof Text && tmodel.getRawHtml() instanceof Text) {
46
- return domTemplate.text.textLiterals === tmodel.getRawHtml().textLiterals;
47
- } else if (domTemplate.text instanceof String && tmodel.getRawHtml() instanceof String) {
48
- return domTemplate.text === tmodel.getRawHtml();
49
- }
50
- }
51
- return false;
52
- }
53
- }]);
54
- }();