@mgdis/stencil-helpers 1.0.0

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.
@@ -0,0 +1,2 @@
1
+ (function($,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):($=typeof globalThis<"u"?globalThis:$||self,y($.StencilHelpersModule={}))})(this,function($){"use strict";var Ue=Object.defineProperty;var ze=($,y,S)=>y in $?Ue($,y,{enumerable:!0,configurable:!0,writable:!0,value:S}):$[y]=S;var h=($,y,S)=>(ze($,typeof y!="symbol"?y+"":y,S),S);const y={allRenderFn:!1,cmpDidLoad:!0,cmpDidUnload:!1,cmpDidUpdate:!0,cmpDidRender:!0,cmpWillLoad:!0,cmpWillUpdate:!0,cmpWillRender:!0,connectedCallback:!0,disconnectedCallback:!0,element:!0,event:!0,hasRenderFn:!0,lifecycle:!0,hostListener:!0,hostListenerTargetWindow:!0,hostListenerTargetDocument:!0,hostListenerTargetBody:!0,hostListenerTargetParent:!1,hostListenerTarget:!0,member:!0,method:!0,mode:!0,observeAttribute:!0,prop:!0,propMutable:!0,reflect:!0,scoped:!0,shadowDom:!0,slot:!0,cssAnnotations:!0,state:!0,style:!0,formAssociated:!1,svg:!0,updatable:!0,vdomAttribute:!0,vdomXlink:!0,vdomClass:!0,vdomFunctional:!0,vdomKey:!0,vdomListener:!0,vdomRef:!0,vdomPropOrAttr:!0,vdomRender:!0,vdomStyle:!0,vdomText:!0,watchCallback:!0,taskQueue:!0,hotModuleReplacement:!1,isDebug:!1,isDev:!1,isTesting:!1,hydrateServerSide:!1,hydrateClientSide:!1,lifecycleDOMEvents:!1,lazyLoad:!1,profile:!1,slotRelocation:!0,appendChildSlotFix:!1,cloneNodeFix:!1,hydratedAttribute:!1,hydratedClass:!0,scriptDataOpts:!1,scopedSlotTextContentFix:!1,shadowDomShim:!1,slotChildNodesFix:!1,invisiblePrehydration:!0,propBoolean:!0,propNumber:!0,propString:!0,constructableCSS:!0,cmpShouldUpdate:!0,devTools:!1,shadowDelegatesFocus:!0,initializeNextTick:!1,asyncLoading:!1,asyncQueue:!1,transformTagName:!1,attachStyles:!0,experimentalSlotFixes:!1};let S,_,A,C=!1,R=!1,N=!1,v=!1;const W="http://www.w3.org/1999/xlink",U={},ie="http://www.w3.org/2000/svg",ce="http://www.w3.org/1999/xhtml",ae=e=>e!=null,z=e=>(e=typeof e,e==="object"||e==="function"),I=(e,t,...n)=>{let s=null,l=null,r=null,o=!1,c=!1;const i=[],g=a=>{for(let u=0;u<a.length;u++)s=a[u],Array.isArray(s)?g(s):s!=null&&typeof s!="boolean"&&((o=typeof e!="function"&&!z(s))&&(s=String(s)),o&&c?i[i.length-1].$text$+=s:i.push(o?x(null,s):s),c=o)};if(g(n),t){t.key&&(l=t.key),t.name&&(r=t.name);{const a=t.className||t.class;a&&(t.class=typeof a!="object"?a:Object.keys(a).filter(u=>a[u]).join(" "))}}if(typeof e=="function")return e(t===null?{}:t,i,ue);const d=x(e,null);return d.$attrs$=t,i.length>0&&(d.$children$=i),d.$key$=l,d.$name$=r,d},x=(e,t)=>{const n={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null};return n.$attrs$=null,n.$key$=null,n.$name$=null,n},fe={},$e=e=>e&&e.$tag$===fe,ue={forEach:(e,t)=>e.map(X).forEach(t),map:(e,t)=>e.map(X).map(t).map(de)},X=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),de=e=>{if(typeof e.vtag=="function"){const n=Object.assign({},e.vattrs);return e.vkey&&(n.key=e.vkey),e.vname&&(n.name=e.vname),I(e.vtag,n,...e.vchildren||[])}const t=x(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},q=(e,t,n,s,l,r)=>{if(n!==s){let o=se(e,t),c=t.toLowerCase();if(t==="class"){const i=e.classList,g=G(n),d=G(s);i.remove(...g.filter(a=>a&&!d.includes(a))),i.add(...d.filter(a=>a&&!g.includes(a)))}else if(t==="style"){for(const i in n)(!s||s[i]==null)&&(i.includes("-")?e.style.removeProperty(i):e.style[i]="");for(const i in s)(!n||s[i]!==n[i])&&(i.includes("-")?e.style.setProperty(i,s[i]):e.style[i]=s[i])}else if(t!=="key")if(t==="ref")s&&s(e);else if(!e.__lookupSetter__(t)&&t[0]==="o"&&t[1]==="n"){if(t[2]==="-"?t=t.slice(3):se(H,c)?t=c.slice(2):t=c[2]+t.slice(3),n||s){const i=t.endsWith(K);t=t.replace(pe,""),n&&E.rel(e,t,n,i),s&&E.ael(e,t,s,i)}}else{const i=z(s);if((o||i&&s!==null)&&!l)try{if(e.tagName.includes("-"))e[t]=s;else{const d=s??"";t==="list"?o=!1:(n==null||e[t]!=d)&&(e[t]=d)}}catch{}let g=!1;c!==(c=c.replace(/^xlink\:?/,""))&&(t=c,g=!0),s==null||s===!1?(s!==!1||e.getAttribute(t)==="")&&(g?e.removeAttributeNS(W,t):e.removeAttribute(t)):(!o||r&4||l)&&!i&&(s=s===!0?"":s,g?e.setAttributeNS(W,t,s):e.setAttribute(t,s))}}},ge=/\s/,G=e=>e?e.split(ge):[],K="Capture",pe=new RegExp(K+"$"),Q=(e,t,n,s)=>{const l=t.$elm$.nodeType===11&&t.$elm$.host?t.$elm$.host:t.$elm$,r=e&&e.$attrs$||U,o=t.$attrs$||U;for(s in r)s in o||q(l,s,r[s],void 0,n,t.$flags$);for(s in o)q(l,s,r[s],o[s],n,t.$flags$)},O=(e,t,n,s)=>{const l=t.$children$[n];let r=0,o,c,i;if(C||(N=!0,l.$tag$==="slot"&&(S&&s.classList.add(S+"-s"),l.$flags$|=l.$children$?2:1)),l.$text$!==null)o=l.$elm$=D.createTextNode(l.$text$);else if(l.$flags$&1)o=l.$elm$=D.createTextNode("");else{if(v||(v=l.$tag$==="svg"),o=l.$elm$=D.createElementNS(v?ie:ce,l.$flags$&2?"slot-fb":l.$tag$),v&&l.$tag$==="foreignObject"&&(v=!1),Q(null,l,v),ae(S)&&o["s-si"]!==S&&o.classList.add(o["s-si"]=S),l.$children$)for(r=0;r<l.$children$.length;++r)c=O(e,l,r,o),c&&o.appendChild(c);l.$tag$==="svg"?v=!1:o.tagName==="foreignObject"&&(v=!0)}return o["s-hn"]=A,l.$flags$&3&&(o["s-sr"]=!0,o["s-cr"]=_,o["s-sn"]=l.$name$||"",i=e&&e.$children$&&e.$children$[n],i&&i.$tag$===l.$tag$&&e.$elm$&&M(e.$elm$,!1)),o},M=(e,t)=>{E.$flags$|=1;const n=e.childNodes;for(let s=n.length-1;s>=0;s--){const l=n[s];l["s-hn"]!==A&&l["s-ol"]&&(Y(l).insertBefore(l,B(l)),l["s-ol"].remove(),l["s-ol"]=void 0,l["s-sh"]=void 0,N=!0),t&&M(l,t)}E.$flags$&=-2},w=(e,t,n,s,l,r)=>{let o=e["s-cr"]&&e["s-cr"].parentNode||e,c;for(o.shadowRoot&&o.tagName===A&&(o=o.shadowRoot);l<=r;++l)s[l]&&(c=O(null,n,l,e),c&&(s[l].$elm$=c,o.insertBefore(c,B(t))))},J=(e,t,n)=>{for(let s=t;s<=n;++s){const l=e[s];if(l){const r=l.$elm$;te(l),r&&(R=!0,r["s-ol"]?r["s-ol"].remove():M(r,!0),r.remove())}}},he=(e,t,n,s,l=!1)=>{let r=0,o=0,c=0,i=0,g=t.length-1,d=t[0],a=t[g],u=s.length-1,f=s[0],p=s[u],k,b;for(;r<=g&&o<=u;)if(d==null)d=t[++r];else if(a==null)a=t[--g];else if(f==null)f=s[++o];else if(p==null)p=s[--u];else if(j(d,f,l))L(d,f,l),d=t[++r],f=s[++o];else if(j(a,p,l))L(a,p,l),a=t[--g],p=s[--u];else if(j(d,p,l))(d.$tag$==="slot"||p.$tag$==="slot")&&M(d.$elm$.parentNode,!1),L(d,p,l),e.insertBefore(d.$elm$,a.$elm$.nextSibling),d=t[++r],p=s[--u];else if(j(a,f,l))(d.$tag$==="slot"||p.$tag$==="slot")&&M(a.$elm$.parentNode,!1),L(a,f,l),e.insertBefore(a.$elm$,d.$elm$),a=t[--g],f=s[++o];else{for(c=-1,i=r;i<=g;++i)if(t[i]&&t[i].$key$!==null&&t[i].$key$===f.$key$){c=i;break}c>=0?(b=t[c],b.$tag$!==f.$tag$?k=O(t&&t[o],n,c,e):(L(b,f,l),t[c]=void 0,k=b.$elm$),f=s[++o]):(k=O(t&&t[o],n,o,e),f=s[++o]),k&&Y(d.$elm$).insertBefore(k,B(d.$elm$))}r>g?w(e,s[u+1]==null?null:s[u+1].$elm$,n,s,o,u):o>u&&J(t,r,g)},j=(e,t,n=!1)=>e.$tag$===t.$tag$?e.$tag$==="slot"?e.$name$===t.$name$:n?!0:e.$key$===t.$key$:!1,B=e=>e&&e["s-ol"]||e,Y=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,L=(e,t,n=!1)=>{const s=t.$elm$=e.$elm$,l=e.$children$,r=t.$children$,o=t.$tag$,c=t.$text$;let i;c===null?(v=o==="svg"?!0:o==="foreignObject"?!1:v,o==="slot"||Q(e,t,v),l!==null&&r!==null?he(s,l,t,r,n):r!==null?(e.$text$!==null&&(s.textContent=""),w(s,null,t,r,0,r.length-1)):l!==null&&J(l,0,l.length-1),v&&o==="svg"&&(v=!1)):(i=s["s-cr"])?i.parentNode.textContent=c:e.$text$!==c&&(s.data=c)},Z=e=>{const t=e.childNodes;for(const n of t)if(n.nodeType===1){if(n["s-sr"]){const s=n["s-sn"];n.hidden=!1;for(const l of t)if(l!==n){if(l["s-hn"]!==n["s-hn"]||s!==""){if(l.nodeType===1&&(s===l.getAttribute("slot")||s===l["s-sn"])){n.hidden=!0;break}}else if(l.nodeType===1||l.nodeType===3&&l.textContent.trim()!==""){n.hidden=!0;break}}}Z(n)}},T=[],V=e=>{let t,n,s;for(const l of e.childNodes){if(l["s-sr"]&&(t=l["s-cr"])&&t.parentNode){n=t.parentNode.childNodes;const r=l["s-sn"];for(s=n.length-1;s>=0;s--)if(t=n[s],!t["s-cn"]&&!t["s-nr"]&&t["s-hn"]!==l["s-hn"]&&!y.experimentalSlotFixes)if(ee(t,r)){let o=T.find(c=>c.$nodeToRelocate$===t);R=!0,t["s-sn"]=t["s-sn"]||r,o?(o.$nodeToRelocate$["s-sh"]=l["s-hn"],o.$slotRefNode$=l):(t["s-sh"]=l["s-hn"],T.push({$slotRefNode$:l,$nodeToRelocate$:t})),t["s-sr"]&&T.map(c=>{ee(c.$nodeToRelocate$,t["s-sn"])&&(o=T.find(i=>i.$nodeToRelocate$===t),o&&!c.$slotRefNode$&&(c.$slotRefNode$=o.$slotRefNode$))})}else T.some(o=>o.$nodeToRelocate$===t)||T.push({$nodeToRelocate$:t})}l.nodeType===1&&V(l)}},ee=(e,t)=>e.nodeType===1?e.getAttribute("slot")===null&&t===""||e.getAttribute("slot")===t:e["s-sn"]===t?!0:t==="",te=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(te)},ye=(e,t,n=!1)=>{var s,l,r,o,c;const i=e.$hostElement$,g=e.$cmpMeta$,d=e.$vnode$||x(null,null),a=$e(t)?t:I(null,null,t);if(A=i.tagName,g.$attrsToReflect$&&(a.$attrs$=a.$attrs$||{},g.$attrsToReflect$.map(([u,f])=>a.$attrs$[f]=i[u])),n&&a.$attrs$)for(const u of Object.keys(a.$attrs$))i.hasAttribute(u)&&!["key","ref","style","class"].includes(u)&&(a.$attrs$[u]=i[u]);a.$tag$=null,a.$flags$|=4,e.$vnode$=a,a.$elm$=d.$elm$=i.shadowRoot||i,S=i["s-sc"],_=i["s-cr"],C=(g.$flags$&1)!==0,R=!1,L(d,a,n);{if(E.$flags$|=1,N){V(a.$elm$);for(const u of T){const f=u.$nodeToRelocate$;if(!f["s-ol"]){const p=D.createTextNode("");p["s-nr"]=f,f.parentNode.insertBefore(f["s-ol"]=p,f)}}for(const u of T){const f=u.$nodeToRelocate$,p=u.$slotRefNode$;if(p){const k=p.parentNode;let b=p.nextSibling;{let F=(s=f["s-ol"])===null||s===void 0?void 0:s.previousSibling;for(;F;){let m=(l=F["s-nr"])!==null&&l!==void 0?l:null;if(m&&m["s-sn"]===f["s-sn"]&&k===m.parentNode&&(m=m.nextSibling,!m||!m["s-nr"])){b=m;break}F=F.previousSibling}}(!b&&k!==f.parentNode||f.nextSibling!==b)&&f!==b&&(!f["s-hn"]&&f["s-ol"]&&(f["s-hn"]=f["s-ol"].parentNode.nodeName),k.insertBefore(f,b),f.nodeType===1&&(f.hidden=(r=f["s-ih"])!==null&&r!==void 0?r:!1))}else f.nodeType===1&&(n&&(f["s-ih"]=(o=f.hidden)!==null&&o!==void 0?o:!1),f.hidden=!0)}}R&&Z(a.$elm$),E.$flags$&=-2,T.length=0}if(y.experimentalScopedSlotChanges&&g.$flags$&2)for(const u of a.$elm$.childNodes)u["s-hn"]!==A&&!u["s-sh"]&&(n&&u["s-ih"]==null&&(u["s-ih"]=(c=u.hidden)!==null&&c!==void 0?c:!1),u.hidden=!0);_=void 0},se=(e,t)=>t in e,H=typeof window<"u"?window:{},D=H.document||{head:{}};H.HTMLElement;const E={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,s)=>e.addEventListener(t,n,s),rel:(e,t,n,s)=>e.removeEventListener(t,n,s),ce:(e,t)=>new CustomEvent(e,t)},ve=(e,t,n)=>{[null,void 0,"",!1].includes(n)||["innerHTML","style"].includes(t)||e.setAttribute(t,["object","function"].includes(typeof n)?"/!\\ Object props are not rendered in the code example":n)},ne=(e,t,n,s,l)=>{if(t&&typeof t=="string"){const r=document.createElement(t);Object.keys(n||{}).forEach(o=>{ve(r,o,n[o])}),s==null||s.forEach(o=>{ne(r,o.$tag$,o.$attrs$,o.$children$,o.$text$)}),n!=null&&n.innerHTML&&(r.innerHTML=n.innerHTML),e.appendChild(r)}l&&(e.innerHTML=l)},Se=(e,t)=>{const n={};if(typeof e!="object")throw new Error("filterArgs - args isn't an object.");for(const s in e)if(!s.startsWith("slot")){const l=e[s],r=s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();(!t||!Object.keys(t).includes(s)||t[s]!==l)&&(n[r]=l)}return n},be=(e,t)=>{var s,l;const n=document.getElementById("storybook-root");if(n)return(l=document.querySelector("[lang]"))==null||l.setAttribute("lang",((s=t.globals)==null?void 0:s.locale)||"en"),ye({$ancestorComponent$:void 0,$flags$:0,$modeName$:void 0,$cmpMeta$:{$flags$:0,$tagName$:n.tagName},$hostElement$:n},e(t)),n.children[n.children.length-1]},Te=({$tag$:e,$attrs$:t,$children$:n,$text$:s})=>{const l=document.createElement("div");return ne(l,e,t,n,s),l.innerHTML},ke=e=>{const t={value:"2023",pattern:"yyyy"},n={value:"12",pattern:"mm"},s={value:"24",pattern:"dd"};return oe([t.value,n.value,s.value].join("-"),e).replace(t.value,t.pattern).replace(n.value,n.pattern).replace(s.value,s.pattern)},me=e=>e.toISOString().split("T")[0],Le=(e,t,n)=>{const s=e.closest("[lang]"),l=Intl.NumberFormat.supportedLocalesOf(s==null?void 0:s.lang),r=l.length>0&&typeof l[0]=="string"?l[0]:navigator.language||n,o=r.split("-").shift();return{locale:r,messages:t[o]||t[n]}},Ee=(e,t,n)=>new Intl.NumberFormat(t,{style:"currency",currency:n}).format(e),Ae=(e,t)=>new Intl.NumberFormat(t).format(e),le=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,oe=(e,t)=>typeof e!="string"||e===""||!le.test(e)?"":new Intl.DateTimeFormat(t).format(new Date(e)),Me=(e,t)=>n=>Le(n,e,t),Re=(e="",t=10)=>{const n=new Uint8Array(t);crypto.getRandomValues(n);const s=Array.from(n).map(l=>l.toString(16).padStart(2,"0")).join("").slice(0,t);return e!==""?`${e}-${s}`:s};class xe{constructor(t=[]){h(this,"classes");h(this,"add",t=>{this.has(t)||this.classes.push(t)});h(this,"delete",t=>{const n=this.classes.indexOf(t);n>-1&&this.classes.splice(n,1)});h(this,"has",t=>this.classes.includes(t));h(this,"join",()=>this.classes.join(" "));this.classes=t}}const Oe=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),je=(e,t)=>t.includes(e==null?void 0:e.tagName.toLowerCase()),De='a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier], mg-button',Fe=e=>{const t=P(e),n=re(e);return[e,...t,...n]},P=(e,t=[])=>{if(e.self!==e.top)try{const n=e.parent;return n?(t.push(n),P(n,t)):t}catch(n){return console.error("Different hosts between iframes:",n),t}return t},re=(e,t=[])=>{if(e.frames.length>0)for(const n of Array.from(e.frames))t.push(n),re(n,t);return t},_e=e=>typeof e=="string"&&e.trim()!=="",Ne=e=>typeof e=="string"?e.toLocaleLowerCase().normalize("NFD").replaceAll(/[\u0300-\u036f]/g,""):e,Be=async e=>e(),He=({disconnect:e,observe:t,takeRecords:n})=>{class s{constructor(r){h(this,"disconnect",e);h(this,"observe",t);h(this,"takeRecords",n);h(this,"cb");this.cb=r}}return[window,global].forEach(l=>{Object.defineProperty(l,"MutationObserver",{writable:!0,configurable:!0,value:s})}),s},Pe=({disconnect:e,observe:t})=>{class n{constructor(l){h(this,"disconnect",e);h(this,"observe",t);h(this,"unobserve");h(this,"cb");this.cb=l}}return[window,global].forEach(s=>{Object.defineProperty(s,"ResizeObserver",{writable:!0,configurable:!0,value:n})}),n};class Ce extends Event{constructor(){super(...arguments);h(this,"detail")}}const We=()=>{class e extends Ce{}return[window,global].forEach(t=>{Object.defineProperty(t,"SubmitEvent",{writable:!0,configurable:!0,value:e})}),e};$.ClassList=xe,$.allItemsAreString=Oe,$.cleanString=Ne,$.createID=Re,$.dateRegExp=le,$.dateToString=me,$.defineLocales=Me,$.filterArgs=Se,$.focusableElements=De,$.getLocaleDatePattern=ke,$.getParentWindows=P,$.getStoryHTML=Te,$.getWindows=Fe,$.isTagName=je,$.isValidString=_e,$.localeCurrency=Ee,$.localeDate=oe,$.localeNumber=Ae,$.nextTick=Be,$.setupMutationObserverMock=He,$.setupResizeObserverMock=Pe,$.setupSubmitEventMock=We,$.stencilWrapper=be,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=index.umd.js.map