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.
Files changed (270) hide show
  1. package/CHANGELOG.md +62 -1
  2. package/README.ja.md +65 -64
  3. package/README.md +40 -39
  4. package/bin/egatari.mjs +3 -3
  5. package/components.lock.json +507 -153
  6. package/components2.lock.json +1710 -33
  7. package/kit/check-messages.mjs +105 -71
  8. package/kit/check.mjs +17 -11
  9. package/kit/core/article-messages.mjs +15 -15
  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 +23 -1
  13. package/kit/core/check-parity.mjs +2 -2
  14. package/kit/core/check-rules.mjs +12 -7
  15. package/kit/core/colab-core.mjs +2 -2
  16. package/kit/core/comment-core.mjs +6 -0
  17. package/kit/core/export-name.mjs +2 -2
  18. package/kit/core/geometry-check.mjs +363 -25
  19. package/kit/core/layout-scan.mjs +75 -5
  20. package/kit/core/live-policy.mjs +2 -2
  21. package/kit/core/live.mjs +2 -2
  22. package/kit/core/llm-fix.mjs +24 -13
  23. package/kit/core/llm-insert.mjs +11 -11
  24. package/kit/core/llm-outline.mjs +7 -7
  25. package/kit/core/llm-pack-assemble.mjs +5 -2
  26. package/kit/core/llm-pack-data.mjs +225 -39
  27. package/kit/core/llm-pack.mjs +3 -3
  28. package/kit/core/new-deck.mjs +17 -3
  29. package/kit/core/part-labels.mjs +6 -0
  30. package/kit/core/parts2.mjs +5 -5
  31. package/kit/core/player.mjs +18 -0
  32. package/kit/core/portable.mjs +26 -8
  33. package/kit/core/purposes.mjs +2 -2
  34. package/kit/core/ref-voice.mjs +1 -1
  35. package/kit/core/scorm.mjs +1 -1
  36. package/kit/core/sound-preferences.mjs +1 -1
  37. package/kit/core/theme-derive.mjs +209 -0
  38. package/kit/core/themes-list.mjs +1 -1
  39. package/kit/core/themes-lock.mjs +1 -1
  40. package/kit/core/tier-a.mjs +20 -8
  41. package/kit/deck.js +7 -4
  42. package/kit/instruction-version.json +1 -1
  43. package/kit/live.js +20 -20
  44. package/kit/player.json +1 -1
  45. package/kit/player.lock.json +2 -2
  46. package/kit/presenter.js +5 -3
  47. package/kit/templates/new-deck.mjs +6 -6
  48. package/kit/tools.js +13 -6
  49. package/kit/track.js +1 -1
  50. package/package.json +4 -2
  51. package/server/dev.mjs +3 -2
  52. package/server/editor-ui.js +28 -20
  53. package/server/hints.js +22 -2
  54. package/tts/yomi.yaml +8 -0
  55. package/vendor/components/CATALOG.md +21 -14
  56. package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/README.en.md +40 -0
  57. package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/index.js +408 -0
  58. package/vendor/components/sha256/0396a1895978803ae342b7f598f187b17ead47800e8f8317a5cb041111349813/index.js +278 -0
  59. package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/README.en.md +26 -0
  60. package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/index.js +322 -0
  61. package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/README.en.md +54 -0
  62. package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/index.js +470 -0
  63. package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/README.en.md +18 -0
  64. package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/index.js +279 -0
  65. package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/README.en.md +31 -0
  66. package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/index.js +267 -0
  67. package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/README.en.md +53 -0
  68. package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/index.js +171 -0
  69. package/vendor/components/sha256/1117758820dc561f41cf9d1cc0bab8cf3173cde7771ac10a12b94c96007c0f55/index.js +268 -0
  70. package/vendor/components/sha256/137017ad452afe209bdff81bc02ffae99c6b60a1c4aed2383515974f65511ff2/index.js +205 -0
  71. package/vendor/components/sha256/1a1471ba5f68e54304825a64e736afeda421e3763cdcbcdab2e45509562a0291/index.js +607 -0
  72. package/vendor/components/sha256/1b15fcc12b2fa43821e6299e87aae31aa69dbbc5a0d1b80088a5d7c5f8b8f7f5/index.js +429 -0
  73. package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/README.en.md +23 -0
  74. package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/index.js +147 -0
  75. package/vendor/components/sha256/21c099461befc0d382ddfe982f2a6cd8eeb6dd731252164ac619525e4bacdf0d/index.js +242 -0
  76. package/vendor/components/sha256/2352e0e22460f4a3c46dca6cef27cd9c63f161a411f1cf56c75c585e9124503c/index.js +315 -0
  77. package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/README.en.md +53 -0
  78. package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/index.js +171 -0
  79. package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/README.en.md +38 -0
  80. package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/index.js +414 -0
  81. package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/README.en.md +45 -0
  82. package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/index.js +211 -0
  83. package/vendor/components/sha256/2f111b900898579b3ec1611c2110db336a46d9133171a0cbb125ee37bd1f24f8/index.js +592 -0
  84. package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/README.en.md +45 -0
  85. package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/index.js +211 -0
  86. package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/README.en.md +20 -0
  87. package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/index.js +310 -0
  88. package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/README.en.md +35 -0
  89. package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/index.js +179 -0
  90. package/vendor/components/sha256/3af0b84b1799fc64ec74d6da9cbd343eccd89e8a11c81bfb444562c911284442/index.js +342 -0
  91. package/vendor/components/sha256/3c69bf3b3c6b9f76048fbc0839b3aa9699723570086d3d44bac799230ed6de5b/index.js +121 -0
  92. package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/README.en.md +37 -0
  93. package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/index.js +501 -0
  94. package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/README.en.md +38 -0
  95. package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/index.js +414 -0
  96. package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/README.en.md +30 -0
  97. package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/index.js +305 -0
  98. package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/README.en.md +31 -0
  99. package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/index.js +236 -0
  100. package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/README.en.md +21 -0
  101. package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/index.js +108 -0
  102. package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/README.en.md +28 -0
  103. package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/index.js +213 -0
  104. package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/README.en.md +35 -0
  105. package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/index.js +179 -0
  106. package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/README.en.md +53 -0
  107. package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/index.js +171 -0
  108. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ABCJS-ADAPTER.md +101 -0
  109. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/LICENSE-abcjs.txt +21 -0
  110. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/chords.json +89 -0
  111. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/doremi.json +261 -0
  112. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/extras.json +192 -0
  113. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/kaeru.json +521 -0
  114. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/rhythm.json +248 -0
  115. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ties.json +360 -0
  116. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/index.js +508 -0
  117. package/vendor/components/sha256/59996a56df462b36e24a928d4397c9308d9e39ad8224ebd19fb5c981608ef458/index.js +521 -0
  118. package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/README.en.md +30 -0
  119. package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/index.js +305 -0
  120. package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/README.en.md +30 -0
  121. package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/index.js +192 -0
  122. package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/README.en.md +20 -0
  123. package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/index.js +307 -0
  124. package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/README.en.md +24 -0
  125. package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/index.js +554 -0
  126. package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/README.en.md +25 -0
  127. package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/index.js +316 -0
  128. package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/README.en.md +18 -0
  129. package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/index.js +279 -0
  130. package/vendor/components/sha256/624acb997c4975ace65570b529b3ba00baa421c80ecb7fc80f392a64e8c573a7/index.js +107 -0
  131. package/vendor/components/sha256/62602488ee33dd4bdef8516de16da5ab27d7f7265d5041681beab80e08f1d482/index.js +97 -0
  132. package/vendor/components/sha256/67eaf344bddac79b74ed03fdcd70285c7b52b160e6c5ffbd6897848179aa5230/index.js +818 -0
  133. package/vendor/components/sha256/682c9c8871eccd19ff1264e0323a2e4c5798b0488b612ba0339c6fe85aab5914/index.js +926 -0
  134. package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/README.en.md +51 -0
  135. package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/index.js +230 -0
  136. package/vendor/components/sha256/72138936ed0b8fd3cb0214ae7ed250ae3f1f8b21ed6fd593544947774064ba0d/index.js +250 -0
  137. package/vendor/components/sha256/74c1a0f3ed1370c5003aa5770ee28cea2ce994d415680116a92fdbcd5854ba62/index.js +198 -0
  138. package/vendor/components/sha256/76125035eb153b98befa9c735bcd9fc4f99f774dc1d082fdae40acaadfe7d95b/index.js +818 -0
  139. package/vendor/components/sha256/7728cf7dde88a6688aba0ed70f23f7e21362a147beac09c1fa1a4b773e08e93b/index.js +354 -0
  140. package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/README.en.md +23 -0
  141. package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/index.js +289 -0
  142. package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/README.en.md +31 -0
  143. package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/index.js +236 -0
  144. package/vendor/components/sha256/7d50e50fbb6c5ec636b62509bd88ddaac1870e0522cf11bcc293ce924d48072d/index.js +312 -0
  145. package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/README.en.md +42 -0
  146. package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/index.js +549 -0
  147. package/vendor/components/sha256/87fc302c41b2bfeea88951ed689ec01b4dc79218c4bc69b310dc2228dfa2e153/index.js +926 -0
  148. package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/README.en.md +24 -0
  149. package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/index.js +103 -0
  150. package/vendor/components/sha256/89c8c16788e24df17920542ed6eb6557dea4a10e835de8fe839e439ccbba8014/index.js +69 -0
  151. package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/README.en.md +44 -0
  152. package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/index.js +304 -0
  153. package/vendor/components/sha256/8d9af78aef44ad2f98101c67d32473373d39725a09c923969aa621d5f5b124bb/index.js +121 -0
  154. package/vendor/components/sha256/8f861d71df72a82be86a3e63abf7d69bbab5aac6fa68be6e077c4e19c3519ed8/index.js +312 -0
  155. package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/README.en.md +54 -0
  156. package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/index.js +470 -0
  157. package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/README.en.md +24 -0
  158. package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/index.js +214 -0
  159. package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/README.en.md +33 -0
  160. package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/index.js +390 -0
  161. package/vendor/components/sha256/9289efef4a75afe011e54a17e34db08cfb16a450b2e0653e6a98525495cfba99/index.js +315 -0
  162. package/vendor/components/sha256/93256a923199ea51108cdb7491c3c96f376dbef15b64cbf1a1aa7cc5726b4970/index.js +429 -0
  163. package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/README.en.md +24 -0
  164. package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/index.js +550 -0
  165. package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/README.en.md +28 -0
  166. package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/index.js +213 -0
  167. package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/README.en.md +40 -0
  168. package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/index.js +348 -0
  169. package/vendor/components/sha256/97c074a5473618c65f4c23263f056870a0b7940e73475f2a1f32f68c08d8eb0f/index.js +198 -0
  170. package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/README.en.md +66 -0
  171. package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/index.js +984 -0
  172. package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/README.en.md +34 -0
  173. package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/index.js +244 -0
  174. package/vendor/components/sha256/a18b2b15d00c76462a43823b5c270c7ddd7c31794da9c236f74f20f80ec2ffdb/index.js +354 -0
  175. package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/README.en.md +32 -0
  176. package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/index.js +222 -0
  177. package/vendor/components/sha256/a979207c60fbd2a12cb557297eb0217eb098d660de684530a0f43d0d9c64e6ef/index.js +312 -0
  178. package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/README.en.md +34 -0
  179. package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/index.js +244 -0
  180. package/vendor/components/sha256/af7ed69b8969f6da14784b6e9d26e4dfd20147772ea172a99bd936a71be10fcd/index.js +278 -0
  181. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ABCJS-ADAPTER.md +101 -0
  182. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/LICENSE-abcjs.txt +21 -0
  183. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/chords.json +89 -0
  184. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/doremi.json +261 -0
  185. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/extras.json +192 -0
  186. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/kaeru.json +521 -0
  187. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/rhythm.json +248 -0
  188. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ties.json +360 -0
  189. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/index.js +508 -0
  190. package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/README.en.md +66 -0
  191. package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/index.js +990 -0
  192. package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/README.en.md +24 -0
  193. package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/index.js +550 -0
  194. package/vendor/components/sha256/b8096d7a60609520981273673761a110e40e3bdf52a7ab5548363b20e16f6e93/index.js +404 -0
  195. package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/README.en.md +32 -0
  196. package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/index.js +222 -0
  197. package/vendor/components/sha256/bd8e3893df02411deccc1d6d7b02292ca0d59dfeddfafcf99419430981572c82/index.js +351 -0
  198. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ABCJS-ADAPTER.md +101 -0
  199. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/LICENSE-abcjs.txt +21 -0
  200. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/chords.json +89 -0
  201. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/doremi.json +261 -0
  202. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/extras.json +192 -0
  203. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/kaeru.json +521 -0
  204. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/rhythm.json +248 -0
  205. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ties.json +360 -0
  206. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/index.js +508 -0
  207. package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/README.en.md +31 -0
  208. package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/index.js +267 -0
  209. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/LICENSE-strokesvg.txt +115 -0
  210. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/OFL.txt +93 -0
  211. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/index.js +749 -0
  212. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/strokes-CHANGES.md +20 -0
  213. package/vendor/components/sha256/c791e69e722f64146242f97acb29a341160d0c327cfe1d76307954d80e70db85/index.js +268 -0
  214. package/vendor/components/sha256/c8c0de41d603b61c6ec4dc1da5b50559e213dd1f3693ee5019df858016fd6daf/index.js +747 -0
  215. package/vendor/components/sha256/c99d4f2ab443484b9f462e405c72ea4794838b88f8823f27c606d12cbbedb996/index.js +404 -0
  216. package/vendor/components/sha256/cbde046e30c35db60259911a88e2ae0bedaf545e29b1da8b8ce13bc602a33c19/index.js +465 -0
  217. package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/README.en.md +51 -0
  218. package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/index.js +228 -0
  219. package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/README.en.md +35 -0
  220. package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/index.js +179 -0
  221. package/vendor/components/sha256/cf0985ffcd8e7cbe2175ddb9a4342b2a4aa3f322794188fc99af8789b494460d/index.js +521 -0
  222. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/LICENSE-strokesvg.txt +115 -0
  223. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/OFL.txt +93 -0
  224. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/index.js +749 -0
  225. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/strokes-CHANGES.md +20 -0
  226. package/vendor/components/sha256/d01dc7fd78d08dd720ed86b39d7877dc0913d72e914036088a86af2df2faee52/index.js +484 -0
  227. package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/README.en.md +24 -0
  228. package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/index.js +214 -0
  229. package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/README.en.md +31 -0
  230. package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/index.js +271 -0
  231. package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/README.en.md +25 -0
  232. package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/index.js +316 -0
  233. package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/README.en.md +23 -0
  234. package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/index.js +120 -0
  235. package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/README.en.md +40 -0
  236. package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/index.js +405 -0
  237. package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/README.en.md +66 -0
  238. package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/index.js +984 -0
  239. package/vendor/components/sha256/ddd4b9cbbc282cbb3117ff662e1a14ecdb3cc7c16072a574418ec6a6eecef4d8/index.js +107 -0
  240. package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/README.en.md +22 -0
  241. package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/index.js +145 -0
  242. package/vendor/components/sha256/e2da948daac7bfac158857877b5a6932dbd2369e73901abcef118c92dd20b725/index.js +747 -0
  243. package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/README.en.md +42 -0
  244. package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/index.js +268 -0
  245. package/vendor/components/sha256/e653a4da80f7761442dc5b504ea5b0700fd0acf1979beeff56122cfdb3d4654c/index.js +607 -0
  246. package/vendor/components/sha256/ea217c6821e931b2d8474bf56d38f2dcc89ec705fe1d276f313e1c7e8db2b98a/index.js +233 -0
  247. package/vendor/components/sha256/ea2e4e24838574f607879c7d05556281258c018331e4da3e6f3a5263173f2e99/index.js +75 -0
  248. package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/README.en.md +42 -0
  249. package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/index.js +549 -0
  250. package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/README.en.md +44 -0
  251. package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/index.js +203 -0
  252. package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/README.en.md +34 -0
  253. package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/index.js +244 -0
  254. package/vendor/components/sha256/fa1a09c10181456143d125d68dbbdcacde6bab2e4a2b3e573367103ce28ebf55/index.js +228 -0
  255. package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/README.en.md +51 -0
  256. package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/index.js +228 -0
  257. package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/README.en.md +23 -0
  258. package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/index.js +147 -0
  259. package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/README.en.md +20 -0
  260. package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/index.js +307 -0
  261. package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/README.en.md +26 -0
  262. package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/index.js +322 -0
  263. package/vendor/components-2/manifest-2.12.0.json +2348 -0
  264. package/vendor/components-2/manifest-2.13.0.json +2477 -0
  265. package/vendor/components-2/manifest-2.14.0.json +2460 -0
  266. package/vendor/components-2/manifest-2.14.1.json +2460 -0
  267. package/vendor/components-2/manifest-2.15.0.json +2460 -0
  268. package/vendor/egatari-spec/SOURCE.json +3 -3
  269. package/vendor/egatari-spec/schema/deck-meta.schema.json +16 -1
  270. package/vendor/egatari-spec/schema/egatari-metadata.schema.json +17 -2
