egatari 0.6.14 → 0.6.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -1
- package/README.ja.md +65 -64
- package/README.md +40 -39
- package/bin/egatari.mjs +3 -3
- package/components.lock.json +507 -153
- package/components2.lock.json +1710 -33
- package/kit/check-messages.mjs +105 -71
- package/kit/check.mjs +17 -11
- package/kit/core/article-messages.mjs +15 -15
- package/kit/core/article-render.mjs +1 -1
- package/kit/core/article-text.mjs +3 -1
- package/kit/core/build-core.mjs +23 -1
- package/kit/core/check-parity.mjs +2 -2
- package/kit/core/check-rules.mjs +12 -7
- package/kit/core/colab-core.mjs +2 -2
- package/kit/core/comment-core.mjs +6 -0
- package/kit/core/export-name.mjs +2 -2
- package/kit/core/geometry-check.mjs +363 -25
- package/kit/core/layout-scan.mjs +75 -5
- package/kit/core/live-policy.mjs +2 -2
- package/kit/core/live.mjs +2 -2
- package/kit/core/llm-fix.mjs +24 -13
- package/kit/core/llm-insert.mjs +11 -11
- package/kit/core/llm-outline.mjs +7 -7
- package/kit/core/llm-pack-assemble.mjs +5 -2
- package/kit/core/llm-pack-data.mjs +225 -39
- package/kit/core/llm-pack.mjs +3 -3
- package/kit/core/new-deck.mjs +17 -3
- package/kit/core/part-labels.mjs +6 -0
- package/kit/core/parts2.mjs +5 -5
- package/kit/core/player.mjs +18 -0
- package/kit/core/portable.mjs +26 -8
- package/kit/core/purposes.mjs +2 -2
- package/kit/core/ref-voice.mjs +1 -1
- package/kit/core/scorm.mjs +1 -1
- package/kit/core/sound-preferences.mjs +1 -1
- package/kit/core/theme-derive.mjs +209 -0
- package/kit/core/themes-list.mjs +1 -1
- package/kit/core/themes-lock.mjs +1 -1
- package/kit/core/tier-a.mjs +20 -8
- package/kit/deck.js +7 -4
- package/kit/instruction-version.json +1 -1
- package/kit/live.js +20 -20
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/presenter.js +5 -3
- package/kit/templates/new-deck.mjs +6 -6
- package/kit/tools.js +13 -6
- package/kit/track.js +1 -1
- package/package.json +4 -2
- package/server/dev.mjs +3 -2
- package/server/editor-ui.js +28 -20
- package/server/hints.js +22 -2
- package/tts/yomi.yaml +8 -0
- package/vendor/components/CATALOG.md +21 -14
- package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/README.en.md +40 -0
- package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/index.js +408 -0
- package/vendor/components/sha256/0396a1895978803ae342b7f598f187b17ead47800e8f8317a5cb041111349813/index.js +278 -0
- package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/README.en.md +26 -0
- package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/index.js +322 -0
- package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/README.en.md +54 -0
- package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/index.js +470 -0
- package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/README.en.md +18 -0
- package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/index.js +279 -0
- package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/README.en.md +31 -0
- package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/index.js +267 -0
- package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/README.en.md +53 -0
- package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/index.js +171 -0
- package/vendor/components/sha256/1117758820dc561f41cf9d1cc0bab8cf3173cde7771ac10a12b94c96007c0f55/index.js +268 -0
- package/vendor/components/sha256/137017ad452afe209bdff81bc02ffae99c6b60a1c4aed2383515974f65511ff2/index.js +205 -0
- package/vendor/components/sha256/1a1471ba5f68e54304825a64e736afeda421e3763cdcbcdab2e45509562a0291/index.js +607 -0
- package/vendor/components/sha256/1b15fcc12b2fa43821e6299e87aae31aa69dbbc5a0d1b80088a5d7c5f8b8f7f5/index.js +429 -0
- package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/README.en.md +23 -0
- package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/index.js +147 -0
- package/vendor/components/sha256/21c099461befc0d382ddfe982f2a6cd8eeb6dd731252164ac619525e4bacdf0d/index.js +242 -0
- package/vendor/components/sha256/2352e0e22460f4a3c46dca6cef27cd9c63f161a411f1cf56c75c585e9124503c/index.js +315 -0
- package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/README.en.md +53 -0
- package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/index.js +171 -0
- package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/README.en.md +38 -0
- package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/index.js +414 -0
- package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/README.en.md +45 -0
- package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/index.js +211 -0
- package/vendor/components/sha256/2f111b900898579b3ec1611c2110db336a46d9133171a0cbb125ee37bd1f24f8/index.js +592 -0
- package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/README.en.md +45 -0
- package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/index.js +211 -0
- package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/README.en.md +20 -0
- package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/index.js +310 -0
- package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/README.en.md +35 -0
- package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/index.js +179 -0
- package/vendor/components/sha256/3af0b84b1799fc64ec74d6da9cbd343eccd89e8a11c81bfb444562c911284442/index.js +342 -0
- package/vendor/components/sha256/3c69bf3b3c6b9f76048fbc0839b3aa9699723570086d3d44bac799230ed6de5b/index.js +121 -0
- package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/README.en.md +37 -0
- package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/index.js +501 -0
- package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/README.en.md +38 -0
- package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/index.js +414 -0
- package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/README.en.md +30 -0
- package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/index.js +305 -0
- package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/README.en.md +31 -0
- package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/index.js +236 -0
- package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/README.en.md +21 -0
- package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/index.js +108 -0
- package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/README.en.md +28 -0
- package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/index.js +213 -0
- package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/README.en.md +35 -0
- package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/index.js +179 -0
- package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/README.en.md +53 -0
- package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/index.js +171 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/chords.json +89 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/extras.json +192 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ties.json +360 -0
- package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/index.js +508 -0
- package/vendor/components/sha256/59996a56df462b36e24a928d4397c9308d9e39ad8224ebd19fb5c981608ef458/index.js +521 -0
- package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/README.en.md +30 -0
- package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/index.js +305 -0
- package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/README.en.md +30 -0
- package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/index.js +192 -0
- package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/README.en.md +20 -0
- package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/index.js +307 -0
- package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/README.en.md +24 -0
- package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/index.js +554 -0
- package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/README.en.md +25 -0
- package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/index.js +316 -0
- package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/README.en.md +18 -0
- package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/index.js +279 -0
- package/vendor/components/sha256/624acb997c4975ace65570b529b3ba00baa421c80ecb7fc80f392a64e8c573a7/index.js +107 -0
- package/vendor/components/sha256/62602488ee33dd4bdef8516de16da5ab27d7f7265d5041681beab80e08f1d482/index.js +97 -0
- package/vendor/components/sha256/67eaf344bddac79b74ed03fdcd70285c7b52b160e6c5ffbd6897848179aa5230/index.js +818 -0
- package/vendor/components/sha256/682c9c8871eccd19ff1264e0323a2e4c5798b0488b612ba0339c6fe85aab5914/index.js +926 -0
- package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/README.en.md +51 -0
- package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/index.js +230 -0
- package/vendor/components/sha256/72138936ed0b8fd3cb0214ae7ed250ae3f1f8b21ed6fd593544947774064ba0d/index.js +250 -0
- package/vendor/components/sha256/74c1a0f3ed1370c5003aa5770ee28cea2ce994d415680116a92fdbcd5854ba62/index.js +198 -0
- package/vendor/components/sha256/76125035eb153b98befa9c735bcd9fc4f99f774dc1d082fdae40acaadfe7d95b/index.js +818 -0
- package/vendor/components/sha256/7728cf7dde88a6688aba0ed70f23f7e21362a147beac09c1fa1a4b773e08e93b/index.js +354 -0
- package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/README.en.md +23 -0
- package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/index.js +289 -0
- package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/README.en.md +31 -0
- package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/index.js +236 -0
- package/vendor/components/sha256/7d50e50fbb6c5ec636b62509bd88ddaac1870e0522cf11bcc293ce924d48072d/index.js +312 -0
- package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/README.en.md +42 -0
- package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/index.js +549 -0
- package/vendor/components/sha256/87fc302c41b2bfeea88951ed689ec01b4dc79218c4bc69b310dc2228dfa2e153/index.js +926 -0
- package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/README.en.md +24 -0
- package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/index.js +103 -0
- package/vendor/components/sha256/89c8c16788e24df17920542ed6eb6557dea4a10e835de8fe839e439ccbba8014/index.js +69 -0
- package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/README.en.md +44 -0
- package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/index.js +304 -0
- package/vendor/components/sha256/8d9af78aef44ad2f98101c67d32473373d39725a09c923969aa621d5f5b124bb/index.js +121 -0
- package/vendor/components/sha256/8f861d71df72a82be86a3e63abf7d69bbab5aac6fa68be6e077c4e19c3519ed8/index.js +312 -0
- package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/README.en.md +54 -0
- package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/index.js +470 -0
- package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/README.en.md +24 -0
- package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/index.js +214 -0
- package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/README.en.md +33 -0
- package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/index.js +390 -0
- package/vendor/components/sha256/9289efef4a75afe011e54a17e34db08cfb16a450b2e0653e6a98525495cfba99/index.js +315 -0
- package/vendor/components/sha256/93256a923199ea51108cdb7491c3c96f376dbef15b64cbf1a1aa7cc5726b4970/index.js +429 -0
- package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/README.en.md +24 -0
- package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/index.js +550 -0
- package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/README.en.md +28 -0
- package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/index.js +213 -0
- package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/README.en.md +40 -0
- package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/index.js +348 -0
- package/vendor/components/sha256/97c074a5473618c65f4c23263f056870a0b7940e73475f2a1f32f68c08d8eb0f/index.js +198 -0
- package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/README.en.md +66 -0
- package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/index.js +984 -0
- package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/README.en.md +34 -0
- package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/index.js +244 -0
- package/vendor/components/sha256/a18b2b15d00c76462a43823b5c270c7ddd7c31794da9c236f74f20f80ec2ffdb/index.js +354 -0
- package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/README.en.md +32 -0
- package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/index.js +222 -0
- package/vendor/components/sha256/a979207c60fbd2a12cb557297eb0217eb098d660de684530a0f43d0d9c64e6ef/index.js +312 -0
- package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/README.en.md +34 -0
- package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/index.js +244 -0
- package/vendor/components/sha256/af7ed69b8969f6da14784b6e9d26e4dfd20147772ea172a99bd936a71be10fcd/index.js +278 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/chords.json +89 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/extras.json +192 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ties.json +360 -0
- package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/index.js +508 -0
- package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/README.en.md +66 -0
- package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/index.js +990 -0
- package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/README.en.md +24 -0
- package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/index.js +550 -0
- package/vendor/components/sha256/b8096d7a60609520981273673761a110e40e3bdf52a7ab5548363b20e16f6e93/index.js +404 -0
- package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/README.en.md +32 -0
- package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/index.js +222 -0
- package/vendor/components/sha256/bd8e3893df02411deccc1d6d7b02292ca0d59dfeddfafcf99419430981572c82/index.js +351 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/chords.json +89 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/extras.json +192 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ties.json +360 -0
- package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/index.js +508 -0
- package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/README.en.md +31 -0
- package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/index.js +267 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/LICENSE-strokesvg.txt +115 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/OFL.txt +93 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/index.js +749 -0
- package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/strokes-CHANGES.md +20 -0
- package/vendor/components/sha256/c791e69e722f64146242f97acb29a341160d0c327cfe1d76307954d80e70db85/index.js +268 -0
- package/vendor/components/sha256/c8c0de41d603b61c6ec4dc1da5b50559e213dd1f3693ee5019df858016fd6daf/index.js +747 -0
- package/vendor/components/sha256/c99d4f2ab443484b9f462e405c72ea4794838b88f8823f27c606d12cbbedb996/index.js +404 -0
- package/vendor/components/sha256/cbde046e30c35db60259911a88e2ae0bedaf545e29b1da8b8ce13bc602a33c19/index.js +465 -0
- package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/README.en.md +51 -0
- package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/index.js +228 -0
- package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/README.en.md +35 -0
- package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/index.js +179 -0
- package/vendor/components/sha256/cf0985ffcd8e7cbe2175ddb9a4342b2a4aa3f322794188fc99af8789b494460d/index.js +521 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/LICENSE-strokesvg.txt +115 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/OFL.txt +93 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/index.js +749 -0
- package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/strokes-CHANGES.md +20 -0
- package/vendor/components/sha256/d01dc7fd78d08dd720ed86b39d7877dc0913d72e914036088a86af2df2faee52/index.js +484 -0
- package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/README.en.md +24 -0
- package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/index.js +214 -0
- package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/README.en.md +31 -0
- package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/index.js +271 -0
- package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/README.en.md +25 -0
- package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/index.js +316 -0
- package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/README.en.md +23 -0
- package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/index.js +120 -0
- package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/README.en.md +40 -0
- package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/index.js +405 -0
- package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/README.en.md +66 -0
- package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/index.js +984 -0
- package/vendor/components/sha256/ddd4b9cbbc282cbb3117ff662e1a14ecdb3cc7c16072a574418ec6a6eecef4d8/index.js +107 -0
- package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/README.en.md +22 -0
- package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/index.js +145 -0
- package/vendor/components/sha256/e2da948daac7bfac158857877b5a6932dbd2369e73901abcef118c92dd20b725/index.js +747 -0
- package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/README.en.md +42 -0
- package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/index.js +268 -0
- package/vendor/components/sha256/e653a4da80f7761442dc5b504ea5b0700fd0acf1979beeff56122cfdb3d4654c/index.js +607 -0
- package/vendor/components/sha256/ea217c6821e931b2d8474bf56d38f2dcc89ec705fe1d276f313e1c7e8db2b98a/index.js +233 -0
- package/vendor/components/sha256/ea2e4e24838574f607879c7d05556281258c018331e4da3e6f3a5263173f2e99/index.js +75 -0
- package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/README.en.md +42 -0
- package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/index.js +549 -0
- package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/README.en.md +44 -0
- package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/index.js +203 -0
- package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/README.en.md +34 -0
- package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/index.js +244 -0
- package/vendor/components/sha256/fa1a09c10181456143d125d68dbbdcacde6bab2e4a2b3e573367103ce28ebf55/index.js +228 -0
- package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/README.en.md +51 -0
- package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/index.js +228 -0
- package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/README.en.md +23 -0
- package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/index.js +147 -0
- package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/README.en.md +20 -0
- package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/index.js +307 -0
- package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/README.en.md +26 -0
- package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/index.js +322 -0
- package/vendor/components-2/manifest-2.12.0.json +2348 -0
- package/vendor/components-2/manifest-2.13.0.json +2477 -0
- package/vendor/components-2/manifest-2.14.0.json +2460 -0
- package/vendor/components-2/manifest-2.14.1.json +2460 -0
- package/vendor/components-2/manifest-2.15.0.json +2460 -0
- package/vendor/egatari-spec/SOURCE.json +3 -3
- package/vendor/egatari-spec/schema/deck-meta.schema.json +16 -1
- package/vendor/egatari-spec/schema/egatari-metadata.schema.json +17 -2
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
// m-fishbone:原因と結果の図(特性要因図・フィッシュボーン図)を、骨 1 本ずつ組み立てる
|
|
2
|
+
// <m-fishbone style="height:450px"><script type="application/json">
|
|
3
|
+
// {"effect": {"label": "配送の遅れ"},
|
|
4
|
+
// "nodes": [{"id": "p", "label": "人"}, {"id": "p1", "label": "人手が足りない", "parent": "p"}, …]}
|
|
5
|
+
// (JSON の終わり)</m-fishbone>
|
|
6
|
+
// 座標は書かない(docs/conventions.md §2)。parent のない節が大骨(分類:人・機械・方法・材料など)、その子が原因(中骨)、孫が細かい原因(小骨)。3 段まで
|
|
7
|
+
// 頭(結果の箱)は右、背骨は横。大骨は上下に交互に、斜めに付く。原因は大骨に付く横の線の上に書き、細かい原因は原因の線から大骨と平行に下ろした線に付ける
|
|
8
|
+
// 段階:order="causes-first"(既定:大骨 1 本ずつ(その原因と一緒に)、最後に頭)か order="effect-first"(頭と背骨、それから大骨 1 本ずつ)。節の step が勝つ
|
|
9
|
+
// edges:原因どうしなど、ほかのつながり(破線、矢印つき)。段階は両端の遅いほう
|
|
10
|
+
// 字の大きさは要素の大きさから決め(27 px から)、入らなければ 24 px まで縮める。それでも入らなければ、字は 24 px のまま
|
|
11
|
+
// 大骨の間を詰め、要素の箱からはみ出して ctx.report("size", …)(足りない px)
|
|
12
|
+
// 見せ方(docs/conventions.md §2.5):fade(箱と字が下から 12 px 上がりながら現れてから線を引く、既定)・draw(線を先に引き、
|
|
13
|
+
// その先に箱と字が現れる)・grow(分類の箱が背骨の側から 12 px 寄りながら 0.92 → 1 に、原因の字が大骨の側から 12 px 寄って出る)。
|
|
14
|
+
// 箱と字の動きはどれも 12 px まで。段階の数・長さ・最後の中身はどれも同じ
|
|
15
|
+
// 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・mtext・prog・lerp・variant・previewOpacity を使い、プレイヤーのグローバルは使わない。
|
|
16
|
+
// 式(tex)は組み立てのときに KaTeX で描く(spec §6.2):build.fields の effect.tex・nodes[].tex を作り手が描いて texHtml を足し、
|
|
17
|
+
// この部品は markup-reader で決まった要素と属性だけを読んで置く(再生のときに KaTeX は動かない)。描いた結果がなければ tex を字のまま出して知らせる。
|
|
18
|
+
// 入らないときは ctx.report("size", "[fishbone] …") で知らせる(1.x の console.warn の代わり)
|
|
19
|
+
egatariParts.define({name: "fishbone", version: "2.1.2", requires: {base: "1.3.0", "markup-reader": "1.0.3"}, element: "m-fishbone"}, function(deps){
|
|
20
|
+
"use strict";
|
|
21
|
+
var base = deps.base, MR = deps["markup-reader"];
|
|
22
|
+
// KaTeX の式のおよその幅(em)。\text{…} などの中は字ごとに、命令は表から(ない命令は 1 em)、^ と _ の中は 0.7 倍
|
|
23
|
+
var TEX_WIDE = {Longleftrightarrow: 1.86, longleftrightarrow: 1.86, Longrightarrow: 1.64, longrightarrow: 1.64, Longleftarrow: 1.64, longleftarrow: 1.64,
|
|
24
|
+
longmapsto: 1.64, leftrightarrow: 1.0, Leftrightarrow: 1.0, rightarrow: 1.0, leftarrow: 1.0, Rightarrow: 1.0, Leftarrow: 1.0, to: 1.0, mapsto: 1.0,
|
|
25
|
+
iff: 2.42, implies: 2.2, impliedby: 2.2, sum: 1.06, prod: 0.95, int: 0.56, quad: 1.0, qquad: 2.0, cdots: 1.17, ldots: 1.17, dots: 1.17, infty: 1.0,
|
|
26
|
+
le: 1.06, ge: 1.06, leq: 1.06, geq: 1.06, ne: 1.06, neq: 1.06, approx: 1.06, equiv: 1.06, times: 1.0, div: 1.0, pm: 1.0, cdot: 0.5,
|
|
27
|
+
alpha: 0.64, beta: 0.57, gamma: 0.52, delta: 0.45, theta: 0.47, lambda: 0.58, mu: 0.6, pi: 0.57, sigma: 0.57, omega: 0.62, Sigma: 0.72, Delta: 0.83, Omega: 0.72,
|
|
28
|
+
",": 0.17, ":": 0.22, ";": 0.28, "!": 0, " ": 0.33};
|
|
29
|
+
var TEX_SKIP = /^(left|right|big|Big|bigg|Bigg|displaystyle|textstyle|mathit|mathcal|mathbb|boldsymbol|hat|bar|vec|tilde|dot|overline|underline)$/;
|
|
30
|
+
function texCharEm(c){
|
|
31
|
+
if (/[WM]/.test(c)) return 1.03;
|
|
32
|
+
if (/[A-Z]/.test(c)) return 0.76;
|
|
33
|
+
if (/[mw]/.test(c)) return 0.84;
|
|
34
|
+
if (/[a-z]/.test(c)) return 0.53;
|
|
35
|
+
if (/[0-9]/.test(c)) return 0.5;
|
|
36
|
+
if (/[+=<>\-]/.test(c)) return 1.0;
|
|
37
|
+
if (/[()\[\]|\/]/.test(c)) return 0.42;
|
|
38
|
+
if (/[.,;:!' ]/.test(c)) return 0.3;
|
|
39
|
+
return /[ -鿿-]/.test(c) ? 1.0 : 0.6;
|
|
40
|
+
}
|
|
41
|
+
// s の i 番目の { から対応する } の後ろまで
|
|
42
|
+
function texGroup(s, i){ var d = 0, j = i; do { var c = s.charAt(j); if (c === "{") d++; else if (c === "}") d--; j++; } while (d > 0 && j < s.length); return {inner: s.slice(i + 1, j - 1), end: j}; }
|
|
43
|
+
function texEm(src){
|
|
44
|
+
var s = String(src || ""), i = 0, w = 0;
|
|
45
|
+
while (i < s.length){
|
|
46
|
+
var c = s.charAt(i);
|
|
47
|
+
if (c === "\\"){
|
|
48
|
+
var m = /^\\([a-zA-Z]+|.)/.exec(s.slice(i)), cmd = m ? m[1] : "";
|
|
49
|
+
i += m ? m[0].length : 1;
|
|
50
|
+
if (/^(text|textrm|textbf|mathrm|mathbf|operatorname|mbox)$/.test(cmd) && s.charAt(i) === "{"){
|
|
51
|
+
var g = texGroup(s, i);
|
|
52
|
+
for (var k = 0; k < g.inner.length; k++) w += texCharEm(g.inner.charAt(k));
|
|
53
|
+
i = g.end; continue;
|
|
54
|
+
}
|
|
55
|
+
if (/^(frac|dfrac|tfrac)$/.test(cmd) && s.charAt(i) === "{"){
|
|
56
|
+
var a = texGroup(s, i), b = s.charAt(a.end) === "{" ? texGroup(s, a.end) : {inner: "", end: a.end};
|
|
57
|
+
w += Math.max(texEm(a.inner), texEm(b.inner)) * (cmd === "dfrac" ? 1 : 0.8) + 0.24;
|
|
58
|
+
i = b.end; continue;
|
|
59
|
+
}
|
|
60
|
+
if (cmd === "sqrt"){ w += 0.85; continue; }
|
|
61
|
+
if (TEX_SKIP.test(cmd)) continue;
|
|
62
|
+
w += TEX_WIDE[cmd] !== undefined ? TEX_WIDE[cmd] : 1.0;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (c === "^" || c === "_"){
|
|
66
|
+
i++;
|
|
67
|
+
if (s.charAt(i) === "{"){ var sg = texGroup(s, i); w += texEm(sg.inner) * 0.7; i = sg.end; }
|
|
68
|
+
else if (s.charAt(i) === "\\"){ var m2 = /^\\([a-zA-Z]+|.)/.exec(s.slice(i)); w += texEm(m2 ? m2[0] : "") * 0.7; i += m2 ? m2[0].length : 1; }
|
|
69
|
+
else { w += texCharEm(s.charAt(i)) * 0.7; i++; }
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (c === "{" || c === "}"){ i++; continue; }
|
|
73
|
+
w += texCharEm(c); i++;
|
|
74
|
+
}
|
|
75
|
+
return w;
|
|
76
|
+
}
|
|
77
|
+
var Part = class extends base.MotionElement {
|
|
78
|
+
static partName = "fishbone"; // the registry name (define meta name), for report prefixes
|
|
79
|
+
// 組み立てのときに描く欄(spec §6.2)。式の意味は字(tex)でも持つので、KaTeX の出力は HTML だけ
|
|
80
|
+
static build = {fields: {"effect.tex": "katex", "nodes[].tex": "katex"}, options: {katex: {output: "html"}}};
|
|
81
|
+
static variants = ["fade", "draw", "grow"];
|
|
82
|
+
// データの形(kit/shape.js)
|
|
83
|
+
static shape = {
|
|
84
|
+
schema: {type: "object", additionalProperties: false, required: ["effect", "nodes"], properties: {
|
|
85
|
+
effect: {type: "object", properties: {label: {type: "string"}, tex: {type: "string"}, texHtml: {type: "string"}, note: {type: "string"}, tone: {type: "string"}, step: {type: "integer"}, at: {type: "number"}}},
|
|
86
|
+
nodes: {type: "array", minItems: 1, items: {type: "object", required: ["id"], properties: {
|
|
87
|
+
id: {type: ["string", "integer"]}, label: {type: "string"}, tex: {type: "string"}, texHtml: {type: "string"}, note: {type: "string"}, tone: {type: "string"},
|
|
88
|
+
parent: {type: ["string", "integer"]}, step: {type: "integer"}, at: {type: "number"}}}},
|
|
89
|
+
edges: {type: "array", items: {type: "object", required: ["from", "to"], properties: {
|
|
90
|
+
from: {type: ["string", "integer"]}, to: {type: ["string", "integer"]}, label: {type: "string"}, tone: {type: "string"}, dash: {type: "boolean"},
|
|
91
|
+
step: {type: "integer"}, at: {type: "number"}}}},
|
|
92
|
+
renderers: {type: "object"}}},
|
|
93
|
+
example: {effect: {label: "配送の遅れ"}, nodes: [{id: "p", label: "人"}, {id: "p1", label: "人手が足りない", parent: "p"}, {id: "m", label: "機械"}, {id: "m1", label: "車の故障", parent: "m"}]},
|
|
94
|
+
note: {en: "nodes without parent are main bones (categories); their children are causes, grandchildren finer causes (3 levels max)", ja: "parent のない節が大骨(分類)、その子が原因、孫が細かい原因(3 段まで)"},
|
|
95
|
+
};
|
|
96
|
+
static props = {
|
|
97
|
+
order: {type: "string", default: "causes-first", doc: "ステップの順:causes-first(大骨 1 本ずつ、最後に頭、既定)か effect-first(頭と背骨が先)"},
|
|
98
|
+
size: {type: "number", default: 0, doc: "箱の字の大きさ(px。0 = 27 から入るまで 24 まで縮める)"},
|
|
99
|
+
fade: {type: "number", default: 0.45, doc: "箱が現れる秒数"},
|
|
100
|
+
draw: {type: "number", default: 0.5, doc: "線を引く秒数"},
|
|
101
|
+
};
|
|
102
|
+
// 骨の形と段階(mount の前にも段階の数のために使う)
|
|
103
|
+
plan(){
|
|
104
|
+
if (this._plan) return this._plan;
|
|
105
|
+
var d = this.data || {}, P = this.props, byId = {}, cats = [], notes = this._notes = []; // データの問題:mount が ctx.report で知らせる
|
|
106
|
+
var nodes = (d.nodes || []).map(function(n){
|
|
107
|
+
var o = {n: n, kids: []};
|
|
108
|
+
if (/^@/.test(String(n.id))) notes.push("[fishbone] the id " + JSON.stringify(n.id) + " starts with @, which is kept for the part's own marks (@head, @spine, @tail); use another id");
|
|
109
|
+
if (byId[n.id]) notes.push("[fishbone] the id " + JSON.stringify(n.id) + " is used by more than one node (parent and edges refer to the last one; give each node its own id)");
|
|
110
|
+
byId[n.id] = o; return o;
|
|
111
|
+
});
|
|
112
|
+
nodes.forEach(function(o){
|
|
113
|
+
if (o.n.parent === undefined || o.n.parent === null) cats.push(o);
|
|
114
|
+
else if (!byId[o.n.parent]) throw new Error("m-fishbone: node " + JSON.stringify(o.n.id) + " has an unknown parent " + JSON.stringify(o.n.parent));
|
|
115
|
+
else byId[o.n.parent].kids.push(o);
|
|
116
|
+
});
|
|
117
|
+
if (!cats.length) throw new Error("m-fishbone: no main bone (a node without parent)");
|
|
118
|
+
var seen = 0;
|
|
119
|
+
cats.forEach(function(c){
|
|
120
|
+
(function walk(o, lv){
|
|
121
|
+
if (++seen > nodes.length) throw new Error("m-fishbone: the parents form a loop");
|
|
122
|
+
if (lv > 2) throw new Error("m-fishbone: " + JSON.stringify(o.n.id) + " is deeper than 3 levels (main bone, cause, sub-cause)");
|
|
123
|
+
o.lv = lv; o.kids.forEach(function(k){ k.par = o; walk(k, lv + 1); });
|
|
124
|
+
})(c, 0);
|
|
125
|
+
});
|
|
126
|
+
if (seen !== nodes.length) throw new Error("m-fishbone: the parents form a loop");
|
|
127
|
+
var ef = d.effect || {}, effFirst = P.order === "effect-first", n = cats.length;
|
|
128
|
+
var head = {n: ef, step: ef.step !== undefined ? ef.step : effFirst ? 1 : n + 1, at: ef.at || 0};
|
|
129
|
+
var spineStep = effFirst ? head.step : 1;
|
|
130
|
+
cats.forEach(function(c, i){
|
|
131
|
+
c.step = c.n.step !== undefined ? c.n.step : effFirst ? i + 2 : i + 1;
|
|
132
|
+
// 大骨の行:原因と、その下の細かい原因(上から下の順)
|
|
133
|
+
c.rows = [];
|
|
134
|
+
c.kids.forEach(function(k){ c.rows.push(k); k.kids.forEach(function(s){ c.rows.push(s); }); });
|
|
135
|
+
c.rows.forEach(function(r){ r.step = r.n.step !== undefined ? r.n.step : c.step; r.cat = c; });
|
|
136
|
+
});
|
|
137
|
+
var edges = (d.edges || []).map(function(e){
|
|
138
|
+
var a = byId[e.from], b = byId[e.to];
|
|
139
|
+
if (!a || !b) throw new Error("m-fishbone: edge to an unknown node " + JSON.stringify(a ? e.to : e.from));
|
|
140
|
+
return {e: e, a: a, b: b, step: e.step !== undefined ? e.step : Math.max(a.step, b.step)};
|
|
141
|
+
});
|
|
142
|
+
return (this._plan = {cats: cats, nodes: nodes, head: head, spineStep: spineStep, edges: edges, byId: byId});
|
|
143
|
+
}
|
|
144
|
+
get steps(){
|
|
145
|
+
if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
|
|
146
|
+
var p = this.plan(), m = Math.max(p.head.step, p.spineStep);
|
|
147
|
+
p.nodes.concat(p.edges).forEach(function(o){ m = Math.max(m, o.step); });
|
|
148
|
+
return m;
|
|
149
|
+
}
|
|
150
|
+
// 1 つのものが現れて線を引き終わるまで(どの見せ方でも同じ)
|
|
151
|
+
span(){ return this.props.fade * 0.6 + this.props.draw; }
|
|
152
|
+
mount(ctx){
|
|
153
|
+
var P = this.props, D = base, self = this, pl = this.plan(), sk = MR.sink(this, ctx);
|
|
154
|
+
this._notes.forEach(function(m){ ctx.report("data", m); });
|
|
155
|
+
this.variant = base.variant(this);
|
|
156
|
+
this.style.display = "block"; this.style.position = "relative";
|
|
157
|
+
var W = this.clientWidth, H = this.clientHeight;
|
|
158
|
+
var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
|
|
159
|
+
var root = D.el("g", {}, svg), gL = D.el("g", {}, root), gT = D.el("g", {}, root), gE = D.el("g", {}, root), gN = D.el("g", {}, root);
|
|
160
|
+
// 字の幅の見積もり(字の大きさ 1 あたり。base の textWidth:テーマの字で測った幅。*斜体* などの記号は数えない)
|
|
161
|
+
var est = function(s){ return D.textWidth(s, 1, {font: self, mark: true}); };
|
|
162
|
+
var texEst = function(s){ return Math.max(1, String(s).replace(/\\[a-zA-Z]+/g, "x").replace(/[{}^_\\ ]/g, "").length) * 0.62; };
|
|
163
|
+
// TeX の式の幅(px):KaTeX の字の幅(em)から見積もる。画面で測らない(KaTeX の字が読み込まれる前に測ると狭く出て、
|
|
164
|
+
// 測る時刻で箱の大きさが変わるため)。長い矢印や W のような幅の広い記号も数え、これまでの見積もり(字数 × 0.62 字)より狭くはしない
|
|
165
|
+
// (components 2.9.0。前は \Longleftrightarrow や \text{WWWWWWWW} が箱から 9〜63 px はみ出した)
|
|
166
|
+
var texW = function(n, s){ return Math.max(texEm(n.tex), texEst(n.tex)) * s; };
|
|
167
|
+
var tones = {term: ["var(--term)", "var(--term-tint)", "var(--fg)"], emph: ["var(--emph)", "var(--emph-tint)", "var(--emph)"]};
|
|
168
|
+
var toneOf = function(t, dflt){
|
|
169
|
+
if (tones[t]) return tones[t];
|
|
170
|
+
if (/^(muted|accent2|series-[1-4])$/.test(t || "")) return ["var(--" + t + ")", "var(--bg)", "var(--" + t + ")"];
|
|
171
|
+
return tones[dflt || "term"];
|
|
172
|
+
};
|
|
173
|
+
var NS = 24, NLH = 30, cats = pl.cats, nc = cats.length, cols = Math.ceil(nc / 2);
|
|
174
|
+
var R = Math.max(1, Math.max.apply(null, cats.map(function(c){ return c.rows.length; })));
|
|
175
|
+
var M1 = 12, M2 = 14, TXT = 31; // 箱と最初の行の間、最後の行と背骨の間、字の行の高さ(字の上端から線まで)
|
|
176
|
+
// 大きさ s、行の高さ rh、傾き k(縦 1 px あたりの横)で 1 本の大骨を局所座標(背骨に付く点が原点)で測る
|
|
177
|
+
function box(n, s){
|
|
178
|
+
var lines = n.tex ? [n.tex] : String(n.label || "").split("\n");
|
|
179
|
+
var tw = n.tex ? texW(n, s) : Math.max.apply(null, lines.map(est)) * s;
|
|
180
|
+
var notes = n.note ? String(n.note).split("\n") : [];
|
|
181
|
+
return {lines: lines, w: Math.max(s * 2.4, tw + s * 1.3), h: (n.tex ? s * 1.5 : lines.length * s * 1.25) + s * 0.75,
|
|
182
|
+
notes: notes, nw: notes.length ? Math.max.apply(null, notes.map(est)) * NS : 0, nh: notes.length ? notes.length * NLH + 4 : 0};
|
|
183
|
+
}
|
|
184
|
+
function boneGeom(c, i, s, rh, k){
|
|
185
|
+
var up = i % 2 === 0, sg = up ? -1 : 1, cs = Math.max(24, s - 1), ss = 24;
|
|
186
|
+
var Lv = R * rh + M1 + M2, g = {up: up, sg: sg, Lv: Lv, k: k, cs: cs};
|
|
187
|
+
g.b = box(c.n, s);
|
|
188
|
+
var xo = -Lv * k;
|
|
189
|
+
g.outer = [xo, sg * Lv];
|
|
190
|
+
g.boxX = xo - g.b.w / 2; g.boxY = up ? -Lv - g.b.h : Lv;
|
|
191
|
+
var xb = function(v){ return -v * k; };
|
|
192
|
+
var lo = Math.min(g.boxX, xo - g.b.nw / 2), hi = Math.max(0, g.boxX + g.b.w, xo + g.b.nw / 2);
|
|
193
|
+
g.rows = [];
|
|
194
|
+
c.rows.forEach(function(o, r){
|
|
195
|
+
// 行 r の横の線の、背骨からの縦の距離 v(上の骨は外から内へ、下の骨は内から外へ並ぶ)。字は線の上(画面で上)に書く
|
|
196
|
+
var v = up ? Lv - M1 - (r + 1) * rh + 6 : M2 + (r + 1) * rh - 6, y = sg * v, sz = o.lv === 1 ? cs : ss;
|
|
197
|
+
// 字の幅:tex は字数から見積もる。note は後ろに続けて小さく(--muted)書く
|
|
198
|
+
var nw = o.n.note ? est(" " + o.n.note) * NS : 0, tw = (o.n.tex ? texW(o.n, sz) : est(o.n.label || "") * sz) + nw, x0, xe, mini = null;
|
|
199
|
+
if (o.lv === 1){ x0 = xb(v); xe = Math.min(xb(v), xb(v - sg * TXT)) - 10; }
|
|
200
|
+
else {
|
|
201
|
+
// 細かい原因:親の原因の線から、大骨と平行な線を下ろした先に付く
|
|
202
|
+
var pr = g.rows[c.rows.indexOf(o.par)], xp = xb(pr.v) - (40 + 30 * k), py = pr.y;
|
|
203
|
+
var xm = function(yy){ return xp + (up ? 1 : -1) * k * (yy - py); };
|
|
204
|
+
x0 = xm(y); xe = Math.min(xm(y), xm(y - TXT)) - 10;
|
|
205
|
+
pr.miniEnd = Math.max(pr.miniEnd || 0, y - py);
|
|
206
|
+
pr.mini = {x0: xp, xm: xm};
|
|
207
|
+
}
|
|
208
|
+
var xl = xe - tw - 8;
|
|
209
|
+
lo = Math.min(lo, xl); hi = Math.max(hi, x0);
|
|
210
|
+
g.rows.push({o: o, v: v, y: y, x0: x0, xe: xe, xl: xl, tw: tw, nw: nw, sz: sz});
|
|
211
|
+
});
|
|
212
|
+
g.lo = lo; g.hi = hi;
|
|
213
|
+
g.ext = Lv + g.b.h + g.b.nh; // 背骨からの縦の広がり
|
|
214
|
+
return g;
|
|
215
|
+
}
|
|
216
|
+
function layout(s, rh, k, cgap){
|
|
217
|
+
var geo = cats.map(function(c, i){ return boneGeom(c, i, s, rh, k); });
|
|
218
|
+
var hb = box(pl.head.n, s), xs = [], x = 0;
|
|
219
|
+
for (var j = 0; j < cols; j++){
|
|
220
|
+
var a = geo[2 * j], b = geo[2 * j + 1], lo = Math.min(a.lo, b ? b.lo : 0), hi = Math.max(a.hi, b ? b.hi : 0);
|
|
221
|
+
x = j === 0 ? -lo : x + cgap - lo;
|
|
222
|
+
xs.push(x); x += hi;
|
|
223
|
+
}
|
|
224
|
+
var tail = Math.min(0, xs[0] + Math.min(geo[0].outer[0], geo[1] ? geo[1].outer[0] : 0) - 24);
|
|
225
|
+
var spineEnd = x + Math.max(36, cgap), width = spineEnd + hb.w - tail;
|
|
226
|
+
var ext = Math.max.apply(null, geo.map(function(g){ return g.ext; }));
|
|
227
|
+
var hh = Math.max(ext * 2, hb.h + 2 * hb.nh);
|
|
228
|
+
return {geo: geo, hb: hb, xs: xs, tail: tail, spineEnd: spineEnd, width: width, height: hh, ext: ext};
|
|
229
|
+
}
|
|
230
|
+
// 入る大きさを探す:字(27 → 24 px)、行の高さ(52 → 40 px)、傾き(0.5 → 0.3)
|
|
231
|
+
// size:24 より小さい字は使わない(24 にする)
|
|
232
|
+
var sz0 = P.size;
|
|
233
|
+
if (sz0 && sz0 < 24){ ctx.report("attr", "[fishbone] size=\"" + this.getAttribute("size") + "\" is below 24 (text is at least 24px; 24 is used)"); sz0 = 24; }
|
|
234
|
+
var sizes = sz0 ? [sz0] : [27, 26, 25, 24], L = null, fit = true;
|
|
235
|
+
search: for (var si = 0; si < sizes.length; si++){
|
|
236
|
+
for (var rh = 52; rh >= 40; rh -= 2){
|
|
237
|
+
for (var k = 0.5; k >= 0.29; k -= 0.1){
|
|
238
|
+
var t = layout(sizes[si], rh, k, 28);
|
|
239
|
+
if (t.width <= W && t.height <= H){ L = t; L.s = sizes[si]; L.rh = rh; L.k = k; break search; }
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (!L){
|
|
244
|
+
// 24 px でも入らない:字は小さくせず、大骨の間を 12 px まで詰め、はみ出しのいちばん少ない形にする(中央に置き、両側へ同じだけはみ出す)
|
|
245
|
+
fit = false;
|
|
246
|
+
var s24 = sizes[sizes.length - 1], miss = function(t){ return Math.max(0, t.width - W) + Math.max(0, t.height - H); };
|
|
247
|
+
for (var cg0 = 28; cg0 >= 12; cg0 -= 4){ var t0 = layout(s24, 40, 0.3, cg0); if (!L || miss(t0) < miss(L)) L = t0; }
|
|
248
|
+
L.s = s24; L.rh = 40; L.k = 0.3;
|
|
249
|
+
ctx.report("size", "[fishbone] the diagram does not fit at " + s24 + " px; it overflows its box by " + Math.ceil(Math.max(0, L.width - W)) + " px across and " +
|
|
250
|
+
Math.ceil(Math.max(0, L.height - H)) + " px up and down (text is not made smaller). Use fewer causes per bone, shorter causes or a larger element");
|
|
251
|
+
}
|
|
252
|
+
// 横に余れば、大骨の間を広げる(80 px まで)
|
|
253
|
+
if (fit) for (var cg = 80; cg > 28; cg -= 4){ var t2 = layout(L.s, L.rh, L.k, cg); if (t2.width <= W){ t2.s = L.s; t2.rh = L.rh; t2.k = L.k; L = t2; break; } }
|
|
254
|
+
var s = L.s, ox = (W - L.width) / 2 - L.tail, oy = H / 2;
|
|
255
|
+
this.size = s;
|
|
256
|
+
var X = function(x){ return ox + x; }, Y = function(y){ return oy + y; };
|
|
257
|
+
var mkLine = function(parent, w, col){ return D.el("path", {d: "", fill: "none", stroke: col || "var(--muted)", "stroke-width": w, "stroke-linecap": "round", "stroke-linejoin": "round", "data-part-line": ""}, parent); };
|
|
258
|
+
// data-part:Studio の形の検査(geometry check)が測る印。箱の形に box、線に edge(<g>、from と to)、字に label
|
|
259
|
+
// (data-part-of で持ち主が箱か辺か、箱の外の字は data-part-at="outside")。節でない端は @ で始まる(@head、@spine、@tail)
|
|
260
|
+
var eids = {}, edgeG = function(f, t, attrs, parent){
|
|
261
|
+
var id = String(f) + "\u2192" + String(t); eids[id] = (eids[id] || 0) + 1; if (eids[id] > 1) id += "#" + eids[id];
|
|
262
|
+
return D.el("g", Object.assign({"data-part": "edge", "data-part-id": id, "data-part-from": String(f), "data-part-to": String(t)}, attrs || {}), parent || gL);
|
|
263
|
+
};
|
|
264
|
+
var lab = function(id, of, out){ var a = {"data-part": "label", "data-part-id": String(id), "data-part-of": of}; if (out) a["data-part-at"] = "outside"; return a; };
|
|
265
|
+
var boxText = function(g, b, n, x, y, c, sz, id){
|
|
266
|
+
var cx = x + b.w / 2, cy = y + b.h / 2, lb = lab(id, "box");
|
|
267
|
+
if (n.tex){ var tf = MR.texFrame(g, cx, cy + sz * 0.36, n, "tex", {size: sz, anchor: "middle", color: c[2], w: b.w, h: b.h}, sk);
|
|
268
|
+
tf.firstChild.style.verticalAlign = "top"; for (var k in lb) tf.setAttribute(k, lb[k]);
|
|
269
|
+
// 式の枠は箱の幅にし、中で中央に寄せる(KaTeX の字が読み込まれた後の幅で中央になる。texFrame は読み込む前の幅で位置を決めるため)
|
|
270
|
+
tf.setAttribute("x", (cx - b.w / 2).toFixed(1)); tf.setAttribute("width", b.w.toFixed(1)); tf.style.textAlign = "center"; }
|
|
271
|
+
else {
|
|
272
|
+
var lh = sz * 1.25, y0 = cy - (b.lines.length - 1) * lh / 2 + sz * 0.36;
|
|
273
|
+
b.lines.forEach(function(t, j){ D.mtext(g, cx, y0 + j * lh, t, Object.assign({"text-anchor": "middle", "font-size": sz, fill: c[2]}, lb)); });
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
// 頭(結果)
|
|
277
|
+
var hb = L.hb, hx = X(L.spineEnd), hy = Y(0) - hb.h / 2, hc = toneOf(pl.head.n.tone, "emph");
|
|
278
|
+
var H0 = this.head = {o: pl.head, g: D.el("g", {opacity: 0}, gN), x: hx, y: hy, cx: hx + hb.w / 2, cy: Y(0), inP: [hx, Y(0)]};
|
|
279
|
+
D.el("rect", {class: "box", x: hx.toFixed(1), y: hy.toFixed(1), width: hb.w.toFixed(1), height: hb.h.toFixed(1), rx: 10, fill: hc[1], stroke: hc[0], "stroke-width": 3, "data-part": "box", "data-part-id": "@head"}, H0.g);
|
|
280
|
+
boxText(H0.g, hb, pl.head.n, hx, hy, hc, s, "@head");
|
|
281
|
+
hb.notes.forEach(function(t, j){ D.mtext(H0.g, hx + hb.w / 2, hy + hb.h + 4 + NLH * j + NS * 0.95, t, Object.assign({"text-anchor": "middle", "font-size": NS, fill: "var(--muted)"}, lab("@head", "box", true))); });
|
|
282
|
+
// 背骨(尾から頭の手前まで)と矢じり
|
|
283
|
+
var gS = edgeG("@tail", "@head");
|
|
284
|
+
this.spine = {path: this.poly([[X(L.tail), Y(0)], [hx - 3, Y(0)]]), line: mkLine(gS, 5), step: pl.spineStep};
|
|
285
|
+
H0.arrow = D.el("path", {d: "M0,0L-16,-7L-16,7Z", fill: "var(--muted)", transform: "translate(" + (hx - 1).toFixed(1) + " " + Y(0).toFixed(1) + ")", opacity: 0}, gS);
|
|
286
|
+
// 大骨と原因
|
|
287
|
+
var cnt = {};
|
|
288
|
+
this.bones = cats.map(function(c, i){
|
|
289
|
+
var g = L.geo[i], bx = L.xs[Math.floor(i / 2)], col = c.n.tone ? toneOf(c.n.tone)[0] : "var(--muted)", cc = toneOf(c.n.tone);
|
|
290
|
+
var at = c.n.at !== undefined ? c.n.at : c.step === pl.spineStep && c.step !== pl.head.step ? P.draw * 0.8 : c.step === pl.head.step ? self.span() : 0;
|
|
291
|
+
var B = {o: c, step: c.step, at: at, g: D.el("g", {opacity: 0}, gN)};
|
|
292
|
+
// 大骨:背骨の点から外の端まで(path は外から背骨へ。fade と grow は外から引く、draw は背骨から引く)
|
|
293
|
+
B.spineP = [X(bx), Y(0)]; B.outP = [X(bx + g.outer[0]), Y(g.outer[1])];
|
|
294
|
+
B.path = self.poly([B.outP, B.spineP]); B.rpath = self.poly([B.spineP, B.outP]);
|
|
295
|
+
B.line = mkLine(edgeG(c.n.id, "@spine"), 3.5, col);
|
|
296
|
+
var x0 = X(bx + g.boxX), y0 = Y(g.boxY);
|
|
297
|
+
D.el("rect", {class: "box", x: x0.toFixed(1), y: y0.toFixed(1), width: g.b.w.toFixed(1), height: g.b.h.toFixed(1), rx: 10, fill: cc[1], stroke: cc[0], "stroke-width": c.n.tone === "emph" ? 3 : 2.2, "data-part": "box", "data-part-id": String(c.n.id)}, B.g);
|
|
298
|
+
boxText(B.g, g.b, c.n, x0, y0, cc, s, c.n.id);
|
|
299
|
+
g.b.notes.forEach(function(t, j){
|
|
300
|
+
var ny = g.up ? y0 - 8 - NLH * (g.b.notes.length - 1 - j) : y0 + g.b.h + 4 + NLH * j + NS * 0.95;
|
|
301
|
+
D.mtext(B.g, x0 + g.b.w / 2, ny, t, Object.assign({"text-anchor": "middle", "font-size": NS, fill: "var(--muted)"}, lab(c.n.id, "box", true)));
|
|
302
|
+
});
|
|
303
|
+
B.cx = x0 + g.b.w / 2; B.cy = y0 + g.b.h / 2;
|
|
304
|
+
// 背骨の側から箱へ向かう向き(draw と grow で箱が寄ってくる向き)
|
|
305
|
+
var dx = B.cx - B.spineP[0], dy = B.cy - B.spineP[1], dl = Math.hypot(dx, dy) || 1;
|
|
306
|
+
B.dir = [dx / dl, dy / dl];
|
|
307
|
+
// 原因:横の線(大骨の点から左へ)と、その上の字
|
|
308
|
+
B.rows = g.rows.map(function(r, j){
|
|
309
|
+
var o = r.o, tc = o.n.tone ? toneOf(o.n.tone)[0] : "var(--fg)", lc = o.n.tone ? toneOf(o.n.tone)[0] : "var(--muted)";
|
|
310
|
+
var gr = D.el("g", {opacity: 0}, gT);
|
|
311
|
+
var y = Y(r.y), xa = X(bx + r.x0), xl = X(bx + r.xl);
|
|
312
|
+
// 原因の横線は、その原因から親(大骨か原因)への辺。字はその辺の label(自分の線の上にのせる)
|
|
313
|
+
var rid = String(o.n.id), rg = edgeG(rid, o.par.n.id), pr = lab(rid, "edge");
|
|
314
|
+
var rec = {o: o, step: o.step, g: gr, eg: rg, path: self.poly([[xa, y], [xl, y]]), line: mkLine(rg, 2.5, lc)};
|
|
315
|
+
if (r.miniEnd){
|
|
316
|
+
// 細かい原因へ下ろす、大骨と平行な線(親の原因の行が持つ)
|
|
317
|
+
var p0 = [X(bx + r.mini.x0), y], p1 = [X(bx + r.mini.xm(r.y + r.miniEnd)), y + r.miniEnd];
|
|
318
|
+
rec.mpath = self.poly([p0, p1]); rec.mline = mkLine(rg, 2.5, lc); // 下の、最初の細かい原因の辺へ移す
|
|
319
|
+
}
|
|
320
|
+
var tx, xe = X(bx + r.xe);
|
|
321
|
+
if (o.n.tex){
|
|
322
|
+
// 式(組み立てのときに描いた KaTeX):箱と同じ枠(MR.texFrame)で、行の右端に寄せる。note はその右に別の字で
|
|
323
|
+
var rf = MR.texFrame(gr, xe - r.nw, y - 8, o.n, "tex", {size: r.sz, anchor: "end", color: tc, w: r.tw - r.nw + 40, h: r.sz * 1.6}, sk);
|
|
324
|
+
rf.firstChild.style.verticalAlign = "top"; for (var k in pr) rf.setAttribute(k, pr[k]);
|
|
325
|
+
// 右端をそろえる:枠を見積もった幅にして、中で右に寄せる(読み込む前の幅で位置を決めない)
|
|
326
|
+
var rw = Math.max(1, r.tw - r.nw + 4); rf.setAttribute("x", (xe - r.nw - rw).toFixed(1)); rf.setAttribute("width", rw.toFixed(1)); rf.style.textAlign = "right";
|
|
327
|
+
if (o.n.note) D.mtext(gr, xe, y - 8, " " + o.n.note, Object.assign({"text-anchor": "end", "font-size": NS, fill: "var(--muted)"}, pr));
|
|
328
|
+
} else {
|
|
329
|
+
tx = D.mtext(gr, xe, y - 8, o.n.label || "", Object.assign({"text-anchor": "end", "font-size": r.sz, fill: tc}, pr));
|
|
330
|
+
if (o.n.tone === "emph") tx.setAttribute("font-weight", 700);
|
|
331
|
+
if (o.n.note){ var ns = D.el("tspan", {"font-size": NS, fill: "var(--muted)", "font-weight": 400}, tx); ns.textContent = " " + o.n.note; }
|
|
332
|
+
}
|
|
333
|
+
// 段階の中の開始時刻:同じ段階の行を上から順に少しずつずらす
|
|
334
|
+
var key = rec.step, base = rec.step === c.step ? at + self.span() * 0.8 : 0;
|
|
335
|
+
cnt[key + "|" + i] = (cnt[key + "|" + i] || 0) + 1;
|
|
336
|
+
rec.at = o.n.at !== undefined ? o.n.at : +(base + 0.12 * (cnt[key + "|" + i] - 1)).toFixed(3);
|
|
337
|
+
return rec;
|
|
338
|
+
});
|
|
339
|
+
return B;
|
|
340
|
+
});
|
|
341
|
+
// 細かい原因の平行の線は、細かい原因の行と同じ段階・時刻で引く(最初の子に合わせる)
|
|
342
|
+
this.bones.forEach(function(B){
|
|
343
|
+
B.rows.forEach(function(r){
|
|
344
|
+
if (!r.mpath) return;
|
|
345
|
+
var first = B.rows.filter(function(q){ return q.o.par === r.o; })[0];
|
|
346
|
+
r.mstep = first.step; r.mat = first.at;
|
|
347
|
+
first.eg.appendChild(r.mline); // data-part:細かい原因へ下ろす線は、その最初の細かい原因の辺に入れる
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
// そのほかのつながり:字の左端どうしを、左へふくらむ破線で
|
|
351
|
+
var rowOf = {};
|
|
352
|
+
this.bones.forEach(function(B){ B.rows.forEach(function(r){ rowOf[r.o.n.id] = r; }); });
|
|
353
|
+
this.edges = pl.edges.map(function(x){
|
|
354
|
+
var e = x.e, ra = rowOf[e.from], rb = rowOf[e.to];
|
|
355
|
+
if (!ra || !rb) throw new Error("m-fishbone: edges connect causes (not main bones)");
|
|
356
|
+
var pa = [ra.path.pts[1][0] - 6, ra.path.pts[1][1]], pb = [rb.path.pts[1][0] - 10, rb.path.pts[1][1]];
|
|
357
|
+
var mid = [(pa[0] + pb[0]) / 2, (pa[1] + pb[1]) / 2], far = Math.min(pa[0], pb[0]) - 40, ctl = [2 * far - mid[0], mid[1]];
|
|
358
|
+
var pts = [];
|
|
359
|
+
for (var j = 0; j <= 24; j++){ var u = j / 24, v = 1 - u; pts.push([v * v * pa[0] + 2 * u * v * ctl[0] + u * u * pb[0], v * v * pa[1] + 2 * u * v * ctl[1] + u * u * pb[1]]); }
|
|
360
|
+
var col = e.tone ? toneOf(e.tone)[0] : "var(--muted)";
|
|
361
|
+
var g = edgeG(e.from, e.to, {opacity: 0}, gE);
|
|
362
|
+
var line = D.el("path", {d: "", fill: "none", stroke: col, "stroke-width": 3, "stroke-dasharray": e.dash === false ? "none" : "8 6", "data-part-line": ""}, g);
|
|
363
|
+
var head = D.el("path", {d: "M0,0L-16,-7L-16,7Z", fill: col}, g);
|
|
364
|
+
var elab = e.label ? D.mtext(g, far - 8, mid[1] + 8, e.label, Object.assign({"text-anchor": "end", "font-size": 24, fill: col, opacity: 0}, lab(g.getAttribute("data-part-id"), "edge"))) : null;
|
|
365
|
+
var after = 0;
|
|
366
|
+
[ra, rb].forEach(function(r){ if (r.step === x.step) after = Math.max(after, r.at + 0.45); });
|
|
367
|
+
return {g: g, line: line, head: head, lab: elab, path: self.poly(pts), step: x.step, at: e.at !== undefined ? e.at : after};
|
|
368
|
+
});
|
|
369
|
+
// 読み上げ:最後の形(結果と、大骨ごとの原因)を 1 文で。作者の aria-label があればそれを使う(上書きしない)
|
|
370
|
+
if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
|
|
371
|
+
this.setAttribute("role", "img");
|
|
372
|
+
if (!this._aria) this.setAttribute("aria-label", this.summary(/^ja\b/i.test(ctx.lang || "ja")));
|
|
373
|
+
sk.flush(); // what the formulas have to report, once per kind (spec §6.2)
|
|
374
|
+
}
|
|
375
|
+
// 最後の形を 1 文で(読み上げの名前):「原因と結果の図。結果:配送の遅れ。人:人手が足りない(休みが多い)、新人が多い。機械:車の故障。つながり:…」
|
|
376
|
+
summary(ja){
|
|
377
|
+
var pl = this.plan(), one = function(n){ return String(n.label || n.tex || "").replace(/\s*\n\s*/g, " ").replace(/\*/g, "").replace(/[_^](.)/g, "$1") + (n.note ? " " + n.note : ""); };
|
|
378
|
+
var lp = ja ? "(" : " (", rp = ja ? ")" : ")", cm = ja ? "、" : ", ", dot = ja ? "。" : ". ";
|
|
379
|
+
var s = (ja ? "原因と結果の図" : "Cause-and-effect diagram") + (pl.head.n.label || pl.head.n.tex ? dot + (ja ? "結果:" : "Effect: ") + one(pl.head.n) : "");
|
|
380
|
+
pl.cats.forEach(function(c){
|
|
381
|
+
var ks = c.kids.map(function(k){ return one(k.n) + (k.kids.length ? lp + k.kids.map(function(x){ return one(x.n); }).join(cm) + rp : ""); });
|
|
382
|
+
s += dot + one(c.n) + (ks.length ? (ja ? ":" : ": ") + ks.join(cm) : "");
|
|
383
|
+
});
|
|
384
|
+
var ed = pl.edges.map(function(x){ return one(x.a.n) + " → " + one(x.b.n) + (x.e.label ? lp + x.e.label + rp : ""); });
|
|
385
|
+
if (ed.length) s += dot + (ja ? "つながり:" : "Links: ") + ed.join(cm);
|
|
386
|
+
return s;
|
|
387
|
+
}
|
|
388
|
+
poly(pts){
|
|
389
|
+
var L = [0];
|
|
390
|
+
for (var i = 1; i < pts.length; i++) L.push(L[i - 1] + Math.hypot(pts[i][0] - pts[i - 1][0], pts[i][1] - pts[i - 1][1]));
|
|
391
|
+
return {pts: pts, L: L, len: L[L.length - 1] || 1};
|
|
392
|
+
}
|
|
393
|
+
part(pl, f){
|
|
394
|
+
var want = pl.len * Math.max(0, Math.min(1, f)), pts = pl.pts, out = [pts[0]], i = 1;
|
|
395
|
+
for (; i < pts.length && pl.L[i] <= want; i++) out.push(pts[i]);
|
|
396
|
+
var end = out[out.length - 1];
|
|
397
|
+
if (i < pts.length && want > pl.L[i - 1]){
|
|
398
|
+
var u = (want - pl.L[i - 1]) / (pl.L[i] - pl.L[i - 1]);
|
|
399
|
+
end = [base.lerp(pts[i - 1][0], pts[i][0], u), base.lerp(pts[i - 1][1], pts[i][1], u)];
|
|
400
|
+
out.push(end);
|
|
401
|
+
}
|
|
402
|
+
var pv = out.length > 1 ? out[out.length - 2] : pts[0], nx = i < pts.length ? pts[i] : end;
|
|
403
|
+
var ang = out.length < 2 ? Math.atan2(nx[1] - end[1], nx[0] - end[0]) : Math.atan2(end[1] - pv[1], end[0] - pv[0]);
|
|
404
|
+
return {d: "M" + out.map(function(p){ return p[0].toFixed(1) + "," + p[1].toFixed(1); }).join("L"), end: end, ang: ang};
|
|
405
|
+
}
|
|
406
|
+
duration(k){
|
|
407
|
+
var self = this, P = this.props, d = 0, S = this.span(), pl = this.plan();
|
|
408
|
+
if (pl.spineStep === k) d = Math.max(d, P.draw);
|
|
409
|
+
if (pl.head.step === k) d = Math.max(d, (pl.head.n.at || 0) + S);
|
|
410
|
+
(this.bones || []).forEach(function(B){
|
|
411
|
+
if (B.step === k) d = Math.max(d, B.at + S);
|
|
412
|
+
B.rows.forEach(function(r){ if (r.step === k) d = Math.max(d, r.at + 0.45); });
|
|
413
|
+
});
|
|
414
|
+
(this.edges || []).forEach(function(o){ if (o.step === k) d = Math.max(d, o.at + P.draw + (o.lab ? 0.3 : 0)); });
|
|
415
|
+
return d;
|
|
416
|
+
}
|
|
417
|
+
render(k, t, ctx){
|
|
418
|
+
var P = this.props, D = base, self = this, vr = this.variant, lect = !!ctx.preview, S = this.span(), FAINT = 0.45;
|
|
419
|
+
if (lect) FAINT = base.previewOpacity(this); // 先の段階の薄さ:テーマの --preview-opacity(ないときは 0.45)
|
|
420
|
+
var tOf = function(step){ return step < k ? Infinity : step > k ? -1 : t; };
|
|
421
|
+
var pr = function(tt, at, dur){ return tt < 0 ? 0 : D.prog(tt, at, dur); };
|
|
422
|
+
// 授業の表示:後の段階は薄く(--preview-opacity)、今の段階は薄い状態から濃くなる。位置は動かさない(どの見せ方でも同じ)
|
|
423
|
+
var faint = function(tt, e){ return tt < 0 ? FAINT : FAINT + (1 - FAINT) * e; };
|
|
424
|
+
var line = function(el, path, e){ el.setAttribute("d", e > 0 ? self.part(path, e).d : ""); };
|
|
425
|
+
// 背骨:尾から頭へ引く(どの見せ方でも同じ)
|
|
426
|
+
var sp = this.spine, ts = tOf(sp.step), es = pr(ts, 0, P.draw);
|
|
427
|
+
if (lect){ line(sp.line, sp.path, 1); sp.line.setAttribute("opacity", faint(ts, es).toFixed(3)); }
|
|
428
|
+
else { line(sp.line, sp.path, es); sp.line.setAttribute("opacity", es > 0 ? 1 : 0); }
|
|
429
|
+
// 箱と字の動きは 12 px まで(docs/conventions.md §1.2:どの見せ方も fade より遠くへ動かさない)
|
|
430
|
+
// fade:下から 12 px 上がりながら現れる(0.92 → 1)。draw:線の後、背骨の側から 12 px 寄りながら現れる。
|
|
431
|
+
// grow:背骨の側から 12 px 寄りながら 0.92 → 1 に大きくなる
|
|
432
|
+
var OFF = 12;
|
|
433
|
+
var tf = function(cx, cy, s, dx, dy){
|
|
434
|
+
return s >= 1 && Math.abs(dx) < 0.01 && Math.abs(dy) < 0.01 ? "" :
|
|
435
|
+
"translate(" + (cx + dx).toFixed(2) + " " + (cy + dy).toFixed(2) + ") scale(" + s.toFixed(4) + ") translate(" + (-cx).toFixed(2) + " " + (-cy).toFixed(2) + ")";
|
|
436
|
+
};
|
|
437
|
+
// 頭(背骨は左から来る)
|
|
438
|
+
var h = this.head, th = tOf(h.o.step), at = h.o.n.at || 0, eb, ea, sc = 1, m, sh;
|
|
439
|
+
if (vr === "draw"){ ea = pr(th, at, S * 0.5); eb = pr(th, at + S * 0.45, S * 0.55); sc = D.lerp(0.92, 1, eb); sh = [-OFF * (1 - eb), 0]; }
|
|
440
|
+
else if (vr === "grow"){ m = pr(th, at, P.fade); eb = pr(th, at, P.fade * 0.6); ea = pr(th, at, S * 0.5); sc = D.lerp(0.92, 1, m); sh = [-OFF * (1 - m), 0]; }
|
|
441
|
+
else { eb = pr(th, at, P.fade); ea = pr(th, at + P.fade * 0.6, P.draw * 0.5); sc = D.lerp(0.92, 1, eb); sh = [0, OFF * (1 - eb)]; }
|
|
442
|
+
if (lect){ var fh = faint(th, eb); h.g.setAttribute("opacity", fh.toFixed(3)); h.g.setAttribute("transform", ""); h.arrow.setAttribute("opacity", fh.toFixed(3)); }
|
|
443
|
+
else {
|
|
444
|
+
h.g.setAttribute("opacity", eb.toFixed(3));
|
|
445
|
+
h.g.setAttribute("transform", tf(h.cx, h.cy, sc, sh[0], sh[1]));
|
|
446
|
+
h.arrow.setAttribute("opacity", ea.toFixed(3));
|
|
447
|
+
}
|
|
448
|
+
// 大骨
|
|
449
|
+
this.bones.forEach(function(B){
|
|
450
|
+
var tt = tOf(B.step), eb, el, sc = 1, m, sh, path = B.path;
|
|
451
|
+
if (vr === "draw"){
|
|
452
|
+
el = pr(tt, B.at, S * 0.5); eb = pr(tt, B.at + S * 0.45, S * 0.55); sc = D.lerp(0.92, 1, eb); path = B.rpath;
|
|
453
|
+
sh = [-B.dir[0] * OFF * (1 - eb), -B.dir[1] * OFF * (1 - eb)];
|
|
454
|
+
} else if (vr === "grow"){
|
|
455
|
+
m = pr(tt, B.at, P.fade); eb = pr(tt, B.at, P.fade * 0.6); el = pr(tt, B.at, S); sc = D.lerp(0.92, 1, m); path = B.rpath;
|
|
456
|
+
sh = [-B.dir[0] * OFF * (1 - m), -B.dir[1] * OFF * (1 - m)];
|
|
457
|
+
} else { eb = pr(tt, B.at, P.fade); el = pr(tt, B.at + P.fade * 0.6, P.draw); sc = D.lerp(0.92, 1, eb); sh = [0, OFF * (1 - eb)]; }
|
|
458
|
+
if (lect){ var f = faint(tt, eb); B.g.setAttribute("opacity", f.toFixed(3)); B.g.setAttribute("transform", ""); line(B.line, B.path, 1); B.line.setAttribute("opacity", f.toFixed(3)); }
|
|
459
|
+
else {
|
|
460
|
+
B.g.setAttribute("opacity", eb.toFixed(3));
|
|
461
|
+
B.g.setAttribute("transform", tf(B.cx, B.cy, sc, sh[0], sh[1]));
|
|
462
|
+
line(B.line, path, el); B.line.setAttribute("opacity", el > 0 ? 1 : 0);
|
|
463
|
+
}
|
|
464
|
+
// 原因の行(どれも 0.45 秒):fade は字が下から 12 px 上がりながら現れてから線、draw は線から字、
|
|
465
|
+
// grow は字が大骨の側(右)から 12 px 寄りながら現れ、線は同時に大骨から引く
|
|
466
|
+
B.rows.forEach(function(r){
|
|
467
|
+
var tr = tOf(r.step), et, el2, dx = 0, dy = 0;
|
|
468
|
+
if (vr === "draw"){ el2 = pr(tr, r.at, 0.25); et = pr(tr, r.at + 0.15, 0.3); }
|
|
469
|
+
else if (vr === "grow"){ el2 = pr(tr, r.at, 0.45); et = pr(tr, r.at, 0.3); dx = OFF * (1 - et); }
|
|
470
|
+
else { et = pr(tr, r.at, 0.3); el2 = pr(tr, r.at + 0.15, 0.3); dy = OFF * (1 - et); }
|
|
471
|
+
if (lect){
|
|
472
|
+
var f = faint(tr, et);
|
|
473
|
+
r.g.setAttribute("opacity", f.toFixed(3)); r.g.setAttribute("transform", "");
|
|
474
|
+
line(r.line, r.path, 1); r.line.setAttribute("opacity", f.toFixed(3));
|
|
475
|
+
} else {
|
|
476
|
+
r.g.setAttribute("opacity", et.toFixed(3));
|
|
477
|
+
r.g.setAttribute("transform", Math.abs(dx) > 0.01 || Math.abs(dy) > 0.01 ? "translate(" + dx.toFixed(2) + " " + dy.toFixed(2) + ")" : "");
|
|
478
|
+
line(r.line, r.path, el2); r.line.setAttribute("opacity", el2 > 0 ? 1 : 0);
|
|
479
|
+
}
|
|
480
|
+
if (r.mline){
|
|
481
|
+
var tm = tOf(r.mstep), em = pr(tm, r.mat, vr === "fade" ? 0.3 : 0.25);
|
|
482
|
+
if (vr === "fade") em = pr(tm, r.mat + 0.15, 0.3);
|
|
483
|
+
if (lect){ line(r.mline, r.mpath, 1); r.mline.setAttribute("opacity", faint(tm, em).toFixed(3)); }
|
|
484
|
+
else { line(r.mline, r.mpath, em); r.mline.setAttribute("opacity", em > 0 ? 1 : 0); }
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
});
|
|
488
|
+
this.edges.forEach(function(o){
|
|
489
|
+
var tt = tOf(o.step), e = pr(tt, o.at, P.draw), lo = pr(tt, o.at + P.draw * 0.8, 0.3);
|
|
490
|
+
if (lect){ var f = faint(tt, e); e = 1; lo = 1; o.g.setAttribute("opacity", f.toFixed(3)); }
|
|
491
|
+
else o.g.setAttribute("opacity", e > 0 ? 1 : 0);
|
|
492
|
+
var p = self.part(o.path, e);
|
|
493
|
+
o.line.setAttribute("d", e > 0 ? p.d : "");
|
|
494
|
+
var hs = Math.min(1, e * o.path.len / 20);
|
|
495
|
+
o.head.setAttribute("transform", "translate(" + p.end[0].toFixed(2) + " " + p.end[1].toFixed(2) + ") rotate(" + (p.ang * 180 / Math.PI).toFixed(2) + ") scale(" + hs.toFixed(4) + ")");
|
|
496
|
+
if (o.lab) o.lab.setAttribute("opacity", lo.toFixed(3));
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
return Part;
|
|
501
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Code notes
|
|
3
|
+
steps: Code → notes → output (n+1/+2)
|
|
4
|
+
props:
|
|
5
|
+
dur: Seconds
|
|
6
|
+
size: Text px
|
|
7
|
+
outputPos: Output
|
|
8
|
+
example: {"lang":"python","code":"import pandas as pd\ndf = pd.read_csv(\"sales.csv\")\ndf.groupby(\"store\")[\"sales\"].mean()","steps":[{"lines":[1],"note":"Load pandas"},{"lines":[2],"note":"Read CSV"},{"lines":[3],"note":"Mean"}],"output":"store\nA 120.5\nB 98.0"}
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
`<m-code>` child JSON.
|
|
12
|
+
|
|
13
|
+
- `code`: 440px shows 9 lines of 76 chars; longer lines wrap, more scroll in a window (≤16; else split).
|
|
14
|
+
- `lang`; `steps[{lines,note}]`: `[3]`, range `[3,4]`, or 3+ lines `[2,5,9]`; notes ≤30 chars.
|
|
15
|
+
- `output`: ≤8 lines.
|
|
16
|
+
|
|
17
|
+
Script: explain each line; never read code aloud.
|
|
18
|
+
|
|
19
|
+
<!-- llm: omit -->
|
|
20
|
+
Displays supplied text; never runs code. Code first, then highlights and notes. Beside: natural code width ≤55% and every note fits; earlier notes stay muted, all shown at completion. Otherwise band: only the current note, prefixed “lines 3–4”. Final/print: numbered compact list, no code highlight. If the list needs more height, report and keep the last numbered note. Deterministic seeking. Fit layout (2.2.0), only when the 2.1.0 layout would not fit (same pixels otherwise): band notes up to 2 rows; long lines wrap after a space, comma or opening bracket under a "↪" gutter; a window per step centred on its lines, "⋮ n" for hidden rows (it changes in the step's first half, then shows in the second); a final list that does not fit keeps the last note with `data-fit="last-note"` (no report); a window under 3 rows reports size. Full source and output in `pre[data-readable]`. Preview uses --preview-opacity; the final list previews before notes begin.
|
|
21
|
+
|
|
22
|
+
dur .6s; size 0=24px code/26px notes, otherwise ≥24. outputPos auto/below/right. Beside auto: right for ≤8 lines when columns fit. Band auto: right when natural code width ≤70% and output fits, else below the band. Explicit right/below retained. Bad props report/default.
|
|
23
|
+
|
|
24
|
+
Colours are theme roles: for Python, R, shell and JavaScript (js), keywords term, strings accent2 (Python triple quotes and JS templates span lines), # (JS //) comments outside strings muted, the rest fg; other languages stay fg. Code reads the same without colour. `[[3,4]]` reads as `[3,4]`; two ranges in one step report range. Tabs: four spaces. Monospace width .6em, wide characters 1em. Full-width band mode at 1184px/24px fits 77 ASCII characters with single-digit line numbers, 76 with two digits. Beside notes/right output reduce this. Beside notes wrap/stack with connectors; each band note is one truncated row.
|
|
25
|
+
|
|
26
|
+
Default height, one band row, right/no output: header 50 + n × row 34 + padding 16 + gap 8 + band 58 = **132 + 34n px**. General: r=ceil(1.4×size), header=r+16, b=ceil(1.45×note px+4)+16; H=header+n×r+16+8+b. No notes: omit 8+b. Below output adds 16+header+output rows×r+16. Final list (24px, 35px rows) packs “3–4: note” items; each row beyond one adds 35px. Auto output that would go below sits beside the band when its natural width ≤45%; the zone is then max(band, output). Every “give the element about H px” uses this formula; above 440px (body under a heading) reports give lines that fit at 440px and say fewer lines/shorter notes/split instead. If only the list misses, all code stays and the final state keeps the last note.
|
|
27
|
+
|
|
28
|
+
| Height | Code lines (one band row) |
|
|
29
|
+
|---|---|
|
|
30
|
+
| 380px | 7 (needs 370px) |
|
|
31
|
+
| 440px | 9 (438px) |
|
|
32
|
+
| 540px | 12 (540px) |
|
|
33
|
+
| 680px | 16 (676px) |
|
|
34
|
+
|
|
35
|
+
A 59-character line exceeds 70% width: auto output goes below. Seven lines + band + one output row need 486px; two output rows need 520px. Without output, 380px fits. Separate layout reports give line count/capacity/needed height, longest line/character capacity, or note index/width/capacity/target length. Oversize text truncates with …; tiny elements retain clipped content and numeric size reports. Code ≤16 lines, output ≤8. Invalid ranges report; no highlight/connector, notes/steps preserved.
|
|
36
|
+
|
|
37
|
+
ctx.lang ja/en. Figure role; author label preserved; SVG hidden. Full source/output in non-focusable sr-only pre. All notes remain in the accessible summary. Fictional sales data.
|
|
38
|
+
<!-- llm: end -->
|