@justifi/webcomponents 4.0.5 → 4.2.0-rc.0

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 (268) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/Api-11362403.js +111 -0
  3. package/dist/cjs/Api-11362403.js.map +1 -0
  4. package/dist/cjs/Payment-ac4dea02.js +2 -0
  5. package/dist/cjs/Payment-ac4dea02.js.map +1 -0
  6. package/dist/cjs/{index-051b6dd0.js → index-34312a38.js} +185 -21
  7. package/dist/cjs/index-34312a38.js.map +1 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/index.cjs.js.map +1 -0
  10. package/dist/cjs/{index.esm-8df4906e.js → index.esm-bcf90c56.js} +2 -244
  11. package/dist/cjs/index.esm-bcf90c56.js.map +1 -0
  12. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +12 -1
  13. package/dist/cjs/justifi-bank-account-form.cjs.entry.js.map +1 -0
  14. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +8 -5
  15. package/dist/cjs/justifi-billing-form_2.cjs.entry.js.map +1 -0
  16. package/dist/cjs/justifi-business-address.cjs.entry.js +7 -4
  17. package/dist/cjs/justifi-business-address.cjs.entry.js.map +1 -0
  18. package/dist/cjs/justifi-business-info.cjs.entry.js +174 -0
  19. package/dist/cjs/justifi-business-info.cjs.entry.js.map +1 -0
  20. package/dist/cjs/justifi-card-form.cjs.entry.js +12 -1
  21. package/dist/cjs/justifi-card-form.cjs.entry.js.map +1 -0
  22. package/dist/cjs/justifi-payment-form.cjs.entry.js +10 -4
  23. package/dist/cjs/justifi-payment-form.cjs.entry.js.map +1 -0
  24. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +15 -7
  25. package/dist/cjs/justifi-payment-method-form.cjs.entry.js.map +1 -0
  26. package/dist/cjs/justifi-payments-list.cjs.entry.js +5 -108
  27. package/dist/cjs/justifi-payments-list.cjs.entry.js.map +1 -0
  28. package/dist/cjs/loader.cjs.js +6 -3
  29. package/dist/cjs/loader.cjs.js.map +1 -0
  30. package/dist/cjs/select-input_2.cjs.entry.js +5 -3
  31. package/dist/cjs/select-input_2.cjs.entry.js.map +1 -0
  32. package/dist/cjs/state-options-efeaa587.js +248 -0
  33. package/dist/cjs/state-options-efeaa587.js.map +1 -0
  34. package/dist/cjs/webcomponents.cjs.js +12 -3
  35. package/dist/cjs/webcomponents.cjs.js.map +1 -0
  36. package/dist/collection/api/Api.js +2 -1
  37. package/dist/collection/api/Api.js.map +1 -0
  38. package/dist/collection/api/Pagination.js +1 -0
  39. package/dist/collection/api/Pagination.js.map +1 -0
  40. package/dist/collection/api/Payment.js +1 -0
  41. package/dist/collection/api/Payment.js.map +1 -0
  42. package/dist/collection/api/index.js +1 -0
  43. package/dist/collection/api/index.js.map +1 -0
  44. package/dist/collection/api/mockData/MockPayments.js +1 -0
  45. package/dist/collection/api/mockData/MockPayments.js.map +1 -0
  46. package/dist/collection/collection-manifest.json +4 -3
  47. package/dist/collection/components/bank-account-form/bank-account-form.js +26 -0
  48. package/dist/collection/components/bank-account-form/bank-account-form.js.map +1 -0
  49. package/dist/collection/components/bank-account-form/bank-account-form.stories.js +11 -1
  50. package/dist/collection/components/bank-account-form/bank-account-form.stories.js.map +1 -0
  51. package/dist/collection/components/bank-account-form/test/bank-account-form.e2e.js +14 -0
  52. package/dist/collection/components/bank-account-form/test/bank-account-form.e2e.js.map +1 -0
  53. package/dist/collection/components/bank-account-form/test/bank-account-form.spec.js +48 -0
  54. package/dist/collection/components/bank-account-form/test/bank-account-form.spec.js.map +1 -0
  55. package/dist/collection/components/billing-form/billing-form-schema.js +1 -0
  56. package/dist/collection/components/billing-form/billing-form-schema.js.map +1 -0
  57. package/dist/collection/components/billing-form/billing-form.css +337 -0
  58. package/dist/collection/components/billing-form/billing-form.js +1 -0
  59. package/dist/collection/components/billing-form/billing-form.js.map +1 -0
  60. package/dist/collection/components/billing-form/billing-form.stories.js +1 -0
  61. package/dist/collection/components/billing-form/billing-form.stories.js.map +1 -0
  62. package/dist/collection/components/billing-form/state-options.js +1 -0
  63. package/dist/collection/components/billing-form/state-options.js.map +1 -0
  64. package/dist/collection/components/billing-form/test/billing-form.spec.js +31 -0
  65. package/dist/collection/components/billing-form/test/billing-form.spec.js.map +1 -0
  66. package/dist/collection/components/business-address/business-address-schema.js +1 -0
  67. package/dist/collection/components/business-address/business-address-schema.js.map +1 -0
  68. package/dist/collection/components/business-address/business-address.css +337 -0
  69. package/dist/collection/components/business-address/business-address.js +1 -0
  70. package/dist/collection/components/business-address/business-address.js.map +1 -0
  71. package/dist/collection/components/business-address/test/business-address.e2e.js +10 -0
  72. package/dist/collection/components/business-address/test/business-address.e2e.js.map +1 -0
  73. package/dist/collection/components/business-address/test/business-address.spec.js +18 -0
  74. package/dist/collection/components/business-address/test/business-address.spec.js.map +1 -0
  75. package/dist/collection/components/business-info/business-info-schema.js +94 -0
  76. package/dist/collection/components/business-info/business-info-schema.js.map +1 -0
  77. package/dist/collection/components/business-info/business-info.css +2274 -0
  78. package/dist/collection/components/business-info/business-info.js +168 -0
  79. package/dist/collection/components/business-info/business-info.js.map +1 -0
  80. package/dist/collection/components/card-form/card-form.js +26 -0
  81. package/dist/collection/components/card-form/card-form.js.map +1 -0
  82. package/dist/collection/components/card-form/card-form.stories.js +11 -1
  83. package/dist/collection/components/card-form/card-form.stories.js.map +1 -0
  84. package/dist/collection/components/card-form/test/card-form.e2e.js +14 -0
  85. package/dist/collection/components/card-form/test/card-form.e2e.js.map +1 -0
  86. package/dist/collection/components/card-form/test/card-form.spec.js +56 -0
  87. package/dist/collection/components/card-form/test/card-form.spec.js.map +1 -0
  88. package/dist/collection/components/payment-form/payment-form.css +412 -0
  89. package/dist/collection/components/payment-form/payment-form.js +8 -2
  90. package/dist/collection/components/payment-form/payment-form.js.map +1 -0
  91. package/dist/collection/components/payment-form/payment-form.stories.js +3 -1
  92. package/dist/collection/components/payment-form/payment-form.stories.js.map +1 -0
  93. package/dist/collection/components/payment-form/payment-method-selector.css +337 -0
  94. package/dist/collection/components/payment-form/payment-method-selector.js +1 -0
  95. package/dist/collection/components/payment-form/payment-method-selector.js.map +1 -0
  96. package/dist/collection/components/payment-form/test/payment-form.e2e.js +23 -0
  97. package/dist/collection/components/payment-form/test/payment-form.e2e.js.map +1 -0
  98. package/dist/collection/components/payment-form/test/payment-form.spec.js +182 -0
  99. package/dist/collection/components/payment-form/test/payment-form.spec.js.map +1 -0
  100. package/dist/collection/components/payment-form/tokenize.js +1 -0
  101. package/dist/collection/components/payment-form/tokenize.js.map +1 -0
  102. package/dist/collection/components/payment-method-form/get-computed-theme.js +1 -0
  103. package/dist/collection/components/payment-method-form/get-computed-theme.js.map +1 -0
  104. package/dist/collection/components/payment-method-form/message-event-types.js +1 -0
  105. package/dist/collection/components/payment-method-form/message-event-types.js.map +1 -0
  106. package/dist/collection/components/payment-method-form/payment-method-form.js +21 -2
  107. package/dist/collection/components/payment-method-form/payment-method-form.js.map +1 -0
  108. package/dist/collection/components/payment-method-form/payment-method-responses.js +1 -0
  109. package/dist/collection/components/payment-method-form/payment-method-responses.js.map +1 -0
  110. package/dist/collection/components/payment-method-form/test/payment-method-form.e2e.js +22 -0
  111. package/dist/collection/components/payment-method-form/test/payment-method-form.e2e.js.map +1 -0
  112. package/dist/collection/components/payment-method-form/test/payment-method-form.spec.js +83 -0
  113. package/dist/collection/components/payment-method-form/test/payment-method-form.spec.js.map +1 -0
  114. package/dist/collection/components/payment-method-form/theme.js +1 -0
  115. package/dist/collection/components/payment-method-form/theme.js.map +1 -0
  116. package/dist/collection/components/payments-list/payments-list.js +1 -0
  117. package/dist/collection/components/payments-list/payments-list.js.map +1 -0
  118. package/dist/collection/components/payments-list/test/payments-list.spec.js +21 -0
  119. package/dist/collection/components/payments-list/test/payments-list.spec.js.map +1 -0
  120. package/dist/collection/components/select-input/select-input.css +337 -0
  121. package/dist/collection/components/select-input/select-input.js +1 -0
  122. package/dist/collection/components/select-input/select-input.js.map +1 -0
  123. package/dist/collection/components/select-input/test/select-input.spec.js +36 -0
  124. package/dist/collection/components/select-input/test/select-input.spec.js.map +1 -0
  125. package/dist/collection/components/text-input/test/text-input.spec.js +19 -0
  126. package/dist/collection/components/text-input/test/text-input.spec.js.map +1 -0
  127. package/dist/collection/components/text-input/text-input.css +337 -0
  128. package/dist/collection/components/text-input/text-input.js +1 -0
  129. package/dist/collection/components/text-input/text-input.js.map +1 -0
  130. package/dist/collection/index.js +1 -0
  131. package/dist/collection/index.js.map +1 -0
  132. package/dist/collection/utils/utils.js +1 -0
  133. package/dist/collection/utils/utils.js.map +1 -0
  134. package/dist/components/Api.js +109 -0
  135. package/dist/components/Api.js.map +1 -0
  136. package/dist/components/Payment.js +2 -0
  137. package/dist/components/Payment.js.map +1 -0
  138. package/dist/components/billing-form.js +6 -3
  139. package/dist/components/billing-form.js.map +1 -0
  140. package/dist/components/index.d.ts +9 -13
  141. package/dist/{esm/index.esm-c6a89005.js → components/index.esm.js} +3 -244
  142. package/dist/components/index.esm.js.map +1 -0
  143. package/dist/components/index.js +3 -11
  144. package/dist/components/index.js.map +1 -0
  145. package/dist/components/justifi-bank-account-form.js +14 -2
  146. package/dist/components/justifi-bank-account-form.js.map +1 -0
  147. package/dist/components/justifi-billing-form.js +2 -0
  148. package/dist/components/justifi-billing-form.js.map +1 -0
  149. package/dist/components/justifi-business-address.js +6 -3
  150. package/dist/components/justifi-business-address.js.map +1 -0
  151. package/dist/components/justifi-business-info.d.ts +11 -0
  152. package/dist/components/justifi-business-info.js +207 -0
  153. package/dist/components/justifi-business-info.js.map +1 -0
  154. package/dist/components/justifi-card-form.js +14 -2
  155. package/dist/components/justifi-card-form.js.map +1 -0
  156. package/dist/components/justifi-payment-form.js +11 -4
  157. package/dist/components/justifi-payment-form.js.map +1 -0
  158. package/dist/components/justifi-payment-method-form.js +2 -0
  159. package/dist/components/justifi-payment-method-form.js.map +1 -0
  160. package/dist/components/justifi-payment-method-selector.js +2 -0
  161. package/dist/components/justifi-payment-method-selector.js.map +1 -0
  162. package/dist/components/justifi-payments-list.js +4 -107
  163. package/dist/components/justifi-payments-list.js.map +1 -0
  164. package/dist/components/payment-method-form.js +17 -8
  165. package/dist/components/payment-method-form.js.map +1 -0
  166. package/dist/components/payment-method-selector.js +4 -2
  167. package/dist/components/payment-method-selector.js.map +1 -0
  168. package/dist/components/select-input.js +2 -0
  169. package/dist/components/select-input.js.map +1 -0
  170. package/dist/components/select-input2.js +4 -2
  171. package/dist/components/select-input2.js.map +1 -0
  172. package/dist/components/state-options.js +3 -1845
  173. package/dist/components/state-options.js.map +1 -0
  174. package/dist/components/text-input.js +2 -0
  175. package/dist/components/text-input.js.map +1 -0
  176. package/dist/components/text-input2.js +4 -2
  177. package/dist/components/text-input2.js.map +1 -0
  178. package/dist/esm/Api-a07f0057.js +109 -0
  179. package/dist/esm/Api-a07f0057.js.map +1 -0
  180. package/dist/esm/Payment-c86e1e84.js +2 -0
  181. package/dist/esm/Payment-c86e1e84.js.map +1 -0
  182. package/dist/esm/{index-605b421a.js → index-044f93fc.js} +185 -22
  183. package/dist/esm/index-044f93fc.js.map +1 -0
  184. package/dist/esm/index.esm-5624a5ed.js +1847 -0
  185. package/dist/esm/index.esm-5624a5ed.js.map +1 -0
  186. package/dist/esm/index.js +2 -0
  187. package/dist/esm/index.js.map +1 -0
  188. package/dist/esm/justifi-bank-account-form.entry.js +12 -1
  189. package/dist/esm/justifi-bank-account-form.entry.js.map +1 -0
  190. package/dist/esm/justifi-billing-form_2.entry.js +7 -4
  191. package/dist/esm/justifi-billing-form_2.entry.js.map +1 -0
  192. package/dist/esm/justifi-business-address.entry.js +6 -3
  193. package/dist/esm/justifi-business-address.entry.js.map +1 -0
  194. package/dist/esm/justifi-business-info.entry.js +170 -0
  195. package/dist/esm/justifi-business-info.entry.js.map +1 -0
  196. package/dist/esm/justifi-card-form.entry.js +12 -1
  197. package/dist/esm/justifi-card-form.entry.js.map +1 -0
  198. package/dist/esm/justifi-payment-form.entry.js +10 -4
  199. package/dist/esm/justifi-payment-form.entry.js.map +1 -0
  200. package/dist/esm/justifi-payment-method-form.entry.js +15 -7
  201. package/dist/esm/justifi-payment-method-form.entry.js.map +1 -0
  202. package/dist/esm/justifi-payments-list.entry.js +4 -107
  203. package/dist/esm/justifi-payments-list.entry.js.map +1 -0
  204. package/dist/esm/loader.js +6 -3
  205. package/dist/esm/loader.js.map +1 -0
  206. package/dist/esm/polyfills/css-shim.js +1 -1
  207. package/dist/esm/select-input_2.entry.js +5 -3
  208. package/dist/esm/select-input_2.entry.js.map +1 -0
  209. package/dist/esm/state-options-188acc34.js +246 -0
  210. package/dist/esm/state-options-188acc34.js.map +1 -0
  211. package/dist/esm/webcomponents.js +9 -3
  212. package/dist/esm/webcomponents.js.map +1 -0
  213. package/dist/types/api/Api.d.ts +1 -1
  214. package/dist/types/api/Payment.d.ts +1 -1
  215. package/dist/types/components/bank-account-form/bank-account-form.d.ts +4 -0
  216. package/dist/types/components/business-info/business-info-schema.d.ts +42 -0
  217. package/dist/types/components/business-info/business-info.d.ts +20 -0
  218. package/dist/types/components/card-form/card-form.d.ts +4 -0
  219. package/dist/types/components/payment-form/payment-form.d.ts +1 -0
  220. package/dist/types/components/payment-method-form/payment-method-form.d.ts +1 -0
  221. package/dist/types/components/payment-method-form/payment-method-responses.d.ts +1 -1
  222. package/dist/types/components.d.ts +72 -0
  223. package/dist/types/stencil-public-runtime.d.ts +72 -15
  224. package/dist/webcomponents/index.esm.js +2 -0
  225. package/dist/webcomponents/index.esm.js.map +1 -0
  226. package/dist/webcomponents/p-0969db8f.entry.js +2 -0
  227. package/dist/webcomponents/p-0969db8f.entry.js.map +1 -0
  228. package/dist/webcomponents/p-0ea23153.js +2 -0
  229. package/dist/webcomponents/p-0ea23153.js.map +1 -0
  230. package/dist/webcomponents/p-1ca0646b.js +2 -1
  231. package/dist/webcomponents/p-1ca0646b.js.map +1 -0
  232. package/dist/webcomponents/p-1f151d49.js +2 -0
  233. package/dist/webcomponents/p-1f151d49.js.map +1 -0
  234. package/dist/webcomponents/p-255b1284.entry.js +2 -0
  235. package/dist/webcomponents/p-255b1284.entry.js.map +1 -0
  236. package/dist/webcomponents/p-3aa91155.js +3 -0
  237. package/dist/webcomponents/p-3aa91155.js.map +1 -0
  238. package/dist/webcomponents/p-4ef14106.entry.js +2 -0
  239. package/dist/webcomponents/p-4ef14106.entry.js.map +1 -0
  240. package/dist/webcomponents/p-90c0d9e1.entry.js +2 -0
  241. package/dist/webcomponents/p-90c0d9e1.entry.js.map +1 -0
  242. package/dist/webcomponents/p-bd5352d6.entry.js +2 -0
  243. package/dist/webcomponents/p-bd5352d6.entry.js.map +1 -0
  244. package/dist/webcomponents/p-c903cc5a.entry.js +2 -0
  245. package/dist/webcomponents/p-c903cc5a.entry.js.map +1 -0
  246. package/dist/webcomponents/p-d87b0711.entry.js +2 -0
  247. package/dist/webcomponents/p-d87b0711.entry.js.map +1 -0
  248. package/dist/webcomponents/p-dbf7100f.entry.js +2 -0
  249. package/dist/webcomponents/p-dbf7100f.entry.js.map +1 -0
  250. package/dist/webcomponents/p-e0054bc3.js +2 -0
  251. package/dist/webcomponents/p-e0054bc3.js.map +1 -0
  252. package/dist/webcomponents/p-f30d1567.entry.js +2 -0
  253. package/dist/webcomponents/p-f30d1567.entry.js.map +1 -0
  254. package/dist/webcomponents/webcomponents.css +1 -1
  255. package/dist/webcomponents/webcomponents.esm.js +2 -1
  256. package/dist/webcomponents/webcomponents.esm.js.map +1 -0
  257. package/loader/index.d.ts +9 -0
  258. package/package.json +9 -5
  259. package/dist/webcomponents/p-039e3540.entry.js +0 -1
  260. package/dist/webcomponents/p-11e5bef9.entry.js +0 -1
  261. package/dist/webcomponents/p-20732337.js +0 -1
  262. package/dist/webcomponents/p-24409e8e.entry.js +0 -1
  263. package/dist/webcomponents/p-4a406704.js +0 -2
  264. package/dist/webcomponents/p-5774e36e.entry.js +0 -1
  265. package/dist/webcomponents/p-5b5e8351.entry.js +0 -1
  266. package/dist/webcomponents/p-5b68fa52.entry.js +0 -1
  267. package/dist/webcomponents/p-7747c086.entry.js +0 -1
  268. package/dist/webcomponents/p-bc35e124.entry.js +0 -1
