targetj 1.0.137 → 1.0.138
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/License +1 -1
- package/README.md +37 -28
- package/build/$Dom.js +60 -5
- package/build/App.js +19 -5
- package/build/BaseModel.js +7 -3
- package/build/Browser.js +0 -23
- package/build/EventListener.js +56 -23
- package/build/LocationManager.js +2 -15
- package/build/RunScheduler.js +9 -3
- package/build/TModel.js +11 -1
- package/build/TModelManager.js +6 -2
- package/build/TargetExecutor.js +1 -1
- package/build/TargetUtil.js +23 -42
- package/build/Text.js +54 -0
- package/package.json +1 -1
package/License
CHANGED
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Welcome to TargetJS, a powerful JavaScript UI framework and library that you might find redefines front-end development. (https://targetjs.io)
|
|
4
4
|
|
|
5
|
-
TargetJS distinguishes itself by introducing a novel concept known as 'targets,' which forms its core. Targets give methods and variable assignments life cycles and the autonomy to operate independently, with various callbacks to adapt to changes, mimicking the behavior of living cells. This opens a new paradigm in programming.
|
|
5
|
+
TargetJS distinguishes itself by introducing a novel concept known as 'targets,' which forms its core. Targets give methods and variable assignments life cycles and the autonomy to operate independently, with various callbacks to adapt to changes, mimicking the behavior of living cells. This opens a new paradigm in programming.
|
|
6
|
+
|
|
7
|
+
We believe TargetJS not only increases productivity but also enhances the development process by making it more enjoyable and user-experience-centered.
|
|
6
8
|
|
|
7
9
|
---
|
|
8
10
|
|
|
@@ -10,7 +12,7 @@ TargetJS distinguishes itself by introducing a novel concept known as 'targets,'
|
|
|
10
12
|
|
|
11
13
|
1. [Installation](#installation)
|
|
12
14
|
2. [What are Targets?](#what-are-targets)
|
|
13
|
-
3. Quick Examples:
|
|
15
|
+
3. Two Quick Examples:
|
|
14
16
|
- [Draggable Animation Example](#draggable-animation-example)
|
|
15
17
|
- [Infinite Scrolling Example](#infinite-scrolling-example)
|
|
16
18
|
4. [Why TargetJS?](#why-targetjs)
|
|
@@ -25,8 +27,8 @@ TargetJS distinguishes itself by introducing a novel concept known as 'targets,'
|
|
|
25
27
|
- [Animation API Comparison Example](#animation-api-comparison-example)
|
|
26
28
|
- [Simple Single Page App Example](#simple-single-page-app-example)
|
|
27
29
|
- [Using TargetJS as a Library Example](#using-targetjs-as-a-library-example)
|
|
28
|
-
10. [
|
|
29
|
-
11. [
|
|
30
|
+
10. [Features](#features)
|
|
31
|
+
11. [Special Target Names](#special-target-names)
|
|
30
32
|
12. [How to Debug in TargetJS](#how-to-debug-in-targetjs)
|
|
31
33
|
13. [Documentation](#documentation)
|
|
32
34
|
14. [License](#license)
|
|
@@ -47,17 +49,23 @@ npm install targetj
|
|
|
47
49
|
|
|
48
50
|
## What are targets?
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
In TargetJS, **targets** serve as the core building blocks of components, replacing traditional variables and methods. Each component is composed of a set of targets.
|
|
51
53
|
|
|
52
|
-
Targets provide a unified
|
|
54
|
+
Targets provide a **unified approach** for solving challenges in **animation**, **user interface organization**, **program flow control**, **state management**, **event handling**, **API calls**, and more. They achieve this by offering a consistent interface for variable assignments and methods, enabling them to operate autonomously and manage their own life cycles.
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
### For example:
|
|
57
|
+
- **Variables**:
|
|
58
|
+
- Can iterate step by step toward a specified value instead of being instantly assigned.
|
|
59
|
+
- Can introduce pauses between steps, adjust their progression dynamically, and trigger callbacks upon completion.
|
|
60
|
+
- **Methods**:
|
|
61
|
+
- Can execute themselves when specific conditions are met.
|
|
62
|
+
- Can adjust pauses between executions, limit the number of executions, track the progress of other variables or methods, and activate the life cycles of additional methods, and more.
|
|
55
63
|
|
|
56
|
-
|
|
64
|
+
---
|
|
57
65
|
|
|
58
|
-
|
|
66
|
+
## Two Quick examples
|
|
59
67
|
|
|
60
|
-
|
|
68
|
+
### Draggable Animation Example
|
|
61
69
|
|
|
62
70
|
In our first example, `color`, `html`, `textAlign`, `moves`, and `animate` are all targets. These targets are executed in the same order they appear in the program. `color`, `html`, `textAlign`, `moves` get competed and their life cycle end. The main target `animate` remains active with an indefinite lifecycle specified by the `loop` property. After each animation cycle, there is a one-second pause, defined by the `interval` property in the `animate` target. Both `loop` and `interval` can also be defined as methods, which will be explained further below. The `setTarget` method defines an imperative target, which is also explained in more detail below, executes the assigment in 30 steps. The `animate` target starts a new cycle after all the imperative targets have been completed or at least one second pass specified in the interval value given that the imperative targets get executed less than 1 second.
|
|
63
71
|
|
|
@@ -99,9 +107,9 @@ App(new TModel('quickStart', {
|
|
|
99
107
|
}));
|
|
100
108
|
```
|
|
101
109
|
|
|
102
|
-
|
|
110
|
+
### Infinite Scrolling Example
|
|
103
111
|
|
|
104
|
-
This example demonstrates how to handle scroll events and implement a simple infinite scrolling application. The `containerOverflowMode` system target ensures that all items in the scroller overflow and stack beneath each other. The `children`
|
|
112
|
+
This example demonstrates how to handle scroll events and implement a simple infinite scrolling application. The `containerOverflowMode` system target ensures that all items in the scroller overflow and stack beneath each other. The `children` target dynamically adds items to the container's children. The `onVisibleChildrenChange` event function detects changes in the visible children and activates the `children` target to create new items that fill the gaps.
|
|
105
113
|
|
|
106
114
|
Internally, TargetJS maintains a tree-like structure to track the visible branches of the tree, optimizing the performance of the scroller. You can opt out of tree-structure optimization by setting `shouldBeBracketed` target to false.
|
|
107
115
|
|
|
@@ -600,6 +608,22 @@ App(new TModel("rows", {
|
|
|
600
608
|
```
|
|
601
609
|
---
|
|
602
610
|
|
|
611
|
+
## Features
|
|
612
|
+
|
|
613
|
+
As a result of using targets, we can develop web sites or apps with the following features:
|
|
614
|
+
|
|
615
|
+
- **No HTML required**: HTML tags are seldom necessary.
|
|
616
|
+
- **No CSS required**: Most popular styles are incorporated directly into targets.
|
|
617
|
+
- **No HTML nesting**: HTML nesting is seldom required in TargetJS. If it is required, nesting is done at runtime. Elements can be dynamically detached and incorporated into other elements, facilitating the easy reuse of components regardless of their location or attachment. It also opens the door for a new user experiences.
|
|
618
|
+
- **Next-level animation**: Users can program objects to move at varying speeds, pause at certain intervals, and repeat sequences based on various conditions. It allows the creation of complicated animations.
|
|
619
|
+
- **Control the flow of execution with time**: TargetJS simplifies the execution of various program segments at specific times, making it easy to sequence or parallelize numerous actions.
|
|
620
|
+
- **Handle events effortlessly**: In TargetJS, events are triggered synchronously and are designed so that any component can detect when an event occurs.
|
|
621
|
+
- **Easy to learn**: TargetJS simplifies development by employing the single concept of \'targets\' making it easy to learn.
|
|
622
|
+
- **Handle 100,000s of items**: TargetJS efficiently manages large collections of objects on a single page. This is done by its data structure and optimization algorithm. It divides a long list into a tree structure, monitoring only the branches that are visible to the user at any given time.
|
|
623
|
+
- **AI friendly**: With a unified concept of targets for all development, the ability to add and remove targets at runtime, and the capability to inspect various statuses of running objects, TargetJS is a strong candidate for AI-powered UI development.
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
603
627
|
## Special target names
|
|
604
628
|
|
|
605
629
|
All HTML style names and attributes are treated as special target names. The most commonly used style names and attributes have already been added to the framework, with the possibility of adding more in the future.
|
|
@@ -665,21 +689,6 @@ Here are all the event targets:
|
|
|
665
689
|
19. **onVisibleChildrenChange**: Triggered when the count of visible children changes.
|
|
666
690
|
20. **onDomEvent**: It accepts an array of targets and activates them when their associated object acquires a DOM element.
|
|
667
691
|
21.
|
|
668
|
-
---
|
|
669
|
-
|
|
670
|
-
## Features
|
|
671
|
-
|
|
672
|
-
As a result of using targets, we can develop web sites or apps with the following features:
|
|
673
|
-
|
|
674
|
-
- **No HTML required**: HTML tags are seldom necessary.
|
|
675
|
-
- **No CSS required**: Most popular styles are incorporated directly into targets.
|
|
676
|
-
- **No HTML nesting**: HTML nesting is seldom required in TargetJS. If it is required, nesting is done at runtime. Elements can be dynamically detached and incorporated into other elements, facilitating the easy reuse of components regardless of their location or attachment. It also opens the door for a new user experiences.
|
|
677
|
-
- **Next-level animation**: Users can program objects to move at varying speeds, pause at certain intervals, and repeat sequences based on various conditions. It allows the creation of complicated animations.
|
|
678
|
-
- **Control the flow of execution with time**: TargetJS simplifies the execution of various program segments at specific times, making it easy to sequence or parallelize numerous actions.
|
|
679
|
-
- **Handle events effortlessly**: In TargetJS, events are triggered synchronously and are designed so that any component can detect when an event occurs.
|
|
680
|
-
- **Easy to learn**: TargetJS simplifies development by employing the single concept of \'targets\' making it easy to learn.
|
|
681
|
-
- **Handle 100,000s of items**: TargetJS efficiently manages large collections of objects on a single page. This is done by its data structure and optimization algorithm. It divides a long list into a tree structure, monitoring only the branches that are visible to the user at any given time.
|
|
682
|
-
- **AI friendly**: With a unified concept of targets for all development, the ability to add and remove targets at runtime, and the capability to inspect various statuses of running objects, TargetJS is a strong candidate for AI-powered UI development.
|
|
683
692
|
|
|
684
693
|
---
|
|
685
694
|
|
|
@@ -695,7 +704,7 @@ As a result of using targets, we can develop web sites or apps with the followin
|
|
|
695
704
|
---
|
|
696
705
|
|
|
697
706
|
## Documentation
|
|
698
|
-
Explore the
|
|
707
|
+
Explore the potential of TargetJS and dive into our interactive documentation at www.targetjs.io.
|
|
699
708
|
|
|
700
709
|
---
|
|
701
710
|
|
package/build/$Dom.js
CHANGED
|
@@ -30,6 +30,12 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
30
30
|
this.textOnly = true;
|
|
31
31
|
}
|
|
32
32
|
return _createClass($Dom, [{
|
|
33
|
+
key: "cloneTemplate",
|
|
34
|
+
value: function cloneTemplate() {
|
|
35
|
+
var _this$element$content;
|
|
36
|
+
return new $Dom((_this$element$content = this.element.content) === null || _this$element$content === void 0 ? void 0 : _this$element$content.cloneNode(true).children[0]);
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
33
39
|
key: "exists",
|
|
34
40
|
value: function exists() {
|
|
35
41
|
if (this.selector) {
|
|
@@ -190,6 +196,32 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
190
196
|
value: function append$Dom($dom) {
|
|
191
197
|
this.element.appendChild($dom.element);
|
|
192
198
|
}
|
|
199
|
+
}, {
|
|
200
|
+
key: "appendElement",
|
|
201
|
+
value: function appendElement(element) {
|
|
202
|
+
this.element.appendChild(element);
|
|
203
|
+
}
|
|
204
|
+
}, {
|
|
205
|
+
key: "removeElement",
|
|
206
|
+
value: function removeElement(element) {
|
|
207
|
+
this.element.removeChild(element);
|
|
208
|
+
}
|
|
209
|
+
}, {
|
|
210
|
+
key: "elementCount",
|
|
211
|
+
value: function elementCount() {
|
|
212
|
+
return this.element.children.length;
|
|
213
|
+
}
|
|
214
|
+
}, {
|
|
215
|
+
key: "swapElements",
|
|
216
|
+
value: function swapElements(element1, element2) {
|
|
217
|
+
var nextSibling = element2.nextSibling;
|
|
218
|
+
if (nextSibling === element1) {
|
|
219
|
+
this.element.insertBefore(element1, element2);
|
|
220
|
+
} else {
|
|
221
|
+
this.element.insertBefore(element2, element1);
|
|
222
|
+
this.element.insertBefore(element1, nextSibling);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
193
225
|
}, {
|
|
194
226
|
key: "insertFirst$Dom",
|
|
195
227
|
value: function insertFirst$Dom($dom) {
|
|
@@ -336,6 +368,16 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
336
368
|
var element = _TUtil.TUtil.isDefined(selector) ? $Dom.query(selector) : this.query('canvas');
|
|
337
369
|
return element ? element.getContext(type) : undefined;
|
|
338
370
|
}
|
|
371
|
+
}, {
|
|
372
|
+
key: "query",
|
|
373
|
+
value: function query(_query) {
|
|
374
|
+
return this.element.querySelector(_query);
|
|
375
|
+
}
|
|
376
|
+
}, {
|
|
377
|
+
key: "queryAll",
|
|
378
|
+
value: function queryAll(query) {
|
|
379
|
+
return this.element.querySelectorAll(query);
|
|
380
|
+
}
|
|
339
381
|
}, {
|
|
340
382
|
key: "findFirstByClass",
|
|
341
383
|
value: function findFirstByClass(className) {
|
|
@@ -346,17 +388,20 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
346
388
|
value: function findFirstByTag(tagName) {
|
|
347
389
|
return $Dom.findFirstByTag(tagName, this.element);
|
|
348
390
|
}
|
|
349
|
-
}, {
|
|
350
|
-
key: "query",
|
|
351
|
-
value: function query(selector) {
|
|
352
|
-
return selector[0] === '#' ? $Dom.findById(selector) : selector[0] === '.' ? this.findFirstByClass(selector) : this.findFirstByTag(selector);
|
|
353
|
-
}
|
|
354
391
|
}, {
|
|
355
392
|
key: "stamp",
|
|
356
393
|
value: function stamp() {
|
|
357
394
|
this.attr('data-tgt', 'true');
|
|
358
395
|
}
|
|
359
396
|
}], [{
|
|
397
|
+
key: "createTemplate",
|
|
398
|
+
value: function createTemplate(html) {
|
|
399
|
+
var $dom = new $Dom();
|
|
400
|
+
$dom.create('template');
|
|
401
|
+
$dom.innerHTML(html.trim());
|
|
402
|
+
return $dom;
|
|
403
|
+
}
|
|
404
|
+
}, {
|
|
360
405
|
key: "getAllStamped",
|
|
361
406
|
value: function getAllStamped() {
|
|
362
407
|
return document.querySelectorAll('[data-tgt="true"]');
|
|
@@ -429,6 +474,16 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
429
474
|
value: function getWindowScrollLeft() {
|
|
430
475
|
return window.pageXOffset || document.documentElement.scrollLeft || 0;
|
|
431
476
|
}
|
|
477
|
+
}, {
|
|
478
|
+
key: "getScreenWidth",
|
|
479
|
+
value: function getScreenWidth() {
|
|
480
|
+
return document.documentElement.clientWidth || document.body.clientWidth;
|
|
481
|
+
}
|
|
482
|
+
}, {
|
|
483
|
+
key: "getScreenHeight",
|
|
484
|
+
value: function getScreenHeight() {
|
|
485
|
+
return document.documentElement.clientHeight || document.body.clientHeight;
|
|
486
|
+
}
|
|
432
487
|
}, {
|
|
433
488
|
key: "ready",
|
|
434
489
|
value: function ready(callback) {
|
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.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.App = void 0;
|
|
8
8
|
var _$Dom = require("./$Dom.js");
|
|
9
9
|
var _TModel = require("./TModel.js");
|
|
10
10
|
var _Browser = require("./Browser.js");
|
|
@@ -26,6 +26,7 @@ var AppFn = function AppFn(firstChild) {
|
|
|
26
26
|
my.throttle = 0;
|
|
27
27
|
my.debugLevel = 0;
|
|
28
28
|
my.runningFlag = false;
|
|
29
|
+
my.resizeLastUpdate = 0;
|
|
29
30
|
my.init = function () {
|
|
30
31
|
my.browser = new _Browser.Browser();
|
|
31
32
|
my.browser.setup();
|
|
@@ -62,14 +63,23 @@ var AppFn = function AppFn(firstChild) {
|
|
|
62
63
|
},
|
|
63
64
|
isVisible: true,
|
|
64
65
|
width: function width() {
|
|
65
|
-
|
|
66
|
+
var width = _$Dom.$Dom.getScreenWidth();
|
|
67
|
+
if (width !== tmodel.val('width')) {
|
|
68
|
+
my.resizeLastUpdate = _TUtil.TUtil.now();
|
|
69
|
+
}
|
|
70
|
+
return width;
|
|
66
71
|
},
|
|
67
72
|
height: function height() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
var height = _$Dom.$Dom.getScreenHeight();
|
|
74
|
+
if (height !== tmodel.val('height')) {
|
|
75
|
+
my.resizeLastUpdate = _TUtil.TUtil.now();
|
|
76
|
+
}
|
|
77
|
+
return height;
|
|
78
|
+
}
|
|
71
79
|
});
|
|
72
80
|
tmodel.oids = {};
|
|
81
|
+
tmodel.val('width', _$Dom.$Dom.getScreenWidth());
|
|
82
|
+
tmodel.val('height', _$Dom.$Dom.getScreenHeight());
|
|
73
83
|
if (my.tRoot) {
|
|
74
84
|
my.tRoot.getChildren().forEach(function (t) {
|
|
75
85
|
var child = new _TModel.TModel(t.type, t.targets);
|
|
@@ -212,4 +222,8 @@ var getVisibles = exports.getVisibles = function getVisibles() {
|
|
|
212
222
|
var _tApp11;
|
|
213
223
|
return (_tApp11 = tApp) === null || _tApp11 === void 0 || (_tApp11 = _tApp11.manager) === null || _tApp11 === void 0 ? void 0 : _tApp11.lists.visible;
|
|
214
224
|
};
|
|
225
|
+
var getResizeLastUpdate = exports.getResizeLastUpdate = function getResizeLastUpdate() {
|
|
226
|
+
var _tApp12;
|
|
227
|
+
return (_tApp12 = tApp) === null || _tApp12 === void 0 ? void 0 : _tApp12.resizeLastUpdate;
|
|
228
|
+
};
|
|
215
229
|
window.t = window.t || _SearchUtil.SearchUtil.find;
|
package/build/BaseModel.js
CHANGED
|
@@ -41,6 +41,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
41
41
|
this.oidNum = uniqueId.num;
|
|
42
42
|
this.targetValues = {};
|
|
43
43
|
this.actualValues = {};
|
|
44
|
+
this.lastActualValues = {};
|
|
44
45
|
this.activeTargetList = [];
|
|
45
46
|
this.activeTargetMap = {};
|
|
46
47
|
this.updatingTargetList = [];
|
|
@@ -119,7 +120,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
119
120
|
}
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
122
|
-
if (_TargetUtil.TargetUtil.
|
|
123
|
+
if (_TargetUtil.TargetUtil.bypassInitialProcessingTargetMap[key]) {
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
126
|
if (_TUtil.TUtil.isDefined(target.initialValue)) {
|
|
@@ -444,12 +445,14 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
444
445
|
}, {
|
|
445
446
|
key: "getTargetInitialValue",
|
|
446
447
|
value: function getTargetInitialValue(key) {
|
|
447
|
-
|
|
448
|
+
var _this$targetValues$ke;
|
|
449
|
+
return (_this$targetValues$ke = this.targetValues[key]) === null || _this$targetValues$ke === void 0 ? void 0 : _this$targetValues$ke.initialValue;
|
|
448
450
|
}
|
|
449
451
|
}, {
|
|
450
452
|
key: "getActualValueLastUpdate",
|
|
451
453
|
value: function getActualValueLastUpdate(key) {
|
|
452
|
-
|
|
454
|
+
var _this$targetValues$ke2;
|
|
455
|
+
return (_this$targetValues$ke2 = this.targetValues[key]) === null || _this$targetValues$ke2 === void 0 ? void 0 : _this$targetValues$ke2.actualValueLastUpdate;
|
|
453
456
|
}
|
|
454
457
|
}, {
|
|
455
458
|
key: "getTargetCreationTime",
|
|
@@ -723,6 +726,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
723
726
|
}
|
|
724
727
|
var targetValue = this.targetValues[key];
|
|
725
728
|
if (targetValue) {
|
|
729
|
+
targetValue.isImperative = false;
|
|
726
730
|
targetValue.executionFlag = false;
|
|
727
731
|
targetValue.scheduleTimeStamp = undefined;
|
|
728
732
|
targetValue.step = 0;
|
package/build/Browser.js
CHANGED
|
@@ -22,29 +22,6 @@ var Browser = exports.Browser = /*#__PURE__*/function () {
|
|
|
22
22
|
return _createClass(Browser, [{
|
|
23
23
|
key: "setup",
|
|
24
24
|
value: function setup() {
|
|
25
|
-
if (!document.getElementsByClassName) {
|
|
26
|
-
var getElementsByClassName = function getElementsByClassName(className, context) {
|
|
27
|
-
var elems;
|
|
28
|
-
if (document.querySelectorAll) {
|
|
29
|
-
elems = context.querySelectorAll(".".concat(className));
|
|
30
|
-
} else {
|
|
31
|
-
var all = context.getElementsByTagName("*");
|
|
32
|
-
elems = [];
|
|
33
|
-
for (var i = 0; i < all.length; i++) {
|
|
34
|
-
if (all[i].className && " ".concat(all[i].className, " ").indexOf(" ".concat(className, " ")) > -1 && elems.indexOf(all[i]) === -1) {
|
|
35
|
-
elems.push(all[i]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return elems;
|
|
40
|
-
};
|
|
41
|
-
document.getElementsByClassName = function (className) {
|
|
42
|
-
return getElementsByClassName(className, document);
|
|
43
|
-
};
|
|
44
|
-
Element.prototype.getElementsByClassName = function (className) {
|
|
45
|
-
return getElementsByClassName(className, this);
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
25
|
this.style = {
|
|
49
26
|
transform: this.prefixStyle('transform'),
|
|
50
27
|
transitionTimingFunction: this.prefixStyle('transitionTimingFunction'),
|
package/build/EventListener.js
CHANGED
|
@@ -69,15 +69,6 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
69
69
|
this.attachedEventMap = {};
|
|
70
70
|
this.eventTargetMap = {};
|
|
71
71
|
this.startEvents = {
|
|
72
|
-
touchstart: {
|
|
73
|
-
eventName: 'touchstart',
|
|
74
|
-
inputType: 'touch',
|
|
75
|
-
eventType: 'start',
|
|
76
|
-
order: 1,
|
|
77
|
-
windowEvent: false,
|
|
78
|
-
queue: true,
|
|
79
|
-
rateLimit: 0
|
|
80
|
-
},
|
|
81
72
|
pointerdown: {
|
|
82
73
|
eventName: 'mousedown',
|
|
83
74
|
inputType: 'pointer',
|
|
@@ -98,20 +89,11 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
98
89
|
}
|
|
99
90
|
};
|
|
100
91
|
this.endEvents = {
|
|
101
|
-
touchend: {
|
|
102
|
-
eventName: 'touchend',
|
|
103
|
-
inputType: 'touch',
|
|
104
|
-
eventType: 'end',
|
|
105
|
-
order: 1,
|
|
106
|
-
windowEvent: false,
|
|
107
|
-
queue: true,
|
|
108
|
-
rateLimit: 0
|
|
109
|
-
},
|
|
110
92
|
pointerup: {
|
|
111
93
|
eventName: 'mouseup',
|
|
112
94
|
inputType: 'pointer',
|
|
113
95
|
eventType: 'end',
|
|
114
|
-
order:
|
|
96
|
+
order: 2,
|
|
115
97
|
windowEvent: false,
|
|
116
98
|
queue: true,
|
|
117
99
|
rateLimit: 0
|
|
@@ -126,6 +108,39 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
126
108
|
rateLimit: 0
|
|
127
109
|
}
|
|
128
110
|
};
|
|
111
|
+
this.clickEvents = {
|
|
112
|
+
click: {
|
|
113
|
+
eventName: 'click',
|
|
114
|
+
inputType: 'mouse',
|
|
115
|
+
eventType: 'click',
|
|
116
|
+
order: 1,
|
|
117
|
+
windowEvent: false,
|
|
118
|
+
queue: false,
|
|
119
|
+
rateLimit: 0
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
this.touchStart = {
|
|
123
|
+
touchstart: {
|
|
124
|
+
eventName: 'touchstart',
|
|
125
|
+
inputType: 'touch',
|
|
126
|
+
eventType: 'start',
|
|
127
|
+
order: 1,
|
|
128
|
+
windowEvent: false,
|
|
129
|
+
queue: true,
|
|
130
|
+
rateLimit: 0
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
this.touchEnd = {
|
|
134
|
+
touchend: {
|
|
135
|
+
eventName: 'touchend',
|
|
136
|
+
inputType: 'touch',
|
|
137
|
+
eventType: 'end',
|
|
138
|
+
order: 1,
|
|
139
|
+
windowEvent: false,
|
|
140
|
+
queue: true,
|
|
141
|
+
rateLimit: 0
|
|
142
|
+
}
|
|
143
|
+
};
|
|
129
144
|
this.cancelEvents = {
|
|
130
145
|
touchcancel: {
|
|
131
146
|
eventName: 'touchend',
|
|
@@ -189,7 +204,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
189
204
|
eventType: 'resize',
|
|
190
205
|
order: 1,
|
|
191
206
|
windowEvent: true,
|
|
192
|
-
queue:
|
|
207
|
+
queue: true,
|
|
193
208
|
rateLimit: 50
|
|
194
209
|
},
|
|
195
210
|
orientationchange: {
|
|
@@ -198,7 +213,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
198
213
|
eventType: 'resize',
|
|
199
214
|
order: 1,
|
|
200
215
|
windowEvent: true,
|
|
201
|
-
queue:
|
|
216
|
+
queue: true,
|
|
202
217
|
rateLimit: 50
|
|
203
218
|
}
|
|
204
219
|
};
|
|
@@ -273,7 +288,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
273
288
|
rateLimit: 50
|
|
274
289
|
}
|
|
275
290
|
};
|
|
276
|
-
this.allEvents = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, this.startEvents), this.endEvents), this.cancelEvents), this.leaveEvents), this.moveEvents), this.wheelEvents), this.windowEvents), this.windowScrollEvents);
|
|
291
|
+
this.allEvents = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, this.touchStart), this.touchEnd), this.startEvents), this.endEvents), this.clickEvents), this.cancelEvents), this.leaveEvents), this.moveEvents), this.wheelEvents), this.windowEvents), this.windowScrollEvents);
|
|
277
292
|
this.bindedHandleEvent = this.bindedHandleEvent || this.handleEvent.bind(this);
|
|
278
293
|
}
|
|
279
294
|
return _createClass(EventListener, [{
|
|
@@ -523,7 +538,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
523
538
|
event.preventDefault();
|
|
524
539
|
}
|
|
525
540
|
this.end(event);
|
|
526
|
-
if (this.start0) {
|
|
541
|
+
if (this.start0 && eventName === 'touchend') {
|
|
527
542
|
var deltaX = this.end0 ? Math.abs(this.end0.originalX - this.start0.originalX) : 0;
|
|
528
543
|
var deltaY = this.end0 ? Math.abs(this.end0.originalY - this.start0.originalY) : 0;
|
|
529
544
|
var period = this.end0 ? Math.abs(this.end0.timeStamp - this.start0.timeStamp) : 300;
|
|
@@ -546,6 +561,24 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
546
561
|
this.touchCount = 0;
|
|
547
562
|
event.stopPropagation();
|
|
548
563
|
break;
|
|
564
|
+
case 'click':
|
|
565
|
+
if (this.preventDefault(tmodel, eventName)) {
|
|
566
|
+
event.preventDefault();
|
|
567
|
+
}
|
|
568
|
+
this.eventQueue.length = 0;
|
|
569
|
+
this.eventQueue.push({
|
|
570
|
+
eventName: eventName,
|
|
571
|
+
eventItem: eventItem,
|
|
572
|
+
eventType: eventType,
|
|
573
|
+
originalName: originalName,
|
|
574
|
+
tmodel: tmodel,
|
|
575
|
+
eventTarget: eventTarget,
|
|
576
|
+
timeStamp: now
|
|
577
|
+
});
|
|
578
|
+
this.clearStart();
|
|
579
|
+
this.touchCount = 0;
|
|
580
|
+
event.stopPropagation();
|
|
581
|
+
break;
|
|
549
582
|
case 'wheel':
|
|
550
583
|
if (this.preventDefault(tmodel, eventName)) {
|
|
551
584
|
event.preventDefault();
|
package/build/LocationManager.js
CHANGED
|
@@ -33,16 +33,10 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
33
33
|
this.locationListStats = [];
|
|
34
34
|
this.activatedList = [];
|
|
35
35
|
this.activatedMap = {};
|
|
36
|
-
this.screenWidth = (0, _App.getScreenWidth)();
|
|
37
|
-
this.screenHeight = (0, _App.getScreenHeight)();
|
|
38
|
-
this.resizeLastUpdate = 0;
|
|
39
|
-
this.resizeFlag = false;
|
|
40
36
|
}
|
|
41
37
|
return _createClass(LocationManager, [{
|
|
42
38
|
key: "clear",
|
|
43
39
|
value: function clear() {
|
|
44
|
-
this.screenWidth = 0;
|
|
45
|
-
this.screenHeight = 0;
|
|
46
40
|
this.visibleChildrenLengthMap = {};
|
|
47
41
|
this.childrenLengthMap = {};
|
|
48
42
|
this.activatedList = [];
|
|
@@ -56,13 +50,6 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
56
50
|
this.hasLocationMap = {};
|
|
57
51
|
this.locationListStats = [];
|
|
58
52
|
this.startTime = _TUtil.TUtil.now();
|
|
59
|
-
this.resizeFlag = false;
|
|
60
|
-
if (this.screenWidth !== (0, _App.getScreenWidth)() || this.screenHeight !== (0, _App.getScreenHeight)()) {
|
|
61
|
-
this.resizeLastUpdate = this.startTime;
|
|
62
|
-
this.resizeFlag = false;
|
|
63
|
-
this.screenWidth = (0, _App.getScreenWidth)();
|
|
64
|
-
this.screenHeight = (0, _App.getScreenHeight)();
|
|
65
|
-
}
|
|
66
53
|
this.calculate();
|
|
67
54
|
Object.keys(this.visibleChildrenLengthMap).forEach(function (key) {
|
|
68
55
|
var _this$visibleChildren = _this.visibleChildrenLengthMap[key],
|
|
@@ -246,13 +233,13 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
246
233
|
_App.tApp.targetManager.setActualValues(tmodel);
|
|
247
234
|
if (tmodel.hasDom()) {
|
|
248
235
|
if (_TModelUtil.TModelUtil.shouldMeasureWidthFromDom(tmodel)) {
|
|
249
|
-
_TargetUtil.TargetUtil.setWidthFromDom(tmodel
|
|
236
|
+
_TargetUtil.TargetUtil.setWidthFromDom(tmodel);
|
|
250
237
|
tmodel.addToStyleTargetList('width');
|
|
251
238
|
}
|
|
252
239
|
}
|
|
253
240
|
if (tmodel.hasDom()) {
|
|
254
241
|
if (_TModelUtil.TModelUtil.shouldMeasureHeightFromDom(tmodel)) {
|
|
255
|
-
_TargetUtil.TargetUtil.setHeightFromDom(tmodel
|
|
242
|
+
_TargetUtil.TargetUtil.setHeightFromDom(tmodel);
|
|
256
243
|
tmodel.addToStyleTargetList('height');
|
|
257
244
|
}
|
|
258
245
|
}
|
package/build/RunScheduler.js
CHANGED
|
@@ -31,6 +31,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
31
31
|
this.rerunId = '';
|
|
32
32
|
this.delayProcess = undefined;
|
|
33
33
|
this.resetting = false;
|
|
34
|
+
this.activeStartTime = undefined;
|
|
34
35
|
}
|
|
35
36
|
return _createClass(RunScheduler, [{
|
|
36
37
|
key: "resetRuns",
|
|
@@ -57,7 +58,8 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
57
58
|
this.rerunId = '';
|
|
58
59
|
this.delayProcess = undefined;
|
|
59
60
|
this.resetting = false;
|
|
60
|
-
|
|
61
|
+
this.activeStartTime = undefined;
|
|
62
|
+
case 13:
|
|
61
63
|
case "end":
|
|
62
64
|
return _context.stop();
|
|
63
65
|
}
|
|
@@ -132,14 +134,18 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
132
134
|
if (newDelay >= 15) {
|
|
133
135
|
if ((0, _App.getEvents)().eventQueue.length > 0) {
|
|
134
136
|
this.schedule(15, "events-".concat((0, _App.getEvents)().eventQueue.length));
|
|
137
|
+
} else if ((0, _App.getManager)().lists.updatingTModels.length > 0) {
|
|
138
|
+
this.schedule(15, "getManager-needsRerun-updatingTModels");
|
|
135
139
|
} else if ((0, _App.getManager)().lists.activeTModels.length > 0) {
|
|
136
140
|
var activeTModel = (0, _App.getManager)().lists.activeTModels.find(function (tmodel) {
|
|
137
141
|
return tmodel.activeTargetList.some(function (target) {
|
|
138
|
-
return tmodel.isTargetEnabled(target);
|
|
142
|
+
return tmodel.isTargetEnabled(target) && tmodel.shouldScheduleRun(target);
|
|
139
143
|
});
|
|
140
144
|
});
|
|
141
145
|
if (activeTModel) {
|
|
142
|
-
this.
|
|
146
|
+
var delay = !this.activeStartTime || _TUtil.TUtil.now() - this.activeStartTime > 15 ? 1 : 15;
|
|
147
|
+
this.activeStartTime = _TUtil.TUtil.now();
|
|
148
|
+
this.schedule(delay, "getManager-needsRerun-".concat(activeTModel.oid, "-").concat(activeTModel.activeTargetList));
|
|
143
149
|
}
|
|
144
150
|
}
|
|
145
151
|
}
|
package/build/TModel.js
CHANGED
|
@@ -116,7 +116,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
116
116
|
index: index,
|
|
117
117
|
child: child
|
|
118
118
|
});
|
|
119
|
-
|
|
119
|
+
child.activate();
|
|
120
120
|
return this;
|
|
121
121
|
}
|
|
122
122
|
}, {
|
|
@@ -337,11 +337,13 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
337
337
|
key: "val",
|
|
338
338
|
value: function val(key, value) {
|
|
339
339
|
var actual = this.actualValues;
|
|
340
|
+
var lastActual = this.lastActualValues;
|
|
340
341
|
if (key.startsWith('_')) {
|
|
341
342
|
actual = this;
|
|
342
343
|
key = key.slice(1);
|
|
343
344
|
}
|
|
344
345
|
if (value !== undefined) {
|
|
346
|
+
lastActual[key] = actual[key];
|
|
345
347
|
if (value !== actual[key]) {
|
|
346
348
|
actual[key] = value;
|
|
347
349
|
}
|
|
@@ -349,6 +351,11 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
349
351
|
}
|
|
350
352
|
return actual[key];
|
|
351
353
|
}
|
|
354
|
+
}, {
|
|
355
|
+
key: "lastVal",
|
|
356
|
+
value: function lastVal(key) {
|
|
357
|
+
return this.lastActualValues[key];
|
|
358
|
+
}
|
|
352
359
|
}, {
|
|
353
360
|
key: "floorVal",
|
|
354
361
|
value: function floorVal(key) {
|
|
@@ -581,6 +588,9 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
581
588
|
}, {
|
|
582
589
|
key: "canHaveDom",
|
|
583
590
|
value: function canHaveDom() {
|
|
591
|
+
if (this.targets['$dom'] && !this.val('$dom')) {
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
584
594
|
return this.val('canHaveDom');
|
|
585
595
|
}
|
|
586
596
|
}, {
|
package/build/TModelManager.js
CHANGED
|
@@ -346,8 +346,12 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
346
346
|
var _tmodel$getDomHolder;
|
|
347
347
|
var tmodel = _needsDom[_i];
|
|
348
348
|
if ((_tmodel$getDomHolder = tmodel.getDomHolder(tmodel)) !== null && _tmodel$getDomHolder !== void 0 && _tmodel$getDomHolder.exists()) {
|
|
349
|
-
tmodel
|
|
350
|
-
|
|
349
|
+
if (tmodel.val('$dom')) {
|
|
350
|
+
tmodel.$dom = tmodel.val('$dom');
|
|
351
|
+
} else {
|
|
352
|
+
tmodel.$dom = new _$Dom.$Dom();
|
|
353
|
+
_TModelUtil.TModelUtil.createDom(tmodel);
|
|
354
|
+
}
|
|
351
355
|
tmodel.getDomHolder(tmodel).appendTModel$Dom(tmodel);
|
|
352
356
|
tmodel.hasDomNow = true;
|
|
353
357
|
}
|
package/build/TargetExecutor.js
CHANGED
|
@@ -55,6 +55,7 @@ var TargetExecutor = exports.TargetExecutor = /*#__PURE__*/function () {
|
|
|
55
55
|
value: function updateTarget(tmodel, targetValue, key) {
|
|
56
56
|
targetValue.executionCount++;
|
|
57
57
|
targetValue.executionFlag = true;
|
|
58
|
+
tmodel.setActualValueLastUpdate(key);
|
|
58
59
|
if (tmodel.getTargetSteps(key) === 0) {
|
|
59
60
|
TargetExecutor.snapActualToTarget(tmodel, key);
|
|
60
61
|
}
|
|
@@ -109,7 +110,6 @@ var TargetExecutor = exports.TargetExecutor = /*#__PURE__*/function () {
|
|
|
109
110
|
var oldValue = tmodel.val(key);
|
|
110
111
|
var value = tmodel.targetValues[key].value;
|
|
111
112
|
tmodel.val(key, typeof value === 'function' ? value.call(tmodel) : value);
|
|
112
|
-
tmodel.setActualValueLastUpdate(key);
|
|
113
113
|
_TargetUtil.TargetUtil.handleValueChange(tmodel, key, tmodel.val(key), oldValue, 0, 0);
|
|
114
114
|
}
|
|
115
115
|
}, {
|
package/build/TargetUtil.js
CHANGED
|
@@ -247,7 +247,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
247
247
|
}
|
|
248
248
|
}, {
|
|
249
249
|
key: "setWidthFromDom",
|
|
250
|
-
value: function setWidthFromDom(child
|
|
250
|
+
value: function setWidthFromDom(child) {
|
|
251
251
|
var _child$domWidth, _child$domWidth2;
|
|
252
252
|
var height = (_child$domWidth = child.domWidth) === null || _child$domWidth === void 0 ? void 0 : _child$domWidth.height;
|
|
253
253
|
var width = (_child$domWidth2 = child.domWidth) === null || _child$domWidth2 === void 0 ? void 0 : _child$domWidth2.width;
|
|
@@ -257,7 +257,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
257
257
|
child.isTextOnly() ? child.$dom.text(child.getHtml()) : child.$dom.html(child.getHtml());
|
|
258
258
|
rerender = true;
|
|
259
259
|
}
|
|
260
|
-
if (!_TUtil.TUtil.isDefined(child.domWidth) || rerender || height !== child.getHeight() ||
|
|
260
|
+
if (!_TUtil.TUtil.isDefined(child.domWidth) || rerender || height !== child.getHeight() || domParent && child.getActualValueLastUpdate('width') <= domParent.getActualValueLastUpdate('width')) {
|
|
261
261
|
child.$dom.width('auto');
|
|
262
262
|
width = child.$dom.width();
|
|
263
263
|
height = child.$dom.height();
|
|
@@ -271,7 +271,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
271
271
|
}
|
|
272
272
|
}, {
|
|
273
273
|
key: "setHeightFromDom",
|
|
274
|
-
value: function setHeightFromDom(child
|
|
274
|
+
value: function setHeightFromDom(child) {
|
|
275
275
|
var _child$domHeight, _child$domHeight2;
|
|
276
276
|
var height = (_child$domHeight = child.domHeight) === null || _child$domHeight === void 0 ? void 0 : _child$domHeight.height;
|
|
277
277
|
var width = (_child$domHeight2 = child.domHeight) === null || _child$domHeight2 === void 0 ? void 0 : _child$domHeight2.width;
|
|
@@ -281,7 +281,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
281
281
|
child.isTextOnly() ? child.$dom.text(child.getHtml()) : child.$dom.html(child.getHtml());
|
|
282
282
|
rerender = true;
|
|
283
283
|
}
|
|
284
|
-
if (!_TUtil.TUtil.isDefined(child.domHeight) || rerender || width !== child.getWidth() ||
|
|
284
|
+
if (!_TUtil.TUtil.isDefined(child.domHeight) || rerender || width !== child.getWidth() || domParent && child.getActualValueLastUpdate('height') <= domParent.getActualValueLastUpdate('height')) {
|
|
285
285
|
child.$dom.height('auto');
|
|
286
286
|
width = child.$dom.width();
|
|
287
287
|
height = child.$dom.height();
|
|
@@ -443,32 +443,32 @@ _defineProperty(TargetUtil, "cssFunctionMap", {
|
|
|
443
443
|
z: 0
|
|
444
444
|
}
|
|
445
445
|
});
|
|
446
|
-
_defineProperty(TargetUtil, "
|
|
446
|
+
_defineProperty(TargetUtil, "bypassInitialProcessingTargetMap", {
|
|
447
447
|
onChildrenChange: true,
|
|
448
448
|
onVisibleChildrenChange: true,
|
|
449
449
|
onPageClose: true,
|
|
450
450
|
onVisible: true
|
|
451
451
|
});
|
|
452
452
|
_defineProperty(TargetUtil, "targetToEventsMapping", {
|
|
453
|
-
onClickEvent: ['
|
|
454
|
-
onTouchStart: ['startEvents'],
|
|
455
|
-
onTouchEnd: ['endEvents'],
|
|
456
|
-
onSwipeEvent: ['startEvents', 'endEvents', 'cancelEvents', 'moveEvents'],
|
|
457
|
-
onAnySwipeEvent: ['startEvents', 'endEvents', 'cancelEvents', 'moveEvents'],
|
|
458
|
-
onTouchEvent: ['startEvents', 'endEvents', 'cancelEvents'],
|
|
453
|
+
onClickEvent: ['clickEvents', 'touchStart', 'touchEnd'],
|
|
454
|
+
onTouchStart: ['touchStart', 'startEvents'],
|
|
455
|
+
onTouchEnd: ['touchEnd', 'endEvents'],
|
|
456
|
+
onSwipeEvent: ['touchStart', 'startEvents', 'touchEnd', 'endEvents', 'cancelEvents', 'moveEvents'],
|
|
457
|
+
onAnySwipeEvent: ['touchStart', 'startEvents', 'touchEnd', 'endEvents', 'cancelEvents', 'moveEvents'],
|
|
458
|
+
onTouchEvent: ['touchStart', 'startEvents', 'touchEnd', 'endEvents', 'cancelEvents'],
|
|
459
459
|
onEnterEvent: ['moveEvents', 'leaveEvents'],
|
|
460
460
|
onLeaveEvent: ['moveEvents', 'leaveEvents'],
|
|
461
|
-
onScrollEvent: ['startEvents', 'endEvents', 'cancelEvents', 'moveEvents', 'wheelEvents'],
|
|
461
|
+
onScrollEvent: ['touchStart', 'startEvents', 'touchEnd', 'endEvents', 'cancelEvents', 'moveEvents', 'wheelEvents'],
|
|
462
462
|
onWindowScrollEvent: ['windowScrollEvents'],
|
|
463
|
-
onClick: ['
|
|
464
|
-
onSwipe: ['startEvents', 'endEvents', 'cancelEvents', 'moveEvents'],
|
|
465
|
-
onAnySwipe: ['startEvents', 'endEvents', 'cancelEvents', 'moveEvents'],
|
|
466
|
-
onTouch: ['startEvents', 'endEvents', 'cancelEvents'],
|
|
463
|
+
onClick: ['clickEvents', 'touchStart', 'touchEnd'],
|
|
464
|
+
onSwipe: ['touchStart', 'startEvents', 'touchEnd', 'endEvents', 'cancelEvents', 'moveEvents'],
|
|
465
|
+
onAnySwipe: ['touchStart', 'startEvents', 'touchEnd', 'endEvents', 'cancelEvents', 'moveEvents'],
|
|
466
|
+
onTouch: ['touchStart', 'startEvents', 'touchEnd', 'endEvents', 'cancelEvents'],
|
|
467
467
|
onEnter: ['moveEvents', 'leaveEvents'],
|
|
468
468
|
onLeave: ['moveEvents', 'leaveEvents'],
|
|
469
|
-
onScroll: ['startEvents', 'endEvents', 'cancelEvents', 'moveEvents', 'wheelEvents'],
|
|
470
|
-
onScrollLeft: ['startEvents', 'endEvents', 'cancelEvents', 'moveEvents', 'wheelEvents'],
|
|
471
|
-
onScrollTop: ['startEvents', 'endEvents', 'cancelEvents', 'moveEvents', 'wheelEvents'],
|
|
469
|
+
onScroll: ['touchStart', 'startEvents', 'touchEnd', 'endEvents', 'cancelEvents', 'moveEvents', 'wheelEvents'],
|
|
470
|
+
onScrollLeft: ['touchStart', 'startEvents', 'touchEnd', 'endEvents', 'cancelEvents', 'moveEvents', 'wheelEvents'],
|
|
471
|
+
onScrollTop: ['touchStart', 'startEvents', 'touchEnd', 'endEvents', 'cancelEvents', 'moveEvents', 'wheelEvents'],
|
|
472
472
|
onWindowScroll: ['windowScrollEvents']
|
|
473
473
|
});
|
|
474
474
|
_defineProperty(TargetUtil, "touchEventMap", {
|
|
@@ -528,31 +528,12 @@ _defineProperty(TargetUtil, "internalEventMap", {
|
|
|
528
528
|
onResize: function onResize(tmodel) {
|
|
529
529
|
var lastUpdateWidth = tmodel.getActualValueLastUpdate('width');
|
|
530
530
|
var lastUpdateHeight = tmodel.getActualValueLastUpdate('height');
|
|
531
|
-
var
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
tmodel.setActualValueLastUpdate('height');
|
|
535
|
-
return resizeLastUpdate > Math.max(lastUpdateWidth, lastUpdateHeight);
|
|
536
|
-
}
|
|
537
|
-
if (lastUpdateWidth) {
|
|
538
|
-
tmodel.setActualValueLastUpdate('width');
|
|
539
|
-
return resizeLastUpdate > lastUpdateWidth;
|
|
540
|
-
}
|
|
541
|
-
if (lastUpdateHeight) {
|
|
542
|
-
tmodel.setActualValueLastUpdate('height');
|
|
543
|
-
return resizeLastUpdate > lastUpdateHeight;
|
|
544
|
-
}
|
|
545
|
-
return (0, _App.getLocationManager)().resizeFlag;
|
|
546
|
-
},
|
|
547
|
-
onParentResize: function onParentResize(tmodel) {
|
|
548
|
-
if (tmodel.getParent().getActualValueLastUpdate('width') > tmodel.getActualValueLastUpdate('width')) {
|
|
549
|
-
tmodel.setActualValueLastUpdate('width');
|
|
550
|
-
return true;
|
|
551
|
-
}
|
|
552
|
-
if (tmodel.getParent().getActualValueLastUpdate('height') > tmodel.getActualValueLastUpdate('height')) {
|
|
553
|
-
tmodel.setActualValueLastUpdate('height');
|
|
531
|
+
var parent = tmodel.getParent();
|
|
532
|
+
var resizeLastUpdate = parent ? Math.max(parent.getActualValueLastUpdate('width') || 0, parent.getActualValueLastUpdate('height') || 0, (0, _App.getResizeLastUpdate)()) : (0, _App.getResizeLastUpdate)();
|
|
533
|
+
if ((lastUpdateWidth || lastUpdateHeight) && resizeLastUpdate > Math.max(lastUpdateWidth || 0, lastUpdateHeight || 0)) {
|
|
554
534
|
return true;
|
|
555
535
|
}
|
|
536
|
+
return false;
|
|
556
537
|
}
|
|
557
538
|
});
|
|
558
539
|
_defineProperty(TargetUtil, "allEventMap", _objectSpread(_objectSpread({}, _TargetUtil.touchEventMap), {}, {
|
package/build/Text.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
}();
|