@watermarkinsights/ripple 3.4.0 → 3.5.0-3
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-ee710089.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 +71 -84
- package/dist/collection/components/wm-chart/wm-chart.js +718 -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-b94f59e6.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-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-7a96bb97.js +1 -0
- package/dist/ripple/p-83b8aaaf.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-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
|
@@ -31,26 +31,26 @@ const doc = win.document || { head: {} };
|
|
|
31
31
|
const plt = {
|
|
32
32
|
$flags$: 0,
|
|
33
33
|
$resourcesUrl$: '',
|
|
34
|
-
jmp: h => h(),
|
|
35
|
-
raf: h => requestAnimationFrame(h),
|
|
34
|
+
jmp: (h) => h(),
|
|
35
|
+
raf: (h) => requestAnimationFrame(h),
|
|
36
36
|
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
37
37
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
38
38
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
39
39
|
};
|
|
40
40
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
41
|
-
const supportsConstructibleStylesheets =
|
|
41
|
+
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
42
42
|
try {
|
|
43
43
|
new CSSStyleSheet();
|
|
44
|
-
return
|
|
44
|
+
return typeof new CSSStyleSheet().replace === 'function';
|
|
45
45
|
}
|
|
46
46
|
catch (e) { }
|
|
47
47
|
return false;
|
|
48
48
|
})()
|
|
49
49
|
;
|
|
50
50
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
51
|
-
if (
|
|
51
|
+
if (listeners) {
|
|
52
52
|
listeners.map(([flags, name, method]) => {
|
|
53
|
-
const target =
|
|
53
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
54
54
|
const handler = hostListenerProxy(hostRef, method);
|
|
55
55
|
const opts = hostListenerOpts(flags);
|
|
56
56
|
plt.ael(target, name, handler, opts);
|
|
@@ -75,14 +75,14 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
const getHostListenerTarget = (elm, flags) => {
|
|
78
|
-
if (
|
|
78
|
+
if (flags & 4 /* TargetDocument */)
|
|
79
79
|
return doc;
|
|
80
|
-
if (
|
|
80
|
+
if (flags & 8 /* TargetWindow */)
|
|
81
81
|
return win;
|
|
82
82
|
return elm;
|
|
83
83
|
};
|
|
84
84
|
// prettier-ignore
|
|
85
|
-
const hostListenerOpts = (flags) =>
|
|
85
|
+
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
86
86
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
87
87
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
88
88
|
const createTime = (fnName, tagName = '') => {
|
|
@@ -138,7 +138,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
else if (
|
|
141
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
142
142
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -149,8 +149,8 @@ const attachStyles = (hostRef) => {
|
|
|
149
149
|
const elm = hostRef.$hostElement$;
|
|
150
150
|
const flags = cmpMeta.$flags$;
|
|
151
151
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
152
|
-
const scopeId = addStyle(
|
|
153
|
-
if (
|
|
152
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
153
|
+
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
154
154
|
// only required when we're NOT using native shadow dom (slot)
|
|
155
155
|
// or this browser doesn't support native shadow dom
|
|
156
156
|
// and this host element was NOT created with SSR
|
|
@@ -163,7 +163,7 @@ const attachStyles = (hostRef) => {
|
|
|
163
163
|
}
|
|
164
164
|
endAttachStyles();
|
|
165
165
|
};
|
|
166
|
-
const getScopeId = (cmp, mode) => 'sc-' + (
|
|
166
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
167
167
|
/**
|
|
168
168
|
* Default style mode id
|
|
169
169
|
*/
|
|
@@ -225,7 +225,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
225
225
|
walk(children);
|
|
226
226
|
if (vnodeData) {
|
|
227
227
|
// normalize class / classname attributes
|
|
228
|
-
if (
|
|
228
|
+
if (vnodeData.key) {
|
|
229
229
|
key = vnodeData.key;
|
|
230
230
|
}
|
|
231
231
|
{
|
|
@@ -235,7 +235,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
235
235
|
typeof classData !== 'object'
|
|
236
236
|
? classData
|
|
237
237
|
: Object.keys(classData)
|
|
238
|
-
.filter(k => classData[k])
|
|
238
|
+
.filter((k) => classData[k])
|
|
239
239
|
.join(' ');
|
|
240
240
|
}
|
|
241
241
|
}
|
|
@@ -280,19 +280,19 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
280
280
|
if (oldValue !== newValue) {
|
|
281
281
|
let isProp = isMemberInElement(elm, memberName);
|
|
282
282
|
let ln = memberName.toLowerCase();
|
|
283
|
-
if (
|
|
283
|
+
if (memberName === 'class') {
|
|
284
284
|
const classList = elm.classList;
|
|
285
285
|
const oldClasses = parseClassList(oldValue);
|
|
286
286
|
const newClasses = parseClassList(newValue);
|
|
287
|
-
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
|
|
288
|
-
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
|
|
287
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
288
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
289
289
|
}
|
|
290
|
-
else if (
|
|
290
|
+
else if (memberName === 'style') {
|
|
291
291
|
// update style attribute, css properties and values
|
|
292
292
|
{
|
|
293
293
|
for (const prop in oldValue) {
|
|
294
294
|
if (!newValue || newValue[prop] == null) {
|
|
295
|
-
if (
|
|
295
|
+
if (prop.includes('-')) {
|
|
296
296
|
elm.style.removeProperty(prop);
|
|
297
297
|
}
|
|
298
298
|
else {
|
|
@@ -303,7 +303,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
303
303
|
}
|
|
304
304
|
for (const prop in newValue) {
|
|
305
305
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
306
|
-
if (
|
|
306
|
+
if (prop.includes('-')) {
|
|
307
307
|
elm.style.setProperty(prop, newValue[prop]);
|
|
308
308
|
}
|
|
309
309
|
else {
|
|
@@ -312,15 +312,17 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
else if (
|
|
315
|
+
else if (memberName === 'key')
|
|
316
316
|
;
|
|
317
|
-
else if (
|
|
317
|
+
else if (memberName === 'ref') {
|
|
318
318
|
// minifier will clean this up
|
|
319
319
|
if (newValue) {
|
|
320
320
|
newValue(elm);
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
else if (
|
|
323
|
+
else if ((!isProp ) &&
|
|
324
|
+
memberName[0] === 'o' &&
|
|
325
|
+
memberName[1] === 'n') {
|
|
324
326
|
// Event Handlers
|
|
325
327
|
// so if the member name starts with "on" and the 3rd characters is
|
|
326
328
|
// a capital letter, and it's not already a member on the element,
|
|
@@ -395,7 +397,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
395
397
|
}
|
|
396
398
|
if (newValue == null || newValue === false) {
|
|
397
399
|
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
398
|
-
if (
|
|
400
|
+
if (xlink) {
|
|
399
401
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
400
402
|
}
|
|
401
403
|
else {
|
|
@@ -405,7 +407,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
405
407
|
}
|
|
406
408
|
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
407
409
|
newValue = newValue === true ? '' : newValue;
|
|
408
|
-
if (
|
|
410
|
+
if (xlink) {
|
|
409
411
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
410
412
|
}
|
|
411
413
|
else {
|
|
@@ -421,7 +423,9 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
421
423
|
// if the element passed in is a shadow root, which is a document fragment
|
|
422
424
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
423
425
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
424
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
426
|
+
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
427
|
+
? newVnode.$elm$.host
|
|
428
|
+
: newVnode.$elm$;
|
|
425
429
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
426
430
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
427
431
|
{
|
|
@@ -443,25 +447,25 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
443
447
|
let i = 0;
|
|
444
448
|
let elm;
|
|
445
449
|
let childNode;
|
|
446
|
-
if (
|
|
450
|
+
if (newVNode.$text$ !== null) {
|
|
447
451
|
// create text node
|
|
448
452
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
449
453
|
}
|
|
450
454
|
else {
|
|
451
|
-
if (
|
|
455
|
+
if (!isSvgMode) {
|
|
452
456
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
453
457
|
}
|
|
454
458
|
// create element
|
|
455
|
-
elm = newVNode.$elm$ = (
|
|
459
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
|
|
456
460
|
);
|
|
457
|
-
if (
|
|
461
|
+
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
458
462
|
isSvgMode = false;
|
|
459
463
|
}
|
|
460
464
|
// add css classes, attrs, props, listeners, etc.
|
|
461
465
|
{
|
|
462
466
|
updateElement(null, newVNode, isSvgMode);
|
|
463
467
|
}
|
|
464
|
-
if (
|
|
468
|
+
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
465
469
|
// if there is a scopeId and this is the initial render
|
|
466
470
|
// then let's add the scopeId as a css class
|
|
467
471
|
elm.classList.add((elm['s-si'] = scopeId));
|
|
@@ -491,9 +495,9 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
491
495
|
return elm;
|
|
492
496
|
};
|
|
493
497
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
494
|
-
let containerElm = (
|
|
498
|
+
let containerElm = (parentElm);
|
|
495
499
|
let childNode;
|
|
496
|
-
if (
|
|
500
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
497
501
|
containerElm = containerElm.shadowRoot;
|
|
498
502
|
}
|
|
499
503
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
@@ -501,7 +505,7 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
501
505
|
childNode = createElm(null, parentVNode, startIdx);
|
|
502
506
|
if (childNode) {
|
|
503
507
|
vnodes[startIdx].$elm$ = childNode;
|
|
504
|
-
containerElm.insertBefore(childNode,
|
|
508
|
+
containerElm.insertBefore(childNode, before);
|
|
505
509
|
}
|
|
506
510
|
}
|
|
507
511
|
}
|
|
@@ -576,7 +580,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
576
580
|
}
|
|
577
581
|
}
|
|
578
582
|
}
|
|
579
|
-
if (
|
|
583
|
+
if (idxInOld >= 0) {
|
|
580
584
|
elmToMove = oldCh[idxInOld];
|
|
581
585
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
582
586
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
@@ -603,7 +607,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
603
607
|
if (oldStartIdx > oldEndIdx) {
|
|
604
608
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
605
609
|
}
|
|
606
|
-
else if (
|
|
610
|
+
else if (newStartIdx > newEndIdx) {
|
|
607
611
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
608
612
|
}
|
|
609
613
|
};
|
|
@@ -623,7 +627,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
623
627
|
const newChildren = newVNode.$children$;
|
|
624
628
|
const tag = newVNode.$tag$;
|
|
625
629
|
const text = newVNode.$text$;
|
|
626
|
-
if (
|
|
630
|
+
if (text === null) {
|
|
627
631
|
{
|
|
628
632
|
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
629
633
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
@@ -631,7 +635,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
631
635
|
}
|
|
632
636
|
// element node
|
|
633
637
|
{
|
|
634
|
-
if (
|
|
638
|
+
if (tag === 'slot')
|
|
635
639
|
;
|
|
636
640
|
else {
|
|
637
641
|
// either this is the first render of an element OR it's an update
|
|
@@ -640,28 +644,28 @@ const patch = (oldVNode, newVNode) => {
|
|
|
640
644
|
updateElement(oldVNode, newVNode, isSvgMode);
|
|
641
645
|
}
|
|
642
646
|
}
|
|
643
|
-
if (
|
|
647
|
+
if (oldChildren !== null && newChildren !== null) {
|
|
644
648
|
// looks like there's child vnodes for both the old and new vnodes
|
|
645
649
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
646
650
|
}
|
|
647
651
|
else if (newChildren !== null) {
|
|
648
652
|
// no old child vnodes, but there are new child vnodes to add
|
|
649
|
-
if (
|
|
653
|
+
if (oldVNode.$text$ !== null) {
|
|
650
654
|
// the old vnode was text, so be sure to clear it out
|
|
651
655
|
elm.textContent = '';
|
|
652
656
|
}
|
|
653
657
|
// add the new vnode children
|
|
654
658
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
655
659
|
}
|
|
656
|
-
else if (
|
|
660
|
+
else if (oldChildren !== null) {
|
|
657
661
|
// no new child vnodes, but there are old child vnodes to remove
|
|
658
662
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
659
663
|
}
|
|
660
|
-
if (
|
|
664
|
+
if (isSvgMode && tag === 'svg') {
|
|
661
665
|
isSvgMode = false;
|
|
662
666
|
}
|
|
663
667
|
}
|
|
664
|
-
else if (
|
|
668
|
+
else if (oldVNode.$text$ !== text) {
|
|
665
669
|
// update the text content for the text only vnode
|
|
666
670
|
// and also only if the text is different than before
|
|
667
671
|
elm.data = text;
|
|
@@ -679,21 +683,21 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
679
683
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
680
684
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
681
685
|
hostTagName = hostElm.tagName;
|
|
682
|
-
if (
|
|
686
|
+
if (cmpMeta.$attrsToReflect$) {
|
|
683
687
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
684
688
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
685
689
|
}
|
|
686
690
|
rootVnode.$tag$ = null;
|
|
687
691
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
688
692
|
hostRef.$vnode$ = rootVnode;
|
|
689
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (
|
|
693
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
690
694
|
{
|
|
691
695
|
scopeId = hostElm['s-sc'];
|
|
692
696
|
}
|
|
693
697
|
// synchronous patch
|
|
694
698
|
patch(oldVNode, rootVnode);
|
|
695
699
|
};
|
|
696
|
-
const getElement = (ref) => (
|
|
700
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
697
701
|
const createEvent = (ref, name, flags) => {
|
|
698
702
|
const elm = getElement(ref);
|
|
699
703
|
return {
|
|
@@ -707,21 +711,28 @@ const createEvent = (ref, name, flags) => {
|
|
|
707
711
|
},
|
|
708
712
|
};
|
|
709
713
|
};
|
|
714
|
+
/**
|
|
715
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
716
|
+
* @param elm the target of the Event
|
|
717
|
+
* @param name the name to give the custom Event
|
|
718
|
+
* @param opts options for configuring a custom Event
|
|
719
|
+
* @returns the custom Event
|
|
720
|
+
*/
|
|
710
721
|
const emitEvent = (elm, name, opts) => {
|
|
711
722
|
const ev = plt.ce(name, opts);
|
|
712
723
|
elm.dispatchEvent(ev);
|
|
713
724
|
return ev;
|
|
714
725
|
};
|
|
715
726
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
716
|
-
if (
|
|
717
|
-
ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
|
|
727
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
728
|
+
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
718
729
|
}
|
|
719
730
|
};
|
|
720
731
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
721
732
|
{
|
|
722
733
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
723
734
|
}
|
|
724
|
-
if (
|
|
735
|
+
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
725
736
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
726
737
|
return;
|
|
727
738
|
}
|
|
@@ -730,11 +741,11 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
730
741
|
// has already fired off its lifecycle update then
|
|
731
742
|
// fire off the initial update
|
|
732
743
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
733
|
-
return
|
|
744
|
+
return writeTask(dispatch) ;
|
|
734
745
|
};
|
|
735
746
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
736
747
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
737
|
-
const instance =
|
|
748
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
738
749
|
let promise;
|
|
739
750
|
if (isInitialLoad) {
|
|
740
751
|
{
|
|
@@ -756,26 +767,19 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
756
767
|
const elm = hostRef.$hostElement$;
|
|
757
768
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
758
769
|
const rc = elm['s-rc'];
|
|
759
|
-
if (
|
|
770
|
+
if (isInitialLoad) {
|
|
760
771
|
// DOM WRITE!
|
|
761
772
|
attachStyles(hostRef);
|
|
762
773
|
}
|
|
763
774
|
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
764
775
|
{
|
|
765
|
-
|
|
766
|
-
// looks like we've got child nodes to render into this host element
|
|
767
|
-
// or we need to update the css class/attrs on the host element
|
|
768
|
-
// DOM WRITE!
|
|
769
|
-
{
|
|
770
|
-
renderVdom(hostRef, callRender(hostRef, instance));
|
|
771
|
-
}
|
|
772
|
-
}
|
|
776
|
+
callRender(hostRef, instance);
|
|
773
777
|
}
|
|
774
|
-
if (
|
|
778
|
+
if (rc) {
|
|
775
779
|
// ok, so turns out there are some child host elements
|
|
776
780
|
// waiting on this parent element to load
|
|
777
781
|
// let's fire off all update callbacks waiting
|
|
778
|
-
rc.map(cb => cb());
|
|
782
|
+
rc.map((cb) => cb());
|
|
779
783
|
elm['s-rc'] = undefined;
|
|
780
784
|
}
|
|
781
785
|
endRender();
|
|
@@ -793,26 +797,36 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
793
797
|
}
|
|
794
798
|
}
|
|
795
799
|
};
|
|
796
|
-
const callRender = (hostRef, instance) => {
|
|
800
|
+
const callRender = (hostRef, instance, elm) => {
|
|
797
801
|
try {
|
|
798
|
-
instance =
|
|
802
|
+
instance = instance.render && instance.render();
|
|
799
803
|
{
|
|
800
804
|
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
801
805
|
}
|
|
802
806
|
{
|
|
803
807
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
804
808
|
}
|
|
809
|
+
{
|
|
810
|
+
{
|
|
811
|
+
// looks like we've got child nodes to render into this host element
|
|
812
|
+
// or we need to update the css class/attrs on the host element
|
|
813
|
+
// DOM WRITE!
|
|
814
|
+
{
|
|
815
|
+
renderVdom(hostRef, instance);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
805
819
|
}
|
|
806
820
|
catch (e) {
|
|
807
821
|
consoleError(e, hostRef.$hostElement$);
|
|
808
822
|
}
|
|
809
|
-
return
|
|
823
|
+
return null;
|
|
810
824
|
};
|
|
811
825
|
const postUpdateComponent = (hostRef) => {
|
|
812
826
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
813
827
|
const elm = hostRef.$hostElement$;
|
|
814
828
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
815
|
-
const instance =
|
|
829
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
816
830
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
817
831
|
{
|
|
818
832
|
safeCall(instance, 'componentDidRender');
|
|
@@ -863,7 +877,8 @@ const forceUpdate = (ref) => {
|
|
|
863
877
|
{
|
|
864
878
|
const hostRef = getHostRef(ref);
|
|
865
879
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
866
|
-
if (isConnected &&
|
|
880
|
+
if (isConnected &&
|
|
881
|
+
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
867
882
|
scheduleUpdate(hostRef, false);
|
|
868
883
|
}
|
|
869
884
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -892,20 +907,21 @@ const safeCall = (instance, method, arg) => {
|
|
|
892
907
|
const then = (promise, thenFn) => {
|
|
893
908
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
894
909
|
};
|
|
895
|
-
const addHydratedFlag = (elm) =>
|
|
910
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
911
|
+
;
|
|
896
912
|
const parsePropertyValue = (propValue, propType) => {
|
|
897
913
|
// ensure this value is of the correct prop type
|
|
898
914
|
if (propValue != null && !isComplexType(propValue)) {
|
|
899
|
-
if (
|
|
915
|
+
if (propType & 4 /* Boolean */) {
|
|
900
916
|
// per the HTML spec, any string value means it is a boolean true value
|
|
901
917
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
902
918
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
903
919
|
}
|
|
904
|
-
if (
|
|
920
|
+
if (propType & 2 /* Number */) {
|
|
905
921
|
// force it to be a number
|
|
906
922
|
return parseFloat(propValue);
|
|
907
923
|
}
|
|
908
|
-
if (
|
|
924
|
+
if (propType & 1 /* String */) {
|
|
909
925
|
// could have been passed as a number or boolean
|
|
910
926
|
// but we still want it as a string
|
|
911
927
|
return String(propValue);
|
|
@@ -921,22 +937,22 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
921
937
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
922
938
|
// check our new property value against our internal value
|
|
923
939
|
const hostRef = getHostRef(ref);
|
|
924
|
-
const elm =
|
|
940
|
+
const elm = hostRef.$hostElement$ ;
|
|
925
941
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
926
942
|
const flags = hostRef.$flags$;
|
|
927
|
-
const instance =
|
|
943
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
928
944
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
929
|
-
if ((
|
|
945
|
+
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
|
|
930
946
|
// gadzooks! the property's value has changed!!
|
|
931
947
|
// set our new value!
|
|
932
948
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
933
|
-
if (
|
|
949
|
+
if (instance) {
|
|
934
950
|
// get an array of method names of watch functions to call
|
|
935
|
-
if (
|
|
951
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
936
952
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
937
953
|
if (watchMethods) {
|
|
938
954
|
// this instance is watching for when this property changed
|
|
939
|
-
watchMethods.map(watchMethodName => {
|
|
955
|
+
watchMethods.map((watchMethodName) => {
|
|
940
956
|
try {
|
|
941
957
|
// fire off each of the watch methods that are watching this property
|
|
942
958
|
instance[watchMethodName](newVal, oldVal, propName);
|
|
@@ -947,7 +963,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
947
963
|
});
|
|
948
964
|
}
|
|
949
965
|
}
|
|
950
|
-
if (
|
|
966
|
+
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
951
967
|
// looks like this value actually changed, so we've got work to do!
|
|
952
968
|
// but only if we've already rendered, otherwise just chill out
|
|
953
969
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -958,15 +974,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
958
974
|
}
|
|
959
975
|
};
|
|
960
976
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
961
|
-
if (
|
|
962
|
-
if (
|
|
977
|
+
if (cmpMeta.$members$) {
|
|
978
|
+
if (Cstr.watchers) {
|
|
963
979
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
964
980
|
}
|
|
965
981
|
// It's better to have a const than two Object.entries()
|
|
966
982
|
const members = Object.entries(cmpMeta.$members$);
|
|
967
983
|
const prototype = Cstr.prototype;
|
|
968
984
|
members.map(([memberName, [memberFlags]]) => {
|
|
969
|
-
if (
|
|
985
|
+
if ((memberFlags & 31 /* Prop */ ||
|
|
986
|
+
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
970
987
|
// proxyComponent - prop
|
|
971
988
|
Object.defineProperty(prototype, memberName, {
|
|
972
989
|
get() {
|
|
@@ -981,7 +998,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
981
998
|
enumerable: true,
|
|
982
999
|
});
|
|
983
1000
|
}
|
|
984
|
-
else if (
|
|
1001
|
+
else if (flags & 1 /* isElementConstructor */ &&
|
|
1002
|
+
memberFlags & 64 /* Method */) {
|
|
985
1003
|
// proxyComponent - method
|
|
986
1004
|
Object.defineProperty(prototype, memberName, {
|
|
987
1005
|
value(...args) {
|
|
@@ -991,11 +1009,48 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
991
1009
|
});
|
|
992
1010
|
}
|
|
993
1011
|
});
|
|
994
|
-
if (
|
|
1012
|
+
if ((flags & 1 /* isElementConstructor */)) {
|
|
995
1013
|
const attrNameToPropName = new Map();
|
|
996
1014
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
997
1015
|
plt.jmp(() => {
|
|
998
1016
|
const propName = attrNameToPropName.get(attrName);
|
|
1017
|
+
// In a webcomponent lifecyle the attributeChangedCallback runs prior to connectedCallback
|
|
1018
|
+
// in the case where an attribute was set inline.
|
|
1019
|
+
// ```html
|
|
1020
|
+
// <my-component some-attribute="some-value"></my-component>
|
|
1021
|
+
// ```
|
|
1022
|
+
//
|
|
1023
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then programatically
|
|
1024
|
+
// changes it before it has been upgraded as shown below:
|
|
1025
|
+
//
|
|
1026
|
+
// ```html
|
|
1027
|
+
// <!-- this component has _not_ been upgraded yet -->
|
|
1028
|
+
// <my-component id="test" some-attribute="some-value"></my-component>
|
|
1029
|
+
// <script>
|
|
1030
|
+
// // grab non-upgraded component
|
|
1031
|
+
// el = document.querySelector("#test");
|
|
1032
|
+
// el.someAttribute = "another-value";
|
|
1033
|
+
// // upgrade component
|
|
1034
|
+
// cutsomElements.define('my-component', MyComponent);
|
|
1035
|
+
// </script>
|
|
1036
|
+
// ```
|
|
1037
|
+
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
|
|
1038
|
+
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
1039
|
+
// to the value that was set inline i.e. "some-value" from above example. When
|
|
1040
|
+
// the connectedCallback attempts to unshadow it will use "some-value" as the intial value rather than "another-value"
|
|
1041
|
+
//
|
|
1042
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
|
|
1043
|
+
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
1044
|
+
//
|
|
1045
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1046
|
+
//
|
|
1047
|
+
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
|
1048
|
+
// properties here given that this goes against best practices outlined here
|
|
1049
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
|
1050
|
+
if (this.hasOwnProperty(propName)) {
|
|
1051
|
+
newValue = this[propName];
|
|
1052
|
+
delete this[propName];
|
|
1053
|
+
}
|
|
999
1054
|
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
|
1000
1055
|
});
|
|
1001
1056
|
};
|
|
@@ -1006,7 +1061,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1006
1061
|
.map(([propName, m]) => {
|
|
1007
1062
|
const attrName = m[1] || propName;
|
|
1008
1063
|
attrNameToPropName.set(attrName, propName);
|
|
1009
|
-
if (
|
|
1064
|
+
if (m[0] & 512 /* ReflectAttr */) {
|
|
1010
1065
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1011
1066
|
}
|
|
1012
1067
|
return attrName;
|
|
@@ -1017,7 +1072,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1017
1072
|
};
|
|
1018
1073
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1019
1074
|
// initializeComponent
|
|
1020
|
-
if (
|
|
1075
|
+
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1021
1076
|
{
|
|
1022
1077
|
// we haven't initialized this element yet
|
|
1023
1078
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
@@ -1031,8 +1086,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1031
1086
|
Cstr = await Cstr;
|
|
1032
1087
|
endLoad();
|
|
1033
1088
|
}
|
|
1034
|
-
if (
|
|
1035
|
-
// we'
|
|
1089
|
+
if (!Cstr.isProxied) {
|
|
1090
|
+
// we've never proxied this Constructor before
|
|
1036
1091
|
// let's add the getters/setters to its prototype before
|
|
1037
1092
|
// the first time we create an instance of the implementation
|
|
1038
1093
|
{
|
|
@@ -1066,7 +1121,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1066
1121
|
}
|
|
1067
1122
|
endNewInstance();
|
|
1068
1123
|
}
|
|
1069
|
-
if (
|
|
1124
|
+
if (Cstr.style) {
|
|
1070
1125
|
// this component has styles but we haven't registered them yet
|
|
1071
1126
|
let style = Cstr.style;
|
|
1072
1127
|
const scopeId = getScopeId(cmpMeta);
|
|
@@ -1080,7 +1135,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1080
1135
|
// we've successfully created a lazy instance
|
|
1081
1136
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1082
1137
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
1083
|
-
if (
|
|
1138
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
1084
1139
|
// this is the intial load and this component it has an ancestor component
|
|
1085
1140
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
1086
1141
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
@@ -1108,8 +1163,7 @@ const connectedCallback = (elm) => {
|
|
|
1108
1163
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1109
1164
|
// climb up the ancestors looking for the first
|
|
1110
1165
|
// component that hasn't finished its lifecycle update yet
|
|
1111
|
-
if (
|
|
1112
|
-
ancestorComponent['s-p']) {
|
|
1166
|
+
if (ancestorComponent['s-p']) {
|
|
1113
1167
|
// we found this components first ancestor component
|
|
1114
1168
|
// keep a reference to this component's ancestor component
|
|
1115
1169
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -1119,7 +1173,7 @@ const connectedCallback = (elm) => {
|
|
|
1119
1173
|
}
|
|
1120
1174
|
// Lazy properties
|
|
1121
1175
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1122
|
-
if (
|
|
1176
|
+
if (cmpMeta.$members$) {
|
|
1123
1177
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1124
1178
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1125
1179
|
const value = elm[memberName];
|
|
@@ -1146,7 +1200,7 @@ const disconnectedCallback = (elm) => {
|
|
|
1146
1200
|
const hostRef = getHostRef(elm);
|
|
1147
1201
|
{
|
|
1148
1202
|
if (hostRef.$rmListeners$) {
|
|
1149
|
-
hostRef.$rmListeners$.map(rmListener => rmListener());
|
|
1203
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1150
1204
|
hostRef.$rmListeners$ = undefined;
|
|
1151
1205
|
}
|
|
1152
1206
|
}
|
|
@@ -1165,7 +1219,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1165
1219
|
let isBootstrapping = true;
|
|
1166
1220
|
Object.assign(plt, options);
|
|
1167
1221
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1168
|
-
lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
|
|
1222
|
+
lazyBundles.map((lazyBundle) => lazyBundle[1].map((compactMeta) => {
|
|
1169
1223
|
const cmpMeta = {
|
|
1170
1224
|
$flags$: compactMeta[0],
|
|
1171
1225
|
$tagName$: compactMeta[1],
|
|
@@ -1184,7 +1238,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1184
1238
|
{
|
|
1185
1239
|
cmpMeta.$watchers$ = {};
|
|
1186
1240
|
}
|
|
1187
|
-
const tagName =
|
|
1241
|
+
const tagName = cmpMeta.$tagName$;
|
|
1188
1242
|
const HostElement = class extends HTMLElement {
|
|
1189
1243
|
// StencilLazyHost
|
|
1190
1244
|
constructor(self) {
|
|
@@ -1192,7 +1246,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1192
1246
|
super(self);
|
|
1193
1247
|
self = this;
|
|
1194
1248
|
registerHost(self, cmpMeta);
|
|
1195
|
-
if (
|
|
1249
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1196
1250
|
// this component is using shadow dom
|
|
1197
1251
|
// and this browser supports shadow dom
|
|
1198
1252
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1238,7 +1292,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1238
1292
|
// Process deferred connectedCallbacks now all components have been registered
|
|
1239
1293
|
isBootstrapping = false;
|
|
1240
1294
|
if (deferredConnectedCallbacks.length) {
|
|
1241
|
-
deferredConnectedCallbacks.map(host => host.connectedCallback());
|
|
1295
|
+
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
1242
1296
|
}
|
|
1243
1297
|
else {
|
|
1244
1298
|
{
|
|
@@ -1259,10 +1313,10 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1259
1313
|
$instanceValues$: new Map(),
|
|
1260
1314
|
};
|
|
1261
1315
|
{
|
|
1262
|
-
hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
|
|
1316
|
+
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
|
1263
1317
|
}
|
|
1264
1318
|
{
|
|
1265
|
-
hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
|
|
1319
|
+
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
1266
1320
|
elm['s-p'] = [];
|
|
1267
1321
|
elm['s-rc'] = [];
|
|
1268
1322
|
}
|
|
@@ -1270,13 +1324,13 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1270
1324
|
return hostRefs.set(elm, hostRef);
|
|
1271
1325
|
};
|
|
1272
1326
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
1273
|
-
const consoleError = (e, el) => (
|
|
1327
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
1274
1328
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
1275
1329
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
1276
1330
|
// loadModuleImport
|
|
1277
1331
|
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
|
1278
1332
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
1279
|
-
const module =
|
|
1333
|
+
const module = cmpModules.get(bundleId) ;
|
|
1280
1334
|
if (module) {
|
|
1281
1335
|
return module[exportName];
|
|
1282
1336
|
}
|
|
@@ -1284,7 +1338,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1284
1338
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1285
1339
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1286
1340
|
/* webpackMode: "lazy" */
|
|
1287
|
-
`./${bundleId}.entry.js${
|
|
1341
|
+
`./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
|
|
1288
1342
|
{
|
|
1289
1343
|
cmpModules.set(bundleId, importedModule);
|
|
1290
1344
|
}
|