@salla.sa/twilight-components 1.0.99 → 1.0.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-fdf99836.js → index-b4140db0.js} +26 -98
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/salla-add-product-button_6.cjs.entry.js +73 -56
- package/dist/cjs/salla-branches.cjs.entry.js +10 -6
- package/dist/cjs/salla-conditional-fields.cjs.entry.js +4 -5
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +6 -5
- package/dist/cjs/salla-login-modal.cjs.entry.js +4 -4
- package/dist/cjs/salla-offer-modal.cjs.entry.js +4 -3
- package/dist/cjs/salla-quantity-input.cjs.entry.js +3 -3
- package/dist/cjs/salla-rating-modal.cjs.entry.js +5 -5
- package/dist/cjs/salla-rating-stars.cjs.entry.js +27 -36
- package/dist/cjs/{salla-verify-modal.cjs.entry.js → salla-verify.cjs.entry.js} +20 -14
- package/dist/cjs/twilight-components.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +2 -3
- package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +13 -28
- package/dist/collection/components/salla-branches/salla-branches.css +0 -3
- package/dist/collection/components/salla-branches/salla-branches.js +10 -6
- package/dist/collection/components/salla-button/salla-button.css +1 -88
- package/dist/collection/components/salla-button/salla-button.js +2 -26
- package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +3 -7
- package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.css +0 -3
- package/dist/collection/components/salla-installment/salla-installment.css +4 -3
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.css +2 -16
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +4 -3
- package/dist/collection/components/salla-login-modal/salla-login-modal.css +1 -8
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +3 -3
- package/dist/collection/components/salla-modal/salla-modal.css +0 -3
- package/dist/collection/components/salla-modal/salla-modal.js +13 -12
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.css +1 -25
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +2 -1
- package/dist/collection/components/salla-product-availability/salla-product-availability.css +0 -3
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +18 -13
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.css +4 -3
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +3 -3
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.css +1 -20
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +3 -3
- package/dist/collection/components/salla-rating-stars/salla-rating-stars.css +3 -5
- package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +26 -35
- package/dist/collection/components/salla-search/salla-search.css +1 -45
- package/dist/collection/components/salla-search/salla-search.js +35 -16
- package/dist/collection/components/salla-tel-input/salla-tel-input.css +13 -8
- package/dist/collection/components/{salla-verify-modal/salla-verify-modal.css → salla-verify/salla-verify.css} +1 -8
- package/dist/collection/components/{salla-verify-modal/salla-verify-modal.js → salla-verify/salla-verify.js} +33 -26
- package/dist/collection/plugins/tailwind-theme/generator.js +6 -2
- package/dist/collection/plugins/tailwind-theme/index.js +3 -3
- package/dist/components/index.d.ts +17 -5
- package/dist/components/index.js +17 -0
- package/dist/components/salla-add-product-button.js +14 -12
- package/dist/components/salla-branches.js +9 -5
- package/dist/components/salla-button2.js +3 -10
- package/dist/components/salla-conditional-fields.js +3 -4
- package/dist/components/salla-localization-modal.js +5 -4
- package/dist/components/salla-login-modal.js +6 -6
- package/dist/components/salla-modal2.js +7 -7
- package/dist/components/salla-offer-modal.js +3 -2
- package/dist/components/salla-product-availability2.js +17 -12
- package/dist/components/salla-quantity-input.js +2 -2
- package/dist/components/salla-rating-modal.js +4 -4
- package/dist/components/salla-rating-stars2.js +26 -35
- package/dist/components/salla-search.js +33 -15
- package/dist/components/salla-tel-input2.js +3 -3
- package/dist/components/{salla-sizes-table.d.ts → salla-verify.d.ts} +4 -4
- package/dist/components/salla-verify.js +9 -0
- package/dist/components/{salla-verify-modal2.js → salla-verify2.js} +24 -18
- package/dist/esm/{index-4ffd4317.js → index-20b84fd0.js} +26 -98
- package/dist/esm/loader.js +3 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/salla-add-product-button_6.entry.js +73 -56
- package/dist/esm/salla-branches.entry.js +10 -6
- package/dist/esm/salla-conditional-fields.entry.js +4 -5
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +6 -5
- package/dist/esm/salla-login-modal.entry.js +4 -4
- package/dist/esm/salla-offer-modal.entry.js +4 -3
- package/dist/esm/salla-quantity-input.entry.js +3 -3
- package/dist/esm/salla-rating-modal.entry.js +5 -5
- package/dist/esm/salla-rating-stars.entry.js +27 -36
- package/dist/esm/{salla-verify-modal.entry.js → salla-verify.entry.js} +20 -14
- package/dist/esm/twilight-components.js +3 -3
- package/dist/twilight-components/{p-8c69a096.entry.js → p-15fac4f2.entry.js} +1 -1
- package/dist/twilight-components/p-27d01075.entry.js +4 -0
- package/dist/twilight-components/p-30e63760.entry.js +4 -0
- package/dist/twilight-components/{p-edbb12b2.entry.js → p-5ee94c9e.entry.js} +1 -1
- package/dist/twilight-components/p-799da239.entry.js +4 -0
- package/dist/twilight-components/p-9ff78dd1.entry.js +4 -0
- package/dist/twilight-components/p-c1952856.entry.js +4 -0
- package/dist/twilight-components/p-c2bef5f2.js +5 -0
- package/dist/twilight-components/p-cf143464.entry.js +4 -0
- package/dist/twilight-components/p-d3778858.entry.js +4 -0
- package/dist/twilight-components/p-ebd2e045.entry.js +4 -0
- package/dist/twilight-components/p-ec0a2892.entry.js +4 -0
- package/dist/twilight-components/{p-56065da6.entry.js → p-fab65162.entry.js} +1 -1
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-add-product-button/salla-add-product-button.d.ts +1 -2
- package/dist/types/components/salla-button/salla-button.d.ts +0 -5
- package/dist/types/components/salla-rating-stars/salla-rating-stars.d.ts +1 -0
- package/dist/types/components/salla-search/salla-search.d.ts +6 -1
- package/dist/types/components/{salla-verify-modal/salla-verify-modal.d.ts → salla-verify/salla-verify.d.ts} +3 -2
- package/dist/types/components.d.ts +33 -50
- package/example/dist/translations.js +1 -1
- package/example/index.html +184 -162
- package/example/tailwind.config.js +4 -7
- package/package.json +9 -13
- package/dist/cjs/salla-sizes-table.cjs.entry.js +0 -22
- package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.css +0 -3
- package/dist/collection/components/salla-sizes-table/salla-sizes-table.css +0 -6
- package/dist/collection/components/salla-sizes-table/salla-sizes-table.js +0 -18
- package/dist/components/salla-sizes-table.js +0 -37
- package/dist/components/salla-verify-modal.d.ts +0 -11
- package/dist/components/salla-verify-modal.js +0 -9
- package/dist/esm/salla-sizes-table.entry.js +0 -18
- package/dist/twilight-components/p-1d0e664c.js +0 -4
- package/dist/twilight-components/p-210f5278.entry.js +0 -4
- package/dist/twilight-components/p-2384537d.entry.js +0 -4
- package/dist/twilight-components/p-2b1c3490.entry.js +0 -4
- package/dist/twilight-components/p-7fae6b84.entry.js +0 -4
- package/dist/twilight-components/p-9e05640e.entry.js +0 -4
- package/dist/twilight-components/p-af450175.entry.js +0 -4
- package/dist/twilight-components/p-d762e16f.entry.js +0 -4
- package/dist/twilight-components/p-d77dd260.entry.js +0 -4
- package/dist/twilight-components/p-e435a209.entry.js +0 -4
- package/dist/twilight-components/p-ecaee6a4.entry.js +0 -4
- package/dist/types/components/salla-sizes-table/salla-sizes-table.d.ts +0 -3
- package/example/.DS_Store +0 -0
- package/example/.gitignore +0 -2
- package/example/dist/.DS_Store +0 -0
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const NAMESPACE = 'twilight-components';
|
|
5
5
|
|
|
6
|
-
let scopeId;
|
|
7
6
|
let contentRef;
|
|
8
7
|
let hostTagName;
|
|
9
8
|
let useNativeShadowDom = false;
|
|
@@ -24,10 +23,10 @@ const plt = {
|
|
|
24
23
|
};
|
|
25
24
|
const supportsShadow = true;
|
|
26
25
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
27
|
-
const
|
|
26
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
28
27
|
try {
|
|
29
28
|
new CSSStyleSheet();
|
|
30
|
-
return typeof new CSSStyleSheet().
|
|
29
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
31
30
|
}
|
|
32
31
|
catch (e) { }
|
|
33
32
|
return false;
|
|
@@ -93,9 +92,14 @@ const uniqueTime = (key, measureText) => {
|
|
|
93
92
|
const rootAppliedStyles = new WeakMap();
|
|
94
93
|
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
95
94
|
let style = styles.get(scopeId);
|
|
96
|
-
if (
|
|
95
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
97
96
|
style = (style || new CSSStyleSheet());
|
|
98
|
-
style
|
|
97
|
+
if (typeof style === 'string') {
|
|
98
|
+
style = cssText;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
style.replaceSync(cssText);
|
|
102
|
+
}
|
|
99
103
|
}
|
|
100
104
|
else {
|
|
101
105
|
style = cssText;
|
|
@@ -104,7 +108,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
104
108
|
};
|
|
105
109
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
106
110
|
let scopeId = getScopeId(cmpMeta);
|
|
107
|
-
|
|
111
|
+
const style = styles.get(scopeId);
|
|
108
112
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
109
113
|
// so the fallback is to always use the document for the root node in those cases
|
|
110
114
|
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
@@ -143,24 +147,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
143
147
|
const attachStyles = (hostRef) => {
|
|
144
148
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
145
149
|
const elm = hostRef.$hostElement$;
|
|
146
|
-
const flags = cmpMeta.$flags$;
|
|
147
150
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
148
|
-
|
|
149
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
150
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
151
|
-
// or this browser doesn't support native shadow dom
|
|
152
|
-
// and this host element was NOT created with SSR
|
|
153
|
-
// let's pick out the inner content for slot projection
|
|
154
|
-
// create a node to represent where the original
|
|
155
|
-
// content was first placed, which is useful later on
|
|
156
|
-
// DOM WRITE!!
|
|
157
|
-
elm['s-sc'] = scopeId;
|
|
158
|
-
elm.classList.add(scopeId + '-h');
|
|
159
|
-
}
|
|
151
|
+
addStyle(elm.getRootNode(), cmpMeta);
|
|
160
152
|
endAttachStyles();
|
|
161
153
|
};
|
|
162
154
|
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
163
|
-
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
|
164
155
|
/**
|
|
165
156
|
* Default style mode id
|
|
166
157
|
*/
|
|
@@ -169,7 +160,6 @@ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g
|
|
|
169
160
|
* Don't add values to these!!
|
|
170
161
|
*/
|
|
171
162
|
const EMPTY_OBJ = {};
|
|
172
|
-
const isDef = (v) => v != null;
|
|
173
163
|
const isComplexType = (o) => {
|
|
174
164
|
// https://jsperf.com/typeof-fn-object/5
|
|
175
165
|
o = typeof o;
|
|
@@ -192,7 +182,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
192
182
|
let slotName = null;
|
|
193
183
|
let simple = false;
|
|
194
184
|
let lastSimple = false;
|
|
195
|
-
|
|
185
|
+
const vNodeChildren = [];
|
|
196
186
|
const walk = (c) => {
|
|
197
187
|
for (let i = 0; i < c.length; i++) {
|
|
198
188
|
child = c[i];
|
|
@@ -367,7 +357,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
367
357
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
368
358
|
try {
|
|
369
359
|
if (!elm.tagName.includes('-')) {
|
|
370
|
-
|
|
360
|
+
const n = newValue == null ? '' : newValue;
|
|
371
361
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
372
362
|
if (memberName === 'list') {
|
|
373
363
|
isProp = false;
|
|
@@ -444,7 +434,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
444
434
|
};
|
|
445
435
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
446
436
|
// tslint:disable-next-line: prefer-const
|
|
447
|
-
|
|
437
|
+
const newVNode = newParentVNode.$children$[childIndex];
|
|
448
438
|
let i = 0;
|
|
449
439
|
let elm;
|
|
450
440
|
let childNode;
|
|
@@ -453,10 +443,6 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
453
443
|
// remember for later we need to check to relocate nodes
|
|
454
444
|
checkSlotRelocate = true;
|
|
455
445
|
if (newVNode.$tag$ === 'slot') {
|
|
456
|
-
if (scopeId) {
|
|
457
|
-
// scoped css needs to add its scoped id to the parent element
|
|
458
|
-
parentElm.classList.add(scopeId + '-s');
|
|
459
|
-
}
|
|
460
446
|
newVNode.$flags$ |= newVNode.$children$
|
|
461
447
|
? // slot element has fallback content
|
|
462
448
|
2 /* isSlotFallback */
|
|
@@ -482,15 +468,10 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
482
468
|
{
|
|
483
469
|
updateElement(null, newVNode, isSvgMode);
|
|
484
470
|
}
|
|
485
|
-
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
486
|
-
// if there is a scopeId and this is the initial render
|
|
487
|
-
// then let's add the scopeId as a css class
|
|
488
|
-
elm.classList.add((elm['s-si'] = scopeId));
|
|
489
|
-
}
|
|
490
471
|
if (newVNode.$children$) {
|
|
491
472
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
492
473
|
// create the node
|
|
493
|
-
childNode = createElm(oldParentVNode, newVNode, i
|
|
474
|
+
childNode = createElm(oldParentVNode, newVNode, i);
|
|
494
475
|
// return node could have been null
|
|
495
476
|
if (childNode) {
|
|
496
477
|
// append our new node
|
|
@@ -546,12 +527,9 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
546
527
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
547
528
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
548
529
|
let childNode;
|
|
549
|
-
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
550
|
-
containerElm = containerElm.shadowRoot;
|
|
551
|
-
}
|
|
552
530
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
553
531
|
if (vnodes[startIdx]) {
|
|
554
|
-
childNode = createElm(null, parentVNode, startIdx
|
|
532
|
+
childNode = createElm(null, parentVNode, startIdx);
|
|
555
533
|
if (childNode) {
|
|
556
534
|
vnodes[startIdx].$elm$ = childNode;
|
|
557
535
|
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
@@ -654,7 +632,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
654
632
|
if (idxInOld >= 0) {
|
|
655
633
|
elmToMove = oldCh[idxInOld];
|
|
656
634
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
657
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld
|
|
635
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
658
636
|
}
|
|
659
637
|
else {
|
|
660
638
|
patch(elmToMove, newStartVnode);
|
|
@@ -665,7 +643,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
665
643
|
}
|
|
666
644
|
else {
|
|
667
645
|
// new element
|
|
668
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx
|
|
646
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
669
647
|
newStartVnode = newCh[++newStartIdx];
|
|
670
648
|
}
|
|
671
649
|
if (node) {
|
|
@@ -752,7 +730,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
752
730
|
};
|
|
753
731
|
const updateFallbackSlotVisibility = (elm) => {
|
|
754
732
|
// tslint:disable-next-line: prefer-const
|
|
755
|
-
|
|
733
|
+
const childNodes = elm.childNodes;
|
|
756
734
|
let childNode;
|
|
757
735
|
let i;
|
|
758
736
|
let ilen;
|
|
@@ -805,8 +783,8 @@ const relocateSlotContent = (elm) => {
|
|
|
805
783
|
let relocateNodeData;
|
|
806
784
|
let j;
|
|
807
785
|
let i = 0;
|
|
808
|
-
|
|
809
|
-
|
|
786
|
+
const childNodes = elm.childNodes;
|
|
787
|
+
const ilen = childNodes.length;
|
|
810
788
|
for (; i < ilen; i++) {
|
|
811
789
|
childNode = childNodes[i];
|
|
812
790
|
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
@@ -900,10 +878,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
900
878
|
rootVnode.$tag$ = null;
|
|
901
879
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
902
880
|
hostRef.$vnode$ = rootVnode;
|
|
903
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm
|
|
904
|
-
{
|
|
905
|
-
scopeId = hostElm['s-sc'];
|
|
906
|
-
}
|
|
881
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
|
907
882
|
{
|
|
908
883
|
contentRef = hostElm['s-cr'];
|
|
909
884
|
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
@@ -1191,7 +1166,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1191
1166
|
const shadowRoot = hostElm.shadowRoot;
|
|
1192
1167
|
const childRenderNodes = [];
|
|
1193
1168
|
const slotNodes = [];
|
|
1194
|
-
const shadowRootNodes =
|
|
1169
|
+
const shadowRootNodes = null;
|
|
1195
1170
|
const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
|
|
1196
1171
|
if (!plt.$orgLocNodes$) {
|
|
1197
1172
|
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
|
@@ -1215,13 +1190,6 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1215
1190
|
}
|
|
1216
1191
|
plt.$orgLocNodes$.delete(orgLocationId);
|
|
1217
1192
|
});
|
|
1218
|
-
if (shadowRoot) {
|
|
1219
|
-
shadowRootNodes.map((shadowRootNode) => {
|
|
1220
|
-
if (shadowRootNode) {
|
|
1221
|
-
shadowRoot.appendChild(shadowRootNode);
|
|
1222
|
-
}
|
|
1223
|
-
});
|
|
1224
|
-
}
|
|
1225
1193
|
endHydrate();
|
|
1226
1194
|
};
|
|
1227
1195
|
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
|
@@ -1325,22 +1293,6 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
|
|
|
1325
1293
|
node['s-sn'] = '';
|
|
1326
1294
|
}
|
|
1327
1295
|
node['s-sr'] = true;
|
|
1328
|
-
if (shadowRootNodes) {
|
|
1329
|
-
// browser support shadowRoot and this is a shadow dom component
|
|
1330
|
-
// create an actual slot element
|
|
1331
|
-
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
1332
|
-
if (childVNode.$name$) {
|
|
1333
|
-
// add the slot name attribute
|
|
1334
|
-
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
|
1335
|
-
}
|
|
1336
|
-
// insert the new slot element before the slot comment
|
|
1337
|
-
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
1338
|
-
// remove the slot comment since it's not needed for shadow
|
|
1339
|
-
node.remove();
|
|
1340
|
-
if (childVNode.$depth$ === '0') {
|
|
1341
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
1296
|
slotNodes.push(childVNode);
|
|
1345
1297
|
if (!parentVNode.$children$) {
|
|
1346
1298
|
parentVNode.$children$ = [];
|
|
@@ -1349,11 +1301,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
|
|
|
1349
1301
|
}
|
|
1350
1302
|
else if (childNodeType === CONTENT_REF_ID) {
|
|
1351
1303
|
// `${CONTENT_REF_ID}.${hostId}`;
|
|
1352
|
-
|
|
1353
|
-
// remove the content ref comment since it's not needed for shadow
|
|
1354
|
-
node.remove();
|
|
1355
|
-
}
|
|
1356
|
-
else {
|
|
1304
|
+
{
|
|
1357
1305
|
hostElm['s-cr'] = node;
|
|
1358
1306
|
node['s-cn'] = true;
|
|
1359
1307
|
}
|
|
@@ -1676,10 +1624,6 @@ const connectedCallback = (elm) => {
|
|
|
1676
1624
|
{
|
|
1677
1625
|
hostId = elm.getAttribute(HYDRATE_ID);
|
|
1678
1626
|
if (hostId) {
|
|
1679
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1680
|
-
const scopeId = addStyle(elm.shadowRoot, cmpMeta);
|
|
1681
|
-
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
|
1682
|
-
}
|
|
1683
1627
|
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
1684
1628
|
}
|
|
1685
1629
|
}
|
|
@@ -1765,10 +1709,8 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1765
1709
|
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
|
1766
1710
|
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
|
|
1767
1711
|
const deferredConnectedCallbacks = [];
|
|
1768
|
-
const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
1769
1712
|
let appLoadFallback;
|
|
1770
1713
|
let isBootstrapping = true;
|
|
1771
|
-
let i = 0;
|
|
1772
1714
|
Object.assign(plt, options);
|
|
1773
1715
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1774
1716
|
{
|
|
@@ -1776,11 +1718,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1776
1718
|
// async queue. This will improve the first input delay
|
|
1777
1719
|
plt.$flags$ |= 2 /* appLoaded */;
|
|
1778
1720
|
}
|
|
1779
|
-
{
|
|
1780
|
-
for (; i < styles.length; i++) {
|
|
1781
|
-
registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
1721
|
lazyBundles.map((lazyBundle) => {
|
|
1785
1722
|
lazyBundle[1].map((compactMeta) => {
|
|
1786
1723
|
const cmpMeta = {
|
|
@@ -1809,17 +1746,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1809
1746
|
super(self);
|
|
1810
1747
|
self = this;
|
|
1811
1748
|
registerHost(self, cmpMeta);
|
|
1812
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1813
|
-
// this component is using shadow dom
|
|
1814
|
-
// and this browser supports shadow dom
|
|
1815
|
-
// add the read-only property "shadowRoot" to the host element
|
|
1816
|
-
// adding the shadow root build conditionals to minimize runtime
|
|
1817
|
-
{
|
|
1818
|
-
{
|
|
1819
|
-
self.attachShadow({ mode: 'open' });
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
1749
|
}
|
|
1824
1750
|
connectedCallback() {
|
|
1825
1751
|
if (appLoadFallback) {
|
|
@@ -1898,7 +1824,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1898
1824
|
if (module) {
|
|
1899
1825
|
return module[exportName];
|
|
1900
1826
|
}
|
|
1827
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
1901
1828
|
return import(
|
|
1829
|
+
/* @vite-ignore */
|
|
1902
1830
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1903
1831
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1904
1832
|
/* webpackMode: "lazy" */
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
4
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-20b84fd0.js';
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
|
-
Stencil Client Patch Esm v2.
|
|
7
|
+
Stencil Client Patch Esm v2.17.1 | MIT Licensed | https://stenciljs.com
|
|
8
8
|
*/
|
|
9
9
|
const patchEsm = () => {
|
|
10
10
|
return promiseResolve();
|
|
@@ -13,7 +13,7 @@ const patchEsm = () => {
|
|
|
13
13
|
const defineCustomElements = (win, options) => {
|
|
14
14
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
15
15
|
return patchEsm().then(() => {
|
|
16
|
-
return bootstrapLazy([["salla-add-product-button_6",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"]
|
|
16
|
+
return bootstrapLazy([["salla-add-product-button_6",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32],"typing":[32],"debounce":[32],"search_term":[32]}],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"emailErrorMsg":[32],"isVisitorSubscribed":[32]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"iconStyle":[1,"icon-style"],"imageIcon":[1,"image-icon"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-login-modal",[[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]]]],["salla-rating-modal",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"open":[64],"close":[64]}]]],["salla-branches",[[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-modal",[[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}]]],["salla-offer-modal",[[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"add_to_cart":[32],"out_of_stock":[32],"open":[64],"showOffer":[64]}]]],["salla-conditional-fields",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-infinite-scroll",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-installment",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-quantity-input",[[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}]]],["salla-verify",[[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}]]],["salla-rating-stars",[[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}]]]], options);
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.substr(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window);
|
|
1
|
+
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.slice(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window);
|