targetj 1.0.74 → 1.0.76

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.
Files changed (44) hide show
  1. package/babel.config.json +17 -0
  2. package/build/$Dom.js +424 -0
  3. package/build/App.js +187 -0
  4. package/build/Bracket.js +157 -0
  5. package/build/BracketGenerator.js +86 -0
  6. package/build/Browser.js +105 -0
  7. package/build/ColorUtil.js +182 -0
  8. package/build/Dim.js +31 -0
  9. package/build/Easing.js +59 -0
  10. package/build/EventListener.js +664 -0
  11. package/build/LoadingManager.js +366 -0
  12. package/build/LocationManager.js +211 -0
  13. package/build/Moves.js +71 -0
  14. package/build/PageManager.js +113 -0
  15. package/build/SearchUtil.js +196 -0
  16. package/build/TModel.js +1000 -0
  17. package/build/TModelManager.js +605 -0
  18. package/build/TUtil.js +188 -0
  19. package/build/TargetExecutor.js +117 -0
  20. package/build/TargetManager.js +197 -0
  21. package/build/TargetUtil.js +299 -0
  22. package/build/Viewport.js +163 -0
  23. package/package.json +11 -4
  24. package/webpack.config.js +14 -1
  25. package/src/$Dom.js +0 -380
  26. package/src/App.js +0 -224
  27. package/src/Bracket.js +0 -212
  28. package/src/Browser.js +0 -122
  29. package/src/ColorUtil.js +0 -166
  30. package/src/Dim.js +0 -21
  31. package/src/Easing.js +0 -41
  32. package/src/EventListener.js +0 -570
  33. package/src/LoadingManager.js +0 -368
  34. package/src/LocationManager.js +0 -236
  35. package/src/Moves.js +0 -59
  36. package/src/PageManager.js +0 -87
  37. package/src/SearchUtil.js +0 -210
  38. package/src/TModel.js +0 -937
  39. package/src/TModelManager.js +0 -575
  40. package/src/TUtil.js +0 -162
  41. package/src/TargetExecutor.js +0 -113
  42. package/src/TargetManager.js +0 -191
  43. package/src/TargetUtil.js +0 -307
  44. package/src/Viewport.js +0 -180
