UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue) [![Discord Chat](https://img.shields.io/discord/55794023

2 lines (1 loc) 1.26 kB
this.primevue=this.primevue||{},this.primevue.usestyle=function(e,t,i){"use strict";function n(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];i.getCurrentInstance()?i.onMounted(e):t?e():i.nextTick(e)}var u=0;return e.useStyle=function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=i.ref(!1),l=i.ref(e),o=i.ref(null),v=t.DomHandler.isClient()?window.document:void 0,r=a.document,s=void 0===r?v:r,c=a.immediate,m=void 0===c||c,y=a.manual,f=void 0!==y&&y,h=a.name,p=void 0===h?"style_".concat(++u):h,C=a.id,g=void 0===C?void 0:C,x=a.media,w=void 0===x?void 0:x,E=function(){},_=function(){s&&(o.value=s.querySelector('style[data-primevue-style-id="'.concat(p,'"]'))||s.getElementById(g)||s.createElement("style"),o.value.isConnected||(o.value.type="text/css",g&&(o.value.id=g),w&&(o.value.media=w),s.head.appendChild(o.value),p&&o.value.setAttribute("data-primevue-style-id",p)),d.value||(E=i.watch(l,(function(e){o.value.textContent=e}),{immediate:!0}),d.value=!0))};return m&&!f&&n(_),{id:g,name:p,css:l,unload:function(){s&&d.value&&(E(),t.DomHandler.isExist(o.value)&&s.head.removeChild(o.value),d.value=!1)},load:_,isLoaded:i.readonly(d)}},Object.defineProperty(e,"__esModule",{value:!0}),e}({},primevue.utils,Vue);