ku4web-components 6.7.12 → 6.7.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. package/LICENSE +7 -10
  2. package/angular/index.js +1 -3
  3. package/angular/index.mjs +1 -1
  4. package/dist/cjs/{index-8b7230db.js → index-15875e65.js} +458 -273
  5. package/dist/cjs/index-3f6b12f6.js +10 -0
  6. package/dist/cjs/ku4-carousel-controls.cjs.entry.js +1 -1
  7. package/dist/cjs/ku4-carousel-slide.cjs.entry.js +1 -1
  8. package/dist/cjs/ku4-carousel.cjs.entry.js +2 -2
  9. package/dist/cjs/ku4-col.cjs.entry.js +1 -1
  10. package/dist/cjs/ku4-drawer.cjs.entry.js +1 -1
  11. package/dist/cjs/ku4-feature.cjs.entry.js +1 -1
  12. package/dist/cjs/ku4-focus-trap.cjs.entry.js +2 -2
  13. package/dist/cjs/ku4-form.cjs.entry.js +2 -2
  14. package/dist/cjs/ku4-grid.cjs.entry.js +1 -1
  15. package/dist/cjs/ku4-label.cjs.entry.js +1 -1
  16. package/dist/cjs/ku4-mask.cjs.entry.js +1 -1
  17. package/dist/cjs/ku4-modal.cjs.entry.js +2 -2
  18. package/dist/cjs/ku4-panel.cjs.entry.js +1 -1
  19. package/dist/cjs/ku4-preview.cjs.entry.js +2 -2
  20. package/dist/cjs/ku4-tab-list.cjs.entry.js +2 -2
  21. package/dist/cjs/ku4-tab-panel.cjs.entry.js +1 -1
  22. package/dist/cjs/ku4-tab.cjs.entry.js +1 -1
  23. package/dist/cjs/ku4-table.cjs.entry.js +1 -1
  24. package/dist/cjs/ku4-tooltip.cjs.entry.js +1 -1
  25. package/dist/cjs/ku4-validation.cjs.entry.js +1 -1
  26. package/dist/cjs/ku4web-components.cjs.js +2 -2
  27. package/dist/cjs/loader.cjs.js +2 -2
  28. package/dist/cjs/{shadow-css-cf936b02.js → shadow-css-346c0795.js} +1 -1
  29. package/dist/esm/{index-ed88cd9f.js → index-906433aa.js} +458 -273
  30. package/dist/esm/index-b9d8468a.js +3 -0
  31. package/dist/esm/ku4-carousel-controls.entry.js +1 -1
  32. package/dist/esm/ku4-carousel-slide.entry.js +1 -1
  33. package/dist/esm/ku4-carousel.entry.js +2 -2
  34. package/dist/esm/ku4-col.entry.js +1 -1
  35. package/dist/esm/ku4-drawer.entry.js +1 -1
  36. package/dist/esm/ku4-feature.entry.js +1 -1
  37. package/dist/esm/ku4-focus-trap.entry.js +2 -2
  38. package/dist/esm/ku4-form.entry.js +2 -2
  39. package/dist/esm/ku4-grid.entry.js +1 -1
  40. package/dist/esm/ku4-label.entry.js +1 -1
  41. package/dist/esm/ku4-mask.entry.js +1 -1
  42. package/dist/esm/ku4-modal.entry.js +2 -2
  43. package/dist/esm/ku4-panel.entry.js +1 -1
  44. package/dist/esm/ku4-preview.entry.js +2 -2
  45. package/dist/esm/ku4-tab-list.entry.js +2 -2
  46. package/dist/esm/ku4-tab-panel.entry.js +1 -1
  47. package/dist/esm/ku4-tab.entry.js +1 -1
  48. package/dist/esm/ku4-table.entry.js +1 -1
  49. package/dist/esm/ku4-tooltip.entry.js +1 -1
  50. package/dist/esm/ku4-validation.entry.js +1 -1
  51. package/dist/esm/ku4web-components.js +2 -2
  52. package/dist/esm/loader.js +2 -2
  53. package/dist/esm/polyfills/css-shim.js +1 -1
  54. package/dist/esm/{shadow-css-4cd4480f.js → shadow-css-b18e99d7.js} +1 -1
  55. package/dist/esm-es5/index-906433aa.js +2 -0
  56. package/dist/esm-es5/index-b9d8468a.js +1 -0
  57. package/dist/esm-es5/ku4-carousel-controls.entry.js +1 -1
  58. package/dist/esm-es5/ku4-carousel-slide.entry.js +1 -1
  59. package/dist/esm-es5/ku4-carousel.entry.js +1 -1
  60. package/dist/esm-es5/ku4-col.entry.js +1 -1
  61. package/dist/esm-es5/ku4-drawer.entry.js +1 -1
  62. package/dist/esm-es5/ku4-feature.entry.js +1 -1
  63. package/dist/esm-es5/ku4-focus-trap.entry.js +1 -1
  64. package/dist/esm-es5/ku4-form.entry.js +1 -1
  65. package/dist/esm-es5/ku4-grid.entry.js +1 -1
  66. package/dist/esm-es5/ku4-label.entry.js +1 -1
  67. package/dist/esm-es5/ku4-mask.entry.js +1 -1
  68. package/dist/esm-es5/ku4-modal.entry.js +1 -1
  69. package/dist/esm-es5/ku4-panel.entry.js +1 -1
  70. package/dist/esm-es5/ku4-preview.entry.js +1 -1
  71. package/dist/esm-es5/ku4-tab-list.entry.js +1 -1
  72. package/dist/esm-es5/ku4-tab-panel.entry.js +1 -1
  73. package/dist/esm-es5/ku4-tab.entry.js +1 -1
  74. package/dist/esm-es5/ku4-table.entry.js +1 -1
  75. package/dist/esm-es5/ku4-tooltip.entry.js +1 -1
  76. package/dist/esm-es5/ku4-validation.entry.js +1 -1
  77. package/dist/esm-es5/ku4web-components.js +1 -1
  78. package/dist/esm-es5/loader.js +1 -1
  79. package/dist/esm-es5/{shadow-css-4cd4480f.js → shadow-css-b18e99d7.js} +0 -0
  80. package/dist/ku4web-components/ku4web-components.esm.js +1 -1
  81. package/dist/ku4web-components/ku4web-components.js +1 -1
  82. package/dist/ku4web-components/{p-416cf70d.system.entry.js → p-0c80849a.system.entry.js} +1 -1
  83. package/dist/ku4web-components/{p-a51c6fe5.system.entry.js → p-2e259be8.system.entry.js} +1 -1
  84. package/dist/ku4web-components/{p-a3636f09.entry.js → p-2e8bdcac.entry.js} +1 -1
  85. package/dist/ku4web-components/{p-7d459d29.entry.js → p-321ff189.entry.js} +1 -1
  86. package/dist/ku4web-components/{p-a43cea20.system.entry.js → p-3afb47cc.system.entry.js} +1 -1
  87. package/dist/ku4web-components/{p-5cccec1b.system.entry.js → p-3ee2a2dd.system.entry.js} +1 -1
  88. package/dist/ku4web-components/{p-00f6f7a2.system.entry.js → p-4038362a.system.entry.js} +1 -1
  89. package/dist/ku4web-components/{p-3bf6b262.entry.js → p-4143d5d6.entry.js} +1 -1
  90. package/dist/ku4web-components/{p-36f621f0.entry.js → p-47690d76.entry.js} +1 -1
  91. package/dist/ku4web-components/{p-dd984902.system.entry.js → p-4ae67f1f.system.entry.js} +1 -1
  92. package/dist/ku4web-components/{p-29a8bbab.entry.js → p-4c41bbdd.entry.js} +1 -1
  93. package/dist/ku4web-components/{p-9dfc9b1f.system.entry.js → p-517fec9b.system.entry.js} +1 -1
  94. package/dist/ku4web-components/{p-9d3e0ac4.entry.js → p-557f0053.entry.js} +1 -1
  95. package/dist/ku4web-components/{p-376b72f4.system.entry.js → p-570177e8.system.entry.js} +1 -1
  96. package/dist/ku4web-components/p-5d8e9dd5.js +1 -0
  97. package/dist/ku4web-components/{p-6c6c1035.system.entry.js → p-608ec081.system.entry.js} +1 -1
  98. package/dist/ku4web-components/{p-89670006.system.entry.js → p-62691d31.system.entry.js} +1 -1
  99. package/dist/ku4web-components/{p-003842e3.entry.js → p-6343daaa.entry.js} +1 -1
  100. package/dist/ku4web-components/{p-b32c7075.system.entry.js → p-667063a1.system.entry.js} +1 -1
  101. package/dist/ku4web-components/{p-e4e56edf.system.entry.js → p-6a27b43f.system.entry.js} +1 -1
  102. package/dist/ku4web-components/{p-15a87049.system.entry.js → p-6d14ef68.system.entry.js} +1 -1
  103. package/dist/ku4web-components/{p-e56f956e.entry.js → p-6fc8ef40.entry.js} +1 -1
  104. package/dist/ku4web-components/{p-b1530d9c.system.js → p-88092d06.system.js} +0 -0
  105. package/dist/ku4web-components/p-8e03322a.system.js +2 -0
  106. package/dist/ku4web-components/{p-0e578877.system.entry.js → p-92c72bf8.system.entry.js} +1 -1
  107. package/dist/ku4web-components/{p-11757f38.system.entry.js → p-98f05ada.system.entry.js} +1 -1
  108. package/dist/ku4web-components/{p-c52796ac.entry.js → p-990790af.entry.js} +1 -1
  109. package/dist/ku4web-components/{p-76ed1a14.system.entry.js → p-9f434bd7.system.entry.js} +1 -1
  110. package/dist/ku4web-components/{p-46b0daaf.entry.js → p-ae5e23b4.entry.js} +1 -1
  111. package/dist/ku4web-components/{p-918a802a.entry.js → p-bd8e14e8.entry.js} +1 -1
  112. package/dist/ku4web-components/{p-adbc2f7a.system.entry.js → p-c37c000c.system.entry.js} +1 -1
  113. package/dist/ku4web-components/p-c7ab12de.system.js +1 -0
  114. package/dist/ku4web-components/{p-80c99a74.entry.js → p-ca08f742.entry.js} +1 -1
  115. package/dist/ku4web-components/{p-0ca65b63.entry.js → p-cfa2430c.entry.js} +1 -1
  116. package/dist/ku4web-components/{p-e2515ee6.entry.js → p-d19c1792.entry.js} +1 -1
  117. package/dist/ku4web-components/{p-4f30a3b4.entry.js → p-d21d1e0e.entry.js} +1 -1
  118. package/dist/ku4web-components/{p-23ff9bcd.entry.js → p-d66a1733.entry.js} +1 -1
  119. package/dist/ku4web-components/{p-ba6e9e3d.entry.js → p-ea728fd5.entry.js} +1 -1
  120. package/dist/ku4web-components/{p-0f3da44d.system.entry.js → p-eace27f8.system.entry.js} +1 -1
  121. package/dist/ku4web-components/{p-825c4eb1.entry.js → p-ebacc2e9.entry.js} +1 -1
  122. package/dist/ku4web-components/{p-f5f5958d.system.entry.js → p-f0744d75.system.entry.js} +1 -1
  123. package/dist/ku4web-components/p-f134bec3.js +2 -0
  124. package/dist/ku4web-components/{p-db4732d6.system.entry.js → p-f1b64863.system.entry.js} +1 -1
  125. package/dist/ku4web-components/p-f1df904f.entry.js +1 -0
  126. package/dist/ku4web-components/{p-4eaf20b7.js → p-f26ed61d.js} +0 -0
  127. package/dist/ku4web-components/{p-68376c90.system.js → p-f7873ccb.system.js} +1 -1
  128. package/dist/ku4web-components/{p-7fb3c20b.entry.js → p-feef17a2.entry.js} +1 -1
  129. package/dist/types/capabilities/decorators/deprecated.d.ts +1 -1
  130. package/dist/types/capabilities/testing/html.d.ts +1 -1
  131. package/dist/types/capabilities/testing/styles.d.ts +1 -1
  132. package/dist/types/components/ku4-validation/validate.d.ts +1 -1
  133. package/dist/types/stencil-public-runtime.d.ts +15 -4
  134. package/loader/package.json +1 -0
  135. package/mask/index.js +1 -1
  136. package/package.json +39 -39
  137. package/react/index.js +1 -3
  138. package/react/index.mjs +1 -1
  139. package/vue/index.js +1 -3
  140. package/vue/index.mjs +1 -1
  141. package/vue3/index.js +1 -3
  142. package/vue3/index.mjs +1 -1
  143. package/dist/cjs/index-5ea4489d.js +0 -10
  144. package/dist/esm/index-bb8d5d62.js +0 -3
  145. package/dist/esm-es5/index-bb8d5d62.js +0 -1
  146. package/dist/esm-es5/index-ed88cd9f.js +0 -2
  147. package/dist/ku4web-components/p-3074face.system.js +0 -2
  148. package/dist/ku4web-components/p-8e94fc34.entry.js +0 -1
  149. package/dist/ku4web-components/p-a145181f.js +0 -2
  150. package/dist/ku4web-components/p-e8b35187.js +0 -1
  151. package/dist/ku4web-components/p-eb21757a.system.js +0 -1
