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
|
@@ -2,18 +2,34 @@
|
|
|
2
2
|
// 編集アプリのプレビュー(app/frame-shim.js)が同じこの関数を使う(体裁の検査 kit/core/layout-scan.mjs と同じ入れ方)
|
|
3
3
|
//
|
|
4
4
|
// 部品は描いた要素に印(札)を付けるだけで、測るのはここ 1 か所:
|
|
5
|
-
// 箱 形の要素そのもの(<rect>・<path>・<ellipse>・<polygon>)に data-part="box"・data-part-id
|
|
6
|
-
// 辺 <g data-part="edge" data-part-id data-part-from data-part-to>。線そのもの(<line> か <path>)に data-part-line(矢じりは除く)。1 つの辺に線が 2
|
|
5
|
+
// 箱 形の要素そのもの(<rect>・<path>・<ellipse>・<polygon>・<circle>)に data-part="box"・data-part-id。形の中かは isPointInFill で測る
|
|
6
|
+
// 辺 <g data-part="edge" data-part-id data-part-from data-part-to>。線そのもの(<line> か <path>)に data-part-line(矢じりは除く)。1 つの辺に線が 2 本のこともある。
|
|
7
|
+
// 端(from・to)は箱の id か点(mark)の id(点から字への引き出し線。handoff #45 の決定 2)。端が点なら、その点の字と、その点を中に持つ箱は、この辺の通過・横切りの相手にしない
|
|
7
8
|
// 字 <text data-part="label" data-part-id=<持ち主> data-part-of="box|edge|mark">。縁取りがあれば data-part-halo、箱の外に置く字は data-part-at="outside"。
|
|
8
9
|
// foreignObject の字は中身を Range で測る
|
|
9
10
|
// 点 data-part="mark"(m-quad の点。<g transform> の中の <circle cx=0 cy=0> でも getBoundingClientRect で測る)。字の障害物
|
|
10
11
|
// @ で始まる端(@spine・@moved など)は節でない
|
|
12
|
+
// わざと重ねる所:要素そのものか祖先の <g> に o.overlap の印(data-overlap="ok"、kit/core/layout-scan.mjs の OVERLAP_ATTR。handoff #45 の決定 3)。
|
|
13
|
+
// その要素が関わる重なりの知らせ(geoEdgeThroughBox・geoLineOverLabel・geoLabelOverlap)を出さない。値は "ok" だけ。箱の縁を越える字(geoLabelOutsideBox)は重なりでないので外さない
|
|
14
|
+
// 枠の中(handoff #46。属性の名前は WITHIN_ATTRS の 1 か所):図形に data-within="名前"、枠に data-frame="名前"。名前は 1 つ(WITHIN_NAME)。宣言した図形だけを、ステップごとに測る(geometrySteps)。
|
|
15
|
+
// 名前の形に合わない値は測らず、要素ごとに geoBadMarkName(警告。a: {el, kind: 'shape'|'frame', attr, value})で知らせる
|
|
16
|
+
// 図の端で欠ける線(handoff #52):印は要らない。インラインの SVG(作成者の図もパーツの図も)の線のある形の要素を、ステップごとに測る(geometrySteps)
|
|
11
17
|
//
|
|
12
|
-
// geometryScan(s, o) → [{code, sev, a}] s:最終段階まで出したスライドの <section>。o = {bands, dflt}
|
|
18
|
+
// geometryScan(s, o) → [{code, sev, a}] s:最終段階まで出したスライドの <section>。o = {bands, dflt, overlap, within, frame, name, clip}
|
|
13
19
|
// bands 字体ごとの字の範囲(kit/core/text-band.mjs の TEXT_BANDS。{字体の名前: {up, down}}、em)
|
|
14
20
|
// dflt 表にない字体だけの字の範囲(DEFAULT_BAND)
|
|
21
|
+
// overlap わざと重ねる印の属性の名前(OVERLAP_ATTR)。なければ外さない
|
|
22
|
+
// within・frame 枠の中の印の属性の名前(WITHIN_ATTRS)
|
|
23
|
+
// name 枠の中の印の値の形(WITHIN_NAME。RegExp の source)。なければ枠の中は見ない
|
|
24
|
+
// clip わざと切る印の属性の名前(kit/core/layout-scan.mjs の CLIP_ATTR)。その中の形は図の端で欠けても知らせない
|
|
25
|
+
// o.mode === 'step' のときだけ、今の表示で測る 1 段階分を返す:枠の外に出た図形(geoOutsideFrame)と図の端で欠ける線(geoClippedStroke)
|
|
15
26
|
// 縦書きのスライド(layout-tate)は測らない([] を返す。数は geometryTate)
|
|
16
|
-
//
|
|
27
|
+
// geometrySteps(s, o, seek, scan) → null | [{code: 'geoOutsideFrame', sev, a: {shape, frame, step, px, at, steps}} | {code: 'geoClippedStroke', sev, a: {shape, side, px, stroke, step, steps}}]
|
|
28
|
+
// スライドの全部のステップ(0 … s._max。static は 0 だけ)を seek(k) で出し、scan(= geometryScan)を o.mode = 'step' で呼ぶ(2 つの検査で 1 回だけ歩く)。
|
|
29
|
+
// 測るものがない(枠の中の印も、線のある形の入った SVG もない)スライドは歩かずに null。
|
|
30
|
+
// 図形(と枠)ごとに 1 つ:いちばん大きく出た・欠けたステップ(step。結論のステップは 'concl')とその値(px ほか)と、出た・欠けたステップの一覧(steps)。
|
|
31
|
+
// 最後のステップだけでは途中のはみ出しを逃す(backlog #91 の分裂期の染色体)。終わった後の表示は呼ぶ側が戻す
|
|
32
|
+
// geometryTate(slides, o) → n 縦横が混ざる教材で、測らなかった縦書きのスライドのうち印のあるものの数(geoTateSlides)。
|
|
17
33
|
// 中身のスライド(表紙・章の扉を除く)がみな縦書きなら 0(そのときは決まりの台帳が R-geometry を skipped/tate にする。kit/core/check-rules.mjs の factsFromSource の allTate と同じ数え方)
|
|
18
34
|
//
|
|
19
35
|
// 座標はスライドの座標(1280×720。拡大率で割る)。
|
|
@@ -25,19 +41,39 @@
|
|
|
25
41
|
// この関数は文字列にしてページに入れる(check.mjs は page.evaluate、編集アプリは仲立ちの文字列に埋める)。
|
|
26
42
|
// だから外の名前を使わない(中だけで閉じる)。閉じるタグと HTML の注釈の始まりを書かない(tools/build-app.mjs が確かめる)
|
|
27
43
|
|
|
44
|
+
// 枠の中の印の名前(仕様 §8.4 Marks for geometry checks)。呼ぶ側が o.within・o.frame として渡す(kit/core/layout-scan.mjs の GEO_OPTS)
|
|
45
|
+
export const WITHIN_ATTRS = Object.freeze({ within: 'data-within', frame: 'data-frame' });
|
|
46
|
+
// その値の形:名前 1 つ(小文字の英字で始まり、小文字の英字・数字・-)。関数は外の名前を使えないので、呼ぶ側が o.name(RegExp の source)として渡す(GEO_OPTS)。
|
|
47
|
+
// これに合わない値は測らず、geoBadMarkName(警告)で知らせる(綴りの誤りで点検が黙って外れないように。handoff #46、11/18 の決定)
|
|
48
|
+
export const WITHIN_NAME = '^[a-z][a-z0-9-]*$';
|
|
49
|
+
|
|
28
50
|
export function geometryScan(s, o) {
|
|
29
51
|
const out = [];
|
|
30
52
|
if (!s || s.classList.contains('layout-tate')) return out;
|
|
31
53
|
const BANDS = (o && o.bands) || {}, DFLT = (o && o.dflt) || { up: 0.86, down: 0.26 };
|
|
32
54
|
const SEL = (v) => '[data-part="' + v + '"]';
|
|
33
|
-
|
|
55
|
+
const STEP = !!(o && o.mode === 'step'), WA = (o && o.within) || '', FA = (o && o.frame) || '', OV = (o && o.overlap) || '', CL = (o && o.clip) || '';
|
|
56
|
+
const NAME = o && o.name ? new RegExp(o.name) : null;
|
|
57
|
+
const add = (sev, code, a) => out.push({ code, sev, a });
|
|
58
|
+
// 枠の中の印の値が名前 1 つ(o.name)でない(geoBadMarkName。handoff #46):その印は測らないので、黙って点検が外れないよう知らせる。
|
|
59
|
+
// 要素ごとに 1 つ(data-within と data-frame の両方が名前でなければ data-within のほう)。値の形だけを見るので、見えているかに依らない。
|
|
60
|
+
// 名前の合わない印だけのスライドも見る(下の data-part の有無で返す前に)。o.mode === 'step' のときは出さない(ステップごとに重なるので)
|
|
61
|
+
if (!STEP && NAME && WA && FA) {
|
|
62
|
+
const seen = { [WA]: 0, [FA]: 0 };
|
|
63
|
+
for (const el of s.querySelectorAll('[' + WA + '],[' + FA + ']')) {
|
|
64
|
+
const n = el.hasAttribute(WA) ? ++seen[WA] : 0, m = el.hasAttribute(FA) ? ++seen[FA] : 0;
|
|
65
|
+
const bad = [[WA, 'shape', n], [FA, 'frame', m]].find(([at]) => el.hasAttribute(at) && !NAME.test(el.getAttribute(at)));
|
|
66
|
+
if (bad) add('warn', 'geoBadMarkName', { el: el.getAttribute('data-part-id') || el.id || el.localName + '#' + bad[2], kind: bad[1], attr: bad[0], value: el.getAttribute(bad[0]) });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const WITHIN = STEP && !!WA && !!FA && !!NAME && !!s.querySelector('[' + WA + ']'), EDGE = STEP && !!s.querySelector('svg');
|
|
70
|
+
if (STEP ? !WITHIN && !EDGE : !s.querySelector([SEL('box'), SEL('edge'), SEL('label'), SEL('mark')].join(','))) return out;
|
|
34
71
|
const sr = s.getBoundingClientRect();
|
|
35
72
|
const k = sr.width / 1280 || 1;
|
|
36
73
|
const SX = (x) => (x - sr.left) / k, SY = (y) => (y - sr.top) / k;
|
|
37
74
|
const box = (r) => ({ l: SX(r.left), t: SY(r.top), r: SX(r.right), b: SY(r.bottom) });
|
|
38
75
|
const rnd = (v) => Math.round(v);
|
|
39
76
|
const rr = (q) => [rnd(q.l), rnd(q.t), rnd(q.r), rnd(q.b)];
|
|
40
|
-
const add = (sev, code, a) => out.push({ code, sev, a });
|
|
41
77
|
const TOL = 2;
|
|
42
78
|
|
|
43
79
|
// 字体の並び → 字の範囲(kit/core/text-band.mjs の textBand と同じ決め方:並びの中で表にある字体の最も広いもの、なければ dflt)
|
|
@@ -72,37 +108,75 @@ export function geometryScan(s, o) {
|
|
|
72
108
|
};
|
|
73
109
|
const strokeOf = (el, M) => { const w = parseFloat(getComputedStyle(el).strokeWidth); return (isFinite(w) ? w : 1) * (M ? M.sc : 1); };
|
|
74
110
|
const textOf = (el) => (el.textContent || '').replace(/\s+/g, ' ').trim().slice(0, 40);
|
|
111
|
+
// わざと重ねる印(data-overlap="ok"):要素そのものか、スライドの中の祖先の <g>
|
|
112
|
+
const okOverlap = (el) => {
|
|
113
|
+
if (!OV) return false;
|
|
114
|
+
for (let e = el; e && e !== s; e = e.parentElement) if ((e === el || e.localName === 'g') && e.getAttribute(OV) === 'ok') return true;
|
|
115
|
+
return false;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// 形の要素の輪郭(getTotalLength・getPointAtLength でスライドの座標 step px ごと、8〜2000 点)。測れなければ []
|
|
119
|
+
const outline = (el, step) => {
|
|
120
|
+
const M = mapper(el);
|
|
121
|
+
if (!M) return [];
|
|
122
|
+
let len = 0;
|
|
123
|
+
try { len = el.getTotalLength(); } catch (e) { len = 0; }
|
|
124
|
+
if (!(len > 0)) return [];
|
|
125
|
+
const n = Math.min(2000, Math.max(8, Math.ceil(len * M.sc / step)));
|
|
126
|
+
const pts = [];
|
|
127
|
+
for (let i = 0; i <= n; i++) { const p = el.getPointAtLength(len * i / n); pts.push(M.pt(p.x, p.y)); }
|
|
128
|
+
return pts;
|
|
129
|
+
};
|
|
130
|
+
// 点から折れ線(閉じた輪郭)のいちばん近い点 {x, y, d}
|
|
131
|
+
const nearRing = (ring, x, y) => {
|
|
132
|
+
let best = { x, y, d: Infinity };
|
|
133
|
+
for (let i = 0; i < ring.length; i++) {
|
|
134
|
+
const a = ring[i], b = ring[(i + 1) % ring.length], dx = b.x - a.x, dy = b.y - a.y, L2 = dx * dx + dy * dy;
|
|
135
|
+
const t = L2 > 0 ? Math.max(0, Math.min(1, ((x - a.x) * dx + (y - a.y) * dy) / L2)) : 0;
|
|
136
|
+
const qx = a.x + dx * t, qy = a.y + dy * t, d = Math.hypot(x - qx, y - qy);
|
|
137
|
+
if (d < best.d) best = { x: qx, y: qy, d };
|
|
138
|
+
}
|
|
139
|
+
return best;
|
|
140
|
+
};
|
|
141
|
+
const toRing = (ring, x, y) => nearRing(ring, x, y).d;
|
|
142
|
+
// 矩形の周りの点(4px ごと)
|
|
143
|
+
const rectRing = (q) => {
|
|
144
|
+
const pts = [], w = q.r - q.l, h = q.b - q.t, n = Math.max(1, Math.ceil(w / 4)), m = Math.max(1, Math.ceil(h / 4));
|
|
145
|
+
for (let i = 0; i <= n; i++) { const x = q.l + w * i / n; pts.push({ x, y: q.t }, { x, y: q.b }); }
|
|
146
|
+
for (let j = 1; j < m; j++) { const y = q.t + h * j / m; pts.push({ x: q.l, y }, { x: q.r, y }); }
|
|
147
|
+
return pts;
|
|
148
|
+
};
|
|
75
149
|
|
|
76
150
|
// ---------------------------------------------------------------- 箱
|
|
77
151
|
const boxes = [];
|
|
78
|
-
for (const el of s.querySelectorAll(SEL('box'))) {
|
|
152
|
+
if (!STEP) for (const el of s.querySelectorAll(SEL('box'))) {
|
|
79
153
|
if (!shown(el)) continue;
|
|
80
154
|
const q = box(el.getBoundingClientRect());
|
|
81
155
|
if (q.r - q.l <= 0 || q.b - q.t <= 0) continue;
|
|
82
156
|
const M = mapper(el);
|
|
83
157
|
let inv = null;
|
|
84
158
|
if (M && typeof el.isPointInFill === 'function') { try { inv = M.m.inverse(); } catch (e) { inv = null; } }
|
|
85
|
-
boxes.push({ el, id: el.getAttribute('data-part-id') || '', root: rootOf(el), q, inv, sw: strokeOf(el, M) });
|
|
159
|
+
boxes.push({ el, id: el.getAttribute('data-part-id') || '', root: rootOf(el), q, inv, sw: strokeOf(el, M), ok: okOverlap(el) });
|
|
86
160
|
}
|
|
87
161
|
// 点(スライドの座標)が箱の内側に tol より深く入っているか:点とそのまわり 8 方向の tol の点がみな箱の形の中
|
|
88
162
|
// (形は isPointInFill。ひし形の <polygon>・楕円・角の丸い <rect> も形どおり。形を測れない要素は外接矩形)
|
|
89
163
|
const DIRS = [[1, 0], [-1, 0], [0, 1], [0, -1], [0.7071, 0.7071], [0.7071, -0.7071], [-0.7071, 0.7071], [-0.7071, -0.7071]];
|
|
164
|
+
const inFillOf = (b, px, py) => {
|
|
165
|
+
const cx = sr.left + px * k, cy = sr.top + py * k, m = b.inv;
|
|
166
|
+
try { return b.el.isPointInFill(new DOMPoint(m.a * cx + m.c * cy + m.e, m.b * cx + m.d * cy + m.f)); } catch (e) { return true; }
|
|
167
|
+
};
|
|
90
168
|
const deepIn = (b, x, y, tol) => {
|
|
91
169
|
if (x <= b.q.l + tol || x >= b.q.r - tol || y <= b.q.t + tol || y >= b.q.b - tol) return false;
|
|
92
170
|
if (!b.inv) return true;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
try { return b.el.isPointInFill(new DOMPoint(m.a * cx + m.c * cy + m.e, m.b * cx + m.d * cy + m.f)); } catch (e) { return true; }
|
|
96
|
-
};
|
|
97
|
-
if (!inFill(x, y)) return false;
|
|
98
|
-
for (const d of DIRS) if (!inFill(x + d[0] * tol, y + d[1] * tol)) return false;
|
|
171
|
+
if (!inFillOf(b, x, y)) return false;
|
|
172
|
+
for (const d of DIRS) if (!inFillOf(b, x + d[0] * tol, y + d[1] * tol)) return false;
|
|
99
173
|
return true;
|
|
100
174
|
};
|
|
101
175
|
|
|
102
176
|
// ---------------------------------------------------------------- 辺(線ごとの折れ線、スライドの座標)
|
|
103
177
|
const LINE = 'line,path,polyline,polygon';
|
|
104
178
|
const edges = [];
|
|
105
|
-
for (const g of s.querySelectorAll(SEL('edge'))) {
|
|
179
|
+
if (!STEP) for (const g of s.querySelectorAll(SEL('edge'))) {
|
|
106
180
|
if (!shown(g)) continue;
|
|
107
181
|
const id = g.getAttribute('data-part-id') || '', from = g.getAttribute('data-part-from') || '', to = g.getAttribute('data-part-to') || '';
|
|
108
182
|
const els = g.matches(LINE) && g.hasAttribute('data-part-line') ? [g] : [...g.querySelectorAll('[data-part-line]')].filter((x) => x.matches(LINE));
|
|
@@ -122,9 +196,9 @@ export function geometryScan(s, o) {
|
|
|
122
196
|
const n = Math.min(2000, Math.max(2, Math.ceil(len * M.sc / 4)));
|
|
123
197
|
for (let i = 0; i <= n; i++) { const p = el.getPointAtLength(len * i / n); pts.push(M.pt(p.x, p.y)); }
|
|
124
198
|
}
|
|
125
|
-
lines.push({ el, pts, tol: strokeOf(el, M) / 2 + TOL });
|
|
199
|
+
lines.push({ el, pts, tol: strokeOf(el, M) / 2 + TOL, ok: okOverlap(el) });
|
|
126
200
|
}
|
|
127
|
-
if (lines.length) edges.push({ el: g, id, from, to, root: rootOf(g), lines });
|
|
201
|
+
if (lines.length) edges.push({ el: g, id, from, to, root: rootOf(g), lines, ok: okOverlap(g) });
|
|
128
202
|
}
|
|
129
203
|
// 折れ線を 2px ごとの点に細かくする(箱の通過を見る)
|
|
130
204
|
const dense = (pts) => {
|
|
@@ -195,18 +269,232 @@ export function geometryScan(s, o) {
|
|
|
195
269
|
}
|
|
196
270
|
return htmlTextRects(el);
|
|
197
271
|
};
|
|
272
|
+
|
|
273
|
+
// ---------------------------------------------------------------- 0. 図形が枠の外に出る(geoOutsideFrame の 1 段階分。o.mode === 'step'。handoff #46)
|
|
274
|
+
// 図形(data-within="名前")の輪郭の点が、同じ名前の枠(data-frame="名前")の形の中にあるかを、今の表示で測る。
|
|
275
|
+
// 図形の点:形の要素(SVGGeometryElement)は輪郭を getTotalLength・getPointAtLength で 2px ごと(多くても 2000 点)。<g> なら中の見えている形の要素と字の全部。
|
|
276
|
+
// 字は字の範囲(上の textRects。R-geometry の text-band と同じ値)の周り。HTML の要素は外接矩形の周り
|
|
277
|
+
// 枠:形の要素なら isPointInFill(楕円・円・多角形も形どおり)と、輪郭の折れ線までの距離。そのほか(<g>・HTML)は外接矩形
|
|
278
|
+
// はみ出しの量:点が枠の外なら枠の輪郭までの距離。図形の線の太さの半分を足し、枠の線の太さの半分を引く(線どうしが重なって描けているなら中)。2px までは中とみなす
|
|
279
|
+
// 同じ名前の枠が同じ図(rootOf)にいくつもあれば、いちばんよく収まる枠と比べる(表のマスなど)。同じ図になければスライドの中から。見えている枠がなければ測らない
|
|
280
|
+
const GEOM = 'path,rect,circle,ellipse,line,polyline,polygon';
|
|
281
|
+
const NOT_DRAWN = 'defs,clipPath,mask,marker,pattern,symbol';
|
|
282
|
+
const halfPaint = (el) => {
|
|
283
|
+
const st = getComputedStyle(el);
|
|
284
|
+
if (st.stroke === 'none' || parseFloat(st.strokeOpacity) === 0) return 0;
|
|
285
|
+
return strokeOf(el, mapper(el)) / 2;
|
|
286
|
+
};
|
|
287
|
+
// ---------------------------------------------------------------- 0'. 図形の線が図の端で欠ける(geoClippedStroke の 1 段階分。o.mode === 'step'。handoff #52)
|
|
288
|
+
// インラインの SVG の、線(stroke)の見える形の要素(<rect>・<circle>・<ellipse>・<line>・<polyline>・<polygon>・<path>。字は svgTextOut が見る)ごとに、
|
|
289
|
+
// 描いた範囲(形の外接矩形を線の太さの半分だけ広げたもの。スライドの座標)を、その形を切る範囲(祖先の <svg> のうち overflow が visible でないものの見える範囲。
|
|
290
|
+
// 外側の <svg> は箱、中の <svg> は x・y・width・height。軸ごと)と比べる。overflow が visible の <svg>(属性でも CSS でも)は切らないので見ない。
|
|
291
|
+
// 描いた範囲:変形が回転・傾きのない(ふつうの)形は getBBox の角を getScreenCTM で写し、線の太さの半分を足す。回転した形は輪郭(outline)の点の外接矩形。
|
|
292
|
+
// 開いた線(<line>・<polyline>・z のない <path>)は輪郭の点を法線の向きにだけ線の太さの半分ずらす(butt の端は長さの向きに出ない。round・square の端は出る)
|
|
293
|
+
// 知らせるのは「事故の形」:どこかの辺で 1px より多く欠け、かつ描いた範囲の 9 割以上が見える範囲の中(大半が外の飾りは知らせない)。
|
|
294
|
+
// 9 割は面積の割合(軸ごとの重なりの割合の積)。太さのない向き(水平・垂直の線の太さの向き)は割合に入れない(端に沿う線は、太さの半分が欠けても長さは中)
|
|
295
|
+
// 測らないもの:線のない形(塗りだけの背景は端からはみ出させることが多い)・見えない形・defs など描かれない所・KaTeX・目印の重ね(svg.marks)・
|
|
296
|
+
// わざと切る印(o.clip)の中・clip-path か mask の付いた形(とその祖先)・data-overlap="ok"(要素そのものか祖先の <g>)
|
|
297
|
+
// 1 つの形の値:side(左右上下の欠けた量、1px 以下は 0)・px(いちばん大きい量)・stroke(形そのものは中にあり、線の太さの分だけ欠ける)
|
|
298
|
+
const clippedStrokes = () => {
|
|
299
|
+
const SVGNS = 'http://www.w3.org/2000/svg';
|
|
300
|
+
const SKIP = NOT_DRAWN + ',text,.katex,svg.marks' + (CL ? ',[' + CL + ']' : '');
|
|
301
|
+
const CUT = 1, SHARE = 0.9;
|
|
302
|
+
// <svg> の見える範囲({l, t, r, b, x, y}。x・y はその軸で切るか)。切らないか、大きさがなければ null
|
|
303
|
+
const vps = new Map();
|
|
304
|
+
const viewport = (e) => {
|
|
305
|
+
if (vps.has(e)) return vps.get(e);
|
|
306
|
+
let v = null;
|
|
307
|
+
const st = getComputedStyle(e), x = st.overflowX !== 'visible', y = st.overflowY !== 'visible';
|
|
308
|
+
if (x || y) {
|
|
309
|
+
const p = e.parentElement, outer = !p || p.namespaceURI !== SVGNS || p.localName === 'foreignObject';
|
|
310
|
+
let q = null;
|
|
311
|
+
if (outer) q = box(e.getBoundingClientRect());
|
|
312
|
+
else {
|
|
313
|
+
const M = mapper(p);
|
|
314
|
+
if (M) {
|
|
315
|
+
const X = e.x.baseVal.value, Y = e.y.baseVal.value, W = e.width.baseVal.value, H = e.height.baseVal.value;
|
|
316
|
+
const c = [M.pt(X, Y), M.pt(X + W, Y), M.pt(X, Y + H), M.pt(X + W, Y + H)];
|
|
317
|
+
q = { l: Math.min.apply(null, c.map((a) => a.x)), r: Math.max.apply(null, c.map((a) => a.x)), t: Math.min.apply(null, c.map((a) => a.y)), b: Math.max.apply(null, c.map((a) => a.y)) };
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (q && q.r - q.l > 0 && q.b - q.t > 0) v = Object.assign(q, { x, y });
|
|
321
|
+
}
|
|
322
|
+
vps.set(e, v);
|
|
323
|
+
return v;
|
|
324
|
+
};
|
|
325
|
+
// 形を切る範囲:祖先の <svg> の見える範囲を重ねたもの(外側の <svg> まで)。どれも切らなければ null
|
|
326
|
+
const clipOf = (el) => {
|
|
327
|
+
let q = null;
|
|
328
|
+
for (let e = el.parentElement; e && e !== s; e = e.parentElement) {
|
|
329
|
+
if (e.localName !== 'svg' || e.namespaceURI !== SVGNS) continue;
|
|
330
|
+
const v = viewport(e);
|
|
331
|
+
if (v) {
|
|
332
|
+
if (!q) q = { l: -Infinity, t: -Infinity, r: Infinity, b: Infinity, x: false, y: false };
|
|
333
|
+
if (v.x) { q.l = Math.max(q.l, v.l); q.r = Math.min(q.r, v.r); q.x = true; }
|
|
334
|
+
if (v.y) { q.t = Math.max(q.t, v.t); q.b = Math.min(q.b, v.b); q.y = true; }
|
|
335
|
+
}
|
|
336
|
+
const p = e.parentElement;
|
|
337
|
+
if (!p || p.namespaceURI !== SVGNS || p.localName === 'foreignObject') break;
|
|
338
|
+
}
|
|
339
|
+
return q;
|
|
340
|
+
};
|
|
341
|
+
const cutBy = (el) => {
|
|
342
|
+
for (let e = el; e && e !== s; e = e.parentElement) {
|
|
343
|
+
const st = getComputedStyle(e);
|
|
344
|
+
if ((st.clipPath && st.clipPath !== 'none') || (st.maskImage && st.maskImage !== 'none')) return true;
|
|
345
|
+
if (e.localName === 'svg' && (!e.parentElement || e.parentElement.namespaceURI !== SVGNS)) break;
|
|
346
|
+
}
|
|
347
|
+
return false;
|
|
348
|
+
};
|
|
349
|
+
const bbOf = (pts) => ({ l: Math.min.apply(null, pts.map((p) => p.x)), r: Math.max.apply(null, pts.map((p) => p.x)), t: Math.min.apply(null, pts.map((p) => p.y)), b: Math.max.apply(null, pts.map((p) => p.y)) });
|
|
350
|
+
const grow = (q, w) => ({ l: q.l - w, t: q.t - w, r: q.r + w, b: q.b + w });
|
|
351
|
+
const seen = {};
|
|
352
|
+
for (const el of s.querySelectorAll(GEOM)) {
|
|
353
|
+
const tag = el.localName;
|
|
354
|
+
seen[tag] = (seen[tag] || 0) + 1;
|
|
355
|
+
const nth = seen[tag];
|
|
356
|
+
if (el.namespaceURI !== SVGNS || el.closest(SKIP) || okOverlap(el)) continue;
|
|
357
|
+
const C = clipOf(el);
|
|
358
|
+
if (!C) continue;
|
|
359
|
+
const st = getComputedStyle(el);
|
|
360
|
+
if (st.stroke === 'none' || parseFloat(st.strokeOpacity) === 0 || !(parseFloat(st.strokeWidth) > 0)) continue;
|
|
361
|
+
const M = mapper(el);
|
|
362
|
+
if (!M) continue;
|
|
363
|
+
let bb;
|
|
364
|
+
try { bb = el.getBBox(); } catch (e) { continue; }
|
|
365
|
+
// 線の太さの半分(スライドの座標)。non-scaling-stroke は画面の px
|
|
366
|
+
const w = (st.vectorEffect === 'non-scaling-stroke' ? parseFloat(st.strokeWidth) / k : strokeOf(el, M)) / 2;
|
|
367
|
+
const g0 = bbOf([M.pt(bb.x, bb.y), M.pt(bb.x + bb.width, bb.y), M.pt(bb.x, bb.y + bb.height), M.pt(bb.x + bb.width, bb.y + bb.height)]);
|
|
368
|
+
// 端から離れた形は細かく測らない(回転した形の外接矩形は実際より大きいので、離れていればなお離れている。square の端の斜めの角まで見て 1.5 倍)
|
|
369
|
+
const w2 = w * 1.5;
|
|
370
|
+
if ((!C.x || (g0.l - w2 - C.l > CUT && C.r - g0.r - w2 > CUT)) && (!C.y || (g0.t - w2 - C.t > CUT && C.b - g0.b - w2 > CUT))) continue;
|
|
371
|
+
if (!shown(el) || cutBy(el)) continue;
|
|
372
|
+
const rot = Math.abs(M.m.b) > 1e-6 || Math.abs(M.m.c) > 1e-6;
|
|
373
|
+
const open = tag === 'line' || tag === 'polyline' || (tag === 'path' && !/z/i.test(el.getAttribute('d') || ''));
|
|
374
|
+
let g = g0, p;
|
|
375
|
+
if (!open) {
|
|
376
|
+
if (rot) { const pts = outline(el, 4); if (pts.length) g = bbOf(pts); }
|
|
377
|
+
p = grow(g, w);
|
|
378
|
+
} else {
|
|
379
|
+
const pts = tag === 'line' ? [M.pt(el.x1.baseVal.value, el.y1.baseVal.value), M.pt(el.x2.baseVal.value, el.y2.baseVal.value)] : outline(el, 4);
|
|
380
|
+
if (pts.length < 2) continue;
|
|
381
|
+
g = bbOf(pts);
|
|
382
|
+
const ps = [], cap = st.strokeLinecap;
|
|
383
|
+
for (let i = 0; i < pts.length; i++) {
|
|
384
|
+
const a = pts[Math.max(0, i - 1)], b = pts[Math.min(pts.length - 1, i + 1)], L = Math.hypot(b.x - a.x, b.y - a.y);
|
|
385
|
+
if (!(L > 0)) continue;
|
|
386
|
+
const tx = (b.x - a.x) / L, ty = (b.y - a.y) / L, nx = -ty * w, ny = tx * w, q = pts[i];
|
|
387
|
+
ps.push({ x: q.x + nx, y: q.y + ny }, { x: q.x - nx, y: q.y - ny });
|
|
388
|
+
const end = i === 0 ? -1 : i === pts.length - 1 ? 1 : 0;
|
|
389
|
+
if (end && cap === 'round') ps.push({ x: q.x - w, y: q.y }, { x: q.x + w, y: q.y }, { x: q.x, y: q.y - w }, { x: q.x, y: q.y + w });
|
|
390
|
+
if (end && cap === 'square') { const ex = end * tx * w, ey = end * ty * w; ps.push({ x: q.x + ex + nx, y: q.y + ey + ny }, { x: q.x + ex - nx, y: q.y + ey - ny }); }
|
|
391
|
+
}
|
|
392
|
+
if (!ps.length) continue;
|
|
393
|
+
p = bbOf(ps);
|
|
394
|
+
}
|
|
395
|
+
const side = { left: C.x ? C.l - p.l : 0, right: C.x ? p.r - C.r : 0, top: C.y ? C.t - p.t : 0, bottom: C.y ? p.b - C.b : 0 };
|
|
396
|
+
const worst = Math.max(side.left, side.right, side.top, side.bottom);
|
|
397
|
+
if (!(worst > CUT)) continue;
|
|
398
|
+
const share = (a0, a1, c0, c1, thin) => (thin || a1 - a0 <= 0 ? 1 : Math.max(0, Math.min(a1, c1) - Math.max(a0, c0)) / (a1 - a0));
|
|
399
|
+
const inside = share(p.l, p.r, C.l, C.r, !C.x || g.r - g.l < 1) * share(p.t, p.b, C.t, C.b, !C.y || g.b - g.t < 1);
|
|
400
|
+
if (inside < SHARE) continue;
|
|
401
|
+
// 形そのもの(線の太さを除く)は見える範囲の中か(中なら線だけが欠ける)
|
|
402
|
+
const geo = Math.max(C.x ? C.l - g.l : 0, C.x ? g.r - C.r : 0, C.y ? C.t - g.t : 0, C.y ? g.b - C.b : 0);
|
|
403
|
+
for (const kk of Object.keys(side)) side[kk] = side[kk] > CUT ? rnd(side[kk]) : 0;
|
|
404
|
+
add('warn', 'geoClippedStroke', { shape: el.getAttribute('data-part-id') || el.id || tag + '#' + nth, side, px: rnd(worst), stroke: geo <= CUT });
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
if (WITHIN) {
|
|
409
|
+
const shapePts = (el) => {
|
|
410
|
+
const pts = [];
|
|
411
|
+
const geo = (g) => { const w = halfPaint(g); for (const p of outline(g, 2)) pts.push({ x: p.x, y: p.y, w }); };
|
|
412
|
+
const txt = (t) => { for (const r of textRects(t)) for (const p of rectRing(r)) pts.push({ x: p.x, y: p.y, w: 0 }); };
|
|
413
|
+
if (el.namespaceURI === 'http://www.w3.org/2000/svg' && el.localName !== 'svg') {
|
|
414
|
+
if (el.matches(GEOM)) geo(el);
|
|
415
|
+
else if (el.localName === 'text' || el.localName === 'foreignObject') txt(el);
|
|
416
|
+
else {
|
|
417
|
+
for (const g of el.querySelectorAll(GEOM)) if (shown(g) && !g.closest(NOT_DRAWN)) geo(g);
|
|
418
|
+
for (const t of el.querySelectorAll('text,foreignObject')) if (shown(t) && !t.parentElement.closest('text,foreignObject')) txt(t);
|
|
419
|
+
}
|
|
420
|
+
} else for (const p of rectRing(box(el.getBoundingClientRect()))) pts.push({ x: p.x, y: p.y, w: 0 });
|
|
421
|
+
return pts;
|
|
422
|
+
};
|
|
423
|
+
const frameOf = (el) => {
|
|
424
|
+
if (el.namespaceURI === 'http://www.w3.org/2000/svg' && typeof el.isPointInFill === 'function') {
|
|
425
|
+
const M = mapper(el);
|
|
426
|
+
let inv = null;
|
|
427
|
+
try { inv = M && M.m.inverse(); } catch (e) { inv = null; }
|
|
428
|
+
const ring = outline(el, 2);
|
|
429
|
+
if (inv && ring.length > 2) {
|
|
430
|
+
return {
|
|
431
|
+
half: halfPaint(el),
|
|
432
|
+
inside: (x, y) => { const cx = sr.left + x * k, cy = sr.top + y * k; try { return el.isPointInFill(new DOMPoint(inv.a * cx + inv.c * cy + inv.e, inv.b * cx + inv.d * cy + inv.f)); } catch (e) { return true; } },
|
|
433
|
+
dist: (x, y) => toRing(ring, x, y),
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
const q = box(el.getBoundingClientRect());
|
|
438
|
+
return {
|
|
439
|
+
half: 0,
|
|
440
|
+
inside: (x, y) => x >= q.l && x <= q.r && y >= q.t && y <= q.b,
|
|
441
|
+
dist: (x, y) => (x >= q.l && x <= q.r && y >= q.t && y <= q.b ? Math.min(x - q.l, q.r - x, y - q.t, q.b - y) : Math.hypot(Math.max(q.l - x, 0, x - q.r), Math.max(q.t - y, 0, y - q.b))),
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
// 名前は 1 つだけ(o.name)。並べた名前・大文字・空などの値は測らない(枠の側も同じ値でしか合わない)。その値は geoBadMarkName が最後のステップで 1 度知らせる
|
|
445
|
+
const all = [...s.querySelectorAll('[' + WA + ']')];
|
|
446
|
+
all.forEach((el, n) => {
|
|
447
|
+
const name = el.getAttribute(WA) || '';
|
|
448
|
+
if (!NAME.test(name) || !shown(el)) return;
|
|
449
|
+
const sel = '[' + FA + '="' + name + '"]';
|
|
450
|
+
const root = rootOf(el);
|
|
451
|
+
let fs = [...s.querySelectorAll(sel)].filter((f) => f !== el && !el.contains(f) && shown(f));
|
|
452
|
+
const near = fs.filter((f) => rootOf(f) === root);
|
|
453
|
+
if (near.length) fs = near;
|
|
454
|
+
if (!fs.length) return;
|
|
455
|
+
const pts = shapePts(el);
|
|
456
|
+
if (!pts.length) return;
|
|
457
|
+
let best = null;
|
|
458
|
+
for (const f of fs) {
|
|
459
|
+
const F = frameOf(f);
|
|
460
|
+
let worst = -Infinity, at = null;
|
|
461
|
+
for (const p of pts) {
|
|
462
|
+
let v;
|
|
463
|
+
if (F.inside(p.x, p.y)) { if (p.w - F.half <= TOL) continue; v = p.w - F.half - F.dist(p.x, p.y); }
|
|
464
|
+
else v = F.dist(p.x, p.y) + p.w - F.half;
|
|
465
|
+
if (v > worst) { worst = v; at = p; }
|
|
466
|
+
}
|
|
467
|
+
if (!best || worst < best.worst) best = { worst, at };
|
|
468
|
+
if (best.worst <= TOL) break;
|
|
469
|
+
}
|
|
470
|
+
if (best && best.worst > TOL) {
|
|
471
|
+
add('warn', 'geoOutsideFrame', { shape: el.getAttribute('data-part-id') || el.id || el.localName + '#' + (n + 1), frame: name, px: rnd(best.worst), at: [rnd(best.at.x), rnd(best.at.y)] });
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
if (STEP) {
|
|
476
|
+
if (EDGE) clippedStrokes();
|
|
477
|
+
return out;
|
|
478
|
+
}
|
|
479
|
+
|
|
198
480
|
const labels = [];
|
|
199
481
|
for (const el of s.querySelectorAll(SEL('label'))) {
|
|
200
482
|
if (!shown(el)) continue;
|
|
201
483
|
const rs = textRects(el);
|
|
202
484
|
if (!rs.length) continue;
|
|
203
|
-
labels.push({ el, id: el.getAttribute('data-part-id') || '', of: el.getAttribute('data-part-of') || '', outside: el.getAttribute('data-part-at') === 'outside', halo: el.hasAttribute('data-part-halo'), t: textOf(el), root: rootOf(el), rs });
|
|
485
|
+
labels.push({ el, id: el.getAttribute('data-part-id') || '', of: el.getAttribute('data-part-of') || '', outside: el.getAttribute('data-part-at') === 'outside', halo: el.hasAttribute('data-part-halo'), t: textOf(el), root: rootOf(el), rs, ok: okOverlap(el) });
|
|
204
486
|
}
|
|
205
487
|
const marks = [];
|
|
206
488
|
for (const el of s.querySelectorAll(SEL('mark'))) {
|
|
207
489
|
if (!shown(el)) continue;
|
|
208
490
|
const q = box(el.getBoundingClientRect());
|
|
209
|
-
if (q.r - q.l > 0 && q.b - q.t > 0) marks.push({ el, id: el.getAttribute('data-part-id') || '', root: rootOf(el), q });
|
|
491
|
+
if (q.r - q.l > 0 && q.b - q.t > 0) marks.push({ el, id: el.getAttribute('data-part-id') || '', root: rootOf(el), q, ok: okOverlap(el) });
|
|
492
|
+
}
|
|
493
|
+
// 辺の端が点(mark)のとき:その点の字と、その点を中に持つ箱は、この辺の相手にしない(点から字への引き出し線。handoff #45 の決定 2)
|
|
494
|
+
for (const E of edges) {
|
|
495
|
+
const ends = marks.filter((Mk) => Mk.root === E.root && Mk.id && (Mk.id === E.from || Mk.id === E.to));
|
|
496
|
+
E.markIds = ends.map((Mk) => Mk.id);
|
|
497
|
+
E.inBoxes = boxes.filter((B) => B.root === E.root && ends.some((Mk) => deepIn(B, (Mk.q.l + Mk.q.r) / 2, (Mk.q.t + Mk.q.b) / 2, 0)));
|
|
210
498
|
}
|
|
211
499
|
const meet = (a, b, tol) => {
|
|
212
500
|
const q = { l: Math.max(a.l, b.l), t: Math.max(a.t, b.t), r: Math.min(a.r, b.r), b: Math.min(a.b, b.b) };
|
|
@@ -215,10 +503,12 @@ export function geometryScan(s, o) {
|
|
|
215
503
|
|
|
216
504
|
// ---------------------------------------------------------------- 1. 辺が元でも先でもない箱の内側を通る(geoEdgeThroughBox)
|
|
217
505
|
for (const E of edges) {
|
|
506
|
+
if (E.ok) continue;
|
|
218
507
|
for (const B of boxes) {
|
|
219
|
-
if (B.root !== E.root || B.id === E.from || B.id === E.to) continue;
|
|
508
|
+
if (B.root !== E.root || B.id === E.from || B.id === E.to || B.ok || E.inBoxes.includes(B)) continue;
|
|
220
509
|
let seg = null;
|
|
221
510
|
for (const L of E.lines) {
|
|
511
|
+
if (L.ok) continue;
|
|
222
512
|
let first = null, last = null;
|
|
223
513
|
for (const p of dense(L.pts)) {
|
|
224
514
|
if (deepIn(B, p.x, p.y, L.tol)) { if (!first) first = p; last = p; }
|
|
@@ -245,10 +535,12 @@ export function geometryScan(s, o) {
|
|
|
245
535
|
return { x: a.x + dx * tm, y: a.y + dy * tm };
|
|
246
536
|
};
|
|
247
537
|
for (const E of edges) {
|
|
538
|
+
if (E.ok) continue;
|
|
248
539
|
for (const Lb of labels) {
|
|
249
|
-
if (Lb.root !== E.root || (Lb.of === 'edge' && Lb.id === E.id) || E.el.contains(Lb.el)) continue;
|
|
540
|
+
if (Lb.root !== E.root || Lb.ok || (Lb.of === 'edge' && Lb.id === E.id) || (Lb.of === 'mark' && E.markIds.includes(Lb.id)) || E.el.contains(Lb.el)) continue;
|
|
250
541
|
let at = null;
|
|
251
542
|
for (const L of E.lines) {
|
|
543
|
+
if (L.ok) continue;
|
|
252
544
|
for (const r of Lb.rs) {
|
|
253
545
|
const q = { l: r.l + L.tol, t: r.t + L.tol, r: r.r - L.tol, b: r.b - L.tol };
|
|
254
546
|
if (q.r <= q.l || q.b <= q.t) continue;
|
|
@@ -264,15 +556,16 @@ export function geometryScan(s, o) {
|
|
|
264
556
|
// ---------------------------------------------------------------- 3. 字の範囲どうし・字と持ち主でない点が重なる(geoLabelOverlap)
|
|
265
557
|
for (let i = 0; i < labels.length; i++) {
|
|
266
558
|
const A = labels[i];
|
|
559
|
+
if (A.ok) continue;
|
|
267
560
|
for (let j = i + 1; j < labels.length; j++) {
|
|
268
561
|
const B = labels[j];
|
|
269
|
-
if (A.root !== B.root || A.el.contains(B.el) || B.el.contains(A.el)) continue;
|
|
562
|
+
if (A.root !== B.root || B.ok || A.el.contains(B.el) || B.el.contains(A.el)) continue;
|
|
270
563
|
let q = null;
|
|
271
564
|
for (const r of A.rs) { for (const u of B.rs) if ((q = meet(r, u, TOL))) break; if (q) break; }
|
|
272
565
|
if (q) add('warn', 'geoLabelOverlap', { label: A.id, of: A.of, t: A.t, other: B.id, otherOf: B.of, u: B.t, mark: false, rect: rr(q) });
|
|
273
566
|
}
|
|
274
567
|
for (const Mk of marks) {
|
|
275
|
-
if (Mk.root !== A.root || (A.of === 'mark' && A.id === Mk.id) || Mk.el.contains(A.el) || A.el.contains(Mk.el)) continue;
|
|
568
|
+
if (Mk.root !== A.root || Mk.ok || (A.of === 'mark' && A.id === Mk.id) || Mk.el.contains(A.el) || A.el.contains(Mk.el)) continue;
|
|
276
569
|
let q = null;
|
|
277
570
|
for (const r of A.rs) if ((q = meet(r, Mk.q, TOL))) break;
|
|
278
571
|
if (q) add('warn', 'geoLabelOverlap', { label: A.id, of: A.of, t: A.t, other: Mk.id, otherOf: 'mark', u: '', mark: true, rect: rr(q) });
|
|
@@ -280,23 +573,68 @@ export function geometryScan(s, o) {
|
|
|
280
573
|
}
|
|
281
574
|
|
|
282
575
|
// ---------------------------------------------------------------- 4. 箱の中の字が箱の縁を越える(geoLabelOutsideBox)。data-part-at="outside" の字は見ない
|
|
576
|
+
// <rect> の箱は外接矩形と比べる。<circle>・<ellipse>・<polygon>・<path> の箱は形と比べる(ほかの点検と同じ isPointInFill と輪郭までの距離):
|
|
577
|
+
// 字の範囲の周りの点のうち形の外のものについて、輪郭のいちばん近い点からのずれを左右上下に分けて、いちばん大きいものを px にする(2px までは中)
|
|
283
578
|
for (const Lb of labels) {
|
|
284
579
|
if (Lb.of !== 'box' || Lb.outside) continue;
|
|
285
580
|
const B = boxes.find((b) => b.id === Lb.id && b.root === Lb.root);
|
|
286
581
|
if (!B) continue;
|
|
287
582
|
const l = Math.min.apply(null, Lb.rs.map((r) => r.l)), r = Math.max.apply(null, Lb.rs.map((x) => x.r));
|
|
288
583
|
const t = Math.min.apply(null, Lb.rs.map((x) => x.t)), b = Math.max.apply(null, Lb.rs.map((x) => x.b));
|
|
584
|
+
const ring = B.inv && B.el.localName !== 'rect' ? outline(B.el, 2) : [];
|
|
585
|
+
if (ring.length > 2) {
|
|
586
|
+
const d = { left: 0, right: 0, top: 0, bottom: 0 };
|
|
587
|
+
let worst = 0;
|
|
588
|
+
for (const q of Lb.rs) for (const p of rectRing(q)) {
|
|
589
|
+
if (inFillOf(B, p.x, p.y)) continue;
|
|
590
|
+
const o = nearRing(ring, p.x, p.y);
|
|
591
|
+
worst = Math.max(worst, o.d);
|
|
592
|
+
d.left = Math.max(d.left, o.x - p.x); d.right = Math.max(d.right, p.x - o.x); d.top = Math.max(d.top, o.y - p.y); d.bottom = Math.max(d.bottom, p.y - o.y);
|
|
593
|
+
}
|
|
594
|
+
if (worst > TOL) add('warn', 'geoLabelOutsideBox', { box: B.id, t: Lb.t, px: { left: rnd(d.left), right: rnd(d.right), top: rnd(d.top), bottom: rnd(d.bottom) }, rect: rr({ l, t, r, b }), boxRect: rr(B.q) });
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
289
597
|
const px = { left: rnd(Math.max(0, B.q.l - l)), right: rnd(Math.max(0, r - B.q.r)), top: rnd(Math.max(0, B.q.t - t)), bottom: rnd(Math.max(0, b - B.q.b)) };
|
|
290
598
|
if (B.q.l - l > TOL || r - B.q.r > TOL || B.q.t - t > TOL || b - B.q.b > TOL) add('warn', 'geoLabelOutsideBox', { box: B.id, t: Lb.t, px, rect: rr({ l, t, r, b }), boxRect: rr(B.q) });
|
|
291
599
|
}
|
|
292
600
|
return out;
|
|
293
601
|
}
|
|
294
602
|
|
|
603
|
+
// 図形が枠の外に出る(geoOutsideFrame。handoff #46)を、スライドの全部のステップで測ってまとめる。geometryScan と同じく文字列でページに入れる。
|
|
604
|
+
// seek(k):そのステップの終わりの表示にする(kit/check.mjs と編集アプリは DECK.seek(i, k, Infinity))。scan:geometryScan(中で外の名前を使えないので渡してもらう)
|
|
605
|
+
export function geometrySteps(s, o, seek, scan) {
|
|
606
|
+
if (!s || s.classList.contains('layout-tate')) return null;
|
|
607
|
+
const WA = (o && o.within) || '', CL = (o && o.clip) || '';
|
|
608
|
+
// 歩くのは、枠の中の印があるか、形の要素の入った、切る(overflow が visible でない)SVG があるスライドだけ
|
|
609
|
+
const SKIP = '.katex,svg.marks' + (CL ? ',[' + CL + ']' : '');
|
|
610
|
+
const svgs = [].filter.call(s.querySelectorAll('svg'), (g) => {
|
|
611
|
+
if (g.closest(SKIP) || !g.querySelector('path,rect,circle,ellipse,line,polyline,polygon')) return false;
|
|
612
|
+
const st = getComputedStyle(g);
|
|
613
|
+
return st.overflowX !== 'visible' || st.overflowY !== 'visible';
|
|
614
|
+
});
|
|
615
|
+
if (!(WA && s.querySelector('[' + WA + ']')) && !svgs.length) return null;
|
|
616
|
+
const max = s.classList.contains('static') ? 0 : (isFinite(s._max) && s._max > 0 ? s._max : 0);
|
|
617
|
+
const oo = Object.assign({}, o, { mode: 'step' }), by = new Map(), order = [];
|
|
618
|
+
for (let k = 0; k <= max; k++) {
|
|
619
|
+
seek(k);
|
|
620
|
+
const name = k === s._cstep ? 'concl' : String(k);
|
|
621
|
+
for (const f of scan(s, oo)) {
|
|
622
|
+
const key = f.code + '\n' + f.a.shape + '\n' + (f.a.frame || '');
|
|
623
|
+
let r = by.get(key);
|
|
624
|
+
if (!r) { r = { code: f.code, sev: f.sev, a: Object.assign({}, f.a, { step: name, steps: [] }) }; by.set(key, r); order.push(r); }
|
|
625
|
+
r.a.steps.push(name);
|
|
626
|
+
if (f.a.px > r.a.px) r.a = Object.assign({}, f.a, { step: name, steps: r.a.steps });
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return order;
|
|
630
|
+
}
|
|
631
|
+
|
|
295
632
|
// 縦横が混ざる教材で、形の点検から外した縦書きのスライド(印のあるもの)の数。中身のスライドがみな縦書きなら 0。geometryScan と同じく文字列でページに入れる
|
|
296
|
-
|
|
633
|
+
// 印:data-part の 4 つと、枠の中の印(o.within・o.frame。渡されたときだけ)
|
|
634
|
+
export function geometryTate(slides, o) {
|
|
297
635
|
const content = [].filter.call(slides || [], (s) => !s.classList.contains('cover') && !s.classList.contains('sec'));
|
|
298
636
|
const tate = content.filter((s) => s.classList.contains('layout-tate'));
|
|
299
637
|
if (!tate.length || tate.length === content.length) return 0;
|
|
300
|
-
const sel = ['box', 'edge', 'label', 'mark'].map((v) => '[data-part="' + v + '"]').join(',');
|
|
638
|
+
const sel = ['box', 'edge', 'label', 'mark'].map((v) => '[data-part="' + v + '"]').concat(o && o.within ? ['[' + o.within + ']'] : [], o && o.frame ? ['[' + o.frame + ']'] : []).join(',');
|
|
301
639
|
return tate.filter((s) => !!s.querySelector(sel)).length;
|
|
302
640
|
}
|