@jumpgroup/jump-design-system 0.1.6 → 0.1.8

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 (44) hide show
  1. package/dist/cjs/{index-46644e39.js → index-91a3ed32.js} +42 -448
  2. package/dist/cjs/index-91a3ed32.js.map +1 -0
  3. package/dist/cjs/jump-button.cjs.entry.js +4 -3
  4. package/dist/cjs/jump-button.cjs.entry.js.map +1 -1
  5. package/dist/cjs/jump-design-system.cjs.js +2 -2
  6. package/dist/cjs/jump-icon.cjs.entry.js +1 -1
  7. package/dist/cjs/jump-pagination.cjs.entry.js +1 -1
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/collection/components/jump-button/jump-button.css +15 -1
  10. package/dist/collection/components/jump-button/jump-button.js +21 -1
  11. package/dist/collection/components/jump-button/jump-button.js.map +1 -1
  12. package/dist/collection/components/jump-button/jump-button.stories.js +211 -26
  13. package/dist/collection/components/jump-button/jump-button.stories.js.map +1 -1
  14. package/dist/components/jump-button.js +7 -4
  15. package/dist/components/jump-button.js.map +1 -1
  16. package/dist/esm/{index-b0176170.js → index-3cf3394c.js} +42 -448
  17. package/dist/esm/index-3cf3394c.js.map +1 -0
  18. package/dist/esm/jump-button.entry.js +4 -3
  19. package/dist/esm/jump-button.entry.js.map +1 -1
  20. package/dist/esm/jump-design-system.js +3 -3
  21. package/dist/esm/jump-icon.entry.js +1 -1
  22. package/dist/esm/jump-pagination.entry.js +1 -1
  23. package/dist/esm/loader.js +3 -3
  24. package/dist/jump-design-system/jump-design-system.esm.js +1 -1
  25. package/dist/jump-design-system/jump-design-system.esm.js.map +1 -1
  26. package/dist/jump-design-system/p-7216d46f.js +3 -0
  27. package/dist/jump-design-system/p-7216d46f.js.map +1 -0
  28. package/dist/jump-design-system/{p-0d2b55a8.entry.js → p-85fbbf60.entry.js} +2 -2
  29. package/dist/jump-design-system/p-e2af0fd9.entry.js +2 -0
  30. package/dist/jump-design-system/p-e2af0fd9.entry.js.map +1 -0
  31. package/dist/jump-design-system/{p-3cbc3a68.entry.js → p-f4cfa17d.entry.js} +2 -2
  32. package/dist/jump-design-system-elements.json +4 -0
  33. package/dist/types/components/jump-button/jump-button.d.ts +4 -0
  34. package/dist/types/components/jump-button/jump-button.stories.d.ts +18 -3
  35. package/dist/types/components.d.ts +8 -0
  36. package/package.json +1 -1
  37. package/dist/cjs/index-46644e39.js.map +0 -1
  38. package/dist/esm/index-b0176170.js.map +0 -1
  39. package/dist/jump-design-system/p-1bb7f2a5.entry.js +0 -2
  40. package/dist/jump-design-system/p-1bb7f2a5.entry.js.map +0 -1
  41. package/dist/jump-design-system/p-68bce598.js +0 -3
  42. package/dist/jump-design-system/p-68bce598.js.map +0 -1
  43. /package/dist/jump-design-system/{p-0d2b55a8.entry.js.map → p-85fbbf60.entry.js.map} +0 -0
  44. /package/dist/jump-design-system/{p-3cbc3a68.entry.js.map → p-f4cfa17d.entry.js.map} +0 -0
@@ -21,7 +21,6 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'jump-design-system';
24
- const BUILD = /* jump-design-system */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: false, slot: true, slotChildNodesFix: false, slotRelocation: true, state: false, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: false };
25
24
 
