@sankhyalabs/sankhyablocks 10.1.0-dev.2 → 10.1.0-dev.21

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 (318) hide show
  1. package/dist/cjs/{ConfigStorage-5a73e979.js → ConfigStorage-a4e1e518.js} +2 -2
  2. package/dist/cjs/{DataFetcher-eeb3b0b7.js → DataFetcher-0b6aa084.js} +34 -24
  3. package/dist/cjs/{FormConfigHelper-ebb77625.js → FormConfigHelper-28fe4668.js} +44 -0
  4. package/dist/cjs/{ISave-861e9d6d.js → ISave-2c455a77.js} +4 -4
  5. package/dist/cjs/{PersonalizedFilterUtils-7259cf65.js → PersonalizedFilterUtils-eccb267a.js} +13 -0
  6. package/dist/cjs/{SnkFormConfigManager-8d4fded8.js → SnkFormConfigManager-b8c81493.js} +7 -7
  7. package/dist/cjs/{SnkMultiSelectionListDataSource-3b93f6a6.js → SnkMultiSelectionListDataSource-03b58f5a.js} +5 -5
  8. package/dist/cjs/{auth-fetcher-8d8acd69.js → auth-fetcher-7e7796c9.js} +1 -1
  9. package/dist/cjs/config-header.cjs.entry.js +1 -1
  10. package/dist/cjs/configs-button.cjs.entry.js +1 -1
  11. package/dist/cjs/css-shim-a27d231b.js +6 -0
  12. package/dist/cjs/{dataunit-fetcher-1cea0695.js → dataunit-fetcher-8dffbcdf.js} +1 -1
  13. package/dist/cjs/dom-ff96a4bc.js +75 -0
  14. package/dist/cjs/field-config_2.cjs.entry.js +3 -3
  15. package/dist/cjs/fields-layout.cjs.entry.js +7 -4
  16. package/dist/cjs/fields-selector.cjs.entry.js +2 -2
  17. package/dist/cjs/{form-config-fetcher-f347f884.js → form-config-fetcher-5516d68a.js} +1 -1
  18. package/dist/cjs/guides-configurator.cjs.entry.js +6 -4
  19. package/dist/cjs/{index-1cf293c1.js → index-1894343a.js} +1515 -171
  20. package/dist/cjs/{index-13d05f03.js → index-f0fe7e6e.js} +90 -21
  21. package/dist/cjs/loader.cjs.js +16 -2
  22. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +5 -5
  23. package/dist/cjs/sankhyablocks.cjs.js +132 -4
  24. package/dist/cjs/shadow-css-7e3e0ab1.js +389 -0
  25. package/dist/cjs/snk-actions-button_9.cjs.entry.js +6 -6
  26. package/dist/cjs/snk-actions-form.cjs.entry.js +1 -1
  27. package/dist/cjs/snk-application.cjs.entry.js +100 -70
  28. package/dist/cjs/snk-attach.cjs.entry.js +8 -8
  29. package/dist/cjs/snk-client-confirm.cjs.entry.js +1 -1
  30. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  31. package/dist/cjs/snk-crud.cjs.entry.js +100 -9
  32. package/dist/cjs/snk-custom-slot-elements.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-custom-slot-guide.cjs.entry.js +40 -0
  34. package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
  35. package/dist/cjs/{snk-data-unit-de248308.js → snk-data-unit-036ce58c.js} +12 -3
  36. package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
  37. package/dist/cjs/snk-default-filter.cjs.entry.js +1 -1
  38. package/dist/cjs/snk-detail-view.cjs.entry.js +10 -10
  39. package/dist/cjs/snk-entity-list.cjs.entry.js +1 -1
  40. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  41. package/dist/cjs/snk-expression-group_2.cjs.entry.js +2 -2
  42. package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +2 -2
  43. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +58 -25
  44. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  45. package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
  46. package/dist/cjs/snk-filter-detail.cjs.entry.js +2 -2
  47. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +2 -2
  48. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +4 -4
  49. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  50. package/dist/cjs/snk-filter-number.cjs.entry.js +2 -2
  51. package/dist/cjs/snk-filter-period.cjs.entry.js +11 -6
  52. package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
  53. package/dist/cjs/snk-filter-text.cjs.entry.js +2 -2
  54. package/dist/cjs/snk-form-summary.cjs.entry.js +1 -1
  55. package/dist/cjs/snk-form-view.cjs.entry.js +1 -1
  56. package/dist/cjs/snk-form_2.cjs.entry.js +33 -10
  57. package/dist/cjs/snk-grid.cjs.entry.js +28 -19
  58. package/dist/cjs/{snk-guides-viewer-4ec3e7e1.js → snk-guides-viewer-164c063e.js} +86 -40
  59. package/dist/cjs/snk-guides-viewer.cjs.entry.js +10 -10
  60. package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
  61. package/dist/cjs/snk-personalized-filter.cjs.entry.js +6 -6
  62. package/dist/cjs/snk-pesquisa.cjs.entry.js +17 -6
  63. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  64. package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
  65. package/dist/cjs/snk-simple-crud.cjs.entry.js +14 -21
  66. package/dist/cjs/snk-taskbar.cjs.entry.js +67 -51
  67. package/dist/cjs/{taskbar-elements-fb5d1e08.js → taskbar-elements-8a80420e.js} +2 -2
  68. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  69. package/dist/collection/collection-manifest.json +2 -1
  70. package/dist/collection/components/snk-application/search-strategy/exec-prepared-search-advaced-mode.js +27 -0
  71. package/dist/collection/components/snk-application/search-strategy/exec-prepared-search-plus.js +5 -25
  72. package/dist/collection/components/snk-application/snk-application.js +105 -44
  73. package/dist/collection/components/snk-attach/snk-attach.js +1 -1
  74. package/dist/collection/components/snk-crud/snk-crud.js +151 -2
  75. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +133 -34
  76. package/dist/collection/components/snk-custom-slot-guide/snk-custom-slot-guide.css +3 -0
  77. package/dist/collection/components/snk-custom-slot-guide/snk-custom-slot-guide.js +95 -0
  78. package/dist/collection/components/snk-data-unit/snk-data-unit.js +9 -0
  79. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +2 -2
  80. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +11 -6
  81. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
  82. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.css +4 -0
  83. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +7 -1
  84. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +1 -0
  85. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +15 -4
  86. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +30 -13
  87. package/dist/collection/components/snk-form-config/FormConfigHelper.js +42 -0
  88. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -6
  89. package/dist/collection/components/snk-form-config/field-item/field-config/field-config.css +1 -0
  90. package/dist/collection/components/snk-form-config/fields-layout/fields-layout.css +16 -0
  91. package/dist/collection/components/snk-form-config/fields-layout/fields-layout.js +6 -3
  92. package/dist/collection/components/snk-form-config/guides-configurator/guides-configurator.css +3 -3
  93. package/dist/collection/components/snk-form-config/guides-configurator/guides-configurator.js +5 -3
  94. package/dist/collection/components/snk-form-config/snk-form-config.js +53 -6
  95. package/dist/collection/components/snk-grid/snk-grid.css +12 -0
  96. package/dist/collection/components/snk-grid/snk-grid.js +39 -12
  97. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +13 -0
  98. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +5 -1
  99. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +43 -0
  100. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +23 -12
  101. package/dist/collection/components/snk-taskbar/snk-taskbar.js +87 -48
  102. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +3 -3
  103. package/dist/collection/lib/message/SnkMessageBuilder.js +11 -2
  104. package/dist/collection/lib/message/resources/en-us/snk-form.msg.js +7 -0
  105. package/dist/collection/lib/message/resources/es-es/snk-form.msg.js +7 -0
  106. package/dist/collection/lib/message/resources/pt-br/snk-form.msg.js +8 -1
  107. package/dist/collection/lib/message/resources/pt-br/snk-pesquisa.msg.js +1 -1
  108. package/dist/components/DataFetcher.js +34 -4
  109. package/dist/components/ISave.js +3 -3
  110. package/dist/components/PersonalizedFilterUtils.js +13 -0
  111. package/dist/components/SnkFormConfigManager.js +6 -6
  112. package/dist/components/field-config2.js +44 -2
  113. package/dist/components/fields-layout2.js +6 -3
  114. package/dist/components/guides-configurator2.js +5 -3
  115. package/dist/components/index.d.ts +1 -0
  116. package/dist/components/index.js +1 -0
  117. package/dist/components/index2.js +90 -21
  118. package/dist/components/snk-application2.js +94 -63
  119. package/dist/components/snk-attach2.js +1 -1
  120. package/dist/components/snk-crud.js +96 -1
  121. package/dist/components/snk-custom-slot-guide.d.ts +11 -0
  122. package/dist/components/snk-custom-slot-guide.js +55 -0
  123. package/dist/components/snk-data-unit2.js +9 -0
  124. package/dist/components/snk-detail-view2.js +81 -34
  125. package/dist/components/snk-filter-bar2.js +30 -13
  126. package/dist/components/snk-filter-item2.js +8 -2
  127. package/dist/components/snk-filter-modal2.js +16 -6
  128. package/dist/components/snk-filter-number.js +2 -2
  129. package/dist/components/snk-filter-period.js +10 -5
  130. package/dist/components/snk-filter-text.js +1 -1
  131. package/dist/components/snk-form-config2.js +29 -5
  132. package/dist/components/snk-grid2.js +22 -11
  133. package/dist/components/snk-pesquisa2.js +14 -2
  134. package/dist/components/snk-simple-crud2.js +6 -12
  135. package/dist/components/snk-taskbar2.js +66 -49
  136. package/dist/esm/{ConfigStorage-568dc227.js → ConfigStorage-39ac8fef.js} +2 -2
  137. package/dist/esm/{DataFetcher-743feb3b.js → DataFetcher-0b9da57d.js} +34 -4
  138. package/dist/esm/{FormConfigHelper-4e42f0b6.js → FormConfigHelper-d09669f3.js} +43 -1
  139. package/dist/esm/{ISave-345481c1.js → ISave-f1c9269b.js} +4 -4
  140. package/dist/esm/{PersonalizedFilterUtils-2db38ff2.js → PersonalizedFilterUtils-d2439a9a.js} +13 -0
  141. package/dist/esm/{SnkFormConfigManager-d61df0c8.js → SnkFormConfigManager-a87566c8.js} +7 -7
  142. package/dist/esm/{SnkMultiSelectionListDataSource-ca8d7a09.js → SnkMultiSelectionListDataSource-01b3744b.js} +5 -5
  143. package/dist/esm/{auth-fetcher-c353127d.js → auth-fetcher-acdc1cb4.js} +1 -1
  144. package/dist/esm/config-header.entry.js +1 -1
  145. package/dist/esm/configs-button.entry.js +1 -1
  146. package/dist/esm/css-shim-9f2d321e.js +4 -0
  147. package/dist/esm/{dataunit-fetcher-7f2c61ca.js → dataunit-fetcher-4c312b43.js} +1 -1
  148. package/dist/esm/dom-64053c71.js +73 -0
  149. package/dist/esm/field-config_2.entry.js +3 -3
  150. package/dist/esm/fields-layout.entry.js +7 -4
  151. package/dist/esm/fields-selector.entry.js +2 -2
  152. package/dist/esm/{form-config-fetcher-898d2dd1.js → form-config-fetcher-7cda6254.js} +1 -1
  153. package/dist/esm/guides-configurator.entry.js +6 -4
  154. package/dist/esm/{index-479e1293.js → index-04f73a26.js} +1507 -171
  155. package/dist/esm/{index-446f9341.js → index-ea250be6.js} +90 -21
  156. package/dist/esm/loader.js +17 -3
  157. package/dist/esm/pesquisa-grid_2.entry.js +5 -5
  158. package/dist/esm/sankhyablocks.js +133 -5
  159. package/dist/esm/shadow-css-98135883.js +387 -0
  160. package/dist/esm/snk-actions-button_9.entry.js +6 -6
  161. package/dist/esm/snk-actions-form.entry.js +1 -1
  162. package/dist/esm/snk-application.entry.js +100 -70
  163. package/dist/esm/snk-attach.entry.js +8 -8
  164. package/dist/esm/snk-client-confirm.entry.js +1 -1
  165. package/dist/esm/snk-configurator.entry.js +1 -1
  166. package/dist/esm/snk-crud.entry.js +100 -9
  167. package/dist/esm/snk-custom-slot-elements.entry.js +1 -1
  168. package/dist/esm/snk-custom-slot-guide.entry.js +36 -0
  169. package/dist/esm/snk-data-exporter.entry.js +6 -6
  170. package/dist/esm/{snk-data-unit-60b338c5.js → snk-data-unit-130021b3.js} +12 -3
  171. package/dist/esm/snk-data-unit.entry.js +4 -4
  172. package/dist/esm/snk-default-filter.entry.js +1 -1
  173. package/dist/esm/snk-detail-view.entry.js +10 -10
  174. package/dist/esm/snk-entity-list.entry.js +1 -1
  175. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  176. package/dist/esm/snk-expression-group_2.entry.js +2 -2
  177. package/dist/esm/snk-filter-advanced-mode_2.entry.js +2 -2
  178. package/dist/esm/snk-filter-bar_4.entry.js +58 -25
  179. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  180. package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
  181. package/dist/esm/snk-filter-detail.entry.js +2 -2
  182. package/dist/esm/snk-filter-field-search_2.entry.js +2 -2
  183. package/dist/esm/snk-filter-modal-item.entry.js +4 -4
  184. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  185. package/dist/esm/snk-filter-number.entry.js +2 -2
  186. package/dist/esm/snk-filter-period.entry.js +11 -6
  187. package/dist/esm/snk-filter-search.entry.js +1 -1
  188. package/dist/esm/snk-filter-text.entry.js +2 -2
  189. package/dist/esm/snk-form-summary.entry.js +1 -1
  190. package/dist/esm/snk-form-view.entry.js +1 -1
  191. package/dist/esm/snk-form_2.entry.js +33 -10
  192. package/dist/esm/snk-grid.entry.js +28 -19
  193. package/dist/esm/{snk-guides-viewer-339e10b3.js → snk-guides-viewer-3fd18298.js} +86 -40
  194. package/dist/esm/snk-guides-viewer.entry.js +10 -10
  195. package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
  196. package/dist/esm/snk-personalized-filter.entry.js +6 -6
  197. package/dist/esm/snk-pesquisa.entry.js +17 -6
  198. package/dist/esm/snk-print-selector.entry.js +1 -1
  199. package/dist/esm/snk-simple-bar.entry.js +1 -1
  200. package/dist/esm/snk-simple-crud.entry.js +14 -21
  201. package/dist/esm/snk-taskbar.entry.js +68 -52
  202. package/dist/esm/{taskbar-elements-faaf5d8f.js → taskbar-elements-d1e63fb2.js} +2 -2
  203. package/dist/esm/teste-pesquisa.entry.js +1 -1
  204. package/dist/sankhyablocks/{p-7f7fe6c4.entry.js → p-0a160fb5.entry.js} +1 -1
  205. package/dist/sankhyablocks/{p-144da1d1.entry.js → p-12f595a6.entry.js} +1 -1
  206. package/dist/sankhyablocks/{p-162bddae.entry.js → p-175c9576.entry.js} +1 -1
  207. package/dist/sankhyablocks/p-18d66638.entry.js +1 -0
  208. package/dist/sankhyablocks/{p-1788d191.js → p-1f310bc6.js} +1 -1
  209. package/dist/sankhyablocks/{p-c4fcf1fb.entry.js → p-27e0cd68.entry.js} +1 -1
  210. package/dist/sankhyablocks/p-2a33d4cf.entry.js +1 -0
  211. package/dist/sankhyablocks/p-2ac55a5d.js +1 -0
  212. package/dist/sankhyablocks/{p-9a63f3f7.entry.js → p-2b882835.entry.js} +1 -1
  213. package/dist/sankhyablocks/{p-1f8cb438.entry.js → p-2c6be187.entry.js} +1 -1
  214. package/dist/sankhyablocks/p-2c9d0870.js +2 -0
  215. package/dist/sankhyablocks/{p-cb4343c4.entry.js → p-2cc2526e.entry.js} +1 -1
  216. package/dist/sankhyablocks/{p-75af335e.entry.js → p-2ebda226.entry.js} +1 -1
  217. package/dist/sankhyablocks/{p-093f58fa.entry.js → p-2f94cf87.entry.js} +1 -1
  218. package/dist/sankhyablocks/p-3a35917e.entry.js +1 -0
  219. package/dist/sankhyablocks/p-3a443150.entry.js +1 -0
  220. package/dist/sankhyablocks/{p-c90f337a.entry.js → p-3b6d8d33.entry.js} +1 -1
  221. package/dist/sankhyablocks/p-3db72758.entry.js +1 -0
  222. package/dist/sankhyablocks/{p-e8c49c12.js → p-48a5c311.js} +2 -2
  223. package/dist/sankhyablocks/p-52691b42.js +1 -0
  224. package/dist/sankhyablocks/{p-27482793.entry.js → p-5aae5c74.entry.js} +1 -1
  225. package/dist/sankhyablocks/p-6564180d.entry.js +1 -0
  226. package/dist/sankhyablocks/{p-6d241415.js → p-6768f176.js} +1 -1
  227. package/dist/sankhyablocks/p-68c1a093.js +1 -0
  228. package/dist/sankhyablocks/p-6d322b0a.js +1 -0
  229. package/dist/sankhyablocks/{p-7b3ca294.entry.js → p-7150eacf.entry.js} +1 -1
  230. package/dist/sankhyablocks/{p-825098c1.entry.js → p-752c57f4.entry.js} +1 -1
  231. package/dist/sankhyablocks/{p-49ddc27a.entry.js → p-752f4e29.entry.js} +1 -1
  232. package/dist/sankhyablocks/{p-e258de96.entry.js → p-76729994.entry.js} +1 -1
  233. package/dist/sankhyablocks/{p-7fc46290.js → p-7ee6b1bf.js} +1 -1
  234. package/dist/sankhyablocks/{p-27005fac.entry.js → p-877d9614.entry.js} +1 -1
  235. package/dist/sankhyablocks/p-8b4d6719.js +1 -0
  236. package/dist/sankhyablocks/{p-3d41f5a8.entry.js → p-8d946600.entry.js} +1 -1
  237. package/dist/sankhyablocks/{p-96d45943.entry.js → p-90ae6c2e.entry.js} +1 -1
  238. package/dist/sankhyablocks/p-94267a30.entry.js +1 -0
  239. package/dist/sankhyablocks/{p-59b8f277.js → p-998a9d6f.js} +1 -1
  240. package/dist/sankhyablocks/{p-21107f0d.entry.js → p-9c1ff75e.entry.js} +1 -1
  241. package/dist/sankhyablocks/{p-2fdac5e6.entry.js → p-9e109f5e.entry.js} +1 -1
  242. package/dist/sankhyablocks/{p-88ed2793.js → p-9e4555ab.js} +1 -1
  243. package/dist/sankhyablocks/p-a46ac091.js +1 -0
  244. package/dist/sankhyablocks/p-a73b6b00.js +1 -0
  245. package/dist/sankhyablocks/{p-164c822d.entry.js → p-acd2ba28.entry.js} +1 -1
  246. package/dist/sankhyablocks/{p-180716b2.entry.js → p-ae326d06.entry.js} +1 -1
  247. package/dist/sankhyablocks/p-b471bfab.entry.js +1 -0
  248. package/dist/sankhyablocks/p-b533edab.entry.js +1 -0
  249. package/dist/sankhyablocks/p-b555ce38.entry.js +1 -0
  250. package/dist/sankhyablocks/p-c2d33fc8.entry.js +1 -0
  251. package/dist/sankhyablocks/p-c3ec6642.js +19 -0
  252. package/dist/sankhyablocks/{p-91a9abb6.entry.js → p-c8043a53.entry.js} +1 -1
  253. package/dist/sankhyablocks/{p-c3dbf441.entry.js → p-cc64239c.entry.js} +1 -1
  254. package/dist/sankhyablocks/{p-b987e15d.js → p-cc9935af.js} +1 -1
  255. package/dist/sankhyablocks/{p-471b34f4.entry.js → p-cd00a3d1.entry.js} +1 -1
  256. package/dist/sankhyablocks/{p-b7e891cc.entry.js → p-cd40c8cf.entry.js} +1 -1
  257. package/dist/sankhyablocks/{p-bd203e8d.entry.js → p-cd412add.entry.js} +1 -1
  258. package/dist/sankhyablocks/{p-4c763b10.entry.js → p-d657f71f.entry.js} +1 -1
  259. package/dist/sankhyablocks/{p-e6b1c769.entry.js → p-d6dad5e4.entry.js} +1 -1
  260. package/dist/sankhyablocks/p-d714b6ca.js +1 -0
  261. package/dist/sankhyablocks/p-da455c82.js +12 -0
  262. package/dist/sankhyablocks/p-e30acdca.entry.js +1 -0
  263. package/dist/sankhyablocks/p-ec9027a7.entry.js +1 -0
  264. package/dist/sankhyablocks/p-ef9343c3.entry.js +1 -0
  265. package/dist/sankhyablocks/{p-667cab42.entry.js → p-f152ef98.entry.js} +1 -1
  266. package/dist/sankhyablocks/{p-7e250432.entry.js → p-f7170e10.entry.js} +1 -1
  267. package/dist/sankhyablocks/p-f8c5395a.entry.js +1 -0
  268. package/dist/sankhyablocks/{p-7345782c.entry.js → p-f921270b.entry.js} +1 -1
  269. package/dist/sankhyablocks/p-fa087ab2.entry.js +11 -0
  270. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  271. package/dist/types/components/snk-application/search-strategy/exec-prepared-search-advaced-mode.d.ts +5 -0
  272. package/dist/types/components/snk-application/snk-application.d.ts +9 -0
  273. package/dist/types/components/snk-crud/snk-crud.d.ts +22 -0
  274. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +23 -0
  275. package/dist/types/components/snk-custom-slot-guide/snk-custom-slot-guide.d.ts +16 -0
  276. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -0
  277. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +1 -0
  278. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +1 -1
  279. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +2 -1
  280. package/dist/types/components/snk-form-config/FormConfigHelper.d.ts +6 -1
  281. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +1 -1
  282. package/dist/types/components/snk-form-config/fields-layout/fields-layout.d.ts +2 -2
  283. package/dist/types/components/snk-form-config/guides-configurator/guides-configurator.d.ts +1 -1
  284. package/dist/types/components/snk-form-config/snk-form-config.d.ts +9 -2
  285. package/dist/types/components/snk-grid/snk-grid.d.ts +6 -0
  286. package/dist/types/components/snk-personalized-filter/interfaces/IParameter.d.ts +1 -0
  287. package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +8 -0
  288. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -1
  289. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +12 -4
  290. package/dist/types/components.d.ts +113 -0
  291. package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -0
  292. package/package.json +1 -1
  293. package/react/components.d.ts +1 -0
  294. package/react/components.js +1 -0
  295. package/react/components.js.map +1 -1
  296. package/dist/sankhyablocks/p-0cf9aa38.js +0 -1
  297. package/dist/sankhyablocks/p-11346b8d.entry.js +0 -1
  298. package/dist/sankhyablocks/p-1649f51e.entry.js +0 -1
  299. package/dist/sankhyablocks/p-1d585081.js +0 -1
  300. package/dist/sankhyablocks/p-3ed04f0d.entry.js +0 -1
  301. package/dist/sankhyablocks/p-4759912d.entry.js +0 -1
  302. package/dist/sankhyablocks/p-55798617.js +0 -1
  303. package/dist/sankhyablocks/p-56948f00.entry.js +0 -11
  304. package/dist/sankhyablocks/p-60dd1d27.entry.js +0 -1
  305. package/dist/sankhyablocks/p-626b7a17.js +0 -1
  306. package/dist/sankhyablocks/p-8f73da95.js +0 -1
  307. package/dist/sankhyablocks/p-95c71f5e.entry.js +0 -1
  308. package/dist/sankhyablocks/p-988afe78.js +0 -1
  309. package/dist/sankhyablocks/p-9f2cdaab.entry.js +0 -1
  310. package/dist/sankhyablocks/p-9fe91526.js +0 -1
  311. package/dist/sankhyablocks/p-a5108625.entry.js +0 -1
  312. package/dist/sankhyablocks/p-aae4258d.entry.js +0 -1
  313. package/dist/sankhyablocks/p-af9d79e0.entry.js +0 -1
  314. package/dist/sankhyablocks/p-bb0de89c.entry.js +0 -1
  315. package/dist/sankhyablocks/p-d8d8169b.js +0 -2
  316. package/dist/sankhyablocks/p-e64958ba.entry.js +0 -1
  317. package/dist/sankhyablocks/p-f25c50f7.entry.js +0 -1
  318. package/dist/sankhyablocks/p-f8f29e1a.entry.js +0 -1
