@torpor/view 0.1.5 → 0.1.7

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 (361) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/compile.cjs +311 -260
  3. package/dist/compile.cjs.map +1 -1
  4. package/dist/compile.js +311 -260
  5. package/dist/compile.js.map +1 -1
  6. package/dist/index.cjs +148 -96
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +86 -29
  9. package/dist/index.d.ts +86 -29
  10. package/dist/index.js +144 -96
  11. package/dist/index.js.map +1 -1
  12. package/dist/metafile-cjs.json +1 -1
  13. package/dist/metafile-esm.json +1 -1
  14. package/package.json +3 -3
  15. package/src/compile/build/client/buildAddFragment.ts +5 -1
  16. package/src/compile/build/client/buildCode.ts +3 -0
  17. package/src/compile/build/client/buildComponentNode.ts +1 -0
  18. package/src/compile/build/client/buildControlNode.ts +2 -1
  19. package/src/compile/build/client/buildFragment.ts +54 -21
  20. package/src/compile/build/client/buildRootNode.ts +5 -1
  21. package/src/compile/build/server/buildServerComponentNode.ts +2 -4
  22. package/src/compile/build/server/buildServerControlNode.ts +2 -1
  23. package/src/compile/build/server/buildServerForNode.ts +2 -2
  24. package/src/compile/build/server/buildServerIfNode.ts +4 -0
  25. package/src/compile/build/server/buildServerRootNode.ts +3 -1
  26. package/src/compile/build/server/buildServerSwitchNode.ts +4 -0
  27. package/src/compile/parse/ParseStatus.ts +2 -1
  28. package/src/compile/parse/parseCode.ts +5 -8
  29. package/src/compile/parse/parseControl.ts +19 -6
  30. package/src/compile/parse/parseMarkup.ts +15 -8
  31. package/src/compile/types/comments.ts +2 -2
  32. package/src/compile/types/nodes/OperationType.ts +2 -1
  33. package/src/debug/printNode.ts +54 -36
  34. package/src/index.ts +7 -1
  35. package/src/render/addFragment.ts +5 -4
  36. package/src/render/clearLayoutSlot.ts +6 -0
  37. package/src/render/clearRange.ts +1 -1
  38. package/src/render/hydrationMarkers.ts +2 -2
  39. package/src/render/isComment.ts +2 -2
  40. package/src/render/isText.ts +3 -0
  41. package/src/render/nodeAnchor.ts +52 -27
  42. package/src/render/nodeCheckHydrationBreak.ts +25 -0
  43. package/src/render/nodeChild.ts +12 -7
  44. package/src/render/nodeNext.ts +16 -25
  45. package/src/render/nodeReanchor.ts +18 -0
  46. package/src/render/nodeRoot.ts +26 -9
  47. package/src/render/nodeSkip.ts +20 -0
  48. package/src/render/runLayoutSlot.ts +26 -0
  49. package/test/attributes/components/output/Attributes-client.ts +7 -4
  50. package/test/attributes/components/output/Attributes-server.ts +1 -1
  51. package/test/attributes/components/temp/{Attributes-client-7b8f7b9996208e8d2d0a12d4f4a40a73df63d9d8.ts → Attributes-client-4620a40099e57a7fdaab895b204d85881f6dbfb7.ts} +7 -4
  52. package/test/attributes/components/temp/{Attributes-server-a1289434a5a801be1d63bfc85b621579e06452f0.ts → Attributes-server-80f9f58fd6cb30df11867386d4f0b15b44401ebe.ts} +1 -1
  53. package/test/await/components/output/Await-client.ts +21 -15
  54. package/test/await/components/output/Await-server.ts +2 -2
  55. package/test/await/components/temp/{Await-client-a7bf000bf2b59a3d5251a0fa18ec79890a52a547.ts → Await-client-e2fc91352ed24b160650d7851d82375910bd28d6.ts} +21 -15
  56. package/test/await/components/temp/{Await-server-06cd2a3d8c7eb5bef026ffe2fb11793becf547c2.ts → Await-server-f02f39af3bb3344ca6b18a1d64d60b21913fba31.ts} +2 -2
  57. package/test/bind/components/output/BindComponent-client.ts +21 -12
  58. package/test/bind/components/output/BindComponent-server.ts +3 -3
  59. package/test/bind/components/output/BindText-client.ts +10 -8
  60. package/test/bind/components/output/BindText-server.ts +1 -1
  61. package/test/bind/components/temp/{BindComponent-client-a645474748485a878871c062ad69e6bcf35e6550.ts → BindComponent-client-c4dbd934eda6b8f9a7afc697b9d6dd3edc3a4a48.ts} +21 -12
  62. package/test/bind/components/temp/{BindComponent-server-c557e7aa944517ab87415b8bb35b41b0034254e7.ts → BindComponent-server-c630dee0bee6cea49d5eb8bea04979a737bb8f5e.ts} +3 -3
  63. package/test/bind/components/temp/{BindText-client-d5f7d721df55020ef337f660e5d278eb80fcc330.ts → BindText-client-134676d616abbad6b8a7ec48df0a2e38cbfe3b87.ts} +10 -8
  64. package/test/bind/components/temp/{BindText-server-4b94cdf60d9c9a2088306c4407e2ae30785169b0.ts → BindText-server-807a1ddcb68410b30429cb088d2e204ed6f585b2.ts} +1 -1
  65. package/test/buildHtml.ts +1 -1
  66. package/test/buildOutputFiles.ts +10 -1
  67. package/test/child-component/components/output/ParentChild-client.ts +20 -11
  68. package/test/child-component/components/output/ParentChild-server.ts +3 -3
  69. package/test/child-component/components/temp/{ParentChild-client-eaefb0cbfd251badab3c57ae2037d973f785a1b8.ts → ParentChild-client-16042a29846dbbeec5905f163bf29b6bb48dfd42.ts} +20 -11
  70. package/test/child-component/components/temp/{ParentChild-server-8f2fc556f87867e6e3393e2e9e6d696cda107b69.ts → ParentChild-server-a34a8b5acf1c00d1990f8ab7433599506265a45a.ts} +3 -3
  71. package/test/class/class.test.ts +1 -1
  72. package/test/class/components/output/Class-client.ts +30 -20
  73. package/test/class/components/output/Class-server.ts +4 -4
  74. package/test/class/components/temp/{Class-client-12f09850a5f8c27de6cf94c23a2b17aadbf66f01.ts → Class-client-71b655ee0cbda59527269a2fbf0b6d2a1176bbaa.ts} +30 -20
  75. package/test/class/components/temp/Class-server-daf30ffb1bacf9877e3385dc9a3eede61c972329.ts +40 -0
  76. package/test/component/components/output/Component-client.ts +12 -4
  77. package/test/component/components/output/Component-server.ts +2 -0
  78. package/test/component/components/output/Header-client.ts +7 -5
  79. package/test/component/components/output/Header-server.ts +1 -1
  80. package/test/component/components/temp/{Component-client-a2fb6f30fc340bac909b64cb4f5ac68cde376de3.ts → Component-client-2f4734d1288dc88d1d5aa532791199969351ec1d.ts} +12 -4
  81. package/test/component/components/temp/{Component-server-40be12cd528ccf768f1ad40ef2a435ad2b2a2d71.ts → Component-server-81012827b18e82d787d194a0a1a9d4e07311a336.ts} +2 -0
  82. package/test/component/components/temp/{Header-client-75cb4aa868295ac168c16ba7b275fbb5ab9256f9.ts → Header-client-903877003b220272b0cb5bfd62d7d748ad46c477.ts} +7 -5
  83. package/test/component/components/temp/{Header-server-f73307874bec34a95dcd152d7f83a3ad13a0f4ac.ts → Header-server-6969d20782edd8f99d4b5c5b7b5563ce26e6dc2d.ts} +1 -1
  84. package/test/console/components/output/Console-client.ts +6 -4
  85. package/test/console/components/output/Console-server.ts +1 -1
  86. package/test/console/components/temp/{Console-client-2f206752ce59e59fba9bb91263b4102fd515951e.ts → Console-client-4fa3b3679cee88bf6151185438e36d14010944b7.ts} +6 -4
  87. package/test/console/components/temp/{Console-server-b4b15f7a0d1d2b50d87bad4870e1b8d368707c04.ts → Console-server-cfb2208b130d5f15403df19ae8341aaa1c9ad33a.ts} +1 -1
  88. package/test/const/components/output/Const-client.ts +7 -5
  89. package/test/const/components/output/Const-server.ts +2 -2
  90. package/test/const/components/temp/{Const-client-536e8fdf18d6f4f7f23b2789de2330ecf62d7865.ts → Const-client-7dff2758c14bfbd208e301a702ae1781e6daba1b.ts} +7 -5
  91. package/test/const/components/temp/{Const-server-8f84096c03a19296425aee5d243af0734b70ca61.ts → Const-server-1cf6ed84f72d3b15b318b80937b8de1f2c0f188c.ts} +2 -2
  92. package/test/effects/components/output/For-client.ts +15 -9
  93. package/test/effects/components/output/For-server.ts +2 -2
  94. package/test/effects/components/output/If-client.ts +17 -11
  95. package/test/effects/components/output/If-server.ts +4 -4
  96. package/test/effects/components/output/NestedIf-client.ts +23 -15
  97. package/test/effects/components/output/NestedIf-server.ts +5 -5
  98. package/test/effects/components/temp/{For-client-d8d4e4424ec3238fe9f79cc907d673612b63bcdf.ts → For-client-56df708520a56e3461dd041d5fcf3a6d16d6c653.ts} +15 -9
  99. package/test/effects/components/temp/{For-server-1f853c161bea31a1a5b11b00d7a021b70c778066.ts → For-server-efe60939d185315f4c9b567b6867c6d5af14d9aa.ts} +2 -2
  100. package/test/effects/components/temp/{If-client-bb06988422395321bf298a75bf5563c6f750f776.ts → If-client-341b189ef35481d477325e09e9b2d3479b7a6dfc.ts} +17 -11
  101. package/test/effects/components/temp/{If-server-97e3cbe059306fc607985dcd1b187df3a278d979.ts → If-server-2424b7b812d350d7eb8ff9afb1146807217320cd.ts} +4 -4
  102. package/test/effects/components/temp/{NestedIf-client-dc880c1ec92e716ec730dfa0bac0e3d9265bdf27.ts → NestedIf-client-4c74efc133b9817ff106e6ffcf4065603030a596.ts} +23 -15
  103. package/test/effects/components/temp/{NestedIf-server-9f199a33bae5d5fe34920d6a419937537a2b18dc.ts → NestedIf-server-ab260586490cb5afed31377d2226bb5a1fc30e2d.ts} +5 -5
  104. package/test/events/components/output/Increment-client.ts +9 -7
  105. package/test/events/components/output/Increment-server.ts +1 -1
  106. package/test/events/components/temp/{Increment-client-41bd7bc91aac8c7a9bf73527c8f7ba1794b09ab3.ts → Increment-client-1b5f9e231c5c4fc059d77ca0da632719283e5ac4.ts} +9 -7
  107. package/test/events/components/temp/{Increment-server-bbf5ac93c4f73382c4262ae42f4cc836bcb8ac1b.ts → Increment-server-b084f43082e2ec31dbe5f9edc1cb6e37e4c8df9d.ts} +1 -1
  108. package/test/for/components/output/For-client.ts +15 -9
  109. package/test/for/components/output/For-server.ts +2 -2
  110. package/test/for/components/output/ForEscape-client.ts +19 -13
  111. package/test/for/components/output/ForEscape-server.ts +2 -2
  112. package/test/for/components/output/ForIn-client.ts +15 -9
  113. package/test/for/components/output/ForIn-server.ts +2 -2
  114. package/test/for/components/output/ForOf-client.ts +15 -9
  115. package/test/for/components/output/ForOf-server.ts +2 -2
  116. package/test/for/components/temp/{For-client-0be5994e98c07a3455cd8a18a2b1b8ef3605aba6.ts → For-client-1d8c7995d69e881e0c6e23e17feb4ee73e34f7c3.ts} +15 -9
  117. package/test/for/components/temp/{For-server-8490f15d02ae76b218feb7fa266415f44b2a4ab9.ts → For-server-3b6ead39728c79206203c519a215390d07d80f7e.ts} +2 -2
  118. package/test/for/components/temp/{ForEscape-client-a973a145e28b32ca55fe3dca53d885fcf5e11c37.ts → ForEscape-client-c4b46ddf79bcceb3d677baeb57ac85ec6bc5f565.ts} +19 -13
  119. package/test/for/components/temp/{ForEscape-server-375744ca1e10e5c8ed7dd6420beef72107e55568.ts → ForEscape-server-ed906c8cd593a0b467073ada415734de31dc38d9.ts} +2 -2
  120. package/test/for/components/temp/{ForIn-client-5cc25a98e10826e8477fe6f931d5d2bbd0b13c9f.ts → ForIn-client-b64e5ecc592f137f08fc6ab9da800732df94976e.ts} +15 -9
  121. package/test/for/components/temp/{ForIn-server-d68e82c048f7e0f1525f74724b91e5cd01cdc6a6.ts → ForIn-server-c8f13304a2ba235e091685256909fbfa50bdd5fd.ts} +2 -2
  122. package/test/for/components/temp/{ForOf-client-70b0d59ff72f1cffe2e0ac8523dd7ccdca4ffe39.ts → ForOf-client-4ef8193b2f0603a8edfcbe6c2d321a240211bdcd.ts} +15 -9
  123. package/test/for/components/temp/{ForOf-server-ac08d98dd249a3e64a366b8488450e6ce0d18def.ts → ForOf-server-8c2c33ca6595bf0a5e952ca9971e595e18446623.ts} +2 -2
  124. package/test/function/components/output/Function-client.ts +8 -6
  125. package/test/function/components/output/Function-server.ts +2 -2
  126. package/test/function/components/temp/{Function-client-b3ff029a821d47e1a2249a52dfb681f4b2e96232.ts → Function-client-4e2168306756eb927d5ed4b673334b357eecaa74.ts} +8 -6
  127. package/test/function/components/temp/{Function-server-2d32fbe35260c0948a135f287f131c5520e8bce7.ts → Function-server-2b19d0cd881c31dc67132107c6e322a18701c318.ts} +2 -2
  128. package/test/html/components/output/Html-client.ts +12 -6
  129. package/test/html/components/output/Html-server.ts +1 -1
  130. package/test/html/components/temp/{Html-client-766ba4a63f28f929ca16cd7d1640fe92f9b30792.ts → Html-client-2c3bae5ddb348adb88e332df9bad69714a88ddd1.ts} +12 -6
  131. package/test/html/components/temp/{Html-server-0a41da8b81bf833f331f3becdbac14be7ddc6c8c.ts → Html-server-d159b0ef04b1f65ae4f9e05a7b44b21e7aa14cf9.ts} +1 -1
  132. package/test/hydrateComponent.ts +1 -0
  133. package/test/if/components/IfAfterIf.torp +10 -12
  134. package/test/if/components/IfElse.torp +12 -11
  135. package/test/if/components/IfElseIf.torp +13 -15
  136. package/test/if/components/IfFalse.torp +10 -0
  137. package/test/if/components/IfNested.torp +11 -13
  138. package/test/if/components/output/IfAfterIf-client.ts +19 -13
  139. package/test/if/components/output/IfAfterIf-server.ts +4 -4
  140. package/test/if/components/output/IfElse-client.ts +17 -13
  141. package/test/if/components/output/IfElse-server.ts +4 -4
  142. package/test/if/components/output/IfElseIf-client.ts +19 -15
  143. package/test/if/components/output/IfElseIf-server.ts +5 -5
  144. package/test/if/components/output/IfFalse-client.ts +59 -0
  145. package/test/if/components/output/IfFalse-server.ts +21 -0
  146. package/test/if/components/output/IfNested-client.ts +25 -19
  147. package/test/if/components/output/IfNested-server.ts +6 -6
  148. package/test/if/components/temp/{IfAfterIf-client-49b6b8c42b0a351561f9f5f22c2ae2e844bf3b58.ts → IfAfterIf-client-e092f37a07f06c67501693a2028c3f7a809267a9.ts} +19 -13
  149. package/test/if/components/temp/{IfAfterIf-server-eb67cf1fcf6711882266219940a47bd4a66497f3.ts → IfAfterIf-server-a5005147e7902d1a5a048c9fe07feb9804eb6560.ts} +4 -4
  150. package/test/if/components/temp/{IfElse-client-e236d4a2e99262ff09675bc519c07e2826c0d70b.ts → IfElse-client-9b9b5cd2d58364c2792c6233dcf1a028c343741b.ts} +17 -13
  151. package/test/if/components/temp/{IfElse-server-c077e0e30f4d2adec41ab779198362d21542d055.ts → IfElse-server-80d93e5fc4ceba7a645f7081fa11b177dbe730d0.ts} +4 -4
  152. package/test/if/components/temp/{IfElseIf-client-b92106861f0c7ec3d09e3a42bb93d8f5bd4e3bdf.ts → IfElseIf-client-c6e0f7e55b7d2471527f7fbc673cdb1be41a548c.ts} +19 -15
  153. package/test/if/components/temp/{IfElseIf-server-67991eee3f56dc687cda600511c31396438e0a77.ts → IfElseIf-server-ddc7348705d51b02538301e0aa704130748992cf.ts} +5 -5
  154. package/test/if/components/temp/IfFalse-client-84249379a2b7b30baea5eeed2a64d4502763d002.ts +59 -0
  155. package/test/if/components/temp/IfFalse-server-e8385013cfdde584b43cc0d71311cbb417859116.ts +21 -0
  156. package/test/if/components/temp/{IfNested-client-f563ac1b16a2280e457557281c4925ed447a9cd7.ts → IfNested-client-6a536c2000ef72e8c289ad789b135d4b1e170b6e.ts} +25 -19
  157. package/test/if/components/temp/{IfNested-server-0a2a9643324ab73b02b310cad61ba87dab146ab2.ts → IfNested-server-285a5d8e0e0fcc8ccf421df152fdc00811782835.ts} +6 -6
  158. package/test/if/if-else-false.test.ts +54 -0
  159. package/test/if/{if-true.test.ts → if-else-true.test.ts} +5 -2
  160. package/test/if/if-false.test.ts +1 -4
  161. package/test/importComponent.ts +4 -0
  162. package/test/mount/components/output/Mount-client.ts +7 -4
  163. package/test/mount/components/output/Mount-server.ts +1 -1
  164. package/test/mount/components/temp/{Mount-client-36dbc95a61345a1b7dcf07e6b0c998af2afca691.ts → Mount-client-efa5c34fbfc7646e114a1a58f0814b6dff33e566.ts} +7 -4
  165. package/test/mount/components/temp/{Mount-server-8bef1924a731f3db63cb827be3938fec685e53af.ts → Mount-server-62f94f276c2d6c9048765a77b575cb21146917f1.ts} +1 -1
  166. package/test/on-mount/components/output/OnMount-client.ts +7 -4
  167. package/test/on-mount/components/output/OnMount-server.ts +1 -1
  168. package/test/on-mount/components/temp/{OnMount-client-21708a638d2939ee8b017f5dc819cee4748bde87.ts → OnMount-client-4bb62e8bf1fcd67798598fe03bf5455a57f0a6be.ts} +7 -4
  169. package/test/on-mount/components/temp/{OnMount-server-1758fe2b16972fca7d4b9bb49d9256fce99780eb.ts → OnMount-server-c531f718eb68754ea6c3001d5db9c07c511e434c.ts} +1 -1
  170. package/test/party/components/output/AnswerButton-client.ts +8 -6
  171. package/test/party/components/output/AnswerButton-server.ts +1 -1
  172. package/test/party/components/output/AnswerButtonApp-client.ts +14 -7
  173. package/test/party/components/output/AnswerButtonApp-server.ts +2 -2
  174. package/test/party/components/output/ColorSelect-client.ts +15 -10
  175. package/test/party/components/output/ColorSelect-server.ts +2 -2
  176. package/test/party/components/output/Colors-client.ts +15 -9
  177. package/test/party/components/output/Colors-server.ts +2 -2
  178. package/test/party/components/output/Counter-client.ts +8 -6
  179. package/test/party/components/output/Counter-server.ts +1 -1
  180. package/test/party/components/output/CssStyle-client.ts +6 -4
  181. package/test/party/components/output/CssStyle-server.ts +1 -1
  182. package/test/party/components/output/DoubleCount-client.ts +7 -5
  183. package/test/party/components/output/DoubleCount-server.ts +1 -1
  184. package/test/party/components/output/FunnyButton-client.ts +15 -9
  185. package/test/party/components/output/FunnyButton-server.ts +2 -2
  186. package/test/party/components/output/FunnyButtonApp-client.ts +20 -9
  187. package/test/party/components/output/FunnyButtonApp-server.ts +3 -3
  188. package/test/party/components/output/HelloWorld-client.ts +6 -4
  189. package/test/party/components/output/HelloWorld-server.ts +1 -1
  190. package/test/party/components/output/InputFocused-client.ts +7 -4
  191. package/test/party/components/output/InputFocused-server.ts +1 -1
  192. package/test/party/components/output/InputHello-client.ts +8 -6
  193. package/test/party/components/output/InputHello-server.ts +1 -1
  194. package/test/party/components/output/IsAvailable-client.ts +8 -6
  195. package/test/party/components/output/IsAvailable-server.ts +1 -1
  196. package/test/party/components/output/Name-client.ts +7 -5
  197. package/test/party/components/output/Name-server.ts +1 -1
  198. package/test/party/components/output/NameUpdate-client.ts +7 -5
  199. package/test/party/components/output/NameUpdate-server.ts +1 -1
  200. package/test/party/components/output/PageTitle-client.ts +7 -5
  201. package/test/party/components/output/PageTitle-server.ts +1 -1
  202. package/test/party/components/output/PickPill-client.ts +9 -7
  203. package/test/party/components/output/PickPill-server.ts +1 -1
  204. package/test/party/components/output/Time-client.ts +7 -5
  205. package/test/party/components/output/Time-server.ts +1 -1
  206. package/test/party/components/output/TrafficLight-client.ts +22 -17
  207. package/test/party/components/output/TrafficLight-server.ts +5 -5
  208. package/test/party/components/output/UserProfile-client.ts +10 -8
  209. package/test/party/components/output/UserProfile-server.ts +1 -1
  210. package/test/party/components/output/UserProfileApp-client.ts +12 -4
  211. package/test/party/components/output/UserProfileApp-server.ts +2 -0
  212. package/test/party/components/output/UserProfileContext-client.ts +9 -7
  213. package/test/party/components/output/UserProfileContext-server.ts +1 -1
  214. package/test/party/components/output/UserProfileContextApp-client.ts +14 -7
  215. package/test/party/components/output/UserProfileContextApp-server.ts +2 -2
  216. package/test/party/components/temp/{AnswerButton-client-c3dc7edbfff2db1ea111086002147d771ee12193.ts → AnswerButton-client-ad8f8db36b7aaa68d8de5898a324bacfbe9f20df.ts} +8 -6
  217. package/test/party/components/temp/{AnswerButton-server-427442fa8cfc0a18817c2d37f9cb5cbcb3a88a05.ts → AnswerButton-server-928b5d447afa865fa09e0142c79bb1f2c1b86875.ts} +1 -1
  218. package/test/party/components/temp/{AnswerButtonApp-client-3e0b63a6bbc1dee3e6cb715c0297cc2ce58d3e4e.ts → AnswerButtonApp-client-959a3756a3549b01c5d4c6e7b1dade9dc14ce671.ts} +14 -7
  219. package/test/party/components/temp/{AnswerButtonApp-server-bbc8bb739d2060ccda77ce406aa6b15d8f90b91c.ts → AnswerButtonApp-server-16161f2c9062dd11b8b6b8c898f9f1249ae2400d.ts} +2 -2
  220. package/test/party/components/temp/{ColorSelect-client-5ffa6f9d77de967993088c9a01b9f976f3333176.ts → ColorSelect-client-06e6ef9f285d81975b97d89c8a68a494a32a8e3b.ts} +15 -10
  221. package/test/party/components/temp/{ColorSelect-server-3ed19eff17bf10b31d03ec507974ff913932c97a.ts → ColorSelect-server-90f83722bd85155ebb2b8ccdaf053cd28d3152be.ts} +2 -2
  222. package/test/party/components/temp/{Colors-client-3dafffc5c2a72037f4419fc45d08963872a29958.ts → Colors-client-2f3ab581879042904699c9d47ae5001b82edd910.ts} +15 -9
  223. package/test/party/components/temp/{Colors-server-f9b3037a5f25979f71b5f8f3e658140be7c27920.ts → Colors-server-e13d49ba57f7b0dc6fb10a333ec872f5207e1ff0.ts} +2 -2
  224. package/test/party/components/temp/{Counter-client-4d553521fcfc6c9a4e05dce89e70b2ecf8785c4e.ts → Counter-client-3b876c148f2b14da1766eff77eb6c494f7be6414.ts} +8 -6
  225. package/test/party/components/temp/{Counter-server-36d1137c519691f5b86a18a5c27b7cf615b7e37c.ts → Counter-server-7adf9376b38d97f1fd4b9c14108e6814e81f14ea.ts} +1 -1
  226. package/test/party/components/temp/{CssStyle-client-59c0f261f67bc04f2829a0371f655d146101cec6.ts → CssStyle-client-37465dd48d1479db1bae513eb0b92c4e9a15e9ea.ts} +6 -4
  227. package/test/party/components/temp/{CssStyle-server-3e58d7e2f5c381a251f593245d3d8bf4b50925ae.ts → CssStyle-server-90a950501a20bfa5feac84ca6d97898c25bce2ed.ts} +1 -1
  228. package/test/party/components/temp/{DoubleCount-client-0426f128507a8d4516ef7501cd180662112b6d1d.ts → DoubleCount-client-6d4cf1e54368e3c6082e37c1e04f9ecde90624f2.ts} +7 -5
  229. package/test/party/components/temp/{DoubleCount-server-40fc88156e52281b80fd6b12dd73d2469201fa29.ts → DoubleCount-server-62c94483ebe9661e5ecc4f489787e32448ddcafa.ts} +1 -1
  230. package/test/party/components/temp/FunnyButton-client-400cff6abc7bdd6dbcd23786070eb0e198800337.ts +46 -0
  231. package/test/party/components/temp/{FunnyButton-server-e8ab55e47c735f7e42c55d2b7504dfa4190a1b40.ts → FunnyButton-server-e0adab2be2d283acb8a8b580479ade999dc918e9.ts} +2 -2
  232. package/test/party/components/temp/{FunnyButtonApp-client-ac7101af922dc6ba472b75a428f340caca6be74a.ts → FunnyButtonApp-client-42c39a8ffb7563c474e6b3ccfc9d4ee064c8fbee.ts} +20 -9
  233. package/test/party/components/temp/{FunnyButtonApp-server-f1a98a946e0bb9d1bb76b01e26d6ead8f55d32bb.ts → FunnyButtonApp-server-48d37de0c755843a2be34d7c7cb5c730689dcc2f.ts} +3 -3
  234. package/test/party/components/temp/{HelloWorld-client-791e8b9a0bd4b01e87fbe70f2b28d4ac356e3624.ts → HelloWorld-client-7344e400b4adb975fa8263d3081a06de0a793e57.ts} +6 -4
  235. package/test/party/components/temp/{HelloWorld-server-3c4b9a995a78d652d9220a20124c9e0d18fc7101.ts → HelloWorld-server-e0ed80e7531f303952a4af30d646263ff2e4ead6.ts} +1 -1
  236. package/test/party/components/temp/{InputFocused-client-11a9cb08909b26945bbc2451ab4c1dac09e6d113.ts → InputFocused-client-20d755aea7dfaf1fd5e42dcade8fb7867f59ef28.ts} +7 -4
  237. package/test/party/components/temp/{InputFocused-server-82be1a63c80d1dd3f06efaf0bef349d58cf1d9af.ts → InputFocused-server-ee70758a515227c04788be0e298a79c277994ccd.ts} +1 -1
  238. package/test/party/components/temp/{InputHello-client-b0453caeae0d43dc1878039c6b49318d12624d48.ts → InputHello-client-2a4cbd980534fde14b9d3e8a2f8e4f59a4f15d64.ts} +8 -6
  239. package/test/party/components/temp/{InputHello-server-6c982438e58d3649ee3890efec636ca4590a5cdb.ts → InputHello-server-1b9dd5442ded022abe92a9075ca5a4bb90486cbe.ts} +1 -1
  240. package/test/party/components/temp/{IsAvailable-client-d789346a68b26fd3f5d9f7aebc4c7bd181c47cad.ts → IsAvailable-client-3949f85aea0e935c3b59ab1389baee836eff1866.ts} +8 -6
  241. package/test/party/components/temp/{IsAvailable-server-a35b7ec5f111472c76aa1b67c857b169fe363594.ts → IsAvailable-server-123daa1ae56b77defe6666faddb44ba4252dd0fb.ts} +1 -1
  242. package/test/party/components/temp/{Name-client-cb8bef7cfca1306386b65410a0bd7a8acfaed359.ts → Name-client-62f0dab96aff130e81882099d7c0a111ba99cebd.ts} +7 -5
  243. package/test/party/components/temp/{Name-server-9da0823f748e9751e017078f39717298be232636.ts → Name-server-a402418f1ca2d8a0e6403596ec03ec47b5ff40ec.ts} +1 -1
  244. package/test/party/components/temp/{NameUpdate-client-ebef69b0da12d640994099592ce06c7e4b5089d4.ts → NameUpdate-client-6ceb440637c99142bafcf8512eabf831c113b8c7.ts} +7 -5
  245. package/test/party/components/temp/{NameUpdate-server-1856bdb5e010f7d7e5e67f2a0d87ac3f92f4e0ee.ts → NameUpdate-server-b7dcc875e894a5606544fcd78bda575ea07632ca.ts} +1 -1
  246. package/test/party/components/temp/{PageTitle-client-403645e918294e5cdeea8cb3f602e0a2642b2650.ts → PageTitle-client-75fea3a37fb1213bc13f56160bb6779486b2e6e9.ts} +7 -5
  247. package/test/party/components/temp/{PageTitle-server-4d959183b7029b6817372abd1d60a7e996baeb15.ts → PageTitle-server-12dcb4e437aaef227c704a2ee8bbdee55ca323dc.ts} +1 -1
  248. package/test/party/components/temp/{PickPill-client-b47d371ae5f41d87c96b3cdeed0a8bc06fbfa9c7.ts → PickPill-client-0f13aa652cb1bd45f57d5a249f8364e80204441a.ts} +9 -7
  249. package/test/party/components/temp/{PickPill-server-49e033c5f97dd2f98e1498327e16eb9c8c9d2f66.ts → PickPill-server-f10dae4708e36775a5e1a5ad10c6c0c309335009.ts} +1 -1
  250. package/test/party/components/temp/{Time-client-7ba4ca9322af2cb88a873c812fc776760c337c64.ts → Time-client-2013f274e90b45be3138727f2298305e1951131f.ts} +7 -5
  251. package/test/party/components/temp/{Time-server-08f66c7f3f32b13de06d75fe679cf58b5727c473.ts → Time-server-8e0278a4b16925903f3c4ceedbf1332cde4921fa.ts} +1 -1
  252. package/test/party/components/temp/{TrafficLight-client-549f9fe3418c113fb240cfa17e09c42e1e7f346a.ts → TrafficLight-client-b536f07f37c21cd9340db9cef7b95d30c53f9349.ts} +22 -17
  253. package/test/party/components/temp/{TrafficLight-server-ed2a8640fd82cf381eee8f4fb83bb09d174a4557.ts → TrafficLight-server-04bb3b2f11322ccc97a9a8a8fbb26c3c99843042.ts} +5 -5
  254. package/test/party/components/temp/{UserProfile-client-2c13aac1ad915e51dc557f9af765669e636c0fea.ts → UserProfile-client-11c2a928de5a5ed4cab45186f08ca09f6161afb5.ts} +10 -8
  255. package/test/party/components/temp/{UserProfile-server-cc1162a4297f6163bfb86e7a8aeea08e8c0625c6.ts → UserProfile-server-a0576b8d9dd15b3fab6c11758984c686ddfe2f66.ts} +1 -1
  256. package/test/party/components/temp/{UserProfileApp-client-2be7a11319cca4d7bfa0f3d2205c441d7e203780.ts → UserProfileApp-client-deefee703fc851401cd3a4eec7606d0a228a631d.ts} +12 -4
  257. package/test/party/components/temp/{UserProfileApp-server-ab9ff66f787f775aa8571314fee8bcbef85489ef.ts → UserProfileApp-server-97397c42aaac0ee3902218d02c0ce6884434cc5b.ts} +2 -0
  258. package/test/party/components/temp/{UserProfileContext-client-2aa36f436a5f20614d77f48963ec5ca442eebd90.ts → UserProfileContext-client-c97c077254210061b3c9ba561f681c0cf4f6167f.ts} +9 -7
  259. package/test/party/components/temp/{UserProfileContext-server-cf58767df1e2d1dde919f59de73cdd9764bbc006.ts → UserProfileContext-server-2d32476b00448bdec6c1c45aac5087a5152c2471.ts} +1 -1
  260. package/test/party/components/temp/{UserProfileContextApp-client-5099052fdcd8fb4c368c45090390947424a4e9b0.ts → UserProfileContextApp-client-0f5f11a3fd62f7e0e428fec2a260b93fcff61578.ts} +14 -7
  261. package/test/party/components/temp/{UserProfileContextApp-server-6be8dab2ed4f8911f26bef137e7dea164f2b894d.ts → UserProfileContextApp-server-95a4b12d30cef621db55d5de102a906ac7286fb2.ts} +2 -2
  262. package/test/props/components/output/Reactive-client.ts +21 -12
  263. package/test/props/components/output/Reactive-server.ts +3 -3
  264. package/test/props/components/temp/{Reactive-client-e3e5f6ee2f22c46337c6ab1df2f241133c7e2646.ts → Reactive-client-524add56a858b575fda1001bfe4891e6a1d6d751.ts} +21 -12
  265. package/test/props/components/temp/{Reactive-server-0914d91287a1bc6d32d7cc56d086624762dbfc04.ts → Reactive-server-770cd3df7c877c0c99e156b2ba6d1f8b35914027.ts} +3 -3
  266. package/test/replace/components/output/Replace-client.ts +14 -8
  267. package/test/replace/components/output/Replace-server.ts +2 -2
  268. package/test/replace/components/temp/{Replace-client-3fdab63871fa4bb792317caefd3539b1888325b1.ts → Replace-client-7f6ae4e645d18c4768ef9a212b2e9626c9abdeb0.ts} +14 -8
  269. package/test/replace/components/temp/{Replace-server-857aca7a58deffc3a1c95ab9d31628b4051ca203.ts → Replace-server-9519943d193b681e1d7894a0d7952affdfb0660c.ts} +2 -2
  270. package/test/slots/components/output/Article-client.ts +21 -10
  271. package/test/slots/components/output/Article-server.ts +2 -2
  272. package/test/slots/components/output/Basic-client.ts +12 -5
  273. package/test/slots/components/output/Basic-server.ts +2 -0
  274. package/test/slots/components/output/Header-client.ts +13 -7
  275. package/test/slots/components/output/Header-server.ts +2 -2
  276. package/test/slots/components/output/Let-client.ts +12 -5
  277. package/test/slots/components/output/Let-server.ts +2 -0
  278. package/test/slots/components/output/List-client.ts +18 -10
  279. package/test/slots/components/output/List-server.ts +2 -2
  280. package/test/slots/components/output/Named-client.ts +15 -8
  281. package/test/slots/components/output/Named-server.ts +2 -0
  282. package/test/slots/components/output/Unused-client.ts +12 -4
  283. package/test/slots/components/output/Unused-server.ts +2 -0
  284. package/test/slots/components/temp/Article-client-5f243a2540a073d4018bdc93c6a8e285ba965f5c.ts +52 -0
  285. package/test/slots/components/temp/{Article-server-a6bd47a621cc213db4313eb775a52246541dd203.ts → Article-server-b84141b05064f5ea1e4b535faafe459df0d875fb.ts} +2 -2
  286. package/test/slots/components/temp/{Basic-client-97b18686412869e8c814fd4542dfe826b1f7669f.ts → Basic-client-85377d56d5d37f56ebb10a709e9ffa1a91a2dd91.ts} +12 -5
  287. package/test/slots/components/temp/{Basic-server-248392e2cd147b537cd44e9a5a71885ef20102e4.ts → Basic-server-aed46a5b459cce50e7ddb311c42a76b9e91c2dae.ts} +2 -0
  288. package/test/slots/components/temp/{Header-client-e2e1e7d60b48b0841cd0c20224f520330ca96458.ts → Header-client-247a12314f4fc2695e63b576731b9d0c2a73dcac.ts} +13 -7
  289. package/test/slots/components/temp/{Header-server-1c195508a91c32822da22a08576c8a30c9070636.ts → Header-server-d8e8ccb129d84478f0c4f8dc8ad1d2091188cc7b.ts} +2 -2
  290. package/test/slots/components/temp/{Let-client-be69c1f5aa32faf16239050d7836db46cfdcba2f.ts → Let-client-2625080a2799f5124b1b7083b780958f95539f15.ts} +12 -5
  291. package/test/slots/components/temp/{Let-server-c3293219ed27aec61a6af36d451ddf6609c40027.ts → Let-server-62727e5e2db3df405cdbe7a2d339a99113fc7f4a.ts} +2 -0
  292. package/test/slots/components/temp/{List-client-a829b33214de829de689a72d2e8703b2266ad7a4.ts → List-client-2b316860db37180e9bdfabb32f18b391c3994ac4.ts} +18 -10
  293. package/test/slots/components/temp/{List-server-06503834c9bfae9b8c2b61742568b020a3de961c.ts → List-server-f4f63df4d19e15311da347284935a1bb530a8df4.ts} +2 -2
  294. package/test/slots/components/temp/{Named-client-2d9d88f5fdf74d81c3ed1d769a476f4ac36c8b99.ts → Named-client-64e56746d78b308fd788c9b0409d79e4c91756ff.ts} +15 -8
  295. package/test/slots/components/temp/{Named-server-65a7bbf038111475c8f07dccb34040ab8c1392c4.ts → Named-server-829daa82c94fd7142a721cabac1b3402cca8fce6.ts} +2 -0
  296. package/test/slots/components/temp/{Unused-client-1b16491cb800bbbbd871d9fbf5966c7275244019.ts → Unused-client-3436f47c322f34378aa240b8ad789048d35b4829.ts} +12 -4
  297. package/test/slots/components/temp/{Unused-server-e5d1e85116bebc7e1a2882cb8f2c9ae7975a1de7.ts → Unused-server-379b45ff313e82f8b2949385f50d8ea482094520.ts} +2 -0
  298. package/test/special-component/components/output/BigTitle-client.ts +12 -6
  299. package/test/special-component/components/output/BigTitle-server.ts +2 -2
  300. package/test/special-component/components/output/Component-client.ts +16 -5
  301. package/test/special-component/components/output/Component-server.ts +2 -2
  302. package/test/special-component/components/output/SmallTitle-client.ts +12 -6
  303. package/test/special-component/components/output/SmallTitle-server.ts +2 -2
  304. package/test/special-component/components/temp/{BigTitle-client-881a9f84876fb3f6d994736edb253b96e71de926.ts → BigTitle-client-aa7930485dfd471094922b7725ab6fd7718817e6.ts} +12 -6
  305. package/test/special-component/components/temp/{BigTitle-server-9efc738f5eb131a4b859c4a99a8e255d93834e9a.ts → BigTitle-server-d8919a4c975e022c936584bd668917cb89aa8e20.ts} +2 -2
  306. package/test/special-component/components/temp/{Component-client-22f7e1d0955fb3d90939e956a1f0f77118c259b6.ts → Component-client-3353f5d7d697fd754f92ea30f751f62efb0635c9.ts} +16 -5
  307. package/test/special-component/components/temp/{Component-server-ce596cd84dc11f67c9f0588060a5b672eddf9715.ts → Component-server-3564dfcef8d015cab4944a3c75cc6cf329f3fad6.ts} +2 -2
  308. package/test/special-component/components/temp/{SmallTitle-client-25b3097b7ae47848dd82967403faf7745fc43388.ts → SmallTitle-client-419568c1936f1bb8346db193f0a17848aac61e8e.ts} +12 -6
  309. package/test/special-component/components/temp/{SmallTitle-server-fc105db9a91b83644d67e049ce583a3d1a61f50c.ts → SmallTitle-server-0a9b5098e4dda96f8c1da30294d71b39997dd118.ts} +2 -2
  310. package/test/special-element/components/output/Element-client.ts +8 -6
  311. package/test/special-element/components/output/Element-server.ts +1 -1
  312. package/test/special-element/components/temp/{Element-client-21c92c04579b1d29e8813265a10897d069aad5c5.ts → Element-client-c5701ed44faa4ec8ae558505063684a84cada3f2.ts} +8 -6
  313. package/test/special-element/components/temp/{Element-server-4bed9653529f39e72754126147fe8618f328853a.ts → Element-server-166d672256ef4635168de0090e490e48b569c7d6.ts} +1 -1
  314. package/test/special-head/components/output/Head-client.ts +6 -4
  315. package/test/special-head/components/output/Head-server.ts +1 -1
  316. package/test/special-head/components/temp/{Head-client-07e8af6386d767a52667a4fdc978a335ec388302.ts → Head-client-18616689a7d6f83ca076c9d825606b049de9d3ef.ts} +6 -4
  317. package/test/special-head/components/temp/{Head-server-d80a0f1ee10e9942d9a631df35a24cb1cfb15555.ts → Head-server-c0956653b544ff632e36da15d5f7623fa285953a.ts} +1 -1
  318. package/test/special-self/components/output/Self-client.ts +19 -10
  319. package/test/special-self/components/output/Self-server.ts +4 -4
  320. package/test/special-self/components/temp/{Self-client-911c67194be1fdd997537310bcafe712161e8251.ts → Self-client-bc1db32c01ceebd8aac04288c4d73431cffb200f.ts} +19 -10
  321. package/test/special-self/components/temp/{Self-server-49ba9be1f6255dd4daf490c640f5222a85960218.ts → Self-server-ee440757ca9772d7b4111451a9ee05a157302e7c.ts} +4 -4
  322. package/test/style/components/output/Style-client.ts +7 -4
  323. package/test/style/components/output/Style-server.ts +1 -1
  324. package/test/style/components/temp/{Style-client-cbfac1e255c33a867ccbd5f9d1484a855d91a2d7.ts → Style-client-bc13f8dbb5f754e4eebb2473fc63a139ebf1ba92.ts} +7 -4
  325. package/test/style/components/temp/{Style-server-763d82ee2296be3f7620814aed950b505329c04c.ts → Style-server-85720cb43e20ab000f98bc632c29454a51ae92d9.ts} +1 -1
  326. package/test/svg/components/output/Shape-client.ts +17 -11
  327. package/test/svg/components/output/Shape-server.ts +4 -4
  328. package/test/svg/components/temp/{Shape-client-cb98b36ab2a0d9f06b484a3c988fb43c3a71a4a0.ts → Shape-client-8e9515d4a360b9f4a945263a485486a557da1075.ts} +17 -11
  329. package/test/svg/components/temp/{Shape-server-500d7fe4556026234ce5379b8e90595ddd094edc.ts → Shape-server-9951ff1dcc7aa0827f28d3f8d970813767115ae3.ts} +4 -4
  330. package/test/switch/components/output/Switch-client.ts +20 -14
  331. package/test/switch/components/output/Switch-server.ts +5 -5
  332. package/test/switch/components/temp/{Switch-client-9980de45e3346b79525c445edec7cbc3b375e8a4.ts → Switch-client-485db0bdd94941ecad84528054f40ec6330c5e48.ts} +20 -14
  333. package/test/switch/components/temp/{Switch-server-1c5690726f28008bb565966af69b6e4e019dea82.ts → Switch-server-c1b5e1c657438ee3d8afdbf2166c5295cafc5604.ts} +5 -5
  334. package/test/template/errors.test.ts +8 -6
  335. package/test/text/components/output/Text-client.ts +8 -6
  336. package/test/text/components/output/Text-server.ts +1 -1
  337. package/test/text/components/temp/{Text-client-63f1d3bf9b3bd145c7ce7058716640e27144055e.ts → Text-client-e335aae6d8aef389dfdbb5bee14e3dd3d41e86bd.ts} +8 -6
  338. package/test/text/components/temp/{Text-server-9d3dd6f51e893e63c1999ceafce19ca1697d76ea.ts → Text-server-e37d33aa182f36461927d8ce36040bfd05e2f227.ts} +1 -1
  339. package/test/watch-array/components/output/Array-client.ts +15 -9
  340. package/test/watch-array/components/output/Array-server.ts +2 -2
  341. package/test/watch-array/components/output/ArrayEntries-client.ts +15 -9
  342. package/test/watch-array/components/output/ArrayEntries-server.ts +2 -2
  343. package/test/watch-array/components/output/ArrayIndexes-client.ts +15 -9
  344. package/test/watch-array/components/output/ArrayIndexes-server.ts +2 -2
  345. package/test/watch-array/components/output/ArrayUnkeyed-client.ts +15 -9
  346. package/test/watch-array/components/output/ArrayUnkeyed-server.ts +2 -2
  347. package/test/watch-array/components/temp/{Array-client-ffd82188a45877d74053c82fb3616e4aed0fc2ad.ts → Array-client-8b76b82f631c149d12466795ef6b016ebeda5568.ts} +15 -9
  348. package/test/watch-array/components/temp/{Array-server-3715e815af887e8487b214e7de324850fe99e312.ts → Array-server-c907209008ac6177f614b62931a2bb1f1c3a04e1.ts} +2 -2
  349. package/test/watch-array/components/temp/{ArrayEntries-client-b6e982660628576061dbb44539e970b9549bdcfa.ts → ArrayEntries-client-c7b6352485a0d8ebcdb150d3e7f49d60493fde92.ts} +15 -9
  350. package/test/watch-array/components/temp/{ArrayEntries-server-85cbe80fbb7f6885287825e2cc0dfc1cb9835d79.ts → ArrayEntries-server-57c1ab0045fa4a02de95f69a65de6f54efe9850c.ts} +2 -2
  351. package/test/watch-array/components/temp/{ArrayIndexes-client-39337aa43bd8c10a53db836c3be233d48dd39b91.ts → ArrayIndexes-client-d8321be46a9572147e7b4bc71d7496985217b4f8.ts} +15 -9
  352. package/test/watch-array/components/temp/{ArrayIndexes-server-ec623c724af0c7212675d61ea68e9dee87f96caa.ts → ArrayIndexes-server-f093878b94a37617e2e697a786caa680f75630a7.ts} +2 -2
  353. package/test/watch-array/components/temp/{ArrayUnkeyed-client-7606f9a6a221c8cf6a8b51e4895d10a3d7bccc11.ts → ArrayUnkeyed-client-e37813da82c6d06de32d77348f23ed29c9c08187.ts} +15 -9
  354. package/test/watch-array/components/temp/{ArrayUnkeyed-server-db21cd576a4c70973abe10f6c8ef5cecb3ead86c.ts → ArrayUnkeyed-server-c893fa024be07e5e7fce608c3ae456bdf2279dbe.ts} +2 -2
  355. package/test/watch-object/components/output/Watched-client.ts +7 -5
  356. package/test/watch-object/components/output/Watched-server.ts +1 -1
  357. package/test/watch-object/components/temp/{Watched-client-bbffbf2cede1a5c071b770670eb39c0f0be725af.ts → Watched-client-d26e846bbeb8271ec5dc2a1ceb75b362af44d3bd.ts} +7 -5
  358. package/test/watch-object/components/temp/{Watched-server-0252addaf92fb0f0c1e2937f42918a1c9f31d196.ts → Watched-server-312fca1e769d7594fc5bb6295ccf55b544dd2f4d.ts} +1 -1
  359. package/test/class/components/temp/Class-server-853a463d2ad1a1e3da4da5ad59ad1c75461d2431.ts +0 -40
  360. package/test/party/components/temp/FunnyButton-client-45f2c5dd56f2cdb80102193a978df6b0cec822ab.ts +0 -40
  361. package/test/slots/components/temp/Article-client-80848d6cadd8abac61865d14ddd35685844797e0.ts +0 -41
