@salla.sa/twilight-components 1.0.4 → 1.0.6

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 (61) hide show
  1. package/dist/cjs/Helper-8c75b6ac.js +20 -0
  2. package/dist/cjs/{index-9441fd8e.js → index-e9451c82.js} +71 -179
  3. package/dist/cjs/index.cjs.js +5 -114
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/salla-currency-language.cjs.entry.js +46 -0
  6. package/dist/cjs/salla-login-3ec94029.js +14 -0
  7. package/dist/cjs/salla-login_2.cjs.entry.js +51 -5
  8. package/dist/cjs/{search-modal-722cccc3.js → salla-search-2b1d67e4.js} +3 -36
  9. package/dist/cjs/salla-search.cjs.entry.js +10 -0
  10. package/dist/cjs/twilight-components.cjs.js +2 -2
  11. package/dist/collection/Helpers/Helper.js +16 -0
  12. package/dist/collection/collection-manifest.json +4 -2
  13. package/dist/collection/components/currency-language/salla-currency-language.js +97 -0
  14. package/dist/collection/components/login/salla-login.js +31 -0
  15. package/dist/collection/components/modal/salla-modal.js +184 -0
  16. package/dist/collection/components/{search-modal/search-modal.js → search/salla-search.js} +2 -9
  17. package/dist/collection/index.js +2 -3
  18. package/dist/collection/plugins/tailwind-theme/{scripts/generator.js → generator.js} +7 -5
  19. package/dist/collection/plugins/tailwind-theme/index.js +2 -7
  20. package/dist/esm/Helper-23b2de40.js +18 -0
  21. package/dist/esm/{index-63e5409f.js → index-8919a244.js} +71 -180
  22. package/dist/esm/index.js +3 -115
  23. package/dist/esm/loader.js +2 -2
  24. package/dist/esm/salla-currency-language.entry.js +42 -0
  25. package/dist/esm/salla-login-4aa5bb90.js +12 -0
  26. package/dist/esm/salla-login_2.entry.js +52 -2
  27. package/dist/esm/{search-modal-d6e12d32.js → salla-search-bd2f71b3.js} +3 -35
  28. package/dist/esm/salla-search.entry.js +2 -0
  29. package/dist/esm/twilight-components.js +2 -2
  30. package/dist/twilight-components/index.esm.js +1 -1
  31. package/dist/twilight-components/p-1abaafe4.entry.js +1 -0
  32. package/dist/twilight-components/p-41dc89e6.js +1 -0
  33. package/dist/twilight-components/p-520446eb.js +1 -0
  34. package/dist/twilight-components/p-58b1afae.js +1 -0
  35. package/dist/twilight-components/p-840f0daa.entry.js +1 -0
  36. package/dist/twilight-components/p-9f9af3e0.js +1 -0
  37. package/dist/twilight-components/p-b134c95d.entry.js +1 -0
  38. package/dist/twilight-components/twilight-components.esm.js +1 -1
  39. package/dist/types/Helpers/Helper.d.ts +8 -0
  40. package/dist/types/components/currency-language/salla-currency-language.d.ts +10 -0
  41. package/dist/types/components/login/salla-login.d.ts +3 -0
  42. package/dist/types/components/modal/salla-modal.d.ts +16 -0
  43. package/dist/types/components/{search-modal/search-modal.d.ts → search/salla-search.d.ts} +1 -1
  44. package/dist/types/components.d.ts +47 -17
  45. package/dist/types/index.d.ts +3 -3
  46. package/package.json +3 -2
  47. package/dist/collection/components/salla-login/salla-login.css +0 -104
  48. package/dist/collection/components/salla-login/salla-login.js +0 -113
  49. package/dist/collection/components/search-modal/search-modal.css +0 -9
  50. package/dist/collection/utils/utils.js +0 -16
  51. package/dist/loader/cdn.js +0 -3
  52. package/dist/loader/index.cjs.js +0 -3
  53. package/dist/loader/index.d.ts +0 -13
  54. package/dist/loader/index.es2017.js +0 -3
  55. package/dist/loader/index.js +0 -4
  56. package/dist/loader/package.json +0 -10
  57. package/dist/twilight-components/p-01102f97.entry.js +0 -1
  58. package/dist/twilight-components/p-3d53781c.js +0 -1
  59. package/dist/twilight-components/p-591a15cf.js +0 -1
  60. package/dist/types/components/salla-login/salla-login.d.ts +0 -14
  61. package/dist/types/utils/utils.d.ts +0 -6