@@ -1,4 +1,6 @@
1
1
  const NAMESPACE = 'sankhyablocks';
2
+ const BUILD = /* sankhyablocks */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: true, cmpShouldUpdate: true, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: true, connectedCallback: true, constructableCSS: true, cssAnnotations: true, cssVarShim: false, devTools: false, disconnectedCallback: true, dynamicImportShim: false, element: false, event: true, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: true, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: true, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: false, invisiblePrehydration: false, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, safari10: false, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, shadowDomShim: false, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
3
+ const Env = /* sankhyablocks */ {};
2
4
 
3
5
  /**
4
6
  * Virtual DOM patching algorithm based on Snabbdom by
@@ -11,26 +13,120 @@ const NAMESPACE = 'sankhyablocks';
11
13
  let scopeId;
12
14
  let contentRef;
13
15
  let hostTagName;
16
+ let customError;
17
+ let i = 0;
14
18
  let useNativeShadowDom = false;
15
19
  let checkSlotFallbackVisibility = false;
16
20
  let checkSlotRelocate = false;
17
21
  let isSvgMode = false;
18
22
  let renderingRef = null;
23
+ let queueCongestion = 0;
19
24
  let queuePending = false;
25
+ const Build = {
26
+ isDev: BUILD.isDev ? true : false,
27
+ isBrowser: true,
28
+ isServer: false,
29
+ isTesting: BUILD.isTesting ? true : false,
30
+ };
31
+ const Context = {};
32
+ const getAssetPath = (path) => {
33
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
34
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
35
+ };
36
+ const setAssetPath = (path) => (plt.$resourcesUrl$ = path);
20
37
  const createTime = (fnName, tagName = '') => {
21
- {
38
+ if (BUILD.profile && performance.mark) {
39
+ const key = `st:${fnName}:${tagName}:${i++}`;
40
+ // Start
41
+ performance.mark(key);
42
+ // End
43
+ return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
44
+ }
45
+ else {
22
46
  return () => {
23
47
  return;
24
48
  };
25
49
  }
26
50
  };
27
51
  const uniqueTime = (key, measureText) => {
28
- {
52
+ if (BUILD.profile && performance.mark) {
53
+ if (performance.getEntriesByName(key, 'mark').length === 0) {
54
+ performance.mark(key);
55
+ }
56
+ return () => {
57
+ if (performance.getEntriesByName(measureText, 'measure').length === 0) {
58
+ performance.measure(measureText, key);
59
+ }
60
+ };
61
+ }
62
+ else {
29
63
  return () => {
30
64
  return;
31
65
  };
32
66
  }
33
67
  };
68
+ const inspect = (ref) => {
69
+ const hostRef = getHostRef(ref);
70
+ if (!hostRef) {
71
+ return undefined;
72
+ }
73
+ const flags = hostRef.$flags$;
74
+ const hostElement = hostRef.$hostElement$;
75
+ return {
76
+ renderCount: hostRef.$renderCount$,
77
+ flags: {
78
+ hasRendered: !!(flags & 2 /* HOST_FLAGS.hasRendered */),
79
+ hasConnected: !!(flags & 1 /* HOST_FLAGS.hasConnected */),
80
+ isWaitingForChildren: !!(flags & 4 /* HOST_FLAGS.isWaitingForChildren */),
81
+ isConstructingInstance: !!(flags & 8 /* HOST_FLAGS.isConstructingInstance */),
82
+ isQueuedForUpdate: !!(flags & 16 /* HOST_FLAGS.isQueuedForUpdate */),
83
+ hasInitializedComponent: !!(flags & 32 /* HOST_FLAGS.hasInitializedComponent */),
84
+ hasLoadedComponent: !!(flags & 64 /* HOST_FLAGS.hasLoadedComponent */),
85
+ isWatchReady: !!(flags & 128 /* HOST_FLAGS.isWatchReady */),
86
+ isListenReady: !!(flags & 256 /* HOST_FLAGS.isListenReady */),
87
+ needsRerender: !!(flags & 512 /* HOST_FLAGS.needsRerender */),
88
+ },
89
+ instanceValues: hostRef.$instanceValues$,
90
+ ancestorComponent: hostRef.$ancestorComponent$,
91
+ hostElement,
92
+ lazyInstance: hostRef.$lazyInstance$,
93
+ vnode: hostRef.$vnode$,
94
+ modeName: hostRef.$modeName$,
95
+ onReadyPromise: hostRef.$onReadyPromise$,
96
+ onReadyResolve: hostRef.$onReadyResolve$,
97
+ onInstancePromise: hostRef.$onInstancePromise$,
98
+ onInstanceResolve: hostRef.$onInstanceResolve$,
99
+ onRenderResolve: hostRef.$onRenderResolve$,
100
+ queuedListeners: hostRef.$queuedListeners$,
101
+ rmListeners: hostRef.$rmListeners$,
102
+ ['s-id']: hostElement['s-id'],
103
+ ['s-cr']: hostElement['s-cr'],
104
+ ['s-lr']: hostElement['s-lr'],
105
+ ['s-p']: hostElement['s-p'],
106
+ ['s-rc']: hostElement['s-rc'],
107
+ ['s-sc']: hostElement['s-sc'],
108
+ };
109
+ };
110
+ const installDevTools = () => {
111
+ if (BUILD.devTools) {
112
+ const stencil = (win.stencil = win.stencil || {});
113
+ const originalInspect = stencil.inspect;
114
+ stencil.inspect = (ref) => {
115
+ let result = inspect(ref);
116
+ if (!result && typeof originalInspect === 'function') {
117
+ result = originalInspect(ref);
118
+ }
119
+ return result;
120
+ };
121
+ }
122
+ };
123
+ const CONTENT_REF_ID = 'r';
124
+ const ORG_LOCATION_ID = 'o';
125
+ const SLOT_NODE_ID = 's';
126
+ const TEXT_NODE_ID = 't';
127
+ const HYDRATE_ID = 's-id';
128
+ const HYDRATED_STYLE_ID = 'sty-id';
129
+ const HYDRATE_CHILD_ID = 'c-id';
34
130
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
35
131
  const XLINK_NS = 'http://www.w3.org/1999/xlink';
36
132
  /**
@@ -41,6 +137,11 @@ const XLINK_NS = 'http://www.w3.org/1999/xlink';
41
137
  * Don't add values to these!!
42
138
  */
43
139
  const EMPTY_OBJ = {};
140
+ /**
141
+ * Namespaces
142
+ */
143
+ const SVG_NS = 'http://www.w3.org/2000/svg';
144
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
44
145
  const isDef = (v) => v != null;
