@torpor/view 0.1.10 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -1
  3. package/dist/{ServerSlotRender-t1sOutne.d.cts → ServerSlotRender-BMGG0yq3.d.cts} +4 -4
  4. package/dist/{ServerSlotRender-t1sOutne.d.ts → ServerSlotRender-BMGG0yq3.d.ts} +4 -4
  5. package/dist/chunk-XNO4YEJ3.js +64 -0
  6. package/dist/chunk-XNO4YEJ3.js.map +1 -0
  7. package/dist/compile.cjs +69 -60
  8. package/dist/compile.cjs.map +1 -1
  9. package/dist/compile.js +69 -60
  10. package/dist/compile.js.map +1 -1
  11. package/dist/index.cjs +116 -85
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +9 -6
  14. package/dist/index.d.ts +9 -6
  15. package/dist/index.js +67 -55
  16. package/dist/index.js.map +1 -1
  17. package/dist/metafile-cjs.json +1 -1
  18. package/dist/metafile-esm.json +1 -1
  19. package/dist/ssr.cjs +44 -25
  20. package/dist/ssr.cjs.map +1 -1
  21. package/dist/ssr.d.cts +2 -2
  22. package/dist/ssr.d.ts +2 -2
  23. package/dist/ssr.js +6 -6
  24. package/package.json +5 -5
  25. package/src/compile/build/client/buildComponentNode.ts +13 -11
  26. package/src/compile/build/client/buildElementNode.ts +10 -13
  27. package/src/compile/build/server/buildServerAwaitNode.ts +2 -2
  28. package/src/compile/build/server/buildServerCode.ts +13 -4
  29. package/src/compile/build/server/buildServerComponentNode.ts +21 -16
  30. package/src/compile/build/server/buildServerControlNode.ts +2 -2
  31. package/src/compile/build/server/buildServerElementNode.ts +7 -4
  32. package/src/compile/build/server/buildServerForNode.ts +2 -2
  33. package/src/compile/build/server/buildServerIfNode.ts +2 -2
  34. package/src/compile/build/server/buildServerReplaceNode.ts +2 -2
  35. package/src/compile/build/server/buildServerSlotNode.ts +9 -5
  36. package/src/compile/build/server/buildServerSwitchNode.ts +2 -2
  37. package/src/compile/parse/scopeStyles.ts +1 -0
  38. package/src/debug/printNode.ts +8 -8
  39. package/src/index.ts +4 -4
  40. package/src/render/addFragment.ts +2 -1
  41. package/src/render/{getClasses.ts → buildClasses.ts} +13 -6
  42. package/src/render/buildStyles.ts +19 -0
  43. package/src/render/{runLayoutSlot.ts → fillLayoutSlot.ts} +1 -1
  44. package/src/render/isCommentNode.ts +3 -0
  45. package/src/render/isFragmentNode.ts +3 -0
  46. package/src/render/isTextNode.ts +3 -0
  47. package/src/render/moveRange.ts +9 -0
  48. package/src/render/nodeAnchor.ts +3 -3
  49. package/src/render/nodeCheckHydrationBreak.ts +2 -2
  50. package/src/render/nodeNext.ts +2 -2
  51. package/src/render/nodeRoot.ts +11 -2
  52. package/src/ssr.ts +2 -2
  53. package/src/types/ServerComponent.ts +1 -1
  54. package/test/attributes/components/output/Attributes-server.ts +4 -3
  55. package/test/attributes/components/temp/{Attributes-server-80f9f58fd6cb30df11867386d4f0b15b44401ebe.ts → Attributes-server-f4c59f5e4757ce0113907389902499efc36cfe38.ts} +4 -3
  56. package/test/await/components/Await.torp +10 -12
  57. package/test/await/components/output/Await-client.ts +6 -7
  58. package/test/await/components/output/Await-server.ts +6 -5
  59. package/test/await/components/temp/{Await-client-9c30564ea39457e614e60c0cc0a71c431e8a1e76.ts → Await-client-17b0e7c682fbff8518a440831620c1024b8be23a.ts} +6 -7
  60. package/test/await/components/temp/{Await-server-f02f39af3bb3344ca6b18a1d64d60b21913fba31.ts → Await-server-eb8d79f8abc791dd8e87f9713534cebf0eb2c854.ts} +6 -5
  61. package/test/bench/components/Bench.torp +1 -1
  62. package/test/bench/components/output/Bench-client.ts +238 -32
  63. package/test/bench/components/output/Bench-server.ts +21 -9
  64. package/test/bench/components/temp/Bench-client-4e18421473e97bac7c24b17ba14751ce14dd187e.ts +414 -0
  65. package/test/bench/components/temp/{Bench-server-00cefa588803c01ca4f2741c595e4f045cdd101e.ts → Bench-server-4648921af9bc146718d55a7e9fc288b47a57dfda.ts} +18 -6
  66. package/test/bind/components/BindComponent.torp +3 -18
  67. package/test/bind/components/BindText.torp +8 -10
  68. package/test/bind/components/output/BindComponent-client.ts +19 -30
  69. package/test/bind/components/output/BindComponent-server.ts +14 -20
  70. package/test/bind/components/output/BindText-client.ts +3 -3
  71. package/test/bind/components/output/BindText-server.ts +4 -3
  72. package/test/bind/components/temp/{BindComponent-client-6f650efb818a185ef33e1b071cfd77415a803dd3.ts → BindComponent-client-a59ee6a598341c64c79be633ae7b22cb594dd0bc.ts} +19 -30
  73. package/test/bind/components/temp/{BindComponent-server-2e6caf0cbbb2831eb4bfbd7dcd6cf4d5c422d047.ts → BindComponent-server-96120f1e75c77e02ba11ab719c225005e168d25f.ts} +14 -20
  74. package/test/bind/components/temp/{BindText-client-134676d616abbad6b8a7ec48df0a2e38cbfe3b87.ts → BindText-client-dac614203e672e51675b22a246983168a7c173ea.ts} +3 -3
  75. package/test/bind/components/temp/{BindText-server-807a1ddcb68410b30429cb088d2e204ed6f585b2.ts → BindText-server-c713033ef787587f752fc8e6282e3a8faeee9a08.ts} +4 -3
  76. package/test/build-server/build-server.test.ts +1 -1
  77. package/test/build-server/components/IfNested.torp +11 -13
  78. package/test/buildHtml.ts +1 -1
  79. package/test/buildOutputFiles.ts +4 -4
  80. package/test/child-component/components/ParentChild.torp +1 -3
  81. package/test/child-component/components/output/ParentChild-client.ts +4 -5
  82. package/test/child-component/components/output/ParentChild-server.ts +12 -8
  83. package/test/child-component/components/temp/{ParentChild-client-50ca7e499599209c9d674f2561413ca14a282c22.ts → ParentChild-client-198e4ebc2ef5277ad7147f69d5879946fbe2d6ec.ts} +4 -5
  84. package/test/child-component/components/temp/{ParentChild-server-5e4a7fa5f4cd1c7dbe6866819025d2c03bfc62cb.ts → ParentChild-server-55e809830788ae740608136cf66664fc5434a9cd.ts} +12 -8
  85. package/test/class/components/Class.torp +22 -24
  86. package/test/class/components/output/Class-client.ts +7 -9
  87. package/test/class/components/output/Class-server.ts +13 -10
  88. package/test/class/components/temp/{Class-client-de2491c550647203bea08727fa8c88f30654db0a.ts → Class-client-7defac0b98d9c9f303670c0372e329e31823f163.ts} +7 -9
  89. package/test/class/components/temp/Class-server-46563e9c3bf56b642ac496b60179decfd0b4e952.ts +43 -0
  90. package/test/component/components/output/Component-server.ts +8 -5
  91. package/test/component/components/output/Header-server.ts +4 -3
  92. package/test/component/components/temp/{Component-server-57f59c74599572da6322a67cb97848cfbfcf6968.ts → Component-server-2d4aa317e6c385036e07f4c3946fc18ba848c00d.ts} +8 -5
  93. package/test/component/components/temp/{Header-server-6969d20782edd8f99d4b5c5b7b5563ce26e6dc2d.ts → Header-server-91088d2a5a543287bfdf1a24d92b66db6ccd294d.ts} +4 -3
  94. package/test/console/components/output/Console-server.ts +4 -3
  95. package/test/console/components/temp/{Console-server-cfb2208b130d5f15403df19ae8341aaa1c9ad33a.ts → Console-server-7bc7f568e9c3626dca1bdafcb23186c2dbc59199.ts} +4 -3
  96. package/test/const/components/Const.torp +4 -6
  97. package/test/const/components/output/Const-client.ts +2 -2
  98. package/test/const/components/output/Const-server.ts +5 -4
  99. package/test/const/components/temp/{Const-client-7dff2758c14bfbd208e301a702ae1781e6daba1b.ts → Const-client-b0293a037d9ed7b6ad4591c153723a3c26d46029.ts} +2 -2
  100. package/test/const/components/temp/{Const-server-1cf6ed84f72d3b15b318b80937b8de1f2c0f188c.ts → Const-server-5fd2444a9ae7a676b7c4480e01e28f7f89624fdc.ts} +5 -4
  101. package/test/dummy/components/temp/ProfilePreview-client-e57ca1ac502e0ddcb3ef376dd5ef27add70090d1.ts +327 -0
  102. package/test/dummy/components/temp/ProfilePreview-server-9d3d0f8b4f80f634db6ba97d037ab07de004b4d3.ts +56 -0
  103. package/test/effects/components/For.torp +3 -5
  104. package/test/effects/components/If.torp +5 -7
  105. package/test/effects/components/NestedIf.torp +6 -8
  106. package/test/effects/components/output/For-client.ts +5 -6
  107. package/test/effects/components/output/For-server.ts +6 -5
  108. package/test/effects/components/output/If-client.ts +5 -7
  109. package/test/effects/components/output/If-server.ts +7 -6
  110. package/test/effects/components/output/NestedIf-client.ts +4 -6
  111. package/test/effects/components/output/NestedIf-server.ts +9 -8
  112. package/test/effects/components/temp/{For-client-35bf9bea43f53d6c0cf807f9e31500765fa0b455.ts → For-client-268e69779d5b744377af9b30df256a453adaf183.ts} +5 -6
  113. package/test/effects/components/temp/{For-server-efe60939d185315f4c9b567b6867c6d5af14d9aa.ts → For-server-b15b01b4daaf50fd95de790102089eb930e84e9b.ts} +6 -5
  114. package/test/effects/components/temp/{If-client-efb994796596d9d08f59a0ab5ffdacc74bd04545.ts → If-client-4df0e6fc27a6f7d60ce056fd65df687213f3a2f9.ts} +5 -7
  115. package/test/effects/components/temp/{If-server-2424b7b812d350d7eb8ff9afb1146807217320cd.ts → If-server-0a213ea232e0225d5a8ecb012ad418136b86fbe7.ts} +7 -6
  116. package/test/effects/components/temp/{NestedIf-client-845b3789b8a938439bff758bc9b3731d769c8ff6.ts → NestedIf-client-bfd381672c51febbe2f101f19afd5f6ff570ce7e.ts} +4 -6
  117. package/test/effects/components/temp/{NestedIf-server-ab260586490cb5afed31377d2226bb5a1fc30e2d.ts → NestedIf-server-6089abc72d6208e64d1818ddb624ad5c3f236afa.ts} +9 -8
  118. package/test/events/components/Increment.torp +9 -11
  119. package/test/events/components/output/Increment-client.ts +3 -3
  120. package/test/events/components/output/Increment-server.ts +4 -3
  121. package/test/events/components/temp/{Increment-client-1b5f9e231c5c4fc059d77ca0da632719283e5ac4.ts → Increment-client-db2fd3376f12b186a4276eac470bf10b7bf2da19.ts} +3 -3
  122. package/test/events/components/temp/{Increment-server-b084f43082e2ec31dbe5f9edc1cb6e37e4c8df9d.ts → Increment-server-062b9757192b84e5a6e247aa44e1e7887129293d.ts} +4 -3
  123. package/test/for/components/output/For-server.ts +6 -5
  124. package/test/for/components/output/ForEscape-server.ts +6 -5
  125. package/test/for/components/output/ForIn-server.ts +6 -5
  126. package/test/for/components/output/ForOf-server.ts +6 -5
  127. package/test/for/components/temp/{For-server-3b6ead39728c79206203c519a215390d07d80f7e.ts → For-server-082c156a9f047995bc55f9477295d8e3262614f5.ts} +6 -5
  128. package/test/for/components/temp/{ForEscape-server-ed906c8cd593a0b467073ada415734de31dc38d9.ts → ForEscape-server-2db43ff8397ddbb114b5bff3d88a63728184a811.ts} +6 -5
  129. package/test/for/components/temp/{ForIn-server-c8f13304a2ba235e091685256909fbfa50bdd5fd.ts → ForIn-server-fda7a21cbb8a7ad69c48d2a8533cc13fa98d54b6.ts} +6 -5
  130. package/test/for/components/temp/{ForOf-server-8c2c33ca6595bf0a5e952ca9971e595e18446623.ts → ForOf-server-cd2b01507304e25c34030755b915f56785375de8.ts} +6 -5
  131. package/test/function/components/Function.torp +8 -10
  132. package/test/function/components/output/Function-client.ts +3 -3
  133. package/test/function/components/output/Function-server.ts +5 -4
  134. package/test/function/components/temp/{Function-client-4e2168306756eb927d5ed4b673334b357eecaa74.ts → Function-client-2068eb8ae35b3157b8eda79addde6afd9f4d7006.ts} +3 -3
  135. package/test/function/components/temp/{Function-server-2b19d0cd881c31dc67132107c6e322a18701c318.ts → Function-server-4b66a728f6f1b170d678313238bdc9158356511e.ts} +5 -4
  136. package/test/html/components/output/Html-server.ts +4 -3
  137. package/test/html/components/temp/{Html-server-d159b0ef04b1f65ae4f9e05a7b44b21e7aa14cf9.ts → Html-server-4f73a2b0c5cd9b82666a99ec6a217c758d435008.ts} +4 -3
  138. package/test/hydrateComponent.ts +2 -3
  139. package/test/if/components/output/IfAfterIf-server.ts +8 -7
  140. package/test/if/components/output/IfElse-server.ts +7 -6
  141. package/test/if/components/output/IfElseIf-server.ts +8 -7
  142. package/test/if/components/output/IfFalse-server.ts +6 -5
  143. package/test/if/components/output/IfNested-server.ts +10 -9
  144. package/test/if/components/temp/{IfAfterIf-server-a5005147e7902d1a5a048c9fe07feb9804eb6560.ts → IfAfterIf-server-3e6a3beab27821c3e53290ee72eca811814aad38.ts} +8 -7
  145. package/test/if/components/temp/{IfElse-server-80d93e5fc4ceba7a645f7081fa11b177dbe730d0.ts → IfElse-server-1b5006dfad695f257c7453a79bde3944898fbf6d.ts} +7 -6
  146. package/test/if/components/temp/{IfElseIf-server-ddc7348705d51b02538301e0aa704130748992cf.ts → IfElseIf-server-11c65065e9e5640ad65cd0c37af07f1e57c4f49c.ts} +8 -7
  147. package/test/if/components/temp/{IfFalse-server-e8385013cfdde584b43cc0d71311cbb417859116.ts → IfFalse-server-40d07bc07e5edffd7386fb6016cd025b98175219.ts} +6 -5
  148. package/test/if/components/temp/{IfNested-server-285a5d8e0e0fcc8ccf421df152fdc00811782835.ts → IfNested-server-061ea3d56576a352be8a9db8424fae0f1d74cd36.ts} +10 -9
  149. package/test/mount/components/output/Mount-server.ts +4 -3
  150. package/test/mount/components/temp/{Mount-server-62f94f276c2d6c9048765a77b575cb21146917f1.ts → Mount-server-8564e4e0886ea754dfedf9a4a5fd82f0484c1d83.ts} +4 -3
  151. package/test/on-mount/components/output/OnMount-server.ts +4 -3
  152. package/test/on-mount/components/temp/{OnMount-server-c531f718eb68754ea6c3001d5db9c07c511e434c.ts → OnMount-server-2ff035e067926fadc284030075aa5da69a05cf31.ts} +4 -3
  153. package/test/party/components/AnswerButton.torp +2 -5
  154. package/test/party/components/AnswerButtonApp.torp +3 -5
  155. package/test/party/components/ColorSelect.torp +8 -10
  156. package/test/party/components/Counter.torp +2 -4
  157. package/test/party/components/CssStyle.torp +2 -4
  158. package/test/party/components/FunnyButtonApp.torp +2 -4
  159. package/test/party/components/InputHello.torp +2 -4
  160. package/test/party/components/IsAvailable.torp +3 -5
  161. package/test/party/components/PickPill.torp +5 -7
  162. package/test/party/components/TrafficLight.torp +12 -14
  163. package/test/party/components/UserProfile.torp +4 -6
  164. package/test/party/components/UserProfileContext.torp +6 -8
  165. package/test/party/components/UserProfileContextApp.torp +2 -4
  166. package/test/party/components/output/AnswerButton-client.ts +3 -4
  167. package/test/party/components/output/AnswerButton-server.ts +4 -3
  168. package/test/party/components/output/AnswerButtonApp-client.ts +4 -5
  169. package/test/party/components/output/AnswerButtonApp-server.ts +8 -5
  170. package/test/party/components/output/ColorSelect-client.ts +4 -4
  171. package/test/party/components/output/ColorSelect-server.ts +6 -5
  172. package/test/party/components/output/Colors-server.ts +6 -5
  173. package/test/party/components/output/Counter-client.ts +4 -4
  174. package/test/party/components/output/Counter-server.ts +4 -3
  175. package/test/party/components/output/CssStyle-client.ts +2 -2
  176. package/test/party/components/output/CssStyle-server.ts +4 -3
  177. package/test/party/components/output/DoubleCount-server.ts +4 -3
  178. package/test/party/components/output/FunnyButton-server.ts +7 -6
  179. package/test/party/components/output/FunnyButtonApp-client.ts +5 -8
  180. package/test/party/components/output/FunnyButtonApp-server.ts +15 -10
  181. package/test/party/components/output/HelloWorld-server.ts +4 -3
  182. package/test/party/components/output/InputFocused-server.ts +4 -3
  183. package/test/party/components/output/InputHello-client.ts +4 -4
  184. package/test/party/components/output/InputHello-server.ts +4 -3
  185. package/test/party/components/output/IsAvailable-client.ts +4 -4
  186. package/test/party/components/output/IsAvailable-server.ts +4 -3
  187. package/test/party/components/output/Name-server.ts +4 -3
  188. package/test/party/components/output/NameUpdate-server.ts +4 -3
  189. package/test/party/components/output/PageTitle-server.ts +4 -3
  190. package/test/party/components/output/PickPill-client.ts +4 -4
  191. package/test/party/components/output/PickPill-server.ts +4 -3
  192. package/test/party/components/output/Time-server.ts +4 -3
  193. package/test/party/components/output/TrafficLight-client.ts +3 -3
  194. package/test/party/components/output/TrafficLight-server.ts +8 -7
  195. package/test/party/components/output/UserProfile-client.ts +6 -6
  196. package/test/party/components/output/UserProfile-server.ts +4 -3
  197. package/test/party/components/output/UserProfileApp-server.ts +8 -5
  198. package/test/party/components/output/UserProfileContext-client.ts +5 -5
  199. package/test/party/components/output/UserProfileContext-server.ts +4 -3
  200. package/test/party/components/output/UserProfileContextApp-client.ts +5 -6
  201. package/test/party/components/output/UserProfileContextApp-server.ts +8 -5
  202. package/test/party/components/temp/{AnswerButton-client-ad8f8db36b7aaa68d8de5898a324bacfbe9f20df.ts → AnswerButton-client-890e28879c132eea21260eb82af832afc6a48507.ts} +3 -4
  203. package/test/party/components/temp/{AnswerButton-server-928b5d447afa865fa09e0142c79bb1f2c1b86875.ts → AnswerButton-server-01ffab9f6f92073640df2cf2cb5473407d82b24f.ts} +4 -3
  204. package/test/party/components/temp/{AnswerButtonApp-client-5661f07868550612bcdeee268b82c473af6a2613.ts → AnswerButtonApp-client-295a835cadf7e7ccec608f84ed01865dd8c73954.ts} +4 -5
  205. package/test/party/components/temp/{AnswerButtonApp-server-e4ea88e0f4d65508950594437e5e34424bd28897.ts → AnswerButtonApp-server-b458692868307e6e08ad3deed9c2db542c28dee0.ts} +8 -5
  206. package/test/party/components/temp/{ColorSelect-client-70bf59d6399d63c0eed421b9d370a1e5c97a89ca.ts → ColorSelect-client-5f74d3b38193a0c9b22317598cdbf2f56754ca2b.ts} +4 -4
  207. package/test/party/components/temp/{ColorSelect-server-90f83722bd85155ebb2b8ccdaf053cd28d3152be.ts → ColorSelect-server-cf0b1b533948a558e1705d9a7cca3c0b6ae8d315.ts} +6 -5
  208. package/test/party/components/temp/{Colors-server-e13d49ba57f7b0dc6fb10a333ec872f5207e1ff0.ts → Colors-server-b050714bfe752b88a99f6498f1b5c13abe6b56a5.ts} +6 -5
  209. package/test/party/components/temp/{Counter-client-3b876c148f2b14da1766eff77eb6c494f7be6414.ts → Counter-client-006caeda8766cb17a161da0c6f58f006f8f16e8b.ts} +4 -4
  210. package/test/party/components/temp/{Counter-server-7adf9376b38d97f1fd4b9c14108e6814e81f14ea.ts → Counter-server-931d36d8e4bcd114047bbfec8aa5f2fac0c2ce1e.ts} +4 -3
  211. package/test/party/components/temp/{CssStyle-client-37465dd48d1479db1bae513eb0b92c4e9a15e9ea.ts → CssStyle-client-6ec06cbc4b34344234d289f6c4a9e427efff85a7.ts} +2 -2
  212. package/test/party/components/temp/{CssStyle-server-90a950501a20bfa5feac84ca6d97898c25bce2ed.ts → CssStyle-server-fa4bad3c82930632730e3b6b9f0e9193cab6f777.ts} +4 -3
  213. package/test/party/components/temp/{DoubleCount-server-62c94483ebe9661e5ecc4f489787e32448ddcafa.ts → DoubleCount-server-8c013a97a08562deb6ad0f35e6e337203b0ddde9.ts} +4 -3
  214. package/test/party/components/temp/{FunnyButton-server-e0adab2be2d283acb8a8b580479ade999dc918e9.ts → FunnyButton-server-3fd55a1e1dc71c183a6cea68e4c4693c988b7533.ts} +7 -6
  215. package/test/party/components/temp/{FunnyButtonApp-client-daa929c6d64f67e4a1a387b884317a4bb615b5d4.ts → FunnyButtonApp-client-1f2258b8488469d4704366bc49f5c171d8a854ae.ts} +5 -8
  216. package/test/party/components/temp/{FunnyButtonApp-server-80d85ede7da558154a5aa17cd602d6724bf1c9cb.ts → FunnyButtonApp-server-6463d1c57adf61450d1415f0d76da4561ca3e798.ts} +15 -10
  217. package/test/party/components/temp/{HelloWorld-server-e0ed80e7531f303952a4af30d646263ff2e4ead6.ts → HelloWorld-server-50dd4393d55ecd33d5b7684c4f9ed41dfa0ceb5d.ts} +4 -3
  218. package/test/party/components/temp/{InputFocused-server-ee70758a515227c04788be0e298a79c277994ccd.ts → InputFocused-server-7b062b0dd7686ccc389c3c1a17f37e9a9bb19da9.ts} +4 -3
  219. package/test/party/components/temp/{InputHello-client-2a4cbd980534fde14b9d3e8a2f8e4f59a4f15d64.ts → InputHello-client-496d26bdeb6a168c4242e45f35d22e6ecbd211b9.ts} +4 -4
  220. package/test/party/components/temp/{InputHello-server-1b9dd5442ded022abe92a9075ca5a4bb90486cbe.ts → InputHello-server-a5fb3e0d8766c19d177a1f4d43d421c7da1b92ab.ts} +4 -3
  221. package/test/party/components/temp/{IsAvailable-client-3949f85aea0e935c3b59ab1389baee836eff1866.ts → IsAvailable-client-491b92b5e21ebe1bbab47b2e422c35fb996b55e1.ts} +4 -4
  222. package/test/party/components/temp/{IsAvailable-server-123daa1ae56b77defe6666faddb44ba4252dd0fb.ts → IsAvailable-server-c0da3c019ef13617d2ab51353eb3360ddaae4189.ts} +4 -3
  223. package/test/party/components/temp/{Name-server-a402418f1ca2d8a0e6403596ec03ec47b5ff40ec.ts → Name-server-0306b0c622d71323eb79a6b466d900380a0944f3.ts} +4 -3
  224. package/test/party/components/temp/{NameUpdate-server-b7dcc875e894a5606544fcd78bda575ea07632ca.ts → NameUpdate-server-a54ea11dc6b8f0b55d29ad29163cf27b9aa6ec40.ts} +4 -3
  225. package/test/party/components/temp/{PageTitle-server-12dcb4e437aaef227c704a2ee8bbdee55ca323dc.ts → PageTitle-server-8b34f9af760ab39e20a60e10ee3185e70d92e42b.ts} +4 -3
  226. package/test/party/components/temp/{PickPill-client-0f13aa652cb1bd45f57d5a249f8364e80204441a.ts → PickPill-client-a1f48b5c28db87eb57f0ac1f6b4370e4b2952de7.ts} +4 -4
  227. package/test/party/components/temp/{PickPill-server-f10dae4708e36775a5e1a5ad10c6c0c309335009.ts → PickPill-server-9596fdb8ff254cb4e1b99b714f3c5e8ea8aaa308.ts} +4 -3
  228. package/test/party/components/temp/{Time-server-8e0278a4b16925903f3c4ceedbf1332cde4921fa.ts → Time-server-da1cafe72c0f9a6dbf15a04dfa7282ae5187c101.ts} +4 -3
  229. package/test/party/components/temp/{TrafficLight-client-4a90675ca6157ed7701aefa0d9141575960a1d47.ts → TrafficLight-client-d04c95686ec0ad8a9c54710773945e9904224d5e.ts} +3 -3
  230. package/test/party/components/temp/{TrafficLight-server-04bb3b2f11322ccc97a9a8a8fbb26c3c99843042.ts → TrafficLight-server-6c0f66cdabfc7239b99665c3f7087462ee302e8a.ts} +8 -7
  231. package/test/party/components/temp/{UserProfile-client-11c2a928de5a5ed4cab45186f08ca09f6161afb5.ts → UserProfile-client-a59466813b208664f35e6e394858c3d61e040644.ts} +6 -6
  232. package/test/party/components/temp/{UserProfile-server-a0576b8d9dd15b3fab6c11758984c686ddfe2f66.ts → UserProfile-server-b10ec192e03dc818fe66dbd4aad14200e817e596.ts} +4 -3
  233. package/test/party/components/temp/{UserProfileApp-server-86c204098fd0ffbeded50372354488768b255156.ts → UserProfileApp-server-4b308db466a80bcacd190aa71f86cf4d2b6f2873.ts} +8 -5
  234. package/test/party/components/temp/{UserProfileContext-client-c97c077254210061b3c9ba561f681c0cf4f6167f.ts → UserProfileContext-client-7ef27199bd35b55b3dadd876174a2ef4b602b63f.ts} +5 -5
  235. package/test/party/components/temp/{UserProfileContext-server-2d32476b00448bdec6c1c45aac5087a5152c2471.ts → UserProfileContext-server-df958e4fc2de2242c556ffa61ddb58aa395de50c.ts} +4 -3
  236. package/test/party/components/temp/{UserProfileContextApp-client-05ce216919de6ffde56d1c2c39299173d9b611b3.ts → UserProfileContextApp-client-b3ef357f481dfb940e1c726690d57567fde2dc23.ts} +5 -6
  237. package/test/party/components/temp/{UserProfileContextApp-server-c970abaa8326db9a5efc3a5c64741743ae0dd1ca.ts → UserProfileContextApp-server-f8fe2b88db3d0dfa4dafd300006b25123cb8e3fb.ts} +8 -5
  238. package/test/props/components/Reactive.torp +2 -4
  239. package/test/props/components/output/Reactive-client.ts +4 -5
  240. package/test/props/components/output/Reactive-server.ts +12 -8
  241. package/test/props/components/temp/{Reactive-client-cf6e602b2f74fce8e9451b6c41c6f8ff8eab63a3.ts → Reactive-client-21a24e3b0a76140567db8a01975317c9c0e0ad5a.ts} +4 -5
  242. package/test/props/components/temp/{Reactive-server-206bcc8984bad12c5712661b77d000216cdfe66d.ts → Reactive-server-b6e37b5d3488ea74a260ca972906bfab30dde486.ts} +12 -8
  243. package/test/replace/components/Replace.torp +3 -5
  244. package/test/replace/components/output/Replace-client.ts +4 -5
  245. package/test/replace/components/output/Replace-server.ts +6 -5
  246. package/test/replace/components/temp/{Replace-client-2a9ee3430708b469fa31bbc6989eed5b2f22984d.ts → Replace-client-aee34e2e40c6f4380b61e9c7c8df9af1897f06cc.ts} +4 -5
  247. package/test/replace/components/temp/{Replace-server-9519943d193b681e1d7894a0d7952affdfb0660c.ts → Replace-server-3521251fa687ce42af3128d22b129fe1ec6ed411.ts} +6 -5
  248. package/test/slots/components/output/Article-server.ts +10 -9
  249. package/test/slots/components/output/Basic-server.ts +11 -8
  250. package/test/slots/components/output/Header-server.ts +7 -6
  251. package/test/slots/components/output/Let-server.ts +11 -8
  252. package/test/slots/components/output/List-server.ts +8 -7
  253. package/test/slots/components/output/Named-server.ts +14 -11
  254. package/test/slots/components/output/Unused-server.ts +8 -5
  255. package/test/slots/components/temp/{Article-server-b84141b05064f5ea1e4b535faafe459df0d875fb.ts → Article-server-50fa458663f115c0e80a3a2846de4607d8748ecb.ts} +10 -9
  256. package/test/slots/components/temp/{Basic-server-6b37594c9bf74e0c86a05b20213f69651e2cc937.ts → Basic-server-593e0ecbc8abbc90e8b06198698d244d110d97e2.ts} +11 -8
  257. package/test/slots/components/temp/{Header-server-d8e8ccb129d84478f0c4f8dc8ad1d2091188cc7b.ts → Header-server-d0f27afc4db322e605491e8f508e83f625e8dc38.ts} +7 -6
  258. package/test/slots/components/temp/{Let-server-8cad3b1199bec801bc3a1f2f3dbc20f2ef1e9741.ts → Let-server-f3c026e37c11628914c495083752d8cf285b2e85.ts} +11 -8
  259. package/test/slots/components/temp/{List-server-f4f63df4d19e15311da347284935a1bb530a8df4.ts → List-server-8d9c174fc4b3b232f3a9fd2f59843481f023d913.ts} +8 -7
  260. package/test/slots/components/temp/{Named-server-2aac48bb8c7300d1a8858917fe81edc17c6372fa.ts → Named-server-ac8d47db82d9a387c8baeee59b975bb810bad168.ts} +14 -11
  261. package/test/slots/components/temp/{Unused-server-6e832928d7db6c43c556e7bda8af34ac37c0d4c1.ts → Unused-server-1da99efc50ef70be0d9a0e5499353a17dc666936.ts} +8 -5
  262. package/test/special-component/components/output/BigTitle-server.ts +6 -5
  263. package/test/special-component/components/output/Component-server.ts +13 -10
  264. package/test/special-component/components/output/SmallTitle-server.ts +6 -5
  265. package/test/special-component/components/temp/{BigTitle-server-d8919a4c975e022c936584bd668917cb89aa8e20.ts → BigTitle-server-34af54c15cf575163c1ff8e63978cf5257f2347c.ts} +6 -5
  266. package/test/special-component/components/temp/{Component-server-14cd9beb57d6e833f75ab8c6624eb9841444ef63.ts → Component-server-ca4a2192477db4a32ad12f1a6a14d673717b0f7b.ts} +13 -10
  267. package/test/special-component/components/temp/{SmallTitle-server-0a9b5098e4dda96f8c1da30294d71b39997dd118.ts → SmallTitle-server-6c9aabb9139356397e04612b4dd9d849f871a280.ts} +6 -5
  268. package/test/special-element/components/output/Element-server.ts +4 -3
  269. package/test/special-element/components/temp/{Element-server-166d672256ef4635168de0090e490e48b569c7d6.ts → Element-server-011a942cc147900d8e074c084297d8e81f05aa27.ts} +4 -3
  270. package/test/special-head/components/Head.torp +3 -5
  271. package/test/special-head/components/output/Head-client.ts +2 -6
  272. package/test/special-head/components/output/Head-server.ts +4 -3
  273. package/test/special-head/components/temp/{Head-client-18616689a7d6f83ca076c9d825606b049de9d3ef.ts → Head-client-967d6ea24d46308af586c7553f4658412d94716c.ts} +2 -6
  274. package/test/special-head/components/temp/{Head-server-c0956653b544ff632e36da15d5f7623fa285953a.ts → Head-server-7cf8212c95197ed6320b47483524d8b1b3e5ae68.ts} +4 -3
  275. package/test/special-self/components/Self.torp +4 -6
  276. package/test/special-self/components/output/Self-client.ts +5 -6
  277. package/test/special-self/components/output/Self-server.ts +10 -7
  278. package/test/special-self/components/temp/{Self-client-43a0a90fac58867c88bf32221883e8da342a0295.ts → Self-client-883ca81e0e44df56f2290698e8d6b9955434a2ad.ts} +5 -6
  279. package/test/special-self/components/temp/{Self-server-b857c30c279a16dd81ad29567fb8abb9b2a0c239.ts → Self-server-69dac409fc984db7db97df8a30c5de6794f25655.ts} +10 -7
  280. package/test/style/components/output/Style-client.ts +1 -1
  281. package/test/style/components/output/Style-server.ts +5 -4
  282. package/test/style/components/temp/{Style-client-bc13f8dbb5f754e4eebb2473fc63a139ebf1ba92.ts → Style-client-ea018338497095f270308b2e73cfe6344721c6eb.ts} +1 -1
  283. package/test/style/components/temp/{Style-server-85720cb43e20ab000f98bc632c29454a51ae92d9.ts → Style-server-99ff9867ee067760a463a8282773b2eb09aa14f7.ts} +5 -4
  284. package/test/svg/components/output/Shape-server.ts +7 -6
  285. package/test/svg/components/temp/Shape-server-4ef7e80f09d3d4c930055d0a25184c48507e51de.ts +25 -0
  286. package/test/switch/components/Switch.torp +16 -18
  287. package/test/switch/components/output/Switch-client.ts +6 -8
  288. package/test/switch/components/output/Switch-server.ts +8 -7
  289. package/test/switch/components/temp/{Switch-client-30113fadf131c72e7c24160fa62068b651716896.ts → Switch-client-1482e2da8fe144d3e867dfad4618e0f364b91b49.ts} +6 -8
  290. package/test/switch/components/temp/{Switch-server-c1b5e1c657438ee3d8afdbf2166c5295cafc5604.ts → Switch-server-d709eb7a418752dd4203a8f824b78c5f308c8f47.ts} +8 -7
  291. package/test/text/components/Text.torp +5 -7
  292. package/test/text/components/output/Text-client.ts +4 -4
  293. package/test/text/components/output/Text-server.ts +4 -3
  294. package/test/text/components/temp/{Text-client-e335aae6d8aef389dfdbb5bee14e3dd3d41e86bd.ts → Text-client-ca2d5402358fba0df1db2353eed304b0dedb7971.ts} +4 -4
  295. package/test/text/components/temp/{Text-server-e37d33aa182f36461927d8ce36040bfd05e2f227.ts → Text-server-9df4606b85f044ea2b38660e799988461edacb27.ts} +4 -3
  296. package/test/watch-array/components/output/Array-server.ts +6 -5
  297. package/test/watch-array/components/output/ArrayEntries-server.ts +6 -5
  298. package/test/watch-array/components/output/ArrayIndexes-server.ts +6 -5
  299. package/test/watch-array/components/output/ArrayUnkeyed-server.ts +6 -5
  300. package/test/watch-array/components/temp/{Array-server-c907209008ac6177f614b62931a2bb1f1c3a04e1.ts → Array-server-48864ed3b67cae2bcedb216865776e44cc3a1dc2.ts} +6 -5
  301. package/test/watch-array/components/temp/{ArrayEntries-server-57c1ab0045fa4a02de95f69a65de6f54efe9850c.ts → ArrayEntries-server-401a989fd5f3a093d5d1a8ef1d4fd9d5107a6be3.ts} +6 -5
  302. package/test/watch-array/components/temp/{ArrayIndexes-server-f093878b94a37617e2e697a786caa680f75630a7.ts → ArrayIndexes-server-35c31a8a4597da68d39cf20bd6b90137695514de.ts} +6 -5
  303. package/test/watch-array/components/temp/{ArrayUnkeyed-server-c893fa024be07e5e7fce608c3ae456bdf2279dbe.ts → ArrayUnkeyed-server-19f195f0cf00760c520ac4c55aef474c8eae4c41.ts} +6 -5
  304. package/test/watch-object/components/Watched.torp +5 -7
  305. package/test/watch-object/components/output/Watched-client.ts +2 -2
  306. package/test/watch-object/components/output/Watched-server.ts +4 -3
  307. package/test/watch-object/components/temp/{Watched-client-d26e846bbeb8271ec5dc2a1ceb75b362af44d3bd.ts → Watched-client-ddba353c5a94f5a874e19d6d4cc6271a04e915c0.ts} +2 -2
  308. package/test/watch-object/components/temp/{Watched-server-312fca1e769d7594fc5bb6295ccf55b544dd2f4d.ts → Watched-server-e8e8c15b9fb5dda4051a289e9cd75d71078b9e95.ts} +4 -3
  309. package/dist/chunk-T6JGCJ5T.js +0 -45
  310. package/dist/chunk-T6JGCJ5T.js.map +0 -1
  311. package/src/render/getStyles.ts +0 -7
  312. package/src/render/isComment.ts +0 -3
  313. package/src/render/isText.ts +0 -3
  314. package/test/bench/components/temp/Bench-client-fca94b485c6263778751927240ab3ca4048d7a10.ts +0 -208
  315. package/test/class/components/temp/Class-server-c24c01d0d3a98169172aba453c183c4152705be9.ts +0 -40
  316. package/test/svg/components/temp/Shape-server-9951ff1dcc7aa0827f28d3f8d970813767115ae3.ts +0 -24
