@rededor/cura 0.5.0 → 0.5.2

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 (221) hide show
  1. package/dist/cjs/{app-globals-0e3b7fc6.js → app-globals-2988084b.js} +5 -5
  2. package/dist/cjs/app-globals-2988084b.js.map +1 -0
  3. package/dist/cjs/cura-accordion_8.cjs.entry.js +452 -0
  4. package/dist/cjs/cura-accordion_8.cjs.entry.js.map +1 -0
  5. package/dist/cjs/cura-button-outline.cjs.entry.js +83 -0
  6. package/dist/cjs/cura-button-outline.cjs.entry.js.map +1 -0
  7. package/dist/cjs/cura-button-transparent.cjs.entry.js +83 -0
  8. package/dist/cjs/cura-button-transparent.cjs.entry.js.map +1 -0
  9. package/dist/cjs/cura-display.cjs.entry.js +74 -0
  10. package/dist/cjs/cura-display.cjs.entry.js.map +1 -0
  11. package/dist/cjs/cura-icons-view.cjs.entry.js +29 -0
  12. package/dist/cjs/cura-icons-view.cjs.entry.js.map +1 -0
  13. package/dist/cjs/cura-label.cjs.entry.js +69 -0
  14. package/dist/cjs/cura-label.cjs.entry.js.map +1 -0
  15. package/dist/cjs/cura.cjs.js +3 -3
  16. package/dist/cjs/{index-72217b50.js → index-404d93e9.js} +247 -3
  17. package/dist/cjs/index-404d93e9.js.map +1 -0
  18. package/dist/cjs/index.cjs.js +7 -0
  19. package/dist/cjs/index.cjs.js.map +1 -1
  20. package/dist/cjs/loader.cjs.js +3 -3
  21. package/dist/collection/api/cura-api.type.js.map +1 -1
  22. package/dist/collection/api/modules/cura-theme-breakpoints-module.js +1 -1
  23. package/dist/collection/api/modules/cura-theme-breakpoints-module.js.map +1 -1
  24. package/dist/collection/api/modules/cura-theme-colors-module.js +1 -1
  25. package/dist/collection/api/modules/cura-theme-colors-module.js.map +1 -1
  26. package/dist/collection/api/theme-presets/static.js +2 -2
  27. package/dist/collection/api/theme-presets/static.js.map +1 -1
  28. package/dist/collection/collection-manifest.json +1 -0
  29. package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js +1 -1
  30. package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js.map +1 -1
  31. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.css +10 -6
  32. package/dist/collection/components/buttons/cura-button/cura-button.js +4 -3
  33. package/dist/collection/components/buttons/cura-button/cura-button.js.map +1 -1
  34. package/dist/collection/components/buttons/cura-button/cura-button.stories.js +1 -1
  35. package/dist/collection/components/buttons/cura-button/cura-button.stories.js.map +1 -1
  36. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +4 -3
  37. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js.map +1 -1
  38. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js +1 -1
  39. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js.map +1 -1
  40. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +4 -3
  41. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js.map +1 -1
  42. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js +1 -1
  43. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js.map +1 -1
  44. package/dist/collection/components/cura-icon/cura-icon.stories.js +1 -1
  45. package/dist/collection/components/cura-icon/cura-icon.stories.js.map +1 -1
  46. package/dist/collection/components/cura-icons-view/cura-icons-view.stories.js +1 -1
  47. package/dist/collection/components/cura-icons-view/cura-icons-view.stories.js.map +1 -1
  48. package/dist/collection/components/cura-page-template/cura-page-template.css +13 -9
  49. package/dist/collection/components/forms/cura-label/cura-label.css +70 -0
  50. package/dist/collection/components/forms/cura-label/cura-label.js +190 -0
  51. package/dist/collection/components/forms/cura-label/cura-label.js.map +1 -0
  52. package/dist/collection/components/forms/cura-label/cura-label.stories.js +137 -0
  53. package/dist/collection/components/forms/cura-label/cura-label.stories.js.map +1 -0
  54. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.stories.js +1 -1
  55. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.stories.js.map +1 -1
  56. package/dist/collection/components/text/cura-display/cura-display.css +21 -38
  57. package/dist/collection/components/text/cura-display/cura-display.js +80 -49
  58. package/dist/collection/components/text/cura-display/cura-display.js.map +1 -1
  59. package/dist/collection/components/text/cura-display/cura-display.stories.js +79 -34
  60. package/dist/collection/components/text/cura-display/cura-display.stories.js.map +1 -1
  61. package/dist/collection/components/text/cura-heading/cura-heading.css +50 -24
  62. package/dist/collection/components/text/cura-heading/cura-heading.js +94 -39
  63. package/dist/collection/components/text/cura-heading/cura-heading.js.map +1 -1
  64. package/dist/collection/components/text/cura-heading/cura-heading.stories.js +93 -37
  65. package/dist/collection/components/text/cura-heading/cura-heading.stories.js.map +1 -1
  66. package/dist/collection/components/text/cura-paragraph/cura-paragraph.css +37 -38
  67. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +62 -41
  68. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js.map +1 -1
  69. package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js +79 -47
  70. package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js.map +1 -1
  71. package/dist/collection/index.js +3 -1
  72. package/dist/collection/index.js.map +1 -1
  73. package/dist/components/cura-accordion-item.js +1 -1
  74. package/dist/components/cura-accordion-item.js.map +1 -1
  75. package/dist/components/cura-button-outline.js +1 -1
  76. package/dist/components/cura-button-outline.js.map +1 -1
  77. package/dist/components/cura-button-transparent.js +1 -1
  78. package/dist/components/cura-button-transparent.js.map +1 -1
  79. package/dist/components/cura-button.js +1 -1
  80. package/dist/components/cura-button.js.map +1 -1
  81. package/dist/components/cura-display.js +41 -35
  82. package/dist/components/cura-display.js.map +1 -1
  83. package/dist/components/cura-heading.js +34 -21
  84. package/dist/components/cura-heading.js.map +1 -1
  85. package/dist/components/cura-label.d.ts +11 -0
  86. package/dist/components/cura-label.js +91 -0
  87. package/dist/components/cura-label.js.map +1 -0
  88. package/dist/components/cura-page-template.js +1 -1
  89. package/dist/components/cura-page-template.js.map +1 -1
  90. package/dist/components/cura-paragraph.js +25 -23
  91. package/dist/components/cura-paragraph.js.map +1 -1
  92. package/dist/components/index.js +11 -5
  93. package/dist/components/index.js.map +1 -1
  94. package/dist/cura/cura.esm.js +1 -1
  95. package/dist/cura/cura.esm.js.map +1 -1
  96. package/dist/cura/cura.js +1 -1
  97. package/dist/cura/index.esm.js +1 -1
  98. package/dist/cura/index.esm.js.map +1 -1
  99. package/dist/cura/p-03047b3e.entry.js +2 -0
  100. package/dist/cura/p-03047b3e.entry.js.map +1 -0
  101. package/dist/cura/p-0c79c54e.entry.js +2 -0
  102. package/dist/cura/p-0c79c54e.entry.js.map +1 -0
  103. package/dist/cura/p-120926c5.system.js +2 -0
  104. package/dist/cura/p-120926c5.system.js.map +1 -0
  105. package/dist/cura/p-223924fb.system.entry.js +2 -0
  106. package/dist/cura/p-223924fb.system.entry.js.map +1 -0
  107. package/dist/cura/p-46d20db3.js +3 -0
  108. package/dist/cura/p-46d20db3.js.map +1 -0
  109. package/dist/cura/p-48426f60.system.js +2 -0
  110. package/dist/cura/p-48426f60.system.js.map +1 -0
  111. package/dist/cura/p-49813052.entry.js +2 -0
  112. package/dist/cura/p-49813052.entry.js.map +1 -0
  113. package/dist/cura/p-4bdbcdf0.system.entry.js +2 -0
  114. package/dist/cura/p-4bdbcdf0.system.entry.js.map +1 -0
  115. package/dist/cura/p-7c8f3c77.system.entry.js +2 -0
  116. package/dist/cura/p-7c8f3c77.system.entry.js.map +1 -0
  117. package/dist/cura/p-8b18b5f7.system.js +2 -0
  118. package/dist/cura/p-8b18b5f7.system.js.map +1 -0
  119. package/dist/cura/p-91b0f78e.entry.js +2 -0
  120. package/dist/cura/p-91b0f78e.entry.js.map +1 -0
  121. package/dist/cura/p-a0395f90.entry.js +2 -0
  122. package/dist/cura/p-a0395f90.entry.js.map +1 -0
  123. package/dist/cura/p-a7ef255f.entry.js +2 -0
  124. package/dist/cura/p-a7ef255f.entry.js.map +1 -0
  125. package/dist/cura/p-c0c00396.system.js +3 -0
  126. package/dist/cura/p-c0c00396.system.js.map +1 -0
  127. package/dist/cura/p-ca054b07.system.entry.js +2 -0
  128. package/dist/cura/p-ca054b07.system.entry.js.map +1 -0
  129. package/dist/cura/p-d47b9cfe.system.entry.js +2 -0
  130. package/dist/cura/p-d47b9cfe.system.entry.js.map +1 -0
  131. package/dist/cura/p-f8fffdc1.js +2 -0
  132. package/dist/cura/p-f8fffdc1.js.map +1 -0
  133. package/dist/cura/p-fc77814b.system.entry.js +2 -0
  134. package/dist/cura/p-fc77814b.system.entry.js.map +1 -0
  135. package/dist/esm/{app-globals-cc003eaf.js → app-globals-29001758.js} +5 -5
  136. package/dist/esm/app-globals-29001758.js.map +1 -0
  137. package/dist/esm/cura-accordion_8.entry.js +441 -0
  138. package/dist/esm/cura-accordion_8.entry.js.map +1 -0
  139. package/dist/esm/cura-button-outline.entry.js +79 -0
  140. package/dist/esm/cura-button-outline.entry.js.map +1 -0
  141. package/dist/esm/cura-button-transparent.entry.js +79 -0
  142. package/dist/esm/cura-button-transparent.entry.js.map +1 -0
  143. package/dist/esm/cura-display.entry.js +70 -0
  144. package/dist/esm/cura-display.entry.js.map +1 -0
  145. package/dist/esm/cura-icons-view.entry.js +25 -0
  146. package/dist/esm/cura-icons-view.entry.js.map +1 -0
  147. package/dist/esm/cura-label.entry.js +65 -0
  148. package/dist/esm/cura-label.entry.js.map +1 -0
  149. package/dist/esm/cura.js +4 -4
  150. package/dist/esm/{index-9af0cdbd.js → index-d99da69e.js} +247 -3
  151. package/dist/esm/index-d99da69e.js.map +1 -0
  152. package/dist/esm/index.js +4 -0
  153. package/dist/esm/index.js.map +1 -1
  154. package/dist/esm/loader.js +4 -4
  155. package/dist/esm-es5/app-globals-29001758.js +2 -0
  156. package/dist/esm-es5/app-globals-29001758.js.map +1 -0
  157. package/dist/esm-es5/cura-accordion_8.entry.js +2 -0
  158. package/dist/esm-es5/cura-accordion_8.entry.js.map +1 -0
  159. package/dist/esm-es5/cura-button-outline.entry.js +2 -0
  160. package/dist/esm-es5/cura-button-outline.entry.js.map +1 -0
  161. package/dist/esm-es5/cura-button-transparent.entry.js +2 -0
  162. package/dist/esm-es5/cura-button-transparent.entry.js.map +1 -0
  163. package/dist/esm-es5/cura-display.entry.js +2 -0
  164. package/dist/esm-es5/cura-display.entry.js.map +1 -0
  165. package/dist/esm-es5/cura-icons-view.entry.js +2 -0
  166. package/dist/esm-es5/cura-icons-view.entry.js.map +1 -0
  167. package/dist/esm-es5/cura-label.entry.js +2 -0
  168. package/dist/esm-es5/cura-label.entry.js.map +1 -0
  169. package/dist/esm-es5/cura.js +1 -1
  170. package/dist/esm-es5/cura.js.map +1 -1
  171. package/dist/esm-es5/index-d99da69e.js +3 -0
  172. package/dist/esm-es5/index-d99da69e.js.map +1 -0
  173. package/dist/esm-es5/index.js +1 -1
  174. package/dist/esm-es5/index.js.map +1 -1
  175. package/dist/esm-es5/loader.js +1 -1
  176. package/dist/esm-es5/loader.js.map +1 -1
  177. package/dist/types/api/cura-api.type.d.ts +1 -0
  178. package/dist/types/components/buttons/cura-button/cura-button.d.ts +1 -1
  179. package/dist/types/components/buttons/cura-button-outline/cura-button-outline.d.ts +1 -1
  180. package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.d.ts +1 -1
  181. package/dist/types/components/forms/cura-label/cura-label.d.ts +54 -0
  182. package/dist/types/components/forms/cura-label/cura-label.stories.d.ts +126 -0
  183. package/dist/types/components/text/cura-display/cura-display.d.ts +29 -18
  184. package/dist/types/components/text/cura-display/cura-display.stories.d.ts +52 -14
  185. package/dist/types/components/text/cura-heading/cura-heading.d.ts +34 -17
  186. package/dist/types/components/text/cura-heading/cura-heading.stories.d.ts +58 -6
  187. package/dist/types/components/text/cura-paragraph/cura-paragraph.d.ts +24 -12
  188. package/dist/types/components/text/cura-paragraph/cura-paragraph.stories.d.ts +47 -9
  189. package/dist/types/components.d.ts +145 -52
  190. package/dist/types/index.d.ts +9 -0
  191. package/package.json +2 -4
  192. package/dist/cjs/app-globals-0e3b7fc6.js.map +0 -1
  193. package/dist/cjs/cura-accordion_12.cjs.entry.js +0 -674
  194. package/dist/cjs/cura-accordion_12.cjs.entry.js.map +0 -1
  195. package/dist/cjs/index-72217b50.js.map +0 -1
  196. package/dist/cura/p-2cbf52f1.js +0 -3
  197. package/dist/cura/p-2cbf52f1.js.map +0 -1
  198. package/dist/cura/p-4cdbc8a1.system.entry.js +0 -2
  199. package/dist/cura/p-4cdbc8a1.system.entry.js.map +0 -1
  200. package/dist/cura/p-50ea2036.system.js +0 -2
  201. package/dist/cura/p-50ea2036.system.js.map +0 -1
  202. package/dist/cura/p-788e035b.system.js +0 -2
  203. package/dist/cura/p-788e035b.system.js.map +0 -1
  204. package/dist/cura/p-8da635b7.system.js +0 -3
  205. package/dist/cura/p-8da635b7.system.js.map +0 -1
  206. package/dist/cura/p-c54ce246.entry.js +0 -2
  207. package/dist/cura/p-c54ce246.entry.js.map +0 -1
  208. package/dist/cura/p-d5c64a5f.js +0 -2
  209. package/dist/cura/p-d5c64a5f.js.map +0 -1
  210. package/dist/cura/p-f4232daa.system.js +0 -2
  211. package/dist/cura/p-f4232daa.system.js.map +0 -1
  212. package/dist/esm/app-globals-cc003eaf.js.map +0 -1
  213. package/dist/esm/cura-accordion_12.entry.js +0 -659
  214. package/dist/esm/cura-accordion_12.entry.js.map +0 -1
  215. package/dist/esm/index-9af0cdbd.js.map +0 -1
  216. package/dist/esm-es5/app-globals-cc003eaf.js +0 -2
  217. package/dist/esm-es5/app-globals-cc003eaf.js.map +0 -1
  218. package/dist/esm-es5/cura-accordion_12.entry.js +0 -2
  219. package/dist/esm-es5/cura-accordion_12.entry.js.map +0 -1
  220. package/dist/esm-es5/index-9af0cdbd.js +0 -3
  221. package/dist/esm-es5/index-9af0cdbd.js.map +0 -1