@@ -36,11 +36,30 @@ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
36
36
  */
37
37
  const EMPTY_OBJ = {};
38
38
  const isDef = (v) => v != null;
39
+ /**
40
+ * Check whether a value is a 'complex type', defined here as an object or a
41
+ * function.
42
+ *
43
+ * @param o the value to check
44
+ * @returns whether it's a complex type or not
45
+ */
39
46
  const isComplexType = (o) => {
40
47
  // https://jsperf.com/typeof-fn-object/5
41
48
  o = typeof o;
42
49
  return o === 'object' || o === 'function';
43
50
  };
51
+ /**
52
+ * Helper method for querying a `meta` tag that contains a nonce value
53
+ * out of a DOM's head.
54
+ *
55
+ * @param doc The DOM containing the `head` to query against
56
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
57
+ * exists or the tag has no content.
58
+ */
59
+ function queryNonceMetaTagContent(doc) {
60
+ var _a, _b, _c;
61
+ 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;
62
+ }
44
63
  /**
45
64
  * Production h() function based on Preact by
46
65
  * Jason Miller (@developit)
@@ -49,7 +68,6 @@ const isComplexType = (o) => {
49
68
  *
50
69
  * Modified for Stencil's compiler and vdom
51
70
  */
52
- // const stack: any[] = [];
53
71
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
54
72
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
55
73
  const h = (nodeName, vnodeData, ...children) => {
@@ -104,6 +122,14 @@ const h = (nodeName, vnodeData, ...children) => {
104
122
  }
105
123
  return vnode;
106
124
  };