@@ -1,87 +0,0 @@
1
- import { TUtil } from "./TUtil.js";
2
- import { tapp } from "./App.js";
3
-
4
- function PageManager() {
5
- this.lastLink = document.URL;
6
- this.pageCache = {};
7
- }
8
-
9
- PageManager.prototype.openPage = function(link) {
10
-
11
- tapp.stop();
12
- tapp.reset();
13
-
14
- var self = this;
15
-
16
- if (!this.pageCache[link]) {
17
- tapp.troot.getChildren().forEach(function(child) { child.$dom.innerHTML(""); });
18
- tapp.troot = tapp.trootFactory();
19
- self.lastLink = link;
20
- setTimeout(tapp.start);
21
- } else {
22
- tapp.troot = this.pageCache[link].troot;
23
- tapp.troot.getChildren().forEach(function(child, index) {
24
- child.$dom.innerHTML(self.pageCache[link].htmls[index]);
25
- });
26
-
27
- TUtil.initDoms(this.pageCache[link].visibleList);
28
- tapp.manager.lists.visible = this.pageCache[link].visibleList.slice(0);
29
- self.lastLink = link;
30
- setTimeout(tapp.start);
31
- }
32
- };
33
-
34
- PageManager.prototype.openLinkFromHistory = function(state) {
35
- if (state.link) {
36
- this.openPage(state.link);
37
- } else if (state.browserUrl) {
38
- history.replaceState({ link: state.browserUrl }, "", state.browserUrl);
39
- this.openPage(state.browserUrl);
40
- }
41
-
42
- tapp.manager.scheduleRun(0, "pagemanager-openLinkFromHistory");
43
- };
44
-
45
- PageManager.prototype.openLink = function(link) {
46
-
47
- link = TUtil.getFullLink(link);
48
-
49
- if (this.lastLink) {
50
- this.pageCache[this.lastLink] = {
51
- link: this.lastLink,
52
- htmls: tapp.troot.getChildren().map(function(child) { return child.$dom.innerHTML(); }),
53
- visibleList: tapp.manager.lists.visible.slice(0),
54
- troot: tapp.troot
55
- };
56
- }
57
-
58
- history.pushState({ link: link }, "", link);
59
-
60
- this.openPage(link);
61
-
62
- tapp.manager.scheduleRun(0, "pagemanager-processOpenLink");
63
- };
64
-
65
- PageManager.prototype.updateBrowserUrl = function(link) {
66
- var currentState = window.history.state;
67
-
68
- if (!currentState.browserUrl) {
69
- this.pageCache[document.URL] = {
70
- link: document.URL,
71
- htmls: tapp.troot.getChildren().map(function(child) { return child.$dom.innerHTML(); }),
72
- visibleList: tapp.manager.lists.visible.slice(0),
73
- troot: tapp.troot
74
- };
75
- history.pushState({ browserUrl: link }, "", link);
76
- } else {
77
- history.replaceState({ browserUrl: link }, "", link);
78
- }
79
-
80
- tapp.manager.scheduleRun(0, "pagemanager-processUpdateBrowserUrl");
81
- };
82
-
83
- PageManager.prototype.back = function() {
84
- return history.back();
85
- };
86
-
87
- export { PageManager };
package/src/SearchUtil.js DELETED
@@ -1,210 +0,0 @@
1
- import { TUtil } from "./TUtil.js";
2
- import { tapp } from "./App.js";
3
-
4
- function SearchUtil() {}
5
-
6
- SearchUtil.foundParentWithType = {};
7
- SearchUtil.foundParentWithTarget = {};
8
- SearchUtil.foundTypeMap = {};
9
- SearchUtil.foundTargetMap = {};
10
- SearchUtil.foundOids = {};
11
-
12
- SearchUtil.findFirstPinchHandler = function(tmodel) {
13
- return SearchUtil.findEventHandler(tmodel, 'pinch');
14
- };
15
-
16
- SearchUtil.findFirstScrollTopHandler = function(tmodel) {
17
- return SearchUtil.findEventHandler(tmodel, 'scrollTop');
18
- };
19
-
20
- SearchUtil.findFirstScrollLeftHandler = function(tmodel) {
21
- return SearchUtil.findEventHandler(tmodel, 'scrollLeft');
22
- };
23
-
24
- SearchUtil.findFirstTouchHandler = function(tmodel) {
25
- return SearchUtil.findEventHandler(tmodel, 'touch');
26
- };
27
-
28
- SearchUtil.findEventHandler = function(tmodel, eventName) {
29
- while (tmodel) {
30
- if (tmodel.canHandleEvents(eventName)) {
31
- return tmodel;
32
- }
33
-
34
- tmodel = tmodel.getParent();
35
- }
36
- };
37
-
38
- SearchUtil.findParentByType = function(child, type) {
39
- var parent;
40
-
41
- function search() {
42
- parent = child.getParent();
43
- while (parent) {
44
- if (parent.type === type) {
45
- break;
46
- }
47
- parent = parent.getParent();
48
- }
49
- }
50
-
51
- var indexKey = child.oid + "__" + type;
52
-
53
- if (!TUtil.isDefined(SearchUtil.foundParentWithType[indexKey])) {
54
- search();
55
-
56
- if (parent) {
57
- SearchUtil.foundParentWithType[indexKey] = parent;
58
- }
59
- }
60
-
61
- return SearchUtil.foundParentWithType[indexKey];
62
- };
63
-
64
- SearchUtil.findParentByTarget = function(child, targetName) {
65
- var parent;
66
-
67
- function search() {
68
- parent = child.getParent();
69
- while (parent) {
70
- if (TUtil.isDefined(parent.targets[targetName]) || TUtil.isDefined(parent.targetValues[targetName])) {
71
- break;
72
- }
73
- parent = parent.getParent();
74
- }
75
- }
76
-
77
- var indexKey = child.oid + "__" + targetName;
78
-
79
- if (!TUtil.isDefined(SearchUtil.foundParentWithTarget[indexKey])) {
80
- search();
81
-
82
- if (parent) {
83
- SearchUtil.foundParentWithTarget[indexKey] = parent;
84
- }
85
- }
86
-
87
- return SearchUtil.foundParentWithTarget[indexKey];
88
- };
89
-
90
- SearchUtil.findByType = function (type) {
91
- var tmodel;
92
-
93
- function search(container) {
94
-
95
- if (container.type === type) {
96
- return container;
97
- }
98
-
99
- var children = container.getChildren();
100
- var found;
101
-
102
- for (var i = 0; children && i < children.length && !found; i++) {
103
-
104
- tmodel = children[i];
105
-
106
- if (!tmodel) {
107
- continue;
108
- }
109
-
110
- if (tmodel.hasChildren()) {
111
- found = search(tmodel);
112
- } else if (tmodel.type === type) {
113
- found = tmodel;
114
- }
115
- }
116
-
117
- return found;
118
- }
119
-
120
- if (!TUtil.isDefined(SearchUtil.foundTypeMap[type])) {
121
- tmodel = search(tapp.troot);
122
- if (tmodel) {
123
- SearchUtil.foundTypeMap[type] = tmodel;
124
- }
125
- }
126
-
127
- return SearchUtil.foundTypeMap[type];
128
- };
129
-
130
- SearchUtil.findByTarget = function (target) {
131
- var tmodel;
132
-
133
- function search(container) {
134
-
135
- if (container.targets[target]) {
136
- return container;
137
- }
138
-
139
- var children = container.getChildren();
140
- var found;
141
-
142
- for (var i = 0; children && i < children.length && !found; i++) {
143
-
144
- tmodel = children[i];
145
-
146
- if (!tmodel) {
147
- continue;
148
- }
149
-
150
- if (tmodel.hasChildren()) {
151
- found = search(tmodel);
152
- } else if (tmodel.targets[target]) {
153
- found = tmodel;
154
- }
155
- }
156
-
157
- return found;
158
- }
159
-
160
- if (!TUtil.isDefined(SearchUtil.foundTargetMap[target])) {
161
- tmodel = search(tapp.troot);
162
- if (tmodel) {
163
- SearchUtil.foundTargetMap[target] = tmodel;
164
- }
165
- }
166
-
167
- return SearchUtil.foundTargetMap[target];
168
- };
169
-
170
- SearchUtil.find = function (oid) {
171
- var tmodel;
172
-
173
- function search(container) {
174
-
175
- if (container.oid === oid) {
176
- return container;
177
- }
178
-
179
- var children = container.getChildren();
180
- var found;
181
-
182
- for (var i = 0; children && i < children.length && !found; i++) {
183
-
184
- tmodel = children[i];
185
-
186
- if (!tmodel) {
187
- continue;
188
- }
189
-
190
- if (tmodel.hasChildren()) {
191
- found = search(tmodel);
192
- } else if (tmodel.oid === oid) {
193
- found = tmodel;
194
- }
195
- }
196
-
197
- return found;
198
- }
199
-
200
- if (!TUtil.isDefined(SearchUtil.foundOids[oid])) {
201
- tmodel = search(tapp.troot);
202
- if (tmodel) {
203
- SearchUtil.foundOids[oid] = tmodel;
204
- }
205
- }
206
-
207
- return SearchUtil.foundOids[oid];
208
- };
209
-
210
- export { SearchUtil };