@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.esm.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
|
*/
|
|
@@ -19,6 +19,7 @@ import '@babel/runtime/helpers/readOnlyError';
|
|
|
19
19
|
import { isNumber, distanceSquareRoot, isString, isNil, clamp, getTotalLength, min, max, isNumberEqual, mod, normalizePath, path2Curve, equalizeSegments, getDrawDirection, reverseCurve, clonePath, getRotatedCurve, isUndefined, isArray, isBoolean, isFunction, isObject, getPointAtLength } from '@antv/util';
|
|
20
20
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
21
21
|
import _superPropGet from '@babel/runtime/helpers/superPropGet';
|
|
22
|
+
import _arrayLikeToArray from '@babel/runtime/helpers/arrayLikeToArray';
|
|
22
23
|
import { polylineLength, arcBox, cubicBox, quadBox, linePointAt, lineLength } from '@antv/g-math';
|
|
23
24
|
import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime';
|
|
24
25
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
@@ -8499,6 +8500,11 @@ var CustomEvent = /*#__PURE__*/function (_FederatedEvent) {
|
|
|
8499
8500
|
_this.type = eventName;
|
|
8500
8501
|
_this.detail = options === null || options === void 0 ? void 0 : options.detail;
|
|
8501
8502
|
|
|
8503
|
+
// compatible
|
|
8504
|
+
if (options && !('detail' in options)) {
|
|
8505
|
+
_this.detail = options;
|
|
8506
|
+
}
|
|
8507
|
+
|
|
8502
8508
|
// compatible with G 3.0
|
|
8503
8509
|
Object.assign(_this, options);
|
|
8504
8510
|
return _this;
|
|
@@ -8594,9 +8600,7 @@ var EventTarget = /*#__PURE__*/function () {
|
|
|
8594
8600
|
}, {
|
|
8595
8601
|
key: "emit",
|
|
8596
8602
|
value: function emit(eventName, object) {
|
|
8597
|
-
this.dispatchEvent(new CustomEvent(eventName,
|
|
8598
|
-
detail: object
|
|
8599
|
-
}));
|
|
8603
|
+
this.dispatchEvent(new CustomEvent(eventName, object));
|
|
8600
8604
|
}
|
|
8601
8605
|
}, {
|
|
8602
8606
|
key: "dispatchEventToSelf",
|
|
@@ -8694,6 +8698,7 @@ var Node = /*#__PURE__*/function (_EventTarget) {
|
|
|
8694
8698
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeValue
|
|
8695
8699
|
*/
|
|
8696
8700
|
_this.nodeValue = null;
|
|
8701
|
+
_this.mutations = undefined;
|
|
8697
8702
|
/**
|
|
8698
8703
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
|
|
8699
8704
|
*/
|
|
@@ -10133,7 +10138,6 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
10133
10138
|
value: function destroy() {
|
|
10134
10139
|
this.inited = false;
|
|
10135
10140
|
this.hooks.destroy.call();
|
|
10136
|
-
this.globalRuntime.sceneGraphService.clearMutationObserverData();
|
|
10137
10141
|
}
|
|
10138
10142
|
}, {
|
|
10139
10143
|
key: "dirty",
|
|
@@ -10402,7 +10406,6 @@ var $rotate_ParentInvertRotation = quat$1.create();
|
|
|
10402
10406
|
var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
10403
10407
|
function DefaultSceneGraphService(runtime) {
|
|
10404
10408
|
_classCallCheck(this, DefaultSceneGraphService);
|
|
10405
|
-
this.mutationsMap = new Map();
|
|
10406
10409
|
this.displayObjectDependencyMap = new WeakMap();
|
|
10407
10410
|
this.runtime = runtime;
|
|
10408
10411
|
}
|
|
@@ -11091,7 +11094,6 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
11091
11094
|
key: "syncHierarchy",
|
|
11092
11095
|
value: function syncHierarchy(rootNode) {
|
|
11093
11096
|
var _transformable, _transformable2;
|
|
11094
|
-
// console.log('syncHierarchy');
|
|
11095
11097
|
var stack = [rootNode];
|
|
11096
11098
|
var ancestors = rootNode.parentNode ? [{
|
|
11097
11099
|
node: rootNode.parentNode,
|
|
@@ -11174,21 +11176,25 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
11174
11176
|
});
|
|
11175
11177
|
}
|
|
11176
11178
|
this.informDependentDisplayObjects(element);
|
|
11177
|
-
var
|
|
11178
|
-
|
|
11179
|
-
|
|
11179
|
+
var mutations = element.mutations || [];
|
|
11180
|
+
var boundChangeMutation = mutations.find(function (item) {
|
|
11181
|
+
return item.type === 'attributes' && item._boundsChangeData;
|
|
11182
|
+
});
|
|
11183
|
+
if (!boundChangeMutation) {
|
|
11184
|
+
boundChangeMutation = {
|
|
11180
11185
|
type: 'attributes',
|
|
11181
11186
|
target: element,
|
|
11182
11187
|
_boundsChangeData: {
|
|
11183
11188
|
affectChildren: affectChildren
|
|
11184
11189
|
}
|
|
11185
11190
|
};
|
|
11186
|
-
|
|
11191
|
+
mutations.push(boundChangeMutation);
|
|
11187
11192
|
} else {
|
|
11188
|
-
|
|
11189
|
-
affectChildren:
|
|
11193
|
+
boundChangeMutation._boundsChangeData = {
|
|
11194
|
+
affectChildren: boundChangeMutation._boundsChangeData.affectChildren || affectChildren
|
|
11190
11195
|
};
|
|
11191
11196
|
}
|
|
11197
|
+
element.mutations = mutations;
|
|
11192
11198
|
}
|
|
11193
11199
|
}, {
|
|
11194
11200
|
key: "dirtyFragment",
|
|
@@ -11208,16 +11214,29 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
11208
11214
|
}, {
|
|
11209
11215
|
key: "notifyMutationObservers",
|
|
11210
11216
|
value: function notifyMutationObservers(canvas) {
|
|
11211
|
-
var
|
|
11212
|
-
|
|
11217
|
+
var mutations = new Set();
|
|
11218
|
+
canvas.getRoot().forEach(function (item) {
|
|
11219
|
+
(item.mutations || []).forEach(function (mutation) {
|
|
11220
|
+
if (mutation.type === 'attributes' && mutation._boundsChangeData) {
|
|
11221
|
+
if (mutation._boundsChangeData.affectChildren) {
|
|
11222
|
+
item.forEach(function (node) {
|
|
11223
|
+
var newMutation = _objectSpread({}, mutation);
|
|
11224
|
+
newMutation.target = node;
|
|
11225
|
+
mutations.add(newMutation);
|
|
11226
|
+
});
|
|
11227
|
+
} else {
|
|
11228
|
+
mutations.add(mutation);
|
|
11229
|
+
}
|
|
11230
|
+
}
|
|
11231
|
+
});
|
|
11232
|
+
item.mutations = undefined;
|
|
11213
11233
|
});
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
this.mutationsMap.clear();
|
|
11234
|
+
if (mutations.size > 0) {
|
|
11235
|
+
var event = new CustomEvent(ElementEvent.BOUNDS_CHANGED, {
|
|
11236
|
+
detail: Array.from(mutations)
|
|
11237
|
+
});
|
|
11238
|
+
canvas.dispatchEvent(event, true, true);
|
|
11239
|
+
}
|
|
11221
11240
|
}
|
|
11222
11241
|
}, {
|
|
11223
11242
|
key: "updateDisplayObjectDependency",
|
|
@@ -12361,7 +12380,7 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
12361
12380
|
nodes[_key3] = arguments[_key3];
|
|
12362
12381
|
}
|
|
12363
12382
|
var first = nodes[0],
|
|
12364
|
-
rest = nodes.slice(1);
|
|
12383
|
+
rest = _arrayLikeToArray(nodes).slice(1);
|
|
12365
12384
|
this.parentNode.appendChild(first, index);
|
|
12366
12385
|
(_ref = first).after.apply(_ref, _toConsumableArray(rest));
|
|
12367
12386
|
}
|