@torpor/view 0.4.8 → 0.4.10

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 (240) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/compile.cjs +74 -76
  3. package/dist/compile.cjs.map +1 -1
  4. package/dist/compile.js +74 -76
  5. package/dist/compile.js.map +1 -1
  6. package/dist/index.cjs +7 -8
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +2 -2
  9. package/dist/index.d.cts.map +1 -1
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +7 -8
  13. package/dist/index.js.map +1 -1
  14. package/package.json +1 -1
  15. package/src/compile/build/client/buildAwaitNode.ts +32 -34
  16. package/src/compile/build/client/buildCode.ts +0 -9
  17. package/src/compile/build/client/buildHtmlNode.ts +11 -3
  18. package/src/compile/build/client/buildIfNode.ts +18 -26
  19. package/src/compile/build/client/buildReplaceNode.ts +10 -2
  20. package/src/compile/build/client/buildSwitchNode.ts +18 -26
  21. package/src/render/runControl.ts +2 -1
  22. package/src/render/runControlBranch.ts +6 -13
  23. package/src/watch/proxyGet.ts +4 -0
  24. package/src/watch/proxySet.ts +1 -1
  25. package/test/attributes/components/output/Attributes-client.ts +0 -2
  26. package/test/attributes/components/output/Disappearing-client.ts +0 -2
  27. package/test/attributes/components/temp/{Attributes-client-b9b98b8c868cc4f13484ae2237d59ef9491dfbf3.ts → Attributes-client-63bd49fe97fb8d775ef291fa19b8f03075020f63.ts} +0 -2
  28. package/test/attributes/components/temp/{Disappearing-client-b9b98b8c868cc4f13484ae2237d59ef9491dfbf3.ts → Disappearing-client-63bd49fe97fb8d775ef291fa19b8f03075020f63.ts} +0 -2
  29. package/test/await/components/output/Await-client.ts +49 -42
  30. package/test/await/components/temp/{Await-client-284921284e6ae52b607902682f7f9b69bffe1515.ts → Await-client-5ad15bc135417fa095bb5c95c7407a02a444a272.ts} +49 -42
  31. package/test/bind/components/output/BindComponent-client.ts +0 -4
  32. package/test/bind/components/output/BindText-client.ts +0 -2
  33. package/test/bind/components/temp/{BindComponent-client-acbb75b9dc9685722e49a937138b8f8d2e5f0539.ts → BindComponent-client-44f487e4c31612483ff002a7dea91925dd37b96b.ts} +0 -4
  34. package/test/bind/components/temp/{BindText-client-12ad90dae9678c8cdc7d8f2266ff6ed58824d57e.ts → BindText-client-74b797d8a10d8f18a71ef121dbb9eaec9c8dd67a.ts} +0 -2
  35. package/test/child-component/components/output/ChildComponent-client.ts +0 -4
  36. package/test/child-component/components/temp/{ChildComponent-client-63a83042fd341882e31e4fe9344294cbe83f00e5.ts → ChildComponent-client-3f29b8db2e610cbcb200af36721456404ed29dca.ts} +0 -4
  37. package/test/class/components/output/Class-client.ts +0 -4
  38. package/test/class/components/temp/{Class-client-919c8e138d3885b62ad3440c2d6925edae8e4892.ts → Class-client-0741f12141ba1e5d531ca6cc9becc0511ff0c502.ts} +0 -4
  39. package/test/component/components/output/Component-client.ts +0 -4
  40. package/test/component/components/temp/{Component-client-a433db324e16bc80b647022bba8717c7b5d285a6.ts → Component-client-8255e6a16f9dc01f64b88808bc92003396794fa5.ts} +0 -4
  41. package/test/console/components/output/Console-client.ts +0 -2
  42. package/test/console/components/temp/{Console-client-2d6a441342c992f6be9f4139a3354055f7aa6c41.ts → Console-client-bf26a9f6c8785ce09608d36fae616de0724a2355.ts} +0 -2
  43. package/test/const/components/output/Const-client.ts +0 -2
  44. package/test/const/components/temp/{Const-client-9d8262840860a5cb686c4923d0c8567ffc704b35.ts → Const-client-111aef0ff3a14c98eed9dba0a6205bd4509ccf29.ts} +0 -2
  45. package/test/context/components/output/Context-client.ts +0 -6
  46. package/test/context/components/temp/{Context-client-c1437b9cb8765f3d73b315982dd52e8458345da9.ts → Context-client-a4b608a96e3a3763ad9d660e1bc0836a105b9ea3.ts} +0 -6
  47. package/test/effects/components/output/ForEffect-client.ts +0 -2
  48. package/test/effects/components/output/IfEffect-client.ts +24 -27
  49. package/test/effects/components/output/NestedIfEffect-client.ts +46 -52
  50. package/test/effects/components/temp/{ForEffect-client-74072b430ca76fba1ebcad8bbc14754874f60969.ts → ForEffect-client-15144e8e55d99b6495affdb158cf95b301713f1a.ts} +0 -2
  51. package/test/effects/components/temp/{IfEffect-client-bdc34d65604493fc1475e2e98f7ae262a0ca5f34.ts → IfEffect-client-792e4b6c568e2cffad16c0b64ffd39928566c534.ts} +24 -27
  52. package/test/effects/components/temp/NestedIfEffect-client-724b09d88afd0eb4df459082ada91ac041825f7a.ts +89 -0
  53. package/test/events/components/output/Events-client.ts +0 -2
  54. package/test/events/components/temp/{Events-client-a02f139a6aed6e9105eeb23cee802f3d1b8550e5.ts → Events-client-3224d5bbbc6d4188c566cfa86659e546a886877a.ts} +0 -2
  55. package/test/for/components/output/For-client.ts +0 -2
  56. package/test/for/components/output/ForAfterFor-client.ts +0 -2
  57. package/test/for/components/output/ForContainingFor-client.ts +0 -2
  58. package/test/for/components/output/ForContainingFunction-client.ts +0 -2
  59. package/test/for/components/output/ForContainingIf-client.ts +18 -24
  60. package/test/for/components/output/ForEscape-client.ts +0 -2
  61. package/test/for/components/output/ForIn-client.ts +0 -2
  62. package/test/for/components/output/ForOf-client.ts +0 -2
  63. package/test/for/components/temp/{For-client-b999b399f32cac80c8ca1c9a718e35705a2dc10f.ts → For-client-287e5695f24f6700158d2c689fdce1916031b4d7.ts} +0 -2
  64. package/test/for/components/temp/{ForAfterFor-client-315138c704ee78185fbaf09a3f055e4c00a3a91d.ts → ForAfterFor-client-bc375829d736a62ee760f32a5a90df78426c8534.ts} +0 -2
  65. package/test/for/components/temp/{ForContainingFor-client-d9ed22634282fabc29ed8bdd5e4cb3ee699f5f56.ts → ForContainingFor-client-d80aba5977a7cef8263f0fdaf6216e19bb8b0625.ts} +0 -2
  66. package/test/for/components/temp/{ForContainingFunction-client-a1a63d73cf56ffc50e5f46cd2e2cc71bf0ebaa4c.ts → ForContainingFunction-client-bcb91a1c7ad2fd4e227fc40f28f01e7fdc495bdc.ts} +0 -2
  67. package/test/for/components/temp/{ForContainingIf-client-9fd42948e04eeb5114d22c4d986e27a101c7e73a.ts → ForContainingIf-client-8911d18357f7c81f97d64773442275c802292ae7.ts} +18 -24
  68. package/test/for/components/temp/{ForEscape-client-f6ee68cf9081cecccc78d793da192df403a573d4.ts → ForEscape-client-13038740272dd6b7fa9f228ae852e3d1b2725f88.ts} +0 -2
  69. package/test/for/components/temp/{ForIn-client-f82576cc3c950432fec8c196ba25596f191177ae.ts → ForIn-client-9f244dfd10d0439f14719e724aefc908174fe4e3.ts} +0 -2
  70. package/test/for/components/temp/{ForOf-client-1a89bfa049d931c7ec848d80196cd75bc67868a6.ts → ForOf-client-b0e33a686f4183a88aa06af7f2255e7210438fce.ts} +0 -2
  71. package/test/function/components/output/Function-client.ts +0 -2
  72. package/test/function/components/temp/{Function-client-a9072c015aa3f89966fbfc905109c2c6ecac3846.ts → Function-client-a2603b20a7f8763ba9713b04c42da56c2ee2056e.ts} +0 -2
  73. package/test/html/components/output/Html-client.ts +10 -8
  74. package/test/html/components/temp/{Html-client-206a7cd3478abde0e6902a8cb953dc20d6a2cd3f.ts → Html-client-da930140bd62a34408887d13aafebbe856065bef.ts} +10 -8
  75. package/test/html/html.test.ts +1 -0
  76. package/test/if/components/output/ElseIfTrue-client.ts +34 -35
  77. package/test/if/components/output/ElseTrue-client.ts +34 -35
  78. package/test/if/components/output/IfAfterIf-client.ts +30 -38
  79. package/test/if/components/output/IfCache-client.ts +29 -32
  80. package/test/if/components/output/IfContainingFor-client.ts +53 -59
  81. package/test/if/components/output/IfContainingFunction-client.ts +21 -26
  82. package/test/if/components/output/IfContainingIf-client.ts +46 -52
  83. package/test/if/components/output/IfElseFalse-client.ts +24 -27
  84. package/test/if/components/output/IfElseTrue-client.ts +24 -27
  85. package/test/if/components/output/IfFalse-client.ts +16 -21
  86. package/test/if/components/output/IfNested-client.ts +54 -58
  87. package/test/if/components/temp/ElseIfTrue-client-b9fc7dd83aae7205745ae376e2081befa33e320c.ts +77 -0
  88. package/test/if/components/temp/ElseTrue-client-b9fc7dd83aae7205745ae376e2081befa33e320c.ts +77 -0
  89. package/test/if/components/temp/{IfAfterIf-client-b042b5047978b9054a6a89e45f4d157249885821.ts → IfAfterIf-client-e463e4db80127acc2ed0c4da349ecaa4c5b0ce1a.ts} +30 -38
  90. package/test/if/components/temp/{IfCache-client-3d0bc2841d050f6d86bbccddfdcaf0b0b781ab87.ts → IfCache-client-e892165cad33a1052bb248fe10e1b3aa9dffbf01.ts} +29 -32
  91. package/test/if/components/temp/IfContainingFor-client-0835d2155fd73b40d06b77d9f5af380a1d209e4e.ts +105 -0
  92. package/test/if/components/temp/{IfContainingFunction-client-b3a3e7e2b2b44618fa722403d51717532fc237e4.ts → IfContainingFunction-client-2c1a9e5da9fb9a85cae8123f30c23ccc851c9803.ts} +21 -26
  93. package/test/if/components/temp/IfContainingIf-client-517b94a34195618e4e58cabdfdb402288379b075.ts +89 -0
  94. package/test/{effects/components/temp/NestedIfEffect-client-944bd749d83ebce0f6ae66c6751f38ecd430df05.ts → if/components/temp/IfContainingIfAfterIf-client-f435f9bc464edfaf580ef7c1726a4be5ba8c6f6f.ts} +29 -8
  95. package/test/if/components/temp/IfContainingIfAfterIf-server-2cfd604fd3a7187217437bd97dc89a4c6aeb8726.ts +29 -0
  96. package/test/if/components/temp/IfContainingIfAfterIf-types-805203b39332252a17996786ac79ece914bbea34.ts +10 -0
  97. package/test/if/components/temp/{IfElseTrue-client-9bccfbdf5da704d3756ff48e2cf6987e6125dc1f.ts → IfElseFalse-client-6003c6c731c1bad239bdcea789d136bc8cd6090a.ts} +24 -27
  98. package/test/if/components/temp/{IfElseFalse-client-9bccfbdf5da704d3756ff48e2cf6987e6125dc1f.ts → IfElseTrue-client-6003c6c731c1bad239bdcea789d136bc8cd6090a.ts} +24 -27
  99. package/test/if/components/temp/{IfFalse-client-9ad6f6e3f7abb5d9927d4823315886542c6ec611.ts → IfFalse-client-8ef85fba04e1e6c3f2b95d9d957bffea5ba593ae.ts} +16 -21
  100. package/test/if/components/temp/IfNested-client-5be29838cfd71602d781e744ebd1eb9968eb825c.ts +97 -0
  101. package/test/mount/components/output/Mount-client.ts +0 -2
  102. package/test/mount/components/temp/{Mount-client-ce5a39e2bd6942a589b1a91d392ee841d55bccf2.ts → Mount-client-00351e81e77561213a14c8eea534acae3c5eb692.ts} +0 -2
  103. package/test/on-mount/components/output/OnMount-client.ts +0 -2
  104. package/test/on-mount/components/temp/{OnMount-client-218e35c32f4c3d30a193775e4aecd50d5663da0d.ts → OnMount-client-0a63fc37b0f617ee0b4de2619590a2562a3e2f92.ts} +0 -2
  105. package/test/party/components/output/ComputedState-client.ts +0 -2
  106. package/test/party/components/output/Conditional-client.ts +36 -35
  107. package/test/party/components/output/Context-client.ts +0 -4
  108. package/test/party/components/output/DeclareState-client.ts +0 -2
  109. package/test/party/components/output/DomRef-client.ts +0 -2
  110. package/test/party/components/output/EmitToParent-client.ts +0 -4
  111. package/test/party/components/output/EventClick-client.ts +0 -2
  112. package/test/party/components/output/InputCheckbox-client.ts +0 -2
  113. package/test/party/components/output/InputRadio-client.ts +0 -2
  114. package/test/party/components/output/InputSelect-client.ts +0 -2
  115. package/test/party/components/output/InputText-client.ts +0 -2
  116. package/test/party/components/output/Loop-client.ts +0 -2
  117. package/test/party/components/output/MinimalTemplate-client.ts +0 -2
  118. package/test/party/components/output/OnMount-client.ts +0 -2
  119. package/test/party/components/output/Props-client.ts +0 -4
  120. package/test/party/components/output/Slot-client.ts +0 -4
  121. package/test/party/components/output/SlotFallback-client.ts +0 -4
  122. package/test/party/components/output/Styling-client.ts +0 -2
  123. package/test/party/components/output/UpdateState-client.ts +0 -2
  124. package/test/party/components/temp/{ComputedState-client-fcd3c890f4dc9058c4ee29e7cdbfda23a8d4695f.ts → ComputedState-client-512a35be46f600ab9b9cf9da0e3c0c90b377d7fa.ts} +0 -2
  125. package/test/party/components/temp/{Conditional-client-39c1844a9395f8620541f6599ee4547906c35d69.ts → Conditional-client-2c5f759b41ce567a51589af001bf0fc6feb47b4b.ts} +36 -35
  126. package/test/party/components/temp/{Context-client-696777e5ce1ad7ef2f5bc8e4c2c1a81fb3a98ece.ts → Context-client-88246cfda3671dd5ac8919d95c2f65a8dce81f18.ts} +0 -4
  127. package/test/party/components/temp/{DeclareState-client-cbade5ab902b3d7d5bf8054f9cc7e149334e3560.ts → DeclareState-client-cc45b93b34f4c34c965c765e0f53f78ea416b1ca.ts} +0 -2
  128. package/test/party/components/temp/{DomRef-client-6e643c9cfee7fed10c6cead9fcad055646712aa6.ts → DomRef-client-4c28338d9ea7a2c3d273970161181d82076ed19e.ts} +0 -2
  129. package/test/party/components/temp/{EmitToParent-client-89b1744b0bc1e50dc2091c6e63dfe9b62a0b8d46.ts → EmitToParent-client-fcf3d690b10871aad884099e078d5c98d7b8503d.ts} +0 -4
  130. package/test/party/components/temp/{EventClick-client-2c7393fcd73e6d10d17f5f19aacafeb91ab219f6.ts → EventClick-client-dcb9b191808f7f0f9d009b725da046ba241cb44b.ts} +0 -2
  131. package/test/party/components/temp/{InputCheckbox-client-377a0a0505e307b19dcca95cb9b1cf9c8a38835b.ts → InputCheckbox-client-f0af6d8f86c4f80673dea1599a6f2deaf54fe576.ts} +0 -2
  132. package/test/party/components/temp/{InputRadio-client-38c3f46fabdb94ca79c71888ce3335687461fcbd.ts → InputRadio-client-1472838ddbfe003a85779e1ccb7b57cb66333e90.ts} +0 -2
  133. package/test/party/components/temp/{InputSelect-client-bac5f12f5560e702794587702c883c273c92394f.ts → InputSelect-client-9881943682735888d6b62612d93577ba51593678.ts} +0 -2
  134. package/test/party/components/temp/{InputText-client-2a189403e60e6f932829370233ddede2be782334.ts → InputText-client-7b37e856f97c863e120a4aa6c02757e489ad6591.ts} +0 -2
  135. package/test/party/components/temp/{Loop-client-c99929d3487880b8526d0ed3602c96dd36da1a8c.ts → Loop-client-5e5694bc158fcd5f06cd1037e920c657032d7b90.ts} +0 -2
  136. package/test/party/components/temp/{MinimalTemplate-client-72e8afffe412117e38f8045196704fa3ac384213.ts → MinimalTemplate-client-079892cc885b1f25863c13b93c83e0554a22a2c3.ts} +0 -2
  137. package/test/party/components/temp/{OnMount-client-f16abd053b4b1ba31fc806e8c3a39163a46cb6a2.ts → OnMount-client-1900436fa5a6d56cb98df953de89e0f662d821e8.ts} +0 -2
  138. package/test/party/components/temp/{Props-client-863b630f7f77c4609f6171886bf812b9452cfceb.ts → Props-client-b94724d04965006c1c89776bac2fa10694280c44.ts} +0 -4
  139. package/test/party/components/temp/{Slot-client-4406668a963796d1117ec818118e504e55b18e4c.ts → Slot-client-5793cdf8a5f28b5009ae17435cfd146ed6c8a1f8.ts} +0 -4
  140. package/test/party/components/temp/{SlotFallback-client-4406668a963796d1117ec818118e504e55b18e4c.ts → SlotFallback-client-5793cdf8a5f28b5009ae17435cfd146ed6c8a1f8.ts} +0 -4
  141. package/test/party/components/temp/{Styling-client-59c057fc5b6c226d667351ea7f748abbe86f1c96.ts → Styling-client-a1c7082740471fead2feb331c9ba0864ff0c5566.ts} +0 -2
  142. package/test/party/components/temp/{UpdateState-client-3b087abf0cb4b1e784623f3de6dabbcb63703e07.ts → UpdateState-client-c6c785a6d35693ba1b9c36dbd59bf28163718c00.ts} +0 -2
  143. package/test/props/components/output/Reactive-client.ts +0 -4
  144. package/test/props/components/temp/{Reactive-client-a911a7026a02bf32c185e29a87f5b8611685e370.ts → Reactive-client-26a5294eda35e924911bcc99acda58cc98baee7c.ts} +0 -4
  145. package/test/replace/components/output/Replace-client.ts +14 -12
  146. package/test/replace/components/temp/{Replace-client-d5e681fe8c662c832916d61ae22d51e65dfeba53.ts → Replace-client-872de024cd2c5c6c95a3eb4e29642e8e48e69a27.ts} +14 -12
  147. package/test/slots/components/output/BasicSlot-client.ts +0 -4
  148. package/test/slots/components/output/LetSlot-client.ts +0 -4
  149. package/test/slots/components/output/NamedSlot-client.ts +0 -4
  150. package/test/slots/components/output/UnusedSlot-client.ts +0 -4
  151. package/test/slots/components/temp/{BasicSlot-client-c1e9885dc85d13e4b44d54e0ad800c0d46e35914.ts → BasicSlot-client-39a9a3170fd51582b023b805d597eb729bb6b02b.ts} +0 -4
  152. package/test/slots/components/temp/{LetSlot-client-3b1779874d3c9b1289fb62f124af5ebaf78279a8.ts → LetSlot-client-63980e54259324855b573e87efb1d7a1ac9abd9c.ts} +0 -4
  153. package/test/slots/components/temp/{NamedSlot-client-8faa564d1002c199f102aa148657d82628d1ebd7.ts → NamedSlot-client-426018f63a360e6d4208400b25bfadd2727eadcf.ts} +0 -4
  154. package/test/slots/components/temp/{UnusedSlot-client-2e23b278b99db53bc0fde9c98836d8e26481a40e.ts → UnusedSlot-client-5819c279d1f8c2d808651505171a5b20a41998ef.ts} +0 -4
  155. package/test/special-component/components/output/SpecialComponent-client.ts +29 -31
  156. package/test/special-component/components/temp/{SpecialComponent-client-d81a30dda5d8d509e8661caa70bbc89265bc65c1.ts → SpecialComponent-client-752f0be79a322e8f75bfdd5adfec996d4ab35281.ts} +29 -31
  157. package/test/special-element/components/output/SpecialElement-client.ts +0 -2
  158. package/test/special-element/components/temp/{SpecialElement-client-2887938dfcd02e042d8fe5501845d043b098616a.ts → SpecialElement-client-f6239c04736a49add9278edfaea7804dd186e665.ts} +0 -2
  159. package/test/special-head/components/output/SpecialHead-client.ts +0 -2
  160. package/test/special-head/components/temp/{SpecialHead-client-3b8455aa874ae0113a7f718cb64b310d84430ce6.ts → SpecialHead-client-cda50f56454f7c7f0147352e53d50c4060ed2e3b.ts} +0 -2
  161. package/test/special-self/components/output/SpecialSelf-client.ts +25 -28
  162. package/test/special-self/components/temp/{SpecialSelf-client-cb6aba06aa4bec73485ef48bc05557a5c935f54c.ts → SpecialSelf-client-09e93618a2318d3873b201557e2f32d5bf5e4100.ts} +25 -28
  163. package/test/style/components/output/Style-client.ts +0 -2
  164. package/test/style/components/temp/{Style-client-8896b4c0fe78e346904fbcf24d629bbe20a56860.ts → Style-client-8ca877392f5610bc527c5577d948f5782c40bf96.ts} +0 -2
  165. package/test/svg/components/output/Svg-client.ts +24 -26
  166. package/test/svg/components/temp/{Svg-client-0397419af735b847de6c56bd6ad2bb4eb6dc1ba2.ts → Svg-client-6a213daf6df5c361de9e1c9aa7cc581bcb6356be.ts} +24 -26
  167. package/test/switch/components/output/Switch-client.ts +34 -35
  168. package/test/{if/components/temp/ElseTrue-client-6eb8f5e058f266603104442f46cd96206bbceee8.ts → switch/components/temp/Switch-client-4cab689c9914c62d461e6aaf6beb68d15275c68f.ts} +46 -34
  169. package/test/text/components/output/Text-client.ts +0 -2
  170. package/test/text/components/temp/{Text-client-3b2555c36eef59b2d79b1d5a6d3edf4ff28a6816.ts → Text-client-4288bc38b436a5b486c1fd5a4805bd206dbff27c.ts} +0 -2
  171. package/test/watch-array/components/output/ArrayAllFunctions-client.ts +0 -2
  172. package/test/watch-array/components/output/ArrayAllFunctionsUnkeyed-client.ts +0 -2
  173. package/test/watch-array/components/output/ArrayEmpty-client.ts +0 -2
  174. package/test/watch-array/components/output/ArrayEntries-client.ts +0 -2
  175. package/test/watch-array/components/output/ArrayIndexes-client.ts +0 -2
  176. package/test/watch-array/components/output/ArrayPop-client.ts +0 -2
  177. package/test/watch-array/components/output/ArrayPush-client.ts +0 -2
  178. package/test/watch-array/components/output/ArrayReassign-client.ts +0 -2
  179. package/test/watch-array/components/output/ArrayReverse-client.ts +0 -2
  180. package/test/watch-array/components/output/ArraySetObject-client.ts +0 -2
  181. package/test/watch-array/components/output/ArraySetProperty-client.ts +0 -2
  182. package/test/watch-array/components/output/ArrayShift-client.ts +0 -2
  183. package/test/watch-array/components/output/ArraySort-client.ts +0 -2
  184. package/test/watch-array/components/output/ArraySpliceAdd-client.ts +0 -2
  185. package/test/watch-array/components/output/ArraySpliceDelete-client.ts +0 -2
  186. package/test/watch-array/components/output/ArraySpliceDeleteAll-client.ts +0 -2
  187. package/test/watch-array/components/output/ArraySpliceDeleteAndAdd-client.ts +0 -2
  188. package/test/watch-array/components/output/ArraySpliceDeleteEnd-client.ts +0 -2
  189. package/test/watch-array/components/output/ArraySwap-client.ts +0 -2
  190. package/test/watch-array/components/output/ArrayUnshift-client.ts +0 -2
  191. package/test/watch-array/components/output/ArrayUpdateAssignment-client.ts +0 -2
  192. package/test/watch-array/components/temp/{ArrayPush-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayAllFunctions-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
  193. package/test/watch-array/components/temp/{ArrayAllFunctionsUnkeyed-client-0aede144ecd4a1de98d0ac6265fc4275e9803f9e.ts → ArrayAllFunctionsUnkeyed-client-513455af417adc9807393dbb58da507c66dde885.ts} +0 -2
  194. package/test/watch-array/components/temp/{ArrayAllFunctions-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayEmpty-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
  195. package/test/watch-array/components/temp/{ArrayEntries-client-40c8fbd950418f90335fee16250a42778d8bfbaf.ts → ArrayEntries-client-cf9fe0738861c78fbd576d7f74b38c713363ee31.ts} +0 -2
  196. package/test/watch-array/components/temp/{ArrayIndexes-client-89d3c7c1e89ca1c402183e84c3a2a8ed02bde10b.ts → ArrayIndexes-client-2c12fa2b6d0992423b57ddb6f363b9c4c5bf525a.ts} +0 -2
  197. package/test/watch-array/components/temp/{ArrayEmpty-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayPop-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
  198. package/test/watch-array/components/temp/{ArrayPop-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayPush-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
  199. package/test/watch-array/components/temp/ArrayReassign-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  200. package/test/watch-array/components/temp/ArrayReverse-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  201. package/test/watch-array/components/temp/ArraySetObject-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  202. package/test/watch-array/components/temp/ArraySetProperty-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  203. package/test/watch-array/components/temp/ArrayShift-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  204. package/test/watch-array/components/temp/ArraySort-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  205. package/test/watch-array/components/temp/ArraySpliceAdd-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  206. package/test/watch-array/components/temp/ArraySpliceDelete-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  207. package/test/watch-array/components/temp/ArraySpliceDeleteAll-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  208. package/test/watch-array/components/temp/ArraySpliceDeleteAndAdd-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  209. package/test/watch-array/components/temp/ArraySpliceDeleteEnd-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  210. package/test/watch-array/components/temp/ArraySwap-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  211. package/test/watch-array/components/temp/ArrayUnshift-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  212. package/test/watch-array/components/temp/ArrayUpdateAssignment-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  213. package/test/watch-object/components/output/WatchObject-client.ts +0 -2
  214. package/test/watch-object/components/output/WatchUndefinedPropertyChange-client.ts +34 -0
  215. package/test/watch-object/components/output/WatchUndefinedPropertyChange-server.ts +18 -0
  216. package/test/watch-object/components/output/WatchUndefinedPropertyChange-types.ts +10 -0
  217. package/test/watch-object/components/temp/{WatchObject-client-6e179fea629d983307056536ab5a3cf9141335fa.ts → WatchObject-client-8f906f7d7613370e70c55a122774e122cdd55bff.ts} +0 -2
  218. package/test/watch-object/components/temp/WatchUndefinedPropertyChange-client-bce2c42e17dedce203b71228966e20056b82baba.ts +34 -0
  219. package/test/watch-object/components/temp/WatchUndefinedPropertyChange-server-7af97c0938c3c851f60e86ef27188e0bcd432354.ts +18 -0
  220. package/test/watch-object/components/temp/WatchUndefinedPropertyChange-types-05e791b7c4023f8ae6e8dd548fe3f16ea8c16d10.ts +10 -0
  221. package/test/watch-object/watch-undefined-property-change.test.ts +51 -0
  222. package/test/if/components/temp/ElseIfTrue-client-6eb8f5e058f266603104442f46cd96206bbceee8.ts +0 -78
  223. package/test/if/components/temp/IfContainingFor-client-0b27933986c4593fdad3c81ac22e32d7ee6bd40f.ts +0 -111
  224. package/test/if/components/temp/IfContainingIf-client-3cf3407e41d0bd4d2927f97cbc5f9df661537702.ts +0 -95
  225. package/test/if/components/temp/IfNested-client-50abd76ec9369ac6cf42f0264870914923f30b5c.ts +0 -101
  226. package/test/switch/components/temp/Switch-client-8de47f56a21297420acf8bc27fc03149f258028b.ts +0 -91
  227. package/test/watch-array/components/temp/ArrayReassign-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  228. package/test/watch-array/components/temp/ArrayReverse-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  229. package/test/watch-array/components/temp/ArraySetObject-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  230. package/test/watch-array/components/temp/ArraySetProperty-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  231. package/test/watch-array/components/temp/ArrayShift-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  232. package/test/watch-array/components/temp/ArraySort-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  233. package/test/watch-array/components/temp/ArraySpliceAdd-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  234. package/test/watch-array/components/temp/ArraySpliceDelete-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  235. package/test/watch-array/components/temp/ArraySpliceDeleteAll-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  236. package/test/watch-array/components/temp/ArraySpliceDeleteAndAdd-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  237. package/test/watch-array/components/temp/ArraySpliceDeleteEnd-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  238. package/test/watch-array/components/temp/ArraySwap-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  239. package/test/watch-array/components/temp/ArrayUnshift-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  240. package/test/watch-array/components/temp/ArrayUpdateAssignment-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
@@ -16,9 +16,8 @@ export default function buildAwaitNode(node: ControlNode, status: BuildStatus, b
16
16
  const anchorName = node.varName ?? "null";
17
17
  const parentName = node.parentName!;
18
18
  const regionName = nextVarName("await_region", status);
19
- const stateName = "$" + nextVarName("await_state", status);
20
- const creatorsName = nextVarName("await_creators", status);
21
- const awaitVarsName = nextVarName("await_vars", status);
19
+ const indexName = nextVarName("await_index", status);
20
+ const tokenName = nextVarName("await_token", status);
22
21
 
23
22
  // Filter non-control branches (spaces)
24
23
  const branches = node.children.filter((n) => isControlNode(n)) as ControlNode[];
@@ -55,29 +54,31 @@ export default function buildAwaitNode(node: ControlNode, status: BuildStatus, b
55
54
 
56
55
  // Use an incrementing token to make sure only the last request gets handled
57
56
  // TODO: This might have unforeseen consequences
58
- status.imports.add("$watch");
59
- status.imports.add("$run");
57
+
60
58
  status.imports.add("t_region");
61
59
  status.imports.add("t_run_control");
62
60
  status.imports.add("t_run_branch");
61
+ status.imports.add("t_push_region");
62
+ status.imports.add("t_pop_region");
63
63
 
64
64
  b.append("");
65
65
  b.append("/* @await */");
66
+
66
67
  addPushDevBoundary("control", `@${branches[0].statement}`, status, b);
68
+
67
69
  b.append(`
68
70
  const ${regionName} = t_region(${status.options.dev === true ? `"await"` : ""});
69
- let ${stateName} = $watch({ index: -1 });
70
- let ${creatorsName}: ((t_before: Node | null) => void)[] = [];
71
- let ${awaitVarsName} = { t_token: 0 };
72
- $run(() => {`);
71
+ let ${tokenName} = 0;
72
+ let ${indexName} = -1;
73
+ t_run_control(${regionName}, ${anchorName}, (t_before) => {`);
73
74
 
74
75
  let index = 0;
75
76
 
76
77
  // Build the waiting branch before anything happens
77
- buildAwaitBranch(awaitBranch, status, b, parentName, stateName, creatorsName, index++);
78
+ buildAwaitBranch(awaitBranch, status, b, parentName, regionName, indexName, index++);
78
79
 
79
80
  b.append(`
80
- ${awaitVarsName}.t_token++;
81
+ ${tokenName}++;
81
82
  ((t_token) => {`);
82
83
 
83
84
  // TODO: replaceForVarNames is going to throw mapping out
@@ -95,8 +96,8 @@ export default function buildAwaitNode(node: ControlNode, status: BuildStatus, b
95
96
  b,
96
97
  );
97
98
 
98
- b.append(`if (t_token === ${awaitVarsName}.t_token) {`);
99
- buildAwaitBranch(thenBranch, status, b, parentName, stateName, creatorsName, index++);
99
+ b.append(`if (t_token === ${tokenName}) {`);
100
+ buildAwaitBranch(thenBranch, status, b, parentName, regionName, indexName, index++);
100
101
  b.append(`}
101
102
  })`);
102
103
 
@@ -111,23 +112,13 @@ export default function buildAwaitNode(node: ControlNode, status: BuildStatus, b
111
112
  b,
112
113
  );
113
114
 
114
- b.append(`if (t_token === ${awaitVarsName}.t_token) {`);
115
- buildAwaitBranch(catchBranch, status, b, parentName, stateName, creatorsName, index++);
115
+ b.append(`if (t_token === ${tokenName}) {`);
116
+ buildAwaitBranch(catchBranch, status, b, parentName, regionName, indexName, index++);
116
117
  b.append(`}
117
118
  });
118
- })(${awaitVarsName}.t_token);
119
+ })(${tokenName});
119
120
  }${status.options.dev === true ? `, "runAwait"` : ""});`);
120
121
 
121
- b.append(`
122
- t_run_control(${regionName}, ${anchorName}, (t_before) => {
123
- const index = ${stateName}.index;`);
124
- //addPushDevBoundary("branch", "`branch ${index}`", status, b);
125
- b.append(
126
- `t_run_branch(${regionName}, () => ${creatorsName}[index](t_before)${status.options.dev === true ? ", `branch ${index}`" : ""});`,
127
- );
128
- addPopDevBoundary(status, b);
129
- b.append("});");
130
-
131
122
  addPopDevBoundary(status, b);
132
123
 
133
124
  b.append("");
@@ -138,13 +129,21 @@ function buildAwaitBranch(
138
129
  status: BuildStatus,
139
130
  b: Builder,
140
131
  parentName: string,
141
- stateName: string,
142
- creatorsName: string,
132
+ regionName: string,
133
+ indexName: string,
143
134
  index: number,
144
135
  ) {
136
+ b.append(`if (!t_run_branch(${regionName}, ${indexName}, ${index})) return;`);
137
+
145
138
  if (node.children.length > 0) {
146
- let beforeParam = node.fragment !== undefined ? "t_before" : "_";
147
- b.append(`${creatorsName}[${index}] = (${beforeParam}) => {`);
139
+ // NOTE: for await branches, we need to push the control region again,
140
+ // because it will have been popped by the time the `then` or `catch`
141
+ // branches are hit
142
+ b.append(`
143
+ const t_new_region = t_region(${status.options.dev === true ? `"await_branch"` : ""});
144
+ const t_old_control_region = t_push_region(${regionName});
145
+ const t_old_region = t_push_region(t_new_region, true);
146
+ `);
148
147
 
149
148
  buildFragment(node, status, b, parentName, "t_before");
150
149
 
@@ -159,10 +158,9 @@ function buildAwaitBranch(
159
158
 
160
159
  buildAddFragment(node, status, b, parentName, "t_before");
161
160
 
162
- b.append("};");
163
- } else {
164
- b.append(`${creatorsName}[${index}] = (_) => {};`);
161
+ b.append("t_pop_region(t_old_region);");
162
+ b.append("t_pop_region(t_old_control_region);");
165
163
  }
166
164
 
167
- b.append(`${stateName}.index = ${index};`);
165
+ b.append(`${indexName} = ${index};`);
168
166
  }
@@ -148,14 +148,6 @@ function buildTemplate(
148
148
  if (current.contextProps?.length) {
149
149
  b.append(`$context = Object.assign({}, $context);`);
150
150
  }
151
-
152
- // NOTE: We're isolating the user script by setting `context.activeTarget =
153
- // null` and then setting it back at the end, but maybe it would be better to
154
- // make it so that signals only affect effects that they are under e.g. so
155
- // that creating a $state in a component doesn't affect any $runs outside
156
- // the component?
157
- b.append("$peek(() => { /**/");
158
- b.append("");
159
151
  } else if (chunk.script === "/* @render */") {
160
152
  if (current.markup) {
161
153
  // Add the interface
@@ -178,7 +170,6 @@ function buildTemplate(
178
170
  // No styles in the client
179
171
  } else if (chunk.script === "/* @end */") {
180
172
  addPopDevBoundary(status, b);
181
- b.append("/**/ });");
182
173
  currentIndex += 1;
183
174
  current = template.components[currentIndex];
184
175
  } else {
@@ -18,6 +18,9 @@ export default function buildHtmlNode(node: ControlNode, status: BuildStatus, b:
18
18
 
19
19
  status.imports.add("t_region");
20
20
  status.imports.add("t_run_control");
21
+ status.imports.add("t_run_branch");
22
+ status.imports.add("t_push_region");
23
+ status.imports.add("t_pop_region");
21
24
 
22
25
  b.append("");
23
26
  b.append(`
@@ -40,8 +43,13 @@ function buildHtmlBranch(
40
43
  ) {
41
44
  status.imports.add("t_run_branch");
42
45
 
43
- b.append(`${node.statement};`);
44
- b.append(`t_run_branch(${regionName}, () => {`);
46
+ b.append(`${replaceForVarNames(node.statement, status)};`);
47
+ b.append(`if (!t_run_branch(${regionName}, 0, -1)) return;`);
48
+
49
+ b.append(`
50
+ const t_new_region = t_region(${status.options.dev === true ? `"html_branch"` : ""});
51
+ const t_old_region = t_push_region(t_new_region, true);
52
+ `);
45
53
 
46
54
  const templateName = nextVarName("template", status);
47
55
  const fragmentName = `t_fragment_${node.fragment!.number}`;
@@ -61,5 +69,5 @@ function buildHtmlBranch(
61
69
 
62
70
  buildAddFragment(node, status, b, parentName, "t_before");
63
71
 
64
- b.append(`}${status.options.dev === true ? ', "html"' : ""});`);
72
+ b.append("t_pop_region(t_old_region);");
65
73
  }
@@ -17,8 +17,7 @@ export default function buildIfNode(node: ControlNode, status: BuildStatus, b: B
17
17
  const anchorName = node.varName ?? "null";
18
18
  const parentName = node.parentName || anchorName + ".parentNode";
19
19
  const regionName = nextVarName("if_region", status);
20
- const stateName = "$" + nextVarName("if_state", status);
21
- const creatorsName = nextVarName("if_creators", status);
20
+ const indexName = nextVarName("if_index", status);
22
21
 
23
22
  // Filter non-control branches (spaces)
24
23
  const branches = node.children.filter((n) => isControlNode(n)) as ControlNode[];
@@ -35,36 +34,28 @@ export default function buildIfNode(node: ControlNode, status: BuildStatus, b: B
35
34
  branches.push(elseBranch);
36
35
  }
37
36
 
38
- status.imports.add("$watch");
39
- status.imports.add("$run");
40
37
  status.imports.add("t_region");
41
38
  status.imports.add("t_run_control");
42
39
  status.imports.add("t_run_branch");
40
+ status.imports.add("t_push_region");
41
+ status.imports.add("t_pop_region");
43
42
 
44
43
  b.append("");
45
44
  b.append("/* @if */");
45
+
46
46
  addPushDevBoundary("control", `@${branches[0].statement}`, status, b);
47
+
47
48
  b.append(`
48
49
  const ${regionName} = t_region(${status.options.dev === true ? `"if"` : ""});
49
- let ${stateName} = $watch({ index: -1 });
50
- let ${creatorsName}: ((t_before: Node | null) => void)[] = [];
51
- $run(() => {`);
50
+ let ${indexName} = -1;
51
+ t_run_control(${regionName}, ${anchorName}, (t_before) => {`);
52
52
 
53
53
  let index = 0;
54
54
  for (let branch of branches) {
55
- buildIfBranch(branch, status, b, parentName, stateName, creatorsName, index++);
55
+ buildIfBranch(branch, status, b, parentName, regionName, indexName, index++);
56
56
  }
57
- b.append(`}${status.options.dev === true ? `, "runIf"` : ""});`);
58
57
 
59
- b.append(`
60
- t_run_control(${regionName}, ${anchorName}, (t_before) => {
61
- const index = ${stateName}.index;`);
62
- //addPushDevBoundary("branch", "`branch ${index}`", status, b);
63
- b.append(
64
- `t_run_branch(${regionName}, () => ${creatorsName}[index](t_before)${status.options.dev === true ? ", `branch ${index}`" : ""});`,
65
- );
66
- addPopDevBoundary(status, b);
67
- b.append("});");
58
+ b.append(`}${status.options.dev === true ? `, "runIf"` : ""});`);
68
59
 
69
60
  addPopDevBoundary(status, b);
70
61
 
@@ -76,16 +67,19 @@ function buildIfBranch(
76
67
  status: BuildStatus,
77
68
  b: Builder,
78
69
  parentName: string,
79
- stateName: string,
80
- creatorsName: string,
70
+ regionName: string,
71
+ indexName: string,
81
72
  index: number,
82
73
  ) {
83
74
  // TODO: replaceForVarNames is going to throw mapping out
84
75
  addMappedText("", `${replaceForVarNames(node.statement, status)}`, " {", node.span, status, b);
76
+ b.append(`if (!t_run_branch(${regionName}, ${indexName}, ${index})) return;`);
85
77
 
86
78
  if (node.children.length > 0) {
87
- let beforeParam = node.fragment !== undefined ? "t_before" : "_";
88
- b.append(`${creatorsName}[${index}] = (${beforeParam}) => {`);
79
+ b.append(`
80
+ const t_new_region = t_region(${status.options.dev === true ? `"if_branch"` : ""});
81
+ const t_old_region = t_push_region(t_new_region, true);
82
+ `);
89
83
 
90
84
  buildFragment(node, status, b, parentName, "t_before");
91
85
 
@@ -100,11 +94,9 @@ function buildIfBranch(
100
94
 
101
95
  buildAddFragment(node, status, b, parentName, "t_before");
102
96
 
103
- b.append("};");
104
- } else {
105
- b.append(`${creatorsName}[${index}] = (_) => {};`);
97
+ b.append("t_pop_region(t_old_region);");
106
98
  }
107
99
 
108
- b.append(`${stateName}.index = ${index};`);
100
+ b.append(`${indexName} = ${index};`);
109
101
  b.append("}");
110
102
  }
@@ -19,6 +19,9 @@ export default function buildReplaceNode(node: ControlNode, status: BuildStatus,
19
19
 
20
20
  status.imports.add("t_region");
21
21
  status.imports.add("t_run_control");
22
+ status.imports.add("t_run_branch");
23
+ status.imports.add("t_push_region");
24
+ status.imports.add("t_pop_region");
22
25
 
23
26
  b.append("");
24
27
  b.append(`
@@ -42,7 +45,12 @@ function buildReplaceBranch(
42
45
  status.imports.add("t_run_branch");
43
46
 
44
47
  b.append(`${replaceForVarNames(node.statement, status)};`);
45
- b.append(`t_run_branch(${regionName}, () => {`);
48
+ b.append(`if (!t_run_branch(${regionName}, 0, -1)) return;`);
49
+
50
+ b.append(`
51
+ const t_new_region = t_region(${status.options.dev === true ? `"replace_branch"` : ""});
52
+ const t_old_region = t_push_region(t_new_region, true);
53
+ `);
46
54
 
47
55
  buildFragment(node, status, b, parentName, "t_before");
48
56
 
@@ -57,5 +65,5 @@ function buildReplaceBranch(
57
65
 
58
66
  buildAddFragment(node, status, b, parentName, "t_before");
59
67
 
60
- b.append(`}${status.options.dev === true ? ', "replace"' : ""});`);
68
+ b.append("t_pop_region(t_old_region);");
61
69
  }
@@ -15,8 +15,7 @@ export default function buildSwitchNode(node: ControlNode, status: BuildStatus,
15
15
  const anchorName = node.varName ?? "null";
16
16
  const parentName = node.parentName!;
17
17
  const regionName = nextVarName("switch_region", status);
18
- const stateName = "$" + nextVarName("switch_state", status);
19
- const creatorsName = nextVarName("switch_creators", status);
18
+ const indexName = nextVarName("switch_index", status);
20
19
 
21
20
  // Filter non-control branches (spaces)
22
21
  const branches = node.children.filter((n) => isControlNode(n)) as ControlNode[];
@@ -33,42 +32,33 @@ export default function buildSwitchNode(node: ControlNode, status: BuildStatus,
33
32
  branches.push(defaultBranch);
34
33
  }
35
34
 
36
- status.imports.add("$watch");
37
- status.imports.add("$run");
38
35
  status.imports.add("t_region");
39
36
  status.imports.add("t_run_control");
40
37
  status.imports.add("t_run_branch");
38
+ status.imports.add("t_push_region");
39
+ status.imports.add("t_pop_region");
41
40
 
42
41
  b.append("");
43
42
  b.append("/* @switch */");
43
+
44
44
  addPushDevBoundary("control", `@${branches[0].statement}`, status, b);
45
+
45
46
  b.append(`
46
47
  const ${regionName} = t_region(${status.options.dev === true ? `"switch"` : ""});
47
- let ${stateName} = $watch({ index: -1 });
48
- let ${creatorsName}: ((t_before: Node | null) => void)[] = [];
49
- $run(() => {`);
48
+ let ${indexName} = -1;
49
+ t_run_control(${regionName}, ${anchorName}, (t_before) => {`);
50
50
 
51
51
  // TODO: replaceForVarNames is going to throw mapping out
52
52
  addMappedText("", `${replaceForVarNames(node.statement, status)}`, " {", node.span, status, b);
53
53
 
54
54
  let index = 0;
55
55
  for (let branch of branches) {
56
- buildSwitchBranch(branch, status, b, parentName, stateName, creatorsName, index++);
56
+ buildSwitchBranch(branch, status, b, parentName, regionName, indexName, index++);
57
57
  }
58
58
  b.append(`
59
59
  }
60
60
  }${status.options.dev === true ? `, "runSwitch"` : ""});`);
61
61
 
62
- b.append(`
63
- t_run_control(${regionName}, ${anchorName}, (t_before) => {
64
- const index = ${stateName}.index;`);
65
- //addPushDevBoundary("branch", "`branch ${index}`", status, b);
66
- b.append(
67
- `t_run_branch(${regionName}, () => ${creatorsName}[index](t_before)${status.options.dev === true ? ", `branch ${index}`" : ""});`,
68
- );
69
- addPopDevBoundary(status, b);
70
- b.append("});");
71
-
72
62
  addPopDevBoundary(status, b);
73
63
 
74
64
  b.append("");
@@ -79,16 +69,20 @@ function buildSwitchBranch(
79
69
  status: BuildStatus,
80
70
  b: Builder,
81
71
  parentName: string,
82
- stateName: string,
83
- creatorsName: string,
72
+ regionName: string,
73
+ indexName: string,
84
74
  index: number,
85
75
  ) {
86
76
  // TODO: replaceForVarNames is going to throw mapping out
87
77
  addMappedText("", `${replaceForVarNames(node.statement, status)}`, " {", node.span, status, b);
88
78
 
79
+ b.append(`if (!t_run_branch(${regionName}, ${indexName}, ${index})) return;`);
80
+
89
81
  if (node.children.length > 0) {
90
- let beforeParam = node.fragment !== undefined ? "t_before" : "_";
91
- b.append(`${creatorsName}[${index}] = (${beforeParam}) => {`);
82
+ b.append(`
83
+ const t_new_region = t_region(${status.options.dev === true ? `"switch_branch"` : ""});
84
+ const t_old_region = t_push_region(t_new_region, true);
85
+ `);
92
86
 
93
87
  buildFragment(node, status, b, parentName, "t_before");
94
88
 
@@ -103,13 +97,11 @@ function buildSwitchBranch(
103
97
 
104
98
  buildAddFragment(node, status, b, parentName, "t_before");
105
99
 
106
- b.append("};");
107
- } else {
108
- b.append(`${creatorsName}[${index}] = (_) => {};`);
100
+ b.append("t_pop_region(t_old_region);");
109
101
  }
110
102
 
111
- b.append(`${stateName}.index = ${index};`);
112
103
  b.append(`
104
+ ${indexName} = ${index};
113
105
  break;
114
106
  }`);
115
107
  }
@@ -12,6 +12,7 @@ export default function runControl(
12
12
  region: Region,
13
13
  anchor: Node | null,
14
14
  create: (anchor: Node | null) => void,
15
+ name?: string,
15
16
  ): void {
16
17
  let first = true;
17
18
 
@@ -24,7 +25,7 @@ export default function runControl(
24
25
  create(anchor);
25
26
 
26
27
  popRegion(oldRegion);
27
- });
28
+ }, name);
28
29
 
29
30
  // If we're mounting, the anchor will be the one that is passed in, but if
30
31
  // we're hydrating it will be after the active branch's HTML elements, so we
@@ -1,25 +1,18 @@
1
1
  import type Region from "../types/Region";
2
2
  import clearRegion from "./clearRegion";
3
- import newRegion from "./newRegion";
4
- import popRegion from "./popRegion";
5
- import pushRegion from "./pushRegion";
6
3
 
7
- export default function runControlBranch(region: Region, create: () => void, name?: string): void {
4
+ export default function runControlBranch(region: Region, oldIndex: number, index: number): boolean {
5
+ if (oldIndex === index) return false;
6
+
8
7
  // HACK: This is bad -- it means that the parent region has been cleared,
9
8
  // but that should have cleared the effect that runs this child region??
10
9
  // TODO: Look into this further...
11
- if (region.depth === -2) return;
10
+ if (region.depth === -2) return false;
12
11
 
13
12
  // Branching regions have exactly one child -- remove it if necessary
14
13
  if (region.nextRegion !== null && region.nextRegion.depth > region.depth) {
15
- clearRegion(region.nextRegion!);
14
+ clearRegion(region.nextRegion);
16
15
  }
17
16
 
18
- const branchRegion = newRegion(name);
19
- const oldRegion = pushRegion(branchRegion, true);
20
-
21
- // Run the create function
22
- create();
23
-
24
- popRegion(oldRegion);
17
+ return true;
25
18
  }
@@ -71,6 +71,10 @@ export default function proxyGet(
71
71
  if (arrayWrapper[key] !== undefined) {
72
72
  return arrayWrapper[key](data, target, key);
73
73
  }
74
+ } else {
75
+ // If it's a non-existent property we still set up a subscription so
76
+ // that if its value is set to something it will re-run the effect
77
+ trackProxySignal(data, key);
74
78
  }
75
79
  } else if (signal.type === SIGNAL_TYPE) {
76
80
  // If a property is being accessed in the course of setting up an
@@ -11,7 +11,7 @@ export default function proxySet(
11
11
  value: any,
12
12
  receiver: any,
13
13
  ): boolean {
14
- //console.log(`object set '${String(key)}' to '`, value, `' on`, target);
14
+ //console.log(`object set '${String(key)}' to`, value, "on", target);
15
15
  //console.log(`object set '${String(key)}'`);
16
16
 
17
17
  // Only do things if the value has changed
@@ -16,7 +16,6 @@ export default function Attributes(
16
16
  // @ts-ignore
17
17
  $slots?: Record<string, SlotRender>
18
18
  ): void {
19
- $peek(() => { /**/
20
19
 
21
20
  /* User interface */
22
21
  const t_fragments: DocumentFragment[] = [];
@@ -34,5 +33,4 @@ export default function Attributes(
34
33
  t_add_fragment(t_fragment_0, $parent, $anchor, t_text_1);
35
34
  t_next(t_text_1);
36
35
 
37
- /**/ });
38
36
  }
@@ -16,7 +16,6 @@ export default function Attributes(
16
16
  // @ts-ignore
17
17
  $slots?: Record<string, SlotRender>
18
18
  ): void {
19
- $peek(() => { /**/
20
19
 
21
20
  /* User interface */
22
21
  const t_fragments: DocumentFragment[] = [];
@@ -34,5 +33,4 @@ export default function Attributes(
34
33
  t_add_fragment(t_fragment_0, $parent, $anchor, t_text_1);
35
34
  t_next(t_text_1);
36
35
 
37
- /**/ });
38
36
  }
@@ -16,7 +16,6 @@ export default function Attributes(
16
16
  // @ts-ignore
17
17
  $slots?: Record<string, SlotRender>
18
18
  ): void {
19
- $peek(() => { /**/
20
19
 
21
20
  /* User interface */
22
21
  const t_fragments: DocumentFragment[] = [];
@@ -34,5 +33,4 @@ export default function Attributes(
34
33
  t_add_fragment(t_fragment_0, $parent, $anchor, t_text_1);
35
34
  t_next(t_text_1);
36
35
 
37
- /**/ });
38
36
  }
@@ -16,7 +16,6 @@ export default function Attributes(
16
16
  // @ts-ignore
17
17
  $slots?: Record<string, SlotRender>
18
18
  ): void {
19
- $peek(() => { /**/
20
19
 
21
20
  /* User interface */
22
21
  const t_fragments: DocumentFragment[] = [];
@@ -34,5 +33,4 @@ export default function Attributes(
34
33
  t_add_fragment(t_fragment_0, $parent, $anchor, t_text_1);
35
34
  t_next(t_text_1);
36
35
 
37
- /**/ });
38
36
  }