26
25
  /**
27
26
  * Virtual DOM patching algorithm based on Snabbdom by
@@ -31,11 +30,9 @@ const BUILD = /* jump-design-system */ { allRenderFn: true, appendChildSlotFix:
31
30
  *
32
31
  * Modified for Stencil's renderer and slot projection
33
32
  */
34
- let contentRef;
33
+ let scopeId;
35
34
  let hostTagName;
36
35
  let useNativeShadowDom = false;
37
- let checkSlotFallbackVisibility = false;
38
- let checkSlotRelocate = false;
39
36
  let isSvgMode = false;
40
37
  let queuePending = false;
41
38
  const createTime = (fnName, tagName = '') => {
@@ -68,6 +65,7 @@ const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
68
65
  * Don't add values to these!!
69
66
  */
70
67
  const EMPTY_OBJ = {};
68
+ const isDef = (v) => v != null;
71
69
  /**
72
70
  * Check whether a value is a 'complex type', defined here as an object or a
73
71
  * function.
@@ -105,7 +103,6 @@ function queryNonceMetaTagContent(doc) {
105
103
  const h = (nodeName, vnodeData, ...children) => {
106
104
  let child = null;
107
105
  let key = null;
108
- let slotName = null;
109
106
  let simple = false;
110
107
  let lastSimple = false;
111
108
  const vNodeChildren = [];
@@ -136,9 +133,6 @@ const h = (nodeName, vnodeData, ...children) => {
136
133
  if (vnodeData.key) {
137
134
  key = vnodeData.key;
138
135
  }
139
- if (vnodeData.name) {
140
- slotName = vnodeData.name;
141
- }
142
136
  // normalize class / className attributes
143
137
  {
144
138
  const classData = vnodeData.className || vnodeData.class;
@@ -160,9 +154,6 @@ const h = (nodeName, vnodeData, ...children) => {
160
154
  {
161
155
  vnode.$key$ = key;
162
156
  }
163
- {
164
- vnode.$name$ = slotName;
165
- }
166
157
  return vnode;
167
158
  };
168
159
  /**
@@ -187,9 +178,6 @@ const newVNode = (tag, text) => {
187
178
  {
188
179
  vnode.$key$ = null;
189
180
  }
190
- {
191
- vnode.$name$ = null;
192
- }
193
181
  return vnode;
194
182
  };
195
183
  const Host = {};
@@ -320,8 +308,20 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
320
308
  const attachStyles = (hostRef) => {
321
309
  const cmpMeta = hostRef.$cmpMeta$;
322
310
  const elm = hostRef.$hostElement$;
311
+ const flags = cmpMeta.$flags$;
323
312
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
324
- addStyle(elm.getRootNode(), cmpMeta);
313
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
314
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
315
+ // only required when we're NOT using native shadow dom (slot)
316
+ // or this browser doesn't support native shadow dom
317
+ // and this host element was NOT created with SSR
318
+ // let's pick out the inner content for slot projection
319
+ // create a node to represent where the original
320
+ // content was first placed, which is useful later on
321
+ // DOM WRITE!!
322
+ elm['s-sc'] = scopeId;
323
+ elm.classList.add(scopeId + '-h');
324
+ }
325
325
  endAttachStyles();
326
326
  };
327
327
  const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
@@ -447,36 +447,22 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
447
447
  let i = 0;
448
448
  let elm;
449
449
  let childNode;
450
- let oldVNode;
451
- if (!useNativeShadowDom) {
452
- // remember for later we need to check to relocate nodes
453
- checkSlotRelocate = true;
454
- if (newVNode.$tag$ === 'slot') {
455
- newVNode.$flags$ |= newVNode.$children$
456
- ? // slot element has fallback content
457
- 2 /* VNODE_FLAGS.isSlotFallback */
458
- : // slot element does not have fallback content
459
- 1 /* VNODE_FLAGS.isSlotReference */;
460
- }
461
- }
462
450
  if (newVNode.$text$ !== null) {
463
451
  // create text node
464
452
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
465
453
  }
466
- else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
467
- // create a slot reference node
468
- elm = newVNode.$elm$ =
469
- doc.createTextNode('');
470
- }
471
454
  else {
472
455
  // create element
473
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
474
- ? 'slot-fb'
475
- : newVNode.$tag$));
456
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
476
457
  // add css classes, attrs, props, listeners, etc.
477
458
  {
478
459
  updateElement(null, newVNode, isSvgMode);
479
460
  }
