@arcgis/common-components 4.29.0-beta.42 → 4.29.0-beta.44

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 (128) hide show
  1. package/dist/arcgis-common-components/arcgis-common-components.esm.js +1 -1
  2. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.ar.json +78 -0
  3. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.bg.json +78 -0
  4. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.bs.json +78 -0
  5. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.ca.json +78 -0
  6. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.cs.json +78 -0
  7. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.da.json +78 -0
  8. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.de.json +78 -0
  9. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.el.json +78 -0
  10. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.en.json +78 -0
  11. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.es.json +78 -0
  12. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.et.json +78 -0
  13. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.fi.json +78 -0
  14. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.fr.json +78 -0
  15. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.he.json +78 -0
  16. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.hr.json +78 -0
  17. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.hu.json +78 -0
  18. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.id.json +78 -0
  19. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.it.json +78 -0
  20. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.ja.json +78 -0
  21. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.ko.json +78 -0
  22. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.lt.json +78 -0
  23. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.lv.json +78 -0
  24. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.nb.json +78 -0
  25. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.nl.json +78 -0
  26. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.pl.json +78 -0
  27. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.pt-BR.json +78 -0
  28. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.pt-PT.json +78 -0
  29. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.ro.json +78 -0
  30. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.ru.json +78 -0
  31. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.sk.json +78 -0
  32. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.sl.json +78 -0
  33. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.sr.json +78 -0
  34. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.sv.json +78 -0
  35. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.th.json +78 -0
  36. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.tr.json +78 -0
  37. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.uk.json +78 -0
  38. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.vi.json +78 -0
  39. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.zh-CN.json +78 -0
  40. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.zh-HK.json +78 -0
  41. package/dist/arcgis-common-components/assets/field-info/t9n/field-info.t9n.zh-TW.json +78 -0
  42. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.ar.json +17 -0
  43. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.bg.json +17 -0
  44. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.bs.json +17 -0
  45. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.ca.json +17 -0
  46. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.cs.json +17 -0
  47. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.da.json +17 -0
  48. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.de.json +17 -0
  49. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.el.json +17 -0
  50. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.en.json +17 -0
  51. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.es.json +17 -0
  52. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.et.json +17 -0
  53. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.fi.json +17 -0
  54. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.fr.json +17 -0
  55. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.he.json +17 -0
  56. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.hr.json +17 -0
  57. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.hu.json +17 -0
  58. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.id.json +17 -0
  59. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.it.json +17 -0
  60. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.ja.json +17 -0
  61. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.ko.json +17 -0
  62. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.lt.json +17 -0
  63. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.lv.json +17 -0
  64. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.nb.json +17 -0
  65. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.nl.json +17 -0
  66. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.pl.json +17 -0
  67. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.pt-BR.json +17 -0
  68. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.pt-PT.json +17 -0
  69. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.ro.json +17 -0
  70. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.ru.json +17 -0
  71. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.sk.json +17 -0
  72. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.sl.json +17 -0
  73. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.sr.json +17 -0
  74. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.sv.json +17 -0
  75. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.th.json +17 -0
  76. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.tr.json +17 -0
  77. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.uk.json +17 -0
  78. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.vi.json +17 -0
  79. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.zh-CN.json +17 -0
  80. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.zh-HK.json +17 -0
  81. package/dist/arcgis-common-components/assets/field-pick-list/t9n/field-pick-list.t9n.zh-TW.json +17 -0
  82. package/dist/arcgis-common-components/p-0a9f9233.entry.js +1 -0
  83. package/dist/arcgis-common-components/p-19ebc914.js +1 -0
  84. package/dist/arcgis-common-components/p-20e63d91.entry.js +1 -0
  85. package/dist/arcgis-common-components/p-b23318c8.js +1 -0
  86. package/dist/arcgis-common-components/{p-d868f293.entry.js → p-b98229f1.entry.js} +1 -1
  87. package/dist/arcgis-common-components/p-bc099d11.entry.js +1 -0
  88. package/dist/arcgis-common-components/p-f27af39c.js +2 -0
  89. package/dist/cjs/arcgis-api-key.cjs.entry.js +2 -2
  90. package/dist/cjs/arcgis-common-components.cjs.js +2 -2
  91. package/dist/cjs/arcgis-field-info.cjs.entry.js +1021 -0
  92. package/dist/cjs/arcgis-field-pick-list.cjs.entry.js +258 -0
  93. package/dist/cjs/arcgis-identity.cjs.entry.js +2 -2
  94. package/dist/cjs/{index-9962d715.js → index-81d57760.js} +40 -0
  95. package/dist/cjs/{index-693a0aa8.js → index-ab5f2576.js} +870 -4
  96. package/dist/cjs/index-f8bf4df6.js +7 -0
  97. package/dist/cjs/loader.cjs.js +2 -2
  98. package/dist/components/arcgis-field-info.d.ts +11 -0
  99. package/dist/components/arcgis-field-info.js +6 -0
  100. package/dist/components/arcgis-field-pick-list.d.ts +11 -0
  101. package/dist/components/arcgis-field-pick-list.js +314 -0
  102. package/dist/components/arcgis-identity.js +1 -1
  103. package/dist/components/field-info.js +1048 -0
  104. package/dist/components/index2.js +36 -1
  105. package/dist/esm/arcgis-api-key.entry.js +2 -2
  106. package/dist/esm/arcgis-common-components.js +3 -3
  107. package/dist/esm/arcgis-field-info.entry.js +1017 -0
  108. package/dist/esm/arcgis-field-pick-list.entry.js +254 -0
  109. package/dist/esm/arcgis-identity.entry.js +2 -2
  110. package/dist/esm/{index-00709df9.js → index-74897166.js} +867 -5
  111. package/dist/esm/index-877e3851.js +75 -0
  112. package/dist/esm/index-e7244815.js +3 -0
  113. package/dist/esm/loader.js +3 -3
  114. package/dist/types/components/field-info/field-info.d.ts +68 -0
  115. package/dist/types/components/field-info/t9n-types.d.ts +82 -0
  116. package/dist/types/components/field-info/utils/basic.d.ts +44 -0
  117. package/dist/types/components/field-info/utils/feature.d.ts +17 -0
  118. package/dist/types/components/field-info/utils/field.d.ts +25 -0
  119. package/dist/types/components/field-info/utils/index.d.ts +3 -0
  120. package/dist/types/components/field-pick-list/field-pick-list.d.ts +122 -0
  121. package/dist/types/components/field-pick-list/t9n-types.d.ts +17 -0
  122. package/dist/types/components/field-pick-list/utils/types.d.ts +25 -0
  123. package/dist/types/components.d.ts +270 -0
  124. package/package.json +9 -9
  125. package/dist/arcgis-common-components/p-02d347bb.entry.js +0 -1
  126. package/dist/arcgis-common-components/p-2a7fe37a.js +0 -2
  127. package/dist/arcgis-common-components/p-5d6c7dd8.js +0 -1
  128. package/dist/esm/index-2ba2e62a.js +0 -40