@@ -1,6 +1,5 @@
1
1
  const NAMESPACE = 'twilight-components';
2
2
 
3
- let scopeId;
4
3
  let contentRef;
5
4
  let hostTagName;
6
5
  let useNativeShadowDom = false;
@@ -20,49 +19,6 @@ const plt = {
20
19
  ce: (eventName, opts) => new CustomEvent(eventName, opts),
21
20
  };
22
21
  const promiseResolve = (v) => Promise.resolve(v);
23
- const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
24
- try {
25
- new CSSStyleSheet();
26
- return typeof new CSSStyleSheet().replace === 'function';
27
- }
28
- catch (e) { }
29
- return false;
30
- })()
31
- ;
32
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
33
- if (listeners) {
34
- listeners.map(([flags, name, method]) => {
35
- const target = getHostListenerTarget(elm, flags) ;
36
- const handler = hostListenerProxy(hostRef, method);
37
- const opts = hostListenerOpts(flags);
38
- plt.ael(target, name, handler, opts);
39
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
40
- });
41
- }
42
- };
43
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
44
- try {
45
- {
46
- if (hostRef.$flags$ & 256 /* isListenReady */) {
47
- // instance is ready, let's call it's member method for this event
48
- hostRef.$lazyInstance$[methodName](ev);
49
- }
50
- else {
51
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
52
- }
53
- }
54
- }
55
- catch (e) {
56
- consoleError(e);
57
- }
58
- };
59
- const getHostListenerTarget = (elm, flags) => {
60
- if (flags & 8 /* TargetWindow */)
61
- return win;
62
- return elm;
63
- };
64
- // prettier-ignore
65
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
66
22
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
67
23
  const createTime = (fnName, tagName = '') => {
68
24
  {
@@ -78,71 +34,6 @@ const uniqueTime = (key, measureText) => {
78
34
  };
79
35
  }
80
36
  };
81
- const rootAppliedStyles = new WeakMap();
82
- const registerStyle = (scopeId, cssText, allowCS) => {
83
- let style = styles.get(scopeId);
84
- if (supportsConstructibleStylesheets && allowCS) {
85
- style = (style || new CSSStyleSheet());
86
- style.replace(cssText);
87
- }
88
- else {
89
- style = cssText;
90
- }
91
- styles.set(scopeId, style);
92
- };
93
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
94
- let scopeId = getScopeId(cmpMeta);
95
- let style = styles.get(scopeId);
96
- // if an element is NOT connected then getRootNode() will return the wrong root node
97
- // so the fallback is to always use the document for the root node in those cases
98
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
99
- if (style) {
100
- if (typeof style === 'string') {
101
- styleContainerNode = styleContainerNode.head || styleContainerNode;
102
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
103
- let styleElm;
104
- if (!appliedStyles) {
105
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
106
- }
107
- if (!appliedStyles.has(scopeId)) {
108
- {
109
- {
110
- styleElm = doc.createElement('style');
111
- styleElm.innerHTML = style;
112
- }
113
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
114
- }
115
- if (appliedStyles) {
116
- appliedStyles.add(scopeId);
117
- }
118
- }
119
- }
120
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
121
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
122
- }
123
- }
124
- return scopeId;
125
- };
126
- const attachStyles = (hostRef) => {
127
- const cmpMeta = hostRef.$cmpMeta$;
128
- const elm = hostRef.$hostElement$;
129
- const flags = cmpMeta.$flags$;
130
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
131
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
132
- if (flags & 10 /* needsScopedEncapsulation */) {
133
- // only required when we're NOT using native shadow dom (slot)
134
- // or this browser doesn't support native shadow dom
135
- // and this host element was NOT created with SSR
136
- // let's pick out the inner content for slot projection
137
- // create a node to represent where the original
138
- // content was first placed, which is useful later on
139
- // DOM WRITE!!
140
- elm['s-sc'] = scopeId;
141
- elm.classList.add(scopeId + '-h');
142
- }
143
- endAttachStyles();
144
- };
145
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
146
37
  /**
147
38
  * Default style mode id
148
39
  */
@@ -151,7 +42,6 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
151
42
  * Don't add values to these!!
152
43
  */