@@ -1,5 +1,13 @@
1
1
  const NAMESPACE = 'ku4web-components';
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 contentRef;
5
13
  let hostTagName;
@@ -8,64 +16,6 @@ let checkSlotFallbackVisibility = false;
8
16
  let checkSlotRelocate = false;
9
17
  let isSvgMode = false;
10
18
  let queuePending = false;
11
- const win = typeof window !== 'undefined' ? window : {};
12
- const doc = win.document || { head: {} };
13
- const plt = {
14
- $flags$: 0,
15
- $resourcesUrl$: '',
16
- jmp: (h) => h(),
17
- raf: (h) => requestAnimationFrame(h),
18
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
19
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
20
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
21
- };
22
- const supportsShadow = /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
23
- ;
24
- const promiseResolve = (v) => Promise.resolve(v);
25
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
26
- try {
27
- new CSSStyleSheet();
28
- return typeof new CSSStyleSheet().replaceSync === 'function';
29
- }
30
- catch (e) { }
31
- return false;
32
- })()
33
- ;
34
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
35
- if (listeners) {
36
- listeners.map(([flags, name, method]) => {
37
- const target = getHostListenerTarget(elm, flags) ;
38
- const handler = hostListenerProxy(hostRef, method);
39
- const opts = hostListenerOpts(flags);
40
- plt.ael(target, name, handler, opts);
41
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
42
- });
43
- }
44
- };
45
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
46
- try {
47
- {
48
- if (hostRef.$flags$ & 256 /* isListenReady */) {
49
- // instance is ready, let's call it's member method for this event
50
- hostRef.$lazyInstance$[methodName](ev);
51
- }
52
- else {
53
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
54
- }
55
- }
56
- }
57
- catch (e) {
58
- consoleError(e);
59
- }
60
- };
61
- const getHostListenerTarget = (elm, flags) => {
62
- if (flags & 8 /* TargetWindow */)
63
- return win;
64
- return elm;
65
- };
66
- // prettier-ignore
67
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
68
- const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
69
19
  const createTime = (fnName, tagName = '') => {
70
20
  {
71
21
  return () => {
@@ -80,76 +30,7 @@ const uniqueTime = (key, measureText) => {
80
30
  };
81
31
  }
82
32
  };
83
- const rootAppliedStyles = new WeakMap();
84
- const registerStyle = (scopeId, cssText, allowCS) => {
85
- let style = styles.get(scopeId);
86
- if (supportsConstructableStylesheets && allowCS) {
87
- style = (style || new CSSStyleSheet());
88
- if (typeof style === 'string') {
89
- style = cssText;
90
- }
91
- else {
92
- style.replaceSync(cssText);
93
- }
94
- }
95
- else {
96
- style = cssText;
97
- }
98
- styles.set(scopeId, style);
99
- };
100
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
101
- let scopeId = getScopeId(cmpMeta);
102
- const style = styles.get(scopeId);
103
- // if an element is NOT connected then getRootNode() will return the wrong root node
104
- // so the fallback is to always use the document for the root node in those cases
105
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
106
- if (style) {
107
- if (typeof style === 'string') {
108
- styleContainerNode = styleContainerNode.head || styleContainerNode;
109
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
110
- let styleElm;
111
- if (!appliedStyles) {
112
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
113
- }
114
- if (!appliedStyles.has(scopeId)) {
115
- {
116
- {
117
- styleElm = doc.createElement('style');
118
- styleElm.innerHTML = style;
119
- }
120
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
121
- }
122
- if (appliedStyles) {
123
- appliedStyles.add(scopeId);
124
- }
125
- }
126
- }
127
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
128
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
129
- }
130
- }
131
- return scopeId;
132
- };
133
- const attachStyles = (hostRef) => {
134
- const cmpMeta = hostRef.$cmpMeta$;
135
- const elm = hostRef.$hostElement$;
136
- const flags = cmpMeta.$flags$;
137
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
138
- const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
139
- if (flags & 10 /* needsScopedEncapsulation */) {
140
- // only required when we're NOT using native shadow dom (slot)
141
- // or this browser doesn't support native shadow dom
142
- // and this host element was NOT created with SSR
143
- // let's pick out the inner content for slot projection
144
- // create a node to represent where the original
145
- // content was first placed, which is useful later on
146
- // DOM WRITE!!
147
- elm['s-sc'] = scopeId;
148
- elm.classList.add(scopeId + '-h');
149
- }
150
- endAttachStyles();
151
- };
152
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
33
+ const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
153
34
  /**
154
35
  * Default style mode id
155
36
  */
