@salla.sa/twilight 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.
Files changed (57) hide show
  1. package/README.md +12 -0
  2. package/components/README.md +55 -0
  3. package/components/dist/cjs/index-9441fd8e.js +1554 -0
  4. package/components/dist/cjs/index.cjs.js +2 -0
  5. package/components/dist/cjs/loader.cjs.js +21 -0
  6. package/components/dist/cjs/salla-login_2.cjs.entry.js +131 -0
  7. package/components/dist/cjs/twilight-components.cjs.js +19 -0
  8. package/components/dist/collection/collection-manifest.json +13 -0
  9. package/components/dist/collection/components/generate-summary.js +35 -0
  10. package/components/dist/collection/components/salla-login/salla-login.css +104 -0
  11. package/components/dist/collection/components/salla-login/salla-login.js +113 -0
  12. package/components/dist/collection/components/search-modal/search-modal.css +9 -0
  13. package/components/dist/collection/components/search-modal/search-modal.js +161 -0
  14. package/components/dist/collection/index.js +1 -0
  15. package/components/dist/collection/interfaces/colors.js +1 -0
  16. package/components/dist/collection/interfaces/index.js +2 -0
  17. package/components/dist/collection/interfaces/ratio.js +1 -0
  18. package/components/dist/collection/plugins/tailwind-theme/index.js +32 -0
  19. package/components/dist/collection/plugins/tailwind-theme/scripts/generator.js +51 -0
  20. package/components/dist/collection/utils/utils.js +16 -0
  21. package/components/dist/esm/index-63e5409f.js +1527 -0
  22. package/components/dist/esm/index.js +1 -0
  23. package/components/dist/esm/loader.js +17 -0
  24. package/components/dist/esm/polyfills/core-js.js +11 -0
  25. package/components/dist/esm/polyfills/css-shim.js +1 -0
  26. package/components/dist/esm/polyfills/dom.js +79 -0
  27. package/components/dist/esm/polyfills/es5-html-element.js +1 -0
  28. package/components/dist/esm/polyfills/index.js +34 -0
  29. package/components/dist/esm/polyfills/system.js +6 -0
  30. package/components/dist/esm/salla-login_2.entry.js +126 -0
  31. package/components/dist/esm/twilight-components.js +17 -0
  32. package/components/dist/index.cjs.js +1 -0
  33. package/components/dist/index.js +1 -0
  34. package/components/dist/twilight-components/index.esm.js +0 -0
  35. package/components/dist/twilight-components/p-3d53781c.js +1 -0
  36. package/components/dist/twilight-components/p-fccb89fa.entry.js +1 -0
  37. package/components/dist/twilight-components/twilight-components.esm.js +1 -0
  38. package/components/dist/types/components/salla-login/salla-login.d.ts +14 -0
  39. package/components/dist/types/components/search-modal/search-modal.d.ts +26 -0
  40. package/components/dist/types/components.d.ts +76 -0
  41. package/components/dist/types/index.d.ts +6 -0
  42. package/components/dist/types/interfaces/colors.d.ts +1 -0
  43. package/components/dist/types/interfaces/index.d.ts +2 -0
  44. package/components/dist/types/interfaces/ratio.d.ts +1 -0
  45. package/components/dist/types/stencil-public-runtime.d.ts +1563 -0
  46. package/components/dist/types/utils/utils.d.ts +6 -0
  47. package/components/loader/cdn.js +3 -0
  48. package/components/loader/index.cjs.js +3 -0
  49. package/components/loader/index.d.ts +13 -0
  50. package/components/loader/index.es2017.js +3 -0
  51. package/components/loader/index.js +4 -0
  52. package/components/loader/package.json +10 -0
  53. package/components/package.json +67 -0
  54. package/dist/twilight.js +2 -0
  55. package/dist/twilight.js.LICENSE.txt +27 -0
  56. package/package.json +62 -0
  57. package/twilight/WatcherPlugin.js +123 -0
