egatari 0.6.10 → 0.6.11-rc.1
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/README.ja.md +22 -22
- package/README.md +1 -1
- package/bin/egatari.mjs +1 -1
- package/components.lock.json +288 -144
- package/components2.lock.json +657 -1
- package/kit/build.mjs +3 -2
- package/kit/check-messages.mjs +46 -12
- package/kit/check.mjs +54 -19
- package/kit/core/article-messages.mjs +5 -4
- package/kit/core/attachments.mjs +2 -1
- package/kit/core/build-core.mjs +2 -1
- package/kit/core/check-parity.mjs +3 -1
- package/kit/core/check-result.mjs +2 -1
- package/kit/core/check-rules.mjs +132 -0
- package/kit/core/colab-core.mjs +2 -2
- package/kit/core/geometry-check.mjs +302 -0
- package/kit/core/layout-scan.mjs +9 -2
- package/kit/core/live-results.mjs +1 -1
- package/kit/core/llm-fix.mjs +3 -2
- package/kit/core/llm-outline.mjs +3 -2
- package/kit/core/llm-pack-data.mjs +114 -114
- package/kit/core/narration-lint.mjs +37 -0
- package/kit/core/new-deck-pack.mjs +2 -1
- package/kit/core/new-deck.mjs +1 -1
- package/kit/core/plural.mjs +5 -0
- package/kit/core/portable.mjs +6 -5
- package/kit/core/sample-layout.mjs +14 -0
- package/kit/core/text-band.mjs +37 -0
- package/kit/core/tier-a.mjs +2 -1
- package/kit/instruction-version.json +1 -1
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/render-compare.mjs +5 -4
- package/kit/tools.js +2 -2
- package/package.json +3 -2
- package/server/editor-ui.js +2 -2
- package/vendor/components/CATALOG.md +12 -12
- package/vendor/components/sha256/00d9072cb279a1a68166787f53395c747072388971d916c082a106844dbf888f/index.js +315 -0
- package/vendor/components/sha256/03e20fb6803de0d94e93de7c01d7d00cede57b0b2604b449daa4cb156367500d/README.en.md +23 -0
- package/vendor/components/sha256/03e20fb6803de0d94e93de7c01d7d00cede57b0b2604b449daa4cb156367500d/index.js +289 -0
- package/vendor/components/sha256/0e5458deb63e32aefdbf8722fa156fd44cd90d5d8f9d6a25a636007b4b599450/README.en.md +40 -0
- package/vendor/components/sha256/0e5458deb63e32aefdbf8722fa156fd44cd90d5d8f9d6a25a636007b4b599450/index.js +341 -0
- package/vendor/components/sha256/1073e03374f0fe65d2691f160bfd8c092986c168d0bd6a6094ebd444d4b89c27/index.js +592 -0
- package/vendor/components/sha256/12b1b32eb3a75e9f11eff407b7876473674ae996d7ce276e2ab6ffaf41ad4376/README.en.md +48 -0
- package/vendor/components/sha256/12b1b32eb3a75e9f11eff407b7876473674ae996d7ce276e2ab6ffaf41ad4376/index.js +384 -0
- package/vendor/components/sha256/147987bd84722249dab609293d4fafa93f0a2aac25b8517fda1710840b575d00/index.js +341 -0
- package/vendor/components/sha256/170e9072285213a2b4e79d7c2e4ddb882d1501e60b5da63c59b1679643163005/README.en.md +23 -0
- package/vendor/components/sha256/170e9072285213a2b4e79d7c2e4ddb882d1501e60b5da63c59b1679643163005/index.js +120 -0
- package/vendor/components/sha256/17da8ef5ce58354df54ebb52c8a9b0726e69d06ac28cc8e78f807ec338002782/README.en.md +32 -0
- package/vendor/components/sha256/17da8ef5ce58354df54ebb52c8a9b0726e69d06ac28cc8e78f807ec338002782/index.js +222 -0
- package/vendor/components/sha256/1b30dfd9b366ff07556024eb8ce75cca2eac8001fa392eed4e1232047001ec74/index.js +404 -0
- package/vendor/components/sha256/37846655693f8dd869d11d3d4cddb43be57f848037d0e49564b2250401448ab5/README.en.md +66 -0
- package/vendor/components/sha256/37846655693f8dd869d11d3d4cddb43be57f848037d0e49564b2250401448ab5/index.js +920 -0
- package/vendor/components/sha256/3fdd15756f779a16362dd854f143ca4343154059882d88d44adf64745c7876e3/README.en.md +50 -0
- package/vendor/components/sha256/3fdd15756f779a16362dd854f143ca4343154059882d88d44adf64745c7876e3/index.js +171 -0
- package/vendor/components/sha256/435c3f8e0c0abc123866e57ae2c7f3409e19d14a2eb67b1fde84c4da5d95f14c/README.en.md +31 -0
- package/vendor/components/sha256/435c3f8e0c0abc123866e57ae2c7f3409e19d14a2eb67b1fde84c4da5d95f14c/index.js +232 -0
- package/vendor/components/sha256/43740da51de85c1b7ec1eaf688f93fd9ea25b15977ab075e6abac196f08643a6/index.js +122 -0
- package/vendor/components/sha256/4817f77bd021ec5c77d5a15ee56e2e34d31d1d98630e86225eb20f2f9bf095e9/index.js +812 -0
- package/vendor/components/sha256/4e4bf3b2968c36a334dc997e32e36f22ecbc4f5dfe1c76bb7a5beef002fe8899/index.js +228 -0
- package/vendor/components/sha256/553e132d1f84caad648bb7175a206d4c5d18c005b5ca17989f5e8a5e3f5cdfa1/index.js +75 -0
- package/vendor/components/sha256/5b02d8a81a41f4d1658f1972f3fc91de3cc431b2c71bb6b92601d58f734de9ec/README.en.md +34 -0
- package/vendor/components/sha256/5b02d8a81a41f4d1658f1972f3fc91de3cc431b2c71bb6b92601d58f734de9ec/index.js +244 -0
- package/vendor/components/sha256/5c72414df5a948a7cbb882be1e5bdd4113d188e357d4a0f01fabda15781417eb/LICENSE-tabler.txt +21 -0
- package/vendor/components/sha256/5c72414df5a948a7cbb882be1e5bdd4113d188e357d4a0f01fabda15781417eb/index.js +4868 -0
- package/vendor/components/sha256/5c72414df5a948a7cbb882be1e5bdd4113d188e357d4a0f01fabda15781417eb/names.txt +4808 -0
- package/vendor/components/sha256/636f47e955f5550f046cfc7a3de8de70c4b97aa77771bde2ee0e31d706bb032e/index.js +278 -0
- package/vendor/components/sha256/65ddc34bd9c75e073f4c2cd283369417fe88769521809670c6b8730852d4f647/index.js +97 -0
- package/vendor/components/sha256/6b0c75b0f697fe451197301de82a113f1c2548b67f7a8d2b56576d2bae8e240c/index.js +607 -0
- package/vendor/components/sha256/6cdf432d3e61be3ff15e80910369324ac7ea0e8b9f62c32ef37bf09a5bfe93b9/README.en.md +33 -0
- package/vendor/components/sha256/6cdf432d3e61be3ff15e80910369324ac7ea0e8b9f62c32ef37bf09a5bfe93b9/index.js +390 -0
- package/vendor/components/sha256/6d648d0e5c96ec680c04a14b7c3d672010d3b9f101197689e9672ec00174383d/README.en.md +31 -0
- package/vendor/components/sha256/6d648d0e5c96ec680c04a14b7c3d672010d3b9f101197689e9672ec00174383d/index.js +267 -0
- package/vendor/components/sha256/71208afc5c8ea1ed6d2180f46de7385e43990cfb046ba350eefb917eca5d92fe/README.en.md +22 -0
- package/vendor/components/sha256/71208afc5c8ea1ed6d2180f46de7385e43990cfb046ba350eefb917eca5d92fe/index.js +145 -0
- package/vendor/components/sha256/7552a029f30f9c2f2ec8c5af4f144b63eeffc9172b53e35a925821f69a738b64/README.en.md +44 -0
- package/vendor/components/sha256/7552a029f30f9c2f2ec8c5af4f144b63eeffc9172b53e35a925821f69a738b64/index.js +203 -0
- package/vendor/components/sha256/781a45d97f1325cfb40aa98d00e1db9600949158fdb2749b0223b019c67a80f2/index.js +919 -0
- package/vendor/components/sha256/850944419734168be3dc202057de128131869c471cb8ab3baec2cfe789d56493/index.js +465 -0
- package/vendor/components/sha256/863d4d42075fbae1084089730f10da943c88d3e3e655235f28c24b9a3cf95c88/README.en.md +37 -0
- package/vendor/components/sha256/863d4d42075fbae1084089730f10da943c88d3e3e655235f28c24b9a3cf95c88/index.js +424 -0
- package/vendor/components/sha256/8a892d25d0bb6105ba31ea690b465876ce3af1fbaf18e2a9ce44ad2fee81260e/index.js +162 -0
- package/vendor/components/sha256/8acec8f299510287fbad6a69311ec58a39b0e99647dd03609c818e053b3b6087/index.js +484 -0
- package/vendor/components/sha256/8ef66bd1e800bcbedef436585469d308665aaa1ab6011aee699544302d0a8ad0/index.js +312 -0
- package/vendor/components/sha256/8fa5ed6ab12a27542e077ff965bea626ff9450b330609304dc1148fc8dbb68b0/README.en.md +40 -0
- package/vendor/components/sha256/8fa5ed6ab12a27542e077ff965bea626ff9450b330609304dc1148fc8dbb68b0/index.js +348 -0
- package/vendor/components/sha256/a0c71874d83045baaef70285bd00d87a7c6c43219fa5630dfff60d5cb08509be/index.js +250 -0
- package/vendor/components/sha256/a31f39625d7d1087d06a72b644cec417372f98add940288257ef07f812d8395a/index.js +747 -0
- package/vendor/components/sha256/ae04a57be4a26b7443796a93c58adcf1cbcf746120eba619bf9c2bcdce53c640/README.en.md +38 -0
- package/vendor/components/sha256/ae04a57be4a26b7443796a93c58adcf1cbcf746120eba619bf9c2bcdce53c640/index.js +289 -0
- package/vendor/components/sha256/ae06622a328da2a01260bc68b28bb632c391e8d62a4e8387638e5a944525a418/index.js +521 -0
- package/vendor/components/sha256/b490139e9afa84164054738532d5ec4985bf071e40791d903012fe3b850bae43/README.en.md +24 -0
- package/vendor/components/sha256/b490139e9afa84164054738532d5ec4985bf071e40791d903012fe3b850bae43/index.js +103 -0
- package/vendor/components/sha256/b756c66d5c6e6ace90912ab467dea3031f2c9b291d8b2a786ca660faa0e8ac84/index.js +121 -0
- package/vendor/components/sha256/babd98da50ea334b63f79c66be436d092e8aea32654e011a6444667abb882e77/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/babd98da50ea334b63f79c66be436d092e8aea32654e011a6444667abb882e77/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/babd98da50ea334b63f79c66be436d092e8aea32654e011a6444667abb882e77/fixtures/chords.json +89 -0
- package/vendor/components/sha256/babd98da50ea334b63f79c66be436d092e8aea32654e011a6444667abb882e77/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/babd98da50ea334b63f79c66be436d092e8aea32654e011a6444667abb882e77/fixtures/extras.json +192 -0
- package/vendor/components/sha256/babd98da50ea334b63f79c66be436d092e8aea32654e011a6444667abb882e77/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/babd98da50ea334b63f79c66be436d092e8aea32654e011a6444667abb882e77/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/babd98da50ea334b63f79c66be436d092e8aea32654e011a6444667abb882e77/fixtures/ties.json +360 -0
- package/vendor/components/sha256/babd98da50ea334b63f79c66be436d092e8aea32654e011a6444667abb882e77/index.js +508 -0
- package/vendor/components/sha256/bea7cb344f55677d5756c9711b90cc971126830ec5f66a03f71f13dbfadc401e/index.js +351 -0
- package/vendor/components/sha256/c08b25a2f7be68c36634cdee180aa617fd018d80b7ddf2a484a2edb4acffdbe0/README.en.md +42 -0
- package/vendor/components/sha256/c08b25a2f7be68c36634cdee180aa617fd018d80b7ddf2a484a2edb4acffdbe0/index.js +268 -0
- package/vendor/components/sha256/cbe8bb4b2fd0845a9333bc2064d86758ea6465992ad86a99167ba17f57f3e382/README.en.md +51 -0
- package/vendor/components/sha256/cbe8bb4b2fd0845a9333bc2064d86758ea6465992ad86a99167ba17f57f3e382/index.js +228 -0
- package/vendor/components/sha256/d2df3d70fc7c6e07e3cad7332a7e5501e84abeb24653786e567f57046adebcba/index.js +268 -0
- package/vendor/components/sha256/d386f2b94cd9fbed765ad301aa7009228599edb2859efe7f37a98d7aaa44b9bb/README.en.md +35 -0
- package/vendor/components/sha256/d386f2b94cd9fbed765ad301aa7009228599edb2859efe7f37a98d7aaa44b9bb/index.js +179 -0
- package/vendor/components/sha256/e6d219f67d241fdf00a40d4cec261d9dd3c09ad3110d3418d4e843d0f2b8c196/index.js +429 -0
- package/vendor/components/sha256/ef60e6c089f5f6e909f439af8fc0c9c0a2d7a1aafad5e65be6328ba993b990a0/index.js +354 -0
- package/vendor/components/sha256/f6f47601c90f0195353e94b76d57499591d6330a7e35714958a2c41229f70da2/index.js +198 -0
- package/vendor/components/sha256/f9159c87fa998487787f738fdfab52aa2483f52f170fc258840b127f6ed06051/README.en.md +44 -0
- package/vendor/components/sha256/f9159c87fa998487787f738fdfab52aa2483f52f170fc258840b127f6ed06051/index.js +304 -0
- package/vendor/components/sha256/fb482cbe2ca1da07d08f41880e03fe75ff3f1d29842ff40946541e63030219b8/README.en.md +42 -0
- package/vendor/components/sha256/fb482cbe2ca1da07d08f41880e03fe75ff3f1d29842ff40946541e63030219b8/index.js +481 -0
- package/vendor/components/sha256/fdcea28e27638d8bfe234016672375e14de8bb97c32f7b6840d1b7b10ac4b1cd/index.js +233 -0
- package/vendor/components/sha256/ff5eaa083a46db6aefc13d97b27c9487f9fc318805f5c89b05a12e63703b7a72/LICENSE-strokesvg.txt +115 -0
- package/vendor/components/sha256/ff5eaa083a46db6aefc13d97b27c9487f9fc318805f5c89b05a12e63703b7a72/OFL.txt +93 -0
- package/vendor/components/sha256/ff5eaa083a46db6aefc13d97b27c9487f9fc318805f5c89b05a12e63703b7a72/index.js +749 -0
- package/vendor/components/sha256/ff5eaa083a46db6aefc13d97b27c9487f9fc318805f5c89b05a12e63703b7a72/strokes-CHANGES.md +20 -0
- package/vendor/components-2/manifest-2.7.0.json +2118 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// 品質チェックの決まりの台帳(backlog #202、handoff/v0.6.11-check-sketch-2026-11-12.md「#202 の具体案」と d5 との合意 11/12)。Node にもブラウザにも依存しない
|
|
2
|
+
// 1 回の点検の終わりに、決まりの 1 つずつを checked・excused・skipped・failed のどれかにする。どれにもならない決まりが残れば、その回は incomplete。
|
|
3
|
+
// 決まりは 2 種:作者への決まり R-*(AI への指示 docs/authoring-with-llms の名前)と、検査器の族 C-*(Studio の確かめ方。仕様には書かない)
|
|
4
|
+
// RULES [{id, kind: 'authoring'|'checker', phase, codes: [code …], applies?(facts) → null | excused の理由, skips?(facts) → null | skipped の理由}]
|
|
5
|
+
// applies が先(当てはまらなければ excused)。skips はその教材では「まだ測れない」もの(R-geometry の縦書き)
|
|
6
|
+
// phase は kit/check.mjs の検査の段(phase = '…' の名前)。その段を通らなかった決まりは incomplete
|
|
7
|
+
// kit/check-messages.mjs の MESSAGES のどの code も、ちょうど 1 つの決まりに入る(tools/test-check-rules.mjs)
|
|
8
|
+
// EXCUSES excused の理由(その教材にないもの・その教材の性質)
|
|
9
|
+
// SKIPS skipped の理由(その回に見られなかったもの)
|
|
10
|
+
// ruleOfCode(code) → 決まりの id | null
|
|
11
|
+
// ruleSet() → 台帳の版(決まりの id と code の並びの sha256 の先頭 12。where や phase が変わっても変わらない)は呼ぶ側が sha256 で作る:ruleSetText()
|
|
12
|
+
// account({results, visited, facts, inEditor}) → {status, rules, summary, problems}
|
|
13
|
+
// results:[{sev: 'error'|'warn'|'info', code}]。visited:通った段の名前の集合(編集アプリは null:その版の編集アプリが見る決まりはどれも通ったとみなす)
|
|
14
|
+
// facts:{narration, audio, attachments, parts: [タグ…], partMarks, marks, morphs, links, book, tate, allTate, lang}
|
|
15
|
+
// partMarks:図の形の印(data-part="box|edge|label|mark")が原稿にある。allTate:中身のスライド(表紙・章の扉を除く)がみな縦書き
|
|
16
|
+
// inEditor:編集アプリの品質チェック(コマンド版だけの決まりは skipped/notInEditor)
|
|
17
|
+
// factsFromSource({deck, narration, audio, attachments, book}) → facts:原稿と台本の文字列から(コマンド版と編集アプリで同じ判定にする)。
|
|
18
|
+
// audio・attachments・book は呼ぶ側がファイルの有無から(audio/manifest.json か voice.json・attachments/・article.md か article/)
|
|
19
|
+
// excused か skipped の決まりに code が出たら problems(台帳の誤り)。problems があるか、どれにもならない決まりがあれば status は incomplete
|
|
20
|
+
import { cliOnly } from './check-parity.mjs';
|
|
21
|
+
|
|
22
|
+
export const EXCUSES = Object.freeze(['noNarration', 'noAudio', 'noAttachments', 'noParts', 'noMarks', 'noMorphs', 'noLinks', 'noBook', 'tate', 'lang']);
|
|
23
|
+
// tate は EXCUSES にも SKIPS にもある(state で区別する)。SKIPS の tate は「まだ測っていない」:縦書きの字も重なりうるので、
|
|
24
|
+
// excused(当てはまらない)にすると見た範囲を言い過ぎる。skipped なら毎晩の評価が数えて穴が見え続ける(R-geometry、d5 11/12)
|
|
25
|
+
export const SKIPS = Object.freeze(['noBrowser', 'notInEditor', 'tate']);
|
|
26
|
+
|
|
27
|
+
const needs = (fact, reason) => (f) => (f[fact] ? null : reason);
|
|
28
|
+
const ARTICLE = ['articleEncoding', 'articleFrontMatter', 'articleFrontMatterMember', 'articleFrontMatterValue', 'articleKindChapter', 'articleDirective', 'articleBacktickDirective',
|
|
29
|
+
'articleOption', 'articleRole', 'articleHtml', 'articleHtmlTable', 'articleHtmlTableNoSpan', 'articleComment', 'articleBlockBreak', 'articleSubstitution', 'articleStrike', 'articleBareUrl',
|
|
30
|
+
'articleTaskList', 'articleHeadingLevel', 'articleSectionId', 'articleSectionIdForm', 'articleLabel', 'articleCiteKey', 'articleCitePrefix', 'articleCiteNarrativeLocator', 'articleImagePath',
|
|
31
|
+
'articleAsideTitle', 'articleAsideNested', 'articleNested', 'articleAsideClass', 'articleTableClass', 'articleProofKind', 'articleFootnoteContent', 'articleFootnoteMissing',
|
|
32
|
+
'articleFootnoteUnused', 'articleFootnoteName', 'articleFootnoteDuplicate', 'articleRuby', 'articleStepSyntax', 'articleSubfigure', 'articleFigureAlt', 'articleGlossary', 'articleSolutionLabel',
|
|
33
|
+
'articleConverted', 'articleIndex', 'articleConfig', 'articleUnlisted', 'articleRead', 'articleUnsafeParagraph', 'articleTooLarge', 'articleChapterNumber', 'articleChapterTitle',
|
|
34
|
+
'articleChapterIncrease', 'articleChapterOrder', 'articleChapterDiffer', 'articleLang', 'articleBibliography', 'articleLabelDuplicate', 'articleLabelSlideId', 'articleXref', 'articleSolution',
|
|
35
|
+
'articleTerm', 'articleStep', 'articleCite', 'articleReferences', 'articleImage', 'articleDataArticle', 'articleCitations', 'articleCiteStyle', 'articleCiteListChapter', 'articleCiteEngine',
|
|
36
|
+
'articleUncited', 'articleLinksShape', 'articleLinkStale', 'articleLinkUnconfirmed', 'articleLinkUnlinked', 'articleSummary', 'articleSectionUnlinked'];
|
|
37
|
+
const ATTACH = ['attachBadConfig', 'attachBadName', 'attachExcluded', 'attachDuplicate', 'attachBadRole', 'attachBadTitle', 'attachMissing', 'attachNoRole', 'attachNoTitle', 'attachMedia',
|
|
38
|
+
'attachType', 'attachForbidden', 'attachMismatch', 'attachPolyglot', 'attachUnsafe', 'attachUnchecked', 'attachInjection', 'attachPrivate', 'attachBadDescription', 'attachTooLarge',
|
|
39
|
+
'attachTotal', 'attachCount', 'attachList'];
|
|
40
|
+
|
|
41
|
+
export const RULES = Object.freeze([
|
|
42
|
+
// ---- 作者への決まり(R-*)
|
|
43
|
+
{ id: 'R-fit', kind: 'authoring', phase: 'A 体裁', codes: ['bodyBottom', 'bodyRight', 'tateBodyHead', 'bodyConclCol', 'bodyLeft', 'smallText', 'smallSvgText', 'textClipped', 'svgTextOut', 'svgTextBox', 'outsideBody', 'textOffSlide', 'textOverlap', 'cellWordBreak', 'compLayout'] },
|
|
44
|
+
{ id: 'R-title', kind: 'authoring', phase: 'A 体裁', codes: ['titleLong', 'titleLongEn', 'titleColon', 'tateTitle'] },
|
|
45
|
+
{ id: 'R-concl', kind: 'authoring', phase: 'A 体裁', codes: ['conclLong', 'conclLongEn', 'conclOverflow'] },
|
|
46
|
+
{ id: 'R-headings', kind: 'authoring', phase: 'A 体裁', codes: ['secHeading', 'narrHeadingDiffers'] },
|
|
47
|
+
{ id: 'R-style', kind: 'authoring', phase: 'A 体裁', codes: ['desuMasu', 'punctMixed'], applies: (f) => (f.lang === 'ja' ? null : 'lang') },
|
|
48
|
+
{ id: 'R-math', kind: 'authoring', phase: 'A 体裁', codes: ['rawMath', 'katexError'] },
|
|
49
|
+
{ id: 'R-purpose', kind: 'authoring', phase: 'A 体裁', codes: ['cardsHint'] },
|
|
50
|
+
// 描いた図の形(kit/core/geometry-check.mjs、backlog #201):パーツが付けた印(data-part)を測る。パーツも印もない教材は noParts。
|
|
51
|
+
// 中身のスライドがみな縦書きなら skipped/tate(まだ測らない)。縦横が混ざれば横書きのスライドだけを見て geoTateSlides(情報)
|
|
52
|
+
{ id: 'R-geometry', kind: 'authoring', phase: 'A 体裁', codes: ['geoEdgeThroughBox', 'geoLineOverLabel', 'geoLabelOverlap', 'geoLabelOutsideBox', 'geoTateSlides'],
|
|
53
|
+
applies: (f) => ((f.parts || []).length || f.partMarks ? null : 'noParts'), skips: (f) => (f.allTate ? 'tate' : null) },
|
|
54
|
+
{ id: 'R-colors', kind: 'authoring', phase: 'C パレット', codes: ['colorOutside', 'textContrast', 'contrastLow'] },
|
|
55
|
+
{ id: 'R-balance', kind: 'authoring', phase: 'N 釣り合い', codes: ['balance'] },
|
|
56
|
+
// 台本がない教材にも、ステップごとに narrMissing が出る(台本を書くこと自体がこの決まり)。だから外さない。言語と確かめ直しの知らせも台本なしで出る
|
|
57
|
+
{ id: 'R-narr-steps', kind: 'authoring', phase: 'B 台本', codes: ['narrMissing', 'narrOrphan', 'narrNote', 'narrLang', 'narrRecheck'] },
|
|
58
|
+
{ id: 'R-formula', kind: 'authoring', phase: 'B 台本', codes: ['narrFormula'], applies: needs('narration', 'noNarration') },
|
|
59
|
+
{ id: 'R-reading', kind: 'authoring', phase: 'B 台本', codes: ['readingExpr', 'readingSeveral', 'readingGap'], applies: needs('narration', 'noNarration') },
|
|
60
|
+
{ id: 'R-dialogue', kind: 'authoring', phase: 'B 台本', codes: ['turnLong'], applies: needs('narration', 'noNarration') },
|
|
61
|
+
{ id: 'R-marks', kind: 'authoring', phase: 'F 強調', codes: ['markMissing'], applies: needs('marks', 'noMarks') },
|
|
62
|
+
{ id: 'R-steps', kind: 'authoring', phase: 'E タイムライン', codes: ['predictAnswerWithCount', 'predictAnswerNeverShown'], applies: (f) => ((f.parts || []).includes('m-predict') ? null : 'noParts') },
|
|
63
|
+
{ id: 'R-components', kind: 'authoring', phase: 'E タイムライン', codes: ['compReport', 'compData'], applies: (f) => ((f.parts || []).length ? null : 'noParts') },
|
|
64
|
+
// ---- 検査器の族(C-*)
|
|
65
|
+
{ id: 'C-build', kind: 'checker', phase: '読み込み', codes: ['build', 'consoleError', 'extensionVersion', 'component-requires-missing', 'component-not-in-catalogue'] },
|
|
66
|
+
{ id: 'C-ids', kind: 'checker', phase: '読み込み', codes: ['slideId', 'legacyDataKey', 'legacyIndex'] },
|
|
67
|
+
{ id: 'C-vocab', kind: 'checker', phase: '読み込み', codes: ['legacyColorClass', 'legacyStepAttr', 'legacyLectureMode'] },
|
|
68
|
+
{ id: 'C-template', kind: 'checker', phase: 'B 台本', codes: ['templateText', 'narrPlaceholder'] },
|
|
69
|
+
{ id: 'C-font', kind: 'checker', phase: 'A 体裁', codes: ['themeMetricsDrift', 'metricsFontLoad', 'themeMetricsInvalid', 'fontsExtraMissing', 'fontNotCovered', 'fontNotEmbedded'] },
|
|
70
|
+
{ id: 'C-links', kind: 'checker', phase: 'J リンク', codes: ['linkFileMissing', 'linkEmpty', 'linkUnknown', 'linkNumberRange', 'linkNoConcl', 'linkStepRange', 'linkBadStep', 'linkNumber', 'linkNoId', 'linkCount'], applies: needs('links', 'noLinks') },
|
|
71
|
+
{ id: 'C-audio', kind: 'checker', phase: '読み込み', codes: ['audioStale', 'refVoice'], applies: needs('audio', 'noAudio') },
|
|
72
|
+
{ id: 'C-attach', kind: 'checker', phase: '読み込み', codes: ATTACH, applies: needs('attachments', 'noAttachments') },
|
|
73
|
+
{ id: 'C-book', kind: 'checker', phase: 'M 本文', codes: ARTICLE, applies: needs('book', 'noBook') },
|
|
74
|
+
{ id: 'C-a11y', kind: 'checker', phase: 'H 読み上げ', codes: ['imgAlt', 'svgName', 'compName'] },
|
|
75
|
+
{ id: 'C-morph', kind: 'checker', phase: 'G モーフ', codes: ['morphNoSrc', 'morphNoIds', 'morphPairs', 'morphLater', 'morphDupSrc', 'morphDupDst'], applies: needs('morphs', 'noMorphs') },
|
|
76
|
+
{ id: 'C-repro', kind: 'checker', phase: 'D 再現性', codes: ['compOrder', 'compOrderNoise', 'compOrderDetail'], applies: (f) => ((f.parts || []).length ? null : 'noParts') },
|
|
77
|
+
{ id: 'C-listing', kind: 'checker', phase: 'E タイムライン', codes: ['step0', 'palette', 'marks', 'timelineTotal', 'slideLength'] },
|
|
78
|
+
].map((r) => Object.freeze({ ...r, codes: Object.freeze(r.codes) })));
|
|
79
|
+
|
|
80
|
+
const BY_CODE = new Map(RULES.flatMap((r) => r.codes.map((c) => [c, r.id])));
|
|
81
|
+
export const ruleOfCode = (code) => BY_CODE.get(code) || null;
|
|
82
|
+
// 台帳の版の材料(id と code だけ。phase・applies・where は入れない)。呼ぶ側が sha256 の先頭 12 にする
|
|
83
|
+
export const ruleSetText = () => RULES.map((r) => r.id + ':' + r.codes.join(',')).join('\n');
|
|
84
|
+
// 編集アプリが見ない決まり:その code がどれもコマンド版だけ(kit/core/check-parity.mjs の CLI_ONLY)
|
|
85
|
+
export const cliOnlyRule = (r) => r.codes.every((c) => cliOnly(c) !== null);
|
|
86
|
+
|
|
87
|
+
export function factsFromSource({ deck = '', narration = '', audio = false, attachments = false, book = false } = {}) {
|
|
88
|
+
const lang = (deck.match(/<html\b[^>]*\slang=["']([^"']*)["']/i) || [])[1] || '';
|
|
89
|
+
// 中身のスライド(class に slide があり、cover・sec でない <section>)。kit/core/geometry-check.mjs の geometryTate と同じ数え方
|
|
90
|
+
const content = [...deck.matchAll(/<section\b[^>]*\sclass=["']([^"']*)["']/gi)].map((m) => m[1].split(/\s+/))
|
|
91
|
+
.filter((c) => c.includes('slide') && !c.includes('cover') && !c.includes('sec'));
|
|
92
|
+
return {
|
|
93
|
+
narration: /\S/.test(narration), audio: !!audio, attachments: !!attachments, book: !!book,
|
|
94
|
+
parts: [...new Set([...deck.matchAll(/<(m-[a-z][a-z0-9]*(?:-[a-z0-9]+)*)[\s>/]/g)].map((m) => m[1]))].sort(),
|
|
95
|
+
marks: /\{mark:/.test(narration), morphs: /\bdata-morph\b/.test(deck), links: /<a\b[^>]*\shref=/i.test(deck),
|
|
96
|
+
partMarks: /\sdata-part=["']?(?:box|edge|label|mark)\b/.test(deck),
|
|
97
|
+
tate: /\blayout-tate\b/.test(deck), allTate: content.length > 0 && content.every((c) => c.includes('layout-tate')), lang: /^ja\b/i.test(lang) || !lang ? 'ja' : 'en',
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function account({ results, visited = null, facts = {}, inEditor = false }) {
|
|
102
|
+
const by = new Map(RULES.map((r) => [r.id, { error: 0, warning: 0, info: 0, codes: new Set() }]));
|
|
103
|
+
const problems = [];
|
|
104
|
+
for (const x of results) {
|
|
105
|
+
const id = ruleOfCode(x.code);
|
|
106
|
+
if (!id) { problems.push(`${x.code}: not in the rule ledger (kit/core/check-rules.mjs)`); continue; }
|
|
107
|
+
const c = by.get(id);
|
|
108
|
+
c[x.sev === 'error' ? 'error' : x.sev === 'warn' ? 'warning' : 'info']++;
|
|
109
|
+
c.codes.add(x.code);
|
|
110
|
+
}
|
|
111
|
+
const rules = RULES.map((r) => {
|
|
112
|
+
const c = by.get(r.id);
|
|
113
|
+
const counts = { error: c.error, warning: c.warning, info: c.info };
|
|
114
|
+
const codes = r.codes.filter((k) => c.codes.has(k));
|
|
115
|
+
const base = { id: r.id, kind: r.kind };
|
|
116
|
+
let state, reason;
|
|
117
|
+
if (inEditor && cliOnlyRule(r)) { state = 'skipped'; reason = 'notInEditor'; }
|
|
118
|
+
else if (!inEditor && visited && !visited.has(r.phase)) state = null;
|
|
119
|
+
else {
|
|
120
|
+
reason = r.applies ? r.applies(facts) : null;
|
|
121
|
+
if (reason) state = 'excused';
|
|
122
|
+
else if (r.skips && (reason = r.skips(facts))) state = 'skipped';
|
|
123
|
+
else state = counts.error ? 'failed' : 'checked';
|
|
124
|
+
}
|
|
125
|
+
if ((state === 'excused' || state === 'skipped') && codes.length) problems.push(`${r.id}: ${state} (${reason}) but reported ${codes.join(', ')}`);
|
|
126
|
+
return { ...base, state, reason: reason || null, counts, codes };
|
|
127
|
+
});
|
|
128
|
+
const unset = rules.filter((r) => r.state === null).map((r) => r.id);
|
|
129
|
+
const summary = { checked: 0, excused: 0, skipped: 0, failed: 0, total: rules.length };
|
|
130
|
+
for (const r of rules) if (r.state) summary[r.state]++;
|
|
131
|
+
return { status: unset.length || problems.length ? 'incomplete' : 'ok', rules, summary, unset, problems };
|
|
132
|
+
}
|
package/kit/core/colab-core.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import { readZip, ZipError } from './zip-read.mjs';
|
|
|
19
19
|
// 確かめる範囲が変わったら(Kokoro・CPU を通したなど)ここの文を直し、`npm run gen` と docs の <!-- colab-verified --> の行を揃える
|
|
20
20
|
// (tools/test-colab.mjs が、記しのある所が揃っているかを確かめる)。固定した版(tools/make-colab-notebook.mjs の COLAB_PINS)での GPU は 2026-10-24 に確認した。
|
|
21
21
|
export const COLAB_VERIFIED = Object.freeze({
|
|
22
|
-
ja: '確認済み:2026-10-23、CPU(講習で、Irodori)。2026-10-24、T4
|
|
22
|
+
ja: '確認済み:2026-10-23、CPU(講習で、Irodori)。2026-10-24、T4 で固定したバージョン(cuda13 の組):Irodori 23 ステップを 42 秒、Kokoro 59 ステップを 30 秒。2026-10-25、持ち主の手での計測(10 ステップ・話者 1 人。日本語 209 字・英語 518 字):T4 の日本語(Irodori)は読み込み 34 秒・合成 19 秒、T4 の英語(Kokoro)は読み込み 4 秒・合成 4 秒、CPU の英語は読み込み 7 秒・合成 33 秒(1 ステップ約 3 秒で十分使える)、CPU の日本語は読み込み 1 分・1 ステップ約 60 秒(steps=40)。1 ステップだけの手での計測は steps=40 で 90 秒、steps=16 で 52.5 秒(このバージョンより前の、fp16 の重みで参照音声を毎回符号化していたとき)',
|
|
23
23
|
en: "Verified: 2026-10-23, CPU (at a workshop, Irodori). 2026-10-24, T4 with the cuda13 pin set: Irodori 23 steps in 42 s, Kokoro 59 steps in 30 s. 2026-10-25, the owner's hand check (10 steps, one speaker; 209 Japanese / 518 English characters): T4 Japanese (Irodori) load 34 s, synthesis 19 s; T4 English (Kokoro) load 4 s, synthesis 4 s; CPU English load 7 s, synthesis 33 s (about 3 s per step, fine); CPU Japanese load 1 min, about 60 s per step at steps=40; a single step timed by hand took 90 s at steps=40 and 52.5 s at steps=16 (before this version, with fp16 weights and the reference voice encoded on every call).",
|
|
24
24
|
});
|
|
25
25
|
// Colab での手順(音声の板の「クラウドで作る」の C2 と、ノートブックの最初のセルに同じ文を出す。1 か所だけに書く)。
|
|
@@ -45,7 +45,7 @@ export const JOB = Object.freeze({ tag: 'tts-job', recordsTag: 'tts-records', v:
|
|
|
45
45
|
export const COLAB = Object.freeze({
|
|
46
46
|
repo: 'egatari/egatari-studio', notebook: 'colab/egatari-tts.ipynb',
|
|
47
47
|
videoNotebook: 'colab/egatari-video.ipynb', // 動画(MP4)を作るノート(CPU のランタイム。#131)
|
|
48
|
-
ref: 'v0.6.
|
|
48
|
+
ref: 'v0.6.11', // バッジの URL は版のタグに固定する(リリースの手順で替える。RELEASING.md)
|
|
49
49
|
pause: 0.35,
|
|
50
50
|
models: Object.freeze({ irodori: 'irodori-tts-500m-v3', kokoro: 'kokoro-82m-v1.0' }),
|
|
51
51
|
// 後処理の版(records の recipe.processing は PROCESSING に '+colab<ノートブックの版>' を付けたもの):ノートブック(colab/egatari_tts.py)の後処理は audio-core.mjs と同じ数。数を変えたら名前も変える
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
// 描いた図の形の点検(backlog #201、R-geometry。handoff/v0.6.11-check-sketch-2026-11-12.md の 1)。品質チェックのコマンド版(kit/check.mjs)と
|
|
2
|
+
// 編集アプリのプレビュー(app/frame-shim.js)が同じこの関数を使う(体裁の検査 kit/core/layout-scan.mjs と同じ入れ方)
|
|
3
|
+
//
|
|
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 本のこともある
|
|
7
|
+
// 字 <text data-part="label" data-part-id=<持ち主> data-part-of="box|edge|mark">。縁取りがあれば data-part-halo、箱の外に置く字は data-part-at="outside"。
|
|
8
|
+
// foreignObject の字は中身を Range で測る
|
|
9
|
+
// 点 data-part="mark"(m-quad の点。<g transform> の中の <circle cx=0 cy=0> でも getBoundingClientRect で測る)。字の障害物
|
|
10
|
+
// @ で始まる端(@spine・@moved など)は節でない
|
|
11
|
+
//
|
|
12
|
+
// geometryScan(s, o) → [{code, sev, a}] s:最終段階まで出したスライドの <section>。o = {bands, dflt}
|
|
13
|
+
// bands 字体ごとの字の範囲(kit/core/text-band.mjs の TEXT_BANDS。{字体の名前: {up, down}}、em)
|
|
14
|
+
// dflt 表にない字体だけの字の範囲(DEFAULT_BAND)
|
|
15
|
+
// 縦書きのスライド(layout-tate)は測らない([] を返す。数は geometryTate)
|
|
16
|
+
// geometryTate(slides) → n 縦横が混ざる教材で、測らなかった縦書きのスライドのうち印のあるものの数(geoTateSlides)。
|
|
17
|
+
// 中身のスライド(表紙・章の扉を除く)がみな縦書きなら 0(そのときは決まりの台帳が R-geometry を skipped/tate にする。kit/core/check-rules.mjs の factsFromSource の allTate と同じ数え方)
|
|
18
|
+
//
|
|
19
|
+
// 座標はスライドの座標(1280×720。拡大率で割る)。
|
|
20
|
+
// 字の範囲:横は実際の字体での送り幅(SVG の <text> は getExtentOfChar、HTML の字は Range.getClientRects)、縦は基線から上 up・下 down(em。字体ごとの表)。
|
|
21
|
+
// 基線:SVG の <text> は getStartPositionOfChar(その字の基線上の点。tspan の y・dy も含む)を getScreenCTM でスライドの座標に直す。
|
|
22
|
+
// HTML の字(foreignObject の中身)は Range の矩形の上端 + 字体の ascent(canvas の fontBoundingBoxAscent。矩形の高さ = ascent + descent で拡大率をそろえる)
|
|
23
|
+
// 余裕:線の太さの半分 + 2px は重なりとみなさない(端が箱の縁に触れるのは正しい図)。字どうし・字と箱の縁は 2px
|
|
24
|
+
//
|
|
25
|
+
// この関数は文字列にしてページに入れる(check.mjs は page.evaluate、編集アプリは仲立ちの文字列に埋める)。
|
|
26
|
+
// だから外の名前を使わない(中だけで閉じる)。閉じるタグと HTML の注釈の始まりを書かない(tools/build-app.mjs が確かめる)
|
|
27
|
+
|
|
28
|
+
export function geometryScan(s, o) {
|
|
29
|
+
const out = [];
|
|
30
|
+
if (!s || s.classList.contains('layout-tate')) return out;
|
|
31
|
+
const BANDS = (o && o.bands) || {}, DFLT = (o && o.dflt) || { up: 0.86, down: 0.26 };
|
|
32
|
+
const SEL = (v) => '[data-part="' + v + '"]';
|
|
33
|
+
if (!s.querySelector([SEL('box'), SEL('edge'), SEL('label'), SEL('mark')].join(','))) return out;
|
|
34
|
+
const sr = s.getBoundingClientRect();
|
|
35
|
+
const k = sr.width / 1280 || 1;
|
|
36
|
+
const SX = (x) => (x - sr.left) / k, SY = (y) => (y - sr.top) / k;
|
|
37
|
+
const box = (r) => ({ l: SX(r.left), t: SY(r.top), r: SX(r.right), b: SY(r.bottom) });
|
|
38
|
+
const rnd = (v) => Math.round(v);
|
|
39
|
+
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
|
+
const TOL = 2;
|
|
42
|
+
|
|
43
|
+
// 字体の並び → 字の範囲(kit/core/text-band.mjs の textBand と同じ決め方:並びの中で表にある字体の最も広いもの、なければ dflt)
|
|
44
|
+
const bandOf = (ff) => {
|
|
45
|
+
const known = String(ff || '').split(',').map((x) => x.trim().replace(/^["']|["']$/g, '')).map((n) => BANDS[n]).filter(Boolean);
|
|
46
|
+
if (!known.length) return DFLT;
|
|
47
|
+
return { up: Math.max.apply(null, known.map((b) => b.up)), down: Math.max.apply(null, known.map((b) => b.down)) };
|
|
48
|
+
};
|
|
49
|
+
// 見えているか(最終段階で隠れたままの要素・透明な要素は測らない)
|
|
50
|
+
const shown = (el) => {
|
|
51
|
+
if (getComputedStyle(el).visibility !== 'visible') return false;
|
|
52
|
+
for (let e = el; e && e !== s; e = e.parentElement) {
|
|
53
|
+
const st = getComputedStyle(e);
|
|
54
|
+
if (st.display === 'none' || parseFloat(st.opacity) === 0) return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
};
|
|
58
|
+
// 比べる範囲:同じ図の中だけ(いちばん近いパーツの要素、なければいちばん外の <svg>、なければスライド)
|
|
59
|
+
const rootOf = (el) => {
|
|
60
|
+
let svg = null;
|
|
61
|
+
for (let e = el; e && e !== s; e = e.parentElement) {
|
|
62
|
+
if (e.localName.indexOf('-') > 0) return e;
|
|
63
|
+
if (e.localName === 'svg') svg = e;
|
|
64
|
+
}
|
|
65
|
+
return svg || s;
|
|
66
|
+
};
|
|
67
|
+
// 要素の座標(ユーザー座標)→ スライドの座標
|
|
68
|
+
const mapper = (el) => {
|
|
69
|
+
const m = el.getScreenCTM && el.getScreenCTM();
|
|
70
|
+
if (!m) return null;
|
|
71
|
+
return { m, sc: Math.sqrt(Math.abs(m.a * m.d - m.b * m.c)) / k, pt: (x, y) => ({ x: SX(m.a * x + m.c * y + m.e), y: SY(m.b * x + m.d * y + m.f) }) };
|
|
72
|
+
};
|
|
73
|
+
const strokeOf = (el, M) => { const w = parseFloat(getComputedStyle(el).strokeWidth); return (isFinite(w) ? w : 1) * (M ? M.sc : 1); };
|
|
74
|
+
const textOf = (el) => (el.textContent || '').replace(/\s+/g, ' ').trim().slice(0, 40);
|
|
75
|
+
|
|
76
|
+
// ---------------------------------------------------------------- 箱
|
|
77
|
+
const boxes = [];
|
|
78
|
+
for (const el of s.querySelectorAll(SEL('box'))) {
|
|
79
|
+
if (!shown(el)) continue;
|
|
80
|
+
const q = box(el.getBoundingClientRect());
|
|
81
|
+
if (q.r - q.l <= 0 || q.b - q.t <= 0) continue;
|
|
82
|
+
const M = mapper(el);
|
|
83
|
+
let inv = null;
|
|
84
|
+
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) });
|
|
86
|
+
}
|
|
87
|
+
// 点(スライドの座標)が箱の内側に tol より深く入っているか:点とそのまわり 8 方向の tol の点がみな箱の形の中
|
|
88
|
+
// (形は isPointInFill。ひし形の <polygon>・楕円・角の丸い <rect> も形どおり。形を測れない要素は外接矩形)
|
|
89
|
+
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]];
|
|
90
|
+
const deepIn = (b, x, y, tol) => {
|
|
91
|
+
if (x <= b.q.l + tol || x >= b.q.r - tol || y <= b.q.t + tol || y >= b.q.b - tol) return false;
|
|
92
|
+
if (!b.inv) return true;
|
|
93
|
+
const inFill = (px, py) => {
|
|
94
|
+
const cx = sr.left + px * k, cy = sr.top + py * k, m = b.inv;
|
|
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;
|
|
99
|
+
return true;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// ---------------------------------------------------------------- 辺(線ごとの折れ線、スライドの座標)
|
|
103
|
+
const LINE = 'line,path,polyline,polygon';
|
|
104
|
+
const edges = [];
|
|
105
|
+
for (const g of s.querySelectorAll(SEL('edge'))) {
|
|
106
|
+
if (!shown(g)) continue;
|
|
107
|
+
const id = g.getAttribute('data-part-id') || '', from = g.getAttribute('data-part-from') || '', to = g.getAttribute('data-part-to') || '';
|
|
108
|
+
const els = g.matches(LINE) && g.hasAttribute('data-part-line') ? [g] : [...g.querySelectorAll('[data-part-line]')].filter((x) => x.matches(LINE));
|
|
109
|
+
const lines = [];
|
|
110
|
+
for (const el of els) {
|
|
111
|
+
if (!shown(el)) continue;
|
|
112
|
+
const M = mapper(el);
|
|
113
|
+
if (!M) continue;
|
|
114
|
+
let pts = [];
|
|
115
|
+
if (el.localName === 'line') {
|
|
116
|
+
pts = [M.pt(el.x1.baseVal.value, el.y1.baseVal.value), M.pt(el.x2.baseVal.value, el.y2.baseVal.value)];
|
|
117
|
+
} else {
|
|
118
|
+
// path などは getTotalLength・getPointAtLength で折れ線に近似(スライドの座標で 4px ごと、多くても 2000 点)
|
|
119
|
+
let len = 0;
|
|
120
|
+
try { len = el.getTotalLength(); } catch (e) { len = 0; }
|
|
121
|
+
if (!(len > 0)) continue;
|
|
122
|
+
const n = Math.min(2000, Math.max(2, Math.ceil(len * M.sc / 4)));
|
|
123
|
+
for (let i = 0; i <= n; i++) { const p = el.getPointAtLength(len * i / n); pts.push(M.pt(p.x, p.y)); }
|
|
124
|
+
}
|
|
125
|
+
lines.push({ el, pts, tol: strokeOf(el, M) / 2 + TOL });
|
|
126
|
+
}
|
|
127
|
+
if (lines.length) edges.push({ el: g, id, from, to, root: rootOf(g), lines });
|
|
128
|
+
}
|
|
129
|
+
// 折れ線を 2px ごとの点に細かくする(箱の通過を見る)
|
|
130
|
+
const dense = (pts) => {
|
|
131
|
+
const outp = [pts[0]];
|
|
132
|
+
for (let i = 1; i < pts.length; i++) {
|
|
133
|
+
const a = pts[i - 1], b = pts[i], n = Math.max(1, Math.ceil(Math.hypot(b.x - a.x, b.y - a.y) / 2));
|
|
134
|
+
for (let j = 1; j <= n; j++) outp.push({ x: a.x + (b.x - a.x) * j / n, y: a.y + (b.y - a.y) * j / n });
|
|
135
|
+
}
|
|
136
|
+
return outp;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// ---------------------------------------------------------------- 字の範囲(行ごとの矩形、スライドの座標)
|
|
140
|
+
let cv = null;
|
|
141
|
+
const ascentOf = (st) => {
|
|
142
|
+
if (!cv) cv = document.createElement('canvas').getContext('2d', { willReadFrequently: true });
|
|
143
|
+
cv.font = st.fontStyle + ' ' + st.fontWeight + ' ' + st.fontSize + ' ' + st.fontFamily;
|
|
144
|
+
const m = cv.measureText('Hg');
|
|
145
|
+
return { asc: m.fontBoundingBoxAscent, desc: m.fontBoundingBoxDescent };
|
|
146
|
+
};
|
|
147
|
+
const svgTextRects = (el) => {
|
|
148
|
+
const M = mapper(el);
|
|
149
|
+
let n = 0;
|
|
150
|
+
try { n = el.getNumberOfChars(); } catch (e) { n = 0; }
|
|
151
|
+
if (!M || !n) return [];
|
|
152
|
+
const st = getComputedStyle(el), bd = bandOf(st.fontFamily);
|
|
153
|
+
let fs = parseFloat(st.fontSize) || 0;
|
|
154
|
+
for (const t of el.querySelectorAll('tspan')) fs = Math.max(fs, parseFloat(getComputedStyle(t).fontSize) || 0);
|
|
155
|
+
// 字の番号は空白をまとめた後の字(既定の白空白の扱い)。数が合えば空白の字を除く
|
|
156
|
+
const norm = (el.textContent || '').replace(/[\n\t]/g, ' ').replace(/ {2,}/g, ' ').trim();
|
|
157
|
+
const chars = norm.length === n ? norm : null;
|
|
158
|
+
const lines = [];
|
|
159
|
+
let cur = null;
|
|
160
|
+
for (let i = 0; i < n; i++) {
|
|
161
|
+
if (chars && /\s/.test(chars[i])) continue;
|
|
162
|
+
let p, x;
|
|
163
|
+
try { p = el.getStartPositionOfChar(i); x = el.getExtentOfChar(i); } catch (e) { continue; }
|
|
164
|
+
if (!x.width) continue;
|
|
165
|
+
// 同じ基線で続く字は 1 行。基線が変わるか、1 字より大きく離れたら次の行
|
|
166
|
+
if (cur && Math.abs(p.y - cur.y) < 0.5 && x.x <= cur.r + fs && x.x + x.width >= cur.l - fs) { cur.l = Math.min(cur.l, x.x); cur.r = Math.max(cur.r, x.x + x.width); }
|
|
167
|
+
else { cur = { y: p.y, l: x.x, r: x.x + x.width }; lines.push(cur); }
|
|
168
|
+
}
|
|
169
|
+
return lines.map((ln) => {
|
|
170
|
+
const ps = [M.pt(ln.l, ln.y - bd.up * fs), M.pt(ln.r, ln.y - bd.up * fs), M.pt(ln.l, ln.y + bd.down * fs), M.pt(ln.r, ln.y + bd.down * fs)];
|
|
171
|
+
return { l: Math.min.apply(null, ps.map((q) => q.x)), r: Math.max.apply(null, ps.map((q) => q.x)), t: Math.min.apply(null, ps.map((q) => q.y)), b: Math.max.apply(null, ps.map((q) => q.y)) };
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
const htmlTextRects = (el) => {
|
|
175
|
+
const rs = [], tw = document.createTreeWalker(el, NodeFilter.SHOW_TEXT), rg = document.createRange();
|
|
176
|
+
let nd;
|
|
177
|
+
while ((nd = tw.nextNode())) {
|
|
178
|
+
if (!/\S/.test(nd.textContent) || !shown(nd.parentElement)) continue;
|
|
179
|
+
const st = getComputedStyle(nd.parentElement), bd = bandOf(st.fontFamily), fm = ascentOf(st), fs = parseFloat(st.fontSize) || 0;
|
|
180
|
+
rg.selectNodeContents(nd);
|
|
181
|
+
for (const r of rg.getClientRects()) {
|
|
182
|
+
if (r.width < 0.5 || r.height < 0.5) continue;
|
|
183
|
+
const sc = fm.asc + fm.desc > 0 ? r.height / (fm.asc + fm.desc) : k;
|
|
184
|
+
const base = r.top + fm.asc * sc;
|
|
185
|
+
rs.push({ l: SX(r.left), r: SX(r.right), t: SY(base - bd.up * fs * sc), b: SY(base + bd.down * fs * sc) });
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return rs;
|
|
189
|
+
};
|
|
190
|
+
const textRects = (el) => {
|
|
191
|
+
if (el.localName === 'text' && typeof el.getNumberOfChars === 'function') return svgTextRects(el);
|
|
192
|
+
if (el.namespaceURI === 'http://www.w3.org/2000/svg' && el.localName !== 'foreignObject') {
|
|
193
|
+
const ts = [...el.querySelectorAll('text')];
|
|
194
|
+
if (ts.length) return ts.reduce((a, t) => a.concat(shown(t) ? svgTextRects(t) : []), []);
|
|
195
|
+
}
|
|
196
|
+
return htmlTextRects(el);
|
|
197
|
+
};
|
|
198
|
+
const labels = [];
|
|
199
|
+
for (const el of s.querySelectorAll(SEL('label'))) {
|
|
200
|
+
if (!shown(el)) continue;
|
|
201
|
+
const rs = textRects(el);
|
|
202
|
+
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 });
|
|
204
|
+
}
|
|
205
|
+
const marks = [];
|
|
206
|
+
for (const el of s.querySelectorAll(SEL('mark'))) {
|
|
207
|
+
if (!shown(el)) continue;
|
|
208
|
+
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 });
|
|
210
|
+
}
|
|
211
|
+
const meet = (a, b, tol) => {
|
|
212
|
+
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) };
|
|
213
|
+
return q.r - q.l > tol && q.b - q.t > tol ? q : null;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// ---------------------------------------------------------------- 1. 辺が元でも先でもない箱の内側を通る(geoEdgeThroughBox)
|
|
217
|
+
for (const E of edges) {
|
|
218
|
+
for (const B of boxes) {
|
|
219
|
+
if (B.root !== E.root || B.id === E.from || B.id === E.to) continue;
|
|
220
|
+
let seg = null;
|
|
221
|
+
for (const L of E.lines) {
|
|
222
|
+
let first = null, last = null;
|
|
223
|
+
for (const p of dense(L.pts)) {
|
|
224
|
+
if (deepIn(B, p.x, p.y, L.tol)) { if (!first) first = p; last = p; }
|
|
225
|
+
else if (first) break;
|
|
226
|
+
}
|
|
227
|
+
if (first) { seg = [rnd(first.x), rnd(first.y), rnd(last.x), rnd(last.y)]; break; }
|
|
228
|
+
}
|
|
229
|
+
if (seg) add('warn', 'geoEdgeThroughBox', { edge: E.id, from: E.from, to: E.to, box: B.id, seg });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ---------------------------------------------------------------- 2. 線が字の範囲を横切る(geoLineOverLabel)。自分の辺の字は除く。縁取り(halo)のある字は情報
|
|
234
|
+
// 線分と矩形の交わり(Liang–Barsky):交わる区間の中点か null
|
|
235
|
+
const clip = (a, b, q) => {
|
|
236
|
+
let t0 = 0, t1 = 1;
|
|
237
|
+
const dx = b.x - a.x, dy = b.y - a.y;
|
|
238
|
+
const P = [-dx, dx, -dy, dy], Q = [a.x - q.l, q.r - a.x, a.y - q.t, q.b - a.y];
|
|
239
|
+
for (let i = 0; i < 4; i++) {
|
|
240
|
+
if (P[i] === 0) { if (Q[i] < 0) return null; continue; }
|
|
241
|
+
const r = Q[i] / P[i];
|
|
242
|
+
if (P[i] < 0) { if (r > t1) return null; if (r > t0) t0 = r; } else { if (r < t0) return null; if (r < t1) t1 = r; }
|
|
243
|
+
}
|
|
244
|
+
const tm = (t0 + t1) / 2;
|
|
245
|
+
return { x: a.x + dx * tm, y: a.y + dy * tm };
|
|
246
|
+
};
|
|
247
|
+
for (const E of edges) {
|
|
248
|
+
for (const Lb of labels) {
|
|
249
|
+
if (Lb.root !== E.root || (Lb.of === 'edge' && Lb.id === E.id) || E.el.contains(Lb.el)) continue;
|
|
250
|
+
let at = null;
|
|
251
|
+
for (const L of E.lines) {
|
|
252
|
+
for (const r of Lb.rs) {
|
|
253
|
+
const q = { l: r.l + L.tol, t: r.t + L.tol, r: r.r - L.tol, b: r.b - L.tol };
|
|
254
|
+
if (q.r <= q.l || q.b <= q.t) continue;
|
|
255
|
+
for (let i = 1; i < L.pts.length && !at; i++) at = clip(L.pts[i - 1], L.pts[i], q);
|
|
256
|
+
if (at) break;
|
|
257
|
+
}
|
|
258
|
+
if (at) break;
|
|
259
|
+
}
|
|
260
|
+
if (at) add(Lb.halo ? 'info' : 'warn', 'geoLineOverLabel', { edge: E.id, from: E.from, to: E.to, label: Lb.id, of: Lb.of, t: Lb.t, at: [rnd(at.x), rnd(at.y)], halo: Lb.halo });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// ---------------------------------------------------------------- 3. 字の範囲どうし・字と持ち主でない点が重なる(geoLabelOverlap)
|
|
265
|
+
for (let i = 0; i < labels.length; i++) {
|
|
266
|
+
const A = labels[i];
|
|
267
|
+
for (let j = i + 1; j < labels.length; j++) {
|
|
268
|
+
const B = labels[j];
|
|
269
|
+
if (A.root !== B.root || A.el.contains(B.el) || B.el.contains(A.el)) continue;
|
|
270
|
+
let q = null;
|
|
271
|
+
for (const r of A.rs) { for (const u of B.rs) if ((q = meet(r, u, TOL))) break; if (q) break; }
|
|
272
|
+
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
|
+
}
|
|
274
|
+
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;
|
|
276
|
+
let q = null;
|
|
277
|
+
for (const r of A.rs) if ((q = meet(r, Mk.q, TOL))) break;
|
|
278
|
+
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) });
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// ---------------------------------------------------------------- 4. 箱の中の字が箱の縁を越える(geoLabelOutsideBox)。data-part-at="outside" の字は見ない
|
|
283
|
+
for (const Lb of labels) {
|
|
284
|
+
if (Lb.of !== 'box' || Lb.outside) continue;
|
|
285
|
+
const B = boxes.find((b) => b.id === Lb.id && b.root === Lb.root);
|
|
286
|
+
if (!B) continue;
|
|
287
|
+
const l = Math.min.apply(null, Lb.rs.map((r) => r.l)), r = Math.max.apply(null, Lb.rs.map((x) => x.r));
|
|
288
|
+
const t = Math.min.apply(null, Lb.rs.map((x) => x.t)), b = Math.max.apply(null, Lb.rs.map((x) => x.b));
|
|
289
|
+
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
|
+
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
|
+
}
|
|
292
|
+
return out;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// 縦横が混ざる教材で、形の点検から外した縦書きのスライド(印のあるもの)の数。中身のスライドがみな縦書きなら 0。geometryScan と同じく文字列でページに入れる
|
|
296
|
+
export function geometryTate(slides) {
|
|
297
|
+
const content = [].filter.call(slides || [], (s) => !s.classList.contains('cover') && !s.classList.contains('sec'));
|
|
298
|
+
const tate = content.filter((s) => s.classList.contains('layout-tate'));
|
|
299
|
+
if (!tate.length || tate.length === content.length) return 0;
|
|
300
|
+
const sel = ['box', 'edge', 'label', 'mark'].map((v) => '[data-part="' + v + '"]').join(',');
|
|
301
|
+
return tate.filter((s) => !!s.querySelector(sel)).length;
|
|
302
|
+
}
|
package/kit/core/layout-scan.mjs
CHANGED
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
// だから外の名前を使わない(中だけで閉じる)。仲立ちはデッキの script の要素の中にそのまま入るので、閉じるタグと HTML の注釈の始まりを書かない(tools/build-app.mjs が確かめる)
|
|
24
24
|
|
|
25
25
|
import { findRawMath } from './raw-math.mjs';
|
|
26
|
+
import { geometryScan, geometryTate } from './geometry-check.mjs';
|
|
27
|
+
import { TEXT_BANDS, DEFAULT_BAND } from './text-band.mjs';
|
|
26
28
|
|
|
27
29
|
// わざと切る印(CLIP_ATTR。docs/contract.md §10):その要素の中(子孫も、SVG の字も)は、箱で切れる・スライドの外に出る・
|
|
28
30
|
// 図の箱からはみ出す、の 4 つ(textClipped・svgTextOut・svgTextBox・outsideBody)を見ない。縦横どちらにも効く。前からの検査(bodyBottom など)には効かない
|
|
@@ -278,7 +280,9 @@ export function layoutScan(s, o) {
|
|
|
278
280
|
if (hit) { done.add(p); note('outsideBody', { t: p.t, why: hit === c ? 'concl' : hit.classList.contains('pn') ? 'pn' : 'title' }); continue; }
|
|
279
281
|
}
|
|
280
282
|
// 4. SVG の字が、それを囲む箱(同じ親の <rect> で、字の中心を含むもののうち一番小さいもの)からはみ出す
|
|
281
|
-
|
|
283
|
+
// パーツが箱の字の印(data-part="label" data-part-of="box")を付けた字は、描いた図の形の点検(kit/core/geometry-check.mjs の geoLabelOutsideBox)が見る。
|
|
284
|
+
// ただし図の形の点検が測らない縦書きのスライドでは、ここで見る(d5 11/12:形の点検が見ない所で欠陥を消さない)
|
|
285
|
+
if (p.svg && (tate || !p.el.closest('[data-part="label"][data-part-of="box"]'))) {
|
|
282
286
|
const cx = (p.b.l + p.b.r) / 2, cy = (p.b.t + p.b.b) / 2;
|
|
283
287
|
let best = null, area = Infinity;
|
|
284
288
|
for (const r of p.el.parentElement.children) {
|
|
@@ -397,6 +401,8 @@ export function layoutScan(s, o) {
|
|
|
397
401
|
for (let i = 0; i < G.length; i++) for (let j = i + 1; j < G.length; j++) {
|
|
398
402
|
const A = G[i], B = G[j];
|
|
399
403
|
if (!!A.svg !== !!B.svg) continue;
|
|
404
|
+
// パーツが字の印(data-part="label")を付けた SVG の字どうしは、描いた図の形の点検(kit/core/geometry-check.mjs の geoLabelOverlap)が見る(縦書きのスライドは測らないので、ここで見る)
|
|
405
|
+
if (!tate && A.svg && A.el.closest('[data-part="label"]') && B.el.closest('[data-part="label"]')) continue;
|
|
400
406
|
if (A.el.contains(B.el) || B.el.contains(A.el)) continue;
|
|
401
407
|
if (bodyErr && A.inBody !== B.inBody) continue;
|
|
402
408
|
if (!A.svg && A.comp && A.comp === B.comp) continue;
|
|
@@ -654,8 +660,9 @@ export async function metricsFonts(doc, timeoutMs) {
|
|
|
654
660
|
|
|
655
661
|
// 編集アプリの仲立ち(app/frame-shim.js の文字列。「(function frameShim(cfg){…})」)に、この関数・寸法の比べ方(metricsProbe・metricsFonts)・残った数式の検出(findRawMath)と印の名前を渡す形にする。
|
|
656
662
|
// 戻り値も「(…)(cfg)」で呼べる 1 つの式(仲立ちの中では layoutScan・metricsProbe・metricsFonts・findRawMath・LAYOUT_CLIP・LAYOUT_ANNOT・LAYOUT_OVERLAP という名前で使える)
|
|
663
|
+
// 描いた図の形の点検(kit/core/geometry-check.mjs の geometryScan・geometryTate)と字の範囲の表(GEO_OPTS = {bands: TEXT_BANDS, dflt: DEFAULT_BAND})も同じ名前で渡す
|
|
657
664
|
export function withLayoutScan(shimSrc) {
|
|
658
665
|
// 仲立ちの文字列は注釈の行から始まるので、return の後ろで改行して括弧で囲む(return の直後の改行で式が切れないように)
|
|
659
666
|
// findRawMath(kit/core/raw-math.mjs):組まれずに残った数式(rawMath)。コマンド版(kit/check.mjs)と同じ関数を仲立ちにも渡す
|
|
660
|
-
return `(function(layoutScan, LAYOUT_CLIP, LAYOUT_ANNOT, LAYOUT_OVERLAP, metricsProbe, metricsFonts, findRawMath){return (\n${String(shimSrc).trim()}\n);})(${layoutScan}, ${JSON.stringify(CLIP_ATTR)}, ${JSON.stringify(ANNOT_ATTR)}, ${JSON.stringify(OVERLAP_ATTR)}, ${metricsProbe}, ${metricsFonts}, ${findRawMath})`;
|
|
667
|
+
return `(function(layoutScan, LAYOUT_CLIP, LAYOUT_ANNOT, LAYOUT_OVERLAP, metricsProbe, metricsFonts, findRawMath, geometryScan, geometryTate, GEO_OPTS){return (\n${String(shimSrc).trim()}\n);})(${layoutScan}, ${JSON.stringify(CLIP_ATTR)}, ${JSON.stringify(ANNOT_ATTR)}, ${JSON.stringify(OVERLAP_ATTR)}, ${metricsProbe}, ${metricsFonts}, ${findRawMath}, ${geometryScan}, ${geometryTate}, ${JSON.stringify({ bands: TEXT_BANDS, dflt: DEFAULT_BAND })})`;
|
|
661
668
|
}
|
|
@@ -81,7 +81,7 @@ export function skippedNotice(s, lang) {
|
|
|
81
81
|
const list = shown.join(lang === 'en' ? ', ' : '・') + (more > 0 ? (lang === 'en' ? `, and ${more} more` : `・ほか ${more} 件`) : '');
|
|
82
82
|
return lang === 'en'
|
|
83
83
|
? `Items this Studio version doesn't know (${list}) were not imported. The file itself is kept as it is.`
|
|
84
|
-
:
|
|
84
|
+
: `このバージョンの Studio が知らない項目(${list})は取り込みませんでした。ファイルそのものはそのまま残します`;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
function checkActivity(a, at, e) {
|
package/kit/core/llm-fix.mjs
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { sectionsOf, narrSections } from './llm-import.mjs';
|
|
15
15
|
import { cleanErrorText } from './error-text.mjs';
|
|
16
16
|
import { quoteJa } from './quote-ja.mjs';
|
|
17
|
+
import { plural } from './plural.mjs';
|
|
17
18
|
import { commonBody, componentsIn, componentNotes } from './llm-pack.mjs';
|
|
18
19
|
import { DEFAULT_METRICS, limitsOf } from './theme-metrics.mjs';
|
|
19
20
|
|
|
@@ -34,7 +35,7 @@ export function guideRules(guide) {
|
|
|
34
35
|
const BY_CODE = {
|
|
35
36
|
titleLong: ['R-title'], titleLongEn: ['R-title'], conclLong: ['R-concl'], conclLongEn: ['R-concl'], conclOverflow: ['R-concl', 'R-fit'],
|
|
36
37
|
overflowBottom: ['R-fit'], overflowRight: ['R-fit'], smallText: ['R-fit'], katexError: ['R-math'],
|
|
37
|
-
noNarration: ['R-narr-steps'], orphanNarration: ['R-narr-steps'], readingExpr: ['R-reading', 'R-formula'], readingSeveral: ['R-reading'],
|
|
38
|
+
noNarration: ['R-narr-steps'], orphanNarration: ['R-narr-steps'], readingExpr: ['R-reading', 'R-formula'], readingSeveral: ['R-reading'], readingGap: ['R-reading'],
|
|
38
39
|
compData: ['R-components'], consoleError: ['R-components'],
|
|
39
40
|
contrast: ['R-colors'], formula: ['R-formula'], missingSection: ['R-headings'], narrHeadingDiffers: ['R-headings'], markTarget: ['R-marks'],
|
|
40
41
|
// 体裁の検査(kit/core/layout-scan.mjs)がブラウザ版にも出すコマンド版の code
|
|
@@ -64,7 +65,7 @@ const L = {
|
|
|
64
65
|
en: {
|
|
65
66
|
head: 'Fix request for an Egatari lesson (deck.html + narration.md). The instructions you followed are the Egatari authoring guide; the standards are quoted below.',
|
|
66
67
|
ask: 'Fix only the findings listed. Keep everything else as it is, and keep every id="…" and {#…} exactly (R-noids). Do not use Canvas, slide-making or file features: reply in the body of your chat message with exactly two fenced code blocks, ```deck.html and ```narration.md (R-output).',
|
|
67
|
-
askPartial: (n) => `The lesson is long, so only the ${n} slide
|
|
68
|
+
askPartial: (n) => `The lesson is long, so only the ${n} ${plural(n, 'slide')} with problems ${n === 1 ? 'is' : 'are'} included below. Reply with the same two blocks, but put only those <section> elements in the deck.html block (no <html>, keep their ids) and only their sections in the narration.md block (keep the {#id} headings) (R-output).`,
|
|
68
69
|
problems: 'Findings', rules: 'Standards', components: 'Parts used in this lesson (from the instructions)', files: 'Current files', partialFiles: 'Current slides with problems',
|
|
69
70
|
where: (p) => (p.i === null || p.i === undefined ? 'Whole lesson' : `Slide ${p.i + 1}${p.id ? ` (id ${p.id})` : ''}${p.title ? ` “${p.title}”` : ''}`),
|
|
70
71
|
sev: { error: 'error', warn: 'warning' },
|
package/kit/core/llm-outline.mjs
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
// nextBatch({rows, next}) → {from, to, size} | null(1 から数える。終わっていれば null)。remaining({rows, next}) → 残りの枚数
|
|
17
17
|
// batchRequest({rows, from, to, deck, narration, first, lang}) → 文字列
|
|
18
18
|
import { slideChunks } from './slide-ops.mjs';
|
|
19
|
+
import { plural } from './plural.mjs';
|
|
19
20
|
import { narrSections } from './llm-import.mjs';
|
|
20
21
|
import { parseHeading } from './narration-core.mjs';
|
|
21
22
|
import { updateConfig, merge } from './config-file.mjs';
|
|
@@ -54,8 +55,8 @@ const L = {
|
|
|
54
55
|
'In one ```outline block, write a Markdown table with the columns “#”, “Heading” and “Point (one line)”, one row per slide, every slide in order. Outside the block, at most a one-line note.',
|
|
55
56
|
tableHead: '| # | Heading | Point |',
|
|
56
57
|
batchHead: (a, b) => `# Please make slides ${a}–${b} of the outline`,
|
|
57
|
-
batchFirst: (a, b, n) => `Make slides ${a}–${b} of the outline (${n} slides in all), exactly ${b - a + 1}
|
|
58
|
-
batchNext: (a, b, n, x) => `Make slides ${a}–${b} of the outline (${n} slides in all), exactly ${b - a + 1}
|
|
58
|
+
batchFirst: (a, b, n) => `Make slides ${a}–${b} of the outline (${n} slides in all), exactly ${b - a + 1} ${plural(b - a + 1, 'slide')}. The standards (R-…) and the output format (R-output) are those of the instructions for the AI; write the whole deck.html from <!DOCTYPE html>. The other slides are requested later.`,
|
|
59
|
+
batchNext: (a, b, n, x) => `Make slides ${a}–${b} of the outline (${n} slides in all), exactly ${b - a + 1} ${plural(b - a + 1, 'slide')}. They go ${x} of the current lesson. The standards and the output format are those of the instructions for the AI used to make it.`,
|
|
59
60
|
where: (x) => `after slide ${x.n}, “${x.h}”,`,
|
|
60
61
|
outlineList: '## The outline (all of it; do not send it back)', range: (a, b) => `← this time: ${a}–${b}`,
|
|
61
62
|
near: '## The slide before the new ones (for reference; do not send it back)',
|