@xplortech/apollo-core 0.0.0 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/build/style.css +151 -5
  2. package/dist/apollo-core/apollo-core.css +4 -0
  3. package/dist/apollo-core/apollo-core.esm.js +1 -1
  4. package/dist/apollo-core/apollo-core.js +130 -0
  5. package/dist/apollo-core/p-1c170a38.system.js +1 -0
  6. package/dist/apollo-core/p-50ea2036.system.js +1 -0
  7. package/dist/apollo-core/p-88225b28.system.js +1 -0
  8. package/dist/apollo-core/p-933b8694.entry.js +1 -0
  9. package/dist/apollo-core/p-c0ff6f68.system.entry.js +1 -0
  10. package/dist/apollo-core/p-fc3282b6.js +1 -0
  11. package/dist/cjs/apollo-core.cjs.js +2 -2
  12. package/dist/cjs/{index-3ceb30c2.js → index-5a391b2a.js} +399 -27
  13. package/dist/cjs/loader.cjs.js +2 -2
  14. package/dist/cjs/xpl-button_3.cjs.entry.js +144 -0
  15. package/dist/collection/collection-manifest.json +1 -0
  16. package/dist/collection/components/xpl-button/xpl-button.js +73 -0
  17. package/dist/collection/components/xpl-pagination/xpl-pagination.js +188 -3
  18. package/dist/collection/components/xpl-table/xpl-table.js +1 -1
  19. package/dist/custom-elements/index.d.ts +6 -0
  20. package/dist/custom-elements/index.js +88 -7
  21. package/dist/esm/apollo-core.js +2 -2
  22. package/dist/esm/{index-52844266.js → index-6fd7b087.js} +399 -27
  23. package/dist/esm/loader.js +2 -2
  24. package/dist/esm/xpl-button_3.entry.js +138 -0
  25. package/dist/esm-es5/apollo-core.js +1 -0
  26. package/dist/esm-es5/index-6fd7b087.js +1 -0
  27. package/dist/esm-es5/index.js +0 -0
  28. package/dist/esm-es5/loader.js +1 -0
  29. package/dist/esm-es5/xpl-button_3.entry.js +1 -0
  30. package/dist/index.js +1 -1
  31. package/dist/loader/index.js +1 -1
  32. package/dist/types/.stencil/xpl-button/xpl-button.d.ts +6 -0
  33. package/dist/types/.stencil/xpl-pagination/xpl-pagination.d.ts +22 -0
  34. package/dist/types/components.d.ts +31 -0
  35. package/package.json +3 -5
  36. package/dist/apollo-core/p-1c829417.js +0 -1
  37. package/dist/apollo-core/p-64ea0ce6.entry.js +0 -1
  38. package/dist/apollo-core/p-b76559ae.entry.js +0 -1
  39. package/dist/cjs/xpl-pagination.cjs.entry.js +0 -16
  40. package/dist/cjs/xpl-table.cjs.entry.js +0 -54
  41. package/dist/esm/xpl-pagination.entry.js +0 -12
  42. package/dist/esm/xpl-table.entry.js +0 -50