461
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
462
+ // if there is a scopeId and this is the initial render
463
+ // then let's add the scopeId as a css class
464
+ elm.classList.add((elm['s-si'] = scopeId));
465
+ }
480
466
  if (newVNode.$children$) {
481
467
  for (i = 0; i < newVNode.$children$.length; ++i) {
482
468
  // create the node
@@ -492,50 +478,8 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
492
478
  // This needs to always happen so we can hide nodes that are projected
493
479
  // to another component but don't end up in a slot
494
480
  elm['s-hn'] = hostTagName;
495
- {
496
- if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
497
- // remember the content reference comment
498
- elm['s-sr'] = true;
499
- // remember the content reference comment
500
- elm['s-cr'] = contentRef;
501
- // remember the slot name, or empty string for default slot
502
- elm['s-sn'] = newVNode.$name$ || '';
503
- // check if we've got an old vnode for this slot
504
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
505
- if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
506
- {
507
- // we've got an old slot vnode and the wrapper is being replaced
508
- // so let's move the old slot content back to its original location
509
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
510
- }
511
- }
512
- }
513
- }
514
481
  return elm;
515
482
  };
516
- const putBackInOriginalLocation = (parentElm, recursive) => {
517
- plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
518
- const oldSlotChildNodes = parentElm.childNodes;
519
- for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
520
- const childNode = oldSlotChildNodes[i];
521
- if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
522
- // and relocate it back to it's original location
523
- parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
524
- // remove the old original location comment entirely
525
- // later on the patch function will know what to do
526
- // and move this to the correct spot if need be
527
- childNode['s-ol'].remove();
528
- childNode['s-ol'] = undefined;
529
- // Reset so we can correctly move the node around again.
530
- childNode['s-sh'] = undefined;
531
- checkSlotRelocate = true;
532
- }
533
- if (recursive) {
534
- putBackInOriginalLocation(childNode, recursive);
535
- }
536
- }
537
- plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
538
- };
539
483
  /**
540
484
  * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
541
485
  * add them to the DOM in the appropriate place.
@@ -552,14 +496,17 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
552
496
  * creating DOM nodes (inclusive)
553
497
  */
554
498
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
555
- let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
499
+ let containerElm = (parentElm);
556
500
  let childNode;
501
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
502
+ containerElm = containerElm.shadowRoot;
503
+ }
557
504
  for (; startIdx <= endIdx; ++startIdx) {
558
505
  if (vnodes[startIdx]) {
559
506
  childNode = createElm(null, parentVNode, startIdx);
560
507
  if (childNode) {
561
508
  vnodes[startIdx].$elm$ = childNode;
562
- containerElm.insertBefore(childNode, referenceNode(before) );
509
+ containerElm.insertBefore(childNode, before);
563
510
  }
564
511
  }
565
512
  }
@@ -581,20 +528,6 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
581
528
  if (vnode) {
582
529
  const elm = vnode.$elm$;
583
530
  if (elm) {
584
- {
585
- // we're removing this element
586
- // so it's possible we need to show slot fallback content now
587
- checkSlotFallbackVisibility = true;
588
- if (elm['s-ol']) {
589
- // remove the original location comment
590
- elm['s-ol'].remove();
591
- }
592
- else {
593
- // it's possible that child nodes of the node
594
- // that's being removed are slot nodes
595
- putBackInOriginalLocation(elm, true);
596
- }
597
- }
598
531
  // remove the vnode's element from the dom
599
532
  elm.remove();
600
533
  }
@@ -715,23 +648,6 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
715
648
  newEndVnode = newCh[--newEndIdx];
716
649
  }
717
650
  else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
718
- // case: "Vnode moved right"
719
- //
720
- // We've found that the last node in our window on the new children is
721
- // the same VNode as the _first_ node in our window on the old children
722
- // we're dealing with now. Visually, this is the layout of these two
723
- // nodes:
724
- //
725
- // newCh: [..., newStartVnode , ... , newEndVnode , ...]
726
- // ^^^^^^^^^^^
727
- // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
728
- // ^^^^^^^^^^^^^
729
- //
730
- // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
731
- // and move the DOM element for `oldStartVnode`.
732
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
733
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
734
- }
735
651
  patch(oldStartVnode, newEndVnode, isInitialRender);
736
652
  // We need to move the element for `oldStartVnode` into a position which
737
653
  // will be appropriate for `newEndVnode`. For this we can use
@@ -755,24 +671,6 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
755
671
  newEndVnode = newCh[--newEndIdx];
756
672
  }
757
673
  else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