@@ -248,6 +129,149 @@ const newVNode = (tag, text) => {
248
129
  };
249
130
  const Host = {};
250
131
  const isHost = (node) => node && node.$tag$ === Host;
132
+ /**
133
+ * Parse a new property value for a given property type.
134
+ *
135
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
136
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
137
+ * 1. `any`, the type given to `propValue` in the function signature
138
+ * 2. the type stored from `propType`.
139
+ *
140
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
141
+ *
142
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
143
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
144
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
145
+ * ```tsx
146
+ * <my-cmp prop-val={0}></my-cmp>
147
+ * ```
148
+ *
149
+ * HTML prop values on the other hand, will always a string
150
+ *
151
+ * @param propValue the new value to coerce to some type
152
+ * @param propType the type of the prop, expressed as a binary number
153
+ * @returns the parsed/coerced value
154
+ */
155
+ const parsePropertyValue = (propValue, propType) => {
156
+ // ensure this value is of the correct prop type
157
+ if (propValue != null && !isComplexType(propValue)) {
158
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
159
+ // per the HTML spec, any string value means it is a boolean true value
160
+ // but we'll cheat here and say that the string "false" is the boolean false
161
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
162
+ }
163
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
164
+ // force it to be a number
165
+ return parseFloat(propValue);
166
+ }
167
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
168
+ // could have been passed as a number or boolean
169
+ // but we still want it as a string
170
+ return String(propValue);
171
+ }
172
+ // redundant return here for better minification
173
+ return propValue;
174
+ }
175
+ // not sure exactly what type we want
176
+ // so no need to change to a different type
177
+ return propValue;
178
+ };
179
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
180
+ const createEvent = (ref, name, flags) => {
181
+ const elm = getElement(ref);
182
+ return {
183
+ emit: (detail) => {
184
+ return emitEvent(elm, name, {
185
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
186
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
187
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
188
+ detail,
189
+ });
190
+ },
191
+ };
192
+ };
193
+ /**
194
+ * Helper function to create & dispatch a custom Event on a provided target
195
+ * @param elm the target of the Event
196
+ * @param name the name to give the custom Event
197
+ * @param opts options for configuring a custom Event
198
+ * @returns the custom Event
199
+ */
200
+ const emitEvent = (elm, name, opts) => {
201
+ const ev = plt.ce(name, opts);
202
+ elm.dispatchEvent(ev);
203
+ return ev;
204
+ };
205
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
206
+ const registerStyle = (scopeId, cssText, allowCS) => {
207
+ let style = styles.get(scopeId);
208
+ if (supportsConstructableStylesheets && allowCS) {
209
+ style = (style || new CSSStyleSheet());
210
+ if (typeof style === 'string') {
211
+ style = cssText;
212
+ }
213
+ else {
214
+ style.replaceSync(cssText);
215
+ }
216
+ }
217
+ else {
218
+ style = cssText;
219
+ }
220
+ styles.set(scopeId, style);
221
+ };
222
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
223
+ let scopeId = getScopeId(cmpMeta);
224
+ const style = styles.get(scopeId);
225
+ // if an element is NOT connected then getRootNode() will return the wrong root node
226
+ // so the fallback is to always use the document for the root node in those cases
227
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
228
+ if (style) {
229
+ if (typeof style === 'string') {
230
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
231
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
232
+ let styleElm;
233
+ if (!appliedStyles) {
234
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
235
+ }
236
+ if (!appliedStyles.has(scopeId)) {
237
+ {
238
+ {
239
+ styleElm = doc.createElement('style');
240
+ styleElm.innerHTML = style;
241
+ }
242
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
243
+ }
244
+ if (appliedStyles) {
245
+ appliedStyles.add(scopeId);
246
+ }
247
+ }
248
+ }
249
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
250
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
251
+ }
252
+ }
253
+ return scopeId;
254
+ };
255
+ const attachStyles = (hostRef) => {
256
+ const cmpMeta = hostRef.$cmpMeta$;
257
+ const elm = hostRef.$hostElement$;
258
+ const flags = cmpMeta.$flags$;
259
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
260
+ const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
261
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
262
+ // only required when we're NOT using native shadow dom (slot)
263
+ // or this browser doesn't support native shadow dom
264
+ // and this host element was NOT created with SSR
265
+ // let's pick out the inner content for slot projection
266
+ // create a node to represent where the original
267
+ // content was first placed, which is useful later on
268
+ // DOM WRITE!!
269
+ elm['s-sc'] = scopeId;
270
+ elm.classList.add(scopeId + '-h');
271
+ }
272
+ endAttachStyles();
273
+ };
274
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
251
275
  /**
252
276
  * Production setAccessor() function based on Preact by
253
277
  * Jason Miller (@developit)
@@ -359,7 +383,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
359
383
  }
360
384
  }
361
385
  }
362
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
386
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
363
387
  newValue = newValue === true ? '' : newValue;
364
388
  {
365
389
  elm.setAttribute(memberName, newValue);
@@ -374,7 +398,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
374
398
  // if the element passed in is a shadow root, which is a document fragment
375
399
  // then we want to be adding attrs/props to the shadow root's "host" element
376
400
  // if it's not a shadow root, then we add attrs/props to the same element
377
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
401
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
378
402
  ? newVnode.$elm$.host
379
403
  : newVnode.$elm$;
380
404
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -392,6 +416,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
392
416
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
393
417
  }
394
418
  };
419
+ /**
420
+ * Create a DOM Node corresponding to one of the children of a given VNode.
421
+ *
422
+ * @param oldParentVNode the parent VNode from the previous render
423
+ * @param newParentVNode the parent VNode from the current render
424
+ * @param childIndex the index of the VNode, in the _new_ parent node's
425
+ * children, for which we will create a new DOM node
426
+ * @param parentElm the parent DOM node which our new node will be a child of
427
+ * @returns the newly created node
428
+ */
395
429
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
396
430
  // tslint:disable-next-line: prefer-const
