UNPKG

@stdlib/esm

Version:

ES module distribution for Stdlib, a standard library for JavaScript and Node.js.

3 lines 3.22 kB
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 import e from"./../../../vendor/events.js";import t from"./../../../vendor/debug.js";import r from"./../../../utils/define-property.js";import i from"./../../../utils/define-read-only-property.js";import n from"./../../../utils/copy.js";import a from"./../../../utils/keys.js";import o from"./../../../assert/is-plain-object.js";import s from"./../../../assert/has-own-property.js";import u from"./../../../assert/is-string.js";import l from"./../../../assert/is-boolean.js";import p from"./../../../vendor/virtual-dom/h.js";var d="",h=!1,m={clipPathId:d,autoRender:h},c=u.isPrimitive;function f(e){return c(e)?null:new TypeError("invalid value. `clipPathId` must be a string primitive. Value: `"+e+".`")}var v=l.isPrimitive;function g(e){return v(e)?null:new TypeError("invalid value. `autoRender` must be a boolean primitive. Value: `"+e+".`")}var b=f,w=g,y={clipPathId:b,autoRender:w},R=a,P=o,j=s,_=y,I=R(_);function k(e,t){var r,i,n,a;if(!P(t))return new TypeError("invalid argument. Options argument must be an object. Value: `"+t+"`.");for(a=0;a<I.length;a++)if(i=I[a],j(t,i)){if(n=t[i],r=_[i](n))return r;e[i]=n}return null}var E="change",N="change",O={clipPathId:E,autoRender:N},V=O;function C(e){return V[e]}var T=t,J=C,S=f,x=T("marks:set:clip-path-id"),A=J("clipPathId");function D(e){var t=S(e);if(t)throw t;x("Current value: %d.",this._clipPathId),this._clipPathId=e,x("New Value: %d.",this._clipPathId),this.emit(A)}function G(){return this._clipPathId}var M=t,q=C,z=g,B=M("marks:set:auto-render"),F=q("autoRender");function H(e){var t=z(e);if(t)throw t;B("Current value: %d.",this._autoRender),this._autoRender=e,B("New Value: %d.",this._autoRender),this.emit(F)}function K(){return this._autoRender}var L=t,Q=p,U=L("marks:render"),W="g";function X(){var e,t;return U("Rendering..."),e={namespace:"http://www.w3.org/2000/svg",property:"marks",className:"marks",attributes:{"clip-path":"url(#"+this._clipPathId+")"}},U("Generating a virtual DOM tree (%s) with properties: %s.",W,JSON.stringify(e)),t=Q(W,e,[]),this.emit("_render",t),t}var Y=e.EventEmitter,Z=t,$=r,ee=i,te=n,re=m,ie=k,ne=D,ae=G,oe=H,se=K,ue=X,le=Z("marks:main");function pe(e){var t,r,i;if(!(this instanceof pe))return new pe(e);if(t=this,r=te(re),i=ie(r,e))throw i;return le("Creating an instance with the following configuration: %s.",JSON.stringify(r)),Y.call(this),$(this,"_clipPathId",{configurable:!1,enumerable:!1,writable:!0,value:r.clipPathId}),$(this,"_autoRender",{configurable:!1,enumerable:!1,writable:!0,value:r.autoRender}),this.on("change",(function(){le("Received a change event."),t._autoRender&&t.render()})),this.on("_render",(function(){var e,r;for(le("Received a render event. Re-emitting..."),(e=new Array(arguments.length+1))[0]="render",r=0;r<arguments.length;r++)e[r+1]=arguments[r];t.emit.apply(t,e)})),this}pe.prototype=Object.create(Y.prototype),pe.prototype.constructor=pe,$(pe.prototype,"clipPathId",{configurable:!1,enumerable:!0,set:ne,get:ae}),$(pe.prototype,"autoRender",{configurable:!1,enumerable:!0,set:oe,get:se}),ee(pe.prototype,"render",ue);var de=pe;export default de; //# sourceMappingURL=marks.js.map