758
- // case: "Vnode moved left"
759
- //
760
- // We've found that the first node in our window on the new children is
761
- // the same VNode as the _last_ node in our window on the old children.
762
- // Visually, this is the layout of these two nodes:
763
- //
764
- // newCh: [..., newStartVnode , ... , newEndVnode , ...]
765
- // ^^^^^^^^^^^^^
766
- // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
767
- // ^^^^^^^^^^^
768
- //
769
- // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
770
- // (which will handle updating any changed attributes, reconciling their
771
- // children etc) but we also need to move the DOM node to which
772
- // `oldEndVnode` corresponds.
773
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
774
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
775
- }
776
674
  patch(oldEndVnode, newStartVnode, isInitialRender);
777
675
  // We've already checked above if `oldStartVnode` and `newStartVnode` are
778
676
  // the same node, so since we're here we know that they are not. Thus we
@@ -829,7 +727,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
829
727
  if (node) {
830
728
  // if we created a new node then handle inserting it to the DOM
831
729
  {
832
- parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
730
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
833
731
  }
834
732
  }
835
733
  }
@@ -868,9 +766,6 @@ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
868
766
  // compare if two vnode to see if they're "technically" the same
869
767
  // need to have the same element tag, and same key to be the same
870
768
  if (leftVNode.$tag$ === rightVNode.$tag$) {
871
- if (leftVNode.$tag$ === 'slot') {
872
- return leftVNode.$name$ === rightVNode.$name$;
873
- }
874
769
  // this will be set if JSX tags in the build have `key` attrs set on them
875
770
  // we only want to check this if we're not on the first render since on
876
771
  // first render `leftVNode.$key$` will always be `null`, so we can be led
@@ -883,14 +778,6 @@ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
883
778
  }
884
779
  return false;
885
780
  };