package/dist/compile.js CHANGED
@@ -63,7 +63,7 @@ var Builder = class {
63
63
  var ANCHOR_COMMENT = "<!>";
64
64
  var HYDRATION_START_COMMENT = "<![>";
65
65
  var HYDRATION_END_COMMENT = "<!]>";
66
- var HYDRATION_BRANCH_COMMENT = "<!^>";
66
+ var HYDRATION_BREAK_COMMENT = "<!^>";
67
67
 
68
68
  // src/compile/utils/trimQuotes.ts
69
69
  function trimQuotes(text) {
@@ -281,7 +281,11 @@ function buildAddFragment(node, status, b, parentName, anchorName) {
281
281
  const fragment = node.fragment;
282
282
  const fragmentName = `t_fragment_${fragment.number}`;
283
283
  status.imports.add("t_add_fragment");
284
- b.append(`t_add_fragment(${fragmentName}, ${parentName}, ${anchorName});`);
284
+ let params = [fragmentName, parentName, anchorName];
285
+ if (fragment.endVarName) {
286
+ params.push(fragment.endVarName);
287
+ }
288
+ b.append(`t_add_fragment(${params.join(", ")});`);
285
289
  if (fragment.endVarName) {
286
290
  status.imports.add("t_next");
287
291
  b.append(`t_next(${fragment.endVarName});`);
@@ -394,10 +398,15 @@ function maybeAddRootNodeDeclaration(node, fragment, fragmentName, status, b, va
394
398
  } else {
395
399
  status.imports.add("t_root");
396
400
  const rootName = `t_root_${fragment.number}`;
397
- const rootPath = `t_root(${fragmentName})`;
401
+ const params = [fragmentName];
402
+ if (firstNode.type === "text") {
403
+ params.push("true");
404
+ }
405
+ const rootPath = `t_root(${params.join(", ")})`;
398
406
  b.append("// @ts-ignore");
399
407
  b.append(`const ${rootName} = ${rootPath};`);
400
- varPaths.set(rootPath, rootName);
408
+ varPaths.set(`t_root(${fragmentName})`, rootName);
409
+ printDebug(rootName, status, b);
401
410
  }
402
411
  }
403
412
  function declareFragmentVars(fragment, node, path, status, b, parentName, anchorName, varPaths, lastChild, declare) {
@@ -597,6 +606,7 @@ function declareElementFragmentVars(fragment, node, path, status, b, parentName,
597
606
  b.append("// @ts-ignore");
598
607
  }
599
608
  b.append(`const ${node.varName} = ${varPath} as ${elementTypeName(node)};`);
609
+ printDebug(node.varName, status, b);
600
610
  }
601
611
  }
602
612
  }
@@ -675,6 +685,7 @@ function declareTextFragmentVars(fragment, node, path, status, b, varPaths, last
675
685
  b.append("// @ts-ignore");
676
686
  }
677
687
  b.append(`const ${node.varName} = ${varPath};`);
688
+ printDebug(node.varName, status, b);
678
689
  }
