@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
@@ -1,7 +1,10 @@
1
1
  const NAMESPACE = 'apollo-core';
2
2
 
3
- let scopeId;
3
+ let contentRef;
4
4
  let hostTagName;
5
+ let useNativeShadowDom = false;
6
+ let checkSlotFallbackVisibility = false;
7
+ let checkSlotRelocate = false;
5
8
  let isSvgMode = false;
6
9
  let queuePending = false;
7
10
  const win = typeof window !== 'undefined' ? window : {};
@@ -39,7 +42,11 @@ const uniqueTime = (key, measureText) => {
39
42
  * Don't add values to these!!
40
43
  */
41
44
  const EMPTY_OBJ = {};
42
- const isDef = (v) => v != null;
45
+ /**
46
+ * Namespaces
47
+ */
48
+ const SVG_NS = 'http://www.w3.org/2000/svg';
49
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
43
50
  const isComplexType = (o) => {
44
51
  // https://jsperf.com/typeof-fn-object/5
45
52
  o = typeof o;
@@ -58,6 +65,7 @@ const isComplexType = (o) => {
58
65
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
59
66
  const h = (nodeName, vnodeData, ...children) => {
60
67
  let child = null;
68
+ let slotName = null;
61
69
  let simple = false;
62
70
  let lastSimple = false;
63
71
  let vNodeChildren = [];
@@ -85,6 +93,9 @@ const h = (nodeName, vnodeData, ...children) => {
85
93
  };
86
94
  walk(children);
87
95
  if (vnodeData) {
96
+ if (vnodeData.name) {
97
+ slotName = vnodeData.name;
98
+ }
88
99
  {
89
100
  const classData = vnodeData.className || vnodeData.class;
90
101
  if (classData) {
@@ -102,6 +113,9 @@ const h = (nodeName, vnodeData, ...children) => {
102
113
  if (vNodeChildren.length > 0) {
103
114
  vnode.$children$ = vNodeChildren;
104
115
  }
116
+ {
117
+ vnode.$name$ = slotName;
118
+ }
105
119
  return vnode;
106
120
  };
107
121
  const newVNode = (tag, text) => {
@@ -115,6 +129,9 @@ const newVNode = (tag, text) => {
115
129
  {
116
130
  vnode.$attrs$ = null;
117
131
  }
132
+ {
133
+ vnode.$name$ = null;
134
+ }
118
135
  return vnode;
119
136
  };
120
137
  const Host = {};
@@ -241,22 +258,40 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
241
258
  let i = 0;
242
259
  let elm;
243
260
  let childNode;
261
+ let oldVNode;
262
+ if (!useNativeShadowDom) {
263
+ // remember for later we need to check to relocate nodes
264
+ checkSlotRelocate = true;
265
+ if (newVNode.$tag$ === 'slot') {
266
+ newVNode.$flags$ |= newVNode.$children$
267
+ ? // slot element has fallback content
268
+ 2 /* isSlotFallback */
269
+ : // slot element does not have fallback content
270
+ 1 /* isSlotReference */;
271
+ }
272
+ }
244
273
  if (newVNode.$text$ !== null) {
245
274
  // create text node
246
275
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
247
276
  }
277
+ else if (newVNode.$flags$ & 1 /* isSlotReference */) {
278
+ // create a slot reference node
279
+ elm = newVNode.$elm$ = doc.createTextNode('');
280
+ }
248
281
  else {
282
+ if (!isSvgMode) {
283
+ isSvgMode = newVNode.$tag$ === 'svg';
284
+ }
249
285
  // create element
250
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
286
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */ ? 'slot-fb' : newVNode.$tag$)
287
+ );
288
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
289
+ isSvgMode = false;
290
+ }
251
291
  // add css classes, attrs, props, listeners, etc.
252
292
  {
253
293
  updateElement(null, newVNode, isSvgMode);
254
294
  }
255
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
256
- // if there is a scopeId and this is the initial render
257
- // then let's add the scopeId as a css class
258
- elm.classList.add((elm['s-si'] = scopeId));
259
- }
260
295
  if (newVNode.$children$) {
261
296
  for (i = 0; i < newVNode.$children$.length; ++i) {
262
297
  // create the node
@@ -268,21 +303,70 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
268
303
  }
269
304
  }
270
305
  }
306
+ {
307
+ if (newVNode.$tag$ === 'svg') {
308
+ // Only reset the SVG context when we're exiting <svg> element
309
+ isSvgMode = false;
310
+ }
311
+ else if (elm.tagName === 'foreignObject') {
312
+ // Reenter SVG context when we're exiting <foreignObject> element
313
+ isSvgMode = true;
314
+ }
315
+ }
316
+ }
317
+ {
318
+ elm['s-hn'] = hostTagName;
319
+ if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
320
+ // remember the content reference comment
321
+ elm['s-sr'] = true;
322
+ // remember the content reference comment
323
+ elm['s-cr'] = contentRef;
324
+ // remember the slot name, or empty string for default slot
325
+ elm['s-sn'] = newVNode.$name$ || '';
326
+ // check if we've got an old vnode for this slot
327
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
328
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
329
+ // we've got an old slot vnode and the wrapper is being replaced
330
+ // so let's move the old slot content back to it's original location
331
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
332
+ }
333
+ }
271
334
  }
272
335
  return elm;
273
336
  };