@@ -30,7 +30,14 @@ const NAMESPACE = 'arcgis-common-components';
30
30
  *
31
31
  * Modified for Stencil's renderer and slot projection
32
32
  */
33
+ let scopeId;
34
+ let hostTagName;
35
+ let isSvgMode = false;
33
36
  let queuePending = false;
37
+ const getAssetPath = (path) => {
38
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
39
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
40
+ };
34
41
  const createTime = (fnName, tagName = '') => {
35
42
  {
36
43
  return () => {
@@ -46,6 +53,15 @@ const uniqueTime = (key, measureText) => {
46
53
  }
47
54
  };
48
55
  const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
56
+ /**
57
+ * Default style mode id
58
+ */
59
+ /**
60
+ * Reusable empty obj/array
61
+ * Don't add values to these!!
62
+ */
63
+ const EMPTY_OBJ = {};
64
+ const isDef = (v) => v != null;
49
65
  /**
50
66
  * Check whether a value is a 'complex type', defined here as an object or a
51
67
  * function.
@@ -70,6 +86,161 @@ function queryNonceMetaTagContent(doc) {
70
86
  var _a, _b, _c;
71
87
  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;
72
88
  }
89
+ /**
90
+ * Production h() function based on Preact by
91
+ * Jason Miller (@developit)
92
+ * Licensed under the MIT License
93
+ * https://github.com/developit/preact/blob/master/LICENSE
94
+ *
95
+ * Modified for Stencil's compiler and vdom
96
+ */
97
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
98
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
99
+ const h = (nodeName, vnodeData, ...children) => {
100
+ let child = null;
101
+ let key = null;
102
+ let simple = false;
103
+ let lastSimple = false;
104
+ const vNodeChildren = [];
105
+ const walk = (c) => {
106
+ for (let i = 0; i < c.length; i++) {
107
+ child = c[i];
108
+ if (Array.isArray(child)) {
109
+ walk(child);
110
+ }
111
+ else if (child != null && typeof child !== 'boolean') {
112
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
113
+ child = String(child);
114
+ }
115
+ if (simple && lastSimple) {
116
+ // If the previous child was simple (string), we merge both
117
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
118
+ }
119
+ else {
120
+ // Append a new vNode, if it's text, we create a text vNode
121
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
122
+ }
123
+ lastSimple = simple;
124
+ }
125
+ }
126
+ };
127
+ walk(children);
128
+ if (vnodeData) {
129
+ if (vnodeData.key) {
130
+ key = vnodeData.key;
131
+ }
132
+ // normalize class / className attributes
133
+ {
134
+ const classData = vnodeData.className || vnodeData.class;
135
+ if (classData) {
136
+ vnodeData.class =
137
+ typeof classData !== 'object'
138
+ ? classData
139
+ : Object.keys(classData)
140
+ .filter((k) => classData[k])
141
+ .join(' ');
142
+ }
143
+ }
144
+ }
145
+ if (typeof nodeName === 'function') {
146
+ // nodeName is a functional component
147
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
148
+ }
149
+ const vnode = newVNode(nodeName, null);
150
+ vnode.$attrs$ = vnodeData;
151
+ if (vNodeChildren.length > 0) {
152
+ vnode.$children$ = vNodeChildren;
153
+ }
154
+ {
155
+ vnode.$key$ = key;
156
+ }
157
+ return vnode;
158
+ };
159
+ /**
160
+ * A utility function for creating a virtual DOM node from a tag and some
161
+ * possible text content.
162
+ *
163
+ * @param tag the tag for this element
164
+ * @param text possible text content for the node
165
+ * @returns a newly-minted virtual DOM node
166
+ */
167
+ const newVNode = (tag, text) => {
168
+ const vnode = {
169
+ $flags$: 0,
170
+ $tag$: tag,
171
+ $text$: text,
172
+ $elm$: null,
173
+ $children$: null,
174
+ };
175
+ {
176
+ vnode.$attrs$ = null;
177
+ }
178
+ {
179
+ vnode.$key$ = null;
180
+ }
181
+ return vnode;
182
+ };
183
+ const Host = {};
184
+ /**
185
+ * Check whether a given node is a Host node or not
186
+ *
187
+ * @param node the virtual DOM node to check
188
+ * @returns whether it's a Host node or not
189
+ */
190
+ const isHost = (node) => node && node.$tag$ === Host;
191
+ /**
192
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
193
+ *
194
+ * Note that these functions convert from {@link d.VNode} to
195
+ * {@link d.ChildNode} to give functional component developers a friendly
196
+ * interface.
197
+ */
198
+ const vdomFnUtils = {
199
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
200
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
201
+ };
202
+ /**
203
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
204
+ * friendlier public interface (hence, 'convertToPublic').
205
+ *
206
+ * @param node the virtual DOM node to convert
207
+ * @returns a converted child node
208
+ */
209
+ const convertToPublic = (node) => ({
210
+ vattrs: node.$attrs$,
211
+ vchildren: node.$children$,
212
+ vkey: node.$key$,
213
+ vname: node.$name$,
214
+ vtag: node.$tag$,
215
+ vtext: node.$text$,
216
+ });
217
+ /**
218
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
219
+ * order to use the resulting object in the virtual DOM. The initial object was
220
+ * likely created as part of presenting a public API, so converting it back
221
+ * involved making it 'private' again (hence, `convertToPrivate`).
222
+ *
223
+ * @param node the child node to convert
224
+ * @returns a converted virtual DOM node
225
+ */
226
+ const convertToPrivate = (node) => {
227
+ if (typeof node.vtag === 'function') {
228
+ const vnodeData = Object.assign({}, node.vattrs);
229
+ if (node.vkey) {
230
+ vnodeData.key = node.vkey;
231
+ }
232
+ if (node.vname) {
233
+ vnodeData.name = node.vname;
234
+ }
235
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
236
+ }
237
+ const vnode = newVNode(node.vtag, node.vtext);
238
+ vnode.$attrs$ = node.vattrs;
239
+ vnode.$children$ = node.vchildren;
240
+ vnode.$key$ = node.vkey;
241
+ vnode.$name$ = node.vname;
242
+ return vnode;
243
+ };
73
244
  /**
74
245
  * Parse a new property value for a given property type.
75
246
  *
@@ -200,11 +371,652 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
200
371
  const attachStyles = (hostRef) => {
201
372
  const cmpMeta = hostRef.$cmpMeta$;
202
373
  const elm = hostRef.$hostElement$;
374
+ const flags = cmpMeta.$flags$;
203
375
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
204
- addStyle(elm.getRootNode(), cmpMeta);
376
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
377
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
378
+ // only required when we're NOT using native shadow dom (slot)
379
+ // or this browser doesn't support native shadow dom
380
+ // and this host element was NOT created with SSR
381
+ // let's pick out the inner content for slot projection
382
+ // create a node to represent where the original
383
+ // content was first placed, which is useful later on
384
+ // DOM WRITE!!
385
+ elm['s-sc'] = scopeId;
386
+ elm.classList.add(scopeId + '-h');
387
+ }
205
388
  endAttachStyles();
206
389
  };
207
390
  const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
391
+ /**
392
+ * Production setAccessor() function based on Preact by
393
+ * Jason Miller (@developit)
394
+ * Licensed under the MIT License
395
+ * https://github.com/developit/preact/blob/master/LICENSE
396
+ *
397
+ * Modified for Stencil's compiler and vdom
398
+ */
399
+ /**
400
+ * When running a VDom render set properties present on a VDom node onto the
401
+ * corresponding HTML element.
402
+ *
403
+ * Note that this function has special functionality for the `class`,
404
+ * `style`, `key`, and `ref` attributes, as well as event handlers (like
405
+ * `onClick`, etc). All others are just passed through as-is.
406
+ *
407
+ * @param elm the HTMLElement onto which attributes should be set
408
+ * @param memberName the name of the attribute to set
409
+ * @param oldValue the old value for the attribute
410
+ * @param newValue the new value for the attribute
411
+ * @param isSvg whether we're in an svg context or not
412
+ * @param flags bitflags for Vdom variables
413
+ */
414
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
415
+ if (oldValue !== newValue) {
416
+ let isProp = isMemberInElement(elm, memberName);
417
+ let ln = memberName.toLowerCase();
418
+ if (memberName === 'class') {
419
+ const classList = elm.classList;
420
+ const oldClasses = parseClassList(oldValue);
421
+ const newClasses = parseClassList(newValue);
422
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
423
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
424
+ }
425
+ else if (memberName === 'style') {
426
+ // update style attribute, css properties and values
427
+ {
428
+ for (const prop in oldValue) {
429
+ if (!newValue || newValue[prop] == null) {
430
+ if (prop.includes('-')) {
431
+ elm.style.removeProperty(prop);
432
+ }
433
+ else {
434
+ elm.style[prop] = '';
435
+ }
436
+ }
437
+ }
438
+ }
439
+ for (const prop in newValue) {
440
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
441
+ if (prop.includes('-')) {
442
+ elm.style.setProperty(prop, newValue[prop]);
443
+ }
444
+ else {
445
+ elm.style[prop] = newValue[prop];
446
+ }
447
+ }
448
+ }
449
+ }
450
+ else if (memberName === 'key')
451
+ ;
452
+ else if (memberName === 'ref') {
453
+ // minifier will clean this up
454
+ if (newValue) {
455
+ newValue(elm);
456
+ }
457
+ }
458
+ else if ((!isProp ) &&
459
+ memberName[0] === 'o' &&
460
+ memberName[1] === 'n') {
461
+ // Event Handlers
462
+ // so if the member name starts with "on" and the 3rd characters is
463
+ // a capital letter, and it's not already a member on the element,
464
+ // then we're assuming it's an event listener
465
+ if (memberName[2] === '-') {
466
+ // on- prefixed events
467
+ // allows to be explicit about the dom event to listen without any magic
468
+ // under the hood:
469
+ // <my-cmp on-click> // listens for "click"
470
+ // <my-cmp on-Click> // listens for "Click"
471
+ // <my-cmp on-ionChange> // listens for "ionChange"
472
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
473
+ memberName = memberName.slice(3);
474
+ }
475
+ else if (isMemberInElement(win, ln)) {
476
+ // standard event
477
+ // the JSX attribute could have been "onMouseOver" and the
478
+ // member name "onmouseover" is on the window's prototype
479
+ // so let's add the listener "mouseover", which is all lowercased
480
+ memberName = ln.slice(2);
481
+ }
482
+ else {
483
+ // custom event
484
+ // the JSX attribute could have been "onMyCustomEvent"
485
+ // so let's trim off the "on" prefix and lowercase the first character
486
+ // and add the listener "myCustomEvent"
487
+ // except for the first character, we keep the event name case
488
+ memberName = ln[2] + memberName.slice(3);
489
+ }
490
+ if (oldValue || newValue) {
491
+ // Need to account for "capture" events.
492
+ // If the event name ends with "Capture", we'll update the name to remove
493
+ // the "Capture" suffix and make sure the event listener is setup to handle the capture event.
494
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
495
+ // Make sure we only replace the last instance of "Capture"
496
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
497
+ if (oldValue) {
498
+ plt.rel(elm, memberName, oldValue, capture);
499
+ }
500
+ if (newValue) {
501
+ plt.ael(elm, memberName, newValue, capture);
502
+ }
503
+ }
504
+ }
505
+ else {
506
+ // Set property if it exists and it's not a SVG
507
+ const isComplex = isComplexType(newValue);
508
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
509
+ try {
510
+ if (!elm.tagName.includes('-')) {
511
+ const n = newValue == null ? '' : newValue;
512
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
513
+ if (memberName === 'list') {
514
+ isProp = false;
515
+ }
516
+ else if (oldValue == null || elm[memberName] != n) {
517
+ elm[memberName] = n;
518
+ }
519
+ }
520
+ else {
521
+ elm[memberName] = newValue;
522
+ }
523
+ }
524
+ catch (e) { }
525
+ }
526
+ if (newValue == null || newValue === false) {
527
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
528
+ {
529
+ elm.removeAttribute(memberName);
530
+ }
531
+ }
532
+ }
533
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
534
+ newValue = newValue === true ? '' : newValue;
535
+ {
536
+ elm.setAttribute(memberName, newValue);
537
+ }
538
+ }
539
+ }
540
+ }
541
+ };
542
+ const parseClassListRegex = /\s/;
543
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
544
+ const CAPTURE_EVENT_SUFFIX = 'Capture';
545
+ const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
546
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
547
+ // if the element passed in is a shadow root, which is a document fragment
548
+ // then we want to be adding attrs/props to the shadow root's "host" element
549
+ // if it's not a shadow root, then we add attrs/props to the same element
550
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
551
+ ? newVnode.$elm$.host
552
+ : newVnode.$elm$;
553
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
554
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
555
+ {
556
+ // remove attributes no longer present on the vnode by setting them to undefined
557
+ for (memberName in oldVnodeAttrs) {
558
+ if (!(memberName in newVnodeAttrs)) {
559
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
560
+ }
561
+ }
562
+ }
563
+ // add new & update changed attributes
564
+ for (memberName in newVnodeAttrs) {
565
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
566
+ }
567
+ };
568
+ /**
569
+ * Create a DOM Node corresponding to one of the children of a given VNode.
570
+ *
571
+ * @param oldParentVNode the parent VNode from the previous render
572
+ * @param newParentVNode the parent VNode from the current render
573
+ * @param childIndex the index of the VNode, in the _new_ parent node's
574
+ * children, for which we will create a new DOM node
575
+ * @param parentElm the parent DOM node which our new node will be a child of
576
+ * @returns the newly created node
577
+ */
578
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
579
+ // tslint:disable-next-line: prefer-const
580
+ const newVNode = newParentVNode.$children$[childIndex];
581
+ let i = 0;
582
+ let elm;
583
+ let childNode;
584
+ if (newVNode.$text$ !== null) {
585
+ // create text node
586
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
587
+ }
588
+ else {
589
+ // create element
590
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
591
+ // add css classes, attrs, props, listeners, etc.
592
+ {
593
+ updateElement(null, newVNode, isSvgMode);
594
+ }
595
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
596
+ // if there is a scopeId and this is the initial render
597
+ // then let's add the scopeId as a css class
598
+ elm.classList.add((elm['s-si'] = scopeId));
599
+ }
600
+ if (newVNode.$children$) {
601
+ for (i = 0; i < newVNode.$children$.length; ++i) {
602
+ // create the node
603
+ childNode = createElm(oldParentVNode, newVNode, i);
604
+ // return node could have been null
605
+ if (childNode) {
606
+ // append our new node
607
+ elm.appendChild(childNode);
608
+ }
609
+ }
610
+ }
611
+ }
612
+ return elm;
613
+ };
614
+ /**
615
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
616
+ * add them to the DOM in the appropriate place.
617
+ *
618
+ * @param parentElm the DOM node which should be used as a parent for the new
619
+ * DOM nodes
620
+ * @param before a child of the `parentElm` which the new children should be
621
+ * inserted before (optional)
622
+ * @param parentVNode the parent virtual DOM node
623
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
624
+ * @param startIdx the index in the child virtual DOM nodes at which to start
625
+ * creating DOM nodes (inclusive)
626
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
627
+ * creating DOM nodes (inclusive)
628
+ */
629
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
630
+ let containerElm = (parentElm);
631
+ let childNode;
632
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
633
+ containerElm = containerElm.shadowRoot;
634
+ }
635
+ for (; startIdx <= endIdx; ++startIdx) {
636
+ if (vnodes[startIdx]) {
637
+ childNode = createElm(null, parentVNode, startIdx);
638
+ if (childNode) {
639
+ vnodes[startIdx].$elm$ = childNode;
640
+ containerElm.insertBefore(childNode, before);
641
+ }
642
+ }
643
+ }
644
+ };
645
+ /**
646
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
647
+ * This can be used to, for instance, clean up after a list of children which
648
+ * should no longer be shown.
649
+ *
650
+ * This function also handles some of Stencil's slot relocation logic.
651
+ *
652
+ * @param vnodes a list of virtual DOM nodes to remove
653
+ * @param startIdx the index at which to start removing nodes (inclusive)
654
+ * @param endIdx the index at which to stop removing nodes (inclusive)
655
+ */
656
+ const removeVnodes = (vnodes, startIdx, endIdx) => {
657
+ for (let index = startIdx; index <= endIdx; ++index) {
658
+ const vnode = vnodes[index];
659
+ if (vnode) {
660
+ const elm = vnode.$elm$;
661
+ nullifyVNodeRefs(vnode);
662
+ if (elm) {
663
+ // remove the vnode's element from the dom
664
+ elm.remove();
665
+ }
666
+ }
667
+ }
668
+ };
669
+ /**
670
+ * Reconcile the children of a new VNode with the children of an old VNode by
671
+ * traversing the two collections of children, identifying nodes that are
672
+ * conserved or changed, calling out to `patch` to make any necessary
673
+ * updates to the DOM, and rearranging DOM nodes as needed.
674
+ *
675
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
676
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
677
+ * 'windows' by storing start and end indices and references to the
678
+ * corresponding array entries. Initially the two 'windows' are basically equal
679
+ * to the entire array, but we progressively narrow the windows until there are
680
+ * no children left to update by doing the following:
681
+ *
682
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
683
+ * that if we have an initial array like the following we'll end up dealing
684
+ * only with a window bounded by the highlighted elements:
685
+ *
686
+ * [null, null, VNode1 , ... , VNode2, null, null]
687
+ * ^^^^^^ ^^^^^^
688
+ *
689
+ * 2. Check to see if the elements at the head and tail positions are equal
690
+ * across the windows. This will basically detect elements which haven't
691
+ * been added, removed, or changed position, i.e. if you had the following
692
+ * VNode elements (represented as HTML):
693
+ *
694
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
695
+ * newVNode: `<div><p><span>THERE</span></p></div>`
696
+ *
697
+ * Then when comparing the children of the `<div>` tag we check the equality
698
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
699
+ * same tag in the same position, we'd be able to avoid completely
700
+ * re-rendering the subtree under them with a new DOM element and would just
701
+ * call out to `patch` to handle reconciling their children and so on.
702
+ *
703
+ * 3. Check, for both windows, to see if the element at the beginning of the
704
+ * window corresponds to the element at the end of the other window. This is
705
+ * a heuristic which will let us identify _some_ situations in which
706
+ * elements have changed position, for instance it _should_ detect that the
707
+ * children nodes themselves have not changed but merely moved in the
708
+ * following example:
709
+ *
710
+ * oldVNode: `<div><element-one /><element-two /></div>`
711
+ * newVNode: `<div><element-two /><element-one /></div>`
712
+ *
713
+ * If we find cases like this then we also need to move the concrete DOM
714
+ * elements corresponding to the moved children to write the re-order to the
715
+ * DOM.
716
+ *
717
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
718
+ * nodes in the old children which have the same key as the first element in
719
+ * our window on the new children. If we find such a node we handle calling
720
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
721
+ * what we find.
722
+ *
723
+ * Finally, once we've narrowed our 'windows' to the point that either of them
724
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
725
+ * insertion or deletion that needs to happen to get a DOM state that correctly
726
+ * reflects the new child VNodes. If, for instance, after our window on the old
727
+ * children has collapsed we still have more nodes on the new children that
728
+ * we haven't dealt with yet then we need to add them, or if the new children
729
+ * collapse but we still have unhandled _old_ children then we need to make
730
+ * sure the corresponding DOM nodes are removed.
731
+ *
732
+ * @param parentElm the node into which the parent VNode is rendered
733
+ * @param oldCh the old children of the parent node
734
+ * @param newVNode the new VNode which will replace the parent
735
+ * @param newCh the new children of the parent node
736
+ */
737
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
738
+ let oldStartIdx = 0;
739
+ let newStartIdx = 0;
740
+ let idxInOld = 0;
741
+ let i = 0;
742
+ let oldEndIdx = oldCh.length - 1;
743
+ let oldStartVnode = oldCh[0];
744
+ let oldEndVnode = oldCh[oldEndIdx];
745
+ let newEndIdx = newCh.length - 1;
746
+ let newStartVnode = newCh[0];
747
+ let newEndVnode = newCh[newEndIdx];
748
+ let node;
749
+ let elmToMove;
750
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
751
+ if (oldStartVnode == null) {
752
+ // VNode might have been moved left
753
+ oldStartVnode = oldCh[++oldStartIdx];
754
+ }
755
+ else if (oldEndVnode == null) {
756
+ oldEndVnode = oldCh[--oldEndIdx];
757
+ }
758
+ else if (newStartVnode == null) {
759
+ newStartVnode = newCh[++newStartIdx];
760
+ }
761
+ else if (newEndVnode == null) {
762
+ newEndVnode = newCh[--newEndIdx];
763
+ }
764
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
765
+ // if the start nodes are the same then we should patch the new VNode
766
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
767
+ // indices to reflect that. We don't need to move any DOM Nodes around
768
+ // since things are matched up in order.
769
+ patch(oldStartVnode, newStartVnode);
770
+ oldStartVnode = oldCh[++oldStartIdx];
771
+ newStartVnode = newCh[++newStartIdx];
772
+ }
773
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
774
+ // likewise, if the end nodes are the same we patch new onto old and
775
+ // decrement our end indices, and also likewise in this case we don't
776
+ // need to move any DOM Nodes.
777
+ patch(oldEndVnode, newEndVnode);
778
+ oldEndVnode = oldCh[--oldEndIdx];
779
+ newEndVnode = newCh[--newEndIdx];
780
+ }
781
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
782
+ patch(oldStartVnode, newEndVnode);
783
+ // We need to move the element for `oldStartVnode` into a position which
784
+ // will be appropriate for `newEndVnode`. For this we can use
785
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
786
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
787
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
788
+ //
789
+ // <old-start-node />
790
+ // <some-intervening-node />
791
+ // <old-end-node />
792
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
793
+ // <next-sibling />
794
+ //
795
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
796
+ // the node for `oldStartVnode` at the end of the children of
797
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
798
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
799
+ // append it to the children of the parent element.
800
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
801
+ oldStartVnode = oldCh[++oldStartIdx];
802
+ newEndVnode = newCh[--newEndIdx];
803
+ }
804
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
805
+ patch(oldEndVnode, newStartVnode);
806
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
807
+ // the same node, so since we're here we know that they are not. Thus we
808
+ // can move the element for `oldEndVnode` _before_ the element for
809
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
810
+ // future.
811
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
812
+ oldEndVnode = oldCh[--oldEndIdx];
813
+ newStartVnode = newCh[++newStartIdx];
814
+ }
815
+ else {
816
+ // Here we do some checks to match up old and new nodes based on the
817
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
818
+ // in the JSX for a DOM element in the implementation of a Stencil
819
+ // component.
820
+ //
821
+ // First we check to see if there are any nodes in the array of old
822
+ // children which have the same key as the first node in the new
823
+ // children.
824
+ idxInOld = -1;
825
+ {
826
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
827
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
828
+ idxInOld = i;
829
+ break;
830
+ }
831
+ }
832
+ }
833
+ if (idxInOld >= 0) {
834
+ // We found a node in the old children which matches up with the first
835
+ // node in the new children! So let's deal with that
836
+ elmToMove = oldCh[idxInOld];
837
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
838
+ // the tag doesn't match so we'll need a new DOM element
839
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
840
+ }
841
+ else {
842
+ patch(elmToMove, newStartVnode);
843
+ // invalidate the matching old node so that we won't try to update it
844
+ // again later on
845
+ oldCh[idxInOld] = undefined;
846
+ node = elmToMove.$elm$;
847
+ }
848
+ newStartVnode = newCh[++newStartIdx];
849
+ }
850
+ else {
851
+ // We either didn't find an element in the old children that matches
852
+ // the key of the first new child OR the build is not using `key`
853
+ // attributes at all. In either case we need to create a new element
854
+ // for the new node.
855
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
856
+ newStartVnode = newCh[++newStartIdx];
857
+ }
858
+ if (node) {
859
+ // if we created a new node then handle inserting it to the DOM
860
+ {
861
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
862
+ }
863
+ }
864
+ }
865
+ }
866
+ if (oldStartIdx > oldEndIdx) {
867
+ // we have some more new nodes to add which don't match up with old nodes
868
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
869
+ }
870
+ else if (newStartIdx > newEndIdx) {
871
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
872
+ // in the new array, so lets remove them (which entails cleaning up the
873
+ // relevant DOM nodes)
874
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
875
+ }
876
+ };
877
+ /**
878
+ * Compare two VNodes to determine if they are the same
879
+ *
880
+ * **NB**: This function is an equality _heuristic_ based on the available
881
+ * information set on the two VNodes and can be misleading under certain
882
+ * circumstances. In particular, if the two nodes do not have `key` attrs
883
+ * (available under `$key$` on VNodes) then the function falls back on merely
884
+ * checking that they have the same tag.
885
+ *
886
+ * So, in other words, if `key` attrs are not set on VNodes which may be
887
+ * changing order within a `children` array or something along those lines then
888
+ * we could obtain a false negative and then have to do needless re-rendering
889
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
890
+ *
891
+ * @param leftVNode the first VNode to check
892
+ * @param rightVNode the second VNode to check
893
+ * @returns whether they're equal or not
894
+ */
895
+ const isSameVnode = (leftVNode, rightVNode) => {
896
+ // compare if two vnode to see if they're "technically" the same
897
+ // need to have the same element tag, and same key to be the same
898
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
899
+ // this will be set if components in the build have `key` attrs set on them
900
+ {
901
+ return leftVNode.$key$ === rightVNode.$key$;
902
+ }
903
+ }
904
+ return false;
905
+ };
906
+ /**
907
+ * Handle reconciling an outdated VNode with a new one which corresponds to
908
+ * it. This function handles flushing updates to the DOM and reconciling the
909
+ * children of the two nodes (if any).
910
+ *
911
+ * @param oldVNode an old VNode whose DOM element and children we want to update
912
+ * @param newVNode a new VNode representing an updated version of the old one
913
+ */
914
+ const patch = (oldVNode, newVNode) => {
915
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
916
+ const oldChildren = oldVNode.$children$;
917
+ const newChildren = newVNode.$children$;
918
+ const text = newVNode.$text$;
919
+ if (text === null) {
920
+ {
921
+ {
922
+ // either this is the first render of an element OR it's an update
923
+ // AND we already know it's possible it could have changed
924
+ // this updates the element's css classes, attrs, props, listeners, etc.
925
+ updateElement(oldVNode, newVNode, isSvgMode);
926
+ }
927
+ }
928
+ if (oldChildren !== null && newChildren !== null) {
929
+ // looks like there's child vnodes for both the old and new vnodes
930
+ // so we need to call `updateChildren` to reconcile them
931
+ updateChildren(elm, oldChildren, newVNode, newChildren);
932
+ }
933
+ else if (newChildren !== null) {
934
+ // no old child vnodes, but there are new child vnodes to add
935
+ if (oldVNode.$text$ !== null) {
936
+ // the old vnode was text, so be sure to clear it out
937
+ elm.textContent = '';
938
+ }
939
+ // add the new vnode children
940
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
941
+ }
942
+ else if (oldChildren !== null) {
943
+ // no new child vnodes, but there are old child vnodes to remove
944
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
945
+ }
946
+ }
947
+ else if (oldVNode.$text$ !== text) {
948
+ // update the text content for the text only vnode
949
+ // and also only if the text is different than before
950
+ elm.data = text;
951
+ }
952
+ };
953
+ /**
954
+ * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
955
+ * them with `null`. This signals that the DOM element corresponding to the VDom
956
+ * node has been removed from the DOM.
957
+ *
958
+ * @param vNode a virtual DOM node
959
+ */
960
+ const nullifyVNodeRefs = (vNode) => {
961
+ {
962
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
963
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
964
+ }
965
+ };
966
+ /**
967
+ * The main entry point for Stencil's virtual DOM-based rendering engine
968
+ *
969
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
970
+ * function will handle creating a virtual DOM tree with a single root, patching
971
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
972
+ * relocation, and reflecting attributes.
973
+ *
974
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
975
+ * the DOM node into which it should be rendered.
976
+ * @param renderFnResults the virtual DOM nodes to be rendered
977
+ * @param isInitialLoad whether or not this is the first call after page load
978
+ */
979
+ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
980
+ const hostElm = hostRef.$hostElement$;
981
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
982
+ // if `renderFnResults` is a Host node then we can use it directly. If not,
983
+ // we need to call `h` again to wrap the children of our component in a
984
+ // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
985
+ // implicitly that the top-level vdom node is 1) an only child and 2)
986
+ // contains attrs that need to be set on the host element.
987
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
988
+ hostTagName = hostElm.tagName;
989
+ // On the first render and *only* on the first render we want to check for
990
+ // any attributes set on the host element which are also set on the vdom
991
+ // node. If we find them, we override the value on the VDom node attrs with
992
+ // the value from the host element, which allows developers building apps
993
+ // with Stencil components to override e.g. the `role` attribute on a
994
+ // component even if it's already set on the `Host`.
995
+ if (isInitialLoad && rootVnode.$attrs$) {
996
+ for (const key of Object.keys(rootVnode.$attrs$)) {
997
+ // We have a special implementation in `setAccessor` for `style` and
998
+ // `class` which reconciles values coming from the VDom with values
999
+ // already present on the DOM element, so we don't want to override those
1000
+ // attributes on the VDom tree with values from the host element if they
1001
+ // are present.
1002
+ //
1003
+ // Likewise, `ref` and `key` are special internal values for the Stencil
1004
+ // runtime and we don't want to override those either.
1005
+ if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
1006
+ rootVnode.$attrs$[key] = hostElm[key];
1007
+ }
1008
+ }
1009
+ }
1010
+ rootVnode.$tag$ = null;
1011
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1012
+ hostRef.$vnode$ = rootVnode;
1013
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1014
+ {
1015
+ scopeId = hostElm['s-sc'];
1016
+ }
1017
+ // synchronous patch
1018
+ patch(oldVNode, rootVnode);
1019
+ };
208
1020
  const attachToAncestor = (hostRef, ancestorComponent) => {
209
1021
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
210
1022
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -251,6 +1063,16 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
251
1063
  // 2. If all functions added to the queue are asynchronous they'll all be
252
1064
  // called in order after `dispatchHooks` exits.
253
1065
  let maybePromise;
1066
+ if (isInitialLoad) {
1067
+ {
1068
+ // If `componentWillLoad` returns a `Promise` then we want to wait on
1069
+ // whatever's going on in that `Promise` before we launch into
1070
+ // rendering the component, doing other lifecycle stuff, etc. So
1071
+ // in that case we assign the returned promise to the variable we
1072
+ // declared above to hold a possible 'queueing' Promise
1073
+ maybePromise = safeCall(instance, 'componentWillLoad');
1074
+ }
1075
+ }
254
1076
  endSchedule();
255
1077
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
256
1078
  };
