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