@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
|
@@ -31,7 +31,11 @@ const NAMESPACE = 'ripple';
|
|
|
31
31
|
* Modified for Stencil's renderer and slot projection
|
|
32
32
|
*/
|
|
33
33
|
let scopeId;
|
|
34
|
+
let contentRef;
|
|
34
35
|
let hostTagName;
|
|
36
|
+
let useNativeShadowDom = false;
|
|
37
|
+
let checkSlotFallbackVisibility = false;
|
|
38
|
+
let checkSlotRelocate = false;
|
|
35
39
|
let isSvgMode = false;
|
|
36
40
|
let queuePending = false;
|
|
37
41
|
const createTime = (fnName, tagName = '') => {
|
|
@@ -101,6 +105,7 @@ function queryNonceMetaTagContent(doc) {
|
|
|
101
105
|
const h = (nodeName, vnodeData, ...children) => {
|
|
102
106
|
let child = null;
|
|
103
107
|
let key = null;
|
|
108
|
+
let slotName = null;
|
|
104
109
|
let simple = false;
|
|
105
110
|
let lastSimple = false;
|
|
106
111
|
const vNodeChildren = [];
|
|
@@ -132,6 +137,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
132
137
|
if (vnodeData.key) {
|
|
133
138
|
key = vnodeData.key;
|
|
134
139
|
}
|
|
140
|
+
if (vnodeData.name) {
|
|
141
|
+
slotName = vnodeData.name;
|
|
142
|
+
}
|
|
135
143
|
{
|
|
136
144
|
const classData = vnodeData.className || vnodeData.class;
|
|
137
145
|
if (classData) {
|
|
@@ -152,6 +160,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
152
160
|
{
|
|
153
161
|
vnode.$key$ = key;
|
|
154
162
|
}
|
|
163
|
+
{
|
|
164
|
+
vnode.$name$ = slotName;
|
|
165
|
+
}
|
|
155
166
|
return vnode;
|
|
156
167
|
};
|
|
157
168
|
/**
|
|
@@ -176,6 +187,9 @@ const newVNode = (tag, text) => {
|
|
|
176
187
|
{
|
|
177
188
|
vnode.$key$ = null;
|
|
178
189
|
}
|
|
190
|
+
{
|
|
191
|
+
vnode.$name$ = null;
|
|
192
|
+
}
|
|
179
193
|
return vnode;
|
|
180
194
|
};
|
|
181
195
|
const Host = {};
|
|
@@ -525,16 +539,39 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
525
539
|
let i = 0;
|
|
526
540
|
let elm;
|
|
527
541
|
let childNode;
|
|
542
|
+
let oldVNode;
|
|
543
|
+
if (!useNativeShadowDom) {
|
|
544
|
+
// remember for later we need to check to relocate nodes
|
|
545
|
+
checkSlotRelocate = true;
|
|
546
|
+
if (newVNode.$tag$ === 'slot') {
|
|
547
|
+
if (scopeId) {
|
|
548
|
+
// scoped css needs to add its scoped id to the parent element
|
|
549
|
+
parentElm.classList.add(scopeId + '-s');
|
|
550
|
+
}
|
|
551
|
+
newVNode.$flags$ |= newVNode.$children$
|
|
552
|
+
? // slot element has fallback content
|
|
553
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
554
|
+
: // slot element does not have fallback content
|
|
555
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
528
558
|
if (newVNode.$text$ !== null) {
|
|
529
559
|
// create text node
|
|
530
560
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
531
561
|
}
|
|
562
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
563
|
+
// create a slot reference node
|
|
564
|
+
elm = newVNode.$elm$ =
|
|
565
|
+
doc.createTextNode('');
|
|
566
|
+
}
|
|
532
567
|
else {
|
|
533
568
|
if (!isSvgMode) {
|
|
534
569
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
535
570
|
}
|
|
536
571
|
// create element
|
|
537
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$
|
|
572
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
573
|
+
? 'slot-fb'
|
|
574
|
+
: newVNode.$tag$)
|
|
538
575
|
);
|
|
539
576
|
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
540
577
|
isSvgMode = false;
|
|
@@ -551,7 +588,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
551
588
|
if (newVNode.$children$) {
|
|
552
589
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
553
590
|
// create the node
|
|
554
|
-
childNode = createElm(oldParentVNode, newVNode, i);
|
|
591
|
+
childNode = createElm(oldParentVNode, newVNode, i, elm);
|
|
555
592
|
// return node could have been null
|
|
556
593
|
if (childNode) {
|
|
557
594
|
// append our new node
|
|
@@ -570,8 +607,50 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
570
607
|
}
|
|
571
608
|
}
|
|
572
609
|
}
|
|
610
|
+
{
|
|
611
|
+
elm['s-hn'] = hostTagName;
|
|
612
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
613
|
+
// remember the content reference comment
|
|
614
|
+
elm['s-sr'] = true;
|
|
615
|
+
// remember the content reference comment
|
|
616
|
+
elm['s-cr'] = contentRef;
|
|
617
|
+
// remember the slot name, or empty string for default slot
|
|
618
|
+
elm['s-sn'] = newVNode.$name$ || '';
|
|
619
|
+
// check if we've got an old vnode for this slot
|
|
620
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
621
|
+
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
622
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
|
623
|
+
// so let's move the old slot content back to it's original location
|
|
624
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
573
628
|
return elm;
|
|
574
629
|
};
|
|
630
|
+
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
631
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
632
|
+
const oldSlotChildNodes = parentElm.childNodes;
|
|
633
|
+
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
634
|
+
const childNode = oldSlotChildNodes[i];
|
|
635
|
+
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
636
|
+
// // this child node in the old element is from another component
|
|
637
|
+
// // remove this node from the old slot's parent
|
|
638
|
+
// childNode.remove();
|
|
639
|
+
// and relocate it back to it's original location
|
|
640
|
+
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
641
|
+
// remove the old original location comment entirely
|
|
642
|
+
// later on the patch function will know what to do
|
|
643
|
+
// and move this to the correct spot in need be
|
|
644
|
+
childNode['s-ol'].remove();
|
|
645
|
+
childNode['s-ol'] = undefined;
|
|
646
|
+
checkSlotRelocate = true;
|
|
647
|
+
}
|
|
648
|
+
if (recursive) {
|
|
649
|
+
putBackInOriginalLocation(childNode, recursive);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
653
|
+
};
|
|
575
654
|
/**
|
|
576
655
|
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
577
656
|
* add them to the DOM in the appropriate place.
|
|
@@ -588,17 +667,17 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
588
667
|
* creating DOM nodes (inclusive)
|
|
589
668
|
*/
|
|
590
669
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
591
|
-
let containerElm = (parentElm);
|
|
670
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
592
671
|
let childNode;
|
|
593
672
|
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
594
673
|
containerElm = containerElm.shadowRoot;
|
|
595
674
|
}
|
|
596
675
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
597
676
|
if (vnodes[startIdx]) {
|
|
598
|
-
childNode = createElm(null, parentVNode, startIdx);
|
|
677
|
+
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
599
678
|
if (childNode) {
|
|
600
679
|
vnodes[startIdx].$elm$ = childNode;
|
|
601
|
-
containerElm.insertBefore(childNode, before);
|
|
680
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
602
681
|
}
|
|
603
682
|
}
|
|
604
683
|
}
|
|
@@ -621,6 +700,20 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
|
621
700
|
const elm = vnode.$elm$;
|
|
622
701
|
nullifyVNodeRefs(vnode);
|
|
623
702
|
if (elm) {
|
|
703
|
+
{
|
|
704
|
+
// we're removing this element
|
|
705
|
+
// so it's possible we need to show slot fallback content now
|
|
706
|
+
checkSlotFallbackVisibility = true;
|
|
707
|
+
if (elm['s-ol']) {
|
|
708
|
+
// remove the original location comment
|
|
709
|
+
elm['s-ol'].remove();
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
// it's possible that child nodes of the node
|
|
713
|
+
// that's being removed are slot nodes
|
|
714
|
+
putBackInOriginalLocation(elm, true);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
624
717
|
// remove the vnode's element from the dom
|
|
625
718
|
elm.remove();
|
|
626
719
|
}
|
|
@@ -740,6 +833,23 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
740
833
|
newEndVnode = newCh[--newEndIdx];
|
|
741
834
|
}
|
|
742
835
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
836
|
+
// case: "Vnode moved right"
|
|
837
|
+
//
|
|
838
|
+
// We've found that the last node in our window on the new children is
|
|
839
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
840
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
841
|
+
// nodes:
|
|
842
|
+
//
|
|
843
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
844
|
+
// ^^^^^^^^^^^
|
|
845
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
846
|
+
// ^^^^^^^^^^^^^
|
|
847
|
+
//
|
|
848
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
849
|
+
// and move the DOM element for `oldStartVnode`.
|
|
850
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
851
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
852
|
+
}
|
|
743
853
|
patch(oldStartVnode, newEndVnode);
|
|
744
854
|
// We need to move the element for `oldStartVnode` into a position which
|
|
745
855
|
// will be appropriate for `newEndVnode`. For this we can use
|
|
@@ -763,6 +873,24 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
763
873
|
newEndVnode = newCh[--newEndIdx];
|
|
764
874
|
}
|
|
765
875
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
876
|
+
// case: "Vnode moved left"
|
|
877
|
+
//
|
|
878
|
+
// We've found that the first node in our window on the new children is
|
|
879
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
880
|
+
// Visually, this is the layout of these two nodes:
|
|
881
|
+
//
|
|
882
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
883
|
+
// ^^^^^^^^^^^^^
|
|
884
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
885
|
+
// ^^^^^^^^^^^
|
|
886
|
+
//
|
|
887
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
888
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
889
|
+
// children etc) but we also need to move the DOM node to which
|
|
890
|
+
// `oldEndVnode` corresponds.
|
|
891
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
892
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
893
|
+
}
|
|
766
894
|
patch(oldEndVnode, newStartVnode);
|
|
767
895
|
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
768
896
|
// the same node, so since we're here we know that they are not. Thus we
|
|
@@ -797,7 +925,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
797
925
|
elmToMove = oldCh[idxInOld];
|
|
798
926
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
799
927
|
// the tag doesn't match so we'll need a new DOM element
|
|
800
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
928
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
|
|
801
929
|
}
|
|
802
930
|
else {
|
|
803
931
|
patch(elmToMove, newStartVnode);
|
|
@@ -813,13 +941,13 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
813
941
|
// the key of the first new child OR the build is not using `key`
|
|
814
942
|
// attributes at all. In either case we need to create a new element
|
|
815
943
|
// for the new node.
|
|
816
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
944
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
817
945
|
newStartVnode = newCh[++newStartIdx];
|
|
818
946
|
}
|
|
819
947
|
if (node) {
|
|
820
948
|
// if we created a new node then handle inserting it to the DOM
|
|
821
949
|
{
|
|
822
|
-
oldStartVnode.$elm
|
|
950
|
+
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
823
951
|
}
|
|
824
952
|
}
|
|
825
953
|
}
|
|
@@ -857,6 +985,9 @@ const isSameVnode = (leftVNode, rightVNode) => {
|
|
|
857
985
|
// compare if two vnode to see if they're "technically" the same
|
|
858
986
|
// need to have the same element tag, and same key to be the same
|
|
859
987
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
988
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
989
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
990
|
+
}
|
|
860
991
|
// this will be set if components in the build have `key` attrs set on them
|
|
861
992
|
{
|
|
862
993
|
return leftVNode.$key$ === rightVNode.$key$;
|
|
@@ -864,6 +995,14 @@ const isSameVnode = (leftVNode, rightVNode) => {
|
|
|
864
995
|
}
|
|
865
996
|
return false;
|
|
866
997
|
};
|
|
998
|
+
const referenceNode = (node) => {
|
|
999
|
+
// this node was relocated to a new location in the dom
|
|
1000
|
+
// because of some other component's slot
|
|
1001
|
+
// but we still have an html comment in place of where
|
|
1002
|
+
// it's original location was according to it's original vdom
|
|
1003
|
+
return (node && node['s-ol']) || node;
|
|
1004
|
+
};
|
|
1005
|
+
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
867
1006
|
/**
|
|
868
1007
|
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
869
1008
|
* it. This function handles flushing updates to the DOM and reconciling the
|
|
@@ -878,6 +1017,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
878
1017
|
const newChildren = newVNode.$children$;
|
|
879
1018
|
const tag = newVNode.$tag$;
|
|
880
1019
|
const text = newVNode.$text$;
|
|
1020
|
+
let defaultHolder;
|
|
881
1021
|
if (text === null) {
|
|
882
1022
|
{
|
|
883
1023
|
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
@@ -916,12 +1056,147 @@ const patch = (oldVNode, newVNode) => {
|
|
|
916
1056
|
isSvgMode = false;
|
|
917
1057
|
}
|
|
918
1058
|
}
|
|
1059
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
1060
|
+
// this element has slotted content
|
|
1061
|
+
defaultHolder.parentNode.textContent = text;
|
|
1062
|
+
}
|
|
919
1063
|
else if (oldVNode.$text$ !== text) {
|
|
920
1064
|
// update the text content for the text only vnode
|
|
921
1065
|
// and also only if the text is different than before
|
|
922
1066
|
elm.data = text;
|
|
923
1067
|
}
|
|
924
1068
|
};
|
|
1069
|
+
const updateFallbackSlotVisibility = (elm) => {
|
|
1070
|
+
// tslint:disable-next-line: prefer-const
|
|
1071
|
+
const childNodes = elm.childNodes;
|
|
1072
|
+
let childNode;
|
|
1073
|
+
let i;
|
|
1074
|
+
let ilen;
|
|
1075
|
+
let j;
|
|
1076
|
+
let slotNameAttr;
|
|
1077
|
+
let nodeType;
|
|
1078
|
+
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
1079
|
+
childNode = childNodes[i];
|
|
1080
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1081
|
+
if (childNode['s-sr']) {
|
|
1082
|
+
// this is a slot fallback node
|
|
1083
|
+
// get the slot name for this slot reference node
|
|
1084
|
+
slotNameAttr = childNode['s-sn'];
|
|
1085
|
+
// by default always show a fallback slot node
|
|
1086
|
+
// then hide it if there are other slots in the light dom
|
|
1087
|
+
childNode.hidden = false;
|
|
1088
|
+
for (j = 0; j < ilen; j++) {
|
|
1089
|
+
nodeType = childNodes[j].nodeType;
|
|
1090
|
+
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
1091
|
+
// this sibling node is from a different component OR is a named fallback slot node
|
|
1092
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
1093
|
+
childNode.hidden = true;
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
else {
|
|
1098
|
+
// this is a default fallback slot node
|
|
1099
|
+
// any element or text node (with content)
|
|
1100
|
+
// should hide the default fallback slot node
|
|
1101
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1102
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
1103
|
+
childNode.hidden = true;
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
// keep drilling down
|
|
1110
|
+
updateFallbackSlotVisibility(childNode);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
const relocateNodes = [];
|
|
1115
|
+
const relocateSlotContent = (elm) => {
|
|
1116
|
+
// tslint:disable-next-line: prefer-const
|
|
1117
|
+
let childNode;
|
|
1118
|
+
let node;
|
|
1119
|
+
let hostContentNodes;
|
|
1120
|
+
let slotNameAttr;
|
|
1121
|
+
let relocateNodeData;
|
|
1122
|
+
let j;
|
|
1123
|
+
let i = 0;
|
|
1124
|
+
const childNodes = elm.childNodes;
|
|
1125
|
+
const ilen = childNodes.length;
|
|
1126
|
+
for (; i < ilen; i++) {
|
|
1127
|
+
childNode = childNodes[i];
|
|
1128
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
1129
|
+
// first got the content reference comment node
|
|
1130
|
+
// then we got it's parent, which is where all the host content is in now
|
|
1131
|
+
hostContentNodes = node.parentNode.childNodes;
|
|
1132
|
+
slotNameAttr = childNode['s-sn'];
|
|
1133
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
1134
|
+
node = hostContentNodes[j];
|
|
1135
|
+
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
1136
|
+
// let's do some relocating to its new home
|
|
1137
|
+
// but never relocate a content reference node
|
|
1138
|
+
// that is suppose to always represent the original content location
|
|
1139
|
+
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
1140
|
+
// it's possible we've already decided to relocate this node
|
|
1141
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1142
|
+
// made some changes to slots
|
|
1143
|
+
// let's make sure we also double check
|
|
1144
|
+
// fallbacks are correctly hidden or shown
|
|
1145
|
+
checkSlotFallbackVisibility = true;
|
|
1146
|
+
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
|
1147
|
+
if (relocateNodeData) {
|
|
1148
|
+
// previously we never found a slot home for this node
|
|
1149
|
+
// but turns out we did, so let's remember it now
|
|
1150
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
|
1151
|
+
}
|
|
1152
|
+
else {
|
|
1153
|
+
// add to our list of nodes to relocate
|
|
1154
|
+
relocateNodes.push({
|
|
1155
|
+
$slotRefNode$: childNode,
|
|
1156
|
+
$nodeToRelocate$: node,
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
if (node['s-sr']) {
|
|
1160
|
+
relocateNodes.map((relocateNode) => {
|
|
1161
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
1162
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1163
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
1164
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
1171
|
+
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
1172
|
+
// if we never find a home for this element then we'll need to hide it
|
|
1173
|
+
relocateNodes.push({
|
|
1174
|
+
$nodeToRelocate$: node,
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1181
|
+
relocateSlotContent(childNode);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
1186
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1187
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
1188
|
+
return true;
|
|
1189
|
+
}
|
|
1190
|
+
if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
|
|
1191
|
+
return true;
|
|
1192
|
+
}
|
|
1193
|
+
return false;
|
|
1194
|
+
}
|
|
1195
|
+
if (nodeToRelocate['s-sn'] === slotNameAttr) {
|
|
1196
|
+
return true;
|
|
1197
|
+
}
|
|
1198
|
+
return slotNameAttr === '';
|
|
1199
|
+
};
|
|
925
1200
|
/**
|
|
926
1201
|
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
|
|
927
1202
|
* calling them with `null`. This signals that the DOM element corresponding to
|
|
@@ -964,8 +1239,90 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
964
1239
|
{
|
|
965
1240
|
scopeId = hostElm['s-sc'];
|
|
966
1241
|
}
|
|
1242
|
+
{
|
|
1243
|
+
contentRef = hostElm['s-cr'];
|
|
1244
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
1245
|
+
// always reset
|
|
1246
|
+
checkSlotFallbackVisibility = false;
|
|
1247
|
+
}
|
|
967
1248
|
// synchronous patch
|
|
968
1249
|
patch(oldVNode, rootVnode);
|
|
1250
|
+
{
|
|
1251
|
+
// while we're moving nodes around existing nodes, temporarily disable
|
|
1252
|
+
// the disconnectCallback from working
|
|
1253
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1254
|
+
if (checkSlotRelocate) {
|
|
1255
|
+
relocateSlotContent(rootVnode.$elm$);
|
|
1256
|
+
let relocateData;
|
|
1257
|
+
let nodeToRelocate;
|
|
1258
|
+
let orgLocationNode;
|
|
1259
|
+
let parentNodeRef;
|
|
1260
|
+
let insertBeforeNode;
|
|
1261
|
+
let refNode;
|
|
1262
|
+
let i = 0;
|
|
1263
|
+
for (; i < relocateNodes.length; i++) {
|
|
1264
|
+
relocateData = relocateNodes[i];
|
|
1265
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1266
|
+
if (!nodeToRelocate['s-ol']) {
|
|
1267
|
+
// add a reference node marking this node's original location
|
|
1268
|
+
// keep a reference to this node for later lookups
|
|
1269
|
+
orgLocationNode =
|
|
1270
|
+
doc.createTextNode('');
|
|
1271
|
+
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1272
|
+
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
for (i = 0; i < relocateNodes.length; i++) {
|
|
1276
|
+
relocateData = relocateNodes[i];
|
|
1277
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1278
|
+
if (relocateData.$slotRefNode$) {
|
|
1279
|
+
// by default we're just going to insert it directly
|
|
1280
|
+
// after the slot reference node
|
|
1281
|
+
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
|
1282
|
+
insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
|
|
1283
|
+
orgLocationNode = nodeToRelocate['s-ol'];
|
|
1284
|
+
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
|
1285
|
+
refNode = orgLocationNode['s-nr'];
|
|
1286
|
+
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
1287
|
+
refNode = refNode.nextSibling;
|
|
1288
|
+
if (!refNode || !refNode['s-nr']) {
|
|
1289
|
+
insertBeforeNode = refNode;
|
|
1290
|
+
break;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
1295
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
1296
|
+
// we've checked that it's worth while to relocate
|
|
1297
|
+
// since that the node to relocate
|
|
1298
|
+
// has a different next sibling or parent relocated
|
|
1299
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
|
1300
|
+
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
1301
|
+
// probably a component in the index.html that doesn't have it's hostname set
|
|
1302
|
+
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
1303
|
+
}
|
|
1304
|
+
// add it back to the dom but in its new home
|
|
1305
|
+
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
else {
|
|
1310
|
+
// this node doesn't have a slot home to go to, so let's hide it
|
|
1311
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1312
|
+
nodeToRelocate.hidden = true;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
if (checkSlotFallbackVisibility) {
|
|
1318
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
1319
|
+
}
|
|
1320
|
+
// done moving nodes around
|
|
1321
|
+
// allow the disconnect callback to work again
|
|
1322
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1323
|
+
// always reset
|
|
1324
|
+
relocateNodes.length = 0;
|
|
1325
|
+
}
|
|
969
1326
|
};
|
|
970
1327
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
971
1328
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
@@ -1460,6 +1817,16 @@ const connectedCallback = (elm) => {
|
|
|
1460
1817
|
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1461
1818
|
// first time this component has connected
|
|
1462
1819
|
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1820
|
+
{
|
|
1821
|
+
// initUpdate
|
|
1822
|
+
// if the slot polyfill is required we'll need to put some nodes
|
|
1823
|
+
// in here to act as original content anchors as we move nodes around
|
|
1824
|
+
// host element has been connected to the DOM
|
|
1825
|
+
if ((// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
1826
|
+
cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1827
|
+
setContentReference(elm);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1463
1830
|
{
|
|
1464
1831
|
// find the first ancestor component (if there is one) and register
|
|
1465
1832
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1499,6 +1866,17 @@ const connectedCallback = (elm) => {
|
|
|
1499
1866
|
endConnected();
|
|
1500
1867
|
}
|
|
1501
1868
|
};
|
|
1869
|
+
const setContentReference = (elm) => {
|
|
1870
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
1871
|
+
// or this browser doesn't support native shadow dom
|
|
1872
|
+
// and this host element was NOT created with SSR
|
|
1873
|
+
// let's pick out the inner content for slot projection
|
|
1874
|
+
// create a node to represent where the original
|
|
1875
|
+
// content was first placed, which is useful later on
|
|
1876
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
1877
|
+
contentRefElm['s-cn'] = true;
|
|
1878
|
+
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1879
|
+
};
|
|
1502
1880
|
const disconnectedCallback = (elm) => {
|
|
1503
1881
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1504
1882
|
const hostRef = getHostRef(elm);
|