@@ -0,0 +1,242 @@
1
+ // m-seq:観測を 1 つずつ加えて、分布(事後分布など)と数値が更新されていく様子を見せる
2
+ // <m-seq per-step="2" style="height:400px"><script type="application/json">
3
+ // {"xs":[…], "steps":[{"dens":[…], "readout":{"n":0,"μ_n":0.00}}, {"dens":[…], "readout":{…}, "mark":1.2}, …],
4
+ // "xl":"*θ*", "yl":"密度", "yr":[0,2], "digits":{"n":0}, "markLabel":"*y*_n"}
5
+ // (JSON の終わり)</m-seq>
6
+ // steps[0] は始めの状態(段階 0)。steps[1..] が 1 回ずつの更新。1 段階に per-step 回の更新を、等しい時間枠で順に動かす。
7
+ // 今の分布は濃く、前の分布は薄い線で残す。右の欄に readout の数値(桁をそろえる)。mark は今回の観測の位置
8
+ // 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・mtext・prog・lerp・previewOpacity と plot の Plot を使い、プレイヤーのグローバルは使わない
9
+ egatariParts.define({name: "seq", version: "2.1.0", requires: {base: "1.3.0", plot: "1.1.3"}, element: "m-seq"}, function(deps){
10
+ "use strict";
11
+ var base = deps.base, plot = deps.plot;
12
+ // 点列の d。null の所で線を切り、次の有限な点から M で引き直す(plot の p.d と同じ字。切れ目がなければ同じ d)
13
+ function pathOf(pts){
14
+ var d = "", pen = false;
15
+ pts.forEach(function(q){ if (q){ d += (pen ? "L" : "M") + q[0].toFixed(1) + "," + q[1].toFixed(1); pen = true; } else pen = false; });
16
+ return d;
17
+ }
18
+ // 線分 s = [[x, y], [x, y]] が箱 r = [x0, y0, x1, y1] にかかるか(Liang–Barsky)
19
+ function segHitsBox(s, r){
20
+ var x = s[0][0], y = s[0][1], dx = s[1][0] - x, dy = s[1][1] - y, t0 = 0, t1 = 1;
21
+ var pp = [-dx, dx, -dy, dy], qq = [x - r[0], r[2] - x, y - r[1], r[3] - y];
22
+ for (var i = 0; i < 4; i++){
23
+ if (pp[i] === 0){ if (qq[i] < 0) return false; continue; }
24
+ var u = qq[i] / pp[i];
25
+ if (pp[i] < 0){ if (u > t1) return false; if (u > t0) t0 = u; }
26
+ else { if (u < t0) return false; if (u < t1) t1 = u; }
27
+ }
28
+ return true;
29
+ }
30
+ // 灰色の線の名前の置き場所:その線の上に、線の点を中心にして置く(字は背景色の縁取りで線を切るので、どの線の名前か読める)。
31
+ // bd(字を置ける範囲)の中で、置いた字(boxes)に重ならず、ほかの線(lines:点列の配列。cl の中だけ描かれる)にかかる数が最も少なく、
32
+ // 自分の線が字の高さの中に収まり(平らな所)、ほかの線から離れている所(40 px まで)。w は字の幅の見積もり、fs は字の大きさ。置けなければ null
33
+ function placeOn(own, w, fs, lines, boxes, bd, cl){
34
+ var best = null, bc = Infinity;
35
+ var hits = function(L, r){
36
+ var q = [Math.max(r[0], cl[0]), Math.max(r[1], cl[1]), Math.min(r[2], cl[2]), Math.min(r[3], cl[3])];
37
+ if (q[0] >= q[2] || q[1] >= q[3]) return false;
38
+ for (var i = 1; i < L.length; i++) if (L[i - 1] && L[i] && segHitsBox([L[i - 1], L[i]], q)) return true;
39
+ return false;
40
+ };
41
+ for (var j = 0; j < own.length; j += 3){
42
+ var q = own[j];
43
+ if (!q || q[0] < cl[0] || q[0] > cl[2] || q[1] < cl[1] || q[1] > cl[3]) continue; // 描かれている点だけ
44
+ // 横軸や上の端に沿う線では、字を範囲の中へ上下にずらす(線のすぐ上・下になる)
45
+ var y = q[1] + fs * 0.33;
46
+ y = Math.max(bd[1] + fs * 0.88, Math.min(bd[3] - fs * 0.22, y));
47
+ var r = [q[0] - w / 2, y - fs * 0.88, q[0] + w / 2, y + fs * 0.22];
48
+ if (r[0] < bd[0] || r[2] > bd[2]) continue;
49
+ if (boxes.some(function(b){ return r[0] < b[2] + 6 && b[0] < r[2] + 6 && r[1] < b[3] + 4 && b[1] < r[3] + 4; })) continue;
50
+ // ほかの線にかかれば 1 本につき 1000。自分の線が字の幅の間に字の高さより大きく上下すれば 300
51
+ var c = 0, r3 = [r[0] - 3, r[1] - 3, r[2] + 3, r[3] + 3], gap = 40, lo = Infinity, hi = -Infinity;
52
+ own.forEach(function(z){ if (z && z[0] >= r[0] && z[0] <= r[2]){ lo = Math.min(lo, z[1]); hi = Math.max(hi, z[1]); } });
53
+ if (hi - lo > fs * 0.9) c += 300;
54
+ lines.forEach(function(L){
55
+ if (L === own) return;
56
+ if (hits(L, r3)){ c += 1000; return; }
57
+ L.forEach(function(z){
58
+ if (z && z[0] >= cl[0] && z[0] <= cl[2] && z[1] >= cl[1] && z[1] <= cl[3]) gap = Math.min(gap, Math.hypot(Math.max(r[0] - z[0], 0, z[0] - r[2]), Math.max(r[1] - z[1], 0, z[1] - r[3])));
59
+ });
60
+ });
61
+ c += 40 - gap + (hi - lo) / fs;
62
+ if (c < bc){ bc = c; best = {x: q[0], y: y, box: r}; }
63
+ }
64
+ return best;
65
+ }
66
+ return class extends base.MotionElement {
67
+ static partName = "seq"; // the registry name (define meta name), for report prefixes
68
+ // データの形(kit/shape.js)。軸の設定(xl yl yr など)も JSON に書ける
69
+ static shape = {
70
+ schema: {type: "object", required: ["xs", "steps"], properties: {
71
+ xs: {type: "array", minItems: 2, items: {type: "number"}},
72
+ steps: {type: "array", minItems: 1, items: {type: "object", required: ["dens"], properties: {dens: {type: "array", items: {type: "number"}}, readout: {type: "object"}, mark: {type: "number"}}}},
73
+ digits: {type: "object"}, markLabel: {type: "string"}}},
74
+ example: {xs: [-2, -1, 0, 1, 2], steps: [{dens: [0.05, 0.24, 0.4, 0.24, 0.05], readout: {n: 0}}, {dens: [0.02, 0.2, 0.5, 0.2, 0.02], readout: {n: 1}, mark: 0.3}]},
75
+ };
76
+ static props = {
77
+ "per-step": {type: "number", default: 1, doc: "1 ステップで動かす更新の回数"},
78
+ slot: {type: "number", default: 0.9, doc: "更新 1 回の秒数(cues はこの間隔)"},
79
+ xr: {type: "json", default: null, doc: "横軸の範囲(既定は xs の端)"}, yr: {type: "json", default: [0, 1]},
80
+ xt: {type: "json", default: []}, yt: {type: "json", default: []},
81
+ xf: {type: "number", default: undefined}, yf: {type: "number", default: undefined},
82
+ xl: {type: "string", default: ""}, yl: {type: "string", default: ""},
83
+ digits: {type: "number", default: 2, doc: "数値の小数の桁数(data.digits で名前ごとに上書き)"},
84
+ panel: {type: "number", default: 250, doc: "右の数値の欄の幅(px)"},
85
+ ghosts: {type: "number", default: 99, doc: "残す前の分布の数"},
86
+ };
87
+ // 属性があれば属性、なければ data の同名の値、なければ既定
88
+ opt(name){ var d = this.data || {}; return this.hasAttribute(name) || d[name] === undefined ? this.props[name] : d[name]; }
89
+ get updates(){ return Math.max(0, ((this.data || {}).steps || []).length - 1); }
90
+ get steps(){ return this.getAttribute("steps") !== null ? +this.getAttribute("steps") : Math.ceil(this.updates / this.props["per-step"]); }
91
+ mount(ctx){
92
+ var D = base, self = this, data = this.data, xs = data.xs;
93
+ this.classList.add("plot"); this.style.display = "block";
94
+ var xr = this.opt("xr") || [xs[0], xs[xs.length - 1]], pw = this.opt("panel");
95
+ var p = this.p = plot.Plot(this, {xr: xr, yr: this.opt("yr"), xt: this.opt("xt"), yt: this.opt("yt"), xf: this.opt("xf"), yf: this.opt("yf"),
96
+ xl: this.opt("xl"), yl: this.opt("yl"), m: {l: 86, r: pw + 16, t: 24, b: 64}});
97
+ // 密度の点列(px)。有限でない値(NaN・±Infinity・足りない値)の点は null で、線はそこで切る
98
+ this.pts = function(dens){ return xs.map(function(x, i){ var X = p.x(x), Y = p.y(dens[i]); return typeof dens[i] === "number" && isFinite(X) && isFinite(Y) ? [X, Y] : null; }); };
99
+ var bad = [];
100
+ data.steps.forEach(function(s, i){ if (self.pts(s.dens).indexOf(null) >= 0) bad.push(i); });
101
+ if (bad.length) ctx.report("data", "[seq] steps " + bad.join(", ") + ": dens has values that are not finite numbers (NaN, ±Infinity or missing for some xs); the curve is broken there");
102
+ // 軸の範囲を書かなかったとき(yr は既定の [0, 1]、xr は xs の端)に値が範囲の外に出るなら知らせる(m-curves 2.3.1 と同じ。書いた範囲で切るのは意図とみなし、知らせない)
103
+ var unset = function(name){ return !self.hasAttribute(name) && data[name] === undefined; };
104
+ var outside = function(ax, r, vs, what, cut){
105
+ var lo = Math.min(r[0], r[1]), hi = Math.max(r[0], r[1]), tol = (hi - lo) * 1e-9, out = vs.filter(function(v){ return v < lo - tol || v > hi + tol; });
106
+ if (out.length) ctx.report("range", "[seq] " + out.length + " of " + vs.length + " " + what + " are outside " + ax + " " + JSON.stringify(r) + " (the default" + (ax === "xr" ? ", the ends of xs" : "") + "; values from " + +Math.min.apply(null, vs).toPrecision(4) + " to " + +Math.max.apply(null, vs).toPrecision(4) + "), so " + cut + ". Write " + ax + " to cover them");
107
+ };
108
+ var fin = function(v){ return typeof v === "number" && isFinite(v); };
109
+ if (unset("yr")) outside("yr", this.opt("yr"), [].concat.apply([], data.steps.map(function(s){ return (s.dens || []).filter(fin); })), "dens values", "the curve is cut at the edge");
110
+ if (unset("xr")) outside("xr", xr, data.steps.map(function(s){ return s.mark; }).filter(fin), "marks", "they are drawn outside the plot");
111
+ // 塗り(今の分布の下)→ 前の分布の薄い線 → 今の分布の線 の順に重ねる
112
+ this.area = D.el("path", {fill: "var(--term-tint)", stroke: "none", "clip-path": p.clip}, p.svg);
113
+ var gG = D.el("g", {"clip-path": p.clip}, p.svg);
114
+ this.ghostEls = data.steps.map(function(s){
115
+ var e = D.el("path", {fill: "none", stroke: "var(--line)", "stroke-width": 2.5, opacity: 0}, gG);
116
+ e.setAttribute("d", pathOf(self.pts(s.dens)));
117
+ return e;
118
+ });
119
+ this.cur = D.el("path", {fill: "none", stroke: "var(--term)", "stroke-width": 3.5, "stroke-linejoin": "round", "clip-path": p.clip}, p.svg);
120
+ // 観測の印:今回は縦の点線と名前、前の観測は横軸の上の小さな点
121
+ this.dots = data.steps.map(function(s){
122
+ return s.mark === undefined ? null : D.el("circle", {cx: p.x(s.mark), cy: p.H - p.m.b - 7, r: 6, fill: "var(--muted)", opacity: 0}, p.svg);
123
+ });
124
+ this.markLine = D.el("line", {x1: 0, x2: 0, y1: p.m.t + 34, y2: p.H - p.m.b, stroke: "var(--emph)", "stroke-width": 2.5, "stroke-dasharray": "7 6", opacity: 0}, p.svg);
125
+ this.markLab = D.mtext(p.svg, 0, p.m.t + 24, data.markLabel || "", {"text-anchor": "middle", fill: "var(--emph)", "font-size": 26, opacity: 0});
126
+ // 数値の欄(名前は左寄せ、値は右寄せ。等幅の数字)
127
+ var keys = Object.keys(data.steps[0].readout || {}), px = p.W - pw + 8, px2 = p.W - 8;
128
+ D.el("rect", {x: px - 8, y: p.m.t, width: pw, height: 40 + keys.length * 44, rx: 10, fill: "var(--term-tint)", stroke: "var(--line)", "stroke-width": 1.5}, p.svg);
129
+ this.rows = keys.map(function(key, j){
130
+ var y = p.m.t + 44 + j * 44;
131
+ D.mtext(p.svg, px + 12, y, key, {"font-size": 28});
132
+ var v = D.el("text", {x: px2 - 12, y: y, "text-anchor": "end", "font-size": 28, style: "font-variant-numeric:tabular-nums;font-feature-settings:'tnum'"}, p.svg);
133
+ return {key: key, el: v, dg: (data.digits || {})[key] !== undefined ? data.digits[key] : self.props.digits};
134
+ });
135
+ // readout に書いていない名前は、前の値のまま出す(1 回だけ知らせる)
136
+ var miss = [];
137
+ keys.forEach(function(key){
138
+ var at = []; data.steps.forEach(function(s, i){ if ((s.readout || {})[key] === undefined) at.push(i); });
139
+ if (at.length) miss.push(JSON.stringify(key) + " (steps " + at.join(", ") + ")");
140
+ });
141
+ if (miss.length) ctx.report("data", "[seq] readout has no value for " + miss.join(", ") + "; the previous value is shown");
142
+ // 灰色の線(前の分布)の名前「n = 3」:最後の段階で残る線に、--muted の 24px で線の上に(背景色で縁取って)書く。
143
+ // 5 本以上なら最初と最後だけ。n は readout の n(*n* など、字が n の名前)の値、なければ更新の回数。
144
+ // 置き場所は最後の段階の形(今の線・灰色の線・観測の印)で決め、その線が灰色で見えている間だけ出す
145
+ var last = this.updates, G = this.props.ghosts, fs = 24, nk = null;
146
+ keys.forEach(function(key){ if (nk === null && key.replace(/[*_^]/g, "") === "n") nk = key; });
147
+ var wOf = function(str){ return D.textWidth(str, fs, {font: self, mark: true}); }; // base の textWidth(記法の * _ ^ を除く)
148
+ var shown = [];
149
+ for (var i = Math.max(0, last - G); i < last; i++) shown.push(i);
150
+ if (shown.length > 4) shown = [shown[0], shown[shown.length - 1]];
151
+ var gp = data.steps.map(function(s){ return self.pts(s.dens); });
152
+ var lines = [gp[last]].concat(gp.slice(Math.max(0, last - G), last)), lm = data.steps[last].mark, boxes = [];
153
+ if (lm !== undefined && last > 0){
154
+ lines.push([[p.x(lm), p.m.t + 34], [p.x(lm), p.H - p.m.b]]);
155
+ var mw = wOf(data.markLabel || "") * 26 / 24;
156
+ boxes.push([p.x(lm) - mw / 2, p.m.t + 24 - 26 * 0.88, p.x(lm) + mw / 2, p.m.t + 24 + 26 * 0.22]);
157
+ }
158
+ data.steps.forEach(function(s, i){ if (s.mark !== undefined && i < last) boxes.push([p.x(s.mark) - 6, p.H - p.m.b - 13, p.x(s.mark) + 6, p.H - p.m.b - 1]); });
159
+ var bd = [p.m.l + 4, 4, p.W - pw - 16, p.H - p.m.b - 2], cl = [p.m.l, p.m.t - 4, p.W - pw - 16, p.H - p.m.b];
160
+ this.glabs = [];
161
+ shown.forEach(function(i){
162
+ var v = nk !== null ? (data.steps[i].readout || {})[nk] : i;
163
+ if (v === undefined) v = i;
164
+ var dg = nk !== null && (data.digits || {})[nk] !== undefined ? data.digits[nk] : 0;
165
+ var str = (nk !== null ? nk : "*n*") + " = " + (typeof v === "number" ? v.toFixed(dg).replace("-", "−") : String(v));
166
+ var at = placeOn(gp[i], wOf(str), fs, lines, boxes, bd, cl);
167
+ if (!at){ ctx.report("layout", "[seq] no free place for the name of the grey curve " + JSON.stringify(str) + " (not drawn)"); return; }
168
+ boxes.push(at.box);
169
+ self.glabs.push({i: i, el: D.mtext(p.svg, +at.x.toFixed(1), +at.y.toFixed(1), str, {"text-anchor": "middle", fill: "var(--muted)", stroke: "var(--bg)", "stroke-width": 6, "paint-order": "stroke", "font-size": fs, opacity: 0})});
170
+ });
171
+ }
172
+ // 段階 i までで readout の key に最後に書かれた値(なければ undefined)
173
+ valAt(i, key){ var S = this.data.steps; for (; i >= 0; i--){ var v = (S[i].readout || {})[key]; if (v !== undefined) return v; } return undefined; }
174
+ // 段階 k が受け持つ更新の番号 [first, last]
175
+ span(k){ var P = this.props["per-step"]; return [(k - 1) * P + 1, Math.min(k * P, this.updates)]; }
176
+ duration(k){ if (k < 1) return 0; var s = this.span(k); return Math.max(0, s[1] - s[0] + 1) * this.props.slot; }
177
+ cues(k){
178
+ if (k < 1) return null;
179
+ var s = this.span(k), out = [];
180
+ for (var j = 0; j <= s[1] - s[0]; j++) out.push(+(j * this.props.slot).toFixed(4));
181
+ return out;
182
+ }
183
+ render(k, t, ctx){
184
+ var D = base, S = this.data.steps, p = this.p, slot = this.props.slot;
185
+ var preview = !!ctx.preview, PV = preview ? base.previewOpacity(this) : 1;
186
+
187
+ // 今の更新の番号 idx と、その更新の進み具合 e(0 なら一つ前の状態、1 なら更新後)
188
+ var idx = 0, e = 1, tm = 0;
189
+ if (k >= 1){
190
+ var s = this.span(k), n = s[1] - s[0] + 1;
191
+ if (t === Infinity){ idx = s[1]; tm = Infinity; }
192
+ else { var j = Math.max(0, Math.min(n - 1, Math.floor(t / slot))); idx = s[0] + j; tm = t - j * slot; }
193
+ e = D.prog(tm, 0, slot * 0.8);
194
+ }
195
+ var a = S[Math.max(0, idx - 1)], b = S[idx];
196
+ // 前後のどちらかが有限でなければ補間せず、動き終わり(e = 1)は後の値、始め(e = 0)は前の値
197
+ var dens = this.data.xs.map(function(_, i){
198
+ var A = a.dens[i], B = b.dens[i];
199
+ return typeof A === "number" && typeof B === "number" && isFinite(A) && isFinite(B) ? D.lerp(A, B, e) : e >= 1 ? B : e <= 0 ? A : NaN;
200
+ });
201
+ // 線は有限な区間ごとに引き、塗りも区間ごとに横軸まで閉じる(切れ目がなければ今までと同じ d)
202
+ var q = this.pts(dens), d = pathOf(q), ar = "", y0 = p.y(0).toFixed(1);
203
+ for (var i = 0; i < q.length; i++){
204
+ if (!q[i]) continue;
205
+ var j = i; while (j + 1 < q.length && q[j + 1]) j++;
206
+ ar += pathOf(q.slice(i, j + 1)) + "L" + q[j][0].toFixed(1) + "," + y0 + "L" + q[i][0].toFixed(1) + "," + y0 + "Z";
207
+ i = j;
208
+ }
209
+ this.cur.setAttribute("d", d);
210
+ this.area.setAttribute("d", ar);
211
+ var G = this.props.ghosts, last = this.updates, end = this.span(k)[1];
212
+ // 先の段階を薄く見せる表示(授業の表示):後の段階の終わりの分布を今の線の色で、後の観測の点とともに、
213
+ // テーマの --preview-opacity の濃さに(途中の分布は重ねない)
214
+ var ahead = function(i){ return preview && i > Math.max(idx, k >= 1 ? end : 0); };
215
+ this.ghostEls.forEach(function(g, i){
216
+ var f = ahead(i) && i === last;
217
+ var col = f ? "var(--term)" : "var(--line)";
218
+ // style は base.el と同じ書き方で書く(style.stroke に代入すると "stroke: var(--x);" になり、作った直後と字が変わる)
219
+ g.setAttribute("style", "stroke:" + col + ";");
220
+ g.setAttribute("opacity", f ? PV : i < idx && i >= idx - G ? 1 : 0);
221
+ });
222
+ this.dots.forEach(function(c, i){ if (c) c.setAttribute("opacity", ahead(i) ? PV : i < idx ? 1 : 0); });
223
+ var mo = b.mark !== undefined && idx > 0 ? D.prog(tm, 0, 0.25) : 0;
224
+ // 印のない段階では作った直後の位置(0)に戻す(前の段階の位置を残さない。docs/contract.md §3)
225
+ var mx = b.mark !== undefined ? p.x(b.mark) : 0;
226
+ this.markLine.setAttribute("x1", mx); this.markLine.setAttribute("x2", mx); this.markLab.setAttribute("x", mx);
227
+ this.markLine.setAttribute("opacity", mo.toFixed(3));
228
+ this.markLab.setAttribute("opacity", mo.toFixed(3));
229
+ var self = this, ia = Math.max(0, idx - 1);
230
+ this.rows.forEach(function(r){
231
+ // 書いていない値は前の段階の値(桁もそろえる)
232
+ var va = self.valAt(ia, r.key), vb = self.valAt(idx, r.key), v;
233
+ if (typeof va === "number" && typeof vb === "number") v = D.lerp(va, vb, e);
234
+ else v = e < 0.5 && va !== undefined ? va : vb;
235
+ v = typeof v === "number" ? v.toFixed(r.dg).replace("-", "−") : String(v);
236
+ r.el.textContent = v === "−0" || /^−0\.0*$/.test(v) ? v.slice(1) : v;
237
+ });
238
+ // 灰色の線の名前は、その線が灰色で見えている間だけ
239
+ this.glabs.forEach(function(o){ o.el.setAttribute("opacity", !ahead(o.i) && o.i < idx && o.i >= idx - G ? 1 : 0); });
240
+ }
241
+ };
242
+ });
@@ -0,0 +1,315 @@
1
+ // m-keyboard:音楽の授業のピアノの鍵盤。段階ごとに鍵盤を光らせ(音階・和音・半音と全音)、その音を再生器に鳴らしてもらう
2
+ // <m-keyboard style="height:380px"><script type="application/json">
3
+ // {"range": "C4-C6", "names": "solfa", "steps": [{"keys": ["C4", "E4", "G4"], "label": "主和音"}]}
4
+ // (JSON の終わり)</m-keyboard>
5
+ // 段階 0 は鍵盤だけ。段階 k は steps[k-1] の keys を --emph(または step の tone)で光らせる。keys ごとの t(秒)でずらせば音階・分散和音、
6
+ // 同じ t なら和音。cumulative: true なら前の段階の鍵盤も薄く光ったまま
7
+ // 音(仕様 §8.4「Component sounds」):events(k) は鍵盤 1 つに 1 つの note(pitch は鍵盤の名前、vel 0.7、dur は dur の欄か、
8
+ // 次の t まで(なければ 0.8 秒))。duration(k) は最後の音の終わりまで。音だけに頼らない:光った鍵盤と印がいつも同じことを示す
9
+ // 鍵盤の形(customElements.get("m-keyboard").kb、tools/test-keyboard.mjs):白鍵の幅を 1 として、ド〜ミの 3 つを 5 等分、ファ〜シの 4 つを
10
+ // 7 等分した 2・4(・6)番目に黒鍵を置く(本物の鍵盤と同じく、ド♯とレ♯は外へ、ファ♯とラ♯も外へ寄り、ソ♯は真ん中)
11
+ // 授業の表示(ctx.preview):先の段階の鍵盤をテーマの --preview-opacity(なければ 0.45)で薄く、印なしで見せる
12
+ // 見せ方(docs/conventions.md §1):light(既定。光がフェード)・press(鍵盤が少し沈んで戻る)・rise(光が鍵盤の下から上へ満ちる)
13
+ // 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・prog・variant・previewOpacity を使い、プレイヤーのグローバルは使わない。
14
+ // 段階の数は ctx にも言語にもよらない(spec §8.4):既定の鍵盤の名前(日本語ならドレミ、ほかは CDE)は plan() ではなく mount で選ぶ。
15
+ // レッスンのデータや要素の大きさの問題は ctx.report で知らせる(1.x の console.warn("m-keyboard: …") の代わり)
16
+ egatariParts.define({name: "keyboard", version: "2.0.5", requires: {base: "1.2.0"}, element: "m-keyboard"}, function(deps){
17
+ "use strict";
18
+ var base = deps.base;
19
+ // ---- 鍵盤の名前と形(DOM を使わない。tools/test-keyboard.mjs が試す) ----
20
+ var KB = (function(){
21
+ var LETTERS = "CDEFGAB", PC = {C: 0, D: 2, E: 4, F: 5, G: 7, A: 9, B: 11};
22
+ var SOLFA = {C: "ド", D: "レ", E: "ミ", F: "ファ", G: "ソ", A: "ラ", B: "シ"};
23
+ var IROHA = {C: "ハ", D: "ニ", E: "ホ", F: "ヘ", G: "ト", A: "イ", B: "ロ"};
24
+ var BW = 0.58, BH = 0.62; // 黒鍵の幅(白鍵の幅に対して)と長さ(白鍵の長さに対して)
25
+ // "C4" "C#4" "Db4"(♯ ♭ も)→ {letter, acc: "" | "#" | "b", oct, midi, white, name}。読めなければ null
26
+ function parseKey(s){
27
+ var m = /^([A-G])([#b♯♭]?)(-?\d)$/.exec(String(s).trim());
28
+ if (!m) return null;
29
+ var acc = m[2] === "♯" ? "#" : m[2] === "♭" ? "b" : m[2], oct = +m[3];
30
+ // E♯・B♯・F♭・C♭ は白鍵の別の名前:鍵盤の名前としては使わない
31
+ if ((acc === "#" && (m[1] === "E" || m[1] === "B")) || (acc === "b" && (m[1] === "F" || m[1] === "C"))) return null;
32
+ var midi = 12 * (oct + 1) + PC[m[1]] + (acc === "#" ? 1 : acc === "b" ? -1 : 0);
33
+ return {letter: m[1], acc: acc, oct: oct, midi: midi, white: !acc, name: m[1] + acc + oct};
34
+ }
35
+ // "C4-C6" → {lo, hi}(鍵盤 2 つ)。両端は白鍵、1〜3 オクターブ(半音 12〜36 個)。違えば Error(何が・どう書くか)
36
+ function parseRange(s){
37
+ var m = /^\s*([A-G][#b♯♭]?-?\d)\s*[-–〜~]\s*([A-G][#b♯♭]?-?\d)\s*$/.exec(String(s || ""));
38
+ if (!m) throw new Error('m-keyboard: range "' + s + '" is not two key names such as "C4-C6"');
39
+ var lo = parseKey(m[1]), hi = parseKey(m[2]);
40
+ if (!lo || !hi) throw new Error('m-keyboard: range "' + s + '": ' + (!lo ? m[1] : m[2]) + " is not a key name (C4, F#3, Bb4, …)");
41
+ if (!lo.white || !hi.white) throw new Error('m-keyboard: range "' + s + '" must start and end on white keys (C D E F G A B)');
42
+ var span = hi.midi - lo.midi;
43
+ if (span < 12 || span > 36) throw new Error('m-keyboard: range "' + s + '" covers ' + span + " semitones; it must cover 1–3 octaves (12–36, such as C4-C5 or C3-C6)");
44
+ return {lo: lo, hi: hi};
45
+ }
46
+ // 鍵 lo〜hi(midi)を覆う範囲の書き方:"C4-D5"(両端は白鍵、半音 12〜36 個。12 に足りなければ上に広げる)。36 を超えれば null
47
+ function cover(lo, hi){
48
+ var name = function(mi){ return "C D EF G A B".charAt(((mi % 12) + 12) % 12) + (Math.floor(mi / 12) - 1); };
49
+ var white = function(mi){ return [0, 2, 4, 5, 7, 9, 11].indexOf(((mi % 12) + 12) % 12) >= 0; };
50
+ if (!white(lo)) lo--;
51
+ if (!white(hi)) hi++;
52
+ if (hi - lo < 12){ hi = lo + 12; if (!white(hi)) hi++; }
53
+ return hi - lo > 36 ? null : name(lo) + "-" + name(hi);
54
+ }
55
+ // 範囲の鍵盤:白鍵 {midi, white: true, i, x(左の端), w: 1}、黒鍵 {midi, white: false, x(左の端), cx(真ん中), w: BW}。単位は白鍵の幅
56
+ function keys(r){
57
+ var out = [], whites = [], wi = -1;
58
+ for (var mi = r.lo.midi; mi <= r.hi.midi; mi++){
59
+ var pc = ((mi % 12) + 12) % 12, white = [0, 2, 4, 5, 7, 9, 11].indexOf(pc) >= 0;
60
+ if (white){ wi++; var k = {midi: mi, pc: pc, white: true, i: wi, x: wi, w: 1}; whites.push(k); out.push(k); continue; }
61
+ // 黒鍵:下の白鍵(i = wi)の組(ド〜ミ か ファ〜シ)の始まりから数える
62
+ var g = pc < 5 ? {start: wi - (pc - 1) / 2, n: 3, slot: (pc === 1 ? 1 : 3)} : {start: wi - (pc - 6) / 2, n: 4, slot: (pc === 6 ? 1 : pc === 8 ? 3 : 5)};
63
+ var cx = g.start + (g.slot + 0.5) * g.n / (2 * g.n - 1);
64
+ out.push({midi: mi, pc: pc, white: false, below: wi, cx: cx, x: cx - BW / 2, w: BW});
65
+ }
66
+ return {all: out, whites: whites, n: whites.length, BW: BW, BH: BH};
67
+ }
68
+ // 鍵盤の名前:names = "solfa"(ドレミ)・"abc"(CDE)・"iroha"(ハニホ)・"none"(null)。黒鍵は ♯・♭ をつける(ド♯ / C♯、レ♭ / D♭)。
69
+ // iroha は前に 嬰・変 をつける(嬰ハ、変ニ)
70
+ function label(k, names){
71
+ if (names === "none") return null;
72
+ if (names === "iroha") return (k.acc === "#" ? "嬰" : k.acc === "b" ? "変" : "") + IROHA[k.letter];
73
+ var s = names === "abc" ? k.letter : SOLFA[k.letter];
74
+ return s + (k.acc === "#" ? "♯" : k.acc === "b" ? "♭" : "");
75
+ }
76
+ // 白鍵の名前(範囲の中の midi から。白鍵は ♯ も ♭ もない)
77
+ function whiteLetter(midi){ return "C D EF G A B".charAt(((midi % 12) + 12) % 12); }
78
+ // 段階 1 つの音:鍵盤 1 つに 1 つ。t は keys ごと(なければ 0)。dur は step.dur → 全体の dur → 次の(より遅い)t まで → 0.8 秒
79
+ function notes(step, dur){
80
+ var ts = (step.keys || []).map(function(_, i){ return step.t && typeof step.t[i] === "number" ? step.t[i] : 0; });
81
+ var d0 = typeof step.dur === "number" ? step.dur : typeof dur === "number" ? dur : null;
82
+ return step.keys.map(function(key, i){
83
+ var k = parseKey(key), t = ts[i], later = ts.filter(function(u){ return u > t + 1e-9; }), next = later.length ? Math.min.apply(null, later) : null;
84
+ return {t: t, sound: "note", pitch: k ? k.name : String(key), dur: d0 !== null ? d0 : next !== null ? +(next - t).toFixed(6) : 0.8, vel: 0.7};
85
+ });
86
+ }
87
+ // 段階の長さ:最後の音の終わり
88
+ function length(step, dur){ return notes(step, dur).reduce(function(a, n){ return Math.max(a, n.t + n.dur); }, 0); }
89
+ // 段階 k・時刻 t の鍵盤ごとの状態(render が描く。DOM を使わない)。steps は plan の段階(keys は parseKey の結果、ev は notes)。
90
+ // o = {cumulative, preview, variant, prog(t, at, len)}。{midi: {e: 今の段階の光の進み 0〜1, p: 動きの進み, tone, ids: {綴り: e},
91
+ // faded: 前の段階で光った(cumulative), fadeTone, fids, pre: 先の段階で光る(授業の表示で薄く。印なし), preTone}}
92
+ function state(steps, k, t, o){
93
+ var st = {}, cur = steps[k - 1];
94
+ var get = function(m){ return st[m] || (st[m] = {e: 0, p: 0, faded: false, pre: false, tone: null, fadeTone: null, preTone: null, ids: {}, fids: {}}); };
95
+ if (o.cumulative) for (var j = 0; j < k - 1 && j < steps.length; j++){
96
+ var sj = steps[j];
97
+ sj.keys.forEach(function(kk){ var s = get(kk.midi); s.faded = true; s.fadeTone = sj.tone; s.fids[kk.midi + "|" + kk.acc] = true; });
98
+ }
99
+ if (cur) cur.keys.forEach(function(kk, i){
100
+ var n = cur.ev[i], len = o.variant === "light" ? Math.min(0.2, n.dur) : Math.min(0.3, n.dur);
101
+ var e = t === Infinity ? 1 : o.prog(t, n.t, len), s = get(kk.midi), id = kk.midi + "|" + kk.acc;
102
+ if (e >= s.e){ s.e = e; s.p = t === Infinity ? 1 : Math.max(0, Math.min(1, (t - n.t) / len)); }
103
+ s.tone = cur.tone; if (e > 0) s.ids[id] = Math.max(s.ids[id] || 0, e);
104
+ });
105
+ // 授業の表示:先の段階の鍵盤を薄く(いちばん近い段階の色。今・前の段階で光っている鍵盤はそのまま)
106
+ if (o.preview) for (var q = steps.length - 1; q >= Math.max(0, k); q--){
107
+ var sq = steps[q];
108
+ sq.keys.forEach(function(kk){ var s = get(kk.midi); if (s.e > 0 || s.faded) return; s.pre = true; s.preTone = sq.tone; });
109
+ }
110
+ return st;
111
+ }
112
+ return {state: state, parseKey: parseKey, parseRange: parseRange, cover: cover, keys: keys, label: label, whiteLetter: whiteLetter, notes: notes, length: length, LETTERS: LETTERS, BW: BW, BH: BH};
113
+ })();
114
+
115
+ var TONES = /^(term|emph|muted|accent2|fg|series-[1-4])$/;
116
+ // 字の幅(base の textWidth:font の要素の字で測った幅)
117
+ var est = function(s, size, font){ return base.textWidth(s, size, {font: font}); };
118
+ return class extends base.MotionElement {
119
+ static partName = "keyboard"; // the registry name (define meta name), for report prefixes
120
+ static variants = ["light", "press", "rise"];
121
+ static kb = KB;
122
+ static shape = {
123
+ schema: {type: "object", additionalProperties: false, required: ["range", "steps"], properties: {
124
+ range: {type: "string"}, names: {type: "string", enum: ["solfa", "abc", "iroha", "none"]}, cumulative: {type: "boolean"}, dur: {type: "number"},
125
+ steps: {type: "array", minItems: 1, items: {type: "object", additionalProperties: false, required: ["keys"], properties: {
126
+ keys: {type: "array", minItems: 1, items: {type: "string"}}, label: {type: "string"}, t: {type: "array", items: {type: "number"}},
127
+ tone: {type: "string"}, dur: {type: "number"}}}}}},
128
+ example: {range: "C4-C6", names: "solfa", steps: [{keys: ["C4", "E4", "G4"], label: "主和音(ドミソ)"}]},
129
+ note: {en: "range \"C4-C6\" (white keys at both ends, 1–3 octaves); steps [{keys: [\"C4\", \"E4\"], label, t: [seconds per key], tone, dur}]",
130
+ ja: "range \"C4-C6\"(両端は白鍵、1〜3 オクターブ)、steps [{keys: [\"C4\", \"E4\"], label, t: [鍵盤ごとの秒], tone, dur}]"},
131
+ };
132
+ static props = {};
133
+ get steps(){
134
+ if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
135
+ return this.plan().steps.length;
136
+ }
137
+ // 範囲と段階を読む(mount の前にも steps が要る)。範囲・鍵盤の名前・t の数が違えば Error(札が出る)
138
+ plan(){
139
+ if (this._plan) return this._plan;
140
+ var d = this.data || {}, notes = [];
141
+ var r = KB.parseRange(d.range), kb = KB.keys(r), outside = [];
142
+ // 音の長さ dur(全体と段階ごと)は 0 より長い秒数:0 以下は知らせて、書いていないものとする(次の t まで、なければ 0.8 秒)
143
+ var gdur = d.dur;
144
+ if (typeof gdur === "number" && !(gdur > 0)){ notes.push("[keyboard] dur " + gdur + " is not more than 0 seconds (ignored: each note lasts until the next t, or 0.8 s)"); gdur = undefined; }
145
+ var steps = d.steps.map(function(s0, j){
146
+ var s = s0;
147
+ if (typeof s0.dur === "number" && !(s0.dur > 0)){ notes.push("[keyboard] steps[" + j + "] dur " + s0.dur + " is not more than 0 seconds (ignored)"); s = Object.assign({}, s0); delete s.dur; }
148
+ var ks = s.keys.map(function(name){
149
+ var k = KB.parseKey(name);
150
+ if (!k) throw new Error("m-keyboard: steps[" + j + "] key \"" + name + "\" is not a key name (C4, F#3, Bb4, …)");
151
+ if (k.midi < r.lo.midi || k.midi > r.hi.midi) outside.push("steps[" + j + "] key " + name);
152
+ return k;
153
+ });
154
+ if (s.t && s.t.length !== s.keys.length) throw new Error("m-keyboard: steps[" + j + "] has " + s.keys.length + " keys but " + s.t.length + " times in t (one per key)");
155
+ if (s.t && s.t.some(function(v){ return !(v >= 0); })) throw new Error("m-keyboard: steps[" + j + "] t must be seconds ≥ 0");
156
+ if (s.tone !== undefined && !TONES.test(s.tone)) notes.push('[keyboard] steps[' + j + '] tone "' + s.tone + '" is not a theme colour (emph is used)');
157
+ var ev = KB.notes(s, gdur);
158
+ return {o: s, keys: ks, ev: ev, len: KB.length(s, gdur), tone: TONES.test(s.tone || "") ? s.tone : "emph"};
159
+ });
160
+ if (outside.length){
161
+ // 範囲の外の鍵:すべての鍵を覆う範囲を示す(範囲そのものではなく、段階の鍵だけから)
162
+ var lo = Infinity, hi = -Infinity;
163
+ steps.forEach(function(s){ s.keys.forEach(function(k){ lo = Math.min(lo, k.midi); hi = Math.max(hi, k.midi); }); });
164
+ var c = KB.cover(lo, hi);
165
+ throw new Error("m-keyboard: " + outside.join(", ") + (outside.length > 1 ? " are" : " is") + " outside range " + d.range + "; " +
166
+ (c ? "use " + c + " (covers every key in steps)" : "the keys in steps span " + (hi - lo) + " semitones, more than 3 octaves: split them over two keyboards"));
167
+ }
168
+ return (this._plan = {r: r, kb: kb, steps: steps, cumulative: d.cumulative === true, notes: notes});
169
+ }
170
+ duration(k){ var s = k >= 1 && this.plan().steps[k - 1]; return s ? s.len : 0; }
171
+ events(k){ var s = k >= 1 && this.plan().steps[k - 1]; return s ? s.ev.map(function(e){ return Object.assign({}, e); }) : []; }
172
+ mount(ctx){
173
+ var self = this, D = base, pl = this.plan(), kb = pl.kb, d = this.data || {};
174
+ this.variant = base.variant(this);
175
+ // 鍵盤の名前:書いていなければ日本語の授業はドレミ、ほかは CDE(段階の数は変わらないので plan() ではなくここで選ぶ)
176
+ var names = d.names === undefined ? (/^ja\b/i.test(ctx.lang) ? "solfa" : "abc") : d.names;
177
+ pl.notes.forEach(function(n){ ctx.report("data", n); });
178
+ this.style.display = "block";
179
+ var W = this.clientWidth, H = this.clientHeight;
180
+ var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
181
+ // 読み上げ:最後の形で光っている鍵盤(cumulative なら全部の段階の)を 1 文で。作者の aria-label があればそれを使う(上書きしない)
182
+ var ja = /^ja\b/i.test(ctx.lang || "ja");
183
+ if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
184
+ this.setAttribute("role", "img");
185
+ if (!this._aria) this.setAttribute("aria-label", this.summary(ja, names === "none" ? (ja ? "solfa" : "abc") : names));
186
+ var hasLabel = pl.steps.some(function(s){ return s.o.label; });
187
+ // 光る黒鍵の名前の行:となりの名前に重なるなら 2 行目へ(どの段階でも同じ置き場所)
188
+ var LFS = 30, NFS = 26, BFS = 24;
189
+ var unitW = Math.max(0, Math.min((W - 6) / kb.n, 96));
190
+ var x0 = (W - unitW * kb.n) / 2;
191
+ var bl = {};
192
+ pl.steps.forEach(function(s){ s.keys.forEach(function(k){ if (!k.white && names !== "none") bl[k.midi + "|" + k.acc] = k; }); });
193
+ var blist = Object.keys(bl).map(function(id){
194
+ var k = bl[id], key = kb.all.filter(function(q){ return q.midi === k.midi; })[0], s = KB.label(k, names);
195
+ return {id: id, k: k, s: s, cx: x0 + key.cx * unitW, w: est(s, BFS, self)};
196
+ }).sort(function(a, b){ return a.cx - b.cx || a.id.localeCompare(b.id); });
197
+ var rowsEnd = [-1e9, -1e9], nRows = 0;
198
+ blist.forEach(function(b){
199
+ var row = b.cx - b.w / 2 > rowsEnd[0] + 10 ? 0 : 1;
200
+ if (row === 1 && b.cx - b.w / 2 <= rowsEnd[1] + 10) ctx.report("size", "[keyboard] the names of black keys near " + b.s + " overlap (use a wider element or a narrower range)");
201
+ rowsEnd[row] = b.cx + b.w / 2; b.row = row; nRows = Math.max(nRows, row + 1);
202
+ });
203
+ // cumulative:段階の名前を、その段階の鍵盤の真ん中の上に残す(前の段階の名前も消さない。色だけで見分けないように)。
204
+ // 名前が重なれば次の行へ(行は 40 px)
205
+ var cumLabs = pl.cumulative && hasLabel ? [] : null, labRows = 1;
206
+ if (cumLabs) pl.steps.forEach(function(s, j){
207
+ if (!s.o.label) return;
208
+ var xs = s.keys.map(function(k){ var key = kb.all.filter(function(q){ return q.midi === k.midi; })[0]; return x0 + (key.white ? key.x + 0.5 : key.cx) * unitW; });
209
+ var w = est(s.o.label, LFS, self), cx = (Math.min.apply(null, xs) + Math.max.apply(null, xs)) / 2;
210
+ cx = Math.max(w / 2 + 2, Math.min(W - w / 2 - 2, cx));
211
+ var row = 0;
212
+ while (cumLabs.some(function(o){ return o.row === row && Math.abs(o.cx - cx) < (o.w + w) / 2 + 16; })) row++;
213
+ cumLabs.push({j: j, s: s.o.label, w: w, cx: cx, row: row, tone: s.tone}); labRows = Math.max(labRows, row + 1);
214
+ });
215
+ var labH = hasLabel ? 46 + (labRows - 1) * 40 : 0, bnH = nRows * 32, namesH = names === "none" ? 0 : 40, gapTop = nRows ? 8 : (hasLabel ? 10 : 0);
216
+ var avail = H - labH - bnH - gapTop - namesH - 8;
217
+ var keyH = Math.max(0, Math.min(avail, unitW * 4.4));
218
+ if (avail < 110) ctx.report("size", "[keyboard] the element (" + W + "×" + H + " px) leaves only " + Math.round(avail) + " px for the keys; make it taller (about " + Math.ceil(H + 110 - avail) + " px)");
219
+ if (unitW < 40) ctx.report("size", "[keyboard] white keys are " + unitW.toFixed(0) + " px wide; the names under them may not fit (use a narrower range or a wider element)");
220
+ var used = labH + bnH + gapTop + keyH + namesH, top0 = Math.max(0, (H - used) / 2);
221
+ var labY = top0 + 34, bnTop = top0 + labH, keyTop = bnTop + bnH + gapTop, keyBot = keyTop + keyH, bH = keyH * KB.BH;
222
+ this.geo = {x0: x0, unitW: unitW, keyTop: keyTop, keyH: keyH};
223
+ // 鍵盤:白鍵 → 白鍵の光 → 黒鍵 → 黒鍵の光(黒鍵は短く、上に)
224
+ var gW = D.el("g", {}, svg), gB = D.el("g", {}, svg), gT = D.el("g", {}, svg);
225
+ var K = this.K = {};
226
+ var rise = this.variant === "rise";
227
+ kb.all.forEach(function(key){
228
+ var white = key.white, x = x0 + key.x * unitW, w = key.w * unitW, h = white ? keyH : bH;
229
+ var par = white ? gW : gB, g = D.el("g", {}, par);
230
+ D.el("rect", {x: x.toFixed(1), y: keyTop.toFixed(1), width: w.toFixed(1), height: h.toFixed(1), rx: white ? 4 : 3,
231
+ fill: white ? "var(--bg)" : "var(--fg)", stroke: "var(--fg)", "stroke-width": white ? 2 : 1.5}, g);
232
+ var ins = white ? 3 : 4;
233
+ var lit = D.el("rect", {x: (x + ins).toFixed(1), y: (keyTop + (white ? 2 : 0)).toFixed(1), width: Math.max(0, w - 2 * ins).toFixed(1), height: Math.max(0, h - ins - (white ? 2 : 0)).toFixed(1), rx: 2, opacity: 0}, g);
234
+ var cx = x + w / 2, r = white ? Math.min(9, w * 0.16) : Math.min(7, w * 0.2), cy = keyTop + h - (white ? 14 + r : 10 + r);
235
+ var dot = D.el("circle", {cx: cx.toFixed(1), cy: cy.toFixed(1), r: r.toFixed(1), opacity: 0}, g);
236
+ K[key.midi] = {key: key, g: g, lit: lit, dot: dot, y: keyTop + (white ? 2 : 0), h: Math.max(0, h - ins - (white ? 2 : 0)), white: white, nm: null, bn: {}};
237
+ });
238
+ // 白鍵の名前(鍵盤の下)
239
+ if (names !== "none") kb.whites.forEach(function(key){
240
+ var s = KB.label({letter: KB.whiteLetter(key.midi), acc: ""}, names);
241
+ var t = D.el("text", {x: (x0 + (key.x + 0.5) * unitW).toFixed(1), y: (keyBot + 32).toFixed(1), "font-size": NFS, "text-anchor": "middle", fill: "var(--fg)"}, gT);
242
+ t.textContent = s;
243
+ K[key.midi].nm = t;
244
+ });
245
+ // 光る黒鍵の名前(鍵盤の上。光っているときだけ)
246
+ blist.forEach(function(b){
247
+ var t = D.el("text", {x: b.cx.toFixed(1), y: (bnTop + 25 + (nRows - 1 - b.row) * 32).toFixed(1), "font-size": BFS, "font-weight": 700, "text-anchor": "middle", fill: "var(--fg)", opacity: 0}, gT);
248
+ t.textContent = b.s;
249
+ K[b.k.midi].bn[b.id] = t;
250
+ });
251
+ // 段階の名前(鍵盤の上、24 px 以上)
252
+ this.lab = D.el("text", {x: (W / 2).toFixed(1), y: labY.toFixed(1), "font-size": LFS, "font-weight": 700, "text-anchor": "middle", fill: "var(--fg)", opacity: 0}, gT);
253
+ // cumulative の段階の名前:字と、その段階の色の下線(鍵盤の光と同じ色)
254
+ this.cumLabs = cumLabs && cumLabs.map(function(o){
255
+ var g = D.el("g", {opacity: 0}, gT), y = labY + o.row * 40;
256
+ var tx = D.el("text", {x: o.cx.toFixed(1), y: y.toFixed(1), "font-size": LFS, "font-weight": 700, "text-anchor": "middle", fill: "var(--fg)"}, g);
257
+ tx.textContent = o.s;
258
+ D.el("rect", {x: (o.cx - o.w / 2).toFixed(1), y: (y + 6).toFixed(1), width: o.w.toFixed(1), height: 4, rx: 2, fill: "var(--" + o.tone + ")"}, g);
259
+ return {j: o.j, g: g, tx: tx};
260
+ });
261
+ pl.steps.forEach(function(s, j){ if (s.o.label && est(s.o.label, LFS, self) > W) ctx.report("size", "[keyboard] steps[" + j + "] label is wider than the element; shorten it"); });
262
+ if (rise) Object.keys(K).forEach(function(m){ K[m].lit.setAttribute("data-y", K[m].y); });
263
+ }
264
+ // 最後の形を 1 文で(読み上げの名前):「鍵盤:ド・ミ・ソ(Ⅰ)」。cumulative なら全部の段階を順に、そうでなければ最後の段階
265
+ summary(ja, names){
266
+ var pl = this.plan(), st = pl.cumulative ? pl.steps : pl.steps.slice(-1);
267
+ return (ja ? "鍵盤:" : "Keyboard: ") + st.map(function(s){
268
+ return s.keys.map(function(k){ return KB.label(k, names); }).join(ja ? "・" : ", ") + (s.o.label ? (ja ? "(" + s.o.label + ")" : " (" + s.o.label + ")") : "");
269
+ }).join(ja ? "、" : "; ");
270
+ }
271
+ render(k, t, ctx){
272
+ var pl = this.plan(), K = this.K, v = this.variant, cur = pl.steps[k - 1];
273
+ // 薄さはテーマの --preview-opacity(仕様 §8.4「Answers under preview」)。書いていないテーマだけ 0.45
274
+ var preview = !!ctx.preview, FAINT = preview ? base.previewOpacity(this) : 0.45;
275
+ var st = KB.state(pl.steps, k, t, {cumulative: pl.cumulative, preview: preview, variant: v, prog: base.prog});
276
+ Object.keys(K).forEach(function(m){
277
+ var o = K[m], s = st[m] || {e: 0, faded: false, pre: false, ids: {}, fids: {}}, on = s.e > 0;
278
+ var tone = on ? s.tone : s.faded ? s.fadeTone : s.preTone;
279
+ o.lit.setAttribute("fill", "var(--" + (tone || "emph") + ")");
280
+ var op = on ? (s.faded ? Math.max(0.4, v === "light" ? s.e : 1) : v === "light" ? s.e : 1) : s.faded ? 0.4 : s.pre ? FAINT : 0;
281
+ // rise:光が鍵盤の下から上へ満ちる
282
+ if (v === "rise"){
283
+ var f = on ? (s.faded ? 1 : s.e) : 1, h = o.h * f;
284
+ o.lit.setAttribute("y", (o.y + o.h - h).toFixed(1)); o.lit.setAttribute("height", h.toFixed(1));
285
+ }
286
+ o.lit.setAttribute("opacity", op.toFixed(3));
287
+ // 印:今の段階は塗った丸、前の段階は輪(色だけに頼らない)
288
+ o.dot.setAttribute("fill", on ? "var(--bg)" : "none");
289
+ o.dot.setAttribute("stroke", on ? "none" : o.white ? "var(--fg)" : "var(--bg)");
290
+ o.dot.setAttribute("stroke-width", on ? 0 : 2.5);
291
+ o.dot.setAttribute("opacity", (on ? (v === "press" ? 1 : s.e) : s.faded ? 0.9 : 0).toFixed(3));
292
+ // press:少し沈んで戻る(4 px、0.3 秒まで)
293
+ var dy = v === "press" && on && s.p < 1 ? 4 * Math.sin(Math.PI * s.p) : 0;
294
+ o.g.setAttribute("transform", dy ? "translate(0," + dy.toFixed(2) + ")" : "");
295
+ for (var id in o.bn){
296
+ var a = s.ids[id] ? (v === "light" ? s.ids[id] : 1) : 0;
297
+ if (!a && s.fids[id]) a = 0.75;
298
+ o.bn[id].setAttribute("opacity", a.toFixed(3));
299
+ }
300
+ });
301
+ var lab = cur && cur.o.label, la = lab ? (t === Infinity ? 1 : base.prog(t, 0, Math.min(0.3, cur.len || 0.3))) : 0;
302
+ if (this.cumLabs){
303
+ // cumulative:前の段階の名前はそのまま、今の段階の名前は太字でフェードして現れる
304
+ this.lab.textContent = ""; this.lab.setAttribute("opacity", 0);
305
+ this.cumLabs.forEach(function(o){
306
+ o.g.setAttribute("opacity", (o.j < k - 1 ? 1 : o.j === k - 1 ? la : 0).toFixed(3));
307
+ o.tx.setAttribute("font-weight", o.j === k - 1 ? 700 : 400);
308
+ });
309
+ return;
310
+ }
311
+ this.lab.textContent = lab || "";
312
+ this.lab.setAttribute("opacity", lab ? la.toFixed(3) : 0);
313
+ }
314
+ };
315
+ });
@@ -0,0 +1,53 @@
1
+ ---
2
+ summary: Grid of slide-link cards (contents); plain <a href="#<slide id>">; visited mark
3
+ steps: ceil(cards / per-step) (per-step="0": 0)
4
+ props:
5
+ cols: columns (0 = auto)
6
+ per-step: cards per step (0 = all, no steps)
7
+ size: title px
8
+ fade: appear (s)
9
+ stagger: card offset (s)
10
+ visited: mark visited cards
11
+ example: "<a href=\"#s-abc123\" data-sub=\"Subtitle\">Title</a>"
12
+ ---
13
+
14
+ Contents; choosing where to start.
15
+ <!-- llm: omit -->
16
+ Cards are plain child links; the part only styles them (grid, circle, subtitle, mark). Clicks are handled by the runtime (`kit/deck.js`)
17
+ ([format spec §9.1A](https://github.com/egatari/egatari-spec/blob/main/egatari-1.0.md#91a-links-to-slides), `docs/contract.md` §9).
18
+
19
+ <!-- llm: end -->
20
+ ```html
21
+ <m-menu cols="3" aria-label="Today">
22
+ <a href="#s-njd4kp" data-icon="1" data-sub="Poet">Poem A</a>
23
+ <a href="#s-uhqygr:2" data-icon="2" data-sub="Order">Poem B</a>
24
+ <a href="lesson2.ega.html" data-sub="Next">Drill</a>
25
+ </m-menu>
26
+ ```
27
+
28
+ - One child `<a href>` = one card. `href`: `#<slide id>` (step 0) or `#<id>:<step>` (`0`, `1`, … `concl`); ids from `npm run ids`; content = title
29
+ - `data-icon`: circle text (`1`, `A`). `data-sub`: subtitle
30
+ <!-- llm: omit -->
31
+ - Links to other files (`other.ega.html#s-…`): plain links, "other file" mark bottom right; not bundled into the single .ega.html
32
+ - Click: presenting = that step's final state; autoplay continues from there. "Back" top left (Backspace, Alt+←, browser back)
33
+ - Visited mark: ✓ top right once the target slide was opened this session (not saved; not in video or print).
34
+ Viewer-side state outside (i, k, t) (like `m-kobun` cards). `visited="false"` disables
35
+ <!-- llm: end -->
36
+ - `per-step="n"`: n cards per step (from `data-from`). `0` = all at once
37
+ <!-- llm: omit -->
38
+ Cards not shown yet cannot be pressed, focused or read.
39
+ <!-- llm: end -->
40
+ - `cols` default: ≤ 3 cards 1 row, 4 → 2, more → 3. Min height `--mm-h` (104px), gap `--mm-gap` (18px). Fill, centred: `style="height:100%;align-content:center;--mm-h:150px"`
41
+ <!-- llm: omit -->
42
+ - Text: title `size` (34px), subtitle 0.8× (≥ 27px body minimum). Circle `--term`, subtitle `--muted`. `stagger` within a step; depends on (k, t) only
43
+ <!-- llm: end -->
44
+
45
+ The demo is `demo.html`; also slide 2 of `examples/kokugo-kanbun`.
46
+
47
+ <!-- llm: omit -->
48
+ Notes
49
+
50
+ - Without scripts (readable layer, pre-print HTML) it reads as a plain list of links
51
+ - The part wraps title, subtitle, circle in `span`s but leaves `<a>` and `href` as written
52
+ - No CSS transitions (real time would break (k, t))
53
+ <!-- llm: end -->