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,390 @@
|
|
|
1
|
+
// m-predict:予想してから答えを開く。問いと選択肢、クラスの数(手を挙げた人数)を選択肢ごとの棒で見せ、作者の書いた段階で答えを開く
|
|
2
|
+
// <m-predict unit="人" style="height:440px"><script type="application/json">
|
|
3
|
+
// {"question": "重い球と軽い球、どちらが先に落ちる?",
|
|
4
|
+
// "choices": [{"label": "重い球"}, {"label": "軽い球"}, {"label": "同時"}],
|
|
5
|
+
// "answer": 2, "counts": [14, 3, 9], "note": "空気の抵抗を除けば、重さによらず同時に落ちる(ガリレオ)"}
|
|
6
|
+
// (JSON の終わり)</m-predict>
|
|
7
|
+
// 段階:0 = 問いと選択肢(と目盛り)。1 = 数の棒。answer-step(既定 2)= 答え(正しい選択肢に枠と ✓、ほかは薄く、note)
|
|
8
|
+
// 見る人の入力(仕様 §8.4「Viewer input」、Studio の約束事 §3):選択肢ごとの −1・+1 と数の欄(発表者が数える)、選択肢の名前を押すと「自分の予想」。
|
|
9
|
+
// 入力は (i, k, t) の外で、同じスライドにいるあいだは(段階を進めても戻っても)残る。ほかのスライドから入ったとき・飛んだとき(ctx.entered)だけ作者の counts に戻る。
|
|
10
|
+
// ctx.reset(触った部品を段階に入るときに戻す)では、触った跡(欄やボタンのフォーカス)だけを戻し、数と予想は残す(仕様 §8.4)
|
|
11
|
+
// 動画(?mode=video)では操作を作らず、input() も受け付けない。印刷では操作を隠し、作者の数を字で出す
|
|
12
|
+
// live(拡張 live §2.5):poll="p1" と書き、ctx.live があれば ctx.live.poll("p1") の数(number[] | null)を棒に出す。
|
|
13
|
+
// 見せてよいか(先生が見せると決めたか、3 人以上か)は実行系が決める。部品は配列が来たときだけ出し、動画・印刷では出さない
|
|
14
|
+
// 見せ方(docs/conventions.md §1):fade(0。棒と答えの印がフェードして現れる)・draw(棒が上の選択肢から順に現れ、答えの枠を線で引く。長さは同じ)
|
|
15
|
+
// 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・mtext・prog・variant を使い、プレイヤーのグローバルは使わない。
|
|
16
|
+
// 見る人の入力を戻すのは ctx.entered だけ(1.x の deck:pos の代わりはない)。動画かどうかは mount の ctx.mode。
|
|
17
|
+
// 要素の大きさの問題は ctx.report("size", …)。印刷の前後は document.defaultView の beforeprint・afterprint
|
|
18
|
+
egatariParts.define({name: "predict", version: "2.1.2", requires: {base: "1.3.0"}, element: "m-predict"}, function(deps){
|
|
19
|
+
"use strict";
|
|
20
|
+
var base = deps.base;
|
|
21
|
+
// 表示の文字(ctx.lang、見る人の言語ではなく文書の言語)。correct は子の JSON の labels.correct で上書きできる
|
|
22
|
+
var TEXT = {
|
|
23
|
+
ja: {
|
|
24
|
+
correct: "✓ 正解",
|
|
25
|
+
noteWrong: "予想ははずれ。", noteRight: "予想は当たり。",
|
|
26
|
+
liveResults: "投票の結果",
|
|
27
|
+
guessLabel: function(label){ return "予想:" + label; },
|
|
28
|
+
countGroup: function(label){ return label + "の数"; },
|
|
29
|
+
countField: function(label, unit){ return label + "の数" + (unit ? "(" + unit + ")" : ""); },
|
|
30
|
+
decrease: function(label){ return label + ":1 減らす"; },
|
|
31
|
+
increase: function(label){ return label + ":1 増やす"; },
|
|
32
|
+
countAnnounce: function(label, v, unit){ return label + ":" + v + unit; },
|
|
33
|
+
unpicked: "予想を外しました",
|
|
34
|
+
pickedRight: function(label){ return "当たり:" + label; },
|
|
35
|
+
pickedWrong: function(label){ return "はずれ。答えは " + label; },
|
|
36
|
+
myGuess: function(label){ return "あなたの予想:" + label; },
|
|
37
|
+
answerAnnounce: function(label, note){ return "答え:" + label + (note ? "。" + note : ""); },
|
|
38
|
+
},
|
|
39
|
+
en: {
|
|
40
|
+
correct: "✓ Correct",
|
|
41
|
+
noteWrong: "Wrong. ", noteRight: "Right! ",
|
|
42
|
+
liveResults: "Poll results",
|
|
43
|
+
guessLabel: function(label){ return "Guess: " + label; },
|
|
44
|
+
countGroup: function(label){ return label + " count"; },
|
|
45
|
+
countField: function(label, unit){ return label + " count" + (unit ? " (" + unit + ")" : ""); },
|
|
46
|
+
decrease: function(label){ return label + ": decrease by 1"; },
|
|
47
|
+
increase: function(label){ return label + ": increase by 1"; },
|
|
48
|
+
countAnnounce: function(label, v, unit){ return label + ": " + v + (unit ? " " + unit : ""); },
|
|
49
|
+
unpicked: "Guess cleared",
|
|
50
|
+
pickedRight: function(label){ return "Correct: " + label; },
|
|
51
|
+
pickedWrong: function(label){ return "Wrong. The answer is " + label; },
|
|
52
|
+
myGuess: function(label){ return "My guess: " + label; },
|
|
53
|
+
answerAnnounce: function(label, note){ return "Answer: " + label + (note ? ". " + note : ""); },
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var CSS_ID = "predict-2-1-1-css"; // the style element this part writes, named with its name and version (spec §6.1 Identifiers)
|
|
57
|
+
var CSS = [
|
|
58
|
+
"m-predict .pd-say{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}",
|
|
59
|
+
"m-predict .pd-pick{position:absolute;background:transparent;border:0;border-radius:10px;cursor:pointer;padding:0;margin:0}",
|
|
60
|
+
"m-predict .pd-pick:focus-visible,m-predict .pd-btn:focus-visible,m-predict .pd-num:focus-visible{outline:3px solid var(--emph);outline-offset:2px}",
|
|
61
|
+
"m-predict .pd-ctl{position:absolute;display:flex;gap:8px;align-items:center;height:48px}",
|
|
62
|
+
"m-predict .pd-btn{width:60px;height:48px;font:700 27px/1 var(--font-cap,var(--font-sans,sans-serif));color:var(--fg);background:var(--bg);border:2px solid var(--term);border-radius:8px;cursor:pointer;padding:0;touch-action:manipulation}",
|
|
63
|
+
"m-predict .pd-btn:active{background:var(--term-tint)}",
|
|
64
|
+
"m-predict .pd-num{width:80px;height:48px;box-sizing:border-box;font:700 27px/1 var(--font-cap,var(--font-sans,sans-serif));font-variant-numeric:tabular-nums;text-align:center;color:var(--fg);background:var(--bg);border:2px solid var(--muted);border-radius:8px;padding:0}",
|
|
65
|
+
"@media print{m-predict .pd-ctl,m-predict .pd-pick,m-predict .pd-mark,m-predict .pd-live{display:none!important}}",
|
|
66
|
+
].join("\n");
|
|
67
|
+
return class extends base.MotionElement {
|
|
68
|
+
static partName = "predict"; // the registry name (define meta name), for report prefixes
|
|
69
|
+
static variants = ["fade", "draw"];
|
|
70
|
+
static interactive = true; // 操作できるパーツ(docs/conventions.md §6)
|
|
71
|
+
static viewerInput = true; // 見る人の入力を受け付ける(仕様 §8.4)
|
|
72
|
+
static preview = "none"; // 先の段階は答えなので、授業の表示でも先を見せない(仕様 §8.4、docs/conventions.md §1.2)
|
|
73
|
+
// データの形(kit/shape.js)
|
|
74
|
+
static shape = {
|
|
75
|
+
schema: {type: "object", additionalProperties: false, required: ["choices", "answer"], properties: {
|
|
76
|
+
question: {type: "string"},
|
|
77
|
+
choices: {type: "array", minItems: 2, maxItems: 6, items: {type: "object", additionalProperties: false, required: ["label"], properties: {
|
|
78
|
+
label: {type: "string"}, tone: {type: "string"}}}},
|
|
79
|
+
answer: {type: "integer"},
|
|
80
|
+
counts: {type: "array", items: {type: "integer"}},
|
|
81
|
+
note: {type: "string"},
|
|
82
|
+
labels: {type: "object", additionalProperties: false, properties: {correct: {type: "string"}}}}},
|
|
83
|
+
example: {question: "重い球と軽い球、どちらが先に落ちる?", choices: [{label: "重い球"}, {label: "軽い球"}, {label: "同時"}], answer: 2, counts: [14, 3, 9], note: "空気の抵抗を除けば同時に落ちる"},
|
|
84
|
+
note: {en: "choices are objects {\"label\": …} (not strings); answer is the 0-based index of the right choice; counts (optional) has one whole number ≥ 0 per choice",
|
|
85
|
+
ja: "choices は {\"label\": …} の並び(字の並びではない)。answer は正しい選択肢の番号(0 から数える)。counts(省略可)は選択肢ごとに 0 以上の整数を 1 つずつ"},
|
|
86
|
+
};
|
|
87
|
+
static props = {
|
|
88
|
+
"answer-step": {type: "number", default: 2, doc: "2 以上(既定 2)。人数を数えるステップ 1 のあとに答えを開く"},
|
|
89
|
+
unit: {type: "string", default: "", doc: "数の単位(人 など)"},
|
|
90
|
+
poll: {type: "string", default: "", doc: "live の投票の id(live 拡張のある再生で、見せてよいと決まった集計を棒に出す)"},
|
|
91
|
+
ticks: {type: "bool", default: true, doc: "数の軸の目盛りと格子"},
|
|
92
|
+
};
|
|
93
|
+
get aStep(){ return Math.max(1, Math.round(this.props["answer-step"]) || 2); }
|
|
94
|
+
get steps(){ return this.getAttribute("steps") !== null ? +this.getAttribute("steps") : this.aStep; }
|
|
95
|
+
// 作者の数(counts。書かなければ全部 0)
|
|
96
|
+
get author(){
|
|
97
|
+
var d = this.data || {}, n = (d.choices || []).length;
|
|
98
|
+
// 9999 まで(−1・+1 と数の欄が扱う数の上限。mount で知らせる)
|
|
99
|
+
return Array.from({length: n}, function(_, i){ var v = d.counts && d.counts[i]; return Number.isInteger(v) && v > 0 ? Math.min(9999, v) : 0; });
|
|
100
|
+
}
|
|
101
|
+
mount(ctx){
|
|
102
|
+
var self = this, d = this.data || {}, n = (d.choices || []).length;
|
|
103
|
+
this.T = /^ja\b/i.test(ctx.lang || "") ? TEXT.ja : TEXT.en;
|
|
104
|
+
if (!(d.answer >= 0 && d.answer < n)) throw new Error("answer " + d.answer + " is not a choice index (0–" + (n - 1) + ")");
|
|
105
|
+
if (d.counts && d.counts.length !== n) throw new Error("counts has " + d.counts.length + " numbers for " + n + " choices");
|
|
106
|
+
if (d.counts && d.counts.some(function(v){ return v < 0; })) throw new Error("counts must be 0 or more");
|
|
107
|
+
var big = (d.counts || []).filter(function(v){ return v > 9999; });
|
|
108
|
+
if (big.length) ctx.report("data", "[predict] counts " + big.join(", ") + " are more than 9999, the most the −1/+1 buttons and the field take; 9999 is shown");
|
|
109
|
+
this.variant = base.variant(this);
|
|
110
|
+
this.video = ctx.mode === "video";
|
|
111
|
+
this.style.display = "block"; this.style.position = "relative";
|
|
112
|
+
if (!document.getElementById(CSS_ID)){ var st = document.createElement("style"); st.id = CSS_ID; st.textContent = CSS; document.head.appendChild(st); }
|
|
113
|
+
// 読み上げソフトへの知らせ
|
|
114
|
+
this.say = document.createElement("div"); this.say.className = "pd-say"; this.say.setAttribute("role", "status"); this.say.setAttribute("aria-live", "polite");
|
|
115
|
+
this.appendChild(this.say);
|
|
116
|
+
if (d.question) this.setAttribute("aria-label", d.question);
|
|
117
|
+
// 印刷は作者の値で描く(画面の数は消さない。afterprint で戻す)。beforeprint・afterprint は文書の窓(document.defaultView)に来る
|
|
118
|
+
var view = document.defaultView;
|
|
119
|
+
if (!this.video && view){
|
|
120
|
+
view.addEventListener("beforeprint", function(){ self._printing = true; self.redraw(); });
|
|
121
|
+
view.addEventListener("afterprint", function(){ self._printing = false; self.redraw(); });
|
|
122
|
+
}
|
|
123
|
+
this.place(ctx);
|
|
124
|
+
}
|
|
125
|
+
// 配置が変わった知らせ(仕様 §8.4 layout):要素の大きさが mount のときと変わったときだけ置き直す(変換で縮めるだけなら呼ばれない。
|
|
126
|
+
// 横に並んだ文の字が後から読み込まれて、段組みの中の幅が変わるときなど)。大きさ 0(隠れている)なら前の配置のまま
|
|
127
|
+
layout(ctx){
|
|
128
|
+
var W = this.clientWidth, H = this.clientHeight;
|
|
129
|
+
if (!W || !H || (W === this.g.W && H === this.g.H)) return;
|
|
130
|
+
// フォーカスが操作の中にあれば、作り直した同じ行・同じ場所の操作に戻す(字の読み込みや画面の切り替えで呼ばれても、キーボードや読み上げソフトで使う人に見えないように)
|
|
131
|
+
var a = document.activeElement, keep = null;
|
|
132
|
+
if (a && a !== this && this.contains(a)) this.rows.forEach(function(r, i){
|
|
133
|
+
if (a === r.pick) keep = {i: i, at: -1};
|
|
134
|
+
else if (r.ctl && r.ctl.contains(a)) keep = {i: i, at: Array.prototype.indexOf.call(r.ctl.children, a), sel: a === r.field ? [a.selectionStart, a.selectionEnd] : null};
|
|
135
|
+
});
|
|
136
|
+
this.place(ctx);
|
|
137
|
+
this.redraw();
|
|
138
|
+
var r = keep && this.rows[keep.i], e = r && (keep.at < 0 ? r.pick : r.ctl && r.ctl.children[keep.at]);
|
|
139
|
+
if (e){
|
|
140
|
+
e.focus({preventScroll: true});
|
|
141
|
+
if (keep.sel && keep.sel[0] != null) try { e.setSelectionRange(keep.sel[0], keep.sel[1]); } catch (x) {}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// 大きさで決まる絵と操作を作る。数と予想(見る人の入力)・読み上げの知らせは残す(フォーカスは layout が戻す)
|
|
145
|
+
place(ctx){
|
|
146
|
+
var self = this, P = this.props, D = base, d = this.data || {}, ch = d.choices || [], n = ch.length, T = this.T;
|
|
147
|
+
var correctLabel = (d.labels && d.labels.correct) || T.correct;
|
|
148
|
+
var W = this.clientWidth, H = this.clientHeight, inter = !this.video;
|
|
149
|
+
if (this.svg){
|
|
150
|
+
this.svg.remove();
|
|
151
|
+
this.rows.forEach(function(r){ if (r.pick) r.pick.remove(); if (r.ctl) r.ctl.remove(); });
|
|
152
|
+
}
|
|
153
|
+
// 字の幅(base の textWidth:テーマの字で測った幅。mk:mtext で書く字で、*_^ は数えない)
|
|
154
|
+
var est = function(s, size, mk){ return D.textWidth(s, size, {font: self, mark: !!mk}); };
|
|
155
|
+
// 縦:問い・行・目盛り・注(と予想の当たり外れ)
|
|
156
|
+
var qh = d.question ? 54 : 0, nh = d.note || inter ? 50 : 0, tb = P.ticks ? 40 : 8;
|
|
157
|
+
var rh = Math.min(88, (H - qh - nh - tb) / n);
|
|
158
|
+
if (inter && rh < 54) ctx.report("size", "[predict] rows are " + rh.toFixed(0) + " px high; the −1/+1 buttons need 54 (make the element taller or use fewer choices)");
|
|
159
|
+
// 横:予想の印・選択肢の名前・棒・数と「正解」・操作
|
|
160
|
+
var mk = inter ? 40 : 0, LS = 26;
|
|
161
|
+
var lw = Math.min(W * 0.34, Math.max.apply(null, ch.map(function(c){ return est(c.label, LS, true); })) + 16);
|
|
162
|
+
var cw = inter ? 232 : 0;
|
|
163
|
+
var valW = est("9999" + P.unit, 26) + 12, okW = est(correctLabel, 26) + 16;
|
|
164
|
+
// 棒の軸の長さ:選択肢の名前・数・「正解」・操作の残り。BARMIN px より短ければ知らせ、その長さは残す(負の長さで棒が消え、目盛りが重ならないように)
|
|
165
|
+
var x0 = mk + lw + 8, x1 = W - cw - valW - okW - 8, BARMIN = 120;
|
|
166
|
+
if (x1 < x0 + BARMIN){ ctx.report("size", "[predict] the element is " + W + " px wide; the bars get " + Math.round(x1 - x0) + " px, less than " + BARMIN + " (make it about " + Math.ceil(W + x0 + BARMIN - x1) + " px wide or shorten the labels)"); x1 = x0 + BARMIN; }
|
|
167
|
+
this.g = {W: W, H: H, qh: qh, nh: nh, rh: rh, mk: mk, lw: lw, cw: cw,
|
|
168
|
+
x0: x0, x1: x1, y0: qh, y1: qh + rh * n};
|
|
169
|
+
var G = this.g;
|
|
170
|
+
var svg = this.svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, style: "display:block;overflow:visible"});
|
|
171
|
+
this.insertBefore(svg, this.say);
|
|
172
|
+
var fitText = function(el, s, max, size, what, mk){
|
|
173
|
+
var z = size;
|
|
174
|
+
while (z > 24 && est(s, z, mk) > max) z--;
|
|
175
|
+
if (est(s, z, mk) > max) ctx.report("size", "[predict] the " + what + " does not fit (" + Math.ceil(est(s, z, mk) - max) + " px too wide at 24 px); shorten it");
|
|
176
|
+
el.setAttribute("font-size", z);
|
|
177
|
+
return el;
|
|
178
|
+
};
|
|
179
|
+
if (d.question) fitText(D.mtext(svg, 0, 36, d.question, {"font-size": 30, "font-weight": 700}), d.question, W - 8, 30, "question", true);
|
|
180
|
+
// 答えの枠(行の後ろ)
|
|
181
|
+
this.frame = D.el("rect", {x: 2, y: 0, width: Math.max(0, W - cw - 12), height: Math.max(0, rh - 8), rx: 10, fill: "none", stroke: "var(--emph)", "stroke-width": 3, opacity: 0}, svg);
|
|
182
|
+
this.frameLen = 2 * (W - cw - 12 + rh - 8);
|
|
183
|
+
// 目盛り(数の軸の上限は数で決まるので、render で置き直す。入れ物は先に作る)
|
|
184
|
+
var gT = D.el("g", {}, svg);
|
|
185
|
+
this.ticks = !P.ticks ? [] : Array.from({length: 8}, function(){
|
|
186
|
+
return {grid: D.el("line", {stroke: "var(--line)", "stroke-width": 1.2, y1: G.y0 + 4, y2: G.y1}, gT),
|
|
187
|
+
text: D.el("text", {"font-size": 24, "text-anchor": "middle", y: G.y1 + 30, style: "font-variant-numeric:tabular-nums"}, gT)};
|
|
188
|
+
});
|
|
189
|
+
if (P.ticks){ var z = D.el("text", {"font-size": 24, "text-anchor": "middle", x: G.x0, y: G.y1 + 30}, gT); z.textContent = "0"; }
|
|
190
|
+
D.el("line", {x1: G.x0, y1: G.y0 + 4, x2: G.x0, y2: G.y1, stroke: "var(--fg)", "stroke-width": 1.5}, svg);
|
|
191
|
+
var bw = Math.max(0, Math.min(46, rh * 0.56));
|
|
192
|
+
this.rows = ch.map(function(c, i){
|
|
193
|
+
var cy = G.y0 + rh * (i + 0.5), col = tone(c.tone);
|
|
194
|
+
var r = {cy: cy, col: col,
|
|
195
|
+
mark: inter ? D.el("circle", {cx: 16, cy: cy, r: 11, fill: "none", stroke: "var(--term)", "stroke-width": 2.5, "class": "pd-mark"}, svg) : null,
|
|
196
|
+
dot: inter ? D.el("circle", {cx: 16, cy: cy, r: 6, fill: "var(--term)", opacity: 0, "class": "pd-mark"}, svg) : null,
|
|
197
|
+
bar: D.el("rect", {x: G.x0, y: (cy - bw / 2).toFixed(1), height: bw.toFixed(1), rx: 3, fill: col, opacity: 0}, svg),
|
|
198
|
+
label: fitText(D.mtext(svg, mk + lw, cy + 9, c.label, {"text-anchor": "end", "font-size": LS}), c.label, lw - 8, LS, "label " + JSON.stringify(c.label), true),
|
|
199
|
+
val: D.el("text", {"font-size": 26, "font-weight": 700, y: (cy + 9).toFixed(1), opacity: 0, style: "font-variant-numeric:tabular-nums"}, svg)};
|
|
200
|
+
if (i === d.answer) r.ok = D.el("text", {"font-size": 26, "font-weight": 700, y: (cy + 9).toFixed(1), fill: "var(--emph)", opacity: 0}, svg);
|
|
201
|
+
if (r.ok) r.ok.textContent = correctLabel;
|
|
202
|
+
return r;
|
|
203
|
+
});
|
|
204
|
+
this.bw = bw;
|
|
205
|
+
// 注(答えと一緒に)と、予想の当たり外れ(見る人が予想したときだけ)
|
|
206
|
+
this.noteEl = D.el("text", {x: 0, y: H - 14, "font-size": 26, opacity: 0}, svg);
|
|
207
|
+
this.noteText = d.note || "";
|
|
208
|
+
if (d.note){ var notePrefix = est(T.noteWrong, 26) >= est(T.noteRight, 26) ? T.noteWrong : T.noteRight; fitText(this.noteEl, notePrefix + d.note, W - 8, 26, "note"); }
|
|
209
|
+
// live の集計の見出し(集計を出すときだけ)
|
|
210
|
+
this.liveEl = D.el("text", {x: W, y: G.y1 + 30, "font-size": 24, "text-anchor": "end", opacity: 0, "class": "pd-live"}, svg);
|
|
211
|
+
this.liveEl.textContent = T.liveResults;
|
|
212
|
+
// 操作:選択肢の名前(自分の予想)、−1・数の欄・+1。動画では作らない
|
|
213
|
+
if (inter){
|
|
214
|
+
var mkEl = function(tag, cls, attrs){ var e = document.createElement(tag); e.className = cls; for (var a in attrs) e.setAttribute(a, attrs[a]); self.appendChild(e); return e; };
|
|
215
|
+
var unit = P.unit;
|
|
216
|
+
this.rows.forEach(function(r, i){
|
|
217
|
+
var top = r.cy - 24;
|
|
218
|
+
r.pick = mkEl("button", "pd-pick", {type: "button", "aria-pressed": "false", "aria-label": T.guessLabel(ch[i].label)});
|
|
219
|
+
Object.assign(r.pick.style, {left: "0px", top: (r.cy - rh / 2 + 4) + "px", width: (mk + lw) + "px", height: (rh - 8) + "px"});
|
|
220
|
+
r.pick.addEventListener("click", function(e){ e.stopPropagation(); self.choose(i); });
|
|
221
|
+
var ctl = r.ctl = mkEl("div", "pd-ctl", {role: "group", "aria-label": T.countGroup(ch[i].label)});
|
|
222
|
+
Object.assign(ctl.style, {left: (W - cw + 16) + "px", top: top + "px"});
|
|
223
|
+
var bt = function(txt, dlt, ariaLabel){
|
|
224
|
+
var b = document.createElement("button"); b.type = "button"; b.className = "pd-btn"; b.textContent = txt; b.setAttribute("aria-label", ariaLabel);
|
|
225
|
+
b.addEventListener("click", function(e){ e.stopPropagation(); self.bump(i, dlt); });
|
|
226
|
+
b.addEventListener("keydown", function(e){ self.key(e, i, false); });
|
|
227
|
+
return b;
|
|
228
|
+
};
|
|
229
|
+
ctl.appendChild(bt("−1", -1, T.decrease(ch[i].label)));
|
|
230
|
+
var f = r.field = document.createElement("input");
|
|
231
|
+
f.type = "text"; f.className = "pd-num"; f.setAttribute("inputmode", "numeric"); f.setAttribute("autocomplete", "off");
|
|
232
|
+
f.setAttribute("aria-label", T.countField(ch[i].label, unit));
|
|
233
|
+
f.addEventListener("keydown", function(e){ self.key(e, i, true); });
|
|
234
|
+
f.addEventListener("input", function(){
|
|
235
|
+
var s = f.value.replace(/[^0-9]/g, "").slice(0, 4);
|
|
236
|
+
if (s !== f.value) f.value = s;
|
|
237
|
+
self.set(i, s === "" ? 0 : +s);
|
|
238
|
+
});
|
|
239
|
+
f.addEventListener("change", function(){ f.value = String(self.counts()[i]); });
|
|
240
|
+
ctl.appendChild(f);
|
|
241
|
+
ctl.appendChild(bt("+1", 1, T.increase(ch[i].label)));
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function tone(t){ return /^(term|emph|muted|accent2|fg|series-[1-4])$/.test(t || "") ? "var(--" + t + ")" : "var(--term)"; }
|
|
245
|
+
}
|
|
246
|
+
// ---- 見る人の状態((i, k, t) の外)
|
|
247
|
+
// 今の数(見る人が変えていればその値、そうでなければ作者の値)。新しい配列を返す
|
|
248
|
+
counts(){ return (this._vc || this.author).slice(); }
|
|
249
|
+
// 発表者の画面から(Studio が呼ぶ):choice は 0 から数える選択肢の番号、count は新しい数(0 以上の整数)
|
|
250
|
+
input(choice, count){
|
|
251
|
+
if (this.video) return;
|
|
252
|
+
var n = this.author.length;
|
|
253
|
+
if (!Number.isInteger(choice) || choice < 0 || choice >= n || !Number.isInteger(count) || count < 0 || count > 9999){
|
|
254
|
+
console.warn("[predict] input(" + JSON.stringify(choice) + ", " + JSON.stringify(count) + ") ignored (choice 0–" + (n - 1) + ", count a whole number 0–9999)");
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
this.set(choice, count);
|
|
258
|
+
}
|
|
259
|
+
bump(i, dl){ this.set(i, this.counts()[i] + dl); }
|
|
260
|
+
set(i, v){
|
|
261
|
+
if (this.video || !this.rows) return;
|
|
262
|
+
v = Math.max(0, Math.min(9999, v));
|
|
263
|
+
var c = this.counts();
|
|
264
|
+
if (c[i] === v) return;
|
|
265
|
+
c[i] = v; this._vc = c;
|
|
266
|
+
this.redraw();
|
|
267
|
+
this.say.textContent = this.T.countAnnounce(this.data.choices[i].label, v, this.props.unit);
|
|
268
|
+
this.emit();
|
|
269
|
+
}
|
|
270
|
+
// 自分の予想(1 つ。もう一度押すと外す)
|
|
271
|
+
choose(i){
|
|
272
|
+
if (this.video) return;
|
|
273
|
+
var d = this.data, T = this.T;
|
|
274
|
+
this._pick = this._pick === i ? null : i;
|
|
275
|
+
this.redraw();
|
|
276
|
+
var lab = d.choices[i].label;
|
|
277
|
+
this.say.textContent = this._pick === null ? T.unpicked : this.revealed() ? (i === d.answer ? T.pickedRight(lab) : T.pickedWrong(d.choices[d.answer].label)) : T.myGuess(lab);
|
|
278
|
+
}
|
|
279
|
+
revealed(){ return this._k !== undefined && this._k >= this.aStep; }
|
|
280
|
+
key(e, i, field){
|
|
281
|
+
var k = e.key, up = k === "+" || k === "ArrowUp" || (!field && k === "ArrowRight"), dn = k === "-" || k === "−" || k === "ArrowDown" || (!field && k === "ArrowLeft");
|
|
282
|
+
if (up || dn){ e.preventDefault(); e.stopPropagation(); this.bump(i, up ? 1 : -1); return; }
|
|
283
|
+
if (field){
|
|
284
|
+
// 欄の中のキー(数字・矢印・Space など)はスライドを動かさない。Esc で欄を出る
|
|
285
|
+
e.stopPropagation();
|
|
286
|
+
if (k === "Escape" || k === "Enter") e.target.blur();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
emit(){ this.dispatchEvent(new CustomEvent("egatari-input", {bubbles: true, detail: {counts: this.counts()}})); }
|
|
290
|
+
// 見る人の状態を捨てて作者の値に戻す。数を変えていたら知らせる
|
|
291
|
+
reset(){
|
|
292
|
+
var had = !!this._vc;
|
|
293
|
+
if (!had && this._pick == null) return false;
|
|
294
|
+
this._vc = null; this._pick = null;
|
|
295
|
+
if (had) this.emit();
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
// 触った跡だけを戻す(ctx.reset):部品の中のフォーカスを外す(欄は今の数を出し直す)。数と予想(見る人の入力)は残す
|
|
299
|
+
untouch(){
|
|
300
|
+
var a = document.activeElement;
|
|
301
|
+
if (a && a !== this && this.contains(a) && a.blur) a.blur();
|
|
302
|
+
}
|
|
303
|
+
// 入力のあとの描き直し:最後の (k, t) で paint だけを呼ぶ(render を通さないので、ctx.entered・ctx.reset を繰り返さない)
|
|
304
|
+
redraw(){ if (this._k !== undefined) this.paint(this._k, this._t, this._ctx); }
|
|
305
|
+
duration(k){
|
|
306
|
+
var a = this.aStep, d = 0;
|
|
307
|
+
if (k === 1) d = 0.6;
|
|
308
|
+
if (k === a) d += 0.6;
|
|
309
|
+
return d;
|
|
310
|
+
}
|
|
311
|
+
render(k, t, ctx){
|
|
312
|
+
// ほかのスライドから入ったとき・飛んだとき(ctx.entered)だけ、見る人の状態を捨てる。同じスライドの中の段階の移りでは残す。
|
|
313
|
+
// ctx.reset(触った部品が段階に入るとき)は触った跡だけを戻し、見る人の入力は消さない(仕様 §8.4)
|
|
314
|
+
if (ctx.entered === true) this.reset();
|
|
315
|
+
if (ctx.reset) this.untouch();
|
|
316
|
+
this._k = k; this._t = t; this._ctx = {mode: ctx.mode, preview: ctx.preview, live: ctx.live};
|
|
317
|
+
this.paint(k, t, this._ctx);
|
|
318
|
+
}
|
|
319
|
+
// (k, t) と見る人の状態の絵。ctx は {mode, preview, live}
|
|
320
|
+
paint(k, t, ctx){
|
|
321
|
+
var self = this, P = this.props, D = base, G = this.g, dd = this.data, n = this.rows.length, vr = this.variant, T = this.T;
|
|
322
|
+
var a = this.aStep;
|
|
323
|
+
// 数:live の集計(実行系が見せてよいと渡したときだけ)→ 見る人の数 → 作者の数
|
|
324
|
+
var live = null;
|
|
325
|
+
if (P.poll && ctx && ctx.live && typeof ctx.live.poll === "function" && !this.video && !this._printing){
|
|
326
|
+
var lv = ctx.live.poll(P.poll);
|
|
327
|
+
if (Array.isArray(lv)) live = Array.from({length: n}, function(_, i){ var v = +lv[i]; return isFinite(v) && v > 0 ? Math.round(v) : 0; });
|
|
328
|
+
}
|
|
329
|
+
var c = live || (this._printing ? this.author : this.counts()), pick = this._printing ? null : this._pick;
|
|
330
|
+
// 段階 1 の棒(draw は上から順に、同じ長さの中で)、答えの段階
|
|
331
|
+
// 先の段階は授業の表示(ctx.preview)でも見せない:予想する前に棒や答えが見えてはいけない(static preview = "none")
|
|
332
|
+
var e1 = k > 1 ? 1 : k < 1 ? 0 : null;
|
|
333
|
+
var at1 = 0, ea = k > a ? 1 : k < a ? 0 : D.prog(t, a === 1 ? 0.6 : 0, 0.6);
|
|
334
|
+
var rowE = function(j){
|
|
335
|
+
if (e1 !== null) return e1;
|
|
336
|
+
if (vr === "draw"){ var s = n > 1 ? 0.3 / (n - 1) : 0; return D.prog(t, at1 + j * s, 0.3); }
|
|
337
|
+
return D.prog(t, at1, 0.6);
|
|
338
|
+
};
|
|
339
|
+
// 数の軸
|
|
340
|
+
var M = nice(Math.max(4, Math.max.apply(null, c)) * 1.12), len = G.x1 - G.x0, X = function(v){ return G.x0 + Math.min(v, M) / M * len; };
|
|
341
|
+
var ts = Math.max(1, tickStep(M)), ti = 0;
|
|
342
|
+
// 短い軸では目盛りの数が重ならない間隔まで広げる(数の幅+16 px)
|
|
343
|
+
while (ts < M && len * ts / M < est(String(Math.ceil(M)), 24) + 16) ts = up(ts);
|
|
344
|
+
this.ticks.forEach(function(o, j){
|
|
345
|
+
var v = (j + 1) * ts, on = v <= M + 1e-9;
|
|
346
|
+
o.grid.setAttribute("x1", X(v).toFixed(1)); o.grid.setAttribute("x2", X(v).toFixed(1));
|
|
347
|
+
o.text.setAttribute("x", X(v).toFixed(1)); o.text.textContent = on ? String(v) : "";
|
|
348
|
+
o.grid.setAttribute("opacity", on ? 0.8 : 0); o.text.setAttribute("opacity", on ? 1 : 0);
|
|
349
|
+
});
|
|
350
|
+
var shown = ea > 0.5;
|
|
351
|
+
this.rows.forEach(function(r, j){
|
|
352
|
+
var e = rowE(j), isA = j === dd.answer, dim = isA ? 1 : 1 - 0.65 * ea;
|
|
353
|
+
r.bar.setAttribute("width", Math.max(0, X(c[j]) - G.x0).toFixed(1));
|
|
354
|
+
r.bar.setAttribute("opacity", (e * dim).toFixed(3));
|
|
355
|
+
r.val.textContent = self.fmt(c[j]);
|
|
356
|
+
r.val.setAttribute("x", (X(c[j]) + 10).toFixed(1));
|
|
357
|
+
r.val.setAttribute("opacity", e.toFixed(3));
|
|
358
|
+
// 答えを開いたら、ほかの選択肢の字は --muted(読める濃さのまま)
|
|
359
|
+
var txt = !isA && shown ? "var(--muted)" : "var(--fg)";
|
|
360
|
+
r.val.style.fill = txt; r.label.style.fill = txt;
|
|
361
|
+
r.label.setAttribute("font-weight", isA && shown ? 700 : 400);
|
|
362
|
+
if (r.ok){ r.ok.setAttribute("x", (X(c[j]) + 10 + est(self.fmt(c[j]), 26) + 14).toFixed(1)); r.ok.setAttribute("opacity", ea.toFixed(3)); }
|
|
363
|
+
if (r.dot){ r.dot.setAttribute("opacity", pick === j ? 1 : 0); r.pick.setAttribute("aria-pressed", pick === j ? "true" : "false"); }
|
|
364
|
+
if (r.ctl){
|
|
365
|
+
r.ctl.style.display = k >= 1 && !live ? "" : "none";
|
|
366
|
+
if (document.activeElement !== r.field) r.field.value = String(c[j]);
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
// 答えの枠:fade はフェード、draw は線を引く(同じ長さ)
|
|
370
|
+
var fy = G.y0 + G.rh * dd.answer + 4;
|
|
371
|
+
this.frame.setAttribute("y", fy.toFixed(1));
|
|
372
|
+
if (vr === "draw" && ea > 0 && ea < 1){ this.frame.setAttribute("stroke-dasharray", this.frameLen.toFixed(0)); this.frame.setAttribute("stroke-dashoffset", (this.frameLen * (1 - ea)).toFixed(1)); this.frame.setAttribute("opacity", 1); }
|
|
373
|
+
else { this.frame.removeAttribute("stroke-dasharray"); this.frame.removeAttribute("stroke-dashoffset"); this.frame.setAttribute("opacity", ea.toFixed(3)); }
|
|
374
|
+
// 注と、予想の当たり外れ
|
|
375
|
+
var pk = pick, st = pk != null && k >= a ? (pk === dd.answer ? T.noteRight : T.noteWrong) : "";
|
|
376
|
+
this.noteEl.textContent = (k >= a ? st : "") + this.noteText;
|
|
377
|
+
this.noteEl.setAttribute("opacity", ea.toFixed(3));
|
|
378
|
+
this.liveEl.setAttribute("opacity", live && k >= 1 ? 1 : 0);
|
|
379
|
+
// 答えを開いた段階に入ったら知らせる(入力の知らせは set・choose が後から書く)
|
|
380
|
+
if (this._sayK !== k && !this.video){ this._sayK = k; this.say.textContent = k >= a ? T.answerAnnounce(dd.choices[dd.answer].label, this.noteText) : ""; }
|
|
381
|
+
function est(s, size){ return D.textWidth(s, size, {font: self}); }
|
|
382
|
+
function nice(v){ var e = Math.pow(10, Math.floor(Math.log10(v))), x = v / e;
|
|
383
|
+
return [1, 1.2, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10].filter(function(s){ return s >= x - 1e-9; })[0] * e; }
|
|
384
|
+
function up(v){ var e = Math.pow(10, Math.floor(Math.log10(v))); return Math.round([1, 2, 5, 10, 20].filter(function(s){ return s * e > v + 1e-9; })[0] * e); }
|
|
385
|
+
function tickStep(M){ var r = M / 4.5, e = Math.pow(10, Math.floor(Math.log10(r))), x = r / e;
|
|
386
|
+
return Math.round((x <= 1 ? 1 : x <= 2 ? 2 : x <= 2.5 ? 2.5 : x <= 5 ? 5 : 10) * e); }
|
|
387
|
+
}
|
|
388
|
+
fmt(v){ return String(v).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + this.props.unit; }
|
|
389
|
+
};
|
|
390
|
+
});
|