css-styled
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/daybrush/css-styled.git | ||
version: 1.0.5 | ||
version: 1.0.6 | ||
*/ | ||
@@ -68,3 +68,3 @@ 'use strict'; | ||
style.setAttribute("data-styled-id", className); | ||
style.setAttribute("data-styled-count", "0"); | ||
style.setAttribute("data-styled-count", "1"); | ||
if (options.nonce) { | ||
@@ -100,5 +100,10 @@ style.setAttribute("nonce", options.nonce); | ||
destroy: function () { | ||
var _a; | ||
var injectCount = parseFloat(styleElement.getAttribute("data-styled-count")) || 0; | ||
if (injectCount <= 1) { | ||
styleElement.parentNode.removeChild(styleElement); | ||
if (styleElement.remove) { | ||
styleElement.remove(); | ||
} else { | ||
(_a = styleElement.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(styleElement); | ||
} | ||
styleElement = null; | ||
@@ -105,0 +110,0 @@ } else { |
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/daybrush/css-styled.git | ||
version: 1.0.5 | ||
version: 1.0.6 | ||
*/ | ||
@@ -66,3 +66,3 @@ import { splitComma } from '@daybrush/utils'; | ||
style.setAttribute("data-styled-id", className); | ||
style.setAttribute("data-styled-count", "0"); | ||
style.setAttribute("data-styled-count", "1"); | ||
if (options.nonce) { | ||
@@ -98,5 +98,10 @@ style.setAttribute("nonce", options.nonce); | ||
destroy: function () { | ||
var _a; | ||
var injectCount = parseFloat(styleElement.getAttribute("data-styled-count")) || 0; | ||
if (injectCount <= 1) { | ||
styleElement.parentNode.removeChild(styleElement); | ||
if (styleElement.remove) { | ||
styleElement.remove(); | ||
} else { | ||
(_a = styleElement.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(styleElement); | ||
} | ||
styleElement = null; | ||
@@ -103,0 +108,0 @@ } else { |
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/daybrush/css-styled.git | ||
version: 1.0.5 | ||
version: 1.0.6 | ||
*/ | ||
@@ -347,3 +347,3 @@ (function (global, factory) { | ||
style.setAttribute("data-styled-id", className); | ||
style.setAttribute("data-styled-count", "0"); | ||
style.setAttribute("data-styled-count", "1"); | ||
if (options.nonce) { | ||
@@ -379,5 +379,10 @@ style.setAttribute("nonce", options.nonce); | ||
destroy: function () { | ||
var _a; | ||
var injectCount = parseFloat(styleElement.getAttribute("data-styled-count")) || 0; | ||
if (injectCount <= 1) { | ||
styleElement.parentNode.removeChild(styleElement); | ||
if (styleElement.remove) { | ||
styleElement.remove(); | ||
} else { | ||
(_a = styleElement.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(styleElement); | ||
} | ||
styleElement = null; | ||
@@ -384,0 +389,0 @@ } else { |
@@ -7,5 +7,5 @@ /* | ||
repository: git+https://github.com/daybrush/css-styled.git | ||
version: 1.0.5 | ||
version: 1.0.6 | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).styled=t()}(this,function(){"use strict";var e=function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return t>>>0},h=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}];function b(e,t,n,r,o){if(m(e,t,n))return n;for(var i,a=e,u=t,c=r,s=o,l=n+1;l<c;++l){var f=function(e){var t,n,r=u[e].trim();return r!==a.close||m(a,u,e)?(t=e,-1===(t=(n=j(s,function(e){return e.open===r}))?b(n,u,e,c,s):t)?(i=e,"break"):void(i=e=t)):{value:e}}(l);if(l=i,"object"==typeof f)return f.value;if("break"===f)break}return-1}function m(e,t,n){return e.ignore?(t=t.slice(Math.max(n-3,0),n+3).join(""),new RegExp(e.ignore).exec(t)):null}function C(i,e){var e="string"==typeof e?{separator:e}:e,t=e.separator,a=void 0===t?",":t,u=e.isSeparateFirst,c=e.isSeparateOnlyOpenClose,t=e.isSeparateOpenClose,s=void 0===t?c:t,t=e.openCloseCharacters,l=void 0===t?h:t,e=l.map(function(e){var t=e.open,e=e.close;return t===e?t:t+"|"+e}).join("|"),t=new RegExp("(\\s*"+a+"\\s*|"+e+"|\\s+)","g"),f=i.split(t).filter(function(e){return e&&"undefined"!==e}),d=f.length,p=[],v=[];function g(){return v.length&&(p.push(v.join("")),v=[])}for(var y,n=function(e){var t=f[e].trim(),n=e,r=j(l,function(e){return e.open===t}),o=j(l,function(e){return e.close===t});if(r){if(-1!==(n=b(r,f,e,d,l))&&s)return g()&&u||(p.push(f.slice(e,n+1).join("")),e=n,u)?(y=e,"break"):(y=e,"continue")}else{if(o&&!m(o,f,e))return(r=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),o=0,t=0;t<n;t++)for(var i=arguments[t],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}(l)).splice(l.indexOf(o),1),{value:C(i,{separator:a,isSeparateFirst:u,isSeparateOnlyOpenClose:c,isSeparateOpenClose:s,openCloseCharacters:r})};if(o=t,!((""!==(r=a)&&" "!=r||""!==o&&" "!=o)&&o!==r||c))return g(),u?(y=e,"break"):(y=e,"continue")}v.push(f.slice(e,(n=-1===n?d-1:n)+1).join("")),y=e=n},r=0;r<d;++r){var o=n(r),r=y;if("object"==typeof o)return o.value;if("break"===o)break}return v.length&&p.push(v.join("")),p}function j(e,t,n){t=function(e,t,n){void 0===n&&(n=-1);for(var r=e.length,o=0;o<r;++o)if(t(e[o],o,e))return o;return n}(e,t);return-1<t?e[t]:n}function c(n,e,t){return t.original?e:e.replace(/([^};{\s}][^};{]*|^\s*){/gm,function(e,t){t=t.trim();return(t?C(t,","):[""]).map(function(e){e=e.trim();return 0===e.indexOf("@")?e:-1<e.indexOf(":global")?e.replace(/\:global/g,""):-1<e.indexOf(":host")?"".concat(e.replace(/\:host/g,".".concat(n))):e?".".concat(n," ").concat(e):".".concat(n)}).join(", ")+" {"})}return function(a){var u="rCS"+e(a).toString(36);return{className:u,inject:function(e,t){void 0===t&&(t={});var n,r,o,e=function(e){if(e&&e.getRootNode){e=e.getRootNode();if(11===e.nodeType)return e}}(e),i=(e||document).querySelector('style[data-styled-id="'.concat(u,'"]'));return i?(n=parseFloat(i.getAttribute("data-styled-count"))||0,i.setAttribute("data-styled-count","".concat(n+1))):(n=u,r=a,t=t,e=e,(o=document.createElement("style")).setAttribute("type","text/css"),o.setAttribute("data-styled-id",n),o.setAttribute("data-styled-count","0"),t.nonce&&o.setAttribute("nonce",t.nonce),o.innerHTML=c(n,r,t),(e||document.head||document.body).appendChild(o),i=o),{destroy:function(){var e=parseFloat(i.getAttribute("data-styled-count"))||0;e<=1?(i.parentNode.removeChild(i),i=null):i.setAttribute("data-styled-count","".concat(e-1))}}}}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).styled=t()}(this,function(){"use strict";var e=function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return t>>>0},h=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}];function b(e,t,n,r,o){if(m(e,t,n))return n;for(var i,a=e,u=t,c=r,s=o,l=n+1;l<c;++l){var f=function(e){var t,n,r=u[e].trim();return r!==a.close||m(a,u,e)?(t=e,-1===(t=(n=j(s,function(e){return e.open===r}))?b(n,u,e,c,s):t)?(i=e,"break"):void(i=e=t)):{value:e}}(l);if(l=i,"object"==typeof f)return f.value;if("break"===f)break}return-1}function m(e,t,n){return e.ignore?(t=t.slice(Math.max(n-3,0),n+3).join(""),new RegExp(e.ignore).exec(t)):null}function C(i,e){var e="string"==typeof e?{separator:e}:e,t=e.separator,a=void 0===t?",":t,u=e.isSeparateFirst,c=e.isSeparateOnlyOpenClose,t=e.isSeparateOpenClose,s=void 0===t?c:t,t=e.openCloseCharacters,l=void 0===t?h:t,e=l.map(function(e){var t=e.open,e=e.close;return t===e?t:t+"|"+e}).join("|"),t=new RegExp("(\\s*"+a+"\\s*|"+e+"|\\s+)","g"),f=i.split(t).filter(function(e){return e&&"undefined"!==e}),d=f.length,p=[],v=[];function g(){return v.length&&(p.push(v.join("")),v=[])}for(var y,n=function(e){var t=f[e].trim(),n=e,r=j(l,function(e){return e.open===t}),o=j(l,function(e){return e.close===t});if(r){if(-1!==(n=b(r,f,e,d,l))&&s)return g()&&u||(p.push(f.slice(e,n+1).join("")),e=n,u)?(y=e,"break"):(y=e,"continue")}else{if(o&&!m(o,f,e))return(r=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),o=0,t=0;t<n;t++)for(var i=arguments[t],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}(l)).splice(l.indexOf(o),1),{value:C(i,{separator:a,isSeparateFirst:u,isSeparateOnlyOpenClose:c,isSeparateOpenClose:s,openCloseCharacters:r})};if(o=t,!((""!==(r=a)&&" "!=r||""!==o&&" "!=o)&&o!==r||c))return g(),u?(y=e,"break"):(y=e,"continue")}v.push(f.slice(e,(n=-1===n?d-1:n)+1).join("")),y=e=n},r=0;r<d;++r){var o=n(r),r=y;if("object"==typeof o)return o.value;if("break"===o)break}return v.length&&p.push(v.join("")),p}function j(e,t,n){t=function(e,t,n){void 0===n&&(n=-1);for(var r=e.length,o=0;o<r;++o)if(t(e[o],o,e))return o;return n}(e,t);return-1<t?e[t]:n}function c(n,e,t){return t.original?e:e.replace(/([^};{\s}][^};{]*|^\s*){/gm,function(e,t){t=t.trim();return(t?C(t,","):[""]).map(function(e){e=e.trim();return 0===e.indexOf("@")?e:-1<e.indexOf(":global")?e.replace(/\:global/g,""):-1<e.indexOf(":host")?"".concat(e.replace(/\:host/g,".".concat(n))):e?".".concat(n," ").concat(e):".".concat(n)}).join(", ")+" {"})}return function(a){var u="rCS"+e(a).toString(36);return{className:u,inject:function(e,t){void 0===t&&(t={});var n,r,o,e=function(e){if(e&&e.getRootNode){e=e.getRootNode();if(11===e.nodeType)return e}}(e),i=(e||document).querySelector('style[data-styled-id="'.concat(u,'"]'));return i?(n=parseFloat(i.getAttribute("data-styled-count"))||0,i.setAttribute("data-styled-count","".concat(n+1))):(n=u,r=a,t=t,e=e,(o=document.createElement("style")).setAttribute("type","text/css"),o.setAttribute("data-styled-id",n),o.setAttribute("data-styled-count","1"),t.nonce&&o.setAttribute("nonce",t.nonce),o.innerHTML=c(n,r,t),(e||document.head||document.body).appendChild(o),i=o),{destroy:function(){var e,t=parseFloat(i.getAttribute("data-styled-count"))||0;t<=1?(i.remove?i.remove():null!=(e=i.parentNode)&&e.removeChild(i),i=null):i.setAttribute("data-styled-count","".concat(t-1))}}}}}}); | ||
//# sourceMappingURL=styled.min.js.map |
{ | ||
"name": "css-styled", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "This component is a lightweight, simple line style component.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/styled.cjs.js", |
@@ -28,3 +28,7 @@ import { getHash, injectStyle, getShadowRoot } from "./utils"; | ||
if (injectCount <= 1) { | ||
styleElement.parentNode!.removeChild(styleElement); | ||
if (styleElement.remove) { | ||
styleElement.remove(); | ||
} else { | ||
styleElement.parentNode?.removeChild(styleElement); | ||
} | ||
styleElement = null; | ||
@@ -31,0 +35,0 @@ } else { |
@@ -45,3 +45,3 @@ import stringHash from "string-hash"; | ||
style.setAttribute("data-styled-id", className); | ||
style.setAttribute("data-styled-count", "0"); | ||
style.setAttribute("data-styled-count", "1"); | ||
@@ -48,0 +48,0 @@ if (options.nonce) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63972
829