@salla.sa/twilight-components 1.0.0 → 1.0.1
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/README.md +19 -1
- package/dist/cjs/{index-6ea83d19.js → index-a67728b4.js} +9 -392
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{salla-alert_3.cjs.entry.js → salla-login_2.cjs.entry.js} +1 -62
- package/dist/cjs/twilight-components.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +0 -2
- package/dist/esm/{index-3c2b0663.js → index-aeba9f62.js} +10 -391
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{salla-alert_3.entry.js → salla-login_2.entry.js} +2 -62
- package/dist/esm/twilight-components.js +2 -2
- package/dist/twilight-components/p-0a7edc5f.entry.js +1 -0
- package/dist/twilight-components/p-b390bfd1.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components.d.ts +0 -120
- package/package.json +3 -2
- package/dist/cjs/salla-modal.cjs.entry.js +0 -52
- package/dist/collection/components/alert/alert.css +0 -112
- package/dist/collection/components/alert/alert.js +0 -194
- package/dist/collection/components/modal/modal.css +0 -158
- package/dist/collection/components/modal/modal.js +0 -180
- package/dist/esm/salla-modal.entry.js +0 -48
- package/dist/twilight-components/p-58168e3c.entry.js +0 -1
- package/dist/twilight-components/p-a2a8cae2.entry.js +0 -1
- package/dist/twilight-components/p-e1773073.js +0 -1
- package/dist/types/components/alert/alert.d.ts +0 -38
- package/dist/types/components/modal/modal.d.ts +0 -28
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
const NAMESPACE = 'twilight-components';
|
|
2
2
|
|
|
3
3
|
let scopeId;
|
|
4
|
-
let contentRef;
|
|
5
4
|
let hostTagName;
|
|
6
|
-
let useNativeShadowDom = false;
|
|
7
|
-
let checkSlotFallbackVisibility = false;
|
|
8
|
-
let checkSlotRelocate = false;
|
|
9
5
|
let isSvgMode = false;
|
|
10
6
|
let queuePending = false;
|
|
11
7
|
const win = typeof window !== 'undefined' ? window : {};
|
|
@@ -139,9 +135,6 @@ const attachStyles = (hostRef) => {
|
|
|
139
135
|
// DOM WRITE!!
|
|
140
136
|
elm['s-sc'] = scopeId;
|
|
141
137
|
elm.classList.add(scopeId + '-h');
|
|
142
|
-
if (flags & 2 /* scopedCssEncapsulation */) {
|
|
143
|
-
elm.classList.add(scopeId + '-s');
|
|
144
|
-
}
|
|
145
138
|
}
|
|
146
139
|
endAttachStyles();
|
|
147
140
|
};
|
|
@@ -174,7 +167,6 @@ const isComplexType = (o) => {
|
|
|
174
167
|
const h = (nodeName, vnodeData, ...children) => {
|
|
175
168
|
let child = null;
|
|
176
169
|
let key = null;
|
|
177
|
-
let slotName = null;
|
|
178
170
|
let simple = false;
|
|
179
171
|
let lastSimple = false;
|
|
180
172
|
let vNodeChildren = [];
|
|
@@ -206,9 +198,6 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
206
198
|
if (vnodeData.key) {
|
|
207
199
|
key = vnodeData.key;
|
|
208
200
|
}
|
|
209
|
-
if (vnodeData.name) {
|
|
210
|
-
slotName = vnodeData.name;
|
|
211
|
-
}
|
|
212
201
|
{
|
|
213
202
|
const classData = vnodeData.className || vnodeData.class;
|
|
214
203
|
if (classData) {
|
|
@@ -229,9 +218,6 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
229
218
|
{
|
|
230
219
|
vnode.$key$ = key;
|
|
231
220
|
}
|
|
232
|
-
{
|
|
233
|
-
vnode.$name$ = slotName;
|
|
234
|
-
}
|
|
235
221
|
return vnode;
|
|
236
222
|
};
|
|
237
223
|
const newVNode = (tag, text) => {
|
|
@@ -248,9 +234,6 @@ const newVNode = (tag, text) => {
|
|
|
248
234
|
{
|
|
249
235
|
vnode.$key$ = null;
|
|
250
236
|
}
|
|
251
|
-
{
|
|
252
|
-
vnode.$name$ = null;
|
|
253
|
-
}
|
|
254
237
|
return vnode;
|
|
255
238
|
};
|
|
256
239
|
const Host = {};
|
|
@@ -408,36 +391,13 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
408
391
|
let i = 0;
|
|
409
392
|
let elm;
|
|
410
393
|
let childNode;
|
|
411
|
-
let oldVNode;
|
|
412
|
-
if (!useNativeShadowDom) {
|
|
413
|
-
// remember for later we need to check to relocate nodes
|
|
414
|
-
checkSlotRelocate = true;
|
|
415
|
-
if (newVNode.$tag$ === 'slot') {
|
|
416
|
-
if (scopeId) {
|
|
417
|
-
// scoped css needs to add its scoped id to the parent element
|
|
418
|
-
parentElm.classList.add(scopeId + '-s');
|
|
419
|
-
}
|
|
420
|
-
newVNode.$flags$ |= newVNode.$children$
|
|
421
|
-
? // slot element has fallback content
|
|
422
|
-
2 /* isSlotFallback */
|
|
423
|
-
: // slot element does not have fallback content
|
|
424
|
-
1 /* isSlotReference */;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
394
|
if (newVNode.$text$ !== null) {
|
|
428
395
|
// create text node
|
|
429
396
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
430
397
|
}
|
|
431
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
432
|
-
// create a slot reference node
|
|
433
|
-
elm = newVNode.$elm$ =
|
|
434
|
-
doc.createTextNode('');
|
|
435
|
-
}
|
|
436
398
|
else {
|
|
437
399
|
// create element
|
|
438
|
-
elm = newVNode.$elm$ = (doc.createElement(newVNode.$
|
|
439
|
-
? 'slot-fb'
|
|
440
|
-
: newVNode.$tag$));
|
|
400
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
|
|
441
401
|
// add css classes, attrs, props, listeners, etc.
|
|
442
402
|
{
|
|
443
403
|
updateElement(null, newVNode, isSvgMode);
|
|
@@ -450,7 +410,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
450
410
|
if (newVNode.$children$) {
|
|
451
411
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
452
412
|
// create the node
|
|
453
|
-
childNode = createElm(oldParentVNode, newVNode, i
|
|
413
|
+
childNode = createElm(oldParentVNode, newVNode, i);
|
|
454
414
|
// return node could have been null
|
|
455
415
|
if (childNode) {
|
|
456
416
|
// append our new node
|
|
@@ -459,62 +419,20 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
459
419
|
}
|
|
460
420
|
}
|
|
461
421
|
}
|
|
462
|
-
{
|
|
463
|
-
elm['s-hn'] = hostTagName;
|
|
464
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
465
|
-
// remember the content reference comment
|
|
466
|
-
elm['s-sr'] = true;
|
|
467
|
-
// remember the content reference comment
|
|
468
|
-
elm['s-cr'] = contentRef;
|
|
469
|
-
// remember the slot name, or empty string for default slot
|
|
470
|
-
elm['s-sn'] = newVNode.$name$ || '';
|
|
471
|
-
// check if we've got an old vnode for this slot
|
|
472
|
-
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
473
|
-
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
474
|
-
// we've got an old slot vnode and the wrapper is being replaced
|
|
475
|
-
// so let's move the old slot content back to it's original location
|
|
476
|
-
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
422
|
return elm;
|
|
481
423
|
};
|
|
482
|
-
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
483
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
484
|
-
const oldSlotChildNodes = parentElm.childNodes;
|
|
485
|
-
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
486
|
-
const childNode = oldSlotChildNodes[i];
|
|
487
|
-
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
488
|
-
// // this child node in the old element is from another component
|
|
489
|
-
// // remove this node from the old slot's parent
|
|
490
|
-
// childNode.remove();
|
|
491
|
-
// and relocate it back to it's original location
|
|
492
|
-
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
493
|
-
// remove the old original location comment entirely
|
|
494
|
-
// later on the patch function will know what to do
|
|
495
|
-
// and move this to the correct spot in need be
|
|
496
|
-
childNode['s-ol'].remove();
|
|
497
|
-
childNode['s-ol'] = undefined;
|
|
498
|
-
checkSlotRelocate = true;
|
|
499
|
-
}
|
|
500
|
-
if (recursive) {
|
|
501
|
-
putBackInOriginalLocation(childNode, recursive);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
505
|
-
};
|
|
506
424
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
507
|
-
let containerElm = (
|
|
425
|
+
let containerElm = (parentElm);
|
|
508
426
|
let childNode;
|
|
509
427
|
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
510
428
|
containerElm = containerElm.shadowRoot;
|
|
511
429
|
}
|
|
512
430
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
513
431
|
if (vnodes[startIdx]) {
|
|
514
|
-
childNode = createElm(null, parentVNode, startIdx
|
|
432
|
+
childNode = createElm(null, parentVNode, startIdx);
|
|
515
433
|
if (childNode) {
|
|
516
434
|
vnodes[startIdx].$elm$ = childNode;
|
|
517
|
-
containerElm.insertBefore(childNode,
|
|
435
|
+
containerElm.insertBefore(childNode, before);
|
|
518
436
|
}
|
|
519
437
|
}
|
|
520
438
|
}
|
|
@@ -523,20 +441,6 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
523
441
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
524
442
|
if ((vnode = vnodes[startIdx])) {
|
|
525
443
|
elm = vnode.$elm$;
|
|
526
|
-
{
|
|
527
|
-
// we're removing this element
|
|
528
|
-
// so it's possible we need to show slot fallback content now
|
|
529
|
-
checkSlotFallbackVisibility = true;
|
|
530
|
-
if (elm['s-ol']) {
|
|
531
|
-
// remove the original location comment
|
|
532
|
-
elm['s-ol'].remove();
|
|
533
|
-
}
|
|
534
|
-
else {
|
|
535
|
-
// it's possible that child nodes of the node
|
|
536
|
-
// that's being removed are slot nodes
|
|
537
|
-
putBackInOriginalLocation(elm, true);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
444
|
// remove the vnode's element from the dom
|
|
541
445
|
elm.remove();
|
|
542
446
|
}
|
|
@@ -580,20 +484,12 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
580
484
|
newEndVnode = newCh[--newEndIdx];
|
|
581
485
|
}
|
|
582
486
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
583
|
-
// Vnode moved right
|
|
584
|
-
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
585
|
-
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
586
|
-
}
|
|
587
487
|
patch(oldStartVnode, newEndVnode);
|
|
588
488
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
589
489
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
590
490
|
newEndVnode = newCh[--newEndIdx];
|
|
591
491
|
}
|
|
592
492
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
593
|
-
// Vnode moved left
|
|
594
|
-
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
595
|
-
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
596
|
-
}
|
|
597
493
|
patch(oldEndVnode, newStartVnode);
|
|
598
494
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
599
495
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
@@ -613,7 +509,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
613
509
|
if (idxInOld >= 0) {
|
|
614
510
|
elmToMove = oldCh[idxInOld];
|
|
615
511
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
616
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld
|
|
512
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
617
513
|
}
|
|
618
514
|
else {
|
|
619
515
|
patch(elmToMove, newStartVnode);
|
|
@@ -624,12 +520,12 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
624
520
|
}
|
|
625
521
|
else {
|
|
626
522
|
// new element
|
|
627
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx
|
|
523
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
628
524
|
newStartVnode = newCh[++newStartIdx];
|
|
629
525
|
}
|
|
630
526
|
if (node) {
|
|
631
527
|
{
|
|
632
|
-
|
|
528
|
+
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
633
529
|
}
|
|
634
530
|
}
|
|
635
531
|
}
|
|
@@ -645,36 +541,21 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
645
541
|
// compare if two vnode to see if they're "technically" the same
|
|
646
542
|
// need to have the same element tag, and same key to be the same
|
|
647
543
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
648
|
-
if (vnode1.$tag$ === 'slot') {
|
|
649
|
-
return vnode1.$name$ === vnode2.$name$;
|
|
650
|
-
}
|
|
651
544
|
{
|
|
652
545
|
return vnode1.$key$ === vnode2.$key$;
|
|
653
546
|
}
|
|
654
547
|
}
|
|
655
548
|
return false;
|
|
656
549
|
};
|
|
657
|
-
const referenceNode = (node) => {
|
|
658
|
-
// this node was relocated to a new location in the dom
|
|
659
|
-
// because of some other component's slot
|
|
660
|
-
// but we still have an html comment in place of where
|
|
661
|
-
// it's original location was according to it's original vdom
|
|
662
|
-
return (node && node['s-ol']) || node;
|
|
663
|
-
};
|
|
664
|
-
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
665
550
|
const patch = (oldVNode, newVNode) => {
|
|
666
551
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
667
552
|
const oldChildren = oldVNode.$children$;
|
|
668
553
|
const newChildren = newVNode.$children$;
|
|
669
|
-
const tag = newVNode.$tag$;
|
|
670
554
|
const text = newVNode.$text$;
|
|
671
|
-
let defaultHolder;
|
|
672
555
|
if (text === null) {
|
|
673
556
|
// element node
|
|
674
557
|
{
|
|
675
|
-
|
|
676
|
-
;
|
|
677
|
-
else {
|
|
558
|
+
{
|
|
678
559
|
// either this is the first render of an element OR it's an update
|
|
679
560
|
// AND we already know it's possible it could have changed
|
|
680
561
|
// this updates the element's css classes, attrs, props, listeners, etc.
|
|
@@ -699,147 +580,12 @@ const patch = (oldVNode, newVNode) => {
|
|
|
699
580
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
700
581
|
}
|
|
701
582
|
}
|
|
702
|
-
else if ((defaultHolder = elm['s-cr'])) {
|
|
703
|
-
// this element has slotted content
|
|
704
|
-
defaultHolder.parentNode.textContent = text;
|
|
705
|
-
}
|
|
706
583
|
else if (oldVNode.$text$ !== text) {
|
|
707
584
|
// update the text content for the text only vnode
|
|
708
585
|
// and also only if the text is different than before
|
|
709
586
|
elm.data = text;
|
|
710
587
|
}
|
|
711
588
|
};
|
|
712
|
-
const updateFallbackSlotVisibility = (elm) => {
|
|
713
|
-
// tslint:disable-next-line: prefer-const
|
|
714
|
-
let childNodes = elm.childNodes;
|
|
715
|
-
let childNode;
|
|
716
|
-
let i;
|
|
717
|
-
let ilen;
|
|
718
|
-
let j;
|
|
719
|
-
let slotNameAttr;
|
|
720
|
-
let nodeType;
|
|
721
|
-
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
722
|
-
childNode = childNodes[i];
|
|
723
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
724
|
-
if (childNode['s-sr']) {
|
|
725
|
-
// this is a slot fallback node
|
|
726
|
-
// get the slot name for this slot reference node
|
|
727
|
-
slotNameAttr = childNode['s-sn'];
|
|
728
|
-
// by default always show a fallback slot node
|
|
729
|
-
// then hide it if there are other slots in the light dom
|
|
730
|
-
childNode.hidden = false;
|
|
731
|
-
for (j = 0; j < ilen; j++) {
|
|
732
|
-
nodeType = childNodes[j].nodeType;
|
|
733
|
-
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
734
|
-
// this sibling node is from a different component OR is a named fallback slot node
|
|
735
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
736
|
-
childNode.hidden = true;
|
|
737
|
-
break;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
else {
|
|
741
|
-
// this is a default fallback slot node
|
|
742
|
-
// any element or text node (with content)
|
|
743
|
-
// should hide the default fallback slot node
|
|
744
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
745
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
746
|
-
childNode.hidden = true;
|
|
747
|
-
break;
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
// keep drilling down
|
|
753
|
-
updateFallbackSlotVisibility(childNode);
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
const relocateNodes = [];
|
|
758
|
-
const relocateSlotContent = (elm) => {
|
|
759
|
-
// tslint:disable-next-line: prefer-const
|
|
760
|
-
let childNode;
|
|
761
|
-
let node;
|
|
762
|
-
let hostContentNodes;
|
|
763
|
-
let slotNameAttr;
|
|
764
|
-
let relocateNodeData;
|
|
765
|
-
let j;
|
|
766
|
-
let i = 0;
|
|
767
|
-
let childNodes = elm.childNodes;
|
|
768
|
-
let ilen = childNodes.length;
|
|
769
|
-
for (; i < ilen; i++) {
|
|
770
|
-
childNode = childNodes[i];
|
|
771
|
-
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
772
|
-
// first got the content reference comment node
|
|
773
|
-
// then we got it's parent, which is where all the host content is in now
|
|
774
|
-
hostContentNodes = node.parentNode.childNodes;
|
|
775
|
-
slotNameAttr = childNode['s-sn'];
|
|
776
|
-
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
777
|
-
node = hostContentNodes[j];
|
|
778
|
-
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
779
|
-
// let's do some relocating to its new home
|
|
780
|
-
// but never relocate a content reference node
|
|
781
|
-
// that is suppose to always represent the original content location
|
|
782
|
-
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
783
|
-
// it's possible we've already decided to relocate this node
|
|
784
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
785
|
-
// made some changes to slots
|
|
786
|
-
// let's make sure we also double check
|
|
787
|
-
// fallbacks are correctly hidden or shown
|
|
788
|
-
checkSlotFallbackVisibility = true;
|
|
789
|
-
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
|
790
|
-
if (relocateNodeData) {
|
|
791
|
-
// previously we never found a slot home for this node
|
|
792
|
-
// but turns out we did, so let's remember it now
|
|
793
|
-
relocateNodeData.$slotRefNode$ = childNode;
|
|
794
|
-
}
|
|
795
|
-
else {
|
|
796
|
-
// add to our list of nodes to relocate
|
|
797
|
-
relocateNodes.push({
|
|
798
|
-
$slotRefNode$: childNode,
|
|
799
|
-
$nodeToRelocate$: node,
|
|
800
|
-
});
|
|
801
|
-
}
|
|
802
|
-
if (node['s-sr']) {
|
|
803
|
-
relocateNodes.map((relocateNode) => {
|
|
804
|
-
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
805
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
806
|
-
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
807
|
-
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
814
|
-
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
815
|
-
// if we never find a home for this element then we'll need to hide it
|
|
816
|
-
relocateNodes.push({
|
|
817
|
-
$nodeToRelocate$: node,
|
|
818
|
-
});
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
824
|
-
relocateSlotContent(childNode);
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
};
|
|
828
|
-
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
829
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
830
|
-
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
831
|
-
return true;
|
|
832
|
-
}
|
|
833
|
-
if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
|
|
834
|
-
return true;
|
|
835
|
-
}
|
|
836
|
-
return false;
|
|
837
|
-
}
|
|
838
|
-
if (nodeToRelocate['s-sn'] === slotNameAttr) {
|
|
839
|
-
return true;
|
|
840
|
-
}
|
|
841
|
-
return slotNameAttr === '';
|
|
842
|
-
};
|
|
843
589
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
844
590
|
const hostElm = hostRef.$hostElement$;
|
|
845
591
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -857,104 +603,8 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
857
603
|
{
|
|
858
604
|
scopeId = hostElm['s-sc'];
|
|
859
605
|
}
|
|
860
|
-
{
|
|
861
|
-
contentRef = hostElm['s-cr'];
|
|
862
|
-
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
863
|
-
// always reset
|
|
864
|
-
checkSlotFallbackVisibility = false;
|
|
865
|
-
}
|
|
866
606
|
// synchronous patch
|
|
867
607
|
patch(oldVNode, rootVnode);
|
|
868
|
-
{
|
|
869
|
-
// while we're moving nodes around existing nodes, temporarily disable
|
|
870
|
-
// the disconnectCallback from working
|
|
871
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
872
|
-
if (checkSlotRelocate) {
|
|
873
|
-
relocateSlotContent(rootVnode.$elm$);
|
|
874
|
-
let relocateData;
|
|
875
|
-
let nodeToRelocate;
|
|
876
|
-
let orgLocationNode;
|
|
877
|
-
let parentNodeRef;
|
|
878
|
-
let insertBeforeNode;
|
|
879
|
-
let refNode;
|
|
880
|
-
let i = 0;
|
|
881
|
-
for (; i < relocateNodes.length; i++) {
|
|
882
|
-
relocateData = relocateNodes[i];
|
|
883
|
-
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
884
|
-
if (!nodeToRelocate['s-ol']) {
|
|
885
|
-
// add a reference node marking this node's original location
|
|
886
|
-
// keep a reference to this node for later lookups
|
|
887
|
-
orgLocationNode =
|
|
888
|
-
doc.createTextNode('');
|
|
889
|
-
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
890
|
-
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
for (i = 0; i < relocateNodes.length; i++) {
|
|
894
|
-
relocateData = relocateNodes[i];
|
|
895
|
-
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
896
|
-
if (relocateData.$slotRefNode$) {
|
|
897
|
-
// by default we're just going to insert it directly
|
|
898
|
-
// after the slot reference node
|
|
899
|
-
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
|
900
|
-
insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
|
|
901
|
-
orgLocationNode = nodeToRelocate['s-ol'];
|
|
902
|
-
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
|
903
|
-
refNode = orgLocationNode['s-nr'];
|
|
904
|
-
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
905
|
-
refNode = refNode.nextSibling;
|
|
906
|
-
if (!refNode || !refNode['s-nr']) {
|
|
907
|
-
insertBeforeNode = refNode;
|
|
908
|
-
break;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
913
|
-
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
914
|
-
// we've checked that it's worth while to relocate
|
|
915
|
-
// since that the node to relocate
|
|
916
|
-
// has a different next sibling or parent relocated
|
|
917
|
-
if (nodeToRelocate !== insertBeforeNode) {
|
|
918
|
-
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
919
|
-
// probably a component in the index.html that doesn't have it's hostname set
|
|
920
|
-
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
921
|
-
}
|
|
922
|
-
// add it back to the dom but in its new home
|
|
923
|
-
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
else {
|
|
928
|
-
// this node doesn't have a slot home to go to, so let's hide it
|
|
929
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
930
|
-
nodeToRelocate.hidden = true;
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
if (checkSlotFallbackVisibility) {
|
|
936
|
-
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
937
|
-
}
|
|
938
|
-
// done moving nodes around
|
|
939
|
-
// allow the disconnect callback to work again
|
|
940
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
941
|
-
// always reset
|
|
942
|
-
relocateNodes.length = 0;
|
|
943
|
-
}
|
|
944
|
-
};
|
|
945
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
946
|
-
const createEvent = (ref, name, flags) => {
|
|
947
|
-
const elm = getElement(ref);
|
|
948
|
-
return {
|
|
949
|
-
emit: (detail) => {
|
|
950
|
-
return emitEvent(elm, name, {
|
|
951
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
952
|
-
composed: !!(flags & 2 /* Composed */),
|
|
953
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
954
|
-
detail,
|
|
955
|
-
});
|
|
956
|
-
},
|
|
957
|
-
};
|
|
958
608
|
};
|
|
959
609
|
/**
|
|
960
610
|
* Helper function to create & dispatch a custom Event on a provided target
|
|
@@ -1000,9 +650,6 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1000
650
|
hostRef.$queuedListeners$ = null;
|
|
1001
651
|
}
|
|
1002
652
|
}
|
|
1003
|
-
{
|
|
1004
|
-
promise = safeCall(instance, 'componentWillLoad');
|
|
1005
|
-
}
|
|
1006
653
|
}
|
|
1007
654
|
endSchedule();
|
|
1008
655
|
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
@@ -1137,10 +784,6 @@ const parsePropertyValue = (propValue, propType) => {
|
|
|
1137
784
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1138
785
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1139
786
|
}
|
|
1140
|
-
if (propType & 2 /* Number */) {
|
|
1141
|
-
// force it to be a number
|
|
1142
|
-
return parseFloat(propValue);
|
|
1143
|
-
}
|
|
1144
787
|
if (propType & 1 /* String */) {
|
|
1145
788
|
// could have been passed as a number or boolean
|
|
1146
789
|
// but we still want it as a string
|
|
@@ -1337,15 +980,6 @@ const connectedCallback = (elm) => {
|
|
|
1337
980
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1338
981
|
// first time this component has connected
|
|
1339
982
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1340
|
-
{
|
|
1341
|
-
// initUpdate
|
|
1342
|
-
// if the slot polyfill is required we'll need to put some nodes
|
|
1343
|
-
// in here to act as original content anchors as we move nodes around
|
|
1344
|
-
// host element has been connected to the DOM
|
|
1345
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1346
|
-
setContentReference(elm);
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
983
|
{
|
|
1350
984
|
// find the first ancestor component (if there is one) and register
|
|
1351
985
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1385,30 +1019,15 @@ const connectedCallback = (elm) => {
|
|
|
1385
1019
|
endConnected();
|
|
1386
1020
|
}
|
|
1387
1021
|
};
|
|
1388
|
-
const setContentReference = (elm) => {
|
|
1389
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
1390
|
-
// or this browser doesn't support native shadow dom
|
|
1391
|
-
// and this host element was NOT created with SSR
|
|
1392
|
-
// let's pick out the inner content for slot projection
|
|
1393
|
-
// create a node to represent where the original
|
|
1394
|
-
// content was first placed, which is useful later on
|
|
1395
|
-
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
1396
|
-
contentRefElm['s-cn'] = true;
|
|
1397
|
-
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1398
|
-
};
|
|
1399
1022
|
const disconnectedCallback = (elm) => {
|
|
1400
1023
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1401
1024
|
const hostRef = getHostRef(elm);
|
|
1402
|
-
const instance = hostRef.$lazyInstance$ ;
|
|
1403
1025
|
{
|
|
1404
1026
|
if (hostRef.$rmListeners$) {
|
|
1405
1027
|
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1406
1028
|
hostRef.$rmListeners$ = undefined;
|
|
1407
1029
|
}
|
|
1408
1030
|
}
|
|
1409
|
-
{
|
|
1410
|
-
safeCall(instance, 'disconnectedCallback');
|
|
1411
|
-
}
|
|
1412
1031
|
}
|
|
1413
1032
|
};
|
|
1414
1033
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
@@ -1588,4 +1207,4 @@ const flush = () => {
|
|
|
1588
1207
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1589
1208
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1590
1209
|
|
|
1591
|
-
export { Host as H, bootstrapLazy as b,
|
|
1210
|
+
export { Host as H, bootstrapLazy as b, h, promiseResolve as p, registerInstance as r };
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-aeba9f62.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Stencil Client Patch Esm v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["salla-
|
|
13
|
+
return bootstrapLazy([["salla-login_2",[[1,"salla-login",{"searchIcon":[1,"search-icon"],"visible":[1540],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32]},[[8,"click","handleClick"]]],[0,"salla-search-modal",{"searchPlaceholder":[1,"search-placeholder"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|