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,20 @@
|
|
|
1
|
+
# Changes to the strokesvg kana shapes (FONTLOG)
|
|
2
|
+
|
|
3
|
+
Source: strokesvg <https://github.com/zhengkyl/strokesvg>, commit `e4c2c91034e03c9c2f4e95f14f2361a948f52cd0`
|
|
4
|
+
(kana SVGs derived from Klee One; SIL OFL 1.1). Converted by `tools/kana-import-strokesvg.mjs`. These changes are
|
|
5
|
+
part of the OFL-licensed work.
|
|
6
|
+
|
|
7
|
+
- 2026-10-26 — Format and precision. Each character's strokes in writing order; each stroke a list of pieces
|
|
8
|
+
`[outline, centreline]` (strokesvg splits a stroke that crosses itself into pieces, each with its own clip; they
|
|
9
|
+
stay grouped as one stroke). Coordinates scaled from strokesvg's 1024 box to 0–100 (×100/1024) and rounded to
|
|
10
|
+
0.1, written as one absolute move and then relative commands; arcs kept. The brush (strokesvg's stroke width 128)
|
|
11
|
+
is 12.5.
|
|
12
|
+
- 2026-10-26 — **半濁点** of ぱ ぴ ぷ ぺ ぽ パ ピ プ ペ ポ: the circle's centreline is redrawn to **start at the bottom
|
|
13
|
+
centre and go clockwise** (bottom → left → top → right, and a little past the start), as taught in 光村図書
|
|
14
|
+
『こくご一(上)』p.27 (半濁点) and p.37 (句点): 「下中心から時計回り」. Its centre and radius come from the circle's
|
|
15
|
+
own outline (the middle of the ring); the outline is unchanged. strokesvg's line started above the ring and went
|
|
16
|
+
anticlockwise.
|
|
17
|
+
- 2026-10-26 — **っ ッ ゎ ヮ ヵ ヶ** added (not in strokesvg). Each is its base character (つ ツ わ ワ カ ケ) scaled
|
|
18
|
+
uniformly and moved so that its outline box fits Klee One's own small glyph box (read from the font's metrics;
|
|
19
|
+
the scale and move are recorded under `"derived"` in the file). Checked against the Klee One small glyphs by
|
|
20
|
+
overlay: they match within about 0.3 units (the font's small forms are very slightly bolder).
|
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
// m-syntax:英文の構造(中学・高校の英語)。S V O C M の札、句と節の括弧、修飾の矢印、品詞、それから和訳
|
|
2
|
+
// <m-syntax style="height:420px">
|
|
3
|
+
// [S The girl {形^girl [S who] [V lives] [M next door]}] [V is] [C my friend].
|
|
4
|
+
// = 隣に住んでいる女の子は私の友達だ。
|
|
5
|
+
// </m-syntax>
|
|
6
|
+
// 1 行が 1 文。「= 」で始まる行は直前の文の和訳。
|
|
7
|
+
// [S …] [V …] [O …] [C …] [M …] 文の要素(O1 O2 も)。語の下に下線と記号。{ } の中の要素は小文字(s v o c m)
|
|
8
|
+
// {形 …} {副 …} {名 …} 句・節の括弧(形容詞は ( )、副詞は < >、名詞は [ ])。句か節かは中に V があるかで決まる(形句・形節と書けば固定)
|
|
9
|
+
// {形^girl …} 語^語(tall^boy) 修飾の矢印:括弧(語)から、^ の後の語(同じ文のいちばん近いもの)へ。^ だけなら隣の語({形^ …} は前、tall^ は次)
|
|
10
|
+
// 語[品詞](boy[名]) 品詞。pos="on" のときだけ出す
|
|
11
|
+
// 段階:(pos)→ 要素を 1 つずつ(S V O C M のうち出てくるもの)→ 括弧(と中の小文字の要素)→ 矢印 → 和訳。build="whole" で 1 段階
|
|
12
|
+
// 字は HTML(英文は var(--font-sans)、和訳も)。線・括弧・札は SVG で、描くたびに語の位置を測る(呼び出しの順によらない)
|
|
13
|
+
// 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・prog・variant・previewOpacity を使い、プレイヤーのグローバルは使わない。
|
|
14
|
+
// 書き方の誤りは ctx.report("data", "[syntax] …")、属性の誤りは ctx.report("attr", …)・ctx.report("range", …)、矢印が行をまたぐときと
|
|
15
|
+
// 要素の高さが足りないときは ctx.report("size", …) で知らせる(1.x の console.warn("m-syntax: …") の代わり)。
|
|
16
|
+
// 読み取りと段階(parse・plan・durationOf と表)は試験のために static testing に出す(ほかのパーツは読まない)
|
|
17
|
+
egatariParts.define({name: "syntax", version: "2.0.4", requires: {base: "1.3.0"}, element: "m-syntax"}, function(deps){
|
|
18
|
+
"use strict";
|
|
19
|
+
var base = deps.base;
|
|
20
|
+
var D = base;
|
|
21
|
+
|
|
22
|
+
// ---------------------------------------------------------------- 決まり
|
|
23
|
+
var ROLES = ["S", "V", "O", "C", "M"];
|
|
24
|
+
var ROLE_COLOR = {S: "var(--series-1)", V: "var(--series-2)", O: "var(--series-3)", C: "var(--series-4)", M: "var(--muted)"};
|
|
25
|
+
// 括弧の種類:名詞 [ ]・形容詞 ( )・副詞 < >(形と記号の両方で種類が分かる。色だけに頼らない)
|
|
26
|
+
var KIND = {"名": {name: "名詞", shape: "square"}, "形": {name: "形容詞", shape: "round"}, "副": {name: "副詞", shape: "angle"}};
|
|
27
|
+
// 品詞:略号 → [名前, 色の組]
|
|
28
|
+
var POS = {"名": ["名詞", "n"], "代": ["代名詞", "n"], "動": ["動詞", "v"], "助": ["助動詞", "v"], "形": ["形容詞", "a"], "副": ["副詞", "d"],
|
|
29
|
+
"冠": ["冠詞", "x"], "前": ["前置詞", "x"], "接": ["接続詞", "x"], "関": ["関係詞", "x"], "間": ["間投詞", "x"]};
|
|
30
|
+
var POS_COLOR = {n: "var(--series-1)", v: "var(--series-2)", a: "var(--series-3)", d: "var(--series-4)", x: "var(--fg)"};
|
|
31
|
+
var PUNCT = /^[.,!?;:]+$/;
|
|
32
|
+
|
|
33
|
+
// ---------------------------------------------------------------- 読み取り
|
|
34
|
+
// parse(文字列) → {sentences: [{tokens, roles, groups, mods, yaku, text}], warnings}
|
|
35
|
+
// tokens[i] = {t, punct, pos: {tag, name, cls} | null}
|
|
36
|
+
// roles[j] = {code: "S"…"M", sub: "" | "1" | "2", a, b, lower({ } の中), depth(囲む要素の数), owner(いちばん内側の括弧の番号 | -1)}
|
|
37
|
+
// groups[j] = {kind: "名" | "形" | "副" | null, unit: "句" | "節", label, a, b, depth(囲む括弧の数), head: 語 | null}
|
|
38
|
+
// mods[j] = {from: {group: j} | {token: i}, a, b, to(頭の語の番号)} a..b は修飾する側の語の範囲
|
|
39
|
+
function norm(w){ return String(w).toLowerCase().replace(/[^\p{L}\p{N}'’-]/gu, ""); }
|
|
40
|
+
function parse(src){
|
|
41
|
+
var sentences = [], warnings = [];
|
|
42
|
+
String(src || "").split(/\r?\n/).map(function(l){ return l.trim(); }).filter(Boolean).forEach(function(l, li){
|
|
43
|
+
if (/^[==]/.test(l)){
|
|
44
|
+
var y = l.replace(/^[==]\s*/, "");
|
|
45
|
+
if (!sentences.length) warnings.push("和訳の前に英文がない:" + l);
|
|
46
|
+
else if (sentences[sentences.length - 1].yaku) warnings.push("和訳が 2 行ある(" + (li + 1) + " 行目。1 行にまとめる):" + l);
|
|
47
|
+
else sentences[sentences.length - 1].yaku = y;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
sentences.push(sentence(l, li + 1, warnings));
|
|
51
|
+
});
|
|
52
|
+
return {sentences: sentences, warnings: warnings};
|
|
53
|
+
}
|
|
54
|
+
function sentence(src, ln, warnings){
|
|
55
|
+
var l = src.replace(/[/g, "[").replace(/]/g, "]").replace(/{/g, "{").replace(/}/g, "}").replace(/^/g, "^");
|
|
56
|
+
var at = "(" + ln + " 行目)";
|
|
57
|
+
var tokens = [], roles = [], groups = [], wmods = [], stack = [], cur = "", curPos = null, nOpen = 0;
|
|
58
|
+
var lastWord = function(){ for (var i = tokens.length - 1; i >= 0; i--) if (!tokens[i].punct) return i; return -1; };
|
|
59
|
+
var push = function(t, pos){
|
|
60
|
+
var m = /^(.*?)([.,!?;:]*)$/.exec(t), w = m[1], p = m[2];
|
|
61
|
+
if (w){
|
|
62
|
+
var head = null, k = w.indexOf("^");
|
|
63
|
+
if (k === 0){ warnings.push("「^」の前に語がない:" + w + at); w = w.slice(1); }
|
|
64
|
+
else if (k > 0){ head = w.slice(k + 1); w = w.slice(0, k); } // head が "" なら次の語
|
|
65
|
+
if (w){
|
|
66
|
+
tokens.push({t: w, punct: false, pos: pos});
|
|
67
|
+
if (head !== null) wmods.push({i: tokens.length - 1, head: head});
|
|
68
|
+
}
|
|
69
|
+
} else if (pos) warnings.push("品詞の前に語がない:[" + pos.tag + "]" + at);
|
|
70
|
+
if (p) tokens.push({t: p, punct: true, pos: null});
|
|
71
|
+
};
|
|
72
|
+
var flush = function(){
|
|
73
|
+
if (!cur) return;
|
|
74
|
+
var pos = null;
|
|
75
|
+
if (curPos !== null){
|
|
76
|
+
var P = POS[curPos];
|
|
77
|
+
if (!P) warnings.push("知らない品詞「" + curPos + "」(" + Object.keys(POS).join(" ") + " のどれか)" + at);
|
|
78
|
+
pos = {tag: curPos, name: P ? P[0] : curPos, cls: P ? P[1] : "x"};
|
|
79
|
+
}
|
|
80
|
+
push(cur, pos); cur = ""; curPos = null;
|
|
81
|
+
};
|
|
82
|
+
var close = function(item){
|
|
83
|
+
var b = lastWord();
|
|
84
|
+
if (b < item.a){ warnings.push("中に語のない" + (item.type === "role" ? "要素 [" + item.code : "括弧 {" + (item.kind || "")) + "]" + at); return; }
|
|
85
|
+
item.b = b;
|
|
86
|
+
if (item.type === "role") roles.push(item); else groups.push(item);
|
|
87
|
+
};
|
|
88
|
+
var closeUntil = function(type, ch){
|
|
89
|
+
for (var j = stack.length - 1; j >= 0; j--) if (stack[j].type === type){
|
|
90
|
+
if (j !== stack.length - 1) warnings.push("閉じる順が違う:「" + ch + "」の前に閉じていないものがある" + at);
|
|
91
|
+
while (stack.length > j){ var it = stack.pop(); if (it.type !== "bad") close(it); }
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// 開いていない(読めなかった開きは bad として積んである)
|
|
95
|
+
for (var q = stack.length - 1; q >= 0; q--) if (stack[q].type === "bad" && stack[q].ch === (ch === "]" ? "[" : "{")){ stack.splice(q, 1); return; }
|
|
96
|
+
warnings.push("「" + ch + "」に対応する開きがない" + at);
|
|
97
|
+
};
|
|
98
|
+
var nGroups = function(){ return stack.filter(function(x){ return x.type === "group"; }); };
|
|
99
|
+
for (var i = 0; i < l.length; i++){
|
|
100
|
+
var ch = l[i], rest = l.slice(i), m;
|
|
101
|
+
if (/\s/.test(ch)){ flush(); continue; }
|
|
102
|
+
if (ch === "[" && cur){
|
|
103
|
+
// 語に付いた [ ]:品詞
|
|
104
|
+
var e = l.indexOf("]", i), body = e > 0 ? l.slice(i + 1, e) : "";
|
|
105
|
+
if (e > 0 && body && !/\s/.test(body)){ curPos = body; i = e; continue; }
|
|
106
|
+
}
|
|
107
|
+
if (ch === "["){
|
|
108
|
+
flush();
|
|
109
|
+
m = /^\[([SVOCMsvocm])([12]?)(?=\s)/.exec(rest);
|
|
110
|
+
if (!m){ warnings.push("「[」の後に要素の記号(S V O C M)と空白がない:" + rest.slice(0, 12) + at); stack.push({type: "bad", ch: "["}); continue; }
|
|
111
|
+
var gs = nGroups();
|
|
112
|
+
stack.push({type: "role", code: m[1].toUpperCase(), sub: m[2], a: tokens.length, lower: gs.length > 0,
|
|
113
|
+
owner: gs.length ? gs[gs.length - 1].id : -1, depth: stack.filter(function(x){ return x.type === "role"; }).length});
|
|
114
|
+
i += m[0].length - 1; continue;
|
|
115
|
+
}
|
|
116
|
+
if (ch === "{"){
|
|
117
|
+
flush();
|
|
118
|
+
m = /^\{([名形副])(句|節)?(?:\^([^\s[\]{}^]*))?(?=\s)/.exec(rest);
|
|
119
|
+
var id = nOpen++;
|
|
120
|
+
if (!m){
|
|
121
|
+
var bad = /^\{(\S*)/.exec(rest)[1];
|
|
122
|
+
warnings.push("知らない括弧の種類「" + bad + "」(形・副・名。句・節と ^語 を続けてよい:{形節^girl …})" + at);
|
|
123
|
+
stack.push({type: "group", id: id, kind: null, unit: "", label: bad.replace(/\^.*$/, ""), head: null, a: tokens.length, depth: nGroups().length});
|
|
124
|
+
i += bad.length; continue;
|
|
125
|
+
}
|
|
126
|
+
stack.push({type: "group", id: id, kind: m[1], unit: m[2] || "", head: m[3] === undefined ? null : m[3], a: tokens.length, depth: nGroups().length});
|
|
127
|
+
i += m[0].length - 1; continue;
|
|
128
|
+
}
|
|
129
|
+
if (ch === "]"){ flush(); closeUntil("role", "]"); continue; }
|
|
130
|
+
if (ch === "}"){ flush(); closeUntil("group", "}"); continue; }
|
|
131
|
+
cur += ch;
|
|
132
|
+
}
|
|
133
|
+
flush();
|
|
134
|
+
while (stack.length){
|
|
135
|
+
var it = stack.pop();
|
|
136
|
+
if (it.type === "bad") continue;
|
|
137
|
+
warnings.push("閉じていない" + (it.type === "role" ? "「[" + it.code + "」" : "「{" + (it.kind || it.label) + "」") + at);
|
|
138
|
+
close(it);
|
|
139
|
+
}
|
|
140
|
+
// 括弧の番号を開いた順に(id は開いた順に振ってある)
|
|
141
|
+
groups.sort(function(x, y){ return x.id - y.id; });
|
|
142
|
+
var gid = {};
|
|
143
|
+
groups.forEach(function(g, j){ gid[g.id] = j; });
|
|
144
|
+
roles.forEach(function(r){ r.owner = r.owner >= 0 && gid[r.owner] !== undefined ? gid[r.owner] : -1; });
|
|
145
|
+
roles.sort(function(x, y){ return x.a - y.a || x.depth - y.depth; });
|
|
146
|
+
groups.forEach(function(g){
|
|
147
|
+
if (g.kind && !g.unit) g.unit = roles.some(function(r){ return r.code === "V" && r.a >= g.a && r.b <= g.b; }) ? "節" : "句";
|
|
148
|
+
if (g.kind) g.label = KIND[g.kind].name + g.unit;
|
|
149
|
+
delete g.id;
|
|
150
|
+
});
|
|
151
|
+
// 修飾の矢印:頭の語は、修飾する側の外で、いちばん近い同じ語(同じ距離なら左)
|
|
152
|
+
var mods = [];
|
|
153
|
+
var find = function(head, a, b){
|
|
154
|
+
var h = norm(head), best = -1, bd = Infinity;
|
|
155
|
+
tokens.forEach(function(t, i){
|
|
156
|
+
if (t.punct || (i >= a && i <= b) || norm(t.t) !== h) return;
|
|
157
|
+
var d = i < a ? a - i : i - b;
|
|
158
|
+
if (d < bd){ bd = d; best = i; }
|
|
159
|
+
});
|
|
160
|
+
return best;
|
|
161
|
+
};
|
|
162
|
+
// ^ だけなら隣の語:括弧は前の語、語は次の語
|
|
163
|
+
var near = function(i, dir){ for (i += dir; i >= 0 && i < tokens.length; i += dir) if (!tokens[i].punct) return i; return -1; };
|
|
164
|
+
groups.forEach(function(g, j){
|
|
165
|
+
if (g.head === null) return;
|
|
166
|
+
var to = g.head ? find(g.head, g.a, g.b) : near(g.a, -1);
|
|
167
|
+
if (to < 0) warnings.push((g.head ? "矢印の先「" + g.head + "」が括弧の外にない" : "括弧の前に語がない") + "({" + (g.kind || g.label) + "^" + g.head + " …})" + at);
|
|
168
|
+
else mods.push({from: {group: j}, a: g.a, b: g.b, to: to});
|
|
169
|
+
});
|
|
170
|
+
wmods.forEach(function(w){
|
|
171
|
+
var to = w.head ? find(w.head, w.i, w.i) : near(w.i, 1);
|
|
172
|
+
if (to < 0) warnings.push((w.head ? "矢印の先「" + w.head + "」がない" : "「^」の後に語がない") + "(" + tokens[w.i].t + "^" + w.head + ")" + at);
|
|
173
|
+
else mods.push({from: {token: w.i}, a: w.i, b: w.i, to: to});
|
|
174
|
+
});
|
|
175
|
+
mods.sort(function(x, y){ return Math.min(x.a, x.to) - Math.min(y.a, y.to) || x.a - y.a; });
|
|
176
|
+
// 矢印の段:つなぐ範囲の短いものから、重なる矢印より 1 つ上の段へ
|
|
177
|
+
var placed = [];
|
|
178
|
+
mods.map(function(o){ return {o: o, lo: Math.min(o.a, o.to), hi: Math.max(o.b, o.to)}; })
|
|
179
|
+
.sort(function(x, y){ return (x.hi - x.lo) - (y.hi - y.lo) || x.lo - y.lo; })
|
|
180
|
+
.forEach(function(s){
|
|
181
|
+
var lv = 1;
|
|
182
|
+
placed.forEach(function(q){ if (q.lo < s.hi && s.lo < q.hi) lv = Math.max(lv, q.o.lane + 1); }); // 端で接するだけなら同じ段(同じ語に来る矢印は語の幅に並べる)
|
|
183
|
+
s.o.lane = lv; placed.push(s);
|
|
184
|
+
});
|
|
185
|
+
var text = tokens.map(function(t, i){ return (i && !t.punct ? " " : "") + t.t; }).join("");
|
|
186
|
+
return {tokens: tokens, roles: roles, groups: groups, mods: mods, yaku: "", text: text};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// ---------------------------------------------------------------- 段階
|
|
190
|
+
// plan(model, {pos, yaku, whole}) → {phases: [{name, code, n, dur, step, off}], steps}
|
|
191
|
+
// name:pos(品詞)・role(code の要素)・brackets(括弧と中の小文字の要素)・arrows(矢印)・yaku(和訳)
|
|
192
|
+
var GAP = 0.2; // build="whole" の段の間
|
|
193
|
+
function phaseDur(name, n){
|
|
194
|
+
if (name === "pos") return 0.8;
|
|
195
|
+
if (name === "role") return 0.5 + 0.2 * (n - 1);
|
|
196
|
+
if (name === "brackets") return 0.7 + 0.3 * (n - 1);
|
|
197
|
+
if (name === "arrows") return 0.6 + 0.4 * (n - 1);
|
|
198
|
+
return 0.6;
|
|
199
|
+
}
|
|
200
|
+
function plan(model, o){
|
|
201
|
+
o = o || {};
|
|
202
|
+
var S = model.sentences, ph = [];
|
|
203
|
+
var all = function(f){ var n = 0; S.forEach(function(s){ n += f(s); }); return n; };
|
|
204
|
+
var nPos = all(function(s){ return s.tokens.filter(function(t){ return t.pos; }).length; });
|
|
205
|
+
if (o.pos && nPos) ph.push({name: "pos", n: nPos});
|
|
206
|
+
ROLES.forEach(function(c){
|
|
207
|
+
var n = all(function(s){ return s.roles.filter(function(r){ return !r.lower && r.code === c; }).length; });
|
|
208
|
+
if (n) ph.push({name: "role", code: c, n: n});
|
|
209
|
+
});
|
|
210
|
+
var nG = all(function(s){ return s.groups.length; });
|
|
211
|
+
if (nG) ph.push({name: "brackets", n: nG});
|
|
212
|
+
var nM = all(function(s){ return s.mods.length; });
|
|
213
|
+
if (nM) ph.push({name: "arrows", n: nM});
|
|
214
|
+
var nY = all(function(s){ return s.yaku ? 1 : 0; });
|
|
215
|
+
if (o.yaku !== false && nY) ph.push({name: "yaku", n: nY});
|
|
216
|
+
var off = 0;
|
|
217
|
+
ph.forEach(function(p, j){
|
|
218
|
+
p.dur = phaseDur(p.name, p.n);
|
|
219
|
+
if (o.whole){ p.step = 1; p.off = off; off += p.dur + GAP; }
|
|
220
|
+
else { p.step = j + 1; p.off = 0; }
|
|
221
|
+
});
|
|
222
|
+
return {phases: ph, steps: o.whole ? (ph.length ? 1 : 0) : ph.length};
|
|
223
|
+
}
|
|
224
|
+
function durationOf(pl, k){
|
|
225
|
+
var d = 0;
|
|
226
|
+
pl.phases.forEach(function(p){ if (p.step === k) d = Math.max(d, p.off + p.dur); });
|
|
227
|
+
return d;
|
|
228
|
+
}
|
|
229
|
+
// 段の中の時刻:済んだ段は Infinity、まだの段は -Infinity
|
|
230
|
+
function localTime(p, k, t){ return p.step < k ? Infinity : p.step > k ? -Infinity : t - p.off; }
|
|
231
|
+
function prog(lt, a, d){ if (lt === Infinity) return 1; if (!(lt > a)) return 0; return D.prog ? D.prog(lt, a, d) : Math.min(1, (lt - a) / d); }
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
// ---------------------------------------------------------------- 部品
|
|
235
|
+
var CSS = [
|
|
236
|
+
"m-syntax{display:block;position:relative;color:var(--fg);font-family:var(--font-sans)}",
|
|
237
|
+
"m-syntax .sx-s{display:flex;flex-wrap:wrap;align-items:flex-start}",
|
|
238
|
+
"m-syntax .sx-w{display:inline-block;white-space:nowrap}",
|
|
239
|
+
"m-syntax .sx-t{display:inline-block}",
|
|
240
|
+
"m-syntax .sx-y{font-size:28px;line-height:1.4;margin:0 0 14px}",
|
|
241
|
+
].join("\n");
|
|
242
|
+
var TAGROW = 30; // 括弧の名前の段の高さ(24px の字)
|
|
243
|
+
var LANE = 14; // 矢印の段の間
|
|
244
|
+
var ROWH = 40; // 要素の下線と記号の段の高さ
|
|
245
|
+
var POSH = 30; // 品詞の段の高さ
|
|
246
|
+
var ON = function(v){ return /^(on|true|yes)$/i.test(String(v || "").trim()); };
|
|
247
|
+
var f1 = function(x){ return x.toFixed(1); };
|
|
248
|
+
var CSS_ID = "syntax-2-0-3-css"; // the style element this part writes, named with its name and version (spec §6.1 Identifiers)
|
|
249
|
+
return class extends base.MotionElement {
|
|
250
|
+
static partName = "syntax"; // the registry name (define meta name), for report prefixes
|
|
251
|
+
static testing = {parse: parse, plan: plan, durationOf: durationOf, POS: POS, KIND: KIND}; // for tools/test-syntax.mjs only (no part reads it)
|
|
252
|
+
static variants = ["fade", "draw"];
|
|
253
|
+
// データの形(kit/shape.js):JSON ではなく、要素の中に 1 行 1 文の英文(「= 」の行は和訳)
|
|
254
|
+
static shape = {text: true, example: "[S We] [V call] [O him] [C Ken].\n= 私たちは彼をケンと呼ぶ。"};
|
|
255
|
+
static props = {
|
|
256
|
+
size: {type: "number", default: 36, doc: "英文の字の大きさ(px)"},
|
|
257
|
+
pos: {type: "string", default: "off", doc: "on で品詞(語[名])を語の下に"},
|
|
258
|
+
build: {type: "string", default: "steps", doc: "whole で全部を 1 ステップに"},
|
|
259
|
+
yaku: {type: "bool", default: true, doc: "和訳(= の行)を最後に出す"},
|
|
260
|
+
};
|
|
261
|
+
get model(){ if (!this._m) this._m = parse(this._src !== undefined ? this._src : this.textContent); return this._m; }
|
|
262
|
+
get plan(){
|
|
263
|
+
if (!this._pl){ var P = this.props; this._pl = plan(this.model, {pos: ON(P.pos), yaku: P.yaku, whole: String(P.build).trim() === "whole"}); }
|
|
264
|
+
return this._pl;
|
|
265
|
+
}
|
|
266
|
+
get steps(){ return this.getAttribute("steps") !== null ? +this.getAttribute("steps") : this.plan.steps; }
|
|
267
|
+
duration(k){ return durationOf(this.plan, k); }
|
|
268
|
+
mount(ctx){
|
|
269
|
+
var self = this, P = this.props, size = P.size, m = this.model, pos = ON(P.pos);
|
|
270
|
+
this._src = this.textContent;
|
|
271
|
+
m.warnings.forEach(function(w){ ctx.report("data", "[syntax] " + w); });
|
|
272
|
+
if (!/^(steps|whole)$/.test(String(P.build).trim())) ctx.report("attr", '[syntax] build="' + P.build + '" is not steps or whole (steps is used)');
|
|
273
|
+
if (!(typeof size === "number" && isFinite(size))){ ctx.report("attr", '[syntax] size="' + self.getAttribute("size") + '" is not a number (36 is used)'); size = 36; }
|
|
274
|
+
if (size < 27){ ctx.report("range", "[syntax] size " + size + " is below 27 px (27 is used)"); size = 27; }
|
|
275
|
+
this.size = size;
|
|
276
|
+
this.variant = base.variant(this);
|
|
277
|
+
this.textContent = "";
|
|
278
|
+
this.classList.add("plot");
|
|
279
|
+
if (!document.getElementById(CSS_ID)){ var st = document.createElement("style"); st.id = CSS_ID; st.textContent = CSS; document.head.appendChild(st); }
|
|
280
|
+
var W = this.clientWidth || 1184, H = this.clientHeight || 400;
|
|
281
|
+
var mk = function(tag, cls, parent, text){ var e = document.createElement(tag); if (cls) e.className = cls; if (text !== undefined) e.textContent = text; parent.appendChild(e); return e; };
|
|
282
|
+
var box = mk("div", "sx-text", this);
|
|
283
|
+
box.setAttribute("aria-hidden", "true");
|
|
284
|
+
this.box = box;
|
|
285
|
+
var svg = D.el("svg", {width: W, height: H, viewBox: "0 0 " + W + " " + H, "aria-hidden": "true", style: "position:absolute;left:0;top:0;overflow:visible;pointer-events:none"}, this);
|
|
286
|
+
var gB = D.el("g", {}, svg), gL = D.el("g", {}, svg), gA = D.el("g", {}, svg);
|
|
287
|
+
var BR = Math.round(size * 0.36);
|
|
288
|
+
this.BR = BR;
|
|
289
|
+
this.S = m.sentences.map(function(s){
|
|
290
|
+
var G = 0, R = 0, L = 0;
|
|
291
|
+
s.groups.forEach(function(g){ G = Math.max(G, g.depth + 1); });
|
|
292
|
+
s.roles.forEach(function(r){ R = Math.max(R, r.depth + 1); });
|
|
293
|
+
s.mods.forEach(function(o){ L = Math.max(L, o.lane); });
|
|
294
|
+
var above = G * TAGROW + (L ? 14 + (L - 1) * LANE + 4 : 0) + 6, below = (pos ? POSH : 0) + R * ROWH + 6;
|
|
295
|
+
var el = mk("div", "sx-s", box);
|
|
296
|
+
el.style.cssText = "font-size:" + size + "px;line-height:1.25;column-gap:" + Math.round(size * 0.3) + "px;row-gap:" + (above + below) + "px;padding:" + above + "px 0 " + below + "px 0";
|
|
297
|
+
var opens = s.tokens.map(function(){ return 0; }), closes = opens.slice();
|
|
298
|
+
s.groups.forEach(function(g){ opens[g.a]++; closes[g.b]++; });
|
|
299
|
+
var T = [], outer = null;
|
|
300
|
+
s.tokens.forEach(function(t, i){
|
|
301
|
+
if (t.punct && outer){ T.push({el: mk("span", "sx-p", outer, t.t), t: t}); return; }
|
|
302
|
+
if (outer) el.appendChild(document.createTextNode(" ")); // 字として読むときの語の間(flex の中の空白は場所を取らない)
|
|
303
|
+
outer = mk("span", "sx-w", el);
|
|
304
|
+
var tx = mk("span", "sx-t", outer, t.t);
|
|
305
|
+
if (opens[i] || closes[i]) tx.style.margin = "0 " + closes[i] * BR + "px 0 " + opens[i] * BR + "px";
|
|
306
|
+
T.push({el: tx, t: t});
|
|
307
|
+
});
|
|
308
|
+
var S2 = {s: s, el: el, T: T, G: G, R: R, L: L};
|
|
309
|
+
S2.roles = s.roles.map(function(r){
|
|
310
|
+
var c = ROLE_COLOR[r.code];
|
|
311
|
+
var line = D.el("path", {fill: "none", stroke: c, "stroke-width": 3, "stroke-linecap": "round", pathLength: 1}, gL);
|
|
312
|
+
var lab = D.el("text", {"font-size": 28, "font-weight": 700, fill: c, "text-anchor": "middle"}, gL);
|
|
313
|
+
lab.appendChild(document.createTextNode(r.lower ? r.code.toLowerCase() : r.code));
|
|
314
|
+
if (r.sub){ var ts = D.el("tspan", {"font-size": 24, dy: 6}, lab); ts.textContent = r.sub; }
|
|
315
|
+
return {r: r, line: line, lab: lab};
|
|
316
|
+
});
|
|
317
|
+
S2.groups = s.groups.map(function(g){
|
|
318
|
+
return {g: g, path: D.el("path", {fill: "none", stroke: "var(--fg)", "stroke-width": 2.5, "stroke-linecap": "round", "stroke-linejoin": "round", pathLength: 1}, gB),
|
|
319
|
+
tag: (function(){ var e = D.el("text", {"font-size": 24, fill: "var(--fg)"}, gB); e.textContent = g.label; return e; })()};
|
|
320
|
+
});
|
|
321
|
+
S2.mods = s.mods.map(function(o){
|
|
322
|
+
return {o: o, path: D.el("path", {fill: "none", stroke: "var(--emph)", "stroke-width": 2.5, "stroke-linecap": "round", "stroke-linejoin": "round", pathLength: 1}, gA),
|
|
323
|
+
head: D.el("path", {d: "M0,0L-13,-6.5L-13,6.5Z", fill: "var(--emph)"}, gA)};
|
|
324
|
+
});
|
|
325
|
+
S2.pos = pos ? s.tokens.map(function(t, i){
|
|
326
|
+
if (!t.pos) return null;
|
|
327
|
+
var e = D.el("text", {"font-size": 24, fill: POS_COLOR[t.pos.cls], "text-anchor": "middle"}, gL);
|
|
328
|
+
e.textContent = t.pos.tag;
|
|
329
|
+
return {i: i, el: e};
|
|
330
|
+
}).filter(Boolean) : [];
|
|
331
|
+
S2.yaku = s.yaku && P.yaku ? mk("div", "sx-y", box, s.yaku) : null;
|
|
332
|
+
return S2;
|
|
333
|
+
});
|
|
334
|
+
// 順番(段の中で何番目に出るか):文の順、文の中は左から
|
|
335
|
+
var cnt = {};
|
|
336
|
+
var next = function(key){ cnt[key] = (cnt[key] || 0) + 1; return cnt[key] - 1; };
|
|
337
|
+
var gIndex = [];
|
|
338
|
+
this.S.forEach(function(S2){
|
|
339
|
+
S2.pos.forEach(function(p){ p.j = next("pos"); });
|
|
340
|
+
S2.roles.forEach(function(R2){ if (!R2.r.lower) R2.j = next("role" + R2.r.code); });
|
|
341
|
+
S2.groups.forEach(function(G2){ G2.j = next("brackets"); });
|
|
342
|
+
gIndex.push(S2.groups);
|
|
343
|
+
S2.roles.forEach(function(R2){ if (R2.r.lower) R2.j = R2.r.owner >= 0 ? S2.groups[R2.r.owner].j : 0; });
|
|
344
|
+
S2.mods.forEach(function(M2){ M2.j = next("arrows"); });
|
|
345
|
+
});
|
|
346
|
+
// 読める層(画面にも印刷にも出ない):英文と構造と和訳を字で
|
|
347
|
+
var lines = m.sentences.map(function(s){
|
|
348
|
+
var span = function(a, b){ return s.tokens.slice(a, b + 1).map(function(t, i){ return (i && !t.punct ? " " : "") + t.t; }).join(""); };
|
|
349
|
+
var out = [s.text];
|
|
350
|
+
if (s.roles.length) out.push("要素:" + s.roles.map(function(r){ return (r.lower ? r.code.toLowerCase() : r.code) + r.sub + "「" + span(r.a, r.b) + "」"; }).join("、"));
|
|
351
|
+
if (s.groups.length) out.push("括弧:" + s.groups.map(function(g){ return g.label + "「" + span(g.a, g.b) + "」"; }).join("、"));
|
|
352
|
+
if (s.mods.length) out.push("修飾:" + s.mods.map(function(o){ return "「" + span(o.a, o.b) + "」→「" + s.tokens[o.to].t + "」"; }).join("、"));
|
|
353
|
+
if (pos){ var ps = s.tokens.filter(function(t){ return t.pos; }); if (ps.length) out.push("品詞:" + ps.map(function(t){ return t.t + "(" + t.pos.name + ")"; }).join("、")); }
|
|
354
|
+
if (s.yaku) out.push("訳:" + s.yaku);
|
|
355
|
+
return out.join(" ");
|
|
356
|
+
});
|
|
357
|
+
var sr = document.createElement("p");
|
|
358
|
+
sr.className = "sr-only";
|
|
359
|
+
sr.setAttribute("style", "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0");
|
|
360
|
+
sr.textContent = "文の構造:" + lines.join(";");
|
|
361
|
+
this.appendChild(sr);
|
|
362
|
+
if (!this.getAttribute("aria-label")) this.setAttribute("aria-label", m.sentences.map(function(s){ return s.text; }).join(" ") + "(文の構造)");
|
|
363
|
+
}
|
|
364
|
+
// 要素の字の箱を部品の座標で。部品の外側の拡大(舞台の scale)によらない
|
|
365
|
+
rect(e){
|
|
366
|
+
var R = this.getBoundingClientRect(), sc = R.width / (this.offsetWidth || 1) || 1, r = e.getBoundingClientRect();
|
|
367
|
+
return {l: (r.left - R.left) / sc, t: (r.top - R.top) / sc, r: (r.right - R.left) / sc, b: (r.bottom - R.top) / sc};
|
|
368
|
+
}
|
|
369
|
+
render(k, t, ctx){
|
|
370
|
+
var self = this, P = this.props, pl = this.plan, draw = this.variant === "draw", BR = this.BR;
|
|
371
|
+
var preview = !!ctx.preview, PV = preview ? base.previewOpacity(this) : 0.45;
|
|
372
|
+
// 段ごとの時刻と、薄く見せるか
|
|
373
|
+
var phase = {};
|
|
374
|
+
pl.phases.forEach(function(p){ phase[p.name === "role" ? "role" + p.code : p.name] = p; });
|
|
375
|
+
var st = function(key){
|
|
376
|
+
var p = phase[key];
|
|
377
|
+
if (!p) return {lt: -Infinity, faint: false};
|
|
378
|
+
var faint = preview && p.step > k;
|
|
379
|
+
return {lt: faint ? Infinity : localTime(p, k, t), faint: faint};
|
|
380
|
+
};
|
|
381
|
+
var show = function(e, s, a, d){ var v = s.faint ? PV : prog(s.lt, a, d); e.setAttribute("opacity", v.toFixed(3)); return v; };
|
|
382
|
+
var stroke = function(e, s, a, d, v){ e.setAttribute("stroke-dasharray", "1"); e.setAttribute("stroke-dashoffset", (draw && !s.faint ? 1 - prog(s.lt, a, d) : 0).toFixed(4)); if (draw && !s.faint) e.setAttribute("opacity", v > 0 ? 1 : 0); };
|
|
383
|
+
var warns = [];
|
|
384
|
+
this.S.forEach(function(S2){
|
|
385
|
+
var s = S2.s, R = S2.R, G = S2.G;
|
|
386
|
+
// 語の箱と行(上の位置が変わるところで次の行)
|
|
387
|
+
var box = S2.T.map(function(x){ return self.rect(x.el); }), line = [], ln = 0, top = null;
|
|
388
|
+
box.forEach(function(b, i){
|
|
389
|
+
if (S2.T[i].t.punct){ line.push(ln); return; }
|
|
390
|
+
if (top !== null && b.t > top + 4) ln++;
|
|
391
|
+
top = b.t; line.push(ln);
|
|
392
|
+
});
|
|
393
|
+
// 範囲 a..b の語を行ごとの区間に(句読点は除く)
|
|
394
|
+
var segs = function(a, b){
|
|
395
|
+
var out = [];
|
|
396
|
+
for (var i = a; i <= b; i++){
|
|
397
|
+
if (S2.T[i].t.punct) continue;
|
|
398
|
+
var x = box[i], last = out[out.length - 1];
|
|
399
|
+
if (last && last.line === line[i]) last.r = x.r;
|
|
400
|
+
else out.push({l: x.l, r: x.r, t: x.t, b: x.b, line: line[i]});
|
|
401
|
+
}
|
|
402
|
+
return out;
|
|
403
|
+
};
|
|
404
|
+
// ---- 品詞:語の下
|
|
405
|
+
var sPos = st("pos");
|
|
406
|
+
S2.pos.forEach(function(p){
|
|
407
|
+
var x = box[p.i];
|
|
408
|
+
p.el.setAttribute("x", f1((x.l + x.r) / 2)); p.el.setAttribute("y", f1(x.b + 24));
|
|
409
|
+
show(p.el, sPos, 0.3 * p.j / Math.max(1, phase.pos ? phase.pos.n - 1 : 1), 0.5);
|
|
410
|
+
});
|
|
411
|
+
// ---- 要素:下線と記号。囲む要素の数だけ下の段(文の要素は同じ段にそろう)
|
|
412
|
+
var posH = S2.pos.length ? POSH : 0;
|
|
413
|
+
S2.roles.forEach(function(R2){
|
|
414
|
+
var r = R2.r, sg = segs(r.a, r.b), row = R - 1 - r.depth, d = "", best = null;
|
|
415
|
+
sg.forEach(function(g){
|
|
416
|
+
var y = g.b + posH + 6 + row * ROWH;
|
|
417
|
+
var cx = (g.l + g.r) / 2, hw = Math.max(14, (g.r - g.l) / 2 - 2); // 1 字の語(I)でも記号の幅はある
|
|
418
|
+
d += "M" + f1(cx - hw) + "," + f1(y) + "H" + f1(cx + hw);
|
|
419
|
+
if (!best || g.r - g.l > best.r - best.l) best = {l: g.l, r: g.r, y: y};
|
|
420
|
+
});
|
|
421
|
+
R2.line.setAttribute("d", d || "M0,0");
|
|
422
|
+
R2.lab.setAttribute("x", f1(best ? (best.l + best.r) / 2 : 0)); R2.lab.setAttribute("y", f1(best ? best.y + 27 : 0));
|
|
423
|
+
var s1 = r.lower ? st("brackets") : st("role" + r.code), a = r.lower ? 0.3 * R2.j + 0.2 : 0.2 * R2.j;
|
|
424
|
+
var v = show(R2.line, s1, a, 0.5); stroke(R2.line, s1, a, 0.5, v);
|
|
425
|
+
show(R2.lab, s1, a + (draw ? 0.2 : 0), draw ? 0.3 : 0.5);
|
|
426
|
+
});
|
|
427
|
+
// ---- 括弧:最初の語の前と最後の語の後。同じ語で開く(閉じる)括弧は外のものほど外へ、少し高く
|
|
428
|
+
var sB = st("brackets"), tags = [];
|
|
429
|
+
var slot = function(i, key){ return s.groups.filter(function(g){ return g[key] === i; }).sort(function(x, y){ return y.depth - x.depth; }); };
|
|
430
|
+
S2.groups.forEach(function(G2){
|
|
431
|
+
var g = G2.g, A = box[g.a], B = box[g.b], shape = g.kind ? KIND[g.kind].shape : "round";
|
|
432
|
+
var jo = slot(g.a, "a").indexOf(g), jc = slot(g.b, "b").indexOf(g), w = BR * 0.5;
|
|
433
|
+
var glyph = function(x, t0, b0, dir){ // dir 1:開き(右へ開く)、-1:閉じ
|
|
434
|
+
var h = w * dir, mid = (t0 + b0) / 2;
|
|
435
|
+
if (shape === "square") return "M" + f1(x + h / 2) + "," + f1(t0) + "H" + f1(x - h / 2) + "V" + f1(b0) + "H" + f1(x + h / 2);
|
|
436
|
+
if (shape === "angle") return "M" + f1(x + h / 2) + "," + f1(t0) + "L" + f1(x - h / 2) + "," + f1(mid) + "L" + f1(x + h / 2) + "," + f1(b0);
|
|
437
|
+
return "M" + f1(x + h / 2) + "," + f1(t0) + "Q" + f1(x - h * 0.9) + "," + f1(mid) + " " + f1(x + h / 2) + "," + f1(b0);
|
|
438
|
+
};
|
|
439
|
+
var xo = A.l - BR * (jo + 0.5), xc = B.r + BR * (jc + 0.5);
|
|
440
|
+
G2.path.setAttribute("d", glyph(xo, A.t + 4 - jo * 3, A.b - 4 + jo * 3, 1) + glyph(xc, B.t + 4 - jc * 3, B.b - 4 + jc * 3, -1));
|
|
441
|
+
var a = 0.3 * G2.j, v = show(G2.path, sB, a, 0.5); stroke(G2.path, sB, a, 0.5, v);
|
|
442
|
+
// 名前:開きの括弧の上。外の括弧ほど上の段。同じ段・同じ行で前の名前に重なれば右へずらす
|
|
443
|
+
var row = G - 1 - g.depth, tw = Array.from(g.label).length * 24, x = xo - w / 2, y = A.t - 6 - row * TAGROW;
|
|
444
|
+
tags.forEach(function(q){ if (q.line === line[g.a] && q.row === row && x < q.r + 8 && x + tw > q.l - 8) x = q.r + 8; });
|
|
445
|
+
tags.push({line: line[g.a], row: row, l: x, r: x + tw});
|
|
446
|
+
G2.tag.setAttribute("x", f1(x)); G2.tag.setAttribute("y", f1(y));
|
|
447
|
+
show(G2.tag, sB, a, 0.5);
|
|
448
|
+
G2.tagBox = {l: x, r: x + tw, t: y - 21};
|
|
449
|
+
});
|
|
450
|
+
// ---- 矢印:修飾する側(括弧の名前、または語)の上から段の高さへ上がり、頭の語の上へ下りる
|
|
451
|
+
var sA = st("arrows"), ends = {};
|
|
452
|
+
S2.mods.forEach(function(M2){ (ends[M2.o.to] = ends[M2.o.to] || []).push(M2); });
|
|
453
|
+
Object.keys(ends).forEach(function(h){
|
|
454
|
+
var list = ends[h], x = box[+h], n = list.length;
|
|
455
|
+
list.sort(function(p, q){ return p.o.a - q.o.a; });
|
|
456
|
+
list.forEach(function(M2, j){ M2.x1 = n === 1 ? (x.l + x.r) / 2 : x.l + (x.r - x.l) * (j + 1) / (n + 1); });
|
|
457
|
+
});
|
|
458
|
+
S2.mods.forEach(function(M2){
|
|
459
|
+
var o = M2.o, H = box[o.to], x0, y0, x1 = M2.x1, y1 = H.t + 3, left = o.to < o.a;
|
|
460
|
+
if (o.from.group !== undefined){ var tb = S2.groups[o.from.group].tagBox; x0 = left ? tb.l + 12 : tb.r - 12; y0 = tb.t - 2; }
|
|
461
|
+
else { var F = box[o.from.token]; x0 = (F.l + F.r) / 2; y0 = F.t + 3; }
|
|
462
|
+
var F0 = box[o.a];
|
|
463
|
+
if (line[o.a] !== line[o.to]) warns.push("「" + s.tokens[o.a].t + "」から「" + s.tokens[o.to].t + "」への矢印が行をまたぐ(要素を広くするか size を小さく、文を短く)");
|
|
464
|
+
var yl = Math.min(F0.t, H.t) - 6 - G * TAGROW - 10 - (o.lane - 1) * LANE, rr = Math.min(8, Math.abs(x1 - x0) / 2), sx = x1 < x0 ? -1 : 1;
|
|
465
|
+
var d = "M" + f1(x0) + "," + f1(y0) + "V" + f1(yl + rr) + "Q" + f1(x0) + "," + f1(yl) + " " + f1(x0 + sx * rr) + "," + f1(yl) +
|
|
466
|
+
"H" + f1(x1 - sx * rr) + "Q" + f1(x1) + "," + f1(yl) + " " + f1(x1) + "," + f1(yl + rr) + "V" + f1(y1 - 2);
|
|
467
|
+
M2.path.setAttribute("d", d);
|
|
468
|
+
M2.head.setAttribute("transform", "translate(" + f1(x1) + " " + f1(y1) + ") rotate(90)");
|
|
469
|
+
var a = 0.4 * M2.j, v = show(M2.path, sA, a, 0.6); stroke(M2.path, sA, a, 0.6, v);
|
|
470
|
+
if (draw && !sA.faint) M2.head.setAttribute("opacity", prog(sA.lt, a, 0.6) >= 0.98 ? 1 : 0);
|
|
471
|
+
else show(M2.head, sA, a, 0.6);
|
|
472
|
+
});
|
|
473
|
+
// ---- 和訳
|
|
474
|
+
if (S2.yaku){ var sY = st("yaku"); S2.yaku.style.opacity = (sY.faint ? PV : prog(sY.lt, 0, 0.6)).toFixed(3); }
|
|
475
|
+
});
|
|
476
|
+
// 収まらないとき(1 度だけ知らせる。描く絵は変えない)
|
|
477
|
+
if (!this._warned){
|
|
478
|
+
var last = this.box.lastElementChild, bottom = last ? last.offsetTop + last.offsetHeight : 0;
|
|
479
|
+
if (bottom > this.clientHeight + 2) warns.push("要素の高さ " + this.clientHeight + "px に " + Math.ceil(bottom - this.clientHeight) + "px 足りない(要素を高くするか、文を分ける)");
|
|
480
|
+
if (warns.length && document.fonts && document.fonts.status === "loaded"){ this._warned = true; warns.filter(function(w, i){ return warns.indexOf(w) === i; }).forEach(function(w){ ctx.report("size", "[syntax] " + w); }); }
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Contours of f(x, y) by level, gradient arrows, a descent path by point
|
|
3
|
+
steps: levels (all: 1) → gradient → path points
|
|
4
|
+
props:
|
|
5
|
+
dur: s per step
|
|
6
|
+
size: text px
|
|
7
|
+
by: level or all
|
|
8
|
+
example: {"f":"x**2 + 3*y**2","range":{"x":[-3,3],"y":[-2,2]},"levels":[1,2,4,8],"gradient":{"at":[[1,1]]},"path":[[2.5,1.5],[1.5,0.3],[0.9,0.06]],"monotone":true}
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
`f` (arithmetic in x, y) or a script's `grid`; `levels` (≤8), `gradient.at`, `path` from a script. Size: with `equal` and a square range, about 740 px wide for 440 px high (a panel on the right); to fill the width, widen x or set `equal: false`.
|
|
12
|
+
<!-- llm: omit -->
|
|
13
|
+
- `range` {x, y}; `equal` (default true). `grid.values` row 0 = min y.
|
|
14
|
+
- Level labels on the lines. `gradient`: `scale`, `tangent`. `path` ≤30 points; `monotone` reports a rise.
|
|
15
|
+
- Colours: contours term, gradient accent2, path fg, current point emph. No preview of later steps.
|
|
16
|
+
<!-- llm: end -->
|
|
17
|
+
|
|
18
|
+
Demo: `demo.html`.
|
|
19
|
+
|
|
20
|
+
<!-- llm: omit -->
|
|
21
|
+
Notes
|
|
22
|
+
|
|
23
|
+
- A formula f is sampled on 97 × 73; pass narrow valleys as `grid`.
|
|
24
|
+
<!-- llm: end -->
|