153
44
  const EMPTY_OBJ = {};
154
- const isDef = (v) => v != null;
155
45
  const isComplexType = (o) => {
156
46
  // https://jsperf.com/typeof-fn-object/5
157
47
  o = typeof o;
@@ -397,10 +287,6 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
397
287
  // remember for later we need to check to relocate nodes
398
288
  checkSlotRelocate = true;
399
289
  if (newVNode.$tag$ === 'slot') {
400
- if (scopeId) {
401
- // scoped css needs to add its scoped id to the parent element
402
- parentElm.classList.add(scopeId + '-s');
403
- }
404
290
  newVNode.$flags$ |= newVNode.$children$
405
291
  ? // slot element has fallback content
406
292
  2 /* isSlotFallback */
@@ -426,15 +312,10 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
426
312
  {
427
313
  updateElement(null, newVNode, isSvgMode);
428
314
  }
429
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
430
- // if there is a scopeId and this is the initial render
431
- // then let's add the scopeId as a css class
432
- elm.classList.add((elm['s-si'] = scopeId));
433
- }
434
315
  if (newVNode.$children$) {
435
316
  for (i = 0; i < newVNode.$children$.length; ++i) {
436
317
  // create the node
437
- childNode = createElm(oldParentVNode, newVNode, i, elm);
318
+ childNode = createElm(oldParentVNode, newVNode, i);
438
319
  // return node could have been null
439
320
  if (childNode) {
440
321
  // append our new node
@@ -490,12 +371,9 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
490
371
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
491
372
  let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
492
373
  let childNode;
493
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
494
- containerElm = containerElm.shadowRoot;
495
- }
496
374
  for (; startIdx <= endIdx; ++startIdx) {
497
375
  if (vnodes[startIdx]) {
498
- childNode = createElm(null, parentVNode, startIdx, parentElm);
376
+ childNode = createElm(null, parentVNode, startIdx);
499
377
  if (childNode) {
500
378
  vnodes[startIdx].$elm$ = childNode;
501
379
  containerElm.insertBefore(childNode, referenceNode(before) );
@@ -583,7 +461,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
583
461
  else {
584
462
  {
585
463
  // new element
586
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
464
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
587
465
  newStartVnode = newCh[++newStartIdx];
588
466
  }
589
467
  if (node) {
@@ -810,10 +688,7 @@ const renderVdom = (hostRef, renderFnResults) => {
810
688
  rootVnode.$tag$ = null;
811
689
  rootVnode.$flags$ |= 4 /* isHost */;
812
690
  hostRef.$vnode$ = rootVnode;
813
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
814
- {
815
- scopeId = hostElm['s-sc'];
816
- }
691
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
817
692
  {
818
693
  contentRef = hostElm['s-cr'];
819
694
  useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
@@ -900,6 +775,19 @@ const renderVdom = (hostRef, renderFnResults) => {
900
775
  }
901
776
  };
902
777
  const getElement = (ref) => (getHostRef(ref).$hostElement$ );
778
+ const createEvent = (ref, name, flags) => {
779
+ const elm = getElement(ref);
780
+ return {
781
+ emit: (detail) => {
782
+ return emitEvent(elm, name, {
783
+ bubbles: !!(flags & 4 /* Bubbles */),
784
+ composed: !!(flags & 2 /* Composed */),
785
+ cancelable: !!(flags & 1 /* Cancellable */),
786
+ detail,
787
+ });
788
+ },
789
+ };
790
+ };
903
791
  /**
904
792
  * Helper function to create & dispatch a custom Event on a provided target
905
793
  * @param elm the target of the Event
@@ -937,29 +825,18 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
937
825
  const instance = hostRef.$lazyInstance$ ;
938
826
  let promise;
939
827
  if (isInitialLoad) {
940
- {
941
- hostRef.$flags$ |= 256 /* isListenReady */;
942
- if (hostRef.$queuedListeners$) {
943
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
944
- hostRef.$queuedListeners$ = null;
945
- }
946
- }
947
828
  {
948
829
  promise = safeCall(instance, 'componentWillLoad');
949
830
  }
950
831
  }
951
832
  endSchedule();
952
- return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
833
+ return then(promise, () => updateComponent(hostRef, instance));
953
834
  };
954
835
  const updateComponent = async (hostRef, instance, isInitialLoad) => {
955
836
  // updateComponent
956
837
  const elm = hostRef.$hostElement$;
957
838
  const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
958
839
  const rc = elm['s-rc'];
959
- if (isInitialLoad) {
960
- // DOM WRITE!
961
- attachStyles(hostRef);
962
- }
963
840
  const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
964
841
  {
965
842
  callRender(hostRef, instance);
@@ -1015,7 +892,11 @@ const postUpdateComponent = (hostRef) => {
1015
892
  const tagName = hostRef.$cmpMeta$.$tagName$;
1016
893
  const elm = hostRef.$hostElement$;
1017
894
  const endPostUpdate = createTime('postUpdate', tagName);
895
+ const instance = hostRef.$lazyInstance$ ;
1018
896
  const ancestorComponent = hostRef.$ancestorComponent$;
897
+ {
898
+ safeCall(instance, 'componentDidRender');
899
+ }
1019
900
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1020
901
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1021
902
  {
@@ -1033,6 +914,9 @@ const postUpdateComponent = (hostRef) => {
1033
914
  else {
1034
915
  endPostUpdate();
1035
916
  }
917
+ {
918
+ hostRef.$onInstanceResolve$(elm);
919
+ }
1036
920
  // load events fire from bottom to top
1037
921
  // the deepest elements load first then bubbles up
1038
922
  {
@@ -1097,6 +981,7 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
1097
981
  const setValue = (ref, propName, newVal, cmpMeta) => {
1098
982
  // check our new property value against our internal value
1099
983
  const hostRef = getHostRef(ref);
984
+ const elm = hostRef.$hostElement$ ;
1100
985
  const oldVal = hostRef.$instanceValues$.get(propName);
1101
986
  const flags = hostRef.$flags$;
1102
987
  const instance = hostRef.$lazyInstance$ ;
@@ -1106,6 +991,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1106
991
  // set our new value!
1107
992
  hostRef.$instanceValues$.set(propName, newVal);
1108
993
  if (instance) {
994
+ // get an array of method names of watch functions to call
995
+ if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
996
+ const watchMethods = cmpMeta.$watchers$[propName];
997
+ if (watchMethods) {
998
+ // this instance is watching for when this property changed
999
+ watchMethods.map((watchMethodName) => {
1000
+ try {
1001
+ // fire off each of the watch methods that are watching this property
1002
+ instance[watchMethodName](newVal, oldVal, propName);
1003
+ }
1004
+ catch (e) {
1005
+ consoleError(e, elm);
1006
+ }
1007
+ });
1008
+ }
1009
+ }
1109
1010
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1110
1011
  // looks like this value actually changed, so we've got work to do!
1111
1012
  // but only if we've already rendered, otherwise just chill out
@@ -1118,6 +1019,9 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1118
1019
  };
1119
1020
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1120
1021
  if (cmpMeta.$members$) {
1022
+ if (Cstr.watchers) {
1023
+ cmpMeta.$watchers$ = Cstr.watchers;
1024
+ }
1121
1025
  // It's better to have a const than two Object.entries()
1122
1026
  const members = Object.entries(cmpMeta.$members$);
1123
1027
  const prototype = Cstr.prototype;
@@ -1138,6 +1042,16 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1138
1042
  enumerable: true,
1139
1043
  });
1140
1044
  }
1045
+ else if (flags & 1 /* isElementConstructor */ &&
1046
+ memberFlags & 64 /* Method */) {
1047
+ // proxyComponent - method
1048
+ Object.defineProperty(prototype, memberName, {
1049
+ value(...args) {
1050
+ const ref = getHostRef(this);
1051
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
1052
+ },
1053
+ });
1054
+ }
1141
1055
  });
1142
1056
  if ((flags & 1 /* isElementConstructor */)) {
1143
1057
  const attrNameToPropName = new Map();
@@ -1217,6 +1131,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1217
1131
  endLoad();
1218
1132
  }
1219
1133
  if (!Cstr.isProxied) {
1134
+ // we've never proxied this Constructor before
1135
+ // let's add the getters/setters to its prototype before
1136
+ // the first time we create an instance of the implementation
1137
+ {
1138
+ cmpMeta.$watchers$ = Cstr.watchers;
1139
+ }
1220
1140
  proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1221
1141
  Cstr.isProxied = true;
1222
1142
  }
@@ -1240,17 +1160,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1240
1160
  {
1241
1161
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1242
1162
  }
1243
- endNewInstance();
1244
- }
1245
- if (Cstr.style) {
1246
- // this component has styles but we haven't registered them yet
1247
- let style = Cstr.style;
1248
- const scopeId = getScopeId(cmpMeta);
1249
- if (!styles.has(scopeId)) {
1250
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1251
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1252
- endRegisterStyles();
1163
+ {
1164
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1253
1165
  }
1166
+ endNewInstance();
1254
1167
  }
1255
1168
  }
1256
1169
  // we've successfully created a lazy instance
@@ -1316,12 +1229,6 @@ const connectedCallback = (elm) => {
1316
1229
  initializeComponent(elm, hostRef, cmpMeta);
1317
1230
  }
1318
1231
  }
1319
- else {
1320
- // not the first time this has connected
1321
- // reattach any event listeners to the host
1322
- // since they would have been removed when disconnected
1323
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1324
- }
1325
1232
  endConnected();
1326
1233
  }
1327
1234
  };
@@ -1338,13 +1245,7 @@ const setContentReference = (elm) => {
1338
1245
  };
1339
1246
  const disconnectedCallback = (elm) => {
1340
1247
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1341
- const hostRef = getHostRef(elm);
1342
- {
1343
- if (hostRef.$rmListeners$) {
1344
- hostRef.$rmListeners$.map((rmListener) => rmListener());
1345
- hostRef.$rmListeners$ = undefined;
1346
- }
1347
- }
1248
+ getHostRef(elm);
1348
1249
  }
1349
1250
  };
1350
1251
  const bootstrapLazy = (lazyBundles, options = {}) => {
@@ -1371,10 +1272,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1371
1272
  cmpMeta.$members$ = compactMeta[2];
1372
1273
  }
1373
1274
  {
1374
- cmpMeta.$listeners$ = compactMeta[3];
1275
+ cmpMeta.$attrsToReflect$ = [];
1375
1276
  }
1376
1277
  {
1377
- cmpMeta.$attrsToReflect$ = [];
1278
+ cmpMeta.$watchers$ = {};
1378
1279
  }
1379
1280
  const tagName = cmpMeta.$tagName$;
1380
1281
  const HostElement = class extends HTMLElement {
@@ -1384,17 +1285,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1384
1285
  super(self);
1385
1286
  self = this;
1386
1287
  registerHost(self, cmpMeta);
1387
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1388
- // this component is using shadow dom
1389
- // and this browser supports shadow dom
1390
- // add the read-only property "shadowRoot" to the host element
1391
- // adding the shadow root build conditionals to minimize runtime
1392
- {
1393
- {
1394
- self.attachShadow({ mode: 'open' });
1395
- }
1396
- }
1397
- }
1398
1288
  }
1399
1289
  connectedCallback() {
1400
1290
  if (appLoadFallback) {
@@ -1450,12 +1340,14 @@ const registerHost = (elm, cmpMeta) => {
1450
1340
  $cmpMeta$: cmpMeta,
1451
1341
  $instanceValues$: new Map(),
1452
1342
  };
1343
+ {
1344
+ hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
1345
+ }
1453
1346
  {
1454
1347
  hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1455
1348
  elm['s-p'] = [];
1456
1349
  elm['s-rc'] = [];
1457
1350
  }
1458
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1459
1351
  return hostRefs.set(elm, hostRef);
1460
1352
  };
1461
1353
  const isMemberInElement = (elm, memberName) => memberName in elm;
@@ -1480,7 +1372,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1480
1372
  return importedModule[exportName];
1481
1373
  }, consoleError);
1482
1374
  };
