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
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PageManager = void 0;
7
+ var _TUtil = require("./TUtil.js");
8
+ var _App = require("./App.js");
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
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
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; } }
13
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
14
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
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; }
16
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
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); } }
18
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
20
+ 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); }
21
+ var PageManager = exports.PageManager = /*#__PURE__*/function () {
22
+ function PageManager() {
23
+ _classCallCheck(this, PageManager);
24
+ this.lastLink = document.URL;
25
+ this.pageCache = {};
26
+ }
27
+ return _createClass(PageManager, [{
28
+ key: "openPage",
29
+ value: function openPage(link) {
30
+ var _this = this;
31
+ _App.tApp.stop();
32
+ _App.tApp.reset();
33
+ if (!this.pageCache[link]) {
34
+ _App.tApp.tRoot.getChildren().forEach(function (child) {
35
+ return child.$dom.innerHTML("");
36
+ });
37
+ _App.tApp.tRoot = _App.tApp.tRootFactory();
38
+ this.lastLink = link;
39
+ setTimeout(_App.tApp.start);
40
+ } else {
41
+ _App.tApp.tRoot = this.pageCache[link].tRoot;
42
+ _App.tApp.tRoot.getChildren().forEach(function (child, index) {
43
+ child.$dom.innerHTML(_this.pageCache[link].htmls[index]);
44
+ });
45
+ _TUtil.TUtil.initDoms(this.pageCache[link].visibleList);
46
+ _App.tApp.manager.lists.visible = _toConsumableArray(this.pageCache[link].visibleList);
47
+ this.lastLink = link;
48
+ setTimeout(_App.tApp.start);
49
+ }
50
+ }
51
+ }, {
52
+ key: "openLinkFromHistory",
53
+ value: function openLinkFromHistory(state) {
54
+ if (state.link) {
55
+ this.openPage(state.link);
56
+ } else if (state.browserUrl) {
57
+ history.replaceState({
58
+ link: state.browserUrl
59
+ }, "", state.browserUrl);
60
+ this.openPage(state.browserUrl);
61
+ }
62
+ _App.tApp.manager.scheduleRun(0, "pagemanager-openLinkFromHistory");
63
+ }
64
+ }, {
65
+ key: "openLink",
66
+ value: function openLink(link) {
67
+ link = _TUtil.TUtil.getFullLink(link);
68
+ if (this.lastLink) {
69
+ this.pageCache[this.lastLink] = {
70
+ link: this.lastLink,
71
+ htmls: _App.tApp.tRoot.getChildren().map(function (child) {
72
+ return child.$dom.innerHTML();
73
+ }),
74
+ visibleList: _toConsumableArray(_App.tApp.manager.lists.visible),
75
+ tRoot: _App.tApp.tRoot
76
+ };
77
+ }
78
+ history.pushState({
79
+ link: link
80
+ }, "", link);
81
+ this.openPage(link);
82
+ _App.tApp.manager.scheduleRun(0, "pagemanager-processOpenLink");
83
+ }
84
+ }, {
85
+ key: "updateBrowserUrl",
86
+ value: function updateBrowserUrl(link) {
87
+ var currentState = window.history.state;
88
+ if (!currentState.browserUrl) {
89
+ this.pageCache[document.URL] = {
90
+ link: document.URL,
91
+ htmls: _App.tApp.tRoot.getChildren().map(function (child) {
92
+ return child.$dom.innerHTML();
93
+ }),
94
+ visibleList: _toConsumableArray(_App.tApp.manager.lists.visible),
95
+ tRoot: _App.tApp.tRoot
96
+ };
97
+ history.pushState({
98
+ browserUrl: link
99
+ }, "", link);
100
+ } else {
101
+ history.replaceState({
102
+ browserUrl: link
103
+ }, "", link);
104
+ }
105
+ _App.tApp.manager.scheduleRun(0, "pagemanager-processUpdateBrowserUrl");
106
+ }
107
+ }, {
108
+ key: "back",
109
+ value: function back() {
110
+ return history.back();
111
+ }
112
+ }]);
113
+ }();
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SearchUtil = void 0;
7
+ var _TUtil = require("./TUtil.js");
8
+ var _App = require("./App.js");
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
+ 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; } } }; }
11
+ 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
+ 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; }
13
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
+ 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); } }
15
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
+ 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; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
+ 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); }
19
+ var SearchUtil = exports.SearchUtil = /*#__PURE__*/function () {
20
+ function SearchUtil() {
21
+ _classCallCheck(this, SearchUtil);
22
+ }
23
+ return _createClass(SearchUtil, null, [{
24
+ key: "findFirstPinchHandler",
25
+ value: function findFirstPinchHandler(tmodel) {
26
+ return SearchUtil.findEventHandler(tmodel, 'pinch');
27
+ }
28
+ }, {
29
+ key: "findFirstScrollTopHandler",
30
+ value: function findFirstScrollTopHandler(tmodel) {
31
+ return SearchUtil.findEventHandler(tmodel, 'scrollTop');
32
+ }
33
+ }, {
34
+ key: "findFirstScrollLeftHandler",
35
+ value: function findFirstScrollLeftHandler(tmodel) {
36
+ return SearchUtil.findEventHandler(tmodel, 'scrollLeft');
37
+ }
38
+ }, {
39
+ key: "findFirstTouchHandler",
40
+ value: function findFirstTouchHandler(tmodel) {
41
+ return SearchUtil.findEventHandler(tmodel, 'touch');
42
+ }
43
+ }, {
44
+ key: "findEventHandler",
45
+ value: function findEventHandler(tmodel, eventName) {
46
+ while (tmodel) {
47
+ if (tmodel.canHandleEvents(eventName)) {
48
+ return tmodel;
49
+ }
50
+ tmodel = tmodel.getParent();
51
+ }
52
+ }
53
+ }, {
54
+ key: "findParentByType",
55
+ value: function findParentByType(child, type) {
56
+ var indexKey = "".concat(child.oid, "__").concat(type);
57
+ if (!_TUtil.TUtil.isDefined(SearchUtil.foundParentWithType[indexKey])) {
58
+ var parent = child.getParent();
59
+ while (parent) {
60
+ if (parent.type === type) {
61
+ SearchUtil.foundParentWithType[indexKey] = parent;
62
+ break;
63
+ }
64
+ parent = parent.getParent();
65
+ }
66
+ }
67
+ return SearchUtil.foundParentWithType[indexKey];
68
+ }
69
+ }, {
70
+ key: "findParentByTarget",
71
+ value: function findParentByTarget(child, targetName) {
72
+ var indexKey = "".concat(child.oid, "__").concat(targetName);
73
+ if (!_TUtil.TUtil.isDefined(SearchUtil.foundParentWithTarget[indexKey])) {
74
+ var parent = child.getParent();
75
+ while (parent) {
76
+ if (_TUtil.TUtil.isDefined(parent.targets[targetName]) || _TUtil.TUtil.isDefined(parent.targetValues[targetName])) {
77
+ SearchUtil.foundParentWithTarget[indexKey] = parent;
78
+ break;
79
+ }
80
+ parent = parent.getParent();
81
+ }
82
+ }
83
+ return SearchUtil.foundParentWithTarget[indexKey];
84
+ }
85
+ }, {
86
+ key: "findByType",
87
+ value: function findByType(type) {
88
+ if (!_TUtil.TUtil.isDefined(SearchUtil.foundTypeMap[type])) {
89
+ var _search = function search(container) {
90
+ if (container.type === type) {
91
+ return container;
92
+ }
93
+ var _iterator = _createForOfIteratorHelper(container.getChildren()),
94
+ _step;
95
+ try {
96
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
97
+ var child = _step.value;
98
+ if (child && child.hasChildren()) {
99
+ var found = _search(child);
100
+ if (found) {
101
+ return found;
102
+ }
103
+ } else if (child && child.type === type) {
104
+ return child;
105
+ }
106
+ }
107
+ } catch (err) {
108
+ _iterator.e(err);
109
+ } finally {
110
+ _iterator.f();
111
+ }
112
+ };
113
+ var tmodel = _search(_App.tApp.tRoot);
114
+ if (tmodel) {
115
+ SearchUtil.foundTypeMap[type] = tmodel;
116
+ }
117
+ }
118
+ return SearchUtil.foundTypeMap[type];
119
+ }
120
+ }, {
121
+ key: "findByTarget",
122
+ value: function findByTarget(target) {
123
+ if (!_TUtil.TUtil.isDefined(SearchUtil.foundTargetMap[target])) {
124
+ var _search2 = function search(container) {
125
+ if (container.targets[target]) {
126
+ return container;
127
+ }
128
+ var _iterator2 = _createForOfIteratorHelper(container.getChildren()),
129
+ _step2;
130
+ try {
131
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
132
+ var child = _step2.value;
133
+ if (child && child.hasChildren()) {
134
+ var found = _search2(child);
135
+ if (found) {
136
+ return found;
137
+ }
138
+ } else if (child && child.targets[target]) {
139
+ return child;
140
+ }
141
+ }
142
+ } catch (err) {
143
+ _iterator2.e(err);
144
+ } finally {
145
+ _iterator2.f();
146
+ }
147
+ };
148
+ var tmodel = _search2(_App.tApp.tRoot);
149
+ if (tmodel) {
150
+ SearchUtil.foundTargetMap[target] = tmodel;
151
+ }
152
+ }
153
+ return SearchUtil.foundTargetMap[target];
154
+ }
155
+ }, {
156
+ key: "find",
157
+ value: function find(oid) {
158
+ if (!_TUtil.TUtil.isDefined(SearchUtil.foundOids[oid])) {
159
+ var _search3 = function search(container) {
160
+ if (container.oid === oid) {
161
+ return container;
162
+ }
163
+ var _iterator3 = _createForOfIteratorHelper(container.getChildren()),
164
+ _step3;
165
+ try {
166
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
167
+ var child = _step3.value;
168
+ if (child && child.hasChildren()) {
169
+ var found = _search3(child);
170
+ if (found) {
171
+ return found;
172
+ }
173
+ } else if (child && child.oid === oid) {
174
+ return child;
175
+ }
176
+ }
177
+ } catch (err) {
178
+ _iterator3.e(err);
179
+ } finally {
180
+ _iterator3.f();
181
+ }
182
+ };
183
+ var tmodel = _search3(_App.tApp.tRoot);
184
+ if (tmodel) {
185
+ SearchUtil.foundOids[oid] = tmodel;
186
+ }
187
+ }
188
+ return SearchUtil.foundOids[oid];
189
+ }
190
+ }]);
191
+ }();
192
+ _defineProperty(SearchUtil, "foundParentWithType", {});
193
+ _defineProperty(SearchUtil, "foundParentWithTarget", {});
194
+ _defineProperty(SearchUtil, "foundTypeMap", {});
195
+ _defineProperty(SearchUtil, "foundTargetMap", {});
196
+ _defineProperty(SearchUtil, "foundOids", {});