sirius/vendor/grapesjs/parser-postcss.js

3 lines
51 KiB
JavaScript
Raw Normal View History

/*! grapesjs-parser-postcss - 1.0.3 */
!function(e,t){'object'==typeof exports&&'object'==typeof module?module.exports=t():'function'==typeof define&&define.amd?define([],t):'object'==typeof exports?exports["grapesjs-parser-postcss"]=t():e["grapesjs-parser-postcss"]=t()}('undefined'!=typeof globalThis?globalThis:'undefined'!=typeof window?window:this,(()=>(()=>{var e={241:e=>{var t=String,s=function(){return{isColorSupported:!1,reset:t,bold:t,dim:t,italic:t,underline:t,inverse:t,hidden:t,strikethrough:t,black:t,red:t,green:t,yellow:t,blue:t,magenta:t,cyan:t,white:t,gray:t,bgBlack:t,bgRed:t,bgGreen:t,bgYellow:t,bgBlue:t,bgMagenta:t,bgCyan:t,bgWhite:t}};e.exports=s(),e.exports.createColors=s},353:(e,t,s)=>{"use strict";let r=s(19);class i extends r{constructor(e){super(e),this.type='atrule'}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}e.exports=i,i.default=i,r.registerAtRule(i)},932:(e,t,s)=>{"use strict";let r=s(631);class i extends r{constructor(e){super(e),this.type='comment'}}e.exports=i,i.default=i},19:(e,t,s)=>{"use strict";let r,i,o,n,{isClean:l,my:a}=s(513),h=s(258),u=s(932),c=s(631);function p(e){return e.map((e=>(e.nodes&&(e.nodes=p(e.nodes)),delete e.source,e)))}function f(e){if(e[l]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)f(t)}class d extends c{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,s,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],s=e(this.proxyOf.nodes[t],t),!1!==s);)this.indexes[r]+=1;return delete this.indexes[r],s}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>'proxyOf'===t?e:e[t]?'each'===t||'string'==typeof t&&t.startsWith('walk')?(...s)=>e[t](...s.map((e=>'function'==typeof e?(t,s)=>e(t.toProxy(),s):e))):'every'===t||'some'===t?s=>e[t](((e,...t)=>s(e.toProxy(),...t))):'root'===t?()=>e.root().toProxy():'nodes'===t?e.nodes.map((e=>e.toProxy())):'first'===t||'last'===t?e[t].toProxy():e[t]:e[t],set:(e,t,s)=>(e[t]===s||(e[t]=s,'name'!==t&&'params'!==t&&'selector'!==t||e.markDirty()),!0)}}index(e){return'number'==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let s,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)s=this.indexes[e],r<s&&(this.indexes[e]=s+i.length);return this.markDirty(),this}insertBefore(e,t){let s,r=this.index(e),i=0===r&&'prepend',o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of o)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)s=this.indexes[e],r<=s&&(this.indexes[e]=s+o.length);return this.markDirty(),this}normalize(e,t){if('string'==typeof e)e=p(r(e).nodes);else if(Array.isArray(e)){e=e.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,'ignore')}else if('root'===e.type&&'document'!==this.type){e=e.nodes.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,'ignore')}else if(e.type)e=[e];else if(e.prop){if(void 0===e.value)throw new Error('Value field is missed in node creation');'string'!=typeof e.value&&(e.value=String(e.value)),e=[new h(e)]}else if(e.selector)e=[new i(e)];else if(e.name)e=[new o(e)];else{if(!e.text)throw new Error('Unknown node type in node creation');e=[new u(e)]}return e.map((e=>(e[a]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[l]&&f(e),void 0===e.raws.before&&t&&void 0!==t.raws.before&&(e.raws.before=t.raws.before.replace(/\S/g,'')),e.parent=this.proxyOf,e)))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,'prepend').reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=thi
//# sourceMappingURL=index.js.map