397
431
  const newVNode = newParentVNode.$children$[childIndex];
@@ -409,23 +443,23 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
409
443
  }
410
444
  newVNode.$flags$ |= newVNode.$children$
411
445
  ? // slot element has fallback content
412
- 2 /* isSlotFallback */
446
+ 2 /* VNODE_FLAGS.isSlotFallback */
413
447
  : // slot element does not have fallback content
414
- 1 /* isSlotReference */;
448
+ 1 /* VNODE_FLAGS.isSlotReference */;
415
449
  }
416
450
  }
417
451
  if (newVNode.$text$ !== null) {
418
452
  // create text node
419
453
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
420
454
  }
421
- else if (newVNode.$flags$ & 1 /* isSlotReference */) {
455
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
422
456
  // create a slot reference node
423
457
  elm = newVNode.$elm$ =
424
458
  doc.createTextNode('');
425
459
  }
426
460
  else {
427
461
  // create element
428
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
462
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
429
463
  ? 'slot-fb'
430
464
  : newVNode.$tag$));
431
465
  // add css classes, attrs, props, listeners, etc.
@@ -451,7 +485,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
451
485
  }
452
486
  {
453
487
  elm['s-hn'] = hostTagName;
454
- if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
488
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
455
489
  // remember the content reference comment
456
490
  elm['s-sr'] = true;
457
491
  // remember the content reference comment
@@ -470,7 +504,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
470
504
  return elm;
471
505
  };
472
506
  const putBackInOriginalLocation = (parentElm, recursive) => {
473
- plt.$flags$ |= 1 /* isTmpDisconnected */;
507
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
474
508
  const oldSlotChildNodes = parentElm.childNodes;
475
509
  for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
476
510
  const childNode = oldSlotChildNodes[i];
@@ -491,7 +525,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
491
525
  putBackInOriginalLocation(childNode, recursive);
492
526
  }
493
527
  }
494
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
528
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
495
529
  };
496
530
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
497
531
  let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
@@ -532,6 +566,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
532
566
  }
533
567
  }
534
568
  };
569
+ /**
570
+ * Reconcile the children of a new VNode with the children of an old VNode by
571
+ * traversing the two collections of children, identifying nodes that are
572
+ * conserved or changed, calling out to `patch` to make any necessary
573
+ * updates to the DOM, and rearranging DOM nodes as needed.
574
+ *
575
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
576
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
577
+ * 'windows' by storing start and end indices and references to the
578
+ * corresponding array entries. Initially the two 'windows' are basically equal
579
+ * to the entire array, but we progressively narrow the windows until there are
580
+ * no children left to update by doing the following:
581
+ *
582
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
583
+ * that if we have an initial array like the following we'll end up dealing
584
+ * only with a window bounded by the highlighted elements:
585
+ *
586
+ * [null, null, VNode1 , ... , VNode2, null, null]
587
+ * ^^^^^^ ^^^^^^
588
+ *
589
+ * 2. Check to see if the elements at the head and tail positions are equal
590
+ * across the windows. This will basically detect elements which haven't
591
+ * been added, removed, or changed position, i.e. if you had the following
592
+ * VNode elements (represented as HTML):
593
+ *
594
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
595
+ * newVNode: `<div><p><span>THERE</span></p></div>`
596
+ *
597
+ * Then when comparing the children of the `<div>` tag we check the equality
598
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
599
+ * same tag in the same position, we'd be able to avoid completely
600
+ * re-rendering the subtree under them with a new DOM element and would just
601
+ * call out to `patch` to handle reconciling their children and so on.
602
+ *
603
+ * 3. Check, for both windows, to see if the element at the beginning of the
604
+ * window corresponds to the element at the end of the other window. This is
605
+ * a heuristic which will let us identify _some_ situations in which
606
+ * elements have changed position, for instance it _should_ detect that the
607
+ * children nodes themselves have not changed but merely moved in the
608
+ * following example:
609
+ *
610
+ * oldVNode: `<div><element-one /><element-two /></div>`
611
+ * newVNode: `<div><element-two /><element-one /></div>`
612
+ *
613
+ * If we find cases like this then we also need to move the concrete DOM
614
+ * elements corresponding to the moved children to write the re-order to the
615
+ * DOM.
616
+ *
617
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
618
+ * nodes in the old children which have the same key as the first element in
619
+ * our window on the new children. If we find such a node we handle calling
620
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
621
+ * what we find.
622
+ *
623
+ * Finally, once we've narrowed our 'windows' to the point that either of them
624
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
625
+ * insertion or deletion that needs to happen to get a DOM state that correctly
626
+ * reflects the new child VNodes. If, for instance, after our window on the old
627
+ * children has collapsed we still have more nodes on the new children that
628
+ * we haven't dealt with yet then we need to add them, or if the new children
629
+ * collapse but we still have unhandled _old_ children then we need to make
630
+ * sure the corresponding DOM nodes are removed.
631
+ *
632
+ * @param parentElm the node into which the parent VNode is rendered
633
+ * @param oldCh the old children of the parent node
634
+ * @param newVNode the new VNode which will replace the parent
635
+ * @param newCh the new children of the parent node
636
+ */
535
637
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
536
638
  let oldStartIdx = 0;