125
+ /**
126
+ * A utility function for creating a virtual DOM node from a tag and some
127
+ * possible text content.
128
+ *
129
+ * @param tag the tag for this element
130
+ * @param text possible text content for the node
131
+ * @returns a newly-minted virtual DOM node
132
+ */
107
133
  const newVNode = (tag, text) => {
108
134
  const vnode = {
109
135
  $flags$: 0,
@@ -118,11 +144,31 @@ const newVNode = (tag, text) => {
118
144
  return vnode;
119
145
  };
120
146
  const Host = {};
147
+ /**
148
+ * Check whether a given node is a Host node or not
149
+ *
150
+ * @param node the virtual DOM node to check
151
+ * @returns whether it's a Host node or not
152
+ */
121
153
  const isHost = (node) => node && node.$tag$ === Host;
154
+ /**
155
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
156
+ *
157
+ * Note that these functions convert from {@link d.VNode} to
158
+ * {@link d.ChildNode} to give functional component developers a friendly
159
+ * interface.
160
+ */
122
161
  const vdomFnUtils = {
123
162
  forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
124
163
  map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
125
164
  };
165
+ /**
166
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
167
+ * friendlier public interface (hence, 'convertToPublic').
168
+ *
169
+ * @param node the virtual DOM node to convert
170
+ * @returns a converted child node
171
+ */
126
172
  const convertToPublic = (node) => ({
127
173
  vattrs: node.$attrs$,
128
174
  vchildren: node.$children$,
@@ -131,6 +177,15 @@ const convertToPublic = (node) => ({
131
177
  vtag: node.$tag$,
132
178
  vtext: node.$text$,
133
179
  });
180
+ /**
181
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
182
+ * order to use the resulting object in the virtual DOM. The initial object was
183
+ * likely created as part of presenting a public API, so converting it back
184
+ * involved making it 'private' again (hence, `convertToPrivate`).
185
+ *
186
+ * @param node the child node to convert
187
+ * @returns a converted virtual DOM node
188
+ */
134
189
  const convertToPrivate = (node) => {
135
190
  if (typeof node.vtag === 'function') {
136
191
  const vnodeData = Object.assign({}, node.vattrs);
@@ -236,6 +291,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
236
291
  styles.set(scopeId, style);
237
292
  };
238
293
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
294
+ var _a;
239
295
  let scopeId = getScopeId(cmpMeta);
240
296
  const style = styles.get(scopeId);
241
297
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -251,10 +307,16 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
251
307
  }
252
308
  if (!appliedStyles.has(scopeId)) {
253
309
  {
310
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
254
311
  {
255
312
  styleElm = doc.createElement('style');
256
313
  styleElm.innerHTML = style;
257
314
  }
315
+ // Apply CSP nonce to the style tag if it exists
316
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
317
+ if (nonce != null) {
318
+ styleElm.setAttribute('nonce', nonce);
319
+ }
258
320
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
259
321
  }
260
322
  if (appliedStyles) {
@@ -274,6 +336,7 @@ const attachStyles = (hostRef) => {
274
336
  const flags = cmpMeta.$flags$;
275
337
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
276
338
  const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
339
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
277
340
  if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
278
341
  // only required when we're NOT using native shadow dom (slot)
279
342
  // or this browser doesn't support native shadow dom
@@ -459,6 +522,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
459
522
  }
460
523
  return elm;
461
524
  };
525
+ /**
526
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
527
+ * add them to the DOM in the appropriate place.
528
+ *
529
+ * @param parentElm the DOM node which should be used as a parent for the new
530
+ * DOM nodes
531
+ * @param before a child of the `parentElm` which the new children should be
532
+ * inserted before (optional)
533
+ * @param parentVNode the parent virtual DOM node
534
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
535
+ * @param startIdx the index in the child virtual DOM nodes at which to start
536
+ * creating DOM nodes (inclusive)
537
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
538
+ * creating DOM nodes (inclusive)
539
+ */
462
540
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
463
541
  let containerElm = (parentElm);
464
542
  let childNode;
@@ -475,13 +553,27 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
475
553
  }
476
554
  }
477
555
  };
478
- const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
479
- for (; startIdx <= endIdx; ++startIdx) {
480
- if ((vnode = vnodes[startIdx])) {
481
- elm = vnode.$elm$;
482
- callNodeRefs(vnode);
483
- // remove the vnode's element from the dom
484
- elm.remove();
556
+ /**
557
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
558
+ * This can be used to, for instance, clean up after a list of children which
559
+ * should no longer be shown.
560
+ *
561
+ * This function also handles some of Stencil's slot relocation logic.
562
+ *
563
+ * @param vnodes a list of virtual DOM nodes to remove
564
+ * @param startIdx the index at which to start removing nodes (inclusive)
565
+ * @param endIdx the index at which to stop removing nodes (inclusive)
566
+ */
567
+ const removeVnodes = (vnodes, startIdx, endIdx) => {
568
+ for (let index = startIdx; index <= endIdx; ++index) {
569
+ const vnode = vnodes[index];
570
+ if (vnode) {
571
+ const elm = vnode.$elm$;
572
+ nullifyVNodeRefs(vnode);
573
+ if (elm) {
574
+ // remove the vnode's element from the dom
575
+ elm.remove();
576
+ }
485
577
  }
486
578
  }
487
579
  };
@@ -667,7 +759,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
667
759
  *
668
760
  * So, in other words, if `key` attrs are not set on VNodes which may be
669
761
  * changing order within a `children` array or something along those lines then
670
- * we could obtain a false positive and then have to do needless re-rendering.
762
+ * we could obtain a false negative and then have to do needless re-rendering
763
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
671
764
  *
672
765
  * @param leftVNode the first VNode to check
673
766
  * @param rightVNode the second VNode to check
@@ -728,12 +821,31 @@ const patch = (oldVNode, newVNode) => {
728
821
  elm.data = text;
729
822
  }
730
823
  };
731
- const callNodeRefs = (vNode) => {
824
+ /**
825
+ * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
826
+ * calling them with `null`. This signals that the DOM element corresponding to
827
+ * the VDom node has been removed from the DOM.
828
+ *
829
+ * @param vNode a virtual DOM node
830
+ */
831
+ const nullifyVNodeRefs = (vNode) => {
732
832
  {
733
833
  vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
734
- vNode.$children$ && vNode.$children$.map(callNodeRefs);
834
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
735
835
  }
736
836
  };
837
+ /**
838
+ * The main entry point for Stencil's virtual DOM-based rendering engine
839
+ *
840
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
841
+ * function will handle creating a virtual DOM tree with a single root, patching
842
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
843
+ * relocation, and reflecting attributes.
844
+ *
845
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
846
+ * the DOM node into which it should be rendered.
847
+ * @param renderFnResults the virtual DOM nodes to be rendered
848
+ */
737
849
  const renderVdom = (hostRef, renderFnResults) => {
738
850
  const hostElm = hostRef.$hostElement$;
739
851
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -769,24 +881,63 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
769
881
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
770
882
  return writeTask(dispatch) ;
771
883
  };
884
+ /**
885
+ * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
886
+ * component lifecycle methods like `componentWillLoad` as well as
887
+ * {@link updateComponent}, which will kick off the virtual DOM re-render.
888
+ *
889
+ * @param hostRef a reference to a host DOM node
890
+ * @param isInitialLoad whether we're on the initial load or not
891
+ * @returns an empty Promise which is used to enqueue a series of operations for
892
+ * the component
893
+ */
772
894
  const dispatchHooks = (hostRef, isInitialLoad) => {
773
895
  const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
774
896
  const instance = hostRef.$lazyInstance$ ;
775
- let promise;
897
+ // We're going to use this variable together with `enqueue` to implement a
898
+ // little promise-based queue. We start out with it `undefined`. When we add
899
+ // the first function to the queue we'll set this variable to be that
900
+ // function's return value. When we attempt to add subsequent values to the
901
+ // queue we'll check that value and, if it was a `Promise`, we'll then chain
902
+ // the new function off of that `Promise` using `.then()`. This will give our
903
+ // queue two nice properties:
904
+ //
905
+ // 1. If all functions added to the queue are synchronous they'll be called
906
+ // synchronously right away.
907
+ // 2. If all functions added to the queue are asynchronous they'll all be
908
+ // called in order after `dispatchHooks` exits.
909
+ let maybePromise;
776
910
  if (isInitialLoad) {
777
911
  {
778
912
  hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
779
913
  if (hostRef.$queuedListeners$) {
780
914
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
781
- hostRef.$queuedListeners$ = null;
915
+ hostRef.$queuedListeners$ = undefined;
782
916
  }
783
917
  }
784
918
  }
785
919
  endSchedule();
786
- return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
920
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
787
921
  };
922
+ /**
923
+ * This function uses a Promise to implement a simple first-in, first-out queue
924
+ * of functions to be called.
925
+ *
926
+ * The queue is ordered on the basis of the first argument. If it's
927
+ * `undefined`, then nothing is on the queue yet, so the provided function can
928
+ * be called synchronously (although note that this function may return a
929
+ * `Promise`). The idea is that then the return value of that enqueueing
930
+ * operation is kept around, so that if it was a `Promise` then subsequent
931
+ * functions can be enqueued by calling this function again with that `Promise`
932
+ * as the first argument.
933
+ *
934
+ * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
935
+ * @param fn a function to enqueue
936
+ * @returns either a `Promise` or the return value of the provided function
937
+ */
938
+ const enqueue = (maybePromise, fn) => maybePromise instanceof Promise ? maybePromise.then(fn) : fn();
788
939
  const updateComponent = async (hostRef, instance, isInitialLoad) => {
789
- // updateComponent
940
+ var _a;
790
941
  const elm = hostRef.$hostElement$;
791
942
  const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
792
943
  const rc = elm['s-rc'];
@@ -808,7 +959,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
808
959
  endRender();
809
960
  endUpdate();
810
961
  {
811
- const childrenPromises = elm['s-p'];
962
+ const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
812
963
  const postUpdate = () => postUpdateComponent(hostRef);
813
964
  if (childrenPromises.length === 0) {
814
965
  postUpdate();
@@ -905,9 +1056,6 @@ const safeCall = (instance, method, arg) => {
905
1056
  }
906
1057
  return undefined;
907
1058
  };
908
- const then = (promise, thenFn) => {
909
- return promise && promise.then ? promise.then(thenFn) : thenFn();
910
- };
911
1059
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
912
1060
  ;
913
1061
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
@@ -1073,9 +1221,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1073
1221
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1074
1222
  // initializeComponent
1075
1223
  if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1224
+ // Let the runtime know that the component has been initialized
1225
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1076
1226
  {
1077
- // we haven't initialized this element yet
1078
- hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1079
1227
  // lazy loaded components
1080
1228
  // request the component's implementation to be
1081
1229
  // wired up with the host element
@@ -1219,6 +1367,7 @@ const disconnectedCallback = (elm) => {
1219
1367
  }
1220
1368
  };
1221
1369
  const bootstrapLazy = (lazyBundles, options = {}) => {
1370
+ var _a;
1222
1371
  const endBootstrap = createTime();
1223
1372
  const cmpTags = [];
1224
1373
  const exclude = options.exclude || [];
@@ -1298,6 +1447,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1298
1447
  {
1299
1448
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1300
1449
  visibilityStyle.setAttribute('data-styles', '');
1450
+ // Apply CSP nonce to the style tag if it exists
1451
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1452
+ if (nonce != null) {
1453
+ visibilityStyle.setAttribute('nonce', nonce);
1454
+ }
1301
1455
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1302
1456
  }
1303
1457
  // Process deferred connectedCallbacks now all components have been registered
@@ -1343,6 +1497,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1343
1497
  };
1344
1498
  // prettier-ignore
1345
1499
  const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1500
+ /**
1501
+ * Assigns the given value to the nonce property on the runtime platform object.
1502
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1503
+ * @param nonce The value to be assigned to the platform nonce property.
1504
+ * @returns void
1505
+ */
1506
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1346
1507
  const hostRefs = /*@__PURE__*/ new WeakMap();
1347
1508
  const getHostRef = (ref) => hostRefs.get(ref);
1348
1509
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1453,4 +1614,6 @@ const flush = () => {
1453
1614
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1454
1615
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1455
1616
 
1456
- export { Fragment as F, Host as H, bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r };
1617
+ export { Fragment as F, Host as H, bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r, setNonce as s };
1618
+
1619
+ //# sourceMappingURL=index-044f93fc.js.map