egatari 0.6.13 → 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.
Files changed (260) hide show
  1. package/CHANGELOG.md +60 -1
  2. package/README.ja.md +46 -46
  3. package/bin/egatari.mjs +6 -6
  4. package/components.lock.json +507 -153
  5. package/components2.lock.json +1710 -33
  6. package/kit/build.mjs +3 -1
  7. package/kit/check-messages.mjs +23 -8
  8. package/kit/check.mjs +27 -15
  9. package/kit/core/article-messages.mjs +4 -4
  10. package/kit/core/article-render.mjs +1 -1
  11. package/kit/core/article-text.mjs +3 -1
  12. package/kit/core/build-core.mjs +28 -6
  13. package/kit/core/check-parity.mjs +3 -1
  14. package/kit/core/check-rules.mjs +6 -4
  15. package/kit/core/colab-core.mjs +3 -3
  16. package/kit/core/comment-core.mjs +6 -0
  17. package/kit/core/image-size.mjs +35 -0
  18. package/kit/core/layout-scan.mjs +89 -2
  19. package/kit/core/llm-fix.mjs +39 -6
  20. package/kit/core/llm-pack-assemble.mjs +5 -2
  21. package/kit/core/llm-pack-data.mjs +269 -83
  22. package/kit/core/llm-pack.mjs +3 -3
  23. package/kit/core/new-deck.mjs +17 -3
  24. package/kit/core/part-labels.mjs +9 -3
  25. package/kit/core/parts2.mjs +1 -1
  26. package/kit/core/player.mjs +18 -0
  27. package/kit/core/portable.mjs +44 -4
  28. package/kit/core/purposes.mjs +6 -3
  29. package/kit/core/readable-parts.mjs +42 -0
  30. package/kit/core/themes-lock.mjs +1 -1
  31. package/kit/core/tier-a.mjs +14 -2
  32. package/kit/deck.js +49 -2
  33. package/kit/instruction-version.json +1 -1
  34. package/kit/live.js +6 -6
  35. package/kit/player.json +1 -1
  36. package/kit/player.lock.json +2 -2
  37. package/kit/presenter.js +3 -1
  38. package/kit/readable-parts.mjs +25 -0
  39. package/kit/tools.js +11 -4
  40. package/package.json +4 -2
  41. package/server/dev.mjs +7 -6
  42. package/server/editor-ui.js +9 -4
  43. package/server/hints.js +22 -2
  44. package/tts/yomi.yaml +1 -1
  45. package/vendor/components/CATALOG.md +21 -14
  46. package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/README.en.md +40 -0
  47. package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/index.js +408 -0
  48. package/vendor/components/sha256/0396a1895978803ae342b7f598f187b17ead47800e8f8317a5cb041111349813/index.js +278 -0
  49. package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/README.en.md +26 -0
  50. package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/index.js +322 -0
  51. package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/README.en.md +54 -0
  52. package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/index.js +470 -0
  53. package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/README.en.md +18 -0
  54. package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/index.js +279 -0
  55. package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/README.en.md +31 -0
  56. package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/index.js +267 -0
  57. package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/README.en.md +53 -0
  58. package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/index.js +171 -0
  59. package/vendor/components/sha256/1117758820dc561f41cf9d1cc0bab8cf3173cde7771ac10a12b94c96007c0f55/index.js +268 -0
  60. package/vendor/components/sha256/137017ad452afe209bdff81bc02ffae99c6b60a1c4aed2383515974f65511ff2/index.js +205 -0
  61. package/vendor/components/sha256/1a1471ba5f68e54304825a64e736afeda421e3763cdcbcdab2e45509562a0291/index.js +607 -0
  62. package/vendor/components/sha256/1b15fcc12b2fa43821e6299e87aae31aa69dbbc5a0d1b80088a5d7c5f8b8f7f5/index.js +429 -0
  63. package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/README.en.md +23 -0
  64. package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/index.js +147 -0
  65. package/vendor/components/sha256/21c099461befc0d382ddfe982f2a6cd8eeb6dd731252164ac619525e4bacdf0d/index.js +242 -0
  66. package/vendor/components/sha256/2352e0e22460f4a3c46dca6cef27cd9c63f161a411f1cf56c75c585e9124503c/index.js +315 -0
  67. package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/README.en.md +53 -0
  68. package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/index.js +171 -0
  69. package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/README.en.md +38 -0
  70. package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/index.js +414 -0
  71. package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/README.en.md +45 -0
  72. package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/index.js +211 -0
  73. package/vendor/components/sha256/2f111b900898579b3ec1611c2110db336a46d9133171a0cbb125ee37bd1f24f8/index.js +592 -0
  74. package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/README.en.md +45 -0
  75. package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/index.js +211 -0
  76. package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/README.en.md +20 -0
  77. package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/index.js +310 -0
  78. package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/README.en.md +35 -0
  79. package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/index.js +179 -0
  80. package/vendor/components/sha256/3af0b84b1799fc64ec74d6da9cbd343eccd89e8a11c81bfb444562c911284442/index.js +342 -0
  81. package/vendor/components/sha256/3c69bf3b3c6b9f76048fbc0839b3aa9699723570086d3d44bac799230ed6de5b/index.js +121 -0
  82. package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/README.en.md +37 -0
  83. package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/index.js +501 -0
  84. package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/README.en.md +38 -0
  85. package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/index.js +414 -0
  86. package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/README.en.md +30 -0
  87. package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/index.js +305 -0
  88. package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/README.en.md +31 -0
  89. package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/index.js +236 -0
  90. package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/README.en.md +21 -0
  91. package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/index.js +108 -0
  92. package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/README.en.md +28 -0
  93. package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/index.js +213 -0
  94. package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/README.en.md +35 -0
  95. package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/index.js +179 -0
  96. package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/README.en.md +53 -0
  97. package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/index.js +171 -0
  98. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ABCJS-ADAPTER.md +101 -0
  99. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/LICENSE-abcjs.txt +21 -0
  100. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/chords.json +89 -0
  101. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/doremi.json +261 -0
  102. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/extras.json +192 -0
  103. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/kaeru.json +521 -0
  104. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/rhythm.json +248 -0
  105. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ties.json +360 -0
  106. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/index.js +508 -0
  107. package/vendor/components/sha256/59996a56df462b36e24a928d4397c9308d9e39ad8224ebd19fb5c981608ef458/index.js +521 -0
  108. package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/README.en.md +30 -0
  109. package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/index.js +305 -0
  110. package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/README.en.md +30 -0
  111. package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/index.js +192 -0
  112. package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/README.en.md +20 -0
  113. package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/index.js +307 -0
  114. package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/README.en.md +24 -0
  115. package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/index.js +554 -0
  116. package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/README.en.md +25 -0
  117. package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/index.js +316 -0
  118. package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/README.en.md +18 -0
  119. package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/index.js +279 -0
  120. package/vendor/components/sha256/624acb997c4975ace65570b529b3ba00baa421c80ecb7fc80f392a64e8c573a7/index.js +107 -0
  121. package/vendor/components/sha256/62602488ee33dd4bdef8516de16da5ab27d7f7265d5041681beab80e08f1d482/index.js +97 -0
  122. package/vendor/components/sha256/67eaf344bddac79b74ed03fdcd70285c7b52b160e6c5ffbd6897848179aa5230/index.js +818 -0
  123. package/vendor/components/sha256/682c9c8871eccd19ff1264e0323a2e4c5798b0488b612ba0339c6fe85aab5914/index.js +926 -0
  124. package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/README.en.md +51 -0
  125. package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/index.js +230 -0
  126. package/vendor/components/sha256/72138936ed0b8fd3cb0214ae7ed250ae3f1f8b21ed6fd593544947774064ba0d/index.js +250 -0
  127. package/vendor/components/sha256/74c1a0f3ed1370c5003aa5770ee28cea2ce994d415680116a92fdbcd5854ba62/index.js +198 -0
  128. package/vendor/components/sha256/76125035eb153b98befa9c735bcd9fc4f99f774dc1d082fdae40acaadfe7d95b/index.js +818 -0
  129. package/vendor/components/sha256/7728cf7dde88a6688aba0ed70f23f7e21362a147beac09c1fa1a4b773e08e93b/index.js +354 -0
  130. package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/README.en.md +23 -0
  131. package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/index.js +289 -0
  132. package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/README.en.md +31 -0
  133. package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/index.js +236 -0
  134. package/vendor/components/sha256/7d50e50fbb6c5ec636b62509bd88ddaac1870e0522cf11bcc293ce924d48072d/index.js +312 -0
  135. package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/README.en.md +42 -0
  136. package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/index.js +549 -0
  137. package/vendor/components/sha256/87fc302c41b2bfeea88951ed689ec01b4dc79218c4bc69b310dc2228dfa2e153/index.js +926 -0
  138. package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/README.en.md +24 -0
  139. package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/index.js +103 -0
  140. package/vendor/components/sha256/89c8c16788e24df17920542ed6eb6557dea4a10e835de8fe839e439ccbba8014/index.js +69 -0
  141. package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/README.en.md +44 -0
  142. package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/index.js +304 -0
  143. package/vendor/components/sha256/8d9af78aef44ad2f98101c67d32473373d39725a09c923969aa621d5f5b124bb/index.js +121 -0
  144. package/vendor/components/sha256/8f861d71df72a82be86a3e63abf7d69bbab5aac6fa68be6e077c4e19c3519ed8/index.js +312 -0
  145. package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/README.en.md +54 -0
  146. package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/index.js +470 -0
  147. package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/README.en.md +24 -0
  148. package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/index.js +214 -0
  149. package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/README.en.md +33 -0
  150. package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/index.js +390 -0
  151. package/vendor/components/sha256/9289efef4a75afe011e54a17e34db08cfb16a450b2e0653e6a98525495cfba99/index.js +315 -0
  152. package/vendor/components/sha256/93256a923199ea51108cdb7491c3c96f376dbef15b64cbf1a1aa7cc5726b4970/index.js +429 -0
  153. package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/README.en.md +24 -0
  154. package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/index.js +550 -0
  155. package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/README.en.md +28 -0
  156. package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/index.js +213 -0
  157. package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/README.en.md +40 -0
  158. package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/index.js +348 -0
  159. package/vendor/components/sha256/97c074a5473618c65f4c23263f056870a0b7940e73475f2a1f32f68c08d8eb0f/index.js +198 -0
  160. package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/README.en.md +66 -0
  161. package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/index.js +984 -0
  162. package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/README.en.md +34 -0
  163. package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/index.js +244 -0
  164. package/vendor/components/sha256/a18b2b15d00c76462a43823b5c270c7ddd7c31794da9c236f74f20f80ec2ffdb/index.js +354 -0
  165. package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/README.en.md +32 -0
  166. package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/index.js +222 -0
  167. package/vendor/components/sha256/a979207c60fbd2a12cb557297eb0217eb098d660de684530a0f43d0d9c64e6ef/index.js +312 -0
  168. package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/README.en.md +34 -0
  169. package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/index.js +244 -0
  170. package/vendor/components/sha256/af7ed69b8969f6da14784b6e9d26e4dfd20147772ea172a99bd936a71be10fcd/index.js +278 -0
  171. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ABCJS-ADAPTER.md +101 -0
  172. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/LICENSE-abcjs.txt +21 -0
  173. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/chords.json +89 -0
  174. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/doremi.json +261 -0
  175. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/extras.json +192 -0
  176. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/kaeru.json +521 -0
  177. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/rhythm.json +248 -0
  178. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ties.json +360 -0
  179. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/index.js +508 -0
  180. package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/README.en.md +66 -0
  181. package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/index.js +990 -0
  182. package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/README.en.md +24 -0
  183. package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/index.js +550 -0
  184. package/vendor/components/sha256/b8096d7a60609520981273673761a110e40e3bdf52a7ab5548363b20e16f6e93/index.js +404 -0
  185. package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/README.en.md +32 -0
  186. package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/index.js +222 -0
  187. package/vendor/components/sha256/bd8e3893df02411deccc1d6d7b02292ca0d59dfeddfafcf99419430981572c82/index.js +351 -0
  188. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ABCJS-ADAPTER.md +101 -0
  189. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/LICENSE-abcjs.txt +21 -0
  190. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/chords.json +89 -0
  191. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/doremi.json +261 -0
  192. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/extras.json +192 -0
  193. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/kaeru.json +521 -0
  194. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/rhythm.json +248 -0
  195. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ties.json +360 -0
  196. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/index.js +508 -0
  197. package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/README.en.md +31 -0
  198. package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/index.js +267 -0
  199. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/LICENSE-strokesvg.txt +115 -0
  200. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/OFL.txt +93 -0
  201. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/index.js +749 -0
  202. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/strokes-CHANGES.md +20 -0
  203. package/vendor/components/sha256/c791e69e722f64146242f97acb29a341160d0c327cfe1d76307954d80e70db85/index.js +268 -0
  204. package/vendor/components/sha256/c8c0de41d603b61c6ec4dc1da5b50559e213dd1f3693ee5019df858016fd6daf/index.js +747 -0
  205. package/vendor/components/sha256/c99d4f2ab443484b9f462e405c72ea4794838b88f8823f27c606d12cbbedb996/index.js +404 -0
  206. package/vendor/components/sha256/cbde046e30c35db60259911a88e2ae0bedaf545e29b1da8b8ce13bc602a33c19/index.js +465 -0
  207. package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/README.en.md +51 -0
  208. package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/index.js +228 -0
  209. package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/README.en.md +35 -0
  210. package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/index.js +179 -0
  211. package/vendor/components/sha256/cf0985ffcd8e7cbe2175ddb9a4342b2a4aa3f322794188fc99af8789b494460d/index.js +521 -0
  212. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/LICENSE-strokesvg.txt +115 -0
  213. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/OFL.txt +93 -0
  214. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/index.js +749 -0
  215. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/strokes-CHANGES.md +20 -0
  216. package/vendor/components/sha256/d01dc7fd78d08dd720ed86b39d7877dc0913d72e914036088a86af2df2faee52/index.js +484 -0
  217. package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/README.en.md +24 -0
  218. package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/index.js +214 -0
  219. package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/README.en.md +31 -0
  220. package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/index.js +271 -0
  221. package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/README.en.md +25 -0
  222. package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/index.js +316 -0
  223. package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/README.en.md +23 -0
  224. package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/index.js +120 -0
  225. package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/README.en.md +40 -0
  226. package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/index.js +405 -0
  227. package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/README.en.md +66 -0
  228. package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/index.js +984 -0
  229. package/vendor/components/sha256/ddd4b9cbbc282cbb3117ff662e1a14ecdb3cc7c16072a574418ec6a6eecef4d8/index.js +107 -0
  230. package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/README.en.md +22 -0
  231. package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/index.js +145 -0
  232. package/vendor/components/sha256/e2da948daac7bfac158857877b5a6932dbd2369e73901abcef118c92dd20b725/index.js +747 -0
  233. package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/README.en.md +42 -0
  234. package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/index.js +268 -0
  235. package/vendor/components/sha256/e653a4da80f7761442dc5b504ea5b0700fd0acf1979beeff56122cfdb3d4654c/index.js +607 -0
  236. package/vendor/components/sha256/ea217c6821e931b2d8474bf56d38f2dcc89ec705fe1d276f313e1c7e8db2b98a/index.js +233 -0
  237. package/vendor/components/sha256/ea2e4e24838574f607879c7d05556281258c018331e4da3e6f3a5263173f2e99/index.js +75 -0
  238. package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/README.en.md +42 -0
  239. package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/index.js +549 -0
  240. package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/README.en.md +44 -0
  241. package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/index.js +203 -0
  242. package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/README.en.md +34 -0
  243. package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/index.js +244 -0
  244. package/vendor/components/sha256/fa1a09c10181456143d125d68dbbdcacde6bab2e4a2b3e573367103ce28ebf55/index.js +228 -0
  245. package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/README.en.md +51 -0
  246. package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/index.js +228 -0
  247. package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/README.en.md +23 -0
  248. package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/index.js +147 -0
  249. package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/README.en.md +20 -0
  250. package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/index.js +307 -0
  251. package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/README.en.md +26 -0
  252. package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/index.js +322 -0
  253. package/vendor/components-2/manifest-2.12.0.json +2348 -0
  254. package/vendor/components-2/manifest-2.13.0.json +2477 -0
  255. package/vendor/components-2/manifest-2.14.0.json +2460 -0
  256. package/vendor/components-2/manifest-2.14.1.json +2460 -0
  257. package/vendor/components-2/manifest-2.15.0.json +2460 -0
  258. package/vendor/egatari-spec/SOURCE.json +3 -3
  259. package/vendor/egatari-spec/schema/deck-meta.schema.json +15 -0
  260. package/vendor/egatari-spec/schema/egatari-metadata.schema.json +15 -0
