mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-18 16:46:10 -04:00
Compare commits
1784 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b04a262433 | |||
| 96bafa7f0b | |||
| b10612da5c | |||
| 171f4206a8 | |||
| bd83d19197 | |||
| 95cf201c6d | |||
| 4107711dae | |||
| 67f0758cb5 | |||
| 1c99944a32 | |||
| d3ea4959b4 | |||
| 70b27fbff2 | |||
| 96c2144857 | |||
| 0655af4d4f | |||
| 3fc0fdbe62 | |||
| fd73571744 | |||
| 80d861c12c | |||
| 3506de8d1a | |||
| 32456d6966 | |||
| bdc2af9733 | |||
| a7daf41934 | |||
| fe6ff2528a | |||
| 7ceb8708b0 | |||
| 4d22d957a1 | |||
| 79f1a863b6 | |||
| 98db3d37ef | |||
| c02976782b | |||
| ceb4376eb8 | |||
| 0566b7bcb3 | |||
| 6d0ecb9f5e | |||
| 0901948564 | |||
| e6d028fd6b | |||
| 945e7082cd | |||
| 0d6bdfb514 | |||
| 70712bdab6 | |||
| 53771d7f95 | |||
| 6d32d4024d | |||
| f387589342 | |||
| 47a5080352 | |||
| 5314c83534 | |||
| 204c964050 | |||
| 1ede99f71e | |||
| 3c1844046a | |||
| eefa90a2bc | |||
| efa0737660 | |||
| 6232560273 | |||
| e051d383a0 | |||
| 4fb5c1828d | |||
| 6f3b2fa66b | |||
| f17459fdc3 | |||
| a053f40e59 | |||
| 9a0459fdd3 | |||
| 46a859736a | |||
| e4524a2be9 | |||
| f3ee1cc947 | |||
| 86bc28dfb3 | |||
| 1bc0934228 | |||
| f26fd18c7a | |||
| c68dba8c21 | |||
| f768e1eece | |||
| f99557cc05 | |||
| f785823e00 | |||
| 62cd2263c2 | |||
| 7157634db0 | |||
| 86442adb20 | |||
| 569137eb22 | |||
| 5e3a37c9e8 | |||
| 4651066472 | |||
| 8d325b96ea | |||
| b52cb198b5 | |||
| bcee6632af | |||
| 150a1b8eed | |||
| 4c49b84213 | |||
| b27f177138 | |||
| b2f63897f9 | |||
| 2ee392be9b | |||
| f37652edb3 | |||
| 27049eb706 | |||
| a2974099c1 | |||
| 041a809b07 | |||
| 2ecc6b30aa | |||
| d582bbbb60 | |||
| ca3eda8fc7 | |||
| 4d25e3b90b | |||
| 83c820a18c | |||
| 3eface706c | |||
| 8d143f4bf1 | |||
| 88fbd78492 | |||
| 9a235a7c15 | |||
| d99607ea14 | |||
| 5150ec06dc | |||
| b9f190562e | |||
| eb189d077d | |||
| 9756d63cf1 | |||
| a800b32529 | |||
| 8f56ef6507 | |||
| 92e0d09c28 | |||
| 64d80f98db | |||
| 01391d316b | |||
| 1d32da075d | |||
| 9b32900b96 | |||
| ecf837636b | |||
| 5a76bc93b8 | |||
| b14e5577b4 | |||
| 4121ac91ee | |||
| c44f202c44 | |||
| 9059b16c7c | |||
| 3760f51c3c | |||
| aa18293f1d | |||
| 63066937e9 | |||
| 34f0d631d9 | |||
| b3522fea6a | |||
| 2ae3ce53f3 | |||
| 2adacbd27b | |||
| 45eed1b7e7 | |||
| b36d334f78 | |||
| bd648185bc | |||
| 67f1dc32a5 | |||
| d47d9dadf4 | |||
| b52f8c2925 | |||
| 59ce624521 | |||
| 70b9fbfcf6 | |||
| 74b9279416 | |||
| c3ba8ee0fa | |||
| 4f5ca0767d | |||
| d0a1374d2f | |||
| a747c976fe | |||
| 94fcea1040 | |||
| 7db684e308 | |||
| 1981e1c34c | |||
| 5274508665 | |||
| 6f68bdcf5b | |||
| cf20f1059f | |||
| 307c69edb9 | |||
| 9a07b15952 | |||
| a178d310fd | |||
| 12451ba5fc | |||
| 69554c0762 | |||
| 3152bc123a | |||
| 4871abbd71 | |||
| bd2333377f | |||
| 76aaedba66 | |||
| b0f316eecd | |||
| 49903abed7 | |||
| d106875605 | |||
| c13feccdcd | |||
| 6aebf99ebc | |||
| 5d6ccf56d7 | |||
| 0323f75bae | |||
| f31fdb0988 | |||
| 92024f68cf | |||
| f9c1e46c01 | |||
| a5af6d5f4c | |||
| b1d06c4eb7 | |||
| 89bf3b2817 | |||
| ea8aabceed | |||
| 9fd2d3d640 | |||
| 967dea346f | |||
| 57bc0b7032 | |||
| 9974311344 | |||
| b0bdd09032 | |||
| f477273d8a | |||
| 014303b0d5 | |||
| 201fe726b6 | |||
| 2ed3a5c582 | |||
| 975a198ee9 | |||
| 837f8f318d | |||
| f96827d052 | |||
| a9dc0912d0 | |||
| b5039ecce8 | |||
| 624affe092 | |||
| 9b5842b20e | |||
| edfa0c65f9 | |||
| 39e81aa77c | |||
| 8bde87246b | |||
| e2a082f748 | |||
| d7c2cf562f | |||
| f44ceb46cd | |||
| f524dde5ae | |||
| 47aa4cf198 | |||
| 1b55a5e3e0 | |||
| cb57d8f497 | |||
| e12421cee8 | |||
| 53484db768 | |||
| 4c337a5114 | |||
| 63ae95186b | |||
| 8c0065f563 | |||
| 5c41d6789c | |||
| e19f799046 | |||
| 7dac1e275d | |||
| d74d50c40a | |||
| 8b4be4d100 | |||
| de4460a047 | |||
| 0ed615a312 | |||
| e8e8f888dd | |||
| 3776791239 | |||
| 77fee0b866 | |||
| 5671b40707 | |||
| dec039ead3 | |||
| fb81f6f268 | |||
| deb973afa5 | |||
| 2dea3911ba | |||
| e0a7fb8290 | |||
| 30e402b9f1 | |||
| f6d9ad51c6 | |||
| 34ba81a841 | |||
| d7fae2620e | |||
| 9979a08cb0 | |||
| 17dd48f2a4 | |||
| 355ac2ea29 | |||
| 000e1293db | |||
| 48fa04f164 | |||
| ed8f5bf24f | |||
| e17df79133 | |||
| 9519d286bd | |||
| b462f19ef1 | |||
| 1cdb5964c6 | |||
| 592e54a53f | |||
| fe60f34015 | |||
| b5dc65d52a | |||
| 93a4efcf6d | |||
| 40f3212efa | |||
| 53d6ef04b8 | |||
| c29d032027 | |||
| 7fcd9d8a83 | |||
| fc034830d0 | |||
| 48e06bd213 | |||
| 96e0cce2d2 | |||
| 88f677e910 | |||
| 9f50f6ef0e | |||
| 20e8a30583 | |||
| 89c06046b5 | |||
| 9c13f6bb53 | |||
| b5edcde638 | |||
| 93e8186388 | |||
| 8e35079fd1 | |||
| 9663c2ec85 | |||
| 7da7554493 | |||
| 372e93e8f8 | |||
| 9b58cf9890 | |||
| 9fac2c3c33 | |||
| 505ad17447 | |||
| 129327077a | |||
| 034df01e1f | |||
| be1e5a7d0e | |||
| 9872a89a29 | |||
| cf445633c2 | |||
| 2cec7bc1a6 | |||
| 46bfd74e8d | |||
| f6b1e13113 | |||
| f0c3d38ea7 | |||
| d4afbc63e2 | |||
| 466574a856 | |||
| a8d0d39055 | |||
| 1b04243af6 | |||
| 29082808cb | |||
| d23cac506c | |||
| 8959c630ae | |||
| 35a4f9808d | |||
| 49906e98b7 | |||
| 7b6f63db05 | |||
| 37f97e1c17 | |||
| 60e559a910 | |||
| f6f5ee0375 | |||
| 72d1f129cf | |||
| 9474ed7d85 | |||
| 99194814a9 | |||
| 87feac447b | |||
| 0a070a2084 | |||
| 1d3f87a431 | |||
| f38d1c272e | |||
| b0bbd58f66 | |||
| 73fd801907 | |||
| bc59f20af4 | |||
| daf9187572 | |||
| 783c856fd7 | |||
| f939e00a84 | |||
| b31faa9bbc | |||
| 853a31b638 | |||
| faaed61384 | |||
| b50f686a96 | |||
| f45a3933de | |||
| 98a1786c10 | |||
| 1f16ebc5b2 | |||
| 79e8e430f1 | |||
| 6440621d5d | |||
| 59a4cd9cf8 | |||
| 6238be7f2c | |||
| 4051276d74 | |||
| 145510266a | |||
| 4d361a2b3d | |||
| c4fe664215 | |||
| ace71693b7 | |||
| f19ac748e6 | |||
| a7713213f9 | |||
| 845571a716 | |||
| 8b1dfab077 | |||
| 6969800192 | |||
| 37a13d1a00 | |||
| 8c89938eaf | |||
| 5116bf74ad | |||
| a6f969614e | |||
| c1b7476f43 | |||
| 0ca4c1de0f | |||
| ec44103d20 | |||
| 89fe0f11ae | |||
| 63a01088a0 | |||
| c3e48f1b4d | |||
| 31cd626820 | |||
| 8dd0e9600d | |||
| 10d86ff835 | |||
| cec8553fb5 | |||
| b03bf9ec3d | |||
| a750490eea | |||
| 5281c61f99 | |||
| 52628920d9 | |||
| ac2e450e38 | |||
| f8d1e9e004 | |||
| e551dfeddb | |||
| 2f9244e90d | |||
| 056fae518b | |||
| a45d87667f | |||
| 7225b0b18d | |||
| e72c9cbebf | |||
| c787bb26c7 | |||
| 20f3ddd277 | |||
| 5cac182b26 | |||
| 78b2b5ccc3 | |||
| 60cee7fd2f | |||
| 2bd21df762 | |||
| a32ed02745 | |||
| 93c5eeb99e | |||
| ff45baba2c | |||
| cc4d38b4a5 | |||
| bf30587180 | |||
| 1b372a9a7b | |||
| d9f78e1283 | |||
| 2ddd2d1f39 | |||
| 6b31160bbd | |||
| 74aa85b38b | |||
| 8e9b607fa1 | |||
| 5332f99a5a | |||
| e1a8bd333d | |||
| 018a45e2d4 | |||
| 2c43fb2512 | |||
| 3e5664a877 | |||
| ac41426a20 | |||
| 8a0cf14fd7 | |||
| 362f0df117 | |||
| 1190f6e091 | |||
| ebf93c06dd | |||
| fe8debe6e8 | |||
| b8866cf575 | |||
| 2ce8576ab2 | |||
| 1bca05e349 | |||
| 8146725f89 | |||
| 34c44a29c6 | |||
| 7c948dd812 | |||
| 61919a1b3e | |||
| 9be10890e1 | |||
| f51109cb26 | |||
| 9aec18b3a0 | |||
| b374cdf47c | |||
| b16f235e1c | |||
| c26e5bbf0d | |||
| 020c326458 | |||
| dacd1e6146 | |||
| 25b2eb5783 | |||
| 7c3dbac083 | |||
| 54b5d69c8d | |||
| 407510e265 | |||
| f7a283f87d | |||
| 508a6c92b2 | |||
| 9045ce05da | |||
| 456be920d3 | |||
| 71b4e14dd3 | |||
| fb7a9e2083 | |||
| 69e99fa902 | |||
| 5e7e1ff0e8 | |||
| 18e9ceb501 | |||
| 458c97b927 | |||
| 4fd3e6e99c | |||
| c606f86e9d | |||
| e7376c4fc8 | |||
| 886b16d6fd | |||
| 64c2e7c1e8 | |||
| 88e933ee25 | |||
| 1f62d85d8b | |||
| 3fd5fdf1ee | |||
| e419733716 | |||
| ecc8e0a108 | |||
| 2868a5ff4f | |||
| d71877f915 | |||
| e0e896d4b5 | |||
| 0a280e9399 | |||
| a58ac967a6 | |||
| ebc6723f55 | |||
| 66fd20ace5 | |||
| de00212bb6 | |||
| f0b458cd17 | |||
| 7aa217828b | |||
| b27f8e45dc | |||
| 3e02f0a0ba | |||
| f759999826 | |||
| 049aa35286 | |||
| dd8be657c2 | |||
| 09752241ba | |||
| 83561a0ceb | |||
| b8ca83ddd1 | |||
| 4cae6c051b | |||
| e5f9467329 | |||
| 34c1f3c7de | |||
| c0f56be2a9 | |||
| c6f89431d9 | |||
| 80601451b6 | |||
| f74d1beb62 | |||
| b73ea7f086 | |||
| a3bf6975c4 | |||
| 08ebb52e9b | |||
| 47a6af2b25 | |||
| a84cfb5677 | |||
| 6e92c4915a | |||
| 2a18df61cd | |||
| fb28083ce6 | |||
| 476bda812e | |||
| 265f01eb06 | |||
| cb9ef3ee6a | |||
| a4487179a5 | |||
| f43f627037 | |||
| a7b799f154 | |||
| ee7cd8cd4c | |||
| 2d1fcf4a8d | |||
| ef14074164 | |||
| 49aa9cf6da | |||
| 8d5ef45e2b | |||
| 9ef177e735 | |||
| 7f1919ebc6 | |||
| 1aaaaba619 | |||
| b7dd9b7d35 | |||
| ff0af15ac7 | |||
| 8a7ff9e01d | |||
| e52e257d9b | |||
| 2d6654b234 | |||
| 1b0427e943 | |||
| 24e1881876 | |||
| bfff38a262 | |||
| 2aff31fe06 | |||
| 6ba2b767b0 | |||
| bbc292561f | |||
| e4b00117c3 | |||
| d25851ac17 | |||
| d02450c0d9 | |||
| 400b2109fb | |||
| 2a09f9ef0b | |||
| 0052d349d9 | |||
| 7c8a8b8b70 | |||
| 85835087ba | |||
| 5aac042c80 | |||
| 9dbd073073 | |||
| 035f6c8098 | |||
| d2a06654c3 | |||
| c028686298 | |||
| 858a02634e | |||
| 2682fd38f8 | |||
| 3ecb701504 | |||
| ac359a0e9e | |||
| df636cf4f6 | |||
| 791a363694 | |||
| 06eb8b5be8 | |||
| 4b4290e087 | |||
| c89f91215c | |||
| 65d07dbff2 | |||
| 2e4d28b910 | |||
| 51c63fa996 | |||
| f0a582dc92 | |||
| bee36a7a4f | |||
| 0edd54dee3 | |||
| 4a16cd891f | |||
| 23dd9d4c01 | |||
| df277d6b7b | |||
| eed2c304e4 | |||
| bd5953317e | |||
| b88f58cc21 | |||
| 9cbf3079f3 | |||
| 682ac25111 | |||
| 07da9a9dd2 | |||
| 395ae4d05a | |||
| 2ef35a8583 | |||
| 5807dbfdac | |||
| c4f26c3cad | |||
| 26d87b691c | |||
| 52e2b90eef | |||
| 62eb9ce598 | |||
| a9efda3bc3 | |||
| 8fe4dca4c2 | |||
| a05d3a47c6 | |||
| e9265eff35 | |||
| 8fa7bf795a | |||
| f045fb44de | |||
| 0d06840a1b | |||
| 624e540cb4 | |||
| 353333653f | |||
| 83fec57400 | |||
| 7ad0ec1600 | |||
| ec611aac45 | |||
| d7752961b8 | |||
| 8c5837e78a | |||
| b3f8df1783 | |||
| 0ecc6c196f | |||
| 77686547eb | |||
| 419cf6c12b | |||
| 326571b797 | |||
| c25c2693f5 | |||
| 8d8a1f552d | |||
| 638f5c7323 | |||
| 9ec5d33840 | |||
| 8d3ba2a8cd | |||
| 0c2838cc90 | |||
| 1e5edfca26 | |||
| b141e1ee68 | |||
| 2fd4836228 | |||
| 9ceab0f294 | |||
| d4c12dcef4 | |||
| 16bb920011 | |||
| 158fa85c46 | |||
| 34bd0e11e4 | |||
| 9e649a18c4 | |||
| 2bb45afe5f | |||
| 41a9098c80 | |||
| 36ef03a406 | |||
| fd6c713119 | |||
| 4a57d3ada1 | |||
| 53160c638a | |||
| a2077f7be1 | |||
| b245d44220 | |||
| b15f7bcf45 | |||
| f16cb8f7d2 | |||
| af915be142 | |||
| 2633f4fcef | |||
| 6c2330984e | |||
| 1e1d5ef442 | |||
| 248757ac3f | |||
| cdbfb2c08c | |||
| d84c917f19 | |||
| 1c7c82358d | |||
| c085694a8b | |||
| a57c2b9fe5 | |||
| 9fc87fe20f | |||
| 4761e25fe1 | |||
| 3ce50d80de | |||
| 8754b023d5 | |||
| 22c9829fea | |||
| 0f7b3e9f84 | |||
| 1a456828df | |||
| 5958c69d64 | |||
| b14aa901ba | |||
| 535dfb5099 | |||
| 19f1aad88c | |||
| 9009eccc8e | |||
| 7f3cdedef9 | |||
| 05095805f1 | |||
| 5430147572 | |||
| 9b9f031fe1 | |||
| 2ad63247c2 | |||
| 87f37e3d87 | |||
| cb8edd9b8f | |||
| 072ae7280e | |||
| e99c299c6f | |||
| 46cdbd514f | |||
| a3e0189f0b | |||
| 8f4344f413 | |||
| 7e28de1d24 | |||
| 624e685212 | |||
| a23765a1cb | |||
| 048502ecd1 | |||
| 1b072448c4 | |||
| 86997488fb | |||
| db6efec417 | |||
| 2cc60c6ee2 | |||
| 80c98b6a35 | |||
| f51c01dc88 | |||
| 7b8a35a311 | |||
| d9db5263e8 | |||
| 912a661c04 | |||
| d3edc62fc7 | |||
| 6b5de5fec8 | |||
| fed4c51aa4 | |||
| 1721209f85 | |||
| 289820188e | |||
| 4fa0a9064b | |||
| f751d97c29 | |||
| d7028252c2 | |||
| a2ee70a964 | |||
| 57b166d13a | |||
| 5c76f2b9a2 | |||
| e59f06ff92 | |||
| d3b96dd048 | |||
| 6544e8135c | |||
| 54ed415d75 | |||
| f34937d4ae | |||
| a4fc40875b | |||
| 56c1441494 | |||
| 08ce8213fc | |||
| 0a3692e459 | |||
| 341546508f | |||
| 444d583a49 | |||
| 130ad4451b | |||
| d24cf8e7ec | |||
| 2d750a14b9 | |||
| b25b9d815b | |||
| daf965f119 | |||
| 296cd83a55 | |||
| b297888eb4 | |||
| e2569ed6dd | |||
| 4718bfac25 | |||
| 2f0798de32 | |||
| 11b0a00593 | |||
| 1d4eb59e94 | |||
| d6c8838fe2 | |||
| 0b888ac54d | |||
| 75099abbc1 | |||
| 3c4f835d8b | |||
| ce842f7561 | |||
| 508af7eb72 | |||
| a4386a617a | |||
| 767ba713a6 | |||
| 020e85906d | |||
| d1ffdd57a5 | |||
| 9c9323e040 | |||
| 376cf09565 | |||
| 047129223e | |||
| 4b64168faa | |||
| 2bc6d08410 | |||
| 484bb6b11f | |||
| a0884e2a03 | |||
| 1e352fdf80 | |||
| 83dfbb84c2 | |||
| 9043064543 | |||
| a3649148c1 | |||
| 28966739f6 | |||
| 13cb32903a | |||
| dcd75e0384 | |||
| dfdd9e02ca | |||
| 275796c241 | |||
| 6ca99e33ab | |||
| 1909caf769 | |||
| 2d07eeb518 | |||
| 1c0da7cd49 | |||
| fd316c81c0 | |||
| edbd437d7b | |||
| 9be1f9c18b | |||
| 96f06d8026 | |||
| 935d8e8aea | |||
| 21b99b3810 | |||
| c051a1249d | |||
| 564697e175 | |||
| d4bf358eae | |||
| f84d5ba3a0 | |||
| b550ff038c | |||
| ac9c629c0b | |||
| 755e24315e | |||
| c6ecd31ea1 | |||
| e600b91a85 | |||
| abff279707 | |||
| fd18508266 | |||
| d7bc309eeb | |||
| 33c40e5ef8 | |||
| 062d926900 | |||
| 0ad0046a76 | |||
| b36cee93f7 | |||
| 2731e70fb7 | |||
| 276cf858fc | |||
| b2acff40c4 | |||
| e3333e716f | |||
| bb7b8c2fab | |||
| 389c7be264 | |||
| c2481e460b | |||
| c93e4a951a | |||
| aa094bf930 | |||
| 8a741952df | |||
| 0dcc55ee16 | |||
| 6c3a3b9e29 | |||
| e4eff8c837 | |||
| 527b895e3c | |||
| 4eb0a7b7c0 | |||
| f11462bf41 | |||
| dea1c31701 | |||
| 68ab43b3ab | |||
| cf72e3bba5 | |||
| 62743edf45 | |||
| eec3752b5a | |||
| 006fd6c733 | |||
| 7078e20200 | |||
| 52c01abbe9 | |||
| 6e26f39751 | |||
| 08aab9d4d8 | |||
| dc254bd562 | |||
| 6c3173f45b | |||
| 30cba7b935 | |||
| 9e27c0fe2c | |||
| 05c09eff19 | |||
| 258eb88684 | |||
| 9c73ef770f | |||
| de9a52366f | |||
| 57265b9e33 | |||
| b7ef2d97e2 | |||
| 4fb364195c | |||
| 578bede46b | |||
| 38a51324b2 | |||
| 0e7c9a4001 | |||
| 32fee6313b | |||
| c6a74c040e | |||
| a97384cec1 | |||
| f052adb93a | |||
| c2560e0cf8 | |||
| cd6d1fb2d2 | |||
| c354ee32e3 | |||
| 5c5df74860 | |||
| 887fb6a84c | |||
| 80ea9e8de4 | |||
| 3879b01ddd | |||
| 4490681fa3 | |||
| b98e24fabf | |||
| 2deafe214a | |||
| d0258756e5 | |||
| 4fecad16e4 | |||
| a82eeb44c0 | |||
| 7ec5ab0c20 | |||
| 872e10fc95 | |||
| e3b7d0f84d | |||
| e0c424eb92 | |||
| 536427310d | |||
| a7eb0bb04a | |||
| af6a5b85f5 | |||
| b96e8093a0 | |||
| 989dc0aabe | |||
| 735f892a08 | |||
| e959c275fd | |||
| 7dbcc90450 | |||
| 7f86eac8f1 | |||
| 40de717cc9 | |||
| df211c994d | |||
| ee314e9b03 | |||
| 9049a8b964 | |||
| 88c029202c | |||
| 9142fb753a | |||
| 4688c0bf10 | |||
| 7e55258bbf | |||
| 828e475921 | |||
| 9d5f919023 | |||
| b8932390f7 | |||
| 445881992e | |||
| 30d96dcb65 | |||
| 3a69fd50bb | |||
| 0f72729f0d | |||
| 0a8874180c | |||
| a6501474bb | |||
| 4cb93ddcde | |||
| 7f1918ae8c | |||
| 78adaaedef | |||
| 4a65113bff | |||
| 843d9d52c3 | |||
| 7a74189771 | |||
| 6de04f7781 | |||
| ba27f2ba28 | |||
| f09b89ed63 | |||
| bac8594c5f | |||
| 3582ae9163 | |||
| 7a95bafa54 | |||
| 1383af6208 | |||
| bea9a3c2dc | |||
| 78ccec5d7b | |||
| 534e3f7f81 | |||
| 6a427d6f89 | |||
| b4297580a7 | |||
| 26b0e2ae43 | |||
| e75ac7b3c0 | |||
| 74442b0d76 | |||
| 3431803980 | |||
| c5fb247de6 | |||
| 18640d59da | |||
| 48753b2539 | |||
| 606dcc8cc3 | |||
| 9e4c548c69 | |||
| 75a974643b | |||
| e2711ba911 | |||
| 7605198774 | |||
| fc9525e7d8 | |||
| e597b6473d | |||
| 16c8dcf788 | |||
| 37842d4fbd | |||
| 133a1d2e8f | |||
| 15c15a9c36 | |||
| d233d50de3 | |||
| a9d8e7ca82 | |||
| 4001cc9531 | |||
| 4319df0cb6 | |||
| 5be7898522 | |||
| 009760c31a | |||
| 77349526e4 | |||
| 3ba195c2d9 | |||
| 60f5032b12 | |||
| fdc201a799 | |||
| ec8616a515 | |||
| 349d11e76d | |||
| 62e3774ff7 | |||
| abaeb52b7c | |||
| 60e600c381 | |||
| 97f84ee87f | |||
| c5738aeed9 | |||
| 192adccb10 | |||
| defcacb59b | |||
| e4ea786956 | |||
| c9d98bf4d7 | |||
| 8dd08c360f | |||
| d6c4bb0e4e | |||
| c54916cdfd | |||
| e29cf6fcc1 | |||
| 5b3cd166b0 | |||
| a7246c6518 | |||
| b48fd78cf0 | |||
| 66c895ee3c | |||
| 37c450dd83 | |||
| 4c744da3e2 | |||
| 388e7b3c2f | |||
| 6ec5377381 | |||
| 24ec47e4ff | |||
| 4a122523d9 | |||
| 1241911ec0 | |||
| 0f54bb1938 | |||
| a3b55aa5cc | |||
| 4fa02a483b | |||
| a786c642f1 | |||
| 1bade7bee8 | |||
| d399df8798 | |||
| 749b11a5ea | |||
| 328af5f560 | |||
| 876f97e9a2 | |||
| 26d7a32f11 | |||
| 3057773009 | |||
| 6ca89cb907 | |||
| 88b5b9b21c | |||
| 6bcf8b91cc | |||
| 7cf7ebc555 | |||
| ee0aaca2b0 | |||
| b1b084452c | |||
| 213b1a2dae | |||
| b991cfc493 | |||
| 90cdea3656 | |||
| 1463f27a0f | |||
| afb8ab44cf | |||
| 282f36c47c | |||
| c3f27d1ad9 | |||
| ad230a8dc7 | |||
| c29c4c0a8b | |||
| 284f5615cc | |||
| c625096f59 | |||
| c3cd5d08c9 | |||
| c87c3c6672 | |||
| 8fc7688585 | |||
| 94bcfb11de | |||
| ebeaac3c5f | |||
| 942ffc038d | |||
| 9de344e48d | |||
| 5efea045d2 | |||
| 6bd3274a4b | |||
| a179313db2 | |||
| 289376840e | |||
| 0e3d84e5ca | |||
| cb643f8fd9 | |||
| 1faa81099c | |||
| 2dc079b950 | |||
| f6cf740507 | |||
| 338c866d83 | |||
| 038e6c312b | |||
| 6f6def34f7 | |||
| 88651149d3 | |||
| e301090704 | |||
| d0f8a612ad | |||
| a7728e3d81 | |||
| 4dadc18a3a | |||
| 43efe6921d | |||
| 2e31c8695a | |||
| 988bd8ccdc | |||
| 965794712e | |||
| 68ea086e2a | |||
| 7370f41fa0 | |||
| 5cbe30095b | |||
| c75c3f1ab1 | |||
| 281ad5fac9 | |||
| eb0301d74e | |||
| 4a76757dd2 | |||
| 1855dae35e | |||
| f20c5a1bcb | |||
| 02979926fd | |||
| b08337af45 | |||
| 980c1e4812 | |||
| f43dd8db1b | |||
| badda165fe | |||
| f7d17875c0 | |||
| 0c124bcca3 | |||
| 3eb63f1730 | |||
| abb0b3b4c0 | |||
| 42662748d3 | |||
| b5b866a894 | |||
| 4e7e715f10 | |||
| 5be1004292 | |||
| 01cccc6462 | |||
| 9287b8ea42 | |||
| 5fabc5c7f9 | |||
| 61dc6f980d | |||
| 84328cfb90 | |||
| 37a35022f5 | |||
| 3afe540111 | |||
| 35687b1ee0 | |||
| 195e6b61f9 | |||
| dabc0331cb | |||
| 824abb0406 | |||
| f6789aaace | |||
| 10bce85561 | |||
| cd0f1b6c5c | |||
| 834bb7d777 | |||
| 5c1d7baf72 | |||
| 8bdbc9ec4c | |||
| 0c6a0720af | |||
| c6095fd92a | |||
| 7d0fb0de83 | |||
| 75281afe05 | |||
| 738e714f45 | |||
| 898bfaeecf | |||
| 7f44d9cdd2 | |||
| 8d9be21c8a | |||
| 82cb4c8c11 | |||
| 2778e4d697 | |||
| 30fe2dd502 | |||
| 1170ff58ee | |||
| 2483bf812f | |||
| 7a999de602 | |||
| 1929c27225 | |||
| 0cf5c9c7d6 | |||
| c20b691683 | |||
| 5c2101de1a | |||
| 2ec2e81511 | |||
| ac3d8b832c | |||
| ad174957e8 | |||
| 9b3fa83516 | |||
| 52b8d9d361 | |||
| d231ded7a2 | |||
| 5f57951e3d | |||
| b1a4788442 | |||
| 6377378a3d | |||
| 45b91cdea5 | |||
| d5647c6760 | |||
| f419559bde | |||
| 4cfaa39419 | |||
| d6b1762adf | |||
| 45c3293385 | |||
| 92d574605e | |||
| cec7b90631 | |||
| aa3cb35f09 | |||
| 7373138e3d | |||
| 2d8176f213 | |||
| 8589d72aee | |||
| 626b50087a | |||
| 1e62554dfb | |||
| bcf800482b | |||
| 08f94d2122 | |||
| 559cfd11db | |||
| ce820c2314 | |||
| 8583ed0e5c | |||
| f2c16a06a1 | |||
| 584d469a73 | |||
| 4298e582fb | |||
| a3fdfbbc16 | |||
| b8929a0d18 | |||
| 0fa5832b63 | |||
| bbb29ebd7c | |||
| 0fd9ac6da3 | |||
| e53098b179 | |||
| 78dcab2778 | |||
| e05f74cef1 | |||
| 3d8724c90d | |||
| ffeda19ce5 | |||
| 70fe8f14e3 | |||
| a639d9f49f | |||
| e5251422fe | |||
| d8f80c058d | |||
| 4cf3655c08 | |||
| 58fc786462 | |||
| 81b142704c | |||
| b0cbeda796 | |||
| 0b3a8a5f65 | |||
| d7d8d2a3e6 | |||
| d5c0309885 | |||
| 36fa9d81fb | |||
| 35f5a5d11a | |||
| d1fe50e271 | |||
| 2d08b31f9a | |||
| 27643f4a48 | |||
| 110e179e9e | |||
| fe6d99d4f1 | |||
| 06fbcbe24b | |||
| f40b57ee48 | |||
| 9438c69bed | |||
| 70d6f3000a | |||
| d47fd0cf18 | |||
| 40117fbe54 | |||
| 7466d8a1de | |||
| ce09443e48 | |||
| 1718dbe94e | |||
| 69894db206 | |||
| 6e4c873248 | |||
| 64693ffd26 | |||
| 66f8ca72c1 | |||
| c82f7bd8fe | |||
| 34176ab5f8 | |||
| 7f12ce9b45 | |||
| 9e1b9f7f5c | |||
| 23e949de1c | |||
| 00bd60a855 | |||
| dacd9afac0 | |||
| 3fc5bb31d0 | |||
| 78770888a5 | |||
| f5b092acf2 | |||
| ba9562f000 | |||
| aded178ab7 | |||
| 0b5d905120 | |||
| 08abec8fd5 | |||
| 63c23736ad | |||
| f7bd373ce6 | |||
| 8e717d2ea1 | |||
| 5f271ed127 | |||
| d686b65dbe | |||
| c7e882e001 | |||
| f07859996e | |||
| fbc73bc78a | |||
| bd8ad1ed1b | |||
| dc2ff83fa5 | |||
| 13545d147b | |||
| 1b85aa713b | |||
| 90a58858ca | |||
| 8149b85a55 | |||
| e79b6c514a | |||
| aaa894d74b | |||
| b55721f16f | |||
| b39d948d71 | |||
| 0fee279e3d | |||
| c7d8a9cb82 | |||
| b50075f102 | |||
| fb3ca9f960 | |||
| 058b971870 | |||
| 610ea414c1 | |||
| cc6997baec | |||
| d126c28b85 | |||
| c1649b9dc0 | |||
| b0a8d12112 | |||
| b5160d38cb | |||
| 360e9b5936 | |||
| 85a6cd828e | |||
| e698f19a64 | |||
| 83c1b580dd | |||
| 9273e1f8ed | |||
| 5287825279 | |||
| 5567959afd | |||
| eaab36b051 | |||
| 9a4f3af580 | |||
| b83664dfce | |||
| 349f7ae965 | |||
| 6f41716ab5 | |||
| abeb62dea8 | |||
| 7cfed80443 | |||
| 36aa7d9b25 | |||
| 2a449ad3c0 | |||
| a71c5957cc | |||
| eef6c7d55e | |||
| 3872322da1 | |||
| f1e850a62a | |||
| 8d9278419d | |||
| 0862827a51 | |||
| f37a220a05 | |||
| aa51c2b6dd | |||
| 92da70a7ae | |||
| a55862fc25 | |||
| 09b14a5702 | |||
| 260b831815 | |||
| 665cf6ac65 | |||
| 5e90021698 | |||
| 16aeb7e12c | |||
| b4cbec173b | |||
| 8c9e06c329 | |||
| e4a35fdd72 | |||
| 370d82e66c | |||
| 876e851517 | |||
| 190fe37a9f | |||
| 623661f8d2 | |||
| f31bc3f8c5 | |||
| 12fc48544c | |||
| 3b4e44a9fd | |||
| 7850fb727e | |||
| 9b3122837e | |||
| d4c59cc73b | |||
| fe36bf54b2 | |||
| 4d8308a763 | |||
| 11f26c1e2c | |||
| e10104d401 | |||
| 5e09c3c318 | |||
| 576b88221d | |||
| 7dc2a0091b | |||
| 89a4a85589 | |||
| a3baf07a5c | |||
| 8e6909478c | |||
| 2d2d0cabb3 | |||
| 6f04a1b8fa | |||
| a9ad3a56ad | |||
| 3069b14e9c | |||
| ae868c6372 | |||
| c287ff554c | |||
| 3ccbd35fad | |||
| 51cc69208f | |||
| 1fec2f7a46 | |||
| ffffdd2d7d | |||
| f8c3e3d5aa | |||
| eccce6fa84 | |||
| 44be6cee2c | |||
| 799afd511a | |||
| 37c4541468 | |||
| 119a66acd0 | |||
| 105193a452 | |||
| 02d793e9e0 | |||
| 90647a8ba8 | |||
| 06950a6bd8 | |||
| 0c2147d9c5 | |||
| 51e8174689 | |||
| 185318a70c | |||
| a88759ba94 | |||
| 96ac054392 | |||
| bd7f4dd73f | |||
| 2e22152089 | |||
| 98a89aea11 | |||
| 372e33c066 | |||
| 52641db590 | |||
| f9ad5f0d01 | |||
| 3db1c7a521 | |||
| b6d1f96930 | |||
| 61a9b01062 | |||
| f0faf5b42e | |||
| 11733d5e05 | |||
| c4a38d9008 | |||
| 0edd7e14b7 | |||
| 8b7bb7b6ae | |||
| 39d5955e58 | |||
| 536327f403 | |||
| 8679dc63be | |||
| 1e9979ae18 | |||
| d2dffe3186 | |||
| 9971867e2f | |||
| 8c93e578a0 | |||
| 1ba5d2e1ca | |||
| ed792fc0d4 | |||
| 4e575c44b3 | |||
| fc06181217 | |||
| 0d6fcf78d8 | |||
| 82225f0b81 | |||
| 2177e13b49 | |||
| b63f4eb503 | |||
| cd7bc09f9c | |||
| ccf775e976 | |||
| 811346e83d | |||
| d3240a75d0 | |||
| d93e396ce5 | |||
| d74cc234c4 | |||
| 0fda83d8de | |||
| a1ec8545fb | |||
| 087f574355 | |||
| 1de784b817 | |||
| db79c05d9a | |||
| 1fdb1f0da6 | |||
| e2bfaa6233 | |||
| 6089849d35 | |||
| 6e02bf59e9 | |||
| 12228c56d9 | |||
| 3b631cb6af | |||
| b27a58df7e | |||
| 308f139193 | |||
| 692fc4e11d | |||
| b52f65c4d7 | |||
| 299275e368 | |||
| bb71c519db | |||
| 9ec7109dc8 | |||
| 5b67fccb1b | |||
| 9807c4b7a1 | |||
| 9039600f6d | |||
| b5b0156e08 | |||
| 352e647d37 | |||
| e6b66f2525 | |||
| f5075906e2 | |||
| a6f57bced8 | |||
| d35bf9591c | |||
| d96f3f9dd4 | |||
| 1f4c2f8c5a | |||
| 95719654f3 | |||
| 4b921c47f5 | |||
| f069f53fae | |||
| 1494cc38fc | |||
| a035412956 | |||
| 08662ea831 | |||
| d97103268b | |||
| a959e2e34d | |||
| 602bfbdd79 | |||
| 0785bdd37a | |||
| 8b62b6e1b1 | |||
| d1c8ebd15b | |||
| 13088e4001 | |||
| 5c6fa1c82b | |||
| fd81867e7b | |||
| 78293e64dd | |||
| 930fc10aec | |||
| 0b2a4fda44 | |||
| efdce6d4cd | |||
| c0b0ea4493 | |||
| 0fcec0a0ca | |||
| c0701d8a35 | |||
| ae51092044 | |||
| b7fcccb8db | |||
| b21a52f5f3 | |||
| 2bdcfe13e6 | |||
| 12a97ec429 | |||
| 99298ce9f2 | |||
| a0ed25d373 | |||
| dc6c29c668 | |||
| 3a85f28b5c | |||
| 95c44b1ce2 | |||
| b88e0ecb78 | |||
| c26f6b72d9 | |||
| 6cd3cc96a3 | |||
| c138cf0b76 | |||
| 8edb086178 | |||
| 0f74b5a4b1 | |||
| 6de2feff05 | |||
| a9811ee955 | |||
| 98b6c11a82 | |||
| 3df2929d12 | |||
| 30d1f423cb | |||
| e0c5566f35 | |||
| c5a2ae47d7 | |||
| 17654b885b | |||
| acaf0ca0af | |||
| 6a201be1fd | |||
| 8617b9164e | |||
| 991e5f1b3c | |||
| 55c533c947 | |||
| d17543d5d9 | |||
| 73169563c4 | |||
| d351cb9f7f | |||
| 251be60630 | |||
| 18d7222804 | |||
| ff1c37d361 | |||
| 3abe6db3de | |||
| b9ca9d3b06 | |||
| 9bbc04843d | |||
| ddf61a6438 | |||
| ba35a81e9b | |||
| 13133583ca | |||
| e91b981740 | |||
| 1458ee64ec | |||
| 4e2a5e1663 | |||
| c98b0e9687 | |||
| 4e25990de9 | |||
| 4b51f1a3fc | |||
| 5490b01004 | |||
| 43176e1f1d | |||
| fffd3c07ca | |||
| 952bd38e70 | |||
| 8589f5cc89 | |||
| ec594d52f8 | |||
| 848cbf9c60 | |||
| e02be7dd9a | |||
| 33d35e47a6 | |||
| 18d62b32c2 | |||
| 58ed51b49c | |||
| 9f9fe529e4 | |||
| aad721890a | |||
| e63a5d10c8 | |||
| 15681262de | |||
| b5d3aa81f9 | |||
| a688061616 | |||
| f788d347ec | |||
| a33ce67dd4 | |||
| 8a22c5627a | |||
| 7b529a30f4 | |||
| 4910b34f26 | |||
| 74ad521fc9 | |||
| 6a73b43e3a | |||
| b59b26460d | |||
| aa324ae25d | |||
| ff412f6396 | |||
| ac148b2f32 | |||
| 6f5d096e6d | |||
| ff1e6714c6 | |||
| 41d82eaadf | |||
| be6b011204 | |||
| 65e48c05f0 | |||
| cee08ea67d | |||
| 35ef26c013 | |||
| b08a0b8102 | |||
| 220342154b | |||
| ef7182cd76 | |||
| 6059c69995 | |||
| 892d8ba152 | |||
| da11069f75 | |||
| bf72908dc9 | |||
| 81ab5c78e2 | |||
| de503c7d63 | |||
| 487ccb90a1 | |||
| 4bfeaa47bf | |||
| 9a4d8036a6 | |||
| a50bd6375d | |||
| 14508e91a9 | |||
| 2d5064bd5b | |||
| fdc4819e39 | |||
| efddbb616b | |||
| db4d0f26a8 | |||
| 06cffbc31b | |||
| 3cfb0f4c76 | |||
| 436ba067bc | |||
| f8724bf47e | |||
| 1f7e293204 | |||
| 86d2652258 | |||
| f5c0cc2e2d | |||
| 4463d4a417 | |||
| df35a5c9b1 | |||
| dda93b3c13 | |||
| 5de40b6bf5 | |||
| dcbe799d25 | |||
| a5641aef03 | |||
| 668f97a4c8 | |||
| e9d577496b | |||
| 66fba947ac | |||
| 18c7e02609 | |||
| 7e1351507a | |||
| 032acbd27c | |||
| 8b51f0fbd2 | |||
| ead5942ef0 | |||
| cfe369d9fe | |||
| 2750a3c130 | |||
| a7f6d6ecac | |||
| 3680282450 | |||
| 3b3435c999 | |||
| e2ae6278c2 | |||
| 37d6723e3c | |||
| 961bbf6f55 | |||
| fc71d349ed | |||
| 97c8ab0f71 | |||
| 28534ea547 | |||
| 1a75b79a33 | |||
| 75dfb0af35 | |||
| 073fa09648 | |||
| 3015e7b203 | |||
| 7ac0cdc0f9 | |||
| 49234183a3 | |||
| ed7763df92 | |||
| b818a02f76 | |||
| 886f8449fd | |||
| 5de6643604 | |||
| 6283273d81 | |||
| 5506d18bc5 | |||
| c8f8f02a46 | |||
| 4c5d6f1d6c | |||
| f349e36345 | |||
| 1574c4ab13 | |||
| 0dc9bc3ab6 | |||
| 0006d57a4a | |||
| 70f7e73b9a | |||
| b67b049802 | |||
| ff99dbcd22 | |||
| 0198697737 | |||
| a742a71f67 | |||
| 8f6c1531fa | |||
| d9f56f11cb | |||
| 7ff877464f | |||
| 7c367eb1e8 | |||
| 20848aac09 | |||
| 7716574076 | |||
| 89cd0c769b | |||
| a21b3d788f | |||
| 7994ba8b38 | |||
| 81b4cb2f16 | |||
| 14af1df6a3 | |||
| ac3bd7d7db | |||
| 632e8e9634 | |||
| 1e3f09f69b | |||
| f3f18ffca7 | |||
| ceb3aa0627 | |||
| 014555fe5d | |||
| fdb76867a7 | |||
| 57157fde9c | |||
| 4a3540cf2b | |||
| 540bd938f2 | |||
| c6fbebd996 | |||
| 18d3a7e23a | |||
| cbae355896 | |||
| 924e8a764a | |||
| 40e629cb0e | |||
| 99ec261f79 | |||
| 9daea5bbc2 | |||
| 4704c03d48 | |||
| 9dbf52bedb | |||
| cfd04ab7fa | |||
| 33dbf75e3b | |||
| 8ffaeeb171 | |||
| 451828e5d4 | |||
| 176877f2b8 | |||
| 61b0d08b5f | |||
| f50a6ce1ae | |||
| 8549d6ea8b | |||
| 90a90a87a5 | |||
| 760bdea521 | |||
| 0fd783e83f | |||
| 42caa9058b | |||
| 9ab315ac2c | |||
| a08ad07537 | |||
| c6ce763f7c | |||
| 70d1eb17a7 | |||
| 0393205eda | |||
| 5c05a5a63e | |||
| b01d9f849b | |||
| 0ab904275c | |||
| 5f82a86801 | |||
| 13a5d8de86 | |||
| f024b71808 | |||
| cd35a17904 | |||
| be3f68ed06 | |||
| 64b8fd9584 | |||
| b001d1d0f1 | |||
| 64ad75c79e | |||
| 12eb361d69 | |||
| dd51bd0a2f | |||
| 0fb478a7c8 | |||
| 9694ecf55b | |||
| fe80478b8a | |||
| a253c26bee | |||
| a500f983f5 | |||
| 3579b6f8f3 | |||
| 14cb954213 | |||
| 6170eef441 | |||
| ddb9af4d57 | |||
| 6db2c0bf93 | |||
| 46f70e6a5e | |||
| 0b994a1b0f | |||
| 0326244956 | |||
| ea1b2252fc | |||
| 0da25ea7cc | |||
| 3209afa4ff | |||
| 33e2631e5d | |||
| f02a41b675 | |||
| f497d7b212 | |||
| 0f18f5eb81 | |||
| 8da81104aa | |||
| 97cbdc6b0f | |||
| 7f53f4e36b | |||
| c350f262e6 | |||
| 3e727893bf | |||
| 2a2c7437e4 | |||
| 4f0885d3af | |||
| 5656cd2fc6 | |||
| b6e42876ad | |||
| 3671344867 | |||
| 30b149053c | |||
| cdd40df9d3 | |||
| 9d661808ba | |||
| 6a5d849b3c | |||
| 25bbd73a90 | |||
| 3d27a5f8c7 | |||
| 44ef372399 | |||
| fd09dff381 | |||
| 10580a0bec | |||
| f3f87b0a46 | |||
| ac606bcf71 | |||
| bb50df07e7 | |||
| f7ac033e1c | |||
| a1043352c1 | |||
| e15fecf6cf | |||
| 3e99f345ef | |||
| 0a77770ef3 | |||
| 379b8392dd | |||
| 0fdae70461 | |||
| 087423c754 | |||
| ce64c98fb7 | |||
| e11a8a9dbb | |||
| ef4a68a24d | |||
| 0ec65c85d3 | |||
| 74326f226d | |||
| 554e0d7a39 | |||
| 1b99ac92dd | |||
| ff0b77908a | |||
| 83d19638ba | |||
| a7d484b1a8 | |||
| d87beb37b8 | |||
| dcdb383960 | |||
| 478a7e95ea | |||
| f7b3b582cc | |||
| d1719dc277 | |||
| 9d8c812aa3 | |||
| 2e390acce9 | |||
| e04797d891 | |||
| fb6195b081 | |||
| c6491a3ccd | |||
| 014ae2107e | |||
| 1457eb9d19 | |||
| 6f5f8cc7d8 | |||
| 9ec3fee455 | |||
| 2d52168c26 | |||
| aa5dd7920f | |||
| d60956e82a | |||
| 91fd3fb5ca | |||
| 46f3b662a7 | |||
| 54a61dcdae | |||
| b58f5232c7 | |||
| 9a5bda862c | |||
| 7f67adb639 | |||
| 48fd943622 | |||
| 08350d00be | |||
| 84bf4a2686 | |||
| 2823456e96 | |||
| a373629fc2 | |||
| 0aa2f72a3a | |||
| c032f6dde1 | |||
| f448d8f334 | |||
| a5d4a43753 | |||
| 52e01321ec | |||
| 19692e0122 | |||
| cd1da3cb81 | |||
| ffaa8f4ab3 | |||
| f3da9d680d | |||
| 6118bd24f2 | |||
| fddbb2e2ac | |||
| cb7156b091 | |||
| b5914a3f12 | |||
| 348d576ff3 | |||
| 7507654749 | |||
| c25aad0c4a | |||
| 4aa32415cd | |||
| cde23bbf98 | |||
| 555fe0b629 | |||
| be44c28fd3 | |||
| 657091307e | |||
| 458dc6e07d | |||
| cfaecf9fcb | |||
| 902f722d4c | |||
| ea2d8b2773 | |||
| b319754dc3 | |||
| 35f2040717 | |||
| 4121fc926e | |||
| fd9ab987e6 | |||
| 6c3a235b08 | |||
| 07cb861385 | |||
| 217e348fc3 | |||
| ad917afba4 | |||
| 9539c6d317 | |||
| e946e1e01e | |||
| fea1e71a99 | |||
| 9731eb8c5b | |||
| e058ae54ef | |||
| ba6714f384 | |||
| 0a0a761e23 | |||
| 88e8368022 | |||
| 468ccc6288 | |||
| 77e0237148 | |||
| ffdfb07f72 | |||
| 203ed88024 | |||
| 9923bcd16f | |||
| 0179ec051f | |||
| 05b6353355 | |||
| 47c6ed8829 | |||
| ff9ebd64e3 | |||
| cd2b098b81 | |||
| 7000a4cead | |||
| 5aa983b45b | |||
| 800989419b | |||
| 362679954a | |||
| 2732d64beb | |||
| 88684d6d9e | |||
| 9afddf0850 | |||
| a2d7d6e81f | |||
| 49bcb5e19f | |||
| 3744ea6218 | |||
| b2c6d87633 | |||
| e4f538b674 | |||
| ea0e0b4396 | |||
| 1ac784dc7a | |||
| d980c9ca4c | |||
| 6a2a60df0d | |||
| ee9b89b6d5 | |||
| 68cc109933 | |||
| 1015bb0fdc | |||
| 7da94dd109 | |||
| 171808cf2c | |||
| 78d14cdfea | |||
| 19982a2ffb | |||
| 79904560fc | |||
| 28aee1c58d | |||
| d4512f360b | |||
| 48d0ffe868 | |||
| 62af12f3b9 | |||
| efa4bfef2f | |||
| fc3ead4c01 | |||
| ca9c813b40 | |||
| e3b0f47c40 | |||
| bf13e42092 | |||
| 4345fda9bc | |||
| 4059e9faa9 | |||
| 95fcce1bcf | |||
| 86cde9716a | |||
| 6e315a50ed | |||
| 500c0b6534 | |||
| db75dca118 | |||
| d5f37e2cbe | |||
| a120a9895b | |||
| e9c1db020f | |||
| 08cd319a0b | |||
| 896ec69329 | |||
| 32e64bbb6e | |||
| 0974540e5f | |||
| e06963e616 | |||
| a675815529 | |||
| 3d48135b32 | |||
| 8f09e7f097 | |||
| e8b09f1124 | |||
| 57ba353594 | |||
| b695e090cd | |||
| 69ecb7b54f | |||
| f57fe182ed | |||
| 10ee11c886 | |||
| 45842b1f05 | |||
| 9ca5f9ad48 | |||
| bb00036a30 | |||
| 4a2a540500 | |||
| 09217216dc | |||
| 22a64c4931 | |||
| 93f520b941 | |||
| c84714dc3a | |||
| a7aa09a13e | |||
| efa1cdfcb2 | |||
| 70695daae8 | |||
| 62fdba0600 | |||
| 5733e00908 | |||
| e56abaefd7 | |||
| c71e893e8e | |||
| 3992356517 | |||
| dbb84ef129 | |||
| 8781fa2e33 | |||
| 605a1365d3 | |||
| ebb1bbc966 | |||
| d4518f7a6e | |||
| 68c9008019 | |||
| cafde1e910 | |||
| 41f5f3fe6e | |||
| cf12ecfa34 | |||
| 4fa668927f | |||
| 24d2b5b4bd | |||
| 4da2e003e1 | |||
| 205debde9c | |||
| ba6c7b0901 | |||
| 8e5d02fd25 | |||
| 11d3251c67 | |||
| 9ec5787b4d | |||
| 027c669ad7 | |||
| 405c12ba3f | |||
| 64fd53a8e5 | |||
| 069d63e3cf | |||
| 66049e0e25 | |||
| db7ef01dbb | |||
| 1a6b649fd6 | |||
| 548619775e | |||
| 4b79a75f39 | |||
| 28912fff97 | |||
| 98a83ddcc0 | |||
| e9d965ce7a | |||
| b7624813cc | |||
| 734e451bd9 | |||
| 7a96436085 | |||
| 670af8fb1b | |||
| 0abd062e5c | |||
| 1286468d5a | |||
| 0f3da5be4a | |||
| 9170269e06 | |||
| 8bb460701f | |||
| c0a7173ca4 | |||
| 949e15d8c6 | |||
| 0caedeb481 | |||
| 83ca8d95be | |||
| 8483868783 | |||
| 6961388545 | |||
| 8ef1ae5202 | |||
| 26b8f93cea | |||
| a576523976 | |||
| cf21c4085b | |||
| 204f655d6d | |||
| fb14865785 | |||
| 5cd052cc59 | |||
| af49c4117c | |||
| dd736130a0 | |||
| cee8bda676 | |||
| 6420a72ceb | |||
| 380e7c7899 | |||
| 16b4058a8b | |||
| e3fba0257f | |||
| cb8b65f6f3 | |||
| 3944a8ed54 | |||
| 2ceafe6379 | |||
| 9f058bd88a | |||
| 1dd0ff13d8 | |||
| 6061f10230 | |||
| ea59fafb52 | |||
| 2ff71126de | |||
| 6d522e1743 | |||
| b37f3c819d | |||
| 1b41994e5f | |||
| 4fd4b0d713 | |||
| 7b43ed702e | |||
| 56cd77942b | |||
| 37dc723b4b | |||
| d7ea37c917 | |||
| c1d2bf9b9f | |||
| 36f837730a | |||
| b8f0a1dd82 | |||
| 2d1b62a978 | |||
| 0792d0d59d | |||
| 8c6da1a658 | |||
| 26be10f937 | |||
| ef4d9a13ed | |||
| 320d987ede | |||
| 51a4c4d13b | |||
| aaf3ae5f9c | |||
| 858f4f74b3 | |||
| 3feed90039 | |||
| b46330fc7a | |||
| 5ca7ce1f75 | |||
| d1d9b37ec7 | |||
| 823115c4ec | |||
| 8fe3fda27f | |||
| 63fffd7493 | |||
| 243a350e2b | |||
| 8c09e7ba36 | |||
| d89502f91f | |||
| 847602f933 | |||
| 8fcf8fe39c | |||
| d59eec9296 | |||
| b9122ebc34 | |||
| 38e066ee49 | |||
| 232a04a1a2 | |||
| dcb145635c | |||
| c9b73c68a6 | |||
| 08f7925ea9 | |||
| ed79ec7940 | |||
| 869a44dd04 | |||
| 6a9e9ebc4c | |||
| f18a2a11fa | |||
| 9aaaa755c7 | |||
| 818cd9044b | |||
| 006ca12b6d | |||
| b5f9ab7c20 | |||
| 0981f95f16 | |||
| f64ef32eaa | |||
| 7a19659c9e | |||
| b1202fcd55 | |||
| b8f991eddb | |||
| d0013f55a2 | |||
| 7efaff4f6f | |||
| bc7a84e462 | |||
| 61657bd1b1 | |||
| fc63f4f89c | |||
| 2c44c252d7 | |||
| 613fc6e3ef | |||
| 0a9604d10e | |||
| 1cabedc65e | |||
| 4e5a0d9e02 | |||
| bf373d894d | |||
| e6bbad84c1 | |||
| 4de477d46c | |||
| 264cab3c9b | |||
| 7f9ef59bea | |||
| 8ebbef4cbb | |||
| 0c98a84242 | |||
| 6679cd60ce |
@@ -9,6 +9,16 @@ out/**
|
|||||||
postcss.config.js
|
postcss.config.js
|
||||||
postcss.config.cjs
|
postcss.config.cjs
|
||||||
tailwind.config.js
|
tailwind.config.js
|
||||||
|
tailwind.config.cjs
|
||||||
vite.config.js
|
vite.config.js
|
||||||
/**/dist/**/*
|
/**/dist/**/*
|
||||||
!**/*.mjs
|
!**/*.mjs
|
||||||
|
**/*.tsx
|
||||||
|
**/*.ts
|
||||||
|
**/*.json
|
||||||
|
**/dev-dist
|
||||||
|
**/dist
|
||||||
|
/src-tauri/target/**/*
|
||||||
|
reverbGen.mjs
|
||||||
|
hydra.mjs
|
||||||
|
jsdoc-synonyms.js
|
||||||
+3
-2
@@ -9,8 +9,9 @@
|
|||||||
"ecmaVersion": "latest",
|
"ecmaVersion": "latest",
|
||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
"plugins": [],
|
"plugins": ["import"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-unused-vars": ["warn", { "destructuredArrayIgnorePattern": ".", "ignoreRestSiblings": false }]
|
"no-unused-vars": ["warn", { "destructuredArrayIgnorePattern": ".", "ignoreRestSiblings": false }],
|
||||||
|
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,16 +21,19 @@ jobs:
|
|||||||
name: github-pages
|
name: github-pages
|
||||||
url: ${{ steps.deployment.outputs.page_url }}
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
|
- uses: pnpm/action-setup@v2
|
||||||
|
with:
|
||||||
|
version: 8.11.0
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 20
|
||||||
cache: "npm"
|
cache: "pnpm"
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci && cd repl && npm ci && cd ../tutorial && npm ci
|
run: pnpm install
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: pnpm build
|
||||||
|
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@v2
|
uses: actions/configure-pages@v2
|
||||||
@@ -39,7 +42,7 @@ jobs:
|
|||||||
uses: actions/upload-pages-artifact@v1
|
uses: actions/upload-pages-artifact@v1
|
||||||
with:
|
with:
|
||||||
# Upload entire repository
|
# Upload entire repository
|
||||||
path: "./out"
|
path: "./website/dist"
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
name: Tauri Builder
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
rust_target: x86_64-unknown-linux-gnu
|
||||||
|
- os: macos-latest
|
||||||
|
rust_target: x86_64-apple-darwin
|
||||||
|
- os: macos-latest
|
||||||
|
rust_target: aarch64-apple-darwin
|
||||||
|
- os: windows-latest
|
||||||
|
rust_target: x86_64-pc-windows-msvc
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: pnpm/action-setup@v2
|
||||||
|
with:
|
||||||
|
version: 8.6.2
|
||||||
|
|
||||||
|
- name: Node.js setup
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: latest
|
||||||
|
# node-version-file: '.nvmrc'
|
||||||
|
|
||||||
|
- name: Install Rust (Stable)
|
||||||
|
run:
|
||||||
|
curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||||
|
|
||||||
|
- name: Install dependencies (ubuntu only)
|
||||||
|
if: matrix.platform == 'ubuntu-latest'
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf libasound2-dev
|
||||||
|
|
||||||
|
- name: Install app dependencies from lockfile and build web
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Build the app
|
||||||
|
uses: tauri-apps/tauri-action@v0
|
||||||
|
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
# tauri-action replaces \_\_VERSION\_\_ with the app version
|
||||||
|
tagName: ${{ github.ref_name }}
|
||||||
|
releaseName: "Strudel v__VERSION__"
|
||||||
|
releaseBody: |
|
||||||
|
See the assets to download this version and install.
|
||||||
|
releaseDraft: true
|
||||||
|
prerelease: false
|
||||||
@@ -7,15 +7,18 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [18]
|
node-version: [20]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
|
- uses: pnpm/action-setup@v2
|
||||||
|
with:
|
||||||
|
version: 8.11.0
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: "npm"
|
cache: 'pnpm'
|
||||||
- run: npm install
|
- run: pnpm install
|
||||||
- run: npm run format-check
|
- run: pnpm run format-check
|
||||||
- run: npm run lint
|
- run: pnpm run lint
|
||||||
- run: npm test
|
- run: pnpm test
|
||||||
|
|||||||
+90
-1
@@ -37,4 +37,93 @@ talk/public/EmuSP12
|
|||||||
talk/public/samples
|
talk/public/samples
|
||||||
server/samples/old
|
server/samples/old
|
||||||
repl/stats.html
|
repl/stats.html
|
||||||
coverage
|
coverage
|
||||||
|
public/icons/apple-splash-*
|
||||||
|
dev-dist
|
||||||
|
Dirt-Samples
|
||||||
|
tidal-drum-machines
|
||||||
|
webaudiofontdata
|
||||||
|
src-tauri/target
|
||||||
|
|
||||||
|
# BEGIN JetBrains -> END JetBrains
|
||||||
|
|
||||||
|
# for JetBrains IDE users, e.g. WebStorm. Source: https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# AWS User-specific
|
||||||
|
.idea/**/aws.xml
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/artifacts
|
||||||
|
# .idea/compiler.xml
|
||||||
|
# .idea/jarRepositories.xml
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
# *.iml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# SonarLint plugin
|
||||||
|
.idea/sonarlint/
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
|
# END JetBrains -> BEGIN JetBrains
|
||||||
|
|||||||
@@ -6,3 +6,8 @@
|
|||||||
**/dist
|
**/dist
|
||||||
packages/mini/krill-parser.js
|
packages/mini/krill-parser.js
|
||||||
packages/xen/tunejs.js
|
packages/xen/tunejs.js
|
||||||
|
paper
|
||||||
|
pnpm-lock.yaml
|
||||||
|
pnpm-workspace.yaml
|
||||||
|
**/dev-dist
|
||||||
|
website/.astro
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
"jsxSingleQuote": false,
|
"jsxSingleQuote": false,
|
||||||
"trailingComma": "all",
|
"trailingComma": "all",
|
||||||
"bracketSpacing": true,
|
"bracketSpacing": true,
|
||||||
"jsxBracketSameLine": false,
|
"bracketSameLine": false,
|
||||||
"arrowParens": "always",
|
"arrowParens": "always",
|
||||||
"proseWrap": "preserve",
|
"proseWrap": "preserve",
|
||||||
"htmlWhitespaceSensitivity": "css",
|
"htmlWhitespaceSensitivity": "css",
|
||||||
|
|||||||
Vendored
+2
-1
@@ -5,5 +5,6 @@
|
|||||||
],
|
],
|
||||||
"yaml.schemas": {
|
"yaml.schemas": {
|
||||||
"https://json.schemastore.org/github-workflow.json": "file:///home/felix/projects/strudel/.github/workflows/deploy.yml"
|
"https://json.schemastore.org/github-workflow.json": "file:///home/felix/projects/strudel/.github/workflows/deploy.yml"
|
||||||
}
|
},
|
||||||
|
"testing.automaticallyOpenPeekView": "never"
|
||||||
}
|
}
|
||||||
+47
-19
@@ -12,8 +12,8 @@ To get in touch with the contributors, either
|
|||||||
|
|
||||||
## Ask a Question
|
## Ask a Question
|
||||||
|
|
||||||
If you have any questions about strudel, make sure you've read the
|
If you have any questions about strudel, make sure you've glanced through the
|
||||||
[tutorial](https://strudel.tidalcycles.org/tutorial/) to find out if it answers your question.
|
[docs](https://strudel.cc/learn/) to find out if it answers your question.
|
||||||
If not, use one of the Communication Channels above!
|
If not, use one of the Communication Channels above!
|
||||||
|
|
||||||
Don't be afraid to ask! Your question might be of great value for other people too.
|
Don't be afraid to ask! Your question might be of great value for other people too.
|
||||||
@@ -29,12 +29,10 @@ If you made some music with strudel, you can give back some love and share what
|
|||||||
Your creation could also be part of the random selection in the REPL if you want.
|
Your creation could also be part of the random selection in the REPL if you want.
|
||||||
Use one of the Communication Channels listed above.
|
Use one of the Communication Channels listed above.
|
||||||
|
|
||||||
## Improve the Tutorial
|
## Improve the Docs
|
||||||
|
|
||||||
If you find some weak spots in the [tutorial](https://strudel.tidalcycles.org/),
|
If you find some weak spots in the [docs](https://strudel.cc/workshop/getting-started/),
|
||||||
you are welcome to improve them by editing [this file](https://github.com/tidalcycles/strudel/blob/main/tutorial/tutorial.mdx).
|
you can edit each file directly on github via the "Edit this page" link located in the right sidebar.
|
||||||
|
|
||||||
This will even work without setting up a development environment, only a github account is required.
|
|
||||||
|
|
||||||
## Propose a Feature
|
## Propose a Feature
|
||||||
|
|
||||||
@@ -60,23 +58,22 @@ To fix a bug that has been reported,
|
|||||||
## Write Tests
|
## Write Tests
|
||||||
|
|
||||||
There are still many tests that have not been written yet! Reading and writing tests is a great opportunity to get familiar with the codebase.
|
There are still many tests that have not been written yet! Reading and writing tests is a great opportunity to get familiar with the codebase.
|
||||||
You can find the tests in each package in the `test` folder. To run all tests, run `npm test` from the root folder.
|
You can find the tests in each package in the `test` folder. To run all tests, run `pnpm test` from the root folder.
|
||||||
|
|
||||||
## Project Setup
|
## Project Setup
|
||||||
|
|
||||||
To get the project up and running for development, make sure you have installed:
|
To get the project up and running for development, make sure you have installed:
|
||||||
|
|
||||||
- git
|
- [git](https://git-scm.com/)
|
||||||
- node, preferably v16
|
- [node](https://nodejs.org/en/) >= 18
|
||||||
|
- [pnpm](https://pnpm.io/) (`curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=8.11.0 sh -`)
|
||||||
|
|
||||||
then, do the following:
|
then, do the following:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/tidalcycles/strudel.git && cd strudel
|
git clone https://github.com/tidalcycles/strudel.git && cd strudel
|
||||||
npm i # install at root to symlink packages
|
pnpm i # install at root to symlink packages
|
||||||
npx lerna bootstrap # install all dependencies in packages
|
pnpm start # start repl
|
||||||
cd repl && npm i # install repl dependencies
|
|
||||||
npm run start # start repl
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Those commands might look slightly different for your OS.
|
Those commands might look slightly different for your OS.
|
||||||
@@ -85,6 +82,10 @@ Please report any problems you've had with the setup instructions!
|
|||||||
## Code Style
|
## Code Style
|
||||||
|
|
||||||
To make sure the code changes only where it should, we are using prettier to unify the code style.
|
To make sure the code changes only where it should, we are using prettier to unify the code style.
|
||||||
|
|
||||||
|
- You can format all files at once by running `pnpm codeformat` from the project root
|
||||||
|
- Run `pnpm format-check` from the project root to check if all files are well formatted
|
||||||
|
|
||||||
If you use VSCode, you can
|
If you use VSCode, you can
|
||||||
|
|
||||||
1. install [the prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
1. install [the prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
||||||
@@ -92,12 +93,29 @@ If you use VSCode, you can
|
|||||||
3. Choose "Configure Default Formatter..."
|
3. Choose "Configure Default Formatter..."
|
||||||
4. Select prettier
|
4. Select prettier
|
||||||
|
|
||||||
|
## ESLint
|
||||||
|
|
||||||
|
To prevent unwanted runtime errors, this project uses [eslint](https://eslint.org/).
|
||||||
|
|
||||||
|
- You can check for lint errors by running `pnpm lint`
|
||||||
|
|
||||||
|
There are also eslint extensions / plugins for most editors.
|
||||||
|
|
||||||
|
## Running Tests
|
||||||
|
|
||||||
|
- Run all tests with `pnpm test`
|
||||||
|
- Run all tests with UI using `pnpm test-ui`
|
||||||
|
|
||||||
|
## Running all CI Checks
|
||||||
|
|
||||||
|
When opening a PR, the CI runner will automatically check the code style and eslint, as well as run all tests.
|
||||||
|
You can run the same check with `pnpm check`
|
||||||
|
|
||||||
## Package Workflow
|
## Package Workflow
|
||||||
|
|
||||||
The project is split into multiple [packages](https://github.com/tidalcycles/strudel/tree/main/packages) with independent versioning.
|
The project is split into multiple [packages](https://github.com/tidalcycles/strudel/tree/main/packages) with independent versioning.
|
||||||
When you run `npm i` on the root folder, [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces) will symlink all packages
|
When you run `pnpm i` on the root folder, [pnpm workspaces](https://pnpm.io/workspaces) will install all dependencies of all subpackages. This will allow any js file to import `@strudel/<package-name>` to get the local version,
|
||||||
in the `node_modules` folder. This will allow any js file to import `@strudel.cycles/<package-name>` to get the local version,
|
allowing to develop multiple packages at the same time.
|
||||||
which allows developing multiple packages at the same time
|
|
||||||
|
|
||||||
## Package Publishing
|
## Package Publishing
|
||||||
|
|
||||||
@@ -105,15 +123,25 @@ To publish all packages that have been changed since the last release, run:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm login
|
npm login
|
||||||
npx lerna publish
|
|
||||||
|
# this will increment all the versions in package.json files of non private packages to selected versions
|
||||||
|
npx lerna version --no-private
|
||||||
|
|
||||||
|
# publish all packages inside /packages using pnpm! don't use lerna to publish!!
|
||||||
|
pnpm --filter "./packages/**" publish --dry-run
|
||||||
|
|
||||||
|
# the last command was only a dry-run, make sure everything looks ok, if yes, run the same command without flag
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To manually publish a single package, increase the version in the `package.json`, then run `pnpm publish`.
|
||||||
|
Important: Always publish with `pnpm`, as `npm` does not support overriding main files in `publishConfig`, which is done in all the packages.
|
||||||
|
|
||||||
### New Packages
|
### New Packages
|
||||||
|
|
||||||
To add a new package, you have to publish it manually the first time, using:
|
To add a new package, you have to publish it manually the first time, using:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd packages/<package-name> && npm publish --access public
|
cd packages/<package-name> && pnpm publish --access public
|
||||||
```
|
```
|
||||||
|
|
||||||
## Have Fun
|
## Have Fun
|
||||||
|
|||||||
@@ -4,17 +4,18 @@
|
|||||||
|
|
||||||
An experiment in making a [Tidal](https://github.com/tidalcycles/tidal/) using web technologies. This software is slowly stabilising, but please continue to tread carefully.
|
An experiment in making a [Tidal](https://github.com/tidalcycles/tidal/) using web technologies. This software is slowly stabilising, but please continue to tread carefully.
|
||||||
|
|
||||||
- Try it here: <https://strudel.tidalcycles.org/>
|
- Try it here: <https://strudel.cc>
|
||||||
- Tutorial: <https://strudel.tidalcycles.org/tutorial/>
|
- Docs: <https://strudel.cc/learn>
|
||||||
- Technical Blog Post: <https://loophole-letters.vercel.app/strudel>
|
- Technical Blog Post: <https://loophole-letters.vercel.app/strudel>
|
||||||
|
- 1 Year of Strudel Blog Post: <https://loophole-letters.vercel.app/strudel1year>
|
||||||
|
|
||||||
## Running Locally
|
## Running Locally
|
||||||
|
|
||||||
After cloning the project, you can run the REPL locally:
|
After cloning the project, you can run the REPL locally:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run setup
|
pnpm run setup
|
||||||
npm run repl
|
pnpm run repl
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using Strudel In Your Project
|
## Using Strudel In Your Project
|
||||||
@@ -23,13 +24,12 @@ There are multiple npm packages you can use to use strudel, or only parts of it,
|
|||||||
|
|
||||||
- [`core`](./packages/core/): tidal pattern engine
|
- [`core`](./packages/core/): tidal pattern engine
|
||||||
- [`mini`](./packages/mini): mini notation parser + core binding
|
- [`mini`](./packages/mini): mini notation parser + core binding
|
||||||
- [`eval`](./packages/eval): user code evaluator. syntax sugar + highlighting
|
- [`transpiler`](./packages/transpiler): user code transpiler
|
||||||
- [`tone`](./packages/tone): bindings for Tone.js instruments and effects
|
- [`webaudio`](./packages/webaudio): webaudio output
|
||||||
- [`osc`](./packages/osc): bindings to communicate via OSC
|
- [`osc`](./packages/osc): bindings to communicate via OSC
|
||||||
- [`midi`](./packages/midi): webmidi bindings
|
- [`midi`](./packages/midi): webmidi bindings
|
||||||
- [`serial`](./packages/serial): webserial bindings
|
- [`serial`](./packages/serial): webserial bindings
|
||||||
- [`tonal`](./packages/tonal): tonal functions
|
- [`tonal`](./packages/tonal): tonal functions
|
||||||
- [`xen`](./packages/xen): microtonal / xenharmonic functions
|
|
||||||
- ... [and there are more](./packages/)
|
- ... [and there are more](./packages/)
|
||||||
|
|
||||||
Click on the package names to find out more about each one.
|
Click on the package names to find out more about each one.
|
||||||
|
|||||||
-1806
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 150 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
# examples
|
||||||
|
|
||||||
|
This folder contains usage examples for different scenarios.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# buildless examples
|
||||||
|
|
||||||
|
These examples show you how strudel can be used in a regular html file, without the need for a build tool.
|
||||||
|
|
||||||
|
Most examples are using [skypack](https://www.skypack.dev/)
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="text"
|
id="text"
|
||||||
value="cat('a', 'b')"
|
value="seq('a', ['b', 'c'])"
|
||||||
style="width: 100%; font-size: 2em; outline: none; margin-bottom: 10px"
|
style="width: 100%; font-size: 2em; outline: none; margin-bottom: 10px"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
/>
|
/>
|
||||||
<div id="output"></div>
|
<div id="output"></div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
const strudel = await import('https://cdn.skypack.dev/@strudel.cycles/core@0.0.2');
|
const strudel = await import('https://cdn.skypack.dev/@strudel/core@0.6.8');
|
||||||
Object.assign(window, strudel); // assign all strudel functions to global scope to use with eval
|
Object.assign(window, strudel); // assign all strudel functions to global scope to use with eval
|
||||||
const input = document.getElementById('text');
|
const input = document.getElementById('text');
|
||||||
const getEvents = () => {
|
const getEvents = () => {
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="text"
|
id="text"
|
||||||
value="cat('orange', 'indigo')"
|
value="seq('tomato', 'indigo', ['white', 'steelblue']).fast(4)"
|
||||||
style="width: 100%; font-size: 2em; background: black; color: white; outline: none; position: absolute; top: 0"
|
style="width: 100%; font-size: 2em; background: black; color: white; outline: none; position: absolute; top: 0"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
/>
|
/>
|
||||||
<canvas id="canvas"></canvas>
|
<canvas id="canvas"></canvas>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
const strudel = await import('https://cdn.skypack.dev/@strudel.cycles/core@0.0.2');
|
const strudel = await import('https://cdn.skypack.dev/@strudel/core@0.6.8');
|
||||||
// this adds all strudel functions to the global scope, to be used by eval
|
// this adds all strudel functions to the global scope, to be used by eval
|
||||||
Object.assign(window, strudel);
|
Object.assign(window, strudel);
|
||||||
// setup elements
|
// setup elements
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<button id="play">play</button>
|
||||||
|
<button id="stop">stop</button>
|
||||||
|
<script type="module">
|
||||||
|
import { initStrudel } from 'https://cdn.skypack.dev/@strudel/web@0.8.2';
|
||||||
|
|
||||||
|
initStrudel();
|
||||||
|
document.getElementById('play').addEventListener('click', () => evaluate('note("c a f e").jux(rev)'));
|
||||||
|
document.getElementById('play').addEventListener('stop', () => hush());
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<button id="a">A</button>
|
||||||
|
<button id="b">B</button>
|
||||||
|
<button id="c">C</button>
|
||||||
|
<button id="stop">stop</button>
|
||||||
|
<script type="module">
|
||||||
|
import { initStrudel } from 'https://cdn.skypack.dev/@strudel/web@0.8.2';
|
||||||
|
initStrudel({
|
||||||
|
prebake: () => samples('github:tidalcycles/Dirt-Samples/master'),
|
||||||
|
});
|
||||||
|
const click = (id, action) => document.getElementById(id).addEventListener('click', action);
|
||||||
|
click('a', () => evaluate(`s('bd,jvbass(3,8)').jux(rev)`));
|
||||||
|
click('b', () => s('bd*2,hh(3,4),jvbass(5,8,1)').jux(rev).play());
|
||||||
|
click('c', () => s('bd*2,hh(3,4),jvbass:[0 4](5,8,1)').jux(rev).stack(s('~ sd')).play());
|
||||||
|
click('stop', () => hush());
|
||||||
|
</script>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
@@ -6,46 +6,36 @@
|
|||||||
<title>Buildless Vanilla Strudel REPL</title>
|
<title>Buildless Vanilla Strudel REPL</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="margin: 0; background: #222">
|
<body style="margin: 0; background: #222">
|
||||||
<div style="display: grid; height: 100vh">
|
<div style="display: grid; height: 100vh; grid-template-rows: 32px auto">
|
||||||
|
<button id="start" style="width: 100vw; height: 32px">evaluate</button>
|
||||||
<textarea
|
<textarea
|
||||||
id="text"
|
id="text"
|
||||||
style="font-size: 2em; border: 0; color: white; background: transparent; outline: none; padding: 20px"
|
style="font-size: 2em; border: 0; color: white; background: transparent; outline: none; padding: 20px"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
></textarea>
|
></textarea>
|
||||||
</div>
|
</div>
|
||||||
<button
|
|
||||||
id="start"
|
|
||||||
style="
|
|
||||||
position: absolute;
|
|
||||||
border-radius: 10px;
|
|
||||||
top: 20px;
|
|
||||||
right: 20px;
|
|
||||||
padding: 20px;
|
|
||||||
border: 2px solid white;
|
|
||||||
background: transparent;
|
|
||||||
color: white;
|
|
||||||
cursor: pointer;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
evaluate
|
|
||||||
</button>
|
|
||||||
<div id="output"></div>
|
<div id="output"></div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { controls, repl, evalScope } from 'https://cdn.skypack.dev/@strudel.cycles/core@0.3.2';
|
import { controls, repl, evalScope } from 'https://cdn.skypack.dev/@strudel.cycles/core@0.6.8';
|
||||||
import { mini } from 'https://cdn.skypack.dev/@strudel.cycles/mini@0.3.2';
|
import { mini } from 'https://cdn.skypack.dev/@strudel.cycles/mini@0.6.0';
|
||||||
import { transpiler } from 'https://cdn.skypack.dev/@strudel.cycles/transpiler@0.3.2';
|
import { transpiler } from 'https://cdn.skypack.dev/@strudel.cycles/transpiler@0.6.0';
|
||||||
import { getAudioContext, webaudioOutput } from 'https://cdn.skypack.dev/@strudel.cycles/webaudio@0.3.3';
|
import {
|
||||||
|
getAudioContext,
|
||||||
|
webaudioOutput,
|
||||||
|
initAudioOnFirstClick,
|
||||||
|
} from 'https://cdn.skypack.dev/@strudel.cycles/webaudio@0.6.0';
|
||||||
|
|
||||||
|
initAudioOnFirstClick();
|
||||||
const ctx = getAudioContext();
|
const ctx = getAudioContext();
|
||||||
const input = document.getElementById('text');
|
const input = document.getElementById('text');
|
||||||
input.innerHTML = getTune();
|
input.innerHTML = getTune();
|
||||||
|
|
||||||
evalScope(
|
evalScope(
|
||||||
controls,
|
controls,
|
||||||
import('https://cdn.skypack.dev/@strudel.cycles/core@0.3.2'),
|
import('https://cdn.skypack.dev/@strudel.cycles/core@0.6.8'),
|
||||||
import('https://cdn.skypack.dev/@strudel.cycles/mini@0.3.2'),
|
import('https://cdn.skypack.dev/@strudel.cycles/mini@0.6.0'),
|
||||||
import('https://cdn.skypack.dev/@strudel.cycles/tonal@0.3.3'),
|
import('https://cdn.skypack.dev/@strudel.cycles/tonal@0.6.0'),
|
||||||
import('https://cdn.skypack.dev/@strudel.cycles/webaudio@0.3.3'),
|
import('https://cdn.skypack.dev/@strudel.cycles/webaudio@0.6.0'),
|
||||||
);
|
);
|
||||||
|
|
||||||
const { evaluate } = repl({
|
const { evaluate } = repl({
|
||||||
@@ -53,10 +43,7 @@
|
|||||||
getTime: () => ctx.currentTime,
|
getTime: () => ctx.currentTime,
|
||||||
transpiler,
|
transpiler,
|
||||||
});
|
});
|
||||||
document.getElementById('start').addEventListener('click', () => {
|
document.getElementById('start').addEventListener('click', () => evaluate(input.value));
|
||||||
ctx.resume();
|
|
||||||
evaluate(input.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
function getTune() {
|
function getTune() {
|
||||||
return `await samples('github:tidalcycles/Dirt-Samples/master')
|
return `await samples('github:tidalcycles/Dirt-Samples/master')
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<script src="https://unpkg.com/@strudel/repl@0.9.4"></script>
|
||||||
|
<strudel-editor>
|
||||||
|
<!--
|
||||||
|
// @date 23-08-15
|
||||||
|
// "golf rolf" @by froos @license CC BY-NC-SA 4.0
|
||||||
|
|
||||||
|
setcps(1)
|
||||||
|
stack(
|
||||||
|
s("bd*2, ~ rim*<1!3 2>, hh*4").bank('RolandTR909')
|
||||||
|
.off(-1/8, set(speed("1.5").gain(.25)))
|
||||||
|
.mask("<0!16 1!64>")
|
||||||
|
,
|
||||||
|
note("g1(3,8)")
|
||||||
|
.s("gm_synth_bass_2:<0 2>")
|
||||||
|
.delay(".8:.25:.25")
|
||||||
|
.clip("<.5!16 2!32>")
|
||||||
|
.off(1/8, add(note("12?0.7")))
|
||||||
|
.lpf(sine.range(500,2000).slow(32)).lpq(8)
|
||||||
|
.add(note("0,.05"))
|
||||||
|
.mask("<0!8 1!32>")
|
||||||
|
,
|
||||||
|
n("<0 1 2 3 4>*8").scale('G4 minor')
|
||||||
|
.s("gm_lead_6_voice")
|
||||||
|
.clip(sine.range(.2,.8).slow(8))
|
||||||
|
.jux(rev)
|
||||||
|
.room(2)
|
||||||
|
.sometimes(add(note("12")))
|
||||||
|
.lpf(perlin.range(200,20000).slow(4))
|
||||||
|
).reset("<x@15 x(5,8)>")
|
||||||
|
-->
|
||||||
|
</strudel-editor>
|
||||||
@@ -8,7 +8,7 @@ pnpm-debug.log*
|
|||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
!dist
|
dist
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# codemirror-repl example
|
||||||
|
|
||||||
|
This folder demonstrates how to set up a full strudel repl with the `@strudel/codemirror` package. Run it using:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pnpm i
|
||||||
|
pnpm dev
|
||||||
|
```
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Vite Vanilla Strudel REPL</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<nav>
|
||||||
|
<button id="play">eval</button>
|
||||||
|
<button id="stop">stop</button>
|
||||||
|
</nav>
|
||||||
|
<div class="container">
|
||||||
|
<div id="editor"></div>
|
||||||
|
<div id="output"></div>
|
||||||
|
</div>
|
||||||
|
<canvas id="roll"></canvas>
|
||||||
|
</main>
|
||||||
|
<script type="module" src="./main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import { StrudelMirror } from '@strudel/codemirror';
|
||||||
|
import { funk42 } from './tunes';
|
||||||
|
import { drawPianoroll, evalScope, controls } from '@strudel/core';
|
||||||
|
import './style.css';
|
||||||
|
import { initAudioOnFirstClick } from '@strudel/webaudio';
|
||||||
|
import { transpiler } from '@strudel/transpiler';
|
||||||
|
import { getAudioContext, webaudioOutput, registerSynthSounds } from '@strudel/webaudio';
|
||||||
|
import { registerSoundfonts } from '@strudel/soundfonts';
|
||||||
|
|
||||||
|
// init canvas
|
||||||
|
const canvas = document.getElementById('roll');
|
||||||
|
canvas.width = canvas.width * 2;
|
||||||
|
canvas.height = canvas.height * 2;
|
||||||
|
const drawContext = canvas.getContext('2d');
|
||||||
|
const drawTime = [-2, 2]; // time window of drawn haps
|
||||||
|
|
||||||
|
const editor = new StrudelMirror({
|
||||||
|
defaultOutput: webaudioOutput,
|
||||||
|
getTime: () => getAudioContext().currentTime,
|
||||||
|
transpiler,
|
||||||
|
root: document.getElementById('editor'),
|
||||||
|
initialCode: funk42,
|
||||||
|
drawTime,
|
||||||
|
onDraw: (haps, time) => drawPianoroll({ haps, time, ctx: drawContext, drawTime, fold: 0 }),
|
||||||
|
prebake: async () => {
|
||||||
|
initAudioOnFirstClick(); // needed to make the browser happy (don't await this here..)
|
||||||
|
const loadModules = evalScope(
|
||||||
|
controls,
|
||||||
|
import('@strudel/core'),
|
||||||
|
import('@strudel/mini'),
|
||||||
|
import('@strudel/tonal'),
|
||||||
|
import('@strudel/webaudio'),
|
||||||
|
);
|
||||||
|
await Promise.all([loadModules, registerSynthSounds(), registerSoundfonts()]);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('play').addEventListener('click', () => editor.evaluate());
|
||||||
|
document.getElementById('stop').addEventListener('click', () => editor.stop());
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "vite-vanilla-repl-cm6",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"vite": "^5.0.10"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@strudel/codemirror": "workspace:*",
|
||||||
|
"@strudel/core": "workspace:*",
|
||||||
|
"@strudel/mini": "workspace:*",
|
||||||
|
"@strudel/soundfonts": "workspace:*",
|
||||||
|
"@strudel/tonal": "workspace:*",
|
||||||
|
"@strudel/transpiler": "workspace:*",
|
||||||
|
"@strudel/webaudio": "workspace:*"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
body,
|
||||||
|
html {
|
||||||
|
margin: 0;
|
||||||
|
height: 100%;
|
||||||
|
background: #282c34;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
flex-grow: 1;
|
||||||
|
max-height: 100%;
|
||||||
|
position: relative;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#editor {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-editor {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#roll {
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
export const bumpStreet = `// froos - "22 bump street", licensed with CC BY-NC-SA 4.0
|
||||||
|
await samples('github:felixroos/samples/main')
|
||||||
|
await samples('https://strudel.cc/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/')
|
||||||
|
|
||||||
|
"<[0,<6 7 9>,13,<17 20 22 26>]!2>/2"
|
||||||
|
// make it 22 edo
|
||||||
|
.fmap(v => Math.pow(2,v/22))
|
||||||
|
// mess with the base frequency
|
||||||
|
.mul("<300 [300@3 200]>/8").freq()
|
||||||
|
.layer(
|
||||||
|
// chords
|
||||||
|
x=>x.div(freq(2)).s("flute").euclidLegato("<3 2>",8)
|
||||||
|
.shape(.4).lpf(sine.range(800,4000).slow(8)),
|
||||||
|
// adlibs
|
||||||
|
x=>x.arp("{0 3 2 [1 3]}%1.5")
|
||||||
|
.s('xylo').mul(freq(2))
|
||||||
|
.delay(.5).delayfeedback(.4).juxBy(.5, rev)
|
||||||
|
.hpf(sine.range(200,3000).slow(8)),
|
||||||
|
// bass
|
||||||
|
x=>x.arp("[0 [2 1?]](5,8)").s('sawtooth').div(freq(4))
|
||||||
|
.lpf(sine.range(400,2000).slow(8)).lpq(8).shape(.4)
|
||||||
|
.off(1/8, x=>x.mul(freq(2)).degradeBy(.5)).gain(.3)
|
||||||
|
).clip(1).release(.2)
|
||||||
|
.stack(
|
||||||
|
// drums
|
||||||
|
s("bd sd:<2 1>, [~ hh]*2, [~ rim]").bank('RolandTR909')
|
||||||
|
.off(1/8, x=>x.speed(2).gain(.4)).sometimes(ply(2)).gain(.8)
|
||||||
|
.mask("<0@4 1@12>/4")
|
||||||
|
.reset("<x@15 [x(3,8) x*[4 8]]>")
|
||||||
|
// wait for it...
|
||||||
|
).fast(2/3)
|
||||||
|
//.crush(6) // remove "//" if you dare`;
|
||||||
|
|
||||||
|
export const trafficFlam = `// froos - "traffic flam", licensed with CC BY-NC-SA 4.0
|
||||||
|
|
||||||
|
await samples('github:felixroos/samples/main')
|
||||||
|
await samples('https://strudel.cc/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/')
|
||||||
|
|
||||||
|
addVoicings('hip', {
|
||||||
|
m11: ['2M 3m 4P 7m'],
|
||||||
|
'^7#11': ['3M 4A 5P 7M'],
|
||||||
|
}, ['C4', 'C6'])
|
||||||
|
|
||||||
|
stack(
|
||||||
|
stack(
|
||||||
|
"<Bbm11 A^7#11>/2".voicings('hip').note()
|
||||||
|
.s("gm_epiano1:2")
|
||||||
|
.arp("[<[0 1 2 3] [3 2 1 0]> ~@5]/2")
|
||||||
|
.release(2).late(.25).lpf(2000),
|
||||||
|
"<Bb1 A1>/2".note().s('gm_acoustic_bass'),
|
||||||
|
n("<0 2 3>(3,8)".off(1/8, add(4)))
|
||||||
|
.scale("<Bb4:minor A4:lydian>/2")
|
||||||
|
.s('gm_electric_guitar_jazz')
|
||||||
|
.decay(sine.range(.05, .2).slow(32)).sustain(0)
|
||||||
|
.delay(.5).lpf(sine.range(100,5000).slow(64))
|
||||||
|
.gain(.7).room(.5).pan(sine.range(0,1).slow(11))
|
||||||
|
).add(perlin.range(0,.25).note()),
|
||||||
|
stack(
|
||||||
|
s("bd:1(3,8) rim").bank('RolandTR707').slow(2).room("<0 <.1 .6>>")
|
||||||
|
.when("<0@7 1>",x=>x.echoWith(3, .0625, (x,i) => x.speed(1+i*.24))),
|
||||||
|
s("rim*4").end(.05).bank('RolandTR808').speed(.8).room(.2)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.late("[0 .05]*2").late(12)
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const funk42 = `// froos - how to funk in 42 lines of code
|
||||||
|
// adapted from "how to funk in two minutes" by marc rebillet https://www.youtube.com/watch?v=3vBwRfQbXkg
|
||||||
|
// thanks to peach for the transcription: https://www.youtube.com/watch?v=8eiPXvIgda4
|
||||||
|
|
||||||
|
await samples('github:felixroos/samples/main')
|
||||||
|
await samples('https://strudel.cc/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/')
|
||||||
|
|
||||||
|
setcps(.5)
|
||||||
|
|
||||||
|
let drums = stack(
|
||||||
|
s("bd*2, ~ sd").bank('RolandTR707').room("0 .1"),
|
||||||
|
s("hh*4").begin(.2).release(.02).end(.25).release(.02)
|
||||||
|
.gain(.3).bank('RolandTR707').late(.02).room(.5),
|
||||||
|
//s("shaker_small").struct("[x x*2]*2").speed(".8,.9").release(.02)
|
||||||
|
).fast(2)
|
||||||
|
|
||||||
|
let wurli = note(\`<
|
||||||
|
[[a2,g3,[b3 c4],e4] ~ [g3,c4,e4](3,8)@4 ~@2]!3
|
||||||
|
[[e2,e3,a3,b3,e4]@3 [e2,e3,ab3,b3,e4]@5]>\`)
|
||||||
|
.s("gm_epiano1:5").decay(.2).sustain("<[1 0@7]!3 1>")
|
||||||
|
.gain("<[.8@2 .4@14]!3 .7>").room(.3)
|
||||||
|
|
||||||
|
let organ = note("<[~@3 [a3,d4,f#4]@2 [[a3,c4,e4]@2 ~] ~@2]!3 ~>".add(12))
|
||||||
|
.s("gm_percussive_organ:2").gain(.6).lpf(1800).pan(.2).room(.3);
|
||||||
|
|
||||||
|
let clav = note(\`<
|
||||||
|
[~@3 a2 [g3,[b3 c4],e4]@2 ~ a2 [g3,b3,e4] ~@2 [g3,c4,e4] ~@4]!3
|
||||||
|
[~@3 e3 [[a3 b3],c3,e3]@2 ~ e2 [e3,a3]@3 [b3,e3] ~@2 [b3,e3]@2]>\`)
|
||||||
|
.s("gm_clavinet:1").decay("<.25!3 [.25 .4]>").sustain(0)
|
||||||
|
.gain(.7).pan(.8).room(.2);
|
||||||
|
|
||||||
|
let bass = note(\`<
|
||||||
|
[a1 [~ [g2 a2]] [g1 g#1] [a1 [g2 a2]]]
|
||||||
|
[a1 [~ [g2 a2]] [e3 d3] [c3 [g3 a3]]]
|
||||||
|
[a1 [~ [g2 a2]] [g1 g#1] [a1 [g2 a2]]]
|
||||||
|
[e2@6 e1@5 e1 [[d2 e3] g1]@4]
|
||||||
|
>\`).s("gm_electric_bass_pick:1").release(.1)
|
||||||
|
|
||||||
|
stack(
|
||||||
|
drums
|
||||||
|
,wurli
|
||||||
|
,organ
|
||||||
|
,clav
|
||||||
|
,bass
|
||||||
|
)`;
|
||||||
@@ -8,11 +8,10 @@ pnpm-debug.log*
|
|||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
|
dist
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
|
|
||||||
!dist
|
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# headless-repl demo
|
||||||
|
|
||||||
|
This demo shows how to use strudel in "headless mode".
|
||||||
|
Buttons A / B / C will switch between different patterns.
|
||||||
|
It showcases the usage of the `@strudel/web` package, using [vite](https://vitejs.dev/) as the dev server.
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pnpm i && cd examples/headless-repl
|
||||||
|
pnpm dev
|
||||||
|
# open http://localhost:5173/
|
||||||
|
```
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="https://strudel.cc/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>@strudel/web REPL Example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<button id="a">A</button>
|
||||||
|
<button id="b">B</button>
|
||||||
|
<button id="c">C</button>
|
||||||
|
<button id="stop">stop</button>
|
||||||
|
<script type="module">
|
||||||
|
import { initStrudel } from '@strudel/web';
|
||||||
|
initStrudel({
|
||||||
|
prebake: () => samples('github:tidalcycles/Dirt-Samples/master'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const click = (id, action) => document.getElementById(id).addEventListener('click', action);
|
||||||
|
click('a', () => evaluate(`s('bd,jvbass(3,8)').jux(rev)`));
|
||||||
|
click('b', () => s('bd*2,hh(3,4),jvbass(5,8,1)').jux(rev).play());
|
||||||
|
click('c', () => s('bd*2,hh(3,4),jvbass:[0 4](5,8,1)').jux(rev).stack(s('~ sd')).play());
|
||||||
|
click('stop', () => hush());
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "repl-example",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"license": "AGPL-3.0-or-later",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"vite": "^5.0.10"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@strudel/web": "workspace:*"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
dist
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# minimal repl
|
||||||
|
|
||||||
|
This folder demonstrates how to set up a minimal strudel repl using vite and vanilla JS. Run it using:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm i
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're looking for a more feature rich alternative, have a look at the [../codemirror-repl](codemirror-repl example)
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { controls, repl, evalScope } from '@strudel/core';
|
||||||
|
import { getAudioContext, webaudioOutput, initAudioOnFirstClick } from '@strudel/webaudio';
|
||||||
|
import { transpiler } from '@strudel/transpiler';
|
||||||
|
import tune from './tune.mjs';
|
||||||
|
|
||||||
|
const ctx = getAudioContext();
|
||||||
|
const input = document.getElementById('text');
|
||||||
|
input.innerHTML = tune;
|
||||||
|
initAudioOnFirstClick();
|
||||||
|
|
||||||
|
evalScope(
|
||||||
|
controls,
|
||||||
|
import('@strudel/core'),
|
||||||
|
import('@strudel/mini'),
|
||||||
|
import('@strudel/webaudio'),
|
||||||
|
import('@strudel/tonal'),
|
||||||
|
);
|
||||||
|
|
||||||
|
const { evaluate } = repl({
|
||||||
|
defaultOutput: webaudioOutput,
|
||||||
|
getTime: () => ctx.currentTime,
|
||||||
|
transpiler,
|
||||||
|
});
|
||||||
|
document.getElementById('start').addEventListener('click', () => {
|
||||||
|
ctx.resume();
|
||||||
|
console.log('eval', input.value);
|
||||||
|
evaluate(input.value);
|
||||||
|
});
|
||||||
+8
-1
@@ -10,6 +10,13 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite": "^3.2.0"
|
"vite": "^5.0.10"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@strudel/core": "workspace:*",
|
||||||
|
"@strudel/mini": "workspace:*",
|
||||||
|
"@strudel/transpiler": "workspace:*",
|
||||||
|
"@strudel/webaudio": "workspace:*",
|
||||||
|
"@strudel/tonal": "workspace:*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* export default `await samples('github:tidalcycles/Dirt-Samples/master')
|
export default `await samples('github:tidalcycles/Dirt-Samples/master')
|
||||||
|
|
||||||
stack(
|
stack(
|
||||||
// amen
|
// amen
|
||||||
@@ -29,11 +29,3 @@ stack(
|
|||||||
,
|
,
|
||||||
n("0 1").s("east").delay(.5).degradeBy(.8).speed(rand.range(.5,1.5))
|
n("0 1").s("east").delay(.5).degradeBy(.8).speed(rand.range(.5,1.5))
|
||||||
).reset("<x@7 x(5,8)>")`;
|
).reset("<x@7 x(5,8)>")`;
|
||||||
*/
|
|
||||||
|
|
||||||
export default `stack(
|
|
||||||
n("c3 [eb3,g3]")
|
|
||||||
.delay("<0 .5>")
|
|
||||||
.delaytime(".16 | .33")
|
|
||||||
.delayfeedback(".6 | .8")
|
|
||||||
).sometimes(x=>x.speed("-1"))`;
|
|
||||||
@@ -22,6 +22,3 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
oldtunes.mjs
|
|
||||||
public/samples/EMU World/
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# superdough demo
|
||||||
|
|
||||||
|
This demo shows how to use [superdough](https://www.npmjs.com/package/superdough) with [vite](https://vitejs.dev/).
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pnpm i && cd examples/headless-repl
|
||||||
|
pnpm dev
|
||||||
|
# open http://localhost:5173/
|
||||||
|
```
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Superdough Example</title>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<button id="play">PLAAAAAAAY</button>
|
||||||
|
<script type="module">
|
||||||
|
import { superdough, samples, initAudioOnFirstClick, registerSynthSounds } from 'superdough';
|
||||||
|
|
||||||
|
const init = Promise.all([
|
||||||
|
initAudioOnFirstClick(),
|
||||||
|
samples('github:tidalcycles/Dirt-Samples/master'),
|
||||||
|
registerSynthSounds(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const loop = (t = 0) => {
|
||||||
|
// superdough(value, time, duration)
|
||||||
|
superdough({ s: 'bd', delay: 0.5 }, t);
|
||||||
|
superdough({ note: 'g1', s: 'sawtooth', cutoff: 600, resonance: 8 }, t, 0.125);
|
||||||
|
superdough({ note: 'g2', s: 'sawtooth', cutoff: 600, resonance: 8 }, t + 0.25, 0.125);
|
||||||
|
superdough({ s: 'hh' }, t + 0.25);
|
||||||
|
superdough({ s: 'sd', room: 0.5 }, t + 0.5);
|
||||||
|
superdough({ s: 'hh' }, t + 0.75);
|
||||||
|
};
|
||||||
|
|
||||||
|
document.getElementById('play').addEventListener('click', async () => {
|
||||||
|
await init;
|
||||||
|
let t = 0.1;
|
||||||
|
while (t < 16) {
|
||||||
|
loop(t++);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "superdough-example",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"superdough": "workspace:*"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"vite": "^5.0.10"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// this barrel export is currently only used to find undocumented exports
|
||||||
|
export * from './packages/core/index.mjs';
|
||||||
|
export * from './packages/csound/index.mjs';
|
||||||
|
export * from './packages/embed/index.mjs';
|
||||||
|
export * from './packages/desktopbridge/index.mjs';
|
||||||
|
export * from './packages/midi/index.mjs';
|
||||||
|
export * from './packages/mini/index.mjs';
|
||||||
|
export * from './packages/osc/index.mjs';
|
||||||
|
export * from './packages/react/index.mjs';
|
||||||
|
export * from './packages/serial/index.mjs';
|
||||||
|
export * from './packages/soundfonts/index.mjs';
|
||||||
|
export * from './packages/tonal/index.mjs';
|
||||||
|
export * from './packages/transpiler/index.mjs';
|
||||||
|
export * from './packages/webaudio/index.mjs';
|
||||||
|
export * from './packages/xen/index.mjs';
|
||||||
@@ -1,12 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
evaluate.mjs - <short description TODO>
|
jsdoc-synonyms.js - Add support for @synonym tag
|
||||||
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/eval/evaluate.mjs>
|
Copyright (C) 2023 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/midi/midi.mjs>
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { evaluate as _evaluate } from '@strudel.cycles/core';
|
function defineTags(dictionary) {
|
||||||
import shapeshifter from './shapeshifter.mjs';
|
dictionary.defineTag('synonyms', {
|
||||||
|
mustHaveValue: true,
|
||||||
|
onTagged: function (doclet, tag) {
|
||||||
|
doclet.synonyms_text = tag.value;
|
||||||
|
doclet.synonyms = doclet.synonyms_text.split(/[ ,]+/);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export const evaluate = async (code) => {
|
module.exports = { defineTags: defineTags };
|
||||||
return _evaluate(code, shapeshifter);
|
|
||||||
};
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"includePattern": ".+\\.(js(doc|x)?|mjs)$",
|
"includePattern": ".+\\.(js(doc|x)?|mjs)$",
|
||||||
"excludePattern": "node_modules|shift-parser|shift-reducer|shift-traverser|dist"
|
"excludePattern": "node_modules|shift-parser|shift-reducer|shift-traverser|dist"
|
||||||
},
|
},
|
||||||
"plugins": ["plugins/markdown"],
|
"plugins": ["plugins/markdown", "jsdoc/jsdoc-synonyms"],
|
||||||
"opts": {
|
"opts": {
|
||||||
"destination": "./out/",
|
"destination": "./out/",
|
||||||
"recurse": true
|
"recurse": true
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import { readFile } from 'node:fs/promises';
|
||||||
|
import { dirname, resolve } from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import { parse } from 'acorn';
|
||||||
|
import dependencyTree from 'dependency-tree';
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
|
function getExports(code) {
|
||||||
|
// parse it with acorn
|
||||||
|
let ast;
|
||||||
|
try {
|
||||||
|
ast = parse(code, {
|
||||||
|
ecmaVersion: 11,
|
||||||
|
sourceType: 'module',
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
return [`acorn parse error: ${err.name}: ${err.messsage}`];
|
||||||
|
}
|
||||||
|
|
||||||
|
// find all names exported in the file
|
||||||
|
return ast.body
|
||||||
|
.filter((node) => node?.type === 'ExportNamedDeclaration')
|
||||||
|
.map((node) => {
|
||||||
|
const { declaration } = node;
|
||||||
|
if (!declaration) {
|
||||||
|
// e.g. "export { Fraction, controls }"
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
switch (declaration.type) {
|
||||||
|
case 'VariableDeclaration':
|
||||||
|
return declaration.declarations
|
||||||
|
.map((d) => {
|
||||||
|
switch (d.id.type) {
|
||||||
|
case 'Identifier':
|
||||||
|
return d.id.name;
|
||||||
|
case 'ObjectPattern':
|
||||||
|
return d.id.properties.map((p) => p.value.name);
|
||||||
|
default:
|
||||||
|
return 'unknown declaration: ' + declaration;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.flat();
|
||||||
|
default:
|
||||||
|
// FunctionDeclaration, ClassDeclaration
|
||||||
|
return declaration.id.name;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.flat();
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDocumented(name, docs) {
|
||||||
|
return docs.find(
|
||||||
|
(d) => d.name === name || d.tags?.find((t) => t.title === 'synonyms' && t.value.split(', ').includes(name)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getUndocumented(path, docs) {
|
||||||
|
try {
|
||||||
|
// load the code of pattern.mjs as a string
|
||||||
|
const code = await readFile(path, 'utf8');
|
||||||
|
return getExports(code).filter((name) => !isDocumented(name, docs));
|
||||||
|
} catch (err) {
|
||||||
|
return [`parse error: ${err.name}: ${err.message}`];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// read doc.json file
|
||||||
|
const { docs } = JSON.parse(await readFile(resolve(__dirname, '..', 'doc.json'), 'utf8'));
|
||||||
|
|
||||||
|
const paths = dependencyTree.toList({
|
||||||
|
filename: 'index.mjs',
|
||||||
|
// filename: 'packages/core/index.mjs',
|
||||||
|
directory: resolve(__dirname),
|
||||||
|
filter: (path) => !path.includes('node_modules'),
|
||||||
|
});
|
||||||
|
// const paths = ['../packages/core/pattern.mjs', '../packages/core/hap.mjs'].map((rel) => resolve(__dirname, rel));
|
||||||
|
|
||||||
|
const undocumented = Object.fromEntries(
|
||||||
|
await Promise.all(
|
||||||
|
paths.map(async (path) => [path.replace(resolve(__dirname, '..'), ''), await getUndocumented(path, docs)]),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(JSON.stringify(undocumented, null, 2));
|
||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"packages": [
|
"packages": ["packages/*"],
|
||||||
"packages/*"
|
"version": "independent",
|
||||||
],
|
"npmClient": "pnpm",
|
||||||
"version": "independent"
|
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
# my-patterns
|
||||||
|
|
||||||
|
This directory can be used to save your own patterns, which then get
|
||||||
|
made into a pattern swatch.
|
||||||
|
|
||||||
|
Example: <https://felixroos.github.io/strudel/swatch/>
|
||||||
|
|
||||||
|
## deploy
|
||||||
|
|
||||||
|
### 1. fork the [strudel repo on github](https://github.com/tidalcycles/strudel.git)
|
||||||
|
|
||||||
|
### 2. clone your fork to your machine `git clone https://github.com/<your-username>/strudel.git strudel && cd strudel`
|
||||||
|
|
||||||
|
### 3. create a separate branch like `git branch patternuary && git checkout patternuary`
|
||||||
|
|
||||||
|
### 4. save one or more .txt files in the my-patterns folder
|
||||||
|
|
||||||
|
### 5. edit `website/public/CNAME` to contain `<your-username>.github.io/strudel`
|
||||||
|
|
||||||
|
### 6. edit `website/astro.config.mjs` to use site: `https://<your-username>.github.io` and base `/strudel`, like this
|
||||||
|
|
||||||
|
```js
|
||||||
|
const site = 'https://<your-username>.github.io';
|
||||||
|
const base = '/strudel';
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7. commit & push the changes
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git add . && git commit -m "site config" && git push --set-upstream origin
|
||||||
|
```
|
||||||
|
|
||||||
|
### 8. deploy to github pages
|
||||||
|
|
||||||
|
- go to settings -> pages and select "Github Actions" as source
|
||||||
|
- go to settings -> environments -> github-pages and press the edit button next to `main` and type in `patternuary` (under "Deployment branches")
|
||||||
|
- go to Actions -> `Build and Deploy` and click `Run workflow` with branch `patternuary`
|
||||||
|
|
||||||
|
### 9. view your patterns at `<your-username>.github.io/strudel/swatch/`
|
||||||
|
|
||||||
|
Alternatively, github pages allows you to use a custom domain, like https://mycooldomain.org/swatch/. [See their documentation for details](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site).
|
||||||
|
|
||||||
|
### 10. optional: automatic deployment
|
||||||
|
|
||||||
|
If you want to automatically deploy your site on push, go to `deploy.yml` and change `workflow_dispatch` to `push`.
|
||||||
|
|
||||||
|
## running locally
|
||||||
|
|
||||||
|
- install dependencies with `npm run setup`
|
||||||
|
- run dev server with `npm run repl` and open `http://localhost:4321/strudel/swatch/`
|
||||||
|
|
||||||
|
## tests fail?
|
||||||
|
|
||||||
|
Your tests might fail if the code does not follow prettiers format.
|
||||||
|
In that case, run `npm run codeformat`. To disable that, remove `npm run format-check` from `test.yml`
|
||||||
|
|
||||||
|
## updating your fork
|
||||||
|
|
||||||
|
To update your fork, you can pull the main branch and merge it into your `patternuary` branch.
|
||||||
Generated
-20478
File diff suppressed because it is too large
Load Diff
+41
-30
@@ -1,31 +1,32 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel.cycles/monorepo",
|
"name": "@strudel/monorepo",
|
||||||
"version": "0.0.4",
|
"version": "0.5.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Port of tidalcycles to javascript",
|
"description": "Port of tidalcycles to javascript",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pretest": "cd tutorial && npm run jsdoc-json",
|
"setup": "pnpm i",
|
||||||
"test": "vitest run --version",
|
"pretest": "npm run jsdoc-json",
|
||||||
"test-ui": "vitest --ui",
|
"prebuild": "npm run jsdoc-json",
|
||||||
"test-coverage": "vitest --coverage",
|
"prestart": "npm run jsdoc-json",
|
||||||
"bootstrap": "lerna bootstrap",
|
"test": "npm run pretest && vitest run --version",
|
||||||
"setup": "npm i && npm run bootstrap && cd repl && npm i && cd ../tutorial && npm i",
|
"test-ui": "npm run pretest && vitest --ui",
|
||||||
"snapshot": "vitest run -u --silent",
|
"test-coverage": "npm run pretest && vitest --coverage",
|
||||||
"repl": "cd repl && npm run dev",
|
"snapshot": "npm run pretest && vitest run -u --silent",
|
||||||
|
"repl": "npm run prestart && cd website && npm run dev",
|
||||||
|
"start": "npm run prestart && cd website && npm run dev",
|
||||||
|
"dev": "npm run prestart && cd website && npm run dev",
|
||||||
|
"build": "npm run prebuild && cd website && npm run build",
|
||||||
|
"preview": "cd website && npm run preview",
|
||||||
"osc": "cd packages/osc && npm run server",
|
"osc": "cd packages/osc && npm run server",
|
||||||
"build": "rm -rf out && cd repl && npm run build && cd ../tutorial && npm run build",
|
"jsdoc": "jsdoc packages/ -c jsdoc/jsdoc.config.json",
|
||||||
"preview": "npx serve ./out",
|
"jsdoc-json": "jsdoc packages/ --template ./node_modules/jsdoc-json --destination doc.json -c jsdoc/jsdoc.config.json",
|
||||||
"deploy": "NODE_DEBUG=gh-pages gh-pages -d out",
|
|
||||||
"jsdoc": "jsdoc packages/ -c jsdoc.config.json",
|
|
||||||
"jsdoc-json": "jsdoc packages/ --template ./node_modules/jsdoc-json --destination doc.json -c jsdoc.config.json",
|
|
||||||
"lint": "eslint . --ext mjs,js --quiet",
|
"lint": "eslint . --ext mjs,js --quiet",
|
||||||
"codeformat": "prettier --write .",
|
"codeformat": "prettier --write .",
|
||||||
"format-check": "prettier --check .",
|
"format-check": "prettier --check .",
|
||||||
"check": "npm run format-check && npm run lint && npm run test"
|
"report-undocumented": "npm run jsdoc-json && node jsdoc/undocumented.mjs > undocumented.json",
|
||||||
|
"check": "npm run format-check && npm run lint && npm run test",
|
||||||
|
"iclc": "cd paper && pandoc --template=pandoc/iclc.html --citeproc --number-sections iclc2023.md -o iclc2023.html && pandoc --template=pandoc/iclc.latex --citeproc --number-sections iclc2023.md -o iclc2023.pdf"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
|
||||||
"packages/*"
|
|
||||||
],
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/tidalcycles/strudel.git"
|
"url": "git+https://github.com/tidalcycles/strudel.git"
|
||||||
@@ -42,19 +43,29 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/tidalcycles/strudel/issues"
|
"url": "https://github.com/tidalcycles/strudel/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://strudel.tidalcycles.org",
|
"homepage": "https://strudel.cc",
|
||||||
|
"dependencies": {
|
||||||
|
"@strudel/core": "workspace:*",
|
||||||
|
"@strudel/mini": "workspace:*",
|
||||||
|
"@strudel/tonal": "workspace:*",
|
||||||
|
"@strudel/transpiler": "workspace:*",
|
||||||
|
"@strudel/webaudio": "workspace:*",
|
||||||
|
"@strudel/xen": "workspace:*"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitest/ui": "^0.25.7",
|
"dependency-tree": "^10.0.9",
|
||||||
"c8": "^7.12.0",
|
"@tauri-apps/cli": "^1.5.9",
|
||||||
"eslint": "^8.28.0",
|
"@vitest/ui": "^1.1.0",
|
||||||
|
"canvas": "^2.11.2",
|
||||||
|
"eslint": "^8.56.0",
|
||||||
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"events": "^3.3.0",
|
"events": "^3.3.0",
|
||||||
"gh-pages": "^4.0.0",
|
"jsdoc": "^4.0.2",
|
||||||
"jsdoc": "^3.6.10",
|
|
||||||
"jsdoc-json": "^2.0.2",
|
"jsdoc-json": "^2.0.2",
|
||||||
"jsdoc-to-markdown": "^7.1.1",
|
"jsdoc-to-markdown": "^8.0.0",
|
||||||
"lerna": "^4.0.0",
|
"lerna": "^8.0.1",
|
||||||
"prettier": "^2.8.1",
|
"prettier": "^3.1.1",
|
||||||
"rollup-plugin-visualizer": "^5.8.1",
|
"rollup-plugin-visualizer": "^5.12.0",
|
||||||
"vitest": "^0.25.7"
|
"vitest": "^1.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-11
@@ -1,15 +1,5 @@
|
|||||||
# Packages
|
# Packages
|
||||||
|
|
||||||
Each folder represents one of the @strudel.cycles/* packages [published to npm](https://www.npmjs.com/org/strudel.cycles).
|
Each folder represents one of the @strudel/* packages [published to npm](https://www.npmjs.com/org/strudel).
|
||||||
|
|
||||||
To understand how those pieces connect, refer to the [Technical Manual](https://github.com/tidalcycles/strudel/wiki/Technical-Manual) or the individual READMEs.
|
To understand how those pieces connect, refer to the [Technical Manual](https://github.com/tidalcycles/strudel/wiki/Technical-Manual) or the individual READMEs.
|
||||||
|
|
||||||
This is a graphical view of all the packages: [full screen](https://raw.githubusercontent.com/tidalcycles/strudel/main/dependencies.svg)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Generated with
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npx depcruise --include-only "^packages" -X "node_modules" --output-type dot packages | dot -T svg > dependencygraph.svg
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# @strudel/codemirror
|
||||||
|
|
||||||
|
This package contains helpers and extensions to use codemirror6. See [vite-vanilla-repl-cm6](../core/examples/vite-vanilla-repl-cm6/main.js) as an example of using it.
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import jsdoc from '../../doc.json';
|
||||||
|
// import { javascriptLanguage } from '@codemirror/lang-javascript';
|
||||||
|
import { autocompletion } from '@codemirror/autocomplete';
|
||||||
|
import { h } from './html';
|
||||||
|
|
||||||
|
function plaintext(str) {
|
||||||
|
const div = document.createElement('div');
|
||||||
|
div.innerText = str;
|
||||||
|
return div.innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getDocLabel = (doc) => doc.name || doc.longname;
|
||||||
|
const getInnerText = (html) => {
|
||||||
|
var div = document.createElement('div');
|
||||||
|
div.innerHTML = html;
|
||||||
|
return div.textContent || div.innerText || '';
|
||||||
|
};
|
||||||
|
|
||||||
|
export function Autocomplete({ doc, label }) {
|
||||||
|
return h`<div class="prose dark:prose-invert max-h-[400px] overflow-auto p-2">
|
||||||
|
<h1 class="pt-0 mt-0">${label || getDocLabel(doc)}</h1>
|
||||||
|
${doc.description}
|
||||||
|
<ul>
|
||||||
|
${doc.params?.map(
|
||||||
|
({ name, type, description }) =>
|
||||||
|
`<li>${name} : ${type.names?.join(' | ')} ${description ? ` - ${getInnerText(description)}` : ''}</li>`,
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
${doc.examples?.map((example) => `<div><pre>${plaintext(example)}</pre></div>`)}
|
||||||
|
</div>
|
||||||
|
</div>`[0];
|
||||||
|
/*
|
||||||
|
<pre
|
||||||
|
className="cursor-pointer"
|
||||||
|
onMouseDown={(e) => {
|
||||||
|
console.log('ola!');
|
||||||
|
navigator.clipboard.writeText(example);
|
||||||
|
e.stopPropagation();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{example}
|
||||||
|
</pre>
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
const jsdocCompletions = jsdoc.docs
|
||||||
|
.filter(
|
||||||
|
(doc) =>
|
||||||
|
getDocLabel(doc) &&
|
||||||
|
!getDocLabel(doc).startsWith('_') &&
|
||||||
|
!['package'].includes(doc.kind) &&
|
||||||
|
!['superdirtOnly', 'noAutocomplete'].some((tag) => doc.tags?.find((t) => t.originalTitle === tag)),
|
||||||
|
)
|
||||||
|
// https://codemirror.net/docs/ref/#autocomplete.Completion
|
||||||
|
.map((doc) /*: Completion */ => ({
|
||||||
|
label: getDocLabel(doc),
|
||||||
|
// detail: 'xxx', // An optional short piece of information to show (with a different style) after the label.
|
||||||
|
info: () => Autocomplete({ doc }),
|
||||||
|
type: 'function', // https://codemirror.net/docs/ref/#autocomplete.Completion.type
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const strudelAutocomplete = (context /* : CompletionContext */) => {
|
||||||
|
let word = context.matchBefore(/\w*/);
|
||||||
|
if (word.from == word.to && !context.explicit) return null;
|
||||||
|
return {
|
||||||
|
from: word.from,
|
||||||
|
options: jsdocCompletions,
|
||||||
|
/* options: [
|
||||||
|
{ label: 'match', type: 'keyword' },
|
||||||
|
{ label: 'hello', type: 'variable', info: '(World)' },
|
||||||
|
{ label: 'magic', type: 'text', apply: '⠁⭒*.✩.*⭒⠁', detail: 'macro' },
|
||||||
|
], */
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export function isAutoCompletionEnabled(on) {
|
||||||
|
return on
|
||||||
|
? [
|
||||||
|
autocompletion({ override: [strudelAutocomplete] }),
|
||||||
|
//javascriptLanguage.data.of({ autocomplete: strudelAutocomplete }),
|
||||||
|
]
|
||||||
|
: []; // autocompletion({ override: [] })
|
||||||
|
}
|
||||||
@@ -0,0 +1,339 @@
|
|||||||
|
import { closeBrackets } from '@codemirror/autocomplete';
|
||||||
|
// import { search, highlightSelectionMatches } from '@codemirror/search';
|
||||||
|
import { history } from '@codemirror/commands';
|
||||||
|
import { javascript } from '@codemirror/lang-javascript';
|
||||||
|
import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
||||||
|
import { Compartment, EditorState, Prec } from '@codemirror/state';
|
||||||
|
import {
|
||||||
|
EditorView,
|
||||||
|
highlightActiveLineGutter,
|
||||||
|
highlightActiveLine,
|
||||||
|
keymap,
|
||||||
|
lineNumbers,
|
||||||
|
drawSelection,
|
||||||
|
} from '@codemirror/view';
|
||||||
|
import { Pattern, Drawer, repl, cleanupDraw } from '@strudel/core';
|
||||||
|
import { isAutoCompletionEnabled } from './autocomplete.mjs';
|
||||||
|
import { isTooltipEnabled } from './tooltip.mjs';
|
||||||
|
import { flash, isFlashEnabled } from './flash.mjs';
|
||||||
|
import { highlightMiniLocations, isPatternHighlightingEnabled, updateMiniLocations } from './highlight.mjs';
|
||||||
|
import { keybindings } from './keybindings.mjs';
|
||||||
|
import { initTheme, activateTheme, theme } from './themes.mjs';
|
||||||
|
import { updateWidgets, sliderPlugin } from './slider.mjs';
|
||||||
|
import { persistentAtom } from '@nanostores/persistent';
|
||||||
|
|
||||||
|
const extensions = {
|
||||||
|
isLineWrappingEnabled: (on) => (on ? EditorView.lineWrapping : []),
|
||||||
|
isLineNumbersDisplayed: (on) => (on ? lineNumbers() : []),
|
||||||
|
theme,
|
||||||
|
isAutoCompletionEnabled,
|
||||||
|
isTooltipEnabled,
|
||||||
|
isPatternHighlightingEnabled,
|
||||||
|
isActiveLineHighlighted: (on) => (on ? [highlightActiveLine(), highlightActiveLineGutter()] : []),
|
||||||
|
isFlashEnabled,
|
||||||
|
keybindings,
|
||||||
|
};
|
||||||
|
const compartments = Object.fromEntries(Object.keys(extensions).map((key) => [key, new Compartment()]));
|
||||||
|
|
||||||
|
export const defaultSettings = {
|
||||||
|
keybindings: 'codemirror',
|
||||||
|
isLineNumbersDisplayed: true,
|
||||||
|
isActiveLineHighlighted: false,
|
||||||
|
isAutoCompletionEnabled: false,
|
||||||
|
isPatternHighlightingEnabled: true,
|
||||||
|
isFlashEnabled: true,
|
||||||
|
isTooltipEnabled: false,
|
||||||
|
isLineWrappingEnabled: false,
|
||||||
|
theme: 'strudelTheme',
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
fontSize: 18,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const codemirrorSettings = persistentAtom('codemirror-settings', defaultSettings, {
|
||||||
|
encode: JSON.stringify,
|
||||||
|
decode: JSON.parse,
|
||||||
|
});
|
||||||
|
|
||||||
|
// https://codemirror.net/docs/guide/
|
||||||
|
export function initEditor({ initialCode = '', onChange, onEvaluate, onStop, root }) {
|
||||||
|
const settings = codemirrorSettings.get();
|
||||||
|
const initialSettings = Object.keys(compartments).map((key) =>
|
||||||
|
compartments[key].of(extensions[key](parseBooleans(settings[key]))),
|
||||||
|
);
|
||||||
|
initTheme(settings.theme);
|
||||||
|
let state = EditorState.create({
|
||||||
|
doc: initialCode,
|
||||||
|
extensions: [
|
||||||
|
/* search(),
|
||||||
|
highlightSelectionMatches(), */
|
||||||
|
...initialSettings,
|
||||||
|
javascript(),
|
||||||
|
sliderPlugin,
|
||||||
|
// indentOnInput(), // works without. already brought with javascript extension?
|
||||||
|
// bracketMatching(), // does not do anything
|
||||||
|
closeBrackets(),
|
||||||
|
syntaxHighlighting(defaultHighlightStyle),
|
||||||
|
history(),
|
||||||
|
EditorView.updateListener.of((v) => onChange(v)),
|
||||||
|
drawSelection({ cursorBlinkRate: 0 }),
|
||||||
|
Prec.highest(
|
||||||
|
keymap.of([
|
||||||
|
{
|
||||||
|
key: 'Ctrl-Enter',
|
||||||
|
run: () => onEvaluate?.(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'Alt-Enter',
|
||||||
|
run: () => onEvaluate?.(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'Ctrl-.',
|
||||||
|
run: () => onStop?.(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'Alt-.',
|
||||||
|
run: (_, e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
onStop?.();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
/* {
|
||||||
|
key: 'Ctrl-Shift-.',
|
||||||
|
run: () => (onPanic ? onPanic() : onStop?.()),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'Ctrl-Shift-Enter',
|
||||||
|
run: () => (onReEvaluate ? onReEvaluate() : onEvaluate?.()),
|
||||||
|
}, */
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
return new EditorView({
|
||||||
|
state,
|
||||||
|
parent: root,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export class StrudelMirror {
|
||||||
|
constructor(options) {
|
||||||
|
const {
|
||||||
|
root,
|
||||||
|
id,
|
||||||
|
initialCode = '',
|
||||||
|
onDraw,
|
||||||
|
drawTime = [0, 0],
|
||||||
|
autodraw,
|
||||||
|
prebake,
|
||||||
|
bgFill = true,
|
||||||
|
...replOptions
|
||||||
|
} = options;
|
||||||
|
this.code = initialCode;
|
||||||
|
this.root = root;
|
||||||
|
this.miniLocations = [];
|
||||||
|
this.widgets = [];
|
||||||
|
this.painters = [];
|
||||||
|
this.drawTime = drawTime;
|
||||||
|
this.onDraw = onDraw;
|
||||||
|
const self = this;
|
||||||
|
this.id = id || s4();
|
||||||
|
|
||||||
|
this.drawer = new Drawer((haps, time) => {
|
||||||
|
const currentFrame = haps.filter((hap) => time >= hap.whole.begin && time <= hap.endClipped);
|
||||||
|
this.highlight(currentFrame, time);
|
||||||
|
this.onDraw?.(haps, time, currentFrame, this.painters);
|
||||||
|
}, drawTime);
|
||||||
|
|
||||||
|
// this approach does not work with multiple repls on screen
|
||||||
|
// TODO: refactor onPaint usages + find fix, maybe remove painters here?
|
||||||
|
Pattern.prototype.onPaint = function (onPaint) {
|
||||||
|
self.painters.push(onPaint);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.prebaked = prebake();
|
||||||
|
autodraw && this.drawFirstFrame();
|
||||||
|
|
||||||
|
this.repl = repl({
|
||||||
|
...replOptions,
|
||||||
|
onToggle: (started) => {
|
||||||
|
replOptions?.onToggle?.(started);
|
||||||
|
if (started) {
|
||||||
|
this.adjustDrawTime();
|
||||||
|
this.drawer.start(this.repl.scheduler);
|
||||||
|
// stop other repls when this one is started
|
||||||
|
document.dispatchEvent(
|
||||||
|
new CustomEvent('start-repl', {
|
||||||
|
detail: this.id,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.drawer.stop();
|
||||||
|
updateMiniLocations(this.editor, []);
|
||||||
|
cleanupDraw(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeEval: async () => {
|
||||||
|
cleanupDraw();
|
||||||
|
this.painters = [];
|
||||||
|
await this.prebaked;
|
||||||
|
await replOptions?.beforeEval?.();
|
||||||
|
},
|
||||||
|
afterEval: (options) => {
|
||||||
|
// remember for when highlighting is toggled on
|
||||||
|
this.miniLocations = options.meta?.miniLocations;
|
||||||
|
this.widgets = options.meta?.widgets;
|
||||||
|
updateWidgets(this.editor, this.widgets);
|
||||||
|
updateMiniLocations(this.editor, this.miniLocations);
|
||||||
|
replOptions?.afterEval?.(options);
|
||||||
|
this.adjustDrawTime();
|
||||||
|
this.drawer.invalidate();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this.editor = initEditor({
|
||||||
|
root,
|
||||||
|
initialCode,
|
||||||
|
onChange: (v) => {
|
||||||
|
if (v.docChanged) {
|
||||||
|
this.code = v.state.doc.toString();
|
||||||
|
this.repl.setCode?.(this.code);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onEvaluate: () => this.evaluate(),
|
||||||
|
onStop: () => this.stop(),
|
||||||
|
});
|
||||||
|
const cmEditor = this.root.querySelector('.cm-editor');
|
||||||
|
if (cmEditor) {
|
||||||
|
this.root.style.display = 'block';
|
||||||
|
if (bgFill) {
|
||||||
|
this.root.style.backgroundColor = 'var(--background)';
|
||||||
|
}
|
||||||
|
cmEditor.style.backgroundColor = 'transparent';
|
||||||
|
}
|
||||||
|
const settings = codemirrorSettings.get();
|
||||||
|
this.setFontSize(settings.fontSize);
|
||||||
|
this.setFontFamily(settings.fontFamily);
|
||||||
|
|
||||||
|
// stop this repl when another repl is started
|
||||||
|
this.onStartRepl = (e) => {
|
||||||
|
if (e.detail !== this.id) {
|
||||||
|
this.stop();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener('start-repl', this.onStartRepl);
|
||||||
|
}
|
||||||
|
// adjusts draw time depending on if there are painters
|
||||||
|
adjustDrawTime() {
|
||||||
|
// when no painters are set, [0,0] is enough (just highlighting)
|
||||||
|
this.drawer.setDrawTime(this.painters.length ? this.drawTime : [0, 0]);
|
||||||
|
}
|
||||||
|
async drawFirstFrame() {
|
||||||
|
if (!this.onDraw) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// draw first frame instantly
|
||||||
|
await this.prebaked;
|
||||||
|
try {
|
||||||
|
await this.repl.evaluate(this.code, false);
|
||||||
|
this.drawer.invalidate(this.repl.scheduler, -0.001);
|
||||||
|
// draw at -0.001 to avoid haps at 0 to be visualized as active
|
||||||
|
this.onDraw?.(this.drawer.visibleHaps, -0.001, [], this.painters);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('first frame could not be painted');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async evaluate() {
|
||||||
|
this.flash();
|
||||||
|
await this.repl.evaluate(this.code);
|
||||||
|
}
|
||||||
|
async stop() {
|
||||||
|
this.repl.scheduler.stop();
|
||||||
|
}
|
||||||
|
async toggle() {
|
||||||
|
if (this.repl.scheduler.started) {
|
||||||
|
this.repl.stop();
|
||||||
|
} else {
|
||||||
|
this.evaluate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flash(ms) {
|
||||||
|
flash(this.editor, ms);
|
||||||
|
}
|
||||||
|
highlight(haps, time) {
|
||||||
|
highlightMiniLocations(this.editor, time, haps);
|
||||||
|
}
|
||||||
|
setFontSize(size) {
|
||||||
|
this.root.style.fontSize = size + 'px';
|
||||||
|
}
|
||||||
|
setFontFamily(family) {
|
||||||
|
this.root.style.fontFamily = family;
|
||||||
|
const scroller = this.root.querySelector('.cm-scroller');
|
||||||
|
if (scroller) {
|
||||||
|
scroller.style.fontFamily = family;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reconfigureExtension(key, value) {
|
||||||
|
if (!extensions[key]) {
|
||||||
|
console.warn(`extension ${key} is not known`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
value = parseBooleans(value);
|
||||||
|
const newValue = extensions[key](value, this);
|
||||||
|
this.editor.dispatch({
|
||||||
|
effects: compartments[key].reconfigure(newValue),
|
||||||
|
});
|
||||||
|
if (key === 'theme') {
|
||||||
|
activateTheme(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setLineWrappingEnabled(enabled) {
|
||||||
|
this.reconfigureExtension('isLineWrappingEnabled', enabled);
|
||||||
|
}
|
||||||
|
setLineNumbersDisplayed(enabled) {
|
||||||
|
this.reconfigureExtension('isLineNumbersDisplayed', enabled);
|
||||||
|
}
|
||||||
|
setTheme(theme) {
|
||||||
|
this.reconfigureExtension('theme', theme);
|
||||||
|
}
|
||||||
|
setAutocompletionEnabled(enabled) {
|
||||||
|
this.reconfigureExtension('isAutoCompletionEnabled', enabled);
|
||||||
|
}
|
||||||
|
updateSettings(settings) {
|
||||||
|
this.setFontSize(settings.fontSize);
|
||||||
|
this.setFontFamily(settings.fontFamily);
|
||||||
|
for (let key in extensions) {
|
||||||
|
this.reconfigureExtension(key, settings[key]);
|
||||||
|
}
|
||||||
|
const updated = { ...codemirrorSettings.get(), ...settings };
|
||||||
|
codemirrorSettings.set(updated);
|
||||||
|
}
|
||||||
|
changeSetting(key, value) {
|
||||||
|
if (extensions[key]) {
|
||||||
|
this.reconfigureExtension(key, value);
|
||||||
|
return;
|
||||||
|
} else if (key === 'fontFamily') {
|
||||||
|
this.setFontFamily(value);
|
||||||
|
} else if (key === 'fontSize') {
|
||||||
|
this.setFontSize(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setCode(code) {
|
||||||
|
const changes = { from: 0, to: this.editor.state.doc.length, insert: code };
|
||||||
|
this.editor.dispatch({ changes });
|
||||||
|
}
|
||||||
|
clear() {
|
||||||
|
this.onStartRepl && document.removeEventListener('start-repl', this.onStartRepl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseBooleans(value) {
|
||||||
|
return { true: true, false: false }[value] ?? value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// helper function to generate repl ids
|
||||||
|
function s4() {
|
||||||
|
return Math.floor((1 + Math.random()) * 0x10000)
|
||||||
|
.toString(16)
|
||||||
|
.substring(1);
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { StateEffect, StateField } from '@codemirror/state';
|
||||||
|
import { Decoration, EditorView } from '@codemirror/view';
|
||||||
|
|
||||||
|
export const setFlash = StateEffect.define();
|
||||||
|
export const flashField = StateField.define({
|
||||||
|
create() {
|
||||||
|
return Decoration.none;
|
||||||
|
},
|
||||||
|
update(flash, tr) {
|
||||||
|
try {
|
||||||
|
for (let e of tr.effects) {
|
||||||
|
if (e.is(setFlash)) {
|
||||||
|
if (e.value && tr.newDoc.length > 0) {
|
||||||
|
const mark = Decoration.mark({ attributes: { style: `background-color: #FFCA2880` } });
|
||||||
|
flash = Decoration.set([mark.range(0, tr.newDoc.length)]);
|
||||||
|
} else {
|
||||||
|
flash = Decoration.set([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flash;
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('flash error', err);
|
||||||
|
return flash;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
provide: (f) => EditorView.decorations.from(f),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const flash = (view, ms = 200) => {
|
||||||
|
view.dispatch({ effects: setFlash.of(true) });
|
||||||
|
setTimeout(() => {
|
||||||
|
view.dispatch({ effects: setFlash.of(false) });
|
||||||
|
}, ms);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const isFlashEnabled = (on) => (on ? flashField : []);
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
import { RangeSetBuilder, StateEffect, StateField } from '@codemirror/state';
|
||||||
|
import { Decoration, EditorView } from '@codemirror/view';
|
||||||
|
|
||||||
|
export const setMiniLocations = StateEffect.define();
|
||||||
|
export const showMiniLocations = StateEffect.define();
|
||||||
|
export const updateMiniLocations = (view, locations) => {
|
||||||
|
view.dispatch({ effects: setMiniLocations.of(locations) });
|
||||||
|
};
|
||||||
|
export const highlightMiniLocations = (view, atTime, haps) => {
|
||||||
|
view.dispatch({ effects: showMiniLocations.of({ atTime, haps }) });
|
||||||
|
};
|
||||||
|
|
||||||
|
const miniLocations = StateField.define({
|
||||||
|
create() {
|
||||||
|
return Decoration.none;
|
||||||
|
},
|
||||||
|
update(locations, tr) {
|
||||||
|
if (tr.docChanged) {
|
||||||
|
locations = locations.map(tr.changes);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let e of tr.effects) {
|
||||||
|
if (e.is(setMiniLocations)) {
|
||||||
|
// this is called on eval, with the mini locations obtained from the transpiler
|
||||||
|
// codemirror will automatically remap the marks when the document is edited
|
||||||
|
// create a mark for each mini location, adding the range to the spec to find it later
|
||||||
|
const marks = e.value
|
||||||
|
.filter(([from]) => from < tr.newDoc.length)
|
||||||
|
.map(([from, to]) => [from, Math.min(to, tr.newDoc.length)])
|
||||||
|
.map(
|
||||||
|
(range) =>
|
||||||
|
Decoration.mark({
|
||||||
|
id: range.join(':'),
|
||||||
|
// this green is only to verify that the decoration moves when the document is edited
|
||||||
|
// it will be removed later, so the mark is not visible by default
|
||||||
|
attributes: { style: `background-color: #00CA2880` },
|
||||||
|
}).range(...range), // -> Decoration
|
||||||
|
);
|
||||||
|
|
||||||
|
locations = Decoration.set(marks, true); // -> DecorationSet === RangeSet<Decoration>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return locations;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const visibleMiniLocations = StateField.define({
|
||||||
|
create() {
|
||||||
|
return { atTime: 0, haps: new Map() };
|
||||||
|
},
|
||||||
|
update(visible, tr) {
|
||||||
|
for (let e of tr.effects) {
|
||||||
|
if (e.is(showMiniLocations)) {
|
||||||
|
// this is called every frame to show the locations that are currently active
|
||||||
|
// we can NOT create new marks because the context.locations haven't changed since eval time
|
||||||
|
// this is why we need to find a way to update the existing decorations, showing the ones that have an active range
|
||||||
|
const haps = new Map();
|
||||||
|
for (let hap of e.value.haps) {
|
||||||
|
for (let { start, end } of hap.context.locations) {
|
||||||
|
let id = `${start}:${end}`;
|
||||||
|
if (!haps.has(id) || haps.get(id).whole.begin.lt(hap.whole.begin)) {
|
||||||
|
haps.set(id, hap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
visible = { atTime: e.value.atTime, haps };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return visible;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// // Derive the set of decorations from the miniLocations and visibleLocations
|
||||||
|
const miniLocationHighlights = EditorView.decorations.compute([miniLocations, visibleMiniLocations], (state) => {
|
||||||
|
const iterator = state.field(miniLocations).iter();
|
||||||
|
const { haps } = state.field(visibleMiniLocations);
|
||||||
|
const builder = new RangeSetBuilder();
|
||||||
|
|
||||||
|
while (iterator.value) {
|
||||||
|
const {
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
value: {
|
||||||
|
spec: { id },
|
||||||
|
},
|
||||||
|
} = iterator;
|
||||||
|
|
||||||
|
if (haps.has(id)) {
|
||||||
|
const hap = haps.get(id);
|
||||||
|
const color = hap.context.color ?? 'var(--foreground)';
|
||||||
|
// Get explicit channels for color values
|
||||||
|
/*
|
||||||
|
const swatch = document.createElement('div');
|
||||||
|
swatch.style.color = color;
|
||||||
|
document.body.appendChild(swatch);
|
||||||
|
let channels = getComputedStyle(swatch)
|
||||||
|
.color.match(/^rgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(?:,\s*(\d*(?:\.\d+)?))?\)$/)
|
||||||
|
.slice(1)
|
||||||
|
.map((c) => parseFloat(c || 1));
|
||||||
|
document.body.removeChild(swatch);
|
||||||
|
|
||||||
|
// Get percentage of event
|
||||||
|
const percent = 1 - (atTime - hap.whole.begin) / hap.whole.duration;
|
||||||
|
channels[3] *= percent;
|
||||||
|
*/
|
||||||
|
|
||||||
|
builder.add(
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
Decoration.mark({
|
||||||
|
// attributes: { style: `outline: solid 2px rgba(${channels.join(', ')})` },
|
||||||
|
attributes: { style: `outline: solid 2px ${color}` },
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.finish();
|
||||||
|
});
|
||||||
|
|
||||||
|
export const highlightExtension = [miniLocations, visibleMiniLocations, miniLocationHighlights];
|
||||||
|
|
||||||
|
export const isPatternHighlightingEnabled = (on, config) => {
|
||||||
|
on &&
|
||||||
|
config &&
|
||||||
|
setTimeout(() => {
|
||||||
|
updateMiniLocations(config.editor, config.miniLocations);
|
||||||
|
}, 100);
|
||||||
|
return on ? highlightExtension : [];
|
||||||
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
const parser = typeof DOMParser !== 'undefined' ? new DOMParser() : null;
|
||||||
|
export let html = (string) => {
|
||||||
|
return parser?.parseFromString(string, 'text/html').querySelectorAll('*');
|
||||||
|
};
|
||||||
|
let parseChunk = (chunk) => {
|
||||||
|
if (Array.isArray(chunk)) return chunk.flat().join('');
|
||||||
|
if (chunk === undefined) return '';
|
||||||
|
return chunk;
|
||||||
|
};
|
||||||
|
export let h = (strings, ...vars) => {
|
||||||
|
let string = '';
|
||||||
|
for (let i in strings) {
|
||||||
|
string += parseChunk(strings[i]);
|
||||||
|
string += parseChunk(vars[i]);
|
||||||
|
}
|
||||||
|
return html(string);
|
||||||
|
};
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export * from './codemirror.mjs';
|
||||||
|
export * from './highlight.mjs';
|
||||||
|
export * from './flash.mjs';
|
||||||
|
export * from './slider.mjs';
|
||||||
|
export * from './themes.mjs';
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import { Prec } from '@codemirror/state';
|
||||||
|
import { keymap, ViewPlugin } from '@codemirror/view';
|
||||||
|
// import { searchKeymap } from '@codemirror/search';
|
||||||
|
import { emacs } from '@replit/codemirror-emacs';
|
||||||
|
import { vim } from '@replit/codemirror-vim';
|
||||||
|
import { vscodeKeymap } from '@replit/codemirror-vscode-keymap';
|
||||||
|
import { defaultKeymap, historyKeymap } from '@codemirror/commands';
|
||||||
|
|
||||||
|
const vscodePlugin = ViewPlugin.fromClass(
|
||||||
|
class {
|
||||||
|
constructor() {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: () => {
|
||||||
|
return Prec.highest(keymap.of([...vscodeKeymap]));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
const vscodeExtension = (options) => [vscodePlugin].concat(options ?? []);
|
||||||
|
|
||||||
|
const keymaps = {
|
||||||
|
vim,
|
||||||
|
emacs,
|
||||||
|
vscode: vscodeExtension,
|
||||||
|
};
|
||||||
|
|
||||||
|
export function keybindings(name) {
|
||||||
|
const active = keymaps[name];
|
||||||
|
return [keymap.of(defaultKeymap), keymap.of(historyKeymap), active ? active() : []];
|
||||||
|
// keymap.of(searchKeymap),
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"name": "@strudel/codemirror",
|
||||||
|
"version": "0.11.0",
|
||||||
|
"description": "Codemirror Extensions for Strudel",
|
||||||
|
"main": "index.mjs",
|
||||||
|
"publishConfig": {
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"module": "dist/index.mjs"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "vite build",
|
||||||
|
"prepublishOnly": "npm run build"
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/tidalcycles/strudel.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"tidalcycles",
|
||||||
|
"strudel",
|
||||||
|
"pattern",
|
||||||
|
"livecoding",
|
||||||
|
"algorave"
|
||||||
|
],
|
||||||
|
"author": "Felix Roos <flix91@gmail.com>",
|
||||||
|
"contributors": [
|
||||||
|
"Alex McLean <alex@slab.org>"
|
||||||
|
],
|
||||||
|
"license": "AGPL-3.0-or-later",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/tidalcycles/strudel/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/tidalcycles/strudel#readme",
|
||||||
|
"dependencies": {
|
||||||
|
"@codemirror/autocomplete": "^6.11.1",
|
||||||
|
"@codemirror/commands": "^6.3.3",
|
||||||
|
"@codemirror/lang-javascript": "^6.2.1",
|
||||||
|
"@codemirror/language": "^6.10.0",
|
||||||
|
"@codemirror/search": "^6.5.5",
|
||||||
|
"@codemirror/state": "^6.4.0",
|
||||||
|
"@codemirror/view": "^6.23.0",
|
||||||
|
"@lezer/highlight": "^1.2.0",
|
||||||
|
"@nanostores/persistent": "^0.9.1",
|
||||||
|
"@replit/codemirror-emacs": "^6.0.1",
|
||||||
|
"@replit/codemirror-vim": "^6.1.0",
|
||||||
|
"@replit/codemirror-vscode-keymap": "^6.0.2",
|
||||||
|
"@strudel/core": "workspace:*",
|
||||||
|
"@uiw/codemirror-themes": "^4.21.21",
|
||||||
|
"@uiw/codemirror-themes-all": "^4.21.21",
|
||||||
|
"nanostores": "^0.9.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"vite": "^5.0.10"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
import { ref, pure } from '@strudel/core';
|
||||||
|
import { WidgetType, ViewPlugin, Decoration } from '@codemirror/view';
|
||||||
|
import { StateEffect, StateField } from '@codemirror/state';
|
||||||
|
|
||||||
|
export let sliderValues = {};
|
||||||
|
const getSliderID = (from) => `slider_${from}`;
|
||||||
|
|
||||||
|
export class SliderWidget extends WidgetType {
|
||||||
|
constructor(value, min, max, from, to, step, view) {
|
||||||
|
super();
|
||||||
|
this.value = value;
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
|
this.from = from;
|
||||||
|
this.originalFrom = from;
|
||||||
|
this.to = to;
|
||||||
|
this.step = step;
|
||||||
|
this.view = view;
|
||||||
|
}
|
||||||
|
|
||||||
|
eq() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
toDOM() {
|
||||||
|
let wrap = document.createElement('span');
|
||||||
|
wrap.setAttribute('aria-hidden', 'true');
|
||||||
|
wrap.className = 'cm-slider'; // inline-flex items-center
|
||||||
|
let slider = wrap.appendChild(document.createElement('input'));
|
||||||
|
slider.type = 'range';
|
||||||
|
slider.min = this.min;
|
||||||
|
slider.max = this.max;
|
||||||
|
slider.step = this.step ?? (this.max - this.min) / 1000;
|
||||||
|
slider.originalValue = this.value;
|
||||||
|
// to make sure the code stays in sync, let's save the original value
|
||||||
|
// becuase .value automatically clamps values so it'll desync with the code
|
||||||
|
slider.value = slider.originalValue;
|
||||||
|
slider.from = this.from;
|
||||||
|
slider.originalFrom = this.originalFrom;
|
||||||
|
slider.to = this.to;
|
||||||
|
slider.style = 'width:64px;margin-right:4px;transform:translateY(4px)';
|
||||||
|
this.slider = slider;
|
||||||
|
slider.addEventListener('input', (e) => {
|
||||||
|
const next = e.target.value;
|
||||||
|
let insert = next;
|
||||||
|
//let insert = next.toFixed(2);
|
||||||
|
const to = slider.from + slider.originalValue.length;
|
||||||
|
let change = { from: slider.from, to, insert };
|
||||||
|
slider.originalValue = insert;
|
||||||
|
slider.value = insert;
|
||||||
|
this.view.dispatch({ changes: change });
|
||||||
|
const id = getSliderID(slider.originalFrom); // matches id generated in transpiler
|
||||||
|
window.postMessage({ type: 'cm-slider', value: Number(next), id });
|
||||||
|
});
|
||||||
|
return wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
ignoreEvent(e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const setWidgets = StateEffect.define();
|
||||||
|
|
||||||
|
export const updateWidgets = (view, widgets) => {
|
||||||
|
view.dispatch({ effects: setWidgets.of(widgets) });
|
||||||
|
};
|
||||||
|
|
||||||
|
function getWidgets(widgetConfigs, view) {
|
||||||
|
return widgetConfigs.map(({ from, to, value, min, max, step }) => {
|
||||||
|
return Decoration.widget({
|
||||||
|
widget: new SliderWidget(value, min, max, from, to, step, view),
|
||||||
|
side: 0,
|
||||||
|
}).range(from /* , to */);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const sliderPlugin = ViewPlugin.fromClass(
|
||||||
|
class {
|
||||||
|
decorations; //: DecorationSet
|
||||||
|
|
||||||
|
constructor(view /* : EditorView */) {
|
||||||
|
this.decorations = Decoration.set([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(update /* : ViewUpdate */) {
|
||||||
|
update.transactions.forEach((tr) => {
|
||||||
|
if (tr.docChanged) {
|
||||||
|
this.decorations = this.decorations.map(tr.changes);
|
||||||
|
const iterator = this.decorations.iter();
|
||||||
|
while (iterator.value) {
|
||||||
|
// when the widgets are moved, we need to tell the dom node the current position
|
||||||
|
// this is important because the updateSliderValue function has to work with the dom node
|
||||||
|
if (iterator.value?.widget?.slider) {
|
||||||
|
iterator.value.widget.slider.from = iterator.from;
|
||||||
|
iterator.value.widget.slider.to = iterator.to;
|
||||||
|
}
|
||||||
|
iterator.next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let e of tr.effects) {
|
||||||
|
if (e.is(setWidgets)) {
|
||||||
|
this.decorations = Decoration.set(getWidgets(e.value, update.view));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
decorations: (v) => v.decorations,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a slider widget to allow the user manipulate a value
|
||||||
|
*
|
||||||
|
* @name slider
|
||||||
|
* @param {number} value Initial value
|
||||||
|
* @param {number} min Minimum value - optional, defaults to 0
|
||||||
|
* @param {number} max Maximum value - optional, defaults to 1
|
||||||
|
* @param {number} step Step size - optional
|
||||||
|
*/
|
||||||
|
export let slider = (value) => {
|
||||||
|
console.warn('slider will only work when the transpiler is used... passing value as is');
|
||||||
|
return pure(value);
|
||||||
|
};
|
||||||
|
// function transpiled from slider = (value, min, max)
|
||||||
|
export let sliderWithID = (id, value, min, max) => {
|
||||||
|
sliderValues[id] = value; // sync state at eval time (code -> state)
|
||||||
|
return ref(() => sliderValues[id]); // use state at query time
|
||||||
|
};
|
||||||
|
// update state when sliders are moved
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
window.addEventListener('message', (e) => {
|
||||||
|
if (e.data.type === 'cm-slider') {
|
||||||
|
if (sliderValues[e.data.id] !== undefined) {
|
||||||
|
// update state when slider is moved
|
||||||
|
sliderValues[e.data.id] = e.data.value;
|
||||||
|
} else {
|
||||||
|
console.warn(`slider with id "${e.data.id}" is not registered. Only ${Object.keys(sliderValues)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
Vendored
+527
@@ -0,0 +1,527 @@
|
|||||||
|
import {
|
||||||
|
abcdef,
|
||||||
|
androidstudio,
|
||||||
|
atomone,
|
||||||
|
aura,
|
||||||
|
bespin,
|
||||||
|
darcula,
|
||||||
|
dracula,
|
||||||
|
duotoneDark,
|
||||||
|
eclipse,
|
||||||
|
githubDark,
|
||||||
|
gruvboxDark,
|
||||||
|
materialDark,
|
||||||
|
nord,
|
||||||
|
okaidia,
|
||||||
|
solarizedDark,
|
||||||
|
sublime,
|
||||||
|
tokyoNight,
|
||||||
|
tokyoNightStorm,
|
||||||
|
vscodeDark,
|
||||||
|
xcodeDark,
|
||||||
|
bbedit,
|
||||||
|
duotoneLight,
|
||||||
|
githubLight,
|
||||||
|
gruvboxLight,
|
||||||
|
materialLight,
|
||||||
|
noctisLilac,
|
||||||
|
solarizedLight,
|
||||||
|
tokyoNightDay,
|
||||||
|
xcodeLight,
|
||||||
|
} from '@uiw/codemirror-themes-all';
|
||||||
|
|
||||||
|
import strudelTheme from './themes/strudel-theme';
|
||||||
|
import bluescreen, { settings as bluescreenSettings } from './themes/bluescreen';
|
||||||
|
import blackscreen, { settings as blackscreenSettings } from './themes/blackscreen';
|
||||||
|
import whitescreen, { settings as whitescreenSettings } from './themes/whitescreen';
|
||||||
|
import teletext, { settings as teletextSettings } from './themes/teletext';
|
||||||
|
import algoboy, { settings as algoboySettings } from './themes/algoboy';
|
||||||
|
import terminal, { settings as terminalSettings } from './themes/terminal';
|
||||||
|
|
||||||
|
export const themes = {
|
||||||
|
strudelTheme,
|
||||||
|
bluescreen,
|
||||||
|
blackscreen,
|
||||||
|
whitescreen,
|
||||||
|
teletext,
|
||||||
|
algoboy,
|
||||||
|
terminal,
|
||||||
|
abcdef,
|
||||||
|
androidstudio,
|
||||||
|
atomone,
|
||||||
|
aura,
|
||||||
|
bespin,
|
||||||
|
darcula,
|
||||||
|
dracula,
|
||||||
|
duotoneDark,
|
||||||
|
eclipse,
|
||||||
|
githubDark,
|
||||||
|
gruvboxDark,
|
||||||
|
materialDark,
|
||||||
|
nord,
|
||||||
|
okaidia,
|
||||||
|
solarizedDark,
|
||||||
|
sublime,
|
||||||
|
tokyoNight,
|
||||||
|
tokyoNightStorm,
|
||||||
|
vscodeDark,
|
||||||
|
xcodeDark,
|
||||||
|
bbedit,
|
||||||
|
duotoneLight,
|
||||||
|
githubLight,
|
||||||
|
gruvboxLight,
|
||||||
|
materialLight,
|
||||||
|
noctisLilac,
|
||||||
|
solarizedLight,
|
||||||
|
tokyoNightDay,
|
||||||
|
xcodeLight,
|
||||||
|
};
|
||||||
|
|
||||||
|
// lineBackground is background with 50% opacity, to make sure the selection below is visible
|
||||||
|
|
||||||
|
export const settings = {
|
||||||
|
strudelTheme: {
|
||||||
|
background: '#222',
|
||||||
|
lineBackground: '#22222299',
|
||||||
|
foreground: '#fff',
|
||||||
|
// foreground: '#75baff',
|
||||||
|
caret: '#ffcc00',
|
||||||
|
selection: 'rgba(128, 203, 196, 0.5)',
|
||||||
|
selectionMatch: '#036dd626',
|
||||||
|
// lineHighlight: '#8a91991a', // original
|
||||||
|
lineHighlight: '#00000050',
|
||||||
|
gutterBackground: 'transparent',
|
||||||
|
// gutterForeground: '#8a919966',
|
||||||
|
gutterForeground: '#8a919966',
|
||||||
|
},
|
||||||
|
bluescreen: bluescreenSettings,
|
||||||
|
blackscreen: blackscreenSettings,
|
||||||
|
whitescreen: whitescreenSettings,
|
||||||
|
teletext: teletextSettings,
|
||||||
|
algoboy: algoboySettings,
|
||||||
|
terminal: terminalSettings,
|
||||||
|
abcdef: {
|
||||||
|
background: '#0f0f0f',
|
||||||
|
lineBackground: '#0f0f0f99',
|
||||||
|
foreground: '#defdef',
|
||||||
|
caret: '#00FF00',
|
||||||
|
selection: '#515151',
|
||||||
|
selectionMatch: '#515151',
|
||||||
|
gutterBackground: '#555',
|
||||||
|
gutterForeground: '#FFFFFF',
|
||||||
|
lineHighlight: '#314151',
|
||||||
|
},
|
||||||
|
androidstudio: {
|
||||||
|
background: '#282b2e',
|
||||||
|
lineBackground: '#282b2e99',
|
||||||
|
foreground: '#a9b7c6',
|
||||||
|
caret: '#00FF00',
|
||||||
|
selection: '#343739',
|
||||||
|
selectionMatch: '#343739',
|
||||||
|
lineHighlight: '#343739',
|
||||||
|
},
|
||||||
|
atomone: {
|
||||||
|
background: '#272C35',
|
||||||
|
lineBackground: '#272C3599',
|
||||||
|
foreground: '#9d9b97',
|
||||||
|
caret: '#797977',
|
||||||
|
selection: '#ffffff30',
|
||||||
|
selectionMatch: '#2B323D',
|
||||||
|
gutterBackground: '#272C35',
|
||||||
|
gutterForeground: '#465063',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
lineHighlight: '#2B323D',
|
||||||
|
},
|
||||||
|
aura: {
|
||||||
|
background: '#21202e',
|
||||||
|
lineBackground: '#21202e99',
|
||||||
|
foreground: '#edecee',
|
||||||
|
caret: '#a277ff',
|
||||||
|
selection: '#3d375e7f',
|
||||||
|
selectionMatch: '#3d375e7f',
|
||||||
|
gutterBackground: '#21202e',
|
||||||
|
gutterForeground: '#edecee',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
lineHighlight: '#a394f033',
|
||||||
|
},
|
||||||
|
bbedit: {
|
||||||
|
light: true,
|
||||||
|
background: '#FFFFFF',
|
||||||
|
lineBackground: '#FFFFFF99',
|
||||||
|
foreground: '#000000',
|
||||||
|
caret: '#FBAC52',
|
||||||
|
selection: '#FFD420',
|
||||||
|
selectionMatch: '#FFD420',
|
||||||
|
gutterBackground: '#f5f5f5',
|
||||||
|
gutterForeground: '#4D4D4C',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
lineHighlight: '#00000012',
|
||||||
|
},
|
||||||
|
bespin: {
|
||||||
|
background: '#28211c',
|
||||||
|
lineBackground: '#28211c99',
|
||||||
|
foreground: '#9d9b97',
|
||||||
|
caret: '#797977',
|
||||||
|
selection: '#36312e',
|
||||||
|
selectionMatch: '#4f382b',
|
||||||
|
gutterBackground: '#28211c',
|
||||||
|
gutterForeground: '#666666',
|
||||||
|
lineHighlight: 'rgba(255, 255, 255, 0.1)',
|
||||||
|
},
|
||||||
|
darcula: {
|
||||||
|
background: '#2B2B2B',
|
||||||
|
lineBackground: '#2B2B2B99',
|
||||||
|
foreground: '#f8f8f2',
|
||||||
|
caret: '#FFFFFF',
|
||||||
|
selection: 'rgba(255, 255, 255, 0.1)',
|
||||||
|
selectionMatch: 'rgba(255, 255, 255, 0.2)',
|
||||||
|
gutterBackground: 'rgba(255, 255, 255, 0.1)',
|
||||||
|
gutterForeground: '#999',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
lineHighlight: 'rgba(255, 255, 255, 0.1)',
|
||||||
|
},
|
||||||
|
dracula: {
|
||||||
|
background: '#282a36',
|
||||||
|
lineBackground: '#282a3699',
|
||||||
|
foreground: '#f8f8f2',
|
||||||
|
caret: '#f8f8f0',
|
||||||
|
selection: 'rgba(255, 255, 255, 0.1)',
|
||||||
|
selectionMatch: 'rgba(255, 255, 255, 0.2)',
|
||||||
|
gutterBackground: '#282a36',
|
||||||
|
gutterForeground: '#6D8A88',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
lineHighlight: 'rgba(255, 255, 255, 0.1)',
|
||||||
|
},
|
||||||
|
duotoneLight: {
|
||||||
|
light: true,
|
||||||
|
background: '#faf8f5',
|
||||||
|
lineBackground: '#faf8f599',
|
||||||
|
foreground: '#b29762',
|
||||||
|
caret: '#93abdc',
|
||||||
|
selection: '#e3dcce',
|
||||||
|
selectionMatch: '#e3dcce',
|
||||||
|
gutterBackground: '#faf8f5',
|
||||||
|
gutterForeground: '#cdc4b1',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
lineHighlight: '#EFEFEF',
|
||||||
|
},
|
||||||
|
duotoneDark: {
|
||||||
|
background: '#2a2734',
|
||||||
|
lineBackground: '#2a273499',
|
||||||
|
foreground: '#6c6783',
|
||||||
|
caret: '#ffad5c',
|
||||||
|
selection: 'rgba(255, 255, 255, 0.1)',
|
||||||
|
gutterBackground: '#2a2734',
|
||||||
|
gutterForeground: '#545167',
|
||||||
|
lineHighlight: '#36334280',
|
||||||
|
},
|
||||||
|
eclipse: {
|
||||||
|
light: true,
|
||||||
|
background: '#fff',
|
||||||
|
lineBackground: '#ffffff99',
|
||||||
|
foreground: '#000',
|
||||||
|
caret: '#FFFFFF',
|
||||||
|
selection: '#d7d4f0',
|
||||||
|
selectionMatch: '#d7d4f0',
|
||||||
|
gutterBackground: '#f7f7f7',
|
||||||
|
gutterForeground: '#999',
|
||||||
|
lineHighlight: '#e8f2ff',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
},
|
||||||
|
githubLight: {
|
||||||
|
light: true,
|
||||||
|
background: '#fff',
|
||||||
|
lineBackground: '#ffffff99',
|
||||||
|
foreground: '#24292e',
|
||||||
|
selection: '#BBDFFF',
|
||||||
|
selectionMatch: '#BBDFFF',
|
||||||
|
gutterBackground: '#fff',
|
||||||
|
gutterForeground: '#6e7781',
|
||||||
|
},
|
||||||
|
githubDark: {
|
||||||
|
background: '#0d1117',
|
||||||
|
lineBackground: '#0d111799',
|
||||||
|
foreground: '#c9d1d9',
|
||||||
|
caret: '#c9d1d9',
|
||||||
|
selection: '#003d73',
|
||||||
|
selectionMatch: '#003d73',
|
||||||
|
lineHighlight: '#36334280',
|
||||||
|
},
|
||||||
|
gruvboxDark: {
|
||||||
|
background: '#282828',
|
||||||
|
lineBackground: '#28282899',
|
||||||
|
foreground: '#ebdbb2',
|
||||||
|
caret: '#ebdbb2',
|
||||||
|
selection: '#bdae93',
|
||||||
|
selectionMatch: '#bdae93',
|
||||||
|
lineHighlight: '#3c3836',
|
||||||
|
gutterBackground: '#282828',
|
||||||
|
gutterForeground: '#7c6f64',
|
||||||
|
},
|
||||||
|
gruvboxLight: {
|
||||||
|
light: true,
|
||||||
|
background: '#fbf1c7',
|
||||||
|
lineBackground: '#fbf1c799',
|
||||||
|
foreground: '#3c3836',
|
||||||
|
caret: '#af3a03',
|
||||||
|
selection: '#ebdbb2',
|
||||||
|
selectionMatch: '#bdae93',
|
||||||
|
lineHighlight: '#ebdbb2',
|
||||||
|
gutterBackground: '#ebdbb2',
|
||||||
|
gutterForeground: '#665c54',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
},
|
||||||
|
materialDark: {
|
||||||
|
background: '#2e3235',
|
||||||
|
lineBackground: '#2e323599',
|
||||||
|
foreground: '#bdbdbd',
|
||||||
|
caret: '#a0a4ae',
|
||||||
|
selection: '#d7d4f0',
|
||||||
|
selectionMatch: '#d7d4f0',
|
||||||
|
gutterBackground: '#2e3235',
|
||||||
|
gutterForeground: '#999',
|
||||||
|
gutterActiveForeground: '#4f5b66',
|
||||||
|
lineHighlight: '#545b61',
|
||||||
|
},
|
||||||
|
materialLight: {
|
||||||
|
light: true,
|
||||||
|
background: '#FAFAFA',
|
||||||
|
lineBackground: '#FAFAFA99',
|
||||||
|
foreground: '#90A4AE',
|
||||||
|
caret: '#272727',
|
||||||
|
selection: '#80CBC440',
|
||||||
|
selectionMatch: '#FAFAFA',
|
||||||
|
gutterBackground: '#FAFAFA',
|
||||||
|
gutterForeground: '#90A4AE',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
lineHighlight: '#CCD7DA50',
|
||||||
|
},
|
||||||
|
noctisLilac: {
|
||||||
|
light: true,
|
||||||
|
background: '#f2f1f8',
|
||||||
|
lineBackground: '#f2f1f899',
|
||||||
|
foreground: '#0c006b',
|
||||||
|
caret: '#5c49e9',
|
||||||
|
selection: '#d5d1f2',
|
||||||
|
selectionMatch: '#d5d1f2',
|
||||||
|
gutterBackground: '#f2f1f8',
|
||||||
|
gutterForeground: '#0c006b70',
|
||||||
|
lineHighlight: '#e1def3',
|
||||||
|
},
|
||||||
|
nord: {
|
||||||
|
background: '#2e3440',
|
||||||
|
lineBackground: '#2e344099',
|
||||||
|
foreground: '#FFFFFF',
|
||||||
|
caret: '#FFFFFF',
|
||||||
|
selection: '#3b4252',
|
||||||
|
selectionMatch: '#e5e9f0',
|
||||||
|
gutterBackground: '#2e3440',
|
||||||
|
gutterForeground: '#4c566a',
|
||||||
|
gutterActiveForeground: '#d8dee9',
|
||||||
|
lineHighlight: '#4c566a',
|
||||||
|
},
|
||||||
|
okaidia: {
|
||||||
|
background: '#272822',
|
||||||
|
lineBackground: '#27282299',
|
||||||
|
foreground: '#FFFFFF',
|
||||||
|
caret: '#FFFFFF',
|
||||||
|
selection: '#49483E',
|
||||||
|
selectionMatch: '#49483E',
|
||||||
|
gutterBackground: '#272822',
|
||||||
|
gutterForeground: '#FFFFFF70',
|
||||||
|
lineHighlight: '#00000059',
|
||||||
|
},
|
||||||
|
solarizedLight: {
|
||||||
|
light: true,
|
||||||
|
background: '#fdf6e3',
|
||||||
|
lineBackground: '#fdf6e399',
|
||||||
|
foreground: '#657b83',
|
||||||
|
caret: '#586e75',
|
||||||
|
selection: '#dfd9c8',
|
||||||
|
selectionMatch: '#dfd9c8',
|
||||||
|
gutterBackground: '#00000010',
|
||||||
|
gutterForeground: '#657b83',
|
||||||
|
lineHighlight: '#dfd9c8',
|
||||||
|
},
|
||||||
|
solarizedDark: {
|
||||||
|
background: '#002b36',
|
||||||
|
lineBackground: '#002b3699',
|
||||||
|
foreground: '#93a1a1',
|
||||||
|
caret: '#839496',
|
||||||
|
selection: '#173541',
|
||||||
|
selectionMatch: '#aafe661a',
|
||||||
|
gutterBackground: '#00252f',
|
||||||
|
gutterForeground: '#839496',
|
||||||
|
lineHighlight: '#173541',
|
||||||
|
},
|
||||||
|
sublime: {
|
||||||
|
background: '#303841',
|
||||||
|
lineBackground: '#30384199',
|
||||||
|
foreground: '#FFFFFF',
|
||||||
|
caret: '#FBAC52',
|
||||||
|
selection: '#4C5964',
|
||||||
|
selectionMatch: '#3A546E',
|
||||||
|
gutterBackground: '#303841',
|
||||||
|
gutterForeground: '#FFFFFF70',
|
||||||
|
lineHighlight: '#00000059',
|
||||||
|
},
|
||||||
|
tokyoNightDay: {
|
||||||
|
light: true,
|
||||||
|
background: '#e1e2e7',
|
||||||
|
lineBackground: '#e1e2e799',
|
||||||
|
foreground: '#3760bf',
|
||||||
|
caret: '#3760bf',
|
||||||
|
selection: '#99a7df',
|
||||||
|
selectionMatch: '#99a7df',
|
||||||
|
gutterBackground: '#e1e2e7',
|
||||||
|
gutterForeground: '#3760bf',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
lineHighlight: '#5f5faf11',
|
||||||
|
},
|
||||||
|
tokyoNightStorm: {
|
||||||
|
background: '#24283b',
|
||||||
|
lineBackground: '#24283b99',
|
||||||
|
foreground: '#7982a9',
|
||||||
|
caret: '#c0caf5',
|
||||||
|
selection: '#6f7bb630',
|
||||||
|
selectionMatch: '#1f2335',
|
||||||
|
gutterBackground: '#24283b',
|
||||||
|
gutterForeground: '#7982a9',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
lineHighlight: '#292e42',
|
||||||
|
},
|
||||||
|
tokyoNight: {
|
||||||
|
background: '#1a1b26',
|
||||||
|
lineBackground: '#1a1b2699',
|
||||||
|
foreground: '#787c99',
|
||||||
|
caret: '#c0caf5',
|
||||||
|
selection: '#515c7e40',
|
||||||
|
selectionMatch: '#16161e',
|
||||||
|
gutterBackground: '#1a1b26',
|
||||||
|
gutterForeground: '#787c99',
|
||||||
|
gutterBorder: 'transparent',
|
||||||
|
lineHighlight: '#1e202e',
|
||||||
|
},
|
||||||
|
vscodeDark: {
|
||||||
|
background: '#1e1e1e',
|
||||||
|
lineBackground: '#1e1e1e99',
|
||||||
|
foreground: '#9cdcfe',
|
||||||
|
caret: '#c6c6c6',
|
||||||
|
selection: '#6199ff2f',
|
||||||
|
selectionMatch: '#72a1ff59',
|
||||||
|
lineHighlight: '#ffffff0f',
|
||||||
|
gutterBackground: '#1e1e1e',
|
||||||
|
gutterForeground: '#838383',
|
||||||
|
gutterActiveForeground: '#fff',
|
||||||
|
},
|
||||||
|
xcodeLight: {
|
||||||
|
light: true,
|
||||||
|
background: '#fff',
|
||||||
|
lineBackground: '#ffffff99',
|
||||||
|
foreground: '#3D3D3D',
|
||||||
|
selection: '#BBDFFF',
|
||||||
|
selectionMatch: '#BBDFFF',
|
||||||
|
gutterBackground: '#fff',
|
||||||
|
gutterForeground: '#AFAFAF',
|
||||||
|
lineHighlight: '#EDF4FF',
|
||||||
|
},
|
||||||
|
xcodeDark: {
|
||||||
|
background: '#292A30',
|
||||||
|
lineBackground: '#292A3099',
|
||||||
|
foreground: '#CECFD0',
|
||||||
|
caret: '#fff',
|
||||||
|
selection: '#727377',
|
||||||
|
selectionMatch: '#727377',
|
||||||
|
lineHighlight: '#2F3239',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
function getColors(str) {
|
||||||
|
const colorRegex = /#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})/g;
|
||||||
|
const colors = [];
|
||||||
|
|
||||||
|
let match;
|
||||||
|
while ((match = colorRegex.exec(str)) !== null) {
|
||||||
|
const color = match[0];
|
||||||
|
if (!colors.includes(color)) {
|
||||||
|
colors.push(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return colors;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove
|
||||||
|
export function themeColors(theme) {
|
||||||
|
return getColors(stringifySafe(theme));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCircularReplacer() {
|
||||||
|
const seen = new WeakSet();
|
||||||
|
return (key, value) => {
|
||||||
|
if (typeof value === 'object' && value !== null) {
|
||||||
|
if (seen.has(value)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
seen.add(value);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function stringifySafe(json) {
|
||||||
|
return JSON.stringify(json, getCircularReplacer());
|
||||||
|
}
|
||||||
|
|
||||||
|
export const theme = (theme) => themes[theme] || themes.strudelTheme;
|
||||||
|
|
||||||
|
// css style injection helpers
|
||||||
|
export function injectStyle(rule) {
|
||||||
|
const newStyle = document.createElement('style');
|
||||||
|
document.head.appendChild(newStyle);
|
||||||
|
const styleSheet = newStyle.sheet;
|
||||||
|
const ruleIndex = styleSheet.insertRule(rule, 0);
|
||||||
|
return () => styleSheet.deleteRule(ruleIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentTheme,
|
||||||
|
resetThemeStyle,
|
||||||
|
themeStyle,
|
||||||
|
styleID = 'strudel-theme-vars';
|
||||||
|
export function initTheme(theme) {
|
||||||
|
if (!document.getElementById(styleID)) {
|
||||||
|
themeStyle = document.createElement('style');
|
||||||
|
themeStyle.id = styleID;
|
||||||
|
document.head.append(themeStyle);
|
||||||
|
}
|
||||||
|
activateTheme(theme);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function activateTheme(name) {
|
||||||
|
if (currentTheme === name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
currentTheme = name;
|
||||||
|
if (!settings[name]) {
|
||||||
|
console.warn('theme', name, 'has no settings.. defaulting to strudelTheme settings');
|
||||||
|
}
|
||||||
|
const themeSettings = settings[name] || settings.strudelTheme;
|
||||||
|
// set css variables
|
||||||
|
themeStyle.innerHTML = `:root {
|
||||||
|
${Object.entries(themeSettings)
|
||||||
|
// important to override fallback
|
||||||
|
.map(([key, value]) => `--${key}: ${value} !important;`)
|
||||||
|
.join('\n')}
|
||||||
|
}`;
|
||||||
|
// tailwind dark mode
|
||||||
|
if (themeSettings.light) {
|
||||||
|
document.documentElement.classList.remove('dark');
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.add('dark');
|
||||||
|
}
|
||||||
|
resetThemeStyle?.();
|
||||||
|
resetThemeStyle = undefined;
|
||||||
|
if (themeSettings.customStyle) {
|
||||||
|
resetThemeStyle = injectStyle(themeSettings.customStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
import { tags as t } from '@lezer/highlight';
|
||||||
|
import { createTheme } from '@uiw/codemirror-themes';
|
||||||
|
export const settings = {
|
||||||
|
background: '#9bbc0f',
|
||||||
|
foreground: '#0f380f', // whats that?
|
||||||
|
caret: '#0f380f',
|
||||||
|
selection: '#306230',
|
||||||
|
selectionMatch: '#ffffff26',
|
||||||
|
lineHighlight: '#8bac0f',
|
||||||
|
lineBackground: '#9bbc0f50',
|
||||||
|
//lineBackground: 'transparent',
|
||||||
|
gutterBackground: 'transparent',
|
||||||
|
gutterForeground: '#0f380f',
|
||||||
|
light: true,
|
||||||
|
customStyle: '.cm-line { line-height: 1 }',
|
||||||
|
};
|
||||||
|
export default createTheme({
|
||||||
|
theme: 'light',
|
||||||
|
settings,
|
||||||
|
styles: [
|
||||||
|
{ tag: t.keyword, color: '#0f380f' },
|
||||||
|
{ tag: t.operator, color: '#0f380f' },
|
||||||
|
{ tag: t.special(t.variableName), color: '#0f380f' },
|
||||||
|
{ tag: t.typeName, color: '#0f380f' },
|
||||||
|
{ tag: t.atom, color: '#0f380f' },
|
||||||
|
{ tag: t.number, color: '#0f380f' },
|
||||||
|
{ tag: t.definition(t.variableName), color: '#0f380f' },
|
||||||
|
{ tag: t.string, color: '#0f380f' },
|
||||||
|
{ tag: t.special(t.string), color: '#0f380f' },
|
||||||
|
{ tag: t.comment, color: '#0f380f' },
|
||||||
|
{ tag: t.variableName, color: '#0f380f' },
|
||||||
|
{ tag: t.tagName, color: '#0f380f' },
|
||||||
|
{ tag: t.bracket, color: '#0f380f' },
|
||||||
|
{ tag: t.meta, color: '#0f380f' },
|
||||||
|
{ tag: t.attributeName, color: '#0f380f' },
|
||||||
|
{ tag: t.propertyName, color: '#0f380f' },
|
||||||
|
{ tag: t.className, color: '#0f380f' },
|
||||||
|
{ tag: t.invalid, color: '#0f380f' },
|
||||||
|
{ tag: [t.unit, t.punctuation], color: '#0f380f' },
|
||||||
|
],
|
||||||
|
});
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
import { tags as t } from '@lezer/highlight';
|
||||||
|
import { createTheme } from '@uiw/codemirror-themes';
|
||||||
|
export const settings = {
|
||||||
|
background: 'black',
|
||||||
|
foreground: 'white', // whats that?
|
||||||
|
caret: 'white',
|
||||||
|
selection: '#ffffff20',
|
||||||
|
selectionMatch: '#036dd626',
|
||||||
|
lineHighlight: '#ffffff10',
|
||||||
|
lineBackground: '#00000050',
|
||||||
|
gutterBackground: 'transparent',
|
||||||
|
gutterForeground: '#8a919966',
|
||||||
|
};
|
||||||
|
export default createTheme({
|
||||||
|
theme: 'dark',
|
||||||
|
settings,
|
||||||
|
styles: [
|
||||||
|
{ tag: t.keyword, color: 'white' },
|
||||||
|
{ tag: t.operator, color: 'white' },
|
||||||
|
{ tag: t.special(t.variableName), color: 'white' },
|
||||||
|
{ tag: t.typeName, color: 'white' },
|
||||||
|
{ tag: t.atom, color: 'white' },
|
||||||
|
{ tag: t.number, color: 'white' },
|
||||||
|
{ tag: t.definition(t.variableName), color: 'white' },
|
||||||
|
{ tag: t.string, color: 'white' },
|
||||||
|
{ tag: t.special(t.string), color: 'white' },
|
||||||
|
{ tag: t.comment, color: 'white' },
|
||||||
|
{ tag: t.variableName, color: 'white' },
|
||||||
|
{ tag: t.tagName, color: 'white' },
|
||||||
|
{ tag: t.bracket, color: 'white' },
|
||||||
|
{ tag: t.meta, color: 'white' },
|
||||||
|
{ tag: t.attributeName, color: 'white' },
|
||||||
|
{ tag: t.propertyName, color: 'white' },
|
||||||
|
{ tag: t.className, color: 'white' },
|
||||||
|
{ tag: t.invalid, color: 'white' },
|
||||||
|
{ tag: [t.unit, t.punctuation], color: 'white' },
|
||||||
|
],
|
||||||
|
});
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
import { tags as t } from '@lezer/highlight';
|
||||||
|
import { createTheme } from '@uiw/codemirror-themes';
|
||||||
|
export const settings = {
|
||||||
|
background: '#051DB5',
|
||||||
|
lineBackground: '#051DB550',
|
||||||
|
foreground: 'white', // whats that?
|
||||||
|
caret: 'white',
|
||||||
|
selection: 'rgba(128, 203, 196, 0.5)',
|
||||||
|
selectionMatch: '#036dd626',
|
||||||
|
// lineHighlight: '#8a91991a', // original
|
||||||
|
lineHighlight: '#00000050',
|
||||||
|
gutterBackground: 'transparent',
|
||||||
|
// gutterForeground: '#8a919966',
|
||||||
|
gutterForeground: '#8a919966',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default createTheme({
|
||||||
|
theme: 'dark',
|
||||||
|
settings,
|
||||||
|
styles: [
|
||||||
|
{ tag: t.keyword, color: 'white' },
|
||||||
|
{ tag: t.operator, color: 'white' },
|
||||||
|
{ tag: t.special(t.variableName), color: 'white' },
|
||||||
|
{ tag: t.typeName, color: 'white' },
|
||||||
|
{ tag: t.atom, color: 'white' },
|
||||||
|
{ tag: t.number, color: 'white' },
|
||||||
|
{ tag: t.definition(t.variableName), color: 'white' },
|
||||||
|
{ tag: t.string, color: 'white' },
|
||||||
|
{ tag: t.special(t.string), color: 'white' },
|
||||||
|
{ tag: t.comment, color: 'white' },
|
||||||
|
{ tag: t.variableName, color: 'white' },
|
||||||
|
{ tag: t.tagName, color: 'white' },
|
||||||
|
{ tag: t.bracket, color: 'white' },
|
||||||
|
{ tag: t.meta, color: 'white' },
|
||||||
|
{ tag: t.attributeName, color: 'white' },
|
||||||
|
{ tag: t.propertyName, color: 'white' },
|
||||||
|
{ tag: t.className, color: 'white' },
|
||||||
|
{ tag: t.invalid, color: 'white' },
|
||||||
|
{ tag: [t.unit, t.punctuation], color: 'white' },
|
||||||
|
],
|
||||||
|
});
|
||||||
+1
@@ -40,5 +40,6 @@ export default createTheme({
|
|||||||
|
|
||||||
{ tag: t.className, color: '#decb6b' },
|
{ tag: t.className, color: '#decb6b' },
|
||||||
{ tag: t.invalid, color: '#ffffff' },
|
{ tag: t.invalid, color: '#ffffff' },
|
||||||
|
{ tag: [t.unit, t.punctuation], color: '#82aaff' },
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
import { tags as t } from '@lezer/highlight';
|
||||||
|
import { createTheme } from '@uiw/codemirror-themes';
|
||||||
|
|
||||||
|
let colorA = '#6edee4';
|
||||||
|
//let colorB = 'magenta';
|
||||||
|
let colorB = 'white';
|
||||||
|
let colorC = 'red';
|
||||||
|
let colorD = '#f8fc55';
|
||||||
|
|
||||||
|
export const settings = {
|
||||||
|
background: '#000000',
|
||||||
|
foreground: colorA, // whats that?
|
||||||
|
caret: colorC,
|
||||||
|
selection: colorD,
|
||||||
|
selectionMatch: colorA,
|
||||||
|
lineHighlight: '#6edee440', // panel bg
|
||||||
|
lineBackground: '#00000040',
|
||||||
|
gutterBackground: 'transparent',
|
||||||
|
gutterForeground: '#8a919966',
|
||||||
|
customStyle: '.cm-line { line-height: 1 }',
|
||||||
|
};
|
||||||
|
|
||||||
|
let punctuation = colorD;
|
||||||
|
let mini = colorB;
|
||||||
|
|
||||||
|
export default createTheme({
|
||||||
|
theme: 'dark',
|
||||||
|
settings,
|
||||||
|
styles: [
|
||||||
|
{ tag: t.keyword, color: colorA },
|
||||||
|
{ tag: t.operator, color: mini },
|
||||||
|
{ tag: t.special(t.variableName), color: colorA },
|
||||||
|
{ tag: t.typeName, color: colorA },
|
||||||
|
{ tag: t.atom, color: colorA },
|
||||||
|
{ tag: t.number, color: mini },
|
||||||
|
{ tag: t.definition(t.variableName), color: colorA },
|
||||||
|
{ tag: t.string, color: mini },
|
||||||
|
{ tag: t.special(t.string), color: mini },
|
||||||
|
{ tag: t.comment, color: punctuation },
|
||||||
|
{ tag: t.variableName, color: colorA },
|
||||||
|
{ tag: t.tagName, color: colorA },
|
||||||
|
{ tag: t.bracket, color: punctuation },
|
||||||
|
{ tag: t.meta, color: colorA },
|
||||||
|
{ tag: t.attributeName, color: colorA },
|
||||||
|
{ tag: t.propertyName, color: colorA }, // methods
|
||||||
|
{ tag: t.className, color: colorA },
|
||||||
|
{ tag: t.invalid, color: colorC },
|
||||||
|
{ tag: [t.unit, t.punctuation], color: punctuation },
|
||||||
|
],
|
||||||
|
});
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
import { tags as t } from '@lezer/highlight';
|
||||||
|
import { createTheme } from '@uiw/codemirror-themes';
|
||||||
|
export const settings = {
|
||||||
|
background: 'black',
|
||||||
|
foreground: '#41FF00', // whats that?
|
||||||
|
caret: '#41FF00',
|
||||||
|
selection: '#ffffff20',
|
||||||
|
selectionMatch: '#036dd626',
|
||||||
|
lineHighlight: '#ffffff10',
|
||||||
|
gutterBackground: 'transparent',
|
||||||
|
gutterForeground: '#8a919966',
|
||||||
|
};
|
||||||
|
export default createTheme({
|
||||||
|
theme: 'dark',
|
||||||
|
settings,
|
||||||
|
styles: [
|
||||||
|
{ tag: t.keyword, color: '#41FF00' },
|
||||||
|
{ tag: t.operator, color: '#41FF00' },
|
||||||
|
{ tag: t.special(t.variableName), color: '#41FF00' },
|
||||||
|
{ tag: t.typeName, color: '#41FF00' },
|
||||||
|
{ tag: t.atom, color: '#41FF00' },
|
||||||
|
{ tag: t.number, color: '#41FF00' },
|
||||||
|
{ tag: t.definition(t.variableName), color: '#41FF00' },
|
||||||
|
{ tag: t.string, color: '#41FF00' },
|
||||||
|
{ tag: t.special(t.string), color: '#41FF00' },
|
||||||
|
{ tag: t.comment, color: '#41FF00' },
|
||||||
|
{ tag: t.variableName, color: '#41FF00' },
|
||||||
|
{ tag: t.tagName, color: '#41FF00' },
|
||||||
|
{ tag: t.bracket, color: '#41FF00' },
|
||||||
|
{ tag: t.meta, color: '#41FF00' },
|
||||||
|
{ tag: t.attributeName, color: '#41FF00' },
|
||||||
|
{ tag: t.propertyName, color: '#41FF00' },
|
||||||
|
{ tag: t.className, color: '#41FF00' },
|
||||||
|
{ tag: t.invalid, color: '#41FF00' },
|
||||||
|
],
|
||||||
|
});
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
import { tags as t } from '@lezer/highlight';
|
||||||
|
import { createTheme } from '@uiw/codemirror-themes';
|
||||||
|
export const settings = {
|
||||||
|
background: 'white',
|
||||||
|
foreground: 'black', // whats that?
|
||||||
|
caret: 'black',
|
||||||
|
selection: 'rgba(128, 203, 196, 0.5)',
|
||||||
|
selectionMatch: '#ffffff26',
|
||||||
|
lineHighlight: '#cccccc50',
|
||||||
|
lineBackground: '#ffffff50',
|
||||||
|
gutterBackground: 'transparent',
|
||||||
|
gutterForeground: 'black',
|
||||||
|
light: true,
|
||||||
|
};
|
||||||
|
export default createTheme({
|
||||||
|
theme: 'light',
|
||||||
|
settings,
|
||||||
|
styles: [
|
||||||
|
{ tag: t.keyword, color: 'black' },
|
||||||
|
{ tag: t.operator, color: 'black' },
|
||||||
|
{ tag: t.special(t.variableName), color: 'black' },
|
||||||
|
{ tag: t.typeName, color: 'black' },
|
||||||
|
{ tag: t.atom, color: 'black' },
|
||||||
|
{ tag: t.number, color: 'black' },
|
||||||
|
{ tag: t.definition(t.variableName), color: 'black' },
|
||||||
|
{ tag: t.string, color: 'black' },
|
||||||
|
{ tag: t.special(t.string), color: 'black' },
|
||||||
|
{ tag: t.comment, color: 'black' },
|
||||||
|
{ tag: t.variableName, color: 'black' },
|
||||||
|
{ tag: t.tagName, color: 'black' },
|
||||||
|
{ tag: t.bracket, color: 'black' },
|
||||||
|
{ tag: t.meta, color: 'black' },
|
||||||
|
{ tag: t.attributeName, color: 'black' },
|
||||||
|
{ tag: t.propertyName, color: 'black' },
|
||||||
|
{ tag: t.className, color: 'black' },
|
||||||
|
{ tag: t.invalid, color: 'black' },
|
||||||
|
],
|
||||||
|
});
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import { hoverTooltip } from '@codemirror/view';
|
||||||
|
import jsdoc from '../../doc.json';
|
||||||
|
import { Autocomplete } from './autocomplete.mjs';
|
||||||
|
|
||||||
|
const getDocLabel = (doc) => doc.name || doc.longname;
|
||||||
|
|
||||||
|
let ctrlDown = false;
|
||||||
|
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
// Record Control key event to trigger or block the tooltip depending on the state
|
||||||
|
window.addEventListener(
|
||||||
|
'keyup',
|
||||||
|
function (e) {
|
||||||
|
if (e.key == 'Control') {
|
||||||
|
ctrlDown = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
|
||||||
|
window.addEventListener(
|
||||||
|
'keydown',
|
||||||
|
function (e) {
|
||||||
|
if (e.key == 'Control') {
|
||||||
|
ctrlDown = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const strudelTooltip = hoverTooltip(
|
||||||
|
(view, pos, side) => {
|
||||||
|
// Word selection from CodeMirror Hover Tooltip example https://codemirror.net/examples/tooltip/#hover-tooltips
|
||||||
|
if (!ctrlDown) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
let { from, to, text } = view.state.doc.lineAt(pos);
|
||||||
|
let start = pos,
|
||||||
|
end = pos;
|
||||||
|
while (start > from && /\w/.test(text[start - from - 1])) {
|
||||||
|
start--;
|
||||||
|
}
|
||||||
|
while (end < to && /\w/.test(text[end - from])) {
|
||||||
|
end++;
|
||||||
|
}
|
||||||
|
if ((start == pos && side < 0) || (end == pos && side > 0)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
let word = text.slice(start - from, end - from);
|
||||||
|
// Get entry from Strudel documentation
|
||||||
|
let entry = jsdoc.docs.filter((doc) => getDocLabel(doc) === word)[0];
|
||||||
|
if (!entry) {
|
||||||
|
// Try for synonyms
|
||||||
|
entry = jsdoc.docs.filter((doc) => doc.synonyms && doc.synonyms.includes(word))[0];
|
||||||
|
if (!entry) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
pos: start,
|
||||||
|
end,
|
||||||
|
above: false,
|
||||||
|
arrow: true,
|
||||||
|
create(view) {
|
||||||
|
let dom = document.createElement('div');
|
||||||
|
dom.className = 'strudel-tooltip';
|
||||||
|
const ac = Autocomplete({ doc: entry, label: word });
|
||||||
|
dom.appendChild(ac);
|
||||||
|
return { dom };
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{ hoverTime: 10 },
|
||||||
|
);
|
||||||
|
|
||||||
|
export const isTooltipEnabled = (on) => (on ? strudelTooltip : []);
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import { dependencies } from './package.json';
|
||||||
|
import { resolve } from 'path';
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [],
|
||||||
|
build: {
|
||||||
|
lib: {
|
||||||
|
entry: resolve(__dirname, 'index.mjs'),
|
||||||
|
formats: ['es', 'cjs'],
|
||||||
|
fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext],
|
||||||
|
},
|
||||||
|
rollupOptions: {
|
||||||
|
external: [...Object.keys(dependencies)],
|
||||||
|
},
|
||||||
|
target: 'esnext',
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
# @strudel.cycles/core
|
# @strudel/core
|
||||||
|
|
||||||
This package contains the bare essence of strudel.
|
This package contains the bare essence of strudel.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm i @strudel.cycles/core --save
|
npm i @strudel/core --save
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { sequence } from '@strudel.cycles/core';
|
import { sequence } from '@strudel/core';
|
||||||
|
|
||||||
const pattern = sequence('a', ['b', 'c']);
|
const pattern = sequence('a', ['b', 'c']);
|
||||||
|
|
||||||
@@ -33,6 +33,7 @@ b: 3/2 - 7/4
|
|||||||
c: 7/4 - 2
|
c: 7/4 - 2
|
||||||
```
|
```
|
||||||
|
|
||||||
- [play with @strudel.cycles/core on codesandbox](https://codesandbox.io/s/strudel-core-test-qmz6qr?file=/src/index.js).
|
- [play with @strudel/core on codesandbox](https://codesandbox.io/s/strudel-core-test-forked-9ywhv7?file=/src/index.js).
|
||||||
- [open color pattern example](https://raw.githack.com/tidalcycles/strudel/package-examples/packages/core/examples/canvas.html)
|
- [open color pattern example](https://raw.githack.com/tidalcycles/strudel/main/packages/core/examples/canvas.html)
|
||||||
- [open minimal repl example](https://raw.githack.com/tidalcycles/strudel/package-examples/packages/core/examples/metro.html)
|
- [open minimal repl example](https://raw.githack.com/tidalcycles/strudel/main/packages/core/examples/vanilla.html)
|
||||||
|
- [open minimal vite example](./examples/vite-vanilla-repl/)
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
import { Pattern, getDrawContext, silence, register, pure } from './index.mjs';
|
||||||
|
import controls from './controls.mjs'; // do not import from index.mjs as it breaks for some reason..
|
||||||
|
const { createParams } = controls;
|
||||||
|
|
||||||
|
let clearColor = '#22222210';
|
||||||
|
|
||||||
|
Pattern.prototype.animate = function ({ callback, sync = false, smear = 0.5 } = {}) {
|
||||||
|
window.frame && cancelAnimationFrame(window.frame);
|
||||||
|
const ctx = getDrawContext();
|
||||||
|
const { clientWidth: ww, clientHeight: wh } = ctx.canvas;
|
||||||
|
let smearPart = smear === 0 ? '99' : Number((1 - smear) * 100).toFixed(0);
|
||||||
|
smearPart = smearPart.length === 1 ? `0${smearPart}` : smearPart;
|
||||||
|
clearColor = `#200010${smearPart}`;
|
||||||
|
const render = (t) => {
|
||||||
|
let frame;
|
||||||
|
/* if (sync) {
|
||||||
|
t = scheduler.now();
|
||||||
|
frame = this.queryArc(t, t);
|
||||||
|
} else { */
|
||||||
|
t = Math.round(t);
|
||||||
|
frame = this.slow(1000).queryArc(t, t);
|
||||||
|
// }
|
||||||
|
ctx.fillStyle = clearColor;
|
||||||
|
ctx.fillRect(0, 0, ww, wh);
|
||||||
|
frame.forEach((f) => {
|
||||||
|
let { x, y, w, h, s, r, angle = 0, fill = 'darkseagreen' } = f.value;
|
||||||
|
w *= ww;
|
||||||
|
h *= wh;
|
||||||
|
if (r !== undefined && angle !== undefined) {
|
||||||
|
const radians = angle * 2 * Math.PI;
|
||||||
|
const [cx, cy] = [(ww - w) / 2, (wh - h) / 2];
|
||||||
|
x = cx + Math.cos(radians) * r * cx;
|
||||||
|
y = cy + Math.sin(radians) * r * cy;
|
||||||
|
} else {
|
||||||
|
x *= ww - w;
|
||||||
|
y *= wh - h;
|
||||||
|
}
|
||||||
|
const val = { ...f.value, x, y, w, h };
|
||||||
|
ctx.fillStyle = fill;
|
||||||
|
if (s === 'rect') {
|
||||||
|
ctx.fillRect(x, y, w, h);
|
||||||
|
} else if (s === 'ellipse') {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.ellipse(x + w / 2, y + h / 2, w / 2, h / 2, 0, 0, 2 * Math.PI);
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
|
callback && callback(ctx, val, f);
|
||||||
|
});
|
||||||
|
window.frame = requestAnimationFrame(render);
|
||||||
|
};
|
||||||
|
window.frame = requestAnimationFrame(render);
|
||||||
|
return silence;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const { x, y, w, h, angle, r, fill, smear } = createParams('x', 'y', 'w', 'h', 'angle', 'r', 'fill', 'smear');
|
||||||
|
|
||||||
|
export const rescale = register('rescale', function (f, pat) {
|
||||||
|
return pat.mul(x(f).w(f).y(f).h(f));
|
||||||
|
});
|
||||||
|
|
||||||
|
export const moveXY = register('moveXY', function (dx, dy, pat) {
|
||||||
|
return pat.add(x(dx).y(dy));
|
||||||
|
});
|
||||||
|
|
||||||
|
export const zoomIn = register('zoomIn', function (f, pat) {
|
||||||
|
const d = pure(1).sub(f).div(2);
|
||||||
|
return pat.rescale(f).move(d, d);
|
||||||
|
});
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
export const colorMap = {
|
||||||
|
aliceblue: '#f0f8ff',
|
||||||
|
antiquewhite: '#faebd7',
|
||||||
|
aqua: '#00ffff',
|
||||||
|
aquamarine: '#7fffd4',
|
||||||
|
azure: '#f0ffff',
|
||||||
|
beige: '#f5f5dc',
|
||||||
|
bisque: '#ffe4c4',
|
||||||
|
black: '#000000',
|
||||||
|
blanchedalmond: '#ffebcd',
|
||||||
|
blue: '#0000ff',
|
||||||
|
blueviolet: '#8a2be2',
|
||||||
|
brown: '#a52a2a',
|
||||||
|
burlywood: '#deb887',
|
||||||
|
cadetblue: '#5f9ea0',
|
||||||
|
chartreuse: '#7fff00',
|
||||||
|
chocolate: '#d2691e',
|
||||||
|
coral: '#ff7f50',
|
||||||
|
cornflowerblue: '#6495ed',
|
||||||
|
cornsilk: '#fff8dc',
|
||||||
|
crimson: '#dc143c',
|
||||||
|
cyan: '#00ffff',
|
||||||
|
darkblue: '#00008b',
|
||||||
|
darkcyan: '#008b8b',
|
||||||
|
darkgoldenrod: '#b8860b',
|
||||||
|
darkgray: '#a9a9a9',
|
||||||
|
darkgreen: '#006400',
|
||||||
|
darkgrey: '#a9a9a9',
|
||||||
|
darkkhaki: '#bdb76b',
|
||||||
|
darkmagenta: '#8b008b',
|
||||||
|
darkolivegreen: '#556b2f',
|
||||||
|
darkorange: '#ff8c00',
|
||||||
|
darkorchid: '#9932cc',
|
||||||
|
darkred: '#8b0000',
|
||||||
|
darksalmon: '#e9967a',
|
||||||
|
darkseagreen: '#8fbc8f',
|
||||||
|
darkslateblue: '#483d8b',
|
||||||
|
darkslategray: '#2f4f4f',
|
||||||
|
darkslategrey: '#2f4f4f',
|
||||||
|
darkturquoise: '#00ced1',
|
||||||
|
darkviolet: '#9400d3',
|
||||||
|
deeppink: '#ff1493',
|
||||||
|
deepskyblue: '#00bfff',
|
||||||
|
dimgray: '#696969',
|
||||||
|
dimgrey: '#696969',
|
||||||
|
dodgerblue: '#1e90ff',
|
||||||
|
firebrick: '#b22222',
|
||||||
|
floralwhite: '#fffaf0',
|
||||||
|
forestgreen: '#228b22',
|
||||||
|
fuchsia: '#ff00ff',
|
||||||
|
gainsboro: '#dcdcdc',
|
||||||
|
ghostwhite: '#f8f8ff',
|
||||||
|
gold: '#ffd700',
|
||||||
|
goldenrod: '#daa520',
|
||||||
|
gray: '#808080',
|
||||||
|
green: '#008000',
|
||||||
|
greenyellow: '#adff2f',
|
||||||
|
grey: '#808080',
|
||||||
|
honeydew: '#f0fff0',
|
||||||
|
hotpink: '#ff69b4',
|
||||||
|
indianred: '#cd5c5c',
|
||||||
|
indigo: '#4b0082',
|
||||||
|
ivory: '#fffff0',
|
||||||
|
khaki: '#f0e68c',
|
||||||
|
lavender: '#e6e6fa',
|
||||||
|
lavenderblush: '#fff0f5',
|
||||||
|
lawngreen: '#7cfc00',
|
||||||
|
lemonchiffon: '#fffacd',
|
||||||
|
lightblue: '#add8e6',
|
||||||
|
lightcoral: '#f08080',
|
||||||
|
lightcyan: '#e0ffff',
|
||||||
|
lightgoldenrodyellow: '#fafad2',
|
||||||
|
lightgray: '#d3d3d3',
|
||||||
|
lightgreen: '#90ee90',
|
||||||
|
lightgrey: '#d3d3d3',
|
||||||
|
lightpink: '#ffb6c1',
|
||||||
|
lightsalmon: '#ffa07a',
|
||||||
|
lightseagreen: '#20b2aa',
|
||||||
|
lightskyblue: '#87cefa',
|
||||||
|
lightslategray: '#778899',
|
||||||
|
lightslategrey: '#778899',
|
||||||
|
lightsteelblue: '#b0c4de',
|
||||||
|
lightyellow: '#ffffe0',
|
||||||
|
lime: '#00ff00',
|
||||||
|
limegreen: '#32cd32',
|
||||||
|
linen: '#faf0e6',
|
||||||
|
magenta: '#ff00ff',
|
||||||
|
maroon: '#800000',
|
||||||
|
mediumaquamarine: '#66cdaa',
|
||||||
|
mediumblue: '#0000cd',
|
||||||
|
mediumorchid: '#ba55d3',
|
||||||
|
mediumpurple: '#9370db',
|
||||||
|
mediumseagreen: '#3cb371',
|
||||||
|
mediumslateblue: '#7b68ee',
|
||||||
|
mediumspringgreen: '#00fa9a',
|
||||||
|
mediumturquoise: '#48d1cc',
|
||||||
|
mediumvioletred: '#c71585',
|
||||||
|
midnightblue: '#191970',
|
||||||
|
mintcream: '#f5fffa',
|
||||||
|
mistyrose: '#ffe4e1',
|
||||||
|
moccasin: '#ffe4b5',
|
||||||
|
navajowhite: '#ffdead',
|
||||||
|
navy: '#000080',
|
||||||
|
oldlace: '#fdf5e6',
|
||||||
|
olive: '#808000',
|
||||||
|
olivedrab: '#6b8e23',
|
||||||
|
orange: '#ffa500',
|
||||||
|
orangered: '#ff4500',
|
||||||
|
orchid: '#da70d6',
|
||||||
|
palegoldenrod: '#eee8aa',
|
||||||
|
palegreen: '#98fb98',
|
||||||
|
paleturquoise: '#afeeee',
|
||||||
|
palevioletred: '#db7093',
|
||||||
|
papayawhip: '#ffefd5',
|
||||||
|
peachpuff: '#ffdab9',
|
||||||
|
peru: '#cd853f',
|
||||||
|
pink: '#ffc0cb',
|
||||||
|
plum: '#dda0dd',
|
||||||
|
powderblue: '#b0e0e6',
|
||||||
|
purple: '#800080',
|
||||||
|
red: '#ff0000',
|
||||||
|
rosybrown: '#bc8f8f',
|
||||||
|
royalblue: '#4169e1',
|
||||||
|
saddlebrown: '#8b4513',
|
||||||
|
salmon: '#fa8072',
|
||||||
|
sandybrown: '#f4a460',
|
||||||
|
seagreen: '#2e8b57',
|
||||||
|
seashell: '#fff5ee',
|
||||||
|
sienna: '#a0522d',
|
||||||
|
silver: '#c0c0c0',
|
||||||
|
skyblue: '#87ceeb',
|
||||||
|
slateblue: '#6a5acd',
|
||||||
|
slategray: '#708090',
|
||||||
|
slategrey: '#708090',
|
||||||
|
snow: '#fffafa',
|
||||||
|
springgreen: '#00ff7f',
|
||||||
|
steelblue: '#4682b4',
|
||||||
|
tan: '#d2b48c',
|
||||||
|
teal: '#008080',
|
||||||
|
thistle: '#d8bfd8',
|
||||||
|
tomato: '#ff6347',
|
||||||
|
turquoise: '#40e0d0',
|
||||||
|
violet: '#ee82ee',
|
||||||
|
wheat: '#f5deb3',
|
||||||
|
white: '#ffffff',
|
||||||
|
whitesmoke: '#f5f5f5',
|
||||||
|
yellow: '#ffff00',
|
||||||
|
yellowgreen: '#9acd32',
|
||||||
|
};
|
||||||
|
|
||||||
|
export function convertColorToNumber(color) {
|
||||||
|
// Convert color to lowercase for easier matching
|
||||||
|
color = color.toLowerCase();
|
||||||
|
|
||||||
|
// If the color is a hex code, convert it to a number
|
||||||
|
if (color[0] === '#') {
|
||||||
|
return convertHexToNumber(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the color is a named color, return the corresponding number
|
||||||
|
if (colorMap[color] !== undefined) {
|
||||||
|
return convertHexToNumber(colorMap[color]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the color is not recognized, return null
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function convertHexToNumber(hex) {
|
||||||
|
// Remove the leading '#' from the hex code
|
||||||
|
hex = hex.slice(1);
|
||||||
|
|
||||||
|
// Convert the hex code to a number
|
||||||
|
return parseInt(hex, 16);
|
||||||
|
}
|
||||||
+1067
-370
File diff suppressed because it is too large
Load Diff
+43
-20
@@ -8,52 +8,70 @@ import createClock from './zyklus.mjs';
|
|||||||
import { logger } from './logger.mjs';
|
import { logger } from './logger.mjs';
|
||||||
|
|
||||||
export class Cyclist {
|
export class Cyclist {
|
||||||
worker;
|
|
||||||
pattern;
|
|
||||||
started = false;
|
|
||||||
cps = 1; // TODO
|
|
||||||
getTime;
|
|
||||||
phase = 0;
|
|
||||||
constructor({ interval, onTrigger, onToggle, onError, getTime, latency = 0.1 }) {
|
constructor({ interval, onTrigger, onToggle, onError, getTime, latency = 0.1 }) {
|
||||||
this.getTime = getTime;
|
this.started = false;
|
||||||
|
this.cps = 1;
|
||||||
|
this.num_ticks_since_cps_change = 0;
|
||||||
|
this.lastTick = 0; // absolute time when last tick (clock callback) happened
|
||||||
|
this.lastBegin = 0; // query begin of last tick
|
||||||
|
this.lastEnd = 0; // query end of last tick
|
||||||
|
this.getTime = getTime; // get absolute time
|
||||||
|
this.num_cycles_since_last_cps_change = 0;
|
||||||
this.onToggle = onToggle;
|
this.onToggle = onToggle;
|
||||||
this.latency = latency;
|
this.latency = latency; // fixed trigger time offset
|
||||||
const round = (x) => Math.round(x * 1000) / 1000;
|
|
||||||
this.clock = createClock(
|
this.clock = createClock(
|
||||||
getTime,
|
getTime,
|
||||||
|
// called slightly before each cycle
|
||||||
(phase, duration, tick) => {
|
(phase, duration, tick) => {
|
||||||
if (tick === 0) {
|
if (tick === 0) {
|
||||||
this.origin = phase;
|
this.origin = phase;
|
||||||
}
|
}
|
||||||
const begin = round(phase - this.origin);
|
if (this.num_ticks_since_cps_change === 0) {
|
||||||
this.phase = begin - latency;
|
this.num_cycles_since_last_cps_change = this.lastEnd;
|
||||||
const end = round(begin + duration);
|
}
|
||||||
const time = getTime();
|
this.num_ticks_since_cps_change++;
|
||||||
try {
|
try {
|
||||||
const haps = this.pattern.queryArc(begin, end); // get Haps
|
const time = getTime();
|
||||||
|
const begin = this.lastEnd;
|
||||||
|
this.lastBegin = begin;
|
||||||
|
|
||||||
|
//convert ticks to cycles, so you can query the pattern for events
|
||||||
|
const eventLength = duration * this.cps;
|
||||||
|
const end = this.num_cycles_since_last_cps_change + this.num_ticks_since_cps_change * eventLength;
|
||||||
|
this.lastEnd = end;
|
||||||
|
|
||||||
|
// query the pattern for events
|
||||||
|
const haps = this.pattern.queryArc(begin, end);
|
||||||
|
|
||||||
|
const tickdeadline = phase - time; // time left until the phase is a whole number
|
||||||
|
this.lastTick = time + tickdeadline;
|
||||||
|
|
||||||
haps.forEach((hap) => {
|
haps.forEach((hap) => {
|
||||||
if (hap.part.begin.equals(hap.whole.begin)) {
|
if (hap.part.begin.equals(hap.whole.begin)) {
|
||||||
const deadline = hap.whole.begin + this.origin - time + latency;
|
const deadline = (hap.whole.begin - begin) / this.cps + tickdeadline + latency;
|
||||||
const duration = hap.duration * 1;
|
const duration = hap.duration / this.cps;
|
||||||
onTrigger?.(hap, deadline, duration);
|
onTrigger?.(hap, deadline, duration, this.cps);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger(`[cyclist] error: ${e.message}`);
|
logger(`[cyclist] error: ${e.message}`);
|
||||||
onError?.(e);
|
onError?.(e);
|
||||||
}
|
}
|
||||||
}, // called slightly before each cycle
|
},
|
||||||
interval, // duration of each cycle
|
interval, // duration of each cycle
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
getPhase() {
|
now() {
|
||||||
return this.getTime() - this.origin - this.latency;
|
const secondsSinceLastTick = this.getTime() - this.lastTick - this.clock.duration;
|
||||||
|
return this.lastBegin + secondsSinceLastTick * this.cps; // + this.clock.minLatency;
|
||||||
}
|
}
|
||||||
setStarted(v) {
|
setStarted(v) {
|
||||||
this.started = v;
|
this.started = v;
|
||||||
this.onToggle?.(v);
|
this.onToggle?.(v);
|
||||||
}
|
}
|
||||||
start() {
|
start() {
|
||||||
|
this.num_ticks_since_cps_change = 0;
|
||||||
|
this.num_cycles_since_last_cps_change = 0;
|
||||||
if (!this.pattern) {
|
if (!this.pattern) {
|
||||||
throw new Error('Scheduler: no pattern set! call .setPattern first.');
|
throw new Error('Scheduler: no pattern set! call .setPattern first.');
|
||||||
}
|
}
|
||||||
@@ -69,6 +87,7 @@ export class Cyclist {
|
|||||||
stop() {
|
stop() {
|
||||||
logger('[cyclist] stop');
|
logger('[cyclist] stop');
|
||||||
this.clock.stop();
|
this.clock.stop();
|
||||||
|
this.lastEnd = 0;
|
||||||
this.setStarted(false);
|
this.setStarted(false);
|
||||||
}
|
}
|
||||||
setPattern(pat, autostart = false) {
|
setPattern(pat, autostart = false) {
|
||||||
@@ -78,7 +97,11 @@ export class Cyclist {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setCps(cps = 1) {
|
setCps(cps = 1) {
|
||||||
|
if (this.cps === cps) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.cps = cps;
|
this.cps = cps;
|
||||||
|
this.num_ticks_since_cps_change = 0;
|
||||||
}
|
}
|
||||||
log(begin, end, haps) {
|
log(begin, end, haps) {
|
||||||
const onsets = haps.filter((h) => h.hasOnset());
|
const onsets = haps.filter((h) => h.hasOnset());
|
||||||
|
|||||||
+122
-6
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
draw.mjs - <short description TODO>
|
draw.mjs - <short description TODO>
|
||||||
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/tone/draw.mjs>
|
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/draw.mjs>
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -9,17 +9,29 @@ import { Pattern, getTime, State, TimeSpan } from './index.mjs';
|
|||||||
export const getDrawContext = (id = 'test-canvas') => {
|
export const getDrawContext = (id = 'test-canvas') => {
|
||||||
let canvas = document.querySelector('#' + id);
|
let canvas = document.querySelector('#' + id);
|
||||||
if (!canvas) {
|
if (!canvas) {
|
||||||
|
const scale = 2; // 2 = crisp on retina screens
|
||||||
canvas = document.createElement('canvas');
|
canvas = document.createElement('canvas');
|
||||||
canvas.id = id;
|
canvas.id = id;
|
||||||
canvas.width = window.innerWidth;
|
canvas.width = window.innerWidth * scale;
|
||||||
canvas.height = window.innerHeight;
|
canvas.height = window.innerHeight * scale;
|
||||||
canvas.style = 'pointer-events:none;width:100%;height:100%;position:fixed;top:0;left:0;z-index:5';
|
canvas.style = 'pointer-events:none;width:100%;height:100%;position:fixed;top:0;left:0';
|
||||||
document.body.prepend(canvas);
|
document.body.prepend(canvas);
|
||||||
|
let timeout;
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
timeout && clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
canvas.width = window.innerWidth * scale;
|
||||||
|
canvas.height = window.innerHeight * scale;
|
||||||
|
}, 200);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return canvas.getContext('2d');
|
return canvas.getContext('2d');
|
||||||
};
|
};
|
||||||
|
|
||||||
Pattern.prototype.draw = function (callback, { from, to, onQuery }) {
|
Pattern.prototype.draw = function (callback, { from, to, onQuery } = {}) {
|
||||||
|
if (typeof window === 'undefined') {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
if (window.strudelAnimation) {
|
if (window.strudelAnimation) {
|
||||||
cancelAnimationFrame(window.strudelAnimation);
|
cancelAnimationFrame(window.strudelAnimation);
|
||||||
}
|
}
|
||||||
@@ -51,7 +63,7 @@ Pattern.prototype.draw = function (callback, { from, to, onQuery }) {
|
|||||||
|
|
||||||
export const cleanupDraw = (clearScreen = true) => {
|
export const cleanupDraw = (clearScreen = true) => {
|
||||||
const ctx = getDrawContext();
|
const ctx = getDrawContext();
|
||||||
clearScreen && ctx.clearRect(0, 0, window.innerWidth, window.innerHeight);
|
clearScreen && ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.width);
|
||||||
if (window.strudelAnimation) {
|
if (window.strudelAnimation) {
|
||||||
cancelAnimationFrame(window.strudelAnimation);
|
cancelAnimationFrame(window.strudelAnimation);
|
||||||
}
|
}
|
||||||
@@ -59,3 +71,107 @@ export const cleanupDraw = (clearScreen = true) => {
|
|||||||
clearInterval(window.strudelScheduler);
|
clearInterval(window.strudelScheduler);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Pattern.prototype.onPaint = function (onPaint) {
|
||||||
|
// this is evil! TODO: add pattern.context
|
||||||
|
this.context = { onPaint };
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// const round = (x) => Math.round(x * 1000) / 1000;
|
||||||
|
|
||||||
|
// encapsulates starting and stopping animation frames
|
||||||
|
export class Framer {
|
||||||
|
constructor(onFrame, onError) {
|
||||||
|
this.onFrame = onFrame;
|
||||||
|
this.onError = onError;
|
||||||
|
}
|
||||||
|
start() {
|
||||||
|
const self = this;
|
||||||
|
let frame = requestAnimationFrame(function updateHighlights(time) {
|
||||||
|
try {
|
||||||
|
self.onFrame(time);
|
||||||
|
} catch (err) {
|
||||||
|
self.onError(err);
|
||||||
|
}
|
||||||
|
frame = requestAnimationFrame(updateHighlights);
|
||||||
|
});
|
||||||
|
self.cancel = () => {
|
||||||
|
cancelAnimationFrame(frame);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
stop() {
|
||||||
|
if (this.cancel) {
|
||||||
|
this.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// syncs animation frames to a cyclist scheduler
|
||||||
|
// see vite-vanilla-repl-cm6 for an example
|
||||||
|
export class Drawer {
|
||||||
|
constructor(onDraw, drawTime) {
|
||||||
|
this.visibleHaps = [];
|
||||||
|
this.lastFrame = null;
|
||||||
|
this.drawTime = drawTime;
|
||||||
|
this.framer = new Framer(
|
||||||
|
() => {
|
||||||
|
if (!this.scheduler) {
|
||||||
|
console.warn('Drawer: no scheduler');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const lookbehind = Math.abs(this.drawTime[0]);
|
||||||
|
const lookahead = this.drawTime[1];
|
||||||
|
// calculate current frame time (think right side of screen for pianoroll)
|
||||||
|
const phase = this.scheduler.now() + lookahead;
|
||||||
|
// first frame just captures the phase
|
||||||
|
if (this.lastFrame === null) {
|
||||||
|
this.lastFrame = phase;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// query haps from last frame till now. take last 100ms max
|
||||||
|
const haps = this.scheduler.pattern.queryArc(Math.max(this.lastFrame, phase - 1 / 10), phase);
|
||||||
|
this.lastFrame = phase;
|
||||||
|
this.visibleHaps = (this.visibleHaps || [])
|
||||||
|
// filter out haps that are too far in the past (think left edge of screen for pianoroll)
|
||||||
|
.filter((h) => h.whole.end >= phase - lookbehind - lookahead)
|
||||||
|
// add new haps with onset (think right edge bars scrolling in)
|
||||||
|
.concat(haps.filter((h) => h.hasOnset()));
|
||||||
|
const time = phase - lookahead;
|
||||||
|
onDraw(this.visibleHaps, time, this);
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.warn('draw error', err);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
setDrawTime(drawTime) {
|
||||||
|
this.drawTime = drawTime;
|
||||||
|
}
|
||||||
|
invalidate(scheduler = this.scheduler, t) {
|
||||||
|
if (!scheduler) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// TODO: scheduler.now() seems to move even when it's stopped, this hints at a bug...
|
||||||
|
t = t ?? scheduler.now();
|
||||||
|
this.scheduler = scheduler;
|
||||||
|
let [_, lookahead] = this.drawTime;
|
||||||
|
const [begin, end] = [Math.max(t, 0), t + lookahead + 0.1];
|
||||||
|
// remove all future haps
|
||||||
|
this.visibleHaps = this.visibleHaps.filter((h) => h.whole.begin < t);
|
||||||
|
// query future haps
|
||||||
|
const futureHaps = scheduler.pattern.queryArc(begin, end); // +0.1 = workaround for weird holes in query..
|
||||||
|
// append future haps
|
||||||
|
this.visibleHaps = this.visibleHaps.concat(futureHaps);
|
||||||
|
}
|
||||||
|
start(scheduler) {
|
||||||
|
this.scheduler = scheduler;
|
||||||
|
this.invalidate();
|
||||||
|
this.framer.start();
|
||||||
|
}
|
||||||
|
stop() {
|
||||||
|
if (this.framer) {
|
||||||
|
this.framer.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+110
-29
@@ -1,47 +1,91 @@
|
|||||||
/*
|
/*
|
||||||
euclid.mjs - <short description TODO>
|
euclid.mjs - Bjorklund/Euclidean/Diaspora rhythms
|
||||||
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/euclid.mjs>
|
Copyright (C) 2023 Rohan Drape and strudel contributors
|
||||||
|
|
||||||
|
See <https://github.com/tidalcycles/strudel/blob/main/packages/core/euclid.mjs> for authors of this file.
|
||||||
|
|
||||||
|
The Bjorklund algorithm implementation is ported from the Haskell Music Theory Haskell module by Rohan Drape -
|
||||||
|
https://rohandrape.net/?t=hmt
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Pattern, timeCat } from './pattern.mjs';
|
import { Pattern, timeCat, register, silence } from './pattern.mjs';
|
||||||
import bjork from 'bjork';
|
import { rotate, flatten, splitAt, zipWith } from './util.mjs';
|
||||||
import { rotate } from './util.mjs';
|
|
||||||
import Fraction from './fraction.mjs';
|
import Fraction from './fraction.mjs';
|
||||||
|
|
||||||
const euclid = (pulses, steps, rotation = 0) => {
|
const left = function (n, x) {
|
||||||
const b = bjork(steps, pulses);
|
const [ons, offs] = n;
|
||||||
if (rotation) {
|
const [xs, ys] = x;
|
||||||
return rotate(b, -rotation);
|
const [_xs, __xs] = splitAt(offs, xs);
|
||||||
}
|
return [
|
||||||
return b;
|
[offs, ons - offs],
|
||||||
|
[zipWith((a, b) => a.concat(b), _xs, ys), __xs],
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
const right = function (n, x) {
|
||||||
|
const [ons, offs] = n;
|
||||||
|
const [xs, ys] = x;
|
||||||
|
const [_ys, __ys] = splitAt(ons, ys);
|
||||||
|
const result = [
|
||||||
|
[ons, offs - ons],
|
||||||
|
[zipWith((a, b) => a.concat(b), xs, _ys), __ys],
|
||||||
|
];
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
const _bjork = function (n, x) {
|
||||||
|
const [ons, offs] = n;
|
||||||
|
return Math.min(ons, offs) <= 1 ? [n, x] : _bjork(...(ons > offs ? left(n, x) : right(n, x)));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const bjork = function (ons, steps) {
|
||||||
|
const offs = steps - ons;
|
||||||
|
const x = Array(ons).fill([1]);
|
||||||
|
const y = Array(offs).fill([0]);
|
||||||
|
const result = _bjork([ons, offs], [x, y]);
|
||||||
|
return flatten(result[1][0]).concat(flatten(result[1][1]));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the structure of the pattern to form an euclidean rhythm.
|
* Changes the structure of the pattern to form an euclidean rhythm.
|
||||||
* Euclidian rhythms are rhythms obtained using the greatest common divisor of two numbers.
|
* Euclidian rhythms are rhythms obtained using the greatest common
|
||||||
* They were described in 2004 by Godfried Toussaint, a canadian computer scientist.
|
* divisor of two numbers. They were described in 2004 by Godfried
|
||||||
* Euclidian rhythms are really useful for computer/algorithmic music because they can accurately
|
* Toussaint, a canadian computer scientist. Euclidian rhythms are
|
||||||
* describe a large number of rhythms used in the most important music world traditions.
|
* really useful for computer/algorithmic music because they can
|
||||||
|
* describe a large number of rhythms with a couple of numbers.
|
||||||
*
|
*
|
||||||
* @memberof Pattern
|
* @memberof Pattern
|
||||||
* @name euclid
|
* @name euclid
|
||||||
* @param {number} pulses the number of onsets / beats
|
* @param {number} pulses the number of onsets / beats
|
||||||
* @param {number} steps the number of steps to fill
|
* @param {number} steps the number of steps to fill
|
||||||
* @param {number} rotation (optional) offset in steps
|
|
||||||
* @returns Pattern
|
* @returns Pattern
|
||||||
* @example
|
* @example
|
||||||
* // The Cuban tresillo pattern.
|
* // The Cuban tresillo pattern.
|
||||||
* note("c3").euclid(3,8)
|
* note("c3").euclid(3,8)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like `euclid`, but has an additional parameter for 'rotating' the resulting sequence.
|
||||||
|
* @memberof Pattern
|
||||||
|
* @name euclidRot
|
||||||
|
* @param {number} pulses the number of onsets / beats
|
||||||
|
* @param {number} steps the number of steps to fill
|
||||||
|
* @param {number} rotation offset in steps
|
||||||
|
* @returns Pattern
|
||||||
|
* @example
|
||||||
|
* // A Samba rhythm necklace from Brazil
|
||||||
|
* note("c3").euclidRot(3,16,14)
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @example // A thirteenth century Persian rhythm called Khafif-e-ramal.
|
* @example // A thirteenth century Persian rhythm called Khafif-e-ramal.
|
||||||
* note("c3").euclid(2,5)
|
* note("c3").euclid(2,5)
|
||||||
* @example // The archetypal pattern of the Cumbia from Colombia, as well as a Calypso rhythm from Trinidad.
|
* @example // The archetypal pattern of the Cumbia from Colombia, as well as a Calypso rhythm from Trinidad.
|
||||||
* note("c3").euclid(3,4)
|
* note("c3").euclid(3,4)
|
||||||
* @example // Another thirteenth century Persian rhythm by the name of Khafif-e-ramal, as well as a Rumanian folk-dance rhythm.
|
* @example // Another thirteenth century Persian rhythm by the name of Khafif-e-ramal, as well as a Rumanian folk-dance rhythm.
|
||||||
* note("c3").euclid(3,5,2)
|
* note("c3").euclidRot(3,5,2)
|
||||||
* @example // A Ruchenitza rhythm used in a Bulgarian folk-dance.
|
* @example // A Ruchenitza rhythm used in a Bulgarian folk-dance.
|
||||||
* note("c3").euclid(3,7)
|
* note("c3").euclid(3,7)
|
||||||
* @example // The Cuban tresillo pattern.
|
* @example // The Cuban tresillo pattern.
|
||||||
@@ -71,34 +115,71 @@ const euclid = (pulses, steps, rotation = 0) => {
|
|||||||
* @example // A common West African bell pattern.
|
* @example // A common West African bell pattern.
|
||||||
* note("c3").euclid(7,12)
|
* note("c3").euclid(7,12)
|
||||||
* @example // A Samba rhythm necklace from Brazil.
|
* @example // A Samba rhythm necklace from Brazil.
|
||||||
* note("c3").euclid(7,16,14)
|
* note("c3").euclidRot(7,16,14)
|
||||||
* @example // A rhythm necklace used in the Central African Republic.
|
* @example // A rhythm necklace used in the Central African Republic.
|
||||||
* note("c3").euclid(9,16)
|
* note("c3").euclid(9,16)
|
||||||
* @example // A rhythm necklace of the Aka Pygmies of Central Africa.
|
* @example // A rhythm necklace of the Aka Pygmies of Central Africa.
|
||||||
* note("c3").euclid(11,24,14)
|
* note("c3").euclidRot(11,24,14)
|
||||||
* @example // Another rhythm necklace of the Aka Pygmies of the upper Sangha.
|
* @example // Another rhythm necklace of the Aka Pygmies of the upper Sangha.
|
||||||
* note("c3").euclid(13,24,5)
|
* note("c3").euclidRot(13,24,5)
|
||||||
*/
|
*/
|
||||||
Pattern.prototype.euclid = function (pulses, steps, rotation = 0) {
|
|
||||||
return this.struct(euclid(pulses, steps, rotation));
|
const _euclidRot = function (pulses, steps, rotation) {
|
||||||
|
const b = bjork(pulses, steps);
|
||||||
|
if (rotation) {
|
||||||
|
return rotate(b, -rotation);
|
||||||
|
}
|
||||||
|
return b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const euclid = register('euclid', function (pulses, steps, pat) {
|
||||||
|
return pat.struct(_euclidRot(pulses, steps, 0));
|
||||||
|
});
|
||||||
|
|
||||||
|
export const { euclidrot, euclidRot } = register(['euclidrot', 'euclidRot'], function (pulses, steps, rotation, pat) {
|
||||||
|
return pat.struct(_euclidRot(pulses, steps, rotation));
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to `.euclid`, but each pulse is held until the next pulse, so there will be no gaps.
|
* Similar to `euclid`, but each pulse is held until the next pulse,
|
||||||
|
* so there will be no gaps.
|
||||||
* @name euclidLegato
|
* @name euclidLegato
|
||||||
* @memberof Pattern
|
* @memberof Pattern
|
||||||
|
* @param {number} pulses the number of onsets / beats
|
||||||
|
* @param {number} steps the number of steps to fill
|
||||||
* @example
|
* @example
|
||||||
* n("g2").decay(.1).sustain(.3).euclidLegato(3,8)
|
* n("g2").decay(.1).sustain(.3).euclidLegato(3,8)
|
||||||
*/
|
*/
|
||||||
Pattern.prototype.euclidLegato = function (pulses, steps, rotation = 0) {
|
|
||||||
const bin_pat = euclid(pulses, steps, rotation);
|
const _euclidLegato = function (pulses, steps, rotation, pat) {
|
||||||
const firstOne = bin_pat.indexOf(1);
|
if (pulses < 1) {
|
||||||
const gapless = rotate(bin_pat, firstOne)
|
return silence;
|
||||||
|
}
|
||||||
|
const bin_pat = _euclidRot(pulses, steps, rotation);
|
||||||
|
const gapless = bin_pat
|
||||||
.join('')
|
.join('')
|
||||||
.split('1')
|
.split('1')
|
||||||
.slice(1)
|
.slice(1)
|
||||||
.map((s) => [s.length + 1, true]);
|
.map((s) => [s.length + 1, true]);
|
||||||
return this.struct(timeCat(...gapless)).late(Fraction(firstOne).div(steps));
|
return pat.struct(timeCat(...gapless));
|
||||||
};
|
};
|
||||||
|
|
||||||
export default euclid;
|
export const euclidLegato = register(['euclidLegato'], function (pulses, steps, pat) {
|
||||||
|
return _euclidLegato(pulses, steps, 0, pat);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Similar to `euclid`, but each pulse is held until the next pulse,
|
||||||
|
* so there will be no gaps, and has an additional parameter for 'rotating'
|
||||||
|
* the resulting sequence
|
||||||
|
* @name euclidLegatoRot
|
||||||
|
* @memberof Pattern
|
||||||
|
* @param {number} pulses the number of onsets / beats
|
||||||
|
* @param {number} steps the number of steps to fill
|
||||||
|
* @param {number} rotation offset in steps
|
||||||
|
* @example
|
||||||
|
* note("c3").euclidLegatoRot(3,5,2)
|
||||||
|
*/
|
||||||
|
export const euclidLegatoRot = register(['euclidLegatoRot'], function (pulses, steps, rotation, pat) {
|
||||||
|
return _euclidLegato(pulses, steps, rotation, pat);
|
||||||
|
});
|
||||||
|
|||||||
+15
-17
@@ -1,17 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
evaluate.mjs - <short description TODO>
|
evaluate.mjs - <short description TODO>
|
||||||
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/eval/evaluate.mjs>
|
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/evaluate.mjs>
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { isPattern } from './index.mjs';
|
import { isPattern } from './index.mjs';
|
||||||
|
|
||||||
let scoped = false;
|
|
||||||
export const evalScope = async (...args) => {
|
export const evalScope = async (...args) => {
|
||||||
if (scoped) {
|
|
||||||
console.warn('evalScope was called more than once.');
|
|
||||||
}
|
|
||||||
scoped = true;
|
|
||||||
const results = await Promise.allSettled(args);
|
const results = await Promise.allSettled(args);
|
||||||
const modules = results.filter((result) => result.status === 'fulfilled').map((r) => r.value);
|
const modules = results.filter((result) => result.status === 'fulfilled').map((r) => r.value);
|
||||||
results.forEach((result, i) => {
|
results.forEach((result, i) => {
|
||||||
@@ -19,7 +14,14 @@ export const evalScope = async (...args) => {
|
|||||||
console.warn(`evalScope: module with index ${i} could not be loaded:`, result.reason);
|
console.warn(`evalScope: module with index ${i} could not be loaded:`, result.reason);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Object.assign(globalThis, ...modules);
|
// Object.assign(globalThis, ...modules);
|
||||||
|
// below is a fix for above commented out line
|
||||||
|
// same error as https://github.com/vitest-dev/vitest/issues/1807 when running this on astro server
|
||||||
|
modules.forEach((module) => {
|
||||||
|
Object.entries(module).forEach(([name, value]) => {
|
||||||
|
globalThis[name] = value;
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function safeEval(str, options = {}) {
|
function safeEval(str, options = {}) {
|
||||||
@@ -35,19 +37,15 @@ function safeEval(str, options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const evaluate = async (code, transpiler) => {
|
export const evaluate = async (code, transpiler) => {
|
||||||
if (!scoped) {
|
let meta = {};
|
||||||
await evalScope(); // at least scope Pattern.prototype.boostrap
|
|
||||||
}
|
|
||||||
if (transpiler) {
|
if (transpiler) {
|
||||||
code = transpiler(code); // transform syntactically correct js code to semantically usable code
|
// transform syntactically correct js code to semantically usable code
|
||||||
|
const transpiled = transpiler(code);
|
||||||
|
code = transpiled.output;
|
||||||
|
meta = transpiled;
|
||||||
}
|
}
|
||||||
// if no transpiler is given, we expect a single instruction (!wrapExpression)
|
// if no transpiler is given, we expect a single instruction (!wrapExpression)
|
||||||
const options = { wrapExpression: !!transpiler };
|
const options = { wrapExpression: !!transpiler };
|
||||||
let evaluated = await safeEval(code, options);
|
let evaluated = await safeEval(code, options);
|
||||||
if (!isPattern(evaluated)) {
|
return { mode: 'javascript', pattern: evaluated, meta };
|
||||||
console.log('evaluated', evaluated);
|
|
||||||
const message = `got "${typeof evaluated}" instead of pattern`;
|
|
||||||
throw new Error(message + (typeof evaluated === 'function' ? ', did you forget to call a function?' : '.'));
|
|
||||||
}
|
|
||||||
return { mode: 'javascript', pattern: evaluated };
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
<div style="position: absolute; bottom: 0; right: 0; padding: 4px; width: 100vw; display: flex">
|
|
||||||
<button id="start" style="font-size: 2em">start</button>
|
|
||||||
<button id="stop" style="font-size: 2em">stop</button>
|
|
||||||
<button id="slower" style="font-size: 2em">slower</button>
|
|
||||||
<button id="faster" style="font-size: 2em">faster</button>
|
|
||||||
</div>
|
|
||||||
<textarea
|
|
||||||
style="font-size: 2em; background: #052b49; color: #fff; height: 100%; width: 100%; outline: none; border: 0"
|
|
||||||
id="text"
|
|
||||||
spellcheck="false"
|
|
||||||
>
|
|
||||||
Loading...</textarea
|
|
||||||
>
|
|
||||||
<script type="module">
|
|
||||||
document.body.style = 'margin: 0';
|
|
||||||
import * as strudel from '@strudel.cycles/core';
|
|
||||||
|
|
||||||
const { cat, State, TimeSpan, Scheduler, getPlayableNoteValue, getFreq } = strudel;
|
|
||||||
Object.assign(window, strudel); // add strudel to eval scope
|
|
||||||
|
|
||||||
const ctx = new AudioContext();
|
|
||||||
const scheduler = new Scheduler({
|
|
||||||
// audioContext: getAudioContext(),
|
|
||||||
interval: 0.1,
|
|
||||||
onTrigger: (hap, time, duration) => {
|
|
||||||
const freq = getFrequency(hap);
|
|
||||||
const osc = ctx.createOscillator();
|
|
||||||
const gain = 0.2;
|
|
||||||
osc.frequency.value = freq;
|
|
||||||
osc.type = 'triangle';
|
|
||||||
const onset = ctx.currentTime + time;
|
|
||||||
const offset = onset + duration;
|
|
||||||
const attack = 0.05;
|
|
||||||
const release = 0.05;
|
|
||||||
osc.start(onset);
|
|
||||||
osc.stop(offset + release);
|
|
||||||
|
|
||||||
const g = ctx.createGain();
|
|
||||||
g.gain.setValueAtTime(gain, onset);
|
|
||||||
g.gain.linearRampToValueAtTime(gain, onset + attack);
|
|
||||||
g.gain.setValueAtTime(gain, offset - release);
|
|
||||||
g.gain.linearRampToValueAtTime(0, offset);
|
|
||||||
osc.connect(g);
|
|
||||||
g.connect(ctx.destination);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
let initialCode = `stack('c4','e4',cat('g4','a4','b4','a4'))
|
|
||||||
.add(cat(0,1,2,3,4,3,2,1).slow(8))
|
|
||||||
.fast(2)
|
|
||||||
.cps(tri.range(1,8).slow(32))`;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const base64 = decodeURIComponent(window.location.href.split('#')[1]);
|
|
||||||
initialCode = atob(base64);
|
|
||||||
} catch (err) {
|
|
||||||
console.warn('failed to decode', err);
|
|
||||||
}
|
|
||||||
const input = document.getElementById('text');
|
|
||||||
input.value = initialCode;
|
|
||||||
const evaluate = () => {
|
|
||||||
try {
|
|
||||||
const pattern = eval(input.value);
|
|
||||||
scheduler.setPattern(pattern);
|
|
||||||
window.location.hash = '#' + encodeURIComponent(btoa(input.value)); // update url hash
|
|
||||||
} catch (err) {
|
|
||||||
console.warn(err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
evaluate();
|
|
||||||
input.addEventListener('input', () => evaluate());
|
|
||||||
document.getElementById('start').addEventListener('click', async () => {
|
|
||||||
await ctx.resume();
|
|
||||||
scheduler.start();
|
|
||||||
});
|
|
||||||
document.getElementById('stop').addEventListener('click', () => scheduler.stop());
|
|
||||||
document.getElementById('slower').addEventListener('click', () => scheduler.setCps(scheduler.cps - 0.1));
|
|
||||||
document.getElementById('faster').addEventListener('click', () => scheduler.setCps(scheduler.cps + 0.1));
|
|
||||||
</script>
|
|
||||||
<!--
|
|
||||||
sequence(1,2).mul(55/2) // frequencies
|
|
||||||
.mul(slowcat(1,2))
|
|
||||||
.mul(slowcat(1,3/2,4/3,5/3).slow(8))
|
|
||||||
.fast(3)
|
|
||||||
.freq()
|
|
||||||
.velocity(.5)
|
|
||||||
.s('sawtooth')
|
|
||||||
.cutoff(800)
|
|
||||||
.out()
|
|
||||||
-->
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="text"
|
|
||||||
value="seq('c3','eb3','g3').note().s('sawtooth').out()"
|
|
||||||
style="width: 100%; font-size: 2em; outline: none; margin-bottom: 10px"
|
|
||||||
spellcheck="false"
|
|
||||||
/>
|
|
||||||
<button id="start">play</button>
|
|
||||||
<div id="output"></div>
|
|
||||||
<script type="module">
|
|
||||||
const strudel = await import('https://cdn.skypack.dev/@strudel.cycles/core@latest');
|
|
||||||
|
|
||||||
const controls = await import('https://cdn.skypack.dev/@strudel.cycles/core@latest/controls.mjs');
|
|
||||||
const { getAudioContext, Scheduler } = await import('https://cdn.skypack.dev/@strudel.cycles/webaudio@latest');
|
|
||||||
let scheduler;
|
|
||||||
|
|
||||||
const audioContext = getAudioContext();
|
|
||||||
const latency = 0.2;
|
|
||||||
|
|
||||||
Object.assign(window, strudel);
|
|
||||||
Object.assign(window, controls.default);
|
|
||||||
scheduler = new Scheduler({
|
|
||||||
audioContext,
|
|
||||||
interval: 0.1,
|
|
||||||
latency,
|
|
||||||
onEvent: (hap) => {
|
|
||||||
if (!hap.context.onTrigger) {
|
|
||||||
console.warn('no output chosen. use one of .out() .webdirt() .osc()');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
let started;
|
|
||||||
document.getElementById('start').addEventListener('click', async () => {
|
|
||||||
const code = document.getElementById('text').value;
|
|
||||||
const pattern = eval(code);
|
|
||||||
const events = pattern._firstCycleValues;
|
|
||||||
console.log(code, '->', events);
|
|
||||||
scheduler.setPattern(pattern);
|
|
||||||
if (!started) {
|
|
||||||
scheduler.start();
|
|
||||||
started = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
!dist
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# vite-vanilla-repl
|
|
||||||
|
|
||||||
This folder demonstrates how to set up a strudel repl using vite and vanilla JS. Run it using:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm i
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
or view it [live on githack](https://rawcdn.githack.com/tidalcycles/strudel/5fb36acb046ead7cd6ad3cd10f532e7f585f536a/packages/core/examples/vite-vanilla-repl/dist/index.html)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
import{b as s,h as i,m,a as n,c as p,p as t}from"./index.4cbc0a10.js";export{s as SyntaxError,i as h,m as mini,n as minify,p as parse,t as patternifyAST};
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
|||||||
import{g as s,f as d,i as t,n as r,l as u,j as o,d as f,k as p,r as g,s as i,w as l,e as m}from"./index.4cbc0a10.js";export{s as getAudioContext,d as getCachedBuffer,t as getLoadedBuffer,r as getLoadedSamples,u as loadBuffer,o as loadGithubSamples,f as panic,p as resetLoadedSamples,g as reverseBuffer,i as samples,l as webaudioOutput,m as webaudioOutputTrigger};
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Vite Vanilla Strudel REPL</title>
|
|
||||||
<script type="module" crossorigin src="/tidalcycles/strudel/use-acorn/packages/core/examples/vite-vanilla-repl/dist/assets/index.4cbc0a10.js"></script>
|
|
||||||
</head>
|
|
||||||
<body style="margin: 0; background: #222">
|
|
||||||
<div style="display: grid; height: 100vh">
|
|
||||||
<textarea
|
|
||||||
id="text"
|
|
||||||
style="font-size: 2em; border: 0; color: white; background: transparent; outline: none; padding: 20px"
|
|
||||||
spellcheck="false"
|
|
||||||
></textarea>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
id="start"
|
|
||||||
style="
|
|
||||||
position: absolute;
|
|
||||||
border-radius: 10px;
|
|
||||||
top: 20px;
|
|
||||||
right: 20px;
|
|
||||||
padding: 20px;
|
|
||||||
border: 2px solid white;
|
|
||||||
background: transparent;
|
|
||||||
color: white;
|
|
||||||
cursor: pointer;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
evaluate
|
|
||||||
</button>
|
|
||||||
<div id="output"></div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import { controls, repl, evalScope, setStringParser } from '@strudel.cycles/core';
|
|
||||||
import { mini } from '@strudel.cycles/mini';
|
|
||||||
import { getAudioContext, webaudioOutput } from '@strudel.cycles/webaudio';
|
|
||||||
// import { transpiler } from '@strudel.cycles/transpiler';
|
|
||||||
import tune from './tune.mjs';
|
|
||||||
|
|
||||||
const ctx = getAudioContext();
|
|
||||||
const input = document.getElementById('text');
|
|
||||||
input.innerHTML = tune;
|
|
||||||
|
|
||||||
evalScope(
|
|
||||||
controls,
|
|
||||||
import('@strudel.cycles/core'),
|
|
||||||
import('@strudel.cycles/mini'),
|
|
||||||
import('@strudel.cycles/webaudio'),
|
|
||||||
import('@strudel.cycles/tonal'),
|
|
||||||
);
|
|
||||||
|
|
||||||
setStringParser(mini);
|
|
||||||
|
|
||||||
const { evaluate } = repl({
|
|
||||||
defaultOutput: webaudioOutput,
|
|
||||||
getTime: () => ctx.currentTime,
|
|
||||||
// transpiler,
|
|
||||||
});
|
|
||||||
document.getElementById('start').addEventListener('click', () => {
|
|
||||||
ctx.resume();
|
|
||||||
evaluate(input.value);
|
|
||||||
});
|
|
||||||
@@ -1,885 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "vite-vanilla-repl",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"lockfileVersion": 2,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"name": "vite-vanilla-repl",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"devDependencies": {
|
|
||||||
"vite": "^3.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@esbuild/android-arm": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-RY2fVI8O0iFUNvZirXaQ1vMvK0xhCcl0gqRj74Z6yEiO1zAUa7hbsdwZM1kzqbxHK7LFyMizipfXT3JME+12Hw==",
|
|
||||||
"cpu": [
|
|
||||||
"arm"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"android"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@esbuild/linux-loong64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-+BoyIm4I8uJmH/QDIH0fu7MG0AEx9OXEDXnqptXCwKOlOqZiS4iraH1Nr7/ObLMokW3sOCeBNyD68ATcV9b9Ag==",
|
|
||||||
"cpu": [
|
|
||||||
"loong64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-Cu3SC84oyzzhrK/YyN4iEVy2jZu5t2fz66HEOShHURcjSkOSAVL8C/gfUT+lDJxkVHpg8GZ10DD0rMHRPqMFaQ==",
|
|
||||||
"dev": true,
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"bin": {
|
|
||||||
"esbuild": "bin/esbuild"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
},
|
|
||||||
"optionalDependencies": {
|
|
||||||
"@esbuild/android-arm": "0.15.13",
|
|
||||||
"@esbuild/linux-loong64": "0.15.13",
|
|
||||||
"esbuild-android-64": "0.15.13",
|
|
||||||
"esbuild-android-arm64": "0.15.13",
|
|
||||||
"esbuild-darwin-64": "0.15.13",
|
|
||||||
"esbuild-darwin-arm64": "0.15.13",
|
|
||||||
"esbuild-freebsd-64": "0.15.13",
|
|
||||||
"esbuild-freebsd-arm64": "0.15.13",
|
|
||||||
"esbuild-linux-32": "0.15.13",
|
|
||||||
"esbuild-linux-64": "0.15.13",
|
|
||||||
"esbuild-linux-arm": "0.15.13",
|
|
||||||
"esbuild-linux-arm64": "0.15.13",
|
|
||||||
"esbuild-linux-mips64le": "0.15.13",
|
|
||||||
"esbuild-linux-ppc64le": "0.15.13",
|
|
||||||
"esbuild-linux-riscv64": "0.15.13",
|
|
||||||
"esbuild-linux-s390x": "0.15.13",
|
|
||||||
"esbuild-netbsd-64": "0.15.13",
|
|
||||||
"esbuild-openbsd-64": "0.15.13",
|
|
||||||
"esbuild-sunos-64": "0.15.13",
|
|
||||||
"esbuild-windows-32": "0.15.13",
|
|
||||||
"esbuild-windows-64": "0.15.13",
|
|
||||||
"esbuild-windows-arm64": "0.15.13"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-android-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-yRorukXBlokwTip+Sy4MYskLhJsO0Kn0/Fj43s1krVblfwP+hMD37a4Wmg139GEsMLl+vh8WXp2mq/cTA9J97g==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"android"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-android-arm64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-TKzyymLD6PiVeyYa4c5wdPw87BeAiTXNtK6amWUcXZxkV51gOk5u5qzmDaYSwiWeecSNHamFsaFjLoi32QR5/w==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"android"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-darwin-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-WAx7c2DaOS6CrRcoYCgXgkXDliLnFv3pQLV6GeW1YcGEZq2Gnl8s9Pg7ahValZkpOa0iE/ojRVQ87sbUhF1Cbg==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-darwin-arm64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-U6jFsPfSSxC3V1CLiQqwvDuj3GGrtQNB3P3nNC3+q99EKf94UGpsG9l4CQ83zBs1NHrk1rtCSYT0+KfK5LsD8A==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-freebsd-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-whItJgDiOXaDG/idy75qqevIpZjnReZkMGCgQaBWZuKHoElDJC1rh7MpoUgupMcdfOd+PgdEwNQW9DAE6i8wyA==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"freebsd"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-freebsd-arm64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-6pCSWt8mLUbPtygv7cufV0sZLeylaMwS5Fznj6Rsx9G2AJJsAjQ9ifA+0rQEIg7DwJmi9it+WjzNTEAzzdoM3Q==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"freebsd"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-linux-32": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-VbZdWOEdrJiYApm2kkxoTOgsoCO1krBZ3quHdYk3g3ivWaMwNIVPIfEE0f0XQQ0u5pJtBsnk2/7OPiCFIPOe/w==",
|
|
||||||
"cpu": [
|
|
||||||
"ia32"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-linux-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-rXmnArVNio6yANSqDQlIO4WiP+Cv7+9EuAHNnag7rByAqFVuRusLbGi2697A5dFPNXoO//IiogVwi3AdcfPC6A==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-linux-arm": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-Ac6LpfmJO8WhCMQmO253xX2IU2B3wPDbl4IvR0hnqcPrdfCaUa2j/lLMGTjmQ4W5JsJIdHEdW12dG8lFS0MbxQ==",
|
|
||||||
"cpu": [
|
|
||||||
"arm"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-linux-arm64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-alEMGU4Z+d17U7KQQw2IV8tQycO6T+rOrgW8OS22Ua25x6kHxoG6Ngry6Aq6uranC+pNWNMB6aHFPh7aTQdORQ==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-linux-mips64le": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-47PgmyYEu+yN5rD/MbwS6DxP2FSGPo4Uxg5LwIdxTiyGC2XKwHhHyW7YYEDlSuXLQXEdTO7mYe8zQ74czP7W8A==",
|
|
||||||
"cpu": [
|
|
||||||
"mips64el"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-linux-ppc64le": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-z6n28h2+PC1Ayle9DjKoBRcx/4cxHoOa2e689e2aDJSaKug3jXcQw7mM+GLg+9ydYoNzj8QxNL8ihOv/OnezhA==",
|
|
||||||
"cpu": [
|
|
||||||
"ppc64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-linux-riscv64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-+Lu4zuuXuQhgLUGyZloWCqTslcCAjMZH1k3Xc9MSEJEpEFdpsSU0sRDXAnk18FKOfEjhu4YMGaykx9xjtpA6ow==",
|
|
||||||
"cpu": [
|
|
||||||
"riscv64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-linux-s390x": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-BMeXRljruf7J0TMxD5CIXS65y7puiZkAh+s4XFV9qy16SxOuMhxhVIXYLnbdfLrsYGFzx7U9mcdpFWkkvy/Uag==",
|
|
||||||
"cpu": [
|
|
||||||
"s390x"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-netbsd-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-EHj9QZOTel581JPj7UO3xYbltFTYnHy+SIqJVq6yd3KkCrsHRbapiPb0Lx3EOOtybBEE9EyqbmfW1NlSDsSzvQ==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"netbsd"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-openbsd-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-nkuDlIjF/sfUhfx8SKq0+U+Fgx5K9JcPq1mUodnxI0x4kBdCv46rOGWbuJ6eof2n3wdoCLccOoJAbg9ba/bT2w==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"openbsd"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-sunos-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-jVeu2GfxZQ++6lRdY43CS0Tm/r4WuQQ0Pdsrxbw+aOrHQPHV0+LNOLnvbN28M7BSUGnJnHkHm2HozGgNGyeIRw==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"sunos"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-windows-32": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-XoF2iBf0wnqo16SDq+aDGi/+QbaLFpkiRarPVssMh9KYbFNCqPLlGAWwDvxEVz+ywX6Si37J2AKm+AXq1kC0JA==",
|
|
||||||
"cpu": [
|
|
||||||
"ia32"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"win32"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-windows-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-Et6htEfGycjDrtqb2ng6nT+baesZPYQIW+HUEHK4D1ncggNrDNk3yoboYQ5KtiVrw/JaDMNttz8rrPubV/fvPQ==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"win32"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/esbuild-windows-arm64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-3bv7tqntThQC9SWLRouMDmZnlOukBhOCTlkzNqzGCmrkCJI7io5LLjwJBOVY6kOUlIvdxbooNZwjtBvj+7uuVg==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"win32"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/fsevents": {
|
|
||||||
"version": "2.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
|
||||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
|
||||||
"dev": true,
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/function-bind": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/has": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"function-bind": "^1.1.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/is-core-module": {
|
|
||||||
"version": "2.11.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz",
|
|
||||||
"integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"has": "^1.0.3"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/nanoid": {
|
|
||||||
"version": "3.3.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
|
|
||||||
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
|
|
||||||
"dev": true,
|
|
||||||
"bin": {
|
|
||||||
"nanoid": "bin/nanoid.cjs"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/path-parse": {
|
|
||||||
"version": "1.0.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
|
||||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/picocolors": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/postcss": {
|
|
||||||
"version": "8.4.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.18.tgz",
|
|
||||||
"integrity": "sha512-Wi8mWhncLJm11GATDaQKobXSNEYGUHeQLiQqDFG1qQ5UTDPTEvKw0Xt5NsTpktGTwLps3ByrWsBrG0rB8YQ9oA==",
|
|
||||||
"dev": true,
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/postcss/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "tidelift",
|
|
||||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"nanoid": "^3.3.4",
|
|
||||||
"picocolors": "^1.0.0",
|
|
||||||
"source-map-js": "^1.0.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^10 || ^12 || >=14"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/resolve": {
|
|
||||||
"version": "1.22.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
|
||||||
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"is-core-module": "^2.9.0",
|
|
||||||
"path-parse": "^1.0.7",
|
|
||||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"resolve": "bin/resolve"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/rollup": {
|
|
||||||
"version": "2.79.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz",
|
|
||||||
"integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==",
|
|
||||||
"dev": true,
|
|
||||||
"bin": {
|
|
||||||
"rollup": "dist/bin/rollup"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10.0.0"
|
|
||||||
},
|
|
||||||
"optionalDependencies": {
|
|
||||||
"fsevents": "~2.3.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/source-map-js": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/supports-preserve-symlinks-flag": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/vite": {
|
|
||||||
"version": "3.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-3.2.2.tgz",
|
|
||||||
"integrity": "sha512-pLrhatFFOWO9kS19bQ658CnRYzv0WLbsPih6R+iFeEEhDOuYgYCX2rztUViMz/uy/V8cLCJvLFeiOK7RJEzHcw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"esbuild": "^0.15.9",
|
|
||||||
"postcss": "^8.4.18",
|
|
||||||
"resolve": "^1.22.1",
|
|
||||||
"rollup": "^2.79.1"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"vite": "bin/vite.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^14.18.0 || >=16.0.0"
|
|
||||||
},
|
|
||||||
"optionalDependencies": {
|
|
||||||
"fsevents": "~2.3.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"less": "*",
|
|
||||||
"sass": "*",
|
|
||||||
"stylus": "*",
|
|
||||||
"sugarss": "*",
|
|
||||||
"terser": "^5.4.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"less": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"sass": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"stylus": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"sugarss": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"terser": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@esbuild/android-arm": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-RY2fVI8O0iFUNvZirXaQ1vMvK0xhCcl0gqRj74Z6yEiO1zAUa7hbsdwZM1kzqbxHK7LFyMizipfXT3JME+12Hw==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"@esbuild/linux-loong64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-+BoyIm4I8uJmH/QDIH0fu7MG0AEx9OXEDXnqptXCwKOlOqZiS4iraH1Nr7/ObLMokW3sOCeBNyD68ATcV9b9Ag==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-Cu3SC84oyzzhrK/YyN4iEVy2jZu5t2fz66HEOShHURcjSkOSAVL8C/gfUT+lDJxkVHpg8GZ10DD0rMHRPqMFaQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@esbuild/android-arm": "0.15.13",
|
|
||||||
"@esbuild/linux-loong64": "0.15.13",
|
|
||||||
"esbuild-android-64": "0.15.13",
|
|
||||||
"esbuild-android-arm64": "0.15.13",
|
|
||||||
"esbuild-darwin-64": "0.15.13",
|
|
||||||
"esbuild-darwin-arm64": "0.15.13",
|
|
||||||
"esbuild-freebsd-64": "0.15.13",
|
|
||||||
"esbuild-freebsd-arm64": "0.15.13",
|
|
||||||
"esbuild-linux-32": "0.15.13",
|
|
||||||
"esbuild-linux-64": "0.15.13",
|
|
||||||
"esbuild-linux-arm": "0.15.13",
|
|
||||||
"esbuild-linux-arm64": "0.15.13",
|
|
||||||
"esbuild-linux-mips64le": "0.15.13",
|
|
||||||
"esbuild-linux-ppc64le": "0.15.13",
|
|
||||||
"esbuild-linux-riscv64": "0.15.13",
|
|
||||||
"esbuild-linux-s390x": "0.15.13",
|
|
||||||
"esbuild-netbsd-64": "0.15.13",
|
|
||||||
"esbuild-openbsd-64": "0.15.13",
|
|
||||||
"esbuild-sunos-64": "0.15.13",
|
|
||||||
"esbuild-windows-32": "0.15.13",
|
|
||||||
"esbuild-windows-64": "0.15.13",
|
|
||||||
"esbuild-windows-arm64": "0.15.13"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"esbuild-android-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-yRorukXBlokwTip+Sy4MYskLhJsO0Kn0/Fj43s1krVblfwP+hMD37a4Wmg139GEsMLl+vh8WXp2mq/cTA9J97g==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-android-arm64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-TKzyymLD6PiVeyYa4c5wdPw87BeAiTXNtK6amWUcXZxkV51gOk5u5qzmDaYSwiWeecSNHamFsaFjLoi32QR5/w==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-darwin-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-WAx7c2DaOS6CrRcoYCgXgkXDliLnFv3pQLV6GeW1YcGEZq2Gnl8s9Pg7ahValZkpOa0iE/ojRVQ87sbUhF1Cbg==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-darwin-arm64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-U6jFsPfSSxC3V1CLiQqwvDuj3GGrtQNB3P3nNC3+q99EKf94UGpsG9l4CQ83zBs1NHrk1rtCSYT0+KfK5LsD8A==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-freebsd-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-whItJgDiOXaDG/idy75qqevIpZjnReZkMGCgQaBWZuKHoElDJC1rh7MpoUgupMcdfOd+PgdEwNQW9DAE6i8wyA==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-freebsd-arm64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-6pCSWt8mLUbPtygv7cufV0sZLeylaMwS5Fznj6Rsx9G2AJJsAjQ9ifA+0rQEIg7DwJmi9it+WjzNTEAzzdoM3Q==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-linux-32": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-VbZdWOEdrJiYApm2kkxoTOgsoCO1krBZ3quHdYk3g3ivWaMwNIVPIfEE0f0XQQ0u5pJtBsnk2/7OPiCFIPOe/w==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-linux-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-rXmnArVNio6yANSqDQlIO4WiP+Cv7+9EuAHNnag7rByAqFVuRusLbGi2697A5dFPNXoO//IiogVwi3AdcfPC6A==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-linux-arm": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-Ac6LpfmJO8WhCMQmO253xX2IU2B3wPDbl4IvR0hnqcPrdfCaUa2j/lLMGTjmQ4W5JsJIdHEdW12dG8lFS0MbxQ==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-linux-arm64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-alEMGU4Z+d17U7KQQw2IV8tQycO6T+rOrgW8OS22Ua25x6kHxoG6Ngry6Aq6uranC+pNWNMB6aHFPh7aTQdORQ==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-linux-mips64le": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-47PgmyYEu+yN5rD/MbwS6DxP2FSGPo4Uxg5LwIdxTiyGC2XKwHhHyW7YYEDlSuXLQXEdTO7mYe8zQ74czP7W8A==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-linux-ppc64le": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-z6n28h2+PC1Ayle9DjKoBRcx/4cxHoOa2e689e2aDJSaKug3jXcQw7mM+GLg+9ydYoNzj8QxNL8ihOv/OnezhA==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-linux-riscv64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-+Lu4zuuXuQhgLUGyZloWCqTslcCAjMZH1k3Xc9MSEJEpEFdpsSU0sRDXAnk18FKOfEjhu4YMGaykx9xjtpA6ow==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-linux-s390x": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-BMeXRljruf7J0TMxD5CIXS65y7puiZkAh+s4XFV9qy16SxOuMhxhVIXYLnbdfLrsYGFzx7U9mcdpFWkkvy/Uag==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-netbsd-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-EHj9QZOTel581JPj7UO3xYbltFTYnHy+SIqJVq6yd3KkCrsHRbapiPb0Lx3EOOtybBEE9EyqbmfW1NlSDsSzvQ==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-openbsd-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-nkuDlIjF/sfUhfx8SKq0+U+Fgx5K9JcPq1mUodnxI0x4kBdCv46rOGWbuJ6eof2n3wdoCLccOoJAbg9ba/bT2w==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-sunos-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-jVeu2GfxZQ++6lRdY43CS0Tm/r4WuQQ0Pdsrxbw+aOrHQPHV0+LNOLnvbN28M7BSUGnJnHkHm2HozGgNGyeIRw==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-windows-32": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-XoF2iBf0wnqo16SDq+aDGi/+QbaLFpkiRarPVssMh9KYbFNCqPLlGAWwDvxEVz+ywX6Si37J2AKm+AXq1kC0JA==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-windows-64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-Et6htEfGycjDrtqb2ng6nT+baesZPYQIW+HUEHK4D1ncggNrDNk3yoboYQ5KtiVrw/JaDMNttz8rrPubV/fvPQ==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"esbuild-windows-arm64": {
|
|
||||||
"version": "0.15.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.13.tgz",
|
|
||||||
"integrity": "sha512-3bv7tqntThQC9SWLRouMDmZnlOukBhOCTlkzNqzGCmrkCJI7io5LLjwJBOVY6kOUlIvdxbooNZwjtBvj+7uuVg==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"fsevents": {
|
|
||||||
"version": "2.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
|
||||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"function-bind": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"has": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"function-bind": "^1.1.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"is-core-module": {
|
|
||||||
"version": "2.11.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz",
|
|
||||||
"integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"has": "^1.0.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nanoid": {
|
|
||||||
"version": "3.3.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
|
|
||||||
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"path-parse": {
|
|
||||||
"version": "1.0.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
|
||||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"picocolors": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"postcss": {
|
|
||||||
"version": "8.4.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.18.tgz",
|
|
||||||
"integrity": "sha512-Wi8mWhncLJm11GATDaQKobXSNEYGUHeQLiQqDFG1qQ5UTDPTEvKw0Xt5NsTpktGTwLps3ByrWsBrG0rB8YQ9oA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"nanoid": "^3.3.4",
|
|
||||||
"picocolors": "^1.0.0",
|
|
||||||
"source-map-js": "^1.0.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"resolve": {
|
|
||||||
"version": "1.22.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
|
||||||
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"is-core-module": "^2.9.0",
|
|
||||||
"path-parse": "^1.0.7",
|
|
||||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rollup": {
|
|
||||||
"version": "2.79.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz",
|
|
||||||
"integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"fsevents": "~2.3.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"source-map-js": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"supports-preserve-symlinks-flag": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"vite": {
|
|
||||||
"version": "3.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-3.2.2.tgz",
|
|
||||||
"integrity": "sha512-pLrhatFFOWO9kS19bQ658CnRYzv0WLbsPih6R+iFeEEhDOuYgYCX2rztUViMz/uy/V8cLCJvLFeiOK7RJEzHcw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"esbuild": "^0.15.9",
|
|
||||||
"fsevents": "~2.3.2",
|
|
||||||
"postcss": "^8.4.18",
|
|
||||||
"resolve": "^1.22.1",
|
|
||||||
"rollup": "^2.79.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Buildless Vanilla Strudel REPL</title>
|
|
||||||
</head>
|
|
||||||
<body style="margin: 0; background: #222">
|
|
||||||
<div style="display: grid; height: 100vh">
|
|
||||||
<textarea
|
|
||||||
id="text"
|
|
||||||
style="font-size: 2em; border: 0; color: white; background: transparent; outline: none; padding: 20px"
|
|
||||||
spellcheck="false"
|
|
||||||
>
|
|
||||||
// LOADING</textarea
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
id="start"
|
|
||||||
style="
|
|
||||||
position: absolute;
|
|
||||||
border-radius: 10px;
|
|
||||||
top: 20px;
|
|
||||||
right: 20px;
|
|
||||||
padding: 20px;
|
|
||||||
border: 2px solid white;
|
|
||||||
background: transparent;
|
|
||||||
color: white;
|
|
||||||
cursor: pointer;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
evaluate
|
|
||||||
</button>
|
|
||||||
<div id="output"></div>
|
|
||||||
<script type="module">
|
|
||||||
import { controls, repl, evalScope } from 'https://cdn.skypack.dev/@strudel.cycles/core@0.4.1';
|
|
||||||
import { transpiler } from 'https://cdn.skypack.dev/@strudel.cycles/transpiler@0.4.1';
|
|
||||||
|
|
||||||
const modules = [
|
|
||||||
import('https://cdn.skypack.dev/@strudel.cycles/core@0.4.1'),
|
|
||||||
import('https://cdn.skypack.dev/@strudel.cycles/mini@0.4.1'),
|
|
||||||
];
|
|
||||||
|
|
||||||
const input = document.getElementById('text');
|
|
||||||
|
|
||||||
Promise.all(modules).then(() => {
|
|
||||||
input.innerHTML = `note("<c3 [d3 e3]>").cutoff(1000)`;
|
|
||||||
document.getElementById('start').addEventListener('click', () => {
|
|
||||||
evaluate(input.value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
evalScope(controls, ...modules);
|
|
||||||
|
|
||||||
const { evaluate } = repl({
|
|
||||||
defaultOutput: (hap, deadline, duration) => {
|
|
||||||
console.log(deadline, duration, hap.value);
|
|
||||||
},
|
|
||||||
getTime: () => Date.now() / 1000,
|
|
||||||
transpiler,
|
|
||||||
beforeEval: (code) => console.log('evaluate', code),
|
|
||||||
afterEval: (code) => {},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
/*
|
|
||||||
gist.js - <short description TODO>
|
|
||||||
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/gist.js>
|
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// this is a shortcut to eval code from a gist
|
|
||||||
// why? to be able to shorten strudel code + e.g. be able to change instruments after links have been generated
|
|
||||||
export default (route, cache = true) =>
|
|
||||||
fetch(`https://gist.githubusercontent.com/${route}?cachebust=${cache ? '' : Date.now()}`)
|
|
||||||
.then((res) => res.text())
|
|
||||||
.then((code) => eval(code));
|
|
||||||
+18
-1
@@ -32,7 +32,11 @@ export class Hap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get duration() {
|
get duration() {
|
||||||
return this.whole.end.sub(this.whole.begin);
|
return this.whole.end.sub(this.whole.begin).mul(typeof this.value?.clip === 'number' ? this.value?.clip : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
get endClipped() {
|
||||||
|
return this.whole.begin.add(this.duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
wholeOrPart() {
|
wholeOrPart() {
|
||||||
@@ -126,6 +130,19 @@ export class Hap {
|
|||||||
setContext(context) {
|
setContext(context) {
|
||||||
return new Hap(this.whole, this.part, this.value, context);
|
return new Hap(this.whole, this.part, this.value, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensureObjectValue() {
|
||||||
|
/* if (isNote(hap.value)) {
|
||||||
|
// supports primitive hap values that look like notes
|
||||||
|
hap.value = { note: hap.value };
|
||||||
|
} */
|
||||||
|
if (typeof this.value !== 'object') {
|
||||||
|
throw new Error(
|
||||||
|
`expected hap.value to be an object, but got "${this.value}". Hint: append .note() or .s() to the end`,
|
||||||
|
'error',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Hap;
|
export default Hap;
|
||||||
|
|||||||
@@ -18,22 +18,24 @@ export * from './util.mjs';
|
|||||||
export * from './speak.mjs';
|
export * from './speak.mjs';
|
||||||
export * from './evaluate.mjs';
|
export * from './evaluate.mjs';
|
||||||
export * from './repl.mjs';
|
export * from './repl.mjs';
|
||||||
|
export * from './cyclist.mjs';
|
||||||
export * from './logger.mjs';
|
export * from './logger.mjs';
|
||||||
export * from './time.mjs';
|
export * from './time.mjs';
|
||||||
export * from './draw.mjs';
|
export * from './draw.mjs';
|
||||||
|
export * from './animate.mjs';
|
||||||
export * from './pianoroll.mjs';
|
export * from './pianoroll.mjs';
|
||||||
|
export * from './spiral.mjs';
|
||||||
export * from './ui.mjs';
|
export * from './ui.mjs';
|
||||||
export { default as drawLine } from './drawLine.mjs';
|
export { default as drawLine } from './drawLine.mjs';
|
||||||
export { default as gist } from './gist.js';
|
|
||||||
// below won't work with runtime.mjs (json import fails)
|
// below won't work with runtime.mjs (json import fails)
|
||||||
/* import * as p from './package.json';
|
/* import * as p from './package.json';
|
||||||
export const version = p.version; */
|
export const version = p.version; */
|
||||||
logger('🌀 @strudel.cycles/core loaded 🌀');
|
logger('🌀 @strudel/core loaded 🌀');
|
||||||
if (globalThis._strudelLoaded) {
|
if (globalThis._strudelLoaded) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`@strudel.cycles/core was loaded more than once...
|
`@strudel/core was loaded more than once...
|
||||||
This might happen when you have multiple versions of strudel installed.
|
This might happen when you have multiple versions of strudel installed.
|
||||||
Please check with "npm ls @strudel.cycles/core".`,
|
Please check with "npm ls @strudel/core".`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
globalThis._strudelLoaded = true;
|
globalThis._strudelLoaded = true;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ export const logKey = 'strudel.log';
|
|||||||
|
|
||||||
export function logger(message, type, data = {}) {
|
export function logger(message, type, data = {}) {
|
||||||
console.log(`%c${message}`, 'background-color: black;color:white;border-radius:15px');
|
console.log(`%c${message}`, 'background-color: black;color:white;border-radius:15px');
|
||||||
if (typeof CustomEvent !== 'undefined') {
|
if (typeof document !== 'undefined' && typeof CustomEvent !== 'undefined') {
|
||||||
document.dispatchEvent(
|
document.dispatchEvent(
|
||||||
new CustomEvent(logKey, {
|
new CustomEvent(logKey, {
|
||||||
detail: {
|
detail: {
|
||||||
|
|||||||
Generated
-1639
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel.cycles/core",
|
"name": "@strudel/core",
|
||||||
"version": "0.5.0",
|
"version": "0.11.0",
|
||||||
"description": "Port of Tidal Cycles to JavaScript",
|
"description": "Port of Tidal Cycles to JavaScript",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
"publishConfig": {
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"module": "dist/index.mjs"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vitest run"
|
"test": "vitest run",
|
||||||
|
"build": "vite build",
|
||||||
|
"prepublishOnly": "pnpm build"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -23,10 +29,13 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/tidalcycles/strudel/issues"
|
"url": "https://github.com/tidalcycles/strudel/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://strudel.tidalcycles.org",
|
"homepage": "https://strudel.cc",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bjork": "^0.0.1",
|
"fraction.js": "^4.3.7"
|
||||||
"fraction.js": "^4.2.0"
|
|
||||||
},
|
},
|
||||||
"gitHead": "0e26d4e741500f5bae35b023608f062a794905c2"
|
"gitHead": "0e26d4e741500f5bae35b023608f062a794905c2",
|
||||||
|
"devDependencies": {
|
||||||
|
"vite": "^5.0.10",
|
||||||
|
"vitest": "^1.1.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+624
-152
File diff suppressed because it is too large
Load Diff
+230
-90
@@ -1,24 +1,100 @@
|
|||||||
/*
|
/*
|
||||||
pianoroll.mjs - <short description TODO>
|
pianoroll.mjs - <short description TODO>
|
||||||
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/tone/pianoroll.mjs>
|
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/pianoroll.mjs>
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Pattern, toMidi, getDrawContext } from './index.mjs';
|
import { Pattern, noteToMidi, getDrawContext, freqToMidi, isNote } from './index.mjs';
|
||||||
|
|
||||||
const scale = (normalized, min, max) => normalized * (max - min) + min;
|
const scale = (normalized, min, max) => normalized * (max - min) + min;
|
||||||
const getValue = (e) => {
|
const getValue = (e) => {
|
||||||
let value = typeof e.value === 'object' ? e.value.note ?? e.value.n : e.value;
|
let { value } = e;
|
||||||
if (typeof value === 'string') {
|
if (typeof e.value !== 'object') {
|
||||||
value = toMidi(value);
|
value = { value };
|
||||||
|
}
|
||||||
|
let { note, n, freq, s } = value;
|
||||||
|
if (freq) {
|
||||||
|
return freqToMidi(freq);
|
||||||
|
}
|
||||||
|
note = note ?? n;
|
||||||
|
if (typeof note === 'string') {
|
||||||
|
return noteToMidi(note);
|
||||||
|
}
|
||||||
|
if (typeof note === 'number') {
|
||||||
|
return note;
|
||||||
|
}
|
||||||
|
if (s) {
|
||||||
|
return '_' + s;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pattern.prototype.pianoroll = function ({
|
Pattern.prototype.pianoroll = function (options = {}) {
|
||||||
|
let { cycles = 4, playhead = 0.5, overscan = 1, hideNegative = false } = options;
|
||||||
|
|
||||||
|
let from = -cycles * playhead;
|
||||||
|
let to = cycles * (1 - playhead);
|
||||||
|
|
||||||
|
this.draw(
|
||||||
|
(ctx, haps, t) => {
|
||||||
|
const inFrame = (event) =>
|
||||||
|
(!hideNegative || event.whole.begin >= 0) && event.whole.begin <= t + to && event.endClipped >= t + from;
|
||||||
|
pianoroll({
|
||||||
|
...options,
|
||||||
|
time: t,
|
||||||
|
ctx,
|
||||||
|
haps: haps.filter(inFrame),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: from - overscan,
|
||||||
|
to: to + overscan,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// this function allows drawing a pianoroll without ties to Pattern.prototype
|
||||||
|
// it will probably replace the above in the future
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a midi-style piano roll
|
||||||
|
*
|
||||||
|
* @name pianoroll
|
||||||
|
* @param {Object} options Object containing all the optional following parameters as key value pairs:
|
||||||
|
* @param {integer} cycles number of cycles to be displayed at the same time - defaults to 4
|
||||||
|
* @param {number} playhead location of the active notes on the time axis - 0 to 1, defaults to 0.5
|
||||||
|
* @param {boolean} vertical displays the roll vertically - 0 by default
|
||||||
|
* @param {boolean} labels displays labels on individual notes (see the label function) - 0 by default
|
||||||
|
* @param {boolean} flipTime reverse the direction of the roll - 0 by default
|
||||||
|
* @param {boolean} flipValues reverse the relative location of notes on the value axis - 0 by default
|
||||||
|
* @param {number} overscan lookup X cycles outside of the cycles window to display notes in advance - 1 by default
|
||||||
|
* @param {boolean} hideNegative hide notes with negative time (before starting playing the pattern) - 0 by default
|
||||||
|
* @param {boolean} smear notes leave a solid trace - 0 by default
|
||||||
|
* @param {boolean} fold notes takes the full value axis width - 0 by default
|
||||||
|
* @param {string} active hexadecimal or CSS color of the active notes - defaults to #FFCA28
|
||||||
|
* @param {string} inactive hexadecimal or CSS color of the inactive notes - defaults to #7491D2
|
||||||
|
* @param {string} background hexadecimal or CSS color of the background - defaults to transparent
|
||||||
|
* @param {string} playheadColor hexadecimal or CSS color of the line representing the play head - defaults to white
|
||||||
|
* @param {boolean} fill notes are filled with color (otherwise only the label is displayed) - 0 by default
|
||||||
|
* @param {boolean} fillActive active notes are filled with color - 0 by default
|
||||||
|
* @param {boolean} stroke notes are shown with colored borders - 0 by default
|
||||||
|
* @param {boolean} strokeActive active notes are shown with colored borders - 0 by default
|
||||||
|
* @param {boolean} hideInactive only active notes are shown - 0 by default
|
||||||
|
* @param {boolean} colorizeInactive use note color for inactive notes - 1 by default
|
||||||
|
* @param {string} fontFamily define the font used by notes labels - defaults to 'monospace'
|
||||||
|
* @param {integer} minMidi minimum note value to display on the value axis - defaults to 10
|
||||||
|
* @param {integer} maxMidi maximum note value to display on the value axis - defaults to 90
|
||||||
|
* @param {boolean} autorange automatically calculate the minMidi and maxMidi parameters - 0 by default
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* note("C2 A2 G2").euclid(5,8).s('piano').clip(1).color('salmon').pianoroll({vertical:1, labels:1})
|
||||||
|
*/
|
||||||
|
export function pianoroll({
|
||||||
|
time,
|
||||||
|
haps,
|
||||||
cycles = 4,
|
cycles = 4,
|
||||||
playhead = 0.5,
|
playhead = 0.5,
|
||||||
overscan = 1,
|
|
||||||
flipTime = 0,
|
flipTime = 0,
|
||||||
flipValues = 0,
|
flipValues = 0,
|
||||||
hideNegative = false,
|
hideNegative = false,
|
||||||
@@ -36,8 +112,16 @@ Pattern.prototype.pianoroll = function ({
|
|||||||
timeframe: timeframeProp,
|
timeframe: timeframeProp,
|
||||||
fold = 0,
|
fold = 0,
|
||||||
vertical = 0,
|
vertical = 0,
|
||||||
|
labels = false,
|
||||||
|
fill = 1,
|
||||||
|
fillActive = false,
|
||||||
|
strokeActive = true,
|
||||||
|
stroke,
|
||||||
|
hideInactive = 0,
|
||||||
|
colorizeInactive = 1,
|
||||||
|
fontFamily,
|
||||||
|
ctx,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
const ctx = getDrawContext();
|
|
||||||
const w = ctx.canvas.width;
|
const w = ctx.canvas.width;
|
||||||
const h = ctx.canvas.height;
|
const h = ctx.canvas.height;
|
||||||
let from = -cycles * playhead;
|
let from = -cycles * playhead;
|
||||||
@@ -48,9 +132,6 @@ Pattern.prototype.pianoroll = function ({
|
|||||||
from = 0;
|
from = 0;
|
||||||
to = timeframeProp;
|
to = timeframeProp;
|
||||||
}
|
}
|
||||||
if (!autorange && fold) {
|
|
||||||
console.warn('disabling autorange has no effect when fold is enabled');
|
|
||||||
}
|
|
||||||
const timeAxis = vertical ? h : w;
|
const timeAxis = vertical ? h : w;
|
||||||
const valueAxis = vertical ? w : h;
|
const valueAxis = vertical ? w : h;
|
||||||
let timeRange = vertical ? [timeAxis, 0] : [0, timeAxis]; // pixel range for time
|
let timeRange = vertical ? [timeAxis, 0] : [0, timeAxis]; // pixel range for time
|
||||||
@@ -62,86 +143,145 @@ Pattern.prototype.pianoroll = function ({
|
|||||||
flipTime && timeRange.reverse();
|
flipTime && timeRange.reverse();
|
||||||
flipValues && valueRange.reverse();
|
flipValues && valueRange.reverse();
|
||||||
|
|
||||||
this.draw(
|
// onQuery
|
||||||
(ctx, events, t) => {
|
const { min, max, values } = haps.reduce(
|
||||||
ctx.fillStyle = background;
|
({ min, max, values }, e) => {
|
||||||
ctx.globalAlpha = 1; // reset!
|
const v = getValue(e);
|
||||||
if (!smear) {
|
return {
|
||||||
ctx.clearRect(0, 0, w, h);
|
min: v < min ? v : min,
|
||||||
ctx.fillRect(0, 0, w, h);
|
max: v > max ? v : max,
|
||||||
}
|
values: values.includes(v) ? values : [...values, v],
|
||||||
const inFrame = (event) =>
|
};
|
||||||
(!hideNegative || event.whole.begin >= 0) && event.whole.begin <= t + to && event.whole.end >= t + from;
|
|
||||||
events.filter(inFrame).forEach((event) => {
|
|
||||||
const isActive = event.whole.begin <= t && event.whole.end > t;
|
|
||||||
ctx.fillStyle = event.context?.color || inactive;
|
|
||||||
ctx.strokeStyle = event.context?.color || active;
|
|
||||||
ctx.globalAlpha = event.context.velocity ?? 1;
|
|
||||||
const timePx = scale((event.whole.begin - (flipTime ? to : from)) / timeExtent, ...timeRange);
|
|
||||||
let durationPx = scale(event.duration / timeExtent, 0, timeAxis);
|
|
||||||
const value = getValue(event);
|
|
||||||
const valuePx = scale(
|
|
||||||
fold ? foldValues.indexOf(value) / foldValues.length : (Number(value) - minMidi) / valueExtent,
|
|
||||||
...valueRange,
|
|
||||||
);
|
|
||||||
let margin = 0;
|
|
||||||
const offset = scale(t / timeExtent, ...timeRange);
|
|
||||||
let coords;
|
|
||||||
if (vertical) {
|
|
||||||
coords = [
|
|
||||||
valuePx + 1 - (flipValues ? barThickness : 0), // x
|
|
||||||
timeAxis - offset + timePx + margin + 1 - (flipTime ? 0 : durationPx), // y
|
|
||||||
barThickness - 2, // width
|
|
||||||
durationPx - 2, // height
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
coords = [
|
|
||||||
timePx - offset + margin + 1 - (flipTime ? durationPx : 0), // x
|
|
||||||
valuePx + 1 - (flipValues ? 0 : barThickness), // y
|
|
||||||
durationPx - 2, // widith
|
|
||||||
barThickness - 2, // height
|
|
||||||
];
|
|
||||||
}
|
|
||||||
isActive ? ctx.strokeRect(...coords) : ctx.fillRect(...coords);
|
|
||||||
});
|
|
||||||
ctx.globalAlpha = 1; // reset!
|
|
||||||
const playheadPosition = scale(-from / timeExtent, ...timeRange);
|
|
||||||
// draw playhead
|
|
||||||
ctx.strokeStyle = playheadColor;
|
|
||||||
ctx.beginPath();
|
|
||||||
if (vertical) {
|
|
||||||
ctx.moveTo(0, playheadPosition);
|
|
||||||
ctx.lineTo(valueAxis, playheadPosition);
|
|
||||||
} else {
|
|
||||||
ctx.moveTo(playheadPosition, 0);
|
|
||||||
ctx.lineTo(playheadPosition, valueAxis);
|
|
||||||
}
|
|
||||||
ctx.stroke();
|
|
||||||
},
|
|
||||||
{
|
|
||||||
from: from - overscan,
|
|
||||||
to: to + overscan,
|
|
||||||
onQuery: (events) => {
|
|
||||||
const { min, max, values } = events.reduce(
|
|
||||||
({ min, max, values }, e) => {
|
|
||||||
const v = getValue(e);
|
|
||||||
return {
|
|
||||||
min: v < min ? v : min,
|
|
||||||
max: v > max ? v : max,
|
|
||||||
values: values.includes(v) ? values : [...values, v],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{ min: Infinity, max: -Infinity, values: [] },
|
|
||||||
);
|
|
||||||
if (autorange) {
|
|
||||||
minMidi = min;
|
|
||||||
maxMidi = max;
|
|
||||||
valueExtent = maxMidi - minMidi + 1;
|
|
||||||
}
|
|
||||||
foldValues = values.sort((a, b) => a - b);
|
|
||||||
barThickness = fold ? valueAxis / foldValues.length : valueAxis / valueExtent;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
{ min: Infinity, max: -Infinity, values: [] },
|
||||||
);
|
);
|
||||||
|
if (autorange) {
|
||||||
|
minMidi = min;
|
||||||
|
maxMidi = max;
|
||||||
|
valueExtent = maxMidi - minMidi + 1;
|
||||||
|
}
|
||||||
|
// foldValues = values.sort((a, b) => a - b);
|
||||||
|
foldValues = values.sort((a, b) => String(a).localeCompare(String(b)));
|
||||||
|
barThickness = fold ? valueAxis / foldValues.length : valueAxis / valueExtent;
|
||||||
|
ctx.fillStyle = background;
|
||||||
|
ctx.globalAlpha = 1; // reset!
|
||||||
|
if (!smear) {
|
||||||
|
ctx.clearRect(0, 0, w, h);
|
||||||
|
ctx.fillRect(0, 0, w, h);
|
||||||
|
}
|
||||||
|
haps.forEach((event) => {
|
||||||
|
const isActive = event.whole.begin <= time && event.endClipped > time;
|
||||||
|
let strokeCurrent = stroke ?? (strokeActive && isActive);
|
||||||
|
let fillCurrent = (!isActive && fill) || (isActive && fillActive);
|
||||||
|
if (hideInactive && !isActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let color = event.value?.color || event.context?.color;
|
||||||
|
active = color || active;
|
||||||
|
inactive = colorizeInactive ? color || inactive : inactive;
|
||||||
|
color = isActive ? active : inactive;
|
||||||
|
ctx.fillStyle = fillCurrent ? color : 'transparent';
|
||||||
|
ctx.strokeStyle = color;
|
||||||
|
ctx.globalAlpha = event.context.velocity ?? event.value?.gain ?? 1;
|
||||||
|
const timeProgress = (event.whole.begin - (flipTime ? to : from)) / timeExtent;
|
||||||
|
const timePx = scale(timeProgress, ...timeRange);
|
||||||
|
let durationPx = scale(event.duration / timeExtent, 0, timeAxis);
|
||||||
|
const value = getValue(event);
|
||||||
|
const valueProgress = fold
|
||||||
|
? foldValues.indexOf(value) / foldValues.length
|
||||||
|
: (Number(value) - minMidi) / valueExtent;
|
||||||
|
const valuePx = scale(valueProgress, ...valueRange);
|
||||||
|
let margin = 0;
|
||||||
|
const offset = scale(time / timeExtent, ...timeRange);
|
||||||
|
let coords;
|
||||||
|
if (vertical) {
|
||||||
|
coords = [
|
||||||
|
valuePx + 1 - (flipValues ? barThickness : 0), // x
|
||||||
|
timeAxis - offset + timePx + margin + 1 - (flipTime ? 0 : durationPx), // y
|
||||||
|
barThickness - 2, // width
|
||||||
|
durationPx - 2, // height
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
coords = [
|
||||||
|
timePx - offset + margin + 1 - (flipTime ? durationPx : 0), // x
|
||||||
|
valuePx + 1 - (flipValues ? 0 : barThickness), // y
|
||||||
|
durationPx - 2, // widith
|
||||||
|
barThickness - 2, // height
|
||||||
|
];
|
||||||
|
}
|
||||||
|
/* const xFactor = Math.sin(performance.now() / 500) + 1;
|
||||||
|
coords[0] *= xFactor; */
|
||||||
|
|
||||||
|
if (strokeCurrent) {
|
||||||
|
ctx.strokeRect(...coords);
|
||||||
|
}
|
||||||
|
if (fillCurrent) {
|
||||||
|
ctx.fillRect(...coords);
|
||||||
|
}
|
||||||
|
//ctx.ellipse(...ellipseFromRect(...coords))
|
||||||
|
if (labels) {
|
||||||
|
const defaultLabel = event.value.note ?? event.value.s + (event.value.n ? `:${event.value.n}` : '');
|
||||||
|
const { label: inactiveLabel, activeLabel } = event.value;
|
||||||
|
const customLabel = isActive ? activeLabel || inactiveLabel : inactiveLabel;
|
||||||
|
const label = customLabel ?? defaultLabel;
|
||||||
|
let measure = vertical ? durationPx : barThickness * 0.75;
|
||||||
|
ctx.font = `${measure}px ${fontFamily || 'monospace'}`;
|
||||||
|
// font color
|
||||||
|
ctx.fillStyle = /* isActive && */ !fillCurrent ? color : 'black';
|
||||||
|
ctx.textBaseline = 'top';
|
||||||
|
ctx.fillText(label, ...coords);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ctx.globalAlpha = 1; // reset!
|
||||||
|
const playheadPosition = scale(-from / timeExtent, ...timeRange);
|
||||||
|
// draw playhead
|
||||||
|
ctx.strokeStyle = playheadColor;
|
||||||
|
ctx.beginPath();
|
||||||
|
if (vertical) {
|
||||||
|
ctx.moveTo(0, playheadPosition);
|
||||||
|
ctx.lineTo(valueAxis, playheadPosition);
|
||||||
|
} else {
|
||||||
|
ctx.moveTo(playheadPosition, 0);
|
||||||
|
ctx.lineTo(playheadPosition, valueAxis);
|
||||||
|
}
|
||||||
|
ctx.stroke();
|
||||||
return this;
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDrawOptions(drawTime, options = {}) {
|
||||||
|
let [lookbehind, lookahead] = drawTime;
|
||||||
|
lookbehind = Math.abs(lookbehind);
|
||||||
|
const cycles = lookahead + lookbehind;
|
||||||
|
const playhead = lookbehind / cycles;
|
||||||
|
return { fold: 1, ...options, cycles, playhead };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getPunchcardPainter =
|
||||||
|
(options = {}) =>
|
||||||
|
(ctx, time, haps, drawTime, paintOptions = {}) =>
|
||||||
|
pianoroll({ ctx, time, haps, ...getDrawOptions(drawTime, { ...paintOptions, ...options }) });
|
||||||
|
|
||||||
|
Pattern.prototype.punchcard = function (options) {
|
||||||
|
return this.onPaint(getPunchcardPainter(options));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a vertical pianoroll with event labels.
|
||||||
|
* Supports all the same options as pianoroll.
|
||||||
|
*
|
||||||
|
* @name wordfall
|
||||||
|
*/
|
||||||
|
Pattern.prototype.wordfall = function (options) {
|
||||||
|
return this.punchcard({ vertical: 1, labels: 1, stroke: 0, fillActive: 1, active: 'white', ...options });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Pattern.prototype.pianoroll = function (options) {
|
||||||
|
return this.onPaint((ctx, time, haps, drawTime) =>
|
||||||
|
pianoroll({ ctx, time, haps, ...getDrawOptions(drawTime, { fold: 0, ...options }) }),
|
||||||
|
);
|
||||||
|
}; */
|
||||||
|
|
||||||
|
export function drawPianoroll(options) {
|
||||||
|
const { drawTime, ...rest } = options;
|
||||||
|
pianoroll({ ...getDrawOptions(drawTime), ...rest });
|
||||||
|
}
|
||||||
|
|||||||
+146
-22
@@ -2,6 +2,8 @@ import { Cyclist } from './cyclist.mjs';
|
|||||||
import { evaluate as _evaluate } from './evaluate.mjs';
|
import { evaluate as _evaluate } from './evaluate.mjs';
|
||||||
import { logger } from './logger.mjs';
|
import { logger } from './logger.mjs';
|
||||||
import { setTime } from './time.mjs';
|
import { setTime } from './time.mjs';
|
||||||
|
import { evalScope } from './evaluate.mjs';
|
||||||
|
import { register, Pattern, isPattern, silence, stack } from './pattern.mjs';
|
||||||
|
|
||||||
export function repl({
|
export function repl({
|
||||||
interval,
|
interval,
|
||||||
@@ -13,47 +15,169 @@ export function repl({
|
|||||||
getTime,
|
getTime,
|
||||||
transpiler,
|
transpiler,
|
||||||
onToggle,
|
onToggle,
|
||||||
|
editPattern,
|
||||||
|
onUpdateState,
|
||||||
}) {
|
}) {
|
||||||
|
const state = {
|
||||||
|
schedulerError: undefined,
|
||||||
|
evalError: undefined,
|
||||||
|
code: '// LOADING',
|
||||||
|
activeCode: '// LOADING',
|
||||||
|
pattern: undefined,
|
||||||
|
miniLocations: [],
|
||||||
|
widgets: [],
|
||||||
|
pending: false,
|
||||||
|
started: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateState = (update) => {
|
||||||
|
Object.assign(state, update);
|
||||||
|
state.isDirty = state.code !== state.activeCode;
|
||||||
|
state.error = state.evalError || state.schedulerError;
|
||||||
|
onUpdateState?.(state);
|
||||||
|
};
|
||||||
|
|
||||||
const scheduler = new Cyclist({
|
const scheduler = new Cyclist({
|
||||||
interval,
|
interval,
|
||||||
onTrigger: async (hap, deadline, duration) => {
|
onTrigger: getTrigger({ defaultOutput, getTime }),
|
||||||
try {
|
|
||||||
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
|
|
||||||
await defaultOutput(hap, deadline, duration);
|
|
||||||
}
|
|
||||||
if (hap.context.onTrigger) {
|
|
||||||
const cps = 1;
|
|
||||||
// call signature of output / onTrigger is different...
|
|
||||||
await hap.context.onTrigger(getTime() + deadline, hap, getTime(), cps);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
logger(`[cyclist] error: ${err.message}`, 'error');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: onSchedulerError,
|
onError: onSchedulerError,
|
||||||
getTime,
|
getTime,
|
||||||
onToggle,
|
onToggle: (started) => {
|
||||||
|
updateState({ started });
|
||||||
|
onToggle?.(started);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
setTime(() => scheduler.getPhase()); // TODO: refactor?
|
let pPatterns = {};
|
||||||
const evaluate = async (code, autostart = true) => {
|
let allTransform;
|
||||||
|
|
||||||
|
const hush = function () {
|
||||||
|
pPatterns = {};
|
||||||
|
allTransform = undefined;
|
||||||
|
return silence;
|
||||||
|
};
|
||||||
|
|
||||||
|
const setPattern = (pattern, autostart = true) => {
|
||||||
|
pattern = editPattern?.(pattern) || pattern;
|
||||||
|
scheduler.setPattern(pattern, autostart);
|
||||||
|
};
|
||||||
|
setTime(() => scheduler.now()); // TODO: refactor?
|
||||||
|
const evaluate = async (code, autostart = true, shouldHush = true) => {
|
||||||
if (!code) {
|
if (!code) {
|
||||||
throw new Error('no code to evaluate');
|
throw new Error('no code to evaluate');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
beforeEval?.({ code });
|
updateState({ code, pending: true });
|
||||||
const { pattern } = await _evaluate(code, transpiler);
|
await beforeEval?.({ code });
|
||||||
|
shouldHush && hush();
|
||||||
|
let { pattern, meta } = await _evaluate(code, transpiler);
|
||||||
|
if (Object.keys(pPatterns).length) {
|
||||||
|
pattern = stack(...Object.values(pPatterns));
|
||||||
|
}
|
||||||
|
if (allTransform) {
|
||||||
|
pattern = allTransform(pattern);
|
||||||
|
}
|
||||||
|
if (!isPattern(pattern)) {
|
||||||
|
const message = `got "${typeof evaluated}" instead of pattern`;
|
||||||
|
throw new Error(message + (typeof evaluated === 'function' ? ', did you forget to call a function?' : '.'));
|
||||||
|
}
|
||||||
logger(`[eval] code updated`);
|
logger(`[eval] code updated`);
|
||||||
scheduler.setPattern(pattern, autostart);
|
setPattern(pattern, autostart);
|
||||||
afterEval?.({ code, pattern });
|
updateState({
|
||||||
|
miniLocations: meta?.miniLocations || [],
|
||||||
|
widgets: meta?.widgets || [],
|
||||||
|
activeCode: code,
|
||||||
|
pattern,
|
||||||
|
evalError: undefined,
|
||||||
|
schedulerError: undefined,
|
||||||
|
pending: false,
|
||||||
|
});
|
||||||
|
afterEval?.({ code, pattern, meta });
|
||||||
return pattern;
|
return pattern;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// console.warn(`[repl] eval error: ${err.message}`);
|
// console.warn(`[repl] eval error: ${err.message}`);
|
||||||
logger(`[eval] error: ${err.message}`, 'error');
|
logger(`[eval] error: ${err.message}`, 'error');
|
||||||
|
updateState({ evalError: err, pending: false });
|
||||||
onEvalError?.(err);
|
onEvalError?.(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const stop = () => scheduler.stop();
|
const stop = () => scheduler.stop();
|
||||||
const start = () => scheduler.start();
|
const start = () => scheduler.start();
|
||||||
const pause = () => scheduler.pause();
|
const pause = () => scheduler.pause();
|
||||||
return { scheduler, evaluate, start, stop, pause };
|
const toggle = () => scheduler.toggle();
|
||||||
|
const setCps = (cps) => scheduler.setCps(cps);
|
||||||
|
const setCpm = (cpm) => scheduler.setCps(cpm / 60);
|
||||||
|
|
||||||
|
// the following functions use the cps value, which is why they are defined here..
|
||||||
|
const loopAt = register('loopAt', (cycles, pat) => {
|
||||||
|
return pat.loopAtCps(cycles, scheduler.cps);
|
||||||
|
});
|
||||||
|
|
||||||
|
Pattern.prototype.p = function (id) {
|
||||||
|
pPatterns[id] = this;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
Pattern.prototype.q = function (id) {
|
||||||
|
return silence;
|
||||||
|
};
|
||||||
|
|
||||||
|
const all = function (transform) {
|
||||||
|
allTransform = transform;
|
||||||
|
return silence;
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
for (let i = 1; i < 10; ++i) {
|
||||||
|
Object.defineProperty(Pattern.prototype, `d${i}`, {
|
||||||
|
get() {
|
||||||
|
return this.p(i);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Object.defineProperty(Pattern.prototype, `p${i}`, {
|
||||||
|
get() {
|
||||||
|
return this.p(i);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Pattern.prototype[`q${i}`] = silence;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// already defined..
|
||||||
|
}
|
||||||
|
|
||||||
|
const fit = register('fit', (pat) =>
|
||||||
|
pat.withHap((hap) =>
|
||||||
|
hap.withValue((v) => ({
|
||||||
|
...v,
|
||||||
|
speed: scheduler.cps / hap.whole.duration, // overwrite speed completely?
|
||||||
|
unit: 'c',
|
||||||
|
})),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
evalScope({
|
||||||
|
loopAt,
|
||||||
|
fit,
|
||||||
|
all,
|
||||||
|
hush,
|
||||||
|
setCps,
|
||||||
|
setcps: setCps,
|
||||||
|
setCpm,
|
||||||
|
setcpm: setCpm,
|
||||||
|
});
|
||||||
|
const setCode = (code) => updateState({ code });
|
||||||
|
return { scheduler, evaluate, start, stop, pause, setCps, setPattern, setCode, toggle, state };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getTrigger =
|
||||||
|
({ getTime, defaultOutput }) =>
|
||||||
|
async (hap, deadline, duration, cps) => {
|
||||||
|
try {
|
||||||
|
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
|
||||||
|
await defaultOutput(hap, deadline, duration, cps);
|
||||||
|
}
|
||||||
|
if (hap.context.onTrigger) {
|
||||||
|
// call signature of output / onTrigger is different...
|
||||||
|
await hap.context.onTrigger(getTime() + deadline, hap, getTime(), cps);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger(`[cyclist] error: ${err.message}`, 'error');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user