@@ -22,8 +22,11 @@ function _interopNamespace(e) {
22
22
 
23
23
  const NAMESPACE = 'apollo-core';
24
24
 
25
- let scopeId;
25
+ let contentRef;
26
26
  let hostTagName;
27
+ let useNativeShadowDom = false;
28
+ let checkSlotFallbackVisibility = false;
29
+ let checkSlotRelocate = false;
27
30
  let isSvgMode = false;
28
31
  let queuePending = false;
29
32
  const win = typeof window !== 'undefined' ? window : {};
@@ -61,7 +64,11 @@ const uniqueTime = (key, measureText) => {
61
64
  * Don't add values to these!!
62
65
  */
63
66
  const EMPTY_OBJ = {};
64
- const isDef = (v) => v != null;
67
+ /**
68
+ * Namespaces
69
+ */
70
+ const SVG_NS = 'http://www.w3.org/2000/svg';
71
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
65
72
  const isComplexType = (o) => {
66
73
  // https://jsperf.com/typeof-fn-object/5
67
74
  o = typeof o;
@@ -80,6 +87,7 @@ const isComplexType = (o) => {
80
87
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
81
88
  const h = (nodeName, vnodeData, ...children) => {
82
89
  let child = null;
90
+ let slotName = null;
83
91
  let simple = false;
84
92
  let lastSimple = false;
85
93
  let vNodeChildren = [];
@@ -107,6 +115,9 @@ const h = (nodeName, vnodeData, ...children) => {
107
115
  };
108
116
  walk(children);
109
117
  if (vnodeData) {
118
+ if (vnodeData.name) {
119
+ slotName = vnodeData.name;
120
+ }
110
121
  {
111
122
  const classData = vnodeData.className || vnodeData.class;
112
123
  if (classData) {
@@ -124,6 +135,9 @@ const h = (nodeName, vnodeData, ...children) => {
124
135
  if (vNodeChildren.length > 0) {
125
136
  vnode.$children$ = vNodeChildren;
126
137
  }
138
+ {
139
+ vnode.$name$ = slotName;
140
+ }
127
141
  return vnode;
128
142
  };
129
143
  const newVNode = (tag, text) => {
@@ -137,6 +151,9 @@ const newVNode = (tag, text) => {
137
151
  {
138
152
  vnode.$attrs$ = null;
139
153
  }
154
+ {
155
+ vnode.$name$ = null;
156
+ }
140
157
  return vnode;
141
158
  };
142
159
  const Host = {};
@@ -263,22 +280,40 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
263
280
  let i = 0;
264
281
  let elm;
265
282
  let childNode;
283
+ let oldVNode;
284
+ if (!useNativeShadowDom) {
285
+ // remember for later we need to check to relocate nodes
286
+ checkSlotRelocate = true;
287
+ if (newVNode.$tag$ === 'slot') {
288
+ newVNode.$flags$ |= newVNode.$children$
289
+ ? // slot element has fallback content
290
+ 2 /* isSlotFallback */
291
+ : // slot element does not have fallback content
292
+ 1 /* isSlotReference */;
293
+ }
294
+ }
266
295
  if (newVNode.$text$ !== null) {
267
296
  // create text node
268
297
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
269
298
  }
299
+ else if (newVNode.$flags$ & 1 /* isSlotReference */) {
300
+ // create a slot reference node
301
+ elm = newVNode.$elm$ = doc.createTextNode('');
302
+ }
270
303
  else {
304
+ if (!isSvgMode) {
305
+ isSvgMode = newVNode.$tag$ === 'svg';
306
+ }
271
307
  // create element
272
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
308
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */ ? 'slot-fb' : newVNode.$tag$)
309
+ );
310
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
311
+ isSvgMode = false;
312
+ }
273
313
  // add css classes, attrs, props, listeners, etc.
274
314
  {
275
315
  updateElement(null, newVNode, isSvgMode);
276
316
  }
277
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
278
- // if there is a scopeId and this is the initial render
279
- // then let's add the scopeId as a css class
280
- elm.classList.add((elm['s-si'] = scopeId));
281
- }
282
317
  if (newVNode.$children$) {
283
318
  for (i = 0; i < newVNode.$children$.length; ++i) {
284
319
  // create the node
@@ -290,21 +325,70 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
290
325
  }
291
326
  }
292
327
  }
328
+ {
329
+ if (newVNode.$tag$ === 'svg') {
330
+ // Only reset the SVG context when we're exiting <svg> element
331
+ isSvgMode = false;
332
+ }
333
+ else if (elm.tagName === 'foreignObject') {
334
+ // Reenter SVG context when we're exiting <foreignObject> element
335
+ isSvgMode = true;
336
+ }
337
+ }
338
+ }
339
+ {
340
+ elm['s-hn'] = hostTagName;
341
+ if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
342
+ // remember the content reference comment
343
+ elm['s-sr'] = true;
344
+ // remember the content reference comment
345
+ elm['s-cr'] = contentRef;
346
+ // remember the slot name, or empty string for default slot
347
+ elm['s-sn'] = newVNode.$name$ || '';
348
+ // check if we've got an old vnode for this slot
349
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
350
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
351
+ // we've got an old slot vnode and the wrapper is being replaced
352
+ // so let's move the old slot content back to it's original location
353
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
354
+ }
355
+ }
293
356
  }
294
357
  return elm;
295
358
  };
359
+ const putBackInOriginalLocation = (parentElm, recursive) => {
360
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
361
+ const oldSlotChildNodes = parentElm.childNodes;
362
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
363
+ const childNode = oldSlotChildNodes[i];
364
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
365
+ // // this child node in the old element is from another component
366
+ // // remove this node from the old slot's parent
367
+ // childNode.remove();
368
+ // and relocate it back to it's original location
369
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
370
+ // remove the old original location comment entirely
371
+ // later on the patch function will know what to do
372
+ // and move this to the correct spot in need be
373
+ childNode['s-ol'].remove();
374
+ childNode['s-ol'] = undefined;
375
+ checkSlotRelocate = true;
376
+ }
377
+ if (recursive) {
378
+ putBackInOriginalLocation(childNode, recursive);
379
+ }
380
+ }
381
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
382
+ };
296
383
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
297
- let containerElm = (parentElm);
384
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
298
385
  let childNode;
