@salla.sa/twilight-components 1.0.17 → 1.0.19

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 (64) hide show
  1. package/dist/cjs/{Helper-8852feaa.js → Helper-fcea994c.js} +1 -1
  2. package/dist/cjs/{index-0b5b5867.js → index-4b8b3ffe.js} +46 -6
  3. package/dist/cjs/index.cjs.js +4 -4
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/salla-branches.cjs.entry.js +1 -1
  6. package/dist/cjs/salla-button_5.cjs.entry.js +1686 -0
  7. package/dist/cjs/salla-localization.cjs.entry.js +18 -16
  8. package/dist/cjs/{salla-login-342876b9.js → salla-login-008cc893.js} +15 -8
  9. package/dist/cjs/salla-offer.cjs.entry.js +33 -8
  10. package/dist/cjs/salla-product-availability.cjs.entry.js +2 -2
  11. package/dist/cjs/salla-rating.cjs.entry.js +2 -2
  12. package/dist/cjs/{salla-search-28da4616.js → salla-search-c7aad59a.js} +2 -2
  13. package/dist/cjs/salla-search.cjs.entry.js +3 -3
  14. package/dist/cjs/twilight-components.cjs.js +2 -2
  15. package/dist/collection/Helpers/Helper.js +1 -1
  16. package/dist/collection/collection-manifest.json +1 -0
  17. package/dist/collection/components/salla-localization/salla-localization.js +16 -14
  18. package/dist/collection/components/salla-login/salla-login.css +3 -0
  19. package/dist/collection/components/salla-login/salla-login.js +73 -43
  20. package/dist/collection/components/salla-offer/salla-offer.js +51 -10
  21. package/dist/collection/components/salla-tel-input/salla-tel-input.js +14 -0
  22. package/dist/collection/components/salla-verify/salla-verify.js +37 -2
  23. package/dist/esm/{Helper-81ac9a8c.js → Helper-d07ebbc7.js} +1 -1
  24. package/dist/esm/{index-8b97d225.js → index-092659c7.js} +46 -6
  25. package/dist/esm/index.js +4 -4
  26. package/dist/esm/loader.js +2 -2
  27. package/dist/esm/salla-branches.entry.js +1 -1
  28. package/dist/esm/salla-button_5.entry.js +1678 -0
  29. package/dist/esm/salla-localization.entry.js +18 -16
  30. package/dist/esm/{salla-login-32d25ffa.js → salla-login-38586400.js} +15 -8
  31. package/dist/esm/salla-offer.entry.js +33 -8
  32. package/dist/esm/salla-product-availability.entry.js +2 -2
  33. package/dist/esm/salla-rating.entry.js +2 -2
  34. package/dist/esm/{salla-search-f552c487.js → salla-search-ca856aab.js} +2 -2
  35. package/dist/esm/salla-search.entry.js +3 -3
  36. package/dist/esm/twilight-components.js +2 -2
  37. package/dist/twilight-components/index.esm.js +1 -1
  38. package/dist/twilight-components/p-03d0ec44.entry.js +1 -0
  39. package/dist/twilight-components/p-13a55257.entry.js +1 -0
  40. package/dist/twilight-components/p-160062c6.js +1 -0
  41. package/dist/twilight-components/{p-9bc28e0c.js → p-47f17d3b.js} +1 -1
  42. package/dist/twilight-components/{p-fa04c4b6.entry.js → p-5307c7b5.entry.js} +1 -1
  43. package/dist/twilight-components/{p-3cfede65.entry.js → p-6a1f43c6.entry.js} +1 -1
  44. package/dist/twilight-components/{p-33990e49.entry.js → p-7088e517.entry.js} +1 -1
  45. package/dist/twilight-components/{p-36683152.js → p-924e3c88.js} +1 -1
  46. package/dist/twilight-components/p-e8965b01.js +1 -0
  47. package/dist/twilight-components/p-ecb1b6cc.entry.js +1 -0
  48. package/dist/twilight-components/p-f11b401a.entry.js +1 -0
  49. package/dist/twilight-components/twilight-components.esm.js +1 -1
  50. package/dist/types/components/salla-localization/salla-localization.d.ts +2 -0
  51. package/dist/types/components/salla-login/salla-login.d.ts +2 -2
  52. package/dist/types/components/salla-offer/salla-offer.d.ts +50 -2
  53. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +4 -0
  54. package/dist/types/components/salla-verify/salla-verify.d.ts +2 -0
  55. package/dist/types/components.d.ts +19 -1
  56. package/package.json +2 -1
  57. package/dist/cjs/salla-button_4.cjs.entry.js +0 -299
  58. package/dist/esm/salla-button_4.entry.js +0 -292
  59. package/dist/twilight-components/p-648661c8.entry.js +0 -1
  60. package/dist/twilight-components/p-93c3ac79.js +0 -1
  61. package/dist/twilight-components/p-a923a51e.entry.js +0 -1
  62. package/dist/twilight-components/p-bc278b0e.entry.js +0 -1
  63. package/dist/twilight-components/p-cb1c59a2.js +0 -1
  64. package/dist/twilight-components/p-fa2f0e64.entry.js +0 -1
