@haiilo/catalyst 4.1.2 → 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/dist/catalyst/assets/fonts/Lato-Black.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Black.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Bold.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Bold.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Hairline.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Hairline.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Heavy.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Heavy.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Italic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Italic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Light.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Light.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-LightItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-LightItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Medium.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Medium.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Regular.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Regular.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Semibold.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Semibold.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Thin.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Thin.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff2 +0 -0
- package/dist/catalyst/catalyst.css +6 -27
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.esm.js.map +1 -1
- package/dist/catalyst/p-50855511.entry.js +10 -0
- package/dist/catalyst/p-50855511.entry.js.map +1 -0
- package/dist/catalyst/p-ccfebe33.js.map +1 -1
- package/dist/catalyst/p-d1fb9d96.js +3 -0
- package/dist/catalyst/p-d1fb9d96.js.map +1 -0
- package/dist/catalyst/scss/fonts/_fonts-mixins.scss +0 -10
- package/dist/cjs/cat-alert_24.cjs.entry.js +932 -1132
- package/dist/cjs/cat-alert_24.cjs.entry.js.map +1 -1
- package/dist/cjs/catalyst.cjs.js +10 -3
- package/dist/cjs/catalyst.cjs.js.map +1 -1
- package/dist/cjs/{index-c4542095.js → index-01312a2e.js} +527 -245
- package/dist/cjs/index-01312a2e.js.map +1 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +4 -3
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/collection/assets/fonts/Lato-Black.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Black.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-BlackItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-BlackItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Bold.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Bold.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-BoldItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Hairline.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Hairline.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-HairlineItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Heavy.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Heavy.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-HeavyItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Italic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Italic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Light.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Light.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-LightItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-LightItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Medium.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Medium.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-MediumItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-MediumItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Regular.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Regular.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Semibold.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Semibold.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Thin.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Thin.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-ThinItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-ThinItalic.woff2 +0 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/cat-alert/cat-alert.js +69 -71
- package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
- package/dist/collection/components/cat-avatar/cat-avatar.js +172 -165
- package/dist/collection/components/cat-avatar/cat-avatar.js.map +1 -1
- package/dist/collection/components/cat-badge/cat-badge.js +102 -111
- package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
- package/dist/collection/components/cat-button/cat-button.js +526 -537
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-card/cat-card.js +12 -8
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +336 -350
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
- package/dist/collection/components/cat-dropdown/cat-dropdown.js +137 -137
- package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
- package/dist/collection/components/cat-form-group/cat-form-group.js +58 -40
- package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
- package/dist/collection/components/cat-form-hint/cat-form-hint.js +14 -7
- package/dist/collection/components/cat-form-hint/cat-form-hint.js.map +1 -1
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js +1 -1
- package/dist/collection/components/cat-icon/cat-icon-registry.js +1 -1
- package/dist/collection/components/cat-icon/cat-icon.js +85 -79
- package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.css +32 -3
- package/dist/collection/components/cat-input/cat-input.js +662 -660
- package/dist/collection/components/cat-input/cat-input.js.map +1 -1
- package/dist/collection/components/cat-input/input-type.js +1 -1
- package/dist/collection/components/cat-label/cat-label.js +69 -78
- package/dist/collection/components/cat-label/cat-label.js.map +1 -1
- package/dist/collection/components/cat-notification/cat-notification.js +1 -1
- package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
- package/dist/collection/components/cat-pagination/cat-pagination.js +192 -226
- package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.js +319 -327
- package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
- package/dist/collection/components/cat-radio-group/cat-radio-group.js +173 -165
- package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
- package/dist/collection/components/cat-scrollable/cat-scrollable.js +200 -208
- package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.js +555 -590
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-select-demo/cat-select-demo.js +3 -28
- package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
- package/dist/collection/components/cat-skeleton/cat-skeleton.js +85 -88
- package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.js +52 -50
- package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -1
- package/dist/collection/components/cat-tab/cat-tab.js +169 -168
- package/dist/collection/components/cat-tab/cat-tab.js.map +1 -1
- package/dist/collection/components/cat-tabs/cat-tabs.js +73 -66
- package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.css +32 -1
- package/dist/collection/components/cat-textarea/cat-textarea.js +479 -468
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.js +319 -326
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.css +7 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +187 -198
- package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/scss/fonts/_fonts-mixins.scss +0 -10
- package/dist/collection/utils/breakpoints.js +1 -1
- package/dist/collection/utils/breakpoints.js.map +1 -1
- package/dist/collection/utils/coerce.js +11 -0
- package/dist/collection/utils/coerce.js.map +1 -0
- package/dist/collection/utils/first-tabbable.js +1 -1
- package/dist/collection/utils/is-touch-screen.js +1 -1
- package/dist/collection/utils/load-img.js +1 -1
- package/dist/collection/utils/media-matcher.js +1 -1
- package/dist/collection/utils/platform.js +4 -4
- package/dist/collection/utils/setDefault.js +1 -1
- package/dist/components/cat-alert.js +1 -6
- package/dist/components/cat-alert.js.map +1 -1
- package/dist/components/cat-avatar2.js +6 -9
- package/dist/components/cat-avatar2.js.map +1 -1
- package/dist/components/cat-badge.js +0 -15
- package/dist/components/cat-badge.js.map +1 -1
- package/dist/components/cat-button2.js +10 -36
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-checkbox2.js +9 -26
- package/dist/components/cat-checkbox2.js.map +1 -1
- package/dist/components/cat-dropdown2.js +139 -176
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-form-group.js +4 -9
- package/dist/components/cat-form-group.js.map +1 -1
- package/dist/components/cat-form-hint.js +13 -6
- package/dist/components/cat-form-hint.js.map +1 -1
- package/dist/components/cat-icon-registry.js +71 -0
- package/dist/components/cat-icon-registry.js.map +1 -0
- package/dist/components/cat-icon.js +1 -1
- package/dist/components/cat-icon2.js +5 -71
- package/dist/components/cat-icon2.js.map +1 -1
- package/dist/components/cat-input.js +33 -41
- package/dist/components/cat-input.js.map +1 -1
- package/dist/components/cat-label.js +1 -6
- package/dist/components/cat-label.js.map +1 -1
- package/dist/components/cat-pagination.js +0 -30
- package/dist/components/cat-pagination.js.map +1 -1
- package/dist/components/cat-radio-group.js +3 -6
- package/dist/components/cat-radio-group.js.map +1 -1
- package/dist/components/cat-radio.js +9 -23
- package/dist/components/cat-radio.js.map +1 -1
- package/dist/components/cat-scrollable2.js +1 -12
- package/dist/components/cat-scrollable2.js.map +1 -1
- package/dist/components/cat-select-demo.js +2 -12
- package/dist/components/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select2.js +40 -47
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-skeleton2.js +1 -10
- package/dist/components/cat-skeleton2.js.map +1 -1
- package/dist/components/cat-spinner2.js +1 -3
- package/dist/components/cat-spinner2.js.map +1 -1
- package/dist/components/cat-tab.js +3 -12
- package/dist/components/cat-tab.js.map +1 -1
- package/dist/components/cat-tabs.js +1 -6
- package/dist/components/cat-tabs.js.map +1 -1
- package/dist/components/cat-textarea.js +28 -33
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/cat-toggle.js +9 -23
- package/dist/components/cat-toggle.js.map +1 -1
- package/dist/components/cat-tooltip.js +14 -34
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/components/first-tabbable.js +51 -113
- package/dist/components/first-tabbable.js.map +1 -1
- package/dist/components/floating-ui.dom.esm.js +577 -441
- package/dist/components/floating-ui.dom.esm.js.map +1 -1
- package/dist/components/index.d.ts +9 -27
- package/dist/components/index.js +2 -26
- package/dist/components/index.js.map +1 -1
- package/dist/esm/cat-alert_24.entry.js +933 -1133
- package/dist/esm/cat-alert_24.entry.js.map +1 -1
- package/dist/esm/catalyst.js +7 -3
- package/dist/esm/catalyst.js.map +1 -1
- package/dist/esm/{index-524906f7.js → index-fc2f91a4.js} +527 -246
- package/dist/esm/index-fc2f91a4.js.map +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +4 -3
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +1 -1
- package/dist/types/components/cat-form-group/cat-form-group.d.ts +4 -0
- package/dist/types/components/cat-form-hint/cat-form-hint.d.ts +5 -0
- package/dist/types/components/cat-input/cat-input.d.ts +6 -1
- package/dist/types/components/cat-input/input-type.d.ts +1 -1
- package/dist/types/components/cat-radio/cat-radio.d.ts +1 -1
- package/dist/types/components/cat-select/cat-select.d.ts +3 -1
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +6 -1
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +1 -1
- package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +3 -0
- package/dist/types/components.d.ts +353 -7
- package/dist/types/stencil-public-runtime.d.ts +91 -19
- package/dist/types/utils/breakpoints.d.ts +1 -1
- package/dist/types/utils/coerce.d.ts +3 -0
- package/dist/types/utils/first-tabbable.d.ts +2 -2
- package/loader/index.d.ts +9 -0
- package/loader/package.json +1 -0
- package/package.json +19 -19
- package/dist/catalyst/assets/fonts/AzeretMono-Regular.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Bold.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Italic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Medium.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Regular.woff2 +0 -0
- package/dist/catalyst/p-919eea27.js +0 -3
- package/dist/catalyst/p-919eea27.js.map +0 -1
- package/dist/catalyst/p-cd8f8639.entry.js +0 -10
- package/dist/catalyst/p-cd8f8639.entry.js.map +0 -1
- package/dist/catalyst/scss/fonts/_fonts.mixins.azeret.scss +0 -14
- package/dist/catalyst/scss/fonts/_fonts.mixins.dm.scss +0 -53
- package/dist/cjs/index-c4542095.js.map +0 -1
- package/dist/collection/assets/fonts/AzeretMono-Regular.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Bold.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Italic.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Medium.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Regular.woff2 +0 -0
- package/dist/collection/components/cat-form-hint/cat-form-hint-utils.js +0 -13
- package/dist/collection/components/cat-form-hint/cat-form-hint-utils.js.map +0 -1
- package/dist/collection/scss/fonts/_fonts.mixins.azeret.scss +0 -14
- package/dist/collection/scss/fonts/_fonts.mixins.dm.scss +0 -53
- package/dist/components/cat-form-hint-utils.js +0 -17
- package/dist/components/cat-form-hint-utils.js.map +0 -1
- package/dist/esm/index-524906f7.js.map +0 -1
- package/dist/types/components/cat-form-hint/cat-form-hint-utils.d.ts +0 -4
|
@@ -1,61 +1,17 @@
|
|
|
1
1
|
const NAMESPACE = 'catalyst';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
|
5
|
+
* Simon Friis Vindum (@paldepind)
|
|
6
|
+
* Licensed under the MIT License
|
|
7
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
8
|
+
*
|
|
9
|
+
* Modified for Stencil's renderer and slot projection
|
|
10
|
+
*/
|
|
3
11
|
let scopeId;
|
|
4
12
|
let hostTagName;
|
|
5
13
|
let isSvgMode = false;
|
|
6
14
|
let queuePending = false;
|
|
7
|
-
const win = typeof window !== 'undefined' ? window : {};
|
|
8
|
-
const doc = win.document || { head: {} };
|
|
9
|
-
const plt = {
|
|
10
|
-
$flags$: 0,
|
|
11
|
-
$resourcesUrl$: '',
|
|
12
|
-
jmp: (h) => h(),
|
|
13
|
-
raf: (h) => requestAnimationFrame(h),
|
|
14
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
15
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
16
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
17
|
-
};
|
|
18
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
19
|
-
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
20
|
-
try {
|
|
21
|
-
new CSSStyleSheet();
|
|
22
|
-
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
23
|
-
}
|
|
24
|
-
catch (e) { }
|
|
25
|
-
return false;
|
|
26
|
-
})()
|
|
27
|
-
;
|
|
28
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
29
|
-
if (listeners) {
|
|
30
|
-
listeners.map(([flags, name, method]) => {
|
|
31
|
-
const target = elm;
|
|
32
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
33
|
-
const opts = hostListenerOpts(flags);
|
|
34
|
-
plt.ael(target, name, handler, opts);
|
|
35
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
40
|
-
try {
|
|
41
|
-
{
|
|
42
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
43
|
-
// instance is ready, let's call it's member method for this event
|
|
44
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
consoleError(e);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
// prettier-ignore
|
|
56
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
57
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
58
|
-
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
59
15
|
const createTime = (fnName, tagName = '') => {
|
|
60
16
|
{
|
|
61
17
|
return () => {
|
|
@@ -70,76 +26,8 @@ const uniqueTime = (key, measureText) => {
|
|
|
70
26
|
};
|
|
71
27
|
}
|
|
72
28
|
};
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
let style = styles.get(scopeId);
|
|
76
|
-
if (supportsConstructableStylesheets && allowCS) {
|
|
77
|
-
style = (style || new CSSStyleSheet());
|
|
78
|
-
if (typeof style === 'string') {
|
|
79
|
-
style = cssText;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
style.replaceSync(cssText);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
style = cssText;
|
|
87
|
-
}
|
|
88
|
-
styles.set(scopeId, style);
|
|
89
|
-
};
|
|
90
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
91
|
-
let scopeId = getScopeId(cmpMeta);
|
|
92
|
-
const style = styles.get(scopeId);
|
|
93
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
94
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
95
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
96
|
-
if (style) {
|
|
97
|
-
if (typeof style === 'string') {
|
|
98
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
99
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
100
|
-
let styleElm;
|
|
101
|
-
if (!appliedStyles) {
|
|
102
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
103
|
-
}
|
|
104
|
-
if (!appliedStyles.has(scopeId)) {
|
|
105
|
-
{
|
|
106
|
-
{
|
|
107
|
-
styleElm = doc.createElement('style');
|
|
108
|
-
styleElm.innerHTML = style;
|
|
109
|
-
}
|
|
110
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
111
|
-
}
|
|
112
|
-
if (appliedStyles) {
|
|
113
|
-
appliedStyles.add(scopeId);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
118
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return scopeId;
|
|
122
|
-
};
|
|
123
|
-
const attachStyles = (hostRef) => {
|
|
124
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
125
|
-
const elm = hostRef.$hostElement$;
|
|
126
|
-
const flags = cmpMeta.$flags$;
|
|
127
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
128
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
129
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
130
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
131
|
-
// or this browser doesn't support native shadow dom
|
|
132
|
-
// and this host element was NOT created with SSR
|
|
133
|
-
// let's pick out the inner content for slot projection
|
|
134
|
-
// create a node to represent where the original
|
|
135
|
-
// content was first placed, which is useful later on
|
|
136
|
-
// DOM WRITE!!
|
|
137
|
-
elm['s-sc'] = scopeId;
|
|
138
|
-
elm.classList.add(scopeId + '-h');
|
|
139
|
-
}
|
|
140
|
-
endAttachStyles();
|
|
141
|
-
};
|
|
142
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
29
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
30
|
+
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
143
31
|
/**
|
|
144
32
|
* Default style mode id
|
|
145
33
|
*/
|
|
@@ -159,6 +47,18 @@ const isComplexType = (o) => {
|
|
|
159
47
|
o = typeof o;
|
|
160
48
|
return o === 'object' || o === 'function';
|
|
161
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* Helper method for querying a `meta` tag that contains a nonce value
|
|
52
|
+
* out of a DOM's head.
|
|
53
|
+
*
|
|
54
|
+
* @param doc The DOM containing the `head` to query against
|
|
55
|
+
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
|
56
|
+
* exists or the tag has no content.
|
|
57
|
+
*/
|
|
58
|
+
function queryNonceMetaTagContent(doc) {
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
|
61
|
+
}
|
|
162
62
|
/**
|
|
163
63
|
* Production h() function based on Preact by
|
|
164
64
|
* Jason Miller (@developit)
|
|
@@ -167,7 +67,6 @@ const isComplexType = (o) => {
|
|
|
167
67
|
*
|
|
168
68
|
* Modified for Stencil's compiler and vdom
|
|
169
69
|
*/
|
|
170
|
-
// const stack: any[] = [];
|
|
171
70
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
|
172
71
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
173
72
|
const h = (nodeName, vnodeData, ...children) => {
|
|
@@ -230,6 +129,14 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
230
129
|
}
|
|
231
130
|
return vnode;
|
|
232
131
|
};
|
|
132
|
+
/**
|
|
133
|
+
* A utility function for creating a virtual DOM node from a tag and some
|
|
134
|
+
* possible text content.
|
|
135
|
+
*
|
|
136
|
+
* @param tag the tag for this element
|
|
137
|
+
* @param text possible text content for the node
|
|
138
|
+
* @returns a newly-minted virtual DOM node
|
|
139
|
+
*/
|
|
233
140
|
const newVNode = (tag, text) => {
|
|
234
141
|
const vnode = {
|
|
235
142
|
$flags$: 0,
|
|
@@ -247,11 +154,31 @@ const newVNode = (tag, text) => {
|
|
|
247
154
|
return vnode;
|
|
248
155
|
};
|
|
249
156
|
const Host = {};
|
|
157
|
+
/**
|
|
158
|
+
* Check whether a given node is a Host node or not
|
|
159
|
+
*
|
|
160
|
+
* @param node the virtual DOM node to check
|
|
161
|
+
* @returns whether it's a Host node or not
|
|
162
|
+
*/
|
|
250
163
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
164
|
+
/**
|
|
165
|
+
* Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
|
|
166
|
+
*
|
|
167
|
+
* Note that these functions convert from {@link d.VNode} to
|
|
168
|
+
* {@link d.ChildNode} to give functional component developers a friendly
|
|
169
|
+
* interface.
|
|
170
|
+
*/
|
|
251
171
|
const vdomFnUtils = {
|
|
252
172
|
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
253
173
|
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
254
174
|
};
|
|
175
|
+
/**
|
|
176
|
+
* Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
|
|
177
|
+
* friendlier public interface (hence, 'convertToPublic').
|
|
178
|
+
*
|
|
179
|
+
* @param node the virtual DOM node to convert
|
|
180
|
+
* @returns a converted child node
|
|
181
|
+
*/
|
|
255
182
|
const convertToPublic = (node) => ({
|
|
256
183
|
vattrs: node.$attrs$,
|
|
257
184
|
vchildren: node.$children$,
|
|
@@ -260,6 +187,15 @@ const convertToPublic = (node) => ({
|
|
|
260
187
|
vtag: node.$tag$,
|
|
261
188
|
vtext: node.$text$,
|
|
262
189
|
});
|
|
190
|
+
/**
|
|
191
|
+
* Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
|
|
192
|
+
* order to use the resulting object in the virtual DOM. The initial object was
|
|
193
|
+
* likely created as part of presenting a public API, so converting it back
|
|
194
|
+
* involved making it 'private' again (hence, `convertToPrivate`).
|
|
195
|
+
*
|
|
196
|
+
* @param node the child node to convert
|
|
197
|
+
* @returns a converted virtual DOM node
|
|
198
|
+
*/
|
|
263
199
|
const convertToPrivate = (node) => {
|
|
264
200
|
if (typeof node.vtag === 'function') {
|
|
265
201
|
const vnodeData = Object.assign({}, node.vattrs);
|
|
@@ -278,6 +214,157 @@ const convertToPrivate = (node) => {
|
|
|
278
214
|
vnode.$name$ = node.vname;
|
|
279
215
|
return vnode;
|
|
280
216
|
};
|
|
217
|
+
/**
|
|
218
|
+
* Parse a new property value for a given property type.
|
|
219
|
+
*
|
|
220
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
221
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
222
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
223
|
+
* 2. the type stored from `propType`.
|
|
224
|
+
*
|
|
225
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
226
|
+
*
|
|
227
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
228
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
229
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
230
|
+
* ```tsx
|
|
231
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* HTML prop values on the other hand, will always a string
|
|
235
|
+
*
|
|
236
|
+
* @param propValue the new value to coerce to some type
|
|
237
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
238
|
+
* @returns the parsed/coerced value
|
|
239
|
+
*/
|
|
240
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
241
|
+
// ensure this value is of the correct prop type
|
|
242
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
243
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
244
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
245
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
246
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
247
|
+
}
|
|
248
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
249
|
+
// force it to be a number
|
|
250
|
+
return parseFloat(propValue);
|
|
251
|
+
}
|
|
252
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
253
|
+
// could have been passed as a number or boolean
|
|
254
|
+
// but we still want it as a string
|
|
255
|
+
return String(propValue);
|
|
256
|
+
}
|
|
257
|
+
// redundant return here for better minification
|
|
258
|
+
return propValue;
|
|
259
|
+
}
|
|
260
|
+
// not sure exactly what type we want
|
|
261
|
+
// so no need to change to a different type
|
|
262
|
+
return propValue;
|
|
263
|
+
};
|
|
264
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
265
|
+
const createEvent = (ref, name, flags) => {
|
|
266
|
+
const elm = getElement(ref);
|
|
267
|
+
return {
|
|
268
|
+
emit: (detail) => {
|
|
269
|
+
return emitEvent(elm, name, {
|
|
270
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
271
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
272
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
273
|
+
detail,
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
280
|
+
* @param elm the target of the Event
|
|
281
|
+
* @param name the name to give the custom Event
|
|
282
|
+
* @param opts options for configuring a custom Event
|
|
283
|
+
* @returns the custom Event
|
|
284
|
+
*/
|
|
285
|
+
const emitEvent = (elm, name, opts) => {
|
|
286
|
+
const ev = plt.ce(name, opts);
|
|
287
|
+
elm.dispatchEvent(ev);
|
|
288
|
+
return ev;
|
|
289
|
+
};
|
|
290
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
291
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
292
|
+
let style = styles.get(scopeId);
|
|
293
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
294
|
+
style = (style || new CSSStyleSheet());
|
|
295
|
+
if (typeof style === 'string') {
|
|
296
|
+
style = cssText;
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
style.replaceSync(cssText);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
style = cssText;
|
|
304
|
+
}
|
|
305
|
+
styles.set(scopeId, style);
|
|
306
|
+
};
|
|
307
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
308
|
+
var _a;
|
|
309
|
+
let scopeId = getScopeId(cmpMeta);
|
|
310
|
+
const style = styles.get(scopeId);
|
|
311
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
312
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
313
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
314
|
+
if (style) {
|
|
315
|
+
if (typeof style === 'string') {
|
|
316
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
317
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
318
|
+
let styleElm;
|
|
319
|
+
if (!appliedStyles) {
|
|
320
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
321
|
+
}
|
|
322
|
+
if (!appliedStyles.has(scopeId)) {
|
|
323
|
+
{
|
|
324
|
+
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
325
|
+
{
|
|
326
|
+
styleElm = doc.createElement('style');
|
|
327
|
+
styleElm.innerHTML = style;
|
|
328
|
+
}
|
|
329
|
+
// Apply CSP nonce to the style tag if it exists
|
|
330
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
331
|
+
if (nonce != null) {
|
|
332
|
+
styleElm.setAttribute('nonce', nonce);
|
|
333
|
+
}
|
|
334
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
335
|
+
}
|
|
336
|
+
if (appliedStyles) {
|
|
337
|
+
appliedStyles.add(scopeId);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
342
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return scopeId;
|
|
346
|
+
};
|
|
347
|
+
const attachStyles = (hostRef) => {
|
|
348
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
349
|
+
const elm = hostRef.$hostElement$;
|
|
350
|
+
const flags = cmpMeta.$flags$;
|
|
351
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
352
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
353
|
+
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
354
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
355
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
356
|
+
// or this browser doesn't support native shadow dom
|
|
357
|
+
// and this host element was NOT created with SSR
|
|
358
|
+
// let's pick out the inner content for slot projection
|
|
359
|
+
// create a node to represent where the original
|
|
360
|
+
// content was first placed, which is useful later on
|
|
361
|
+
// DOM WRITE!!
|
|
362
|
+
elm['s-sc'] = scopeId;
|
|
363
|
+
elm.classList.add(scopeId + '-h');
|
|
364
|
+
}
|
|
365
|
+
endAttachStyles();
|
|
366
|
+
};
|
|
367
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
281
368
|
/**
|
|
282
369
|
* Production setAccessor() function based on Preact by
|
|
283
370
|
* Jason Miller (@developit)
|
|
@@ -414,7 +501,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
414
501
|
}
|
|
415
502
|
}
|
|
416
503
|
}
|
|
417
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
504
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
418
505
|
newValue = newValue === true ? '' : newValue;
|
|
419
506
|
if (xlink) {
|
|
420
507
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
@@ -432,7 +519,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
432
519
|
// if the element passed in is a shadow root, which is a document fragment
|
|
433
520
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
434
521
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
435
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
522
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
436
523
|
? newVnode.$elm$.host
|
|
437
524
|
: newVnode.$elm$;
|
|
438
525
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -450,6 +537,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
450
537
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
451
538
|
}
|
|
452
539
|
};
|
|
540
|
+
/**
|
|
541
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
542
|
+
*
|
|
543
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
544
|
+
* @param newParentVNode the parent VNode from the current render
|
|
545
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
546
|
+
* children, for which we will create a new DOM node
|
|
547
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
548
|
+
* @returns the newly created node
|
|
549
|
+
*/
|
|
453
550
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
454
551
|
// tslint:disable-next-line: prefer-const
|
|
455
552
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
@@ -503,6 +600,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
503
600
|
}
|
|
504
601
|
return elm;
|
|
505
602
|
};
|
|
603
|
+
/**
|
|
604
|
+
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
605
|
+
* add them to the DOM in the appropriate place.
|
|
606
|
+
*
|
|
607
|
+
* @param parentElm the DOM node which should be used as a parent for the new
|
|
608
|
+
* DOM nodes
|
|
609
|
+
* @param before a child of the `parentElm` which the new children should be
|
|
610
|
+
* inserted before (optional)
|
|
611
|
+
* @param parentVNode the parent virtual DOM node
|
|
612
|
+
* @param vnodes the new child virtual DOM nodes to produce DOM nodes for
|
|
613
|
+
* @param startIdx the index in the child virtual DOM nodes at which to start
|
|
614
|
+
* creating DOM nodes (inclusive)
|
|
615
|
+
* @param endIdx the index in the child virtual DOM nodes at which to stop
|
|
616
|
+
* creating DOM nodes (inclusive)
|
|
617
|
+
*/
|
|
506
618
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
507
619
|
let containerElm = (parentElm);
|
|
508
620
|
let childNode;
|
|
@@ -519,6 +631,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
519
631
|
}
|
|
520
632
|
}
|
|
521
633
|
};
|
|
634
|
+
/**
|
|
635
|
+
* Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
|
|
636
|
+
* This can be used to, for instance, clean up after a list of children which
|
|
637
|
+
* should no longer be shown.
|
|
638
|
+
*
|
|
639
|
+
* This function also handles some of Stencil's slot relocation logic.
|
|
640
|
+
*
|
|
641
|
+
* @param vnodes a list of virtual DOM nodes to remove
|
|
642
|
+
* @param startIdx the index at which to start removing nodes (inclusive)
|
|
643
|
+
* @param endIdx the index at which to stop removing nodes (inclusive)
|
|
644
|
+
* @param vnode a VNode
|
|
645
|
+
* @param elm an element
|
|
646
|
+
*/
|
|
522
647
|
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
523
648
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
524
649
|
if ((vnode = vnodes[startIdx])) {
|
|
@@ -529,6 +654,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
529
654
|
}
|
|
530
655
|
}
|
|
531
656
|
};
|
|
657
|
+
/**
|
|
658
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
659
|
+
* traversing the two collections of children, identifying nodes that are
|
|
660
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
661
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
662
|
+
*
|
|
663
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
664
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
665
|
+
* 'windows' by storing start and end indices and references to the
|
|
666
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
667
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
668
|
+
* no children left to update by doing the following:
|
|
669
|
+
*
|
|
670
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
671
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
672
|
+
* only with a window bounded by the highlighted elements:
|
|
673
|
+
*
|
|
674
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
675
|
+
* ^^^^^^ ^^^^^^
|
|
676
|
+
*
|
|
677
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
678
|
+
* across the windows. This will basically detect elements which haven't
|
|
679
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
680
|
+
* VNode elements (represented as HTML):
|
|
681
|
+
*
|
|
682
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
683
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
684
|
+
*
|
|
685
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
686
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
687
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
688
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
689
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
690
|
+
*
|
|
691
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
692
|
+
* window corresponds to the element at the end of the other window. This is
|
|
693
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
694
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
695
|
+
* children nodes themselves have not changed but merely moved in the
|
|
696
|
+
* following example:
|
|
697
|
+
*
|
|
698
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
699
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
700
|
+
*
|
|
701
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
702
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
703
|
+
* DOM.
|
|
704
|
+
*
|
|
705
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
706
|
+
* nodes in the old children which have the same key as the first element in
|
|
707
|
+
* our window on the new children. If we find such a node we handle calling
|
|
708
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
709
|
+
* what we find.
|
|
710
|
+
*
|
|
711
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
712
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
713
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
714
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
715
|
+
* children has collapsed we still have more nodes on the new children that
|
|
716
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
717
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
718
|
+
* sure the corresponding DOM nodes are removed.
|
|
719
|
+
*
|
|
720
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
721
|
+
* @param oldCh the old children of the parent node
|
|
722
|
+
* @param newVNode the new VNode which will replace the parent
|
|
723
|
+
* @param newCh the new children of the parent node
|
|
724
|
+
*/
|
|
532
725
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
533
726
|
let oldStartIdx = 0;
|
|
534
727
|
let newStartIdx = 0;
|
|
@@ -544,7 +737,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
544
737
|
let elmToMove;
|
|
545
738
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
546
739
|
if (oldStartVnode == null) {
|
|
547
|
-
//
|
|
740
|
+
// VNode might have been moved left
|
|
548
741
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
549
742
|
}
|
|
550
743
|
else if (oldEndVnode == null) {
|
|
@@ -557,29 +750,65 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
557
750
|
newEndVnode = newCh[--newEndIdx];
|
|
558
751
|
}
|
|
559
752
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
753
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
754
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
755
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
756
|
+
// since things are matched up in order.
|
|
560
757
|
patch(oldStartVnode, newStartVnode);
|
|
561
758
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
562
759
|
newStartVnode = newCh[++newStartIdx];
|
|
563
760
|
}
|
|
564
761
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
762
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
763
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
764
|
+
// need to move any DOM Nodes.
|
|
565
765
|
patch(oldEndVnode, newEndVnode);
|
|
566
766
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
567
767
|
newEndVnode = newCh[--newEndIdx];
|
|
568
768
|
}
|
|
569
769
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
570
770
|
patch(oldStartVnode, newEndVnode);
|
|
771
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
772
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
773
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
774
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
775
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
776
|
+
//
|
|
777
|
+
// <old-start-node />
|
|
778
|
+
// <some-intervening-node />
|
|
779
|
+
// <old-end-node />
|
|
780
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
781
|
+
// <next-sibling />
|
|
782
|
+
//
|
|
783
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
784
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
785
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
786
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
787
|
+
// append it to the children of the parent element.
|
|
571
788
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
572
789
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
573
790
|
newEndVnode = newCh[--newEndIdx];
|
|
574
791
|
}
|
|
575
792
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
576
793
|
patch(oldEndVnode, newStartVnode);
|
|
794
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
795
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
796
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
797
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
798
|
+
// future.
|
|
577
799
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
578
800
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
579
801
|
newStartVnode = newCh[++newStartIdx];
|
|
580
802
|
}
|
|
581
803
|
else {
|
|
582
|
-
//
|
|
804
|
+
// Here we do some checks to match up old and new nodes based on the
|
|
805
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
|
806
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
|
807
|
+
// component.
|
|
808
|
+
//
|
|
809
|
+
// First we check to see if there are any nodes in the array of old
|
|
810
|
+
// children which have the same key as the first node in the new
|
|
811
|
+
// children.
|
|
583
812
|
idxInOld = -1;
|
|
584
813
|
{
|
|
585
814
|
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
@@ -590,23 +819,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
590
819
|
}
|
|
591
820
|
}
|
|
592
821
|
if (idxInOld >= 0) {
|
|
822
|
+
// We found a node in the old children which matches up with the first
|
|
823
|
+
// node in the new children! So let's deal with that
|
|
593
824
|
elmToMove = oldCh[idxInOld];
|
|
594
825
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
826
|
+
// the tag doesn't match so we'll need a new DOM element
|
|
595
827
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
596
828
|
}
|
|
597
829
|
else {
|
|
598
830
|
patch(elmToMove, newStartVnode);
|
|
831
|
+
// invalidate the matching old node so that we won't try to update it
|
|
832
|
+
// again later on
|
|
599
833
|
oldCh[idxInOld] = undefined;
|
|
600
834
|
node = elmToMove.$elm$;
|
|
601
835
|
}
|
|
602
836
|
newStartVnode = newCh[++newStartIdx];
|
|
603
837
|
}
|
|
604
838
|
else {
|
|
605
|
-
//
|
|
839
|
+
// We either didn't find an element in the old children that matches
|
|
840
|
+
// the key of the first new child OR the build is not using `key`
|
|
841
|
+
// attributes at all. In either case we need to create a new element
|
|
842
|
+
// for the new node.
|
|
606
843
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
607
844
|
newStartVnode = newCh[++newStartIdx];
|
|
608
845
|
}
|
|
609
846
|
if (node) {
|
|
847
|
+
// if we created a new node then handle inserting it to the DOM
|
|
610
848
|
{
|
|
611
849
|
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
612
850
|
}
|
|
@@ -614,22 +852,53 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
614
852
|
}
|
|
615
853
|
}
|
|
616
854
|
if (oldStartIdx > oldEndIdx) {
|
|
855
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
617
856
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
618
857
|
}
|
|
619
858
|
else if (newStartIdx > newEndIdx) {
|
|
859
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
860
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
861
|
+
// relevant DOM nodes)
|
|
620
862
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
621
863
|
}
|
|
622
864
|
};
|
|
623
|
-
|
|
865
|
+
/**
|
|
866
|
+
* Compare two VNodes to determine if they are the same
|
|
867
|
+
*
|
|
868
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
869
|
+
* information set on the two VNodes and can be misleading under certain
|
|
870
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
871
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
872
|
+
* checking that they have the same tag.
|
|
873
|
+
*
|
|
874
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
875
|
+
* changing order within a `children` array or something along those lines then
|
|
876
|
+
* we could obtain a false negative and then have to do needless re-rendering
|
|
877
|
+
* (i.e. we'd say two VNodes aren't equal when in fact they should be).
|
|
878
|
+
*
|
|
879
|
+
* @param leftVNode the first VNode to check
|
|
880
|
+
* @param rightVNode the second VNode to check
|
|
881
|
+
* @returns whether they're equal or not
|
|
882
|
+
*/
|
|
883
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
624
884
|
// compare if two vnode to see if they're "technically" the same
|
|
625
885
|
// need to have the same element tag, and same key to be the same
|
|
626
|
-
if (
|
|
886
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
887
|
+
// this will be set if components in the build have `key` attrs set on them
|
|
627
888
|
{
|
|
628
|
-
return
|
|
889
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
629
890
|
}
|
|
630
891
|
}
|
|
631
892
|
return false;
|
|
632
893
|
};
|
|
894
|
+
/**
|
|
895
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
896
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
897
|
+
* children of the two nodes (if any).
|
|
898
|
+
*
|
|
899
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
900
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
901
|
+
*/
|
|
633
902
|
const patch = (oldVNode, newVNode) => {
|
|
634
903
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
635
904
|
const oldChildren = oldVNode.$children$;
|
|
@@ -642,7 +911,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
642
911
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
643
912
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
644
913
|
}
|
|
645
|
-
// element node
|
|
646
914
|
{
|
|
647
915
|
if (tag === 'slot')
|
|
648
916
|
;
|
|
@@ -655,6 +923,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
655
923
|
}
|
|
656
924
|
if (oldChildren !== null && newChildren !== null) {
|
|
657
925
|
// looks like there's child vnodes for both the old and new vnodes
|
|
926
|
+
// so we need to call `updateChildren` to reconcile them
|
|
658
927
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
659
928
|
}
|
|
660
929
|
else if (newChildren !== null) {
|
|
@@ -686,6 +955,18 @@ const callNodeRefs = (vNode) => {
|
|
|
686
955
|
vNode.$children$ && vNode.$children$.map(callNodeRefs);
|
|
687
956
|
}
|
|
688
957
|
};
|
|
958
|
+
/**
|
|
959
|
+
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
960
|
+
*
|
|
961
|
+
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
|
962
|
+
* function will handle creating a virtual DOM tree with a single root, patching
|
|
963
|
+
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
|
964
|
+
* relocation, and reflecting attributes.
|
|
965
|
+
*
|
|
966
|
+
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
967
|
+
* the DOM node into which it should be rendered.
|
|
968
|
+
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
969
|
+
*/
|
|
689
970
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
690
971
|
const hostElm = hostRef.$hostElement$;
|
|
691
972
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -697,7 +978,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
697
978
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
698
979
|
}
|
|
699
980
|
rootVnode.$tag$ = null;
|
|
700
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
981
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
701
982
|
hostRef.$vnode$ = rootVnode;
|
|
702
983
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
703
984
|
{
|
|
@@ -706,32 +987,6 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
706
987
|
// synchronous patch
|
|
707
988
|
patch(oldVNode, rootVnode);
|
|
708
989
|
};
|
|
709
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
710
|
-
const createEvent = (ref, name, flags) => {
|
|
711
|
-
const elm = getElement(ref);
|
|
712
|
-
return {
|
|
713
|
-
emit: (detail) => {
|
|
714
|
-
return emitEvent(elm, name, {
|
|
715
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
716
|
-
composed: !!(flags & 2 /* Composed */),
|
|
717
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
718
|
-
detail,
|
|
719
|
-
});
|
|
720
|
-
},
|
|
721
|
-
};
|
|
722
|
-
};
|
|
723
|
-
/**
|
|
724
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
725
|
-
* @param elm the target of the Event
|
|
726
|
-
* @param name the name to give the custom Event
|
|
727
|
-
* @param opts options for configuring a custom Event
|
|
728
|
-
* @returns the custom Event
|
|
729
|
-
*/
|
|
730
|
-
const emitEvent = (elm, name, opts) => {
|
|
731
|
-
const ev = plt.ce(name, opts);
|
|
732
|
-
elm.dispatchEvent(ev);
|
|
733
|
-
return ev;
|
|
734
|
-
};
|
|
735
990
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
736
991
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
737
992
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
@@ -739,10 +994,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
739
994
|
};
|
|
740
995
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
741
996
|
{
|
|
742
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
997
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
743
998
|
}
|
|
744
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
745
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
999
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1000
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
746
1001
|
return;
|
|
747
1002
|
}
|
|
748
1003
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -758,7 +1013,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
758
1013
|
let promise;
|
|
759
1014
|
if (isInitialLoad) {
|
|
760
1015
|
{
|
|
761
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1016
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
762
1017
|
if (hostRef.$queuedListeners$) {
|
|
763
1018
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
764
1019
|
hostRef.$queuedListeners$ = null;
|
|
@@ -804,7 +1059,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
804
1059
|
}
|
|
805
1060
|
else {
|
|
806
1061
|
Promise.all(childrenPromises).then(postUpdate);
|
|
807
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
1062
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
808
1063
|
childrenPromises.length = 0;
|
|
809
1064
|
}
|
|
810
1065
|
}
|
|
@@ -813,10 +1068,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
813
1068
|
try {
|
|
814
1069
|
instance = instance.render() ;
|
|
815
1070
|
{
|
|
816
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1071
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
817
1072
|
}
|
|
818
1073
|
{
|
|
819
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1074
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
820
1075
|
}
|
|
821
1076
|
{
|
|
822
1077
|
{
|
|
@@ -843,8 +1098,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
843
1098
|
{
|
|
844
1099
|
safeCall(instance, 'componentDidRender');
|
|
845
1100
|
}
|
|
846
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
847
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1101
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1102
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
848
1103
|
{
|
|
849
1104
|
// DOM WRITE!
|
|
850
1105
|
addHydratedFlag(elm);
|
|
@@ -873,10 +1128,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
873
1128
|
hostRef.$onRenderResolve$();
|
|
874
1129
|
hostRef.$onRenderResolve$ = undefined;
|
|
875
1130
|
}
|
|
876
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
1131
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
877
1132
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
878
1133
|
}
|
|
879
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1134
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
880
1135
|
}
|
|
881
1136
|
// ( •_•)
|
|
882
1137
|
// ( •_•)>⌐■-■
|
|
@@ -906,53 +1161,6 @@ const then = (promise, thenFn) => {
|
|
|
906
1161
|
};
|
|
907
1162
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
908
1163
|
;
|
|
909
|
-
/**
|
|
910
|
-
* Parse a new property value for a given property type.
|
|
911
|
-
*
|
|
912
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
913
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
914
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
915
|
-
* 2. the type stored from `propType`.
|
|
916
|
-
*
|
|
917
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
918
|
-
*
|
|
919
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
920
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
921
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
922
|
-
* ```tsx
|
|
923
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
924
|
-
* ```
|
|
925
|
-
*
|
|
926
|
-
* HTML prop values on the other hand, will always a string
|
|
927
|
-
*
|
|
928
|
-
* @param propValue the new value to coerce to some type
|
|
929
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
930
|
-
* @returns the parsed/coerced value
|
|
931
|
-
*/
|
|
932
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
933
|
-
// ensure this value is of the correct prop type
|
|
934
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
935
|
-
if (propType & 4 /* Boolean */) {
|
|
936
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
937
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
938
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
939
|
-
}
|
|
940
|
-
if (propType & 2 /* Number */) {
|
|
941
|
-
// force it to be a number
|
|
942
|
-
return parseFloat(propValue);
|
|
943
|
-
}
|
|
944
|
-
if (propType & 1 /* String */) {
|
|
945
|
-
// could have been passed as a number or boolean
|
|
946
|
-
// but we still want it as a string
|
|
947
|
-
return String(propValue);
|
|
948
|
-
}
|
|
949
|
-
// redundant return here for better minification
|
|
950
|
-
return propValue;
|
|
951
|
-
}
|
|
952
|
-
// not sure exactly what type we want
|
|
953
|
-
// so no need to change to a different type
|
|
954
|
-
return propValue;
|
|
955
|
-
};
|
|
956
1164
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
957
1165
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
958
1166
|
// check our new property value against our internal value
|
|
@@ -965,13 +1173,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
965
1173
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
966
1174
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
967
1175
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
968
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1176
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
969
1177
|
// gadzooks! the property's value has changed!!
|
|
970
1178
|
// set our new value!
|
|
971
1179
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
972
1180
|
if (instance) {
|
|
973
1181
|
// get an array of method names of watch functions to call
|
|
974
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1182
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
975
1183
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
976
1184
|
if (watchMethods) {
|
|
977
1185
|
// this instance is watching for when this property changed
|
|
@@ -986,7 +1194,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
986
1194
|
});
|
|
987
1195
|
}
|
|
988
1196
|
}
|
|
989
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1197
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
990
1198
|
// looks like this value actually changed, so we've got work to do!
|
|
991
1199
|
// but only if we've already rendered, otherwise just chill out
|
|
992
1200
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -996,6 +1204,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
996
1204
|
}
|
|
997
1205
|
}
|
|
998
1206
|
};
|
|
1207
|
+
/**
|
|
1208
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
1209
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
1210
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
1211
|
+
*
|
|
1212
|
+
* @param Cstr the constructor for a component that we need to process
|
|
1213
|
+
* @param cmpMeta metadata collected previously about the component
|
|
1214
|
+
* @param flags a number used to store a series of bit flags
|
|
1215
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1216
|
+
*/
|
|
999
1217
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1000
1218
|
if (cmpMeta.$members$) {
|
|
1001
1219
|
if (Cstr.watchers) {
|
|
@@ -1005,8 +1223,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1005
1223
|
const members = Object.entries(cmpMeta.$members$);
|
|
1006
1224
|
const prototype = Cstr.prototype;
|
|
1007
1225
|
members.map(([memberName, [memberFlags]]) => {
|
|
1008
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
1009
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1226
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1227
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1010
1228
|
// proxyComponent - prop
|
|
1011
1229
|
Object.defineProperty(prototype, memberName, {
|
|
1012
1230
|
get() {
|
|
@@ -1021,8 +1239,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1021
1239
|
enumerable: true,
|
|
1022
1240
|
});
|
|
1023
1241
|
}
|
|
1024
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
1025
|
-
memberFlags & 64 /* Method */) {
|
|
1242
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1243
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
1026
1244
|
// proxyComponent - method
|
|
1027
1245
|
Object.defineProperty(prototype, memberName, {
|
|
1028
1246
|
value(...args) {
|
|
@@ -1032,7 +1250,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1032
1250
|
});
|
|
1033
1251
|
}
|
|
1034
1252
|
});
|
|
1035
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1253
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1036
1254
|
const attrNameToPropName = new Map();
|
|
1037
1255
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1038
1256
|
plt.jmp(() => {
|
|
@@ -1088,11 +1306,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1088
1306
|
// create an array of attributes to observe
|
|
1089
1307
|
// and also create a map of html attribute name to js property name
|
|
1090
1308
|
Cstr.observedAttributes = members
|
|
1091
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1309
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1092
1310
|
.map(([propName, m]) => {
|
|
1093
1311
|
const attrName = m[1] || propName;
|
|
1094
1312
|
attrNameToPropName.set(attrName, propName);
|
|
1095
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1313
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1096
1314
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1097
1315
|
}
|
|
1098
1316
|
return attrName;
|
|
@@ -1103,10 +1321,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1103
1321
|
};
|
|
1104
1322
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1105
1323
|
// initializeComponent
|
|
1106
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1324
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1107
1325
|
{
|
|
1108
1326
|
// we haven't initialized this element yet
|
|
1109
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1327
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1110
1328
|
// lazy loaded components
|
|
1111
1329
|
// request the component's implementation to be
|
|
1112
1330
|
// wired up with the host element
|
|
@@ -1124,7 +1342,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1124
1342
|
{
|
|
1125
1343
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1126
1344
|
}
|
|
1127
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1345
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1128
1346
|
Cstr.isProxied = true;
|
|
1129
1347
|
}
|
|
1130
1348
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1132,7 +1350,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1132
1350
|
// but let's keep track of when we start and stop
|
|
1133
1351
|
// so that the getters/setters don't incorrectly step on data
|
|
1134
1352
|
{
|
|
1135
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1353
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1136
1354
|
}
|
|
1137
1355
|
// construct the lazy-loaded component implementation
|
|
1138
1356
|
// passing the hostRef is very important during
|
|
@@ -1145,10 +1363,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1145
1363
|
consoleError(e);
|
|
1146
1364
|
}
|
|
1147
1365
|
{
|
|
1148
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1366
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1149
1367
|
}
|
|
1150
1368
|
{
|
|
1151
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1369
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1152
1370
|
}
|
|
1153
1371
|
endNewInstance();
|
|
1154
1372
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
@@ -1159,7 +1377,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1159
1377
|
const scopeId = getScopeId(cmpMeta);
|
|
1160
1378
|
if (!styles.has(scopeId)) {
|
|
1161
1379
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1162
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1380
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1163
1381
|
endRegisterStyles();
|
|
1164
1382
|
}
|
|
1165
1383
|
}
|
|
@@ -1186,13 +1404,13 @@ const fireConnectedCallback = (instance) => {
|
|
|
1186
1404
|
}
|
|
1187
1405
|
};
|
|
1188
1406
|
const connectedCallback = (elm) => {
|
|
1189
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1407
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1190
1408
|
const hostRef = getHostRef(elm);
|
|
1191
1409
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1192
1410
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1193
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1411
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1194
1412
|
// first time this component has connected
|
|
1195
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1413
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1196
1414
|
{
|
|
1197
1415
|
// find the first ancestor component (if there is one) and register
|
|
1198
1416
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1212,7 +1430,7 @@ const connectedCallback = (elm) => {
|
|
|
1212
1430
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1213
1431
|
if (cmpMeta.$members$) {
|
|
1214
1432
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1215
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1433
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1216
1434
|
const value = elm[memberName];
|
|
1217
1435
|
delete elm[memberName];
|
|
1218
1436
|
elm[memberName] = value;
|
|
@@ -1235,7 +1453,7 @@ const connectedCallback = (elm) => {
|
|
|
1235
1453
|
}
|
|
1236
1454
|
};
|
|
1237
1455
|
const disconnectedCallback = (elm) => {
|
|
1238
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1456
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1239
1457
|
const hostRef = getHostRef(elm);
|
|
1240
1458
|
const instance = hostRef.$lazyInstance$ ;
|
|
1241
1459
|
{
|
|
@@ -1250,6 +1468,7 @@ const disconnectedCallback = (elm) => {
|
|
|
1250
1468
|
}
|
|
1251
1469
|
};
|
|
1252
1470
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1471
|
+
var _a;
|
|
1253
1472
|
const endBootstrap = createTime();
|
|
1254
1473
|
const cmpTags = [];
|
|
1255
1474
|
const exclude = options.exclude || [];
|
|
@@ -1290,7 +1509,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1290
1509
|
super(self);
|
|
1291
1510
|
self = this;
|
|
1292
1511
|
registerHost(self, cmpMeta);
|
|
1293
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1512
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1294
1513
|
// this component is using shadow dom
|
|
1295
1514
|
// and this browser supports shadow dom
|
|
1296
1515
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1325,13 +1544,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1325
1544
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1326
1545
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1327
1546
|
cmpTags.push(tagName);
|
|
1328
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1547
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1329
1548
|
}
|
|
1330
1549
|
});
|
|
1331
1550
|
});
|
|
1332
1551
|
{
|
|
1333
1552
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
1334
1553
|
visibilityStyle.setAttribute('data-styles', '');
|
|
1554
|
+
// Apply CSP nonce to the style tag if it exists
|
|
1555
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
1556
|
+
if (nonce != null) {
|
|
1557
|
+
visibilityStyle.setAttribute('nonce', nonce);
|
|
1558
|
+
}
|
|
1335
1559
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
1336
1560
|
}
|
|
1337
1561
|
// Process deferred connectedCallbacks now all components have been registered
|
|
@@ -1347,7 +1571,43 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1347
1571
|
// Fallback appLoad event
|
|
1348
1572
|
endBootstrap();
|
|
1349
1573
|
};
|
|
1350
|
-
const
|
|
1574
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1575
|
+
if (listeners) {
|
|
1576
|
+
listeners.map(([flags, name, method]) => {
|
|
1577
|
+
const target = elm;
|
|
1578
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1579
|
+
const opts = hostListenerOpts(flags);
|
|
1580
|
+
plt.ael(target, name, handler, opts);
|
|
1581
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1585
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1586
|
+
try {
|
|
1587
|
+
{
|
|
1588
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1589
|
+
// instance is ready, let's call it's member method for this event
|
|
1590
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1591
|
+
}
|
|
1592
|
+
else {
|
|
1593
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
catch (e) {
|
|
1598
|
+
consoleError(e);
|
|
1599
|
+
}
|
|
1600
|
+
};
|
|
1601
|
+
// prettier-ignore
|
|
1602
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1603
|
+
/**
|
|
1604
|
+
* Assigns the given value to the nonce property on the runtime platform object.
|
|
1605
|
+
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
1606
|
+
* @param nonce The value to be assigned to the platform nonce property.
|
|
1607
|
+
* @returns void
|
|
1608
|
+
*/
|
|
1609
|
+
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
1610
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1351
1611
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1352
1612
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1353
1613
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1392,14 +1652,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1392
1652
|
return importedModule[exportName];
|
|
1393
1653
|
}, consoleError);
|
|
1394
1654
|
};
|
|
1395
|
-
const styles = new Map();
|
|
1655
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1656
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
1657
|
+
const doc = win.document || { head: {} };
|
|
1658
|
+
const plt = {
|
|
1659
|
+
$flags$: 0,
|
|
1660
|
+
$resourcesUrl$: '',
|
|
1661
|
+
jmp: (h) => h(),
|
|
1662
|
+
raf: (h) => requestAnimationFrame(h),
|
|
1663
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
1664
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
1665
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
1666
|
+
};
|
|
1667
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
1668
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
1669
|
+
try {
|
|
1670
|
+
new CSSStyleSheet();
|
|
1671
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
1672
|
+
}
|
|
1673
|
+
catch (e) { }
|
|
1674
|
+
return false;
|
|
1675
|
+
})()
|
|
1676
|
+
;
|
|
1396
1677
|
const queueDomReads = [];
|
|
1397
1678
|
const queueDomWrites = [];
|
|
1398
1679
|
const queueTask = (queue, write) => (cb) => {
|
|
1399
1680
|
queue.push(cb);
|
|
1400
1681
|
if (!queuePending) {
|
|
1401
1682
|
queuePending = true;
|
|
1402
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1683
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1403
1684
|
nextTick(flush);
|
|
1404
1685
|
}
|
|
1405
1686
|
else {
|
|
@@ -1436,6 +1717,6 @@ const flush = () => {
|
|
|
1436
1717
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1437
1718
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1438
1719
|
|
|
1439
|
-
export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };
|
|
1720
|
+
export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
1440
1721
|
|
|
1441
|
-
//# sourceMappingURL=index-
|
|
1722
|
+
//# sourceMappingURL=index-fc2f91a4.js.map
|