886
- const referenceNode = (node) => {
887
- // this node was relocated to a new location in the dom
888
- // because of some other component's slot
889
- // but we still have an html comment in place of where
890
- // it's original location was according to it's original vdom
891
- return (node && node['s-ol']) || node;
892
- };
893
- const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
894
781
  /**
895
782
  * Handle reconciling an outdated VNode with a new one which corresponds to
896
783
  * it. This function handles flushing updates to the DOM and reconciling the
@@ -906,7 +793,6 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
906
793
  const newChildren = newVNode.$children$;
907
794
  const tag = newVNode.$tag$;
908
795
  const text = newVNode.$text$;
909
- let defaultHolder;
910
796
  if (text === null) {
911
797
  {
912
798
  if (tag === 'slot' && !useNativeShadowDom) ;
@@ -936,193 +822,12 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
936
822
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
937
823
  }
938
824
  }
939
- else if ((defaultHolder = elm['s-cr'])) {
940
- // this element has slotted content
941
- defaultHolder.parentNode.textContent = text;
942
- }
943
825
  else if (oldVNode.$text$ !== text) {
944
826
  // update the text content for the text only vnode
945
827
  // and also only if the text is different than before
946
828
  elm.data = text;
947
829
  }
948
830
  };
949
- /**
950
- * Adjust the `.hidden` property as-needed on any nodes in a DOM subtree which
951
- * are slot fallbacks nodes.
952
- *
953
- * A slot fallback node should be visible by default. Then, it should be
954
- * conditionally hidden if:
955
- *
956
- * - it has a sibling with a `slot` property set to its slot name or if
957
- * - it is a default fallback slot node, in which case we hide if it has any
958
- * content
959
- *
960
- * @param elm the element of interest
961
- */
962
- const updateFallbackSlotVisibility = (elm) => {
963
- const childNodes = elm.childNodes;
964
- for (const childNode of childNodes) {
965
- if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
966
- if (childNode['s-sr']) {
967
- // this is a slot fallback node
968
- // get the slot name for this slot reference node
969
- const slotName = childNode['s-sn'];
970
- // by default always show a fallback slot node
971
- // then hide it if there are other slots in the light dom
972
- childNode.hidden = false;
973
- // we need to check all of its sibling nodes in order to see if
974
- // `childNode` should be hidden
975
- for (const siblingNode of childNodes) {
976
- // Don't check the node against itself
977
- if (siblingNode !== childNode) {
978
- if (siblingNode['s-hn'] !== childNode['s-hn'] || slotName !== '') {
979
- // this sibling node is from a different component OR is a named
980
- // fallback slot node
981
- if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
982
- (slotName === siblingNode.getAttribute('slot') || slotName === siblingNode['s-sn'])) {
983
- childNode.hidden = true;
984
- break;
985
- }
986
- }
987
- else {
988
- // this is a default fallback slot node
989
- // any element or text node (with content)
990
- // should hide the default fallback slot node
991
- if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ ||
992
- (siblingNode.nodeType === 3 /* NODE_TYPE.TextNode */ && siblingNode.textContent.trim() !== '')) {
993
- childNode.hidden = true;
994
- break;
995
- }
996
- }
997
- }
998
- }
999
- }
1000
- // keep drilling down
1001
- updateFallbackSlotVisibility(childNode);
1002
- }
1003
- }
1004
- };
1005
- /**
1006
- * Component-global information about nodes which are either currently being
1007
- * relocated or will be shortly.
1008
- */
1009
- const relocateNodes = [];
1010
- /**
1011
- * Mark the contents of a slot for relocation via adding references to them to
1012
- * the {@link relocateNodes} data structure. The actual work of relocating them
1013
- * will then be handled in {@link renderVdom}.
1014
- *
1015
- * @param elm a render node whose child nodes need to be relocated
1016
- */
1017
- const markSlotContentForRelocation = (elm) => {
1018
- // tslint:disable-next-line: prefer-const
1019
- let node;
1020
- let hostContentNodes;
1021
- let j;
1022
- for (const childNode of elm.childNodes) {
1023
- // we need to find child nodes which are slot references so we can then try
1024
- // to match them up with nodes that need to be relocated
1025
- if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1026
- // first get the content reference comment node ('s-cr'), then we get
1027
- // its parent, which is where all the host content is now
1028
- hostContentNodes = node.parentNode.childNodes;
1029
- const slotName = childNode['s-sn'];
1030
- // iterate through all the nodes under the location where the host was
1031
- // originally rendered
1032
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
1033
- node = hostContentNodes[j];
1034
- // check that the node is not a content reference node or a node
1035
- // reference and then check that the host name does not match that of
1036
- // childNode.
1037
- // In addition, check that the slot either has not already been relocated, or
1038
- // that its current location's host is not childNode's host. This is essentially
1039
- // a check so that we don't try to relocate (and then hide) a node that is already
1040
- // where it should be.
1041
- if (!node['s-cn'] &&
1042
- !node['s-nr'] &&
1043
- node['s-hn'] !== childNode['s-hn'] &&
1044
- (!BUILD.experimentalSlotFixes )) {
1045
- // if `node` is located in the slot that `childNode` refers to (via the
1046
- // `'s-sn'` property) then we need to relocate it from it's current spot
1047
- // (under the host element parent) to the right slot location
1048
- if (isNodeLocatedInSlot(node, slotName)) {
1049
- // it's possible we've already decided to relocate this node
1050
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1051
- // made some changes to slots
1052
- // let's make sure we also double check
1053
- // fallbacks are correctly hidden or shown
1054
- checkSlotFallbackVisibility = true;
1055
- // ensure that the slot-name attr is correct
1056
- node['s-sn'] = node['s-sn'] || slotName;
1057
- if (relocateNodeData) {
1058
- relocateNodeData.$nodeToRelocate$['s-sh'] = childNode['s-hn'];
1059
- // we marked this node for relocation previously but didn't find
1060
- // out the slot reference node to which it needs to be relocated
1061
- // so write it down now!
1062
- relocateNodeData.$slotRefNode$ = childNode;
1063
- }
1064
- else {
1065
- node['s-sh'] = childNode['s-hn'];
1066
- // add to our list of nodes to relocate
1067
- relocateNodes.push({
1068
- $slotRefNode$: childNode,
1069
- $nodeToRelocate$: node,
1070
- });
1071
- }
1072
- if (node['s-sr']) {
1073
- relocateNodes.map((relocateNode) => {
1074
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1075
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1076
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
1077
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1078
- }
1079
- }
1080
- });
1081
- }
1082
- }
1083
- else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1084
- // the node is not found within the slot (`childNode`) that we're
1085
- // currently looking at, so we stick it into `relocateNodes` to
1086
- // handle later. If we never find a home for this element then
1087
- // we'll need to hide it
1088
- relocateNodes.push({
1089
- $nodeToRelocate$: node,
1090
- });
1091
- }
1092
- }
1093
- }
1094
- }
1095
- // if we're dealing with any type of element (capable of itself being a
1096
- // slot reference or containing one) then we recur
1097
- if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1098
- markSlotContentForRelocation(childNode);
1099
- }
1100
- }
1101
- };
1102
- /**
1103
- * Check whether a node is located in a given named slot.
1104
- *
1105
- * @param nodeToRelocate the node of interest
1106
- * @param slotName the slot name to check
1107
- * @returns whether the node is located in the slot or not
1108
- */
1109
- const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
1110
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1111
- if (nodeToRelocate.getAttribute('slot') === null && slotName === '') {
1112
- // if the node doesn't have a slot attribute, and the slot we're checking
1113
- // is not a named slot, then we assume the node should be within the slot
1114
- return true;
1115
- }
1116
- if (nodeToRelocate.getAttribute('slot') === slotName) {
1117
- return true;
1118
- }
1119
- return false;
1120
- }
1121
- if (nodeToRelocate['s-sn'] === slotName) {
1122
- return true;
1123
- }
1124
- return slotName === '';
1125
- };
1126
831
  /**
1127
832
  * The main entry point for Stencil's virtual DOM-based rendering engine
1128
833
  *
@@ -1137,7 +842,6 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
1137
842
  * @param isInitialLoad whether or not this is the first call after page load
1138
843
  */
