UNPKG

basb-cli

Version:
2 lines (1 loc) 9.11 kB
import{a3 as t,e,bP as i,cs as o,cD as n,X as r,h as a,ad as s,P as l,D as f,cE as d,cF as x,w as u,cG as h,Y as c,bA as g,Z as v,bc as S,d as y,bk as p}from"./index.js";var w={};function m(e,i,o,n){return e&&(e.legacy||!1!==e.legacy&&!o&&!n&&"tspan"!==i&&("text"===i||t(e,"text")))}function B(i,o,n){var r,a,s,l=i;if("text"===o)s=l;else{s={},t(l,"text")&&(s.text=l.text),t(l,"rich")&&(s.rich=l.rich),t(l,"textFill")&&(s.fill=l.textFill),t(l,"textStroke")&&(s.stroke=l.textStroke),t(l,"fontFamily")&&(s.fontFamily=l.fontFamily),t(l,"fontSize")&&(s.fontSize=l.fontSize),t(l,"fontStyle")&&(s.fontStyle=l.fontStyle),t(l,"fontWeight")&&(s.fontWeight=l.fontWeight),a={type:"text",style:s,silent:!0},r={};var f=t(l,"textPosition");n?r.position=f?l.textPosition:"inside":f&&(r.position=l.textPosition),t(l,"textPosition")&&(r.position=l.textPosition),t(l,"textOffset")&&(r.offset=l.textOffset),t(l,"textRotation")&&(r.rotation=l.textRotation),t(l,"textDistance")&&(r.distance=l.textDistance)}return k(s,i),e(s.rich,(function(t){k(t,t)})),{textConfig:r,textContent:a}}function k(e,i){i&&(i.font=i.textFont||i.font,t(i,"textStrokeWidth")&&(e.lineWidth=i.textStrokeWidth),t(i,"textAlign")&&(e.align=i.textAlign),t(i,"textVerticalAlign")&&(e.verticalAlign=i.textVerticalAlign),t(i,"textLineHeight")&&(e.lineHeight=i.textLineHeight),t(i,"textWidth")&&(e.width=i.textWidth),t(i,"textHeight")&&(e.height=i.textHeight),t(i,"textBackgroundColor")&&(e.backgroundColor=i.textBackgroundColor),t(i,"textPadding")&&(e.padding=i.textPadding),t(i,"textBorderColor")&&(e.borderColor=i.textBorderColor),t(i,"textBorderWidth")&&(e.borderWidth=i.textBorderWidth),t(i,"textBorderRadius")&&(e.borderRadius=i.textBorderRadius),t(i,"textBoxShadowColor")&&(e.shadowColor=i.textBoxShadowColor),t(i,"textBoxShadowBlur")&&(e.shadowBlur=i.textBoxShadowBlur),t(i,"textBoxShadowOffsetX")&&(e.shadowOffsetX=i.textBoxShadowOffsetX),t(i,"textBoxShadowOffsetY")&&(e.shadowOffsetY=i.textBoxShadowOffsetY))}function b(t,i,o){var n=t;n.textPosition=n.textPosition||o.position||"inside",null!=o.offset&&(n.textOffset=o.offset),null!=o.rotation&&(n.textRotation=o.rotation),null!=o.distance&&(n.textDistance=o.distance);var r=n.textPosition.indexOf("inside")>=0,a=t.fill||"#000";C(n,i);var s=null==n.textFill;return r?s&&(n.textFill=o.insideFill||"#fff",!n.textStroke&&o.insideStroke&&(n.textStroke=o.insideStroke),!n.textStroke&&(n.textStroke=a),null==n.textStrokeWidth&&(n.textStrokeWidth=2)):(s&&(n.textFill=t.fill||o.outsideFill||"#000"),!n.textStroke&&o.outsideStroke&&(n.textStroke=o.outsideStroke)),n.text=i.text,n.rich=i.rich,e(i.rich,(function(t){C(t,t)})),n}function C(e,i){i&&(t(i,"fill")&&(e.textFill=i.fill),t(i,"stroke")&&(e.textStroke=i.fill),t(i,"lineWidth")&&(e.textStrokeWidth=i.lineWidth),t(i,"font")&&(e.font=i.font),t(i,"fontStyle")&&(e.fontStyle=i.fontStyle),t(i,"fontWeight")&&(e.fontWeight=i.fontWeight),t(i,"fontSize")&&(e.fontSize=i.fontSize),t(i,"fontFamily")&&(e.fontFamily=i.fontFamily),t(i,"align")&&(e.textAlign=i.align),t(i,"verticalAlign")&&(e.textVerticalAlign=i.verticalAlign),t(i,"lineHeight")&&(e.textLineHeight=i.lineHeight),t(i,"width")&&(e.textWidth=i.width),t(i,"height")&&(e.textHeight=i.height),t(i,"backgroundColor")&&(e.textBackgroundColor=i.backgroundColor),t(i,"padding")&&(e.textPadding=i.padding),t(i,"borderColor")&&(e.textBorderColor=i.borderColor),t(i,"borderWidth")&&(e.textBorderWidth=i.borderWidth),t(i,"borderRadius")&&(e.textBorderRadius=i.borderRadius),t(i,"shadowColor")&&(e.textBoxShadowColor=i.shadowColor),t(i,"shadowBlur")&&(e.textBoxShadowBlur=i.shadowBlur),t(i,"shadowOffsetX")&&(e.textBoxShadowOffsetX=i.shadowOffsetX),t(i,"shadowOffsetY")&&(e.textBoxShadowOffsetY=i.shadowOffsetY),t(i,"textShadowColor")&&(e.textShadowColor=i.textShadowColor),t(i,"textShadowBlur")&&(e.textShadowBlur=i.textShadowBlur),t(i,"textShadowOffsetX")&&(e.textShadowOffsetX=i.textShadowOffsetX),t(i,"textShadowOffsetY")&&(e.textShadowOffsetY=i.textShadowOffsetY))}function O(t,e){var i=t+"^_^"+e;w[i]||(console.warn('[ECharts] DEPRECATED: "'+t+'" has been deprecated. '+e),w[i]=!0)}var W={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},F=i(W),P=o(n,(function(t,e){return t[e]=1,t}),{}),A=n.join(", "),T=["","style","shape","extra"],D=r();function X(t,e,i,o,n){var r=t+"Animation",s=h(t,o,n)||{},l=D(e).userDuring;return s.duration>0&&(s.during=l?c(V,{el:e,userDuring:l}):null,s.setToFinal=!0,s.scope=t),a(s,i[r]),s}function Y(o,r,d,x){var u=(x=x||{}).dataIndex,h=x.isInit,c=x.clearStyle,v=d.isAnimationEnabled(),S=D(o),y=r.style;S.userDuring=r.during;var p={},w={};if(function(t,e,i){for(var o=0;o<F.length;o++){var r=F[o],a=W[r],s=e[r];s&&(i[a[0]]=s[0],i[a[1]]=s[1])}for(o=0;o<n.length;o++){var l=n[o];null!=e[l]&&(i[l]=e[l])}}(0,r,w),I("shape",r,w),I("extra",r,w),!h&&v&&(function(t,e,i){for(var o=e.transition,r=H(o)?n:g(o||[]),a=0;a<r.length;a++){var s=r[a];if("style"!==s&&"shape"!==s&&"extra"!==s){var l=t[s];z(s,"el.transition"),i[s]=l}}}(o,r,p),G("shape",o,r,p),G("extra",o,r,p),function(t,e,o,n){if(!o)return;var r,a=t.style;if(a){var s=o.transition,l=e.transition;if(s&&!H(s)){var d=g(s);!r&&(r=n.style={});for(var x=0;x<d.length;x++){var u=a[S=d[x]];r[S]=u}}else if(t.getAnimationStyleProps&&(H(l)||H(s)||f(l,"style")>=0)){var h=t.getAnimationStyleProps(),c=h?h.style:null;if(c){!r&&(r=n.style={});var v=i(o);for(x=0;x<v.length;x++){var S;if(c[S=v[x]]){u=a[S];r[S]=u}}}}}}(o,r,y,p)),w.style=y,function(t,e,i){var o=e.style;if(!t.isGroup&&o){if(i){t.useStyle({});for(var n=t.animators,r=0;r<n.length;r++){var a=n[r];"style"===a.targetName&&a.changeTarget(t.style)}}t.setStyle(o)}e&&(e.style=null,e&&t.attr(e),e.style=o)}(o,w,c),function(e,i){t(i,"silent")&&(e.silent=i.silent),t(i,"ignore")&&(e.ignore=i.ignore),e instanceof s&&t(i,"invisible")&&(e.invisible=i.invisible);e instanceof l&&t(i,"autoBatch")&&(e.autoBatch=i.autoBatch)}(o,r),v)if(h){var m={};e(T,(function(t){var e=t?r[t]:r;e&&e.enterFrom&&(t&&(m[t]=m[t]||{}),a(t?m[t]:m,e.enterFrom))}));var B=X("enter",o,r,d,u);B.duration>0&&o.animateFrom(m,B)}else!function(t,e,i,o,n){if(n){var r=X("update",t,e,o,i);r.duration>0&&t.animateFrom(n,r)}}(o,r,u||0,d,p);E(o,r),y?o.dirty():o.markRedraw()}function E(t,e){for(var i=D(t).leaveToProps,o=0;o<T.length;o++){var n=T[o],r=n?e[n]:e;r&&r.leaveTo&&(i||(i=D(t).leaveToProps={}),n&&(i[n]=i[n]||{}),a(n?i[n]:i,r.leaveTo))}}function R(t,e,i,o){if(t){var n=t.parent,r=D(t).leaveToProps;if(r){var a=X("update",t,e,i,0);a.done=function(){n.remove(t),o&&o()},t.animateTo(r,a)}else n.remove(t),o&&o()}}function H(t){return"all"===t}var z,N={},j={setTransform:function(e,i){return v(t(P,e),"Only "+A+" available in `setTransform`."),N.el[e]=i,this},getTransform:function(e){return v(t(P,e),"Only "+A+" available in `getTransform`."),N.el[e]},setShape:function(t,e){L(t);var i=N.el;return(i.shape||(i.shape={}))[t]=e,i.dirtyShape&&i.dirtyShape(),this},getShape:function(t){L(t);var e=N.el.shape;if(e)return e[t]},setStyle:function(t,e){L(t);var i=N.el,o=i.style;return o&&(S(e)&&u("style."+t+" must not be assigned with NaN."),o[t]=e,i.dirtyStyle&&i.dirtyStyle()),this},getStyle:function(t){L(t);var e=N.el.style;if(e)return e[t]},setExtra:function(t,e){return L(t),(N.el.extra||(N.el.extra={}))[t]=e,this},getExtra:function(t){L(t);var e=N.el.extra;if(e)return e[t]}};function L(t){if("transition"===t||"enterFrom"===t||"leaveTo"===t)throw new Error('key must not be "'+t+'"')}function V(){var t=this,e=t.el;if(e){var i=D(e).userDuring,o=t.userDuring;i===o?(N.el=e,o(j)):t.el=t.userDuring=null}}function G(t,e,o,n){var r=o[t];if(r){var s,l=e[t];if(l){var d=o.transition,x=r.transition;if(x)if(!s&&(s=n[t]={}),H(x))a(s,l);else for(var u=g(x),h=0;h<u.length;h++){var c=l[S=u[h]];s[S]=c}else if(H(d)||f(d,t)>=0){!s&&(s=n[t]={});var v=i(l);for(h=0;h<v.length;h++){var S;c=l[S=v[h]];K(r[S],c)&&(s[S]=c)}}}}}function I(t,e,o){var n=e[t];if(n)for(var r=o[t]={},a=i(n),s=0;s<a.length;s++){var l=a[s];r[l]=d(n[l])}}function K(t,e){return x(t)?t!==e:null!=t&&isFinite(t)}z=function(e,o){t(P,e)||u("Prop `"+e+"` is not a permitted in `"+o+"`. Only `"+i(P).join("`, `")+"` are permitted.")};var Z=r(),_=["percent","easing","shape","style","extra"];function q(t){t.stopAnimation("keyframe"),t.attr(Z(t))}function J(t,o,n){if(n.isAnimationEnabled()&&o)if(y(o))e(o,(function(e){J(t,e,n)}));else{var r=o.keyframes,a=o.duration;if(n&&null==a){var s=h("enter",n,0);a=s&&s.duration}if(r&&a){var l=Z(t);e(T,(function(n){if(!n||t[n]){var s,d=!1;r.sort((function(t,e){return t.percent-e.percent})),e(r,(function(r){var x=t.animators,u=n?r[n]:r;if(r.percent>=1&&(d=!0),u){var h=i(u);if(n||(h=p(h,(function(t){return f(_,t)<0}))),h.length){s||((s=t.animate(n,o.loop,!0)).scope="keyframe");for(var c=0;c<x.length;c++)x[c]!==s&&x[c].targetName===s.targetName&&x[c].stopTracks(h);n&&(l[n]=l[n]||{});var g=n?l[n]:l;e(h,(function(e){g[e]=((n?t[n]:t)||{})[e]})),s.whenWithKeys(a*r.percent,u,h,r.easing)}}})),s&&(d||u("End frame with percent: 1 is missing in the keyframeAnimation.",!0),s.delay(o.delay||0).duration(a).start(o.easing))}}))}}}export{R as a,B as b,b as c,Y as d,J as e,H as f,m as i,q as s,E as u,O as w};