@@ -304,7 +1126,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
304
1126
  }
305
1127
  const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
306
1128
  {
307
- callRender(hostRef, instance);
1129
+ callRender(hostRef, instance, elm, isInitialLoad);
308
1130
  }
309
1131
  if (rc) {
310
1132
  // ok, so turns out there are some child host elements
@@ -353,6 +1175,16 @@ const callRender = (hostRef, instance, elm, isInitialLoad) => {
353
1175
  {
354
1176
  hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
355
1177
  }
1178
+ {
1179
+ {
1180
+ // looks like we've got child nodes to render into this host element
1181
+ // or we need to update the css class/attrs on the host element
1182
+ // DOM WRITE!
1183
+ {
1184
+ renderVdom(hostRef, instance, isInitialLoad);
1185
+ }
1186
+ }
1187
+ }
356
1188
  }
357
1189
  catch (e) {
358
1190
  consoleError(e, hostRef.$hostElement$);
@@ -363,6 +1195,7 @@ const postUpdateComponent = (hostRef) => {
363
1195
  const tagName = hostRef.$cmpMeta$.$tagName$;
364
1196
  const elm = hostRef.$hostElement$;
365
1197
  const endPostUpdate = createTime('postUpdate', tagName);
1198
+ const instance = hostRef.$lazyInstance$ ;
366
1199
  const ancestorComponent = hostRef.$ancestorComponent$;
367
1200
  if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
368
1201
  hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
@@ -370,6 +1203,9 @@ const postUpdateComponent = (hostRef) => {
370
1203
  // DOM WRITE!
371
1204
  addHydratedFlag(elm);
372
1205
  }
1206
+ {
1207
+ safeCall(instance, 'componentDidLoad');
1208
+ }
373
1209
  endPostUpdate();
374
1210
  {
375
1211
  hostRef.$onReadyResolve$(elm);
@@ -761,13 +1597,18 @@ const connectedCallback = (elm) => {
761
1597
  }
762
1598
  };
763
1599
  const disconnectInstance = (instance) => {
1600
+ {
1601
+ safeCall(instance, 'disconnectedCallback');
1602
+ }
764
1603
  };
765
1604
  const disconnectedCallback = async (elm) => {
766
1605
  if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
767
1606
  const hostRef = getHostRef(elm);
768
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1607
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
1608
+ disconnectInstance(hostRef.$lazyInstance$);
1609
+ }
769
1610
  else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
770
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1611
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
771
1612
  }
772
1613
  }
773
1614
  };