45
146
  const isComplexType = (o) => {
46
147
  // https://jsperf.com/typeof-fn-object/5
@@ -86,6 +187,11 @@ const h = (nodeName, vnodeData, ...children) => {
86
187
  if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
87
188
  child = String(child);
88
189
  }
190
+ else if (BUILD.isDev && typeof nodeName !== 'function' && child.$flags$ === undefined) {
191
+ consoleDevError(`vNode passed as children has unexpected type.
192
+ Make sure it's using the correct h() function.
193
+ Empty objects can also be the cause, look for JSX comments that became objects.`);
194
+ }
89
195
  if (simple && lastSimple) {
90
196
  // If the previous child was simple (string), we merge both
91
197
  vNodeChildren[vNodeChildren.length - 1].$text$ += child;
@@ -100,14 +206,17 @@ const h = (nodeName, vnodeData, ...children) => {
100
206
  };
101
207
  walk(children);
102
208
  if (vnodeData) {
209
+ if (BUILD.isDev && nodeName === 'input') {
210
+ validateInputProperties(vnodeData);
211
+ }
103
212
  // normalize class / classname attributes
104
- if (vnodeData.key) {
213
+ if (BUILD.vdomKey && vnodeData.key) {
105
214
  key = vnodeData.key;
106
215
  }
107
- if (vnodeData.name) {
216
+ if (BUILD.slotRelocation && vnodeData.name) {
108
217
  slotName = vnodeData.name;
109
218
  }
110
- {
219
+ if (BUILD.vdomClass) {
111
220
  const classData = vnodeData.className || vnodeData.class;
112
221
  if (classData) {
113
222
  vnodeData.class =
@@ -119,7 +228,12 @@ const h = (nodeName, vnodeData, ...children) => {
119
228
  }
120
229
  }
121
230
  }
122
- if (typeof nodeName === 'function') {
231
+ if (BUILD.isDev && vNodeChildren.some(isHost)) {
232
+ consoleDevError(`The <Host> must be the single root component. Make sure:
233
+ - You are NOT using hostData() and <Host> in the same component.
234
+ - <Host> is used once, and it's the single root component of the render() function.`);
235
+ }
236
+ if (BUILD.vdomFunctional && typeof nodeName === 'function') {
123
237
  // nodeName is a functional component
124
238
  return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
125
239
  }
@@ -128,10 +242,10 @@ const h = (nodeName, vnodeData, ...children) => {
128
242
  if (vNodeChildren.length > 0) {
129
243
  vnode.$children$ = vNodeChildren;
130
244
  }
131
- {
245
+ if (BUILD.vdomKey) {
132
246
  vnode.$key$ = key;
133
247
  }
134
- {
248
+ if (BUILD.slotRelocation) {
135
249
  vnode.$name$ = slotName;
136
250
  }
137
251
  return vnode;
@@ -152,13 +266,13 @@ const newVNode = (tag, text) => {
152
266
  $elm$: null,
153
267
  $children$: null,
154
268
  };
155
- {
269
+ if (BUILD.vdomAttribute) {
156
270
  vnode.$attrs$ = null;
157
271
  }
158
- {
272
+ if (BUILD.vdomKey) {
159
273
  vnode.$key$ = null;
160
274
  }
161
- {
275
+ if (BUILD.slotRelocation) {
162
276
  vnode.$name$ = null;
163
277
  }
164
278
  return vnode;
@@ -224,6 +338,235 @@ const convertToPrivate = (node) => {
224
338
  vnode.$name$ = node.vname;
225
339
  return vnode;
226
340
  };
341
+ /**
342
+ * Validates the ordering of attributes on an input element
343
+ *
344
+ * @param inputElm the element to validate
345
+ */
346
+ const validateInputProperties = (inputElm) => {
347
+ const props = Object.keys(inputElm);
348
+ const value = props.indexOf('value');
349
+ if (value === -1) {
350
+ return;
351
+ }
352
+ const typeIndex = props.indexOf('type');
353
+ const minIndex = props.indexOf('min');
354
+ const maxIndex = props.indexOf('max');
355
+ const stepIndex = props.indexOf('step');
356
+ if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
357
+ consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
358
+ }
359
+ };
360
+ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
361
+ const endHydrate = createTime('hydrateClient', tagName);
362
+ const shadowRoot = hostElm.shadowRoot;
363
+ const childRenderNodes = [];
364
+ const slotNodes = [];
365
+ const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
366
+ const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
367
+ if (!plt.$orgLocNodes$) {
368
+ initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
369
+ }
370
+ hostElm[HYDRATE_ID] = hostId;
371
+ hostElm.removeAttribute(HYDRATE_ID);
372
+ clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
373
+ childRenderNodes.map((c) => {
374
+ const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
375
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
376
+ const node = c.$elm$;
377
+ if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
378
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
379
+ }
380
+ if (!shadowRoot) {
381
+ node['s-hn'] = tagName;
382
+ if (orgLocationNode) {
383
+ node['s-ol'] = orgLocationNode;
384
+ node['s-ol']['s-nr'] = node;
385
+ }
386
+ }
387
+ plt.$orgLocNodes$.delete(orgLocationId);
388
+ });
389
+ if (BUILD.shadowDom && shadowRoot) {
390
+ shadowRootNodes.map((shadowRootNode) => {
391
+ if (shadowRootNode) {
392
+ shadowRoot.appendChild(shadowRootNode);
393
+ }
394
+ });
395
+ }
396
+ endHydrate();
397
+ };
398
+ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
399
+ let childNodeType;
400
+ let childIdSplt;
401
+ let childVNode;
402
+ let i;
403
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
404
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
405
+ if (childNodeType) {
406
+ // got the node data from the element's attribute
407
+ // `${hostId}.${nodeId}.${depth}.${index}`
408
+ childIdSplt = childNodeType.split('.');
409
+ if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
410
+ childVNode = {
411
+ $flags$: 0,
412
+ $hostId$: childIdSplt[0],
413
+ $nodeId$: childIdSplt[1],
414
+ $depth$: childIdSplt[2],
415
+ $index$: childIdSplt[3],
416
+ $tag$: node.tagName.toLowerCase(),
417
+ $elm$: node,
418
+ $attrs$: null,
419
+ $children$: null,
420
+ $key$: null,
421
+ $name$: null,
422
+ $text$: null,
423
+ };
424
+ childRenderNodes.push(childVNode);
425
+ node.removeAttribute(HYDRATE_CHILD_ID);
426
+ // this is a new child vnode
427
+ // so ensure its parent vnode has the vchildren array
428
+ if (!parentVNode.$children$) {
429
+ parentVNode.$children$ = [];
430
+ }
431
+ // add our child vnode to a specific index of the vnode's children
432
+ parentVNode.$children$[childVNode.$index$] = childVNode;
433
+ // this is now the new parent vnode for all the next child checks
434
+ parentVNode = childVNode;
435
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
436
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
437
+ }
438
+ }
439
+ }
440
+ // recursively drill down, end to start so we can remove nodes
441
+ for (i = node.childNodes.length - 1; i >= 0; i--) {
442
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
443
+ }
444
+ if (node.shadowRoot) {
445
+ // keep drilling down through the shadow root nodes
446
+ for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
447
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
448
+ }
449
+ }
450
+ }
451
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
452
+ // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
453
+ childIdSplt = node.nodeValue.split('.');
454
+ if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
455
+ // comment node for either the host id or a 0 host id
456
+ childNodeType = childIdSplt[0];
457
+ childVNode = {
458
+ $flags$: 0,
459
+ $hostId$: childIdSplt[1],
460
+ $nodeId$: childIdSplt[2],
461
+ $depth$: childIdSplt[3],
462
+ $index$: childIdSplt[4],
463
+ $elm$: node,
464
+ $attrs$: null,
465
+ $children$: null,
466
+ $key$: null,
467
+ $name$: null,
468
+ $tag$: null,
469
+ $text$: null,
470
+ };
471
+ if (childNodeType === TEXT_NODE_ID) {
472
+ childVNode.$elm$ = node.nextSibling;
473
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
474
+ childVNode.$text$ = childVNode.$elm$.textContent;
475
+ childRenderNodes.push(childVNode);
476
+ // remove the text comment since it's no longer needed
477
+ node.remove();
478
+ if (!parentVNode.$children$) {
479
+ parentVNode.$children$ = [];
480
+ }
481
+ parentVNode.$children$[childVNode.$index$] = childVNode;
482
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
483
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
484
+ }
485
+ }
486
+ }
487
+ else if (childVNode.$hostId$ === hostId) {
488
+ // this comment node is specifcally for this host id
489
+ if (childNodeType === SLOT_NODE_ID) {
490
+ // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
491
+ childVNode.$tag$ = 'slot';
492
+ if (childIdSplt[5]) {
493
+ node['s-sn'] = childVNode.$name$ = childIdSplt[5];
494
+ }
495
+ else {
496
+ node['s-sn'] = '';
497
+ }
498
+ node['s-sr'] = true;
499
+ if (BUILD.shadowDom && shadowRootNodes) {
500
+ // browser support shadowRoot and this is a shadow dom component
501
+ // create an actual slot element
502
+ childVNode.$elm$ = doc.createElement(childVNode.$tag$);
503
+ if (childVNode.$name$) {
504
+ // add the slot name attribute
505
+ childVNode.$elm$.setAttribute('name', childVNode.$name$);
506
+ }
507
+ // insert the new slot element before the slot comment
508
+ node.parentNode.insertBefore(childVNode.$elm$, node);
509
+ // remove the slot comment since it's not needed for shadow
510
+ node.remove();
511
+ if (childVNode.$depth$ === '0') {
512
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
513
+ }
514
+ }
515
+ slotNodes.push(childVNode);
516
+ if (!parentVNode.$children$) {
517
+ parentVNode.$children$ = [];
518
+ }
519
+ parentVNode.$children$[childVNode.$index$] = childVNode;
520
+ }
521
+ else if (childNodeType === CONTENT_REF_ID) {
522
+ // `${CONTENT_REF_ID}.${hostId}`;
523
+ if (BUILD.shadowDom && shadowRootNodes) {
524
+ // remove the content ref comment since it's not needed for shadow
525
+ node.remove();
526
+ }
527
+ else if (BUILD.slotRelocation) {
528
+ hostElm['s-cr'] = node;
529
+ node['s-cn'] = true;
530
+ }
531
+ }
532
+ }
533
+ }
534
+ }
535
+ else if (parentVNode && parentVNode.$tag$ === 'style') {
536
+ const vnode = newVNode(null, node.textContent);
537
+ vnode.$elm$ = node;
538
+ vnode.$index$ = '0';
539
+ parentVNode.$children$ = [vnode];
540
+ }
541
+ };
542
+ const initializeDocumentHydrate = (node, orgLocNodes) => {
543
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
544
+ let i = 0;
545
+ for (; i < node.childNodes.length; i++) {
546
+ initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
547
+ }
548
+ if (node.shadowRoot) {
549
+ for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
550
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
551
+ }
552
+ }
553
+ }
554
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
555
+ const childIdSplt = node.nodeValue.split('.');
556
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
557
+ orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
558
+ node.nodeValue = '';
559
+ // useful to know if the original location is
560
+ // the root light-dom of a shadow dom component
561
+ node['s-en'] = childIdSplt[3];
562
+ }
563
+ }
564
+ };
565
+ // Private
566
+ const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
567
+ // Public
568
+ const setMode = (handler) => modeResolutionChain.push(handler);
569
+ const getMode = (ref) => getHostRef(ref).$modeName$;
227
570
  /**
228
571
  * Parse a new property value for a given property type.
229
572
  *
@@ -250,16 +593,16 @@ const convertToPrivate = (node) => {
250
593
  const parsePropertyValue = (propValue, propType) => {
251
594
  // ensure this value is of the correct prop type
252
595
  if (propValue != null && !isComplexType(propValue)) {
253
- if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
596
+ if (BUILD.propBoolean && propType & 4 /* MEMBER_FLAGS.Boolean */) {
254
597
  // per the HTML spec, any string value means it is a boolean true value
255
598
  // but we'll cheat here and say that the string "false" is the boolean false
256
599
  return propValue === 'false' ? false : propValue === '' || !!propValue;
257
600
  }
