@salla.sa/twilight-components 1.0.2 → 1.0.3

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 (34) hide show
  1. package/README.md +3 -0
  2. package/dist/cjs/{index-a67728b4.js → index-9441fd8e.js} +361 -43
  3. package/dist/cjs/index.cjs.js +119 -0
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/salla-login_2.cjs.entry.js +4 -103
  6. package/dist/cjs/search-modal-722cccc3.js +129 -0
  7. package/dist/cjs/twilight-components.cjs.js +2 -2
  8. package/dist/collection/components/search-modal/search-modal.css +9 -0
  9. package/dist/collection/components/search-modal/search-modal.js +55 -20
  10. package/dist/collection/index.js +3 -1
  11. package/dist/collection/plugins/tailwind-theme/index.js +6 -10
  12. package/dist/esm/{index-aeba9f62.js → index-63e5409f.js} +361 -44
  13. package/dist/esm/index.js +114 -0
  14. package/dist/esm/loader.js +2 -2
  15. package/dist/esm/salla-login_2.entry.js +2 -105
  16. package/dist/esm/search-modal-d6e12d32.js +126 -0
  17. package/dist/esm/twilight-components.js +2 -2
  18. package/dist/loader/cdn.js +3 -0
  19. package/dist/loader/index.cjs.js +3 -0
  20. package/dist/loader/index.d.ts +13 -0
  21. package/dist/loader/index.es2017.js +3 -0
  22. package/dist/loader/index.js +4 -0
  23. package/dist/loader/package.json +10 -0
  24. package/dist/twilight-components/index.esm.js +1 -0
  25. package/dist/twilight-components/p-01102f97.entry.js +1 -0
  26. package/dist/twilight-components/p-3d53781c.js +1 -0
  27. package/dist/twilight-components/p-591a15cf.js +1 -0
  28. package/dist/twilight-components/twilight-components.esm.js +1 -1
  29. package/dist/types/components/search-modal/search-modal.d.ts +10 -6
  30. package/dist/types/components.d.ts +8 -0
  31. package/dist/types/index.d.ts +8 -1
  32. package/package.json +1 -1
  33. package/dist/twilight-components/p-0a7edc5f.entry.js +0 -1
  34. package/dist/twilight-components/p-b390bfd1.js +0 -1
package/dist/esm/index.js CHANGED
@@ -1 +1,115 @@
1
+ export { S as SallaLogin, a as SearchModal } from './search-modal-d6e12d32.js';
2
+ import './index-63e5409f.js';
1
3
 
