@antv/g 5.15.2 → 5.15.3

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.umd.js CHANGED
@@ -8105,10 +8105,7 @@
8105
8105
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node
8106
8106
  */var Node=/*#__PURE__*/function(_EventTarget){_inheritsLoose(Node,_EventTarget);function Node(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_EventTarget.call.apply(_EventTarget,[this].concat(args))||this;_this.shadow=false;_this.ownerDocument=null;_this.isConnected=false;_this.baseURI='';_this.childNodes=[];_this.nodeType=0;_this.nodeName='';_this.nodeValue=null;_this.parentNode=null;return _this;}Node.isNode=function isNode(target){return !!target.childNodes;};var _proto=Node.prototype;/**
8107
8107
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/getRootNode
8108
- */_proto.getRootNode=function getRootNode(opts){if(opts===void 0){opts={};}if(this.parentNode){return this.parentNode.getRootNode(opts);}if(opts.composed&&this.host){return this.host.getRootNode(opts);}return this;};_proto.hasChildNodes=function hasChildNodes(){return this.childNodes.length>0;}// eslint-disable-next-line @typescript-eslint/no-unused-vars
8109
- ;_proto.isDefaultNamespace=function isDefaultNamespace(namespace){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);}// eslint-disable-next-line @typescript-eslint/no-unused-vars
8110
- ;_proto.lookupNamespaceURI=function lookupNamespaceURI(prefix){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);}// eslint-disable-next-line @typescript-eslint/no-unused-vars
8111
- ;_proto.lookupPrefix=function lookupPrefix(namespace){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.normalize=function normalize(){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);}/**
8108
+ */_proto.getRootNode=function getRootNode(opts){if(opts===void 0){opts={};}if(this.parentNode){return this.parentNode.getRootNode(opts);}if(opts.composed&&this.host){return this.host.getRootNode(opts);}return this;};_proto.hasChildNodes=function hasChildNodes(){return this.childNodes.length>0;};_proto.isDefaultNamespace=function isDefaultNamespace(namespace){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.lookupNamespaceURI=function lookupNamespaceURI(prefix){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.lookupPrefix=function lookupPrefix(namespace){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.normalize=function normalize(){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);}/**
8112
8109
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/isEqualNode
8113
8110
  */;_proto.isEqualNode=function isEqualNode(otherNode){// TODO: compare 2 nodes, not sameness
8114
8111
  return this===otherNode;};_proto.isSameNode=function isSameNode(otherNode){return this.isEqualNode(otherNode);}/**
@@ -8159,8 +8156,7 @@
8159
8156
  * @example const circle = document.createElement('circle', { style: { r: 10 } });
8160
8157
  */_proto.createElement=function createElement(tagName,options){// @observablehq/plot will create <svg>
8161
8158
  if(tagName==='svg'){return this.documentElement;}// d3 will use <tspan>
8162
- var clazz=this.defaultView.customElements.get(tagName);if(!clazz){console.warn('Unsupported tagName: ',tagName);clazz=tagName==='tspan'?Text:Group;}var shape=new clazz(options);shape.ownerDocument=this;return shape;};_proto.createElementNS=function createElementNS(namespaceURI,tagName,options){return this.createElement(tagName,options);}// eslint-disable-next-line @typescript-eslint/no-unused-vars
8163
- ;_proto.cloneNode=function cloneNode(deep){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.destroy=function destroy(){try{this.documentElement.destroy();this.timeline.destroy();}catch(e){}}/**
8159
+ var clazz=this.defaultView.customElements.get(tagName);if(!clazz){console.warn('Unsupported tagName: ',tagName);clazz=tagName==='tspan'?Text:Group;}var shape=new clazz(options);shape.ownerDocument=this;return shape;};_proto.createElementNS=function createElementNS(namespaceURI,tagName,options){return this.createElement(tagName,options);};_proto.cloneNode=function cloneNode(deep){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.destroy=function destroy(){try{this.documentElement.destroy();this.timeline.destroy();}catch(e){}}/**
8164
8160
  * Picking 2D graphics with RBush based on BBox, fast but inaccurate.
8165
8161
  */;_proto.elementsFromBBox=function elementsFromBBox(minX,minY,maxX,maxY){var rBush=this.defaultView.context.rBushRoot;var rBushNodes=rBush.search({minX:minX,minY:minY,maxX:maxX,maxY:maxY});var hitTestList=[];rBushNodes.forEach(function(_ref2){var id=_ref2.id;var displayObject=runtime.displayObjectPool.getByEntity(id);var pointerEvents=displayObject.parsedStyle.pointerEvents;// account for `visibility`
8166
8162
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
@@ -8179,13 +8175,7 @@
8179
8175
  */;_proto.elementsFromPoint=/*#__PURE__*/function(){var _elementsFromPoint=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(x,y){var _this$defaultView$can4,viewportX,viewportY,_this$defaultView$get6,width,height,_this$defaultView$vie4,clientX,clientY,_yield$this$defaultVi2,picked;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_this$defaultView$can4=this.defaultView.canvas2Viewport({x:x,y:y}),viewportX=_this$defaultView$can4.x,viewportY=_this$defaultView$can4.y;_this$defaultView$get6=this.defaultView.getConfig(),width=_this$defaultView$get6.width,height=_this$defaultView$get6.height;// outside canvas' viewport
8180
8176
  if(!(viewportX<0||viewportY<0||viewportX>width||viewportY>height)){_context2.next=4;break;}return _context2.abrupt("return",[]);case 4:_this$defaultView$vie4=this.defaultView.viewport2Client({x:viewportX,y:viewportY}),clientX=_this$defaultView$vie4.x,clientY=_this$defaultView$vie4.y;_context2.next=7;return this.defaultView.getRenderingService().hooks.pick.promise({topmost:false,position:{x:x,y:y,viewportX:viewportX,viewportY:viewportY,clientX:clientX,clientY:clientY},picked:[]});case 7:_yield$this$defaultVi2=_context2.sent;picked=_yield$this$defaultVi2.picked;if(picked[picked.length-1]!==this.documentElement){picked.push(this.documentElement);}return _context2.abrupt("return",picked);case 11:case"end":return _context2.stop();}}},_callee2,this);}));function elementsFromPoint(_x3,_x4){return _elementsFromPoint.apply(this,arguments);}return elementsFromPoint;}()/**
8181
8177
  * eg. Uncaught DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
8182
- */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
8183
- ;_proto.appendChild=function appendChild(newChild,index){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);}// eslint-disable-next-line @typescript-eslint/no-unused-vars
8184
- ;_proto.insertBefore=function insertBefore(newChild,refChild){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);}// eslint-disable-next-line @typescript-eslint/no-unused-vars
8185
- ;_proto.removeChild=function removeChild(oldChild,destroy){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);}// eslint-disable-next-line @typescript-eslint/no-unused-vars
8186
- ;_proto.replaceChild=function replaceChild(newChild,oldChild,destroy){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);}// eslint-disable-next-line @typescript-eslint/no-unused-vars
8187
- ;_proto.append=function append(){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);}// eslint-disable-next-line @typescript-eslint/no-unused-vars
8188
- ;_proto.prepend=function prepend(){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);}/**
8178
+ */;_proto.appendChild=function appendChild(newChild,index){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);};_proto.insertBefore=function insertBefore(newChild,refChild){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);};_proto.removeChild=function removeChild(oldChild,destroy){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);};_proto.replaceChild=function replaceChild(newChild,oldChild,destroy){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);};_proto.append=function append(){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);};_proto.prepend=function prepend(){throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);}/**
8189
8179
  * Execute query on documentElement.
8190
8180
  */;_proto.getElementById=function getElementById(id){return this.documentElement.getElementById(id);};_proto.getElementsByName=function getElementsByName(name){return this.documentElement.getElementsByName(name);};_proto.getElementsByTagName=function getElementsByTagName(tagName){return this.documentElement.getElementsByTagName(tagName);};_proto.getElementsByClassName=function getElementsByClassName(className){return this.documentElement.getElementsByClassName(className);};_proto.querySelector=function querySelector(selectors){return this.documentElement.querySelector(selectors);};_proto.querySelectorAll=function querySelectorAll(selectors){return this.documentElement.querySelectorAll(selectors);};_proto.find=function find(filter){return this.documentElement.find(filter);};_proto.findAll=function findAll(filter){return this.documentElement.findAll(filter);};_createClass(Document,[{key:"children",get:function get(){return this.childNodes;}},{key:"childElementCount",get:function get(){return this.childNodes.length;}},{key:"firstElementChild",get:function get(){return this.firstChild;}},{key:"lastElementChild",get:function get(){return this.lastChild;}/**
8191
8181
  * only document has defaultView, points to canvas,
@@ -8238,8 +8228,7 @@
8238
8228
  // textTransform: '',
8239
8229
  };_this.attributes={};return _this;}Element.isElement=function isElement(target){return !!target.getAttribute;}/**
8240
8230
  * Unique id.
8241
- */;var _proto=Element.prototype;// eslint-disable-next-line @typescript-eslint/no-unused-vars
8242
- _proto.cloneNode=function cloneNode(deep){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.appendChild=function appendChild(child,index){var _this$ownerDocument;if(child.destroyed){throw new Error(ERROR_MSG_APPEND_DESTROYED_ELEMENT);}runtime.sceneGraphService.attach(child,this,index);if((_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:_this$ownerDocument.defaultView){this.ownerDocument.defaultView.mountChildren(child);}insertedEvent.relatedNode=this;child.dispatchEvent(insertedEvent);return child;};_proto.insertBefore=function insertBefore(newChild,refChild){if(!refChild){this.appendChild(newChild);}else {var index=this.childNodes.indexOf(refChild);this.appendChild(newChild,index-1);}return newChild;};_proto.replaceChild=function replaceChild(newChild,oldChild){var index=this.childNodes.indexOf(oldChild);this.removeChild(oldChild);this.appendChild(newChild,index);return oldChild;};_proto.removeChild=function removeChild(child){var _child$ownerDocument;// should emit on itself before detach
8231
+ */;var _proto=Element.prototype;_proto.cloneNode=function cloneNode(deep){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.appendChild=function appendChild(child,index){var _this$ownerDocument;if(child.destroyed){throw new Error(ERROR_MSG_APPEND_DESTROYED_ELEMENT);}runtime.sceneGraphService.attach(child,this,index);if((_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:_this$ownerDocument.defaultView){this.ownerDocument.defaultView.mountChildren(child);}insertedEvent.relatedNode=this;child.dispatchEvent(insertedEvent);return child;};_proto.insertBefore=function insertBefore(newChild,refChild){if(!refChild){this.appendChild(newChild);}else {var index=this.childNodes.indexOf(refChild);this.appendChild(newChild,index-1);}return newChild;};_proto.replaceChild=function replaceChild(newChild,oldChild){var index=this.childNodes.indexOf(oldChild);this.removeChild(oldChild);this.appendChild(newChild,index);return oldChild;};_proto.removeChild=function removeChild(child){var _child$ownerDocument;// should emit on itself before detach
8243
8232
  removedEvent.relatedNode=this;child.dispatchEvent(removedEvent);if((_child$ownerDocument=child.ownerDocument)===null||_child$ownerDocument===void 0?void 0:_child$ownerDocument.defaultView){child.ownerDocument.defaultView.unmountChildren(child);}// remove from scene graph
8244
8233
  runtime.sceneGraphService.detach(child);return child;}/**
8245
8234
  * Remove all children which can be appended to its original parent later again.
@@ -8305,8 +8294,7 @@
8305
8294
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
8306
8295
  */;_proto.removeAttribute=function removeAttribute(attributeName){this.setAttribute(attributeName,null);delete this.attributes[attributeName];}/**
8307
8296
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
8308
- */;_proto.setAttribute=function setAttribute(attributeName,value,// eslint-disable-next-line @typescript-eslint/no-unused-vars
8309
- force){this.attributes[attributeName]=value;};_proto.getAttributeNS=function getAttributeNS(namespace,localName){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.getAttributeNode=function getAttributeNode(qualifiedName){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.getAttributeNodeNS=function getAttributeNodeNS(namespace,localName){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.hasAttributeNS=function hasAttributeNS(namespace,localName){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.removeAttributeNS=function removeAttributeNS(namespace,localName){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.removeAttributeNode=function removeAttributeNode(attr){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.setAttributeNS=function setAttributeNS(namespace,qualifiedName,value){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.setAttributeNode=function setAttributeNode(attr){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.setAttributeNodeNS=function setAttributeNodeNS(attr){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.toggleAttribute=function toggleAttribute(qualifiedName,force){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_createClass(Element,[{key:"className",get:/**
8297
+ */;_proto.setAttribute=function setAttribute(attributeName,value,force){this.attributes[attributeName]=value;};_proto.getAttributeNS=function getAttributeNS(namespace,localName){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.getAttributeNode=function getAttributeNode(qualifiedName){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.getAttributeNodeNS=function getAttributeNodeNS(namespace,localName){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.hasAttributeNS=function hasAttributeNS(namespace,localName){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.removeAttributeNS=function removeAttributeNS(namespace,localName){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.removeAttributeNode=function removeAttributeNode(attr){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.setAttributeNS=function setAttributeNS(namespace,qualifiedName,value){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.setAttributeNode=function setAttributeNode(attr){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.setAttributeNodeNS=function setAttributeNodeNS(attr){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.toggleAttribute=function toggleAttribute(qualifiedName,force){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_createClass(Element,[{key:"className",get:/**
8310
8298
  * used in `getElementsByClassName`
8311
8299
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
8312
8300
  */function get(){// @ts-ignore
@@ -8338,7 +8326,7 @@
8338
8326
  * which can lead to unintended consequences if an attempt is made to cache the entire event object.
8339
8327
  *
8340
8328
  * Therefore, while keeping the above performance considerations in mind, it is possible to provide a clone method that creates a new object when the user really wants to cache it, e.g.
8341
- */;_proto.clone=function clone(){return this.manager.clonePointerEvent(this);};return FederatedPointerEvent;}(FederatedMouseEvent);var FederatedWheelEvent=/*#__PURE__*/function(_FederatedMouseEvent){_inheritsLoose(FederatedWheelEvent,_FederatedMouseEvent);function FederatedWheelEvent(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_FederatedMouseEvent.call.apply(_FederatedMouseEvent,[this].concat(args))||this;_this.deltaMode=void 0;_this.deltaX=void 0;_this.deltaY=void 0;_this.deltaZ=void 0;_this.DOM_DELTA_LINE=0;_this.DOM_DELTA_PAGE=1;_this.DOM_DELTA_PIXEL=2;return _this;}var _proto=FederatedWheelEvent.prototype;_proto.clone=function clone(){return this.manager.cloneWheelEvent(this);};return FederatedWheelEvent;}(FederatedMouseEvent);var mutationEvent=new MutationEvent(exports.ElementEvent.ATTR_MODIFIED,null,null,null,null,MutationEvent.MODIFICATION,null,null);var DEFAULT_STYLE_PROPS={anchor:'',opacity:'',fillOpacity:'',strokeOpacity:'',fill:'',stroke:'',transform:'',transformOrigin:'',visibility:'',pointerEvents:'',lineWidth:'',lineCap:'',lineJoin:'',increasedLineWidthForHitTesting:'',fontSize:'',fontFamily:'',fontStyle:'',fontWeight:'',fontVariant:'',textAlign:'',textBaseline:'',textTransform:'',zIndex:'',filter:'',shadowType:''};var DEFAULT_PARSED_STYLE_PROPS={anchor:[0,0],fill:noneColor,stroke:noneColor,transform:[],zIndex:0,filter:[],shadowType:'outer'};var INHERITABLE_STYLE_PROPS=['opacity','fillOpacity','strokeOpacity','transformOrigin','visibility','pointerEvents','lineWidth','lineCap','lineJoin','increasedLineWidthForHitTesting','fontSize','fontFamily','fontStyle','fontWeight','fontVariant','textAlign','textBaseline','textTransform'];/**
8329
+ */;_proto.clone=function clone(){return this.manager.clonePointerEvent(this);};return FederatedPointerEvent;}(FederatedMouseEvent);var FederatedWheelEvent=/*#__PURE__*/function(_FederatedMouseEvent){_inheritsLoose(FederatedWheelEvent,_FederatedMouseEvent);function FederatedWheelEvent(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_FederatedMouseEvent.call.apply(_FederatedMouseEvent,[this].concat(args))||this;_this.deltaMode=void 0;_this.deltaX=void 0;_this.deltaY=void 0;_this.deltaZ=void 0;_this.DOM_DELTA_LINE=0;_this.DOM_DELTA_PAGE=1;_this.DOM_DELTA_PIXEL=2;return _this;}var _proto=FederatedWheelEvent.prototype;_proto.clone=function clone(){return this.manager.cloneWheelEvent(this);};return FederatedWheelEvent;}(FederatedMouseEvent);var mutationEvent=new MutationEvent(exports.ElementEvent.ATTR_MODIFIED,null,null,null,null,MutationEvent.MODIFICATION,null,null);var DEFAULT_STYLE_PROPS={anchor:'',opacity:'',fillOpacity:'',strokeOpacity:'',fill:'',stroke:'',transform:'',transformOrigin:'',visibility:'',pointerEvents:'',lineWidth:'',lineCap:'',lineJoin:'',increasedLineWidthForHitTesting:'',fontSize:'',fontFamily:'',fontStyle:'',fontWeight:'',fontVariant:'',textAlign:'',textBaseline:'',textTransform:'',zIndex:'',filter:'',shadowType:''};var DEFAULT_PARSED_STYLE_PROPS={anchor:[0,0],fill:noneColor,stroke:noneColor,transform:[],zIndex:0,filter:[],shadowType:'outer'};var INHERITABLE_BASE_STYLE_PROPS=['opacity','fillOpacity','strokeOpacity','transformOrigin','visibility','pointerEvents','lineWidth','lineCap','lineJoin','increasedLineWidthForHitTesting'];var INHERITABLE_STYLE_PROPS=[].concat(INHERITABLE_BASE_STYLE_PROPS,['fontSize','fontFamily','fontStyle','fontWeight','fontVariant','textAlign','textBaseline','textTransform']);/**
8342
8330
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
8343
8331
  *
8344
8332
  * mixins: Animatable, Transformable, Visible
@@ -8380,7 +8368,8 @@
8380
8368
  id:this.id,name:this.name,className:this.name,interactive:this.interactive,style:clonedStyle});// apply transform
8381
8369
  cloned.setLocalTransform(this.getLocalTransform());if(deep){this.children.forEach(function(child){// skip marker
8382
8370
  if(!child.style.isMarker){var clonedChild=child.cloneNode(deep);cloned.appendChild(clonedChild);}});}return cloned;};_proto.initAttributes=function initAttributes(attributes){if(attributes===void 0){attributes={};}var renderable=this.renderable;// account for FCP, process properties as less as possible
8383
- runtime.styleValueRegistry.processProperties(this,attributes,{forceUpdateGeometry:true,usedAttributes:INHERITABLE_STYLE_PROPS});// redraw at next frame
8371
+ runtime.styleValueRegistry.processProperties(this,attributes,{forceUpdateGeometry:true,usedAttributes:// only Group / Text should account for text relative props
8372
+ this.tagName===exports.Shape.GROUP||this.tagName===exports.Shape.TEXT?INHERITABLE_STYLE_PROPS:INHERITABLE_BASE_STYLE_PROPS});// redraw at next frame
8384
8373
  renderable.dirty=true;};_proto.setAttribute=function setAttribute(name,value,force){if(force===void 0){force=false;}var attributeName=formatAttributeName(name);// ignore undefined value
8385
8374
  if(isUndefined(value)){return;}if(force||value!==this.attributes[attributeName]){this.internalSetAttribute(attributeName,value);_Element.prototype.setAttribute.call(this,attributeName,value);}}/**
8386
8375
  * called when attributes get changed or initialized
@@ -9237,8 +9226,7 @@
9237
9226
  // should not include itself
9238
9227
  return root.findAll(function(node){return root!==node&&((node===null||node===void 0?void 0:node.classList)||[]).indexOf(_this2.getIdOrClassname(query))>-1;});}else if(query.startsWith('#')){return root.findAll(function(node){return root!==node&&node.id===_this2.getIdOrClassname(query);});}else if(query.startsWith('[')){var _this$getAttribute2=this.getAttribute(query),name=_this$getAttribute2.name,value=_this$getAttribute2.value;if(name){// getElementsByName();
9239
9228
  return root.findAll(function(node){return root!==node&&(name==='name'?node.name===value:_this2.attributeToString(node,name)===value);});}else {return [];}}else {// getElementsByTag('circle');
9240
- return root.findAll(function(node){return root!==node&&node.nodeName===query;});}}// eslint-disable-next-line @typescript-eslint/no-unused-vars
9241
- ;_proto.is=function is(query,node){// a simple `matches` implementation
9229
+ return root.findAll(function(node){return root!==node&&node.nodeName===query;});}};_proto.is=function is(query,node){// a simple `matches` implementation
9242
9230
  if(query.startsWith('.')){return node.className===this.getIdOrClassname(query);}else if(query.startsWith('#')){return node.id===this.getIdOrClassname(query);}else if(query.startsWith('[')){var _this$getAttribute3=this.getAttribute(query),name=_this$getAttribute3.name,value=_this$getAttribute3.value;return name==='name'?node.name===value:this.attributeToString(node,name)===value;}else {return node.nodeName===query;}};_proto.getIdOrClassname=function getIdOrClassname(query){return query.substring(1);};_proto.getAttribute=function getAttribute(query){var matches=query.match(ATTRIBUTE_REGEXP);var name='';var value='';if(matches&&matches.length>2){name=matches[1].replace(/"/g,'');value=matches[2].replace(/"/g,'');}return {name:name,value:value};};_proto.attributeToString=function attributeToString(node,name){if(!node.getAttribute){return '';}var value=node.getAttribute(name);if(isNil(value)){return '';}if(value.toString){return value.toString();}return '';};return DefaultSceneGraphSelector;}();function markRenderableDirty(e){var renderable=e.renderable;if(renderable){renderable.renderBoundsDirty=true;renderable.boundsDirty=true;}}/**
9243
9231
  * update transform in scene graph
9244
9232
  *
@@ -9331,8 +9319,7 @@
9331
9319
  // (toDataURI, getImageData functions)
9332
9320
  if(fontProperties.fontSize===0){fontProperties.fontSize=fontSize;fontProperties.ascent=fontSize;}var context=this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);context.font=font;// no overflowing by default
9333
9321
  parsedStyle.isOverflowing=false;var outputText=wordWrap?this.wordWrap(text,parsedStyle,offscreenCanvas):text;var lines=outputText.split(/(?:\r\n|\r|\n)/);var lineWidths=new Array(lines.length);var maxLineWidth=0;// account for textPath
9334
- if(textPath){var totalPathLength=textPath.getTotalLength();// eslint-disable-next-line @typescript-eslint/no-unused-vars
9335
- var startingPoint=textPath.getPoint(0);for(var i=0;i<lines.length;i++){var width=context.measureText(lines[i]).width+(lines[i].length-1)*letterSpacing;// for (
9322
+ if(textPath){var totalPathLength=textPath.getTotalLength();var startingPoint=textPath.getPoint(0);for(var i=0;i<lines.length;i++){var width=context.measureText(lines[i]).width+(lines[i].length-1)*letterSpacing;// for (
9336
9323
  // let i = reverse ? lines[0].length - 1 : 0;
9337
9324
  // reverse ? i >= 0 : i < lines[0].length;
9338
9325
  // reverse ? i-- : i++
@@ -9367,12 +9354,13 @@
9367
9354
  if(ellipsisWidth>0&&ellipsisWidth<=maxWidth){// Backspace from line's end.
9368
9355
  var currentLineLength=lines[currentIndex].length;var lastLineWidth=0;var lastLineIndex=currentLineLength;for(var _i2=0;_i2<currentLineLength;_i2++){var width=calcWidth(lines[currentIndex][_i2]);if(lastLineWidth+width+ellipsisWidth>maxWidth){lastLineIndex=_i2;break;}lastLineWidth+=width;}lines[currentIndex]=(lines[currentIndex]||'').slice(0,lastLineIndex)+ellipsis;}break;}currentIndex++;currentWidth=0;lines[currentIndex]='';if(this.isBreakingSpace(char)){continue;}if(!this.canBreakInLastChar(char)){lines=this.trimToBreakable(lines);currentWidth=this.sumTextWidthByCache(lines[currentIndex]||'',cache);}if(this.shouldBreakByKinsokuShorui(char,nextChar)){lines=this.trimByKinsokuShorui(lines);currentWidth+=calcWidth(prevChar||'');}}currentWidth+=charWidth;lines[currentIndex]=(lines[currentIndex]||'')+char;}return lines.join('\n');};_proto.isBreakingSpace=function isBreakingSpace(char){if(typeof char!=='string'){return false;}return TEXT_METRICS.BreakingSpaces.indexOf(char.charCodeAt(0))>=0;};_proto.isNewline=function isNewline(char){if(typeof char!=='string'){return false;}return TEXT_METRICS.Newlines.indexOf(char.charCodeAt(0))>=0;};_proto.trimToBreakable=function trimToBreakable(prev){var next=[].concat(prev);var prevLine=next[next.length-2];var index=this.findBreakableIndex(prevLine);if(index===-1||!prevLine)return next;var trimmedChar=prevLine.slice(index,index+1);var isTrimmedWithSpace=this.isBreakingSpace(trimmedChar);var trimFrom=index+1;var trimTo=index+(isTrimmedWithSpace?0:1);next[next.length-1]+=prevLine.slice(trimFrom,prevLine.length);next[next.length-2]=prevLine.slice(0,trimTo);return next;};_proto.canBreakInLastChar=function canBreakInLastChar(char){if(char&&LATIN_REGEX.test(char))return false;return true;};_proto.sumTextWidthByCache=function sumTextWidthByCache(text,cache){return text.split('').reduce(function(sum,c){if(!cache[c])throw Error('cannot count the word without cache');return sum+cache[c];},0);};_proto.findBreakableIndex=function findBreakableIndex(line){for(var i=line.length-1;i>=0;i--){if(!LATIN_REGEX.test(line[i]))return i;}return -1;};_proto.getFromCache=function getFromCache(key,letterSpacing,cache,context){var width=cache[key];if(typeof width!=='number'){var spacing=key.length*letterSpacing;width=context.measureText(key).width+spacing;cache[key]=width;}return width;};return TextService;}();var runtime={};/**
9369
9356
  * Replace with IoC container
9370
- */var geometryUpdaterFactory=function(){var _ref;var rectUpdater=new RectUpdater();var polylineUpdater=new PolylineUpdater();return _ref={},_ref[exports.Shape.CIRCLE]=new CircleUpdater(),_ref[exports.Shape.ELLIPSE]=new EllipseUpdater(),_ref[exports.Shape.RECT]=rectUpdater,_ref[exports.Shape.IMAGE]=rectUpdater,_ref[exports.Shape.GROUP]=rectUpdater,_ref[exports.Shape.LINE]=new LineUpdater(),_ref[exports.Shape.TEXT]=new TextUpdater(runtime),_ref[exports.Shape.POLYLINE]=polylineUpdater,_ref[exports.Shape.POLYGON]=polylineUpdater,_ref[exports.Shape.PATH]=new PathUpdater(),_ref[exports.Shape.HTML]=null,_ref[exports.Shape.MESH]=null,_ref;}();var CSSPropertySyntaxFactory=function(){var _ref2;var color=new CSSPropertyColor();var length=new CSSPropertyLengthOrPercentage();return _ref2={},_ref2[exports.PropertySyntax.PERCENTAGE]=null,_ref2[exports.PropertySyntax.NUMBER]=new CSSPropertyNumber(),_ref2[exports.PropertySyntax.ANGLE]=new CSSPropertyAngle(),_ref2[exports.PropertySyntax.DEFINED_PATH]=new CSSPropertyClipPath(),_ref2[exports.PropertySyntax.PAINT]=color,_ref2[exports.PropertySyntax.COLOR]=color,_ref2[exports.PropertySyntax.FILTER]=new CSSPropertyFilter(),_ref2[exports.PropertySyntax.LENGTH]=length,_ref2[exports.PropertySyntax.LENGTH_PERCENTAGE]=length,_ref2[exports.PropertySyntax.LENGTH_PERCENTAGE_12]=new CSSPropertyLengthOrPercentage12(),_ref2[exports.PropertySyntax.LENGTH_PERCENTAGE_14]=new CSSPropertyLengthOrPercentage14(),_ref2[exports.PropertySyntax.COORDINATE]=new CSSPropertyLocalPosition(),_ref2[exports.PropertySyntax.OFFSET_DISTANCE]=new CSSPropertyOffsetDistance(),_ref2[exports.PropertySyntax.OPACITY_VALUE]=new CSSPropertyOpacity(),_ref2[exports.PropertySyntax.PATH]=new CSSPropertyPath(),_ref2[exports.PropertySyntax.LIST_OF_POINTS]=new CSSPropertyPoints(),_ref2[exports.PropertySyntax.SHADOW_BLUR]=new CSSPropertyShadowBlur(),_ref2[exports.PropertySyntax.TEXT]=new CSSPropertyText(),_ref2[exports.PropertySyntax.TEXT_TRANSFORM]=new CSSPropertyTextTransform(),_ref2[exports.PropertySyntax.TRANSFORM]=new CSSPropertyTransform(),_ref2[exports.PropertySyntax.TRANSFORM_ORIGIN]=new CSSPropertyTransformOrigin(),_ref2[exports.PropertySyntax.Z_INDEX]=new CSSPropertyZIndex(),_ref2[exports.PropertySyntax.MARKER]=new CSSPropertyMarker(),_ref2;}();/**
9357
+ */var geometryUpdaterFactory=function(){var _ref;var rectUpdater=new RectUpdater();var polylineUpdater=new PolylineUpdater();return _ref={},_ref[exports.Shape.CIRCLE]=new CircleUpdater(),_ref[exports.Shape.ELLIPSE]=new EllipseUpdater(),_ref[exports.Shape.RECT]=rectUpdater,_ref[exports.Shape.IMAGE]=rectUpdater,_ref[exports.Shape.GROUP]=rectUpdater,_ref[exports.Shape.LINE]=new LineUpdater(),_ref[exports.Shape.TEXT]=new TextUpdater(runtime),_ref[exports.Shape.POLYLINE]=polylineUpdater,_ref[exports.Shape.POLYGON]=polylineUpdater,_ref[exports.Shape.PATH]=new PathUpdater(),_ref[exports.Shape.HTML]=null,_ref[exports.Shape.MESH]=null,_ref;}();var CSSPropertySyntaxFactory=function(){var _ref2;var color=new CSSPropertyColor();var length=new CSSPropertyLengthOrPercentage();return _ref2={},_ref2[exports.PropertySyntax.PERCENTAGE]=null,_ref2[exports.PropertySyntax.NUMBER]=new CSSPropertyNumber(),_ref2[exports.PropertySyntax.ANGLE]=new CSSPropertyAngle(),_ref2[exports.PropertySyntax.DEFINED_PATH]=new CSSPropertyClipPath(),_ref2[exports.PropertySyntax.PAINT]=color,_ref2[exports.PropertySyntax.COLOR]=color,_ref2[exports.PropertySyntax.FILTER]=new CSSPropertyFilter(),_ref2[exports.PropertySyntax.LENGTH]=length,_ref2[exports.PropertySyntax.LENGTH_PERCENTAGE]=length,_ref2[exports.PropertySyntax.LENGTH_PERCENTAGE_12]=new CSSPropertyLengthOrPercentage12(),_ref2[exports.PropertySyntax.LENGTH_PERCENTAGE_14]=new CSSPropertyLengthOrPercentage14(),_ref2[exports.PropertySyntax.COORDINATE]=new CSSPropertyLocalPosition(),_ref2[exports.PropertySyntax.OFFSET_DISTANCE]=new CSSPropertyOffsetDistance(),_ref2[exports.PropertySyntax.OPACITY_VALUE]=new CSSPropertyOpacity(),_ref2[exports.PropertySyntax.PATH]=new CSSPropertyPath(),_ref2[exports.PropertySyntax.LIST_OF_POINTS]=new CSSPropertyPoints(),_ref2[exports.PropertySyntax.SHADOW_BLUR]=new CSSPropertyShadowBlur(),_ref2[exports.PropertySyntax.TEXT]=new CSSPropertyText(),_ref2[exports.PropertySyntax.TEXT_TRANSFORM]=new CSSPropertyTextTransform(),_ref2[exports.PropertySyntax.TRANSFORM]=new CSSPropertyTransform(),_ref2[exports.PropertySyntax.TRANSFORM_ORIGIN]=new CSSPropertyTransformOrigin(),_ref2[exports.PropertySyntax.Z_INDEX]=new CSSPropertyZIndex(),_ref2[exports.PropertySyntax.MARKER]=new CSSPropertyMarker(),_ref2;}();var getGlobalThis=function getGlobalThis(){if(typeof globalThis!=='undefined')return globalThis;if(typeof self!=='undefined')return self;if(typeof window!=='undefined')return window;// @ts-ignore
9358
+ if(typeof global!=='undefined')return global;throw new Error('Unable to locate global `this`');};/**
9371
9359
  * Camera
9372
9360
  * `g-camera-api` will provide an advanced implementation
9373
9361
  */runtime.CameraContribution=Camera;/**
9374
9362
  * `g-web-animations-api` will provide an AnimationTimeline
9375
- */runtime.AnimationTimeline=null;runtime.EasingFunction=null;runtime.offscreenCanvas=new OffscreenCanvasCreator();runtime.displayObjectPool=new DisplayObjectPool();runtime.sceneGraphSelector=new DefaultSceneGraphSelector();runtime.sceneGraphService=new DefaultSceneGraphService(runtime);runtime.textService=new TextService(runtime);runtime.geometryUpdaterFactory=geometryUpdaterFactory;runtime.CSSPropertySyntaxFactory=CSSPropertySyntaxFactory;runtime.styleValueRegistry=new DefaultStyleValueRegistry();runtime.layoutRegistry=null;var AbstractRendererPlugin=/*#__PURE__*/function(){function AbstractRendererPlugin(){this.context=void 0;this.plugins=[];}var _proto=AbstractRendererPlugin.prototype;_proto.addRenderingPlugin=function addRenderingPlugin(plugin){this.plugins.push(plugin);this.context.renderingPlugins.push(plugin);};_proto.removeAllRenderingPlugins=function removeAllRenderingPlugins(){var _this=this;this.plugins.forEach(function(plugin){var index=_this.context.renderingPlugins.indexOf(plugin);if(index>=0){_this.context.renderingPlugins.splice(index,1);}});};return AbstractRendererPlugin;}();var AbstractRenderer=/*#__PURE__*/function(){function AbstractRenderer(config){this.plugins=[];this.config=void 0;this.config=_extends({/**
9363
+ */runtime.AnimationTimeline=null;runtime.EasingFunction=null;runtime.offscreenCanvas=new OffscreenCanvasCreator();runtime.displayObjectPool=new DisplayObjectPool();runtime.sceneGraphSelector=new DefaultSceneGraphSelector();runtime.sceneGraphService=new DefaultSceneGraphService(runtime);runtime.textService=new TextService(runtime);runtime.geometryUpdaterFactory=geometryUpdaterFactory;runtime.CSSPropertySyntaxFactory=CSSPropertySyntaxFactory;runtime.styleValueRegistry=new DefaultStyleValueRegistry();runtime.layoutRegistry=null;runtime.globalThis=getGlobalThis();var AbstractRendererPlugin=/*#__PURE__*/function(){function AbstractRendererPlugin(){this.context=void 0;this.plugins=[];}var _proto=AbstractRendererPlugin.prototype;_proto.addRenderingPlugin=function addRenderingPlugin(plugin){this.plugins.push(plugin);this.context.renderingPlugins.push(plugin);};_proto.removeAllRenderingPlugins=function removeAllRenderingPlugins(){var _this=this;this.plugins.forEach(function(plugin){var index=_this.context.renderingPlugins.indexOf(plugin);if(index>=0){_this.context.renderingPlugins.splice(index,1);}});};return AbstractRendererPlugin;}();var AbstractRenderer=/*#__PURE__*/function(){function AbstractRenderer(config){this.plugins=[];this.config=void 0;this.config=_extends({/**
9376
9364
  * only dirty object will cause re-render
9377
9365
  */enableDirtyCheck:true,enableCulling:false,/**
9378
9366
  * enable auto rendering by default
@@ -9498,11 +9486,11 @@
9498
9486
  if(canvas){// infer width & height with dpr
9499
9487
  dpr=devicePixelRatio||isBrowser&&window.devicePixelRatio||1;dpr=dpr>=1?Math.ceil(dpr):1;canvasWidth=width||getWidth(canvas)||canvas.width/dpr;canvasHeight=height||getHeight(canvas)||canvas.height/dpr;}/**
9500
9488
  * implements `Window` interface
9501
- */_this.devicePixelRatio=dpr;_this.requestAnimationFrame=requestAnimationFrame!==null&&requestAnimationFrame!==void 0?requestAnimationFrame:raf.bind(globalThis);_this.cancelAnimationFrame=cancelAnimationFrame!==null&&cancelAnimationFrame!==void 0?cancelAnimationFrame:caf.bind(globalThis);/**
9489
+ */_this.devicePixelRatio=dpr;_this.requestAnimationFrame=requestAnimationFrame!==null&&requestAnimationFrame!==void 0?requestAnimationFrame:raf.bind(runtime.globalThis);_this.cancelAnimationFrame=cancelAnimationFrame!==null&&cancelAnimationFrame!==void 0?cancelAnimationFrame:caf.bind(runtime.globalThis);/**
9502
9490
  * limits query
9503
9491
  */ // the following feature-detect from hammer.js
9504
9492
  // @see https://github.com/hammerjs/hammer.js/blob/master/src/inputjs/input-consts.js#L5
9505
- _this.supportsTouchEvents=supportsTouchEvents!==null&&supportsTouchEvents!==void 0?supportsTouchEvents:'ontouchstart'in globalThis;_this.supportsPointerEvents=supportsPointerEvents!==null&&supportsPointerEvents!==void 0?supportsPointerEvents:!!globalThis.PointerEvent;_this.isTouchEvent=isTouchEvent!==null&&isTouchEvent!==void 0?isTouchEvent:function(event){return _this.supportsTouchEvents&&event instanceof globalThis.TouchEvent;};_this.isMouseEvent=isMouseEvent!==null&&isMouseEvent!==void 0?isMouseEvent:function(event){return !globalThis.MouseEvent||event instanceof globalThis.MouseEvent&&(!_this.supportsPointerEvents||!(event instanceof globalThis.PointerEvent));};_this.initRenderingContext({container:container,canvas:canvas,width:canvasWidth,height:canvasHeight,renderer:renderer,offscreenCanvas:offscreenCanvas,devicePixelRatio:dpr,cursor:cursor||'default',background:background||'transparent',createImage:createImage,document:document,supportsCSSTransform:supportsCSSTransform});_this.initDefaultCamera(canvasWidth,canvasHeight);_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _this.initRenderer(renderer);case 2:_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.READY));if(_this.readyPromise){_this.resolveReadyPromise();}case 4:case"end":return _context.stop();}}},_callee);}))();return _this;}var _proto=Canvas.prototype;_proto.initRenderingContext=function initRenderingContext(mergedConfig){this.context.config=mergedConfig;// bind rendering context, shared by all renderers
9493
+ _this.supportsTouchEvents=supportsTouchEvents!==null&&supportsTouchEvents!==void 0?supportsTouchEvents:'ontouchstart'in runtime.globalThis;_this.supportsPointerEvents=supportsPointerEvents!==null&&supportsPointerEvents!==void 0?supportsPointerEvents:!!runtime.globalThis.PointerEvent;_this.isTouchEvent=isTouchEvent!==null&&isTouchEvent!==void 0?isTouchEvent:function(event){return _this.supportsTouchEvents&&event instanceof runtime.globalThis.TouchEvent;};_this.isMouseEvent=isMouseEvent!==null&&isMouseEvent!==void 0?isMouseEvent:function(event){return !runtime.globalThis.MouseEvent||event instanceof runtime.globalThis.MouseEvent&&(!_this.supportsPointerEvents||!(event instanceof runtime.globalThis.PointerEvent));};_this.initRenderingContext({container:container,canvas:canvas,width:canvasWidth,height:canvasHeight,renderer:renderer,offscreenCanvas:offscreenCanvas,devicePixelRatio:dpr,cursor:cursor||'default',background:background||'transparent',createImage:createImage,document:document,supportsCSSTransform:supportsCSSTransform});_this.initDefaultCamera(canvasWidth,canvasHeight);_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _this.initRenderer(renderer);case 2:_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.READY));if(_this.readyPromise){_this.resolveReadyPromise();}case 4:case"end":return _context.stop();}}},_callee);}))();return _this;}var _proto=Canvas.prototype;_proto.initRenderingContext=function initRenderingContext(mergedConfig){this.context.config=mergedConfig;// bind rendering context, shared by all renderers
9506
9494
  this.context.renderingContext={/**
9507
9495
  * the root node in scene graph
9508
9496
  */root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set(),force:false,dirty:false};};_proto.initDefaultCamera=function initDefaultCamera(width,height){var _this2=this;// set a default ortho camera
@@ -11387,8 +11375,8 @@
11387
11375
  if (!isScheduled) {
11388
11376
  isScheduled = true;
11389
11377
  // setImmediate(dispatchCallbacks);
11390
- if (typeof globalThis !== 'undefined') {
11391
- globalThis.setTimeout(dispatchCallbacks);
11378
+ if (typeof runtime.globalThis !== 'undefined') {
11379
+ runtime.globalThis.setTimeout(dispatchCallbacks);
11392
11380
  } else {
11393
11381
  dispatchCallbacks();
11394
11382
  }
@@ -11680,22 +11668,13 @@
11680
11668
  };
11681
11669
  _proto.persist = function persist() {
11682
11670
  throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
11683
- }
11684
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
11685
- ;
11686
-
11671
+ };
11687
11672
  _proto.addEventListener = function addEventListener(type, listener, options) {
11688
11673
  throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
11689
- }
11690
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
11691
- ;
11692
-
11674
+ };
11693
11675
  _proto.removeEventListener = function removeEventListener(type, listener, options) {
11694
11676
  throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
11695
- }
11696
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
11697
- ;
11698
-
11677
+ };
11699
11678
  _proto.dispatchEvent = function dispatchEvent(event) {
11700
11679
  throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
11701
11680
  };