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.47 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 a=0;return e.useStyle=function(e){var d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=i.ref(!1),o=i.ref(e),l=i.ref(null),v=t.DomHandler.isClient()?window.document:void 0,r=d.document,s=void 0===r?v:r,c=d.immediate,m=void 0===c||c,f=d.manual,y=void 0!==f&&f,h=d.name,p=void 0===h?"style_".concat(++a):h,C=d.id,g=void 0===C?void 0:C,D=d.media,H=void 0===D?void 0:D,b=d.nonce,x=void 0===b?void 0:b,w=function(){},A=function(n){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s){var d=a.id||g,v=a.nonce||x;l.value=s.querySelector('style[data-primevue-style-id="'.concat(a.name||p,'"]'))||s.getElementById(d)||s.createElement("style"),l.value.isConnected||(o.value=n||e,t.DomHandler.setAttributes(l.value,{type:"text/css",id:d,media:H,nonce:v}),s.head.appendChild(l.value),t.DomHandler.setAttribute(l.value,"data-primevue-style-id",p),t.DomHandler.setAttributes(l.value,a)),u.value||(w=i.watch(o,(function(e){l.value.textContent=e}),{immediate:!0}),u.value=!0)}};return m&&!y&&n(A),{id:g,name:p,css:o,unload:function(){s&&u.value&&(w(),t.DomHandler.isExist(l.value)&&s.head.removeChild(l.value),u.value=!1)},load:A,isLoaded:i.readonly(u)}},Object.defineProperty(e,"__esModule",{value:!0}),e}({},primevue.utils,Vue);