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.
- package/babel.config.json +17 -0
- package/build/$Dom.js +424 -0
- package/build/App.js +187 -0
- package/build/Bracket.js +157 -0
- package/build/BracketGenerator.js +86 -0
- package/build/Browser.js +105 -0
- package/build/ColorUtil.js +182 -0
- package/build/Dim.js +31 -0
- package/build/Easing.js +59 -0
- package/build/EventListener.js +664 -0
- package/build/LoadingManager.js +366 -0
- package/build/LocationManager.js +211 -0
- package/build/Moves.js +71 -0
- package/build/PageManager.js +113 -0
- package/build/SearchUtil.js +196 -0
- package/build/TModel.js +1000 -0
- package/build/TModelManager.js +605 -0
- package/build/TUtil.js +188 -0
- package/build/TargetExecutor.js +117 -0
- package/build/TargetManager.js +197 -0
- package/build/TargetUtil.js +299 -0
- package/build/Viewport.js +163 -0
- package/package.json +11 -4
- package/webpack.config.js +14 -1
- package/src/$Dom.js +0 -380
- package/src/App.js +0 -224
- package/src/Bracket.js +0 -212
- package/src/Browser.js +0 -122
- package/src/ColorUtil.js +0 -166
- package/src/Dim.js +0 -21
- package/src/Easing.js +0 -41
- package/src/EventListener.js +0 -570
- package/src/LoadingManager.js +0 -368
- package/src/LocationManager.js +0 -236
- package/src/Moves.js +0 -59
- package/src/PageManager.js +0 -87
- package/src/SearchUtil.js +0 -210
- package/src/TModel.js +0 -937
- package/src/TModelManager.js +0 -575
- package/src/TUtil.js +0 -162
- package/src/TargetExecutor.js +0 -113
- package/src/TargetManager.js +0 -191
- package/src/TargetUtil.js +0 -307
- package/src/Viewport.js +0 -180
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TargetUtil = void 0;
|
|
7
|
+
var _Browser = require("./Browser.js");
|
|
8
|
+
var _TModel = require("./TModel.js");
|
|
9
|
+
var _App = require("./App.js");
|
|
10
|
+
var _TUtil = require("./TUtil.js");
|
|
11
|
+
var _ColorUtil = require("./ColorUtil.js");
|
|
12
|
+
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); }
|
|
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 TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
20
|
+
function TargetUtil() {
|
|
21
|
+
_classCallCheck(this, TargetUtil);
|
|
22
|
+
}
|
|
23
|
+
return _createClass(TargetUtil, null, [{
|
|
24
|
+
key: "emptyValue",
|
|
25
|
+
value: function emptyValue() {
|
|
26
|
+
return {
|
|
27
|
+
value: undefined,
|
|
28
|
+
step: 0,
|
|
29
|
+
steps: 0,
|
|
30
|
+
cycle: 0,
|
|
31
|
+
cycles: 0,
|
|
32
|
+
interval: 0,
|
|
33
|
+
initialValue: undefined,
|
|
34
|
+
scheduleTimeStamp: undefined,
|
|
35
|
+
actualValueLastUpdate: 0,
|
|
36
|
+
status: '',
|
|
37
|
+
executionCount: 0,
|
|
38
|
+
executionFlag: false,
|
|
39
|
+
isImperative: false,
|
|
40
|
+
originalTargetName: undefined,
|
|
41
|
+
easing: undefined,
|
|
42
|
+
creationTime: _Browser.browser.now()
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
key: "bindTargetName",
|
|
47
|
+
value: function bindTargetName(targetInstance, key) {
|
|
48
|
+
var target = targetInstance[key];
|
|
49
|
+
if (_typeof(target) === 'object') {
|
|
50
|
+
['value', 'enabledOn', 'onStepsEnd', 'onValueChange', 'loop', 'onImperativeEnd', 'onImperativeStep'].forEach(function (method) {
|
|
51
|
+
if (typeof target[method] === 'function') {
|
|
52
|
+
var originalMethod = target[method];
|
|
53
|
+
target[method] = function () {
|
|
54
|
+
this.key = key;
|
|
55
|
+
return originalMethod.apply(this, arguments);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
} else if (typeof target === 'function') {
|
|
60
|
+
var originalFunction = target;
|
|
61
|
+
targetInstance[key] = function () {
|
|
62
|
+
this.key = key;
|
|
63
|
+
return originalFunction.apply(this, arguments);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "isValueStepsCycleArray",
|
|
69
|
+
value: function isValueStepsCycleArray(arr) {
|
|
70
|
+
if (arr.length > 4 || arr.length === 0) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
var result = arr.length >= 2;
|
|
74
|
+
for (var i = 1; i < arr.length; i++) {
|
|
75
|
+
if (typeof arr[i] !== 'number') {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return result && (typeof arr[0] === 'number' || TargetUtil.isListTarget(arr[0]) || typeof arr[0] === 'string');
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "isListTarget",
|
|
83
|
+
value: function isListTarget(value) {
|
|
84
|
+
return _typeof(value) === 'object' && Array.isArray(value.list);
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "isAddChildTarget",
|
|
88
|
+
value: function isAddChildTarget(key, value) {
|
|
89
|
+
return value instanceof _TModel.TModel && key === 'addChild';
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "getValueStepsCycles",
|
|
93
|
+
value: function getValueStepsCycles(tmodel, key) {
|
|
94
|
+
var _target = tmodel.targets[key];
|
|
95
|
+
var valueOnly = _target && _target.valueOnly;
|
|
96
|
+
var cycle = tmodel.getTargetCycle(key);
|
|
97
|
+
var lastValue = tmodel.val(key);
|
|
98
|
+
var value = null,
|
|
99
|
+
steps = 0,
|
|
100
|
+
interval = 0,
|
|
101
|
+
cycles = 0;
|
|
102
|
+
function getValue(target) {
|
|
103
|
+
if (Array.isArray(target)) {
|
|
104
|
+
if (valueOnly || !TargetUtil.isValueStepsCycleArray(target)) {
|
|
105
|
+
return [target, steps, interval, cycles];
|
|
106
|
+
} else if (Array.isArray(_target)) {
|
|
107
|
+
return _target;
|
|
108
|
+
} else {
|
|
109
|
+
value = target[0];
|
|
110
|
+
steps = target.length >= 2 ? target[1] : steps;
|
|
111
|
+
interval = target.length >= 3 ? target[2] : interval;
|
|
112
|
+
cycles = target.length >= 4 ? target[3] : cycles;
|
|
113
|
+
return [value, steps, interval, cycles];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (_typeof(target) === 'object' && target !== null) {
|
|
117
|
+
value = typeof target.value === 'function' ? target.value.call(tmodel, cycle, lastValue) : _TUtil.TUtil.isDefined(target.value) ? target.value : target;
|
|
118
|
+
steps = typeof target.steps === 'function' ? target.steps.call(tmodel, cycle) : _TUtil.TUtil.isDefined(target.steps) ? target.steps : 0;
|
|
119
|
+
interval = typeof target.interval === 'function' ? target.interval.call(tmodel, cycle) : _TUtil.TUtil.isDefined(target.interval) ? target.interval : 0;
|
|
120
|
+
cycles = typeof target.cycles === 'function' ? target.cycles.call(tmodel, cycle, tmodel.getTargetCycles(key)) : _TUtil.TUtil.isDefined(target.cycles) ? target.cycles : 0;
|
|
121
|
+
return Array.isArray(value) ? getValue(value) : [value, steps, interval, cycles];
|
|
122
|
+
}
|
|
123
|
+
if (typeof target === 'function') {
|
|
124
|
+
return getValue(target.call(tmodel, cycle, lastValue));
|
|
125
|
+
}
|
|
126
|
+
return [target, steps, interval, cycles];
|
|
127
|
+
}
|
|
128
|
+
return getValue(_target);
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
key: "getIntervalValue",
|
|
132
|
+
value: function getIntervalValue(tmodel, key, interval) {
|
|
133
|
+
var intervalValue = typeof interval === 'function' ? interval.call(tmodel, key) : interval;
|
|
134
|
+
return _TUtil.TUtil.isNumber(intervalValue) ? intervalValue : 0;
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "scheduleExecution",
|
|
138
|
+
value: function scheduleExecution(tmodel, key) {
|
|
139
|
+
var now = _Browser.browser.now();
|
|
140
|
+
var interval = tmodel.getTargetInterval(key);
|
|
141
|
+
var lastScheduledTime = tmodel.getScheduleTimeStamp(key);
|
|
142
|
+
var schedulePeriod = 0;
|
|
143
|
+
if (interval > 0) {
|
|
144
|
+
if (_TUtil.TUtil.isDefined(lastScheduledTime)) {
|
|
145
|
+
var elapsed = now - lastScheduledTime;
|
|
146
|
+
schedulePeriod = Math.max(interval - elapsed, 0);
|
|
147
|
+
} else {
|
|
148
|
+
schedulePeriod = interval;
|
|
149
|
+
tmodel.setScheduleTimeStamp(key, now);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (schedulePeriod > 0 && !_TUtil.TUtil.isDefined(lastScheduledTime)) {
|
|
153
|
+
tmodel.setScheduleTimeStamp(key, now);
|
|
154
|
+
}
|
|
155
|
+
return schedulePeriod;
|
|
156
|
+
}
|
|
157
|
+
}, {
|
|
158
|
+
key: "getTargetSchedulePeriod",
|
|
159
|
+
value: function getTargetSchedulePeriod(tmodel, key, intervalValue) {
|
|
160
|
+
var now = _Browser.browser.now();
|
|
161
|
+
var pastPeriod;
|
|
162
|
+
var schedulePeriod = 0;
|
|
163
|
+
if (intervalValue > 0) {
|
|
164
|
+
if (_TUtil.TUtil.isDefined(tmodel.getTargetTimeStamp(key))) {
|
|
165
|
+
pastPeriod = now - tmodel.getTargetTimeStamp(key);
|
|
166
|
+
if (pastPeriod < intervalValue) {
|
|
167
|
+
schedulePeriod = intervalValue - pastPeriod;
|
|
168
|
+
} else {
|
|
169
|
+
schedulePeriod = 0;
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
tmodel.setTargetTimeStamp(key, now);
|
|
173
|
+
schedulePeriod = intervalValue;
|
|
174
|
+
}
|
|
175
|
+
} else if (_TUtil.TUtil.isDefined(tmodel.getTargetTimeStamp(key))) {
|
|
176
|
+
pastPeriod = now - tmodel.getTargetTimeStamp(key);
|
|
177
|
+
if (pastPeriod < 0) {
|
|
178
|
+
schedulePeriod = -pastPeriod;
|
|
179
|
+
} else {
|
|
180
|
+
schedulePeriod = 0;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return schedulePeriod;
|
|
184
|
+
}
|
|
185
|
+
}, {
|
|
186
|
+
key: "handleValueChange",
|
|
187
|
+
value: function handleValueChange(tmodel, key, newValue, lastValue, step, cycle) {
|
|
188
|
+
if (_typeof(tmodel.targets[key]) === 'object' && typeof tmodel.targets[key].onValueChange === 'function') {
|
|
189
|
+
var valueChanged = !_TUtil.TUtil.areEqual(newValue, lastValue, tmodel.targets[key].deepEquality);
|
|
190
|
+
if (valueChanged) {
|
|
191
|
+
tmodel.targets[key].onValueChange.call(tmodel, newValue, lastValue, cycle);
|
|
192
|
+
tmodel.setTargetMethodName(key, 'onValueChange');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
key: "morph",
|
|
198
|
+
value: function morph(tmodel, key, fromValue, toValue, step) {
|
|
199
|
+
var easing = tmodel.getTargetEasing(key);
|
|
200
|
+
var easingStep = easing ? easing(tmodel.getTargetStepPercent(key, step)) : tmodel.getTargetStepPercent(key, step);
|
|
201
|
+
if (TargetUtil.colorMap[key]) {
|
|
202
|
+
var targetColors = _ColorUtil.ColorUtil.color2Integers(toValue);
|
|
203
|
+
var lastColors = fromValue ? _ColorUtil.ColorUtil.color2Integers(fromValue) : _ColorUtil.ColorUtil.color2Integers('#fff');
|
|
204
|
+
if (targetColors && lastColors) {
|
|
205
|
+
var red = Math.floor(targetColors[0] * easingStep + lastColors[0] * (1 - easingStep));
|
|
206
|
+
var green = Math.floor(targetColors[1] * easingStep + lastColors[1] * (1 - easingStep));
|
|
207
|
+
var blue = Math.floor(targetColors[2] * easingStep + lastColors[2] * (1 - easingStep));
|
|
208
|
+
return "rgb(".concat(red, ",").concat(green, ",").concat(blue, ")");
|
|
209
|
+
} else {
|
|
210
|
+
return toValue;
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
return typeof toValue === 'number' ? toValue * easingStep + fromValue * (1 - easingStep) : toValue;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}, {
|
|
217
|
+
key: "setWidthFromDom",
|
|
218
|
+
value: function setWidthFromDom(child) {
|
|
219
|
+
var height = _TUtil.TUtil.isDefined(child.domWidth) ? child.domWidth.height : undefined;
|
|
220
|
+
var width = _TUtil.TUtil.isDefined(child.domWidth) ? child.domWidth.width : undefined;
|
|
221
|
+
var domParent = child.getDomParent();
|
|
222
|
+
var rerender = false;
|
|
223
|
+
if ((0, _App.getManager)().needsRerender(child)) {
|
|
224
|
+
child.isTextOnly() ? child.$dom.text(child.getHtml()) : child.$dom.html(child.getHtml());
|
|
225
|
+
rerender = true;
|
|
226
|
+
}
|
|
227
|
+
if (!_TUtil.TUtil.isDefined(child.domWidth) || rerender || height !== child.getHeight() || domParent && child.getActualValueLastUpdate('width') <= domParent.getActualValueLastUpdate('width')) {
|
|
228
|
+
child.$dom.width('auto');
|
|
229
|
+
width = child.$dom.width();
|
|
230
|
+
height = child.$dom.height();
|
|
231
|
+
}
|
|
232
|
+
child.domWidth = {
|
|
233
|
+
width: width,
|
|
234
|
+
height: height
|
|
235
|
+
};
|
|
236
|
+
child.val('width', width);
|
|
237
|
+
return width;
|
|
238
|
+
}
|
|
239
|
+
}, {
|
|
240
|
+
key: "setHeightFromDom",
|
|
241
|
+
value: function setHeightFromDom(child) {
|
|
242
|
+
var height = _TUtil.TUtil.isDefined(child.domHeight) ? child.domHeight.height : undefined;
|
|
243
|
+
var width = _TUtil.TUtil.isDefined(child.domHeight) ? child.domHeight.width : undefined;
|
|
244
|
+
var domParent = child.getDomParent();
|
|
245
|
+
var rerender = false;
|
|
246
|
+
if ((0, _App.getManager)().needsRerender(child)) {
|
|
247
|
+
child.isTextOnly() ? child.$dom.text(child.getHtml()) : child.$dom.html(child.getHtml());
|
|
248
|
+
rerender = true;
|
|
249
|
+
}
|
|
250
|
+
if (!_TUtil.TUtil.isDefined(child.domHeight) || rerender || width !== child.getWidth() || domParent && child.getActualValueLastUpdate('height') <= domParent.getActualValueLastUpdate('height')) {
|
|
251
|
+
child.$dom.height('auto');
|
|
252
|
+
width = child.$dom.width();
|
|
253
|
+
height = child.$dom.height();
|
|
254
|
+
}
|
|
255
|
+
child.domHeight = {
|
|
256
|
+
height: height,
|
|
257
|
+
width: width
|
|
258
|
+
};
|
|
259
|
+
child.val('height', height);
|
|
260
|
+
return height;
|
|
261
|
+
}
|
|
262
|
+
}]);
|
|
263
|
+
}();
|
|
264
|
+
_defineProperty(TargetUtil, "styleTargetMap", {
|
|
265
|
+
x: true,
|
|
266
|
+
y: true,
|
|
267
|
+
width: true,
|
|
268
|
+
height: true,
|
|
269
|
+
rotate: true,
|
|
270
|
+
scale: true,
|
|
271
|
+
opacity: true,
|
|
272
|
+
zIndex: true,
|
|
273
|
+
fontSize: true,
|
|
274
|
+
lineHeight: true,
|
|
275
|
+
borderRadius: true,
|
|
276
|
+
padding: true,
|
|
277
|
+
backgroundColor: true,
|
|
278
|
+
background: true,
|
|
279
|
+
color: true,
|
|
280
|
+
css: true,
|
|
281
|
+
style: true,
|
|
282
|
+
transform: true,
|
|
283
|
+
dim: true
|
|
284
|
+
});
|
|
285
|
+
_defineProperty(TargetUtil, "transformMap", {
|
|
286
|
+
x: true,
|
|
287
|
+
y: true,
|
|
288
|
+
rotate: true,
|
|
289
|
+
scale: true
|
|
290
|
+
});
|
|
291
|
+
_defineProperty(TargetUtil, "dimMap", {
|
|
292
|
+
width: true,
|
|
293
|
+
height: true
|
|
294
|
+
});
|
|
295
|
+
_defineProperty(TargetUtil, "colorMap", {
|
|
296
|
+
color: true,
|
|
297
|
+
background: true,
|
|
298
|
+
backgroundColor: true
|
|
299
|
+
});
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Viewport = 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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
+
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); } }
|
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
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); }
|
|
15
|
+
var Viewport = exports.Viewport = /*#__PURE__*/function () {
|
|
16
|
+
function Viewport(tmodel) {
|
|
17
|
+
_classCallCheck(this, Viewport);
|
|
18
|
+
this.tmodel = tmodel;
|
|
19
|
+
this.xNext = 0;
|
|
20
|
+
this.xNorth = 0;
|
|
21
|
+
this.xWest = 0;
|
|
22
|
+
this.xEast = 0;
|
|
23
|
+
this.xSouth = 0;
|
|
24
|
+
this.xOverflow = 0;
|
|
25
|
+
this.xOffset = 0;
|
|
26
|
+
this.yNext = 0;
|
|
27
|
+
this.yNorth = 0;
|
|
28
|
+
this.yWest = 0;
|
|
29
|
+
this.yEast = 0;
|
|
30
|
+
this.ySouth = 0;
|
|
31
|
+
this.yOffset = 0;
|
|
32
|
+
this.reset();
|
|
33
|
+
}
|
|
34
|
+
return _createClass(Viewport, [{
|
|
35
|
+
key: "reset",
|
|
36
|
+
value: function reset() {
|
|
37
|
+
var x, y;
|
|
38
|
+
if (this.tmodel.type === 'BI') {
|
|
39
|
+
x = this.tmodel.getX() + this.tmodel.getScrollLeft();
|
|
40
|
+
y = this.tmodel.getY() + this.tmodel.getScrollTop();
|
|
41
|
+
this.xOffset = 0;
|
|
42
|
+
this.yOffset = 0;
|
|
43
|
+
this.xNext = x;
|
|
44
|
+
this.xNorth = x;
|
|
45
|
+
this.xEast = x;
|
|
46
|
+
this.xSouth = x;
|
|
47
|
+
this.xWest = x;
|
|
48
|
+
this.xOverflow = this.tmodel.getRealParent().getX();
|
|
49
|
+
this.yNext = y;
|
|
50
|
+
this.yNorth = y;
|
|
51
|
+
this.yWest = y;
|
|
52
|
+
this.yEast = y;
|
|
53
|
+
this.ySouth = this.tmodel.getRealParent().viewport ? this.tmodel.getRealParent().viewport.ySouth : y;
|
|
54
|
+
} else {
|
|
55
|
+
this.xOffset = 0;
|
|
56
|
+
this.yOffset = 0;
|
|
57
|
+
x = this.tmodel.getX();
|
|
58
|
+
y = this.tmodel.getY();
|
|
59
|
+
this.xNext = x;
|
|
60
|
+
this.xNorth = x;
|
|
61
|
+
this.xEast = x;
|
|
62
|
+
this.xSouth = x;
|
|
63
|
+
this.xWest = x;
|
|
64
|
+
this.xOverflow = _TUtil.TUtil.isDefined(this.tmodel.val('xOverflow')) ? this.tmodel.val('xOverflow') : x;
|
|
65
|
+
this.yNext = y;
|
|
66
|
+
this.yNorth = y;
|
|
67
|
+
this.yWest = y;
|
|
68
|
+
this.yEast = y;
|
|
69
|
+
this.ySouth = y;
|
|
70
|
+
}
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "setCurrentChild",
|
|
75
|
+
value: function setCurrentChild(child) {
|
|
76
|
+
this.currentChild = child;
|
|
77
|
+
this.xOffset = child.getDomParent() ? -child.getDomParent().getX() : 0;
|
|
78
|
+
this.yOffset = child.getDomParent() ? -child.getDomParent().getY() : 0;
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "getXNext",
|
|
82
|
+
value: function getXNext() {
|
|
83
|
+
return this.xNext + this.currentChild.getLeftMargin() + this.xOffset - this.tmodel.getScrollLeft();
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "getYNext",
|
|
87
|
+
value: function getYNext() {
|
|
88
|
+
return this.yNext + this.currentChild.getTopMargin() + this.yOffset - this.tmodel.getScrollTop();
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "isVisible",
|
|
92
|
+
value: function isVisible(child) {
|
|
93
|
+
var x = child.absX;
|
|
94
|
+
var y = child.absY;
|
|
95
|
+
var parentScale = child.getDomParent() ? child.getDomParent().getMeasuringScale() : 1;
|
|
96
|
+
var scale = parentScale * child.getMeasuringScale();
|
|
97
|
+
var maxWidth = _TUtil.TUtil.isDefined(child.getWidth()) ? scale * child.getWidth() : 0;
|
|
98
|
+
var maxHeight = _TUtil.TUtil.isDefined(child.getHeight()) ? scale * child.getHeight() : 0;
|
|
99
|
+
var status = child.visibilityStatus;
|
|
100
|
+
var rect = child.getBoundingRect();
|
|
101
|
+
if (!child.hasChildren()) {
|
|
102
|
+
status.right = x <= (0, _App.getScreenWidth)() && x <= rect.right;
|
|
103
|
+
status.left = x + maxWidth >= 0 && x + maxWidth >= rect.left;
|
|
104
|
+
status.bottom = y <= (0, _App.getScreenHeight)() && y <= rect.bottom;
|
|
105
|
+
status.top = y + maxHeight >= 0 && y + maxHeight >= rect.top;
|
|
106
|
+
} else {
|
|
107
|
+
status.right = x <= rect.right;
|
|
108
|
+
status.left = x + maxWidth >= rect.left;
|
|
109
|
+
status.bottom = y <= rect.bottom;
|
|
110
|
+
status.top = y + maxHeight >= rect.top;
|
|
111
|
+
}
|
|
112
|
+
child.visible = status.left && status.right && status.top && status.bottom;
|
|
113
|
+
return child.isVisible();
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
key: "isOverflow",
|
|
117
|
+
value: function isOverflow(outerXEast, innerXEast) {
|
|
118
|
+
return _TUtil.TUtil.isNumber(outerXEast) && _TUtil.TUtil.isNumber(innerXEast) && outerXEast > innerXEast;
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "overflow",
|
|
122
|
+
value: function overflow() {
|
|
123
|
+
this.xNext = this.xOverflow;
|
|
124
|
+
this.yNext = this.ySouth;
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "appendNewLine",
|
|
128
|
+
value: function appendNewLine() {
|
|
129
|
+
var innerHeight = this.currentChild.getInnerHeight() * this.currentChild.getMeasuringScale();
|
|
130
|
+
this.xNext = this.xOverflow;
|
|
131
|
+
this.yNext = this.ySouth > this.yNext ? this.ySouth + this.currentChild.val('appendNewLine') : this.ySouth + innerHeight + this.currentChild.val('appendNewLine');
|
|
132
|
+
this.yEast = this.yNext;
|
|
133
|
+
this.xSouth = this.xNext;
|
|
134
|
+
this.ySouth = Math.max(this.yNext, this.ySouth);
|
|
135
|
+
this.currentChild.getRealParent().viewport.xEast = Math.max(this.currentChild.getRealParent().viewport.xEast, this.xEast);
|
|
136
|
+
this.currentChild.getRealParent().viewport.ySouth = Math.max(this.currentChild.getRealParent().viewport.ySouth, this.ySouth);
|
|
137
|
+
}
|
|
138
|
+
}, {
|
|
139
|
+
key: "nextLocation",
|
|
140
|
+
value: function nextLocation() {
|
|
141
|
+
var innerWidth = this.currentChild.getInnerWidth() * this.currentChild.getMeasuringScale();
|
|
142
|
+
var innerHeight = this.currentChild.getInnerHeight() * this.currentChild.getMeasuringScale();
|
|
143
|
+
var innerContentHeight = this.currentChild.getInnerContentHeight() * this.currentChild.getMeasuringScale();
|
|
144
|
+
var ySouth = this.yNext + innerHeight + this.currentChild.getTopMargin() + this.currentChild.getBottomMargin();
|
|
145
|
+
this.xNext += innerWidth + this.currentChild.getLeftMargin() + this.currentChild.getRightMargin();
|
|
146
|
+
this.yNext += innerContentHeight;
|
|
147
|
+
this.xSouth = this.xNext;
|
|
148
|
+
this.yEast = this.yNext;
|
|
149
|
+
this.xEast = Math.max(this.xNext, this.xEast);
|
|
150
|
+
this.ySouth = Math.max(ySouth, this.ySouth);
|
|
151
|
+
this.currentChild.getRealParent().viewport.xEast = Math.max(this.currentChild.getRealParent().viewport.xEast, this.xEast);
|
|
152
|
+
this.currentChild.getRealParent().viewport.ySouth = Math.max(this.currentChild.getRealParent().viewport.ySouth, this.ySouth);
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
key: "calcContentWidthHeight",
|
|
156
|
+
value: function calcContentWidthHeight() {
|
|
157
|
+
this.tmodel.contentHeight = this.ySouth - this.yNorth;
|
|
158
|
+
this.tmodel.innerContentHeight = this.yEast - this.yNorth;
|
|
159
|
+
this.tmodel.innerContentWidth = this.xSouth - this.xWest;
|
|
160
|
+
this.tmodel.contentWidth = this.xEast - this.xWest;
|
|
161
|
+
}
|
|
162
|
+
}]);
|
|
163
|
+
}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "targetj",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.76",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"targetj"
|
|
6
6
|
],
|
|
@@ -18,13 +18,20 @@
|
|
|
18
18
|
"url": "https://github.com/livetrails/targetj.io/issues"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"
|
|
21
|
+
"prod": "webpack --mode production",
|
|
22
|
+
"dev": "webpack --mode development",
|
|
23
|
+
"build": "babel src --out-dir build"
|
|
22
24
|
},
|
|
23
25
|
"homepage": "http://targetj.io",
|
|
24
26
|
"devDependencies": {
|
|
27
|
+
"@babel/cli": "^7.25.6",
|
|
28
|
+
"@babel/core": "^7.25.2",
|
|
29
|
+
"@babel/eslint-parser": "^7.25.0",
|
|
30
|
+
"@babel/preset-env": "^7.25.4",
|
|
31
|
+
"babel-loader": "^9.1.0",
|
|
32
|
+
"eslint-webpack-plugin": "^4.2.0",
|
|
25
33
|
"webpack": "^5.91.0",
|
|
26
34
|
"webpack-cli": "^5.1.4",
|
|
27
|
-
"wepback": "^1.0.0"
|
|
28
|
-
"eslint-webpack-plugin": "^4.2.0"
|
|
35
|
+
"wepback": "^1.0.0"
|
|
29
36
|
}
|
|
30
37
|
}
|
package/webpack.config.js
CHANGED
|
@@ -8,12 +8,24 @@ module.exports = {
|
|
|
8
8
|
name: 'TargetJ',
|
|
9
9
|
type: 'window'
|
|
10
10
|
},
|
|
11
|
+
environment: {
|
|
12
|
+
arrowFunction: false
|
|
13
|
+
},
|
|
11
14
|
path: path.resolve(__dirname, './dist'),
|
|
12
15
|
filename: 'targetj.js'
|
|
13
16
|
},
|
|
17
|
+
module: {
|
|
18
|
+
rules: [
|
|
19
|
+
{
|
|
20
|
+
test: /\.js$/,
|
|
21
|
+
exclude: /node_modules/,
|
|
22
|
+
include: path.resolve(__dirname, 'src'),
|
|
23
|
+
use: 'babel-loader',
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
14
27
|
plugins: [
|
|
15
28
|
new ESLintPlugin({
|
|
16
|
-
extensions: ['js'],
|
|
17
29
|
exclude: 'node_modules',
|
|
18
30
|
overrideConfig: {
|
|
19
31
|
env: {
|
|
@@ -23,6 +35,7 @@ module.exports = {
|
|
|
23
35
|
extends: [
|
|
24
36
|
'eslint:recommended'
|
|
25
37
|
],
|
|
38
|
+
parser: "@babel/eslint-parser",
|
|
26
39
|
parserOptions: {
|
|
27
40
|
ecmaVersion: 12,
|
|
28
41
|
sourceType: 'module'
|