299
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
300
- containerElm = containerElm.shadowRoot;
301
- }
302
386
  for (; startIdx <= endIdx; ++startIdx) {
303
387
  if (vnodes[startIdx]) {
304
388
  childNode = createElm(null, parentVNode, startIdx);
305
389
  if (childNode) {
306
390
  vnodes[startIdx].$elm$ = childNode;
307
- containerElm.insertBefore(childNode, before);
391
+ containerElm.insertBefore(childNode, referenceNode(before) );
308
392
  }
309
393
  }
310
394
  }
@@ -313,6 +397,20 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
313
397
  for (; startIdx <= endIdx; ++startIdx) {
314
398
  if ((vnode = vnodes[startIdx])) {
315
399
  elm = vnode.$elm$;
400
+ {
401
+ // we're removing this element
402
+ // so it's possible we need to show slot fallback content now
403
+ checkSlotFallbackVisibility = true;
404
+ if (elm['s-ol']) {
405
+ // remove the original location comment
406
+ elm['s-ol'].remove();
407
+ }
408
+ else {
409
+ // it's possible that child nodes of the node
410
+ // that's being removed are slot nodes
411
+ putBackInOriginalLocation(elm, true);
412
+ }
413
+ }
316
414
  // remove the vnode's element from the dom
317
415
  elm.remove();
318
416
  }
@@ -353,12 +451,20 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
353
451
  newEndVnode = newCh[--newEndIdx];
354
452
  }
355
453
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
454
+ // Vnode moved right
455
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
456
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
457
+ }
356
458
  patch(oldStartVnode, newEndVnode);
357
459
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
358
460
  oldStartVnode = oldCh[++oldStartIdx];
359
461
  newEndVnode = newCh[--newEndIdx];
360
462
  }
361
463
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
464
+ // Vnode moved left
465
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
466
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
467
+ }
362
468
  patch(oldEndVnode, newStartVnode);
363
469
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
364
470
  oldEndVnode = oldCh[--oldEndIdx];
@@ -372,7 +478,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
372
478
  }
373
479
  if (node) {
374
480
  {
375
- oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
481
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
376
482
  }
377
483
  }
378
484
  }
@@ -388,17 +494,34 @@ const isSameVnode = (vnode1, vnode2) => {
388
494
  // compare if two vnode to see if they're "technically" the same
389
495
  // need to have the same element tag, and same key to be the same
390
496
  if (vnode1.$tag$ === vnode2.$tag$) {
497
+ if (vnode1.$tag$ === 'slot') {
498
+ return vnode1.$name$ === vnode2.$name$;
499
+ }
391
500
  return true;
392
501
  }
393
502
  return false;
394
503
  };
