egatari 0.6.14 → 0.6.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -1
- package/README.ja.md +65 -64
- package/README.md +40 -39
- package/bin/egatari.mjs +3 -3
- package/components.lock.json +507 -153
- package/components2.lock.json +1710 -33
- package/kit/check-messages.mjs +105 -71
- package/kit/check.mjs +17 -11
- package/kit/core/article-messages.mjs +15 -15
- package/kit/core/article-render.mjs +1 -1
- package/kit/core/article-text.mjs +3 -1
- package/kit/core/build-core.mjs +23 -1
- package/kit/core/check-parity.mjs +2 -2
- package/kit/core/check-rules.mjs +12 -7
- package/kit/core/colab-core.mjs +2 -2
- package/kit/core/comment-core.mjs +6 -0
- package/kit/core/export-name.mjs +2 -2
- package/kit/core/geometry-check.mjs +363 -25
- package/kit/core/layout-scan.mjs +75 -5
- package/kit/core/live-policy.mjs +2 -2
- package/kit/core/live.mjs +2 -2
- package/kit/core/llm-fix.mjs +24 -13
- package/kit/core/llm-insert.mjs +11 -11
- package/kit/core/llm-outline.mjs +7 -7
- package/kit/core/llm-pack-assemble.mjs +5 -2
- package/kit/core/llm-pack-data.mjs +225 -39
- package/kit/core/llm-pack.mjs +3 -3
- package/kit/core/new-deck.mjs +17 -3
- package/kit/core/part-labels.mjs +6 -0
- package/kit/core/parts2.mjs +5 -5
- package/kit/core/player.mjs +18 -0
- package/kit/core/portable.mjs +26 -8
- package/kit/core/purposes.mjs +2 -2
- package/kit/core/ref-voice.mjs +1 -1
- package/kit/core/scorm.mjs +1 -1
- package/kit/core/sound-preferences.mjs +1 -1
- package/kit/core/theme-derive.mjs +209 -0
- package/kit/core/themes-list.mjs +1 -1
- package/kit/core/themes-lock.mjs +1 -1
- package/kit/core/tier-a.mjs +20 -8
- package/kit/deck.js +7 -4
- package/kit/instruction-version.json +1 -1
- package/kit/live.js +20 -20
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/presenter.js +5 -3
- package/kit/templates/new-deck.mjs +6 -6
- package/kit/tools.js +13 -6
- package/kit/track.js +1 -1
- package/package.json +4 -2
- package/server/dev.mjs +3 -2
- package/server/editor-ui.js +28 -20
- package/server/hints.js +22 -2
- package/tts/yomi.yaml +8 -0
- package/vendor/components/CATALOG.md +21 -14
- package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/README.en.md +40 -0
- package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/index.js +408 -0
- package/vendor/components/sha256/0396a1895978803ae342b7f598f187b17ead47800e8f8317a5cb041111349813/index.js +278 -0
- package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/README.en.md +26 -0
- package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/index.js +322 -0
- package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/README.en.md +54 -0
- package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/index.js +470 -0
- package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/README.en.md +18 -0
- package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/index.js +279 -0
- package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/README.en.md +31 -0
- package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/index.js +267 -0
- package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/README.en.md +53 -0
- package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/index.js +171 -0
- package/vendor/components/sha256/1117758820dc561f41cf9d1cc0bab8cf3173cde7771ac10a12b94c96007c0f55/index.js +268 -0
- package/vendor/components/sha256/137017ad452afe209bdff81bc02ffae99c6b60a1c4aed2383515974f65511ff2/index.js +205 -0
- package/vendor/components/sha256/1a1471ba5f68e54304825a64e736afeda421e3763cdcbcdab2e45509562a0291/index.js +607 -0
- package/vendor/components/sha256/1b15fcc12b2fa43821e6299e87aae31aa69dbbc5a0d1b80088a5d7c5f8b8f7f5/index.js +429 -0
- package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/README.en.md +23 -0
- package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/index.js +147 -0
- package/vendor/components/sha256/21c099461befc0d382ddfe982f2a6cd8eeb6dd731252164ac619525e4bacdf0d/index.js +242 -0
- package/vendor/components/sha256/2352e0e22460f4a3c46dca6cef27cd9c63f161a411f1cf56c75c585e9124503c/index.js +315 -0
- package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/README.en.md +53 -0
- package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/index.js +171 -0
- package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/README.en.md +38 -0
- package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/index.js +414 -0
- package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/README.en.md +45 -0
- package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/index.js +211 -0
- package/vendor/components/sha256/2f111b900898579b3ec1611c2110db336a46d9133171a0cbb125ee37bd1f24f8/index.js +592 -0
- package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/README.en.md +45 -0
- package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/index.js +211 -0
- package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/README.en.md +20 -0
- package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/index.js +310 -0
- package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/README.en.md +35 -0
- package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/index.js +179 -0
- package/vendor/components/sha256/3af0b84b1799fc64ec74d6da9cbd343eccd89e8a11c81bfb444562c911284442/index.js +342 -0
- package/vendor/components/sha256/3c69bf3b3c6b9f76048fbc0839b3aa9699723570086d3d44bac799230ed6de5b/index.js +121 -0
- package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/README.en.md +37 -0
- package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/index.js +501 -0
- package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/README.en.md +38 -0
- package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/index.js +414 -0
- package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/README.en.md +30 -0
- package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/index.js +305 -0
- package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/README.en.md +31 -0
- package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/index.js +236 -0
- package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/README.en.md +21 -0
- package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/index.js +108 -0
- package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/README.en.md +28 -0
- package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/index.js +213 -0
- package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/README.en.md +35 -0
- package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/index.js +179 -0
- package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/README.en.md +53 -0
- package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/index.js +171 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/chords.json +89 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/extras.json +192 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ties.json +360 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/index.js +508 -0
- package/vendor/components/sha256/59996a56df462b36e24a928d4397c9308d9e39ad8224ebd19fb5c981608ef458/index.js +521 -0
- package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/README.en.md +30 -0
- package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/index.js +305 -0
- package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/README.en.md +30 -0
- package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/index.js +192 -0
- package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/README.en.md +20 -0
- package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/index.js +307 -0
- package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/README.en.md +24 -0
- package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/index.js +554 -0
- package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/README.en.md +25 -0
- package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/index.js +316 -0
- package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/README.en.md +18 -0
- package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/index.js +279 -0
- package/vendor/components/sha256/624acb997c4975ace65570b529b3ba00baa421c80ecb7fc80f392a64e8c573a7/index.js +107 -0
- package/vendor/components/sha256/62602488ee33dd4bdef8516de16da5ab27d7f7265d5041681beab80e08f1d482/index.js +97 -0
- package/vendor/components/sha256/67eaf344bddac79b74ed03fdcd70285c7b52b160e6c5ffbd6897848179aa5230/index.js +818 -0
- package/vendor/components/sha256/682c9c8871eccd19ff1264e0323a2e4c5798b0488b612ba0339c6fe85aab5914/index.js +926 -0
- package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/README.en.md +51 -0
- package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/index.js +230 -0
- package/vendor/components/sha256/72138936ed0b8fd3cb0214ae7ed250ae3f1f8b21ed6fd593544947774064ba0d/index.js +250 -0
- package/vendor/components/sha256/74c1a0f3ed1370c5003aa5770ee28cea2ce994d415680116a92fdbcd5854ba62/index.js +198 -0
- package/vendor/components/sha256/76125035eb153b98befa9c735bcd9fc4f99f774dc1d082fdae40acaadfe7d95b/index.js +818 -0
- package/vendor/components/sha256/7728cf7dde88a6688aba0ed70f23f7e21362a147beac09c1fa1a4b773e08e93b/index.js +354 -0
- package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/README.en.md +23 -0
- package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/index.js +289 -0
- package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/README.en.md +31 -0
- package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/index.js +236 -0
- package/vendor/components/sha256/7d50e50fbb6c5ec636b62509bd88ddaac1870e0522cf11bcc293ce924d48072d/index.js +312 -0
- package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/README.en.md +42 -0
- package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/index.js +549 -0
- package/vendor/components/sha256/87fc302c41b2bfeea88951ed689ec01b4dc79218c4bc69b310dc2228dfa2e153/index.js +926 -0
- package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/README.en.md +24 -0
- package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/index.js +103 -0
- package/vendor/components/sha256/89c8c16788e24df17920542ed6eb6557dea4a10e835de8fe839e439ccbba8014/index.js +69 -0
- package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/README.en.md +44 -0
- package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/index.js +304 -0
- package/vendor/components/sha256/8d9af78aef44ad2f98101c67d32473373d39725a09c923969aa621d5f5b124bb/index.js +121 -0
- package/vendor/components/sha256/8f861d71df72a82be86a3e63abf7d69bbab5aac6fa68be6e077c4e19c3519ed8/index.js +312 -0
- package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/README.en.md +54 -0
- package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/index.js +470 -0
- package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/README.en.md +24 -0
- package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/index.js +214 -0
- package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/README.en.md +33 -0
- package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/index.js +390 -0
- package/vendor/components/sha256/9289efef4a75afe011e54a17e34db08cfb16a450b2e0653e6a98525495cfba99/index.js +315 -0
- package/vendor/components/sha256/93256a923199ea51108cdb7491c3c96f376dbef15b64cbf1a1aa7cc5726b4970/index.js +429 -0
- package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/README.en.md +24 -0
- package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/index.js +550 -0
- package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/README.en.md +28 -0
- package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/index.js +213 -0
- package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/README.en.md +40 -0
- package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/index.js +348 -0
- package/vendor/components/sha256/97c074a5473618c65f4c23263f056870a0b7940e73475f2a1f32f68c08d8eb0f/index.js +198 -0
- package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/README.en.md +66 -0
- package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/index.js +984 -0
- package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/README.en.md +34 -0
- package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/index.js +244 -0
- package/vendor/components/sha256/a18b2b15d00c76462a43823b5c270c7ddd7c31794da9c236f74f20f80ec2ffdb/index.js +354 -0
- package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/README.en.md +32 -0
- package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/index.js +222 -0
- package/vendor/components/sha256/a979207c60fbd2a12cb557297eb0217eb098d660de684530a0f43d0d9c64e6ef/index.js +312 -0
- package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/README.en.md +34 -0
- package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/index.js +244 -0
- package/vendor/components/sha256/af7ed69b8969f6da14784b6e9d26e4dfd20147772ea172a99bd936a71be10fcd/index.js +278 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/chords.json +89 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/extras.json +192 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ties.json +360 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/index.js +508 -0
- package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/README.en.md +66 -0
- package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/index.js +990 -0
- package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/README.en.md +24 -0
- package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/index.js +550 -0
- package/vendor/components/sha256/b8096d7a60609520981273673761a110e40e3bdf52a7ab5548363b20e16f6e93/index.js +404 -0
- package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/README.en.md +32 -0
- package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/index.js +222 -0
- package/vendor/components/sha256/bd8e3893df02411deccc1d6d7b02292ca0d59dfeddfafcf99419430981572c82/index.js +351 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/chords.json +89 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/extras.json +192 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ties.json +360 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/index.js +508 -0
- package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/README.en.md +31 -0
- package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/index.js +267 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/LICENSE-strokesvg.txt +115 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/OFL.txt +93 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/index.js +749 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/strokes-CHANGES.md +20 -0
- package/vendor/components/sha256/c791e69e722f64146242f97acb29a341160d0c327cfe1d76307954d80e70db85/index.js +268 -0
- package/vendor/components/sha256/c8c0de41d603b61c6ec4dc1da5b50559e213dd1f3693ee5019df858016fd6daf/index.js +747 -0
- package/vendor/components/sha256/c99d4f2ab443484b9f462e405c72ea4794838b88f8823f27c606d12cbbedb996/index.js +404 -0
- package/vendor/components/sha256/cbde046e30c35db60259911a88e2ae0bedaf545e29b1da8b8ce13bc602a33c19/index.js +465 -0
- package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/README.en.md +51 -0
- package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/index.js +228 -0
- package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/README.en.md +35 -0
- package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/index.js +179 -0
- package/vendor/components/sha256/cf0985ffcd8e7cbe2175ddb9a4342b2a4aa3f322794188fc99af8789b494460d/index.js +521 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/LICENSE-strokesvg.txt +115 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/OFL.txt +93 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/index.js +749 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/strokes-CHANGES.md +20 -0
- package/vendor/components/sha256/d01dc7fd78d08dd720ed86b39d7877dc0913d72e914036088a86af2df2faee52/index.js +484 -0
- package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/README.en.md +24 -0
- package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/index.js +214 -0
- package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/README.en.md +31 -0
- package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/index.js +271 -0
- package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/README.en.md +25 -0
- package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/index.js +316 -0
- package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/README.en.md +23 -0
- package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/index.js +120 -0
- package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/README.en.md +40 -0
- package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/index.js +405 -0
- package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/README.en.md +66 -0
- package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/index.js +984 -0
- package/vendor/components/sha256/ddd4b9cbbc282cbb3117ff662e1a14ecdb3cc7c16072a574418ec6a6eecef4d8/index.js +107 -0
- package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/README.en.md +22 -0
- package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/index.js +145 -0
- package/vendor/components/sha256/e2da948daac7bfac158857877b5a6932dbd2369e73901abcef118c92dd20b725/index.js +747 -0
- package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/README.en.md +42 -0
- package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/index.js +268 -0
- package/vendor/components/sha256/e653a4da80f7761442dc5b504ea5b0700fd0acf1979beeff56122cfdb3d4654c/index.js +607 -0
- package/vendor/components/sha256/ea217c6821e931b2d8474bf56d38f2dcc89ec705fe1d276f313e1c7e8db2b98a/index.js +233 -0
- package/vendor/components/sha256/ea2e4e24838574f607879c7d05556281258c018331e4da3e6f3a5263173f2e99/index.js +75 -0
- package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/README.en.md +42 -0
- package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/index.js +549 -0
- package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/README.en.md +44 -0
- package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/index.js +203 -0
- package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/README.en.md +34 -0
- package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/index.js +244 -0
- package/vendor/components/sha256/fa1a09c10181456143d125d68dbbdcacde6bab2e4a2b3e573367103ce28ebf55/index.js +228 -0
- package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/README.en.md +51 -0
- package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/index.js +228 -0
- package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/README.en.md +23 -0
- package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/index.js +147 -0
- package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/README.en.md +20 -0
- package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/index.js +307 -0
- package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/README.en.md +26 -0
- package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/index.js +322 -0
- package/vendor/components-2/manifest-2.12.0.json +2348 -0
- package/vendor/components-2/manifest-2.13.0.json +2477 -0
- package/vendor/components-2/manifest-2.14.0.json +2460 -0
- package/vendor/components-2/manifest-2.14.1.json +2460 -0
- package/vendor/components-2/manifest-2.15.0.json +2460 -0
- package/vendor/egatari-spec/SOURCE.json +3 -3
- package/vendor/egatari-spec/schema/deck-meta.schema.json +16 -1
- package/vendor/egatari-spec/schema/egatari-metadata.schema.json +17 -2
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// m-checklist:確かめる一覧。項目を並べ、ステップごとに 1 つずつ印(✓)を描く
|
|
2
|
+
// <m-checklist style="height:420px"><script type="application/json">
|
|
3
|
+
// {"items": [{"label": "名札を付けた"}, {"label": "手を洗った", "note": "30 秒"}, {"label": "指輪を外した", "mark": "cross"}]}
|
|
4
|
+
// (JSON の終わり)</m-checklist>
|
|
5
|
+
// 印はスライドの中身(作者が決めた ✓ と ×)で、見ている人の操作ではない。押しても変わらず、何も保存しない
|
|
6
|
+
// reveal="false"(既定):項目はステップ 0 から全部見え、ステップごとに次の項目に印が付く。reveal="true":項目もそのステップで現れる
|
|
7
|
+
egatariParts.define({name: "checklist", version: "2.0.1", requires: {base: "1.3.0"}, element: "m-checklist"}, function(deps){
|
|
8
|
+
"use strict";
|
|
9
|
+
var base = deps.base;
|
|
10
|
+
return class extends base.MotionElement {
|
|
11
|
+
static partName = "checklist";
|
|
12
|
+
static shape = {
|
|
13
|
+
schema: {type: "object", additionalProperties: false, required: ["items"], properties: {
|
|
14
|
+
items: {type: "array", minItems: 1, items: {type: "object", required: ["label"], properties: {
|
|
15
|
+
label: {type: "string"}, note: {type: "string"}, mark: {enum: ["check", "cross", "none"]}, step: {type: "integer"}, at: {type: "number"}}}}}},
|
|
16
|
+
example: {items: [{label: "名札を付けた"}, {label: "手を洗った", note: "30 秒"}]},
|
|
17
|
+
};
|
|
18
|
+
static props = {
|
|
19
|
+
reveal: {type: "bool", default: false, doc: "項目もそのステップで現れる(false なら項目はステップ 0 から全部見え、印だけがステップごとに付く)"},
|
|
20
|
+
"per-step": {type: "number", default: 1, doc: "1 ステップに印を付ける項目の数(0 = 全部をステップ 1 で)"},
|
|
21
|
+
dur: {type: "number", default: 0.6, doc: "1 つの印を描く秒数"},
|
|
22
|
+
stagger: {type: "number", default: 0.25, doc: "同じステップの印の出だしのずれ(秒)"},
|
|
23
|
+
size: {type: "number", default: 32, doc: "項目の字の大きさ(px、24 以上)。メモはその 0.8 倍(24 以上)"},
|
|
24
|
+
};
|
|
25
|
+
get steps(){
|
|
26
|
+
if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
|
|
27
|
+
var m = 0;
|
|
28
|
+
this.plan().forEach(function(p){ m = Math.max(m, p.step); });
|
|
29
|
+
return m;
|
|
30
|
+
}
|
|
31
|
+
plan(){
|
|
32
|
+
if (this._plan) return this._plan;
|
|
33
|
+
var d = this.data || {}, P = this.props, per = P["per-step"], seen = {};
|
|
34
|
+
return (this._plan = (d.items || []).map(function(it, i){
|
|
35
|
+
var step = it.step !== undefined ? it.step : per > 0 ? Math.floor(i / per) + 1 : 1;
|
|
36
|
+
var j = seen[step] = (seen[step] || 0) + 1;
|
|
37
|
+
return {it: it, step: step, at: it.at !== undefined ? it.at : +((j - 1) * P.stagger).toFixed(3), mark: it.mark || "check"};
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
mount(ctx){
|
|
41
|
+
var P = this.props, D = base, self = this, pl = this.plan();
|
|
42
|
+
this.style.display = "block"; this.style.position = "relative";
|
|
43
|
+
var W = this.clientWidth, H = this.clientHeight;
|
|
44
|
+
var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
|
|
45
|
+
if (!pl.length){ ctx.report("data", "[checklist] items is empty"); return; }
|
|
46
|
+
var fs = Math.max(24, P.size), ns = Math.max(24, Math.round(fs * 0.8));
|
|
47
|
+
var est = function(s, size){ return D.textWidth(s, size, {font: self, mark: true}); };
|
|
48
|
+
// 行の高さ:字の行(項目と、あればメモ)に上下の余白。枠に入らなければ詰め、それでも入らなければ知らせる
|
|
49
|
+
var lineH = function(p){ return String(p.it.label).split("\n").length * fs * 1.3 + (p.it.note ? ns * 1.35 : 0); };
|
|
50
|
+
var need = pl.reduce(function(a, p){ return a + lineH(p); }, 0), gap = Math.max(8, Math.min(28, (H - need) / Math.max(1, pl.length)));
|
|
51
|
+
if (need + 8 * pl.length > H) ctx.report("size", "[checklist] " + pl.length + " items need about " + Math.round(need + 8 * pl.length) + " px of height; the element is " + H + " px");
|
|
52
|
+
var box = Math.round(fs * 1.15), x0 = 8, tx = x0 + box + 24, y = Math.max(0, (H - need - gap * pl.length) / 2);
|
|
53
|
+
var gB = D.el("g", {}, svg), gM = D.el("g", {}, svg), gT = D.el("g", {}, svg);
|
|
54
|
+
this.rows = pl.map(function(p){
|
|
55
|
+
var h = lineH(p) + gap, cy = y + gap / 2 + fs * 0.65;
|
|
56
|
+
var g = D.el("g", {}, gT);
|
|
57
|
+
var r = {p: p, g: g, box: D.el("rect", {x: x0, y: (cy - box / 2).toFixed(1), width: box, height: box, rx: 6, fill: "var(--bg)", stroke: "var(--fg)", "stroke-width": 2.5}, gB)};
|
|
58
|
+
String(p.it.label).split("\n").forEach(function(s, j){
|
|
59
|
+
D.mtext(g, tx, (cy + fs * 0.36 + j * fs * 1.3).toFixed(1), s, {"font-size": fs});
|
|
60
|
+
if (tx + est(s, fs) > W + 1) ctx.report("size", "[checklist] \"" + s + "\" is wider than the element; break it with \\n or make the element wider");
|
|
61
|
+
});
|
|
62
|
+
if (p.it.note) D.mtext(g, tx, (cy + fs * 0.36 + (String(p.it.label).split("\n").length - 1) * fs * 1.3 + ns * 1.35).toFixed(1), p.it.note, {"font-size": ns, fill: "var(--muted)"});
|
|
63
|
+
// 印:✓ は --term、× は --emph。描く長さで出す(stroke-dasharray)
|
|
64
|
+
var s = box, bx = x0, by = cy - box / 2;
|
|
65
|
+
if (p.mark === "check") r.mk = [D.el("path", {d: "M" + (bx + s * 0.2).toFixed(1) + "," + (by + s * 0.52).toFixed(1) + "L" + (bx + s * 0.42).toFixed(1) + "," + (by + s * 0.76).toFixed(1) + "L" + (bx + s * 0.84).toFixed(1) + "," + (by + s * 0.22).toFixed(1), fill: "none", stroke: "var(--term)", "stroke-width": 5, "stroke-linecap": "round", "stroke-linejoin": "round"}, gM)];
|
|
66
|
+
else if (p.mark === "cross") r.mk = [
|
|
67
|
+
D.el("path", {d: "M" + (bx + s * 0.24).toFixed(1) + "," + (by + s * 0.24).toFixed(1) + "L" + (bx + s * 0.76).toFixed(1) + "," + (by + s * 0.76).toFixed(1), fill: "none", stroke: "var(--emph)", "stroke-width": 5, "stroke-linecap": "round"}, gM),
|
|
68
|
+
D.el("path", {d: "M" + (bx + s * 0.76).toFixed(1) + "," + (by + s * 0.24).toFixed(1) + "L" + (bx + s * 0.24).toFixed(1) + "," + (by + s * 0.76).toFixed(1), fill: "none", stroke: "var(--emph)", "stroke-width": 5, "stroke-linecap": "round"}, gM)];
|
|
69
|
+
else r.mk = [];
|
|
70
|
+
r.len = r.mk.map(function(el){ return p.mark === "check" ? s * (Math.hypot(0.22, 0.24) + Math.hypot(0.42, 0.54)) : s * Math.hypot(0.52, 0.52); });
|
|
71
|
+
r.mk.forEach(function(el, i){ el.setAttribute("stroke-dasharray", r.len[i].toFixed(1) + " " + r.len[i].toFixed(1)); });
|
|
72
|
+
y += h;
|
|
73
|
+
return r;
|
|
74
|
+
});
|
|
75
|
+
if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
|
|
76
|
+
this.setAttribute("role", "img");
|
|
77
|
+
if (!this._aria){
|
|
78
|
+
var ja = /^ja\b/i.test(ctx.lang || "ja");
|
|
79
|
+
var word = {check: ja ? "済" : "done", cross: ja ? "×" : "no", none: ja ? "未" : "open"};
|
|
80
|
+
this.setAttribute("aria-label", (ja ? "確かめる一覧:" : "Checklist: ") + pl.map(function(p){
|
|
81
|
+
return String(p.it.label).replace(/\s*\n\s*/g, " ") + (ja ? "(" + word[p.mark] + ")" : " (" + word[p.mark] + ")");
|
|
82
|
+
}).join(ja ? "、" : "; "));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
duration(k){
|
|
86
|
+
var P = this.props, d = 0;
|
|
87
|
+
this.plan().forEach(function(p){ if (p.step === k) d = Math.max(d, p.at + (P.reveal ? 0.35 : 0) + P.dur); });
|
|
88
|
+
return d;
|
|
89
|
+
}
|
|
90
|
+
render(k, t, ctx){
|
|
91
|
+
if (!this.rows) return;
|
|
92
|
+
var P = this.props, D = base, preview = !!ctx.preview, PV = preview ? base.previewOpacity(this) : 1;
|
|
93
|
+
this.rows.forEach(function(r){
|
|
94
|
+
var p = r.p, ahead = preview && p.step > k;
|
|
95
|
+
// 項目:reveal なら、そのステップで現れる(先のステップは薄く)
|
|
96
|
+
var show = !P.reveal ? 1 : ahead ? PV : p.step < k ? 1 : p.step > k ? 0 : D.prog(t, p.at, 0.35);
|
|
97
|
+
r.g.setAttribute("opacity", show.toFixed(3)); r.box.setAttribute("opacity", show.toFixed(3));
|
|
98
|
+
// 印:現れてから描く
|
|
99
|
+
var e = ahead ? 1 : p.step < k ? 1 : p.step > k ? 0 : D.prog(t, p.at + (P.reveal ? 0.35 : 0), P.dur);
|
|
100
|
+
r.mk.forEach(function(el, i){
|
|
101
|
+
var n = r.mk.length, ei = Math.max(0, Math.min(1, e * n - i));
|
|
102
|
+
el.setAttribute("stroke-dashoffset", (r.len[i] * (1 - ei)).toFixed(1));
|
|
103
|
+
el.setAttribute("opacity", ahead ? PV : ei > 0 ? 1 : 0);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Rotate validation folds
|
|
3
|
+
steps: Rows → mean (k+1)
|
|
4
|
+
props:
|
|
5
|
+
dur: Seconds
|
|
6
|
+
size: Text px
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
JSON:
|
|
10
|
+
- `k`: 2–10; k=5: ≥316px tall (264 without errors)
|
|
11
|
+
- `errors`: k errors (optional).
|
|
12
|
+
- `labels`: k names (optional).
|
|
13
|
+
|
|
14
|
+
<!-- llm: omit -->
|
|
15
|
+
Equal blocks. Row i validates block i: emph tint + outline; training: term tint. Legend explains outline. Blocks ≥40px with enough height: T/V; short rows drop letters first, retaining the legend and outlines. Names once above. Errors/mean: 2 decimals. Final rule and mean below errors; omitted errors leave completed splits at k+1.
|
|
16
|
+
|
|
17
|
+
Wrong lengths, negative errors or invalid k: report, no draw. dur 1s; size 0=26px, ≥24. Bad props default/report.
|
|
18
|
+
|
|
19
|
+
Suggested width: 1184px. Rows shrink from ~46px to 32px before reporting. At default 26px text, minimum height = ceil(99.4+32k+56.1) = **156+32k px** with errors; **104+32k px** without. k=5: 316/264px; k=10: 476/424px. Compact row numbers/errors use monospace.
|
|
20
|
+
|
|
21
|
+
General: f=text px, L=1.45f+4, R=max(32,ceil(1.2f)); minimum=ceil(2L+16+kR+footer+4), footer=L+.4f with errors, else 0. Size reports give k, required/current height and its terms; legend width needed/available; label index and width needed/available.
|
|
22
|
+
|
|
23
|
+
ctx.lang selects ja/en. Font boxes ≥1.43em plus gap. Image role, final summary; preserve author label, hide SVG. No answer preview. Fictional demo.
|
|
24
|
+
<!-- llm: end -->
|
|
25
|
+
|
|
26
|
+
<!-- llm: omit -->
|
|
27
|
+
Per-sample splits (2.1.0): `splits` (`test`, `train` indices) and `samples` (`class`, `group`, `t`) from `uv run tools/sk2ega.py model_selection`. `splitter`: KFold, StratifiedKFold, GroupKFold, TimeSeriesSplit, ShuffleSplit, holdout. Checks: KFold-type splitters test each sample once; groups stay together; time series train on the past; stratified class counts within 1; one holdout split. Class colours: `--series-1`, `--series-3`, `--fg`, `--series-4` in that order, as in m-classify2d. Up to 60 samples and 10 splits.
|
|
28
|
+
<!-- llm: end -->
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
// m-folds: the validation block advances through k train/validation splits.
|
|
2
|
+
// 2.1.0: with `splits` (and `samples`), each sample is a cell and each row is one split from scikit-learn's splitter
|
|
3
|
+
// (KFold with shuffle, StratifiedKFold = クラスの比率を保つ KFold, GroupKFold, TimeSeriesSplit, a holdout): test cells as the
|
|
4
|
+
// validation block, train cells as before, unused cells empty; class colours and names, group runs, time order. The k mode
|
|
5
|
+
// draws exactly as 2.0.1.
|
|
6
|
+
egatariParts.define({name: "folds", version: "2.1.0", requires: {base: "1.2.0"}, element: "m-folds"}, function(deps){
|
|
7
|
+
"use strict";
|
|
8
|
+
var base = deps.base;
|
|
9
|
+
var TEXT = {
|
|
10
|
+
ja: {train: "学習(学)", validate: "検証(検・枠)", t: "学", v: "検", error: "誤差", mean: "平均", fold: "分割", unused: "使わない", cls: "クラス", group: "グループ", time: "時間 →", test: "検証", trainS: "訓練"},
|
|
11
|
+
en: {train: "train (T)", validate: "validate (V, outline)", t: "T", v: "V", error: "error", mean: "mean", fold: "fold", unused: "unused", cls: "class", group: "group", time: "time →", test: "validate", trainS: "train"}
|
|
12
|
+
};
|
|
13
|
+
function set(e, a, v){ e.setAttribute(a, String(v)); }
|
|
14
|
+
function fmt(v){ return v.toFixed(2); }
|
|
15
|
+
var PAL = ["var(--series-1)", "var(--series-3)", "var(--fg)", "var(--series-4)"]; // m-classify2d の CLASS_COLORS と同じ並び
|
|
16
|
+
return class extends base.MotionElement {
|
|
17
|
+
static partName = "folds";
|
|
18
|
+
static preview = "none";
|
|
19
|
+
static shape = {schema: {type: "object", additionalProperties: false, anyOf: [{required: ["k"]}, {required: ["splits"]}], properties: {
|
|
20
|
+
k: {type: "number"}, errors: {type: "array", items: {type: "number"}}, labels: {type: "array", items: {type: "string"}},
|
|
21
|
+
samples: {type: "array", minItems: 2, maxItems: 60, items: {type: "object", additionalProperties: false, properties: {class: {type: "integer"}, group: {type: "string"}, t: {type: ["number", "string"]}}}},
|
|
22
|
+
splits: {type: "array", minItems: 1, maxItems: 10, items: {type: "object", additionalProperties: false, required: ["test"], properties: {test: {type: "array", items: {type: "integer"}}, train: {type: "array", items: {type: "integer"}}}}},
|
|
23
|
+
splitter: {type: "string", enum: ["KFold", "StratifiedKFold", "GroupKFold", "TimeSeriesSplit", "ShuffleSplit", "holdout"]},
|
|
24
|
+
classes: {type: "array", maxItems: 4, items: {type: "object", additionalProperties: false, required: ["id"], properties: {id: {type: "integer"}, label: {type: "string"}}}}
|
|
25
|
+
}}, example: {k: 5, errors: [0.21, 0.18, 0.25, 0.19, 0.22], labels: ["1", "2", "3", "4", "5"]}};
|
|
26
|
+
static props = {
|
|
27
|
+
dur: {type: "number", default: 1, doc: "ステップの秒数"},
|
|
28
|
+
size: {type: "number", default: 0, doc: "文字 px(0 は 26)"}
|
|
29
|
+
};
|
|
30
|
+
get steps(){ if (this.data.splits) return this.data.splits.length + 1; var k = this.data.k; return Number.isInteger(k) && k >= 2 && k <= 10 ? k + 1 : 0; }
|
|
31
|
+
duration(k){ return k >= 1 && k <= this.steps ? this.props.dur : 0; }
|
|
32
|
+
label(g, x, y, s, anchor){
|
|
33
|
+
var e = base.el("text", {x: x, y: y, "font-size": this.fs, "text-anchor": anchor || "start", fill: "var(--fg)"}, g);
|
|
34
|
+
e.textContent = s; return e;
|
|
35
|
+
}
|
|
36
|
+
mount(ctx){
|
|
37
|
+
var self = this, d = this.data, P = this.props;
|
|
38
|
+
this.T = /^ja\b/i.test(ctx.lang || "") ? TEXT.ja : TEXT.en;
|
|
39
|
+
var T = this.T;
|
|
40
|
+
if (!(Number.isFinite(P.dur) && P.dur > 0)){ ctx.report("attr", "[folds] dur must be positive; using 1"); P.dur = 1; }
|
|
41
|
+
if (!(P.size === 0 || Number.isFinite(P.size) && P.size >= 24)){ ctx.report("attr", "[folds] size must be 0 or at least 24; using 26"); P.size = 0; }
|
|
42
|
+
this.fs = P.size || 26;
|
|
43
|
+
this.style.display = "block"; this.style.position = "relative"; this.style.writingMode = "horizontal-tb"; this.setAttribute("role", "img");
|
|
44
|
+
if (d.splits) return this.mountSamples(ctx);
|
|
45
|
+
if (!Number.isInteger(d.k) || d.k < 2 || d.k > 10){ ctx.report("data", "[folds] k must be an integer 2–10"); return; }
|
|
46
|
+
if (d.errors && (d.errors.length !== d.k || d.errors.some(function(v){ return v < 0; }))){ ctx.report("data", "[folds] errors must contain k non-negative numbers"); return; }
|
|
47
|
+
if (d.labels && d.labels.length !== d.k){ ctx.report("data", "[folds] labels must contain k names"); return; }
|
|
48
|
+
var labels = d.labels || Array.from({length: d.k}, function(_, i){ return String(i + 1); });
|
|
49
|
+
var errors = d.errors || null, mean = errors ? errors.reduce(function(s, v){ return s + v / d.k; }, 0) : null;
|
|
50
|
+
this.model = {k: d.k, labels: labels, errors: errors, mean: mean};
|
|
51
|
+
var summary = labels.map(function(s, i){ return T.fold + " " + (i + 1) + ": " + T.validate + " " + s + ", " + T.train + " " + labels.filter(function(_, j){ return j !== i; }).join(", ") + (errors ? "; " + T.error + " " + fmt(errors[i]) : ""); }).join("; ");
|
|
52
|
+
if (!this.getAttribute("aria-label")) this.setAttribute("aria-label", summary + (errors ? "; " + T.mean + " " + fmt(mean) : ""));
|
|
53
|
+
var W = Math.max(1, this.clientWidth), H = Math.max(1, this.clientHeight), fs = this.fs, line = fs * 1.45 + 4;
|
|
54
|
+
var width = function(s){ return base.textWidth(s, fs, {font: self}); };
|
|
55
|
+
var errorWidth = errors ? Math.max(width(T.error), width(T.mean + " " + fmt(mean)), ...errors.map(function(v){ return Math.max(width(fmt(v)), fmt(v).length * fs * 0.62); })) + 8 : 0;
|
|
56
|
+
var left = Math.max(42, width(String(d.k)) + 16), ex = W - errorWidth - 8, right = errors ? ex - 20 : W - 8;
|
|
57
|
+
var bw = (right - left) / d.k, top = 2 * line + 16;
|
|
58
|
+
var footer = errors ? line + fs * 0.4 : 0, minRow = Math.max(32, Math.ceil(fs * 1.2));
|
|
59
|
+
var minHeight = Math.ceil(top + d.k * minRow + footer + 4);
|
|
60
|
+
var rh = Math.max(minRow, Math.min(Math.max(44, line + 4), (H - top - footer - 4) / d.k)), bh = rh - 6;
|
|
61
|
+
var letters = bh >= fs * 1.43;
|
|
62
|
+
this.geometry = {row: rh, minRow: minRow, minHeight: minHeight, letters: letters};
|
|
63
|
+
// Compact row numbers/errors use a monospace font whose box fits 32px rows.
|
|
64
|
+
function rowLabel(g, x, y, s, anchor){
|
|
65
|
+
var e = self.label(g, x, y, s, anchor);
|
|
66
|
+
if (!letters) e.setAttribute("style", "font-family:ui-monospace, Menlo, Consolas, monospace;fill:var(--fg)");
|
|
67
|
+
return e;
|
|
68
|
+
}
|
|
69
|
+
this.svg = base.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true"}, this);
|
|
70
|
+
this.header = base.el("g", {opacity: 0}, this.svg);
|
|
71
|
+
function swatch(x, validate, text){
|
|
72
|
+
base.el("rect", {x: x, y: 8, width: 32, height: fs * 1.45, fill: validate ? "var(--emph-tint)" : "var(--term-tint)", stroke: validate ? "var(--emph)" : "none", "stroke-width": 3}, self.header);
|
|
73
|
+
self.label(self.header, x + 42, fs + 4, text);
|
|
74
|
+
}
|
|
75
|
+
var legend2 = 8 + 42 + width(T.train) + 28;
|
|
76
|
+
swatch(8, false, T.train); swatch(legend2, true, T.validate);
|
|
77
|
+
var legendWidth = Math.ceil(legend2 + 42 + width(T.validate) + 8);
|
|
78
|
+
if (legendWidth > W) ctx.report("size", "[folds] legend needs " + legendWidth + " px width; element has " + W + " px");
|
|
79
|
+
if (bw < 8) ctx.report("size", "[folds] " + d.k + " blocks have " + Math.floor(bw) + " px each; allow at least 8 px per block");
|
|
80
|
+
labels.forEach(function(s, i){
|
|
81
|
+
self.label(self.header, left + (i + 0.5) * bw, 2 * line, s, "middle");
|
|
82
|
+
if (width(s) > bw - 8) ctx.report("size", "[folds] label " + (i + 1) + " needs " + Math.ceil(width(s)) + " px; block fits " + Math.max(0, Math.floor(bw - 8)) + " px (shorten the label)");
|
|
83
|
+
});
|
|
84
|
+
if (errors) this.label(this.header, ex, 2 * line, T.error);
|
|
85
|
+
this.rows = labels.map(function(_, i){
|
|
86
|
+
var g = base.el("g", {opacity: 0}, self.svg), y = top + i * rh;
|
|
87
|
+
rowLabel(g, left - 12, y + bh / 2 + fs * 0.31, String(i + 1), "end");
|
|
88
|
+
var blocks = labels.map(function(_, j){
|
|
89
|
+
var valid = i === j, x = left + j * bw + 3;
|
|
90
|
+
var rect = base.el("rect", {x: x, y: y, width: Math.max(1, bw - 6), height: bh, rx: 3, fill: valid ? "var(--emph-tint)" : "var(--term-tint)", stroke: valid ? "var(--emph)" : "none", "stroke-width": 3}, g);
|
|
91
|
+
if (letters && bw - 6 >= 40) self.label(g, x + (bw - 6) / 2, y + bh / 2 + fs * 0.31, valid ? T.v : T.t, "middle");
|
|
92
|
+
return {rect: rect, validation: valid};
|
|
93
|
+
});
|
|
94
|
+
if (errors) rowLabel(g, ex, y + bh / 2 + fs * 0.31, fmt(errors[i]));
|
|
95
|
+
return {g: g, blocks: blocks};
|
|
96
|
+
});
|
|
97
|
+
this.finalLayer = base.el("g", {opacity: 0}, this.svg);
|
|
98
|
+
var bottom = top + d.k * rh, finalY = bottom + line;
|
|
99
|
+
if (errors){
|
|
100
|
+
base.el("line", {x1: ex, x2: W - 8, y1: bottom + 6, y2: bottom + 6, stroke: "var(--muted)", "stroke-width": 2}, this.finalLayer);
|
|
101
|
+
this.label(this.finalLayer, ex, finalY, T.mean + " " + fmt(mean));
|
|
102
|
+
}
|
|
103
|
+
if (H < minHeight) ctx.report("size", "[folds] k = " + d.k + " needs at least " + minHeight + " px height (header " + top.toFixed(1) + " + " + d.k + " × " + minRow + " rows + " + (footer + 4).toFixed(1) + " footer); element has " + H + " px");
|
|
104
|
+
}
|
|
105
|
+
render(k, t){
|
|
106
|
+
if (this.sm) return this.renderSamples(k, t);
|
|
107
|
+
if (!this.model) return;
|
|
108
|
+
var dur = this.props.dur, phase = function(step){ return k > step ? 1 : k < step ? 0 : base.prog(t, 0, dur); };
|
|
109
|
+
set(this.header, "opacity", phase(1));
|
|
110
|
+
this.rows.forEach(function(o, i){ set(o.g, "opacity", phase(i + 1)); });
|
|
111
|
+
set(this.finalLayer, "opacity", phase(this.model.k + 1));
|
|
112
|
+
}
|
|
113
|
+
// 標本のモード(2.1.0):列が標本、行が分割。データの確かめと描き方。クラスの色は --emph(検証の枠)と同じ色にならないよう
|
|
114
|
+
// --series-2 を飛ばす(1 つの意味に 1 つの色)。m-classify2d の CLASS_COLORS と同じ並び
|
|
115
|
+
mountSamples(ctx){
|
|
116
|
+
var self = this, d = this.data, T = this.T, sp = d.splits, kind = d.splitter || "";
|
|
117
|
+
var n = d.samples ? d.samples.length : 1 + Math.max.apply(null, [].concat.apply([], sp.map(function(s){ return s.test.concat(s.train || []); })).concat([0]));
|
|
118
|
+
var samples = d.samples || Array.from({length: n}, function(){ return {}; }), bad = [];
|
|
119
|
+
if (n < 2 || n > 60) bad.push("splits cover " + n + " samples; 2–60 can be drawn");
|
|
120
|
+
var cls = {}; (d.classes || []).forEach(function(c, i){ cls[c.id] = i; });
|
|
121
|
+
samples.forEach(function(s, i){ if (s.class !== undefined && !(s.class in cls)) bad.push("samples[" + i + "].class " + s.class + " is not in classes"); });
|
|
122
|
+
var role = sp.map(function(s, r){
|
|
123
|
+
var a = Array(n).fill(0), testSet = {};
|
|
124
|
+
s.test.forEach(function(i){ if (!(i >= 0 && i < n)) bad.push("splits[" + r + "].test has " + i + " (samples 0–" + (n - 1) + ")"); else { a[i] = 2; testSet[i] = 1; } });
|
|
125
|
+
(s.train || Array.from({length: n}, function(_, i){ return i; }).filter(function(i){ return !testSet[i]; })).forEach(function(i){
|
|
126
|
+
if (!(i >= 0 && i < n)) bad.push("splits[" + r + "].train has " + i); else if (testSet[i]) bad.push("splits[" + r + "]: sample " + i + " is in both train and test"); else a[i] = 1;
|
|
127
|
+
});
|
|
128
|
+
return a;
|
|
129
|
+
});
|
|
130
|
+
// 分け方の決まり:KFold の仲間は、どの標本もちょうど 1 回だけ検証に入る
|
|
131
|
+
var kfold = !kind || kind === "KFold" || kind === "StratifiedKFold" || kind === "GroupKFold";
|
|
132
|
+
if (kfold){
|
|
133
|
+
for (var i = 0; i < n; i++){ var c = role.filter(function(a){ return a[i] === 2; }).length; if (c !== 1){ bad.push("sample " + i + " is in the test set of " + c + " splits; " + (kind || "KFold") + " uses each sample once (set splitter for TimeSeriesSplit, ShuffleSplit or holdout)"); break; } }
|
|
134
|
+
}
|
|
135
|
+
if (kind === "GroupKFold") role.forEach(function(a, r){ var tr = {}, te = {}; a.forEach(function(v, i){ var g = samples[i].group; if (v === 1) tr[g] = 1; if (v === 2) te[g] = 1; }); Object.keys(te).forEach(function(g){ if (tr[g]) bad.push("splits[" + r + "]: group \"" + g + "\" is in both train and test (GroupKFold keeps a group together)"); }); });
|
|
136
|
+
if (kind === "TimeSeriesSplit") role.forEach(function(a, r){ var lastTrain = a.lastIndexOf(1), firstTest = a.indexOf(2); if (lastTrain > firstTest && firstTest >= 0) bad.push("splits[" + r + "]: a train sample comes after a test sample (TimeSeriesSplit trains on the past)"); });
|
|
137
|
+
if (kind === "holdout" && sp.length !== 1) bad.push("holdout has one split; got " + sp.length);
|
|
138
|
+
if (kind === "StratifiedKFold") role.forEach(function(a, r){
|
|
139
|
+
// クラスの比率を保つ:検証に入る各クラスの数が、全体の数 ÷ 分割数から 1 未満しかずれない
|
|
140
|
+
Object.keys(cls).forEach(function(c){ var tot = samples.filter(function(s){ return String(s.class) === c; }).length, got = a.filter(function(v, i){ return v === 2 && String(samples[i].class) === c; }).length; if (Math.abs(got - tot / sp.length) >= 1) bad.push("splits[" + r + "]: class " + c + " has " + got + " test samples; StratifiedKFold keeps about " + +(tot / sp.length).toFixed(2)); });
|
|
141
|
+
});
|
|
142
|
+
if (d.errors && (d.errors.length !== sp.length || d.errors.some(function(v){ return v < 0; }))) bad.push("errors must contain one non-negative number per split");
|
|
143
|
+
bad.forEach(function(s){ ctx.report("data", "[folds] " + s); });
|
|
144
|
+
if (bad.length && bad.some(function(s){ return /samples 0–|2–60|errors must/.test(s); })) return;
|
|
145
|
+
var errors = d.errors && d.errors.length === sp.length ? d.errors : null, mean = errors ? errors.reduce(function(s, v){ return s + v / errors.length; }, 0) : null;
|
|
146
|
+
this.sm = {n: n, role: role, errors: errors, mean: mean};
|
|
147
|
+
var used = role.some(function(a){ return a.indexOf(0) >= 0; });
|
|
148
|
+
if (!this.getAttribute("aria-label")) this.setAttribute("aria-label", (kind ? kind + ": " : "") + role.map(function(a, r){ return T.fold + " " + (r + 1) + ": " + T.test + " " + a.map(function(v, i){ return v === 2 ? i + 1 : null; }).filter(Boolean).join(", ") + (errors ? "; " + T.error + " " + fmt(errors[r]) : ""); }).join("; ") + (errors ? "; " + T.mean + " " + fmt(mean) : ""));
|
|
149
|
+
var W = Math.max(1, this.clientWidth), H = Math.max(1, this.clientHeight), fs = this.fs, line = Math.ceil(fs * 1.45 + 4);
|
|
150
|
+
var width = function(s){ return base.textWidth(s, fs, {font: self}); };
|
|
151
|
+
var hasCls = samples.some(function(s){ return s.class !== undefined; }), hasGrp = samples.some(function(s){ return s.group !== undefined; }), hasT = samples.some(function(s){ return s.t !== undefined; });
|
|
152
|
+
var errorWidth = errors ? Math.max(width(T.error), width(T.mean + " " + fmt(mean)), width("0.00")) + 8 : 0;
|
|
153
|
+
var stripLab = Math.max(hasCls ? width(T.cls) : 0, hasGrp ? width(T.group) : 0, width(String(sp.length))) + 16;
|
|
154
|
+
var left = Math.max(42, stripLab), ex = W - errorWidth - 8, right = errors ? ex - 20 : W - 8, cw = (right - left) / n;
|
|
155
|
+
var strips = (hasCls ? 1 : 0) + (hasGrp ? 1 : 0) + (hasT ? 1 : 0), top = line + 8 + strips * line;
|
|
156
|
+
var footer = errors ? line + 8 : 4, rh = Math.max(28, Math.min(Math.ceil(fs * 2.6), (H - top - footer) / sp.length)), bh = rh - 6;
|
|
157
|
+
if (cw < 6) ctx.report("size", "[folds] " + n + " samples have " + cw.toFixed(1) + " px each; allow at least 6 px per sample (a wider element or fewer samples)");
|
|
158
|
+
if (H < top + sp.length * 28 + footer) ctx.report("size", "[folds] " + sp.length + " splits need at least " + Math.ceil(top + sp.length * 28 + footer) + " px height; element has " + H + " px");
|
|
159
|
+
this.geometry = {cell: cw, row: rh, top: top};
|
|
160
|
+
var svg = this.svg = base.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true"}, this);
|
|
161
|
+
var head = this.header = base.el("g", {opacity: 0}, svg);
|
|
162
|
+
// 凡例:学習・検証(・使わない)・クラスの名前(右へ並べる)
|
|
163
|
+
var x = 8, item = function(fill, stroke, text, dash){ base.el("rect", {x: x, y: 8, width: 28, height: fs * 1.2, fill: fill, stroke: stroke || "none", "stroke-width": 3, "stroke-dasharray": dash ? "4 3" : null}, head); self.label(head, x + 36, fs + 4, text); x += 36 + width(text) + 24; };
|
|
164
|
+
item("var(--term-tint)", null, T.trainS); item("var(--emph-tint)", "var(--emph)", T.test);
|
|
165
|
+
if (used) item("var(--bg)", "var(--line)", T.unused, true);
|
|
166
|
+
(d.classes || []).forEach(function(c, i){ base.el("circle", {cx: x + 10, cy: 8 + fs * 0.6, r: 9, fill: PAL[i]}, head); self.label(head, x + 26, fs + 4, c.label || String(c.id)); x += 26 + width(c.label || String(c.id)) + 24; });
|
|
167
|
+
if (x > W) ctx.report("size", "[folds] the legend needs " + Math.ceil(x) + " px width; element has " + W + " px");
|
|
168
|
+
var sy = line + 8;
|
|
169
|
+
if (hasCls){
|
|
170
|
+
self.label(head, left - 12, sy + fs * 0.85, T.cls, "end");
|
|
171
|
+
samples.forEach(function(s, i){ if (s.class !== undefined) base.el("rect", {x: left + i * cw + 1, y: sy + 4, width: Math.max(1, cw - 2), height: line - 12, fill: PAL[cls[s.class] || 0]}, head); });
|
|
172
|
+
sy += line;
|
|
173
|
+
}
|
|
174
|
+
if (hasGrp){
|
|
175
|
+
self.label(head, left - 12, sy + fs * 0.85, T.group, "end");
|
|
176
|
+
// 同じグループの続き:枠で囲み、入れば名前
|
|
177
|
+
var i0 = 0;
|
|
178
|
+
for (var i = 1; i <= n; i++) if (i === n || samples[i].group !== samples[i0].group){
|
|
179
|
+
base.el("rect", {x: left + i0 * cw + 1, y: sy + 4, width: Math.max(1, (i - i0) * cw - 2), height: line - 12, fill: "none", stroke: "var(--muted)", "stroke-width": 2, rx: 4}, head);
|
|
180
|
+
var gname = samples[i0].group === undefined ? "" : String(samples[i0].group);
|
|
181
|
+
if (gname && width(gname) <= (i - i0) * cw - 8) self.label(head, left + (i0 + (i - i0) / 2) * cw, sy + fs * 0.85, gname, "middle");
|
|
182
|
+
i0 = i;
|
|
183
|
+
}
|
|
184
|
+
sy += line;
|
|
185
|
+
}
|
|
186
|
+
if (hasT){
|
|
187
|
+
self.label(head, left, sy + fs * 0.85, String(samples[0].t !== undefined ? samples[0].t : ""));
|
|
188
|
+
var tEnd = String(samples[n - 1].t !== undefined ? samples[n - 1].t : "");
|
|
189
|
+
self.label(head, right, sy + fs * 0.85, tEnd, "end");
|
|
190
|
+
var mid = left + (right - left) / 2, tw0 = width(T.time);
|
|
191
|
+
if (width(String(samples[0].t)) + width(tEnd) + tw0 + 48 <= right - left) self.label(head, mid, sy + fs * 0.85, T.time, "middle");
|
|
192
|
+
}
|
|
193
|
+
if (errors) this.label(head, ex, top - 8, T.error);
|
|
194
|
+
this.rows = role.map(function(a, r){
|
|
195
|
+
var g = base.el("g", {opacity: 0}, svg), y = top + r * rh;
|
|
196
|
+
self.label(g, left - 12, y + bh / 2 + fs * 0.31, String(r + 1), "end");
|
|
197
|
+
a.forEach(function(v, i){
|
|
198
|
+
base.el("rect", {x: left + i * cw + 1, y: y, width: Math.max(1, cw - 2), height: bh, rx: Math.min(3, cw / 4), fill: v === 2 ? "var(--emph-tint)" : v === 1 ? "var(--term-tint)" : "var(--bg)", stroke: v === 2 ? "var(--emph)" : v === 0 ? "var(--line)" : "none", "stroke-width": v === 2 ? 2.5 : 1.5, "stroke-dasharray": v === 0 ? "4 3" : null}, g);
|
|
199
|
+
});
|
|
200
|
+
if (errors) self.label(g, ex, y + bh / 2 + fs * 0.31, fmt(errors[r]));
|
|
201
|
+
return {g: g};
|
|
202
|
+
});
|
|
203
|
+
this.finalLayer = base.el("g", {opacity: 0}, svg);
|
|
204
|
+
if (errors){ var bottom = top + sp.length * rh; base.el("line", {x1: ex, x2: W - 8, y1: bottom + 2, y2: bottom + 2, stroke: "var(--muted)", "stroke-width": 2}, this.finalLayer); this.label(this.finalLayer, ex, bottom + line - 4, T.mean + " " + fmt(mean)); }
|
|
205
|
+
}
|
|
206
|
+
renderSamples(k, t){
|
|
207
|
+
var dur = this.props.dur, n = this.sm.role.length, phase = function(step){ return k > step ? 1 : k < step ? 0 : base.prog(t, 0, dur); };
|
|
208
|
+
set(this.header, "opacity", phase(1));
|
|
209
|
+
this.rows.forEach(function(o, i){ set(o.g, "opacity", phase(i + 1)); });
|
|
210
|
+
set(this.finalLayer, "opacity", phase(n + 1));
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: KPI cards by step; count-up, change arrow, note
|
|
3
|
+
steps: largest card step (default 1 card = 1 step)
|
|
4
|
+
props:
|
|
5
|
+
cols: cards per row (0 = count, ≤ 4)
|
|
6
|
+
digits: decimals (card wins)
|
|
7
|
+
per-step: cards per step (0 = all)
|
|
8
|
+
dur: count seconds
|
|
9
|
+
stagger: card offset (s)
|
|
10
|
+
count: count up
|
|
11
|
+
size: number px (0 = auto)
|
|
12
|
+
example: {"cards": [{"label": "Drafting time", "value": 62, "unit": "%", "prefix": "−", "delta": {"dir": "down", "text": "8 pt vs last", "good": true}}]}
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
Child JSON: `{"cards": [{"label", "value", "digits", "unit", "prefix", "from", "tone", "delta", "note", "step", "at"}, …]}`.
|
|
16
|
+
|
|
17
|
+
- `label`: above. `value` (`digits`, commas). `unit`: after. `prefix`: before (`+`, `~`). Negative `value` has its own −: no `prefix` `−` (−−12); `prefix: "−"` only with a positive decrease
|
|
18
|
+
- `from`: count start (default 0; may count down)
|
|
19
|
+
- `tone`: number, top band (`term`, `emph`, `accent2`, `series-1..4`)
|
|
20
|
+
- `delta`: `{"dir": "up" | "down", "text": "+4", "good": true}`: ▲/▼ + text; good (default `up`) `--term`, bad `--emph`
|
|
21
|
+
- `note`: bottom line
|
|
22
|
+
<!-- llm: omit -->
|
|
23
|
+
- Count-up eases out; depends on (k, t) only (t = Infinity = final). `count="false"`: no counting
|
|
24
|
+
<!-- llm: end -->
|
|
25
|
+
- `variant`: `count` (default), `rise`, `flip`, `underline`; `count="false"` → `rise`
|
|
26
|
+
- `cues(k)`: start times of 2nd+ cards in a step (for `{cue}`)
|
|
27
|
+
|
|
28
|
+
The demo is `demo.html`. All numbers are fictional.
|
|
29
|
+
|
|
30
|
+
<!-- llm: omit -->
|
|
31
|
+
Notes
|
|
32
|
+
|
|
33
|
+
- `rise`: final value grows in; `flip`: digits flip from the right. Cards wrap past `cols`
|
|
34
|
+
- Number and unit width estimated from characters and centred; the right edge stays put while counting; may be off by a few characters
|
|
35
|
+
<!-- llm: end -->
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// m-kpi:大きな数字の札(KPI)を段階ごとに出す。数字は 0(か from)から数え上げ、下に増減の矢印と一言
|
|
2
|
+
// <m-kpi style="height:300px"><script type="application/json">
|
|
3
|
+
// {"cards": [{"label": "作成時間", "value": 62, "unit": "%", "prefix": "−", "delta": {"dir": "down", "text": "前の版から 8 pt", "good": true}, "note": "1 本あたり"}]}
|
|
4
|
+
// (JSON の終わり)</m-kpi>
|
|
5
|
+
// 段階:既定は札 1 枚 = 1 段階(per-step で n 枚ずつ、札の step で直接、at で段階の中の開始秒)
|
|
6
|
+
// 数え上げは (k, t) だけで決まる(初めに速く、終わりにゆっくり。t = Infinity なら最後の値)。count="false" で数えずに出す
|
|
7
|
+
// 札の幅は cols(既定は札の数、4 まで)で決める。数字と単位の幅は字数から見積もって中央にそろえる(字の読み込みを待たない)
|
|
8
|
+
// 見せ方(docs/conventions.md §1):count(数え上げ、既定)・rise(最後の値のまま少し小さい大きさから戻る)・flip(右の桁から 1 桁ずつ
|
|
9
|
+
// めくれて止まる)・underline(出たあと数字の下に線を引く)。段階の数・長さ・合図・最後の中身はどれも同じ
|
|
10
|
+
// 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・mtext・prog・lerp・clamp・variant・previewOpacity を使い、プレイヤーのグローバルは使わない
|
|
11
|
+
egatariParts.define({name: "kpi", version: "2.0.4", requires: {base: "1.2.0"}, element: "m-kpi"}, function(deps){
|
|
12
|
+
"use strict";
|
|
13
|
+
var base = deps.base;
|
|
14
|
+
return class extends base.MotionElement {
|
|
15
|
+
static partName = "kpi"; // the registry name (define meta name), for report prefixes
|
|
16
|
+
static variants = ["count", "rise", "flip", "underline"];
|
|
17
|
+
// データの形(kit/shape.js)
|
|
18
|
+
static shape = {
|
|
19
|
+
schema: {type: "object", additionalProperties: false, required: ["cards"], properties: {
|
|
20
|
+
cards: {type: "array", minItems: 1, items: {type: "object", required: ["value"], properties: {
|
|
21
|
+
label: {type: "string"}, value: {type: "number"}, digits: {type: "integer"}, unit: {type: "string"}, prefix: {type: "string"}, from: {type: "number"}, tone: {type: "string"},
|
|
22
|
+
delta: {type: "object", properties: {dir: {enum: ["up", "down"]}, text: {type: "string"}, good: {type: "boolean"}}}, note: {type: "string"}, step: {type: "integer"}, at: {type: "number"}}}}}},
|
|
23
|
+
example: {cards: [{label: "作成時間", value: 62, unit: "%", prefix: "−", delta: {dir: "down", text: "前の版から 8 pt", good: true}}]},
|
|
24
|
+
};
|
|
25
|
+
static props = {
|
|
26
|
+
cols: {type: "number", default: 0, doc: "1 行の札の数(0 = 札の数、4 まで)"},
|
|
27
|
+
digits: {type: "number", default: 0, doc: "数字の小数桁(札の digits が優先)"},
|
|
28
|
+
"per-step": {type: "number", default: 1, doc: "1 ステップに出す札の数(0 = 全部をステップ 1 で)"},
|
|
29
|
+
dur: {type: "number", default: 1.2, doc: "数え上げの秒数"},
|
|
30
|
+
stagger: {type: "number", default: 0.3, doc: "同じステップの札の出だしのずれ(秒)"},
|
|
31
|
+
count: {type: "bool", default: true, doc: "数字を数え上げる"},
|
|
32
|
+
size: {type: "number", default: 0, doc: "数字の字の大きさ(px。0 = 札の高さから)"},
|
|
33
|
+
};
|
|
34
|
+
get steps(){
|
|
35
|
+
if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
|
|
36
|
+
var m = 0;
|
|
37
|
+
this.plan().forEach(function(o){ m = Math.max(m, o.step); });
|
|
38
|
+
return m;
|
|
39
|
+
}
|
|
40
|
+
plan(){
|
|
41
|
+
if (this._plan) return this._plan;
|
|
42
|
+
var P = this.props, per = P["per-step"], seen = {};
|
|
43
|
+
return (this._plan = ((this.data || {}).cards || []).map(function(c, i){
|
|
44
|
+
var step = c.step !== undefined ? c.step : per > 0 ? Math.floor(i / per) + 1 : 1;
|
|
45
|
+
var j = seen[step] = (seen[step] || 0) + 1;
|
|
46
|
+
return {c: c, step: step, at: c.at !== undefined ? c.at : +((j - 1) * P.stagger).toFixed(3)};
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
mount(ctx){
|
|
50
|
+
var P = this.props, D = base, self = this, pl = this.plan();
|
|
51
|
+
var vr = this.variant = base.variant(this);
|
|
52
|
+
// count="false"(数えない)が見せ方より強い:数える見せ方なら rise にする
|
|
53
|
+
if (!P.count && (vr === "count" || vr === "flip")){
|
|
54
|
+
console.info('[kpi] count="false", so the variant "' + vr + '" is shown as "rise"');
|
|
55
|
+
vr = this.variant = "rise";
|
|
56
|
+
}
|
|
57
|
+
this.style.display = "block"; this.style.position = "relative";
|
|
58
|
+
var W = this.clientWidth, H = this.clientHeight;
|
|
59
|
+
var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
|
|
60
|
+
// 読み上げ:最後の形(札ごとの名前・最後の値・増減・一言)を 1 文で。作者の aria-label があればそれを使う(上書きしない)
|
|
61
|
+
if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
|
|
62
|
+
this.setAttribute("role", "img");
|
|
63
|
+
if (!this._aria){
|
|
64
|
+
var ja = /^ja\b/i.test(ctx.lang || "ja");
|
|
65
|
+
this.setAttribute("aria-label", pl.map(function(o){
|
|
66
|
+
var c = o.c, dg = c.digits !== undefined ? c.digits : P.digits;
|
|
67
|
+
var more = [c.delta ? (c.delta.dir === "down" ? "↓ " : "↑ ") + (c.delta.text || "") : "", c.note || ""].filter(function(x){ return x.trim(); });
|
|
68
|
+
return (c.label ? c.label + " " : "") + (c.prefix || "") + self.fmt(c.value, dg) + (c.unit || "") + (more.length ? (ja ? "(" + more.join("、") + ")" : " (" + more.join(", ") + ")") : "");
|
|
69
|
+
}).join(ja ? "、" : "; "));
|
|
70
|
+
}
|
|
71
|
+
var n = pl.length || 1, cols = P.cols || Math.min(4, n), rows = Math.ceil(n / cols), gap = 28;
|
|
72
|
+
var cw = Math.max(0, (W - gap * (cols - 1)) / cols), ch = Math.max(0, (H - gap * (rows - 1)) / rows);
|
|
73
|
+
var size = P.size || Math.max(48, Math.min(84, ch * 0.3, cw * 0.24));
|
|
74
|
+
// 字の幅(base の textWidth:テーマの字で測った幅。mk:mtext で書く字で、*_^ は数えない)
|
|
75
|
+
var est = function(s, sz, mk){ return D.textWidth(s, sz, {font: self, mark: !!mk}); };
|
|
76
|
+
this.cards = pl.map(function(o, i){
|
|
77
|
+
var c = o.c, x = (i % cols) * (cw + gap), y = Math.floor(i / cols) * (ch + gap), cx = x + cw / 2;
|
|
78
|
+
var col = "var(--" + (/^(term|emph|accent2|series-[1-4])$/.test(c.tone || "") ? c.tone : "term") + ")";
|
|
79
|
+
var g = D.el("g", {opacity: 0}, svg);
|
|
80
|
+
D.el("rect", {x: x, y: y, width: cw, height: ch, rx: 12, fill: "var(--term-tint)"}, g);
|
|
81
|
+
D.el("rect", {x: x, y: y, width: cw, height: 7, rx: 3, fill: col}, g);
|
|
82
|
+
// 行の位置:名前・数字・増減・一言を札の高さに配る
|
|
83
|
+
var hasD = !!c.delta, hasN = !!c.note;
|
|
84
|
+
var yl = y + 26 + 26, yn = y + ch * (hasD || hasN ? 0.5 : 0.6) + size * 0.36;
|
|
85
|
+
D.mtext(g, cx, yl, c.label || "", {"text-anchor": "middle", "font-size": 26, "font-weight": 700});
|
|
86
|
+
var dg = c.digits !== undefined ? c.digits : P.digits, usz = Math.round(size * 0.46);
|
|
87
|
+
var finalS = (c.prefix || "") + self.fmt(c.value, dg);
|
|
88
|
+
var nw = est(finalS, size), uw = c.unit ? est(c.unit, usz) + 6 : 0, xr = cx - (nw + uw) / 2 + nw;
|
|
89
|
+
var gn = D.el("g", {}, g); // 数字と単位(rise はこれを拡大する)
|
|
90
|
+
var num = D.el("text", {x: xr.toFixed(1), y: yn.toFixed(1), "text-anchor": "end", "font-size": size, "font-weight": 700, fill: col, style: "font-variant-numeric:tabular-nums"}, gn);
|
|
91
|
+
if (c.unit){ var u = D.el("text", {x: (xr + 6).toFixed(1), y: yn.toFixed(1), "font-size": usz, "font-weight": 700, fill: col}, gn); u.textContent = c.unit; }
|
|
92
|
+
// flip:字ごとの tspan(桁だけがめくれる。y でなく dy で前の字との差を書く:y を書くと字の塊が分かれて右寄せが崩れる)
|
|
93
|
+
var digits = null;
|
|
94
|
+
if (vr === "flip"){
|
|
95
|
+
digits = [...finalS].map(function(ch){
|
|
96
|
+
var ts = D.el("tspan", {}, num); ts.textContent = ch;
|
|
97
|
+
return {ts: ts, d: /[0-9]/.test(ch) ? +ch : null};
|
|
98
|
+
});
|
|
99
|
+
var nd = digits.filter(function(o){ return o.d !== null; }).length, j = 0;
|
|
100
|
+
for (var q = digits.length - 1; q >= 0; q--) if (digits[q].d !== null) digits[q].j = j++, digits[q].n = nd;
|
|
101
|
+
}
|
|
102
|
+
var line = vr === "underline" ? D.el("line", {x1: (xr - nw).toFixed(1), x2: (xr - nw).toFixed(1), y1: (yn + size * 0.14).toFixed(1), y2: (yn + size * 0.14).toFixed(1), stroke: "var(--term)", "stroke-width": 5, "stroke-linecap": "round"}, g) : null;
|
|
103
|
+
var gd = null;
|
|
104
|
+
if (hasD){
|
|
105
|
+
// 増減:▲ / ▼ と一言。良い向き(good、既定は up)なら --term、悪い向きなら --emph
|
|
106
|
+
var up = c.delta.dir !== "down", good = c.delta.good !== undefined ? !!c.delta.good : up;
|
|
107
|
+
var dc = good ? "var(--term)" : "var(--emph)", yd = yn + Math.max(44, size * 0.62), tw = est(c.delta.text || "", 24, true) + 30;
|
|
108
|
+
gd = D.el("g", {opacity: 0}, g);
|
|
109
|
+
var tx = cx - tw / 2;
|
|
110
|
+
D.el("path", {d: up ? "M0,-9L9,7L-9,7Z" : "M0,9L9,-7L-9,-7Z", fill: dc, transform: "translate(" + (tx + 9).toFixed(1) + " " + (yd - 8).toFixed(1) + ")"}, gd);
|
|
111
|
+
D.mtext(gd, tx + 30, yd, c.delta.text || "", {"font-size": 24, fill: dc, "font-weight": 700});
|
|
112
|
+
}
|
|
113
|
+
var note = hasN ? D.mtext(g, cx, y + ch - 22, c.note, {"text-anchor": "middle", "font-size": 24, fill: "var(--muted)"}) : null;
|
|
114
|
+
return {o: o, g: g, gn: gn, num: num, gd: gd, dg: dg, from: c.from || 0, cx: cx, cy: y + ch / 2, xn: xr - nw / 2 + uw / 2, yn: yn, size: size, digits: digits, line: line, lx: xr - nw, lw: nw + uw};
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
fmt(v, dg){
|
|
118
|
+
var s = Math.abs(v).toFixed(dg).split("."), i = s[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
119
|
+
return (v < 0 ? "−" : "") + i + (s[1] ? "." + s[1] : "");
|
|
120
|
+
}
|
|
121
|
+
duration(k){
|
|
122
|
+
var P = this.props, d = 0;
|
|
123
|
+
this.plan().forEach(function(o){ if (o.step === k) d = Math.max(d, o.at + (P.count ? P.dur : 0.45) + (o.c.delta ? 0.4 : 0)); });
|
|
124
|
+
return d;
|
|
125
|
+
}
|
|
126
|
+
cues(k){
|
|
127
|
+
var c = [];
|
|
128
|
+
this.plan().forEach(function(o){ if (o.step === k && o.at > 0) c.push(o.at); });
|
|
129
|
+
return c.length ? c.sort(function(a, b){ return a - b; }) : null;
|
|
130
|
+
}
|
|
131
|
+
render(k, t, ctx){
|
|
132
|
+
var P = this.props, D = base, self = this;
|
|
133
|
+
// 先の段階を薄く見せる表示(授業の表示):後の段階の札を最後の値で、テーマの --preview-opacity の濃さに(動かさない)
|
|
134
|
+
var preview = !!ctx.preview, PV = preview ? base.previewOpacity(this) : 1;
|
|
135
|
+
this.cards.forEach(function(o){
|
|
136
|
+
var s = o.o.step, at = o.o.at, ahead = preview && s > k;
|
|
137
|
+
var tt = s < k || ahead ? Infinity : s > k ? -1 : t; // この札の段階の中の時刻(-1 = まだ)
|
|
138
|
+
var e = tt < 0 ? 0 : D.prog(tt, at, 0.45);
|
|
139
|
+
o.g.setAttribute("opacity", ahead ? PV.toFixed(3) : e.toFixed(3));
|
|
140
|
+
o.g.setAttribute("transform", "translate(0 " + ((1 - e) * 14).toFixed(2) + ")");
|
|
141
|
+
var vr = self.variant, span = P.count ? P.dur : 0.45;
|
|
142
|
+
if (vr === "count"){
|
|
143
|
+
// 数え上げ:ease-out(初めに速く)。t = Infinity なら最後の値
|
|
144
|
+
var c = tt < 0 ? 0 : tt === Infinity || !P.count ? 1 : D.clamp((tt - at) / P.dur);
|
|
145
|
+
var q = 1 - Math.pow(1 - c, 3), v = D.lerp(o.from, o.o.c.value, q);
|
|
146
|
+
o.num.textContent = (o.o.c.prefix || "") + self.fmt(c >= 1 ? o.o.c.value : v, o.dg);
|
|
147
|
+
} else if (vr === "rise"){
|
|
148
|
+
// 最後の値のまま、0.85 倍から元の大きさへ(札が現れるのと同じ 0.45 秒)
|
|
149
|
+
var s = 0.85 + 0.15 * (tt < 0 ? 0 : D.prog(tt, at, 0.45)), cx = o.xn, cy = o.yn - o.size * 0.35;
|
|
150
|
+
o.num.textContent = (o.o.c.prefix || "") + self.fmt(o.o.c.value, o.dg);
|
|
151
|
+
o.gn.setAttribute("transform", s >= 1 ? "" : "translate(" + cx.toFixed(1) + " " + cy.toFixed(1) + ") scale(" + s.toFixed(4) + ") translate(" + (-cx).toFixed(1) + " " + (-cy).toFixed(1) + ")");
|
|
152
|
+
} else if (vr === "flip"){
|
|
153
|
+
// 札が出たあと(0.45 秒)、右の桁から 1 桁ずつ 0 → 最後の数字へめくれて、上から定位置に止まる(段階の長さの中で終わる)
|
|
154
|
+
var t0 = at + 0.45, len = Math.max(0.1, span - 0.45), prev = 0;
|
|
155
|
+
o.digits.forEach(function(d){
|
|
156
|
+
var off = 0;
|
|
157
|
+
if (d.d !== null){
|
|
158
|
+
var w = len / (d.n + 1), st = t0 + d.j * w, e = tt < 0 ? 0 : tt === Infinity ? 1 : D.clamp((tt - st) / (2 * w));
|
|
159
|
+
var shown = e >= 1 ? d.d : Math.min(d.d, Math.floor(e * (d.d + 1))), frac = (e * (d.d + 1)) % 1;
|
|
160
|
+
d.ts.textContent = String(shown);
|
|
161
|
+
// めくれる桁は上から少し(字の 0.12)下りて止まる
|
|
162
|
+
off = e > 0 && e < 1 ? -(1 - D.prog(frac, 0, 1)) * o.size * 0.12 : 0;
|
|
163
|
+
}
|
|
164
|
+
d.ts.setAttribute("dy", (off - prev).toFixed(1));
|
|
165
|
+
prev = off;
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
// underline:最後の値で出て、数字の下に左から右へ線を引く
|
|
169
|
+
o.num.textContent = (o.o.c.prefix || "") + self.fmt(o.o.c.value, o.dg);
|
|
170
|
+
// 線は段階の長さの中で引き終える(count="false" なら段階は 0.45 秒なので、後半の半分で引く)
|
|
171
|
+
var u0 = Math.min(0.45, span * 0.5), u = tt < 0 ? 0 : D.prog(tt, at + u0, span - u0);
|
|
172
|
+
o.line.setAttribute("x2", (o.lx + o.lw * u).toFixed(1));
|
|
173
|
+
o.line.setAttribute("opacity", u > 0 ? 1 : 0);
|
|
174
|
+
}
|
|
175
|
+
if (o.gd) o.gd.setAttribute("opacity", (tt < 0 ? 0 : D.prog(tt, at + (P.count ? P.dur : 0.45) * 0.85, 0.4)).toFixed(3));
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
});
|