1139
844
  const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1140
- var _a, _b, _c, _d;
1141
845
  const hostElm = hostRef.$hostElement$;
1142
846
  const cmpMeta = hostRef.$cmpMeta$;
1143
847
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -1176,113 +880,13 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1176
880
  rootVnode.$tag$ = null;
1177
881
  rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1178
882
  hostRef.$vnode$ = rootVnode;
1179
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
1180
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
883
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1181
884
  {
1182
- contentRef = hostElm['s-cr'];
1183
- // always reset
1184
- checkSlotFallbackVisibility = false;
885
+ scopeId = hostElm['s-sc'];
1185
886
  }
887
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1186
888
  // synchronous patch
1187
889
  patch(oldVNode, rootVnode, isInitialLoad);
1188
- {
1189
- // while we're moving nodes around existing nodes, temporarily disable
1190
- // the disconnectCallback from working
1191
- plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1192
- if (checkSlotRelocate) {
1193
- markSlotContentForRelocation(rootVnode.$elm$);
1194
- for (const relocateData of relocateNodes) {
1195
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1196
- if (!nodeToRelocate['s-ol']) {
1197
- // add a reference node marking this node's original location
1198
- // keep a reference to this node for later lookups
1199
- const orgLocationNode = doc.createTextNode('');
1200
- orgLocationNode['s-nr'] = nodeToRelocate;
1201
- nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1202
- }
1203
- }
1204
- for (const relocateData of relocateNodes) {
1205
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1206
- const slotRefNode = relocateData.$slotRefNode$;
1207
- if (slotRefNode) {
1208
- const parentNodeRef = slotRefNode.parentNode;
1209
- // When determining where to insert content, the most simple case would be
1210
- // to relocate the node immediately following the slot reference node. We do this
1211
- // by getting a reference to the node immediately following the slot reference node
1212
- // since we will use `insertBefore` to manipulate the DOM.
1213
- //
1214
- // If there is no node immediately following the slot reference node, then we will just
1215
- // end up appending the node as the last child of the parent.
1216
- let insertBeforeNode = slotRefNode.nextSibling;
1217
- // If the node we're currently planning on inserting the new node before is an element,
1218
- // we need to do some additional checks to make sure we're inserting the node in the correct order.
1219
- // The use case here would be that we have multiple nodes being relocated to the same slot. So, we want
1220
- // to make sure they get inserted into their new how in the same order they were declared in their original location.
1221
- //
1222
- // TODO(STENCIL-914): Remove `experimentalSlotFixes` check
1223
- {
1224
- let orgLocationNode = (_a = nodeToRelocate['s-ol']) === null || _a === void 0 ? void 0 : _a.previousSibling;
1225
- while (orgLocationNode) {
1226
- let refNode = (_b = orgLocationNode['s-nr']) !== null && _b !== void 0 ? _b : null;
1227
- if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1228
- refNode = refNode.nextSibling;
1229
- if (!refNode || !refNode['s-nr']) {
1230
- insertBeforeNode = refNode;
1231
- break;
1232
- }
1233
- }
1234
- orgLocationNode = orgLocationNode.previousSibling;
1235
- }
1236
- }
1237
- if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1238
- nodeToRelocate.nextSibling !== insertBeforeNode) {
1239
- // we've checked that it's worth while to relocate
1240
- // since that the node to relocate
1241
- // has a different next sibling or parent relocated
1242
- if (nodeToRelocate !== insertBeforeNode) {
1243
- if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1244
- // probably a component in the index.html that doesn't have its hostname set
1245
- nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1246
- }
1247
- // Add it back to the dom but in its new home
1248
- // If we get to this point and `insertBeforeNode` is `null`, that means
1249
- // we're just going to append the node as the last child of the parent. Passing
1250
- // `null` as the second arg here will trigger that behavior.
1251
- parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1252
- // Reset the `hidden` value back to what it was defined as originally
1253
- // This solves a problem where a `slot` is dynamically rendered and `hidden` may have
1254
- // been set on content originally, but now it has a slot to go to so it should have
1255
- // the value it was defined as having in the DOM, not what we overrode it to.
1256
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1257
- nodeToRelocate.hidden = (_c = nodeToRelocate['s-ih']) !== null && _c !== void 0 ? _c : false;
1258
- }
1259
- }
1260
- }
1261
- }
1262
- else {
1263
- // this node doesn't have a slot home to go to, so let's hide it
1264
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1265
- // Store the initial value of `hidden` so we can reset it later when
1266
- // moving nodes around.
1267
- if (isInitialLoad) {
1268
- nodeToRelocate['s-ih'] = (_d = nodeToRelocate.hidden) !== null && _d !== void 0 ? _d : false;
1269
- }
1270
- nodeToRelocate.hidden = true;
1271
- }
1272
- }
1273
- }
1274
- }
1275
- if (checkSlotFallbackVisibility) {
1276
- updateFallbackSlotVisibility(rootVnode.$elm$);
1277
- }
1278
- // done moving nodes around
1279
- // allow the disconnect callback to work again
1280
- plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1281
- // always reset
1282
- relocateNodes.length = 0;
1283
- }
1284
- // Clear the content ref so we don't create a memory leak
1285
- contentRef = undefined;
1286
890
  };
