@antv/g 5.16.14 → 5.16.16

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
@@ -5810,6 +5810,7 @@
5810
5810
  function piMod(angle) {
5811
5811
  return (angle + Math.PI * 2) % (Math.PI * 2);
5812
5812
  }
5813
+
5813
5814
  var line = {
5814
5815
  /**
5815
5816
  * 计算线段的包围盒
@@ -5904,6 +5905,7 @@
5904
5905
  return Math.atan2(y2 - y1, x2 - x1);
5905
5906
  }
5906
5907
  };
5908
+
5907
5909
  var EPSILON$1 = 0.0001;
5908
5910
  /**
5909
5911
  * 使用牛顿切割法求最近的点
@@ -6073,6 +6075,7 @@
6073
6075
  return piMod(angle);
6074
6076
  }
6075
6077
  };
6078
+
6076
6079
  function cubicAt(p0, p1, p2, p3, t) {
6077
6080
  var onet = 1 - t; // t * t * t 的性能大概是 Math.pow(t, 3) 的三倍
6078
6081
  return onet * onet * onet * p0 + 3 * p1 * t * onet * onet + 3 * p2 * t * t * onet + p3 * t * t * t;
@@ -6504,6 +6507,7 @@
6504
6507
  return piMod(Math.atan2(dy, dx));
6505
6508
  }
6506
6509
  };
6510
+
6507
6511
  function analyzePoints(points) {
6508
6512
  // 计算每段的长度和总的长度
6509
6513
  var totalLength = 0;
@@ -6616,6 +6620,7 @@
6616
6620
  }
6617
6621
  return minDistance;
6618
6622
  }
6623
+
6619
6624
  var polyline = {
6620
6625
  /**
6621
6626
  * 计算多折线的包围盒
@@ -7692,92 +7697,9 @@
7692
7697
  if(useStartOffset){return "M "+(params[1]-defX+startOffsetX)+","+(params[2]-defY+startOffsetY)+" L "+(params[1]-defX)+","+(params[2]-defY);}else {return "M "+(params[1]-defX)+","+(params[2]-defY);}case'L':return "L "+(params[1]-defX+(useEndOffset?endOffsetX:0))+","+(params[2]-defY+(useEndOffset?endOffsetY:0));case'Q':return "Q "+(params[1]-defX)+" "+(params[2]-defY)+","+(params[3]-defX)+" "+(params[4]-defY)+(useEndOffset?" L "+(params[3]-defX+endOffsetX)+","+(params[4]-defY+endOffsetY):'');case'C':return "C "+(params[1]-defX)+" "+(params[2]-defY)+","+(params[3]-defX)+" "+(params[4]-defY)+","+(params[5]-defX)+" "+(params[6]-defY)+(useEndOffset?" L "+(params[5]-defX+endOffsetX)+","+(params[6]-defY+endOffsetY):'');case'A':return "A "+params[1]+" "+params[2]+" "+params[3]+" "+params[4]+" "+params[5]+" "+(params[6]-defX)+" "+(params[7]-defY)+(useEndOffset?" L "+(params[6]-defX+endOffsetX)+","+(params[7]-defY+endOffsetY):'');case'Z':return 'Z';}}).join(' ');if(~newValue.indexOf('NaN')){return '';}return newValue;}function isFillOrStrokeAffected(pointerEvents,fill,stroke){// account for pointerEvents
7693
7698
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
7694
7699
  var hasFill=false;var hasStroke=false;var isFillOtherThanNone=!!fill&&!fill.isNone;var isStrokeOtherThanNone=!!stroke&&!stroke.isNone;if(pointerEvents==='visiblepainted'||pointerEvents==='painted'||pointerEvents==='auto'){hasFill=isFillOtherThanNone;hasStroke=isStrokeOtherThanNone;}else if(pointerEvents==='visiblefill'||pointerEvents==='fill'){hasFill=true;}else if(pointerEvents==='visiblestroke'||pointerEvents==='stroke'){hasStroke=true;}else if(pointerEvents==='visible'||pointerEvents==='all'){// The values of the fill and stroke do not affect event processing.
7695
- hasFill=true;hasStroke=true;}return [hasFill,hasStroke];}// @ts-nocheck
7696
- // interface HookInterceptor<T, R, AdditionalOptions = UnsetAdditionalOptions> {
7697
- // name?: string;
7698
- // tap?: (tap: FullTap & IfSet<AdditionalOptions>) => void;
7699
- // call?: (...args: any[]) => void;
7700
- // loop?: (...args: any[]) => void;
7701
- // error?: (err: Error) => void;
7702
- // result?: (result: R) => void;
7703
- // done?: () => void;
7704
- // register?: (tap: FullTap & IfSet<AdditionalOptions>) => FullTap & IfSet<AdditionalOptions>;
7705
- // }
7706
- // type ArgumentNames<T extends any[]> = FixedSizeArray<T['length'], string>;
7707
- // export declare class AsyncHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends Hook<
7708
- // T,
7709
- // R,
7710
- // AdditionalOptions
7711
- // > {
7712
- // tapAsync(
7713
- // options: string | (Tap & IfSet<AdditionalOptions>),
7714
- // fn: (...args: Append<AsArray<T>, InnerCallback<Error, R>>) => void,
7715
- // ): void;
7716
- // tapPromise(
7717
- // options: string | (Tap & IfSet<AdditionalOptions>),
7718
- // fn: (...args: AsArray<T>) => Promise<R>,
7719
- // ): void;
7720
- // }
7721
- var CALL_DELEGATE=function CALL_DELEGATE(){this.call=this._createCall('sync');return this.call.apply(this,arguments);};var CALL_ASYNC_DELEGATE=function CALL_ASYNC_DELEGATE(){this.callAsync=this._createCall('async');return this.callAsync.apply(this,arguments);};var PROMISE_DELEGATE=function PROMISE_DELEGATE(){this.promise=this._createCall('promise');return this.promise.apply(this,arguments);};var Hook=/*#__PURE__*/function(){function Hook(args,name){if(args===void 0){args=[];}if(name===void 0){name=undefined;}this.name=void 0;this.taps=void 0;this.promise=void 0;this._promise=void 0;this._args=args;this.name=name;this.taps=[];this.interceptors=[];this._call=CALL_DELEGATE;this.call=CALL_DELEGATE;this._callAsync=CALL_ASYNC_DELEGATE;this.callAsync=CALL_ASYNC_DELEGATE;this._promise=PROMISE_DELEGATE;this.promise=PROMISE_DELEGATE;this._x=undefined;// this.compile = this.compile;
7722
- // this.tap = this.tap;
7723
- // this.tapAsync = this.tapAsync;
7724
- // this.tapPromise = this.tapPromise;
7725
- }var _proto=Hook.prototype;_proto.compile=function compile(options){throw new Error('Abstract: should be overridden');};_proto._createCall=function _createCall(type){return this.compile({taps:this.taps,interceptors:this.interceptors,args:this._args,type:type});};_proto._tap=function _tap(type,options,fn){if(typeof options==='string'){options={name:options.trim()};}else if(typeof options!=='object'||options===null){throw new Error('Invalid tap options');}if(typeof options.name!=='string'||options.name===''){throw new Error('Missing name for tap');}// if (typeof options.context !== "undefined") {
7726
- // deprecateContext();
7727
- // }
7728
- options=Object.assign({type:type,fn:fn},options);options=this._runRegisterInterceptors(options);this._insert(options);};_proto.tap=function tap(options,fn){this._tap('sync',options,fn);};_proto.tapAsync=function tapAsync(options,fn){this._tap('async',options,fn);};_proto.tapPromise=function tapPromise(options,fn){this._tap('promise',options,fn);};_proto._runRegisterInterceptors=function _runRegisterInterceptors(options){for(var _iterator=_createForOfIteratorHelperLoose(this.interceptors),_step;!(_step=_iterator()).done;){var interceptor=_step.value;if(interceptor.register){var newOptions=interceptor.register(options);if(newOptions!==undefined){options=newOptions;}}}return options;};_proto.withOptions=function withOptions(options){var _this=this;var mergeOptions=function mergeOptions(opt){return Object.assign({},options,typeof opt==='string'?{name:opt}:opt);};return {name:this.name,tap:function tap(opt,fn){return _this.tap(mergeOptions(opt),fn);},tapAsync:function tapAsync(opt,fn){return _this.tapAsync(mergeOptions(opt),fn);},tapPromise:function tapPromise(opt,fn){return _this.tapPromise(mergeOptions(opt),fn);},// intercept: (interceptor) => this.intercept(interceptor),
7729
- isUsed:function isUsed(){return _this.isUsed();},withOptions:function withOptions(opt){return _this.withOptions(mergeOptions(opt));}};};_proto.isUsed=function isUsed(){return this.taps.length>0||this.interceptors.length>0;}// intercept(interceptor: HookInterceptor<T, R, AdditionalOptions>) {
7730
- // this._resetCompilation();
7731
- // this.interceptors.push(Object.assign({}, interceptor));
7732
- // if (interceptor.register) {
7733
- // for (let i = 0; i < this.taps.length; i++) {
7734
- // this.taps[i] = interceptor.register(this.taps[i]);
7735
- // }
7736
- // }
7737
- // }
7738
- ;_proto._resetCompilation=function _resetCompilation(){this.call=this._call;this.callAsync=this._callAsync;this.promise=this._promise;};_proto._insert=function _insert(item){this._resetCompilation();var before;if(typeof item.before==='string'){before=new Set([item.before]);}else if(Array.isArray(item.before)){before=new Set(item.before);}var stage=0;if(typeof item.stage==='number'){stage=item.stage;}var i=this.taps.length;while(i>0){i--;var x=this.taps[i];this.taps[i+1]=x;var xStage=x.stage||0;if(before){if(before.has(x.name)){before.delete(x.name);continue;}if(before.size>0){continue;}}if(xStage>stage){continue;}i++;break;}this.taps[i]=item;};return Hook;}();// Object.setPrototypeOf(Hook.prototype, null);
7739
- // @ts-nocheck
7740
- var HookCodeFactory=/*#__PURE__*/function(){function HookCodeFactory(config){this.config=config;this.options=undefined;this._args=undefined;}var _proto=HookCodeFactory.prototype;_proto.create=function create(options){this.init(options);var fn;switch(this.options.type){case'sync':fn=new Function(this.args(),'"use strict";\n'+this.header()+this.contentWithInterceptors({onError:function onError(err){return "throw "+err+";\n";},onResult:function onResult(result){return "return "+result+";\n";},resultReturns:true,onDone:function onDone(){return '';},rethrowIfPossible:true}));break;case'async':fn=new Function(this.args({after:'_callback'}),'"use strict";\n'+this.header()+this.contentWithInterceptors({onError:function onError(err){return "_callback("+err+");\n";},onResult:function onResult(result){return "_callback(null, "+result+");\n";},onDone:function onDone(){return '_callback();\n';}}));break;case'promise':var errorHelperUsed=false;var content=this.contentWithInterceptors({onError:function onError(err){errorHelperUsed=true;return "_error("+err+");\n";},onResult:function onResult(result){return "_resolve("+result+");\n";},onDone:function onDone(){return '_resolve();\n';}});var code='';code+='"use strict";\n';code+=this.header();code+='return new Promise((function(_resolve, _reject) {\n';if(errorHelperUsed){code+='var _sync = true;\n';code+='function _error(_err) {\n';code+='if(_sync)\n';code+='_resolve(Promise.resolve().then((function() { throw _err; })));\n';code+='else\n';code+='_reject(_err);\n';code+='};\n';}code+=content;if(errorHelperUsed){code+='_sync = false;\n';}code+='}));\n';fn=new Function(this.args(),code);break;}this.deinit();return fn;};_proto.setup=function setup(instance,options){instance._x=options.taps.map(function(t){return t.fn;});}/**
7741
- * @param {{ type: "sync" | "promise" | "async", taps: Array<Tap>, interceptors: Array<Interceptor> }} options
7742
- */;_proto.init=function init(options){this.options=options;this._args=options.args.slice();};_proto.deinit=function deinit(){this.options=undefined;this._args=undefined;};_proto.contentWithInterceptors=function contentWithInterceptors(options){var _this=this;if(this.options.interceptors.length>0){var onError=options.onError;var onResult=options.onResult;var onDone=options.onDone;var code='';for(var i=0;i<this.options.interceptors.length;i++){var interceptor=this.options.interceptors[i];if(interceptor.call){code+=this.getInterceptor(i)+".call("+this.args({before:interceptor.context?'_context':undefined})+");\n";}}code+=this.content(Object.assign(options,{onError:onError&&function(err){var code='';for(var _i=0;_i<_this.options.interceptors.length;_i++){var _interceptor=_this.options.interceptors[_i];if(_interceptor.error){code+=_this.getInterceptor(_i)+".error("+err+");\n";}}code+=onError(err);return code;},onResult:onResult&&function(result){var code='';for(var _i2=0;_i2<_this.options.interceptors.length;_i2++){var _interceptor2=_this.options.interceptors[_i2];if(_interceptor2.result){code+=_this.getInterceptor(_i2)+".result("+result+");\n";}}code+=onResult(result);return code;},onDone:onDone&&function(){var code='';for(var _i3=0;_i3<_this.options.interceptors.length;_i3++){var _interceptor3=_this.options.interceptors[_i3];if(_interceptor3.done){code+=_this.getInterceptor(_i3)+".done();\n";}}code+=onDone();return code;}}));return code;}else {return this.content(options);}};_proto.header=function header(){var code='';if(this.needContext()){code+='var _context = {};\n';}else {code+='var _context;\n';}code+='var _x = this._x;\n';if(this.options.interceptors.length>0){code+='var _taps = this.taps;\n';code+='var _interceptors = this.interceptors;\n';}return code;};_proto.needContext=function needContext(){for(var _iterator=_createForOfIteratorHelperLoose(this.options.taps),_step;!(_step=_iterator()).done;){var tap=_step.value;if(tap.context)return true;}return false;};_proto.callTap=function callTap(tapIndex,_ref){var onError=_ref.onError,onResult=_ref.onResult,onDone=_ref.onDone,rethrowIfPossible=_ref.rethrowIfPossible;var code='';var hasTapCached=false;for(var i=0;i<this.options.interceptors.length;i++){var interceptor=this.options.interceptors[i];if(interceptor.tap){if(!hasTapCached){code+="var _tap"+tapIndex+" = "+this.getTap(tapIndex)+";\n";hasTapCached=true;}code+=this.getInterceptor(i)+".tap("+(interceptor.context?'_context, ':'')+"_tap"+tapIndex+");\n";}}code+="var _fn"+tapIndex+" = "+this.getTapFn(tapIndex)+";\n";var tap=this.options.taps[tapIndex];switch(tap.type){case'sync':if(!rethrowIfPossible){code+="var _hasError"+tapIndex+" = false;\n";code+='try {\n';}if(onResult){code+="var _result"+tapIndex+" = _fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined})+");\n";}else {code+="_fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined})+");\n";}if(!rethrowIfPossible){code+='} catch(_err) {\n';code+="_hasError"+tapIndex+" = true;\n";code+=onError('_err');code+='}\n';code+="if(!_hasError"+tapIndex+") {\n";}if(onResult){code+=onResult("_result"+tapIndex);}if(onDone){code+=onDone();}if(!rethrowIfPossible){code+='}\n';}break;case'async':var cbCode='';if(onResult)cbCode+="(function(_err"+tapIndex+", _result"+tapIndex+") {\n";else cbCode+="(function(_err"+tapIndex+") {\n";cbCode+="if(_err"+tapIndex+") {\n";cbCode+=onError("_err"+tapIndex);cbCode+='} else {\n';if(onResult){cbCode+=onResult("_result"+tapIndex);}if(onDone){cbCode+=onDone();}cbCode+='}\n';cbCode+='})';code+="_fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined,after:cbCode})+");\n";break;case'promise':code+="var _hasResult"+tapIndex+" = false;\n";code+="var _promise"+tapIndex+" = _fn"+tapIndex+"("+this.args({before:tap.context?'_context':undefined})+");\n";code+="if (!_promise"+tapIndex+" || !_promise"+tapIndex+".then)\n";code+=" throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise"+tapIndex+" + ')');\n";code+="_promise"+tapIndex+".then((function(_result"+tapIndex+") {\n";code+="_hasResult"+tapIndex+" = true;\n";if(onResult){code+=onResult("_result"+tapIndex);}if(onDone){code+=onDone();}code+="}), function(_err"+tapIndex+") {\n";code+="if(_hasResult"+tapIndex+") throw _err"+tapIndex+";\n";code+=onError("_err"+tapIndex);code+='});\n';break;}return code;};_proto.callTapsSeries=function callTapsSeries(_ref2){var _this2=this;var _onError=_ref2.onError,onResult=_ref2.onResult,resultReturns=_ref2.resultReturns,onDone=_ref2.onDone,doneReturns=_ref2.doneReturns,rethrowIfPossible=_ref2.rethrowIfPossible;if(this.options.taps.length===0)return onDone();var firstAsync=this.options.taps.findIndex(function(t){return t.type!=='sync';});var somethingReturns=resultReturns||doneReturns;var code='';var current=onDone;var unrollCounter=0;var _loop=function _loop(){var i=j;var unroll=current!==onDone&&(_this2.options.taps[i].type!=='sync'||unrollCounter++>20);if(unroll){unrollCounter=0;code+="function _next"+i+"() {\n";code+=current();code+="}\n";current=function current(){return (somethingReturns?'return ':'')+"_next"+i+"();\n";};}var done=current;var doneBreak=function doneBreak(skipDone){if(skipDone)return '';return onDone();};var content=_this2.callTap(i,{onError:function onError(error){return _onError(i,error,done,doneBreak);},onResult:onResult&&function(result){return onResult(i,result,done,doneBreak);},onDone:!onResult&&done,rethrowIfPossible:rethrowIfPossible&&(firstAsync<0||i<firstAsync)});current=function current(){return content;};};for(var j=this.options.taps.length-1;j>=0;j--){_loop();}code+=current();return code;};_proto.callTapsLooping=function callTapsLooping(_ref3){var onError=_ref3.onError,onDone=_ref3.onDone,rethrowIfPossible=_ref3.rethrowIfPossible;if(this.options.taps.length===0)return onDone();var syncOnly=this.options.taps.every(function(t){return t.type==='sync';});var code='';if(!syncOnly){code+='var _looper = (function() {\n';code+='var _loopAsync = false;\n';}code+='var _loop;\n';code+='do {\n';code+='_loop = false;\n';for(var i=0;i<this.options.interceptors.length;i++){var interceptor=this.options.interceptors[i];if(interceptor.loop){code+=this.getInterceptor(i)+".loop("+this.args({before:interceptor.context?'_context':undefined})+");\n";}}code+=this.callTapsSeries({onError:onError,onResult:function onResult(i,result,next,doneBreak){var code='';code+="if("+result+" !== undefined) {\n";code+='_loop = true;\n';if(!syncOnly)code+='if(_loopAsync) _looper();\n';code+=doneBreak(true);code+="} else {\n";code+=next();code+="}\n";return code;},onDone:onDone&&function(){var code='';code+='if(!_loop) {\n';code+=onDone();code+='}\n';return code;},rethrowIfPossible:rethrowIfPossible&&syncOnly});code+='} while(_loop);\n';if(!syncOnly){code+='_loopAsync = true;\n';code+='});\n';code+='_looper();\n';}return code;};_proto.callTapsParallel=function callTapsParallel(_ref4){var _this3=this;var _onError2=_ref4.onError,onResult=_ref4.onResult,onDone=_ref4.onDone,rethrowIfPossible=_ref4.rethrowIfPossible,_ref4$onTap=_ref4.onTap,onTap=_ref4$onTap===void 0?function(i,run){return run();}:_ref4$onTap;if(this.options.taps.length<=1){return this.callTapsSeries({onError:_onError2,onResult:onResult,onDone:onDone,rethrowIfPossible:rethrowIfPossible});}var code='';code+='do {\n';code+="var _counter = "+this.options.taps.length+";\n";if(onDone){code+='var _done = (function() {\n';code+=onDone();code+='});\n';}var _loop2=function _loop2(i){var done=function done(){if(onDone)return 'if(--_counter === 0) _done();\n';else return '--_counter;';};var doneBreak=function doneBreak(skipDone){if(skipDone||!onDone)return '_counter = 0;\n';else return '_counter = 0;\n_done();\n';};code+='if(_counter <= 0) break;\n';code+=onTap(i,function(){return _this3.callTap(i,{onError:function onError(error){var code='';code+='if(_counter > 0) {\n';code+=_onError2(i,error,done,doneBreak);code+='}\n';return code;},onResult:onResult&&function(result){var code='';code+='if(_counter > 0) {\n';code+=onResult(i,result,done,doneBreak);code+='}\n';return code;},onDone:!onResult&&function(){return done();},rethrowIfPossible:rethrowIfPossible});},done,doneBreak);};for(var i=0;i<this.options.taps.length;i++){_loop2(i);}code+='} while(false);\n';return code;};_proto.args=function args(_temp){var _ref5=_temp===void 0?{}:_temp,before=_ref5.before,after=_ref5.after;var allArgs=this._args;if(before)allArgs=[before].concat(allArgs);if(after)allArgs=allArgs.concat(after);if(allArgs.length===0){return '';}else {return allArgs.join(', ');}};_proto.getTapFn=function getTapFn(idx){return "_x["+idx+"]";};_proto.getTap=function getTap(idx){return "_taps["+idx+"]";};_proto.getInterceptor=function getInterceptor(idx){return "_interceptors["+idx+"]";};return HookCodeFactory;}();var AsyncParallelHookCodeFactory=/*#__PURE__*/function(_HookCodeFactory){_inheritsLoose(AsyncParallelHookCodeFactory,_HookCodeFactory);function AsyncParallelHookCodeFactory(){return _HookCodeFactory.apply(this,arguments)||this;}var _proto=AsyncParallelHookCodeFactory.prototype;_proto.content=function content(_ref){var _onError=_ref.onError,onDone=_ref.onDone;return this.callTapsParallel({onError:function onError(i,err,done,doneBreak){return _onError(err)+doneBreak(true);},onDone:onDone});};return AsyncParallelHookCodeFactory;}(HookCodeFactory);var factory=new AsyncParallelHookCodeFactory();var COMPILE=function COMPILE(options){factory.setup(this,options);return factory.create(options);};var AsyncParallelHook=/*#__PURE__*/function(_Hook){_inheritsLoose(AsyncParallelHook,_Hook);function AsyncParallelHook(args,name){var _this;if(args===void 0){args=[];}if(name===void 0){name=undefined;}_this=_Hook.call(this,args,name)||this;_this.compile=COMPILE;_this._call=undefined;_this.call=undefined;return _this;}return AsyncParallelHook;}(Hook);// export function AsyncParallelHook(args = [], name = undefined) {
7743
- // const hook = new Hook(args, name);
7744
- // hook.constructor = AsyncParallelHook;
7745
- // hook.compile = COMPILE;
7746
- // hook._call = undefined;
7747
- // hook.call = undefined;
7748
- // return hook;
7749
- // }
7750
- // AsyncParallelHook.prototype = null;
7751
- var AsyncSeriesWaterfallHookCodeFactory=/*#__PURE__*/function(_HookCodeFactory){_inheritsLoose(AsyncSeriesWaterfallHookCodeFactory,_HookCodeFactory);function AsyncSeriesWaterfallHookCodeFactory(){return _HookCodeFactory.apply(this,arguments)||this;}var _proto=AsyncSeriesWaterfallHookCodeFactory.prototype;_proto.content=function content(_ref){var _this=this;var _onError=_ref.onError,onResult=_ref.onResult,onDone=_ref.onDone;return this.callTapsSeries({onError:function onError(i,err,next,doneBreak){return _onError(err)+doneBreak(true);},onResult:function onResult(i,result,next){var code='';code+="if("+result+" !== undefined) {\n";code+=_this._args[0]+" = "+result+";\n";code+="}\n";code+=next();return code;},onDone:function onDone(){return onResult(_this._args[0]);}});};return AsyncSeriesWaterfallHookCodeFactory;}(HookCodeFactory);var factory$1=new AsyncSeriesWaterfallHookCodeFactory();var COMPILE$1=function COMPILE(options){factory$1.setup(this,options);return factory$1.create(options);};// export function AsyncSeriesWaterfallHook(args = [], name = undefined) {
7752
- // if (args.length < 1) throw new Error('Waterfall hooks must have at least one argument');
7753
- // const hook = new Hook(args, name);
7754
- // hook.constructor = AsyncSeriesWaterfallHook;
7755
- // hook.compile = COMPILE;
7756
- // hook._call = undefined;
7757
- // hook.call = undefined;
7758
- // return hook;
7759
- // }
7760
- // AsyncSeriesWaterfallHook.prototype = null;
7761
- var AsyncSeriesWaterfallHook=/*#__PURE__*/function(_Hook){_inheritsLoose(AsyncSeriesWaterfallHook,_Hook);function AsyncSeriesWaterfallHook(args,name){var _this2;if(args===void 0){args=[];}if(name===void 0){name=undefined;}_this2=_Hook.call(this,args,name)||this;_this2.compile=COMPILE$1;_this2._call=undefined;_this2.call=undefined;return _this2;}return AsyncSeriesWaterfallHook;}(Hook);var SyncHookCodeFactory=/*#__PURE__*/function(_HookCodeFactory){_inheritsLoose(SyncHookCodeFactory,_HookCodeFactory);function SyncHookCodeFactory(){return _HookCodeFactory.apply(this,arguments)||this;}var _proto=SyncHookCodeFactory.prototype;_proto.content=function content(_ref){var _onError=_ref.onError,onDone=_ref.onDone,rethrowIfPossible=_ref.rethrowIfPossible;return this.callTapsSeries({onError:function onError(i,err){return _onError(err);},onDone:onDone,rethrowIfPossible:rethrowIfPossible});};return SyncHookCodeFactory;}(HookCodeFactory);var factory$2=new SyncHookCodeFactory();var TAP_ASYNC=function TAP_ASYNC(){throw new Error('tapAsync is not supported on a SyncHook');};var TAP_PROMISE=function TAP_PROMISE(){throw new Error('tapPromise is not supported on a SyncHook');};var COMPILE$2=function COMPILE(options){factory$2.setup(this,options);return factory$2.create(options);};var SyncHook=/*#__PURE__*/function(_Hook){_inheritsLoose(SyncHook,_Hook);function SyncHook(args,name){var _this;if(args===void 0){args=[];}if(name===void 0){name=undefined;}_this=_Hook.call(this,args,name)||this;_this.tapAsync=TAP_ASYNC;_this.tapPromise=TAP_PROMISE;_this.compile=COMPILE$2;return _this;}return SyncHook;}(Hook);// export function SyncHook(args = [], name = undefined) {
7762
- // const hook = new Hook(args, name);
7763
- // hook.constructor = SyncHook;
7764
- // hook.tapAsync = TAP_ASYNC;
7765
- // hook.tapPromise = TAP_PROMISE;
7766
- // hook.compile = COMPILE;
7767
- // return hook;
7768
- // }
7769
- // SyncHook.prototype = null;
7770
- var SyncWaterfallHookCodeFactory=/*#__PURE__*/function(_HookCodeFactory){_inheritsLoose(SyncWaterfallHookCodeFactory,_HookCodeFactory);function SyncWaterfallHookCodeFactory(){return _HookCodeFactory.apply(this,arguments)||this;}var _proto=SyncWaterfallHookCodeFactory.prototype;_proto.content=function content(_ref){var _this=this;var _onError=_ref.onError,onResult=_ref.onResult,resultReturns=_ref.resultReturns,rethrowIfPossible=_ref.rethrowIfPossible;return this.callTapsSeries({onError:function onError(i,err){return _onError(err);},onResult:function onResult(i,result,next){var code='';code+="if("+result+" !== undefined) {\n";code+=_this._args[0]+" = "+result+";\n";code+="}\n";code+=next();return code;},onDone:function onDone(){return onResult(_this._args[0]);},doneReturns:resultReturns,rethrowIfPossible:rethrowIfPossible});};return SyncWaterfallHookCodeFactory;}(HookCodeFactory);var factory$3=new SyncWaterfallHookCodeFactory();var TAP_ASYNC$1=function TAP_ASYNC(){throw new Error('tapAsync is not supported on a SyncWaterfallHook');};var TAP_PROMISE$1=function TAP_PROMISE(){throw new Error('tapPromise is not supported on a SyncWaterfallHook');};var COMPILE$3=function COMPILE(options){factory$3.setup(this,options);return factory$3.create(options);};var SyncWaterfallHook=/*#__PURE__*/function(_SyncHook){_inheritsLoose(SyncWaterfallHook,_SyncHook);function SyncWaterfallHook(args,name){var _this2;if(args===void 0){args=[];}if(name===void 0){name=undefined;}_this2=_SyncHook.call(this,args,name)||this;_this2.tapAsync=TAP_ASYNC$1;_this2.tapPromise=TAP_PROMISE$1;_this2.compile=COMPILE$3;return _this2;}return SyncWaterfallHook;}(SyncHook);// export function SyncWaterfallHook(args = [], name = undefined) {
7771
- // if (args.length < 1) throw new Error('Waterfall hooks must have at least one argument');
7772
- // const hook = new Hook(args, name);
7773
- // hook.constructor = SyncWaterfallHook;
7774
- // hook.tapAsync = TAP_ASYNC;
7775
- // hook.tapPromise = TAP_PROMISE;
7776
- // hook.compile = COMPILE;
7777
- // return hook;
7778
- // }
7779
- // SyncWaterfallHook.prototype = null;
7780
- var genericFontFamilies=['serif','sans-serif','monospace','cursive','fantasy','system-ui'];var stringRegExp=/([\"\'])[^\'\"]+\1/;function toFontString(attributes){var fontSize=attributes.fontSize,fontFamily=attributes.fontFamily,fontStyle=attributes.fontStyle,fontVariant=attributes.fontVariant,fontWeight=attributes.fontWeight;// build canvas api font setting from individual components. Convert a numeric this.fontSize to px
7700
+ hasFill=true;hasStroke=true;}return [hasFill,hasStroke];}var AsyncParallelHook=/*#__PURE__*/function(){function AsyncParallelHook(){this.callbacks=[];}var _proto=AsyncParallelHook.prototype;_proto.tapPromise=function tapPromise(options,fn){this.callbacks.push(fn);};_proto.promise=/*#__PURE__*/function(){var _promise=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var _len,args,_key,_args=arguments;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:for(_len=_args.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=_args[_key];}_context.next=3;return Promise.all(this.callbacks.map(function(callback){return callback.apply(void 0,args);}));case 3:case"end":return _context.stop();}},_callee,this);}));function promise(){return _promise.apply(this,arguments);}return promise;}();return AsyncParallelHook;}();var AsyncSeriesWaterfallHook=/*#__PURE__*/function(){function AsyncSeriesWaterfallHook(){this.callbacks=[];}var _proto=AsyncSeriesWaterfallHook.prototype;_proto.tapPromise=function tapPromise(options,fn){this.callbacks.push(fn);};_proto.promise=/*#__PURE__*/function(){var _promise=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var _this$callbacks,result,i,callback,_args=arguments;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!this.callbacks.length){_context.next=14;break;}_context.next=3;return (_this$callbacks=this.callbacks)[0].apply(_this$callbacks,_args);case 3:result=_context.sent;i=0;case 5:if(!(i<this.callbacks.length-1)){_context.next=13;break;}callback=this.callbacks[i];// @ts-ignore
7701
+ _context.next=9;return callback(result);case 9:result=_context.sent;case 10:i++;_context.next=5;break;case 13:return _context.abrupt("return",result);case 14:return _context.abrupt("return",null);case 15:case"end":return _context.stop();}},_callee,this);}));function promise(){return _promise.apply(this,arguments);}return promise;}();return AsyncSeriesWaterfallHook;}();var SyncHook=/*#__PURE__*/function(){function SyncHook(){this.callbacks=[];}var _proto=SyncHook.prototype;_proto.tap=function tap(options,fn){this.callbacks.push(fn);};_proto.call=function call(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}this.callbacks.forEach(function(callback){callback.apply(void 0,args);});};return SyncHook;}();var SyncWaterfallHook=/*#__PURE__*/function(){function SyncWaterfallHook(){this.callbacks=[];}var _proto=SyncWaterfallHook.prototype;_proto.tap=function tap(options,fn){this.callbacks.push(fn);};_proto.call=function call(){if(this.callbacks.length){var _this$callbacks;var result=(_this$callbacks=this.callbacks)[0].apply(_this$callbacks,arguments);for(var i=0;i<this.callbacks.length-1;i++){var callback=this.callbacks[i];// @ts-ignore
7702
+ result=callback(result);}return result;}return null;};return SyncWaterfallHook;}();var genericFontFamilies=['serif','sans-serif','monospace','cursive','fantasy','system-ui'];var stringRegExp=/([\"\'])[^\'\"]+\1/;function toFontString(attributes){var fontSize=attributes.fontSize,fontFamily=attributes.fontFamily,fontStyle=attributes.fontStyle,fontVariant=attributes.fontVariant,fontWeight=attributes.fontWeight;// build canvas api font setting from individual components. Convert a numeric this.fontSize to px
7781
7703
  // const fontSizeString: string = isNumber(fontSize) ? `${fontSize}px` : fontSize.toString();
7782
7704
  var fontSizeString=isNumber(fontSize)&&fontSize+"px"||'16px';// Clean-up fontFamily property by quoting each font name
7783
7705
  // this will support font names with spaces
@@ -8061,9 +7983,9 @@
8061
7983
  }else if(plane.pnVertexFlag===0x010){return [this.min[0],this.max[1],this.min[2]];// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
8062
7984
  }else if(plane.pnVertexFlag===0x001){return [this.min[0],this.min[1],this.max[2]];// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
8063
7985
  }else {return [this.min[0],this.min[1],this.min[2]];// return vec3.fromValues(this.min[0], this.min[1], this.min[2]);
8064
- }};return AABB;}();var Plane=/*#__PURE__*/function(){/**
8065
- * lookup table for p-vertex & n-vertex when doing frustum culling
8066
- */function Plane(distance,normal){this.distance=void 0;this.normal=void 0;this.pnVertexFlag=void 0;this.distance=distance||0;this.normal=normal||fromValues$2(0,1,0);this.updatePNVertexFlag();}var _proto=Plane.prototype;_proto.updatePNVertexFlag=function updatePNVertexFlag(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0);};_proto.distanceToPoint=function distanceToPoint(point){return dot(point,this.normal)-this.distance;};_proto.normalize=function normalize(){var invLen=1/len(this.normal);scale$1(this.normal,this.normal,invLen);this.distance*=invLen;};_proto.intersectsLine=function intersectsLine(start,end,point){var d0=this.distanceToPoint(start);var d1=this.distanceToPoint(end);var t=d0/(d0-d1);var intersects=t>=0&&t<=1;if(intersects&&point){lerp(point,start,end,t);}return intersects;};return Plane;}();(function(Mask){Mask[Mask["OUTSIDE"]=4294967295]="OUTSIDE";Mask[Mask["INSIDE"]=0]="INSIDE";Mask[Mask["INDETERMINATE"]=2147483647]="INDETERMINATE";})(exports.Mask||(exports.Mask={}));var Frustum=/*#__PURE__*/function(){function Frustum(planes){this.planes=[];if(planes){this.planes=planes;}else {for(var i=0;i<6;i++){this.planes.push(new Plane());}}}/**
7986
+ }};return AABB;}();var Plane=/*#__PURE__*/function(){function Plane(distance,normal){this.distance=void 0;this.normal=void 0;/**
7987
+ * lookup table for p-vertex & n-vertex when doing frustum culling
7988
+ */this.pnVertexFlag=void 0;this.distance=distance||0;this.normal=normal||fromValues$2(0,1,0);this.updatePNVertexFlag();}var _proto=Plane.prototype;_proto.updatePNVertexFlag=function updatePNVertexFlag(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0);};_proto.distanceToPoint=function distanceToPoint(point){return dot(point,this.normal)-this.distance;};_proto.normalize=function normalize(){var invLen=1/len(this.normal);scale$1(this.normal,this.normal,invLen);this.distance*=invLen;};_proto.intersectsLine=function intersectsLine(start,end,point){var d0=this.distanceToPoint(start);var d1=this.distanceToPoint(end);var t=d0/(d0-d1);var intersects=t>=0&&t<=1;if(intersects&&point){lerp(point,start,end,t);}return intersects;};return Plane;}();(function(Mask){Mask[Mask["OUTSIDE"]=4294967295]="OUTSIDE";Mask[Mask["INSIDE"]=0]="INSIDE";Mask[Mask["INDETERMINATE"]=2147483647]="INDETERMINATE";})(exports.Mask||(exports.Mask={}));var Frustum=/*#__PURE__*/function(){function Frustum(planes){this.planes=[];if(planes){this.planes=planes;}else {for(var i=0;i<6;i++){this.planes.push(new Plane());}}}/**
8067
7989
  * extract 6 planes from projectionMatrix
8068
7990
  * @see http://www8.cs.umu.se/kurser/5DV051/HT12/lab/plane_extraction.pdf
8069
7991
  */var _proto=Frustum.prototype;_proto.extractFromVPMatrix=function extractFromVPMatrix(projectionMatrix){// @ts-ignore
@@ -8583,19 +8505,19 @@
8583
8505
  * * init
8584
8506
  * * destroy
8585
8507
  * * attributeChanged
8586
- */var DisplayObject=/*#__PURE__*/function(_Element){_inheritsLoose(DisplayObject,_Element);/**
8587
- * contains style props in constructor's params, eg. fill, stroke...
8588
- */ /**
8589
- * push to active animations after calling `animate()`
8590
- */ /**
8591
- * Use data-* attribute.
8592
- * @see https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
8593
- * @example
8594
- * group.dataset.prop1 = 1;
8595
- * group.getAttribute('data-prop1'); // 1
8596
- */function DisplayObject(config){var _this$config$capture;var _this;_this=_Element.call(this)||this;// assign name, id to config
8508
+ */var DisplayObject=/*#__PURE__*/function(_Element){_inheritsLoose(DisplayObject,_Element);function DisplayObject(config){var _this$config$capture;var _this;_this=_Element.call(this)||this;// assign name, id to config
8597
8509
  // eg. group.get('name')
8598
- _this.config=void 0;_this.isCustomElement=false;_this.isMutationObserved=false;_this.activeAnimations=[];_this.dataset=void 0;/**
8510
+ /**
8511
+ * contains style props in constructor's params, eg. fill, stroke...
8512
+ */_this.config=void 0;_this.isCustomElement=false;_this.isMutationObserved=false;/**
8513
+ * push to active animations after calling `animate()`
8514
+ */_this.activeAnimations=[];/**
8515
+ * Use data-* attribute.
8516
+ * @see https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
8517
+ * @example
8518
+ * group.dataset.prop1 = 1;
8519
+ * group.getAttribute('data-prop1'); // 1
8520
+ */_this.dataset=void 0;/**
8599
8521
  * Use `this.style.clipPath` instead.
8600
8522
  * @deprecated
8601
8523
  */_this.getClip=function(){return this.style.clipPath||null;};_this.config=config;// compatible with G 3.0
@@ -8756,11 +8678,11 @@
8756
8678
  */;_proto.setZIndex=function setZIndex(zIndex){this.style.zIndex=zIndex;return this;};_createClass(DisplayObject,[{key:"interactive",get:function get(){return this.isInteractive();},set:function set(b){this.style.pointerEvents=b?'auto':'none';}}]);return DisplayObject;}(Element);var _excluded=["style"];var Circle=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Circle,_DisplayObject);function Circle(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded);return _DisplayObject.call(this,_extends({type:exports.Shape.CIRCLE,style:runtime.enableCSSParsing?_extends({cx:'',cy:'',r:''},style):_extends({},style),initialParsedStyle:{anchor:[0.5,0.5],transformOrigin:runtime.enableCSSParsing?null:[PECENTAGE_50,PECENTAGE_50]}},rest))||this;}return Circle;}(DisplayObject);var _excluded$1=["style"];/**
8757
8679
  * shadow root
8758
8680
  * @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
8759
- */var CustomElement=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(CustomElement,_DisplayObject);// static get observedAttributes(): string[] {
8681
+ */var CustomElement=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(CustomElement,_DisplayObject);// private shadowNodes: DisplayObject[] = [];
8682
+ function CustomElement(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$1);_this=_DisplayObject.call(this,_extends({style:runtime.enableCSSParsing?_extends({x:'',y:''},style):_extends({},style)},rest))||this;// static get observedAttributes(): string[] {
8760
8683
  // return [];
8761
8684
  // }
8762
- // private shadowNodes: DisplayObject[] = [];
8763
- function CustomElement(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$1);_this=_DisplayObject.call(this,_extends({style:runtime.enableCSSParsing?_extends({x:'',y:''},style):_extends({},style)},rest))||this;_this.isCustomElement=true;return _this;}return CustomElement;}(DisplayObject);var _excluded$2=["style"];var Ellipse=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Ellipse,_DisplayObject);function Ellipse(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$2);return _DisplayObject.call(this,_extends({type:exports.Shape.ELLIPSE,style:runtime.enableCSSParsing?_extends({cx:'',cy:'',rx:'',ry:''},style):_extends({},style),initialParsedStyle:{anchor:[0.5,0.5],transformOrigin:runtime.enableCSSParsing?null:[PECENTAGE_50,PECENTAGE_50]}},rest))||this;}return Ellipse;}(DisplayObject);var _excluded$3=["style"];/**
8685
+ _this.isCustomElement=true;return _this;}return CustomElement;}(DisplayObject);var _excluded$2=["style"];var Ellipse=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Ellipse,_DisplayObject);function Ellipse(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$2);return _DisplayObject.call(this,_extends({type:exports.Shape.ELLIPSE,style:runtime.enableCSSParsing?_extends({cx:'',cy:'',rx:'',ry:''},style):_extends({},style),initialParsedStyle:{anchor:[0.5,0.5],transformOrigin:runtime.enableCSSParsing?null:[PECENTAGE_50,PECENTAGE_50]}},rest))||this;}return Ellipse;}(DisplayObject);var _excluded$3=["style"];/**
8764
8686
  * its attributes are inherited by its children.
8765
8687
  * @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/g
8766
8688
  *
@@ -8795,9 +8717,9 @@
8795
8717
  marker.setLocalEulerAngles(rad*180/Math.PI+originalAngle);marker.setLocalPosition(ox+Math.cos(rad)*offset,oy+Math.sin(rad)*offset);};_proto.getPoint=function getPoint(ratio,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}// TODO: account for z1/z2 in 3D line
8796
8718
  var _this$parsedStyle3=this.parsedStyle,x1=_this$parsedStyle3.x1,y1=_this$parsedStyle3.y1,x2=_this$parsedStyle3.x2,y2=_this$parsedStyle3.y2,defX=_this$parsedStyle3.defX,defY=_this$parsedStyle3.defY;var _LineUtil$pointAt=line.pointAt(x1,y1,x2,y2,ratio),x=_LineUtil$pointAt.x,y=_LineUtil$pointAt.y;var transformed=transformMat4(create$2(),fromValues$2(x-defX,y-defY,0),inWorldSpace?this.getWorldTransform():this.getLocalTransform());// apply local transformation
8797
8719
  return new Point(transformed[0],transformed[1]);};_proto.getPointAtLength=function getPointAtLength(distance,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}return this.getPoint(distance/this.getTotalLength(),inWorldSpace);};_proto.getTotalLength=function getTotalLength(){// TODO: account for z1/z2 in 3D line
8798
- var _this$parsedStyle4=this.parsedStyle,x1=_this$parsedStyle4.x1,y1=_this$parsedStyle4.y1,x2=_this$parsedStyle4.x2,y2=_this$parsedStyle4.y2;return line.length(x1,y1,x2,y2);};return Line;}(DisplayObject);var _excluded$7=["style"];var EMPTY_PARSED_PATH={absolutePath:[],hasArc:false,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Rectangle(0,0,0,0)};var Path=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Path,_DisplayObject);/**
8799
- * markers placed at the mid
8800
- */function Path(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$7);_this=_DisplayObject.call(this,_extends({type:exports.Shape.PATH,style:runtime.enableCSSParsing?_extends({path:'',miterLimit:''},style):_extends({},style),initialParsedStyle:runtime.enableCSSParsing?null:{miterLimit:4,path:_extends({},EMPTY_PARSED_PATH)}},rest))||this;_this.markerStartAngle=0;_this.markerEndAngle=0;_this.markerMidList=[];var _this$parsedStyle=_this.parsedStyle,markerStart=_this$parsedStyle.markerStart,markerEnd=_this$parsedStyle.markerEnd,markerMid=_this$parsedStyle.markerMid;if(markerStart&&isDisplayObject(markerStart)){_this.markerStartAngle=markerStart.getLocalEulerAngles();_this.appendChild(markerStart);}if(markerMid&&isDisplayObject(markerMid)){_this.placeMarkerMid(markerMid);}if(markerEnd&&isDisplayObject(markerEnd)){_this.markerEndAngle=markerEnd.getLocalEulerAngles();_this.appendChild(markerEnd);}_this.transformMarker(true);_this.transformMarker(false);return _this;}var _proto=Path.prototype;_proto.attributeChangedCallback=function attributeChangedCallback(attrName,oldValue,newValue,prevParsedValue,newParsedValue){if(attrName==='path'){// recalc markers
8720
+ var _this$parsedStyle4=this.parsedStyle,x1=_this$parsedStyle4.x1,y1=_this$parsedStyle4.y1,x2=_this$parsedStyle4.x2,y2=_this$parsedStyle4.y2;return line.length(x1,y1,x2,y2);};return Line;}(DisplayObject);var _excluded$7=["style"];var EMPTY_PARSED_PATH={absolutePath:[],hasArc:false,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Rectangle(0,0,0,0)};var Path=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Path,_DisplayObject);function Path(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$7);_this=_DisplayObject.call(this,_extends({type:exports.Shape.PATH,style:runtime.enableCSSParsing?_extends({path:'',miterLimit:''},style):_extends({},style),initialParsedStyle:runtime.enableCSSParsing?null:{miterLimit:4,path:_extends({},EMPTY_PARSED_PATH)}},rest))||this;_this.markerStartAngle=0;_this.markerEndAngle=0;/**
8721
+ * markers placed at the mid
8722
+ */_this.markerMidList=[];var _this$parsedStyle=_this.parsedStyle,markerStart=_this$parsedStyle.markerStart,markerEnd=_this$parsedStyle.markerEnd,markerMid=_this$parsedStyle.markerMid;if(markerStart&&isDisplayObject(markerStart)){_this.markerStartAngle=markerStart.getLocalEulerAngles();_this.appendChild(markerStart);}if(markerMid&&isDisplayObject(markerMid)){_this.placeMarkerMid(markerMid);}if(markerEnd&&isDisplayObject(markerEnd)){_this.markerEndAngle=markerEnd.getLocalEulerAngles();_this.appendChild(markerEnd);}_this.transformMarker(true);_this.transformMarker(false);return _this;}var _proto=Path.prototype;_proto.attributeChangedCallback=function attributeChangedCallback(attrName,oldValue,newValue,prevParsedValue,newParsedValue){if(attrName==='path'){// recalc markers
8801
8723
  this.transformMarker(true);this.transformMarker(false);this.placeMarkerMid(this.parsedStyle.markerMid);}else if(attrName==='markerStartOffset'||attrName==='markerEndOffset'){this.transformMarker(true);this.transformMarker(false);}else if(attrName==='markerStart'){if(prevParsedValue&&isDisplayObject(prevParsedValue)){this.markerStartAngle=0;prevParsedValue.remove();}// CSSKeyword 'unset'
8802
8724
  if(newParsedValue&&isDisplayObject(newParsedValue)){this.markerStartAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(true);}}else if(attrName==='markerEnd'){if(prevParsedValue&&isDisplayObject(prevParsedValue)){this.markerEndAngle=0;prevParsedValue.remove();}if(newParsedValue&&isDisplayObject(newParsedValue)){this.markerEndAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(false);}}else if(attrName==='markerMid'){this.placeMarkerMid(newParsedValue);}};_proto.transformMarker=function transformMarker(isStart){var _this$parsedStyle2=this.parsedStyle,markerStart=_this$parsedStyle2.markerStart,markerEnd=_this$parsedStyle2.markerEnd,markerStartOffset=_this$parsedStyle2.markerStartOffset,markerEndOffset=_this$parsedStyle2.markerEndOffset,defX=_this$parsedStyle2.defX,defY=_this$parsedStyle2.defY;var marker=isStart?markerStart:markerEnd;if(!marker||!isDisplayObject(marker)){return;}var rad=0;var x;var y;var ox;var oy;var offset;var originalAngle;if(isStart){var _this$getStartTangent=this.getStartTangent(),p1=_this$getStartTangent[0],p2=_this$getStartTangent[1];ox=p2[0]-defX;oy=p2[1]-defY;x=p1[0]-p2[0];y=p1[1]-p2[1];offset=markerStartOffset||0;originalAngle=this.markerStartAngle;}else {var _this$getEndTangent=this.getEndTangent(),_p=_this$getEndTangent[0],_p2=_this$getEndTangent[1];ox=_p2[0]-defX;oy=_p2[1]-defY;x=_p[0]-_p2[0];y=_p[1]-_p2[1];offset=markerEndOffset||0;originalAngle=this.markerEndAngle;}rad=Math.atan2(y,x);// account for markerOffset
8803
8725
  marker.setLocalEulerAngles(rad*180/Math.PI+originalAngle);marker.setLocalPosition(ox+Math.cos(rad)*offset,oy+Math.sin(rad)*offset);};_proto.placeMarkerMid=function placeMarkerMid(marker){var _this$parsedStyle3=this.parsedStyle,segments=_this$parsedStyle3.path.segments,defX=_this$parsedStyle3.defX,defY=_this$parsedStyle3.defY;// clear all existed markers
@@ -8815,9 +8737,9 @@
8815
8737
  * Get start tangent vector
8816
8738
  */;_proto.getStartTangent=function getStartTangent(){var segments=this.parsedStyle.path.segments;var result=[];if(segments.length>1){var startPoint=segments[0].currentPoint;var endPoint=segments[1].currentPoint;var tangent=segments[1].startTangent;result=[];if(tangent){result.push([startPoint[0]-tangent[0],startPoint[1]-tangent[1]]);result.push([startPoint[0],startPoint[1]]);}else {result.push([endPoint[0],endPoint[1]]);result.push([startPoint[0],startPoint[1]]);}}return result;}/**
8817
8739
  * Get end tangent vector
8818
- */;_proto.getEndTangent=function getEndTangent(){var segments=this.parsedStyle.path.segments;var length=segments.length;var result=[];if(length>1){var startPoint=segments[length-2].currentPoint;var endPoint=segments[length-1].currentPoint;var tangent=segments[length-1].endTangent;result=[];if(tangent){result.push([endPoint[0]-tangent[0],endPoint[1]-tangent[1]]);result.push([endPoint[0],endPoint[1]]);}else {result.push([startPoint[0],startPoint[1]]);result.push([endPoint[0],endPoint[1]]);}}return result;};return Path;}(DisplayObject);var _excluded$8=["style"];var Polygon=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Polygon,_DisplayObject);/**
8819
- * markers placed at the mid
8820
- */function Polygon(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$8);_this=_DisplayObject.call(this,_extends({type:exports.Shape.POLYGON,style:runtime.enableCSSParsing?_extends({points:'',miterLimit:'',isClosed:true},style):_extends({},style),initialParsedStyle:runtime.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:true}},rest))||this;_this.markerStartAngle=0;_this.markerEndAngle=0;_this.markerMidList=[];var _this$parsedStyle=_this.parsedStyle,markerStart=_this$parsedStyle.markerStart,markerEnd=_this$parsedStyle.markerEnd,markerMid=_this$parsedStyle.markerMid;if(markerStart&&isDisplayObject(markerStart)){_this.markerStartAngle=markerStart.getLocalEulerAngles();_this.appendChild(markerStart);}if(markerMid&&isDisplayObject(markerMid)){_this.placeMarkerMid(markerMid);}if(markerEnd&&isDisplayObject(markerEnd)){_this.markerEndAngle=markerEnd.getLocalEulerAngles();_this.appendChild(markerEnd);}_this.transformMarker(true);_this.transformMarker(false);return _this;}var _proto=Polygon.prototype;_proto.attributeChangedCallback=function attributeChangedCallback(attrName,oldValue,newValue,prevParsedValue,newParsedValue){if(attrName==='points'){// recalc markers
8740
+ */;_proto.getEndTangent=function getEndTangent(){var segments=this.parsedStyle.path.segments;var length=segments.length;var result=[];if(length>1){var startPoint=segments[length-2].currentPoint;var endPoint=segments[length-1].currentPoint;var tangent=segments[length-1].endTangent;result=[];if(tangent){result.push([endPoint[0]-tangent[0],endPoint[1]-tangent[1]]);result.push([endPoint[0],endPoint[1]]);}else {result.push([startPoint[0],startPoint[1]]);result.push([endPoint[0],endPoint[1]]);}}return result;};return Path;}(DisplayObject);var _excluded$8=["style"];var Polygon=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Polygon,_DisplayObject);function Polygon(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$8);_this=_DisplayObject.call(this,_extends({type:exports.Shape.POLYGON,style:runtime.enableCSSParsing?_extends({points:'',miterLimit:'',isClosed:true},style):_extends({},style),initialParsedStyle:runtime.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:true}},rest))||this;_this.markerStartAngle=0;_this.markerEndAngle=0;/**
8741
+ * markers placed at the mid
8742
+ */_this.markerMidList=[];var _this$parsedStyle=_this.parsedStyle,markerStart=_this$parsedStyle.markerStart,markerEnd=_this$parsedStyle.markerEnd,markerMid=_this$parsedStyle.markerMid;if(markerStart&&isDisplayObject(markerStart)){_this.markerStartAngle=markerStart.getLocalEulerAngles();_this.appendChild(markerStart);}if(markerMid&&isDisplayObject(markerMid)){_this.placeMarkerMid(markerMid);}if(markerEnd&&isDisplayObject(markerEnd)){_this.markerEndAngle=markerEnd.getLocalEulerAngles();_this.appendChild(markerEnd);}_this.transformMarker(true);_this.transformMarker(false);return _this;}var _proto=Polygon.prototype;_proto.attributeChangedCallback=function attributeChangedCallback(attrName,oldValue,newValue,prevParsedValue,newParsedValue){if(attrName==='points'){// recalc markers
8821
8743
  this.transformMarker(true);this.transformMarker(false);this.placeMarkerMid(this.parsedStyle.markerMid);}else if(attrName==='markerStartOffset'||attrName==='markerEndOffset'){this.transformMarker(true);this.transformMarker(false);}else if(attrName==='markerStart'){if(prevParsedValue&&isDisplayObject(prevParsedValue)){this.markerStartAngle=0;prevParsedValue.remove();}// CSSKeyword 'unset'
8822
8744
  if(newParsedValue&&isDisplayObject(newParsedValue)){this.markerStartAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(true);}}else if(attrName==='markerEnd'){if(prevParsedValue&&isDisplayObject(prevParsedValue)){this.markerEndAngle=0;prevParsedValue.remove();}if(newParsedValue&&isDisplayObject(newParsedValue)){this.markerEndAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(false);}}else if(attrName==='markerMid'){this.placeMarkerMid(newParsedValue);}};_proto.transformMarker=function transformMarker(isStart){var _this$parsedStyle2=this.parsedStyle,markerStart=_this$parsedStyle2.markerStart,markerEnd=_this$parsedStyle2.markerEnd,markerStartOffset=_this$parsedStyle2.markerStartOffset,markerEndOffset=_this$parsedStyle2.markerEndOffset,points=_this$parsedStyle2.points.points,defX=_this$parsedStyle2.defX,defY=_this$parsedStyle2.defY;var marker=isStart?markerStart:markerEnd;if(!marker||!isDisplayObject(marker)){return;}var rad=0;var x;var y;var ox;var oy;var offset;var originalAngle;ox=points[0][0]-defX;oy=points[0][1]-defY;if(isStart){x=points[1][0]-points[0][0];y=points[1][1]-points[0][1];offset=markerStartOffset||0;originalAngle=this.markerStartAngle;}else {var length=points.length;if(!this.parsedStyle.isClosed){ox=points[length-1][0]-defX;oy=points[length-1][1]-defY;x=points[length-2][0]-points[length-1][0];y=points[length-2][1]-points[length-1][1];}else {x=points[length-1][0]-points[0][0];y=points[length-1][1]-points[0][1];}offset=markerEndOffset||0;originalAngle=this.markerEndAngle;}rad=Math.atan2(y,x);// account for markerOffset
8823
8745
  marker.setLocalEulerAngles(rad*180/Math.PI+originalAngle);marker.setLocalPosition(ox+Math.cos(rad)*offset,oy+Math.sin(rad)*offset);};_proto.placeMarkerMid=function placeMarkerMid(marker){var _this$parsedStyle3=this.parsedStyle,points=_this$parsedStyle3.points.points,defX=_this$parsedStyle3.defX,defY=_this$parsedStyle3.defY;// clear all existed markers
@@ -9351,23 +9273,23 @@
9351
9273
  * called before any frame rendered
9352
9274
  */init:new AsyncParallelHook(),/**
9353
9275
  * only dirty object which has sth changed will be rendered
9354
- */dirtycheck:new SyncWaterfallHook(['object']),/**
9276
+ */dirtycheck:new SyncWaterfallHook(),/**
9355
9277
  * do culling
9356
- */cull:new SyncWaterfallHook(['object','camera']),/**
9278
+ */cull:new SyncWaterfallHook(),/**
9357
9279
  * called at beginning of each frame, won't get called if nothing to re-render
9358
- */beginFrame:new SyncHook([]),/**
9280
+ */beginFrame:new SyncHook(),/**
9359
9281
  * called before every dirty object get rendered
9360
- */beforeRender:new SyncHook(['objectToRender']),/**
9282
+ */beforeRender:new SyncHook(),/**
9361
9283
  * called when every dirty object rendering even it's culled
9362
- */render:new SyncHook(['objectToRender']),/**
9284
+ */render:new SyncHook(),/**
9363
9285
  * called after every dirty object get rendered
9364
- */afterRender:new SyncHook(['objectToRender']),endFrame:new SyncHook([]),destroy:new SyncHook([]),/**
9286
+ */afterRender:new SyncHook(),endFrame:new SyncHook(),destroy:new SyncHook(),/**
9365
9287
  * use async but faster method such as GPU-based picking in `g-plugin-device-renderer`
9366
- */pick:new AsyncSeriesWaterfallHook(['result']),/**
9288
+ */pick:new AsyncSeriesWaterfallHook(),/**
9367
9289
  * Unsafe but sync version of pick.
9368
- */pickSync:new SyncWaterfallHook(['result']),/**
9290
+ */pickSync:new SyncWaterfallHook(),/**
9369
9291
  * used in event system
9370
- */pointerDown:new SyncHook(['event']),pointerUp:new SyncHook(['event']),pointerMove:new SyncHook(['event']),pointerOut:new SyncHook(['event']),pointerOver:new SyncHook(['event']),pointerWheel:new SyncHook(['event']),pointerCancel:new SyncHook(['event']),click:new SyncHook(['event'])};this.globalRuntime=globalRuntime;this.context=context;}var _proto=RenderingService.prototype;_proto.init=/*#__PURE__*/function(){var _init=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var context;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:context=_extends({},this.globalRuntime,this.context);// register rendering plugins
9292
+ */pointerDown:new SyncHook(),pointerUp:new SyncHook(),pointerMove:new SyncHook(),pointerOut:new SyncHook(),pointerOver:new SyncHook(),pointerWheel:new SyncHook(),pointerCancel:new SyncHook(),click:new SyncHook()};this.globalRuntime=globalRuntime;this.context=context;}var _proto=RenderingService.prototype;_proto.init=/*#__PURE__*/function(){var _init=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var context;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:context=_extends({},this.globalRuntime,this.context);// register rendering plugins
9371
9293
  this.context.renderingPlugins.forEach(function(plugin){plugin.apply(context,runtime);});// await this.hooks.init.callPromise();
9372
9294
  _context.next=4;return this.hooks.init.promise();case 4:this.inited=true;case 5:case"end":return _context.stop();}},_callee,this);}));function init(){return _init.apply(this,arguments);}return init;}();_proto.getStats=function getStats(){return this.stats;}/**
9373
9295
  * Meet the following conditions:
@@ -9657,32 +9579,32 @@
9657
9579
  * * `window.devicePixelRatio`
9658
9580
  *
9659
9581
  * prototype chains: Canvas(Window) -> EventTarget
9660
- */var Canvas=/*#__PURE__*/function(_EventTarget){_inheritsLoose(Canvas,_EventTarget);/**
9661
- * window.document
9662
- */ /**
9663
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry
9664
- */ /**
9665
- * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
9666
- */ /**
9667
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame
9668
- */ /**
9669
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio
9670
- */ /**
9671
- * whether the runtime supports PointerEvent?
9672
- * if not, the event system won't trigger pointer events like `pointerdown`
9673
- */ /**
9674
- * whether the runtime supports TouchEvent?
9675
- * if not, the event system won't trigger touch events like `touchstart`
9676
- */ /**
9677
- * is this native event a TouchEvent?
9678
- */ /**
9679
- * is this native event a MouseEvent?
9680
- */ /**
9681
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element
9682
- */ /**
9683
- * rAF in auto rendering
9684
- */function Canvas(config){var _this;_this=_EventTarget.call(this)||this;// create document
9685
- _this.document=void 0;_this.customElements=void 0;_this.requestAnimationFrame=void 0;_this.cancelAnimationFrame=void 0;_this.devicePixelRatio=void 0;_this.supportsPointerEvents=void 0;_this.supportsTouchEvents=void 0;_this.isTouchEvent=void 0;_this.isMouseEvent=void 0;_this.Element=DisplayObject;_this.frameId=void 0;_this.inited=false;_this.readyPromise=void 0;_this.resolveReadyPromise=void 0;_this.context={};_this.document=new Document();_this.document.defaultView=_assertThisInitialized(_this);// create registry of custom elements
9582
+ */var Canvas=/*#__PURE__*/function(_EventTarget){_inheritsLoose(Canvas,_EventTarget);function Canvas(config){var _this;_this=_EventTarget.call(this)||this;// create document
9583
+ /**
9584
+ * window.document
9585
+ */_this.document=void 0;/**
9586
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry
9587
+ */_this.customElements=void 0;/**
9588
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
9589
+ */_this.requestAnimationFrame=void 0;/**
9590
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame
9591
+ */_this.cancelAnimationFrame=void 0;/**
9592
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio
9593
+ */_this.devicePixelRatio=void 0;/**
9594
+ * whether the runtime supports PointerEvent?
9595
+ * if not, the event system won't trigger pointer events like `pointerdown`
9596
+ */_this.supportsPointerEvents=void 0;/**
9597
+ * whether the runtime supports TouchEvent?
9598
+ * if not, the event system won't trigger touch events like `touchstart`
9599
+ */_this.supportsTouchEvents=void 0;/**
9600
+ * is this native event a TouchEvent?
9601
+ */_this.isTouchEvent=void 0;/**
9602
+ * is this native event a MouseEvent?
9603
+ */_this.isMouseEvent=void 0;/**
9604
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element
9605
+ */_this.Element=DisplayObject;/**
9606
+ * rAF in auto rendering
9607
+ */_this.frameId=void 0;_this.inited=false;_this.readyPromise=void 0;_this.resolveReadyPromise=void 0;_this.context={};_this.document=new Document();_this.document.defaultView=_assertThisInitialized(_this);// create registry of custom elements
9686
9608
  _this.customElements=new CustomElementRegistry();var container=config.container,canvas=config.canvas,offscreenCanvas=config.offscreenCanvas,width=config.width,height=config.height,devicePixelRatio=config.devicePixelRatio,renderer=config.renderer,background=config.background,cursor=config.cursor,document=config.document,requestAnimationFrame=config.requestAnimationFrame,cancelAnimationFrame=config.cancelAnimationFrame,createImage=config.createImage,supportsPointerEvents=config.supportsPointerEvents,supportsTouchEvents=config.supportsTouchEvents,supportsCSSTransform=config.supportsCSSTransform,useNativeClickEvent=config.useNativeClickEvent,isTouchEvent=config.isTouchEvent,isMouseEvent=config.isMouseEvent;cleanExistedCanvas(container,_assertThisInitialized(_this));var canvasWidth=width;var canvasHeight=height;var dpr=devicePixelRatio;// use user-defined <canvas> or OffscreenCanvas
9687
9609
  if(canvas){// infer width & height with dpr
9688
9610
  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;}/**
@@ -10013,1197 +9935,6 @@
10013
9935
  }(Camera);
10014
9936
  runtime.CameraContribution = AdvancedCamera;
10015
9937
 
10016
- // export const ContextNode = Syringe.defineToken('');
10017
- var FragmentResult = function FragmentResult(_layoutContext, _node, options) {
10018
- this._layoutContext = void 0;
10019
- this._node = void 0;
10020
- this.options = void 0;
10021
- this.layoutContext = void 0;
10022
- this.inlineSize = void 0;
10023
- this.blockSize = void 0;
10024
- this.node = void 0;
10025
- this.childFragments = void 0;
10026
- this.data = void 0;
10027
- this._layoutContext = _layoutContext;
10028
- this._node = _node;
10029
- this.options = options;
10030
- this.layoutContext = _layoutContext;
10031
- this.inlineSize = options === null || options === void 0 ? void 0 : options.inlineSize;
10032
- this.blockSize = options === null || options === void 0 ? void 0 : options.blockSize;
10033
- this.childFragments = options === null || options === void 0 ? void 0 : options.childFragments;
10034
- this.data = options.data;
10035
- this.node = _node;
10036
- };
10037
-
10038
- (function (LayoutTaskType) {
10039
- LayoutTaskType["Layout"] = "layout";
10040
- LayoutTaskType["IntrinsicSizes"] = "intrinsic-sizes";
10041
- })(exports.LayoutTaskType || (exports.LayoutTaskType = {}));
10042
- var ChildDisplayType;
10043
- (function (ChildDisplayType) {
10044
- ChildDisplayType[ChildDisplayType["block"] = 0] = "block";
10045
- ChildDisplayType[ChildDisplayType["normal"] = 1] = "normal";
10046
- })(ChildDisplayType || (ChildDisplayType = {}));
10047
- var LayoutSizingMode;
10048
- (function (LayoutSizingMode) {
10049
- LayoutSizingMode[LayoutSizingMode["block-like"] = 0] = "block-like";
10050
- LayoutSizingMode[LayoutSizingMode["manual"] = 1] = "manual";
10051
- })(LayoutSizingMode || (LayoutSizingMode = {}));
10052
-
10053
- (function (PropertyName) {
10054
- PropertyName["LAYOUT"] = "display";
10055
- PropertyName["LEFT"] = "left";
10056
- PropertyName["TOP"] = "top";
10057
- PropertyName["BOTTOM"] = "bottom";
10058
- PropertyName["RIGHT"] = "right";
10059
- PropertyName["WIDTH"] = "width";
10060
- PropertyName["HEIGHT"] = "height";
10061
- PropertyName["MIN_WIDTH"] = "minWidth";
10062
- PropertyName["MAX_WIDTH"] = "maxWidth";
10063
- PropertyName["MIN_HEIGHT"] = "minHeight";
10064
- PropertyName["MAX_HEIGHT"] = "maxHeight";
10065
- PropertyName["BOX_SIZING"] = "boxSizing";
10066
- PropertyName["PADDING"] = "padding";
10067
- PropertyName["PADDING_TOP"] = "paddingTop";
10068
- PropertyName["PADDING_BOTTOM"] = "paddingBottom";
10069
- PropertyName["PADDING_START"] = "paddingLeft";
10070
- PropertyName["PADDING_END"] = "paddingRight";
10071
- PropertyName["MARGIN"] = "margin";
10072
- PropertyName["MARGIN_TOP"] = "marginTop";
10073
- PropertyName["MARGIN_BOTTOM"] = "marginBottom";
10074
- PropertyName["MARGIN_START"] = "marginLeft";
10075
- PropertyName["MARGIN_END"] = "marginRight";
10076
- PropertyName["BORDER"] = "border";
10077
- PropertyName["BORDER_TOP"] = "borderTop";
10078
- PropertyName["BORDER_BOTTOM"] = "borderBottom";
10079
- PropertyName["BORDER_START"] = "borderLeft";
10080
- PropertyName["BORDER_END"] = "borderRight";
10081
- PropertyName["FLEX_DIRECTION"] = "flexDirection";
10082
- PropertyName["FLEX_WRAP"] = "flexWrap";
10083
- PropertyName["FLEX_FLOW"] = "flexFlow";
10084
- PropertyName["ALIGN_ITEMS"] = "alignItems";
10085
- PropertyName["ALIGN_CONTENT"] = "alignContent";
10086
- PropertyName["JUSTIFY_CONTENT"] = "justifyContent";
10087
- PropertyName["FLEX"] = "flex";
10088
- PropertyName["ALIGN_SELF"] = "alignSelf";
10089
- PropertyName["FLEX_SHRINK"] = "flexShrink";
10090
- PropertyName["FLEX_BASIS"] = "flexBasis";
10091
- PropertyName["FLEX_GROW"] = "flexGrow";
10092
- PropertyName["OFFSET_WIDTH"] = "offsetWidth";
10093
- PropertyName["OFFSET_HEIGHT"] = "offsetHeight";
10094
- PropertyName["ORDER"] = "order";
10095
- })(exports.PropertyName || (exports.PropertyName = {}));
10096
- function _regeneratorRuntime$1() {
10097
- _regeneratorRuntime$1 = function _regeneratorRuntime() {
10098
- return exports;
10099
- };
10100
- var exports = {},
10101
- Op = Object.prototype,
10102
- hasOwn = Op.hasOwnProperty,
10103
- defineProperty = Object.defineProperty || function (obj, key, desc) {
10104
- obj[key] = desc.value;
10105
- },
10106
- $Symbol = "function" == typeof Symbol ? Symbol : {},
10107
- iteratorSymbol = $Symbol.iterator || "@@iterator",
10108
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
10109
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
10110
- function define(obj, key, value) {
10111
- return Object.defineProperty(obj, key, {
10112
- value: value,
10113
- enumerable: !0,
10114
- configurable: !0,
10115
- writable: !0
10116
- }), obj[key];
10117
- }
10118
- try {
10119
- define({}, "");
10120
- } catch (err) {
10121
- define = function define(obj, key, value) {
10122
- return obj[key] = value;
10123
- };
10124
- }
10125
- function wrap(innerFn, outerFn, self, tryLocsList) {
10126
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
10127
- generator = Object.create(protoGenerator.prototype),
10128
- context = new Context(tryLocsList || []);
10129
- return defineProperty(generator, "_invoke", {
10130
- value: makeInvokeMethod(innerFn, self, context)
10131
- }), generator;
10132
- }
10133
- function tryCatch(fn, obj, arg) {
10134
- try {
10135
- return {
10136
- type: "normal",
10137
- arg: fn.call(obj, arg)
10138
- };
10139
- } catch (err) {
10140
- return {
10141
- type: "throw",
10142
- arg: err
10143
- };
10144
- }
10145
- }
10146
- exports.wrap = wrap;
10147
- var ContinueSentinel = {};
10148
- function Generator() {}
10149
- function GeneratorFunction() {}
10150
- function GeneratorFunctionPrototype() {}
10151
- var IteratorPrototype = {};
10152
- define(IteratorPrototype, iteratorSymbol, function () {
10153
- return this;
10154
- });
10155
- var getProto = Object.getPrototypeOf,
10156
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
10157
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
10158
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
10159
- function defineIteratorMethods(prototype) {
10160
- ["next", "throw", "return"].forEach(function (method) {
10161
- define(prototype, method, function (arg) {
10162
- return this._invoke(method, arg);
10163
- });
10164
- });
10165
- }
10166
- function AsyncIterator(generator, PromiseImpl) {
10167
- function invoke(method, arg, resolve, reject) {
10168
- var record = tryCatch(generator[method], generator, arg);
10169
- if ("throw" !== record.type) {
10170
- var result = record.arg,
10171
- value = result.value;
10172
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
10173
- invoke("next", value, resolve, reject);
10174
- }, function (err) {
10175
- invoke("throw", err, resolve, reject);
10176
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
10177
- result.value = unwrapped, resolve(result);
10178
- }, function (error) {
10179
- return invoke("throw", error, resolve, reject);
10180
- });
10181
- }
10182
- reject(record.arg);
10183
- }
10184
- var previousPromise;
10185
- defineProperty(this, "_invoke", {
10186
- value: function value(method, arg) {
10187
- function callInvokeWithMethodAndArg() {
10188
- return new PromiseImpl(function (resolve, reject) {
10189
- invoke(method, arg, resolve, reject);
10190
- });
10191
- }
10192
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
10193
- }
10194
- });
10195
- }
10196
- function makeInvokeMethod(innerFn, self, context) {
10197
- var state = "suspendedStart";
10198
- return function (method, arg) {
10199
- if ("executing" === state) throw new Error("Generator is already running");
10200
- if ("completed" === state) {
10201
- if ("throw" === method) throw arg;
10202
- return doneResult();
10203
- }
10204
- for (context.method = method, context.arg = arg;;) {
10205
- var delegate = context.delegate;
10206
- if (delegate) {
10207
- var delegateResult = maybeInvokeDelegate(delegate, context);
10208
- if (delegateResult) {
10209
- if (delegateResult === ContinueSentinel) continue;
10210
- return delegateResult;
10211
- }
10212
- }
10213
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
10214
- if ("suspendedStart" === state) throw state = "completed", context.arg;
10215
- context.dispatchException(context.arg);
10216
- } else "return" === context.method && context.abrupt("return", context.arg);
10217
- state = "executing";
10218
- var record = tryCatch(innerFn, self, context);
10219
- if ("normal" === record.type) {
10220
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
10221
- return {
10222
- value: record.arg,
10223
- done: context.done
10224
- };
10225
- }
10226
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
10227
- }
10228
- };
10229
- }
10230
- function maybeInvokeDelegate(delegate, context) {
10231
- var methodName = context.method,
10232
- method = delegate.iterator[methodName];
10233
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
10234
- var record = tryCatch(method, delegate.iterator, context.arg);
10235
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
10236
- var info = record.arg;
10237
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
10238
- }
10239
- function pushTryEntry(locs) {
10240
- var entry = {
10241
- tryLoc: locs[0]
10242
- };
10243
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
10244
- }
10245
- function resetTryEntry(entry) {
10246
- var record = entry.completion || {};
10247
- record.type = "normal", delete record.arg, entry.completion = record;
10248
- }
10249
- function Context(tryLocsList) {
10250
- this.tryEntries = [{
10251
- tryLoc: "root"
10252
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
10253
- }
10254
- function values(iterable) {
10255
- if (iterable) {
10256
- var iteratorMethod = iterable[iteratorSymbol];
10257
- if (iteratorMethod) return iteratorMethod.call(iterable);
10258
- if ("function" == typeof iterable.next) return iterable;
10259
- if (!isNaN(iterable.length)) {
10260
- var i = -1,
10261
- next = function next() {
10262
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
10263
- return next.value = undefined, next.done = !0, next;
10264
- };
10265
- return next.next = next;
10266
- }
10267
- }
10268
- return {
10269
- next: doneResult
10270
- };
10271
- }
10272
- function doneResult() {
10273
- return {
10274
- value: undefined,
10275
- done: !0
10276
- };
10277
- }
10278
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
10279
- value: GeneratorFunctionPrototype,
10280
- configurable: !0
10281
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
10282
- value: GeneratorFunction,
10283
- configurable: !0
10284
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
10285
- var ctor = "function" == typeof genFun && genFun.constructor;
10286
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
10287
- }, exports.mark = function (genFun) {
10288
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
10289
- }, exports.awrap = function (arg) {
10290
- return {
10291
- __await: arg
10292
- };
10293
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
10294
- return this;
10295
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
10296
- void 0 === PromiseImpl && (PromiseImpl = Promise);
10297
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
10298
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
10299
- return result.done ? result.value : iter.next();
10300
- });
10301
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
10302
- return this;
10303
- }), define(Gp, "toString", function () {
10304
- return "[object Generator]";
10305
- }), exports.keys = function (val) {
10306
- var object = Object(val),
10307
- keys = [];
10308
- for (var key in object) keys.push(key);
10309
- return keys.reverse(), function next() {
10310
- for (; keys.length;) {
10311
- var key = keys.pop();
10312
- if (key in object) return next.value = key, next.done = !1, next;
10313
- }
10314
- return next.done = !0, next;
10315
- };
10316
- }, exports.values = values, Context.prototype = {
10317
- constructor: Context,
10318
- reset: function reset(skipTempReset) {
10319
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
10320
- },
10321
- stop: function stop() {
10322
- this.done = !0;
10323
- var rootRecord = this.tryEntries[0].completion;
10324
- if ("throw" === rootRecord.type) throw rootRecord.arg;
10325
- return this.rval;
10326
- },
10327
- dispatchException: function dispatchException(exception) {
10328
- if (this.done) throw exception;
10329
- var context = this;
10330
- function handle(loc, caught) {
10331
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
10332
- }
10333
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
10334
- var entry = this.tryEntries[i],
10335
- record = entry.completion;
10336
- if ("root" === entry.tryLoc) return handle("end");
10337
- if (entry.tryLoc <= this.prev) {
10338
- var hasCatch = hasOwn.call(entry, "catchLoc"),
10339
- hasFinally = hasOwn.call(entry, "finallyLoc");
10340
- if (hasCatch && hasFinally) {
10341
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
10342
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
10343
- } else if (hasCatch) {
10344
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
10345
- } else {
10346
- if (!hasFinally) throw new Error("try statement without catch or finally");
10347
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
10348
- }
10349
- }
10350
- }
10351
- },
10352
- abrupt: function abrupt(type, arg) {
10353
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
10354
- var entry = this.tryEntries[i];
10355
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
10356
- var finallyEntry = entry;
10357
- break;
10358
- }
10359
- }
10360
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
10361
- var record = finallyEntry ? finallyEntry.completion : {};
10362
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
10363
- },
10364
- complete: function complete(record, afterLoc) {
10365
- if ("throw" === record.type) throw record.arg;
10366
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
10367
- },
10368
- finish: function finish(finallyLoc) {
10369
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
10370
- var entry = this.tryEntries[i];
10371
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
10372
- }
10373
- },
10374
- catch: function _catch(tryLoc) {
10375
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
10376
- var entry = this.tryEntries[i];
10377
- if (entry.tryLoc === tryLoc) {
10378
- var record = entry.completion;
10379
- if ("throw" === record.type) {
10380
- var thrown = record.arg;
10381
- resetTryEntry(entry);
10382
- }
10383
- return thrown;
10384
- }
10385
- }
10386
- throw new Error("illegal catch attempt");
10387
- },
10388
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
10389
- return this.delegate = {
10390
- iterator: values(iterable),
10391
- resultName: resultName,
10392
- nextLoc: nextLoc
10393
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
10394
- }
10395
- }, exports;
10396
- }
10397
- function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
10398
- try {
10399
- var info = gen[key](arg);
10400
- var value = info.value;
10401
- } catch (error) {
10402
- reject(error);
10403
- return;
10404
- }
10405
- if (info.done) {
10406
- resolve(value);
10407
- } else {
10408
- Promise.resolve(value).then(_next, _throw);
10409
- }
10410
- }
10411
- function _asyncToGenerator$1(fn) {
10412
- return function () {
10413
- var self = this,
10414
- args = arguments;
10415
- return new Promise(function (resolve, reject) {
10416
- var gen = fn.apply(self, args);
10417
- function _next(value) {
10418
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
10419
- }
10420
- function _throw(err) {
10421
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
10422
- }
10423
- _next(undefined);
10424
- });
10425
- };
10426
- }
10427
- function _defineProperties$1(target, props) {
10428
- for (var i = 0; i < props.length; i++) {
10429
- var descriptor = props[i];
10430
- descriptor.enumerable = descriptor.enumerable || false;
10431
- descriptor.configurable = true;
10432
- if ("value" in descriptor) descriptor.writable = true;
10433
- Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
10434
- }
10435
- }
10436
- function _createClass$1(Constructor, protoProps, staticProps) {
10437
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
10438
- if (staticProps) _defineProperties$1(Constructor, staticProps);
10439
- Object.defineProperty(Constructor, "prototype", {
10440
- writable: false
10441
- });
10442
- return Constructor;
10443
- }
10444
- function _toPrimitive$1(input, hint) {
10445
- if (typeof input !== "object" || input === null) return input;
10446
- var prim = input[Symbol.toPrimitive];
10447
- if (prim !== undefined) {
10448
- var res = prim.call(input, hint || "default");
10449
- if (typeof res !== "object") return res;
10450
- throw new TypeError("@@toPrimitive must return a primitive value.");
10451
- }
10452
- return (hint === "string" ? String : Number)(input);
10453
- }
10454
- function _toPropertyKey$1(arg) {
10455
- var key = _toPrimitive$1(arg, "string");
10456
- return typeof key === "symbol" ? key : String(key);
10457
- }
10458
-
10459
- /**
10460
- * This function allow you to modify a JS Promise by adding some status properties.
10461
- * Based on: http://stackoverflow.com/questions/21485545/is-there-a-way-to-tell-if-an-es6-promise-is-fulfilled-rejected-resolved
10462
- * But modified according to the specs of promises : https://promisesaplus.com/
10463
- */
10464
- var makeQuerablePromise = function makeQuerablePromise(promise) {
10465
- // Don't modify any promise that has been already modified.
10466
- if (promise.isRejected || promise.isFulfilled) return promise;
10467
- // Set initial state
10468
- var isPending = true;
10469
- var isRejected = false;
10470
- var isFulfilled = false;
10471
- var fullFilledValue;
10472
- // Observe the promise, saving the fulfillment in a closure scope.
10473
- var result = promise.then(function (v) {
10474
- isFulfilled = true;
10475
- isPending = false;
10476
- fullFilledValue = v;
10477
- return v;
10478
- }, function (e) {
10479
- isRejected = true;
10480
- isPending = false;
10481
- throw e;
10482
- });
10483
- result.isFulfilled = function () {
10484
- return isFulfilled;
10485
- };
10486
- result.isPending = function () {
10487
- return isPending;
10488
- };
10489
- result.isRejected = function () {
10490
- return isRejected;
10491
- };
10492
- result.getFullFilledValue = function () {
10493
- return fullFilledValue;
10494
- };
10495
- return result;
10496
- };
10497
- /**
10498
- * Simple implementation of the deferred pattern.
10499
- * An object that exposes a promise and functions to resolve and reject it.
10500
- */
10501
- var Deferred = function Deferred() {
10502
- var _this = this;
10503
- this.resolve = void 0;
10504
- this.reject = void 0;
10505
- this.promise = new Promise(function (resolve, reject) {
10506
- _this.resolve = resolve;
10507
- _this.reject = reject;
10508
- });
10509
- };
10510
- var LayoutChildren = /*#__PURE__*/function () {
10511
- function LayoutChildren(_layoutContext, options) {
10512
- this._layoutContext = void 0;
10513
- this.options = void 0;
10514
- this.node = void 0;
10515
- this.styleMap = void 0;
10516
- this.layoutContext = void 0;
10517
- this._layoutContext = _layoutContext;
10518
- this.options = options;
10519
- this.layoutContext = _layoutContext;
10520
- this.node = options.node;
10521
- this.styleMap = options.node.getAllStyle();
10522
- }
10523
- var _proto = LayoutChildren.prototype;
10524
- _proto.intrinsicSizes = function intrinsicSizes() {
10525
- // if (this.contextId !== this.layoutContext.contextId) {
10526
- // throw new Error('Invalid State: wrong layout context');
10527
- // }
10528
- var deferred = new Deferred();
10529
- this.layoutContext.appendWorkTask({
10530
- layoutChild: this,
10531
- taskType: exports.LayoutTaskType.IntrinsicSizes,
10532
- deferred: deferred
10533
- });
10534
- return deferred.promise;
10535
- };
10536
- _proto.layoutNextFragment = function layoutNextFragment(constraints) {
10537
- // if (this.layoutContext.contextId !== this.layoutContext.contextId) {
10538
- // throw new Error('Invalid State: wrong layout context');
10539
- // }
10540
- if (this.layoutContext.mode === exports.LayoutTaskType.IntrinsicSizes) {
10541
- throw new Error('Not Supported: cant call layoutNextFragment in intrinsicSizes');
10542
- }
10543
- var deferred = new Deferred();
10544
- this.layoutContext.appendWorkTask({
10545
- layoutConstraints: constraints,
10546
- layoutChild: this,
10547
- taskType: exports.LayoutTaskType.Layout,
10548
- deferred: deferred
10549
- });
10550
- return deferred.promise;
10551
- };
10552
- return LayoutChildren;
10553
- }();
10554
- var guid = 0;
10555
- /**
10556
- * 每次layout 有单独的 context
10557
- */
10558
- var LayoutContext = /*#__PURE__*/function () {
10559
- function LayoutContext(options) {
10560
- this.options = void 0;
10561
- this.contextId = void 0;
10562
- this.workQueue = [];
10563
- this.mode = void 0;
10564
- this.layoutChildrenFactory = void 0;
10565
- this.fragmentResultFactory = void 0;
10566
- this.layoutFragmentFactory = void 0;
10567
- this.options = options;
10568
- this.contextId = "" + guid++;
10569
- this.mode = options.mode;
10570
- this.layoutChildrenFactory = options.layoutChildrenFactory;
10571
- this.fragmentResultFactory = options.fragmentResultFactory;
10572
- this.layoutFragmentFactory = options.layoutFragmentFactory;
10573
- }
10574
- var _proto = LayoutContext.prototype;
10575
- _proto.appendWorkTask = function appendWorkTask(work) {
10576
- this.workQueue.push(work);
10577
- };
10578
- _proto.clearWorkQueue = function clearWorkQueue() {
10579
- this.workQueue = [];
10580
- };
10581
- return LayoutContext;
10582
- }();
10583
- var AbstractLayoutDefinition = function AbstractLayoutDefinition() {};
10584
- AbstractLayoutDefinition.inputProperties = void 0;
10585
- AbstractLayoutDefinition.childrenInputProperties = void 0;
10586
- AbstractLayoutDefinition.layoutOptions = void 0;
10587
- var SCROLLBAR_SIZES = [0, 0, 0, 0];
10588
- /**
10589
- * https://drafts.css-houdini.org/css-layout-api/#layoutedges
10590
- * the size of border, scrollbar, padding
10591
- */
10592
- var LayoutEdges =
10593
- // Convenience attributes for the sum in one direction.
10594
-
10595
- function LayoutEdges(options) {
10596
- var _styleMap$get$value, _styleMap$get, _styleMap$get$value2, _styleMap$get2, _styleMap$get$value3, _styleMap$get3, _styleMap$get$value4, _styleMap$get4, _styleMap$get$value5, _styleMap$get5, _styleMap$get$value6, _styleMap$get6, _styleMap$get$value7, _styleMap$get7, _styleMap$get$value8, _styleMap$get8;
10597
- this.options = void 0;
10598
- this.inlineStart = void 0;
10599
- this.inlineEnd = void 0;
10600
- this.blockStart = void 0;
10601
- this.blockEnd = void 0;
10602
- this.inline = void 0;
10603
- this.block = void 0;
10604
- this.options = options;
10605
- var node = options.node;
10606
- var styleMap = node.getAllStyle();
10607
- var borderTopWidth = (_styleMap$get$value = (_styleMap$get = styleMap.get(exports.PropertyName.PADDING_TOP)) === null || _styleMap$get === void 0 ? void 0 : _styleMap$get.value) !== null && _styleMap$get$value !== void 0 ? _styleMap$get$value : 0;
10608
- var borderRightWidth = (_styleMap$get$value2 = (_styleMap$get2 = styleMap.get(exports.PropertyName.PADDING_END)) === null || _styleMap$get2 === void 0 ? void 0 : _styleMap$get2.value) !== null && _styleMap$get$value2 !== void 0 ? _styleMap$get$value2 : 0;
10609
- var borderBottomWidth = (_styleMap$get$value3 = (_styleMap$get3 = styleMap.get(exports.PropertyName.PADDING_BOTTOM)) === null || _styleMap$get3 === void 0 ? void 0 : _styleMap$get3.value) !== null && _styleMap$get$value3 !== void 0 ? _styleMap$get$value3 : 0;
10610
- var borderLeftWidth = (_styleMap$get$value4 = (_styleMap$get4 = styleMap.get(exports.PropertyName.PADDING_START)) === null || _styleMap$get4 === void 0 ? void 0 : _styleMap$get4.value) !== null && _styleMap$get$value4 !== void 0 ? _styleMap$get$value4 : 0;
10611
- var paddingTopWidth = (_styleMap$get$value5 = (_styleMap$get5 = styleMap.get(exports.PropertyName.PADDING_TOP)) === null || _styleMap$get5 === void 0 ? void 0 : _styleMap$get5.value) !== null && _styleMap$get$value5 !== void 0 ? _styleMap$get$value5 : 0;
10612
- var paddingRightWidth = (_styleMap$get$value6 = (_styleMap$get6 = styleMap.get(exports.PropertyName.PADDING_END)) === null || _styleMap$get6 === void 0 ? void 0 : _styleMap$get6.value) !== null && _styleMap$get$value6 !== void 0 ? _styleMap$get$value6 : 0;
10613
- var paddingBottomWidth = (_styleMap$get$value7 = (_styleMap$get7 = styleMap.get(exports.PropertyName.PADDING_BOTTOM)) === null || _styleMap$get7 === void 0 ? void 0 : _styleMap$get7.value) !== null && _styleMap$get$value7 !== void 0 ? _styleMap$get$value7 : 0;
10614
- var paddingLeftWidth = (_styleMap$get$value8 = (_styleMap$get8 = styleMap.get(exports.PropertyName.PADDING_START)) === null || _styleMap$get8 === void 0 ? void 0 : _styleMap$get8.value) !== null && _styleMap$get$value8 !== void 0 ? _styleMap$get$value8 : 0;
10615
- this.blockStart = borderTopWidth + SCROLLBAR_SIZES[0] + paddingTopWidth;
10616
- this.inlineStart = borderRightWidth + SCROLLBAR_SIZES[1] + paddingRightWidth;
10617
- this.blockEnd = borderBottomWidth + SCROLLBAR_SIZES[2] + paddingBottomWidth;
10618
- this.inlineEnd = borderLeftWidth + SCROLLBAR_SIZES[3] + paddingLeftWidth;
10619
- this.block = this.blockStart + this.blockEnd;
10620
- this.inline = this.inlineStart + this.inlineEnd;
10621
- };
10622
- var delay = function delay(minisecond) {
10623
- if (minisecond === void 0) {
10624
- minisecond = 0;
10625
- }
10626
- return new Promise(function (resolve) {
10627
- setTimeout(function () {
10628
- resolve();
10629
- }, minisecond);
10630
- });
10631
- };
10632
- var LayoutEngine = /*#__PURE__*/function () {
10633
- function LayoutEngine(_layoutRegistry, _layoutContextFactory, _layoutEdgesFactory) {
10634
- this._layoutRegistry = void 0;
10635
- this._layoutContextFactory = void 0;
10636
- this._layoutEdgesFactory = void 0;
10637
- this.layoutRegistry = void 0;
10638
- this.layoutContextFactory = void 0;
10639
- this.layoutEdgesFactory = void 0;
10640
- this._layoutRegistry = _layoutRegistry;
10641
- this._layoutContextFactory = _layoutContextFactory;
10642
- this._layoutEdgesFactory = _layoutEdgesFactory;
10643
- this.layoutRegistry = _layoutRegistry;
10644
- this.layoutContextFactory = _layoutContextFactory;
10645
- this.layoutEdgesFactory = _layoutEdgesFactory;
10646
- // layoutContributions.getContributions().forEach((layoutContrib) => {
10647
- // layoutContrib.registerLayout(_layoutRegistry);
10648
- // });
10649
- }
10650
- /**
10651
- * This function takes the root of the box-tree, a LayoutConstraints object, and compute the position of every node in the tree
10652
- * @param rootNode root node of the layout object tree
10653
- * @param rootPageConstraints layout constraints
10654
- * @returns
10655
- */
10656
- var _proto = LayoutEngine.prototype;
10657
- _proto.computeLayout = /*#__PURE__*/
10658
- function () {
10659
- var _computeLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee(rootNode, rootPageConstraints) {
10660
- return _regeneratorRuntime$1().wrap(function _callee$(_context) {
10661
- while (1) switch (_context.prev = _context.next) {
10662
- case 0:
10663
- _context.next = 2;
10664
- return this.determineIntrinsicSizes(rootNode, rootNode.children);
10665
- case 2:
10666
- _context.next = 4;
10667
- return this.calculateLayout(rootNode, rootNode.children, rootPageConstraints);
10668
- case 4:
10669
- case "end":
10670
- return _context.stop();
10671
- }
10672
- }, _callee, this);
10673
- }));
10674
- function computeLayout(_x, _x2) {
10675
- return _computeLayout.apply(this, arguments);
10676
- }
10677
- return computeLayout;
10678
- }()
10679
- /**
10680
- * calculate intrinsicSize of node tree, use depth dirst / post order traversal
10681
- * @param rootNode
10682
- */;
10683
-
10684
- _proto.determineAllIntrinsicSizes = /*#__PURE__*/
10685
- function () {
10686
- var _determineAllIntrinsicSizes = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2(rootNode) {
10687
- return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
10688
- while (1) switch (_context2.prev = _context2.next) {
10689
- case 0:
10690
- case "end":
10691
- return _context2.stop();
10692
- }
10693
- }, _callee2);
10694
- }));
10695
- function determineAllIntrinsicSizes(_x3) {
10696
- return _determineAllIntrinsicSizes.apply(this, arguments);
10697
- }
10698
- return determineAllIntrinsicSizes;
10699
- }();
10700
- _proto.getLayoutDefinitionName = function getLayoutDefinitionName(node) {
10701
- var layoutStyle = node.getAllStyle().get(exports.PropertyName.LAYOUT);
10702
- if (!layoutStyle) {
10703
- throw new Error('layout property not found');
10704
- }
10705
- return layoutStyle.value;
10706
- }
10707
- /**
10708
- * calculate the min/max content size of node
10709
- * @param node current layout object
10710
- * @param childNodes children of the current node
10711
- */;
10712
- _proto.determineIntrinsicSizes = /*#__PURE__*/
10713
- function () {
10714
- var _determineIntrinsicSizes = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3(node, childNodes) {
10715
- var layoutName;
10716
- return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
10717
- while (1) switch (_context3.prev = _context3.next) {
10718
- case 0:
10719
- layoutName = this.getLayoutDefinitionName(node);
10720
- _context3.next = 3;
10721
- return this.invokeIntrinsicSizesCallback(layoutName, node, childNodes);
10722
- case 3:
10723
- case "end":
10724
- return _context3.stop();
10725
- }
10726
- }, _callee3, this);
10727
- }));
10728
- function determineIntrinsicSizes(_x4, _x5) {
10729
- return _determineIntrinsicSizes.apply(this, arguments);
10730
- }
10731
- return determineIntrinsicSizes;
10732
- }();
10733
- _proto.invokeIntrinsicSizesCallback = /*#__PURE__*/function () {
10734
- var _invokeIntrinsicSizesCallback = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4(layoutName, node, childNodes) {
10735
- var LayoutDef, layoutInstance, context, _LayoutDef$inputPrope, inputProperties, children, edges, styleMap, value, generator, intrinsicSizesValue;
10736
- return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
10737
- while (1) switch (_context4.prev = _context4.next) {
10738
- case 0:
10739
- LayoutDef = this.layoutRegistry.getLayout(layoutName);
10740
- layoutInstance = new LayoutDef();
10741
- context = this.layoutContextFactory({
10742
- mode: exports.LayoutTaskType.IntrinsicSizes
10743
- });
10744
- _LayoutDef$inputPrope = LayoutDef.inputProperties, inputProperties = _LayoutDef$inputPrope === void 0 ? [] : _LayoutDef$inputPrope;
10745
- children = [];
10746
- childNodes.forEach(function (childNode) {
10747
- var layoutChild = context.layoutChildrenFactory({
10748
- node: childNode
10749
- });
10750
- children.push(layoutChild);
10751
- });
10752
- edges = this.layoutEdgesFactory({
10753
- node: node
10754
- });
10755
- styleMap = node.getStyle.apply(node, inputProperties); // TODO compare to cache ( children edges styleMap )
10756
- value = layoutInstance.intrinsicSizes(children, edges, styleMap);
10757
- generator = this.runWorkQueue(value, context.workQueue);
10758
- generator.next();
10759
- _context4.next = 13;
10760
- return delay();
10761
- case 13:
10762
- intrinsicSizesValue = generator.next().value;
10763
- context.clearWorkQueue();
10764
- node.setIntrisicSizes(intrinsicSizesValue);
10765
- case 16:
10766
- case "end":
10767
- return _context4.stop();
10768
- }
10769
- }, _callee4, this);
10770
- }));
10771
- function invokeIntrinsicSizesCallback(_x6, _x7, _x8) {
10772
- return _invokeIntrinsicSizesCallback.apply(this, arguments);
10773
- }
10774
- return invokeIntrinsicSizesCallback;
10775
- }();
10776
- _proto.calculateLayout = /*#__PURE__*/function () {
10777
- var _calculateLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5(node, childNodes, layoutConstraints) {
10778
- var layoutName;
10779
- return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
10780
- while (1) switch (_context5.prev = _context5.next) {
10781
- case 0:
10782
- layoutName = this.getLayoutDefinitionName(node);
10783
- _context5.next = 3;
10784
- return this.invokeLayoutCallback(layoutName, node, childNodes, layoutConstraints);
10785
- case 3:
10786
- case "end":
10787
- return _context5.stop();
10788
- }
10789
- }, _callee5, this);
10790
- }));
10791
- function calculateLayout(_x9, _x10, _x11) {
10792
- return _calculateLayout.apply(this, arguments);
10793
- }
10794
- return calculateLayout;
10795
- }();
10796
- _proto.invokeLayoutCallback = /*#__PURE__*/function () {
10797
- var _invokeLayoutCallback = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee6(layoutName, node, childNodes, layoutConstraints) {
10798
- var LayoutDef, layoutInstance, context, _LayoutDef$inputPrope2, inputProperties, children, edges, styleMap, value, generator, fragmentResultvalue, fragmentResult, layoutFragment;
10799
- return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
10800
- while (1) switch (_context6.prev = _context6.next) {
10801
- case 0:
10802
- LayoutDef = this.layoutRegistry.getLayout(layoutName);
10803
- layoutInstance = new LayoutDef();
10804
- context = this.layoutContextFactory({
10805
- mode: exports.LayoutTaskType.Layout
10806
- });
10807
- _LayoutDef$inputPrope2 = LayoutDef.inputProperties, inputProperties = _LayoutDef$inputPrope2 === void 0 ? [] : _LayoutDef$inputPrope2;
10808
- children = [];
10809
- childNodes.forEach(function (childNode) {
10810
- var layoutChild = context.layoutChildrenFactory({
10811
- node: childNode
10812
- });
10813
- children.push(layoutChild);
10814
- });
10815
- edges = this.layoutEdgesFactory({
10816
- node: node
10817
- });
10818
- styleMap = node.getStyle.apply(node, inputProperties); // TODO compare to cache ( children styleMap layoutConstraints )
10819
- value = layoutInstance.layout(children, edges, layoutConstraints, styleMap);
10820
- generator = this.runWorkQueue(value, context.workQueue);
10821
- generator.next();
10822
- _context6.next = 13;
10823
- return delay();
10824
- case 13:
10825
- fragmentResultvalue = generator.next().value;
10826
- context.clearWorkQueue();
10827
- fragmentResult = fragmentResultvalue instanceof FragmentResult ? fragmentResultvalue : context.fragmentResultFactory(fragmentResultvalue);
10828
- layoutFragment = context.layoutFragmentFactory({
10829
- inlineSize: fragmentResult.inlineSize,
10830
- blockSize: fragmentResult.blockSize,
10831
- data: fragmentResult.data
10832
- });
10833
- node.setComputedLayout(layoutFragment);
10834
- childNodes.forEach(function (childNode, index) {
10835
- childNode.setComputedLayout(fragmentResult.childFragments[index]);
10836
- });
10837
- case 19:
10838
- case "end":
10839
- return _context6.stop();
10840
- }
10841
- }, _callee6, this);
10842
- }));
10843
- function invokeLayoutCallback(_x12, _x13, _x14, _x15) {
10844
- return _invokeLayoutCallback.apply(this, arguments);
10845
- }
10846
- return invokeLayoutCallback;
10847
- }();
10848
- _proto.runWorkQueue = /*#__PURE__*/_regeneratorRuntime$1().mark(function runWorkQueue(promise, workQueue) {
10849
- var _this = this;
10850
- var querablePromise;
10851
- return _regeneratorRuntime$1().wrap(function runWorkQueue$(_context7) {
10852
- while (1) switch (_context7.prev = _context7.next) {
10853
- case 0:
10854
- querablePromise = makeQuerablePromise(promise);
10855
- if (workQueue.length > 0 && querablePromise.isPending()) {
10856
- workQueue.forEach(function (workTask) {
10857
- if (workTask.taskType === exports.LayoutTaskType.IntrinsicSizes) {
10858
- var layoutChild = workTask.layoutChild,
10859
- deferred = workTask.deferred;
10860
- var node = layoutChild.node;
10861
- deferred.resolve(_this.getNodeIntrisicSizes(node));
10862
- }
10863
- if (workTask.taskType === exports.LayoutTaskType.Layout) {
10864
- var _layoutChild = workTask.layoutChild,
10865
- _deferred = workTask.deferred,
10866
- layoutConstraints = workTask.layoutConstraints;
10867
- var _node = _layoutChild.node,
10868
- layoutContext = _layoutChild.layoutContext;
10869
- var fragment = _this.getNodeFragment(_node, layoutConstraints);
10870
- _deferred.resolve(layoutContext.layoutFragmentFactory(fragment));
10871
- }
10872
- });
10873
- }
10874
- // wait promise to resolve
10875
- _context7.next = 4;
10876
- return;
10877
- case 4:
10878
- if (querablePromise.isFulfilled()) {
10879
- _context7.next = 6;
10880
- break;
10881
- }
10882
- throw new Error('promise not fullfilled!');
10883
- case 6:
10884
- return _context7.abrupt("return", querablePromise.getFullFilledValue());
10885
- case 7:
10886
- case "end":
10887
- return _context7.stop();
10888
- }
10889
- }, runWorkQueue);
10890
- });
10891
- _proto.getNodeIntrisicSizes = function getNodeIntrisicSizes(node) {
10892
- var _styleMap$get, _node$intrisicSizes, _styleMap$get2, _styleMap$get3, _node$intrisicSizes2, _styleMap$get4, _styleMap$get5, _node$intrisicSizes3, _styleMap$get6, _styleMap$get7, _node$intrisicSizes4, _styleMap$get8;
10893
- // calculate from border box, depend on writing mode of current layout
10894
- var styleMap = node.getAllStyle();
10895
- var minWidth = ((_styleMap$get = styleMap.get(exports.PropertyName.MIN_WIDTH)) === null || _styleMap$get === void 0 ? void 0 : _styleMap$get.value) || ((_node$intrisicSizes = node.intrisicSizes) === null || _node$intrisicSizes === void 0 ? void 0 : _node$intrisicSizes.minContentInlineSize) || ((_styleMap$get2 = styleMap.get(exports.PropertyName.WIDTH)) === null || _styleMap$get2 === void 0 ? void 0 : _styleMap$get2.value) || 0;
10896
- var maxWidth = ((_styleMap$get3 = styleMap.get(exports.PropertyName.MAX_WIDTH)) === null || _styleMap$get3 === void 0 ? void 0 : _styleMap$get3.value) || ((_node$intrisicSizes2 = node.intrisicSizes) === null || _node$intrisicSizes2 === void 0 ? void 0 : _node$intrisicSizes2.maxContentInlineSize) || ((_styleMap$get4 = styleMap.get(exports.PropertyName.WIDTH)) === null || _styleMap$get4 === void 0 ? void 0 : _styleMap$get4.value) || 0;
10897
- var minHeight = ((_styleMap$get5 = styleMap.get(exports.PropertyName.MIN_HEIGHT)) === null || _styleMap$get5 === void 0 ? void 0 : _styleMap$get5.value) || ((_node$intrisicSizes3 = node.intrisicSizes) === null || _node$intrisicSizes3 === void 0 ? void 0 : _node$intrisicSizes3.minContentBlockSize) || ((_styleMap$get6 = styleMap.get(exports.PropertyName.HEIGHT)) === null || _styleMap$get6 === void 0 ? void 0 : _styleMap$get6.value) || 0;
10898
- var maxHeight = ((_styleMap$get7 = styleMap.get(exports.PropertyName.MAX_HEIGHT)) === null || _styleMap$get7 === void 0 ? void 0 : _styleMap$get7.value) || ((_node$intrisicSizes4 = node.intrisicSizes) === null || _node$intrisicSizes4 === void 0 ? void 0 : _node$intrisicSizes4.maxContentBlockSize) || ((_styleMap$get8 = styleMap.get(exports.PropertyName.HEIGHT)) === null || _styleMap$get8 === void 0 ? void 0 : _styleMap$get8.value) || 0;
10899
- return {
10900
- minContentInlineSize: minWidth,
10901
- maxContentInlineSize: maxWidth,
10902
- minContentBlockSize: minHeight,
10903
- maxContentBlockSize: maxHeight
10904
- };
10905
- };
10906
- _proto.getNodeFragment = function getNodeFragment(node, constraints) {
10907
- var _node$getComputedLayo, _node$getAllStyle$get, _node$getAllStyle$get2, _node$getComputedLayo2, _node$getAllStyle$get3, _node$getAllStyle$get4;
10908
- // TODO
10909
- var width = ((_node$getComputedLayo = node.getComputedLayout()) === null || _node$getComputedLayo === void 0 ? void 0 : _node$getComputedLayo.inlineSize) || ((_node$getAllStyle$get = node.getAllStyle().get(exports.PropertyName.MIN_WIDTH)) === null || _node$getAllStyle$get === void 0 ? void 0 : _node$getAllStyle$get.value) || ((_node$getAllStyle$get2 = node.getAllStyle().get(exports.PropertyName.WIDTH)) === null || _node$getAllStyle$get2 === void 0 ? void 0 : _node$getAllStyle$get2.value) || 0;
10910
- var height = ((_node$getComputedLayo2 = node.getComputedLayout()) === null || _node$getComputedLayo2 === void 0 ? void 0 : _node$getComputedLayo2.blockSize) || ((_node$getAllStyle$get3 = node.getAllStyle().get(exports.PropertyName.MIN_HEIGHT)) === null || _node$getAllStyle$get3 === void 0 ? void 0 : _node$getAllStyle$get3.value) || ((_node$getAllStyle$get4 = node.getAllStyle().get(exports.PropertyName.HEIGHT)) === null || _node$getAllStyle$get4 === void 0 ? void 0 : _node$getAllStyle$get4.value) || 0;
10911
- return {
10912
- inlineSize: width,
10913
- blockSize: height,
10914
- data: constraints.data
10915
- };
10916
- };
10917
- return LayoutEngine;
10918
- }();
10919
-
10920
- /**
10921
- * 布局的结果
10922
- */
10923
- var LayoutFragment = function LayoutFragment(_layoutContext, options) {
10924
- this._layoutContext = void 0;
10925
- this.options = void 0;
10926
- this.layoutContext = void 0;
10927
- this.inlineSize = void 0;
10928
- this.blockSize = void 0;
10929
- this.inlineOffset = void 0;
10930
- this.blockOffset = void 0;
10931
- this.data = void 0;
10932
- this._layoutContext = _layoutContext;
10933
- this.options = options;
10934
- this.layoutContext = _layoutContext;
10935
- this.inlineSize = options.inlineSize;
10936
- this.blockSize = options.blockSize;
10937
- this.inlineOffset = 0;
10938
- this.blockOffset = 0;
10939
- this.data = options.data;
10940
- };
10941
- var id$1 = 1;
10942
- var LayoutObject = /*#__PURE__*/function () {
10943
- function LayoutObject(style) {
10944
- if (style === void 0) {
10945
- style = new Map();
10946
- }
10947
- this.id = void 0;
10948
- this.style = void 0;
10949
- this.dirty = void 0;
10950
- this.parent = void 0;
10951
- this.children = void 0;
10952
- this.internalIntrisicSizes = void 0;
10953
- this.computedLayout = void 0;
10954
- this.measureFn = void 0;
10955
- this.id = id$1++;
10956
- this.style = style;
10957
- this.parent = undefined;
10958
- this.children = [];
10959
- this.dirty = false;
10960
- }
10961
- /**
10962
- * set the intrinsic size of leaf node, different basic shape has different size, compsed shape has
10963
- * @param measure measure function
10964
- */
10965
- var _proto = LayoutObject.prototype;
10966
- _proto.setMeasure = function setMeasure(measure) {
10967
- this.measureFn = measure;
10968
- };
10969
- _proto.setIntrisicSizes = function setIntrisicSizes(intrisicSizes) {
10970
- this.internalIntrisicSizes = intrisicSizes;
10971
- };
10972
- _proto.addChild = function addChild(child) {
10973
- var _this$children;
10974
- (_this$children = this.children) === null || _this$children === void 0 ? void 0 : _this$children.push(child);
10975
- };
10976
- _proto.insertChild = function insertChild(index, child) {
10977
- this.children.splice(index, 0, child);
10978
- };
10979
- _proto.removeChild = function removeChild(child) {
10980
- var _this$children2;
10981
- var index = (_this$children2 = this.children) === null || _this$children2 === void 0 ? void 0 : _this$children2.findIndex(function (node) {
10982
- return node.id === child.id;
10983
- });
10984
- this.removeChildAtIndex(index);
10985
- };
10986
- _proto.removeChildAtIndex = function removeChildAtIndex(index) {
10987
- this.children.splice(index, 1);
10988
- };
10989
- _proto.replaceChildAtIndex = function replaceChildAtIndex(index, child) {
10990
- this.children.splice(index, 1, child);
10991
- };
10992
- _proto.setStyle = function setStyle(property, value) {
10993
- this.style.set(property, value);
10994
- }
10995
- // setStyles(styles: Record<StyleProperty, StyleInputValue>) {
10996
- // this.style = StylePropertyMap.create({ styles }).styles;
10997
- // }
10998
- ;
10999
-
11000
- _proto.getStyle = function getStyle() {
11001
- var _this = this;
11002
- var returnStyle = new Map();
11003
- for (var _len = arguments.length, properties = new Array(_len), _key = 0; _key < _len; _key++) {
11004
- properties[_key] = arguments[_key];
11005
- }
11006
- properties.forEach(function (prop) {
11007
- var propertyValue = _this.style.get(prop);
11008
- if (propertyValue) {
11009
- returnStyle.set(prop, propertyValue);
11010
- }
11011
- });
11012
- return returnStyle;
11013
- };
11014
- _proto.getAllStyle = function getAllStyle() {
11015
- return this.style;
11016
- };
11017
- _proto.markDirty = function markDirty() {
11018
- this.dirty = true;
11019
- };
11020
- _proto.idDirty = function idDirty() {
11021
- return this.dirty;
11022
- };
11023
- _proto.getSize = function getSize() {
11024
- var _this$style$get$value, _this$style$get, _this$style$get$value2, _this$style$get2;
11025
- var width = (_this$style$get$value = (_this$style$get = this.style.get(exports.PropertyName.WIDTH)) === null || _this$style$get === void 0 ? void 0 : _this$style$get.value) !== null && _this$style$get$value !== void 0 ? _this$style$get$value : 0;
11026
- var height = (_this$style$get$value2 = (_this$style$get2 = this.style.get(exports.PropertyName.HEIGHT)) === null || _this$style$get2 === void 0 ? void 0 : _this$style$get2.value) !== null && _this$style$get$value2 !== void 0 ? _this$style$get$value2 : 0;
11027
- return {
11028
- width: width,
11029
- height: height
11030
- };
11031
- };
11032
- _proto.computeLayout = /*#__PURE__*/function () {
11033
- var _computeLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
11034
- var size;
11035
- return _regeneratorRuntime$1().wrap(function _callee$(_context) {
11036
- while (1) switch (_context.prev = _context.next) {
11037
- case 0:
11038
- size = this.getSize();
11039
- _context.next = 3;
11040
- return layoutEngine.computeLayout(this, {
11041
- availableInlineSize: size.width,
11042
- availableBlockSize: size.height,
11043
- fixedInlineSize: size.width,
11044
- fixedBlockSize: size.height,
11045
- percentageInlineSize: size.width,
11046
- percentageBlockSize: size.height,
11047
- data: undefined
11048
- });
11049
- case 3:
11050
- case "end":
11051
- return _context.stop();
11052
- }
11053
- }, _callee, this);
11054
- }));
11055
- function computeLayout() {
11056
- return _computeLayout.apply(this, arguments);
11057
- }
11058
- return computeLayout;
11059
- }();
11060
- _proto.setComputedLayout = function setComputedLayout(computedLayout) {
11061
- this.computedLayout = computedLayout;
11062
- };
11063
- _proto.getComputedLayout = function getComputedLayout() {
11064
- return this.computedLayout;
11065
- };
11066
- _proto.getAllComputedLayout = function getAllComputedLayout() {};
11067
- _proto.toString = function toString() {
11068
- return "LayoutObject " + this.id;
11069
- };
11070
- _createClass$1(LayoutObject, [{
11071
- key: "intrisicSizes",
11072
- get: function get() {
11073
- return this.internalIntrisicSizes;
11074
- }
11075
- }, {
11076
- key: "childCount",
11077
- get: function get() {
11078
- return this.children.length;
11079
- }
11080
- }]);
11081
- return LayoutObject;
11082
- }();
11083
- var DefaultLayoutRegistry = /*#__PURE__*/function () {
11084
- function DefaultLayoutRegistry() {
11085
- this.registry = new Map();
11086
- }
11087
- var _proto = DefaultLayoutRegistry.prototype;
11088
- _proto.hasLayout = function hasLayout(name) {
11089
- return this.registry.has(name);
11090
- }
11091
- /**
11092
- *
11093
- * @param name layout name, default to 'absolute'
11094
- * @returns layout object
11095
- */;
11096
- _proto.getLayout = function getLayout(name) {
11097
- if (name === void 0) {
11098
- name = 'absolute';
11099
- }
11100
- if (!this.hasLayout(name)) {
11101
- throw new Error("invalid layout property: " + name);
11102
- }
11103
- return this.registry.get(name);
11104
- };
11105
- _proto.updateLayout = function updateLayout(name, layout) {
11106
- this.registry.set(name, layout);
11107
- };
11108
- _proto.registerLayout = function registerLayout(name, layout) {
11109
- if (name === '') {
11110
- throw new TypeError("layout name cant't be empty");
11111
- }
11112
- if (DefaultLayoutRegistry.reservedLayout.includes(name)) {
11113
- throw new Error("layout name '" + name + "' is a system reserved layout name, please use another name");
11114
- }
11115
- if (this.hasLayout(name)) {
11116
- throw new Error("layout '" + name + "' already exist.");
11117
- }
11118
- this.registry.set(name, layout);
11119
- };
11120
- _proto.deleteLayout = function deleteLayout(name) {
11121
- this.registry.delete(name);
11122
- };
11123
- _createClass$1(DefaultLayoutRegistry, [{
11124
- key: "size",
11125
- get: function get() {
11126
- return this.registry.size;
11127
- }
11128
- }]);
11129
- return DefaultLayoutRegistry;
11130
- }();
11131
- // 系统保留的布局名称,外部用户不能使用
11132
- // private static reservedLayout = ['relative', 'absolute', 'fixed', 'flex', 'dagre', 'autolayout'];
11133
- DefaultLayoutRegistry.reservedLayout = [];
11134
-
11135
- // import { LayoutEdges, LayoutEdgesOptions } from './LayoutEdges';
11136
- // const layoutRegistry = new DefaultLayoutRegistry();
11137
- // const layoutEdgesFactory = (options: LayoutEdgesOptions) => {
11138
- // return new LayoutEdges(options);
11139
- // };
11140
- // const layoutContextFactory = (options: LayoutEdgesOptions) => {
11141
- // // const layoutChildrenFactory = (childOptions: LayoutChildrenOptions) => {
11142
- // // return new LayoutChildren(childOptions);
11143
- // // };
11144
- // // container.register({
11145
- // // token: LayoutChildrenFactory,
11146
- // // useFactory: (childContext) => {
11147
- // // return (childOptions: LayoutChildrenOptions) => {
11148
- // // const childContainer = childContext.container.createChild();
11149
- // // childContainer.register({
11150
- // // token: LayoutChildrenOptions,
11151
- // // useValue: childOptions,
11152
- // // });
11153
- // // return childContainer.get(LayoutChildren);
11154
- // // };
11155
- // // },
11156
- // // });
11157
- // // container.register(FragmentResult);
11158
- // // container.register({
11159
- // // token: FragmentResultFactory,
11160
- // // useFactory: (childContext) => {
11161
- // // return (childOptions, node) => {
11162
- // // const childContainer = childContext.container.createChild();
11163
- // // childContainer.register({
11164
- // // token: FragmentResultOptions,
11165
- // // useValue: childOptions,
11166
- // // });
11167
- // // childContainer.register({
11168
- // // token: ContextNode,
11169
- // // useValue: node,
11170
- // // });
11171
- // // return childContainer.get(FragmentResult);
11172
- // // };
11173
- // // },
11174
- // // });
11175
- // // container.register(LayoutFragment);
11176
- // // container.register({
11177
- // // token: LayoutFragmentFactory,
11178
- // // useFactory: (childContext) => {
11179
- // // return (childOptions) => {
11180
- // // const childContainer = childContext.container.createChild();
11181
- // // childContainer.register({
11182
- // // token: LayoutFragmentOptions,
11183
- // // useValue: childOptions,
11184
- // // });
11185
- // // return childContainer.get(LayoutFragment);
11186
- // // };
11187
- // // },
11188
- // // });
11189
- // // const layoutChildrenFactory = container.get(LayoutChildrenFactory);
11190
- // // const layoutFragmentFactory = (childContext) => {
11191
- // // return (childOptions) => {
11192
- // // return new LayoutFragment(childOptions);
11193
- // // };
11194
- // // };
11195
- // // const fragmentResultFactory = container.get(FragmentResultFactory);
11196
- // // const layoutContext = new LayoutContext({
11197
- // // ...options,
11198
- // // layoutChildrenFactory,
11199
- // // layoutFragmentFactory,
11200
- // // fragmentResultFactory,
11201
- // // });
11202
- // // return layoutContext;
11203
- // }
11204
- // export const layoutEngine = new LayoutEngine(layoutRegistry);
11205
- var layoutEngine = null;
11206
-
11207
9938
  var MutationRecord = /*#__PURE__*/function () {
11208
9939
  MutationRecord.copy = function copy(original) {
11209
9940
  var record = new MutationRecord(original.type, original.target);
@@ -11600,18 +10331,18 @@
11600
10331
  if (anyNonEmpty) dispatchCallbacks();
11601
10332
  }
11602
10333
 
11603
- function _defineProperties$2(target, props) {
10334
+ function _defineProperties$1(target, props) {
11604
10335
  for (var i = 0; i < props.length; i++) {
11605
10336
  var descriptor = props[i];
11606
10337
  descriptor.enumerable = descriptor.enumerable || false;
11607
10338
  descriptor.configurable = true;
11608
10339
  if ("value" in descriptor) descriptor.writable = true;
11609
- Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
10340
+ Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
11610
10341
  }
11611
10342
  }
11612
- function _createClass$2(Constructor, protoProps, staticProps) {
11613
- if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
11614
- if (staticProps) _defineProperties$2(Constructor, staticProps);
10343
+ function _createClass$1(Constructor, protoProps, staticProps) {
10344
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
10345
+ if (staticProps) _defineProperties$1(Constructor, staticProps);
11615
10346
  Object.defineProperty(Constructor, "prototype", {
11616
10347
  writable: false
11617
10348
  });
@@ -11629,7 +10360,7 @@
11629
10360
  };
11630
10361
  return _setPrototypeOf$2(o, p);
11631
10362
  }
11632
- function _toPrimitive$2(input, hint) {
10363
+ function _toPrimitive$1(input, hint) {
11633
10364
  if (typeof input !== "object" || input === null) return input;
11634
10365
  var prim = input[Symbol.toPrimitive];
11635
10366
  if (prim !== undefined) {
@@ -11639,8 +10370,8 @@
11639
10370
  }
11640
10371
  return (hint === "string" ? String : Number)(input);
11641
10372
  }
11642
- function _toPropertyKey$2(arg) {
11643
- var key = _toPrimitive$2(arg, "string");
10373
+ function _toPropertyKey$1(arg) {
10374
+ var key = _toPrimitive$1(arg, "string");
11644
10375
  return typeof key === "symbol" ? key : String(key);
11645
10376
  }
11646
10377
 
@@ -11821,6 +10552,7 @@
11821
10552
  this.updatePromises();
11822
10553
  };
11823
10554
  _proto.cancel = function cancel() {
10555
+ var _this = this;
11824
10556
  this.updatePromises();
11825
10557
  if (!this._inEffect) return;
11826
10558
  this._inEffect = false;
@@ -11834,6 +10566,21 @@
11834
10566
  // needs to un-apply.
11835
10567
  this.timeline.applyDirtiedAnimation(this);
11836
10568
  this.updatePromises();
10569
+ /**
10570
+ * 1. Reject the current finished promise with a DOMException named "AbortError".
10571
+ * 2. Let current finished promise be a new promise
10572
+ * @see https://w3c.github.io/csswg-drafts/web-animations-1/#canceling-an-animation-section
10573
+ */
10574
+ if (this.finishedPromise) {
10575
+ this.rejectFinishedPromise();
10576
+ this.finishedPromise = undefined;
10577
+ }
10578
+ if (this.oncancel) {
10579
+ var event = new AnimationEvent(null, this, this.currentTime, null);
10580
+ setTimeout(function () {
10581
+ _this.oncancel(event);
10582
+ });
10583
+ }
11837
10584
  };
11838
10585
  _proto.reverse = function reverse() {
11839
10586
  this.updatePromises();
@@ -11935,14 +10682,14 @@
11935
10682
  }
11936
10683
  };
11937
10684
  _proto.fireEvents = function fireEvents(baseTime) {
11938
- var _this = this;
10685
+ var _this2 = this;
11939
10686
  if (this._isFinished) {
11940
10687
  if (!this._finishedFlag) {
11941
10688
  if (this.onfinish) {
11942
10689
  var event = new AnimationEvent(null, this, this.currentTime, baseTime);
11943
10690
  setTimeout(function () {
11944
- if (_this.onfinish) {
11945
- _this.onfinish(event);
10691
+ if (_this2.onfinish) {
10692
+ _this2.onfinish(event);
11946
10693
  }
11947
10694
  });
11948
10695
  }
@@ -11956,7 +10703,7 @@
11956
10703
  this._finishedFlag = false;
11957
10704
  }
11958
10705
  };
11959
- _createClass$2(Animation, [{
10706
+ _createClass$1(Animation, [{
11960
10707
  key: "pending",
11961
10708
  get:
11962
10709
  // animation: InternalAnimation | null;
@@ -11988,16 +10735,16 @@
11988
10735
  animation.play();
11989
10736
  */
11990
10737
  function get() {
11991
- var _this2 = this;
10738
+ var _this3 = this;
11992
10739
  if (!this.readyPromise) {
11993
10740
  if (this.timeline.animationsWithPromises.indexOf(this) === -1) {
11994
10741
  this.timeline.animationsWithPromises.push(this);
11995
10742
  }
11996
10743
  this.readyPromise = new Promise(function (resolve, reject) {
11997
- _this2.resolveReadyPromise = function () {
11998
- resolve(_this2);
10744
+ _this3.resolveReadyPromise = function () {
10745
+ resolve(_this3);
11999
10746
  };
12000
- _this2.rejectReadyPromise = function () {
10747
+ _this3.rejectReadyPromise = function () {
12001
10748
  reject(new Error());
12002
10749
  };
12003
10750
  });
@@ -12025,16 +10772,16 @@
12025
10772
  }, {
12026
10773
  key: "finished",
12027
10774
  get: function get() {
12028
- var _this3 = this;
10775
+ var _this4 = this;
12029
10776
  if (!this.finishedPromise) {
12030
10777
  if (this.timeline.animationsWithPromises.indexOf(this) === -1) {
12031
10778
  this.timeline.animationsWithPromises.push(this);
12032
10779
  }
12033
10780
  this.finishedPromise = new Promise(function (resolve, reject) {
12034
- _this3.resolveFinishedPromise = function () {
12035
- resolve(_this3);
10781
+ _this4.resolveFinishedPromise = function () {
10782
+ resolve(_this4);
12036
10783
  };
12037
- _this3.rejectFinishedPromise = function () {
10784
+ _this4.rejectFinishedPromise = function () {
12038
10785
  reject(new Error());
12039
10786
  };
12040
10787
  });
@@ -12864,7 +11611,7 @@
12864
11611
  this.currentIteration = null;
12865
11612
  this.progress = null;
12866
11613
  }
12867
- _createClass$2(AnimationEffectTiming, [{
11614
+ _createClass$1(AnimationEffectTiming, [{
12868
11615
  key: "easing",
12869
11616
  get: function get() {
12870
11617
  return this._easing;
@@ -13079,12 +11826,11 @@
13079
11826
  *
13080
11827
  */
13081
11828
  var KeyframeEffect = /*#__PURE__*/function () {
13082
- // pseudoElement: string | null;
13083
-
13084
11829
  function KeyframeEffect(target, effectInput, timingInput) {
13085
11830
  var _this = this;
13086
11831
  this.composite = 'replace';
13087
11832
  this.iterationComposite = 'replace';
11833
+ // pseudoElement: string | null;
13088
11834
  this.target = void 0;
13089
11835
  this.animation = void 0;
13090
11836
  this.timing = void 0;
@@ -13174,13 +11920,12 @@
13174
11920
  * @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/web-animations-js/index.d.ts
13175
11921
  */
13176
11922
  var AnimationTimeline = /*#__PURE__*/function () {
13177
- /**
13178
- * all active animations
13179
- */
13180
-
13181
11923
  function AnimationTimeline(document) {
13182
11924
  var _this = this;
13183
11925
  this.document = void 0;
11926
+ /**
11927
+ * all active animations
11928
+ */
13184
11929
  this.animations = [];
13185
11930
  this.ticking = false;
13186
11931
  this.timelineTicking = false;
@@ -13349,7 +12094,6 @@
13349
12094
  runtime.AnimationTimeline = AnimationTimeline;
13350
12095
 
13351
12096
  exports.AABB = AABB;
13352
- exports.AbstractLayoutDefinition = AbstractLayoutDefinition;
13353
12097
  exports.AbstractRenderer = AbstractRenderer;
13354
12098
  exports.AbstractRendererPlugin = AbstractRendererPlugin;
13355
12099
  exports.AdvancedCamera = AdvancedCamera;
@@ -13371,7 +12115,6 @@
13371
12115
  exports.CustomElement = CustomElement;
13372
12116
  exports.CustomElementRegistry = CustomElementRegistry;
13373
12117
  exports.CustomEvent = CustomEvent;
13374
- exports.DefaultLayoutRegistry = DefaultLayoutRegistry;
13375
12118
  exports.DefaultSceneGraphSelector = DefaultSceneGraphSelector;
13376
12119
  exports.DefaultSceneGraphService = DefaultSceneGraphService;
13377
12120
  exports.DisplayObject = DisplayObject;
@@ -13387,18 +12130,11 @@
13387
12130
  exports.FederatedMouseEvent = FederatedMouseEvent;
13388
12131
  exports.FederatedPointerEvent = FederatedPointerEvent;
13389
12132
  exports.FederatedWheelEvent = FederatedWheelEvent;
13390
- exports.FragmentResult = FragmentResult;
13391
12133
  exports.Frustum = Frustum;
13392
12134
  exports.Group = Group;
13393
12135
  exports.HTML = HTML;
13394
12136
  exports.Image = Image;
13395
12137
  exports.KeyframeEffect = KeyframeEffect;
13396
- exports.LayoutChildren = LayoutChildren;
13397
- exports.LayoutContext = LayoutContext;
13398
- exports.LayoutEdges = LayoutEdges;
13399
- exports.LayoutEngine = LayoutEngine;
13400
- exports.LayoutFragment = LayoutFragment;
13401
- exports.LayoutObject = LayoutObject;
13402
12138
  exports.Line = Line;
13403
12139
  exports.LineUpdater = LineUpdater;
13404
12140
  exports.MutationEvent = MutationEvent;
@@ -13445,7 +12181,6 @@
13445
12181
  exports.isFederatedEvent = isFederatedEvent;
13446
12182
  exports.isFillOrStrokeAffected = isFillOrStrokeAffected;
13447
12183
  exports.isPattern = isPattern;
13448
- exports.layoutEngine = layoutEngine;
13449
12184
  exports.makeTiming = makeTiming;
13450
12185
  exports.mergeColors = mergeColors;
13451
12186
  exports.normalizeKeyframes = normalizeKeyframes;