@antv/g-lite 2.4.1 → 2.5.1
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/dist/index.esm.js +43 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +43 -24
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +4 -4
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/types/dom/CustomEvent.d.ts.map +1 -1
- package/types/dom/MutationObserver.d.ts +6 -6
- package/types/dom/MutationObserver.d.ts.map +1 -1
- package/types/dom/Node.d.ts +2 -0
- package/types/dom/Node.d.ts.map +1 -1
- package/types/services/RenderingService.d.ts.map +1 -1
- package/types/services/SceneGraphService.d.ts +0 -2
- package/types/services/SceneGraphService.d.ts.map +1 -1
- package/types/services/interfaces.d.ts +0 -1
- package/types/services/interfaces.d.ts.map +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @antv/g-lite
|
|
3
3
|
* @description A core module for rendering engine implements DOM API.
|
|
4
|
-
* @version 2.
|
|
5
|
-
* @date
|
|
4
|
+
* @version 2.5.1
|
|
5
|
+
* @date 12/12/2025, 3:28:41 AM
|
|
6
6
|
* @author AntVis
|
|
7
7
|
* @docs https://g.antv.antgroup.com/
|
|
8
8
|
*/
|
|
@@ -21,6 +21,7 @@ require('@babel/runtime/helpers/readOnlyError');
|
|
|
21
21
|
var util = require('@antv/util');
|
|
22
22
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
23
23
|
var _superPropGet = require('@babel/runtime/helpers/superPropGet');
|
|
24
|
+
var _arrayLikeToArray = require('@babel/runtime/helpers/arrayLikeToArray');
|
|
24
25
|
var gMath = require('@antv/g-math');
|
|
25
26
|
var _regeneratorRuntime = require('@babel/runtime/helpers/regeneratorRuntime');
|
|
26
27
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
@@ -8501,6 +8502,11 @@ var CustomEvent = /*#__PURE__*/function (_FederatedEvent) {
|
|
|
8501
8502
|
_this.type = eventName;
|
|
8502
8503
|
_this.detail = options === null || options === void 0 ? void 0 : options.detail;
|
|
8503
8504
|
|
|
8505
|
+
// compatible
|
|
8506
|
+
if (options && !('detail' in options)) {
|
|
8507
|
+
_this.detail = options;
|
|
8508
|
+
}
|
|
8509
|
+
|
|
8504
8510
|
// compatible with G 3.0
|
|
8505
8511
|
Object.assign(_this, options);
|
|
8506
8512
|
return _this;
|
|
@@ -8596,9 +8602,7 @@ var EventTarget = /*#__PURE__*/function () {
|
|
|
8596
8602
|
}, {
|
|
8597
8603
|
key: "emit",
|
|
8598
8604
|
value: function emit(eventName, object) {
|
|
8599
|
-
this.dispatchEvent(new CustomEvent(eventName,
|
|
8600
|
-
detail: object
|
|
8601
|
-
}));
|
|
8605
|
+
this.dispatchEvent(new CustomEvent(eventName, object));
|
|
8602
8606
|
}
|
|
8603
8607
|
}, {
|
|
8604
8608
|
key: "dispatchEventToSelf",
|
|
@@ -8696,6 +8700,7 @@ var Node = /*#__PURE__*/function (_EventTarget) {
|
|
|
8696
8700
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeValue
|
|
8697
8701
|
*/
|
|
8698
8702
|
_this.nodeValue = null;
|
|
8703
|
+
_this.mutations = undefined;
|
|
8699
8704
|
/**
|
|
8700
8705
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
|
|
8701
8706
|
*/
|
|
@@ -10135,7 +10140,6 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
10135
10140
|
value: function destroy() {
|
|
10136
10141
|
this.inited = false;
|
|
10137
10142
|
this.hooks.destroy.call();
|
|
10138
|
-
this.globalRuntime.sceneGraphService.clearMutationObserverData();
|
|
10139
10143
|
}
|
|
10140
10144
|
}, {
|
|
10141
10145
|
key: "dirty",
|
|
@@ -10404,7 +10408,6 @@ var $rotate_ParentInvertRotation = glMatrix.quat.create();
|
|
|
10404
10408
|
var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
10405
10409
|
function DefaultSceneGraphService(runtime) {
|
|
10406
10410
|
_classCallCheck(this, DefaultSceneGraphService);
|
|
10407
|
-
this.mutationsMap = new Map();
|
|
10408
10411
|
this.displayObjectDependencyMap = new WeakMap();
|
|
10409
10412
|
this.runtime = runtime;
|
|
10410
10413
|
}
|
|
@@ -11093,7 +11096,6 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
11093
11096
|
key: "syncHierarchy",
|
|
11094
11097
|
value: function syncHierarchy(rootNode) {
|
|
11095
11098
|
var _transformable, _transformable2;
|
|
11096
|
-
// console.log('syncHierarchy');
|
|
11097
11099
|
var stack = [rootNode];
|
|
11098
11100
|
var ancestors = rootNode.parentNode ? [{
|
|
11099
11101
|
node: rootNode.parentNode,
|
|
@@ -11176,21 +11178,25 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
11176
11178
|
});
|
|
11177
11179
|
}
|
|
11178
11180
|
this.informDependentDisplayObjects(element);
|
|
11179
|
-
var
|
|
11180
|
-
|
|
11181
|
-
|
|
11181
|
+
var mutations = element.mutations || [];
|
|
11182
|
+
var boundChangeMutation = mutations.find(function (item) {
|
|
11183
|
+
return item.type === 'attributes' && item._boundsChangeData;
|
|
11184
|
+
});
|
|
11185
|
+
if (!boundChangeMutation) {
|
|
11186
|
+
boundChangeMutation = {
|
|
11182
11187
|
type: 'attributes',
|
|
11183
11188
|
target: element,
|
|
11184
11189
|
_boundsChangeData: {
|
|
11185
11190
|
affectChildren: affectChildren
|
|
11186
11191
|
}
|
|
11187
11192
|
};
|
|
11188
|
-
|
|
11193
|
+
mutations.push(boundChangeMutation);
|
|
11189
11194
|
} else {
|
|
11190
|
-
|
|
11191
|
-
affectChildren:
|
|
11195
|
+
boundChangeMutation._boundsChangeData = {
|
|
11196
|
+
affectChildren: boundChangeMutation._boundsChangeData.affectChildren || affectChildren
|
|
11192
11197
|
};
|
|
11193
11198
|
}
|
|
11199
|
+
element.mutations = mutations;
|
|
11194
11200
|
}
|
|
11195
11201
|
}, {
|
|
11196
11202
|
key: "dirtyFragment",
|
|
@@ -11210,16 +11216,29 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
11210
11216
|
}, {
|
|
11211
11217
|
key: "notifyMutationObservers",
|
|
11212
11218
|
value: function notifyMutationObservers(canvas) {
|
|
11213
|
-
var
|
|
11214
|
-
|
|
11219
|
+
var mutations = new Set();
|
|
11220
|
+
canvas.getRoot().forEach(function (item) {
|
|
11221
|
+
(item.mutations || []).forEach(function (mutation) {
|
|
11222
|
+
if (mutation.type === 'attributes' && mutation._boundsChangeData) {
|
|
11223
|
+
if (mutation._boundsChangeData.affectChildren) {
|
|
11224
|
+
item.forEach(function (node) {
|
|
11225
|
+
var newMutation = _objectSpread({}, mutation);
|
|
11226
|
+
newMutation.target = node;
|
|
11227
|
+
mutations.add(newMutation);
|
|
11228
|
+
});
|
|
11229
|
+
} else {
|
|
11230
|
+
mutations.add(mutation);
|
|
11231
|
+
}
|
|
11232
|
+
}
|
|
11233
|
+
});
|
|
11234
|
+
item.mutations = undefined;
|
|
11215
11235
|
});
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
this.mutationsMap.clear();
|
|
11236
|
+
if (mutations.size > 0) {
|
|
11237
|
+
var event = new CustomEvent(ElementEvent.BOUNDS_CHANGED, {
|
|
11238
|
+
detail: Array.from(mutations)
|
|
11239
|
+
});
|
|
11240
|
+
canvas.dispatchEvent(event, true, true);
|
|
11241
|
+
}
|
|
11223
11242
|
}
|
|
11224
11243
|
}, {
|
|
11225
11244
|
key: "updateDisplayObjectDependency",
|
|
@@ -12363,7 +12382,7 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
12363
12382
|
nodes[_key3] = arguments[_key3];
|
|
12364
12383
|
}
|
|
12365
12384
|
var first = nodes[0],
|
|
12366
|
-
rest = nodes.slice(1);
|
|
12385
|
+
rest = _arrayLikeToArray(nodes).slice(1);
|
|
12367
12386
|
this.parentNode.appendChild(first, index);
|
|
12368
12387
|
(_ref = first).after.apply(_ref, _toConsumableArray(rest));
|
|
12369
12388
|
}
|