504
+ const referenceNode = (node) => {
505
+ // this node was relocated to a new location in the dom
506
+ // because of some other component's slot
507
+ // but we still have an html comment in place of where
508
+ // it's original location was according to it's original vdom
509
+ return (node && node['s-ol']) || node;
510
+ };
511
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
395
512
  const patch = (oldVNode, newVNode) => {
396
513
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
397
514
  const oldChildren = oldVNode.$children$;
398
515
  const newChildren = newVNode.$children$;
399
516
  const tag = newVNode.$tag$;
400
517
  const text = newVNode.$text$;
518
+ let defaultHolder;
401
519
  if (text === null) {
520
+ {
521
+ // test if we're rendering an svg element, or still rendering nodes inside of one
522
+ // only add this to the when the compiler sees we're using an svg somewhere
523
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
524
+ }
402
525
  // element node
403
526
  {
404
527
  if (tag === 'slot')
@@ -427,6 +550,13 @@ const patch = (oldVNode, newVNode) => {
427
550
  // no new child vnodes, but there are old child vnodes to remove
428
551
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
429
552
  }
553
+ if (isSvgMode && tag === 'svg') {
554
+ isSvgMode = false;
555
+ }
556
+ }
557
+ else if ((defaultHolder = elm['s-cr'])) {
558
+ // this element has slotted content
559
+ defaultHolder.parentNode.textContent = text;
430
560
  }
431
561
  else if (oldVNode.$text$ !== text) {
432
562
  // update the text content for the text only vnode
@@ -434,20 +564,229 @@ const patch = (oldVNode, newVNode) => {
434
564
  elm.data = text;
435
565
  }
436
566
  };
567
+ const updateFallbackSlotVisibility = (elm) => {
568
+ // tslint:disable-next-line: prefer-const
569
+ let childNodes = elm.childNodes;
570
+ let childNode;
571
+ let i;
572
+ let ilen;
573
+ let j;
574
+ let slotNameAttr;
575
+ let nodeType;
576
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
577
+ childNode = childNodes[i];
578
+ if (childNode.nodeType === 1 /* ElementNode */) {
579
+ if (childNode['s-sr']) {
580
+ // this is a slot fallback node
581
+ // get the slot name for this slot reference node
582
+ slotNameAttr = childNode['s-sn'];
583
+ // by default always show a fallback slot node
584
+ // then hide it if there are other slots in the light dom
585
+ childNode.hidden = false;
586
+ for (j = 0; j < ilen; j++) {
587
+ nodeType = childNodes[j].nodeType;
588
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
589
+ // this sibling node is from a different component OR is a named fallback slot node
590
+ if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
591
+ childNode.hidden = true;
592
+ break;
593
+ }
594
+ }
595
+ else {
596
+ // this is a default fallback slot node
597
+ // any element or text node (with content)
598
+ // should hide the default fallback slot node
599
+ if (nodeType === 1 /* ElementNode */ ||
600
+ (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
601
+ childNode.hidden = true;
602
+ break;
603
+ }
604
+ }
605
+ }
606
+ }
607
+ // keep drilling down
608
+ updateFallbackSlotVisibility(childNode);
609
+ }
610
+ }
611
+ };
612
+ const relocateNodes = [];
613
+ const relocateSlotContent = (elm) => {
614
+ // tslint:disable-next-line: prefer-const
615
+ let childNode;
616
+ let node;
617
+ let hostContentNodes;
618
+ let slotNameAttr;
619
+ let relocateNodeData;
620
+ let j;
621
+ let i = 0;
622
+ let childNodes = elm.childNodes;
623
+ let ilen = childNodes.length;
624
+ for (; i < ilen; i++) {
625
+ childNode = childNodes[i];
626
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
627
+ // first got the content reference comment node
628
+ // then we got it's parent, which is where all the host content is in now
629
+ hostContentNodes = node.parentNode.childNodes;
630
+ slotNameAttr = childNode['s-sn'];
631
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
632
+ node = hostContentNodes[j];
633
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
634
+ // let's do some relocating to its new home
635
+ // but never relocate a content reference node
636
+ // that is suppose to always represent the original content location
637
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
638
+ // it's possible we've already decided to relocate this node
639
+ relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
640
+ // made some changes to slots
641
+ // let's make sure we also double check
642
+ // fallbacks are correctly hidden or shown
643
+ checkSlotFallbackVisibility = true;
644
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
645
+ if (relocateNodeData) {
646
+ // previously we never found a slot home for this node
647
+ // but turns out we did, so let's remember it now
648
+ relocateNodeData.$slotRefNode$ = childNode;
649
+ }
650
+ else {
651
+ // add to our list of nodes to relocate
652
+ relocateNodes.push({
653
+ $slotRefNode$: childNode,
654
+ $nodeToRelocate$: node,
655
+ });
656
+ }
657
+ if (node['s-sr']) {
658
+ relocateNodes.map(relocateNode => {
659
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
660
+ relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
661
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
662
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
663
+ }
664
+ }
665
+ });
666
+ }
667
+ }
668
+ else if (!relocateNodes.some(r => r.$nodeToRelocate$ === node)) {
669
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
670
+ // if we never find a home for this element then we'll need to hide it
671
+ relocateNodes.push({
672
+ $nodeToRelocate$: node,
673
+ });
674
+ }
675
+ }
676
+ }
677
+ }
678
+ if (childNode.nodeType === 1 /* ElementNode */) {
679
+ relocateSlotContent(childNode);
680
+ }
681
+ }
682
+ };
683
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
684
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
685
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
686
+ return true;
687
+ }
688
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
689
+ return true;
690
+ }
691
+ return false;
692
+ }
693
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
694
+ return true;
695
+ }
696
+ return slotNameAttr === '';
697
+ };
437
698
  const renderVdom = (hostRef, renderFnResults) => {
438
699
  const hostElm = hostRef.$hostElement$;
700
+ const cmpMeta = hostRef.$cmpMeta$;
439
701
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
440
702
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
441
703
  hostTagName = hostElm.tagName;
442
704
  rootVnode.$tag$ = null;
443
705
  rootVnode.$flags$ |= 4 /* isHost */;
444
706
  hostRef.$vnode$ = rootVnode;
445
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
707
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
446
708
  {
447
- scopeId = hostElm['s-sc'];
709
+ contentRef = hostElm['s-cr'];
710
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
711
+ // always reset
712
+ checkSlotFallbackVisibility = false;
448
713
  }
449
714
  // synchronous patch
450
715
  patch(oldVNode, rootVnode);
716
+ {
717
+ // while we're moving nodes around existing nodes, temporarily disable
718
+ // the disconnectCallback from working
719
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
720
+ if (checkSlotRelocate) {
721
+ relocateSlotContent(rootVnode.$elm$);
722
+ let relocateData;
723
+ let nodeToRelocate;
724
+ let orgLocationNode;
725
+ let parentNodeRef;
726
+ let insertBeforeNode;
727
+ let refNode;
728
+ let i = 0;
729
+ for (; i < relocateNodes.length; i++) {
730
+ relocateData = relocateNodes[i];
731
+ nodeToRelocate = relocateData.$nodeToRelocate$;
732
+ if (!nodeToRelocate['s-ol']) {
733
+ // add a reference node marking this node's original location
734
+ // keep a reference to this node for later lookups
735
+ orgLocationNode = doc.createTextNode('');
736
+ orgLocationNode['s-nr'] = nodeToRelocate;
737
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
738
+ }
739
+ }
740
+ for (i = 0; i < relocateNodes.length; i++) {
741
+ relocateData = relocateNodes[i];
742
+ nodeToRelocate = relocateData.$nodeToRelocate$;
743
+ if (relocateData.$slotRefNode$) {
744
+ // by default we're just going to insert it directly
745
+ // after the slot reference node
746
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
747
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
748
+ orgLocationNode = nodeToRelocate['s-ol'];
749
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
750
+ refNode = orgLocationNode['s-nr'];
751
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
752
+ refNode = refNode.nextSibling;
753
+ if (!refNode || !refNode['s-nr']) {
754
+ insertBeforeNode = refNode;
755
+ break;
756
+ }
757
+ }
758
+ }
759
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) || nodeToRelocate.nextSibling !== insertBeforeNode) {
760
+ // we've checked that it's worth while to relocate
761
+ // since that the node to relocate
762
+ // has a different next sibling or parent relocated
763
+ if (nodeToRelocate !== insertBeforeNode) {
764
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
765
+ // probably a component in the index.html that doesn't have it's hostname set
766
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
767
+ }
768
+ // add it back to the dom but in its new home
769
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
770
+ }
771
+ }
772
+ }
773
+ else {
774
+ // this node doesn't have a slot home to go to, so let's hide it
775
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
776
+ nodeToRelocate.hidden = true;
777
+ }
778
+ }
779
+ }
780
+ }
781
+ if (checkSlotFallbackVisibility) {
782
+ updateFallbackSlotVisibility(rootVnode.$elm$);
783
+ }
784
+ // done moving nodes around
785
+ // allow the disconnect callback to work again
786
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
787
+ // always reset
788
+ relocateNodes.length = 0;
789
+ }
451
790
  };
