@salla.sa/twilight-components 1.0.3 → 1.0.5
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.
- package/dist/twilight-components/app-globals-0f993ce5.js +3 -0
- package/dist/twilight-components/css-shim-a64b8820.js +4 -0
- package/dist/twilight-components/dom-d08ba8aa.js +73 -0
- package/dist/twilight-components/index-0aa9ca9b.js +3010 -0
- package/dist/twilight-components/index-d2312a61.js +3010 -0
- package/dist/twilight-components/index-d6ed984a.js +3010 -0
- package/dist/twilight-components/index.esm.js +3 -1
- package/dist/twilight-components/salla-login-0e725af9.js +12 -0
- package/dist/twilight-components/salla-login-2a48c6c7.js +29 -0
- package/dist/twilight-components/salla-login-2bfbce21.js +16 -0
- package/dist/twilight-components/salla-login-45a3f61c.js +16 -0
- package/dist/twilight-components/salla-login-5fe80dd7.js +29 -0
- package/dist/twilight-components/salla-login-69a00ca2.js +12 -0
- package/dist/twilight-components/salla-login-7bf31d85.js +29 -0
- package/dist/twilight-components/salla-login-cb872dc2.js +16 -0
- package/dist/twilight-components/salla-login.entry.js +2 -0
- package/dist/twilight-components/salla-modal.entry.js +24 -0
- package/dist/twilight-components/salla-search-modal.entry.js +2 -0
- package/dist/{esm/search-modal-d6e12d32.js → twilight-components/search-modal-5dc35a08.js} +2 -34
- package/dist/twilight-components/search-modal-c1babeb6.js +94 -0
- package/dist/twilight-components/search-modal-ee69bd04.js +94 -0
- package/dist/twilight-components/shadow-css-bc14d9fd.js +389 -0
- package/dist/twilight-components/twilight-components.esm.js +125 -1
- package/dist/types/components/salla-login/salla-login.d.ts +0 -11
- package/dist/types/components/salla-modal/salla-modal.d.ts +9 -0
- package/dist/{collection/interfaces/colors.js → types/components/salla-modal/test/salla-modal.e2e.d.ts} +0 -0
- package/dist/{collection/interfaces/ratio.js → types/components/salla-modal/test/salla-modal.spec.d.ts} +0 -0
- package/dist/types/components.d.ts +23 -10
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/utils.spec.d.ts +1 -0
- package/package.json +3 -2
- package/dist/cjs/index-9441fd8e.js +0 -1554
- package/dist/cjs/index.cjs.js +0 -121
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/cjs/salla-login_2.cjs.entry.js +0 -11
- package/dist/cjs/search-modal-722cccc3.js +0 -129
- package/dist/cjs/twilight-components.cjs.js +0 -19
- package/dist/collection/collection-manifest.json +0 -13
- package/dist/collection/components/generate-summary.js +0 -35
- package/dist/collection/components/salla-login/salla-login.css +0 -104
- package/dist/collection/components/salla-login/salla-login.js +0 -113
- package/dist/collection/components/search-modal/search-modal.css +0 -9
- package/dist/collection/components/search-modal/search-modal.js +0 -161
- package/dist/collection/index.js +0 -3
- package/dist/collection/interfaces/index.js +0 -2
- package/dist/collection/plugins/tailwind-theme/index.js +0 -31
- package/dist/collection/plugins/tailwind-theme/scripts/generator.js +0 -51
- package/dist/collection/utils/utils.js +0 -16
- package/dist/esm/index-63e5409f.js +0 -1527
- package/dist/esm/index.js +0 -115
- package/dist/esm/loader.js +0 -17
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/salla-login_2.entry.js +0 -2
- package/dist/esm/twilight-components.js +0 -17
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/loader/cdn.js +0 -3
- package/dist/loader/index.cjs.js +0 -3
- package/dist/loader/index.d.ts +0 -13
- package/dist/loader/index.es2017.js +0 -3
- package/dist/loader/index.js +0 -4
- package/dist/loader/package.json +0 -10
- package/dist/twilight-components/p-01102f97.entry.js +0 -1
- package/dist/twilight-components/p-3d53781c.js +0 -1
- package/dist/twilight-components/p-591a15cf.js +0 -1
package/dist/index.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./cjs/index.cjs.js');
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './esm/index.js';
|
package/dist/loader/cdn.js
DELETED
package/dist/loader/index.cjs.js
DELETED
package/dist/loader/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export * from '../types/components';
|
|
3
|
-
export interface CustomElementsDefineOptions {
|
|
4
|
-
exclude?: string[];
|
|
5
|
-
resourcesUrl?: string;
|
|
6
|
-
syncQueue?: boolean;
|
|
7
|
-
jmp?: (c: Function) => any;
|
|
8
|
-
raf?: (c: FrameRequestCallback) => number;
|
|
9
|
-
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
10
|
-
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
|
|
13
|
-
export declare function applyPolyfills(): Promise<void>;
|
package/dist/loader/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
(function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
|
|
3
|
-
export * from '../esm/polyfills/index.js';
|
|
4
|
-
export * from '../esm/loader.js';
|
package/dist/loader/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{S as salla_login,a as salla_search_modal}from"./p-591a15cf.js";import"./p-3d53781c.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let t,e,l,n=!1,o=!1,s=!1,i=!1;const r="undefined"!=typeof window?window:{},c=r.document||{head:{}},f={t:0,l:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,l,n)=>t.addEventListener(e,l,n),rel:(t,e,l,n)=>t.removeEventListener(e,l,n),ce:(t,e)=>new CustomEvent(t,e)},a=t=>Promise.resolve(t),u=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(t){}return!1})(),$=(t,e,l)=>{l&&l.map((([l,n,o])=>{const s=h(t,l),i=d(e,o),r=y(l);f.ael(s,n,i,r),(e.o=e.o||[]).push((()=>f.rel(s,n,i,r)))}))},d=(t,e)=>l=>{try{256&t.t?t.i[e](l):(t.u=t.u||[]).push([e,l])}catch(t){nt(t)}},h=(t,e)=>8&e?r:t,y=t=>0!=(2&t),p=new WeakMap,m=t=>"sc-"+t.$,b={},w=t=>"object"==(t=typeof t)||"function"===t,S=(t,e,...l)=>{let n=null,o=null,s=!1,i=!1,r=[];const c=e=>{for(let l=0;l<e.length;l++)n=e[l],Array.isArray(n)?c(n):null!=n&&"boolean"!=typeof n&&((s="function"!=typeof t&&!w(n))&&(n+=""),s&&i?r[r.length-1].h+=n:r.push(s?g(null,n):n),i=s)};if(c(l),e){e.name&&(o=e.name);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}}const f=g(t,null);return f.p=e,r.length>0&&(f.m=r),f.S=o,f},g=(t,e)=>({t:0,g:t,h:e,j:null,m:null,p:null,S:null}),j={},k=(t,e,l,n,o,s)=>{if(l!==n){let i=lt(t,e),c=e.toLowerCase();if("class"===e){const e=t.classList,o=M(l),s=M(n);e.remove(...o.filter((t=>t&&!s.includes(t)))),e.add(...s.filter((t=>t&&!o.includes(t))))}else if("style"===e){for(const e in l)n&&null!=n[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in n)l&&n[e]===l[e]||(e.includes("-")?t.style.setProperty(e,n[e]):t.style[e]=n[e])}else if(i||"o"!==e[0]||"n"!==e[1]){const r=w(n);if((i||r&&null!==n)&&!o)try{if(t.tagName.includes("-"))t[e]=n;else{let o=null==n?"":n;"list"===e?i=!1:null!=l&&t[e]==o||(t[e]=o)}}catch(t){}null==n||!1===n?!1===n&&""!==t.getAttribute(e)||t.removeAttribute(e):(!i||4&s||o)&&!r&&t.setAttribute(e,n=!0===n?"":n)}else e="-"===e[2]?e.slice(3):lt(r,c)?c.slice(2):c[2]+e.slice(3),l&&f.rel(t,e,l,!1),n&&f.ael(t,e,n,!1)}},v=/\s/,M=t=>t?t.split(v):[],C=(t,e,l,n)=>{const o=11===e.j.nodeType&&e.j.host?e.j.host:e.j,s=t&&t.p||b,i=e.p||b;for(n in s)n in i||k(o,n,s[n],void 0,l,e.t);for(n in i)k(o,n,s[n],i[n],l,e.t)},O=(o,i,r,f)=>{let a,u,$,d=i.m[r],h=0;if(n||(s=!0,"slot"===d.g&&(t&&f.classList.add(t+"-s"),d.t|=d.m?2:1)),null!==d.h)a=d.j=c.createTextNode(d.h);else if(1&d.t)a=d.j=c.createTextNode("");else if(a=d.j=c.createElement(2&d.t?"slot-fb":d.g),C(null,d,!1),null!=t&&a["s-si"]!==t&&a.classList.add(a["s-si"]=t),d.m)for(h=0;h<d.m.length;++h)u=O(o,d,h,a),u&&a.appendChild(u);return a["s-hn"]=l,3&d.t&&(a["s-sr"]=!0,a["s-cr"]=e,a["s-sn"]=d.S||"",$=o&&o.m&&o.m[r],$&&$.g===d.g&&o.j&&R(o.j,!1)),a},R=(t,e)=>{f.t|=1;const n=t.childNodes;for(let t=n.length-1;t>=0;t--){const o=n[t];o["s-hn"]!==l&&o["s-ol"]&&(L(o).insertBefore(o,E(o)),o["s-ol"].remove(),o["s-ol"]=void 0,s=!0),e&&R(o,e)}f.t&=-2},T=(t,e,n,o,s,i)=>{let r,c=t["s-cr"]&&t["s-cr"].parentNode||t;for(c.shadowRoot&&c.tagName===l&&(c=c.shadowRoot);s<=i;++s)o[s]&&(r=O(null,n,s,t),r&&(o[s].j=r,c.insertBefore(r,E(e))))},P=(t,e,l,n,s)=>{for(;e<=l;++e)(n=t[e])&&(o=!0,(s=n.j)["s-ol"]?s["s-ol"].remove():R(s,!0),s.remove())},x=(t,e)=>t.g===e.g&&("slot"!==t.g||t.S===e.S),E=t=>t&&t["s-ol"]||t,L=t=>(t["s-ol"]?t["s-ol"]:t).parentNode,W=(t,e)=>{const l=e.j=t.j,n=t.m,o=e.m,s=e.h;let i;null===s?("slot"===e.g||C(t,e,!1),null!==n&&null!==o?((t,e,l,n)=>{let o,s=0,i=0,r=e.length-1,c=e[0],f=e[r],a=n.length-1,u=n[0],$=n[a];for(;s<=r&&i<=a;)null==c?c=e[++s]:null==f?f=e[--r]:null==u?u=n[++i]:null==$?$=n[--a]:x(c,u)?(W(c,u),c=e[++s],u=n[++i]):x(f,$)?(W(f,$),f=e[--r],$=n[--a]):x(c,$)?("slot"!==c.g&&"slot"!==$.g||R(c.j.parentNode,!1),W(c,$),t.insertBefore(c.j,f.j.nextSibling),c=e[++s],$=n[--a]):x(f,u)?("slot"!==c.g&&"slot"!==$.g||R(f.j.parentNode,!1),W(f,u),t.insertBefore(f.j,c.j),f=e[--r],u=n[++i]):(o=O(e&&e[i],l,i,t),u=n[++i],o&&L(c.j).insertBefore(o,E(c.j)));s>r?T(t,null==n[a+1]?null:n[a+1].j,l,n,i,a):i>a&&P(e,s,r)})(l,n,e,o):null!==o?(null!==t.h&&(l.textContent=""),T(l,null,e,o,0,o.length-1)):null!==n&&P(n,0,n.length-1)):(i=l["s-cr"])?i.parentNode.textContent=s:t.h!==s&&(l.data=s)},A=t=>{let e,l,n,o,s,i,r=t.childNodes;for(l=0,n=r.length;l<n;l++)if(e=r[l],1===e.nodeType){if(e["s-sr"])for(s=e["s-sn"],e.hidden=!1,o=0;o<n;o++)if(i=r[o].nodeType,r[o]["s-hn"]!==e["s-hn"]||""!==s){if(1===i&&s===r[o].getAttribute("slot")){e.hidden=!0;break}}else if(1===i||3===i&&""!==r[o].textContent.trim()){e.hidden=!0;break}A(e)}},H=[],N=t=>{let e,l,n,s,i,r,c=0,f=t.childNodes,a=f.length;for(;c<a;c++){if(e=f[c],e["s-sr"]&&(l=e["s-cr"])&&l.parentNode)for(n=l.parentNode.childNodes,s=e["s-sn"],r=n.length-1;r>=0;r--)l=n[r],l["s-cn"]||l["s-nr"]||l["s-hn"]===e["s-hn"]||(U(l,s)?(i=H.find((t=>t.k===l)),o=!0,l["s-sn"]=l["s-sn"]||s,i?i.v=e:H.push({v:e,k:l}),l["s-sr"]&&H.map((t=>{U(t.k,l["s-sn"])&&(i=H.find((t=>t.k===l)),i&&!t.v&&(t.v=i.v))}))):H.some((t=>t.k===l))||H.push({k:l}));1===e.nodeType&&N(e)}},U=(t,e)=>1===t.nodeType?null===t.getAttribute("slot")&&""===e||t.getAttribute("slot")===e:t["s-sn"]===e||""===e,q=t=>Z(t).M,F=(t,e)=>{e&&!t.C&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.C=e)))},V=(t,e)=>{if(t.t|=16,!(4&t.t))return F(t,t.O),dt((()=>_(t,e)));t.t|=512},_=(t,e)=>{const l=t.i;let n;return e&&(t.t|=256,t.u&&(t.u.map((([t,e])=>I(l,t,e))),t.u=null),n=I(l,"componentWillLoad")),J(n,(()=>z(t,l,e)))},z=async(t,e,l)=>{const n=t.M,o=n["s-rc"];l&&(t=>{const e=t.R,l=t.M,n=e.t,o=((t,e)=>{let l=m(e),n=it.get(l);if(t=11===t.nodeType?t:c,n)if("string"==typeof n){let e,o=p.get(t=t.head||t);o||p.set(t,o=new Set),o.has(l)||(e=c.createElement("style"),e.innerHTML=n,t.insertBefore(e,t.querySelector("link")),o&&o.add(l))}else t.adoptedStyleSheets.includes(n)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,n]);return l})(l.shadowRoot?l.shadowRoot:l.getRootNode(),e);10&n&&(l["s-sc"]=o,l.classList.add(o+"-h"))})(t);B(t,e),o&&(o.map((t=>t())),n["s-rc"]=void 0);{const e=n["s-p"],l=()=>D(t);0===e.length?l():(Promise.all(e).then(l),t.t|=4,e.length=0)}},B=(i,r)=>{try{r=r.render(),i.t&=-17,i.t|=2,((i,r)=>{const a=i.M,u=i.R,$=i.T||g(null,null),d=(t=>t&&t.g===j)(r)?r:S(null,null,r);if(l=a.tagName,u.P&&(d.p=d.p||{},u.P.map((([t,e])=>d.p[e]=a[t]))),d.g=null,d.t|=4,i.T=d,d.j=$.j=a.shadowRoot||a,t=a["s-sc"],e=a["s-cr"],n=0!=(1&u.t),o=!1,W($,d),f.t|=1,s){let t,e,l,n,o,s;N(d.j);let i=0;for(;i<H.length;i++)t=H[i],e=t.k,e["s-ol"]||(l=c.createTextNode(""),l["s-nr"]=e,e.parentNode.insertBefore(e["s-ol"]=l,e));for(i=0;i<H.length;i++)if(t=H[i],e=t.k,t.v){for(n=t.v.parentNode,o=t.v.nextSibling,l=e["s-ol"];l=l.previousSibling;)if(s=l["s-nr"],s&&s["s-sn"]===e["s-sn"]&&n===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&n!==e.parentNode||e.nextSibling!==o)&&e!==o&&(!e["s-hn"]&&e["s-ol"]&&(e["s-hn"]=e["s-ol"].parentNode.nodeName),n.insertBefore(e,o))}else 1===e.nodeType&&(e.hidden=!0)}o&&A(d.j),f.t&=-2,H.length=0})(i,r)}catch(t){nt(t,i.M)}return null},D=t=>{const e=t.M,l=t.O;64&t.t||(t.t|=64,K(e),t.L(e),l||G()),t.C&&(t.C(),t.C=void 0),512&t.t&&$t((()=>V(t,!1))),t.t&=-517},G=()=>{K(c.documentElement),$t((()=>(t=>{const e=f.ce("appload",{detail:{namespace:"twilight-components"}});return t.dispatchEvent(e),e})(r)))},I=(t,e,l)=>{if(t&&t[e])try{return t[e](l)}catch(t){nt(t)}},J=(t,e)=>t&&t.then?t.then(e):e(),K=t=>t.classList.add("hydrated"),Q=(t,e,l)=>{if(e.W){const n=Object.entries(e.W),o=t.prototype;if(n.map((([t,[n]])=>{(31&n||2&l&&32&n)&&Object.defineProperty(o,t,{get(){return((t,e)=>Z(this).A.get(e))(0,t)},set(l){((t,e,l,n)=>{const o=Z(t),s=o.A.get(e),i=o.t,r=o.i;l=((t,e)=>null==t||w(t)?t:4&e?"false"!==t&&(""===t||!!t):1&e?t+"":t)(l,n.W[e][0]),8&i&&void 0!==s||l===s||(o.A.set(e,l),r&&2==(18&i)&&V(o,!1))})(this,t,l,e)},configurable:!0,enumerable:!0})})),1&l){const l=new Map;o.attributeChangedCallback=function(t,e,n){f.jmp((()=>{const e=l.get(t);this.hasOwnProperty(e)&&(n=this[e],delete this[e]),this[e]=(null!==n||"boolean"!=typeof this[e])&&n}))},t.observedAttributes=n.filter((([t,e])=>15&e[0])).map((([t,n])=>{const o=n[1]||t;return l.set(o,t),512&n[0]&&e.P.push([t,o]),o}))}}return t},X=(t,e={})=>{const l=[],n=e.exclude||[],o=r.customElements,s=c.head,i=s.querySelector("meta[charset]"),a=c.createElement("style"),d=[];let h,y=!0;Object.assign(f,e),f.l=new URL(e.resourcesUrl||"./",c.baseURI).href,t.map((t=>t[1].map((e=>{const s={t:e[0],$:e[1],W:e[2],H:e[3]};s.W=e[2],s.H=e[3],s.P=[];const i=s.$,r=class extends HTMLElement{constructor(t){super(t),et(t=this,s),1&s.t&&t.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),y?d.push(this):f.jmp((()=>(t=>{if(0==(1&f.t)){const e=Z(t),l=e.R,n=()=>{};if(1&e.t)$(t,e,l.H);else{e.t|=1,12&l.t&&(t=>{const e=t["s-cr"]=c.createComment("");e["s-cn"]=!0,t.insertBefore(e,t.firstChild)})(t);{let l=t;for(;l=l.parentNode||l.host;)if(l["s-p"]){F(e,e.O=l);break}}l.W&&Object.entries(l.W).map((([e,[l]])=>{if(31&l&&t.hasOwnProperty(e)){const l=t[e];delete t[e],t[e]=l}})),(async(t,e,l,n,o)=>{if(0==(32&e.t)){{if(e.t|=32,(o=st(l)).then){const t=()=>{};o=await o,t()}o.isProxied||(Q(o,l,2),o.isProxied=!0);const t=()=>{};e.t|=8;try{new o(e)}catch(t){nt(t)}e.t&=-9,t()}if(o.style){let t=o.style;const e=m(l);if(!it.has(e)){const n=()=>{};((t,e,l)=>{let n=it.get(t);u&&l?(n=n||new CSSStyleSheet,n.replace(e)):n=e,it.set(t,n)})(e,t,!!(1&l.t)),n()}}}const s=e.O,i=()=>V(e,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,e,l)}n()}})(this)))}disconnectedCallback(){f.jmp((()=>(()=>{if(0==(1&f.t)){const t=Z(this);t.o&&(t.o.map((t=>t())),t.o=void 0)}})()))}componentOnReady(){return Z(this).N}};s.U=t[0],n.includes(i)||o.get(i)||(l.push(i),o.define(i,Q(r,s,1)))})))),a.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",a.setAttribute("data-styles",""),s.insertBefore(a,i?i.nextSibling:s.firstChild),y=!1,d.length?d.map((t=>t.connectedCallback())):f.jmp((()=>h=setTimeout(G,30)))},Y=new WeakMap,Z=t=>Y.get(t),tt=(t,e)=>Y.set(e.i=t,e),et=(t,e)=>{const l={t:0,M:t,R:e,A:new Map};return l.N=new Promise((t=>l.L=t)),t["s-p"]=[],t["s-rc"]=[],$(t,l,e.H),Y.set(t,l)},lt=(t,e)=>e in t,nt=(t,e)=>(0,console.error)(t,e),ot=new Map,st=t=>{const e=t.$.replace(/-/g,"_"),l=t.U,n=ot.get(l);return n?n[e]:import(`./${l}.entry.js`).then((t=>(ot.set(l,t),t[e])),nt)},it=new Map,rt=[],ct=[],ft=(t,e)=>l=>{t.push(l),i||(i=!0,e&&4&f.t?$t(ut):f.raf(ut))},at=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){nt(t)}t.length=0},ut=()=>{at(rt),at(ct),(i=rt.length>0)&&f.raf(ut)},$t=t=>a().then(t),dt=ft(ct,!0);export{j as H,X as b,q as g,S as h,a as p,tt as r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as t,H as e,g as i}from"./p-3d53781c.js";const a=class{constructor(t){s(this,t),this.fetchStatus="",this.searchIcon="Search_Icon.svg",this.visible=!1,this.handleClose=()=>{this.visible=!1}}handleClick(s){s.path.some((s=>s.className&&s.className.includes("modal-body")))||"salla-search-modal"!==s.target.localName||(this.visible=!1)}render(){return t("div",{class:this.visible?"wrapper visible":"wrapper"},t("div",{class:"modal"},t("div",{class:"modal-header"},t("h5",{class:"title"},"سجل دخول إلي الموقع"),t("button",{type:"button",class:"close","data-dismiss":"modal","aria-label":"Close",onClick:this.handleClose},t("span",{"aria-hidden":"true"},"×"))),t("div",{class:"modal-body"},t("div",{id:"showLoginMethods"},t("p",{class:"text-sm text-gray-text mb-5"},"اختر الوسيلة المناسبة"),t("div",{id:"openEmailLogin",class:"mb-2.5 box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200"},t("div",{class:"flex-shrink-0"},t("div",{class:"bg-primary w-12 h-12 text-lg text-white rounded-icon"},t("i",{class:"sicon-mail"}))),t("div",{class:"flex-1 min-w-0"},t("a",{href:"#",class:"focus:outline-none flex justify-between items-center"},t("div",{class:"flex-1"},t("span",{class:"absolute inset-0","aria-hidden":"true"}),t("p",{class:"text-sm text-gray-text"},"سجل دخول"),t("h6",{class:"font-boldf"},"البريد الإلكتروني")),t("i",{class:"sicon-keyboard_arrow_left text-primary text-xl"})))),t("div",{class:"box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200"},t("div",{class:"flex-shrink-0"},t("div",{class:"bg-primary w-12 h-12 text-lg text-white rounded-icon"},t("i",{class:"sicon-phone"}))),t("div",{class:"flex-1 min-w-0"},t("a",{href:"#",class:"focus:outline-none flex justify-between items-center"},t("div",{class:"flex-1"},t("span",{class:"absolute inset-0","aria-hidden":"true"}),t("p",{class:"text-sm text-gray-text"},"سجل دخول"),t("h6",{class:"font-boldf"},"الهاتف")),t("i",{class:"sicon-keyboard_arrow_left text-primary text-xl"}))))))))}static get assetsDirs(){return["assets"]}};a.style=".wrapper{opacity:0;visibility:hidden;position:fixed;width:100%;height:100%;top:0;left:0;background:#fcfcfc;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;display:flex;align-items:center;justify-content:center;z-index:1050}.wrapper .modal{font-family:Helvetica, sans-serif;font-size:14px;background-color:#fff;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:90%;border:1px solid rgba(0, 0, 0, 0.2);border-radius:0.3rem}@media (min-width: 576px){.wrapper .modal{max-width:500px}}.wrapper .modal .displayed{display:flex}.wrapper .modal .modal-body{position:relative;-ms-flex:1 1 auto;flex:1 1 auto;padding:1rem}.visible{opacity:1;visibility:visible;transform:scale(1);transition:visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s}.hide{display:none !important}.show{display:block !important}.search-box{display:flex}.search-box input{width:100%;padding:10px;padding-inline-start:32px}.search-box button{background-color:transparent;border:0;position:absolute;padding:12px;left:12px}.results{list-style:none;padding:0;margin:0;max-height:300px;overflow-y:scroll}.results .product-img{width:50px;margin-inline-end:10px}.results a:first-child{margin-top:20px}.results a{display:flex;border-bottom:1px solid #ddd}.results a h5{margin-top:5px}";const r=class{constructor(t){s(this,t),this.fetchStatus="",this.showModal=!1,this.searchPlaceholder="Search here ...",this.noResultsText="There are no results at the moment",this.handleChange=s=>{this.searchTerm=s.target.value,this.fetchStatus="loading",this.showResult=!1,this.results=[],this.searchTerm.length>2&&window.salla.search.api.search(this.searchTerm).then((s=>s)).then((s=>{console.log("response",s),this.fetchStatus="idle",this.results=s.results,this.showResult=!0,this.results.length<1&&(this.fetchStatus="error")})).catch((s=>{this.showResult=!0,this.fetchStatus="error",console.log(s)}))},this.openSearch=()=>{this.searchTerm="",this.fetchStatus="",this.results=[],this.showModal=!0,window.scrollTo(0,0),document.getElementsByTagName("html")[0].style.position="fixed",document.getElementsByTagName("html")[0].style.overflowY="scroll"},this.closeSearch=()=>{this.searchTerm="",this.fetchStatus="",this.results=[],document.getElementsByTagName("html")[0].style.position="static",document.getElementsByTagName("html")[0].style.overflowY="auto",this.showModal=!1}}componentWillLoad(){this.hasSearchIconSlot=!!this.hostElement.querySelector('[slot="search-icon"]'),this.hasProductTemplateSlot=!!this.hostElement.querySelector('[slot="product-template"]'),this.hasProductTemplateSlot&&(this.productTemplateHtml=this.hostElement.querySelector('[slot="product-template"]').innerHTML)}getProduct(s){var e,i;if(this.hasProductTemplateSlot){let i=this.productTemplateHtml.replace("{title}",s.title).replace("{price}",null===(e=s.price)||void 0===e?void 0:e.after).replace("{url}",s.url).replace("{thumb}",s.thumb);return t("div",{class:"s-search-modal-product",innerHTML:i})}return t("div",{class:"s-search-modal-product"},t("a",{target:"_blank",href:s.url,class:"s-search-modal-product-image-container"},t("img",{class:"s-search-modal-product-image",src:s.thumb})),t("div",{class:"s-search-modal-product-details"},t("div",{class:"s-search-modal-product-title"},s.title),t("div",{class:"s-search-modal-product-price"},null===(i=s.price)||void 0===i?void 0:i.after)))}render(){return t(e,{class:"s-search-modal"},t("button",{type:"button",onClick:this.openSearch,class:"s-search-modal-search-button-icon"},this.hasSearchIconSlot?t("slot",{name:"search-icon"}):t("i",{class:"sicon-search font-bold"})),this.showModal&&t("div",{class:"s-search-modal-container",style:{backgroundColor:"rgba(0,0,0,0.5)"}},t("div",{class:"s-search-modal-wrapper",onClick:this.closeSearch},t("div",{class:"s-search-modal-inner",onClick:s=>{s.stopPropagation()}},t("div",{class:"s-search-modal-search-box-container"},t("div",{class:this.showResult?"s-search-modal-search-box-inner-open":"s-search-modal-search-box-inner"},t("input",{class:"s-search-modal-input",type:"text",placeholder:this.searchPlaceholder,value:this.searchTerm,onInput:s=>this.handleChange(s)}),"loading"!=this.fetchStatus?t("button",{class:"s-search-modal-search-icon"},t("i",{class:"sicon-search"})):t("span",{class:"s-search-modal-spinner"},t("span",{class:"s-search-modal-spinner-loader"})))),t("div",{class:"s-search-modal-search-results"},"error"===this.fetchStatus&&t("p",{class:"s-search-modal-no-results error p-4 text-sm text-gray-text"},this.noResultsText),this.results&&this.results.map((s=>this.getProduct(s))))))))}static get assetsDirs(){return["assets"]}get hostElement(){return i(this)}};r.style="";export{a as S,r as a}
|