@haiilo/catalyst 0.1.0 → 0.2.1

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 (80) hide show
  1. package/dist/catalyst/catalyst.css +1 -1403
  2. package/dist/catalyst/catalyst.esm.js +1 -126
  3. package/dist/catalyst/index.esm.js +0 -1
  4. package/dist/catalyst/p-22fac0fb.js +1 -0
  5. package/dist/catalyst/p-2dc28db3.entry.js +11 -0
  6. package/dist/catalyst/{p-f3fad7a0.js → p-e08f13c7.js} +1 -1
  7. package/dist/cjs/{app-globals-8908fe44.js → app-globals-814f34aa.js} +5 -2
  8. package/dist/cjs/cat-alert_7.cjs.entry.js +3115 -0
  9. package/dist/cjs/{cat-icon-registry-da00f7d6.js → cat-icon-registry-909e38e7.js} +65 -1
  10. package/dist/cjs/catalyst.cjs.js +7 -114
  11. package/dist/cjs/loader.cjs.js +5 -20
  12. package/dist/collection/collection-manifest.json +6 -2
  13. package/dist/collection/components/cat-alert/cat-alert.css +57 -0
  14. package/dist/collection/components/cat-alert/cat-alert.js +49 -0
  15. package/dist/collection/components/cat-badge/cat-badge.css +154 -0
  16. package/dist/collection/components/cat-badge/cat-badge.js +141 -0
  17. package/dist/collection/components/cat-button/cat-button.css +43 -8
  18. package/dist/collection/components/cat-button/cat-button.js +28 -6
  19. package/dist/collection/components/cat-icon/cat-icon.css +2 -1
  20. package/dist/collection/components/cat-menu/cat-menu.css +33 -0
  21. package/dist/collection/components/cat-menu/cat-menu.js +185 -0
  22. package/dist/collection/components/cat-skeleton/cat-skeleton.css +177 -0
  23. package/dist/collection/components/cat-skeleton/cat-skeleton.js +130 -0
  24. package/dist/components/cat-alert.d.ts +11 -0
  25. package/dist/components/cat-alert.js +42 -0
  26. package/dist/components/cat-badge.d.ts +11 -0
  27. package/dist/components/cat-badge.js +66 -0
  28. package/dist/components/cat-button.js +14 -42
  29. package/dist/components/cat-icon2.js +4 -5
  30. package/dist/components/cat-menu.d.ts +11 -0
  31. package/dist/components/cat-menu.js +2377 -0
  32. package/dist/components/cat-skeleton.d.ts +11 -0
  33. package/dist/components/cat-skeleton.js +76 -0
  34. package/dist/components/cat-spinner2.js +3 -4
  35. package/dist/components/index.d.ts +1 -1
  36. package/dist/components/index.js +4 -575
  37. package/dist/esm/{app-globals-000601ea.js → app-globals-e1679c2d.js} +5 -2
  38. package/dist/esm/cat-alert_7.entry.js +3105 -0
  39. package/dist/esm/{cat-icon-registry-b66e3f57.js → cat-icon-registry-4d02ee6c.js} +65 -2
  40. package/dist/esm/catalyst.js +6 -113
  41. package/dist/esm/loader.js +4 -19
  42. package/dist/esm/polyfills/css-shim.js +1 -1
  43. package/dist/types/components/cat-alert/cat-alert.d.ts +12 -0
  44. package/dist/types/components/cat-badge/cat-badge.d.ts +28 -0
  45. package/dist/types/components/cat-button/cat-button.d.ts +5 -0
  46. package/dist/types/components/cat-menu/cat-menu.d.ts +32 -0
  47. package/dist/types/components/cat-skeleton/cat-skeleton.d.ts +28 -0
  48. package/dist/types/components.d.ts +153 -0
  49. package/package.json +12 -9
  50. package/dist/catalyst/app-globals-622e4f87.js +0 -704
  51. package/dist/catalyst/cat-button.entry.js +0 -629
  52. package/dist/catalyst/cat-icon-registry-59da2e37.js +0 -43
  53. package/dist/catalyst/cat-icon.entry.js +0 -27
  54. package/dist/catalyst/cat-spinner.entry.js +0 -21
  55. package/dist/catalyst/css-shim-20dbffa5.js +0 -4
  56. package/dist/catalyst/dom-c5ed0ba5.js +0 -73
  57. package/dist/catalyst/index-72a1bbba.js +0 -3031
  58. package/dist/catalyst/p-17a20657.js +0 -1
  59. package/dist/catalyst/p-582935bb.entry.js +0 -1
  60. package/dist/catalyst/shadow-css-8c625855.js +0 -388
  61. package/dist/cjs/app-globals-fe9ff8ba.js +0 -706
  62. package/dist/cjs/cat-button.cjs.entry.js +0 -633
  63. package/dist/cjs/cat-button_3.cjs.entry.js +0 -645
  64. package/dist/cjs/cat-icon-registry-850c538c.js +0 -45
  65. package/dist/cjs/cat-icon.cjs.entry.js +0 -31
  66. package/dist/cjs/cat-spinner.cjs.entry.js +0 -25
  67. package/dist/cjs/css-shim-3bfdba4f.js +0 -6
  68. package/dist/cjs/dom-8ac1ad03.js +0 -75
  69. package/dist/cjs/index-083488c8.js +0 -3065
  70. package/dist/cjs/shadow-css-41d9783d.js +0 -390
  71. package/dist/esm/app-globals-622e4f87.js +0 -704
  72. package/dist/esm/cat-button.entry.js +0 -629
  73. package/dist/esm/cat-button_3.entry.js +0 -639
  74. package/dist/esm/cat-icon-registry-59da2e37.js +0 -43
  75. package/dist/esm/cat-icon.entry.js +0 -27
  76. package/dist/esm/cat-spinner.entry.js +0 -21
  77. package/dist/esm/css-shim-20dbffa5.js +0 -4
  78. package/dist/esm/dom-c5ed0ba5.js +0 -73
  79. package/dist/esm/index-72a1bbba.js +0 -3031
  80. package/dist/esm/shadow-css-8c625855.js +0 -388
