@torpor/view 0.3.0 → 0.3.2
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 +15 -0
- package/dist/Component-C6Y3UwGs.d.cts +11 -0
- package/dist/Component-C6Y3UwGs.d.cts.map +1 -0
- package/dist/ServerSlotRender-COS6H8Yk.d.cts +41 -0
- package/dist/ServerSlotRender-COS6H8Yk.d.cts.map +1 -0
- package/dist/compile.cjs +3735 -0
- package/dist/compile.cjs.map +1 -0
- package/dist/compile.d.cts +216 -0
- package/dist/compile.d.cts.map +1 -0
- package/dist/compile.d.ts +6 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +128 -76
- package/dist/compile.js.map +1 -1
- package/dist/formatText-B0FXBdFT.js.map +1 -1
- package/dist/formatText-DufG5l83.cjs +500 -0
- package/dist/formatText-DufG5l83.cjs.map +1 -0
- package/dist/index.cjs +906 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +411 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/ssr.cjs +40 -0
- package/dist/ssr.cjs.map +1 -0
- package/dist/ssr.d.cts +19 -0
- package/dist/ssr.d.cts.map +1 -0
- package/package.json +7 -4
- package/src/compile/build/client/buildAwaitNode.ts +15 -7
- package/src/compile/build/client/buildCode.ts +8 -1
- package/src/compile/build/client/buildIfNode.ts +11 -5
- package/src/compile/build/client/buildSwitchNode.ts +12 -5
- package/src/compile/buildType.ts +11 -12
- package/src/compile/parse/ParseComponentStatus.ts +6 -0
- package/src/compile/parse/parseCode.ts +61 -7
- package/src/compile/parse/parseTag.ts +7 -0
- package/src/types/TemplateComponent.ts +6 -0
- package/src/watch/checkEffect.ts +2 -0
- package/test/attributes/components/output/Attributes-client.ts +3 -0
- package/test/attributes/components/output/Attributes-types.ts +10 -0
- package/test/attributes/components/temp/{Attributes-client-9b2935d7824ba501776fdc6c48861422c15b6a12.ts → Attributes-client-ffbdd4d85a50436c1a51a4499921304098c1b396.ts} +3 -0
- package/test/attributes/components/temp/Attributes-types-5892927754ac19a8b3a8560fa1c78ce653e5f318.ts +10 -0
- package/test/attributes/errors.test.ts +35 -0
- package/test/await/components/output/Await-client.ts +12 -5
- package/test/await/components/output/Await-types.ts +10 -0
- package/test/await/components/temp/{Await-client-e969f4bd0712acf259ddfaa5a3b3448307201fd2.ts → Await-client-4d2c318baf00e6fb8fea11e34189817ca8002a1f.ts} +12 -5
- package/test/await/components/temp/Await-types-355b335acd1c17a2271920d51e542ce1fc61eeef.ts +10 -0
- package/test/bench/components/output/Bench-client.ts +3 -0
- package/test/bench/components/output/Bench-types.ts +10 -0
- package/test/bench/components/temp/{Bench-client-7f31596dafc8077370d8d90b1bb9b6e0208154e7.ts → Bench-client-33b5a23562f6a00687449c5ffe72dc42ac7f766e.ts} +3 -0
- package/test/bench/components/temp/Bench-types-a798f6c7b7ec235754ff5fdd5d7020633253b042.ts +10 -0
- package/test/bind/components/output/BindComponent-client.ts +5 -0
- package/test/bind/components/output/BindComponent-types.ts +10 -0
- package/test/bind/components/output/BindText-client.ts +3 -0
- package/test/bind/components/output/BindText-types.ts +10 -0
- package/test/bind/components/temp/{BindComponent-client-22eccb5354a2b0267841e015f3a2a0baf534bf89.ts → BindComponent-client-eb816edf9f83c19641ced9ecb1c2c5fc87e8e32c.ts} +5 -0
- package/test/bind/components/temp/BindComponent-types-8a10f6efddd92990ed5390f3c89ba17db179d801.ts +10 -0
- package/test/bind/components/temp/{BindText-client-7692ae1570533cc17e2186e9c7d4768529e4a2fe.ts → BindText-client-63e98b4407a8f0f22f4766d029567ac0aac7dba8.ts} +3 -0
- package/test/bind/components/temp/BindText-types-5892d9ef33c61a0de524b74323ba135accee8175.ts +10 -0
- package/test/build-server/components/output/IfNested-client.ts +17 -8
- package/test/build-server/components/output/IfNested-types.ts +10 -0
- package/test/build-server/components/temp/{IfNested-client-eefdd449fa700b2e7326bc72df8b32ddcadf9d21.ts → IfNested-client-2af78cceff5dbce510db31fd5b8bb4da5d30d53a.ts} +17 -8
- package/test/build-server/components/temp/IfNested-types-692d58ca98f3534102193a44aa358994f798ca7b.ts +10 -0
- package/test/buildOutputFiles.ts +16 -4
- package/test/child-component/components/output/ParentChild-client.ts +5 -0
- package/test/child-component/components/output/ParentChild-types.ts +10 -0
- package/test/child-component/components/temp/{ParentChild-client-2dfd600f7d409630d429a1d2d18c038bd08b08da.ts → ParentChild-client-93ca4d2ac521ef996a6548bfacb3e36f6f71fcf9.ts} +5 -0
- package/test/child-component/components/temp/ParentChild-types-4d26850ef18600f398f7aa9c4502071349bf5624.ts +10 -0
- package/test/class/components/output/Class-client.ts +5 -0
- package/test/class/components/output/Class-types.ts +10 -0
- package/test/class/components/temp/{Class-client-5af6a50cd454ae019b2aa79457ba7ead83b8c056.ts → Class-client-284ac46628b2d3d6b4a4edbdbfd1700626d3fed0.ts} +5 -0
- package/test/class/components/temp/Class-types-38567e85c9ec17739c7c97e12281fc1818267190.ts +10 -0
- package/test/component/components/output/Component-client.ts +3 -0
- package/test/component/components/output/Component-types.ts +10 -0
- package/test/component/components/output/Header-client.ts +3 -0
- package/test/component/components/output/Header-types.ts +10 -0
- package/test/component/components/temp/{Component-client-fdc327499be0a01f987d0f2897baf022a247c77c.ts → Component-client-3cb873dd1782874af78544c1d8886bbfa4bef11b.ts} +3 -0
- package/test/component/components/temp/Component-types-3ef4f140ba29c98357caf0f2618785437b5804de.ts +10 -0
- package/test/component/components/temp/{Header-client-6beb5770e68e6b19595e53e20bc906765fc6c260.ts → Header-client-cb780b85ee6e0587eca3d9ad7a8b8c947075e394.ts} +3 -0
- package/test/component/components/temp/Header-types-c56a108c6fb5a22b8ae156936bc05e58eef199c2.ts +10 -0
- package/test/console/components/output/Console-client.ts +3 -0
- package/test/console/components/output/Console-types.ts +10 -0
- package/test/console/components/temp/{Console-client-2b58290ac407ebbe89a0613d64eb9cd141b99887.ts → Console-client-b0feb868a912138e8af01bd06902d28c536ebb87.ts} +3 -0
- package/test/console/components/temp/Console-types-93ad3f25ddc6280fcff2cf4db7c2913d3a474912.ts +10 -0
- package/test/const/components/output/Const-client.ts +3 -0
- package/test/const/components/output/Const-types.ts +10 -0
- package/test/const/components/temp/{Const-client-d1037557e7ef75a8fe06f56816e65883047e9421.ts → Const-client-149dbc44ee609c54a99bacb715d04034a1d33c9c.ts} +3 -0
- package/test/const/components/temp/Const-types-afba269310bd143aa325752d3cc7e0c598fd0de2.ts +10 -0
- package/test/context/components/output/ChildA-client.ts +3 -0
- package/test/context/components/output/ChildA-types.ts +10 -0
- package/test/context/components/output/ChildB-client.ts +3 -0
- package/test/context/components/output/ChildB-types.ts +10 -0
- package/test/context/components/{temp/Parent-client-9898b2e521527c86d69905053b6727ea8fd28166.ts → output/Parent-client.ts} +3 -0
- package/test/context/components/output/Parent-types.ts +10 -0
- package/test/context/components/temp/{ChildA-client-9dea3e29ffcb82ca1779f6ff671e19b1c106fc4a.ts → ChildA-client-b9ad03bb0c64e9fb27a38b85792df79dc3ebf7f1.ts} +3 -0
- package/test/context/components/temp/ChildA-types-2ee15b25e68166d1574582f08e2280cbae948e5d.ts +10 -0
- package/test/context/components/temp/{ChildB-client-4b801099936c8aa013a1220f291375f67eba1acb.ts → ChildB-client-f4e1a447378a9a9be05aa37c8b3eae7ca6be8411.ts} +3 -0
- package/test/context/components/temp/ChildB-types-531f67cfda5bd04468e827c14f9358a431853fc5.ts +10 -0
- package/test/context/components/temp/Parent-client-2ecf387911773f5cd74c7bf1d04f98da08bc4450.ts +44 -0
- package/test/context/components/temp/Parent-types-e6be7d1cf118d7a8927af59db780010392966d01.ts +10 -0
- package/test/effects/components/output/For-client.ts +3 -0
- package/test/effects/components/output/For-types.ts +10 -0
- package/test/effects/components/output/If-client.ts +10 -4
- package/test/effects/components/output/If-types.ts +10 -0
- package/test/effects/components/output/NestedIf-client.ts +17 -8
- package/test/effects/components/output/NestedIf-types.ts +10 -0
- package/test/effects/components/temp/{For-client-7c7d7c0dba2547f816b9bd9c6a95d6873ec00ffd.ts → For-client-af16b99099e237c988932845b79500dfc28c6642.ts} +3 -0
- package/test/effects/components/temp/For-types-cfec41b41b054674bf8b01ce0e0003c8a6640a82.ts +10 -0
- package/test/effects/components/temp/{If-client-f0480a98f80b32612d12765c6838ff6db5982e82.ts → If-client-7f0b171f29a1f1ff969b21c33b241cd35eb1ce0e.ts} +10 -4
- package/test/effects/components/temp/If-types-7b245b6e531e122e0d0cfb72903bb88223b98793.ts +10 -0
- package/test/effects/components/temp/{NestedIf-client-702deffd158f219c5da4199b563a62cd54385a7f.ts → NestedIf-client-e2dd594c8f77f5ce53265b234e72b7c2f29ba76d.ts} +17 -8
- package/test/effects/components/temp/NestedIf-types-0912466d777f52f3616557823a7e47f5901cb755.ts +10 -0
- package/test/events/components/output/Increment-client.ts +3 -0
- package/test/events/components/output/Increment-types.ts +10 -0
- package/test/events/components/temp/{Increment-client-84c09711baf098c82ee226598ba7a36913616b75.ts → Increment-client-aeee696f3a4363c5c4c1ecf86de8ec071342ba22.ts} +3 -0
- package/test/events/components/temp/Increment-types-f259dd221aa967b0426746303f1f2c33aeeaf068.ts +10 -0
- package/test/for/components/output/For-client.ts +3 -0
- package/test/for/components/output/For-types.ts +10 -0
- package/test/for/components/output/ForEscape-client.ts +3 -0
- package/test/for/components/output/ForEscape-types.ts +10 -0
- package/test/for/components/output/ForIn-client.ts +3 -0
- package/test/for/components/output/ForIn-types.ts +10 -0
- package/test/for/components/output/ForOf-client.ts +3 -0
- package/test/for/components/output/ForOf-types.ts +10 -0
- package/test/for/components/temp/{For-client-2f6b4b81670b0ba31b01176b4f61ebf321e945bb.ts → For-client-bc23ebc49e3cf710762bce7cd1b73244c94a3abb.ts} +3 -0
- package/test/for/components/temp/For-types-8bcd17ab2e0faebb340a19f56e052cc94820a29a.ts +10 -0
- package/test/for/components/temp/{ForEscape-client-8d0fcc940851e687173b6a9129c3d83e0fc771ef.ts → ForEscape-client-a475ec9bdab5d57d30c27124fcf9ce38110ddf75.ts} +3 -0
- package/test/for/components/temp/ForEscape-types-bb4f3457b02c2ad97a7b6cbc66f9097a37728ed2.ts +10 -0
- package/test/for/components/temp/{ForIn-client-fa0614a1c7b8aa6e8819ed91a518479fd80453ae.ts → ForIn-client-890cee3ac35ede73eafad4e935eefd2fe7ecb9e2.ts} +3 -0
- package/test/for/components/temp/ForIn-types-fb4f7b02e23a40d27376760b7e1d06f8ecaa13ba.ts +10 -0
- package/test/for/components/temp/{ForOf-client-11006c4239d9018363e582dc5b54b50477d652e7.ts → ForOf-client-309297e25afd249f1a3e27126af23b7329c5c727.ts} +3 -0
- package/test/for/components/temp/ForOf-types-6e2fbcd0fbfd3c0a2c3d8c458fdda7b05c2a19b1.ts +10 -0
- package/test/function/components/output/Function-client.ts +3 -0
- package/test/function/components/output/Function-types.ts +10 -0
- package/test/function/components/temp/{Function-client-ec5fe7d599d6099bdfab78c2a0c8edf77a23cd9b.ts → Function-client-8423f53837e6503cdcc0d997684dd3e208b5dd13.ts} +3 -0
- package/test/function/components/temp/Function-types-5479cb46b9bef3251b7961fb6e99a8c30cd4220f.ts +10 -0
- package/test/html/components/output/Html-client.ts +3 -0
- package/test/html/components/output/Html-types.ts +10 -0
- package/test/html/components/temp/{Html-client-82ff34dcdcbdf4be1112bcb1baac8027cdc32de7.ts → Html-client-83b1a1be5c4b8e9cc06a616acf8418c786804255.ts} +3 -0
- package/test/html/components/temp/Html-types-c5dc816f932e3fb021c006f266a7c9a2f2fb5353.ts +10 -0
- package/test/if/components/IfCache.torp +14 -0
- package/test/if/components/output/IfAfterIf-client.ts +17 -8
- package/test/if/components/output/IfAfterIf-types.ts +10 -0
- package/test/if/components/output/IfCache-client.ts +70 -0
- package/test/if/components/output/IfCache-server.ts +22 -0
- package/test/if/components/output/IfCache-types.ts +10 -0
- package/test/if/components/output/IfElse-client.ts +10 -4
- package/test/if/components/output/IfElse-types.ts +10 -0
- package/test/if/components/output/IfElseIf-client.ts +12 -5
- package/test/if/components/output/IfElseIf-types.ts +10 -0
- package/test/if/components/output/IfFalse-client.ts +10 -4
- package/test/if/components/output/IfFalse-types.ts +10 -0
- package/test/if/components/output/IfNested-client.ts +17 -8
- package/test/if/components/output/IfNested-types.ts +10 -0
- package/test/if/components/temp/{IfAfterIf-client-c1cfd21a6ace4945703ba8f46aada923a60265d9.ts → IfAfterIf-client-5aa5aac7099224e0ec1e8bff6162d729f89267ec.ts} +17 -8
- package/test/if/components/temp/IfAfterIf-types-c4bd4f93c103a618889f40c77d55fa7de454f70b.ts +10 -0
- package/test/if/components/temp/IfCache-client-8433b3b239bc225d616f12e8904c4f2ba530efb4.ts +70 -0
- package/test/if/components/temp/IfCache-server-8b35e6a2009d72083013cfb01b187a1d027fdcc9.ts +22 -0
- package/test/if/components/temp/IfCache-types-02f467ce9ebc23ae68c9e5f33c90ecc96b666452.ts +10 -0
- package/test/if/components/temp/{IfElse-client-06dfcacd3a5225dcb0947587bcd4fae9ec3d3c1e.ts → IfElse-client-8bd2aa123e050847fdf28172479f0cc1a3ddb01c.ts} +10 -4
- package/test/if/components/temp/IfElse-types-e81080227f8f69ac1d81141d97a07e0a0e9391c1.ts +10 -0
- package/test/if/components/temp/{IfElseIf-client-26df9a728c9cb712d5ac0235b4c99885f25545b8.ts → IfElseIf-client-a17e2408252495ef0e90ba303a2d9e076867b6fd.ts} +12 -5
- package/test/if/components/temp/IfElseIf-types-a492d2b6e8517f598befca7127cd514244239984.ts +10 -0
- package/test/if/components/temp/{IfFalse-client-de6fc8e9eb222153608490e6d172e9aae9000aa1.ts → IfFalse-client-00a24a722347d2c711064dd504db9443747e5099.ts} +10 -4
- package/test/if/components/temp/IfFalse-types-1d512c6d82e2af9efe0221a9929b05ad62fd97fb.ts +10 -0
- package/test/if/components/temp/{IfNested-client-eefdd449fa700b2e7326bc72df8b32ddcadf9d21.ts → IfNested-client-2af78cceff5dbce510db31fd5b8bb4da5d30d53a.ts} +17 -8
- package/test/if/components/temp/IfNested-types-692d58ca98f3534102193a44aa358994f798ca7b.ts +10 -0
- package/test/if/if-cache.test.ts +68 -0
- package/test/mount/components/output/Mount-client.ts +3 -0
- package/test/mount/components/output/Mount-types.ts +10 -0
- package/test/mount/components/temp/{Mount-client-29896228d7d0ef3692a9d13065c1bbfbe3198cdc.ts → Mount-client-f4dd3d5a21d287d3d22a797805816fe09528dfb6.ts} +3 -0
- package/test/mount/components/temp/Mount-types-2d88616243f860d43b8b7d74a6bbeff9b2c6f27b.ts +10 -0
- package/test/on-mount/components/output/OnMount-client.ts +3 -0
- package/test/on-mount/components/output/OnMount-types.ts +10 -0
- package/test/on-mount/components/temp/{OnMount-client-038f8c6bbcf0278406909d6ba5394f311924fda9.ts → OnMount-client-8afb8473b51815e9b0ba994f3476217506b41b1d.ts} +3 -0
- package/test/on-mount/components/temp/OnMount-types-d0f834addb351520cc75a589cb9ec5b6a5a787b4.ts +10 -0
- package/test/party/components/output/AnswerButton-client.ts +3 -0
- package/test/party/components/output/AnswerButton-types.ts +10 -0
- package/test/party/components/output/AnswerButtonApp-client.ts +3 -0
- package/test/party/components/output/AnswerButtonApp-types.ts +10 -0
- package/test/party/components/output/ColorSelect-client.ts +3 -0
- package/test/party/components/output/ColorSelect-types.ts +10 -0
- package/test/party/components/output/Colors-client.ts +3 -0
- package/test/party/components/output/Colors-types.ts +10 -0
- package/test/party/components/output/Counter-client.ts +3 -0
- package/test/party/components/output/Counter-types.ts +10 -0
- package/test/party/components/output/CssStyle-client.ts +3 -0
- package/test/party/components/output/CssStyle-types.ts +10 -0
- package/test/party/components/output/DoubleCount-client.ts +3 -0
- package/test/party/components/output/DoubleCount-types.ts +10 -0
- package/test/party/components/output/FunnyButton-client.ts +3 -0
- package/test/party/components/output/FunnyButton-types.ts +10 -0
- package/test/party/components/output/FunnyButtonApp-client.ts +3 -0
- package/test/party/components/output/FunnyButtonApp-types.ts +10 -0
- package/test/party/components/output/HelloWorld-client.ts +3 -0
- package/test/party/components/output/HelloWorld-types.ts +10 -0
- package/test/party/components/output/InputFocused-client.ts +3 -0
- package/test/party/components/output/InputFocused-types.ts +10 -0
- package/test/party/components/output/InputHello-client.ts +3 -0
- package/test/party/components/output/InputHello-types.ts +10 -0
- package/test/party/components/output/IsAvailable-client.ts +3 -0
- package/test/party/components/output/IsAvailable-types.ts +10 -0
- package/test/party/components/output/Name-client.ts +3 -0
- package/test/party/components/output/Name-types.ts +10 -0
- package/test/party/components/output/NameUpdate-client.ts +3 -0
- package/test/party/components/output/NameUpdate-types.ts +10 -0
- package/test/party/components/output/PageTitle-client.ts +3 -0
- package/test/party/components/output/PageTitle-types.ts +10 -0
- package/test/party/components/output/PickPill-client.ts +3 -0
- package/test/party/components/output/PickPill-types.ts +10 -0
- package/test/party/components/output/Time-client.ts +3 -0
- package/test/party/components/output/Time-types.ts +10 -0
- package/test/party/components/output/TrafficLight-client.ts +14 -6
- package/test/party/components/output/TrafficLight-types.ts +10 -0
- package/test/party/components/output/UserProfile-client.ts +3 -0
- package/test/party/components/output/UserProfile-types.ts +15 -0
- package/test/party/components/output/UserProfileApp-client.ts +3 -0
- package/test/party/components/output/UserProfileApp-types.ts +10 -0
- package/test/party/components/output/UserProfileContext-client.ts +3 -0
- package/test/party/components/output/UserProfileContext-types.ts +10 -0
- package/test/party/components/output/UserProfileContextApp-client.ts +3 -0
- package/test/party/components/output/UserProfileContextApp-types.ts +10 -0
- package/test/party/components/temp/{AnswerButton-client-df895c3e7a88fd7ede9f951fc9de2ed75c27a5cb.ts → AnswerButton-client-2119fa9523949bca3e8ef264eff7e72611d70bac.ts} +3 -0
- package/test/party/components/temp/AnswerButton-types-7dc4d046e52be1e6cb46d6235ce7540bd3e7b2a5.ts +10 -0
- package/test/party/components/temp/{AnswerButtonApp-client-4c05ef36b1c0e93370fb463643419928717fa701.ts → AnswerButtonApp-client-87979b0578066e637c4257d6a7dbc2bfa1542515.ts} +3 -0
- package/test/party/components/temp/AnswerButtonApp-types-10a6f55029e859366f9a3a73cdcdb3f63e89dbeb.ts +10 -0
- package/test/party/components/temp/{ColorSelect-client-5db8d1b0924361fdb5efb867c14491402ec9668c.ts → ColorSelect-client-d7eb9276031b613439d7bd6212c76b4a972ebcad.ts} +3 -0
- package/test/party/components/temp/ColorSelect-types-e652a36ebdd98e8c23a8de3156c4499023f09301.ts +10 -0
- package/test/party/components/temp/{Colors-client-6d3ac693e85bdda50b8742282915997063a32769.ts → Colors-client-42c890154b9a132ebd784cccc4f4f9962f400b3e.ts} +3 -0
- package/test/party/components/temp/Colors-types-075975e9b9074b49f96f99d660f0ee580546a630.ts +10 -0
- package/test/party/components/temp/{Counter-client-0c604a107c5b84cdbf725f307dfe29d34f8a2cc8.ts → Counter-client-ad5e891eaea79548afabef156b87fee5317319b2.ts} +3 -0
- package/test/party/components/temp/Counter-types-206b0704ee2e25f5f3198d716fa524295581c075.ts +10 -0
- package/test/party/components/temp/{CssStyle-client-2a642d115ad52539f97c051c34687b8d6d12b324.ts → CssStyle-client-5078b4c735f6273e2565c7d7688c41afa026a2c3.ts} +3 -0
- package/test/party/components/temp/CssStyle-types-f1ce4f0b03d404c70704f271ce9bfc5d5107346c.ts +10 -0
- package/test/party/components/temp/{DoubleCount-client-8c85c3af12c471ea23bb702bbf5a3e240420f3ec.ts → DoubleCount-client-9406fd993ae8d0efa1f87848ae6e952591b20c3d.ts} +3 -0
- package/test/party/components/temp/DoubleCount-types-436bd75fe7808c3a30389aeb1740aea361aa8681.ts +10 -0
- package/test/party/components/temp/{FunnyButton-client-850dd3da0fa803c1bce5c53e88fcd2d48d279eb8.ts → FunnyButton-client-f8dea087fd6e3f2d7d0697cd3c87444c6866daf5.ts} +3 -0
- package/test/party/components/temp/FunnyButton-types-7780d5c5dfe3ff2369f8e3c505616036cfcd3759.ts +10 -0
- package/test/party/components/temp/{FunnyButtonApp-client-00300846d11a3d0a5a620c2ade87b935b7f0ebf8.ts → FunnyButtonApp-client-22aa2ee00b25a3ee0bda442372da843828231242.ts} +3 -0
- package/test/party/components/temp/FunnyButtonApp-types-ea73d641565a4478759166f462206dd97c92cedd.ts +10 -0
- package/test/party/components/temp/{HelloWorld-client-890b311ad9a3919379acdc1d52807ea36cc9f489.ts → HelloWorld-client-84fa7bd70d75149892044f4a15fdbf9ac8c7fcff.ts} +3 -0
- package/test/party/components/temp/HelloWorld-types-3c153ac7af343dbce6cb081f1ae1b4f85d7f0b10.ts +10 -0
- package/test/party/components/temp/{InputFocused-client-03527f9ceb52f66ac53887dbc884a0aa83bb7a23.ts → InputFocused-client-504b10731a6c96079a0abd7bb4a8381634ff4a0d.ts} +3 -0
- package/test/party/components/temp/InputFocused-types-33da14c13216ca00edaa8f02508db21f5cd32d31.ts +10 -0
- package/test/party/components/temp/{InputHello-client-f65a477624975b68b7aaa3614fbf198d4476480f.ts → InputHello-client-b9dd846c4cc129749781955f645327cc3c0956ac.ts} +3 -0
- package/test/party/components/temp/InputHello-types-ab629048402441fde9a292bc2d376c0deea482a8.ts +10 -0
- package/test/party/components/temp/{IsAvailable-client-8767437fd92cf79713de5b00828e1502e38d79e3.ts → IsAvailable-client-3bd6d53a45c3dcda3e958bb4b5000fef78301b04.ts} +3 -0
- package/test/party/components/temp/IsAvailable-types-23d4e196c659901c347a7b3e5c9e4a6668234adb.ts +10 -0
- package/test/party/components/temp/{Name-client-08903a8df8bdff5288170d3c89658192956587a9.ts → Name-client-b2cd160fc076bb34c0421a673358e7b7f61e4b49.ts} +3 -0
- package/test/party/components/temp/Name-types-06f89338c785a1fd352ed7de3ebe02b30722760d.ts +10 -0
- package/test/party/components/temp/{NameUpdate-client-d65b2476c3721d2efddf9385a61433e2a2dd0d72.ts → NameUpdate-client-f2dfcab63d80c25681aa6b15a61c547a0aab2f96.ts} +3 -0
- package/test/party/components/temp/NameUpdate-types-9c69805006d2d3bb457c5d4d87db8baeb431aeb6.ts +10 -0
- package/test/party/components/temp/{PageTitle-client-c006df9a3e662488a1db089de53fd485c6b923e4.ts → PageTitle-client-f4094f4b23126a99a211f804ed7c4a97a34733b3.ts} +3 -0
- package/test/party/components/temp/PageTitle-types-dfb55ea9b607c89167dbd7538523a484a6eec300.ts +10 -0
- package/test/party/components/temp/{PickPill-client-af8357daf3f6633c7f451d0bddd72fefe786d5c3.ts → PickPill-client-0a4e095bc2c963a2f091ae2f69c8d075f7d9b5a5.ts} +3 -0
- package/test/party/components/temp/PickPill-types-526e2bb4c36ec1bed87eaf5722093a0eaefcd9d3.ts +10 -0
- package/test/party/components/temp/{Time-client-94380d45de7275a5cec98e5f58c15b74b13e9c3e.ts → Time-client-95ee134377911d1c1cddbf074b8f943cdcf2a966.ts} +3 -0
- package/test/party/components/temp/Time-types-2bf6facfbb2d6e7de472d18760029afaefbb93e1.ts +10 -0
- package/test/party/components/temp/{TrafficLight-client-12b20962b4146ef08fe0c37597441533c7699408.ts → TrafficLight-client-dc0248dc967afbbbce4873cd37677cd97cc4933c.ts} +14 -6
- package/test/party/components/temp/TrafficLight-types-d301a2317da01a215fc8e5222dc6ff87226fa250.ts +10 -0
- package/test/party/components/temp/{UserProfile-client-e5330b2c96bd8b225cb6291bc8b1d9f35c93307e.ts → UserProfile-client-352291dcaf115cc563ae3a07ec6aed901fcc2bc1.ts} +3 -0
- package/test/party/components/temp/UserProfile-types-412089462c8dcc757d2f53e7ff8030296d3100c2.ts +15 -0
- package/test/party/components/temp/{UserProfileApp-client-4c86e4f9a0d042f4f4811868f0146e872b17353c.ts → UserProfileApp-client-18ad0243fd853dac3c3f71bea21b021bbd5b35f4.ts} +3 -0
- package/test/party/components/temp/UserProfileApp-types-3e70c106e03c68b4aa06c2fe21dfeceffe7cc313.ts +10 -0
- package/test/party/components/temp/{UserProfileContext-client-424131db3cc89ae4babe127b9108ffc5696c9e1d.ts → UserProfileContext-client-a3f521facb10ae64007c362e34bce41d8144bf96.ts} +3 -0
- package/test/party/components/temp/UserProfileContext-types-076b9fa0a87d3ca098884a003284050b36172cc6.ts +10 -0
- package/test/party/components/temp/{UserProfileContextApp-client-5f94a7ccf3e4542ea40d8046ad75eeb21005c55f.ts → UserProfileContextApp-client-cccb3b8e819279cd7f729af61b84ad9801213597.ts} +3 -0
- package/test/party/components/temp/UserProfileContextApp-types-d04199ab7d43ecc12ceccb7a0bef7ff38ac1e8b1.ts +10 -0
- package/test/props/components/output/Reactive-client.ts +5 -0
- package/test/props/components/output/Reactive-types.ts +10 -0
- package/test/props/components/temp/{Reactive-client-9bc3643675fc563f96efb00bc3c4b843ba4b7f2e.ts → Reactive-client-644526502a3c5db2be797056d127a124f76976d5.ts} +5 -0
- package/test/props/components/temp/Reactive-types-bd642939107f1be06666bfce1ad97a94ccc21ee1.ts +10 -0
- package/test/replace/components/output/Replace-client.ts +3 -0
- package/test/replace/components/output/Replace-types.ts +10 -0
- package/test/replace/components/temp/{Replace-client-6f21ff3eb303bd5488d211087dc35fcf998d4e2a.ts → Replace-client-b80bc4591f8638cf125e8de9c1b25ea840dc75e9.ts} +3 -0
- package/test/replace/components/temp/Replace-types-9aedaa79e9b616ea1780ea97306f3428faa5d477.ts +10 -0
- package/test/slots/components/output/Article-client.ts +3 -0
- package/test/slots/components/output/Article-types.ts +10 -0
- package/test/slots/components/output/Basic-client.ts +3 -0
- package/test/slots/components/output/Basic-types.ts +10 -0
- package/test/slots/components/output/Header-client.ts +3 -0
- package/test/slots/components/output/Header-types.ts +10 -0
- package/test/slots/components/output/Let-client.ts +3 -0
- package/test/slots/components/output/Let-types.ts +10 -0
- package/test/slots/components/output/List-client.ts +3 -0
- package/test/slots/components/output/List-types.ts +10 -0
- package/test/slots/components/output/Named-client.ts +3 -0
- package/test/slots/components/output/Named-types.ts +10 -0
- package/test/slots/components/output/Unused-client.ts +3 -0
- package/test/slots/components/output/Unused-types.ts +10 -0
- package/test/slots/components/temp/{Article-client-0b674ee98ae7f85021bfb8b912f28e3c4b35e877.ts → Article-client-df86e549f8681f2329bffb4bc6bdf8ef60659d82.ts} +3 -0
- package/test/slots/components/temp/Article-types-d3d960fbab7644ec2d90dfe39d908fbb65abaaa2.ts +10 -0
- package/test/slots/components/temp/{Basic-client-196f7f0244dca0baeffb547eec55c089a108283d.ts → Basic-client-5bf137a656d5bc8739443df8e6876ac6ffdaeddd.ts} +3 -0
- package/test/slots/components/temp/Basic-types-709765786c453e34088db3e894a59fb3332d3ed1.ts +10 -0
- package/test/slots/components/temp/{Header-client-e5c784d60469523803898ee4d8b85fb82a7b7c0b.ts → Header-client-89439803e4de9b44da53fc051088ded2b4816a83.ts} +3 -0
- package/test/slots/components/temp/Header-types-c56a108c6fb5a22b8ae156936bc05e58eef199c2.ts +10 -0
- package/test/slots/components/temp/{Let-client-645271fcd63cd500001c75740b22b1b387330657.ts → Let-client-1e404c72bae5fe99bdced72d497dc3700d001112.ts} +3 -0
- package/test/slots/components/temp/Let-types-3d05614de77a23df63a3cc1873b27ce1b0148c58.ts +10 -0
- package/test/slots/components/temp/{List-client-ee6047ac396dc0b6fce5e38af51c38093fae83a2.ts → List-client-73ebb1a2d1364d807ca67c2b3008efb73e5bc74f.ts} +3 -0
- package/test/slots/components/temp/List-types-fd59ad7d85c06e67ee766a2cf14a637dd129569e.ts +10 -0
- package/test/slots/components/temp/{Named-client-559988562c5de1ae6017d2ad6de063f4363064b6.ts → Named-client-fae857376ae748995be367ea0b78c86cb778dcee.ts} +3 -0
- package/test/slots/components/temp/Named-types-ed10fb6338eb9bd67281b9658bd7b10b572d346a.ts +10 -0
- package/test/slots/components/temp/{Unused-client-52d1828bd28ebf7046a2e948a369563c0ea83b98.ts → Unused-client-715ddd9fa963f8185b11dd3725849dddc9b4a8e0.ts} +3 -0
- package/test/slots/components/temp/Unused-types-88f7e38611b4cae1067969cf702cde41422837ae.ts +10 -0
- package/test/source-maps/components/output/Source-client.ts +10 -4
- package/test/source-maps/components/output/Source-types.ts +10 -0
- package/test/source-maps/components/temp/{Source-client-ae8c4811ff658c13ee8c9b9e0e53fff1b83b178b.ts → Source-client-ea4254d629d7270203bf98ffae915e9b753a2fe2.ts} +10 -4
- package/test/source-maps/components/temp/Source-types-69770c124317e0a0fd6aeb3d4f331b50231452fa.ts +10 -0
- package/test/special-component/components/output/BigTitle-client.ts +3 -0
- package/test/special-component/components/output/BigTitle-types.ts +10 -0
- package/test/special-component/components/output/Component-client.ts +3 -0
- package/test/special-component/components/output/Component-types.ts +10 -0
- package/test/special-component/components/output/SmallTitle-client.ts +3 -0
- package/test/special-component/components/output/SmallTitle-types.ts +10 -0
- package/test/special-component/components/temp/{BigTitle-client-cb3055f809aaf17bd1fa82748d039ac3730a8d44.ts → BigTitle-client-d46e785f86a5daee62360043056359ca3e1cb7a0.ts} +3 -0
- package/test/special-component/components/temp/BigTitle-types-cb6363da78f853772d3408240f32030d5e826859.ts +10 -0
- package/test/special-component/components/temp/{Component-client-0eb9553b52acce2dfa564242295a4c57a38bd540.ts → Component-client-bd3af877909777431434a02fb77e751980a0b822.ts} +3 -0
- package/test/special-component/components/temp/Component-types-196e5e5c55f61a9d24837f8de1fb9e9eeb2dd3f1.ts +10 -0
- package/test/special-component/components/temp/{SmallTitle-client-5a65b233be29395e9650f57d9708a33de1279af3.ts → SmallTitle-client-28035d0154e3af173e9e3a1921be3a358e236cc5.ts} +3 -0
- package/test/special-component/components/temp/SmallTitle-types-629b435eb6f9a402ff576511db3e1d150f8c612b.ts +10 -0
- package/test/special-element/components/output/Element-client.ts +3 -0
- package/test/special-element/components/output/Element-types.ts +10 -0
- package/test/special-element/components/temp/{Element-client-745e610fbd5c652d327c8ac349d49d5ee4c8d9ea.ts → Element-client-83bfbaab3d8c85cce6b97675d8955e03ae99ba24.ts} +3 -0
- package/test/special-element/components/temp/Element-types-478aac6fcc8cc71dc587b534bb45ddcde069e2cb.ts +10 -0
- package/test/special-head/components/output/Head-client.ts +3 -0
- package/test/special-head/components/output/Head-types.ts +10 -0
- package/test/special-head/components/temp/{Head-client-bbbb5e712247ee41ca65a7ffd457987de5e99b3e.ts → Head-client-9e828c39f1930711e6c7db1d318b63f195e01e92.ts} +3 -0
- package/test/special-head/components/temp/Head-types-88772e6c9aefe7f65c342350ad45b29e7fa16604.ts +10 -0
- package/test/special-self/components/output/Self-client.ts +10 -4
- package/test/special-self/components/output/Self-types.ts +10 -0
- package/test/special-self/components/temp/{Self-client-dfe57df69e3677e94f7b5f3657c82602054ef19e.ts → Self-client-6846c5e6cdac15947ab4361f2e2b4ec900abd988.ts} +10 -4
- package/test/special-self/components/temp/Self-types-d438955d6f42951942dfa72ec1b79ad4ee95e966.ts +10 -0
- package/test/style/components/output/Style-client.ts +3 -0
- package/test/style/components/output/Style-types.ts +10 -0
- package/test/style/components/temp/{Style-client-9491a5aff97f118df542f976d7f7a21e7cc88c62.ts → Style-client-710dc4eba0e6a6ecbee26adc0d739ffdfb73ef10.ts} +3 -0
- package/test/style/components/temp/Style-types-d7ced2961f74be74eebaedfb98c492c6789d3cb8.ts +10 -0
- package/test/svg/components/output/Shape-client.ts +10 -4
- package/test/svg/components/output/Shape-types.ts +10 -0
- package/test/svg/components/temp/{Shape-client-4cc148d8b70d3750d2982360aad76b74d194b60e.ts → Shape-client-691decdc6064d94b0951c7a08da10feebd087324.ts} +10 -4
- package/test/svg/components/temp/Shape-types-70f9e311a005452b58286636c0dcb67a73e9fab4.ts +10 -0
- package/test/switch/components/Switch.torp +6 -4
- package/test/switch/components/output/Switch-client.ts +18 -9
- package/test/switch/components/output/Switch-server.ts +6 -4
- package/test/switch/components/output/Switch-types.ts +18 -0
- package/test/switch/components/temp/{Switch-client-5fc00f4d41300dc7587b113d8e53a102beca7558.ts → Switch-client-dcb3511bb3db12ad47e2237afc32a788184ad566.ts} +18 -9
- package/test/switch/components/temp/{Switch-server-440f7e852145b79656c0023ddc776e4d1d077d2a.ts → Switch-server-bbb3b40226e88388eb6f016cb0fd4be54f6139e7.ts} +6 -4
- package/test/switch/components/temp/Switch-types-fad2e2b194747eb6c06474c81de5f814c15e06aa.ts +18 -0
- package/test/text/components/output/Text-client.ts +3 -0
- package/test/text/components/output/Text-types.ts +16 -0
- package/test/text/components/temp/{Text-client-6c3be8a1a31a13eff86ce8b5330829cd15b07fab.ts → Text-client-e05d0c431475bf49349b4f6c162c9e78e0577b10.ts} +3 -0
- package/test/text/components/temp/Text-types-f9e6d77cf5a6def5aff78be41ebca3e8e6a54278.ts +16 -0
- package/test/watch-array/components/output/Array-client.ts +3 -0
- package/test/watch-array/components/output/Array-types.ts +10 -0
- package/test/watch-array/components/output/ArrayEntries-client.ts +3 -0
- package/test/watch-array/components/output/ArrayEntries-types.ts +10 -0
- package/test/watch-array/components/output/ArrayIndexes-client.ts +3 -0
- package/test/watch-array/components/output/ArrayIndexes-types.ts +10 -0
- package/test/watch-array/components/output/ArrayUnkeyed-client.ts +3 -0
- package/test/watch-array/components/output/ArrayUnkeyed-types.ts +10 -0
- package/test/watch-array/components/temp/{Array-client-552f81452d33fe6dc715c9f6bb7986f06475d761.ts → Array-client-3110972e940a678cc26316f5f38b9315a27559ee.ts} +3 -0
- package/test/watch-array/components/temp/Array-types-4afcc38999fa0a5d5b28b8c54ea8f25659d91165.ts +10 -0
- package/test/watch-array/components/temp/{ArrayEntries-client-736755fba2492e74812ff9c905202810de54e15a.ts → ArrayEntries-client-7f1e7bf740768a929f21e62f6b8ee31db8a50918.ts} +3 -0
- package/test/watch-array/components/temp/ArrayEntries-types-ae83cd05c68e5e6b7e8d31212035c14ec9ea6b85.ts +10 -0
- package/test/watch-array/components/temp/{ArrayIndexes-client-a496328fa92ffca676ab8893013a0cfec1734ad1.ts → ArrayIndexes-client-9861162934f1d779326d4d268cd95d765155a085.ts} +3 -0
- package/test/watch-array/components/temp/ArrayIndexes-types-5f02ec73d46553fd5730abfe022dba9a76a341f7.ts +10 -0
- package/test/watch-array/components/temp/{ArrayUnkeyed-client-5a2c5cb1fecba52653f7f35cfd07627682930c15.ts → ArrayUnkeyed-client-4ae3d9a74e763f8879458012de2a3c3837956c99.ts} +3 -0
- package/test/watch-array/components/temp/ArrayUnkeyed-types-6f544a6b354c46913b9ee0e843d0a6482af2745d.ts +10 -0
- package/test/watch-object/components/output/Watched-client.ts +3 -0
- package/test/watch-object/components/output/Watched-types.ts +10 -0
- package/test/watch-object/components/temp/{Watched-client-1f0409aa6e2c425d0319a23caec7d10ad313d579.ts → Watched-client-a7ddca317e29ef12d882d90e7b043d9c99a5f355.ts} +3 -0
- package/test/watch-object/components/temp/Watched-types-70c7bde732f624bfbb8e353bf9d1be8dbaea63e1.ts +10 -0
- package/tsdown.config.ts +1 -1
- package/test/attributes/components/Attributes.d.ts +0 -18
- package/test/await/components/Await.d.ts +0 -18
- package/test/bench/components/Bench.d.ts +0 -18
- package/test/bind/components/BindText.d.ts +0 -18
- package/test/child-component/components/ParentChild.d.ts +0 -34
- package/test/class/components/Class.d.ts +0 -18
- package/test/component/components/Component.d.ts +0 -18
- package/test/component/components/Header.d.ts +0 -18
- package/test/console/components/Console.d.ts +0 -18
- package/test/const/components/Const.d.ts +0 -18
- package/test/effects/components/For.d.ts +0 -18
- package/test/effects/components/If.d.ts +0 -18
- package/test/effects/components/NestedIf.d.ts +0 -18
- package/test/events/components/Increment.d.ts +0 -18
- package/test/for/components/For.d.ts +0 -18
- package/test/for/components/ForEscape.d.ts +0 -18
- package/test/for/components/ForIn.d.ts +0 -18
- package/test/for/components/ForOf.d.ts +0 -18
- package/test/function/components/Function.d.ts +0 -18
- package/test/html/components/Html.d.ts +0 -18
- package/test/if/components/IfAfterIf.d.ts +0 -18
- package/test/if/components/IfElse.d.ts +0 -18
- package/test/if/components/IfElseIf.d.ts +0 -18
- package/test/if/components/IfNested.d.ts +0 -18
- package/test/mount/components/Mount.d.ts +0 -18
- package/test/on-mount/components/OnMount.d.ts +0 -18
- package/test/party/components/AnswerButton.d.ts +0 -18
- package/test/party/components/AnswerButtonApp.d.ts +0 -18
- package/test/party/components/ColorSelect.d.ts +0 -18
- package/test/party/components/Colors.d.ts +0 -18
- package/test/party/components/Counter.d.ts +0 -18
- package/test/party/components/CssStyle.d.ts +0 -18
- package/test/party/components/DoubleCount.d.ts +0 -18
- package/test/party/components/FunnyButton.d.ts +0 -18
- package/test/party/components/FunnyButtonApp.d.ts +0 -18
- package/test/party/components/HelloWorld.d.ts +0 -18
- package/test/party/components/InputFocused.d.ts +0 -18
- package/test/party/components/InputHello.d.ts +0 -18
- package/test/party/components/IsAvailable.d.ts +0 -18
- package/test/party/components/Name.d.ts +0 -18
- package/test/party/components/NameUpdate.d.ts +0 -18
- package/test/party/components/PageTitle.d.ts +0 -18
- package/test/party/components/PickPill.d.ts +0 -18
- package/test/party/components/Time.d.ts +0 -18
- package/test/party/components/TrafficLight.d.ts +0 -18
- package/test/party/components/UserProfile.d.ts +0 -23
- package/test/party/components/UserProfileApp.d.ts +0 -18
- package/test/party/components/UserProfileContext.d.ts +0 -18
- package/test/party/components/UserProfileContextApp.d.ts +0 -18
- package/test/replace/components/Replace.d.ts +0 -18
- package/test/slots/components/Article.d.ts +0 -18
- package/test/slots/components/Basic.d.ts +0 -18
- package/test/slots/components/Header.d.ts +0 -18
- package/test/slots/components/Let.d.ts +0 -18
- package/test/slots/components/List.d.ts +0 -18
- package/test/slots/components/Named.d.ts +0 -18
- package/test/slots/components/Unused.d.ts +0 -18
- package/test/special-component/components/BigTitle.d.ts +0 -18
- package/test/special-component/components/Component.d.ts +0 -18
- package/test/special-component/components/SmallTitle.d.ts +0 -18
- package/test/special-element/components/Element.d.ts +0 -18
- package/test/special-head/components/Head.d.ts +0 -18
- package/test/special-self/components/Self.d.ts +0 -18
- package/test/style/components/Style.d.ts +0 -18
- package/test/svg/components/Shape.d.ts +0 -18
- package/test/switch/components/Switch.d.ts +0 -21
- package/test/text/components/Text.d.ts +0 -21
- package/test/watch-array/components/Array.d.ts +0 -18
- package/test/watch-array/components/ArrayEntries.d.ts +0 -18
- package/test/watch-array/components/ArrayIndexes.d.ts +0 -18
- package/test/watch-array/components/ArrayUnkeyed.d.ts +0 -18
- package/test/watch-object/components/Watched.d.ts +0 -18
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,906 @@
|
|
|
1
|
+
const require_formatText = require('./formatText-DufG5l83.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/render/$mount.ts
|
|
4
|
+
/**
|
|
5
|
+
* Runs and re-runs a function on component mount
|
|
6
|
+
*
|
|
7
|
+
* @param fn The function to run, which may return a cleanup function
|
|
8
|
+
*/
|
|
9
|
+
function $mount(fn) {
|
|
10
|
+
require_formatText.context_default.mountEffects.push(fn);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/render/$run.ts
|
|
15
|
+
/**
|
|
16
|
+
* Runs and re-runs a function that depends on a watched object
|
|
17
|
+
*
|
|
18
|
+
* @param fn The function to run, which may return a cleanup function.
|
|
19
|
+
*/
|
|
20
|
+
function $run(fn, name) {
|
|
21
|
+
let effect = {
|
|
22
|
+
type: require_formatText.EFFECT_TYPE,
|
|
23
|
+
run: fn,
|
|
24
|
+
cleanup: void 0,
|
|
25
|
+
firstSource: null,
|
|
26
|
+
nextEffect: null,
|
|
27
|
+
extent: 0,
|
|
28
|
+
nextEffectToRun: null,
|
|
29
|
+
didError: false,
|
|
30
|
+
name
|
|
31
|
+
};
|
|
32
|
+
require_formatText.runEffect(effect);
|
|
33
|
+
return effect;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/watch/symbols.ts
|
|
38
|
+
const proxyDataSymbol = Symbol("_proxy_data");
|
|
39
|
+
const proxyHandledSymbol = Symbol("_proxy_handled");
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/render/$unwrap.ts
|
|
43
|
+
/**
|
|
44
|
+
* Returns the target object of a proxy
|
|
45
|
+
*
|
|
46
|
+
* @param object The proxy object
|
|
47
|
+
*/
|
|
48
|
+
function $unwrap(object) {
|
|
49
|
+
return object !== void 0 && object !== null && object[proxyDataSymbol] !== void 0 ? object[proxyDataSymbol].target ?? object : object;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/watch/trackProxyEffect.ts
|
|
54
|
+
function trackProxyEffect(data, key) {
|
|
55
|
+
let signal = data.signals.get(key);
|
|
56
|
+
if (signal === void 0) {
|
|
57
|
+
signal = {
|
|
58
|
+
type: require_formatText.SIGNAL_TYPE,
|
|
59
|
+
firstTarget: null,
|
|
60
|
+
nextSignalToUpdate: null
|
|
61
|
+
};
|
|
62
|
+
data.signals.set(key, signal);
|
|
63
|
+
}
|
|
64
|
+
require_formatText.trackEffect(signal);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/watch/updateSignal.ts
|
|
69
|
+
let lastEffect;
|
|
70
|
+
/**
|
|
71
|
+
* When a signal is changed, we need to
|
|
72
|
+
* - Set the signal's subscriptions to recalc
|
|
73
|
+
* - Set any dependent computed values to recalc
|
|
74
|
+
* - Gather dependent effects that will need to be re-run
|
|
75
|
+
*/
|
|
76
|
+
function updateSignal(proxy, key) {
|
|
77
|
+
let signal = proxy.signals.get(key);
|
|
78
|
+
if (signal !== void 0 && signal.firstTarget !== null) {
|
|
79
|
+
require_formatText.batchStart();
|
|
80
|
+
try {
|
|
81
|
+
if (require_formatText.context_default.firstSignalToUpdate === null) require_formatText.context_default.firstSignalToUpdate = signal;
|
|
82
|
+
else if (signal.nextSignalToUpdate === null) {
|
|
83
|
+
let lastSignal = require_formatText.context_default.firstSignalToUpdate;
|
|
84
|
+
while (lastSignal.nextSignalToUpdate !== null) lastSignal = lastSignal.nextSignalToUpdate;
|
|
85
|
+
lastSignal.nextSignalToUpdate = signal;
|
|
86
|
+
}
|
|
87
|
+
lastEffect = require_formatText.context_default.firstEffectToRun;
|
|
88
|
+
if (lastEffect !== null) while (lastEffect.nextEffectToRun !== null) lastEffect = lastEffect.nextEffectToRun;
|
|
89
|
+
let targetSub = signal.firstTarget;
|
|
90
|
+
let computed;
|
|
91
|
+
outer: while (true) {
|
|
92
|
+
targetSub.active = false;
|
|
93
|
+
targetSub.recalc = true;
|
|
94
|
+
const target = targetSub.target;
|
|
95
|
+
if (target.type === require_formatText.EFFECT_TYPE) {
|
|
96
|
+
if (lastEffect === null) {
|
|
97
|
+
require_formatText.context_default.firstEffectToRun = target;
|
|
98
|
+
lastEffect = target;
|
|
99
|
+
} else if (target.nextEffectToRun === null && lastEffect !== target) {
|
|
100
|
+
lastEffect.nextEffectToRun = target;
|
|
101
|
+
lastEffect = target;
|
|
102
|
+
}
|
|
103
|
+
} else if (!target.recalc) {
|
|
104
|
+
target.recalc = true;
|
|
105
|
+
if (target.firstTarget !== null) {
|
|
106
|
+
computed = target;
|
|
107
|
+
computed.rollback = targetSub;
|
|
108
|
+
targetSub = target.firstTarget;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
while (targetSub.nextTarget === null && computed !== void 0) {
|
|
113
|
+
targetSub = computed.rollback;
|
|
114
|
+
if (targetSub.source.type !== require_formatText.COMPUTED_TYPE) {
|
|
115
|
+
computed = void 0;
|
|
116
|
+
continue outer;
|
|
117
|
+
}
|
|
118
|
+
computed = targetSub.source;
|
|
119
|
+
}
|
|
120
|
+
if (targetSub.nextTarget === null) break;
|
|
121
|
+
targetSub = targetSub.nextTarget;
|
|
122
|
+
}
|
|
123
|
+
} finally {
|
|
124
|
+
require_formatText.batchEnd();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/watch/proxyGet.ts
|
|
131
|
+
function proxyGet(target, key, receiver) {
|
|
132
|
+
let data = target[proxyDataSymbol];
|
|
133
|
+
if (key === proxyDataSymbol) return data;
|
|
134
|
+
let signal = data.signals.get(key);
|
|
135
|
+
if (signal === void 0) {
|
|
136
|
+
const propDescriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
137
|
+
if (propDescriptor !== void 0) {
|
|
138
|
+
if (propDescriptor.writable) {
|
|
139
|
+
if (data.shallow !== true) {
|
|
140
|
+
const value = target[key];
|
|
141
|
+
if (value !== void 0 && value !== null && typeof value === "object" && value[proxyDataSymbol] === void 0 && value.then === void 0) target[key] = $watch(value);
|
|
142
|
+
}
|
|
143
|
+
trackProxyEffect(data, key);
|
|
144
|
+
} else if (propDescriptor.get) {
|
|
145
|
+
const oldRegisterComputed = require_formatText.context_default.registerComputed;
|
|
146
|
+
try {
|
|
147
|
+
require_formatText.context_default.registerComputed = (computed) => {
|
|
148
|
+
data.signals.set(key, computed);
|
|
149
|
+
};
|
|
150
|
+
return Reflect.get(target, key, receiver);
|
|
151
|
+
} finally {
|
|
152
|
+
require_formatText.context_default.registerComputed = oldRegisterComputed;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
} else if (data.isArray) {
|
|
156
|
+
if (arrayWrapper[key] !== void 0) return arrayWrapper[key](data, target, key);
|
|
157
|
+
}
|
|
158
|
+
} else if (signal.type === require_formatText.SIGNAL_TYPE) trackProxyEffect(data, key);
|
|
159
|
+
else if (signal.type === require_formatText.COMPUTED_TYPE) {
|
|
160
|
+
if (signal.running) throw new Error("Cycle detected");
|
|
161
|
+
else if (signal.recalc) require_formatText.checkComputed(signal);
|
|
162
|
+
else if (signal.didError) throw signal.value;
|
|
163
|
+
else require_formatText.trackEffect(signal);
|
|
164
|
+
return signal.value;
|
|
165
|
+
}
|
|
166
|
+
return Reflect.get(target, key, receiver);
|
|
167
|
+
}
|
|
168
|
+
const arrayWrapper = {
|
|
169
|
+
[Symbol.iterator]: function(data, target, key) {
|
|
170
|
+
trackProxyEffect(data, "length");
|
|
171
|
+
require_formatText.context_default.activeTarget = null;
|
|
172
|
+
return target[key];
|
|
173
|
+
},
|
|
174
|
+
pop: arrayHandle,
|
|
175
|
+
push: arrayHandle,
|
|
176
|
+
reverse: arrayHandle,
|
|
177
|
+
shift: arrayHandle,
|
|
178
|
+
sort: arrayHandle,
|
|
179
|
+
splice: arrayHandle,
|
|
180
|
+
unshift: arrayHandle
|
|
181
|
+
};
|
|
182
|
+
function arrayHandle(data, target, key) {
|
|
183
|
+
return function(...args) {
|
|
184
|
+
const result = target[key].apply(target, args);
|
|
185
|
+
updateSignal(data, "length");
|
|
186
|
+
return result;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/watch/proxySet.ts
|
|
192
|
+
function proxySet(target, key, value, receiver) {
|
|
193
|
+
const oldValue = target[key];
|
|
194
|
+
if (value !== oldValue) {
|
|
195
|
+
if (require_formatText.context_default.batchOperation > 100) throw new Error("Cycle detected");
|
|
196
|
+
let data = target[proxyDataSymbol];
|
|
197
|
+
if (oldValue && oldValue[proxyDataSymbol] !== void 0) value = $watch(value, { shallow: oldValue[proxyDataSymbol].shallow });
|
|
198
|
+
Reflect.set(target, key, value, receiver);
|
|
199
|
+
updateSignal(data, key);
|
|
200
|
+
if (data.isArray && !isNaN(+String(key))) updateSignal(data, "length");
|
|
201
|
+
}
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/render/$watch.ts
|
|
207
|
+
/**
|
|
208
|
+
* Watches an object and runs effects when its properties are changed
|
|
209
|
+
*
|
|
210
|
+
* @param object The object to watch
|
|
211
|
+
*/
|
|
212
|
+
function $watch(object, options) {
|
|
213
|
+
if (object === void 0 || object === null || object[proxyDataSymbol] !== void 0) return object;
|
|
214
|
+
object[proxyDataSymbol] = {
|
|
215
|
+
target: object,
|
|
216
|
+
isArray: Array.isArray(object),
|
|
217
|
+
shallow: options?.shallow === true,
|
|
218
|
+
signals: /* @__PURE__ */ new Map()
|
|
219
|
+
};
|
|
220
|
+
const handler = {
|
|
221
|
+
get: proxyGet,
|
|
222
|
+
set: proxySet
|
|
223
|
+
};
|
|
224
|
+
return new Proxy(object, handler);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/render/addAnimation.ts
|
|
229
|
+
function addAnimation(el, entry, exit) {
|
|
230
|
+
require_formatText.context_default.stashedAnimations.push({
|
|
231
|
+
range: require_formatText.context_default.activeRange,
|
|
232
|
+
el,
|
|
233
|
+
in: entry,
|
|
234
|
+
out: exit
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/render/addEvent.ts
|
|
240
|
+
function addEvent(el, type, listener) {
|
|
241
|
+
require_formatText.context_default.stashedEvents.push({
|
|
242
|
+
range: require_formatText.context_default.activeRange,
|
|
243
|
+
el,
|
|
244
|
+
type,
|
|
245
|
+
listener
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/motion/animate.ts
|
|
251
|
+
/**
|
|
252
|
+
* Adds an animation for an element
|
|
253
|
+
* @param el The element to animate
|
|
254
|
+
* @param enter Whether the animation is being run on enter
|
|
255
|
+
* @param keyframes The Web Animation API keyframes
|
|
256
|
+
* @param options The Web Animmation API options
|
|
257
|
+
*/
|
|
258
|
+
async function animate(el, enter, keyframes, options) {
|
|
259
|
+
let animationOptions = Object.assign({
|
|
260
|
+
direction: enter ? "normal" : "reverse",
|
|
261
|
+
duration: 300,
|
|
262
|
+
easing: "ease-in-out",
|
|
263
|
+
fill: "forwards"
|
|
264
|
+
}, options);
|
|
265
|
+
const animation = el.animate(keyframes, animationOptions);
|
|
266
|
+
setTimeout(() => {
|
|
267
|
+
animation.timeline = el.ownerDocument.timeline;
|
|
268
|
+
}, 1);
|
|
269
|
+
let activeRange = require_formatText.context_default.activeRange;
|
|
270
|
+
if (activeRange) {
|
|
271
|
+
activeRange.animations ??= /* @__PURE__ */ new Set();
|
|
272
|
+
activeRange.animations.add(animation);
|
|
273
|
+
await animation.finished;
|
|
274
|
+
activeRange.animations.delete(animation);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/render/isFragmentNode.ts
|
|
280
|
+
function isFragmentNode(node) {
|
|
281
|
+
return node.nodeType === 11;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/render/addFragment.ts
|
|
286
|
+
function addFragment(fragment, parent, before, endNode) {
|
|
287
|
+
const range = require_formatText.context_default.activeRange;
|
|
288
|
+
const hydrationNode = require_formatText.context_default.hydrationNode;
|
|
289
|
+
if (hydrationNode !== null) range.endNode = endNode ?? hydrationNode;
|
|
290
|
+
else {
|
|
291
|
+
range.startNode = fragment.firstChild;
|
|
292
|
+
range.endNode = fragment.lastChild;
|
|
293
|
+
}
|
|
294
|
+
parent = before?.parentNode ?? parent;
|
|
295
|
+
if (hydrationNode === null) parent.insertBefore(fragment, before);
|
|
296
|
+
if (!isFragmentNode(parent)) {
|
|
297
|
+
if (hydrationNode === null) {
|
|
298
|
+
for (let effect of require_formatText.context_default.mountEffects) $run(effect);
|
|
299
|
+
require_formatText.context_default.mountEffects.length = 0;
|
|
300
|
+
}
|
|
301
|
+
for (let event of require_formatText.context_default.stashedEvents) {
|
|
302
|
+
require_formatText.context_default.activeRange = event.range;
|
|
303
|
+
$run(function addFragmentEvent() {
|
|
304
|
+
event.el.addEventListener(event.type, event.listener);
|
|
305
|
+
return () => {
|
|
306
|
+
event.el.removeEventListener(event.type, event.listener);
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
require_formatText.context_default.stashedEvents.length = 0;
|
|
311
|
+
for (let animation of require_formatText.context_default.stashedAnimations) {
|
|
312
|
+
require_formatText.context_default.activeRange = animation.range;
|
|
313
|
+
$run(function addFragmentAnimation() {
|
|
314
|
+
if (animation.in !== void 0) animate(animation.el, true, animation.in.keyframes, animation.in.options);
|
|
315
|
+
if (animation.out !== void 0) return () => {
|
|
316
|
+
animate(animation.el, false, animation.out.keyframes, animation.out.options);
|
|
317
|
+
};
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
require_formatText.context_default.stashedAnimations.length = 0;
|
|
321
|
+
require_formatText.context_default.activeRange = range;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region src/render/applyProps.ts
|
|
327
|
+
function applyProps(el, props, propNamesUsed) {
|
|
328
|
+
if (props !== void 0) {
|
|
329
|
+
for (let [name, value] of Object.entries(props)) if (!propNamesUsed.includes(name)) if (name.startsWith("on")) {
|
|
330
|
+
const eventName = name.substring(2);
|
|
331
|
+
el.addEventListener(eventName, value);
|
|
332
|
+
} else $run(function setAttribute$1() {
|
|
333
|
+
el.setAttribute(name, value);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/render/clearRange.ts
|
|
340
|
+
function clearRange(range) {
|
|
341
|
+
let animations = range.animations !== null ? Array.from(range.animations) : void 0;
|
|
342
|
+
let childRange = range.nextRange;
|
|
343
|
+
while (childRange !== null && childRange.depth > range.depth) {
|
|
344
|
+
if (childRange.animations !== null) {
|
|
345
|
+
animations ??= [];
|
|
346
|
+
animations.push(...childRange.animations);
|
|
347
|
+
}
|
|
348
|
+
releaseRange(childRange);
|
|
349
|
+
childRange.depth = -2;
|
|
350
|
+
childRange = childRange.nextRange;
|
|
351
|
+
}
|
|
352
|
+
range.nextRange = childRange;
|
|
353
|
+
if (range.previousRange !== null) range.previousRange.nextRange = range.nextRange;
|
|
354
|
+
if (range.nextRange !== null) range.nextRange.previousRange = range.previousRange;
|
|
355
|
+
if (animations !== void 0) Promise.all(animations.map((a) => a.finished)).then(() => clearNodes(range));
|
|
356
|
+
else clearNodes(range);
|
|
357
|
+
}
|
|
358
|
+
function clearNodes(range) {
|
|
359
|
+
if (range.startNode !== null && range.endNode !== null) {
|
|
360
|
+
let currentNode = range.endNode;
|
|
361
|
+
while (currentNode !== range.startNode) {
|
|
362
|
+
let previousNode = currentNode.previousSibling;
|
|
363
|
+
currentNode.remove();
|
|
364
|
+
currentNode = previousNode;
|
|
365
|
+
}
|
|
366
|
+
currentNode.remove();
|
|
367
|
+
}
|
|
368
|
+
releaseRange(range);
|
|
369
|
+
}
|
|
370
|
+
function releaseRange(range) {
|
|
371
|
+
range.startNode = null;
|
|
372
|
+
range.endNode = null;
|
|
373
|
+
range.previousRange = null;
|
|
374
|
+
range.nextRange = null;
|
|
375
|
+
range.animations = null;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/render/clearLayoutSlot.ts
|
|
380
|
+
function clearLayoutSlot(range) {
|
|
381
|
+
clearRange(range);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/render/newRange.ts
|
|
386
|
+
function newRange(name) {
|
|
387
|
+
return {
|
|
388
|
+
startNode: null,
|
|
389
|
+
endNode: null,
|
|
390
|
+
previousRange: null,
|
|
391
|
+
nextRange: null,
|
|
392
|
+
depth: -1,
|
|
393
|
+
animations: null,
|
|
394
|
+
name
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/render/popRange.ts
|
|
400
|
+
function popRange(oldRange) {
|
|
401
|
+
require_formatText.context_default.activeRange = oldRange;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/render/pushRange.ts
|
|
406
|
+
function pushRange(range, toParent = false) {
|
|
407
|
+
const activeRange = require_formatText.context_default.activeRange;
|
|
408
|
+
if (toParent) {
|
|
409
|
+
const previousRange = require_formatText.context_default.previousRange;
|
|
410
|
+
range.previousRange = previousRange;
|
|
411
|
+
const nextRange = previousRange.nextRange;
|
|
412
|
+
previousRange.nextRange = range;
|
|
413
|
+
range.nextRange = nextRange;
|
|
414
|
+
range.depth = activeRange.depth + 1;
|
|
415
|
+
}
|
|
416
|
+
require_formatText.context_default.activeRange = range;
|
|
417
|
+
require_formatText.context_default.previousRange = range;
|
|
418
|
+
return activeRange;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/render/fillLayoutSlot.ts
|
|
423
|
+
function fillLayoutSlot(component, slot, parent, anchor, $props, $context) {
|
|
424
|
+
const range = newRange();
|
|
425
|
+
const oldRange = pushRange(range);
|
|
426
|
+
component(parent, anchor, $props, $context, { _: slot });
|
|
427
|
+
popRange(oldRange);
|
|
428
|
+
return range;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/render/getFragment.ts
|
|
433
|
+
function getFragment(document, array, index, html, ns) {
|
|
434
|
+
if (array[index] === void 0) if (ns === true) {
|
|
435
|
+
const template = document.createElementNS("http://www.w3.org/2000/svg", "template");
|
|
436
|
+
template.innerHTML = html;
|
|
437
|
+
const fragment = new DocumentFragment();
|
|
438
|
+
fragment.append(...template.childNodes);
|
|
439
|
+
array[index] = fragment;
|
|
440
|
+
} else {
|
|
441
|
+
const template = document.createElement("template");
|
|
442
|
+
template.innerHTML = html;
|
|
443
|
+
array[index] = template.content;
|
|
444
|
+
}
|
|
445
|
+
return array[index].cloneNode(true);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/render/hydrate.ts
|
|
450
|
+
/**
|
|
451
|
+
* Hydrates a component into an existing DOM tree
|
|
452
|
+
* @param parent The parent node
|
|
453
|
+
* @param component The component to mount
|
|
454
|
+
* @param props An object containing component props
|
|
455
|
+
*/
|
|
456
|
+
function hydrate(parent, component, props, slots) {
|
|
457
|
+
require_formatText.context_default.hydrationNode = parent.firstChild;
|
|
458
|
+
require_formatText.context_default.rootRange = newRange();
|
|
459
|
+
require_formatText.context_default.previousRange = require_formatText.context_default.rootRange;
|
|
460
|
+
pushRange(require_formatText.context_default.rootRange);
|
|
461
|
+
component(parent, null, props, void 0, slots);
|
|
462
|
+
require_formatText.context_default.hydrationNode = null;
|
|
463
|
+
for (let effect of require_formatText.context_default.mountEffects) $run(effect);
|
|
464
|
+
require_formatText.context_default.mountEffects.length = 0;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/render/mount.ts
|
|
469
|
+
/**
|
|
470
|
+
* Mounts a component into a DOM node
|
|
471
|
+
*
|
|
472
|
+
* @param parent The node to mount the component into
|
|
473
|
+
* @param component The component to mount
|
|
474
|
+
* @param props An object containing component props
|
|
475
|
+
*/
|
|
476
|
+
function mount(parent, component, props, slots) {
|
|
477
|
+
if (parent.childElementCount > 0) throw new Error("The parent node must have no child elements");
|
|
478
|
+
while (parent.firstChild !== null) parent.firstChild.remove();
|
|
479
|
+
require_formatText.context_default.rootRange = newRange();
|
|
480
|
+
require_formatText.context_default.previousRange = require_formatText.context_default.rootRange;
|
|
481
|
+
pushRange(require_formatText.context_default.rootRange);
|
|
482
|
+
component(parent, null, props, void 0, slots);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/render/newListItem.ts
|
|
487
|
+
function newListItem(data, key) {
|
|
488
|
+
return {
|
|
489
|
+
startNode: null,
|
|
490
|
+
endNode: null,
|
|
491
|
+
previousRange: null,
|
|
492
|
+
nextRange: null,
|
|
493
|
+
depth: -1,
|
|
494
|
+
animations: null,
|
|
495
|
+
data,
|
|
496
|
+
key
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
//#endregion
|
|
501
|
+
//#region src/render/hydrationMarkers.ts
|
|
502
|
+
const HYDRATION_START = "[";
|
|
503
|
+
const HYDRATION_END = "]";
|
|
504
|
+
const HYDRATION_BREAK = "^";
|
|
505
|
+
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/render/isCommentNode.ts
|
|
508
|
+
function isCommentNode(node) {
|
|
509
|
+
return node.nodeType === 8;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region src/render/isTextNode.ts
|
|
514
|
+
function isTextNode(node) {
|
|
515
|
+
return node.nodeType === 3;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/render/nodeCheckHydrationBreak.ts
|
|
520
|
+
/**
|
|
521
|
+
* When hydrating, removes and skips hydration comments that are inserted at the
|
|
522
|
+
* start of branches and used to split up text nodes that would otherwise be
|
|
523
|
+
* joined in HTML.
|
|
524
|
+
*
|
|
525
|
+
* @param node The node to check and maybe skip.
|
|
526
|
+
* @returns The next node.
|
|
527
|
+
*/
|
|
528
|
+
function nodeCheckHydrationBreak(node) {
|
|
529
|
+
if (require_formatText.context_default.hydrationNode !== null) {
|
|
530
|
+
if (node !== null && isCommentNode(node) && node.data === HYDRATION_BREAK) {
|
|
531
|
+
let comment = node;
|
|
532
|
+
node = node.nextSibling;
|
|
533
|
+
comment.remove();
|
|
534
|
+
}
|
|
535
|
+
require_formatText.context_default.hydrationNode = node;
|
|
536
|
+
}
|
|
537
|
+
return node;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region src/render/nodeNext.ts
|
|
542
|
+
/**
|
|
543
|
+
* Gets the next sibling of a node.
|
|
544
|
+
*
|
|
545
|
+
* When hydrating, sets the hydration node.
|
|
546
|
+
*
|
|
547
|
+
* @param node The node.
|
|
548
|
+
* @param text Whether we require a text node.
|
|
549
|
+
*/
|
|
550
|
+
function nodeNext(node, text = false) {
|
|
551
|
+
if (require_formatText.context_default.hydrationNode !== null && text && isTextNode(node)) return node;
|
|
552
|
+
return nodeCheckHydrationBreak(node.nextSibling);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
//#endregion
|
|
556
|
+
//#region src/render/nodeAnchor.ts
|
|
557
|
+
/**
|
|
558
|
+
* Gets the anchor node for a control statement or component.
|
|
559
|
+
*
|
|
560
|
+
* When mounting, this just returns the anchor node parameter (because it was
|
|
561
|
+
* created).
|
|
562
|
+
*
|
|
563
|
+
* When hydrating, there should be matched <![> and <!]> comments in the HTML,
|
|
564
|
+
* and the anchor node should be after the end comment. The matched comment
|
|
565
|
+
* nodes will be deleted, and the hydration node set to the first node inside
|
|
566
|
+
* the matched comments.
|
|
567
|
+
*
|
|
568
|
+
* @param node The potential anchor node.
|
|
569
|
+
* @returns The anchor node.
|
|
570
|
+
*/
|
|
571
|
+
function nodeAnchor(node) {
|
|
572
|
+
if (require_formatText.context_default.hydrationNode !== null) {
|
|
573
|
+
if (isCommentNode(node) && node.data === HYDRATION_START) {
|
|
574
|
+
let currentNode = nodeNext(node);
|
|
575
|
+
node.remove();
|
|
576
|
+
let level = 1;
|
|
577
|
+
while (currentNode !== null) {
|
|
578
|
+
if (isCommentNode(currentNode)) {
|
|
579
|
+
if (currentNode.data === HYDRATION_START) level += 1;
|
|
580
|
+
else if (currentNode.data === HYDRATION_END) {
|
|
581
|
+
level -= 1;
|
|
582
|
+
if (level === 0) {
|
|
583
|
+
const endNode = currentNode.nextSibling;
|
|
584
|
+
currentNode.remove();
|
|
585
|
+
if (require_formatText.context_default.hydrationNode === currentNode) require_formatText.context_default.hydrationNode = endNode;
|
|
586
|
+
return endNode;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
currentNode = currentNode.nextSibling;
|
|
591
|
+
}
|
|
592
|
+
if (currentNode === null) throw new Error("End hydration comment not found");
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return node;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region src/render/nodeChild.ts
|
|
600
|
+
/**
|
|
601
|
+
* Gets the first child of a node.
|
|
602
|
+
*
|
|
603
|
+
* Sets the hydration node.
|
|
604
|
+
*
|
|
605
|
+
* @param parent The parent node.
|
|
606
|
+
*/
|
|
607
|
+
function nodeChild(parent) {
|
|
608
|
+
let childNode = parent.firstChild;
|
|
609
|
+
if (require_formatText.context_default.hydrationNode !== null) {
|
|
610
|
+
if (childNode === null) childNode = parent.appendChild(parent.ownerDocument.createTextNode(""));
|
|
611
|
+
require_formatText.context_default.hydrationNode = childNode;
|
|
612
|
+
}
|
|
613
|
+
return childNode;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/render/nodeRoot.ts
|
|
618
|
+
/**
|
|
619
|
+
* Gets the first child in a fragment.
|
|
620
|
+
*
|
|
621
|
+
* When hydrating, also sets the active range's start node, while we have it.
|
|
622
|
+
*
|
|
623
|
+
* @param parent The parent of the fragment.
|
|
624
|
+
* @param text Whether we require a text node.
|
|
625
|
+
*/
|
|
626
|
+
function nodeRoot(parent, text = false) {
|
|
627
|
+
if (require_formatText.context_default.hydrationNode !== null) {
|
|
628
|
+
let rootNode = require_formatText.context_default.hydrationNode;
|
|
629
|
+
if (text && !isTextNode(rootNode) && rootNode.previousSibling !== null && isTextNode(rootNode.previousSibling)) {
|
|
630
|
+
rootNode = rootNode.previousSibling;
|
|
631
|
+
require_formatText.context_default.hydrationNode = rootNode;
|
|
632
|
+
}
|
|
633
|
+
if (isCommentNode(rootNode) && rootNode.data === HYDRATION_START) {
|
|
634
|
+
rootNode = rootNode.nextSibling;
|
|
635
|
+
require_formatText.context_default.hydrationNode = rootNode;
|
|
636
|
+
}
|
|
637
|
+
const range = require_formatText.context_default.activeRange;
|
|
638
|
+
if (range.startNode === null) range.startNode = rootNode;
|
|
639
|
+
return rootNode;
|
|
640
|
+
} else return parent.firstChild;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region src/render/nodeSkip.ts
|
|
645
|
+
/**
|
|
646
|
+
* Gets the sibling of a node, x nodes after it.
|
|
647
|
+
*
|
|
648
|
+
* When hydrating, sets the hydration node.
|
|
649
|
+
*
|
|
650
|
+
* @param node The node.
|
|
651
|
+
* @param count The number of nodes to skip.
|
|
652
|
+
*/
|
|
653
|
+
function nodeSkip(node, count) {
|
|
654
|
+
let nextNode = node;
|
|
655
|
+
for (let i = 0; i < count; i++) nextNode = nodeCheckHydrationBreak(nextNode.nextSibling);
|
|
656
|
+
return nextNode;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
//#endregion
|
|
660
|
+
//#region src/render/runControl.ts
|
|
661
|
+
/**
|
|
662
|
+
* Runs an`if`, `switch` or `await` control statement
|
|
663
|
+
* @param create A function that creates the control statement's branches
|
|
664
|
+
*/
|
|
665
|
+
function runControl(range, anchor, create) {
|
|
666
|
+
const oldRange = pushRange(range, true);
|
|
667
|
+
$run(function runControl$1() {
|
|
668
|
+
const oldBranchRange = pushRange(range);
|
|
669
|
+
create(anchor);
|
|
670
|
+
popRange(oldBranchRange);
|
|
671
|
+
});
|
|
672
|
+
if (require_formatText.context_default.hydrationNode) anchor = require_formatText.context_default.hydrationNode.nextSibling;
|
|
673
|
+
popRange(oldRange);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region src/render/runControlBranch.ts
|
|
678
|
+
function runControlBranch(range, create) {
|
|
679
|
+
if (range.depth === -2) return;
|
|
680
|
+
if (range.nextRange !== null && range.nextRange.depth > range.depth) clearRange(range.nextRange);
|
|
681
|
+
const oldRange = pushRange(newRange(), true);
|
|
682
|
+
create();
|
|
683
|
+
popRange(oldRange);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/render/moveRange.ts
|
|
688
|
+
function moveRange(parent, range, before) {
|
|
689
|
+
parent = before?.parentNode ?? parent;
|
|
690
|
+
const endNode = range.endNode ?? range.startNode;
|
|
691
|
+
let currentNode = range.startNode;
|
|
692
|
+
while (currentNode !== null) {
|
|
693
|
+
const nextNode = currentNode.nextSibling;
|
|
694
|
+
parent.insertBefore(currentNode, before);
|
|
695
|
+
if (currentNode === endNode) break;
|
|
696
|
+
currentNode = nextNode;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
//#endregion
|
|
701
|
+
//#region src/render/runListItems.ts
|
|
702
|
+
/**
|
|
703
|
+
* @param range The list's range
|
|
704
|
+
* @param parent The parent DOM element
|
|
705
|
+
* @param anchor The DOM element to create new items before
|
|
706
|
+
* @param oldItems The list of current items
|
|
707
|
+
* @param newItems The list of future items
|
|
708
|
+
* @param create A function that creates the DOM elements for a new item
|
|
709
|
+
*/
|
|
710
|
+
function runListItems(range, parent, anchor, oldItems, newItems, create, update) {
|
|
711
|
+
let oldStartIndex = 0;
|
|
712
|
+
let oldEndIndex = oldItems.length - 1;
|
|
713
|
+
let oldStartItem = oldItems[0];
|
|
714
|
+
let oldEndItem = oldItems[oldEndIndex];
|
|
715
|
+
let newStartIndex = 0;
|
|
716
|
+
let newEndIndex = newItems.length - 1;
|
|
717
|
+
let newStartItem = newItems[0];
|
|
718
|
+
let newEndItem = newItems[newEndIndex];
|
|
719
|
+
let oldKeyToIndex;
|
|
720
|
+
let newKeyToIndex;
|
|
721
|
+
while (oldStartIndex <= oldEndIndex && newStartIndex <= newEndIndex) if (oldStartItem === null) oldStartItem = oldItems[++oldStartIndex];
|
|
722
|
+
else if (oldEndItem === null) oldEndItem = oldItems[--oldEndIndex];
|
|
723
|
+
else if (newStartItem === null) newStartItem = newItems[++newStartIndex];
|
|
724
|
+
else if (newEndItem === null) newEndItem = newItems[--newEndIndex];
|
|
725
|
+
else if (oldStartItem.key === newStartItem.key) {
|
|
726
|
+
transferListItemData(oldStartItem, newStartItem, update);
|
|
727
|
+
oldStartItem = oldItems[++oldStartIndex];
|
|
728
|
+
newStartItem = newItems[++newStartIndex];
|
|
729
|
+
} else if (oldEndItem.key === newEndItem.key) {
|
|
730
|
+
transferListItemData(oldEndItem, newEndItem, update);
|
|
731
|
+
oldEndItem = oldItems[--oldEndIndex];
|
|
732
|
+
newEndItem = newItems[--newEndIndex];
|
|
733
|
+
} else if (oldStartItem.key === newEndItem.key) {
|
|
734
|
+
moveRange(parent, oldStartItem, oldEndItem.endNode.nextSibling);
|
|
735
|
+
transferListItemData(oldStartItem, newEndItem, update);
|
|
736
|
+
oldStartItem = oldItems[++oldStartIndex];
|
|
737
|
+
newEndItem = newItems[--newEndIndex];
|
|
738
|
+
} else if (oldEndItem.key === newStartItem.key) {
|
|
739
|
+
moveRange(parent, oldEndItem, oldStartItem.startNode);
|
|
740
|
+
transferListItemData(oldEndItem, newStartItem, update);
|
|
741
|
+
oldEndItem = oldItems[--oldEndIndex];
|
|
742
|
+
newStartItem = newItems[++newStartIndex];
|
|
743
|
+
} else {
|
|
744
|
+
if (oldKeyToIndex === void 0 || newKeyToIndex === void 0) {
|
|
745
|
+
oldKeyToIndex = /* @__PURE__ */ new Map();
|
|
746
|
+
for (let i = oldStartIndex; i < oldEndIndex; i++) oldKeyToIndex.set(oldItems[i].key, i);
|
|
747
|
+
newKeyToIndex = /* @__PURE__ */ new Map();
|
|
748
|
+
for (let i = newStartIndex; i < newEndIndex; i++) newKeyToIndex.set(newItems[i].key, i);
|
|
749
|
+
}
|
|
750
|
+
let oldIndex = oldKeyToIndex.get(newStartItem.key);
|
|
751
|
+
let newIndex = newKeyToIndex.get(oldStartItem.key);
|
|
752
|
+
if (oldIndex === void 0 && newIndex === void 0) {
|
|
753
|
+
newStartItem.data = $watch(newStartItem.data, { shallow: true });
|
|
754
|
+
create(newStartItem, oldStartItem.startNode);
|
|
755
|
+
newStartItem.previousRange = oldStartItem.previousRange;
|
|
756
|
+
newStartItem.nextRange = oldStartItem;
|
|
757
|
+
oldStartItem.previousRange = newStartItem;
|
|
758
|
+
clearRange(oldStartItem);
|
|
759
|
+
oldStartItem = oldItems[++oldStartIndex];
|
|
760
|
+
newStartItem = newItems[++newStartIndex];
|
|
761
|
+
} else if (oldIndex === void 0) {
|
|
762
|
+
newStartItem.data = $watch(newStartItem.data, { shallow: true });
|
|
763
|
+
create(newStartItem, oldStartItem.startNode);
|
|
764
|
+
newStartItem = newItems[++newStartIndex];
|
|
765
|
+
} else if (newIndex === void 0) {
|
|
766
|
+
clearRange(oldStartItem);
|
|
767
|
+
oldStartItem = oldItems[++oldStartIndex];
|
|
768
|
+
} else {
|
|
769
|
+
const oldData = oldItems[oldIndex];
|
|
770
|
+
moveRange(parent, oldData, oldStartItem.startNode);
|
|
771
|
+
transferListItemData(oldData, newStartItem, update);
|
|
772
|
+
oldItems[oldIndex] = null;
|
|
773
|
+
newStartItem = newItems[++newStartIndex];
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
if (oldStartIndex <= oldEndIndex || newStartIndex <= newEndIndex) if (oldStartIndex > oldEndIndex) {
|
|
777
|
+
let before = oldStartItem?.startNode ?? oldItems[oldItems.length - 1]?.endNode?.nextSibling ?? anchor;
|
|
778
|
+
for (; newStartIndex <= newEndIndex; newStartItem = newItems[++newStartIndex]) {
|
|
779
|
+
newStartItem.data = $watch(newStartItem.data, { shallow: true });
|
|
780
|
+
create(newStartItem, before);
|
|
781
|
+
before = newStartItem.endNode.nextSibling;
|
|
782
|
+
}
|
|
783
|
+
} else for (; oldEndIndex >= oldStartIndex; oldStartItem = oldItems[oldEndIndex--]) clearRange(oldStartItem);
|
|
784
|
+
if (newItems.length > 0) range.nextRange = newItems[0];
|
|
785
|
+
else if (oldItems.length > 0) range.nextRange = oldItems[oldItems.length - 1].nextRange;
|
|
786
|
+
}
|
|
787
|
+
function transferListItemData(oldItem, newItem, update) {
|
|
788
|
+
newItem.startNode = oldItem.startNode;
|
|
789
|
+
newItem.endNode = oldItem.endNode;
|
|
790
|
+
update(oldItem, newItem);
|
|
791
|
+
newItem.data = oldItem.data;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region src/render/runList.ts
|
|
796
|
+
/**
|
|
797
|
+
* Runs a `for` control statement
|
|
798
|
+
* @param create A function that creates the control statement's branches
|
|
799
|
+
*/
|
|
800
|
+
function runList(range, parent, anchor, buildItems, create, update) {
|
|
801
|
+
const oldRange = pushRange(range, true);
|
|
802
|
+
let listItems = [];
|
|
803
|
+
$run(function runList$1() {
|
|
804
|
+
const oldBranchRange = pushRange(range);
|
|
805
|
+
const newItems = buildItems();
|
|
806
|
+
require_formatText.context_default.activeTarget = null;
|
|
807
|
+
runListItems(range, parent, anchor, listItems, newItems, create, update);
|
|
808
|
+
listItems = newItems;
|
|
809
|
+
popRange(oldBranchRange);
|
|
810
|
+
});
|
|
811
|
+
if (require_formatText.context_default.hydrationNode !== null) anchor = require_formatText.context_default.hydrationNode.nextSibling;
|
|
812
|
+
popRange(oldRange);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
//#endregion
|
|
816
|
+
//#region src/render/setAttribute.ts
|
|
817
|
+
function setAttribute(el, name, value) {
|
|
818
|
+
if (value === false || value === void 0 || value === null) el.removeAttribute(name);
|
|
819
|
+
else el.setAttribute(name, value);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
//#endregion
|
|
823
|
+
//#region src/render/setDynamicElement.ts
|
|
824
|
+
function setDynamicElement(el, tag) {
|
|
825
|
+
if (require_formatText.context_default.hydrationNode !== null) return el;
|
|
826
|
+
let newElement = el.ownerDocument.createElement(tag);
|
|
827
|
+
el.replaceWith(newElement);
|
|
828
|
+
return newElement;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
//#endregion
|
|
832
|
+
//#region src/wrappers/ReactiveDate.ts
|
|
833
|
+
let initialized = false;
|
|
834
|
+
/**
|
|
835
|
+
* Wraps a Date object for $watching.
|
|
836
|
+
*/
|
|
837
|
+
var ReactiveDate = class ReactiveDate extends Date {
|
|
838
|
+
constructor(...params) {
|
|
839
|
+
super(...params);
|
|
840
|
+
if (!initialized) this.#init();
|
|
841
|
+
this[proxyHandledSymbol] = true;
|
|
842
|
+
this[proxyDataSymbol] = {
|
|
843
|
+
target: this,
|
|
844
|
+
isArray: false,
|
|
845
|
+
shallow: true,
|
|
846
|
+
signals: /* @__PURE__ */ new Map()
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
#init() {
|
|
850
|
+
initialized = true;
|
|
851
|
+
let reactivePrototype = ReactiveDate.prototype;
|
|
852
|
+
let datePrototype = Date.prototype;
|
|
853
|
+
const methods = Object.getOwnPropertyNames(datePrototype);
|
|
854
|
+
for (const method of methods) {
|
|
855
|
+
if (method.startsWith("get") || method.startsWith("to") || method === "valueOf") reactivePrototype[method] = function(...args) {
|
|
856
|
+
const data = this[proxyDataSymbol];
|
|
857
|
+
const result = datePrototype[method].apply(this, args);
|
|
858
|
+
trackProxyEffect(data, "#time");
|
|
859
|
+
return result;
|
|
860
|
+
};
|
|
861
|
+
if (method.startsWith("set")) reactivePrototype[method] = function(...args) {
|
|
862
|
+
const data = this[proxyDataSymbol];
|
|
863
|
+
const result = datePrototype[method].apply(this, args);
|
|
864
|
+
updateSignal(data, "#time");
|
|
865
|
+
return result;
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
//#endregion
|
|
872
|
+
exports.$batch = require_formatText.$batch;
|
|
873
|
+
exports.$cache = require_formatText.$cache;
|
|
874
|
+
exports.$mount = $mount;
|
|
875
|
+
exports.$peek = require_formatText.$peek;
|
|
876
|
+
exports.$run = $run;
|
|
877
|
+
exports.$unwrap = $unwrap;
|
|
878
|
+
exports.$watch = $watch;
|
|
879
|
+
exports.ReactiveDate = ReactiveDate;
|
|
880
|
+
exports.clearLayoutSlot = clearLayoutSlot;
|
|
881
|
+
exports.fillLayoutSlot = fillLayoutSlot;
|
|
882
|
+
exports.hydrate = hydrate;
|
|
883
|
+
exports.mount = mount;
|
|
884
|
+
exports.t_add_fragment = addFragment;
|
|
885
|
+
exports.t_anchor = nodeAnchor;
|
|
886
|
+
exports.t_animate = addAnimation;
|
|
887
|
+
exports.t_apply_props = applyProps;
|
|
888
|
+
exports.t_attribute = setAttribute;
|
|
889
|
+
exports.t_child = nodeChild;
|
|
890
|
+
exports.t_class = require_formatText.buildClasses;
|
|
891
|
+
exports.t_dynamic = setDynamicElement;
|
|
892
|
+
exports.t_event = addEvent;
|
|
893
|
+
exports.t_fmt = require_formatText.formatText;
|
|
894
|
+
exports.t_fragment = getFragment;
|
|
895
|
+
exports.t_list_item = newListItem;
|
|
896
|
+
exports.t_next = nodeNext;
|
|
897
|
+
exports.t_pop_range = popRange;
|
|
898
|
+
exports.t_push_range = pushRange;
|
|
899
|
+
exports.t_range = newRange;
|
|
900
|
+
exports.t_root = nodeRoot;
|
|
901
|
+
exports.t_run_branch = runControlBranch;
|
|
902
|
+
exports.t_run_control = runControl;
|
|
903
|
+
exports.t_run_list = runList;
|
|
904
|
+
exports.t_skip = nodeSkip;
|
|
905
|
+
exports.t_style = require_formatText.buildStyles;
|
|
906
|
+
//# sourceMappingURL=index.cjs.map
|