258
- if (propType & 2 /* MEMBER_FLAGS.Number */) {
601
+ if (BUILD.propNumber && propType & 2 /* MEMBER_FLAGS.Number */) {
259
602
  // force it to be a number
260
603
  return parseFloat(propValue);
261
604
  }
262
- if (propType & 1 /* MEMBER_FLAGS.String */) {
605
+ if (BUILD.propString && propType & 1 /* MEMBER_FLAGS.String */) {
263
606
  // could have been passed as a number or boolean
264
607
  // but we still want it as a string
265
608
  return String(propValue);
@@ -271,11 +614,14 @@ const parsePropertyValue = (propValue, propType) => {
271
614
  // so no need to change to a different type
272
615
  return propValue;
273
616
  };
274
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
617
+ const getElement = (ref) => (BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref);
275
618
  const createEvent = (ref, name, flags) => {
276
619
  const elm = getElement(ref);
277
620
  return {
278
621
  emit: (detail) => {
622
+ if (BUILD.isDev && !elm.isConnected) {
623
+ consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
624
+ }
279
625
  return emitEvent(elm, name, {
280
626
  bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
281
627
  composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
@@ -316,8 +662,11 @@ const registerStyle = (scopeId, cssText, allowCS) => {
316
662
  };
317
663
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
318
664
  var _a;
319
- let scopeId = getScopeId(cmpMeta);
665
+ let scopeId = getScopeId(cmpMeta, mode);
320
666
  const style = styles.get(scopeId);
667
+ if (!BUILD.attachStyles) {
668
+ return scopeId;
669
+ }
321
670
  // if an element is NOT connected then getRootNode() will return the wrong root node
322
671
  // so the fallback is to always use the document for the root node in those cases
323
672
  styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
@@ -330,8 +679,25 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
330
679
  rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
331
680
  }
332
681
  if (!appliedStyles.has(scopeId)) {
333
- {
334
- {
682
+ if (BUILD.hydrateClientSide &&
683
+ styleContainerNode.host &&
684
+ (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
685
+ // This is only happening on native shadow-dom, do not needs CSS var shim
686
+ styleElm.innerHTML = style;
687
+ }
688
+ else {
689
+ if (BUILD.cssVarShim && plt.$cssShim$) {
690
+ styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* CMP_FLAGS.needsScopedEncapsulation */));
691
+ const newScopeId = styleElm['s-sc'];
692
+ if (newScopeId) {
693
+ scopeId = newScopeId;
694
+ // we don't want to add this styleID to the appliedStyles Set
695
+ // since the cssVarShim might need to apply several different
696
+ // stylesheets for the same component
697
+ appliedStyles = null;
698
+ }
699
+ }
700
+ else {
335
701
  styleElm = doc.createElement('style');
336
702
  styleElm.innerHTML = style;
337
703
  }
@@ -340,6 +706,9 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
340
706
  if (nonce != null) {
341
707
  styleElm.setAttribute('nonce', nonce);
342
708
  }
709
+ if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
710
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
711
+ }
343
712
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
344
713
  }
345
714
  if (appliedStyles) {
@@ -347,7 +716,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
347
716
  }
348
717
  }
349
718
  }
350
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
719
+ else if (BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
351
720
  styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
352
721
  }
353
722
  }
@@ -358,8 +727,8 @@ const attachStyles = (hostRef) => {
358
727
  const elm = hostRef.$hostElement$;
359
728
  const flags = cmpMeta.$flags$;
360
729
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
361
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
362
- if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
730
+ const scopeId = addStyle(BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
731
+ if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
363
732
  // only required when we're NOT using native shadow dom (slot)
364
733
  // or this browser doesn't support native shadow dom
365
734
  // and this host element was NOT created with SSR
@@ -369,13 +738,14 @@ const attachStyles = (hostRef) => {
369
738
  // DOM WRITE!!
370
739
  elm['s-sc'] = scopeId;
371
740
  elm.classList.add(scopeId + '-h');
372
- if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
741
+ if (BUILD.scoped && flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
373
742
  elm.classList.add(scopeId + '-s');
374
743
  }
375
744
  }
376
745
  endAttachStyles();
377
746
  };
378
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
747
+ const getScopeId = (cmp, mode) => 'sc-' + (BUILD.mode && mode && cmp.$flags$ & 32 /* CMP_FLAGS.hasMode */ ? cmp.$tagName$ + '-' + mode : cmp.$tagName$);
748
+ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
379
749
  /**
380
750
  * Production setAccessor() function based on Preact by
381
751
  * Jason Miller (@developit)
@@ -388,19 +758,19 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
388
758
  if (oldValue !== newValue) {
389
759
  let isProp = isMemberInElement(elm, memberName);
390
760
  let ln = memberName.toLowerCase();
391
- if (memberName === 'class') {
761
+ if (BUILD.vdomClass && memberName === 'class') {
392
762
  const classList = elm.classList;
393
763
  const oldClasses = parseClassList(oldValue);
394
764
  const newClasses = parseClassList(newValue);
395
765
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
396
766
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
397
767
  }
398
- else if (memberName === 'style') {
768
+ else if (BUILD.vdomStyle && memberName === 'style') {
399
769
  // update style attribute, css properties and values
400
- {
770
+ if (BUILD.updatable) {
401
771
  for (const prop in oldValue) {
402
772
  if (!newValue || newValue[prop] == null) {
403
- if (prop.includes('-')) {
773
+ if (!BUILD.hydrateServerSide && prop.includes('-')) {
404
774
  elm.style.removeProperty(prop);
405
775
  }
406
776
  else {
@@ -411,7 +781,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
411
781
  }
412
782
  for (const prop in newValue) {
413
783
  if (!oldValue || newValue[prop] !== oldValue[prop]) {
414
- if (prop.includes('-')) {
784
+ if (!BUILD.hydrateServerSide && prop.includes('-')) {
415
785
  elm.style.setProperty(prop, newValue[prop]);
416
786
  }
417
787
  else {
@@ -420,15 +790,16 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
420
790
  }
421
791
  }
422
792
  }
423
- else if (memberName === 'key')
793
+ else if (BUILD.vdomKey && memberName === 'key')
424
794
  ;
425
- else if (memberName === 'ref') {
795
+ else if (BUILD.vdomRef && memberName === 'ref') {
426
796
  // minifier will clean this up
427
797
  if (newValue) {
428
798
  newValue(elm);
429
799
  }
430
800
  }
431
- else if ((!isProp ) &&
801
+ else if (BUILD.vdomListener &&
802
+ (BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) &&
432
803
  memberName[0] === 'o' &&
433
804
  memberName[1] === 'n') {
434
805
  // Event Handlers
@@ -467,7 +838,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
467
838
  plt.ael(elm, memberName, newValue, false);
468
839
  }
469
840
  }
470
- else {
841
+ else if (BUILD.vdomPropOrAttr) {
471
842
  // Set property if it exists and it's not a SVG
472
843
  const isComplex = isComplexType(newValue);
473
844
  if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
@@ -496,7 +867,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
496
867
  * - if the newValue is null/undefined or 'false'.
497
868
  */
498
869
  let xlink = false;
499
- {
870
+ if (BUILD.vdomXlink) {
500
871
  if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
501
872
  memberName = ln;
502
873
  xlink = true;
@@ -504,7 +875,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
504
875
  }
505
876
  if (newValue == null || newValue === false) {
506
877
  if (newValue !== false || elm.getAttribute(memberName) === '') {
507
- if (xlink) {
878
+ if (BUILD.vdomXlink && xlink) {
508
879
  elm.removeAttributeNS(XLINK_NS, memberName);
509
880
  }
510
881
  else {
@@ -514,7 +885,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
514
885
  }
515
886
  else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
516
887
  newValue = newValue === true ? '' : newValue;
517
- if (xlink) {
888
+ if (BUILD.vdomXlink && xlink) {
518
889
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
519
890
  }
520
891
  else {
@@ -535,7 +906,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
535
906
  : newVnode.$elm$;
536
907
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
537
908
  const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
538
- {
909
+ if (BUILD.updatable) {
539
910
  // remove attributes no longer present on the vnode by setting them to undefined
540
911
  for (memberName in oldVnodeAttrs) {
541
912
  if (!(memberName in newVnodeAttrs)) {
@@ -565,7 +936,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
565
936
  let elm;
566
937
  let childNode;
567
938
  let oldVNode;
568
- if (!useNativeShadowDom) {
939
+ if (BUILD.slotRelocation && !useNativeShadowDom) {
569
940
  // remember for later we need to check to relocate nodes
570
941
  checkSlotRelocate = true;
571
942
  if (newVNode.$tag$ === 'slot') {
@@ -580,25 +951,38 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
580
951
  1 /* VNODE_FLAGS.isSlotReference */;
581
952
  }
582
953
  }
583
- if (newVNode.$text$ !== null) {
954
+ if (BUILD.isDev && newVNode.$elm$) {
955
+ consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${newVNode.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
956
+ }
957
+ if (BUILD.vdomText && newVNode.$text$ !== null) {
584
958
  // create text node
585
959
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
586
960
  }
587
- else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
961
+ else if (BUILD.slotRelocation && newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
588
962
  // create a slot reference node
589
963
  elm = newVNode.$elm$ =
590
- doc.createTextNode('');
964
+ BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : doc.createTextNode('');
591
965
  }
592
966
  else {
967
+ if (BUILD.svg && !isSvgMode) {
968
+ isSvgMode = newVNode.$tag$ === 'svg';
969
+ }
593
970
  // create element
594
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
971
+ elm = newVNode.$elm$ = (BUILD.svg
972
+ ? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
973
+ ? 'slot-fb'
974
+ : newVNode.$tag$)
975
+ : doc.createElement(BUILD.slotRelocation && newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
595
976
  ? 'slot-fb'
596
977
  : newVNode.$tag$));
978
+ if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
979
+ isSvgMode = false;
980
+ }
597
981
  // add css classes, attrs, props, listeners, etc.
598
- {
982
+ if (BUILD.vdomAttribute) {
599
983
  updateElement(null, newVNode, isSvgMode);
600
984
  }
601
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
985
+ if ((BUILD.shadowDom || BUILD.scoped) && isDef(scopeId) && elm['s-si'] !== scopeId) {
602
986
  // if there is a scopeId and this is the initial render
603
987
  // then let's add the scopeId as a css class
604
988
  elm.classList.add((elm['s-si'] = scopeId));
@@ -614,8 +998,18 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
614
998
  }
615
999
  }
616
1000
  }
1001
+ if (BUILD.svg) {
1002
+ if (newVNode.$tag$ === 'svg') {
1003
+ // Only reset the SVG context when we're exiting <svg> element
1004
+ isSvgMode = false;
1005
+ }
1006
+ else if (elm.tagName === 'foreignObject') {
1007
+ // Reenter SVG context when we're exiting <foreignObject> element
1008
+ isSvgMode = true;
1009
+ }
1010
+ }
617
1011
  }
618
- {
1012
+ if (BUILD.slotRelocation) {
619
1013
  elm['s-hn'] = hostTagName;
620
1014
  if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
621
1015
  // remember the content reference comment
@@ -675,9 +1069,9 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
675
1069
  * creating DOM nodes (inclusive)
676
1070
  */
677
1071
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
678
- let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
1072
+ let containerElm = ((BUILD.slotRelocation && parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
679
1073
  let childNode;
680
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
1074
+ if (BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
681
1075
  containerElm = containerElm.shadowRoot;
682
1076
  }
683
1077
  for (; startIdx <= endIdx; ++startIdx) {
@@ -685,7 +1079,7 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
685
1079
  childNode = createElm(null, parentVNode, startIdx, parentElm);
686
1080
  if (childNode) {
687
1081
  vnodes[startIdx].$elm$ = childNode;
688
- containerElm.insertBefore(childNode, referenceNode(before) );
1082
+ containerElm.insertBefore(childNode, BUILD.slotRelocation ? referenceNode(before) : before);
689
1083
  }
690
1084
  }
691
1085
  }
@@ -708,7 +1102,7 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
708
1102
  if ((vnode = vnodes[startIdx])) {
709
1103
  elm = vnode.$elm$;
710
1104
  callNodeRefs(vnode);
711
- {
1105
+ if (BUILD.slotRelocation) {
712
1106
  // we're removing this element
713
1107
  // so it's possible we need to show slot fallback content now
714
1108
  checkSlotFallbackVisibility = true;
@@ -854,7 +1248,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
854
1248
  //
855
1249
  // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
856
1250
  // and move the DOM element for `oldStartVnode`.
857
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1251
+ if (BUILD.slotRelocation && (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
858
1252
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
859
1253
  }
860
1254
  patch(oldStartVnode, newEndVnode);
@@ -895,7 +1289,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
895
1289
  // (which will handle updating any changed attributes, reconciling their
896
1290
  // children etc) but we also need to move the DOM node to which
897
1291
  // `oldEndVnode` corresponds.
898
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1292
+ if (BUILD.slotRelocation && (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
899
1293
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
900
1294
  }
901
1295
  patch(oldEndVnode, newStartVnode);
@@ -918,7 +1312,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
918
1312
  // children which have the same key as the first node in the new
919
1313
  // children.
920
1314
  idxInOld = -1;
921
- {
1315
+ if (BUILD.vdomKey) {
922
1316
  for (i = oldStartIdx; i <= oldEndIdx; ++i) {
923
1317
  if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
924
1318
  idxInOld = i;
@@ -926,7 +1320,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
926
1320
  }
927
1321
  }
928
1322
  }
929
- if (idxInOld >= 0) {
1323
+ if (BUILD.vdomKey && idxInOld >= 0) {
930
1324
  // We found a node in the old children which matches up with the first
931
1325
  // node in the new children! So let's deal with that
932
1326
  elmToMove = oldCh[idxInOld];
@@ -953,9 +1347,12 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
953
1347
  }
954
1348
  if (node) {
955
1349
  // if we created a new node then handle inserting it to the DOM
956
- {
1350
+ if (BUILD.slotRelocation) {
957
1351
  parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
958
1352
  }
1353
+ else {
1354
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
1355
+ }
959
1356
  }
960
1357
  }
961
1358
  }
@@ -963,7 +1360,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
963
1360
  // we have some more new nodes to add which don't match up with old nodes
964
1361
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
965
1362
  }
966
- else if (newStartIdx > newEndIdx) {
1363
+ else if (BUILD.updatable && newStartIdx > newEndIdx) {
967
1364
  // there are nodes in the `oldCh` array which no longer correspond to nodes
968
1365
  // in the new array, so lets remove them (which entails cleaning up the
969
1366
  // relevant DOM nodes)
@@ -992,13 +1389,14 @@ const isSameVnode = (leftVNode, rightVNode) => {
992
1389
  // compare if two vnode to see if they're "technically" the same
993
1390
  // need to have the same element tag, and same key to be the same
994
1391
  if (leftVNode.$tag$ === rightVNode.$tag$) {
995
- if (leftVNode.$tag$ === 'slot') {
1392
+ if (BUILD.slotRelocation && leftVNode.$tag$ === 'slot') {
996
1393
  return leftVNode.$name$ === rightVNode.$name$;
997
1394
  }
998
1395
  // this will be set if components in the build have `key` attrs set on them
999
- {
1396
+ if (BUILD.vdomKey) {
1000
1397
  return leftVNode.$key$ === rightVNode.$key$;
1001
1398
  }
1399
+ return true;
1002
1400
  }
1003
1401
  return false;
1004
1402
  };
@@ -1025,9 +1423,14 @@ const patch = (oldVNode, newVNode) => {
1025
1423
  const tag = newVNode.$tag$;
1026
1424
  const text = newVNode.$text$;
1027
1425
  let defaultHolder;
1028
- if (text === null) {
1029
- {
1030
- if (tag === 'slot')
1426
+ if (!BUILD.vdomText || text === null) {
1427
+ if (BUILD.svg) {
1428
+ // test if we're rendering an svg element, or still rendering nodes inside of one
1429
+ // only add this to the when the compiler sees we're using an svg somewhere
1430
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1431
+ }
1432
+ if (BUILD.vdomAttribute || BUILD.reflect) {
1433
+ if (BUILD.slot && tag === 'slot')
1031
1434
  ;
1032
1435
  else {
1033
1436
  // either this is the first render of an element OR it's an update
@@ -1036,30 +1439,33 @@ const patch = (oldVNode, newVNode) => {
1036
1439
  updateElement(oldVNode, newVNode, isSvgMode);
1037
1440
  }
1038
1441
  }
1039
- if (oldChildren !== null && newChildren !== null) {
1442
+ if (BUILD.updatable && oldChildren !== null && newChildren !== null) {
1040
1443
  // looks like there's child vnodes for both the old and new vnodes
1041
1444
  // so we need to call `updateChildren` to reconcile them
1042
1445
  updateChildren(elm, oldChildren, newVNode, newChildren);
1043
1446
  }
1044
1447
  else if (newChildren !== null) {
1045
1448
  // no old child vnodes, but there are new child vnodes to add
1046
- if (oldVNode.$text$ !== null) {
1449
+ if (BUILD.updatable && BUILD.vdomText && oldVNode.$text$ !== null) {
1047
1450
  // the old vnode was text, so be sure to clear it out
1048
1451
  elm.textContent = '';
1049
1452
  }
1050
1453
  // add the new vnode children
1051
1454
  addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1052
1455
  }
1053
- else if (oldChildren !== null) {
1456
+ else if (BUILD.updatable && oldChildren !== null) {
1054
1457
  // no new child vnodes, but there are old child vnodes to remove
1055
1458
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
1056
1459
  }
1460
+ if (BUILD.svg && isSvgMode && tag === 'svg') {
1461
+ isSvgMode = false;
1462
+ }
1057
1463
  }
1058
- else if ((defaultHolder = elm['s-cr'])) {
1464
+ else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm['s-cr'])) {
1059
1465
  // this element has slotted content
1060
1466
  defaultHolder.parentNode.textContent = text;
1061
1467
  }
1062
- else if (oldVNode.$text$ !== text) {
1468
+ else if (BUILD.vdomText && oldVNode.$text$ !== text) {
1063
1469
  // update the text content for the text only vnode
1064
1470
  // and also only if the text is different than before
1065
1471
  elm.data = text;
@@ -1197,7 +1603,7 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1197
1603
  return slotNameAttr === '';
1198
1604
  };
1199
1605
  const callNodeRefs = (vNode) => {
1200
- {
1606
+ if (BUILD.vdomRef) {
1201
1607
  vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1202
1608
  vNode.$children$ && vNode.$children$.map(callNodeRefs);
1203
1609
  }
@@ -1220,26 +1626,41 @@ const renderVdom = (hostRef, renderFnResults) => {
1220
1626
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1221
1627
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1222
1628
  hostTagName = hostElm.tagName;
1223
- if (cmpMeta.$attrsToReflect$) {
1629
+ // <Host> runtime check
1630
+ if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
1631
+ throw new Error(`The <Host> must be the single root component.
1632
+ Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1633
+
1634
+ The render() function should look like this instead:
1635
+
1636
+ render() {
1637
+ // Do not return an array
1638
+ return (
1639
+ <Host>{content}</Host>
1640
+ );
1641
+ }
1642
+ `);
1643
+ }
1644
+ if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
1224
1645
  rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1225
1646
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1226
1647
  }
1227
1648
  rootVnode.$tag$ = null;
1228
1649
  rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1229
1650
  hostRef.$vnode$ = rootVnode;
1230
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1231
- {
1651
+ rootVnode.$elm$ = oldVNode.$elm$ = (BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm);
1652
+ if (BUILD.scoped || BUILD.shadowDom) {
1232
1653
  scopeId = hostElm['s-sc'];
1233
1654
  }
1234
- {
1655
+ if (BUILD.slotRelocation) {
1235
1656
  contentRef = hostElm['s-cr'];
1236
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1657
+ useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1237
1658
  // always reset
1238
1659
  checkSlotFallbackVisibility = false;
1239
1660
  }
1240
1661
  // synchronous patch
1241
1662
  patch(oldVNode, rootVnode);
1242
- {
1663
+ if (BUILD.slotRelocation) {
1243
1664
  // while we're moving nodes around existing nodes, temporarily disable
1244
1665
  // the disconnectCallback from working
1245
1666
  plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
@@ -1259,7 +1680,9 @@ const renderVdom = (hostRef, renderFnResults) => {
1259
1680
  // add a reference node marking this node's original location
1260
1681
  // keep a reference to this node for later lookups
1261
1682
  orgLocationNode =
1262
- doc.createTextNode('');
1683
+ BUILD.isDebug || BUILD.hydrateServerSide
1684
+ ? originalLocationDebugNode(nodeToRelocate)
1685
+ : doc.createTextNode('');
1263
1686
  orgLocationNode['s-nr'] = nodeToRelocate;
1264
1687
  nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1265
1688
  }
@@ -1316,16 +1739,23 @@ const renderVdom = (hostRef, renderFnResults) => {
1316
1739
  relocateNodes.length = 0;
1317
1740
  }
1318
1741
  };
1742
+ // slot comment debug nodes only created with the `--debug` flag
1743
+ // otherwise these nodes are text nodes w/out content
1744
+ const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ''}> (host=${hostTagName.toLowerCase()})`);
1745
+ const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
1746
+ (nodeToRelocate.localName
1747
+ ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})`
1748
+ : `[${nodeToRelocate.textContent}]`));
1319
1749
  const attachToAncestor = (hostRef, ancestorComponent) => {
1320
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1750
+ if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1321
1751
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1322
1752
  }
1323
1753
  };
1324
1754
  const scheduleUpdate = (hostRef, isInitialLoad) => {
1325
- {
1755
+ if (BUILD.taskQueue && BUILD.updatable) {
1326
1756
  hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1327
1757
  }
1328
- if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1758
+ if (BUILD.asyncLoading && hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1329
1759
  hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1330
1760
  return;
1331
1761
  }
@@ -1334,30 +1764,34 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
1334
1764
  // has already fired off its lifecycle update then
1335
1765
  // fire off the initial update
1336
1766
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1337
- return writeTask(dispatch) ;
1767
+ return BUILD.taskQueue ? writeTask(dispatch) : dispatch();
1338
1768
  };
1339
1769
  const dispatchHooks = (hostRef, isInitialLoad) => {
1770
+ const elm = hostRef.$hostElement$;
1340
1771
  const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1341
- const instance = hostRef.$lazyInstance$ ;
1772
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1342
1773
  let promise;
1343
1774
  if (isInitialLoad) {
1344
- {
1775
+ if (BUILD.lazyLoad && BUILD.hostListener) {
1345
1776
  hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1346
1777
  if (hostRef.$queuedListeners$) {
1347
1778
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1348
1779
  hostRef.$queuedListeners$ = null;
1349
1780
  }
1350
1781
  }
1351
- {
1782
+ emitLifecycleEvent(elm, 'componentWillLoad');
1783
+ if (BUILD.cmpWillLoad) {
1352
1784
  promise = safeCall(instance, 'componentWillLoad');
1353
1785
  }
1354
1786
  }
1355
1787
  else {
1356
- {
1788
+ emitLifecycleEvent(elm, 'componentWillUpdate');
1789
+ if (BUILD.cmpWillUpdate) {
1357
1790
  promise = safeCall(instance, 'componentWillUpdate');
1358
1791
  }
1359
1792
  }
1360
- {
1793
+ emitLifecycleEvent(elm, 'componentWillRender');
1794
+ if (BUILD.cmpWillRender) {
1361
1795
  promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1362
1796
  }
1363
1797
  endSchedule();
@@ -1368,15 +1802,46 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1368
1802
  const elm = hostRef.$hostElement$;
1369
1803
  const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1370
1804
  const rc = elm['s-rc'];
1371
- if (isInitialLoad) {
1805
+ if (BUILD.style && isInitialLoad) {
1372
1806
  // DOM WRITE!
1373
1807
  attachStyles(hostRef);
1374
1808
  }
1375
1809
  const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1376
- {
1377
- callRender(hostRef, instance);
1810
+ if (BUILD.isDev) {
1811
+ hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
1812
+ }
1813
+ if (BUILD.hydrateServerSide) {
1814
+ await callRender(hostRef, instance, elm);
1815
+ }
1816
+ else {
1817
+ callRender(hostRef, instance, elm);
1818
+ }
1819
+ if (BUILD.cssVarShim && plt.$cssShim$) {
1820
+ plt.$cssShim$.updateHost(elm);
1821
+ }
1822
+ if (BUILD.isDev) {
1823
+ hostRef.$renderCount$++;
1824
+ hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
1825
+ }
1826
+ if (BUILD.hydrateServerSide) {
1827
+ try {
1828
+ // manually connected child components during server-side hydrate
1829
+ serverSideConnected(elm);
1830
+ if (isInitialLoad) {
1831
+ // using only during server-side hydrate
1832
+ if (hostRef.$cmpMeta$.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1833
+ elm['s-en'] = '';
1834
+ }
1835
+ else if (hostRef.$cmpMeta$.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
1836
+ elm['s-en'] = 'c';
1837
+ }
1838
+ }
1839
+ }
1840
+ catch (e) {
1841
+ consoleError(e, elm);
1842
+ }
1378
1843
  }
1379
- if (rc) {
1844
+ if (BUILD.asyncLoading && rc) {
1380
1845
  // ok, so turns out there are some child host elements
1381
1846
  // waiting on this parent element to load
1382
1847
  // let's fire off all update callbacks waiting
@@ -1385,7 +1850,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1385
1850
  }
1386
1851
  endRender();
1387
1852
  endUpdate();
1388
- {
1853
+ if (BUILD.asyncLoading) {
1389
1854
  const childrenPromises = elm['s-p'];
1390
1855
  const postUpdate = () => postUpdateComponent(hostRef);
1391
1856
  if (childrenPromises.length === 0) {
@@ -1397,26 +1862,42 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1397
1862
  childrenPromises.length = 0;
1398
1863
  }
1399
1864
  }
1865
+ else {
1866
+ postUpdateComponent(hostRef);
1867
+ }
1400
1868
  };
1401
1869
  const callRender = (hostRef, instance, elm) => {
1870
+ // in order for bundlers to correctly treeshake the BUILD object
1871
+ // we need to ensure BUILD is not deoptimized within a try/catch
1872
+ // https://rollupjs.org/guide/en/#treeshake tryCatchDeoptimization
1873
+ const allRenderFn = BUILD.allRenderFn ? true : false;
1874
+ const lazyLoad = BUILD.lazyLoad ? true : false;
1875
+ const taskQueue = BUILD.taskQueue ? true : false;
1876
+ const updatable = BUILD.updatable ? true : false;
1402
1877
  try {
1403
1878
  renderingRef = instance;
1404
- instance = instance.render() ;
1405
- {
1879
+ instance = allRenderFn ? instance.render() : instance.render && instance.render();
1880
+ if (updatable && taskQueue) {
1406
1881
  hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1407
1882
  }
1408
- {
1883
+ if (updatable || lazyLoad) {
1409
1884
  hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1410
1885
  }
1411
- {
1412
- {
1886
+ if (BUILD.hasRenderFn || BUILD.reflect) {
1887
+ if (BUILD.vdomRender || BUILD.reflect) {
1413
1888
  // looks like we've got child nodes to render into this host element
1414
1889
  // or we need to update the css class/attrs on the host element
1415
1890
  // DOM WRITE!
1416
- {
1891
+ if (BUILD.hydrateServerSide) {
1892
+ return Promise.resolve(instance).then((value) => renderVdom(hostRef, value));
1893
+ }
1894
+ else {
1417
1895
  renderVdom(hostRef, instance);
1418
1896
  }
1419
1897
  }
1898
+ else {
1899
+ elm.textContent = instance;
1900
+ }
1420
1901
  }
1421
1902
  }
1422
1903
  catch (e) {
@@ -1430,40 +1911,68 @@ const postUpdateComponent = (hostRef) => {
1430
1911
  const tagName = hostRef.$cmpMeta$.$tagName$;
1431
1912
  const elm = hostRef.$hostElement$;
1432
1913
  const endPostUpdate = createTime('postUpdate', tagName);
1433
- const instance = hostRef.$lazyInstance$ ;
1914
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1434
1915
  const ancestorComponent = hostRef.$ancestorComponent$;
1435
- {
1916
+ if (BUILD.cmpDidRender) {
1917
+ if (BUILD.isDev) {
1918
+ hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
1919
+ }
1436
1920
  safeCall(instance, 'componentDidRender');
1921
+ if (BUILD.isDev) {
1922
+ hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
1923
+ }
1437
1924
  }
1925
+ emitLifecycleEvent(elm, 'componentDidRender');
1438
1926
  if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1439
1927
  hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1440
- {
1928
+ if (BUILD.asyncLoading && BUILD.cssAnnotations) {
1441
1929
  // DOM WRITE!
1442
1930
  addHydratedFlag(elm);
1443
1931
  }
1444
- {
1932
+ if (BUILD.cmpDidLoad) {
1933
+ if (BUILD.isDev) {
1934
+ hostRef.$flags$ |= 2048 /* HOST_FLAGS.devOnDidLoad */;
1935
+ }
1445
1936
  safeCall(instance, 'componentDidLoad');
1937
+ if (BUILD.isDev) {
1938
+ hostRef.$flags$ &= ~2048 /* HOST_FLAGS.devOnDidLoad */;
1939
+ }
1446
1940
  }
1941
+ emitLifecycleEvent(elm, 'componentDidLoad');
1447
1942
  endPostUpdate();
1448
- {
1943
+ if (BUILD.asyncLoading) {
1449
1944
  hostRef.$onReadyResolve$(elm);
1450
1945
  if (!ancestorComponent) {
1451
- appDidLoad();
1946
+ appDidLoad(tagName);
1452
1947
  }
1453
1948
  }
1454
1949
  }
1455
1950
  else {
1456
- {
1951
+ if (BUILD.cmpDidUpdate) {
1952
+ // we've already loaded this component
1953
+ // fire off the user's componentDidUpdate method (if one was provided)
1954
+ // componentDidUpdate runs AFTER render() has been called
1955
+ // and all child components have finished updating
1956
+ if (BUILD.isDev) {
1957
+ hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
1958
+ }
1457
1959
  safeCall(instance, 'componentDidUpdate');
1960
+ if (BUILD.isDev) {
1961
+ hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
1962
+ }
1458
1963
  }
1964
+ emitLifecycleEvent(elm, 'componentDidUpdate');
1459
1965
  endPostUpdate();
1460
1966
  }
1461
- {
1967
+ if (BUILD.hotModuleReplacement) {
1968
+ elm['s-hmr-load'] && elm['s-hmr-load']();
1969
+ }
1970
+ if (BUILD.method && BUILD.lazyLoad) {
1462
1971
  hostRef.$onInstanceResolve$(elm);
1463
1972
  }
1464
1973
  // load events fire from bottom to top
1465
1974
  // the deepest elements load first then bubbles up
1466
- {
1975
+ if (BUILD.asyncLoading) {
1467
1976
  if (hostRef.$onRenderResolve$) {
1468
1977
  hostRef.$onRenderResolve$();
1469
1978
  hostRef.$onRenderResolve$ = undefined;
@@ -1478,7 +1987,7 @@ const postUpdateComponent = (hostRef) => {
1478
1987
  // (⌐■_■)
1479
1988
  };
1480
1989
  const forceUpdate = (ref) => {
1481
- {
1990
+ if (BUILD.updatable) {
1482
1991
  const hostRef = getHostRef(ref);
1483
1992
  const isConnected = hostRef.$hostElement$.isConnected;
1484
1993
  if (isConnected &&
@@ -1488,14 +1997,21 @@ const forceUpdate = (ref) => {
1488
1997
  // Returns "true" when the forced update was successfully scheduled
1489
1998
  return isConnected;
1490
1999
  }
2000
+ return false;
1491
2001
  };
1492
2002
  const appDidLoad = (who) => {
1493
2003
  // on appload
1494
2004
  // we have finish the first big initial render
1495
- {
2005
+ if (BUILD.cssAnnotations) {
1496
2006
  addHydratedFlag(doc.documentElement);
1497
2007
  }
2008
+ if (BUILD.asyncQueue) {
2009
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
2010
+ }
1498
2011
  nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
2012
+ if (BUILD.profile && performance.measure) {
2013
+ performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, 'st:app:start');
2014
+ }
1499
2015
  };
1500
2016
  const safeCall = (instance, method, arg) => {
1501
2017
  if (instance && instance[method]) {
@@ -1511,27 +2027,61 @@ const safeCall = (instance, method, arg) => {
1511
2027
  const then = (promise, thenFn) => {
1512
2028
  return promise && promise.then ? promise.then(thenFn) : thenFn();
1513
2029
  };
1514
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1515
- ;
2030
+ const emitLifecycleEvent = (elm, lifecycleName) => {
2031
+ if (BUILD.lifecycleDOMEvents) {
2032
+ emitEvent(elm, 'stencil_' + lifecycleName, {
2033
+ bubbles: true,
2034
+ composed: true,
2035
+ detail: {
2036
+ namespace: NAMESPACE,
2037
+ },
2038
+ });
2039
+ }
2040
+ };
2041
+ const addHydratedFlag = (elm) => BUILD.hydratedClass
2042
+ ? elm.classList.add('hydrated')
2043
+ : BUILD.hydratedAttribute
2044
+ ? elm.setAttribute('hydrated', '')
2045
+ : undefined;
2046
+ const serverSideConnected = (elm) => {
2047
+ const children = elm.children;
2048
+ if (children != null) {
2049
+ for (let i = 0, ii = children.length; i < ii; i++) {
2050
+ const childElm = children[i];
2051
+ if (typeof childElm.connectedCallback === 'function') {
2052
+ childElm.connectedCallback();
2053
+ }
2054
+ serverSideConnected(childElm);
2055
+ }
2056
+ }
2057
+ };
1516
2058
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1517
2059
  const setValue = (ref, propName, newVal, cmpMeta) => {
1518
2060
  // check our new property value against our internal value
1519
2061
  const hostRef = getHostRef(ref);
1520
- const elm = hostRef.$hostElement$ ;
2062
+ const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
1521
2063
  const oldVal = hostRef.$instanceValues$.get(propName);
1522
2064
  const flags = hostRef.$flags$;
1523
- const instance = hostRef.$lazyInstance$ ;
2065
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1524
2066
  newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1525
2067
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1526
2068
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1527
2069
  const didValueChange = newVal !== oldVal && !areBothNaN;
1528
- if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
2070
+ if ((!BUILD.lazyLoad || !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1529
2071
  // gadzooks! the property's value has changed!!
1530
2072
  // set our new value!
1531
2073
  hostRef.$instanceValues$.set(propName, newVal);
1532
- if (instance) {
2074
+ if (BUILD.isDev) {
2075
+ if (hostRef.$flags$ & 1024 /* HOST_FLAGS.devOnRender */) {
2076
+ consoleDevWarn(`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
2077
+ }
2078
+ else if (hostRef.$flags$ & 2048 /* HOST_FLAGS.devOnDidLoad */) {
2079
+ consoleDevWarn(`The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
2080
+ }
2081
+ }
2082
+ if (!BUILD.lazyLoad || instance) {
1533
2083
  // get an array of method names of watch functions to call
1534
- if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
2084
+ if (BUILD.watchCallback && cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1535
2085
  const watchMethods = cmpMeta.$watchers$[propName];
1536
2086
  if (watchMethods) {
1537
2087
  // this instance is watching for when this property changed
@@ -1546,8 +2096,9 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1546
2096
  });
1547
2097
  }
1548
2098
  }
1549
- if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1550
- if (instance.componentShouldUpdate) {
2099
+ if (BUILD.updatable &&
2100
+ (flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
2101
+ if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
1551
2102
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1552
2103
  return;
1553
2104
  }
@@ -1572,16 +2123,17 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1572
2123
  * @returns a reference to the same constructor passed in (but now mutated)
1573
2124
  */
1574
2125
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1575
- if (cmpMeta.$members$) {
1576
- if (Cstr.watchers) {
2126
+ if (BUILD.member && cmpMeta.$members$) {
2127
+ if (BUILD.watchCallback && Cstr.watchers) {
1577
2128
  cmpMeta.$watchers$ = Cstr.watchers;
1578
2129
  }
1579
2130
  // It's better to have a const than two Object.entries()
1580
2131
  const members = Object.entries(cmpMeta.$members$);
1581
2132
  const prototype = Cstr.prototype;
1582
2133
  members.map(([memberName, [memberFlags]]) => {
1583
- if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1584
- ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
2134
+ if ((BUILD.prop || BUILD.state) &&
2135
+ (memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
2136
+ ((!BUILD.lazyLoad || flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1585
2137
  // proxyComponent - prop
1586
2138
  Object.defineProperty(prototype, memberName, {
1587
2139
  get() {
@@ -1589,6 +2141,21 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1589
2141
  return getValue(this, memberName);
1590
2142
  },
1591
2143
  set(newValue) {
2144
+ // only during dev time
2145
+ if (BUILD.isDev) {
2146
+ const ref = getHostRef(this);
2147
+ if (
2148
+ // we are proxying the instance (not element)
2149
+ (flags & 1 /* PROXY_FLAGS.isElementConstructor */) === 0 &&
2150
+ // the element is not constructing
2151
+ (ref.$flags$ & 8 /* HOST_FLAGS.isConstructingInstance */) === 0 &&
2152
+ // the member is a prop
2153
+ (memberFlags & 31 /* MEMBER_FLAGS.Prop */) !== 0 &&
2154
+ // the member is not mutable
2155
+ (memberFlags & 1024 /* MEMBER_FLAGS.Mutable */) === 0) {
2156
+ consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.\nMore information: https://stenciljs.com/docs/properties#prop-mutability`);
2157
+ }
2158
+ }
1592
2159
  // proxyComponent, set value
1593
2160
  setValue(this, memberName, newValue, cmpMeta);
1594
2161
  },
@@ -1596,7 +2163,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1596
2163
  enumerable: true,
1597
2164
  });
1598
2165
  }
1599
- else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
2166
+ else if (BUILD.lazyLoad &&
2167
+ BUILD.method &&
2168
+ flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1600
2169
  memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1601
2170
  // proxyComponent - method
1602
2171
  Object.defineProperty(prototype, memberName, {
@@ -1607,7 +2176,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1607
2176
  });
1608
2177
  }
1609
2178
  });
1610
- if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
2179
+ if (BUILD.observeAttribute && (!BUILD.lazyLoad || flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1611
2180
  const attrNameToPropName = new Map();
1612
2181
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1613
2182
  plt.jmp(() => {
@@ -1667,7 +2236,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1667
2236
  .map(([propName, m]) => {
1668
2237
  const attrName = m[1] || propName;
1669
2238
  attrNameToPropName.set(attrName, propName);
1670
- if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
2239
+ if (BUILD.reflect && m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1671
2240
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1672
2241
  }
1673
2242
  return attrName;
@@ -1678,25 +2247,29 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1678
2247
  };
1679
2248
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1680
2249
  // initializeComponent
1681
- if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1682
- {
2250
+ if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) &&
2251
+ (hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
2252
+ if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
1683
2253
  // we haven't initialized this element yet
1684
2254
  hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1685
2255
  // lazy loaded components
1686
2256
  // request the component's implementation to be
1687
2257
  // wired up with the host element
1688
- Cstr = loadModule(cmpMeta);
2258
+ Cstr = loadModule(cmpMeta, hostRef, hmrVersionId);
1689
2259
  if (Cstr.then) {
1690
2260
  // Await creates a micro-task avoid if possible
1691
- const endLoad = uniqueTime();
2261
+ const endLoad = uniqueTime(`st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`, `[Stencil] Load module for <${cmpMeta.$tagName$}>`);
1692
2262
  Cstr = await Cstr;
1693
2263
  endLoad();
1694
2264
  }
1695
- if (!Cstr.isProxied) {
2265
+ if ((BUILD.isDev || BUILD.isDebug) && !Cstr) {
2266
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
2267
+ }
2268
+ if (BUILD.member && !Cstr.isProxied) {
1696
2269
  // we've never proxied this Constructor before
1697
2270
  // let's add the getters/setters to its prototype before
1698
2271
  // the first time we create an instance of the implementation
1699
- {
2272
+ if (BUILD.watchCallback) {
1700
2273
  cmpMeta.$watchers$ = Cstr.watchers;
1701
2274
  }
1702
2275
  proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
@@ -1706,7 +2279,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1706
2279
  // ok, time to construct the instance
1707
2280
  // but let's keep track of when we start and stop
1708
2281
  // so that the getters/setters don't incorrectly step on data
1709
- {
2282
+ if (BUILD.member) {
1710
2283
  hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1711
2284
  }
1712
2285
  // construct the lazy-loaded component implementation
@@ -1719,21 +2292,42 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1719
2292
  catch (e) {
1720
2293
  consoleError(e);
1721
2294
  }
1722
- {
2295
+ if (BUILD.member) {
1723
2296
  hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1724
2297
  }
1725
- {
2298
+ if (BUILD.watchCallback) {
1726
2299
  hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1727
2300
  }
1728
2301
  endNewInstance();
1729
2302
  fireConnectedCallback(hostRef.$lazyInstance$);
1730
2303
  }
1731
- if (Cstr.style) {
2304
+ else {
2305
+ // sync constructor component
2306
+ Cstr = elm.constructor;
2307
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
2308
+ // wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
2309
+ // watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
2310
+ // Stencil has completed instantiating the component.
2311
+ customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */));
2312
+ }
2313
+ if (BUILD.style && Cstr.style) {
1732
2314
  // this component has styles but we haven't registered them yet
1733
2315
  let style = Cstr.style;
1734
- const scopeId = getScopeId(cmpMeta);
2316
+ if (BUILD.mode && typeof style !== 'string') {
2317
+ style = style[(hostRef.$modeName$ = computeMode(elm))];
2318
+ if (BUILD.hydrateServerSide && hostRef.$modeName$) {
2319
+ elm.setAttribute('s-mode', hostRef.$modeName$);
2320
+ }
2321
+ }
2322
+ const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
1735
2323
  if (!styles.has(scopeId)) {
1736
2324
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
2325
+ if (!BUILD.hydrateServerSide &&
2326
+ BUILD.shadowDom &&
2327
+ BUILD.shadowDomShim &&
2328
+ cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
2329
+ style = await import('./shadow-css-98135883.js').then((m) => m.scopeCss(style, scopeId, false));
2330
+ }
1737
2331
  registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1738
2332
  endRegisterStyles();
1739
2333
  }
@@ -1742,7 +2336,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1742
2336
  // we've successfully created a lazy instance
1743
2337
  const ancestorComponent = hostRef.$ancestorComponent$;
1744
2338
  const schedule = () => scheduleUpdate(hostRef, true);
1745
- if (ancestorComponent && ancestorComponent['s-rc']) {
2339
+ if (BUILD.asyncLoading && ancestorComponent && ancestorComponent['s-rc']) {
1746
2340
  // this is the initial load and this component it has an ancestor component
1747
2341
  // but the ancestor component has NOT fired its will update lifecycle yet
1748
2342
  // so let's just cool our jets and wait for the ancestor to continue first
@@ -1756,7 +2350,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1756
2350
  }
1757
2351
  };
1758
2352
  const fireConnectedCallback = (instance) => {
1759
- {
2353
+ if (BUILD.lazyLoad && BUILD.connectedCallback) {
1760
2354
  safeCall(instance, 'connectedCallback');
1761
2355
  }
1762
2356
  };
@@ -1765,26 +2359,49 @@ const connectedCallback = (elm) => {
1765
2359
  const hostRef = getHostRef(elm);
1766
2360
  const cmpMeta = hostRef.$cmpMeta$;
1767
2361
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2362
+ if (BUILD.hostListenerTargetParent) {
2363
+ // only run if we have listeners being attached to a parent
2364
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
2365
+ }
1768
2366
  if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1769
2367
  // first time this component has connected
1770
2368
  hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1771
- {
2369
+ let hostId;
2370
+ if (BUILD.hydrateClientSide) {
2371
+ hostId = elm.getAttribute(HYDRATE_ID);
2372
+ if (hostId) {
2373
+ if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2374
+ const scopeId = BUILD.mode
2375
+ ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode'))
2376
+ : addStyle(elm.shadowRoot, cmpMeta);
2377
+ elm.classList.remove(scopeId + '-h', scopeId + '-s');
2378
+ }
2379
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2380
+ }
2381
+ }
2382
+ if (BUILD.slotRelocation && !hostId) {
1772
2383
  // initUpdate
1773
2384
  // if the slot polyfill is required we'll need to put some nodes
1774
2385
  // in here to act as original content anchors as we move nodes around
1775
2386
  // host element has been connected to the DOM
1776
- if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
2387
+ if (BUILD.hydrateServerSide ||
2388
+ ((BUILD.slot || BUILD.shadowDom) &&
2389
+ cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1777
2390
  setContentReference(elm);
1778
2391
  }
1779
2392
  }
1780
- {
2393
+ if (BUILD.asyncLoading) {
1781
2394
  // find the first ancestor component (if there is one) and register
1782
2395
  // this component as one of the actively loading child components for its ancestor
1783
2396
  let ancestorComponent = elm;
1784
2397
  while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1785
2398
  // climb up the ancestors looking for the first
1786
2399
  // component that hasn't finished its lifecycle update yet
1787
- if (ancestorComponent['s-p']) {
2400
+ if ((BUILD.hydrateClientSide &&
2401
+ ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
2402
+ ancestorComponent.hasAttribute('s-id') &&
2403
+ ancestorComponent['s-p']) ||
2404
+ ancestorComponent['s-p']) {
1788
2405
  // we found this components first ancestor component
1789
2406
  // keep a reference to this component's ancestor component
1790
2407
  attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
@@ -1794,7 +2411,7 @@ const connectedCallback = (elm) => {
1794
2411
  }
1795
2412
  // Lazy properties
1796
2413
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1797
- if (cmpMeta.$members$) {
2414
+ if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) {
1798
2415
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1799
2416
  if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1800
2417
  const value = elm[memberName];
@@ -1803,7 +2420,14 @@ const connectedCallback = (elm) => {
1803
2420
  }
1804
2421
  });
1805
2422
  }
1806
- {
2423
+ if (BUILD.initializeNextTick) {
2424
+ // connectedCallback, taskQueue, initialLoad
2425
+ // angular sets attribute AFTER connectCallback
2426
+ // https://github.com/angular/angular/issues/18909
2427
+ // https://github.com/angular/angular/issues/19940
2428
+ nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
2429
+ }
2430
+ else {
1807
2431
  initializeComponent(elm, hostRef, cmpMeta);
1808
2432
  }
1809
2433
  }
@@ -1811,7 +2435,7 @@ const connectedCallback = (elm) => {
1811
2435
  // not the first time this has connected
1812
2436
  // reattach any event listeners to the host
1813
2437
  // since they would have been removed when disconnected
1814
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
2438
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
1815
2439
  // fire off connectedCallback() on component instance
1816
2440
  fireConnectedCallback(hostRef.$lazyInstance$);
1817
2441
  }
@@ -1825,28 +2449,317 @@ const setContentReference = (elm) => {
1825
2449
  // let's pick out the inner content for slot projection
1826
2450
  // create a node to represent where the original
1827
2451
  // content was first placed, which is useful later on
1828
- const contentRefElm = (elm['s-cr'] = doc.createComment(''));
2452
+ const contentRefElm = (elm['s-cr'] = doc.createComment(BUILD.isDebug ? `content-ref (host=${elm.localName})` : ''));
1829
2453
  contentRefElm['s-cn'] = true;
1830
2454
  elm.insertBefore(contentRefElm, elm.firstChild);
1831
2455
  };
1832
2456
  const disconnectedCallback = (elm) => {
1833
2457
  if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1834
2458
  const hostRef = getHostRef(elm);
1835
- const instance = hostRef.$lazyInstance$ ;
1836
- {
2459
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2460
+ if (BUILD.hostListener) {
1837
2461
  if (hostRef.$rmListeners$) {
1838
2462
  hostRef.$rmListeners$.map((rmListener) => rmListener());
1839
2463
  hostRef.$rmListeners$ = undefined;
1840
2464
  }
1841
2465
  }
1842
- {
2466
+ // clear CSS var-shim tracking
2467
+ if (BUILD.cssVarShim && plt.$cssShim$) {
2468
+ plt.$cssShim$.removeHost(elm);
2469
+ }
2470
+ if (BUILD.lazyLoad && BUILD.disconnectedCallback) {
1843
2471
  safeCall(instance, 'disconnectedCallback');
1844
2472
  }
2473
+ if (BUILD.cmpDidUnload) {
2474
+ safeCall(instance, 'componentDidUnload');
2475
+ }
2476
+ }
2477
+ };
2478
+ const defineCustomElement = (Cstr, compactMeta) => {
2479
+ customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
2480
+ };
2481
+ const proxyCustomElement = (Cstr, compactMeta) => {
2482
+ const cmpMeta = {
2483
+ $flags$: compactMeta[0],
2484
+ $tagName$: compactMeta[1],
2485
+ };
2486
+ if (BUILD.member) {
2487
+ cmpMeta.$members$ = compactMeta[2];
2488
+ }
2489
+ if (BUILD.hostListener) {
2490
+ cmpMeta.$listeners$ = compactMeta[3];
2491
+ }
2492
+ if (BUILD.watchCallback) {
2493
+ cmpMeta.$watchers$ = Cstr.$watchers$;
2494
+ }
2495
+ if (BUILD.reflect) {
2496
+ cmpMeta.$attrsToReflect$ = [];
2497
+ }
2498
+ if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2499
+ cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
2500
+ }
2501
+ const originalConnectedCallback = Cstr.prototype.connectedCallback;
2502
+ const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
2503
+ Object.assign(Cstr.prototype, {
2504
+ __registerHost() {
2505
+ registerHost(this, cmpMeta);
2506
+ },
2507
+ connectedCallback() {
2508
+ connectedCallback(this);
2509
+ if (BUILD.connectedCallback && originalConnectedCallback) {
2510
+ originalConnectedCallback.call(this);
2511
+ }
2512
+ },
2513
+ disconnectedCallback() {
2514
+ disconnectedCallback(this);
2515
+ if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
2516
+ originalDisconnectedCallback.call(this);
2517
+ }
2518
+ },
2519
+ __attachShadow() {
2520
+ if (supportsShadow) {
2521
+ if (BUILD.shadowDelegatesFocus) {
2522
+ this.attachShadow({
2523
+ mode: 'open',
2524
+ delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
2525
+ });
2526
+ }
2527
+ else {
2528
+ this.attachShadow({ mode: 'open' });
2529
+ }
2530
+ }
2531
+ else {
2532
+ this.shadowRoot = this;
2533
+ }
2534
+ },
2535
+ });
2536
+ Cstr.is = cmpMeta.$tagName$;
2537
+ return proxyComponent(Cstr, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */ | 2 /* PROXY_FLAGS.proxyState */);
2538
+ };
2539
+ const forceModeUpdate = (elm) => {
2540
+ if (BUILD.style && BUILD.mode && !BUILD.lazyLoad) {
2541
+ const mode = computeMode(elm);
2542
+ const hostRef = getHostRef(elm);
2543
+ if (hostRef.$modeName$ !== mode) {
2544
+ const cmpMeta = hostRef.$cmpMeta$;
2545
+ const oldScopeId = elm['s-sc'];
2546
+ const scopeId = getScopeId(cmpMeta, mode);
2547
+ const style = elm.constructor.style[mode];
2548
+ const flags = cmpMeta.$flags$;
2549
+ if (style) {
2550
+ if (!styles.has(scopeId)) {
2551
+ registerStyle(scopeId, style, !!(flags & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
2552
+ }
2553
+ hostRef.$modeName$ = mode;
2554
+ elm.classList.remove(oldScopeId + '-h', oldScopeId + '-s');
2555
+ attachStyles(hostRef);
2556
+ forceUpdate(elm);
2557
+ }
2558
+ }
1845
2559
  }
1846
2560
  };
2561
+ const patchCloneNode = (HostElementPrototype) => {
2562
+ const orgCloneNode = HostElementPrototype.cloneNode;
2563
+ HostElementPrototype.cloneNode = function (deep) {
2564
+ const srcNode = this;
2565
+ const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
2566
+ const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
2567
+ if (BUILD.slot && !isShadowDom && deep) {
2568
+ let i = 0;
2569
+ let slotted, nonStencilNode;
2570
+ const stencilPrivates = [
2571
+ 's-id',
2572
+ 's-cr',
2573
+ 's-lr',
2574
+ 's-rc',
2575
+ 's-sc',
2576
+ 's-p',
2577
+ 's-cn',
2578
+ 's-sr',
2579
+ 's-sn',
2580
+ 's-hn',
2581
+ 's-ol',
2582
+ 's-nr',
2583
+ 's-si',
2584
+ ];
2585
+ for (; i < srcNode.childNodes.length; i++) {
2586
+ slotted = srcNode.childNodes[i]['s-nr'];
2587
+ nonStencilNode = stencilPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
2588
+ if (slotted) {
2589
+ if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
2590
+ clonedNode.__appendChild(slotted.cloneNode(true));
2591
+ }
2592
+ else {
2593
+ clonedNode.appendChild(slotted.cloneNode(true));
2594
+ }
2595
+ }
2596
+ if (nonStencilNode) {
2597
+ clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
2598
+ }
2599
+ }
2600
+ }
2601
+ return clonedNode;
2602
+ };
2603
+ };
2604
+ const patchSlotAppendChild = (HostElementPrototype) => {
2605
+ HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
2606
+ HostElementPrototype.appendChild = function (newChild) {
2607
+ const slotName = (newChild['s-sn'] = getSlotName(newChild));
2608
+ const slotNode = getHostSlotNode(this.childNodes, slotName);
2609
+ if (slotNode) {
2610
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2611
+ const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2612
+ return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2613
+ }
2614
+ return this.__appendChild(newChild);
2615
+ };
2616
+ };
2617
+ /**
2618
+ * Patches the text content of an unnamed slotted node inside a scoped component
2619
+ * @param hostElementPrototype the `Element` to be patched
2620
+ * @param cmpMeta component runtime metadata used to determine if the component should be patched or not
2621
+ */
2622
+ const patchTextContent = (hostElementPrototype, cmpMeta) => {
2623
+ if (BUILD.scoped && cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
2624
+ const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
2625
+ Object.defineProperty(hostElementPrototype, '__textContent', descriptor);
2626
+ Object.defineProperty(hostElementPrototype, 'textContent', {
2627
+ get() {
2628
+ var _a;
2629
+ // get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
2630
+ // the empty string
2631
+ const slotNode = getHostSlotNode(this.childNodes, '');
2632
+ // when a slot node is found, the textContent _may_ be found in the next sibling (text) node, depending on how
2633
+ // nodes were reordered during the vdom render. first try to get the text content from the sibling.
2634
+ if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* NODE_TYPES.TEXT_NODE */) {
2635
+ return slotNode.nextSibling.textContent;
2636
+ }
2637
+ else if (slotNode) {
2638
+ return slotNode.textContent;
2639
+ }
2640
+ else {
2641
+ // fallback to the original implementation
2642
+ return this.__textContent;
2643
+ }
2644
+ },
2645
+ set(value) {
2646
+ var _a;
2647
+ // get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
2648
+ // the empty string
2649
+ const slotNode = getHostSlotNode(this.childNodes, '');
2650
+ // when a slot node is found, the textContent _may_ need to be placed in the next sibling (text) node,
2651
+ // depending on how nodes were reordered during the vdom render. first try to set the text content on the
2652
+ // sibling.
2653
+ if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* NODE_TYPES.TEXT_NODE */) {
2654
+ slotNode.nextSibling.textContent = value;
2655
+ }
2656
+ else if (slotNode) {
2657
+ slotNode.textContent = value;
2658
+ }
2659
+ else {
2660
+ // we couldn't find a slot, but that doesn't mean that there isn't one. if this check ran before the DOM
2661
+ // loaded, we could have missed it. check for a content reference element on the scoped component and insert
2662
+ // it there
2663
+ this.__textContent = value;
2664
+ const contentRefElm = this['s-cr'];
2665
+ if (contentRefElm) {
2666
+ this.insertBefore(contentRefElm, this.firstChild);
2667
+ }
2668
+ }
2669
+ },
2670
+ });
2671
+ }
2672
+ };
2673
+ const patchChildSlotNodes = (elm, cmpMeta) => {
2674
+ class FakeNodeList extends Array {
2675
+ item(n) {
2676
+ return this[n];
2677
+ }
2678
+ }
2679
+ if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
2680
+ const childNodesFn = elm.__lookupGetter__('childNodes');
2681
+ Object.defineProperty(elm, 'children', {
2682
+ get() {
2683
+ return this.childNodes.map((n) => n.nodeType === 1);
2684
+ },
2685
+ });
2686
+ Object.defineProperty(elm, 'childElementCount', {
2687
+ get() {
2688
+ return elm.children.length;
2689
+ },
2690
+ });
2691
+ Object.defineProperty(elm, 'childNodes', {
2692
+ get() {
2693
+ const childNodes = childNodesFn.call(this);
2694
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
2695
+ getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
2696
+ const result = new FakeNodeList();
2697
+ for (let i = 0; i < childNodes.length; i++) {
2698
+ const slot = childNodes[i]['s-nr'];
2699
+ if (slot) {
2700
+ result.push(slot);
2701
+ }
2702
+ }
2703
+ return result;
2704
+ }
2705
+ return FakeNodeList.from(childNodes);
2706
+ },
2707
+ });
2708
+ }
2709
+ };
2710
+ const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || '';
2711
+ /**
2712
+ * Recursively searches a series of child nodes for a slot with the provided name.
2713
+ * @param childNodes the nodes to search for a slot with a specific name.
2714
+ * @param slotName the name of the slot to match on.
2715
+ * @returns a reference to the slot node that matches the provided name, `null` otherwise
2716
+ */
2717
+ const getHostSlotNode = (childNodes, slotName) => {
2718
+ let i = 0;
2719
+ let childNode;
2720
+ for (; i < childNodes.length; i++) {
2721
+ childNode = childNodes[i];
2722
+ if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
2723
+ return childNode;
2724
+ }
2725
+ childNode = getHostSlotNode(childNode.childNodes, slotName);
2726
+ if (childNode) {
2727
+ return childNode;
2728
+ }
2729
+ }
2730
+ return null;
2731
+ };
2732
+ const getHostSlotChildNodes = (n, slotName) => {
2733
+ const childNodes = [n];
2734
+ while ((n = n.nextSibling) && n['s-sn'] === slotName) {
2735
+ childNodes.push(n);
2736
+ }
2737
+ return childNodes;
2738
+ };
2739
+ const hmrStart = (elm, cmpMeta, hmrVersionId) => {
2740
+ // ¯\_(ツ)_/¯
2741
+ const hostRef = getHostRef(elm);
2742
+ // reset state flags to only have been connected
2743
+ hostRef.$flags$ = 1 /* HOST_FLAGS.hasConnected */;
2744
+ // TODO
2745
+ // detatch any event listeners that may have been added
2746
+ // because we're not passing an exact event name it'll
2747
+ // remove all of this element's event, which is good
2748
+ // create a callback for when this component finishes hmr
2749
+ elm['s-hmr-load'] = () => {
2750
+ // finished hmr for this element
2751
+ delete elm['s-hmr-load'];
2752
+ };
2753
+ // re-initialize the component
2754
+ initializeComponent(elm, hostRef, cmpMeta, hmrVersionId);
2755
+ };
1847
2756
  const bootstrapLazy = (lazyBundles, options = {}) => {
1848
2757
  var _a;
1849
- const endBootstrap = createTime();
2758
+ if (BUILD.profile && performance.mark) {
2759
+ performance.mark('st:app:start');
2760
+ }
2761
+ installDevTools();
2762
+ const endBootstrap = createTime('bootstrapLazy');
1850
2763
  const cmpTags = [];
1851
2764
  const exclude = options.exclude || [];
1852
2765
  const customElements = win.customElements;
@@ -1854,10 +2767,27 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1854
2767
  const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1855
2768
  const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1856
2769
  const deferredConnectedCallbacks = [];
2770
+ const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
1857
2771
  let appLoadFallback;
1858
2772
  let isBootstrapping = true;
2773
+ let i = 0;
1859
2774
  Object.assign(plt, options);
1860
2775
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2776
+ if (BUILD.asyncQueue) {
2777
+ if (options.syncQueue) {
2778
+ plt.$flags$ |= 4 /* PLATFORM_FLAGS.queueSync */;
2779
+ }
2780
+ }
2781
+ if (BUILD.hydrateClientSide) {
2782
+ // If the app is already hydrated there is not point to disable the
2783
+ // async queue. This will improve the first input delay
2784
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
2785
+ }
2786
+ if (BUILD.hydrateClientSide && BUILD.shadowDom) {
2787
+ for (; i < styles.length; i++) {
2788
+ registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
2789
+ }
2790
+ }
1861
2791
  lazyBundles.map((lazyBundle) => {
1862
2792
  lazyBundle[1].map((compactMeta) => {
1863
2793
  const cmpMeta = {
@@ -1866,19 +2796,24 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1866
2796
  $members$: compactMeta[2],
1867
2797
  $listeners$: compactMeta[3],
1868
2798
  };
1869
- {
2799
+ if (BUILD.member) {
1870
2800
  cmpMeta.$members$ = compactMeta[2];
1871
2801
  }
1872
- {
2802
+ if (BUILD.hostListener) {
1873
2803
  cmpMeta.$listeners$ = compactMeta[3];
1874
2804
  }
1875
- {
2805
+ if (BUILD.reflect) {
1876
2806
  cmpMeta.$attrsToReflect$ = [];
1877
2807
  }
1878
- {
2808
+ if (BUILD.watchCallback) {
1879
2809
  cmpMeta.$watchers$ = {};
1880
2810
  }
1881
- const tagName = cmpMeta.$tagName$;
2811
+ if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2812
+ cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
2813
+ }
2814
+ const tagName = BUILD.transformTagName && options.transformTagName
2815
+ ? options.transformTagName(cmpMeta.$tagName$)
2816
+ : cmpMeta.$tagName$;
1882
2817
  const HostElement = class extends HTMLElement {
1883
2818
  // StencilLazyHost
1884
2819
  constructor(self) {
@@ -1886,16 +2821,28 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1886
2821
  super(self);
1887
2822
  self = this;
1888
2823
  registerHost(self, cmpMeta);
1889
- if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2824
+ if (BUILD.shadowDom && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1890
2825
  // this component is using shadow dom
1891
2826
  // and this browser supports shadow dom
1892
2827
  // add the read-only property "shadowRoot" to the host element
1893
2828
  // adding the shadow root build conditionals to minimize runtime
1894
- {
1895
- {
2829
+ if (supportsShadow) {
2830
+ if (BUILD.shadowDelegatesFocus) {
2831
+ self.attachShadow({
2832
+ mode: 'open',
2833
+ delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
2834
+ });
2835
+ }
2836
+ else {
1896
2837
  self.attachShadow({ mode: 'open' });
1897
2838
  }
1898
2839
  }
2840
+ else if (!BUILD.hydrateServerSide && !('shadowRoot' in self)) {
2841
+ self.shadowRoot = self;
2842
+ }
2843
+ }
2844
+ if (BUILD.slotChildNodesFix) {
2845
+ patchChildSlotNodes(self, cmpMeta);
1899
2846
  }
1900
2847
  }
1901
2848
  connectedCallback() {
@@ -1918,6 +2865,20 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1918
2865
  return getHostRef(this).$onReadyPromise$;
1919
2866
  }
1920
2867
  };
2868
+ if (BUILD.cloneNodeFix) {
2869
+ patchCloneNode(HostElement.prototype);
2870
+ }
2871
+ if (BUILD.appendChildSlotFix) {
2872
+ patchSlotAppendChild(HostElement.prototype);
2873
+ }
2874
+ if (BUILD.hotModuleReplacement) {
2875
+ HostElement.prototype['s-hmr'] = function (hmrVersionId) {
2876
+ hmrStart(this, cmpMeta, hmrVersionId);
2877
+ };
2878
+ }
2879
+ if (BUILD.scopedSlotTextContentFix) {
2880
+ patchTextContent(HostElement.prototype, cmpMeta);
2881
+ }
1921
2882
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1922
2883
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1923
2884
  cmpTags.push(tagName);
@@ -1925,7 +2886,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1925
2886
  }
1926
2887
  });
1927
2888
  });
1928
- {
2889
+ if (BUILD.invisiblePrehydration && (BUILD.hydratedClass || BUILD.hydratedAttribute)) {
1929
2890
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1930
2891
  visibilityStyle.setAttribute('data-styles', '');
1931
2892
  // Apply CSP nonce to the style tag if it exists
@@ -1941,18 +2902,89 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1941
2902
  deferredConnectedCallbacks.map((host) => host.connectedCallback());
1942
2903
  }
1943
2904
  else {
1944
- {
2905
+ if (BUILD.profile) {
2906
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30, 'timeout')));
2907
+ }
2908
+ else {
1945
2909
  plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1946
2910
  }
1947
2911
  }
1948
2912
  // Fallback appLoad event
1949
2913
  endBootstrap();
1950
2914
  };
2915
+ const getConnect = (_ref, tagName) => {
2916
+ const componentOnReady = () => {
2917
+ let elm = doc.querySelector(tagName);
2918
+ if (!elm) {
2919
+ elm = doc.createElement(tagName);
2920
+ doc.body.appendChild(elm);
2921
+ }
2922
+ return typeof elm.componentOnReady === 'function' ? elm.componentOnReady() : Promise.resolve(elm);
2923
+ };
2924
+ const create = (...args) => {
2925
+ return componentOnReady().then((el) => el.create(...args));
2926
+ };
2927
+ return {
2928
+ create,
2929
+ componentOnReady,
2930
+ };
2931
+ };
2932
+ const getContext = (_elm, context) => {
2933
+ if (context in Context) {
2934
+ return Context[context];
2935
+ }
2936
+ else if (context === 'window') {
2937
+ return win;
2938
+ }
2939
+ else if (context === 'document') {
2940
+ return doc;
2941
+ }
2942
+ else if (context === 'isServer' || context === 'isPrerender') {
2943
+ return BUILD.hydrateServerSide ? true : false;
2944
+ }
2945
+ else if (context === 'isClient') {
2946
+ return BUILD.hydrateServerSide ? false : true;
2947
+ }
2948
+ else if (context === 'resourcesUrl' || context === 'publicPath') {
2949
+ return getAssetPath('.');
2950
+ }
2951
+ else if (context === 'queue') {
2952
+ return {
2953
+ write: writeTask,
2954
+ read: readTask,
2955
+ tick: {
2956
+ then(cb) {
2957
+ return nextTick(cb);
2958
+ },
2959
+ },
2960
+ };
2961
+ }
2962
+ return undefined;
2963
+ };
1951
2964
  const Fragment = (_, children) => children;
1952
2965
  const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1953
- if (listeners) {
2966
+ if (BUILD.hostListener && listeners) {
2967
+ // this is called immediately within the element's constructor
2968
+ // initialize our event listeners on the host element
2969
+ // we do this now so that we can listen to events that may
2970
+ // have fired even before the instance is ready
2971
+ if (BUILD.hostListenerTargetParent) {
2972
+ // this component may have event listeners that should be attached to the parent
2973
+ if (attachParentListeners) {
2974
+ // this is being ran from within the connectedCallback
2975
+ // which is important so that we know the host element actually has a parent element
2976
+ // filter out the listeners to only have the ones that ARE being attached to the parent
2977
+ listeners = listeners.filter(([flags]) => flags & 32 /* LISTENER_FLAGS.TargetParent */);
2978
+ }
2979
+ else {
2980
+ // this is being ran from within the component constructor
2981
+ // everything BUT the parent element listeners should be attached at this time
2982
+ // filter out the listeners that are NOT being attached to the parent
2983
+ listeners = listeners.filter(([flags]) => !(flags & 32 /* LISTENER_FLAGS.TargetParent */));
2984
+ }
2985
+ }
1954
2986
  listeners.map(([flags, name, method]) => {
1955
- const target = getHostListenerTarget(elm, flags) ;
2987
+ const target = BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
1956
2988
  const handler = hostListenerProxy(hostRef, method);
1957
2989
  const opts = hostListenerOpts(flags);
1958
2990
  plt.ael(target, name, handler, opts);
@@ -1962,7 +2994,7 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
1962
2994
  };
1963
2995
  const hostListenerProxy = (hostRef, methodName) => (ev) => {
1964
2996
  try {
1965
- {
2997
+ if (BUILD.lazyLoad) {
1966
2998
  if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1967
2999
  // instance is ready, let's call it's member method for this event
1968
3000
  hostRef.$lazyInstance$[methodName](ev);
@@ -1971,20 +3003,32 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1971
3003
  (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1972
3004
  }
1973
3005
  }
3006
+ else {
3007
+ hostRef.$hostElement$[methodName](ev);
3008
+ }
1974
3009
  }
1975
3010
  catch (e) {
1976
3011
  consoleError(e);
1977
3012
  }
1978
3013
  };
1979
3014
  const getHostListenerTarget = (elm, flags) => {
1980
- if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
3015
+ if (BUILD.hostListenerTargetDocument && flags & 4 /* LISTENER_FLAGS.TargetDocument */)
3016
+ return doc;
3017
+ if (BUILD.hostListenerTargetWindow && flags & 8 /* LISTENER_FLAGS.TargetWindow */)
1981
3018
  return win;
1982
- if (flags & 16 /* LISTENER_FLAGS.TargetBody */)
3019
+ if (BUILD.hostListenerTargetBody && flags & 16 /* LISTENER_FLAGS.TargetBody */)
1983
3020
  return doc.body;
3021
+ if (BUILD.hostListenerTargetParent && flags & 32 /* LISTENER_FLAGS.TargetParent */)
3022
+ return elm.parentElement;
1984
3023
  return elm;
1985
3024
  };
1986
3025
  // prettier-ignore
1987
- const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
3026
+ const hostListenerOpts = (flags) => supportsListenerOptions
3027
+ ? ({
3028
+ passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
3029
+ capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
3030
+ })
3031
+ : (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1988
3032
  /**
1989
3033
  * Assigns the given value to the nonce property on the runtime platform object.
1990
3034
  * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
@@ -1992,6 +3036,146 @@ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !==
1992
3036
  * @returns void
1993
3037
  */
1994
3038
  const setNonce = (nonce) => (plt.$nonce$ = nonce);
3039
+ const setPlatformOptions = (opts) => Object.assign(plt, opts);
3040
+ const insertVdomAnnotations = (doc, staticComponents) => {
3041
+ if (doc != null) {
3042
+ const docData = {
3043
+ hostIds: 0,
3044
+ rootLevelIds: 0,
3045
+ staticComponents: new Set(staticComponents),
3046
+ };
3047
+ const orgLocationNodes = [];
3048
+ parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
3049
+ orgLocationNodes.forEach((orgLocationNode) => {
3050
+ if (orgLocationNode != null) {
3051
+ const nodeRef = orgLocationNode['s-nr'];
3052
+ let hostId = nodeRef['s-host-id'];
3053
+ let nodeId = nodeRef['s-node-id'];
3054
+ let childId = `${hostId}.${nodeId}`;
3055
+ if (hostId == null) {
3056
+ hostId = 0;
3057
+ docData.rootLevelIds++;
3058
+ nodeId = docData.rootLevelIds;
3059
+ childId = `${hostId}.${nodeId}`;
3060
+ if (nodeRef.nodeType === 1 /* NODE_TYPE.ElementNode */) {
3061
+ nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
3062
+ }
3063
+ else if (nodeRef.nodeType === 3 /* NODE_TYPE.TextNode */) {
3064
+ if (hostId === 0) {
3065
+ const textContent = nodeRef.nodeValue.trim();
3066
+ if (textContent === '') {
3067
+ // useless whitespace node at the document root
3068
+ orgLocationNode.remove();
3069
+ return;
3070
+ }
3071
+ }
3072
+ const commentBeforeTextNode = doc.createComment(childId);
3073
+ commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
3074
+ nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
3075
+ }
3076
+ }
3077
+ let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
3078
+ const orgLocationParentNode = orgLocationNode.parentElement;
3079
+ if (orgLocationParentNode) {
3080
+ if (orgLocationParentNode['s-en'] === '') {
3081
+ // ending with a "." means that the parent element
3082
+ // of this node's original location is a SHADOW dom element
3083
+ // and this node is apart of the root level light dom
3084
+ orgLocationNodeId += `.`;
3085
+ }
3086
+ else if (orgLocationParentNode['s-en'] === 'c') {
3087
+ // ending with a ".c" means that the parent element
3088
+ // of this node's original location is a SCOPED element
3089
+ // and this node is apart of the root level light dom
3090
+ orgLocationNodeId += `.c`;
3091
+ }
3092
+ }
3093
+ orgLocationNode.nodeValue = orgLocationNodeId;
3094
+ }
3095
+ });
3096
+ }
3097
+ };
3098
+ const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
3099
+ if (node == null) {
3100
+ return;
3101
+ }
3102
+ if (node['s-nr'] != null) {
3103
+ orgLocationNodes.push(node);
3104
+ }
3105
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
3106
+ node.childNodes.forEach((childNode) => {
3107
+ const hostRef = getHostRef(childNode);
3108
+ if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
3109
+ const cmpData = {
3110
+ nodeIds: 0,
3111
+ };
3112
+ insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
3113
+ }
3114
+ parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
3115
+ });
3116
+ }
3117
+ };
3118
+ const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
3119
+ if (vnode != null) {
3120
+ const hostId = ++docData.hostIds;
3121
+ hostElm.setAttribute(HYDRATE_ID, hostId);
3122
+ if (hostElm['s-cr'] != null) {
3123
+ hostElm['s-cr'].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
3124
+ }
3125
+ if (vnode.$children$ != null) {
3126
+ const depth = 0;
3127
+ vnode.$children$.forEach((vnodeChild, index) => {
3128
+ insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
3129
+ });
3130
+ }
3131
+ if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute('c-id')) {
3132
+ const parent = hostElm.parentElement;
3133
+ if (parent && parent.childNodes) {
3134
+ const parentChildNodes = Array.from(parent.childNodes);
3135
+ const comment = parentChildNodes.find((node) => node.nodeType === 8 /* NODE_TYPE.CommentNode */ && node['s-sr']);
3136
+ if (comment) {
3137
+ const index = parentChildNodes.indexOf(hostElm) - 1;
3138
+ vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}`);
3139
+ }
3140
+ }
3141
+ }
3142
+ }
3143
+ };
3144
+ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
3145
+ const childElm = vnodeChild.$elm$;
3146
+ if (childElm == null) {
3147
+ return;
3148
+ }
3149
+ const nodeId = cmpData.nodeIds++;
3150
+ const childId = `${hostId}.${nodeId}.${depth}.${index}`;
3151
+ childElm['s-host-id'] = hostId;
3152
+ childElm['s-node-id'] = nodeId;
3153
+ if (childElm.nodeType === 1 /* NODE_TYPE.ElementNode */) {
3154
+ childElm.setAttribute(HYDRATE_CHILD_ID, childId);
3155
+ }
3156
+ else if (childElm.nodeType === 3 /* NODE_TYPE.TextNode */) {
3157
+ const parentNode = childElm.parentNode;
3158
+ const nodeName = parentNode.nodeName;
3159
+ if (nodeName !== 'STYLE' && nodeName !== 'SCRIPT') {
3160
+ const textNodeId = `${TEXT_NODE_ID}.${childId}`;
3161
+ const commentBeforeTextNode = doc.createComment(textNodeId);
3162
+ parentNode.insertBefore(commentBeforeTextNode, childElm);
3163
+ }
3164
+ }
3165
+ else if (childElm.nodeType === 8 /* NODE_TYPE.CommentNode */) {
3166
+ if (childElm['s-sr']) {
3167
+ const slotName = childElm['s-sn'] || '';
3168
+ const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
3169
+ childElm.nodeValue = slotNodeId;
3170
+ }
3171
+ }
3172
+ if (vnodeChild.$children$ != null) {
3173
+ const childDepth = depth + 1;
3174
+ vnodeChild.$children$.forEach((vnode, index) => {
3175
+ insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index);
3176
+ });
3177
+ }
3178
+ };
1995
3179
  const hostRefs = /*@__PURE__*/ new WeakMap();
1996
3180
  const getHostRef = (ref) => hostRefs.get(ref);
1997
3181
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -2002,25 +3186,42 @@ const registerHost = (elm, cmpMeta) => {
2002
3186
  $cmpMeta$: cmpMeta,
2003
3187
  $instanceValues$: new Map(),
2004
3188
  };
2005
- {
3189
+ if (BUILD.isDev) {
3190
+ hostRef.$renderCount$ = 0;
3191
+ }
3192
+ if (BUILD.method && BUILD.lazyLoad) {
2006
3193
  hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
2007
3194
  }
2008
- {
3195
+ if (BUILD.asyncLoading) {
2009
3196
  hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
2010
3197
  elm['s-p'] = [];
2011
3198
  elm['s-rc'] = [];
2012
3199
  }
2013
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
3200
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2014
3201
  return hostRefs.set(elm, hostRef);
2015
3202
  };
2016
3203
  const isMemberInElement = (elm, memberName) => memberName in elm;
2017
- const consoleError = (e, el) => (0, console.error)(e, el);
3204
+ const consoleError = (e, el) => (customError || console.error)(e, el);
3205
+ const STENCIL_DEV_MODE = BUILD.isTesting
3206
+ ? ['STENCIL:'] // E2E testing
3207
+ : [
3208
+ '%cstencil',
3209
+ 'color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px',
3210
+ ];
3211
+ const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
3212
+ const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
3213
+ const consoleDevInfo = (...m) => console.info(...STENCIL_DEV_MODE, ...m);
3214
+ const setErrorHandler = (handler) => (customError = handler);
2018
3215
  const cmpModules = /*@__PURE__*/ new Map();
2019
3216
  const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2020
3217
  // loadModuleImport
2021
3218
  const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
2022
3219
  const bundleId = cmpMeta.$lazyBundleId$;
2023
- const module = cmpModules.get(bundleId) ;
3220
+ if (BUILD.isDev && typeof bundleId !== 'string') {
3221
+ consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
3222
+ return undefined;
3223
+ }
3224
+ const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
2024
3225
  if (module) {
2025
3226
  return module[exportName];
2026
3227
  }
@@ -2104,6 +3305,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2104
3305
  return import(
2105
3306
  /* webpackMode: "lazy" */
2106
3307
  './snk-custom-slot-elements.entry.js').then(processMod, consoleError);
3308
+ case 'snk-custom-slot-guide':
3309
+ return import(
3310
+ /* webpackMode: "lazy" */
3311
+ './snk-custom-slot-guide.entry.js').then(processMod, consoleError);
2107
3312
  case 'snk-entity-list':
2108
3313
  return import(
2109
3314
  /* webpackMode: "lazy" */
@@ -2227,16 +3432,20 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2227
3432
  /* webpackInclude: /\.entry\.js$/ */
2228
3433
  /* webpackExclude: /\.system\.entry\.js$/ */
2229
3434
  /* webpackMode: "lazy" */
2230
- `./${bundleId}.entry.js${''}`).then((importedModule) => {
2231
- {
3435
+ `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? '?s-hmr=' + hmrVersionId : ''}`).then((importedModule) => {
3436
+ if (!BUILD.hotModuleReplacement) {
2232
3437
  cmpModules.set(bundleId, importedModule);
2233
3438
  }
2234
3439
  return importedModule[exportName];
2235
3440
  }, consoleError);
2236
3441
  };
2237
3442
  const styles = /*@__PURE__*/ new Map();
3443
+ const modeResolutionChain = [];
2238
3444
  const win = typeof window !== 'undefined' ? window : {};
3445
+ const CSS = BUILD.cssVarShim ? win.CSS : null;
2239
3446
  const doc = win.document || { head: {} };
3447
+ const H = (win.HTMLElement || class {
3448
+ });
2240
3449
  const plt = {
2241
3450
  $flags$: 0,
2242
3451
  $resourcesUrl$: '',
@@ -2246,8 +3455,27 @@ const plt = {
2246
3455
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2247
3456
  ce: (eventName, opts) => new CustomEvent(eventName, opts),
2248
3457
  };
3458
+ const setPlatformHelpers = (helpers) => {
3459
+ Object.assign(plt, helpers);
3460
+ };
3461
+ const supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom
3462
+ ? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
3463
+ : true;
3464
+ const supportsListenerOptions = /*@__PURE__*/ (() => {
3465
+ let supportsListenerOptions = false;
3466
+ try {
3467
+ doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
3468
+ get() {
3469
+ supportsListenerOptions = true;
3470
+ },
3471
+ }));
3472
+ }
3473
+ catch (e) { }
3474
+ return supportsListenerOptions;
3475
+ })();
2249
3476
  const promiseResolve = (v) => Promise.resolve(v);
2250
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
3477
+ const supportsConstructableStylesheets = BUILD.constructableCSS
3478
+ ? /*@__PURE__*/ (() => {
2251
3479
  try {
2252
3480
  new CSSStyleSheet();
2253
3481
  return typeof new CSSStyleSheet().replaceSync === 'function';
@@ -2255,9 +3483,10 @@ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2255
3483
  catch (e) { }
2256
3484
  return false;
2257
3485
  })()
2258
- ;
3486
+ : false;
2259
3487
  const queueDomReads = [];
2260
3488
  const queueDomWrites = [];
3489
+ const queueDomWritesLow = [];
2261
3490
  const queueTask = (queue, write) => (cb) => {
2262
3491
  queue.push(cb);
2263
3492
  if (!queuePending) {
@@ -2281,13 +3510,53 @@ const consume = (queue) => {
2281
3510
  }
2282
3511
  queue.length = 0;
2283
3512
  };
3513
+ const consumeTimeout = (queue, timeout) => {
3514
+ let i = 0;
3515
+ let ts = 0;
3516
+ while (i < queue.length && (ts = performance.now()) < timeout) {
3517
+ try {
3518
+ queue[i++](ts);
3519
+ }
3520
+ catch (e) {
3521
+ consoleError(e);
3522
+ }
3523
+ }
3524
+ if (i === queue.length) {
3525
+ queue.length = 0;
3526
+ }
3527
+ else if (i !== 0) {
3528
+ queue.splice(0, i);
3529
+ }
3530
+ };
2284
3531
  const flush = () => {
3532
+ if (BUILD.asyncQueue) {
3533
+ queueCongestion++;
3534
+ }
2285
3535
  // always force a bunch of medium callbacks to run, but still have
2286
3536
  // a throttle on how many can run in a certain time
2287
3537
  // DOM READS!!!
2288
3538
  consume(queueDomReads);
2289
3539
  // DOM WRITES!!!
2290
- {
3540
+ if (BUILD.asyncQueue) {
3541
+ const timeout = (plt.$flags$ & 6 /* PLATFORM_FLAGS.queueMask */) === 2 /* PLATFORM_FLAGS.appLoaded */
3542
+ ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0))
3543
+ : Infinity;
3544
+ consumeTimeout(queueDomWrites, timeout);
3545
+ consumeTimeout(queueDomWritesLow, timeout);
3546
+ if (queueDomWrites.length > 0) {
3547
+ queueDomWritesLow.push(...queueDomWrites);
3548
+ queueDomWrites.length = 0;
3549
+ }
3550
+ if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
3551
+ // still more to do yet, but we've run out of time
3552
+ // let's let this thing cool off and try again in the next tick
3553
+ plt.raf(flush);
3554
+ }
3555
+ else {
3556
+ queueCongestion = 0;
3557
+ }
3558
+ }
3559
+ else {
2291
3560
  consume(queueDomWrites);
2292
3561
  if ((queuePending = queueDomReads.length > 0)) {
2293
3562
  // still more to do yet, but we've run out of time
@@ -2297,6 +3566,73 @@ const flush = () => {
2297
3566
  }
2298
3567
  };
2299
3568
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
3569
+ const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
2300
3570
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2301
3571
 
2302
- export { Fragment as F, Host as H, getRenderingRef as a, bootstrapLazy as b, createEvent as c, forceUpdate as f, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
3572
+ const StencilCore = /*#__PURE__*/Object.freeze({
3573
+ __proto__: null,
3574
+ Build: Build,
3575
+ CSS: CSS,
3576
+ Context: Context,
3577
+ Fragment: Fragment,
3578
+ H: H,
3579
+ HTMLElement: H,
3580
+ Host: Host,
3581
+ STENCIL_DEV_MODE: STENCIL_DEV_MODE,
3582
+ addHostEventListeners: addHostEventListeners,
3583
+ bootstrapLazy: bootstrapLazy,
3584
+ cmpModules: cmpModules,
3585
+ connectedCallback: connectedCallback,
3586
+ consoleDevError: consoleDevError,
3587
+ consoleDevInfo: consoleDevInfo,
3588
+ consoleDevWarn: consoleDevWarn,
3589
+ consoleError: consoleError,
3590
+ createEvent: createEvent,
3591
+ defineCustomElement: defineCustomElement,
3592
+ disconnectedCallback: disconnectedCallback,
3593
+ doc: doc,
3594
+ forceModeUpdate: forceModeUpdate,
3595
+ forceUpdate: forceUpdate,
3596
+ getAssetPath: getAssetPath,
3597
+ getConnect: getConnect,
3598
+ getContext: getContext,
3599
+ getElement: getElement,
3600
+ getHostRef: getHostRef,
3601
+ getMode: getMode,
3602
+ getRenderingRef: getRenderingRef,
3603
+ getValue: getValue,
3604
+ h: h,
3605
+ insertVdomAnnotations: insertVdomAnnotations,
3606
+ isMemberInElement: isMemberInElement,
3607
+ loadModule: loadModule,
3608
+ modeResolutionChain: modeResolutionChain,
3609
+ nextTick: nextTick,
3610
+ parsePropertyValue: parsePropertyValue,
3611
+ plt: plt,
3612
+ postUpdateComponent: postUpdateComponent,
3613
+ promiseResolve: promiseResolve,
3614
+ proxyComponent: proxyComponent,
3615
+ proxyCustomElement: proxyCustomElement,
3616
+ readTask: readTask,
3617
+ registerHost: registerHost,
3618
+ registerInstance: registerInstance,
3619
+ renderVdom: renderVdom,
3620
+ setAssetPath: setAssetPath,
3621
+ setErrorHandler: setErrorHandler,
3622
+ setMode: setMode,
3623
+ setNonce: setNonce,
3624
+ setPlatformHelpers: setPlatformHelpers,
3625
+ setPlatformOptions: setPlatformOptions,
3626
+ setValue: setValue,
3627
+ styles: styles,
3628
+ supportsConstructableStylesheets: supportsConstructableStylesheets,
3629
+ supportsListenerOptions: supportsListenerOptions,
3630
+ supportsShadow: supportsShadow,
3631
+ win: win,
3632
+ writeTask: writeTask,
3633
+ BUILD: BUILD,
3634
+ Env: Env,
3635
+ NAMESPACE: NAMESPACE
3636
+ });
3637
+
3638
+ export { BUILD as B, CSS as C, Fragment as F, H, NAMESPACE as N, StencilCore as S, plt as a, bootstrapLazy as b, consoleDevInfo as c, doc as d, createEvent as e, Host as f, getElement as g, h, forceUpdate as i, promiseResolve as p, registerInstance as r, setNonce as s, win as w };