@rijkshuisstijl-community/web-components-stencil 1.0.0-alpha.2 → 1.0.0-alpha.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +7 -0
  2. package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
  3. package/dist/cjs/index-79e96916.js +1148 -0
  4. package/dist/cjs/index-79e96916.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +4 -2
  6. package/dist/cjs/loader.cjs.js.map +1 -1
  7. package/dist/cjs/rhc-icon-arrow-right.cjs.entry.js +7 -7
  8. package/dist/cjs/rhc-icon-arrow-right.cjs.entry.js.map +1 -1
  9. package/dist/cjs/rhc-icon-calendar.cjs.entry.js +7 -7
  10. package/dist/cjs/rhc-icon-calendar.cjs.entry.js.map +1 -1
  11. package/dist/cjs/rhc-icon-error.cjs.entry.js +7 -7
  12. package/dist/cjs/rhc-icon-error.cjs.entry.js.map +1 -1
  13. package/dist/cjs/rhc-icon-info_2.cjs.entry.js +19 -18
  14. package/dist/cjs/rhc-icon-info_2.cjs.entry.js.map +1 -1
  15. package/dist/cjs/rhc-icon-success.cjs.entry.js +7 -7
  16. package/dist/cjs/rhc-icon-success.cjs.entry.js.map +1 -1
  17. package/dist/cjs/rhc-icon-warning.cjs.entry.js +7 -7
  18. package/dist/cjs/rhc-icon-warning.cjs.entry.js.map +1 -1
  19. package/dist/cjs/rhc.cjs.js +12 -10
  20. package/dist/cjs/rhc.cjs.js.map +1 -1
  21. package/dist/collection/collection-manifest.json +2 -2
  22. package/dist/collection/icon-arrow-right/stencil.js +5 -5
  23. package/dist/collection/icon-arrow-right/stencil.js.map +1 -1
  24. package/dist/collection/icon-calendar/stencil.js +5 -5
  25. package/dist/collection/icon-calendar/stencil.js.map +1 -1
  26. package/dist/collection/icon-error/stencil.js +5 -5
  27. package/dist/collection/icon-error/stencil.js.map +1 -1
  28. package/dist/collection/icon-info/stencil.js +5 -5
  29. package/dist/collection/icon-info/stencil.js.map +1 -1
  30. package/dist/collection/icon-success/stencil.js +5 -5
  31. package/dist/collection/icon-success/stencil.js.map +1 -1
  32. package/dist/collection/icon-warning/stencil.js +5 -5
  33. package/dist/collection/icon-warning/stencil.js.map +1 -1
  34. package/dist/collection/logo.css +41 -21
  35. package/dist/collection/logo.stencil.js +58 -58
  36. package/dist/collection/logo.stencil.js.map +1 -1
  37. package/dist/components/index.js +15 -15
  38. package/dist/components/rhc-icon-arrow-right.d.ts +2 -2
  39. package/dist/components/rhc-icon-arrow-right.js +19 -19
  40. package/dist/components/rhc-icon-arrow-right.js.map +1 -1
  41. package/dist/components/rhc-icon-calendar.d.ts +2 -2
  42. package/dist/components/rhc-icon-calendar.js +19 -19
  43. package/dist/components/rhc-icon-calendar.js.map +1 -1
  44. package/dist/components/rhc-icon-error.d.ts +2 -2
  45. package/dist/components/rhc-icon-error.js +19 -19
  46. package/dist/components/rhc-icon-error.js.map +1 -1
  47. package/dist/components/rhc-icon-info.d.ts +2 -2
  48. package/dist/components/rhc-icon-info.js +19 -19
  49. package/dist/components/rhc-icon-info.js.map +1 -1
  50. package/dist/components/rhc-icon-success.d.ts +2 -2
  51. package/dist/components/rhc-icon-success.js +19 -19
  52. package/dist/components/rhc-icon-success.js.map +1 -1
  53. package/dist/components/rhc-icon-warning.d.ts +2 -2
  54. package/dist/components/rhc-icon-warning.js +19 -19
  55. package/dist/components/rhc-icon-warning.js.map +1 -1
  56. package/dist/components/rhc-logo.d.ts +2 -2
  57. package/dist/components/rhc-logo.js +28 -27
  58. package/dist/components/rhc-logo.js.map +1 -1
  59. package/dist/esm/app-globals-0f993ce5.js +5 -0
  60. package/dist/esm/app-globals-0f993ce5.js.map +1 -0
  61. package/dist/esm/index-0eb79357.js +1122 -0
  62. package/dist/esm/index-0eb79357.js.map +1 -0
  63. package/dist/esm/loader.js +5 -3
  64. package/dist/esm/loader.js.map +1 -1
  65. package/dist/esm/rhc-icon-arrow-right.entry.js +7 -7
  66. package/dist/esm/rhc-icon-arrow-right.entry.js.map +1 -1
  67. package/dist/esm/rhc-icon-calendar.entry.js +7 -7
  68. package/dist/esm/rhc-icon-calendar.entry.js.map +1 -1
  69. package/dist/esm/rhc-icon-error.entry.js +7 -7
  70. package/dist/esm/rhc-icon-error.entry.js.map +1 -1
  71. package/dist/esm/rhc-icon-info_2.entry.js +19 -18
  72. package/dist/esm/rhc-icon-info_2.entry.js.map +1 -1
  73. package/dist/esm/rhc-icon-success.entry.js +7 -7
  74. package/dist/esm/rhc-icon-success.entry.js.map +1 -1
  75. package/dist/esm/rhc-icon-warning.entry.js +7 -7
  76. package/dist/esm/rhc-icon-warning.entry.js.map +1 -1
  77. package/dist/esm/rhc.js +13 -11
  78. package/dist/esm/rhc.js.map +1 -1
  79. package/dist/rhc/index.esm.js.map +1 -1
  80. package/dist/rhc/p-0c06d3c7.entry.js +2 -0
  81. package/dist/rhc/p-0c06d3c7.entry.js.map +1 -0
  82. package/dist/rhc/p-0d031d9b.entry.js +2 -0
  83. package/dist/rhc/p-0d031d9b.entry.js.map +1 -0
  84. package/dist/rhc/p-1b63fdd4.entry.js +2 -0
  85. package/dist/rhc/p-1b63fdd4.entry.js.map +1 -0
  86. package/dist/rhc/p-566be07a.entry.js +2 -0
  87. package/dist/rhc/p-566be07a.entry.js.map +1 -0
  88. package/dist/rhc/p-5adfb6ac.entry.js +2 -0
  89. package/dist/rhc/p-5adfb6ac.entry.js.map +1 -0
  90. package/dist/rhc/p-62f5168e.js +3 -0
  91. package/dist/rhc/p-62f5168e.js.map +1 -0
  92. package/dist/rhc/p-994c6c79.entry.js +2 -0
  93. package/dist/rhc/p-994c6c79.entry.js.map +1 -0
  94. package/dist/rhc/p-e1255160.js +2 -0
  95. package/dist/rhc/p-e1255160.js.map +1 -0
  96. package/dist/rhc/rhc.esm.js +1 -1
  97. package/dist/rhc/rhc.esm.js.map +1 -1
  98. package/dist/src/icon-error/stencil.js +2 -8
  99. package/dist/src/icon-error/stencil.js.map +1 -1
  100. package/dist/src/icon-info/stencil.js +4 -6
  101. package/dist/src/icon-info/stencil.js.map +1 -1
  102. package/dist/src/icon-success/stencil.js +2 -4
  103. package/dist/src/icon-success/stencil.js.map +1 -1
  104. package/dist/src/icon-warning/stencil.js +2 -6
  105. package/dist/src/icon-warning/stencil.js.map +1 -1
  106. package/dist/types/icon-arrow-right/stencil.d.ts +1 -1
  107. package/dist/types/icon-calendar/stencil.d.ts +1 -1
  108. package/dist/types/icon-error/stencil.d.ts +1 -1
  109. package/dist/types/icon-info/stencil.d.ts +1 -1
  110. package/dist/types/icon-success/stencil.d.ts +1 -1
  111. package/dist/types/icon-warning/stencil.d.ts +1 -1
  112. package/dist/types/logo.stencil.d.ts +3 -3
  113. package/dist/types/stencil-public-runtime.d.ts +35 -13
  114. package/loader/cdn.js +1 -3
  115. package/loader/index.cjs.js +1 -3
  116. package/loader/index.d.ts +3 -0
  117. package/loader/index.es2017.js +1 -3
  118. package/loader/index.js +1 -3
  119. package/package.json +12 -11
  120. package/dist/cjs/index-97a16ac9.js +0 -1551
  121. package/dist/cjs/index-97a16ac9.js.map +0 -1
  122. package/dist/esm/index-c2d82fd1.js +0 -1525
  123. package/dist/esm/index-c2d82fd1.js.map +0 -1
  124. package/dist/esm/polyfills/core-js.js +0 -11
  125. package/dist/esm/polyfills/dom.js +0 -79
  126. package/dist/esm/polyfills/es5-html-element.js +0 -1
  127. package/dist/esm/polyfills/index.js +0 -34
  128. package/dist/esm/polyfills/system.js +0 -6
  129. package/dist/rhc/p-1849850a.entry.js +0 -2
  130. package/dist/rhc/p-1849850a.entry.js.map +0 -1
  131. package/dist/rhc/p-1ddc5ba6.entry.js +0 -2
  132. package/dist/rhc/p-1ddc5ba6.entry.js.map +0 -1
  133. package/dist/rhc/p-1f328841.js +0 -3
  134. package/dist/rhc/p-1f328841.js.map +0 -1
  135. package/dist/rhc/p-3c963064.entry.js +0 -2
  136. package/dist/rhc/p-3c963064.entry.js.map +0 -1
  137. package/dist/rhc/p-4378bb06.entry.js +0 -2
  138. package/dist/rhc/p-4378bb06.entry.js.map +0 -1
  139. package/dist/rhc/p-569d82ec.entry.js +0 -2
  140. package/dist/rhc/p-569d82ec.entry.js.map +0 -1
  141. package/dist/rhc/p-bab6df1d.entry.js +0 -2
  142. package/dist/rhc/p-bab6df1d.entry.js.map +0 -1
