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,222 @@
1
+ // m-compare:2 つ(3 つまで)を横に並べて比べる表。列ごとに見出し、行ごとに比べる観点、最後に行ごとの違い
2
+ // <m-compare style="height:420px"><script type="application/json">
3
+ // {"sides": [{"label": "紙の申請", "tone": "muted"}, {"label": "オンライン申請"}],
4
+ // "rows": [{"label": "受付時間", "values": ["平日 9〜17 時", "24 時間"], "better": 1, "diff": "いつでも出せる"}, …]}
5
+ // (JSON の終わり)</m-compare>
6
+ // 段階:既定は 一方の列 → もう一方の列(→ 3 つ目の列)→ 違い(diff の列と better の枠)。違いのない表は列の数だけ
7
+ // 観点の名前(行の名前)は最初の列と一緒に出る。値は列の幅で折り返す(字数から幅を見積もる。\n で改行)
8
+ // 字は size(既定 28 px)から 24 px まで縮めて要素の箱に収める。収まらなければ ctx.report(size)
9
+ // 見せ方(docs/conventions.md §1):fade(既定。列が少し上がりながら現れる)・slide(列が自分の側から横に寄って現れる)・
10
+ // reveal(列の中を上の行から 1 行ずつ)。どれも動く距離(16 px)と長さ(dur)は同じで、段階の数・長さ・最後の中身は変わらない
11
+ // 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・mtext・prog・lerp・variant・previewOpacity を使い、プレイヤーのグローバルは使わない。
12
+ // 違いの列の既定の見出しの言語は ctx.lang(mount で読む)。収まらない表は ctx.report で知らせる(1.x の console.warn の代わり)
13
+ egatariParts.define({name: "compare", version: "2.0.4", requires: {base: "1.2.0"}, element: "m-compare"}, function(deps){
14
+ "use strict";
15
+ var base = deps.base;
16
+ return class extends base.MotionElement {
17
+ static partName = "compare"; // the registry name (define meta name), for report prefixes
18
+ static variants = ["fade", "slide", "reveal"];
19
+ // データの形(kit/shape.js)
20
+ static shape = {
21
+ schema: {type: "object", additionalProperties: false, required: ["sides", "rows"], properties: {
22
+ sides: {type: "array", minItems: 2, maxItems: 3, items: {type: "object", additionalProperties: false, required: ["label"], properties: {
23
+ label: {type: "string"}, tone: {type: "string"}, step: {type: "integer"}}}},
24
+ rows: {type: "array", minItems: 1, items: {type: "object", additionalProperties: false, required: ["values"], properties: {
25
+ label: {type: "string"}, values: {type: "array", items: {type: ["string", "number"]}}, diff: {type: "string"}, better: {type: "integer"}}}}}},
26
+ example: {sides: [{label: "紙の申請", tone: "muted"}, {label: "オンライン申請"}],
27
+ rows: [{label: "受付時間", values: ["平日 9〜17 時", "24 時間"], better: 1, diff: "いつでも出せる"}]},
28
+ };
29
+ static props = {
30
+ size: {type: "number", default: 28, doc: "値の字の大きさ(px)。収まらなければ 24 まで縮める"},
31
+ dur: {type: "number", default: 0.6, doc: "1 つの列(と違い)が現れる秒数"},
32
+ "diff-label": {type: "string", default: "", doc: "違いの列の見出し(空なら「違い」)"},
33
+ };
34
+ get steps(){
35
+ if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
36
+ var d = this.data || {}, m = 0;
37
+ (d.sides || []).forEach(function(s, i){ m = Math.max(m, s.step || i + 1); });
38
+ return m + (this.hasDiff() ? 1 : 0);
39
+ }
40
+ hasDiff(){
41
+ return ((this.data || {}).rows || []).some(function(r){ return (r.diff !== undefined && r.diff !== "") || r.better !== undefined; });
42
+ }
43
+ mount(ctx){
44
+ var P = this.props, D = base, self = this, data = this.data || {sides: [], rows: []};
45
+ this.variant = base.variant(this);
46
+ // 形(static shape)では書けない決まり:values は列の数だけ、better は列の番号(0 から)。黙って値を落とさない
47
+ var ns = (data.sides || []).length;
48
+ (data.rows || []).forEach(function(r, j){
49
+ var nv = (r.values || []).length;
50
+ if (nv !== ns) throw new Error("m-compare: rows[" + j + "].values has " + nv + " value(s) but there are " + ns + " sides (write one value per side, in the order of sides)");
51
+ if (r.better !== undefined && !(r.better >= 0 && r.better < ns)) throw new Error("m-compare: rows[" + j + "].better is " + JSON.stringify(r.better) + " but it must be a side number from 0 to " + (ns - 1));
52
+ });
53
+ this.style.display = "block"; this.style.position = "relative";
54
+ var W = this.clientWidth, H = this.clientHeight;
55
+ var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
56
+ var sides = data.sides || [], rows = data.rows || [], n = sides.length;
57
+ var TONES = /^(term|emph|muted|accent2|series-[1-4])$/, DEF = ["term", "accent2", "series-4"];
58
+ var tone = function(s, i){ return "var(--" + (TONES.test(s.tone || "") ? s.tone : DEF[i] || "term") + ")"; };
59
+ var hasDiff = this.hasDiff(), hasDiffCol = rows.some(function(r){ return r.diff !== undefined && r.diff !== ""; });
60
+ this.ja = /^ja\b/i.test(ctx.lang);
61
+ var diffHead = P["diff-label"] || (this.ja ? "違い" : "Difference");
62
+ // 字の幅の見積もり(base の textWidth:テーマの字で測った幅。mtext で書くので *_^ は数えない。太字は 1.04 倍)
63
+ var est = function(s, fs, bold){ return D.textWidth(s, fs, {font: self, mark: true}) * (bold ? 1.04 : 1); };
64
+ // 折り返し:英数字の語はまとめ、行頭に来てはいけない字(、。)」など)の前では折らない。幅は 0.5 px まで超えてよい
65
+ // (列の幅はいちばん長い名前の見積もりで決まり、字ごとの和はその見積もりと浮動小数点の誤差だけ違うことがある)
66
+ var wrap = function(s, maxW, fs, bold){
67
+ var out = [], over = false;
68
+ String(s === undefined ? "" : s).split("\n").forEach(function(par){
69
+ var toks = par.match(/[A-Za-z0-9.,%+\-−:\/'’]+|\s+|[^]/gu) || [""], line = "", w = 0;
70
+ toks.forEach(function(tk){
71
+ var tw = est(tk, fs, bold), sp = /^\s+$/.test(tk);
72
+ if (line && w + tw > maxW + 0.5 && !sp && !/^[、。,.)」』!?ー々ゃゅょっャュョッぁぃぅぇぉ〜]/.test(tk)){ out.push(line.trim()); line = ""; w = 0; }
73
+ if (sp && !line) return;
74
+ line += tk; w += tw;
75
+ });
76
+ out.push(line.trim());
77
+ });
78
+ out.forEach(function(l){ if (est(l, fs, bold) > maxW + 0.5) over = true; });
79
+ return {lines: out, over: over};
80
+ };
81
+ // 字の大きさを size から 24 まで下げて、要素の箱に収まる配置を探す
82
+ var gap = 14, padX = 16, padY = 12, bar = 7, L = null;
83
+ // size が数でなければ既定の 28
84
+ var size0 = P.size;
85
+ if (!(typeof size0 === "number" && isFinite(size0))){ ctx.report("attr", "[compare] size=\"" + this.getAttribute("size") + "\" is not a number (28 is used)"); size0 = 28; }
86
+ for (var fs = Math.max(24, size0); fs >= 24; fs--){
87
+ L = (function(fs){
88
+ var lh = Math.round(fs * 1.3), hs = fs + 2, hlh = Math.round(hs * 1.25), over = false;
89
+ var anyLabel = rows.some(function(r){ return r.label; });
90
+ var lw = anyLabel ? Math.min(W * 0.24, Math.max(W * 0.1, Math.max.apply(null, rows.map(function(r){ return est(r.label || "", fs, true); })) + padX * 2)) : 0;
91
+ var dw = hasDiffCol ? Math.min(W * 0.3, Math.max(W * 0.18, Math.max.apply(null, rows.map(function(r){ return est(r.diff || "", fs, true); })) + padX * 2)) : 0;
92
+ var cw = Math.max(0, (W - lw - dw - gap * (n - 1 + (lw ? 1 : 0) + (dw ? 1 : 0))) / n);
93
+ var heads = sides.map(function(s){ var w = wrap(s.label, cw - padX * 2, hs, true); over = over || w.over; return w.lines; });
94
+ var cells = rows.map(function(r){
95
+ var lab = wrap(r.label || "", lw - padX * 2, fs, true), dif = wrap(r.diff || "", dw - padX * 2, fs, true);
96
+ var vals = sides.map(function(s, i){ var v = (r.values || [])[i]; return wrap(v === undefined || v === null ? "" : v, cw - padX * 2, fs, r.better === i); });
97
+ over = over || (lw && lab.over) || (dw && dif.over) || vals.some(function(v){ return v.over; });
98
+ var nl = Math.max(lw ? lab.lines.length : 1, dw ? dif.lines.length : 1, Math.max.apply(null, vals.map(function(v){ return v.lines.length; })));
99
+ return {lab: lab.lines, dif: dif.lines, vals: vals.map(function(v){ return v.lines; }), h: nl * lh + padY * 2};
100
+ });
101
+ var hh = bar + padY * 2 + Math.max.apply(null, heads.map(function(h){ return h.length; })) * hlh;
102
+ var tot = hh + cells.reduce(function(a, c){ return a + c.h; }, 0);
103
+ return {fs: fs, lh: lh, hs: hs, hlh: hlh, lw: lw, dw: dw, cw: cw, heads: heads, cells: cells, hh: hh, tot: tot, ok: !over && tot <= H};
104
+ })(fs);
105
+ if (L.ok) break;
106
+ }
107
+ if (!L.ok) ctx.report("size", "[compare] the table does not fit in " + W + "×" + H + " px even at 24 px (shorten the texts or make the element taller)");
108
+ // 余った高さは行に分ける(1 行につき字の行の高さまで。表は上にそろえる)
109
+ var extra = Math.max(0, Math.min((H - L.tot) / Math.max(1, rows.length), L.lh));
110
+ var ys = [], y = L.hh;
111
+ L.cells.forEach(function(c){ c.h += extra; ys.push(y); y += c.h; });
112
+ var tableH = y;
113
+ var x = 0, colX = {};
114
+ if (L.lw){ colX.label = x; x += L.lw + gap; }
115
+ colX.sides = sides.map(function(){ var x0 = x; x += L.cw + gap; return x0; });
116
+ if (L.dw) colX.diff = x;
117
+ var lastSide = 0;
118
+ sides.forEach(function(s, i){ lastSide = Math.max(lastSide, s.step || i + 1); });
119
+ var diffStep = lastSide + 1;
120
+ // 字の塊を (cx, 行の中央) に置く
121
+ var block = function(g, lines, xx, yc, anchor, attrs, lh){
122
+ var y0 = yc - (lines.length - 1) * lh / 2 + L.fs * 0.36;
123
+ lines.forEach(function(s, j){ if (s) D.mtext(g, xx, y0 + j * lh, s, Object.assign({"text-anchor": anchor, "font-size": L.fs}, attrs)); });
124
+ };
125
+ // 現れる単位(piece):{g, step, row(reveal の順。見出しは 0、行 j は j + 1), dir(slide の向き:-1 左から、1 右から、0 下から)}
126
+ var pieces = [], m = rows.length + 1;
127
+ var piece = function(step, row, dir){ var g = D.el("g", {opacity: 0}, svg); pieces.push({g: g, step: step, row: row, dir: dir}); return g; };
128
+ var sepLine = function(g, x0, w, yy){ D.el("line", {x1: x0, x2: x0 + w, y1: yy, y2: yy, stroke: "var(--line)", "stroke-width": 1.5}, g); };
129
+ // 左右の列は外から、3 つの列の真ん中は下から寄る
130
+ var dirOf = function(i){ return i === 0 ? -1 : i === n - 1 ? 1 : 0; };
131
+ // 観点の名前(最初の列と一緒に、その列の向きで)
132
+ var s0 = sides.length ? (sides[0].step || 1) : 1;
133
+ if (L.lw) L.cells.forEach(function(c, j){
134
+ var g = piece(s0, j + 1, -1);
135
+ block(g, c.lab, colX.label + padX * 0.5, ys[j] + c.h / 2, "start", {"font-weight": 700, fill: "var(--fg)"}, L.lh);
136
+ if (j < rows.length - 1) sepLine(g, colX.label, L.lw, ys[j] + c.h);
137
+ });
138
+ // 列:薄い地の札・上の帯・見出し、行ごとの値
139
+ sides.forEach(function(s, i){
140
+ var st = s.step || i + 1, col = tone(s, i), x0 = colX.sides[i], dir = dirOf(i);
141
+ var g = piece(st, 0, dir);
142
+ D.el("rect", {x: x0, y: 0, width: L.cw, height: tableH, rx: 12, fill: col, "fill-opacity": 0.07}, g);
143
+ D.el("rect", {x: x0, y: 0, width: L.cw, height: bar, rx: 3, fill: col}, g);
144
+ var hl = L.heads[i];
145
+ hl.forEach(function(t, j){
146
+ D.mtext(g, x0 + L.cw / 2, bar + padY + (L.hh - bar - padY * 2 - hl.length * L.hlh) / 2 + j * L.hlh + L.hlh / 2 + L.hs * 0.36, t,
147
+ {"text-anchor": "middle", "font-size": L.hs, "font-weight": 700, fill: col});
148
+ });
149
+ L.cells.forEach(function(c, j){
150
+ var gc = piece(st, j + 1, dir), r = rows[j];
151
+ block(gc, c.vals[i], x0 + L.cw / 2, ys[j] + c.h / 2, "middle", r.better === i ? {"font-weight": 700, fill: col} : {fill: "var(--fg)"}, L.lh);
152
+ sepLine(gc, x0 + 10, L.cw - 20, ys[j]);
153
+ });
154
+ });
155
+ // 違い:右の列(見出しと diff の字)と、better の値を囲む枠
156
+ if (hasDiff){
157
+ if (L.dw){
158
+ var gd = piece(diffStep, 0, 1);
159
+ D.el("rect", {x: colX.diff, y: 0, width: L.dw, height: tableH, rx: 12, fill: "var(--emph-tint)"}, gd);
160
+ D.el("rect", {x: colX.diff, y: 0, width: L.dw, height: bar, rx: 3, fill: "var(--emph)"}, gd);
161
+ D.mtext(gd, colX.diff + L.dw / 2, bar + (L.hh - bar) / 2 + L.hs * 0.36, diffHead, {"text-anchor": "middle", "font-size": L.hs, "font-weight": 700, fill: "var(--emph)"});
162
+ }
163
+ L.cells.forEach(function(c, j){
164
+ var r = rows[j], hasD = r.diff !== undefined && r.diff !== "", hasB = r.better !== undefined && r.better >= 0 && r.better < n;
165
+ if (!hasD && !hasB && !L.dw) return;
166
+ var g = piece(diffStep, j + 1, 1);
167
+ if (L.dw){
168
+ if (hasD) block(g, c.dif, colX.diff + padX, ys[j] + c.h / 2, "start", {"font-weight": 700, fill: "var(--emph)"}, L.lh);
169
+ D.el("line", {x1: colX.diff + 10, x2: colX.diff + L.dw - 10, y1: ys[j], y2: ys[j], stroke: "var(--line)", "stroke-width": 1.5}, g);
170
+ }
171
+ if (hasB) D.el("rect", {x: colX.sides[r.better] + 5, y: ys[j] + 5, width: Math.max(0, L.cw - 10), height: Math.max(0, c.h - 10), rx: 9, fill: "none", stroke: "var(--emph)", "stroke-width": 3}, g);
172
+ });
173
+ }
174
+ this.pieces = pieces; this.m = m;
175
+ // 読み上げ:最後の形(すべての列と行、違い)を 1 文で。作者の aria-label があればそれを使う(上書きしない)
176
+ if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
177
+ this.setAttribute("role", "img");
178
+ if (!this._aria) this.setAttribute("aria-label", this.summary(this.ja, diffHead));
179
+ }
180
+ // 最後の形を 1 文で(読み上げの名前):「紙の申請とオンライン申請の比較。受付時間:紙の申請 平日 9〜17 時、オンライン申請 24 時間(オンライン申請がよい。違い:いつでも出せる)」
181
+ summary(ja, diffHead){
182
+ var d = this.data || {}, sides = d.sides || [], one = function(v){ return String(v === undefined || v === null ? "" : v).replace(/\s*\n\s*/g, " ").replace(/\*/g, ""); };
183
+ var names = sides.map(function(s){ return one(s.label); });
184
+ var s = ja ? names.join("と") + "の比較" : "Comparison of " + names.join(" and ");
185
+ (d.rows || []).forEach(function(r){
186
+ var vs = sides.map(function(sd, i){ return names[i] + " " + one((r.values || [])[i]); }).join(ja ? "、" : ", ");
187
+ var ex = [];
188
+ if (r.better !== undefined && names[r.better] !== undefined) ex.push(ja ? names[r.better] + "がよい" : names[r.better] + " is better");
189
+ if (r.diff !== undefined && r.diff !== "") ex.push(one(diffHead) + (ja ? ":" : ": ") + one(r.diff));
190
+ s += (ja ? "。" : ". ") + (r.label ? one(r.label) + (ja ? ":" : ": ") : "") + vs + (ex.length ? (ja ? "(" + ex.join("。") + ")" : " (" + ex.join("; ") + ")") : "");
191
+ });
192
+ return s;
193
+ }
194
+ duration(k){
195
+ var d = 0, F = this.props.dur;
196
+ (this.pieces || []).forEach(function(p){ if (p.step === k) d = F; });
197
+ return d;
198
+ }
199
+ cues(){ return null; }
200
+ render(k, t, ctx){
201
+ var D = base, F = this.props.dur, vr = this.variant, m = this.m, lecture = !!ctx.preview;
202
+ // 先の段階の薄さ:テーマの --preview-opacity(ないときは 0.45)
203
+ var dim = lecture ? base.previewOpacity(this) : 0.45;
204
+ var TRAVEL = 16;
205
+ this.pieces.forEach(function(p){
206
+ // reveal:行ごとに F/2 秒ずつ、出だしを F/2 の中で上から順にずらす(全体で F 秒。fade と同じ長さ)
207
+ var at = 0, len = F;
208
+ if (vr === "reveal"){ len = F / 2; at = m > 1 ? p.row / (m - 1) * F / 2 : 0; }
209
+ var e = p.step < k ? 1 : p.step > k ? 0 : D.prog(t, at, len);
210
+ if (lecture){
211
+ p.g.setAttribute("opacity", (p.step > k ? dim : p.step === k ? D.lerp(dim, 1, e) : 1).toFixed(3));
212
+ p.g.removeAttribute("transform");
213
+ return;
214
+ }
215
+ p.g.setAttribute("opacity", e.toFixed(3));
216
+ var off = (1 - e) * TRAVEL, tr = "";
217
+ if (off > 0.01) tr = vr === "slide" && p.dir ? "translate(" + (p.dir * off).toFixed(2) + " 0)" : "translate(0 " + off.toFixed(2) + ")";
218
+ if (tr) p.g.setAttribute("transform", tr); else p.g.removeAttribute("transform");
219
+ });
220
+ }
221
+ };
222
+ });
@@ -0,0 +1,351 @@
1
+ // m-kanbun:白文に返り点・送り仮名を付け、訓読の順に読み、書き下し文にする(縦書き)
2
+ // <m-kanbun style="height:440px">
3
+ // 春眠不{=ず}レ覚(エ)レ暁(ヲ)
4
+ // 処処聞(ク)[二]啼鳥(ヲ)[一]
5
+ // </m-kanbun>
6
+ // 1 行が 1 列(句)。行の中の空白は読まない。字の後ろに付けるもの(順は問わない):
7
+ // (送り仮名) [返り点](レ・一二三四五・上中下・甲乙丙丁・天地人、一レ・上レ・甲レ・天レ)。レ点だけは [ ] なしの「レ」でもよい
8
+ // {振り仮名} {=かな}(書き下し文で平仮名にする字:不{=ず}、也{=なり}) {-}(置き字:読まない)
9
+ // (右|二度目) 再読文字:右の送り仮名と二度目の読み(未(ダ|ず)、将(ニ|ス))。二度目の読みの片仮名は左の送り仮名として出す
10
+ // 字-字 竪点(続けて読む熟語。返り点はまとまり全体に効く) 、。 句読点(白文では出さない)
11
+ // 段階(phases の順。既定は kunten order kaki):段階 0 は白文 → kunten 訓点(返り点・送り仮名)→ order 読む順(目が字を順にたどり、
12
+ // 返り点で上へ戻るところに弧を描く)→ kaki 書き下し文(左に縦書きで)。読む順の計算は kanbun-core の order(試験は tools/test-kokugo.mjs)
13
+ // order は既定(order-by="col")で列(句)ごとに 1 段階:読む順の字を、字の列が変わるところで切る。order-by="all" で全体を 1 段階(v1.3.0 まで)
14
+ // 2.0(Egatari spec §6.1 の部品):base の MotionElement・prog・lerp・previewOpacity と、読み取り・訓読の順の kanbun-core を使い、
15
+ // プレイヤーのグローバルは使わない。書き方の誤りは ctx.report("data", "[kanbun] …")、要素に収まらないときは
16
+ // ctx.report("size", "[kanbun] …") で知らせる(1.x の console.warn("m-kanbun: …") の代わり)
17
+ egatariParts.define({name: "kanbun", version: "2.0.4", requires: {base: "1.3.0", "kanbun-core": "1.0.0"}, element: "m-kanbun"}, function(deps){
18
+ "use strict";
19
+ var base = deps.base;
20
+ var D = base;
21
+
22
+ // ---------------------------------------------------------------- 読み取りと訓読の順(kanbun-core)
23
+ var K = deps["kanbun-core"];
24
+ var parse = K.parse, order = K.order, charEvents = K.charEvents, kakikudashi = K.kakikudashi, stepGroups = K.stepGroups;
25
+ var plain = function(line){ return line.map(function(s){ return s.t; }).join(""); };
26
+
27
+ // ---------------------------------------------------------------- 部品
28
+ var PH = ["kunten", "order", "kaki"];
29
+ // 長い送り仮名を詰める:fit は自然の長さ(字数 × 字の大きさ)に対する割合。まず字間を詰め(1 字につき字の大きさの 0.12 まで)、
30
+ // 残りを縦に縮める(transform。字の大きさ・字の幅は変えない)。OK_MIN より詰めない(それより長ければ次の字を下げる)
31
+ var OK_MIN = 0.78, OK_TRACK = 0.12, GAP_OK = 8, OK_DELAY = 0.36;
32
+ // 要素に収めるときの字の大きさの下限(px)。振り仮名・送り仮名・返り点は 24px のままなので、これより小さいと
33
+ // 返り点が隣の列の送り仮名に 4px より近づく(列の間 1.3 字 = 返り点と送り仮名 2 つ分の 48px + 3px + 4px)
34
+ var FIT_MIN = 42;
35
+ // 高さは要素を FIT_SLACK px まで超えてよい(最後の仮名の字の枠の下の余白。見本の『史記』は size=56 で 4.4px 超えていて、これまでどおりに描く)
36
+ var FIT_SLACK = 6;
37
+ // 二桁の番号を横に縮めてよい割合の下限(これより狭い箱では字の大きさを下げる)
38
+ var NUM_SQ = 0.75;
39
+ function okSquash(n, F, fit){
40
+ if (!(fit < 0.999) || !n) return "";
41
+ var ls = Math.max(-OK_TRACK * F, (fit - 1) * F), sy = fit * F / (F + ls);
42
+ return ";letter-spacing:" + ls.toFixed(2) + "px" + (sy < 0.999 ? ";transform:scaleY(" + sy.toFixed(3) + ");transform-origin:50% 0" : "");
43
+ }
44
+ return class extends base.MotionElement {
45
+ static partName = "kanbun"; // the registry name (define meta name), for report prefixes
46
+ // データの形(kit/shape.js):JSON ではなく、要素の中に 1 行 1 句の字(送り仮名 (…)・返り点 […])
47
+ static shape = {text: true, example: "学(ビテ)而{-}時(ニ)習(フ)[レ]之(ヲ)"};
48
+ static props = {
49
+ size: {type: "number", default: 60, doc: "漢字の大きさ(px)。送り仮名・返り点はその 0.42 倍(24px より小さくしない)"},
50
+ slot: {type: "number", default: 0.55, doc: "読む順で 1 字にかける秒数"},
51
+ phases: {type: "string", default: "kunten order kaki", doc: "ステップの並び(kunten 訓点・order 読む順・kaki 書き下し文から選ぶ)"},
52
+ kaki: {type: "number", default: 36, doc: "書き下し文の字の大きさ(px)"},
53
+ nums: {type: "bool", default: true, doc: "読む順の番号を字の左上に出す"},
54
+ "order-by": {type: "string", default: "col", doc: "読む順のステップの分け方:col は列(句)ごとに 1 ステップ、all は読む順の全体で 1 ステップ(v1.3.0 まで)"},
55
+ };
56
+ get phaseList(){
57
+ var a = String(this.props.phases || "").split(/[\s,]+/).filter(function(x){ return PH.indexOf(x) >= 0; });
58
+ return a.length ? a : PH.slice();
59
+ }
60
+ // 読み取りと読む順(段階の数を決めるので mount の前にも読む)。groups:読む順の段階ごとの字の事柄の範囲(stepGroups)
61
+ get kd(){
62
+ if (!this._kd){
63
+ var p = parse(this._src !== undefined ? this._src : this.textContent), o = order(p.chars), ce = charEvents(o);
64
+ this._kd = {p: p, o: o, ce: ce, groups: stepGroups(p.chars, ce, this.props["order-by"])};
65
+ }
66
+ return this._kd;
67
+ }
68
+ // 段階の並び:phases の各段階。order は groups の数だけ({name, g})
69
+ get stepList(){
70
+ var G = this.kd.groups;
71
+ return this.phaseList.reduce(function(a, name){ return a.concat(name === "order" ? G.map(function(g){ return {name: name, g: g}; }) : [{name: name}]); }, []);
72
+ }
73
+ get steps(){ return this.getAttribute("steps") !== null ? +this.getAttribute("steps") : this.stepList.length; }
74
+ // 段階 name の(最初の)番号(1 から)。phases になければ 0
75
+ phaseStep(name){ var L = this.stepList; for (var i = 0; i < L.length; i++) if (L[i].name === name) return i + 1; return 0; }
76
+ mount(ctx){
77
+ var self = this, P = this.props;
78
+ this._src = this.textContent;
79
+ var kd = this.kd, p = kd.p, o = kd.o, kaki = kakikudashi(p.chars, o);
80
+ p.warnings.concat(o.warnings).forEach(function(w){ ctx.report("data", "[kanbun] " + w); });
81
+ this.k = {p: p, o: o, ce: kd.ce, kaki: kaki, groups: kd.groups};
82
+ this.textContent = "";
83
+ this.classList.add("plot", "kanbun");
84
+ this.style.display = "block"; this.style.position = "relative";
85
+ this.setAttribute("role", "img");
86
+ // 読み上げの名前:最後の形(白文と、kaki の段階があれば書き下し文)。作者の aria-label があればそれを使う(上書きしない)
87
+ if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
88
+ if (!this._aria) this.setAttribute("aria-label", "漢文:" + p.chars.map(function(c){ return c.ch; }).join("") + (this.phaseList.indexOf("kaki") >= 0 ? "。書き下し文:" + kaki.map(plain).join("") : ""));
89
+ // ---- 配置:列は右から左へ。列の中は 左の欄(返り点・再読の左の送り仮名)・漢字・右の欄(振り仮名・送り仮名)
90
+ // lay(S):字の大きさ S で並べる(字の位置を p.chars に書き、寸法を返す)。B は字の下端(振り仮名・送り仮名・返り点・句読点を含む)
91
+ var S, F, L, R, G, PITCH, cols, H, XR;
92
+ var lay = function(S0){
93
+ S = S0; F = Math.max(24, Math.round(S * 0.42));
94
+ L = Math.round(S * 0.5); R = Math.round(S * 0.5); G = Math.round(S * 0.3); PITCH = L + S + R + G;
95
+ cols = []; H = 0;
96
+ p.chars.forEach(function(c, n){
97
+ var col = cols[c.col] = cols[c.col] || {y: 0, rEnd: 0, lEnd: 0, list: [], prevOk: null};
98
+ // 前の字の右と左の欄の終わりにぶつからないところまで下げる
99
+ var rStart = c.ruby ? 0 : S * 0.52, lStart = S * 0.5;
100
+ // 番号(左上)を出すときは、前の字の左の欄(一レ点・再読文字の左の送り仮名)の下から始める
101
+ var y = Math.max(col.y, col.lEnd - (P.nums ? 0 : lStart) + 2);
102
+ // 右の欄:前の字の送り仮名は、この字を下げずに収まるように詰める(印刷の組み方:字間を詰め、それでも長ければ縦に縮める。
103
+ // 字の大きさは変えない)。この字に振り仮名も送り仮名もなければ、この字の右の欄の 0.8 まではみ出してよい。
104
+ // 振り仮名は前の字の送り仮名から少し離す(続けて読まないように)。縮めきっても入らないときだけ下げる
105
+ var pk = col.prevOk;
106
+ if (pk){
107
+ // 次の字の送り仮名は下で OK_DELAY まで下げうるので、ここではそれを見込む(足りなければ下で後ろの字をまとめて下げる)
108
+ var room = c.ruby ? -10 : c.okuri ? rStart - GAP_OK + S * OK_DELAY : S * 0.8;
109
+ var need = pk.len * OK_MIN;
110
+ y = Math.max(y, pk.top + need - room);
111
+ pk.c.okFit = Math.min(1, (y + room - pk.top) / pk.len);
112
+ } else y = Math.max(y, col.rEnd - rStart + (c.ruby ? 10 : 6));
113
+ c.y = y; c.n = n;
114
+ var rr = y + (c.ruby ? 0 : S * 0.52);
115
+ if (c.ruby){ c.rubyY = y + Math.max(0, (S * 0.52 - Array.from(c.ruby).length * F) / 2); rr = Math.max(y + S * 0.52, c.rubyY + Array.from(c.ruby).length * F); }
116
+ c.okY = rr; c.okFit = 1;
117
+ var okLen = Array.from(c.okuri).length * F;
118
+ col.rEnd = rr + okLen; col.prevOk = okLen ? {c: c, top: rr, len: okLen} : null;
119
+ var ll = y + S * 0.5, leftKana = c.second ? (c.second.match(/[ァ-ヶー]/g) || []).join("") : "";
120
+ c.leftKana = leftKana; c.lkY = ll; ll += Array.from(leftKana).length * F;
121
+ // 返り点は左下:字の下端をまたぐところ(天を字の 0.72 の高さに)
122
+ c.kaeriY = Math.max(ll, y + S * 0.72); c.kaeriN = (c.mark ? 1 : 0) + (c.re ? 1 : 0);
123
+ col.lEnd = c.kaeriN ? c.kaeriY + c.kaeriN * F * 0.92 : ll;
124
+ col.y = y + S * 1.2 + (c.punct ? S * 0.42 : 0) + (c.join ? S * 0.22 : 0);
125
+ col.list.push(n);
126
+ H = Math.max(H, col.y, col.rEnd, col.lEnd);
127
+ });
128
+ // 右の欄の送り仮名を列ごとに置き直す(字の位置は上で決まったまま)。送り仮名は字の下半分から始め、長ければ詰める。
129
+ // 次の字の送り仮名がその次の字までに楽に収まるなら、次の字の送り仮名を字の 0.36(OK_DELAY)まで下げて、前の長い送り仮名に場所を譲る
130
+ var okLen = function(c){ return Array.from(c.okuri).length * F; };
131
+ cols.forEach(function(col){
132
+ var L2 = col.list.map(function(n){ return p.chars[n]; }), prevEnd = -Infinity;
133
+ // 字 i の送り仮名の終わりの上限(次の字の振り仮名・送り仮名・字そのもの)。delay:次の字の送り仮名を下げる量
134
+ var limitOf = function(i, delay){
135
+ var d = L2[i + 1];
136
+ if (!d) return Infinity;
137
+ return d.ruby ? d.rubyY - 10 : d.okuri ? d.okY + delay - GAP_OK : d.y + S * 0.8;
138
+ };
139
+ L2.forEach(function(c, i){
140
+ if (!c.okuri) return;
141
+ var top = Math.max(c.okY, prevEnd + GAP_OK), len = okLen(c), d = L2[i + 1], delay = 0;
142
+ if (d && d.okuri && !d.ruby){
143
+ var slack = limitOf(i + 1, 0) - (d.okY + okLen(d));
144
+ delay = Math.max(0, Math.min(S * OK_DELAY, slack, top + len + GAP_OK - d.okY));
145
+ }
146
+ var lim = limitOf(i, delay);
147
+ // 縮めきっても入らなければ、この列の後ろの字をまとめて下げる(字どうしの間は変えない)
148
+ var short = top + len * OK_MIN - lim;
149
+ if (short > 0) L2.slice(i + 1).forEach(function(e){
150
+ e.y += short; e.okY += short; e.lkY += short; e.kaeriY += short; if (e.ruby) e.rubyY += short;
151
+ H = Math.max(H, e.y + S * 1.2 + (e.punct ? S * 0.42 : 0), e.kaeriY + e.kaeriN * F * 0.92, e.lkY + Array.from(e.leftKana).length * F);
152
+ });
153
+ if (short > 0) lim += short;
154
+ c.okY = top; c.okFit = Math.max(OK_MIN, Math.min(1, (lim - top) / len));
155
+ prevEnd = top + len * c.okFit;
156
+ H = Math.max(H, prevEnd);
157
+ });
158
+ });
159
+ var B = 0;
160
+ p.chars.forEach(function(c){
161
+ B = Math.max(B, c.y + S, c.okY + Array.from(c.okuri).length * F * c.okFit, c.lkY + Array.from(c.leftKana).length * F);
162
+ if (c.ruby) B = Math.max(B, c.rubyY + Array.from(c.ruby).length * F);
163
+ if (c.kaeriN) B = Math.max(B, c.kaeriY + (c.kaeriN - 1) * F * 0.92 + F);
164
+ if (c.punct) B = Math.max(B, c.y + S * 1.02 + Math.round(S * 0.6));
165
+ if (c.join) B = Math.max(B, c.y + S * 1.06 + Math.round(S * 0.24));
166
+ });
167
+ // 幅:列と、書き下し文との間。字が小さいと右端の列の送り仮名(24px)が右の欄(字の 0.5)からはみ出すので、その分(XR)も
168
+ XR = Math.max(0, F + 1 - R);
169
+ return {S: S, B: B, W: cols.length * PITCH - G + Math.round(S * 0.9) + XR};
170
+ };
171
+ // 要素の高さと幅に収める:字の大きさ size で収まらなければ、字の大きさと字の送りを一緒に 1px ずつ下げる(FIT_MIN まで)。
172
+ // 収まるときは size のまま(配置は今までと同じ)。幅は列と書き下し文(字の大きさによらない)の合計
173
+ var KS = P.kaki, avH = this.clientHeight, HA0 = Math.max(KS * 4, avH), W = this.clientWidth || 1184;
174
+ var kakiW = function(HA){
175
+ var perCol = Math.max(1, Math.floor(HA / KS));
176
+ return kaki.reduce(function(a, line){ return a + Math.max(1, Math.ceil(Array.from(plain(line)).length / perCol)); }, 0) * KS * 1.9;
177
+ };
178
+ var over = function(g){ return {h: avH ? g.B - FIT_SLACK - avH : 0, w: g.W + kakiW(avH ? HA0 : Math.max(KS * 4, H)) - W}; };
179
+ var g = lay(P.size), o2 = over(g);
180
+ while ((o2.h > 0.5 || o2.w > 0.5) && S > FIT_MIN){ g = lay(Math.max(FIT_MIN, Math.ceil(S) - 1)); o2 = over(g); }
181
+ if (o2.h > 0.5 || o2.w > 0.5){
182
+ var at = S < P.size ? "字を size=" + S + " まで小さくしても" : "size=" + S + " では";
183
+ if (o2.h > 0.5) ctx.report("size", "[kanbun] " + at + "要素の高さ " + avH + "px に " + Math.ceil(g.B - avH) + "px 足りない(いちばん長い列 " + Math.ceil(g.B) + "px)。" +
184
+ "高さを " + Math.ceil(g.B) + "px 以上にするか、1 行の字を減らす(長い文は句読点のところで行を分ける)");
185
+ if (o2.w > 0.5) ctx.report("size", "[kanbun] " + at + "要素の幅 " + W + "px に " + Math.ceil(o2.w) + "px 足りない(" + cols.length + " 列と書き下し文)。" +
186
+ "詩を分けて 2 枚にする(1 枚に 2 句など)");
187
+ }
188
+ var nc = cols.length, WK = nc * PITCH - G;
189
+ // 書き下し文:部品の高さで折り返す。列の数は字数から見積もる(振り仮名は数えない)
190
+ var HA = Math.max(KS * 4, avH || H), KW = kakiW(HA), GAP = Math.round(S * 0.9);
191
+ var X0 = Math.max(0, Math.round((W - (WK + GAP + KW + XR)) / 2));
192
+ this.geom = {S: S, F: F, L: L, PITCH: PITCH, WK: WK, H: H};
193
+ var box = function(tag, cls, css, parent, text){
194
+ var e = document.createElement(tag); e.className = cls; e.style.cssText = css; if (text !== undefined) e.textContent = text; (parent || self).appendChild(e); return e;
195
+ };
196
+ var kb = box("div", "kb", "position:absolute;top:0;left:" + (X0 + KW + GAP) + "px;width:" + WK + "px;height:" + Math.ceil(H) + "px;font-family:var(--font-mincho);color:var(--fg)");
197
+ kb.setAttribute("aria-hidden", "true"); // 読み上げは要素の aria-label(role="img")。中の字・番号・弧は読まない
198
+ // 列 c の左端(kb の中の x)
199
+ var colLeft = function(c){ return WK - (c + 1) * PITCH + G; };
200
+ this.cells = p.chars.map(function(c){
201
+ var x = colLeft(c.col) + L, e = {c: c, x: x, y: c.y};
202
+ e.bg = box("div", "kb-bg", "position:absolute;left:" + (x - 3) + "px;top:" + (c.y - 3) + "px;width:" + (S + 6) + "px;height:" + (S + 6) + "px;border-radius:6px;background:var(--term-tint);opacity:0", kb);
203
+ e.ch = box("span", "kb-ch", "position:absolute;left:" + x + "px;top:" + c.y + "px;width:" + S + "px;height:" + S + "px;font-size:" + S + "px;line-height:" + S + "px;text-align:center", kb, c.ch);
204
+ var vt = "writing-mode:vertical-rl;text-orientation:upright;position:absolute;font-size:" + F + "px;line-height:" + F + "px;white-space:nowrap;opacity:0;";
205
+ e.ann = [];
206
+ // 右の欄:振り仮名(上)と送り仮名(下半分から)。左の欄:再読文字の二度目の片仮名、その下に返り点
207
+ if (c.ruby) e.ann.push(box("span", "kb-ruby", vt + "left:" + (x + S + 1) + "px;top:" + c.rubyY + "px;color:var(--muted)", kb, c.ruby));
208
+ if (c.okuri) e.ann.push(box("span", "kb-ok", vt + "left:" + (x + S + 1) + "px;top:" + c.okY + "px;color:var(--term)" + okSquash(Array.from(c.okuri).length, F, c.okFit), kb, c.okuri));
209
+ if (c.leftKana) e.ann.push(box("span", "kb-ok kb-left", vt + "left:" + (x - F - 1) + "px;top:" + c.lkY + "px;color:var(--term)", kb, c.leftKana));
210
+ e.kaeri = [];
211
+ var ky = c.kaeriY, kx = x - F - 2;
212
+ var mk = function(s){ var k = box("span", "kb-kaeri", "position:absolute;left:" + kx + "px;top:" + ky + "px;width:" + F + "px;font-size:" + F + "px;line-height:" + F + "px;text-align:center;color:var(--emph);font-weight:700;opacity:0", kb, s); e.kaeri.push(k); ky += F * 0.92; };
213
+ if (c.mark) mk(c.mark);
214
+ if (c.re) mk("レ");
215
+ if (c.punct) e.punct = box("span", "kb-punct", "writing-mode:vertical-rl;position:absolute;left:" + (x + S * 0.2) + "px;top:" + (c.y + S * 1.02) + "px;font-size:" + Math.round(S * 0.6) + "px;line-height:" + Math.round(S * 0.6) + "px;opacity:0", kb, c.punct);
216
+ if (c.join) e.join = box("span", "kb-join", "position:absolute;left:" + (x + S / 2 - 1.5) + "px;top:" + (c.y + S * 1.06) + "px;width:3px;height:" + Math.round(S * 0.24) + "px;background:var(--fg);opacity:0", kb);
217
+ e.nums = [];
218
+ return e;
219
+ });
220
+ // 読む順:字ごとの番号(左上。再読文字の二度目は右上、振り仮名があれば左上の番号の上)
221
+ var ce = this.k.ce, NF = Math.max(24, Math.round(S * 0.4));
222
+ ce.forEach(function(ev, m){
223
+ var e = self.cells[ev.c], second = ev.kind === "second" && e.c.second !== null;
224
+ // 右上の番号は、字が小さいとき(要素に収めたとき)に送り仮名と重ならないよう、送り仮名の上に上げる
225
+ var nx = second && !e.c.ruby ? e.x + S + 1 : e.x - L, ny = second && e.c.ruby ? e.y - NF : second && e.c.okuri ? Math.min(e.y + 3, e.c.okY - NF - 1) : e.y + 3;
226
+ // 二桁以上は箱(幅 L)に収める。まず字の大きさ NF のまま横だけを縮める(数字 1 つの幅を 0.7em と見た幅 NW の箱を scaleX で幅 L に。
227
+ // 縮める割合は NUM_SQ まで。送り仮名を詰めるのと同じ組み方)。それでも入らなければ字の大きさを下げる(数字 1 つを 0.75em と見て 2 px の余白)。一桁は従来のまま
228
+ var nd = String(m + 1).length, NW = Math.ceil(nd * 0.7 * NF) + 2, sq = nd > 1 && L / NW >= NUM_SQ && L < NW;
229
+ var NS = nd > 1 && !sq ? Math.floor(Math.min(NF, (L - 2) / (nd * 0.75)) * 2) / 2 : NF;
230
+ var nb = box("span", "kb-num", "position:absolute;left:" + (sq ? nx - (NW - L) / 2 : nx) + "px;top:" + ny + "px;width:" + (sq ? NW : L) + "px;font-family:var(--font-sans);font-size:" + NS + "px;line-height:" + NF + "px;text-align:center;font-weight:700;color:var(--emph);font-variant-numeric:tabular-nums;opacity:0" +
231
+ (sq ? ";transform:scaleX(" + (L / NW).toFixed(6) + ");transform-origin:50% 0" : ""), kb, String(m + 1));
232
+ // 字の脇に添える小さい注記の印(Egatari Studio の品質チェックが字の大きさの最小を見ない。docs/contract.md §10)
233
+ nb.setAttribute("data-annot", "");
234
+ e.nums.push(nb); ev.num = nb;
235
+ });
236
+ // 目(今読んでいる字の枠)と、上へ戻るところの弧
237
+ this.eye = box("div", "kb-eye", "position:absolute;left:0;top:0;width:" + (S + 10) + "px;height:" + (S + 10) + "px;border:3px solid var(--emph);border-radius:9px;opacity:0", kb);
238
+ var svg = D.el("svg", {width: WK, height: Math.ceil(H), viewBox: "0 0 " + WK + " " + Math.ceil(H), style: "position:absolute;left:0;top:0;overflow:visible;pointer-events:none"}, kb);
239
+ this.jumps = [];
240
+ ce.forEach(function(ev, m){
241
+ if (m === 0) return;
242
+ var a = self.cells[ce[m - 1].c], b = self.cells[ev.c];
243
+ // 同じ列の上の字へ戻るとき(または右の列へ戻るとき)に弧を描く
244
+ var back = a.c.col === b.c.col ? b.c.n < a.c.n : b.c.col < a.c.col;
245
+ if (!back) return;
246
+ // 弧は左の欄(返り点・番号)の外を通す(2 次曲線の頂点は制御点までの半分)
247
+ var x0 = a.x - 4, y0 = a.y + S / 2, x1 = b.x - 4, y1 = b.y + S / 2, cx = Math.min(x0, x1) - S * 1.3;
248
+ if (a.c.col !== b.c.col){ x0 = a.x + S / 2; y0 = a.y - 4; x1 = b.x + S / 2; y1 = b.y - 4; cx = (x0 + x1) / 2; }
249
+ var cy = a.c.col !== b.c.col ? Math.min(y0, y1) - S * 0.8 : (y0 + y1) / 2;
250
+ var d = "M" + x0.toFixed(1) + "," + y0.toFixed(1) + "Q" + cx.toFixed(1) + "," + cy.toFixed(1) + " " + x1.toFixed(1) + "," + y1.toFixed(1);
251
+ var g = D.el("g", {opacity: 0}, svg);
252
+ var path = D.el("path", {d: d, fill: "none", stroke: "var(--emph)", "stroke-width": 3, "stroke-linecap": "round", pathLength: 1, "stroke-dasharray": 1, "stroke-dashoffset": 1}, g);
253
+ // 矢じり:終わりの点での向き(2 次曲線の終わりの接線は制御点 → 終点)
254
+ var ang = Math.atan2(y1 - cy, x1 - cx) * 180 / Math.PI;
255
+ var head = D.el("path", {d: "M0,0L-13,-6L-13,6Z", fill: "var(--emph)", transform: "translate(" + x1.toFixed(1) + " " + y1.toFixed(1) + ") rotate(" + ang.toFixed(1) + ")", opacity: 0}, g);
256
+ self.jumps.push({m: m, g: g, path: path, head: head});
257
+ });
258
+ // 書き下し文(縦書き、左に)
259
+ var kk = box("div", "kb-kaki", "position:absolute;top:0;left:" + X0 + "px;width:" + Math.ceil(KW) + "px;height:" + Math.ceil(HA) + "px;writing-mode:vertical-rl;font-family:var(--font-mincho);font-size:" + KS + "px;line-height:1.9;color:var(--fg);line-break:strict");
260
+ kk.setAttribute("aria-hidden", "true");
261
+ this.kakiLines = kaki.map(function(line){
262
+ var d = box("div", "kb-kaki-line", "opacity:0", kk);
263
+ line.forEach(function(s){
264
+ if (s.rb){ var r = document.createElement("ruby"); r.textContent = s.t; var rt = document.createElement("rt"); rt.textContent = s.rb; r.appendChild(rt); d.appendChild(r); }
265
+ else d.appendChild(document.createTextNode(s.t));
266
+ });
267
+ return d;
268
+ });
269
+ }
270
+ duration(k){
271
+ var st = this.stepList[k - 1], name = st && st.name;
272
+ if (name === "kunten") return 0.9;
273
+ if (name === "order") return (st.g.b - st.g.a) * this.props.slot + 0.3;
274
+ if (name === "kaki") return (this.kakiLines ? this.kakiLines.length : 1) * 0.3 + 0.45;
275
+ return 0;
276
+ }
277
+ // 読む順の段階:その段階の中で列が変わる字(order-by="all" では 2 列目からの各列の読み始め)の時刻。
278
+ // order-by="col" では列が変わるところで段階が分かれるので、段階の中に合図はない
279
+ cues(k){
280
+ var st = this.stepList[k - 1];
281
+ if (!st || st.name !== "order") return null;
282
+ var ce = this.kd.ce, ch = this.kd.p.chars, slot = this.props.slot, a = st.g.a, out = [];
283
+ for (var m = a + 1; m < st.g.b; m++) if (ch[ce[m].c].col !== ch[ce[m - 1].c].col) out.push(+((m - a) * slot).toFixed(4));
284
+ return out.length ? out : null;
285
+ }
286
+ render(k, t, ctx){
287
+ var self = this, S = this.geom.S, slot = this.props.slot;
288
+ // 先の段階を薄く見せる表示(授業の表示):後の段階の訓点・読む順の番号と弧・書き下し文を、最後の形のまま --preview-opacity の濃さで
289
+ var preview = !!ctx.preview, PV = preview ? base.previewOpacity(this) : 0.45;
290
+ // 段階 name の進み:まだなら -1、済んだら Infinity、今なら t。phases になければ、訓点は初めから済み、ほかは来ない
291
+ var at = function(name){ var s = self.phaseStep(name); if (!s) return name === "kunten" ? Infinity : -1; return k > s ? Infinity : k < s ? -1 : t; };
292
+ var pr = function(tt, a, d){ return tt < 0 ? 0 : D.prog(tt, a, d); };
293
+ var tk = at("kunten"), tw = at("kaki");
294
+ // 読む順の段階は groups の数だけ続く(first から last)。今の段階の範囲 [a, a + len) と、その中の時刻 to
295
+ var first = this.phaseStep("order"), G = this.k.groups, last = first ? first + G.length - 1 : 0;
296
+ var started = first > 0 && k >= first, done = started && k > last, a = 0, len = 0, to = -1;
297
+ if (started && !done){ a = G[k - first].a; len = G[k - first].b - a; to = t; }
298
+ var eK = pr(tk, 0, 0.4), eO = pr(tk, 0.3, 0.45), eP = pr(tk, 0.45, 0.3);
299
+ if (preview && tk < 0) eK = eO = eP = PV;
300
+ this.cells.forEach(function(e){
301
+ e.kaeri.forEach(function(x){ x.style.opacity = eK.toFixed(3); });
302
+ e.ann.forEach(function(x){ x.style.opacity = eO.toFixed(3); });
303
+ if (e.punct) e.punct.style.opacity = eP.toFixed(3);
304
+ if (e.join) e.join.style.opacity = eK.toFixed(3);
305
+ e.bg.style.opacity = 0;
306
+ // 置き字は読む順の段階から薄くする(読まない字)
307
+ e.ch.style.color = e.c.oki && started ? "var(--muted)" : "";
308
+ });
309
+ // 読む順:事柄 m は m * slot 秒に始まる。今の事柄 j
310
+ // 段階の終わりの 0.3 秒(tail)で、今の字の印(目の枠・朱の字)を消し、弧を読み終えた濃さにする:段階の長さの時点で最後の状態と同じ
311
+ var ce = this.k.ce, n = ce.length, j = -1, tail = done ? 1 : to >= 0 ? pr(to - len * slot, 0, 0.25) : 0;
312
+ if (done) j = n;
313
+ else if (to >= 0) j = a + Math.max(0, Math.min(len - 1, Math.floor(to / slot)));
314
+ // 事柄 m の始まりからの時刻
315
+ var lt = function(m){ return to - (m - a) * slot; };
316
+ // 番号と弧は書き下し文が出ても残す(最後の形は印刷にも台本の小さい絵にも出る。読む順はこの部品が教える中身)
317
+ var seen = {};
318
+ ce.forEach(function(ev, m){
319
+ var e = self.cells[ev.c], v = m < j ? 1 : m === j ? pr(lt(m), 0.12 * slot, 0.3 * slot) : 0;
320
+ if (v > 0) seen[ev.c] = Math.max(seen[ev.c] || 0, v);
321
+ // 後の段階の事柄(読む順の段階の前、または今の段階より後)
322
+ var later = preview && first > 0 && (!started || (!done && m >= a + len));
323
+ ev.num.style.opacity = self.props.nums ? (later ? PV : v).toFixed(3) : 0;
324
+ });
325
+ Object.keys(seen).forEach(function(c){ self.cells[c].bg.style.opacity = (seen[c] * 0.9).toFixed(3); });
326
+ this.jumps.forEach(function(J){
327
+ if (preview && first > 0 && (!started || (!done && J.m >= a + len))){
328
+ // 後の段階の弧:引き終えた形を、読み終えた弧の濃さ(0.55)のまま薄く
329
+ J.path.setAttribute("stroke-dashoffset", "0.0000"); J.head.setAttribute("opacity", 1); J.g.setAttribute("opacity", (0.55 * PV).toFixed(3));
330
+ return;
331
+ }
332
+ var d = J.m < j ? 1 : J.m === j ? pr(lt(J.m), 0, 0.35 * slot) : 0;
333
+ J.path.setAttribute("stroke-dashoffset", (1 - d).toFixed(4));
334
+ J.head.setAttribute("opacity", d >= 0.98 ? 1 : 0);
335
+ J.g.setAttribute("opacity", d <= 0 ? 0 : (J.m === j && !done ? 1 - 0.45 * tail : 0.55).toFixed(3));
336
+ });
337
+ // 目:前の字から今の字へ 0.35 slot で動く。読み終えたら消える
338
+ if (j >= 0 && j < n && !done && tail < 1){
339
+ var cur = this.cells[ce[j].c], prev = j > 0 ? this.cells[ce[j - 1].c] : cur;
340
+ // 同じ列の中では滑らせ、列が変わるとき(次の句へ)は今の字で現れる
341
+ var e2 = pr(lt(j), 0, 0.35 * slot), hop = prev.c.col !== cur.c.col;
342
+ var x = hop ? cur.x : D.lerp(prev.x, cur.x, e2), y = hop ? cur.y : D.lerp(prev.y, cur.y, e2);
343
+ this.eye.style.left = (x - 8).toFixed(2) + "px"; this.eye.style.top = (y - 8).toFixed(2) + "px";
344
+ this.eye.style.opacity = ((j === 0 ? pr(to, 0, 0.15) : hop ? e2 : 1) * (1 - tail)).toFixed(3);
345
+ cur.ch.style.color = tail > 0 ? "color-mix(in srgb, var(--emph) " + (100 * (1 - tail)).toFixed(1) + "%, var(--fg))" : "var(--emph)";
346
+ } else this.eye.style.opacity = 0;
347
+ // 書き下し文:行ごとに 0.3 秒ずつ遅らせて出す
348
+ this.kakiLines.forEach(function(d, L){ d.style.opacity = (preview && tw < 0 && self.phaseStep("kaki") ? PV : pr(tw, L * 0.3, 0.45)).toFixed(3); });
349
+ }
350
+ };
351
+ });