4
+ const utilities = {
5
+ ".s-search-modal-search-button-icon": {
6
+ "@apply bg-gray-bg2 hover:bg-gray-150 dark:hover:bg-opacity-10 transition duration-300 mx-3 text-sm rounded-full w-9 h-9": {
7
+ }
8
+ },
9
+ ".s-search-modal-container": {
10
+ "@apply fixed inset-0 z-50 flex items-top justify-center overflow-auto items-top": {
11
+ }
12
+ },
13
+ ".s-search-modal-wrapper": {
14
+ "@apply bg-transparent w-full": {
15
+ }
16
+ },
17
+ ".s-search-modal-inner": {
18
+ "@apply mx-auto w-11/12 lg:w-6/12": {
19
+ }
20
+ },
21
+ ".s-search-modal-search-box-container": {
22
+ "@apply mt-36 search-box anime-item": {
23
+ }
24
+ },
25
+ ".s-search-modal-search-box-inner": {
26
+ "@apply relative bg-white rounded-tiny border border-border-color": {
27
+ }
28
+ },
29
+ ".s-search-modal-search-box-inner-open": {
30
+ "@apply relative bg-white rounded-tiny border border-border-color rounded-b-none": {
31
+ }
32
+ },
33
+ ".s-search-modal-input": {
34
+ "@apply anime-item bg-transparent border-0 form-input w-full ps-10 pt-6 pb-7 rounded-tiny text-gray-600": {
35
+ }
36
+ },
37
+ ".s-search-modal-search-icon": {
38
+ "@apply anime-item flex justify-end items-center absolute top-4 start-4 text-md text-gray-text": {
39
+ }
40
+ },
41
+ ".s-search-modal-spinner": {
42
+ "@apply spinner-loader-wrap absolute top-1/2 transform -translate-y-1/2 start-4 w-4 h-4": {
43
+ }
44
+ },
45
+ ".s-search-modal-spinner-loader": {
46
+ "@apply block spinner-loader w-4 h-4 animate-spin border-2 border-gray-300 rounded-full": {
47
+ }
48
+ },
49
+ ".s-search-modal-search-results": {
50
+ "@apply m-auto max-h-96 overflow-y-auto bg-white rounded-b-tiny": {
51
+ }
52
+ },
53
+ ".s-search-modal-no-results": {
54
+ "@apply error p-4 text-sm text-gray-text": {
55
+ }
56
+ },
57
+ ".s-search-modal-product": {
58
+ "@apply h-full transition duration-500 bg-transparent justify-around overflow-hidden flex transition-colors duration-300 hover:bg-gray-bg2 px-4 xs:px-5 py-5 border-t-0": {
59
+ }
60
+ },
61
+ ".s-search-modal-product-image-container": {
62
+ "@apply relative overflow-hidden w-20 h-20 sm:w-28 sm:h-28 rounded-md": {
63
+ }
64
+ },
65
+ ".s-search-modal-product-image": {
66
+ "@apply h-full w-full object-cover": {
67
+ }
68
+ },
69
+ ".s-search-modal-product-details": {
70
+ "@apply flex-1 ps-4 xs:ps-5 pt-1": {
71
+ }
72
+ },
73
+ ".s-search-modal-product-title": {
74
+ "@apply flex flex-col justify-start items-baseline text-sm font-bold text-title-color leading-6 mb-2.5": {
75
+ }
76
+ },
77
+ ".s-search-modal-product-price": {
78
+ "@apply w-full flex justify-between items-center mb-5 text-primary font-bold text-sm": {
79
+ }
80
+ }
81
+ };
82
+
83
+ const componentsClasses = /*#__PURE__*/Object.freeze({
84
+ __proto__: null,
85
+ 'default': utilities
86
+ });
87
+
88
+ let tailwind=require('tailwindcss/plugin').withOptions(() => {
89
+ return function({addUtilities}) {
90
+ addUtilities({
91
+ // TODO :: find if there are used and defined them here if its.
92
+ '.anime-item': {},
93
+ '.text-md': {},
94
+ '.items-top': {},
95
+ '.error': {},
96
+ '.search-box': {},
97
+ '.spinner-loader-wrap': {}
98
+ });
99
+
100
+ // todo :: move it to global
101
+ addUtilities({
102
+ '.spinner-loader': {
103
+ 'border-right-color': 'var(--main-color) !important',
104
+ '&.reverse': {
105
+ 'border-right-color': '#9f7171 !important',
106
+ 'background-color': '#f98181'
107
+ }
108
+ }
109
+ });
110
+
111
+ addUtilities(componentsClasses);
112
+ };
113
+ });
114
+
115
+ export { tailwind };
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-aeba9f62.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-63e5409f.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.8.1 | MIT Licensed | https://stenciljs.com
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- 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"]]],[0,"salla-search-modal",{"searchPlaceholder":[1,"search-placeholder"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], options);
13
+ 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);
14
14
  });
15
15
  };
16
16
 
