@watermarkinsights/ripple 3.36.0 → 3.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{chartFunctions-41c67866.js → chartFunctions-4d828b26.js} +2 -2
- package/dist/cjs/{functions-45f36418.js → functions-0c27162e.js} +38 -22
- package/dist/{esm/global-1dca883b.js → cjs/global-a2ca8069.js} +13 -3
- package/dist/cjs/{index-670c5d2a.js → index-fae02cd7.js} +386 -8
- package/dist/cjs/{intl-a84cd5ef.js → intl-022a42a1.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/priv-chart-popover.cjs.entry.js +2 -2
- package/dist/cjs/priv-datepicker.cjs.entry.js +2 -2
- package/dist/cjs/priv-navigator-button.cjs.entry.js +1 -1
- package/dist/cjs/priv-navigator-item.cjs.entry.js +1 -1
- package/dist/cjs/ripple.cjs.js +3 -3
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +2 -2
- package/dist/cjs/wm-button.cjs.entry.js +2 -2
- package/dist/cjs/wm-chart-slice.cjs.entry.js +1 -1
- package/dist/cjs/wm-chart.cjs.entry.js +4 -4
- package/dist/cjs/wm-datepicker.cjs.entry.js +2 -2
- package/dist/cjs/wm-file-list.cjs.entry.js +1 -1
- package/dist/cjs/wm-file.cjs.entry.js +2 -2
- package/dist/cjs/wm-input.cjs.entry.js +3 -3
- package/dist/cjs/wm-line-chart.cjs.entry.js +4 -4
- package/dist/cjs/wm-modal-footer.cjs.entry.js +13 -16
- package/dist/cjs/wm-modal-header.cjs.entry.js +8 -18
- package/dist/cjs/wm-modal.cjs.entry.js +27 -58
- package/dist/cjs/wm-navigation_3.cjs.entry.js +3 -3
- package/dist/cjs/wm-navigator.cjs.entry.js +2 -2
- package/dist/cjs/wm-network-uploader.cjs.entry.js +3 -3
- package/dist/cjs/wm-option_2.cjs.entry.js +3 -3
- package/dist/cjs/wm-pagination.cjs.entry.js +2 -2
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +3 -3
- package/dist/cjs/wm-search.cjs.entry.js +3 -3
- package/dist/cjs/wm-snackbar.cjs.entry.js +3 -3
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-tag-input-row.cjs.entry.js +1 -1
- package/dist/cjs/wm-tag-input.cjs.entry.js +3 -3
- package/dist/cjs/wm-timepicker.cjs.entry.js +2 -2
- package/dist/cjs/wm-toggletip.cjs.entry.js +2 -2
- package/dist/cjs/wm-uploader.cjs.entry.js +3 -3
- package/dist/cjs/wm-wrapper.cjs.entry.js +1 -1
- package/dist/collection/components/wm-modal/wm-modal-footer.css +1 -1
- package/dist/collection/components/wm-modal/wm-modal-footer.js +11 -14
- package/dist/collection/components/wm-modal/wm-modal-header.css +1 -1
- package/dist/collection/components/wm-modal/wm-modal-header.js +4 -14
- package/dist/collection/components/wm-modal/wm-modal.css +27 -65
- package/dist/collection/components/wm-modal/wm-modal.js +24 -71
- package/dist/collection/components/wm-modal/wm-modal.spec.js +0 -28
- package/dist/collection/global/functions.js +38 -22
- package/dist/collection/global/global.js +10 -2
- package/dist/esm/{chartFunctions-e539d991.js → chartFunctions-f4f3252e.js} +2 -2
- package/dist/esm/{functions-7fc7cf30.js → functions-d52b728c.js} +39 -23
- package/dist/{cjs/global-c795cff3.js → esm/global-06801d00.js} +11 -5
- package/dist/esm/{index-294d486f.js → index-7e11ea42.js} +386 -8
- package/dist/esm/{intl-f0475a8e.js → intl-9809c77c.js} +1 -1
- package/dist/esm/loader.js +4 -4
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/priv-chart-popover.entry.js +2 -2
- package/dist/esm/priv-datepicker.entry.js +2 -2
- package/dist/esm/priv-navigator-button.entry.js +1 -1
- package/dist/esm/priv-navigator-item.entry.js +1 -1
- package/dist/esm/ripple.js +4 -4
- package/dist/esm/wm-action-menu_2.entry.js +2 -2
- package/dist/esm/wm-button.entry.js +2 -2
- package/dist/esm/wm-chart-slice.entry.js +1 -1
- package/dist/esm/wm-chart.entry.js +4 -4
- package/dist/esm/wm-datepicker.entry.js +2 -2
- package/dist/esm/wm-file-list.entry.js +1 -1
- package/dist/esm/wm-file.entry.js +2 -2
- package/dist/esm/wm-input.entry.js +3 -3
- package/dist/esm/wm-line-chart.entry.js +4 -4
- package/dist/esm/wm-modal-footer.entry.js +13 -16
- package/dist/esm/wm-modal-header.entry.js +8 -18
- package/dist/esm/wm-modal.entry.js +27 -58
- package/dist/esm/wm-navigation_3.entry.js +3 -3
- package/dist/esm/wm-navigator.entry.js +2 -2
- package/dist/esm/wm-network-uploader.entry.js +3 -3
- package/dist/esm/wm-option_2.entry.js +3 -3
- package/dist/esm/wm-pagination.entry.js +2 -2
- package/dist/esm/wm-progress-indicator_3.entry.js +3 -3
- package/dist/esm/wm-search.entry.js +3 -3
- package/dist/esm/wm-snackbar.entry.js +3 -3
- package/dist/esm/wm-tab-item_3.entry.js +2 -2
- package/dist/esm/wm-tag-input-row.entry.js +1 -1
- package/dist/esm/wm-tag-input.entry.js +3 -3
- package/dist/esm/wm-timepicker.entry.js +2 -2
- package/dist/esm/wm-toggletip.entry.js +2 -2
- package/dist/esm/wm-uploader.entry.js +3 -3
- package/dist/esm/wm-wrapper.entry.js +1 -1
- package/dist/esm-es5/{chartFunctions-e539d991.js → chartFunctions-f4f3252e.js} +1 -1
- package/dist/esm-es5/{functions-7fc7cf30.js → functions-d52b728c.js} +1 -1
- package/dist/esm-es5/{global-1dca883b.js → global-06801d00.js} +1 -1
- package/dist/esm-es5/index-7e11ea42.js +2 -0
- package/dist/esm-es5/{intl-f0475a8e.js → intl-9809c77c.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
- package/dist/esm-es5/priv-datepicker.entry.js +1 -1
- package/dist/esm-es5/priv-navigator-button.entry.js +1 -1
- package/dist/esm-es5/priv-navigator-item.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
- package/dist/esm-es5/wm-button.entry.js +1 -1
- package/dist/esm-es5/wm-chart-slice.entry.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-file-list.entry.js +1 -1
- package/dist/esm-es5/wm-file.entry.js +1 -1
- package/dist/esm-es5/wm-input.entry.js +1 -1
- package/dist/esm-es5/wm-line-chart.entry.js +1 -1
- package/dist/esm-es5/wm-modal-footer.entry.js +1 -1
- package/dist/esm-es5/wm-modal-header.entry.js +1 -1
- package/dist/esm-es5/wm-modal.entry.js +1 -1
- package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
- package/dist/esm-es5/wm-navigator.entry.js +1 -1
- package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/esm-es5/wm-pagination.entry.js +1 -1
- package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
- package/dist/esm-es5/wm-search.entry.js +1 -1
- package/dist/esm-es5/wm-snackbar.entry.js +1 -1
- package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
- package/dist/esm-es5/wm-tag-input-row.entry.js +1 -1
- package/dist/esm-es5/wm-tag-input.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-wrapper.entry.js +1 -1
- package/dist/ripple/p-0631be01.system.entry.js +1 -0
- package/dist/ripple/{p-a6317ac6.entry.js → p-06871476.entry.js} +1 -1
- package/dist/ripple/{p-5e109597.entry.js → p-0d9f70ab.entry.js} +1 -1
- package/dist/ripple/{p-6639cf6c.entry.js → p-11763c02.entry.js} +1 -1
- package/dist/ripple/p-185c3645.entry.js +1 -0
- package/dist/ripple/{p-42cd9ae6.entry.js → p-19773c40.entry.js} +1 -1
- package/dist/ripple/{p-69c802aa.entry.js → p-198f596b.entry.js} +1 -1
- package/dist/ripple/{p-2bbf689a.system.entry.js → p-20df08be.system.entry.js} +1 -1
- package/dist/ripple/p-24d9f6fe.entry.js +1 -0
- package/dist/ripple/p-25c1bd67.system.entry.js +1 -0
- package/dist/ripple/{p-77ea81c7.system.entry.js → p-26031cd0.system.entry.js} +1 -1
- package/dist/ripple/{p-936e078c.system.js → p-27efb4d0.system.js} +1 -1
- package/dist/ripple/{p-766a4a70.system.entry.js → p-2acf8af1.system.entry.js} +1 -1
- package/dist/ripple/{p-1cb7bdc5.entry.js → p-2ebac749.entry.js} +1 -1
- package/dist/ripple/p-30bf24f8.system.js +2 -0
- package/dist/ripple/{p-bde26da9.system.entry.js → p-3248c0fa.system.entry.js} +1 -1
- package/dist/ripple/p-364753eb.js +1 -0
- package/dist/ripple/p-39e17683.system.js +1 -0
- package/dist/ripple/{p-935eafa7.system.entry.js → p-3b50511c.system.entry.js} +1 -1
- package/dist/ripple/p-3c80bf67.entry.js +1 -0
- package/dist/ripple/{p-6f36e973.entry.js → p-3ec4ae19.entry.js} +1 -1
- package/dist/ripple/p-42aeb9bb.js +1 -0
- package/dist/ripple/{p-5d78937a.entry.js → p-4b59b16a.entry.js} +1 -1
- package/dist/ripple/{p-770f02d4.entry.js → p-50623da2.entry.js} +1 -1
- package/dist/ripple/p-50be6128.system.entry.js +1 -0
- package/dist/ripple/{p-f3ff86da.entry.js → p-535e7286.entry.js} +1 -1
- package/dist/ripple/{p-cabf1867.system.entry.js → p-53f5e969.system.entry.js} +1 -1
- package/dist/ripple/{p-0412d22d.system.entry.js → p-56d64283.system.entry.js} +1 -1
- package/dist/ripple/{p-d9268ba1.system.entry.js → p-5c1b2132.system.entry.js} +1 -1
- package/dist/ripple/{p-29960160.system.entry.js → p-5d592297.system.entry.js} +1 -1
- package/dist/ripple/{p-d4ebbe84.system.js → p-5e55eb56.system.js} +1 -1
- package/dist/ripple/{p-0872dd92.entry.js → p-697ba13b.entry.js} +1 -1
- package/dist/ripple/{p-b22858cd.entry.js → p-725c757a.entry.js} +1 -1
- package/dist/ripple/{p-24ac418e.system.entry.js → p-74a92541.system.entry.js} +1 -1
- package/dist/ripple/{p-fcbd4194.entry.js → p-7962f562.entry.js} +1 -1
- package/dist/ripple/{p-cd67e184.entry.js → p-7f722888.entry.js} +1 -1
- package/dist/ripple/{p-08e0007e.system.entry.js → p-80ca72ff.system.entry.js} +1 -1
- package/dist/ripple/{p-53b84f6d.entry.js → p-84e55d9e.entry.js} +1 -1
- package/dist/ripple/{p-0730d70d.system.entry.js → p-89bf36c8.system.entry.js} +1 -1
- package/dist/ripple/p-8ea68cb3.system.entry.js +1 -0
- package/dist/ripple/{p-7b91eba4.system.entry.js → p-8f273c5b.system.entry.js} +1 -1
- package/dist/ripple/{p-a7a9c931.entry.js → p-9cb8f41b.entry.js} +1 -1
- package/dist/ripple/{p-23a5adae.entry.js → p-9e29176c.entry.js} +1 -1
- package/dist/ripple/{p-6cc52a23.system.entry.js → p-a1e95b05.system.entry.js} +1 -1
- package/dist/ripple/{p-38b67301.entry.js → p-a52c5a1c.entry.js} +1 -1
- package/dist/ripple/{p-71ecba7e.system.entry.js → p-aae11e37.system.entry.js} +1 -1
- package/dist/ripple/{p-b111bc7d.entry.js → p-adf76148.entry.js} +1 -1
- package/dist/ripple/{p-765b53d8.system.entry.js → p-ae97bf6c.system.entry.js} +1 -1
- package/dist/ripple/p-b5bedd63.js +2 -0
- package/dist/ripple/{p-00850d97.entry.js → p-b982a342.entry.js} +1 -1
- package/dist/ripple/{p-e4f352fe.system.js → p-ba31d982.system.js} +1 -1
- package/dist/ripple/p-c1857a16.entry.js +1 -0
- package/dist/ripple/{p-d601c5a1.entry.js → p-c32d10f7.entry.js} +1 -1
- package/dist/ripple/{p-a9012b82.system.entry.js → p-c3915cfe.system.entry.js} +1 -1
- package/dist/ripple/{p-4d5e075b.system.entry.js → p-cab12cec.system.entry.js} +1 -1
- package/dist/ripple/{p-2b378ac6.js → p-cd7cc5c6.js} +1 -1
- package/dist/ripple/{p-0a846e45.entry.js → p-d72b00a0.entry.js} +1 -1
- package/dist/ripple/{p-f1aed810.system.entry.js → p-d8de670a.system.entry.js} +1 -1
- package/dist/ripple/{p-68f11410.entry.js → p-da01c531.entry.js} +1 -1
- package/dist/ripple/{p-4a58b0ff.system.entry.js → p-dd01929e.system.entry.js} +1 -1
- package/dist/ripple/{p-5da6b9ff.system.entry.js → p-e0f270e2.system.entry.js} +1 -1
- package/dist/ripple/{p-64abb6d9.system.entry.js → p-e882a31f.system.entry.js} +1 -1
- package/dist/ripple/{p-c459ef8e.entry.js → p-ec13e325.entry.js} +1 -1
- package/dist/ripple/{p-dc069d46.entry.js → p-ed3e41ed.entry.js} +1 -1
- package/dist/ripple/{p-458c1c0b.system.entry.js → p-f635c1ec.system.entry.js} +1 -1
- package/dist/ripple/{p-eb0d569a.system.entry.js → p-f865899a.system.entry.js} +1 -1
- package/dist/ripple/{p-fd0fc5e1.system.entry.js → p-f9539737.system.entry.js} +1 -1
- package/dist/ripple/{p-6628e036.system.entry.js → p-fbb44f76.system.entry.js} +1 -1
- package/dist/ripple/{p-74880dac.system.entry.js → p-fcdd9e03.system.entry.js} +1 -1
- package/dist/ripple/{p-1a7b1578.system.js → p-fd354e00.system.js} +1 -1
- package/dist/ripple/{p-6546dda7.entry.js → p-fd91cd58.entry.js} +1 -1
- package/dist/ripple/{p-f9e942f6.entry.js → p-fea4bc00.entry.js} +1 -1
- package/dist/ripple/{p-20495238.js → p-ff888d78.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/wm-modal/wm-modal-footer.d.ts +0 -1
- package/dist/types/components/wm-modal/wm-modal-header.d.ts +0 -1
- package/dist/types/components/wm-modal/wm-modal.d.ts +4 -10
- package/package.json +1 -1
- package/dist/esm-es5/index-294d486f.js +0 -2
- package/dist/ripple/p-11b416c7.js +0 -2
- package/dist/ripple/p-16708229.js +0 -1
- package/dist/ripple/p-212d0c64.entry.js +0 -1
- package/dist/ripple/p-2b59a09f.entry.js +0 -1
- package/dist/ripple/p-4418858d.entry.js +0 -1
- package/dist/ripple/p-56747d40.system.entry.js +0 -1
- package/dist/ripple/p-5e005259.system.entry.js +0 -1
- package/dist/ripple/p-63466d04.entry.js +0 -1
- package/dist/ripple/p-89bc016a.js +0 -1
- package/dist/ripple/p-8a38e526.system.js +0 -1
- package/dist/ripple/p-8c6ffd70.system.entry.js +0 -1
- package/dist/ripple/p-c467a1e1.system.js +0 -2
- package/dist/ripple/p-c5942ad6.system.entry.js +0 -1
|
@@ -9,7 +9,11 @@ const NAMESPACE = 'ripple';
|
|
|
9
9
|
* Modified for Stencil's renderer and slot projection
|
|
10
10
|
*/
|
|
11
11
|
let scopeId;
|
|
12
|
+
let contentRef;
|
|
12
13
|
let hostTagName;
|
|
14
|
+
let useNativeShadowDom = false;
|
|
15
|
+
let checkSlotFallbackVisibility = false;
|
|
16
|
+
let checkSlotRelocate = false;
|
|
13
17
|
let isSvgMode = false;
|
|
14
18
|
let queuePending = false;
|
|
15
19
|
const createTime = (fnName, tagName = '') => {
|
|
@@ -79,6 +83,7 @@ function queryNonceMetaTagContent(doc) {
|
|
|
79
83
|
const h = (nodeName, vnodeData, ...children) => {
|
|
80
84
|
let child = null;
|
|
81
85
|
let key = null;
|
|
86
|
+
let slotName = null;
|
|
82
87
|
let simple = false;
|
|
83
88
|
let lastSimple = false;
|
|
84
89
|
const vNodeChildren = [];
|
|
@@ -110,6 +115,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
110
115
|
if (vnodeData.key) {
|
|
111
116
|
key = vnodeData.key;
|
|
112
117
|
}
|
|
118
|
+
if (vnodeData.name) {
|
|
119
|
+
slotName = vnodeData.name;
|
|
120
|
+
}
|
|
113
121
|
{
|
|
114
122
|
const classData = vnodeData.className || vnodeData.class;
|
|
115
123
|
if (classData) {
|
|
@@ -130,6 +138,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
130
138
|
{
|
|
131
139
|
vnode.$key$ = key;
|
|
132
140
|
}
|
|
141
|
+
{
|
|
142
|
+
vnode.$name$ = slotName;
|
|
143
|
+
}
|
|
133
144
|
return vnode;
|
|
134
145
|
};
|
|
135
146
|
/**
|
|
@@ -154,6 +165,9 @@ const newVNode = (tag, text) => {
|
|
|
154
165
|
{
|
|
155
166
|
vnode.$key$ = null;
|
|
156
167
|
}
|
|
168
|
+
{
|
|
169
|
+
vnode.$name$ = null;
|
|
170
|
+
}
|
|
157
171
|
return vnode;
|
|
158
172
|
};
|
|
159
173
|
const Host = {};
|
|
@@ -503,16 +517,39 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
503
517
|
let i = 0;
|
|
504
518
|
let elm;
|
|
505
519
|
let childNode;
|
|
520
|
+
let oldVNode;
|
|
521
|
+
if (!useNativeShadowDom) {
|
|
522
|
+
// remember for later we need to check to relocate nodes
|
|
523
|
+
checkSlotRelocate = true;
|
|
524
|
+
if (newVNode.$tag$ === 'slot') {
|
|
525
|
+
if (scopeId) {
|
|
526
|
+
// scoped css needs to add its scoped id to the parent element
|
|
527
|
+
parentElm.classList.add(scopeId + '-s');
|
|
528
|
+
}
|
|
529
|
+
newVNode.$flags$ |= newVNode.$children$
|
|
530
|
+
? // slot element has fallback content
|
|
531
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
532
|
+
: // slot element does not have fallback content
|
|
533
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
506
536
|
if (newVNode.$text$ !== null) {
|
|
507
537
|
// create text node
|
|
508
538
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
509
539
|
}
|
|
540
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
541
|
+
// create a slot reference node
|
|
542
|
+
elm = newVNode.$elm$ =
|
|
543
|
+
doc.createTextNode('');
|
|
544
|
+
}
|
|
510
545
|
else {
|
|
511
546
|
if (!isSvgMode) {
|
|
512
547
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
513
548
|
}
|
|
514
549
|
// create element
|
|
515
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$
|
|
550
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
551
|
+
? 'slot-fb'
|
|
552
|
+
: newVNode.$tag$)
|
|
516
553
|
);
|
|
517
554
|
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
518
555
|
isSvgMode = false;
|
|
@@ -529,7 +566,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
529
566
|
if (newVNode.$children$) {
|
|
530
567
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
531
568
|
// create the node
|
|
532
|
-
childNode = createElm(oldParentVNode, newVNode, i);
|
|
569
|
+
childNode = createElm(oldParentVNode, newVNode, i, elm);
|
|
533
570
|
// return node could have been null
|
|
534
571
|
if (childNode) {
|
|
535
572
|
// append our new node
|
|
@@ -548,8 +585,50 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
548
585
|
}
|
|
549
586
|
}
|
|
550
587
|
}
|
|
588
|
+
{
|
|
589
|
+
elm['s-hn'] = hostTagName;
|
|
590
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
591
|
+
// remember the content reference comment
|
|
592
|
+
elm['s-sr'] = true;
|
|
593
|
+
// remember the content reference comment
|
|
594
|
+
elm['s-cr'] = contentRef;
|
|
595
|
+
// remember the slot name, or empty string for default slot
|
|
596
|
+
elm['s-sn'] = newVNode.$name$ || '';
|
|
597
|
+
// check if we've got an old vnode for this slot
|
|
598
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
599
|
+
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
600
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
|
601
|
+
// so let's move the old slot content back to it's original location
|
|
602
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
551
606
|
return elm;
|
|
552
607
|
};
|
|
608
|
+
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
609
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
610
|
+
const oldSlotChildNodes = parentElm.childNodes;
|
|
611
|
+
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
612
|
+
const childNode = oldSlotChildNodes[i];
|
|
613
|
+
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
614
|
+
// // this child node in the old element is from another component
|
|
615
|
+
// // remove this node from the old slot's parent
|
|
616
|
+
// childNode.remove();
|
|
617
|
+
// and relocate it back to it's original location
|
|
618
|
+
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
619
|
+
// remove the old original location comment entirely
|
|
620
|
+
// later on the patch function will know what to do
|
|
621
|
+
// and move this to the correct spot in need be
|
|
622
|
+
childNode['s-ol'].remove();
|
|
623
|
+
childNode['s-ol'] = undefined;
|
|
624
|
+
checkSlotRelocate = true;
|
|
625
|
+
}
|
|
626
|
+
if (recursive) {
|
|
627
|
+
putBackInOriginalLocation(childNode, recursive);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
631
|
+
};
|
|
553
632
|
/**
|
|
554
633
|
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
555
634
|
* add them to the DOM in the appropriate place.
|
|
@@ -566,17 +645,17 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
566
645
|
* creating DOM nodes (inclusive)
|
|
567
646
|
*/
|
|
568
647
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
569
|
-
let containerElm = (parentElm);
|
|
648
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
570
649
|
let childNode;
|
|
571
650
|
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
572
651
|
containerElm = containerElm.shadowRoot;
|
|
573
652
|
}
|
|
574
653
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
575
654
|
if (vnodes[startIdx]) {
|
|
576
|
-
childNode = createElm(null, parentVNode, startIdx);
|
|
655
|
+
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
577
656
|
if (childNode) {
|
|
578
657
|
vnodes[startIdx].$elm$ = childNode;
|
|
579
|
-
containerElm.insertBefore(childNode, before);
|
|
658
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
580
659
|
}
|
|
581
660
|
}
|
|
582
661
|
}
|
|
@@ -599,6 +678,20 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
|
599
678
|
const elm = vnode.$elm$;
|
|
600
679
|
nullifyVNodeRefs(vnode);
|
|
601
680
|
if (elm) {
|
|
681
|
+
{
|
|
682
|
+
// we're removing this element
|
|
683
|
+
// so it's possible we need to show slot fallback content now
|
|
684
|
+
checkSlotFallbackVisibility = true;
|
|
685
|
+
if (elm['s-ol']) {
|
|
686
|
+
// remove the original location comment
|
|
687
|
+
elm['s-ol'].remove();
|
|
688
|
+
}
|
|
689
|
+
else {
|
|
690
|
+
// it's possible that child nodes of the node
|
|
691
|
+
// that's being removed are slot nodes
|
|
692
|
+
putBackInOriginalLocation(elm, true);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
602
695
|
// remove the vnode's element from the dom
|
|
603
696
|
elm.remove();
|
|
604
697
|
}
|
|
@@ -718,6 +811,23 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
718
811
|
newEndVnode = newCh[--newEndIdx];
|
|
719
812
|
}
|
|
720
813
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
814
|
+
// case: "Vnode moved right"
|
|
815
|
+
//
|
|
816
|
+
// We've found that the last node in our window on the new children is
|
|
817
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
818
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
819
|
+
// nodes:
|
|
820
|
+
//
|
|
821
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
822
|
+
// ^^^^^^^^^^^
|
|
823
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
824
|
+
// ^^^^^^^^^^^^^
|
|
825
|
+
//
|
|
826
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
827
|
+
// and move the DOM element for `oldStartVnode`.
|
|
828
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
829
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
830
|
+
}
|
|
721
831
|
patch(oldStartVnode, newEndVnode);
|
|
722
832
|
// We need to move the element for `oldStartVnode` into a position which
|
|
723
833
|
// will be appropriate for `newEndVnode`. For this we can use
|
|
@@ -741,6 +851,24 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
741
851
|
newEndVnode = newCh[--newEndIdx];
|
|
742
852
|
}
|
|
743
853
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
854
|
+
// case: "Vnode moved left"
|
|
855
|
+
//
|
|
856
|
+
// We've found that the first node in our window on the new children is
|
|
857
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
858
|
+
// Visually, this is the layout of these two nodes:
|
|
859
|
+
//
|
|
860
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
861
|
+
// ^^^^^^^^^^^^^
|
|
862
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
863
|
+
// ^^^^^^^^^^^
|
|
864
|
+
//
|
|
865
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
866
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
867
|
+
// children etc) but we also need to move the DOM node to which
|
|
868
|
+
// `oldEndVnode` corresponds.
|
|
869
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
870
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
871
|
+
}
|
|
744
872
|
patch(oldEndVnode, newStartVnode);
|
|
745
873
|
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
746
874
|
// the same node, so since we're here we know that they are not. Thus we
|
|
@@ -775,7 +903,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
775
903
|
elmToMove = oldCh[idxInOld];
|
|
776
904
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
777
905
|
// the tag doesn't match so we'll need a new DOM element
|
|
778
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
906
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
|
|
779
907
|
}
|
|
780
908
|
else {
|
|
781
909
|
patch(elmToMove, newStartVnode);
|
|
@@ -791,13 +919,13 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
791
919
|
// the key of the first new child OR the build is not using `key`
|
|
792
920
|
// attributes at all. In either case we need to create a new element
|
|
793
921
|
// for the new node.
|
|
794
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
922
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
795
923
|
newStartVnode = newCh[++newStartIdx];
|
|
796
924
|
}
|
|
797
925
|
if (node) {
|
|
798
926
|
// if we created a new node then handle inserting it to the DOM
|
|
799
927
|
{
|
|
800
|
-
oldStartVnode.$elm
|
|
928
|
+
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
801
929
|
}
|
|
802
930
|
}
|
|
803
931
|
}
|
|
@@ -835,6 +963,9 @@ const isSameVnode = (leftVNode, rightVNode) => {
|
|
|
835
963
|
// compare if two vnode to see if they're "technically" the same
|
|
836
964
|
// need to have the same element tag, and same key to be the same
|
|
837
965
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
966
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
967
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
968
|
+
}
|
|
838
969
|
// this will be set if components in the build have `key` attrs set on them
|
|
839
970
|
{
|
|
840
971
|
return leftVNode.$key$ === rightVNode.$key$;
|
|
@@ -842,6 +973,14 @@ const isSameVnode = (leftVNode, rightVNode) => {
|
|
|
842
973
|
}
|
|
843
974
|
return false;
|
|
844
975
|
};
|
|
976
|
+
const referenceNode = (node) => {
|
|
977
|
+
// this node was relocated to a new location in the dom
|
|
978
|
+
// because of some other component's slot
|
|
979
|
+
// but we still have an html comment in place of where
|
|
980
|
+
// it's original location was according to it's original vdom
|
|
981
|
+
return (node && node['s-ol']) || node;
|
|
982
|
+
};
|
|
983
|
+
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
845
984
|
/**
|
|
846
985
|
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
847
986
|
* it. This function handles flushing updates to the DOM and reconciling the
|
|
@@ -856,6 +995,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
856
995
|
const newChildren = newVNode.$children$;
|
|
857
996
|
const tag = newVNode.$tag$;
|
|
858
997
|
const text = newVNode.$text$;
|
|
998
|
+
let defaultHolder;
|
|
859
999
|
if (text === null) {
|
|
860
1000
|
{
|
|
861
1001
|
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
@@ -894,12 +1034,147 @@ const patch = (oldVNode, newVNode) => {
|
|
|
894
1034
|
isSvgMode = false;
|
|
895
1035
|
}
|
|
896
1036
|
}
|
|
1037
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
1038
|
+
// this element has slotted content
|
|
1039
|
+
defaultHolder.parentNode.textContent = text;
|
|
1040
|
+
}
|
|
897
1041
|
else if (oldVNode.$text$ !== text) {
|
|
898
1042
|
// update the text content for the text only vnode
|
|
899
1043
|
// and also only if the text is different than before
|
|
900
1044
|
elm.data = text;
|
|
901
1045
|
}
|
|
902
1046
|
};
|
|
1047
|
+
const updateFallbackSlotVisibility = (elm) => {
|
|
1048
|
+
// tslint:disable-next-line: prefer-const
|
|
1049
|
+
const childNodes = elm.childNodes;
|
|
1050
|
+
let childNode;
|
|
1051
|
+
let i;
|
|
1052
|
+
let ilen;
|
|
1053
|
+
let j;
|
|
1054
|
+
let slotNameAttr;
|
|
1055
|
+
let nodeType;
|
|
1056
|
+
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
1057
|
+
childNode = childNodes[i];
|
|
1058
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1059
|
+
if (childNode['s-sr']) {
|
|
1060
|
+
// this is a slot fallback node
|
|
1061
|
+
// get the slot name for this slot reference node
|
|
1062
|
+
slotNameAttr = childNode['s-sn'];
|
|
1063
|
+
// by default always show a fallback slot node
|
|
1064
|
+
// then hide it if there are other slots in the light dom
|
|
1065
|
+
childNode.hidden = false;
|
|
1066
|
+
for (j = 0; j < ilen; j++) {
|
|
1067
|
+
nodeType = childNodes[j].nodeType;
|
|
1068
|
+
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
1069
|
+
// this sibling node is from a different component OR is a named fallback slot node
|
|
1070
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
1071
|
+
childNode.hidden = true;
|
|
1072
|
+
break;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
else {
|
|
1076
|
+
// this is a default fallback slot node
|
|
1077
|
+
// any element or text node (with content)
|
|
1078
|
+
// should hide the default fallback slot node
|
|
1079
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1080
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
1081
|
+
childNode.hidden = true;
|
|
1082
|
+
break;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
// keep drilling down
|
|
1088
|
+
updateFallbackSlotVisibility(childNode);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
const relocateNodes = [];
|
|
1093
|
+
const relocateSlotContent = (elm) => {
|
|
1094
|
+
// tslint:disable-next-line: prefer-const
|
|
1095
|
+
let childNode;
|
|
1096
|
+
let node;
|
|
1097
|
+
let hostContentNodes;
|
|
1098
|
+
let slotNameAttr;
|
|
1099
|
+
let relocateNodeData;
|
|
1100
|
+
let j;
|
|
1101
|
+
let i = 0;
|
|
1102
|
+
const childNodes = elm.childNodes;
|
|
1103
|
+
const ilen = childNodes.length;
|
|
1104
|
+
for (; i < ilen; i++) {
|
|
1105
|
+
childNode = childNodes[i];
|
|
1106
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
1107
|
+
// first got the content reference comment node
|
|
1108
|
+
// then we got it's parent, which is where all the host content is in now
|
|
1109
|
+
hostContentNodes = node.parentNode.childNodes;
|
|
1110
|
+
slotNameAttr = childNode['s-sn'];
|
|
1111
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
1112
|
+
node = hostContentNodes[j];
|
|
1113
|
+
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
1114
|
+
// let's do some relocating to its new home
|
|
1115
|
+
// but never relocate a content reference node
|
|
1116
|
+
// that is suppose to always represent the original content location
|
|
1117
|
+
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
1118
|
+
// it's possible we've already decided to relocate this node
|
|
1119
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1120
|
+
// made some changes to slots
|
|
1121
|
+
// let's make sure we also double check
|
|
1122
|
+
// fallbacks are correctly hidden or shown
|
|
1123
|
+
checkSlotFallbackVisibility = true;
|
|
1124
|
+
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
|
1125
|
+
if (relocateNodeData) {
|
|
1126
|
+
// previously we never found a slot home for this node
|
|
1127
|
+
// but turns out we did, so let's remember it now
|
|
1128
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
|
1129
|
+
}
|
|
1130
|
+
else {
|
|
1131
|
+
// add to our list of nodes to relocate
|
|
1132
|
+
relocateNodes.push({
|
|
1133
|
+
$slotRefNode$: childNode,
|
|
1134
|
+
$nodeToRelocate$: node,
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
if (node['s-sr']) {
|
|
1138
|
+
relocateNodes.map((relocateNode) => {
|
|
1139
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
1140
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1141
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
1142
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
1149
|
+
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
1150
|
+
// if we never find a home for this element then we'll need to hide it
|
|
1151
|
+
relocateNodes.push({
|
|
1152
|
+
$nodeToRelocate$: node,
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1159
|
+
relocateSlotContent(childNode);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
1164
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1165
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
1166
|
+
return true;
|
|
1167
|
+
}
|
|
1168
|
+
if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
|
|
1169
|
+
return true;
|
|
1170
|
+
}
|
|
1171
|
+
return false;
|
|
1172
|
+
}
|
|
1173
|
+
if (nodeToRelocate['s-sn'] === slotNameAttr) {
|
|
1174
|
+
return true;
|
|
1175
|
+
}
|
|
1176
|
+
return slotNameAttr === '';
|
|
1177
|
+
};
|
|
903
1178
|
/**
|
|
904
1179
|
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
|
|
905
1180
|
* calling them with `null`. This signals that the DOM element corresponding to
|
|
@@ -942,8 +1217,90 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
942
1217
|
{
|
|
943
1218
|
scopeId = hostElm['s-sc'];
|
|
944
1219
|
}
|
|
1220
|
+
{
|
|
1221
|
+
contentRef = hostElm['s-cr'];
|
|
1222
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
1223
|
+
// always reset
|
|
1224
|
+
checkSlotFallbackVisibility = false;
|
|
1225
|
+
}
|
|
945
1226
|
// synchronous patch
|
|
946
1227
|
patch(oldVNode, rootVnode);
|
|
1228
|
+
{
|
|
1229
|
+
// while we're moving nodes around existing nodes, temporarily disable
|
|
1230
|
+
// the disconnectCallback from working
|
|
1231
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1232
|
+
if (checkSlotRelocate) {
|
|
1233
|
+
relocateSlotContent(rootVnode.$elm$);
|
|
1234
|
+
let relocateData;
|
|
1235
|
+
let nodeToRelocate;
|
|
1236
|
+
let orgLocationNode;
|
|
1237
|
+
let parentNodeRef;
|
|
1238
|
+
let insertBeforeNode;
|
|
1239
|
+
let refNode;
|
|
1240
|
+
let i = 0;
|
|
1241
|
+
for (; i < relocateNodes.length; i++) {
|
|
1242
|
+
relocateData = relocateNodes[i];
|
|
1243
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1244
|
+
if (!nodeToRelocate['s-ol']) {
|
|
1245
|
+
// add a reference node marking this node's original location
|
|
1246
|
+
// keep a reference to this node for later lookups
|
|
1247
|
+
orgLocationNode =
|
|
1248
|
+
doc.createTextNode('');
|
|
1249
|
+
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1250
|
+
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
for (i = 0; i < relocateNodes.length; i++) {
|
|
1254
|
+
relocateData = relocateNodes[i];
|
|
1255
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1256
|
+
if (relocateData.$slotRefNode$) {
|
|
1257
|
+
// by default we're just going to insert it directly
|
|
1258
|
+
// after the slot reference node
|
|
1259
|
+
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
|
1260
|
+
insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
|
|
1261
|
+
orgLocationNode = nodeToRelocate['s-ol'];
|
|
1262
|
+
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
|
1263
|
+
refNode = orgLocationNode['s-nr'];
|
|
1264
|
+
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
1265
|
+
refNode = refNode.nextSibling;
|
|
1266
|
+
if (!refNode || !refNode['s-nr']) {
|
|
1267
|
+
insertBeforeNode = refNode;
|
|
1268
|
+
break;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
1273
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
1274
|
+
// we've checked that it's worth while to relocate
|
|
1275
|
+
// since that the node to relocate
|
|
1276
|
+
// has a different next sibling or parent relocated
|
|
1277
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
|
1278
|
+
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
1279
|
+
// probably a component in the index.html that doesn't have it's hostname set
|
|
1280
|
+
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
1281
|
+
}
|
|
1282
|
+
// add it back to the dom but in its new home
|
|
1283
|
+
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
else {
|
|
1288
|
+
// this node doesn't have a slot home to go to, so let's hide it
|
|
1289
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1290
|
+
nodeToRelocate.hidden = true;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
if (checkSlotFallbackVisibility) {
|
|
1296
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
1297
|
+
}
|
|
1298
|
+
// done moving nodes around
|
|
1299
|
+
// allow the disconnect callback to work again
|
|
1300
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1301
|
+
// always reset
|
|
1302
|
+
relocateNodes.length = 0;
|
|
1303
|
+
}
|
|
947
1304
|
};
|
|
948
1305
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
949
1306
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
@@ -1438,6 +1795,16 @@ const connectedCallback = (elm) => {
|
|
|
1438
1795
|
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1439
1796
|
// first time this component has connected
|
|
1440
1797
|
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1798
|
+
{
|
|
1799
|
+
// initUpdate
|
|
1800
|
+
// if the slot polyfill is required we'll need to put some nodes
|
|
1801
|
+
// in here to act as original content anchors as we move nodes around
|
|
1802
|
+
// host element has been connected to the DOM
|
|
1803
|
+
if ((// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
1804
|
+
cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1805
|
+
setContentReference(elm);
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1441
1808
|
{
|
|
1442
1809
|
// find the first ancestor component (if there is one) and register
|
|
1443
1810
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1477,6 +1844,17 @@ const connectedCallback = (elm) => {
|
|
|
1477
1844
|
endConnected();
|
|
1478
1845
|
}
|
|
1479
1846
|
};
|
|
1847
|
+
const setContentReference = (elm) => {
|
|
1848
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
1849
|
+
// or this browser doesn't support native shadow dom
|
|
1850
|
+
// and this host element was NOT created with SSR
|
|
1851
|
+
// let's pick out the inner content for slot projection
|
|
1852
|
+
// create a node to represent where the original
|
|
1853
|
+
// content was first placed, which is useful later on
|
|
1854
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
1855
|
+
contentRefElm['s-cn'] = true;
|
|
1856
|
+
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1857
|
+
};
|
|
1480
1858
|
const disconnectedCallback = (elm) => {
|
|
1481
1859
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1482
1860
|
const hostRef = getHostRef(elm);
|