679
690
  }
680
691
  } else {
@@ -779,6 +790,7 @@ function declareParentAndAnchorFragmentVars(fragment, node, path, status, b, par
779
790
  b.append(`let ${node.parentName} as HTMLElement;`);
780
791
  } else {
781
792
  b.append(`const ${node.parentName} = ${parentVarPath} as HTMLElement;`);
793
+ printDebug(node.parentName, status, b);
782
794
  }
783
795
  varPaths.set(parentVarPath, node.parentName);
784
796
  } else {
@@ -794,7 +806,8 @@ function declareParentAndAnchorFragmentVars(fragment, node, path, status, b, par
794
806
  b.append(`let ${node.varName};`);
795
807
  } else {
796
808
  status.imports.add("t_anchor");
797
- b.append(`const ${node.varName} = t_anchor(${anchorVarPath}) as HTMLElement;`);
809
+ b.append(`let ${node.varName} = t_anchor(${anchorVarPath}) as HTMLElement;`);
810
+ printDebug(node.varName, status, b);
798
811
  }
799
812
  } else {
800
813
  status.imports.add("t_cmt");
@@ -802,6 +815,12 @@ function declareParentAndAnchorFragmentVars(fragment, node, path, status, b, par
802
815
  }
803
816
  buildNode(node, status, b, parentName, anchorName);
804
817
  node.handled = true;
818
+ if (declare && node.varName) {
819
+ status.imports.add("t_reanchor");
820
+ b.append(`${node.varName} = t_reanchor(${node.varName}) as HTMLElement;`);
821
+ b.append("");
822
+ printDebug(node.varName, status, b);
823
+ }
805
824
  }