@@ -1,105 +1,2 @@
1
- import { r as registerInstance, h, H as Host } from './index-aeba9f62.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
- this.handleChange = event => {
43
- this.searchTerm = event.target.value;
44
- console.log('this.value', this.searchTerm);
45
- this.fetchStatus = 'loading';
46
- this.showResult = false;
47
- this.results = [];
48
- if (this.searchTerm.length > 2) {
49
- window.salla.search.api
50
- .search(this.searchTerm)
51
- .then(response => response)
52
- .then(response => {
53
- console.log('response', response);
54
- this.fetchStatus = 'idle';
55
- this.results = response.results;
56
- this.showResult = true;
57
- if (this.results.length < 1) {
58
- this.fetchStatus = 'error';
59
- }
60
- })
61
- .catch(err => {
62
- this.showResult = true;
63
- this.fetchStatus = 'error';
64
- console.log(err);
65
- });
66
- }
67
- };
68
- this.openSearch = () => {
69
- console.log('openSearchModal');
70
- this.searchTerm = '';
71
- this.fetchStatus = '';
72
- this.results = [];
73
- this.showModal = true;
74
- window.scrollTo(0, 0);
75
- document.getElementsByTagName('html')[0].style.position = 'fixed';
76
- document.getElementsByTagName('html')[0].style.overflowY = 'scroll';
77
- //this.$nextTick(() => { this.$refs.searchInput.focus(); });
78
- };
79
- this.closeSearch = () => {
80
- console.log('closeSearchModal');
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
- getProduct(item) {
90
- var _a;
91
- return (h("div", { key: item.id, class: "s-search-modal-results-item" }, 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" }, h("h3", { class: "s-search-modal-product-title-h3" }, item.title)), h("div", { class: "s-search-modal-product-price" }, h("h4", { class: "s-search-modal-product-price-h4" }, (_a = item.price) === null || _a === void 0 ? void 0 : _a.after))))));
92
- }
93
- render() {
94
- return (h(Host, { class: "s-search-modal" }, h("button", { type: "button", onClick: this.openSearch, class: "s-search-modal-search-button-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" }, h("div", { class: "s-search-modal-search-box-container" }, h("div", { class: !this.showResult ? 's-search-modal-search-box-inner' : 's-search-modal-search-box-inner-open' }, h("input", { onClick: e => {
95
- e.stopPropagation();
96
- }, 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" }, "\u0644\u0627 \u064A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C")), this.results &&
97
- this.results.map(item => {
98
- return this.getProduct(item);
99
- }))))))));
100
- }
101
- static get assetsDirs() { return ["assets"]; }
102
- };
103
- SearchModal.style = searchModalCss;
104
-
105
- export { SallaLogin as salla_login, SearchModal as salla_search_modal };
1
+ export { S as salla_login, a as salla_search_modal } from './search-modal-d6e12d32.js';
2
+ import './index-63e5409f.js';
@@ -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 S, SearchModal as a };
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-aeba9f62.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-63e5409f.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
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"]]],[0,"salla-search-modal",{"searchPlaceholder":[1,"search-placeholder"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], 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
17
  });