337
+ const putBackInOriginalLocation = (parentElm, recursive) => {
338
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
339
+ const oldSlotChildNodes = parentElm.childNodes;
340
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
341
+ const childNode = oldSlotChildNodes[i];
342
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
343
+ // // this child node in the old element is from another component
344
+ // // remove this node from the old slot's parent
345
+ // childNode.remove();
346
+ // and relocate it back to it's original location
347
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
348
+ // remove the old original location comment entirely
349
+ // later on the patch function will know what to do
350
+ // and move this to the correct spot in need be
351
+ childNode['s-ol'].remove();
352
+ childNode['s-ol'] = undefined;
353
+ checkSlotRelocate = true;
354
+ }
355
+ if (recursive) {
356
+ putBackInOriginalLocation(childNode, recursive);
357
+ }
358
+ }
359
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
360
+ };
274
361
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
275
- let containerElm = (parentElm);
362
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
276
363
  let childNode;
277
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
278
- containerElm = containerElm.shadowRoot;
279
- }
280
364
  for (; startIdx <= endIdx; ++startIdx) {
281
365
  if (vnodes[startIdx]) {
282
366
  childNode = createElm(null, parentVNode, startIdx);
283
367
  if (childNode) {
284
368
  vnodes[startIdx].$elm$ = childNode;
285
- containerElm.insertBefore(childNode, before);
369
+ containerElm.insertBefore(childNode, referenceNode(before) );
286
370
  }
287
371
  }
288
372
  }
@@ -291,6 +375,20 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
291
375
  for (; startIdx <= endIdx; ++startIdx) {
292
376
  if ((vnode = vnodes[startIdx])) {
293
377
  elm = vnode.$elm$;
378
+ {
379
+ // we're removing this element
380
+ // so it's possible we need to show slot fallback content now
381
+ checkSlotFallbackVisibility = true;
382
+ if (elm['s-ol']) {
383
+ // remove the original location comment
384
+ elm['s-ol'].remove();
385
+ }
386
+ else {
387
+ // it's possible that child nodes of the node
388
+ // that's being removed are slot nodes
389
+ putBackInOriginalLocation(elm, true);
390
+ }
391
+ }
294
392
  // remove the vnode's element from the dom
295
393
  elm.remove();
296
394
  }
@@ -331,12 +429,20 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
331
429
  newEndVnode = newCh[--newEndIdx];
332
430
  }
333
431
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
432
+ // Vnode moved right
433
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
434
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
435
+ }
334
436
  patch(oldStartVnode, newEndVnode);
335
437
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
336
438
  oldStartVnode = oldCh[++oldStartIdx];
337
439
  newEndVnode = newCh[--newEndIdx];
338
440
  }
339
441
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
442
+ // Vnode moved left
443
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
444
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
445
+ }
340
446
  patch(oldEndVnode, newStartVnode);
341
447
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
342
448
  oldEndVnode = oldCh[--oldEndIdx];
@@ -350,7 +456,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
350
456
  }
351
457
  if (node) {
352
458
  {
353
- oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
459
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
354
460
  }
355
461
  }
356
462
  }
@@ -366,17 +472,34 @@ const isSameVnode = (vnode1, vnode2) => {
366
472
  // compare if two vnode to see if they're "technically" the same
367
473
  // need to have the same element tag, and same key to be the same
368
474
  if (vnode1.$tag$ === vnode2.$tag$) {
475
+ if (vnode1.$tag$ === 'slot') {
476
+ return vnode1.$name$ === vnode2.$name$;
477
+ }
369
478
  return true;
370
479
  }
371
480
  return false;
372
481
  };