806
825
  function getFragmentVarPath(fragment, status, name, path, varPaths) {
807
826
  let node = path;
@@ -820,6 +839,7 @@ function getFragmentVarPath(fragment, status, name, path, varPaths) {
820
839
  varPaths.set(name, name);
821
840
  }
822
841
  while (varPath.includes("t_next(t_next(")) {
842
+ status.imports.add("t_skip");
823
843
  const match = varPath.match(/(t_next\(){2,}/)[0];
824
844
  const count = match.length / "t_next(".length;
825
845
  const pos = varPath.indexOf("t_next(t_next(");
@@ -840,8 +860,9 @@ function getFragmentVarPath(fragment, status, name, path, varPaths) {
840
860
  }
841
861
  const tail = varPath.substring(end + count);
842
862
  const param = varPath.substring(pos + match.length, end);
843
- varPath = `${head}t_next(${param}, ${count})${tail}`;
863
+ varPath = `${head}t_skip(${param}, ${count})${tail}`;
844
864
  }
865
+ varPath = varPath.replaceAll("t_next_text", "t_next");
845
866
  return varPath;
846
867
  }
847
868
  function getFragmentVarPathPart(path, varPath, status, root = false) {
@@ -854,8 +875,12 @@ function getFragmentVarPathPart(path, varPath, status, root = false) {
854
875
  }
855
876
  for (let [i, child] of path.children.entries()) {
856
877
  if (i > 0) {
857
- status.imports.add("t_next");
858
- varPath = `t_next(${varPath})`;
878
+ if (child.type === "text" || child.type === "space") {
879
+ varPath = `t_next_text(${varPath}, true)`;
880
+ } else {
881
+ status.imports.add("t_next");
882
+ varPath = `t_next(${varPath})`;
883
+ }
859
884
  }
860
885
  if (i === path.children.length - 1 && child.children.length) {
861
886
  varPath = getFragmentVarPathPart(child, varPath, status);
@@ -863,6 +888,13 @@ function getFragmentVarPathPart(path, varPath, status, root = false) {
863
888
  }
864
889
  return varPath;
865
890
  }
891
+ var debug = false;
892
+ function printDebug(varName, status, b) {
893
+ if (debug) {
894
+ status.imports.add("t_print");
895
+ b.append(`console.log("${varName}:", t_print(${varName}));`);
896
+ }
897
+ }
866
898
 
867
899
  // src/compile/build/client/replaceForVarNames.ts
868
900
  function replaceForVarNames(value, status) {
@@ -994,6 +1026,7 @@ ${slotParams.join(",\n")}
994
1026
  }
995
1027
  }
996
1028
  b.append(`${componentName}(${renderParams});`);
1029
+ b.append("");
997
1030
  }
998
1031
 
999
1032
  // src/compile/build/client/buildAwaitNode.ts
@@ -1403,7 +1436,8 @@ function buildControlNode(node, status, b) {
1403
1436
  buildScriptNode(node, b);
1404
1437
  break;
1405
1438
  }
1406
- case "@function": {
1439
+ case "@function":
1440
+ case "@async function": {
1407
1441
  b.append("");
1408
1442
  buildScriptNode(node, b);
1409
1443
  b.append("");
@@ -1717,7 +1751,9 @@ function buildRootNode(node, status, b, parentName, anchorName) {
1717
1751
  fragment: node.fragment,
1718
1752
  path: "0:ch/"
1719
1753
  });
1720
- buildNode(node.children[0], status, b, parentName, anchorName, true);
1754
+ for (let child of node.children) {
1755
+ buildNode(child, status, b, parentName, anchorName, true);
1756
+ }
1721
1757
  status.fragmentStack.pop();
1722
1758
  buildAddFragment(node, status, b, parentName, anchorName);
1723
1759
  }
@@ -1960,12 +1996,15 @@ var importsMap = {
1960
1996
  t_animate: 'import { t_animate } from "${folder}";',
1961
1997
  t_root: 'import { t_root } from "${folder}";',
1962
1998
  t_anchor: 'import { t_anchor } from "${folder}";',
1999
+ t_reanchor: 'import { t_reanchor } from "${folder}";',
1963
2000
  t_child: 'import { t_child } from "${folder}";',
1964
2001
  t_next: 'import { t_next } from "${folder}";',
2002
+ t_skip: 'import { t_skip } from "${folder}";',
1965
2003
  t_frg: 'import { t_frg } from "${folder}";',
1966
2004
  t_elm: 'import { t_elm } from "${folder}";',
1967
2005
  t_txt: 'import { t_txt } from "${folder}";',
1968
2006
  t_cmt: 'import { t_cmt } from "${folder}";',
2007
+ t_print: 'import { t_print } from "${folder}";',
1969
2008
  ListItem: 'import { type ListItem } from "${folder}";',
1970
2009
  SlotRender: 'import { type SlotRender } from "${folder}";'
1971
2010
  };
@@ -2167,9 +2206,7 @@ ${slotParams.join(",\n")}
2167
2206
  }
