@torpor/view 0.4.9 → 0.4.11

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 (234) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/compile.cjs +75 -77
  3. package/dist/compile.cjs.map +1 -1
  4. package/dist/compile.js +75 -77
  5. package/dist/compile.js.map +1 -1
  6. package/dist/index.cjs +6 -7
  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 +6 -7
  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 +1 -10
  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/proxySet.ts +1 -1
  24. package/test/attributes/components/output/Attributes-client.ts +0 -2
  25. package/test/attributes/components/output/Disappearing-client.ts +0 -2
  26. package/test/attributes/components/temp/{Attributes-client-b9b98b8c868cc4f13484ae2237d59ef9491dfbf3.ts → Attributes-client-63bd49fe97fb8d775ef291fa19b8f03075020f63.ts} +0 -2
  27. package/test/attributes/components/temp/{Disappearing-client-b9b98b8c868cc4f13484ae2237d59ef9491dfbf3.ts → Disappearing-client-63bd49fe97fb8d775ef291fa19b8f03075020f63.ts} +0 -2
  28. package/test/await/components/output/Await-client.ts +49 -42
  29. package/test/await/components/temp/{Await-client-284921284e6ae52b607902682f7f9b69bffe1515.ts → Await-client-5ad15bc135417fa095bb5c95c7407a02a444a272.ts} +49 -42
  30. package/test/bind/components/output/BindComponent-client.ts +0 -4
  31. package/test/bind/components/output/BindText-client.ts +0 -2
  32. package/test/bind/components/temp/{BindComponent-client-acbb75b9dc9685722e49a937138b8f8d2e5f0539.ts → BindComponent-client-44f487e4c31612483ff002a7dea91925dd37b96b.ts} +0 -4
  33. package/test/bind/components/temp/{BindText-client-12ad90dae9678c8cdc7d8f2266ff6ed58824d57e.ts → BindText-client-74b797d8a10d8f18a71ef121dbb9eaec9c8dd67a.ts} +0 -2
  34. package/test/child-component/components/output/ChildComponent-client.ts +0 -4
  35. package/test/child-component/components/temp/{ChildComponent-client-63a83042fd341882e31e4fe9344294cbe83f00e5.ts → ChildComponent-client-3f29b8db2e610cbcb200af36721456404ed29dca.ts} +0 -4
  36. package/test/class/components/output/Class-client.ts +0 -4
  37. package/test/class/components/temp/{Class-client-919c8e138d3885b62ad3440c2d6925edae8e4892.ts → Class-client-0741f12141ba1e5d531ca6cc9becc0511ff0c502.ts} +0 -4
  38. package/test/component/components/output/Component-client.ts +0 -4
  39. package/test/component/components/temp/{Component-client-a433db324e16bc80b647022bba8717c7b5d285a6.ts → Component-client-8255e6a16f9dc01f64b88808bc92003396794fa5.ts} +0 -4
  40. package/test/console/components/output/Console-client.ts +0 -2
  41. package/test/console/components/temp/{Console-client-2d6a441342c992f6be9f4139a3354055f7aa6c41.ts → Console-client-bf26a9f6c8785ce09608d36fae616de0724a2355.ts} +0 -2
  42. package/test/const/components/output/Const-client.ts +0 -2
  43. package/test/const/components/temp/{Const-client-9d8262840860a5cb686c4923d0c8567ffc704b35.ts → Const-client-111aef0ff3a14c98eed9dba0a6205bd4509ccf29.ts} +0 -2
  44. package/test/context/components/output/Context-client.ts +0 -6
  45. package/test/context/components/temp/{Context-client-c1437b9cb8765f3d73b315982dd52e8458345da9.ts → Context-client-a4b608a96e3a3763ad9d660e1bc0836a105b9ea3.ts} +0 -6
  46. package/test/effects/components/output/ForEffect-client.ts +0 -2
  47. package/test/effects/components/output/IfEffect-client.ts +24 -27
  48. package/test/effects/components/output/NestedIfEffect-client.ts +46 -52
  49. package/test/effects/components/temp/{ForEffect-client-74072b430ca76fba1ebcad8bbc14754874f60969.ts → ForEffect-client-15144e8e55d99b6495affdb158cf95b301713f1a.ts} +0 -2
  50. package/test/effects/components/temp/{IfEffect-client-bdc34d65604493fc1475e2e98f7ae262a0ca5f34.ts → IfEffect-client-792e4b6c568e2cffad16c0b64ffd39928566c534.ts} +24 -27
  51. package/test/effects/components/temp/NestedIfEffect-client-724b09d88afd0eb4df459082ada91ac041825f7a.ts +89 -0
  52. package/test/events/components/output/Events-client.ts +0 -2
  53. package/test/events/components/temp/{Events-client-a02f139a6aed6e9105eeb23cee802f3d1b8550e5.ts → Events-client-3224d5bbbc6d4188c566cfa86659e546a886877a.ts} +0 -2
  54. package/test/for/components/output/For-client.ts +0 -2
  55. package/test/for/components/output/ForAfterFor-client.ts +0 -2
  56. package/test/for/components/output/ForContainingFor-client.ts +0 -2
  57. package/test/for/components/output/ForContainingFunction-client.ts +0 -2
  58. package/test/for/components/output/ForContainingIf-client.ts +18 -24
  59. package/test/for/components/output/ForEscape-client.ts +0 -2
  60. package/test/for/components/output/ForIn-client.ts +0 -2
  61. package/test/for/components/output/ForOf-client.ts +0 -2
  62. package/test/for/components/temp/{For-client-b999b399f32cac80c8ca1c9a718e35705a2dc10f.ts → For-client-287e5695f24f6700158d2c689fdce1916031b4d7.ts} +0 -2
  63. package/test/for/components/temp/{ForAfterFor-client-315138c704ee78185fbaf09a3f055e4c00a3a91d.ts → ForAfterFor-client-bc375829d736a62ee760f32a5a90df78426c8534.ts} +0 -2
  64. package/test/for/components/temp/{ForContainingFor-client-d9ed22634282fabc29ed8bdd5e4cb3ee699f5f56.ts → ForContainingFor-client-d80aba5977a7cef8263f0fdaf6216e19bb8b0625.ts} +0 -2
  65. package/test/for/components/temp/{ForContainingFunction-client-a1a63d73cf56ffc50e5f46cd2e2cc71bf0ebaa4c.ts → ForContainingFunction-client-bcb91a1c7ad2fd4e227fc40f28f01e7fdc495bdc.ts} +0 -2
  66. package/test/for/components/temp/{ForContainingIf-client-9fd42948e04eeb5114d22c4d986e27a101c7e73a.ts → ForContainingIf-client-8911d18357f7c81f97d64773442275c802292ae7.ts} +18 -24
  67. package/test/for/components/temp/{ForEscape-client-f6ee68cf9081cecccc78d793da192df403a573d4.ts → ForEscape-client-13038740272dd6b7fa9f228ae852e3d1b2725f88.ts} +0 -2
  68. package/test/for/components/temp/{ForIn-client-f82576cc3c950432fec8c196ba25596f191177ae.ts → ForIn-client-9f244dfd10d0439f14719e724aefc908174fe4e3.ts} +0 -2
  69. package/test/for/components/temp/{ForOf-client-1a89bfa049d931c7ec848d80196cd75bc67868a6.ts → ForOf-client-b0e33a686f4183a88aa06af7f2255e7210438fce.ts} +0 -2
  70. package/test/function/components/output/Function-client.ts +0 -2
  71. package/test/function/components/temp/{Function-client-a9072c015aa3f89966fbfc905109c2c6ecac3846.ts → Function-client-a2603b20a7f8763ba9713b04c42da56c2ee2056e.ts} +0 -2
  72. package/test/html/components/output/Html-client.ts +10 -8
  73. package/test/html/components/temp/{Html-client-206a7cd3478abde0e6902a8cb953dc20d6a2cd3f.ts → Html-client-da930140bd62a34408887d13aafebbe856065bef.ts} +10 -8
  74. package/test/html/html.test.ts +1 -0
  75. package/test/if/components/output/ElseIfTrue-client.ts +34 -35
  76. package/test/if/components/output/ElseTrue-client.ts +34 -35
  77. package/test/if/components/output/IfAfterIf-client.ts +30 -38
  78. package/test/if/components/output/IfCache-client.ts +29 -32
  79. package/test/if/components/output/IfContainingFor-client.ts +53 -59
  80. package/test/if/components/output/IfContainingFunction-client.ts +21 -26
  81. package/test/if/components/output/IfContainingIf-client.ts +46 -52
  82. package/test/if/components/output/IfElseFalse-client.ts +24 -27
  83. package/test/if/components/output/IfElseTrue-client.ts +24 -27
  84. package/test/if/components/output/IfFalse-client.ts +16 -21
  85. package/test/if/components/output/IfNested-client.ts +54 -58
  86. package/test/if/components/temp/ElseIfTrue-client-b9fc7dd83aae7205745ae376e2081befa33e320c.ts +77 -0
  87. package/test/if/components/temp/ElseTrue-client-b9fc7dd83aae7205745ae376e2081befa33e320c.ts +77 -0
  88. package/test/if/components/temp/{IfAfterIf-client-b042b5047978b9054a6a89e45f4d157249885821.ts → IfAfterIf-client-e463e4db80127acc2ed0c4da349ecaa4c5b0ce1a.ts} +30 -38
  89. package/test/if/components/temp/{IfCache-client-3d0bc2841d050f6d86bbccddfdcaf0b0b781ab87.ts → IfCache-client-e892165cad33a1052bb248fe10e1b3aa9dffbf01.ts} +29 -32
  90. package/test/if/components/temp/IfContainingFor-client-0835d2155fd73b40d06b77d9f5af380a1d209e4e.ts +105 -0
  91. package/test/if/components/temp/{IfContainingFunction-client-b3a3e7e2b2b44618fa722403d51717532fc237e4.ts → IfContainingFunction-client-2c1a9e5da9fb9a85cae8123f30c23ccc851c9803.ts} +21 -26
  92. package/test/if/components/temp/IfContainingIf-client-517b94a34195618e4e58cabdfdb402288379b075.ts +89 -0
  93. package/test/{effects/components/temp/NestedIfEffect-client-944bd749d83ebce0f6ae66c6751f38ecd430df05.ts → if/components/temp/IfContainingIfAfterIf-client-f435f9bc464edfaf580ef7c1726a4be5ba8c6f6f.ts} +29 -8
  94. package/test/if/components/temp/IfContainingIfAfterIf-server-2cfd604fd3a7187217437bd97dc89a4c6aeb8726.ts +29 -0
  95. package/test/if/components/temp/IfContainingIfAfterIf-types-805203b39332252a17996786ac79ece914bbea34.ts +10 -0
  96. package/test/if/components/temp/{IfElseTrue-client-9bccfbdf5da704d3756ff48e2cf6987e6125dc1f.ts → IfElseFalse-client-6003c6c731c1bad239bdcea789d136bc8cd6090a.ts} +24 -27
  97. package/test/if/components/temp/{IfElseFalse-client-9bccfbdf5da704d3756ff48e2cf6987e6125dc1f.ts → IfElseTrue-client-6003c6c731c1bad239bdcea789d136bc8cd6090a.ts} +24 -27
  98. package/test/if/components/temp/{IfFalse-client-9ad6f6e3f7abb5d9927d4823315886542c6ec611.ts → IfFalse-client-8ef85fba04e1e6c3f2b95d9d957bffea5ba593ae.ts} +16 -21
  99. package/test/if/components/temp/IfNested-client-5be29838cfd71602d781e744ebd1eb9968eb825c.ts +97 -0
  100. package/test/mount/components/output/Mount-client.ts +0 -2
  101. package/test/mount/components/temp/{Mount-client-ce5a39e2bd6942a589b1a91d392ee841d55bccf2.ts → Mount-client-00351e81e77561213a14c8eea534acae3c5eb692.ts} +0 -2
  102. package/test/on-mount/components/output/OnMount-client.ts +0 -2
  103. package/test/on-mount/components/temp/{OnMount-client-218e35c32f4c3d30a193775e4aecd50d5663da0d.ts → OnMount-client-0a63fc37b0f617ee0b4de2619590a2562a3e2f92.ts} +0 -2
  104. package/test/party/components/output/ComputedState-client.ts +0 -2
  105. package/test/party/components/output/Conditional-client.ts +36 -35
  106. package/test/party/components/output/Context-client.ts +0 -4
  107. package/test/party/components/output/DeclareState-client.ts +0 -2
  108. package/test/party/components/output/DomRef-client.ts +0 -2
  109. package/test/party/components/output/EmitToParent-client.ts +0 -4
  110. package/test/party/components/output/EventClick-client.ts +0 -2
  111. package/test/party/components/output/InputCheckbox-client.ts +0 -2
  112. package/test/party/components/output/InputRadio-client.ts +0 -2
  113. package/test/party/components/output/InputSelect-client.ts +0 -2
  114. package/test/party/components/output/InputText-client.ts +0 -2
  115. package/test/party/components/output/Loop-client.ts +0 -2
  116. package/test/party/components/output/MinimalTemplate-client.ts +0 -2
  117. package/test/party/components/output/OnMount-client.ts +0 -2
  118. package/test/party/components/output/Props-client.ts +0 -4
  119. package/test/party/components/output/Slot-client.ts +0 -4
  120. package/test/party/components/output/SlotFallback-client.ts +0 -4
  121. package/test/party/components/output/Styling-client.ts +0 -2
  122. package/test/party/components/output/UpdateState-client.ts +0 -2
  123. package/test/party/components/temp/{ComputedState-client-fcd3c890f4dc9058c4ee29e7cdbfda23a8d4695f.ts → ComputedState-client-512a35be46f600ab9b9cf9da0e3c0c90b377d7fa.ts} +0 -2
  124. package/test/party/components/temp/{Conditional-client-39c1844a9395f8620541f6599ee4547906c35d69.ts → Conditional-client-2c5f759b41ce567a51589af001bf0fc6feb47b4b.ts} +36 -35
  125. package/test/party/components/temp/{Context-client-696777e5ce1ad7ef2f5bc8e4c2c1a81fb3a98ece.ts → Context-client-88246cfda3671dd5ac8919d95c2f65a8dce81f18.ts} +0 -4
  126. package/test/party/components/temp/{DeclareState-client-cbade5ab902b3d7d5bf8054f9cc7e149334e3560.ts → DeclareState-client-cc45b93b34f4c34c965c765e0f53f78ea416b1ca.ts} +0 -2
  127. package/test/party/components/temp/{DomRef-client-6e643c9cfee7fed10c6cead9fcad055646712aa6.ts → DomRef-client-4c28338d9ea7a2c3d273970161181d82076ed19e.ts} +0 -2
  128. package/test/party/components/temp/{EmitToParent-client-89b1744b0bc1e50dc2091c6e63dfe9b62a0b8d46.ts → EmitToParent-client-fcf3d690b10871aad884099e078d5c98d7b8503d.ts} +0 -4
  129. package/test/party/components/temp/{EventClick-client-2c7393fcd73e6d10d17f5f19aacafeb91ab219f6.ts → EventClick-client-dcb9b191808f7f0f9d009b725da046ba241cb44b.ts} +0 -2
  130. package/test/party/components/temp/{InputCheckbox-client-377a0a0505e307b19dcca95cb9b1cf9c8a38835b.ts → InputCheckbox-client-f0af6d8f86c4f80673dea1599a6f2deaf54fe576.ts} +0 -2
  131. package/test/party/components/temp/{InputRadio-client-38c3f46fabdb94ca79c71888ce3335687461fcbd.ts → InputRadio-client-1472838ddbfe003a85779e1ccb7b57cb66333e90.ts} +0 -2
  132. package/test/party/components/temp/{InputSelect-client-bac5f12f5560e702794587702c883c273c92394f.ts → InputSelect-client-9881943682735888d6b62612d93577ba51593678.ts} +0 -2
  133. package/test/party/components/temp/{InputText-client-2a189403e60e6f932829370233ddede2be782334.ts → InputText-client-7b37e856f97c863e120a4aa6c02757e489ad6591.ts} +0 -2
  134. package/test/party/components/temp/{Loop-client-c99929d3487880b8526d0ed3602c96dd36da1a8c.ts → Loop-client-5e5694bc158fcd5f06cd1037e920c657032d7b90.ts} +0 -2
  135. package/test/party/components/temp/{MinimalTemplate-client-72e8afffe412117e38f8045196704fa3ac384213.ts → MinimalTemplate-client-079892cc885b1f25863c13b93c83e0554a22a2c3.ts} +0 -2
  136. package/test/party/components/temp/{OnMount-client-f16abd053b4b1ba31fc806e8c3a39163a46cb6a2.ts → OnMount-client-1900436fa5a6d56cb98df953de89e0f662d821e8.ts} +0 -2
  137. package/test/party/components/temp/{Props-client-863b630f7f77c4609f6171886bf812b9452cfceb.ts → Props-client-b94724d04965006c1c89776bac2fa10694280c44.ts} +0 -4
  138. package/test/party/components/temp/{Slot-client-4406668a963796d1117ec818118e504e55b18e4c.ts → Slot-client-5793cdf8a5f28b5009ae17435cfd146ed6c8a1f8.ts} +0 -4
  139. package/test/party/components/temp/{SlotFallback-client-4406668a963796d1117ec818118e504e55b18e4c.ts → SlotFallback-client-5793cdf8a5f28b5009ae17435cfd146ed6c8a1f8.ts} +0 -4
  140. package/test/party/components/temp/{Styling-client-59c057fc5b6c226d667351ea7f748abbe86f1c96.ts → Styling-client-a1c7082740471fead2feb331c9ba0864ff0c5566.ts} +0 -2
  141. package/test/party/components/temp/{UpdateState-client-3b087abf0cb4b1e784623f3de6dabbcb63703e07.ts → UpdateState-client-c6c785a6d35693ba1b9c36dbd59bf28163718c00.ts} +0 -2
  142. package/test/props/components/output/Reactive-client.ts +0 -4
  143. package/test/props/components/temp/{Reactive-client-a911a7026a02bf32c185e29a87f5b8611685e370.ts → Reactive-client-26a5294eda35e924911bcc99acda58cc98baee7c.ts} +0 -4
  144. package/test/replace/components/output/Replace-client.ts +14 -12
  145. package/test/replace/components/temp/{Replace-client-d5e681fe8c662c832916d61ae22d51e65dfeba53.ts → Replace-client-872de024cd2c5c6c95a3eb4e29642e8e48e69a27.ts} +14 -12
  146. package/test/slots/components/output/BasicSlot-client.ts +0 -4
  147. package/test/slots/components/output/LetSlot-client.ts +0 -4
  148. package/test/slots/components/output/NamedSlot-client.ts +0 -4
  149. package/test/slots/components/output/UnusedSlot-client.ts +0 -4
  150. package/test/slots/components/temp/{BasicSlot-client-c1e9885dc85d13e4b44d54e0ad800c0d46e35914.ts → BasicSlot-client-39a9a3170fd51582b023b805d597eb729bb6b02b.ts} +0 -4
  151. package/test/slots/components/temp/{LetSlot-client-3b1779874d3c9b1289fb62f124af5ebaf78279a8.ts → LetSlot-client-63980e54259324855b573e87efb1d7a1ac9abd9c.ts} +0 -4
  152. package/test/slots/components/temp/{NamedSlot-client-8faa564d1002c199f102aa148657d82628d1ebd7.ts → NamedSlot-client-426018f63a360e6d4208400b25bfadd2727eadcf.ts} +0 -4
  153. package/test/slots/components/temp/{UnusedSlot-client-2e23b278b99db53bc0fde9c98836d8e26481a40e.ts → UnusedSlot-client-5819c279d1f8c2d808651505171a5b20a41998ef.ts} +0 -4
  154. package/test/special-component/components/output/SpecialComponent-client.ts +29 -31
  155. package/test/special-component/components/temp/{SpecialComponent-client-d81a30dda5d8d509e8661caa70bbc89265bc65c1.ts → SpecialComponent-client-752f0be79a322e8f75bfdd5adfec996d4ab35281.ts} +29 -31
  156. package/test/special-element/components/output/SpecialElement-client.ts +0 -2
  157. package/test/special-element/components/temp/{SpecialElement-client-2887938dfcd02e042d8fe5501845d043b098616a.ts → SpecialElement-client-f6239c04736a49add9278edfaea7804dd186e665.ts} +0 -2
  158. package/test/special-head/components/output/SpecialHead-client.ts +0 -2
  159. package/test/special-head/components/temp/{SpecialHead-client-3b8455aa874ae0113a7f718cb64b310d84430ce6.ts → SpecialHead-client-cda50f56454f7c7f0147352e53d50c4060ed2e3b.ts} +0 -2
  160. package/test/special-self/components/output/SpecialSelf-client.ts +25 -28
  161. package/test/special-self/components/temp/{SpecialSelf-client-cb6aba06aa4bec73485ef48bc05557a5c935f54c.ts → SpecialSelf-client-09e93618a2318d3873b201557e2f32d5bf5e4100.ts} +25 -28
  162. package/test/style/components/output/Style-client.ts +0 -2
  163. package/test/style/components/temp/{Style-client-8896b4c0fe78e346904fbcf24d629bbe20a56860.ts → Style-client-8ca877392f5610bc527c5577d948f5782c40bf96.ts} +0 -2
  164. package/test/svg/components/output/Svg-client.ts +24 -26
  165. package/test/svg/components/temp/{Svg-client-0397419af735b847de6c56bd6ad2bb4eb6dc1ba2.ts → Svg-client-6a213daf6df5c361de9e1c9aa7cc581bcb6356be.ts} +24 -26
  166. package/test/switch/components/output/Switch-client.ts +34 -35
  167. package/test/{if/components/temp/ElseTrue-client-6eb8f5e058f266603104442f46cd96206bbceee8.ts → switch/components/temp/Switch-client-4cab689c9914c62d461e6aaf6beb68d15275c68f.ts} +46 -34
  168. package/test/text/components/output/Text-client.ts +0 -2
  169. package/test/text/components/temp/{Text-client-3b2555c36eef59b2d79b1d5a6d3edf4ff28a6816.ts → Text-client-4288bc38b436a5b486c1fd5a4805bd206dbff27c.ts} +0 -2
  170. package/test/watch-array/components/output/ArrayAllFunctions-client.ts +0 -2
  171. package/test/watch-array/components/output/ArrayAllFunctionsUnkeyed-client.ts +0 -2
  172. package/test/watch-array/components/output/ArrayEmpty-client.ts +0 -2
  173. package/test/watch-array/components/output/ArrayEntries-client.ts +0 -2
  174. package/test/watch-array/components/output/ArrayIndexes-client.ts +0 -2
  175. package/test/watch-array/components/output/ArrayPop-client.ts +0 -2
  176. package/test/watch-array/components/output/ArrayPush-client.ts +0 -2
  177. package/test/watch-array/components/output/ArrayReassign-client.ts +0 -2
  178. package/test/watch-array/components/output/ArrayReverse-client.ts +0 -2
  179. package/test/watch-array/components/output/ArraySetObject-client.ts +0 -2
  180. package/test/watch-array/components/output/ArraySetProperty-client.ts +0 -2
  181. package/test/watch-array/components/output/ArrayShift-client.ts +0 -2
  182. package/test/watch-array/components/output/ArraySort-client.ts +0 -2
  183. package/test/watch-array/components/output/ArraySpliceAdd-client.ts +0 -2
  184. package/test/watch-array/components/output/ArraySpliceDelete-client.ts +0 -2
  185. package/test/watch-array/components/output/ArraySpliceDeleteAll-client.ts +0 -2
  186. package/test/watch-array/components/output/ArraySpliceDeleteAndAdd-client.ts +0 -2
  187. package/test/watch-array/components/output/ArraySpliceDeleteEnd-client.ts +0 -2
  188. package/test/watch-array/components/output/ArraySwap-client.ts +0 -2
  189. package/test/watch-array/components/output/ArrayUnshift-client.ts +0 -2
  190. package/test/watch-array/components/output/ArrayUpdateAssignment-client.ts +0 -2
  191. package/test/watch-array/components/temp/{ArrayPush-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayAllFunctions-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
  192. package/test/watch-array/components/temp/{ArrayAllFunctionsUnkeyed-client-0aede144ecd4a1de98d0ac6265fc4275e9803f9e.ts → ArrayAllFunctionsUnkeyed-client-513455af417adc9807393dbb58da507c66dde885.ts} +0 -2
  193. package/test/watch-array/components/temp/{ArrayAllFunctions-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayEmpty-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
  194. package/test/watch-array/components/temp/{ArrayEntries-client-40c8fbd950418f90335fee16250a42778d8bfbaf.ts → ArrayEntries-client-cf9fe0738861c78fbd576d7f74b38c713363ee31.ts} +0 -2
  195. package/test/watch-array/components/temp/{ArrayIndexes-client-89d3c7c1e89ca1c402183e84c3a2a8ed02bde10b.ts → ArrayIndexes-client-2c12fa2b6d0992423b57ddb6f363b9c4c5bf525a.ts} +0 -2
  196. package/test/watch-array/components/temp/{ArrayEmpty-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayPop-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
  197. package/test/watch-array/components/temp/{ArrayPop-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayPush-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
  198. package/test/watch-array/components/temp/ArrayReassign-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  199. package/test/watch-array/components/temp/ArrayReverse-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  200. package/test/watch-array/components/temp/ArraySetObject-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  201. package/test/watch-array/components/temp/ArraySetProperty-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  202. package/test/watch-array/components/temp/ArrayShift-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  203. package/test/watch-array/components/temp/ArraySort-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  204. package/test/watch-array/components/temp/ArraySpliceAdd-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  205. package/test/watch-array/components/temp/ArraySpliceDelete-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  206. package/test/watch-array/components/temp/ArraySpliceDeleteAll-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  207. package/test/watch-array/components/temp/ArraySpliceDeleteAndAdd-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  208. package/test/watch-array/components/temp/ArraySpliceDeleteEnd-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  209. package/test/watch-array/components/temp/ArraySwap-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  210. package/test/watch-array/components/temp/ArrayUnshift-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  211. package/test/watch-array/components/temp/ArrayUpdateAssignment-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
  212. package/test/watch-object/components/output/WatchObject-client.ts +0 -2
  213. package/test/watch-object/components/output/WatchUndefinedPropertyChange-client.ts +0 -2
  214. package/test/watch-object/components/temp/{WatchObject-client-6e179fea629d983307056536ab5a3cf9141335fa.ts → WatchObject-client-8f906f7d7613370e70c55a122774e122cdd55bff.ts} +0 -2
  215. package/test/watch-object/components/temp/{WatchUndefinedPropertyChange-client-210c8984d068fe46e681de4f63d744af34d75b7a.ts → WatchUndefinedPropertyChange-client-bce2c42e17dedce203b71228966e20056b82baba.ts} +0 -2
  216. package/test/if/components/temp/ElseIfTrue-client-6eb8f5e058f266603104442f46cd96206bbceee8.ts +0 -78
  217. package/test/if/components/temp/IfContainingFor-client-0b27933986c4593fdad3c81ac22e32d7ee6bd40f.ts +0 -111
  218. package/test/if/components/temp/IfContainingIf-client-3cf3407e41d0bd4d2927f97cbc5f9df661537702.ts +0 -95
  219. package/test/if/components/temp/IfNested-client-50abd76ec9369ac6cf42f0264870914923f30b5c.ts +0 -101
  220. package/test/switch/components/temp/Switch-client-8de47f56a21297420acf8bc27fc03149f258028b.ts +0 -91
  221. package/test/watch-array/components/temp/ArrayReassign-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  222. package/test/watch-array/components/temp/ArrayReverse-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  223. package/test/watch-array/components/temp/ArraySetObject-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  224. package/test/watch-array/components/temp/ArraySetProperty-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  225. package/test/watch-array/components/temp/ArrayShift-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  226. package/test/watch-array/components/temp/ArraySort-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  227. package/test/watch-array/components/temp/ArraySpliceAdd-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  228. package/test/watch-array/components/temp/ArraySpliceDelete-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  229. package/test/watch-array/components/temp/ArraySpliceDeleteAll-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  230. package/test/watch-array/components/temp/ArraySpliceDeleteAndAdd-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  231. package/test/watch-array/components/temp/ArraySpliceDeleteEnd-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  232. package/test/watch-array/components/temp/ArraySwap-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  233. package/test/watch-array/components/temp/ArrayUnshift-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
  234. package/test/watch-array/components/temp/ArrayUpdateAssignment-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
package/dist/index.cjs CHANGED
@@ -789,25 +789,24 @@ function nodeSkip(node, count) {
789
789
  * Runs an `if`, `switch` or `await` control statement
790
790
  * @param create A function that creates the control statement's branches
791
791
  */
792
- function runControl(region, anchor, create) {
792
+ function runControl(region, anchor, create, name) {
793
793
  let first = true;
794
794
  $run(function runControl$1() {
795
795
  const oldRegion = pushRegion(region, first);
796
796
  first = false;
797
797
  create(anchor);
798
798
  popRegion(oldRegion);
799
- });
799
+ }, name);
800
800
  if (context_default.hydrationNode) anchor = context_default.hydrationNode.nextSibling;
801
801
  }
802
802
 
803
803
  //#endregion
804
804
  //#region src/render/runControlBranch.ts
805
- function runControlBranch(region, create, name) {
806
- if (region.depth === -2) return;
805
+ function runControlBranch(region, oldIndex, index) {
806
+ if (oldIndex === index) return false;
807
+ if (region.depth === -2) return false;
807
808
  if (region.nextRegion !== null && region.nextRegion.depth > region.depth) clearRegion(region.nextRegion);
808
- const oldRegion = pushRegion(newRegion(name), true);
809
- create();
810
- popRegion(oldRegion);
809
+ return true;
811
810
  }
812
811
 
813
812
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["CONTEXT_SYMBOL: unique symbol","context: Context","context","context","previousSub: Subscription | null","clearSub: Subscription | null","sourceSub: Subscription | null","context","sub: Subscription | null","lastSub: Subscription | null","nextSub: Subscription | null","context","targetSub: Subscription | null","sourceSub: Subscription | null","context","effectToClean: Effect | null","context","nextEffect: Effect","previousSub: Subscription | null","clearSub: Subscription | null","error: any","effect: Effect | null","context","signal: ProxySignal | null","context","context","effect: Effect","context","context","setAttribute","animations: Animation[] | undefined","context","devContext","devContext","context","context","devContext","context","context","context","context","context","runControl","context","context","targetSub: Subscription","computed: Computed | undefined","proxyDataSymbol: unique symbol","proxyHandledSymbol: unique symbol","data: ProxyData","context","arrayWrapper: Record<PropertyKey, any>","context","data: ProxyData","handler: ProxyHandler<T>","oldKeyToIndex: Map<any, number> | undefined","newKeyToIndex: Map<any, number> | undefined","listItems: ListItem[]","runList","context","context","context","context","computed: Computed","context","#init"],"sources":["../src/render/context.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/types/constants.ts","../src/watch/clearSources.ts","../src/watch/deactivateSources.ts","../src/watch/trackSignal.ts","../src/watch/runComputed.ts","../src/watch/checkComputed.ts","../src/watch/checkSources.ts","../src/watch/runCleanups.ts","../src/watch/checkEffect.ts","../src/watch/clearTargets.ts","../src/watch/triggerEffects.ts","../src/watch/batchEnd.ts","../src/watch/batchStart.ts","../src/watch/runEffect.ts","../src/watch/$run.ts","../src/render/animate.ts","../src/render/isFragmentNode.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/clearRegion.ts","../src/render/clearLayoutSlot.ts","../src/render/newRegion.ts","../src/render/popRegion.ts","../src/render/pushRegion.ts","../src/render/fillLayoutSlot.ts","../src/render/getFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/render/newListItem.ts","../src/render/hydrationMarkers.ts","../src/render/isCommentNode.ts","../src/render/isTextNode.ts","../src/render/nodeCheckHydrationBreak.ts","../src/render/nodeNext.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeRoot.ts","../src/render/nodeSkip.ts","../src/render/runControl.ts","../src/render/runControlBranch.ts","../src/watch/propagateSignal.ts","../src/watch/symbols.ts","../src/watch/trackProxySignal.ts","../src/watch/proxyGet.ts","../src/watch/proxySet.ts","../src/watch/$watch.ts","../src/render/moveRegion.ts","../src/render/runListItems.ts","../src/render/runList.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts","../src/watch/$batch.ts","../src/watch/$cache.ts","../src/watch/$mount.ts","../src/watch/$peek.ts","../src/watch/$unwrap.ts","../src/wrappers/ReactiveDate.ts"],"sourcesContent":["import type Context from \"../types/Context\";\nimport type Region from \"../types/Region\";\n\n// TODO: Possibly create this in mount/hydrate so we aren't always checking\n// whether it exists with `??=`\n\nconst CONTEXT_SYMBOL: unique symbol = Symbol.for(\"t_context\");\n\nconst context: Context =\n\t// @ts-ignore\n\t(globalThis[CONTEXT_SYMBOL] ??= {\n\t\tactiveTarget: null,\n\t\tpreviousEffect: null,\n\t\textent: 0,\n\t\tbatch: 0,\n\t\tbatchOperation: 0,\n\t\tregisterComputed: null,\n\n\t\tfirstEffectToRun: null,\n\t\tfirstSignalToUpdate: null,\n\n\t\t// These will definitely be set, in mount or render\n\t\tactiveRegion: null as unknown as Region,\n\t\tpreviousRegion: null as unknown as Region,\n\t\trootRegion: null as unknown as Region,\n\n\t\tmountEffects: [],\n\t\tstashedEvents: [],\n\t\tstashedAnimations: [],\n\n\t\thydrationNode: null,\n\t\t//hn: null,\n\t\t//get hydrationNode() {\n\t\t//\treturn this.hn;\n\t\t//},\n\t\t//set hydrationNode(value) {\n\t\t//\tconsole.log(`set hydration ${printNode(value)}`);\n\t\t//\tthis.hn = value;\n\t\t//},\n\t} satisfies Context);\n\nexport default context;\n","import type Animation from \"../types/Animation\";\nimport context from \"./context\";\n\nexport default function addAnimation(el: HTMLElement, entry?: Animation, exit?: Animation): void {\n\t// Stash the event in context so that it can be added when the fragment is\n\t// added to the DOM\n\t// NOTE: We don't need to do this for hydration, but it's simpler to do it\n\t// the same way in both processes\n\tcontext.stashedAnimations.push({\n\t\tregion: context.activeRegion,\n\t\tel,\n\t\tin: entry,\n\t\tout: exit,\n\t});\n}\n","import context from \"./context\";\n\nexport default function addEvent(\n\tel: Element,\n\ttype: string,\n\tlistener: ((this: Element, ev: any) => any) | undefined | null,\n): void {\n\t// Stash the event in context so that it can be added when the fragment is\n\t// added to the DOM\n\t// NOTE: We don't need to do this for hydration, but it's simpler to do it\n\t// the same way in both processes\n\tif (listener !== undefined && listener !== null) {\n\t\tcontext.stashedEvents.push({ region: context.activeRegion, el, type, listener });\n\t}\n}\n","/**\n * The type of a Signal object.\n */\nexport const SIGNAL_TYPE = 0;\n\n/**\n * The type of a Computed object.\n */\nexport const COMPUTED_TYPE = 1;\n\n/**\n * The type of an Effect object.\n */\nexport const EFFECT_TYPE = 2;\n","import type Computed from \"../types/Computed\";\nimport type Effect from \"../types/Effect\";\nimport type Subscription from \"../types/Subscription\";\n\n/**\n * Clear unused source subscriptions after each Computed or Effect has been run.\n */\nexport default function clearSources(target: Computed | Effect): void {\n\tlet previousSub: Subscription | null = null;\n\tfor (\n\t\tlet clearSub: Subscription | null = target.firstSource;\n\t\tclearSub !== null;\n\t\tclearSub = clearSub.nextSource\n\t) {\n\t\tif (target.didError || !clearSub.active) {\n\t\t\t//console.log(\n\t\t\t//\t`clearing source sub ${clearSub.source.name} <-> ${clearSub.target.name} (${clearSub.name})`,\n\t\t\t//);\n\t\t\tif (previousSub === null) {\n\t\t\t\ttarget.firstSource = clearSub.nextSource;\n\t\t\t} else {\n\t\t\t\tpreviousSub.nextSource = clearSub.nextSource;\n\t\t\t}\n\n\t\t\t// Update the targets list too\n\t\t\tif (clearSub.previousTarget === null) {\n\t\t\t\tif (clearSub.source.firstTarget === clearSub) {\n\t\t\t\t\tclearSub.source.firstTarget = clearSub.nextTarget;\n\t\t\t\t}\n\t\t\t\t// TODO: else???\n\t\t\t} else {\n\t\t\t\tclearSub.previousTarget.nextTarget = clearSub.nextTarget;\n\t\t\t}\n\t\t} else {\n\t\t\tclearSub.recalc = false;\n\t\t\tpreviousSub = clearSub;\n\t\t}\n\t}\n}\n","import type Computed from \"../types/Computed\";\nimport type Effect from \"../types/Effect\";\nimport type Subscription from \"../types/Subscription\";\n\n/**\n * Sets source subscriptions to inactive for a Computed or Effect.\n */\nexport default function deactivateSources(target: Computed | Effect): void {\n\tfor (\n\t\tlet sourceSub: Subscription | null = target.firstSource;\n\t\tsourceSub !== null;\n\t\tsourceSub = sourceSub.nextSource\n\t) {\n\t\tsourceSub.active = false;\n\t\t//console.log(\n\t\t//\t`deactivating ${sourceSub.source.name} <-> ${sourceSub.target.name} (${sourceSub.name})`,\n\t\t//);\n\t}\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport type ProxySignal from \"../types/ProxySignal\";\nimport type Subscription from \"../types/Subscription\";\n\n/**\n * If there's an active target, subscribe it to this signal, so that it will be\n * run when the signal changes.\n */\nexport default function trackSignal(signal: ProxySignal | Computed): void {\n\tconst target = context.activeTarget;\n\tif (target !== null) {\n\t\tlet sub: Subscription | null = null;\n\t\tlet lastSub: Subscription | null = null;\n\n\t\t// Check if there's a sub we can re-use\n\t\t// TODO: Maybe we could be smarter with this\n\t\t// -- use the target sub instead?\n\t\t// -- do it differently on push vs pull??\n\t\tfor (\n\t\t\tlet nextSub: Subscription | null = signal.firstTarget;\n\t\t\tnextSub !== null;\n\t\t\tnextSub = nextSub.nextTarget\n\t\t) {\n\t\t\tlastSub = nextSub;\n\t\t\tif (nextSub.target === target) {\n\t\t\t\tsub = nextSub;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (sub === null) {\n\t\t\tsub = {\n\t\t\t\tsource: signal,\n\t\t\t\ttarget: target,\n\t\t\t\tpreviousTarget: lastSub,\n\t\t\t\tnextTarget: null,\n\t\t\t\tnextSource: null,\n\t\t\t\tactive: true,\n\t\t\t\trecalc: false,\n\t\t\t\t//name: dev.subName(),\n\t\t\t};\n\t\t\t//console.log(`creating sub '${signal.name}' => '${effect.name}' (${sub.name})`);\n\t\t\tif (lastSub === null) {\n\t\t\t\tsignal.firstTarget = sub;\n\t\t\t} else {\n\t\t\t\tlastSub.nextTarget = sub;\n\t\t\t}\n\n\t\t\tif (target.firstSource === null) {\n\t\t\t\ttarget.firstSource = sub;\n\t\t\t} else {\n\t\t\t\tlet lastEffectSub = target.firstSource;\n\t\t\t\tfor (\n\t\t\t\t\tlet nextSub: Subscription | null = lastEffectSub.nextSource;\n\t\t\t\t\tnextSub !== null;\n\t\t\t\t\tnextSub = nextSub.nextSource\n\t\t\t\t) {\n\t\t\t\t\tlastEffectSub = nextSub;\n\t\t\t\t}\n\t\t\t\tlastEffectSub.nextSource = sub;\n\t\t\t}\n\t\t} else {\n\t\t\t// We can re-use this subscription object\n\t\t\t//console.log(`re-using sub '${signal.name}' => '${effect.name}' (${sub.name})`);\n\t\t\tsub.active = true;\n\t\t}\n\t}\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport trackSignal from \"./trackSignal\";\n\nexport default function runComputed<T>(computed: Computed<T>): T {\n\t//console.log(`running computed '${computed.name}'`);\n\n\t// Store the active target\n\tconst oldActiveTarget = context.activeTarget;\n\n\tcomputed.running = true;\n\tcomputed.didError = false;\n\n\ttry {\n\t\t// Set the active target, so that any properties accessed while running it\n\t\t// will trigger it in future\n\t\tcontext.activeTarget = computed;\n\n\t\t// Run the computed and gather its dependencies\n\t\tcomputed.value = computed.run();\n\t} catch (err) {\n\t\tcomputed.didError = true;\n\t\t// @ts-ignore\n\t\tcomputed.value = err;\n\t\tthrow err;\n\t} finally {\n\t\t// Set the active target back to what it was previously\n\t\tcontext.activeTarget = oldActiveTarget;\n\n\t\tcomputed.running = false;\n\t}\n\n\ttrackSignal(computed);\n\n\treturn computed.value;\n}\n","import type Computed from \"../types/Computed\";\nimport type Subscription from \"../types/Subscription\";\nimport checkSources from \"./checkSources\";\nimport clearSources from \"./clearSources\";\nimport deactivateSources from \"./deactivateSources\";\nimport runComputed from \"./runComputed\";\n\n/**\n * Checks whether a Computed value should be re-run (which will be true if any\n * of its sources have changed) and re-runs it if necessary.\n */\nexport default function checkComputed(computed: Computed): boolean {\n\tlet rerun = checkSources(computed);\n\n\tlet changed = false;\n\n\tif (rerun) {\n\t\t// Set source subscriptions to inactive\n\t\tdeactivateSources(computed);\n\n\t\t// Run the computed, which will reset subscriptions\n\t\tconst oldValue = computed.value;\n\t\trunComputed(computed);\n\t\tchanged = computed.value !== oldValue;\n\n\t\t// Clear unused source subscriptions\n\t\tclearSources(computed);\n\t}\n\n\tcomputed.recalc = false;\n\n\t// If it hasn't changed, all of its target subscriptions remain active and\n\t// don't need to be recalculated\n\tif (!changed) {\n\t\tfor (\n\t\t\tlet targetSub: Subscription | null = computed.firstTarget;\n\t\t\ttargetSub !== null;\n\t\t\ttargetSub = targetSub.nextTarget\n\t\t) {\n\t\t\ttargetSub.active = true;\n\t\t\ttargetSub.recalc = false;\n\t\t}\n\t}\n\n\treturn changed;\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport type Effect from \"../types/Effect\";\nimport type Subscription from \"../types/Subscription\";\nimport { COMPUTED_TYPE, SIGNAL_TYPE } from \"../types/constants\";\nimport checkComputed from \"./checkComputed\";\n\n// RECURSIVE\n\n/**\n * Checks whether a Computed or Effect should be re-run (which will be true if\n * any of its sources have changed).\n */\nexport default function checkSources(target: Computed | Effect): boolean {\n\t// NOTE: We bail early if we know the target needs to be re-run; subsequent\n\t// computed values will be computed in the proxy getter\n\n\t// Check signals first as it's cheap, then computed values\n\tlet haveComputed = false;\n\n\tfor (\n\t\tlet sourceSub: Subscription | null = target.firstSource;\n\t\tsourceSub !== null;\n\t\tsourceSub = sourceSub.nextSource\n\t) {\n\t\t//console.log(`checking source sub '${sourceSub.source.name}' (${sourceSub.name})`);\n\t\tif (sourceSub.recalc) {\n\t\t\tif (sourceSub.source.type === SIGNAL_TYPE) {\n\t\t\t\treturn true;\n\t\t\t} /* else if (sourceSub.source.type === COMPUTED_TYPE) */ else {\n\t\t\t\tif (sourceSub.source.recalc) {\n\t\t\t\t\thaveComputed = true;\n\t\t\t\t} else {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (haveComputed) {\n\t\tfor (\n\t\t\tlet sourceSub: Subscription | null = target.firstSource;\n\t\t\tsourceSub !== null;\n\t\t\tsourceSub = sourceSub.nextSource\n\t\t) {\n\t\t\t//console.log(`checking source sub '${sourceSub.source.name}' (${sourceSub.name})`);\n\t\t\tif (sourceSub.recalc && sourceSub.source.type === COMPUTED_TYPE && sourceSub.source.recalc) {\n\t\t\t\tconst oldActiveTarget = context.activeTarget;\n\t\t\t\tcontext.activeTarget = target;\n\n\t\t\t\tconst recalc = checkComputed(sourceSub.source);\n\n\t\t\t\tcontext.activeTarget = oldActiveTarget;\n\n\t\t\t\tif (recalc) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}\n","import context from \"../render/context\";\nimport type Effect from \"../types/Effect\";\nimport clearSources from \"./clearSources\";\n\n/**\n * Runs cleanup functions for the effect and its children.\n */\nexport default function runCleanups(effect: Effect): void {\n\tlet effectToClean: Effect | null = effect;\n\tfor (let i = 0; i < effect.extent; i++) {\n\t\tif (typeof effectToClean.cleanup === \"function\") {\n\t\t\t//console.log(`cleaning effect '${effectToClean.name}'`);\n\t\t\tconst oldActiveTarget = context.activeTarget;\n\t\t\tcontext.activeTarget = null;\n\n\t\t\ttry {\n\t\t\t\teffectToClean.cleanup();\n\t\t\t} catch (err) {\n\t\t\t\teffectToClean.didError = true;\n\t\t\t\tclearSources(effectToClean);\n\t\t\t\tthrow err;\n\t\t\t} finally {\n\t\t\t\teffectToClean.cleanup = undefined;\n\t\t\t\tcontext.activeTarget = oldActiveTarget;\n\t\t\t}\n\t\t}\n\n\t\tconst nextEffect: Effect = effectToClean.nextEffect!;\n\n\t\t// If it's a child effect that has been triggered, clean it up\n\t\t// and remove it from the list of effects to run (it may get\n\t\t// re-created with the parent)\n\t\tif (i !== 0 && effect.nextEffectToRun === effectToClean) {\n\t\t\teffect.nextEffectToRun = effectToClean.nextEffectToRun;\n\t\t\teffectToClean.nextEffect = effectToClean.nextEffectToRun = null;\n\t\t}\n\n\t\teffectToClean = nextEffect;\n\t}\n}\n","import type Effect from \"../types/Effect\";\nimport checkSources from \"./checkSources\";\nimport clearSources from \"./clearSources\";\nimport deactivateSources from \"./deactivateSources\";\nimport runCleanups from \"./runCleanups\";\nimport runEffect from \"./runEffect\";\n\n/**\n * Checks whether an Effect should be re-run (which will be true if any\n * of its sources have changed) and re-runs it if necessary.\n */\nexport default function checkEffect(effect: Effect): void {\n\t//console.log(`checking effect '${effect.name}'`);\n\n\tlet rerun = checkSources(effect);\n\n\tif (rerun) {\n\t\t//console.log(`running effect '${String(effect.run)}'`);\n\n\t\t// Run cleanup functions for the effect and its children\n\t\trunCleanups(effect);\n\n\t\t// Set source subscriptions to inactive\n\t\tdeactivateSources(effect);\n\n\t\t// Run the effect, which will reset subscriptions\n\t\trunEffect(effect);\n\n\t\t// Clear unused source subscriptions\n\t\tclearSources(effect);\n\t}\n}\n","import type Computed from \"../types/Computed\";\nimport type ProxySignal from \"../types/ProxySignal\";\nimport type Subscription from \"../types/Subscription\";\n\n/**\n * Clear unused target subscriptions after all Effects have been run.\n */\nexport default function clearTargets(source: ProxySignal | Computed): void {\n\tlet previousSub: Subscription | null = null;\n\tfor (\n\t\tlet clearSub: Subscription | null = source.firstTarget;\n\t\tclearSub !== null;\n\t\tclearSub = clearSub.nextTarget\n\t) {\n\t\tif (!clearSub.active) {\n\t\t\t//console.log(\n\t\t\t//\t`clearing target sub ${clearSub.source.name} <-> ${clearSub.target.name} (${clearSub.name})`,\n\t\t\t//);\n\t\t\tif (previousSub === null) {\n\t\t\t\tsource.firstTarget = clearSub.nextTarget;\n\t\t\t} else {\n\t\t\t\tpreviousSub.nextTarget = clearSub.nextTarget;\n\t\t\t}\n\t\t} else {\n\t\t\tpreviousSub = clearSub;\n\t\t}\n\t}\n}\n","import context from \"../render/context\";\nimport type Effect from \"../types/Effect\";\nimport type ProxySignal from \"../types/ProxySignal\";\nimport checkEffect from \"./checkEffect\";\nimport clearTargets from \"./clearTargets\";\n\n/**\n * Runs the effects that have been collected during the batch.\n */\nexport default function triggerEffects(): void {\n\t//console.log(`triggering effects for '${String(key)}' on`, proxy);\n\t//console.log(\"===\");\n\t//console.log(`triggering effects for '${String(key)}'`);\n\n\tlet didError = false;\n\tlet error: any;\n\n\t// Run the effects\n\tlet effect: Effect | null = context.firstEffectToRun;\n\twhile (effect !== null) {\n\t\tcontext.batchOperation++;\n\n\t\ttry {\n\t\t\tcheckEffect(effect);\n\t\t} catch (err) {\n\t\t\tif (!didError) {\n\t\t\t\tdidError = true;\n\t\t\t\terror = err;\n\t\t\t}\n\t\t}\n\n\t\teffect = effect.nextEffectToRun;\n\t}\n\n\t// Clear the effects\n\teffect = context.firstEffectToRun;\n\tcontext.firstEffectToRun = null;\n\twhile (effect !== null) {\n\t\tlet nextEffect = effect.nextEffectToRun;\n\t\teffect.nextEffectToRun = null;\n\t\teffect = nextEffect;\n\t}\n\n\t// Clear unused target subscriptions for the signals that were updated\n\t// during the batch\n\tlet signal: ProxySignal | null = context.firstSignalToUpdate;\n\tcontext.firstSignalToUpdate = null;\n\twhile (signal !== null) {\n\t\tclearTargets(signal);\n\n\t\tconst nextSignal = signal.nextSignalToUpdate;\n\t\tsignal.nextSignalToUpdate = null;\n\t\tsignal = nextSignal;\n\t}\n\n\tif (didError) {\n\t\tthrow error;\n\t}\n}\n","import context from \"../render/context\";\nimport triggerEffects from \"./triggerEffects\";\n\nexport default function batchEnd(): void {\n\tif (context.batch > 1) {\n\t\tcontext.batch--;\n\t\treturn;\n\t}\n\n\ttry {\n\t\ttriggerEffects();\n\t} finally {\n\t\tcontext.batch = 0;\n\t\tcontext.batchOperation = 0;\n\t\tcontext.previousEffect = null;\n\t}\n}\n","import context from \"../render/context\";\n\nexport default function batchStart(): void {\n\tcontext.batch++;\n}\n","import devContext from \"../dev/devContext\";\nimport context from \"../render/context\";\nimport type Effect from \"../types/Effect\";\nimport batchEnd from \"./batchEnd\";\nimport batchStart from \"./batchStart\";\nimport clearSources from \"./clearSources\";\n\nexport default function runEffect(effect: Effect): void {\n\t//console.log(`running effect '${effect.name}'`);\n\n\t// DEV:\n\tdevContext.effectRun(effect);\n\n\t// Store the active target\n\tconst oldActiveTarget = context.activeTarget;\n\tconst oldExtent = context.extent;\n\n\teffect.didError = false;\n\n\tbatchStart();\n\n\ttry {\n\t\t// Set the next effect for navigating through\n\t\tif (context.previousEffect !== null) {\n\t\t\tcontext.previousEffect.nextEffect = effect;\n\t\t}\n\n\t\t// Set the active effect, so that any properties accessed while running it\n\t\t// will trigger it in future\n\t\tcontext.activeTarget = effect;\n\t\tcontext.previousEffect = effect;\n\t\tcontext.extent = 1;\n\n\t\t// Run the effect to register its subscriptions and get its (optional)\n\t\t// cleanup function\n\t\teffect.cleanup = effect.run();\n\n\t\teffect.extent = context.extent;\n\t} catch (err) {\n\t\teffect.didError = true;\n\t\tclearSources(effect);\n\t\tthrow err;\n\t} finally {\n\t\t// Set the active target back to what it was previously\n\t\tcontext.activeTarget = oldActiveTarget;\n\t\tcontext.extent += oldExtent - 1;\n\n\t\tbatchEnd();\n\t}\n}\n","import devContext from \"../dev/devContext\";\nimport type Cleanup from \"../types/Cleanup\";\nimport type Effect from \"../types/Effect\";\nimport { EFFECT_TYPE } from \"../types/constants\";\nimport runEffect from \"./runEffect\";\n\n// TODO: Take a pipeline of operators e.g. debounce\n\n/**\n * Runs and re-runs a function that depends on a watched object\n *\n * @param fn The function to run, which may return a cleanup function.\n */\nexport default function $run(fn: () => Cleanup | void, name?: string): Effect {\n\tlet effect: Effect = {\n\t\ttype: EFFECT_TYPE,\n\t\trun: fn,\n\t\tcleanup: undefined,\n\t\tfirstSource: null,\n\t\tnextEffect: null,\n\t\textent: 0,\n\t\tnextEffectToRun: null,\n\t\tdidError: false,\n\t\tname,\n\t};\n\n\t// DEV:\n\tdevContext.onRun(effect);\n\n\trunEffect(effect);\n\n\treturn effect;\n}\n","import context from \"./context\";\n\n/**\n * Adds an animation for an element\n * @param el The element to animate\n * @param enter Whether the animation is being run on enter\n * @param keyframes The Web Animation API keyframes\n * @param options The Web Animmation API options\n */\nexport default async function animate(\n\tel: HTMLElement,\n\tenter: boolean,\n\tkeyframes: Keyframe[] | PropertyIndexedKeyframes | null,\n\toptions?: number | KeyframeAnimationOptions,\n): Promise<void> {\n\t// This is quite simplistic\n\t// We might need to\n\t// - store the animation\n\t// - reverse it if it's running and the region appears/disappears\n\t// - transfer the animation to the new element\n\tlet animationOptions = Object.assign(\n\t\t{\n\t\t\tdirection: enter ? \"normal\" : \"reverse\",\n\t\t\t// TODO: Should probably have a global setting for these somewhere\n\t\t\t// And respect browser reduce motion settings\n\t\t\tduration: 300,\n\t\t\teasing: \"ease-in-out\",\n\t\t\tfill: \"forwards\",\n\t\t},\n\t\toptions,\n\t);\n\n\tconst animation = el.animate(keyframes, animationOptions);\n\n\t// HACK: I'm not entirely sure why we need to sent the animation's timeline,\n\t// but without it, animations never start\n\t// HACK: We also need to make sure the element has been added to the DOM\n\t// with a timeout\n\tsetTimeout(() => {\n\t\tanimation.timeline = el.ownerDocument.timeline;\n\t}, 1);\n\n\t// Add the animation to the active region, so that the region won't be cleared\n\t// until the animation is completed\n\tconst activeRegion = context.activeRegion;\n\t// TODO: An option for whether to await or cancel events on region remove\n\t// e.g. if you are doing a client side navigation, you don't want to run animations\n\tactiveRegion.animations ??= new Set();\n\tactiveRegion.animations.add(animation);\n\n\tawait animation.finished;\n}\n","export default function isFragmentNode(node: Node): node is DocumentFragment {\n\treturn node.nodeType === 11;\n}\n","import $run from \"../watch/$run\";\nimport animate from \"./animate\";\nimport context from \"./context\";\nimport isFragmentNode from \"./isFragmentNode\";\n\nexport default function addFragment(\n\tfragment: DocumentFragment,\n\tparent: ParentNode,\n\tbefore: Node | null,\n\tendNode?: ChildNode,\n): void {\n\t//console.log(`adding fragment '${fragment.textContent}' to `, parent);\n\t//console.log(\"before\", before);\n\n\tconst activeRegion = context.activeRegion;\n\tconst hydrationNode = context.hydrationNode;\n\n\t// Set the active region's end node to the last node in the fragment\n\tif (hydrationNode !== null) {\n\t\tactiveRegion.endNode = endNode ?? hydrationNode;\n\t} else {\n\t\tactiveRegion.startNode = fragment.firstChild;\n\t\tactiveRegion.endNode = fragment.lastChild;\n\t}\n\n\tparent = before?.parentNode ?? parent;\n\n\t// Add the fragment\n\tif (hydrationNode === null) {\n\t\tparent.insertBefore(fragment, before);\n\t}\n\n\t// If we're adding this fragment to the DOM, we can now run any $mount\n\t// effects, add our stashed events and play our stashed animations\n\tif (!isFragmentNode(parent)) {\n\t\t// Only run $mount effects if not hydrating (if hydrating, they will get\n\t\t// run at the end when everything is hooked up)\n\t\tif (hydrationNode === null) {\n\t\t\tfor (let effect of context.mountEffects) {\n\t\t\t\t$run(effect);\n\t\t\t}\n\t\t\tcontext.mountEffects.length = 0;\n\t\t}\n\n\t\t// Set the active region for each event so it will get attached to the\n\t\t// right one and set it back afterwards\n\t\tif (context.stashedEvents.length > 0) {\n\t\t\tconst events = [...context.stashedEvents];\n\t\t\t$run(function addFragmentEvents() {\n\t\t\t\tfor (let event of events) {\n\t\t\t\t\tevent.el.addEventListener(event.type, event.listener);\n\t\t\t\t}\n\t\t\t\treturn () => {\n\t\t\t\t\tfor (let event of events) {\n\t\t\t\t\t\tevent.el.removeEventListener(event.type, event.listener);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t});\n\t\t\tcontext.stashedEvents.length = 0;\n\t\t}\n\n\t\t// Set the active region for each animation so it will get attached to\n\t\t// the right one and set it back afterwards\n\t\t// Don't await animations\n\t\tfor (let animation of context.stashedAnimations) {\n\t\t\tcontext.activeRegion = animation.region;\n\t\t\t$run(function addFragmentAnimation() {\n\t\t\t\tif (animation.in !== undefined) {\n\t\t\t\t\t// eslint-disable-next-line no-floating-promises\n\t\t\t\t\tanimate(animation.el, true, animation.in.keyframes, animation.in.options);\n\t\t\t\t}\n\t\t\t\tif (animation.out !== undefined) {\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\t// eslint-disable-next-line no-floating-promises\n\t\t\t\t\t\tanimate(animation.el, false, animation.out!.keyframes, animation.out!.options);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tcontext.stashedAnimations.length = 0;\n\n\t\t// Set the active region back\n\t\tcontext.activeRegion = activeRegion;\n\t}\n}\n","import $run from \"../watch/$run\";\n\nexport default function applyProps(\n\tel: Element,\n\tprops: Record<string, any> | undefined,\n\tpropNamesUsed: string[],\n): void {\n\tif (props !== undefined) {\n\t\tfor (let [name, value] of Object.entries(props)) {\n\t\t\tif (!propNamesUsed.includes(name)) {\n\t\t\t\tif (name.startsWith(\"on\")) {\n\t\t\t\t\tconst eventName = name.substring(2);\n\t\t\t\t\tel.addEventListener(eventName, value);\n\t\t\t\t} else {\n\t\t\t\t\t$run(function setAttribute() {\n\t\t\t\t\t\tel.setAttribute(name, value);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import devContext from \"../dev/devContext\";\nimport type Region from \"../types/Region\";\n\nexport default function clearRegion(region: Region): void {\n\t//console.log(\"clearing region\", region.name, \"from\", region.startNode, \"to\", region.endNode);\n\n\t// DEV:\n\tdevContext.onRegionCleared(region);\n\n\t// Clear child regions and collect animations that take place within this\n\t// region and its children\n\tlet animations: Animation[] | undefined =\n\t\tregion.animations !== null ? Array.from(region.animations) : undefined;\n\tlet childRegion = region.nextRegion;\n\twhile (childRegion !== null && childRegion.depth > region.depth) {\n\t\tif (childRegion.animations !== null) {\n\t\t\tanimations ??= [];\n\t\t\tanimations.push(...childRegion.animations);\n\t\t}\n\t\treleaseRegion(childRegion);\n\t\t// HACK: see runControlBranch\n\t\tchildRegion.depth = -2;\n\t\tchildRegion = childRegion.nextRegion;\n\t}\n\tregion.nextRegion = childRegion;\n\n\tif (region.previousRegion !== null) {\n\t\tregion.previousRegion.nextRegion = region.nextRegion;\n\t}\n\tif (region.nextRegion !== null) {\n\t\tregion.nextRegion.previousRegion = region.previousRegion;\n\t}\n\n\t// Wait for animations, if any, then clear the region's nodes\n\tif (animations !== undefined) {\n\t\tanimations.forEach((a) => {\n\t\t\ta.reverse();\n\t\t\ta.play();\n\t\t});\n\t\t// eslint-disable-next-line no-floating-promises\n\t\tPromise.all(animations.map((a) => a.finished)).then(() => clearNodes(region));\n\t} else {\n\t\tclearNodes(region);\n\t}\n}\n\nfunction clearNodes(region: Region) {\n\t// Clear the nodes for this region\n\tif (region.startNode !== null && region.endNode !== null) {\n\t\tlet currentNode = region.endNode;\n\t\t// DEBUG:\n\t\t//if (region.startNode.parentNode !== currentNode.parentNode) {\n\t\t//\tthrow new Error(\"region nodes have different parents\");\n\t\t//}\n\t\twhile (currentNode !== region.startNode) {\n\t\t\tlet previousNode = currentNode.previousSibling;\n\t\t\tcurrentNode.remove();\n\t\t\tcurrentNode = previousNode!;\n\t\t}\n\t\tcurrentNode.remove();\n\t}\n\treleaseRegion(region);\n}\n\nfunction releaseRegion(region: Region) {\n\tregion.startNode = null;\n\tregion.endNode = null;\n\tregion.previousRegion = null;\n\tregion.nextRegion = null;\n\tregion.animations = null;\n}\n","import type Region from \"../types/Region\";\nimport clearRegion from \"./clearRegion\";\nimport context from \"./context\";\n\nexport default function clearLayoutSlot(region: Region): void {\n\tcontext.previousRegion = region.previousRegion!;\n\tclearRegion(region);\n}\n","import type Region from \"../types/Region\";\n\nexport default function newRegion(name?: string): Region {\n\treturn {\n\t\tstartNode: null,\n\t\tendNode: null,\n\t\tpreviousRegion: null,\n\t\tnextRegion: null,\n\t\tdepth: -1,\n\t\tanimations: null,\n\t\tname,\n\t};\n}\n","import devContext from \"../dev/devContext\";\nimport type Region from \"../types/Region\";\nimport context from \"./context\";\n\nexport default function popRegion(oldRegion: Region): void {\n\tcontext.activeRegion = oldRegion;\n\n\tdevContext.onRegionPopped();\n}\n","import devContext from \"../dev/devContext\";\nimport type Region from \"../types/Region\";\nimport context from \"./context\";\n\nexport default function pushRegion(region: Region, toParent = false): Region {\n\tconst activeRegion = context.activeRegion;\n\n\t// Add the new region to the currently active region's children, so that we\n\t// can delete the children with the parent\n\tif (toParent) {\n\t\tconst previousRegion = context.previousRegion;\n\t\tregion.previousRegion = previousRegion;\n\n\t\tconst nextRegion = previousRegion.nextRegion;\n\t\tpreviousRegion.nextRegion = region;\n\t\tregion.nextRegion = nextRegion;\n\n\t\tregion.depth = activeRegion.depth + 1;\n\t}\n\n\t// Set the new active region\n\tcontext.activeRegion = region;\n\tcontext.previousRegion = region;\n\n\t// DEV:\n\tdevContext.onRegionPushed(region, toParent);\n\n\t// Return the old active region, so that it can be reset when done\n\treturn activeRegion;\n}\n","import devContext from \"../dev/devContext\";\nimport type Component from \"../types/Component\";\nimport type Region from \"../types/Region\";\nimport type SlotRender from \"../types/SlotRender\";\nimport newRegion from \"./newRegion\";\nimport popRegion from \"./popRegion\";\nimport pushRegion from \"./pushRegion\";\n\nexport default function fillLayoutSlot(\n\tcomponent: Component,\n\tslot: SlotRender,\n\tparent: ParentNode,\n\tanchor: Node | null,\n\t$props?: Record<string, string>,\n\t$context?: Record<PropertyKey, any>,\n): Region {\n\tconst region = newRegion(devContext.enabled ? \"Layout slot\" : undefined);\n\tconst oldRegion = pushRegion(region, true);\n\n\tcomponent(parent, anchor, $props, $context, {\n\t\t_: slot,\n\t});\n\n\tpopRegion(oldRegion);\n\n\treturn region;\n}\n","export default function getFragment(\n\tdocument: Document,\n\tarray: DocumentFragment[],\n\tindex: number,\n\thtml: string,\n\tns?: boolean,\n): DocumentFragment {\n\t// Create the fragment in the array if it hasn't yet been used\n\tif (array[index] === undefined) {\n\t\t// TODO: Should pass a string for the ns, when we support other element types\n\t\tif (ns === true) {\n\t\t\tconst template = document.createElementNS(\"http://www.w3.org/2000/svg\", \"template\");\n\t\t\ttemplate.innerHTML = html;\n\t\t\tconst fragment = new DocumentFragment();\n\t\t\tfragment.append(...template.childNodes);\n\t\t\tarray[index] = fragment;\n\t\t} else {\n\t\t\tconst template = document.createElement(\"template\");\n\t\t\ttemplate.innerHTML = html;\n\t\t\tarray[index] = template.content;\n\t\t}\n\t}\n\n\t// Get the fragment from the array\n\t// TODO: If we're hydrating we probably don't want to create and return a\n\t// fragment unless we really need to\n\tlet fragment = array[index].cloneNode(true) as DocumentFragment;\n\n\treturn fragment;\n}\n","import devContext from \"../dev/devContext\";\nimport type Component from \"../types/Component\";\nimport type SlotRender from \"../types/SlotRender\";\nimport $run from \"../watch/$run\";\nimport context from \"./context\";\nimport newRegion from \"./newRegion\";\nimport pushRegion from \"./pushRegion\";\n\n/**\n * Hydrates a component into an existing DOM tree\n * @param parent The parent node\n * @param component The component to mount\n * @param props An object containing component props\n */\nexport default function hydrate(\n\tparent: ParentNode,\n\tcomponent: Component,\n\tprops?: Record<string, any>,\n\tslots?: Record<string, SlotRender>,\n): void {\n\t// When mounting, the parent must have no child elements, so we can just set\n\t// the hydration node to the first child node\n\tcontext.hydrationNode = parent.firstChild;\n\n\t// Create and push the root region\n\t// TODO: Does it need to be on context??\n\tcontext.rootRegion = newRegion(devContext.enabled ? \"Root\" : undefined);\n\tcontext.previousRegion = context.rootRegion;\n\tpushRegion(context.rootRegion);\n\n\t// Call the component's render function\n\tcomponent(parent, null, props, undefined, slots);\n\n\tcontext.hydrationNode = null;\n\n\t// Now that we've hydrated, we can run $mount effects\n\tfor (let effect of context.mountEffects) {\n\t\t$run(effect);\n\t}\n\tcontext.mountEffects.length = 0;\n}\n","import devContext from \"../dev/devContext\";\nimport type Component from \"../types/Component\";\nimport type SlotRender from \"../types/SlotRender\";\nimport context from \"./context\";\nimport newRegion from \"./newRegion\";\nimport pushRegion from \"./pushRegion\";\n\n/**\n * Mounts a component into a DOM node\n *\n * @param parent The node to mount the component into\n * @param component The component to mount\n * @param props An object containing component props\n */\nexport default function mount(\n\tparent: ParentNode,\n\tcomponent: Component,\n\tprops?: Record<string, any>,\n\tslots?: Record<string, SlotRender>,\n): void {\n\t// The parent node must have no child elements, so that we can hydrate\n\t// without worrying about where to start\n\tif (parent.childElementCount > 0) {\n\t\tthrow new Error(\"The parent node must have no child elements\");\n\t}\n\n\t// Remove all text, commments, etc\n\twhile (parent.firstChild !== null) {\n\t\tparent.firstChild.remove();\n\t}\n\n\t// Create and push the root region\n\tif (context.rootRegion === null) {\n\t\tcontext.rootRegion = newRegion(devContext.enabled ? \"Root\" : undefined);\n\t\tcontext.previousRegion = context.rootRegion;\n\t\tpushRegion(context.rootRegion);\n\t}\n\n\t// Call the component's render function\n\tcomponent(parent, null, props, undefined, slots);\n}\n","import type ListItem from \"../types/ListItem\";\n\nexport default function newListItem(\n\tdata: Record<PropertyKey, any>,\n\tkey?: any,\n\tname?: string,\n): ListItem {\n\treturn {\n\t\tstartNode: null,\n\t\tendNode: null,\n\t\tpreviousRegion: null,\n\t\tnextRegion: null,\n\t\tdepth: -1,\n\t\tanimations: null,\n\t\tname,\n\t\tdata,\n\t\tkey,\n\t};\n}\n","const HYDRATION_START = \"[\";\nconst HYDRATION_END = \"]\";\nconst HYDRATION_BREAK = \"^\";\n\nexport { HYDRATION_START, HYDRATION_END, HYDRATION_BREAK };\n","export default function isCommentNode(node: Node): node is Comment {\n\treturn node.nodeType === 8;\n}\n","export default function isTextNode(node: Node): node is Text {\n\treturn node.nodeType === 3;\n}\n","import context from \"./context\";\nimport { HYDRATION_BREAK } from \"./hydrationMarkers\";\nimport isCommentNode from \"./isCommentNode\";\n\n// TODO: It would be good to remove this, if possible\n\n/**\n * When hydrating, removes and skips hydration comments that are inserted at the\n * start of branches and used to split up text nodes that would otherwise be\n * joined in HTML.\n *\n * @param node The node to check and maybe skip.\n * @returns The next node.\n */\nexport default function nodeCheckHydrationBreak(node: ChildNode | null): ChildNode | null {\n\tif (context.hydrationNode !== null) {\n\t\tif (node !== null && isCommentNode(node) && node.data === HYDRATION_BREAK) {\n\t\t\tlet comment = node;\n\t\t\tnode = node.nextSibling;\n\t\t\tcomment.remove();\n\t\t}\n\t\tcontext.hydrationNode = node;\n\t}\n\treturn node;\n}\n","import context from \"./context\";\nimport isTextNode from \"./isTextNode\";\nimport nodeCheckHydrationBreak from \"./nodeCheckHydrationBreak\";\n\n/**\n * Gets the next sibling of a node.\n *\n * When hydrating, sets the hydration node.\n *\n * @param node The node.\n * @param text Whether we require a text node.\n */\nexport default function nodeNext(node: ChildNode, text = false): ChildNode {\n\t// If the required node is a text node, and we already have one, just use\n\t// it. This is caused by text nodes being merged in HTML\n\tif (context.hydrationNode !== null && text && isTextNode(node)) {\n\t\treturn node;\n\t}\n\n\tlet nextNode = nodeCheckHydrationBreak(node.nextSibling);\n\n\t// NOTE: We know this is not null as it is being called from generated code\n\treturn nextNode!;\n}\n","import context from \"./context\";\nimport { HYDRATION_END, HYDRATION_START } from \"./hydrationMarkers\";\nimport isCommentNode from \"./isCommentNode\";\nimport nodeNext from \"./nodeNext\";\n\n/**\n * Gets the anchor node for a control statement or component.\n *\n * When mounting, this just returns the anchor node parameter (because it was\n * created).\n *\n * When hydrating, there should be matched <![> and <!]> comments in the HTML,\n * and the anchor node should be after the end comment. The matched comment\n * nodes will be deleted, and the hydration node set to the first node inside\n * the matched comments.\n *\n * @param node The potential anchor node.\n * @returns The anchor node.\n */\nexport default function nodeAnchor(node: ChildNode): ChildNode {\n\tif (context.hydrationNode !== null) {\n\t\tif (isCommentNode(node) && node.data === HYDRATION_START) {\n\t\t\t// Skip and remove the start node, setting the hydration node in\n\t\t\t// nodeNext\n\t\t\tlet currentNode = nodeNext(node);\n\t\t\tnode.remove();\n\n\t\t\t// Go through siblings until we get to the end\n\t\t\tlet level = 1;\n\t\t\twhile (currentNode !== null) {\n\t\t\t\tif (isCommentNode(currentNode)) {\n\t\t\t\t\tif (currentNode.data === HYDRATION_START) {\n\t\t\t\t\t\tlevel += 1;\n\t\t\t\t\t} else if (currentNode.data === HYDRATION_END) {\n\t\t\t\t\t\tlevel -= 1;\n\t\t\t\t\t\tif (level === 0) {\n\t\t\t\t\t\t\t// Remove the end node and return the next one\n\t\t\t\t\t\t\tconst endNode = currentNode.nextSibling;\n\t\t\t\t\t\t\tcurrentNode.remove();\n\n\t\t\t\t\t\t\t// If the statement is empty (i.e. the end comment\n\t\t\t\t\t\t\t// immediately follows the start comment), move the\n\t\t\t\t\t\t\t// hydration node past the removed end comment to\n\t\t\t\t\t\t\t// the anchor, so that we can continue to the next\n\t\t\t\t\t\t\t// nodes\n\t\t\t\t\t\t\tif (context.hydrationNode === currentNode) {\n\t\t\t\t\t\t\t\tcontext.hydrationNode = endNode;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// NOTE: We know this is not null as it is being\n\t\t\t\t\t\t\t// called from generated code\n\t\t\t\t\t\t\treturn endNode!;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcurrentNode = currentNode.nextSibling!;\n\t\t\t}\n\n\t\t\tif (currentNode === null) {\n\t\t\t\tthrow new Error(\"End hydration comment not found\");\n\t\t\t}\n\t\t}\n\t}\n\n\treturn node;\n}\n","import context from \"./context\";\n\n/**\n * Gets the first child of a node.\n *\n * Sets the hydration node.\n *\n * @param parent The parent node.\n */\nexport default function nodeChild(parent: Node): ChildNode {\n\tlet childNode = parent.firstChild;\n\tif (context.hydrationNode !== null) {\n\t\t// The child may be null when hydrating the sole text child of an\n\t\t// element with no text\n\t\tif (childNode === null) {\n\t\t\tchildNode = parent.appendChild(parent.ownerDocument!.createTextNode(\"\"));\n\t\t}\n\t\tcontext.hydrationNode = childNode;\n\t}\n\n\t// NOTE: We know this is not null as it is being called from generated code\n\treturn childNode!;\n}\n","import context from \"./context\";\nimport { HYDRATION_START } from \"./hydrationMarkers\";\nimport isCommentNode from \"./isCommentNode\";\nimport isTextNode from \"./isTextNode\";\n\n/**\n * Gets the first child in a fragment.\n *\n * When hydrating, also sets the active range's start node, while we have it.\n *\n * @param parent The parent of the fragment.\n * @param text Whether we require a text node.\n */\nexport default function nodeRoot(parent: Node, text = false): ChildNode {\n\tif (context.hydrationNode !== null) {\n\t\tlet rootNode = context.hydrationNode;\n\n\t\t// If the root node we need is a text node, and the hydration node is\n\t\t// not a text node but the previous node is, use the previous node. This\n\t\t// is caused by text nodes being merged in HTML\n\t\tif (\n\t\t\ttext &&\n\t\t\t!isTextNode(rootNode) &&\n\t\t\trootNode.previousSibling !== null &&\n\t\t\tisTextNode(rootNode.previousSibling)\n\t\t) {\n\t\t\trootNode = rootNode.previousSibling;\n\t\t\tcontext.hydrationNode = rootNode;\n\t\t}\n\n\t\t// HACK: If the root node is a hydration start comment node, get the\n\t\t// next one instead\n\t\tif (isCommentNode(rootNode) && rootNode.data === HYDRATION_START) {\n\t\t\trootNode = rootNode.nextSibling!;\n\t\t\tcontext.hydrationNode = rootNode;\n\t\t}\n\n\t\t// If hydrating, set the active range's start node\n\t\tconst region = context.activeRegion;\n\t\tif (region.startNode === null) {\n\t\t\tregion.startNode = rootNode;\n\t\t}\n\n\t\treturn rootNode;\n\t} else {\n\t\t// NOTE: We know this is not null as it is being called from generated\n\t\t// code\n\t\treturn parent.firstChild!;\n\t}\n}\n","import nodeCheckHydrationBreak from \"./nodeCheckHydrationBreak\";\n\n/**\n * Gets the sibling of a node, x nodes after it.\n *\n * When hydrating, sets the hydration node.\n *\n * @param node The node.\n * @param count The number of nodes to skip.\n */\nexport default function nodeSkip(node: ChildNode, count: number): ChildNode {\n\tlet nextNode = node;\n\n\tfor (let i = 0; i < count; i++) {\n\t\tnextNode = nodeCheckHydrationBreak(nextNode.nextSibling)!;\n\t}\n\n\t// NOTE: We know this is not null as it is being called from generated code\n\treturn nextNode!;\n}\n","import type Region from \"../types/Region\";\nimport $run from \"../watch/$run\";\nimport context from \"./context\";\nimport popRegion from \"./popRegion\";\nimport pushRegion from \"./pushRegion\";\n\n/**\n * Runs an `if`, `switch` or `await` control statement\n * @param create A function that creates the control statement's branches\n */\nexport default function runControl(\n\tregion: Region,\n\tanchor: Node | null,\n\tcreate: (anchor: Node | null) => void,\n): void {\n\tlet first = true;\n\n\t// Run the control statement in an effect\n\t$run(function runControl() {\n\t\tconst oldRegion = pushRegion(region, first);\n\t\tfirst = false;\n\n\t\t// Run the function that creates the control statement's branches\n\t\tcreate(anchor);\n\n\t\tpopRegion(oldRegion);\n\t});\n\n\t// If we're mounting, the anchor will be the one that is passed in, but if\n\t// we're hydrating it will be after the active branch's HTML elements, so we\n\t// need to update it after the branches have been hydrated\n\tif (context.hydrationNode) {\n\t\tanchor = context.hydrationNode.nextSibling;\n\t}\n}\n","import type Region from \"../types/Region\";\nimport clearRegion from \"./clearRegion\";\nimport newRegion from \"./newRegion\";\nimport popRegion from \"./popRegion\";\nimport pushRegion from \"./pushRegion\";\n\nexport default function runControlBranch(region: Region, create: () => void, name?: string): void {\n\t// HACK: This is bad -- it means that the parent region has been cleared,\n\t// but that should have cleared the effect that runs this child region??\n\t// TODO: Look into this further...\n\tif (region.depth === -2) return;\n\n\t// Branching regions have exactly one child -- remove it if necessary\n\tif (region.nextRegion !== null && region.nextRegion.depth > region.depth) {\n\t\tclearRegion(region.nextRegion!);\n\t}\n\n\tconst branchRegion = newRegion(name);\n\tconst oldRegion = pushRegion(branchRegion, true);\n\n\t// Run the create function\n\tcreate();\n\n\tpopRegion(oldRegion);\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport type ProxyData from \"../types/ProxyData\";\nimport type ProxySignal from \"../types/ProxySignal\";\nimport type Subscription from \"../types/Subscription\";\nimport { COMPUTED_TYPE, EFFECT_TYPE } from \"../types/constants\";\nimport batchEnd from \"./batchEnd\";\nimport batchStart from \"./batchStart\";\n\n/**\n * When a signal is changed, we need to\n * - Set the signal's subscriptions to recalc\n * - Set any dependent computed values to recalc\n * - Gather dependent effects that will need to be re-run\n */\nexport default function propagateSignal(proxy: ProxyData, key: PropertyKey): void {\n\t//console.log(`triggering effects for '${String(key)}' on`, proxy);\n\t//console.log(\"===\");\n\t//console.log(`triggering effects for '${String(key)}'`);\n\n\tlet signal = proxy.signals.get(key) as ProxySignal;\n\tif (signal !== undefined && signal.firstTarget !== null) {\n\t\tbatchStart();\n\n\t\ttry {\n\t\t\t// Add the signal to the context for updating after triggering\n\t\t\tif (context.firstSignalToUpdate === null) {\n\t\t\t\tcontext.firstSignalToUpdate = signal;\n\t\t\t} else if (signal.nextSignalToUpdate === null) {\n\t\t\t\tlet lastSignal = context.firstSignalToUpdate;\n\t\t\t\twhile (lastSignal.nextSignalToUpdate !== null) {\n\t\t\t\t\tlastSignal = lastSignal.nextSignalToUpdate;\n\t\t\t\t}\n\t\t\t\tlastSignal.nextSignalToUpdate = signal;\n\t\t\t}\n\n\t\t\t// Cache the last effect in the chain, so we don't have to keep\n\t\t\t// looping in cases where there are lots of them for this signal\n\t\t\tlet lastEffect = context.firstEffectToRun;\n\t\t\tif (lastEffect !== null) {\n\t\t\t\twhile (lastEffect.nextEffectToRun !== null) {\n\t\t\t\t\tlastEffect = lastEffect.nextEffectToRun;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// De-activate all targets, so they can be re-used/updated/deleted,\n\t\t\t// and mark them to be recalculated\n\t\t\tlet targetSub: Subscription = signal.firstTarget;\n\t\t\tlet computed: Computed | undefined;\n\t\t\touter: while (true) {\n\t\t\t\t// De-activate all targets, so they can be re-used/updated/deleted\n\t\t\t\ttargetSub.active = false;\n\t\t\t\ttargetSub.recalc = true;\n\n\t\t\t\tconst target = targetSub.target;\n\t\t\t\tif (target.type === EFFECT_TYPE) {\n\t\t\t\t\t// Add the effect to the context for running after triggering\n\t\t\t\t\tif (lastEffect === null) {\n\t\t\t\t\t\tcontext.firstEffectToRun = target;\n\t\t\t\t\t\tlastEffect = target;\n\t\t\t\t\t} else if (target.nextEffectToRun === null && lastEffect !== target) {\n\t\t\t\t\t\tlastEffect.nextEffectToRun = target;\n\t\t\t\t\t\tlastEffect = target;\n\t\t\t\t\t}\n\t\t\t\t} else if (/*target.type === COMPUTED_TYPE*/ !target.recalc) {\n\t\t\t\t\t// This may need to be re-computed in the pull phase\n\t\t\t\t\ttarget.recalc = true;\n\n\t\t\t\t\t// Check the computed's targets\n\t\t\t\t\tif (target.firstTarget !== null) {\n\t\t\t\t\t\tcomputed = target;\n\t\t\t\t\t\tcomputed.rollback = targetSub;\n\t\t\t\t\t\ttargetSub = target.firstTarget;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If there are no more targets, we may need to rollback to the\n\t\t\t\t// last computed that had more targets\n\t\t\t\twhile (targetSub.nextTarget === null && computed !== undefined) {\n\t\t\t\t\ttargetSub = computed.rollback!;\n\t\t\t\t\tif (targetSub.source.type !== COMPUTED_TYPE) {\n\t\t\t\t\t\tcomputed = undefined;\n\t\t\t\t\t\tcontinue outer;\n\t\t\t\t\t}\n\t\t\t\t\tcomputed = targetSub.source;\n\t\t\t\t}\n\n\t\t\t\tif (targetSub.nextTarget === null) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\ttargetSub = targetSub.nextTarget;\n\t\t\t}\n\t\t} finally {\n\t\t\tbatchEnd();\n\t\t}\n\t}\n}\n","// TODO: Should these be branded?\nconst proxyDataSymbol: unique symbol = Symbol(\"_proxy_data\");\nconst proxyHandledSymbol: unique symbol = Symbol(\"_proxy_handled\");\n\nexport { proxyDataSymbol, proxyHandledSymbol };\n","import type ProxyData from \"../types/ProxyData\";\nimport { SIGNAL_TYPE } from \"../types/constants\";\nimport trackSignal from \"./trackSignal\";\n\nexport default function trackProxySignal(data: ProxyData, key: PropertyKey): void {\n\t//console.log(`tracking effect '${context.activeTarget.name}' for '${String(key)}' prop`);\n\n\t// Create or get the signals\n\tlet signal = data.signals.get(key);\n\tif (signal === undefined) {\n\t\tsignal = {\n\t\t\ttype: SIGNAL_TYPE,\n\t\t\tfirstTarget: null,\n\t\t\tnextSignalToUpdate: null,\n\t\t\t//name: dev.propName(key),\n\t\t};\n\t\tdata.signals.set(key, signal);\n\t}\n\n\ttrackSignal(signal);\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport type ProxyData from \"../types/ProxyData\";\nimport { COMPUTED_TYPE, SIGNAL_TYPE } from \"../types/constants\";\nimport $watch from \"./$watch\";\nimport checkComputed from \"./checkComputed\";\nimport propagateSignal from \"./propagateSignal\";\nimport { proxyDataSymbol } from \"./symbols\";\nimport trackProxySignal from \"./trackProxySignal\";\nimport trackSignal from \"./trackSignal\";\n\nexport default function proxyGet(\n\ttarget: Record<PropertyKey, any>,\n\tkey: PropertyKey,\n\treceiver: any,\n): any {\n\tlet data: ProxyData = target[proxyDataSymbol];\n\n\tif (key === proxyDataSymbol) {\n\t\treturn data;\n\t}\n\n\t//console.log(`object get '${String(key)}' on`, target);\n\t//console.log(`object get '${String(key)}'`);\n\n\tlet signal = data.signals.get(key);\n\tif (signal === undefined) {\n\t\tconst propDescriptor = Object.getOwnPropertyDescriptor(target, key);\n\t\tif (propDescriptor !== undefined) {\n\t\t\tif (propDescriptor.writable) {\n\t\t\t\t// Setup data for the property\n\t\t\t\tif (data.shallow !== true) {\n\t\t\t\t\t// Set the value to a new proxy if it's an object\n\t\t\t\t\tconst value = target[key];\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue !== undefined &&\n\t\t\t\t\t\tvalue !== null &&\n\t\t\t\t\t\ttypeof value === \"object\" &&\n\t\t\t\t\t\tvalue[proxyDataSymbol] === undefined &&\n\t\t\t\t\t\t// But not if it's a Promise (i.e. has a `then` method)\n\t\t\t\t\t\tvalue.then === undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\ttarget[key] = $watch(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If a property is being accessed in the course of setting up an\n\t\t\t\t// effect, track it\n\t\t\t\ttrackProxySignal(data, key);\n\t\t\t} else if (propDescriptor.get) {\n\t\t\t\t// OK, we're only checking for computed values if it's read-only for\n\t\t\t\t// now, but we probably need to check any getter's value -- e.g. the\n\t\t\t\t// user may wish to add a setter to optimistically set a value, have\n\t\t\t\t// the UI update, then set the value concretely later (e.g. if\n\t\t\t\t// updating a `count` via a fetch)\n\n\t\t\t\tconst oldRegisterComputed = context.registerComputed;\n\t\t\t\ttry {\n\t\t\t\t\t// Allow calling `$cache` to assign the computed to a proxy\n\t\t\t\t\t// signal\n\t\t\t\t\tcontext.registerComputed = (computed: Computed) => {\n\t\t\t\t\t\tdata.signals.set(key, computed);\n\t\t\t\t\t};\n\t\t\t\t\treturn Reflect.get(target, key, receiver);\n\t\t\t\t} finally {\n\t\t\t\t\tcontext.registerComputed = oldRegisterComputed;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.isArray) {\n\t\t\t// If it's a function in an array, we may intercept it\n\t\t\tif (arrayWrapper[key] !== undefined) {\n\t\t\t\treturn arrayWrapper[key](data, target, key);\n\t\t\t}\n\t\t} else {\n\t\t\t// If it's a non-existent property we still set up a subscription so\n\t\t\t// that if its value is set to something it will re-run the effect\n\t\t\ttrackProxySignal(data, key);\n\t\t}\n\t} else if (signal.type === SIGNAL_TYPE) {\n\t\t// If a property is being accessed in the course of setting up an\n\t\t// effect, track it\n\t\ttrackProxySignal(data, key);\n\t} else if (signal.type === COMPUTED_TYPE) {\n\t\tif (signal.running) {\n\t\t\tthrow new Error(\"Cycle detected\");\n\t\t} else if (signal.recalc) {\n\t\t\t// If a signal that the computed depends on has been changed,\n\t\t\t// but the computed hasn't yet been read, it may need to be\n\t\t\t// re-computed\n\t\t\tcheckComputed(signal);\n\t\t} else if (signal.didError) {\n\t\t\t// If there was a previous error, and no dependencies have\n\t\t\t// changed, throw the error again\n\t\t\tthrow signal.value;\n\t\t} else {\n\t\t\ttrackSignal(signal);\n\t\t}\n\t\treturn signal.value;\n\t}\n\n\t// Return the property value\n\treturn Reflect.get(target, key, receiver);\n}\n\n// Prevent array functions from calling functions and properties in breakable\n// ways (e.g. calling splice sets length before adding items)\nconst arrayWrapper: Record<PropertyKey, any> = {\n\t[Symbol.iterator]: function (data: ProxyData, target: any, key: PropertyKey) {\n\t\ttrackProxySignal(data, \"length\");\n\t\t// HACK: This prevents lists being re-run on every random property\n\t\t// access by disabling the active effect before properties get\n\t\t// accessed. I'm not sure if this is the best way to achieve this...\n\t\tcontext.activeTarget = null;\n\t\treturn target[key];\n\t},\n\tpop: arrayHandle,\n\tpush: arrayHandle,\n\treverse: arrayHandle,\n\tshift: arrayHandle,\n\tsort: arrayHandle,\n\tsplice: arrayHandle,\n\tunshift: arrayHandle,\n};\n\nfunction arrayHandle(data: ProxyData, target: any, key: PropertyKey): Function {\n\t// Call the function on the target (so proxy properties don't get\n\t// intercepted) and trigger effects that depend on `length`\n\treturn function (...args: any[]) {\n\t\tconst func = target[key];\n\t\tconst result = func.apply(target, args);\n\t\tpropagateSignal(data, \"length\");\n\t\treturn result;\n\t};\n}\n","import devContext from \"../dev/devContext\";\nimport context from \"../render/context\";\nimport $watch from \"./$watch\";\n//import transferEffects from \"./transferEffects\";\nimport propagateSignal from \"./propagateSignal\";\nimport { proxyDataSymbol } from \"./symbols\";\n\nexport default function proxySet(\n\ttarget: Record<PropertyKey, any>,\n\tkey: PropertyKey,\n\tvalue: any,\n\treceiver: any,\n): boolean {\n\t//console.log(`object set '${String(key)}' to '`, value, `' on`, target);\n\t//console.log(`object set '${String(key)}'`);\n\n\t// Only do things if the value has changed\n\tconst oldValue = target[key];\n\tif (value !== oldValue) {\n\t\tif (context.batchOperation > 100) {\n\t\t\tthrow new Error(\"Cycle detected\");\n\t\t}\n\n\t\tlet data = target[proxyDataSymbol];\n\n\t\t// DEV:\n\t\tdevContext.signalSet(data, key);\n\n\t\t// If the value was previously a proxy, watch the new value and update\n\t\t// its effect subscriptions\n\t\tif (oldValue && oldValue[proxyDataSymbol] !== undefined) {\n\t\t\tvalue = $watch(value, { shallow: oldValue[proxyDataSymbol].shallow });\n\t\t\t//transferEffects(oldValue, newValue);\n\t\t}\n\n\t\t// Set the property value on the target\n\t\tReflect.set(target, key, value, receiver);\n\n\t\t// Re-run effects\n\t\tpropagateSignal(data, key);\n\n\t\t// If an item in an array is being set directly, trigger the length to\n\t\t// cause any lists to be re-run and data re-bound\n\t\t// TODO: Can we update the single item's data directly somehow?\n\t\tif (data.isArray && !isNaN(+String(key))) {\n\t\t\tpropagateSignal(data, \"length\");\n\t\t}\n\t}\n\n\treturn true;\n}\n","import devContext from \"../dev/devContext\";\nimport type ProxyData from \"../types/ProxyData\";\nimport type WatchOptions from \"../types/WatchOptions\";\nimport proxyGet from \"./proxyGet\";\nimport proxySet from \"./proxySet\";\nimport { proxyDataSymbol } from \"./symbols\";\n\n/**\n * Watches an object and runs effects when its properties are changed\n *\n * @param object The object to watch\n */\nexport default function $watch<T extends Record<PropertyKey, any>>(\n\tobject: T,\n\toptions?: WatchOptions,\n): T {\n\t// Return the object itself if it is undefined or null, or if it is already a proxy\n\tif (object === undefined || object === null || object[proxyDataSymbol] !== undefined) {\n\t\treturn object;\n\t}\n\n\t// DEBUG: Make sure we can proxy this value\n\t//if (typeof object !== \"object\") {\n\t//\tthrow new Error(`$watch can't be called with a ${typeof object}`);\n\t//}\n\n\t// Create a proxy handler for each object, and store some data for it here\n\tconst data: ProxyData = {\n\t\ttarget: object,\n\t\tisArray: Array.isArray(object),\n\t\tshallow: options?.shallow === true,\n\t\tsignals: new Map(),\n\t};\n\n\t// @ts-ignore\n\tobject[proxyDataSymbol] = data;\n\n\tconst handler: ProxyHandler<T> = {\n\t\tget: proxyGet,\n\t\tset: proxySet,\n\t};\n\n\tconst proxy = new Proxy(object, handler) as T;\n\n\t// DEV:\n\tdevContext.onWatch(data);\n\n\treturn proxy;\n}\n","import type Region from \"../types/Region\";\n\nexport default function moveRegion(parent: Node, region: Region, before: ChildNode | null): void {\n\tparent = before?.parentNode ?? parent;\n\tconst endNode = region.endNode ?? region.startNode;\n\tlet currentNode = region.startNode;\n\n\twhile (currentNode !== null) {\n\t\tconst nextNode = currentNode.nextSibling;\n\t\tparent.insertBefore(currentNode, before);\n\t\tif (currentNode === endNode) break;\n\t\tcurrentNode = nextNode;\n\t}\n}\n","// Adapted from https://github.com/snabbdom/snabbdom\n// With changes from https://github.com/luwes/js-diff-benchmark\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Simon Friis Vindum\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport type ListItem from \"../types/ListItem\";\nimport type Region from \"../types/Region\";\nimport $watch from \"../watch/$watch\";\nimport clearRegion from \"./clearRegion\";\nimport moveRegion from \"./moveRegion\";\nimport popRegion from \"./popRegion\";\nimport pushRegion from \"./pushRegion\";\n\n/**\n * @param region The list's region\n * @param parent The parent DOM element\n * @param anchor The DOM element to create new items before\n * @param oldItems The list of current items\n * @param newItems The list of future items\n * @param create A function that creates the DOM elements for a new item\n */\nexport default function runListItems(\n\tregion: Region,\n\tparent: ParentNode,\n\tanchor: Node | null,\n\toldItems: ListItem[],\n\tnewItems: ListItem[],\n\tcreate: (item: ListItem, before: Node | null) => void,\n\tupdate: (oldItem: ListItem, newItem: ListItem) => void,\n): void {\n\tlet oldStartIndex = 0;\n\tlet oldEndIndex = oldItems.length - 1;\n\tlet oldStartItem = oldItems[0];\n\tlet oldEndItem = oldItems[oldEndIndex];\n\n\tlet newStartIndex = 0;\n\tlet newEndIndex = newItems.length - 1;\n\tlet newStartItem = newItems[0];\n\tlet newEndItem = newItems[newEndIndex];\n\n\tlet oldKeyToIndex: Map<any, number> | undefined;\n\tlet newKeyToIndex: Map<any, number> | undefined;\n\n\twhile (oldStartIndex <= oldEndIndex && newStartIndex <= newEndIndex) {\n\t\tif (oldStartItem === null) {\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t} else if (oldEndItem === null) {\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t} else if (newStartItem === null) {\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else if (newEndItem === null) {\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldStartItem.key === newStartItem.key) {\n\t\t\ttransferListItemData(oldStartItem, newStartItem, update);\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else if (oldEndItem.key === newEndItem.key) {\n\t\t\ttransferListItemData(oldEndItem, newEndItem, update);\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldStartItem.key === newEndItem.key) {\n\t\t\t// Move to the end\n\t\t\t//console.log(\"move\", oldStartItem.key, \"to the end\");\n\t\t\tmoveRegion(parent, oldStartItem, oldEndItem.endNode!.nextSibling!);\n\t\t\ttransferListItemData(oldStartItem, newEndItem, update);\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldEndItem.key === newStartItem.key) {\n\t\t\t// Move to the start\n\t\t\t//console.log(\"move\", oldEndItem.key, \"to the start\");\n\t\t\tmoveRegion(parent, oldEndItem, oldStartItem!.startNode);\n\t\t\ttransferListItemData(oldEndItem, newStartItem, update);\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else {\n\t\t\t// Lazily build maps of keys to indexes here\n\t\t\t// They are relevant only if there has been a move, or a mid-list\n\t\t\t// insertion or deletion, and not if there has been an insertion\n\t\t\t// at the end or deletion from the front\n\t\t\tif (oldKeyToIndex === undefined || newKeyToIndex === undefined) {\n\t\t\t\toldKeyToIndex = new Map();\n\t\t\t\tfor (let i = oldStartIndex; i < oldEndIndex; i++) {\n\t\t\t\t\toldKeyToIndex.set(oldItems[i].key, i);\n\t\t\t\t}\n\t\t\t\tnewKeyToIndex = new Map();\n\t\t\t\tfor (let i = newStartIndex; i < newEndIndex; i++) {\n\t\t\t\t\tnewKeyToIndex.set(newItems[i].key, i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet oldIndex = oldKeyToIndex.get(newStartItem.key);\n\t\t\tlet newIndex = newKeyToIndex.get(oldStartItem.key);\n\n\t\t\tif (oldIndex === undefined && newIndex === undefined) {\n\t\t\t\t// Replace\n\t\t\t\t//console.log(\"replace\", oldStartItem.key, \"with\", newStartItem.key);\n\t\t\t\tconst oldRegion = pushRegion(newStartItem, true);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data, { shallow: true });\n\t\t\t\tcreate(newStartItem, oldStartItem.startNode);\n\t\t\t\tpopRegion(oldRegion);\n\t\t\t\tnewStartItem.previousRegion = oldStartItem.previousRegion;\n\t\t\t\tnewStartItem.nextRegion = oldStartItem;\n\t\t\t\toldStartItem.previousRegion = newStartItem;\n\t\t\t\tclearRegion(oldStartItem);\n\t\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t} else if (oldIndex === undefined) {\n\t\t\t\t// Insert\n\t\t\t\t//console.log(\"insert\", newStartItem.key);\n\t\t\t\tconst oldRegion = pushRegion(newStartItem, true);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data, { shallow: true });\n\t\t\t\tcreate(newStartItem, oldStartItem.startNode);\n\t\t\t\tpopRegion(oldRegion);\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t} else if (newIndex === undefined) {\n\t\t\t\t// Delete\n\t\t\t\t//console.log(\"delete\", oldStartItem.key);\n\t\t\t\tclearRegion(oldStartItem);\n\t\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\t} else {\n\t\t\t\t// Move\n\t\t\t\t//console.log(\"move\", newStartItem.key, \"before\", oldStartItem.key);\n\t\t\t\tconst oldData = oldItems[oldIndex];\n\t\t\t\tmoveRegion(parent, oldData, oldStartItem.startNode);\n\t\t\t\ttransferListItemData(oldData, newStartItem, update);\n\t\t\t\t// @ts-ignore TODO: Set key null instead?\n\t\t\t\toldItems[oldIndex] = null;\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (oldStartIndex <= oldEndIndex || newStartIndex <= newEndIndex) {\n\t\tif (oldStartIndex > oldEndIndex) {\n\t\t\t// The old list is exhausted; process new list additions\n\t\t\t// HACK: I think it would be better to move anchors to the end?\n\t\t\tlet before =\n\t\t\t\toldStartItem?.startNode ?? oldItems[oldItems.length - 1]?.endNode?.nextSibling ?? anchor;\n\t\t\tfor (newStartIndex; newStartIndex <= newEndIndex; newStartItem = newItems[++newStartIndex]) {\n\t\t\t\t//console.log(\"create\", newStartItem.key);\n\t\t\t\tconst oldRegion = pushRegion(newStartItem, true);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data, { shallow: true });\n\t\t\t\tcreate(newStartItem, before);\n\t\t\t\tpopRegion(oldRegion);\n\t\t\t\tbefore = newStartItem.endNode!.nextSibling;\n\t\t\t}\n\t\t} else {\n\t\t\t// The new list is exhausted; process old list removals\n\t\t\tfor (oldEndIndex; oldEndIndex >= oldStartIndex; oldStartItem = oldItems[oldEndIndex--]) {\n\t\t\t\t//console.log(\"clear\", oldStartItem.key);\n\t\t\t\tclearRegion(oldStartItem);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (newItems.length > 0) {\n\t\tregion.nextRegion = newItems[0];\n\t} else if (oldItems.length > 0) {\n\t\tregion.nextRegion = oldItems[oldItems.length - 1].nextRegion;\n\t}\n}\n\nfunction transferListItemData(\n\toldItem: ListItem,\n\tnewItem: ListItem,\n\tupdate: (oldItem: ListItem, newItem: ListItem) => void,\n) {\n\tnewItem.startNode = oldItem.startNode;\n\tnewItem.endNode = oldItem.endNode;\n\n\t// Manually transfer the new data's props to the old ones (to run effects)\n\t// and then set the new data to the old one\n\tupdate(oldItem, newItem);\n\tnewItem.data = oldItem.data;\n\n\t// HACK: This is just for dev tools, so we have the right `name [id]`\n\tnewItem.name = oldItem.name;\n}\n","import type ListItem from \"../types/ListItem\";\nimport type Region from \"../types/Region\";\nimport $run from \"../watch/$run\";\nimport context from \"./context\";\nimport popRegion from \"./popRegion\";\nimport pushRegion from \"./pushRegion\";\nimport runListItems from \"./runListItems\";\n\n/**\n * Runs a `for` control statement\n * @param create A function that creates the control statement's branches\n */\nexport default function runList(\n\tregion: Region,\n\tparent: ParentNode,\n\tanchor: Node | null,\n\tbuildItems: () => ListItem[],\n\tcreate: (item: ListItem, anchor: Node | null) => void,\n\tupdate: (oldItem: ListItem, newItem: ListItem) => void,\n): void {\n\tlet first = true;\n\tlet listItems: ListItem[] = [];\n\n\t// Run the list in an effect\n\t$run(function runList() {\n\t\tconst oldRegion = pushRegion(region, first);\n\t\tfirst = false;\n\n\t\t// Build the array of items with keys and data\n\t\tconst newItems = buildItems();\n\n\t\t// Do NOT re-run the list for properties accessed while updating its\n\t\t// items. E.g. we want to re-run the list for `@for (item of $items)`\n\t\t// (in buildItems, above) but not for `<span>{item.id}</span>` (in\n\t\t// runListItems, below)\n\t\tcontext.activeTarget = null;\n\n\t\t// Run the function that updates the list's items\n\t\trunListItems(region, parent, anchor, listItems, newItems, create, update);\n\n\t\tlistItems = newItems;\n\n\t\tpopRegion(oldRegion);\n\t});\n\n\t// If we're mounting, the anchor will be the one that is passed in, but if\n\t// we're hydrating it will be after the items' HTML elements, so we need to\n\t// update it after all of the items have been hydrated\n\tif (context.hydrationNode !== null) {\n\t\tanchor = context.hydrationNode.nextSibling;\n\t}\n}\n","export default function setAttribute(el: Element, name: string, value: any): void {\n\tif (value === false || value === undefined || value === null) {\n\t\tel.removeAttribute(name);\n\t} else {\n\t\tel.setAttribute(name, value);\n\t}\n}\n","import context from \"./context\";\n\n// TODO: Should we @toggle this instead? That would call onmount etc again for the new element\n\nexport default function setDynamicElement(el: HTMLElement, tag: string): HTMLElement {\n\t// If hydrating, it should already have been created as the correct element\n\tif (context.hydrationNode !== null) {\n\t\treturn el;\n\t}\n\n\t// Replace the old element with the new element\n\tlet newElement = el.ownerDocument.createElement(tag);\n\tel.replaceWith(newElement);\n\n\treturn newElement;\n}\n","import context from \"../render/context\";\nimport batchEnd from \"./batchEnd\";\nimport batchStart from \"./batchStart\";\n\n/**\n * Runs updates to proxy values in a batch, where the updates are stored in\n * context, and dependent effects are run all at once at the end.\n *\n * @param fn The function containing the batched updates to run.\n */\nexport default function $batch<T>(fn: () => T): T {\n\tif (context.batch > 0) {\n\t\treturn fn();\n\t}\n\n\tbatchStart();\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tbatchEnd();\n\t}\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport { COMPUTED_TYPE } from \"../types/constants\";\nimport runComputed from \"./runComputed\";\n\n/**\n * Caches a computed value from signals accessed in a property getter.\n *\n * @param fn The function containing the signals to compute and cache.\n */\nexport default function $cache<T>(fn: () => T): T {\n\tif (context.registerComputed === null) {\n\t\tthrow new Error(\"$cache must be used in a getter\");\n\t}\n\n\tlet computed: Computed = {\n\t\ttype: COMPUTED_TYPE,\n\t\tvalue: null,\n\t\trun: fn,\n\t\tfirstSource: null,\n\t\tfirstTarget: null,\n\t\trecalc: false,\n\t\trunning: false,\n\t\tdidError: false,\n\t\trollback: null,\n\t\t//name: dev.effectName(fn),\n\t};\n\n\tcontext.registerComputed(computed);\n\n\trunComputed(computed);\n\n\treturn computed.value;\n}\n","import context from \"../render/context\";\nimport type Cleanup from \"../types/Cleanup\";\n\n/**\n * Runs and re-runs a function on component mount\n *\n * @param fn The function to run, which may return a cleanup function\n */\nexport default function $mount(fn: () => Cleanup | void): void {\n\tcontext.mountEffects.push(fn);\n}\n","import context from \"../render/context\";\n\n// Not sure if this is a good idea?\n\nexport default function $peek<T>(fn: () => T): T {\n\tconst oldActiveTarget = context.activeTarget;\n\tcontext.activeTarget = null;\n\n\tconst result = fn();\n\n\tcontext.activeTarget = oldActiveTarget;\n\n\treturn result;\n}\n","import { proxyDataSymbol } from \"./symbols\";\n\n/**\n * Returns the target object of a proxy\n *\n * @param object The proxy object\n */\nexport default function $unwrap<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object !== undefined && object !== null && object[proxyDataSymbol] !== undefined\n\t\t? (object[proxyDataSymbol].target ?? object)\n\t\t: object;\n}\n","import type ProxyData from \"../types/ProxyData\";\nimport propagateSignal from \"../watch/propagateSignal\";\nimport { proxyDataSymbol, proxyHandledSymbol } from \"../watch/symbols\";\nimport trackProxySignal from \"../watch/trackProxySignal\";\n\n// NOTE: this is mostly copied from SvelteDate, without the memoization\n// I'm not 100% sold on it, maybe it would be better to intercept $watch calls on a Date?\n\nlet initialized = false;\n\n/**\n * Wraps a Date object for $watching.\n */\nexport default class ReactiveDate extends Date {\n\tconstructor(...params: any[]) {\n\t\t// @ts-ignore\n\t\tsuper(...params);\n\n\t\tif (!initialized) {\n\t\t\tthis.#init();\n\t\t}\n\n\t\t// @ts-ignore\n\t\tthis[proxyHandledSymbol] = true;\n\t\t// @ts-ignore\n\t\tthis[proxyDataSymbol] = {\n\t\t\ttarget: this,\n\t\t\tisArray: false,\n\t\t\tshallow: true,\n\t\t\tsignals: new Map(),\n\t\t} satisfies ProxyData;\n\t}\n\n\t#init() {\n\t\tinitialized = true;\n\n\t\tlet reactivePrototype = ReactiveDate.prototype;\n\t\tlet datePrototype = Date.prototype;\n\n\t\tconst methods = Object.getOwnPropertyNames(datePrototype);\n\n\t\tfor (const method of methods) {\n\t\t\tif (method.startsWith(\"get\") || method.startsWith(\"to\") || method === \"valueOf\") {\n\t\t\t\t// @ts-ignore\n\t\t\t\treactivePrototype[method] = function (...args) {\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tconst data = this[proxyDataSymbol];\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tconst result = datePrototype[method].apply(this, args);\n\t\t\t\t\ttrackProxySignal(data, \"#time\");\n\t\t\t\t\treturn result;\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (method.startsWith(\"set\")) {\n\t\t\t\t// @ts-ignore\n\t\t\t\treactivePrototype[method] = function (...args) {\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tconst data = this[proxyDataSymbol];\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tconst result = datePrototype[method].apply(this, args);\n\t\t\t\t\tpropagateSignal(data, \"#time\");\n\t\t\t\t\treturn result;\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":";;;;AAMA,MAAMA,iBAAgC,OAAO,IAAI,YAAY;AAE7D,MAAMC,UAEJ,WAAW,oBAAoB;CAC/B,cAAc;CACd,gBAAgB;CAChB,QAAQ;CACR,OAAO;CACP,gBAAgB;CAChB,kBAAkB;CAElB,kBAAkB;CAClB,qBAAqB;CAGrB,cAAc;CACd,gBAAgB;CAChB,YAAY;CAEZ,cAAc,EAAE;CAChB,eAAe,EAAE;CACjB,mBAAmB,EAAE;CAErB,eAAe;CASf;AAEF,sBAAe;;;;ACtCf,SAAwB,aAAa,IAAiB,OAAmB,MAAwB;AAKhG,iBAAQ,kBAAkB,KAAK;EAC9B,QAAQC,gBAAQ;EAChB;EACA,IAAI;EACJ,KAAK;EACL,CAAC;;;;;ACXH,SAAwB,SACvB,IACA,MACA,UACO;AAKP,KAAI,aAAa,UAAa,aAAa,KAC1C,iBAAQ,cAAc,KAAK;EAAE,QAAQC,gBAAQ;EAAc;EAAI;EAAM;EAAU,CAAC;;;;;;;;ACTlF,MAAa,cAAc;;;;AAK3B,MAAa,gBAAgB;;;;AAK7B,MAAa,cAAc;;;;;;;ACN3B,SAAwB,aAAa,QAAiC;CACrE,IAAIC,cAAmC;AACvC,MACC,IA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AS,cAAc,QAAQ,MAAM,MAAM,KAAK;AACtD,oBAAgB,MAAM,QAAQ;AAC9B,WAAO"}
1
+ {"version":3,"file":"index.cjs","names":["CONTEXT_SYMBOL: unique symbol","context: Context","context","context","previousSub: Subscription | null","clearSub: Subscription | null","sourceSub: Subscription | null","context","sub: Subscription | null","lastSub: Subscription | null","nextSub: Subscription | null","context","targetSub: Subscription | null","sourceSub: Subscription | null","context","effectToClean: Effect | null","context","nextEffect: Effect","previousSub: Subscription | null","clearSub: Subscription | null","error: any","effect: Effect | null","context","signal: ProxySignal | null","context","context","effect: Effect","context","context","setAttribute","animations: Animation[] | undefined","context","devContext","devContext","context","context","devContext","context","context","context","context","context","runControl","context","context","targetSub: Subscription","computed: Computed | undefined","proxyDataSymbol: unique symbol","proxyHandledSymbol: unique symbol","data: ProxyData","context","arrayWrapper: Record<PropertyKey, any>","context","data: ProxyData","handler: ProxyHandler<T>","oldKeyToIndex: Map<any, number> | undefined","newKeyToIndex: Map<any, number> | undefined","listItems: ListItem[]","runList","context","context","context","context","computed: Computed","context","#init"],"sources":["../src/render/context.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/types/constants.ts","../src/watch/clearSources.ts","../src/watch/deactivateSources.ts","../src/watch/trackSignal.ts","../src/watch/runComputed.ts","../src/watch/checkComputed.ts","../src/watch/checkSources.ts","../src/watch/runCleanups.ts","../src/watch/checkEffect.ts","../src/watch/clearTargets.ts","../src/watch/triggerEffects.ts","../src/watch/batchEnd.ts","../src/watch/batchStart.ts","../src/watch/runEffect.ts","../src/watch/$run.ts","../src/render/animate.ts","../src/render/isFragmentNode.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/clearRegion.ts","../src/render/clearLayoutSlot.ts","../src/render/newRegion.ts","../src/render/popRegion.ts","../src/render/pushRegion.ts","../src/render/fillLayoutSlot.ts","../src/render/getFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/render/newListItem.ts","../src/render/hydrationMarkers.ts","../src/render/isCommentNode.ts","../src/render/isTextNode.ts","../src/render/nodeCheckHydrationBreak.ts","../src/render/nodeNext.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeRoot.ts","../src/render/nodeSkip.ts","../src/render/runControl.ts","../src/render/runControlBranch.ts","../src/watch/propagateSignal.ts","../src/watch/symbols.ts","../src/watch/trackProxySignal.ts","../src/watch/proxyGet.ts","../src/watch/proxySet.ts","../src/watch/$watch.ts","../src/render/moveRegion.ts","../src/render/runListItems.ts","../src/render/runList.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts","../src/watch/$batch.ts","../src/watch/$cache.ts","../src/watch/$mount.ts","../src/watch/$peek.ts","../src/watch/$unwrap.ts","../src/wrappers/ReactiveDate.ts"],"sourcesContent":["import type Context from \"../types/Context\";\nimport type Region from \"../types/Region\";\n\n// TODO: Possibly create this in mount/hydrate so we aren't always checking\n// whether it exists with `??=`\n\nconst CONTEXT_SYMBOL: unique symbol = Symbol.for(\"t_context\");\n\nconst context: Context =\n\t// @ts-ignore\n\t(globalThis[CONTEXT_SYMBOL] ??= {\n\t\tactiveTarget: null,\n\t\tpreviousEffect: null,\n\t\textent: 0,\n\t\tbatch: 0,\n\t\tbatchOperation: 0,\n\t\tregisterComputed: null,\n\n\t\tfirstEffectToRun: null,\n\t\tfirstSignalToUpdate: null,\n\n\t\t// These will definitely be set, in mount or render\n\t\tactiveRegion: null as unknown as Region,\n\t\tpreviousRegion: null as unknown as Region,\n\t\trootRegion: null as unknown as Region,\n\n\t\tmountEffects: [],\n\t\tstashedEvents: [],\n\t\tstashedAnimations: [],\n\n\t\thydrationNode: null,\n\t\t//hn: null,\n\t\t//get hydrationNode() {\n\t\t//\treturn this.hn;\n\t\t//},\n\t\t//set hydrationNode(value) {\n\t\t//\tconsole.log(`set hydration ${printNode(value)}`);\n\t\t//\tthis.hn = value;\n\t\t//},\n\t} satisfies Context);\n\nexport default context;\n","import type Animation from \"../types/Animation\";\nimport context from \"./context\";\n\nexport default function addAnimation(el: HTMLElement, entry?: Animation, exit?: Animation): void {\n\t// Stash the event in context so that it can be added when the fragment is\n\t// added to the DOM\n\t// NOTE: We don't need to do this for hydration, but it's simpler to do it\n\t// the same way in both processes\n\tcontext.stashedAnimations.push({\n\t\tregion: context.activeRegion,\n\t\tel,\n\t\tin: entry,\n\t\tout: exit,\n\t});\n}\n","import context from \"./context\";\n\nexport default function addEvent(\n\tel: Element,\n\ttype: string,\n\tlistener: ((this: Element, ev: any) => any) | undefined | null,\n): void {\n\t// Stash the event in context so that it can be added when the fragment is\n\t// added to the DOM\n\t// NOTE: We don't need to do this for hydration, but it's simpler to do it\n\t// the same way in both processes\n\tif (listener !== undefined && listener !== null) {\n\t\tcontext.stashedEvents.push({ region: context.activeRegion, el, type, listener });\n\t}\n}\n","/**\n * The type of a Signal object.\n */\nexport const SIGNAL_TYPE = 0;\n\n/**\n * The type of a Computed object.\n */\nexport const COMPUTED_TYPE = 1;\n\n/**\n * The type of an Effect object.\n */\nexport const EFFECT_TYPE = 2;\n","import type Computed from \"../types/Computed\";\nimport type Effect from \"../types/Effect\";\nimport type Subscription from \"../types/Subscription\";\n\n/**\n * Clear unused source subscriptions after each Computed or Effect has been run.\n */\nexport default function clearSources(target: Computed | Effect): void {\n\tlet previousSub: Subscription | null = null;\n\tfor (\n\t\tlet clearSub: Subscription | null = target.firstSource;\n\t\tclearSub !== null;\n\t\tclearSub = clearSub.nextSource\n\t) {\n\t\tif (target.didError || !clearSub.active) {\n\t\t\t//console.log(\n\t\t\t//\t`clearing source sub ${clearSub.source.name} <-> ${clearSub.target.name} (${clearSub.name})`,\n\t\t\t//);\n\t\t\tif (previousSub === null) {\n\t\t\t\ttarget.firstSource = clearSub.nextSource;\n\t\t\t} else {\n\t\t\t\tpreviousSub.nextSource = clearSub.nextSource;\n\t\t\t}\n\n\t\t\t// Update the targets list too\n\t\t\tif (clearSub.previousTarget === null) {\n\t\t\t\tif (clearSub.source.firstTarget === clearSub) {\n\t\t\t\t\tclearSub.source.firstTarget = clearSub.nextTarget;\n\t\t\t\t}\n\t\t\t\t// TODO: else???\n\t\t\t} else {\n\t\t\t\tclearSub.previousTarget.nextTarget = clearSub.nextTarget;\n\t\t\t}\n\t\t} else {\n\t\t\tclearSub.recalc = false;\n\t\t\tpreviousSub = clearSub;\n\t\t}\n\t}\n}\n","import type Computed from \"../types/Computed\";\nimport type Effect from \"../types/Effect\";\nimport type Subscription from \"../types/Subscription\";\n\n/**\n * Sets source subscriptions to inactive for a Computed or Effect.\n */\nexport default function deactivateSources(target: Computed | Effect): void {\n\tfor (\n\t\tlet sourceSub: Subscription | null = target.firstSource;\n\t\tsourceSub !== null;\n\t\tsourceSub = sourceSub.nextSource\n\t) {\n\t\tsourceSub.active = false;\n\t\t//console.log(\n\t\t//\t`deactivating ${sourceSub.source.name} <-> ${sourceSub.target.name} (${sourceSub.name})`,\n\t\t//);\n\t}\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport type ProxySignal from \"../types/ProxySignal\";\nimport type Subscription from \"../types/Subscription\";\n\n/**\n * If there's an active target, subscribe it to this signal, so that it will be\n * run when the signal changes.\n */\nexport default function trackSignal(signal: ProxySignal | Computed): void {\n\tconst target = context.activeTarget;\n\tif (target !== null) {\n\t\tlet sub: Subscription | null = null;\n\t\tlet lastSub: Subscription | null = null;\n\n\t\t// Check if there's a sub we can re-use\n\t\t// TODO: Maybe we could be smarter with this\n\t\t// -- use the target sub instead?\n\t\t// -- do it differently on push vs pull??\n\t\tfor (\n\t\t\tlet nextSub: Subscription | null = signal.firstTarget;\n\t\t\tnextSub !== null;\n\t\t\tnextSub = nextSub.nextTarget\n\t\t) {\n\t\t\tlastSub = nextSub;\n\t\t\tif (nextSub.target === target) {\n\t\t\t\tsub = nextSub;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (sub === null) {\n\t\t\tsub = {\n\t\t\t\tsource: signal,\n\t\t\t\ttarget: target,\n\t\t\t\tpreviousTarget: lastSub,\n\t\t\t\tnextTarget: null,\n\t\t\t\tnextSource: null,\n\t\t\t\tactive: true,\n\t\t\t\trecalc: false,\n\t\t\t\t//name: dev.subName(),\n\t\t\t};\n\t\t\t//console.log(`creating sub '${signal.name}' => '${effect.name}' (${sub.name})`);\n\t\t\tif (lastSub === null) {\n\t\t\t\tsignal.firstTarget = sub;\n\t\t\t} else {\n\t\t\t\tlastSub.nextTarget = sub;\n\t\t\t}\n\n\t\t\tif (target.firstSource === null) {\n\t\t\t\ttarget.firstSource = sub;\n\t\t\t} else {\n\t\t\t\tlet lastEffectSub = target.firstSource;\n\t\t\t\tfor (\n\t\t\t\t\tlet nextSub: Subscription | null = lastEffectSub.nextSource;\n\t\t\t\t\tnextSub !== null;\n\t\t\t\t\tnextSub = nextSub.nextSource\n\t\t\t\t) {\n\t\t\t\t\tlastEffectSub = nextSub;\n\t\t\t\t}\n\t\t\t\tlastEffectSub.nextSource = sub;\n\t\t\t}\n\t\t} else {\n\t\t\t// We can re-use this subscription object\n\t\t\t//console.log(`re-using sub '${signal.name}' => '${effect.name}' (${sub.name})`);\n\t\t\tsub.active = true;\n\t\t}\n\t}\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport trackSignal from \"./trackSignal\";\n\nexport default function runComputed<T>(computed: Computed<T>): T {\n\t//console.log(`running computed '${computed.name}'`);\n\n\t// Store the active target\n\tconst oldActiveTarget = context.activeTarget;\n\n\tcomputed.running = true;\n\tcomputed.didError = false;\n\n\ttry {\n\t\t// Set the active target, so that any properties accessed while running it\n\t\t// will trigger it in future\n\t\tcontext.activeTarget = computed;\n\n\t\t// Run the computed and gather its dependencies\n\t\tcomputed.value = computed.run();\n\t} catch (err) {\n\t\tcomputed.didError = true;\n\t\t// @ts-ignore\n\t\tcomputed.value = err;\n\t\tthrow err;\n\t} finally {\n\t\t// Set the active target back to what it was previously\n\t\tcontext.activeTarget = oldActiveTarget;\n\n\t\tcomputed.running = false;\n\t}\n\n\ttrackSignal(computed);\n\n\treturn computed.value;\n}\n","import type Computed from \"../types/Computed\";\nimport type Subscription from \"../types/Subscription\";\nimport checkSources from \"./checkSources\";\nimport clearSources from \"./clearSources\";\nimport deactivateSources from \"./deactivateSources\";\nimport runComputed from \"./runComputed\";\n\n/**\n * Checks whether a Computed value should be re-run (which will be true if any\n * of its sources have changed) and re-runs it if necessary.\n */\nexport default function checkComputed(computed: Computed): boolean {\n\tlet rerun = checkSources(computed);\n\n\tlet changed = false;\n\n\tif (rerun) {\n\t\t// Set source subscriptions to inactive\n\t\tdeactivateSources(computed);\n\n\t\t// Run the computed, which will reset subscriptions\n\t\tconst oldValue = computed.value;\n\t\trunComputed(computed);\n\t\tchanged = computed.value !== oldValue;\n\n\t\t// Clear unused source subscriptions\n\t\tclearSources(computed);\n\t}\n\n\tcomputed.recalc = false;\n\n\t// If it hasn't changed, all of its target subscriptions remain active and\n\t// don't need to be recalculated\n\tif (!changed) {\n\t\tfor (\n\t\t\tlet targetSub: Subscription | null = computed.firstTarget;\n\t\t\ttargetSub !== null;\n\t\t\ttargetSub = targetSub.nextTarget\n\t\t) {\n\t\t\ttargetSub.active = true;\n\t\t\ttargetSub.recalc = false;\n\t\t}\n\t}\n\n\treturn changed;\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport type Effect from \"../types/Effect\";\nimport type Subscription from \"../types/Subscription\";\nimport { COMPUTED_TYPE, SIGNAL_TYPE } from \"../types/constants\";\nimport checkComputed from \"./checkComputed\";\n\n// RECURSIVE\n\n/**\n * Checks whether a Computed or Effect should be re-run (which will be true if\n * any of its sources have changed).\n */\nexport default function checkSources(target: Computed | Effect): boolean {\n\t// NOTE: We bail early if we know the target needs to be re-run; subsequent\n\t// computed values will be computed in the proxy getter\n\n\t// Check signals first as it's cheap, then computed values\n\tlet haveComputed = false;\n\n\tfor (\n\t\tlet sourceSub: Subscription | null = target.firstSource;\n\t\tsourceSub !== null;\n\t\tsourceSub = sourceSub.nextSource\n\t) {\n\t\t//console.log(`checking source sub '${sourceSub.source.name}' (${sourceSub.name})`);\n\t\tif (sourceSub.recalc) {\n\t\t\tif (sourceSub.source.type === SIGNAL_TYPE) {\n\t\t\t\treturn true;\n\t\t\t} /* else if (sourceSub.source.type === COMPUTED_TYPE) */ else {\n\t\t\t\tif (sourceSub.source.recalc) {\n\t\t\t\t\thaveComputed = true;\n\t\t\t\t} else {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (haveComputed) {\n\t\tfor (\n\t\t\tlet sourceSub: Subscription | null = target.firstSource;\n\t\t\tsourceSub !== null;\n\t\t\tsourceSub = sourceSub.nextSource\n\t\t) {\n\t\t\t//console.log(`checking source sub '${sourceSub.source.name}' (${sourceSub.name})`);\n\t\t\tif (sourceSub.recalc && sourceSub.source.type === COMPUTED_TYPE && sourceSub.source.recalc) {\n\t\t\t\tconst oldActiveTarget = context.activeTarget;\n\t\t\t\tcontext.activeTarget = target;\n\n\t\t\t\tconst recalc = checkComputed(sourceSub.source);\n\n\t\t\t\tcontext.activeTarget = oldActiveTarget;\n\n\t\t\t\tif (recalc) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}\n","import context from \"../render/context\";\nimport type Effect from \"../types/Effect\";\nimport clearSources from \"./clearSources\";\n\n/**\n * Runs cleanup functions for the effect and its children.\n */\nexport default function runCleanups(effect: Effect): void {\n\tlet effectToClean: Effect | null = effect;\n\tfor (let i = 0; i < effect.extent; i++) {\n\t\tif (typeof effectToClean.cleanup === \"function\") {\n\t\t\t//console.log(`cleaning effect '${effectToClean.name}'`);\n\t\t\tconst oldActiveTarget = context.activeTarget;\n\t\t\tcontext.activeTarget = null;\n\n\t\t\ttry {\n\t\t\t\teffectToClean.cleanup();\n\t\t\t} catch (err) {\n\t\t\t\teffectToClean.didError = true;\n\t\t\t\tclearSources(effectToClean);\n\t\t\t\tthrow err;\n\t\t\t} finally {\n\t\t\t\teffectToClean.cleanup = undefined;\n\t\t\t\tcontext.activeTarget = oldActiveTarget;\n\t\t\t}\n\t\t}\n\n\t\tconst nextEffect: Effect = effectToClean.nextEffect!;\n\n\t\t// If it's a child effect that has been triggered, clean it up\n\t\t// and remove it from the list of effects to run (it may get\n\t\t// re-created with the parent)\n\t\tif (i !== 0 && effect.nextEffectToRun === effectToClean) {\n\t\t\teffect.nextEffectToRun = effectToClean.nextEffectToRun;\n\t\t\teffectToClean.nextEffect = effectToClean.nextEffectToRun = null;\n\t\t}\n\n\t\teffectToClean = nextEffect;\n\t}\n}\n","import type Effect from \"../types/Effect\";\nimport checkSources from \"./checkSources\";\nimport clearSources from \"./clearSources\";\nimport deactivateSources from \"./deactivateSources\";\nimport runCleanups from \"./runCleanups\";\nimport runEffect from \"./runEffect\";\n\n/**\n * Checks whether an Effect should be re-run (which will be true if any\n * of its sources have changed) and re-runs it if necessary.\n */\nexport default function checkEffect(effect: Effect): void {\n\t//console.log(`checking effect '${effect.name}'`);\n\n\tlet rerun = checkSources(effect);\n\n\tif (rerun) {\n\t\t//console.log(`running effect '${String(effect.run)}'`);\n\n\t\t// Run cleanup functions for the effect and its children\n\t\trunCleanups(effect);\n\n\t\t// Set source subscriptions to inactive\n\t\tdeactivateSources(effect);\n\n\t\t// Run the effect, which will reset subscriptions\n\t\trunEffect(effect);\n\n\t\t// Clear unused source subscriptions\n\t\tclearSources(effect);\n\t}\n}\n","import type Computed from \"../types/Computed\";\nimport type ProxySignal from \"../types/ProxySignal\";\nimport type Subscription from \"../types/Subscription\";\n\n/**\n * Clear unused target subscriptions after all Effects have been run.\n */\nexport default function clearTargets(source: ProxySignal | Computed): void {\n\tlet previousSub: Subscription | null = null;\n\tfor (\n\t\tlet clearSub: Subscription | null = source.firstTarget;\n\t\tclearSub !== null;\n\t\tclearSub = clearSub.nextTarget\n\t) {\n\t\tif (!clearSub.active) {\n\t\t\t//console.log(\n\t\t\t//\t`clearing target sub ${clearSub.source.name} <-> ${clearSub.target.name} (${clearSub.name})`,\n\t\t\t//);\n\t\t\tif (previousSub === null) {\n\t\t\t\tsource.firstTarget = clearSub.nextTarget;\n\t\t\t} else {\n\t\t\t\tpreviousSub.nextTarget = clearSub.nextTarget;\n\t\t\t}\n\t\t} else {\n\t\t\tpreviousSub = clearSub;\n\t\t}\n\t}\n}\n","import context from \"../render/context\";\nimport type Effect from \"../types/Effect\";\nimport type ProxySignal from \"../types/ProxySignal\";\nimport checkEffect from \"./checkEffect\";\nimport clearTargets from \"./clearTargets\";\n\n/**\n * Runs the effects that have been collected during the batch.\n */\nexport default function triggerEffects(): void {\n\t//console.log(`triggering effects for '${String(key)}' on`, proxy);\n\t//console.log(\"===\");\n\t//console.log(`triggering effects for '${String(key)}'`);\n\n\tlet didError = false;\n\tlet error: any;\n\n\t// Run the effects\n\tlet effect: Effect | null = context.firstEffectToRun;\n\twhile (effect !== null) {\n\t\tcontext.batchOperation++;\n\n\t\ttry {\n\t\t\tcheckEffect(effect);\n\t\t} catch (err) {\n\t\t\tif (!didError) {\n\t\t\t\tdidError = true;\n\t\t\t\terror = err;\n\t\t\t}\n\t\t}\n\n\t\teffect = effect.nextEffectToRun;\n\t}\n\n\t// Clear the effects\n\teffect = context.firstEffectToRun;\n\tcontext.firstEffectToRun = null;\n\twhile (effect !== null) {\n\t\tlet nextEffect = effect.nextEffectToRun;\n\t\teffect.nextEffectToRun = null;\n\t\teffect = nextEffect;\n\t}\n\n\t// Clear unused target subscriptions for the signals that were updated\n\t// during the batch\n\tlet signal: ProxySignal | null = context.firstSignalToUpdate;\n\tcontext.firstSignalToUpdate = null;\n\twhile (signal !== null) {\n\t\tclearTargets(signal);\n\n\t\tconst nextSignal = signal.nextSignalToUpdate;\n\t\tsignal.nextSignalToUpdate = null;\n\t\tsignal = nextSignal;\n\t}\n\n\tif (didError) {\n\t\tthrow error;\n\t}\n}\n","import context from \"../render/context\";\nimport triggerEffects from \"./triggerEffects\";\n\nexport default function batchEnd(): void {\n\tif (context.batch > 1) {\n\t\tcontext.batch--;\n\t\treturn;\n\t}\n\n\ttry {\n\t\ttriggerEffects();\n\t} finally {\n\t\tcontext.batch = 0;\n\t\tcontext.batchOperation = 0;\n\t\tcontext.previousEffect = null;\n\t}\n}\n","import context from \"../render/context\";\n\nexport default function batchStart(): void {\n\tcontext.batch++;\n}\n","import devContext from \"../dev/devContext\";\nimport context from \"../render/context\";\nimport type Effect from \"../types/Effect\";\nimport batchEnd from \"./batchEnd\";\nimport batchStart from \"./batchStart\";\nimport clearSources from \"./clearSources\";\n\nexport default function runEffect(effect: Effect): void {\n\t//console.log(`running effect '${effect.name}'`);\n\n\t// DEV:\n\tdevContext.effectRun(effect);\n\n\t// Store the active target\n\tconst oldActiveTarget = context.activeTarget;\n\tconst oldExtent = context.extent;\n\n\teffect.didError = false;\n\n\tbatchStart();\n\n\ttry {\n\t\t// Set the next effect for navigating through\n\t\tif (context.previousEffect !== null) {\n\t\t\tcontext.previousEffect.nextEffect = effect;\n\t\t}\n\n\t\t// Set the active effect, so that any properties accessed while running it\n\t\t// will trigger it in future\n\t\tcontext.activeTarget = effect;\n\t\tcontext.previousEffect = effect;\n\t\tcontext.extent = 1;\n\n\t\t// Run the effect to register its subscriptions and get its (optional)\n\t\t// cleanup function\n\t\teffect.cleanup = effect.run();\n\n\t\teffect.extent = context.extent;\n\t} catch (err) {\n\t\teffect.didError = true;\n\t\tclearSources(effect);\n\t\tthrow err;\n\t} finally {\n\t\t// Set the active target back to what it was previously\n\t\tcontext.activeTarget = oldActiveTarget;\n\t\tcontext.extent += oldExtent - 1;\n\n\t\tbatchEnd();\n\t}\n}\n","import devContext from \"../dev/devContext\";\nimport type Cleanup from \"../types/Cleanup\";\nimport type Effect from \"../types/Effect\";\nimport { EFFECT_TYPE } from \"../types/constants\";\nimport runEffect from \"./runEffect\";\n\n// TODO: Take a pipeline of operators e.g. debounce\n\n/**\n * Runs and re-runs a function that depends on a watched object\n *\n * @param fn The function to run, which may return a cleanup function.\n */\nexport default function $run(fn: () => Cleanup | void, name?: string): Effect {\n\tlet effect: Effect = {\n\t\ttype: EFFECT_TYPE,\n\t\trun: fn,\n\t\tcleanup: undefined,\n\t\tfirstSource: null,\n\t\tnextEffect: null,\n\t\textent: 0,\n\t\tnextEffectToRun: null,\n\t\tdidError: false,\n\t\tname,\n\t};\n\n\t// DEV:\n\tdevContext.onRun(effect);\n\n\trunEffect(effect);\n\n\treturn effect;\n}\n","import context from \"./context\";\n\n/**\n * Adds an animation for an element\n * @param el The element to animate\n * @param enter Whether the animation is being run on enter\n * @param keyframes The Web Animation API keyframes\n * @param options The Web Animmation API options\n */\nexport default async function animate(\n\tel: HTMLElement,\n\tenter: boolean,\n\tkeyframes: Keyframe[] | PropertyIndexedKeyframes | null,\n\toptions?: number | KeyframeAnimationOptions,\n): Promise<void> {\n\t// This is quite simplistic\n\t// We might need to\n\t// - store the animation\n\t// - reverse it if it's running and the region appears/disappears\n\t// - transfer the animation to the new element\n\tlet animationOptions = Object.assign(\n\t\t{\n\t\t\tdirection: enter ? \"normal\" : \"reverse\",\n\t\t\t// TODO: Should probably have a global setting for these somewhere\n\t\t\t// And respect browser reduce motion settings\n\t\t\tduration: 300,\n\t\t\teasing: \"ease-in-out\",\n\t\t\tfill: \"forwards\",\n\t\t},\n\t\toptions,\n\t);\n\n\tconst animation = el.animate(keyframes, animationOptions);\n\n\t// HACK: I'm not entirely sure why we need to sent the animation's timeline,\n\t// but without it, animations never start\n\t// HACK: We also need to make sure the element has been added to the DOM\n\t// with a timeout\n\tsetTimeout(() => {\n\t\tanimation.timeline = el.ownerDocument.timeline;\n\t}, 1);\n\n\t// Add the animation to the active region, so that the region won't be cleared\n\t// until the animation is completed\n\tconst activeRegion = context.activeRegion;\n\t// TODO: An option for whether to await or cancel events on region remove\n\t// e.g. if you are doing a client side navigation, you don't want to run animations\n\tactiveRegion.animations ??= new Set();\n\tactiveRegion.animations.add(animation);\n\n\tawait animation.finished;\n}\n","export default function isFragmentNode(node: Node): node is DocumentFragment {\n\treturn node.nodeType === 11;\n}\n","import $run from \"../watch/$run\";\nimport animate from \"./animate\";\nimport context from \"./context\";\nimport isFragmentNode from \"./isFragmentNode\";\n\nexport default function addFragment(\n\tfragment: DocumentFragment,\n\tparent: ParentNode,\n\tbefore: Node | null,\n\tendNode?: ChildNode,\n): void {\n\t//console.log(`adding fragment '${fragment.textContent}' to `, parent);\n\t//console.log(\"before\", before);\n\n\tconst activeRegion = context.activeRegion;\n\tconst hydrationNode = context.hydrationNode;\n\n\t// Set the active region's end node to the last node in the fragment\n\tif (hydrationNode !== null) {\n\t\tactiveRegion.endNode = endNode ?? hydrationNode;\n\t} else {\n\t\tactiveRegion.startNode = fragment.firstChild;\n\t\tactiveRegion.endNode = fragment.lastChild;\n\t}\n\n\tparent = before?.parentNode ?? parent;\n\n\t// Add the fragment\n\tif (hydrationNode === null) {\n\t\tparent.insertBefore(fragment, before);\n\t}\n\n\t// If we're adding this fragment to the DOM, we can now run any $mount\n\t// effects, add our stashed events and play our stashed animations\n\tif (!isFragmentNode(parent)) {\n\t\t// Only run $mount effects if not hydrating (if hydrating, they will get\n\t\t// run at the end when everything is hooked up)\n\t\tif (hydrationNode === null) {\n\t\t\tfor (let effect of context.mountEffects) {\n\t\t\t\t$run(effect);\n\t\t\t}\n\t\t\tcontext.mountEffects.length = 0;\n\t\t}\n\n\t\t// Set the active region for each event so it will get attached to the\n\t\t// right one and set it back afterwards\n\t\tif (context.stashedEvents.length > 0) {\n\t\t\tconst events = [...context.stashedEvents];\n\t\t\t$run(function addFragmentEvents() {\n\t\t\t\tfor (let event of events) {\n\t\t\t\t\tevent.el.addEventListener(event.type, event.listener);\n\t\t\t\t}\n\t\t\t\treturn () => {\n\t\t\t\t\tfor (let event of events) {\n\t\t\t\t\t\tevent.el.removeEventListener(event.type, event.listener);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t});\n\t\t\tcontext.stashedEvents.length = 0;\n\t\t}\n\n\t\t// Set the active region for each animation so it will get attached to\n\t\t// the right one and set it back afterwards\n\t\t// Don't await animations\n\t\tfor (let animation of context.stashedAnimations) {\n\t\t\tcontext.activeRegion = animation.region;\n\t\t\t$run(function addFragmentAnimation() {\n\t\t\t\tif (animation.in !== undefined) {\n\t\t\t\t\t// eslint-disable-next-line no-floating-promises\n\t\t\t\t\tanimate(animation.el, true, animation.in.keyframes, animation.in.options);\n\t\t\t\t}\n\t\t\t\tif (animation.out !== undefined) {\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\t// eslint-disable-next-line no-floating-promises\n\t\t\t\t\t\tanimate(animation.el, false, animation.out!.keyframes, animation.out!.options);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tcontext.stashedAnimations.length = 0;\n\n\t\t// Set the active region back\n\t\tcontext.activeRegion = activeRegion;\n\t}\n}\n","import $run from \"../watch/$run\";\n\nexport default function applyProps(\n\tel: Element,\n\tprops: Record<string, any> | undefined,\n\tpropNamesUsed: string[],\n): void {\n\tif (props !== undefined) {\n\t\tfor (let [name, value] of Object.entries(props)) {\n\t\t\tif (!propNamesUsed.includes(name)) {\n\t\t\t\tif (name.startsWith(\"on\")) {\n\t\t\t\t\tconst eventName = name.substring(2);\n\t\t\t\t\tel.addEventListener(eventName, value);\n\t\t\t\t} else {\n\t\t\t\t\t$run(function setAttribute() {\n\t\t\t\t\t\tel.setAttribute(name, value);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import devContext from \"../dev/devContext\";\nimport type Region from \"../types/Region\";\n\nexport default function clearRegion(region: Region): void {\n\t//console.log(\"clearing region\", region.name, \"from\", region.startNode, \"to\", region.endNode);\n\n\t// DEV:\n\tdevContext.onRegionCleared(region);\n\n\t// Clear child regions and collect animations that take place within this\n\t// region and its children\n\tlet animations: Animation[] | undefined =\n\t\tregion.animations !== null ? Array.from(region.animations) : undefined;\n\tlet childRegion = region.nextRegion;\n\twhile (childRegion !== null && childRegion.depth > region.depth) {\n\t\tif (childRegion.animations !== null) {\n\t\t\tanimations ??= [];\n\t\t\tanimations.push(...childRegion.animations);\n\t\t}\n\t\treleaseRegion(childRegion);\n\t\t// HACK: see runControlBranch\n\t\tchildRegion.depth = -2;\n\t\tchildRegion = childRegion.nextRegion;\n\t}\n\tregion.nextRegion = childRegion;\n\n\tif (region.previousRegion !== null) {\n\t\tregion.previousRegion.nextRegion = region.nextRegion;\n\t}\n\tif (region.nextRegion !== null) {\n\t\tregion.nextRegion.previousRegion = region.previousRegion;\n\t}\n\n\t// Wait for animations, if any, then clear the region's nodes\n\tif (animations !== undefined) {\n\t\tanimations.forEach((a) => {\n\t\t\ta.reverse();\n\t\t\ta.play();\n\t\t});\n\t\t// eslint-disable-next-line no-floating-promises\n\t\tPromise.all(animations.map((a) => a.finished)).then(() => clearNodes(region));\n\t} else {\n\t\tclearNodes(region);\n\t}\n}\n\nfunction clearNodes(region: Region) {\n\t// Clear the nodes for this region\n\tif (region.startNode !== null && region.endNode !== null) {\n\t\tlet currentNode = region.endNode;\n\t\t// DEBUG:\n\t\t//if (region.startNode.parentNode !== currentNode.parentNode) {\n\t\t//\tthrow new Error(\"region nodes have different parents\");\n\t\t//}\n\t\twhile (currentNode !== region.startNode) {\n\t\t\tlet previousNode = currentNode.previousSibling;\n\t\t\tcurrentNode.remove();\n\t\t\tcurrentNode = previousNode!;\n\t\t}\n\t\tcurrentNode.remove();\n\t}\n\treleaseRegion(region);\n}\n\nfunction releaseRegion(region: Region) {\n\tregion.startNode = null;\n\tregion.endNode = null;\n\tregion.previousRegion = null;\n\tregion.nextRegion = null;\n\tregion.animations = null;\n}\n","import type Region from \"../types/Region\";\nimport clearRegion from \"./clearRegion\";\nimport context from \"./context\";\n\nexport default function clearLayoutSlot(region: Region): void {\n\tcontext.previousRegion = region.previousRegion!;\n\tclearRegion(region);\n}\n","import type Region from \"../types/Region\";\n\nexport default function newRegion(name?: string): Region {\n\treturn {\n\t\tstartNode: null,\n\t\tendNode: null,\n\t\tpreviousRegion: null,\n\t\tnextRegion: null,\n\t\tdepth: -1,\n\t\tanimations: null,\n\t\tname,\n\t};\n}\n","import devContext from \"../dev/devContext\";\nimport type Region from \"../types/Region\";\nimport context from \"./context\";\n\nexport default function popRegion(oldRegion: Region): void {\n\tcontext.activeRegion = oldRegion;\n\n\tdevContext.onRegionPopped();\n}\n","import devContext from \"../dev/devContext\";\nimport type Region from \"../types/Region\";\nimport context from \"./context\";\n\nexport default function pushRegion(region: Region, toParent = false): Region {\n\tconst activeRegion = context.activeRegion;\n\n\t// Add the new region to the currently active region's children, so that we\n\t// can delete the children with the parent\n\tif (toParent) {\n\t\tconst previousRegion = context.previousRegion;\n\t\tregion.previousRegion = previousRegion;\n\n\t\tconst nextRegion = previousRegion.nextRegion;\n\t\tpreviousRegion.nextRegion = region;\n\t\tregion.nextRegion = nextRegion;\n\n\t\tregion.depth = activeRegion.depth + 1;\n\t}\n\n\t// Set the new active region\n\tcontext.activeRegion = region;\n\tcontext.previousRegion = region;\n\n\t// DEV:\n\tdevContext.onRegionPushed(region, toParent);\n\n\t// Return the old active region, so that it can be reset when done\n\treturn activeRegion;\n}\n","import devContext from \"../dev/devContext\";\nimport type Component from \"../types/Component\";\nimport type Region from \"../types/Region\";\nimport type SlotRender from \"../types/SlotRender\";\nimport newRegion from \"./newRegion\";\nimport popRegion from \"./popRegion\";\nimport pushRegion from \"./pushRegion\";\n\nexport default function fillLayoutSlot(\n\tcomponent: Component,\n\tslot: SlotRender,\n\tparent: ParentNode,\n\tanchor: Node | null,\n\t$props?: Record<string, string>,\n\t$context?: Record<PropertyKey, any>,\n): Region {\n\tconst region = newRegion(devContext.enabled ? \"Layout slot\" : undefined);\n\tconst oldRegion = pushRegion(region, true);\n\n\tcomponent(parent, anchor, $props, $context, {\n\t\t_: slot,\n\t});\n\n\tpopRegion(oldRegion);\n\n\treturn region;\n}\n","export default function getFragment(\n\tdocument: Document,\n\tarray: DocumentFragment[],\n\tindex: number,\n\thtml: string,\n\tns?: boolean,\n): DocumentFragment {\n\t// Create the fragment in the array if it hasn't yet been used\n\tif (array[index] === undefined) {\n\t\t// TODO: Should pass a string for the ns, when we support other element types\n\t\tif (ns === true) {\n\t\t\tconst template = document.createElementNS(\"http://www.w3.org/2000/svg\", \"template\");\n\t\t\ttemplate.innerHTML = html;\n\t\t\tconst fragment = new DocumentFragment();\n\t\t\tfragment.append(...template.childNodes);\n\t\t\tarray[index] = fragment;\n\t\t} else {\n\t\t\tconst template = document.createElement(\"template\");\n\t\t\ttemplate.innerHTML = html;\n\t\t\tarray[index] = template.content;\n\t\t}\n\t}\n\n\t// Get the fragment from the array\n\t// TODO: If we're hydrating we probably don't want to create and return a\n\t// fragment unless we really need to\n\tlet fragment = array[index].cloneNode(true) as DocumentFragment;\n\n\treturn fragment;\n}\n","import devContext from \"../dev/devContext\";\nimport type Component from \"../types/Component\";\nimport type SlotRender from \"../types/SlotRender\";\nimport $run from \"../watch/$run\";\nimport context from \"./context\";\nimport newRegion from \"./newRegion\";\nimport pushRegion from \"./pushRegion\";\n\n/**\n * Hydrates a component into an existing DOM tree\n * @param parent The parent node\n * @param component The component to mount\n * @param props An object containing component props\n */\nexport default function hydrate(\n\tparent: ParentNode,\n\tcomponent: Component,\n\tprops?: Record<string, any>,\n\tslots?: Record<string, SlotRender>,\n): void {\n\t// When mounting, the parent must have no child elements, so we can just set\n\t// the hydration node to the first child node\n\tcontext.hydrationNode = parent.firstChild;\n\n\t// Create and push the root region\n\t// TODO: Does it need to be on context??\n\tcontext.rootRegion = newRegion(devContext.enabled ? \"Root\" : undefined);\n\tcontext.previousRegion = context.rootRegion;\n\tpushRegion(context.rootRegion);\n\n\t// Call the component's render function\n\tcomponent(parent, null, props, undefined, slots);\n\n\tcontext.hydrationNode = null;\n\n\t// Now that we've hydrated, we can run $mount effects\n\tfor (let effect of context.mountEffects) {\n\t\t$run(effect);\n\t}\n\tcontext.mountEffects.length = 0;\n}\n","import devContext from \"../dev/devContext\";\nimport type Component from \"../types/Component\";\nimport type SlotRender from \"../types/SlotRender\";\nimport context from \"./context\";\nimport newRegion from \"./newRegion\";\nimport pushRegion from \"./pushRegion\";\n\n/**\n * Mounts a component into a DOM node\n *\n * @param parent The node to mount the component into\n * @param component The component to mount\n * @param props An object containing component props\n */\nexport default function mount(\n\tparent: ParentNode,\n\tcomponent: Component,\n\tprops?: Record<string, any>,\n\tslots?: Record<string, SlotRender>,\n): void {\n\t// The parent node must have no child elements, so that we can hydrate\n\t// without worrying about where to start\n\tif (parent.childElementCount > 0) {\n\t\tthrow new Error(\"The parent node must have no child elements\");\n\t}\n\n\t// Remove all text, commments, etc\n\twhile (parent.firstChild !== null) {\n\t\tparent.firstChild.remove();\n\t}\n\n\t// Create and push the root region\n\tif (context.rootRegion === null) {\n\t\tcontext.rootRegion = newRegion(devContext.enabled ? \"Root\" : undefined);\n\t\tcontext.previousRegion = context.rootRegion;\n\t\tpushRegion(context.rootRegion);\n\t}\n\n\t// Call the component's render function\n\tcomponent(parent, null, props, undefined, slots);\n}\n","import type ListItem from \"../types/ListItem\";\n\nexport default function newListItem(\n\tdata: Record<PropertyKey, any>,\n\tkey?: any,\n\tname?: string,\n): ListItem {\n\treturn {\n\t\tstartNode: null,\n\t\tendNode: null,\n\t\tpreviousRegion: null,\n\t\tnextRegion: null,\n\t\tdepth: -1,\n\t\tanimations: null,\n\t\tname,\n\t\tdata,\n\t\tkey,\n\t};\n}\n","const HYDRATION_START = \"[\";\nconst HYDRATION_END = \"]\";\nconst HYDRATION_BREAK = \"^\";\n\nexport { HYDRATION_START, HYDRATION_END, HYDRATION_BREAK };\n","export default function isCommentNode(node: Node): node is Comment {\n\treturn node.nodeType === 8;\n}\n","export default function isTextNode(node: Node): node is Text {\n\treturn node.nodeType === 3;\n}\n","import context from \"./context\";\nimport { HYDRATION_BREAK } from \"./hydrationMarkers\";\nimport isCommentNode from \"./isCommentNode\";\n\n// TODO: It would be good to remove this, if possible\n\n/**\n * When hydrating, removes and skips hydration comments that are inserted at the\n * start of branches and used to split up text nodes that would otherwise be\n * joined in HTML.\n *\n * @param node The node to check and maybe skip.\n * @returns The next node.\n */\nexport default function nodeCheckHydrationBreak(node: ChildNode | null): ChildNode | null {\n\tif (context.hydrationNode !== null) {\n\t\tif (node !== null && isCommentNode(node) && node.data === HYDRATION_BREAK) {\n\t\t\tlet comment = node;\n\t\t\tnode = node.nextSibling;\n\t\t\tcomment.remove();\n\t\t}\n\t\tcontext.hydrationNode = node;\n\t}\n\treturn node;\n}\n","import context from \"./context\";\nimport isTextNode from \"./isTextNode\";\nimport nodeCheckHydrationBreak from \"./nodeCheckHydrationBreak\";\n\n/**\n * Gets the next sibling of a node.\n *\n * When hydrating, sets the hydration node.\n *\n * @param node The node.\n * @param text Whether we require a text node.\n */\nexport default function nodeNext(node: ChildNode, text = false): ChildNode {\n\t// If the required node is a text node, and we already have one, just use\n\t// it. This is caused by text nodes being merged in HTML\n\tif (context.hydrationNode !== null && text && isTextNode(node)) {\n\t\treturn node;\n\t}\n\n\tlet nextNode = nodeCheckHydrationBreak(node.nextSibling);\n\n\t// NOTE: We know this is not null as it is being called from generated code\n\treturn nextNode!;\n}\n","import context from \"./context\";\nimport { HYDRATION_END, HYDRATION_START } from \"./hydrationMarkers\";\nimport isCommentNode from \"./isCommentNode\";\nimport nodeNext from \"./nodeNext\";\n\n/**\n * Gets the anchor node for a control statement or component.\n *\n * When mounting, this just returns the anchor node parameter (because it was\n * created).\n *\n * When hydrating, there should be matched <![> and <!]> comments in the HTML,\n * and the anchor node should be after the end comment. The matched comment\n * nodes will be deleted, and the hydration node set to the first node inside\n * the matched comments.\n *\n * @param node The potential anchor node.\n * @returns The anchor node.\n */\nexport default function nodeAnchor(node: ChildNode): ChildNode {\n\tif (context.hydrationNode !== null) {\n\t\tif (isCommentNode(node) && node.data === HYDRATION_START) {\n\t\t\t// Skip and remove the start node, setting the hydration node in\n\t\t\t// nodeNext\n\t\t\tlet currentNode = nodeNext(node);\n\t\t\tnode.remove();\n\n\t\t\t// Go through siblings until we get to the end\n\t\t\tlet level = 1;\n\t\t\twhile (currentNode !== null) {\n\t\t\t\tif (isCommentNode(currentNode)) {\n\t\t\t\t\tif (currentNode.data === HYDRATION_START) {\n\t\t\t\t\t\tlevel += 1;\n\t\t\t\t\t} else if (currentNode.data === HYDRATION_END) {\n\t\t\t\t\t\tlevel -= 1;\n\t\t\t\t\t\tif (level === 0) {\n\t\t\t\t\t\t\t// Remove the end node and return the next one\n\t\t\t\t\t\t\tconst endNode = currentNode.nextSibling;\n\t\t\t\t\t\t\tcurrentNode.remove();\n\n\t\t\t\t\t\t\t// If the statement is empty (i.e. the end comment\n\t\t\t\t\t\t\t// immediately follows the start comment), move the\n\t\t\t\t\t\t\t// hydration node past the removed end comment to\n\t\t\t\t\t\t\t// the anchor, so that we can continue to the next\n\t\t\t\t\t\t\t// nodes\n\t\t\t\t\t\t\tif (context.hydrationNode === currentNode) {\n\t\t\t\t\t\t\t\tcontext.hydrationNode = endNode;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// NOTE: We know this is not null as it is being\n\t\t\t\t\t\t\t// called from generated code\n\t\t\t\t\t\t\treturn endNode!;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcurrentNode = currentNode.nextSibling!;\n\t\t\t}\n\n\t\t\tif (currentNode === null) {\n\t\t\t\tthrow new Error(\"End hydration comment not found\");\n\t\t\t}\n\t\t}\n\t}\n\n\treturn node;\n}\n","import context from \"./context\";\n\n/**\n * Gets the first child of a node.\n *\n * Sets the hydration node.\n *\n * @param parent The parent node.\n */\nexport default function nodeChild(parent: Node): ChildNode {\n\tlet childNode = parent.firstChild;\n\tif (context.hydrationNode !== null) {\n\t\t// The child may be null when hydrating the sole text child of an\n\t\t// element with no text\n\t\tif (childNode === null) {\n\t\t\tchildNode = parent.appendChild(parent.ownerDocument!.createTextNode(\"\"));\n\t\t}\n\t\tcontext.hydrationNode = childNode;\n\t}\n\n\t// NOTE: We know this is not null as it is being called from generated code\n\treturn childNode!;\n}\n","import context from \"./context\";\nimport { HYDRATION_START } from \"./hydrationMarkers\";\nimport isCommentNode from \"./isCommentNode\";\nimport isTextNode from \"./isTextNode\";\n\n/**\n * Gets the first child in a fragment.\n *\n * When hydrating, also sets the active range's start node, while we have it.\n *\n * @param parent The parent of the fragment.\n * @param text Whether we require a text node.\n */\nexport default function nodeRoot(parent: Node, text = false): ChildNode {\n\tif (context.hydrationNode !== null) {\n\t\tlet rootNode = context.hydrationNode;\n\n\t\t// If the root node we need is a text node, and the hydration node is\n\t\t// not a text node but the previous node is, use the previous node. This\n\t\t// is caused by text nodes being merged in HTML\n\t\tif (\n\t\t\ttext &&\n\t\t\t!isTextNode(rootNode) &&\n\t\t\trootNode.previousSibling !== null &&\n\t\t\tisTextNode(rootNode.previousSibling)\n\t\t) {\n\t\t\trootNode = rootNode.previousSibling;\n\t\t\tcontext.hydrationNode = rootNode;\n\t\t}\n\n\t\t// HACK: If the root node is a hydration start comment node, get the\n\t\t// next one instead\n\t\tif (isCommentNode(rootNode) && rootNode.data === HYDRATION_START) {\n\t\t\trootNode = rootNode.nextSibling!;\n\t\t\tcontext.hydrationNode = rootNode;\n\t\t}\n\n\t\t// If hydrating, set the active range's start node\n\t\tconst region = context.activeRegion;\n\t\tif (region.startNode === null) {\n\t\t\tregion.startNode = rootNode;\n\t\t}\n\n\t\treturn rootNode;\n\t} else {\n\t\t// NOTE: We know this is not null as it is being called from generated\n\t\t// code\n\t\treturn parent.firstChild!;\n\t}\n}\n","import nodeCheckHydrationBreak from \"./nodeCheckHydrationBreak\";\n\n/**\n * Gets the sibling of a node, x nodes after it.\n *\n * When hydrating, sets the hydration node.\n *\n * @param node The node.\n * @param count The number of nodes to skip.\n */\nexport default function nodeSkip(node: ChildNode, count: number): ChildNode {\n\tlet nextNode = node;\n\n\tfor (let i = 0; i < count; i++) {\n\t\tnextNode = nodeCheckHydrationBreak(nextNode.nextSibling)!;\n\t}\n\n\t// NOTE: We know this is not null as it is being called from generated code\n\treturn nextNode!;\n}\n","import type Region from \"../types/Region\";\nimport $run from \"../watch/$run\";\nimport context from \"./context\";\nimport popRegion from \"./popRegion\";\nimport pushRegion from \"./pushRegion\";\n\n/**\n * Runs an `if`, `switch` or `await` control statement\n * @param create A function that creates the control statement's branches\n */\nexport default function runControl(\n\tregion: Region,\n\tanchor: Node | null,\n\tcreate: (anchor: Node | null) => void,\n\tname?: string,\n): void {\n\tlet first = true;\n\n\t// Run the control statement in an effect\n\t$run(function runControl() {\n\t\tconst oldRegion = pushRegion(region, first);\n\t\tfirst = false;\n\n\t\t// Run the function that creates the control statement's branches\n\t\tcreate(anchor);\n\n\t\tpopRegion(oldRegion);\n\t}, name);\n\n\t// If we're mounting, the anchor will be the one that is passed in, but if\n\t// we're hydrating it will be after the active branch's HTML elements, so we\n\t// need to update it after the branches have been hydrated\n\tif (context.hydrationNode) {\n\t\tanchor = context.hydrationNode.nextSibling;\n\t}\n}\n","import type Region from \"../types/Region\";\nimport clearRegion from \"./clearRegion\";\n\nexport default function runControlBranch(region: Region, oldIndex: number, index: number): boolean {\n\tif (oldIndex === index) return false;\n\n\t// HACK: This is bad -- it means that the parent region has been cleared,\n\t// but that should have cleared the effect that runs this child region??\n\t// TODO: Look into this further...\n\tif (region.depth === -2) return false;\n\n\t// Branching regions have exactly one child -- remove it if necessary\n\tif (region.nextRegion !== null && region.nextRegion.depth > region.depth) {\n\t\tclearRegion(region.nextRegion);\n\t}\n\n\treturn true;\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport type ProxyData from \"../types/ProxyData\";\nimport type ProxySignal from \"../types/ProxySignal\";\nimport type Subscription from \"../types/Subscription\";\nimport { COMPUTED_TYPE, EFFECT_TYPE } from \"../types/constants\";\nimport batchEnd from \"./batchEnd\";\nimport batchStart from \"./batchStart\";\n\n/**\n * When a signal is changed, we need to\n * - Set the signal's subscriptions to recalc\n * - Set any dependent computed values to recalc\n * - Gather dependent effects that will need to be re-run\n */\nexport default function propagateSignal(proxy: ProxyData, key: PropertyKey): void {\n\t//console.log(`triggering effects for '${String(key)}' on`, proxy);\n\t//console.log(\"===\");\n\t//console.log(`triggering effects for '${String(key)}'`);\n\n\tlet signal = proxy.signals.get(key) as ProxySignal;\n\tif (signal !== undefined && signal.firstTarget !== null) {\n\t\tbatchStart();\n\n\t\ttry {\n\t\t\t// Add the signal to the context for updating after triggering\n\t\t\tif (context.firstSignalToUpdate === null) {\n\t\t\t\tcontext.firstSignalToUpdate = signal;\n\t\t\t} else if (signal.nextSignalToUpdate === null) {\n\t\t\t\tlet lastSignal = context.firstSignalToUpdate;\n\t\t\t\twhile (lastSignal.nextSignalToUpdate !== null) {\n\t\t\t\t\tlastSignal = lastSignal.nextSignalToUpdate;\n\t\t\t\t}\n\t\t\t\tlastSignal.nextSignalToUpdate = signal;\n\t\t\t}\n\n\t\t\t// Cache the last effect in the chain, so we don't have to keep\n\t\t\t// looping in cases where there are lots of them for this signal\n\t\t\tlet lastEffect = context.firstEffectToRun;\n\t\t\tif (lastEffect !== null) {\n\t\t\t\twhile (lastEffect.nextEffectToRun !== null) {\n\t\t\t\t\tlastEffect = lastEffect.nextEffectToRun;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// De-activate all targets, so they can be re-used/updated/deleted,\n\t\t\t// and mark them to be recalculated\n\t\t\tlet targetSub: Subscription = signal.firstTarget;\n\t\t\tlet computed: Computed | undefined;\n\t\t\touter: while (true) {\n\t\t\t\t// De-activate all targets, so they can be re-used/updated/deleted\n\t\t\t\ttargetSub.active = false;\n\t\t\t\ttargetSub.recalc = true;\n\n\t\t\t\tconst target = targetSub.target;\n\t\t\t\tif (target.type === EFFECT_TYPE) {\n\t\t\t\t\t// Add the effect to the context for running after triggering\n\t\t\t\t\tif (lastEffect === null) {\n\t\t\t\t\t\tcontext.firstEffectToRun = target;\n\t\t\t\t\t\tlastEffect = target;\n\t\t\t\t\t} else if (target.nextEffectToRun === null && lastEffect !== target) {\n\t\t\t\t\t\tlastEffect.nextEffectToRun = target;\n\t\t\t\t\t\tlastEffect = target;\n\t\t\t\t\t}\n\t\t\t\t} else if (/*target.type === COMPUTED_TYPE*/ !target.recalc) {\n\t\t\t\t\t// This may need to be re-computed in the pull phase\n\t\t\t\t\ttarget.recalc = true;\n\n\t\t\t\t\t// Check the computed's targets\n\t\t\t\t\tif (target.firstTarget !== null) {\n\t\t\t\t\t\tcomputed = target;\n\t\t\t\t\t\tcomputed.rollback = targetSub;\n\t\t\t\t\t\ttargetSub = target.firstTarget;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If there are no more targets, we may need to rollback to the\n\t\t\t\t// last computed that had more targets\n\t\t\t\twhile (targetSub.nextTarget === null && computed !== undefined) {\n\t\t\t\t\ttargetSub = computed.rollback!;\n\t\t\t\t\tif (targetSub.source.type !== COMPUTED_TYPE) {\n\t\t\t\t\t\tcomputed = undefined;\n\t\t\t\t\t\tcontinue outer;\n\t\t\t\t\t}\n\t\t\t\t\tcomputed = targetSub.source;\n\t\t\t\t}\n\n\t\t\t\tif (targetSub.nextTarget === null) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\ttargetSub = targetSub.nextTarget;\n\t\t\t}\n\t\t} finally {\n\t\t\tbatchEnd();\n\t\t}\n\t}\n}\n","// TODO: Should these be branded?\nconst proxyDataSymbol: unique symbol = Symbol(\"_proxy_data\");\nconst proxyHandledSymbol: unique symbol = Symbol(\"_proxy_handled\");\n\nexport { proxyDataSymbol, proxyHandledSymbol };\n","import type ProxyData from \"../types/ProxyData\";\nimport { SIGNAL_TYPE } from \"../types/constants\";\nimport trackSignal from \"./trackSignal\";\n\nexport default function trackProxySignal(data: ProxyData, key: PropertyKey): void {\n\t//console.log(`tracking effect '${context.activeTarget.name}' for '${String(key)}' prop`);\n\n\t// Create or get the signals\n\tlet signal = data.signals.get(key);\n\tif (signal === undefined) {\n\t\tsignal = {\n\t\t\ttype: SIGNAL_TYPE,\n\t\t\tfirstTarget: null,\n\t\t\tnextSignalToUpdate: null,\n\t\t\t//name: dev.propName(key),\n\t\t};\n\t\tdata.signals.set(key, signal);\n\t}\n\n\ttrackSignal(signal);\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport type ProxyData from \"../types/ProxyData\";\nimport { COMPUTED_TYPE, SIGNAL_TYPE } from \"../types/constants\";\nimport $watch from \"./$watch\";\nimport checkComputed from \"./checkComputed\";\nimport propagateSignal from \"./propagateSignal\";\nimport { proxyDataSymbol } from \"./symbols\";\nimport trackProxySignal from \"./trackProxySignal\";\nimport trackSignal from \"./trackSignal\";\n\nexport default function proxyGet(\n\ttarget: Record<PropertyKey, any>,\n\tkey: PropertyKey,\n\treceiver: any,\n): any {\n\tlet data: ProxyData = target[proxyDataSymbol];\n\n\tif (key === proxyDataSymbol) {\n\t\treturn data;\n\t}\n\n\t//console.log(`object get '${String(key)}' on`, target);\n\t//console.log(`object get '${String(key)}'`);\n\n\tlet signal = data.signals.get(key);\n\tif (signal === undefined) {\n\t\tconst propDescriptor = Object.getOwnPropertyDescriptor(target, key);\n\t\tif (propDescriptor !== undefined) {\n\t\t\tif (propDescriptor.writable) {\n\t\t\t\t// Setup data for the property\n\t\t\t\tif (data.shallow !== true) {\n\t\t\t\t\t// Set the value to a new proxy if it's an object\n\t\t\t\t\tconst value = target[key];\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue !== undefined &&\n\t\t\t\t\t\tvalue !== null &&\n\t\t\t\t\t\ttypeof value === \"object\" &&\n\t\t\t\t\t\tvalue[proxyDataSymbol] === undefined &&\n\t\t\t\t\t\t// But not if it's a Promise (i.e. has a `then` method)\n\t\t\t\t\t\tvalue.then === undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\ttarget[key] = $watch(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If a property is being accessed in the course of setting up an\n\t\t\t\t// effect, track it\n\t\t\t\ttrackProxySignal(data, key);\n\t\t\t} else if (propDescriptor.get) {\n\t\t\t\t// OK, we're only checking for computed values if it's read-only for\n\t\t\t\t// now, but we probably need to check any getter's value -- e.g. the\n\t\t\t\t// user may wish to add a setter to optimistically set a value, have\n\t\t\t\t// the UI update, then set the value concretely later (e.g. if\n\t\t\t\t// updating a `count` via a fetch)\n\n\t\t\t\tconst oldRegisterComputed = context.registerComputed;\n\t\t\t\ttry {\n\t\t\t\t\t// Allow calling `$cache` to assign the computed to a proxy\n\t\t\t\t\t// signal\n\t\t\t\t\tcontext.registerComputed = (computed: Computed) => {\n\t\t\t\t\t\tdata.signals.set(key, computed);\n\t\t\t\t\t};\n\t\t\t\t\treturn Reflect.get(target, key, receiver);\n\t\t\t\t} finally {\n\t\t\t\t\tcontext.registerComputed = oldRegisterComputed;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.isArray) {\n\t\t\t// If it's a function in an array, we may intercept it\n\t\t\tif (arrayWrapper[key] !== undefined) {\n\t\t\t\treturn arrayWrapper[key](data, target, key);\n\t\t\t}\n\t\t} else {\n\t\t\t// If it's a non-existent property we still set up a subscription so\n\t\t\t// that if its value is set to something it will re-run the effect\n\t\t\ttrackProxySignal(data, key);\n\t\t}\n\t} else if (signal.type === SIGNAL_TYPE) {\n\t\t// If a property is being accessed in the course of setting up an\n\t\t// effect, track it\n\t\ttrackProxySignal(data, key);\n\t} else if (signal.type === COMPUTED_TYPE) {\n\t\tif (signal.running) {\n\t\t\tthrow new Error(\"Cycle detected\");\n\t\t} else if (signal.recalc) {\n\t\t\t// If a signal that the computed depends on has been changed,\n\t\t\t// but the computed hasn't yet been read, it may need to be\n\t\t\t// re-computed\n\t\t\tcheckComputed(signal);\n\t\t} else if (signal.didError) {\n\t\t\t// If there was a previous error, and no dependencies have\n\t\t\t// changed, throw the error again\n\t\t\tthrow signal.value;\n\t\t} else {\n\t\t\ttrackSignal(signal);\n\t\t}\n\t\treturn signal.value;\n\t}\n\n\t// Return the property value\n\treturn Reflect.get(target, key, receiver);\n}\n\n// Prevent array functions from calling functions and properties in breakable\n// ways (e.g. calling splice sets length before adding items)\nconst arrayWrapper: Record<PropertyKey, any> = {\n\t[Symbol.iterator]: function (data: ProxyData, target: any, key: PropertyKey) {\n\t\ttrackProxySignal(data, \"length\");\n\t\t// HACK: This prevents lists being re-run on every random property\n\t\t// access by disabling the active effect before properties get\n\t\t// accessed. I'm not sure if this is the best way to achieve this...\n\t\tcontext.activeTarget = null;\n\t\treturn target[key];\n\t},\n\tpop: arrayHandle,\n\tpush: arrayHandle,\n\treverse: arrayHandle,\n\tshift: arrayHandle,\n\tsort: arrayHandle,\n\tsplice: arrayHandle,\n\tunshift: arrayHandle,\n};\n\nfunction arrayHandle(data: ProxyData, target: any, key: PropertyKey): Function {\n\t// Call the function on the target (so proxy properties don't get\n\t// intercepted) and trigger effects that depend on `length`\n\treturn function (...args: any[]) {\n\t\tconst func = target[key];\n\t\tconst result = func.apply(target, args);\n\t\tpropagateSignal(data, \"length\");\n\t\treturn result;\n\t};\n}\n","import devContext from \"../dev/devContext\";\nimport context from \"../render/context\";\nimport $watch from \"./$watch\";\n//import transferEffects from \"./transferEffects\";\nimport propagateSignal from \"./propagateSignal\";\nimport { proxyDataSymbol } from \"./symbols\";\n\nexport default function proxySet(\n\ttarget: Record<PropertyKey, any>,\n\tkey: PropertyKey,\n\tvalue: any,\n\treceiver: any,\n): boolean {\n\t//console.log(`object set '${String(key)}' to`, value, \"on\", target);\n\t//console.log(`object set '${String(key)}'`);\n\n\t// Only do things if the value has changed\n\tconst oldValue = target[key];\n\tif (value !== oldValue) {\n\t\tif (context.batchOperation > 100) {\n\t\t\tthrow new Error(\"Cycle detected\");\n\t\t}\n\n\t\tlet data = target[proxyDataSymbol];\n\n\t\t// DEV:\n\t\tdevContext.signalSet(data, key);\n\n\t\t// If the value was previously a proxy, watch the new value and update\n\t\t// its effect subscriptions\n\t\tif (oldValue && oldValue[proxyDataSymbol] !== undefined) {\n\t\t\tvalue = $watch(value, { shallow: oldValue[proxyDataSymbol].shallow });\n\t\t\t//transferEffects(oldValue, newValue);\n\t\t}\n\n\t\t// Set the property value on the target\n\t\tReflect.set(target, key, value, receiver);\n\n\t\t// Re-run effects\n\t\tpropagateSignal(data, key);\n\n\t\t// If an item in an array is being set directly, trigger the length to\n\t\t// cause any lists to be re-run and data re-bound\n\t\t// TODO: Can we update the single item's data directly somehow?\n\t\tif (data.isArray && !isNaN(+String(key))) {\n\t\t\tpropagateSignal(data, \"length\");\n\t\t}\n\t}\n\n\treturn true;\n}\n","import devContext from \"../dev/devContext\";\nimport type ProxyData from \"../types/ProxyData\";\nimport type WatchOptions from \"../types/WatchOptions\";\nimport proxyGet from \"./proxyGet\";\nimport proxySet from \"./proxySet\";\nimport { proxyDataSymbol } from \"./symbols\";\n\n/**\n * Watches an object and runs effects when its properties are changed\n *\n * @param object The object to watch\n */\nexport default function $watch<T extends Record<PropertyKey, any>>(\n\tobject: T,\n\toptions?: WatchOptions,\n): T {\n\t// Return the object itself if it is undefined or null, or if it is already a proxy\n\tif (object === undefined || object === null || object[proxyDataSymbol] !== undefined) {\n\t\treturn object;\n\t}\n\n\t// DEBUG: Make sure we can proxy this value\n\t//if (typeof object !== \"object\") {\n\t//\tthrow new Error(`$watch can't be called with a ${typeof object}`);\n\t//}\n\n\t// Create a proxy handler for each object, and store some data for it here\n\tconst data: ProxyData = {\n\t\ttarget: object,\n\t\tisArray: Array.isArray(object),\n\t\tshallow: options?.shallow === true,\n\t\tsignals: new Map(),\n\t};\n\n\t// @ts-ignore\n\tobject[proxyDataSymbol] = data;\n\n\tconst handler: ProxyHandler<T> = {\n\t\tget: proxyGet,\n\t\tset: proxySet,\n\t};\n\n\tconst proxy = new Proxy(object, handler) as T;\n\n\t// DEV:\n\tdevContext.onWatch(data);\n\n\treturn proxy;\n}\n","import type Region from \"../types/Region\";\n\nexport default function moveRegion(parent: Node, region: Region, before: ChildNode | null): void {\n\tparent = before?.parentNode ?? parent;\n\tconst endNode = region.endNode ?? region.startNode;\n\tlet currentNode = region.startNode;\n\n\twhile (currentNode !== null) {\n\t\tconst nextNode = currentNode.nextSibling;\n\t\tparent.insertBefore(currentNode, before);\n\t\tif (currentNode === endNode) break;\n\t\tcurrentNode = nextNode;\n\t}\n}\n","// Adapted from https://github.com/snabbdom/snabbdom\n// With changes from https://github.com/luwes/js-diff-benchmark\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Simon Friis Vindum\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport type ListItem from \"../types/ListItem\";\nimport type Region from \"../types/Region\";\nimport $watch from \"../watch/$watch\";\nimport clearRegion from \"./clearRegion\";\nimport moveRegion from \"./moveRegion\";\nimport popRegion from \"./popRegion\";\nimport pushRegion from \"./pushRegion\";\n\n/**\n * @param region The list's region\n * @param parent The parent DOM element\n * @param anchor The DOM element to create new items before\n * @param oldItems The list of current items\n * @param newItems The list of future items\n * @param create A function that creates the DOM elements for a new item\n */\nexport default function runListItems(\n\tregion: Region,\n\tparent: ParentNode,\n\tanchor: Node | null,\n\toldItems: ListItem[],\n\tnewItems: ListItem[],\n\tcreate: (item: ListItem, before: Node | null) => void,\n\tupdate: (oldItem: ListItem, newItem: ListItem) => void,\n): void {\n\tlet oldStartIndex = 0;\n\tlet oldEndIndex = oldItems.length - 1;\n\tlet oldStartItem = oldItems[0];\n\tlet oldEndItem = oldItems[oldEndIndex];\n\n\tlet newStartIndex = 0;\n\tlet newEndIndex = newItems.length - 1;\n\tlet newStartItem = newItems[0];\n\tlet newEndItem = newItems[newEndIndex];\n\n\tlet oldKeyToIndex: Map<any, number> | undefined;\n\tlet newKeyToIndex: Map<any, number> | undefined;\n\n\twhile (oldStartIndex <= oldEndIndex && newStartIndex <= newEndIndex) {\n\t\tif (oldStartItem === null) {\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t} else if (oldEndItem === null) {\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t} else if (newStartItem === null) {\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else if (newEndItem === null) {\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldStartItem.key === newStartItem.key) {\n\t\t\ttransferListItemData(oldStartItem, newStartItem, update);\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else if (oldEndItem.key === newEndItem.key) {\n\t\t\ttransferListItemData(oldEndItem, newEndItem, update);\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldStartItem.key === newEndItem.key) {\n\t\t\t// Move to the end\n\t\t\t//console.log(\"move\", oldStartItem.key, \"to the end\");\n\t\t\tmoveRegion(parent, oldStartItem, oldEndItem.endNode!.nextSibling!);\n\t\t\ttransferListItemData(oldStartItem, newEndItem, update);\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldEndItem.key === newStartItem.key) {\n\t\t\t// Move to the start\n\t\t\t//console.log(\"move\", oldEndItem.key, \"to the start\");\n\t\t\tmoveRegion(parent, oldEndItem, oldStartItem!.startNode);\n\t\t\ttransferListItemData(oldEndItem, newStartItem, update);\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else {\n\t\t\t// Lazily build maps of keys to indexes here\n\t\t\t// They are relevant only if there has been a move, or a mid-list\n\t\t\t// insertion or deletion, and not if there has been an insertion\n\t\t\t// at the end or deletion from the front\n\t\t\tif (oldKeyToIndex === undefined || newKeyToIndex === undefined) {\n\t\t\t\toldKeyToIndex = new Map();\n\t\t\t\tfor (let i = oldStartIndex; i < oldEndIndex; i++) {\n\t\t\t\t\toldKeyToIndex.set(oldItems[i].key, i);\n\t\t\t\t}\n\t\t\t\tnewKeyToIndex = new Map();\n\t\t\t\tfor (let i = newStartIndex; i < newEndIndex; i++) {\n\t\t\t\t\tnewKeyToIndex.set(newItems[i].key, i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet oldIndex = oldKeyToIndex.get(newStartItem.key);\n\t\t\tlet newIndex = newKeyToIndex.get(oldStartItem.key);\n\n\t\t\tif (oldIndex === undefined && newIndex === undefined) {\n\t\t\t\t// Replace\n\t\t\t\t//console.log(\"replace\", oldStartItem.key, \"with\", newStartItem.key);\n\t\t\t\tconst oldRegion = pushRegion(newStartItem, true);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data, { shallow: true });\n\t\t\t\tcreate(newStartItem, oldStartItem.startNode);\n\t\t\t\tpopRegion(oldRegion);\n\t\t\t\tnewStartItem.previousRegion = oldStartItem.previousRegion;\n\t\t\t\tnewStartItem.nextRegion = oldStartItem;\n\t\t\t\toldStartItem.previousRegion = newStartItem;\n\t\t\t\tclearRegion(oldStartItem);\n\t\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t} else if (oldIndex === undefined) {\n\t\t\t\t// Insert\n\t\t\t\t//console.log(\"insert\", newStartItem.key);\n\t\t\t\tconst oldRegion = pushRegion(newStartItem, true);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data, { shallow: true });\n\t\t\t\tcreate(newStartItem, oldStartItem.startNode);\n\t\t\t\tpopRegion(oldRegion);\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t} else if (newIndex === undefined) {\n\t\t\t\t// Delete\n\t\t\t\t//console.log(\"delete\", oldStartItem.key);\n\t\t\t\tclearRegion(oldStartItem);\n\t\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\t} else {\n\t\t\t\t// Move\n\t\t\t\t//console.log(\"move\", newStartItem.key, \"before\", oldStartItem.key);\n\t\t\t\tconst oldData = oldItems[oldIndex];\n\t\t\t\tmoveRegion(parent, oldData, oldStartItem.startNode);\n\t\t\t\ttransferListItemData(oldData, newStartItem, update);\n\t\t\t\t// @ts-ignore TODO: Set key null instead?\n\t\t\t\toldItems[oldIndex] = null;\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (oldStartIndex <= oldEndIndex || newStartIndex <= newEndIndex) {\n\t\tif (oldStartIndex > oldEndIndex) {\n\t\t\t// The old list is exhausted; process new list additions\n\t\t\t// HACK: I think it would be better to move anchors to the end?\n\t\t\tlet before =\n\t\t\t\toldStartItem?.startNode ?? oldItems[oldItems.length - 1]?.endNode?.nextSibling ?? anchor;\n\t\t\tfor (newStartIndex; newStartIndex <= newEndIndex; newStartItem = newItems[++newStartIndex]) {\n\t\t\t\t//console.log(\"create\", newStartItem.key);\n\t\t\t\tconst oldRegion = pushRegion(newStartItem, true);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data, { shallow: true });\n\t\t\t\tcreate(newStartItem, before);\n\t\t\t\tpopRegion(oldRegion);\n\t\t\t\tbefore = newStartItem.endNode!.nextSibling;\n\t\t\t}\n\t\t} else {\n\t\t\t// The new list is exhausted; process old list removals\n\t\t\tfor (oldEndIndex; oldEndIndex >= oldStartIndex; oldStartItem = oldItems[oldEndIndex--]) {\n\t\t\t\t//console.log(\"clear\", oldStartItem.key);\n\t\t\t\tclearRegion(oldStartItem);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (newItems.length > 0) {\n\t\tregion.nextRegion = newItems[0];\n\t} else if (oldItems.length > 0) {\n\t\tregion.nextRegion = oldItems[oldItems.length - 1].nextRegion;\n\t}\n}\n\nfunction transferListItemData(\n\toldItem: ListItem,\n\tnewItem: ListItem,\n\tupdate: (oldItem: ListItem, newItem: ListItem) => void,\n) {\n\tnewItem.startNode = oldItem.startNode;\n\tnewItem.endNode = oldItem.endNode;\n\n\t// Manually transfer the new data's props to the old ones (to run effects)\n\t// and then set the new data to the old one\n\tupdate(oldItem, newItem);\n\tnewItem.data = oldItem.data;\n\n\t// HACK: This is just for dev tools, so we have the right `name [id]`\n\tnewItem.name = oldItem.name;\n}\n","import type ListItem from \"../types/ListItem\";\nimport type Region from \"../types/Region\";\nimport $run from \"../watch/$run\";\nimport context from \"./context\";\nimport popRegion from \"./popRegion\";\nimport pushRegion from \"./pushRegion\";\nimport runListItems from \"./runListItems\";\n\n/**\n * Runs a `for` control statement\n * @param create A function that creates the control statement's branches\n */\nexport default function runList(\n\tregion: Region,\n\tparent: ParentNode,\n\tanchor: Node | null,\n\tbuildItems: () => ListItem[],\n\tcreate: (item: ListItem, anchor: Node | null) => void,\n\tupdate: (oldItem: ListItem, newItem: ListItem) => void,\n): void {\n\tlet first = true;\n\tlet listItems: ListItem[] = [];\n\n\t// Run the list in an effect\n\t$run(function runList() {\n\t\tconst oldRegion = pushRegion(region, first);\n\t\tfirst = false;\n\n\t\t// Build the array of items with keys and data\n\t\tconst newItems = buildItems();\n\n\t\t// Do NOT re-run the list for properties accessed while updating its\n\t\t// items. E.g. we want to re-run the list for `@for (item of $items)`\n\t\t// (in buildItems, above) but not for `<span>{item.id}</span>` (in\n\t\t// runListItems, below)\n\t\tcontext.activeTarget = null;\n\n\t\t// Run the function that updates the list's items\n\t\trunListItems(region, parent, anchor, listItems, newItems, create, update);\n\n\t\tlistItems = newItems;\n\n\t\tpopRegion(oldRegion);\n\t});\n\n\t// If we're mounting, the anchor will be the one that is passed in, but if\n\t// we're hydrating it will be after the items' HTML elements, so we need to\n\t// update it after all of the items have been hydrated\n\tif (context.hydrationNode !== null) {\n\t\tanchor = context.hydrationNode.nextSibling;\n\t}\n}\n","export default function setAttribute(el: Element, name: string, value: any): void {\n\tif (value === false || value === undefined || value === null) {\n\t\tel.removeAttribute(name);\n\t} else {\n\t\tel.setAttribute(name, value);\n\t}\n}\n","import context from \"./context\";\n\n// TODO: Should we @toggle this instead? That would call onmount etc again for the new element\n\nexport default function setDynamicElement(el: HTMLElement, tag: string): HTMLElement {\n\t// If hydrating, it should already have been created as the correct element\n\tif (context.hydrationNode !== null) {\n\t\treturn el;\n\t}\n\n\t// Replace the old element with the new element\n\tlet newElement = el.ownerDocument.createElement(tag);\n\tel.replaceWith(newElement);\n\n\treturn newElement;\n}\n","import context from \"../render/context\";\nimport batchEnd from \"./batchEnd\";\nimport batchStart from \"./batchStart\";\n\n/**\n * Runs updates to proxy values in a batch, where the updates are stored in\n * context, and dependent effects are run all at once at the end.\n *\n * @param fn The function containing the batched updates to run.\n */\nexport default function $batch<T>(fn: () => T): T {\n\tif (context.batch > 0) {\n\t\treturn fn();\n\t}\n\n\tbatchStart();\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tbatchEnd();\n\t}\n}\n","import context from \"../render/context\";\nimport type Computed from \"../types/Computed\";\nimport { COMPUTED_TYPE } from \"../types/constants\";\nimport runComputed from \"./runComputed\";\n\n/**\n * Caches a computed value from signals accessed in a property getter.\n *\n * @param fn The function containing the signals to compute and cache.\n */\nexport default function $cache<T>(fn: () => T): T {\n\tif (context.registerComputed === null) {\n\t\tthrow new Error(\"$cache must be used in a getter\");\n\t}\n\n\tlet computed: Computed = {\n\t\ttype: COMPUTED_TYPE,\n\t\tvalue: null,\n\t\trun: fn,\n\t\tfirstSource: null,\n\t\tfirstTarget: null,\n\t\trecalc: false,\n\t\trunning: false,\n\t\tdidError: false,\n\t\trollback: null,\n\t\t//name: dev.effectName(fn),\n\t};\n\n\tcontext.registerComputed(computed);\n\n\trunComputed(computed);\n\n\treturn computed.value;\n}\n","import context from \"../render/context\";\nimport type Cleanup from \"../types/Cleanup\";\n\n/**\n * Runs and re-runs a function on component mount\n *\n * @param fn The function to run, which may return a cleanup function\n */\nexport default function $mount(fn: () => Cleanup | void): void {\n\tcontext.mountEffects.push(fn);\n}\n","import context from \"../render/context\";\n\n// Not sure if this is a good idea?\n\nexport default function $peek<T>(fn: () => T): T {\n\tconst oldActiveTarget = context.activeTarget;\n\tcontext.activeTarget = null;\n\n\tconst result = fn();\n\n\tcontext.activeTarget = oldActiveTarget;\n\n\treturn result;\n}\n","import { proxyDataSymbol } from \"./symbols\";\n\n/**\n * Returns the target object of a proxy\n *\n * @param object The proxy object\n */\nexport default function $unwrap<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object !== undefined && object !== null && object[proxyDataSymbol] !== undefined\n\t\t? (object[proxyDataSymbol].target ?? object)\n\t\t: object;\n}\n","import type ProxyData from \"../types/ProxyData\";\nimport propagateSignal from \"../watch/propagateSignal\";\nimport { proxyDataSymbol, proxyHandledSymbol } from \"../watch/symbols\";\nimport trackProxySignal from \"../watch/trackProxySignal\";\n\n// NOTE: this is mostly copied from SvelteDate, without the memoization\n// I'm not 100% sold on it, maybe it would be better to intercept $watch calls on a Date?\n\nlet initialized = false;\n\n/**\n * Wraps a Date object for $watching.\n */\nexport default class ReactiveDate extends Date {\n\tconstructor(...params: any[]) {\n\t\t// @ts-ignore\n\t\tsuper(...params);\n\n\t\tif (!initialized) {\n\t\t\tthis.#init();\n\t\t}\n\n\t\t// @ts-ignore\n\t\tthis[proxyHandledSymbol] = true;\n\t\t// @ts-ignore\n\t\tthis[proxyDataSymbol] = {\n\t\t\ttarget: this,\n\t\t\tisArray: false,\n\t\t\tshallow: true,\n\t\t\tsignals: new Map(),\n\t\t} satisfies ProxyData;\n\t}\n\n\t#init() {\n\t\tinitialized = true;\n\n\t\tlet reactivePrototype = ReactiveDate.prototype;\n\t\tlet datePrototype = Date.prototype;\n\n\t\tconst methods = Object.getOwnPropertyNames(datePrototype);\n\n\t\tfor (const method of methods) {\n\t\t\tif (method.startsWith(\"get\") || method.startsWith(\"to\") || method === \"valueOf\") {\n\t\t\t\t// @ts-ignore\n\t\t\t\treactivePrototype[method] = function (...args) {\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tconst data = this[proxyDataSymbol];\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tconst result = datePrototype[method].apply(this, args);\n\t\t\t\t\ttrackProxySignal(data, \"#time\");\n\t\t\t\t\treturn result;\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (method.startsWith(\"set\")) {\n\t\t\t\t// @ts-ignore\n\t\t\t\treactivePrototype[method] = function (...args) {\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tconst data = this[proxyDataSymbol];\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tconst result = datePrototype[method].apply(this, args);\n\t\t\t\t\tpropagateSignal(data, \"#time\");\n\t\t\t\t\treturn result;\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":";;;;AAMA,MAAMA,iBAAgC,OAAO,IAAI,YAAY;AAE7D,MAAMC,UAEJ,WAAW,oBAAoB;CAC/B,cAAc;CACd,gBAAgB;CAChB,QAAQ;CACR,OAAO;CACP,gBAAgB;CAChB,kBAAkB;CAElB,kBAAkB;CAClB,qBAAqB;CAGrB,cAAc;CACd,gBAAgB;CAChB,YAAY;CAEZ,cAAc,EAAE;CAChB,eAAe,EAAE;CACjB,mBAAmB,EAAE;CAErB,eAAe;CASf;AAEF,sBAAe;;;;ACtCf,SAAwB,aAAa,IAAiB,OAAmB,MAAwB;AAKhG,iBAAQ,kBAAkB,KAAK;EAC9B,QAAQC,gBAAQ;EAChB;EACA,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,IAAI,OAAO,WAAW,KAAK,IAAI,WAAW,UAErE,mBAAkB,UAAU,SAAU,GAAG,MAAM;IAE9C,MAAM,OAAO,KAAK;IAElB,MAAM,SAAS,cAAc,QAAQ,MAAM,MAAM,KAAK;AACtD,qBAAiB,MAAM,QAAQ;AAC/B,WAAO;;AAIT,OAAI,OAAO,WAAW,MAAM,CAE3B,mBAAkB,UAAU,SAAU,GAAG,MAAM;IAE9C,MAAM,OAAO,KAAK;IAElB,MAAM,SAAS,cAAc,QAAQ,MAAM,MAAM,KAAK;AACtD,oBAAgB,MAAM,QAAQ;AAC9B,WAAO"}
package/dist/index.d.cts CHANGED
@@ -132,10 +132,10 @@ declare function pushRegion(region: Region, toParent?: boolean): Region;
132
132
  * Runs an `if`, `switch` or `await` control statement
133
133
  * @param create A function that creates the control statement's branches
134
134
  */
135
- declare function runControl(region: Region, anchor: Node | null, create: (anchor: Node | null) => void): void;
135
+ declare function runControl(region: Region, anchor: Node | null, create: (anchor: Node | null) => void, name?: string): void;
136
136
  //#endregion
137
137
  //#region src/render/runControlBranch.d.ts
138
- declare function runControlBranch(region: Region, create: () => void, name?: string): void;
138
+ declare function runControlBranch(region: Region, oldIndex: number, index: number): boolean;
139
139
  //#endregion
140
140
  //#region src/render/runList.d.ts
141
141
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types/Animation.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/clearLayoutSlot.ts","../src/render/fillLayoutSlot.ts","../src/render/getFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/types/ListItem.ts","../src/render/newListItem.ts","../src/render/newRegion.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeNext.ts","../src/render/nodeRoot.ts","../src/render/nodeSkip.ts","../src/render/popRegion.ts","../src/render/pushRegion.ts","../src/render/runControl.ts","../src/render/runControlBranch.ts","../src/render/runList.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts","../src/watch/$batch.ts","../src/watch/$cache.ts","../src/watch/$mount.ts","../src/watch/$peek.ts","../src/watch/$run.ts","../src/watch/$unwrap.ts","../src/types/WatchOptions.ts","../src/watch/$watch.ts","../src/wrappers/ReactiveDate.ts"],"sourcesContent":[],"mappings":";;;;;;UAAyB,SAAA;aACb,aAAa;qBACL;;;;iBCCI,YAAA,KAAiB,qBAAqB,kBAAkB;;;iBCDxD,QAAA,KACnB,yCAEc;;;iBCAK,WAAA,WACb,0BACF,oBACA,uBACE;;;iBCPa,UAAA,KACnB,gBACG;;;iBCAgB,eAAA,SAAwB;;;iBCIxB,cAAA,YACZ,iBACL,oBACE,oBACA,sBACC,mCACE,OAAO,oBAChB;;;iBCfqB,WAAA,WACb,iBACH,gEAIL;;;;;;;;;APLsB,iBQaD,OAAA,CRbC,MAAA,EQchB,URdgB,EAAA,SAAA,EQeb,SRfa,EAAA,KAAA,CAAA,EQgBhB,MRhBgB,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,KAAA,CAAA,EQiBhB,MRjBgB,CAAA,MAAA,EQiBD,URjBC,CAAA,CAAA,EAAA,IAAA;;;;;;;;;;AACL,iBSYI,KAAA,CTZJ,MAAA,ESaX,UTbW,EAAA,SAAA,EScR,STdQ,EAAA,KAAA,CAAA,ESeX,MTfW,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,KAAA,CAAA,ESgBX,MThBW,CAAA,MAAA,ESgBI,UThBJ,CAAA,CAAA,EAAA,IAAA;;;UUAK,QAAA,SAAiB;QACnC;;;;;iBCDiB,WAAA,OACjB,OAAO,8CAGX;;;iBCJqB,SAAA,iBAA0B;;;;;;;;;;;;;;;;;AXC1B,iBYgBA,UAAA,CZhBA,IAAA,EYgBiB,SZhBjB,CAAA,EYgB6B,SZhB7B;;;;;;;;;;ADFZ,iBcQY,SAAA,CdRZ,MAAA,EcQ8B,IdR9B,CAAA,EcQqC,SdRrC;;;;;;;;;;;AAAa,i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AAA,EAAA,IAAA,CAAA,EAAA,MAAA,CAAA,E6BY2D,M7BZ3D;;;;;;;;iB8BMY,kBAAkB,OAAO,2BAA2B,IAAI;;;;;;UCJvD,YAAA;;;;E/BFb,OAAA,CAAA,EAAA,OAAA;;;;;;;;;AADa,iBgCYD,MhCZC,CAAA,UgCYgB,MhCZhB,CgCYuB,WhCZvB,EAAA,GAAA,CAAA,CAAA,CAAA,MAAA,EgCahB,ChCbgB,EAAA,OAAA,CAAA,EgCcd,YhCdc,CAAA,EgCetB,ChCfsB;;;;;;ciCaJ,YAAA,SAAqB,IAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types/Animation.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/clearLayoutSlot.ts","../src/render/fillLayoutSlot.ts","../src/render/getFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/types/ListItem.ts","../src/render/newListItem.ts","../src/render/newRegion.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeNext.ts","../src/render/nodeRoot.ts","../src/render/nodeSkip.ts","../src/render/popRegion.ts","../src/render/pushRegion.ts","../src/render/runControl.ts","../src/render/runControlBranch.ts","../src/render/runList.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts","../src/watch/$batch.ts","../src/watch/$cache.ts","../src/watch/$mount.ts","../src/watch/$peek.ts","../src/watch/$run.ts","../src/watch/$unwrap.ts","../src/types/WatchOptions.ts","../src/watch/$watch.ts","../src/wrappers/ReactiveDate.ts"],"sourcesContent":[],"mappings":";;;;;;UAAyB,SAAA;aACb,aAAa;qBACL;;;;iBCCI,YAAA,KAAiB,qBAAqB,kBAAkB;;;iBCDxD,QAAA,KACnB,yCAEc;;;iBCAK,WAAA,WACb,0BACF,oBACA,uBACE;;;iBCPa,UAAA,KACnB,gBACG;;;iBCAgB,eAAA,SAAwB;;;iBCIxB,cAAA,YACZ,iBACL,oBACE,oBACA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;
132
132
  * Runs an `if`, `switch` or `await` control statement
133
133
  * @param create A function that creates the control statement's branches
134
134
  */
135
- declare function runControl(region: Region, anchor: Node | null, create: (anchor: Node | null) => void): void;
135
+ declare function runControl(region: Region, anchor: Node | null, create: (anchor: Node | null) => void, name?: string): void;
136
136
  //#endregion
137
137
  //#region src/render/runControlBranch.d.ts
138
- declare function runControlBranch(region: Region, create: () => void, name?: string): void;
138
+ declare function runControlBranch(region: Region, oldIndex: number, index: number): boolean;
139
139
  //#endregion
140
140
  //#region src/render/runList.d.ts
141
141
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/Animation.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/clearLayoutSlot.ts","../src/render/fillLayoutSlot.ts","../src/render/getFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/types/ListItem.ts","../src/render/newListItem.ts","../src/render/newRegion.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeNext.ts","../src/render/nodeRoot.ts","../src/render/nodeSkip.ts","../src/render/popRegion.ts","../src/render/pushRegion.ts","../src/render/runControl.ts","../src/render/runControlBranch.ts","../src/render/runList.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts","../src/watch/$batch.ts","../src/watch/$cache.ts","../src/watch/$mount.ts","../src/watch/$peek.ts","../src/watch/$run.ts","../src/watch/$unwrap.ts","../src/types/WatchOptions.ts","../src/watch/$watch.ts","../src/wrappers/ReactiveDate.ts"],"sourcesContent":[],"mappings":";;;;;;UAAyB,SAAA;aACb,aAAa;qBACL;;;;iBCCI,YAAA,KAAiB,qBAAqB,kBAAkB;;;iBCDxD,QAAA,KACnB,yCAEc;;;iBCAK,WAAA,WACb,0BACF,oBACA,uBACE;;;iBCPa,UAAA,KACnB,gBACG;;;iBCAgB,eAAA,SAAwB;;;iBCIxB,cAAA,YACZ,iBACL,oBACE,oBACA,sBACC,mC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ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/clearLayoutSlot.ts","../src/render/fillLayoutSlot.ts","../src/render/getFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/types/ListItem.ts","../src/render/newListItem.ts","../src/render/newRegion.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeNext.ts","../src/render/nodeRoot.ts","../src/render/nodeSkip.ts","../src/render/popRegion.ts","../src/render/pushRegion.ts","../src/render/runControl.ts","../src/render/runControlBranch.ts","../src/render/runList.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts","../src/watch/$batch.ts","../src/watch/$cache.ts","../src/watch/$mount.ts","../src/watch/$peek.ts","../src/watch/$run.ts","../src/watch/$unwrap.ts","../src/types/WatchOptions.ts","../src/watch/$watch.ts","../src/wrappers/ReactiveDate.ts"],"sourcesContent":[],"mappings":";;;;;;UAAyB,SAAA;aACb,aAAa;qBACL;;;;iBCCI,YAAA,KAAiB,qBAAqB,kBAAkB;;;iBCDxD,QAAA,KACnB,yCAEc;;;iBCAK,WAAA,WACb,0BACF,oBACA,uBACE;;;iBCPa,UAAA,KACnB,gBACG;;;iBCAgB,eAAA,SAAwB;;;iBCIxB,cAAA,YACZ,iBACL,oBACE,oBACA,sBACC,mCACE,OAAO,oBAChB;;;iBCfqB,WAAA,WACb,iBACH,gEAIL;;;;;;;;;APLsB,iBQaD,OAAA,CRbC,MAAA,EQchB,URdgB,EAAA,SAAA,EQeb,SRfa,EAAA,KAAA,CAAA,EQgBhB,MRhBgB,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,KAAA,CAAA,EQiBhB,MRjBgB,CAAA,MAAA,EQiBD,URjBC,CAAA,CAAA,EAAA,IAAA;;;;;;;;;;AACL,iBSYI,KAAA,CTZJ,MAAA,ESaX,UTbW,EAAA,SAAA,EScR,STdQ,EAAA,KAAA,CAAA,ESeX,MTfW,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,KAAA,CAAA,ESgBX,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