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,289 @@
|
|
|
1
|
+
// m-sampling: population → sample → simulated sampling distribution.
|
|
2
|
+
egatariParts.define({name: "sampling", version: "2.0.2", requires: {base: "1.3.0", plot: "1.1.3"}, element: "m-sampling"}, function(deps){
|
|
3
|
+
"use strict";
|
|
4
|
+
var base = deps.base;
|
|
5
|
+
var TEXT = {
|
|
6
|
+
ja: {population: "母集団", sample: "標本", distribution: "標本分布", with: "戻す(復元抽出)", without: "戻さない(非復元抽出)", mean: "平均", proportion: "の割合", meanAxis: "標本平均", proportionAxis: "標本比率", statsMean: "標本統計量の平均", caption: function(n, r){ return "n = " + n + "、" + r + " 回"; }},
|
|
7
|
+
en: {population: "population", sample: "Sample", distribution: "Sampling distribution", with: "with replacement", without: "without replacement", mean: "Mean", proportion: " proportion", meanAxis: "Sample mean", proportionAxis: "Sample proportion", statsMean: "mean of sample statistics", caption: function(n, r){ return "n = " + n + ", " + r + " samples"; }}
|
|
8
|
+
};
|
|
9
|
+
var OBJ = {white: "#ffffff", black: "#222222", red: "#d62728", green: "#2ca02c", yellow: "#f2c12e", blue: "#1f77b4", brown: "#8c564b", purple: "#9467bd", pink: "#e377c2", orange: "#ff7f0e", gray: "#7f7f7f"};
|
|
10
|
+
var OBJ_NAME = {"白": "white", "黒": "black", "赤": "red", "緑": "green", "黄": "yellow", "青": "blue", "茶": "brown", "紫": "purple", "桃": "pink", "橙": "orange", "灰": "gray",
|
|
11
|
+
"白色": "white", "黒色": "black", "赤色": "red", "緑色": "green", "黄色": "yellow", "青色": "blue", "茶色": "brown", "紫色": "purple", "桃色": "pink", "橙色": "orange", "灰色": "gray", "ピンク": "pink", "オレンジ": "orange", "グレー": "gray", "grey": "gray"};
|
|
12
|
+
function objColor(name){
|
|
13
|
+
var k = String(name).trim(), lower = k.toLowerCase(), own = Object.prototype.hasOwnProperty;
|
|
14
|
+
var en = own.call(OBJ, lower) ? lower : own.call(OBJ_NAME, k) ? OBJ_NAME[k] : own.call(OBJ_NAME, lower) ? OBJ_NAME[lower] : null;
|
|
15
|
+
return en ? "var(--obj-" + en + ", " + OBJ[en] + ")" : null;
|
|
16
|
+
}
|
|
17
|
+
// Mulberry32; the only mutable random state lives in mount's local generator.
|
|
18
|
+
function random(seed){
|
|
19
|
+
return function(){
|
|
20
|
+
seed = (seed + 0x6D2B79F5) | 0;
|
|
21
|
+
var z = Math.imul(seed ^ seed >>> 15, 1 | seed);
|
|
22
|
+
z ^= z + Math.imul(z ^ z >>> 7, 61 | z);
|
|
23
|
+
return ((z ^ z >>> 14) >>> 0) / 4294967296;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function set(e, a, v){ e.setAttribute(a, String(v)); }
|
|
27
|
+
function mean(values){
|
|
28
|
+
var scale = Math.max.apply(null, values.map(function(v){ return Math.abs(v); }).concat([1]));
|
|
29
|
+
var average = values.reduce(function(s, v){ return s + v / scale; }, 0) / values.length;
|
|
30
|
+
return Math.max(-1, Math.min(1, average)) * scale;
|
|
31
|
+
}
|
|
32
|
+
function meanTicks(lo, hi, values){
|
|
33
|
+
if (lo === hi) return [lo];
|
|
34
|
+
if (hi - lo <= 10 && values.every(Number.isInteger)) return Array.from({length: hi - lo + 1}, function(_, i){ return lo + i; });
|
|
35
|
+
var scale = Math.max(1, Math.abs(lo), Math.abs(hi));
|
|
36
|
+
var rough = Math.max(Number.MIN_VALUE, (hi / scale - lo / scale) / 4 * scale);
|
|
37
|
+
var power = Math.pow(10, Math.floor(Math.log10(rough))) || Number.MIN_VALUE, fraction = rough / power;
|
|
38
|
+
var step = (fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10) * power;
|
|
39
|
+
var start = Math.ceil(lo / step), ticks = [];
|
|
40
|
+
for (var i = 0; i < 10; i++){
|
|
41
|
+
var v = (start + i) * step;
|
|
42
|
+
if (!Number.isFinite(v) || v > hi + step * 1e-10) break;
|
|
43
|
+
ticks.push(v);
|
|
44
|
+
}
|
|
45
|
+
return ticks;
|
|
46
|
+
}
|
|
47
|
+
return class extends base.MotionElement {
|
|
48
|
+
static partName = "sampling";
|
|
49
|
+
static preview = "none";
|
|
50
|
+
static steps = 4;
|
|
51
|
+
static shape = {
|
|
52
|
+
schema: {type: "object", additionalProperties: false, required: ["n"], anyOf: [{required: ["balls"]}, {required: ["values"]}], properties: {
|
|
53
|
+
balls: {type: "object"}, values: {type: "array", minItems: 2, maxItems: 30, items: {type: "number"}},
|
|
54
|
+
of: {type: "string"}, n: {type: "number"}, replace: {type: "boolean"}, repeat: {type: "number"}, seed: {type: "number"},
|
|
55
|
+
stat: {enum: ["mean", "proportion"]}, digits: {type: "number"}
|
|
56
|
+
}},
|
|
57
|
+
example: {values: [1, 2, 3, 4, 5, 6], n: 2, replace: true, repeat: 40, seed: 3}
|
|
58
|
+
};
|
|
59
|
+
static props = {
|
|
60
|
+
dur: {type: "number", default: 1, doc: "ステップの秒数"},
|
|
61
|
+
stagger: {type: "number", default: 0.25, doc: "抽出のずれ(秒)"},
|
|
62
|
+
fast: {type: "number", default: 2.5, doc: "反復の秒数"},
|
|
63
|
+
size: {type: "number", default: 0, doc: "文字 px(0 は 26)"}
|
|
64
|
+
};
|
|
65
|
+
timing(name, fallback, zero){ var v = this.props[name]; return Number.isFinite(v) && (zero ? v >= 0 : v > 0) ? v : fallback; }
|
|
66
|
+
duration(k){
|
|
67
|
+
if (k < 1 || k > 4) return 0;
|
|
68
|
+
if (k === 4) return this.timing("fast", 2.5);
|
|
69
|
+
var n = this.model ? this.model.n : Math.max(1, Math.min(30, Math.round(this.data.n)));
|
|
70
|
+
return this.timing("dur", 1) + (k === 2 ? (n - 1) * this.timing("stagger", 0.25, true) : 0);
|
|
71
|
+
}
|
|
72
|
+
fmt(v){ return v.toFixed(this.model.digits); }
|
|
73
|
+
label(g, x, y, s, anchor){
|
|
74
|
+
var t = base.el("text", {x: x, y: y, "font-size": this.fs, "text-anchor": anchor || "start", fill: "var(--fg)"}, g);
|
|
75
|
+
t.textContent = s; return t;
|
|
76
|
+
}
|
|
77
|
+
mount(ctx){
|
|
78
|
+
var self = this, d = this.data, P = this.props;
|
|
79
|
+
this.T = /^ja\b/i.test(ctx.lang || "") ? TEXT.ja : TEXT.en;
|
|
80
|
+
var T = this.T;
|
|
81
|
+
[["dur", 1, false], ["stagger", 0.25, true], ["fast", 2.5, false]].forEach(function(a){
|
|
82
|
+
if (self.timing(a[0], -1, a[2]) === -1){ ctx.report("attr", "[sampling] invalid " + a[0] + "; using " + a[1]); P[a[0]] = a[1]; }
|
|
83
|
+
});
|
|
84
|
+
if (!(P.size === 0 || Number.isFinite(P.size) && P.size >= 24)){ ctx.report("attr", "[sampling] size must be 0 or at least 24; using 26"); P.size = 0; }
|
|
85
|
+
this.fs = P.size || 26;
|
|
86
|
+
this.style.display = "block"; this.style.position = "relative"; this.style.writingMode = "horizontal-tb";
|
|
87
|
+
this.setAttribute("role", "img");
|
|
88
|
+
var W = Math.max(1, this.clientWidth), H = Math.max(1, this.clientHeight);
|
|
89
|
+
var items = [], composition = [], balls = d.balls !== undefined;
|
|
90
|
+
var invalid = balls && d.values !== undefined;
|
|
91
|
+
if (balls){
|
|
92
|
+
Object.keys(d.balls).forEach(function(name){
|
|
93
|
+
var count = d.balls[name], col = objColor(name);
|
|
94
|
+
if (!col) ctx.report("data", "[sampling] unknown colour " + name + "; drawn as gray with its name");
|
|
95
|
+
if (!Number.isInteger(count) || count < 0 || count > 30){ invalid = true; return; }
|
|
96
|
+
composition.push(name + " " + count);
|
|
97
|
+
for (var i = 0; i < count; i++) items.push({label: name, color: col || objColor("gray")});
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
items = d.values.map(function(v){ return {label: String(v), value: v}; });
|
|
101
|
+
composition = items.map(function(o){ return o.label; });
|
|
102
|
+
}
|
|
103
|
+
if (invalid || items.length < 2 || items.length > 30){
|
|
104
|
+
ctx.report("data", "[sampling] supply exactly one population: 2–30 values or balls with non-negative integer counts totalling 2–30");
|
|
105
|
+
this.svg = base.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true"}, this);
|
|
106
|
+
this.label(this.svg, 8, this.fs + 4, T.population + ": 2–30");
|
|
107
|
+
if (!this.getAttribute("aria-label")) this.setAttribute("aria-label", T.population + ": 2–30");
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
function integer(key, fallback, lo, hi){
|
|
111
|
+
var v = d[key] === undefined ? fallback : d[key];
|
|
112
|
+
if (!Number.isInteger(v) || v < lo || v > hi){
|
|
113
|
+
v = Math.max(lo, Math.min(hi, Math.round(v)));
|
|
114
|
+
ctx.report("data", "[sampling] " + key + " must be an integer " + lo + "–" + hi + "; clamped to " + v);
|
|
115
|
+
}
|
|
116
|
+
return v;
|
|
117
|
+
}
|
|
118
|
+
var stat = balls ? "proportion" : "mean", of = d.of === undefined ? (balls ? Object.keys(d.balls)[0] : "") : d.of;
|
|
119
|
+
if (d.stat !== undefined && d.stat !== stat) ctx.report("data", "[sampling] stat=" + d.stat + " is incompatible with this population; using " + stat);
|
|
120
|
+
if (balls && !Object.prototype.hasOwnProperty.call(d.balls, of)) ctx.report("data", "[sampling] of=" + of + " is absent from the population; proportion is zero");
|
|
121
|
+
var n = integer("n", 1, 1, d.replace ? 30 : items.length), repeat = integer("repeat", 40, 1, 200), digits = integer("digits", 2, 0, 10);
|
|
122
|
+
var seed = d.seed === undefined ? 1 : d.seed;
|
|
123
|
+
if (!Number.isSafeInteger(seed)){ ctx.report("data", "[sampling] seed must be a safe integer; using 1"); seed = 1; }
|
|
124
|
+
function statistic(sample){
|
|
125
|
+
return balls ? sample.filter(function(id){ return items[id].label === of; }).length / sample.length : mean(sample.map(function(id){ return items[id].value; }));
|
|
126
|
+
}
|
|
127
|
+
var rng = random(seed), samples = [];
|
|
128
|
+
for (var r = 0; r < repeat; r++){
|
|
129
|
+
var pool = items.map(function(_, i){ return i; }), ids = [];
|
|
130
|
+
for (var j = 0; j < n; j++){
|
|
131
|
+
var at = Math.floor(rng() * pool.length); ids.push(pool[at]);
|
|
132
|
+
if (!d.replace) pool.splice(at, 1);
|
|
133
|
+
}
|
|
134
|
+
samples.push({ids: ids, value: statistic(ids)});
|
|
135
|
+
}
|
|
136
|
+
this.model = {items: items, samples: samples, n: n, repeat: repeat, digits: digits, replace: !!d.replace, stat: stat, of: of,
|
|
137
|
+
population: statistic(items.map(function(_, i){ return i; })), average: mean(samples.map(function(o){ return o.value; }))};
|
|
138
|
+
var m = this.model, rule = m.replace ? T.with : T.without;
|
|
139
|
+
this.composition = composition.join(T === TEXT.ja ? "・" : ", ");
|
|
140
|
+
if (!this.getAttribute("aria-label")) this.setAttribute("aria-label", T.population + ": " + this.composition + "; " + rule + "; " + T.caption(n, repeat) + "; " + T.population + " " + this.fmt(m.population) + "; " + T.statsMean + " " + this.fmt(m.average));
|
|
141
|
+
// Source Sans 3's SVG box is 1.43em tall, including its descender.
|
|
142
|
+
var fs = this.fs, line = fs * 1.45 + 4, width = function(s){ return base.textWidth(s, fs, {font: self}) + 8; };
|
|
143
|
+
var left = W * 0.24, middle = W * 0.38, sx = left + 22, px = left + middle + 48, pw = Math.max(1, W - px - 22);
|
|
144
|
+
// Plot supplies the numerical mapping and axis; normalized values avoid overflow.
|
|
145
|
+
var vals = items.map(function(o){ return o.value; }), lo = balls ? 0 : Math.min.apply(null, vals), hi = balls ? 1 : Math.max.apply(null, vals);
|
|
146
|
+
var scale = Math.max(1, Math.abs(lo), Math.abs(hi)), a = lo / scale, b = hi / scale;
|
|
147
|
+
var captionY = H - fs * 0.4 - 4, axisY = captionY - 3 * line;
|
|
148
|
+
var plotTop = fs + 4 + fs * 0.4 + 8, plotH = axisY - plotTop;
|
|
149
|
+
var plot = deps.plot.Plot(this, {xr: a === b ? [a - 1, b + 1] : [a, b], yr: [0, 1], xt: [], yt: [], noY: true,
|
|
150
|
+
m: {l: px + 12, r: W - px - 12 - Math.max(1, pw - 24), t: plotTop, b: H - axisY}});
|
|
151
|
+
this.svg = plot.svg;
|
|
152
|
+
set(this.svg, "width", W); set(this.svg, "height", H); set(this.svg, "aria-hidden", "true");
|
|
153
|
+
var axes = [].filter.call(this.svg.children, function(e){ return e.getAttribute("class") === "axes"; })[0];
|
|
154
|
+
this.svg.removeChild(axes);
|
|
155
|
+
var X = function(v){ return plot.x(v / scale); };
|
|
156
|
+
this.populationLayer = base.el("g", {opacity: 0}, this.svg);
|
|
157
|
+
this.sampleLayer = base.el("g", {opacity: 0}, this.svg);
|
|
158
|
+
this.plotLayer = base.el("g", {opacity: 0}, this.svg);
|
|
159
|
+
this.plotLayer.appendChild(axes);
|
|
160
|
+
this.finalLayer = base.el("g", {opacity: 0}, this.plotLayer);
|
|
161
|
+
this.label(this.populationLayer, 8, fs + 4, T.population);
|
|
162
|
+
this.label(this.sampleLayer, sx, fs + 4, T.sample);
|
|
163
|
+
this.label(this.plotLayer, px, fs + 4, T.distribution);
|
|
164
|
+
var small = false, itemW = Math.max(52, ...items.map(function(o){ return width(o.label) + (balls ? 36 : 16); }));
|
|
165
|
+
var cols = Math.max(1, Math.min(items.length, Math.floor((left - 24) / itemW))), rows = Math.ceil(items.length / cols), rowH = Math.max(48, line);
|
|
166
|
+
var bagTop = line + 10, bagBottom = bagTop + rows * rowH + 12;
|
|
167
|
+
base.el("rect", {x: 4, y: bagTop, width: Math.max(1, left - 8), height: bagBottom - bagTop, rx: 18, fill: "none", stroke: "var(--fg)", "stroke-width": 2}, this.populationLayer);
|
|
168
|
+
function item(g, o){
|
|
169
|
+
var shape = base.el(balls ? "circle" : "rect", balls ? {cx: 14, cy: 0, r: 12, fill: o.color, stroke: "var(--fg)", "stroke-width": 2} : {x: 0, y: -rowH / 2 + 3, width: itemW - 8, height: rowH - 6, rx: 6, fill: "var(--bg)", stroke: "var(--fg)", "stroke-width": 2}, g);
|
|
170
|
+
var text = self.label(g, balls ? 34 : (itemW - 8) / 2, fs * 0.312, o.label, balls ? "start" : "middle");
|
|
171
|
+
return {g: g, shape: shape, text: text};
|
|
172
|
+
}
|
|
173
|
+
this.originals = items.map(function(o, i){
|
|
174
|
+
var x = 14 + (i % cols) * itemW, y = bagTop + 8 + rowH / 2 + Math.floor(i / cols) * rowH;
|
|
175
|
+
var q = item(base.el("g", {transform: "translate(" + x + " " + y + ")"}, self.populationLayer), o); q.x = x; q.y = y; return q;
|
|
176
|
+
});
|
|
177
|
+
// Wrap word groups below the bag; reserve a full font box between baselines.
|
|
178
|
+
var y = bagBottom;
|
|
179
|
+
if (balls){
|
|
180
|
+
// Keep separators inside the string: width padding must not add spaces around ・.
|
|
181
|
+
var words = "";
|
|
182
|
+
composition.forEach(function(s){
|
|
183
|
+
var joined = words ? words + (T === TEXT.ja ? "・" : ", ") + s : s;
|
|
184
|
+
if (words && width(joined) > left - 16){ y += line; self.label(self.populationLayer, 8, y, words); words = s; }
|
|
185
|
+
else words = joined;
|
|
186
|
+
if (width(s) > left - 16) small = true;
|
|
187
|
+
});
|
|
188
|
+
y += line; self.label(self.populationLayer, 8, y, words);
|
|
189
|
+
}
|
|
190
|
+
var rules = width(rule) <= left - 16 ? [rule] : (T === TEXT.ja ? [m.replace ? "戻す" : "戻さない", m.replace ? "(復元抽出)" : "(非復元抽出)"] : rule.split(" "));
|
|
191
|
+
rules.forEach(function(s){ y += line; self.label(self.populationLayer, 8, y, s); if (width(s) > left - 16) small = true; });
|
|
192
|
+
if (y + fs * 0.4 + 4 > H || itemW > left - 24) small = true;
|
|
193
|
+
var sampleY = bagTop + rowH / 2 + 8, sampleW = n * itemW;
|
|
194
|
+
if (sampleW > middle - 10) small = true;
|
|
195
|
+
this.drawn = Array.from({length: n}, function(_, j){ var q = item(base.el("g", {}, self.sampleLayer), items[samples[0].ids[j]]); q.x = sx + j * itemW; q.y = sampleY; return q; });
|
|
196
|
+
this.statLayer = base.el("g", {opacity: 0}, this.sampleLayer);
|
|
197
|
+
var statY = sampleY + rowH / 2 + line;
|
|
198
|
+
this.statName = this.label(this.statLayer, sx, statY, balls ? of + T.proportion : T.mean);
|
|
199
|
+
this.statValue = this.label(this.statLayer, sx, statY + line, "");
|
|
200
|
+
var statLabel = balls ? of + T.proportion : T.mean;
|
|
201
|
+
if (width(statLabel) > middle - 10 || statY + line + fs * 0.4 > H) small = true;
|
|
202
|
+
var ticks = balls ? [0, 0.25, 0.5, 0.75, 1] : meanTicks(lo, hi, vals), lastRight = -Infinity;
|
|
203
|
+
ticks.forEach(function(v){
|
|
204
|
+
var xx = X(v), rounded = +v.toPrecision(4), s = Number.isFinite(rounded) ? String(rounded) : String(v), w = width(s);
|
|
205
|
+
base.el("line", {x1: xx, x2: xx, y1: axisY, y2: axisY + 7, stroke: "var(--fg)", "stroke-width": 2}, self.plotLayer);
|
|
206
|
+
var anchor = v === lo ? "start" : v === hi ? "end" : "middle";
|
|
207
|
+
var tx = anchor === "start" ? xx : anchor === "end" ? xx - w : xx - w / 2;
|
|
208
|
+
if (tx < lastRight + 4) small = true; lastRight = tx + w;
|
|
209
|
+
self.label(self.plotLayer, xx, axisY + line, s, anchor);
|
|
210
|
+
});
|
|
211
|
+
this.label(this.plotLayer, px, axisY + 2 * line, balls ? T.proportionAxis : T.meanAxis);
|
|
212
|
+
this.label(this.finalLayer, px, captionY, T.caption(n, repeat));
|
|
213
|
+
var markerLabel = T.population + " " + this.fmt(m.population);
|
|
214
|
+
var markerY = fs + 4 + line, markerRight = px + width(markerLabel);
|
|
215
|
+
this.label(this.finalLayer, px, markerY, markerLabel);
|
|
216
|
+
var markerBottom = markerY + fs * 0.4 + 8;
|
|
217
|
+
base.el("line", {x1: X(m.population), x2: X(m.population), y1: markerBottom, y2: axisY, stroke: "var(--emph)", "stroke-width": 2, "stroke-dasharray": "6 5"}, this.finalLayer);
|
|
218
|
+
// Stack horizontally intersecting dots at separate levels, preserving exact numerical x.
|
|
219
|
+
function stack(radius){
|
|
220
|
+
var levels = [];
|
|
221
|
+
return samples.map(function(o){
|
|
222
|
+
var xx = X(o.value), lv = 0;
|
|
223
|
+
while (levels[lv] && levels[lv].some(function(v){ return Math.abs(v - xx) < 2 * radius + 2; })) lv++;
|
|
224
|
+
if (!levels[lv]) levels[lv] = []; levels[lv].push(xx);
|
|
225
|
+
return {x: xx, level: lv};
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
// The marker label occupies only the plot's upper-left corner, not a whole row.
|
|
229
|
+
// A 1px gap between circle fills leaves more room for repeated values.
|
|
230
|
+
function fits(positions, radius){
|
|
231
|
+
return positions.every(function(o){
|
|
232
|
+
var top = axisY - 2 * radius - 3 - o.level * (2 * radius + 1);
|
|
233
|
+
return top >= (o.x - radius < markerRight && o.x + radius > px ? markerBottom : plotTop);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
var radius = 8, positions;
|
|
237
|
+
while (true){
|
|
238
|
+
positions = stack(radius);
|
|
239
|
+
if (fits(positions, radius) || radius === 5) break;
|
|
240
|
+
radius--;
|
|
241
|
+
}
|
|
242
|
+
if (!fits(positions, radius)) ctx.report("size", "[sampling] dot stack exceeds plot at minimum 5px radius; increase height or reduce repeat");
|
|
243
|
+
this.dots = positions.map(function(o){
|
|
244
|
+
var yy = axisY - radius - 3 - o.level * (2 * radius + 1);
|
|
245
|
+
return {x: o.x, y: yy, el: base.el("circle", {cx: o.x, cy: yy, r: radius, fill: "var(--term)", stroke: "var(--fg)", "stroke-width": 1, opacity: 0}, self.plotLayer)};
|
|
246
|
+
});
|
|
247
|
+
this.plotTop = plotTop;
|
|
248
|
+
if ([T.distribution, markerLabel, T.caption(n, repeat), balls ? T.proportionAxis : T.meanAxis].some(function(s){ return width(s) > pw; }) || plotH < 40) small = true;
|
|
249
|
+
if (small) ctx.report("size", "[sampling] population, sample row or plot labels do not fit; enlarge the element or shorten names");
|
|
250
|
+
// Check all statistic strings, since a later sample can be wider than the first.
|
|
251
|
+
if (samples.some(function(o){ return width(self.statText(o)) > middle - 10; })) ctx.report("size", "[sampling] statistic does not fit; enlarge width or reduce digits");
|
|
252
|
+
}
|
|
253
|
+
statText(sample){
|
|
254
|
+
var m = this.model;
|
|
255
|
+
return (m.stat === "proportion" ? sample.ids.filter(function(i){ return m.items[i].label === m.of; }).length + "/" + m.n + " = " : "") + this.fmt(sample.value);
|
|
256
|
+
}
|
|
257
|
+
render(k, t){
|
|
258
|
+
if (!this.model) return;
|
|
259
|
+
var self = this, m = this.model, P = this.props;
|
|
260
|
+
var phase = function(step){ return k > step ? 1 : k < step ? 0 : base.prog(t, 0, P.dur); };
|
|
261
|
+
set(this.populationLayer, "opacity", phase(1));
|
|
262
|
+
set(this.sampleLayer, "opacity", k >= 2 ? 1 : 0);
|
|
263
|
+
set(this.statLayer, "opacity", phase(3));
|
|
264
|
+
set(this.plotLayer, "opacity", phase(3));
|
|
265
|
+
var progress = k > 4 ? 1 : k < 4 ? 0 : Math.max(0, Math.min(1, t / P.fast));
|
|
266
|
+
var completed = k < 3 ? 0 : k === 3 ? (t >= P.dur ? 1 : 0) : 1 + Math.floor(progress * (m.repeat - 1));
|
|
267
|
+
var rep = k >= 4 ? Math.min(m.repeat - 1, completed - 1) : 0, sample = m.samples[rep];
|
|
268
|
+
var full = k >= 4 && progress === 1 || k === 3 && t >= P.dur;
|
|
269
|
+
this.originals.forEach(function(o, i){
|
|
270
|
+
var j = sample.ids.indexOf(i), gone = !m.replace && j >= 0 && !full && (k >= 3 || k === 2 && t > j * P.stagger);
|
|
271
|
+
set(o.g, "opacity", gone ? 0 : 1);
|
|
272
|
+
});
|
|
273
|
+
this.drawn.forEach(function(o, j){
|
|
274
|
+
var id = sample.ids[j], original = self.originals[id], e = k > 2 ? 1 : k < 2 ? 0 : base.prog(t, j * P.stagger, P.dur);
|
|
275
|
+
set(o.g, "opacity", k >= 2 && (k > 2 || t > j * P.stagger) ? 1 : 0);
|
|
276
|
+
set(o.g, "transform", "translate(" + base.lerp(original.x, o.x, e) + " " + base.lerp(original.y, o.y, e) + ")");
|
|
277
|
+
o.text.textContent = m.items[id].label;
|
|
278
|
+
if (m.stat === "proportion") set(o.shape, "style", "fill:" + m.items[id].color + ";stroke:var(--fg)");
|
|
279
|
+
});
|
|
280
|
+
this.statValue.textContent = this.statText(sample);
|
|
281
|
+
this.dots.forEach(function(o, i){
|
|
282
|
+
var drop = i === 0 && k === 3 ? base.prog(t, 0, P.dur) : 1;
|
|
283
|
+
set(o.el, "opacity", i < completed || i === 0 && k === 3 && t > 0 ? 1 : 0);
|
|
284
|
+
set(o.el, "cy", base.lerp(self.plotTop, o.y, drop));
|
|
285
|
+
});
|
|
286
|
+
set(this.finalLayer, "opacity", k >= 4 && progress === 1 ? 1 : 0);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: 2-axis positioning map (4 quadrants); points one per step
|
|
3
|
+
steps: largest step / to.step (1 point = 1 step)
|
|
4
|
+
props:
|
|
5
|
+
fade: point appear (s)
|
|
6
|
+
move: to move (s)
|
|
7
|
+
size: label px
|
|
8
|
+
quads-step: quadrant-name step (0 = start)
|
|
9
|
+
example: {"x": {"lo": "Manual", "hi": "Auto"}, "y": {"lo": "Costly", "hi": "Cheap"}, "items": [{"label": "Co. A", "x": 0.25, "y": 0.7}, {"label": "Us", "x": 0.8, "y": 0.82, "self": true}]}
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Positioning, effect×effort, SWOT: show the empty space.
|
|
13
|
+
|
|
14
|
+
Child JSON: `{"x": {"lo", "hi"}, "y": {"lo", "hi"}, "quads": {"tr", "tl", "bl", "br", "fill"}, "items": [...]}`.
|
|
15
|
+
|
|
16
|
+
- `x` `y`: axis end words (step 0)
|
|
17
|
+
- `quads`: names (tr = top-right, tl, bl, br); `fill: "tr"` tints one; names at `quads-step`
|
|
18
|
+
- item: `label`, `x` `y` (0–1; 0.5 = axis cross), `step` (default next), `at`, `tone` (`term`/`fg`; default muted), `anchor` (`right`, `left`, `above`, `below`), `r`
|
|
19
|
+
- `self: true`: big `--emph` point, ring pulse
|
|
20
|
+
- `to: {"x", "y", "label", "step", "at"}`: slides at `to.step` (default next), dashed trail; `label` on arrival
|
|
21
|
+
- `cues(k)`: start times of 2nd+ points in a step, for `{cue}`
|
|
22
|
+
|
|
23
|
+
The demo is `demo.html`. Names and positions are fictional.
|
|
24
|
+
|
|
25
|
+
Notes
|
|
26
|
+
|
|
27
|
+
<!-- llm: omit -->
|
|
28
|
+
- Labels crossing an axis move: opposite side → above → below (start and `to`; even with `anchor`). Axis lines have `class="axis"`; `tools/test-components.mjs` flags crossings
|
|
29
|
+
<!-- llm: end -->
|
|
30
|
+
- Quadrant names avoid points and labels (else labels move, or `ctx.report`)
|
|
31
|
+
- Label overlaps not fixed: change `anchor` or shift
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// m-quad:2 軸の位置づけ(ポジショニングマップ・SWOT 風の 4 象限)。点を段階ごとに 1 つずつ置く
|
|
2
|
+
// <m-quad style="height:420px"><script type="application/json">
|
|
3
|
+
// {"x": {"lo": "手作業", "hi": "自動"}, "y": {"lo": "高い", "hi": "安い"},
|
|
4
|
+
// "quads": {"tr": "狙う場所", "tl": "", "bl": "", "br": ""},
|
|
5
|
+
// "items": [{"label": "A 社", "x": 0.25, "y": 0.7}, {"label": "自社", "x": 0.8, "y": 0.82, "self": true, "to": {"x": 0.9, "y": 0.9, "label": "3 年後"}}]}
|
|
6
|
+
// (JSON の終わり)</m-quad>
|
|
7
|
+
// 座標は 0〜1(0.5 が軸の交わるところ)。軸と両端の言葉は段階 0 から見える。象限の名前は quads-step(既定 0)で出る
|
|
8
|
+
// 点は既定で 1 つ = 1 段階(step で直接、at で段階の中の開始秒)。self の点は強調の色で大きく、着いたときに輪が広がる
|
|
9
|
+
// to は移動先:to.step(既定は点の次の段階)に、点が破線の跡を引きながら滑る
|
|
10
|
+
// 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・prog・lerp・clamp・previewOpacity を使い、プレイヤーのグローバルは使わない
|
|
11
|
+
egatariParts.define({name: "quad", version: "2.1.1", requires: {base: "1.2.0"}, element: "m-quad"}, function(deps){
|
|
12
|
+
"use strict";
|
|
13
|
+
var base = deps.base;
|
|
14
|
+
return class extends base.MotionElement {
|
|
15
|
+
static partName = "quad"; // the registry name (define meta name), for report prefixes
|
|
16
|
+
// データの形(kit/shape.js)。x・y は 0〜1(0.5 が軸の交わるところ)
|
|
17
|
+
static shape = {
|
|
18
|
+
schema: {type: "object", additionalProperties: false, required: ["items"], properties: {
|
|
19
|
+
x: {type: "object", properties: {lo: {type: "string"}, hi: {type: "string"}}}, y: {type: "object", properties: {lo: {type: "string"}, hi: {type: "string"}}},
|
|
20
|
+
quads: {type: "object", properties: {tr: {type: "string"}, tl: {type: "string"}, bl: {type: "string"}, br: {type: "string"}, fill: {type: "string"}}},
|
|
21
|
+
items: {type: "array", minItems: 1, items: {type: "object", required: ["x", "y"], properties: {
|
|
22
|
+
label: {type: "string"}, x: {type: "number"}, y: {type: "number"}, step: {type: "integer"}, at: {type: "number"}, tone: {type: "string"}, anchor: {enum: ["right", "left", "above", "below"]},
|
|
23
|
+
r: {type: "number"}, self: {type: "boolean"}, to: {type: "object", required: ["x", "y"], properties: {x: {type: "number"}, y: {type: "number"}, label: {type: "string"}, step: {type: "integer"}, at: {type: "number"}}}}}}}},
|
|
24
|
+
example: {x: {lo: "手作業", hi: "自動"}, y: {lo: "高い", hi: "安い"}, items: [{label: "A 社", x: 0.25, y: 0.7}, {label: "自社", x: 0.8, y: 0.82, self: true}]},
|
|
25
|
+
};
|
|
26
|
+
static props = {
|
|
27
|
+
fade: {type: "number", default: 0.5, doc: "点が現れる秒数"},
|
|
28
|
+
move: {type: "number", default: 1.2, doc: "to の移動の秒数"},
|
|
29
|
+
size: {type: "number", default: 26, doc: "点の名前の字の大きさ(px)"},
|
|
30
|
+
"quads-step": {type: "number", default: 0, doc: "象限の名前を出すステップ(0 = 初めから)"},
|
|
31
|
+
};
|
|
32
|
+
get steps(){
|
|
33
|
+
if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
|
|
34
|
+
var m = this.props["quads-step"];
|
|
35
|
+
this.plan().forEach(function(o){ m = Math.max(m, o.step, o.to ? o.to.step : 0); });
|
|
36
|
+
return m;
|
|
37
|
+
}
|
|
38
|
+
// 点の段階と開始時刻(データだけから決める)
|
|
39
|
+
plan(){
|
|
40
|
+
if (this._plan) return this._plan;
|
|
41
|
+
var d = this.data || {}, q0 = this.props["quads-step"], n = 0, seen = {};
|
|
42
|
+
return (this._plan = (d.items || []).map(function(it){
|
|
43
|
+
var step = it.step !== undefined ? it.step : q0 + (++n);
|
|
44
|
+
n = Math.max(n, step - q0);
|
|
45
|
+
var j = seen[step] = (seen[step] || 0) + 1;
|
|
46
|
+
var to = it.to ? {x: it.to.x, y: it.to.y, label: it.to.label || "", step: it.to.step !== undefined ? it.to.step : step + 1, at: it.to.at || 0} : null;
|
|
47
|
+
return {it: it, step: step, at: it.at !== undefined ? it.at : (j - 1) * 0.6, to: to};
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
mount(ctx){
|
|
51
|
+
var P = this.props, D = base, self = this, d = this.data || {};
|
|
52
|
+
this.style.display = "block"; this.style.position = "relative";
|
|
53
|
+
var W = this.clientWidth, H = this.clientHeight;
|
|
54
|
+
var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
|
|
55
|
+
// 読み上げ:最後の形(点はすべて置かれ、to の点は行き先にいる)を 1 文で。作者の aria-label があればそれを使う(上書きしない)
|
|
56
|
+
if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
|
|
57
|
+
this.setAttribute("role", "img");
|
|
58
|
+
if (!this._aria) this.setAttribute("aria-label", this.summary(/^ja\b/i.test(ctx.lang || "ja")));
|
|
59
|
+
// 図の枠:両端の言葉の分だけ上下と左右に余白
|
|
60
|
+
var m = {l: 12, r: 12, t: 40, b: 40};
|
|
61
|
+
var x0 = m.l, x1 = W - m.r, y0 = m.t, y1 = H - m.b, cx = (x0 + x1) / 2, cy = (y0 + y1) / 2;
|
|
62
|
+
this.X = function(v){ return x0 + v * (x1 - x0); };
|
|
63
|
+
this.Y = function(v){ return y1 - v * (y1 - y0); };
|
|
64
|
+
// 象限の地(右上だけ淡く塗れる:quads.fill = "tr" など)と名前
|
|
65
|
+
var q = d.quads || {}, xa0 = d.x || {}, gQ = D.el("g", {}, svg);
|
|
66
|
+
this.quadG = D.el("g", {}, svg);
|
|
67
|
+
var corner = {tr: [cx, y0, x1 - cx, cy - y0, x1 - 16, y0 + 34, "end"], tl: [x0, y0, cx - x0, cy - y0, x0 + 16, y0 + 34, "start"],
|
|
68
|
+
bl: [x0, cy, cx - x0, y1 - cy, x0 + 16, y1 - 16, "start"], br: [cx, cy, x1 - cx, y1 - cy, x1 - 16, y1 - 16, "end"]};
|
|
69
|
+
["tr", "tl", "bl", "br"].forEach(function(key){
|
|
70
|
+
var c = corner[key];
|
|
71
|
+
if (q.fill === key) D.el("rect", {x: c[0], y: c[1], width: Math.max(0, c[2]), height: Math.max(0, c[3]), fill: "var(--term-tint)"}, gQ);
|
|
72
|
+
});
|
|
73
|
+
// 軸(両向きの矢印)と両端の言葉。横軸の言葉は軸の下、縦軸の言葉は軸の上端・下端の外
|
|
74
|
+
var ax = D.el("g", {}, svg), K = "var(--fg)";
|
|
75
|
+
D.el("line", {x1: x0, y1: cy, x2: x1, y2: cy, stroke: K, "stroke-width": 2, class: "axis"}, ax);
|
|
76
|
+
D.el("line", {x1: cx, y1: y0, x2: cx, y2: y1, stroke: K, "stroke-width": 2, class: "axis"}, ax);
|
|
77
|
+
[[x1, cy, 0], [x0, cy, 180], [cx, y0, -90], [cx, y1, 90]].forEach(function(a){
|
|
78
|
+
D.el("path", {d: "M0,0L-14,-7L-14,7Z", fill: K, transform: "translate(" + a[0] + " " + a[1] + ") rotate(" + a[2] + ")"}, ax);
|
|
79
|
+
});
|
|
80
|
+
var xa = xa0, ya = d.y || {};
|
|
81
|
+
if (xa.lo) D.mtext(ax, x0 + 4, cy + 34, xa.lo, {"text-anchor": "start", "font-size": 24});
|
|
82
|
+
if (xa.hi) D.mtext(ax, x1 - 4, cy + 34, xa.hi, {"text-anchor": "end", "font-size": 24});
|
|
83
|
+
if (ya.hi) D.mtext(ax, cx, y0 - 14, ya.hi, {"text-anchor": "middle", "font-size": 24});
|
|
84
|
+
if (ya.lo) D.mtext(ax, cx, y1 + 32, ya.lo, {"text-anchor": "middle", "font-size": 24});
|
|
85
|
+
// 点の名前の置き場所(既定は右。anchor で left / above / below)。
|
|
86
|
+
// 名前が軸の線を横切るなら、丸の反対の側 → 上 → 下の順に置き直す(点の始めの位置と to の位置の両方で確かめる)。
|
|
87
|
+
// 象限の名前を置いたあとは、その名前にかかる置き場所も避ける。幅は字から見積もる(base の textWidth:テーマの字で測った幅。mtext の *_^ は数えない)
|
|
88
|
+
var est = function(s, z){ return D.textWidth(s || "", z, {font: self, mark: true}); };
|
|
89
|
+
var meet = function(a, b, gp){ return a[0] < b[2] + gp && a[2] > b[0] - gp && a[1] < b[3] + gp && a[3] > b[1] - gp; };
|
|
90
|
+
var items = this.plan().map(function(o){
|
|
91
|
+
var it = o.it, me = !!it.self, r = it.r || (me ? 14 : 11), off = r + 10, w = est(it.label, P.size);
|
|
92
|
+
var place = function(an){ return an === "left" ? [-off, 9, "end"] : an === "above" ? [0, -off - 4, "middle"] : an === "below" ? [0, off + 22, "middle"] : [off, 9, "start"]; };
|
|
93
|
+
var boxAt = function(an, px, py){
|
|
94
|
+
var lp = place(an), lx = px + lp[0], ly = py + lp[1], a0 = lp[2] === "start" ? lx : lp[2] === "end" ? lx - w : lx - w / 2;
|
|
95
|
+
return [a0, ly - P.size * 0.88, a0 + w, ly + P.size * 0.22];
|
|
96
|
+
};
|
|
97
|
+
var crosses = function(an, px, py){
|
|
98
|
+
var b = boxAt(an, px, py);
|
|
99
|
+
return (b[0] - 6 < cx && b[2] + 6 > cx && b[1] < y1 && b[3] > y0) || (b[1] - 6 < cy && b[3] + 6 > cy && b[0] < x1 && b[2] > x0);
|
|
100
|
+
};
|
|
101
|
+
var pts = [[self.X(it.x), self.Y(it.y)]].concat(o.to ? [[self.X(o.to.x), self.Y(o.to.y)]] : []);
|
|
102
|
+
var pref = it.anchor || "right", order = [pref, pref === "left" ? "right" : pref === "right" ? "left" : pref === "above" ? "below" : "above", "above", "below", "left", "right"];
|
|
103
|
+
var pick = function(names){
|
|
104
|
+
return order.filter(function(a){ return !pts.some(function(q){ return crosses(a, q[0], q[1]) || names.some(function(nb){ return meet(boxAt(a, q[0], q[1]), nb, 6); }); }); })[0];
|
|
105
|
+
};
|
|
106
|
+
var an = pick([]) || pref;
|
|
107
|
+
return {o: o, it: it, me: me, r: r, pts: pts, place: place, boxAt: boxAt, pick: pick, an: an,
|
|
108
|
+
// 丸と名前が占める箱(点の始めと to の位置)
|
|
109
|
+
boxes: function(a){ return [].concat.apply([], pts.map(function(q){ return [[q[0] - r, q[1] - r, q[0] + r, q[1] + r], boxAt(a, q[0], q[1])]; })); }};
|
|
110
|
+
});
|
|
111
|
+
// 象限の名前:隅(外側の角)に置く。点や点の名前、軸の言葉にかかるなら、同じ象限の残りの 3 つの隅を順に試す。
|
|
112
|
+
// どこもかかるなら外側の角に置き、点の名前のほうを動かす(上の pick)。動かせなければ知らせる(layout)
|
|
113
|
+
var axisBoxes = [];
|
|
114
|
+
if (xa0.lo) axisBoxes.push([x0 + 4, cy + 34 - 24 * 0.88, x0 + 4 + est(xa0.lo, 24), cy + 34 + 24 * 0.22]);
|
|
115
|
+
if (xa0.hi) axisBoxes.push([x1 - 4 - est(xa0.hi, 24), cy + 34 - 24 * 0.88, x1 - 4, cy + 34 + 24 * 0.22]);
|
|
116
|
+
var names = [];
|
|
117
|
+
["tr", "tl", "bl", "br"].forEach(function(key){
|
|
118
|
+
if (!q[key]) return;
|
|
119
|
+
var c = corner[key], top = key[0] === "t", right = key[1] === "r", w = est(q[key], 26);
|
|
120
|
+
var ins = [c[0] + 16, c[0] + c[2] - 16], ys = top ? [y0 + 34, cy - 16] : [y1 - 16, cy + 42];
|
|
121
|
+
var cand = [[right ? ins[1] : ins[0], ys[0], right ? "end" : "start"], [right ? ins[0] : ins[1], ys[0], right ? "start" : "end"],
|
|
122
|
+
[right ? ins[1] : ins[0], ys[1], right ? "end" : "start"], [right ? ins[0] : ins[1], ys[1], right ? "start" : "end"]];
|
|
123
|
+
var boxOf = function(k){ var x = k[2] === "end" ? k[0] - w : k[0]; return [x, k[1] - 26 * 0.88, x + w, k[1] + 26 * 0.22]; };
|
|
124
|
+
var busy = function(b){ return axisBoxes.some(function(a){ return meet(b, a, 6); }) || items.some(function(m){ return m.boxes(m.an).some(function(a){ return meet(b, a, 6); }); }); };
|
|
125
|
+
var k = cand.filter(function(k){ return !busy(boxOf(k)); })[0] || cand[0];
|
|
126
|
+
D.mtext(self.quadG, k[0], k[1], q[key], {"text-anchor": k[2], "font-size": 26, "font-weight": 700, fill: q.fill === key ? "var(--term)" : "var(--muted)"});
|
|
127
|
+
names.push({key: key, box: boxOf(k)});
|
|
128
|
+
});
|
|
129
|
+
items.forEach(function(m){
|
|
130
|
+
if (!names.length || !m.boxes(m.an).some(function(a){ return names.some(function(nm){ return meet(a, nm.box, 6); }); })) return;
|
|
131
|
+
var a = m.pick(names.map(function(nm){ return nm.box; }));
|
|
132
|
+
if (a) m.an = a;
|
|
133
|
+
else ctx.report("layout", "[quad] the label " + JSON.stringify(m.it.label || "") + " overlaps a quadrant name and has no free side; move the point or shorten a name");
|
|
134
|
+
});
|
|
135
|
+
// 点:丸と名前
|
|
136
|
+
var gT = D.el("g", {}, svg), gP = D.el("g", {}, svg);
|
|
137
|
+
// data-part:Studio の形の検査(geometry check)が測る印。点の丸は mark(id は items の並びで p1, p2 …)、点の名前と行き先の名前は
|
|
138
|
+
// その点の label(箱の外の字)、動いた跡は p<n> から @moved への edge(破線が data-part-line、矢じりは端)
|
|
139
|
+
this.pts = items.map(function(m, i){
|
|
140
|
+
var o = m.o, it = m.it, me = m.me, r = m.r, col = me ? "var(--emph)" : it.tone === "term" ? "var(--term)" : it.tone === "fg" ? "var(--fg)" : "var(--muted)";
|
|
141
|
+
var pid = "p" + (i + 1), lb = {"data-part": "label", "data-part-id": pid, "data-part-of": "mark", "data-part-at": "outside"};
|
|
142
|
+
var gM = o.to ? D.el("g", {"data-part": "edge", "data-part-id": pid + "\u2192@moved", "data-part-from": pid, "data-part-to": "@moved"}, gT) : null;
|
|
143
|
+
var trail = o.to ? D.el("line", {stroke: col, "stroke-width": 2.5, "stroke-dasharray": "7 6", opacity: 0, "data-part-line": ""}, gM) : null;
|
|
144
|
+
// 動いた跡の印(最後の形にも残す):出発点の白抜きの丸と、行き先へ向く矢じり(丸の手前)
|
|
145
|
+
var from = o.to ? D.el("circle", {cx: self.X(it.x).toFixed(2), cy: self.Y(it.y).toFixed(2), r: (r * 0.8).toFixed(1), fill: "var(--bg)", stroke: col, "stroke-width": 2.5, opacity: 0}, gT) : null;
|
|
146
|
+
var head = o.to ? D.el("path", {d: "M0,0L-14,-7L-14,7Z", fill: col, opacity: 0}, gM) : null;
|
|
147
|
+
var ring = me ? D.el("circle", {r: r, fill: "none", stroke: col, "stroke-width": 3, opacity: 0}, gP) : null;
|
|
148
|
+
var g = D.el("g", {opacity: 0}, gP);
|
|
149
|
+
D.el("circle", {cx: 0, cy: 0, r: r, fill: col, stroke: "var(--bg)", "stroke-width": 2.5, "data-part": "mark", "data-part-id": pid}, g);
|
|
150
|
+
var lp = m.place(m.an);
|
|
151
|
+
D.mtext(g, lp[0], lp[1], it.label || "", Object.assign({"text-anchor": lp[2], "font-size": P.size, "font-weight": me ? 700 : 400, fill: me ? col : "var(--fg)"}, lb));
|
|
152
|
+
var lab2 = o.to && o.to.label ? D.mtext(gP, 0, 0, o.to.label, Object.assign({"text-anchor": "middle", "font-size": 24, fill: col, opacity: 0}, lb)) : null;
|
|
153
|
+
return {o: o, g: g, ring: ring, r: r, trail: trail, from: from, head: head, lab2: lab2};
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// 最後の形を 1 文で(読み上げの名前):象限の名前と、点ごとの最後の位置(右上・左下など。to の点は出発点から行き先へ)
|
|
157
|
+
summary(ja){
|
|
158
|
+
var d = this.data || {}, q = d.quads || {}, xa = d.x || {}, ya = d.y || {};
|
|
159
|
+
var where = function(x, y, bare){
|
|
160
|
+
var h = x > 0.5 ? (ja ? "右" : "right") : x < 0.5 ? (ja ? "左" : "left") : "", v = y > 0.5 ? (ja ? "上" : "upper") : y < 0.5 ? (ja ? "下" : "lower") : "";
|
|
161
|
+
var key = (y > 0.5 ? "t" : "b") + (x > 0.5 ? "r" : "l");
|
|
162
|
+
var s = ja ? (h + v || "中央") : ([v, h].filter(Boolean).join(" ") || "centre");
|
|
163
|
+
return s + (h && v && q[key] && !bare ? (ja ? "(" + q[key] + ")" : " (" + q[key] + ")") : "");
|
|
164
|
+
};
|
|
165
|
+
var axis = function(a, n){ return a.lo || a.hi ? (ja ? n + ":" + (a.lo || "") + "→" + (a.hi || "") : n + ": " + (a.lo || "") + " to " + (a.hi || "")) : ""; };
|
|
166
|
+
var ax = [axis(xa, ja ? "横" : "x"), axis(ya, ja ? "縦" : "y")].filter(Boolean).join(ja ? "、" : "; ");
|
|
167
|
+
var pts = this.plan().map(function(o){
|
|
168
|
+
var it = o.it, nm = it.label || (ja ? "点" : "a point");
|
|
169
|
+
if (!o.to) return ja ? nm + "は" + where(it.x, it.y) : nm + " is " + where(it.x, it.y);
|
|
170
|
+
var lb = o.to.label ? (ja ? "(" + o.to.label + ")" : " (" + o.to.label + ")") : "", w0 = where(it.x, it.y), w1 = where(o.to.x, o.to.y, true);
|
|
171
|
+
// 同じ象限の中の移動なら、行き先に象限の名前を繰り返さない
|
|
172
|
+
if (w1 !== where(it.x, it.y, true)) w1 = where(o.to.x, o.to.y);
|
|
173
|
+
return ja ? nm + "は" + w0 + "から" + w1 + "へ" + lb : nm + " moves from " + w0 + " to " + w1 + lb;
|
|
174
|
+
});
|
|
175
|
+
return (ja ? "4 象限" : "Four quadrants") + (ax ? (ja ? "(" + ax + ")" : " (" + ax + ")") : "") + (ja ? ":" : ": ") + pts.join(ja ? "、" : ", ");
|
|
176
|
+
}
|
|
177
|
+
duration(k){
|
|
178
|
+
var P = this.props, d = k === P["quads-step"] && k > 0 ? P.fade : 0;
|
|
179
|
+
this.plan().forEach(function(o){
|
|
180
|
+
if (o.step === k) d = Math.max(d, o.at + P.fade + (o.it.self ? 0.6 : 0));
|
|
181
|
+
if (o.to && o.to.step === k) d = Math.max(d, o.to.at + P.move + 0.3);
|
|
182
|
+
});
|
|
183
|
+
return d;
|
|
184
|
+
}
|
|
185
|
+
// 同じ段階に 2 つ以上の点があれば、2 つ目からの開始時刻を口述原稿の {cue} に合わせられる
|
|
186
|
+
cues(k){
|
|
187
|
+
var c = [];
|
|
188
|
+
this.plan().forEach(function(o){ if (o.step === k && o.at > 0) c.push(o.at); });
|
|
189
|
+
return c.length ? c.sort(function(a, b){ return a - b; }) : null;
|
|
190
|
+
}
|
|
191
|
+
render(k, t, ctx){
|
|
192
|
+
var P = this.props, D = base, self = this;
|
|
193
|
+
// 先の段階を薄く見せる表示(授業の表示):後の段階の点(動いた後の位置)・動く跡・行き先の名前・象限の名前を、
|
|
194
|
+
// テーマの --preview-opacity の濃さに。今の段階に出ている点は元の位置のまま
|
|
195
|
+
var preview = !!ctx.preview, PV = preview ? base.previewOpacity(this) : 1;
|
|
196
|
+
var pr = function(step, at, dur){ return step < k ? 1 : step > k ? 0 : D.prog(t, at, dur); };
|
|
197
|
+
var qs = P["quads-step"];
|
|
198
|
+
this.quadG.setAttribute("opacity", (qs === 0 ? 1 : preview && qs > k ? PV : pr(qs, 0, P.fade)).toFixed(3));
|
|
199
|
+
this.pts.forEach(function(p){
|
|
200
|
+
var o = p.o, e = pr(o.step, o.at, P.fade), fp = preview && o.step > k, fm = preview && o.to && o.to.step > k;
|
|
201
|
+
var m = o.to ? (fp ? 1 : pr(o.to.step, o.to.at, P.move)) : 0;
|
|
202
|
+
if (fp) e = 1;
|
|
203
|
+
var x0 = self.X(o.it.x), y0 = self.Y(o.it.y);
|
|
204
|
+
var x = o.to ? D.lerp(x0, self.X(o.to.x), m) : x0, y = o.to ? D.lerp(y0, self.Y(o.to.y), m) : y0;
|
|
205
|
+
var s = D.lerp(0.6, 1, e);
|
|
206
|
+
p.g.setAttribute("opacity", fp ? PV.toFixed(3) : e.toFixed(3));
|
|
207
|
+
p.g.setAttribute("transform", "translate(" + x.toFixed(2) + " " + y.toFixed(2) + ") scale(" + s.toFixed(4) + ")");
|
|
208
|
+
// 自社の点:着いたときに輪が 1 回広がって消える(最終状態では出さない)
|
|
209
|
+
if (p.ring){
|
|
210
|
+
var rt = !fp && o.step === k && t !== Infinity ? D.clamp((t - o.at - P.fade * 0.6) / 0.8) : 1;
|
|
211
|
+
p.ring.setAttribute("cx", x.toFixed(2)); p.ring.setAttribute("cy", y.toFixed(2));
|
|
212
|
+
p.ring.setAttribute("r", (p.r * (1 + 1.6 * rt)).toFixed(2));
|
|
213
|
+
p.ring.setAttribute("opacity", (rt > 0 && rt < 1 ? 0.8 * (1 - rt) : 0).toFixed(3));
|
|
214
|
+
}
|
|
215
|
+
if (p.trail){
|
|
216
|
+
p.trail.setAttribute("x1", x0.toFixed(2)); p.trail.setAttribute("y1", y0.toFixed(2));
|
|
217
|
+
p.trail.setAttribute("x2", x.toFixed(2)); p.trail.setAttribute("y2", y.toFixed(2));
|
|
218
|
+
if (fm){ p.trail.setAttribute("x2", self.X(o.to.x).toFixed(2)); p.trail.setAttribute("y2", self.Y(o.to.y).toFixed(2)); }
|
|
219
|
+
p.trail.setAttribute("opacity", fm ? PV : m > 0 ? 0.9 : 0);
|
|
220
|
+
// 出発点の丸は跡と同じ濃さ。矢じりは今の点の丸の手前(丸の縁から 3px)に、跡が丸と出発点の丸の外に出ている長さがあるときだけ
|
|
221
|
+
var hx = fm ? self.X(o.to.x) : x, hy = fm ? self.Y(o.to.y) : y, len = Math.hypot(hx - x0, hy - y0), ho = fm ? PV : m > 0 ? 0.9 : 0;
|
|
222
|
+
p.from.setAttribute("opacity", ho);
|
|
223
|
+
if (len > p.r * 1.8 + 3 + 14 + 4){
|
|
224
|
+
var ux = (hx - x0) / len, uy = (hy - y0) / len, tip = p.r * s + 3;
|
|
225
|
+
p.head.setAttribute("transform", "translate(" + (hx - ux * tip).toFixed(2) + " " + (hy - uy * tip).toFixed(2) + ") rotate(" + (Math.atan2(uy, ux) * 180 / Math.PI).toFixed(1) + ")");
|
|
226
|
+
p.head.setAttribute("opacity", ho);
|
|
227
|
+
} else { p.head.removeAttribute("transform"); p.head.setAttribute("opacity", 0); } // 作った直後と同じ(呼ぶ順で DOM が変わらない)
|
|
228
|
+
}
|
|
229
|
+
if (p.lab2){
|
|
230
|
+
p.lab2.setAttribute("x", self.X(o.to.x).toFixed(2)); p.lab2.setAttribute("y", (self.Y(o.to.y) - p.r - 14).toFixed(2));
|
|
231
|
+
p.lab2.setAttribute("opacity", fm ? PV.toFixed(3) : pr(o.to.step, o.to.at + P.move * 0.8, 0.3).toFixed(3));
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
});
|