2168
2207
  b.append("");
2169
2208
  b.append(`$output += ${componentName}(${renderParams})`);
2170
- if (node.tagName === ":component") {
2171
- status.output += ANCHOR_COMMENT;
2172
- }
2209
+ status.output += ANCHOR_COMMENT;
2173
2210
  }
2174
2211
 
2175
2212
  // src/compile/build/server/buildServerAwaitNode.ts
@@ -2214,7 +2251,7 @@ function buildServerForNode(node, status, b) {
2214
2251
  }
2215
2252
  function buildServerForBranch(node, status, b) {
2216
2253
  b.append(`${node.statement} {`);
2217
- status.output += HYDRATION_BRANCH_COMMENT;
2254
+ status.output += HYDRATION_BREAK_COMMENT;
2218
2255
  for (let child of node.children) {
2219
2256
  buildServerNode(child, status, b);
2220
2257
  }
@@ -2254,6 +2291,7 @@ function buildServerIfNode(node, status, b) {
2254
2291
  }
2255
2292
  function buildServerIfBranch(node, status, b) {
2256
2293
  b.append(`${node.statement} {`);
2294
+ status.output += HYDRATION_BREAK_COMMENT;
2257
2295
  for (let child of node.children) {
2258
2296
  buildServerNode(child, status, b);
2259
2297
  }
@@ -2320,6 +2358,7 @@ function buildServerSwitchNode(node, status, b) {
2320
2358
  }
2321
2359
  function buildServerSwitchBranch(node, status, b) {
2322
2360
  b.append(`${node.statement} {`);
2361
+ status.output += HYDRATION_BREAK_COMMENT;
2323
2362
  for (let child of node.children) {
2324
2363
  buildServerNode(child, status, b);
2325
2364
  }
@@ -2390,7 +2429,8 @@ function buildServerControlNode(node, status, b) {
2390
2429
  buildServerScriptNode(node, b);
2391
2430
  break;
2392
2431
  }
2393
- case "@function": {
2432
+ case "@function":
2433
+ case "@async function": {
2394
2434
  if (status.output) {
2395
2435
  b.append(`$output += \`${status.output}\`;`);
2396
2436
  status.output = "";
@@ -2537,7 +2577,9 @@ function buildElementAttributes2(node, status) {
2537
2577
 
2538
2578
  // src/compile/build/server/buildServerRootNode.ts
2539
2579
  function buildServerRootNode(node, status, b) {
2540
- buildServerNode(node.children[0], status, b);
2580
+ for (let child of node.children) {
2581
+ buildServerNode(child, status, b);
2582
+ }
2541
2583
  }
2542
2584
 
2543
2585
  // src/compile/build/server/buildServerSlotNode.ts
@@ -2855,6 +2897,15 @@ function isSpaceNode(node) {
2855
2897
  return isTextNode(node) && isSpace(node.content);
2856
2898
  }
2857
2899
 
2900
+ // src/compile/utils/trimStart.ts
2901
+ function trimStart(text, char) {
2902
+ let start = 0;
2903
+ while (text[start] === char) {
2904
+ start += 1;
2905
+ }
2906
+ return text.substring(start);
2907
+ }
2908
+
2858
2909
  // src/compile/parse/utils/consumeSpace.ts
2859
2910
  function consumeSpace(status) {
2860
2911
  const start = status.i;
@@ -2883,15 +2934,6 @@ function addSpaceElement(parent, status) {
2883
2934
  }
2884
2935
  }
2885
2936
 
2886
- // src/compile/utils/trimStart.ts
2887
- function trimStart(text, char) {
2888
- let start = 0;
2889
- while (text[start] === char) {
2890
- start += 1;
2891
- }
2892
- return text.substring(start);
2893
- }
2894
-
2895
2937
  // src/compile/parse/utils/accept.ts
2896
2938
  function accept(value, status, advance = true) {
2897
2939
  const check = status.source.substring(status.i, status.i + value.length);
@@ -2947,230 +2989,6 @@ function parseInlineScript(status) {
2947
2989
  return "";
2948
2990
  }
2949
2991
 
2950
- // src/compile/parse/utils/addError.ts
2951
- function addError(status, message, start = status.i) {
2952
- let line = 1;
2953
- let lastLineStart = 0;
2954
- for (let i = 0; i < start; i++) {
2955
- if (status.source[i] === "\n") {
2956
- line += 1;
2957
- lastLineStart = i + 1;
2958
- }
2959
- }
2960
- let column = start - lastLineStart;
2961
- status.errors.push({ message, start, line, column });
2962
- }
2963
-
2964
- // src/compile/parse/parseControl.ts
2965
- var controlOperations = [
2966
- "@if",
2967
- "@else",
2968
- "@for",
2969
- "@key",
2970
- "@switch",
2971
- "@case",
2972
- "@default",
2973
- "@await",
2974
- "@then",
2975
- "@catch",
2976
- "@replace",
2977
- "@html",
2978
- "@const",
2979
- "@console",
2980
- "@debugger",
2981
- "@function"
2982
- ];
2983
- var standaloneOperations = ["@key", "@html", "@const", "@console", "@debugger", "@function"];
2984
- function parseControl(status, parentNode) {
2985
- const node = parseControlOpen(status);
2986
- if (!node) {
2987
- return;
2988
- }
2989
- if (standaloneOperations.includes(node.operation)) {
2990
- wrangleControlNode(node, parentNode);
2991
- return;
2992
- }
2993
- while (status.i < status.source.length) {
2994
- addSpaceElement(node, status);
2995
- if (accept("}", status)) {
2996
- break;
2997
- } else if (accept("<", status, false)) {
2998
- const child = parseElement(status);
2999
- node.children.push(child);
3000
- } else if (accept("@//", status)) {
3001
- status.i = status.source.indexOf("\n", status.i) + 1;
3002
- } else if (accept("@/*", status)) {
3003
- status.i = status.source.indexOf("*/", status.i) + 2;
3004
- } else if (accept("@", status, false)) {
3005
- parseControl(status, node);
3006
- } else if (accept("case", status, false) || accept("key", status, false)) {
3007
- parseControl(status, node);
3008
- } else {
3009
- const char = status.source[status.i];
3010
- addError(status, `Unexpected token in control block: ${char}`, status.i);
3011
- break;
3012
- }
3013
- }
3014
- wrangleControlNode(node, parentNode);
3015
- parseControlBranches(status, parentNode);
3016
- }
3017
- function parseControlOpen(status) {
3018
- const start = status.i;
3019
- let operation = "";
3020
- for (status.i; status.i < status.source.length; status.i++) {
3021
- const char = status.source[status.i];
3022
- if (isSpaceChar(status.source, status.i) || accept(":", status) && operation === "default" || accept(".", status) && operation === "@console" || accept("(", status, false) && operation === "@html") {
3023
- break;
3024
- }
3025
- operation += char;
3026
- }
3027
- if (!operation.startsWith("@")) {
3028
- operation = "@" + operation;
3029
- }
3030
- let statement = "";
3031
- if (controlOperations.includes(operation)) {
3032
- statement = parseControlStatement(start, operation, status);
3033
- if (operation === "@function") {
3034
- statement += ` {${parseInlineScript(status)}}`;
3035
- accept("}", status);
3036
- }
3037
- if (operation === "@replace" || operation === "@html") {
3038
- statement = trimMatched(statement.substring(statement.indexOf("(")).trim(), "(", ")");
3039
- }
3040
- } else {
3041
- addError(status, `Unknown operation: ${operation}`, status.i);
3042
- return null;
3043
- }
3044
- return {
3045
- type: "control",
3046
- operation,
3047
- statement,
3048
- children: []
3049
- };
3050
- }
3051
- function parseControlStatement(start, operation, status) {
3052
- let parenCount = 0;
3053
- while (status.i < status.source.length) {
3054
- if (accept("(", status)) {
3055
- parenCount += 1;
3056
- } else if (accept(")", status)) {
3057
- parenCount -= 1;
3058
- } else if (accept("{", status) || accept("\n", status) && standaloneOperations.includes(operation)) {
3059
- if (parenCount === 0) {
3060
- return trimStart(status.source.substring(start, status.i - 1).trim(), "@");
3061
- }
3062
- } else if (accept('"', status) || accept("'", status)) {
3063
- const char = status.source[status.i - 1];
3064
- for (let j = status.i + 1; j < status.source.length; j++) {
3065
- if (status.source[j] === char && status.source[j - 1] !== "\\") {
3066
- status.i = j + 1;
3067
- break;
3068
- }
3069
- }
3070
- } else if (accept("`", status)) {
3071
- let level2 = 0;
3072
- for (let j = status.i + 1; j < status.source.length; j++) {
3073
- if (status.source[j] === "`" && status.source[j - 1] !== "\\" && level2 === 0) {
3074
- status.i = j + 1;
3075
- break;
3076
- } else if (status.source[j] === "{" && (level2 > 0 || status.source[j - 1] === "$")) {
3077
- level2 += 1;
3078
- } else if (status.source[j] === "}" && level2 > 0) {
3079
- level2 -= 1;
3080
- }
3081
- }
3082
- } else if (accept("//", status)) {
3083
- status.i = status.source.indexOf("\n", status.i) + 1;
3084
- } else if (accept("/*", status)) {
3085
- status.i = status.source.indexOf("*/", status.i) + 2;
3086
- } else {
3087
- status.i += 1;
3088
- }
3089
- }
3090
- return "";
3091
- }
3092
- function wrangleControlNode(node, parentNode) {
3093
- if (node.operation === "@if") {
3094
- const ifGroup = {
3095
- type: "control",
3096
- operation: "@if group",
3097
- statement: "",
3098
- children: [node]
3099
- };
3100
- parentNode.children.push(ifGroup);
3101
- } else if (node.operation === "@else") {
3102
- if (/^else\s+if/.test(node.statement)) {
3103
- node.operation = "@else if";
3104
- }
3105
- for (let i = parentNode.children.length - 1; i >= 0; i--) {
3106
- const lastChild = parentNode.children[i];
3107
- if (isControlNode(lastChild) && lastChild.operation === "@if group") {
3108
- lastChild.children.push(node);
3109
- break;
3110
- }
3111
- }
3112
- } else if (node.operation === "@for") {
3113
- const forGroup = {
3114
- type: "control",
3115
- operation: "@for group",
3116
- statement: "",
3117
- children: [node]
3118
- };
3119
- parentNode.children.push(forGroup);
3120
- } else if (node.operation === "@switch") {
3121
- node.operation = "@switch group";
3122
- parentNode.children.push(node);
3123
- } else if (node.operation === "@await") {
3124
- const awaitGroup = {
3125
- type: "control",
3126
- operation: "@await group",
3127
- statement: "",
3128
- children: [node]
3129
- };
3130
- parentNode.children.push(awaitGroup);
3131
- } else if (node.operation === "@then" || node.operation === "@catch") {
3132
- for (let i = parentNode.children.length - 1; i >= 0; i--) {
3133
- const lastChild = parentNode.children[i];
3134
- if (isControlNode(lastChild) && lastChild.operation === "@await group") {
3135
- lastChild.children.push(node);
3136
- break;
3137
- }
3138
- }
3139
- } else if (node.operation === "@replace") {
3140
- const replaceGroup = {
3141
- type: "control",
3142
- operation: "@replace group",
3143
- statement: "",
3144
- children: [node]
3145
- };
3146
- parentNode.children.push(replaceGroup);
3147
- } else if (node.operation === "@html") {
3148
- const htmlGroup = {
3149
- type: "control",
3150
- operation: "@html group",
3151
- statement: "",
3152
- children: [node]
3153
- };
3154
- parentNode.children.push(htmlGroup);
3155
- } else {
3156
- parentNode.children.push(node);
3157
- }
3158
- }
3159
- function parseControlBranches(status, parentNode) {
3160
- let gotAnotherBranch = true;
3161
- while (gotAnotherBranch) {
3162
- let start = status.i;
3163
- status.i += 1;
3164
- consumeSpace(status);
3165
- if (accept("else", status, false) || accept("case", status, false) || accept("default", status, false) || accept("then", status, false) || accept("catch", status, false)) {
3166
- parseControl(status, parentNode);
3167
- } else {
3168
- gotAnotherBranch = false;
3169
- status.i = start;
3170
- }
3171
- }
3172
- }
3173
-
3174
2992
  // src/compile/parse/utils/isAlphaNumericChar.ts
3175
2993
  function isAlphaNumericChar(text, index) {
3176
2994
  let code = text.charCodeAt(index);
@@ -3309,6 +3127,20 @@ function isFillNode(n) {
3309
3127
  return isSpecialNode(n) && n.tagName === ":fill";
3310
3128
  }
3311
3129
 
3130
+ // src/compile/parse/utils/addError.ts
3131
+ function addError(status, message, start = status.i) {
3132
+ let line = 1;
3133
+ let lastLineStart = 0;
3134
+ for (let i = 0; i < start; i++) {
3135
+ if (status.source[i] === "\n") {
3136
+ line += 1;
3137
+ lastLineStart = i + 1;
3138
+ }
3139
+ }
3140
+ let column = start - lastLineStart;
3141
+ status.errors.push({ message, start, line, column });
3142
+ }
3143
+
3312
3144
  // src/compile/parse/parseElement.ts
3313
3145
  function parseElement(status) {
3314
3146
  const start = status.i;
@@ -3513,6 +3345,225 @@ function checkCloseTag(status, element, current) {
3513
3345
  return found;
3514
3346
  }
3515
3347
 
3348
+ // src/compile/parse/parseControl.ts
3349
+ var controlOperations = [
3350
+ "@if",
3351
+ "@else",
3352
+ "@for",
3353
+ "@key",
3354
+ "@switch",
3355
+ "@case",
3356
+ "@default",
3357
+ "@await",
3358
+ "@then",
3359
+ "@catch",
3360
+ "@replace",
3361
+ "@html",
3362
+ "@const",
3363
+ "@console",
3364
+ "@debugger",
3365
+ "@function",
3366
+ "@async function"
3367
+ ];
3368
+ var standaloneOperations = [
3369
+ "@key",
3370
+ "@html",
3371
+ "@const",
3372
+ "@console",
3373
+ "@debugger",
3374
+ "@function",
3375
+ "@async function"
3376
+ ];
3377
+ function parseControl(status, parentNode) {
3378
+ const node = parseControlOpen(status);
3379
+ if (!node) {
3380
+ return;
3381
+ }
3382
+ if (standaloneOperations.includes(node.operation)) {
3383
+ wrangleControlNode(node, parentNode);
3384
+ return;
3385
+ }
3386
+ while (status.i < status.source.length) {
3387
+ addSpaceElement(node, status);
3388
+ if (accept("}", status)) {
3389
+ break;
3390
+ } else if (accept("<", status, false)) {
3391
+ const child = parseElement(status);
3392
+ node.children.push(child);
3393
+ } else if (accept("@//", status)) {
3394
+ status.i = status.source.indexOf("\n", status.i) + 1;
3395
+ } else if (accept("@/*", status)) {
3396
+ status.i = status.source.indexOf("*/", status.i) + 2;
3397
+ } else if (accept("@", status, false)) {
3398
+ parseControl(status, node);
3399
+ } else if (accept("case", status, false) || accept("key", status, false)) {
3400
+ parseControl(status, node);
3401
+ } else {
3402
+ const char = status.source[status.i];
3403
+ addError(status, `Unexpected token in control block: ${char}`, status.i);
3404
+ break;
3405
+ }
3406
+ }
3407
+ wrangleControlNode(node, parentNode);
3408
+ parseControlBranches(status, parentNode);
3409
+ }
3410
+ function parseControlOpen(status) {
3411
+ const start = status.i;
3412
+ let operation = "";
3413
+ for (status.i; status.i < status.source.length; status.i++) {
3414
+ const char = status.source[status.i];
3415
+ if (isSpaceChar(status.source, status.i) && operation !== "@async" || accept(":", status) && operation === "default" || accept(".", status) && operation === "@console" || accept("(", status, false) && operation === "@html") {
3416
+ break;
3417
+ }
3418
+ operation += char;
3419
+ }
3420
+ if (!operation.startsWith("@")) {
3421
+ operation = "@" + operation;
3422
+ }
3423
+ let statement = "";
3424
+ if (controlOperations.includes(operation)) {
3425
+ statement = parseControlStatement(start, operation, status);
3426
+ if (operation === "@function" || operation === "@async function") {
3427
+ statement += ` {${parseInlineScript(status)}}`;
3428
+ accept("}", status);
3429
+ }
3430
+ if (operation === "@replace" || operation === "@html") {
3431
+ statement = trimMatched(statement.substring(statement.indexOf("(")).trim(), "(", ")");
3432
+ }
3433
+ } else {
3434
+ addError(status, `Unknown operation: ${operation}`, status.i);
3435
+ return null;
3436
+ }
3437
+ return {
3438
+ type: "control",
3439
+ operation,
3440
+ statement,
3441
+ children: []
3442
+ };
3443
+ }
3444
+ function parseControlStatement(start, operation, status) {
3445
+ let parenCount = 0;
3446
+ while (status.i < status.source.length) {
3447
+ if (accept("(", status)) {
3448
+ parenCount += 1;
3449
+ } else if (accept(")", status)) {
3450
+ parenCount -= 1;
3451
+ } else if (accept("{", status) || accept("\n", status) && standaloneOperations.includes(operation)) {
3452
+ if (parenCount === 0) {
3453
+ return trimStart(status.source.substring(start, status.i - 1).trim(), "@");
3454
+ }
3455
+ } else if (accept('"', status) || accept("'", status)) {
3456
+ const char = status.source[status.i - 1];
3457
+ for (let j = status.i + 1; j < status.source.length; j++) {
3458
+ if (status.source[j] === char && status.source[j - 1] !== "\\") {
3459
+ status.i = j + 1;
3460
+ break;
3461
+ }
3462
+ }
3463
+ } else if (accept("`", status)) {
3464
+ let level2 = 0;
3465
+ for (let j = status.i + 1; j < status.source.length; j++) {
3466
+ if (status.source[j] === "`" && status.source[j - 1] !== "\\" && level2 === 0) {
3467
+ status.i = j + 1;
3468
+ break;
3469
+ } else if (status.source[j] === "{" && (level2 > 0 || status.source[j - 1] === "$")) {
3470
+ level2 += 1;
3471
+ } else if (status.source[j] === "}" && level2 > 0) {
3472
+ level2 -= 1;
3473
+ }
3474
+ }
3475
+ } else if (accept("//", status)) {
3476
+ status.i = status.source.indexOf("\n", status.i) + 1;
3477
+ } else if (accept("/*", status)) {
3478
+ status.i = status.source.indexOf("*/", status.i) + 2;
3479
+ } else {
3480
+ status.i += 1;
3481
+ }
3482
+ }
3483
+ return "";
3484
+ }
3485
+ function wrangleControlNode(node, parentNode) {
3486
+ if (node.operation === "@if") {
3487
+ const ifGroup = {
3488
+ type: "control",
3489
+ operation: "@if group",
3490
+ statement: "",
3491
+ children: [node]
3492
+ };
3493
+ parentNode.children.push(ifGroup);
3494
+ } else if (node.operation === "@else") {
3495
+ if (/^else\s+if/.test(node.statement)) {
3496
+ node.operation = "@else if";
3497
+ }
3498
+ for (let i = parentNode.children.length - 1; i >= 0; i--) {
3499
+ const lastChild = parentNode.children[i];
3500
+ if (isControlNode(lastChild) && lastChild.operation === "@if group") {
3501
+ lastChild.children.push(node);
3502
+ break;
3503
+ }
3504
+ }
3505
+ } else if (node.operation === "@for") {
3506
+ const forGroup = {
3507
+ type: "control",
3508
+ operation: "@for group",
3509
+ statement: "",
3510
+ children: [node]
3511
+ };
3512
+ parentNode.children.push(forGroup);
3513
+ } else if (node.operation === "@switch") {
3514
+ node.operation = "@switch group";
3515
+ parentNode.children.push(node);
3516
+ } else if (node.operation === "@await") {
3517
+ const awaitGroup = {
3518
+ type: "control",
3519
+ operation: "@await group",
3520
+ statement: "",
3521
+ children: [node]
3522
+ };
3523
+ parentNode.children.push(awaitGroup);
3524
+ } else if (node.operation === "@then" || node.operation === "@catch") {
3525
+ for (let i = parentNode.children.length - 1; i >= 0; i--) {
3526
+ const lastChild = parentNode.children[i];
3527
+ if (isControlNode(lastChild) && lastChild.operation === "@await group") {
3528
+ lastChild.children.push(node);
3529
+ break;
3530
+ }
3531
+ }
3532
+ } else if (node.operation === "@replace") {
3533
+ const replaceGroup = {
3534
+ type: "control",
3535
+ operation: "@replace group",
3536
+ statement: "",
3537
+ children: [node]
3538
+ };
3539
+ parentNode.children.push(replaceGroup);
3540
+ } else if (node.operation === "@html") {
3541
+ const htmlGroup = {
3542
+ type: "control",
3543
+ operation: "@html group",
3544
+ statement: "",
3545
+ children: [node]
3546
+ };
3547
+ parentNode.children.push(htmlGroup);
3548
+ } else {
3549
+ parentNode.children.push(node);
3550
+ }
3551
+ }
3552
+ function parseControlBranches(status, parentNode) {
3553
+ let gotAnotherBranch = true;
3554
+ while (gotAnotherBranch) {
3555
+ let start = status.i;
3556
+ status.i += 1;
3557
+ consumeSpace(status);
3558
+ if (accept("else", status, false) || accept("case", status, false) || accept("default", status, false) || accept("then", status, false) || accept("catch", status, false)) {
3559
+ parseControl(status, parentNode);
3560
+ } else {
3561
+ gotAnotherBranch = false;
3562
+ status.i = start;
3563
+ }
3564
+ }
3565
+ }
3566
+
3516
3567
  // src/compile/parse/parseMarkup.ts
3517
3568
  function parseMarkup(status, source) {
3518
3569
  const current = status.components.at(-1);
@@ -3526,14 +3577,17 @@ function parseMarkup(status, source) {
3526
3577
  status.i = status.source.indexOf("\n", status.i) + 1;
3527
3578
  } else if (accept("@/*", status)) {
3528
3579
  status.i = status.source.indexOf("*/", status.i) + 2;
3580
+ } else if (isSpaceChar(status.source, status.i)) {
3581
+ current.markup ??= { type: "root", children: [] };
3582
+ const text = { type: "text", content: consumeSpace(status) };
3583
+ current.markup.children.push(text);
3529
3584
  } else if (accept("<", status, false)) {
3530
- const start = status.i;
3585
+ current.markup ??= { type: "root", children: [] };
3531
3586
  const element = parseElement(status);
3532
- if (current.markup === void 0) {
3533
- current.markup = element;
3534
- } else if (!element.tagName.startsWith("/")) {
3535
- addError(status, `Multiple top-level elements: ${element.tagName}`, start);
3536
- }
3587
+ current.markup.children.push(element);
3588
+ } else if (accept("@", status, false)) {
3589
+ current.markup ??= { type: "root", children: [] };
3590
+ parseControl(status, current.markup);
3537
3591
  } else {
3538
3592
  status.i += 1;
3539
3593
  }
@@ -3774,10 +3828,7 @@ function parseCode(source) {
3774
3828
  name: c.name,
3775
3829
  default: c.default,
3776
3830
  params: c.params,
3777
- markup: c.markup ? {
3778
- type: "root",
3779
- children: [c.markup]
3780
- } : void 0,
3831
+ markup: c.markup,
3781
3832
  style: c.style,
3782
3833
  props: c.props,
3783
3834
  contextProps: c.contextProps,
@@ -3929,7 +3980,7 @@ function parseComponentEnd(status) {
3929
3980
  const componentSource = status.source.substring(current.start || 0, status.i);
3930
3981
  current.props = getPropsUsage(componentSource);
3931
3982
  current.contextProps = getContextUsage(componentSource);
3932
- if (current.markup && current.markup.tagName === "html" && isSpaceNode(current.markup.children[0])) {
3983
+ if (current.markup && isElementNode(current.markup.children[0]) && current.markup.children[0].tagName === "html" && isSpaceNode(current.markup.children[0].children[0])) {
3933
3984
  current.markup.children.splice(1, 1);
3934
3985
  }
3935
3986
  status.marker = status.i;