@uoguelph/web-components 1.2.0-rc.6 → 1.2.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +0 -63
  2. package/dist/uofg-web-components/index-CSn7dBx6.js +981 -0
  3. package/dist/uofg-web-components/uofg-alert.esm.js +154 -0
  4. package/dist/uofg-web-components/uofg-footer.esm.js +403 -0
  5. package/dist/uofg-web-components/uofg-header.esm.js +2306 -0
  6. package/dist/uofg-web-components/uofg-modal.esm.js +329 -0
  7. package/dist/uofg-web-components/uofg-web-components.css +1 -1
  8. package/dist/uofg-web-components/uofg-web-components.esm.js +8 -1
  9. package/package.json +21 -35
  10. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  11. package/dist/cjs/index-06b58d35.js +0 -32
  12. package/dist/cjs/index-cdb046b4.js +0 -2092
  13. package/dist/cjs/index.cjs.js +0 -2
  14. package/dist/cjs/loader.cjs.js +0 -15
  15. package/dist/cjs/uofg-alert.cjs.entry.js +0 -21
  16. package/dist/cjs/uofg-back-to-top_5.cjs.entry.js +0 -1387
  17. package/dist/cjs/uofg-modal.cjs.entry.js +0 -172
  18. package/dist/cjs/uofg-web-components.cjs.js +0 -25
  19. package/dist/cjs/utils-3d4b7e2e.js +0 -16
  20. package/dist/collection/collection-manifest.json +0 -18
  21. package/dist/collection/components/uofg-alert/uofg-alert.css +0 -1
  22. package/dist/collection/components/uofg-alert/uofg-alert.js +0 -20
  23. package/dist/collection/components/uofg-back-to-top/uofg-back-to-top.css +0 -1
  24. package/dist/collection/components/uofg-back-to-top/uofg-back-to-top.js +0 -71
  25. package/dist/collection/components/uofg-card/uofg-card.css +0 -1
  26. package/dist/collection/components/uofg-card/uofg-card.js +0 -45
  27. package/dist/collection/components/uofg-footer/uofg-footer.css +0 -1
  28. package/dist/collection/components/uofg-footer/uofg-footer.js +0 -153
  29. package/dist/collection/components/uofg-header/uofg-header.css +0 -1
  30. package/dist/collection/components/uofg-header/uofg-header.js +0 -266
  31. package/dist/collection/components/uofg-menu/uofg-menu.js +0 -438
  32. package/dist/collection/components/uofg-modal/uofg-modal.css +0 -1
  33. package/dist/collection/components/uofg-modal/uofg-modal.js +0 -417
  34. package/dist/collection/index.js +0 -1
  35. package/dist/collection/utils/font-awesome-icon.js +0 -7
  36. package/dist/collection/utils/utils.js +0 -13
  37. package/dist/components/font-awesome-icon.js +0 -10
  38. package/dist/components/index.d.ts +0 -50
  39. package/dist/components/index.js +0 -8
  40. package/dist/components/index2.js +0 -18
  41. package/dist/components/uofg-alert.d.ts +0 -11
  42. package/dist/components/uofg-alert.js +0 -36
  43. package/dist/components/uofg-back-to-top.d.ts +0 -11
  44. package/dist/components/uofg-back-to-top.js +0 -52
  45. package/dist/components/uofg-card.d.ts +0 -11
  46. package/dist/components/uofg-card.js +0 -40
  47. package/dist/components/uofg-footer.d.ts +0 -11
  48. package/dist/components/uofg-footer.js +0 -751
  49. package/dist/components/uofg-header.d.ts +0 -11
  50. package/dist/components/uofg-header.js +0 -398
  51. package/dist/components/uofg-menu.d.ts +0 -11
  52. package/dist/components/uofg-menu.js +0 -6
  53. package/dist/components/uofg-menu2.js +0 -268
  54. package/dist/components/uofg-modal.d.ts +0 -11
  55. package/dist/components/uofg-modal.js +0 -201
  56. package/dist/components/utils.js +0 -12
  57. package/dist/esm/app-globals-0f993ce5.js +0 -3
  58. package/dist/esm/index-0b0002d2.js +0 -2062
  59. package/dist/esm/index-e685921a.js +0 -27
  60. package/dist/esm/index.js +0 -1
  61. package/dist/esm/loader.js +0 -11
  62. package/dist/esm/polyfills/core-js.js +0 -11
  63. package/dist/esm/polyfills/dom.js +0 -79
  64. package/dist/esm/polyfills/es5-html-element.js +0 -1
  65. package/dist/esm/polyfills/index.js +0 -34
  66. package/dist/esm/polyfills/system.js +0 -6
  67. package/dist/esm/uofg-alert.entry.js +0 -17
  68. package/dist/esm/uofg-back-to-top_5.entry.js +0 -1379
  69. package/dist/esm/uofg-modal.entry.js +0 -168
  70. package/dist/esm/uofg-web-components.js +0 -20
  71. package/dist/esm/utils-379bb71a.js +0 -12
  72. package/dist/index.cjs.js +0 -1
  73. package/dist/index.js +0 -1
  74. package/dist/types/components/uofg-alert/uofg-alert.d.ts +0 -3
  75. package/dist/types/components/uofg-back-to-top/uofg-back-to-top.d.ts +0 -10
  76. package/dist/types/components/uofg-card/uofg-card.d.ts +0 -7
  77. package/dist/types/components/uofg-footer/uofg-footer.d.ts +0 -8
  78. package/dist/types/components/uofg-header/uofg-header.d.ts +0 -37
  79. package/dist/types/components/uofg-menu/uofg-menu.d.ts +0 -68
  80. package/dist/types/components/uofg-modal/uofg-modal.d.ts +0 -77
  81. package/dist/types/components.d.ts +0 -303
  82. package/dist/types/index.d.ts +0 -1
  83. package/dist/types/stencil-public-runtime.d.ts +0 -1681
  84. package/dist/types/utils/font-awesome-icon.d.ts +0 -5
  85. package/dist/types/utils/utils.d.ts +0 -4
  86. package/dist/uofg-web-components/index.esm.js +0 -0
  87. package/dist/uofg-web-components/p-6fa0f8f6.js +0 -1
  88. package/dist/uofg-web-components/p-7569d8f2.entry.js +0 -1
  89. package/dist/uofg-web-components/p-976982f6.entry.js +0 -1
  90. package/dist/uofg-web-components/p-e1255160.js +0 -1
  91. package/dist/uofg-web-components/p-ee27db22.js +0 -2
  92. package/dist/uofg-web-components/p-fde6370b.entry.js +0 -1
  93. package/dist/uofg-web-components/p-fec87f9d.js +0 -1
  94. package/loader/cdn.js +0 -3
  95. package/loader/index.cjs.js +0 -3
  96. package/loader/index.d.ts +0 -21
  97. package/loader/index.es2017.js +0 -3
  98. package/loader/index.js +0 -4
  99. package/loader/package.json +0 -11
  100. /package/dist/{collection/components/uofg-header/decoration.svg → uofg-web-components/decorative.svg} +0 -0
  101. /package/dist/{collection/components/uofg-footer → uofg-web-components}/improve-life.svg +0 -0
  102. /package/dist/{collection/components/uofg-header/logo-reduced.svg → uofg-web-components/logo-small.svg} +0 -0
  103. /package/dist/{collection/components/uofg-header/logo-full.svg → uofg-web-components/logo.svg} +0 -0