482
+ const referenceNode = (node) => {
483
+ // this node was relocated to a new location in the dom
484
+ // because of some other component's slot
485
+ // but we still have an html comment in place of where
486
+ // it's original location was according to it's original vdom
487
+ return (node && node['s-ol']) || node;
488
+ };
489
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
373
490
  const patch = (oldVNode, newVNode) => {
374
491
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
375
492
  const oldChildren = oldVNode.$children$;
376
493
  const newChildren = newVNode.$children$;
377
494
  const tag = newVNode.$tag$;
378
495
  const text = newVNode.$text$;
496
+ let defaultHolder;
379
497
  if (text === null) {
498
+ {
499
+ // test if we're rendering an svg element, or still rendering nodes inside of one
500
+ // only add this to the when the compiler sees we're using an svg somewhere
501
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
502
+ }
380
503
  // element node
381
504
  {
382
505
  if (tag === 'slot')
@@ -405,6 +528,13 @@ const patch = (oldVNode, newVNode) => {
405
528
  // no new child vnodes, but there are old child vnodes to remove
406
529
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
407
530
  }
531
+ if (isSvgMode && tag === 'svg') {
532
+ isSvgMode = false;
533
+ }
534
+ }
535
+ else if ((defaultHolder = elm['s-cr'])) {
536
+ // this element has slotted content
537
+ defaultHolder.parentNode.textContent = text;
408
538
  }
409
539
  else if (oldVNode.$text$ !== text) {
410
540
  // update the text content for the text only vnode
@@ -412,20 +542,229 @@ const patch = (oldVNode, newVNode) => {
412
542
  elm.data = text;
413
543
  }
414
544
  };
545
+ const updateFallbackSlotVisibility = (elm) => {
546
+ // tslint:disable-next-line: prefer-const
547
+ let childNodes = elm.childNodes;
548
+ let childNode;
549
+ let i;
550
+ let ilen;
551
+ let j;
552
+ let slotNameAttr;
553
+ let nodeType;
554
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
555
+ childNode = childNodes[i];
556
+ if (childNode.nodeType === 1 /* ElementNode */) {
557
+ if (childNode['s-sr']) {
558
+ // this is a slot fallback node
559
+ // get the slot name for this slot reference node
560
+ slotNameAttr = childNode['s-sn'];
561
+ // by default always show a fallback slot node
562
+ // then hide it if there are other slots in the light dom
563
+ childNode.hidden = false;
564
+ for (j = 0; j < ilen; j++) {
565
+ nodeType = childNodes[j].nodeType;
566
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
567
+ // this sibling node is from a different component OR is a named fallback slot node
568
+ if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
569
+ childNode.hidden = true;
570
+ break;
571
+ }
572
+ }
573
+ else {
574
+ // this is a default fallback slot node
575
+ // any element or text node (with content)
576
+ // should hide the default fallback slot node
577
+ if (nodeType === 1 /* ElementNode */ ||
578
+ (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
579
+ childNode.hidden = true;
580
+ break;
581
+ }
582
+ }
583
+ }
584
+ }
585
+ // keep drilling down
586
+ updateFallbackSlotVisibility(childNode);
587
+ }
588
+ }
589
+ };
590
+ const relocateNodes = [];
591
+ const relocateSlotContent = (elm) => {
592
+ // tslint:disable-next-line: prefer-const
593
+ let childNode;
594
+ let node;
595
+ let hostContentNodes;
596
+ let slotNameAttr;
597
+ let relocateNodeData;
598
+ let j;
599
+ let i = 0;
600
+ let childNodes = elm.childNodes;
601
+ let ilen = childNodes.length;
602
+ for (; i < ilen; i++) {
603
+ childNode = childNodes[i];
604
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
605
+ // first got the content reference comment node
606
+ // then we got it's parent, which is where all the host content is in now
607
+ hostContentNodes = node.parentNode.childNodes;
608
+ slotNameAttr = childNode['s-sn'];
609
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
610
+ node = hostContentNodes[j];
611
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
612
+ // let's do some relocating to its new home
613
+ // but never relocate a content reference node
614
+ // that is suppose to always represent the original content location
615
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
616
+ // it's possible we've already decided to relocate this node
617
+ relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
618
+ // made some changes to slots
619
+ // let's make sure we also double check
620
+ // fallbacks are correctly hidden or shown
621
+ checkSlotFallbackVisibility = true;
622
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
623
+ if (relocateNodeData) {
624
+ // previously we never found a slot home for this node
625
+ // but turns out we did, so let's remember it now
626
+ relocateNodeData.$slotRefNode$ = childNode;
627
+ }
628
+ else {
629
+ // add to our list of nodes to relocate
630
+ relocateNodes.push({
631
+ $slotRefNode$: childNode,
632
+ $nodeToRelocate$: node,
633
+ });
634
+ }
635
+ if (node['s-sr']) {
636
+ relocateNodes.map(relocateNode => {
637
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
638
+ relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
639
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
640
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
641
+ }
642
+ }
643
+ });
644
+ }
645
+ }
646
+ else if (!relocateNodes.some(r => r.$nodeToRelocate$ === node)) {
647
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
648
+ // if we never find a home for this element then we'll need to hide it
649
+ relocateNodes.push({
650
+ $nodeToRelocate$: node,
651
+ });
652
+ }
653
+ }
654
+ }
655
+ }
656
+ if (childNode.nodeType === 1 /* ElementNode */) {
657
+ relocateSlotContent(childNode);
658
+ }
659
+ }
660
+ };
661
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
662
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
663
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
664
+ return true;
665
+ }
666
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
667
+ return true;
668
+ }
669
+ return false;
670
+ }
671
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
672
+ return true;
673
+ }
674
+ return slotNameAttr === '';
675
+ };
415
676
  const renderVdom = (hostRef, renderFnResults) => {
416
677
  const hostElm = hostRef.$hostElement$;
678
+ const cmpMeta = hostRef.$cmpMeta$;
417
679
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
418
680
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
419
681
  hostTagName = hostElm.tagName;
420
682
  rootVnode.$tag$ = null;
421
683
  rootVnode.$flags$ |= 4 /* isHost */;
422
684
  hostRef.$vnode$ = rootVnode;
423
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
685
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
424
686
  {
425
- scopeId = hostElm['s-sc'];
687
+ contentRef = hostElm['s-cr'];
688
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
689
+ // always reset
690
+ checkSlotFallbackVisibility = false;
426
691
  }
427
692
  // synchronous patch
428
693
  patch(oldVNode, rootVnode);
694
+ {
695
+ // while we're moving nodes around existing nodes, temporarily disable
696
+ // the disconnectCallback from working
697
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
698
+ if (checkSlotRelocate) {
699
+ relocateSlotContent(rootVnode.$elm$);
700
+ let relocateData;
701
+ let nodeToRelocate;
702
+ let orgLocationNode;
703
+ let parentNodeRef;
704
+ let insertBeforeNode;
705
+ let refNode;
706
+ let i = 0;
707
+ for (; i < relocateNodes.length; i++) {
708
+ relocateData = relocateNodes[i];
709
+ nodeToRelocate = relocateData.$nodeToRelocate$;
710
+ if (!nodeToRelocate['s-ol']) {
711
+ // add a reference node marking this node's original location
712
+ // keep a reference to this node for later lookups
713
+ orgLocationNode = doc.createTextNode('');
714
+ orgLocationNode['s-nr'] = nodeToRelocate;
715
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
716
+ }
717
+ }
718
+ for (i = 0; i < relocateNodes.length; i++) {
719
+ relocateData = relocateNodes[i];
720
+ nodeToRelocate = relocateData.$nodeToRelocate$;
721
+ if (relocateData.$slotRefNode$) {
722
+ // by default we're just going to insert it directly
723
+ // after the slot reference node
724
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
725
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
726
+ orgLocationNode = nodeToRelocate['s-ol'];
727
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
728
+ refNode = orgLocationNode['s-nr'];
729
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
730
+ refNode = refNode.nextSibling;
731
+ if (!refNode || !refNode['s-nr']) {
732
+ insertBeforeNode = refNode;
733
+ break;
734
+ }
735
+ }
736
+ }
737
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) || nodeToRelocate.nextSibling !== insertBeforeNode) {
738
+ // we've checked that it's worth while to relocate
739
+ // since that the node to relocate
740
+ // has a different next sibling or parent relocated
741
+ if (nodeToRelocate !== insertBeforeNode) {
742
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
743
+ // probably a component in the index.html that doesn't have it's hostname set
744
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
745
+ }
746
+ // add it back to the dom but in its new home
747
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
748
+ }
749
+ }
750
+ }
751
+ else {
752
+ // this node doesn't have a slot home to go to, so let's hide it
753
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
754
+ nodeToRelocate.hidden = true;
755
+ }
756
+ }
757
+ }
758
+ }
759
+ if (checkSlotFallbackVisibility) {
760
+ updateFallbackSlotVisibility(rootVnode.$elm$);
761
+ }
762
+ // done moving nodes around
763
+ // allow the disconnect callback to work again
764
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
765
+ // always reset
766
+ relocateNodes.length = 0;
767
+ }
429
768
  };