@@ -0,0 +1,121 @@
1
+ // m-collect:並んだ札(回答など)が動いて縮み、少数の箱(要約)にまとまる
2
+ // <m-collect style="height:400px"><script type="application/json">
3
+ // {"chips":[{"label":"回答 1","to":[0,1]}, …], "targets":[{"label":"事後平均","tex":"\\mu_n"}, …], "cols":4}
4
+ // (JSON の終わり)</m-collect>
5
+ // 段階 1 で、札 i が targets[to] へ動く(to は番号か番号の配列。配列なら札の写しがそれぞれへ動く)。
6
+ // 箱は始めに点線の枠だけ出し、札が着いてから中身(label / tex / value)を出す
7
+ // 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・mtext・prog・lerp・previewOpacity を使い、プレイヤーのグローバルは使わない。
8
+ // 式(tex)は組み立てのときに KaTeX で描く(spec §6.2):build.fields の targets[].tex を作り手が描いて texHtml を足し、
9
+ // この部品は markup-reader で決まった要素と属性だけを読んで置く(再生のときに KaTeX は動かない)。描いた結果がなければ tex を字のまま出して知らせる
10
+ egatariParts.define({name: "collect", version: "2.0.5", requires: {base: "1.3.0", "markup-reader": "1.0.3"}, element: "m-collect"}, function(deps){
11
+ "use strict";
12
+ var base = deps.base, MR = deps["markup-reader"];
13
+ return class extends base.MotionElement {
14
+ static partName = "collect"; // the registry name (define meta name), for report prefixes
15
+ // 組み立てのときに描く欄(spec §6.2)。式の意味は字(tex)でも持つので、KaTeX の出力は HTML だけ
16
+ static build = {fields: {"targets[].tex": "katex"}, options: {katex: {output: "html"}}};
17
+ // データの形(kit/shape.js)
18
+ static shape = {
19
+ schema: {type: "object", additionalProperties: false, required: ["chips", "targets"], properties: {
20
+ chips: {type: "array", minItems: 1, items: {type: "object", required: ["to"], properties: {label: {type: "string"}, to: {type: ["integer", "array"], items: {type: "integer"}}}}},
21
+ targets: {type: "array", minItems: 1, items: {type: "object", properties: {label: {type: "string"}, tex: {type: "string"}, texHtml: {type: "string"}, value: {type: ["string", "number"]}, tone: {type: "string"}, x: {type: "number"}, y: {type: "number"}}}},
22
+ cols: {type: "integer"}, renderers: {type: "object"}}},
23
+ example: {chips: [{label: "表", to: 0}, {label: "裏", to: 1}], targets: [{label: "表の数"}, {label: "裏の数"}], cols: 2},
24
+ };
25
+ static steps = 1;
26
+ static props = {
27
+ move: {type: "number", default: 0.9, doc: "札 1 枚が動く秒数"},
28
+ stagger: {type: "number", default: 0.08, doc: "札ごとの出発のずれ(秒)"},
29
+ shrink: {type: "number", default: 0.35, doc: "着いたときの札の縮尺"},
30
+ "chip-w": {type: "number", default: 0, doc: "札の幅(0 なら列の数から決める)"},
31
+ "chip-h": {type: "number", default: 56, doc: "札の高さ"},
32
+ "box-w": {type: "number", default: 260, doc: "箱の幅"},
33
+ "box-h": {type: "number", default: 110, doc: "箱の高さ"},
34
+ };
35
+ mount(ctx){
36
+ var P = this.props, D = base, self = this, data = this.data || {chips: [], targets: []}, sk = MR.sink(this, ctx);
37
+ this.style.display = "block";
38
+ var W = this.clientWidth, H = this.clientHeight;
39
+ var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, style: "display:block;overflow:visible"}, this);
40
+ var tone = {term: ["var(--term)", "var(--term-tint)"], emph: ["var(--emph)", "var(--emph-tint)"], muted: ["var(--muted)", "var(--bg)"]};
41
+ // 札の並び:上の段に cols 列で並べる
42
+ var C = data.chips || [], n = C.length, cols = data.cols || n, rows = Math.ceil(n / cols), gap = 14;
43
+ var cw = P["chip-w"] || Math.max(0, Math.min(220, (W - gap * (cols - 1)) / cols)), ch = P["chip-h"];
44
+ var gx = (W - (cw * cols + gap * (cols - 1))) / 2;
45
+ // 箱の並び:下の段に等間隔(x, y を書けばその位置。中心の座標)
46
+ var T = data.targets || [], bw = P["box-w"], bh = P["box-h"];
47
+ // tex と label のある箱は label を箱の下に書くので、その分(36 px)だけ下の段を上げる(要素の下にはみ出さない)
48
+ var gR = D.el("g", {}, svg); // 残る札(箱より下に重ねる。札の段が箱にかかっても箱の字は隠れない)
49
+ var under = T.some(function(tg){ return tg.tex && tg.label && tg.y === undefined; }) ? 36 : 0;
50
+ this.targets = T.map(function(tg, j){
51
+ var cx = tg.x !== undefined ? tg.x : W * (j + 1) / (T.length + 1), cy = tg.y !== undefined ? tg.y : H - bh / 2 - 4 - under;
52
+ var c = tone[tg.tone || "emph"] || tone.emph;
53
+ var frame = D.el("rect", {x: cx - bw / 2, y: cy - bh / 2, width: bw, height: bh, rx: 12, fill: "none", stroke: "var(--line)", "stroke-width": 2, "stroke-dasharray": "8 6", opacity: 0}, svg);
54
+ var g = D.el("g", {opacity: 0}, svg);
55
+ D.el("rect", {x: cx - bw / 2, y: cy - bh / 2, width: bw, height: bh, rx: 12, fill: c[1], stroke: c[0], "stroke-width": 3}, g);
56
+ var hasV = tg.value !== undefined, ly = cy + (hasV ? -16 : 9);
57
+ if (tg.tex) MR.texFrame(g, cx, ly + 4, tg, "tex", {size: 30, anchor: "middle", color: c[0], w: bw, h: 50}, sk).firstChild.style.verticalAlign = "top";
58
+ else D.mtext(g, cx, ly, tg.label || "", {"text-anchor": "middle", "font-size": 28, "font-weight": 700, fill: c[0]});
59
+ if (hasV) D.mtext(g, cx, cy + 38, String(tg.value), {"text-anchor": "middle", "font-size": 24, fill: "var(--fg)"});
60
+ // 下に入らなければ(y を書いた箱)箱の上に
61
+ if (tg.tex && tg.label) D.mtext(g, cx, cy + bh / 2 + 32 + 4 <= H ? cy + bh / 2 + 32 : cy - bh / 2 - 10, tg.label, {"text-anchor": "middle", "font-size": 24, fill: "var(--muted)"});
62
+ return {frame: frame, g: g, cx: cx, cy: cy, col: c, last: 0};
63
+ });
64
+ // 札と、行き先ごとの写し。もとの札は元の場所に薄い枠で残る(動いた後も、何を集めたかが図に残る。印刷でも読める)
65
+ this.chips = []; this.rests = [];
66
+ var badTo = [];
67
+ C.forEach(function(cp, i){
68
+ var r = Math.floor(i / cols), q = i % cols;
69
+ var x = gx + q * (cw + gap) + cw / 2, y = 4 + ch / 2 + r * (ch + gap);
70
+ var to = Array.isArray(cp.to) ? cp.to : [cp.to === undefined ? 0 : cp.to];
71
+ var start = i * P.stagger;
72
+ to.forEach(function(j){ if (!self.targets[j]) badTo.push("chip " + i + " (" + JSON.stringify(cp.label || "") + "): to " + JSON.stringify(j)); });
73
+ if (to.some(function(j){ return self.targets[j]; })){
74
+ var rg = D.el("g", {transform: "translate(" + x.toFixed(2) + " " + y.toFixed(2) + ")", opacity: 0}, gR);
75
+ D.el("rect", {x: -cw / 2, y: -ch / 2, width: cw, height: ch, rx: 8, fill: "none", stroke: "var(--line)", "stroke-width": 2, "stroke-dasharray": "6 5"}, rg);
76
+ D.mtext(rg, 0, 9, cp.label || "", {"text-anchor": "middle", "font-size": 24, fill: "var(--muted)"});
77
+ self.rests.push({g: rg, start: start});
78
+ }
79
+ to.forEach(function(j){
80
+ var tg = self.targets[j]; if (!tg) return;
81
+ var c = tone[cp.tone || "term"] || tone.term;
82
+ var g = D.el("g", {}, svg);
83
+ D.el("rect", {x: -cw / 2, y: -ch / 2, width: cw, height: ch, rx: 8, fill: c[1], stroke: c[0], "stroke-width": 2}, g);
84
+ D.mtext(g, 0, 9, cp.label || "", {"text-anchor": "middle", "font-size": 24});
85
+ tg.last = Math.max(tg.last, start + P.move);
86
+ self.chips.push({g: g, x0: x, y0: y, x1: tg.cx, y1: tg.cy, start: start});
87
+ });
88
+ });
89
+ if (badTo.length) ctx.report("data", "[collect] " + badTo.join("; ") + ": not a target number 0–" + (T.length - 1) + " (the copy is not drawn)");
90
+ this.rows = rows;
91
+ sk.flush(); // what the formulas have to report, once per kind (spec §6.2)
92
+ }
93
+ duration(k){ var d = 0; this.targets.forEach(function(tg){ d = Math.max(d, tg.last + 0.3); }); return k >= 1 ? d : 0; }
94
+ render(k, t, ctx){
95
+ var P = this.props, D = base;
96
+ var T = k < 1 ? -Infinity : t; // 段階 0 は動く前
97
+ // 先の段階を薄く見せる表示(授業の表示):段階 0 では、まとめた後の箱をテーマの --preview-opacity の濃さで出す(札は動かさない)
98
+ var PV = 0;
99
+ if (k < 1 && ctx.preview) PV = base.previewOpacity(this);
100
+ var pr = function(start, dur){ return T === -Infinity ? 0 : D.prog(T, start, dur); };
101
+ this.chips.forEach(function(c){
102
+ var e = pr(c.start, P.move);
103
+ // 少し持ち上げてから落ちる弧(中点で上へ 40px)
104
+ var x = D.lerp(c.x0, c.x1, e), y = D.lerp(c.y0, c.y1, e) - Math.sin(Math.PI * e) * 40;
105
+ var s = D.lerp(1, P.shrink, e), op = e < 0.75 ? 1 : 1 - (e - 0.75) / 0.25;
106
+ c.g.setAttribute("transform", "translate(" + x.toFixed(2) + " " + y.toFixed(2) + ") scale(" + s.toFixed(4) + ")");
107
+ c.g.setAttribute("opacity", op.toFixed(3));
108
+ });
109
+ // 残る札:写しが出発したら現れる
110
+ this.rests.forEach(function(c){ c.g.setAttribute("opacity", Math.min(1, pr(c.start, P.move) * 4).toFixed(3)); });
111
+ this.targets.forEach(function(tg){
112
+ tg.frame.setAttribute("opacity", (pr(0, 0.3) * (1 - pr(tg.last - 0.1, 0.3))).toFixed(3));
113
+ var e = pr(tg.last - 0.15, 0.45);
114
+ if (PV){ e = 1; tg.g.setAttribute("opacity", PV.toFixed(3)); }
115
+ else tg.g.setAttribute("opacity", e.toFixed(3));
116
+ var s = D.lerp(0.9, 1, e);
117
+ tg.g.setAttribute("transform", "translate(" + tg.cx + " " + tg.cy + ") scale(" + s.toFixed(4) + ") translate(" + (-tg.cx) + " " + (-tg.cy) + ")");
118
+ });
119
+ }
120
+ };
121
+ });
@@ -0,0 +1,312 @@
1
+ // m-heatmap:値で塗ったセルの格子(混同行列・相関行列・注意の重みなど)。行を 1 段階ずつ、または全体を出し、強調するセルを 1 つずつ囲む
2
+ // <m-heatmap normalize="row" diag="on" xl="予測" yl="正解" style="height:430px">
3
+ // <script type="application/json">{"rows": ["ねこ", "いぬ", "うさぎ"], "cols": ["ねこ", "いぬ", "うさぎ"], "values": [[45, 3, 2], [6, 38, 6], [1, 4, 45]]}
4
+ // (JSON の終わり)</m-heatmap>
5
+ // 色(テーマの色だけ):scale="sequential"(既定)は var(--bg) から tone(var(--term))へ、scale="diverging" は center(既定 0)を地の色に、
6
+ // 上は tone・下は lowtone(var(--emph))へ。どれも color-mix(in oklab, …) で混ぜる。数字の色はセルごとに var(--fg) と var(--bg) の
7
+ // コントラストを計算して高い方(4.5:1 以上)。どちらも 4.5:1 に届かない明るさのセルは、届く所まで混ぜる割合を寄せる
8
+ // 段階:build="rows"(行を 1 つずつ。normalize="row" の既定)・"whole"(全体を 1 段階)・"cells"(全体、それから強調を 1 つずつ。highlight があるときの既定)
9
+ // 字は 24 px 以上:列の名前は長ければ縦に、それでも入らなければ k 個おきに出して知らせる。12×12 を超えるとセルの数字は自動で消える(知らせる)
10
+ // 見せ方(docs/conventions.md §1):fade(セルがフェード、既定)・sweep(同じ段階のセルが左上から順に)
11
+ // 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・prog・variant・previewOpacity と、計算は heatmap-core(1.x の
12
+ // static calc)を使い、プレイヤーのグローバルは使わない。書き方やデータの知らせ(1.x の console.warn)は mount で ctx.report に。
13
+ // 言語は ctx.lang(mount で読む)。凡例のグラデーションの id は heatmap-2-0-2-legend-<n>(1.x は m-heatmap-legend-<n>)
14
+ egatariParts.define({name: "heatmap", version: "2.1.2", requires: {base: "1.2.0", "heatmap-core": "1.0.0"}, element: "m-heatmap"}, function(deps){
15
+ "use strict";
16
+ var base = deps.base;
17
+ // ---- 計算(heatmap-core。tools/test-heatmap.mjs がブラウザなしで試す) ----
18
+ var CALC = deps["heatmap-core"];
19
+ // テーマの色を sRGB で読む(キャンバスに 1 点塗って読む。読めなければ null)。m-map-japan と同じ
20
+ function rgbOf(css){
21
+ try {
22
+ var cv = document.createElement("canvas"); cv.width = cv.height = 1;
23
+ var g = cv.getContext("2d", {willReadFrequently: true});
24
+ if (!g) return null;
25
+ g.fillStyle = "#010203"; g.fillStyle = css;
26
+ if (/^#010203$/i.test(g.fillStyle) && !/^#010203$/i.test(css)) return null;
27
+ g.fillRect(0, 0, 1, 1);
28
+ var d = g.getImageData(0, 0, 1, 1).data;
29
+ return [d[0], d[1], d[2]];
30
+ } catch (e) { return null; }
31
+ }
32
+ // 名前を幅 w(24 px の字で)に収める:入らなければ … で切る
33
+ function clip(s, w, C){
34
+ if (C.est(s, 24) <= w) return s;
35
+ var ch = [...s];
36
+ while (ch.length > 1 && C.est(ch.join("") + "…", 24) > w) ch.pop();
37
+ return ch.join("").replace(/\s+$/, "") + "…";
38
+ }
39
+ var ON = function(v){ return /^(on|true|yes)$/i.test(String(v || "").trim()); };
40
+ var TONES = ["term", "emph", "accent2"];
41
+ var ID = "heatmap-2-1-2-"; // name and version of this part, dots replaced (spec §6.1 Identifiers)
42
+ var SEQ = 0; // 凡例のグラデーションの id(ページの中で部品ごとに別。mount は 1 回だけ。このパーツだけの数え)
43
+ return class extends base.MotionElement {
44
+ static partName = "heatmap"; // the registry name (define meta name), for report prefixes
45
+ static variants = ["fade", "sweep"];
46
+ // データの形(kit/shape.js)
47
+ static shape = {
48
+ schema: {type: "object", additionalProperties: false, required: ["rows", "cols", "values"], properties: {
49
+ rows: {type: "array", minItems: 1, items: {type: "string"}},
50
+ cols: {type: "array", minItems: 1, items: {type: "string"}},
51
+ values: {type: "array", minItems: 1, items: {type: "array", minItems: 1, items: {type: "number"}}},
52
+ unit: {type: "string"}, digits: {type: "number"},
53
+ highlight: {type: "array", items: {type: "array", minItems: 2, maxItems: 3, items: {type: "number"}}}}},
54
+ example: {rows: ["ねこ", "いぬ"], cols: ["ねこ", "いぬ"], values: [[45, 5], [6, 44]]},
55
+ note: {en: "values[row][col], one row per label in rows and one number per label in cols; highlight [[row, col] or [row, col, step]] (0-based)",
56
+ ja: "values[行][列]。rows の名前ごとに 1 行、cols の名前ごとに 1 つの数。highlight は [[行, 列] か [行, 列, ステップ]](0 から数える)"},
57
+ };
58
+ static props = {
59
+ scale: {type: "string", default: "sequential", doc: "sequential か diverging(center を地の色に 2 色)"},
60
+ center: {type: "number", default: 0, doc: "diverging の真ん中の値"},
61
+ range: {type: "json", default: null, doc: "色の範囲 [最小, 最大]"},
62
+ tone: {type: "string", default: "term", doc: "濃い側の色:term・emph・accent2。書かなければテーマの色の階調(なければ term)"},
63
+ lowtone: {type: "string", default: "emph", doc: "diverging の center より下の色"},
64
+ normalize: {type: "string", default: "none", doc: "row:行ごとの割合(混同行列)"},
65
+ show: {type: "string", default: "percent", doc: "normalize=row の数字:percent・count・both"},
66
+ numbers: {type: "string", default: "auto", doc: "セルの数字:auto・on・off"},
67
+ diag: {type: "string", default: "off", doc: "on:対角を枠で強調"},
68
+ build: {type: "string", default: "", doc: "rows・whole・cells"},
69
+ rotate: {type: "string", default: "auto", doc: "列の名前:auto・0・90"},
70
+ xl: {type: "string", default: "", doc: "列の見出し"},
71
+ yl: {type: "string", default: "", doc: "行の見出し"},
72
+ unit: {type: "string", default: undefined, doc: "セルの数字の後ろに付ける単位(JSON の unit より先)"},
73
+ digits: {type: "number", default: undefined, doc: "セルの数字の小数桁(既定は値の桁、2 桁まで。割合は 0)"},
74
+ dur: {type: "number", default: 0.8, doc: "1 ステップの秒数"},
75
+ };
76
+ get steps(){
77
+ if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
78
+ return this.plan().steps;
79
+ }
80
+ // データと属性だけから決まること(mount の前にも steps が要る)
81
+ plan(){
82
+ if (this._plan) return this._plan;
83
+ var d = this.data || {}, P = this.props, notes = [], C = CALC;
84
+ var rows = (d.rows || []).map(String), cols = (d.cols || []).map(String), raw = (d.values || []).map(function(r){ return r.map(Number); });
85
+ if (raw.length !== rows.length) throw new Error("m-heatmap: values has " + raw.length + " rows but rows has " + rows.length + " labels");
86
+ raw.forEach(function(r, i){ if (r.length !== cols.length) throw new Error("m-heatmap: values row " + i + " has " + r.length + " numbers but cols has " + cols.length + " labels"); });
87
+ var norm = P.normalize === "row";
88
+ if (["none", "row"].indexOf(P.normalize) < 0) notes.push(["attr", '[heatmap] normalize="' + P.normalize + '" is not row (none is used)']);
89
+ var kind = P.scale === "diverging" ? "diverging" : "sequential";
90
+ if (["sequential", "diverging"].indexOf(P.scale) < 0) notes.push(["attr", '[heatmap] scale="' + P.scale + '" is not sequential or diverging (sequential is used)']);
91
+ var build = P.build || (norm ? "rows" : (d.highlight || []).length ? "cells" : "whole");
92
+ if (["rows", "whole", "cells"].indexOf(build) < 0){ notes.push(["attr", '[heatmap] build="' + build + '" is not rows, whole or cells (whole is used)']); build = "whole"; }
93
+ var hl = (d.highlight || []).filter(function(h){
94
+ var ok = h[0] >= 0 && h[0] < rows.length && h[1] >= 0 && h[1] < cols.length && h[0] === Math.round(h[0]) && h[1] === Math.round(h[1]);
95
+ if (!ok) notes.push(["data", "[heatmap] highlight [" + h.join(", ") + "] is outside the " + rows.length + "×" + cols.length + " grid (0-based; ignored)"]);
96
+ return ok;
97
+ });
98
+ var shown = norm ? C.normalizeRows(raw) : raw;
99
+ var show = norm ? P.show : "count";
100
+ if (norm && ["count", "percent", "both"].indexOf(show) < 0){ notes.push(["attr", '[heatmap] show="' + show + '" is not count, percent or both (percent is used)']); show = "percent"; }
101
+ if (norm && raw.some(function(r){ return !r.reduce(function(a, v){ return a + v; }, 0); })) notes.push(["data", "[heatmap] a row sums to 0; its proportions are drawn as 0"]);
102
+ // range:2 つの数 [最小, 最大]、最小 < 最大。そうでなければ知らせて、データの範囲に(同じ値は 0 で割り、逆は色が反転する)
103
+ var range = P.range;
104
+ if (range !== null && range !== undefined){
105
+ var okR = Array.isArray(range) && range.length === 2 && typeof range[0] === "number" && typeof range[1] === "number" && isFinite(range[0]) && isFinite(range[1]);
106
+ if (!okR || !(range[0] < range[1])){
107
+ notes.push(["attr", "[heatmap] range=" + JSON.stringify(range) + " is not [min, max] with min < max; the " + (norm ? "range 0 to 1" : "data's range") + " is used"]);
108
+ range = null;
109
+ }
110
+ }
111
+ var dom = C.domain(shown, kind, +P.center || 0, norm && !range ? [0, 1] : range);
112
+ var st = C.steps(rows.length, cols.length, build, hl);
113
+ var dec = function(v){ var m = String(v).match(/\.(\d+)$/); return m ? m[1].length : 0; };
114
+ var digits = P.digits !== undefined ? P.digits : d.digits !== undefined ? d.digits : Math.min(2, Math.max.apply(null, [0].concat([].concat.apply([], raw).map(dec))));
115
+ var unit = P.unit !== undefined ? P.unit : d.unit || "";
116
+ return (this._plan = {rows: rows, cols: cols, raw: raw, val: shown, norm: norm, kind: kind, build: build, show: show, dom: dom,
117
+ cell: st.cell, hl: st.hl, steps: st.steps, digits: digits, unit: unit, notes: notes});
118
+ }
119
+ fmt(v, dg){
120
+ var s = Math.abs(v).toFixed(dg), p = s.split("."), i = p[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
121
+ return (v < 0 && +s !== 0 ? "−" : "") + i + (p[1] ? "." + p[1] : "");
122
+ }
123
+ // 凡例の数:終わりの 0 を落とす
124
+ lfmt(v){
125
+ var pl = this.plan();
126
+ if (pl.norm) return Math.round(v * 100) + "%";
127
+ var s = this.fmt(v, pl.digits); if (s.indexOf(".") >= 0) s = s.replace(/0+$/, "").replace(/\.$/, "");
128
+ return s + pl.unit;
129
+ }
130
+ // セルの字(1 行か 2 行)
131
+ texts(r, c){
132
+ var pl = this.plan(), cnt = this.fmt(pl.raw[r][c], pl.digits) + pl.unit;
133
+ if (!pl.norm) return [cnt];
134
+ var pct = this.fmt(pl.val[r][c] * 100, this.props.digits !== undefined ? this.props.digits : 0) + "%";
135
+ return pl.show === "count" ? [cnt] : pl.show === "both" ? [cnt, pct] : [pct];
136
+ }
137
+ mount(ctx){
138
+ var P = this.props, D = base, C = CALC, self = this, pl = this.plan();
139
+ this.variant = base.variant(this);
140
+ // 書き方とデータの知らせ(plan が集めた [code, message])
141
+ // ctx.report with each code as a literal (lint checks them): plan's notes are attr or data
142
+ pl.notes.forEach(function(n){ var code = n[0], msg = n[1]; if (code === "attr") ctx.report("attr", msg); else ctx.report("data", msg); });
143
+ this.classList.add("plot"); this.style.display = "block";
144
+ var ja = this.ja = /^ja\b/i.test(ctx.lang), W = this.clientWidth, H = this.clientHeight, nr = pl.rows.length, nc = pl.cols.length;
145
+ // ---- 色:テーマの色を読み、セルごとに混ぜる割合と字の色を決める ----
146
+ var tone = TONES.indexOf(P.tone) >= 0 ? P.tone : "term", low = TONES.indexOf(P.lowtone) >= 0 ? P.lowtone : "emph";
147
+ if (TONES.indexOf(P.tone) < 0) ctx.report("attr", '[heatmap] tone="' + P.tone + '" is not term, emph or accent2 (term is used)');
148
+ if (TONES.indexOf(P.lowtone) < 0) ctx.report("attr", '[heatmap] lowtone="' + P.lowtone + '" is not term, emph or accent2 (emph is used)');
149
+ if (pl.kind === "diverging" && tone === low) ctx.report("attr", "[heatmap] tone and lowtone are the same colour; the two sides cannot be told apart");
150
+ var cs0 = getComputedStyle(this), get = function(v){ return rgbOf(cs0.getPropertyValue(v).trim()); };
151
+ var RGB = {bg: get("--bg"), fg: get("--fg"), term: get("--term"), emph: get("--emph"), accent2: get("--accent2")};
152
+ // 色の段階(spec §8.4 --ramp-1…5):sequential で tone を書いていないときだけ。tone を書けばその役割の色(段階は使わない)。
153
+ // diverging は役割の 2 色のまま。段階のないテーマでは、どの段も 2.6.2 までの色(old)に戻るので同じ色になる
154
+ var useRamp = pl.kind === "sequential" && !this.hasAttribute("tone");
155
+ var stops = useRamp ? D.rampStops(this) : null, SRGB = stops ? stops.map(rgbOf) : null;
156
+ if (SRGB && SRGB.some(function(c){ return !c; })) SRGB = null;
157
+ var oldFill = function(side, pc){ return pc <= 0 ? "var(--bg)" : pc >= 100 ? "var(--" + side + ")" : "color-mix(in oklab, var(--" + side + ") " + pc + "%, var(--bg))"; };
158
+ // 段階の色(解いた RGB):t の両隣の段を oklab で混ぜる(base.ramp と同じ割合)
159
+ var rampRGB = function(t){ var x = Math.max(0, Math.min(1, t)) * 4, k = Math.min(3, Math.floor(x + 1e-9)); return C.mix(SRGB[k], SRGB[k + 1], 1 - (x - k)); };
160
+ var paint = function(f){
161
+ var side = f < 0 ? low : tone, p = Math.abs(f), o;
162
+ if (useRamp && stops && SRGB && RGB.bg && RGB.fg){ o = C.pick(rampRGB(p), RGB.bg, RGB.fg, 1); o.p = p; }
163
+ else if (useRamp && stops) o = {p: p, text: p > 0.55 ? "bg" : "fg", halo: true}; // 段階の色が読めなければ、いつも縁を付ける
164
+ else if (RGB.bg && RGB.fg && RGB[side]) o = C.pick(RGB[side], RGB.bg, RGB.fg, p);
165
+ else o = {p: p, text: p > 0.55 ? "bg" : "fg", halo: true}; // テーマの色が読めなければ、いつも縁を付ける
166
+ var pc = Math.round(o.p * 10000) / 100, old = oldFill(side, pc);
167
+ return {fill: useRamp ? D.ramp(pc / 100, old) : old, text: "var(--" + o.text + ")",
168
+ halo: o.halo ? "var(--" + (o.text === "fg" ? "bg" : "fg") + ")" : null};
169
+ };
170
+ // ---- 配置 ----
171
+ var dm = pl.dom, legend = [this.lfmt(dm.hi), this.lfmt(dm.c), this.lfmt(dm.lo)];
172
+ var lay = function(cols){ return C.layout({W: W, H: H, rows: pl.rows, cols: cols, legend: legend, xl: P.xl, yl: P.yl, rotate: P.rotate}); };
173
+ var cols = pl.cols, L = lay(cols);
174
+ // 長い列の名前:core は名前の幅で列を k 個おきに間引く(数が多いのではないのに「多すぎる」と知らせる)。名前を … で切って
175
+ // どの列にも名前が出る幅を探す(セルがいちばん大きくなる幅のうち、いちばん長い名前)。切っても間引くなら(列の数が多い)元の名前のまま
176
+ if (L.kc > 1){
177
+ var colW0 = Math.max.apply(null, pl.cols.map(function(s){ return C.est(s, 24); })), tries = [];
178
+ for (var cap = colW0 * 0.9; cap >= 24 * 3; cap *= 0.9){
179
+ var cut = pl.cols.map(function(s){ return clip(s, cap, C); }), L2 = lay(cut);
180
+ if (L2.kc === 1) tries.push({L: L2, cols: cut});
181
+ }
182
+ var big = Math.max.apply(null, [0].concat(tries.map(function(o){ return o.L.cs; })));
183
+ var pick = tries.filter(function(o){ return o.L.cs >= big * 0.95; })[0];
184
+ if (pick){
185
+ L = pick.L; cols = pick.cols;
186
+ ctx.report("size", "[heatmap] the column labels are too long for the cells; they are cut with … (shorten them, or give the element more room)");
187
+ }
188
+ }
189
+ L.notes.forEach(function(n){ ctx.report("size", "[heatmap] " + n); });
190
+ var cs = L.cs, fs = L.fs;
191
+ // セルの数字:12×12 を超えたら自動で消す。24 px で入らなければ消す(both は割合だけに)
192
+ var mode = ["auto", "on", "off"].indexOf(P.numbers) >= 0 ? P.numbers : (ctx.report("attr", '[heatmap] numbers="' + P.numbers + '" is not auto, on or off (auto is used)'), "auto");
193
+ var nf = 0, lines = pl.show === "both" ? 2 : 1, all = [];
194
+ for (var r0 = 0; r0 < nr; r0++) for (var c0 = 0; c0 < nc; c0++) all = all.concat(this.texts(r0, c0));
195
+ if (mode === "auto" && (nr > 12 || nc > 12)){ mode = "off"; ctx.report("size", "[heatmap] " + nr + "×" + nc + " cells is more than 12×12; the numbers in the cells are turned off (numbers=\"on\" to keep them where they fit)"); }
196
+ if (mode !== "off"){
197
+ nf = C.numberSize(cs, all, lines);
198
+ if (!nf && lines === 2){
199
+ lines = 1; all = []; for (var r1 = 0; r1 < nr; r1++) for (var c1 = 0; c1 < nc; c1++) all.push(this.texts(r1, c1)[1]);
200
+ nf = C.numberSize(cs, all, 1);
201
+ if (nf) ctx.report("size", '[heatmap] the cells (' + Math.round(cs) + ' px) are too small for two lines at 24 px; show="both" shows the percentages only');
202
+ }
203
+ if (!nf) ctx.report("size", "[heatmap] the cells (" + Math.round(cs) + " px) are too small for numbers at 24 px; the numbers are turned off");
204
+ }
205
+ this.lines = lines;
206
+ var svg = D.el("svg", {width: W, height: H, viewBox: "0 0 " + W + " " + H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
207
+ var gGrid = D.el("g", {}, svg), gCell = D.el("g", {}, svg), gOut = D.el("g", {}, svg), gLab = D.el("g", {}, svg);
208
+ var X = function(c){ return L.gx + c * cs; }, Y = function(r){ return L.gy + r * cs; }, f1 = function(v){ return (+v).toFixed(1); };
209
+ var items = this.items = [], dur = P.dur, sweep = this.variant === "sweep";
210
+ // 空の格子(段階 0 から)
211
+ D.el("rect", {x: f1(L.gx), y: f1(L.gy), width: f1(L.gw), height: f1(L.gh), fill: "none", stroke: "var(--line)", "stroke-width": 1.5}, gGrid);
212
+ for (var i = 1; i < nc; i++) D.el("line", {x1: f1(X(i)), y1: f1(L.gy), x2: f1(X(i)), y2: f1(L.gy + L.gh), stroke: "var(--line)", "stroke-width": 1}, gGrid);
213
+ for (i = 1; i < nr; i++) D.el("line", {x1: f1(L.gx), y1: f1(Y(i)), x2: f1(L.gx + L.gw), y2: f1(Y(i)), stroke: "var(--line)", "stroke-width": 1}, gGrid);
214
+ // セル:段階ごとに、見せ方 sweep は左上から順に(同じ段階の中の順番)
215
+ var order = {}, gap = cs >= 16 ? 0.75 : 0; // セルの間の細い隙間(小さいセルでは網目に見えるので付けない)
216
+ for (var r = 0; r < nr; r++) for (var c = 0; c < nc; c++){
217
+ var k = pl.cell[r][c]; (order[k] = order[k] || []).push([r, c]);
218
+ }
219
+ Object.keys(order).forEach(function(k){ order[k].sort(function(a, b){ return (a[0] + a[1]) - (b[0] + b[1]) || a[0] - b[0]; }); });
220
+ for (r = 0; r < nr; r++) for (c = 0; c < nc; c++){
221
+ var st = pl.cell[r][c], pos = order[st].findIndex(function(o){ return o[0] === r && o[1] === c; }), n = order[st].length;
222
+ var pt = paint(C.frac(pl.val[r][c], pl.kind, pl.dom));
223
+ var g = D.el("g", {opacity: 0}, gCell);
224
+ D.el("rect", {x: f1(X(c) + gap), y: f1(Y(r) + gap), width: f1(Math.max(0, cs - 2 * gap)), height: f1(Math.max(0, cs - 2 * gap)), fill: pt.fill}, g);
225
+ if (nf){
226
+ var tx = this.texts(r, c); if (lines === 1 && tx.length === 2) tx = [tx[1]];
227
+ tx.forEach(function(s, j){
228
+ var y = Y(r) + cs / 2 + nf * 0.36 + (tx.length === 2 ? (j ? 0.62 : -0.62) * nf : 0);
229
+ var ta = {x: f1(X(c) + cs / 2), y: f1(y), "font-size": j ? Math.max(24, nf - 4) : nf, "text-anchor": "middle", fill: pt.text, "font-weight": j || tx.length === 1 ? 700 : 400, style: "font-variant-numeric:tabular-nums"};
230
+ // 縁(halo):セルの色に対してどちらの字の色も 4.5:1 に届かないとき、反対の色の 3 px の線を字の下に
231
+ if (pt.halo) Object.assign(ta, {stroke: pt.halo, "stroke-width": 3, "stroke-linejoin": "round", "paint-order": "stroke"});
232
+ D.el("text", ta, g).textContent = s;
233
+ });
234
+ }
235
+ var at = sweep && n > 1 ? dur * 0.6 * pos / (n - 1) : 0, len = sweep ? dur * 0.4 : dur;
236
+ items.push({el: g, st: st, at: at, len: len});
237
+ }
238
+ // 枠(対角は --fg、強調は --emph):地の色の太い線の上に色の線(濃いセルの上でも明るいセルの上でも見える)
239
+ var frame = function(r, c, col, st, at){
240
+ var g = D.el("g", {opacity: 0}, gOut), a = {x: f1(X(c) + 1), y: f1(Y(r) + 1), width: f1(Math.max(0, cs - 2)), height: f1(Math.max(0, cs - 2)), fill: "none"};
241
+ D.el("rect", Object.assign({stroke: "var(--bg)", "stroke-width": 8}, a), g);
242
+ D.el("rect", Object.assign({stroke: col, "stroke-width": 4}, a), g);
243
+ items.push({el: g, st: st, at: at, len: dur * 0.5});
244
+ };
245
+ if (ON(P.diag)) for (i = 0; i < Math.min(nr, nc); i++) frame(i, i, "var(--fg)", pl.cell[i][i], dur * 0.5);
246
+ else if (P.diag !== "off") ctx.report("attr", '[heatmap] diag="' + P.diag + '" is not on or off (off is used)');
247
+ pl.hl.forEach(function(h){ frame(h.r, h.c, "var(--emph)", h.st, h.st === pl.cell[h.r][h.c] ? dur * 0.5 : 0); });
248
+ // ---- 名前(段階 0 から) ----
249
+ var lab = function(x, y, s, a){ return D.el("text", Object.assign({x: f1(x), y: f1(y), "font-size": fs, fill: "var(--fg)"}, a || {}), gLab); };
250
+ C.shown(nr, L.kr).forEach(function(r){ lab(L.gx - 12, Y(r) + cs / 2 + fs * 0.36, pl.rows[r], {"text-anchor": "end"}).textContent = pl.rows[r]; });
251
+ C.shown(nc, L.kc).forEach(function(c){
252
+ var x = X(c) + cs / 2, t;
253
+ if (L.orient === "h") t = lab(x, L.gy - 10, "", {"text-anchor": "middle"});
254
+ else t = lab(x + fs * 0.36, L.gy - 10, "", {"text-anchor": "start", transform: "rotate(-90 " + f1(x + fs * 0.36) + " " + f1(L.gy - 10) + ")"});
255
+ t.textContent = cols[c];
256
+ });
257
+ if (P.xl){ var tl = lab(L.gx + L.gw / 2, L.gy - (L.top - (P.xl ? 40 : 0)) - 12, "", {"text-anchor": "middle", "font-weight": 700, "font-size": 26}); tl.textContent = P.xl; }
258
+ if (P.yl){ var yx = L.x0 + 26, yy = L.gy + L.gh / 2, ty = lab(yx, yy, "", {"text-anchor": "middle", "font-weight": 700, "font-size": 26, transform: "rotate(-90 " + f1(yx) + " " + f1(yy) + ")"}); ty.textContent = P.yl; }
259
+ // ---- 凡例の帯:上が最大、真ん中が center(sequential は真ん中の値)、下が最小 ----
260
+ var bx = L.gx + L.gw + 22, bh = L.gh, gid = ID + "legend-" + (++SEQ);
261
+ // 帯は混ぜる割合をそのまま(セルの字のために寄せた割合ではなく、尺度そのもの)
262
+ var grad = D.el("linearGradient", {id: gid, x1: 0, y1: 0, x2: 0, y2: 1}, D.el("defs", {}, svg));
263
+ for (i = 0; i <= 20; i++){
264
+ var f = C.frac(dm.hi - (dm.hi - dm.lo) * i / 20, pl.kind, dm), pc = Math.round(Math.abs(f) * 10000) / 100, side = f < 0 ? low : tone;
265
+ D.el("stop", {offset: (i / 20).toFixed(3), "stop-color": useRamp ? D.ramp(pc / 100, oldFill(side, pc)) : pc <= 0 ? "var(--bg)" : "color-mix(in oklab, var(--" + side + ") " + pc + "%, var(--bg))"}, grad);
266
+ }
267
+ D.el("rect", {x: f1(bx), y: f1(L.gy), width: 24, height: f1(bh), fill: "url(#" + gid + ")", stroke: "var(--line)", "stroke-width": 1.5}, gGrid);
268
+ var marks = bh >= 3 * 30 ? [[0, legend[0]], [0.5, legend[1]], [1, legend[2]]] : [[0, legend[0]], [1, legend[2]]];
269
+ marks.forEach(function(m){
270
+ var y = L.gy + bh * m[0];
271
+ D.el("line", {x1: f1(bx + 24), y1: f1(y), x2: f1(bx + 30), y2: f1(y), stroke: "var(--muted)", "stroke-width": 1.5}, gGrid);
272
+ lab(bx + 34, Math.max(L.gy + 20, Math.min(L.gy + bh - 2, y + 8)), "", {"font-size": 24, "text-anchor": "start"}).textContent = m[1];
273
+ });
274
+ // ---- 読める層(画面にも印刷にも出ない):値の表 ----
275
+ var wrap = document.createElement("div");
276
+ wrap.className = "sr-only";
277
+ wrap.setAttribute("style", "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0");
278
+ var tbl = document.createElement("table");
279
+ tbl.setAttribute("style", "font-size:24px");
280
+ var cap = document.createElement("caption"); cap.textContent = this.getAttribute("aria-label") || (P.xl || P.yl ? [P.yl, P.xl].filter(Boolean).join(ja ? " × " : " by ") : (ja ? "ヒートマップ" : "Heat map")); tbl.appendChild(cap);
281
+ var tr = document.createElement("tr"), th = document.createElement("th"); th.textContent = ja ? "行\列" : "row \\ column"; tr.appendChild(th);
282
+ pl.cols.forEach(function(s){ var x = document.createElement("th"); x.setAttribute("scope", "col"); x.textContent = s; tr.appendChild(x); });
283
+ tbl.appendChild(tr);
284
+ pl.rows.forEach(function(s, r){
285
+ var row = document.createElement("tr"), h = document.createElement("th"); h.setAttribute("scope", "row"); h.textContent = s; row.appendChild(h);
286
+ pl.cols.forEach(function(_, c){
287
+ var x = document.createElement("td"), t = self.texts(r, c);
288
+ var hit = pl.hl.some(function(o){ return o.r === r && o.c === c; });
289
+ x.textContent = (t.length === 2 ? t[0] + "(" + t[1] + ")" : t[0]) + (hit ? (ja ? "(強調)" : " (highlighted)") : "");
290
+ row.appendChild(x);
291
+ });
292
+ tbl.appendChild(row);
293
+ });
294
+ wrap.appendChild(tbl); this.appendChild(wrap);
295
+ if (!this.getAttribute("aria-label")) this.setAttribute("aria-label", (ja ? "ヒートマップ:" : "Heat map: ") + nr + " × " + nc);
296
+ }
297
+ duration(k){
298
+ var pl = this.plan();
299
+ if (k < 1) return 0;
300
+ var any = pl.cell.some(function(row){ return row.indexOf(k) >= 0; }) || pl.hl.some(function(h){ return h.st === k; });
301
+ return any ? this.props.dur : 0;
302
+ }
303
+ render(k, t, ctx){
304
+ var D = base, lecture = !!ctx.preview, FAINT = 0.45;
305
+ if (lecture) FAINT = base.previewOpacity(this); // 先の段階の薄さ:テーマの --preview-opacity(ないときは 0.45)
306
+ this.items.forEach(function(it){
307
+ var op = it.st < k ? 1 : it.st > k ? (lecture ? FAINT : 0) : D.prog(t, it.at, it.len);
308
+ it.el.setAttribute("opacity", op.toFixed(3));
309
+ });
310
+ }
311
+ };
312
+ });
@@ -0,0 +1,54 @@
1
+ ---
2
+ summary: Bars grow from 0 by step (vertical, horizontal, grouped, stacked); the axis max can widen by step
3
+ steps: max group/scale step (default 1 group = 1 step)
4
+ props:
5
+ orient: v or h
6
+ max: axis max (0 = auto)
7
+ unit: value unit
8
+ digits: decimals
9
+ per-step: groups per step (0 = all)
10
+ dur: grow seconds
11
+ stagger: group offset (s)
12
+ count: count values up
13
+ ticks: ticks and grid
14
+ zoom: scale-change seconds
15
+ al: axis title
16
+ stack: stack values; "percent" = 100 %
17
+ mark: bar or dot (a point with its error bar)
18
+ example: {"series": [{"label": "Sales"}], "groups": [{"label": "Year 1", "value": 1.2}, {"label": "Year 2", "value": 3.4}]}
19
+ ---
20
+
21
+ For quantities shown and compared one at a time: yearly sales, ranked answers, before/after.
22
+
23
+ Child JSON: `{"series": [...], "groups": [...], "scale": [...], "sig": [...]}`.
24
+
25
+ - group: `label` (`\n` = 2 lines), `value` or `values` (one per series), `step`, `at` (start s), `tone` (bar and value colour)
26
+ - err: ± number or `[low, high]`; per series for `values`
27
+ - sig: `[{"from": 0, "to": 2, "label": "**"}]` brackets groups 0 and 2 (`group`: series in a group); vertical, unstacked only
28
+ <!-- llm: omit -->
29
+ - Error bars and values appear once a bar is grown; values sit beyond the error bar's end. `mark="dot"` points appear without growing. Brackets stack from the shortest
30
+ <!-- llm: end -->
31
+ - series: `label` (2+ series: on the first group's bars; no legend), `tone` (default `--series-1..4`)
32
+ - scale: `[{"step": 3, "max": 27, "at": 0.4}]`: the max moves to `max` over `zoom` s; the old range stays as a faint band; taller bars stop at the top and grow as it widens
33
+ <!-- llm: omit -->
34
+ - Auto max: 1.12 × the largest value (before the first scale), rounded
35
+ <!-- llm: end -->
36
+ - `orient="h"`: names left, values right; `ticks="false"` for ranks
37
+ - `stack="true"` (`"percent"` = 100 %): a group's `values` in one bar; total at the end, values inside segments; values ≥ 0
38
+ <!-- llm: omit -->
39
+ - Values: `digits` decimals, thousands separators, `unit` appended
40
+ - Negatives (not stacked): the axis includes 0; bars grow down/left from a `--fg` baseline; values outside the bar end
41
+ - `stack="percent"`: axis 0–100 %, no `max`/`scale`, segment values in % when they fit, no total
42
+ - Show later steps faintly (`ctx.preview`): later bars fully grown at `--preview-opacity`; no axis change or over-max bar shown ahead
43
+ <!-- llm: end -->
44
+
45
+ The demo is `demo.html`. All numbers are fictional.
46
+
47
+ Notes
48
+
49
+ - Values appear once a bar is fully grown; `count="true"` counts them up
50
+ - Series names sit on the first group's bars: keep to 2–3 series
51
+
52
+ <!-- llm: omit -->
53
+ - `examples/tmlr2026-calibration` keeps its own deck-local `components/bars/`
54
+ <!-- llm: end -->