@visactor/vrender-components 1.1.0-alpha.24 → 1.1.0-alpha.26
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/README.md +9 -1
- 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/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 +1090 -1810
- 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/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 +272 -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
|
};
|
|
@@ -3226,193 +2864,6 @@ const builtInSymbolStrMap = {
|
|
|
3226
2864
|
roundLine: "M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"
|
|
3227
2865
|
};
|
|
3228
2866
|
|
|
3229
|
-
function getAllMatches(string, regex) {
|
|
3230
|
-
const matches = [];
|
|
3231
|
-
let match = regex.exec(string);
|
|
3232
|
-
for (; match;) {
|
|
3233
|
-
const allmatches = [];
|
|
3234
|
-
allmatches.startIndex = regex.lastIndex - match[0].length;
|
|
3235
|
-
const len = match.length;
|
|
3236
|
-
for (let index = 0; index < len; index++) allmatches.push(match[index]);
|
|
3237
|
-
matches.push(allmatches), match = regex.exec(string);
|
|
3238
|
-
}
|
|
3239
|
-
return matches;
|
|
3240
|
-
}
|
|
3241
|
-
|
|
3242
|
-
class XmlNode {
|
|
3243
|
-
constructor(tagname) {
|
|
3244
|
-
this.tagname = tagname, this.child = [], this[":@"] = {};
|
|
3245
|
-
}
|
|
3246
|
-
add(key, val) {
|
|
3247
|
-
"__proto__" === key && (key = "#__proto__"), this.child.push({
|
|
3248
|
-
[key]: val
|
|
3249
|
-
});
|
|
3250
|
-
}
|
|
3251
|
-
addChild(node) {
|
|
3252
|
-
"__proto__" === node.tagname && (node.tagname = "#__proto__"), node[":@"] && Object.keys(node[":@"]).length > 0 ? this.child.push({
|
|
3253
|
-
[node.tagname]: node.child,
|
|
3254
|
-
":@": node[":@"]
|
|
3255
|
-
}) : this.child.push({
|
|
3256
|
-
[node.tagname]: node.child
|
|
3257
|
-
});
|
|
3258
|
-
}
|
|
3259
|
-
}
|
|
3260
|
-
function findClosingIndex(xmlData, str, i, errMsg) {
|
|
3261
|
-
const closingIndex = xmlData.indexOf(str, i);
|
|
3262
|
-
if (-1 === closingIndex) throw new Error(errMsg);
|
|
3263
|
-
return closingIndex + str.length - 1;
|
|
3264
|
-
}
|
|
3265
|
-
function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
|
|
3266
|
-
let attrBoundary,
|
|
3267
|
-
tagExp = "";
|
|
3268
|
-
for (let index = i; index < xmlData.length; index++) {
|
|
3269
|
-
let ch = xmlData[index];
|
|
3270
|
-
if (attrBoundary) ch === attrBoundary && (attrBoundary = "");else if ('"' === ch || "'" === ch) attrBoundary = ch;else if (ch === closingChar[0]) {
|
|
3271
|
-
if (!closingChar[1]) return {
|
|
3272
|
-
data: tagExp,
|
|
3273
|
-
index: index
|
|
3274
|
-
};
|
|
3275
|
-
if (xmlData[index + 1] === closingChar[1]) return {
|
|
3276
|
-
data: tagExp,
|
|
3277
|
-
index: index
|
|
3278
|
-
};
|
|
3279
|
-
} else "\t" === ch && (ch = " ");
|
|
3280
|
-
tagExp += ch;
|
|
3281
|
-
}
|
|
3282
|
-
}
|
|
3283
|
-
function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
3284
|
-
const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
|
|
3285
|
-
if (!result) return;
|
|
3286
|
-
let tagExp = result.data;
|
|
3287
|
-
const closeIndex = result.index,
|
|
3288
|
-
separatorIndex = tagExp.search(/\s/);
|
|
3289
|
-
let tagName = tagExp,
|
|
3290
|
-
attrExpPresent = !0;
|
|
3291
|
-
-1 !== separatorIndex && (tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, ""), tagExp = tagExp.substr(separatorIndex + 1));
|
|
3292
|
-
const rawTagName = tagName;
|
|
3293
|
-
if (removeNSPrefix) {
|
|
3294
|
-
const colonIndex = tagName.indexOf(":");
|
|
3295
|
-
-1 !== colonIndex && (tagName = tagName.substr(colonIndex + 1), attrExpPresent = tagName !== result.data.substr(colonIndex + 1));
|
|
3296
|
-
}
|
|
3297
|
-
return {
|
|
3298
|
-
tagName: tagName,
|
|
3299
|
-
tagExp: tagExp,
|
|
3300
|
-
closeIndex: closeIndex,
|
|
3301
|
-
attrExpPresent: attrExpPresent,
|
|
3302
|
-
rawTagName: rawTagName
|
|
3303
|
-
};
|
|
3304
|
-
}
|
|
3305
|
-
const attrsRegx = new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?", "gm");
|
|
3306
|
-
class OrderedObjParser {
|
|
3307
|
-
constructor(options) {
|
|
3308
|
-
this.currentNode = null, this.options = options, this.tagsNodeStack = [], this.docTypeEntities = {};
|
|
3309
|
-
}
|
|
3310
|
-
addChild(currentNode, childNode, jPath) {
|
|
3311
|
-
const result = childNode.tagname;
|
|
3312
|
-
"string" == typeof result ? (childNode.tagname = result, currentNode.addChild(childNode)) : currentNode.addChild(childNode);
|
|
3313
|
-
}
|
|
3314
|
-
buildAttributesMap(attrStr, jPath, tagName) {
|
|
3315
|
-
const attrs = {};
|
|
3316
|
-
if (!attrStr) return;
|
|
3317
|
-
const matches = getAllMatches(attrStr, attrsRegx),
|
|
3318
|
-
len = matches.length;
|
|
3319
|
-
for (let i = 0; i < len; i++) {
|
|
3320
|
-
const attrName = matches[i][1],
|
|
3321
|
-
oldVal = matches[i][4],
|
|
3322
|
-
aName = attrName;
|
|
3323
|
-
attrName && (attrs[aName] = void 0 === oldVal || (isNaN(oldVal) ? oldVal : Number(oldVal)));
|
|
3324
|
-
}
|
|
3325
|
-
return attrs;
|
|
3326
|
-
}
|
|
3327
|
-
parseXml(xmlData) {
|
|
3328
|
-
xmlData = xmlData.replace(/\r\n?/g, "\n");
|
|
3329
|
-
const xmlObj = new XmlNode("!xml");
|
|
3330
|
-
let currentNode = xmlObj,
|
|
3331
|
-
textData = "",
|
|
3332
|
-
jPath = "";
|
|
3333
|
-
for (let i = 0; i < xmlData.length; i++) {
|
|
3334
|
-
if ("<" === xmlData[i]) {
|
|
3335
|
-
if ("/" === xmlData[i + 1]) {
|
|
3336
|
-
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed."),
|
|
3337
|
-
propIndex = jPath.lastIndexOf(".");
|
|
3338
|
-
jPath = jPath.substring(0, propIndex), currentNode = this.tagsNodeStack.pop(), currentNode && currentNode.child && textData && currentNode.child[currentNode.child.length - 1][":@"] && (currentNode.child[currentNode.child.length - 1][":@"].text = textData), textData = "", i = closeIndex;
|
|
3339
|
-
} else if ("?" === xmlData[i + 1]) {
|
|
3340
|
-
i = readTagExp(xmlData, i, !1, "?>").closeIndex + 1;
|
|
3341
|
-
} else if ("!--" === xmlData.substr(i + 1, 3)) {
|
|
3342
|
-
i = findClosingIndex(xmlData, "--\x3e", i + 4, "Comment is not closed.");
|
|
3343
|
-
} else {
|
|
3344
|
-
const result = readTagExp(xmlData, i, !1);
|
|
3345
|
-
let tagName = result.tagName,
|
|
3346
|
-
tagExp = result.tagExp;
|
|
3347
|
-
const attrExpPresent = result.attrExpPresent,
|
|
3348
|
-
closeIndex = result.closeIndex;
|
|
3349
|
-
if (tagName !== xmlObj.tagname && (jPath += jPath ? "." + tagName : tagName), tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
3350
|
-
"/" === tagName[tagName.length - 1] ? (tagName = tagName.substr(0, tagName.length - 1), jPath = jPath.substr(0, jPath.length - 1), tagExp = tagName) : tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
3351
|
-
const childNode = new XmlNode(tagName);
|
|
3352
|
-
tagName !== tagExp && attrExpPresent && (childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName)), this.addChild(currentNode, childNode, jPath), jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
3353
|
-
} else {
|
|
3354
|
-
const childNode = new XmlNode(tagName);
|
|
3355
|
-
this.tagsNodeStack.push(currentNode), tagName !== tagExp && attrExpPresent && (childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName)), this.addChild(currentNode, childNode, jPath), currentNode = childNode;
|
|
3356
|
-
}
|
|
3357
|
-
textData = "", i = closeIndex;
|
|
3358
|
-
}
|
|
3359
|
-
} else textData += xmlData[i];
|
|
3360
|
-
}
|
|
3361
|
-
return xmlObj.child;
|
|
3362
|
-
}
|
|
3363
|
-
}
|
|
3364
|
-
|
|
3365
|
-
function prettify(node, options) {
|
|
3366
|
-
return compress(node);
|
|
3367
|
-
}
|
|
3368
|
-
function compress(arr, jPath) {
|
|
3369
|
-
const compressedObj = {};
|
|
3370
|
-
for (let i = 0; i < arr.length; i++) {
|
|
3371
|
-
const tagObj = arr[i],
|
|
3372
|
-
property = propName(tagObj);
|
|
3373
|
-
if (void 0 !== property && tagObj[property]) {
|
|
3374
|
-
const val = compress(tagObj[property]);
|
|
3375
|
-
isLeafTag(val);
|
|
3376
|
-
tagObj[":@"] && assignAttributes(val, tagObj[":@"]), void 0 !== compressedObj[property] && compressedObj.hasOwnProperty(property) ? (Array.isArray(compressedObj[property]) || (compressedObj[property] = [compressedObj[property]]), compressedObj[property].push(val)) : compressedObj[property] = val;
|
|
3377
|
-
}
|
|
3378
|
-
}
|
|
3379
|
-
return compressedObj;
|
|
3380
|
-
}
|
|
3381
|
-
function propName(obj) {
|
|
3382
|
-
const keys = Object.keys(obj);
|
|
3383
|
-
for (let i = 0; i < keys.length; i++) {
|
|
3384
|
-
const key = keys[i];
|
|
3385
|
-
if (":@" !== key) return key;
|
|
3386
|
-
}
|
|
3387
|
-
}
|
|
3388
|
-
function assignAttributes(obj, attrMap, jpath) {
|
|
3389
|
-
if (attrMap) {
|
|
3390
|
-
const keys = Object.keys(attrMap),
|
|
3391
|
-
len = keys.length;
|
|
3392
|
-
for (let i = 0; i < len; i++) {
|
|
3393
|
-
const atrrName = keys[i];
|
|
3394
|
-
obj[atrrName] = attrMap[atrrName];
|
|
3395
|
-
}
|
|
3396
|
-
}
|
|
3397
|
-
}
|
|
3398
|
-
function isLeafTag(obj) {
|
|
3399
|
-
return 0 === Object.keys(obj).length;
|
|
3400
|
-
}
|
|
3401
|
-
|
|
3402
|
-
class XMLParser {
|
|
3403
|
-
constructor(options) {
|
|
3404
|
-
this.options = Object.assign({}, XMLParser.defaultOptions, options);
|
|
3405
|
-
}
|
|
3406
|
-
valid(xml) {
|
|
3407
|
-
return xml.startsWith("<");
|
|
3408
|
-
}
|
|
3409
|
-
parse(xmlData) {
|
|
3410
|
-
if (!this.valid) return !1;
|
|
3411
|
-
const orderedResult = new OrderedObjParser(this.options).parseXml(xmlData);
|
|
3412
|
-
return prettify(orderedResult, this.options);
|
|
3413
|
-
}
|
|
3414
|
-
}
|
|
3415
|
-
XMLParser.defaultOptions = {};
|
|
3416
2867
|
function isSvg(str) {
|
|
3417
2868
|
return str.startsWith("<svg") || str.startsWith("<?xml");
|
|
3418
2869
|
}
|
|
@@ -4678,8 +4129,8 @@ function getConicGradientAt(x, y, angle, color) {
|
|
|
4678
4129
|
return percent = (percent - startStop.offset) / (endStop.offset - startStop.offset), interpolateColor(startStop.color, endStop.color, percent, !1);
|
|
4679
4130
|
}
|
|
4680
4131
|
|
|
4681
|
-
const FULL_DEFINITION_KEYS
|
|
4682
|
-
function isPlainObject$
|
|
4132
|
+
const FULL_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]);
|
|
4133
|
+
function isPlainObject$1(value) {
|
|
4683
4134
|
return null != value && "object" == typeof value && !Array.isArray(value);
|
|
4684
4135
|
}
|
|
4685
4136
|
function normalizePatch(value) {
|
|
@@ -4725,12 +4176,11 @@ class StateDefinitionCompiler {
|
|
|
4725
4176
|
priority: 0,
|
|
4726
4177
|
patch: void 0
|
|
4727
4178
|
};
|
|
4728
|
-
if ((isPlainObject$
|
|
4179
|
+
if ((isPlainObject$1(value) ? Object.keys(value) : []).some(key => FULL_DEFINITION_KEYS.has(key))) {
|
|
4729
4180
|
const definition = value;
|
|
4730
4181
|
return {
|
|
4731
4182
|
name: null !== (_a = definition.name) && void 0 !== _a ? _a : name,
|
|
4732
4183
|
priority: null !== (_b = definition.priority) && void 0 !== _b ? _b : 0,
|
|
4733
|
-
rank: definition.rank,
|
|
4734
4184
|
patch: normalizePatch(definition.patch),
|
|
4735
4185
|
resolver: definition.resolver,
|
|
4736
4186
|
declaredAffectedKeys: definition.declaredAffectedKeys,
|
|
@@ -4750,253 +4200,40 @@ class StateDefinitionCompiler {
|
|
|
4750
4200
|
rawRelationMap.set(name, new Set(definition[relation]));
|
|
4751
4201
|
}), compiled.forEach((definition, origin) => {
|
|
4752
4202
|
const closure = new Set(),
|
|
4753
|
-
walk = (stateName,
|
|
4203
|
+
walk = (stateName, visiting) => {
|
|
4754
4204
|
const nextStates = rawRelationMap.get(stateName);
|
|
4755
4205
|
nextStates && nextStates.size && nextStates.forEach(nextState => {
|
|
4756
|
-
nextState
|
|
4206
|
+
nextState === origin || visiting.has(nextState) || closure.has(nextState) || (closure.add(nextState), visiting.add(nextState), walk(nextState, visiting), visiting.delete(nextState));
|
|
4757
4207
|
});
|
|
4758
4208
|
};
|
|
4759
|
-
walk(origin, [origin]), definition[relation] = closure;
|
|
4760
|
-
});
|
|
4761
|
-
}
|
|
4762
|
-
}
|
|
4763
|
-
|
|
4764
|
-
var UpdateCategory;
|
|
4765
|
-
!function (UpdateCategory) {
|
|
4766
|
-
UpdateCategory[UpdateCategory.NONE = 0] = "NONE", UpdateCategory[UpdateCategory.PAINT = 1] = "PAINT", UpdateCategory[UpdateCategory.SHAPE = 2] = "SHAPE", UpdateCategory[UpdateCategory.BOUNDS = 4] = "BOUNDS", UpdateCategory[UpdateCategory.TRANSFORM = 8] = "TRANSFORM", UpdateCategory[UpdateCategory.LAYOUT = 16] = "LAYOUT", UpdateCategory[UpdateCategory.PICK = 32] = "PICK";
|
|
4767
|
-
}(UpdateCategory || (UpdateCategory = {}));
|
|
4768
|
-
const ATTRIBUTE_CATEGORY = {
|
|
4769
|
-
fill: UpdateCategory.PAINT,
|
|
4770
|
-
opacity: UpdateCategory.PAINT,
|
|
4771
|
-
fillOpacity: UpdateCategory.PAINT,
|
|
4772
|
-
strokeOpacity: UpdateCategory.PAINT,
|
|
4773
|
-
lineDash: UpdateCategory.PAINT,
|
|
4774
|
-
lineDashOffset: UpdateCategory.PAINT,
|
|
4775
|
-
lineCap: UpdateCategory.PAINT,
|
|
4776
|
-
lineJoin: UpdateCategory.PAINT,
|
|
4777
|
-
miterLimit: UpdateCategory.PAINT,
|
|
4778
|
-
shadowColor: UpdateCategory.PAINT,
|
|
4779
|
-
x: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4780
|
-
y: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4781
|
-
scaleX: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4782
|
-
scaleY: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4783
|
-
angle: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4784
|
-
anchor: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4785
|
-
anchor3d: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4786
|
-
postMatrix: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4787
|
-
layout: UpdateCategory.LAYOUT,
|
|
4788
|
-
zIndex: UpdateCategory.PAINT,
|
|
4789
|
-
visible: UpdateCategory.PAINT | UpdateCategory.PICK,
|
|
4790
|
-
lineWidth: UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.PICK,
|
|
4791
|
-
width: UpdateCategory.SHAPE | UpdateCategory.BOUNDS,
|
|
4792
|
-
height: UpdateCategory.SHAPE | UpdateCategory.BOUNDS
|
|
4793
|
-
};
|
|
4794
|
-
const ATTRIBUTE_DELTA_CLASSIFIER = {
|
|
4795
|
-
stroke: (prev, next) => (null != prev && !1 !== prev) !== (null != next && !1 !== next) ? UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK : UpdateCategory.PAINT,
|
|
4796
|
-
shadowBlur: (prev, next) => {
|
|
4797
|
-
const prevBlur = Number(null != prev ? prev : 0),
|
|
4798
|
-
nextBlur = Number(null != next ? next : 0);
|
|
4799
|
-
return prevBlur !== nextBlur && (prevBlur > 0 || nextBlur > 0) ? UpdateCategory.PAINT | UpdateCategory.BOUNDS : UpdateCategory.PAINT;
|
|
4800
|
-
}
|
|
4801
|
-
};
|
|
4802
|
-
function classifyAttributeDelta(key, prev, next) {
|
|
4803
|
-
var _a;
|
|
4804
|
-
const dynamicClassifier = ATTRIBUTE_DELTA_CLASSIFIER[key];
|
|
4805
|
-
return dynamicClassifier ? dynamicClassifier(prev, next) : null !== (_a = ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : UpdateCategory.PAINT;
|
|
4806
|
-
}
|
|
4807
|
-
|
|
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
|
|
4209
|
+
walk(origin, new Set([origin])), definition[relation] = closure;
|
|
4946
4210
|
});
|
|
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
4211
|
}
|
|
4961
4212
|
}
|
|
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
4213
|
|
|
4976
|
-
function isPlainObject
|
|
4214
|
+
function isPlainObject(value) {
|
|
4977
4215
|
return null != value && "object" == typeof value && !Array.isArray(value);
|
|
4978
4216
|
}
|
|
4979
|
-
function cloneValue
|
|
4980
|
-
if (!isPlainObject
|
|
4217
|
+
function cloneValue(value) {
|
|
4218
|
+
if (!isPlainObject(value)) return value;
|
|
4981
4219
|
const clone = {};
|
|
4982
4220
|
return Object.keys(value).forEach(key => {
|
|
4983
|
-
clone[key] = cloneValue
|
|
4221
|
+
clone[key] = cloneValue(value[key]);
|
|
4984
4222
|
}), clone;
|
|
4985
4223
|
}
|
|
4986
|
-
function deepMerge
|
|
4224
|
+
function deepMerge(base, value) {
|
|
4987
4225
|
var _a;
|
|
4988
|
-
const result = null !== (_a = cloneValue
|
|
4226
|
+
const result = null !== (_a = cloneValue(base)) && void 0 !== _a ? _a : {};
|
|
4989
4227
|
return Object.keys(value).forEach(key => {
|
|
4990
4228
|
const nextValue = value[key],
|
|
4991
4229
|
previousValue = result[key];
|
|
4992
|
-
isPlainObject
|
|
4230
|
+
isPlainObject(previousValue) && isPlainObject(nextValue) ? result[key] = deepMerge(previousValue, nextValue) : result[key] = cloneValue(nextValue);
|
|
4993
4231
|
}), result;
|
|
4994
4232
|
}
|
|
4995
|
-
const FULL_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]);
|
|
4996
4233
|
class StateEngine {
|
|
4997
4234
|
constructor(options) {
|
|
4998
4235
|
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.
|
|
4236
|
+
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";
|
|
5000
4237
|
}
|
|
5001
4238
|
get activeStates() {
|
|
5002
4239
|
return this._activeStates;
|
|
@@ -5066,23 +4303,11 @@ class StateEngine {
|
|
|
5066
4303
|
};
|
|
5067
4304
|
}
|
|
5068
4305
|
invalidateResolverCache() {
|
|
5069
|
-
|
|
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");
|
|
4306
|
+
this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1;
|
|
5071
4307
|
}
|
|
5072
4308
|
hasState(stateName) {
|
|
5073
4309
|
return !!this._activeStates.length && (null == stateName || this._activeStates.includes(stateName));
|
|
5074
4310
|
}
|
|
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
4311
|
sortStates(states) {
|
|
5087
4312
|
const withDefinition = [],
|
|
5088
4313
|
withoutDefinition = [];
|
|
@@ -5113,68 +4338,33 @@ class StateEngine {
|
|
|
5113
4338
|
};
|
|
5114
4339
|
}
|
|
5115
4340
|
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
4341
|
const cacheKey = effectiveStates.join(","),
|
|
5121
|
-
nextPatch = {}
|
|
5122
|
-
|
|
4342
|
+
nextPatch = {},
|
|
4343
|
+
useResolverCache = this.resolverCacheValid && this.resolverCacheKey === cacheKey;
|
|
4344
|
+
useResolverCache || (this.resolverPatchCache.clear(), this.resolverCacheKey = cacheKey), effectiveStates.forEach(stateName => {
|
|
5123
4345
|
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
4346
|
const definition = this.compiledDefinitions.get(stateName);
|
|
5128
|
-
if (definition) {
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
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);
|
|
4347
|
+
if (definition && (definition.patch && this.mergeInto(nextPatch, definition.patch), definition.hasResolver)) {
|
|
4348
|
+
const resolverPatch = useResolverCache ? this.resolverPatchCache.get(stateName) : null === (_a = definition.resolver) || void 0 === _a ? void 0 : _a.call(definition, {
|
|
4349
|
+
graphic: this.graphic,
|
|
4350
|
+
activeStates: this._activeStates,
|
|
4351
|
+
effectiveStates: this._effectiveStates,
|
|
4352
|
+
baseAttributes: this.baseAttributes,
|
|
4353
|
+
resolvedPatch: nextPatch
|
|
4354
|
+
});
|
|
4355
|
+
resolverPatch && (useResolverCache || this.resolverPatchCache.set(stateName, resolverPatch), this.mergeInto(nextPatch, resolverPatch));
|
|
5163
4356
|
}
|
|
5164
|
-
}), this.resolverCacheValid = !0), this._resolvedPatch = nextPatch
|
|
5165
|
-
const totalCost = performance.now() - patchStart;
|
|
5166
|
-
perfMonitor.recordCost("patch", Math.max(0, totalCost - resolverCost));
|
|
5167
|
-
}
|
|
4357
|
+
}), useResolverCache || (this.resolverCacheValid = !0), this._resolvedPatch = nextPatch;
|
|
5168
4358
|
}
|
|
5169
4359
|
mergeInto(target, patch) {
|
|
5170
4360
|
"deep" !== this.mergeMode ? Object.keys(patch).forEach(key => {
|
|
5171
|
-
target[key] = cloneValue
|
|
4361
|
+
target[key] = cloneValue(patch[key]);
|
|
5172
4362
|
}) : Object.keys(patch).forEach(key => {
|
|
5173
4363
|
var _a;
|
|
5174
4364
|
const nextValue = patch[key],
|
|
5175
4365
|
previousValue = target[key],
|
|
5176
4366
|
baseValue = null === (_a = this.baseAttributes) || void 0 === _a ? void 0 : _a[key];
|
|
5177
|
-
isPlainObject
|
|
4367
|
+
isPlainObject(previousValue) && isPlainObject(nextValue) ? target[key] = deepMerge(previousValue, nextValue) : !isPlainObject(previousValue) && isPlainObject(baseValue) && isPlainObject(nextValue) ? target[key] = deepMerge(baseValue, nextValue) : target[key] = cloneValue(nextValue);
|
|
5178
4368
|
});
|
|
5179
4369
|
}
|
|
5180
4370
|
sameArray(left, right) {
|
|
@@ -5182,186 +4372,50 @@ class StateEngine {
|
|
|
5182
4372
|
for (let index = 0; index < left.length; index++) if (left[index] !== right[index]) return !1;
|
|
5183
4373
|
return !0;
|
|
5184
4374
|
}
|
|
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
4375
|
}
|
|
5324
4376
|
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
} else resolvedAttrs[key] = cloneValue(nextValue);
|
|
5362
|
-
}
|
|
5363
|
-
}), resolvedAttrs;
|
|
4377
|
+
var UpdateCategory;
|
|
4378
|
+
!function (UpdateCategory) {
|
|
4379
|
+
UpdateCategory[UpdateCategory.NONE = 0] = "NONE", UpdateCategory[UpdateCategory.PAINT = 1] = "PAINT", UpdateCategory[UpdateCategory.SHAPE = 2] = "SHAPE", UpdateCategory[UpdateCategory.BOUNDS = 4] = "BOUNDS", UpdateCategory[UpdateCategory.TRANSFORM = 8] = "TRANSFORM", UpdateCategory[UpdateCategory.LAYOUT = 16] = "LAYOUT", UpdateCategory[UpdateCategory.PICK = 32] = "PICK";
|
|
4380
|
+
}(UpdateCategory || (UpdateCategory = {}));
|
|
4381
|
+
const ATTRIBUTE_CATEGORY = {
|
|
4382
|
+
fill: UpdateCategory.PAINT,
|
|
4383
|
+
opacity: UpdateCategory.PAINT,
|
|
4384
|
+
fillOpacity: UpdateCategory.PAINT,
|
|
4385
|
+
strokeOpacity: UpdateCategory.PAINT,
|
|
4386
|
+
lineDash: UpdateCategory.PAINT,
|
|
4387
|
+
lineDashOffset: UpdateCategory.PAINT,
|
|
4388
|
+
lineCap: UpdateCategory.PAINT,
|
|
4389
|
+
lineJoin: UpdateCategory.PAINT,
|
|
4390
|
+
miterLimit: UpdateCategory.PAINT,
|
|
4391
|
+
shadowColor: UpdateCategory.PAINT,
|
|
4392
|
+
x: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4393
|
+
y: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4394
|
+
scaleX: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4395
|
+
scaleY: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4396
|
+
angle: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4397
|
+
anchor: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4398
|
+
anchor3d: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4399
|
+
postMatrix: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
|
|
4400
|
+
layout: UpdateCategory.LAYOUT,
|
|
4401
|
+
zIndex: UpdateCategory.PAINT,
|
|
4402
|
+
visible: UpdateCategory.PAINT | UpdateCategory.PICK,
|
|
4403
|
+
lineWidth: UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.PICK,
|
|
4404
|
+
width: UpdateCategory.SHAPE | UpdateCategory.BOUNDS,
|
|
4405
|
+
height: UpdateCategory.SHAPE | UpdateCategory.BOUNDS
|
|
4406
|
+
};
|
|
4407
|
+
const ATTRIBUTE_DELTA_CLASSIFIER = {
|
|
4408
|
+
stroke: (prev, next) => (null != prev && !1 !== prev) !== (null != next && !1 !== next) ? UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK : UpdateCategory.PAINT,
|
|
4409
|
+
shadowBlur: (prev, next) => {
|
|
4410
|
+
const prevBlur = Number(null != prev ? prev : 0),
|
|
4411
|
+
nextBlur = Number(null != next ? next : 0);
|
|
4412
|
+
return prevBlur !== nextBlur && (prevBlur > 0 || nextBlur > 0) ? UpdateCategory.PAINT | UpdateCategory.BOUNDS : UpdateCategory.PAINT;
|
|
5364
4413
|
}
|
|
4414
|
+
};
|
|
4415
|
+
function classifyAttributeDelta(key, prev, next) {
|
|
4416
|
+
var _a;
|
|
4417
|
+
const dynamicClassifier = ATTRIBUTE_DELTA_CLASSIFIER[key];
|
|
4418
|
+
return dynamicClassifier ? dynamicClassifier(prev, next) : null !== (_a = ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : UpdateCategory.PAINT;
|
|
5365
4419
|
}
|
|
5366
4420
|
|
|
5367
4421
|
function hasOwnKeys(value) {
|
|
@@ -5371,25 +4425,22 @@ function normalizeNoAnimateAttrConfig(config) {
|
|
|
5371
4425
|
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
4426
|
}
|
|
5373
4427
|
class StateTransitionOrchestrator {
|
|
5374
|
-
analyzeTransition(
|
|
4428
|
+
analyzeTransition(targetAttrs, hasAnimation, options = {}) {
|
|
5375
4429
|
var _a, _b;
|
|
5376
4430
|
const plan = {
|
|
5377
|
-
stateNames: stateNames,
|
|
5378
4431
|
targetAttrs: Object.assign({}, targetAttrs),
|
|
5379
4432
|
animateAttrs: {},
|
|
5380
|
-
jumpAttrs: {},
|
|
5381
4433
|
noAnimateAttrs: {}
|
|
5382
4434
|
};
|
|
5383
4435
|
if (!hasAnimation) return plan;
|
|
5384
4436
|
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
4437
|
isClear = !0 === options.isClear,
|
|
5386
|
-
|
|
4438
|
+
readDefaultAttribute = options.getDefaultAttribute,
|
|
5387
4439
|
shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
|
|
5388
4440
|
assignTransitionAttr = (key, value) => {
|
|
5389
|
-
if (noWorkAnimateAttr[key])
|
|
5390
|
-
if (isClear && void 0 === value) {
|
|
4441
|
+
if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isClear && void 0 === value) {
|
|
5391
4442
|
if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
|
|
5392
|
-
plan.animateAttrs[key] =
|
|
4443
|
+
plan.animateAttrs[key] = readDefaultAttribute(key);
|
|
5393
4444
|
} else plan.animateAttrs[key] = value;
|
|
5394
4445
|
};
|
|
5395
4446
|
for (const key in targetAttrs) {
|
|
@@ -5425,13 +4476,13 @@ class StateTransitionOrchestrator {
|
|
|
5425
4476
|
type: AttributeUpdateType.STATE
|
|
5426
4477
|
}), plan;
|
|
5427
4478
|
}
|
|
5428
|
-
applyClearTransition(graphic, targetAttrs, hasAnimation,
|
|
5429
|
-
var _a
|
|
5430
|
-
const plan = this.analyzeTransition(
|
|
5431
|
-
noWorkAnimateAttr:
|
|
4479
|
+
applyClearTransition(graphic, targetAttrs, hasAnimation, options = {}) {
|
|
4480
|
+
var _a;
|
|
4481
|
+
const plan = this.analyzeTransition(targetAttrs, hasAnimation, {
|
|
4482
|
+
noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
|
|
5432
4483
|
isClear: !0,
|
|
5433
|
-
getDefaultAttribute:
|
|
5434
|
-
shouldSkipDefaultAttribute: null !== (
|
|
4484
|
+
getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
|
|
4485
|
+
shouldSkipDefaultAttribute: null !== (_a = options.shouldSkipDefaultAttribute) && void 0 !== _a ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
|
|
5435
4486
|
animateConfig: options.animateConfig,
|
|
5436
4487
|
extraAnimateAttrs: options.extraAnimateAttrs
|
|
5437
4488
|
});
|
|
@@ -5440,24 +4491,11 @@ class StateTransitionOrchestrator {
|
|
|
5440
4491
|
}
|
|
5441
4492
|
|
|
5442
4493
|
const compiler = new StateDefinitionCompiler();
|
|
5443
|
-
function copyDefinitions(definitions) {
|
|
5444
|
-
return definitions ? Object.assign({}, definitions) : {};
|
|
5445
|
-
}
|
|
5446
4494
|
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;
|
|
4495
|
+
return Object.assign({}, parentScope ? parentScope.effectiveSourceDefinitions : themeStateDefinitions, localStateDefinitions);
|
|
5456
4496
|
}
|
|
5457
4497
|
function createGroupSharedStateScope(group, parentScope, localStateDefinitions) {
|
|
5458
|
-
return
|
|
5459
|
-
ownerKind: "group",
|
|
5460
|
-
ownerGroup: group,
|
|
4498
|
+
return rebuildSharedStateScope({
|
|
5461
4499
|
ownerStage: group.stage,
|
|
5462
4500
|
parentScope: parentScope,
|
|
5463
4501
|
localStateDefinitions: localStateDefinitions,
|
|
@@ -5474,14 +4512,13 @@ function setSharedStateScopeParent(scope, parentScope) {
|
|
|
5474
4512
|
function setSharedStateScopeLocalDefinitions(scope, localStateDefinitions) {
|
|
5475
4513
|
return scope.localStateDefinitions !== localStateDefinitions && (scope.localStateDefinitions = localStateDefinitions, rebuildSharedStateScope(scope), !0);
|
|
5476
4514
|
}
|
|
5477
|
-
function rebuildSharedStateScope(scope) {
|
|
4515
|
+
function rebuildSharedStateScope(scope, revision = scope.revision + 1) {
|
|
5478
4516
|
var _a;
|
|
5479
4517
|
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
|
|
4518
|
+
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
4519
|
}
|
|
5482
4520
|
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;
|
|
4521
|
+
if (scope) return scope.parentScope && ensureSharedStateScopeFresh(scope.parentScope), (scope.dirty || scope.parentScope && scope.parentRevisionAtBuild !== scope.parentScope.revision) && rebuildSharedStateScope(scope), scope;
|
|
5485
4522
|
}
|
|
5486
4523
|
function collectSharedStateScopeChain(scope) {
|
|
5487
4524
|
const chain = [];
|
|
@@ -5491,26 +4528,19 @@ function collectSharedStateScopeChain(scope) {
|
|
|
5491
4528
|
}
|
|
5492
4529
|
|
|
5493
4530
|
function scheduleStageSharedStateRefresh(stage) {
|
|
5494
|
-
|
|
5495
|
-
stage && "released" !== stage.releaseStatus && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
|
|
4531
|
+
stage && "released" !== stage.releaseStatus && stage.renderNextFrame();
|
|
5496
4532
|
}
|
|
5497
4533
|
function enqueueGraphicSharedStateRefresh(stage, graphic) {
|
|
5498
4534
|
var _a;
|
|
5499
4535
|
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
|
-
}
|
|
4536
|
+
(null !== (_a = stage._pendingSharedStateRefreshGraphics) && void 0 !== _a ? _a : stage._pendingSharedStateRefreshGraphics = new Set()).add(graphic);
|
|
5506
4537
|
}
|
|
5507
4538
|
function markScopeActiveDescendantsDirty(scope, stage) {
|
|
5508
|
-
|
|
5509
|
-
scope.subtreeActiveDescendants.forEach(graphic => {
|
|
4539
|
+
scope.subtreeActiveDescendants.size && (scope.subtreeActiveDescendants.forEach(graphic => {
|
|
5510
4540
|
var _a;
|
|
5511
4541
|
graphic.sharedStateDirty = !0;
|
|
5512
|
-
enqueueGraphicSharedStateRefresh(null !== (_a = null != stage ? stage : graphic.stage) && void 0 !== _a ? _a : scope.ownerStage, graphic)
|
|
5513
|
-
}),
|
|
4542
|
+
enqueueGraphicSharedStateRefresh(null !== (_a = null != stage ? stage : graphic.stage) && void 0 !== _a ? _a : scope.ownerStage, graphic);
|
|
4543
|
+
}), scheduleStageSharedStateRefresh(null != stage ? stage : scope.ownerStage));
|
|
5514
4544
|
}
|
|
5515
4545
|
|
|
5516
4546
|
const _tempBounds = new AABBBounds(),
|
|
@@ -5520,10 +4550,8 @@ const tempConstantXYKey = ["x", "y"],
|
|
|
5520
4550
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
5521
4551
|
tempConstantAngleKey = ["angle"],
|
|
5522
4552
|
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
4553
|
point = new Point(),
|
|
5525
4554
|
EMPTY_STATE_NAMES = [],
|
|
5526
|
-
deprecatedLocalStateFallbackWarningStateNames = new Set(),
|
|
5527
4555
|
BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
|
|
5528
4556
|
function isPlainObjectValue(value) {
|
|
5529
4557
|
return "object" == typeof value && null != value && !Array.isArray(value);
|
|
@@ -5637,11 +4665,6 @@ class Graphic extends Node {
|
|
|
5637
4665
|
getAttributes() {
|
|
5638
4666
|
return this.attribute;
|
|
5639
4667
|
}
|
|
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
4668
|
getStateTransitionOrchestrator() {
|
|
5646
4669
|
return this.stateTransitionOrchestrator || (this.stateTransitionOrchestrator = new StateTransitionOrchestrator()), this.stateTransitionOrchestrator;
|
|
5647
4670
|
}
|
|
@@ -5657,7 +4680,7 @@ class Graphic extends Node {
|
|
|
5657
4680
|
syncSharedStateScopeBindingFromTree(markDirty = !0) {
|
|
5658
4681
|
var _a;
|
|
5659
4682
|
const nextScope = this.resolveBoundSharedStateScope();
|
|
5660
|
-
return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(), !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0, this.
|
|
4683
|
+
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
4684
|
}
|
|
5662
4685
|
syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
|
|
5663
4686
|
var _a, _b;
|
|
@@ -5696,13 +4719,7 @@ class Graphic extends Node {
|
|
|
5696
4719
|
}
|
|
5697
4720
|
getLocalStatesVersion() {
|
|
5698
4721
|
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
|
-
}
|
|
4722
|
+
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
4723
|
}
|
|
5707
4724
|
resolveEffectiveCompiledDefinitions() {
|
|
5708
4725
|
this.syncSharedStateScopeBindingFromTree(!1);
|
|
@@ -5711,50 +4728,24 @@ class Graphic extends Node {
|
|
|
5711
4728
|
const hasStates = !!this.states && Object.keys(this.states).length > 0;
|
|
5712
4729
|
if (!boundScope) {
|
|
5713
4730
|
if (!hasStates) return {
|
|
5714
|
-
compiledDefinitions: void 0
|
|
5715
|
-
stateProxyModeKey: "none"
|
|
4731
|
+
compiledDefinitions: void 0
|
|
5716
4732
|
};
|
|
5717
4733
|
const cacheKey = `local:${this.getLocalStatesVersion()}`;
|
|
5718
4734
|
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"
|
|
4735
|
+
compiledDefinitions: this.compiledStateDefinitions
|
|
5721
4736
|
};
|
|
5722
4737
|
}
|
|
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
|
|
4738
|
+
return {
|
|
4739
|
+
compiledDefinitions: boundScope.effectiveCompiledDefinitions
|
|
5749
4740
|
};
|
|
5750
4741
|
}
|
|
5751
4742
|
recomputeCurrentStatePatch() {
|
|
5752
4743
|
var _a, _b;
|
|
5753
4744
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)) return this.effectiveStates = [], this.resolvedStatePatch = void 0, void this.syncSharedStateActiveRegistrations();
|
|
5754
4745
|
const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(),
|
|
5755
|
-
transition = this.
|
|
4746
|
+
transition = this.resolveUseStatesTransition(this.currentStates, stateResolveBaseAttrs),
|
|
5756
4747
|
effectiveStates = null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states,
|
|
5757
|
-
resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) :
|
|
4748
|
+
resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
|
|
5758
4749
|
this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
|
|
5759
4750
|
}
|
|
5760
4751
|
buildStaticAttributeSnapshot() {
|
|
@@ -5818,12 +4809,7 @@ class Graphic extends Node {
|
|
|
5818
4809
|
return nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category | nextCategory;
|
|
5819
4810
|
}
|
|
5820
4811
|
submitUpdateByCategory(category, forceUpdateTag = !1) {
|
|
5821
|
-
var _a;
|
|
5822
4812
|
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
4813
|
(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
4814
|
}
|
|
5829
4815
|
submitUpdateByDelta(delta, forceUpdateTag = !1) {
|
|
@@ -6042,7 +5028,10 @@ class Graphic extends Node {
|
|
|
6042
5028
|
if (path = Graphic.userSymbolMap[symbolType], path) return path;
|
|
6043
5029
|
const _symbolType = builtInSymbolStrMap[symbolType];
|
|
6044
5030
|
if (!0 === isSvg(symbolType = _symbolType || symbolType)) {
|
|
6045
|
-
const
|
|
5031
|
+
const {
|
|
5032
|
+
XMLParser: XMLParser
|
|
5033
|
+
} = require("../common/xml/parser"),
|
|
5034
|
+
parser = new XMLParser(),
|
|
6046
5035
|
{
|
|
6047
5036
|
svg: svg
|
|
6048
5037
|
} = parser.parse(symbolType);
|
|
@@ -6362,103 +5351,94 @@ class Graphic extends Node {
|
|
|
6362
5351
|
var _a;
|
|
6363
5352
|
return null === (_a = this.stateEngine) || void 0 === _a || _a.setResolveContext(this, stateResolveBaseAttrs), stateResolveBaseAttrs;
|
|
6364
5353
|
}
|
|
6365
|
-
|
|
5354
|
+
ensureStateEngine(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
|
|
6366
5355
|
const {
|
|
6367
|
-
compiledDefinitions: compiledDefinitions
|
|
6368
|
-
stateProxyEligibility: stateProxyEligibility,
|
|
6369
|
-
stateProxyModeKey: stateProxyModeKey
|
|
5356
|
+
compiledDefinitions: compiledDefinitions
|
|
6370
5357
|
} = this.resolveEffectiveCompiledDefinitions();
|
|
6371
|
-
return this.compiledStateDefinitions = compiledDefinitions, compiledDefinitions ? this.stateEngine && this.stateEngineCompiledDefinitions === compiledDefinitions && this.
|
|
5358
|
+
return this.compiledStateDefinitions = compiledDefinitions, compiledDefinitions ? this.stateEngine && this.stateEngineCompiledDefinitions === compiledDefinitions && this.stateEngineStateSort === this.stateSort && this.stateEngineMergeMode === this.stateMergeMode || (this.stateEngine = new StateEngine({
|
|
6372
5359
|
compiledDefinitions: compiledDefinitions,
|
|
6373
5360
|
stateSort: this.stateSort,
|
|
6374
|
-
stateProxy: this.stateProxy,
|
|
6375
|
-
stateProxyEligibility: stateProxyEligibility,
|
|
6376
|
-
states: this.states,
|
|
6377
5361
|
mergeMode: this.stateMergeMode
|
|
6378
|
-
}), this.stateEngineCompiledDefinitions = compiledDefinitions, this.
|
|
6379
|
-
states: this.states,
|
|
6380
|
-
currentStates: this.currentStates,
|
|
6381
|
-
stateSort: this.stateSort,
|
|
6382
|
-
stateProxy: this.stateProxy,
|
|
6383
|
-
stateEngine: this.stateEngine
|
|
6384
|
-
});
|
|
5362
|
+
}), 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;
|
|
6385
5363
|
}
|
|
6386
|
-
|
|
5364
|
+
toGraphicStateTransition(result) {
|
|
5365
|
+
return {
|
|
5366
|
+
changed: result.changed,
|
|
5367
|
+
states: [...result.activeStates],
|
|
5368
|
+
effectiveStates: [...result.effectiveStates]
|
|
5369
|
+
};
|
|
5370
|
+
}
|
|
5371
|
+
sortLocalStates(states) {
|
|
5372
|
+
return this.stateSort ? [...states].sort(this.stateSort) : [...states];
|
|
5373
|
+
}
|
|
5374
|
+
resolveLocalUseStatesTransition(states) {
|
|
6387
5375
|
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
|
-
}
|
|
5376
|
+
if (!states.length) return this.resolveLocalClearStatesTransition();
|
|
5377
|
+
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
5378
|
+
changed = previousStates.length !== states.length || states.some((stateName, index) => previousStates[index] !== stateName),
|
|
5379
|
+
nextStates = this.sortLocalStates(states);
|
|
6440
5380
|
return {
|
|
6441
5381
|
changed: changed,
|
|
6442
|
-
states: nextStates
|
|
6443
|
-
effectiveStates: nextStates,
|
|
6444
|
-
resolvedStateAttrs: resolvedStateAttrs
|
|
5382
|
+
states: changed ? nextStates : [...previousStates]
|
|
6445
5383
|
};
|
|
6446
5384
|
}
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
5385
|
+
resolveLocalClearStatesTransition() {
|
|
5386
|
+
return {
|
|
5387
|
+
changed: this.hasState(),
|
|
5388
|
+
states: []
|
|
5389
|
+
};
|
|
5390
|
+
}
|
|
5391
|
+
resolveUseStatesTransition(states, stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
|
|
5392
|
+
const stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
|
|
5393
|
+
return stateEngine ? this.toGraphicStateTransition(stateEngine.applyStates(states)) : this.resolveLocalUseStatesTransition(states);
|
|
5394
|
+
}
|
|
5395
|
+
resolveClearStatesTransition() {
|
|
5396
|
+
const stateEngine = this.ensureStateEngine();
|
|
5397
|
+
return stateEngine ? this.toGraphicStateTransition(stateEngine.clearStates()) : this.resolveLocalClearStatesTransition();
|
|
5398
|
+
}
|
|
5399
|
+
resolveAddStateTransition(stateName, keepCurrentStates) {
|
|
5400
|
+
var _a;
|
|
5401
|
+
const stateEngine = this.ensureStateEngine();
|
|
5402
|
+
if (stateEngine) return this.toGraphicStateTransition(stateEngine.addState(stateName, keepCurrentStates));
|
|
5403
|
+
if (this.currentStates && this.currentStates.includes(stateName) && (keepCurrentStates || 1 === this.currentStates.length)) return {
|
|
5404
|
+
changed: !1,
|
|
5405
|
+
states: [...this.currentStates]
|
|
5406
|
+
};
|
|
5407
|
+
const nextStates = keepCurrentStates && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) ? this.currentStates.concat([stateName]) : [stateName];
|
|
5408
|
+
return this.resolveLocalUseStatesTransition(nextStates);
|
|
5409
|
+
}
|
|
5410
|
+
resolveRemoveStateTransition(stateName) {
|
|
5411
|
+
const stateEngine = this.ensureStateEngine();
|
|
5412
|
+
if (stateEngine) return this.toGraphicStateTransition(stateEngine.removeState(stateName));
|
|
5413
|
+
if (!this.currentStates) return {
|
|
5414
|
+
changed: !1,
|
|
5415
|
+
states: []
|
|
5416
|
+
};
|
|
5417
|
+
const filter = Array.isArray(stateName) ? s => !stateName.includes(s) : s => s !== stateName,
|
|
5418
|
+
nextStates = this.currentStates.filter(filter);
|
|
5419
|
+
return nextStates.length === this.currentStates.length ? {
|
|
5420
|
+
changed: !1,
|
|
5421
|
+
states: [...this.currentStates]
|
|
5422
|
+
} : this.resolveLocalUseStatesTransition(nextStates);
|
|
5423
|
+
}
|
|
5424
|
+
resolveToggleStateTransition(stateName) {
|
|
5425
|
+
const stateEngine = this.ensureStateEngine();
|
|
5426
|
+
if (stateEngine) return this.toGraphicStateTransition(stateEngine.toggleState(stateName));
|
|
5427
|
+
if (this.hasState(stateName)) return this.resolveRemoveStateTransition(stateName);
|
|
5428
|
+
const nextStates = this.currentStates ? this.currentStates.slice() : [];
|
|
5429
|
+
return nextStates.push(stateName), this.resolveLocalUseStatesTransition(nextStates);
|
|
5430
|
+
}
|
|
5431
|
+
resolveGraphicStateTransition(states, forceResolverRefresh = !1) {
|
|
5432
|
+
var _a;
|
|
5433
|
+
const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(),
|
|
5434
|
+
stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
|
|
5435
|
+
forceResolverRefresh && (null == stateEngine || stateEngine.invalidateResolverCache());
|
|
5436
|
+
const transition = stateEngine ? this.toGraphicStateTransition(stateEngine.applyStates(states)) : this.resolveLocalUseStatesTransition(states),
|
|
5437
|
+
resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
|
|
6457
5438
|
return {
|
|
6458
5439
|
transition: transition,
|
|
6459
|
-
effectiveStates: null !== (
|
|
6460
|
-
resolvedStateAttrs: resolvedStateAttrs
|
|
6461
|
-
isSimpleLocalTransition: isSimpleLocalTransition
|
|
5440
|
+
effectiveStates: null !== (_a = transition.effectiveStates) && void 0 !== _a ? _a : transition.states,
|
|
5441
|
+
resolvedStateAttrs: resolvedStateAttrs
|
|
6462
5442
|
};
|
|
6463
5443
|
}
|
|
6464
5444
|
normalizeSetStatesOptions(options) {
|
|
@@ -6489,24 +5469,14 @@ class Graphic extends Node {
|
|
|
6489
5469
|
{
|
|
6490
5470
|
transition: transition,
|
|
6491
5471
|
effectiveStates: effectiveStates,
|
|
6492
|
-
resolvedStateAttrs: resolvedStateAttrs
|
|
6493
|
-
|
|
6494
|
-
} = this.resolveGraphicStateTransition(states, previousStates, !0),
|
|
5472
|
+
resolvedStateAttrs: resolvedStateAttrs
|
|
5473
|
+
} = this.resolveGraphicStateTransition(states, !0),
|
|
6495
5474
|
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
|
-
}
|
|
5475
|
+
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({
|
|
5476
|
+
type: AttributeUpdateType.STATE
|
|
5477
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
5478
|
+
type: AttributeUpdateType.STATE
|
|
5479
|
+
}), this.emitStateUpdateEvent())));
|
|
6510
5480
|
}
|
|
6511
5481
|
resolveStateAnimateConfig(animateConfig) {
|
|
6512
5482
|
var _a, _b, _c;
|
|
@@ -6519,8 +5489,8 @@ class Graphic extends Node {
|
|
|
6519
5489
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
6520
5490
|
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
|
|
6521
5491
|
} : void 0;
|
|
6522
|
-
if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation,
|
|
6523
|
-
const plan = this.getStateTransitionOrchestrator().analyzeTransition(
|
|
5492
|
+
if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
|
|
5493
|
+
const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
|
|
6524
5494
|
noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
|
|
6525
5495
|
animateConfig: resolvedAnimateConfig,
|
|
6526
5496
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
@@ -6544,43 +5514,29 @@ class Graphic extends Node {
|
|
|
6544
5514
|
animate.stateNames && stateAnimates.push(animate);
|
|
6545
5515
|
}), stateAnimates.forEach(animate => animate.stop(type));
|
|
6546
5516
|
}
|
|
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
5517
|
clearStates(hasAnimation) {
|
|
6553
5518
|
var _a, _b, _c;
|
|
6554
5519
|
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
6555
5520
|
previousResolvedStatePatch = this.resolvedStatePatch,
|
|
6556
|
-
transition = this.
|
|
5521
|
+
transition = this.resolveClearStatesTransition();
|
|
6557
5522
|
if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
|
|
6558
5523
|
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
|
-
}
|
|
5524
|
+
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({
|
|
5525
|
+
type: AttributeUpdateType.STATE
|
|
5526
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
5527
|
+
type: AttributeUpdateType.STATE
|
|
5528
|
+
}), this.emitStateUpdateEvent()));
|
|
6573
5529
|
}
|
|
6574
5530
|
removeState(stateName, hasAnimation) {
|
|
6575
|
-
const transition = this.
|
|
5531
|
+
const transition = this.resolveRemoveStateTransition(stateName);
|
|
6576
5532
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
6577
5533
|
}
|
|
6578
5534
|
toggleState(stateName, hasAnimation) {
|
|
6579
|
-
const transition = this.
|
|
5535
|
+
const transition = this.resolveToggleStateTransition(stateName);
|
|
6580
5536
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
6581
5537
|
}
|
|
6582
5538
|
addState(stateName, keepCurrentStates, hasAnimation) {
|
|
6583
|
-
const transition = this.
|
|
5539
|
+
const transition = this.resolveAddStateTransition(stateName, keepCurrentStates);
|
|
6584
5540
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
6585
5541
|
}
|
|
6586
5542
|
setStates(states, options) {
|
|
@@ -6608,23 +5564,13 @@ class Graphic extends Node {
|
|
|
6608
5564
|
{
|
|
6609
5565
|
transition: transition,
|
|
6610
5566
|
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
|
-
}
|
|
5567
|
+
resolvedStateAttrs: resolvedStateAttrs
|
|
5568
|
+
} = this.resolveGraphicStateTransition(states);
|
|
5569
|
+
!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({
|
|
5570
|
+
type: AttributeUpdateType.STATE
|
|
5571
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
5572
|
+
type: AttributeUpdateType.STATE
|
|
5573
|
+
}), this.emitStateUpdateEvent()));
|
|
6628
5574
|
}
|
|
6629
5575
|
invalidateResolver() {
|
|
6630
5576
|
var _a, _b;
|
|
@@ -6770,7 +5716,7 @@ class Graphic extends Node {
|
|
|
6770
5716
|
}
|
|
6771
5717
|
detachStageForRelease() {
|
|
6772
5718
|
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.
|
|
5719
|
+
(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
5720
|
}
|
|
6775
5721
|
setStageToShadowRoot(stage, layer) {
|
|
6776
5722
|
this.shadowRoot && this.shadowRoot.setStage(stage, layer);
|
|
@@ -7024,6 +5970,730 @@ function getThemeFromGroup(graphic) {
|
|
|
7024
5970
|
return null;
|
|
7025
5971
|
}
|
|
7026
5972
|
|
|
5973
|
+
var GroupUpdateAABBBoundsMode;
|
|
5974
|
+
!function (GroupUpdateAABBBoundsMode) {
|
|
5975
|
+
GroupUpdateAABBBoundsMode[GroupUpdateAABBBoundsMode.LESS_GROUP = 0] = "LESS_GROUP", GroupUpdateAABBBoundsMode[GroupUpdateAABBBoundsMode.MORE_GROUP = 1] = "MORE_GROUP";
|
|
5976
|
+
}(GroupUpdateAABBBoundsMode || (GroupUpdateAABBBoundsMode = {}));
|
|
5977
|
+
class Group extends Graphic {
|
|
5978
|
+
constructor(params) {
|
|
5979
|
+
super(params), this.type = "group", this.parent = null, this.isContainer = !0, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
|
|
5980
|
+
}
|
|
5981
|
+
get sharedStateDefinitions() {
|
|
5982
|
+
return this._sharedStateDefinitions;
|
|
5983
|
+
}
|
|
5984
|
+
set sharedStateDefinitions(value) {
|
|
5985
|
+
if (this._sharedStateDefinitions === value) return;
|
|
5986
|
+
const previousScope = this.sharedStateScope;
|
|
5987
|
+
this._sharedStateDefinitions = value, this.ensureSharedStateScopeBound(), this.sharedStateScope && (setSharedStateScopeLocalDefinitions(this.sharedStateScope, value), markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage)), previousScope !== this.sharedStateScope && this.notifyChildrenSharedStateTreeChanged();
|
|
5988
|
+
}
|
|
5989
|
+
setMode(mode) {
|
|
5990
|
+
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
5991
|
+
}
|
|
5992
|
+
set3dMode() {
|
|
5993
|
+
this.in3dMode = !0;
|
|
5994
|
+
}
|
|
5995
|
+
set2dMode() {
|
|
5996
|
+
this.in3dMode = !1;
|
|
5997
|
+
}
|
|
5998
|
+
setTheme(t) {
|
|
5999
|
+
return this.theme || (this.theme = new Theme()), this.theme.setTheme(t, this);
|
|
6000
|
+
}
|
|
6001
|
+
createTheme() {
|
|
6002
|
+
this.theme || (this.theme = new Theme());
|
|
6003
|
+
}
|
|
6004
|
+
visibleAll(visible) {
|
|
6005
|
+
this.setAttribute("visible", visible), this.forEachChildren(item => {
|
|
6006
|
+
item.isContainer && item.visibleAll ? item.visibleAll(visible) : item.setAttribute("visible", visible);
|
|
6007
|
+
});
|
|
6008
|
+
}
|
|
6009
|
+
hideAll() {
|
|
6010
|
+
this.visibleAll(!1);
|
|
6011
|
+
}
|
|
6012
|
+
showAll() {
|
|
6013
|
+
this.visibleAll(!0);
|
|
6014
|
+
}
|
|
6015
|
+
containsPoint(x, y, mode) {
|
|
6016
|
+
if (mode === IContainPointMode.GLOBAL) {
|
|
6017
|
+
const point = new Point(x, y);
|
|
6018
|
+
return this.parent && this.parent.globalTransMatrix.transformPoint(point, point), this.AABBBounds.contains(point.x, point.y);
|
|
6019
|
+
}
|
|
6020
|
+
return this.AABBBounds.contains(x, y);
|
|
6021
|
+
}
|
|
6022
|
+
shouldUpdateAABBBounds() {
|
|
6023
|
+
return !!super.shouldUpdateAABBBounds() || !!(this._childUpdateTag & UpdateTag.UPDATE_BOUNDS);
|
|
6024
|
+
}
|
|
6025
|
+
tryUpdateAABBBounds() {
|
|
6026
|
+
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
6027
|
+
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6028
|
+
const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
|
|
6029
|
+
bounds = this.doUpdateAABBBounds();
|
|
6030
|
+
return this.addUpdateLayoutTag(), this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6031
|
+
}
|
|
6032
|
+
doUpdateLocalMatrix() {
|
|
6033
|
+
const {
|
|
6034
|
+
x = DefaultTransform.x,
|
|
6035
|
+
y = DefaultTransform.y,
|
|
6036
|
+
dx = DefaultTransform.dx,
|
|
6037
|
+
dy = DefaultTransform.dy,
|
|
6038
|
+
scaleX = DefaultTransform.scaleX,
|
|
6039
|
+
scaleY = DefaultTransform.scaleY,
|
|
6040
|
+
angle = DefaultTransform.angle,
|
|
6041
|
+
postMatrix: postMatrix
|
|
6042
|
+
} = this.attribute;
|
|
6043
|
+
if (0 !== x || 0 !== y || 0 !== dx || 0 !== dy || 1 !== scaleX || 1 !== scaleY || 0 !== angle || postMatrix) return super.doUpdateLocalMatrix();
|
|
6044
|
+
this._transMatrix.reset();
|
|
6045
|
+
}
|
|
6046
|
+
getGraphicTheme() {
|
|
6047
|
+
return getTheme(this).group;
|
|
6048
|
+
}
|
|
6049
|
+
updateAABBBounds(attribute, groupTheme, aabbBounds) {
|
|
6050
|
+
const originalAABBBounds = aabbBounds;
|
|
6051
|
+
aabbBounds = aabbBounds.clone();
|
|
6052
|
+
const {
|
|
6053
|
+
width: width,
|
|
6054
|
+
height: height,
|
|
6055
|
+
path: path,
|
|
6056
|
+
clip = groupTheme.clip
|
|
6057
|
+
} = attribute;
|
|
6058
|
+
if (path && path.length ? path.forEach(g => {
|
|
6059
|
+
aabbBounds.union(g.AABBBounds);
|
|
6060
|
+
}) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), !clip) {
|
|
6061
|
+
this.forEachChildren(node => {
|
|
6062
|
+
aabbBounds.union(node.AABBBounds);
|
|
6063
|
+
});
|
|
6064
|
+
const {
|
|
6065
|
+
scrollX = 0,
|
|
6066
|
+
scrollY = 0
|
|
6067
|
+
} = attribute;
|
|
6068
|
+
aabbBounds.translate(scrollX, scrollY);
|
|
6069
|
+
}
|
|
6070
|
+
return application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, this), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
|
|
6071
|
+
}
|
|
6072
|
+
doUpdateAABBBounds() {
|
|
6073
|
+
this.updateAABBBoundsStamp++;
|
|
6074
|
+
const bounds = super.doUpdateAABBBounds();
|
|
6075
|
+
return this.parent && this.parent.addChildUpdateBoundTag(), this._emitCustomEvent("AAABBBoundsChange"), bounds;
|
|
6076
|
+
}
|
|
6077
|
+
clearUpdateBoundTag() {
|
|
6078
|
+
this._updateTag &= UpdateTag.CLEAR_BOUNDS, this._childUpdateTag &= UpdateTag.CLEAR_BOUNDS;
|
|
6079
|
+
}
|
|
6080
|
+
addUpdateBoundTag() {
|
|
6081
|
+
this._updateTag |= UpdateTag.UPDATE_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag();
|
|
6082
|
+
}
|
|
6083
|
+
addChildUpdateBoundTag() {
|
|
6084
|
+
this._childUpdateTag & UpdateTag.UPDATE_BOUNDS || (this._childUpdateTag |= UpdateTag.UPDATE_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag());
|
|
6085
|
+
}
|
|
6086
|
+
getTheme() {
|
|
6087
|
+
return this.theme.getTheme(this);
|
|
6088
|
+
}
|
|
6089
|
+
incrementalAppendChild(node) {
|
|
6090
|
+
const data = super.appendChild(node);
|
|
6091
|
+
return data && this.syncChildSharedStateTreeBinding(data), this.addUpdateBoundTag(), this.getGraphicService().onAddIncremental(node, this, this.stage), data;
|
|
6092
|
+
}
|
|
6093
|
+
incrementalClearChild() {
|
|
6094
|
+
super.removeAllChild(), this.addUpdateBoundTag(), this.getGraphicService().onClearIncremental(this, this.stage);
|
|
6095
|
+
}
|
|
6096
|
+
_updateChildToStage(child) {
|
|
6097
|
+
return child && this.syncChildSharedStateTreeBinding(child), this.addUpdateBoundTag(), child;
|
|
6098
|
+
}
|
|
6099
|
+
appendChild(node, addStage = !0) {
|
|
6100
|
+
const data = super.appendChild(node);
|
|
6101
|
+
return data && addStage && this.syncChildSharedStateTreeBinding(data), this.addUpdateBoundTag(), data;
|
|
6102
|
+
}
|
|
6103
|
+
insertBefore(newNode, referenceNode) {
|
|
6104
|
+
return this._updateChildToStage(super.insertBefore(newNode, referenceNode));
|
|
6105
|
+
}
|
|
6106
|
+
insertAfter(newNode, referenceNode) {
|
|
6107
|
+
return this._updateChildToStage(super.insertAfter(newNode, referenceNode));
|
|
6108
|
+
}
|
|
6109
|
+
insertInto(newNode, idx) {
|
|
6110
|
+
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
6111
|
+
}
|
|
6112
|
+
removeChild(child, highPerformance = !1) {
|
|
6113
|
+
const data = super.removeChild(child);
|
|
6114
|
+
return data ? highPerformance ? (child.detachStageForRelease(), data) : (this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data) : data;
|
|
6115
|
+
}
|
|
6116
|
+
removeAllChild(deep = !1) {
|
|
6117
|
+
const children = this.children.slice();
|
|
6118
|
+
this.forEachChildren(child => {
|
|
6119
|
+
this.getGraphicService().onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
6120
|
+
}), super.removeAllChild(), children.forEach(child => {
|
|
6121
|
+
child.setStage(null, null);
|
|
6122
|
+
}), this.addUpdateBoundTag();
|
|
6123
|
+
}
|
|
6124
|
+
setStage(stage, layer) {
|
|
6125
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6126
|
+
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,
|
|
6127
|
+
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;
|
|
6128
|
+
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();
|
|
6129
|
+
const layerChanged = this.layer !== layer;
|
|
6130
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
|
|
6131
|
+
}
|
|
6132
|
+
addUpdatePositionTag() {
|
|
6133
|
+
super.addUpdatePositionTag(), this.forEachChildren(g => {
|
|
6134
|
+
g.isContainer && g.addUpdateGlobalPositionTag();
|
|
6135
|
+
});
|
|
6136
|
+
}
|
|
6137
|
+
addUpdateGlobalPositionTag() {
|
|
6138
|
+
super.addUpdateGlobalPositionTag(), this.forEachChildren(g => {
|
|
6139
|
+
g.isContainer && g.addUpdateGlobalPositionTag();
|
|
6140
|
+
});
|
|
6141
|
+
}
|
|
6142
|
+
tryUpdateGlobalTransMatrix(clearTag = !0) {
|
|
6143
|
+
if (this.shouldUpdateGlobalMatrix()) {
|
|
6144
|
+
if (this._globalTransMatrix) {
|
|
6145
|
+
if (this.parent) {
|
|
6146
|
+
const m = this.parent.globalTransMatrix;
|
|
6147
|
+
this._globalTransMatrix.setValue(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
6148
|
+
}
|
|
6149
|
+
} else this._globalTransMatrix = this.parent ? this.parent.globalTransMatrix.clone() : this.transMatrix.clone();
|
|
6150
|
+
this.doUpdateGlobalMatrix(), clearTag && this.clearUpdateGlobalPositionTag();
|
|
6151
|
+
}
|
|
6152
|
+
return this._globalTransMatrix;
|
|
6153
|
+
}
|
|
6154
|
+
shouldUpdateGlobalMatrix() {
|
|
6155
|
+
return !!(this._updateTag & UpdateTag.UPDATE_GLOBAL_MATRIX);
|
|
6156
|
+
}
|
|
6157
|
+
_getChildByName(name, deep) {
|
|
6158
|
+
return this.find(node => node.name === name, deep);
|
|
6159
|
+
}
|
|
6160
|
+
createOrUpdateChild(graphicName, attributes, graphicType) {
|
|
6161
|
+
let graphic = this._getChildByName(graphicName);
|
|
6162
|
+
return graphic ? graphic.setAttributes(attributes) : (graphic = application.graphicService.creator[graphicType](attributes), graphic.name = graphicName, this.add(graphic)), graphic;
|
|
6163
|
+
}
|
|
6164
|
+
clone() {
|
|
6165
|
+
return new Group(Object.assign({}, this.attribute));
|
|
6166
|
+
}
|
|
6167
|
+
getNoWorkAnimateAttr() {
|
|
6168
|
+
return Group.NOWORK_ANIMATE_ATTR;
|
|
6169
|
+
}
|
|
6170
|
+
release(all) {
|
|
6171
|
+
all && this.forEachChildren(g => {
|
|
6172
|
+
g.release(all);
|
|
6173
|
+
}), super.release();
|
|
6174
|
+
}
|
|
6175
|
+
detachStageForRelease() {
|
|
6176
|
+
super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
|
|
6177
|
+
item.detachStageForRelease();
|
|
6178
|
+
});
|
|
6179
|
+
}
|
|
6180
|
+
ensureSharedStateScopeBound() {
|
|
6181
|
+
var _a, _b, _c;
|
|
6182
|
+
if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
|
|
6183
|
+
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;
|
|
6184
|
+
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);
|
|
6185
|
+
}
|
|
6186
|
+
hasSharedStateDefinitions() {
|
|
6187
|
+
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
6188
|
+
}
|
|
6189
|
+
notifyChildrenSharedStateTreeChanged() {
|
|
6190
|
+
this.forEachChildren(item => {
|
|
6191
|
+
this.syncChildSharedStateTreeBinding(item);
|
|
6192
|
+
});
|
|
6193
|
+
}
|
|
6194
|
+
syncChildSharedStateTreeBinding(child) {
|
|
6195
|
+
child.onParentSharedStateTreeChanged(this.stage, this.layer);
|
|
6196
|
+
}
|
|
6197
|
+
onParentSharedStateTreeChanged(stage, layer) {
|
|
6198
|
+
var _a;
|
|
6199
|
+
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);
|
|
6200
|
+
}
|
|
6201
|
+
}
|
|
6202
|
+
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
6203
|
+
function createGroup(attributes) {
|
|
6204
|
+
return new Group(attributes);
|
|
6205
|
+
}
|
|
6206
|
+
|
|
6207
|
+
const GROUP_ATTRIBUTES = [
|
|
6208
|
+
'x',
|
|
6209
|
+
'y',
|
|
6210
|
+
'dx',
|
|
6211
|
+
'dy',
|
|
6212
|
+
'scaleX',
|
|
6213
|
+
'scaleY',
|
|
6214
|
+
'angle',
|
|
6215
|
+
'anchor',
|
|
6216
|
+
'postMatrix',
|
|
6217
|
+
'visible',
|
|
6218
|
+
'clip',
|
|
6219
|
+
'pickable',
|
|
6220
|
+
'childrenPickable',
|
|
6221
|
+
'zIndex',
|
|
6222
|
+
'cursor'
|
|
6223
|
+
];
|
|
6224
|
+
class AbstractComponent extends Group {
|
|
6225
|
+
constructor(attributes, options) {
|
|
6226
|
+
super(attributes);
|
|
6227
|
+
this._skipRenderAttributes = GROUP_ATTRIBUTES;
|
|
6228
|
+
if (options === null || options === void 0 ? void 0 : options.mode) {
|
|
6229
|
+
this.mode = options.mode;
|
|
6230
|
+
this.setMode(options.mode);
|
|
6231
|
+
}
|
|
6232
|
+
if (options === null || options === void 0 ? void 0 : options.skipDefault) {
|
|
6233
|
+
this.skipDefault = true;
|
|
6234
|
+
}
|
|
6235
|
+
this.setTheme({
|
|
6236
|
+
common: {
|
|
6237
|
+
strokeBoundsBuffer: 0
|
|
6238
|
+
}
|
|
6239
|
+
});
|
|
6240
|
+
this.attribute = attributes;
|
|
6241
|
+
this.onSetStage((_, stage) => {
|
|
6242
|
+
if (!stage) {
|
|
6243
|
+
return;
|
|
6244
|
+
}
|
|
6245
|
+
this.render();
|
|
6246
|
+
this.bindEvents();
|
|
6247
|
+
});
|
|
6248
|
+
}
|
|
6249
|
+
setAttribute(key, value, forceUpdateTag, context) {
|
|
6250
|
+
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);
|
|
6251
|
+
if (params) {
|
|
6252
|
+
return this._setAttributes(params, forceUpdateTag);
|
|
6253
|
+
}
|
|
6254
|
+
if (isPlainObject$2(this.attribute[key]) &&
|
|
6255
|
+
isPlainObject$2(value) &&
|
|
6256
|
+
!isFunction(this.attribute[key]) &&
|
|
6257
|
+
!isFunction(value)) {
|
|
6258
|
+
merge(this.attribute[key], value);
|
|
6259
|
+
}
|
|
6260
|
+
else {
|
|
6261
|
+
this.attribute[key] = value;
|
|
6262
|
+
}
|
|
6263
|
+
if (!this._skipRenderAttributes.includes(key)) {
|
|
6264
|
+
this.render();
|
|
6265
|
+
}
|
|
6266
|
+
this.valid = this.isValid();
|
|
6267
|
+
if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTag(key))) {
|
|
6268
|
+
this.addUpdateShapeAndBoundsTag();
|
|
6269
|
+
}
|
|
6270
|
+
else {
|
|
6271
|
+
this.addUpdateBoundTag();
|
|
6272
|
+
}
|
|
6273
|
+
this.addUpdatePositionTag();
|
|
6274
|
+
this.onAttributeUpdate();
|
|
6275
|
+
}
|
|
6276
|
+
setAttributes(params, forceUpdateTag, context) {
|
|
6277
|
+
params =
|
|
6278
|
+
(this.onBeforeAttributeUpdate &&
|
|
6279
|
+
this.onBeforeAttributeUpdate(params, this.attribute, null, context)) ||
|
|
6280
|
+
params;
|
|
6281
|
+
return this._setAttributes(params, forceUpdateTag);
|
|
6282
|
+
}
|
|
6283
|
+
_setAttributes(params, forceUpdateTag) {
|
|
6284
|
+
const keys = Object.keys(params);
|
|
6285
|
+
this._mergeAttributes(params, keys);
|
|
6286
|
+
if (!keys.every(key => this._skipRenderAttributes.includes(key))) {
|
|
6287
|
+
this.render();
|
|
6288
|
+
}
|
|
6289
|
+
this.valid = this.isValid();
|
|
6290
|
+
if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTags(keys))) {
|
|
6291
|
+
this.addUpdateShapeAndBoundsTag();
|
|
6292
|
+
}
|
|
6293
|
+
else {
|
|
6294
|
+
this.addUpdateBoundTag();
|
|
6295
|
+
}
|
|
6296
|
+
this.addUpdatePositionTag();
|
|
6297
|
+
this.onAttributeUpdate();
|
|
6298
|
+
}
|
|
6299
|
+
_mergeAttributes(params, keys) {
|
|
6300
|
+
if (isNil(keys)) {
|
|
6301
|
+
keys = Object.keys(params);
|
|
6302
|
+
}
|
|
6303
|
+
for (let i = 0; i < keys.length; i++) {
|
|
6304
|
+
const key = keys[i];
|
|
6305
|
+
if (isPlainObject$2(this.attribute[key]) && !isFunction(this.attribute[key]) && !isFunction(params[key])) {
|
|
6306
|
+
merge(this.attribute[key], params[key]);
|
|
6307
|
+
}
|
|
6308
|
+
else {
|
|
6309
|
+
this.attribute[key] = params[key];
|
|
6310
|
+
}
|
|
6311
|
+
}
|
|
6312
|
+
}
|
|
6313
|
+
bindEvents() {
|
|
6314
|
+
}
|
|
6315
|
+
_getNodeId(id) {
|
|
6316
|
+
var _a;
|
|
6317
|
+
return `${(_a = this.id) !== null && _a !== void 0 ? _a : this._uid}-${this.name}-${id}`;
|
|
6318
|
+
}
|
|
6319
|
+
_dispatchEvent(eventName, details) {
|
|
6320
|
+
var _a;
|
|
6321
|
+
const changeEvent = new CustomEvent(eventName, details);
|
|
6322
|
+
changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
|
|
6323
|
+
this.dispatchEvent(changeEvent);
|
|
6324
|
+
}
|
|
6325
|
+
eventPosToStagePos(e) {
|
|
6326
|
+
var _a, _b;
|
|
6327
|
+
const result = { x: 0, y: 0 };
|
|
6328
|
+
const stagePoints = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
6329
|
+
this.globalTransMatrix.transformPoint(stagePoints, result);
|
|
6330
|
+
return result;
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
|
|
6334
|
+
class Hook {
|
|
6335
|
+
constructor(args, name) {
|
|
6336
|
+
this._args = args, this.name = name, this.taps = [];
|
|
6337
|
+
}
|
|
6338
|
+
tap(options, fn) {
|
|
6339
|
+
this._tap("sync", options, fn);
|
|
6340
|
+
}
|
|
6341
|
+
unTap(options, fn) {
|
|
6342
|
+
const name = "string" == typeof options ? options.trim() : options.name;
|
|
6343
|
+
name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
|
|
6344
|
+
}
|
|
6345
|
+
_parseOptions(type, options, fn) {
|
|
6346
|
+
let _options;
|
|
6347
|
+
if ("string" == typeof options) _options = {
|
|
6348
|
+
name: options.trim()
|
|
6349
|
+
};else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
|
|
6350
|
+
if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
|
|
6351
|
+
return _options = Object.assign({
|
|
6352
|
+
type: type,
|
|
6353
|
+
fn: fn
|
|
6354
|
+
}, _options), _options;
|
|
6355
|
+
}
|
|
6356
|
+
_tap(type, options, fn) {
|
|
6357
|
+
this._insert(this._parseOptions(type, options, fn));
|
|
6358
|
+
}
|
|
6359
|
+
_insert(item) {
|
|
6360
|
+
let before;
|
|
6361
|
+
"string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
|
|
6362
|
+
let stage = 0;
|
|
6363
|
+
"number" == typeof item.stage && (stage = item.stage);
|
|
6364
|
+
let i = this.taps.length;
|
|
6365
|
+
for (; i > 0;) {
|
|
6366
|
+
i--;
|
|
6367
|
+
const x = this.taps[i];
|
|
6368
|
+
this.taps[i + 1] = x;
|
|
6369
|
+
const xStage = x.stage || 0;
|
|
6370
|
+
if (before) {
|
|
6371
|
+
if (before.has(x.name)) {
|
|
6372
|
+
before.delete(x.name);
|
|
6373
|
+
continue;
|
|
6374
|
+
}
|
|
6375
|
+
if (before.size > 0) continue;
|
|
6376
|
+
}
|
|
6377
|
+
if (!(xStage > stage)) {
|
|
6378
|
+
i++;
|
|
6379
|
+
break;
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
this.taps[i] = item;
|
|
6383
|
+
}
|
|
6384
|
+
}
|
|
6385
|
+
|
|
6386
|
+
class SyncHook extends Hook {
|
|
6387
|
+
call(...args) {
|
|
6388
|
+
this.taps.map(t => t.fn).forEach(cb => cb(...args));
|
|
6389
|
+
}
|
|
6390
|
+
}
|
|
6391
|
+
|
|
6392
|
+
let idx = 0;
|
|
6393
|
+
class PerformanceRAF {
|
|
6394
|
+
constructor() {
|
|
6395
|
+
this.nextAnimationFrameCbs = new Map(), this._rafHandle = null, this.runAnimationFrame = time => {
|
|
6396
|
+
this._rafHandle = null;
|
|
6397
|
+
const cbs = this.nextAnimationFrameCbs;
|
|
6398
|
+
this.nextAnimationFrameCbs = new Map(), cbs.forEach(cb => cb(time));
|
|
6399
|
+
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
6400
|
+
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.size && (this._rafHandle = application.global.getRequestAnimationFrame()(this.runAnimationFrame));
|
|
6401
|
+
};
|
|
6402
|
+
}
|
|
6403
|
+
addAnimationFrameCb(callback) {
|
|
6404
|
+
return this.nextAnimationFrameCbs.set(++idx, callback), this.tryRunAnimationFrameNextFrame(), idx;
|
|
6405
|
+
}
|
|
6406
|
+
removeAnimationFrameCb(index) {
|
|
6407
|
+
return !!this.nextAnimationFrameCbs.has(index) && (this.nextAnimationFrameCbs.delete(index), !0);
|
|
6408
|
+
}
|
|
6409
|
+
wait() {
|
|
6410
|
+
return new Promise(resolve => {
|
|
6411
|
+
this.addAnimationFrameCb(() => resolve());
|
|
6412
|
+
});
|
|
6413
|
+
}
|
|
6414
|
+
}
|
|
6415
|
+
|
|
6416
|
+
class EventListenerManager {
|
|
6417
|
+
constructor() {
|
|
6418
|
+
this._listenerMap = new Map(), this._eventListenerTransformer = event => event;
|
|
6419
|
+
}
|
|
6420
|
+
setEventListenerTransformer(transformer) {
|
|
6421
|
+
this._eventListenerTransformer = transformer || (event => event);
|
|
6422
|
+
}
|
|
6423
|
+
addEventListener(type, listener, options) {
|
|
6424
|
+
if (!listener) return;
|
|
6425
|
+
const capture = this._resolveCapture(options),
|
|
6426
|
+
once = this._resolveOnce(options),
|
|
6427
|
+
listenerTypeMap = this._getOrCreateListenerTypeMap(type),
|
|
6428
|
+
wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
|
|
6429
|
+
if (wrappedMap.has(capture)) return;
|
|
6430
|
+
const wrappedListener = event => {
|
|
6431
|
+
const transformedEvent = this._eventListenerTransformer(event);
|
|
6432
|
+
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
|
|
6433
|
+
};
|
|
6434
|
+
wrappedMap.set(capture, {
|
|
6435
|
+
wrappedListener: wrappedListener,
|
|
6436
|
+
options: options
|
|
6437
|
+
}), this._nativeAddEventListener(type, wrappedListener, options);
|
|
6438
|
+
}
|
|
6439
|
+
removeEventListener(type, listener, options) {
|
|
6440
|
+
var _a, _b;
|
|
6441
|
+
if (!listener) return;
|
|
6442
|
+
const capture = this._resolveCapture(options),
|
|
6443
|
+
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);
|
|
6444
|
+
wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
|
|
6445
|
+
}
|
|
6446
|
+
dispatchEvent(event) {
|
|
6447
|
+
return this._nativeDispatchEvent(event);
|
|
6448
|
+
}
|
|
6449
|
+
clearAllEventListeners() {
|
|
6450
|
+
this._listenerMap.forEach((listenerMap, type) => {
|
|
6451
|
+
listenerMap.forEach(wrappedMap => {
|
|
6452
|
+
wrappedMap.forEach((wrappedRecord, capture) => {
|
|
6453
|
+
this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
|
|
6454
|
+
});
|
|
6455
|
+
});
|
|
6456
|
+
}), this._listenerMap.clear();
|
|
6457
|
+
}
|
|
6458
|
+
_resolveCapture(options) {
|
|
6459
|
+
return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
|
|
6460
|
+
}
|
|
6461
|
+
_resolveOnce(options) {
|
|
6462
|
+
return "object" == typeof options && !!(null == options ? void 0 : options.once);
|
|
6463
|
+
}
|
|
6464
|
+
_getOrCreateListenerTypeMap(type) {
|
|
6465
|
+
let listenerTypeMap = this._listenerMap.get(type);
|
|
6466
|
+
return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
|
|
6467
|
+
}
|
|
6468
|
+
_getOrCreateWrappedMap(listenerTypeMap, listener) {
|
|
6469
|
+
let wrappedMap = listenerTypeMap.get(listener);
|
|
6470
|
+
return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
|
|
6471
|
+
}
|
|
6472
|
+
_deleteListenerRecord(type, listener, capture) {
|
|
6473
|
+
const listenerTypeMap = this._listenerMap.get(type);
|
|
6474
|
+
if (!listenerTypeMap) return;
|
|
6475
|
+
const wrappedMap = listenerTypeMap.get(listener);
|
|
6476
|
+
wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
|
|
6477
|
+
}
|
|
6478
|
+
_nativeAddEventListener(type, listener, options) {
|
|
6479
|
+
throw new Error("_nativeAddEventListener must be implemented by derived classes");
|
|
6480
|
+
}
|
|
6481
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
6482
|
+
throw new Error("_nativeRemoveEventListener must be implemented by derived classes");
|
|
6483
|
+
}
|
|
6484
|
+
_nativeDispatchEvent(event) {
|
|
6485
|
+
throw new Error("_nativeDispatchEvent must be implemented by derived classes");
|
|
6486
|
+
}
|
|
6487
|
+
}
|
|
6488
|
+
|
|
6489
|
+
var __awaiter$3 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
6490
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6491
|
+
function fulfilled(value) {
|
|
6492
|
+
try {
|
|
6493
|
+
step(generator.next(value));
|
|
6494
|
+
} catch (e) {
|
|
6495
|
+
reject(e);
|
|
6496
|
+
}
|
|
6497
|
+
}
|
|
6498
|
+
function rejected(value) {
|
|
6499
|
+
try {
|
|
6500
|
+
step(generator.throw(value));
|
|
6501
|
+
} catch (e) {
|
|
6502
|
+
reject(e);
|
|
6503
|
+
}
|
|
6504
|
+
}
|
|
6505
|
+
function step(result) {
|
|
6506
|
+
var value;
|
|
6507
|
+
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
|
|
6508
|
+
resolve(value);
|
|
6509
|
+
})).then(fulfilled, rejected);
|
|
6510
|
+
}
|
|
6511
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6512
|
+
});
|
|
6513
|
+
};
|
|
6514
|
+
class DefaultGlobal extends EventListenerManager {
|
|
6515
|
+
get env() {
|
|
6516
|
+
return this._env;
|
|
6517
|
+
}
|
|
6518
|
+
get isImageAnonymous() {
|
|
6519
|
+
return this._isImageAnonymous;
|
|
6520
|
+
}
|
|
6521
|
+
set isImageAnonymous(isImageAnonymous) {
|
|
6522
|
+
this._isImageAnonymous = isImageAnonymous;
|
|
6523
|
+
}
|
|
6524
|
+
get devicePixelRatio() {
|
|
6525
|
+
return this._env || this.setEnv("browser"), this.envContribution.getDevicePixelRatio();
|
|
6526
|
+
}
|
|
6527
|
+
get supportEvent() {
|
|
6528
|
+
return this._env || this.setEnv("browser"), this.envContribution.supportEvent;
|
|
6529
|
+
}
|
|
6530
|
+
set supportEvent(support) {
|
|
6531
|
+
this._env || this.setEnv("browser"), this.envContribution.supportEvent = support;
|
|
6532
|
+
}
|
|
6533
|
+
get supportsTouchEvents() {
|
|
6534
|
+
return this._env || this.setEnv("browser"), this.envContribution.supportsTouchEvents;
|
|
6535
|
+
}
|
|
6536
|
+
set supportsTouchEvents(support) {
|
|
6537
|
+
this._env || this.setEnv("browser"), this.envContribution.supportsTouchEvents = support;
|
|
6538
|
+
}
|
|
6539
|
+
get supportsPointerEvents() {
|
|
6540
|
+
return this._env || this.setEnv("browser"), this.envContribution.supportsPointerEvents;
|
|
6541
|
+
}
|
|
6542
|
+
set supportsPointerEvents(support) {
|
|
6543
|
+
this._env || this.setEnv("browser"), this.envContribution.supportsPointerEvents = support;
|
|
6544
|
+
}
|
|
6545
|
+
get supportsMouseEvents() {
|
|
6546
|
+
return this._env || this.setEnv("browser"), this.envContribution.supportsMouseEvents;
|
|
6547
|
+
}
|
|
6548
|
+
set supportsMouseEvents(support) {
|
|
6549
|
+
this._env || this.setEnv("browser"), this.envContribution.supportsMouseEvents = support;
|
|
6550
|
+
}
|
|
6551
|
+
get applyStyles() {
|
|
6552
|
+
return this._env || this.setEnv("browser"), this.envContribution.applyStyles;
|
|
6553
|
+
}
|
|
6554
|
+
set applyStyles(support) {
|
|
6555
|
+
this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
|
|
6556
|
+
}
|
|
6557
|
+
constructor(contributions) {
|
|
6558
|
+
super(), this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.eventListenerTransformer = event => event, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
6559
|
+
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
6560
|
+
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
6561
|
+
}
|
|
6562
|
+
_nativeAddEventListener(type, listener, options) {
|
|
6563
|
+
return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
|
|
6564
|
+
}
|
|
6565
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
6566
|
+
return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
|
|
6567
|
+
}
|
|
6568
|
+
_nativeDispatchEvent(event) {
|
|
6569
|
+
return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
|
|
6570
|
+
}
|
|
6571
|
+
bindContribution(params) {
|
|
6572
|
+
const promiseArr = [];
|
|
6573
|
+
if (this.contributions.getContributions().forEach(contribution => {
|
|
6574
|
+
const data = contribution.configure(this, params);
|
|
6575
|
+
data && data.then && promiseArr.push(data);
|
|
6576
|
+
}), promiseArr.length) return Promise.all(promiseArr);
|
|
6577
|
+
}
|
|
6578
|
+
getDynamicCanvasCount() {
|
|
6579
|
+
return this._env || this.setEnv("browser"), this.envContribution.getDynamicCanvasCount();
|
|
6580
|
+
}
|
|
6581
|
+
getStaticCanvasCount() {
|
|
6582
|
+
return this._env || this.setEnv("browser"), this.envContribution.getStaticCanvasCount();
|
|
6583
|
+
}
|
|
6584
|
+
setEnv(env, params) {
|
|
6585
|
+
if (params && !0 === params.force || this._env !== env) return this.deactiveCurrentEnv(), this.activeEnv(env, params);
|
|
6586
|
+
}
|
|
6587
|
+
deactiveCurrentEnv() {
|
|
6588
|
+
this.envContribution && this.envContribution.release();
|
|
6589
|
+
}
|
|
6590
|
+
activeEnv(env, params) {
|
|
6591
|
+
const lastEnv = this._env;
|
|
6592
|
+
this._env = env;
|
|
6593
|
+
const data = this.bindContribution(params);
|
|
6594
|
+
if (data && data.then) return data.then(() => {
|
|
6595
|
+
this.envParams = params, this.hooks.onSetEnv.call(lastEnv, env, this);
|
|
6596
|
+
});
|
|
6597
|
+
this.envParams = params, this.hooks.onSetEnv.call(lastEnv, env, this);
|
|
6598
|
+
}
|
|
6599
|
+
setActiveEnvContribution(contribution) {
|
|
6600
|
+
this.envContribution = contribution;
|
|
6601
|
+
}
|
|
6602
|
+
createCanvas(params) {
|
|
6603
|
+
return this._env || this.setEnv("browser"), this.envContribution.createCanvas(params);
|
|
6604
|
+
}
|
|
6605
|
+
createOffscreenCanvas(params) {
|
|
6606
|
+
return this._env || this.setEnv("browser"), this.envContribution.createOffscreenCanvas(params);
|
|
6607
|
+
}
|
|
6608
|
+
releaseCanvas(canvas) {
|
|
6609
|
+
return this._env || this.setEnv("browser"), this.envContribution.releaseCanvas(canvas);
|
|
6610
|
+
}
|
|
6611
|
+
getRequestAnimationFrame() {
|
|
6612
|
+
return this._env || this.setEnv("browser"), this.envContribution.getRequestAnimationFrame();
|
|
6613
|
+
}
|
|
6614
|
+
getSpecifiedRequestAnimationFrame(id) {
|
|
6615
|
+
this._env || this.setEnv("browser"), this._performanceRAFList[id] || (this._performanceRAFList[id] = new PerformanceRAF());
|
|
6616
|
+
const performanceRAF = this._performanceRAFList[id];
|
|
6617
|
+
return callback => performanceRAF.addAnimationFrameCb(callback);
|
|
6618
|
+
}
|
|
6619
|
+
getSpecifiedPerformanceRAF(id) {
|
|
6620
|
+
return this._env || this.setEnv("browser"), this._performanceRAFList[id] || (this._performanceRAFList[id] = new PerformanceRAF()), this._performanceRAFList[id];
|
|
6621
|
+
}
|
|
6622
|
+
getSpecifiedCancelAnimationFrame(id) {
|
|
6623
|
+
if (this._env || this.setEnv("browser"), !this._performanceRAFList[id]) return () => !1;
|
|
6624
|
+
const performanceRAF = this._performanceRAFList[id];
|
|
6625
|
+
return handle => performanceRAF.removeAnimationFrameCb(handle);
|
|
6626
|
+
}
|
|
6627
|
+
getCancelAnimationFrame() {
|
|
6628
|
+
return this._env || this.setEnv("browser"), this.envContribution.getCancelAnimationFrame();
|
|
6629
|
+
}
|
|
6630
|
+
getElementById(str) {
|
|
6631
|
+
return this._env || this.setEnv("browser"), this.envContribution.getElementById ? this.envContribution.getElementById(str) : null;
|
|
6632
|
+
}
|
|
6633
|
+
getRootElement() {
|
|
6634
|
+
return this._env || this.setEnv("browser"), this.envContribution.getRootElement ? this.envContribution.getRootElement() : null;
|
|
6635
|
+
}
|
|
6636
|
+
getDocument() {
|
|
6637
|
+
return this._env || this.setEnv("browser"), this.envContribution.getDocument ? this.envContribution.getDocument() : null;
|
|
6638
|
+
}
|
|
6639
|
+
mapToCanvasPoint(event, domElement) {
|
|
6640
|
+
return this._env || this.setEnv("browser"), this.envContribution.mapToCanvasPoint ? this.envContribution.mapToCanvasPoint(event, domElement) : null;
|
|
6641
|
+
}
|
|
6642
|
+
loadImage(url) {
|
|
6643
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadImage(url);
|
|
6644
|
+
}
|
|
6645
|
+
loadSvg(str) {
|
|
6646
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadSvg(str);
|
|
6647
|
+
}
|
|
6648
|
+
loadJson(url) {
|
|
6649
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadJson(url);
|
|
6650
|
+
}
|
|
6651
|
+
loadArrayBuffer(url) {
|
|
6652
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadArrayBuffer(url);
|
|
6653
|
+
}
|
|
6654
|
+
loadBlob(url) {
|
|
6655
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadBlob(url);
|
|
6656
|
+
}
|
|
6657
|
+
loadFont(name, source, descriptors) {
|
|
6658
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
6659
|
+
return this._env || this.setEnv("browser"), this.envContribution.loadFont(name, source, descriptors);
|
|
6660
|
+
});
|
|
6661
|
+
}
|
|
6662
|
+
isChrome() {
|
|
6663
|
+
return null != this._isChrome || (this._env || this.setEnv("browser"), this._isChrome = "browser" === this._env && navigator.userAgent.indexOf("Chrome") > -1), this._isChrome;
|
|
6664
|
+
}
|
|
6665
|
+
isSafari() {
|
|
6666
|
+
return null != this._isSafari || (this._env || this.setEnv("browser"), this._isSafari = "browser" === this._env && /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)), this._isSafari;
|
|
6667
|
+
}
|
|
6668
|
+
getNativeAABBBounds(dom) {
|
|
6669
|
+
return this._env || this.setEnv("browser"), this.envContribution.getNativeAABBBounds(dom);
|
|
6670
|
+
}
|
|
6671
|
+
removeDom(dom) {
|
|
6672
|
+
return this._env || this.setEnv("browser"), this.envContribution.removeDom(dom);
|
|
6673
|
+
}
|
|
6674
|
+
createDom(params) {
|
|
6675
|
+
return this._env || this.setEnv("browser"), this.envContribution.createDom(params);
|
|
6676
|
+
}
|
|
6677
|
+
updateDom(dom, params) {
|
|
6678
|
+
return this._env || this.setEnv("browser"), this.envContribution.updateDom(dom, params);
|
|
6679
|
+
}
|
|
6680
|
+
getElementTop(dom, baseWindow = !1) {
|
|
6681
|
+
return this._env || this.setEnv("browser"), this.envContribution.getElementTop(dom, baseWindow);
|
|
6682
|
+
}
|
|
6683
|
+
getElementLeft(dom, baseWindow = !1) {
|
|
6684
|
+
return this._env || this.setEnv("browser"), this.envContribution.getElementLeft(dom, baseWindow);
|
|
6685
|
+
}
|
|
6686
|
+
getElementTopLeft(dom, baseWindow = !1) {
|
|
6687
|
+
return this._env || this.setEnv("browser"), this.envContribution.getElementTopLeft(dom, baseWindow);
|
|
6688
|
+
}
|
|
6689
|
+
isMacOS() {
|
|
6690
|
+
return this._env || this.setEnv("browser"), this.envContribution.isMacOS();
|
|
6691
|
+
}
|
|
6692
|
+
copyToClipBoard(text) {
|
|
6693
|
+
return this._env || this.setEnv("browser"), this.envContribution.copyToClipBoard(text);
|
|
6694
|
+
}
|
|
6695
|
+
}
|
|
6696
|
+
|
|
7027
6697
|
const updateBoundsOfCommonOuterBorder = (attribute, theme, aabbBounds) => {
|
|
7028
6698
|
const {
|
|
7029
6699
|
outerBorder: outerBorder,
|
|
@@ -9565,243 +9235,6 @@ function createArc(attributes) {
|
|
|
9565
9235
|
return new Arc(attributes);
|
|
9566
9236
|
}
|
|
9567
9237
|
|
|
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
9238
|
const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
9806
9239
|
class Polygon extends Graphic {
|
|
9807
9240
|
constructor(params) {
|
|
@@ -10014,12 +9447,6 @@ class DefaultGraphicService {
|
|
|
10014
9447
|
clearAABBBounds(graphic, stage, b) {
|
|
10015
9448
|
this.hooks.clearAABBBounds.taps.length && this.hooks.clearAABBBounds.call(graphic, stage, b);
|
|
10016
9449
|
}
|
|
10017
|
-
updatePathProxyAABBBounds(aabbBounds, graphic) {
|
|
10018
|
-
const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
|
|
10019
|
-
if (!path) return !1;
|
|
10020
|
-
const boundsContext = new BoundsContext(aabbBounds);
|
|
10021
|
-
return renderCommandList(path.commandList, boundsContext, 0, 0), !0;
|
|
10022
|
-
}
|
|
10023
9450
|
updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
|
|
10024
9451
|
const {
|
|
10025
9452
|
textAlign: textAlign,
|
|
@@ -11124,8 +10551,8 @@ const EMPTY_AUTO_ENABLE_PROVIDER = {
|
|
|
11124
10551
|
};
|
|
11125
10552
|
class DefaultPluginService {
|
|
11126
10553
|
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()
|
|
10554
|
+
var _a;
|
|
10555
|
+
this.autoEnablePlugins = autoEnablePlugins, this.onStartupFinishedPlugin = [], this.onRegisterPlugin = [], this.actived = !1, this.pluginRegistry = null !== (_a = deps.pluginRegistry) && void 0 !== _a ? _a : new PluginRegistry();
|
|
11129
10556
|
}
|
|
11130
10557
|
active(stage, params) {
|
|
11131
10558
|
this.stage = stage, this.actived = !0;
|
|
@@ -15371,133 +14798,6 @@ function registerWrapTextGraphic() {
|
|
|
15371
14798
|
registerGraphic("wrapText", createWrapText);
|
|
15372
14799
|
}
|
|
15373
14800
|
|
|
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
14801
|
function _registerGroup() {
|
|
15502
14802
|
_registerGroup.__loaded || (_registerGroup.__loaded = !0, registerGroupGraphic());
|
|
15503
14803
|
}
|
|
@@ -20252,9 +19552,8 @@ class AnimateExecutor {
|
|
|
20252
19552
|
}
|
|
20253
19553
|
syncFinalAttrsFromContext(graphic) {
|
|
20254
19554
|
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);
|
|
19555
|
+
const finalAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.finalAttrs;
|
|
19556
|
+
finalAttrs && graphic.setFinalAttributes(finalAttrs);
|
|
20258
19557
|
}
|
|
20259
19558
|
executeItem(params, graphic, index = 0, count = 1) {
|
|
20260
19559
|
if (Array.isArray(params)) {
|
|
@@ -20572,11 +19871,9 @@ function getAnimationContext(type) {
|
|
|
20572
19871
|
}
|
|
20573
19872
|
}
|
|
20574
19873
|
function applyAnimationTransientAttributes(target, attributes, type = AttributeUpdateType.ANIMATE_UPDATE) {
|
|
20575
|
-
var _a;
|
|
20576
19874
|
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);
|
|
19875
|
+
const context = getAnimationContext(type);
|
|
19876
|
+
target.applyAnimationTransientAttributes(attributes, !1, context);
|
|
20580
19877
|
}
|
|
20581
19878
|
|
|
20582
19879
|
function noop() {}
|
|
@@ -20588,8 +19885,7 @@ class Step {
|
|
|
20588
19885
|
constructor(type, props, duration, easing) {
|
|
20589
19886
|
var _a;
|
|
20590
19887
|
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, {
|
|
19888
|
+
this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag(), this.target.onAttributeUpdate({
|
|
20593
19889
|
type: AttributeUpdateType.ANIMATE_UPDATE
|
|
20594
19890
|
});
|
|
20595
19891
|
}, 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 +19958,10 @@ class Step {
|
|
|
20662
19958
|
}
|
|
20663
19959
|
}
|
|
20664
19960
|
tryPreventConflict() {
|
|
20665
|
-
var _a, _b;
|
|
20666
19961
|
const animate = this.animate,
|
|
20667
19962
|
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
19963
|
propKeys = this.propKeys;
|
|
20673
|
-
forEachTrackedAnimate(a => {
|
|
19964
|
+
target.forEachTrackedAnimate(a => {
|
|
20674
19965
|
if (a === animate || a.priority > animate.priority || a.priority === 1 / 0) return;
|
|
20675
19966
|
const fromProps = a.getStartProps();
|
|
20676
19967
|
let conflictKeys = null;
|
|
@@ -21993,7 +21284,7 @@ const getCartesianLabelBounds = (scale, domain, op) => {
|
|
|
21993
21284
|
for (let i = 0; i < domain.length; i++) {
|
|
21994
21285
|
const v = domain[i];
|
|
21995
21286
|
const str = labelFormatter ? labelFormatter(v) : `${v}`;
|
|
21996
|
-
if (isPlainObject$
|
|
21287
|
+
if (isPlainObject$2(str)) {
|
|
21997
21288
|
labelBoundsList = undefined;
|
|
21998
21289
|
break;
|
|
21999
21290
|
}
|
|
@@ -27594,19 +26885,13 @@ class FromTo extends ACustomAnimate {
|
|
|
27594
26885
|
super(from, to, duration, easing, params), this.from = null != from ? from : {};
|
|
27595
26886
|
}
|
|
27596
26887
|
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
|
-
});
|
|
26888
|
+
applyAnimationTransientAttributes(this.target, this.from, AttributeUpdateType.ANIMATE_START);
|
|
27604
26889
|
}
|
|
27605
26890
|
onBind() {
|
|
27606
|
-
var _a, _b, _c
|
|
26891
|
+
var _a, _b, _c;
|
|
27607
26892
|
super.onBind(), Object.keys(this.from).forEach(key => {
|
|
27608
26893
|
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) &&
|
|
26894
|
+
}), "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
26895
|
}
|
|
27611
26896
|
onFirstRun() {
|
|
27612
26897
|
this.from = Object.assign(Object.assign({}, this.getLastProps()), this.from);
|
|
@@ -27667,8 +26952,8 @@ class Animate {
|
|
|
27667
26952
|
bind(target) {
|
|
27668
26953
|
this.target = target;
|
|
27669
26954
|
const trackerTarget = this.target;
|
|
27670
|
-
return
|
|
27671
|
-
this.stop(), this.__skipRestoreStaticAttributeOnRemove ||
|
|
26955
|
+
return trackerTarget.detachAttributeFromBaseAttributes(), trackerTarget.trackAnimate(this), this.onRemove(() => {
|
|
26956
|
+
this.stop(), this.__skipRestoreStaticAttributeOnRemove || trackerTarget.restoreStaticAttribute(), trackerTarget.untrackAnimate(this.id);
|
|
27672
26957
|
}), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
|
|
27673
26958
|
}
|
|
27674
26959
|
to(props, duration = 300, easing = "linear") {
|
|
@@ -27805,8 +27090,7 @@ class Animate {
|
|
|
27805
27090
|
if (nextTime < this._startTime) return void (this.currentTime = nextTime);
|
|
27806
27091
|
if (nextTime >= this._startTime + this._totalDuration) {
|
|
27807
27092
|
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);
|
|
27093
|
+
return this.target.restoreStaticAttribute(), void (this.__skipRestoreStaticAttributeOnRemove = !0);
|
|
27810
27094
|
}
|
|
27811
27095
|
this.status = AnimateStatus.RUNNING, this.currentTime <= this._startTime && this.onStart(), this.currentTime = nextTime;
|
|
27812
27096
|
let cycleTime = nextTime - this._startTime,
|
|
@@ -27980,8 +27264,7 @@ class DefaultTicker extends EventEmitter {
|
|
|
27980
27264
|
|
|
27981
27265
|
class AnimateExtension {
|
|
27982
27266
|
visitTrackedAnimates(cb) {
|
|
27983
|
-
|
|
27984
|
-
"function" != typeof target.forEachTrackedAnimate ? target.animates && target.animates.forEach(cb) : target.forEachTrackedAnimate(cb);
|
|
27267
|
+
this.forEachTrackedAnimate(cb);
|
|
27985
27268
|
}
|
|
27986
27269
|
getAttributes(final = !1) {
|
|
27987
27270
|
return final && this.finalAttribute ? this.finalAttribute : this.attribute;
|
|
@@ -28017,15 +27300,12 @@ class AnimateExtension {
|
|
|
28017
27300
|
applyFinalAttributeToAttribute() {
|
|
28018
27301
|
const finalAttribute = this.getFinalAttribute();
|
|
28019
27302
|
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, {
|
|
27303
|
+
this.setAttributesAndPreventAnimate(finalAttribute, !1, {
|
|
28022
27304
|
type: AttributeUpdateType.ANIMATE_BIND
|
|
28023
27305
|
});
|
|
28024
27306
|
}
|
|
28025
27307
|
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({
|
|
27308
|
+
this._restoreAttributeFromStaticTruth({
|
|
28029
27309
|
type: AttributeUpdateType.ANIMATE_END
|
|
28030
27310
|
});
|
|
28031
27311
|
}
|
|
@@ -36938,6 +36218,6 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
36938
36218
|
select: true
|
|
36939
36219
|
};
|
|
36940
36220
|
|
|
36941
|
-
const version = "1.1.0-alpha.
|
|
36221
|
+
const version = "1.1.0-alpha.26";
|
|
36942
36222
|
|
|
36943
36223
|
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 };
|