@@ -1 +0,0 @@
1
- let e,t,n=!1,l=!1;const s="undefined"!=typeof window?window:{},o=s.document||{head:{}},i={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},c=e=>Promise.resolve(e),r=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),a=(e,t,n)=>{n&&n.map((([n,l,s])=>{const o=e,c=u(t,s),r=f(n);i.ael(o,l,c,r),(t.o=t.o||[]).push((()=>i.rel(o,l,c,r)))}))},u=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){J(e)}},f=e=>0!=(2&e),h=new WeakMap,d=e=>"sc-"+e.h,m={},w=e=>"object"==(e=typeof e)||"function"===e,b=(e,t,...n)=>{let l=null,s=!1,o=!1,i=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!w(l))&&(l+=""),s&&o?i[i.length-1].m+=l:i.push(s?p(null,l):l),o=s)};if(c(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const r=p(e,null);return r.p=t,i.length>0&&(r.$=i),r},p=(e,t)=>({t:0,g:e,m:t,v:null,$:null,p:null}),y={},$=(e,t,n,l,o,c)=>{if(n!==l){let r=G(e,t),a=t.toLowerCase();if("class"===t){const t=e.classList,s=v(n),o=v(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("ref"===t)l&&l(e);else if(r||"o"!==t[0]||"n"!==t[1]){const s=w(l);if((r||s&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&c||o)&&!s&&e.setAttribute(t,l=!0===l?"":l)}else t="-"===t[2]?t.slice(3):G(s,a)?a.slice(2):a[2]+t.slice(3),n&&i.rel(e,t,n,!1),l&&i.ael(e,t,l,!1)}},g=/\s/,v=e=>e?e.split(g):[],j=(e,t,n,l)=>{const s=11===t.v.nodeType&&t.v.host?t.v.host:t.v,o=e&&e.p||m,i=t.p||m;for(l in o)l in i||$(s,l,o[l],void 0,n,t.t);for(l in i)$(s,l,o[l],i[l],n,t.t)},S=(t,l,s)=>{let i,c,r=l.$[s],a=0;if(null!==r.m)i=r.v=o.createTextNode(r.m);else{if(n||(n="svg"===r.g),i=r.v=o.createElementNS(n?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",r.g),n&&"foreignObject"===r.g&&(n=!1),j(null,r,n),null!=e&&i["s-si"]!==e&&i.classList.add(i["s-si"]=e),r.$)for(a=0;a<r.$.length;++a)c=S(t,r,a),c&&i.appendChild(c);"svg"===r.g?n=!1:"foreignObject"===i.tagName&&(n=!0)}return i},O=(e,n,l,s,o,i)=>{let c,r=e;for(r.shadowRoot&&r.tagName===t&&(r=r.shadowRoot);o<=i;++o)s[o]&&(c=S(null,l,o),c&&(s[o].v=c,r.insertBefore(c,n)))},M=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.v,I(l),s.remove())},C=(e,t)=>e.g===t.g,k=(e,t)=>{const l=t.v=e.v,s=e.$,o=t.$,i=t.g,c=t.m;null===c?(n="svg"===i||"foreignObject"!==i&&n,"slot"===i||j(e,t,n),null!==s&&null!==o?((e,t,n,l)=>{let s,o=0,i=0,c=t.length-1,r=t[0],a=t[c],u=l.length-1,f=l[0],h=l[u];for(;o<=c&&i<=u;)null==r?r=t[++o]:null==a?a=t[--c]:null==f?f=l[++i]:null==h?h=l[--u]:C(r,f)?(k(r,f),r=t[++o],f=l[++i]):C(a,h)?(k(a,h),a=t[--c],h=l[--u]):C(r,h)?(k(r,h),e.insertBefore(r.v,a.v.nextSibling),r=t[++o],h=l[--u]):C(a,f)?(k(a,f),e.insertBefore(a.v,r.v),a=t[--c],f=l[++i]):(s=S(t&&t[i],n,i),f=l[++i],s&&r.v.parentNode.insertBefore(s,r.v));o>c?O(e,null==l[u+1]?null:l[u+1].v,n,l,i,u):i>u&&M(t,o,c)})(l,s,t,o):null!==o?(null!==e.m&&(l.textContent=""),O(l,null,t,o,0,o.length-1)):null!==s&&M(s,0,s.length-1),n&&"svg"===i&&(n=!1)):e.m!==c&&(l.data=c)},I=e=>{e.p&&e.p.ref&&e.p.ref(null),e.$&&e.$.map(I)},N=(e,t,n)=>{const l=(e=>z(e).j)(e);return{emit:e=>E(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},E=(e,t,n)=>{const l=i.ce(t,n);return e.dispatchEvent(l),l},P=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},x=(e,t)=>{if(e.t|=16,!(4&e.t))return P(e,e.O),se((()=>W(e,t)));e.t|=512},W=(e,t)=>{const n=e.i;let l;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>U(n,e,t))),e.u=null),l=U(n,"componentWillLoad")),l=q(l,(()=>U(n,"componentWillRender"))),q(l,(()=>L(e,n,t)))},L=async(e,t,n)=>{const l=e.j,s=l["s-rc"];n&&(e=>{const t=e.M,n=e.j,l=t.t,s=((e,t)=>{let n=d(t),l=X.get(n);if(e=11===e.nodeType?e:o,l)if("string"==typeof l){let t,s=h.get(e=e.head||e);s||h.set(e,s=new Set),s.has(n)||(t=o.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),s&&s.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(e);R(e,t),s&&(s.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>T(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},R=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.C||p(null,null),i=(e=>e&&e.g===y)(l)?l:b(null,null,l);t=s.tagName,i.g=null,i.t|=4,n.C=i,i.v=o.v=s.shadowRoot||s,e=s["s-sc"],k(o,i)})(n,l)}catch(e){J(e,n.j)}return null},T=e=>{const t=e.j,n=e.O;64&e.t||(e.t|=64,F(t),e.k(t),n||A()),e.I(t),e.S&&(e.S(),e.S=void 0),512&e.t&&le((()=>x(e,!1))),e.t&=-517},A=()=>{F(o.documentElement),le((()=>E(s,"appload",{detail:{namespace:"catalyst"}})))},U=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){J(e)}},q=(e,t)=>e&&e.then?e.then(t):t(),F=e=>e.classList.add("hydrated"),H=(e,t,n)=>{if(t.N){e.watchers&&(t.P=e.watchers);const l=Object.entries(t.N),s=e.prototype;if(l.map((([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(s,e,{get(){return((e,t)=>z(this).W.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=z(e),o=s.j,i=s.W.get(t),c=s.t,r=s.i;if(n=((e,t)=>null==e||w(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(n,l.N[t][0]),!(8&c&&void 0!==i||n===i)&&(s.W.set(t,n),r)){if(l.P&&128&c){const e=l.P[t];e&&e.map((e=>{try{r[e](n,i,t)}catch(e){J(e,o)}}))}2==(18&c)&&x(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(s,e,{value(...t){const n=z(this);return n.L.then((()=>n.i[e](...t)))}})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){i.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},V=(e,t={})=>{const n=[],l=t.exclude||[],c=s.customElements,u=o.head,f=u.querySelector("meta[charset]"),h=o.createElement("style"),m=[];let w,b=!0;Object.assign(i,t),i.l=new URL(t.resourcesUrl||"./",o.baseURI).href,e.map((e=>{e[1].map((t=>{const s={t:t[0],h:t[1],N:t[2],R:t[3]};s.N=t[2],s.R=t[3],s.P={};const o=s.h,u=class extends HTMLElement{constructor(e){super(e),D(e=this,s),1&s.t&&e.attachShadow({mode:"open"})}connectedCallback(){w&&(clearTimeout(w),w=null),b?m.push(this):i.jmp((()=>(e=>{if(0==(1&i.t)){const t=z(e),n=t.M,l=()=>{};if(1&t.t)a(e,t,n.R);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){P(t,t.O=n);break}}n.N&&Object.entries(n.N).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=Q(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.P=s.watchers,H(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){J(e)}t.t&=-9,t.t|=128,e()}if(s.style){let e=s.style;const t=d(n);if(!X.has(t)){const l=()=>{};((e,t,n)=>{let l=X.get(e);r&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,X.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.O,i=()=>x(t,!0);o&&o["s-rc"]?o["s-rc"].push(i):i()})(0,t,n)}l()}})(this)))}disconnectedCallback(){i.jmp((()=>(()=>{if(0==(1&i.t)){const e=z(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return z(this).T}};s.A=e[0],l.includes(o)||c.get(o)||(n.push(o),c.define(o,H(u,s,1)))}))})),h.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",h.setAttribute("data-styles",""),u.insertBefore(h,f?f.nextSibling:u.firstChild),b=!1,m.length?m.map((e=>e.connectedCallback())):i.jmp((()=>w=setTimeout(A,30)))},_=new WeakMap,z=e=>_.get(e),B=(e,t)=>_.set(t.i=e,t),D=(e,t)=>{const n={t:0,j:e,M:t,W:new Map};return n.L=new Promise((e=>n.I=e)),n.T=new Promise((e=>n.k=e)),e["s-p"]=[],e["s-rc"]=[],a(e,n,t.R),_.set(e,n)},G=(e,t)=>t in e,J=(e,t)=>(0,console.error)(e,t),K=new Map,Q=e=>{const t=e.h.replace(/-/g,"_"),n=e.A,l=K.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(K.set(n,e),e[t])),J)},X=new Map,Y=[],Z=[],ee=(e,t)=>n=>{e.push(n),l||(l=!0,t&&4&i.t?le(ne):i.raf(ne))},te=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){J(e)}e.length=0},ne=()=>{te(Y),te(Z),(l=Y.length>0)&&i.raf(ne)},le=e=>c().then(e),se=ee(Z,!0);class oe{constructor(){this.icons=new Map}static getInstance(){return oe.instance||(oe.instance=new oe),oe.instance}getIcon(e,t){return this.icons.get(this.buildName(e,t))}addIcon(e,t,n){this.icons.set(this.buildName(e,n),t),window.dispatchEvent(this.buildEvent("cat-icon-added",{name:e,setName:n}))}addIcons(e,t){Object.entries(e).forEach((([e,n])=>this.icons.set(this.buildName(e,t),n))),window.dispatchEvent(this.buildEvent("cat-icons-added",{names:Object.keys(e),setName:t}))}removeIcon(e,t){this.icons.delete(this.buildName(e,t)),window.dispatchEvent(this.buildEvent("cat-icon-removed",{name:e,setName:t}))}removeIcons(e,t){e.forEach((e=>this.icons.delete(this.buildName(e,t)))),window.dispatchEvent(this.buildEvent("cat-icons-removed",{names:e,setName:t}))}buildName(e,t){return t?t+":name":e}buildEvent(e,t){return new CustomEvent(e,{bubbles:!0,composed:!0,detail:t})}}export{oe as C,V as b,N as c,b as h,c as p,B as r}
@@ -1 +0,0 @@
1
- import{r as t,c as n,h as i,C as o}from"./p-17a20657.js";var e,a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=(function(t){var n,i;n=a,i=function(){var t=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"];function e(t,n){var i=t[n];if("function"==typeof i.bind)return i.bind(t);try{return Function.prototype.bind.call(i,t)}catch(n){return function(){return Function.prototype.apply.apply(i,[t,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function r(o){return"debug"===o&&(o="log"),typeof console!==n&&("trace"===o&&i?a:void 0!==console[o]?e(console,o):void 0!==console.log?e(console,"log"):t)}function s(n,i){for(var e=0;e<o.length;e++){var a=o[e];this[a]=e<n?t:this.methodFactory(a,n,i)}this.log=this.debug}function c(t,i,o){return function(){typeof console!==n&&(s.call(this,i,o),this[t].apply(this,arguments))}}function l(t,n,i){return r(t)||c.apply(this,arguments)}function u(t,i,e){var a,r=this;i=null==i?"WARN":i;var c="loglevel";function u(){var t;if(typeof window!==n&&c){try{t=window.localStorage[c]}catch(t){}if(typeof t===n)try{var i=window.document.cookie,o=i.indexOf(encodeURIComponent(c)+"=");-1!==o&&(t=/^([^;]+)/.exec(i.slice(o))[1])}catch(t){}return void 0===r.levels[t]&&(t=void 0),t}}"string"==typeof t?c+=":"+t:"symbol"==typeof t&&(c=void 0),r.name=t,r.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},r.methodFactory=e||l,r.getLevel=function(){return a},r.setLevel=function(i,e){if("string"==typeof i&&void 0!==r.levels[i.toUpperCase()]&&(i=r.levels[i.toUpperCase()]),!("number"==typeof i&&i>=0&&i<=r.levels.SILENT))throw"log.setLevel() called with invalid level: "+i;if(a=i,!1!==e&&function(t){var i=(o[t]||"silent").toUpperCase();if(typeof window!==n&&c){try{return void(window.localStorage[c]=i)}catch(t){}try{window.document.cookie=encodeURIComponent(c)+"="+i+";"}catch(t){}}}(i),s.call(r,i,t),typeof console===n&&i<r.levels.SILENT)return"No console available for logging"},r.setDefaultLevel=function(t){i=t,u()||r.setLevel(t,!1)},r.resetLevel=function(){r.setLevel(i,!1),function(){if(typeof window!==n&&c){try{return void window.localStorage.removeItem(c)}catch(t){}try{window.document.cookie=encodeURIComponent(c)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}()},r.enableAll=function(t){r.setLevel(r.levels.TRACE,t)},r.disableAll=function(t){r.setLevel(r.levels.SILENT,t)};var d=u();null==d&&(d=i),r.setLevel(d,!1)}var d=new u,h={};d.getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var n=h[t];return n||(n=h[t]=new u(t,d.getLevel(),d.methodFactory)),n};var b=typeof window!==n?window.log:void 0;return d.noConflict=function(){return typeof window!==n&&window.log===d&&(window.log=b),d},d.getLoggers=function(){return h},d.default=d,d},t.exports?t.exports=i():n.log=i()}(e={path:undefined,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}}),e.exports);const s=["xs","s","m","l","xl"],c={xs:"(max-width: 539.98px)",s:"(max-width: 767.98px)",m:"(max-width: 991.98px)",l:"(max-width: 1199.98px)",xl:"(max-width: 1399.98px)"};let l;try{l="undefined"!=typeof Intl&&Intl.v8BreakIterator}catch(t){l=!1}class u{constructor(){this.EDGE=/(edge)/i.test(navigator.userAgent),this.TRIDENT=/(msie|trident)/i.test(navigator.userAgent),this.BLINK=!(!window.chrome&&!l||"undefined"==typeof CSS||this.EDGE||this.TRIDENT),this.WEBKIT=/AppleWebKit/i.test(navigator.userAgent)&&!this.BLINK&&!this.EDGE&&!this.TRIDENT,this.IOS=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!("MSStream"in window),this.FIREFOX=/(firefox|minefield)/i.test(navigator.userAgent),this.ANDROID=/android/i.test(navigator.userAgent)&&!this.TRIDENT,this.SAFARI=/safari/i.test(navigator.userAgent)&&this.WEBKIT}}const d=new Set;let h;class b{constructor(){this._platform=new u,this._matchMedia=window.matchMedia.bind(window)}matchMedia(t){return(this._platform.WEBKIT||this._platform.BLINK)&&function(t){if(!d.has(t))try{h||(h=document.createElement("style"),h.setAttribute("type","text/css"),document.head.appendChild(h)),h.sheet&&(h.sheet.insertRule(`@media ${t} {body{ }}`,0),d.add(t))}catch(t){r.error(t)}}(t),this._matchMedia(t)}}let f=class{constructor(i){t(this,i),this.catFocus=n(this,"catFocus",7),this.catBlur=n(this,"catBlur",7),this._iconOnly=!0,this.variant="filled",this.color="primary",this.size="m",this.disabled=!1,this.loading=!1,this.submit=!1,this.ellipsed=!0,this.round=!1,this.iconOnly=!1,this.iconSuffix=!1}onIconOnlyChanged(t){var n,i;null===(n=this.mediaQueryList)||void 0===n||n.removeEventListener("change",this.mediaQueryListener),this.mediaQueryList=void 0,this.mediaQueryListener=void 0,function(t){return"string"==typeof t&&s.includes(t)}(t)?(null!==(i=this.mediaMatcher)&&void 0!==i||(this.mediaMatcher=new b),this.mediaQueryList=this.mediaMatcher.matchMedia(c[t]),this.mediaQueryListener=t=>this._iconOnly=t.matches,this.mediaQueryList.addEventListener("change",this.mediaQueryListener),this._iconOnly=this.mediaQueryList.matches):this._iconOnly=t}componentWillLoad(){this.onIconOnlyChanged(this.iconOnly)}componentWillRender(){this.isIconButton&&!this.a11yLabel&&r.warn("[A11y] Missing ARIA label on icon button",this)}haltDisabledEvents(t){(this.disabled||this.loading)&&(t.preventDefault(),t.stopImmediatePropagation())}async setFocus(t){this.button.focus(t)}render(){var t;return this.url?i("a",{ref:t=>this.button=t,href:this.disabled?void 0:this.url,target:this.urlTarget,"aria-disabled":this.disabled?"true":null,"aria-label":this.a11yLabel,id:this.buttonId,part:"button",class:{"cat-button":!0,"cat-button-icon":this.isIconButton,"cat-button-round":this.round,"cat-button-loading":this.loading,"cat-button-disabled":this.disabled,"cat-button-ellipsed":this.ellipsed&&!this.isIconButton,[`cat-button-${this.variant}`]:Boolean(this.variant),[`cat-button-${this.color}`]:Boolean(this.color),[`cat-button-${this.size}`]:Boolean(this.size)},onFocus:this.onFocus.bind(this),onBlur:this.onBlur.bind(this)},this.content):i("button",{ref:t=>this.button=t,type:this.submit?"submit":"button",name:this.name,value:this.value,disabled:this.disabled,"aria-disabled":this.disabled?"true":null,"aria-label":this.a11yLabel,id:this.buttonId,part:"button",class:{"cat-button":!0,"cat-button-icon":this.isIconButton,"cat-button-round":null!==(t=this.round)&&void 0!==t?t:this.isIconButton,"cat-button-loading":this.loading,"cat-button-disabled":this.disabled,"cat-button-ellipsed":this.ellipsed&&!this.isIconButton,[`cat-button-${this.variant}`]:Boolean(this.variant),[`cat-button-${this.color}`]:Boolean(this.color),[`cat-button-${this.size}`]:Boolean(this.size)},onFocus:this.onFocus.bind(this),onBlur:this.onBlur.bind(this)},this.content)}get iconSize(){switch(this.size){case"xs":return"s";default:return"l"}}get spinnerSize(){switch(this.size){case"xs":return"xs";default:return"m"}}get isIconButton(){return Boolean(this.icon)&&this._iconOnly}get hasPrefixIcon(){return Boolean(this.icon)&&!this._iconOnly&&!this.iconSuffix}get hasSuffixIcon(){return Boolean(this.icon)&&!this._iconOnly&&this.iconSuffix}get content(){return[this.hasPrefixIcon?i("cat-icon",{icon:this.icon,size:this.iconSize,class:"cat-button-prefix",part:"prefix"}):null,this.isIconButton?i("cat-icon",{icon:this.icon,size:this.iconSize}):i("span",{class:"cat-button-content",part:"content"},i("slot",null)),this.hasSuffixIcon?i("cat-icon",{icon:this.icon,size:this.iconSize,class:"cat-button-suffix",part:"suffix"}):null,this.loading?i("cat-spinner",{size:this.spinnerSize}):null]}onFocus(t){this.catFocus.emit(t)}onBlur(t){this.catBlur.emit(t)}static get watchers(){return{iconOnly:["onIconOnlyChanged"]}}};f.style=":host{display:inline-block;max-width:100%;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host[hidden]{display:none}.cat-button{font:inherit;display:flex;align-items:center;justify-content:center;border:none;border-radius:0.25rem;text-decoration:none;width:100%;box-sizing:border-box;cursor:pointer;transition:color 0.13s linear, border-color 0.13s linear, background-color 0.13s linear, box-shadow 0.13s linear}.cat-button:focus-visible{outline:2px solid #0071ff;outline-offset:1px}.cat-button-content{flex:1 1 auto;text-align:center}.cat-button-ellipsed .cat-button-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-button-disabled{cursor:not-allowed;opacity:0.65;filter:grayscale(100%)}.cat-button-round{border-radius:10rem}.cat-button-loading{cursor:default}.cat-button-loading cat-spinner{position:absolute}.cat-button-loading>*:not(cat-spinner){visibility:hidden}.cat-button-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-button-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--base), 0.2);color:rgb(var(--text))}.cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.05)}.cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-text{background-color:transparent;color:rgb(var(--text));text-decoration:none}.cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:underline}.cat-button-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 32, 127, 138);--base:var(--cat-primary-text, 32, 127, 138)}.cat-button-primary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-hover, 28, 112, 122);--fill:var(--cat-primary-fill-hover, 255, 255, 255);--text:var(--cat-primary-text-hover, 28, 112, 122)}.cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-active, 25, 101, 110);--fill:var(--cat-primary-fill-active, 255, 255, 255);--text:var(--cat-primary-text-active, 25, 101, 110)}.cat-button-secondary{--bg:248, 248, 251;--fill:0, 0, 0;--text:0, 0, 0;--base:248, 248, 251}.cat-button-secondary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:235, 236, 240;--fill:0, 0, 0;--text:0, 0, 0}.cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:235, 236, 240;--fill:0, 0, 0;--text:0, 0, 0}.cat-button-success{--bg:0, 132, 88;--fill:255, 255, 255;--text:0, 132, 88;--base:0, 132, 88}.cat-button-success:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:0, 117, 78;--fill:255, 255, 255;--text:0, 117, 78}.cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:0, 105, 70;--fill:255, 255, 255;--text:0, 105, 70}.cat-button-warning{--bg:255, 206, 128;--fill:0, 0, 0;--text:159, 97, 0;--base:159, 97, 0}.cat-button-warning:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:255, 214, 148;--fill:0, 0, 0;--text:159, 97, 0}.cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:255, 222, 168;--fill:0, 0, 0;--text:159, 97, 0}.cat-button-danger{--bg:217, 52, 13;--fill:255, 255, 255;--text:217, 52, 13;--base:217, 52, 13}.cat-button-danger:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:194, 46, 11;--fill:255, 255, 255;--text:194, 46, 11}.cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:174, 42, 10;--fill:255, 255, 255;--text:174, 42, 10}.cat-button-xs{min-width:1.5rem;padding:0.25rem 0.25rem;font-size:0.875rem;line-height:1rem}.cat-button-xs .cat-button-prefix{margin-right:0.25rem}.cat-button-xs .cat-button-suffix{margin-left:0.25rem}.cat-button-xs.cat-button-icon{width:1.5rem;padding-left:0;padding-right:0}.cat-button-s{min-width:2rem;padding:0.375rem 0.5rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-s .cat-button-prefix{margin-right:0.25rem}.cat-button-s .cat-button-suffix{margin-left:0.25rem}.cat-button-s cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-s.cat-button-icon{width:2rem;padding-left:0;padding-right:0}.cat-button-m{min-width:2.5rem;padding:0.625rem 0.75rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-m .cat-button-prefix{margin-right:0.25rem}.cat-button-m .cat-button-suffix{margin-left:0.25rem}.cat-button-m cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-m.cat-button-icon{width:2.5rem;padding-left:0;padding-right:0}.cat-button-l{min-width:3rem;padding:0.875rem 1rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-l .cat-button-prefix{margin-right:0.25rem}.cat-button-l .cat-button-suffix{margin-left:0.25rem}.cat-button-l cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-l.cat-button-icon{width:3rem;padding-left:0;padding-right:0}.cat-button-xl{min-width:3.5rem;padding:1rem 1.25rem;font-size:1.125rem;line-height:1.5rem}.cat-button-xl .cat-button-prefix{margin-right:0.25rem}.cat-button-xl .cat-button-suffix{margin-left:0.25rem}.cat-button-xl.cat-button-icon{width:3.5rem;padding-left:0;padding-right:0}";let g=class{constructor(n){t(this,n),this.iconRegistry=o.getInstance(),this.icon="",this.size="m"}render(){return i("span",{innerHTML:this.iconRegistry.getIcon(this.icon),"aria-label":this.a11yLabel,"aria-hidden":this.a11yLabel?null:"true",part:"icon",class:{[`cat-icon-${this.size}`]:"inline"!==this.size}})}};g.style=":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host[hidden]{display:none}span{display:inline-flex}svg{fill:currentColor;stroke:none;transform-origin:center center;width:1em;height:1em}.cat-icon-xs svg{font-size:0.75rem}.cat-icon-s svg{font-size:1rem}.cat-icon-m svg{font-size:1.25rem}.cat-icon-l svg{font-size:1.5rem}.cat-icon-xl svg{font-size:1.75rem}";let m=class{constructor(n){t(this,n),this.size="m"}render(){return i("span",{"aria-label":this.a11yLabel,"aria-hidden":this.a11yLabel?null:"true",class:{[`cat-spinner-${this.size}`]:"inline"!==this.size}},i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48"},i("circle",{cx:"24",cy:"24",r:"21.5"})))}};m.style=":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host[hidden]{display:none}span{display:inline-flex}svg{fill:none;stroke:currentColor;stroke-dasharray:135px;stroke-dashoffset:95px;stroke-linecap:round;stroke-width:5px;transform-origin:center center;animation:cat-spinner 0.75s cubic-bezier(0.4, 0.15, 0.6, 0.85) infinite;width:1em;height:1em}.cat-spinner-xs svg{font-size:0.75rem}.cat-spinner-s svg{font-size:1rem}.cat-spinner-m svg{font-size:1.25rem}.cat-spinner-l svg{font-size:1.5rem}.cat-spinner-xl svg{font-size:1.75rem}@keyframes cat-spinner{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}";export{f as cat_button,g as cat_icon,m as cat_spinner}
@@ -1,388 +0,0 @@
1
- /*
2
- Stencil Client Platform v2.13.0 | MIT Licensed | https://stenciljs.com
3
- */
4
- /**
5
- * @license
6
- * Copyright Google Inc. All Rights Reserved.
7
- *
8
- * Use of this source code is governed by an MIT-style license that can be
9
- * found in the LICENSE file at https://angular.io/license
10
- *
11
- * This file is a port of shadowCSS from webcomponents.js to TypeScript.
12
- * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
13
- * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
14
- */
15
- const safeSelector = (selector) => {
16
- const placeholders = [];
17
- let index = 0;
18
- let content;
19
- // Replaces attribute selectors with placeholders.
20
- // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
21
- selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
22
- const replaceBy = `__ph-${index}__`;
23
- placeholders.push(keep);
24
- index++;
25
- return replaceBy;
26
- });
27
- // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
28
- // WS and "+" would otherwise be interpreted as selector separators.
29
- content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
30
- const replaceBy = `__ph-${index}__`;
31
- placeholders.push(exp);
32
- index++;
33
- return pseudo + replaceBy;
34
- });
35
- const ss = {
36
- content,
37
- placeholders,
38
- };
39
- return ss;
40
- };
41
- const restoreSafeSelector = (placeholders, content) => {
42
- return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
43
- };
44
- const _polyfillHost = '-shadowcsshost';
45
- const _polyfillSlotted = '-shadowcssslotted';
46
- // note: :host-context pre-processed to -shadowcsshostcontext.
47
- const _polyfillHostContext = '-shadowcsscontext';
48
- const _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
49
- const _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
50
- const _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
51
- const _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim');
52
- const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
53
- const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
54
- const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
55
- const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
56
- const _polyfillHostRe = /-shadowcsshost/gim;
57
- const _colonHostRe = /:host/gim;
58
- const _colonSlottedRe = /::slotted/gim;
59
- const _colonHostContextRe = /:host-context/gim;
60
- const _commentRe = /\/\*\s*[\s\S]*?\*\//g;
61
- const stripComments = (input) => {
62
- return input.replace(_commentRe, '');
63
- };
64
- const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
65
- const extractCommentsWithHash = (input) => {
66
- return input.match(_commentWithHashRe) || [];
67
- };
68
- const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
69
- const _curlyRe = /([{}])/g;
70
- const _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
71
- const OPEN_CURLY = '{';
72
- const CLOSE_CURLY = '}';
73
- const BLOCK_PLACEHOLDER = '%BLOCK%';
74
- const processRules = (input, ruleCallback) => {
75
- const inputWithEscapedBlocks = escapeBlocks(input);
76
- let nextBlockIndex = 0;
77
- return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
78
- const selector = m[2];
79
- let content = '';
80
- let suffix = m[4];
81
- let contentPrefix = '';
82
- if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
83
- content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
84
- suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
85
- contentPrefix = '{';
86
- }
87
- const cssRule = {
88
- selector,
89
- content,
90
- };
91
- const rule = ruleCallback(cssRule);
92
- return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
93
- });
94
- };
95
- const escapeBlocks = (input) => {
96
- const inputParts = input.split(_curlyRe);
97
- const resultParts = [];
98
- const escapedBlocks = [];
99
- let bracketCount = 0;
100
- let currentBlockParts = [];
101
- for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
102
- const part = inputParts[partIndex];
103
- if (part === CLOSE_CURLY) {
104
- bracketCount--;
105
- }
106
- if (bracketCount > 0) {
107
- currentBlockParts.push(part);
108
- }
109
- else {
110
- if (currentBlockParts.length > 0) {
111
- escapedBlocks.push(currentBlockParts.join(''));
112
- resultParts.push(BLOCK_PLACEHOLDER);
113
- currentBlockParts = [];
114
- }
115
- resultParts.push(part);
116
- }
117
- if (part === OPEN_CURLY) {
118
- bracketCount++;
119
- }
120
- }
121
- if (currentBlockParts.length > 0) {
122
- escapedBlocks.push(currentBlockParts.join(''));
123
- resultParts.push(BLOCK_PLACEHOLDER);
124
- }
125
- const strEscapedBlocks = {
126
- escapedString: resultParts.join(''),
127
- blocks: escapedBlocks,
128
- };
129
- return strEscapedBlocks;
130
- };
131
- const insertPolyfillHostInCssText = (selector) => {
132
- selector = selector
133
- .replace(_colonHostContextRe, _polyfillHostContext)
134
- .replace(_colonHostRe, _polyfillHost)
135
- .replace(_colonSlottedRe, _polyfillSlotted);
136
- return selector;
137
- };
138
- const convertColonRule = (cssText, regExp, partReplacer) => {
139
- // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
140
- return cssText.replace(regExp, (...m) => {
141
- if (m[2]) {
142
- const parts = m[2].split(',');
143
- const r = [];
144
- for (let i = 0; i < parts.length; i++) {
145
- const p = parts[i].trim();
146
- if (!p)
147
- break;
148
- r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
149
- }
150
- return r.join(',');
151
- }
152
- else {
153
- return _polyfillHostNoCombinator + m[3];
154
- }
155
- });
156
- };
157
- const colonHostPartReplacer = (host, part, suffix) => {
158
- return host + part.replace(_polyfillHost, '') + suffix;
159
- };
160
- const convertColonHost = (cssText) => {
161
- return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
162
- };
163
- const colonHostContextPartReplacer = (host, part, suffix) => {
164
- if (part.indexOf(_polyfillHost) > -1) {
165
- return colonHostPartReplacer(host, part, suffix);
166
- }
167
- else {
168
- return host + part + suffix + ', ' + part + ' ' + host + suffix;
169
- }
170
- };
171
- const convertColonSlotted = (cssText, slotScopeId) => {
172
- const slotClass = '.' + slotScopeId + ' > ';
173
- const selectors = [];
174
- cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
175
- if (m[2]) {
176
- const compound = m[2].trim();
177
- const suffix = m[3];
178
- const slottedSelector = slotClass + compound + suffix;
179
- let prefixSelector = '';
180
- for (let i = m[4] - 1; i >= 0; i--) {
181
- const char = m[5][i];
182
- if (char === '}' || char === ',') {
183
- break;
184
- }
185
- prefixSelector = char + prefixSelector;
186
- }
187
- const orgSelector = prefixSelector + slottedSelector;
188
- const addedSelector = `${prefixSelector.trimRight()}${slottedSelector.trim()}`;
189
- if (orgSelector.trim() !== addedSelector.trim()) {
190
- const updatedSelector = `${addedSelector}, ${orgSelector}`;
191
- selectors.push({
192
- orgSelector,
193
- updatedSelector,
194
- });
195
- }
196
- return slottedSelector;
197
- }
198
- else {
199
- return _polyfillHostNoCombinator + m[3];
200
- }
201
- });
202
- return {
203
- selectors,
204
- cssText,
205
- };
206
- };
207
- const convertColonHostContext = (cssText) => {
208
- return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
209
- };
210
- const convertShadowDOMSelectors = (cssText) => {
211
- return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText);
212
- };
213
- const makeScopeMatcher = (scopeSelector) => {
214
- const lre = /\[/g;
215
- const rre = /\]/g;
216
- scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
217
- return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
218
- };
219
- const selectorNeedsScoping = (selector, scopeSelector) => {
220
- const re = makeScopeMatcher(scopeSelector);
221
- return !re.test(selector);
222
- };
223
- const injectScopingSelector = (selector, scopingSelector) => {
224
- return selector.replace(_selectorPartsRe, (_, before = '', _colonGroup, colon = '', after = '') => {
225
- return before + scopingSelector + colon + after;
226
- });
227
- };
228
- const applySimpleSelectorScope = (selector, scopeSelector, hostSelector) => {
229
- // In Android browser, the lastIndex is not reset when the regex is used in String.replace()
230
- _polyfillHostRe.lastIndex = 0;
231
- if (_polyfillHostRe.test(selector)) {
232
- const replaceBy = `.${hostSelector}`;
233
- return selector
234
- .replace(_polyfillHostNoCombinatorRe, (_, selector) => injectScopingSelector(selector, replaceBy))
235
- .replace(_polyfillHostRe, replaceBy + ' ');
236
- }
237
- return scopeSelector + ' ' + selector;
238
- };
239
- const applyStrictSelectorScope = (selector, scopeSelector, hostSelector) => {
240
- const isRe = /\[is=([^\]]*)\]/g;
241
- scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
242
- const className = '.' + scopeSelector;
243
- const _scopeSelectorPart = (p) => {
244
- let scopedP = p.trim();
245
- if (!scopedP) {
246
- return '';
247
- }
248
- if (p.indexOf(_polyfillHostNoCombinator) > -1) {
249
- scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector);
250
- }
251
- else {
252
- // remove :host since it should be unnecessary
253
- const t = p.replace(_polyfillHostRe, '');
254
- if (t.length > 0) {
255
- scopedP = injectScopingSelector(t, className);
256
- }
257
- }
258
- return scopedP;
259
- };
260
- const safeContent = safeSelector(selector);
261
- selector = safeContent.content;
262
- let scopedSelector = '';
263
- let startIndex = 0;
264
- let res;
265
- const sep = /( |>|\+|~(?!=))\s*/g;
266
- // If a selector appears before :host it should not be shimmed as it
267
- // matches on ancestor elements and not on elements in the host's shadow
268
- // `:host-context(div)` is transformed to
269
- // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
270
- // the `div` is not part of the component in the 2nd selectors and should not be scoped.
271
- // Historically `component-tag:host` was matching the component so we also want to preserve
272
- // this behavior to avoid breaking legacy apps (it should not match).
273
- // The behavior should be:
274
- // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
275
- // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
276
- // `:host-context(tag)`)
277
- const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
278
- // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
279
- let shouldScope = !hasHost;
280
- while ((res = sep.exec(selector)) !== null) {
281
- const separator = res[1];
282
- const part = selector.slice(startIndex, res.index).trim();
283
- shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
284
- const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
285
- scopedSelector += `${scopedPart} ${separator} `;
286
- startIndex = sep.lastIndex;
287
- }
288
- const part = selector.substring(startIndex);
289
- shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
290
- scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
291
- // replace the placeholders with their original values
292
- return restoreSafeSelector(safeContent.placeholders, scopedSelector);
293
- };
294
- const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
295
- return selector
296
- .split(',')
297
- .map((shallowPart) => {
298
- if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) {
299
- return shallowPart.trim();
300
- }
301
- if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
302
- return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
303
- }
304
- else {
305
- return shallowPart.trim();
306
- }
307
- })
308
- .join(', ');
309
- };
310
- const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
311
- return processRules(cssText, (rule) => {
312
- let selector = rule.selector;
313
- let content = rule.content;
314
- if (rule.selector[0] !== '@') {
315
- selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
316
- }
317
- else if (rule.selector.startsWith('@media') ||
318
- rule.selector.startsWith('@supports') ||
319
- rule.selector.startsWith('@page') ||
320
- rule.selector.startsWith('@document')) {
321
- content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector);
322
- }
323
- const cssRule = {
324
- selector: selector.replace(/\s{2,}/g, ' ').trim(),
325
- content,
326
- };
327
- return cssRule;
328
- });
329
- };
330
- const scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) => {
331
- cssText = insertPolyfillHostInCssText(cssText);
332
- cssText = convertColonHost(cssText);
333
- cssText = convertColonHostContext(cssText);
334
- const slotted = convertColonSlotted(cssText, slotScopeId);
335
- cssText = slotted.cssText;
336
- cssText = convertShadowDOMSelectors(cssText);
337
- if (scopeId) {
338
- cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId);
339
- }
340
- cssText = cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
341
- cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, ' $1 ');
342
- return {
343
- cssText: cssText.trim(),
344
- slottedSelectors: slotted.selectors,
345
- };
346
- };
347
- const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
348
- const hostScopeId = scopeId + '-h';
349
- const slotScopeId = scopeId + '-s';
350
- const commentsWithHash = extractCommentsWithHash(cssText);
351
- cssText = stripComments(cssText);
352
- const orgSelectors = [];
353
- if (commentOriginalSelector) {
354
- const processCommentedSelector = (rule) => {
355
- const placeholder = `/*!@___${orgSelectors.length}___*/`;
356
- const comment = `/*!@${rule.selector}*/`;
357
- orgSelectors.push({ placeholder, comment });
358
- rule.selector = placeholder + rule.selector;
359
- return rule;
360
- };
361
- cssText = processRules(cssText, (rule) => {
362
- if (rule.selector[0] !== '@') {
363
- return processCommentedSelector(rule);
364
- }
365
- else if (rule.selector.startsWith('@media') ||
366
- rule.selector.startsWith('@supports') ||
367
- rule.selector.startsWith('@page') ||
368
- rule.selector.startsWith('@document')) {
369
- rule.content = processRules(rule.content, processCommentedSelector);
370
- return rule;
371
- }
372
- return rule;
373
- });
374
- }
375
- const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId);
376
- cssText = [scoped.cssText, ...commentsWithHash].join('\n');
377
- if (commentOriginalSelector) {
378
- orgSelectors.forEach(({ placeholder, comment }) => {
379
- cssText = cssText.replace(placeholder, comment);
380
- });
381
- }
382
- scoped.slottedSelectors.forEach((slottedSelector) => {
383
- cssText = cssText.replace(slottedSelector.orgSelector, slottedSelector.updatedSelector);
384
- });
385
- return cssText;
386
- };
387
-
388
- export { scopeCss };