1483
- const styles = new Map();
1484
1375
  const queueDomReads = [];
1485
1376
  const queueDomWrites = [];
1486
1377
  const queueTask = (queue, write) => (cb) => {
@@ -1524,4 +1415,4 @@ const flush = () => {
1524
1415
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1525
1416
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1526
1417
 
1527
- export { Host as H, bootstrapLazy as b, getElement as g, h, promiseResolve as p, registerInstance as r };
1418
+ export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };
package/dist/esm/index.js CHANGED
@@ -1,115 +1,3 @@
1
- export { S as SallaLogin, a as SearchModal } from './search-modal-d6e12d32.js';
2
- import './index-63e5409f.js';
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
+ export { S as SallaLogin } from './salla-login-4aa5bb90.js';
2
+ export { S as SallaSearch } from './salla-search-bd2f71b3.js';
3
+ import './index-8919a244.js';
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-63e5409f.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-8919a244.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"]]],[4,"salla-search-modal",{"searchPlaceholder":[1,"search-placeholder"],"noResultsText":[1,"no-results-text"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], options);
13
+ return bootstrapLazy([["salla-login_2",[[0,"salla-login"],[4,"salla-modal",{"error":[4],"success":[4],"visible":[516],"subTitle":[1,"sub-title"],"icon":[1]}]]],["salla-currency-language",[[4,"salla-currency-language",{"show":[64],"hide":[64]}]]],["salla-search",[[4,"salla-search",{"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
 
@@ -0,0 +1,42 @@
1
+ import { r as registerInstance, h, g as getElement } from './index-8919a244.js';
2
+ import { H as Helper } from './Helper-23b2de40.js';
3
+
4
+ const SallaCurrencyLanguage = class {
5
+ constructor(hostRef) {
6
+ registerInstance(this, hostRef);
7
+ Helper.setHost(this.host);
8
+ }
9
+ async show() {
10
+ this.modal.setAttribute('visible', '');
11
+ }
12
+ async hide() {
13
+ this.modal.removeAttribute('visible');
14
+ }
15
+ submit() {
16
+ this.hide()
17
+ .then(() => {
18
+ let code = Helper.val('[name=currency]:checked');
19
+ if (code !== salla.config.currency.code) {
20
+ return salla.currency.api.change(code);
21
+ }
22
+ }).then(() => {
23
+ let language = Helper.val('[name=lang]:checked');
24
+ if (language !== salla.config.language.code) {
25
+ window.location.href = salla.config.languages.filter(lang => lang.code === language)[0].url;
26
+ }
27
+ });
28
+ }
29
+ render() {
30
+ return (h("salla-modal", { id: "lang-currency-modal", class: "hidden" }, h("slot", { name: "header" }, h("div", { slot: "header" })), h("div", { class: "s-currency-language-inner" }, salla.config.languages
31
+ ? h("div", { class: "s-currency-language-section" }, h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.language')), h("fieldset", { class: "s-currency-language-fieldset" }, h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_language')), h("div", { class: "s-currency-language-section-inner" }, salla.config.languages.map(lang => h("div", { class: "flex items-center" }, h("input", { id: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-input", name: "lang", checked: salla.config.language.code == lang.code, type: "radio", value: lang.code }), h("label", { htmlFor: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-label" }, h("span", null, lang.name), h("div", { class: 's-currency-language-flag flag iti__flag iti__' + lang.country_code })))))))
32
+ : '', salla.config.currencies
33
+ ? h("div", { class: "s-currency-language-section" }, h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.currency')), h("fieldset", { class: "s-currency-language-fieldset" }, h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_currency')), h("div", { class: "s-currency-language-section-inner" }, salla.config.currencies.map(currency => h("div", { class: "s-currency-language-item" }, h("input", { class: "s-currency-language-input", checked: salla.config.currency.code == currency.code, id: 'currency-' + currency.code, name: "currency", type: "radio", value: currency.code }), h("label", { class: "s-currency-language-label", htmlFor: 'currency-' + currency.code }, h("span", null, currency.name), h("small", { class: "s-currency-language-currency" }, currency.code)))))))
34
+ : ''), h("p", { slot: "footer" }, h("slot", { name: "footer" }, h("button", { type: "button", class: "s-currency-language-submit", onClick: () => this.submit() }, salla.lang.get('common.elements.ok'))))));
35
+ }
36
+ componentDidRender() {
37
+ this.modal = document.querySelector('#lang-currency-modal');
38
+ }
39
+ get host() { return getElement(this); }
40
+ };
41
+
42
+ export { SallaCurrencyLanguage as salla_currency_language };
@@ -0,0 +1,12 @@
1
+ import { r as registerInstance, h } from './index-8919a244.js';
2
+
3
+ const SallaLogin = class {
4
+ constructor(hostRef) {
5
+ registerInstance(this, hostRef);
6
+ }
7
+ render() {
8
+ return (h("salla-modal", { id: "salla-login", title: "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u0648\u0642\u0639" }, 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" })))))));
9
+ }
10
+ };
11
+
12
+ export { SallaLogin as S };