egatari 0.6.14 → 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 +34 -1
- package/components.lock.json +507 -153
- package/components2.lock.json +1710 -33
- package/kit/check-messages.mjs +11 -2
- 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 +1 -1
- package/kit/core/check-rules.mjs +1 -1
- package/kit/core/colab-core.mjs +1 -1
- package/kit/core/comment-core.mjs +6 -0
- package/kit/core/layout-scan.mjs +67 -2
- package/kit/core/llm-fix.mjs +12 -1
- package/kit/core/llm-pack-assemble.mjs +5 -2
- package/kit/core/llm-pack-data.mjs +218 -32
- 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/player.mjs +18 -0
- package/kit/core/portable.mjs +21 -3
- package/kit/core/tier-a.mjs +14 -2
- package/kit/instruction-version.json +1 -1
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/presenter.js +3 -1
- package/kit/tools.js +9 -2
- package/package.json +4 -2
- package/server/dev.mjs +3 -2
- package/server/editor-ui.js +8 -3
- package/server/hints.js +22 -2
- 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,279 @@
|
|
|
1
|
+
// m-ctable:計算して埋まる表。分散分析表・分割表(周辺の計・期待度数・χ²・オッズ比)・潜在結果の表を、ステップごとに埋め、
|
|
2
|
+
// 使ったセルと埋めたセルを示し、表の下に式の行を出す。値は計算を走らせたスクリプトの出力を書き、パーツは計算を確かめる(合わなければ data)。
|
|
3
|
+
// <m-ctable style="height:440px"><script type="application/json">
|
|
4
|
+
// {"kind": "anova", "rows": [{"name": "要因 A", "ss": 120, "df": 2, "ms": 60, "f": 7.5}, {"name": "誤差", "ss": 96, "df": 12, "ms": 8},
|
|
5
|
+
// {"name": "全体", "ss": 216, "df": 14}]}
|
|
6
|
+
// (JSON の終わり)</m-ctable>
|
|
7
|
+
// kind:anova(最後の行が全体、その前が誤差。role で変えられる)・contingency(rows・cols・n、margins、expected・chi2・or)・
|
|
8
|
+
// po(units の t・y0・y1。見えない半分は「?」、ステップで開き、個人の効果と平均処置効果)・table(header と rows を行ごとに出す)
|
|
9
|
+
// 色:使ったセル --accent2 の枠、埋めたセル --emph の枠、見えない値の地 --muted の薄い塗り(字の色だけに頼らず「?」と地で示す)。
|
|
10
|
+
egatariParts.define({name: "ctable", version: "2.0.1", requires: {base: "1.3.0"}, element: "m-ctable"}, function(deps){
|
|
11
|
+
"use strict";
|
|
12
|
+
var base = deps.base;
|
|
13
|
+
var NUM = {type: "number"};
|
|
14
|
+
var T = {
|
|
15
|
+
ja: {source: "要因", ss: "平方和", df: "自由度", ms: "平均平方", f: "F", p: "p", total: "計", unit: "ID", t: "処置", y0: "Y(0)", y1: "Y(1)", ite: "Y(1) − Y(0)",
|
|
16
|
+
ssF: function(t, ps, v){ return "平方和:" + t + " = " + ps + " = " + v; }, dfF: function(t, ps, v){ return "自由度:" + t + " = " + ps + " = " + v; },
|
|
17
|
+
msF: "平均平方 = 平方和 ÷ 自由度", fF: "F = 要因の平均平方 ÷ 誤差の平均平方", pF: "p は F 分布から(スクリプトの値)",
|
|
18
|
+
margins: "周辺の計 = 行と列の和", exp: "期待度数 = 行の計 × 列の計 ÷ 総数", chi2: "χ² = Σ(観測 − 期待)² ÷ 期待", or: "オッズ比 = (a × d) ÷ (b × c)",
|
|
19
|
+
reveal: "見えない側の値(仮に分かったとして)", iteF: "個人の効果 = Y(1) − Y(0)", ate: "平均処置効果 = 個人の効果の平均", naive: "単純な差 = 処置群の Y の平均 − 対照群の Y の平均"},
|
|
20
|
+
en: {source: "Source", ss: "SS", df: "df", ms: "MS", f: "F", p: "p", total: "Total", unit: "Unit", t: "t", y0: "Y(0)", y1: "Y(1)", ite: "Y(1) − Y(0)",
|
|
21
|
+
ssF: function(t, ps, v){ return "SS: " + t + " = " + ps + " = " + v; }, dfF: function(t, ps, v){ return "df: " + t + " = " + ps + " = " + v; },
|
|
22
|
+
msF: "MS = SS ÷ df", fF: "F = MS(factor) ÷ MS(error)", pF: "p from the F distribution (script value)",
|
|
23
|
+
margins: "Margins = row and column sums", exp: "Expected = row total × column total ÷ N", chi2: "χ² = Σ (observed − expected)² ÷ expected", or: "Odds ratio = (a × d) ÷ (b × c)",
|
|
24
|
+
reveal: "The unobserved side (as if we knew it)", iteF: "Individual effect = Y(1) − Y(0)", ate: "ATE = mean of the individual effects", naive: "Naive difference = mean Y (treated) − mean Y (control)"},
|
|
25
|
+
};
|
|
26
|
+
function dec(v){ var s = String(v).split(".")[1]; return s ? s.length : 0; }
|
|
27
|
+
function fmt(v, dg){ if (typeof v !== "number") return String(v); var s = Math.abs(v).toFixed(dg); return (v < 0 && +s !== 0 ? "−" : "") + s; }
|
|
28
|
+
return class extends base.MotionElement {
|
|
29
|
+
static partName = "ctable";
|
|
30
|
+
static preview = "none";
|
|
31
|
+
static shape = {
|
|
32
|
+
schema: {type: "object", additionalProperties: false, required: ["kind"], properties: {
|
|
33
|
+
kind: {type: "string", enum: ["anova", "contingency", "po", "table"]},
|
|
34
|
+
rows: {type: "array", maxItems: 12, items: {type: ["object", "string", "array"]}},
|
|
35
|
+
cols: {type: "array", maxItems: 8, items: {type: "string"}},
|
|
36
|
+
n: {type: "array", items: {type: "array", items: NUM}},
|
|
37
|
+
margins: {type: "boolean"},
|
|
38
|
+
expected: {type: "array", items: {type: "array", items: NUM}},
|
|
39
|
+
chi2: NUM, or: NUM,
|
|
40
|
+
units: {type: "array", maxItems: 12, items: {type: "object", additionalProperties: false, required: ["t", "y0", "y1"], properties: {
|
|
41
|
+
id: {type: "string"}, t: {type: "integer", enum: [0, 1]}, y0: NUM, y1: NUM}}},
|
|
42
|
+
ate: NUM, naive: NUM,
|
|
43
|
+
header: {type: "array", maxItems: 8, items: {type: "string"}},
|
|
44
|
+
note: {type: "string"}}},
|
|
45
|
+
example: {kind: "anova", rows: [{name: "要因 A", ss: 120, df: 2, ms: 60, f: 7.5}, {name: "誤差", ss: 96, df: 12, ms: 8}, {name: "全体", ss: 216, df: 14}]},
|
|
46
|
+
};
|
|
47
|
+
static props = {
|
|
48
|
+
dur: {type: "number", default: 0.7, doc: "1 ステップの秒数"},
|
|
49
|
+
digits: {type: "number", default: -1, doc: "値の小数の桁(−1 は書いた値の桁のまま)"},
|
|
50
|
+
size: {type: "number", default: 26, doc: "字の大きさ(px、24 以上)"},
|
|
51
|
+
};
|
|
52
|
+
get steps(){
|
|
53
|
+
if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
|
|
54
|
+
return this.plan().steps.length;
|
|
55
|
+
}
|
|
56
|
+
// 表のセル(文字・いつ埋まるか・見えない値か)とステップ(埋めるセル・使うセル・式の行)。データだけから決まる
|
|
57
|
+
plan(){
|
|
58
|
+
if (this._plan) return this._plan;
|
|
59
|
+
var d = this.data || {}, bad = [], ja = !/^en\b/i.test(this.getAttribute("lang") || (this.closest && this.closest("[lang]") ? this.closest("[lang]").getAttribute("lang") : "ja") || "ja");
|
|
60
|
+
var L = ja ? T.ja : T.en, P = this.props, cells = [], steps = [], cols = [], nr = 0;
|
|
61
|
+
var cell = function(r, c, text, o){ var x = Object.assign({r: r, c: c, text: text, step: 0}, o || {}); cells.push(x); return x; };
|
|
62
|
+
var dgOf = function(vals){ return P.digits >= 0 ? Math.min(6, Math.round(P.digits)) : Math.min(4, Math.max.apply(null, vals.filter(function(v){ return typeof v === "number"; }).map(dec).concat([0]))); };
|
|
63
|
+
var close = function(a, b, dg){ return Math.abs(a - b) <= 1e-9 * Math.max(1, Math.abs(b)) + (dg ? 0.51 * Math.pow(10, -dg) : 0); };
|
|
64
|
+
// 丸めの幅:書いた桁の半分(整数なら 0)。式を通した許し:入力の丸めを式に沿って足す
|
|
65
|
+
var hu = function(v){ var q = dec(v); return q ? 0.51 * Math.pow(10, -q) : 0; };
|
|
66
|
+
var near = function(a, b, tol){ return Math.abs(a - b) <= 1e-9 * Math.max(1, Math.abs(b)) + tol; };
|
|
67
|
+
var kind = d.kind;
|
|
68
|
+
if (kind === "anova"){
|
|
69
|
+
var rows = (d.rows || []).filter(function(r){ return r && typeof r === "object" && !Array.isArray(r); });
|
|
70
|
+
if (rows.length < 2) bad.push("anova needs at least a factor row and a total row");
|
|
71
|
+
var role = rows.map(function(r, i){ return r.role || (i === rows.length - 1 ? "total" : i === rows.length - 2 ? "error" : "factor"); });
|
|
72
|
+
var keys = ["ss", "df", "ms", "f", "p"].filter(function(k){ return rows.some(function(r){ return typeof r[k] === "number"; }); });
|
|
73
|
+
cols = [L.source].concat(keys.map(function(k){ return L[k]; }));
|
|
74
|
+
nr = rows.length + 1;
|
|
75
|
+
cols.forEach(function(h, c){ cell(0, c, h, {head: true}); });
|
|
76
|
+
var dgK = {}; keys.forEach(function(k){ dgK[k] = dgOf(rows.map(function(r){ return r[k]; })); });
|
|
77
|
+
rows.forEach(function(r, i){
|
|
78
|
+
cell(i + 1, 0, r.name || "", {head: true});
|
|
79
|
+
keys.forEach(function(k, j){ if (typeof r[k] === "number") cell(i + 1, j + 1, fmt(r[k], dgK[k]), {key: k, row: i, q: true}); });
|
|
80
|
+
});
|
|
81
|
+
var tot = rows[role.indexOf("total")], err = rows[role.indexOf("error")], fac = rows.filter(function(r, i){ return role[i] !== "total"; });
|
|
82
|
+
var colOf = function(k){ return keys.indexOf(k) + 1; }, idx = function(r){ return rows.indexOf(r) + 1; };
|
|
83
|
+
keys.forEach(function(k){
|
|
84
|
+
var fill = cells.filter(function(x){ return x.key === k; }), src = [], text = "";
|
|
85
|
+
if ((k === "ss" || k === "df") && tot && typeof tot[k] === "number"){
|
|
86
|
+
var sum = fac.reduce(function(a, r){ return a + (r[k] || 0); }, 0);
|
|
87
|
+
if (!near(sum, tot[k], fac.reduce(function(a, r){ return a + hu(r[k] || 0); }, hu(tot[k])))) bad.push(tot.name + " " + k + " is " + tot[k] + " but the rows above sum to " + +sum.toFixed(6));
|
|
88
|
+
text = L[k + "F"](tot.name, fac.map(function(r){ return fmt(r[k], dgK[k]); }).join(" + "), fmt(tot[k], dgK[k]));
|
|
89
|
+
} else if (k === "ms"){
|
|
90
|
+
fac.forEach(function(r){ if (typeof r.ms === "number" && typeof r.ss === "number" && r.df){ if (!near(r.ss / r.df, r.ms, hu(r.ms) + hu(r.ss) / r.df)) bad.push(r.name + ": ms is " + r.ms + " but ss ÷ df = " + +(r.ss / r.df).toFixed(6)); src.push([idx(r), colOf("ss")], [idx(r), colOf("df")]); } });
|
|
91
|
+
text = L.msF;
|
|
92
|
+
} else if (k === "f"){
|
|
93
|
+
var f1 = fac.filter(function(r){ return r !== err && typeof r.f === "number"; });
|
|
94
|
+
f1.forEach(function(r){ if (err && err.ms && typeof r.ms === "number" && !near(r.ms / err.ms, r.f, hu(r.f) + hu(r.ms) / err.ms + r.ms * hu(err.ms) / (err.ms * err.ms))) bad.push(r.name + ": F is " + r.f + " but ms ÷ ms(" + err.name + ") = " + +(r.ms / err.ms).toFixed(6)); src.push([idx(r), colOf("ms")]); });
|
|
95
|
+
if (err) src.push([idx(err), colOf("ms")]);
|
|
96
|
+
text = L.fF + (f1.length && err && err.ms ? " = " + fmt(f1[0].ms, dgK.ms) + " ÷ " + fmt(err.ms, dgK.ms) + " = " + fmt(f1[0].f, dgK.f) : "");
|
|
97
|
+
} else if (k === "p") text = L.pF;
|
|
98
|
+
if (k === "ss" || k === "df") fac.forEach(function(r){ if (typeof r[k] === "number") src.push([idx(r), colOf(k)]); });
|
|
99
|
+
steps.push({fill: fill, src: src, line: [text]});
|
|
100
|
+
});
|
|
101
|
+
} else if (kind === "contingency"){
|
|
102
|
+
var R = (d.rows || []).map(String), Cn = d.cols || [], n = d.n || [], mg = d.margins !== false;
|
|
103
|
+
if (!R.length || !Cn.length || n.length !== R.length || n.some(function(row){ return row.length !== Cn.length; })) bad.push("contingency needs rows, cols and n with rows × cols counts");
|
|
104
|
+
else {
|
|
105
|
+
var rs = n.map(function(row){ return row.reduce(function(a, b){ return a + b; }, 0); }), cs = Cn.map(function(_, j){ return n.reduce(function(a, row){ return a + row[j]; }, 0); }), N = rs.reduce(function(a, b){ return a + b; }, 0);
|
|
106
|
+
var dgN = dgOf([].concat.apply([], n)), ex = d.expected, dgE = ex ? dgOf([].concat.apply([], ex)) : 0;
|
|
107
|
+
cols = [""].concat(Cn, mg ? [L.total] : []); nr = R.length + 1 + (mg ? 1 : 0);
|
|
108
|
+
cols.forEach(function(h, c){ if (h) cell(0, c, h, {head: true}); });
|
|
109
|
+
R.forEach(function(r, i){ cell(i + 1, 0, r, {head: true}); });
|
|
110
|
+
if (mg) cell(R.length + 1, 0, L.total, {head: true});
|
|
111
|
+
var counts = [];
|
|
112
|
+
n.forEach(function(row, i){ row.forEach(function(v, j){ counts.push(cell(i + 1, j + 1, fmt(v, dgN), {q: false, val: v})); }); });
|
|
113
|
+
var mcells = [];
|
|
114
|
+
if (mg){
|
|
115
|
+
rs.forEach(function(v, i){ mcells.push(cell(i + 1, Cn.length + 1, fmt(v, dgN), {q: true})); });
|
|
116
|
+
cs.forEach(function(v, j){ mcells.push(cell(R.length + 1, j + 1, fmt(v, dgN), {q: true})); });
|
|
117
|
+
mcells.push(cell(R.length + 1, Cn.length + 1, fmt(N, dgN), {q: true}));
|
|
118
|
+
steps.push({fill: mcells, src: counts.map(function(x){ return [x.r, x.c]; }), line: [L.margins]});
|
|
119
|
+
}
|
|
120
|
+
if (ex){
|
|
121
|
+
if (ex.length !== R.length || ex.some(function(row){ return row.length !== Cn.length; })) bad.push("expected must have rows × cols numbers");
|
|
122
|
+
else {
|
|
123
|
+
var ecells = [];
|
|
124
|
+
ex.forEach(function(row, i){ row.forEach(function(v, j){
|
|
125
|
+
var want = rs[i] * cs[j] / N;
|
|
126
|
+
if (!close(want, v, dgE)) bad.push("expected[" + i + "][" + j + "] is " + v + " but row × column ÷ N = " + +want.toFixed(6));
|
|
127
|
+
ecells.push(cell(i + 1, j + 1, "(" + fmt(v, dgE) + ")", {q: true, sub: true}));
|
|
128
|
+
}); });
|
|
129
|
+
steps.push({fill: ecells, src: mcells.map(function(x){ return [x.r, x.c]; }), line: [L.exp]});
|
|
130
|
+
if (typeof d.chi2 === "number"){
|
|
131
|
+
var chi = 0; n.forEach(function(row, i){ row.forEach(function(o, j){ var e = rs[i] * cs[j] / N; chi += (o - e) * (o - e) / e; }); });
|
|
132
|
+
if (!close(chi, d.chi2, dec(d.chi2))) bad.push("chi2 is " + d.chi2 + " but Σ (o − e)² ÷ e = " + +chi.toFixed(6));
|
|
133
|
+
steps.push({fill: [], src: counts.concat(ecells).map(function(x){ return [x.r, x.c]; }), line: [L.chi2 + " = " + fmt(d.chi2, dec(d.chi2))]});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} else if (typeof d.chi2 === "number") bad.push("chi2 needs expected");
|
|
137
|
+
if (typeof d.or === "number"){
|
|
138
|
+
if (R.length !== 2 || Cn.length !== 2) bad.push("or (odds ratio) needs a 2 × 2 table");
|
|
139
|
+
else {
|
|
140
|
+
var a = n[0][0], b = n[0][1], c2 = n[1][0], dd = n[1][1], orv = a * dd / (b * c2);
|
|
141
|
+
if (!close(orv, d.or, dec(d.or))) bad.push("or is " + d.or + " but (a × d) ÷ (b × c) = " + +orv.toFixed(6));
|
|
142
|
+
steps.push({fill: [], src: counts.map(function(x){ return [x.r, x.c]; }), line: [L.or + " = (" + a + " × " + dd + ") ÷ (" + b + " × " + c2 + ") = " + fmt(d.or, dec(d.or))]});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
} else if (kind === "po"){
|
|
147
|
+
var U = d.units || [];
|
|
148
|
+
if (U.length < 2) bad.push("po needs at least 2 units");
|
|
149
|
+
var dgY = dgOf([].concat.apply([], U.map(function(u){ return [u.y0, u.y1]; })));
|
|
150
|
+
cols = [L.unit, L.t, L.y0, L.y1, L.ite]; nr = U.length + 1;
|
|
151
|
+
cols.forEach(function(h, c){ cell(0, c, h, {head: true}); });
|
|
152
|
+
var hidden = [], ite = [];
|
|
153
|
+
U.forEach(function(u, i){
|
|
154
|
+
cell(i + 1, 0, u.id || String(i + 1), {head: true});
|
|
155
|
+
cell(i + 1, 1, String(u.t));
|
|
156
|
+
var obs0 = u.t === 0;
|
|
157
|
+
cell(i + 1, 2, fmt(u.y0, dgY), obs0 ? {} : {q: true, hidden: true});
|
|
158
|
+
cell(i + 1, 3, fmt(u.y1, dgY), obs0 ? {q: true, hidden: true} : {});
|
|
159
|
+
hidden.push(cells[cells.length - (obs0 ? 1 : 2)]);
|
|
160
|
+
ite.push(cell(i + 1, 4, fmt(u.y1 - u.y0, dgY), {q: true}));
|
|
161
|
+
});
|
|
162
|
+
steps.push({fill: hidden, src: [], line: [L.reveal]});
|
|
163
|
+
steps.push({fill: ite, src: [].concat.apply([], U.map(function(u, i){ return [[i + 1, 2], [i + 1, 3]]; })), line: [L.iteF]});
|
|
164
|
+
var ateV = U.reduce(function(a, u){ return a + (u.y1 - u.y0); }, 0) / (U.length || 1);
|
|
165
|
+
var tr = U.filter(function(u){ return u.t === 1; }), co = U.filter(function(u){ return u.t === 0; });
|
|
166
|
+
var naiveV = tr.length && co.length ? tr.reduce(function(a, u){ return a + u.y1; }, 0) / tr.length - co.reduce(function(a, u){ return a + u.y0; }, 0) / co.length : NaN;
|
|
167
|
+
if (typeof d.ate === "number" && !close(ateV, d.ate, dec(d.ate))) bad.push("ate is " + d.ate + " but the mean of y1 − y0 = " + +ateV.toFixed(6));
|
|
168
|
+
if (typeof d.naive === "number" && !close(naiveV, d.naive, dec(d.naive))) bad.push("naive is " + d.naive + " but mean y1 (t = 1) − mean y0 (t = 0) = " + +naiveV.toFixed(6));
|
|
169
|
+
var dgA = Math.max(dgY, typeof d.ate === "number" ? dec(d.ate) : 2);
|
|
170
|
+
steps.push({fill: [], src: ite.map(function(x){ return [x.r, x.c]; }), line: [L.ate + " = " + fmt(typeof d.ate === "number" ? d.ate : ateV, dgA),
|
|
171
|
+
isFinite(naiveV) ? L.naive + " = " + fmt(typeof d.naive === "number" ? d.naive : naiveV, dgA) : ""].filter(Boolean)});
|
|
172
|
+
} else if (kind === "table"){
|
|
173
|
+
var H = d.header || [], TR = (d.rows || []).filter(Array.isArray);
|
|
174
|
+
cols = H.slice(); nr = TR.length + 1;
|
|
175
|
+
H.forEach(function(h, c){ cell(0, c, h, {head: true}); });
|
|
176
|
+
TR.forEach(function(row, i){
|
|
177
|
+
if (row.length !== H.length) bad.push("rows[" + i + "] has " + row.length + " cells, header has " + H.length);
|
|
178
|
+
var fill = row.map(function(v, j){ return cell(i + 1, j, typeof v === "number" ? String(v) : String(v), {q: true}); });
|
|
179
|
+
steps.push({fill: fill, src: [], line: []});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
// 埋まるステップ
|
|
183
|
+
steps.forEach(function(s, k){ s.fill.forEach(function(x){ x.step = k + 1; }); });
|
|
184
|
+
// anova:値のセルは列のステップで埋まる(ステップのないセル(p の列の要因以外など)は初めから出す)
|
|
185
|
+
return (this._plan = {cells: cells, steps: steps, bad: bad, cols: cols, nr: nr, L: L, lines: Math.max(1, ...steps.map(function(s){ return s.line.length; }))});
|
|
186
|
+
}
|
|
187
|
+
mount(ctx){
|
|
188
|
+
var self = this, P = this.props, D = base, pl = this.plan(), d = this.data;
|
|
189
|
+
this.style.display = "block"; this.style.position = "relative";
|
|
190
|
+
var W = this.clientWidth, H = this.clientHeight;
|
|
191
|
+
var svg = this.svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
|
|
192
|
+
if (!(P.dur >= 0)){ ctx.report("attr", "[ctable] dur must be ≥ 0; using 0.7"); P.dur = 0.7; }
|
|
193
|
+
if (!(P.size >= 24)){ ctx.report("attr", "[ctable] size must be ≥ 24; using 26"); P.size = 26; }
|
|
194
|
+
pl.bad.forEach(function(m){ ctx.report("data", "[ctable] " + m); });
|
|
195
|
+
var fs = P.size, tw = function(s, b){ return D.textWidth(s, fs, {font: self}) * (b ? 1.06 : 1); };
|
|
196
|
+
var hasSub = pl.cells.some(function(x){ return x.sub; }), rh = Math.ceil(fs * 1.7) * (hasSub ? 2 : 1), pad = 14;
|
|
197
|
+
var nc = pl.cols.length, cw = [];
|
|
198
|
+
for (var c = 0; c < nc; c++) cw[c] = Math.ceil(Math.max(fs * 1.4, ...pl.cells.filter(function(x){ return x.c === c; }).map(function(x){ return tw(x.text, x.head); })) + 2 * pad);
|
|
199
|
+
var tableW = cw.reduce(function(a, b){ return a + b; }, 0), tableH = pl.nr * rh, lineH = Math.ceil(fs * 1.6), formH = pl.steps.some(function(s){ return s.line.length; }) ? pl.lines * lineH + 12 : 0;
|
|
200
|
+
var needH = tableH + formH + 8;
|
|
201
|
+
var need = "[ctable] the table needs " + Math.ceil(tableW) + " × " + Math.ceil(needH) + " px; the element is " + W + " × " + H + " px (fewer rows or columns, shorter names, or a larger element)";
|
|
202
|
+
if (tableW > W || needH > H) ctx.report("size", need);
|
|
203
|
+
var x0 = Math.max(0, (W - tableW) / 2), y0 = 4, xs = [x0];
|
|
204
|
+
cw.forEach(function(w, i){ xs.push(xs[i] + w); });
|
|
205
|
+
this.geo = {x0: x0, y0: y0, xs: xs, rh: rh, W: W, tableW: tableW, tableH: tableH};
|
|
206
|
+
var gB = D.el("g", {}, svg), gL = D.el("g", {}, svg), gT = D.el("g", {}, svg), gH = D.el("g", {}, svg);
|
|
207
|
+
// 表の線:見出しの行の下と見出しの列の右は太く、ほかは細く
|
|
208
|
+
for (var r = 0; r <= pl.nr; r++){ var y = y0 + r * rh; D.el("line", {x1: x0, x2: x0 + tableW, y1: y, y2: y, stroke: "var(--line)", "stroke-width": r === 1 ? 2.5 : 1.2}, gL); }
|
|
209
|
+
for (var c2 = 0; c2 <= nc; c2++) D.el("line", {x1: xs[c2], x2: xs[c2], y1: y0, y2: y0 + tableH, stroke: "var(--line)", "stroke-width": c2 === 1 ? 2.5 : 1.2}, gL);
|
|
210
|
+
this.cellEls = pl.cells.map(function(x){
|
|
211
|
+
var cx0 = xs[x.c], cy0 = y0 + x.r * rh, num = !x.head && /^[−\-]?[\d.]+$|^(/.test(x.text);
|
|
212
|
+
var o = {x: x};
|
|
213
|
+
if (x.hidden) o.bg = D.el("rect", {x: cx0 + 1, y: cy0 + 1, width: cw[x.c] - 2, height: rh - 2, fill: "var(--muted)", opacity: 0.18}, gB);
|
|
214
|
+
var ty = x.sub ? cy0 + rh * 0.75 + fs * 0.36 : hasSub && !x.head && x.r > 0 && !x.sub ? cy0 + rh * 0.3 + fs * 0.36 : cy0 + rh / 2 + fs * 0.36;
|
|
215
|
+
var tx = num ? xs[x.c + 1] - pad : x.head && x.c === 0 ? cx0 + pad : cx0 + cw[x.c] / 2;
|
|
216
|
+
o.t = D.el("text", {x: tx.toFixed(1), y: ty.toFixed(1), "font-size": fs, "text-anchor": num ? "end" : x.head && x.c === 0 ? "start" : "middle",
|
|
217
|
+
fill: x.sub || x.hidden ? "var(--muted)" : "var(--fg)", "font-weight": x.head ? 700 : 400, style: "font-variant-numeric:tabular-nums"}, gT);
|
|
218
|
+
o.t.textContent = x.text;
|
|
219
|
+
if (x.q && !x.sub){ o.qm = D.el("text", {x: (cx0 + cw[x.c] / 2).toFixed(1), y: ty.toFixed(1), "font-size": fs, "text-anchor": "middle", fill: "var(--muted)"}, gT); o.qm.textContent = "?"; }
|
|
220
|
+
o.box = [cx0, cy0, cw[x.c], rh];
|
|
221
|
+
return o;
|
|
222
|
+
});
|
|
223
|
+
// 使ったセル・埋めたセルの枠(ステップごと)
|
|
224
|
+
this.hl = pl.steps.map(function(s){
|
|
225
|
+
var g = D.el("g", {opacity: 0}, gH);
|
|
226
|
+
s.src.forEach(function(rc){ D.el("rect", {x: xs[rc[1]] + 3, y: y0 + rc[0] * rh + 3, width: cw[rc[1]] - 6, height: rh - 6, rx: 4, fill: "none", stroke: "var(--accent2)", "stroke-width": 3}, g); });
|
|
227
|
+
s.fill.forEach(function(x){ D.el("rect", {x: xs[x.c] + 3, y: y0 + x.r * rh + 3, width: cw[x.c] - 6, height: rh - 6, rx: 4, fill: "none", stroke: "var(--emph)", "stroke-width": 3}, g); });
|
|
228
|
+
return g;
|
|
229
|
+
});
|
|
230
|
+
// 式の行(表の下)
|
|
231
|
+
var fy = y0 + tableH + 12 + fs * 0.9;
|
|
232
|
+
this.lines = pl.steps.map(function(s){
|
|
233
|
+
var g = D.el("g", {opacity: 0}, gT);
|
|
234
|
+
s.line.forEach(function(t, i){
|
|
235
|
+
var room = W - 8, txt = t;
|
|
236
|
+
if (tw(txt) > room){ ctx.report("layout", "[ctable] the formula line \"" + t.slice(0, 30) + "…\" is wider than the element; it is cut"); var a = Array.from(txt); while (a.length && tw(a.join("") + "…") > room) a.pop(); txt = a.join("") + "…"; }
|
|
237
|
+
var e = D.el("text", {x: (W / 2).toFixed(1), y: (fy + i * lineH).toFixed(1), "font-size": fs, "text-anchor": "middle", fill: "var(--fg)", style: "font-variant-numeric:tabular-nums"}, g);
|
|
238
|
+
e.textContent = txt;
|
|
239
|
+
});
|
|
240
|
+
return g;
|
|
241
|
+
});
|
|
242
|
+
// 読める表(data-readable):最後の状態の表をそのまま
|
|
243
|
+
var tbl = document.createElement("table");
|
|
244
|
+
tbl.className = "sr-only"; tbl.setAttribute("data-readable", "");
|
|
245
|
+
tbl.setAttribute("style", "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);border:0");
|
|
246
|
+
for (var rr = 0; rr < pl.nr; rr++){
|
|
247
|
+
var tr = document.createElement("tr");
|
|
248
|
+
for (var cc = 0; cc < nc; cc++){
|
|
249
|
+
var x = pl.cells.filter(function(q){ return q.r === rr && q.c === cc; }), td = document.createElement(rr === 0 || cc === 0 ? "th" : "td");
|
|
250
|
+
td.textContent = x.map(function(q){ return q.text; }).join(" ");
|
|
251
|
+
tr.appendChild(td);
|
|
252
|
+
}
|
|
253
|
+
tbl.appendChild(tr);
|
|
254
|
+
}
|
|
255
|
+
this.appendChild(tbl);
|
|
256
|
+
if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
|
|
257
|
+
this.setAttribute("role", "img");
|
|
258
|
+
if (!this._aria) this.setAttribute("aria-label", (pl.L === T.ja ? "表:" : "Table: ") + pl.cols.filter(Boolean).join(pl.L === T.ja ? "、" : ", ") + "; " + pl.steps.map(function(s){ return s.line.join(" "); }).filter(Boolean).join("; "));
|
|
259
|
+
this.model = {cols: pl.cols, nr: pl.nr, steps: pl.steps.length};
|
|
260
|
+
}
|
|
261
|
+
duration(k){ return k >= 1 && k <= this.plan().steps.length ? this.props.dur : 0; }
|
|
262
|
+
render(k, t, ctx){
|
|
263
|
+
if (!this.cellEls) return;
|
|
264
|
+
var pl = this.plan(), D = base, P = this.props, N = pl.steps.length;
|
|
265
|
+
k = Math.max(0, Math.min(k, N));
|
|
266
|
+
var e = k === 0 ? 1 : D.prog(t, 0, P.dur), fin = k === N && (t === Infinity || t >= P.dur);
|
|
267
|
+
this.cellEls.forEach(function(o){
|
|
268
|
+
var st = o.x.step, shown = st === 0 ? 1 : st < k ? 1 : st > k ? 0 : e;
|
|
269
|
+
// 埋まる前は「?」、埋まるステップの前半で「?」が消え、後半で値が出る(同じ場所の字は重ねない)
|
|
270
|
+
var vis = st === 0 || !o.x.q ? shown : Math.max(0, 2 * shown - 1);
|
|
271
|
+
o.t.setAttribute("opacity", vis.toFixed(3));
|
|
272
|
+
if (o.qm) o.qm.setAttribute("opacity", (st === 0 ? 0 : st < k ? 0 : st > k ? 1 : Math.max(0, 1 - 2 * e)).toFixed(3));
|
|
273
|
+
if (o.bg) o.bg.setAttribute("opacity", (0.18).toFixed(3));
|
|
274
|
+
});
|
|
275
|
+
this.hl.forEach(function(g, i){ g.setAttribute("opacity", (i + 1 === k && !fin ? e : 0).toFixed(3)); });
|
|
276
|
+
this.lines.forEach(function(g, i){ g.setAttribute("opacity", (i + 1 === k ? e : 0).toFixed(3)); });
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// code-core 1.0.0: shared code drawing for m-code and m-trace (a library part, Egatari spec §6.1). Pure functions of their
|
|
2
|
+
// arguments except wrap, which measures prose with base.textWidth. No DOM is created here and no state is kept.
|
|
3
|
+
// Moved verbatim from m-code 2.1.0 (lines, monoWidth, cut, the colour roles of KEYWORDS / dialect / spans, wrap) so that m-code
|
|
4
|
+
// 2.2.0 draws the same pixels; new in 1.0.0: softWrap (visual rows of a long code line) and windowFor (the lines a moving
|
|
5
|
+
// window shows for a step).
|
|
6
|
+
// returns {MONO, set, lines, monoWidth, cut, dialect, spans, wrap, softWrap, windowFor}
|
|
7
|
+
egatariParts.define({name: "code-core", version: "1.0.1", requires: {base: "1.3.0"}}, function(deps){
|
|
8
|
+
"use strict";
|
|
9
|
+
var base = deps.base, MONO = 'ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace';
|
|
10
|
+
function set(e, a, v){ e.setAttribute(a, String(v)); }
|
|
11
|
+
function lines(s){ return s.replace(/\r\n?/g, "\n").split("\n"); }
|
|
12
|
+
function monoWidth(s, fs){ return [...s].reduce(function(w, ch){ return w + (/[\u0000-\u024f]/.test(ch) ? 0.6 : 1); }, 0) * fs; }
|
|
13
|
+
function cut(s, w, fs){
|
|
14
|
+
if (monoWidth(s, fs) <= w) return s;
|
|
15
|
+
var ch = [...s];
|
|
16
|
+
while (ch.length && monoWidth(ch.join("") + "…", fs) > w) ch.pop();
|
|
17
|
+
return w >= fs ? ch.join("") + "…" : "";
|
|
18
|
+
}
|
|
19
|
+
// Colour roles for code: keywords term, strings accent2, comments muted (theme roles only; the text stays readable without colour).
|
|
20
|
+
var KEYWORDS = {
|
|
21
|
+
python: "False None True and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield",
|
|
22
|
+
js: "async await break case catch class const continue default delete do else export extends false finally for function if import in instanceof let new null of return super switch this throw true try typeof undefined var void while yield",
|
|
23
|
+
r: "if else repeat while function for in next break TRUE FALSE NULL Inf NaN NA return",
|
|
24
|
+
shell: "if then else elif fi case esac for while until do done in function return export local"
|
|
25
|
+
};
|
|
26
|
+
function dialect(lang){ return lang === "javascript" ? "js" : lang === "sh" || lang === "bash" ? "shell" : KEYWORDS[lang] ? lang : ""; }
|
|
27
|
+
// Split each line into [start, end, role] spans: strings (also across lines for Python triple quotes / JS templates),
|
|
28
|
+
// line comments outside strings, keywords outside both. Unknown languages give no spans.
|
|
29
|
+
function spans(program, lang){
|
|
30
|
+
var L = dialect(lang), kw = L ? new Set(KEYWORDS[L].split(" ")) : null, quote = "", triple = false;
|
|
31
|
+
return program.map(function(s){
|
|
32
|
+
var out = [], from = quote ? 0 : -1;
|
|
33
|
+
if (!L) return out;
|
|
34
|
+
for (var i = 0; i < s.length; i++){
|
|
35
|
+
var c = s[i];
|
|
36
|
+
if (quote){
|
|
37
|
+
if (c === "\\"){ i++; continue; }
|
|
38
|
+
if (c === quote && (!triple || s.slice(i, i + 3) === quote.repeat(3))){ i += triple ? 2 : 0; out.push([from, i + 1, "accent2"]); quote = ""; triple = false; }
|
|
39
|
+
} else if (c === '"' || c === "'" || L === "js" && c === "`"){
|
|
40
|
+
from = i; quote = c; triple = L === "python" && s.slice(i, i + 3) === c.repeat(3); if (triple) i += 2;
|
|
41
|
+
} else if (L !== "js" && c === "#" && (L !== "shell" || i === 0 || /\s/.test(s[i - 1])) || L === "js" && s.slice(i, i + 2) === "//"){
|
|
42
|
+
out.push([i, s.length, "muted"]); return out;
|
|
43
|
+
} else if (/[A-Za-z_]/.test(c) && (i === 0 || !/[\w.$]/.test(s[i - 1]))){
|
|
44
|
+
var m = /^[A-Za-z_]\w*/.exec(s.slice(i))[0];
|
|
45
|
+
if (kw.has(m)) out.push([i, i + m.length, "term"]);
|
|
46
|
+
i += m.length - 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (quote){ out.push([from, s.length, "accent2"]); if (!triple && quote !== "`") quote = ""; }
|
|
50
|
+
return out;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Wrap prose on words where possible, falling back to characters for Japanese / long tokens.
|
|
54
|
+
function wrap(s, w, fs, font){
|
|
55
|
+
var out = [];
|
|
56
|
+
lines(s).forEach(function(p){
|
|
57
|
+
var rest = [...p];
|
|
58
|
+
while (rest.length){
|
|
59
|
+
var n = 0;
|
|
60
|
+
while (n < rest.length && base.textWidth(rest.slice(0, n + 1).join(""), fs, {font: font}) <= w) n++;
|
|
61
|
+
n = Math.max(1, n);
|
|
62
|
+
if (n < rest.length){ var space = rest.slice(0, n + 1).lastIndexOf(" "); if (space > 0) n = space; }
|
|
63
|
+
out.push(rest.splice(0, n).join("").trimEnd());
|
|
64
|
+
while (rest[0] === " ") rest.shift();
|
|
65
|
+
}
|
|
66
|
+
if (!p) out.push("");
|
|
67
|
+
});
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
70
|
+
// Visual rows of one code line (tabs already expanded) that fit `width` px at `fs` px: break after the last space, comma or
|
|
71
|
+
// opening bracket that fits, else at the width. → [{from, to}] character offsets into the line (code points), at least one row.
|
|
72
|
+
function softWrap(s, width, fs){
|
|
73
|
+
var ch = [...s], out = [], from = 0;
|
|
74
|
+
if (!ch.length) return [{from: 0, to: 0}];
|
|
75
|
+
while (from < ch.length){
|
|
76
|
+
var n = 0;
|
|
77
|
+
while (from + n < ch.length && monoWidth(ch.slice(from, from + n + 1).join(""), fs) <= width) n++;
|
|
78
|
+
n = Math.max(1, n);
|
|
79
|
+
if (from + n < ch.length){
|
|
80
|
+
for (var k = n; k > Math.floor(n / 3); k--){ if (/[ ,([{]/.test(ch[from + k - 1])){ n = k; break; } }
|
|
81
|
+
}
|
|
82
|
+
out.push({from: from, to: from + n}); from += n;
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
// The rows a moving window of `slots` rows shows so that rows ra..rb are visible, centred where possible. A hidden part
|
|
87
|
+
// above or below costs one row for its "⋮" marker. → {f, l, top, bottom, fits}: rows f..l are shown; top / bottom are true when
|
|
88
|
+
// a marker sits above / below them; fits is false when ra..rb is taller than the window (then the window starts at ra).
|
|
89
|
+
function windowFor(n, slots, ra, rb){
|
|
90
|
+
if (n <= slots) return {f: 0, l: n - 1, top: false, bottom: false, fits: true};
|
|
91
|
+
var best = null;
|
|
92
|
+
for (var f = 0; f < n; f++){
|
|
93
|
+
var top = f > 0, room = slots - (top ? 1 : 0), l = f + room - 1, bottom = l < n - 1;
|
|
94
|
+
if (bottom) l -= 1;
|
|
95
|
+
if (l >= n - 1){ l = n - 1; bottom = false; }
|
|
96
|
+
if (l < f) continue;
|
|
97
|
+
// まず表示する範囲を埋める(空いた行が少ない方)、次に中心が近い方
|
|
98
|
+
var unused = slots - (top ? 1 : 0) - (bottom ? 1 : 0) - (l - f + 1), fits = ra >= f && rb <= l, score = unused * 1000 + Math.abs((f + l) / 2 - (ra + rb) / 2);
|
|
99
|
+
if (fits && (!best || score < best.score - 1e-9)) best = {f: f, l: l, top: top, bottom: bottom, fits: true, score: score};
|
|
100
|
+
}
|
|
101
|
+
if (best){ delete best.score; return best; }
|
|
102
|
+
var f2 = Math.max(0, Math.min(ra, n - 1)), top2 = f2 > 0, l2 = Math.min(n - 1, f2 + slots - (top2 ? 1 : 0) - 1), bottom2 = l2 < n - 1;
|
|
103
|
+
if (bottom2) l2 -= 1;
|
|
104
|
+
return {f: f2, l: Math.max(f2, l2), top: top2, bottom: bottom2, fits: false};
|
|
105
|
+
}
|
|
106
|
+
return {MONO: MONO, set: set, lines: lines, monoWidth: monoWidth, cut: cut, dialect: dialect, spans: spans, wrap: wrap, softWrap: softWrap, windowFor: windowFor};
|
|
107
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// m-market:市場規模の入れ子の円(TAM / SAM / SOM)。外の円から 1 つずつ、前の円の大きさから縮んで現れる
|
|
2
|
+
// <m-market unit="億円" style="height:420px"><script type="application/json">
|
|
3
|
+
// {"rings": [{"key": "TAM", "value": 3000, "basis": "国内の…"}, {"key": "SAM", "value": 600, "basis": "…"}, {"key": "SOM", "value": 30, "basis": "…"}]}
|
|
4
|
+
// (JSON の終わり)</m-market>
|
|
5
|
+
// 段階 j(1〜円の数)で j 番目の円。数字は円が縮みきってから出る(count="true" で縮みに合わせて数え上げる)
|
|
6
|
+
// 円の大きさ:scale="fixed"(既定。見やすい決まった比)か "area"(面積を値に比例。小さすぎる円は最小の大きさにする)
|
|
7
|
+
// 配置:layout="bottom"(既定。下端をそろえる)か "center"(同心)。円の名前・値・根拠(basis)は右に引き出し線で書く
|
|
8
|
+
// 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・mtext・prog・lerp・previewOpacity を使い、プレイヤーのグローバルは使わない
|
|
9
|
+
egatariParts.define({name: "market", version: "2.0.5", requires: {base: "1.3.0"}, element: "m-market"}, function(deps){
|
|
10
|
+
"use strict";
|
|
11
|
+
var base = deps.base;
|
|
12
|
+
return class extends base.MotionElement {
|
|
13
|
+
static partName = "market"; // the registry name (define meta name), for report prefixes
|
|
14
|
+
// データの形(kit/shape.js)。円は外から順
|
|
15
|
+
static shape = {
|
|
16
|
+
schema: {type: "object", additionalProperties: false, required: ["rings"], properties: {
|
|
17
|
+
rings: {type: "array", minItems: 1, items: {type: "object", required: ["value"], properties: {key: {type: "string"}, value: {type: "number"}, basis: {type: "string"}, tone: {type: "string"}}}}}},
|
|
18
|
+
example: {rings: [{key: "TAM", value: 3000, basis: "国内の…"}, {key: "SAM", value: 600, basis: "…"}, {key: "SOM", value: 30, basis: "…"}]},
|
|
19
|
+
};
|
|
20
|
+
static props = {
|
|
21
|
+
unit: {type: "string", default: "", doc: "値の単位(数字の後ろに付ける)"},
|
|
22
|
+
digits: {type: "number", default: 0, doc: "値の小数桁"},
|
|
23
|
+
scale: {type: "string", default: "fixed", doc: "fixed(決まった比)か area(面積を値に比例)"},
|
|
24
|
+
layout: {type: "string", default: "bottom", doc: "bottom(下端をそろえる)か center(同心)"},
|
|
25
|
+
dur: {type: "number", default: 0.9, doc: "1 つの円が現れる秒数"},
|
|
26
|
+
count: {type: "bool", default: false, doc: "値の数字を縮みに合わせて数え上げる"},
|
|
27
|
+
};
|
|
28
|
+
get steps(){ return this.getAttribute("steps") !== null ? +this.getAttribute("steps") : ((this.data || {}).rings || []).length; }
|
|
29
|
+
mount(ctx){
|
|
30
|
+
var P = this.props, D = base, self = this, R = (this.data || {}).rings || [];
|
|
31
|
+
this.style.display = "block"; this.style.position = "relative";
|
|
32
|
+
var W = this.clientWidth, H = this.clientHeight;
|
|
33
|
+
var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, style: "display:block;overflow:visible"}, this);
|
|
34
|
+
// 円は左の 4 割ほど、名前と数字は右
|
|
35
|
+
var big = Math.max(0, Math.min(H / 2 - 6, W * 0.22)), cx = 6 + big, bottom = H / 2 + big;
|
|
36
|
+
var fixed = [1, 0.64, 0.34, 0.16];
|
|
37
|
+
// area は値がすべて正で、外の円から順に小さくなるときだけ(そうでなければ円が要素の外にはみ出すか、半径が NaN になる)。
|
|
38
|
+
// そうでなければ知らせて、この図は fixed の比で描く
|
|
39
|
+
var area = P.scale === "area";
|
|
40
|
+
if (area && !R.every(function(r, i){ return typeof r.value === "number" && isFinite(r.value) && r.value > 0 && (i === 0 || r.value < R[i - 1].value); })){
|
|
41
|
+
ctx.report("data", "[market] scale=\"area\" needs values that are positive and get smaller from the outer ring inwards; the fixed spacing is used for this figure");
|
|
42
|
+
area = false;
|
|
43
|
+
}
|
|
44
|
+
var radii = R.map(function(r, i){
|
|
45
|
+
if (area) return Math.max(big * 0.14, big * Math.sqrt(r.value / R[0].value));
|
|
46
|
+
return big * (fixed[i] !== undefined ? fixed[i] : fixed[fixed.length - 1] * Math.pow(0.5, i - fixed.length + 1));
|
|
47
|
+
});
|
|
48
|
+
var cy = function(i){ return P.layout === "center" ? H / 2 : bottom - radii[i]; };
|
|
49
|
+
var tones = ["var(--term)", "var(--term)", "var(--emph)", "var(--emph)"];
|
|
50
|
+
var fills = [0.10, 0.18, 0.22, 0.3];
|
|
51
|
+
var gC = D.el("g", {}, svg), gL = D.el("g", {}, svg);
|
|
52
|
+
var lx = cx + big + 64, n = R.length;
|
|
53
|
+
this.rings = R.map(function(r, i){
|
|
54
|
+
var col = r.tone ? "var(--" + (/^(term|emph|muted|accent2|series-[1-4])$/.test(r.tone) ? r.tone : "term") + ")" : tones[Math.min(i, 3)];
|
|
55
|
+
var c = D.el("circle", {cx: cx, cy: cy(i), r: radii[i], fill: col, "fill-opacity": fills[Math.min(i, 3)], stroke: col, "stroke-width": i === n - 1 ? 3 : 2.2, opacity: 0}, gC);
|
|
56
|
+
// 引き出し線の起点:この円の見えている帯の中(次の円の上端との間)。最後の円は中心
|
|
57
|
+
var top = cy(i) - radii[i], nextTop = i + 1 < n ? cy(i + 1) - radii[i + 1] : null;
|
|
58
|
+
var py = nextTop !== null ? (top + nextTop) / 2 : cy(i);
|
|
59
|
+
// 名前と数字の行は高さを等分して並べる(上から順に)
|
|
60
|
+
var ly = (H / (n + 0.2)) * (i + 0.5) + 14;
|
|
61
|
+
var g = D.el("g", {opacity: 0}, gL);
|
|
62
|
+
D.el("circle", {cx: cx, cy: py, r: 5, fill: col}, g);
|
|
63
|
+
D.el("polyline", {points: cx + "," + py + " " + (lx - 40) + "," + py + " " + (lx - 12) + "," + (ly - 10), fill: "none", stroke: col, "stroke-width": 1.6}, g);
|
|
64
|
+
var key = D.mtext(g, lx, ly, r.key || "", {"font-size": 28, "font-weight": 700, fill: col});
|
|
65
|
+
// 数字は名前の後ろ(名前の幅は和文 1 字 = 1 字幅、ほかは 0.6 字幅の見積もり)、根拠は次の行
|
|
66
|
+
var kw = [...String(r.key || "")].reduce(function(a, ch){ return a + (/[\u0000-\u024f]/.test(ch) ? 0.7 : 1); }, 0) * 28;
|
|
67
|
+
var val = D.el("text", {x: lx + kw + 20, y: ly, "font-size": 36, "font-weight": 700, fill: "var(--fg)", style: "font-variant-numeric:tabular-nums"}, g);
|
|
68
|
+
var basis = r.basis ? D.mtext(g, lx, ly + 34, r.basis, {"font-size": 24, fill: "var(--muted)"}) : null;
|
|
69
|
+
// 最初の円は 1.15 倍から縮む。ただし要素の外にはみ出さない大きさまで
|
|
70
|
+
var prev = i ? radii[i - 1] : Math.max(radii[0], Math.min(radii[0] * 1.15, cy(0), H - cy(0), cx, W - cx));
|
|
71
|
+
return {r: r, c: c, g: g, val: val, basis: basis, rad: radii[i], prev: prev, cy: cy(i), pcy: i ? cy(i - 1) : cy(i), i: i};
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
fmt(v){
|
|
75
|
+
var s = Math.abs(v).toFixed(this.props.digits).split("."), i = s[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
76
|
+
return (v < 0 ? "−" : "") + i + (s[1] ? "." + s[1] : "") + this.props.unit;
|
|
77
|
+
}
|
|
78
|
+
duration(k){ return k >= 1 ? this.props.dur + (this.props.count ? 0 : 0.35) : 0; }
|
|
79
|
+
render(k, t, ctx){
|
|
80
|
+
var P = this.props, D = base, self = this, n = this.rings.length;
|
|
81
|
+
// 先の段階を薄く見せる表示(授業の表示):後の段階の円と名前・数字を、最後の形でテーマの --preview-opacity の濃さに
|
|
82
|
+
var preview = !!ctx.preview, PV = preview ? base.previewOpacity(this) : 1;
|
|
83
|
+
this.rings.forEach(function(o){
|
|
84
|
+
var j = o.i + 1, ahead = preview && j > k;
|
|
85
|
+
var e = j < k || ahead ? 1 : j > k ? 0 : D.prog(t, 0, P.dur);
|
|
86
|
+
// 前の円の大きさ・位置から縮んで今の大きさへ
|
|
87
|
+
o.c.setAttribute("r", D.lerp(o.prev, o.rad, e).toFixed(2));
|
|
88
|
+
o.c.setAttribute("cy", D.lerp(o.pcy, o.cy, e).toFixed(2));
|
|
89
|
+
o.c.setAttribute("opacity", (ahead ? PV : j <= k ? Math.min(1, e * 2) : 0).toFixed(3));
|
|
90
|
+
// 名前と数字:縮みきってから(count なら縮みに合わせて)
|
|
91
|
+
var lo = ahead ? PV : P.count ? (j <= k ? Math.min(1, e * 3) : 0) : j < k ? 1 : j > k ? 0 : D.prog(t, P.dur, 0.35);
|
|
92
|
+
o.val.textContent = self.fmt(P.count ? o.r.value * (j < k ? 1 : e) : o.r.value);
|
|
93
|
+
o.g.setAttribute("opacity", lo.toFixed(3));
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
});
|