@@ -0,0 +1,126 @@
1
+ import { r as registerInstance, h, H as Host, g as getElement } from './index-63e5409f.js';
2
+
3
+ const sallaLoginCss = ".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}";
4
+
5
+ const SallaLogin = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ this.fetchStatus = '';
9
+ this.searchIcon = 'Search_Icon.svg';
10
+ /**
11
+ * If 'true' will make the modal visible.
12
+ */
13
+ this.visible = false;
14
+ this.handleClose = () => {
15
+ this.visible = false;
16
+ };
17
+ }
18
+ handleClick(ev) {
19
+ if (!ev.path.some(x => x.className && x.className.includes('modal-body')) &&
20
+ ev.target.localName === 'salla-search-modal') {
21
+ this.visible = false;
22
+ }
23
+ }
24
+ render() {
25
+ return (h("div", { class: this.visible ? 'wrapper visible' : 'wrapper' }, h("div", { class: "modal" }, h("div", { class: 'modal-header' }, h("h5", { class: "title" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644 \u0625\u0644\u064A \u0627\u0644\u0645\u0648\u0642\u0639"), h("button", { type: "button", class: "close", "data-dismiss": "modal", "aria-label": "Close", onClick: this.handleClose }, h("span", { "aria-hidden": "true" }, "\u00D7"))), h("div", { class: "modal-body" }, h("div", { id: "showLoginMethods" }, h("p", { class: "text-sm text-gray-text mb-5" }, "\u0627\u062E\u062A\u0631 \u0627\u0644\u0648\u0633\u064A\u0644\u0629 \u0627\u0644\u0645\u0646\u0627\u0633\u0628\u0629"), h("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" }, h("div", { class: "flex-shrink-0" }, h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" }, h("i", { class: "sicon-mail" }))), h("div", { class: "flex-1 min-w-0" }, h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" }, h("div", { class: "flex-1" }, h("span", { class: "absolute inset-0", "aria-hidden": "true" }), h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"), h("h6", { class: "font-boldf" }, "\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A")), h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))), h("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" }, h("div", { class: "flex-shrink-0" }, h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" }, h("i", { class: "sicon-phone" }))), h("div", { class: "flex-1 min-w-0" }, h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" }, h("div", { class: "flex-1" }, h("span", { class: "absolute inset-0", "aria-hidden": "true" }), h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"), h("h6", { class: "font-boldf" }, "\u0627\u0644\u0647\u0627\u062A\u0641")), h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))))))));
26
+ }
27
+ static get assetsDirs() { return ["assets"]; }
28
+ };
29
+ SallaLogin.style = sallaLoginCss;
30
+
31
+ const searchModalCss = "";
32
+
33
+ const SearchModal = class {
34
+ constructor(hostRef) {
35
+ registerInstance(this, hostRef);
36
+ this.fetchStatus = '';
37
+ this.showModal = false;
38
+ /**
39
+ * The text to overwrite search placeholder.
40
+ */
41
+ this.searchPlaceholder = 'Search here ...';
42
+ /**
43
+ * The text to overwrite no results text.
44
+ */
45
+ this.noResultsText = 'There are no results at the moment';
46
+ this.handleChange = event => {
47
+ this.searchTerm = event.target.value;
48
+ this.fetchStatus = 'loading';
49
+ this.showResult = false;
50
+ this.results = [];
51
+ if (this.searchTerm.length > 2) {
52
+ window.salla.search.api
53
+ .search(this.searchTerm)
54
+ .then(response => response)
55
+ .then(response => {
56
+ console.log('response', response);
57
+ this.fetchStatus = 'idle';
58
+ this.results = response.results;
59
+ this.showResult = true;
60
+ if (this.results.length < 1) {
61
+ this.fetchStatus = 'error';
62
+ }
63
+ })
64
+ .catch(err => {
65
+ this.showResult = true;
66
+ this.fetchStatus = 'error';
67
+ console.log(err);
68
+ });
69
+ }
70
+ };
71
+ this.openSearch = () => {
72
+ this.searchTerm = '';
73
+ this.fetchStatus = '';
74
+ this.results = [];
75
+ this.showModal = true;
76
+ window.scrollTo(0, 0);
77
+ document.getElementsByTagName('html')[0].style.position = 'fixed';
78
+ document.getElementsByTagName('html')[0].style.overflowY = 'scroll';
79
+ };
80
+ this.closeSearch = () => {
81
+ this.searchTerm = '';
82
+ this.fetchStatus = '';
83
+ this.results = [];
84
+ document.getElementsByTagName('html')[0].style.position = 'static';
85
+ document.getElementsByTagName('html')[0].style.overflowY = 'auto';
86
+ this.showModal = false;
87
+ };
88
+ }
89
+ componentWillLoad() {
90
+ this.hasSearchIconSlot = !!this.hostElement.querySelector('[slot="search-icon"]');
91
+ this.hasProductTemplateSlot = !!this.hostElement.querySelector('[slot="product-template"]');
92
+ if (this.hasProductTemplateSlot) {
93
+ this.productTemplateHtml = this.hostElement.querySelector('[slot="product-template"]').innerHTML;
94
+ }
95
+ }
96
+ getProduct(item) {
97
+ var _a, _b;
98
+ // todo use art-template https://aui.github.io/art-template/docs/.
99
+ if (this.hasProductTemplateSlot) {
100
+ let product = this.productTemplateHtml
101
+ .replace("{title}", item.title)
102
+ .replace("{price}", (_a = item.price) === null || _a === void 0 ? void 0 : _a.after)
103
+ .replace("{url}", item.url)
104
+ .replace("{thumb}", item.thumb);
105
+ return (h("div", { class: "s-search-modal-product", innerHTML: product }));
106
+ }
107
+ else {
108
+ return (h("div", { class: "s-search-modal-product" }, h("a", { target: "_blank", href: item.url, class: "s-search-modal-product-image-container" }, h("img", { class: "s-search-modal-product-image", src: item.thumb })), h("div", { class: "s-search-modal-product-details" }, h("div", { class: "s-search-modal-product-title" }, item.title), h("div", { class: "s-search-modal-product-price" }, (_b = item.price) === null || _b === void 0 ? void 0 : _b.after))));
109
+ }
110
+ }
111
+ render() {
112
+ return (h(Host, { class: "s-search-modal" }, h("button", { type: "button", onClick: this.openSearch, class: "s-search-modal-search-button-icon" }, this.hasSearchIconSlot ? (h("slot", { name: "search-icon" })) : (h("i", { class: "sicon-search font-bold" }))), this.showModal && (h("div", { class: "s-search-modal-container", style: { backgroundColor: 'rgba(0,0,0,0.5)' } }, h("div", { class: "s-search-modal-wrapper", onClick: this.closeSearch }, h("div", { class: "s-search-modal-inner", onClick: e => {
113
+ e.stopPropagation();
114
+ } }, h("div", { class: "s-search-modal-search-box-container" }, h("div", { class: !this.showResult
115
+ ? 's-search-modal-search-box-inner'
116
+ : 's-search-modal-search-box-inner-open' }, h("input", { class: "s-search-modal-input", type: "text", placeholder: this.searchPlaceholder, value: this.searchTerm, onInput: event => this.handleChange(event) }), this.fetchStatus != 'loading' ? (h("button", { class: "s-search-modal-search-icon" }, h("i", { class: "sicon-search" }))) : (h("span", { class: "s-search-modal-spinner" }, h("span", { class: "s-search-modal-spinner-loader" }))))), h("div", { class: "s-search-modal-search-results" }, this.fetchStatus === 'error' && (h("p", { class: "s-search-modal-no-results error p-4 text-sm text-gray-text" }, this.noResultsText)), this.results &&
117
+ this.results.map(item => {
118
+ return this.getProduct(item);
119
+ }))))))));
120
+ }
121
+ static get assetsDirs() { return ["assets"]; }
122
+ get hostElement() { return getElement(this); }
123
+ };
124
+ SearchModal.style = searchModalCss;
125
+
126
+ export { SallaLogin as salla_login, SearchModal as salla_search_modal };
@@ -0,0 +1,17 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-63e5409f.js';
2
+
3
+ /*
4
+ Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
5
+ */
6
+ const patchBrowser = () => {
7
+ const importMeta = import.meta.url;
8
+ const opts = {};
9
+ if (importMeta !== '') {
10
+ opts.resourcesUrl = new URL('.', importMeta).href;
11
+ }
12
+ return promiseResolve(opts);
13
+ };
14
+
15
+ patchBrowser().then(options => {
16
+ return bootstrapLazy([["salla-login_2",[[1,"salla-login",{"searchIcon":[1,"search-icon"],"visible":[1540],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32]},[[8,"click","handleClick"]]],[4,"salla-search-modal",{"searchPlaceholder":[1,"search-placeholder"],"noResultsText":[1,"no-results-text"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], options);
17
+ });
@@ -0,0 +1 @@
1
+ module.exports = require('./cjs/index.cjs.js');
@@ -0,0 +1 @@
1
+ export * from './esm/index.js';
@@ -0,0 +1 @@
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}
@@ -0,0 +1 @@
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 salla_login,r as salla_search_modal}
@@ -0,0 +1 @@
1
+ import{p as s,b as e}from"./p-3d53781c.js";(()=>{const e=import.meta.url,a={};return""!==e&&(a.resourcesUrl=new URL(".",e).href),s(a)})().then((s=>e([["p-fccb89fa",[[1,"salla-login",{searchIcon:[1,"search-icon"],visible:[1540],searchTerm:[32],results:[32],fetchStatus:[32],showResult:[32]},[[8,"click","handleClick"]]],[4,"salla-search-modal",{searchPlaceholder:[1,"search-placeholder"],noResultsText:[1,"no-results-text"],searchTerm:[32],results:[32],fetchStatus:[32],showResult:[32],showModal:[32]}]]]],s)));
@@ -0,0 +1,14 @@
1
+ export declare class SallaLogin {
2
+ searchTerm: string;
3
+ results: string[];
4
+ fetchStatus: string;
5
+ showResult: boolean;
6
+ searchIcon: string;
7
+ /**
8
+ * If 'true' will make the modal visible.
9
+ */
10
+ visible: boolean;
11
+ handleClick(ev: any): void;
12
+ private handleClose;
13
+ render(): any;
14
+ }
@@ -0,0 +1,26 @@
1
+ import { HTMLStencilElement } from '../../stencil-public-runtime';
2
+ export declare class SearchModal {
3
+ searchTerm: string;
4
+ results: string[];
5
+ fetchStatus: string;
6
+ showResult: boolean;
7
+ showModal: boolean;
8
+ /**
9
+ * The text to overwrite search placeholder.
10
+ */
11
+ searchPlaceholder: string;
12
+ /**
13
+ * The text to overwrite no results text.
14
+ */
15
+ noResultsText: string;
16
+ private hasSearchIconSlot;
17
+ private hasProductTemplateSlot;
18
+ private productTemplateHtml;
19
+ hostElement: HTMLStencilElement;
20
+ componentWillLoad(): void;
21
+ private handleChange;
22
+ private getProduct;
23
+ private openSearch;
24
+ private closeSearch;
25
+ render(): any;
26
+ }
@@ -0,0 +1,76 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ /**
4
+ * This is an autogenerated file created by the Stencil compiler.
5
+ * It contains typing information for all components that exist in this project.
6
+ */
7
+ import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
+ export namespace Components {
9
+ interface SallaLogin {
10
+ "searchIcon": string;
11
+ /**
12
+ * If 'true' will make the modal visible.
13
+ */
14
+ "visible": boolean;
15
+ }
16
+ interface SallaSearchModal {
17
+ /**
18
+ * The text to overwrite no results text.
19
+ */
20
+ "noResultsText": string;
21
+ /**
22
+ * The text to overwrite search placeholder.
23
+ */
24
+ "searchPlaceholder": string;
25
+ }
26
+ }
27
+ declare global {
28
+ interface HTMLSallaLoginElement extends Components.SallaLogin, HTMLStencilElement {
29
+ }
30
+ var HTMLSallaLoginElement: {
31
+ prototype: HTMLSallaLoginElement;
32
+ new (): HTMLSallaLoginElement;
33
+ };
34
+ interface HTMLSallaSearchModalElement extends Components.SallaSearchModal, HTMLStencilElement {
35
+ }
36
+ var HTMLSallaSearchModalElement: {
37
+ prototype: HTMLSallaSearchModalElement;
38
+ new (): HTMLSallaSearchModalElement;
39
+ };
40
+ interface HTMLElementTagNameMap {
41
+ "salla-login": HTMLSallaLoginElement;
42
+ "salla-search-modal": HTMLSallaSearchModalElement;
43
+ }
44
+ }
45
+ declare namespace LocalJSX {
46
+ interface SallaLogin {
47
+ "searchIcon"?: string;
48
+ /**
49
+ * If 'true' will make the modal visible.
50
+ */
51
+ "visible"?: boolean;
52
+ }
53
+ interface SallaSearchModal {
54
+ /**
55
+ * The text to overwrite no results text.
56
+ */
57
+ "noResultsText"?: string;
58
+ /**
59
+ * The text to overwrite search placeholder.
60
+ */
61
+ "searchPlaceholder"?: string;
62
+ }
63
+ interface IntrinsicElements {
64
+ "salla-login": SallaLogin;
65
+ "salla-search-modal": SallaSearchModal;
66
+ }
67
+ }
68
+ export { LocalJSX as JSX };
69
+ declare module "@stencil/core" {
70
+ export namespace JSX {
71
+ interface IntrinsicElements {
72
+ "salla-login": LocalJSX.SallaLogin & JSXBase.HTMLAttributes<HTMLSallaLoginElement>;
73
+ "salla-search-modal": LocalJSX.SallaSearchModal & JSXBase.HTMLAttributes<HTMLSallaSearchModalElement>;
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,6 @@
1
+ declare global {
2
+ interface Window {
3
+ salla: any;
4
+ }
5
+ }
6
+ export * from './components';
@@ -0,0 +1 @@
1
+ export declare type Color = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | 'default';
@@ -0,0 +1,2 @@
1
+ export * from './colors';
2
+ export * from './ratio';
@@ -0,0 +1 @@
1
+ export declare type Ratio = '1x1' | '5x4' | '5x3' | '3x2' | '16x9' | '2x1' | '3x1';