452
791
  const getElement = (ref) => (getHostRef(ref).$hostElement$ );
453
792
  const createEvent = (ref, name, flags) => {
@@ -578,6 +917,9 @@ const postUpdateComponent = (hostRef) => {
578
917
  else {
579
918
  endPostUpdate();
580
919
  }
920
+ {
921
+ hostRef.$onInstanceResolve$(elm);
922
+ }
581
923
  // load events fire from bottom to top
582
924
  // the deepest elements load first then bubbles up
583
925
  {
@@ -625,6 +967,15 @@ const parsePropertyValue = (propValue, propType) => {
625
967
  // but we'll cheat here and say that the string "false" is the boolean false
626
968
  return propValue === 'false' ? false : propValue === '' || !!propValue;
627
969
  }
970
+ if (propType & 2 /* Number */) {
971
+ // force it to be a number
972
+ return parseFloat(propValue);
973
+ }
974
+ if (propType & 1 /* String */) {
975
+ // could have been passed as a number or boolean
976
+ // but we still want it as a string
977
+ return String(propValue);
978
+ }
628
979
  // redundant return here for better minification
629
980
  return propValue;
630
981
  }
@@ -676,6 +1027,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
676
1027
  enumerable: true,
677
1028
  });
678
1029
  }
1030
+ else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
1031
+ // proxyComponent - method
1032
+ Object.defineProperty(prototype, memberName, {
1033
+ value(...args) {
1034
+ const ref = getHostRef(this);
1035
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
1036
+ },
1037
+ });
1038
+ }
679
1039
  });