package/dist/ssr.cjs CHANGED
@@ -25,9 +25,9 @@ __export(ssr_exports, {
25
25
  $unwrap: () => $serverUnwrap,
26
26
  $watch: () => $serverWatch,
27
27
  t_attr: () => formatAttributeText,
28
- t_class: () => getClasses,
28
+ t_class: () => buildClasses,
29
29
  t_fmt: () => formatText,
30
- t_style: () => getStyles
30
+ t_style: () => buildStyles
31
31
  });
32
32
  module.exports = __toCommonJS(ssr_exports);
33
33
 
@@ -49,24 +49,21 @@ function $serverWatch(object) {
49
49
  return object;
50
50
  }
51
51
 
52
- // src/render/formatAttributeText.ts
53
- function formatAttributeText(value) {
54
- return (value ?? "").toString().replaceAll('"', """);
55
- }
56
-
57
- // src/render/formatText.ts
58
- function formatText(value) {
59
- return value ?? "";
60
- }
61
-
62
- // src/render/getClasses.ts
63
- function getClasses(value, styleHash) {
64
- let classes = [];
65
- gatherNames("", value, classes);
66
- if (styleHash) {
67
- classes.push(styleHash);
52
+ // src/render/buildClasses.ts
53
+ function buildClasses(value, styleHash) {
54
+ if (typeof value === "string") {
55
+ if (styleHash) {
56
+ value += " " + styleHash;
57
+ }
58
+ return value;
59
+ } else {
60
+ let classes = [];
61
+ gatherNames("", value, classes);
62
+ if (styleHash) {
63
+ classes.push(styleHash);
64
+ }
65
+ return classes.join(" ");
68
66
  }
69
- return classes.join(" ");
70
67
  }
71
68
  function gatherNames(name, value, classes) {
72
69
  if (value) {
@@ -84,13 +81,35 @@ function gatherNames(name, value, classes) {
84
81
  }
85
82
  }
86
83
 
87
- // src/render/getStyles.ts
88
- function getStyles(value) {
89
- let styles = [];
90
- for (let [n, v] of Object.entries(value)) {
91
- styles.push(`${n}: ${v}`);
84
+ // src/render/buildStyles.ts
85
+ function buildStyles(value) {
86
+ if (typeof value === "string") {
87
+ return value;
88
+ } else {
89
+ let styles = [];
90
+ if (value) {
91
+ if (Array.isArray(value)) {
92
+ for (let v of value) {
93
+ styles.push(v);
94
+ }
95
+ } else if (typeof value === "object") {
96
+ for (let [n, v] of Object.entries(value)) {
97
+ styles.push(`${n}: ${v}`);
98
+ }
99
+ }
100
+ }
101
+ return styles.join("; ");
92
102
  }
93
- return styles.join("; ");
103
+ }
104
+
105
+ // src/render/formatAttributeText.ts
106
+ function formatAttributeText(value) {
107
+ return (value ?? "").toString().replaceAll('"', """);
108
+ }
109
+
110
+ // src/render/formatText.ts
111
+ function formatText(value) {
112
+ return value ?? "";
94
113
  }
