@antv/g-lite 1.0.29 → 1.0.31
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/AbstractRenderer.d.ts +5 -4
- package/dist/AbstractRenderer.d.ts.map +1 -1
- package/dist/Canvas.d.ts +1 -0
- package/dist/Canvas.d.ts.map +1 -1
- package/dist/dom/Element.d.ts.map +1 -1
- package/dist/dom/Node.d.ts +1 -1
- package/dist/dom/Node.d.ts.map +1 -1
- package/dist/dom/interfaces.d.ts +1 -1
- package/dist/dom/interfaces.d.ts.map +1 -1
- package/dist/index.esm.js +45 -22
- package/dist/index.js +45 -22
- package/dist/index.umd.js +45 -22
- package/dist/index.umd.min.js +1 -1
- package/dist/services/RenderingService.d.ts +2 -2
- package/dist/services/RenderingService.d.ts.map +1 -1
- package/dist/services/SceneGraphService.d.ts +1 -0
- package/dist/services/SceneGraphService.d.ts.map +1 -1
- package/dist/services/interfaces.d.ts +1 -0
- package/dist/services/interfaces.d.ts.map +1 -1
- package/dist/utils/assert.d.ts +1 -0
- package/dist/utils/assert.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -5904,6 +5904,10 @@
|
|
|
5904
5904
|
function isFunction(func) {
|
|
5905
5905
|
return typeof func === 'function';
|
|
5906
5906
|
}
|
|
5907
|
+
function isSymbol(value) {
|
|
5908
|
+
// @see https://github.com/lodash/lodash/blob/master/isSymbol.js
|
|
5909
|
+
return typeof value === 'symbol';
|
|
5910
|
+
}
|
|
5907
5911
|
var definedProps = function definedProps(obj) {
|
|
5908
5912
|
return Object.fromEntries(Object.entries(obj).filter(function (_ref) {
|
|
5909
5913
|
var v = _ref[1];
|
|
@@ -12472,9 +12476,12 @@
|
|
|
12472
12476
|
}
|
|
12473
12477
|
return temp;
|
|
12474
12478
|
};
|
|
12475
|
-
_proto.forEach = function forEach(callback) {
|
|
12479
|
+
_proto.forEach = function forEach(callback, assigned) {
|
|
12480
|
+
if (assigned === void 0) {
|
|
12481
|
+
assigned = false;
|
|
12482
|
+
}
|
|
12476
12483
|
if (!callback(this)) {
|
|
12477
|
-
this.childNodes.forEach(function (child) {
|
|
12484
|
+
(assigned ? this.childNodes.slice() : this.childNodes).forEach(function (child) {
|
|
12478
12485
|
child.forEach(callback);
|
|
12479
12486
|
});
|
|
12480
12487
|
}
|
|
@@ -12627,10 +12634,10 @@
|
|
|
12627
12634
|
};
|
|
12628
12635
|
_proto.destroy = function destroy() {
|
|
12629
12636
|
try {
|
|
12630
|
-
|
|
12637
|
+
this.documentElement.childNodes.slice().forEach(function (child) {
|
|
12631
12638
|
child.forEach(function (object) {
|
|
12632
12639
|
object.destroy();
|
|
12633
|
-
});
|
|
12640
|
+
}, true);
|
|
12634
12641
|
});
|
|
12635
12642
|
this.timeline.destroy();
|
|
12636
12643
|
} catch (e) {}
|
|
@@ -13411,6 +13418,10 @@
|
|
|
13411
13418
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
|
|
13412
13419
|
*/;
|
|
13413
13420
|
_proto.getAttribute = function getAttribute(name) {
|
|
13421
|
+
// @see https://github.com/antvis/G/issues/1267
|
|
13422
|
+
if (isSymbol(name)) {
|
|
13423
|
+
return null;
|
|
13424
|
+
}
|
|
13414
13425
|
var value = this.attributes[name];
|
|
13415
13426
|
if (value === undefined) {
|
|
13416
13427
|
var attributeName = formatAttributeName(name);
|
|
@@ -20827,7 +20838,7 @@
|
|
|
20827
20838
|
case 0:
|
|
20828
20839
|
context = _extends({}, this.globalRuntime, this.context); // register rendering plugins
|
|
20829
20840
|
this.context.renderingPlugins.forEach(function (plugin) {
|
|
20830
|
-
plugin.apply(context);
|
|
20841
|
+
plugin.apply(context, runtime);
|
|
20831
20842
|
});
|
|
20832
20843
|
// await this.hooks.init.callPromise();
|
|
20833
20844
|
_context.next = 4;
|
|
@@ -20860,7 +20871,7 @@
|
|
|
20860
20871
|
enableDirtyRectangleRendering = _renderer$getConfig.enableDirtyRectangleRendering;
|
|
20861
20872
|
return !enableDirtyRectangleRendering || this.context.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED);
|
|
20862
20873
|
};
|
|
20863
|
-
_proto.render = function render(canvasConfig) {
|
|
20874
|
+
_proto.render = function render(canvasConfig, rerenderCallback) {
|
|
20864
20875
|
var _this = this;
|
|
20865
20876
|
this.stats.total = 0;
|
|
20866
20877
|
this.stats.rendered = 0;
|
|
@@ -20879,6 +20890,7 @@
|
|
|
20879
20890
|
this.hooks.endFrame.call();
|
|
20880
20891
|
renderingContext.renderListCurrentFrame = [];
|
|
20881
20892
|
renderingContext.renderReasons.clear();
|
|
20893
|
+
rerenderCallback();
|
|
20882
20894
|
}
|
|
20883
20895
|
// console.log('stats', this.stats);
|
|
20884
20896
|
};
|
|
@@ -20927,6 +20939,7 @@
|
|
|
20927
20939
|
_proto.destroy = function destroy() {
|
|
20928
20940
|
this.inited = false;
|
|
20929
20941
|
this.hooks.destroy.call();
|
|
20942
|
+
this.globalRuntime.sceneGraphService.clearPendingEvents();
|
|
20930
20943
|
};
|
|
20931
20944
|
_proto.dirtify = function dirtify() {
|
|
20932
20945
|
// need re-render
|
|
@@ -21478,9 +21491,12 @@
|
|
|
21478
21491
|
trigger(element, detail);
|
|
21479
21492
|
}
|
|
21480
21493
|
});
|
|
21481
|
-
this.
|
|
21494
|
+
this.clearPendingEvents();
|
|
21482
21495
|
set.clear();
|
|
21483
21496
|
};
|
|
21497
|
+
_proto.clearPendingEvents = function clearPendingEvents() {
|
|
21498
|
+
this.pendingEvents = [];
|
|
21499
|
+
};
|
|
21484
21500
|
_proto.dirtifyToRoot = function dirtifyToRoot(element, affectChildren) {
|
|
21485
21501
|
if (affectChildren === void 0) {
|
|
21486
21502
|
affectChildren = false;
|
|
@@ -22861,6 +22877,7 @@
|
|
|
22861
22877
|
(function (CanvasEvent) {
|
|
22862
22878
|
CanvasEvent["READY"] = "ready";
|
|
22863
22879
|
CanvasEvent["BEFORE_RENDER"] = "beforerender";
|
|
22880
|
+
CanvasEvent["RERENDER"] = "rerender";
|
|
22864
22881
|
CanvasEvent["AFTER_RENDER"] = "afterrender";
|
|
22865
22882
|
CanvasEvent["BEFORE_DESTROY"] = "beforedestroy";
|
|
22866
22883
|
CanvasEvent["AFTER_DESTROY"] = "afterdestroy";
|
|
@@ -22876,6 +22893,7 @@
|
|
|
22876
22893
|
var mountedEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
|
|
22877
22894
|
var unmountedEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
|
|
22878
22895
|
var beforeRenderEvent = new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);
|
|
22896
|
+
var rerenderEvent = new CustomEvent(exports.CanvasEvent.RERENDER);
|
|
22879
22897
|
var afterRenderEvent = new CustomEvent(exports.CanvasEvent.AFTER_RENDER);
|
|
22880
22898
|
/**
|
|
22881
22899
|
* can be treated like Window in DOM
|
|
@@ -23201,16 +23219,21 @@
|
|
|
23201
23219
|
this.document.documentElement.destroyChildren();
|
|
23202
23220
|
};
|
|
23203
23221
|
_proto.render = function render() {
|
|
23222
|
+
var _this3 = this;
|
|
23204
23223
|
this.dispatchEvent(beforeRenderEvent);
|
|
23205
23224
|
var renderingService = this.getRenderingService();
|
|
23206
|
-
renderingService.render(this.getConfig())
|
|
23225
|
+
renderingService.render(this.getConfig(), function () {
|
|
23226
|
+
// trigger actual rerender event
|
|
23227
|
+
// @see https://github.com/antvis/G/issues/1268
|
|
23228
|
+
_this3.dispatchEvent(rerenderEvent);
|
|
23229
|
+
});
|
|
23207
23230
|
this.dispatchEvent(afterRenderEvent);
|
|
23208
23231
|
};
|
|
23209
23232
|
_proto.run = function run() {
|
|
23210
|
-
var
|
|
23233
|
+
var _this4 = this;
|
|
23211
23234
|
var tick = function tick() {
|
|
23212
|
-
|
|
23213
|
-
|
|
23235
|
+
_this4.render();
|
|
23236
|
+
_this4.frameId = requestAnimationFrame(tick);
|
|
23214
23237
|
};
|
|
23215
23238
|
tick();
|
|
23216
23239
|
};
|
|
@@ -23276,12 +23299,12 @@
|
|
|
23276
23299
|
return initRenderer;
|
|
23277
23300
|
}();
|
|
23278
23301
|
_proto.loadRendererContainerModule = function loadRendererContainerModule(renderer) {
|
|
23279
|
-
var
|
|
23302
|
+
var _this5 = this;
|
|
23280
23303
|
// load other container modules provided by g-canvas/g-svg/g-webgl
|
|
23281
23304
|
var plugins = renderer.getPlugins();
|
|
23282
23305
|
plugins.forEach(function (plugin) {
|
|
23283
|
-
plugin.context =
|
|
23284
|
-
plugin.init();
|
|
23306
|
+
plugin.context = _this5.context;
|
|
23307
|
+
plugin.init(runtime);
|
|
23285
23308
|
});
|
|
23286
23309
|
};
|
|
23287
23310
|
_proto.setRenderer = /*#__PURE__*/function () {
|
|
@@ -23305,7 +23328,7 @@
|
|
|
23305
23328
|
this.destroy(false, true);
|
|
23306
23329
|
// destroy all plugins, reverse will mutate origin array
|
|
23307
23330
|
[].concat(oldRenderer === null || oldRenderer === void 0 ? void 0 : oldRenderer.getPlugins()).reverse().forEach(function (plugin) {
|
|
23308
|
-
plugin.destroy();
|
|
23331
|
+
plugin.destroy(runtime);
|
|
23309
23332
|
});
|
|
23310
23333
|
_context3.next = 9;
|
|
23311
23334
|
return this.initRenderer(renderer);
|
|
@@ -23327,10 +23350,10 @@
|
|
|
23327
23350
|
this.getContextService().applyCursorStyle(cursor);
|
|
23328
23351
|
};
|
|
23329
23352
|
_proto.unmountChildren = function unmountChildren(parent) {
|
|
23330
|
-
var
|
|
23353
|
+
var _this6 = this;
|
|
23331
23354
|
// unmountChildren recursively
|
|
23332
23355
|
parent.childNodes.forEach(function (child) {
|
|
23333
|
-
|
|
23356
|
+
_this6.unmountChildren(child);
|
|
23334
23357
|
});
|
|
23335
23358
|
if (this.inited) {
|
|
23336
23359
|
if (parent.isMutationObserved) {
|
|
@@ -23353,7 +23376,7 @@
|
|
|
23353
23376
|
}
|
|
23354
23377
|
};
|
|
23355
23378
|
_proto.mountChildren = function mountChildren(parent) {
|
|
23356
|
-
var
|
|
23379
|
+
var _this7 = this;
|
|
23357
23380
|
if (this.inited) {
|
|
23358
23381
|
if (!parent.isConnected) {
|
|
23359
23382
|
parent.ownerDocument = this.document;
|
|
@@ -23370,7 +23393,7 @@
|
|
|
23370
23393
|
}
|
|
23371
23394
|
// recursively mount children
|
|
23372
23395
|
parent.childNodes.forEach(function (child) {
|
|
23373
|
-
|
|
23396
|
+
_this7.mountChildren(child);
|
|
23374
23397
|
});
|
|
23375
23398
|
// trigger after mounted
|
|
23376
23399
|
if (parent.isCustomElement) {
|
|
@@ -23414,11 +23437,11 @@
|
|
|
23414
23437
|
_createClass(Canvas, [{
|
|
23415
23438
|
key: "ready",
|
|
23416
23439
|
get: function get() {
|
|
23417
|
-
var
|
|
23440
|
+
var _this8 = this;
|
|
23418
23441
|
if (!this.readyPromise) {
|
|
23419
23442
|
this.readyPromise = new Promise(function (resolve) {
|
|
23420
|
-
|
|
23421
|
-
resolve(
|
|
23443
|
+
_this8.resolveReadyPromise = function () {
|
|
23444
|
+
resolve(_this8);
|
|
23422
23445
|
};
|
|
23423
23446
|
});
|
|
23424
23447
|
if (this.inited) {
|