@@ -0,0 +1,3 @@
1
+
2
+ module.exports = require('../cjs/loader.cjs.js');
3
+ module.exports.applyPolyfills = function() { return Promise.resolve() };
@@ -0,0 +1,3 @@
1
+
2
+ module.exports = require('../cjs/loader.cjs.js');
3
+ module.exports.applyPolyfills = function() { return Promise.resolve() };
@@ -0,0 +1,13 @@
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>;
@@ -0,0 +1,3 @@
1
+
2
+ export * from '../esm/polyfills/index.js';
3
+ export * from '../esm/loader.js';
@@ -0,0 +1,4 @@
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';
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "twilight-components-loader",
3
+ "typings": "./index.d.ts",
4
+ "module": "./index.js",
5
+ "main": "./index.cjs.js",
6
+ "jsnext:main": "./index.es2017.js",
7
+ "es2015": "./index.es2017.js",
8
+ "es2017": "./index.es2017.js",
9
+ "unpkg": "./cdn.js"
10
+ }
@@ -0,0 +1 @@
1
+ export{S as SallaLogin,a as SearchModal}from"./p-591a15cf.js";import"./p-3d53781c.js";const e=Object.freeze({__proto__:null,default:{".s-search-modal-search-button-icon":{"@apply bg-gray-bg2 hover:bg-gray-150 dark:hover:bg-opacity-10 transition duration-300 mx-3 text-sm rounded-full w-9 h-9":{}},".s-search-modal-container":{"@apply fixed inset-0 z-50 flex items-top justify-center overflow-auto items-top":{}},".s-search-modal-wrapper":{"@apply bg-transparent w-full":{}},".s-search-modal-inner":{"@apply mx-auto w-11/12 lg:w-6/12":{}},".s-search-modal-search-box-container":{"@apply mt-36 search-box anime-item":{}},".s-search-modal-search-box-inner":{"@apply relative bg-white rounded-tiny border border-border-color":{}},".s-search-modal-search-box-inner-open":{"@apply relative bg-white rounded-tiny border border-border-color rounded-b-none":{}},".s-search-modal-input":{"@apply anime-item bg-transparent border-0 form-input w-full ps-10 pt-6 pb-7 rounded-tiny text-gray-600":{}},".s-search-modal-search-icon":{"@apply anime-item flex justify-end items-center absolute top-4 start-4 text-md text-gray-text":{}},".s-search-modal-spinner":{"@apply spinner-loader-wrap absolute top-1/2 transform -translate-y-1/2 start-4 w-4 h-4":{}},".s-search-modal-spinner-loader":{"@apply block spinner-loader w-4 h-4 animate-spin border-2 border-gray-300 rounded-full":{}},".s-search-modal-search-results":{"@apply m-auto max-h-96 overflow-y-auto bg-white rounded-b-tiny":{}},".s-search-modal-no-results":{"@apply error p-4 text-sm text-gray-text":{}},".s-search-modal-product":{"@apply h-full transition duration-500 bg-transparent justify-around overflow-hidden flex transition-colors duration-300 hover:bg-gray-bg2 px-4 xs:px-5 py-5 border-t-0":{}},".s-search-modal-product-image-container":{"@apply relative overflow-hidden w-20 h-20 sm:w-28 sm:h-28 rounded-md":{}},".s-search-modal-product-image":{"@apply h-full w-full object-cover":{}},".s-search-modal-product-details":{"@apply flex-1 ps-4 xs:ps-5 pt-1":{}},".s-search-modal-product-title":{"@apply flex flex-col justify-start items-baseline text-sm font-bold text-title-color leading-6 mb-2.5":{}},".s-search-modal-product-price":{"@apply w-full flex justify-between items-center mb-5 text-primary font-bold text-sm":{}}}});let r=require("tailwindcss/plugin").withOptions((()=>function({addUtilities:r}){r({".anime-item":{},".text-md":{},".items-top":{},".error":{},".search-box":{},".spinner-loader-wrap":{}}),r({".spinner-loader":{"border-right-color":"var(--main-color) !important","&.reverse":{"border-right-color":"#9f7171 !important","background-color":"#f98181"}}}),r(e)}));export{r as tailwind}
@@ -0,0 +1 @@
1
+ export{S as salla_login,a as salla_search_modal}from"./p-591a15cf.js";import"./p-3d53781c.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 S,r as a}
@@ -1 +1 @@
1
- import{p as s,b as e}from"./p-b390bfd1.js";(()=>{const e=import.meta.url,a={};return""!==e&&(a.resourcesUrl=new URL(".",e).href),s(a)})().then((s=>e([["p-0a7edc5f",[[1,"salla-login",{searchIcon:[1,"search-icon"],visible:[1540],searchTerm:[32],results:[32],fetchStatus:[32],showResult:[32]},[[8,"click","handleClick"]]],[0,"salla-search-modal",{searchPlaceholder:[1,"search-placeholder"],searchTerm:[32],results:[32],fetchStatus:[32],showResult:[32],showModal:[32]}]]]],s)));
1
+ import{p as s,b as e}from"./p-3d53781c.js";(()=>{const e=import.meta.url,l={};return""!==e&&(l.resourcesUrl=new URL(".",e).href),s(l)})().then((s=>e([["p-01102f97",[[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)));
@@ -1,9 +1,4 @@
1
- declare global {
2
- interface Window {
3
- salla: any;
4
- taha: string;
5
- }
6
- }
1
+ import { HTMLStencilElement } from '../../stencil-public-runtime';
7
2
  export declare class SearchModal {
8
3
  searchTerm: string;
9
4
  results: string[];
@@ -14,6 +9,15 @@ export declare class SearchModal {
14
9
  * The text to overwrite search placeholder.
15
10
  */
16
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;
17
21
  private handleChange;
18
22
  private getProduct;
19
23
  private openSearch;
@@ -14,6 +14,10 @@ export namespace Components {
14
14
  "visible": boolean;
15
15
  }
16
16
  interface SallaSearchModal {
17
+ /**
18
+ * The text to overwrite no results text.
19
+ */
20
+ "noResultsText": string;
17
21
  /**
18
22
  * The text to overwrite search placeholder.
19
23
  */
@@ -47,6 +51,10 @@ declare namespace LocalJSX {
47
51
  "visible"?: boolean;
48
52
  }
49
53
  interface SallaSearchModal {
54
+ /**
55
+ * The text to overwrite no results text.
56
+ */
57
+ "noResultsText"?: string;
50
58
  /**
51
59
  * The text to overwrite search placeholder.
52
60
  */
@@ -1 +1,8 @@
1
- export * from './components';
1
+ declare global {
2
+ interface Window {
3
+ salla: any;
4
+ }
5
+ }
6
+ export * from './components/salla-login/salla-login';
7
+ export * from './components/search-modal/search-modal';
8
+ export * from './plugins/tailwind-theme/index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-components",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "twilight",
@@ -1 +0,0 @@
1
- import{r as s,h as t,H as e}from"./p-b390bfd1.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 i=class{constructor(t){s(this,t),this.fetchStatus="",this.showModal=!1,this.searchPlaceholder="Search here ...",this.handleChange=s=>{this.searchTerm=s.target.value,console.log("this.value",this.searchTerm),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=()=>{console.log("openSearchModal"),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=()=>{console.log("closeSearchModal"),this.searchTerm="",this.fetchStatus="",this.results=[],document.getElementsByTagName("html")[0].style.position="static",document.getElementsByTagName("html")[0].style.overflowY="auto",this.showModal=!1}}getProduct(s){var e;return t("div",{key:s.id,class:"s-search-modal-results-item"},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"},t("h3",{class:"s-search-modal-product-title-h3"},s.title)),t("div",{class:"s-search-modal-product-price"},t("h4",{class:"s-search-modal-product-price-h4"},null===(e=s.price)||void 0===e?void 0:e.after)))))}render(){return t(e,{class:"s-search-modal"},t("button",{type:"button",onClick:this.openSearch,class:"s-search-modal-search-button-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"},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",{onClick:s=>{s.stopPropagation()},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.results&&this.results.map((s=>this.getProduct(s))))))))}static get assetsDirs(){return["assets"]}};i.style="";export{a as salla_login,i as salla_search_modal}
@@ -1 +0,0 @@
1
- let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={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)},i=e=>Promise.resolve(e),c=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),r=(e,t,n)=>{n&&n.map((([n,l,s])=>{const i=a(e,n),c=u(t,s),r=f(n);o.ael(i,l,c,r),(t.o=t.o||[]).push((()=>o.rel(i,l,c,r)))}))},u=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){D(e)}},a=(e,t)=>8&t?l:e,f=e=>0!=(2&e),$=new WeakMap,y=e=>"sc-"+e.$,h={},d=e=>"object"==(e=typeof e)||"function"===e,p=(e,t,...n)=>{let l=null,s=null,o=!1,i=!1,c=[];const r=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?r(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof e&&!d(l))&&(l+=""),o&&i?c[c.length-1].h+=l:c.push(o?m(null,l):l),i=o)};if(r(n),t){t.key&&(s=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const u=m(e,null);return u.p=t,c.length>0&&(u.m=c),u.S=s,u},m=(e,t)=>({t:0,g:e,h:t,v:null,m:null,p:null,S:null}),w={},b=(e,t,n,s,i,c)=>{if(n!==s){let r=B(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,l=g(n),o=g(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if("style"===t){for(const t in n)s&&null!=s[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in s)n&&s[t]===n[t]||(t.includes("-")?e.style.setProperty(t,s[t]):e.style[t]=s[t])}else if("key"===t);else if(r||"o"!==t[0]||"n"!==t[1]){const l=d(s);if((r||l&&null!==s)&&!i)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?r=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&c||i)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):B(l,u)?u.slice(2):u[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},S=/\s/,g=e=>e?e.split(S):[],v=(e,t,n,l)=>{const s=11===t.v.nodeType&&t.v.host?t.v.host:t.v,o=e&&e.p||h,i=t.p||h;for(l in o)l in i||b(s,l,o[l],void 0,n,t.t);for(l in i)b(s,l,o[l],i[l],n,t.t)},j=(t,n,l)=>{let o,i,c=n.m[l],r=0;if(null!==c.h)o=c.v=s.createTextNode(c.h);else if(o=c.v=s.createElement(c.g),v(null,c,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),c.m)for(r=0;r<c.m.length;++r)i=j(t,c,r),i&&o.appendChild(i);return o},k=(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=j(null,l,o),c&&(s[o].v=c,r.insertBefore(c,n)))},M=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.v.remove()},C=(e,t)=>e.g===t.g&&e.S===t.S,O=(e,t)=>{const n=t.v=e.v,l=e.m,s=t.m,o=t.h;null===o?(v(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o,i=0,c=0,r=0,u=0,a=t.length-1,f=t[0],$=t[a],y=l.length-1,h=l[0],d=l[y];for(;i<=a&&c<=y;)if(null==f)f=t[++i];else if(null==$)$=t[--a];else if(null==h)h=l[++c];else if(null==d)d=l[--y];else if(C(f,h))O(f,h),f=t[++i],h=l[++c];else if(C($,d))O($,d),$=t[--a],d=l[--y];else if(C(f,d))O(f,d),e.insertBefore(f.v,$.v.nextSibling),f=t[++i],d=l[--y];else if(C($,h))O($,h),e.insertBefore($.v,f.v),$=t[--a],h=l[++c];else{for(r=-1,u=i;u<=a;++u)if(t[u]&&null!==t[u].S&&t[u].S===h.S){r=u;break}r>=0?(o=t[r],o.g!==h.g?s=j(t&&t[c],n,r):(O(o,h),t[r]=void 0,s=o.v),h=l[++c]):(s=j(t&&t[c],n,c),h=l[++c]),s&&f.v.parentNode.insertBefore(s,f.v)}i>a?k(e,null==l[y+1]?null:l[y+1].v,n,l,c,y):c>y&&M(t,i,a)})(n,l,t,s):null!==s?(null!==e.h&&(n.textContent=""),k(n,null,t,s,0,s.length-1)):null!==l&&M(l,0,l.length-1)):e.h!==o&&(n.data=o)},P=(e,t)=>{t&&!e.j&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.j=t)))},x=(e,t)=>{if(e.t|=16,!(4&e.t))return P(e,e.k),te((()=>E(e,t)));e.t|=512},E=(e,t)=>{const n=e.i;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>R(n,e,t))),e.u=null)),U(void 0,(()=>T(e,n,t)))},T=async(e,t,n)=>{const l=e.M,o=l["s-rc"];n&&(e=>{const t=e.C,n=e.M,l=t.t,o=((e,t)=>{let n=y(t),l=J.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=$.get(e=e.head||e);o||$.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.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"]=o,n.classList.add(o+"-h"))})(e);A(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>H(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},A=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.M,o=n.C,i=n.O||m(null,null),c=(e=>e&&e.g===w)(l)?l:p(null,null,l);t=s.tagName,o.P&&(c.p=c.p||{},o.P.map((([e,t])=>c.p[t]=s[e]))),c.g=null,c.t|=4,n.O=c,c.v=i.v=s.shadowRoot||s,e=s["s-sc"],O(i,c)})(n,l)}catch(e){D(e,n.M)}return null},H=e=>{const t=e.M,n=e.k;64&e.t||(e.t|=64,W(t),e.T(t),n||L()),e.j&&(e.j(),e.j=void 0),512&e.t&&ee((()=>x(e,!1))),e.t&=-517},L=()=>{W(s.documentElement),ee((()=>(e=>{const t=o.ce("appload",{detail:{namespace:"twilight-components"}});return e.dispatchEvent(t),t})(l)))},R=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){D(e)}},U=(e,t)=>e&&e.then?e.then(t):t(),W=e=>e.classList.add("hydrated"),q=(e,t,n)=>{if(t.A){const l=Object.entries(t.A),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>V(this).H.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=V(e),o=s.H.get(t),i=s.t,c=s.i;n=((e,t)=>null==e||d(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(n,l.A[t][0]),8&i&&void 0!==o||n===o||(s.H.set(t,n),c&&2==(18&i)&&x(s,!1))})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const n=new Map;s.attributeChangedCallback=function(e,t,l){o.jmp((()=>{const t=n.get(e);this.hasOwnProperty(t)&&(l=this[t],delete this[t]),this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const s=l[1]||e;return n.set(s,e),512&l[0]&&t.P.push([e,s]),s}))}}return e},F=(e,t={})=>{const n=[],i=t.exclude||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),h=[];let d,p=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>e[1].map((t=>{const l={t:t[0],$:t[1],A:t[2],L:t[3]};l.A=t[2],l.L=t[3],l.P=[];const s=l.$,a=class extends HTMLElement{constructor(e){super(e),z(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){d&&(clearTimeout(d),d=null),p?h.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=V(e),n=t.C,l=()=>{};if(1&t.t)r(e,t,n.L);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){P(t,t.k=n);break}}n.A&&Object.entries(n.A).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=I(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(q(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){D(e)}t.t&=-9,e()}if(s.style){let e=s.style;const t=y(n);if(!J.has(t)){const l=()=>{};((e,t,n)=>{let l=J.get(e);c&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,J.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.k,i=()=>x(t,!0);o&&o["s-rc"]?o["s-rc"].push(i):i()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=V(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return V(this).R}};l.U=e[0],i.includes(s)||u.get(s)||(n.push(s),u.define(s,q(a,l,1)))})))),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),p=!1,h.length?h.map((e=>e.connectedCallback())):o.jmp((()=>d=setTimeout(L,30)))},N=new WeakMap,V=e=>N.get(e),_=(e,t)=>N.set(t.i=e,t),z=(e,t)=>{const n={t:0,M:e,C:t,H:new Map};return n.R=new Promise((e=>n.T=e)),e["s-p"]=[],e["s-rc"]=[],r(e,n,t.L),N.set(e,n)},B=(e,t)=>t in e,D=(e,t)=>(0,console.error)(e,t),G=new Map,I=e=>{const t=e.$.replace(/-/g,"_"),n=e.U,l=G.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(G.set(n,e),e[t])),D)},J=new Map,K=[],Q=[],X=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?ee(Z):o.raf(Z))},Y=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){D(e)}e.length=0},Z=()=>{Y(K),Y(Q),(n=K.length>0)&&o.raf(Z)},ee=e=>i().then(e),te=X(Q,!0);export{w as H,F as b,p as h,i as p,_ as r}