95
114
  // Annotate the CommonJS export names for ESM import in node:
96
115
  0 && (module.exports = {
package/dist/ssr.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ssr.ts","../src/render/$serverMount.ts","../src/render/$serverRun.ts","../src/render/$serverUnwrap.ts","../src/render/$serverWatch.ts","../src/render/formatAttributeText.ts","../src/render/formatText.ts","../src/render/getClasses.ts","../src/render/getStyles.ts"],"sourcesContent":["import $mount from \"./render/$serverMount\";\nimport $run from \"./render/$serverRun\";\nimport $unwrap from \"./render/$serverUnwrap\";\nimport $watch from \"./render/$serverWatch\";\nimport t_attr from \"./render/formatAttributeText\";\nimport t_fmt from \"./render/formatText\";\nimport t_class from \"./render/getClasses\";\nimport t_style from \"./render/getStyles\";\nimport { type ServerSlotRender } from \"./types/ServerSlotRender\";\n\nexport { $watch, $unwrap, $run, $mount, t_fmt, t_attr, t_class, t_style };\n\nexport type { ServerSlotRender };\n","import { type Cleanup } from \"../types/Cleanup\";\n\nexport default function $serverMount(_: () => Cleanup | void): void {}\n","import { type Cleanup } from \"../types/Cleanup\";\n\nexport default function $serverRun(_: () => Cleanup | void): void {}\n","export default function $serverUnwrap<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object;\n}\n","export default function $serverWatch<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object;\n}\n","export default function formatAttributeText(value: any): string {\n\treturn (value ?? \"\").toString().replaceAll('\"', \"&quot;\");\n}\n","export default function formatText(value: any): string {\n\treturn value ?? \"\";\n}\n","export default function getClasses(value: unknown, styleHash?: string): string {\n\tlet classes: string[] = [];\n\tgatherNames(\"\", value, classes);\n\tif (styleHash) {\n\t\tclasses.push(styleHash);\n\t}\n\treturn classes.join(\" \");\n}\n\nfunction gatherNames(name: unknown, value: unknown, classes: string[]) {\n\tif (value) {\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (let v of value) {\n\t\t\t\tgatherNames(v, v, classes);\n\t\t\t}\n\t\t} else if (typeof value === \"object\") {\n\t\t\tfor (let [n, v] of Object.entries(value)) {\n\t\t\t\tgatherNames(n, v, classes);\n\t\t\t}\n\t\t} else {\n\t\t\tclasses.push(name as string);\n\t\t}\n\t}\n}\n","export default function getStyles(value: Record<string, any>): string {\n\tlet styles: string[] = [];\n\tfor (let [n, v] of Object.entries(value)) {\n\t\tstyles.push(`${n}: ${v}`);\n\t}\n\treturn styles.join(\"; \");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEe,SAAR,aAA8B,GAA+B;AAAC;;;ACAtD,SAAR,WAA4B,GAA+B;AAAC;;;ACFpD,SAAR,cAAmE,QAAc;AACvF,SAAO;AACR;;;ACFe,SAAR,aAAkE,QAAc;AACtF,SAAO;AACR;;;ACFe,SAAR,oBAAqC,OAAoB;AAC/D,UAAQ,SAAS,IAAI,SAAS,EAAE,WAAW,KAAK,QAAQ;AACzD;;;ACFe,SAAR,WAA4B,OAAoB;AACtD,SAAO,SAAS;AACjB;;;ACFe,SAAR,WAA4B,OAAgB,WAA4B;AAC9E,MAAI,UAAoB,CAAC;AACzB,cAAY,IAAI,OAAO,OAAO;AAC9B,MAAI,WAAW;AACd,YAAQ,KAAK,SAAS;AAAA,EACvB;AACA,SAAO,QAAQ,KAAK,GAAG;AACxB;AAEA,SAAS,YAAY,MAAe,OAAgB,SAAmB;AACtE,MAAI,OAAO;AACV,QAAI,MAAM,QAAQ,KAAK,GAAG;AACzB,eAAS,KAAK,OAAO;AACpB,oBAAY,GAAG,GAAG,OAAO;AAAA,MAC1B;AAAA,IACD,WAAW,OAAO,UAAU,UAAU;AACrC,eAAS,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,KAAK,GAAG;AACzC,oBAAY,GAAG,GAAG,OAAO;AAAA,MAC1B;AAAA,IACD,OAAO;AACN,cAAQ,KAAK,IAAc;AAAA,IAC5B;AAAA,EACD;AACD;;;ACvBe,SAAR,UAA2B,OAAoC;AACrE,MAAI,SAAmB,CAAC;AACxB,WAAS,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,KAAK,GAAG;AACzC,WAAO,KAAK,GAAG,CAAC,KAAK,CAAC,EAAE;AAAA,EACzB;AACA,SAAO,OAAO,KAAK,IAAI;AACxB;","names":[]}
1
+ {"version":3,"sources":["../src/ssr.ts","../src/render/$serverMount.ts","../src/render/$serverRun.ts","../src/render/$serverUnwrap.ts","../src/render/$serverWatch.ts","../src/render/buildClasses.ts","../src/render/buildStyles.ts","../src/render/formatAttributeText.ts","../src/render/formatText.ts"],"sourcesContent":["import $mount from \"./render/$serverMount\";\nimport $run from \"./render/$serverRun\";\nimport $unwrap from \"./render/$serverUnwrap\";\nimport $watch from \"./render/$serverWatch\";\nimport t_class from \"./render/buildClasses\";\nimport t_style from \"./render/buildStyles\";\nimport t_attr from \"./render/formatAttributeText\";\nimport t_fmt from \"./render/formatText\";\nimport { type ServerSlotRender } from \"./types/ServerSlotRender\";\n\nexport { $watch, $unwrap, $run, $mount, t_fmt, t_attr, t_class, t_style };\n\nexport type { ServerSlotRender };\n","import { type Cleanup } from \"../types/Cleanup\";\n\nexport default function $serverMount(_: () => Cleanup | void): void {}\n","import { type Cleanup } from \"../types/Cleanup\";\n\nexport default function $serverRun(_: () => Cleanup | void): void {}\n","export default function $serverUnwrap<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object;\n}\n","export default function $serverWatch<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object;\n}\n","export default function buildClasses(value: unknown, styleHash?: string): string {\n\tif (typeof value === \"string\") {\n\t\tif (styleHash) {\n\t\t\tvalue += \" \" + styleHash;\n\t\t}\n\t\treturn value;\n\t} else {\n\t\tlet classes: string[] = [];\n\t\tgatherNames(\"\", value, classes);\n\t\tif (styleHash) {\n\t\t\tclasses.push(styleHash);\n\t\t}\n\t\treturn classes.join(\" \");\n\t}\n}\n\nfunction gatherNames(name: unknown, value: unknown, classes: string[]) {\n\tif (value) {\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (let v of value) {\n\t\t\t\tgatherNames(v, v, classes);\n\t\t\t}\n\t\t} else if (typeof value === \"object\") {\n\t\t\tfor (let [n, v] of Object.entries(value)) {\n\t\t\t\tgatherNames(n, v, classes);\n\t\t\t}\n\t\t} else {\n\t\t\tclasses.push(name as string);\n\t\t}\n\t}\n}\n","export default function buildStyles(value: unknown): string {\n\tif (typeof value === \"string\") {\n\t\treturn value;\n\t} else {\n\t\tlet styles: string[] = [];\n\t\tif (value) {\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\tfor (let v of value) {\n\t\t\t\t\tstyles.push(v);\n\t\t\t\t}\n\t\t\t} else if (typeof value === \"object\") {\n\t\t\t\tfor (let [n, v] of Object.entries(value)) {\n\t\t\t\t\tstyles.push(`${n}: ${v}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn styles.join(\"; \");\n\t}\n}\n","export default function formatAttributeText(value: any): string {\n\treturn (value ?? \"\").toString().replaceAll('\"', \"&quot;\");\n}\n","export default function formatText(value: any): string {\n\treturn value ?? \"\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEe,SAAR,aAA8B,GAA+B;AAAC;;;ACAtD,SAAR,WAA4B,GAA+B;AAAC;;;ACFpD,SAAR,cAAmE,QAAc;AACvF,SAAO;AACR;;;ACFe,SAAR,aAAkE,QAAc;AACtF,SAAO;AACR;;;ACFe,SAAR,aAA8B,OAAgB,WAA4B;AAChF,MAAI,OAAO,UAAU,UAAU;AAC9B,QAAI,WAAW;AACd,eAAS,MAAM;AAAA,IAChB;AACA,WAAO;AAAA,EACR,OAAO;AACN,QAAI,UAAoB,CAAC;AACzB,gBAAY,IAAI,OAAO,OAAO;AAC9B,QAAI,WAAW;AACd,cAAQ,KAAK,SAAS;AAAA,IACvB;AACA,WAAO,QAAQ,KAAK,GAAG;AAAA,EACxB;AACD;AAEA,SAAS,YAAY,MAAe,OAAgB,SAAmB;AACtE,MAAI,OAAO;AACV,QAAI,MAAM,QAAQ,KAAK,GAAG;AACzB,eAAS,KAAK,OAAO;AACpB,oBAAY,GAAG,GAAG,OAAO;AAAA,MAC1B;AAAA,IACD,WAAW,OAAO,UAAU,UAAU;AACrC,eAAS,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,KAAK,GAAG;AACzC,oBAAY,GAAG,GAAG,OAAO;AAAA,MAC1B;AAAA,IACD,OAAO;AACN,cAAQ,KAAK,IAAc;AAAA,IAC5B;AAAA,EACD;AACD;;;AC9Be,SAAR,YAA6B,OAAwB;AAC3D,MAAI,OAAO,UAAU,UAAU;AAC9B,WAAO;AAAA,EACR,OAAO;AACN,QAAI,SAAmB,CAAC;AACxB,QAAI,OAAO;AACV,UAAI,MAAM,QAAQ,KAAK,GAAG;AACzB,iBAAS,KAAK,OAAO;AACpB,iBAAO,KAAK,CAAC;AAAA,QACd;AAAA,MACD,WAAW,OAAO,UAAU,UAAU;AACrC,iBAAS,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,KAAK,GAAG;AACzC,iBAAO,KAAK,GAAG,CAAC,KAAK,CAAC,EAAE;AAAA,QACzB;AAAA,MACD;AAAA,IACD;AACA,WAAO,OAAO,KAAK,IAAI;AAAA,EACxB;AACD;;;AClBe,SAAR,oBAAqC,OAAoB;AAC/D,UAAQ,SAAS,IAAI,SAAS,EAAE,WAAW,KAAK,QAAQ;AACzD;;;ACFe,SAAR,WAA4B,OAAoB;AACtD,SAAO,SAAS;AACjB;","names":[]}
package/dist/ssr.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Cleanup } from './ServerSlotRender-t1sOutne.cjs';
2
- export { S as ServerSlotRender, g as t_class, f as t_fmt, a as t_style } from './ServerSlotRender-t1sOutne.cjs';
1
+ import { C as Cleanup } from './ServerSlotRender-BMGG0yq3.cjs';
2
+ export { S as ServerSlotRender, b as t_class, f as t_fmt, a as t_style } from './ServerSlotRender-BMGG0yq3.cjs';
3
3
 
4
4
  declare function $serverMount(_: () => Cleanup | void): void;
5
5
 
package/dist/ssr.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Cleanup } from './ServerSlotRender-t1sOutne.js';
2
- export { S as ServerSlotRender, g as t_class, f as t_fmt, a as t_style } from './ServerSlotRender-t1sOutne.js';
1
+ import { C as Cleanup } from './ServerSlotRender-BMGG0yq3.js';
2
+ export { S as ServerSlotRender, b as t_class, f as t_fmt, a as t_style } from './ServerSlotRender-BMGG0yq3.js';
3
3
 
