@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.
- package/dist/cjs/Helper-8c75b6ac.js +20 -0
- package/dist/cjs/{index-9441fd8e.js → index-e9451c82.js} +71 -179
- package/dist/cjs/index.cjs.js +5 -114
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-currency-language.cjs.entry.js +46 -0
- package/dist/cjs/salla-login-3ec94029.js +14 -0
- package/dist/cjs/salla-login_2.cjs.entry.js +51 -5
- package/dist/cjs/{search-modal-722cccc3.js → salla-search-2b1d67e4.js} +3 -36
- package/dist/cjs/salla-search.cjs.entry.js +10 -0
- package/dist/cjs/twilight-components.cjs.js +2 -2
- package/dist/collection/Helpers/Helper.js +16 -0
- package/dist/collection/collection-manifest.json +4 -2
- package/dist/collection/components/currency-language/salla-currency-language.js +97 -0
- package/dist/collection/components/login/salla-login.js +31 -0
- package/dist/collection/components/modal/salla-modal.js +184 -0
- package/dist/collection/components/{search-modal/search-modal.js → search/salla-search.js} +2 -9
- package/dist/collection/index.js +2 -3
- package/dist/collection/plugins/tailwind-theme/{scripts/generator.js → generator.js} +7 -5
- package/dist/collection/plugins/tailwind-theme/index.js +2 -7
- package/dist/esm/Helper-23b2de40.js +18 -0
- package/dist/esm/{index-63e5409f.js → index-8919a244.js} +71 -180
- package/dist/esm/index.js +3 -115
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-currency-language.entry.js +42 -0
- package/dist/esm/salla-login-4aa5bb90.js +12 -0
- package/dist/esm/salla-login_2.entry.js +52 -2
- package/dist/esm/{search-modal-d6e12d32.js → salla-search-bd2f71b3.js} +3 -35
- package/dist/esm/salla-search.entry.js +2 -0
- package/dist/esm/twilight-components.js +2 -2
- package/dist/twilight-components/index.esm.js +1 -1
- package/dist/twilight-components/p-1abaafe4.entry.js +1 -0
- package/dist/twilight-components/p-41dc89e6.js +1 -0
- package/dist/twilight-components/p-520446eb.js +1 -0
- package/dist/twilight-components/p-58b1afae.js +1 -0
- package/dist/twilight-components/p-840f0daa.entry.js +1 -0
- package/dist/twilight-components/p-9f9af3e0.js +1 -0
- package/dist/twilight-components/p-b134c95d.entry.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +8 -0
- package/dist/types/components/currency-language/salla-currency-language.d.ts +10 -0
- package/dist/types/components/login/salla-login.d.ts +3 -0
- package/dist/types/components/modal/salla-modal.d.ts +16 -0
- package/dist/types/components/{search-modal/search-modal.d.ts → search/salla-search.d.ts} +1 -1
- package/dist/types/components.d.ts +47 -17
- package/dist/types/index.d.ts +3 -3
- package/package.json +3 -2
- package/dist/collection/components/salla-login/salla-login.css +0 -104
- package/dist/collection/components/salla-login/salla-login.js +0 -113
- package/dist/collection/components/search-modal/search-modal.css +0 -9
- package/dist/collection/utils/utils.js +0 -16
- package/dist/loader/cdn.js +0 -3
- package/dist/loader/index.cjs.js +0 -3
- package/dist/loader/index.d.ts +0 -13
- package/dist/loader/index.es2017.js +0 -3
- package/dist/loader/index.js +0 -4
- package/dist/loader/package.json +0 -10
- package/dist/twilight-components/p-01102f97.entry.js +0 -1
- package/dist/twilight-components/p-3d53781c.js +0 -1
- package/dist/twilight-components/p-591a15cf.js +0 -1
- package/dist/types/components/salla-login/salla-login.d.ts +0 -14
- package/dist/types/utils/utils.d.ts +0 -6
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class Helper extends salla.AppHelpers {
|
|
4
|
+
setHost(host) {
|
|
5
|
+
this.host = host;
|
|
6
|
+
}
|
|
7
|
+
getElement(selector) {
|
|
8
|
+
return this.host.querySelector(selector);
|
|
9
|
+
}
|
|
10
|
+
getAttribute(selector, attribute) {
|
|
11
|
+
var _a;
|
|
12
|
+
return (_a = this.getElement(selector)) === null || _a === void 0 ? void 0 : _a.getAttribute(attribute);
|
|
13
|
+
}
|
|
14
|
+
val(selector) {
|
|
15
|
+
return this.getAttribute(selector, 'value');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const Helper$1 = new Helper;
|
|
19
|
+
|
|
20
|
+
exports.Helper = Helper$1;
|
|
@@ -22,7 +22,6 @@ function _interopNamespace(e) {
|
|
|
22
22
|
|
|
23
23
|
const NAMESPACE = 'twilight-components';
|
|
24
24
|
|
|
25
|
-
let scopeId;
|
|
26
25
|
let contentRef;
|
|
27
26
|
let hostTagName;
|
|
28
27
|
let useNativeShadowDom = false;
|
|
@@ -42,49 +41,6 @@ const plt = {
|
|
|
42
41
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
43
42
|
};
|
|
44
43
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
45
|
-
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
46
|
-
try {
|
|
47
|
-
new CSSStyleSheet();
|
|
48
|
-
return typeof new CSSStyleSheet().replace === 'function';
|
|
49
|
-
}
|
|
50
|
-
catch (e) { }
|
|
51
|
-
return false;
|
|
52
|
-
})()
|
|
53
|
-
;
|
|
54
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
55
|
-
if (listeners) {
|
|
56
|
-
listeners.map(([flags, name, method]) => {
|
|
57
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
58
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
59
|
-
const opts = hostListenerOpts(flags);
|
|
60
|
-
plt.ael(target, name, handler, opts);
|
|
61
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
66
|
-
try {
|
|
67
|
-
{
|
|
68
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
69
|
-
// instance is ready, let's call it's member method for this event
|
|
70
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch (e) {
|
|
78
|
-
consoleError(e);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
82
|
-
if (flags & 8 /* TargetWindow */)
|
|
83
|
-
return win;
|
|
84
|
-
return elm;
|
|
85
|
-
};
|
|
86
|
-
// prettier-ignore
|
|
87
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
88
44
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
89
45
|
const createTime = (fnName, tagName = '') => {
|
|
90
46
|
{
|
|
@@ -100,71 +56,6 @@ const uniqueTime = (key, measureText) => {
|
|
|
100
56
|
};
|
|
101
57
|
}
|
|
102
58
|
};
|
|
103
|
-
const rootAppliedStyles = new WeakMap();
|
|
104
|
-
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
105
|
-
let style = styles.get(scopeId);
|
|
106
|
-
if (supportsConstructibleStylesheets && allowCS) {
|
|
107
|
-
style = (style || new CSSStyleSheet());
|
|
108
|
-
style.replace(cssText);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
style = cssText;
|
|
112
|
-
}
|
|
113
|
-
styles.set(scopeId, style);
|
|
114
|
-
};
|
|
115
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
116
|
-
let scopeId = getScopeId(cmpMeta);
|
|
117
|
-
let style = styles.get(scopeId);
|
|
118
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
119
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
120
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
121
|
-
if (style) {
|
|
122
|
-
if (typeof style === 'string') {
|
|
123
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
124
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
125
|
-
let styleElm;
|
|
126
|
-
if (!appliedStyles) {
|
|
127
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
128
|
-
}
|
|
129
|
-
if (!appliedStyles.has(scopeId)) {
|
|
130
|
-
{
|
|
131
|
-
{
|
|
132
|
-
styleElm = doc.createElement('style');
|
|
133
|
-
styleElm.innerHTML = style;
|
|
134
|
-
}
|
|
135
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
136
|
-
}
|
|
137
|
-
if (appliedStyles) {
|
|
138
|
-
appliedStyles.add(scopeId);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
143
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return scopeId;
|
|
147
|
-
};
|
|
148
|
-
const attachStyles = (hostRef) => {
|
|
149
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
150
|
-
const elm = hostRef.$hostElement$;
|
|
151
|
-
const flags = cmpMeta.$flags$;
|
|
152
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
153
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
154
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
155
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
156
|
-
// or this browser doesn't support native shadow dom
|
|
157
|
-
// and this host element was NOT created with SSR
|
|
158
|
-
// let's pick out the inner content for slot projection
|
|
159
|
-
// create a node to represent where the original
|
|
160
|
-
// content was first placed, which is useful later on
|
|
161
|
-
// DOM WRITE!!
|
|
162
|
-
elm['s-sc'] = scopeId;
|
|
163
|
-
elm.classList.add(scopeId + '-h');
|
|
164
|
-
}
|
|
165
|
-
endAttachStyles();
|
|
166
|
-
};
|
|
167
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
168
59
|
/**
|
|
169
60
|
* Default style mode id
|
|
170
61
|
*/
|
|
@@ -173,7 +64,6 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
|
173
64
|
* Don't add values to these!!
|
|
174
65
|
*/
|
|
175
66
|
const EMPTY_OBJ = {};
|
|
176
|
-
const isDef = (v) => v != null;
|
|
177
67
|
const isComplexType = (o) => {
|
|
178
68
|
// https://jsperf.com/typeof-fn-object/5
|
|
179
69
|
o = typeof o;
|
|
@@ -419,10 +309,6 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
419
309
|
// remember for later we need to check to relocate nodes
|
|
420
310
|
checkSlotRelocate = true;
|
|
421
311
|
if (newVNode.$tag$ === 'slot') {
|
|
422
|
-
if (scopeId) {
|
|
423
|
-
// scoped css needs to add its scoped id to the parent element
|
|
424
|
-
parentElm.classList.add(scopeId + '-s');
|
|
425
|
-
}
|
|
426
312
|
newVNode.$flags$ |= newVNode.$children$
|
|
427
313
|
? // slot element has fallback content
|
|
428
314
|
2 /* isSlotFallback */
|
|
@@ -448,15 +334,10 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
448
334
|
{
|
|
449
335
|
updateElement(null, newVNode, isSvgMode);
|
|
450
336
|
}
|
|
451
|
-
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
452
|
-
// if there is a scopeId and this is the initial render
|
|
453
|
-
// then let's add the scopeId as a css class
|
|
454
|
-
elm.classList.add((elm['s-si'] = scopeId));
|
|
455
|
-
}
|
|
456
337
|
if (newVNode.$children$) {
|
|
457
338
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
458
339
|
// create the node
|
|
459
|
-
childNode = createElm(oldParentVNode, newVNode, i
|
|
340
|
+
childNode = createElm(oldParentVNode, newVNode, i);
|
|
460
341
|
// return node could have been null
|
|
461
342
|
if (childNode) {
|
|
462
343
|
// append our new node
|
|
@@ -512,12 +393,9 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
512
393
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
513
394
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
514
395
|
let childNode;
|
|
515
|
-
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
516
|
-
containerElm = containerElm.shadowRoot;
|
|
517
|
-
}
|
|
518
396
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
519
397
|
if (vnodes[startIdx]) {
|
|
520
|
-
childNode = createElm(null, parentVNode, startIdx
|
|
398
|
+
childNode = createElm(null, parentVNode, startIdx);
|
|
521
399
|
if (childNode) {
|
|
522
400
|
vnodes[startIdx].$elm$ = childNode;
|
|
523
401
|
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
@@ -605,7 +483,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
605
483
|
else {
|
|
606
484
|
{
|
|
607
485
|
// new element
|
|
608
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx
|
|
486
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
609
487
|
newStartVnode = newCh[++newStartIdx];
|
|
610
488
|
}
|
|
611
489
|
if (node) {
|
|
@@ -832,10 +710,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
832
710
|
rootVnode.$tag$ = null;
|
|
833
711
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
834
712
|
hostRef.$vnode$ = rootVnode;
|
|
835
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm
|
|
836
|
-
{
|
|
837
|
-
scopeId = hostElm['s-sc'];
|
|
838
|
-
}
|
|
713
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
|
839
714
|
{
|
|
840
715
|
contentRef = hostElm['s-cr'];
|
|
841
716
|
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
@@ -922,6 +797,19 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
922
797
|
}
|
|
923
798
|
};
|
|
924
799
|
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
800
|
+
const createEvent = (ref, name, flags) => {
|
|
801
|
+
const elm = getElement(ref);
|
|
802
|
+
return {
|
|
803
|
+
emit: (detail) => {
|
|
804
|
+
return emitEvent(elm, name, {
|
|
805
|
+
bubbles: !!(flags & 4 /* Bubbles */),
|
|
806
|
+
composed: !!(flags & 2 /* Composed */),
|
|
807
|
+
cancelable: !!(flags & 1 /* Cancellable */),
|
|
808
|
+
detail,
|
|
809
|
+
});
|
|
810
|
+
},
|
|
811
|
+
};
|
|
812
|
+
};
|
|
925
813
|
/**
|
|
926
814
|
* Helper function to create & dispatch a custom Event on a provided target
|
|
927
815
|
* @param elm the target of the Event
|
|
@@ -959,29 +847,18 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
959
847
|
const instance = hostRef.$lazyInstance$ ;
|
|
960
848
|
let promise;
|
|
961
849
|
if (isInitialLoad) {
|
|
962
|
-
{
|
|
963
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
964
|
-
if (hostRef.$queuedListeners$) {
|
|
965
|
-
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
966
|
-
hostRef.$queuedListeners$ = null;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
850
|
{
|
|
970
851
|
promise = safeCall(instance, 'componentWillLoad');
|
|
971
852
|
}
|
|
972
853
|
}
|
|
973
854
|
endSchedule();
|
|
974
|
-
return then(promise, () => updateComponent(hostRef, instance
|
|
855
|
+
return then(promise, () => updateComponent(hostRef, instance));
|
|
975
856
|
};
|
|
976
857
|
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
977
858
|
// updateComponent
|
|
978
859
|
const elm = hostRef.$hostElement$;
|
|
979
860
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
980
861
|
const rc = elm['s-rc'];
|
|
981
|
-
if (isInitialLoad) {
|
|
982
|
-
// DOM WRITE!
|
|
983
|
-
attachStyles(hostRef);
|
|
984
|
-
}
|
|
985
862
|
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
986
863
|
{
|
|
987
864
|
callRender(hostRef, instance);
|
|
@@ -1037,7 +914,11 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1037
914
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1038
915
|
const elm = hostRef.$hostElement$;
|
|
1039
916
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
917
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1040
918
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
919
|
+
{
|
|
920
|
+
safeCall(instance, 'componentDidRender');
|
|
921
|
+
}
|
|
1041
922
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1042
923
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1043
924
|
{
|
|
@@ -1055,6 +936,9 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1055
936
|
else {
|
|
1056
937
|
endPostUpdate();
|
|
1057
938
|
}
|
|
939
|
+
{
|
|
940
|
+
hostRef.$onInstanceResolve$(elm);
|
|
941
|
+
}
|
|
1058
942
|
// load events fire from bottom to top
|
|
1059
943
|
// the deepest elements load first then bubbles up
|
|
1060
944
|
{
|
|
@@ -1119,6 +1003,7 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
1119
1003
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1120
1004
|
// check our new property value against our internal value
|
|
1121
1005
|
const hostRef = getHostRef(ref);
|
|
1006
|
+
const elm = hostRef.$hostElement$ ;
|
|
1122
1007
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
1123
1008
|
const flags = hostRef.$flags$;
|
|
1124
1009
|
const instance = hostRef.$lazyInstance$ ;
|
|
@@ -1128,6 +1013,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1128
1013
|
// set our new value!
|
|
1129
1014
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1130
1015
|
if (instance) {
|
|
1016
|
+
// get an array of method names of watch functions to call
|
|
1017
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1018
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1019
|
+
if (watchMethods) {
|
|
1020
|
+
// this instance is watching for when this property changed
|
|
1021
|
+
watchMethods.map((watchMethodName) => {
|
|
1022
|
+
try {
|
|
1023
|
+
// fire off each of the watch methods that are watching this property
|
|
1024
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
1025
|
+
}
|
|
1026
|
+
catch (e) {
|
|
1027
|
+
consoleError(e, elm);
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1131
1032
|
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1132
1033
|
// looks like this value actually changed, so we've got work to do!
|
|
1133
1034
|
// but only if we've already rendered, otherwise just chill out
|
|
@@ -1140,6 +1041,9 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1140
1041
|
};
|
|
1141
1042
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1142
1043
|
if (cmpMeta.$members$) {
|
|
1044
|
+
if (Cstr.watchers) {
|
|
1045
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1046
|
+
}
|
|
1143
1047
|
// It's better to have a const than two Object.entries()
|
|
1144
1048
|
const members = Object.entries(cmpMeta.$members$);
|
|
1145
1049
|
const prototype = Cstr.prototype;
|
|
@@ -1160,6 +1064,16 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1160
1064
|
enumerable: true,
|
|
1161
1065
|
});
|
|
1162
1066
|
}
|
|
1067
|
+
else if (flags & 1 /* isElementConstructor */ &&
|
|
1068
|
+
memberFlags & 64 /* Method */) {
|
|
1069
|
+
// proxyComponent - method
|
|
1070
|
+
Object.defineProperty(prototype, memberName, {
|
|
1071
|
+
value(...args) {
|
|
1072
|
+
const ref = getHostRef(this);
|
|
1073
|
+
return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
|
|
1074
|
+
},
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1163
1077
|
});
|
|
1164
1078
|
if ((flags & 1 /* isElementConstructor */)) {
|
|
1165
1079
|
const attrNameToPropName = new Map();
|
|
@@ -1239,6 +1153,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1239
1153
|
endLoad();
|
|
1240
1154
|
}
|
|
1241
1155
|
if (!Cstr.isProxied) {
|
|
1156
|
+
// we've never proxied this Constructor before
|
|
1157
|
+
// let's add the getters/setters to its prototype before
|
|
1158
|
+
// the first time we create an instance of the implementation
|
|
1159
|
+
{
|
|
1160
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1161
|
+
}
|
|
1242
1162
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1243
1163
|
Cstr.isProxied = true;
|
|
1244
1164
|
}
|
|
@@ -1262,17 +1182,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1262
1182
|
{
|
|
1263
1183
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1264
1184
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
if (Cstr.style) {
|
|
1268
|
-
// this component has styles but we haven't registered them yet
|
|
1269
|
-
let style = Cstr.style;
|
|
1270
|
-
const scopeId = getScopeId(cmpMeta);
|
|
1271
|
-
if (!styles.has(scopeId)) {
|
|
1272
|
-
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1273
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1274
|
-
endRegisterStyles();
|
|
1185
|
+
{
|
|
1186
|
+
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1275
1187
|
}
|
|
1188
|
+
endNewInstance();
|
|
1276
1189
|
}
|
|
1277
1190
|
}
|
|
1278
1191
|
// we've successfully created a lazy instance
|
|
@@ -1338,12 +1251,6 @@ const connectedCallback = (elm) => {
|
|
|
1338
1251
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
1339
1252
|
}
|
|
1340
1253
|
}
|
|
1341
|
-
else {
|
|
1342
|
-
// not the first time this has connected
|
|
1343
|
-
// reattach any event listeners to the host
|
|
1344
|
-
// since they would have been removed when disconnected
|
|
1345
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
1346
|
-
}
|
|
1347
1254
|
endConnected();
|
|
1348
1255
|
}
|
|
1349
1256
|
};
|
|
@@ -1360,13 +1267,7 @@ const setContentReference = (elm) => {
|
|
|
1360
1267
|
};
|
|
1361
1268
|
const disconnectedCallback = (elm) => {
|
|
1362
1269
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1363
|
-
|
|
1364
|
-
{
|
|
1365
|
-
if (hostRef.$rmListeners$) {
|
|
1366
|
-
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1367
|
-
hostRef.$rmListeners$ = undefined;
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1270
|
+
getHostRef(elm);
|
|
1370
1271
|
}
|
|
1371
1272
|
};
|
|
1372
1273
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
@@ -1393,10 +1294,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1393
1294
|
cmpMeta.$members$ = compactMeta[2];
|
|
1394
1295
|
}
|
|
1395
1296
|
{
|
|
1396
|
-
cmpMeta.$
|
|
1297
|
+
cmpMeta.$attrsToReflect$ = [];
|
|
1397
1298
|
}
|
|
1398
1299
|
{
|
|
1399
|
-
cmpMeta.$
|
|
1300
|
+
cmpMeta.$watchers$ = {};
|
|
1400
1301
|
}
|
|
1401
1302
|
const tagName = cmpMeta.$tagName$;
|
|
1402
1303
|
const HostElement = class extends HTMLElement {
|
|
@@ -1406,17 +1307,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1406
1307
|
super(self);
|
|
1407
1308
|
self = this;
|
|
1408
1309
|
registerHost(self, cmpMeta);
|
|
1409
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1410
|
-
// this component is using shadow dom
|
|
1411
|
-
// and this browser supports shadow dom
|
|
1412
|
-
// add the read-only property "shadowRoot" to the host element
|
|
1413
|
-
// adding the shadow root build conditionals to minimize runtime
|
|
1414
|
-
{
|
|
1415
|
-
{
|
|
1416
|
-
self.attachShadow({ mode: 'open' });
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
1310
|
}
|
|
1421
1311
|
connectedCallback() {
|
|
1422
1312
|
if (appLoadFallback) {
|
|
@@ -1472,12 +1362,14 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1472
1362
|
$cmpMeta$: cmpMeta,
|
|
1473
1363
|
$instanceValues$: new Map(),
|
|
1474
1364
|
};
|
|
1365
|
+
{
|
|
1366
|
+
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
|
1367
|
+
}
|
|
1475
1368
|
{
|
|
1476
1369
|
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
1477
1370
|
elm['s-p'] = [];
|
|
1478
1371
|
elm['s-rc'] = [];
|
|
1479
1372
|
}
|
|
1480
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
1481
1373
|
return hostRefs.set(elm, hostRef);
|
|
1482
1374
|
};
|
|
1483
1375
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
@@ -1502,7 +1394,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1502
1394
|
return importedModule[exportName];
|
|
1503
1395
|
}, consoleError);
|
|
1504
1396
|
};
|
|
1505
|
-
const styles = new Map();
|
|
1506
1397
|
const queueDomReads = [];
|
|
1507
1398
|
const queueDomWrites = [];
|
|
1508
1399
|
const queueTask = (queue, write) => (cb) => {
|
|
@@ -1548,6 +1439,7 @@ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
|
1548
1439
|
|
|
1549
1440
|
exports.Host = Host;
|
|
1550
1441
|
exports.bootstrapLazy = bootstrapLazy;
|
|
1442
|
+
exports.createEvent = createEvent;
|
|
1551
1443
|
exports.getElement = getElement;
|
|
1552
1444
|
exports.h = h;
|
|
1553
1445
|
exports.promiseResolve = promiseResolve;
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,120 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
require('./
|
|
5
|
+
const sallaLogin = require('./salla-login-3ec94029.js');
|
|
6
|
+
const sallaSearch = require('./salla-search-2b1d67e4.js');
|
|
7
|
+
require('./index-e9451c82.js');
|
|
7
8
|
|
|
8
|
-
const utilities = {
|
|
9
|
-
".s-search-modal-search-button-icon": {
|
|
10
|
-
"@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": {
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
".s-search-modal-container": {
|
|
14
|
-
"@apply fixed inset-0 z-50 flex items-top justify-center overflow-auto items-top": {
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
".s-search-modal-wrapper": {
|
|
18
|
-
"@apply bg-transparent w-full": {
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
".s-search-modal-inner": {
|
|
22
|
-
"@apply mx-auto w-11/12 lg:w-6/12": {
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
".s-search-modal-search-box-container": {
|
|
26
|
-
"@apply mt-36 search-box anime-item": {
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
".s-search-modal-search-box-inner": {
|
|
30
|
-
"@apply relative bg-white rounded-tiny border border-border-color": {
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
".s-search-modal-search-box-inner-open": {
|
|
34
|
-
"@apply relative bg-white rounded-tiny border border-border-color rounded-b-none": {
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
".s-search-modal-input": {
|
|
38
|
-
"@apply anime-item bg-transparent border-0 form-input w-full ps-10 pt-6 pb-7 rounded-tiny text-gray-600": {
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
".s-search-modal-search-icon": {
|
|
42
|
-
"@apply anime-item flex justify-end items-center absolute top-4 start-4 text-md text-gray-text": {
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
".s-search-modal-spinner": {
|
|
46
|
-
"@apply spinner-loader-wrap absolute top-1/2 transform -translate-y-1/2 start-4 w-4 h-4": {
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
".s-search-modal-spinner-loader": {
|
|
50
|
-
"@apply block spinner-loader w-4 h-4 animate-spin border-2 border-gray-300 rounded-full": {
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
".s-search-modal-search-results": {
|
|
54
|
-
"@apply m-auto max-h-96 overflow-y-auto bg-white rounded-b-tiny": {
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
".s-search-modal-no-results": {
|
|
58
|
-
"@apply error p-4 text-sm text-gray-text": {
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
".s-search-modal-product": {
|
|
62
|
-
"@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": {
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
".s-search-modal-product-image-container": {
|
|
66
|
-
"@apply relative overflow-hidden w-20 h-20 sm:w-28 sm:h-28 rounded-md": {
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
".s-search-modal-product-image": {
|
|
70
|
-
"@apply h-full w-full object-cover": {
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
".s-search-modal-product-details": {
|
|
74
|
-
"@apply flex-1 ps-4 xs:ps-5 pt-1": {
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
".s-search-modal-product-title": {
|
|
78
|
-
"@apply flex flex-col justify-start items-baseline text-sm font-bold text-title-color leading-6 mb-2.5": {
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
".s-search-modal-product-price": {
|
|
82
|
-
"@apply w-full flex justify-between items-center mb-5 text-primary font-bold text-sm": {
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
9
|
|
|
87
|
-
const componentsClasses = /*#__PURE__*/Object.freeze({
|
|
88
|
-
__proto__: null,
|
|
89
|
-
'default': utilities
|
|
90
|
-
});
|
|
91
10
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
addUtilities({
|
|
95
|
-
// TODO :: find if there are used and defined them here if its.
|
|
96
|
-
'.anime-item': {},
|
|
97
|
-
'.text-md': {},
|
|
98
|
-
'.items-top': {},
|
|
99
|
-
'.error': {},
|
|
100
|
-
'.search-box': {},
|
|
101
|
-
'.spinner-loader-wrap': {}
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// todo :: move it to global
|
|
105
|
-
addUtilities({
|
|
106
|
-
'.spinner-loader': {
|
|
107
|
-
'border-right-color': 'var(--main-color) !important',
|
|
108
|
-
'&.reverse': {
|
|
109
|
-
'border-right-color': '#9f7171 !important',
|
|
110
|
-
'background-color': '#f98181'
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
addUtilities(componentsClasses);
|
|
116
|
-
};
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
exports.SallaLogin = searchModal.SallaLogin;
|
|
120
|
-
exports.SearchModal = searchModal.SearchModal;
|
|
121
|
-
exports.tailwind = tailwind;
|
|
11
|
+
exports.SallaLogin = sallaLogin.SallaLogin;
|
|
12
|
+
exports.SallaSearch = sallaSearch.SallaSearch;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-e9451c82.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-login_2.cjs",[[
|
|
17
|
+
return index.bootstrapLazy([["salla-login_2.cjs",[[0,"salla-login"],[4,"salla-modal",{"error":[4],"success":[4],"visible":[516],"subTitle":[1,"sub-title"],"icon":[1]}]]],["salla-currency-language.cjs",[[4,"salla-currency-language",{"show":[64],"hide":[64]}]]],["salla-search.cjs",[[4,"salla-search",{"searchPlaceholder":[1,"search-placeholder"],"noResultsText":[1,"no-results-text"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-e9451c82.js');
|
|
6
|
+
const Helper = require('./Helper-8c75b6ac.js');
|
|
7
|
+
|
|
8
|
+
const SallaCurrencyLanguage = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
Helper.Helper.setHost(this.host);
|
|
12
|
+
}
|
|
13
|
+
async show() {
|
|
14
|
+
this.modal.setAttribute('visible', '');
|
|
15
|
+
}
|
|
16
|
+
async hide() {
|
|
17
|
+
this.modal.removeAttribute('visible');
|
|
18
|
+
}
|
|
19
|
+
submit() {
|
|
20
|
+
this.hide()
|
|
21
|
+
.then(() => {
|
|
22
|
+
let code = Helper.Helper.val('[name=currency]:checked');
|
|
23
|
+
if (code !== salla.config.currency.code) {
|
|
24
|
+
return salla.currency.api.change(code);
|
|
25
|
+
}
|
|
26
|
+
}).then(() => {
|
|
27
|
+
let language = Helper.Helper.val('[name=lang]:checked');
|
|
28
|
+
if (language !== salla.config.language.code) {
|
|
29
|
+
window.location.href = salla.config.languages.filter(lang => lang.code === language)[0].url;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
return (index.h("salla-modal", { id: "lang-currency-modal", class: "hidden" }, index.h("slot", { name: "header" }, index.h("div", { slot: "header" })), index.h("div", { class: "s-currency-language-inner" }, salla.config.languages
|
|
35
|
+
? index.h("div", { class: "s-currency-language-section" }, index.h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.language')), index.h("fieldset", { class: "s-currency-language-fieldset" }, index.h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_language')), index.h("div", { class: "s-currency-language-section-inner" }, salla.config.languages.map(lang => index.h("div", { class: "flex items-center" }, index.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 }), index.h("label", { htmlFor: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-label" }, index.h("span", null, lang.name), index.h("div", { class: 's-currency-language-flag flag iti__flag iti__' + lang.country_code })))))))
|
|
36
|
+
: '', salla.config.currencies
|
|
37
|
+
? index.h("div", { class: "s-currency-language-section" }, index.h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.currency')), index.h("fieldset", { class: "s-currency-language-fieldset" }, index.h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_currency')), index.h("div", { class: "s-currency-language-section-inner" }, salla.config.currencies.map(currency => index.h("div", { class: "s-currency-language-item" }, index.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 }), index.h("label", { class: "s-currency-language-label", htmlFor: 'currency-' + currency.code }, index.h("span", null, currency.name), index.h("small", { class: "s-currency-language-currency" }, currency.code)))))))
|
|
38
|
+
: ''), index.h("p", { slot: "footer" }, index.h("slot", { name: "footer" }, index.h("button", { type: "button", class: "s-currency-language-submit", onClick: () => this.submit() }, salla.lang.get('common.elements.ok'))))));
|
|
39
|
+
}
|
|
40
|
+
componentDidRender() {
|
|
41
|
+
this.modal = document.querySelector('#lang-currency-modal');
|
|
42
|
+
}
|
|
43
|
+
get host() { return index.getElement(this); }
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.salla_currency_language = SallaCurrencyLanguage;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-e9451c82.js');
|
|
4
|
+
|
|
5
|
+
const SallaLogin = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
index.registerInstance(this, hostRef);
|
|
8
|
+
}
|
|
9
|
+
render() {
|
|
10
|
+
return (index.h("salla-modal", { id: "salla-login", title: "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u0648\u0642\u0639" }, index.h("div", { id: "showLoginMethods" }, index.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"), index.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" }, index.h("div", { class: "flex-shrink-0" }, index.h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" }, index.h("i", { class: "sicon-mail" }))), index.h("div", { class: "flex-1 min-w-0" }, index.h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" }, index.h("div", { class: "flex-1" }, index.h("span", { class: "absolute inset-0", "aria-hidden": "true" }), index.h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"), index.h("h6", { class: "font-boldf" }, "\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A")), index.h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))), index.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" }, index.h("div", { class: "flex-shrink-0" }, index.h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" }, index.h("i", { class: "sicon-phone" }))), index.h("div", { class: "flex-1 min-w-0" }, index.h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" }, index.h("div", { class: "flex-1" }, index.h("span", { class: "absolute inset-0", "aria-hidden": "true" }), index.h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"), index.h("h6", { class: "font-boldf" }, "\u0627\u0644\u0647\u0627\u062A\u0641")), index.h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))))));
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.SallaLogin = SallaLogin;
|