@@ -1,2092 +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 = 'uofg-web-components';
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 useNativeShadowDom = false;
36
- let isSvgMode = false;
37
- let queueCongestion = 0;
38
- let queuePending = false;
39
- const createTime = (fnName, tagName = '') => {
40
- {
41
- return () => {
42
- return;
43
- };
44
- }
45
- };
46
- const uniqueTime = (key, measureText) => {
47
- {
48
- return () => {
49
- return;
50
- };
51
- }
52
- };
53
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
54
- /**
55
- * Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
56
- *
57
- * Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
58
- * support as of Stencil v4.
59
- */
60
- const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
61
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
62
- /**
63
- * Default style mode id
64
- */
65
- /**
66
- * Reusable empty obj/array
67
- * Don't add values to these!!
68
- */
69
- const EMPTY_OBJ = {};
70
- /**
71
- * Namespaces
72
- */
73
- const SVG_NS = 'http://www.w3.org/2000/svg';
74
- const HTML_NS = 'http://www.w3.org/1999/xhtml';
75
- const isDef = (v) => v != null;
76
- /**
77
- * Check whether a value is a 'complex type', defined here as an object or a
78
- * function.
79
- *
80
- * @param o the value to check
81
- * @returns whether it's a complex type or not
82
- */
83
- const isComplexType = (o) => {
84
- // https://jsperf.com/typeof-fn-object/5
85
- o = typeof o;
86
- return o === 'object' || o === 'function';
87
- };
88
- /**
89
- * Helper method for querying a `meta` tag that contains a nonce value
90
- * out of a DOM's head.
91
- *
92
- * @param doc The DOM containing the `head` to query against
93
- * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
94
- * exists or the tag has no content.
95
- */
96
- function queryNonceMetaTagContent(doc) {
97
- var _a, _b, _c;
98
- 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;
99
- }
100
- /**
101
- * Production h() function based on Preact by
102
- * Jason Miller (@developit)
103
- * Licensed under the MIT License
104
- * https://github.com/developit/preact/blob/master/LICENSE
105
- *
106
- * Modified for Stencil's compiler and vdom
107
- */
108
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
109
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
110
- const h = (nodeName, vnodeData, ...children) => {
111
- let child = null;
112
- let key = null;
113
- let simple = false;
114
- let lastSimple = false;
115
- const vNodeChildren = [];
116
- const walk = (c) => {
117
- for (let i = 0; i < c.length; i++) {
118
- child = c[i];
119
- if (Array.isArray(child)) {
120
- walk(child);
121
- }
122
- else if (child != null && typeof child !== 'boolean') {
123
- if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
124
- child = String(child);
125
- }
126
- if (simple && lastSimple) {
127
- // If the previous child was simple (string), we merge both
128
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
129
- }
130
- else {
131
- // Append a new vNode, if it's text, we create a text vNode
132
- vNodeChildren.push(simple ? newVNode(null, child) : child);
133
- }
134
- lastSimple = simple;
135
- }
136
- }
137
- };
138
- walk(children);
139
- if (vnodeData) {
140
- if (vnodeData.key) {
141
- key = vnodeData.key;
142
- }
143
- // normalize class / className attributes
144
- {
145
- const classData = vnodeData.className || vnodeData.class;
146
- if (classData) {
147
- vnodeData.class =
148
- typeof classData !== 'object'
149
- ? classData
150
- : Object.keys(classData)
151
- .filter((k) => classData[k])
152
- .join(' ');
153
- }
154
- }
155
- }
156
- if (typeof nodeName === 'function') {
157
- // nodeName is a functional component
158
- return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
159
- }
160
- const vnode = newVNode(nodeName, null);
161
- vnode.$attrs$ = vnodeData;
162
- if (vNodeChildren.length > 0) {
163
- vnode.$children$ = vNodeChildren;
164
- }
165
- {
166
- vnode.$key$ = key;
167
- }
168
- return vnode;
169
- };
170
- /**
171
- * A utility function for creating a virtual DOM node from a tag and some
172
- * possible text content.
173
- *
174
- * @param tag the tag for this element
175
- * @param text possible text content for the node
176
- * @returns a newly-minted virtual DOM node
177
- */
178
- const newVNode = (tag, text) => {
179
- const vnode = {
180
- $flags$: 0,
181
- $tag$: tag,
182
- $text$: text,
183
- $elm$: null,
184
- $children$: null,
185
- };
186
- {
187
- vnode.$attrs$ = null;
188
- }
189
- {
190
- vnode.$key$ = null;
191
- }
192
- return vnode;
193
- };
194
- const Host = {};
195
- /**
196
- * Check whether a given node is a Host node or not
197
- *
198
- * @param node the virtual DOM node to check
199
- * @returns whether it's a Host node or not
200
- */
201
- const isHost = (node) => node && node.$tag$ === Host;
202
- /**
203
- * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
204
- *
205
- * Note that these functions convert from {@link d.VNode} to
206
- * {@link d.ChildNode} to give functional component developers a friendly
207
- * interface.
208
- */
209
- const vdomFnUtils = {
210
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
211
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
212
- };
213
- /**
214
- * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
215
- * friendlier public interface (hence, 'convertToPublic').
216
- *
217
- * @param node the virtual DOM node to convert
218
- * @returns a converted child node
219
- */
220
- const convertToPublic = (node) => ({
221
- vattrs: node.$attrs$,
222
- vchildren: node.$children$,
223
- vkey: node.$key$,
224
- vname: node.$name$,
225
- vtag: node.$tag$,
226
- vtext: node.$text$,
227
- });
228
- /**
229
- * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
230
- * order to use the resulting object in the virtual DOM. The initial object was
231
- * likely created as part of presenting a public API, so converting it back
232
- * involved making it 'private' again (hence, `convertToPrivate`).
233
- *
234
- * @param node the child node to convert
235
- * @returns a converted virtual DOM node
236
- */
237
- const convertToPrivate = (node) => {
238
- if (typeof node.vtag === 'function') {
239
- const vnodeData = Object.assign({}, node.vattrs);
240
- if (node.vkey) {
241
- vnodeData.key = node.vkey;
242
- }
243
- if (node.vname) {
244
- vnodeData.name = node.vname;
245
- }
246
- return h(node.vtag, vnodeData, ...(node.vchildren || []));
247
- }
248
- const vnode = newVNode(node.vtag, node.vtext);
249
- vnode.$attrs$ = node.vattrs;
250
- vnode.$children$ = node.vchildren;
251
- vnode.$key$ = node.vkey;
252
- vnode.$name$ = node.vname;
253
- return vnode;
254
- };
255
- /**
256
- * Parse a new property value for a given property type.
257
- *
258
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
259
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
260
- * 1. `any`, the type given to `propValue` in the function signature
261
- * 2. the type stored from `propType`.
262
- *
263
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
264
- *
265
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
266
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
267
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
268
- * ```tsx
269
- * <my-cmp prop-val={0}></my-cmp>
270
- * ```
271
- *
272
- * HTML prop values on the other hand, will always a string
273
- *
274
- * @param propValue the new value to coerce to some type
275
- * @param propType the type of the prop, expressed as a binary number
276
- * @returns the parsed/coerced value
277
- */
278
- const parsePropertyValue = (propValue, propType) => {
279
- // ensure this value is of the correct prop type
280
- if (propValue != null && !isComplexType(propValue)) {
281
- if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
282
- // per the HTML spec, any string value means it is a boolean true value
283
- // but we'll cheat here and say that the string "false" is the boolean false
284
- return propValue === 'false' ? false : propValue === '' || !!propValue;
285
- }
286
- if (propType & 2 /* MEMBER_FLAGS.Number */) {
287
- // force it to be a number
288
- return parseFloat(propValue);
289
- }
290
- if (propType & 1 /* MEMBER_FLAGS.String */) {
291
- // could have been passed as a number or boolean
292
- // but we still want it as a string
293
- return String(propValue);
294
- }
295
- // redundant return here for better minification
296
- return propValue;
297
- }
298
- // not sure exactly what type we want
299
- // so no need to change to a different type
300
- return propValue;
301
- };
302
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
303
- const createEvent = (ref, name, flags) => {
304
- const elm = getElement(ref);
305
- return {
306
- emit: (detail) => {
307
- return emitEvent(elm, name, {
308
- bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
309
- composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
310
- cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
311
- detail,
312
- });
313
- },
314
- };
315
- };
316
- /**
317
- * Helper function to create & dispatch a custom Event on a provided target
318
- * @param elm the target of the Event
319
- * @param name the name to give the custom Event
320
- * @param opts options for configuring a custom Event
321
- * @returns the custom Event
322
- */
323
- const emitEvent = (elm, name, opts) => {
324
- const ev = plt.ce(name, opts);
325
- elm.dispatchEvent(ev);
326
- return ev;
327
- };
328
- const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
329
- const registerStyle = (scopeId, cssText, allowCS) => {
330
- let style = styles.get(scopeId);
331
- if (supportsConstructableStylesheets && allowCS) {
332
- style = (style || new CSSStyleSheet());
333
- if (typeof style === 'string') {
334
- style = cssText;
335
- }
336
- else {
337
- style.replaceSync(cssText);
338
- }
339
- }
340
- else {
341
- style = cssText;
342
- }
343
- styles.set(scopeId, style);
344
- };
345
- const addStyle = (styleContainerNode, cmpMeta, mode) => {
346
- var _a;
347
- const scopeId = getScopeId(cmpMeta);
348
- const style = styles.get(scopeId);
349
- // if an element is NOT connected then getRootNode() will return the wrong root node
350
- // so the fallback is to always use the document for the root node in those cases
351
- styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
352
- if (style) {
353
- if (typeof style === 'string') {
354
- styleContainerNode = styleContainerNode.head || styleContainerNode;
355
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
356
- let styleElm;
357
- if (!appliedStyles) {
358
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
359
- }
360
- if (!appliedStyles.has(scopeId)) {
361
- {
362
- styleElm = doc.createElement('style');
363
- styleElm.innerHTML = style;
364
- // Apply CSP nonce to the style tag if it exists
365
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
366
- if (nonce != null) {
367
- styleElm.setAttribute('nonce', nonce);
368
- }
369
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
370
- }
371
- // Add styles for `slot-fb` elements if we're using slots outside the Shadow DOM
372
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
373
- styleElm.innerHTML += SLOT_FB_CSS;
374
- }
375
- if (appliedStyles) {
376
- appliedStyles.add(scopeId);
377
- }
378
- }
379
- }
380
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
381
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
382
- }
383
- }
384
- return scopeId;
385
- };
386
- const attachStyles = (hostRef) => {
387
- const cmpMeta = hostRef.$cmpMeta$;
388
- const elm = hostRef.$hostElement$;
389
- const flags = cmpMeta.$flags$;
390
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
391
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
392
- if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
393
- // only required when we're NOT using native shadow dom (slot)
394
- // or this browser doesn't support native shadow dom
395
- // and this host element was NOT created with SSR
396
- // let's pick out the inner content for slot projection
397
- // create a node to represent where the original
398
- // content was first placed, which is useful later on
399
- // DOM WRITE!!
400
- elm['s-sc'] = scopeId;
401
- elm.classList.add(scopeId + '-h');
402
- }
403
- endAttachStyles();
404
- };
405
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
406
- /**
407
- * Production setAccessor() function based on Preact by
408
- * Jason Miller (@developit)
409
- * Licensed under the MIT License
410
- * https://github.com/developit/preact/blob/master/LICENSE
411
- *
412
- * Modified for Stencil's compiler and vdom
413
- */
414
- /**
415
- * When running a VDom render set properties present on a VDom node onto the
416
- * corresponding HTML element.
417
- *
418
- * Note that this function has special functionality for the `class`,
419
- * `style`, `key`, and `ref` attributes, as well as event handlers (like
420
- * `onClick`, etc). All others are just passed through as-is.
421
- *
422
- * @param elm the HTMLElement onto which attributes should be set
423
- * @param memberName the name of the attribute to set
424
- * @param oldValue the old value for the attribute
425
- * @param newValue the new value for the attribute
426
- * @param isSvg whether we're in an svg context or not
427
- * @param flags bitflags for Vdom variables
428
- */
429
- const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
430
- if (oldValue !== newValue) {
431
- let isProp = isMemberInElement(elm, memberName);
432
- let ln = memberName.toLowerCase();
433
- if (memberName === 'class') {
434
- const classList = elm.classList;
435
- const oldClasses = parseClassList(oldValue);
436
- const newClasses = parseClassList(newValue);
437
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
438
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
439
- }
440
- else if (memberName === 'style') {
441
- // update style attribute, css properties and values
442
- {
443
- for (const prop in oldValue) {
444
- if (!newValue || newValue[prop] == null) {
445
- if (prop.includes('-')) {
446
- elm.style.removeProperty(prop);
447
- }
448
- else {
449
- elm.style[prop] = '';
450
- }
451
- }
452
- }
453
- }
454
- for (const prop in newValue) {
455
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
456
- if (prop.includes('-')) {
457
- elm.style.setProperty(prop, newValue[prop]);
458
- }
459
- else {
460
- elm.style[prop] = newValue[prop];
461
- }
462
- }
463
- }
464
- }
465
- else if (memberName === 'key')
466
- ;
467
- else if (memberName === 'ref') {
468
- // minifier will clean this up
469
- if (newValue) {
470
- newValue(elm);
471
- }
472
- }
473
- else if ((!isProp ) &&
474
- memberName[0] === 'o' &&
475
- memberName[1] === 'n') {
476
- // Event Handlers
477
- // so if the member name starts with "on" and the 3rd characters is
478
- // a capital letter, and it's not already a member on the element,
479
- // then we're assuming it's an event listener
480
- if (memberName[2] === '-') {
481
- // on- prefixed events
482
- // allows to be explicit about the dom event to listen without any magic
483
- // under the hood:
484
- // <my-cmp on-click> // listens for "click"
485
- // <my-cmp on-Click> // listens for "Click"
486
- // <my-cmp on-ionChange> // listens for "ionChange"
487
- // <my-cmp on-EVENTS> // listens for "EVENTS"
488
- memberName = memberName.slice(3);
489
- }
490
- else if (isMemberInElement(win, ln)) {
491
- // standard event
492
- // the JSX attribute could have been "onMouseOver" and the
493
- // member name "onmouseover" is on the window's prototype
494
- // so let's add the listener "mouseover", which is all lowercased
495
- memberName = ln.slice(2);
496
- }
497
- else {
498
- // custom event
499
- // the JSX attribute could have been "onMyCustomEvent"
500
- // so let's trim off the "on" prefix and lowercase the first character
501
- // and add the listener "myCustomEvent"
502
- // except for the first character, we keep the event name case
503
- memberName = ln[2] + memberName.slice(3);
504
- }
505
- if (oldValue || newValue) {
506
- // Need to account for "capture" events.
507
- // If the event name ends with "Capture", we'll update the name to remove
508
- // the "Capture" suffix and make sure the event listener is setup to handle the capture event.
509
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
510
- // Make sure we only replace the last instance of "Capture"
511
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
512
- if (oldValue) {
513
- plt.rel(elm, memberName, oldValue, capture);
514
- }
515
- if (newValue) {
516
- plt.ael(elm, memberName, newValue, capture);
517
- }
518
- }
519
- }
520
- else {
521
- // Set property if it exists and it's not a SVG
522
- const isComplex = isComplexType(newValue);
523
- if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
524
- try {
525
- if (!elm.tagName.includes('-')) {
526
- const n = newValue == null ? '' : newValue;
527
- // Workaround for Safari, moving the <input> caret when re-assigning the same valued
528
- if (memberName === 'list') {
529
- isProp = false;
530
- }
531
- else if (oldValue == null || elm[memberName] != n) {
532
- elm[memberName] = n;
533
- }
534
- }
535
- else {
536
- elm[memberName] = newValue;
537
- }
538
- }
539
- catch (e) {
540
- /**
541
- * in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
542
- */
543
- }
544
- }
545
- /**
546
- * Need to manually update attribute if:
547
- * - memberName is not an attribute
548
- * - if we are rendering the host element in order to reflect attribute
549
- * - if it's a SVG, since properties might not work in <svg>
550
- * - if the newValue is null/undefined or 'false'.
551
- */
552
- let xlink = false;
553
- {
554
- if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
555
- memberName = ln;
556
- xlink = true;
557
- }
558
- }
559
- if (newValue == null || newValue === false) {
560
- if (newValue !== false || elm.getAttribute(memberName) === '') {
561
- if (xlink) {
562
- elm.removeAttributeNS(XLINK_NS, memberName);
563
- }
564
- else {
565
- elm.removeAttribute(memberName);
566
- }
567
- }
568
- }
569
- else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
570
- newValue = newValue === true ? '' : newValue;
571
- if (xlink) {
572
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
573
- }
574
- else {
575
- elm.setAttribute(memberName, newValue);
576
- }
577
- }
578
- }
579
- }
580
- };
581
- const parseClassListRegex = /\s/;
582
- /**
583
- * Parsed a string of classnames into an array
584
- * @param value className string, e.g. "foo bar baz"
585
- * @returns list of classes, e.g. ["foo", "bar", "baz"]
586
- */
587
- const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
588
- const CAPTURE_EVENT_SUFFIX = 'Capture';
589
- const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
590
- const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
591
- // if the element passed in is a shadow root, which is a document fragment
592
- // then we want to be adding attrs/props to the shadow root's "host" element
593
- // if it's not a shadow root, then we add attrs/props to the same element
594
- const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
595
- ? newVnode.$elm$.host
596
- : newVnode.$elm$;
597
- const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
598
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
599
- {
600
- // remove attributes no longer present on the vnode by setting them to undefined
601
- for (memberName in oldVnodeAttrs) {
602
- if (!(memberName in newVnodeAttrs)) {
603
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
604
- }
605
- }
606
- }
607
- // add new & update changed attributes
608
- for (memberName in newVnodeAttrs) {
609
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
610
- }
611
- };
612
- /**
613
- * Create a DOM Node corresponding to one of the children of a given VNode.
614
- *
615
- * @param oldParentVNode the parent VNode from the previous render
616
- * @param newParentVNode the parent VNode from the current render
617
- * @param childIndex the index of the VNode, in the _new_ parent node's
618
- * children, for which we will create a new DOM node
619
- * @param parentElm the parent DOM node which our new node will be a child of
620
- * @returns the newly created node
621
- */
622
- const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
623
- // tslint:disable-next-line: prefer-const
624
- const newVNode = newParentVNode.$children$[childIndex];
625
- let i = 0;
626
- let elm;
627
- let childNode;
628
- if (newVNode.$text$ !== null) {
629
- // create text node
630
- elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
631
- }
632
- else {
633
- if (!isSvgMode) {
634
- isSvgMode = newVNode.$tag$ === 'svg';
635
- }
636
- // create element
637
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
638
- );
639
- if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
640
- isSvgMode = false;
641
- }
642
- // add css classes, attrs, props, listeners, etc.
643
- {
644
- updateElement(null, newVNode, isSvgMode);
645
- }
646
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
647
- // if there is a scopeId and this is the initial render
648
- // then let's add the scopeId as a css class
649
- elm.classList.add((elm['s-si'] = scopeId));
650
- }
651
- if (newVNode.$children$) {
652
- for (i = 0; i < newVNode.$children$.length; ++i) {
653
- // create the node
654
- childNode = createElm(oldParentVNode, newVNode, i);
655
- // return node could have been null
656
- if (childNode) {
657
- // append our new node
658
- elm.appendChild(childNode);
659
- }
660
- }
661
- }
662
- {
663
- if (newVNode.$tag$ === 'svg') {
664
- // Only reset the SVG context when we're exiting <svg> element
665
- isSvgMode = false;
666
- }
667
- else if (elm.tagName === 'foreignObject') {
668
- // Reenter SVG context when we're exiting <foreignObject> element
669
- isSvgMode = true;
670
- }
671
- }
672
- }
673
- // This needs to always happen so we can hide nodes that are projected
674
- // to another component but don't end up in a slot
675
- elm['s-hn'] = hostTagName;
676
- return elm;
677
- };
678
- /**
679
- * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
680
- * add them to the DOM in the appropriate place.
681
- *
682
- * @param parentElm the DOM node which should be used as a parent for the new
683
- * DOM nodes
684
- * @param before a child of the `parentElm` which the new children should be
685
- * inserted before (optional)
686
- * @param parentVNode the parent virtual DOM node
687
- * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
688
- * @param startIdx the index in the child virtual DOM nodes at which to start
689
- * creating DOM nodes (inclusive)
690
- * @param endIdx the index in the child virtual DOM nodes at which to stop
691
- * creating DOM nodes (inclusive)
692
- */
693
- const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
694
- let containerElm = (parentElm);
695
- let childNode;
696
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
697
- containerElm = containerElm.shadowRoot;
698
- }
699
- for (; startIdx <= endIdx; ++startIdx) {
700
- if (vnodes[startIdx]) {
701
- childNode = createElm(null, parentVNode, startIdx);
702
- if (childNode) {
703
- vnodes[startIdx].$elm$ = childNode;
704
- containerElm.insertBefore(childNode, before);
705
- }
706
- }
707
- }
708
- };
709
- /**
710
- * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
711
- * This can be used to, for instance, clean up after a list of children which
712
- * should no longer be shown.
713
- *
714
- * This function also handles some of Stencil's slot relocation logic.
715
- *
716
- * @param vnodes a list of virtual DOM nodes to remove
717
- * @param startIdx the index at which to start removing nodes (inclusive)
718
- * @param endIdx the index at which to stop removing nodes (inclusive)
719
- */
720
- const removeVnodes = (vnodes, startIdx, endIdx) => {
721
- for (let index = startIdx; index <= endIdx; ++index) {
722
- const vnode = vnodes[index];
723
- if (vnode) {
724
- const elm = vnode.$elm$;
725
- nullifyVNodeRefs(vnode);
726
- if (elm) {
727
- // remove the vnode's element from the dom
728
- elm.remove();
729
- }
730
- }
731
- }
732
- };
733
- /**
734
- * Reconcile the children of a new VNode with the children of an old VNode by
735
- * traversing the two collections of children, identifying nodes that are
736
- * conserved or changed, calling out to `patch` to make any necessary
737
- * updates to the DOM, and rearranging DOM nodes as needed.
738
- *
739
- * The algorithm for reconciling children works by analyzing two 'windows' onto
740
- * the two arrays of children (`oldCh` and `newCh`). We keep track of the
741
- * 'windows' by storing start and end indices and references to the
742
- * corresponding array entries. Initially the two 'windows' are basically equal
743
- * to the entire array, but we progressively narrow the windows until there are
744
- * no children left to update by doing the following:
745
- *
746
- * 1. Skip any `null` entries at the beginning or end of the two arrays, so
747
- * that if we have an initial array like the following we'll end up dealing
748
- * only with a window bounded by the highlighted elements:
749
- *
750
- * [null, null, VNode1 , ... , VNode2, null, null]
751
- * ^^^^^^ ^^^^^^
752
- *
753
- * 2. Check to see if the elements at the head and tail positions are equal
754
- * across the windows. This will basically detect elements which haven't
755
- * been added, removed, or changed position, i.e. if you had the following
756
- * VNode elements (represented as HTML):
757
- *
758
- * oldVNode: `<div><p><span>HEY</span></p></div>`
759
- * newVNode: `<div><p><span>THERE</span></p></div>`
760
- *
761
- * Then when comparing the children of the `<div>` tag we check the equality
762
- * of the VNodes corresponding to the `<p>` tags and, since they are the
763
- * same tag in the same position, we'd be able to avoid completely
764
- * re-rendering the subtree under them with a new DOM element and would just
765
- * call out to `patch` to handle reconciling their children and so on.
766
- *
767
- * 3. Check, for both windows, to see if the element at the beginning of the
768
- * window corresponds to the element at the end of the other window. This is
769
- * a heuristic which will let us identify _some_ situations in which
770
- * elements have changed position, for instance it _should_ detect that the
771
- * children nodes themselves have not changed but merely moved in the
772
- * following example:
773
- *
774
- * oldVNode: `<div><element-one /><element-two /></div>`
775
- * newVNode: `<div><element-two /><element-one /></div>`
776
- *
777
- * If we find cases like this then we also need to move the concrete DOM
778
- * elements corresponding to the moved children to write the re-order to the
779
- * DOM.
780
- *
781
- * 4. Finally, if VNodes have the `key` attribute set on them we check for any
782
- * nodes in the old children which have the same key as the first element in
783
- * our window on the new children. If we find such a node we handle calling
784
- * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
785
- * what we find.
786
- *
787
- * Finally, once we've narrowed our 'windows' to the point that either of them
788
- * collapse (i.e. they have length 0) we then handle any remaining VNode
789
- * insertion or deletion that needs to happen to get a DOM state that correctly
790
- * reflects the new child VNodes. If, for instance, after our window on the old
791
- * children has collapsed we still have more nodes on the new children that
792
- * we haven't dealt with yet then we need to add them, or if the new children
793
- * collapse but we still have unhandled _old_ children then we need to make
794
- * sure the corresponding DOM nodes are removed.
795
- *
796
- * @param parentElm the node into which the parent VNode is rendered
797
- * @param oldCh the old children of the parent node
798
- * @param newVNode the new VNode which will replace the parent
799
- * @param newCh the new children of the parent node
800
- * @param isInitialRender whether or not this is the first render of the vdom
801
- */
802
- const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
803
- let oldStartIdx = 0;
804
- let newStartIdx = 0;
805
- let idxInOld = 0;
806
- let i = 0;
807
- let oldEndIdx = oldCh.length - 1;
808
- let oldStartVnode = oldCh[0];
809
- let oldEndVnode = oldCh[oldEndIdx];
810
- let newEndIdx = newCh.length - 1;
811
- let newStartVnode = newCh[0];
812
- let newEndVnode = newCh[newEndIdx];
813
- let node;
814
- let elmToMove;
815
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
816
- if (oldStartVnode == null) {
817
- // VNode might have been moved left
818
- oldStartVnode = oldCh[++oldStartIdx];
819
- }
820
- else if (oldEndVnode == null) {
821
- oldEndVnode = oldCh[--oldEndIdx];
822
- }
823
- else if (newStartVnode == null) {
824
- newStartVnode = newCh[++newStartIdx];
825
- }
826
- else if (newEndVnode == null) {
827
- newEndVnode = newCh[--newEndIdx];
828
- }
829
- else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
830
- // if the start nodes are the same then we should patch the new VNode
831
- // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
832
- // indices to reflect that. We don't need to move any DOM Nodes around
833
- // since things are matched up in order.
834
- patch(oldStartVnode, newStartVnode, isInitialRender);
835
- oldStartVnode = oldCh[++oldStartIdx];
836
- newStartVnode = newCh[++newStartIdx];
837
- }
838
- else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
839
- // likewise, if the end nodes are the same we patch new onto old and
840
- // decrement our end indices, and also likewise in this case we don't
841
- // need to move any DOM Nodes.
842
- patch(oldEndVnode, newEndVnode, isInitialRender);
843
- oldEndVnode = oldCh[--oldEndIdx];
844
- newEndVnode = newCh[--newEndIdx];
845
- }
846
- else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
847
- patch(oldStartVnode, newEndVnode, isInitialRender);
848
- // We need to move the element for `oldStartVnode` into a position which
849
- // will be appropriate for `newEndVnode`. For this we can use
850
- // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
851
- // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
852
- // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
853
- //
854
- // <old-start-node />
855
- // <some-intervening-node />
856
- // <old-end-node />
857
- // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
858
- // <next-sibling />
859
- //
860
- // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
861
- // the node for `oldStartVnode` at the end of the children of
862
- // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
863
- // aren't any siblings, and passing `null` to `Node.insertBefore` will
864
- // append it to the children of the parent element.
865
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
866
- oldStartVnode = oldCh[++oldStartIdx];
867
- newEndVnode = newCh[--newEndIdx];
868
- }
869
- else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
870
- patch(oldEndVnode, newStartVnode, isInitialRender);
871
- // We've already checked above if `oldStartVnode` and `newStartVnode` are
872
- // the same node, so since we're here we know that they are not. Thus we
873
- // can move the element for `oldEndVnode` _before_ the element for
874
- // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
875
- // future.
876
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
877
- oldEndVnode = oldCh[--oldEndIdx];
878
- newStartVnode = newCh[++newStartIdx];
879
- }
880
- else {
881
- // Here we do some checks to match up old and new nodes based on the
882
- // `$key$` attribute, which is set by putting a `key="my-key"` attribute
883
- // in the JSX for a DOM element in the implementation of a Stencil
884
- // component.
885
- //
886
- // First we check to see if there are any nodes in the array of old
887
- // children which have the same key as the first node in the new
888
- // children.
889
- idxInOld = -1;
890
- {
891
- for (i = oldStartIdx; i <= oldEndIdx; ++i) {
892
- if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
893
- idxInOld = i;
894
- break;
895
- }
896
- }
897
- }
898
- if (idxInOld >= 0) {
899
- // We found a node in the old children which matches up with the first
900
- // node in the new children! So let's deal with that
901
- elmToMove = oldCh[idxInOld];
902
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
903
- // the tag doesn't match so we'll need a new DOM element
904
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
905
- }
906
- else {
907
- patch(elmToMove, newStartVnode, isInitialRender);
908
- // invalidate the matching old node so that we won't try to update it
909
- // again later on
910
- oldCh[idxInOld] = undefined;
911
- node = elmToMove.$elm$;
912
- }
913
- newStartVnode = newCh[++newStartIdx];
914
- }
915
- else {
916
- // We either didn't find an element in the old children that matches
917
- // the key of the first new child OR the build is not using `key`
918
- // attributes at all. In either case we need to create a new element
919
- // for the new node.
920
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
921
- newStartVnode = newCh[++newStartIdx];
922
- }
923
- if (node) {
924
- // if we created a new node then handle inserting it to the DOM
925
- {
926
- oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
927
- }
928
- }
929
- }
930
- }
931
- if (oldStartIdx > oldEndIdx) {
932
- // we have some more new nodes to add which don't match up with old nodes
933
- addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
934
- }
935
- else if (newStartIdx > newEndIdx) {
936
- // there are nodes in the `oldCh` array which no longer correspond to nodes
937
- // in the new array, so lets remove them (which entails cleaning up the
938
- // relevant DOM nodes)
939
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
940
- }
941
- };
942
- /**
943
- * Compare two VNodes to determine if they are the same
944
- *
945
- * **NB**: This function is an equality _heuristic_ based on the available
946
- * information set on the two VNodes and can be misleading under certain
947
- * circumstances. In particular, if the two nodes do not have `key` attrs
948
- * (available under `$key$` on VNodes) then the function falls back on merely
949
- * checking that they have the same tag.
950
- *
951
- * So, in other words, if `key` attrs are not set on VNodes which may be
952
- * changing order within a `children` array or something along those lines then
953
- * we could obtain a false negative and then have to do needless re-rendering
954
- * (i.e. we'd say two VNodes aren't equal when in fact they should be).
955
- *
956
- * @param leftVNode the first VNode to check
957
- * @param rightVNode the second VNode to check
958
- * @param isInitialRender whether or not this is the first render of the vdom
959
- * @returns whether they're equal or not
960
- */
961
- const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
962
- // compare if two vnode to see if they're "technically" the same
963
- // need to have the same element tag, and same key to be the same
964
- if (leftVNode.$tag$ === rightVNode.$tag$) {
965
- // this will be set if JSX tags in the build have `key` attrs set on them
966
- // we only want to check this if we're not on the first render since on
967
- // first render `leftVNode.$key$` will always be `null`, so we can be led
968
- // astray and, for instance, accidentally delete a DOM node that we want to
969
- // keep around.
970
- if (!isInitialRender) {
971
- return leftVNode.$key$ === rightVNode.$key$;
972
- }
973
- return true;
974
- }
975
- return false;
976
- };
977
- /**
978
- * Handle reconciling an outdated VNode with a new one which corresponds to
979
- * it. This function handles flushing updates to the DOM and reconciling the
980
- * children of the two nodes (if any).
981
- *
982
- * @param oldVNode an old VNode whose DOM element and children we want to update
983
- * @param newVNode a new VNode representing an updated version of the old one
984
- * @param isInitialRender whether or not this is the first render of the vdom
985
- */
986
- const patch = (oldVNode, newVNode, isInitialRender = false) => {
987
- const elm = (newVNode.$elm$ = oldVNode.$elm$);
988
- const oldChildren = oldVNode.$children$;
989
- const newChildren = newVNode.$children$;
990
- const tag = newVNode.$tag$;
991
- const text = newVNode.$text$;
992
- if (text === null) {
993
- {
994
- // test if we're rendering an svg element, or still rendering nodes inside of one
995
- // only add this to the when the compiler sees we're using an svg somewhere
996
- isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
997
- }
998
- {
999
- if (tag === 'slot' && !useNativeShadowDom) ;
1000
- else {
1001
- // either this is the first render of an element OR it's an update
1002
- // AND we already know it's possible it could have changed
1003
- // this updates the element's css classes, attrs, props, listeners, etc.
1004
- updateElement(oldVNode, newVNode, isSvgMode);
1005
- }
1006
- }
1007
- if (oldChildren !== null && newChildren !== null) {
1008
- // looks like there's child vnodes for both the old and new vnodes
1009
- // so we need to call `updateChildren` to reconcile them
1010
- updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
1011
- }
1012
- else if (newChildren !== null) {
1013
- // no old child vnodes, but there are new child vnodes to add
1014
- if (oldVNode.$text$ !== null) {
1015
- // the old vnode was text, so be sure to clear it out
1016
- elm.textContent = '';
1017
- }
1018
- // add the new vnode children
1019
- addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1020
- }
1021
- else if (oldChildren !== null) {
1022
- // no new child vnodes, but there are old child vnodes to remove
1023
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
1024
- }
1025
- if (isSvgMode && tag === 'svg') {
1026
- isSvgMode = false;
1027
- }
1028
- }
1029
- else if (oldVNode.$text$ !== text) {
1030
- // update the text content for the text only vnode
1031
- // and also only if the text is different than before
1032
- elm.data = text;
1033
- }
1034
- };
1035
- /**
1036
- * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
1037
- * them with `null`. This signals that the DOM element corresponding to the VDom
1038
- * node has been removed from the DOM.
1039
- *
1040
- * @param vNode a virtual DOM node
1041
- */
1042
- const nullifyVNodeRefs = (vNode) => {
1043
- {
1044
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1045
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1046
- }
1047
- };
1048
- /**
1049
- * The main entry point for Stencil's virtual DOM-based rendering engine
1050
- *
1051
- * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1052
- * function will handle creating a virtual DOM tree with a single root, patching
1053
- * the current virtual DOM tree onto an old one (if any), dealing with slot
1054
- * relocation, and reflecting attributes.
1055
- *
1056
- * @param hostRef data needed to root and render the virtual DOM tree, such as
1057
- * the DOM node into which it should be rendered.
1058
- * @param renderFnResults the virtual DOM nodes to be rendered
1059
- * @param isInitialLoad whether or not this is the first call after page load
1060
- */
1061
- const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1062
- const hostElm = hostRef.$hostElement$;
1063
- const cmpMeta = hostRef.$cmpMeta$;
1064
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1065
- // if `renderFnResults` is a Host node then we can use it directly. If not,
1066
- // we need to call `h` again to wrap the children of our component in a
1067
- // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
1068
- // implicitly that the top-level vdom node is 1) an only child and 2)
1069
- // contains attrs that need to be set on the host element.
1070
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1071
- hostTagName = hostElm.tagName;
1072
- // On the first render and *only* on the first render we want to check for
1073
- // any attributes set on the host element which are also set on the vdom
1074
- // node. If we find them, we override the value on the VDom node attrs with
1075
- // the value from the host element, which allows developers building apps
1076
- // with Stencil components to override e.g. the `role` attribute on a
1077
- // component even if it's already set on the `Host`.
1078
- if (isInitialLoad && rootVnode.$attrs$) {
1079
- for (const key of Object.keys(rootVnode.$attrs$)) {
1080
- // We have a special implementation in `setAccessor` for `style` and
1081
- // `class` which reconciles values coming from the VDom with values
1082
- // already present on the DOM element, so we don't want to override those
1083
- // attributes on the VDom tree with values from the host element if they
1084
- // are present.
1085
- //
1086
- // Likewise, `ref` and `key` are special internal values for the Stencil
1087
- // runtime and we don't want to override those either.
1088
- if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
1089
- rootVnode.$attrs$[key] = hostElm[key];
1090
- }
1091
- }
1092
- }
1093
- rootVnode.$tag$ = null;
1094
- rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1095
- hostRef.$vnode$ = rootVnode;
1096
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1097
- {
1098
- scopeId = hostElm['s-sc'];
1099
- }
1100
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1101
- // synchronous patch
1102
- patch(oldVNode, rootVnode, isInitialLoad);
1103
- };
1104
- const attachToAncestor = (hostRef, ancestorComponent) => {
1105
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1106
- ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1107
- }
1108
- };
1109
- const scheduleUpdate = (hostRef, isInitialLoad) => {
1110
- {
1111
- hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1112
- }
1113
- if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1114
- hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1115
- return;
1116
- }
1117
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1118
- // there is no ancestor component or the ancestor component
1119
- // has already fired off its lifecycle update then
1120
- // fire off the initial update
1121
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1122
- return writeTask(dispatch) ;
1123
- };
1124
- /**
1125
- * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
1126
- * component lifecycle methods like `componentWillLoad` as well as
1127
- * {@link updateComponent}, which will kick off the virtual DOM re-render.
1128
- *
1129
- * @param hostRef a reference to a host DOM node
1130
- * @param isInitialLoad whether we're on the initial load or not
1131
- * @returns an empty Promise which is used to enqueue a series of operations for
1132
- * the component
1133
- */
1134
- const dispatchHooks = (hostRef, isInitialLoad) => {
1135
- const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1136
- const instance = hostRef.$lazyInstance$ ;
1137
- // We're going to use this variable together with `enqueue` to implement a
1138
- // little promise-based queue. We start out with it `undefined`. When we add
1139
- // the first function to the queue we'll set this variable to be that
1140
- // function's return value. When we attempt to add subsequent values to the
1141
- // queue we'll check that value and, if it was a `Promise`, we'll then chain
1142
- // the new function off of that `Promise` using `.then()`. This will give our
1143
- // queue two nice properties:
1144
- //
1145
- // 1. If all functions added to the queue are synchronous they'll be called
1146
- // synchronously right away.
1147
- // 2. If all functions added to the queue are asynchronous they'll all be
1148
- // called in order after `dispatchHooks` exits.
1149
- let maybePromise;
1150
- if (isInitialLoad) {
1151
- {
1152
- hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1153
- if (hostRef.$queuedListeners$) {
1154
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1155
- hostRef.$queuedListeners$ = undefined;
1156
- }
1157
- }
1158
- }
1159
- endSchedule();
1160
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1161
- };
1162
- /**
1163
- * This function uses a Promise to implement a simple first-in, first-out queue
1164
- * of functions to be called.
1165
- *
1166
- * The queue is ordered on the basis of the first argument. If it's
1167
- * `undefined`, then nothing is on the queue yet, so the provided function can
1168
- * be called synchronously (although note that this function may return a
1169
- * `Promise`). The idea is that then the return value of that enqueueing
1170
- * operation is kept around, so that if it was a `Promise` then subsequent
1171
- * functions can be enqueued by calling this function again with that `Promise`
1172
- * as the first argument.
1173
- *
1174
- * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
1175
- * @param fn a function to enqueue
1176
- * @returns either a `Promise` or the return value of the provided function
1177
- */
1178
- const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
1179
- /**
1180
- * Check that a value is a `Promise`. To check, we first see if the value is an
1181
- * instance of the `Promise` global. In a few circumstances, in particular if
1182
- * the global has been overwritten, this is could be misleading, so we also do
1183
- * a little 'duck typing' check to see if the `.then` property of the value is
1184
- * defined and a function.
1185
- *
1186
- * @param maybePromise it might be a promise!
1187
- * @returns whether it is or not
1188
- */
1189
- const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
1190
- (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
1191
- /**
1192
- * Update a component given reference to its host elements and so on.
1193
- *
1194
- * @param hostRef an object containing references to the element's host node,
1195
- * VDom nodes, and other metadata
1196
- * @param instance a reference to the underlying host element where it will be
1197
- * rendered
1198
- * @param isInitialLoad whether or not this function is being called as part of
1199
- * the first render cycle
1200
- */
1201
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
1202
- var _a;
1203
- const elm = hostRef.$hostElement$;
1204
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1205
- const rc = elm['s-rc'];
1206
- if (isInitialLoad) {
1207
- // DOM WRITE!
1208
- attachStyles(hostRef);
1209
- }
1210
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1211
- {
1212
- callRender(hostRef, instance, elm, isInitialLoad);
1213
- }
1214
- if (rc) {
1215
- // ok, so turns out there are some child host elements
1216
- // waiting on this parent element to load
1217
- // let's fire off all update callbacks waiting
1218
- rc.map((cb) => cb());
1219
- elm['s-rc'] = undefined;
1220
- }
1221
- endRender();
1222
- endUpdate();
1223
- {
1224
- const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
1225
- const postUpdate = () => postUpdateComponent(hostRef);
1226
- if (childrenPromises.length === 0) {
1227
- postUpdate();
1228
- }
1229
- else {
1230
- Promise.all(childrenPromises).then(postUpdate);
1231
- hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1232
- childrenPromises.length = 0;
1233
- }
1234
- }
1235
- };
1236
- /**
1237
- * Handle making the call to the VDom renderer with the proper context given
1238
- * various build variables
1239
- *
1240
- * @param hostRef an object containing references to the element's host node,
1241
- * VDom nodes, and other metadata
1242
- * @param instance a reference to the underlying host element where it will be
1243
- * rendered
1244
- * @param elm the Host element for the component
1245
- * @param isInitialLoad whether or not this function is being called as part of
1246
- * @returns an empty promise
1247
- */
1248
- const callRender = (hostRef, instance, elm, isInitialLoad) => {
1249
- try {
1250
- /**
1251
- * minification optimization: `allRenderFn` is `true` if all components have a `render`
1252
- * method, so we can call the method immediately. If not, check before calling it.
1253
- */
1254
- instance = instance.render() ;
1255
- {
1256
- hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1257
- }
1258
- {
1259
- hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1260
- }
1261
- {
1262
- {
1263
- // looks like we've got child nodes to render into this host element
1264
- // or we need to update the css class/attrs on the host element
1265
- // DOM WRITE!
1266
- {
1267
- renderVdom(hostRef, instance, isInitialLoad);
1268
- }
1269
- }
1270
- }
1271
- }
1272
- catch (e) {
1273
- consoleError(e, hostRef.$hostElement$);
1274
- }
1275
- return null;
1276
- };
1277
- const postUpdateComponent = (hostRef) => {
1278
- const tagName = hostRef.$cmpMeta$.$tagName$;
1279
- const elm = hostRef.$hostElement$;
1280
- const endPostUpdate = createTime('postUpdate', tagName);
1281
- const instance = hostRef.$lazyInstance$ ;
1282
- const ancestorComponent = hostRef.$ancestorComponent$;
1283
- {
1284
- safeCall(instance, 'componentDidRender');
1285
- }
1286
- if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1287
- hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1288
- {
1289
- // DOM WRITE!
1290
- addHydratedFlag(elm);
1291
- }
1292
- {
1293
- safeCall(instance, 'componentDidLoad');
1294
- }
1295
- endPostUpdate();
1296
- {
1297
- hostRef.$onReadyResolve$(elm);
1298
- if (!ancestorComponent) {
1299
- appDidLoad();
1300
- }
1301
- }
1302
- }
1303
- else {
1304
- endPostUpdate();
1305
- }
1306
- {
1307
- hostRef.$onInstanceResolve$(elm);
1308
- }
1309
- // load events fire from bottom to top
1310
- // the deepest elements load first then bubbles up
1311
- {
1312
- if (hostRef.$onRenderResolve$) {
1313
- hostRef.$onRenderResolve$();
1314
- hostRef.$onRenderResolve$ = undefined;
1315
- }
1316
- if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1317
- nextTick(() => scheduleUpdate(hostRef, false));
1318
- }
1319
- hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1320
- }
1321
- // ( •_•)
1322
- // ( •_•)>⌐■-■
1323
- // (⌐■_■)
1324
- };
1325
- const appDidLoad = (who) => {
1326
- // on appload
1327
- // we have finish the first big initial render
1328
- {
1329
- addHydratedFlag(doc.documentElement);
1330
- }
1331
- {
1332
- plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
1333
- }
1334
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1335
- };
1336
- /**
1337
- * Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
1338
- * e.g. custom element node. If a build figures out that e.g. no component
1339
- * has a `componentDidLoad` method, the instance method gets removed from the
1340
- * output bundle and this function returns `undefined`.
1341
- * @param instance any object that may or may not contain methods
1342
- * @param method method name
1343
- * @param arg single arbitrary argument
1344
- * @returns result of method call if it exists, otherwise `undefined`
1345
- */
1346
- const safeCall = (instance, method, arg) => {
1347
- if (instance && instance[method]) {
1348
- try {
1349
- return instance[method](arg);
1350
- }
1351
- catch (e) {
1352
- consoleError(e);
1353
- }
1354
- }
1355
- return undefined;
1356
- };
1357
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1358
- ;
1359
- const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1360
- const setValue = (ref, propName, newVal, cmpMeta) => {
1361
- // check our new property value against our internal value
1362
- const hostRef = getHostRef(ref);
1363
- const elm = hostRef.$hostElement$ ;
1364
- const oldVal = hostRef.$instanceValues$.get(propName);
1365
- const flags = hostRef.$flags$;
1366
- const instance = hostRef.$lazyInstance$ ;
1367
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1368
- // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1369
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1370
- const didValueChange = newVal !== oldVal && !areBothNaN;
1371
- if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1372
- // gadzooks! the property's value has changed!!
1373
- // set our new value!
1374
- hostRef.$instanceValues$.set(propName, newVal);
1375
- if (instance) {
1376
- // get an array of method names of watch functions to call
1377
- if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1378
- const watchMethods = cmpMeta.$watchers$[propName];
1379
- if (watchMethods) {
1380
- // this instance is watching for when this property changed
1381
- watchMethods.map((watchMethodName) => {
1382
- try {
1383
- // fire off each of the watch methods that are watching this property
1384
- instance[watchMethodName](newVal, oldVal, propName);
1385
- }
1386
- catch (e) {
1387
- consoleError(e, elm);
1388
- }
1389
- });
1390
- }
1391
- }
1392
- if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1393
- // looks like this value actually changed, so we've got work to do!
1394
- // but only if we've already rendered, otherwise just chill out
1395
- // queue that we need to do an update, but don't worry about queuing
1396
- // up millions cuz this function ensures it only runs once
1397
- scheduleUpdate(hostRef, false);
1398
- }
1399
- }
1400
- }
1401
- };
1402
- /**
1403
- * Attach a series of runtime constructs to a compiled Stencil component
1404
- * constructor, including getters and setters for the `@Prop` and `@State`
1405
- * decorators, callbacks for when attributes change, and so on.
1406
- *
1407
- * @param Cstr the constructor for a component that we need to process
1408
- * @param cmpMeta metadata collected previously about the component
1409
- * @param flags a number used to store a series of bit flags
1410
- * @returns a reference to the same constructor passed in (but now mutated)
1411
- */
1412
- const proxyComponent = (Cstr, cmpMeta, flags) => {
1413
- var _a;
1414
- const prototype = Cstr.prototype;
1415
- if (cmpMeta.$members$) {
1416
- if (Cstr.watchers) {
1417
- cmpMeta.$watchers$ = Cstr.watchers;
1418
- }
1419
- // It's better to have a const than two Object.entries()
1420
- const members = Object.entries(cmpMeta.$members$);
1421
- members.map(([memberName, [memberFlags]]) => {
1422
- if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1423
- ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1424
- // proxyComponent - prop
1425
- Object.defineProperty(prototype, memberName, {
1426
- get() {
1427
- // proxyComponent, get value
1428
- return getValue(this, memberName);
1429
- },
1430
- set(newValue) {
1431
- // proxyComponent, set value
1432
- setValue(this, memberName, newValue, cmpMeta);
1433
- },
1434
- configurable: true,
1435
- enumerable: true,
1436
- });
1437
- }
1438
- else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1439
- memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1440
- // proxyComponent - method
1441
- Object.defineProperty(prototype, memberName, {
1442
- value(...args) {
1443
- var _a;
1444
- const ref = getHostRef(this);
1445
- return (_a = ref === null || ref === void 0 ? void 0 : ref.$onInstancePromise$) === null || _a === void 0 ? void 0 : _a.then(() => { var _a; return (_a = ref.$lazyInstance$) === null || _a === void 0 ? void 0 : _a[memberName](...args); });
1446
- },
1447
- });
1448
- }
1449
- });
1450
- if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1451
- const attrNameToPropName = new Map();
1452
- prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
1453
- plt.jmp(() => {
1454
- var _a;
1455
- const propName = attrNameToPropName.get(attrName);
1456
- // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1457
- // in the case where an attribute was set inline.
1458
- // ```html
1459
- // <my-component some-attribute="some-value"></my-component>
1460
- // ```
1461
- //
1462
- // There is an edge case where a developer sets the attribute inline on a custom element and then
1463
- // programmatically changes it before it has been upgraded as shown below:
1464
- //
1465
- // ```html
1466
- // <!-- this component has _not_ been upgraded yet -->
1467
- // <my-component id="test" some-attribute="some-value"></my-component>
1468
- // <script>
1469
- // // grab non-upgraded component
1470
- // el = document.querySelector("#test");
1471
- // el.someAttribute = "another-value";
1472
- // // upgrade component
1473
- // customElements.define('my-component', MyComponent);
1474
- // </script>
1475
- // ```
1476
- // In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
1477
- // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1478
- // to the value that was set inline i.e. "some-value" from above example. When
1479
- // the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
1480
- //
1481
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
1482
- // by connectedCallback as this attributeChangedCallback will not fire.
1483
- //
1484
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1485
- //
1486
- // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1487
- // properties here given that this goes against best practices outlined here
1488
- // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1489
- if (this.hasOwnProperty(propName)) {
1490
- newValue = this[propName];
1491
- delete this[propName];
1492
- }
1493
- else if (prototype.hasOwnProperty(propName) &&
1494
- typeof this[propName] === 'number' &&
1495
- this[propName] == newValue) {
1496
- // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1497
- // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1498
- // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1499
- return;
1500
- }
1501
- else if (propName == null) {
1502
- // At this point we should know this is not a "member", so we can treat it like watching an attribute
1503
- // on a vanilla web component
1504
- const hostRef = getHostRef(this);
1505
- const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
1506
- // We only want to trigger the callback(s) if:
1507
- // 1. The instance is ready
1508
- // 2. The watchers are ready
1509
- // 3. The value has changed
1510
- if (flags &&
1511
- !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
1512
- flags & 128 /* HOST_FLAGS.isWatchReady */ &&
1513
- newValue !== oldValue) {
1514
- const instance = hostRef.$lazyInstance$ ;
1515
- const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
1516
- entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
1517
- if (instance[callbackName] != null) {
1518
- instance[callbackName].call(instance, newValue, oldValue, attrName);
1519
- }
1520
- });
1521
- }
1522
- return;
1523
- }
1524
- this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1525
- });
1526
- };
1527
- // Create an array of attributes to observe
1528
- // This list in comprised of all strings used within a `@Watch()` decorator
1529
- // on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
1530
- // As such, there is no way to guarantee type-safety here that a user hasn't entered
1531
- // an invalid attribute.
1532
- Cstr.observedAttributes = Array.from(new Set([
1533
- ...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
1534
- ...members
1535
- .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
1536
- .map(([propName, m]) => {
1537
- const attrName = m[1] || propName;
1538
- attrNameToPropName.set(attrName, propName);
1539
- return attrName;
1540
- }),
1541
- ]));
1542
- }
1543
- }
1544
- return Cstr;
1545
- };
1546
- /**
1547
- * Initialize a Stencil component given a reference to its host element, its
1548
- * runtime bookkeeping data structure, runtime metadata about the component,
1549
- * and (optionally) an HMR version ID.
1550
- *
1551
- * @param elm a host element
1552
- * @param hostRef the element's runtime bookkeeping object
1553
- * @param cmpMeta runtime metadata for the Stencil component
1554
- * @param hmrVersionId an (optional) HMR version ID
1555
- */
1556
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1557
- let Cstr;
1558
- // initializeComponent
1559
- if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1560
- // Let the runtime know that the component has been initialized
1561
- hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1562
- {
1563
- // lazy loaded components
1564
- // request the component's implementation to be
1565
- // wired up with the host element
1566
- Cstr = loadModule(cmpMeta);
1567
- if (Cstr.then) {
1568
- // Await creates a micro-task avoid if possible
1569
- const endLoad = uniqueTime();
1570
- Cstr = await Cstr;
1571
- endLoad();
1572
- }
1573
- if (!Cstr.isProxied) {
1574
- // we've never proxied this Constructor before
1575
- // let's add the getters/setters to its prototype before
1576
- // the first time we create an instance of the implementation
1577
- {
1578
- cmpMeta.$watchers$ = Cstr.watchers;
1579
- }
1580
- proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1581
- Cstr.isProxied = true;
1582
- }
1583
- const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1584
- // ok, time to construct the instance
1585
- // but let's keep track of when we start and stop
1586
- // so that the getters/setters don't incorrectly step on data
1587
- {
1588
- hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1589
- }
1590
- // construct the lazy-loaded component implementation
1591
- // passing the hostRef is very important during
1592
- // construction in order to directly wire together the
1593
- // host element and the lazy-loaded instance
1594
- try {
1595
- new Cstr(hostRef);
1596
- }
1597
- catch (e) {
1598
- consoleError(e);
1599
- }
1600
- {
1601
- hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1602
- }
1603
- {
1604
- hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1605
- }
1606
- endNewInstance();
1607
- fireConnectedCallback(hostRef.$lazyInstance$);
1608
- }
1609
- if (Cstr.style) {
1610
- // this component has styles but we haven't registered them yet
1611
- let style = Cstr.style;
1612
- const scopeId = getScopeId(cmpMeta);
1613
- if (!styles.has(scopeId)) {
1614
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1615
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1616
- endRegisterStyles();
1617
- }
1618
- }
1619
- }
1620
- // we've successfully created a lazy instance
1621
- const ancestorComponent = hostRef.$ancestorComponent$;
1622
- const schedule = () => scheduleUpdate(hostRef, true);
1623
- if (ancestorComponent && ancestorComponent['s-rc']) {
1624
- // this is the initial load and this component it has an ancestor component
1625
- // but the ancestor component has NOT fired its will update lifecycle yet
1626
- // so let's just cool our jets and wait for the ancestor to continue first
1627
- // this will get fired off when the ancestor component
1628
- // finally gets around to rendering its lazy self
1629
- // fire off the initial update
1630
- ancestorComponent['s-rc'].push(schedule);
1631
- }
1632
- else {
1633
- schedule();
1634
- }
1635
- };
1636
- const fireConnectedCallback = (instance) => {
1637
- {
1638
- safeCall(instance, 'connectedCallback');
1639
- }
1640
- };
1641
- const connectedCallback = (elm) => {
1642
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1643
- const hostRef = getHostRef(elm);
1644
- const cmpMeta = hostRef.$cmpMeta$;
1645
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1646
- if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1647
- // first time this component has connected
1648
- hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1649
- {
1650
- // find the first ancestor component (if there is one) and register
1651
- // this component as one of the actively loading child components for its ancestor
1652
- let ancestorComponent = elm;
1653
- while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1654
- // climb up the ancestors looking for the first
1655
- // component that hasn't finished its lifecycle update yet
1656
- if (ancestorComponent['s-p']) {
1657
- // we found this components first ancestor component
1658
- // keep a reference to this component's ancestor component
1659
- attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1660
- break;
1661
- }
1662
- }
1663
- }
1664
- // Lazy properties
1665
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1666
- if (cmpMeta.$members$) {
1667
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1668
- if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1669
- const value = elm[memberName];
1670
- delete elm[memberName];
1671
- elm[memberName] = value;
1672
- }
1673
- });
1674
- }
1675
- {
1676
- initializeComponent(elm, hostRef, cmpMeta);
1677
- }
1678
- }
1679
- else {
1680
- // not the first time this has connected
1681
- // reattach any event listeners to the host
1682
- // since they would have been removed when disconnected
1683
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1684
- // fire off connectedCallback() on component instance
1685
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
1686
- fireConnectedCallback(hostRef.$lazyInstance$);
1687
- }
1688
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1689
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
1690
- }
1691
- }
1692
- endConnected();
1693
- }
1694
- };
1695
- const disconnectInstance = (instance) => {
1696
- {
1697
- safeCall(instance, 'disconnectedCallback');
1698
- }
1699
- };
1700
- const disconnectedCallback = async (elm) => {
1701
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1702
- const hostRef = getHostRef(elm);
1703
- {
1704
- if (hostRef.$rmListeners$) {
1705
- hostRef.$rmListeners$.map((rmListener) => rmListener());
1706
- hostRef.$rmListeners$ = undefined;
1707
- }
1708
- }
1709
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
1710
- disconnectInstance(hostRef.$lazyInstance$);
1711
- }
1712
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1713
- hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
1714
- }
1715
- }
1716
- };
1717
- const bootstrapLazy = (lazyBundles, options = {}) => {
1718
- var _a;
1719
- const endBootstrap = createTime();
1720
- const cmpTags = [];
1721
- const exclude = options.exclude || [];
1722
- const customElements = win.customElements;
1723
- const head = doc.head;
1724
- const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1725
- const dataStyles = /*@__PURE__*/ doc.createElement('style');
1726
- const deferredConnectedCallbacks = [];
1727
- let appLoadFallback;
1728
- let isBootstrapping = true;
1729
- Object.assign(plt, options);
1730
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1731
- {
1732
- if (options.syncQueue) {
1733
- plt.$flags$ |= 4 /* PLATFORM_FLAGS.queueSync */;
1734
- }
1735
- }
1736
- let hasSlotRelocation = false;
1737
- lazyBundles.map((lazyBundle) => {
1738
- lazyBundle[1].map((compactMeta) => {
1739
- var _a;
1740
- const cmpMeta = {
1741
- $flags$: compactMeta[0],
1742
- $tagName$: compactMeta[1],
1743
- $members$: compactMeta[2],
1744
- $listeners$: compactMeta[3],
1745
- };
1746
- // Check if we are using slots outside the shadow DOM in this component.
1747
- // We'll use this information later to add styles for `slot-fb` elements
1748
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
1749
- hasSlotRelocation = true;
1750
- }
1751
- {
1752
- cmpMeta.$members$ = compactMeta[2];
1753
- }
1754
- {
1755
- cmpMeta.$listeners$ = compactMeta[3];
1756
- }
1757
- {
1758
- cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
1759
- }
1760
- const tagName = cmpMeta.$tagName$;
1761
- const HostElement = class extends HTMLElement {
1762
- // StencilLazyHost
1763
- constructor(self) {
1764
- // @ts-ignore
1765
- super(self);
1766
- self = this;
1767
- registerHost(self, cmpMeta);
1768
- if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1769
- // this component is using shadow dom
1770
- // and this browser supports shadow dom
1771
- // add the read-only property "shadowRoot" to the host element
1772
- // adding the shadow root build conditionals to minimize runtime
1773
- {
1774
- {
1775
- self.attachShadow({ mode: 'open' });
1776
- }
1777
- }
1778
- }
1779
- }
1780
- connectedCallback() {
1781
- if (appLoadFallback) {
1782
- clearTimeout(appLoadFallback);
1783
- appLoadFallback = null;
1784
- }
1785
- if (isBootstrapping) {
1786
- // connectedCallback will be processed once all components have been registered
1787
- deferredConnectedCallbacks.push(this);
1788
- }
1789
- else {
1790
- plt.jmp(() => connectedCallback(this));
1791
- }
1792
- }
1793
- disconnectedCallback() {
1794
- plt.jmp(() => disconnectedCallback(this));
1795
- }
1796
- componentOnReady() {
1797
- return getHostRef(this).$onReadyPromise$;
1798
- }
1799
- };
1800
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
1801
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1802
- cmpTags.push(tagName);
1803
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1804
- }
1805
- });
1806
- });
1807
- // Only bother generating CSS if we have components
1808
- // TODO(STENCIL-1118): Add test cases for CSS content based on conditionals
1809
- if (cmpTags.length > 0) {
1810
- // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
1811
- if (hasSlotRelocation) {
1812
- dataStyles.textContent += SLOT_FB_CSS;
1813
- }
1814
- // Add hydration styles
1815
- {
1816
- dataStyles.textContent += cmpTags + HYDRATED_CSS;
1817
- }
1818
- // If we have styles, add them to the DOM
1819
- if (dataStyles.innerHTML.length) {
1820
- dataStyles.setAttribute('data-styles', '');
1821
- // Apply CSP nonce to the style tag if it exists
1822
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1823
- if (nonce != null) {
1824
- dataStyles.setAttribute('nonce', nonce);
1825
- }
1826
- // Insert the styles into the document head
1827
- // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
1828
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1829
- }
1830
- }
1831
- // Process deferred connectedCallbacks now all components have been registered
1832
- isBootstrapping = false;
1833
- if (deferredConnectedCallbacks.length) {
1834
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
1835
- }
1836
- else {
1837
- {
1838
- plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1839
- }
1840
- }
1841
- // Fallback appLoad event
1842
- endBootstrap();
1843
- };
1844
- const Fragment = (_, children) => children;
1845
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1846
- if (listeners) {
1847
- listeners.map(([flags, name, method]) => {
1848
- const target = getHostListenerTarget(elm, flags) ;
1849
- const handler = hostListenerProxy(hostRef, method);
1850
- const opts = hostListenerOpts(flags);
1851
- plt.ael(target, name, handler, opts);
1852
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1853
- });
1854
- }
1855
- };
1856
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
1857
- try {
1858
- {
1859
- if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1860
- // instance is ready, let's call it's member method for this event
1861
- hostRef.$lazyInstance$[methodName](ev);
1862
- }
1863
- else {
1864
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1865
- }
1866
- }
1867
- }
1868
- catch (e) {
1869
- consoleError(e);
1870
- }
1871
- };
1872
- const getHostListenerTarget = (elm, flags) => {
1873
- if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
1874
- return win;
1875
- return elm;
1876
- };
1877
- // prettier-ignore
1878
- const hostListenerOpts = (flags) => supportsListenerOptions
1879
- ? ({
1880
- passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
1881
- capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
1882
- })
1883
- : (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1884
- /**
1885
- * Assigns the given value to the nonce property on the runtime platform object.
1886
- * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1887
- * @param nonce The value to be assigned to the platform nonce property.
1888
- * @returns void
1889
- */
1890
- const setNonce = (nonce) => (plt.$nonce$ = nonce);
1891
- /**
1892
- * A WeakMap mapping runtime component references to their corresponding host reference
1893
- * instances.
1894
- *
1895
- * **Note**: If we're in an HMR context we need to store a reference to this
1896
- * value on `window` in order to maintain the mapping of {@link d.RuntimeRef}
1897
- * to {@link d.HostRef} across HMR updates.
1898
- *
1899
- * This is necessary because when HMR updates for a component are processed by
1900
- * the browser-side dev server client the JS bundle for that component is
1901
- * re-fetched. Since the module containing {@link hostRefs} is included in
1902
- * that bundle, if we do not store a reference to it the new iteration of the
1903
- * component will not have access to the previous hostRef map, leading to a
1904
- * bug where the new version of the component cannot properly initialize.
1905
- */
1906
- const hostRefs = new WeakMap();
1907
- /**
1908
- * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
1909
- *
1910
- * @param ref the runtime ref of interest
1911
- * @returns the Host reference (if found) or undefined
1912
- */
1913
- const getHostRef = (ref) => hostRefs.get(ref);
1914
- /**
1915
- * Register a lazy instance with the {@link hostRefs} object so it's
1916
- * corresponding {@link d.HostRef} can be retrieved later.
1917
- *
1918
- * @param lazyInstance the lazy instance of interest
1919
- * @param hostRef that instances `HostRef` object
1920
- * @returns a reference to the host ref WeakMap
1921
- */
1922
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1923
- /**
1924
- * Register a host element for a Stencil component, setting up various metadata
1925
- * and callbacks based on {@link BUILD} flags as well as the component's runtime
1926
- * metadata.
1927
- *
1928
- * @param hostElement the host element to register
1929
- * @param cmpMeta runtime metadata for that component
1930
- * @returns a reference to the host ref WeakMap
1931
- */
1932
- const registerHost = (hostElement, cmpMeta) => {
1933
- const hostRef = {
1934
- $flags$: 0,
1935
- $hostElement$: hostElement,
1936
- $cmpMeta$: cmpMeta,
1937
- $instanceValues$: new Map(),
1938
- };
1939
- {
1940
- hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
1941
- }
1942
- {
1943
- hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1944
- hostElement['s-p'] = [];
1945
- hostElement['s-rc'] = [];
1946
- }
1947
- addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
1948
- return hostRefs.set(hostElement, hostRef);
1949
- };
1950
- const isMemberInElement = (elm, memberName) => memberName in elm;
1951
- const consoleError = (e, el) => (0, console.error)(e, el);
1952
- const cmpModules = /*@__PURE__*/ new Map();
1953
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1954
- // loadModuleImport
1955
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1956
- const bundleId = cmpMeta.$lazyBundleId$;
1957
- const module = cmpModules.get(bundleId) ;
1958
- if (module) {
1959
- return module[exportName];
1960
- }
1961
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1962
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1963
- /* @vite-ignore */
1964
- /* webpackInclude: /\.entry\.js$/ */
1965
- /* webpackExclude: /\.system\.entry\.js$/ */
1966
- /* webpackMode: "lazy" */
1967
- `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
1968
- {
1969
- cmpModules.set(bundleId, importedModule);
1970
- }
1971
- return importedModule[exportName];
1972
- }, consoleError);
1973
- };
1974
- const styles = /*@__PURE__*/ new Map();
1975
- const win = typeof window !== 'undefined' ? window : {};
1976
- const doc = win.document || { head: {} };
1977
- const plt = {
1978
- $flags$: 0,
1979
- $resourcesUrl$: '',
1980
- jmp: (h) => h(),
1981
- raf: (h) => requestAnimationFrame(h),
1982
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1983
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1984
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
1985
- };
1986
- const supportsListenerOptions = /*@__PURE__*/ (() => {
1987
- let supportsListenerOptions = false;
1988
- try {
1989
- doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
1990
- get() {
1991
- supportsListenerOptions = true;
1992
- },
1993
- }));
1994
- }
1995
- catch (e) { }
1996
- return supportsListenerOptions;
1997
- })();
1998
- const promiseResolve = (v) => Promise.resolve(v);
1999
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2000
- try {
2001
- new CSSStyleSheet();
2002
- return typeof new CSSStyleSheet().replaceSync === 'function';
2003
- }
2004
- catch (e) { }
2005
- return false;
2006
- })()
2007
- ;
2008
- const queueDomReads = [];
2009
- const queueDomWrites = [];
2010
- const queueDomWritesLow = [];
2011
- const queueTask = (queue, write) => (cb) => {
2012
- queue.push(cb);
2013
- if (!queuePending) {
2014
- queuePending = true;
2015
- if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
2016
- nextTick(flush);
2017
- }
2018
- else {
2019
- plt.raf(flush);
2020
- }
2021
- }
2022
- };
2023
- const consume = (queue) => {
2024
- for (let i = 0; i < queue.length; i++) {
2025
- try {
2026
- queue[i](performance.now());
2027
- }
2028
- catch (e) {
2029
- consoleError(e);
2030
- }
2031
- }
2032
- queue.length = 0;
2033
- };
2034
- const consumeTimeout = (queue, timeout) => {
2035
- let i = 0;
2036
- let ts = 0;
2037
- while (i < queue.length && (ts = performance.now()) < timeout) {
2038
- try {
2039
- queue[i++](ts);
2040
- }
2041
- catch (e) {
2042
- consoleError(e);
2043
- }
2044
- }
2045
- if (i === queue.length) {
2046
- queue.length = 0;
2047
- }
2048
- else if (i !== 0) {
2049
- queue.splice(0, i);
2050
- }
2051
- };
2052
- const flush = () => {
2053
- {
2054
- queueCongestion++;
2055
- }
2056
- // always force a bunch of medium callbacks to run, but still have
2057
- // a throttle on how many can run in a certain time
2058
- // DOM READS!!!
2059
- consume(queueDomReads);
2060
- // DOM WRITES!!!
2061
- {
2062
- const timeout = (plt.$flags$ & 6 /* PLATFORM_FLAGS.queueMask */) === 2 /* PLATFORM_FLAGS.appLoaded */
2063
- ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0))
2064
- : Infinity;
2065
- consumeTimeout(queueDomWrites, timeout);
2066
- consumeTimeout(queueDomWritesLow, timeout);
2067
- if (queueDomWrites.length > 0) {
2068
- queueDomWritesLow.push(...queueDomWrites);
2069
- queueDomWrites.length = 0;
2070
- }
2071
- if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
2072
- // still more to do yet, but we've run out of time
2073
- // let's let this thing cool off and try again in the next tick
2074
- plt.raf(flush);
2075
- }
2076
- else {
2077
- queueCongestion = 0;
2078
- }
2079
- }
2080
- };
2081
- const nextTick = (cb) => promiseResolve().then(cb);
2082
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2083
-
2084
- exports.Fragment = Fragment;
2085
- exports.Host = Host;
2086
- exports.bootstrapLazy = bootstrapLazy;
2087
- exports.createEvent = createEvent;
2088
- exports.getElement = getElement;
2089
- exports.h = h;
2090
- exports.promiseResolve = promiseResolve;
2091
- exports.registerInstance = registerInstance;
2092
- exports.setNonce = setNonce;