4
4
  declare function $serverMount(_: () => Cleanup | void): void;
5
5
 
package/dist/ssr.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
- formatText,
3
- getClasses,
4
- getStyles
5
- } from "./chunk-T6JGCJ5T.js";
2
+ buildClasses,
3
+ buildStyles,
4
+ formatText
5
+ } from "./chunk-XNO4YEJ3.js";
6
6
 
7
7
  // src/render/$serverMount.ts
8
8
  function $serverMount(_) {
@@ -32,8 +32,8 @@ export {
32
32
  $serverUnwrap as $unwrap,
33
33
  $serverWatch as $watch,
34
34
  formatAttributeText as t_attr,
35
- getClasses as t_class,
35
+ buildClasses as t_class,
36
36
  formatText as t_fmt,
37
- getStyles as t_style
37
+ buildStyles as t_style
38
38
  };
39
39
  //# sourceMappingURL=ssr.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torpor/view",
3
- "version": "0.1.10",
3
+ "version": "0.2.0",
4
4
  "description": "Torpor's view library, for writing and mounting components",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -30,19 +30,19 @@
30
30
  "author": "",
31
31
  "license": "ISC",
32
32
  "devDependencies": {
33
- "@testing-library/dom": "^10.4.0",
34
- "@testing-library/jest-dom": "^6.6.3",
33
+ "@testing-library/dom": "^10.4.1",
34
+ "@testing-library/jest-dom": "^6.6.4",
35
35
  "@testing-library/user-event": "^14.6.1",
36
36
  "@trivago/prettier-plugin-sort-imports": "^5.2.2",
37
37
  "@types/jsdom": "^21.1.7",
38
- "@types/node": "^24.0.4",
38
+ "@types/node": "^24.2.1",
39
39
  "fast-glob": "^3.3.3",
40
40
  "jsdom": "^26.1.0",
41
41
  "sucrase": "^3.35.0",
42
42
  "tinybench": "^4.0.1",
43
43
  "tsup": "^8.5.0",
44
44
  "tsx": "^4.20.3",
45
- "typescript": "^5.8.3",
45
+ "typescript": "^5.9.2",
46
46
  "vitest": "^3.2.4"
47
47
  },
48
48
  "scripts": {
@@ -52,16 +52,23 @@ export default function buildComponentNode(
52
52
  value = value.substring(1, value.length - 1);
53
53
  buildRun("setProp", `${propsName}["${name}"] = ${value};`, status, b);
54
54
  buildRun("setBinding", `${value} = ${propsName}["${name}"];`, status, b);
55
- } else if (name === ":class" && value != null && isFullyReactive(value)) {
55
+ } else if ((name === "class" || name === ":class") && value != null) {
56
+ // NOTE: :class is obsolete, but let's keep it for a version or two
56
57
  status.imports.add("t_class");
57
- value = value.substring(1, value.length - 1);
58
+ if (isFullyReactive(value)) {
59
+ value = value.substring(1, value.length - 1);
60
+ }
61
+ const params = [value];
58
62
  if (node.scopeStyles) {
59
- value += `, "torp-${status.styleHash}"`;
63
+ params.push(`"torp-${status.styleHash}"`);
60
64
  }
61
- buildRun("setClasses", `${propsName}["class"] = t_class(${value});`, status, b);
62
- } else if (name === ":style" && value != null && isFullyReactive(value)) {
65
+ buildRun("setClasses", `${propsName}["class"] = t_class(${params.join(", ")});`, status, b);
66
+ } else if ((name === "style" || name === ":style") && value != null) {
67
+ // NOTE: :style is obsolete, but let's keep it for a version or two
63
68
  status.imports.add("t_style");
64
- value = value.substring(1, value.length - 1);
69
+ if (isFullyReactive(value)) {
70
+ value = value.substring(1, value.length - 1);
71
+ }
65
72
  buildRun("setStyles", `${propsName}["style"] = t_style(${value});`, status, b);
66
73
  } else if (value != null) {
67
74
  let fullyReactive = isFullyReactive(value);
@@ -71,11 +78,6 @@ export default function buildComponentNode(
71
78
  } else if (partlyReactive) {
72
79
  value = `\`${trimQuotes(value).replaceAll("{", "${")}\``;
73
80
  }
74
- if (name === "class") {
75
- // TODO: How to handle dynamic classes etc
76
- // Probably just compile down to a string?
77
- value = `"${trimQuotes(value)} torp-${status.styleHash}"`;
78
- }
79
81
  const setProp = `${propsName}["${name}"] = ${value};`;
80
82
  if (fullyReactive || partlyReactive) {
81
83
  buildRun("setProp", setProp, status, b);
@@ -134,8 +134,8 @@ function buildHeadNode(node: ElementNode, status: BuildStatus, b: Builder) {
134
134
  // TODO: dedupe e.g. <meta name="x"> or on special key
135
135
  b.append(`
136
136
  $run(function runHead() {
137
- const t_head_el = document.createElement("${node.tagName}");
138
- document.getElementsByTagName("head")[0].appendChild(t_head_el);`);
137
+ const t_headel = document.createElement("${node.tagName}");
138
+ document.getElementsByTagName("head")[0].appendChild(t_headel);`);
139
139
  for (let { name, value } of node.attributes) {
140
140
  if (name.startsWith("{") && name.endsWith("}")) {
141
141
  // It's a shortcut attribute
@@ -143,7 +143,7 @@ function buildHeadNode(node: ElementNode, status: BuildStatus, b: Builder) {
143
143
  // in either case we set the value of the width property
144
144
  name = name.substring(1, name.length - 1);
145
145
  const propName = name.split(".").at(-1);
146
- buildRun("setAttribute", `t_head_el.setAttribute("${propName}", ${name});`, status, b);
146
+ buildRun("setAttribute", `t_headel.setAttribute("${propName}", ${name});`, status, b);
147
147
  } else if (value != null && isReactive(value)) {
148
148
  // It's a reactive attribute
149
149
  if (isFullyReactive(value)) {
@@ -153,10 +153,10 @@ function buildHeadNode(node: ElementNode, status: BuildStatus, b: Builder) {
153
153
  }
154
154
 
155
155
  status.imports.add("t_attribute");
156
- buildRun("setAttribute", `t_attribute(t_head_el, "${name}", ${value});`, status, b);
156
+ buildRun("setAttribute", `t_attribute(t_headel, "${name}", ${value});`, status, b);
157
157
  } else if (value != null) {
158
158
  status.imports.add("t_attribute");
159
- b.append(`t_attribute(t_head_el, "${name}", ${value});`);
159
+ b.append(`t_attribute(t_headel, "${name}", ${value});`);
160
160
  }
161
161
  }
162
162
  b.append(`
@@ -217,17 +217,14 @@ function buildElementAttributes(
217
217
  buildEventAttribute(varName, name, value, status, b);
218
218
  } else if (name.startsWith(":transition")) {
219
219
  buildTransitionAttribute(node, varName, name, value, status, b);
220
- } else if (name === "class") {
221
- if (node.scopeStyles) {
222
- value += `+ "torp-${status.styleHash}"`;
223
- }
224
- buildRun("setClassName", `${varName}.className = ${value};`, status, b);
225
- } else if (name === ":class") {
220
+ } else if (name === "class" || name === ":class") {
221
+ // NOTE: :class is obsolete, but let's keep it for a version or two
226
222
  status.imports.add("t_class");
223
+ const params = [value];
227
224
  if (node.scopeStyles) {
228
- value += `, "torp-${status.styleHash}"`;
225
+ params.push(`"torp-${status.styleHash}"`);
229
226
  }
230
- buildRun("setClasses", `${varName}.className = t_class(${value});`, status, b);
227
+ buildRun("setClasses", `${varName}.className = t_class(${params.join(", ")});`, status, b);
231
228
  } else if (name === ":style") {
232
229
  status.imports.add("t_style");
233
230
  buildRun("setStyles", `${varName}.setAttribute("style", t_style(${value}));`, status, b);
@@ -19,7 +19,7 @@ export default function buildServerAwaitNode(
19
19
  status.output += HYDRATION_START_COMMENT;
20
20
 
21
21
  if (status.output) {
22
- b.append(`$output += \`${status.output}\`;`);
22
+ b.append(`t_body += \`${status.output}\`;`);
23
23
  status.output = "";
24
24
  }
25
25
 
@@ -43,7 +43,7 @@ function buildServerAwaitBranch(node: ControlNode, status: BuildServerStatus, b:
43
43
  }
44
44
 
45
45
  if (status.output) {
46
- b.append(`$output += \`${status.output}\`;`);
46
+ b.append(`t_body += \`${status.output}\`;`);
47
47
  status.output = "";
48
48
  }
49
49
  }
@@ -1,6 +1,7 @@
1
1
  import { type BuildOptions } from "../../../types/BuildOptions";
2
2
  import { type Template } from "../../../types/Template";
3
3
  import Builder from "../../utils/Builder";
4
+ import buildStyles from "../client/buildStyles";
4
5
  import { type BuildServerStatus } from "./BuildServerStatus";
5
6
  import buildServerNode from "./buildServerNode";
6
7
 
@@ -100,13 +101,21 @@ function buildServerTemplate(
100
101
  // Add the interface
101
102
  b.append("");
102
103
  b.append("/* User interface */");
103
- b.append(`let $output = "";`);
104
+ b.append(`let t_body = "";`);
105
+ if (current.style) {
106
+ // Replace multiple spaces with a single space
107
+ const styles = buildStyles(current.style, current.style.hash)
108
+ .replaceAll('"', '\\"')
109
+ .replaceAll(/\s+/g, " ");
110
+ b.append(`let t_head = "<style id='${current.style.hash}'>${styles}</style>";\n`);
111
+ } else {
112
+ b.append(`let t_head = "";`);
113
+ }
104
114
 
105
- // Add the interface
106
115
  buildServerNode(current.markup, status, b);
107
116
 
108
117
  if (status.output) {
109
- b.append(`$output += \`${status.output}\`;`);
118
+ b.append(`t_body += \`${status.output}\`;`);
110
119
  status.output = "";
111
120
  }
112
121
  }
@@ -114,7 +123,7 @@ function buildServerTemplate(
114
123
  marker = i + "/* @render */".length;
115
124
  } else if (script.substring(i, i + "/* @end */".length) === "/* @end */") {
116
125
  b.append(script.substring(marker, i));
117
- b.append("return $output;");
126
+ b.append(`return { body: t_body, head: t_head };`);
118
127
 
119
128
  currentIndex += 1;
120
129
  current = template.components[currentIndex];
@@ -24,7 +24,7 @@ export default function buildServerComponentNode(
24
24
  status.output += HYDRATION_START_COMMENT;
25
25
 
26
26
  if (status.output) {
27
- b.append(`$output += \`${status.output}\`;`);
27
+ b.append(`t_body += \`${status.output}\`;`);
28
28
  status.output = "";
29
29
  }
30
30
 
@@ -42,16 +42,23 @@ export default function buildServerComponentNode(
42
42
  name = name.substring(1, name.length - 1);
43
43
  const propName = name.split(".").at(-1);
44
44
  b.append(`${propsName}["${propName}"] = ${name};`);
45
- } else if (name === ":class" && value != null && isFullyReactive(value)) {
45
+ } else if ((name === "class" || name === ":class") && value != null) {
46
+ // NOTE: :class is obsolete, but let's keep it for a version or two
46
47
  status.imports.add("t_class");
47
- value = value.substring(1, value.length - 1);
48
+ if (isFullyReactive(value)) {
49
+ value = value.substring(1, value.length - 1);
50
+ }
51
+ const params = [value];
48
52
  if (node.scopeStyles) {
49
- value += `, "torp-${status.styleHash}"`;
53
+ params.push(`"torp-${status.styleHash}"`);
50
54
  }
51
- b.append(`${propsName}["class"] = t_class(${value});`);
52
- } else if (name === ":style" && value != null && isFullyReactive(value)) {
55
+ b.append(`${propsName}["class"] = t_class(${params.join(", ")});`);
56
+ } else if ((name === "style" || name === ":style") && value != null) {
57
+ // NOTE: :style is obsolete, but let's keep it for a version or two
53
58
  status.imports.add("t_style");
54
- value = value.substring(1, value.length - 1);
59
+ if (isFullyReactive(value)) {
60
+ value = value.substring(1, value.length - 1);
61
+ }
55
62
  b.append(`${propsName}["style"] = t_style(${value});`);
56
63
  } else if (value != null) {
57
64
  let fullyReactive = isFullyReactive(value);
@@ -61,11 +68,6 @@ export default function buildServerComponentNode(
61
68
  } else if (partlyReactive) {
62
69
  value = `\`${trimQuotes(value).replaceAll("{", "${")}\``;
63
70
  }
64
- if (name === "class") {
65
- // TODO: How to handle dynamic classes etc
66
- // Probably just compile down to a string?
67
- b.append(`"${trimQuotes(value)} torp-${status.styleHash}"`);
68
- }
69
71
  b.append(`${propsName}["${name}"] = ${value};`);
70
72
  } else {
71
73
  b.append(`${propsName}["${name}"] = true;`);
@@ -101,18 +103,18 @@ export default function buildServerComponentNode(
101
103
  "// @ts-ignore\n$context?: Record<PropertyKey, any>",
102
104
  ];
103
105
  b.append(`${slotsName}["${slotName}"] = (\n${slotParams.join(",\n")}\n) => {`);
104
- b.append(`let $output = "";`);
106
+ b.append(`let t_body = "";`);
105
107
 
106
108
  for (let child of slot.children) {
107
109
  buildServerNode(child, status, b);
108
110
  }
109
111
 
110
112
  if (status.output) {
111
- b.append(`$output += \`${status.output}\`;`);
113
+ b.append(`t_body += \`${status.output}\`;`);
112
114
  status.output = "";
113
115
  }
114
116
 
115
- b.append("return $output;");
117
+ b.append("return t_body;");
116
118
  b.append(`}`);
117
119
  }
118
120
  }
@@ -132,7 +134,10 @@ export default function buildServerComponentNode(
132
134
  renderParams += `, ${slotsName}`;
133
135
  }
134
136
  b.append("");
135
- b.append(`$output += ${componentName}(${renderParams})`);
137
+ const componentResult = nextVarName("comp", status);
138
+ b.append(`const ${componentResult} = ${componentName}(${renderParams});`);
139
+ b.append(`t_body += ${componentResult}.body;`);
140
+ b.append(`t_head += ${componentResult}.head;`);
136
141
 
137
142
  // End the control statement
138
143
  status.output += HYDRATION_END_COMMENT;
@@ -71,7 +71,7 @@ export default function buildServerControlNode(
71
71
  }
72
72
  case "@const": {
73
73
  if (status.output) {
74
- b.append(`$output += \`${status.output}\`;`);
74
+ b.append(`t_body += \`${status.output}\`;`);
75
75
  status.output = "";
76
76
  }
77
77
  buildServerScriptNode(node, b);
@@ -80,7 +80,7 @@ export default function buildServerControlNode(
80
80
  case "@function":
81
81
  case "@async function": {
82
82
  if (status.output) {
83
- b.append(`$output += \`${status.output}\`;`);
83
+ b.append(`t_body += \`${status.output}\`;`);
84
84
  status.output = "";
85
85
  }
86
86
  b.append("");
@@ -96,14 +96,17 @@ function buildElementAttributes(node: ElementNode, status: BuildServerStatus) {
96
96
  let valueOrDefault = `${value} || ${defaultValue}`;
97
97
  const propName = name.substring(1);
98
98
  attributes.push(`${propName}="\${${valueOrDefault}}"`);
99
- } else if (name === ":class") {
99
+ } else if (name === "class" || name === ":class") {
100
+ // NOTE: :class is obsolete, but let's keep it for a version or two
100
101
  status.imports.add("t_class");
102
+ let params = [value];
101
103
  if (node.scopeStyles) {
102
- value += `, "torp-${status.styleHash}"`;
104
+ params.push(`"torp-${status.styleHash}"`);
103
105
  needsClass = false;
104
106
  }
105
- attributes.push(`class="\${t_class(${value})}"`);
106
- } else if (name === ":style") {
107
+ attributes.push(`class="\${t_class(${params.join(", ")})}"`);
108
+ } else if (name === "style" || name === ":style") {
109
+ // NOTE: :style is obsolete, but let's keep it for a version or two
107
110
  status.imports.add("t_style");
108
111
  attributes.push(`style="\${t_style(${value})}"`);
109
112
  } else {
@@ -20,7 +20,7 @@ export default function buildServerForNode(
20
20
  status.output += HYDRATION_START_COMMENT;
21
21
 
22
22
  if (status.output) {
23
- b.append(`$output += \`${status.output}\`;`);
23
+ b.append(`t_body += \`${status.output}\`;`);
24
24
  status.output = "";
25
25
  }
26
26
 
@@ -49,7 +49,7 @@ function buildServerForBranch(node: ControlNode, status: BuildServerStatus, b: B
49
49
  }
50
50
 
51
51
  if (status.output) {
52
- b.append(`$output += \`${status.output}\`;`);
52
+ b.append(`t_body += \`${status.output}\`;`);
53
53
  status.output = "";
54
54
  }
55
55
 
@@ -20,7 +20,7 @@ export default function buildServerIfNode(
20
20
  status.output += HYDRATION_START_COMMENT;
21
21
 
22
22
  if (status.output) {
23
- b.append(`$output += \`${status.output}\`;`);
23
+ b.append(`t_body += \`${status.output}\`;`);
24
24
  status.output = "";
25
25
  }
26
26
 
@@ -49,7 +49,7 @@ function buildServerIfBranch(node: ControlNode, status: BuildServerStatus, b: Bu
49
49
  }
50
50
 
51
51
  if (status.output) {
52
- b.append(`$output += \`${status.output}\`;`);
52
+ b.append(`t_body += \`${status.output}\`;`);
53
53
  status.output = "";
54
54
  }
55
55
 
@@ -19,7 +19,7 @@ export default function buildServerReplaceNode(
19
19
  status.output += HYDRATION_START_COMMENT;
20
20
 
21
21
  if (status.output) {
22
- b.append(`$output += \`${status.output}\`;`);
22
+ b.append(`t_body += \`${status.output}\`;`);
23
23
  status.output = "";
24
24
  }
25
25
 
@@ -45,7 +45,7 @@ function buildServerReplaceBranch(node: ControlNode, status: BuildServerStatus,
45
45
  }
46
46
 
47
47
  if (status.output) {
48
- b.append(`$output += \`${status.output}\`;`);
48
+ b.append(`t_body += \`${status.output}\`;`);
49
49
  status.output = "";
50
50
  }
51
51
  }
@@ -23,7 +23,7 @@ export default function buildServerSlotNode(
23
23
  status.output += HYDRATION_START_COMMENT;
24
24
 
25
25
  if (status.output) {
26
- b.append(`$output += \`${status.output}\`;`);
26
+ b.append(`t_body += \`${status.output}\`;`);
27
27
  status.output = "";
28
28
  }
29
29
 
@@ -62,9 +62,13 @@ export default function buildServerSlotNode(
62
62
  }
63
63
 
64
64
  b.append(`if ($slots && $slots["${slotName}"]) {`);
65
- b.append(
66
- `$output += $slots["${slotName}"](${slotHasProps ? propsName : "undefined"}, $context);`,
67
- );
65
+ b.append(`t_body += $slots["${slotName}"](${slotHasProps ? propsName : "undefined"}, $context);`);
66
+ ////const slotResult = nextVarName("comp", status);
67
+ ////b.append(
68
+ //// `const ${slotResult} = $slots["${slotName}"](${slotHasProps ? propsName : "undefined"}, $context);`,
69
+ ////);
70
+ ////b.append(`t_body += ${slotResult}.body;`);
71
+ ////b.append(`t_head += ${slotResult}.head;`);
68
72
 
69
73
  // TODO: Not if there's only a single space node -- maybe check in parse
70
74
  const fill = node.children.find((c) => isSpecialNode(c) && c.tagName === ":fill");
@@ -76,7 +80,7 @@ export default function buildServerSlotNode(
76
80
  }
77
81
 
78
82
  if (status.output) {
79
- b.append(`$output += \`${status.output}\`;`);
83
+ b.append(`t_body += \`${status.output}\`;`);
80
84
  status.output = "";
81
85
  }
82
86
  }
@@ -20,7 +20,7 @@ export default function buildServerSwitchNode(
20
20
  status.output += HYDRATION_START_COMMENT;
21
21
 
22
22
  if (status.output) {
23
- b.append(`$output += \`${status.output}\`;`);
23
+ b.append(`t_body += \`${status.output}\`;`);
24
24
  status.output = "";
25
25
  }
26
26
 
@@ -51,7 +51,7 @@ function buildServerSwitchBranch(node: ControlNode, status: BuildServerStatus, b
51
51
  }
52
52
 
53
53
  if (status.output) {
54
- b.append(`$output += \`${status.output}\`;`);
54
+ b.append(`t_body += \`${status.output}\`;`);
55
55
  status.output = "";
56
56
  }
57
57
 
@@ -24,6 +24,7 @@ function scopeStylesOnNode(node: TemplateNode, selectors: string[]) {
24
24
  if (!scopeStyles) {
25
25
  for (let a of node.attributes) {
26
26
  if (a.name === "class" || a.name === ":class") {
27
+ // NOTE: :class is obsolete, but let's keep it for a version or two
27
28
  scopeStyles = true;
28
29
  } else if (a.name === "id" && a.value) {
29
30
  scopeStyles = selectors.includes(`#${trimQuotes(a.value)}`);
@@ -1,6 +1,6 @@
1
- export default function printNode(node: Node | null | undefined): string {
1
+ export default function printNode(node: Node | null | undefined, colored = true): string {
2
2
  if (!node) {
3
- return `\x1b[41m[null]\x1b[0m`;
3
+ return colored ? "\x1b[41m[null]\x1b[0m" : "[null]";
4
4
  }
5
5
 
6
6
  let parent = node;
@@ -12,25 +12,25 @@ export default function printNode(node: Node | null | undefined): string {
12
12
  }
13
13
 
14
14
  let status = { p: "" };
15
- printChildNode(parent!, node!, status);
15
+ printChildNode(parent!, node!, status, colored);
16
16
 
17
17
  return status.p;
18
18
  }
19
19
 
20
- function printChildNode(node: Node, target: Node, status: { p: string }) {
20
+ function printChildNode(node: Node, target: Node, status: { p: string }, colored: boolean) {
21
21
  if (node.nodeType === 1) {
22
22
  // Element
23
23
  let el = node as Element;
24
24
  let p = `<${el.tagName.toLowerCase()}>`;
25
25
  if (node === target) {
26
- p = `\x1b[44m${p}\x1b[0m`;
26
+ p = colored ? `\x1b[44m${p}\x1b[0m` : `~~{${p}}~~`;
27
27
  }
28
28
  status.p += p;
29
29
  } else if (node.nodeType === 3) {
30
30
  // Text
31
31
  let p = "…";
32
32
  if (node === target) {
33
- p = `\x1b[44m${p}\x1b[0m`;
33
+ p = colored ? `\x1b[44m${p}\x1b[0m` : `~~{${p}}~~`;
34
34
  }
35
35
  status.p += p;
36
36
  } else if (node.nodeType === 8) {
@@ -38,7 +38,7 @@ function printChildNode(node: Node, target: Node, status: { p: string }) {
38
38
  let com = node as Comment;
39
39
  let p = `<!${com.data}>`;
40
40
  if (node === target) {
41
- p = `\x1b[44m${p}\x1b[0m`;
41
+ p = colored ? `\x1b[44m${p}\x1b[0m` : `~~{${p}}~~`;
42
42
  }
43
43
  status.p += p;
44
44
  } else if (node.nodeType === 9) {
@@ -49,7 +49,7 @@ function printChildNode(node: Node, target: Node, status: { p: string }) {
49
49
  }
50
50
 
51
51
  for (let child of node.childNodes) {
52
- printChildNode(child, target, status);
52
+ printChildNode(child, target, status, colored);
53
53
  }
54
54
 
55
55
  if (node.nodeType === 1) {