537
639
  let newStartIdx = 0;
@@ -544,7 +646,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
544
646
  let node;
545
647
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
546
648
  if (oldStartVnode == null) {
547
- // Vnode might have been moved left
649
+ // VNode might have been moved left
548
650
  oldStartVnode = oldCh[++oldStartIdx];
549
651
  }
550
652
  else if (oldEndVnode == null) {
@@ -557,42 +659,102 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
557
659
  newEndVnode = newCh[--newEndIdx];
558
660
  }
559
661
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
662
+ // if the start nodes are the same then we should patch the new VNode
663
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
664
+ // indices to reflect that. We don't need to move any DOM Nodes around
665
+ // since things are matched up in order.
560
666
  patch(oldStartVnode, newStartVnode);
561
667
  oldStartVnode = oldCh[++oldStartIdx];
562
668
  newStartVnode = newCh[++newStartIdx];
563
669
  }
564
670
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
671
+ // likewise, if the end nodes are the same we patch new onto old and
672
+ // decrement our end indices, and also likewise in this case we don't
673
+ // need to move any DOM Nodes.
565
674
  patch(oldEndVnode, newEndVnode);
566
675
  oldEndVnode = oldCh[--oldEndIdx];
567
676
  newEndVnode = newCh[--newEndIdx];
568
677
  }
569
678
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
570
- // Vnode moved right
679
+ // case: "Vnode moved right"
680
+ //
681
+ // We've found that the last node in our window on the new children is
682
+ // the same VNode as the _first_ node in our window on the old children
683
+ // we're dealing with now. Visually, this is the layout of these two
684
+ // nodes:
685
+ //
686
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
687
+ // ^^^^^^^^^^^
688
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
689
+ // ^^^^^^^^^^^^^
690
+ //
691
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
692
+ // and move the DOM element for `oldStartVnode`.
571
693
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
572
694
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
573
695
  }
574
696
  patch(oldStartVnode, newEndVnode);
697
+ // We need to move the element for `oldStartVnode` into a position which
698
+ // will be appropriate for `newEndVnode`. For this we can use
699
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
700
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
701
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
702
+ //
703
+ // <old-start-node />
704
+ // <some-intervening-node />
705
+ // <old-end-node />
706
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
707
+ // <next-sibling />
708
+ //
709
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
710
+ // the node for `oldStartVnode` at the end of the children of
711
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
712
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
713
+ // append it to the children of the parent element.
575
714
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
576
715
  oldStartVnode = oldCh[++oldStartIdx];
577
716
  newEndVnode = newCh[--newEndIdx];
578
717
  }
579
718
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
580
- // Vnode moved left
719
+ // case: "Vnode moved left"
720
+ //
721
+ // We've found that the first node in our window on the new children is
722
+ // the same VNode as the _last_ node in our window on the old children.
723
+ // Visually, this is the layout of these two nodes:
724
+ //
725
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
726
+ // ^^^^^^^^^^^^^
727
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
728
+ // ^^^^^^^^^^^
729
+ //
730
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
731
+ // (which will handle updating any changed attributes, reconciling their
732
+ // children etc) but we also need to move the DOM node to which
733
+ // `oldEndVnode` corresponds.
581
734
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
582
735
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
583
736
  }
584
737
  patch(oldEndVnode, newStartVnode);
738
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
739
+ // the same node, so since we're here we know that they are not. Thus we
740
+ // can move the element for `oldEndVnode` _before_ the element for
741
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
742
+ // future.
585
743
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
586
744
  oldEndVnode = oldCh[--oldEndIdx];
587
745
  newStartVnode = newCh[++newStartIdx];
588
746
  }
589
747
  else {
590
748
  {
591
- // new element
749
+ // We either didn't find an element in the old children that matches
750
+ // the key of the first new child OR the build is not using `key`
751
+ // attributes at all. In either case we need to create a new element
752
+ // for the new node.
592
753
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
593
754
  newStartVnode = newCh[++newStartIdx];
594
755
  }
595
756
  if (node) {
757
+ // if we created a new node then handle inserting it to the DOM
596
758
  {
597
759
  parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
598
760
  }
@@ -600,18 +762,39 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
600
762
  }
601
763
  }
602
764
  if (oldStartIdx > oldEndIdx) {
765
+ // we have some more new nodes to add which don't match up with old nodes
603
766
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
604
767
  }
605
768
  else if (newStartIdx > newEndIdx) {
769
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
770
+ // in the new array, so lets remove them (which entails cleaning up the
771
+ // relevant DOM nodes)
606
772
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
607
773
  }
608
774
  };