@@ -15,7 +15,7 @@ class Helper extends salla.AppHelpers {
15
15
  return this.getAttribute(selector, 'value');
16
16
  }
17
17
  isUser() {
18
- return !!salla.config.is_user;
18
+ return salla.config.get('user.type') === 'user';
19
19
  }
20
20
  }
21
21
  const Helper$1 = new Helper;
@@ -22,6 +22,7 @@ function _interopNamespace(e) {
22
22
 
23
23
  const NAMESPACE = 'twilight-components';
24
24
 
25
+ let scopeId;
25
26
  let contentRef;
26
27
  let hostTagName;
27
28
  let useNativeShadowDom = false;
@@ -143,8 +144,20 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
143
144
  const attachStyles = (hostRef) => {
144
145
  const cmpMeta = hostRef.$cmpMeta$;
145
146
  const elm = hostRef.$hostElement$;
147
+ const flags = cmpMeta.$flags$;
146
148
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
147
- addStyle(elm.getRootNode(), cmpMeta);
149
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
150
+ if (flags & 10 /* needsScopedEncapsulation */) {
151
+ // only required when we're NOT using native shadow dom (slot)
152
+ // or this browser doesn't support native shadow dom
153
+ // and this host element was NOT created with SSR
154
+ // let's pick out the inner content for slot projection
155
+ // create a node to represent where the original
156
+ // content was first placed, which is useful later on
157
+ // DOM WRITE!!
158
+ elm['s-sc'] = scopeId;
159
+ elm.classList.add(scopeId + '-h');
160
+ }
148
161
  endAttachStyles();
149
162
  };
150
163
  const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
@@ -156,6 +169,7 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
156
169
  * Don't add values to these!!
157
170
  */
158
171
  const EMPTY_OBJ = {};
172
+ const isDef = (v) => v != null;
159
173
  const isComplexType = (o) => {
160
174
  // https://jsperf.com/typeof-fn-object/5
161
175
  o = typeof o;
@@ -440,6 +454,10 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
440
454
  // remember for later we need to check to relocate nodes
441
455
  checkSlotRelocate = true;
442
456
  if (newVNode.$tag$ === 'slot') {
457
+ if (scopeId) {
458
+ // scoped css needs to add its scoped id to the parent element
459
+ parentElm.classList.add(scopeId + '-s');
460
+ }
443
461
  newVNode.$flags$ |= newVNode.$children$
444
462
  ? // slot element has fallback content
445
463
  2 /* isSlotFallback */
@@ -465,10 +483,15 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
465
483
  {
466
484
  updateElement(null, newVNode, isSvgMode);
467
485
  }
486
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
487
+ // if there is a scopeId and this is the initial render
488
+ // then let's add the scopeId as a css class
489
+ elm.classList.add((elm['s-si'] = scopeId));
490
+ }
468
491
  if (newVNode.$children$) {
469
492
  for (i = 0; i < newVNode.$children$.length; ++i) {
470
493
  // create the node
471
- childNode = createElm(oldParentVNode, newVNode, i);
494
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
472
495
  // return node could have been null
473
496
  if (childNode) {
474
497
  // append our new node
@@ -524,9 +547,12 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
524
547
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
525
548
  let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
526
549
  let childNode;
550
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
551
+ containerElm = containerElm.shadowRoot;
552
+ }
527
553
  for (; startIdx <= endIdx; ++startIdx) {
528
554
  if (vnodes[startIdx]) {
529
- childNode = createElm(null, parentVNode, startIdx);
555
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
530
556
  if (childNode) {
531
557
  vnodes[startIdx].$elm$ = childNode;
532
558
  containerElm.insertBefore(childNode, referenceNode(before) );
@@ -629,7 +655,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
629
655
  if (idxInOld >= 0) {
630
656
  elmToMove = oldCh[idxInOld];
631
657
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
632
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
658
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
633
659
  }
634
660
  else {
635
661
  patch(elmToMove, newStartVnode);
@@ -640,7 +666,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
640
666
  }
641
667
  else {
642
668
  // new element
643
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
669
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
644
670
  newStartVnode = newCh[++newStartIdx];
645
671
  }
646
672
  if (node) {
@@ -875,7 +901,10 @@ const renderVdom = (hostRef, renderFnResults) => {
875
901
  rootVnode.$tag$ = null;
876
902
  rootVnode.$flags$ |= 4 /* isHost */;
877
903
  hostRef.$vnode$ = rootVnode;
878
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
904
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
905
+ {
906
+ scopeId = hostElm['s-sc'];
907
+ }
879
908
  {
880
909
  contentRef = hostElm['s-cr'];
881
910
  useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
@@ -1515,6 +1544,17 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1515
1544
  super(self);
1516
1545
  self = this;
1517
1546
  registerHost(self, cmpMeta);
1547
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1548
+ // this component is using shadow dom
1549
+ // and this browser supports shadow dom
1550
+ // add the read-only property "shadowRoot" to the host element
1551
+ // adding the shadow root build conditionals to minimize runtime
1552
+ {
1553
+ {
1554
+ self.attachShadow({ mode: 'open' });
1555
+ }
1556
+ }
1557
+ }
1518
1558
  }
1519
1559
  connectedCallback() {
1520
1560
  if (appLoadFallback) {
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const sallaLogin = require('./salla-login-342876b9.js');
6
- const sallaSearch = require('./salla-search-28da4616.js');
7
- require('./index-0b5b5867.js');
8
- require('./Helper-8852feaa.js');
5
+ const sallaLogin = require('./salla-login-008cc893.js');
6
+ const sallaSearch = require('./salla-search-c7aad59a.js');
7
+ require('./index-4b8b3ffe.js');
8
+ require('./Helper-fcea994c.js');
9
9
 
10
10
 
11
11
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-0b5b5867.js');
5
+ const index = require('./index-4b8b3ffe.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.8.1 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["salla-button_4.cjs",[[0,"salla-login",{"loginTypeTitle":[1,"login-type-title"],"loginText":[1,"login-text"],"smsLabel":[1,"sms-label"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"enterText":[1,"enter-text"],"bySMSText":[1,"by-s-m-s-text"],"byEmailText":[1,"by-email-text"],"backText":[1,"back-text"],"show":[64]},[[0,"verified","onVerified"],[0,"modalClosed","onModalClose"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[1],"by":[1],"autoReload":[4,"auto-reload"],"getCode":[64],"show":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[1,"languages-title"],"currenciesTitle":[1,"currencies-title"],"ok":[1],"show":[64],"hide":[64],"submit":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"buttonText":[1,"button-text"],"countryCode":[1,"country-code"],"subscribeText":[1,"subscribe-text"],"cancelText":[1,"cancel-text"],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"subscribedMessage":[1,"subscribed-message"],"isSubscribed":[1028,"is-subscribed"],"submit":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"orderId":[2,"order-id"],"thanksMsg":[1,"thanks-msg"],"isStoreRating":[4,"is-store-rating"],"isProductsRating":[4,"is-products-rating"],"isShippingRating":[4,"is-shipping-rating"],"show":[64],"hide":[64]}]]],["salla-offer.cjs",[[4,"salla-offer",{"show":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"placeholder":[1],"noResultsText":[1,"no-results-text"],"results":[32]},[[0,"modalClosed","onModalClose"]]]]]], options);
17
+ return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isLoginByMail":[4,"is-login-by-mail"],"loginTypeTitle":[1,"login-type-title"],"loginText":[1,"login-text"],"smsLabel":[1,"sms-label"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"enterText":[1,"enter-text"],"bySMSText":[1,"by-s-m-s-text"],"byEmailText":[1,"by-email-text"],"backText":[1,"back-text"],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[1],"by":[1],"backText":[1,"back-text"],"autoReload":[4,"auto-reload"],"getCode":[64],"show":[64]}],[1,"salla-tel-input"],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[1,"languages-title"],"currenciesTitle":[1,"currencies-title"],"ok":[1],"show":[64],"hide":[64],"submit":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"buttonText":[1,"button-text"],"countryCode":[1,"country-code"],"subscribeText":[1,"subscribe-text"],"cancelText":[1,"cancel-text"],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"subscribedMessage":[1,"subscribed-message"],"isSubscribed":[1028,"is-subscribed"],"submit":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"orderId":[2,"order-id"],"thanksMsg":[1,"thanks-msg"],"isStoreRating":[4,"is-store-rating"],"isProductsRating":[4,"is-products-rating"],"isShippingRating":[4,"is-shipping-rating"],"show":[64],"hide":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"placeholder":[1],"noResultsText":[1,"no-results-text"],"results":[32]},[[0,"modalClosed","onModalClose"]]]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-0b5b5867.js');
5
+ const index = require('./index-4b8b3ffe.js');
6
6
 
7
7
  const sallaBranchesCss = ":host{display:block}";
8
8