@@ -1,1551 +0,0 @@
1
- 'use strict';
2
-
3
- function _interopNamespace(e) {
4
- if (e && e.__esModule) return e;
5
- var n = Object.create(null);
6
- if (e) {
7
- Object.keys(e).forEach(function (k) {
8
- if (k !== 'default') {
9
- var d = Object.getOwnPropertyDescriptor(e, k);
10
- Object.defineProperty(n, k, d.get ? d : {
11
- enumerable: true,
12
- get: function () {
13
- return e[k];
14
- }
15
- });
16
- }
17
- });
18
- }
19
- n['default'] = e;
20
- return Object.freeze(n);
21
- }
22
-
23
- const NAMESPACE = 'rhc';
24
-
25
- /**
26
- * Virtual DOM patching algorithm based on Snabbdom by
27
- * Simon Friis Vindum (@paldepind)
28
- * Licensed under the MIT License
29
- * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
30
- *
31
- * Modified for Stencil's renderer and slot projection
32
- */
33
- let scopeId;
34
- let hostTagName;
35
- let isSvgMode = false;
36
- let queuePending = false;
37
- const createTime = (fnName, tagName = '') => {
38
- {
39
- return () => {
40
- return;
41
- };
42
- }
43
- };
44
- const uniqueTime = (key, measureText) => {
45
- {
46
- return () => {
47
- return;
48
- };
49
- }
50
- };
51
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
52
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
53
- /**
54
- * Default style mode id
55
- */
56
- /**
57
- * Reusable empty obj/array
58
- * Don't add values to these!!
59
- */
60
- const EMPTY_OBJ = {};
61
- /**
62
- * Namespaces
63
- */
64
- const SVG_NS = 'http://www.w3.org/2000/svg';
65
- const HTML_NS = 'http://www.w3.org/1999/xhtml';
66
- const isDef = (v) => v != null;
67
- /**
68
- * Check whether a value is a 'complex type', defined here as an object or a
69
- * function.
70
- *
71
- * @param o the value to check
72
- * @returns whether it's a complex type or not
73
- */
74
- const isComplexType = (o) => {
75
- // https://jsperf.com/typeof-fn-object/5
76
- o = typeof o;
77
- return o === 'object' || o === 'function';
78
- };
79
- /**
80
- * Helper method for querying a `meta` tag that contains a nonce value
81
- * out of a DOM's head.
82
- *
83
- * @param doc The DOM containing the `head` to query against
84
- * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
85
- * exists or the tag has no content.
86
- */
87
- function queryNonceMetaTagContent(doc) {
88
- var _a, _b, _c;
89
- 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;
90
- }
91
- /**
92
- * Production h() function based on Preact by
93
- * Jason Miller (@developit)
94
- * Licensed under the MIT License
95
- * https://github.com/developit/preact/blob/master/LICENSE
96
- *
97
- * Modified for Stencil's compiler and vdom
98
- */
99
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
100
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
101
- const h = (nodeName, vnodeData, ...children) => {
102
- let child = null;
103
- let simple = false;
104
- let lastSimple = false;
105
- const vNodeChildren = [];
106
- const walk = (c) => {
107
- for (let i = 0; i < c.length; i++) {
108
- child = c[i];
109
- if (Array.isArray(child)) {
110
- walk(child);
111
- }
112
- else if (child != null && typeof child !== 'boolean') {
113
- if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
114
- child = String(child);
115
- }
116
- if (simple && lastSimple) {
117
- // If the previous child was simple (string), we merge both
118
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
119
- }
120
- else {
121
- // Append a new vNode, if it's text, we create a text vNode
122
- vNodeChildren.push(simple ? newVNode(null, child) : child);
123
- }
124
- lastSimple = simple;
125
- }
126
- }
127
- };
128
- walk(children);
129
- if (vnodeData) {
130
- {
131
- const classData = vnodeData.className || vnodeData.class;
132
- if (classData) {
133
- vnodeData.class =
134
- typeof classData !== 'object'
135
- ? classData
136
- : Object.keys(classData)
137
- .filter((k) => classData[k])
138
- .join(' ');
139
- }
140
- }
141
- }
142
- const vnode = newVNode(nodeName, null);
143
- vnode.$attrs$ = vnodeData;
144
- if (vNodeChildren.length > 0) {
145
- vnode.$children$ = vNodeChildren;
146
- }
147
- return vnode;
148
- };
149
- /**
150
- * A utility function for creating a virtual DOM node from a tag and some
151
- * possible text content.
152
- *
153
- * @param tag the tag for this element
154
- * @param text possible text content for the node
155
- * @returns a newly-minted virtual DOM node
156
- */
157
- const newVNode = (tag, text) => {
158
- const vnode = {
159
- $flags$: 0,
160
- $tag$: tag,
161
- $text$: text,
162
- $elm$: null,
163
- $children$: null,
164
- };
165
- {
166
- vnode.$attrs$ = null;
167
- }
168
- return vnode;
169
- };
170
- const Host = {};
171
- /**
172
- * Check whether a given node is a Host node or not
173
- *
174
- * @param node the virtual DOM node to check
175
- * @returns whether it's a Host node or not
176
- */
177
- const isHost = (node) => node && node.$tag$ === Host;
178
- /**
179
- * Parse a new property value for a given property type.
180
- *
181
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
182
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
183
- * 1. `any`, the type given to `propValue` in the function signature
184
- * 2. the type stored from `propType`.
185
- *
186
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
187
- *
188
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
189
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
190
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
191
- * ```tsx
192
- * <my-cmp prop-val={0}></my-cmp>
193
- * ```
194
- *
195
- * HTML prop values on the other hand, will always a string
196
- *
197
- * @param propValue the new value to coerce to some type
198
- * @param propType the type of the prop, expressed as a binary number
199
- * @returns the parsed/coerced value
200
- */
201
- const parsePropertyValue = (propValue, propType) => {
202
- // ensure this value is of the correct prop type
203
- if (propValue != null && !isComplexType(propValue)) {
204
- if (propType & 1 /* MEMBER_FLAGS.String */) {
205
- // could have been passed as a number or boolean
206
- // but we still want it as a string
207
- return String(propValue);
208
- }
209
- // redundant return here for better minification
210
- return propValue;
211
- }
212
- // not sure exactly what type we want
213
- // so no need to change to a different type
214
- return propValue;
215
- };
216
- /**
217
- * Helper function to create & dispatch a custom Event on a provided target
218
- * @param elm the target of the Event
219
- * @param name the name to give the custom Event
220
- * @param opts options for configuring a custom Event
221
- * @returns the custom Event
222
- */
223
- const emitEvent = (elm, name, opts) => {
224
- const ev = plt.ce(name, opts);
225
- elm.dispatchEvent(ev);
226
- return ev;
227
- };
228
- const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
229
- const registerStyle = (scopeId, cssText, allowCS) => {
230
- let style = styles.get(scopeId);
231
- if (supportsConstructableStylesheets && allowCS) {
232
- style = (style || new CSSStyleSheet());
233
- if (typeof style === 'string') {
234
- style = cssText;
235
- }
236
- else {
237
- style.replaceSync(cssText);
238
- }
239
- }
240
- else {
241
- style = cssText;
242
- }
243
- styles.set(scopeId, style);
244
- };
245
- const addStyle = (styleContainerNode, cmpMeta, mode) => {
246
- var _a;
247
- const scopeId = getScopeId(cmpMeta);
248
- const style = styles.get(scopeId);
249
- // if an element is NOT connected then getRootNode() will return the wrong root node
250
- // so the fallback is to always use the document for the root node in those cases
251
- styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
252
- if (style) {
253
- if (typeof style === 'string') {
254
- styleContainerNode = styleContainerNode.head || styleContainerNode;
255
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
256
- let styleElm;
257
- if (!appliedStyles) {
258
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
259
- }
260
- if (!appliedStyles.has(scopeId)) {
261
- {
262
- styleElm = doc.createElement('style');
263
- styleElm.innerHTML = style;
264
- // Apply CSP nonce to the style tag if it exists
265
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
266
- if (nonce != null) {
267
- styleElm.setAttribute('nonce', nonce);
268
- }
269
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
270
- }
271
- if (appliedStyles) {
272
- appliedStyles.add(scopeId);
273
- }
274
- }
275
- }
276
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
277
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
278
- }
279
- }
280
- return scopeId;
281
- };
282
- const attachStyles = (hostRef) => {
283
- const cmpMeta = hostRef.$cmpMeta$;
284
- const elm = hostRef.$hostElement$;
285
- const flags = cmpMeta.$flags$;
286
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
287
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
288
- if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
289
- // only required when we're NOT using native shadow dom (slot)
290
- // or this browser doesn't support native shadow dom
291
- // and this host element was NOT created with SSR
292
- // let's pick out the inner content for slot projection
293
- // create a node to represent where the original
294
- // content was first placed, which is useful later on
295
- // DOM WRITE!!
296
- elm['s-sc'] = scopeId;
297
- elm.classList.add(scopeId + '-h');
298
- }
299
- endAttachStyles();
300
- };
301
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
302
- /**
303
- * Production setAccessor() function based on Preact by
304
- * Jason Miller (@developit)
305
- * Licensed under the MIT License
306
- * https://github.com/developit/preact/blob/master/LICENSE
307
- *
308
- * Modified for Stencil's compiler and vdom
309
- */
310
- /**
311
- * When running a VDom render set properties present on a VDom node onto the
312
- * corresponding HTML element.
313
- *
314
- * Note that this function has special functionality for the `class`,
315
- * `style`, `key`, and `ref` attributes, as well as event handlers (like
316
- * `onClick`, etc). All others are just passed through as-is.
317
- *
318
- * @param elm the HTMLElement onto which attributes should be set
319
- * @param memberName the name of the attribute to set
320
- * @param oldValue the old value for the attribute
321
- * @param newValue the new value for the attribute
322
- * @param isSvg whether we're in an svg context or not
323
- * @param flags bitflags for Vdom variables
324
- */
325
- const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
326
- if (oldValue !== newValue) {
327
- let isProp = isMemberInElement(elm, memberName);
328
- let ln = memberName.toLowerCase();
329
- if (memberName === 'class') {
330
- const classList = elm.classList;
331
- const oldClasses = parseClassList(oldValue);
332
- const newClasses = parseClassList(newValue);
333
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
334
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
335
- }
336
- else {
337
- // Set property if it exists and it's not a SVG
338
- const isComplex = isComplexType(newValue);
339
- if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
340
- try {
341
- if (!elm.tagName.includes('-')) {
342
- const n = newValue == null ? '' : newValue;
343
- // Workaround for Safari, moving the <input> caret when re-assigning the same valued
344
- if (memberName === 'list') {
345
- isProp = false;
346
- }
347
- else if (oldValue == null || elm[memberName] != n) {
348
- elm[memberName] = n;
349
- }
350
- }
351
- else {
352
- elm[memberName] = newValue;
353
- }
354
- }
355
- catch (e) { }
356
- }
357
- /**
358
- * Need to manually update attribute if:
359
- * - memberName is not an attribute
360
- * - if we are rendering the host element in order to reflect attribute
361
- * - if it's a SVG, since properties might not work in <svg>
362
- * - if the newValue is null/undefined or 'false'.
363
- */
364
- let xlink = false;
365
- {
366
- if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
367
- memberName = ln;
368
- xlink = true;
369
- }
370
- }
371
- if (newValue == null || newValue === false) {
372
- if (newValue !== false || elm.getAttribute(memberName) === '') {
373
- if (xlink) {
374
- elm.removeAttributeNS(XLINK_NS, memberName);
375
- }
376
- else {
377
- elm.removeAttribute(memberName);
378
- }
379
- }
380
- }
381
- else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
382
- newValue = newValue === true ? '' : newValue;
383
- if (xlink) {
384
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
385
- }
386
- else {
387
- elm.setAttribute(memberName, newValue);
388
- }
389
- }
390
- }
391
- }
392
- };
393
- const parseClassListRegex = /\s/;
394
- const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
395
- const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
396
- // if the element passed in is a shadow root, which is a document fragment
397
- // then we want to be adding attrs/props to the shadow root's "host" element
398
- // if it's not a shadow root, then we add attrs/props to the same element
399
- const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
400
- ? newVnode.$elm$.host
401
- : newVnode.$elm$;
402
- const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
403
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
404
- {
405
- // remove attributes no longer present on the vnode by setting them to undefined
406
- for (memberName in oldVnodeAttrs) {
407
- if (!(memberName in newVnodeAttrs)) {
408
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
409
- }
410
- }
411
- }
412
- // add new & update changed attributes
413
- for (memberName in newVnodeAttrs) {
414
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
415
- }
416
- };
417
- /**
418
- * Create a DOM Node corresponding to one of the children of a given VNode.
419
- *
420
- * @param oldParentVNode the parent VNode from the previous render
421
- * @param newParentVNode the parent VNode from the current render
422
- * @param childIndex the index of the VNode, in the _new_ parent node's
423
- * children, for which we will create a new DOM node
424
- * @param parentElm the parent DOM node which our new node will be a child of
425
- * @returns the newly created node
426
- */
427
- const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
428
- // tslint:disable-next-line: prefer-const
429
- const newVNode = newParentVNode.$children$[childIndex];
430
- let i = 0;
431
- let elm;
432
- let childNode;
433
- if (newVNode.$text$ !== null) {
434
- // create text node
435
- elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
436
- }
437
- else {
438
- if (!isSvgMode) {
439
- isSvgMode = newVNode.$tag$ === 'svg';
440
- }
441
- // create element
442
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
443
- );
444
- if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
445
- isSvgMode = false;
446
- }
447
- // add css classes, attrs, props, listeners, etc.
448
- {
449
- updateElement(null, newVNode, isSvgMode);
450
- }
451
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
452
- // if there is a scopeId and this is the initial render
453
- // then let's add the scopeId as a css class
454
- elm.classList.add((elm['s-si'] = scopeId));
455
- }
456
- if (newVNode.$children$) {
457
- for (i = 0; i < newVNode.$children$.length; ++i) {
458
- // create the node
459
- childNode = createElm(oldParentVNode, newVNode, i);
460
- // return node could have been null
461
- if (childNode) {
462
- // append our new node
463
- elm.appendChild(childNode);
464
- }
465
- }
466
- }
467
- {
468
- if (newVNode.$tag$ === 'svg') {
469
- // Only reset the SVG context when we're exiting <svg> element
470
- isSvgMode = false;
471
- }
472
- else if (elm.tagName === 'foreignObject') {
473
- // Reenter SVG context when we're exiting <foreignObject> element
474
- isSvgMode = true;
475
- }
476
- }
477
- }
478
- return elm;
479
- };
480
- /**
481
- * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
482
- * add them to the DOM in the appropriate place.
483
- *
484
- * @param parentElm the DOM node which should be used as a parent for the new
485
- * DOM nodes
486
- * @param before a child of the `parentElm` which the new children should be
487
- * inserted before (optional)
488
- * @param parentVNode the parent virtual DOM node
489
- * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
490
- * @param startIdx the index in the child virtual DOM nodes at which to start
491
- * creating DOM nodes (inclusive)
492
- * @param endIdx the index in the child virtual DOM nodes at which to stop
493
- * creating DOM nodes (inclusive)
494
- */
495
- const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
496
- let containerElm = (parentElm);
497
- let childNode;
498
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
499
- containerElm = containerElm.shadowRoot;
500
- }
501
- for (; startIdx <= endIdx; ++startIdx) {
502
- if (vnodes[startIdx]) {
503
- childNode = createElm(null, parentVNode, startIdx);
504
- if (childNode) {
505
- vnodes[startIdx].$elm$ = childNode;
506
- containerElm.insertBefore(childNode, before);
507
- }
508
- }
509
- }
510
- };
511
- /**
512
- * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
513
- * This can be used to, for instance, clean up after a list of children which
514
- * should no longer be shown.
515
- *
516
- * This function also handles some of Stencil's slot relocation logic.
517
- *
518
- * @param vnodes a list of virtual DOM nodes to remove
519
- * @param startIdx the index at which to start removing nodes (inclusive)
520
- * @param endIdx the index at which to stop removing nodes (inclusive)
521
- */
522
- const removeVnodes = (vnodes, startIdx, endIdx) => {
523
- for (let index = startIdx; index <= endIdx; ++index) {
524
- const vnode = vnodes[index];
525
- if (vnode) {
526
- const elm = vnode.$elm$;
527
- if (elm) {
528
- // remove the vnode's element from the dom
529
- elm.remove();
530
- }
531
- }
532
- }
533
- };
534
- /**
535
- * Reconcile the children of a new VNode with the children of an old VNode by
536
- * traversing the two collections of children, identifying nodes that are
537
- * conserved or changed, calling out to `patch` to make any necessary
538
- * updates to the DOM, and rearranging DOM nodes as needed.
539
- *
540
- * The algorithm for reconciling children works by analyzing two 'windows' onto
541
- * the two arrays of children (`oldCh` and `newCh`). We keep track of the
542
- * 'windows' by storing start and end indices and references to the
543
- * corresponding array entries. Initially the two 'windows' are basically equal
544
- * to the entire array, but we progressively narrow the windows until there are
545
- * no children left to update by doing the following:
546
- *
547
- * 1. Skip any `null` entries at the beginning or end of the two arrays, so
548
- * that if we have an initial array like the following we'll end up dealing
549
- * only with a window bounded by the highlighted elements:
550
- *
551
- * [null, null, VNode1 , ... , VNode2, null, null]
552
- * ^^^^^^ ^^^^^^
553
- *
554
- * 2. Check to see if the elements at the head and tail positions are equal
555
- * across the windows. This will basically detect elements which haven't
556
- * been added, removed, or changed position, i.e. if you had the following
557
- * VNode elements (represented as HTML):
558
- *
559
- * oldVNode: `<div><p><span>HEY</span></p></div>`
560
- * newVNode: `<div><p><span>THERE</span></p></div>`
561
- *
562
- * Then when comparing the children of the `<div>` tag we check the equality
563
- * of the VNodes corresponding to the `<p>` tags and, since they are the
564
- * same tag in the same position, we'd be able to avoid completely
565
- * re-rendering the subtree under them with a new DOM element and would just
566
- * call out to `patch` to handle reconciling their children and so on.
567
- *
568
- * 3. Check, for both windows, to see if the element at the beginning of the
569
- * window corresponds to the element at the end of the other window. This is
570
- * a heuristic which will let us identify _some_ situations in which
571
- * elements have changed position, for instance it _should_ detect that the
572
- * children nodes themselves have not changed but merely moved in the
573
- * following example:
574
- *
575
- * oldVNode: `<div><element-one /><element-two /></div>`
576
- * newVNode: `<div><element-two /><element-one /></div>`
577
- *
578
- * If we find cases like this then we also need to move the concrete DOM
579
- * elements corresponding to the moved children to write the re-order to the
580
- * DOM.
581
- *
582
- * 4. Finally, if VNodes have the `key` attribute set on them we check for any
583
- * nodes in the old children which have the same key as the first element in
584
- * our window on the new children. If we find such a node we handle calling
585
- * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
586
- * what we find.
587
- *
588
- * Finally, once we've narrowed our 'windows' to the point that either of them
589
- * collapse (i.e. they have length 0) we then handle any remaining VNode
590
- * insertion or deletion that needs to happen to get a DOM state that correctly
591
- * reflects the new child VNodes. If, for instance, after our window on the old
592
- * children has collapsed we still have more nodes on the new children that
593
- * we haven't dealt with yet then we need to add them, or if the new children
594
- * collapse but we still have unhandled _old_ children then we need to make
595
- * sure the corresponding DOM nodes are removed.
596
- *
597
- * @param parentElm the node into which the parent VNode is rendered
598
- * @param oldCh the old children of the parent node
599
- * @param newVNode the new VNode which will replace the parent
600
- * @param newCh the new children of the parent node
601
- */
602
- const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
603
- let oldStartIdx = 0;
604
- let newStartIdx = 0;
605
- let oldEndIdx = oldCh.length - 1;
606
- let oldStartVnode = oldCh[0];
607
- let oldEndVnode = oldCh[oldEndIdx];
608
- let newEndIdx = newCh.length - 1;
609
- let newStartVnode = newCh[0];
610
- let newEndVnode = newCh[newEndIdx];
611
- let node;
612
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
613
- if (oldStartVnode == null) {
614
- // VNode might have been moved left
615
- oldStartVnode = oldCh[++oldStartIdx];
616
- }
617
- else if (oldEndVnode == null) {
618
- oldEndVnode = oldCh[--oldEndIdx];
619
- }
620
- else if (newStartVnode == null) {
621
- newStartVnode = newCh[++newStartIdx];
622
- }
623
- else if (newEndVnode == null) {
624
- newEndVnode = newCh[--newEndIdx];
625
- }
626
- else if (isSameVnode(oldStartVnode, newStartVnode)) {
627
- // if the start nodes are the same then we should patch the new VNode
628
- // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
629
- // indices to reflect that. We don't need to move any DOM Nodes around
630
- // since things are matched up in order.
631
- patch(oldStartVnode, newStartVnode);
632
- oldStartVnode = oldCh[++oldStartIdx];
633
- newStartVnode = newCh[++newStartIdx];
634
- }
635
- else if (isSameVnode(oldEndVnode, newEndVnode)) {
636
- // likewise, if the end nodes are the same we patch new onto old and
637
- // decrement our end indices, and also likewise in this case we don't
638
- // need to move any DOM Nodes.
639
- patch(oldEndVnode, newEndVnode);
640
- oldEndVnode = oldCh[--oldEndIdx];
641
- newEndVnode = newCh[--newEndIdx];
642
- }
643
- else if (isSameVnode(oldStartVnode, newEndVnode)) {
644
- patch(oldStartVnode, newEndVnode);
645
- // We need to move the element for `oldStartVnode` into a position which
646
- // will be appropriate for `newEndVnode`. For this we can use
647
- // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
648
- // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
649
- // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
650
- //
651
- // <old-start-node />
652
- // <some-intervening-node />
653
- // <old-end-node />
654
- // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
655
- // <next-sibling />
656
- //
657
- // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
658
- // the node for `oldStartVnode` at the end of the children of
659
- // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
660
- // aren't any siblings, and passing `null` to `Node.insertBefore` will
661
- // append it to the children of the parent element.
662
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
663
- oldStartVnode = oldCh[++oldStartIdx];
664
- newEndVnode = newCh[--newEndIdx];
665
- }
666
- else if (isSameVnode(oldEndVnode, newStartVnode)) {
667
- patch(oldEndVnode, newStartVnode);
668
- // We've already checked above if `oldStartVnode` and `newStartVnode` are
669
- // the same node, so since we're here we know that they are not. Thus we
670
- // can move the element for `oldEndVnode` _before_ the element for
671
- // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
672
- // future.
673
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
674
- oldEndVnode = oldCh[--oldEndIdx];
675
- newStartVnode = newCh[++newStartIdx];
676
- }
677
- else {
678
- {
679
- // We either didn't find an element in the old children that matches
680
- // the key of the first new child OR the build is not using `key`
681
- // attributes at all. In either case we need to create a new element
682
- // for the new node.
683
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
684
- newStartVnode = newCh[++newStartIdx];
685
- }
686
- if (node) {
687
- // if we created a new node then handle inserting it to the DOM
688
- {
689
- oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
690
- }
691
- }
692
- }
693
- }
694
- if (oldStartIdx > oldEndIdx) {
695
- // we have some more new nodes to add which don't match up with old nodes
696
- addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
697
- }
698
- else if (newStartIdx > newEndIdx) {
699
- // there are nodes in the `oldCh` array which no longer correspond to nodes
700
- // in the new array, so lets remove them (which entails cleaning up the
701
- // relevant DOM nodes)
702
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
703
- }
704
- };
705
- /**
706
- * Compare two VNodes to determine if they are the same
707
- *
708
- * **NB**: This function is an equality _heuristic_ based on the available
709
- * information set on the two VNodes and can be misleading under certain
710
- * circumstances. In particular, if the two nodes do not have `key` attrs
711
- * (available under `$key$` on VNodes) then the function falls back on merely
712
- * checking that they have the same tag.
713
- *
714
- * So, in other words, if `key` attrs are not set on VNodes which may be
715
- * changing order within a `children` array or something along those lines then
716
- * we could obtain a false negative and then have to do needless re-rendering
717
- * (i.e. we'd say two VNodes aren't equal when in fact they should be).
718
- *
719
- * @param leftVNode the first VNode to check
720
- * @param rightVNode the second VNode to check
721
- * @returns whether they're equal or not
722
- */
723
- const isSameVnode = (leftVNode, rightVNode) => {
724
- // compare if two vnode to see if they're "technically" the same
725
- // need to have the same element tag, and same key to be the same
726
- if (leftVNode.$tag$ === rightVNode.$tag$) {
727
- return true;
728
- }
729
- return false;
730
- };
731
- /**
732
- * Handle reconciling an outdated VNode with a new one which corresponds to
733
- * it. This function handles flushing updates to the DOM and reconciling the
734
- * children of the two nodes (if any).
735
- *
736
- * @param oldVNode an old VNode whose DOM element and children we want to update
737
- * @param newVNode a new VNode representing an updated version of the old one
738
- */
739
- const patch = (oldVNode, newVNode) => {
740
- const elm = (newVNode.$elm$ = oldVNode.$elm$);
741
- const oldChildren = oldVNode.$children$;
742
- const newChildren = newVNode.$children$;
743
- const tag = newVNode.$tag$;
744
- const text = newVNode.$text$;
745
- if (text === null) {
746
- {
747
- // test if we're rendering an svg element, or still rendering nodes inside of one
748
- // only add this to the when the compiler sees we're using an svg somewhere
749
- isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
750
- }
751
- {
752
- {
753
- // either this is the first render of an element OR it's an update
754
- // AND we already know it's possible it could have changed
755
- // this updates the element's css classes, attrs, props, listeners, etc.
756
- updateElement(oldVNode, newVNode, isSvgMode);
757
- }
758
- }
759
- if (oldChildren !== null && newChildren !== null) {
760
- // looks like there's child vnodes for both the old and new vnodes
761
- // so we need to call `updateChildren` to reconcile them
762
- updateChildren(elm, oldChildren, newVNode, newChildren);
763
- }
764
- else if (newChildren !== null) {
765
- // no old child vnodes, but there are new child vnodes to add
766
- if (oldVNode.$text$ !== null) {
767
- // the old vnode was text, so be sure to clear it out
768
- elm.textContent = '';
769
- }
770
- // add the new vnode children
771
- addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
772
- }
773
- else if (oldChildren !== null) {
774
- // no new child vnodes, but there are old child vnodes to remove
775
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
776
- }
777
- if (isSvgMode && tag === 'svg') {
778
- isSvgMode = false;
779
- }
780
- }
781
- else if (oldVNode.$text$ !== text) {
782
- // update the text content for the text only vnode
783
- // and also only if the text is different than before
784
- elm.data = text;
785
- }
786
- };
787
- /**
788
- * The main entry point for Stencil's virtual DOM-based rendering engine
789
- *
790
- * Given a {@link d.HostRef} container and some virtual DOM nodes, this
791
- * function will handle creating a virtual DOM tree with a single root, patching
792
- * the current virtual DOM tree onto an old one (if any), dealing with slot
793
- * relocation, and reflecting attributes.
794
- *
795
- * @param hostRef data needed to root and render the virtual DOM tree, such as
796
- * the DOM node into which it should be rendered.
797
- * @param renderFnResults the virtual DOM nodes to be rendered
798
- * @param isInitialLoad whether or not this is the first call after page load
799
- */
800
- const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
801
- const hostElm = hostRef.$hostElement$;
802
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
803
- // if `renderFnResults` is a Host node then we can use it directly. If not,
804
- // we need to call `h` again to wrap the children of our component in a
805
- // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
806
- // implicitly that the top-level vdom node is 1) an only child and 2)
807
- // contains attrs that need to be set on the host element.
808
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
809
- hostTagName = hostElm.tagName;
810
- // On the first render and *only* on the first render we want to check for
811
- // any attributes set on the host element which are also set on the vdom
812
- // node. If we find them, we override the value on the VDom node attrs with
813
- // the value from the host element, which allows developers building apps
814
- // with Stencil components to override e.g. the `role` attribute on a
815
- // component even if it's already set on the `Host`.
816
- if (isInitialLoad && rootVnode.$attrs$) {
817
- for (const key of Object.keys(rootVnode.$attrs$)) {
818
- // We have a special implementation in `setAccessor` for `style` and
819
- // `class` which reconciles values coming from the VDom with values
820
- // already present on the DOM element, so we don't want to override those
821
- // attributes on the VDom tree with values from the host element if they
822
- // are present.
823
- //
824
- // Likewise, `ref` and `key` are special internal values for the Stencil
825
- // runtime and we don't want to override those either.
826
- if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
827
- rootVnode.$attrs$[key] = hostElm[key];
828
- }
829
- }
830
- }
831
- rootVnode.$tag$ = null;
832
- rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
833
- hostRef.$vnode$ = rootVnode;
834
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
835
- {
836
- scopeId = hostElm['s-sc'];
837
- }
838
- // synchronous patch
839
- patch(oldVNode, rootVnode);
840
- };
841
- const attachToAncestor = (hostRef, ancestorComponent) => {
842
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
843
- ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
844
- }
845
- };
846
- const scheduleUpdate = (hostRef, isInitialLoad) => {
847
- {
848
- hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
849
- }
850
- if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
851
- hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
852
- return;
853
- }
854
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
855
- // there is no ancestor component or the ancestor component
856
- // has already fired off its lifecycle update then
857
- // fire off the initial update
858
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
859
- return writeTask(dispatch) ;
860
- };
861
- /**
862
- * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
863
- * component lifecycle methods like `componentWillLoad` as well as
864
- * {@link updateComponent}, which will kick off the virtual DOM re-render.
865
- *
866
- * @param hostRef a reference to a host DOM node
867
- * @param isInitialLoad whether we're on the initial load or not
868
- * @returns an empty Promise which is used to enqueue a series of operations for
869
- * the component
870
- */
871
- const dispatchHooks = (hostRef, isInitialLoad) => {
872
- const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
873
- const instance = hostRef.$lazyInstance$ ;
874
- // We're going to use this variable together with `enqueue` to implement a
875
- // little promise-based queue. We start out with it `undefined`. When we add
876
- // the first function to the queue we'll set this variable to be that
877
- // function's return value. When we attempt to add subsequent values to the
878
- // queue we'll check that value and, if it was a `Promise`, we'll then chain
879
- // the new function off of that `Promise` using `.then()`. This will give our
880
- // queue two nice properties:
881
- //
882
- // 1. If all functions added to the queue are synchronous they'll be called
883
- // synchronously right away.
884
- // 2. If all functions added to the queue are asynchronous they'll all be
885
- // called in order after `dispatchHooks` exits.
886
- let maybePromise;
887
- endSchedule();
888
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
889
- };
890
- /**
891
- * This function uses a Promise to implement a simple first-in, first-out queue
892
- * of functions to be called.
893
- *
894
- * The queue is ordered on the basis of the first argument. If it's
895
- * `undefined`, then nothing is on the queue yet, so the provided function can
896
- * be called synchronously (although note that this function may return a
897
- * `Promise`). The idea is that then the return value of that enqueueing
898
- * operation is kept around, so that if it was a `Promise` then subsequent
899
- * functions can be enqueued by calling this function again with that `Promise`
900
- * as the first argument.
901
- *
902
- * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
903
- * @param fn a function to enqueue
904
- * @returns either a `Promise` or the return value of the provided function
905
- */
906
- const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
907
- /**
908
- * Check that a value is a `Promise`. To check, we first see if the value is an
909
- * instance of the `Promise` global. In a few circumstances, in particular if
910
- * the global has been overwritten, this is could be misleading, so we also do
911
- * a little 'duck typing' check to see if the `.then` property of the value is
912
- * defined and a function.
913
- *
914
- * @param maybePromise it might be a promise!
915
- * @returns whether it is or not
916
- */
917
- const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
918
- (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
919
- /**
920
- * Update a component given reference to its host elements and so on.
921
- *
922
- * @param hostRef an object containing references to the element's host node,
923
- * VDom nodes, and other metadata
924
- * @param instance a reference to the underlying host element where it will be
925
- * rendered
926
- * @param isInitialLoad whether or not this function is being called as part of
927
- * the first render cycle
928
- */
929
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
930
- var _a;
931
- const elm = hostRef.$hostElement$;
932
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
933
- const rc = elm['s-rc'];
934
- if (isInitialLoad) {
935
- // DOM WRITE!
936
- attachStyles(hostRef);
937
- }
938
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
939
- {
940
- callRender(hostRef, instance, elm, isInitialLoad);
941
- }
942
- if (rc) {
943
- // ok, so turns out there are some child host elements
944
- // waiting on this parent element to load
945
- // let's fire off all update callbacks waiting
946
- rc.map((cb) => cb());
947
- elm['s-rc'] = undefined;
948
- }
949
- endRender();
950
- endUpdate();
951
- {
952
- const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
953
- const postUpdate = () => postUpdateComponent(hostRef);
954
- if (childrenPromises.length === 0) {
955
- postUpdate();
956
- }
957
- else {
958
- Promise.all(childrenPromises).then(postUpdate);
959
- hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
960
- childrenPromises.length = 0;
961
- }
962
- }
963
- };
964
- /**
965
- * Handle making the call to the VDom renderer with the proper context given
966
- * various build variables
967
- *
968
- * @param hostRef an object containing references to the element's host node,
969
- * VDom nodes, and other metadata
970
- * @param instance a reference to the underlying host element where it will be
971
- * rendered
972
- * @param elm the Host element for the component
973
- * @param isInitialLoad whether or not this function is being called as part of
974
- * @returns an empty promise
975
- */
976
- const callRender = (hostRef, instance, elm, isInitialLoad) => {
977
- try {
978
- instance = instance.render() ;
979
- {
980
- hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
981
- }
982
- {
983
- hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
984
- }
985
- {
986
- {
987
- // looks like we've got child nodes to render into this host element
988
- // or we need to update the css class/attrs on the host element
989
- // DOM WRITE!
990
- {
991
- renderVdom(hostRef, instance, isInitialLoad);
992
- }
993
- }
994
- }
995
- }
996
- catch (e) {
997
- consoleError(e, hostRef.$hostElement$);
998
- }
999
- return null;
1000
- };
1001
- const postUpdateComponent = (hostRef) => {
1002
- const tagName = hostRef.$cmpMeta$.$tagName$;
1003
- const elm = hostRef.$hostElement$;
1004
- const endPostUpdate = createTime('postUpdate', tagName);
1005
- const ancestorComponent = hostRef.$ancestorComponent$;
1006
- if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1007
- hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1008
- {
1009
- // DOM WRITE!
1010
- addHydratedFlag(elm);
1011
- }
1012
- endPostUpdate();
1013
- {
1014
- hostRef.$onReadyResolve$(elm);
1015
- if (!ancestorComponent) {
1016
- appDidLoad();
1017
- }
1018
- }
1019
- }
1020
- else {
1021
- endPostUpdate();
1022
- }
1023
- // load events fire from bottom to top
1024
- // the deepest elements load first then bubbles up
1025
- {
1026
- if (hostRef.$onRenderResolve$) {
1027
- hostRef.$onRenderResolve$();
1028
- hostRef.$onRenderResolve$ = undefined;
1029
- }
1030
- if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1031
- nextTick(() => scheduleUpdate(hostRef, false));
1032
- }
1033
- hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1034
- }
1035
- // ( •_•)
1036
- // ( •_•)>⌐■-■
1037
- // (⌐■_■)
1038
- };
1039
- const appDidLoad = (who) => {
1040
- // on appload
1041
- // we have finish the first big initial render
1042
- {
1043
- addHydratedFlag(doc.documentElement);
1044
- }
1045
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1046
- };
1047
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1048
- ;
1049
- const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1050
- const setValue = (ref, propName, newVal, cmpMeta) => {
1051
- // check our new property value against our internal value
1052
- const hostRef = getHostRef(ref);
1053
- const oldVal = hostRef.$instanceValues$.get(propName);
1054
- const flags = hostRef.$flags$;
1055
- const instance = hostRef.$lazyInstance$ ;
1056
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1057
- // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1058
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1059
- const didValueChange = newVal !== oldVal && !areBothNaN;
1060
- if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1061
- // gadzooks! the property's value has changed!!
1062
- // set our new value!
1063
- hostRef.$instanceValues$.set(propName, newVal);
1064
- if (instance) {
1065
- if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1066
- // looks like this value actually changed, so we've got work to do!
1067
- // but only if we've already rendered, otherwise just chill out
1068
- // queue that we need to do an update, but don't worry about queuing
1069
- // up millions cuz this function ensures it only runs once
1070
- scheduleUpdate(hostRef, false);
1071
- }
1072
- }
1073
- }
1074
- };
1075
- /**
1076
- * Attach a series of runtime constructs to a compiled Stencil component
1077
- * constructor, including getters and setters for the `@Prop` and `@State`
1078
- * decorators, callbacks for when attributes change, and so on.
1079
- *
1080
- * @param Cstr the constructor for a component that we need to process
1081
- * @param cmpMeta metadata collected previously about the component
1082
- * @param flags a number used to store a series of bit flags
1083
- * @returns a reference to the same constructor passed in (but now mutated)
1084
- */
1085
- const proxyComponent = (Cstr, cmpMeta, flags) => {
1086
- if (cmpMeta.$members$) {
1087
- // It's better to have a const than two Object.entries()
1088
- const members = Object.entries(cmpMeta.$members$);
1089
- const prototype = Cstr.prototype;
1090
- members.map(([memberName, [memberFlags]]) => {
1091
- if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1092
- ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1093
- // proxyComponent - prop
1094
- Object.defineProperty(prototype, memberName, {
1095
- get() {
1096
- // proxyComponent, get value
1097
- return getValue(this, memberName);
1098
- },
1099
- set(newValue) {
1100
- // proxyComponent, set value
1101
- setValue(this, memberName, newValue, cmpMeta);
1102
- },
1103
- configurable: true,
1104
- enumerable: true,
1105
- });
1106
- }
1107
- });
1108
- if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1109
- const attrNameToPropName = new Map();
1110
- prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1111
- plt.jmp(() => {
1112
- const propName = attrNameToPropName.get(attrName);
1113
- // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1114
- // in the case where an attribute was set inline.
1115
- // ```html
1116
- // <my-component some-attribute="some-value"></my-component>
1117
- // ```
1118
- //
1119
- // There is an edge case where a developer sets the attribute inline on a custom element and then
1120
- // programmatically changes it before it has been upgraded as shown below:
1121
- //
1122
- // ```html
1123
- // <!-- this component has _not_ been upgraded yet -->
1124
- // <my-component id="test" some-attribute="some-value"></my-component>
1125
- // <script>
1126
- // // grab non-upgraded component
1127
- // el = document.querySelector("#test");
1128
- // el.someAttribute = "another-value";
1129
- // // upgrade component
1130
- // customElements.define('my-component', MyComponent);
1131
- // </script>
1132
- // ```
1133
- // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1134
- // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1135
- // to the value that was set inline i.e. "some-value" from above example. When
1136
- // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1137
- //
1138
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1139
- // by connectedCallback as this attributeChangedCallback will not fire.
1140
- //
1141
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1142
- //
1143
- // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1144
- // properties here given that this goes against best practices outlined here
1145
- // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1146
- if (this.hasOwnProperty(propName)) {
1147
- newValue = this[propName];
1148
- delete this[propName];
1149
- }
1150
- else if (prototype.hasOwnProperty(propName) &&
1151
- typeof this[propName] === 'number' &&
1152
- this[propName] == newValue) {
1153
- // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1154
- // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1155
- // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1156
- return;
1157
- }
1158
- this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1159
- });
1160
- };
1161
- // create an array of attributes to observe
1162
- // and also create a map of html attribute name to js property name
1163
- Cstr.observedAttributes = members
1164
- .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1165
- .map(([propName, m]) => {
1166
- const attrName = m[1] || propName;
1167
- attrNameToPropName.set(attrName, propName);
1168
- return attrName;
1169
- });
1170
- }
1171
- }
1172
- return Cstr;
1173
- };
1174
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1175
- // initializeComponent
1176
- if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1177
- // Let the runtime know that the component has been initialized
1178
- hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1179
- {
1180
- // lazy loaded components
1181
- // request the component's implementation to be
1182
- // wired up with the host element
1183
- Cstr = loadModule(cmpMeta);
1184
- if (Cstr.then) {
1185
- // Await creates a micro-task avoid if possible
1186
- const endLoad = uniqueTime();
1187
- Cstr = await Cstr;
1188
- endLoad();
1189
- }
1190
- if (!Cstr.isProxied) {
1191
- proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1192
- Cstr.isProxied = true;
1193
- }
1194
- const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1195
- // ok, time to construct the instance
1196
- // but let's keep track of when we start and stop
1197
- // so that the getters/setters don't incorrectly step on data
1198
- {
1199
- hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1200
- }
1201
- // construct the lazy-loaded component implementation
1202
- // passing the hostRef is very important during
1203
- // construction in order to directly wire together the
1204
- // host element and the lazy-loaded instance
1205
- try {
1206
- new Cstr(hostRef);
1207
- }
1208
- catch (e) {
1209
- consoleError(e);
1210
- }
1211
- {
1212
- hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1213
- }
1214
- endNewInstance();
1215
- }
1216
- if (Cstr.style) {
1217
- // this component has styles but we haven't registered them yet
1218
- let style = Cstr.style;
1219
- const scopeId = getScopeId(cmpMeta);
1220
- if (!styles.has(scopeId)) {
1221
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1222
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1223
- endRegisterStyles();
1224
- }
1225
- }
1226
- }
1227
- // we've successfully created a lazy instance
1228
- const ancestorComponent = hostRef.$ancestorComponent$;
1229
- const schedule = () => scheduleUpdate(hostRef, true);
1230
- if (ancestorComponent && ancestorComponent['s-rc']) {
1231
- // this is the initial load and this component it has an ancestor component
1232
- // but the ancestor component has NOT fired its will update lifecycle yet
1233
- // so let's just cool our jets and wait for the ancestor to continue first
1234
- // this will get fired off when the ancestor component
1235
- // finally gets around to rendering its lazy self
1236
- // fire off the initial update
1237
- ancestorComponent['s-rc'].push(schedule);
1238
- }
1239
- else {
1240
- schedule();
1241
- }
1242
- };
1243
- const fireConnectedCallback = (instance) => {
1244
- };
1245
- const connectedCallback = (elm) => {
1246
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1247
- const hostRef = getHostRef(elm);
1248
- const cmpMeta = hostRef.$cmpMeta$;
1249
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1250
- if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1251
- // first time this component has connected
1252
- hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1253
- {
1254
- // find the first ancestor component (if there is one) and register
1255
- // this component as one of the actively loading child components for its ancestor
1256
- let ancestorComponent = elm;
1257
- while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1258
- // climb up the ancestors looking for the first
1259
- // component that hasn't finished its lifecycle update yet
1260
- if (ancestorComponent['s-p']) {
1261
- // we found this components first ancestor component
1262
- // keep a reference to this component's ancestor component
1263
- attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1264
- break;
1265
- }
1266
- }
1267
- }
1268
- // Lazy properties
1269
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1270
- if (cmpMeta.$members$) {
1271
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1272
- if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1273
- const value = elm[memberName];
1274
- delete elm[memberName];
1275
- elm[memberName] = value;
1276
- }
1277
- });
1278
- }
1279
- {
1280
- initializeComponent(elm, hostRef, cmpMeta);
1281
- }
1282
- }
1283
- else {
1284
- // fire off connectedCallback() on component instance
1285
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1286
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1287
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1288
- }
1289
- }
1290
- endConnected();
1291
- }
1292
- };
1293
- const disconnectInstance = (instance) => {
1294
- };
1295
- const disconnectedCallback = async (elm) => {
1296
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1297
- const hostRef = getHostRef(elm);
1298
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1299
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1300
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1301
- }
1302
- }
1303
- };
1304
- const bootstrapLazy = (lazyBundles, options = {}) => {
1305
- var _a;
1306
- const endBootstrap = createTime();
1307
- const cmpTags = [];
1308
- const exclude = options.exclude || [];
1309
- const customElements = win.customElements;
1310
- const head = doc.head;
1311
- const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1312
- const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1313
- const deferredConnectedCallbacks = [];
1314
- let appLoadFallback;
1315
- let isBootstrapping = true;
1316
- Object.assign(plt, options);
1317
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1318
- lazyBundles.map((lazyBundle) => {
1319
- lazyBundle[1].map((compactMeta) => {
1320
- const cmpMeta = {
1321
- $flags$: compactMeta[0],
1322
- $tagName$: compactMeta[1],
1323
- $members$: compactMeta[2],
1324
- $listeners$: compactMeta[3],
1325
- };
1326
- {
1327
- cmpMeta.$members$ = compactMeta[2];
1328
- }
1329
- const tagName = cmpMeta.$tagName$;
1330
- const HostElement = class extends HTMLElement {
1331
- // StencilLazyHost
1332
- constructor(self) {
1333
- // @ts-ignore
1334
- super(self);
1335
- self = this;
1336
- registerHost(self, cmpMeta);
1337
- if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1338
- // this component is using shadow dom
1339
- // and this browser supports shadow dom
1340
- // add the read-only property "shadowRoot" to the host element
1341
- // adding the shadow root build conditionals to minimize runtime
1342
- {
1343
- {
1344
- self.attachShadow({ mode: 'open' });
1345
- }
1346
- }
1347
- }
1348
- }
1349
- connectedCallback() {
1350
- if (appLoadFallback) {
1351
- clearTimeout(appLoadFallback);
1352
- appLoadFallback = null;
1353
- }
1354
- if (isBootstrapping) {
1355
- // connectedCallback will be processed once all components have been registered
1356
- deferredConnectedCallbacks.push(this);
1357
- }
1358
- else {
1359
- plt.jmp(() => connectedCallback(this));
1360
- }
1361
- }
1362
- disconnectedCallback() {
1363
- plt.jmp(() => disconnectedCallback(this));
1364
- }
1365
- componentOnReady() {
1366
- return getHostRef(this).$onReadyPromise$;
1367
- }
1368
- };
1369
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
1370
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1371
- cmpTags.push(tagName);
1372
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1373
- }
1374
- });
1375
- });
1376
- {
1377
- visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1378
- visibilityStyle.setAttribute('data-styles', '');
1379
- // Apply CSP nonce to the style tag if it exists
1380
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1381
- if (nonce != null) {
1382
- visibilityStyle.setAttribute('nonce', nonce);
1383
- }
1384
- head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1385
- }
1386
- // Process deferred connectedCallbacks now all components have been registered
1387
- isBootstrapping = false;
1388
- if (deferredConnectedCallbacks.length) {
1389
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
1390
- }
1391
- else {
1392
- {
1393
- plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1394
- }
1395
- }
1396
- // Fallback appLoad event
1397
- endBootstrap();
1398
- };
1399
- /**
1400
- * Assigns the given value to the nonce property on the runtime platform object.
1401
- * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1402
- * @param nonce The value to be assigned to the platform nonce property.
1403
- * @returns void
1404
- */
1405
- const setNonce = (nonce) => (plt.$nonce$ = nonce);
1406
- const hostRefs = /*@__PURE__*/ new WeakMap();
1407
- const getHostRef = (ref) => hostRefs.get(ref);
1408
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1409
- const registerHost = (elm, cmpMeta) => {
1410
- const hostRef = {
1411
- $flags$: 0,
1412
- $hostElement$: elm,
1413
- $cmpMeta$: cmpMeta,
1414
- $instanceValues$: new Map(),
1415
- };
1416
- {
1417
- hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1418
- elm['s-p'] = [];
1419
- elm['s-rc'] = [];
1420
- }
1421
- return hostRefs.set(elm, hostRef);
1422
- };
1423
- const isMemberInElement = (elm, memberName) => memberName in elm;
1424
- const consoleError = (e, el) => (0, console.error)(e, el);
1425
- const cmpModules = /*@__PURE__*/ new Map();
1426
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1427
- // loadModuleImport
1428
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1429
- const bundleId = cmpMeta.$lazyBundleId$;
1430
- const module = cmpModules.get(bundleId) ;
1431
- if (module) {
1432
- return module[exportName];
1433
- }
1434
-
1435
- if (!hmrVersionId || !BUILD.hotModuleReplacement) {
1436
- const processMod = importedModule => {
1437
- cmpModules.set(bundleId, importedModule);
1438
- return importedModule[exportName];
1439
- }
1440
- switch(bundleId) {
1441
-
1442
- case 'rhc-icon-info_2.cjs':
1443
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1444
- /* webpackMode: "lazy" */
1445
- './rhc-icon-info_2.cjs.entry.js')); }).then(processMod, consoleError);
1446
- case 'rhc-icon-arrow-right.cjs':
1447
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1448
- /* webpackMode: "lazy" */
1449
- './rhc-icon-arrow-right.cjs.entry.js')); }).then(processMod, consoleError);
1450
- case 'rhc-icon-calendar.cjs':
1451
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1452
- /* webpackMode: "lazy" */
1453
- './rhc-icon-calendar.cjs.entry.js')); }).then(processMod, consoleError);
1454
- case 'rhc-icon-error.cjs':
1455
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1456
- /* webpackMode: "lazy" */
1457
- './rhc-icon-error.cjs.entry.js')); }).then(processMod, consoleError);
1458
- case 'rhc-icon-success.cjs':
1459
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1460
- /* webpackMode: "lazy" */
1461
- './rhc-icon-success.cjs.entry.js')); }).then(processMod, consoleError);
1462
- case 'rhc-icon-warning.cjs':
1463
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1464
- /* webpackMode: "lazy" */
1465
- './rhc-icon-warning.cjs.entry.js')); }).then(processMod, consoleError);
1466
- }
1467
- }
1468
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1469
- /* @vite-ignore */
1470
- /* webpackInclude: /\.entry\.js$/ */
1471
- /* webpackExclude: /\.system\.entry\.js$/ */
1472
- /* webpackMode: "lazy" */
1473
- `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
1474
- {
1475
- cmpModules.set(bundleId, importedModule);
1476
- }
1477
- return importedModule[exportName];
1478
- }, consoleError);
1479
- };
1480
- const styles = /*@__PURE__*/ new Map();
1481
- const win = typeof window !== 'undefined' ? window : {};
1482
- const doc = win.document || { head: {} };
1483
- const plt = {
1484
- $flags$: 0,
1485
- $resourcesUrl$: '',
1486
- jmp: (h) => h(),
1487
- raf: (h) => requestAnimationFrame(h),
1488
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1489
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1490
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
1491
- };
1492
- const promiseResolve = (v) => Promise.resolve(v);
1493
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1494
- try {
1495
- new CSSStyleSheet();
1496
- return typeof new CSSStyleSheet().replaceSync === 'function';
1497
- }
1498
- catch (e) { }
1499
- return false;
1500
- })()
1501
- ;
1502
- const queueDomReads = [];
1503
- const queueDomWrites = [];
1504
- const queueTask = (queue, write) => (cb) => {
1505
- queue.push(cb);
1506
- if (!queuePending) {
1507
- queuePending = true;
1508
- if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1509
- nextTick(flush);
1510
- }
1511
- else {
1512
- plt.raf(flush);
1513
- }
1514
- }
1515
- };
1516
- const consume = (queue) => {
1517
- for (let i = 0; i < queue.length; i++) {
1518
- try {
1519
- queue[i](performance.now());
1520
- }
1521
- catch (e) {
1522
- consoleError(e);
1523
- }
1524
- }
1525
- queue.length = 0;
1526
- };
1527
- const flush = () => {
1528
- // always force a bunch of medium callbacks to run, but still have
1529
- // a throttle on how many can run in a certain time
1530
- // DOM READS!!!
1531
- consume(queueDomReads);
1532
- // DOM WRITES!!!
1533
- {
1534
- consume(queueDomWrites);
1535
- if ((queuePending = queueDomReads.length > 0)) {
1536
- // still more to do yet, but we've run out of time
1537
- // let's let this thing cool off and try again in the next tick
1538
- plt.raf(flush);
1539
- }
1540
- }
1541
- };
1542
- const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1543
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1544
-
1545
- exports.bootstrapLazy = bootstrapLazy;
1546
- exports.h = h;
1547
- exports.promiseResolve = promiseResolve;
1548
- exports.registerInstance = registerInstance;
1549
- exports.setNonce = setNonce;
1550
-
1551
- //# sourceMappingURL=index-97a16ac9.js.map