@@ -808,6 +1649,17 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
808
1649
  super(self);
809
1650
  self = this;
810
1651
  registerHost(self, cmpMeta);
1652
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1653
+ // this component is using shadow dom
1654
+ // and this browser supports shadow dom
1655
+ // add the read-only property "shadowRoot" to the host element
1656
+ // adding the shadow root build conditionals to minimize runtime
1657
+ {
1658
+ {
1659
+ self.attachShadow({ mode: 'open' });
1660
+ }
1661
+ }
1662
+ }
811
1663
  }
812
1664
  connectedCallback() {
813
1665
  if (appLoadFallback) {
@@ -859,6 +1711,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
859
1711
  // Fallback appLoad event
860
1712
  endBootstrap();
861
1713
  };
1714
+ const Fragment = (_, children) => children;
862
1715
  /**
863
1716
  * Assigns the given value to the nonce property on the runtime platform object.
864
1717
  * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
@@ -913,6 +1766,7 @@ const registerHost = (hostElement, cmpMeta) => {
913
1766
  }
914
1767
  return hostRefs.set(hostElement, hostRef);
915
1768
  };
1769
+ const isMemberInElement = (elm, memberName) => memberName in elm;
916
1770
  const consoleError = (e, el) => (0, console.error)(e, el);
917
1771
  const cmpModules = /*@__PURE__*/ new Map();
918
1772
  const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
@@ -935,10 +1789,18 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
935
1789
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
936
1790
  /* webpackMode: "lazy" */
937
1791
  './arcgis-api-key.cjs.entry.js')); }).then(processMod, consoleError);