680
1040
  if ((flags & 1 /* isElementConstructor */)) {
681
1041
  const attrNameToPropName = new Map();
@@ -765,6 +1125,15 @@ const connectedCallback = (elm) => {
765
1125
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
766
1126
  // first time this component has connected
767
1127
  hostRef.$flags$ |= 1 /* hasConnected */;
1128
+ {
1129
+ // initUpdate
1130
+ // if the slot polyfill is required we'll need to put some nodes
1131
+ // in here to act as original content anchors as we move nodes around
1132
+ // host element has been connected to the DOM
1133
+ if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1134
+ setContentReference(elm);
1135
+ }
1136
+ }
768
1137
  {
769
1138
  // find the first ancestor component (if there is one) and register
770
1139
  // this component as one of the actively loading child components for its ancestor
@@ -798,6 +1167,17 @@ const connectedCallback = (elm) => {
798
1167
  endConnected();
799
1168
  }
800
1169
  };
1170
+ const setContentReference = (elm) => {
1171
+ // only required when we're NOT using native shadow dom (slot)
1172
+ // or this browser doesn't support native shadow dom
1173
+ // and this host element was NOT created with SSR
1174
+ // let's pick out the inner content for slot projection
1175
+ // create a node to represent where the original
1176
+ // content was first placed, which is useful later on
1177
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1178
+ contentRefElm['s-cn'] = true;
1179
+ elm.insertBefore(contentRefElm, elm.firstChild);
1180
+ };
801
1181
  const disconnectedCallback = (elm) => {
802
1182
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
803
1183
  getHostRef(elm);
@@ -834,17 +1214,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
834
1214
  super(self);
835
1215
  self = this;
836
1216
  registerHost(self, cmpMeta);
837
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
838
- // this component is using shadow dom
839
- // and this browser supports shadow dom
840
- // add the read-only property "shadowRoot" to the host element
841
- // adding the shadow root build conditionals to minimize runtime
842
- {
843
- {
844
- self.attachShadow({ mode: 'open' });
845
- }
846
- }
847
- }
848
1217
  }
849
1218
  connectedCallback() {
850
1219
  if (appLoadFallback) {
@@ -900,6 +1269,9 @@ const registerHost = (elm, cmpMeta) => {
900
1269
  $cmpMeta$: cmpMeta,
901
1270
  $instanceValues$: new Map(),
902
1271
  };
1272
+ {
1273
+ hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
1274
+ }
903
1275
  {
904
1276
  hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
905
1277
  elm['s-p'] = [];
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-3ceb30c2.js');
5
+ const index = require('./index-5a391b2a.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.6.0 | 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([["xpl-pagination.cjs",[[1,"xpl-pagination"]]],["xpl-table.cjs",[[0,"xpl-table",{"columns":[16],"data":[16],"fixed":[4],"multiselect":[4],"striped":[4],"areAllSelected":[32],"selected":[32]}]]]], options);
17
+ return index.bootstrapLazy([["xpl-button_3.cjs",[[4,"xpl-button",{"disabled":[4],"type":[1],"href":[1]}],[0,"xpl-pagination",{"total":[2],"perPage":[2,"per-page"],"waitForCallback":[4,"wait-for-callback"],"current":[32],"goto":[64]}],[0,"xpl-table",{"columns":[16],"data":[16],"fixed":[4],"multiselect":[4],"striped":[4],"areAllSelected":[32],"selected":[32]}]]]], options);
18
18
  });
19
19
  };
20
20