egatari 0.6.7 → 0.6.8-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 +2 -2
- package/README.md +2 -2
- package/bin/egatari.mjs +2 -1
- package/components.lock.json +6 -3
- package/components2.lock.json +119 -1
- package/kit/check-messages.mjs +9 -0
- package/kit/check.mjs +12 -2
- package/kit/core/colab-core.mjs +1 -1
- package/kit/core/color-vocab.mjs +172 -0
- package/kit/core/layout-scan.mjs +23 -0
- package/kit/core/llm-fix.mjs +2 -2
- package/kit/core/llm-pack-data.mjs +9 -9
- package/kit/deck.js +18 -1
- package/kit/instruction-version.json +1 -1
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/package.json +3 -1
- package/themes/asagi/theme.json +1 -1
- package/themes/asagi/tokens.css +1 -0
- package/themes/business/theme.json +1 -1
- package/themes/business/tokens.css +1 -0
- package/themes/default/README.ja.md +12 -1
- package/themes/default/README.md +12 -1
- package/themes/default/theme.json +1 -1
- package/themes/default/tokens.css +1 -0
- package/themes/kogecha/theme.json +1 -1
- package/themes/kogecha/tokens.css +1 -0
- package/themes/kokugo/theme.json +2 -1
- package/themes/kokugo/tokens.css +1 -0
- package/themes/murasaki/theme.json +1 -1
- package/themes/murasaki/tokens.css +1 -0
- package/themes/sumi/theme.json +1 -1
- package/themes/sumi/tokens.css +1 -0
- package/themes/tokiwa/theme.json +1 -1
- package/themes/tokiwa/tokens.css +1 -0
- package/themes.lock.json +92 -24
- package/tools/ids-of.mjs +69 -0
- package/vendor/components/CATALOG.md +2 -2
- package/vendor/components/sha256/2e9a35ce9e289196d0b5fd24b8546cf6e0f4a6df857e69f4f78e686cabb00e61/index.js +465 -0
- package/vendor/components/sha256/340f7678bb19a64f9d4ed63b95d290046367a6b49c44977184f1cec1e97a7d68/index.js +916 -0
- package/vendor/components-2/manifest-2.5.1.json +1919 -0
- package/vendor/egatari-spec/SOURCE.json +2 -2
- package/vendor/themes/asagi/1.0.0/theme.json +14 -0
- package/vendor/themes/asagi/1.0.0/tokens.css +17 -0
- package/vendor/themes/business/1.0.1/theme.json +5 -0
- package/vendor/themes/business/1.0.1/tokens.css +28 -0
- package/vendor/themes/default/1.2.0/theme.json +4 -0
- package/vendor/themes/default/1.2.0/tokens.css +73 -0
- package/vendor/themes/kogecha/1.0.0/theme.json +10 -0
- package/vendor/themes/kogecha/1.0.0/tokens.css +16 -0
- package/vendor/themes/kokugo/1.0.0/theme.json +4 -0
- package/vendor/themes/kokugo/1.0.0/tokens.css +12 -0
- package/vendor/themes/murasaki/1.0.0/theme.json +10 -0
- package/vendor/themes/murasaki/1.0.0/tokens.css +12 -0
- package/vendor/themes/sumi/1.0.0/theme.json +10 -0
- package/vendor/themes/sumi/1.0.0/tokens.css +36 -0
- package/vendor/themes/tokiwa/1.0.0/theme.json +10 -0
- package/vendor/themes/tokiwa/1.0.0/tokens.css +14 -0
package/README.ja.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- i18n: pair=README.md sha256=
|
|
1
|
+
<!-- i18n: pair=README.md sha256=0d671e51a6da4638 -->
|
|
2
2
|
<p align="center">
|
|
3
3
|
<picture>
|
|
4
4
|
<source media="(prefers-color-scheme: dark)" srcset="assets/logo/egatari-dark.svg">
|
|
@@ -130,7 +130,7 @@ npx egatari doctor # Node・uv・ffmpeg・ブラウザ・部
|
|
|
130
130
|
|
|
131
131
|
Bun(`bunx egatari`)でも動きます。
|
|
132
132
|
|
|
133
|
-
ほかのコマンド(`ids`・`sheet`・`comment-shots`・`portable`・`video`・`tts`)は `npx egatari --help` に出る。`npx egatari video <作業フォルダ | .ega.html>` は組んでから、今ある音声のまま動画にする(ffmpeg が要る)。相対パスは今いるフォルダから解く。組み立てが埋め込む既定の字体は包みに入っている(`get-fonts` は要らない)。同梱のテーマの字体(`asagi` の Zen Maru Gothic)も入っているので、同梱のテーマはどれも `npx egatari` だけで組める。教材の CSS や自分のテーマだけが名指せるほかの選べる字体(Klee One など)は、別の包み `@egatari/fonts-extra` にある(`npm i -D @egatari/fonts-extra`、または `npx -p egatari -p @egatari/fonts-extra egatari …`。要る教材なら `egatari build` と `check` が知らせる)。パーツライブラリの写しは、組み立てが読む `index.js` と使用条件だけを入れる(README・見本・変更の記録は入れない。`egatari doctor` が `index.js` を `components.lock.json` と manifest のファイルごとの sha256 で確かめる)。TTS の既定の声は初めての `egatari tts` で取り寄せる(上の「要るもの」)。`egatari tts` は uv で `tts/synth.py` を動かし、Python の環境を利用者のキャッシュのフォルダに作る(別の場所にするには `UV_PROJECT_ENVIRONMENT`)。
|
|
133
|
+
ほかのコマンド(`ids`・`ids-of`・`sheet`・`comment-shots`・`portable`・`video`・`tts`)は `npx egatari --help` に出る。`npx egatari ids-of <file.ega.html> […]` は、ファイルごとに 1 行で(タブ区切り。`--json` で JSON)、`docId`、ファイルの原稿から計算し直した `sourceSha256`(原稿の版。音声と組んだ部分は含まない。ファイルに書かれた値と違えば stderr に警告)、ファイル全体の SHA-256(ファイルそのものを表す。配布や LMS への登録の照合用)を出す。誰が公開したかは署名(形式 §10、まだ実装していない)の役目。`npx egatari video <作業フォルダ | .ega.html>` は組んでから、今ある音声のまま動画にする(ffmpeg が要る)。相対パスは今いるフォルダから解く。組み立てが埋め込む既定の字体は包みに入っている(`get-fonts` は要らない)。同梱のテーマの字体(`asagi` の Zen Maru Gothic)も入っているので、同梱のテーマはどれも `npx egatari` だけで組める。教材の CSS や自分のテーマだけが名指せるほかの選べる字体(Klee One など)は、別の包み `@egatari/fonts-extra` にある(`npm i -D @egatari/fonts-extra`、または `npx -p egatari -p @egatari/fonts-extra egatari …`。要る教材なら `egatari build` と `check` が知らせる)。パーツライブラリの写しは、組み立てが読む `index.js` と使用条件だけを入れる(README・見本・変更の記録は入れない。`egatari doctor` が `index.js` を `components.lock.json` と manifest のファイルごとの sha256 で確かめる)。TTS の既定の声は初めての `egatari tts` で取り寄せる(上の「要るもの」)。`egatari tts` は uv で `tts/synth.py` を動かし、Python の環境を利用者のキャッシュのフォルダに作る(別の場所にするには `UV_PROJECT_ENVIRONMENT`)。
|
|
134
134
|
|
|
135
135
|
## ブラウザで直す(開発サーバー)
|
|
136
136
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- i18n: pair=README.ja.md sha256=
|
|
1
|
+
<!-- i18n: pair=README.ja.md sha256=eb2c3d4dbdd4d423 -->
|
|
2
2
|
<p align="center">
|
|
3
3
|
<picture>
|
|
4
4
|
<source media="(prefers-color-scheme: dark)" srcset="assets/logo/egatari-dark.svg">
|
|
@@ -130,7 +130,7 @@ npx egatari doctor # Node, uv, ffmpeg, a browser and the part
|
|
|
130
130
|
|
|
131
131
|
Also runs with Bun (`bunx egatari`).
|
|
132
132
|
|
|
133
|
-
`npx egatari --help` lists the other commands (`ids`, `sheet`, `comment-shots`, `portable`, `video`, `tts`). `npx egatari video <working folder | .ega.html>` builds and exports a lesson with its existing audio to video (needs ffmpeg). Relative paths are resolved from the current folder. The package carries the default fonts the build embeds (no `get-fonts`) and the fonts of the bundled themes (Zen Maru Gothic of `asagi`), so every bundled theme works from `npx egatari` alone. The other optional fonts, which only a lesson's own CSS or theme can name (such as Klee One), are in the separate package `@egatari/fonts-extra` (`npm i -D @egatari/fonts-extra`, or `npx -p egatari -p @egatari/fonts-extra egatari …`; `egatari build` and `check` say so when a lesson needs it). Of each vendored part, the package carries the `index.js` the build reads and its licence (not its README, demo or changelog; `egatari doctor` checks every `index.js` against `components.lock.json` and the manifests' per-file sha256). The default TTS voices are downloaded on the first `egatari tts` (see Requirements above). `egatari tts` runs `tts/synth.py` with uv and keeps its Python environment in your cache folder (set `UV_PROJECT_ENVIRONMENT` to put it elsewhere).
|
|
133
|
+
`npx egatari --help` lists the other commands (`ids`, `ids-of`, `sheet`, `comment-shots`, `portable`, `video`, `tts`). `npx egatari ids-of <file.ega.html> […]` prints, one line per file (tab-separated; `--json` for JSON), the `docId`, the `sourceSha256` recomputed from the file's source (the version of the source: it leaves out audio and built parts; a warning on stderr if it differs from the value written in the file) and the SHA-256 of the whole file (identifies the file itself, for checking at distribution or LMS upload). Who released it is a matter for signatures (format §10, not implemented yet). `npx egatari video <working folder | .ega.html>` builds and exports a lesson with its existing audio to video (needs ffmpeg). Relative paths are resolved from the current folder. The package carries the default fonts the build embeds (no `get-fonts`) and the fonts of the bundled themes (Zen Maru Gothic of `asagi`), so every bundled theme works from `npx egatari` alone. The other optional fonts, which only a lesson's own CSS or theme can name (such as Klee One), are in the separate package `@egatari/fonts-extra` (`npm i -D @egatari/fonts-extra`, or `npx -p egatari -p @egatari/fonts-extra egatari …`; `egatari build` and `check` say so when a lesson needs it). Of each vendored part, the package carries the `index.js` the build reads and its licence (not its README, demo or changelog; `egatari doctor` checks every `index.js` against `components.lock.json` and the manifests' per-file sha256). The default TTS voices are downloaded on the first `egatari tts` (see Requirements above). `egatari tts` runs `tts/synth.py` with uv and keeps its Python environment in your cache folder (set `UV_PROJECT_ENVIRONMENT` to put it elsewhere).
|
|
134
134
|
|
|
135
135
|
## Editing in the browser (dev server)
|
|
136
136
|
|
package/bin/egatari.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// egatari コマンド(npm の包み egatari の bin。npx egatari …):各スクリプトに振り分けるだけ
|
|
3
|
-
// egatari new|ids|check|build|dev|sheet|comment-shots|portable|video|tts|doctor|skills update [引数…]、egatari --version、egatari --help
|
|
3
|
+
// egatari new|ids|ids-of|check|build|dev|sheet|comment-shots|portable|video|tts|doctor|skills update [引数…]、egatari --version、egatari --help
|
|
4
4
|
// 引数はそのままスクリプトに渡す。相対パスは呼び出した場所(cwd)から解く(INIT_CWD も cwd にそろえる)
|
|
5
5
|
import fs from 'node:fs';
|
|
6
6
|
import os from 'node:os';
|
|
@@ -22,6 +22,7 @@ const SCRIPTS = {
|
|
|
22
22
|
sheet: ['tools/sheet.mjs', '全スライドの最終段階を 1 枚の画像に / contact sheet of every slide\'s last step', '<folder | deck.html | .ega.html> [out.png] [--steps] [--tiles] [--cols 4]'],
|
|
23
23
|
'comment-shots': ['tools/comment-shots.mjs', '開発サーバーのコメントの画面を撮る / screenshots of open dev-server comments', '<folder | deck.html> [id …] [--all]'],
|
|
24
24
|
ids: ['tools/ids.mjs', 'スライドに安定した id を付ける / give slides stable ids', '<folder | deck.html> [--dry-run]'],
|
|
25
|
+
'ids-of': ['tools/ids-of.mjs', 'Egatari ファイルの docId・sourceSha256・ファイル全体の SHA-256 を 1 行ずつ出す / print docId, sourceSha256 and the whole-file SHA-256 of Egatari files', '<file.ega.html> [<file> …] [--json]'],
|
|
25
26
|
portable: ['tools/portable.mjs', '1 ファイル(.ega.html)と作業フォルダの行き来 / single file (.ega.html) <-> working folder', 'unpack|pack|attach|compare …'],
|
|
26
27
|
video: ['render/render.mjs', '音声の入った教材を動画に(ffmpeg が要る。音声は作らない)/ export a lesson with its audio to video (needs ffmpeg; makes no audio)', '<folder | .ega.html> または / or <out/deck.html> --out <dir> [--full] [--only key,…]'],
|
|
27
28
|
};
|
package/components.lock.json
CHANGED
|
@@ -3141,19 +3141,22 @@
|
|
|
3141
3141
|
"2.0.0",
|
|
3142
3142
|
"2.0.1",
|
|
3143
3143
|
"2.0.2",
|
|
3144
|
-
"2.0.3"
|
|
3144
|
+
"2.0.3",
|
|
3145
|
+
"2.0.4"
|
|
3145
3146
|
],
|
|
3146
3147
|
"sha256": {
|
|
3147
3148
|
"2.0.0": "6440523fdf4b08fe23bda918d6db8c4656a58a74bb81d4de8b205113483316a8",
|
|
3148
3149
|
"2.0.1": "dbbd262ab28045a0f5e0cbec09b6068a0343668bf21e61bb02f8d0c4c1bc2ea7",
|
|
3149
3150
|
"2.0.2": "7dbbb3852a77a1a3dcfba8c69574d2a87e6b87adbfa84f30c0359e2bae0afb2b",
|
|
3150
|
-
"2.0.3": "d93729f39a0753001c9eef8ad2c12827aff99ff1807cb6891afb9e29b5c3491d"
|
|
3151
|
+
"2.0.3": "d93729f39a0753001c9eef8ad2c12827aff99ff1807cb6891afb9e29b5c3491d",
|
|
3152
|
+
"2.0.4": "b52d8e779ee991153bb3143733e4e2a4b72d08adda31c927992617ddf2097b0b"
|
|
3151
3153
|
},
|
|
3152
3154
|
"content": {
|
|
3153
3155
|
"2.0.0": "41fb94497e0230488b8eb37688bd07109cdd5a03948b892ba621345a1a6314dd",
|
|
3154
3156
|
"2.0.1": "b3ebd4ffde8bc39c7f9100642307cd83b9d32e072f1f894e7c4d6996a6cc0d21",
|
|
3155
3157
|
"2.0.2": "6177d9adeb09f8c72c4105e521f723202623d8887ee9e03e53aec51073d33123",
|
|
3156
|
-
"2.0.3": "37ea0051e8a1f2d7c2fa2d38e57730e5a3b1afabe9037a74fcad6e6f05356c09"
|
|
3158
|
+
"2.0.3": "37ea0051e8a1f2d7c2fa2d38e57730e5a3b1afabe9037a74fcad6e6f05356c09",
|
|
3159
|
+
"2.0.4": "2e9a35ce9e289196d0b5fd24b8546cf6e0f4a6df857e69f4f78e686cabb00e61"
|
|
3157
3160
|
},
|
|
3158
3161
|
"catalogue": "2"
|
|
3159
3162
|
},
|
package/components2.lock.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"source": "https://github.com/egatari/components",
|
|
3
|
-
"default": "2.5.
|
|
3
|
+
"default": "2.5.1",
|
|
4
4
|
"catalogues": {
|
|
5
5
|
"2.0.0": {
|
|
6
6
|
"tag": "v2.0.0",
|
|
@@ -1392,6 +1392,115 @@
|
|
|
1392
1392
|
"tree": "554ed56e1ec963627be86ba1f573099ff57cf4cb22e8e10ce00e2128e30d39e2",
|
|
1393
1393
|
"venn": "e1a0240f83e1925ee59ef2752662e2b0ec27f69251c012f8bab682aadcd8695f"
|
|
1394
1394
|
}
|
|
1395
|
+
},
|
|
1396
|
+
"2.5.1": {
|
|
1397
|
+
"tag": "v2.5.1",
|
|
1398
|
+
"tarballSha256": "23c9f8ffb4324883089bf24d575cedead60875a148c42cba43e17a9460bce846",
|
|
1399
|
+
"manifestSha256": "d60e3c03b1ecd0e18ad52f538eb63a260cb2676ee78cdd252a0080b6edefdf7a",
|
|
1400
|
+
"parts": {
|
|
1401
|
+
"bars": "2.0.2",
|
|
1402
|
+
"base": "1.1.0",
|
|
1403
|
+
"boxplot": "2.0.4",
|
|
1404
|
+
"boxplot-core": "1.0.0",
|
|
1405
|
+
"cards": "2.0.3",
|
|
1406
|
+
"codetree": "2.0.4",
|
|
1407
|
+
"codetree-core": "1.0.0",
|
|
1408
|
+
"collect": "2.0.2",
|
|
1409
|
+
"compare": "2.0.2",
|
|
1410
|
+
"curves": "2.1.1",
|
|
1411
|
+
"cycle": "2.0.3",
|
|
1412
|
+
"expr": "1.0.0",
|
|
1413
|
+
"fishbone": "2.0.3",
|
|
1414
|
+
"flow": "2.0.3",
|
|
1415
|
+
"gendai": "2.0.2",
|
|
1416
|
+
"heatmap": "2.0.2",
|
|
1417
|
+
"heatmap-core": "1.0.0",
|
|
1418
|
+
"hissan": "2.0.2",
|
|
1419
|
+
"hist": "2.0.4",
|
|
1420
|
+
"hist-core": "1.0.0",
|
|
1421
|
+
"icons": "1.0.0",
|
|
1422
|
+
"kakijun": "2.0.1",
|
|
1423
|
+
"kanbun": "2.0.2",
|
|
1424
|
+
"kanbun-core": "1.0.0",
|
|
1425
|
+
"keyboard": "2.0.3",
|
|
1426
|
+
"kobun": "2.0.2",
|
|
1427
|
+
"kpi": "2.0.2",
|
|
1428
|
+
"map-japan": "2.0.4",
|
|
1429
|
+
"map-world": "2.0.3",
|
|
1430
|
+
"market": "2.0.2",
|
|
1431
|
+
"markup-reader": "1.0.1",
|
|
1432
|
+
"menu": "2.0.2",
|
|
1433
|
+
"numberline": "2.0.2",
|
|
1434
|
+
"orbit": "2.0.4",
|
|
1435
|
+
"particles": "2.0.0",
|
|
1436
|
+
"pie": "2.0.2",
|
|
1437
|
+
"plot": "1.1.1",
|
|
1438
|
+
"predict": "2.0.3",
|
|
1439
|
+
"quad": "2.0.3",
|
|
1440
|
+
"scatter": "2.0.4",
|
|
1441
|
+
"score": "2.1.0",
|
|
1442
|
+
"seq": "2.0.4",
|
|
1443
|
+
"shape": "1.0.0",
|
|
1444
|
+
"sweep": "2.1.1",
|
|
1445
|
+
"syntax": "2.0.2",
|
|
1446
|
+
"tape": "2.0.2",
|
|
1447
|
+
"timeline": "2.0.2",
|
|
1448
|
+
"timer": "2.0.3",
|
|
1449
|
+
"tree": "2.0.3",
|
|
1450
|
+
"venn": "2.0.2"
|
|
1451
|
+
},
|
|
1452
|
+
"content": {
|
|
1453
|
+
"bars": "520606a746b0d38fdc1aa380e665a1b95eead2487b11f389d2ebac4abe8f07cb",
|
|
1454
|
+
"base": "577008a069e7eb08057705a0800d975e82c8dfe0d0ba5fbf4f8974af7b298a7f",
|
|
1455
|
+
"boxplot": "2af8f6248ebd499dd036bffcac49b3e43fd8c74a0435bd256e2b1dbd8141b4d5",
|
|
1456
|
+
"boxplot-core": "fadd24868e2730ec14b8f3f1e9cb75b8577a48b8d71beaa12ef089f7a3ba0a7d",
|
|
1457
|
+
"cards": "f3d5b6ce53f40c5f355a67538ff11b9cd28297da6292125ccb6e055aeddef906",
|
|
1458
|
+
"codetree": "4f96929f3b539c459bb78196251009a5f80e607eebccfae641cec60e979efe0e",
|
|
1459
|
+
"codetree-core": "bb139fb1c2e4d010aa82a2c50db120f95f12a0a251cded3130a71dd57dec0274",
|
|
1460
|
+
"collect": "e6bbe784ee452d52d534b8fb3a0924e65c49bbb5926139ef5eabd9193500b357",
|
|
1461
|
+
"compare": "0cab77d128c5f304c2d2ba32841b0bc5adc54b4e72f6681e0a0dda68c96b5d7e",
|
|
1462
|
+
"curves": "96ad8eaf0ea7c23a31b72657964f23a02165765845991cafc41ee2835b97e40f",
|
|
1463
|
+
"cycle": "0787c5bbf2e61801398aeefc39a3674b1fc0e556173c450b85cafa4201cb44a6",
|
|
1464
|
+
"expr": "faf6a2f0b5df589639de624e75c5b20594f517e4426f6415d152809249b00b92",
|
|
1465
|
+
"fishbone": "782ae2154247b00451fc30aa140bf386d3a7a56ac4ad9ee04916f4bd1d29dda0",
|
|
1466
|
+
"flow": "28238c4fa50a377b96ce8a130ce5bdbf7bfc0536ed9c331499ea22377c43adb6",
|
|
1467
|
+
"gendai": "3c36a26fd78dffdfa114bd7c9ca5cae494117bbcdda14bee5c2a01351e5f2eb2",
|
|
1468
|
+
"heatmap": "2a6b20b93f1169ef2435cdf3bfca57d24c9111fe9aaf8e61f0d049cf8a70e9df",
|
|
1469
|
+
"heatmap-core": "de9607f86221006e7bad43f1f661c751d9a6f8f9c62da5c7e0d7f1249b9afcd6",
|
|
1470
|
+
"hissan": "328a440e91684524068076e96cba5771cdceaa274d4b90033656259f05467135",
|
|
1471
|
+
"hist": "f0ac8d6498c1f51ea963f6c0776937f9dc6d2a9f2ac0fdbe6243d94cc3bbc06d",
|
|
1472
|
+
"hist-core": "07013c263cc595382dbcfd4931ca8b016f9dfb673440adf28911c95bd465cf9d",
|
|
1473
|
+
"icons": "b2dfb4fa290d240024c95e2d24fda887db9fbc5b94f99b5be00c74c488fcfddb",
|
|
1474
|
+
"kakijun": "8af8e00fd248f55ce84fe9989e531ae60bf0eb5d0f059f3a28aa3d9c92a8e1d8",
|
|
1475
|
+
"kanbun": "556e7d45a761c4fa749cde186fb53f6c526ba6ede0b8f0f0bba5ac9e25e0d6f4",
|
|
1476
|
+
"kanbun-core": "f268cf809438c8af63a42f9c9121110fc7263e4d705c40c6206ce46cf7ec167b",
|
|
1477
|
+
"keyboard": "3dba49cbbf7853212a6e5c393de030430d02b8b1a2ba4c8b722db2bb8afad12f",
|
|
1478
|
+
"kobun": "de611e2477042b14eb9c04bb98ad0bbe6d7b44ca829213dd1a7a2b94d8f946ae",
|
|
1479
|
+
"kpi": "ef9c8c77ddf2b3953376a2db700c1277f550ea2606eab11cd8e18056dcba84c1",
|
|
1480
|
+
"map-japan": "340f7678bb19a64f9d4ed63b95d290046367a6b49c44977184f1cec1e97a7d68",
|
|
1481
|
+
"map-world": "bec04685638f8fc1217c380d361fd9a425ffeade0291a4f2b2d4e41a5628e0ef",
|
|
1482
|
+
"market": "5b44b272b917246219d2709f1b001964f87a3e07786cc9950087bbb8add3c721",
|
|
1483
|
+
"markup-reader": "03550bb20d425aa926258bab18b03bbc0cee292072e01bb6c78c429b3ae92c34",
|
|
1484
|
+
"menu": "e2181655ed2050668133e08eb14b5683cda48d6af8d76fd7b551c58798c95287",
|
|
1485
|
+
"numberline": "4e0e5eb48fc20ffc554786a7db66c4f5cee0c42eb0554bdc8c98323cdb168eb4",
|
|
1486
|
+
"orbit": "2e9a35ce9e289196d0b5fd24b8546cf6e0f4a6df857e69f4f78e686cabb00e61",
|
|
1487
|
+
"particles": "ec132caf4b4fd019fab20f9e9d6bc86266e30eb80a4fb8d2de4ca440ad45a098",
|
|
1488
|
+
"pie": "2f1c797ecd028d04ce12b3d55d8ef9d5a4180d564aa99afb492d0bfc9cd39c94",
|
|
1489
|
+
"plot": "80bf0ca9b592205315d09e2041df5aeb9e123e4129ada03cb4c7e0fd914a3bd7",
|
|
1490
|
+
"predict": "40571cbc11cd649c447da73ede0f89937da344b05d4386abeb4afeecedfe7d3e",
|
|
1491
|
+
"quad": "4dd7e6a02f4128e90d4e2a86cccd9bf267a02cebcff1cdf36e0aaff8848af66e",
|
|
1492
|
+
"scatter": "808f748e76833742bb12a80482b37cb3dedaf3dcd592ee477d611cb40e95b094",
|
|
1493
|
+
"score": "abbe3a79cdd442191cb76ac572a7fa62af694850c115c4abba30356bae5f475f",
|
|
1494
|
+
"seq": "7ad71dad059fd45a875a68e177335e7c13c550edb4e7746f9410a76f5015bc5a",
|
|
1495
|
+
"shape": "d92842c606795528d1246ddb050ac275e1b72659629185750a6e9ac7fdb763a3",
|
|
1496
|
+
"sweep": "7ef95fd3156f83c48e0961765bae7155607393e16485184fd60fb80cb8a63a16",
|
|
1497
|
+
"syntax": "0eca723150eb30db0b3d3fdbd35b973d5344ac0d0e2ea8ab89d143a0870ab4fd",
|
|
1498
|
+
"tape": "693e2aa59e822d38c48eca7271cc020f8e0a6f6189f2409895318ed2a3f0b809",
|
|
1499
|
+
"timeline": "3df7d0ec0c3ed4a6b06fbe3befec78b65a2202e5571580d8b28700a14b7b4321",
|
|
1500
|
+
"timer": "9043427ed434c76fba5b11ddd863c40d99b6157e194cfc729895cbaa4940496c",
|
|
1501
|
+
"tree": "554ed56e1ec963627be86ba1f573099ff57cf4cb22e8e10ce00e2128e30d39e2",
|
|
1502
|
+
"venn": "e1a0240f83e1925ee59ef2752662e2b0ec27f69251c012f8bab682aadcd8695f"
|
|
1503
|
+
}
|
|
1395
1504
|
}
|
|
1396
1505
|
},
|
|
1397
1506
|
"parts": {
|
|
@@ -2610,6 +2719,15 @@
|
|
|
2610
2719
|
"base": "1.1.0"
|
|
2611
2720
|
},
|
|
2612
2721
|
"license": "MIT"
|
|
2722
|
+
},
|
|
2723
|
+
"2.0.4": {
|
|
2724
|
+
"sha256": "b52d8e779ee991153bb3143733e4e2a4b72d08adda31c927992617ddf2097b0b",
|
|
2725
|
+
"kind": "element",
|
|
2726
|
+
"tag": "m-orbit",
|
|
2727
|
+
"requires": {
|
|
2728
|
+
"base": "1.1.0"
|
|
2729
|
+
},
|
|
2730
|
+
"license": "MIT"
|
|
2613
2731
|
}
|
|
2614
2732
|
},
|
|
2615
2733
|
"particles": {
|
package/kit/check-messages.mjs
CHANGED
|
@@ -102,6 +102,13 @@ export const MESSAGES = {
|
|
|
102
102
|
en: (a) => `the class “${a.what}” names a colour and is not in the 1.0 vocabulary (${a.n} place(s), first on line ${a.line}): use the meaning class “${a.to}” (term for terms and questions, emph for conclusions and problems, muted for known results)` },
|
|
103
103
|
legacyStepAttr: { ja: (a) => `${a.what} は 1.0 の語彙にない(${a.n} か所、最初は ${a.line} 行目):ステップの数と動きは要素の data-step と data-at、線の class="draw"、パーツの steps から決まる(format spec §8.0)。${a.what} を外す`,
|
|
104
104
|
en: (a) => `${a.what} is not in the 1.0 vocabulary (${a.n} place(s), first on line ${a.line}): the number of steps and the motion come from data-step and data-at on elements, class="draw" on strokes and the steps of parts (format spec §8.0); remove ${a.what}` },
|
|
105
|
+
// テーマの色の語彙の外の色(format spec §8.4。kit/core/color-vocab.mjs):じかに書いた色(literal)と、相対色で色相を変えた色(hue)。情報だけ(教材は組める。修正依頼には入らない)
|
|
106
|
+
colorOutside: { rule: 'R-colors', ja: (a) => (a.kind === 'hue'
|
|
107
|
+
? `相対色の構文で色相を変えた色は、役割のない新しい色になる(${a.n} か所、最初は ${a.line} 行目:${a.list})。テーマの色に揃えるなら、役割の色 var(--emph) などをそのまま使う(淡くするなら color-mix() で役割と --bg を混ぜ、明るさ・不透明度だけを変えるなら色相は h のまま)`
|
|
108
|
+
: `色をじかに書いている(${a.n} か所、最初は ${a.line} 行目:${a.list})。テーマの色に揃えるなら、テーマの class(term・emph・muted)か変数 var(--fg) var(--term) var(--emph) var(--muted) var(--accent2) var(--line) var(--lit) を使う`),
|
|
109
|
+
en: (a) => (a.kind === 'hue'
|
|
110
|
+
? `a colour derived by changing the hue (relative colour syntax) is a new colour without a role (${a.n} place(s), first on line ${a.line}: ${a.list}); to follow the theme, use the role colour as it is (var(--emph) …); to make it lighter, mix the role with --bg in color-mix(), and when only lightness or opacity changes keep the hue h`
|
|
111
|
+
: `colours are written directly (${a.n} place(s), first on line ${a.line}: ${a.list}); to follow the theme, use its classes (term, emph, muted) or variables var(--fg) var(--term) var(--emph) var(--muted) var(--accent2) var(--line) var(--lit)`) },
|
|
105
112
|
legacyLectureMode: { ja: (a) => `<html data-mode="lecture"> は 1.0 の語彙にない(${a.line} 行目):見せ方は再生の設定の「先のステップを薄く見せる」で選ぶ。原稿からは外す`,
|
|
106
113
|
en: (a) => `<html data-mode="lecture"> is not in the 1.0 vocabulary (line ${a.line}): the participant chooses “Show later steps faintly” in the player; remove it from the source` },
|
|
107
114
|
narrHeadingDiffers: { rule: 'R-headings', ja: (a) => `narration.md ${a.line} 行目の見出し${quoteJa(a.heading)}がスライドの見出し${quoteJa(a.slide)}と違う({#${a.id}} で対応しているので動きは変わらない)`, en: (a) => `the narration heading “${a.heading}” (narration.md line ${a.line}) differs from the slide heading “${a.slide}” (matched by {#${a.id}}, so nothing breaks)` },
|
|
@@ -218,6 +225,8 @@ export const MESSAGES = {
|
|
|
218
225
|
desuMasu: { rule: 'R-style', ja: (a) => `スライドの字に です・ます がある(「${a.t}」):スライドは常体(だ・である、体言止め)で書く。です・ます は口述原稿だけ`, en: (a) => `the slide text uses です・ます (“${a.t}”): write slides in plain style (だ・である or a noun ending); keep です・ます for the narration` },
|
|
219
226
|
rawMath: { rule: 'R-math', ja: (a) => `数式が KaTeX で組まれずに残っている(「${a.t}」):\\( … \\) か \\[ … \\] で囲み、$ … $ は使わない`, en: (a) => `math was left unrendered (“${a.t}”): wrap it in \\( … \\) or \\[ … \\], not $ … $` },
|
|
220
227
|
katexError: { rule: 'R-math', ja: (a) => `KaTeX が式を組めない(「${a.t}」):式の書き方を直す(< は \\lt、使えるマクロは \\hlE \\hlT \\hlM \\htmlId \\htmlData \\morph)`, en: (a) => `KaTeX cannot render an equation (“${a.t}”): fix its syntax (write < as \\lt; allowed macros are \\hlE \\hlT \\hlM \\htmlId \\htmlData \\morph)` },
|
|
228
|
+
// 同じ重さの短い要点だけの本文(kit/core/layout-scan.mjs、backlog #189。情報だけ:直すかは作成者が決める)
|
|
229
|
+
cardsHint: { rule: 'R-purpose', ja: () => '同じ重さの短い要点なら、カード(m-cards)にすると見やすいことがあります', en: () => 'Short, equal points may read better as cards (m-cards)' },
|
|
221
230
|
// 本文の釣り合い(R-balance の段 1、情報。kit/core/fill-measure.mjs):数だけを言う。直し方は段 2 で足す(字で埋めさせない)
|
|
222
231
|
// 横組み:重心は光学的な中心(上から 45%)に対して、空きは下 − 上。縦組み:重心は左右の真ん中に対して、空きは左 − 右
|
|
223
232
|
balance: { rule: 'R-balance',
|
package/kit/check.mjs
CHANGED
|
@@ -54,6 +54,7 @@ import { scanBalance } from './fill-scan.mjs';
|
|
|
54
54
|
import { layoutScan, metricsProbe, metricsFonts, CLIP_ATTR, ANNOT_ATTR, OVERLAP_ATTR } from './core/layout-scan.mjs';
|
|
55
55
|
import { placeholderSteps, templateTextIn } from './core/template-text.mjs';
|
|
56
56
|
import { legacyVocabulary } from './core/legacy-vocab.mjs';
|
|
57
|
+
import { colorsOutsideVocabulary } from './core/color-vocab.mjs';
|
|
57
58
|
import { FONTS_EXTRA_WARN, FONTS_EXTRA_PKG, FONTS_EXTRA_INSTALL } from './core/build-core.mjs';
|
|
58
59
|
import { uncoveredGlyphs } from './core/font-coverage.mjs';
|
|
59
60
|
|
|
@@ -157,6 +158,12 @@ if (extraMissing.length) report(null, 'error', 'fontsExtraMissing', { fonts: ext
|
|
|
157
158
|
}
|
|
158
159
|
// 1.0 の語彙にない書き方(format spec §8.0):色のクラス blue・red・gray、data-steps・data-anim、<html data-mode="lecture">。警告だけ(教材は組める)
|
|
159
160
|
for (const x of legacyVocabulary(readRegular(src, { max: READ_LIMITS.source }).toString('utf8'))) report(null, 'warn', x.code, x);
|
|
161
|
+
// テーマの色の語彙の外の色(format spec §8.4、R-colors):じかに書いた色と、相対色の構文で色相を変えた色。種類ごとに 1 つの情報(値は 6 つまで並べる)。
|
|
162
|
+
// 情報なので修正依頼(kit/core/llm-fix.mjs)には入らない(規格の担当の判断、2026-11-09)。
|
|
163
|
+
// var(--役割)・color-mix() で役割どうし・役割と --bg を混ぜた色・色相を保って明るさや不透明度だけを変えた相対色は知らせない(kit/core/color-vocab.mjs)
|
|
164
|
+
for (const x of colorsOutsideVocabulary(readRegular(src, { max: READ_LIMITS.source }).toString('utf8'))) {
|
|
165
|
+
report(null, 'info', 'colorOutside', { kind: x.kind, n: x.n, line: x.line, items: x.items, list: x.items.slice(0, 6).map((i) => i.what).join(', ') + (x.items.length > 6 ? ', …' : '') });
|
|
166
|
+
}
|
|
160
167
|
// {#id} で指したスライドの見出しと、narration.md の見出しの文字列が違う(id が勝つので、知らせるだけ)
|
|
161
168
|
const byKey = new Map(built.slides.map((s, i) => [s.key, { ...s, i }]));
|
|
162
169
|
for (const sec of built.segs.sections || []) {
|
|
@@ -439,7 +446,7 @@ const aOut = await page.evaluate(([metaList, JA, CLIP, ANNOT, OVERLAP, METRICS])
|
|
|
439
446
|
const issues = [], warns = [];
|
|
440
447
|
const body = s.querySelector('.body');
|
|
441
448
|
// はみ出し・切れ・字の大きさ・字数(kit/core/layout-scan.mjs。編集アプリの品質チェックと同じ関数)
|
|
442
|
-
for (const f of window.__layoutScan(s, { JA, refRe: '文献', clip: CLIP, annot: ANNOT, overlap: OVERLAP, metrics: METRICS })) (f.sev === 'error' ? issues : warns).push([f.code, f.a]);
|
|
449
|
+
for (const f of window.__layoutScan(s, { JA, refRe: '文献', clip: CLIP, annot: ANNOT, overlap: OVERLAP, metrics: METRICS })) (f.sev === 'error' ? issues : warns).push([f.code, f.a, f.sev]);
|
|
443
450
|
if (body) {
|
|
444
451
|
const txt = (() => { const c = body.cloneNode(true); c.querySelectorAll('.katex-mathml').forEach((x) => x.remove()); document.body.appendChild(c); c.style.cssText = 'position:absolute;left:-99999px;width:' + body.clientWidth + 'px'; const r = c.innerText; c.remove(); return r; })();
|
|
445
452
|
// 句読点はデッキの中でそろっていればよい(どちらにするかは元の原稿に合わせる)。数えて後で比べる
|
|
@@ -470,7 +477,10 @@ if (foreign.length) report(null, 'warn', 'fontNotEmbedded', { fonts: foreign });
|
|
|
470
477
|
if (probe.items.length) report(null, 'warn', 'themeMetricsDrift', { theme: themeInfo.name, declared: !!themeInfo.declared, items: probe.items });
|
|
471
478
|
for (const { i, text } of aOut.step0) report(i, 'info', 'step0', { t: text }, '0');
|
|
472
479
|
for (const { i, issues } of aOut.style) for (const [code, a] of issues) report(i, 'error', code, a);
|
|
473
|
-
|
|
480
|
+
// cardsHint は 1 つの教材で最大 a.cap 個(長さのそろい方 a.ratio の小さい順、同じなら前のスライド)。残りは出さない(kit/core/layout-scan.mjs の CH.cap)
|
|
481
|
+
const cardsHints = [];
|
|
482
|
+
for (const { i, issues } of aOut.soft) for (const [code, a, sev] of issues) { if (code === 'cardsHint') cardsHints.push({ i, a }); else report(i, sev === 'info' ? 'info' : 'warn', code, a); }
|
|
483
|
+
cardsHints.map((h, k) => ({ ...h, k })).sort((x, y) => x.a.ratio - y.a.ratio || x.k - y.k).slice(0, cardsHints[0] ? cardsHints[0].a.cap : 0).sort((x, y) => x.k - y.k).forEach((h) => report(h.i, 'info', 'cardsHint', h.a));
|
|
474
484
|
await collectPartReports();
|
|
475
485
|
{
|
|
476
486
|
const tot = aOut.punct.reduce((a, p) => ({ jp: a.jp + p.jp, en: a.en + p.en }), { jp: 0, en: 0 });
|
package/kit/core/colab-core.mjs
CHANGED
|
@@ -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.8', // バッジの 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,172 @@
|
|
|
1
|
+
// テーマの色の語彙の外の色(format spec §8.4「Theme colours」)を原稿(deck.html)から探す。品質チェック(kit/check.mjs)が情報として知らせる(R-colors。修正依頼には入れない。
|
|
2
|
+
// 教材は組める:スライドは SHOULD)。Node にもブラウザにも依存しない
|
|
3
|
+
// colorsOutsideVocabulary(src) → [{kind, items: [{what, n, line}], n, line}](見つかった kind だけ。items は値ごとに 1 つ、出た順。n は数、line は最初の行)
|
|
4
|
+
// kind 'literal':色をじかに書いたもの。16 進(#rgb #rgba #rrggbb #rrggbbaa)、色の関数(rgb() rgba() hsl() hsla() hwb() lab() lch() oklab() oklch() color())、
|
|
5
|
+
// 色の名前(red・white など。色を取るプロパティと属性の中だけ)。var(--x, …) の予備の値の中のものも(§8.4:予備は役割から作る)
|
|
6
|
+
// kind 'hue' :相対色の構文(rgb(from …) hsl(from …) oklch(from …) color(from …) など)で、色相を変えたもの。役割のない新しい色になる(§8.4)
|
|
7
|
+
// 見るところ:<style> の宣言の値、style 属性、SVG と HTML の色の属性(fill・stroke・stop-color・flood-color・lighting-color・color・bgcolor)。
|
|
8
|
+
// <script> の中は見ない(部品の JavaScript の文字列は色かどうか分からない)。url(…) と文字列("…" '…')とコメントは飛ばす。
|
|
9
|
+
// 許すもの:var(--役割)(どの名前でも。var() は色をじかに書いたものではない。--lit も)、transparent・currentColor・none・inherit など、color-mix()
|
|
10
|
+
// (中の色が許すものだけなら。役割どうし・役割と --bg を混ぜた色は役割を保つ:§8.4)。
|
|
11
|
+
// 相対色の決まり(保守的な読み:既定のテーマが --title を oklch(from var(--base) min(l, 0.32) c h) で作り、淡色を color-mix で作るのと同じく、
|
|
12
|
+
// 色相を保って明るさ・鮮やかさ・不透明度を変えた色は役割を保つ。§8.4 が知らせると言うのは色相を変えたものだけ):
|
|
13
|
+
// 色相のある空間(hsl hwb lch oklch):色相の成分が `h` そのもの以外(calc(h + 30)・数・ほかの成分の名前・none)なら 'hue'。ほかの成分(明るさ・鮮やかさ・白・黒)と
|
|
14
|
+
// 不透明度(/ の後)は変えてよい
|
|
15
|
+
// 色相のない空間(rgb lab oklab color()):rgb と color() の srgb などの 3 成分は、どれか 1 つでも元の名前そのもの(r g b、color() は r g b か x y z)でなければ 'hue'
|
|
16
|
+
// (成分ごとに変えると色相が変わる。等しく変えたかどうかは見分けない)。lab・oklab は a・b が元のまま(a b)なら明るさ l だけを変えてよい。不透明度は変えてよい
|
|
17
|
+
// 元の色(from の後)がじかに書いた色なら、その色を 'literal' として知らせ、相対色としては重ねて知らせない
|
|
18
|
+
import { parse } from 'parse5';
|
|
19
|
+
|
|
20
|
+
// CSS の色の名前(CSS Color 4。transparent と currentcolor は除く:色を足さない)
|
|
21
|
+
const NAMED = new Set(('aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse '
|
|
22
|
+
+ 'chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen '
|
|
23
|
+
+ 'darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray '
|
|
24
|
+
+ 'dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred '
|
|
25
|
+
+ 'indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey '
|
|
26
|
+
+ 'lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon '
|
|
27
|
+
+ 'mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue '
|
|
28
|
+
+ 'mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred '
|
|
29
|
+
+ 'papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna '
|
|
30
|
+
+ 'silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen').split(' '));
|
|
31
|
+
const COLOR_FN = new Set(['rgb', 'rgba', 'hsl', 'hsla', 'hwb', 'lab', 'lch', 'oklab', 'oklch', 'color']);
|
|
32
|
+
// 相対色の成分の名前(空間ごと)と、色相の成分の位置(なければ -1)
|
|
33
|
+
const CHANNELS = { rgb: ['r', 'g', 'b'], rgba: ['r', 'g', 'b'], hsl: ['h', 's', 'l'], hsla: ['h', 's', 'l'], hwb: ['h', 'w', 'b'], lab: ['l', 'a', 'b'], oklab: ['l', 'a', 'b'], lch: ['l', 'c', 'h'], oklch: ['l', 'c', 'h'] };
|
|
34
|
+
// 色の名前を色として読むプロパティ(16 進と色の関数はどのプロパティでも色)
|
|
35
|
+
const COLOR_PROP = /^(?:--|color$|background|border|outline|fill$|stroke$|stop-color$|flood-color$|lighting-color$|text-decoration|text-emphasis|box-shadow$|text-shadow$|caret-color$|accent-color$|column-rule|-webkit-text-(?:stroke|fill)|filter$|scrollbar-color$)/i;
|
|
36
|
+
const COLOR_ATTR = new Set(['fill', 'stroke', 'stop-color', 'flood-color', 'lighting-color', 'color', 'bgcolor']);
|
|
37
|
+
const HEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
38
|
+
|
|
39
|
+
// 値を字句に分ける:{t: 'fn', name, args: [字句…]} | {t: 'id', s} | {t: 'hex', s} | {t: 'op', s}(, / など)| {t: 'num', s}
|
|
40
|
+
function tokenize(s) {
|
|
41
|
+
let i = 0;
|
|
42
|
+
const read = (close) => {
|
|
43
|
+
const out = [];
|
|
44
|
+
while (i < s.length) {
|
|
45
|
+
const c = s[i];
|
|
46
|
+
if (close && c === ')') { i++; return out; }
|
|
47
|
+
if (/\s/.test(c)) { i++; continue; }
|
|
48
|
+
if (c === '"' || c === "'") { const q = c; i++; while (i < s.length && s[i] !== q) i += s[i] === '\\' ? 2 : 1; i++; continue; }
|
|
49
|
+
if (c === '#') { const m = /^#[0-9a-zA-Z_-]*/.exec(s.slice(i)); out.push({ t: 'hex', s: m[0] }); i += m[0].length; continue; }
|
|
50
|
+
const id = /^-?-?[A-Za-z_][\w-]*/.exec(s.slice(i));
|
|
51
|
+
if (id) {
|
|
52
|
+
i += id[0].length;
|
|
53
|
+
if (s[i] === '(') {
|
|
54
|
+
i++;
|
|
55
|
+
const name = id[0].toLowerCase();
|
|
56
|
+
if (name === 'url') { while (i < s.length && s[i] !== ')') i += s[i] === '\\' ? 2 : 1; i++; continue; }
|
|
57
|
+
const start = i;
|
|
58
|
+
const args = read(true);
|
|
59
|
+
out.push({ t: 'fn', name, args, text: `${id[0]}(${s.slice(start, i - 1)})` });
|
|
60
|
+
} else out.push({ t: 'id', s: id[0] });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (c === '(') { i++; out.push({ t: 'fn', name: '', args: read(true), text: '' }); continue; }
|
|
64
|
+
const num = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(?:%|[a-z]+)?/i.exec(s.slice(i));
|
|
65
|
+
if (num) { out.push({ t: 'num', s: num[0] }); i += num[0].length; continue; }
|
|
66
|
+
out.push({ t: 'op', s: c }); i++;
|
|
67
|
+
}
|
|
68
|
+
return out;
|
|
69
|
+
};
|
|
70
|
+
return read(false);
|
|
71
|
+
}
|
|
72
|
+
const isLiteralFn = (x) => x.t === 'fn' && COLOR_FN.has(x.name) && !(x.args[0] && x.args[0].t === 'id' && x.args[0].s.toLowerCase() === 'from');
|
|
73
|
+
const isRelativeFn = (x) => x.t === 'fn' && COLOR_FN.has(x.name) && x.args[0] && x.args[0].t === 'id' && x.args[0].s.toLowerCase() === 'from';
|
|
74
|
+
const short = (s) => { const t = String(s).replace(/\s+/g, ' ').trim(); return t.length > 60 ? t.slice(0, 57) + '…' : t; };
|
|
75
|
+
|
|
76
|
+
// 相対色が色相を変えるか。args は from の後ろ([元の色, 成分…, / 不透明度])
|
|
77
|
+
function relativeChangesHue(fn) {
|
|
78
|
+
let args = fn.args.slice(2);
|
|
79
|
+
let space = fn.name;
|
|
80
|
+
if (space === 'color') { // color(from <色> <空間> c1 c2 c3 [/ a])
|
|
81
|
+
const sp = args[0] && args[0].t === 'id' ? args[0].s.toLowerCase() : '';
|
|
82
|
+
args = args.slice(1);
|
|
83
|
+
const names = /^xyz/.test(sp) ? ['x', 'y', 'z'] : ['r', 'g', 'b'];
|
|
84
|
+
const ch = args.slice(0, args.findIndex((x) => x.t === 'op' && x.s === '/') >= 0 ? args.findIndex((x) => x.t === 'op' && x.s === '/') : args.length);
|
|
85
|
+
return ch.length !== 3 || ch.some((x, k) => !(x.t === 'id' && x.s.toLowerCase() === names[k]));
|
|
86
|
+
}
|
|
87
|
+
const names = CHANNELS[space];
|
|
88
|
+
const slash = args.findIndex((x) => x.t === 'op' && (x.s === '/' || x.s === ','));
|
|
89
|
+
const ch = slash >= 0 ? args.slice(0, slash) : args;
|
|
90
|
+
if (ch.length !== 3) return true; // 読めない形は保守的に知らせる
|
|
91
|
+
const same = (k) => ch[k].t === 'id' && ch[k].s.toLowerCase() === names[k];
|
|
92
|
+
if (space === 'rgb' || space === 'rgba') return ![0, 1, 2].every(same);
|
|
93
|
+
if (space === 'lab' || space === 'oklab') return !(same(1) && same(2));
|
|
94
|
+
return !same(names.indexOf('h'));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 字句の並びを調べる。colorCtx:色の名前を色として読むか
|
|
98
|
+
function scan(tokens, colorCtx, add) {
|
|
99
|
+
for (const x of tokens) {
|
|
100
|
+
if (x.t === 'hex') { if (HEX.test(x.s)) add('literal', x.s); continue; }
|
|
101
|
+
if (x.t === 'id') { if (colorCtx && NAMED.has(x.s.toLowerCase())) add('literal', x.s); continue; }
|
|
102
|
+
if (x.t !== 'fn') continue;
|
|
103
|
+
if (isLiteralFn(x)) { add('literal', x.text); continue; }
|
|
104
|
+
if (isRelativeFn(x)) {
|
|
105
|
+
const origin = x.args[1];
|
|
106
|
+
let lit = false;
|
|
107
|
+
const sub = (k, w) => { if (k === 'literal') lit = true; add(k, w); };
|
|
108
|
+
if (origin) scan([origin], true, sub);
|
|
109
|
+
if (!lit && relativeChangesHue(x)) add('hue', x.text);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (x.name === 'var') { // var(--x, 予備):名前は飛ばし、予備の値だけを見る
|
|
113
|
+
const comma = x.args.findIndex((a) => a.t === 'op' && a.s === ',');
|
|
114
|
+
if (comma >= 0) scan(x.args.slice(comma + 1), true, add);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
scan(x.args, colorCtx || x.name === 'color-mix' || /gradient$/.test(x.name) || x.name === 'light-dark' || x.name === 'drop-shadow', add);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function colorsInValue(value, { colorCtx = true } = {}) {
|
|
121
|
+
const out = [];
|
|
122
|
+
scan(tokenize(String(value)), colorCtx, (kind, what) => out.push({ kind, what: short(what) }));
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
// CSS の文字(<style> の中身・style 属性)の宣言:[{prop, value, at}](at は文字の中の位置)
|
|
126
|
+
export function declarations(css, { inline = false } = {}) {
|
|
127
|
+
const text = String(css).replace(/\/\*[\s\S]*?\*\//g, (m) => ' '.repeat(m.length));
|
|
128
|
+
const out = [];
|
|
129
|
+
const re = inline ? /(^|;)\s*(--[\w-]+|-?[A-Za-z][\w-]*)\s*:([^;]*)/g : /(^|[;{])\s*(--[\w-]+|-?[A-Za-z][\w-]*)\s*:([^;{}]*)(?=[;}])/g;
|
|
130
|
+
for (const m of text.matchAll(re)) out.push({ prop: m[2], value: m[3], at: m.index + m[1].length });
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function walk(n, fn) {
|
|
135
|
+
fn(n);
|
|
136
|
+
if (n.tagName === 'script') return;
|
|
137
|
+
for (const c of n.childNodes || []) walk(c, fn);
|
|
138
|
+
if (n.content) walk(n.content, fn);
|
|
139
|
+
}
|
|
140
|
+
export function colorsOutsideVocabulary(src) {
|
|
141
|
+
const text = String(src);
|
|
142
|
+
const doc = parse(text, { sourceCodeLocationInfo: true });
|
|
143
|
+
const lineOf = (off) => text.slice(0, off).split('\n').length;
|
|
144
|
+
const kinds = new Map();
|
|
145
|
+
const add = (kind, what, at) => {
|
|
146
|
+
if (!kinds.has(kind)) kinds.set(kind, new Map());
|
|
147
|
+
const m = kinds.get(kind), k = what.toLowerCase();
|
|
148
|
+
if (!m.has(k)) m.set(k, { what, n: 0, line: lineOf(at) });
|
|
149
|
+
m.get(k).n++;
|
|
150
|
+
};
|
|
151
|
+
const ofDecls = (css, base, inline) => {
|
|
152
|
+
for (const d of declarations(css, { inline })) for (const f of colorsInValue(d.value, { colorCtx: COLOR_PROP.test(d.prop) })) add(f.kind, f.what, base + d.at);
|
|
153
|
+
};
|
|
154
|
+
walk(doc, (n) => {
|
|
155
|
+
if (!n.tagName || !n.sourceCodeLocation) return;
|
|
156
|
+
const loc = n.sourceCodeLocation;
|
|
157
|
+
if (n.tagName === 'style') {
|
|
158
|
+
const body = (n.childNodes || []).map((c) => c.value || '').join('');
|
|
159
|
+
const start = loc.startTag ? loc.startTag.endOffset : loc.startOffset;
|
|
160
|
+
ofDecls(body, start, false);
|
|
161
|
+
}
|
|
162
|
+
for (const a of n.attrs || []) {
|
|
163
|
+
const at = (loc.attrs && loc.attrs[a.name] ? loc.attrs[a.name].startOffset : loc.startOffset);
|
|
164
|
+
if (a.name === 'style') ofDecls(a.value, at, true);
|
|
165
|
+
else if (COLOR_ATTR.has(a.name.toLowerCase())) for (const f of colorsInValue(a.value)) add(f.kind, f.what, at);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return ['literal', 'hue'].filter((k) => kinds.has(k)).map((kind) => {
|
|
169
|
+
const items = [...kinds.get(kind).values()];
|
|
170
|
+
return { kind, items, n: items.reduce((s, x) => s + x.n, 0), line: Math.min(...items.map((x) => x.line)) };
|
|
171
|
+
});
|
|
172
|
+
}
|
package/kit/core/layout-scan.mjs
CHANGED
|
@@ -469,6 +469,29 @@ export function layoutScan(s, o) {
|
|
|
469
469
|
// 章の扉(.sec)の題は h1。h2 だけで書いた扉を知らせる(#128。CSS は h2 も読めるようにしたが、書き方は h1 にそろえる)
|
|
470
470
|
if (s.classList.contains('sec') && s.querySelector('h2') && !s.querySelector('h1')) add('warn', 'secHeading', { t: sample((s.querySelector('h2').textContent || '').replace(/\s+/g, ' ').trim()) });
|
|
471
471
|
|
|
472
|
+
// 同じ重さの短い要点だけの本文はカード(m-cards)が見やすいことがある(backlog #189、R-purpose。情報だけ。直すかは作成者が決める)
|
|
473
|
+
// 字だけ:本文の直下が 1 つの ul(li が 3〜4 つ)と、あっても短い導入の p 1 つだけ。入れ子の ul・ol、ol、パーツ(m-…)・svg・img・table・数式の別行は対象にしない。
|
|
474
|
+
// 1 つ 30 字まで(日本語は字数の数え方 units:全角 1・半角 0.5、英語など日本語でないデッキは文字数)、長さは最長 ÷ 最短 が 2 以下(教材ごとに cap 個まで、そろい方のよいもの=ratio の小さい順。呼ぶ側が絞る)。数式を含む項目・順を表す項目(まず・次に・そこで・最後に、first・next・then・finally で始まる、または → を含む)があれば見ない。表紙・章の扉・static・縦組みは見ない
|
|
475
|
+
{
|
|
476
|
+
const CH = { min: 3, max: 4, len: 30, ratio: 2, lead: 60, cap: 2 }; // cap:1 つの教材で知らせる数の上限(呼ぶ側が、長さのそろい方 ratio の小さい順に残す)
|
|
477
|
+
const bchildren = body ? [...body.children] : [];
|
|
478
|
+
const uls = bchildren.filter((e) => e.tagName === 'UL'), ps = bchildren.filter((e) => e.tagName === 'P');
|
|
479
|
+
if (body && !tate && !['cover', 'sec', 'static'].some((x) => s.classList.contains(x)) && uls.length === 1 && ps.length <= 1 && bchildren.length === uls.length + ps.length
|
|
480
|
+
&& !body.querySelector('ol, table, svg, img, canvas, video, .katex-display, ul ul') && ![...body.querySelectorAll('*')].some((e) => e.tagName.includes('-'))) {
|
|
481
|
+
const lis = [...uls[0].children];
|
|
482
|
+
const len = (t) => (JA ? units(t) : [...t].length);
|
|
483
|
+
const ts = lis.map((li) => vis(li).replace(/\s+/g, ' ').trim());
|
|
484
|
+
const lead = ps.length ? vis(ps[0]).replace(/\s+/g, ' ').trim() : '';
|
|
485
|
+
// 数式を含む項目(組まれた KaTeX の .katex、または組まれずに残った \( \) \[ \] と $…$)と、順を表す項目(まず・次に・そこで・最後に / first・next・then・finally で始まる、または → を含む)は、カードにしない
|
|
486
|
+
const math = lis.some((li) => li.querySelector('.katex')) || ts.some((t) => /\\[(\[]|\$[^$]+\$/.test(t));
|
|
487
|
+
const seq = ts.some((t) => /^[\s\p{P}\p{S}]*(まず|次に|そこで|最後に|(first|next|then|finally)\b)/iu.test(t) || t.includes('→'));
|
|
488
|
+
if (!math && !seq && lis.length >= CH.min && lis.length <= CH.max && lis.every((li) => li.tagName === 'LI') && ts.every((t) => t) && len(lead) <= CH.lead) {
|
|
489
|
+
const ls = ts.map(len), mx = Math.max.apply(null, ls), mn = Math.min.apply(null, ls);
|
|
490
|
+
if (mx <= CH.len && mx / mn <= CH.ratio) add('info', 'cardsHint', { n: lis.length, max: mx, min: mn, ratio: Math.round(mx / mn * 1000) / 1000, cap: CH.cap });
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
472
495
|
// 字と地のコントラスト(見出しと本文。計算した色で。WCAG 4.5:1 より低ければ警告。#128):地は字の要素から上へ、色のある最初の background-color
|
|
473
496
|
// (背景の画像・グラデーションのある所、半透明の重ね、薄く見せている要素は測らない)。いちばん低いものを 1 つ知らせる
|
|
474
497
|
{
|
package/kit/core/llm-fix.mjs
CHANGED
|
@@ -135,8 +135,8 @@ export function buildFixRequest({ problems, deck, narration = '', lang = 'en', l
|
|
|
135
135
|
const rules = guideRules(commonBody(lang === 'ja' ? 'ja' : 'en'));
|
|
136
136
|
const secs = sectionsOf(deck);
|
|
137
137
|
// 言葉からスタックの行とファイルの場所(一時フォルダ・file://・手元のサーバー)を除く(kit/core/error-text.mjs)
|
|
138
|
-
// 情報(sev: 'info'。本文の釣り合い balance など)は直すものではないので載せない(エラー・警告だけ)
|
|
139
|
-
const list = problems.filter((p) => p && p.sev !== 'info' && p.code !== 'balance').map((p) => ({ ...p, text: cleanErrorText(p.text), msg: p.msg === undefined ? undefined : cleanErrorText(p.msg), id: p.i !== null && p.i !== undefined && secs[p.i] ? secs[p.i].id : null, rules: rulesFor(p) }));
|
|
138
|
+
// 情報(sev: 'info'。本文の釣り合い balance・語彙の外の色 colorOutside・カードの提案 cardsHint など)は直すものではないので載せない(エラー・警告だけ)
|
|
139
|
+
const list = problems.filter((p) => p && p.sev !== 'info' && p.code !== 'balance' && p.code !== 'colorOutside' && p.code !== 'cardsHint').map((p) => ({ ...p, text: cleanErrorText(p.text), msg: p.msg === undefined ? undefined : cleanErrorText(p.msg), id: p.i !== null && p.i !== undefined && secs[p.i] ? secs[p.i].id : null, rules: rulesFor(p) }));
|
|
140
140
|
const used = [...new Set(list.flatMap((p) => p.rules))].filter((r) => rules.has(r));
|
|
141
141
|
const out = [M.head, '', M.ask, ''];
|
|
142
142
|
const partial = deck.length + narration.length > limit && list.some((p) => p.id);
|