@master/css 1.14.5 → 1.14.6

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/render.d.ts +11 -0
  3. package/render.js +1 -1
package/package.json CHANGED
@@ -25,5 +25,5 @@
25
25
  "type": "git",
26
26
  "url": "https://github.com/master-co/css.git"
27
27
  },
28
- "version": "1.14.5"
28
+ "version": "1.14.6"
29
29
  }
package/render.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { Style, StyleSheet } from './';
2
+ import './polyfills/css-escape';
3
+ export declare function render(html: string, options: {
4
+ Style: typeof Style;
5
+ StyleSheet: typeof StyleSheet;
6
+ }): {
7
+ stylesCss: string;
8
+ colorsCss: string;
9
+ colorsMetaContent: string;
10
+ html: string;
11
+ };
package/render.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@master/styles"]=t():e["@master/styles"]=t()}(this,(function(){return(()=>{var e={131:function(e,t,r){var o;o=void 0!==r.g?r.g:this,e.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,r=String(e),o=r.length,n=-1,s="",c=r.charCodeAt(0);++n<o;)0!=(t=r.charCodeAt(n))?s+=t>=1&&t<=31||127==t||0==n&&t>=48&&t<=57||1==n&&t>=48&&t<=57&&45==c?"\\"+t.toString(16)+" ":0==n&&1==o&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+r.charAt(n):r.charAt(n):s+="�";return s};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(o)}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,r),s.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";r.r(o),r.d(o,{render:()=>e});r(131);function e(e,t){if(!e)return{stylesCss:"",colorsCss:"",colorsMetaContent:"",html:e};const{Style:r,StyleSheet:o}=t,n=new o,s=/\sclass="([^"]*)"/gm;let c;for(;c=s.exec(e);){const e=c[1].replace(/\n/g,"").split(" ").filter((e=>e));for(const t of e)t in n.countOfName||(n.findAndInsert(t),n.countOfName[t]=1)}const i=n.styles.map((e=>e.text)).join(""),a=r.colorNames.map((e=>function(e,t){let r=":root{";for(const o in t)r+="--"+e+(o?"-"+o:"")+":"+t[o]+";";return r+="}",r}(e,r.rgbColors[e]))).join(""),l=r.colorNames.join(",");return{stylesCss:i,colorsCss:a,colorsMetaContent:l,html:e.includes("<head>")?e.replace(/(<head>)/,`$1\n <style id="master-colors">${a}</style>\n <style id="master-styles">${i}</style>\n <meta name="master:colors" content="${l}"></meta>`):e}}})(),o})()}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@master/styles"]=t():e["@master/styles"]=t()}(this,(function(){return(()=>{var e={131:function(e,t,r){var o;o=void 0!==r.g?r.g:this,e.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,r=String(e),o=r.length,n=-1,s="",c=r.charCodeAt(0);++n<o;)0!=(t=r.charCodeAt(n))?s+=t>=1&&t<=31||127==t||0==n&&t>=48&&t<=57||1==n&&t>=48&&t<=57&&45==c?"\\"+t.toString(16)+" ":0==n&&1==o&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+r.charAt(n):r.charAt(n):s+="�";return s};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(o)}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,r),s.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";r.r(o),r.d(o,{render:()=>e});r(131);function e(e,t){if(!e)return{stylesCss:"",colorsCss:"",colorsMetaContent:"",html:e};const r=t.StyleSheet,o=t.Style,n=new r,s=/\sclass="([^"]*)"/gm;let c;for(;c=s.exec(e);){const e=c[1].replace(/\n/g,"").split(" ").filter((e=>e));for(const t of e)t in n.countOfName||(n.findAndInsert(t),n.countOfName[t]=1)}const i=n.styles.map((e=>e.text)).join(""),a=o.colorNames.map((e=>function(e,t){let r=":root{";for(const o in t)r+="--"+e+(o?"-"+o:"")+":"+t[o]+";";return r+="}",r}(e,o.rgbColors[e]))).join(""),l=o.colorNames.join(",");return{stylesCss:i,colorsCss:a,colorsMetaContent:l,html:e.includes("<head>")?e.replace(/(<head>)/,`$1\n <style id="master-colors">${a}</style>\n <style id="master-styles">${i}</style>\n <meta name="master:colors" content="${l}"></meta>`):e}}})(),o})()}));