@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.
- package/CHANGELOG.md +13 -0
- package/dist/compile.cjs +75 -77
- package/dist/compile.cjs.map +1 -1
- package/dist/compile.js +75 -77
- package/dist/compile.js.map +1 -1
- package/dist/index.cjs +6 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/compile/build/client/buildAwaitNode.ts +32 -34
- package/src/compile/build/client/buildCode.ts +1 -10
- package/src/compile/build/client/buildHtmlNode.ts +11 -3
- package/src/compile/build/client/buildIfNode.ts +18 -26
- package/src/compile/build/client/buildReplaceNode.ts +10 -2
- package/src/compile/build/client/buildSwitchNode.ts +18 -26
- package/src/render/runControl.ts +2 -1
- package/src/render/runControlBranch.ts +6 -13
- package/src/watch/proxySet.ts +1 -1
- package/test/attributes/components/output/Attributes-client.ts +0 -2
- package/test/attributes/components/output/Disappearing-client.ts +0 -2
- package/test/attributes/components/temp/{Attributes-client-b9b98b8c868cc4f13484ae2237d59ef9491dfbf3.ts → Attributes-client-63bd49fe97fb8d775ef291fa19b8f03075020f63.ts} +0 -2
- package/test/attributes/components/temp/{Disappearing-client-b9b98b8c868cc4f13484ae2237d59ef9491dfbf3.ts → Disappearing-client-63bd49fe97fb8d775ef291fa19b8f03075020f63.ts} +0 -2
- package/test/await/components/output/Await-client.ts +49 -42
- package/test/await/components/temp/{Await-client-284921284e6ae52b607902682f7f9b69bffe1515.ts → Await-client-5ad15bc135417fa095bb5c95c7407a02a444a272.ts} +49 -42
- package/test/bind/components/output/BindComponent-client.ts +0 -4
- package/test/bind/components/output/BindText-client.ts +0 -2
- package/test/bind/components/temp/{BindComponent-client-acbb75b9dc9685722e49a937138b8f8d2e5f0539.ts → BindComponent-client-44f487e4c31612483ff002a7dea91925dd37b96b.ts} +0 -4
- package/test/bind/components/temp/{BindText-client-12ad90dae9678c8cdc7d8f2266ff6ed58824d57e.ts → BindText-client-74b797d8a10d8f18a71ef121dbb9eaec9c8dd67a.ts} +0 -2
- package/test/child-component/components/output/ChildComponent-client.ts +0 -4
- package/test/child-component/components/temp/{ChildComponent-client-63a83042fd341882e31e4fe9344294cbe83f00e5.ts → ChildComponent-client-3f29b8db2e610cbcb200af36721456404ed29dca.ts} +0 -4
- package/test/class/components/output/Class-client.ts +0 -4
- package/test/class/components/temp/{Class-client-919c8e138d3885b62ad3440c2d6925edae8e4892.ts → Class-client-0741f12141ba1e5d531ca6cc9becc0511ff0c502.ts} +0 -4
- package/test/component/components/output/Component-client.ts +0 -4
- package/test/component/components/temp/{Component-client-a433db324e16bc80b647022bba8717c7b5d285a6.ts → Component-client-8255e6a16f9dc01f64b88808bc92003396794fa5.ts} +0 -4
- package/test/console/components/output/Console-client.ts +0 -2
- package/test/console/components/temp/{Console-client-2d6a441342c992f6be9f4139a3354055f7aa6c41.ts → Console-client-bf26a9f6c8785ce09608d36fae616de0724a2355.ts} +0 -2
- package/test/const/components/output/Const-client.ts +0 -2
- package/test/const/components/temp/{Const-client-9d8262840860a5cb686c4923d0c8567ffc704b35.ts → Const-client-111aef0ff3a14c98eed9dba0a6205bd4509ccf29.ts} +0 -2
- package/test/context/components/output/Context-client.ts +0 -6
- package/test/context/components/temp/{Context-client-c1437b9cb8765f3d73b315982dd52e8458345da9.ts → Context-client-a4b608a96e3a3763ad9d660e1bc0836a105b9ea3.ts} +0 -6
- package/test/effects/components/output/ForEffect-client.ts +0 -2
- package/test/effects/components/output/IfEffect-client.ts +24 -27
- package/test/effects/components/output/NestedIfEffect-client.ts +46 -52
- package/test/effects/components/temp/{ForEffect-client-74072b430ca76fba1ebcad8bbc14754874f60969.ts → ForEffect-client-15144e8e55d99b6495affdb158cf95b301713f1a.ts} +0 -2
- package/test/effects/components/temp/{IfEffect-client-bdc34d65604493fc1475e2e98f7ae262a0ca5f34.ts → IfEffect-client-792e4b6c568e2cffad16c0b64ffd39928566c534.ts} +24 -27
- package/test/effects/components/temp/NestedIfEffect-client-724b09d88afd0eb4df459082ada91ac041825f7a.ts +89 -0
- package/test/events/components/output/Events-client.ts +0 -2
- package/test/events/components/temp/{Events-client-a02f139a6aed6e9105eeb23cee802f3d1b8550e5.ts → Events-client-3224d5bbbc6d4188c566cfa86659e546a886877a.ts} +0 -2
- package/test/for/components/output/For-client.ts +0 -2
- package/test/for/components/output/ForAfterFor-client.ts +0 -2
- package/test/for/components/output/ForContainingFor-client.ts +0 -2
- package/test/for/components/output/ForContainingFunction-client.ts +0 -2
- package/test/for/components/output/ForContainingIf-client.ts +18 -24
- package/test/for/components/output/ForEscape-client.ts +0 -2
- package/test/for/components/output/ForIn-client.ts +0 -2
- package/test/for/components/output/ForOf-client.ts +0 -2
- package/test/for/components/temp/{For-client-b999b399f32cac80c8ca1c9a718e35705a2dc10f.ts → For-client-287e5695f24f6700158d2c689fdce1916031b4d7.ts} +0 -2
- package/test/for/components/temp/{ForAfterFor-client-315138c704ee78185fbaf09a3f055e4c00a3a91d.ts → ForAfterFor-client-bc375829d736a62ee760f32a5a90df78426c8534.ts} +0 -2
- package/test/for/components/temp/{ForContainingFor-client-d9ed22634282fabc29ed8bdd5e4cb3ee699f5f56.ts → ForContainingFor-client-d80aba5977a7cef8263f0fdaf6216e19bb8b0625.ts} +0 -2
- package/test/for/components/temp/{ForContainingFunction-client-a1a63d73cf56ffc50e5f46cd2e2cc71bf0ebaa4c.ts → ForContainingFunction-client-bcb91a1c7ad2fd4e227fc40f28f01e7fdc495bdc.ts} +0 -2
- package/test/for/components/temp/{ForContainingIf-client-9fd42948e04eeb5114d22c4d986e27a101c7e73a.ts → ForContainingIf-client-8911d18357f7c81f97d64773442275c802292ae7.ts} +18 -24
- package/test/for/components/temp/{ForEscape-client-f6ee68cf9081cecccc78d793da192df403a573d4.ts → ForEscape-client-13038740272dd6b7fa9f228ae852e3d1b2725f88.ts} +0 -2
- package/test/for/components/temp/{ForIn-client-f82576cc3c950432fec8c196ba25596f191177ae.ts → ForIn-client-9f244dfd10d0439f14719e724aefc908174fe4e3.ts} +0 -2
- package/test/for/components/temp/{ForOf-client-1a89bfa049d931c7ec848d80196cd75bc67868a6.ts → ForOf-client-b0e33a686f4183a88aa06af7f2255e7210438fce.ts} +0 -2
- package/test/function/components/output/Function-client.ts +0 -2
- package/test/function/components/temp/{Function-client-a9072c015aa3f89966fbfc905109c2c6ecac3846.ts → Function-client-a2603b20a7f8763ba9713b04c42da56c2ee2056e.ts} +0 -2
- package/test/html/components/output/Html-client.ts +10 -8
- package/test/html/components/temp/{Html-client-206a7cd3478abde0e6902a8cb953dc20d6a2cd3f.ts → Html-client-da930140bd62a34408887d13aafebbe856065bef.ts} +10 -8
- package/test/html/html.test.ts +1 -0
- package/test/if/components/output/ElseIfTrue-client.ts +34 -35
- package/test/if/components/output/ElseTrue-client.ts +34 -35
- package/test/if/components/output/IfAfterIf-client.ts +30 -38
- package/test/if/components/output/IfCache-client.ts +29 -32
- package/test/if/components/output/IfContainingFor-client.ts +53 -59
- package/test/if/components/output/IfContainingFunction-client.ts +21 -26
- package/test/if/components/output/IfContainingIf-client.ts +46 -52
- package/test/if/components/output/IfElseFalse-client.ts +24 -27
- package/test/if/components/output/IfElseTrue-client.ts +24 -27
- package/test/if/components/output/IfFalse-client.ts +16 -21
- package/test/if/components/output/IfNested-client.ts +54 -58
- package/test/if/components/temp/ElseIfTrue-client-b9fc7dd83aae7205745ae376e2081befa33e320c.ts +77 -0
- package/test/if/components/temp/ElseTrue-client-b9fc7dd83aae7205745ae376e2081befa33e320c.ts +77 -0
- package/test/if/components/temp/{IfAfterIf-client-b042b5047978b9054a6a89e45f4d157249885821.ts → IfAfterIf-client-e463e4db80127acc2ed0c4da349ecaa4c5b0ce1a.ts} +30 -38
- package/test/if/components/temp/{IfCache-client-3d0bc2841d050f6d86bbccddfdcaf0b0b781ab87.ts → IfCache-client-e892165cad33a1052bb248fe10e1b3aa9dffbf01.ts} +29 -32
- package/test/if/components/temp/IfContainingFor-client-0835d2155fd73b40d06b77d9f5af380a1d209e4e.ts +105 -0
- package/test/if/components/temp/{IfContainingFunction-client-b3a3e7e2b2b44618fa722403d51717532fc237e4.ts → IfContainingFunction-client-2c1a9e5da9fb9a85cae8123f30c23ccc851c9803.ts} +21 -26
- package/test/if/components/temp/IfContainingIf-client-517b94a34195618e4e58cabdfdb402288379b075.ts +89 -0
- package/test/{effects/components/temp/NestedIfEffect-client-944bd749d83ebce0f6ae66c6751f38ecd430df05.ts → if/components/temp/IfContainingIfAfterIf-client-f435f9bc464edfaf580ef7c1726a4be5ba8c6f6f.ts} +29 -8
- package/test/if/components/temp/IfContainingIfAfterIf-server-2cfd604fd3a7187217437bd97dc89a4c6aeb8726.ts +29 -0
- package/test/if/components/temp/IfContainingIfAfterIf-types-805203b39332252a17996786ac79ece914bbea34.ts +10 -0
- package/test/if/components/temp/{IfElseTrue-client-9bccfbdf5da704d3756ff48e2cf6987e6125dc1f.ts → IfElseFalse-client-6003c6c731c1bad239bdcea789d136bc8cd6090a.ts} +24 -27
- package/test/if/components/temp/{IfElseFalse-client-9bccfbdf5da704d3756ff48e2cf6987e6125dc1f.ts → IfElseTrue-client-6003c6c731c1bad239bdcea789d136bc8cd6090a.ts} +24 -27
- package/test/if/components/temp/{IfFalse-client-9ad6f6e3f7abb5d9927d4823315886542c6ec611.ts → IfFalse-client-8ef85fba04e1e6c3f2b95d9d957bffea5ba593ae.ts} +16 -21
- package/test/if/components/temp/IfNested-client-5be29838cfd71602d781e744ebd1eb9968eb825c.ts +97 -0
- package/test/mount/components/output/Mount-client.ts +0 -2
- package/test/mount/components/temp/{Mount-client-ce5a39e2bd6942a589b1a91d392ee841d55bccf2.ts → Mount-client-00351e81e77561213a14c8eea534acae3c5eb692.ts} +0 -2
- package/test/on-mount/components/output/OnMount-client.ts +0 -2
- package/test/on-mount/components/temp/{OnMount-client-218e35c32f4c3d30a193775e4aecd50d5663da0d.ts → OnMount-client-0a63fc37b0f617ee0b4de2619590a2562a3e2f92.ts} +0 -2
- package/test/party/components/output/ComputedState-client.ts +0 -2
- package/test/party/components/output/Conditional-client.ts +36 -35
- package/test/party/components/output/Context-client.ts +0 -4
- package/test/party/components/output/DeclareState-client.ts +0 -2
- package/test/party/components/output/DomRef-client.ts +0 -2
- package/test/party/components/output/EmitToParent-client.ts +0 -4
- package/test/party/components/output/EventClick-client.ts +0 -2
- package/test/party/components/output/InputCheckbox-client.ts +0 -2
- package/test/party/components/output/InputRadio-client.ts +0 -2
- package/test/party/components/output/InputSelect-client.ts +0 -2
- package/test/party/components/output/InputText-client.ts +0 -2
- package/test/party/components/output/Loop-client.ts +0 -2
- package/test/party/components/output/MinimalTemplate-client.ts +0 -2
- package/test/party/components/output/OnMount-client.ts +0 -2
- package/test/party/components/output/Props-client.ts +0 -4
- package/test/party/components/output/Slot-client.ts +0 -4
- package/test/party/components/output/SlotFallback-client.ts +0 -4
- package/test/party/components/output/Styling-client.ts +0 -2
- package/test/party/components/output/UpdateState-client.ts +0 -2
- package/test/party/components/temp/{ComputedState-client-fcd3c890f4dc9058c4ee29e7cdbfda23a8d4695f.ts → ComputedState-client-512a35be46f600ab9b9cf9da0e3c0c90b377d7fa.ts} +0 -2
- package/test/party/components/temp/{Conditional-client-39c1844a9395f8620541f6599ee4547906c35d69.ts → Conditional-client-2c5f759b41ce567a51589af001bf0fc6feb47b4b.ts} +36 -35
- package/test/party/components/temp/{Context-client-696777e5ce1ad7ef2f5bc8e4c2c1a81fb3a98ece.ts → Context-client-88246cfda3671dd5ac8919d95c2f65a8dce81f18.ts} +0 -4
- package/test/party/components/temp/{DeclareState-client-cbade5ab902b3d7d5bf8054f9cc7e149334e3560.ts → DeclareState-client-cc45b93b34f4c34c965c765e0f53f78ea416b1ca.ts} +0 -2
- package/test/party/components/temp/{DomRef-client-6e643c9cfee7fed10c6cead9fcad055646712aa6.ts → DomRef-client-4c28338d9ea7a2c3d273970161181d82076ed19e.ts} +0 -2
- package/test/party/components/temp/{EmitToParent-client-89b1744b0bc1e50dc2091c6e63dfe9b62a0b8d46.ts → EmitToParent-client-fcf3d690b10871aad884099e078d5c98d7b8503d.ts} +0 -4
- package/test/party/components/temp/{EventClick-client-2c7393fcd73e6d10d17f5f19aacafeb91ab219f6.ts → EventClick-client-dcb9b191808f7f0f9d009b725da046ba241cb44b.ts} +0 -2
- package/test/party/components/temp/{InputCheckbox-client-377a0a0505e307b19dcca95cb9b1cf9c8a38835b.ts → InputCheckbox-client-f0af6d8f86c4f80673dea1599a6f2deaf54fe576.ts} +0 -2
- package/test/party/components/temp/{InputRadio-client-38c3f46fabdb94ca79c71888ce3335687461fcbd.ts → InputRadio-client-1472838ddbfe003a85779e1ccb7b57cb66333e90.ts} +0 -2
- package/test/party/components/temp/{InputSelect-client-bac5f12f5560e702794587702c883c273c92394f.ts → InputSelect-client-9881943682735888d6b62612d93577ba51593678.ts} +0 -2
- package/test/party/components/temp/{InputText-client-2a189403e60e6f932829370233ddede2be782334.ts → InputText-client-7b37e856f97c863e120a4aa6c02757e489ad6591.ts} +0 -2
- package/test/party/components/temp/{Loop-client-c99929d3487880b8526d0ed3602c96dd36da1a8c.ts → Loop-client-5e5694bc158fcd5f06cd1037e920c657032d7b90.ts} +0 -2
- package/test/party/components/temp/{MinimalTemplate-client-72e8afffe412117e38f8045196704fa3ac384213.ts → MinimalTemplate-client-079892cc885b1f25863c13b93c83e0554a22a2c3.ts} +0 -2
- package/test/party/components/temp/{OnMount-client-f16abd053b4b1ba31fc806e8c3a39163a46cb6a2.ts → OnMount-client-1900436fa5a6d56cb98df953de89e0f662d821e8.ts} +0 -2
- package/test/party/components/temp/{Props-client-863b630f7f77c4609f6171886bf812b9452cfceb.ts → Props-client-b94724d04965006c1c89776bac2fa10694280c44.ts} +0 -4
- package/test/party/components/temp/{Slot-client-4406668a963796d1117ec818118e504e55b18e4c.ts → Slot-client-5793cdf8a5f28b5009ae17435cfd146ed6c8a1f8.ts} +0 -4
- package/test/party/components/temp/{SlotFallback-client-4406668a963796d1117ec818118e504e55b18e4c.ts → SlotFallback-client-5793cdf8a5f28b5009ae17435cfd146ed6c8a1f8.ts} +0 -4
- package/test/party/components/temp/{Styling-client-59c057fc5b6c226d667351ea7f748abbe86f1c96.ts → Styling-client-a1c7082740471fead2feb331c9ba0864ff0c5566.ts} +0 -2
- package/test/party/components/temp/{UpdateState-client-3b087abf0cb4b1e784623f3de6dabbcb63703e07.ts → UpdateState-client-c6c785a6d35693ba1b9c36dbd59bf28163718c00.ts} +0 -2
- package/test/props/components/output/Reactive-client.ts +0 -4
- package/test/props/components/temp/{Reactive-client-a911a7026a02bf32c185e29a87f5b8611685e370.ts → Reactive-client-26a5294eda35e924911bcc99acda58cc98baee7c.ts} +0 -4
- package/test/replace/components/output/Replace-client.ts +14 -12
- package/test/replace/components/temp/{Replace-client-d5e681fe8c662c832916d61ae22d51e65dfeba53.ts → Replace-client-872de024cd2c5c6c95a3eb4e29642e8e48e69a27.ts} +14 -12
- package/test/slots/components/output/BasicSlot-client.ts +0 -4
- package/test/slots/components/output/LetSlot-client.ts +0 -4
- package/test/slots/components/output/NamedSlot-client.ts +0 -4
- package/test/slots/components/output/UnusedSlot-client.ts +0 -4
- package/test/slots/components/temp/{BasicSlot-client-c1e9885dc85d13e4b44d54e0ad800c0d46e35914.ts → BasicSlot-client-39a9a3170fd51582b023b805d597eb729bb6b02b.ts} +0 -4
- package/test/slots/components/temp/{LetSlot-client-3b1779874d3c9b1289fb62f124af5ebaf78279a8.ts → LetSlot-client-63980e54259324855b573e87efb1d7a1ac9abd9c.ts} +0 -4
- package/test/slots/components/temp/{NamedSlot-client-8faa564d1002c199f102aa148657d82628d1ebd7.ts → NamedSlot-client-426018f63a360e6d4208400b25bfadd2727eadcf.ts} +0 -4
- package/test/slots/components/temp/{UnusedSlot-client-2e23b278b99db53bc0fde9c98836d8e26481a40e.ts → UnusedSlot-client-5819c279d1f8c2d808651505171a5b20a41998ef.ts} +0 -4
- package/test/special-component/components/output/SpecialComponent-client.ts +29 -31
- package/test/special-component/components/temp/{SpecialComponent-client-d81a30dda5d8d509e8661caa70bbc89265bc65c1.ts → SpecialComponent-client-752f0be79a322e8f75bfdd5adfec996d4ab35281.ts} +29 -31
- package/test/special-element/components/output/SpecialElement-client.ts +0 -2
- package/test/special-element/components/temp/{SpecialElement-client-2887938dfcd02e042d8fe5501845d043b098616a.ts → SpecialElement-client-f6239c04736a49add9278edfaea7804dd186e665.ts} +0 -2
- package/test/special-head/components/output/SpecialHead-client.ts +0 -2
- package/test/special-head/components/temp/{SpecialHead-client-3b8455aa874ae0113a7f718cb64b310d84430ce6.ts → SpecialHead-client-cda50f56454f7c7f0147352e53d50c4060ed2e3b.ts} +0 -2
- package/test/special-self/components/output/SpecialSelf-client.ts +25 -28
- package/test/special-self/components/temp/{SpecialSelf-client-cb6aba06aa4bec73485ef48bc05557a5c935f54c.ts → SpecialSelf-client-09e93618a2318d3873b201557e2f32d5bf5e4100.ts} +25 -28
- package/test/style/components/output/Style-client.ts +0 -2
- package/test/style/components/temp/{Style-client-8896b4c0fe78e346904fbcf24d629bbe20a56860.ts → Style-client-8ca877392f5610bc527c5577d948f5782c40bf96.ts} +0 -2
- package/test/svg/components/output/Svg-client.ts +24 -26
- package/test/svg/components/temp/{Svg-client-0397419af735b847de6c56bd6ad2bb4eb6dc1ba2.ts → Svg-client-6a213daf6df5c361de9e1c9aa7cc581bcb6356be.ts} +24 -26
- package/test/switch/components/output/Switch-client.ts +34 -35
- package/test/{if/components/temp/ElseTrue-client-6eb8f5e058f266603104442f46cd96206bbceee8.ts → switch/components/temp/Switch-client-4cab689c9914c62d461e6aaf6beb68d15275c68f.ts} +46 -34
- package/test/text/components/output/Text-client.ts +0 -2
- package/test/text/components/temp/{Text-client-3b2555c36eef59b2d79b1d5a6d3edf4ff28a6816.ts → Text-client-4288bc38b436a5b486c1fd5a4805bd206dbff27c.ts} +0 -2
- package/test/watch-array/components/output/ArrayAllFunctions-client.ts +0 -2
- package/test/watch-array/components/output/ArrayAllFunctionsUnkeyed-client.ts +0 -2
- package/test/watch-array/components/output/ArrayEmpty-client.ts +0 -2
- package/test/watch-array/components/output/ArrayEntries-client.ts +0 -2
- package/test/watch-array/components/output/ArrayIndexes-client.ts +0 -2
- package/test/watch-array/components/output/ArrayPop-client.ts +0 -2
- package/test/watch-array/components/output/ArrayPush-client.ts +0 -2
- package/test/watch-array/components/output/ArrayReassign-client.ts +0 -2
- package/test/watch-array/components/output/ArrayReverse-client.ts +0 -2
- package/test/watch-array/components/output/ArraySetObject-client.ts +0 -2
- package/test/watch-array/components/output/ArraySetProperty-client.ts +0 -2
- package/test/watch-array/components/output/ArrayShift-client.ts +0 -2
- package/test/watch-array/components/output/ArraySort-client.ts +0 -2
- package/test/watch-array/components/output/ArraySpliceAdd-client.ts +0 -2
- package/test/watch-array/components/output/ArraySpliceDelete-client.ts +0 -2
- package/test/watch-array/components/output/ArraySpliceDeleteAll-client.ts +0 -2
- package/test/watch-array/components/output/ArraySpliceDeleteAndAdd-client.ts +0 -2
- package/test/watch-array/components/output/ArraySpliceDeleteEnd-client.ts +0 -2
- package/test/watch-array/components/output/ArraySwap-client.ts +0 -2
- package/test/watch-array/components/output/ArrayUnshift-client.ts +0 -2
- package/test/watch-array/components/output/ArrayUpdateAssignment-client.ts +0 -2
- package/test/watch-array/components/temp/{ArrayPush-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayAllFunctions-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
- package/test/watch-array/components/temp/{ArrayAllFunctionsUnkeyed-client-0aede144ecd4a1de98d0ac6265fc4275e9803f9e.ts → ArrayAllFunctionsUnkeyed-client-513455af417adc9807393dbb58da507c66dde885.ts} +0 -2
- package/test/watch-array/components/temp/{ArrayAllFunctions-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayEmpty-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
- package/test/watch-array/components/temp/{ArrayEntries-client-40c8fbd950418f90335fee16250a42778d8bfbaf.ts → ArrayEntries-client-cf9fe0738861c78fbd576d7f74b38c713363ee31.ts} +0 -2
- package/test/watch-array/components/temp/{ArrayIndexes-client-89d3c7c1e89ca1c402183e84c3a2a8ed02bde10b.ts → ArrayIndexes-client-2c12fa2b6d0992423b57ddb6f363b9c4c5bf525a.ts} +0 -2
- package/test/watch-array/components/temp/{ArrayEmpty-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayPop-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
- package/test/watch-array/components/temp/{ArrayPop-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts → ArrayPush-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts} +0 -2
- package/test/watch-array/components/temp/ArrayReassign-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArrayReverse-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArraySetObject-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArraySetProperty-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArrayShift-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArraySort-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArraySpliceAdd-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArraySpliceDelete-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArraySpliceDeleteAll-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArraySpliceDeleteAndAdd-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArraySpliceDeleteEnd-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArraySwap-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArrayUnshift-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-array/components/temp/ArrayUpdateAssignment-client-83720b9fb76de7976be6cdb86d122cb097f16821.ts +81 -0
- package/test/watch-object/components/output/WatchObject-client.ts +0 -2
- package/test/watch-object/components/output/WatchUndefinedPropertyChange-client.ts +0 -2
- package/test/watch-object/components/temp/{WatchObject-client-6e179fea629d983307056536ab5a3cf9141335fa.ts → WatchObject-client-8f906f7d7613370e70c55a122774e122cdd55bff.ts} +0 -2
- package/test/watch-object/components/temp/{WatchUndefinedPropertyChange-client-210c8984d068fe46e681de4f63d744af34d75b7a.ts → WatchUndefinedPropertyChange-client-bce2c42e17dedce203b71228966e20056b82baba.ts} +0 -2
- package/test/if/components/temp/ElseIfTrue-client-6eb8f5e058f266603104442f46cd96206bbceee8.ts +0 -78
- package/test/if/components/temp/IfContainingFor-client-0b27933986c4593fdad3c81ac22e32d7ee6bd40f.ts +0 -111
- package/test/if/components/temp/IfContainingIf-client-3cf3407e41d0bd4d2927f97cbc5f9df661537702.ts +0 -95
- package/test/if/components/temp/IfNested-client-50abd76ec9369ac6cf42f0264870914923f30b5c.ts +0 -101
- package/test/switch/components/temp/Switch-client-8de47f56a21297420acf8bc27fc03149f258028b.ts +0 -91
- package/test/watch-array/components/temp/ArrayReassign-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArrayReverse-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArraySetObject-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArraySetProperty-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArrayShift-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArraySort-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArraySpliceAdd-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArraySpliceDelete-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArraySpliceDeleteAll-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArraySpliceDeleteAndAdd-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArraySpliceDeleteEnd-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArraySwap-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArrayUnshift-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
- package/test/watch-array/components/temp/ArrayUpdateAssignment-client-10c627fb82e67bba84b0a0bc1ffe79430dcd7255.ts +0 -83
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @torpor/view
|
|
2
2
|
|
|
3
|
+
## 0.4.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 195e93b: Fix: only include $peek if used
|
|
8
|
+
|
|
9
|
+
## 0.4.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 3aa92de: Fix: run @if, @switch and @await without closures
|
|
14
|
+
- 81a3512: Fix: shorter generated code
|
|
15
|
+
|
|
3
16
|
## 0.4.9
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/compile.cjs
CHANGED
|
@@ -840,9 +840,8 @@ function buildAwaitNode(node, status, b) {
|
|
|
840
840
|
const anchorName = node.varName ?? "null";
|
|
841
841
|
const parentName = node.parentName;
|
|
842
842
|
const regionName = nextVarName("await_region", status);
|
|
843
|
-
const
|
|
844
|
-
const
|
|
845
|
-
const awaitVarsName = nextVarName("await_vars", status);
|
|
843
|
+
const indexName = nextVarName("await_index", status);
|
|
844
|
+
const tokenName = nextVarName("await_token", status);
|
|
846
845
|
const branches = node.children.filter((n) => isControlNode(n));
|
|
847
846
|
let awaitBranch = branches.find((n) => n.operation === "@await");
|
|
848
847
|
if (!awaitBranch) {}
|
|
@@ -871,54 +870,51 @@ function buildAwaitNode(node, status, b) {
|
|
|
871
870
|
const awaiterName = trimMatched(awaitBranch.statement.substring(5).trim(), "(", ")");
|
|
872
871
|
const thenVar = trimMatched(thenBranch.statement.substring(4).trim(), "(", ")");
|
|
873
872
|
const catchVar = trimMatched(catchBranch.statement.substring(5).trim(), "(", ")");
|
|
874
|
-
status.imports.add("$watch");
|
|
875
|
-
status.imports.add("$run");
|
|
876
873
|
status.imports.add("t_region");
|
|
877
874
|
status.imports.add("t_run_control");
|
|
878
875
|
status.imports.add("t_run_branch");
|
|
876
|
+
status.imports.add("t_push_region");
|
|
877
|
+
status.imports.add("t_pop_region");
|
|
879
878
|
b.append("");
|
|
880
879
|
b.append("/* @await */");
|
|
881
880
|
addPushDevBoundary("control", `@${branches[0].statement}`, status, b);
|
|
882
881
|
b.append(`
|
|
883
882
|
const ${regionName} = t_region(${status.options.dev === true ? `"await"` : ""});
|
|
884
|
-
let ${
|
|
885
|
-
let ${
|
|
886
|
-
|
|
887
|
-
$run(() => {`);
|
|
883
|
+
let ${tokenName} = 0;
|
|
884
|
+
let ${indexName} = -1;
|
|
885
|
+
t_run_control(${regionName}, ${anchorName}, (t_before) => {`);
|
|
888
886
|
let index = 0;
|
|
889
|
-
buildAwaitBranch(awaitBranch, status, b, parentName,
|
|
887
|
+
buildAwaitBranch(awaitBranch, status, b, parentName, regionName, indexName, index++);
|
|
890
888
|
b.append(`
|
|
891
|
-
${
|
|
889
|
+
${tokenName}++;
|
|
892
890
|
((t_token) => {`);
|
|
893
891
|
awaitBranch.span.start += 7;
|
|
894
892
|
addMappedText("", replaceForVarNames(awaiterName, status), "", awaitBranch.span, status, b);
|
|
895
893
|
thenBranch.span.start -= 1;
|
|
896
894
|
addMappedText(".then((", replaceForVarNames(thenVar, status), ") => {", thenBranch.span, status, b);
|
|
897
|
-
b.append(`if (t_token === ${
|
|
898
|
-
buildAwaitBranch(thenBranch, status, b, parentName,
|
|
895
|
+
b.append(`if (t_token === ${tokenName}) {`);
|
|
896
|
+
buildAwaitBranch(thenBranch, status, b, parentName, regionName, indexName, index++);
|
|
899
897
|
b.append(`}
|
|
900
898
|
})`);
|
|
901
899
|
catchBranch.span.start -= 1;
|
|
902
900
|
addMappedText(".catch((", replaceForVarNames(catchVar, status), ") => {", catchBranch.span, status, b);
|
|
903
|
-
b.append(`if (t_token === ${
|
|
904
|
-
buildAwaitBranch(catchBranch, status, b, parentName,
|
|
901
|
+
b.append(`if (t_token === ${tokenName}) {`);
|
|
902
|
+
buildAwaitBranch(catchBranch, status, b, parentName, regionName, indexName, index++);
|
|
905
903
|
b.append(`}
|
|
906
904
|
});
|
|
907
|
-
})(${
|
|
905
|
+
})(${tokenName});
|
|
908
906
|
}${status.options.dev === true ? `, "runAwait"` : ""});`);
|
|
909
|
-
b.append(`
|
|
910
|
-
t_run_control(${regionName}, ${anchorName}, (t_before) => {
|
|
911
|
-
const index = ${stateName}.index;`);
|
|
912
|
-
b.append(`t_run_branch(${regionName}, () => ${creatorsName}[index](t_before)${status.options.dev === true ? ", `branch ${index}`" : ""});`);
|
|
913
|
-
addPopDevBoundary(status, b);
|
|
914
|
-
b.append("});");
|
|
915
907
|
addPopDevBoundary(status, b);
|
|
916
908
|
b.append("");
|
|
917
909
|
}
|
|
918
|
-
function buildAwaitBranch(node, status, b, parentName,
|
|
910
|
+
function buildAwaitBranch(node, status, b, parentName, regionName, indexName, index) {
|
|
911
|
+
b.append(`if (!t_run_branch(${regionName}, ${indexName}, ${index})) return;`);
|
|
919
912
|
if (node.children.length > 0) {
|
|
920
|
-
|
|
921
|
-
|
|
913
|
+
b.append(`
|
|
914
|
+
const t_new_region = t_region(${status.options.dev === true ? `"await_branch"` : ""});
|
|
915
|
+
const t_old_control_region = t_push_region(${regionName});
|
|
916
|
+
const t_old_region = t_push_region(t_new_region, true);
|
|
917
|
+
`);
|
|
922
918
|
buildFragment(node, status, b, parentName, "t_before");
|
|
923
919
|
status.fragmentStack.push({
|
|
924
920
|
fragment: node.fragment,
|
|
@@ -927,9 +923,10 @@ function buildAwaitBranch(node, status, b, parentName, stateName, creatorsName,
|
|
|
927
923
|
for (let child of node.children) buildNode(child, status, b, parentName, "t_before");
|
|
928
924
|
status.fragmentStack.pop();
|
|
929
925
|
buildAddFragment(node, status, b, parentName, "t_before");
|
|
930
|
-
b.append("
|
|
931
|
-
|
|
932
|
-
|
|
926
|
+
b.append("t_pop_region(t_old_region);");
|
|
927
|
+
b.append("t_pop_region(t_old_control_region);");
|
|
928
|
+
}
|
|
929
|
+
b.append(`${indexName} = ${index};`);
|
|
933
930
|
}
|
|
934
931
|
|
|
935
932
|
//#endregion
|
|
@@ -1043,6 +1040,9 @@ function buildHtmlNode(node, status, b) {
|
|
|
1043
1040
|
node = node.children[0];
|
|
1044
1041
|
status.imports.add("t_region");
|
|
1045
1042
|
status.imports.add("t_run_control");
|
|
1043
|
+
status.imports.add("t_run_branch");
|
|
1044
|
+
status.imports.add("t_push_region");
|
|
1045
|
+
status.imports.add("t_pop_region");
|
|
1046
1046
|
b.append("");
|
|
1047
1047
|
b.append(`
|
|
1048
1048
|
/* @html */
|
|
@@ -1054,8 +1054,12 @@ function buildHtmlNode(node, status, b) {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
function buildHtmlBranch(node, status, b, parentName, regionName) {
|
|
1056
1056
|
status.imports.add("t_run_branch");
|
|
1057
|
-
b.append(`${node.statement};`);
|
|
1058
|
-
b.append(`t_run_branch(${regionName},
|
|
1057
|
+
b.append(`${replaceForVarNames(node.statement, status)};`);
|
|
1058
|
+
b.append(`if (!t_run_branch(${regionName}, 0, -1)) return;`);
|
|
1059
|
+
b.append(`
|
|
1060
|
+
const t_new_region = t_region(${status.options.dev === true ? `"html_branch"` : ""});
|
|
1061
|
+
const t_old_region = t_push_region(t_new_region, true);
|
|
1062
|
+
`);
|
|
1059
1063
|
const templateName = nextVarName("template", status);
|
|
1060
1064
|
const fragmentName = `t_fragment_${node.fragment.number}`;
|
|
1061
1065
|
b.append(`let ${templateName} = document.createElement("template");`);
|
|
@@ -1064,7 +1068,7 @@ function buildHtmlBranch(node, status, b, parentName, regionName) {
|
|
|
1064
1068
|
addMappedText("", `${templateName}.innerHTML = ${replaceForVarNames(node.statement, status)};`, "", node.span, status, b);
|
|
1065
1069
|
b.append(`let ${fragmentName} = ${templateName}.content.cloneNode(true) as DocumentFragment;`);
|
|
1066
1070
|
buildAddFragment(node, status, b, parentName, "t_before");
|
|
1067
|
-
b.append(
|
|
1071
|
+
b.append("t_pop_region(t_old_region);");
|
|
1068
1072
|
}
|
|
1069
1073
|
|
|
1070
1074
|
//#endregion
|
|
@@ -1073,8 +1077,7 @@ function buildIfNode(node, status, b) {
|
|
|
1073
1077
|
const anchorName = node.varName ?? "null";
|
|
1074
1078
|
const parentName = node.parentName || anchorName + ".parentNode";
|
|
1075
1079
|
const regionName = nextVarName("if_region", status);
|
|
1076
|
-
const
|
|
1077
|
-
const creatorsName = nextVarName("if_creators", status);
|
|
1080
|
+
const indexName = nextVarName("if_index", status);
|
|
1078
1081
|
const branches = node.children.filter((n) => isControlNode(n));
|
|
1079
1082
|
if (branches.findIndex((n) => n.operation === "@else") === -1) branches.push({
|
|
1080
1083
|
type: "control",
|
|
@@ -1086,36 +1089,32 @@ function buildIfNode(node, status, b) {
|
|
|
1086
1089
|
end: 0
|
|
1087
1090
|
}
|
|
1088
1091
|
});
|
|
1089
|
-
status.imports.add("$watch");
|
|
1090
|
-
status.imports.add("$run");
|
|
1091
1092
|
status.imports.add("t_region");
|
|
1092
1093
|
status.imports.add("t_run_control");
|
|
1093
1094
|
status.imports.add("t_run_branch");
|
|
1095
|
+
status.imports.add("t_push_region");
|
|
1096
|
+
status.imports.add("t_pop_region");
|
|
1094
1097
|
b.append("");
|
|
1095
1098
|
b.append("/* @if */");
|
|
1096
1099
|
addPushDevBoundary("control", `@${branches[0].statement}`, status, b);
|
|
1097
1100
|
b.append(`
|
|
1098
1101
|
const ${regionName} = t_region(${status.options.dev === true ? `"if"` : ""});
|
|
1099
|
-
let ${
|
|
1100
|
-
|
|
1101
|
-
$run(() => {`);
|
|
1102
|
+
let ${indexName} = -1;
|
|
1103
|
+
t_run_control(${regionName}, ${anchorName}, (t_before) => {`);
|
|
1102
1104
|
let index = 0;
|
|
1103
|
-
for (let branch of branches) buildIfBranch(branch, status, b, parentName,
|
|
1105
|
+
for (let branch of branches) buildIfBranch(branch, status, b, parentName, regionName, indexName, index++);
|
|
1104
1106
|
b.append(`}${status.options.dev === true ? `, "runIf"` : ""});`);
|
|
1105
|
-
b.append(`
|
|
1106
|
-
t_run_control(${regionName}, ${anchorName}, (t_before) => {
|
|
1107
|
-
const index = ${stateName}.index;`);
|
|
1108
|
-
b.append(`t_run_branch(${regionName}, () => ${creatorsName}[index](t_before)${status.options.dev === true ? ", `branch ${index}`" : ""});`);
|
|
1109
|
-
addPopDevBoundary(status, b);
|
|
1110
|
-
b.append("});");
|
|
1111
1107
|
addPopDevBoundary(status, b);
|
|
1112
1108
|
b.append("");
|
|
1113
1109
|
}
|
|
1114
|
-
function buildIfBranch(node, status, b, parentName,
|
|
1110
|
+
function buildIfBranch(node, status, b, parentName, regionName, indexName, index) {
|
|
1115
1111
|
addMappedText("", `${replaceForVarNames(node.statement, status)}`, " {", node.span, status, b);
|
|
1112
|
+
b.append(`if (!t_run_branch(${regionName}, ${indexName}, ${index})) return;`);
|
|
1116
1113
|
if (node.children.length > 0) {
|
|
1117
|
-
|
|
1118
|
-
|
|
1114
|
+
b.append(`
|
|
1115
|
+
const t_new_region = t_region(${status.options.dev === true ? `"if_branch"` : ""});
|
|
1116
|
+
const t_old_region = t_push_region(t_new_region, true);
|
|
1117
|
+
`);
|
|
1119
1118
|
buildFragment(node, status, b, parentName, "t_before");
|
|
1120
1119
|
status.fragmentStack.push({
|
|
1121
1120
|
fragment: node.fragment,
|
|
@@ -1124,9 +1123,9 @@ function buildIfBranch(node, status, b, parentName, stateName, creatorsName, ind
|
|
|
1124
1123
|
for (let child of node.children) buildNode(child, status, b, parentName, "t_before");
|
|
1125
1124
|
status.fragmentStack.pop();
|
|
1126
1125
|
buildAddFragment(node, status, b, parentName, "t_before");
|
|
1127
|
-
b.append("
|
|
1128
|
-
}
|
|
1129
|
-
b.append(`${
|
|
1126
|
+
b.append("t_pop_region(t_old_region);");
|
|
1127
|
+
}
|
|
1128
|
+
b.append(`${indexName} = ${index};`);
|
|
1130
1129
|
b.append("}");
|
|
1131
1130
|
}
|
|
1132
1131
|
|
|
@@ -1139,6 +1138,9 @@ function buildReplaceNode(node, status, b) {
|
|
|
1139
1138
|
node = node.children[0];
|
|
1140
1139
|
status.imports.add("t_region");
|
|
1141
1140
|
status.imports.add("t_run_control");
|
|
1141
|
+
status.imports.add("t_run_branch");
|
|
1142
|
+
status.imports.add("t_push_region");
|
|
1143
|
+
status.imports.add("t_pop_region");
|
|
1142
1144
|
b.append("");
|
|
1143
1145
|
b.append(`
|
|
1144
1146
|
/* @replace */
|
|
@@ -1151,7 +1153,11 @@ function buildReplaceNode(node, status, b) {
|
|
|
1151
1153
|
function buildReplaceBranch(node, status, b, parentName, regionName) {
|
|
1152
1154
|
status.imports.add("t_run_branch");
|
|
1153
1155
|
b.append(`${replaceForVarNames(node.statement, status)};`);
|
|
1154
|
-
b.append(`t_run_branch(${regionName},
|
|
1156
|
+
b.append(`if (!t_run_branch(${regionName}, 0, -1)) return;`);
|
|
1157
|
+
b.append(`
|
|
1158
|
+
const t_new_region = t_region(${status.options.dev === true ? `"replace_branch"` : ""});
|
|
1159
|
+
const t_old_region = t_push_region(t_new_region, true);
|
|
1160
|
+
`);
|
|
1155
1161
|
buildFragment(node, status, b, parentName, "t_before");
|
|
1156
1162
|
status.fragmentStack.push({
|
|
1157
1163
|
fragment: node.fragment,
|
|
@@ -1160,7 +1166,7 @@ function buildReplaceBranch(node, status, b, parentName, regionName) {
|
|
|
1160
1166
|
for (let child of node.children) buildNode(child, status, b, parentName, "t_before");
|
|
1161
1167
|
status.fragmentStack.pop();
|
|
1162
1168
|
buildAddFragment(node, status, b, parentName, "t_before");
|
|
1163
|
-
b.append(
|
|
1169
|
+
b.append("t_pop_region(t_old_region);");
|
|
1164
1170
|
}
|
|
1165
1171
|
|
|
1166
1172
|
//#endregion
|
|
@@ -1180,8 +1186,7 @@ function buildSwitchNode(node, status, b) {
|
|
|
1180
1186
|
const anchorName = node.varName ?? "null";
|
|
1181
1187
|
const parentName = node.parentName;
|
|
1182
1188
|
const regionName = nextVarName("switch_region", status);
|
|
1183
|
-
const
|
|
1184
|
-
const creatorsName = nextVarName("switch_creators", status);
|
|
1189
|
+
const indexName = nextVarName("switch_index", status);
|
|
1185
1190
|
const branches = node.children.filter((n) => isControlNode(n));
|
|
1186
1191
|
if (branches.findIndex((n) => n.operation === "@default") === -1) branches.push({
|
|
1187
1192
|
type: "control",
|
|
@@ -1193,39 +1198,35 @@ function buildSwitchNode(node, status, b) {
|
|
|
1193
1198
|
end: 0
|
|
1194
1199
|
}
|
|
1195
1200
|
});
|
|
1196
|
-
status.imports.add("$watch");
|
|
1197
|
-
status.imports.add("$run");
|
|
1198
1201
|
status.imports.add("t_region");
|
|
1199
1202
|
status.imports.add("t_run_control");
|
|
1200
1203
|
status.imports.add("t_run_branch");
|
|
1204
|
+
status.imports.add("t_push_region");
|
|
1205
|
+
status.imports.add("t_pop_region");
|
|
1201
1206
|
b.append("");
|
|
1202
1207
|
b.append("/* @switch */");
|
|
1203
1208
|
addPushDevBoundary("control", `@${branches[0].statement}`, status, b);
|
|
1204
1209
|
b.append(`
|
|
1205
1210
|
const ${regionName} = t_region(${status.options.dev === true ? `"switch"` : ""});
|
|
1206
|
-
let ${
|
|
1207
|
-
|
|
1208
|
-
$run(() => {`);
|
|
1211
|
+
let ${indexName} = -1;
|
|
1212
|
+
t_run_control(${regionName}, ${anchorName}, (t_before) => {`);
|
|
1209
1213
|
addMappedText("", `${replaceForVarNames(node.statement, status)}`, " {", node.span, status, b);
|
|
1210
1214
|
let index = 0;
|
|
1211
|
-
for (let branch of branches) buildSwitchBranch(branch, status, b, parentName,
|
|
1215
|
+
for (let branch of branches) buildSwitchBranch(branch, status, b, parentName, regionName, indexName, index++);
|
|
1212
1216
|
b.append(`
|
|
1213
1217
|
}
|
|
1214
1218
|
}${status.options.dev === true ? `, "runSwitch"` : ""});`);
|
|
1215
|
-
b.append(`
|
|
1216
|
-
t_run_control(${regionName}, ${anchorName}, (t_before) => {
|
|
1217
|
-
const index = ${stateName}.index;`);
|
|
1218
|
-
b.append(`t_run_branch(${regionName}, () => ${creatorsName}[index](t_before)${status.options.dev === true ? ", `branch ${index}`" : ""});`);
|
|
1219
|
-
addPopDevBoundary(status, b);
|
|
1220
|
-
b.append("});");
|
|
1221
1219
|
addPopDevBoundary(status, b);
|
|
1222
1220
|
b.append("");
|
|
1223
1221
|
}
|
|
1224
|
-
function buildSwitchBranch(node, status, b, parentName,
|
|
1222
|
+
function buildSwitchBranch(node, status, b, parentName, regionName, indexName, index) {
|
|
1225
1223
|
addMappedText("", `${replaceForVarNames(node.statement, status)}`, " {", node.span, status, b);
|
|
1224
|
+
b.append(`if (!t_run_branch(${regionName}, ${indexName}, ${index})) return;`);
|
|
1226
1225
|
if (node.children.length > 0) {
|
|
1227
|
-
|
|
1228
|
-
|
|
1226
|
+
b.append(`
|
|
1227
|
+
const t_new_region = t_region(${status.options.dev === true ? `"switch_branch"` : ""});
|
|
1228
|
+
const t_old_region = t_push_region(t_new_region, true);
|
|
1229
|
+
`);
|
|
1229
1230
|
buildFragment(node, status, b, parentName, "t_before");
|
|
1230
1231
|
status.fragmentStack.push({
|
|
1231
1232
|
fragment: node.fragment,
|
|
@@ -1234,10 +1235,10 @@ function buildSwitchBranch(node, status, b, parentName, stateName, creatorsName,
|
|
|
1234
1235
|
for (let child of node.children) buildNode(child, status, b, parentName, "t_before");
|
|
1235
1236
|
status.fragmentStack.pop();
|
|
1236
1237
|
buildAddFragment(node, status, b, parentName, "t_before");
|
|
1237
|
-
b.append("
|
|
1238
|
-
}
|
|
1239
|
-
b.append(`${stateName}.index = ${index};`);
|
|
1238
|
+
b.append("t_pop_region(t_old_region);");
|
|
1239
|
+
}
|
|
1240
1240
|
b.append(`
|
|
1241
|
+
${indexName} = ${index};
|
|
1241
1242
|
break;
|
|
1242
1243
|
}`);
|
|
1243
1244
|
}
|
|
@@ -1808,7 +1809,7 @@ function buildTemplate(template, map, imports, b, options) {
|
|
|
1808
1809
|
if (/\$run\b/.test(script)) imports.add("$run");
|
|
1809
1810
|
if (/\$mount\b/.test(script)) imports.add("$mount");
|
|
1810
1811
|
if (/\$unwrap\b/.test(script)) imports.add("$unwrap");
|
|
1811
|
-
imports.add("$peek");
|
|
1812
|
+
if (/\$peek\b/.test(script)) imports.add("$peek");
|
|
1812
1813
|
if (/\$batch\b/.test(script)) imports.add("$batch");
|
|
1813
1814
|
let currentIndex = 0;
|
|
1814
1815
|
let current = template.components[0];
|
|
@@ -1829,8 +1830,6 @@ function buildTemplate(template, map, imports, b, options) {
|
|
|
1829
1830
|
else if (chunk.script === "/* @start */") {
|
|
1830
1831
|
addPushDevBoundary("component", current.name || "Anon Component", status, b);
|
|
1831
1832
|
if (current.contextProps?.length) b.append(`$context = Object.assign({}, $context);`);
|
|
1832
|
-
b.append("$peek(() => { /**/");
|
|
1833
|
-
b.append("");
|
|
1834
1833
|
} else if (chunk.script === "/* @render */") {
|
|
1835
1834
|
if (current.markup) {
|
|
1836
1835
|
b.append("");
|
|
@@ -1849,7 +1848,6 @@ function buildTemplate(template, map, imports, b, options) {
|
|
|
1849
1848
|
}
|
|
1850
1849
|
} else if (chunk.script === "/* @style */") {} else if (chunk.script === "/* @end */") {
|
|
1851
1850
|
addPopDevBoundary(status, b);
|
|
1852
|
-
b.append("/**/ });");
|
|
1853
1851
|
currentIndex += 1;
|
|
1854
1852
|
current = template.components[currentIndex];
|
|
1855
1853
|
} else addMappedText("", chunk.script, "", chunk.span, status, b);
|