egatari 0.6.13 → 0.6.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -1
- package/README.ja.md +46 -46
- package/bin/egatari.mjs +6 -6
- package/components.lock.json +507 -153
- package/components2.lock.json +1710 -33
- package/kit/build.mjs +3 -1
- package/kit/check-messages.mjs +23 -8
- package/kit/check.mjs +27 -15
- package/kit/core/article-messages.mjs +4 -4
- package/kit/core/article-render.mjs +1 -1
- package/kit/core/article-text.mjs +3 -1
- package/kit/core/build-core.mjs +28 -6
- package/kit/core/check-parity.mjs +3 -1
- package/kit/core/check-rules.mjs +6 -4
- package/kit/core/colab-core.mjs +3 -3
- package/kit/core/comment-core.mjs +6 -0
- package/kit/core/image-size.mjs +35 -0
- package/kit/core/layout-scan.mjs +89 -2
- package/kit/core/llm-fix.mjs +39 -6
- package/kit/core/llm-pack-assemble.mjs +5 -2
- package/kit/core/llm-pack-data.mjs +269 -83
- package/kit/core/llm-pack.mjs +3 -3
- package/kit/core/new-deck.mjs +17 -3
- package/kit/core/part-labels.mjs +9 -3
- package/kit/core/parts2.mjs +1 -1
- package/kit/core/player.mjs +18 -0
- package/kit/core/portable.mjs +44 -4
- package/kit/core/purposes.mjs +6 -3
- package/kit/core/readable-parts.mjs +42 -0
- package/kit/core/themes-lock.mjs +1 -1
- package/kit/core/tier-a.mjs +14 -2
- package/kit/deck.js +49 -2
- package/kit/instruction-version.json +1 -1
- package/kit/live.js +6 -6
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/presenter.js +3 -1
- package/kit/readable-parts.mjs +25 -0
- package/kit/tools.js +11 -4
- package/package.json +4 -2
- package/server/dev.mjs +7 -6
- package/server/editor-ui.js +9 -4
- package/server/hints.js +22 -2
- package/tts/yomi.yaml +1 -1
- package/vendor/components/CATALOG.md +21 -14
- package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/README.en.md +40 -0
- package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/index.js +408 -0
- package/vendor/components/sha256/0396a1895978803ae342b7f598f187b17ead47800e8f8317a5cb041111349813/index.js +278 -0
- package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/README.en.md +26 -0
- package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/index.js +322 -0
- package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/README.en.md +54 -0
- package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/index.js +470 -0
- package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/README.en.md +18 -0
- package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/index.js +279 -0
- package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/README.en.md +31 -0
- package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/index.js +267 -0
- package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/README.en.md +53 -0
- package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/index.js +171 -0
- package/vendor/components/sha256/1117758820dc561f41cf9d1cc0bab8cf3173cde7771ac10a12b94c96007c0f55/index.js +268 -0
- package/vendor/components/sha256/137017ad452afe209bdff81bc02ffae99c6b60a1c4aed2383515974f65511ff2/index.js +205 -0
- package/vendor/components/sha256/1a1471ba5f68e54304825a64e736afeda421e3763cdcbcdab2e45509562a0291/index.js +607 -0
- package/vendor/components/sha256/1b15fcc12b2fa43821e6299e87aae31aa69dbbc5a0d1b80088a5d7c5f8b8f7f5/index.js +429 -0
- package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/README.en.md +23 -0
- package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/index.js +147 -0
- package/vendor/components/sha256/21c099461befc0d382ddfe982f2a6cd8eeb6dd731252164ac619525e4bacdf0d/index.js +242 -0
- package/vendor/components/sha256/2352e0e22460f4a3c46dca6cef27cd9c63f161a411f1cf56c75c585e9124503c/index.js +315 -0
- package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/README.en.md +53 -0
- package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/index.js +171 -0
- package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/README.en.md +38 -0
- package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/index.js +414 -0
- package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/README.en.md +45 -0
- package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/index.js +211 -0
- package/vendor/components/sha256/2f111b900898579b3ec1611c2110db336a46d9133171a0cbb125ee37bd1f24f8/index.js +592 -0
- package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/README.en.md +45 -0
- package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/index.js +211 -0
- package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/README.en.md +20 -0
- package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/index.js +310 -0
- package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/README.en.md +35 -0
- package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/index.js +179 -0
- package/vendor/components/sha256/3af0b84b1799fc64ec74d6da9cbd343eccd89e8a11c81bfb444562c911284442/index.js +342 -0
- package/vendor/components/sha256/3c69bf3b3c6b9f76048fbc0839b3aa9699723570086d3d44bac799230ed6de5b/index.js +121 -0
- package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/README.en.md +37 -0
- package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/index.js +501 -0
- package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/README.en.md +38 -0
- package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/index.js +414 -0
- package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/README.en.md +30 -0
- package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/index.js +305 -0
- package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/README.en.md +31 -0
- package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/index.js +236 -0
- package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/README.en.md +21 -0
- package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/index.js +108 -0
- package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/README.en.md +28 -0
- package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/index.js +213 -0
- package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/README.en.md +35 -0
- package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/index.js +179 -0
- package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/README.en.md +53 -0
- package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/index.js +171 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/chords.json +89 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/extras.json +192 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ties.json +360 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/index.js +508 -0
- package/vendor/components/sha256/59996a56df462b36e24a928d4397c9308d9e39ad8224ebd19fb5c981608ef458/index.js +521 -0
- package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/README.en.md +30 -0
- package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/index.js +305 -0
- package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/README.en.md +30 -0
- package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/index.js +192 -0
- package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/README.en.md +20 -0
- package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/index.js +307 -0
- package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/README.en.md +24 -0
- package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/index.js +554 -0
- package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/README.en.md +25 -0
- package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/index.js +316 -0
- package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/README.en.md +18 -0
- package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/index.js +279 -0
- package/vendor/components/sha256/624acb997c4975ace65570b529b3ba00baa421c80ecb7fc80f392a64e8c573a7/index.js +107 -0
- package/vendor/components/sha256/62602488ee33dd4bdef8516de16da5ab27d7f7265d5041681beab80e08f1d482/index.js +97 -0
- package/vendor/components/sha256/67eaf344bddac79b74ed03fdcd70285c7b52b160e6c5ffbd6897848179aa5230/index.js +818 -0
- package/vendor/components/sha256/682c9c8871eccd19ff1264e0323a2e4c5798b0488b612ba0339c6fe85aab5914/index.js +926 -0
- package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/README.en.md +51 -0
- package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/index.js +230 -0
- package/vendor/components/sha256/72138936ed0b8fd3cb0214ae7ed250ae3f1f8b21ed6fd593544947774064ba0d/index.js +250 -0
- package/vendor/components/sha256/74c1a0f3ed1370c5003aa5770ee28cea2ce994d415680116a92fdbcd5854ba62/index.js +198 -0
- package/vendor/components/sha256/76125035eb153b98befa9c735bcd9fc4f99f774dc1d082fdae40acaadfe7d95b/index.js +818 -0
- package/vendor/components/sha256/7728cf7dde88a6688aba0ed70f23f7e21362a147beac09c1fa1a4b773e08e93b/index.js +354 -0
- package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/README.en.md +23 -0
- package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/index.js +289 -0
- package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/README.en.md +31 -0
- package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/index.js +236 -0
- package/vendor/components/sha256/7d50e50fbb6c5ec636b62509bd88ddaac1870e0522cf11bcc293ce924d48072d/index.js +312 -0
- package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/README.en.md +42 -0
- package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/index.js +549 -0
- package/vendor/components/sha256/87fc302c41b2bfeea88951ed689ec01b4dc79218c4bc69b310dc2228dfa2e153/index.js +926 -0
- package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/README.en.md +24 -0
- package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/index.js +103 -0
- package/vendor/components/sha256/89c8c16788e24df17920542ed6eb6557dea4a10e835de8fe839e439ccbba8014/index.js +69 -0
- package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/README.en.md +44 -0
- package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/index.js +304 -0
- package/vendor/components/sha256/8d9af78aef44ad2f98101c67d32473373d39725a09c923969aa621d5f5b124bb/index.js +121 -0
- package/vendor/components/sha256/8f861d71df72a82be86a3e63abf7d69bbab5aac6fa68be6e077c4e19c3519ed8/index.js +312 -0
- package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/README.en.md +54 -0
- package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/index.js +470 -0
- package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/README.en.md +24 -0
- package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/index.js +214 -0
- package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/README.en.md +33 -0
- package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/index.js +390 -0
- package/vendor/components/sha256/9289efef4a75afe011e54a17e34db08cfb16a450b2e0653e6a98525495cfba99/index.js +315 -0
- package/vendor/components/sha256/93256a923199ea51108cdb7491c3c96f376dbef15b64cbf1a1aa7cc5726b4970/index.js +429 -0
- package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/README.en.md +24 -0
- package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/index.js +550 -0
- package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/README.en.md +28 -0
- package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/index.js +213 -0
- package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/README.en.md +40 -0
- package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/index.js +348 -0
- package/vendor/components/sha256/97c074a5473618c65f4c23263f056870a0b7940e73475f2a1f32f68c08d8eb0f/index.js +198 -0
- package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/README.en.md +66 -0
- package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/index.js +984 -0
- package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/README.en.md +34 -0
- package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/index.js +244 -0
- package/vendor/components/sha256/a18b2b15d00c76462a43823b5c270c7ddd7c31794da9c236f74f20f80ec2ffdb/index.js +354 -0
- package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/README.en.md +32 -0
- package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/index.js +222 -0
- package/vendor/components/sha256/a979207c60fbd2a12cb557297eb0217eb098d660de684530a0f43d0d9c64e6ef/index.js +312 -0
- package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/README.en.md +34 -0
- package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/index.js +244 -0
- package/vendor/components/sha256/af7ed69b8969f6da14784b6e9d26e4dfd20147772ea172a99bd936a71be10fcd/index.js +278 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/chords.json +89 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/extras.json +192 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ties.json +360 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/index.js +508 -0
- package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/README.en.md +66 -0
- package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/index.js +990 -0
- package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/README.en.md +24 -0
- package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/index.js +550 -0
- package/vendor/components/sha256/b8096d7a60609520981273673761a110e40e3bdf52a7ab5548363b20e16f6e93/index.js +404 -0
- package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/README.en.md +32 -0
- package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/index.js +222 -0
- package/vendor/components/sha256/bd8e3893df02411deccc1d6d7b02292ca0d59dfeddfafcf99419430981572c82/index.js +351 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/chords.json +89 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/extras.json +192 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ties.json +360 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/index.js +508 -0
- package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/README.en.md +31 -0
- package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/index.js +267 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/LICENSE-strokesvg.txt +115 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/OFL.txt +93 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/index.js +749 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/strokes-CHANGES.md +20 -0
- package/vendor/components/sha256/c791e69e722f64146242f97acb29a341160d0c327cfe1d76307954d80e70db85/index.js +268 -0
- package/vendor/components/sha256/c8c0de41d603b61c6ec4dc1da5b50559e213dd1f3693ee5019df858016fd6daf/index.js +747 -0
- package/vendor/components/sha256/c99d4f2ab443484b9f462e405c72ea4794838b88f8823f27c606d12cbbedb996/index.js +404 -0
- package/vendor/components/sha256/cbde046e30c35db60259911a88e2ae0bedaf545e29b1da8b8ce13bc602a33c19/index.js +465 -0
- package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/README.en.md +51 -0
- package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/index.js +228 -0
- package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/README.en.md +35 -0
- package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/index.js +179 -0
- package/vendor/components/sha256/cf0985ffcd8e7cbe2175ddb9a4342b2a4aa3f322794188fc99af8789b494460d/index.js +521 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/LICENSE-strokesvg.txt +115 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/OFL.txt +93 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/index.js +749 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/strokes-CHANGES.md +20 -0
- package/vendor/components/sha256/d01dc7fd78d08dd720ed86b39d7877dc0913d72e914036088a86af2df2faee52/index.js +484 -0
- package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/README.en.md +24 -0
- package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/index.js +214 -0
- package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/README.en.md +31 -0
- package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/index.js +271 -0
- package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/README.en.md +25 -0
- package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/index.js +316 -0
- package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/README.en.md +23 -0
- package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/index.js +120 -0
- package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/README.en.md +40 -0
- package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/index.js +405 -0
- package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/README.en.md +66 -0
- package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/index.js +984 -0
- package/vendor/components/sha256/ddd4b9cbbc282cbb3117ff662e1a14ecdb3cc7c16072a574418ec6a6eecef4d8/index.js +107 -0
- package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/README.en.md +22 -0
- package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/index.js +145 -0
- package/vendor/components/sha256/e2da948daac7bfac158857877b5a6932dbd2369e73901abcef118c92dd20b725/index.js +747 -0
- package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/README.en.md +42 -0
- package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/index.js +268 -0
- package/vendor/components/sha256/e653a4da80f7761442dc5b504ea5b0700fd0acf1979beeff56122cfdb3d4654c/index.js +607 -0
- package/vendor/components/sha256/ea217c6821e931b2d8474bf56d38f2dcc89ec705fe1d276f313e1c7e8db2b98a/index.js +233 -0
- package/vendor/components/sha256/ea2e4e24838574f607879c7d05556281258c018331e4da3e6f3a5263173f2e99/index.js +75 -0
- package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/README.en.md +42 -0
- package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/index.js +549 -0
- package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/README.en.md +44 -0
- package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/index.js +203 -0
- package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/README.en.md +34 -0
- package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/index.js +244 -0
- package/vendor/components/sha256/fa1a09c10181456143d125d68dbbdcacde6bab2e4a2b3e573367103ce28ebf55/index.js +228 -0
- package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/README.en.md +51 -0
- package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/index.js +228 -0
- package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/README.en.md +23 -0
- package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/index.js +147 -0
- package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/README.en.md +20 -0
- package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/index.js +307 -0
- package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/README.en.md +26 -0
- package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/index.js +322 -0
- package/vendor/components-2/manifest-2.12.0.json +2348 -0
- package/vendor/components-2/manifest-2.13.0.json +2477 -0
- package/vendor/components-2/manifest-2.14.0.json +2460 -0
- package/vendor/components-2/manifest-2.14.1.json +2460 -0
- package/vendor/components-2/manifest-2.15.0.json +2460 -0
- package/vendor/egatari-spec/SOURCE.json +3 -3
- package/vendor/egatari-spec/schema/deck-meta.schema.json +15 -0
- package/vendor/egatari-spec/schema/egatari-metadata.schema.json +15 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
// m-cycle:循環の図。段階の箱を円(横に長い場所では楕円)の上に 12 時から時計回りに並べ、となりの段階へ円に沿った矢印でつなぐ
|
|
2
|
+
// <m-cycle style="height:420px"><script type="application/json">
|
|
3
|
+
// {"center": {"label": "PDCA"},
|
|
4
|
+
// "nodes": [{"label": "計画", "note": "目標と手順"}, {"label": "実行"}, {"label": "評価"}, {"label": "改善"}]}
|
|
5
|
+
// (JSON の終わり)</m-cycle>
|
|
6
|
+
// 座標はデータに書かない(docs/conventions.md §2)。配列の順に回り、最後から最初へ戻る矢印は自動で引く(最後の段階と一緒に出る)
|
|
7
|
+
// 段階は 3〜8 個を想定。箱の幅は字数から見積もる(字の読み込みを待たない)。入らなければ字を 24px まで縮め、それでも入らなければ ctx.report("size", …)
|
|
8
|
+
// center(任意):真ん中の名前。最初の段階と一緒に出る(center.step で変えられる)
|
|
9
|
+
// 段階:既定は 1 段階に 1 つ(per-step で n 個ずつ、node の step で直接、at で段階の中の開始秒)
|
|
10
|
+
// 見せ方(docs/conventions.md §2.5):fade(既定。箱が下から 12 px 上がりながら現れてから入ってくる矢印を引く)・draw(矢印を先に引き、
|
|
11
|
+
// その先に箱が前の箱の側から 12 px 寄りながら出る)・grow(矢印を引きながら、箱が前の箱の側から 12 px 寄って 0.92 → 1 に大きくなる)。
|
|
12
|
+
// 箱の動きはどれも 12 px まで。段階の数・長さ・合図・最後の中身はどれも同じ
|
|
13
|
+
// 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・mtext・prog・lerp・variant・previewOpacity を使い、プレイヤーのグローバルは使わない。
|
|
14
|
+
// 式(tex)は組み立てのときに KaTeX で描く(spec §6.2):build.fields の nodes[].tex・center.tex を作り手が描いて texHtml を足し、
|
|
15
|
+
// この部品は markup-reader で決まった要素と属性だけを読んで置く(再生のときに KaTeX は動かない)。描いた結果がなければ tex を字のまま出して知らせる。
|
|
16
|
+
// データの問題(ない箱を指す辺)と、入らないときは ctx.report で知らせる(1.x の console.warn の代わり)。
|
|
17
|
+
// 配置を決める内部の関数は arrange(size)(1.x の layout(size)。2.0 の layout(ctx) は再生器が呼ぶので名前を分けた)
|
|
18
|
+
egatariParts.define({name: "cycle", version: "2.0.6", requires: {base: "1.3.0", "markup-reader": "1.0.3"}, element: "m-cycle"}, function(deps){
|
|
19
|
+
"use strict";
|
|
20
|
+
var base = deps.base, MR = deps["markup-reader"];
|
|
21
|
+
var Part = class extends base.MotionElement {
|
|
22
|
+
static partName = "cycle"; // the registry name (define meta name), for report prefixes
|
|
23
|
+
// 組み立てのときに描く欄(spec §6.2)。式の意味は字(tex)でも持つので、KaTeX の出力は HTML だけ
|
|
24
|
+
static build = {fields: {"nodes[].tex": "katex", "center.tex": "katex"}, options: {katex: {output: "html"}}};
|
|
25
|
+
static variants = ["fade", "draw", "grow"];
|
|
26
|
+
// データの形(kit/shape.js)
|
|
27
|
+
static shape = {
|
|
28
|
+
schema: {type: "object", additionalProperties: false, required: ["nodes"], properties: {
|
|
29
|
+
nodes: {type: "array", minItems: 2, items: {type: "object", properties: {
|
|
30
|
+
id: {type: ["string", "integer"]}, label: {type: "string"}, tex: {type: "string"}, texHtml: {type: "string"}, note: {type: "string"}, tone: {type: "string"},
|
|
31
|
+
step: {type: "integer"}, at: {type: "number"}}}},
|
|
32
|
+
center: {type: "object", properties: {label: {type: "string"}, tex: {type: "string"}, texHtml: {type: "string"}, note: {type: "string"}, tone: {type: "string"},
|
|
33
|
+
step: {type: "integer"}, at: {type: "number"}}},
|
|
34
|
+
edges: {type: "array", items: {type: "object", required: ["from", "to"], properties: {
|
|
35
|
+
from: {type: ["string", "integer"]}, to: {type: ["string", "integer"]}, label: {type: "string"}, tone: {type: "string"}, dash: {type: "boolean"},
|
|
36
|
+
step: {type: "integer"}, at: {type: "number"}}}},
|
|
37
|
+
renderers: {type: "object"}}},
|
|
38
|
+
example: {center: {label: "PDCA"}, nodes: [{label: "計画"}, {label: "実行"}, {label: "評価"}, {label: "改善"}]},
|
|
39
|
+
};
|
|
40
|
+
static props = {
|
|
41
|
+
"per-step": {type: "number", default: 1, doc: "1 ステップに出す箱の数(0 = 全部をステップ 1 で)"},
|
|
42
|
+
size: {type: "number", default: 26, doc: "箱の字の大きさ(px。入らなければ 24 まで縮める)"},
|
|
43
|
+
dur: {type: "number", default: 0.8, doc: "1 つの項目(入ってくる矢印と箱)が現れる秒数"},
|
|
44
|
+
stagger: {type: "number", default: 0.3, doc: "同じステップの箱の出だしのずれ(秒)"},
|
|
45
|
+
};
|
|
46
|
+
get steps(){
|
|
47
|
+
if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
|
|
48
|
+
var p = this.plan(), m = p.center ? p.center.step : 0;
|
|
49
|
+
p.stages.concat(p.arrows, p.edges).forEach(function(o){ m = Math.max(m, o.step); });
|
|
50
|
+
return m;
|
|
51
|
+
}
|
|
52
|
+
plan(){
|
|
53
|
+
if (this._plan) return this._plan;
|
|
54
|
+
var notes = this._notes = []; // データの問題:mount が ctx.report で知らせる(段階の数を数えるときには ctx がない)
|
|
55
|
+
var P = this.props, per = P["per-step"], T = P.dur, data = this.data || {}, seen = {};
|
|
56
|
+
var stages = (data.nodes || []).map(function(n, i){
|
|
57
|
+
var step = n.step !== undefined ? n.step : per > 0 ? Math.floor(i / per) + 1 : 1, j = seen[step] = (seen[step] || 0) + 1;
|
|
58
|
+
return {n: n, i: i, step: step, at0: n.at !== undefined ? n.at : +((j - 1) * P.stagger).toFixed(3)};
|
|
59
|
+
});
|
|
60
|
+
stages.forEach(function(o){ o.at = o.at0; });
|
|
61
|
+
var N = stages.length, arrows = [];
|
|
62
|
+
// 矢印 i:段階 i から i + 1 へ(最後は最初へ戻る)。後に出る端の段階と一緒に出る
|
|
63
|
+
for (var i = 0; i < N && N > 1; i++){
|
|
64
|
+
var a = stages[i], b = stages[(i + 1) % N], closing = i === N - 1;
|
|
65
|
+
var owner = closing ? (a.step >= b.step ? a : b) : (b.step >= a.step ? b : a);
|
|
66
|
+
// ふつうは入っていく先の箱と一緒(見せ方で順が変わる)。戻る矢印と、先の箱がもう出ているものは、持ち主の箱が出終わってから
|
|
67
|
+
var withBox = !closing && owner === b;
|
|
68
|
+
arrows.push({i: i, from: a, to: b, step: owner.step, owner: owner, withBox: withBox, at: withBox ? owner.at : +(owner.at + T).toFixed(3)});
|
|
69
|
+
}
|
|
70
|
+
stages.forEach(function(o){ o.inArrow = null; });
|
|
71
|
+
arrows.forEach(function(r){ if (r.withBox) r.to.inArrow = r; });
|
|
72
|
+
var c = data.center ? {n: data.center, step: data.center.step !== undefined ? data.center.step : stages.length ? stages[0].step : 1, at: data.center.at || 0} : null;
|
|
73
|
+
var byId = {};
|
|
74
|
+
stages.forEach(function(o){ if (o.n.id !== undefined) byId[o.n.id] = o; });
|
|
75
|
+
var edges = (data.edges || []).map(function(e){
|
|
76
|
+
var a = byId[e.from], b = byId[e.to];
|
|
77
|
+
if (!a || !b){ notes.push("[cycle] an edge refers to an unknown node: " + JSON.stringify(e.from) + " → " + JSON.stringify(e.to) + " (not drawn)"); return null; }
|
|
78
|
+
var step = e.step !== undefined ? e.step : Math.max(a.step, b.step), at = 0;
|
|
79
|
+
[a, b].forEach(function(o){ if (o.step === step) at = Math.max(at, o.at + T); });
|
|
80
|
+
return {e: e, a: a, b: b, step: step, at: e.at !== undefined ? e.at : at};
|
|
81
|
+
}).filter(Boolean);
|
|
82
|
+
return (this._plan = {stages: stages, arrows: arrows, center: c, edges: edges});
|
|
83
|
+
}
|
|
84
|
+
mount(ctx){
|
|
85
|
+
var P = this.props, D = base, self = this;
|
|
86
|
+
this.variant = base.variant(this);
|
|
87
|
+
this.plan();
|
|
88
|
+
this._notes.forEach(function(m){ ctx.report("data", m); });
|
|
89
|
+
this.texSink = MR.sink(this, ctx);
|
|
90
|
+
this.style.display = "block"; this.style.position = "relative";
|
|
91
|
+
var W = this.W = this.clientWidth, H = this.H = this.clientHeight;
|
|
92
|
+
this.svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
|
|
93
|
+
this.reportLayout = function(msg){ ctx.report("layout", msg); }; // draw の知らせ(名前の置き場がない辺)
|
|
94
|
+
// size:24 より小さい字は使わない(24 にする)。数でなければ既定の 26
|
|
95
|
+
var s0 = P.size;
|
|
96
|
+
if (!(typeof s0 === "number" && isFinite(s0))){ ctx.report("attr", "[cycle] size=\"" + this.getAttribute("size") + "\" is not a number (26 is used)"); s0 = 26; }
|
|
97
|
+
else if (s0 < 24){ ctx.report("attr", "[cycle] size=\"" + this.getAttribute("size") + "\" is below 24 (text is at least 24px; 24 is used)"); s0 = 24; }
|
|
98
|
+
var L = null;
|
|
99
|
+
for (var s = s0; ; s = Math.max(24, s - 2)){
|
|
100
|
+
L = this.arrange(s);
|
|
101
|
+
if (L.fits || s <= 24) break;
|
|
102
|
+
}
|
|
103
|
+
if (!L.fits) ctx.report("size", "[cycle] the cycle does not fit its box even at 24px (" + L.why + "); make the element larger or shorten the labels");
|
|
104
|
+
this.draw(L);
|
|
105
|
+
// 読み上げ:最後の形(一回りと、ほかのつながり)を 1 文で。作者の aria-label があればそれを使う(上書きしない)
|
|
106
|
+
if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
|
|
107
|
+
this.setAttribute("role", "img");
|
|
108
|
+
if (!this._aria) this.setAttribute("aria-label", this.summary(/^ja\b/i.test(ctx.lang || "ja")));
|
|
109
|
+
this.texSink.flush(); // what the formulas have to report, once per kind (spec §6.2)
|
|
110
|
+
}
|
|
111
|
+
arrange(size){
|
|
112
|
+
var self = this, W = this.W, H = this.H, pl = this.plan(), N = pl.stages.length, why = [];
|
|
113
|
+
var th = function(i){ return -Math.PI / 2 + 2 * Math.PI * i / N; };
|
|
114
|
+
var boxes = pl.stages.map(function(o, i){
|
|
115
|
+
var lines = labelLines(o.n, size, textFill(o.n.tone));
|
|
116
|
+
// 強調の箱(--emph-tint の地)の中の補足は --fg(--muted では 4.5:1 に届かない。共通の決まり §2.3)
|
|
117
|
+
if (o.n.note) lines.push({text: o.n.note, size: 24, fill: o.n.tone === "emph" ? "var(--fg)" : "var(--muted)"});
|
|
118
|
+
var bs = boxSize(self, lines);
|
|
119
|
+
return {o: o, bs: bs, w: bs.w, h: bs.h, th: th(i)};
|
|
120
|
+
});
|
|
121
|
+
var cen = null;
|
|
122
|
+
if (pl.center){
|
|
123
|
+
var cl = labelLines(pl.center.n, size + 4).map(function(l){ l.weight = 700; l.fill = tone(pl.center.n.tone); return l; });
|
|
124
|
+
if (pl.center.n.note) cl.push({text: pl.center.n.note, size: 24, fill: "var(--muted)"});
|
|
125
|
+
cen = boxSize(self, cl);
|
|
126
|
+
}
|
|
127
|
+
// 縦:箱と円の上端から下端までが H に入る最大の ry(二分法)。横:箱と円が W に入る最大の rx(縦の 1.9 倍まで)。
|
|
128
|
+
// 円は縦に長くしない(ry ≤ rx の上限)
|
|
129
|
+
var span = function(ry){
|
|
130
|
+
var lo = -ry, hi = ry;
|
|
131
|
+
boxes.forEach(function(b){ var y = ry * Math.sin(b.th); lo = Math.min(lo, y - b.h / 2); hi = Math.max(hi, y + b.h / 2); });
|
|
132
|
+
return [lo, hi];
|
|
133
|
+
};
|
|
134
|
+
var rxMax = W / 2 - 4;
|
|
135
|
+
// 12 時と 6 時の箱(cos = 0)は rx によらない:要素より広ければ入らない
|
|
136
|
+
boxes.forEach(function(b, i){ var c = Math.abs(Math.cos(b.th)); if (c > 1e-6) rxMax = Math.min(rxMax, (W / 2 - 3 - b.w / 2) / c); else if (b.w > W - 6) why.push("box " + (i + 1) + " is " + Math.ceil(b.w) + "px wide, wider than the element (" + W + "px)"); });
|
|
137
|
+
var a = 0, b = H;
|
|
138
|
+
for (var it = 0; it < 40; it++){ var m = (a + b) / 2, sp = span(m); if (sp[1] - sp[0] <= H - 6) a = m; else b = m; }
|
|
139
|
+
var ry = Math.max(0, Math.min(a, rxMax)), sp = span(ry), cy = 3 - sp[0] + (H - 6 - (sp[1] - sp[0])) / 2, cx = W / 2;
|
|
140
|
+
var rx = Math.max(0, Math.min(rxMax, ry * 1.9));
|
|
141
|
+
if (ry < 40 || rx < 40) why.push("no room for the circle");
|
|
142
|
+
var P = function(t){ return [cx + rx * Math.cos(t), cy + ry * Math.sin(t)]; };
|
|
143
|
+
boxes.forEach(function(b){ var p = P(b.th); b.cx = p[0]; b.cy = p[1]; b.x = p[0] - b.w / 2; b.y = p[1] - b.h / 2; });
|
|
144
|
+
// 箱どうしが近すぎないか
|
|
145
|
+
for (var i = 0; i < N; i++) for (var j = i + 1; j < N; j++){
|
|
146
|
+
var p = boxes[i], q = boxes[j];
|
|
147
|
+
if (p.x < q.x + q.w + 8 && q.x < p.x + p.w + 8 && p.y < q.y + q.h + 8 && q.y < p.y + p.h + 8) why.push("boxes " + (i + 1) + " and " + (j + 1) + " overlap");
|
|
148
|
+
}
|
|
149
|
+
// 矢印:円に沿って、箱 i の外へ出たところから、箱 i+1 に入る手前まで(箱から 8px 空ける)
|
|
150
|
+
var inside = function(bx, t){ var p = P(t); return p[0] > bx.x - 8 && p[0] < bx.x + bx.w + 8 && p[1] > bx.y - 8 && p[1] < bx.y + bx.h + 8; };
|
|
151
|
+
var arcs = pl.arrows.map(function(r){
|
|
152
|
+
var A = boxes[r.i], B = boxes[(r.i + 1) % N], t0 = A.th, t1 = r.i === N - 1 ? B.th + 2 * Math.PI : B.th, d = 0.002;
|
|
153
|
+
while (t0 < t1 && inside(A, t0)) t0 += d;
|
|
154
|
+
while (t1 > t0 && inside(B, t1)) t1 -= d;
|
|
155
|
+
var len = 0, q = P(t0);
|
|
156
|
+
for (var t = t0 + d; t <= t1; t += d){ var p2 = P(t); len += Math.hypot(p2[0] - q[0], p2[1] - q[1]); q = p2; }
|
|
157
|
+
if (len < 30) why.push("no room for the arrow from " + (r.i + 1));
|
|
158
|
+
return {r: r, t0: t0, t1: t1, len: len};
|
|
159
|
+
});
|
|
160
|
+
if (cen){
|
|
161
|
+
var hw = cen.w / 2 + 16, hh = cen.h / 2 + 16;
|
|
162
|
+
if (Math.pow(hw / rx, 2) + Math.pow(hh / ry, 2) > 1) why.push("the center label is too large for the circle");
|
|
163
|
+
boxes.forEach(function(b){ if (Math.abs(b.cx - cx) < b.w / 2 + hw && Math.abs(b.cy - cy) < b.h / 2 + hh) why.push("the center label touches a box"); });
|
|
164
|
+
}
|
|
165
|
+
return {fits: !why.length, why: why.join("; "), size: size, boxes: boxes, arcs: arcs, cen: cen, cx: cx, cy: cy, rx: rx, ry: ry};
|
|
166
|
+
}
|
|
167
|
+
draw(L){
|
|
168
|
+
var D = base, self = this, svg = this.svg;
|
|
169
|
+
var gA = D.el("g", {}, svg), gB = D.el("g", {}, svg), gE = D.el("g", {}, svg), gC = D.el("g", {}, svg);
|
|
170
|
+
this.L = L;
|
|
171
|
+
this.pt = function(t){ return [L.cx + L.rx * Math.cos(t), L.cy + L.ry * Math.sin(t)]; };
|
|
172
|
+
var rects = {};
|
|
173
|
+
this.boxes = L.boxes.map(function(b){
|
|
174
|
+
var col = tone(b.o.n.tone), g = D.el("g", {opacity: 0}, gB);
|
|
175
|
+
D.el("rect", {class: "box", x: b.x.toFixed(1), y: b.y.toFixed(1), width: b.w, height: b.h, rx: 12, fill: boxFill(b.o.n.tone), stroke: col, "stroke-width": b.o.n.tone === "emph" ? 3 : 2.2}, g);
|
|
176
|
+
boxDraw(self, g, b.x, b.y, b.bs);
|
|
177
|
+
if (b.o.n.id !== undefined) rects[b.o.n.id] = b;
|
|
178
|
+
return {b: b, g: g, o: b.o};
|
|
179
|
+
});
|
|
180
|
+
this.arcs = L.arcs.map(function(a){
|
|
181
|
+
var col = "var(--muted)", g = D.el("g", {opacity: 0}, gA);
|
|
182
|
+
return {a: a, r: a.r, g: g, path: D.el("path", {d: "", fill: "none", stroke: col, "stroke-width": 3, "stroke-linecap": "round"}, g),
|
|
183
|
+
head: D.el("path", {d: "M0,0L-16,-7L-16,7Z", fill: col}, g)};
|
|
184
|
+
});
|
|
185
|
+
// 前の段階の箱から、この箱へ向かう向き(draw と grow で箱が寄ってくる向き)
|
|
186
|
+
this.boxes.forEach(function(o, i){
|
|
187
|
+
var q = L.boxes[(i + L.boxes.length - 1) % L.boxes.length], dx = o.b.cx - q.cx, dy = o.b.cy - q.cy, dl = Math.hypot(dx, dy) || 1;
|
|
188
|
+
o.dir = [dx / dl, dy / dl];
|
|
189
|
+
});
|
|
190
|
+
this.center = null;
|
|
191
|
+
if (L.cen){
|
|
192
|
+
var g = D.el("g", {opacity: 0}, gC);
|
|
193
|
+
boxDraw(self, g, L.cx - L.cen.w / 2, L.cy - L.cen.h / 2, L.cen);
|
|
194
|
+
this.center = {g: g};
|
|
195
|
+
}
|
|
196
|
+
this.edges = this.plan().edges.map(function(x){
|
|
197
|
+
var e = x.e, A = rects[e.from], B = rects[e.to];
|
|
198
|
+
if (!A || !B) return null;
|
|
199
|
+
var dx = B.cx - A.cx, dy = B.cy - A.cy, Lh = Math.hypot(dx, dy) || 1;
|
|
200
|
+
var cut = function(R, sx, sy){ var s = Math.min(sx ? (R.w / 2 + 6) / Math.abs(sx) : Infinity, sy ? (R.h / 2 + 6) / Math.abs(sy) : Infinity); return [R.cx + sx * s, R.cy + sy * s]; };
|
|
201
|
+
var p0 = cut(A, dx / Lh, dy / Lh), p1 = cut(B, -dx / Lh, -dy / Lh), col = e.tone ? tone(e.tone) : "var(--muted)";
|
|
202
|
+
var g = D.el("g", {opacity: 0}, gE), ux = p1[0] - p0[0], uy = p1[1] - p0[1], l2 = Math.hypot(ux, uy) || 1;
|
|
203
|
+
D.el("line", {x1: p0[0].toFixed(1), y1: p0[1].toFixed(1), x2: (p1[0] - ux / l2 * 14).toFixed(1), y2: (p1[1] - uy / l2 * 14).toFixed(1), stroke: col, "stroke-width": 3, "stroke-dasharray": e.dash === false ? "none" : "8 6"}, g);
|
|
204
|
+
D.el("path", {d: "M0,0L-16,-7L-16,7Z", fill: col, transform: "translate(" + p1[0].toFixed(1) + " " + p1[1].toFixed(1) + ") rotate(" + (Math.atan2(uy, ux) * 180 / Math.PI).toFixed(1) + ")"}, g);
|
|
205
|
+
if (e.label){
|
|
206
|
+
// 名前は線の横に(線・真ん中の名前・箱と重ならない所。なければ知らせる)
|
|
207
|
+
var obst = L.boxes.map(function(b){ return {x: b.x, y: b.y, w: b.w, h: b.h}; });
|
|
208
|
+
if (L.cen) obst.push({x: L.cx - L.cen.w / 2, y: L.cy - L.cen.h / 2, w: L.cen.w, h: L.cen.h});
|
|
209
|
+
var at = sideLabel(p0, p1, est(e.label, 24, self), 30, obst, self.W, self.H);
|
|
210
|
+
if (!at.ok) self.reportLayout("[cycle] the label \"" + e.label + "\" of the edge " + JSON.stringify(e.from) + " → " + JSON.stringify(e.to) + " has no free place beside its line (it may overlap; make the element larger or the label shorter)");
|
|
211
|
+
D.mtext(g, at.x, at.y, e.label, {"text-anchor": "middle", "font-size": 24, fill: e.tone ? col : "var(--muted)"});
|
|
212
|
+
}
|
|
213
|
+
return {g: g, step: x.step, at: x.at};
|
|
214
|
+
}).filter(Boolean);
|
|
215
|
+
}
|
|
216
|
+
// 最後の形を 1 文で(読み上げの名前):「循環(PDCA):計画:目標と手順 → 実行 → 評価 → 改善 → 計画に戻る。ほかのつながり:計画 → 評価(見直し)」
|
|
217
|
+
summary(ja){
|
|
218
|
+
var pl = this.plan(), one = function(n){ return String(n.label || n.tex || "").replace(/\s*\n\s*/g, " ").replace(/\*/g, ""); };
|
|
219
|
+
var full = function(n){ return one(n) + (n.note ? (ja ? ":" : ": ") + n.note : ""); };
|
|
220
|
+
var st = pl.stages.map(function(o){ return full(o.n); });
|
|
221
|
+
var s = (ja ? "循環" : "Cycle") + (pl.center ? (ja ? "(" + full(pl.center.n) + ")" : " (" + full(pl.center.n) + ")") : "") + (ja ? ":" : ": ") +
|
|
222
|
+
st.join(" → ") + (st.length > 1 ? (ja ? " → " + one(pl.stages[0].n) + "に戻る" : " → back to " + one(pl.stages[0].n)) : "");
|
|
223
|
+
var ed = pl.edges.map(function(x){ return one(x.a.n) + " → " + one(x.b.n) + (x.e.label ? (ja ? "(" + x.e.label + ")" : " (" + x.e.label + ")") : ""); });
|
|
224
|
+
if (ed.length) s += (ja ? "。ほかのつながり:" : ". Other links: ") + ed.join(ja ? "、" : ", ");
|
|
225
|
+
return s;
|
|
226
|
+
}
|
|
227
|
+
duration(k){
|
|
228
|
+
var T = this.props.dur, p = this.plan(), d = 0;
|
|
229
|
+
p.stages.forEach(function(o){ if (o.step === k) d = Math.max(d, o.at + T); });
|
|
230
|
+
p.arrows.forEach(function(o){ if (o.step === k && !o.withBox) d = Math.max(d, o.at + 0.5); });
|
|
231
|
+
if (p.center && p.center.step === k) d = Math.max(d, p.center.at + 0.45);
|
|
232
|
+
p.edges.forEach(function(o){ if (o.step === k) d = Math.max(d, o.at + 0.4); });
|
|
233
|
+
return d;
|
|
234
|
+
}
|
|
235
|
+
// 同じ段階の 2 つ目からの箱の開始時刻(口述原稿の {cue} に合わせられる)
|
|
236
|
+
cues(k){
|
|
237
|
+
var c = [];
|
|
238
|
+
this.plan().stages.forEach(function(o){ if (o.step === k && o.at0 > 0 && c.indexOf(o.at) < 0) c.push(o.at); });
|
|
239
|
+
return c.length ? c.sort(function(a, b){ return a - b; }) : null;
|
|
240
|
+
}
|
|
241
|
+
render(k, t, ctx){
|
|
242
|
+
var D = base, self = this, vr = this.variant, T = this.props.dur, L = this.L;
|
|
243
|
+
var lecture = !!ctx.preview, FAINT = 0.45;
|
|
244
|
+
if (lecture) FAINT = base.previewOpacity(this);
|
|
245
|
+
var pr = function(s, start, len){ return s < k ? 1 : s > k ? 0 : D.prog(t, start, len); };
|
|
246
|
+
// 授業の表示:後の段階は最後の形を薄く(テーマの --preview-opacity、ないときは 0.45)、今の段階はその薄さから濃くなる。形は動かさない(どの見せ方でも同じ)
|
|
247
|
+
var faint = function(s, start, len){ return s < k ? 1 : s > k ? FAINT : FAINT + (1 - FAINT) * D.prog(t, start, len); };
|
|
248
|
+
var boxE = {}, arrE = {};
|
|
249
|
+
// 段階ごとの箱と、一緒に出る入ってくる矢印の進み
|
|
250
|
+
// 箱の動きは 12 px まで(docs/conventions.md §1.2:どの見せ方も fade より遠くへ動かさない)
|
|
251
|
+
var OFF = 12;
|
|
252
|
+
this.boxes.forEach(function(o){
|
|
253
|
+
var s = o.o.step, st = o.o.at, op, sc = 1, e = 1, d = [0, -1], ar;
|
|
254
|
+
if (lecture){ op = faint(s, st, T); ar = 1; }
|
|
255
|
+
else if (vr === "draw"){
|
|
256
|
+
// 矢印を先に引き、その先に箱が前の箱の側から 12 px 寄りながら出る
|
|
257
|
+
ar = pr(s, st, 0.5 * T); e = op = pr(s, st + 0.45 * T, 0.55 * T); sc = 0.92 + 0.08 * e; d = o.dir;
|
|
258
|
+
} else if (vr === "grow"){
|
|
259
|
+
// 矢印を引きながら、箱が前の箱の側から 12 px 寄り、0.92 → 1 に大きくなる
|
|
260
|
+
ar = pr(s, st, 0.5 * T); e = pr(s, st + 0.3 * T, 0.55 * T); op = Math.min(1, e * 1.6); sc = 0.92 + 0.08 * e; d = o.dir;
|
|
261
|
+
} else {
|
|
262
|
+
// fade:箱が下から 12 px 上がりながら現れてから、入ってくる矢印を引く
|
|
263
|
+
e = op = pr(s, st, 0.55 * T); sc = 0.92 + 0.08 * e; ar = pr(s, st + 0.45 * T, 0.55 * T);
|
|
264
|
+
}
|
|
265
|
+
var dx = -d[0] * OFF * (1 - e), dy = -d[1] * OFF * (1 - e), cx = o.b.cx, cy = o.b.cy;
|
|
266
|
+
setIf(o.g, "opacity", op.toFixed(3));
|
|
267
|
+
setIf(o.g, "transform", sc >= 1 && Math.abs(dx) < 0.01 && Math.abs(dy) < 0.01 ? "" :
|
|
268
|
+
"translate(" + (cx + dx).toFixed(2) + " " + (cy + dy).toFixed(2) + ") scale(" + sc.toFixed(4) + ") translate(" + (-cx).toFixed(2) + " " + (-cy).toFixed(2) + ")");
|
|
269
|
+
if (o.o.inArrow) arrE[o.o.inArrow.i] = lecture ? [1, op] : [ar, 1];
|
|
270
|
+
});
|
|
271
|
+
this.arcs.forEach(function(o){
|
|
272
|
+
var r = o.r, v = arrE[r.i] || (lecture ? [1, faint(r.step, r.at, 0.5)] : [pr(r.step, r.at, 0.5), 1]);
|
|
273
|
+
var e = v[0], a = o.a, tc = a.t0 + (a.t1 - a.t0) * e;
|
|
274
|
+
setIf(o.g, "opacity", e > 0 ? v[1].toFixed(3) : 0);
|
|
275
|
+
// 見えない矢印も、render が書く属性はすべて書き直す(前の呼び出しの transform を残さない。docs/contract.md §3)
|
|
276
|
+
if (e <= 0){ setIf(o.path, "d", ""); if (o.head.hasAttribute("transform")) o.head.removeAttribute("transform"); return; }
|
|
277
|
+
// 線は矢じりの根元まで(矢じりは 14px、線が 20px 伸びるまでに大きくなる)
|
|
278
|
+
var p = self.pt(tc), sp = Math.hypot(L.rx * Math.sin(tc), L.ry * Math.cos(tc)) || 1;
|
|
279
|
+
var back = Math.min(14 / sp, tc - a.t0), te = tc - back, q0 = self.pt(a.t0), q1 = self.pt(te);
|
|
280
|
+
setIf(o.path, "d", "M" + q0[0].toFixed(2) + "," + q0[1].toFixed(2) + "A" + L.rx.toFixed(2) + "," + L.ry.toFixed(2) + " 0 " + (te - a.t0 > Math.PI ? 1 : 0) + " 1 " + q1[0].toFixed(2) + "," + q1[1].toFixed(2));
|
|
281
|
+
var ang = Math.atan2(L.ry * Math.cos(tc), -L.rx * Math.sin(tc)) * 180 / Math.PI, hs = Math.min(1, a.len * e / 20);
|
|
282
|
+
setIf(o.head, "transform", "translate(" + p[0].toFixed(2) + " " + p[1].toFixed(2) + ") rotate(" + ang.toFixed(2) + ") scale(" + hs.toFixed(4) + ")");
|
|
283
|
+
});
|
|
284
|
+
var c = this.plan().center;
|
|
285
|
+
if (this.center) setIf(this.center.g, "opacity", (lecture ? faint(c.step, c.at, 0.45) : pr(c.step, c.at, 0.45)).toFixed(3));
|
|
286
|
+
this.edges.forEach(function(o){ setIf(o.g, "opacity", (lecture ? faint(o.step, o.at, 0.4) : pr(o.step, o.at, 0.4)).toFixed(3)); });
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
// ---- 下の関数は m-cycle の中だけで使う(字の幅の見積もり・箱の中の行)
|
|
291
|
+
// 属性は値が変わるときだけ書く:同じ値を書き直しても Chrome は塗り直し、macOS では入り直すたびに箱の縁の画素が揺れた(DOM は同じ)
|
|
292
|
+
// 線 p0 → p1 の名前(幅 w、高さ h)の置き場:線の真ん中(次に 1/3・2/3・1/4・3/4・端の近く)の横に、線から離して(近くになければ 24・48 px 遠くへ)。
|
|
293
|
+
// 上(か左)の側を先に試す。箱 obst と枠の外を避ける。返すのは字の基線の中心 {x, y, ok}
|
|
294
|
+
function sideLabel(p0, p1, w, h, obst, W, H){
|
|
295
|
+
var ux = p1[0] - p0[0], uy = p1[1] - p0[1], l = Math.hypot(ux, uy) || 1, nx = -uy / l, ny = ux / l, first = null;
|
|
296
|
+
if (ny > 0 || (ny === 0 && nx > 0)){ nx = -nx; ny = -ny; }
|
|
297
|
+
var ts = [0.5, 0.35, 0.65, 0.25, 0.75, 0.1, 0.9];
|
|
298
|
+
for (var ex = 0; ex <= 48; ex += 24) for (var i = 0; i < ts.length; i++) for (var sd = 1; sd >= -1; sd -= 2){
|
|
299
|
+
var d = Math.abs(nx) * w / 2 + Math.abs(ny) * h / 2 + 8 + ex;
|
|
300
|
+
var cx = p0[0] + ux * ts[i] + sd * nx * d, cy = p0[1] + uy * ts[i] + sd * ny * d;
|
|
301
|
+
var b = {l: cx - w / 2, r: cx + w / 2, t: cy - h / 2, b: cy + h / 2};
|
|
302
|
+
var at = {x: cx, y: cy + 8, ok: true};
|
|
303
|
+
if (!first) first = at;
|
|
304
|
+
if (b.l < 0 || b.r > W || b.t < 0 || b.b > H) continue;
|
|
305
|
+
if (obst.some(function(o){ return b.l < o.x + o.w + 4 && o.x - 4 < b.r && b.t < o.y + o.h + 4 && o.y - 4 < b.b; })) continue;
|
|
306
|
+
return at;
|
|
307
|
+
}
|
|
308
|
+
return {x: first.x, y: first.y, ok: false};
|
|
309
|
+
}
|
|
310
|
+
function setIf(el, a, v){ v = String(v); if (el.getAttribute(a) !== v) el.setAttribute(a, v); }
|
|
311
|
+
function tone(t){ return "var(--" + (/^(term|emph|muted|accent2|series-[1-4])$/.test(t || "") ? t : "term") + ")"; }
|
|
312
|
+
// 箱の地と字の色(m-tree・m-fishbone と同じ決まり):term と emph はテーマの薄い色の地、emph は字も emph
|
|
313
|
+
function boxFill(t){ return t === "emph" ? "var(--emph-tint)" : /^(muted|accent2|series-[1-4])$/.test(t || "") ? tint(tone(t), 12) : "var(--term-tint)"; }
|
|
314
|
+
function textFill(t){ return t === "emph" ? "var(--emph)" : "var(--fg)"; }
|
|
315
|
+
function tint(c, p){ return "color-mix(in srgb," + c + " " + p + "%,var(--bg))"; }
|
|
316
|
+
// 字の幅(px):base の textWidth(font の要素の字で測った幅)。mtext の *_^ は数えない
|
|
317
|
+
function est(s, fs, font){ return base.textWidth(s, fs, {font: font, mark: true}); }
|
|
318
|
+
// KaTeX の式の幅:一度置いて測る
|
|
319
|
+
// KaTeX の式のおよその幅(em)。\text{…} などの中は字ごとに、命令は表から(ない命令は 1 em)、^ と _ の中は 0.7 倍
|
|
320
|
+
var TEX_WIDE = {Longleftrightarrow: 1.86, longleftrightarrow: 1.86, Longrightarrow: 1.64, longrightarrow: 1.64, Longleftarrow: 1.64, longleftarrow: 1.64,
|
|
321
|
+
longmapsto: 1.64, leftrightarrow: 1.0, Leftrightarrow: 1.0, rightarrow: 1.0, leftarrow: 1.0, Rightarrow: 1.0, Leftarrow: 1.0, to: 1.0, mapsto: 1.0,
|
|
322
|
+
iff: 2.42, implies: 2.2, impliedby: 2.2, sum: 1.06, prod: 0.95, int: 0.56, quad: 1.0, qquad: 2.0, cdots: 1.17, ldots: 1.17, dots: 1.17, infty: 1.0,
|
|
323
|
+
le: 1.06, ge: 1.06, leq: 1.06, geq: 1.06, ne: 1.06, neq: 1.06, approx: 1.06, equiv: 1.06, times: 1.0, div: 1.0, pm: 1.0, cdot: 0.5,
|
|
324
|
+
alpha: 0.64, beta: 0.57, gamma: 0.52, delta: 0.45, theta: 0.47, lambda: 0.58, mu: 0.6, pi: 0.57, sigma: 0.57, omega: 0.62, Sigma: 0.72, Delta: 0.83, Omega: 0.72,
|
|
325
|
+
",": 0.17, ":": 0.22, ";": 0.28, "!": 0, " ": 0.33};
|
|
326
|
+
var TEX_SKIP = /^(left|right|big|Big|bigg|Bigg|displaystyle|textstyle|mathit|mathcal|mathbb|boldsymbol|hat|bar|vec|tilde|dot|overline|underline)$/;
|
|
327
|
+
function texCharEm(c){
|
|
328
|
+
if (/[WM]/.test(c)) return 1.03;
|
|
329
|
+
if (/[A-Z]/.test(c)) return 0.76;
|
|
330
|
+
if (/[mw]/.test(c)) return 0.84;
|
|
331
|
+
if (/[a-z]/.test(c)) return 0.53;
|
|
332
|
+
if (/[0-9]/.test(c)) return 0.5;
|
|
333
|
+
if (/[+=<>\-]/.test(c)) return 1.0;
|
|
334
|
+
if (/[()\[\]|\/]/.test(c)) return 0.42;
|
|
335
|
+
if (/[.,;:!' ]/.test(c)) return 0.3;
|
|
336
|
+
return /[ -鿿-]/.test(c) ? 1.0 : 0.6;
|
|
337
|
+
}
|
|
338
|
+
// s の i 番目の { から対応する } の後ろまで
|
|
339
|
+
function texGroup(s, i){ var d = 0, j = i; do { var c = s.charAt(j); if (c === "{") d++; else if (c === "}") d--; j++; } while (d > 0 && j < s.length); return {inner: s.slice(i + 1, j - 1), end: j}; }
|
|
340
|
+
function texEm(src){
|
|
341
|
+
var s = String(src || ""), i = 0, w = 0;
|
|
342
|
+
while (i < s.length){
|
|
343
|
+
var c = s.charAt(i);
|
|
344
|
+
if (c === "\\"){
|
|
345
|
+
var m = /^\\([a-zA-Z]+|.)/.exec(s.slice(i)), cmd = m ? m[1] : "";
|
|
346
|
+
i += m ? m[0].length : 1;
|
|
347
|
+
if (/^(text|textrm|textbf|mathrm|mathbf|operatorname|mbox)$/.test(cmd) && s.charAt(i) === "{"){
|
|
348
|
+
var g = texGroup(s, i);
|
|
349
|
+
for (var k = 0; k < g.inner.length; k++) w += texCharEm(g.inner.charAt(k));
|
|
350
|
+
i = g.end; continue;
|
|
351
|
+
}
|
|
352
|
+
if (/^(frac|dfrac|tfrac)$/.test(cmd) && s.charAt(i) === "{"){
|
|
353
|
+
var a = texGroup(s, i), b = s.charAt(a.end) === "{" ? texGroup(s, a.end) : {inner: "", end: a.end};
|
|
354
|
+
w += Math.max(texEm(a.inner), texEm(b.inner)) * (cmd === "dfrac" ? 1 : 0.8) + 0.24;
|
|
355
|
+
i = b.end; continue;
|
|
356
|
+
}
|
|
357
|
+
if (cmd === "sqrt"){ w += 0.85; continue; }
|
|
358
|
+
if (TEX_SKIP.test(cmd)) continue;
|
|
359
|
+
w += TEX_WIDE[cmd] !== undefined ? TEX_WIDE[cmd] : 1.0;
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (c === "^" || c === "_"){
|
|
363
|
+
i++;
|
|
364
|
+
if (s.charAt(i) === "{"){ var sg = texGroup(s, i); w += texEm(sg.inner) * 0.7; i = sg.end; }
|
|
365
|
+
else if (s.charAt(i) === "\\"){ var m2 = /^\\([a-zA-Z]+|.)/.exec(s.slice(i)); w += texEm(m2 ? m2[0] : "") * 0.7; i += m2 ? m2[0].length : 1; }
|
|
366
|
+
else { w += texCharEm(s.charAt(i)) * 0.7; i++; }
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
if (c === "{" || c === "}"){ i++; continue; }
|
|
370
|
+
w += texCharEm(c); i++;
|
|
371
|
+
}
|
|
372
|
+
return w;
|
|
373
|
+
}
|
|
374
|
+
// TeX の式の幅(px):KaTeX の字の幅(em)から見積もる(components 2.9.0)。前は式を一度置いて測っていたが、mount のときは KaTeX の字が
|
|
375
|
+
// まだ読み込まれていないことがあり、狭く出て(178 px のはずが 201 px)測る時刻で箱が変わった。字数 × 0.62 字の見積もりより狭くはしない
|
|
376
|
+
function texWidth(el, l){
|
|
377
|
+
var est62 = Math.max(1, String(l.tex).replace(/\\[a-zA-Z]+/g, "x").replace(/[{}^_\\ ]/g, "").length) * 0.62;
|
|
378
|
+
return Math.max(texEm(l.tex), est62) * l.size;
|
|
379
|
+
}
|
|
380
|
+
function labelLines(n, size, fill){
|
|
381
|
+
fill = fill || "var(--fg)";
|
|
382
|
+
if (n.tex) return [{tex: n.tex, src: n, size: size, fill: fill}];
|
|
383
|
+
return String(n.label || "").split("\n").map(function(s){ return {text: s, size: size, fill: fill}; });
|
|
384
|
+
}
|
|
385
|
+
// 箱の大きさと行の位置(基線は前の行の下 0.3 字 + 今の行の 1.12 字:字の箱どうしが重ならない)
|
|
386
|
+
function boxSize(el, lines){
|
|
387
|
+
var w = 0, y = 10, prev = null;
|
|
388
|
+
lines.forEach(function(l){
|
|
389
|
+
l.w = l.tex ? texWidth(el, l) : est(l.text, l.size, el) * (l.weight ? 1.05 : 1);
|
|
390
|
+
w = Math.max(w, l.w);
|
|
391
|
+
y += prev ? 0.3 * prev.size + 1.12 * l.size : 0.9 * l.size;
|
|
392
|
+
l.y = y; prev = l;
|
|
393
|
+
});
|
|
394
|
+
return {w: Math.ceil(w + 36), h: Math.ceil(y + 0.28 * prev.size + 10), lines: lines};
|
|
395
|
+
}
|
|
396
|
+
function boxDraw(el, g, x, y, bs){
|
|
397
|
+
bs.lines.forEach(function(l){
|
|
398
|
+
// 式の枠は見積もった幅にし、中で中央に寄せる(KaTeX の字が読み込まれた後の幅で中央になる)
|
|
399
|
+
if (l.tex){ var fo = MR.texFrame(g, x + bs.w / 2, y + l.y, l.src, "tex", {size: l.size, anchor: "middle", color: l.fill, w: l.w + 8, h: l.size * 1.6}, el.texSink);
|
|
400
|
+
fo.firstChild.style.verticalAlign = "top"; fo.setAttribute("x", (x + bs.w / 2 - (l.w + 8) / 2).toFixed(1)); fo.setAttribute("width", (l.w + 8).toFixed(1)); fo.style.textAlign = "center"; }
|
|
401
|
+
else base.mtext(g, x + bs.w / 2, y + l.y, l.text, {"text-anchor": "middle", "font-size": l.size, fill: l.fill, "font-weight": l.weight || 400});
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
return Part;
|
|
405
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Timeline; events one by one; periods drawn along the axis, overlaps stacked; end exclusive ("1912" = start of 1912)
|
|
3
|
+
steps: event count (default 1 per step in time order; per-step n each; node step wins)
|
|
4
|
+
props:
|
|
5
|
+
orient: h or v
|
|
6
|
+
scale: time or even
|
|
7
|
+
per-step: events per step (0 = all)
|
|
8
|
+
size: label px (shrinks to 24)
|
|
9
|
+
dur: event appear (s)
|
|
10
|
+
stagger: event offset (s)
|
|
11
|
+
unit: ticks: day, week, month
|
|
12
|
+
today: today line (YYYY-MM-DD)
|
|
13
|
+
example: {"nodes": [{"id": "a", "label": "Meiji Restoration", "when": "1868", "whenLabel": "Meiji 1"}, {"id": "b", "label": "Constitution", "when": "1889", "note": "Feb 11"}, {"id": "c", "label": "Sino-Japanese War", "when": "1894", "end": "1895", "tone": "emph"}]}
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
History, lives, schedules. No coordinates; content and times only.
|
|
17
|
+
|
|
18
|
+
Child JSON: `{"nodes": [...], "edges": [...]}` (`edges` optional).
|
|
19
|
+
|
|
20
|
+
- `when`: number (`1868`, `-500`, `0.5`) or `"YYYY"` `"YYYY-MM"` `"YYYY-MM-DD"`; shown as the date line
|
|
21
|
+
- `whenLabel`: text replacing the date ("Meiji 1"); `when` still sets position
|
|
22
|
+
- `label` (`\n`) or `tex` (KaTeX)
|
|
23
|
+
- `note`: small last line in the box (`--muted`); after the name for periods/milestones
|
|
24
|
+
- `tone`: `term` (default), `emph`, `muted`, `accent2`, `series-1..4`
|
|
25
|
+
- `end`: a period, drawn along the axis below it; name inside (or beside); `\n` names thicken it
|
|
26
|
+
- `end` is exclusive: Meiji 1868–1912 and Taishō 1912–1926 share a row; through December = next month (`"2027-01"`)
|
|
27
|
+
- `lane`: named group of rows ("Eras", "Authors"); overlaps stack within; `lane` without `end` = milestone (◆)
|
|
28
|
+
- `step`, `at` (start s)
|
|
29
|
+
- `edges`: extra links (`from` `to` `label` `tone` `dash` `step`); dashed arrows (`dash: false` solid)
|
|
30
|
+
- Schedules: `after: ["id", …]` (arrow end→start), `progress` (0–100 %); `today` line; tick `unit`
|
|
31
|
+
- `after` only between periods and milestones; `today` needs a period
|
|
32
|
+
|
|
33
|
+
Layout:
|
|
34
|
+
|
|
35
|
+
- `orient`: `h` (default) or `v`; `scale`: `time` (default) or `even` (very uneven gaps)
|
|
36
|
+
- Events (no `end` or `lane`): axis dot plus date-and-name box, alternating sides (`v`: left/right); 2 rows when crowded
|
|
37
|
+
- With periods: round ticks; event boxes all above the axis
|
|
38
|
+
- Steps: time order, periods and events together; the axis comes with the first
|
|
39
|
+
- `variant`: `fade` (default), `draw` (lines first, periods drawn), `grow` (boxes grow, periods stretch); same steps and end
|
|
40
|
+
- Show later steps faintly (`ctx.preview`): later items faint
|
|
41
|
+
- `cues(k)`: start times of 2nd+ items in a step (for `{cue}`)
|
|
42
|
+
|
|
43
|
+
The demo is `demo.html`; the schedule is fictional, years are history.
|
|
44
|
+
|
|
45
|
+
<!-- llm: omit -->
|
|
46
|
+
Notes
|
|
47
|
+
|
|
48
|
+
- Box and tick widths estimated from characters (CJK 1, digits 0.6, Latin 0.62)
|
|
49
|
+
- No fit: names shrink from `size` by 2px to 24px, then `ctx.report("size", …)`
|
|
50
|
+
- No `Date` (leap years computed); months and days as positions in the year
|
|
51
|
+
- Period names sit in the period's `g`
|
|
52
|
+
- Axis `--muted` 5 px; lane dividers `--line`; links and `edges` `--muted` 3 px
|
|
53
|
+
- Motion: boxes and periods move ≤ 12 px from the axis side, within `fade` time (conventions §1.2)
|
|
54
|
+
<!-- llm: end -->
|
|
55
|
+
|
|
56
|
+
<!-- llm: omit -->
|
|
57
|
+
Schedules (`after`, `progress`, `today`, `unit`)
|
|
58
|
+
|
|
59
|
+
- Any `after`: one row per task in each lane (written order). Arrows only between periods and milestones (others reported)
|
|
60
|
+
- Arrows (`--muted` 3px, right-angled) from a task's end to the next one's start; drawn with the later task; avoid crossing periods where possible
|
|
61
|
+
- A last milestone gets room for its name; arrows to periods whose name is left of the start enter at the edge
|
|
62
|
+
- `progress`: period filled darker from the start; "70%" shown if room; outside 0–100 clamped and reported
|
|
63
|
+
- `today`: only with periods (else reported); small triangle and vertical line (`--accent2`, 3px), "Today" below; range widens to include it
|
|
64
|
+
- `unit`: default month (≤ 4 years with months/days) or round numbers. `day`: 1–2 days or 1–8 weeks (Mondays); `week`: 1–26 weeks; `month`: 1–120 months; finest step whose 24px labels don't overlap; minor ticks unlabeled. Day/week labels "11/2"; `day` shades weekends (`--line`)
|
|
65
|
+
- No plan-vs-actual periods yet
|
|
66
|
+
<!-- llm: end -->
|