1792
+ case 'arcgis-field-pick-list.cjs':
1793
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1794
+ /* webpackMode: "lazy" */
1795
+ './arcgis-field-pick-list.cjs.entry.js')); }).then(processMod, consoleError);
938
1796
  case 'arcgis-identity.cjs':
939
1797
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
940
1798
  /* webpackMode: "lazy" */
941
1799
  './arcgis-identity.cjs.entry.js')); }).then(processMod, consoleError);
1800
+ case 'arcgis-field-info.cjs':
1801
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1802
+ /* webpackMode: "lazy" */
1803
+ './arcgis-field-info.cjs.entry.js')); }).then(processMod, consoleError);
942
1804
  }
943
1805
  }
944
1806
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
@@ -1018,9 +1880,13 @@ const flush = () => {
1018
1880
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1019
1881
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1020
1882
 
1883
+ exports.Fragment = Fragment;
1884
+ exports.Host = Host;
1021
1885
  exports.bootstrapLazy = bootstrapLazy;
1022
1886
  exports.createEvent = createEvent;
1887
+ exports.getAssetPath = getAssetPath;
1023
1888
  exports.getElement = getElement;
1889
+ exports.h = h;
1024
1890
  exports.promiseResolve = promiseResolve;
1025
1891
  exports.registerInstance = registerInstance;
1026
1892
  exports.setNonce = setNonce;