430
769
  const getElement = (ref) => (getHostRef(ref).$hostElement$ );
431
770
  const createEvent = (ref, name, flags) => {
@@ -556,6 +895,9 @@ const postUpdateComponent = (hostRef) => {
556
895
  else {
557
896
  endPostUpdate();
558
897
  }
898
+ {
899
+ hostRef.$onInstanceResolve$(elm);
900
+ }
559
901
  // load events fire from bottom to top
560
902
  // the deepest elements load first then bubbles up
561
903
  {
@@ -603,6 +945,15 @@ const parsePropertyValue = (propValue, propType) => {
603
945
  // but we'll cheat here and say that the string "false" is the boolean false
604
946
  return propValue === 'false' ? false : propValue === '' || !!propValue;
605
947
  }
948
+ if (propType & 2 /* Number */) {
949
+ // force it to be a number
950
+ return parseFloat(propValue);
951
+ }
952
+ if (propType & 1 /* String */) {
953
+ // could have been passed as a number or boolean
954
+ // but we still want it as a string
955
+ return String(propValue);
956
+ }
606
957
  // redundant return here for better minification
607
958
  return propValue;
608
959
  }
@@ -654,6 +1005,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
654
1005
  enumerable: true,
655
1006
  });
656
1007
  }
1008
+ else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
1009
+ // proxyComponent - method
1010
+ Object.defineProperty(prototype, memberName, {
1011
+ value(...args) {
1012
+ const ref = getHostRef(this);
1013
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
1014
+ },
1015
+ });
1016
+ }
657
1017
  });
