egatari 0.6.14 → 0.6.16
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 +62 -1
- package/README.ja.md +65 -64
- package/README.md +40 -39
- package/bin/egatari.mjs +3 -3
- package/components.lock.json +507 -153
- package/components2.lock.json +1710 -33
- package/kit/check-messages.mjs +105 -71
- package/kit/check.mjs +17 -11
- package/kit/core/article-messages.mjs +15 -15
- package/kit/core/article-render.mjs +1 -1
- package/kit/core/article-text.mjs +3 -1
- package/kit/core/build-core.mjs +23 -1
- package/kit/core/check-parity.mjs +2 -2
- package/kit/core/check-rules.mjs +12 -7
- package/kit/core/colab-core.mjs +2 -2
- package/kit/core/comment-core.mjs +6 -0
- package/kit/core/export-name.mjs +2 -2
- package/kit/core/geometry-check.mjs +363 -25
- package/kit/core/layout-scan.mjs +75 -5
- package/kit/core/live-policy.mjs +2 -2
- package/kit/core/live.mjs +2 -2
- package/kit/core/llm-fix.mjs +24 -13
- package/kit/core/llm-insert.mjs +11 -11
- package/kit/core/llm-outline.mjs +7 -7
- package/kit/core/llm-pack-assemble.mjs +5 -2
- package/kit/core/llm-pack-data.mjs +225 -39
- package/kit/core/llm-pack.mjs +3 -3
- package/kit/core/new-deck.mjs +17 -3
- package/kit/core/part-labels.mjs +6 -0
- package/kit/core/parts2.mjs +5 -5
- package/kit/core/player.mjs +18 -0
- package/kit/core/portable.mjs +26 -8
- package/kit/core/purposes.mjs +2 -2
- package/kit/core/ref-voice.mjs +1 -1
- package/kit/core/scorm.mjs +1 -1
- package/kit/core/sound-preferences.mjs +1 -1
- package/kit/core/theme-derive.mjs +209 -0
- package/kit/core/themes-list.mjs +1 -1
- package/kit/core/themes-lock.mjs +1 -1
- package/kit/core/tier-a.mjs +20 -8
- package/kit/deck.js +7 -4
- package/kit/instruction-version.json +1 -1
- package/kit/live.js +20 -20
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/presenter.js +5 -3
- package/kit/templates/new-deck.mjs +6 -6
- package/kit/tools.js +13 -6
- package/kit/track.js +1 -1
- package/package.json +4 -2
- package/server/dev.mjs +3 -2
- package/server/editor-ui.js +28 -20
- package/server/hints.js +22 -2
- package/tts/yomi.yaml +8 -0
- 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 +16 -1
- package/vendor/egatari-spec/schema/egatari-metadata.schema.json +17 -2
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
// m-code: a program, successive line explanations, then its supplied output. Never executes code.
|
|
2
|
+
// 2.2.0: the drawing helpers live in code-core. Whenever 2.1.0's layout fits (no layout report), the same layout is drawn.
|
|
3
|
+
// Otherwise (code taller or wider than the box, a note too long for the band, or a step that lists 3+ lines) the fit layout
|
|
4
|
+
// is drawn instead: notes in the band (up to 2 rows), long lines soft-wrapped under a "↪" gutter, and a moving window of rows
|
|
5
|
+
// centred on each step's lines with "⋮" markers for the hidden ones. The full source and output stay in a child
|
|
6
|
+
// <pre data-readable> (the readable layer copies it as visible text).
|
|
7
|
+
egatariParts.define({name: "code", version: "2.2.1", requires: {base: "1.3.0", "code-core": "1.0.1"}, element: "m-code"}, function(deps){
|
|
8
|
+
"use strict";
|
|
9
|
+
var base = deps.base, MONO = deps["code-core"].MONO;
|
|
10
|
+
var TEXT = {
|
|
11
|
+
ja: {output: "出力", run: "▶ 実行", readable: "コードと出力", summary: function(lang, n, output){ return (lang || "プログラム") + " のコード " + n + " 行" + (output ? "と出力" : ""); }},
|
|
12
|
+
en: {output: "Output", run: "▶ Run", readable: "Code and output", summary: function(lang, n, output){ return (lang || "Program") + ": " + n + " lines of code" + (output ? " and output" : ""); }}
|
|
13
|
+
};
|
|
14
|
+
var C = deps["code-core"], set = C.set, lines = C.lines, monoWidth = C.monoWidth, cut = C.cut, spans = C.spans, wrap = C.wrap;
|
|
15
|
+
return class extends base.MotionElement {
|
|
16
|
+
static partName = "code";
|
|
17
|
+
static shape = {schema: {type: "object", additionalProperties: false, required: ["code", "steps"], properties: {
|
|
18
|
+
code: {type: "string"}, lang: {type: "string"}, output: {type: "string"},
|
|
19
|
+
steps: {type: "array", items: {type: "object", additionalProperties: false, required: ["lines", "note"], properties: {
|
|
20
|
+
lines: {type: "array", minItems: 1, maxItems: 16, items: {type: ["integer", "array"], minItems: 2, maxItems: 2, items: {type: "integer"}}}, note: {type: "string"}
|
|
21
|
+
}}}
|
|
22
|
+
}}, example: /*@egatari-block example*/{"lang":"python","code":"import pandas as pd\ndf = pd.read_csv(\"sales.csv\")\ndf.groupby(\"store\")[\"sales\"].mean()","steps":[{"lines":[1],"note":"pandas を読み込む"},{"lines":[2],"note":"CSV を表として読む"},{"lines":[3],"note":"店ごとの平均"}],"output":"store\nA 120.5\nB 98.0"}/*@egatari-block-end*/};
|
|
23
|
+
static props = {
|
|
24
|
+
dur: {type: "number", default: 0.6, doc: "ステップの秒数"},
|
|
25
|
+
size: {type: "number", default: 0, doc: "文字 px(0 は既定)"},
|
|
26
|
+
outputPos: {type: "enum", values: ["auto", "below", "right"], default: "auto", doc: "出力の位置"}
|
|
27
|
+
};
|
|
28
|
+
get steps(){ return this.data.steps.length + 1 + (this.data.output !== undefined ? 1 : 0); }
|
|
29
|
+
duration(k){ return k >= 1 && k <= this.steps ? this.props.dur : 0; }
|
|
30
|
+
label(g, x, y, s, fs, color, mono){
|
|
31
|
+
var e = base.el("text", {x: x, y: y, "font-size": fs, fill: color || "var(--fg)"}, g);
|
|
32
|
+
// 等幅と空白:テーマの `svg text{font-family}` は属性より強いので style に書く。行頭の字下げを残す(white-space: pre)
|
|
33
|
+
if (mono){ e.setAttribute("style", (e.getAttribute("style") || "") + "font-family:" + MONO + ";white-space:pre;"); }
|
|
34
|
+
e.textContent = s; return e;
|
|
35
|
+
}
|
|
36
|
+
mount(ctx){
|
|
37
|
+
// [[3, 4]] is read as [3, 4] (one range per step); any other nesting is a range problem below
|
|
38
|
+
var self = this, d = Object.assign({}, this.data, {steps: this.data.steps.map(function(s, j){
|
|
39
|
+
var r = s.lines.length === 1 && Array.isArray(s.lines[0]) ? s.lines[0] : s.lines;
|
|
40
|
+
if (r.some(Array.isArray)){ ctx.report("range", "[code] steps[" + j + "].lines: one range per step, e.g. [3, 4]"); return {lines: [0], note: s.note, nested: true}; }
|
|
41
|
+
// 3 つ以上の整数は、その行だけ(飛び飛びでよい)。1〜2 個は今までどおり 1 行か範囲
|
|
42
|
+
if (r.length >= 3) return {lines: [Math.min.apply(null, r), Math.max.apply(null, r)], set: r.slice().sort(function(x, y){ return x - y; }), note: s.note};
|
|
43
|
+
return {lines: r, note: s.note};
|
|
44
|
+
})}), P = this.props, T = /^ja\b/i.test(ctx.lang || "") ? TEXT.ja : TEXT.en;
|
|
45
|
+
if (!(Number.isFinite(P.dur) && P.dur > 0)){ ctx.report("attr", "[code] dur must be positive; using 0.6"); P.dur = 0.6; }
|
|
46
|
+
if (!(P.size === 0 || Number.isFinite(P.size) && P.size >= 24)){ ctx.report("attr", "[code] size must be 0 or at least 24; using defaults"); P.size = 0; }
|
|
47
|
+
if (!["auto", "below", "right"].includes(P.outputPos)){ ctx.report("attr", "[code] invalid outputPos; using auto"); P.outputPos = "auto"; }
|
|
48
|
+
// 大きさを測る前にブロックにする(インラインのままだと幅が 0 になる)
|
|
49
|
+
this.style.display = "block"; this.style.position = "relative"; this.style.writingMode = "horizontal-tb";
|
|
50
|
+
this.fs = P.size || 24; this.noteSize = P.size || 26;
|
|
51
|
+
var fs = this.fs, nf = this.noteSize, row = Math.ceil(fs * 1.4), noteRow = Math.ceil(nf * 1.45 + 4);
|
|
52
|
+
var W = Math.max(1, this.clientWidth), H = Math.max(1, this.clientHeight), program = lines(d.code), output = d.output === undefined ? [] : lines(d.output);
|
|
53
|
+
var lang = d.lang || "", marks = spans(program, lang.toLowerCase());
|
|
54
|
+
this.setAttribute("role", "figure"); // 中の読める pre が読まれるように(img の子は読まれない)
|
|
55
|
+
if (!this.getAttribute("aria-label")) this.setAttribute("aria-label", T.summary(lang.toLowerCase() === "python" ? "Python" : lang, program.length, d.output !== undefined) + "; " + d.steps.map(function(s){ return s.note; }).join("; "));
|
|
56
|
+
// Keep the full source readable inside the figure even when the SVG is truncated.
|
|
57
|
+
var pre = document.createElement("pre"); pre.className = "sr-only";
|
|
58
|
+
pre.setAttribute("style", "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:pre;border:0");
|
|
59
|
+
pre.setAttribute("aria-label", T.readable); pre.setAttribute("data-readable", "");
|
|
60
|
+
pre.textContent = d.code + (d.output !== undefined ? "\n\n" + T.output + "\n" + d.output : ""); this.appendChild(pre);
|
|
61
|
+
this.svg = base.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true"}, this);
|
|
62
|
+
var header = row + 16, pad = 16, gap = 32, numW = monoWidth(String(program.length), fs) + 16;
|
|
63
|
+
var expanded = program.map(function(s){ return s.replace(/\t/g, " "); });
|
|
64
|
+
var longest = expanded.reduce(function(a, b){ return monoWidth(a, fs) >= monoWidth(b, fs) ? a : b; }, "");
|
|
65
|
+
var natural = Math.max(160, monoWidth(longest, fs)) + numW + 2 * pad;
|
|
66
|
+
var outNatural = Math.max(monoWidth(T.output, fs) + monoWidth(T.run, fs) + pad + 8, ...output.slice(0, 8).map(function(s){ return monoWidth(s.replace(/\t/g, " "), fs); })) + 2 * pad;
|
|
67
|
+
var outputH = output.length ? header + row * Math.min(8, output.length) + pad : 0;
|
|
68
|
+
var right = output.length > 0 && (P.outputPos === "right" || P.outputPos === "auto" && program.length <= 8 && natural + 280 + outNatural + 2 * gap <= W);
|
|
69
|
+
var outW = right ? Math.max(120, Math.min(outNatural, W * 0.3)) : 0;
|
|
70
|
+
var available = W - (right ? outW + gap : 0), codeW = natural;
|
|
71
|
+
var nx = codeW + gap, nw = Math.max(1, available - nx);
|
|
72
|
+
var areaH = H - (!right && output.length ? outputH + 16 : 0), nextY = header;
|
|
73
|
+
// Keep the beside layout only if *all* the notes fit at their line targets.
|
|
74
|
+
var beside = natural <= W * 0.55 && natural + gap + 260 <= available;
|
|
75
|
+
d.steps.forEach(function(s){
|
|
76
|
+
var a = s.lines[0], b = s.lines.length === 2 ? s.lines[1] : a;
|
|
77
|
+
var target = header + ((a + b - 2) / 2 + 0.5) * row;
|
|
78
|
+
var h = Math.max(1, wrap(s.note, nw - 24, nf, self).length) * noteRow + 16;
|
|
79
|
+
nextY = Math.max(nextY, target - h / 2) + h + 8;
|
|
80
|
+
if (nextY - 8 > areaH) beside = false;
|
|
81
|
+
});
|
|
82
|
+
this.noteLayout = beside ? "beside" : "band";
|
|
83
|
+
if (!beside){
|
|
84
|
+
// 出力は、コードの横に入るなら右に(幅で決める。短い出力なら広いコードの横にも入る)
|
|
85
|
+
right = output.length > 0 && (P.outputPos === "right" || P.outputPos === "auto" && natural + gap + Math.max(120, outNatural) <= W);
|
|
86
|
+
outW = right ? Math.max(120, Math.min(outNatural, W - gap - natural)) : 0;
|
|
87
|
+
available = W - (right ? outW + gap : 0);
|
|
88
|
+
codeW = Math.max(1, Math.min(natural, available));
|
|
89
|
+
nx = 0; nw = right ? codeW : W;
|
|
90
|
+
areaH = H - (!right && output.length ? outputH + 16 : 0);
|
|
91
|
+
}
|
|
92
|
+
// 下帯の最終一覧:説明ごとに行の範囲を付け(「3–4:…」)、説明の途中では折らずに行へ詰める。字は 24px、行間は字の箱 1.45em
|
|
93
|
+
var listFont = Math.max(24, nf - 2), listRow = Math.ceil(listFont * 1.45);
|
|
94
|
+
var items = d.steps.map(function(s){ var r = Array.isArray(s.lines) ? s.lines : []; var x = r[0], y = r.length > 1 ? r[1] : r[0]; return x + (y === x ? "" : "–" + y) + (T === TEXT.ja ? ":" : ": ") + s.note.replace(/\s*\n\s*/g, " "); });
|
|
95
|
+
// 出力が下に回るときは説明帯の右に並べ、帯と出力の高い方だけを使う
|
|
96
|
+
var sideW = Math.max(120, outNatural);
|
|
97
|
+
var side = !beside && !right && output.length > 0 && P.outputPos === "auto" && d.steps.length > 0 && outNatural <= W * 0.45 && W - sideW - gap >= W * 0.4;
|
|
98
|
+
if (side){ nw = W - sideW - gap; areaH = H; }
|
|
99
|
+
var list = [];
|
|
100
|
+
if (!beside && d.steps.length){
|
|
101
|
+
var cur = "", sep = T === TEXT.ja ? " " : " ";
|
|
102
|
+
items.forEach(function(t){
|
|
103
|
+
var cand = cur ? cur + sep + t : t;
|
|
104
|
+
if (cur && base.textWidth(cand, listFont, {font: self}) > nw - 24){ list.push(cur); cur = t; } else cur = cand;
|
|
105
|
+
});
|
|
106
|
+
if (cur) list.push(cur);
|
|
107
|
+
}
|
|
108
|
+
// 高さの式は 1 つ:コード部 + 帯(一覧 r 行)と横の出力の高い方 + 下の出力。報告もこの式で数える
|
|
109
|
+
function bandFor(r){ return r ? noteRow + 16 + (r - 1) * listRow : 0; }
|
|
110
|
+
function need(n, r){ var zone = Math.max(bandFor(r), side ? outputH : 0); return Math.ceil(header + n * row + pad + (zone ? 8 + zone : 0) + (!right && !side && output.length ? outputH + 16 : 0)); }
|
|
111
|
+
var want = Math.min(16, program.length), rows = list.length, fullList = true;
|
|
112
|
+
function fitsAt(h, r){ return Math.max(0, Math.floor((h - need(0, r)) / row)); }
|
|
113
|
+
var capacity = fitsAt(H, rows);
|
|
114
|
+
if (capacity < want && rows > 1 && fitsAt(H, 1) >= want){ fullList = false; capacity = fitsAt(H, 1); } // コードを全部残し、最終一覧は最後の説明だけ
|
|
115
|
+
var bandH = bandFor(fullList ? rows : Math.min(1, rows)), bandSpace = bandH ? bandH + 8 : 0;
|
|
116
|
+
var count = Math.min(want, capacity), codeH = header + count * row + pad;
|
|
117
|
+
var neededH = need(want, rows), SLIDE = 440;
|
|
118
|
+
function advice(){
|
|
119
|
+
return neededH <= SLIDE ? "give the element about " + neededH + " px" : "more than a slide body under a heading (about " + SLIDE + " px) holds; " + SLIDE + " px fits " + Math.min(want, fitsAt(SLIDE, rows)) + " lines with these notes: show fewer lines, shorten notes or split the slide";
|
|
120
|
+
}
|
|
121
|
+
var textX = pad + numW, firstY = header + fs, textW = Math.max(0, codeW - textX - pad);
|
|
122
|
+
// 2.1.0 の配置で収まらないとき(報告が出るとき)だけ、収める配置に切り替える
|
|
123
|
+
var noteTooLong = !beside && d.steps.some(function(s){
|
|
124
|
+
var a = s.lines[0], b = s.lines.length === 2 ? s.lines[1] : a, pre = (T === TEXT.ja ? a + (b === a ? "" : "–" + b) + " 行目" : (a === b ? "line " + a : "lines " + a + "–" + b)) + " · ";
|
|
125
|
+
return base.textWidth(s.note, nf, {font: self}) > Math.max(0, nw - 24 - base.textWidth(pre, nf, {font: self})) || lines(s.note).length > 1;
|
|
126
|
+
});
|
|
127
|
+
if (count < program.length || monoWidth(longest, fs) > textW || noteTooLong || d.steps.some(function(s){ return s.set; })){
|
|
128
|
+
this.fit = true; return this.mountFit(ctx, d, T, program, output, marks, lang);
|
|
129
|
+
}
|
|
130
|
+
if (count < program.length) ctx.report("layout", "[code] " + program.length + " lines; this height fits " + Math.min(16, capacity) + " (" + advice() + (neededH <= SLIDE ? ", or show fewer lines" : "") + ")" + (program.length > 16 ? "; at most 16 lines per panel" : ""));
|
|
131
|
+
if (monoWidth(longest, fs) > textW) ctx.report("layout", "[code] the longest line is " + [...longest].length + " characters; this width fits " + Math.floor(textW / (0.6 * fs)) + " at " + fs + "px (break the line)");
|
|
132
|
+
this.geometry = {side: side, listRows: rows, codeW: codeW, codeH: codeH, nx: nx, nw: nw, row: row, firstY: firstY, right: right, count: count, neededH: neededH, bandH: bandH, noteLayout: this.noteLayout};
|
|
133
|
+
this.codeLayer = base.el("g", {opacity: 0}, this.svg);
|
|
134
|
+
function panel(g, x, y, w, h){ base.el("rect", {x: x, y: y, width: Math.max(1, w), height: Math.max(1, h), rx: 12, fill: "var(--term-tint, color-mix(in srgb, var(--fg) 5%, var(--bg)))", stroke: "var(--line)", "stroke-width": 2}, g); }
|
|
135
|
+
panel(this.codeLayer, 1, 1, codeW - 2, codeH - 2);
|
|
136
|
+
var tagW = Math.max(1, codeW - 2 * pad), tag = cut(lang, tagW, fs);
|
|
137
|
+
if (count || H >= header + pad) this.label(this.codeLayer, codeW - pad - monoWidth(tag, fs), pad + fs, tag, fs, "var(--muted)", true);
|
|
138
|
+
this.bands = d.steps.map(function(){ return base.el("rect", {x: 4, y: header, width: Math.max(1, codeW - 8), height: row, fill: "var(--emph-tint, color-mix(in srgb, var(--emph) 12%, var(--bg)))", opacity: 0}, self.codeLayer); });
|
|
139
|
+
if (tag !== lang) ctx.report("layout", "[code] language tag needs " + Math.ceil(monoWidth(lang, fs)) + " px; header fits " + Math.floor(tagW) + " px");
|
|
140
|
+
this.numbers = [];
|
|
141
|
+
for (var i = 0; i < count; i++){
|
|
142
|
+
var y = firstY + i * row, original = program[i].replace(/\t/g, " "), s = cut(original, Math.max(0, codeW - textX - pad), fs);
|
|
143
|
+
if (i === count - 1 && count < program.length) s = cut(s + "…", Math.max(0, codeW - textX - pad), fs);
|
|
144
|
+
this.numbers.push(this.label(this.codeLayer, pad, y, String(i + 1), fs, "var(--muted)", true));
|
|
145
|
+
// One <text> per line; coloured runs are tspans, so the browser's own advance places them (indices after tab expansion)
|
|
146
|
+
var e = this.label(this.codeLayer, textX, y, "", fs, "var(--fg)", true), pos = 0, line = program[i];
|
|
147
|
+
var put = function(a, b, role){ if (b > a) base.el("tspan", role ? {fill: "var(--" + role + ")"} : {}, e).textContent = s.slice(a, b); };
|
|
148
|
+
marks[i].forEach(function(m){
|
|
149
|
+
var a = Math.min(s.length, line.slice(0, m[0]).replace(/\t/g, " ").length), b = Math.min(s.length, line.slice(0, m[1]).replace(/\t/g, " ").length);
|
|
150
|
+
put(pos, a); put(a, b, m[2]); pos = b;
|
|
151
|
+
});
|
|
152
|
+
put(pos, s.length);
|
|
153
|
+
}
|
|
154
|
+
if (count === 0 || W < 360 || textW < fs){
|
|
155
|
+
ctx.report("size", "[code] element is " + W + " × " + H + " px; allow at least 360 × " + Math.ceil(header + row + pad + bandSpace) + " px for one code line and notes");
|
|
156
|
+
}
|
|
157
|
+
// Even unusably small boxes retain a clipped panel and an ellipsis.
|
|
158
|
+
this.svg.setAttribute("style", "overflow:hidden");
|
|
159
|
+
if (!count) this.label(this.codeLayer, Math.min(pad, W / 4), Math.min(fs, H), "…", fs);
|
|
160
|
+
nextY = header;
|
|
161
|
+
var bandY = codeH + 8, bandRoom = Math.max(0, areaH - bandY);
|
|
162
|
+
function proseCut(s, width, f){
|
|
163
|
+
f = f || nf;
|
|
164
|
+
if (base.textWidth(s, f, {font: self}) <= width) return s;
|
|
165
|
+
var chars = [...s];
|
|
166
|
+
while (chars.length && base.textWidth(chars.join("") + "…", f, {font: self}) > width) chars.pop();
|
|
167
|
+
return width >= f ? chars.join("") + "…" : "";
|
|
168
|
+
}
|
|
169
|
+
function marker(a, b){ return T === TEXT.ja ? a + (b === a ? "" : "–" + b) + " 行目" : (a === b ? "line " + a : "lines " + a + "–" + b); }
|
|
170
|
+
this.notes = d.steps.map(function(s, j){
|
|
171
|
+
var a = s.lines[0], b = s.lines.length === 2 ? s.lines[1] : a;
|
|
172
|
+
var valid = a >= 1 && b >= a && b <= program.length;
|
|
173
|
+
if (!valid && !s.nested) ctx.report("range", "[code] steps[" + j + "].lines must be an inclusive range within 1–" + program.length);
|
|
174
|
+
var target = valid && a <= count ? header + ((a - 1 + Math.min(b, count) - 1) / 2 + 0.5) * row : header;
|
|
175
|
+
var g = base.el("g", {opacity: 0}, self.svg), text, top, h, labels;
|
|
176
|
+
if (beside){
|
|
177
|
+
text = wrap(s.note, nw - 24, nf, self); h = Math.max(noteRow, text.length * noteRow) + 16;
|
|
178
|
+
top = Math.max(nextY, target - h / 2);
|
|
179
|
+
if (valid && a <= count) base.el("path", {d: "M " + codeW + " " + target + " H " + (nx - 12) + " V " + (top + h / 2) + " H " + nx, fill: "none", stroke: "var(--muted)", "stroke-width": 2}, g);
|
|
180
|
+
base.el("rect", {x: nx, y: top, width: nw - 1, height: h, rx: 8, fill: "var(--bg)", stroke: "var(--line)", "stroke-width": 2}, g);
|
|
181
|
+
labels = text.map(function(t, k){ return self.label(g, nx + 12, top + 8 + nf + k * noteRow, t, nf); });
|
|
182
|
+
nextY = top + h + 8;
|
|
183
|
+
} else {
|
|
184
|
+
top = bandY; h = Math.min(bandFor(1), bandRoom);
|
|
185
|
+
var prefix = marker(a, b) + " · ", prefixW = base.textWidth(prefix, nf, {font: self}), room = Math.max(0, nw - 24 - prefixW);
|
|
186
|
+
var width = base.textWidth(s.note, nf, {font: self});
|
|
187
|
+
if (width > room || lines(s.note).length > 1){
|
|
188
|
+
var approx = Math.max(0, Math.floor([...s.note].length * room / Math.max(1, width)));
|
|
189
|
+
ctx.report("layout", "[code] note " + (j + 1) + " is too long for the band (" + Math.ceil(width) + " px of " + Math.floor(room) + "); shorten it to about " + approx + " characters");
|
|
190
|
+
}
|
|
191
|
+
base.el("rect", {x: 1, y: top, width: Math.max(1, nw - 2), height: Math.max(1, h), rx: 8, fill: "var(--bg)", stroke: "var(--line)", "stroke-width": 2}, g);
|
|
192
|
+
labels = [self.label(g, 12, top + 8 + nf, proseCut(prefix + s.note.replace(/\s*\n\s*/g, " "), nw - 24), nf)];
|
|
193
|
+
}
|
|
194
|
+
if (valid && a <= count){ set(self.bands[j], "y", header + (a - 1) * row); set(self.bands[j], "height", (Math.min(b, count) - a + 1) * row); }
|
|
195
|
+
return {g: g, labels: labels, a: a, b: b, valid: valid && a <= count, top: top, height: h, fits: true};
|
|
196
|
+
});
|
|
197
|
+
this.finalNotes = base.el("g", {opacity: 0}, this.svg);
|
|
198
|
+
if (!beside && d.steps.length){
|
|
199
|
+
list = list.map(function(t){ return proseCut(t, nw - 24, listFont); });
|
|
200
|
+
if (!fullList || bandFor(list.length) > bandRoom){
|
|
201
|
+
// 最後の説明だけを残す(説明はすべて読み上げの要約にある)。報告にはせず、要素に印を付ける
|
|
202
|
+
this.setAttribute("data-fit", "last-note");
|
|
203
|
+
list = [proseCut(items[items.length - 1], nw - 24, listFont)];
|
|
204
|
+
}
|
|
205
|
+
base.el("rect", {x: 1, y: bandY, width: Math.max(1, nw - 2), height: Math.max(1, Math.min(bandRoom, bandFor(list.length))), rx: 8, fill: "var(--bg)", stroke: "var(--line)", "stroke-width": 2}, this.finalNotes);
|
|
206
|
+
list.forEach(function(s, i){ self.label(self.finalNotes, 12, bandY + 8 + nf + i * listRow, s, listFont); });
|
|
207
|
+
}
|
|
208
|
+
this.outputLayer = base.el("g", {opacity: 0}, this.svg);
|
|
209
|
+
if (output.length){
|
|
210
|
+
var ox = right ? W - outW : side ? W - sideW : 0, oy = right ? 0 : side ? codeH + 8 : areaH + 16, ow = right ? outW : side ? sideW : codeW;
|
|
211
|
+
var oc = Math.max(0, Math.min(8, output.length, Math.floor((H - oy - header - pad) / row)));
|
|
212
|
+
panel(this.outputLayer, ox + 1, oy + 1, ow - 2, header + oc * row + pad - 2);
|
|
213
|
+
self.label(this.outputLayer, ox + pad, oy + pad + fs, cut(T.output, ow - 2 * pad, fs), fs);
|
|
214
|
+
// Run precedes the supplied plain text in a separate header region.
|
|
215
|
+
var run = cut(T.run, ow - 2 * pad - monoWidth(T.output, fs) - pad, fs);
|
|
216
|
+
self.label(this.outputLayer, ox + ow - pad - monoWidth(run, fs), oy + pad + fs, run, fs, "var(--muted)", true);
|
|
217
|
+
var outputCut = oc < output.length || run !== T.run || monoWidth(T.output, fs) > ow - 2 * pad;
|
|
218
|
+
output.slice(0, oc).forEach(function(s, i){
|
|
219
|
+
var txt = cut(s.replace(/\t/g, " "), ow - 2 * pad, fs);
|
|
220
|
+
if (i === oc - 1 && oc < output.length) txt = cut(txt + "…", ow - 2 * pad, fs);
|
|
221
|
+
if (txt !== s) outputCut = true;
|
|
222
|
+
self.label(self.outputLayer, ox + pad, oy + header + fs + i * row, txt, fs, "var(--fg)", true);
|
|
223
|
+
});
|
|
224
|
+
if (outputCut) ctx.report("layout", "[code] output exceeds eight lines or panel width/height; showing what fits with …");
|
|
225
|
+
}
|
|
226
|
+
if (outputH > H) ctx.report("size", "[code] output needs " + outputH + " px height; element has " + H + " px");
|
|
227
|
+
}
|
|
228
|
+
// 収める配置(2.2.0):説明は下の帯(2 行まで)、長い行は折り返し(続きの行は番号の欄に ↪)、行が多ければステップごとに
|
|
229
|
+
// そのステップの行が中央に来るようにスクロールして表示する(隠れた行は ⋮ と数)。表示する範囲はステップの前半で消え、後半で新しい位置に出る((k, t) だけで決まる)
|
|
230
|
+
mountFit(ctx, d, T, program, output, marks, lang){
|
|
231
|
+
var self = this, P = this.props, fs = this.fs, nf = this.noteSize, row = Math.ceil(fs * 1.4), noteRow = Math.ceil(nf * 1.45 + 4);
|
|
232
|
+
var W = Math.max(1, this.clientWidth), H = Math.max(1, this.clientHeight), header = row + 16, pad = 16, gap = 32, ja = T === TEXT.ja;
|
|
233
|
+
this.ja = ja;
|
|
234
|
+
var outNatural = Math.max(monoWidth(T.output, fs) + monoWidth(T.run, fs) + pad + 8, ...output.slice(0, 8).map(function(s){ return monoWidth(s.replace(/\t/g, " "), fs); })) + 2 * pad;
|
|
235
|
+
var outputH = output.length ? header + row * Math.min(8, output.length) + pad : 0;
|
|
236
|
+
var right = output.length > 0 && (P.outputPos === "right" || P.outputPos === "auto" && W - gap - Math.max(120, outNatural) >= W * 0.55);
|
|
237
|
+
var outW = right ? Math.max(120, Math.min(outNatural, W * 0.4)) : 0, codeW = right ? W - outW - gap : W;
|
|
238
|
+
// 出力が下に回るとき、帯が幅の 4 割以上残るなら、出力は帯の右に並べる(帯と出力の高い方だけ使う)
|
|
239
|
+
var sideW = Math.max(120, outNatural), side = !right && output.length > 0 && P.outputPos === "auto" && d.steps.length > 0 && W - sideW - gap >= W * 0.4;
|
|
240
|
+
var numW = monoWidth(String(program.length), fs) + 16, textX = pad + numW, textW = Math.max(fs, codeW - textX - pad), firstY = header + fs;
|
|
241
|
+
// 見た目の行:元の行ごとに折り返す。色の範囲は字下げを広げた後の位置に直して、行の切れ目で分ける
|
|
242
|
+
var vrows = [], rowsOf = [];
|
|
243
|
+
program.forEach(function(line, i){
|
|
244
|
+
var ex = line.replace(/\t/g, " "), chars = [...ex], at = function(m){ return [...line.slice(0, m).replace(/\t/g, " ")].length; };
|
|
245
|
+
var segs = C.softWrap(ex, textW, fs), mine = [];
|
|
246
|
+
segs.forEach(function(g, j){
|
|
247
|
+
var sp = marks[i].map(function(m){ return [Math.max(at(m[0]), g.from) - g.from, Math.min(at(m[1]), g.to) - g.from, m[2]]; }).filter(function(m){ return m[1] > m[0]; });
|
|
248
|
+
mine.push(vrows.length); vrows.push({line: i + 1, cont: j > 0, text: chars.slice(g.from, g.to).join(""), spans: sp});
|
|
249
|
+
});
|
|
250
|
+
rowsOf.push(mine);
|
|
251
|
+
});
|
|
252
|
+
var stepRows = d.steps.map(function(s){
|
|
253
|
+
var want = s.set ? s.set : s.lines.length === 2 ? range(s.lines[0], s.lines[1]) : [s.lines[0]];
|
|
254
|
+
var ok = want.every(function(n){ return n >= 1 && n <= program.length; }) && !s.nested && (s.set || s.lines.length === 1 || s.lines[1] >= s.lines[0]);
|
|
255
|
+
if (!ok && !s.nested) ctx.report("range", "[code] steps[" + d.steps.indexOf(s) + "].lines must be within 1–" + program.length);
|
|
256
|
+
var rs = ok ? [].concat.apply([], want.map(function(n){ return rowsOf[n - 1]; })) : [];
|
|
257
|
+
return {lines: ok ? want : [], rows: rs};
|
|
258
|
+
});
|
|
259
|
+
function range(a, b){ var o = []; for (var i = a; i <= b; i++) o.push(i); return o; }
|
|
260
|
+
// 帯の説明:「3–4 行目 · 説明」を 2 行までに折る。3 行以上なら 2 行目の末を … にして知らせる
|
|
261
|
+
var nw = side ? W - sideW - gap : codeW, marker = function(st){ var L = st.lines; if (!L.length) return ""; var cont = L.every(function(n, i){ return i === 0 || n === L[i - 1] + 1; });
|
|
262
|
+
var t = cont ? (L.length === 1 ? String(L[0]) : L[0] + "–" + L[L.length - 1]) : L.join(", ");
|
|
263
|
+
return ja ? t + " 行目" : (L.length === 1 ? "line " : "lines ") + t; };
|
|
264
|
+
var noteLines = d.steps.map(function(s, j){
|
|
265
|
+
var w = wrap(marker(stepRows[j]) + " · " + s.note.replace(/\s*\n\s*/g, " "), nw - 24, nf, self);
|
|
266
|
+
if (w.length > 2){
|
|
267
|
+
ctx.report("layout", "[code] note " + (j + 1) + " needs " + w.length + " rows in the band (2 fit); shorten it");
|
|
268
|
+
w = [w[0], proseCut(w.slice(1).join(" "), nw - 24, nf)];
|
|
269
|
+
}
|
|
270
|
+
return w;
|
|
271
|
+
});
|
|
272
|
+
function proseCut(s, width, f){
|
|
273
|
+
f = f || nf;
|
|
274
|
+
if (base.textWidth(s, f, {font: self}) <= width) return s;
|
|
275
|
+
var ch = [...s];
|
|
276
|
+
while (ch.length && base.textWidth(ch.join("") + "…", f, {font: self}) > width) ch.pop();
|
|
277
|
+
return width >= f ? ch.join("") + "…" : "";
|
|
278
|
+
}
|
|
279
|
+
var nr = Math.max(1, ...noteLines.map(function(w){ return w.length; })), bandH = d.steps.length ? nr * noteRow + 16 : 0;
|
|
280
|
+
// 最後の一覧:説明ごとに「3–4:…」を行へ詰める。入らなければ最後の説明だけ(data-fit="last-note")
|
|
281
|
+
var listFont = Math.max(24, nf - 2), listRow = Math.ceil(listFont * 1.45), sep = ja ? " " : " ", list = [], cur = "";
|
|
282
|
+
d.steps.forEach(function(s, j){
|
|
283
|
+
var L = stepRows[j].lines, t = (L.length ? (marker(stepRows[j]).replace(/ 行目$|^lines? /, "")) : "?") + (ja ? ":" : ": ") + s.note.replace(/\s*\n\s*/g, " ");
|
|
284
|
+
var cand = cur ? cur + sep + t : t;
|
|
285
|
+
if (cur && base.textWidth(cand, listFont, {font: self}) > nw - 24){ list.push(cur); cur = t; } else cur = cand;
|
|
286
|
+
});
|
|
287
|
+
if (cur) list.push(cur);
|
|
288
|
+
var listH = list.length ? noteRow + 16 + (list.length - 1) * listRow : 0, below = !right && !side && output.length ? outputH + 16 : 0;
|
|
289
|
+
var zone = Math.max(bandH, listH, side ? outputH : 0), slots = Math.floor((H - header - pad - (zone ? 8 + zone : 0) - below) / row);
|
|
290
|
+
// コードを先に:最後の一覧の分だけコードの行が減るなら、一覧は最後の説明だけにする
|
|
291
|
+
var zoneNoList = Math.max(bandH, side ? outputH : 0), slotsNoList = Math.floor((H - header - pad - (zoneNoList ? 8 + zoneNoList : 0) - below) / row);
|
|
292
|
+
if (list.length > 1 && slots < Math.min(vrows.length, slotsNoList)){
|
|
293
|
+
zone = zoneNoList; slots = slotsNoList;
|
|
294
|
+
this.setAttribute("data-fit", "last-note"); list = [proseCut(list[list.length - 1], nw - 24, listFont)];
|
|
295
|
+
listH = noteRow + 16;
|
|
296
|
+
}
|
|
297
|
+
if (slots < 3){
|
|
298
|
+
var needH = header + pad + 3 * row + (zone ? 8 + zone : 0) + below;
|
|
299
|
+
ctx.report("size", "[code] element is " + W + " × " + H + " px; the fit layout needs at least " + Math.ceil(needH) + " px height for 3 code rows and the notes");
|
|
300
|
+
slots = Math.max(1, slots);
|
|
301
|
+
}
|
|
302
|
+
var shown = Math.min(slots, vrows.length), codeH = header + shown * row + pad;
|
|
303
|
+
this.windows = stepRows.map(function(st, j){
|
|
304
|
+
var ra = st.rows.length ? Math.min.apply(null, st.rows) : 0, rb = st.rows.length ? Math.max.apply(null, st.rows) : 0, w = C.windowFor(vrows.length, shown, ra, rb);
|
|
305
|
+
if (!w.fits && shown >= 3) ctx.report("layout", "[code] step " + (j + 1) + " highlights " + (rb - ra + 1) + " rows; the code view shows " + shown + " (split the step or give the element more height)");
|
|
306
|
+
return w;
|
|
307
|
+
});
|
|
308
|
+
this.window0 = C.windowFor(vrows.length, shown, 0, 0);
|
|
309
|
+
this.geometry = {fit: true, side: side, codeW: codeW, codeH: codeH, rows: vrows.length, slots: shown, right: right, bandRows: nr, listRows: list.length, windowed: vrows.length > shown};
|
|
310
|
+
this.noteLayout = "band";
|
|
311
|
+
var g = this.codeLayer = base.el("g", {opacity: 0}, this.svg);
|
|
312
|
+
base.el("rect", {x: 1, y: 1, width: Math.max(1, codeW - 2), height: Math.max(1, codeH - 2), rx: 12, fill: "var(--term-tint, color-mix(in srgb, var(--fg) 5%, var(--bg)))", stroke: "var(--line)", "stroke-width": 2}, g);
|
|
313
|
+
var tag = cut(lang, Math.max(1, codeW - 2 * pad), fs);
|
|
314
|
+
this.label(g, codeW - pad - monoWidth(tag, fs), pad + fs, tag, fs, "var(--muted)", true);
|
|
315
|
+
this.fitBands = d.steps.map(function(){ return base.el("g", {opacity: 0}, g); });
|
|
316
|
+
this.fitBandRects = stepRows.map(function(st, j){ return st.rows.map(function(){ return base.el("rect", {x: 4, y: header, width: Math.max(1, codeW - 8), height: row, fill: "var(--emph-tint, color-mix(in srgb, var(--emph) 12%, var(--bg)))"}, self.fitBands[j]); }); });
|
|
317
|
+
this.vrows = vrows.map(function(r){
|
|
318
|
+
var num = self.label(g, pad, firstY, r.cont ? "↪" : String(r.line), fs, "var(--muted)", true);
|
|
319
|
+
var e = self.label(g, textX, firstY, "", fs, "var(--fg)", true), pos = 0;
|
|
320
|
+
var put = function(a, b, role){ if (b > a) base.el("tspan", role ? {fill: "var(--" + role + ")"} : {}, e).textContent = [...r.text].slice(a, b).join(""); };
|
|
321
|
+
r.spans.forEach(function(m){ put(pos, m[0]); put(m[0], m[1], m[2]); pos = m[1]; });
|
|
322
|
+
put(pos, [...r.text].length);
|
|
323
|
+
return {num: num, text: e, line: r.line};
|
|
324
|
+
});
|
|
325
|
+
this.markTop = this.label(g, pad, firstY, "", fs, "var(--muted)", true);
|
|
326
|
+
this.markBottom = this.label(g, pad, firstY, "", fs, "var(--muted)", true);
|
|
327
|
+
this.fitGeo = {header: header, row: row, firstY: firstY};
|
|
328
|
+
this.stepLines = stepRows.map(function(st){ return st.lines; });
|
|
329
|
+
var bandY = codeH + 8;
|
|
330
|
+
this.notes = d.steps.map(function(s, j){
|
|
331
|
+
var ng = base.el("g", {opacity: 0}, self.svg);
|
|
332
|
+
base.el("rect", {x: 1, y: bandY, width: Math.max(1, nw - 2), height: bandH, rx: 8, fill: "var(--bg)", stroke: "var(--line)", "stroke-width": 2}, ng);
|
|
333
|
+
var labels = noteLines[j].map(function(t, i){ return self.label(ng, 12, bandY + 8 + nf + i * noteRow, t, nf); });
|
|
334
|
+
return {g: ng, labels: labels};
|
|
335
|
+
});
|
|
336
|
+
this.finalNotes = base.el("g", {opacity: 0}, this.svg);
|
|
337
|
+
if (list.length){
|
|
338
|
+
base.el("rect", {x: 1, y: bandY, width: Math.max(1, nw - 2), height: listH, rx: 8, fill: "var(--bg)", stroke: "var(--line)", "stroke-width": 2}, this.finalNotes);
|
|
339
|
+
list.forEach(function(t, i){ self.label(self.finalNotes, 12, bandY + 8 + nf + i * listRow, proseCut(t, nw - 24, listFont), listFont); });
|
|
340
|
+
}
|
|
341
|
+
this.outputLayer = base.el("g", {opacity: 0}, this.svg);
|
|
342
|
+
if (output.length){
|
|
343
|
+
var ox = right ? W - outW : side ? W - sideW : 0, oy = right ? 0 : side ? bandY : bandY + zone + 16, ow = right ? outW : side ? sideW : codeW;
|
|
344
|
+
var oc = Math.max(0, Math.min(8, output.length, Math.floor((H - oy - header - pad) / row)));
|
|
345
|
+
base.el("rect", {x: ox + 1, y: oy + 1, width: Math.max(1, ow - 2), height: Math.max(1, header + oc * row + pad - 2), rx: 12, fill: "var(--term-tint, color-mix(in srgb, var(--fg) 5%, var(--bg)))", stroke: "var(--line)", "stroke-width": 2}, this.outputLayer);
|
|
346
|
+
this.label(this.outputLayer, ox + pad, oy + pad + fs, cut(T.output, ow - 2 * pad, fs), fs);
|
|
347
|
+
var run = cut(T.run, ow - 2 * pad - monoWidth(T.output, fs) - pad, fs);
|
|
348
|
+
this.label(this.outputLayer, ox + ow - pad - monoWidth(run, fs), oy + pad + fs, run, fs, "var(--muted)", true);
|
|
349
|
+
var outputCut = oc < output.length || run !== T.run;
|
|
350
|
+
output.slice(0, oc).forEach(function(s, i){
|
|
351
|
+
var txt = cut(s.replace(/\t/g, " "), ow - 2 * pad, fs);
|
|
352
|
+
if (i === oc - 1 && oc < output.length) txt = cut(txt + "…", ow - 2 * pad, fs);
|
|
353
|
+
if (txt !== s) outputCut = true;
|
|
354
|
+
self.label(self.outputLayer, ox + pad, oy + header + fs + i * row, txt, fs, "var(--fg)", true);
|
|
355
|
+
});
|
|
356
|
+
if (outputCut) ctx.report("layout", "[code] output exceeds eight lines or panel width/height; showing what fits with …");
|
|
357
|
+
}
|
|
358
|
+
this.svg.setAttribute("style", "overflow:hidden");
|
|
359
|
+
}
|
|
360
|
+
// 表示する範囲:k ≤ 1 は先頭、説明のステップはその説明の範囲、最後の状態は最後の説明の範囲
|
|
361
|
+
windowAt(k){ var n = this.windows.length; return k <= 1 || !n ? this.window0 : this.windows[Math.min(k - 2, n - 1)]; }
|
|
362
|
+
renderFit(k, t, ctx){
|
|
363
|
+
ctx = ctx || {};
|
|
364
|
+
var self = this, P = this.props, G = this.fitGeo, preview = ctx.preview || ctx.mode === "lecture", faint = preview ? base.previewOpacity(this) : 0;
|
|
365
|
+
var phase = function(step){ return k > step ? 1 : k < step ? faint : base.prog(t, 0, P.dur); };
|
|
366
|
+
set(this.codeLayer, "opacity", phase(1));
|
|
367
|
+
var nNotes = this.notes.length, final = k > this.steps || k === this.steps && t >= P.dur, active = !final && k >= 2 && k <= nNotes + 1 ? k - 2 : -1;
|
|
368
|
+
var w1 = this.windowAt(k), w0 = this.windowAt(k - 1), e = base.prog(t, 0, P.dur), moving = w0.f !== w1.f || w0.l !== w1.l;
|
|
369
|
+
var w = moving && e < 0.5 ? w0 : w1, fade = moving ? (e < 0.5 ? 1 - 2 * e : 2 * e - 1) : 1;
|
|
370
|
+
var slotY = function(r){ return G.firstY + (r - w.f + (w.top ? 1 : 0)) * G.row; };
|
|
371
|
+
var lit = active >= 0 ? this.stepLines[active] : [];
|
|
372
|
+
this.vrows.forEach(function(o, r){
|
|
373
|
+
var vis = r >= w.f && r <= w.l, y = vis ? slotY(r) : G.firstY;
|
|
374
|
+
set(o.num, "y", y); set(o.text, "y", y);
|
|
375
|
+
set(o.num, "opacity", vis ? fade.toFixed(3) : 0); set(o.text, "opacity", vis ? fade.toFixed(3) : 0);
|
|
376
|
+
set(o.num, "style", "font-family:" + MONO + ";white-space:pre;fill:var(--" + (lit.indexOf(o.line) >= 0 ? "emph" : "muted") + ")");
|
|
377
|
+
});
|
|
378
|
+
// 隠れた行の数(折り返しの続きは数えない、元の行の数)
|
|
379
|
+
var vr = this.vrows, linesIn = function(a, b){ var seen = {}; for (var r = a; r <= b; r++) if (vr[r]) seen[vr[r].line] = 1; return Object.keys(seen).length; };
|
|
380
|
+
var more = function(n){ return self.ja ? "⋮(ほか " + n + " 行)" : "⋮ (" + n + " more line" + (n === 1 ? "" : "s") + ")"; };
|
|
381
|
+
var hiddenTop = w.top ? linesIn(0, w.f - 1) - (vr[w.f] && vr[w.f].cont && vr[w.f - 1] && vr[w.f - 1].line === vr[w.f].line ? 1 : 0) : 0, hiddenBottom = w.bottom ? linesIn(w.l + 1, vr.length - 1) : 0;
|
|
382
|
+
this.markTop.textContent = w.top ? more(Math.max(1, hiddenTop)) : ""; set(this.markTop, "y", G.firstY); set(this.markTop, "opacity", w.top ? fade.toFixed(3) : 0);
|
|
383
|
+
this.markBottom.textContent = w.bottom ? more(Math.max(1, hiddenBottom)) : ""; set(this.markBottom, "y", slotY(w.l + 1)); set(this.markBottom, "opacity", w.bottom ? fade.toFixed(3) : 0);
|
|
384
|
+
this.fitBands.forEach(function(bg, j){
|
|
385
|
+
var rows = self.vrows.map(function(o, r){ return self.stepLines[j].indexOf(o.line) >= 0 ? r : -1; }).filter(function(r){ return r >= 0; });
|
|
386
|
+
self.fitBandRects[j].forEach(function(rect, i){ var r = rows[i], vis = r !== undefined && r >= w.f && r <= w.l; set(rect, "y", vis ? slotY(r) - G.firstY + G.header : G.header); set(rect, "opacity", vis ? 1 : 0); });
|
|
387
|
+
set(bg, "opacity", j === active ? (moving ? Math.max(0, 2 * e - 1) : e).toFixed(3) : 0);
|
|
388
|
+
});
|
|
389
|
+
this.notes.forEach(function(n, i){
|
|
390
|
+
set(n.g, "opacity", !final && i === active ? phase(i + 2) : !final && active < 0 && k > nNotes + 1 && i === nNotes - 1 ? 1 : 0);
|
|
391
|
+
});
|
|
392
|
+
set(this.finalNotes, "opacity", final ? 1 : k < 2 ? faint : 0);
|
|
393
|
+
set(this.outputLayer, "opacity", phase(nNotes + 2));
|
|
394
|
+
}
|
|
395
|
+
render(k, t, ctx){
|
|
396
|
+
if (!this.codeLayer) return;
|
|
397
|
+
if (this.fit) return this.renderFit(k, t, ctx);
|
|
398
|
+
ctx = ctx || {};
|
|
399
|
+
var self = this, preview = ctx.preview || ctx.mode === "lecture", faint = preview ? base.previewOpacity(this) : 0;
|
|
400
|
+
var phase = function(step){ return k > step ? 1 : k < step ? faint : base.prog(t, 0, self.props.dur); };
|
|
401
|
+
set(this.codeLayer, "opacity", phase(1));
|
|
402
|
+
var final = k > this.steps || k === this.steps && t >= this.props.dur, active = !final && k >= 2 && k <= this.notes.length + 1 ? k - 2 : -1;
|
|
403
|
+
this.notes.forEach(function(n, i){
|
|
404
|
+
var band = self.noteLayout === "band", shown = !final && (i === active || active < 0 && k > self.notes.length + 1 && i === self.notes.length - 1);
|
|
405
|
+
set(n.g, "opacity", band ? (shown ? phase(i + 2) : 0) : phase(i + 2));
|
|
406
|
+
n.labels.forEach(function(e){ set(e, "style", "fill:var(--" + (i < k - 2 && !final ? "muted" : "fg") + ")"); });
|
|
407
|
+
set(self.bands[i], "opacity", i === active && n.valid ? base.prog(t, 0, self.props.dur) : 0);
|
|
408
|
+
});
|
|
409
|
+
set(this.finalNotes, "opacity", this.noteLayout === "band" ? (final ? 1 : k < 2 ? faint : 0) : 0);
|
|
410
|
+
this.numbers.forEach(function(e, i){ var n = self.notes[active]; set(e, "style", "font-family:" + MONO + ";white-space:pre;fill:var(--" + (n && n.valid && i + 1 >= n.a && i + 1 <= n.b ? "emph" : "muted") + ")"); });
|
|
411
|
+
set(this.outputLayer, "opacity", phase(this.notes.length + 2));
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Code run line by line (tracer output); current line, changed variables, output
|
|
3
|
+
steps: trace lines (time: 1)
|
|
4
|
+
props:
|
|
5
|
+
dur: s per step
|
|
6
|
+
by: step or time
|
|
7
|
+
rate: lines/s
|
|
8
|
+
size: text px
|
|
9
|
+
example: {"lang":"python","code":"total = 0\nfor x in [3, 1]:\n total += x\nprint(total)","source":{"tool":"egatari-trace 0.1","python":"3.13.1","sha256":"","truncated":false},"steps":[{"line":1,"vars":{"total":0}},{"line":2,"vars":{"total":0,"x":3}},{"line":3,"vars":{"total":3,"x":3}},{"line":2,"vars":{"total":3,"x":1}},{"line":3,"vars":{"total":4,"x":1}},{"line":2,"vars":{"total":4,"x":1}},{"line":4,"vars":{"total":4,"x":1},"out":"4\n"}]}
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
JSON from `uv run tools/trace.py prog.py --out trace.json`, never by hand.
|
|
13
|
+
<!-- llm: omit -->
|
|
14
|
+
- Not in any chat pack (tier local): a chat AI cannot run the tracer. Use it from Claude Code or locally.
|
|
15
|
+
- `steps[i]`: `line` or `lines: [a, b]`, `vars` (the FULL state after the line, not a delta), `out` (what the line printed), `note` (added by hand after tracing, ≤2 band rows).
|
|
16
|
+
- Values: numbers, strings (≤40 chars), booleans, null, lists (≤12, or 2-D ≤6×6), dicts (≤8 keys), nesting ≤2, else `{"repr": "…"}`.
|
|
17
|
+
- Caps: 16 code lines, 60 steps, 6 variables (`show` picks them), 8 output lines.
|
|
18
|
+
- `by="time"` plays the whole trace inside one step at `rate` lines/s; cues are the line times.
|
|
19
|
+
- Current line: emph ground and bold number. Changed variables: emph text, ground and bold.
|
|
20
|
+
- Code and output in `pre[data-readable]`; final variables in `table[data-readable]`. No preview of later steps.
|
|
21
|
+
<!-- llm: end -->
|
|
22
|
+
|
|
23
|
+
Demo: `demo.html` (a for-loop sum, counting words in a dict, bubble sort with by="time"); traces from `tools/trace-demo/` through `tools/trace.py`.
|
|
24
|
+
|
|
25
|
+
<!-- llm: omit -->
|
|
26
|
+
Notes
|
|
27
|
+
|
|
28
|
+
- The tracer runs the code locally. Trace short teaching code, not code that touches files or the network.
|
|
29
|
+
- A for line becomes one more step when the loop ends (that is how Python runs it); say so in the notes.
|
|
30
|
+
<!-- llm: end -->
|