1287
891
  const attachToAncestor = (hostRef, ancestorComponent) => {
1288
892
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
@@ -1771,16 +1375,6 @@ const connectedCallback = (elm) => {
1771
1375
  if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1772
1376
  // first time this component has connected
1773
1377
  hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1774
- {
1775
- // initUpdate
1776
- // if the slot polyfill is required we'll need to put some nodes
1777
- // in here to act as original content anchors as we move nodes around
1778
- // host element has been connected to the DOM
1779
- if ((// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
1780
- cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1781
- setContentReference(elm);
1782
- }
1783
- }
1784
1378
  {
1785
1379
  // find the first ancestor component (if there is one) and register
1786
1380
  // this component as one of the actively loading child components for its ancestor
@@ -1821,17 +1415,6 @@ const connectedCallback = (elm) => {
1821
1415
  endConnected();
1822
1416
  }
1823
1417
  };
1824
- const setContentReference = (elm) => {
1825
- // only required when we're NOT using native shadow dom (slot)
1826
- // or this browser doesn't support native shadow dom
1827
- // and this host element was NOT created with SSR
1828
- // let's pick out the inner content for slot projection
1829
- // create a node to represent where the original
1830
- // content was first placed, which is useful later on
1831
- const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1832
- contentRefElm['s-cn'] = true;
1833
- elm.insertBefore(contentRefElm, elm.firstChild);
1834
- };
1835
1418
  const disconnectInstance = (instance) => {
1836
1419
  };
1837
1420
  const disconnectedCallback = async (elm) => {
@@ -1885,6 +1468,17 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1885
1468
  super(self);
1886
1469
  self = this;
1887
1470
  registerHost(self, cmpMeta);
1471
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1472
+ // this component is using shadow dom
1473
+ // and this browser supports shadow dom
1474
+ // add the read-only property "shadowRoot" to the host element
1475
+ // adding the shadow root build conditionals to minimize runtime
1476
+ {
1477
+ {
1478
+ self.attachShadow({ mode: 'open' });
1479
+ }
1480
+ }
1481
+ }
1888
1482
  }
1889
1483
  connectedCallback() {
1890
1484
  if (appLoadFallback) {
@@ -2108,4 +1702,4 @@ exports.promiseResolve = promiseResolve;
2108
1702
  exports.registerInstance = registerInstance;
2109
1703
  exports.setNonce = setNonce;
2110
1704
 
2111
- //# sourceMappingURL=index-46644e39.js.map
1705
+ //# sourceMappingURL=index-91a3ed32.js.map