@antv/g-lite 2.4.0 → 2.5.0
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 +37 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +37 -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 +2 -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/types/types.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 10/
|
|
4
|
+
* @version 2.5.0
|
|
5
|
+
* @date 12/10/2025, 8:42:24 AM
|
|
6
6
|
* @author AntVis
|
|
7
7
|
* @docs https://g.antv.antgroup.com/
|
|
8
8
|
*/
|
|
@@ -19,12 +19,15 @@ 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';
|
|
25
26
|
import _createForOfIteratorHelper from '@babel/runtime/helpers/createForOfIteratorHelper';
|
|
26
27
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
27
28
|
|
|
29
|
+
/// <reference types="webxr" />
|
|
30
|
+
|
|
28
31
|
var Shape = /*#__PURE__*/function (Shape) {
|
|
29
32
|
Shape["GROUP"] = "g";
|
|
30
33
|
Shape["FRAGMENT"] = "fragment";
|
|
@@ -8497,6 +8500,11 @@ var CustomEvent = /*#__PURE__*/function (_FederatedEvent) {
|
|
|
8497
8500
|
_this.type = eventName;
|
|
8498
8501
|
_this.detail = options === null || options === void 0 ? void 0 : options.detail;
|
|
8499
8502
|
|
|
8503
|
+
// compatible
|
|
8504
|
+
if (options && !('detail' in options)) {
|
|
8505
|
+
_this.detail = options;
|
|
8506
|
+
}
|
|
8507
|
+
|
|
8500
8508
|
// compatible with G 3.0
|
|
8501
8509
|
Object.assign(_this, options);
|
|
8502
8510
|
return _this;
|
|
@@ -8592,9 +8600,7 @@ var EventTarget = /*#__PURE__*/function () {
|
|
|
8592
8600
|
}, {
|
|
8593
8601
|
key: "emit",
|
|
8594
8602
|
value: function emit(eventName, object) {
|
|
8595
|
-
this.dispatchEvent(new CustomEvent(eventName,
|
|
8596
|
-
detail: object
|
|
8597
|
-
}));
|
|
8603
|
+
this.dispatchEvent(new CustomEvent(eventName, object));
|
|
8598
8604
|
}
|
|
8599
8605
|
}, {
|
|
8600
8606
|
key: "dispatchEventToSelf",
|
|
@@ -8692,6 +8698,7 @@ var Node = /*#__PURE__*/function (_EventTarget) {
|
|
|
8692
8698
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeValue
|
|
8693
8699
|
*/
|
|
8694
8700
|
_this.nodeValue = null;
|
|
8701
|
+
_this.mutations = undefined;
|
|
8695
8702
|
/**
|
|
8696
8703
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
|
|
8697
8704
|
*/
|
|
@@ -10131,7 +10138,6 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
10131
10138
|
value: function destroy() {
|
|
10132
10139
|
this.inited = false;
|
|
10133
10140
|
this.hooks.destroy.call();
|
|
10134
|
-
this.globalRuntime.sceneGraphService.clearMutationObserverData();
|
|
10135
10141
|
}
|
|
10136
10142
|
}, {
|
|
10137
10143
|
key: "dirty",
|
|
@@ -10400,7 +10406,6 @@ var $rotate_ParentInvertRotation = quat$1.create();
|
|
|
10400
10406
|
var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
10401
10407
|
function DefaultSceneGraphService(runtime) {
|
|
10402
10408
|
_classCallCheck(this, DefaultSceneGraphService);
|
|
10403
|
-
this.mutationsMap = new Map();
|
|
10404
10409
|
this.displayObjectDependencyMap = new WeakMap();
|
|
10405
10410
|
this.runtime = runtime;
|
|
10406
10411
|
}
|
|
@@ -11089,7 +11094,6 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
11089
11094
|
key: "syncHierarchy",
|
|
11090
11095
|
value: function syncHierarchy(rootNode) {
|
|
11091
11096
|
var _transformable, _transformable2;
|
|
11092
|
-
// console.log('syncHierarchy');
|
|
11093
11097
|
var stack = [rootNode];
|
|
11094
11098
|
var ancestors = rootNode.parentNode ? [{
|
|
11095
11099
|
node: rootNode.parentNode,
|
|
@@ -11172,21 +11176,25 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
11172
11176
|
});
|
|
11173
11177
|
}
|
|
11174
11178
|
this.informDependentDisplayObjects(element);
|
|
11175
|
-
var
|
|
11176
|
-
|
|
11177
|
-
|
|
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 = {
|
|
11178
11185
|
type: 'attributes',
|
|
11179
11186
|
target: element,
|
|
11180
11187
|
_boundsChangeData: {
|
|
11181
11188
|
affectChildren: affectChildren
|
|
11182
11189
|
}
|
|
11183
11190
|
};
|
|
11184
|
-
|
|
11191
|
+
mutations.push(boundChangeMutation);
|
|
11185
11192
|
} else {
|
|
11186
|
-
|
|
11187
|
-
affectChildren:
|
|
11193
|
+
boundChangeMutation._boundsChangeData = {
|
|
11194
|
+
affectChildren: boundChangeMutation._boundsChangeData.affectChildren || affectChildren
|
|
11188
11195
|
};
|
|
11189
11196
|
}
|
|
11197
|
+
element.mutations = mutations;
|
|
11190
11198
|
}
|
|
11191
11199
|
}, {
|
|
11192
11200
|
key: "dirtyFragment",
|
|
@@ -11206,16 +11214,21 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
11206
11214
|
}, {
|
|
11207
11215
|
key: "notifyMutationObservers",
|
|
11208
11216
|
value: function notifyMutationObservers(canvas) {
|
|
11209
|
-
var
|
|
11210
|
-
|
|
11217
|
+
var mutations = [];
|
|
11218
|
+
canvas.getRoot().forEach(function (item) {
|
|
11219
|
+
(item.mutations || []).forEach(function (mutation) {
|
|
11220
|
+
if (mutation.type === 'attributes' && mutation._boundsChangeData) {
|
|
11221
|
+
mutations.push(mutation);
|
|
11222
|
+
}
|
|
11223
|
+
});
|
|
11224
|
+
item.mutations = undefined;
|
|
11211
11225
|
});
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
this.mutationsMap.clear();
|
|
11226
|
+
if (mutations.length > 0) {
|
|
11227
|
+
var event = new CustomEvent(ElementEvent.BOUNDS_CHANGED, {
|
|
11228
|
+
detail: mutations
|
|
11229
|
+
});
|
|
11230
|
+
canvas.dispatchEvent(event, true, true);
|
|
11231
|
+
}
|
|
11219
11232
|
}
|
|
11220
11233
|
}, {
|
|
11221
11234
|
key: "updateDisplayObjectDependency",
|
|
@@ -12359,7 +12372,7 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
12359
12372
|
nodes[_key3] = arguments[_key3];
|
|
12360
12373
|
}
|
|
12361
12374
|
var first = nodes[0],
|
|
12362
|
-
rest = nodes.slice(1);
|
|
12375
|
+
rest = _arrayLikeToArray(nodes).slice(1);
|
|
12363
12376
|
this.parentNode.appendChild(first, index);
|
|
12364
12377
|
(_ref = first).after.apply(_ref, _toConsumableArray(rest));
|
|
12365
12378
|
}
|