658
1018
  if ((flags & 1 /* isElementConstructor */)) {
659
1019
  const attrNameToPropName = new Map();
@@ -743,6 +1103,15 @@ const connectedCallback = (elm) => {
743
1103
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
744
1104
  // first time this component has connected
745
1105
  hostRef.$flags$ |= 1 /* hasConnected */;
1106
+ {
1107
+ // initUpdate
1108
+ // if the slot polyfill is required we'll need to put some nodes
1109
+ // in here to act as original content anchors as we move nodes around
1110
+ // host element has been connected to the DOM
1111
+ if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1112
+ setContentReference(elm);
1113
+ }
1114
+ }
746
1115
  {
747
1116
  // find the first ancestor component (if there is one) and register
748
1117
  // this component as one of the actively loading child components for its ancestor
@@ -776,6 +1145,17 @@ const connectedCallback = (elm) => {
776
1145
  endConnected();
777
1146
  }
778
1147
  };
1148
+ const setContentReference = (elm) => {
1149
+ // only required when we're NOT using native shadow dom (slot)
1150
+ // or this browser doesn't support native shadow dom
1151
+ // and this host element was NOT created with SSR
1152
+ // let's pick out the inner content for slot projection
1153
+ // create a node to represent where the original
1154
+ // content was first placed, which is useful later on
1155
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1156
+ contentRefElm['s-cn'] = true;
1157
+ elm.insertBefore(contentRefElm, elm.firstChild);
1158
+ };
779
1159
  const disconnectedCallback = (elm) => {
780
1160
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
781
1161
  getHostRef(elm);
@@ -812,17 +1192,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
812
1192
  super(self);
813
1193
  self = this;
814
1194
  registerHost(self, cmpMeta);
815
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
816
- // this component is using shadow dom
817
- // and this browser supports shadow dom
818
- // add the read-only property "shadowRoot" to the host element
819
- // adding the shadow root build conditionals to minimize runtime
820
- {
821
- {
822
- self.attachShadow({ mode: 'open' });
823
- }
824
- }
825
- }
826
1195
  }
827
1196
  connectedCallback() {
828
1197
  if (appLoadFallback) {
@@ -878,6 +1247,9 @@ const registerHost = (elm, cmpMeta) => {
878
1247
  $cmpMeta$: cmpMeta,
879
1248
  $instanceValues$: new Map(),
880
1249
  };
1250
+ {
1251
+ hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
1252
+ }
881
1253
  {
882
1254
  hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
883
1255
  elm['s-p'] = [];
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-52844266.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-6fd7b087.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.6.0 | 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([["xpl-pagination",[[1,"xpl-pagination"]]],["xpl-table",[[0,"xpl-table",{"columns":[16],"data":[16],"fixed":[4],"multiselect":[4],"striped":[4],"areAllSelected":[32],"selected":[32]}]]]], options);
13
+ return bootstrapLazy([["xpl-button_3",[[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);
14
14
  });
15
15
  };
16
16