@@ -30,6 +30,13 @@ const uniqueTime = (key, measureText) => {
30
30
  };
31
31
  }
32
32
  };
33
+ const CONTENT_REF_ID = 'r';
34
+ const ORG_LOCATION_ID = 'o';
35
+ const SLOT_NODE_ID = 's';
36
+ const TEXT_NODE_ID = 't';
37
+ const HYDRATE_ID = 's-id';
38
+ const HYDRATED_STYLE_ID = 'sty-id';
39
+ const HYDRATE_CHILD_ID = 'c-id';
33
40
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
34
41
  const XLINK_NS = 'http://www.w3.org/1999/xlink';
35
42
  /**
@@ -167,6 +174,211 @@ const Host = {};
167
174
  * @returns whether it's a Host node or not
168
175
  */
169
176
  const isHost = (node) => node && node.$tag$ === Host;
177
+ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
178
+ const endHydrate = createTime('hydrateClient', tagName);
179
+ const shadowRoot = hostElm.shadowRoot;
180
+ const childRenderNodes = [];
181
+ const slotNodes = [];
182
+ const shadowRootNodes = shadowRoot ? [] : null;
183
+ const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
184
+ if (!plt.$orgLocNodes$) {
185
+ initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
186
+ }
187
+ hostElm[HYDRATE_ID] = hostId;
188
+ hostElm.removeAttribute(HYDRATE_ID);
189
+ clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
190
+ childRenderNodes.map((c) => {
191
+ const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
192
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
193
+ const node = c.$elm$;
194
+ if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
195
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
196
+ }
197
+ if (!shadowRoot) {
198
+ node['s-hn'] = tagName;
199
+ if (orgLocationNode) {
200
+ node['s-ol'] = orgLocationNode;
201
+ node['s-ol']['s-nr'] = node;
202
+ }
203
+ }
204
+ plt.$orgLocNodes$.delete(orgLocationId);
205
+ });
206
+ if (shadowRoot) {
207
+ shadowRootNodes.map((shadowRootNode) => {
208
+ if (shadowRootNode) {
209
+ shadowRoot.appendChild(shadowRootNode);
210
+ }
211
+ });
212
+ }
213
+ endHydrate();
214
+ };
215
+ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
216
+ let childNodeType;
217
+ let childIdSplt;
218
+ let childVNode;
219
+ let i;
220
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
221
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
222
+ if (childNodeType) {
223
+ // got the node data from the element's attribute
224
+ // `${hostId}.${nodeId}.${depth}.${index}`
225
+ childIdSplt = childNodeType.split('.');
226
+ if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
227
+ childVNode = {
228
+ $flags$: 0,
229
+ $hostId$: childIdSplt[0],
230
+ $nodeId$: childIdSplt[1],
231
+ $depth$: childIdSplt[2],
232
+ $index$: childIdSplt[3],
233
+ $tag$: node.tagName.toLowerCase(),
234
+ $elm$: node,
235
+ $attrs$: null,
236
+ $children$: null,
237
+ $key$: null,
238
+ $name$: null,
239
+ $text$: null,
240
+ };
241
+ childRenderNodes.push(childVNode);
242
+ node.removeAttribute(HYDRATE_CHILD_ID);
243
+ // this is a new child vnode
244
+ // so ensure its parent vnode has the vchildren array
245
+ if (!parentVNode.$children$) {
246
+ parentVNode.$children$ = [];
247
+ }
248
+ // add our child vnode to a specific index of the vnode's children
249
+ parentVNode.$children$[childVNode.$index$] = childVNode;
250
+ // this is now the new parent vnode for all the next child checks
251
+ parentVNode = childVNode;
252
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
253
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
254
+ }
255
+ }
256
+ }
257
+ // recursively drill down, end to start so we can remove nodes
258
+ for (i = node.childNodes.length - 1; i >= 0; i--) {
259
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
260
+ }
261
+ if (node.shadowRoot) {
262
+ // keep drilling down through the shadow root nodes
263
+ for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
264
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
265
+ }
266
+ }
267
+ }
268
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
269
+ // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
270
+ childIdSplt = node.nodeValue.split('.');
271
+ if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
272
+ // comment node for either the host id or a 0 host id
273
+ childNodeType = childIdSplt[0];
274
+ childVNode = {
275
+ $flags$: 0,
276
+ $hostId$: childIdSplt[1],
277
+ $nodeId$: childIdSplt[2],
278
+ $depth$: childIdSplt[3],
279
+ $index$: childIdSplt[4],
280
+ $elm$: node,
281
+ $attrs$: null,
282
+ $children$: null,
283
+ $key$: null,
284
+ $name$: null,
285
+ $tag$: null,
286
+ $text$: null,
287
+ };
288
+ if (childNodeType === TEXT_NODE_ID) {
289
+ childVNode.$elm$ = node.nextSibling;
290
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
291
+ childVNode.$text$ = childVNode.$elm$.textContent;
292
+ childRenderNodes.push(childVNode);
293
+ // remove the text comment since it's no longer needed
294
+ node.remove();
295
+ if (!parentVNode.$children$) {
296
+ parentVNode.$children$ = [];
297
+ }
298
+ parentVNode.$children$[childVNode.$index$] = childVNode;
299
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
300
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
301
+ }
302
+ }
303
+ }
304
+ else if (childVNode.$hostId$ === hostId) {
305
+ // this comment node is specifcally for this host id
306
+ if (childNodeType === SLOT_NODE_ID) {
307
+ // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
308
+ childVNode.$tag$ = 'slot';
309
+ if (childIdSplt[5]) {
310
+ node['s-sn'] = childVNode.$name$ = childIdSplt[5];
311
+ }
312
+ else {
313
+ node['s-sn'] = '';
314
+ }
315
+ node['s-sr'] = true;
316
+ if (shadowRootNodes) {
317
+ // browser support shadowRoot and this is a shadow dom component
318
+ // create an actual slot element
319
+ childVNode.$elm$ = doc.createElement(childVNode.$tag$);
320
+ if (childVNode.$name$) {
321
+ // add the slot name attribute
322
+ childVNode.$elm$.setAttribute('name', childVNode.$name$);
323
+ }
324
+ // insert the new slot element before the slot comment
325
+ node.parentNode.insertBefore(childVNode.$elm$, node);
326
+ // remove the slot comment since it's not needed for shadow
327
+ node.remove();
328
+ if (childVNode.$depth$ === '0') {
329
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
330
+ }
331
+ }
332
+ slotNodes.push(childVNode);
333
+ if (!parentVNode.$children$) {
334
+ parentVNode.$children$ = [];
335
+ }
336
+ parentVNode.$children$[childVNode.$index$] = childVNode;
337
+ }
338
+ else if (childNodeType === CONTENT_REF_ID) {
339
+ // `${CONTENT_REF_ID}.${hostId}`;
340
+ if (shadowRootNodes) {
341
+ // remove the content ref comment since it's not needed for shadow
342
+ node.remove();
343
+ }
344
+ else {
345
+ hostElm['s-cr'] = node;
346
+ node['s-cn'] = true;
347
+ }
348
+ }
349
+ }
350
+ }
351
+ }
352
+ else if (parentVNode && parentVNode.$tag$ === 'style') {
353
+ const vnode = newVNode(null, node.textContent);
354
+ vnode.$elm$ = node;
355
+ vnode.$index$ = '0';
356
+ parentVNode.$children$ = [vnode];
357
+ }
358
+ };
359
+ const initializeDocumentHydrate = (node, orgLocNodes) => {
360
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
361
+ let i = 0;
362
+ for (; i < node.childNodes.length; i++) {
363
+ initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
364
+ }
365
+ if (node.shadowRoot) {
366
+ for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
367
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
368
+ }
369
+ }
370
+ }
371
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
372
+ const childIdSplt = node.nodeValue.split('.');
373
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
374
+ orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
375
+ node.nodeValue = '';
376
+ // useful to know if the original location is
377
+ // the root light-dom of a shadow dom component
378
+ node['s-en'] = childIdSplt[3];
379
+ }
380
+ }
381
+ };
170
382
  /**
171
383
  * Parse a new property value for a given property type.
172
384
  *
@@ -260,7 +472,12 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
260
472
  rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
261
473
  }
262
474
  if (!appliedStyles.has(scopeId)) {
263
- {
475
+ if (styleContainerNode.host &&
476
+ (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
477
+ // This is only happening on native shadow-dom, do not needs CSS var shim
478
+ styleElm.innerHTML = style;
479
+ }
480
+ else {
264
481
  // TODO(STENCIL-659): Remove code implementing the CSS variable shim
265
482
  if (plt.$cssShim$) {
266
483
  // TODO(STENCIL-659): Remove code implementing the CSS variable shim
@@ -319,6 +536,7 @@ const attachStyles = (hostRef) => {
319
536
  endAttachStyles();
320
537
  };
321
538
  const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
539
+ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
322
540
  /**
323
541
  * Production setAccessor() function based on Preact by
324
542
  * Jason Miller (@developit)
@@ -1667,7 +1885,18 @@ const connectedCallback = (elm) => {
1667
1885
  if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1668
1886
  // first time this component has connected
1669
1887
  hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1888
+ let hostId;
1670
1889
  {
1890
+ hostId = elm.getAttribute(HYDRATE_ID);
1891
+ if (hostId) {
1892
+ if (supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1893
+ const scopeId = addStyle(elm.shadowRoot, cmpMeta);
1894
+ elm.classList.remove(scopeId + '-h', scopeId + '-s');
1895
+ }
1896
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
1897
+ }
1898
+ }
1899
+ if (!hostId) {
1671
1900
  // initUpdate
1672
1901
  // if the slot polyfill is required we'll need to put some nodes
1673
1902
  // in here to act as original content anchors as we move nodes around
@@ -1684,7 +1913,10 @@ const connectedCallback = (elm) => {
1684
1913
  while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1685
1914
  // climb up the ancestors looking for the first
1686
1915
  // component that hasn't finished its lifecycle update yet
1687
- if (ancestorComponent['s-p']) {
1916
+ if ((ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
1917
+ ancestorComponent.hasAttribute('s-id') &&
1918
+ ancestorComponent['s-p']) ||
1919
+ ancestorComponent['s-p']) {
1688
1920
  // we found this components first ancestor component
1689
1921
  // keep a reference to this component's ancestor component
1690
1922
  attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
@@ -1750,10 +1982,22 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1750
1982
  const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1751
1983
  const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1752
1984
  const deferredConnectedCallbacks = [];
1985
+ const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
1753
1986
  let appLoadFallback;
1754
1987
  let isBootstrapping = true;
1988
+ let i = 0;
1755
1989
  Object.assign(plt, options);
1756
1990
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1991
+ {
1992
+ // If the app is already hydrated there is not point to disable the
1993
+ // async queue. This will improve the first input delay
1994
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
1995
+ }
1996
+ {
1997
+ for (; i < styles.length; i++) {
1998
+ registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
1999
+ }
2000
+ }
1757
2001
  lazyBundles.map((lazyBundle) => {
1758
2002
  lazyBundle[1].map((compactMeta) => {
1759
2003
  const cmpMeta = {
@@ -1969,4 +2213,4 @@ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1969
2213
 
1970
2214
  export { CSS as C, Host as H, promiseResolve as a, bootstrapLazy as b, getElement as g, h, plt as p, registerInstance as r, setNonce as s, win as w };
1971
2215
 
1972
- //# sourceMappingURL=index-9af0cdbd.js.map
2216
+ //# sourceMappingURL=index-d99da69e.js.map