@watermarkinsights/ripple 3.4.0 → 3.5.0-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/README.md +3 -3
- package/dist/cjs/functions-653e695c.js +6164 -0
- package/dist/cjs/{global-caec45e5.js → global-067b9f65.js} +65 -65
- package/dist/cjs/{http-service-9e8c4dd5.js → http-service-494d81de.js} +49 -49
- package/dist/cjs/{index-921ef454.js → index-cd179539.js} +157 -103
- package/dist/cjs/{interfaces-30a74c1f.js → interfaces-a3338581.js} +29 -29
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/priv-chart-popover.cjs.entry.js +79 -79
- package/dist/cjs/priv-datepicker.cjs.entry.js +668 -668
- package/dist/cjs/priv-navigator-button.cjs.entry.js +19 -19
- package/dist/cjs/priv-navigator-item.cjs.entry.js +24 -24
- package/dist/cjs/ripple.cjs.js +5 -5
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +342 -342
- package/dist/cjs/wm-button.cjs.entry.js +219 -219
- package/dist/cjs/wm-chart-slice.cjs.entry.js +14 -14
- package/dist/cjs/wm-chart.cjs.entry.js +475 -517
- package/dist/cjs/wm-datepicker.cjs.entry.js +257 -257
- package/dist/cjs/wm-input.cjs.entry.js +134 -134
- package/dist/cjs/wm-modal-footer.cjs.entry.js +32 -32
- package/dist/cjs/wm-modal-header.cjs.entry.js +35 -35
- package/dist/cjs/wm-modal.cjs.entry.js +162 -162
- package/dist/cjs/wm-navigator.cjs.entry.js +269 -269
- package/dist/cjs/wm-network-uploader.cjs.entry.js +421 -421
- package/dist/cjs/wm-option_2.cjs.entry.js +492 -492
- package/dist/cjs/wm-pagination.cjs.entry.js +168 -168
- package/dist/cjs/wm-search.cjs.entry.js +232 -232
- package/dist/cjs/wm-snackbar.cjs.entry.js +171 -171
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +301 -301
- package/dist/cjs/wm-tag-input.cjs.entry.js +557 -557
- package/dist/cjs/wm-timepicker.cjs.entry.js +384 -384
- package/dist/cjs/wm-toggletip.cjs.entry.js +125 -125
- package/dist/cjs/wm-uploader.cjs.entry.js +347 -347
- package/dist/cjs/wm-wrapper.cjs.entry.js +13 -13
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/wm-action-menu/wm-action-menu.js +460 -460
- package/dist/collection/components/wm-button/wm-button.js +485 -485
- package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.js +232 -232
- package/dist/collection/components/wm-chart/wm-chart-slice.js +64 -64
- package/dist/collection/components/wm-chart/wm-chart.css +59 -74
- package/dist/collection/components/wm-chart/wm-chart.js +717 -765
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1015 -1015
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +462 -462
- package/dist/collection/components/wm-input/wm-input.js +423 -423
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +444 -444
- package/dist/collection/components/wm-modal/wm-modal-footer.js +141 -141
- package/dist/collection/components/wm-modal/wm-modal-header.js +92 -92
- package/dist/collection/components/wm-modal/wm-modal.js +459 -459
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +97 -97
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +114 -114
- package/dist/collection/components/wm-navigator/wm-navigator.js +468 -468
- package/dist/collection/components/wm-option/wm-option.js +422 -422
- package/dist/collection/components/wm-pagination/wm-pagination.js +368 -368
- package/dist/collection/components/wm-search/wm-search.js +479 -479
- package/dist/collection/components/wm-select/wm-select.js +717 -717
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +297 -297
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +219 -219
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +331 -331
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -104
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +787 -787
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +589 -589
- package/dist/collection/components/wm-toggletip/wm-toggletip.js +241 -241
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +753 -753
- package/dist/collection/components/wm-uploader/wm-uploader.js +748 -748
- package/dist/collection/components/wm-wrapper/wm-wrapper.js +27 -27
- package/dist/collection/dev/scripts.js +20 -20
- package/dist/collection/global/__mocks__/functions.js +6 -6
- package/dist/collection/global/functions.js +445 -445
- package/dist/collection/global/global.js +72 -72
- package/dist/collection/global/interfaces.js +49 -49
- package/dist/collection/global/services/__mocks__/http-service.js +130 -130
- package/dist/collection/global/services/http-service.js +50 -50
- package/dist/collection/lang/lang.js +5 -5
- package/dist/collection/lang/piglatin.js +93 -93
- package/dist/esm/functions-e528c934.js +6144 -0
- package/dist/esm/{global-08ca269c.js → global-18fdd890.js} +65 -65
- package/dist/esm/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +49 -49
- package/dist/esm/{index-f8b130b6.js → index-66f8130e.js} +157 -103
- package/dist/esm/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +29 -29
- package/dist/esm/loader.js +3 -3
- 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 +2 -2
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/priv-chart-popover.entry.js +79 -79
- package/dist/esm/priv-datepicker.entry.js +668 -668
- package/dist/esm/priv-navigator-button.entry.js +19 -19
- package/dist/esm/priv-navigator-item.entry.js +24 -24
- package/dist/esm/ripple.js +5 -5
- package/dist/esm/wm-action-menu_2.entry.js +342 -342
- package/dist/esm/wm-button.entry.js +219 -219
- package/dist/esm/wm-chart-slice.entry.js +14 -14
- package/dist/esm/wm-chart.entry.js +475 -517
- package/dist/esm/wm-datepicker.entry.js +257 -257
- package/dist/esm/wm-input.entry.js +134 -134
- package/dist/esm/wm-modal-footer.entry.js +32 -32
- package/dist/esm/wm-modal-header.entry.js +35 -35
- package/dist/esm/wm-modal.entry.js +162 -162
- package/dist/esm/wm-navigator.entry.js +269 -269
- package/dist/esm/wm-network-uploader.entry.js +421 -421
- package/dist/esm/wm-option_2.entry.js +492 -492
- package/dist/esm/wm-pagination.entry.js +168 -168
- package/dist/esm/wm-search.entry.js +232 -232
- package/dist/esm/wm-snackbar.entry.js +171 -171
- package/dist/esm/wm-tab-item_3.entry.js +301 -301
- package/dist/esm/wm-tag-input.entry.js +557 -557
- package/dist/esm/wm-timepicker.entry.js +384 -384
- package/dist/esm/wm-toggletip.entry.js +125 -125
- package/dist/esm/wm-uploader.entry.js +347 -347
- package/dist/esm/wm-wrapper.entry.js +13 -13
- package/dist/ripple/p-092b01f3.entry.js +1 -0
- package/dist/ripple/{p-c995acbc.entry.js → p-0c58f50d.entry.js} +1 -1
- package/dist/ripple/p-11c09317.entry.js +1 -0
- package/dist/ripple/p-1e0c41a9.entry.js +1 -0
- package/dist/ripple/p-237a432a.entry.js +1 -0
- package/dist/ripple/p-3003d26d.entry.js +1 -0
- package/dist/ripple/p-33524565.entry.js +1 -0
- package/dist/ripple/{p-888bec42.js → p-43f1298b.js} +0 -0
- package/dist/ripple/{p-5e49aba7.entry.js → p-4cc71463.entry.js} +1 -1
- package/dist/ripple/p-588b4475.js +16 -0
- package/dist/ripple/p-65e3a656.entry.js +1 -0
- package/dist/ripple/p-8923b7d0.entry.js +1 -0
- package/dist/ripple/{p-d52033d5.entry.js → p-8b0eb05e.entry.js} +1 -1
- package/dist/ripple/p-8cd1396e.entry.js +1 -0
- package/dist/ripple/{p-22a1a636.entry.js → p-99db8501.entry.js} +1 -1
- package/dist/ripple/p-9baa3039.js +1 -0
- package/dist/ripple/p-aa973691.entry.js +1 -0
- package/dist/ripple/{p-a61977b2.entry.js → p-b3d5ea85.entry.js} +1 -1
- package/dist/ripple/{p-7d009793.entry.js → p-b5189f72.entry.js} +1 -1
- package/dist/ripple/p-b9838664.js +1 -0
- package/dist/ripple/p-bc27b604.entry.js +1 -0
- package/dist/ripple/p-bc9ca97b.entry.js +1 -0
- package/dist/ripple/{p-bba99fcd.entry.js → p-cd58a15c.entry.js} +1 -1
- package/dist/ripple/p-dc9c9fda.entry.js +1 -0
- package/dist/ripple/p-e7616311.entry.js +1 -0
- package/dist/ripple/p-e9e8334e.entry.js +1 -0
- package/dist/ripple/p-ec9697db.entry.js +1 -0
- package/dist/ripple/p-efdaf3b6.entry.js +1 -0
- package/dist/ripple/p-fcdc6395.entry.js +1 -0
- package/dist/ripple/{p-a6d6eae7.js → p-fd8070fb.js} +0 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +48 -48
- package/dist/types/components/wm-button/wm-button.d.ts +44 -44
- package/dist/types/components/wm-chart/priv-chart-popover/priv-chart-popover.d.ts +23 -23
- package/dist/types/components/wm-chart/wm-chart-slice.d.ts +8 -8
- package/dist/types/components/wm-chart/wm-chart.d.ts +81 -80
- package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +76 -76
- package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +41 -41
- package/dist/types/components/wm-input/wm-input.d.ts +46 -46
- package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
- package/dist/types/components/wm-modal/wm-modal-footer.d.ts +15 -15
- package/dist/types/components/wm-modal/wm-modal-header.d.ts +12 -12
- package/dist/types/components/wm-modal/wm-modal.d.ts +41 -41
- package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
- package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
- package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
- package/dist/types/components/wm-option/wm-option.d.ts +32 -32
- package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
- package/dist/types/components/wm-search/wm-search.d.ts +86 -86
- package/dist/types/components/wm-select/wm-select.d.ts +66 -66
- package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +35 -35
- package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +38 -38
- package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +53 -53
- package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
- package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +91 -91
- package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +62 -62
- package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +27 -27
- package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
- package/dist/types/components/wm-uploader/wm-uploader.d.ts +80 -80
- package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
- package/dist/types/components.d.ts +24 -24
- package/dist/types/global/__mocks__/functions.d.ts +6 -6
- package/dist/types/global/functions.d.ts +40 -0
- package/dist/types/global/global.d.ts +1 -1
- package/dist/types/global/interfaces.d.ts +34 -34
- package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
- package/dist/types/global/services/http-service.d.ts +4 -4
- package/dist/types/lang/lang.d.ts +5 -5
- package/dist/types/stencil-public-runtime.d.ts +194 -186
- package/package.json +46 -46
- package/dist/cjs/functions-a6491ba8.js +0 -7943
- package/dist/esm/functions-5aebd578.js +0 -7923
- package/dist/ripple/p-0865e7cf.js +0 -16
- package/dist/ripple/p-0f663e59.entry.js +0 -1
- package/dist/ripple/p-1b790a7d.entry.js +0 -1
- package/dist/ripple/p-3b4c01b8.entry.js +0 -1
- package/dist/ripple/p-54c1f704.entry.js +0 -1
- package/dist/ripple/p-76c615e9.entry.js +0 -1
- package/dist/ripple/p-7d993d52.js +0 -1
- package/dist/ripple/p-8198cc9c.entry.js +0 -1
- package/dist/ripple/p-839d35bd.entry.js +0 -1
- package/dist/ripple/p-8708b8cb.entry.js +0 -1
- package/dist/ripple/p-8bd66955.entry.js +0 -1
- package/dist/ripple/p-957e3a05.entry.js +0 -1
- package/dist/ripple/p-af6eb4d5.entry.js +0 -1
- package/dist/ripple/p-b3f9f575.entry.js +0 -1
- package/dist/ripple/p-cd30198d.entry.js +0 -1
- package/dist/ripple/p-d9d6bf11.js +0 -1
- package/dist/ripple/p-e097c562.entry.js +0 -1
- package/dist/ripple/p-e9db6122.entry.js +0 -1
- package/dist/ripple/p-eabbd1e9.entry.js +0 -1
- package/dist/ripple/p-ec496b8b.entry.js +0 -1
- package/dist/ripple/p-fc8ec142.entry.js +0 -1
|
@@ -9,26 +9,26 @@ const doc = win.document || { head: {} };
|
|
|
9
9
|
const plt = {
|
|
10
10
|
$flags$: 0,
|
|
11
11
|
$resourcesUrl$: '',
|
|
12
|
-
jmp: h => h(),
|
|
13
|
-
raf: h => requestAnimationFrame(h),
|
|
12
|
+
jmp: (h) => h(),
|
|
13
|
+
raf: (h) => requestAnimationFrame(h),
|
|
14
14
|
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
15
15
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
16
16
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
17
17
|
};
|
|
18
18
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
19
|
-
const supportsConstructibleStylesheets =
|
|
19
|
+
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
20
20
|
try {
|
|
21
21
|
new CSSStyleSheet();
|
|
22
|
-
return
|
|
22
|
+
return typeof new CSSStyleSheet().replace === 'function';
|
|
23
23
|
}
|
|
24
24
|
catch (e) { }
|
|
25
25
|
return false;
|
|
26
26
|
})()
|
|
27
27
|
;
|
|
28
28
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
29
|
-
if (
|
|
29
|
+
if (listeners) {
|
|
30
30
|
listeners.map(([flags, name, method]) => {
|
|
31
|
-
const target =
|
|
31
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
32
32
|
const handler = hostListenerProxy(hostRef, method);
|
|
33
33
|
const opts = hostListenerOpts(flags);
|
|
34
34
|
plt.ael(target, name, handler, opts);
|
|
@@ -53,14 +53,14 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
const getHostListenerTarget = (elm, flags) => {
|
|
56
|
-
if (
|
|
56
|
+
if (flags & 4 /* TargetDocument */)
|
|
57
57
|
return doc;
|
|
58
|
-
if (
|
|
58
|
+
if (flags & 8 /* TargetWindow */)
|
|
59
59
|
return win;
|
|
60
60
|
return elm;
|
|
61
61
|
};
|
|
62
62
|
// prettier-ignore
|
|
63
|
-
const hostListenerOpts = (flags) =>
|
|
63
|
+
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
64
64
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
65
65
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
66
66
|
const createTime = (fnName, tagName = '') => {
|
|
@@ -116,7 +116,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
else if (
|
|
119
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
120
120
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -127,8 +127,8 @@ const attachStyles = (hostRef) => {
|
|
|
127
127
|
const elm = hostRef.$hostElement$;
|
|
128
128
|
const flags = cmpMeta.$flags$;
|
|
129
129
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
130
|
-
const scopeId = addStyle(
|
|
131
|
-
if (
|
|
130
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
131
|
+
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
132
132
|
// only required when we're NOT using native shadow dom (slot)
|
|
133
133
|
// or this browser doesn't support native shadow dom
|
|
134
134
|
// and this host element was NOT created with SSR
|
|
@@ -141,7 +141,7 @@ const attachStyles = (hostRef) => {
|
|
|
141
141
|
}
|
|
142
142
|
endAttachStyles();
|
|
143
143
|
};
|
|
144
|
-
const getScopeId = (cmp, mode) => 'sc-' + (
|
|
144
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
145
145
|
/**
|
|
146
146
|
* Default style mode id
|
|
147
147
|
*/
|
|
@@ -203,7 +203,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
203
203
|
walk(children);
|
|
204
204
|
if (vnodeData) {
|
|
205
205
|
// normalize class / classname attributes
|
|
206
|
-
if (
|
|
206
|
+
if (vnodeData.key) {
|
|
207
207
|
key = vnodeData.key;
|
|
208
208
|
}
|
|
209
209
|
{
|
|
@@ -213,7 +213,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
213
213
|
typeof classData !== 'object'
|
|
214
214
|
? classData
|
|
215
215
|
: Object.keys(classData)
|
|
216
|
-
.filter(k => classData[k])
|
|
216
|
+
.filter((k) => classData[k])
|
|
217
217
|
.join(' ');
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -258,19 +258,19 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
258
258
|
if (oldValue !== newValue) {
|
|
259
259
|
let isProp = isMemberInElement(elm, memberName);
|
|
260
260
|
let ln = memberName.toLowerCase();
|
|
261
|
-
if (
|
|
261
|
+
if (memberName === 'class') {
|
|
262
262
|
const classList = elm.classList;
|
|
263
263
|
const oldClasses = parseClassList(oldValue);
|
|
264
264
|
const newClasses = parseClassList(newValue);
|
|
265
|
-
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
|
|
266
|
-
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
|
|
265
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
266
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
267
267
|
}
|
|
268
|
-
else if (
|
|
268
|
+
else if (memberName === 'style') {
|
|
269
269
|
// update style attribute, css properties and values
|
|
270
270
|
{
|
|
271
271
|
for (const prop in oldValue) {
|
|
272
272
|
if (!newValue || newValue[prop] == null) {
|
|
273
|
-
if (
|
|
273
|
+
if (prop.includes('-')) {
|
|
274
274
|
elm.style.removeProperty(prop);
|
|
275
275
|
}
|
|
276
276
|
else {
|
|
@@ -281,7 +281,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
281
281
|
}
|
|
282
282
|
for (const prop in newValue) {
|
|
283
283
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
284
|
-
if (
|
|
284
|
+
if (prop.includes('-')) {
|
|
285
285
|
elm.style.setProperty(prop, newValue[prop]);
|
|
286
286
|
}
|
|
287
287
|
else {
|
|
@@ -290,15 +290,17 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
else if (
|
|
293
|
+
else if (memberName === 'key')
|
|
294
294
|
;
|
|
295
|
-
else if (
|
|
295
|
+
else if (memberName === 'ref') {
|
|
296
296
|
// minifier will clean this up
|
|
297
297
|
if (newValue) {
|
|
298
298
|
newValue(elm);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
else if (
|
|
301
|
+
else if ((!isProp ) &&
|
|
302
|
+
memberName[0] === 'o' &&
|
|
303
|
+
memberName[1] === 'n') {
|
|
302
304
|
// Event Handlers
|
|
303
305
|
// so if the member name starts with "on" and the 3rd characters is
|
|
304
306
|
// a capital letter, and it's not already a member on the element,
|
|
@@ -373,7 +375,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
373
375
|
}
|
|
374
376
|
if (newValue == null || newValue === false) {
|
|
375
377
|
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
376
|
-
if (
|
|
378
|
+
if (xlink) {
|
|
377
379
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
378
380
|
}
|
|
379
381
|
else {
|
|
@@ -383,7 +385,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
383
385
|
}
|
|
384
386
|
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
385
387
|
newValue = newValue === true ? '' : newValue;
|
|
386
|
-
if (
|
|
388
|
+
if (xlink) {
|
|
387
389
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
388
390
|
}
|
|
389
391
|
else {
|
|
@@ -399,7 +401,9 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
399
401
|
// if the element passed in is a shadow root, which is a document fragment
|
|
400
402
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
401
403
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
402
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
404
|
+
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
405
|
+
? newVnode.$elm$.host
|
|
406
|
+
: newVnode.$elm$;
|
|
403
407
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
404
408
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
405
409
|
{
|
|
@@ -421,25 +425,25 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
421
425
|
let i = 0;
|
|
422
426
|
let elm;
|
|
423
427
|
let childNode;
|
|
424
|
-
if (
|
|
428
|
+
if (newVNode.$text$ !== null) {
|
|
425
429
|
// create text node
|
|
426
430
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
427
431
|
}
|
|
428
432
|
else {
|
|
429
|
-
if (
|
|
433
|
+
if (!isSvgMode) {
|
|
430
434
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
431
435
|
}
|
|
432
436
|
// create element
|
|
433
|
-
elm = newVNode.$elm$ = (
|
|
437
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
|
|
434
438
|
);
|
|
435
|
-
if (
|
|
439
|
+
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
436
440
|
isSvgMode = false;
|
|
437
441
|
}
|
|
438
442
|
// add css classes, attrs, props, listeners, etc.
|
|
439
443
|
{
|
|
440
444
|
updateElement(null, newVNode, isSvgMode);
|
|
441
445
|
}
|
|
442
|
-
if (
|
|
446
|
+
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
443
447
|
// if there is a scopeId and this is the initial render
|
|
444
448
|
// then let's add the scopeId as a css class
|
|
445
449
|
elm.classList.add((elm['s-si'] = scopeId));
|
|
@@ -469,9 +473,9 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
469
473
|
return elm;
|
|
470
474
|
};
|
|
471
475
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
472
|
-
let containerElm = (
|
|
476
|
+
let containerElm = (parentElm);
|
|
473
477
|
let childNode;
|
|
474
|
-
if (
|
|
478
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
475
479
|
containerElm = containerElm.shadowRoot;
|
|
476
480
|
}
|
|
477
481
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
@@ -479,7 +483,7 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
479
483
|
childNode = createElm(null, parentVNode, startIdx);
|
|
480
484
|
if (childNode) {
|
|
481
485
|
vnodes[startIdx].$elm$ = childNode;
|
|
482
|
-
containerElm.insertBefore(childNode,
|
|
486
|
+
containerElm.insertBefore(childNode, before);
|
|
483
487
|
}
|
|
484
488
|
}
|
|
485
489
|
}
|
|
@@ -554,7 +558,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
554
558
|
}
|
|
555
559
|
}
|
|
556
560
|
}
|
|
557
|
-
if (
|
|
561
|
+
if (idxInOld >= 0) {
|
|
558
562
|
elmToMove = oldCh[idxInOld];
|
|
559
563
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
560
564
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
@@ -581,7 +585,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
581
585
|
if (oldStartIdx > oldEndIdx) {
|
|
582
586
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
583
587
|
}
|
|
584
|
-
else if (
|
|
588
|
+
else if (newStartIdx > newEndIdx) {
|
|
585
589
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
586
590
|
}
|
|
587
591
|
};
|
|
@@ -601,7 +605,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
601
605
|
const newChildren = newVNode.$children$;
|
|
602
606
|
const tag = newVNode.$tag$;
|
|
603
607
|
const text = newVNode.$text$;
|
|
604
|
-
if (
|
|
608
|
+
if (text === null) {
|
|
605
609
|
{
|
|
606
610
|
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
607
611
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
@@ -609,7 +613,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
609
613
|
}
|
|
610
614
|
// element node
|
|
611
615
|
{
|
|
612
|
-
if (
|
|
616
|
+
if (tag === 'slot')
|
|
613
617
|
;
|
|
614
618
|
else {
|
|
615
619
|
// either this is the first render of an element OR it's an update
|
|
@@ -618,28 +622,28 @@ const patch = (oldVNode, newVNode) => {
|
|
|
618
622
|
updateElement(oldVNode, newVNode, isSvgMode);
|
|
619
623
|
}
|
|
620
624
|
}
|
|
621
|
-
if (
|
|
625
|
+
if (oldChildren !== null && newChildren !== null) {
|
|
622
626
|
// looks like there's child vnodes for both the old and new vnodes
|
|
623
627
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
624
628
|
}
|
|
625
629
|
else if (newChildren !== null) {
|
|
626
630
|
// no old child vnodes, but there are new child vnodes to add
|
|
627
|
-
if (
|
|
631
|
+
if (oldVNode.$text$ !== null) {
|
|
628
632
|
// the old vnode was text, so be sure to clear it out
|
|
629
633
|
elm.textContent = '';
|
|
630
634
|
}
|
|
631
635
|
// add the new vnode children
|
|
632
636
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
633
637
|
}
|
|
634
|
-
else if (
|
|
638
|
+
else if (oldChildren !== null) {
|
|
635
639
|
// no new child vnodes, but there are old child vnodes to remove
|
|
636
640
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
637
641
|
}
|
|
638
|
-
if (
|
|
642
|
+
if (isSvgMode && tag === 'svg') {
|
|
639
643
|
isSvgMode = false;
|
|
640
644
|
}
|
|
641
645
|
}
|
|
642
|
-
else if (
|
|
646
|
+
else if (oldVNode.$text$ !== text) {
|
|
643
647
|
// update the text content for the text only vnode
|
|
644
648
|
// and also only if the text is different than before
|
|
645
649
|
elm.data = text;
|
|
@@ -657,21 +661,21 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
657
661
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
658
662
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
659
663
|
hostTagName = hostElm.tagName;
|
|
660
|
-
if (
|
|
664
|
+
if (cmpMeta.$attrsToReflect$) {
|
|
661
665
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
662
666
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
663
667
|
}
|
|
664
668
|
rootVnode.$tag$ = null;
|
|
665
669
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
666
670
|
hostRef.$vnode$ = rootVnode;
|
|
667
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (
|
|
671
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
668
672
|
{
|
|
669
673
|
scopeId = hostElm['s-sc'];
|
|
670
674
|
}
|
|
671
675
|
// synchronous patch
|
|
672
676
|
patch(oldVNode, rootVnode);
|
|
673
677
|
};
|
|
674
|
-
const getElement = (ref) => (
|
|
678
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
675
679
|
const createEvent = (ref, name, flags) => {
|
|
676
680
|
const elm = getElement(ref);
|
|
677
681
|
return {
|
|
@@ -685,21 +689,28 @@ const createEvent = (ref, name, flags) => {
|
|
|
685
689
|
},
|
|
686
690
|
};
|
|
687
691
|
};
|
|
692
|
+
/**
|
|
693
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
694
|
+
* @param elm the target of the Event
|
|
695
|
+
* @param name the name to give the custom Event
|
|
696
|
+
* @param opts options for configuring a custom Event
|
|
697
|
+
* @returns the custom Event
|
|
698
|
+
*/
|
|
688
699
|
const emitEvent = (elm, name, opts) => {
|
|
689
700
|
const ev = plt.ce(name, opts);
|
|
690
701
|
elm.dispatchEvent(ev);
|
|
691
702
|
return ev;
|
|
692
703
|
};
|
|
693
704
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
694
|
-
if (
|
|
695
|
-
ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
|
|
705
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
706
|
+
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
696
707
|
}
|
|
697
708
|
};
|
|
698
709
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
699
710
|
{
|
|
700
711
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
701
712
|
}
|
|
702
|
-
if (
|
|
713
|
+
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
703
714
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
704
715
|
return;
|
|
705
716
|
}
|
|
@@ -708,11 +719,11 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
708
719
|
// has already fired off its lifecycle update then
|
|
709
720
|
// fire off the initial update
|
|
710
721
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
711
|
-
return
|
|
722
|
+
return writeTask(dispatch) ;
|
|
712
723
|
};
|
|
713
724
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
714
725
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
715
|
-
const instance =
|
|
726
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
716
727
|
let promise;
|
|
717
728
|
if (isInitialLoad) {
|
|
718
729
|
{
|
|
@@ -734,26 +745,19 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
734
745
|
const elm = hostRef.$hostElement$;
|
|
735
746
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
736
747
|
const rc = elm['s-rc'];
|
|
737
|
-
if (
|
|
748
|
+
if (isInitialLoad) {
|
|
738
749
|
// DOM WRITE!
|
|
739
750
|
attachStyles(hostRef);
|
|
740
751
|
}
|
|
741
752
|
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
742
753
|
{
|
|
743
|
-
|
|
744
|
-
// looks like we've got child nodes to render into this host element
|
|
745
|
-
// or we need to update the css class/attrs on the host element
|
|
746
|
-
// DOM WRITE!
|
|
747
|
-
{
|
|
748
|
-
renderVdom(hostRef, callRender(hostRef, instance));
|
|
749
|
-
}
|
|
750
|
-
}
|
|
754
|
+
callRender(hostRef, instance);
|
|
751
755
|
}
|
|
752
|
-
if (
|
|
756
|
+
if (rc) {
|
|
753
757
|
// ok, so turns out there are some child host elements
|
|
754
758
|
// waiting on this parent element to load
|
|
755
759
|
// let's fire off all update callbacks waiting
|
|
756
|
-
rc.map(cb => cb());
|
|
760
|
+
rc.map((cb) => cb());
|
|
757
761
|
elm['s-rc'] = undefined;
|
|
758
762
|
}
|
|
759
763
|
endRender();
|
|
@@ -771,26 +775,36 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
771
775
|
}
|
|
772
776
|
}
|
|
773
777
|
};
|
|
774
|
-
const callRender = (hostRef, instance) => {
|
|
778
|
+
const callRender = (hostRef, instance, elm) => {
|
|
775
779
|
try {
|
|
776
|
-
instance =
|
|
780
|
+
instance = instance.render && instance.render();
|
|
777
781
|
{
|
|
778
782
|
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
779
783
|
}
|
|
780
784
|
{
|
|
781
785
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
782
786
|
}
|
|
787
|
+
{
|
|
788
|
+
{
|
|
789
|
+
// looks like we've got child nodes to render into this host element
|
|
790
|
+
// or we need to update the css class/attrs on the host element
|
|
791
|
+
// DOM WRITE!
|
|
792
|
+
{
|
|
793
|
+
renderVdom(hostRef, instance);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
783
797
|
}
|
|
784
798
|
catch (e) {
|
|
785
799
|
consoleError(e, hostRef.$hostElement$);
|
|
786
800
|
}
|
|
787
|
-
return
|
|
801
|
+
return null;
|
|
788
802
|
};
|
|
789
803
|
const postUpdateComponent = (hostRef) => {
|
|
790
804
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
791
805
|
const elm = hostRef.$hostElement$;
|
|
792
806
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
793
|
-
const instance =
|
|
807
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
794
808
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
795
809
|
{
|
|
796
810
|
safeCall(instance, 'componentDidRender');
|
|
@@ -841,7 +855,8 @@ const forceUpdate = (ref) => {
|
|
|
841
855
|
{
|
|
842
856
|
const hostRef = getHostRef(ref);
|
|
843
857
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
844
|
-
if (isConnected &&
|
|
858
|
+
if (isConnected &&
|
|
859
|
+
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
845
860
|
scheduleUpdate(hostRef, false);
|
|
846
861
|
}
|
|
847
862
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -870,20 +885,21 @@ const safeCall = (instance, method, arg) => {
|
|
|
870
885
|
const then = (promise, thenFn) => {
|
|
871
886
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
872
887
|
};
|
|
873
|
-
const addHydratedFlag = (elm) =>
|
|
888
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
889
|
+
;
|
|
874
890
|
const parsePropertyValue = (propValue, propType) => {
|
|
875
891
|
// ensure this value is of the correct prop type
|
|
876
892
|
if (propValue != null && !isComplexType(propValue)) {
|
|
877
|
-
if (
|
|
893
|
+
if (propType & 4 /* Boolean */) {
|
|
878
894
|
// per the HTML spec, any string value means it is a boolean true value
|
|
879
895
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
880
896
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
881
897
|
}
|
|
882
|
-
if (
|
|
898
|
+
if (propType & 2 /* Number */) {
|
|
883
899
|
// force it to be a number
|
|
884
900
|
return parseFloat(propValue);
|
|
885
901
|
}
|
|
886
|
-
if (
|
|
902
|
+
if (propType & 1 /* String */) {
|
|
887
903
|
// could have been passed as a number or boolean
|
|
888
904
|
// but we still want it as a string
|
|
889
905
|
return String(propValue);
|
|
@@ -899,22 +915,22 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
899
915
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
900
916
|
// check our new property value against our internal value
|
|
901
917
|
const hostRef = getHostRef(ref);
|
|
902
|
-
const elm =
|
|
918
|
+
const elm = hostRef.$hostElement$ ;
|
|
903
919
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
904
920
|
const flags = hostRef.$flags$;
|
|
905
|
-
const instance =
|
|
921
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
906
922
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
907
|
-
if ((
|
|
923
|
+
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
|
|
908
924
|
// gadzooks! the property's value has changed!!
|
|
909
925
|
// set our new value!
|
|
910
926
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
911
|
-
if (
|
|
927
|
+
if (instance) {
|
|
912
928
|
// get an array of method names of watch functions to call
|
|
913
|
-
if (
|
|
929
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
914
930
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
915
931
|
if (watchMethods) {
|
|
916
932
|
// this instance is watching for when this property changed
|
|
917
|
-
watchMethods.map(watchMethodName => {
|
|
933
|
+
watchMethods.map((watchMethodName) => {
|
|
918
934
|
try {
|
|
919
935
|
// fire off each of the watch methods that are watching this property
|
|
920
936
|
instance[watchMethodName](newVal, oldVal, propName);
|
|
@@ -925,7 +941,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
925
941
|
});
|
|
926
942
|
}
|
|
927
943
|
}
|
|
928
|
-
if (
|
|
944
|
+
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
929
945
|
// looks like this value actually changed, so we've got work to do!
|
|
930
946
|
// but only if we've already rendered, otherwise just chill out
|
|
931
947
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -936,15 +952,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
936
952
|
}
|
|
937
953
|
};
|
|
938
954
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
939
|
-
if (
|
|
940
|
-
if (
|
|
955
|
+
if (cmpMeta.$members$) {
|
|
956
|
+
if (Cstr.watchers) {
|
|
941
957
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
942
958
|
}
|
|
943
959
|
// It's better to have a const than two Object.entries()
|
|
944
960
|
const members = Object.entries(cmpMeta.$members$);
|
|
945
961
|
const prototype = Cstr.prototype;
|
|
946
962
|
members.map(([memberName, [memberFlags]]) => {
|
|
947
|
-
if (
|
|
963
|
+
if ((memberFlags & 31 /* Prop */ ||
|
|
964
|
+
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
948
965
|
// proxyComponent - prop
|
|
949
966
|
Object.defineProperty(prototype, memberName, {
|
|
950
967
|
get() {
|
|
@@ -959,7 +976,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
959
976
|
enumerable: true,
|
|
960
977
|
});
|
|
961
978
|
}
|
|
962
|
-
else if (
|
|
979
|
+
else if (flags & 1 /* isElementConstructor */ &&
|
|
980
|
+
memberFlags & 64 /* Method */) {
|
|
963
981
|
// proxyComponent - method
|
|
964
982
|
Object.defineProperty(prototype, memberName, {
|
|
965
983
|
value(...args) {
|
|
@@ -969,11 +987,48 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
969
987
|
});
|
|
970
988
|
}
|
|
971
989
|
});
|
|
972
|
-
if (
|
|
990
|
+
if ((flags & 1 /* isElementConstructor */)) {
|
|
973
991
|
const attrNameToPropName = new Map();
|
|
974
992
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
975
993
|
plt.jmp(() => {
|
|
976
994
|
const propName = attrNameToPropName.get(attrName);
|
|
995
|
+
// In a webcomponent lifecyle the attributeChangedCallback runs prior to connectedCallback
|
|
996
|
+
// in the case where an attribute was set inline.
|
|
997
|
+
// ```html
|
|
998
|
+
// <my-component some-attribute="some-value"></my-component>
|
|
999
|
+
// ```
|
|
1000
|
+
//
|
|
1001
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then programatically
|
|
1002
|
+
// changes it before it has been upgraded as shown below:
|
|
1003
|
+
//
|
|
1004
|
+
// ```html
|
|
1005
|
+
// <!-- this component has _not_ been upgraded yet -->
|
|
1006
|
+
// <my-component id="test" some-attribute="some-value"></my-component>
|
|
1007
|
+
// <script>
|
|
1008
|
+
// // grab non-upgraded component
|
|
1009
|
+
// el = document.querySelector("#test");
|
|
1010
|
+
// el.someAttribute = "another-value";
|
|
1011
|
+
// // upgrade component
|
|
1012
|
+
// cutsomElements.define('my-component', MyComponent);
|
|
1013
|
+
// </script>
|
|
1014
|
+
// ```
|
|
1015
|
+
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
|
|
1016
|
+
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
1017
|
+
// to the value that was set inline i.e. "some-value" from above example. When
|
|
1018
|
+
// the connectedCallback attempts to unshadow it will use "some-value" as the intial value rather than "another-value"
|
|
1019
|
+
//
|
|
1020
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
|
|
1021
|
+
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
1022
|
+
//
|
|
1023
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1024
|
+
//
|
|
1025
|
+
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
|
1026
|
+
// properties here given that this goes against best practices outlined here
|
|
1027
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
|
1028
|
+
if (this.hasOwnProperty(propName)) {
|
|
1029
|
+
newValue = this[propName];
|
|
1030
|
+
delete this[propName];
|
|
1031
|
+
}
|
|
977
1032
|
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
|
978
1033
|
});
|
|
979
1034
|
};
|
|
@@ -984,7 +1039,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
984
1039
|
.map(([propName, m]) => {
|
|
985
1040
|
const attrName = m[1] || propName;
|
|
986
1041
|
attrNameToPropName.set(attrName, propName);
|
|
987
|
-
if (
|
|
1042
|
+
if (m[0] & 512 /* ReflectAttr */) {
|
|
988
1043
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
989
1044
|
}
|
|
990
1045
|
return attrName;
|
|
@@ -995,7 +1050,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
995
1050
|
};
|
|
996
1051
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
997
1052
|
// initializeComponent
|
|
998
|
-
if (
|
|
1053
|
+
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
999
1054
|
{
|
|
1000
1055
|
// we haven't initialized this element yet
|
|
1001
1056
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
@@ -1009,8 +1064,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1009
1064
|
Cstr = await Cstr;
|
|
1010
1065
|
endLoad();
|
|
1011
1066
|
}
|
|
1012
|
-
if (
|
|
1013
|
-
// we'
|
|
1067
|
+
if (!Cstr.isProxied) {
|
|
1068
|
+
// we've never proxied this Constructor before
|
|
1014
1069
|
// let's add the getters/setters to its prototype before
|
|
1015
1070
|
// the first time we create an instance of the implementation
|
|
1016
1071
|
{
|
|
@@ -1044,7 +1099,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1044
1099
|
}
|
|
1045
1100
|
endNewInstance();
|
|
1046
1101
|
}
|
|
1047
|
-
if (
|
|
1102
|
+
if (Cstr.style) {
|
|
1048
1103
|
// this component has styles but we haven't registered them yet
|
|
1049
1104
|
let style = Cstr.style;
|
|
1050
1105
|
const scopeId = getScopeId(cmpMeta);
|
|
@@ -1058,7 +1113,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1058
1113
|
// we've successfully created a lazy instance
|
|
1059
1114
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1060
1115
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
1061
|
-
if (
|
|
1116
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
1062
1117
|
// this is the intial load and this component it has an ancestor component
|
|
1063
1118
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
1064
1119
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
@@ -1086,8 +1141,7 @@ const connectedCallback = (elm) => {
|
|
|
1086
1141
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1087
1142
|
// climb up the ancestors looking for the first
|
|
1088
1143
|
// component that hasn't finished its lifecycle update yet
|
|
1089
|
-
if (
|
|
1090
|
-
ancestorComponent['s-p']) {
|
|
1144
|
+
if (ancestorComponent['s-p']) {
|
|
1091
1145
|
// we found this components first ancestor component
|
|
1092
1146
|
// keep a reference to this component's ancestor component
|
|
1093
1147
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -1097,7 +1151,7 @@ const connectedCallback = (elm) => {
|
|
|
1097
1151
|
}
|
|
1098
1152
|
// Lazy properties
|
|
1099
1153
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1100
|
-
if (
|
|
1154
|
+
if (cmpMeta.$members$) {
|
|
1101
1155
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1102
1156
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1103
1157
|
const value = elm[memberName];
|
|
@@ -1124,7 +1178,7 @@ const disconnectedCallback = (elm) => {
|
|
|
1124
1178
|
const hostRef = getHostRef(elm);
|
|
1125
1179
|
{
|
|
1126
1180
|
if (hostRef.$rmListeners$) {
|
|
1127
|
-
hostRef.$rmListeners$.map(rmListener => rmListener());
|
|
1181
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1128
1182
|
hostRef.$rmListeners$ = undefined;
|
|
1129
1183
|
}
|
|
1130
1184
|
}
|
|
@@ -1143,7 +1197,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1143
1197
|
let isBootstrapping = true;
|
|
1144
1198
|
Object.assign(plt, options);
|
|
1145
1199
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1146
|
-
lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
|
|
1200
|
+
lazyBundles.map((lazyBundle) => lazyBundle[1].map((compactMeta) => {
|
|
1147
1201
|
const cmpMeta = {
|
|
1148
1202
|
$flags$: compactMeta[0],
|
|
1149
1203
|
$tagName$: compactMeta[1],
|
|
@@ -1162,7 +1216,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1162
1216
|
{
|
|
1163
1217
|
cmpMeta.$watchers$ = {};
|
|
1164
1218
|
}
|
|
1165
|
-
const tagName =
|
|
1219
|
+
const tagName = cmpMeta.$tagName$;
|
|
1166
1220
|
const HostElement = class extends HTMLElement {
|
|
1167
1221
|
// StencilLazyHost
|
|
1168
1222
|
constructor(self) {
|
|
@@ -1170,7 +1224,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1170
1224
|
super(self);
|
|
1171
1225
|
self = this;
|
|
1172
1226
|
registerHost(self, cmpMeta);
|
|
1173
|
-
if (
|
|
1227
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1174
1228
|
// this component is using shadow dom
|
|
1175
1229
|
// and this browser supports shadow dom
|
|
1176
1230
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1216,7 +1270,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1216
1270
|
// Process deferred connectedCallbacks now all components have been registered
|
|
1217
1271
|
isBootstrapping = false;
|
|
1218
1272
|
if (deferredConnectedCallbacks.length) {
|
|
1219
|
-
deferredConnectedCallbacks.map(host => host.connectedCallback());
|
|
1273
|
+
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
1220
1274
|
}
|
|
1221
1275
|
else {
|
|
1222
1276
|
{
|
|
@@ -1237,10 +1291,10 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1237
1291
|
$instanceValues$: new Map(),
|
|
1238
1292
|
};
|
|
1239
1293
|
{
|
|
1240
|
-
hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
|
|
1294
|
+
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
|
1241
1295
|
}
|
|
1242
1296
|
{
|
|
1243
|
-
hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
|
|
1297
|
+
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
1244
1298
|
elm['s-p'] = [];
|
|
1245
1299
|
elm['s-rc'] = [];
|
|
1246
1300
|
}
|
|
@@ -1248,13 +1302,13 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1248
1302
|
return hostRefs.set(elm, hostRef);
|
|
1249
1303
|
};
|
|
1250
1304
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
1251
|
-
const consoleError = (e, el) => (
|
|
1305
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
1252
1306
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
1253
1307
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
1254
1308
|
// loadModuleImport
|
|
1255
1309
|
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
|
1256
1310
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
1257
|
-
const module =
|
|
1311
|
+
const module = cmpModules.get(bundleId) ;
|
|
1258
1312
|
if (module) {
|
|
1259
1313
|
return module[exportName];
|
|
1260
1314
|
}
|
|
@@ -1262,7 +1316,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1262
1316
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1263
1317
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1264
1318
|
/* webpackMode: "lazy" */
|
|
1265
|
-
`./${bundleId}.entry.js${
|
|
1319
|
+
`./${bundleId}.entry.js${''}`).then((importedModule) => {
|
|
1266
1320
|
{
|
|
1267
1321
|
cmpModules.set(bundleId, importedModule);
|
|
1268
1322
|
}
|