609
- const isSameVnode = (vnode1, vnode2) => {
775
+ /**
776
+ * Compare two VNodes to determine if they are the same
777
+ *
778
+ * **NB**: This function is an equality _heuristic_ based on the available
779
+ * information set on the two VNodes and can be misleading under certain
780
+ * circumstances. In particular, if the two nodes do not have `key` attrs
781
+ * (available under `$key$` on VNodes) then the function falls back on merely
782
+ * checking that they have the same tag.
783
+ *
784
+ * So, in other words, if `key` attrs are not set on VNodes which may be
785
+ * changing order within a `children` array or something along those lines then
786
+ * we could obtain a false positive and then have to do needless re-rendering.
787
+ *
788
+ * @param leftVNode the first VNode to check
789
+ * @param rightVNode the second VNode to check
790
+ * @returns whether they're equal or not
791
+ */
792
+ const isSameVnode = (leftVNode, rightVNode) => {
610
793
  // compare if two vnode to see if they're "technically" the same
611
794
  // need to have the same element tag, and same key to be the same
612
- if (vnode1.$tag$ === vnode2.$tag$) {
613
- if (vnode1.$tag$ === 'slot') {
614
- return vnode1.$name$ === vnode2.$name$;
795
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
796
+ if (leftVNode.$tag$ === 'slot') {
797
+ return leftVNode.$name$ === rightVNode.$name$;
615
798
  }
616
799
  return true;
617
800
  }
@@ -625,6 +808,14 @@ const referenceNode = (node) => {
625
808
  return (node && node['s-ol']) || node;
626
809
  };
627
810
  const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
811
+ /**
812
+ * Handle reconciling an outdated VNode with a new one which corresponds to
813
+ * it. This function handles flushing updates to the DOM and reconciling the
814
+ * children of the two nodes (if any).
815
+ *
816
+ * @param oldVNode an old VNode whose DOM element and children we want to update
817
+ * @param newVNode a new VNode representing an updated version of the old one
818
+ */
628
819
  const patch = (oldVNode, newVNode) => {
629
820
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
630
821
  const oldChildren = oldVNode.$children$;
@@ -633,7 +824,6 @@ const patch = (oldVNode, newVNode) => {
633
824
  const text = newVNode.$text$;
634
825
  let defaultHolder;
635
826
  if (text === null) {
636
- // element node
637
827
  {
638
828
  if (tag === 'slot')
639
829
  ;
@@ -646,6 +836,7 @@ const patch = (oldVNode, newVNode) => {
646
836
  }
647
837
  if (oldChildren !== null && newChildren !== null) {
648
838
  // looks like there's child vnodes for both the old and new vnodes
839
+ // so we need to call `updateChildren` to reconcile them
649
840
  updateChildren(elm, oldChildren, newVNode, newChildren);
650
841
  }
651
842
  else if (newChildren !== null) {
@@ -683,7 +874,7 @@ const updateFallbackSlotVisibility = (elm) => {
683
874
  let nodeType;
684
875
  for (i = 0, ilen = childNodes.length; i < ilen; i++) {
685
876
  childNode = childNodes[i];
686
- if (childNode.nodeType === 1 /* ElementNode */) {
877
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
687
878
  if (childNode['s-sr']) {
688
879
  // this is a slot fallback node
689
880
  // get the slot name for this slot reference node
@@ -695,7 +886,7 @@ const updateFallbackSlotVisibility = (elm) => {
695
886
  nodeType = childNodes[j].nodeType;
696
887
  if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
697
888
  // this sibling node is from a different component OR is a named fallback slot node
698
- if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
889
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
699
890
  childNode.hidden = true;
700
891
  break;
701
892
  }
@@ -704,8 +895,8 @@ const updateFallbackSlotVisibility = (elm) => {
704
895
  // this is a default fallback slot node
705
896
  // any element or text node (with content)
706
897
  // should hide the default fallback slot node
707
- if (nodeType === 1 /* ElementNode */ ||
708
- (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
898
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
899
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
709
900
  childNode.hidden = true;
710
901
  break;
711
902
  }
@@ -783,13 +974,13 @@ const relocateSlotContent = (elm) => {
783
974
  }
784
975
  }
785
976
  }
786
- if (childNode.nodeType === 1 /* ElementNode */) {
977
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
787
978
  relocateSlotContent(childNode);
788
979
  }
789
980
  }
790
981
  };
791
982
  const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
792
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
983
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
793
984
  if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
794
985
  return true;
795
986
  }
@@ -814,7 +1005,7 @@ const renderVdom = (hostRef, renderFnResults) => {
814
1005
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
815
1006
  }
816
1007
  rootVnode.$tag$ = null;
817
- rootVnode.$flags$ |= 4 /* isHost */;
1008
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
818
1009
  hostRef.$vnode$ = rootVnode;
819
1010
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
820
1011
  {
@@ -822,7 +1013,7 @@ const renderVdom = (hostRef, renderFnResults) => {
822
1013
  }
823
1014
  {
824
1015
  contentRef = hostElm['s-cr'];
825
- useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1016
+ useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
826
1017
  // always reset
827
1018
  checkSlotFallbackVisibility = false;
828
1019
  }
@@ -831,7 +1022,7 @@ const renderVdom = (hostRef, renderFnResults) => {
831
1022
  {
832
1023
  // while we're moving nodes around existing nodes, temporarily disable
833
1024
  // the disconnectCallback from working
834
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1025
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
835
1026
  if (checkSlotRelocate) {
836
1027
  relocateSlotContent(rootVnode.$elm$);
837
1028
  let relocateData;
@@ -889,7 +1080,7 @@ const renderVdom = (hostRef, renderFnResults) => {
889
1080
  }
890
1081
  else {
891
1082
  // this node doesn't have a slot home to go to, so let's hide it
892
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1083
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
893
1084
  nodeToRelocate.hidden = true;
894
1085
  }
895
1086
  }
@@ -900,37 +1091,11 @@ const renderVdom = (hostRef, renderFnResults) => {
900
1091
  }
901
1092
  // done moving nodes around
902
1093
  // allow the disconnect callback to work again
903
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1094
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
904
1095
  // always reset
905
1096
  relocateNodes.length = 0;
906
1097
  }
907
1098
  };
908
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
909
- const createEvent = (ref, name, flags) => {
910
- const elm = getElement(ref);
911
- return {
912
- emit: (detail) => {
913
- return emitEvent(elm, name, {
914
- bubbles: !!(flags & 4 /* Bubbles */),
915
- composed: !!(flags & 2 /* Composed */),
916
- cancelable: !!(flags & 1 /* Cancellable */),
917
- detail,
918
- });
919
- },
920
- };
921
- };
922
- /**
923
- * Helper function to create & dispatch a custom Event on a provided target
924
- * @param elm the target of the Event
925
- * @param name the name to give the custom Event
926
- * @param opts options for configuring a custom Event
927
- * @returns the custom Event
928
- */
929
- const emitEvent = (elm, name, opts) => {
930
- const ev = plt.ce(name, opts);
931
- elm.dispatchEvent(ev);
932
- return ev;
933
- };
934
1099
  const attachToAncestor = (hostRef, ancestorComponent) => {
935
1100
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
936
1101
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -938,10 +1103,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
938
1103
  };
939
1104
  const scheduleUpdate = (hostRef, isInitialLoad) => {
940
1105
  {
941
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1106
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
942
1107
  }
943
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
944
- hostRef.$flags$ |= 512 /* needsRerender */;
1108
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1109
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
945
1110
  return;
946
1111
  }
947
1112
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -957,7 +1122,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
957
1122
  let promise;
958
1123
  if (isInitialLoad) {
959
1124
  {
960
- hostRef.$flags$ |= 256 /* isListenReady */;
1125
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
961
1126
  if (hostRef.$queuedListeners$) {
962
1127
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
963
1128
  hostRef.$queuedListeners$ = null;
@@ -1000,7 +1165,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1000
1165
  }
1001
1166
  else {
1002
1167
  Promise.all(childrenPromises).then(postUpdate);
1003
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1168
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1004
1169
  childrenPromises.length = 0;
1005
1170
  }
1006
1171
  }
@@ -1009,10 +1174,10 @@ const callRender = (hostRef, instance, elm) => {
1009
1174
  try {
1010
1175
  instance = instance.render() ;
1011
1176
  {
1012
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1177
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1013
1178
  }
1014
1179
  {
1015
- hostRef.$flags$ |= 2 /* hasRendered */;
1180
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1016
1181
  }
1017
1182
  {
1018
1183
  {
@@ -1039,8 +1204,8 @@ const postUpdateComponent = (hostRef) => {
1039
1204
  {
1040
1205
  safeCall(instance, 'componentDidRender');
1041
1206
  }
1042
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1043
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1207
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1208
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1044
1209
  {
1045
1210
  // DOM WRITE!
1046
1211
  addHydratedFlag(elm);
@@ -1069,10 +1234,10 @@ const postUpdateComponent = (hostRef) => {
1069
1234
  hostRef.$onRenderResolve$();
1070
1235
  hostRef.$onRenderResolve$ = undefined;
1071
1236
  }
1072
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1237
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1073
1238
  nextTick(() => scheduleUpdate(hostRef, false));
1074
1239
  }
1075
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1240
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1076
1241
  }
1077
1242
  // ( •_•)
1078
1243
  // ( •_•)>⌐■-■
@@ -1102,53 +1267,6 @@ const then = (promise, thenFn) => {
1102
1267
  };
1103
1268
  const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
1104
1269
  ;
1105
- /**
1106
- * Parse a new property value for a given property type.
1107
- *
1108
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1109
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1110
- * 1. `any`, the type given to `propValue` in the function signature
1111
- * 2. the type stored from `propType`.
1112
- *
1113
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1114
- *
1115
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1116
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1117
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1118
- * ```tsx
1119
- * <my-cmp prop-val={0}></my-cmp>
1120
- * ```
1121
- *
1122
- * HTML prop values on the other hand, will always a string
1123
- *
1124
- * @param propValue the new value to coerce to some type
1125
- * @param propType the type of the prop, expressed as a binary number
1126
- * @returns the parsed/coerced value
1127
- */
1128
- const parsePropertyValue = (propValue, propType) => {
1129
- // ensure this value is of the correct prop type
1130
- if (propValue != null && !isComplexType(propValue)) {
1131
- if (propType & 4 /* Boolean */) {
1132
- // per the HTML spec, any string value means it is a boolean true value
1133
- // but we'll cheat here and say that the string "false" is the boolean false
1134
- return propValue === 'false' ? false : propValue === '' || !!propValue;
1135
- }
1136
- if (propType & 2 /* Number */) {
1137
- // force it to be a number
1138
- return parseFloat(propValue);
1139
- }
1140
- if (propType & 1 /* String */) {
1141
- // could have been passed as a number or boolean
1142
- // but we still want it as a string
1143
- return String(propValue);
1144
- }
1145
- // redundant return here for better minification
1146
- return propValue;
1147
- }
1148
- // not sure exactly what type we want
1149
- // so no need to change to a different type
1150
- return propValue;
1151
- };
1152
1270
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1153
1271
  const setValue = (ref, propName, newVal, cmpMeta) => {
1154
1272
  // check our new property value against our internal value
@@ -1161,13 +1279,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1161
1279
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1162
1280
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1163
1281
  const didValueChange = newVal !== oldVal && !areBothNaN;
1164
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1282
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1165
1283
  // gadzooks! the property's value has changed!!
1166
1284
  // set our new value!
1167
1285
  hostRef.$instanceValues$.set(propName, newVal);
1168
1286
  if (instance) {
1169
1287
  // get an array of method names of watch functions to call
1170
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1288
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1171
1289
  const watchMethods = cmpMeta.$watchers$[propName];
1172
1290
  if (watchMethods) {
1173
1291
  // this instance is watching for when this property changed
@@ -1182,7 +1300,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1182
1300
  });
1183
1301
  }
1184
1302
  }
1185
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1303
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1186
1304
  // looks like this value actually changed, so we've got work to do!
1187
1305
  // but only if we've already rendered, otherwise just chill out
1188
1306
  // queue that we need to do an update, but don't worry about queuing
@@ -1192,6 +1310,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1192
1310
  }
1193
1311
  }
1194
1312
  };
1313
+ /**
1314
+ * Attach a series of runtime constructs to a compiled Stencil component
1315
+ * constructor, including getters and setters for the `@Prop` and `@State`
1316
+ * decorators, callbacks for when attributes change, and so on.
1317
+ *
1318
+ * @param Cstr the constructor for a component that we need to process
1319
+ * @param cmpMeta metadata collected previously about the component
1320
+ * @param flags a number used to store a series of bit flags
1321
+ * @returns a reference to the same constructor passed in (but now mutated)
1322
+ */
1195
1323
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1196
1324
  if (cmpMeta.$members$) {
1197
1325
  if (Cstr.watchers) {
@@ -1201,8 +1329,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1201
1329
  const members = Object.entries(cmpMeta.$members$);
1202
1330
  const prototype = Cstr.prototype;
1203
1331
  members.map(([memberName, [memberFlags]]) => {
1204
- if ((memberFlags & 31 /* Prop */ ||
1205
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1332
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1333
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1206
1334
  // proxyComponent - prop
1207
1335
  Object.defineProperty(prototype, memberName, {
1208
1336
  get() {
@@ -1217,8 +1345,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1217
1345
  enumerable: true,
1218
1346
  });
1219
1347
  }
1220
- else if (flags & 1 /* isElementConstructor */ &&
1221
- memberFlags & 64 /* Method */) {
1348
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1349
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1222
1350
  // proxyComponent - method
1223
1351
  Object.defineProperty(prototype, memberName, {
1224
1352
  value(...args) {
@@ -1228,7 +1356,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1228
1356
  });
1229
1357
  }
1230
1358
  });
1231
- if ((flags & 1 /* isElementConstructor */)) {
1359
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1232
1360
  const attrNameToPropName = new Map();
1233
1361
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1234
1362
  plt.jmp(() => {
@@ -1284,11 +1412,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1284
1412
  // create an array of attributes to observe
1285
1413
  // and also create a map of html attribute name to js property name
1286
1414
  Cstr.observedAttributes = members
1287
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1415
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1288
1416
  .map(([propName, m]) => {
1289
1417
  const attrName = m[1] || propName;
1290
1418
  attrNameToPropName.set(attrName, propName);
1291
- if (m[0] & 512 /* ReflectAttr */) {
1419
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1292
1420
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1293
1421
  }
1294
1422
  return attrName;
@@ -1299,10 +1427,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1299
1427
  };
1300
1428
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1301
1429
  // initializeComponent
1302
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1430
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1303
1431
  {
1304
1432
  // we haven't initialized this element yet
1305
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1433
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1306
1434
  // lazy loaded components
1307
1435
  // request the component's implementation to be
1308
1436
  // wired up with the host element
@@ -1320,7 +1448,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1320
1448
  {
1321
1449
  cmpMeta.$watchers$ = Cstr.watchers;
1322
1450
  }
1323
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1451
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1324
1452
  Cstr.isProxied = true;
1325
1453
  }
1326
1454
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -1328,7 +1456,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1328
1456
  // but let's keep track of when we start and stop
1329
1457
  // so that the getters/setters don't incorrectly step on data
1330
1458
  {
1331
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1459
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1332
1460
  }
1333
1461
  // construct the lazy-loaded component implementation
1334
1462
  // passing the hostRef is very important during
@@ -1341,10 +1469,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1341
1469
  consoleError(e);
1342
1470
  }
1343
1471
  {
1344
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1472
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1345
1473
  }
1346
1474
  {
1347
- hostRef.$flags$ |= 128 /* isWatchReady */;
1475
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1348
1476
  }
1349
1477
  endNewInstance();
1350
1478
  fireConnectedCallback(hostRef.$lazyInstance$);
@@ -1355,10 +1483,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1355
1483
  const scopeId = getScopeId(cmpMeta);
1356
1484
  if (!styles.has(scopeId)) {
1357
1485
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1358
- if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
1359
- style = await import('./shadow-css-4cd4480f.js').then((m) => m.scopeCss(style, scopeId, false));
1486
+ if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
1487
+ style = await import('./shadow-css-b18e99d7.js').then((m) => m.scopeCss(style, scopeId, false));
1360
1488
  }
1361
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1489
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1362
1490
  endRegisterStyles();
1363
1491
  }
1364
1492
  }
@@ -1385,19 +1513,19 @@ const fireConnectedCallback = (instance) => {
1385
1513
  }
1386
1514
  };
1387
1515
  const connectedCallback = (elm) => {
1388
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1516
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1389
1517
  const hostRef = getHostRef(elm);
1390
1518
  const cmpMeta = hostRef.$cmpMeta$;
1391
1519
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1392
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1520
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1393
1521
  // first time this component has connected
1394
- hostRef.$flags$ |= 1 /* hasConnected */;
1522
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1395
1523
  {
1396
1524
  // initUpdate
1397
1525
  // if the slot polyfill is required we'll need to put some nodes
1398
1526
  // in here to act as original content anchors as we move nodes around
1399
1527
  // host element has been connected to the DOM
1400
- if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1528
+ if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1401
1529
  setContentReference(elm);
1402
1530
  }
1403
1531
  }
@@ -1420,7 +1548,7 @@ const connectedCallback = (elm) => {
1420
1548
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1421
1549
  if (cmpMeta.$members$) {
1422
1550
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1423
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1551
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1424
1552
  const value = elm[memberName];
1425
1553
  delete elm[memberName];
1426
1554
  elm[memberName] = value;
@@ -1454,7 +1582,7 @@ const setContentReference = (elm) => {
1454
1582
  elm.insertBefore(contentRefElm, elm.firstChild);
1455
1583
  };
1456
1584
  const disconnectedCallback = (elm) => {
1457
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1585
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1458
1586
  const hostRef = getHostRef(elm);
1459
1587
  const instance = hostRef.$lazyInstance$ ;
1460
1588
  {
@@ -1501,8 +1629,8 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1501
1629
  {
1502
1630
  cmpMeta.$watchers$ = {};
1503
1631
  }
1504
- if (!supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1505
- cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
1632
+ if (!supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1633
+ cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
1506
1634
  }
1507
1635
  const tagName = cmpMeta.$tagName$;
1508
1636
  const HostElement = class extends HTMLElement {
@@ -1512,7 +1640,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1512
1640
  super(self);
1513
1641
  self = this;
1514
1642
  registerHost(self, cmpMeta);
1515
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1643
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1516
1644
  // this component is using shadow dom
1517
1645
  // and this browser supports shadow dom
1518
1646
  // add the read-only property "shadowRoot" to the host element
@@ -1550,7 +1678,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1550
1678
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1551
1679
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1552
1680
  cmpTags.push(tagName);
1553
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1681
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1554
1682
  }
1555
1683
  });
1556
1684
  });
@@ -1572,7 +1700,41 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1572
1700
  // Fallback appLoad event
1573
1701
  endBootstrap();
1574
1702
  };
1575
- const hostRefs = new WeakMap();
1703
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1704
+ if (listeners) {
1705
+ listeners.map(([flags, name, method]) => {
1706
+ const target = getHostListenerTarget(elm, flags) ;
1707
+ const handler = hostListenerProxy(hostRef, method);
1708
+ const opts = hostListenerOpts(flags);
1709
+ plt.ael(target, name, handler, opts);
1710
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1711
+ });
1712
+ }
1713
+ };
1714
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1715
+ try {
1716
+ {
1717
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1718
+ // instance is ready, let's call it's member method for this event
1719
+ hostRef.$lazyInstance$[methodName](ev);
1720
+ }
1721
+ else {
1722
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1723
+ }
1724
+ }
1725
+ }
1726
+ catch (e) {
1727
+ consoleError(e);
1728
+ }
1729
+ };
1730
+ const getHostListenerTarget = (elm, flags) => {
1731
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
1732
+ return win;
1733
+ return elm;
1734
+ };
1735
+ // prettier-ignore
1736
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1737
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1576
1738
  const getHostRef = (ref) => hostRefs.get(ref);
1577
1739
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1578
1740
  const registerHost = (elm, cmpMeta) => {
@@ -1617,14 +1779,37 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1617
1779
  return importedModule[exportName];
1618
1780
  }, consoleError);
1619
1781
  };
1620
- const styles = new Map();
1782
+ const styles = /*@__PURE__*/ new Map();
1783
+ const win = typeof window !== 'undefined' ? window : {};
1784
+ const doc = win.document || { head: {} };
1785
+ const plt = {
1786
+ $flags$: 0,
1787
+ $resourcesUrl$: '',
1788
+ jmp: (h) => h(),
1789
+ raf: (h) => requestAnimationFrame(h),
1790
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1791
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1792
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1793
+ };
1794
+ const supportsShadow = /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
1795
+ ;
1796
+ const promiseResolve = (v) => Promise.resolve(v);
1797
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1798
+ try {
1799
+ new CSSStyleSheet();
1800
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1801
+ }
1802
+ catch (e) { }
1803
+ return false;
1804
+ })()
1805
+ ;
1621
1806
  const queueDomReads = [];
1622
1807
  const queueDomWrites = [];
1623
1808
  const queueTask = (queue, write) => (cb) => {
1624
1809
  queue.push(cb);
1625
1810
  if (!queuePending) {
1626
1811
  queuePending = true;
1627
- if (write && plt.$flags$ & 4 /* queueSync */) {
1812
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1628
1813
  nextTick(flush);
1629
1814
  }
1630
1815
  else {