@visactor/vrender-components 1.1.0-alpha.24 → 1.1.0-alpha.25
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/cjs/axis/animate/group-transition.d.ts +2 -1
- package/cjs/axis/animate/group-transition.js +2 -2
- package/cjs/axis/animate/group-transition.js.map +1 -1
- package/cjs/axis/base.js +2 -2
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/overlap/auto-hide.d.ts +1 -1
- package/cjs/axis/overlap/auto-hide.js.map +1 -1
- package/cjs/core/base.d.ts +2 -2
- package/cjs/core/base.js +3 -3
- package/cjs/core/base.js.map +1 -1
- package/cjs/crosshair/polygon-sector.js +2 -1
- package/cjs/crosshair/rect.js +1 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/base.js +11 -11
- package/cjs/label/base.js.map +1 -1
- package/cjs/tooltip/tooltip.js +8 -8
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/cjs/util/event.js +2 -2
- package/cjs/util/event.js.map +1 -1
- package/cjs/util/graphic-creator.js +1 -1
- package/cjs/util/graphic-creator.js.map +1 -1
- package/cjs/util/text.js +3 -3
- package/cjs/util/text.js.map +1 -1
- package/dist/index.es.js +1184 -1714
- package/es/axis/animate/group-transition.d.ts +2 -1
- package/es/axis/animate/group-transition.js +1 -1
- package/es/axis/animate/group-transition.js.map +1 -1
- package/es/axis/base.js +1 -1
- package/es/axis/base.js.map +1 -1
- package/es/axis/overlap/auto-hide.d.ts +1 -1
- package/es/axis/overlap/auto-hide.js.map +1 -1
- package/es/core/base.d.ts +2 -2
- package/es/core/base.js +3 -1
- package/es/core/base.js.map +1 -1
- package/es/crosshair/polygon-sector.js +2 -1
- package/es/crosshair/rect.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/base.js +3 -1
- package/es/label/base.js.map +1 -1
- package/es/tooltip/tooltip.js +3 -1
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/util/event.js +1 -1
- package/es/util/event.js.map +1 -1
- package/es/util/graphic-creator.js +1 -1
- package/es/util/graphic-creator.js.map +1 -1
- package/es/util/text.js +1 -1
- package/es/util/text.js.map +1 -1
- package/package.json +6 -6
package/dist/index.es.js
CHANGED
|
@@ -1,380 +1,154 @@
|
|
|
1
|
-
import { EventEmitter, Logger, isBoolean, isObject,
|
|
1
|
+
import { isFunction, EventEmitter, Logger, isBoolean, isObject, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, isString, pointAt, isNumber, sqrt, isPointInLine, Color, OBBBounds, isEqual, isNil, normalTransform, isValidUrl, isBase64, isPlainObject as isPlainObject$2, merge, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, isValid, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, aabbSeparation, obbSeparation, cloneDeep, get, last, mixin, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
|
|
2
2
|
import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
|
|
3
3
|
|
|
4
|
-
class
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
tap(options, fn) {
|
|
9
|
-
this._tap("sync", options, fn);
|
|
10
|
-
}
|
|
11
|
-
unTap(options, fn) {
|
|
12
|
-
const name = "string" == typeof options ? options.trim() : options.name;
|
|
13
|
-
name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
|
|
14
|
-
}
|
|
15
|
-
_parseOptions(type, options, fn) {
|
|
16
|
-
let _options;
|
|
17
|
-
if ("string" == typeof options) _options = {
|
|
18
|
-
name: options.trim()
|
|
19
|
-
};else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
|
|
20
|
-
if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
|
|
21
|
-
return _options = Object.assign({
|
|
22
|
-
type: type,
|
|
23
|
-
fn: fn
|
|
24
|
-
}, _options), _options;
|
|
25
|
-
}
|
|
26
|
-
_tap(type, options, fn) {
|
|
27
|
-
this._insert(this._parseOptions(type, options, fn));
|
|
28
|
-
}
|
|
29
|
-
_insert(item) {
|
|
30
|
-
let before;
|
|
31
|
-
"string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
|
|
32
|
-
let stage = 0;
|
|
33
|
-
"number" == typeof item.stage && (stage = item.stage);
|
|
34
|
-
let i = this.taps.length;
|
|
35
|
-
for (; i > 0;) {
|
|
36
|
-
i--;
|
|
37
|
-
const x = this.taps[i];
|
|
38
|
-
this.taps[i + 1] = x;
|
|
39
|
-
const xStage = x.stage || 0;
|
|
40
|
-
if (before) {
|
|
41
|
-
if (before.has(x.name)) {
|
|
42
|
-
before.delete(x.name);
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (before.size > 0) continue;
|
|
46
|
-
}
|
|
47
|
-
if (!(xStage > stage)) {
|
|
48
|
-
i++;
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
this.taps[i] = item;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
class SyncHook extends Hook {
|
|
57
|
-
call(...args) {
|
|
58
|
-
this.taps.map(t => t.fn).forEach(cb => cb(...args));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
class Generator {
|
|
63
|
-
static GenAutoIncrementId() {
|
|
64
|
-
return Generator.auto_increment_id++;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
Generator.auto_increment_id = 0;
|
|
68
|
-
|
|
69
|
-
class Application {}
|
|
70
|
-
const application = new Application();
|
|
71
|
-
|
|
72
|
-
let idx = 0;
|
|
73
|
-
class PerformanceRAF {
|
|
74
|
-
constructor() {
|
|
75
|
-
this.nextAnimationFrameCbs = new Map(), this._rafHandle = null, this.runAnimationFrame = time => {
|
|
76
|
-
this._rafHandle = null;
|
|
77
|
-
const cbs = this.nextAnimationFrameCbs;
|
|
78
|
-
this.nextAnimationFrameCbs = new Map(), cbs.forEach(cb => cb(time));
|
|
79
|
-
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
80
|
-
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.size && (this._rafHandle = application.global.getRequestAnimationFrame()(this.runAnimationFrame));
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
addAnimationFrameCb(callback) {
|
|
84
|
-
return this.nextAnimationFrameCbs.set(++idx, callback), this.tryRunAnimationFrameNextFrame(), idx;
|
|
85
|
-
}
|
|
86
|
-
removeAnimationFrameCb(index) {
|
|
87
|
-
return !!this.nextAnimationFrameCbs.has(index) && (this.nextAnimationFrameCbs.delete(index), !0);
|
|
88
|
-
}
|
|
89
|
-
wait() {
|
|
90
|
-
return new Promise(resolve => {
|
|
91
|
-
this.addAnimationFrameCb(() => resolve());
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
class EventListenerManager {
|
|
97
|
-
constructor() {
|
|
98
|
-
this._listenerMap = new Map(), this._eventListenerTransformer = event => event;
|
|
99
|
-
}
|
|
100
|
-
setEventListenerTransformer(transformer) {
|
|
101
|
-
this._eventListenerTransformer = transformer || (event => event);
|
|
4
|
+
class FederatedEvent {
|
|
5
|
+
get layerX() {
|
|
6
|
+
return this.layer.x;
|
|
102
7
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const capture = this._resolveCapture(options),
|
|
106
|
-
once = this._resolveOnce(options),
|
|
107
|
-
listenerTypeMap = this._getOrCreateListenerTypeMap(type),
|
|
108
|
-
wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
|
|
109
|
-
if (wrappedMap.has(capture)) return;
|
|
110
|
-
const wrappedListener = event => {
|
|
111
|
-
const transformedEvent = this._eventListenerTransformer(event);
|
|
112
|
-
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
|
|
113
|
-
};
|
|
114
|
-
wrappedMap.set(capture, {
|
|
115
|
-
wrappedListener: wrappedListener,
|
|
116
|
-
options: options
|
|
117
|
-
}), this._nativeAddEventListener(type, wrappedListener, options);
|
|
8
|
+
get layerY() {
|
|
9
|
+
return this.layer.y;
|
|
118
10
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (!listener) return;
|
|
122
|
-
const capture = this._resolveCapture(options),
|
|
123
|
-
wrappedRecord = null === (_b = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener)) || void 0 === _b ? void 0 : _b.get(capture);
|
|
124
|
-
wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
|
|
11
|
+
get pageX() {
|
|
12
|
+
return this.page.x;
|
|
125
13
|
}
|
|
126
|
-
|
|
127
|
-
return this.
|
|
14
|
+
get pageY() {
|
|
15
|
+
return this.page.y;
|
|
128
16
|
}
|
|
129
|
-
|
|
130
|
-
this.
|
|
131
|
-
listenerMap.forEach(wrappedMap => {
|
|
132
|
-
wrappedMap.forEach((wrappedRecord, capture) => {
|
|
133
|
-
this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
}), this._listenerMap.clear();
|
|
17
|
+
get x() {
|
|
18
|
+
return this.canvas.x;
|
|
137
19
|
}
|
|
138
|
-
|
|
139
|
-
return
|
|
20
|
+
get y() {
|
|
21
|
+
return this.canvas.y;
|
|
140
22
|
}
|
|
141
|
-
|
|
142
|
-
return
|
|
23
|
+
get canvasX() {
|
|
24
|
+
return this.canvas.x;
|
|
143
25
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
|
|
26
|
+
get canvasY() {
|
|
27
|
+
return this.canvas.y;
|
|
147
28
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
|
|
29
|
+
get viewX() {
|
|
30
|
+
return this.viewport.x;
|
|
151
31
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (!listenerTypeMap) return;
|
|
155
|
-
const wrappedMap = listenerTypeMap.get(listener);
|
|
156
|
-
wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
|
|
32
|
+
get viewY() {
|
|
33
|
+
return this.viewport.y;
|
|
157
34
|
}
|
|
158
|
-
|
|
159
|
-
|
|
35
|
+
constructor(manager) {
|
|
36
|
+
this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = FederatedEvent.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = {
|
|
37
|
+
x: 0,
|
|
38
|
+
y: 0
|
|
39
|
+
}, this.page = {
|
|
40
|
+
x: 0,
|
|
41
|
+
y: 0
|
|
42
|
+
}, this.canvas = {
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 0
|
|
45
|
+
}, this.viewport = {
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0
|
|
48
|
+
}, this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = manager;
|
|
160
49
|
}
|
|
161
|
-
|
|
162
|
-
|
|
50
|
+
composedPath() {
|
|
51
|
+
return !this.manager || this.path && this.path[this.path.length - 1] === this.target || (this.path = this.target ? this.manager.propagationPath(this.target) : []), this.composedDetailPath(), this.path;
|
|
163
52
|
}
|
|
164
|
-
|
|
165
|
-
|
|
53
|
+
composedDetailPath() {
|
|
54
|
+
return this.pickParams && this.pickParams.graphic ? (this.detailPath = this.path.slice(), this._composedDetailPath(this.pickParams)) : this.detailPath = this.path.slice(), this.detailPath;
|
|
166
55
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
step(generator.next(value));
|
|
174
|
-
} catch (e) {
|
|
175
|
-
reject(e);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function rejected(value) {
|
|
179
|
-
try {
|
|
180
|
-
step(generator.throw(value));
|
|
181
|
-
} catch (e) {
|
|
182
|
-
reject(e);
|
|
56
|
+
_composedDetailPath(params) {
|
|
57
|
+
if (params && params.graphic) {
|
|
58
|
+
const g = params.graphic;
|
|
59
|
+
if (g.stage) {
|
|
60
|
+
const path = g.stage.eventSystem.manager.propagationPath(g);
|
|
61
|
+
this.detailPath.push(path), this._composedDetailPath(params.params);
|
|
183
62
|
}
|
|
184
63
|
}
|
|
185
|
-
function step(result) {
|
|
186
|
-
var value;
|
|
187
|
-
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
|
|
188
|
-
resolve(value);
|
|
189
|
-
})).then(fulfilled, rejected);
|
|
190
|
-
}
|
|
191
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
class DefaultGlobal extends EventListenerManager {
|
|
195
|
-
get env() {
|
|
196
|
-
return this._env;
|
|
197
|
-
}
|
|
198
|
-
get isImageAnonymous() {
|
|
199
|
-
return this._isImageAnonymous;
|
|
200
|
-
}
|
|
201
|
-
set isImageAnonymous(isImageAnonymous) {
|
|
202
|
-
this._isImageAnonymous = isImageAnonymous;
|
|
203
|
-
}
|
|
204
|
-
get devicePixelRatio() {
|
|
205
|
-
return this._env || this.setEnv("browser"), this.envContribution.getDevicePixelRatio();
|
|
206
|
-
}
|
|
207
|
-
get supportEvent() {
|
|
208
|
-
return this._env || this.setEnv("browser"), this.envContribution.supportEvent;
|
|
209
|
-
}
|
|
210
|
-
set supportEvent(support) {
|
|
211
|
-
this._env || this.setEnv("browser"), this.envContribution.supportEvent = support;
|
|
212
|
-
}
|
|
213
|
-
get supportsTouchEvents() {
|
|
214
|
-
return this._env || this.setEnv("browser"), this.envContribution.supportsTouchEvents;
|
|
215
|
-
}
|
|
216
|
-
set supportsTouchEvents(support) {
|
|
217
|
-
this._env || this.setEnv("browser"), this.envContribution.supportsTouchEvents = support;
|
|
218
|
-
}
|
|
219
|
-
get supportsPointerEvents() {
|
|
220
|
-
return this._env || this.setEnv("browser"), this.envContribution.supportsPointerEvents;
|
|
221
|
-
}
|
|
222
|
-
set supportsPointerEvents(support) {
|
|
223
|
-
this._env || this.setEnv("browser"), this.envContribution.supportsPointerEvents = support;
|
|
224
|
-
}
|
|
225
|
-
get supportsMouseEvents() {
|
|
226
|
-
return this._env || this.setEnv("browser"), this.envContribution.supportsMouseEvents;
|
|
227
|
-
}
|
|
228
|
-
set supportsMouseEvents(support) {
|
|
229
|
-
this._env || this.setEnv("browser"), this.envContribution.supportsMouseEvents = support;
|
|
230
64
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
super(), this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.eventListenerTransformer = event => event, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
239
|
-
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
240
|
-
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
241
|
-
}
|
|
242
|
-
_nativeAddEventListener(type, listener, options) {
|
|
243
|
-
return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
|
|
244
|
-
}
|
|
245
|
-
_nativeRemoveEventListener(type, listener, options) {
|
|
246
|
-
return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
|
|
247
|
-
}
|
|
248
|
-
_nativeDispatchEvent(event) {
|
|
249
|
-
return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
|
|
250
|
-
}
|
|
251
|
-
bindContribution(params) {
|
|
252
|
-
const promiseArr = [];
|
|
253
|
-
if (this.contributions.getContributions().forEach(contribution => {
|
|
254
|
-
const data = contribution.configure(this, params);
|
|
255
|
-
data && data.then && promiseArr.push(data);
|
|
256
|
-
}), promiseArr.length) return Promise.all(promiseArr);
|
|
257
|
-
}
|
|
258
|
-
getDynamicCanvasCount() {
|
|
259
|
-
return this._env || this.setEnv("browser"), this.envContribution.getDynamicCanvasCount();
|
|
260
|
-
}
|
|
261
|
-
getStaticCanvasCount() {
|
|
262
|
-
return this._env || this.setEnv("browser"), this.envContribution.getStaticCanvasCount();
|
|
263
|
-
}
|
|
264
|
-
setEnv(env, params) {
|
|
265
|
-
if (params && !0 === params.force || this._env !== env) return this.deactiveCurrentEnv(), this.activeEnv(env, params);
|
|
266
|
-
}
|
|
267
|
-
deactiveCurrentEnv() {
|
|
268
|
-
this.envContribution && this.envContribution.release();
|
|
269
|
-
}
|
|
270
|
-
activeEnv(env, params) {
|
|
271
|
-
const lastEnv = this._env;
|
|
272
|
-
this._env = env;
|
|
273
|
-
const data = this.bindContribution(params);
|
|
274
|
-
if (data && data.then) return data.then(() => {
|
|
275
|
-
this.envParams = params, this.hooks.onSetEnv.call(lastEnv, env, this);
|
|
276
|
-
});
|
|
277
|
-
this.envParams = params, this.hooks.onSetEnv.call(lastEnv, env, this);
|
|
278
|
-
}
|
|
279
|
-
setActiveEnvContribution(contribution) {
|
|
280
|
-
this.envContribution = contribution;
|
|
281
|
-
}
|
|
282
|
-
createCanvas(params) {
|
|
283
|
-
return this._env || this.setEnv("browser"), this.envContribution.createCanvas(params);
|
|
284
|
-
}
|
|
285
|
-
createOffscreenCanvas(params) {
|
|
286
|
-
return this._env || this.setEnv("browser"), this.envContribution.createOffscreenCanvas(params);
|
|
287
|
-
}
|
|
288
|
-
releaseCanvas(canvas) {
|
|
289
|
-
return this._env || this.setEnv("browser"), this.envContribution.releaseCanvas(canvas);
|
|
290
|
-
}
|
|
291
|
-
getRequestAnimationFrame() {
|
|
292
|
-
return this._env || this.setEnv("browser"), this.envContribution.getRequestAnimationFrame();
|
|
293
|
-
}
|
|
294
|
-
getSpecifiedRequestAnimationFrame(id) {
|
|
295
|
-
this._env || this.setEnv("browser"), this._performanceRAFList[id] || (this._performanceRAFList[id] = new PerformanceRAF());
|
|
296
|
-
const performanceRAF = this._performanceRAFList[id];
|
|
297
|
-
return callback => performanceRAF.addAnimationFrameCb(callback);
|
|
298
|
-
}
|
|
299
|
-
getSpecifiedPerformanceRAF(id) {
|
|
300
|
-
return this._env || this.setEnv("browser"), this._performanceRAFList[id] || (this._performanceRAFList[id] = new PerformanceRAF()), this._performanceRAFList[id];
|
|
301
|
-
}
|
|
302
|
-
getSpecifiedCancelAnimationFrame(id) {
|
|
303
|
-
if (this._env || this.setEnv("browser"), !this._performanceRAFList[id]) return () => !1;
|
|
304
|
-
const performanceRAF = this._performanceRAFList[id];
|
|
305
|
-
return handle => performanceRAF.removeAnimationFrameCb(handle);
|
|
306
|
-
}
|
|
307
|
-
getCancelAnimationFrame() {
|
|
308
|
-
return this._env || this.setEnv("browser"), this.envContribution.getCancelAnimationFrame();
|
|
309
|
-
}
|
|
310
|
-
getElementById(str) {
|
|
311
|
-
return this._env || this.setEnv("browser"), this.envContribution.getElementById ? this.envContribution.getElementById(str) : null;
|
|
312
|
-
}
|
|
313
|
-
getRootElement() {
|
|
314
|
-
return this._env || this.setEnv("browser"), this.envContribution.getRootElement ? this.envContribution.getRootElement() : null;
|
|
315
|
-
}
|
|
316
|
-
getDocument() {
|
|
317
|
-
return this._env || this.setEnv("browser"), this.envContribution.getDocument ? this.envContribution.getDocument() : null;
|
|
318
|
-
}
|
|
319
|
-
mapToCanvasPoint(event, domElement) {
|
|
320
|
-
return this._env || this.setEnv("browser"), this.envContribution.mapToCanvasPoint ? this.envContribution.mapToCanvasPoint(event, domElement) : null;
|
|
321
|
-
}
|
|
322
|
-
loadImage(url) {
|
|
323
|
-
return this._env || this.setEnv("browser"), this.envContribution.loadImage(url);
|
|
324
|
-
}
|
|
325
|
-
loadSvg(str) {
|
|
326
|
-
return this._env || this.setEnv("browser"), this.envContribution.loadSvg(str);
|
|
327
|
-
}
|
|
328
|
-
loadJson(url) {
|
|
329
|
-
return this._env || this.setEnv("browser"), this.envContribution.loadJson(url);
|
|
330
|
-
}
|
|
331
|
-
loadArrayBuffer(url) {
|
|
332
|
-
return this._env || this.setEnv("browser"), this.envContribution.loadArrayBuffer(url);
|
|
333
|
-
}
|
|
334
|
-
loadBlob(url) {
|
|
335
|
-
return this._env || this.setEnv("browser"), this.envContribution.loadBlob(url);
|
|
336
|
-
}
|
|
337
|
-
loadFont(name, source, descriptors) {
|
|
338
|
-
return __awaiter$4(this, void 0, void 0, function* () {
|
|
339
|
-
return this._env || this.setEnv("browser"), this.envContribution.loadFont(name, source, descriptors);
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
isChrome() {
|
|
343
|
-
return null != this._isChrome || (this._env || this.setEnv("browser"), this._isChrome = "browser" === this._env && navigator.userAgent.indexOf("Chrome") > -1), this._isChrome;
|
|
344
|
-
}
|
|
345
|
-
isSafari() {
|
|
346
|
-
return null != this._isSafari || (this._env || this.setEnv("browser"), this._isSafari = "browser" === this._env && /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)), this._isSafari;
|
|
347
|
-
}
|
|
348
|
-
getNativeAABBBounds(dom) {
|
|
349
|
-
return this._env || this.setEnv("browser"), this.envContribution.getNativeAABBBounds(dom);
|
|
350
|
-
}
|
|
351
|
-
removeDom(dom) {
|
|
352
|
-
return this._env || this.setEnv("browser"), this.envContribution.removeDom(dom);
|
|
353
|
-
}
|
|
354
|
-
createDom(params) {
|
|
355
|
-
return this._env || this.setEnv("browser"), this.envContribution.createDom(params);
|
|
356
|
-
}
|
|
357
|
-
updateDom(dom, params) {
|
|
358
|
-
return this._env || this.setEnv("browser"), this.envContribution.updateDom(dom, params);
|
|
65
|
+
preventDefault() {
|
|
66
|
+
try {
|
|
67
|
+
this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.preventDefault();
|
|
68
|
+
} catch (err) {
|
|
69
|
+
this.nativeEvent.preventDefault && isFunction(this.nativeEvent.preventDefault) && this.nativeEvent.preventDefault();
|
|
70
|
+
}
|
|
71
|
+
this.defaultPrevented = !0;
|
|
359
72
|
}
|
|
360
|
-
|
|
361
|
-
|
|
73
|
+
stopImmediatePropagation() {
|
|
74
|
+
this.propagationImmediatelyStopped = !0;
|
|
362
75
|
}
|
|
363
|
-
|
|
364
|
-
|
|
76
|
+
stopPropagation() {
|
|
77
|
+
try {
|
|
78
|
+
this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.stopPropagation();
|
|
79
|
+
} catch (err) {
|
|
80
|
+
this.nativeEvent.stopPropagation && isFunction(this.nativeEvent.stopPropagation) && this.nativeEvent.stopPropagation();
|
|
81
|
+
}
|
|
82
|
+
this.propagationStopped = !0;
|
|
365
83
|
}
|
|
366
|
-
|
|
367
|
-
|
|
84
|
+
initEvent() {}
|
|
85
|
+
initUIEvent() {}
|
|
86
|
+
clone() {
|
|
87
|
+
throw new Error("Method not implemented.");
|
|
368
88
|
}
|
|
369
|
-
|
|
370
|
-
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
class CustomEvent extends FederatedEvent {
|
|
92
|
+
constructor(eventName, object) {
|
|
93
|
+
super(), this.type = eventName, this.detail = object;
|
|
371
94
|
}
|
|
372
|
-
|
|
373
|
-
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var UpdateTag;
|
|
98
|
+
!function (UpdateTag) {
|
|
99
|
+
UpdateTag[UpdateTag.NONE = 0] = "NONE", UpdateTag[UpdateTag.UPDATE_BOUNDS = 1] = "UPDATE_BOUNDS", UpdateTag[UpdateTag.UPDATE_SHAPE = 2] = "UPDATE_SHAPE", UpdateTag[UpdateTag.CLEAR_SHAPE = 253] = "CLEAR_SHAPE", UpdateTag[UpdateTag.UPDATE_SHAPE_AND_BOUNDS = 3] = "UPDATE_SHAPE_AND_BOUNDS", UpdateTag[UpdateTag.INIT = 179] = "INIT", UpdateTag[UpdateTag.CLEAR_BOUNDS = 254] = "CLEAR_BOUNDS", UpdateTag[UpdateTag.UPDATE_GLOBAL_MATRIX = 32] = "UPDATE_GLOBAL_MATRIX", UpdateTag[UpdateTag.CLEAR_GLOBAL_MATRIX = 223] = "CLEAR_GLOBAL_MATRIX", UpdateTag[UpdateTag.UPDATE_LOCAL_MATRIX = 16] = "UPDATE_LOCAL_MATRIX", UpdateTag[UpdateTag.CLEAR_LOCAL_MATRIX = 239] = "CLEAR_LOCAL_MATRIX", UpdateTag[UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX = 48] = "UPDATE_GLOBAL_LOCAL_MATRIX", UpdateTag[UpdateTag.UPDATE_PAINT = 64] = "UPDATE_PAINT", UpdateTag[UpdateTag.CLEAR_PAINT = 191] = "CLEAR_PAINT", UpdateTag[UpdateTag.UPDATE_LAYOUT = 128] = "UPDATE_LAYOUT", UpdateTag[UpdateTag.CLEAR_LAYOUT = 127] = "CLEAR_LAYOUT";
|
|
100
|
+
}(UpdateTag || (UpdateTag = {}));
|
|
101
|
+
var IContainPointMode;
|
|
102
|
+
!function (IContainPointMode) {
|
|
103
|
+
IContainPointMode[IContainPointMode.GLOBAL = 1] = "GLOBAL", IContainPointMode[IContainPointMode.LOCAL = 16] = "LOCAL", IContainPointMode[IContainPointMode.GLOBAL_ACCURATE = 3] = "GLOBAL_ACCURATE", IContainPointMode[IContainPointMode.LOCAL_ACCURATE = 48] = "LOCAL_ACCURATE";
|
|
104
|
+
}(IContainPointMode || (IContainPointMode = {}));
|
|
105
|
+
var AttributeUpdateType;
|
|
106
|
+
!function (AttributeUpdateType) {
|
|
107
|
+
AttributeUpdateType[AttributeUpdateType.INIT = 0] = "INIT", AttributeUpdateType[AttributeUpdateType.DEFAULT = 1] = "DEFAULT", AttributeUpdateType[AttributeUpdateType.STATE = 2] = "STATE", AttributeUpdateType[AttributeUpdateType.ANIMATE_BIND = 10] = "ANIMATE_BIND", AttributeUpdateType[AttributeUpdateType.ANIMATE_PLAY = 11] = "ANIMATE_PLAY", AttributeUpdateType[AttributeUpdateType.ANIMATE_START = 12] = "ANIMATE_START", AttributeUpdateType[AttributeUpdateType.ANIMATE_UPDATE = 13] = "ANIMATE_UPDATE", AttributeUpdateType[AttributeUpdateType.ANIMATE_END = 14] = "ANIMATE_END", AttributeUpdateType[AttributeUpdateType.TRANSLATE = 20] = "TRANSLATE", AttributeUpdateType[AttributeUpdateType.TRANSLATE_TO = 21] = "TRANSLATE_TO", AttributeUpdateType[AttributeUpdateType.SCALE = 22] = "SCALE", AttributeUpdateType[AttributeUpdateType.SCALE_TO = 23] = "SCALE_TO", AttributeUpdateType[AttributeUpdateType.ROTATE = 24] = "ROTATE", AttributeUpdateType[AttributeUpdateType.ROTATE_TO = 25] = "ROTATE_TO";
|
|
108
|
+
}(AttributeUpdateType || (AttributeUpdateType = {}));
|
|
109
|
+
var Direction;
|
|
110
|
+
!function (Direction) {
|
|
111
|
+
Direction[Direction.ROW = 1] = "ROW", Direction[Direction.COLUMN = 2] = "COLUMN";
|
|
112
|
+
}(Direction || (Direction = {}));
|
|
113
|
+
var CurveTypeEnum;
|
|
114
|
+
!function (CurveTypeEnum) {
|
|
115
|
+
CurveTypeEnum[CurveTypeEnum.CubicBezierCurve = 0] = "CubicBezierCurve", CurveTypeEnum[CurveTypeEnum.QuadraticBezierCurve = 1] = "QuadraticBezierCurve", CurveTypeEnum[CurveTypeEnum.ArcCurve = 2] = "ArcCurve", CurveTypeEnum[CurveTypeEnum.LineCurve = 3] = "LineCurve", CurveTypeEnum[CurveTypeEnum.EllipseCurve = 4] = "EllipseCurve", CurveTypeEnum[CurveTypeEnum.MoveCurve = 5] = "MoveCurve";
|
|
116
|
+
}(CurveTypeEnum || (CurveTypeEnum = {}));
|
|
117
|
+
var BaseRenderContributionTime;
|
|
118
|
+
!function (BaseRenderContributionTime) {
|
|
119
|
+
BaseRenderContributionTime[BaseRenderContributionTime.beforeFillStroke = 0] = "beforeFillStroke", BaseRenderContributionTime[BaseRenderContributionTime.afterFillStroke = 1] = "afterFillStroke";
|
|
120
|
+
}(BaseRenderContributionTime || (BaseRenderContributionTime = {}));
|
|
121
|
+
|
|
122
|
+
var AnimateMode;
|
|
123
|
+
!function (AnimateMode) {
|
|
124
|
+
AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
|
|
125
|
+
}(AnimateMode || (AnimateMode = {}));
|
|
126
|
+
|
|
127
|
+
var AnimateStepType;
|
|
128
|
+
!function (AnimateStepType) {
|
|
129
|
+
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
|
|
130
|
+
}(AnimateStepType || (AnimateStepType = {}));
|
|
131
|
+
var AnimateStatus;
|
|
132
|
+
!function (AnimateStatus) {
|
|
133
|
+
AnimateStatus[AnimateStatus.INITIAL = 0] = "INITIAL", AnimateStatus[AnimateStatus.RUNNING = 1] = "RUNNING", AnimateStatus[AnimateStatus.PAUSED = 2] = "PAUSED", AnimateStatus[AnimateStatus.END = 3] = "END";
|
|
134
|
+
}(AnimateStatus || (AnimateStatus = {}));
|
|
135
|
+
|
|
136
|
+
var STATUS$1;
|
|
137
|
+
!function (STATUS) {
|
|
138
|
+
STATUS[STATUS.INITIAL = 0] = "INITIAL", STATUS[STATUS.RUNNING = 1] = "RUNNING", STATUS[STATUS.PAUSE = 2] = "PAUSE";
|
|
139
|
+
}(STATUS$1 || (STATUS$1 = {}));
|
|
140
|
+
|
|
141
|
+
class Application {}
|
|
142
|
+
const application = new Application();
|
|
143
|
+
|
|
144
|
+
class Generator {
|
|
145
|
+
static GenAutoIncrementId() {
|
|
146
|
+
return Generator.auto_increment_id++;
|
|
374
147
|
}
|
|
375
148
|
}
|
|
149
|
+
Generator.auto_increment_id = 0;
|
|
376
150
|
|
|
377
|
-
var __awaiter$
|
|
151
|
+
var __awaiter$4 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
378
152
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
379
153
|
function fulfilled(value) {
|
|
380
154
|
try {
|
|
@@ -424,6 +198,7 @@ class Node extends EventEmitter {
|
|
|
424
198
|
constructor() {
|
|
425
199
|
super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
|
|
426
200
|
}
|
|
201
|
+
onParentSharedStateTreeChanged(_stage, _layer) {}
|
|
427
202
|
forEachChildren(cb, reverse = !1) {
|
|
428
203
|
if (reverse) {
|
|
429
204
|
let child = this._lastChild,
|
|
@@ -442,7 +217,7 @@ class Node extends EventEmitter {
|
|
|
442
217
|
}
|
|
443
218
|
}
|
|
444
219
|
forEachChildrenAsync(cb, reverse = !1) {
|
|
445
|
-
return __awaiter$
|
|
220
|
+
return __awaiter$4(this, void 0, void 0, function* () {
|
|
446
221
|
if (reverse) {
|
|
447
222
|
let child = this._lastChild,
|
|
448
223
|
i = 0;
|
|
@@ -707,117 +482,24 @@ class Node extends EventEmitter {
|
|
|
707
482
|
}
|
|
708
483
|
}
|
|
709
484
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
return this.page.x;
|
|
719
|
-
}
|
|
720
|
-
get pageY() {
|
|
721
|
-
return this.page.y;
|
|
722
|
-
}
|
|
723
|
-
get x() {
|
|
724
|
-
return this.canvas.x;
|
|
485
|
+
const EventTarget = {
|
|
486
|
+
dispatchEvent(e) {
|
|
487
|
+
var _a;
|
|
488
|
+
if (!(e instanceof FederatedEvent)) throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");
|
|
489
|
+
return e.defaultPrevented = !1, e.path = [], e.detailPath && (e.detailPath = []), e.target = this, null === (_a = null == e ? void 0 : e.manager) || void 0 === _a || _a.dispatchEvent(e), !e.defaultPrevented;
|
|
490
|
+
},
|
|
491
|
+
emit(eventName, object) {
|
|
492
|
+
return this.dispatchEvent(new CustomEvent(eventName, object));
|
|
725
493
|
}
|
|
726
|
-
|
|
727
|
-
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
const circleThreshold = tau - 1e-8;
|
|
497
|
+
class BoundsContext {
|
|
498
|
+
constructor(bounds) {
|
|
499
|
+
this.init(bounds);
|
|
728
500
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
-
get canvasY() {
|
|
733
|
-
return this.canvas.y;
|
|
734
|
-
}
|
|
735
|
-
get viewX() {
|
|
736
|
-
return this.viewport.x;
|
|
737
|
-
}
|
|
738
|
-
get viewY() {
|
|
739
|
-
return this.viewport.y;
|
|
740
|
-
}
|
|
741
|
-
constructor(manager) {
|
|
742
|
-
this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = FederatedEvent.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = {
|
|
743
|
-
x: 0,
|
|
744
|
-
y: 0
|
|
745
|
-
}, this.page = {
|
|
746
|
-
x: 0,
|
|
747
|
-
y: 0
|
|
748
|
-
}, this.canvas = {
|
|
749
|
-
x: 0,
|
|
750
|
-
y: 0
|
|
751
|
-
}, this.viewport = {
|
|
752
|
-
x: 0,
|
|
753
|
-
y: 0
|
|
754
|
-
}, this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = manager;
|
|
755
|
-
}
|
|
756
|
-
composedPath() {
|
|
757
|
-
return !this.manager || this.path && this.path[this.path.length - 1] === this.target || (this.path = this.target ? this.manager.propagationPath(this.target) : []), this.composedDetailPath(), this.path;
|
|
758
|
-
}
|
|
759
|
-
composedDetailPath() {
|
|
760
|
-
return this.pickParams && this.pickParams.graphic ? (this.detailPath = this.path.slice(), this._composedDetailPath(this.pickParams)) : this.detailPath = this.path.slice(), this.detailPath;
|
|
761
|
-
}
|
|
762
|
-
_composedDetailPath(params) {
|
|
763
|
-
if (params && params.graphic) {
|
|
764
|
-
const g = params.graphic;
|
|
765
|
-
if (g.stage) {
|
|
766
|
-
const path = g.stage.eventSystem.manager.propagationPath(g);
|
|
767
|
-
this.detailPath.push(path), this._composedDetailPath(params.params);
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
preventDefault() {
|
|
772
|
-
try {
|
|
773
|
-
this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.preventDefault();
|
|
774
|
-
} catch (err) {
|
|
775
|
-
this.nativeEvent.preventDefault && isFunction(this.nativeEvent.preventDefault) && this.nativeEvent.preventDefault();
|
|
776
|
-
}
|
|
777
|
-
this.defaultPrevented = !0;
|
|
778
|
-
}
|
|
779
|
-
stopImmediatePropagation() {
|
|
780
|
-
this.propagationImmediatelyStopped = !0;
|
|
781
|
-
}
|
|
782
|
-
stopPropagation() {
|
|
783
|
-
try {
|
|
784
|
-
this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.stopPropagation();
|
|
785
|
-
} catch (err) {
|
|
786
|
-
this.nativeEvent.stopPropagation && isFunction(this.nativeEvent.stopPropagation) && this.nativeEvent.stopPropagation();
|
|
787
|
-
}
|
|
788
|
-
this.propagationStopped = !0;
|
|
789
|
-
}
|
|
790
|
-
initEvent() {}
|
|
791
|
-
initUIEvent() {}
|
|
792
|
-
clone() {
|
|
793
|
-
throw new Error("Method not implemented.");
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
class CustomEvent extends FederatedEvent {
|
|
798
|
-
constructor(eventName, object) {
|
|
799
|
-
super(), this.type = eventName, this.detail = object;
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
const EventTarget = {
|
|
804
|
-
dispatchEvent(e) {
|
|
805
|
-
var _a;
|
|
806
|
-
if (!(e instanceof FederatedEvent)) throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");
|
|
807
|
-
return e.defaultPrevented = !1, e.path = [], e.detailPath && (e.detailPath = []), e.target = this, null === (_a = null == e ? void 0 : e.manager) || void 0 === _a || _a.dispatchEvent(e), !e.defaultPrevented;
|
|
808
|
-
},
|
|
809
|
-
emit(eventName, object) {
|
|
810
|
-
return this.dispatchEvent(new CustomEvent(eventName, object));
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
|
|
814
|
-
const circleThreshold = tau - 1e-8;
|
|
815
|
-
class BoundsContext {
|
|
816
|
-
constructor(bounds) {
|
|
817
|
-
this.init(bounds);
|
|
818
|
-
}
|
|
819
|
-
init(bounds) {
|
|
820
|
-
this.bounds = bounds;
|
|
501
|
+
init(bounds) {
|
|
502
|
+
this.bounds = bounds;
|
|
821
503
|
}
|
|
822
504
|
arc(cx, cy, r, sa, ea, ccw) {
|
|
823
505
|
if (Math.abs(ea - sa) > circleThreshold) return this.bounds.add(cx - r, cy - r), void this.bounds.add(cx + r, cy + r);
|
|
@@ -941,31 +623,6 @@ function parseSvgPath(str) {
|
|
|
941
623
|
return result;
|
|
942
624
|
}
|
|
943
625
|
|
|
944
|
-
var UpdateTag;
|
|
945
|
-
!function (UpdateTag) {
|
|
946
|
-
UpdateTag[UpdateTag.NONE = 0] = "NONE", UpdateTag[UpdateTag.UPDATE_BOUNDS = 1] = "UPDATE_BOUNDS", UpdateTag[UpdateTag.UPDATE_SHAPE = 2] = "UPDATE_SHAPE", UpdateTag[UpdateTag.CLEAR_SHAPE = 253] = "CLEAR_SHAPE", UpdateTag[UpdateTag.UPDATE_SHAPE_AND_BOUNDS = 3] = "UPDATE_SHAPE_AND_BOUNDS", UpdateTag[UpdateTag.INIT = 179] = "INIT", UpdateTag[UpdateTag.CLEAR_BOUNDS = 254] = "CLEAR_BOUNDS", UpdateTag[UpdateTag.UPDATE_GLOBAL_MATRIX = 32] = "UPDATE_GLOBAL_MATRIX", UpdateTag[UpdateTag.CLEAR_GLOBAL_MATRIX = 223] = "CLEAR_GLOBAL_MATRIX", UpdateTag[UpdateTag.UPDATE_LOCAL_MATRIX = 16] = "UPDATE_LOCAL_MATRIX", UpdateTag[UpdateTag.CLEAR_LOCAL_MATRIX = 239] = "CLEAR_LOCAL_MATRIX", UpdateTag[UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX = 48] = "UPDATE_GLOBAL_LOCAL_MATRIX", UpdateTag[UpdateTag.UPDATE_PAINT = 64] = "UPDATE_PAINT", UpdateTag[UpdateTag.CLEAR_PAINT = 191] = "CLEAR_PAINT", UpdateTag[UpdateTag.UPDATE_LAYOUT = 128] = "UPDATE_LAYOUT", UpdateTag[UpdateTag.CLEAR_LAYOUT = 127] = "CLEAR_LAYOUT";
|
|
947
|
-
}(UpdateTag || (UpdateTag = {}));
|
|
948
|
-
var IContainPointMode;
|
|
949
|
-
!function (IContainPointMode) {
|
|
950
|
-
IContainPointMode[IContainPointMode.GLOBAL = 1] = "GLOBAL", IContainPointMode[IContainPointMode.LOCAL = 16] = "LOCAL", IContainPointMode[IContainPointMode.GLOBAL_ACCURATE = 3] = "GLOBAL_ACCURATE", IContainPointMode[IContainPointMode.LOCAL_ACCURATE = 48] = "LOCAL_ACCURATE";
|
|
951
|
-
}(IContainPointMode || (IContainPointMode = {}));
|
|
952
|
-
var AttributeUpdateType;
|
|
953
|
-
!function (AttributeUpdateType) {
|
|
954
|
-
AttributeUpdateType[AttributeUpdateType.INIT = 0] = "INIT", AttributeUpdateType[AttributeUpdateType.DEFAULT = 1] = "DEFAULT", AttributeUpdateType[AttributeUpdateType.STATE = 2] = "STATE", AttributeUpdateType[AttributeUpdateType.ANIMATE_BIND = 10] = "ANIMATE_BIND", AttributeUpdateType[AttributeUpdateType.ANIMATE_PLAY = 11] = "ANIMATE_PLAY", AttributeUpdateType[AttributeUpdateType.ANIMATE_START = 12] = "ANIMATE_START", AttributeUpdateType[AttributeUpdateType.ANIMATE_UPDATE = 13] = "ANIMATE_UPDATE", AttributeUpdateType[AttributeUpdateType.ANIMATE_END = 14] = "ANIMATE_END", AttributeUpdateType[AttributeUpdateType.TRANSLATE = 20] = "TRANSLATE", AttributeUpdateType[AttributeUpdateType.TRANSLATE_TO = 21] = "TRANSLATE_TO", AttributeUpdateType[AttributeUpdateType.SCALE = 22] = "SCALE", AttributeUpdateType[AttributeUpdateType.SCALE_TO = 23] = "SCALE_TO", AttributeUpdateType[AttributeUpdateType.ROTATE = 24] = "ROTATE", AttributeUpdateType[AttributeUpdateType.ROTATE_TO = 25] = "ROTATE_TO";
|
|
955
|
-
}(AttributeUpdateType || (AttributeUpdateType = {}));
|
|
956
|
-
var Direction;
|
|
957
|
-
!function (Direction) {
|
|
958
|
-
Direction[Direction.ROW = 1] = "ROW", Direction[Direction.COLUMN = 2] = "COLUMN";
|
|
959
|
-
}(Direction || (Direction = {}));
|
|
960
|
-
var CurveTypeEnum;
|
|
961
|
-
!function (CurveTypeEnum) {
|
|
962
|
-
CurveTypeEnum[CurveTypeEnum.CubicBezierCurve = 0] = "CubicBezierCurve", CurveTypeEnum[CurveTypeEnum.QuadraticBezierCurve = 1] = "QuadraticBezierCurve", CurveTypeEnum[CurveTypeEnum.ArcCurve = 2] = "ArcCurve", CurveTypeEnum[CurveTypeEnum.LineCurve = 3] = "LineCurve", CurveTypeEnum[CurveTypeEnum.EllipseCurve = 4] = "EllipseCurve", CurveTypeEnum[CurveTypeEnum.MoveCurve = 5] = "MoveCurve";
|
|
963
|
-
}(CurveTypeEnum || (CurveTypeEnum = {}));
|
|
964
|
-
var BaseRenderContributionTime;
|
|
965
|
-
!function (BaseRenderContributionTime) {
|
|
966
|
-
BaseRenderContributionTime[BaseRenderContributionTime.beforeFillStroke = 0] = "beforeFillStroke", BaseRenderContributionTime[BaseRenderContributionTime.afterFillStroke = 1] = "afterFillStroke";
|
|
967
|
-
}(BaseRenderContributionTime || (BaseRenderContributionTime = {}));
|
|
968
|
-
|
|
969
626
|
function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {
|
|
970
627
|
const th = degreeToRadian(rotateX),
|
|
971
628
|
sin_th = Math.sin(th),
|
|
@@ -2186,25 +1843,6 @@ var MeasureModeEnum;
|
|
|
2186
1843
|
MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
|
|
2187
1844
|
}(MeasureModeEnum || (MeasureModeEnum = {}));
|
|
2188
1845
|
|
|
2189
|
-
var AnimateMode;
|
|
2190
|
-
!function (AnimateMode) {
|
|
2191
|
-
AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
|
|
2192
|
-
}(AnimateMode || (AnimateMode = {}));
|
|
2193
|
-
|
|
2194
|
-
var STATUS$1;
|
|
2195
|
-
!function (STATUS) {
|
|
2196
|
-
STATUS[STATUS.INITIAL = 0] = "INITIAL", STATUS[STATUS.RUNNING = 1] = "RUNNING", STATUS[STATUS.PAUSE = 2] = "PAUSE";
|
|
2197
|
-
}(STATUS$1 || (STATUS$1 = {}));
|
|
2198
|
-
|
|
2199
|
-
var AnimateStepType;
|
|
2200
|
-
!function (AnimateStepType) {
|
|
2201
|
-
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
|
|
2202
|
-
}(AnimateStepType || (AnimateStepType = {}));
|
|
2203
|
-
var AnimateStatus;
|
|
2204
|
-
!function (AnimateStatus) {
|
|
2205
|
-
AnimateStatus[AnimateStatus.INITIAL = 0] = "INITIAL", AnimateStatus[AnimateStatus.RUNNING = 1] = "RUNNING", AnimateStatus[AnimateStatus.PAUSED = 2] = "PAUSED", AnimateStatus[AnimateStatus.END = 3] = "END";
|
|
2206
|
-
}(AnimateStatus || (AnimateStatus = {}));
|
|
2207
|
-
|
|
2208
1846
|
const DefaultLayout = {
|
|
2209
1847
|
alignSelf: "auto"
|
|
2210
1848
|
};
|
|
@@ -4678,8 +4316,8 @@ function getConicGradientAt(x, y, angle, color) {
|
|
|
4678
4316
|
return percent = (percent - startStop.offset) / (endStop.offset - startStop.offset), interpolateColor(startStop.color, endStop.color, percent, !1);
|
|
4679
4317
|
}
|
|
4680
4318
|
|
|
4681
|
-
const FULL_DEFINITION_KEYS
|
|
4682
|
-
function isPlainObject$
|
|
4319
|
+
const FULL_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]);
|
|
4320
|
+
function isPlainObject$1(value) {
|
|
4683
4321
|
return null != value && "object" == typeof value && !Array.isArray(value);
|
|
4684
4322
|
}
|
|
4685
4323
|
function normalizePatch(value) {
|
|
@@ -4725,12 +4363,11 @@ class StateDefinitionCompiler {
|
|
|
4725
4363
|
priority: 0,
|
|
4726
4364
|
patch: void 0
|
|
4727
4365
|
};
|
|
4728
|
-
if ((isPlainObject$
|
|
4366
|
+
if ((isPlainObject$1(value) ? Object.keys(value) : []).some(key => FULL_DEFINITION_KEYS.has(key))) {
|
|
4729
4367
|
const definition = value;
|
|
4730
4368
|
return {
|
|
4731
4369
|
name: null !== (_a = definition.name) && void 0 !== _a ? _a : name,
|
|
4732
4370
|
priority: null !== (_b = definition.priority) && void 0 !== _b ? _b : 0,
|
|
4733
|
-
rank: definition.rank,
|
|
4734
4371
|
patch: normalizePatch(definition.patch),
|
|
4735
4372
|
resolver: definition.resolver,
|
|
4736
4373
|
declaredAffectedKeys: definition.declaredAffectedKeys,
|
|
@@ -4750,15 +4387,178 @@ class StateDefinitionCompiler {
|
|
|
4750
4387
|
rawRelationMap.set(name, new Set(definition[relation]));
|
|
4751
4388
|
}), compiled.forEach((definition, origin) => {
|
|
4752
4389
|
const closure = new Set(),
|
|
4753
|
-
walk = (stateName,
|
|
4390
|
+
walk = (stateName, visiting) => {
|
|
4754
4391
|
const nextStates = rawRelationMap.get(stateName);
|
|
4755
4392
|
nextStates && nextStates.size && nextStates.forEach(nextState => {
|
|
4756
|
-
nextState
|
|
4393
|
+
nextState === origin || visiting.has(nextState) || closure.has(nextState) || (closure.add(nextState), visiting.add(nextState), walk(nextState, visiting), visiting.delete(nextState));
|
|
4757
4394
|
});
|
|
4758
4395
|
};
|
|
4759
|
-
walk(origin, [origin]), definition[relation] = closure;
|
|
4396
|
+
walk(origin, new Set([origin])), definition[relation] = closure;
|
|
4397
|
+
});
|
|
4398
|
+
}
|
|
4399
|
+
}
|
|
4400
|
+
|
|
4401
|
+
function isPlainObject(value) {
|
|
4402
|
+
return null != value && "object" == typeof value && !Array.isArray(value);
|
|
4403
|
+
}
|
|
4404
|
+
function cloneValue(value) {
|
|
4405
|
+
if (!isPlainObject(value)) return value;
|
|
4406
|
+
const clone = {};
|
|
4407
|
+
return Object.keys(value).forEach(key => {
|
|
4408
|
+
clone[key] = cloneValue(value[key]);
|
|
4409
|
+
}), clone;
|
|
4410
|
+
}
|
|
4411
|
+
function deepMerge(base, value) {
|
|
4412
|
+
var _a;
|
|
4413
|
+
const result = null !== (_a = cloneValue(base)) && void 0 !== _a ? _a : {};
|
|
4414
|
+
return Object.keys(value).forEach(key => {
|
|
4415
|
+
const nextValue = value[key],
|
|
4416
|
+
previousValue = result[key];
|
|
4417
|
+
isPlainObject(previousValue) && isPlainObject(nextValue) ? result[key] = deepMerge(previousValue, nextValue) : result[key] = cloneValue(nextValue);
|
|
4418
|
+
}), result;
|
|
4419
|
+
}
|
|
4420
|
+
class StateEngine {
|
|
4421
|
+
constructor(options) {
|
|
4422
|
+
var _a;
|
|
4423
|
+
this._activeStates = [], this._effectiveStates = [], this._suppressed = [], this._resolvedPatch = {}, this.resolverPatchCache = new Map(), this.resolverCacheKey = "", this.resolverCacheValid = !1, this.baseAttributes = {}, this.compiledDefinitions = options.compiledDefinitions, this.stateSort = options.stateSort, this.mergeMode = null !== (_a = options.mergeMode) && void 0 !== _a ? _a : "shallow";
|
|
4424
|
+
}
|
|
4425
|
+
get activeStates() {
|
|
4426
|
+
return this._activeStates;
|
|
4427
|
+
}
|
|
4428
|
+
get effectiveStates() {
|
|
4429
|
+
return this._effectiveStates;
|
|
4430
|
+
}
|
|
4431
|
+
get resolvedPatch() {
|
|
4432
|
+
return this._resolvedPatch;
|
|
4433
|
+
}
|
|
4434
|
+
get suppressed() {
|
|
4435
|
+
return this._suppressed;
|
|
4436
|
+
}
|
|
4437
|
+
setResolveContext(graphic, baseAttributes) {
|
|
4438
|
+
this.graphic = graphic, this.baseAttributes = baseAttributes;
|
|
4439
|
+
}
|
|
4440
|
+
applyStates(stateNames) {
|
|
4441
|
+
const uniqueStates = Array.from(new Set(stateNames)),
|
|
4442
|
+
sortedStates = this.sortStates(uniqueStates),
|
|
4443
|
+
adjudicated = this.adjudicate(sortedStates),
|
|
4444
|
+
activeStates = adjudicated.active,
|
|
4445
|
+
effectiveStates = activeStates.filter(stateName => !adjudicated.suppressedSet.has(stateName)),
|
|
4446
|
+
suppressed = activeStates.filter(stateName => adjudicated.suppressedSet.has(stateName)),
|
|
4447
|
+
changed = !this.sameArray(this._activeStates, activeStates) || !this.sameArray(this._effectiveStates, effectiveStates) || !this.sameArray(this._suppressed, suppressed);
|
|
4448
|
+
return this._activeStates = activeStates, this._effectiveStates = effectiveStates, this._suppressed = suppressed, !changed && this.resolverCacheValid || this.recomputePatch(effectiveStates), {
|
|
4449
|
+
changed: changed,
|
|
4450
|
+
activeStates: [...this._activeStates],
|
|
4451
|
+
effectiveStates: [...this._effectiveStates],
|
|
4452
|
+
suppressed: [...this._suppressed]
|
|
4453
|
+
};
|
|
4454
|
+
}
|
|
4455
|
+
addState(stateName, keepCurrentStates) {
|
|
4456
|
+
if (this._activeStates.includes(stateName) && (keepCurrentStates || 1 === this._activeStates.length)) return {
|
|
4457
|
+
changed: !1,
|
|
4458
|
+
activeStates: [...this._activeStates],
|
|
4459
|
+
effectiveStates: [...this._effectiveStates],
|
|
4460
|
+
suppressed: [...this._suppressed]
|
|
4461
|
+
};
|
|
4462
|
+
const nextStates = keepCurrentStates && this._activeStates.length ? this._activeStates.concat([stateName]) : [stateName];
|
|
4463
|
+
return this.applyStates(nextStates);
|
|
4464
|
+
}
|
|
4465
|
+
removeState(stateNames) {
|
|
4466
|
+
if (!this._activeStates.length) return {
|
|
4467
|
+
changed: !1,
|
|
4468
|
+
activeStates: [],
|
|
4469
|
+
effectiveStates: [],
|
|
4470
|
+
suppressed: []
|
|
4471
|
+
};
|
|
4472
|
+
const filteredNames = Array.isArray(stateNames) ? this._activeStates.filter(stateName => !stateNames.includes(stateName)) : this._activeStates.filter(stateName => stateName !== stateNames);
|
|
4473
|
+
return filteredNames.length === this._activeStates.length ? {
|
|
4474
|
+
changed: !1,
|
|
4475
|
+
activeStates: [...this._activeStates],
|
|
4476
|
+
effectiveStates: [...this._effectiveStates],
|
|
4477
|
+
suppressed: [...this._suppressed]
|
|
4478
|
+
} : this.applyStates(filteredNames);
|
|
4479
|
+
}
|
|
4480
|
+
toggleState(stateName) {
|
|
4481
|
+
return this.hasState(stateName) ? this.removeState(stateName) : this.applyStates(this._activeStates.concat([stateName]));
|
|
4482
|
+
}
|
|
4483
|
+
clearStates() {
|
|
4484
|
+
const changed = this._activeStates.length > 0 || this._effectiveStates.length > 0 || this._suppressed.length > 0;
|
|
4485
|
+
return this._activeStates = [], this._effectiveStates = [], this._suppressed = [], this._resolvedPatch = {}, this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1, {
|
|
4486
|
+
changed: changed,
|
|
4487
|
+
activeStates: [],
|
|
4488
|
+
effectiveStates: [],
|
|
4489
|
+
suppressed: []
|
|
4490
|
+
};
|
|
4491
|
+
}
|
|
4492
|
+
invalidateResolverCache() {
|
|
4493
|
+
this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1;
|
|
4494
|
+
}
|
|
4495
|
+
hasState(stateName) {
|
|
4496
|
+
return !!this._activeStates.length && (null == stateName || this._activeStates.includes(stateName));
|
|
4497
|
+
}
|
|
4498
|
+
sortStates(states) {
|
|
4499
|
+
const withDefinition = [],
|
|
4500
|
+
withoutDefinition = [];
|
|
4501
|
+
return states.forEach(stateName => {
|
|
4502
|
+
this.compiledDefinitions.has(stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
|
|
4503
|
+
}), withDefinition.sort((left, right) => {
|
|
4504
|
+
const leftDefinition = this.compiledDefinitions.get(left),
|
|
4505
|
+
rightDefinition = this.compiledDefinitions.get(right);
|
|
4506
|
+
return leftDefinition && rightDefinition ? leftDefinition.priority !== rightDefinition.priority ? leftDefinition.priority - rightDefinition.priority : leftDefinition.rank - rightDefinition.rank : 0;
|
|
4507
|
+
}), this.stateSort && withoutDefinition.length > 1 && withoutDefinition.sort(this.stateSort), withDefinition.concat(withoutDefinition);
|
|
4508
|
+
}
|
|
4509
|
+
adjudicate(sortedStates) {
|
|
4510
|
+
const candidate = sortedStates.slice(),
|
|
4511
|
+
suppressedSet = new Set();
|
|
4512
|
+
for (let index = candidate.length - 1; index >= 0; index--) {
|
|
4513
|
+
const stateName = candidate[index],
|
|
4514
|
+
definition = this.compiledDefinitions.get(stateName);
|
|
4515
|
+
definition && (definition.exclude.forEach(excludedState => {
|
|
4516
|
+
const excludedIndex = candidate.indexOf(excludedState);
|
|
4517
|
+
-1 !== excludedIndex && (candidate.splice(excludedIndex, 1), excludedIndex < index && (index -= 1));
|
|
4518
|
+
}), definition.suppress.forEach(suppressedState => {
|
|
4519
|
+
suppressedSet.add(suppressedState);
|
|
4520
|
+
}));
|
|
4521
|
+
}
|
|
4522
|
+
return {
|
|
4523
|
+
active: candidate,
|
|
4524
|
+
suppressedSet: suppressedSet
|
|
4525
|
+
};
|
|
4526
|
+
}
|
|
4527
|
+
recomputePatch(effectiveStates) {
|
|
4528
|
+
const cacheKey = effectiveStates.join(","),
|
|
4529
|
+
nextPatch = {},
|
|
4530
|
+
useResolverCache = this.resolverCacheValid && this.resolverCacheKey === cacheKey;
|
|
4531
|
+
useResolverCache || (this.resolverPatchCache.clear(), this.resolverCacheKey = cacheKey), effectiveStates.forEach(stateName => {
|
|
4532
|
+
var _a;
|
|
4533
|
+
const definition = this.compiledDefinitions.get(stateName);
|
|
4534
|
+
if (definition && (definition.patch && this.mergeInto(nextPatch, definition.patch), definition.hasResolver)) {
|
|
4535
|
+
const resolverPatch = useResolverCache ? this.resolverPatchCache.get(stateName) : null === (_a = definition.resolver) || void 0 === _a ? void 0 : _a.call(definition, {
|
|
4536
|
+
graphic: this.graphic,
|
|
4537
|
+
activeStates: this._activeStates,
|
|
4538
|
+
effectiveStates: this._effectiveStates,
|
|
4539
|
+
baseAttributes: this.baseAttributes,
|
|
4540
|
+
resolvedPatch: nextPatch
|
|
4541
|
+
});
|
|
4542
|
+
resolverPatch && (useResolverCache || this.resolverPatchCache.set(stateName, resolverPatch), this.mergeInto(nextPatch, resolverPatch));
|
|
4543
|
+
}
|
|
4544
|
+
}), useResolverCache || (this.resolverCacheValid = !0), this._resolvedPatch = nextPatch;
|
|
4545
|
+
}
|
|
4546
|
+
mergeInto(target, patch) {
|
|
4547
|
+
"deep" !== this.mergeMode ? Object.keys(patch).forEach(key => {
|
|
4548
|
+
target[key] = cloneValue(patch[key]);
|
|
4549
|
+
}) : Object.keys(patch).forEach(key => {
|
|
4550
|
+
var _a;
|
|
4551
|
+
const nextValue = patch[key],
|
|
4552
|
+
previousValue = target[key],
|
|
4553
|
+
baseValue = null === (_a = this.baseAttributes) || void 0 === _a ? void 0 : _a[key];
|
|
4554
|
+
isPlainObject(previousValue) && isPlainObject(nextValue) ? target[key] = deepMerge(previousValue, nextValue) : !isPlainObject(previousValue) && isPlainObject(baseValue) && isPlainObject(nextValue) ? target[key] = deepMerge(baseValue, nextValue) : target[key] = cloneValue(nextValue);
|
|
4760
4555
|
});
|
|
4761
4556
|
}
|
|
4557
|
+
sameArray(left, right) {
|
|
4558
|
+
if (left.length !== right.length) return !1;
|
|
4559
|
+
for (let index = 0; index < left.length; index++) if (left[index] !== right[index]) return !1;
|
|
4560
|
+
return !0;
|
|
4561
|
+
}
|
|
4762
4562
|
}
|
|
4763
4563
|
|
|
4764
4564
|
var UpdateCategory;
|
|
@@ -4805,565 +4605,6 @@ function classifyAttributeDelta(key, prev, next) {
|
|
|
4805
4605
|
return dynamicClassifier ? dynamicClassifier(prev, next) : null !== (_a = ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : UpdateCategory.PAINT;
|
|
4806
4606
|
}
|
|
4807
4607
|
|
|
4808
|
-
const STAGE_PERF_MONITOR = Symbol("vrender.statePerfMonitor");
|
|
4809
|
-
function createReasonBreakdown() {
|
|
4810
|
-
return {
|
|
4811
|
-
config_disabled: 0,
|
|
4812
|
-
context_disabled: 0,
|
|
4813
|
-
non_batch_operation: 0,
|
|
4814
|
-
mixed_update_category: 0,
|
|
4815
|
-
resolver_unstable_keys: 0,
|
|
4816
|
-
graphic_unavailable: 0
|
|
4817
|
-
};
|
|
4818
|
-
}
|
|
4819
|
-
function createEmptyStatePerfSnapshot() {
|
|
4820
|
-
return {
|
|
4821
|
-
counters: {
|
|
4822
|
-
stateCommits: 0,
|
|
4823
|
-
sharedRefreshCommits: 0,
|
|
4824
|
-
deferredJobsCreated: 0,
|
|
4825
|
-
deferredJobsCompleted: 0,
|
|
4826
|
-
deferredJobsCancelled: 0,
|
|
4827
|
-
deferredJobsCoalesced: 0,
|
|
4828
|
-
deferredGraphicsCommitted: 0,
|
|
4829
|
-
deferredBudgetYields: 0,
|
|
4830
|
-
deferredIneligibleGraphics: 0
|
|
4831
|
-
},
|
|
4832
|
-
deferredIneligibleByReason: createReasonBreakdown(),
|
|
4833
|
-
categoryBreakdown: {
|
|
4834
|
-
paint: 0,
|
|
4835
|
-
transform: 0,
|
|
4836
|
-
shape: 0,
|
|
4837
|
-
bounds: 0,
|
|
4838
|
-
layout: 0,
|
|
4839
|
-
pick: 0
|
|
4840
|
-
},
|
|
4841
|
-
refresh: {
|
|
4842
|
-
queuedGraphics: 0,
|
|
4843
|
-
flushedGraphics: 0,
|
|
4844
|
-
ensureFreshCalls: 0,
|
|
4845
|
-
renderScheduled: 0
|
|
4846
|
-
},
|
|
4847
|
-
resolver: {
|
|
4848
|
-
cacheHits: 0,
|
|
4849
|
-
cacheMisses: 0,
|
|
4850
|
-
invalidations: 0
|
|
4851
|
-
},
|
|
4852
|
-
cost: {
|
|
4853
|
-
resolverTotalMs: 0,
|
|
4854
|
-
resolverMaxMs: 0,
|
|
4855
|
-
patchTotalMs: 0,
|
|
4856
|
-
patchMaxMs: 0,
|
|
4857
|
-
sharedRefreshTotalMs: 0,
|
|
4858
|
-
sharedRefreshMaxMs: 0,
|
|
4859
|
-
batchSliceTotalMs: 0,
|
|
4860
|
-
batchSliceMaxMs: 0
|
|
4861
|
-
},
|
|
4862
|
-
allocationHints: {
|
|
4863
|
-
patchObjectsCreated: 0,
|
|
4864
|
-
batchEntriesCreated: 0,
|
|
4865
|
-
refreshQueuePushes: 0
|
|
4866
|
-
},
|
|
4867
|
-
batch: {
|
|
4868
|
-
pendingJobs: 0,
|
|
4869
|
-
maxPendingJobs: 0,
|
|
4870
|
-
maxGraphicsInJob: 0,
|
|
4871
|
-
maxFrameSliceCost: 0
|
|
4872
|
-
},
|
|
4873
|
-
events: []
|
|
4874
|
-
};
|
|
4875
|
-
}
|
|
4876
|
-
function cloneSnapshot(snapshot) {
|
|
4877
|
-
return {
|
|
4878
|
-
counters: Object.assign({}, snapshot.counters),
|
|
4879
|
-
deferredIneligibleByReason: Object.assign({}, snapshot.deferredIneligibleByReason),
|
|
4880
|
-
categoryBreakdown: Object.assign({}, snapshot.categoryBreakdown),
|
|
4881
|
-
refresh: Object.assign({}, snapshot.refresh),
|
|
4882
|
-
resolver: Object.assign({}, snapshot.resolver),
|
|
4883
|
-
cost: Object.assign({}, snapshot.cost),
|
|
4884
|
-
allocationHints: Object.assign({}, snapshot.allocationHints),
|
|
4885
|
-
batch: Object.assign({}, snapshot.batch),
|
|
4886
|
-
events: snapshot.events ? snapshot.events.slice() : []
|
|
4887
|
-
};
|
|
4888
|
-
}
|
|
4889
|
-
class StatePerfMonitor {
|
|
4890
|
-
constructor(configSource) {
|
|
4891
|
-
this.configSource = configSource, this.snapshot = createEmptyStatePerfSnapshot();
|
|
4892
|
-
}
|
|
4893
|
-
setConfig(config) {
|
|
4894
|
-
this.configSource = config;
|
|
4895
|
-
}
|
|
4896
|
-
getSnapshot() {
|
|
4897
|
-
return cloneSnapshot(this.snapshot);
|
|
4898
|
-
}
|
|
4899
|
-
reset() {
|
|
4900
|
-
const next = createEmptyStatePerfSnapshot();
|
|
4901
|
-
Object.assign(this.snapshot.counters, next.counters), Object.assign(this.snapshot.deferredIneligibleByReason, next.deferredIneligibleByReason), Object.assign(this.snapshot.categoryBreakdown, next.categoryBreakdown), Object.assign(this.snapshot.refresh, next.refresh), Object.assign(this.snapshot.resolver, next.resolver), Object.assign(this.snapshot.cost, next.cost), Object.assign(this.snapshot.allocationHints, next.allocationHints), Object.assign(this.snapshot.batch, next.batch), this.snapshot.events = [];
|
|
4902
|
-
}
|
|
4903
|
-
incrementCounter(key, delta = 1) {
|
|
4904
|
-
this.isEnabled() && (this.snapshot.counters[key] += delta);
|
|
4905
|
-
}
|
|
4906
|
-
recordDeferredIneligible(reason, delta = 1) {
|
|
4907
|
-
this.isEnabled() && (this.snapshot.deferredIneligibleByReason[reason] += delta, this.snapshot.counters.deferredIneligibleGraphics += delta, this.recordEvent("deferred-ineligible", {
|
|
4908
|
-
reason: reason,
|
|
4909
|
-
count: delta
|
|
4910
|
-
}));
|
|
4911
|
-
}
|
|
4912
|
-
recordCategory(category) {
|
|
4913
|
-
this.isEnabled() && (category & UpdateCategory.PAINT && (this.snapshot.categoryBreakdown.paint += 1), category & UpdateCategory.TRANSFORM && (this.snapshot.categoryBreakdown.transform += 1), category & UpdateCategory.SHAPE && (this.snapshot.categoryBreakdown.shape += 1), category & UpdateCategory.BOUNDS && (this.snapshot.categoryBreakdown.bounds += 1), category & UpdateCategory.LAYOUT && (this.snapshot.categoryBreakdown.layout += 1), category & UpdateCategory.PICK && (this.snapshot.categoryBreakdown.pick += 1));
|
|
4914
|
-
}
|
|
4915
|
-
recordRefresh(key, delta = 1) {
|
|
4916
|
-
this.isEnabled() && (this.snapshot.refresh[key] += delta);
|
|
4917
|
-
}
|
|
4918
|
-
recordResolver(key, delta = 1) {
|
|
4919
|
-
this.isEnabled() && (this.snapshot.resolver[key] += delta);
|
|
4920
|
-
}
|
|
4921
|
-
recordCost(kind, durationMs) {
|
|
4922
|
-
if (this.isEnabled()) {
|
|
4923
|
-
if ("resolver" === kind) return this.snapshot.cost.resolverTotalMs += durationMs, void (this.snapshot.cost.resolverMaxMs = Math.max(this.snapshot.cost.resolverMaxMs, durationMs));
|
|
4924
|
-
if ("patch" === kind) return this.snapshot.cost.patchTotalMs += durationMs, void (this.snapshot.cost.patchMaxMs = Math.max(this.snapshot.cost.patchMaxMs, durationMs));
|
|
4925
|
-
if ("sharedRefresh" === kind) return this.snapshot.cost.sharedRefreshTotalMs += durationMs, void (this.snapshot.cost.sharedRefreshMaxMs = Math.max(this.snapshot.cost.sharedRefreshMaxMs, durationMs));
|
|
4926
|
-
this.snapshot.cost.batchSliceTotalMs += durationMs, this.snapshot.cost.batchSliceMaxMs = Math.max(this.snapshot.cost.batchSliceMaxMs, durationMs), this.snapshot.batch.maxFrameSliceCost = Math.max(this.snapshot.batch.maxFrameSliceCost, durationMs);
|
|
4927
|
-
}
|
|
4928
|
-
}
|
|
4929
|
-
recordAllocation(key, delta = 1) {
|
|
4930
|
-
this.isEnabled() && (this.snapshot.allocationHints[key] += delta);
|
|
4931
|
-
}
|
|
4932
|
-
updateBatchPending(pendingJobs) {
|
|
4933
|
-
this.isEnabled() && (this.snapshot.batch.pendingJobs = pendingJobs, this.snapshot.batch.maxPendingJobs = Math.max(this.snapshot.batch.maxPendingJobs, pendingJobs));
|
|
4934
|
-
}
|
|
4935
|
-
updateMaxGraphicsInJob(count) {
|
|
4936
|
-
this.isEnabled() && (this.snapshot.batch.maxGraphicsInJob = Math.max(this.snapshot.batch.maxGraphicsInJob, count));
|
|
4937
|
-
}
|
|
4938
|
-
recordEvent(type, detail) {
|
|
4939
|
-
var _a, _b, _c;
|
|
4940
|
-
if (!this.shouldRecordEvents()) return;
|
|
4941
|
-
const events = null !== (_a = this.snapshot.events) && void 0 !== _a ? _a : this.snapshot.events = [];
|
|
4942
|
-
events.push({
|
|
4943
|
-
type: type,
|
|
4944
|
-
at: Date.now(),
|
|
4945
|
-
detail: detail
|
|
4946
|
-
});
|
|
4947
|
-
const max = null !== (_c = null === (_b = this.getConfig()) || void 0 === _b ? void 0 : _b.maxEventRecords) && void 0 !== _c ? _c : 100;
|
|
4948
|
-
events.length > max && events.splice(0, events.length - max);
|
|
4949
|
-
}
|
|
4950
|
-
isEnabled() {
|
|
4951
|
-
var _a;
|
|
4952
|
-
return !0 === (null === (_a = this.getConfig()) || void 0 === _a ? void 0 : _a.enabled);
|
|
4953
|
-
}
|
|
4954
|
-
shouldRecordEvents() {
|
|
4955
|
-
const config = this.getConfig();
|
|
4956
|
-
return !!(null == config ? void 0 : config.enabled) && !!config.recordEvents;
|
|
4957
|
-
}
|
|
4958
|
-
getConfig() {
|
|
4959
|
-
return "function" == typeof this.configSource ? this.configSource() : this.configSource;
|
|
4960
|
-
}
|
|
4961
|
-
}
|
|
4962
|
-
function ensureStageStatePerfMonitor(stage) {
|
|
4963
|
-
const stageAny = stage;
|
|
4964
|
-
return stageAny[STAGE_PERF_MONITOR] || (stageAny[STAGE_PERF_MONITOR] = new StatePerfMonitor(() => stage.statePerfConfig)), stageAny[STAGE_PERF_MONITOR];
|
|
4965
|
-
}
|
|
4966
|
-
function getStageStatePerfMonitor(stage) {
|
|
4967
|
-
if (stage) return stage[STAGE_PERF_MONITOR];
|
|
4968
|
-
}
|
|
4969
|
-
function getActiveStageStatePerfMonitor(stage) {
|
|
4970
|
-
var _a;
|
|
4971
|
-
if (!stage) return;
|
|
4972
|
-
const current = getStageStatePerfMonitor(stage);
|
|
4973
|
-
return current || (!0 === (null === (_a = stage.statePerfConfig) || void 0 === _a ? void 0 : _a.enabled) ? ensureStageStatePerfMonitor(stage) : void 0);
|
|
4974
|
-
}
|
|
4975
|
-
|
|
4976
|
-
function isPlainObject$1(value) {
|
|
4977
|
-
return null != value && "object" == typeof value && !Array.isArray(value);
|
|
4978
|
-
}
|
|
4979
|
-
function cloneValue$1(value) {
|
|
4980
|
-
if (!isPlainObject$1(value)) return value;
|
|
4981
|
-
const clone = {};
|
|
4982
|
-
return Object.keys(value).forEach(key => {
|
|
4983
|
-
clone[key] = cloneValue$1(value[key]);
|
|
4984
|
-
}), clone;
|
|
4985
|
-
}
|
|
4986
|
-
function deepMerge$1(base, value) {
|
|
4987
|
-
var _a;
|
|
4988
|
-
const result = null !== (_a = cloneValue$1(base)) && void 0 !== _a ? _a : {};
|
|
4989
|
-
return Object.keys(value).forEach(key => {
|
|
4990
|
-
const nextValue = value[key],
|
|
4991
|
-
previousValue = result[key];
|
|
4992
|
-
isPlainObject$1(previousValue) && isPlainObject$1(nextValue) ? result[key] = deepMerge$1(previousValue, nextValue) : result[key] = cloneValue$1(nextValue);
|
|
4993
|
-
}), result;
|
|
4994
|
-
}
|
|
4995
|
-
const FULL_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]);
|
|
4996
|
-
class StateEngine {
|
|
4997
|
-
constructor(options) {
|
|
4998
|
-
var _a;
|
|
4999
|
-
this._activeStates = [], this._effectiveStates = [], this._suppressed = [], this._resolvedPatch = {}, this.resolverPatchCache = new Map(), this.resolverCacheKey = "", this.resolverCacheValid = !1, this.baseAttributes = {}, this.compiledDefinitions = options.compiledDefinitions, this.stateSort = options.stateSort, this.stateProxy = options.stateProxy, this.stateProxyEligibility = options.stateProxyEligibility, this.states = options.states, this.mergeMode = null !== (_a = options.mergeMode) && void 0 !== _a ? _a : "shallow";
|
|
5000
|
-
}
|
|
5001
|
-
get activeStates() {
|
|
5002
|
-
return this._activeStates;
|
|
5003
|
-
}
|
|
5004
|
-
get effectiveStates() {
|
|
5005
|
-
return this._effectiveStates;
|
|
5006
|
-
}
|
|
5007
|
-
get resolvedPatch() {
|
|
5008
|
-
return this._resolvedPatch;
|
|
5009
|
-
}
|
|
5010
|
-
get suppressed() {
|
|
5011
|
-
return this._suppressed;
|
|
5012
|
-
}
|
|
5013
|
-
setResolveContext(graphic, baseAttributes) {
|
|
5014
|
-
this.graphic = graphic, this.baseAttributes = baseAttributes;
|
|
5015
|
-
}
|
|
5016
|
-
applyStates(stateNames) {
|
|
5017
|
-
const uniqueStates = Array.from(new Set(stateNames)),
|
|
5018
|
-
sortedStates = this.sortStates(uniqueStates),
|
|
5019
|
-
adjudicated = this.adjudicate(sortedStates),
|
|
5020
|
-
activeStates = adjudicated.active,
|
|
5021
|
-
effectiveStates = activeStates.filter(stateName => !adjudicated.suppressedSet.has(stateName)),
|
|
5022
|
-
suppressed = activeStates.filter(stateName => adjudicated.suppressedSet.has(stateName)),
|
|
5023
|
-
changed = !this.sameArray(this._activeStates, activeStates) || !this.sameArray(this._effectiveStates, effectiveStates) || !this.sameArray(this._suppressed, suppressed);
|
|
5024
|
-
return this._activeStates = activeStates, this._effectiveStates = effectiveStates, this._suppressed = suppressed, !changed && this.resolverCacheValid || this.recomputePatch(effectiveStates), {
|
|
5025
|
-
changed: changed,
|
|
5026
|
-
activeStates: [...this._activeStates],
|
|
5027
|
-
effectiveStates: [...this._effectiveStates],
|
|
5028
|
-
suppressed: [...this._suppressed]
|
|
5029
|
-
};
|
|
5030
|
-
}
|
|
5031
|
-
addState(stateName, keepCurrentStates) {
|
|
5032
|
-
if (this._activeStates.includes(stateName) && (keepCurrentStates || 1 === this._activeStates.length)) return {
|
|
5033
|
-
changed: !1,
|
|
5034
|
-
activeStates: [...this._activeStates],
|
|
5035
|
-
effectiveStates: [...this._effectiveStates],
|
|
5036
|
-
suppressed: [...this._suppressed]
|
|
5037
|
-
};
|
|
5038
|
-
const nextStates = keepCurrentStates && this._activeStates.length ? this._activeStates.concat([stateName]) : [stateName];
|
|
5039
|
-
return this.applyStates(nextStates);
|
|
5040
|
-
}
|
|
5041
|
-
removeState(stateNames) {
|
|
5042
|
-
if (!this._activeStates.length) return {
|
|
5043
|
-
changed: !1,
|
|
5044
|
-
activeStates: [],
|
|
5045
|
-
effectiveStates: [],
|
|
5046
|
-
suppressed: []
|
|
5047
|
-
};
|
|
5048
|
-
const filteredNames = Array.isArray(stateNames) ? this._activeStates.filter(stateName => !stateNames.includes(stateName)) : this._activeStates.filter(stateName => stateName !== stateNames);
|
|
5049
|
-
return filteredNames.length === this._activeStates.length ? {
|
|
5050
|
-
changed: !1,
|
|
5051
|
-
activeStates: [...this._activeStates],
|
|
5052
|
-
effectiveStates: [...this._effectiveStates],
|
|
5053
|
-
suppressed: [...this._suppressed]
|
|
5054
|
-
} : this.applyStates(filteredNames);
|
|
5055
|
-
}
|
|
5056
|
-
toggleState(stateName) {
|
|
5057
|
-
return this.hasState(stateName) ? this.removeState(stateName) : this.applyStates(this._activeStates.concat([stateName]));
|
|
5058
|
-
}
|
|
5059
|
-
clearStates() {
|
|
5060
|
-
const changed = this._activeStates.length > 0 || this._effectiveStates.length > 0 || this._suppressed.length > 0;
|
|
5061
|
-
return this._activeStates = [], this._effectiveStates = [], this._suppressed = [], this._resolvedPatch = {}, this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1, {
|
|
5062
|
-
changed: changed,
|
|
5063
|
-
activeStates: [],
|
|
5064
|
-
effectiveStates: [],
|
|
5065
|
-
suppressed: []
|
|
5066
|
-
};
|
|
5067
|
-
}
|
|
5068
|
-
invalidateResolverCache() {
|
|
5069
|
-
var _a, _b;
|
|
5070
|
-
this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1, null === (_b = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage)) || void 0 === _b || _b.recordResolver("invalidations");
|
|
5071
|
-
}
|
|
5072
|
-
hasState(stateName) {
|
|
5073
|
-
return !!this._activeStates.length && (null == stateName || this._activeStates.includes(stateName));
|
|
5074
|
-
}
|
|
5075
|
-
getCompatPatch(stateName) {
|
|
5076
|
-
var _a, _b, _c;
|
|
5077
|
-
const targetStates = this._activeStates.length ? this._activeStates : this._effectiveStates,
|
|
5078
|
-
canUseStateProxy = this.canUseStateProxy(stateName),
|
|
5079
|
-
proxyPatch = canUseStateProxy ? null === (_a = this.stateProxy) || void 0 === _a ? void 0 : _a.call(this, stateName, targetStates) : void 0;
|
|
5080
|
-
if (this.stateProxy && canUseStateProxy) return null != proxyPatch ? proxyPatch : void 0;
|
|
5081
|
-
const value = null === (_b = this.states) || void 0 === _b ? void 0 : _b[stateName];
|
|
5082
|
-
if (null == value) return;
|
|
5083
|
-
if (!isPlainObject$1(value)) return value;
|
|
5084
|
-
return Object.keys(value).some(key => FULL_DEFINITION_KEYS.has(key)) ? cloneValue$1(null !== (_c = value.patch) && void 0 !== _c ? _c : void 0) : value;
|
|
5085
|
-
}
|
|
5086
|
-
sortStates(states) {
|
|
5087
|
-
const withDefinition = [],
|
|
5088
|
-
withoutDefinition = [];
|
|
5089
|
-
return states.forEach(stateName => {
|
|
5090
|
-
this.compiledDefinitions.has(stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
|
|
5091
|
-
}), withDefinition.sort((left, right) => {
|
|
5092
|
-
const leftDefinition = this.compiledDefinitions.get(left),
|
|
5093
|
-
rightDefinition = this.compiledDefinitions.get(right);
|
|
5094
|
-
return leftDefinition && rightDefinition ? leftDefinition.priority !== rightDefinition.priority ? leftDefinition.priority - rightDefinition.priority : leftDefinition.rank - rightDefinition.rank : 0;
|
|
5095
|
-
}), this.stateSort && withoutDefinition.length > 1 && withoutDefinition.sort(this.stateSort), withDefinition.concat(withoutDefinition);
|
|
5096
|
-
}
|
|
5097
|
-
adjudicate(sortedStates) {
|
|
5098
|
-
const candidate = sortedStates.slice(),
|
|
5099
|
-
suppressedSet = new Set();
|
|
5100
|
-
for (let index = candidate.length - 1; index >= 0; index--) {
|
|
5101
|
-
const stateName = candidate[index],
|
|
5102
|
-
definition = this.compiledDefinitions.get(stateName);
|
|
5103
|
-
definition && (definition.exclude.forEach(excludedState => {
|
|
5104
|
-
const excludedIndex = candidate.indexOf(excludedState);
|
|
5105
|
-
-1 !== excludedIndex && (candidate.splice(excludedIndex, 1), excludedIndex < index && (index -= 1));
|
|
5106
|
-
}), definition.suppress.forEach(suppressedState => {
|
|
5107
|
-
suppressedSet.add(suppressedState);
|
|
5108
|
-
}));
|
|
5109
|
-
}
|
|
5110
|
-
return {
|
|
5111
|
-
active: candidate,
|
|
5112
|
-
suppressedSet: suppressedSet
|
|
5113
|
-
};
|
|
5114
|
-
}
|
|
5115
|
-
recomputePatch(effectiveStates) {
|
|
5116
|
-
var _a;
|
|
5117
|
-
const perfMonitor = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
|
|
5118
|
-
patchStart = perfMonitor ? performance.now() : 0;
|
|
5119
|
-
let resolverCost = 0;
|
|
5120
|
-
const cacheKey = effectiveStates.join(","),
|
|
5121
|
-
nextPatch = {};
|
|
5122
|
-
if (null == perfMonitor || perfMonitor.recordAllocation("patchObjectsCreated"), this.resolverCacheValid && this.resolverCacheKey === cacheKey ? effectiveStates.forEach(stateName => {
|
|
5123
|
-
var _a;
|
|
5124
|
-
const canUseStateProxy = this.canUseStateProxy(stateName),
|
|
5125
|
-
proxyPatch = canUseStateProxy ? null === (_a = this.stateProxy) || void 0 === _a ? void 0 : _a.call(this, stateName, effectiveStates) : void 0;
|
|
5126
|
-
if (this.stateProxy && canUseStateProxy) return void (null != proxyPatch && this.mergeInto(nextPatch, proxyPatch));
|
|
5127
|
-
const definition = this.compiledDefinitions.get(stateName);
|
|
5128
|
-
if (definition) {
|
|
5129
|
-
if (definition.patch && this.mergeInto(nextPatch, definition.patch), definition.hasResolver) {
|
|
5130
|
-
const cachedPatch = this.resolverPatchCache.get(stateName);
|
|
5131
|
-
cachedPatch && (null == perfMonitor || perfMonitor.recordResolver("cacheHits"), this.mergeInto(nextPatch, cachedPatch));
|
|
5132
|
-
}
|
|
5133
|
-
} else {
|
|
5134
|
-
const compatPatch = this.getCompatPatch(stateName);
|
|
5135
|
-
compatPatch && this.mergeInto(nextPatch, compatPatch);
|
|
5136
|
-
}
|
|
5137
|
-
}) : (this.resolverPatchCache.clear(), this.resolverCacheKey = cacheKey, effectiveStates.forEach(stateName => {
|
|
5138
|
-
var _a;
|
|
5139
|
-
const canUseStateProxy = this.canUseStateProxy(stateName),
|
|
5140
|
-
proxyPatch = canUseStateProxy ? null === (_a = this.stateProxy) || void 0 === _a ? void 0 : _a.call(this, stateName, effectiveStates) : void 0;
|
|
5141
|
-
if (this.stateProxy && canUseStateProxy) return void (null != proxyPatch && this.mergeInto(nextPatch, proxyPatch));
|
|
5142
|
-
const definition = this.compiledDefinitions.get(stateName);
|
|
5143
|
-
if (definition) {
|
|
5144
|
-
if (definition.patch && this.mergeInto(nextPatch, definition.patch), definition.hasResolver && definition.resolver) {
|
|
5145
|
-
null == perfMonitor || perfMonitor.recordResolver("cacheMisses");
|
|
5146
|
-
const resolverStart = perfMonitor ? performance.now() : 0,
|
|
5147
|
-
resolverPatch = definition.resolver({
|
|
5148
|
-
graphic: this.graphic,
|
|
5149
|
-
activeStates: this._activeStates,
|
|
5150
|
-
effectiveStates: this._effectiveStates,
|
|
5151
|
-
baseAttributes: this.baseAttributes,
|
|
5152
|
-
resolvedPatch: nextPatch
|
|
5153
|
-
});
|
|
5154
|
-
if (perfMonitor) {
|
|
5155
|
-
const duration = performance.now() - resolverStart;
|
|
5156
|
-
resolverCost += duration, perfMonitor.recordCost("resolver", duration);
|
|
5157
|
-
}
|
|
5158
|
-
resolverPatch && (this.resolverPatchCache.set(stateName, resolverPatch), this.mergeInto(nextPatch, resolverPatch));
|
|
5159
|
-
}
|
|
5160
|
-
} else {
|
|
5161
|
-
const compatPatch = this.getCompatPatch(stateName);
|
|
5162
|
-
compatPatch && this.mergeInto(nextPatch, compatPatch);
|
|
5163
|
-
}
|
|
5164
|
-
}), this.resolverCacheValid = !0), this._resolvedPatch = nextPatch, perfMonitor) {
|
|
5165
|
-
const totalCost = performance.now() - patchStart;
|
|
5166
|
-
perfMonitor.recordCost("patch", Math.max(0, totalCost - resolverCost));
|
|
5167
|
-
}
|
|
5168
|
-
}
|
|
5169
|
-
mergeInto(target, patch) {
|
|
5170
|
-
"deep" !== this.mergeMode ? Object.keys(patch).forEach(key => {
|
|
5171
|
-
target[key] = cloneValue$1(patch[key]);
|
|
5172
|
-
}) : Object.keys(patch).forEach(key => {
|
|
5173
|
-
var _a;
|
|
5174
|
-
const nextValue = patch[key],
|
|
5175
|
-
previousValue = target[key],
|
|
5176
|
-
baseValue = null === (_a = this.baseAttributes) || void 0 === _a ? void 0 : _a[key];
|
|
5177
|
-
isPlainObject$1(previousValue) && isPlainObject$1(nextValue) ? target[key] = deepMerge$1(previousValue, nextValue) : !isPlainObject$1(previousValue) && isPlainObject$1(baseValue) && isPlainObject$1(nextValue) ? target[key] = deepMerge$1(baseValue, nextValue) : target[key] = cloneValue$1(nextValue);
|
|
5178
|
-
});
|
|
5179
|
-
}
|
|
5180
|
-
sameArray(left, right) {
|
|
5181
|
-
if (left.length !== right.length) return !1;
|
|
5182
|
-
for (let index = 0; index < left.length; index++) if (left[index] !== right[index]) return !1;
|
|
5183
|
-
return !0;
|
|
5184
|
-
}
|
|
5185
|
-
canUseStateProxy(stateName) {
|
|
5186
|
-
return !!this.stateProxy && (!this.stateProxyEligibility || this.stateProxyEligibility(stateName));
|
|
5187
|
-
}
|
|
5188
|
-
}
|
|
5189
|
-
|
|
5190
|
-
class StateModel {
|
|
5191
|
-
constructor(options = {}) {
|
|
5192
|
-
var _a;
|
|
5193
|
-
this.exclusiveGroupMap = new Map(), this.exclusiveGroups = new Map(), this.states = options.states, this.currentStates = options.currentStates ? [...options.currentStates] : void 0, this.stateSort = options.stateSort, this.stateProxy = options.stateProxy, this.stateEngine = options.stateEngine, this.stateEngine && options.currentStates && !this.sameStates(this.stateEngine.activeStates, options.currentStates) && this.stateEngine.applyStates(options.currentStates);
|
|
5194
|
-
const exclusiveGroups = null !== (_a = options.exclusiveGroups) && void 0 !== _a ? _a : {};
|
|
5195
|
-
for (const groupName in exclusiveGroups) Object.prototype.hasOwnProperty.call(exclusiveGroups, groupName) && this.registerExclusiveGroup(groupName, exclusiveGroups[groupName]);
|
|
5196
|
-
}
|
|
5197
|
-
getCurrentStates() {
|
|
5198
|
-
return this.currentStates ? [...this.currentStates] : [];
|
|
5199
|
-
}
|
|
5200
|
-
hasState(stateName) {
|
|
5201
|
-
return this.stateEngine ? this.stateEngine.hasState(stateName) : !(!this.currentStates || !this.currentStates.length) && (null == stateName || this.currentStates.includes(stateName));
|
|
5202
|
-
}
|
|
5203
|
-
getState(stateName) {
|
|
5204
|
-
var _a;
|
|
5205
|
-
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
5206
|
-
}
|
|
5207
|
-
useStates(states) {
|
|
5208
|
-
var _a;
|
|
5209
|
-
if (this.stateEngine) {
|
|
5210
|
-
const result = this.stateEngine.applyStates(states);
|
|
5211
|
-
return this.currentStates = [...result.activeStates], {
|
|
5212
|
-
changed: result.changed,
|
|
5213
|
-
states: [...result.activeStates],
|
|
5214
|
-
effectiveStates: [...result.effectiveStates]
|
|
5215
|
-
};
|
|
5216
|
-
}
|
|
5217
|
-
if (!states.length) return this.clearStates();
|
|
5218
|
-
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : [],
|
|
5219
|
-
changed = previousStates.length !== states.length || states.some((stateName, index) => previousStates[index] !== stateName),
|
|
5220
|
-
nextStates = this.sortStates(states);
|
|
5221
|
-
return changed && (this.currentStates = nextStates), {
|
|
5222
|
-
changed: changed,
|
|
5223
|
-
states: changed ? [...nextStates] : [...previousStates]
|
|
5224
|
-
};
|
|
5225
|
-
}
|
|
5226
|
-
clearStates() {
|
|
5227
|
-
if (this.stateEngine) {
|
|
5228
|
-
const result = this.stateEngine.clearStates();
|
|
5229
|
-
return this.currentStates = [], {
|
|
5230
|
-
changed: result.changed,
|
|
5231
|
-
states: [],
|
|
5232
|
-
effectiveStates: []
|
|
5233
|
-
};
|
|
5234
|
-
}
|
|
5235
|
-
const changed = this.hasState();
|
|
5236
|
-
return this.currentStates = [], {
|
|
5237
|
-
changed: changed,
|
|
5238
|
-
states: []
|
|
5239
|
-
};
|
|
5240
|
-
}
|
|
5241
|
-
addState(stateName, keepCurrentStates) {
|
|
5242
|
-
var _a;
|
|
5243
|
-
if (this.stateEngine) {
|
|
5244
|
-
const result = this.stateEngine.addState(stateName, keepCurrentStates);
|
|
5245
|
-
return this.currentStates = [...result.activeStates], {
|
|
5246
|
-
changed: result.changed,
|
|
5247
|
-
states: [...result.activeStates],
|
|
5248
|
-
effectiveStates: [...result.effectiveStates]
|
|
5249
|
-
};
|
|
5250
|
-
}
|
|
5251
|
-
if (this.currentStates && this.currentStates.includes(stateName) && (keepCurrentStates || 1 === this.currentStates.length)) return {
|
|
5252
|
-
changed: !1,
|
|
5253
|
-
states: this.getCurrentStates()
|
|
5254
|
-
};
|
|
5255
|
-
const nextStates = keepCurrentStates && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) ? this.currentStates.concat([stateName]) : [stateName];
|
|
5256
|
-
return this.useStates(nextStates);
|
|
5257
|
-
}
|
|
5258
|
-
removeState(stateName) {
|
|
5259
|
-
if (this.stateEngine) {
|
|
5260
|
-
const result = this.stateEngine.removeState(stateName);
|
|
5261
|
-
return this.currentStates = [...result.activeStates], {
|
|
5262
|
-
changed: result.changed,
|
|
5263
|
-
states: [...result.activeStates],
|
|
5264
|
-
effectiveStates: [...result.effectiveStates]
|
|
5265
|
-
};
|
|
5266
|
-
}
|
|
5267
|
-
if (!this.currentStates) return {
|
|
5268
|
-
changed: !1,
|
|
5269
|
-
states: []
|
|
5270
|
-
};
|
|
5271
|
-
const filter = Array.isArray(stateName) ? s => !stateName.includes(s) : s => s !== stateName,
|
|
5272
|
-
nextStates = this.currentStates.filter(filter);
|
|
5273
|
-
return nextStates.length === this.currentStates.length ? {
|
|
5274
|
-
changed: !1,
|
|
5275
|
-
states: this.getCurrentStates()
|
|
5276
|
-
} : this.useStates(nextStates);
|
|
5277
|
-
}
|
|
5278
|
-
toggleState(stateName) {
|
|
5279
|
-
if (this.stateEngine) {
|
|
5280
|
-
const result = this.stateEngine.toggleState(stateName);
|
|
5281
|
-
return this.currentStates = [...result.activeStates], {
|
|
5282
|
-
changed: result.changed,
|
|
5283
|
-
states: [...result.activeStates],
|
|
5284
|
-
effectiveStates: [...result.effectiveStates]
|
|
5285
|
-
};
|
|
5286
|
-
}
|
|
5287
|
-
if (this.hasState(stateName)) return this.removeState(stateName);
|
|
5288
|
-
const nextStates = this.currentStates ? this.currentStates.slice() : [];
|
|
5289
|
-
return nextStates.includes(stateName) || nextStates.push(stateName), this.useStates(nextStates);
|
|
5290
|
-
}
|
|
5291
|
-
sortStates(states) {
|
|
5292
|
-
return this.stateEngine ? [...this.stateEngine.activeStates] : this.stateSort ? [...states].sort(this.stateSort) : [...states];
|
|
5293
|
-
}
|
|
5294
|
-
registerExclusiveGroup(groupName, states) {
|
|
5295
|
-
const uniqueStates = Array.from(new Set(states));
|
|
5296
|
-
this.exclusiveGroups.set(groupName, uniqueStates), uniqueStates.forEach(stateName => this.exclusiveGroupMap.set(stateName, groupName));
|
|
5297
|
-
}
|
|
5298
|
-
getExclusiveGroup(stateName) {
|
|
5299
|
-
return this.exclusiveGroupMap.get(stateName);
|
|
5300
|
-
}
|
|
5301
|
-
getMutuallyExclusiveStates(stateName) {
|
|
5302
|
-
var _a;
|
|
5303
|
-
const groupName = this.getExclusiveGroup(stateName);
|
|
5304
|
-
return groupName ? (null !== (_a = this.exclusiveGroups.get(groupName)) && void 0 !== _a ? _a : []).filter(name => name !== stateName) : [];
|
|
5305
|
-
}
|
|
5306
|
-
isMutuallyExclusive(stateA, stateB) {
|
|
5307
|
-
const groupName = this.getExclusiveGroup(stateA);
|
|
5308
|
-
return !!groupName && groupName === this.getExclusiveGroup(stateB) && stateA !== stateB;
|
|
5309
|
-
}
|
|
5310
|
-
get effectiveStates() {
|
|
5311
|
-
var _a, _b, _c;
|
|
5312
|
-
return null !== (_c = null !== (_b = null === (_a = this.stateEngine) || void 0 === _a ? void 0 : _a.effectiveStates) && void 0 !== _b ? _b : this.currentStates) && void 0 !== _c ? _c : [];
|
|
5313
|
-
}
|
|
5314
|
-
get resolvedPatch() {
|
|
5315
|
-
var _a;
|
|
5316
|
-
return null === (_a = this.stateEngine) || void 0 === _a ? void 0 : _a.resolvedPatch;
|
|
5317
|
-
}
|
|
5318
|
-
sameStates(left, right) {
|
|
5319
|
-
if (left.length !== right.length) return !1;
|
|
5320
|
-
for (let index = 0; index < left.length; index++) if (left[index] !== right[index]) return !1;
|
|
5321
|
-
return !0;
|
|
5322
|
-
}
|
|
5323
|
-
}
|
|
5324
|
-
|
|
5325
|
-
function isPlainObject(value) {
|
|
5326
|
-
return null != value && "object" == typeof value && !Array.isArray(value);
|
|
5327
|
-
}
|
|
5328
|
-
function cloneValue(value) {
|
|
5329
|
-
if (!isPlainObject(value)) return value;
|
|
5330
|
-
const clone = {};
|
|
5331
|
-
for (const key in value) Object.prototype.hasOwnProperty.call(value, key) && (clone[key] = cloneValue(value[key]));
|
|
5332
|
-
return clone;
|
|
5333
|
-
}
|
|
5334
|
-
function deepMerge(base, value) {
|
|
5335
|
-
const result = cloneValue(base) || {};
|
|
5336
|
-
for (const key in value) {
|
|
5337
|
-
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
5338
|
-
const nextValue = value[key],
|
|
5339
|
-
previousValue = result[key];
|
|
5340
|
-
isPlainObject(previousValue) && isPlainObject(nextValue) ? result[key] = deepMerge(previousValue, nextValue) : result[key] = cloneValue(nextValue);
|
|
5341
|
-
}
|
|
5342
|
-
return result;
|
|
5343
|
-
}
|
|
5344
|
-
class StateStyleResolver {
|
|
5345
|
-
constructor(options = {}) {
|
|
5346
|
-
this.options = options;
|
|
5347
|
-
}
|
|
5348
|
-
resolve(normalAttrs, states, stateProxy, currentStates, stateSort) {
|
|
5349
|
-
var _a;
|
|
5350
|
-
const mergeMode = null !== (_a = this.options.mergeMode) && void 0 !== _a ? _a : "shallow",
|
|
5351
|
-
sortedStates = stateSort ? currentStates.slice().sort(stateSort) : currentStates.slice(),
|
|
5352
|
-
resolvedAttrs = {};
|
|
5353
|
-
return sortedStates.forEach(stateName => {
|
|
5354
|
-
const attrs = stateProxy ? stateProxy(stateName, sortedStates) : null == states ? void 0 : states[stateName];
|
|
5355
|
-
if (null != attrs) for (const key in attrs) {
|
|
5356
|
-
if (!Object.prototype.hasOwnProperty.call(attrs, key)) continue;
|
|
5357
|
-
const nextValue = attrs[key];
|
|
5358
|
-
if ("deep" === mergeMode && isPlainObject(nextValue) && (isPlainObject(resolvedAttrs[key]) || isPlainObject(normalAttrs[key]))) {
|
|
5359
|
-
const baseValue = isPlainObject(resolvedAttrs[key]) ? resolvedAttrs[key] : isPlainObject(normalAttrs[key]) ? normalAttrs[key] : {};
|
|
5360
|
-
resolvedAttrs[key] = deepMerge(baseValue, nextValue);
|
|
5361
|
-
} else resolvedAttrs[key] = cloneValue(nextValue);
|
|
5362
|
-
}
|
|
5363
|
-
}), resolvedAttrs;
|
|
5364
|
-
}
|
|
5365
|
-
}
|
|
5366
|
-
|
|
5367
4608
|
function hasOwnKeys(value) {
|
|
5368
4609
|
return Object.keys(value).length > 0;
|
|
5369
4610
|
}
|
|
@@ -5371,25 +4612,22 @@ function normalizeNoAnimateAttrConfig(config) {
|
|
|
5371
4612
|
return config ? Array.isArray(config) ? config.reduce((acc, key) => (acc[key] = 1, acc), {}) : Object.keys(config).reduce((acc, key) => (config[key] && (acc[key] = 1), acc), {}) : {};
|
|
5372
4613
|
}
|
|
5373
4614
|
class StateTransitionOrchestrator {
|
|
5374
|
-
analyzeTransition(
|
|
4615
|
+
analyzeTransition(targetAttrs, hasAnimation, options = {}) {
|
|
5375
4616
|
var _a, _b;
|
|
5376
4617
|
const plan = {
|
|
5377
|
-
stateNames: stateNames,
|
|
5378
4618
|
targetAttrs: Object.assign({}, targetAttrs),
|
|
5379
4619
|
animateAttrs: {},
|
|
5380
|
-
jumpAttrs: {},
|
|
5381
4620
|
noAnimateAttrs: {}
|
|
5382
4621
|
};
|
|
5383
4622
|
if (!hasAnimation) return plan;
|
|
5384
4623
|
const noWorkAnimateAttr = Object.assign(Object.assign({}, null !== (_a = options.noWorkAnimateAttr) && void 0 !== _a ? _a : {}), normalizeNoAnimateAttrConfig(null === (_b = options.animateConfig) || void 0 === _b ? void 0 : _b.noAnimateAttrs)),
|
|
5385
4624
|
isClear = !0 === options.isClear,
|
|
5386
|
-
|
|
4625
|
+
readDefaultAttribute = options.getDefaultAttribute,
|
|
5387
4626
|
shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
|
|
5388
4627
|
assignTransitionAttr = (key, value) => {
|
|
5389
|
-
if (noWorkAnimateAttr[key])
|
|
5390
|
-
if (isClear && void 0 === value) {
|
|
4628
|
+
if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isClear && void 0 === value) {
|
|
5391
4629
|
if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
|
|
5392
|
-
plan.animateAttrs[key] =
|
|
4630
|
+
plan.animateAttrs[key] = readDefaultAttribute(key);
|
|
5393
4631
|
} else plan.animateAttrs[key] = value;
|
|
5394
4632
|
};
|
|
5395
4633
|
for (const key in targetAttrs) {
|
|
@@ -5425,13 +4663,13 @@ class StateTransitionOrchestrator {
|
|
|
5425
4663
|
type: AttributeUpdateType.STATE
|
|
5426
4664
|
}), plan;
|
|
5427
4665
|
}
|
|
5428
|
-
applyClearTransition(graphic, targetAttrs, hasAnimation,
|
|
5429
|
-
var _a
|
|
5430
|
-
const plan = this.analyzeTransition(
|
|
5431
|
-
noWorkAnimateAttr:
|
|
4666
|
+
applyClearTransition(graphic, targetAttrs, hasAnimation, options = {}) {
|
|
4667
|
+
var _a;
|
|
4668
|
+
const plan = this.analyzeTransition(targetAttrs, hasAnimation, {
|
|
4669
|
+
noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
|
|
5432
4670
|
isClear: !0,
|
|
5433
|
-
getDefaultAttribute:
|
|
5434
|
-
shouldSkipDefaultAttribute: null !== (
|
|
4671
|
+
getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
|
|
4672
|
+
shouldSkipDefaultAttribute: null !== (_a = options.shouldSkipDefaultAttribute) && void 0 !== _a ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
|
|
5435
4673
|
animateConfig: options.animateConfig,
|
|
5436
4674
|
extraAnimateAttrs: options.extraAnimateAttrs
|
|
5437
4675
|
});
|
|
@@ -5440,24 +4678,11 @@ class StateTransitionOrchestrator {
|
|
|
5440
4678
|
}
|
|
5441
4679
|
|
|
5442
4680
|
const compiler = new StateDefinitionCompiler();
|
|
5443
|
-
function copyDefinitions(definitions) {
|
|
5444
|
-
return definitions ? Object.assign({}, definitions) : {};
|
|
5445
|
-
}
|
|
5446
4681
|
function buildEffectiveSourceDefinitions(parentScope, localStateDefinitions, themeStateDefinitions) {
|
|
5447
|
-
|
|
5448
|
-
return localStateDefinitions && Object.keys(localStateDefinitions).forEach(stateName => {
|
|
5449
|
-
merged[stateName] = localStateDefinitions[stateName];
|
|
5450
|
-
}), merged;
|
|
5451
|
-
}
|
|
5452
|
-
function initializeScope(scope, revision = 0) {
|
|
5453
|
-
var _a;
|
|
5454
|
-
const effectiveSourceDefinitions = buildEffectiveSourceDefinitions(scope.parentScope, scope.localStateDefinitions, scope.themeStateDefinitions);
|
|
5455
|
-
return scope.effectiveSourceDefinitions = effectiveSourceDefinitions, scope.effectiveCompiledDefinitions = compiler.compile(effectiveSourceDefinitions), scope.parentRevisionAtBuild = null === (_a = scope.parentScope) || void 0 === _a ? void 0 : _a.revision, scope.revision = revision, scope.dirty = !1, scope;
|
|
4682
|
+
return Object.assign({}, parentScope ? parentScope.effectiveSourceDefinitions : themeStateDefinitions, localStateDefinitions);
|
|
5456
4683
|
}
|
|
5457
4684
|
function createGroupSharedStateScope(group, parentScope, localStateDefinitions) {
|
|
5458
|
-
return
|
|
5459
|
-
ownerKind: "group",
|
|
5460
|
-
ownerGroup: group,
|
|
4685
|
+
return rebuildSharedStateScope({
|
|
5461
4686
|
ownerStage: group.stage,
|
|
5462
4687
|
parentScope: parentScope,
|
|
5463
4688
|
localStateDefinitions: localStateDefinitions,
|
|
@@ -5474,14 +4699,13 @@ function setSharedStateScopeParent(scope, parentScope) {
|
|
|
5474
4699
|
function setSharedStateScopeLocalDefinitions(scope, localStateDefinitions) {
|
|
5475
4700
|
return scope.localStateDefinitions !== localStateDefinitions && (scope.localStateDefinitions = localStateDefinitions, rebuildSharedStateScope(scope), !0);
|
|
5476
4701
|
}
|
|
5477
|
-
function rebuildSharedStateScope(scope) {
|
|
4702
|
+
function rebuildSharedStateScope(scope, revision = scope.revision + 1) {
|
|
5478
4703
|
var _a;
|
|
5479
4704
|
const effectiveSourceDefinitions = buildEffectiveSourceDefinitions(scope.parentScope, scope.localStateDefinitions, scope.themeStateDefinitions);
|
|
5480
|
-
return scope.effectiveSourceDefinitions = effectiveSourceDefinitions, scope.effectiveCompiledDefinitions = compiler.compile(effectiveSourceDefinitions), scope.parentRevisionAtBuild = null === (_a = scope.parentScope) || void 0 === _a ? void 0 : _a.revision, scope.revision
|
|
4705
|
+
return scope.effectiveSourceDefinitions = effectiveSourceDefinitions, scope.effectiveCompiledDefinitions = compiler.compile(effectiveSourceDefinitions), scope.parentRevisionAtBuild = null === (_a = scope.parentScope) || void 0 === _a ? void 0 : _a.revision, scope.revision = revision, scope.dirty = !1, scope;
|
|
5481
4706
|
}
|
|
5482
4707
|
function ensureSharedStateScopeFresh(scope) {
|
|
5483
|
-
|
|
5484
|
-
if (scope) return null === (_a = getActiveStageStatePerfMonitor(scope.ownerStage)) || void 0 === _a || _a.recordRefresh("ensureFreshCalls"), scope.parentScope && ensureSharedStateScopeFresh(scope.parentScope), (scope.dirty || scope.parentScope && scope.parentRevisionAtBuild !== scope.parentScope.revision) && rebuildSharedStateScope(scope), scope;
|
|
4708
|
+
if (scope) return scope.parentScope && ensureSharedStateScopeFresh(scope.parentScope), (scope.dirty || scope.parentScope && scope.parentRevisionAtBuild !== scope.parentScope.revision) && rebuildSharedStateScope(scope), scope;
|
|
5485
4709
|
}
|
|
5486
4710
|
function collectSharedStateScopeChain(scope) {
|
|
5487
4711
|
const chain = [];
|
|
@@ -5491,26 +4715,19 @@ function collectSharedStateScopeChain(scope) {
|
|
|
5491
4715
|
}
|
|
5492
4716
|
|
|
5493
4717
|
function scheduleStageSharedStateRefresh(stage) {
|
|
5494
|
-
|
|
5495
|
-
stage && "released" !== stage.releaseStatus && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
|
|
4718
|
+
stage && "released" !== stage.releaseStatus && stage.renderNextFrame();
|
|
5496
4719
|
}
|
|
5497
4720
|
function enqueueGraphicSharedStateRefresh(stage, graphic) {
|
|
5498
4721
|
var _a;
|
|
5499
4722
|
if (!stage) return;
|
|
5500
|
-
|
|
5501
|
-
if (!pending.has(graphic)) {
|
|
5502
|
-
pending.add(graphic);
|
|
5503
|
-
const perfMonitor = getActiveStageStatePerfMonitor(stage);
|
|
5504
|
-
null == perfMonitor || perfMonitor.recordRefresh("queuedGraphics"), null == perfMonitor || perfMonitor.recordAllocation("refreshQueuePushes");
|
|
5505
|
-
}
|
|
4723
|
+
(null !== (_a = stage._pendingSharedStateRefreshGraphics) && void 0 !== _a ? _a : stage._pendingSharedStateRefreshGraphics = new Set()).add(graphic);
|
|
5506
4724
|
}
|
|
5507
4725
|
function markScopeActiveDescendantsDirty(scope, stage) {
|
|
5508
|
-
|
|
5509
|
-
scope.subtreeActiveDescendants.forEach(graphic => {
|
|
4726
|
+
scope.subtreeActiveDescendants.size && (scope.subtreeActiveDescendants.forEach(graphic => {
|
|
5510
4727
|
var _a;
|
|
5511
4728
|
graphic.sharedStateDirty = !0;
|
|
5512
|
-
enqueueGraphicSharedStateRefresh(null !== (_a = null != stage ? stage : graphic.stage) && void 0 !== _a ? _a : scope.ownerStage, graphic)
|
|
5513
|
-
}),
|
|
4729
|
+
enqueueGraphicSharedStateRefresh(null !== (_a = null != stage ? stage : graphic.stage) && void 0 !== _a ? _a : scope.ownerStage, graphic);
|
|
4730
|
+
}), scheduleStageSharedStateRefresh(null != stage ? stage : scope.ownerStage));
|
|
5514
4731
|
}
|
|
5515
4732
|
|
|
5516
4733
|
const _tempBounds = new AABBBounds(),
|
|
@@ -5520,10 +4737,8 @@ const tempConstantXYKey = ["x", "y"],
|
|
|
5520
4737
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
5521
4738
|
tempConstantAngleKey = ["angle"],
|
|
5522
4739
|
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
5523
|
-
FULL_STATE_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]),
|
|
5524
4740
|
point = new Point(),
|
|
5525
4741
|
EMPTY_STATE_NAMES = [],
|
|
5526
|
-
deprecatedLocalStateFallbackWarningStateNames = new Set(),
|
|
5527
4742
|
BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
|
|
5528
4743
|
function isPlainObjectValue(value) {
|
|
5529
4744
|
return "object" == typeof value && null != value && !Array.isArray(value);
|
|
@@ -5637,11 +4852,6 @@ class Graphic extends Node {
|
|
|
5637
4852
|
getAttributes() {
|
|
5638
4853
|
return this.attribute;
|
|
5639
4854
|
}
|
|
5640
|
-
getStateStyleResolver(mergeMode) {
|
|
5641
|
-
return "deep" === mergeMode ? (this.deepStateStyleResolver || (this.deepStateStyleResolver = new StateStyleResolver({
|
|
5642
|
-
mergeMode: "deep"
|
|
5643
|
-
})), this.deepStateStyleResolver) : (this.stateStyleResolver || (this.stateStyleResolver = new StateStyleResolver()), this.stateStyleResolver);
|
|
5644
|
-
}
|
|
5645
4855
|
getStateTransitionOrchestrator() {
|
|
5646
4856
|
return this.stateTransitionOrchestrator || (this.stateTransitionOrchestrator = new StateTransitionOrchestrator()), this.stateTransitionOrchestrator;
|
|
5647
4857
|
}
|
|
@@ -5657,7 +4867,7 @@ class Graphic extends Node {
|
|
|
5657
4867
|
syncSharedStateScopeBindingFromTree(markDirty = !0) {
|
|
5658
4868
|
var _a;
|
|
5659
4869
|
const nextScope = this.resolveBoundSharedStateScope();
|
|
5660
|
-
return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(), !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0, this.
|
|
4870
|
+
return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(), !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0, this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.syncSharedStateActiveRegistrations(), markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(), !0);
|
|
5661
4871
|
}
|
|
5662
4872
|
syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
|
|
5663
4873
|
var _a, _b;
|
|
@@ -5696,13 +4906,7 @@ class Graphic extends Node {
|
|
|
5696
4906
|
}
|
|
5697
4907
|
getLocalStatesVersion() {
|
|
5698
4908
|
var _a, _b;
|
|
5699
|
-
return this.localStateDefinitionsSource !== this.states && (this.localStateDefinitionsSource = this.states, this.
|
|
5700
|
-
}
|
|
5701
|
-
warnDeprecatedLocalStatesFallback(stateNames) {
|
|
5702
|
-
for (let index = 0; index < stateNames.length; index++) {
|
|
5703
|
-
const stateName = stateNames[index];
|
|
5704
|
-
deprecatedLocalStateFallbackWarningStateNames.has(stateName) || (deprecatedLocalStateFallbackWarningStateNames.add(stateName), console.warn(`[VRender] graphic.states fallback for missing shared state definition "${stateName}" is deprecated. Move the state definition to sharedStateDefinitions or use stateProxy for dynamic per-graphic styles.`));
|
|
5705
|
-
}
|
|
4909
|
+
return this.localStateDefinitionsSource !== this.states && (this.localStateDefinitionsSource = this.states, this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1), null !== (_b = this.localStateDefinitionsVersion) && void 0 !== _b ? _b : 0;
|
|
5706
4910
|
}
|
|
5707
4911
|
resolveEffectiveCompiledDefinitions() {
|
|
5708
4912
|
this.syncSharedStateScopeBindingFromTree(!1);
|
|
@@ -5711,50 +4915,24 @@ class Graphic extends Node {
|
|
|
5711
4915
|
const hasStates = !!this.states && Object.keys(this.states).length > 0;
|
|
5712
4916
|
if (!boundScope) {
|
|
5713
4917
|
if (!hasStates) return {
|
|
5714
|
-
compiledDefinitions: void 0
|
|
5715
|
-
stateProxyModeKey: "none"
|
|
4918
|
+
compiledDefinitions: void 0
|
|
5716
4919
|
};
|
|
5717
4920
|
const cacheKey = `local:${this.getLocalStatesVersion()}`;
|
|
5718
4921
|
return this.compiledStateDefinitions && this.compiledStateDefinitionsCacheKey === cacheKey || (this.compiledStateDefinitions = new StateDefinitionCompiler().compile(this.states), this.compiledStateDefinitionsCacheKey = cacheKey), {
|
|
5719
|
-
compiledDefinitions: this.compiledStateDefinitions
|
|
5720
|
-
stateProxyModeKey: this.stateProxy ? "legacy-all" : "none"
|
|
4922
|
+
compiledDefinitions: this.compiledStateDefinitions
|
|
5721
4923
|
};
|
|
5722
4924
|
}
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
sharedStateProxyEligibility = this.stateProxy ? stateName => !sharedCompiledDefinitions.has(stateName) : void 0;
|
|
5726
|
-
if (!hasStates) return this.localFallbackCompiledDefinitions = void 0, {
|
|
5727
|
-
compiledDefinitions: sharedCompiledDefinitions,
|
|
5728
|
-
stateProxyModeKey: sharedStateProxyModeKey,
|
|
5729
|
-
stateProxyEligibility: sharedStateProxyEligibility
|
|
5730
|
-
};
|
|
5731
|
-
const localStates = this.states,
|
|
5732
|
-
missingLocalStateDefinitions = {},
|
|
5733
|
-
missingStateNames = [];
|
|
5734
|
-
if (Object.keys(localStates).forEach(stateName => {
|
|
5735
|
-
sharedCompiledDefinitions.has(stateName) || (missingLocalStateDefinitions[stateName] = localStates[stateName], missingStateNames.push(stateName));
|
|
5736
|
-
}), !missingStateNames.length) return this.localFallbackCompiledDefinitions = void 0, {
|
|
5737
|
-
compiledDefinitions: sharedCompiledDefinitions,
|
|
5738
|
-
stateProxyModeKey: sharedStateProxyModeKey,
|
|
5739
|
-
stateProxyEligibility: sharedStateProxyEligibility
|
|
5740
|
-
};
|
|
5741
|
-
this.warnDeprecatedLocalStatesFallback(missingStateNames);
|
|
5742
|
-
const localStatesVersion = this.getLocalStatesVersion(),
|
|
5743
|
-
stateProxyModeKey = this.stateProxy ? `missing:${missingStateNames.sort().join("|")}` : "none",
|
|
5744
|
-
cacheKey = `shared:${boundScope.revision}:fallback:${localStatesVersion}:${stateProxyModeKey}`;
|
|
5745
|
-
return this.localFallbackCompiledDefinitions && this.compiledStateDefinitionsCacheKey === cacheKey || (this.localFallbackCompiledDefinitions = new StateDefinitionCompiler().compile(Object.assign(Object.assign({}, boundScope.effectiveSourceDefinitions), missingLocalStateDefinitions)), this.compiledStateDefinitionsCacheKey = cacheKey), {
|
|
5746
|
-
compiledDefinitions: this.localFallbackCompiledDefinitions,
|
|
5747
|
-
stateProxyModeKey: stateProxyModeKey,
|
|
5748
|
-
stateProxyEligibility: sharedStateProxyEligibility
|
|
4925
|
+
return {
|
|
4926
|
+
compiledDefinitions: boundScope.effectiveCompiledDefinitions
|
|
5749
4927
|
};
|
|
5750
4928
|
}
|
|
5751
4929
|
recomputeCurrentStatePatch() {
|
|
5752
4930
|
var _a, _b;
|
|
5753
4931
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)) return this.effectiveStates = [], this.resolvedStatePatch = void 0, void this.syncSharedStateActiveRegistrations();
|
|
5754
4932
|
const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(),
|
|
5755
|
-
transition = this.
|
|
4933
|
+
transition = this.resolveUseStatesTransition(this.currentStates, stateResolveBaseAttrs),
|
|
5756
4934
|
effectiveStates = null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states,
|
|
5757
|
-
resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) :
|
|
4935
|
+
resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
|
|
5758
4936
|
this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
|
|
5759
4937
|
}
|
|
5760
4938
|
buildStaticAttributeSnapshot() {
|
|
@@ -5818,12 +4996,7 @@ class Graphic extends Node {
|
|
|
5818
4996
|
return nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category | nextCategory;
|
|
5819
4997
|
}
|
|
5820
4998
|
submitUpdateByCategory(category, forceUpdateTag = !1) {
|
|
5821
|
-
var _a;
|
|
5822
4999
|
if (forceUpdateTag) return this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), void this.addUpdateLayoutTag();
|
|
5823
|
-
if (category !== UpdateCategory.NONE) {
|
|
5824
|
-
const stage = this.stage;
|
|
5825
|
-
stage && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordCategory(category));
|
|
5826
|
-
}
|
|
5827
5000
|
(category & BROAD_UPDATE_CATEGORY) !== BROAD_UPDATE_CATEGORY ? (category & UpdateCategory.SHAPE ? this.addUpdateShapeAndBoundsTag() : category & UpdateCategory.BOUNDS && this.addUpdateBoundTag(), category & UpdateCategory.PAINT && this.addUpdatePaintTag(), category & UpdateCategory.TRANSFORM && this.addUpdatePositionTag(), category & UpdateCategory.LAYOUT && this.addUpdateLayoutTag()) : this.addBroadUpdateTag();
|
|
5828
5001
|
}
|
|
5829
5002
|
submitUpdateByDelta(delta, forceUpdateTag = !1) {
|
|
@@ -6362,103 +5535,94 @@ class Graphic extends Node {
|
|
|
6362
5535
|
var _a;
|
|
6363
5536
|
return null === (_a = this.stateEngine) || void 0 === _a || _a.setResolveContext(this, stateResolveBaseAttrs), stateResolveBaseAttrs;
|
|
6364
5537
|
}
|
|
6365
|
-
|
|
5538
|
+
ensureStateEngine(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
|
|
6366
5539
|
const {
|
|
6367
|
-
compiledDefinitions: compiledDefinitions
|
|
6368
|
-
stateProxyEligibility: stateProxyEligibility,
|
|
6369
|
-
stateProxyModeKey: stateProxyModeKey
|
|
5540
|
+
compiledDefinitions: compiledDefinitions
|
|
6370
5541
|
} = this.resolveEffectiveCompiledDefinitions();
|
|
6371
|
-
return this.compiledStateDefinitions = compiledDefinitions, compiledDefinitions ? this.stateEngine && this.stateEngineCompiledDefinitions === compiledDefinitions && this.
|
|
5542
|
+
return this.compiledStateDefinitions = compiledDefinitions, compiledDefinitions ? this.stateEngine && this.stateEngineCompiledDefinitions === compiledDefinitions && this.stateEngineStateSort === this.stateSort && this.stateEngineMergeMode === this.stateMergeMode || (this.stateEngine = new StateEngine({
|
|
6372
5543
|
compiledDefinitions: compiledDefinitions,
|
|
6373
5544
|
stateSort: this.stateSort,
|
|
6374
|
-
stateProxy: this.stateProxy,
|
|
6375
|
-
stateProxyEligibility: stateProxyEligibility,
|
|
6376
|
-
states: this.states,
|
|
6377
5545
|
mergeMode: this.stateMergeMode
|
|
6378
|
-
}), this.stateEngineCompiledDefinitions = compiledDefinitions, this.
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
5546
|
+
}), this.stateEngineCompiledDefinitions = compiledDefinitions, this.stateEngineStateSort = this.stateSort, this.stateEngineMergeMode = this.stateMergeMode) : (this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0), this.syncStateResolveContext(stateResolveBaseAttrs), this.stateEngine && this.currentStates && !this.sameStateNames(this.stateEngine.activeStates, this.currentStates) && this.stateEngine.applyStates(this.currentStates), this.stateEngine;
|
|
5547
|
+
}
|
|
5548
|
+
toGraphicStateTransition(result) {
|
|
5549
|
+
return {
|
|
5550
|
+
changed: result.changed,
|
|
5551
|
+
states: [...result.activeStates],
|
|
5552
|
+
effectiveStates: [...result.effectiveStates]
|
|
5553
|
+
};
|
|
5554
|
+
}
|
|
5555
|
+
sortLocalStates(states) {
|
|
5556
|
+
return this.stateSort ? [...states].sort(this.stateSort) : [...states];
|
|
6385
5557
|
}
|
|
6386
|
-
|
|
5558
|
+
resolveLocalUseStatesTransition(states) {
|
|
6387
5559
|
var _a;
|
|
6388
|
-
if (!
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
nextStates = [stateName],
|
|
6393
|
-
changed = !this.sameStateNames(previousStates, nextStates),
|
|
6394
|
-
resolvedStateAttrs = {};
|
|
6395
|
-
if (hasDefinition) {
|
|
6396
|
-
const attrs = this.states[stateName];
|
|
6397
|
-
if (null != attrs) {
|
|
6398
|
-
if (!isPlainObjectValue(attrs)) return null;
|
|
6399
|
-
const keys = Object.keys(attrs);
|
|
6400
|
-
for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
|
|
6401
|
-
const key = keys[keyIndex];
|
|
6402
|
-
if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
|
|
6403
|
-
const attrValue = attrs[key];
|
|
6404
|
-
resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
|
|
6405
|
-
}
|
|
6406
|
-
}
|
|
6407
|
-
}
|
|
6408
|
-
return {
|
|
6409
|
-
changed: changed,
|
|
6410
|
-
states: nextStates,
|
|
6411
|
-
effectiveStates: nextStates,
|
|
6412
|
-
resolvedStateAttrs: resolvedStateAttrs
|
|
6413
|
-
};
|
|
6414
|
-
}
|
|
6415
|
-
const uniqueStates = Array.from(new Set(states)),
|
|
6416
|
-
withDefinition = [],
|
|
6417
|
-
withoutDefinition = [];
|
|
6418
|
-
for (let i = 0; i < uniqueStates.length; i++) {
|
|
6419
|
-
const stateName = uniqueStates[i];
|
|
6420
|
-
Object.prototype.hasOwnProperty.call(this.states, stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
|
|
6421
|
-
}
|
|
6422
|
-
withDefinition.sort((left, right) => left.localeCompare(right));
|
|
6423
|
-
const nextStates = withDefinition.concat(withoutDefinition),
|
|
6424
|
-
changed = !this.sameStateNames(previousStates, nextStates),
|
|
6425
|
-
resolvedStateAttrs = {};
|
|
6426
|
-
for (let i = 0; i < nextStates.length; i++) {
|
|
6427
|
-
const stateName = nextStates[i];
|
|
6428
|
-
if (!Object.prototype.hasOwnProperty.call(this.states, stateName)) continue;
|
|
6429
|
-
const attrs = this.states[stateName];
|
|
6430
|
-
if (null == attrs) continue;
|
|
6431
|
-
if (!isPlainObjectValue(attrs)) return null;
|
|
6432
|
-
const keys = Object.keys(attrs);
|
|
6433
|
-
for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
|
|
6434
|
-
const key = keys[keyIndex];
|
|
6435
|
-
if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
|
|
6436
|
-
const attrValue = attrs[key];
|
|
6437
|
-
resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
|
|
6438
|
-
}
|
|
6439
|
-
}
|
|
5560
|
+
if (!states.length) return this.resolveLocalClearStatesTransition();
|
|
5561
|
+
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
5562
|
+
changed = previousStates.length !== states.length || states.some((stateName, index) => previousStates[index] !== stateName),
|
|
5563
|
+
nextStates = this.sortLocalStates(states);
|
|
6440
5564
|
return {
|
|
6441
5565
|
changed: changed,
|
|
6442
|
-
states: nextStates
|
|
6443
|
-
effectiveStates: nextStates,
|
|
6444
|
-
resolvedStateAttrs: resolvedStateAttrs
|
|
5566
|
+
states: changed ? nextStates : [...previousStates]
|
|
6445
5567
|
};
|
|
6446
5568
|
}
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
5569
|
+
resolveLocalClearStatesTransition() {
|
|
5570
|
+
return {
|
|
5571
|
+
changed: this.hasState(),
|
|
5572
|
+
states: []
|
|
5573
|
+
};
|
|
5574
|
+
}
|
|
5575
|
+
resolveUseStatesTransition(states, stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
|
|
5576
|
+
const stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
|
|
5577
|
+
return stateEngine ? this.toGraphicStateTransition(stateEngine.applyStates(states)) : this.resolveLocalUseStatesTransition(states);
|
|
5578
|
+
}
|
|
5579
|
+
resolveClearStatesTransition() {
|
|
5580
|
+
const stateEngine = this.ensureStateEngine();
|
|
5581
|
+
return stateEngine ? this.toGraphicStateTransition(stateEngine.clearStates()) : this.resolveLocalClearStatesTransition();
|
|
5582
|
+
}
|
|
5583
|
+
resolveAddStateTransition(stateName, keepCurrentStates) {
|
|
5584
|
+
var _a;
|
|
5585
|
+
const stateEngine = this.ensureStateEngine();
|
|
5586
|
+
if (stateEngine) return this.toGraphicStateTransition(stateEngine.addState(stateName, keepCurrentStates));
|
|
5587
|
+
if (this.currentStates && this.currentStates.includes(stateName) && (keepCurrentStates || 1 === this.currentStates.length)) return {
|
|
5588
|
+
changed: !1,
|
|
5589
|
+
states: [...this.currentStates]
|
|
5590
|
+
};
|
|
5591
|
+
const nextStates = keepCurrentStates && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) ? this.currentStates.concat([stateName]) : [stateName];
|
|
5592
|
+
return this.resolveLocalUseStatesTransition(nextStates);
|
|
5593
|
+
}
|
|
5594
|
+
resolveRemoveStateTransition(stateName) {
|
|
5595
|
+
const stateEngine = this.ensureStateEngine();
|
|
5596
|
+
if (stateEngine) return this.toGraphicStateTransition(stateEngine.removeState(stateName));
|
|
5597
|
+
if (!this.currentStates) return {
|
|
5598
|
+
changed: !1,
|
|
5599
|
+
states: []
|
|
5600
|
+
};
|
|
5601
|
+
const filter = Array.isArray(stateName) ? s => !stateName.includes(s) : s => s !== stateName,
|
|
5602
|
+
nextStates = this.currentStates.filter(filter);
|
|
5603
|
+
return nextStates.length === this.currentStates.length ? {
|
|
5604
|
+
changed: !1,
|
|
5605
|
+
states: [...this.currentStates]
|
|
5606
|
+
} : this.resolveLocalUseStatesTransition(nextStates);
|
|
5607
|
+
}
|
|
5608
|
+
resolveToggleStateTransition(stateName) {
|
|
5609
|
+
const stateEngine = this.ensureStateEngine();
|
|
5610
|
+
if (stateEngine) return this.toGraphicStateTransition(stateEngine.toggleState(stateName));
|
|
5611
|
+
if (this.hasState(stateName)) return this.resolveRemoveStateTransition(stateName);
|
|
5612
|
+
const nextStates = this.currentStates ? this.currentStates.slice() : [];
|
|
5613
|
+
return nextStates.push(stateName), this.resolveLocalUseStatesTransition(nextStates);
|
|
5614
|
+
}
|
|
5615
|
+
resolveGraphicStateTransition(states, forceResolverRefresh = !1) {
|
|
5616
|
+
var _a;
|
|
5617
|
+
const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(),
|
|
5618
|
+
stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
|
|
5619
|
+
forceResolverRefresh && (null == stateEngine || stateEngine.invalidateResolverCache());
|
|
5620
|
+
const transition = stateEngine ? this.toGraphicStateTransition(stateEngine.applyStates(states)) : this.resolveLocalUseStatesTransition(states),
|
|
5621
|
+
resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
|
|
6457
5622
|
return {
|
|
6458
5623
|
transition: transition,
|
|
6459
|
-
effectiveStates: null !== (
|
|
6460
|
-
resolvedStateAttrs: resolvedStateAttrs
|
|
6461
|
-
isSimpleLocalTransition: isSimpleLocalTransition
|
|
5624
|
+
effectiveStates: null !== (_a = transition.effectiveStates) && void 0 !== _a ? _a : transition.states,
|
|
5625
|
+
resolvedStateAttrs: resolvedStateAttrs
|
|
6462
5626
|
};
|
|
6463
5627
|
}
|
|
6464
5628
|
normalizeSetStatesOptions(options) {
|
|
@@ -6489,24 +5653,14 @@ class Graphic extends Node {
|
|
|
6489
5653
|
{
|
|
6490
5654
|
transition: transition,
|
|
6491
5655
|
effectiveStates: effectiveStates,
|
|
6492
|
-
resolvedStateAttrs: resolvedStateAttrs
|
|
6493
|
-
|
|
6494
|
-
} = this.resolveGraphicStateTransition(states, previousStates, !0),
|
|
5656
|
+
resolvedStateAttrs: resolvedStateAttrs
|
|
5657
|
+
} = this.resolveGraphicStateTransition(states, !0),
|
|
6495
5658
|
patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
targetStates: [...transition.states]
|
|
6502
|
-
});
|
|
6503
|
-
}
|
|
6504
|
-
hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6505
|
-
type: AttributeUpdateType.STATE
|
|
6506
|
-
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
6507
|
-
type: AttributeUpdateType.STATE
|
|
6508
|
-
}), this.emitStateUpdateEvent());
|
|
6509
|
-
}
|
|
5659
|
+
patchChanged && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) || (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), patchChanged && (hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
5660
|
+
type: AttributeUpdateType.STATE
|
|
5661
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
5662
|
+
type: AttributeUpdateType.STATE
|
|
5663
|
+
}), this.emitStateUpdateEvent())));
|
|
6510
5664
|
}
|
|
6511
5665
|
resolveStateAnimateConfig(animateConfig) {
|
|
6512
5666
|
var _a, _b, _c;
|
|
@@ -6519,8 +5673,8 @@ class Graphic extends Node {
|
|
|
6519
5673
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
6520
5674
|
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
|
|
6521
5675
|
} : void 0;
|
|
6522
|
-
if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation,
|
|
6523
|
-
const plan = this.getStateTransitionOrchestrator().analyzeTransition(
|
|
5676
|
+
if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
|
|
5677
|
+
const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
|
|
6524
5678
|
noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
|
|
6525
5679
|
animateConfig: resolvedAnimateConfig,
|
|
6526
5680
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
@@ -6544,43 +5698,29 @@ class Graphic extends Node {
|
|
|
6544
5698
|
animate.stateNames && stateAnimates.push(animate);
|
|
6545
5699
|
}), stateAnimates.forEach(animate => animate.stop(type));
|
|
6546
5700
|
}
|
|
6547
|
-
getNormalAttribute(key) {
|
|
6548
|
-
var _a, _b;
|
|
6549
|
-
const value = this.attribute[key];
|
|
6550
|
-
return this.hasAnyTrackedAnimate() ? null === (_a = this.finalAttribute) || void 0 === _a ? void 0 : _a[key] : null != value ? value : null === (_b = this.finalAttribute) || void 0 === _b ? void 0 : _b[key];
|
|
6551
|
-
}
|
|
6552
5701
|
clearStates(hasAnimation) {
|
|
6553
5702
|
var _a, _b, _c;
|
|
6554
5703
|
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
6555
5704
|
previousResolvedStatePatch = this.resolvedStatePatch,
|
|
6556
|
-
transition = this.
|
|
5705
|
+
transition = this.resolveClearStatesTransition();
|
|
6557
5706
|
if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
|
|
6558
5707
|
const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
targetStates: []
|
|
6565
|
-
});
|
|
6566
|
-
}
|
|
6567
|
-
hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6568
|
-
type: AttributeUpdateType.STATE
|
|
6569
|
-
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
6570
|
-
type: AttributeUpdateType.STATE
|
|
6571
|
-
}), this.emitStateUpdateEvent());
|
|
6572
|
-
}
|
|
5708
|
+
transition.changed && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0) || (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
5709
|
+
type: AttributeUpdateType.STATE
|
|
5710
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
5711
|
+
type: AttributeUpdateType.STATE
|
|
5712
|
+
}), this.emitStateUpdateEvent()));
|
|
6573
5713
|
}
|
|
6574
5714
|
removeState(stateName, hasAnimation) {
|
|
6575
|
-
const transition = this.
|
|
5715
|
+
const transition = this.resolveRemoveStateTransition(stateName);
|
|
6576
5716
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
6577
5717
|
}
|
|
6578
5718
|
toggleState(stateName, hasAnimation) {
|
|
6579
|
-
const transition = this.
|
|
5719
|
+
const transition = this.resolveToggleStateTransition(stateName);
|
|
6580
5720
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
6581
5721
|
}
|
|
6582
5722
|
addState(stateName, keepCurrentStates, hasAnimation) {
|
|
6583
|
-
const transition = this.
|
|
5723
|
+
const transition = this.resolveAddStateTransition(stateName, keepCurrentStates);
|
|
6584
5724
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
6585
5725
|
}
|
|
6586
5726
|
setStates(states, options) {
|
|
@@ -6608,23 +5748,13 @@ class Graphic extends Node {
|
|
|
6608
5748
|
{
|
|
6609
5749
|
transition: transition,
|
|
6610
5750
|
effectiveStates: effectiveStates,
|
|
6611
|
-
resolvedStateAttrs: resolvedStateAttrs
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
graphicId: this._uid,
|
|
6619
|
-
targetStates: [...transition.states]
|
|
6620
|
-
});
|
|
6621
|
-
}
|
|
6622
|
-
hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6623
|
-
type: AttributeUpdateType.STATE
|
|
6624
|
-
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
6625
|
-
type: AttributeUpdateType.STATE
|
|
6626
|
-
}), this.emitStateUpdateEvent());
|
|
6627
|
-
}
|
|
5751
|
+
resolvedStateAttrs: resolvedStateAttrs
|
|
5752
|
+
} = this.resolveGraphicStateTransition(states);
|
|
5753
|
+
!transition.changed && this.sameStateNames(previousStates, transition.states) || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) && (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
5754
|
+
type: AttributeUpdateType.STATE
|
|
5755
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
5756
|
+
type: AttributeUpdateType.STATE
|
|
5757
|
+
}), this.emitStateUpdateEvent()));
|
|
6628
5758
|
}
|
|
6629
5759
|
invalidateResolver() {
|
|
6630
5760
|
var _a, _b;
|
|
@@ -6770,7 +5900,7 @@ class Graphic extends Node {
|
|
|
6770
5900
|
}
|
|
6771
5901
|
detachStageForRelease() {
|
|
6772
5902
|
var _a, _b, _c;
|
|
6773
|
-
(null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates(), this.boundSharedStateScope = void 0, this.boundSharedStateRevision = void 0, this.
|
|
5903
|
+
(null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates(), this.boundSharedStateScope = void 0, this.boundSharedStateRevision = void 0, this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.sharedStateDirty = !1, this.stage = null, this.layer = null, this.shadowRoot && (null === (_c = (_b = this.shadowRoot).detachStageForRelease) || void 0 === _c || _c.call(_b));
|
|
6774
5904
|
}
|
|
6775
5905
|
setStageToShadowRoot(stage, layer) {
|
|
6776
5906
|
this.shadowRoot && this.shadowRoot.setStage(stage, layer);
|
|
@@ -7024,6 +6154,730 @@ function getThemeFromGroup(graphic) {
|
|
|
7024
6154
|
return null;
|
|
7025
6155
|
}
|
|
7026
6156
|
|
|
6157
|
+
var GroupUpdateAABBBoundsMode;
|
|
6158
|
+
!function (GroupUpdateAABBBoundsMode) {
|
|
6159
|
+
GroupUpdateAABBBoundsMode[GroupUpdateAABBBoundsMode.LESS_GROUP = 0] = "LESS_GROUP", GroupUpdateAABBBoundsMode[GroupUpdateAABBBoundsMode.MORE_GROUP = 1] = "MORE_GROUP";
|
|
6160
|
+
}(GroupUpdateAABBBoundsMode || (GroupUpdateAABBBoundsMode = {}));
|
|
6161
|
+
class Group extends Graphic {
|
|
6162
|
+
constructor(params) {
|
|
6163
|
+
super(params), this.type = "group", this.parent = null, this.isContainer = !0, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
|
|
6164
|
+
}
|
|
6165
|
+
get sharedStateDefinitions() {
|
|
6166
|
+
return this._sharedStateDefinitions;
|
|
6167
|
+
}
|
|
6168
|
+
set sharedStateDefinitions(value) {
|
|
6169
|
+
if (this._sharedStateDefinitions === value) return;
|
|
6170
|
+
const previousScope = this.sharedStateScope;
|
|
6171
|
+
this._sharedStateDefinitions = value, this.ensureSharedStateScopeBound(), this.sharedStateScope && (setSharedStateScopeLocalDefinitions(this.sharedStateScope, value), markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage)), previousScope !== this.sharedStateScope && this.notifyChildrenSharedStateTreeChanged();
|
|
6172
|
+
}
|
|
6173
|
+
setMode(mode) {
|
|
6174
|
+
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
6175
|
+
}
|
|
6176
|
+
set3dMode() {
|
|
6177
|
+
this.in3dMode = !0;
|
|
6178
|
+
}
|
|
6179
|
+
set2dMode() {
|
|
6180
|
+
this.in3dMode = !1;
|
|
6181
|
+
}
|
|
6182
|
+
setTheme(t) {
|
|
6183
|
+
return this.theme || (this.theme = new Theme()), this.theme.setTheme(t, this);
|
|
6184
|
+
}
|
|
6185
|
+
createTheme() {
|
|
6186
|
+
this.theme || (this.theme = new Theme());
|
|
6187
|
+
}
|
|
6188
|
+
visibleAll(visible) {
|
|
6189
|
+
this.setAttribute("visible", visible), this.forEachChildren(item => {
|
|
6190
|
+
item.isContainer && item.visibleAll ? item.visibleAll(visible) : item.setAttribute("visible", visible);
|
|
6191
|
+
});
|
|
6192
|
+
}
|
|
6193
|
+
hideAll() {
|
|
6194
|
+
this.visibleAll(!1);
|
|
6195
|
+
}
|
|
6196
|
+
showAll() {
|
|
6197
|
+
this.visibleAll(!0);
|
|
6198
|
+
}
|
|
6199
|
+
containsPoint(x, y, mode) {
|
|
6200
|
+
if (mode === IContainPointMode.GLOBAL) {
|
|
6201
|
+
const point = new Point(x, y);
|
|
6202
|
+
return this.parent && this.parent.globalTransMatrix.transformPoint(point, point), this.AABBBounds.contains(point.x, point.y);
|
|
6203
|
+
}
|
|
6204
|
+
return this.AABBBounds.contains(x, y);
|
|
6205
|
+
}
|
|
6206
|
+
shouldUpdateAABBBounds() {
|
|
6207
|
+
return !!super.shouldUpdateAABBBounds() || !!(this._childUpdateTag & UpdateTag.UPDATE_BOUNDS);
|
|
6208
|
+
}
|
|
6209
|
+
tryUpdateAABBBounds() {
|
|
6210
|
+
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
6211
|
+
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6212
|
+
const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
|
|
6213
|
+
bounds = this.doUpdateAABBBounds();
|
|
6214
|
+
return this.addUpdateLayoutTag(), this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6215
|
+
}
|
|
6216
|
+
doUpdateLocalMatrix() {
|
|
6217
|
+
const {
|
|
6218
|
+
x = DefaultTransform.x,
|
|
6219
|
+
y = DefaultTransform.y,
|
|
6220
|
+
dx = DefaultTransform.dx,
|
|
6221
|
+
dy = DefaultTransform.dy,
|
|
6222
|
+
scaleX = DefaultTransform.scaleX,
|
|
6223
|
+
scaleY = DefaultTransform.scaleY,
|
|
6224
|
+
angle = DefaultTransform.angle,
|
|
6225
|
+
postMatrix: postMatrix
|
|
6226
|
+
} = this.attribute;
|
|
6227
|
+
if (0 !== x || 0 !== y || 0 !== dx || 0 !== dy || 1 !== scaleX || 1 !== scaleY || 0 !== angle || postMatrix) return super.doUpdateLocalMatrix();
|
|
6228
|
+
this._transMatrix.reset();
|
|
6229
|
+
}
|
|
6230
|
+
getGraphicTheme() {
|
|
6231
|
+
return getTheme(this).group;
|
|
6232
|
+
}
|
|
6233
|
+
updateAABBBounds(attribute, groupTheme, aabbBounds) {
|
|
6234
|
+
const originalAABBBounds = aabbBounds;
|
|
6235
|
+
aabbBounds = aabbBounds.clone();
|
|
6236
|
+
const {
|
|
6237
|
+
width: width,
|
|
6238
|
+
height: height,
|
|
6239
|
+
path: path,
|
|
6240
|
+
clip = groupTheme.clip
|
|
6241
|
+
} = attribute;
|
|
6242
|
+
if (path && path.length ? path.forEach(g => {
|
|
6243
|
+
aabbBounds.union(g.AABBBounds);
|
|
6244
|
+
}) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), !clip) {
|
|
6245
|
+
this.forEachChildren(node => {
|
|
6246
|
+
aabbBounds.union(node.AABBBounds);
|
|
6247
|
+
});
|
|
6248
|
+
const {
|
|
6249
|
+
scrollX = 0,
|
|
6250
|
+
scrollY = 0
|
|
6251
|
+
} = attribute;
|
|
6252
|
+
aabbBounds.translate(scrollX, scrollY);
|
|
6253
|
+
}
|
|
6254
|
+
return application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, this), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
|
|
6255
|
+
}
|
|
6256
|
+
doUpdateAABBBounds() {
|
|
6257
|
+
this.updateAABBBoundsStamp++;
|
|
6258
|
+
const bounds = super.doUpdateAABBBounds();
|
|
6259
|
+
return this.parent && this.parent.addChildUpdateBoundTag(), this._emitCustomEvent("AAABBBoundsChange"), bounds;
|
|
6260
|
+
}
|
|
6261
|
+
clearUpdateBoundTag() {
|
|
6262
|
+
this._updateTag &= UpdateTag.CLEAR_BOUNDS, this._childUpdateTag &= UpdateTag.CLEAR_BOUNDS;
|
|
6263
|
+
}
|
|
6264
|
+
addUpdateBoundTag() {
|
|
6265
|
+
this._updateTag |= UpdateTag.UPDATE_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag();
|
|
6266
|
+
}
|
|
6267
|
+
addChildUpdateBoundTag() {
|
|
6268
|
+
this._childUpdateTag & UpdateTag.UPDATE_BOUNDS || (this._childUpdateTag |= UpdateTag.UPDATE_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag());
|
|
6269
|
+
}
|
|
6270
|
+
getTheme() {
|
|
6271
|
+
return this.theme.getTheme(this);
|
|
6272
|
+
}
|
|
6273
|
+
incrementalAppendChild(node) {
|
|
6274
|
+
const data = super.appendChild(node);
|
|
6275
|
+
return data && this.syncChildSharedStateTreeBinding(data), this.addUpdateBoundTag(), this.getGraphicService().onAddIncremental(node, this, this.stage), data;
|
|
6276
|
+
}
|
|
6277
|
+
incrementalClearChild() {
|
|
6278
|
+
super.removeAllChild(), this.addUpdateBoundTag(), this.getGraphicService().onClearIncremental(this, this.stage);
|
|
6279
|
+
}
|
|
6280
|
+
_updateChildToStage(child) {
|
|
6281
|
+
return child && this.syncChildSharedStateTreeBinding(child), this.addUpdateBoundTag(), child;
|
|
6282
|
+
}
|
|
6283
|
+
appendChild(node, addStage = !0) {
|
|
6284
|
+
const data = super.appendChild(node);
|
|
6285
|
+
return data && addStage && this.syncChildSharedStateTreeBinding(data), this.addUpdateBoundTag(), data;
|
|
6286
|
+
}
|
|
6287
|
+
insertBefore(newNode, referenceNode) {
|
|
6288
|
+
return this._updateChildToStage(super.insertBefore(newNode, referenceNode));
|
|
6289
|
+
}
|
|
6290
|
+
insertAfter(newNode, referenceNode) {
|
|
6291
|
+
return this._updateChildToStage(super.insertAfter(newNode, referenceNode));
|
|
6292
|
+
}
|
|
6293
|
+
insertInto(newNode, idx) {
|
|
6294
|
+
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
6295
|
+
}
|
|
6296
|
+
removeChild(child, highPerformance = !1) {
|
|
6297
|
+
const data = super.removeChild(child);
|
|
6298
|
+
return data ? highPerformance ? (child.detachStageForRelease(), data) : (this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data) : data;
|
|
6299
|
+
}
|
|
6300
|
+
removeAllChild(deep = !1) {
|
|
6301
|
+
const children = this.children.slice();
|
|
6302
|
+
this.forEachChildren(child => {
|
|
6303
|
+
this.getGraphicService().onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
6304
|
+
}), super.removeAllChild(), children.forEach(child => {
|
|
6305
|
+
child.setStage(null, null);
|
|
6306
|
+
}), this.addUpdateBoundTag();
|
|
6307
|
+
}
|
|
6308
|
+
setStage(stage, layer) {
|
|
6309
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6310
|
+
const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
|
|
6311
|
+
needsSharedStateTreeSync = this.hasSharedStateDefinitions() || this.sharedStateScope || (null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty;
|
|
6312
|
+
if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.notifyChildrenSharedStateTreeChanged();
|
|
6313
|
+
const layerChanged = this.layer !== layer;
|
|
6314
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
|
|
6315
|
+
}
|
|
6316
|
+
addUpdatePositionTag() {
|
|
6317
|
+
super.addUpdatePositionTag(), this.forEachChildren(g => {
|
|
6318
|
+
g.isContainer && g.addUpdateGlobalPositionTag();
|
|
6319
|
+
});
|
|
6320
|
+
}
|
|
6321
|
+
addUpdateGlobalPositionTag() {
|
|
6322
|
+
super.addUpdateGlobalPositionTag(), this.forEachChildren(g => {
|
|
6323
|
+
g.isContainer && g.addUpdateGlobalPositionTag();
|
|
6324
|
+
});
|
|
6325
|
+
}
|
|
6326
|
+
tryUpdateGlobalTransMatrix(clearTag = !0) {
|
|
6327
|
+
if (this.shouldUpdateGlobalMatrix()) {
|
|
6328
|
+
if (this._globalTransMatrix) {
|
|
6329
|
+
if (this.parent) {
|
|
6330
|
+
const m = this.parent.globalTransMatrix;
|
|
6331
|
+
this._globalTransMatrix.setValue(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
6332
|
+
}
|
|
6333
|
+
} else this._globalTransMatrix = this.parent ? this.parent.globalTransMatrix.clone() : this.transMatrix.clone();
|
|
6334
|
+
this.doUpdateGlobalMatrix(), clearTag && this.clearUpdateGlobalPositionTag();
|
|
6335
|
+
}
|
|
6336
|
+
return this._globalTransMatrix;
|
|
6337
|
+
}
|
|
6338
|
+
shouldUpdateGlobalMatrix() {
|
|
6339
|
+
return !!(this._updateTag & UpdateTag.UPDATE_GLOBAL_MATRIX);
|
|
6340
|
+
}
|
|
6341
|
+
_getChildByName(name, deep) {
|
|
6342
|
+
return this.find(node => node.name === name, deep);
|
|
6343
|
+
}
|
|
6344
|
+
createOrUpdateChild(graphicName, attributes, graphicType) {
|
|
6345
|
+
let graphic = this._getChildByName(graphicName);
|
|
6346
|
+
return graphic ? graphic.setAttributes(attributes) : (graphic = application.graphicService.creator[graphicType](attributes), graphic.name = graphicName, this.add(graphic)), graphic;
|
|
6347
|
+
}
|
|
6348
|
+
clone() {
|
|
6349
|
+
return new Group(Object.assign({}, this.attribute));
|
|
6350
|
+
}
|
|
6351
|
+
getNoWorkAnimateAttr() {
|
|
6352
|
+
return Group.NOWORK_ANIMATE_ATTR;
|
|
6353
|
+
}
|
|
6354
|
+
release(all) {
|
|
6355
|
+
all && this.forEachChildren(g => {
|
|
6356
|
+
g.release(all);
|
|
6357
|
+
}), super.release();
|
|
6358
|
+
}
|
|
6359
|
+
detachStageForRelease() {
|
|
6360
|
+
super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
|
|
6361
|
+
item.detachStageForRelease();
|
|
6362
|
+
});
|
|
6363
|
+
}
|
|
6364
|
+
ensureSharedStateScopeBound() {
|
|
6365
|
+
var _a, _b, _c;
|
|
6366
|
+
if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
|
|
6367
|
+
const parentScope = null !== (_b = null === (_a = this.parent) || void 0 === _a ? void 0 : _a.sharedStateScope) && void 0 !== _b ? _b : null === (_c = this.stage) || void 0 === _c ? void 0 : _c.rootSharedStateScope;
|
|
6368
|
+
this.sharedStateScope ? (this.sharedStateScope.ownerStage = this.stage, setSharedStateScopeParent(this.sharedStateScope, parentScope), this.sharedStateScope.localStateDefinitions !== this._sharedStateDefinitions && setSharedStateScopeLocalDefinitions(this.sharedStateScope, this._sharedStateDefinitions)) : this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
|
|
6369
|
+
}
|
|
6370
|
+
hasSharedStateDefinitions() {
|
|
6371
|
+
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
6372
|
+
}
|
|
6373
|
+
notifyChildrenSharedStateTreeChanged() {
|
|
6374
|
+
this.forEachChildren(item => {
|
|
6375
|
+
this.syncChildSharedStateTreeBinding(item);
|
|
6376
|
+
});
|
|
6377
|
+
}
|
|
6378
|
+
syncChildSharedStateTreeBinding(child) {
|
|
6379
|
+
child.onParentSharedStateTreeChanged(this.stage, this.layer);
|
|
6380
|
+
}
|
|
6381
|
+
onParentSharedStateTreeChanged(stage, layer) {
|
|
6382
|
+
var _a;
|
|
6383
|
+
this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)), this.notifyChildrenSharedStateTreeChanged()) : this.setStage(stage, layer);
|
|
6384
|
+
}
|
|
6385
|
+
}
|
|
6386
|
+
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
6387
|
+
function createGroup(attributes) {
|
|
6388
|
+
return new Group(attributes);
|
|
6389
|
+
}
|
|
6390
|
+
|
|
6391
|
+
const GROUP_ATTRIBUTES = [
|
|
6392
|
+
'x',
|
|
6393
|
+
'y',
|
|
6394
|
+
'dx',
|
|
6395
|
+
'dy',
|
|
6396
|
+
'scaleX',
|
|
6397
|
+
'scaleY',
|
|
6398
|
+
'angle',
|
|
6399
|
+
'anchor',
|
|
6400
|
+
'postMatrix',
|
|
6401
|
+
'visible',
|
|
6402
|
+
'clip',
|
|
6403
|
+
'pickable',
|
|
6404
|
+
'childrenPickable',
|
|
6405
|
+
'zIndex',
|
|
6406
|
+
'cursor'
|
|
6407
|
+
];
|
|
6408
|
+
class AbstractComponent extends Group {
|
|
6409
|
+
constructor(attributes, options) {
|
|
6410
|
+
super(attributes);
|
|
6411
|
+
this._skipRenderAttributes = GROUP_ATTRIBUTES;
|
|
6412
|
+
if (options === null || options === void 0 ? void 0 : options.mode) {
|
|
6413
|
+
this.mode = options.mode;
|
|
6414
|
+
this.setMode(options.mode);
|
|
6415
|
+
}
|
|
6416
|
+
if (options === null || options === void 0 ? void 0 : options.skipDefault) {
|
|
6417
|
+
this.skipDefault = true;
|
|
6418
|
+
}
|
|
6419
|
+
this.setTheme({
|
|
6420
|
+
common: {
|
|
6421
|
+
strokeBoundsBuffer: 0
|
|
6422
|
+
}
|
|
6423
|
+
});
|
|
6424
|
+
this.attribute = attributes;
|
|
6425
|
+
this.onSetStage((_, stage) => {
|
|
6426
|
+
if (!stage) {
|
|
6427
|
+
return;
|
|
6428
|
+
}
|
|
6429
|
+
this.render();
|
|
6430
|
+
this.bindEvents();
|
|
6431
|
+
});
|
|
6432
|
+
}
|
|
6433
|
+
setAttribute(key, value, forceUpdateTag, context) {
|
|
6434
|
+
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);
|
|
6435
|
+
if (params) {
|
|
6436
|
+
return this._setAttributes(params, forceUpdateTag);
|
|
6437
|
+
}
|
|
6438
|
+
if (isPlainObject$2(this.attribute[key]) &&
|
|
6439
|
+
isPlainObject$2(value) &&
|
|
6440
|
+
!isFunction(this.attribute[key]) &&
|
|
6441
|
+
!isFunction(value)) {
|
|
6442
|
+
merge(this.attribute[key], value);
|
|
6443
|
+
}
|
|
6444
|
+
else {
|
|
6445
|
+
this.attribute[key] = value;
|
|
6446
|
+
}
|
|
6447
|
+
if (!this._skipRenderAttributes.includes(key)) {
|
|
6448
|
+
this.render();
|
|
6449
|
+
}
|
|
6450
|
+
this.valid = this.isValid();
|
|
6451
|
+
if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTag(key))) {
|
|
6452
|
+
this.addUpdateShapeAndBoundsTag();
|
|
6453
|
+
}
|
|
6454
|
+
else {
|
|
6455
|
+
this.addUpdateBoundTag();
|
|
6456
|
+
}
|
|
6457
|
+
this.addUpdatePositionTag();
|
|
6458
|
+
this.onAttributeUpdate();
|
|
6459
|
+
}
|
|
6460
|
+
setAttributes(params, forceUpdateTag, context) {
|
|
6461
|
+
params =
|
|
6462
|
+
(this.onBeforeAttributeUpdate &&
|
|
6463
|
+
this.onBeforeAttributeUpdate(params, this.attribute, null, context)) ||
|
|
6464
|
+
params;
|
|
6465
|
+
return this._setAttributes(params, forceUpdateTag);
|
|
6466
|
+
}
|
|
6467
|
+
_setAttributes(params, forceUpdateTag) {
|
|
6468
|
+
const keys = Object.keys(params);
|
|
6469
|
+
this._mergeAttributes(params, keys);
|
|
6470
|
+
if (!keys.every(key => this._skipRenderAttributes.includes(key))) {
|
|
6471
|
+
this.render();
|
|
6472
|
+
}
|
|
6473
|
+
this.valid = this.isValid();
|
|
6474
|
+
if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTags(keys))) {
|
|
6475
|
+
this.addUpdateShapeAndBoundsTag();
|
|
6476
|
+
}
|
|
6477
|
+
else {
|
|
6478
|
+
this.addUpdateBoundTag();
|
|
6479
|
+
}
|
|
6480
|
+
this.addUpdatePositionTag();
|
|
6481
|
+
this.onAttributeUpdate();
|
|
6482
|
+
}
|
|
6483
|
+
_mergeAttributes(params, keys) {
|
|
6484
|
+
if (isNil(keys)) {
|
|
6485
|
+
keys = Object.keys(params);
|
|
6486
|
+
}
|
|
6487
|
+
for (let i = 0; i < keys.length; i++) {
|
|
6488
|
+
const key = keys[i];
|
|
6489
|
+
if (isPlainObject$2(this.attribute[key]) && !isFunction(this.attribute[key]) && !isFunction(params[key])) {
|
|
6490
|
+
merge(this.attribute[key], params[key]);
|
|
6491
|
+
}
|
|
6492
|
+
else {
|
|
6493
|
+
this.attribute[key] = params[key];
|
|
6494
|
+
}
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6497
|
+
bindEvents() {
|
|
6498
|
+
}
|
|
6499
|
+
_getNodeId(id) {
|
|
6500
|
+
var _a;
|
|
6501
|
+
return `${(_a = this.id) !== null && _a !== void 0 ? _a : this._uid}-${this.name}-${id}`;
|
|
6502
|
+
}
|
|
6503
|
+
_dispatchEvent(eventName, details) {
|
|
6504
|
+
var _a;
|
|
6505
|
+
const changeEvent = new CustomEvent(eventName, details);
|
|
6506
|
+
changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
|
|
6507
|
+
this.dispatchEvent(changeEvent);
|
|
6508
|
+
}
|
|
6509
|
+
eventPosToStagePos(e) {
|
|
6510
|
+
var _a, _b;
|
|
6511
|
+
const result = { x: 0, y: 0 };
|
|
6512
|
+
const stagePoints = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
6513
|
+
this.globalTransMatrix.transformPoint(stagePoints, result);
|
|
6514
|
+
return result;
|
|
6515
|
+
}
|
|
6516
|
+
}
|
|
6517
|
+
|
|
6518
|
+
class Hook {
|
|
6519
|
+
constructor(args, name) {
|
|
6520
|
+
this._args = args, this.name = name, this.taps = [];
|
|
6521
|
+
}
|
|
6522
|
+
tap(options, fn) {
|
|
6523
|
+
this._tap("sync", options, fn);
|
|
6524
|
+
}
|
|
6525
|
+
unTap(options, fn) {
|
|
6526
|
+
const name = "string" == typeof options ? options.trim() : options.name;
|
|
6527
|
+
name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
|
|
6528
|
+
}
|
|
6529
|
+
_parseOptions(type, options, fn) {
|
|
6530
|
+
let _options;
|
|
6531
|
+
if ("string" == typeof options) _options = {
|
|
6532
|
+
name: options.trim()
|
|
6533
|
+
};else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
|
|
6534
|
+
if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
|
|
6535
|
+
return _options = Object.assign({
|
|
6536
|
+
type: type,
|
|
6537
|
+
fn: fn
|
|
6538
|
+
}, _options), _options;
|
|
6539
|
+
}
|
|
6540
|
+
_tap(type, options, fn) {
|
|
6541
|
+
this._insert(this._parseOptions(type, options, fn));
|
|
6542
|
+
}
|
|
6543
|
+
_insert(item) {
|
|
6544
|
+
let before;
|
|
6545
|
+
"string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
|
|
6546
|
+
let stage = 0;
|
|
6547
|
+
"number" == typeof item.stage && (stage = item.stage);
|
|
6548
|
+
let i = this.taps.length;
|
|
6549
|
+
for (; i > 0;) {
|
|
6550
|
+
i--;
|
|
6551
|
+
const x = this.taps[i];
|
|
6552
|
+
this.taps[i + 1] = x;
|
|
6553
|
+
const xStage = x.stage || 0;
|
|
6554
|
+
if (before) {
|
|
6555
|
+
if (before.has(x.name)) {
|
|
6556
|
+
before.delete(x.name);
|
|
6557
|
+
continue;
|
|
6558
|
+
}
|
|
6559
|
+
if (before.size > 0) continue;
|
|
6560
|
+
}
|
|
6561
|
+
if (!(xStage > stage)) {
|
|
6562
|
+
i++;
|
|
6563
|
+
break;
|
|
6564
|
+
}
|
|
6565
|
+
}
|
|
6566
|
+
this.taps[i] = item;
|
|
6567
|
+
}
|
|
6568
|
+
}
|
|
6569
|
+
|
|
6570
|
+
class SyncHook extends Hook {
|
|
6571
|
+
call(...args) {
|
|
6572
|
+
this.taps.map(t => t.fn).forEach(cb => cb(...args));
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
|
|
6576
|
+
let idx = 0;
|
|
6577
|
+
class PerformanceRAF {
|
|
6578
|
+
constructor() {
|
|
6579
|
+
this.nextAnimationFrameCbs = new Map(), this._rafHandle = null, this.runAnimationFrame = time => {
|
|
6580
|
+
this._rafHandle = null;
|
|
6581
|
+
const cbs = this.nextAnimationFrameCbs;
|
|
6582
|
+
this.nextAnimationFrameCbs = new Map(), cbs.forEach(cb => cb(time));
|
|
6583
|
+
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
6584
|
+
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.size && (this._rafHandle = application.global.getRequestAnimationFrame()(this.runAnimationFrame));
|
|
6585
|
+
};
|
|
6586
|
+
}
|
|
6587
|
+
addAnimationFrameCb(callback) {
|
|
6588
|
+
return this.nextAnimationFrameCbs.set(++idx, callback), this.tryRunAnimationFrameNextFrame(), idx;
|
|
6589
|
+
}
|
|
6590
|
+
removeAnimationFrameCb(index) {
|
|
6591
|
+
return !!this.nextAnimationFrameCbs.has(index) && (this.nextAnimationFrameCbs.delete(index), !0);
|
|
6592
|
+
}
|
|
6593
|
+
wait() {
|
|
6594
|
+
return new Promise(resolve => {
|
|
6595
|
+
this.addAnimationFrameCb(() => resolve());
|
|
6596
|
+
});
|
|
6597
|
+
}
|
|
6598
|
+
}
|
|
6599
|
+
|
|
6600
|
+
class EventListenerManager {
|
|
6601
|
+
constructor() {
|
|
6602
|
+
this._listenerMap = new Map(), this._eventListenerTransformer = event => event;
|
|
6603
|
+
}
|
|
6604
|
+
setEventListenerTransformer(transformer) {
|
|
6605
|
+
this._eventListenerTransformer = transformer || (event => event);
|
|
6606
|
+
}
|
|
6607
|
+
addEventListener(type, listener, options) {
|
|
6608
|
+
if (!listener) return;
|
|
6609
|
+
const capture = this._resolveCapture(options),
|
|
6610
|
+
once = this._resolveOnce(options),
|
|
6611
|
+
listenerTypeMap = this._getOrCreateListenerTypeMap(type),
|
|
6612
|
+
wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
|
|
6613
|
+
if (wrappedMap.has(capture)) return;
|
|
6614
|
+
const wrappedListener = event => {
|
|
6615
|
+
const transformedEvent = this._eventListenerTransformer(event);
|
|
6616
|
+
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
|
|
6617
|
+
};
|
|
6618
|
+
wrappedMap.set(capture, {
|
|
6619
|
+
wrappedListener: wrappedListener,
|
|
6620
|
+
options: options
|
|
6621
|
+
}), this._nativeAddEventListener(type, wrappedListener, options);
|
|
6622
|
+
}
|
|
6623
|
+
removeEventListener(type, listener, options) {
|
|
6624
|
+
var _a, _b;
|
|
6625
|
+
if (!listener) return;
|
|
6626
|
+
const capture = this._resolveCapture(options),
|
|
6627
|
+
wrappedRecord = null === (_b = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener)) || void 0 === _b ? void 0 : _b.get(capture);
|
|
6628
|
+
wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
|
|
6629
|
+
}
|
|
6630
|
+
dispatchEvent(event) {
|
|
6631
|
+
return this._nativeDispatchEvent(event);
|
|
6632
|
+
}
|
|
6633
|
+
clearAllEventListeners() {
|
|
6634
|
+
this._listenerMap.forEach((listenerMap, type) => {
|
|
6635
|
+
listenerMap.forEach(wrappedMap => {
|
|
6636
|
+
wrappedMap.forEach((wrappedRecord, capture) => {
|
|
6637
|
+
this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
|
|
6638
|
+
});
|
|
6639
|
+
});
|
|
6640
|
+
}), this._listenerMap.clear();
|
|
6641
|
+
}
|
|
6642
|
+
_resolveCapture(options) {
|
|
6643
|
+
return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
|
|
6644
|
+
}
|
|
6645
|
+
_resolveOnce(options) {
|
|
6646
|
+
return "object" == typeof options && !!(null == options ? void 0 : options.once);
|
|
6647
|
+
}
|
|
6648
|
+
_getOrCreateListenerTypeMap(type) {
|
|
6649
|
+
let listenerTypeMap = this._listenerMap.get(type);
|
|
6650
|
+
return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
|
|
6651
|
+
}
|
|
6652
|
+
_getOrCreateWrappedMap(listenerTypeMap, listener) {
|
|
6653
|
+
let wrappedMap = listenerTypeMap.get(listener);
|
|
6654
|
+
return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
|
|
6655
|
+
}
|
|
6656
|
+
_deleteListenerRecord(type, listener, capture) {
|
|
6657
|
+
const listenerTypeMap = this._listenerMap.get(type);
|
|
6658
|
+
if (!listenerTypeMap) return;
|
|
6659
|
+
const wrappedMap = listenerTypeMap.get(listener);
|
|
6660
|
+
wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
|
|
6661
|
+
}
|
|
6662
|
+
_nativeAddEventListener(type, listener, options) {
|
|
6663
|
+
throw new Error("_nativeAddEventListener must be implemented by derived classes");
|
|
6664
|
+
}
|
|
6665
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
6666
|
+
throw new Error("_nativeRemoveEventListener must be implemented by derived classes");
|
|
6667
|
+
}
|
|
6668
|
+
_nativeDispatchEvent(event) {
|
|
6669
|
+
throw new Error("_nativeDispatchEvent must be implemented by derived classes");
|
|
6670
|
+
}
|
|
6671
|
+
}
|
|
6672
|
+
|
|
6673
|
+
var __awaiter$3 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
6674
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6675
|
+
function fulfilled(value) {
|
|
6676
|
+
try {
|
|
6677
|
+
step(generator.next(value));
|
|
6678
|
+
} catch (e) {
|
|
6679
|
+
reject(e);
|
|
6680
|
+
}
|
|
6681
|
+
}
|
|
6682
|
+
function rejected(value) {
|
|
6683
|
+
try {
|
|
6684
|
+
step(generator.throw(value));
|
|
6685
|
+
} catch (e) {
|
|
6686
|
+
reject(e);
|
|
6687
|
+
}
|
|
6688
|
+
}
|
|
6689
|
+
function step(result) {
|
|
6690
|
+
var value;
|
|
6691
|
+
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
|
|
6692
|
+
resolve(value);
|
|
6693
|
+
})).then(fulfilled, rejected);
|
|
6694
|
+
}
|
|
6695
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6696
|
+
});
|
|
6697
|
+
};
|
|
6698
|
+
class DefaultGlobal extends EventListenerManager {
|
|
6699
|
+
get env() {
|
|
6700
|
+
return this._env;
|
|
6701
|
+
}
|
|
6702
|
+
get isImageAnonymous() {
|
|
6703
|
+
return this._isImageAnonymous;
|
|
6704
|
+
}
|
|
6705
|
+
set isImageAnonymous(isImageAnonymous) {
|
|
6706
|
+
this._isImageAnonymous = isImageAnonymous;
|
|
6707
|
+
}
|
|
6708
|
+
get devicePixelRatio() {
|
|
6709
|
+
return this._env || this.setEnv("browser"), this.envContribution.getDevicePixelRatio();
|
|
6710
|
+
}
|
|
6711
|
+
get supportEvent() {
|
|
6712
|
+
return this._env || this.setEnv("browser"), this.envContribution.supportEvent;
|
|
6713
|
+
}
|
|
6714
|
+
set supportEvent(support) {
|
|
6715
|
+
this._env || this.setEnv("browser"), this.envContribution.supportEvent = support;
|
|
6716
|
+
}
|
|
6717
|
+
get supportsTouchEvents() {
|
|
6718
|
+
return this._env || this.setEnv("browser"), this.envContribution.supportsTouchEvents;
|
|
6719
|
+
}
|
|
6720
|
+
set supportsTouchEvents(support) {
|
|
6721
|
+
this._env || this.setEnv("browser"), this.envContribution.supportsTouchEvents = support;
|
|
6722
|
+
}
|
|
6723
|
+
get supportsPointerEvents() {
|
|
6724
|
+
return this._env || this.setEnv("browser"), this.envContribution.supportsPointerEvents;
|
|
6725
|
+
}
|
|
6726
|
+
set supportsPointerEvents(support) {
|
|
6727
|
+
this._env || this.setEnv("browser"), this.envContribution.supportsPointerEvents = support;
|
|
6728
|
+
}
|
|
6729
|
+
get supportsMouseEvents() {
|
|
6730
|
+
return this._env || this.setEnv("browser"), this.envContribution.supportsMouseEvents;
|
|
6731
|
+
}
|
|
6732
|
+
set supportsMouseEvents(support) {
|
|
6733
|
+
this._env || this.setEnv("browser"), this.envContribution.supportsMouseEvents = support;
|
|
6734
|
+
}
|
|
6735
|
+
get applyStyles() {
|
|
6736
|
+
return this._env || this.setEnv("browser"), this.envContribution.applyStyles;
|
|
6737
|
+
}
|
|
6738
|
+
set applyStyles(support) {
|
|
6739
|
+
this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
|
|
6740
|
+
}
|
|
6741
|
+
constructor(contributions) {
|
|
6742
|
+
super(), this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.eventListenerTransformer = event => event, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
6743
|
+
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
6744
|
+
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
6745
|
+
}
|
|
6746
|
+
_nativeAddEventListener(type, listener, options) {
|
|
6747
|
+
return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
|
|
6748
|
+
}
|
|
6749
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
6750
|
+
return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
|
|
6751
|
+
}
|
|
6752
|
+
_nativeDispatchEvent(event) {
|
|
6753
|
+
return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
|
|
6754
|
+
}
|
|
6755
|
+
bindContribution(params) {
|
|
6756
|
+
const promiseArr = [];
|
|
6757
|
+
if (this.contributions.getContributions().forEach(contribution => {
|
|
6758
|
+
const data = contribution.configure(this, params);
|
|
6759
|
+
data && data.then && promiseArr.push(data);
|
|
6760
|
+
}), promiseArr.length) return Promise.all(promiseArr);
|
|
6761
|
+
}
|
|
6762
|
+
getDynamicCanvasCount() {
|
|
6763
|
+
return this._env || this.setEnv("browser"), this.envContribution.getDynamicCanvasCount();
|
|
6764
|
+
}
|
|
6765
|
+
getStaticCanvasCount() {
|
|
6766
|
+
return this._env || this.setEnv("browser"), this.envContribution.getStaticCanvasCount();
|
|
6767
|
+
}
|
|
6768
|
+
setEnv(env, params) {
|
|
6769
|
+
if (params && !0 === params.force || this._env !== env) return this.deactiveCurrentEnv(), this.activeEnv(env, params);
|
|
6770
|
+
}
|
|
6771
|
+
deactiveCurrentEnv() {
|
|
6772
|
+
this.envContribution && this.envContribution.release();
|
|
6773
|
+
}
|
|
6774
|
+
activeEnv(env, params) {
|
|
6775
|
+
const lastEnv = this._env;
|
|
6776
|
+
this._env = env;
|
|
6777
|
+
const data = this.bindContribution(params);
|
|
6778
|
+
if (data && data.then) return data.then(() => {
|
|
6779
|
+
this.envParams = params, this.hooks.onSetEnv.call(lastEnv, env, this);
|
|
6780
|
+
});
|
|
6781
|
+
this.envParams = params, this.hooks.onSetEnv.call(lastEnv, env, this);
|
|
6782
|
+
}
|
|
6783
|
+
setActiveEnvContribution(contribution) {
|
|
6784
|
+
this.envContribution = contribution;
|
|
6785
|
+
}
|
|
6786
|
+
createCanvas(params) {
|
|
6787
|
+
return this._env || this.setEnv("browser"), this.envContribution.createCanvas(params);
|
|
6788
|
+
}
|
|
6789
|
+
createOffscreenCanvas(params) {
|
|
6790
|
+
return this._env || this.setEnv("browser"), this.envContribution.createOffscreenCanvas(params);
|
|
6791
|
+
}
|
|
6792
|
+
releaseCanvas(canvas) {
|
|
6793
|
+
return this._env || this.setEnv("browser"), this.envContribution.releaseCanvas(canvas);
|
|
6794
|
+
}
|
|
6795
|
+
getRequestAnimationFrame() {
|
|
6796
|
+
return this._env || this.setEnv("browser"), this.envContribution.getRequestAnimationFrame();
|
|
6797
|
+
}
|
|
6798
|
+
getSpecifiedRequestAnimationFrame(id) {
|
|
6799
|
+
this._env || this.setEnv("browser"), this._performanceRAFList[id] || (this._performanceRAFList[id] = new PerformanceRAF());
|
|
6800
|
+
const performanceRAF = this._performanceRAFList[id];
|
|
6801
|
+
return callback => performanceRAF.addAnimationFrameCb(callback);
|
|
6802
|
+
}
|
|
6803
|
+
getSpecifiedPerformanceRAF(id) {
|
|
6804
|
+
return this._env || this.setEnv("browser"), this._performanceRAFList[id] || (this._performanceRAFList[id] = new PerformanceRAF()), this._performanceRAFList[id];
|
|
6805
|
+
}
|
|
6806
|
+
getSpecifiedCancelAnimationFrame(id) {
|
|
6807
|
+
if (this._env || this.setEnv("browser"), !this._performanceRAFList[id]) return () => !1;
|
|
6808
|
+
const performanceRAF = this._performanceRAFList[id];
|
|
6809
|
+
return handle => performanceRAF.removeAnimationFrameCb(handle);
|
|
6810
|
+
}
|
|
6811
|
+
getCancelAnimationFrame() {
|
|
6812
|
+
return this._env || this.setEnv("browser"), this.envContribution.getCancelAnimationFrame();
|
|
6813
|
+
}
|
|
6814
|
+
getElementById(str) {
|
|
6815
|
+
return this._env || this.setEnv("browser"), this.envContribution.getElementById ? this.envContribution.getElementById(str) : null;
|
|
6816
|
+
}
|
|
6817
|
+
getRootElement() {
|
|
6818
|
+
return this._env || this.setEnv("browser"), this.envContribution.getRootElement ? this.envContribution.getRootElement() : null;
|
|
6819
|
+
}
|
|
6820
|
+
getDocument() {
|
|
6821
|
+
return this._env || this.setEnv("browser"), this.envContribution.getDocument ? this.envContribution.getDocument() : null;
|
|
6822
|
+
}
|
|
6823
|
+
mapToCanvasPoint(event, domElement) {
|
|
6824
|
+
return this._env || this.setEnv("browser"), this.envContribution.mapToCanvasPoint ? this.envContribution.mapToCanvasPoint(event, domElement) : null;
|
|
6825
|
+
}
|
|
6826
|
+
loadImage(url) {
|
|
6827
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadImage(url);
|
|
6828
|
+
}
|
|
6829
|
+
loadSvg(str) {
|
|
6830
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadSvg(str);
|
|
6831
|
+
}
|
|
6832
|
+
loadJson(url) {
|
|
6833
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadJson(url);
|
|
6834
|
+
}
|
|
6835
|
+
loadArrayBuffer(url) {
|
|
6836
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadArrayBuffer(url);
|
|
6837
|
+
}
|
|
6838
|
+
loadBlob(url) {
|
|
6839
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadBlob(url);
|
|
6840
|
+
}
|
|
6841
|
+
loadFont(name, source, descriptors) {
|
|
6842
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
6843
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadFont(name, source, descriptors);
|
|
6844
|
+
});
|
|
6845
|
+
}
|
|
6846
|
+
isChrome() {
|
|
6847
|
+
return null != this._isChrome || (this._env || this.setEnv("browser"), this._isChrome = "browser" === this._env && navigator.userAgent.indexOf("Chrome") > -1), this._isChrome;
|
|
6848
|
+
}
|
|
6849
|
+
isSafari() {
|
|
6850
|
+
return null != this._isSafari || (this._env || this.setEnv("browser"), this._isSafari = "browser" === this._env && /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)), this._isSafari;
|
|
6851
|
+
}
|
|
6852
|
+
getNativeAABBBounds(dom) {
|
|
6853
|
+
return this._env || this.setEnv("browser"), this.envContribution.getNativeAABBBounds(dom);
|
|
6854
|
+
}
|
|
6855
|
+
removeDom(dom) {
|
|
6856
|
+
return this._env || this.setEnv("browser"), this.envContribution.removeDom(dom);
|
|
6857
|
+
}
|
|
6858
|
+
createDom(params) {
|
|
6859
|
+
return this._env || this.setEnv("browser"), this.envContribution.createDom(params);
|
|
6860
|
+
}
|
|
6861
|
+
updateDom(dom, params) {
|
|
6862
|
+
return this._env || this.setEnv("browser"), this.envContribution.updateDom(dom, params);
|
|
6863
|
+
}
|
|
6864
|
+
getElementTop(dom, baseWindow = !1) {
|
|
6865
|
+
return this._env || this.setEnv("browser"), this.envContribution.getElementTop(dom, baseWindow);
|
|
6866
|
+
}
|
|
6867
|
+
getElementLeft(dom, baseWindow = !1) {
|
|
6868
|
+
return this._env || this.setEnv("browser"), this.envContribution.getElementLeft(dom, baseWindow);
|
|
6869
|
+
}
|
|
6870
|
+
getElementTopLeft(dom, baseWindow = !1) {
|
|
6871
|
+
return this._env || this.setEnv("browser"), this.envContribution.getElementTopLeft(dom, baseWindow);
|
|
6872
|
+
}
|
|
6873
|
+
isMacOS() {
|
|
6874
|
+
return this._env || this.setEnv("browser"), this.envContribution.isMacOS();
|
|
6875
|
+
}
|
|
6876
|
+
copyToClipBoard(text) {
|
|
6877
|
+
return this._env || this.setEnv("browser"), this.envContribution.copyToClipBoard(text);
|
|
6878
|
+
}
|
|
6879
|
+
}
|
|
6880
|
+
|
|
7027
6881
|
const updateBoundsOfCommonOuterBorder = (attribute, theme, aabbBounds) => {
|
|
7028
6882
|
const {
|
|
7029
6883
|
outerBorder: outerBorder,
|
|
@@ -9565,243 +9419,6 @@ function createArc(attributes) {
|
|
|
9565
9419
|
return new Arc(attributes);
|
|
9566
9420
|
}
|
|
9567
9421
|
|
|
9568
|
-
var GroupUpdateAABBBoundsMode;
|
|
9569
|
-
!function (GroupUpdateAABBBoundsMode) {
|
|
9570
|
-
GroupUpdateAABBBoundsMode[GroupUpdateAABBBoundsMode.LESS_GROUP = 0] = "LESS_GROUP", GroupUpdateAABBBoundsMode[GroupUpdateAABBBoundsMode.MORE_GROUP = 1] = "MORE_GROUP";
|
|
9571
|
-
}(GroupUpdateAABBBoundsMode || (GroupUpdateAABBBoundsMode = {}));
|
|
9572
|
-
class Group extends Graphic {
|
|
9573
|
-
constructor(params) {
|
|
9574
|
-
super(params), this.type = "group", this.parent = null, this.isContainer = !0, this._hasSharedStateDefinitions = !1, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
|
|
9575
|
-
}
|
|
9576
|
-
get sharedStateDefinitions() {
|
|
9577
|
-
return this._sharedStateDefinitions;
|
|
9578
|
-
}
|
|
9579
|
-
set sharedStateDefinitions(value) {
|
|
9580
|
-
if (this._sharedStateDefinitions === value) return;
|
|
9581
|
-
const previousScope = this.sharedStateScope;
|
|
9582
|
-
this._sharedStateDefinitions = value, this._hasSharedStateDefinitions = !!value && Object.keys(value).length > 0, this.ensureSharedStateScopeBound(), this.sharedStateScope && (setSharedStateScopeLocalDefinitions(this.sharedStateScope, value), markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage)), previousScope !== this.sharedStateScope && this.notifyChildrenSharedStateTreeChanged();
|
|
9583
|
-
}
|
|
9584
|
-
setMode(mode) {
|
|
9585
|
-
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
9586
|
-
}
|
|
9587
|
-
set3dMode() {
|
|
9588
|
-
this.in3dMode = !0;
|
|
9589
|
-
}
|
|
9590
|
-
set2dMode() {
|
|
9591
|
-
this.in3dMode = !1;
|
|
9592
|
-
}
|
|
9593
|
-
setTheme(t) {
|
|
9594
|
-
return this.theme || (this.theme = new Theme()), this.theme.setTheme(t, this);
|
|
9595
|
-
}
|
|
9596
|
-
createTheme() {
|
|
9597
|
-
this.theme || (this.theme = new Theme());
|
|
9598
|
-
}
|
|
9599
|
-
visibleAll(visible) {
|
|
9600
|
-
this.setAttribute("visible", visible), this.forEachChildren(item => {
|
|
9601
|
-
item.isContainer && item.visibleAll ? item.visibleAll(visible) : item.setAttribute("visible", visible);
|
|
9602
|
-
});
|
|
9603
|
-
}
|
|
9604
|
-
hideAll() {
|
|
9605
|
-
this.visibleAll(!1);
|
|
9606
|
-
}
|
|
9607
|
-
showAll() {
|
|
9608
|
-
this.visibleAll(!0);
|
|
9609
|
-
}
|
|
9610
|
-
containsPoint(x, y, mode) {
|
|
9611
|
-
if (mode === IContainPointMode.GLOBAL) {
|
|
9612
|
-
const point = new Point(x, y);
|
|
9613
|
-
return this.parent && this.parent.globalTransMatrix.transformPoint(point, point), this.AABBBounds.contains(point.x, point.y);
|
|
9614
|
-
}
|
|
9615
|
-
return this.AABBBounds.contains(x, y);
|
|
9616
|
-
}
|
|
9617
|
-
shouldUpdateAABBBounds() {
|
|
9618
|
-
return !!super.shouldUpdateAABBBounds() || !!(this._childUpdateTag & UpdateTag.UPDATE_BOUNDS);
|
|
9619
|
-
}
|
|
9620
|
-
tryUpdateAABBBounds() {
|
|
9621
|
-
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
9622
|
-
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
9623
|
-
const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
|
|
9624
|
-
bounds = this.doUpdateAABBBounds();
|
|
9625
|
-
return this.addUpdateLayoutTag(), this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
9626
|
-
}
|
|
9627
|
-
doUpdateLocalMatrix() {
|
|
9628
|
-
const {
|
|
9629
|
-
x = DefaultTransform.x,
|
|
9630
|
-
y = DefaultTransform.y,
|
|
9631
|
-
dx = DefaultTransform.dx,
|
|
9632
|
-
dy = DefaultTransform.dy,
|
|
9633
|
-
scaleX = DefaultTransform.scaleX,
|
|
9634
|
-
scaleY = DefaultTransform.scaleY,
|
|
9635
|
-
angle = DefaultTransform.angle,
|
|
9636
|
-
postMatrix: postMatrix
|
|
9637
|
-
} = this.attribute;
|
|
9638
|
-
if (0 !== x || 0 !== y || 0 !== dx || 0 !== dy || 1 !== scaleX || 1 !== scaleY || 0 !== angle || postMatrix) return super.doUpdateLocalMatrix();
|
|
9639
|
-
this._transMatrix.reset();
|
|
9640
|
-
}
|
|
9641
|
-
getGraphicTheme() {
|
|
9642
|
-
return getTheme(this).group;
|
|
9643
|
-
}
|
|
9644
|
-
updateAABBBounds(attribute, groupTheme, aabbBounds) {
|
|
9645
|
-
const originalAABBBounds = aabbBounds;
|
|
9646
|
-
aabbBounds = aabbBounds.clone();
|
|
9647
|
-
const {
|
|
9648
|
-
width: width,
|
|
9649
|
-
height: height,
|
|
9650
|
-
path: path,
|
|
9651
|
-
clip = groupTheme.clip
|
|
9652
|
-
} = attribute;
|
|
9653
|
-
if (path && path.length ? path.forEach(g => {
|
|
9654
|
-
aabbBounds.union(g.AABBBounds);
|
|
9655
|
-
}) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), !clip) {
|
|
9656
|
-
this.forEachChildren(node => {
|
|
9657
|
-
aabbBounds.union(node.AABBBounds);
|
|
9658
|
-
});
|
|
9659
|
-
const {
|
|
9660
|
-
scrollX = 0,
|
|
9661
|
-
scrollY = 0
|
|
9662
|
-
} = attribute;
|
|
9663
|
-
aabbBounds.translate(scrollX, scrollY);
|
|
9664
|
-
}
|
|
9665
|
-
return application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, this), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
|
|
9666
|
-
}
|
|
9667
|
-
doUpdateAABBBounds() {
|
|
9668
|
-
this.updateAABBBoundsStamp++;
|
|
9669
|
-
const bounds = super.doUpdateAABBBounds();
|
|
9670
|
-
return this.parent && this.parent.addChildUpdateBoundTag(), this._emitCustomEvent("AAABBBoundsChange"), bounds;
|
|
9671
|
-
}
|
|
9672
|
-
clearUpdateBoundTag() {
|
|
9673
|
-
this._updateTag &= UpdateTag.CLEAR_BOUNDS, this._childUpdateTag &= UpdateTag.CLEAR_BOUNDS;
|
|
9674
|
-
}
|
|
9675
|
-
addUpdateBoundTag() {
|
|
9676
|
-
this._updateTag |= UpdateTag.UPDATE_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag();
|
|
9677
|
-
}
|
|
9678
|
-
addChildUpdateBoundTag() {
|
|
9679
|
-
this._childUpdateTag & UpdateTag.UPDATE_BOUNDS || (this._childUpdateTag |= UpdateTag.UPDATE_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag());
|
|
9680
|
-
}
|
|
9681
|
-
getTheme() {
|
|
9682
|
-
return this.theme.getTheme(this);
|
|
9683
|
-
}
|
|
9684
|
-
incrementalAppendChild(node) {
|
|
9685
|
-
const data = super.appendChild(node);
|
|
9686
|
-
return data && (!this.stage || data.stage === this.stage && data.layer === this.layer ? data.onParentSharedStateTreeChanged && data.onParentSharedStateTreeChanged(this.stage, this.layer) : data.setStage(this.stage, this.layer)), this.addUpdateBoundTag(), this.getGraphicService().onAddIncremental(node, this, this.stage), data;
|
|
9687
|
-
}
|
|
9688
|
-
incrementalClearChild() {
|
|
9689
|
-
super.removeAllChild(), this.addUpdateBoundTag(), this.getGraphicService().onClearIncremental(this, this.stage);
|
|
9690
|
-
}
|
|
9691
|
-
_updateChildToStage(child) {
|
|
9692
|
-
return child && (!this.stage || child.stage === this.stage && child.layer === this.layer ? child.onParentSharedStateTreeChanged && child.onParentSharedStateTreeChanged(this.stage, this.layer) : child.setStage(this.stage, this.layer)), this.addUpdateBoundTag(), child;
|
|
9693
|
-
}
|
|
9694
|
-
appendChild(node, addStage = !0) {
|
|
9695
|
-
const data = super.appendChild(node);
|
|
9696
|
-
return data && (addStage && this.stage && (data.stage !== this.stage || data.layer !== this.layer) ? data.setStage(this.stage, this.layer) : data.onParentSharedStateTreeChanged && data.onParentSharedStateTreeChanged(this.stage, this.layer)), this.addUpdateBoundTag(), data;
|
|
9697
|
-
}
|
|
9698
|
-
insertBefore(newNode, referenceNode) {
|
|
9699
|
-
return this._updateChildToStage(super.insertBefore(newNode, referenceNode));
|
|
9700
|
-
}
|
|
9701
|
-
insertAfter(newNode, referenceNode) {
|
|
9702
|
-
return this._updateChildToStage(super.insertAfter(newNode, referenceNode));
|
|
9703
|
-
}
|
|
9704
|
-
insertInto(newNode, idx) {
|
|
9705
|
-
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
9706
|
-
}
|
|
9707
|
-
removeChild(child, highPerformance = !1) {
|
|
9708
|
-
var _a;
|
|
9709
|
-
const data = super.removeChild(child);
|
|
9710
|
-
return data ? highPerformance ? (null === (_a = child.detachStageForRelease) || void 0 === _a || _a.call(child), data) : (this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data) : data;
|
|
9711
|
-
}
|
|
9712
|
-
removeAllChild(deep = !1) {
|
|
9713
|
-
const children = this.children.slice();
|
|
9714
|
-
this.forEachChildren(child => {
|
|
9715
|
-
this.getGraphicService().onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
9716
|
-
}), super.removeAllChild(), children.forEach(child => {
|
|
9717
|
-
child.setStage(null, null);
|
|
9718
|
-
}), this.addUpdateBoundTag();
|
|
9719
|
-
}
|
|
9720
|
-
setStage(stage, layer) {
|
|
9721
|
-
var _a, _b, _c, _d, _e, _f;
|
|
9722
|
-
const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
|
|
9723
|
-
needsSharedStateTreeSync = this._hasSharedStateDefinitions || this.sharedStateScope || (null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty;
|
|
9724
|
-
if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.forEachChildren(item => {
|
|
9725
|
-
item.setStage(stage, this.layer);
|
|
9726
|
-
});
|
|
9727
|
-
const layerChanged = this.layer !== layer;
|
|
9728
|
-
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.forEachChildren(item => {
|
|
9729
|
-
item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
|
|
9730
|
-
});
|
|
9731
|
-
}
|
|
9732
|
-
addUpdatePositionTag() {
|
|
9733
|
-
super.addUpdatePositionTag(), this.forEachChildren(g => {
|
|
9734
|
-
g.isContainer && g.addUpdateGlobalPositionTag();
|
|
9735
|
-
});
|
|
9736
|
-
}
|
|
9737
|
-
addUpdateGlobalPositionTag() {
|
|
9738
|
-
super.addUpdateGlobalPositionTag(), this.forEachChildren(g => {
|
|
9739
|
-
g.isContainer && g.addUpdateGlobalPositionTag();
|
|
9740
|
-
});
|
|
9741
|
-
}
|
|
9742
|
-
tryUpdateGlobalTransMatrix(clearTag = !0) {
|
|
9743
|
-
if (this.shouldUpdateGlobalMatrix()) {
|
|
9744
|
-
if (this._globalTransMatrix) {
|
|
9745
|
-
if (this.parent) {
|
|
9746
|
-
const m = this.parent.globalTransMatrix;
|
|
9747
|
-
this._globalTransMatrix.setValue(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9748
|
-
}
|
|
9749
|
-
} else this._globalTransMatrix = this.parent ? this.parent.globalTransMatrix.clone() : this.transMatrix.clone();
|
|
9750
|
-
this.doUpdateGlobalMatrix(), clearTag && this.clearUpdateGlobalPositionTag();
|
|
9751
|
-
}
|
|
9752
|
-
return this._globalTransMatrix;
|
|
9753
|
-
}
|
|
9754
|
-
shouldUpdateGlobalMatrix() {
|
|
9755
|
-
return !!(this._updateTag & UpdateTag.UPDATE_GLOBAL_MATRIX);
|
|
9756
|
-
}
|
|
9757
|
-
_getChildByName(name, deep) {
|
|
9758
|
-
return this.find(node => node.name === name, deep);
|
|
9759
|
-
}
|
|
9760
|
-
createOrUpdateChild(graphicName, attributes, graphicType) {
|
|
9761
|
-
let graphic = this._getChildByName(graphicName);
|
|
9762
|
-
return graphic ? graphic.setAttributes(attributes) : (graphic = application.graphicService.creator[graphicType](attributes), graphic.name = graphicName, this.add(graphic)), graphic;
|
|
9763
|
-
}
|
|
9764
|
-
clone() {
|
|
9765
|
-
return new Group(Object.assign({}, this.attribute));
|
|
9766
|
-
}
|
|
9767
|
-
getNoWorkAnimateAttr() {
|
|
9768
|
-
return Group.NOWORK_ANIMATE_ATTR;
|
|
9769
|
-
}
|
|
9770
|
-
release(all) {
|
|
9771
|
-
all && this.forEachChildren(g => {
|
|
9772
|
-
g.release(all);
|
|
9773
|
-
}), super.release();
|
|
9774
|
-
}
|
|
9775
|
-
detachStageForRelease() {
|
|
9776
|
-
super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
|
|
9777
|
-
var _a;
|
|
9778
|
-
null === (_a = item.detachStageForRelease) || void 0 === _a || _a.call(item);
|
|
9779
|
-
});
|
|
9780
|
-
}
|
|
9781
|
-
ensureSharedStateScopeBound() {
|
|
9782
|
-
var _a, _b, _c;
|
|
9783
|
-
if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
|
|
9784
|
-
const parentScope = null !== (_b = null === (_a = this.parent) || void 0 === _a ? void 0 : _a.sharedStateScope) && void 0 !== _b ? _b : null === (_c = this.stage) || void 0 === _c ? void 0 : _c.rootSharedStateScope;
|
|
9785
|
-
this.sharedStateScope ? (this.sharedStateScope.ownerGroup = this, this.sharedStateScope.ownerStage = this.stage, setSharedStateScopeParent(this.sharedStateScope, parentScope), this.sharedStateScope.localStateDefinitions !== this._sharedStateDefinitions && setSharedStateScopeLocalDefinitions(this.sharedStateScope, this._sharedStateDefinitions)) : this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
|
|
9786
|
-
}
|
|
9787
|
-
hasSharedStateDefinitions() {
|
|
9788
|
-
return this._hasSharedStateDefinitions;
|
|
9789
|
-
}
|
|
9790
|
-
notifyChildrenSharedStateTreeChanged() {
|
|
9791
|
-
this.forEachChildren(item => {
|
|
9792
|
-
item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(this.stage, this.layer);
|
|
9793
|
-
});
|
|
9794
|
-
}
|
|
9795
|
-
onParentSharedStateTreeChanged(stage, layer) {
|
|
9796
|
-
var _a;
|
|
9797
|
-
this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)), this.notifyChildrenSharedStateTreeChanged()) : this.setStage(stage, layer);
|
|
9798
|
-
}
|
|
9799
|
-
}
|
|
9800
|
-
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
9801
|
-
function createGroup(attributes) {
|
|
9802
|
-
return new Group(attributes);
|
|
9803
|
-
}
|
|
9804
|
-
|
|
9805
9422
|
const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
9806
9423
|
class Polygon extends Graphic {
|
|
9807
9424
|
constructor(params) {
|
|
@@ -11124,8 +10741,8 @@ const EMPTY_AUTO_ENABLE_PROVIDER = {
|
|
|
11124
10741
|
};
|
|
11125
10742
|
class DefaultPluginService {
|
|
11126
10743
|
constructor(autoEnablePlugins = EMPTY_AUTO_ENABLE_PROVIDER, deps = {}) {
|
|
11127
|
-
var _a
|
|
11128
|
-
this.autoEnablePlugins = autoEnablePlugins, this.onStartupFinishedPlugin = [], this.onRegisterPlugin = [], this.actived = !1, this.pluginRegistry = null !== (_a = deps.pluginRegistry) && void 0 !== _a ? _a : new PluginRegistry()
|
|
10744
|
+
var _a;
|
|
10745
|
+
this.autoEnablePlugins = autoEnablePlugins, this.onStartupFinishedPlugin = [], this.onRegisterPlugin = [], this.actived = !1, this.pluginRegistry = null !== (_a = deps.pluginRegistry) && void 0 !== _a ? _a : new PluginRegistry();
|
|
11129
10746
|
}
|
|
11130
10747
|
active(stage, params) {
|
|
11131
10748
|
this.stage = stage, this.actived = !0;
|
|
@@ -15371,133 +14988,6 @@ function registerWrapTextGraphic() {
|
|
|
15371
14988
|
registerGraphic("wrapText", createWrapText);
|
|
15372
14989
|
}
|
|
15373
14990
|
|
|
15374
|
-
const GROUP_ATTRIBUTES = [
|
|
15375
|
-
'x',
|
|
15376
|
-
'y',
|
|
15377
|
-
'dx',
|
|
15378
|
-
'dy',
|
|
15379
|
-
'scaleX',
|
|
15380
|
-
'scaleY',
|
|
15381
|
-
'angle',
|
|
15382
|
-
'anchor',
|
|
15383
|
-
'postMatrix',
|
|
15384
|
-
'visible',
|
|
15385
|
-
'clip',
|
|
15386
|
-
'pickable',
|
|
15387
|
-
'childrenPickable',
|
|
15388
|
-
'zIndex',
|
|
15389
|
-
'cursor'
|
|
15390
|
-
];
|
|
15391
|
-
class AbstractComponent extends Group {
|
|
15392
|
-
constructor(attributes, options) {
|
|
15393
|
-
super(attributes);
|
|
15394
|
-
this._skipRenderAttributes = GROUP_ATTRIBUTES;
|
|
15395
|
-
if (options === null || options === void 0 ? void 0 : options.mode) {
|
|
15396
|
-
this.mode = options.mode;
|
|
15397
|
-
this.setMode(options.mode);
|
|
15398
|
-
}
|
|
15399
|
-
if (options === null || options === void 0 ? void 0 : options.skipDefault) {
|
|
15400
|
-
this.skipDefault = true;
|
|
15401
|
-
}
|
|
15402
|
-
this.setTheme({
|
|
15403
|
-
common: {
|
|
15404
|
-
strokeBoundsBuffer: 0
|
|
15405
|
-
}
|
|
15406
|
-
});
|
|
15407
|
-
this.attribute = attributes;
|
|
15408
|
-
this.onSetStage((_, stage) => {
|
|
15409
|
-
if (!stage) {
|
|
15410
|
-
return;
|
|
15411
|
-
}
|
|
15412
|
-
this.render();
|
|
15413
|
-
this.bindEvents();
|
|
15414
|
-
});
|
|
15415
|
-
}
|
|
15416
|
-
setAttribute(key, value, forceUpdateTag, context) {
|
|
15417
|
-
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);
|
|
15418
|
-
if (params) {
|
|
15419
|
-
return this._setAttributes(params, forceUpdateTag);
|
|
15420
|
-
}
|
|
15421
|
-
if (isPlainObject$3(this.attribute[key]) &&
|
|
15422
|
-
isPlainObject$3(value) &&
|
|
15423
|
-
!isFunction(this.attribute[key]) &&
|
|
15424
|
-
!isFunction(value)) {
|
|
15425
|
-
merge(this.attribute[key], value);
|
|
15426
|
-
}
|
|
15427
|
-
else {
|
|
15428
|
-
this.attribute[key] = value;
|
|
15429
|
-
}
|
|
15430
|
-
if (!this._skipRenderAttributes.includes(key)) {
|
|
15431
|
-
this.render();
|
|
15432
|
-
}
|
|
15433
|
-
this.valid = this.isValid();
|
|
15434
|
-
if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTag(key))) {
|
|
15435
|
-
this.addUpdateShapeAndBoundsTag();
|
|
15436
|
-
}
|
|
15437
|
-
else {
|
|
15438
|
-
this.addUpdateBoundTag();
|
|
15439
|
-
}
|
|
15440
|
-
this.addUpdatePositionTag();
|
|
15441
|
-
this.onAttributeUpdate();
|
|
15442
|
-
}
|
|
15443
|
-
setAttributes(params, forceUpdateTag, context) {
|
|
15444
|
-
params =
|
|
15445
|
-
(this.onBeforeAttributeUpdate &&
|
|
15446
|
-
this.onBeforeAttributeUpdate(params, this.attribute, null, context)) ||
|
|
15447
|
-
params;
|
|
15448
|
-
return this._setAttributes(params, forceUpdateTag);
|
|
15449
|
-
}
|
|
15450
|
-
_setAttributes(params, forceUpdateTag) {
|
|
15451
|
-
const keys = Object.keys(params);
|
|
15452
|
-
this._mergeAttributes(params, keys);
|
|
15453
|
-
if (!keys.every(key => this._skipRenderAttributes.includes(key))) {
|
|
15454
|
-
this.render();
|
|
15455
|
-
}
|
|
15456
|
-
this.valid = this.isValid();
|
|
15457
|
-
if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTags(keys))) {
|
|
15458
|
-
this.addUpdateShapeAndBoundsTag();
|
|
15459
|
-
}
|
|
15460
|
-
else {
|
|
15461
|
-
this.addUpdateBoundTag();
|
|
15462
|
-
}
|
|
15463
|
-
this.addUpdatePositionTag();
|
|
15464
|
-
this.onAttributeUpdate();
|
|
15465
|
-
}
|
|
15466
|
-
_mergeAttributes(params, keys) {
|
|
15467
|
-
if (isNil(keys)) {
|
|
15468
|
-
keys = Object.keys(params);
|
|
15469
|
-
}
|
|
15470
|
-
for (let i = 0; i < keys.length; i++) {
|
|
15471
|
-
const key = keys[i];
|
|
15472
|
-
if (isPlainObject$3(this.attribute[key]) && !isFunction(this.attribute[key]) && !isFunction(params[key])) {
|
|
15473
|
-
merge(this.attribute[key], params[key]);
|
|
15474
|
-
}
|
|
15475
|
-
else {
|
|
15476
|
-
this.attribute[key] = params[key];
|
|
15477
|
-
}
|
|
15478
|
-
}
|
|
15479
|
-
}
|
|
15480
|
-
bindEvents() {
|
|
15481
|
-
}
|
|
15482
|
-
_getNodeId(id) {
|
|
15483
|
-
var _a;
|
|
15484
|
-
return `${(_a = this.id) !== null && _a !== void 0 ? _a : this._uid}-${this.name}-${id}`;
|
|
15485
|
-
}
|
|
15486
|
-
_dispatchEvent(eventName, details) {
|
|
15487
|
-
var _a;
|
|
15488
|
-
const changeEvent = new CustomEvent(eventName, details);
|
|
15489
|
-
changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
|
|
15490
|
-
this.dispatchEvent(changeEvent);
|
|
15491
|
-
}
|
|
15492
|
-
eventPosToStagePos(e) {
|
|
15493
|
-
var _a, _b;
|
|
15494
|
-
const result = { x: 0, y: 0 };
|
|
15495
|
-
const stagePoints = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
15496
|
-
this.globalTransMatrix.transformPoint(stagePoints, result);
|
|
15497
|
-
return result;
|
|
15498
|
-
}
|
|
15499
|
-
}
|
|
15500
|
-
|
|
15501
14991
|
function _registerGroup() {
|
|
15502
14992
|
_registerGroup.__loaded || (_registerGroup.__loaded = !0, registerGroupGraphic());
|
|
15503
14993
|
}
|
|
@@ -20252,9 +19742,8 @@ class AnimateExecutor {
|
|
|
20252
19742
|
}
|
|
20253
19743
|
syncFinalAttrsFromContext(graphic) {
|
|
20254
19744
|
var _a;
|
|
20255
|
-
const finalAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.finalAttrs
|
|
20256
|
-
|
|
20257
|
-
finalAttrs && "function" == typeof setFinalAttributes && setFinalAttributes.call(graphic, finalAttrs);
|
|
19745
|
+
const finalAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.finalAttrs;
|
|
19746
|
+
finalAttrs && graphic.setFinalAttributes(finalAttrs);
|
|
20258
19747
|
}
|
|
20259
19748
|
executeItem(params, graphic, index = 0, count = 1) {
|
|
20260
19749
|
if (Array.isArray(params)) {
|
|
@@ -20572,11 +20061,9 @@ function getAnimationContext(type) {
|
|
|
20572
20061
|
}
|
|
20573
20062
|
}
|
|
20574
20063
|
function applyAnimationTransientAttributes(target, attributes, type = AttributeUpdateType.ANIMATE_UPDATE) {
|
|
20575
|
-
var _a;
|
|
20576
20064
|
if (!attributes) return;
|
|
20577
|
-
const context = getAnimationContext(type)
|
|
20578
|
-
|
|
20579
|
-
"function" != typeof transientTarget.applyAnimationTransientAttributes ? "function" != typeof transientTarget.applyTransientAttributes ? "function" != typeof transientTarget.setAttributesAndPreventAnimate ? (transientTarget.attribute || (transientTarget.attribute = {}), Object.assign(transientTarget.attribute, attributes), null === (_a = transientTarget.onAttributeUpdate) || void 0 === _a || _a.call(transientTarget, context)) : transientTarget.setAttributesAndPreventAnimate(attributes, !1, context) : transientTarget.applyTransientAttributes(attributes, !1, context) : transientTarget.applyAnimationTransientAttributes(attributes, !1, context);
|
|
20065
|
+
const context = getAnimationContext(type);
|
|
20066
|
+
target.applyAnimationTransientAttributes(attributes, !1, context);
|
|
20580
20067
|
}
|
|
20581
20068
|
|
|
20582
20069
|
function noop() {}
|
|
@@ -20588,8 +20075,7 @@ class Step {
|
|
|
20588
20075
|
constructor(type, props, duration, easing) {
|
|
20589
20076
|
var _a;
|
|
20590
20077
|
this._startTime = 0, this._hasFirstRun = !1, this._syncAttributeUpdate = () => {
|
|
20591
|
-
|
|
20592
|
-
null === (_b = (_a = this.target).addUpdateShapeAndBoundsTag) || void 0 === _b || _b.call(_a), null === (_d = (_c = this.target).addUpdatePositionTag) || void 0 === _d || _d.call(_c), null === (_f = (_e = this.target).onAttributeUpdate) || void 0 === _f || _f.call(_e, {
|
|
20078
|
+
this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag(), this.target.onAttributeUpdate({
|
|
20593
20079
|
type: AttributeUpdateType.ANIMATE_UPDATE
|
|
20594
20080
|
});
|
|
20595
20081
|
}, this.type = type, this.props = props, this.duration = duration, this.easing = easing ? "function" == typeof easing ? easing : null !== (_a = Easing[easing]) && void 0 !== _a ? _a : Easing.linear : Easing.linear, "wait" === type && (this.onUpdate = noop), this.id = Generator.GenAutoIncrementId(), this.syncAttributeUpdate = noop;
|
|
@@ -20662,15 +20148,10 @@ class Step {
|
|
|
20662
20148
|
}
|
|
20663
20149
|
}
|
|
20664
20150
|
tryPreventConflict() {
|
|
20665
|
-
var _a, _b;
|
|
20666
20151
|
const animate = this.animate,
|
|
20667
20152
|
target = this.target,
|
|
20668
|
-
forEachTrackedAnimate = null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
|
|
20669
|
-
var _a;
|
|
20670
|
-
null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
|
|
20671
|
-
},
|
|
20672
20153
|
propKeys = this.propKeys;
|
|
20673
|
-
forEachTrackedAnimate(a => {
|
|
20154
|
+
target.forEachTrackedAnimate(a => {
|
|
20674
20155
|
if (a === animate || a.priority > animate.priority || a.priority === 1 / 0) return;
|
|
20675
20156
|
const fromProps = a.getStartProps();
|
|
20676
20157
|
let conflictKeys = null;
|
|
@@ -21993,7 +21474,7 @@ const getCartesianLabelBounds = (scale, domain, op) => {
|
|
|
21993
21474
|
for (let i = 0; i < domain.length; i++) {
|
|
21994
21475
|
const v = domain[i];
|
|
21995
21476
|
const str = labelFormatter ? labelFormatter(v) : `${v}`;
|
|
21996
|
-
if (isPlainObject$
|
|
21477
|
+
if (isPlainObject$2(str)) {
|
|
21997
21478
|
labelBoundsList = undefined;
|
|
21998
21479
|
break;
|
|
21999
21480
|
}
|
|
@@ -27594,19 +27075,13 @@ class FromTo extends ACustomAnimate {
|
|
|
27594
27075
|
super(from, to, duration, easing, params), this.from = null != from ? from : {};
|
|
27595
27076
|
}
|
|
27596
27077
|
applyTransientFromAttributes() {
|
|
27597
|
-
|
|
27598
|
-
const target = this.target;
|
|
27599
|
-
"function" != typeof target.applyTransientAttributes ? (Object.assign(null !== (_a = target.attribute) && void 0 !== _a ? _a : {}, this.from), null === (_b = target.onAttributeUpdate) || void 0 === _b || _b.call(target, {
|
|
27600
|
-
type: AttributeUpdateType.ANIMATE_START
|
|
27601
|
-
})) : target.applyTransientAttributes(this.from, !1, {
|
|
27602
|
-
type: AttributeUpdateType.ANIMATE_START
|
|
27603
|
-
});
|
|
27078
|
+
applyAnimationTransientAttributes(this.target, this.from, AttributeUpdateType.ANIMATE_START);
|
|
27604
27079
|
}
|
|
27605
27080
|
onBind() {
|
|
27606
|
-
var _a, _b, _c
|
|
27081
|
+
var _a, _b, _c;
|
|
27607
27082
|
super.onBind(), Object.keys(this.from).forEach(key => {
|
|
27608
27083
|
null == this.props[key] && (this.props[key] = this.target.getGraphicAttribute(key));
|
|
27609
|
-
}), "appear" === (null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.animationState) &&
|
|
27084
|
+
}), "appear" === (null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.animationState) && this.target.applyFinalAttributeToAttribute(), !1 !== (null === (_c = null === (_b = this.params) || void 0 === _b ? void 0 : _b.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.applyTransientFromAttributes();
|
|
27610
27085
|
}
|
|
27611
27086
|
onFirstRun() {
|
|
27612
27087
|
this.from = Object.assign(Object.assign({}, this.getLastProps()), this.from);
|
|
@@ -27667,8 +27142,8 @@ class Animate {
|
|
|
27667
27142
|
bind(target) {
|
|
27668
27143
|
this.target = target;
|
|
27669
27144
|
const trackerTarget = this.target;
|
|
27670
|
-
return
|
|
27671
|
-
this.stop(), this.__skipRestoreStaticAttributeOnRemove ||
|
|
27145
|
+
return trackerTarget.detachAttributeFromBaseAttributes(), trackerTarget.trackAnimate(this), this.onRemove(() => {
|
|
27146
|
+
this.stop(), this.__skipRestoreStaticAttributeOnRemove || trackerTarget.restoreStaticAttribute(), trackerTarget.untrackAnimate(this.id);
|
|
27672
27147
|
}), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
|
|
27673
27148
|
}
|
|
27674
27149
|
to(props, duration = 300, easing = "linear") {
|
|
@@ -27805,8 +27280,7 @@ class Animate {
|
|
|
27805
27280
|
if (nextTime < this._startTime) return void (this.currentTime = nextTime);
|
|
27806
27281
|
if (nextTime >= this._startTime + this._totalDuration) {
|
|
27807
27282
|
null === (_a = this._lastStep) || void 0 === _a || _a.onUpdate(!0, 1, {}), null === (_b = this._lastStep) || void 0 === _b || _b.onEnd(), this.onEnd(), this.status = AnimateStatus.END;
|
|
27808
|
-
|
|
27809
|
-
return "function" == typeof (null == trackerTarget ? void 0 : trackerTarget.restoreStaticAttribute) && trackerTarget.restoreStaticAttribute(), void (this.__skipRestoreStaticAttributeOnRemove = !0);
|
|
27283
|
+
return this.target.restoreStaticAttribute(), void (this.__skipRestoreStaticAttributeOnRemove = !0);
|
|
27810
27284
|
}
|
|
27811
27285
|
this.status = AnimateStatus.RUNNING, this.currentTime <= this._startTime && this.onStart(), this.currentTime = nextTime;
|
|
27812
27286
|
let cycleTime = nextTime - this._startTime,
|
|
@@ -27980,8 +27454,7 @@ class DefaultTicker extends EventEmitter {
|
|
|
27980
27454
|
|
|
27981
27455
|
class AnimateExtension {
|
|
27982
27456
|
visitTrackedAnimates(cb) {
|
|
27983
|
-
|
|
27984
|
-
"function" != typeof target.forEachTrackedAnimate ? target.animates && target.animates.forEach(cb) : target.forEachTrackedAnimate(cb);
|
|
27457
|
+
this.forEachTrackedAnimate(cb);
|
|
27985
27458
|
}
|
|
27986
27459
|
getAttributes(final = !1) {
|
|
27987
27460
|
return final && this.finalAttribute ? this.finalAttribute : this.attribute;
|
|
@@ -28017,15 +27490,12 @@ class AnimateExtension {
|
|
|
28017
27490
|
applyFinalAttributeToAttribute() {
|
|
28018
27491
|
const finalAttribute = this.getFinalAttribute();
|
|
28019
27492
|
if (!finalAttribute) return;
|
|
28020
|
-
|
|
28021
|
-
"function" != typeof target.setAttributesAndPreventAnimate ? console.warn("[AnimateExtension] applyFinalAttributeToAttribute requires target.setAttributesAndPreventAnimate() to avoid committing finalAttribute into base attributes.") : target.setAttributesAndPreventAnimate(finalAttribute, !1, {
|
|
27493
|
+
this.setAttributesAndPreventAnimate(finalAttribute, !1, {
|
|
28022
27494
|
type: AttributeUpdateType.ANIMATE_BIND
|
|
28023
27495
|
});
|
|
28024
27496
|
}
|
|
28025
27497
|
restoreStaticAttribute() {
|
|
28026
|
-
|
|
28027
|
-
if ("function" != typeof target._restoreAttributeFromStaticTruth) return "function" == typeof target.onStop ? (console.warn("[AnimateExtension] restoreStaticAttribute is using deprecated target.onStop(); implement _restoreAttributeFromStaticTruth() for explicit transient restore semantics."), void target.onStop()) : void console.warn("[AnimateExtension] restoreStaticAttribute requires target._restoreAttributeFromStaticTruth() or an equivalent transient restore path.");
|
|
28028
|
-
target._restoreAttributeFromStaticTruth({
|
|
27498
|
+
this._restoreAttributeFromStaticTruth({
|
|
28029
27499
|
type: AttributeUpdateType.ANIMATE_END
|
|
28030
27500
|
});
|
|
28031
27501
|
}
|
|
@@ -36938,6 +36408,6 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
36938
36408
|
select: true
|
|
36939
36409
|
};
|
|
36940
36410
|
|
|
36941
|
-
const version = "1.1.0-alpha.
|
|
36411
|
+
const version = "1.1.0-alpha.25";
|
|
36942
36412
|
|
|
36943
36413
|
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IDataZoomEvent, IDataZoomInteractiveEvent, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SeriesNumberCellStateValue, SeriesNumberEvent, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, TableSeriesNumber, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, installPoptipToApp, installScrollbarToApp, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|