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,322 @@
1
+ // m-classify2d:2 次元の分類の図を、scikit-learn が出した値のとおりに描く。点・領域(格子の上の predict)・境界・
2
+ // 確率や決定関数の等高線(contour-core)・サポートベクトル・ボロノイ図(パーツが種の点から計算)・決定木の分割・k 平均法。
3
+ // 値は tools/sk2ega.py の出力を書く。パーツはモデルの計算をしない(k 平均法の割り当てと重心だけ確かめる)。
4
+ // <m-classify2d style="height:440px"><script type="application/json">
5
+ // {"axes": {"x": {"label": "x₁", "range": [-3, 3]}, "y": {"label": "x₂", "range": [-2, 2]}},
6
+ // "classes": [{"id": 0, "label": "A"}, {"id": 1, "label": "B"}], "points": [[0.4, 1.2, 1], [-1.1, 0.3, 0]],
7
+ // "grid": {"nx": 60, "ny": 40, "labels": "0*35 1*25 …"}}
8
+ // (JSON の終わり)</m-classify2d>
9
+ // 格子:x は range を nx 点、y は ny 点に等分した点(両端を含む。numpy の linspace と meshgrid)。labels と fields の値は行ごと
10
+ // (行 0 が y の最小)。labels は 2 次元の配列か「クラス*個数」を空白で区切った行の順の続け書き。
11
+ // 色:クラスごとに CLASS_COLORS(--series-1・--series-3・--fg・--series-4)と点の形(○・□・△・◇。色だけに頼らない)、領域はその色の薄い塗り、境界と等高線 --fg、
12
+ // サポートベクトルの輪 --fg(クラスの色と --emph が近いテーマでも紛れない)、k 平均法の重心は × の印。
13
+ egatariParts.define({name: "classify2d", version: "2.0.1", requires: {base: "1.3.0", "contour-core": "1.0.0"}, element: "m-classify2d"}, function(deps){
14
+ "use strict";
15
+ var base = deps.base, D = base, K = deps["contour-core"], clipN = 0;
16
+ var NUM = {type: "number"}, PT = {type: "array", minItems: 2, maxItems: 3, items: {type: ["number", "null"]}};
17
+ var CAP = {classes: 4, points: 300, nx: 160, ny: 120, seeds: 40, nodes: 31, iters: 10, levels: 5};
18
+ var SHAPES = ["circle", "square", "triangle", "diamond"];
19
+ // クラスの色の並び(m-folds の classes と同じ。1 つの意味に 1 つの色):--series-2 は印の色 --emph と同じテーマがあるので使わない。
20
+ // 既定のテーマでは --series-3 = --accent2、--series-4 = --muted なので、3 つ目は --fg(4 つ目の --muted は、k 平均法のまだ割り当てていない点と同じ色)
21
+ var CLASS_COLORS = ["var(--series-1)", "var(--series-3)", "var(--fg)", "var(--series-4)"];
22
+ var T = {
23
+ ja: {summary: function(c, n){ return "分類の図:クラス " + c.join("・") + "、点 " + n + " 個"; }, regions: "領域", tree: "決定木の分割", kmeans: function(n){ return "k 平均法(" + n + " 回の繰り返し)"; }, sv: "サポートベクトル"},
24
+ en: {summary: function(c, n){ return "Classification: classes " + c.join(", ") + "; " + n + " points"; }, regions: "regions", tree: "decision tree splits", kmeans: function(n){ return "k-means (" + n + " iterations)"; }, sv: "support vectors"}
25
+ };
26
+ function nice(lo, hi, n){
27
+ var span = hi - lo, raw = span / Math.max(1, n), p = Math.pow(10, Math.floor(Math.log10(raw))), m = raw / p, st = (m < 1.5 ? 1 : m < 3 ? 2 : m < 7 ? 5 : 10) * p, out = [];
28
+ for (var v = Math.ceil(lo / st - 1e-9) * st; v <= hi + 1e-9 * span; v += st) out.push(Math.abs(v) < st * 1e-9 ? 0 : v);
29
+ return {ticks: out, step: st};
30
+ }
31
+ function fmt(v, st){ var d = Math.max(0, -Math.floor(Math.log10(st) + 1e-9)); var s = v.toFixed(Math.min(4, d)); return s.indexOf("-") === 0 ? "−" + s.slice(1) : s; }
32
+ function rle(s){ var out = []; String(s).trim().split(/\s+/).forEach(function(tok){ var m = /^(-?\d+)\*(\d+)$/.exec(tok); if (m){ for (var i = 0; i < +m[2]; i++) out.push(+m[1]); } else if (/^-?\d+$/.test(tok)) out.push(+tok); else out.push(NaN); }); return out; }
33
+ // 種の点 s のボロノイ領域:長方形を、ほかの種との垂直二等分線で切っていく(半平面の切り取り)
34
+ function cell(seeds, s, rect){
35
+ var poly = [[rect[0], rect[2]], [rect[1], rect[2]], [rect[1], rect[3]], [rect[0], rect[3]]], p = seeds[s];
36
+ for (var o = 0; o < seeds.length && poly.length; o++){
37
+ if (o === s) continue;
38
+ var q = seeds[o], nx = q[0] - p[0], ny = q[1] - p[1], c = (q[0] * q[0] + q[1] * q[1] - p[0] * p[0] - p[1] * p[1]) / 2;
39
+ if (!nx && !ny) continue;
40
+ var inside = function(v){ return v[0] * nx + v[1] * ny <= c + 1e-12; }, out = [];
41
+ for (var i = 0; i < poly.length; i++){
42
+ var a = poly[i], b = poly[(i + 1) % poly.length], ia = inside(a), ib = inside(b);
43
+ if (ia) out.push(a);
44
+ if (ia !== ib){ var da = a[0] * nx + a[1] * ny - c, db = b[0] * nx + b[1] * ny - c, u = da / (da - db); out.push([a[0] + (b[0] - a[0]) * u, a[1] + (b[1] - a[1]) * u]); }
45
+ }
46
+ poly = out;
47
+ }
48
+ return poly;
49
+ }
50
+ return class extends base.MotionElement {
51
+ static partName = "classify2d";
52
+ static preview = "none";
53
+ static shape = {schema: {type: "object", additionalProperties: false, required: ["axes", "points"], properties: {
54
+ axes: {type: "object", additionalProperties: false, required: ["x", "y"], properties: {
55
+ x: {type: "object", additionalProperties: false, required: ["range"], properties: {label: {type: "string"}, range: {type: "array", minItems: 2, maxItems: 2, items: NUM}}},
56
+ y: {type: "object", additionalProperties: false, required: ["range"], properties: {label: {type: "string"}, range: {type: "array", minItems: 2, maxItems: 2, items: NUM}}}}},
57
+ classes: {type: "array", minItems: 1, maxItems: 4, items: {type: "object", additionalProperties: false, required: ["id"], properties: {id: {type: "integer"}, label: {type: "string"}}}},
58
+ points: {type: "array", minItems: 1, maxItems: 300, items: PT},
59
+ grid: {type: "object", additionalProperties: false, required: ["nx", "ny"], properties: {nx: {type: "integer"}, ny: {type: "integer"}, labels: {type: ["string", "array"]}}},
60
+ fields: {type: "array", maxItems: 2, items: {type: "object", additionalProperties: false, required: ["values", "levels"], properties: {
61
+ name: {type: "string"}, class: {type: "integer"}, values: {type: "array"}, levels: {type: "array", minItems: 1, maxItems: 5, items: NUM}, style: {type: "array", items: {type: "string", enum: ["solid", "dash"]}}, labels: {type: "boolean"}}}},
62
+ sv: {type: "array", items: {type: "integer"}},
63
+ voronoi: {type: "object", additionalProperties: false, required: ["seeds"], properties: {seeds: {type: "array", minItems: 1, maxItems: 40, items: PT}}},
64
+ tree: {type: "object", additionalProperties: false, required: ["nodes"], properties: {nodes: {type: "array", minItems: 1, maxItems: 31, items: {type: "object", additionalProperties: false, required: ["id"], properties: {
65
+ id: {type: "string"}, feature: {type: "integer", enum: [0, 1]}, threshold: NUM, left: {type: "string"}, right: {type: "string"}, class: {type: "integer"}}}}}},
66
+ kmeans: {type: "object", additionalProperties: false, required: ["iters"], properties: {iters: {type: "array", minItems: 1, maxItems: 10, items: {type: "object", additionalProperties: false, required: ["centroids", "assign"], properties: {
67
+ centroids: {type: "array", minItems: 1, maxItems: 4, items: {type: "array", minItems: 2, maxItems: 2, items: NUM}}, assign: {type: "array", items: {type: "integer"}}}}}}}
68
+ }}, example: /*@egatari-block example*/{"axes":{"x":{"label":"x₁","range":[0,4]},"y":{"label":"x₂","range":[0,3]}},"classes":[{"id":0,"label":"A"},{"id":1,"label":"B"}],"points":[[1,1,0],[1.2,2,0],[2.8,1.1,1],[3.1,2.4,1]],"grid":{"nx":5,"ny":4,"labels":"0*2 1*3 0*2 1*3 0*2 1*3 0*3 1*2"}}/*@egatari-block-end*/};
69
+ static props = {
70
+ dur: {type: "number", default: 0.9, doc: "1 ステップの秒数"},
71
+ size: {type: "number", default: 24, doc: "字の大きさ(px、24 以上)"},
72
+ marker: {type: "number", default: 8, doc: "点の印の半径(px)"}
73
+ };
74
+ get steps(){ return this.plan().steps.length; }
75
+ duration(k){ return k >= 1 && k <= this.plan().steps.length ? this.props.dur : 0; }
76
+ // データだけから決まること:ステップの並びと、確かめ(bad)
77
+ plan(){
78
+ if (this._plan) return this._plan;
79
+ var d = this.data || {}, bad = [], steps = [], pts = d.points || [], classes = d.classes || [], cls = {};
80
+ classes.forEach(function(c, i){ cls[c.id] = i; });
81
+ var known = function(c){ return c === null || c === undefined || c in cls; };
82
+ pts.forEach(function(p, i){ if (!known(p[2])) bad.push("points[" + i + "]: class " + p[2] + " is not in classes"); });
83
+ var rx = d.axes && d.axes.x.range, ry = d.axes && d.axes.y.range;
84
+ if (rx && !(rx[1] > rx[0])) bad.push("axes.x.range must be [min, max] with min < max");
85
+ if (ry && !(ry[1] > ry[0])) bad.push("axes.y.range must be [min, max] with min < max");
86
+ var labels = null;
87
+ if (d.grid){
88
+ var g = d.grid;
89
+ if (!(g.nx >= 2 && g.nx <= CAP.nx && g.ny >= 2 && g.ny <= CAP.ny)) bad.push("grid: nx 2–" + CAP.nx + " and ny 2–" + CAP.ny + " (got " + g.nx + " × " + g.ny + ")");
90
+ if (g.labels !== undefined){
91
+ var flat = typeof g.labels === "string" ? rle(g.labels) : [].concat.apply([], g.labels);
92
+ if (flat.length !== g.nx * g.ny) bad.push("grid.labels has " + flat.length + " values; nx × ny = " + g.nx * g.ny);
93
+ else if (flat.some(function(v){ return !(v in cls); })) bad.push("grid.labels has a class that is not in classes");
94
+ else { labels = []; for (var j = 0; j < g.ny; j++) labels.push(flat.slice(j * g.nx, (j + 1) * g.nx)); }
95
+ }
96
+ }
97
+ var fields = (d.fields || []).map(function(f, i){
98
+ var ok = d.grid && Array.isArray(f.values) && f.values.length === d.grid.ny && f.values.every(function(r){ return Array.isArray(r) && r.length === d.grid.nx && r.every(function(v){ return typeof v === "number"; }); });
99
+ if (!ok) bad.push("fields[" + i + "].values must be ny × nx numbers (a grid is needed)");
100
+ if (f.class !== undefined && !known(f.class)) bad.push("fields[" + i + "].class: " + f.class + " is not in classes");
101
+ return ok ? f : null;
102
+ }).filter(Boolean);
103
+ (d.sv || []).forEach(function(n){ if (!(n >= 0 && n < pts.length)) bad.push("sv: " + n + " is not a point index (0–" + (pts.length - 1) + ")"); });
104
+ (d.voronoi ? d.voronoi.seeds : []).forEach(function(s, i){ if (!known(s[2])) bad.push("voronoi.seeds[" + i + "]: class " + s[2] + " is not in classes"); });
105
+ // 決定木:根から幅優先で分割を並べ、節ごとに長方形を持たせる
106
+ var splits = [], leaves = [];
107
+ if (d.tree && rx && ry){
108
+ var byId = {}; d.tree.nodes.forEach(function(n){ byId[n.id] = n; });
109
+ var queue = [{n: d.tree.nodes[0], r: [rx[0], rx[1], ry[0], ry[1]]}], seen = {};
110
+ while (queue.length){
111
+ var q = queue.shift(), n = q.n;
112
+ if (seen[n.id]){ bad.push("tree: node \"" + n.id + "\" is reached twice"); continue; }
113
+ seen[n.id] = true;
114
+ if (n.left !== undefined || n.right !== undefined){
115
+ var L = byId[n.left], R = byId[n.right];
116
+ if (!L || !R){ bad.push("tree: node \"" + n.id + "\" needs left and right that exist"); continue; }
117
+ var lo = n.feature === 0 ? q.r[0] : q.r[2], hi = n.feature === 0 ? q.r[1] : q.r[3];
118
+ if (!(n.feature === 0 || n.feature === 1) || !(n.threshold > lo && n.threshold < hi)) bad.push("tree: node \"" + n.id + "\" threshold " + n.threshold + " is not inside its cell (" + lo + " to " + hi + " on feature " + n.feature + ")");
119
+ var rl = q.r.slice(), rr = q.r.slice();
120
+ if (n.feature === 0){ rl[1] = n.threshold; rr[0] = n.threshold; } else { rl[3] = n.threshold; rr[2] = n.threshold; }
121
+ splits.push({id: n.id, feature: n.feature, t: n.threshold, r: q.r});
122
+ queue.push({n: L, r: rl}, {n: R, r: rr});
123
+ } else {
124
+ if (!(n.class in cls)) bad.push("tree: leaf \"" + n.id + "\" needs a class from classes");
125
+ leaves.push({id: n.id, cls: n.class, r: q.r});
126
+ }
127
+ }
128
+ }
129
+ // k 平均法:割り当ては最も近い重心か(同じ距離は許す)、次の重心は割り当てた点の平均か
130
+ var km = d.kmeans ? d.kmeans.iters : null;
131
+ if (km) km.forEach(function(it, i){
132
+ if (it.assign.length !== pts.length){ bad.push("kmeans.iters[" + i + "].assign has " + it.assign.length + " entries; points has " + pts.length); return; }
133
+ var C = it.centroids, d2 = function(p, c){ return (p[0] - c[0]) * (p[0] - c[0]) + (p[1] - c[1]) * (p[1] - c[1]); };
134
+ it.assign.forEach(function(a, n){
135
+ if (!(a >= 0 && a < C.length)){ bad.push("kmeans.iters[" + i + "].assign[" + n + "] is not a centroid index"); return; }
136
+ var best = Math.min.apply(null, C.map(function(c){ return d2(pts[n], c); }));
137
+ if (d2(pts[n], C[a]) > best * (1 + 1e-9) + 1e-12) bad.push("kmeans.iters[" + i + "].assign[" + n + "] = " + a + " is not the nearest centroid");
138
+ });
139
+ if (km[i + 1]){
140
+ C.forEach(function(_, c){
141
+ var m = [0, 0], cnt = 0; it.assign.forEach(function(a, n){ if (a === c){ m[0] += pts[n][0]; m[1] += pts[n][1]; cnt++; } });
142
+ if (!cnt) return;
143
+ var want = [m[0] / cnt, m[1] / cnt], got = km[i + 1].centroids[c];
144
+ if (!got || Math.abs(got[0] - want[0]) > 1e-6 * Math.max(1, Math.abs(want[0])) + 0.51 * Math.pow(10, -dec(got[0])) || Math.abs(got[1] - want[1]) > 1e-6 * Math.max(1, Math.abs(want[1])) + 0.51 * Math.pow(10, -dec(got[1])))
145
+ bad.push("kmeans.iters[" + (i + 1) + "].centroids[" + c + "] should be the mean of the points assigned in iteration " + i + ": (" + +want[0].toFixed(6) + ", " + +want[1].toFixed(6) + ")");
146
+ });
147
+ }
148
+ });
149
+ function dec(v){ var s = String(v).split(".")[1]; return s ? Math.min(s.length, 12) : 12; }
150
+ // ステップ
151
+ steps.push({kind: "points"});
152
+ if (km){ km.forEach(function(_, i){ steps.push({kind: "assign", i: i}); if (i + 1 < km.length) steps.push({kind: "update", i: i}); }); }
153
+ else if (d.tree){ splits.forEach(function(s, i){ steps.push({kind: "split", i: i}); }); steps.push({kind: "leaves"}); }
154
+ else {
155
+ if (labels || d.voronoi) steps.push({kind: "regions"});
156
+ fields.forEach(function(f, i){ steps.push({kind: "field", i: i}); });
157
+ if ((d.sv || []).length) steps.push({kind: "sv"});
158
+ }
159
+ if (d.tree && (labels || d.voronoi || fields.length)) bad.push("tree mode draws its own regions: leave out grid, fields and voronoi");
160
+ if (km && (d.tree || labels || d.voronoi)) bad.push("kmeans mode draws its own cells: leave out grid, voronoi and tree");
161
+ return (this._plan = {d: d, bad: bad, steps: steps, cls: cls, classes: classes, labels: labels, fields: fields, splits: splits, leaves: leaves, km: km});
162
+ }
163
+ mount(ctx){
164
+ var self = this, P = this.props, pl = this.plan(), d = pl.d, ja = /^ja\b/i.test(ctx.lang || "ja"), L = ja ? T.ja : T.en;
165
+ if (!(Number.isFinite(P.dur) && P.dur > 0)){ ctx.report("attr", "[classify2d] dur must be positive; using 0.9"); P.dur = 0.9; }
166
+ if (!(Number.isFinite(P.size) && P.size >= 24)){ ctx.report("attr", "[classify2d] size must be at least 24; using 24"); P.size = 24; }
167
+ if (!(Number.isFinite(P.marker) && P.marker >= 4)){ ctx.report("attr", "[classify2d] marker must be at least 4; using 8"); P.marker = 8; }
168
+ pl.bad.forEach(function(s){ ctx.report("data", "[classify2d] " + s); });
169
+ this.style.display = "block"; this.style.position = "relative";
170
+ var W = Math.max(1, this.clientWidth), H = Math.max(1, this.clientHeight), fs = P.size, mr = P.marker;
171
+ var rx = d.axes.x.range, ry = d.axes.y.range, tx = nice(rx[0], rx[1], 6), ty = nice(ry[0], ry[1], 5);
172
+ var tw = function(s){ return base.textWidth(s, fs, {font: self}); };
173
+ var yTickW = Math.max.apply(null, ty.ticks.map(function(v){ return tw(fmt(v, ty.step)); }).concat([0]));
174
+ // 上:凡例の行(クラスの印と名前)と y 軸の名前。下:x の目盛りと x 軸の名前
175
+ var legendH = Math.ceil(fs * 1.7), m = {l: Math.ceil(yTickW) + 14, r: 12, t: legendH + 6, b: Math.ceil(fs * 1.3) + 6};
176
+ var px = m.l, py = m.t, pw = Math.max(1, W - m.l - m.r), ph = Math.max(1, H - m.t - m.b);
177
+ if (pw < 200 || ph < 150) ctx.report("size", "[classify2d] element is " + W + " × " + H + " px; allow at least " + Math.ceil(m.l + m.r + 200) + " × " + Math.ceil(m.t + m.b + 150) + " px");
178
+ var X = function(x){ return px + (x - rx[0]) / (rx[1] - rx[0]) * pw; }, Y = function(y){ return py + (ry[1] - y) / (ry[1] - ry[0]) * ph; };
179
+ this.geo = {X: X, Y: Y, px: px, py: py, pw: pw, ph: ph, rect: [rx[0], rx[1], ry[0], ry[1]]};
180
+ var colOf = function(c){ var i = pl.cls[c]; return i === undefined ? "var(--muted)" : CLASS_COLORS[i]; };
181
+ this.colOf = colOf;
182
+ this.setAttribute("role", "img");
183
+ if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
184
+ var names = pl.classes.map(function(c){ return c.label || String(c.id); });
185
+ if (!this._aria) this.setAttribute("aria-label", L.summary(names, d.points.length) + (pl.km ? "; " + L.kmeans(pl.km.length) : d.tree ? "; " + L.tree : pl.labels || d.voronoi ? "; " + L.regions : "") + ((d.sv || []).length ? "; " + L.sv + " " + d.sv.length : ""));
186
+ var svg = this.svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true"}, this);
187
+ var cid = "classify2d-2-0-0-clip" + (++clipN);
188
+ D.el("rect", {x: px, y: py, width: pw, height: ph}, D.el("clipPath", {id: cid}, D.el("defs", {}, svg)));
189
+ var plot = D.el("g", {"clip-path": "url(#" + cid + ")"}, svg);
190
+ // 層:領域 → ボロノイ → 決定木の葉 → 格子線 → 等高線 → 分割の線 → 点 → 輪 → 重心
191
+ this.regionG = D.el("g", {opacity: 0, "shape-rendering": "crispEdges"}, plot);
192
+ this.vorG = D.el("g", {opacity: 0}, plot);
193
+ this.leafG = D.el("g", {opacity: 0}, plot);
194
+ this.kmG = D.el("g", {}, plot);
195
+ var gridG = D.el("g", {}, plot);
196
+ tx.ticks.forEach(function(v){ D.el("line", {x1: X(v), y1: py, x2: X(v), y2: py + ph, stroke: "var(--line)", "stroke-width": 1, opacity: 0.6}, gridG); });
197
+ ty.ticks.forEach(function(v){ D.el("line", {x1: px, y1: Y(v), x2: px + pw, y2: Y(v), stroke: "var(--line)", "stroke-width": 1, opacity: 0.6}, gridG); });
198
+ this.boundaryG = D.el("g", {opacity: 0}, plot);
199
+ this.fieldG = pl.fields.map(function(){ return D.el("g", {opacity: 0}, plot); });
200
+ this.splitEls = [];
201
+ var splitG = D.el("g", {}, plot);
202
+ D.el("rect", {x: px, y: py, width: pw, height: ph, fill: "none", stroke: "var(--muted)", "stroke-width": 2}, svg);
203
+ // 目盛りと軸の名前
204
+ // x の目盛りの数は、右端の x 軸の名前と重ならないものだけ
205
+ var xLabW = d.axes.x.label ? tw(d.axes.x.label.replace(/[*_]/g, "")) + 12 : 0;
206
+ tx.ticks.forEach(function(v){ var s = fmt(v, tx.step); if (X(v) + tw(s) / 2 > px + pw - xLabW) return; D.el("text", {x: X(v), y: py + ph + fs + 2, "font-size": fs, "text-anchor": "middle", fill: "var(--muted)"}, svg).textContent = s; });
207
+ ty.ticks.forEach(function(v){ D.el("text", {x: px - 8, y: Y(v) + fs * 0.35, "font-size": fs, "text-anchor": "end", fill: "var(--muted)"}, svg).textContent = fmt(v, ty.step); });
208
+ if (d.axes.y.label) D.mtext(svg, px, legendH - fs * 0.45, d.axes.y.label, {"font-size": fs, fill: "var(--fg)"});
209
+ // 凡例:右上にクラスの印と名前(k 平均法はクラスターなので書かない)
210
+ var legW = 0, legend = pl.km ? [] : pl.classes.map(function(c, i){ var t = c.label || String(c.id), w = 2 * mr + 10 + tw(t) + 20; legW += w; return {t: t, w: w, i: i, id: c.id}; });
211
+ var lx = W - m.r - legW, yLabW = d.axes.y.label ? tw(d.axes.y.label.replace(/[*_]/g, "")) + 16 : 0;
212
+ if (lx < px + yLabW) ctx.report("layout", "[classify2d] the class names need " + Math.ceil(legW) + " px beside the y-axis name; shorten them");
213
+ legend.forEach(function(o){ self.marker(svg, lx + mr, legendH / 2 + 2, o.i, colOf(o.id), mr); D.el("text", {x: lx + 2 * mr + 10, y: legendH / 2 + 2 + fs * 0.35, "font-size": fs, fill: "var(--fg)"}, svg).textContent = o.t; lx += o.w; });
214
+ // x 軸の名前:目盛りの右端の数の左に入らなければ、目盛りの行の右に
215
+ if (d.axes.x.label) D.mtext(svg, px + pw, py + ph + fs + 2, d.axes.x.label, {"font-size": fs, "text-anchor": "end", fill: "var(--fg)", "data-xlabel": ""});
216
+ // 領域(格子の上の predict):行ごとに同じクラスの続きを 1 つの長方形に。境界は違うクラスの間のセルの辺(階段)
217
+ if (pl.labels){
218
+ var g = d.grid, dx = (rx[1] - rx[0]) / (g.nx - 1), dy = (ry[1] - ry[0]) / (g.ny - 1), lab = pl.labels;
219
+ var cx = function(i){ return Math.max(rx[0], Math.min(rx[1], rx[0] + (i - 0.5) * dx)); }, cy = function(j){ return Math.max(ry[0], Math.min(ry[1], ry[0] + (j - 0.5) * dy)); };
220
+ lab.forEach(function(row, j){
221
+ var i0 = 0;
222
+ for (var i = 1; i <= row.length; i++) if (i === row.length || row[i] !== row[i0]){
223
+ D.el("rect", {x: X(cx(i0)).toFixed(1), y: Y(cy(j + 1)).toFixed(1), width: (X(cx(i)) - X(cx(i0))).toFixed(1), height: (Y(cy(j)) - Y(cy(j + 1))).toFixed(1), fill: colOf(row[i0]), "fill-opacity": 0.2}, self.regionG);
224
+ i0 = i;
225
+ }
226
+ });
227
+ var path = "";
228
+ for (var j = 0; j < g.ny; j++) for (var i = 0; i < g.nx; i++){
229
+ if (i + 1 < g.nx && lab[j][i] !== lab[j][i + 1]) path += "M" + X(cx(i + 1)).toFixed(1) + " " + Y(cy(j)).toFixed(1) + "V" + Y(cy(j + 1)).toFixed(1);
230
+ if (j + 1 < g.ny && lab[j][i] !== lab[j + 1][i]) path += "M" + X(cx(i)).toFixed(1) + " " + Y(cy(j + 1)).toFixed(1) + "H" + X(cx(i + 1)).toFixed(1);
231
+ }
232
+ // 確率や決定関数の等高線があれば、境界はそちらの滑らかな線で見せる(階段は描かない)
233
+ if (path && !pl.fields.length) D.el("path", {d: path, fill: "none", stroke: "var(--fg)", "stroke-width": 2.5, "stroke-linecap": "square"}, this.boundaryG);
234
+ }
235
+ // ボロノイ図(種の点から計算)
236
+ if (d.voronoi){
237
+ var seeds = d.voronoi.seeds, rect = this.geo.rect;
238
+ seeds.forEach(function(sd, s){
239
+ var poly = cell(seeds, s, rect);
240
+ if (poly.length < 3) return;
241
+ D.el("path", {d: "M" + poly.map(function(v){ return X(v[0]).toFixed(1) + " " + Y(v[1]).toFixed(1); }).join("L") + "Z", fill: sd[2] === null || sd[2] === undefined ? "none" : colOf(sd[2]), "fill-opacity": 0.2, stroke: "var(--fg)", "stroke-width": 2}, self.vorG);
242
+ });
243
+ seeds.forEach(function(sd){ D.el("circle", {cx: X(sd[0]), cy: Y(sd[1]), r: 4, fill: "var(--fg)"}, self.vorG); });
244
+ }
245
+ // 等高線(確率・決定関数)と、その値の名前(線の上、地の色の縁取り)
246
+ pl.fields.forEach(function(f, n){
247
+ var g = d.grid, dx = (rx[1] - rx[0]) / (g.nx - 1), dy = (ry[1] - ry[0]) / (g.ny - 1);
248
+ var gxp = function(p){ return X(rx[0] + p[0] * dx); }, gyp = function(p){ return Y(ry[0] + p[1] * dy); };
249
+ f.levels.forEach(function(lv, li){
250
+ var dash = (f.style || [])[li] === "dash";
251
+ K.lines(f.values, lv).forEach(function(line){
252
+ if (line.length < 2) return;
253
+ D.el("path", {d: "M" + line.map(function(p){ return gxp(p).toFixed(1) + " " + gyp(p).toFixed(1); }).join("L"), fill: "none", stroke: "var(--fg)", "stroke-width": dash ? 2 : 3, "stroke-dasharray": dash ? "10 8" : null}, self.fieldG[n]);
254
+ if (f.labels !== false){
255
+ var at = K.labelAt(line), x = gxp([at.x, at.y]), y = gyp([at.x, at.y]), len = Math.hypot(gxp(line[line.length - 1]) - gxp(line[0]), gyp(line[line.length - 1]) - gyp(line[0]));
256
+ if (at.length && (len > 3 * fs || line.length > 8)){
257
+ var t = D.el("text", {x: x.toFixed(1), y: (y + fs * 0.35).toFixed(1), "font-size": fs, "text-anchor": "middle", fill: "var(--fg)", stroke: "var(--bg)", "stroke-width": 6, "paint-order": "stroke", "stroke-linejoin": "round"}, self.fieldG[n]);
258
+ t.textContent = (lv < 0 ? "−" : "") + String(Math.abs(lv));
259
+ }
260
+ }
261
+ });
262
+ });
263
+ });
264
+ // 決定木の分割(親のセルの中の線)と葉
265
+ pl.splits.forEach(function(s){
266
+ var e = s.feature === 0 ? D.el("line", {x1: X(s.t), y1: Y(s.r[3]), x2: X(s.t), y2: Y(s.r[3]), stroke: "var(--fg)", "stroke-width": 3}, splitG) : D.el("line", {x1: X(s.r[0]), y1: Y(s.t), x2: X(s.r[0]), y2: Y(s.t), stroke: "var(--fg)", "stroke-width": 3}, splitG);
267
+ self.splitEls.push(e);
268
+ });
269
+ pl.leaves.forEach(function(lf){ D.el("rect", {x: X(lf.r[0]), y: Y(lf.r[3]), width: X(lf.r[1]) - X(lf.r[0]), height: Y(lf.r[2]) - Y(lf.r[3]), fill: colOf(lf.cls), "fill-opacity": 0.2}, self.leafG); });
270
+ // k 平均法のセル(重心のボロノイ図。描くたびに重心から計算)
271
+ if (pl.km){ this.kmCells = pl.km[0].centroids.map(function(_, c){ return D.el("path", {fill: CLASS_COLORS[c], "fill-opacity": 0.18, stroke: "var(--fg)", "stroke-width": 2, opacity: 0}, self.kmG); }); }
272
+ // 点
273
+ var ptG = this.ptG = D.el("g", {opacity: 0}, svg);
274
+ this.ptEls = d.points.map(function(p){ return self.marker(ptG, X(p[0]), Y(p[1]), pl.km ? -1 : pl.cls[p[2]], pl.km ? "var(--muted)" : colOf(p[2]), mr); });
275
+ this.svG = D.el("g", {opacity: 0}, svg);
276
+ (d.sv || []).forEach(function(n){ var p = d.points[n]; if (p) D.el("circle", {cx: X(p[0]), cy: Y(p[1]), r: mr + 7, fill: "none", stroke: "var(--fg)", "stroke-width": 3}, self.svG); });
277
+ if (pl.km) this.cEls = pl.km[0].centroids.map(function(_, c){ var g = D.el("g", {opacity: 0}, svg); D.el("path", {d: "M-12 -12L12 12M-12 12L12 -12", stroke: "var(--bg)", "stroke-width": 9, "stroke-linecap": "round"}, g); D.el("path", {d: "M-12 -12L12 12M-12 12L12 -12", stroke: CLASS_COLORS[c], "stroke-width": 5, "stroke-linecap": "round"}, g); return g; });
278
+ if (d.points.length * Math.PI * mr * mr > pw * ph * 0.35) ctx.report("layout", "[classify2d] " + d.points.length + " points cover more than a third of the plot at marker " + mr + " px; use a smaller marker or fewer points");
279
+ }
280
+ // クラスの印:○・□・△・◇(クラスの順)。i < 0 は印なしの○
281
+ marker(g, x, y, i, col, r){
282
+ var s = SHAPES[i] || "circle", e;
283
+ if (s === "circle") e = D.el("circle", {cx: x.toFixed(1), cy: y.toFixed(1), r: r, fill: col, stroke: "var(--bg)", "stroke-width": 1.5}, g);
284
+ else if (s === "square") e = D.el("rect", {x: (x - r * 0.9).toFixed(1), y: (y - r * 0.9).toFixed(1), width: (1.8 * r).toFixed(1), height: (1.8 * r).toFixed(1), fill: col, stroke: "var(--bg)", "stroke-width": 1.5}, g);
285
+ else if (s === "triangle") e = D.el("path", {d: "M" + x.toFixed(1) + " " + (y - 1.2 * r).toFixed(1) + "L" + (x + 1.1 * r).toFixed(1) + " " + (y + 0.8 * r).toFixed(1) + "L" + (x - 1.1 * r).toFixed(1) + " " + (y + 0.8 * r).toFixed(1) + "Z", fill: col, stroke: "var(--bg)", "stroke-width": 1.5}, g);
286
+ else e = D.el("path", {d: "M" + x.toFixed(1) + " " + (y - 1.25 * r).toFixed(1) + "L" + (x + 1.1 * r).toFixed(1) + " " + y.toFixed(1) + "L" + x.toFixed(1) + " " + (y + 1.25 * r).toFixed(1) + "L" + (x - 1.1 * r).toFixed(1) + " " + y.toFixed(1) + "Z", fill: col, stroke: "var(--bg)", "stroke-width": 1.5}, g);
287
+ return e;
288
+ }
289
+ render(k, t){
290
+ if (!this.svg) return;
291
+ var self = this, pl = this.plan(), G = this.geo, dur = this.props.dur, steps = pl.steps;
292
+ var ph = function(i){ return k > i + 1 ? 1 : k < i + 1 ? 0 : base.prog(t, 0, dur); };
293
+ var at = function(kind, i){ for (var n = 0; n < steps.length; n++) if (steps[n].kind === kind && (i === undefined || steps[n].i === i)) return n; return -1; };
294
+ this.ptG.setAttribute("opacity", ph(0).toFixed(3));
295
+ var r = at("regions"); this.regionG.setAttribute("opacity", r >= 0 ? ph(r).toFixed(3) : 0); this.vorG.setAttribute("opacity", r >= 0 ? ph(r).toFixed(3) : 0); this.boundaryG.setAttribute("opacity", r >= 0 ? ph(r).toFixed(3) : 0);
296
+ this.fieldG.forEach(function(g, n){ var s = at("field", n); g.setAttribute("opacity", ph(s).toFixed(3)); });
297
+ var sv = at("sv"); this.svG.setAttribute("opacity", sv >= 0 ? ph(sv).toFixed(3) : 0);
298
+ // 決定木:分割の線が親のセルの端から端へ伸びる
299
+ pl.splits.forEach(function(s, n){
300
+ var e = ph(at("split", n)), el = self.splitEls[n];
301
+ if (s.feature === 0){ el.setAttribute("y1", G.Y(s.r[3]).toFixed(1)); el.setAttribute("y2", G.Y(s.r[3] + (s.r[2] - s.r[3]) * e).toFixed(1)); }
302
+ else { el.setAttribute("x1", G.X(s.r[0]).toFixed(1)); el.setAttribute("x2", G.X(s.r[0] + (s.r[1] - s.r[0]) * e).toFixed(1)); }
303
+ el.setAttribute("opacity", e > 0 ? 1 : 0);
304
+ });
305
+ var lv = at("leaves"); this.leafG.setAttribute("opacity", lv >= 0 ? ph(lv).toFixed(3) : 0);
306
+ // k 平均法:割り当て(点の色とセル)、更新(重心が動き、セルが付いていく)
307
+ if (pl.km){
308
+ var km = pl.km, cur = -1, cs = km[0].centroids, assign = null, showCells = 0;
309
+ steps.forEach(function(s, n){
310
+ var e = ph(n);
311
+ if (e <= 0) return;
312
+ if (s.kind === "assign"){ cur = s.i; cs = km[s.i].centroids; assign = km[s.i].assign; showCells = e; }
313
+ if (s.kind === "update"){ var a = km[s.i].centroids, b = km[s.i + 1].centroids; cs = a.map(function(c, j){ return [c[0] + (b[j][0] - c[0]) * e, c[1] + (b[j][1] - c[1]) * e]; }); showCells = 1; }
314
+ });
315
+ var first = ph(0) > 0 ? 1 : 0;
316
+ this.cEls.forEach(function(g, j){ var c = cs[j]; g.setAttribute("transform", "translate(" + G.X(c[0]).toFixed(1) + " " + G.Y(c[1]).toFixed(1) + ")"); g.setAttribute("opacity", first); });
317
+ this.kmCells.forEach(function(p, j){ var poly = cell(cs, j, G.rect); p.setAttribute("d", poly.length > 2 ? "M" + poly.map(function(v){ return G.X(v[0]).toFixed(1) + " " + G.Y(v[1]).toFixed(1); }).join("L") + "Z" : ""); p.setAttribute("opacity", showCells.toFixed(3)); });
318
+ this.ptEls.forEach(function(e, n){ e.setAttribute("style", "fill:" + (assign ? CLASS_COLORS[assign[n]] : "var(--muted)")); });
319
+ }
320
+ }
321
+ };
322
+ });
@@ -0,0 +1,54 @@
1
+ ---
2
+ summary: Bars grow from 0 by step (vertical, horizontal, grouped, stacked); the axis max can widen by step
3
+ steps: max group/scale step (default 1 group = 1 step)
4
+ props:
5
+ orient: v or h
6
+ max: axis max (0 = auto)
7
+ unit: value unit
8
+ digits: decimals
9
+ per-step: groups per step (0 = all)
10
+ dur: grow seconds
11
+ stagger: group offset (s)
12
+ count: count values up
13
+ ticks: ticks and grid
14
+ zoom: scale-change seconds
15
+ al: axis title
16
+ stack: stack values; "percent" = 100 %
17
+ mark: bar or dot (a point with its error bar)
18
+ example: {"series": [{"label": "Sales"}], "groups": [{"label": "Year 1", "value": 1.2}, {"label": "Year 2", "value": 3.4}]}
19
+ ---
20
+
21
+ For quantities shown and compared one at a time: yearly sales, ranked answers, before/after.
22
+
23
+ Child JSON: `{"series": [...], "groups": [...], "scale": [...], "sig": [...]}`.
24
+
25
+ - group: `label` (`\n` = 2 lines), `value` or `values` (one per series), `step`, `at` (start s), `tone` (bar and value colour)
26
+ - err: ± number or `[low, high]`; per series for `values`
27
+ - sig: `[{"from": 0, "to": 2, "label": "**"}]` brackets groups 0 and 2 (`group`: series in a group); vertical, unstacked only
28
+ <!-- llm: omit -->
29
+ - Error bars and values appear once a bar is grown; values sit beyond the error bar's end. `mark="dot"` points appear without growing. Brackets stack from the shortest
30
+ <!-- llm: end -->
31
+ - series: `label` (2+ series: on the first group's bars; no legend), `tone` (default `--series-1..4`)
32
+ - scale: `[{"step": 3, "max": 27, "at": 0.4}]`: the max moves to `max` over `zoom` s; the old range stays as a faint band; taller bars stop at the top and grow as it widens
33
+ <!-- llm: omit -->
34
+ - Auto max: 1.12 × the largest value (before the first scale), rounded
35
+ <!-- llm: end -->
36
+ - `orient="h"`: names left, values right; `ticks="false"` for ranks
37
+ - `stack="true"` (`"percent"` = 100 %): a group's `values` in one bar; total at the end, values inside segments; values ≥ 0
38
+ <!-- llm: omit -->
39
+ - Values: `digits` decimals, thousands separators, `unit` appended
40
+ - Negatives (not stacked): the axis includes 0; bars grow down/left from a `--fg` baseline; values outside the bar end
41
+ - `stack="percent"`: axis 0–100 %, no `max`/`scale`, segment values in % when they fit, no total
42
+ - Show later steps faintly (`ctx.preview`): later bars fully grown at `--preview-opacity`; no axis change or over-max bar shown ahead
43
+ <!-- llm: end -->
44
+
45
+ The demo is `demo.html`. All numbers are fictional.
46
+
47
+ Notes
48
+
49
+ - Values appear once a bar is fully grown; `count="true"` counts them up
50
+ - Series names sit on the first group's bars: keep to 2–3 series
51
+
52
+ <!-- llm: omit -->
53
+ - `examples/tmlr2026-calibration` keeps its own deck-local `components/bars/`
54
+ <!-- llm: end -->