egatari 0.6.17 → 0.6.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -1
- package/README.ja.md +14 -13
- package/README.md +2 -1
- package/components.lock.json +153 -54
- package/components2.lock.json +1001 -1
- package/kit/build.mjs +1 -1
- package/kit/check-messages.mjs +9 -0
- package/kit/check.mjs +8 -0
- package/kit/core/bookmark.mjs +28 -0
- package/kit/core/build-core.mjs +5 -3
- package/kit/core/check-parity.mjs +6 -0
- package/kit/core/check-rules.mjs +4 -3
- package/kit/core/check-source.mjs +10 -1
- package/kit/core/checks.mjs +79 -0
- package/kit/core/find-replace.mjs +170 -0
- package/kit/core/format.mjs +4 -1
- package/kit/core/image-insert.mjs +197 -0
- package/kit/core/image-size.mjs +1 -1
- package/kit/core/layout-scan.mjs +1 -1
- package/kit/core/llm-fix.mjs +1 -1
- package/kit/core/llm-pack-assemble.mjs +40 -67
- package/kit/core/llm-pack-data.mjs +882 -52
- package/kit/core/llm-pack.mjs +6 -4
- package/kit/core/llm-request.mjs +2 -2
- package/kit/core/new-deck-pack.mjs +38 -44
- package/kit/core/new-deck.mjs +82 -74
- package/kit/core/part-labels.mjs +3 -0
- package/kit/core/portable.mjs +5 -2
- package/kit/core/purposes.mjs +9 -3
- package/kit/core/sample-info.mjs +17 -3
- package/kit/core/scorm.mjs +30 -6
- package/kit/core/script-unclosed.mjs +49 -0
- package/kit/core/slide-ops.mjs +27 -1
- package/kit/core/tate-mix.mjs +25 -0
- package/kit/core/template-text.mjs +2 -0
- package/kit/core/theme-derive.mjs +56 -17
- package/kit/core/theme-shapes.mjs +15 -1
- package/kit/deck.js +124 -6
- package/kit/instruction-version.json +1 -1
- package/kit/layouts.css +8 -0
- package/kit/llm-pack.mjs +5 -7
- package/kit/panes.js +17 -1
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/presenter.js +36 -4
- package/kit/tools.js +54 -2
- package/kit/track.js +46 -5
- package/package.json +1 -1
- package/server/editor-ui.js +21 -1
- package/vendor/components/CATALOG.md +25 -22
- package/vendor/components/sha256/038f9d32c89c8212ab25d6e3180023b6fe024a53053ab2ef1443ecab92e3ce43/index.js +205 -0
- package/vendor/components/sha256/07479cb6e5194a01b2a8a9029f3646060f0dbb673f2737d2132738af2eb379e5/README.en.md +44 -0
- package/vendor/components/sha256/07479cb6e5194a01b2a8a9029f3646060f0dbb673f2737d2132738af2eb379e5/index.js +306 -0
- package/vendor/components/sha256/077678d8b14a8065c4f74a9fe1669728c68a0f763bfdca18b304f5c3d863632a/README.en.md +54 -0
- package/vendor/components/sha256/077678d8b14a8065c4f74a9fe1669728c68a0f763bfdca18b304f5c3d863632a/index.js +470 -0
- package/vendor/components/sha256/0840322bf51eeb3c8188ce21ad70af17c13974ac0151065a39c430a3813ee07f/README.en.md +23 -0
- package/vendor/components/sha256/0840322bf51eeb3c8188ce21ad70af17c13974ac0151065a39c430a3813ee07f/index.js +289 -0
- package/vendor/components/sha256/0c25d49d23529879054737aa181951519fe585c4728fd505e0e3c8869953eac7/index.js +934 -0
- package/vendor/components/sha256/0dd302b82925f35743a893d5c271898ada3659aa0de2d3249ef45936aad10ae0/LICENSE-strokesvg.txt +115 -0
- package/vendor/components/sha256/0dd302b82925f35743a893d5c271898ada3659aa0de2d3249ef45936aad10ae0/OFL.txt +93 -0
- package/vendor/components/sha256/0dd302b82925f35743a893d5c271898ada3659aa0de2d3249ef45936aad10ae0/index.js +755 -0
- package/vendor/components/sha256/0dd302b82925f35743a893d5c271898ada3659aa0de2d3249ef45936aad10ae0/strokes-CHANGES.md +20 -0
- package/vendor/components/sha256/0e9e92df8d70eb6d9fcf10916c361769c7cd37baacece8d7eb96bbbc7fbcf942/README.en.md +25 -0
- package/vendor/components/sha256/0e9e92df8d70eb6d9fcf10916c361769c7cd37baacece8d7eb96bbbc7fbcf942/index.js +317 -0
- package/vendor/components/sha256/12ef6a11055407f5cddc40154a49cf2737b0786429fe0fcc94ee1d8245597b40/index.js +244 -0
- package/vendor/components/sha256/13c9ce43396b2f5693ce430a924dae4ddcd1e8a4ad0c9b9e724ff52acb874d0c/index.js +354 -0
- package/vendor/components/sha256/15306d854d67d52ca2b1d66135f0d3296882e6b21fd85c029399b8077c8a7f9d/README.en.md +34 -0
- package/vendor/components/sha256/15306d854d67d52ca2b1d66135f0d3296882e6b21fd85c029399b8077c8a7f9d/index.js +398 -0
- package/vendor/components/sha256/1a0f21def0efbbdef64461cafa40f3883bc7f7122adf79d01f09ca4a245e5dcb/index.js +465 -0
- package/vendor/components/sha256/208175d05b37d326855fad792b10137f785e5d05d91a2cde119d0dbd69d2ed98/index.js +100 -0
- package/vendor/components/sha256/218d88998b70f0732c18d91ccc238b2d63f6b0aaa483883b83685a25468f214a/README.en.md +34 -0
- package/vendor/components/sha256/218d88998b70f0732c18d91ccc238b2d63f6b0aaa483883b83685a25468f214a/index.js +246 -0
- package/vendor/components/sha256/2579bcb46b6525902763cd15a2e08fc5ebd9a2695cdaba63438e5b47907a47e0/README.en.md +24 -0
- package/vendor/components/sha256/2579bcb46b6525902763cd15a2e08fc5ebd9a2695cdaba63438e5b47907a47e0/index.js +554 -0
- package/vendor/components/sha256/277ac772315f93737a094cd0f0842726f2435d352d9a90822aebfe0d5d7e79a1/README.en.md +23 -0
- package/vendor/components/sha256/277ac772315f93737a094cd0f0842726f2435d352d9a90822aebfe0d5d7e79a1/index.js +294 -0
- package/vendor/components/sha256/2787e410e533e4ad48b0a3c2b652579cf5797f9c51fcf32f5478212a7acef95f/README.en.md +28 -0
- package/vendor/components/sha256/2787e410e533e4ad48b0a3c2b652579cf5797f9c51fcf32f5478212a7acef95f/index.js +214 -0
- package/vendor/components/sha256/2a011338d0fc3c77e102eaa57cde2b6e3726bc279f133174b0b8c9a654263cbc/index.js +824 -0
- package/vendor/components/sha256/2fce5ab0c31dca0aa1586a2c69237870a9cce46c0bc6ab7392c27968d016bd15/index.js +75 -0
- package/vendor/components/sha256/3417efe4722f569690563d9abcea8b144db2f8fa97b83cf0118fb3a34cd4cb2b/README.en.md +23 -0
- package/vendor/components/sha256/3417efe4722f569690563d9abcea8b144db2f8fa97b83cf0118fb3a34cd4cb2b/index.js +150 -0
- package/vendor/components/sha256/3a7962fa87c670447eed54aca08604ef03cd26bf2c334b4667190060e6a17965/README.en.md +18 -0
- package/vendor/components/sha256/3a7962fa87c670447eed54aca08604ef03cd26bf2c334b4667190060e6a17965/index.js +279 -0
- package/vendor/components/sha256/3be5f64deb1951327b614b29a9b632878fab362687c76e3f48f3af1d1ebbb1cf/README.en.md +47 -0
- package/vendor/components/sha256/3be5f64deb1951327b614b29a9b632878fab362687c76e3f48f3af1d1ebbb1cf/index.js +223 -0
- package/vendor/components/sha256/42450c6b36404d66641568f6d6f55e42a4a036d4d9cdf308f709464913b32fe9/README.en.md +42 -0
- package/vendor/components/sha256/42450c6b36404d66641568f6d6f55e42a4a036d4d9cdf308f709464913b32fe9/index.js +272 -0
- package/vendor/components/sha256/45cea6c1abfb3467e3e3dbe7fec58647716999a0c39cf7163531ae389f898d29/README.en.md +30 -0
- package/vendor/components/sha256/45cea6c1abfb3467e3e3dbe7fec58647716999a0c39cf7163531ae389f898d29/index.js +305 -0
- package/vendor/components/sha256/4c8cae404d551a1bb021e8345af5aa45d4f412f13497aa84b142f11a29a365dc/index.js +124 -0
- package/vendor/components/sha256/5521b5b40a43c48c5ae5a50ce87afb3d47bb23b133b16841086d8322364cdd5e/README.en.md +23 -0
- package/vendor/components/sha256/5521b5b40a43c48c5ae5a50ce87afb3d47bb23b133b16841086d8322364cdd5e/index.js +120 -0
- package/vendor/components/sha256/5fe30fd7a84b937a1325d8af2b8e437211efae82ab46d5a433bc4ef07bcaef11/README.en.md +18 -0
- package/vendor/components/sha256/5fe30fd7a84b937a1325d8af2b8e437211efae82ab46d5a433bc4ef07bcaef11/index.js +243 -0
- package/vendor/components/sha256/631f4c4b90c9a41c0f26c9600d5cf2d6447251d04a20f08f48a85aeb4cb0f6fb/index.js +107 -0
- package/vendor/components/sha256/6749f44ed6476a05d4e3026373c188a0e1a19b77a5836579813f62a1477ac35e/README.en.md +31 -0
- package/vendor/components/sha256/6749f44ed6476a05d4e3026373c188a0e1a19b77a5836579813f62a1477ac35e/index.js +271 -0
- package/vendor/components/sha256/701f1deef79fe05eeb18e1119e5a5c4d60a9dfe265e93a4dff79223bc598dbf0/index.js +521 -0
- package/vendor/components/sha256/711cf58fa946c9c0abc953b2f695d02bf5a5a7f73851b09f834e894baf88be38/index.js +122 -0
- package/vendor/components/sha256/728576c57a5ccb39531ad4cb8074fce95480f01603a77dbf57dca0e52199f7c4/index.js +37 -0
- package/vendor/components/sha256/73edc74a2dc4a63b717106c1c1572967b6d306270574e9635d032de16c8ada72/README.en.md +18 -0
- package/vendor/components/sha256/73edc74a2dc4a63b717106c1c1572967b6d306270574e9635d032de16c8ada72/index.js +382 -0
- package/vendor/components/sha256/76bdb63c3e5e14fbb4816bc9f235490817bb5d7be990a826f5077aa08226702c/index.js +162 -0
- package/vendor/components/sha256/7a5adf73fc053b9f2ca56643b5683b42589edb0f63c845ecb7ae7e6b87eccc30/README.en.md +51 -0
- package/vendor/components/sha256/7a5adf73fc053b9f2ca56643b5683b42589edb0f63c845ecb7ae7e6b87eccc30/index.js +230 -0
- package/vendor/components/sha256/7ab483e7fb05f646b062340d70f2749d070b4f64fed7acc0b8a7754d9ef9fded/README.en.md +26 -0
- package/vendor/components/sha256/7ab483e7fb05f646b062340d70f2749d070b4f64fed7acc0b8a7754d9ef9fded/index.js +322 -0
- package/vendor/components/sha256/7af6e5e6dffb618b39f27d883c691ca128f3af06040ee505e75c79c678bfdcfe/README.en.md +18 -0
- package/vendor/components/sha256/7af6e5e6dffb618b39f27d883c691ca128f3af06040ee505e75c79c678bfdcfe/index.js +103 -0
- package/vendor/components/sha256/7c7b0373cfd38fd5ecb4169021e0b908f0a17be1a29b14f85dd89fdb92e7bf81/README.en.md +44 -0
- package/vendor/components/sha256/7c7b0373cfd38fd5ecb4169021e0b908f0a17be1a29b14f85dd89fdb92e7bf81/index.js +306 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/chords.json +89 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/extras.json +192 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/fixtures/ties.json +360 -0
- package/vendor/components/sha256/7dea2c3728b85122b04515aa06ab198657529e7cd101b9ab34d4ecb2905ce94e/index.js +508 -0
- package/vendor/components/sha256/832556ea9c82c292a3ba9e1b332f2405c5c2f969ff8157c91ed80226ec8ac62e/README.en.md +22 -0
- package/vendor/components/sha256/832556ea9c82c292a3ba9e1b332f2405c5c2f969ff8157c91ed80226ec8ac62e/index.js +145 -0
- package/vendor/components/sha256/8a4b6dce84d7a69aaafeb75c1c572fe7904fd49e3169c1c85851ccaeae2a7b11/index.js +41 -0
- package/vendor/components/sha256/8bb511cb90902bc7721e59ca08685b26adbf33539e36a4a45172485d6d3d455b/index.js +250 -0
- package/vendor/components/sha256/8db9c936c36b79b9e3b2be37639487b15502a6937f411ed714621a8091437e9b/README.en.md +21 -0
- package/vendor/components/sha256/8db9c936c36b79b9e3b2be37639487b15502a6937f411ed714621a8091437e9b/index.js +108 -0
- package/vendor/components/sha256/8e5e90c90cb6b06a790b0420e43d79d7da663f1cc19ff06d381ec849b4a8fc57/index.js +312 -0
- package/vendor/components/sha256/939bdae590ebed3d182b0c9940a35b6c03872505bfa242341990a81cae02fd06/README.en.md +34 -0
- package/vendor/components/sha256/939bdae590ebed3d182b0c9940a35b6c03872505bfa242341990a81cae02fd06/index.js +397 -0
- package/vendor/components/sha256/9c5dd0bc0c3279c5f0fea3fdb9d0735870880aef96e8bbf9ecdd77dff0f5ddc8/README.en.md +44 -0
- package/vendor/components/sha256/9c5dd0bc0c3279c5f0fea3fdb9d0735870880aef96e8bbf9ecdd77dff0f5ddc8/index.js +551 -0
- package/vendor/components/sha256/a1c2b2fa06e4229815ab82a9202c266ec887a67632a175854c7d136a92389ca3/index.js +69 -0
- package/vendor/components/sha256/a5b032657720d3beb64f0b3699954e13b0eb985f36161b9ae046c83fd6048ff5/README.en.md +18 -0
- package/vendor/components/sha256/a5b032657720d3beb64f0b3699954e13b0eb985f36161b9ae046c83fd6048ff5/index.js +382 -0
- package/vendor/components/sha256/a7c4282db79d46557bdbaf84ca519606dc46f3c23455db4a26f663453f85813c/README.en.md +38 -0
- package/vendor/components/sha256/a7c4282db79d46557bdbaf84ca519606dc46f3c23455db4a26f663453f85813c/index.js +414 -0
- package/vendor/components/sha256/aac2f8a23cb1b606e9635061cb288f006588c80a7258540cae846ae677f55ff5/index.js +238 -0
- package/vendor/components/sha256/ace7e82e866b577ad42bbc4b64e11bae18982e3236aadceb6c2e6c20f41234cf/README.en.md +45 -0
- package/vendor/components/sha256/ace7e82e866b577ad42bbc4b64e11bae18982e3236aadceb6c2e6c20f41234cf/index.js +211 -0
- package/vendor/components/sha256/aeb0b9b5991a5c1df7191c397780a699f2c7310123ca210a58486c0a23e44006/index.js +342 -0
- package/vendor/components/sha256/af3355efd6739a56c6cb53990100f41703361c475c123b9b2762421c68509036/index.js +315 -0
- package/vendor/components/sha256/b10183a66b58b827a1410cf8b0117af567647684464d5777529dc66f0cea343a/LICENSE-tabler.txt +21 -0
- package/vendor/components/sha256/b10183a66b58b827a1410cf8b0117af567647684464d5777529dc66f0cea343a/index.js +4868 -0
- package/vendor/components/sha256/b10183a66b58b827a1410cf8b0117af567647684464d5777529dc66f0cea343a/names.txt +4808 -0
- package/vendor/components/sha256/b348ea64cc19632df96a91dfd7c435e4a62095aede72b504d03537be70d6d930/index.js +606 -0
- package/vendor/components/sha256/b53bfa03d1e9feb3cb492f440bf9d100c96eb4fe6b76c42b512a56e9158829cd/index.js +351 -0
- package/vendor/components/sha256/b9443e1cdac4850b1ead9f8449a3061678bbb77fbc53eb9b23d01e1cf50750c3/index.js +619 -0
- package/vendor/components/sha256/bc1e2a02c959ac203819d03c0d25b3776a6a9a4290aae860b26cbbe3d29e876d/index.js +268 -0
- package/vendor/components/sha256/beeb180c0e2250bb04490b092c0a235cae47fca2ed1de2d9ef078a5c14b1a963/index.js +429 -0
- package/vendor/components/sha256/c5fd7713e55e96d75824a21146c0251896d7d9dd028b4d169191433135a97981/index.js +200 -0
- package/vendor/components/sha256/c61987e9994940fc668ed8a010e575ee52027b54ed9c5dd1cc9fdf67649092b3/index.js +404 -0
- package/vendor/components/sha256/ccc8bfe174b6903ec254dfef4f5d1c614271ea39963649add7fcb8d83c081eba/index.js +278 -0
- package/vendor/components/sha256/da267bc65fde0a9279127d5a82f6c253ad74984da6fb11391f00604ad9ffe80d/index.js +93 -0
- package/vendor/components/sha256/dea36cd7010991a572ef394ee32b5e17564aeff09d3ec4ed3820d7e43c9a58be/index.js +484 -0
- package/vendor/components/sha256/df3fdb2aed487d4f6e60a8abab1fe0d1e9fa2a4193fd162edf3c384ea8db5a1b/index.js +180 -0
- package/vendor/components/sha256/e27d517f39eb554c7a9ecea7b59fcf1d347c4deeb3fe2250797aa233bfb7e2b0/index.js +747 -0
- package/vendor/components/sha256/e31f6b058503f7980597c89b3e964c512ee08de7cba3fa99904d499abbb5d0e8/README.en.md +20 -0
- package/vendor/components/sha256/e31f6b058503f7980597c89b3e964c512ee08de7cba3fa99904d499abbb5d0e8/index.js +310 -0
- package/vendor/components/sha256/f4100076a37dbde6046d85969d651feffc925bd984ffe9f333ea9bd2b6816918/README.en.md +30 -0
- package/vendor/components/sha256/f4100076a37dbde6046d85969d651feffc925bd984ffe9f333ea9bd2b6816918/index.js +192 -0
- package/vendor/components/sha256/fa6442fa3c5082cf161c29308fe0ecbd85fa33e8e4bad08c12e7961b46b1365b/README.en.md +24 -0
- package/vendor/components/sha256/fa6442fa3c5082cf161c29308fe0ecbd85fa33e8e4bad08c12e7961b46b1365b/index.js +214 -0
- package/vendor/components-2/manifest-2.16.0.json +2919 -0
- package/vendor/components-2/manifest-2.17.0.json +2852 -0
- package/vendor/components-2/manifest-2.18.0.json +3182 -0
- package/vendor/components-2/manifest-2.20.0.json +3217 -0
- package/vendor/components-2/manifest-2.21.0.json +3220 -0
- package/vendor/egatari-spec/SOURCE.json +2 -2
- package/vendor/egatari-spec/schema/deck-meta.schema.json +3 -0
- package/vendor/egatari-spec/schema/egatari-metadata.schema.json +6 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// 閉じていない <script>(handoff #96):パーツのデータの <script type="application/json"> に </script> がないと、HTML の読み方では
|
|
2
|
+
// 次の </script> か原稿の終わりまでが <script> の中の文字になる。後ろのスライドは DOM に現れず(id も付かない)、台本の節は
|
|
3
|
+
// 「スライドが見つからない」、組み立てた文書の再生器の <script> まで飲み込んで、前のスライドの台本まで「ない」と出る。
|
|
4
|
+
// 原因の 1 か所を指す。Node にもブラウザにも依存しない(純粋な ESM)。品質チェックのコマンド版(kit/check.mjs)と編集アプリ(kit/core/check-source.mjs)が同じものを出す
|
|
5
|
+
// scriptUnclosedFindings(src) → [{i(その <script> があるスライドの番号か null), sev: 'error', code: 'scriptUnclosed', a: {line, n, headings}}]
|
|
6
|
+
// 閉じていないとみなす <script>:終わりのタグがない・中にスライドの開始タグ(<section class="slide">)がある・
|
|
7
|
+
// データの <script type="application/json"> の中にパーツの終わりのタグ(</m-…>)がある
|
|
8
|
+
// headings:<script> の中に入ったスライドの見出し(n 枚。見出しのないスライドは '')
|
|
9
|
+
import { parse } from 'parse5';
|
|
10
|
+
|
|
11
|
+
const SLIDE_START = /<section\b[^>]*\bclass\s*=\s*(?:"[^"]*\bslide\b[^"]*"|'[^']*\bslide\b[^']*'|slide\b)[^>]*>/gi;
|
|
12
|
+
const attr = (n, name) => (n.attrs || []).find((a) => a.name === name)?.value;
|
|
13
|
+
const isSlide = (n) => n.tagName === 'section' && (attr(n, 'class') || '').split(/\s+/).includes('slide');
|
|
14
|
+
const plain = (s) => s.replace(/<br\s*\/?>/gi, ' ').replace(/<[^>]*>/g, '').replace(/\s+/g, ' ').trim();
|
|
15
|
+
|
|
16
|
+
function swallowedHeadings(text) {
|
|
17
|
+
const starts = [...text.matchAll(SLIDE_START)].map((m) => m.index + m[0].length);
|
|
18
|
+
return starts.map((at, k) => {
|
|
19
|
+
const part = text.slice(at, k + 1 < starts.length ? starts[k + 1] : text.length);
|
|
20
|
+
const h = part.match(/<h([12])\b[^>]*>([\s\S]*?)<\/h\1>/i);
|
|
21
|
+
return h ? plain(h[2]) : '';
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function scriptUnclosedFindings(src) {
|
|
26
|
+
if (typeof src !== 'string' || !src || !/<script\b/i.test(src)) return [];
|
|
27
|
+
const doc = parse(src, { sourceCodeLocationInfo: true });
|
|
28
|
+
const out = [];
|
|
29
|
+
let slide = -1;
|
|
30
|
+
const lineOf = (off) => src.slice(0, off).split('\n').length;
|
|
31
|
+
const visit = (node, inSlide) => {
|
|
32
|
+
let here = inSlide;
|
|
33
|
+
if (node.tagName && isSlide(node) && inSlide === null) { slide++; here = slide; }
|
|
34
|
+
if (node.tagName === 'script' && node.sourceCodeLocation) {
|
|
35
|
+
const loc = node.sourceCodeLocation;
|
|
36
|
+
const text = (node.childNodes || []).map((c) => c.value || '').join('');
|
|
37
|
+
const json = /^\s*application\/(?:ld\+)?json\s*$/i.test(attr(node, 'type') || '');
|
|
38
|
+
if (!loc.endTag || new RegExp(SLIDE_START.source, 'i').test(text) || (json && /<\/m-[a-z]/i.test(text))) {
|
|
39
|
+
const headings = swallowedHeadings(text);
|
|
40
|
+
out.push({ i: here, sev: 'error', code: 'scriptUnclosed', a: { line: lineOf(loc.startOffset), n: headings.length, headings } });
|
|
41
|
+
}
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
for (const c of node.childNodes || []) visit(c, here);
|
|
45
|
+
if (node.content) visit(node.content, here);
|
|
46
|
+
};
|
|
47
|
+
visit(doc, null);
|
|
48
|
+
return out;
|
|
49
|
+
}
|
package/kit/core/slide-ops.mjs
CHANGED
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
// narration:sectionsOf(text)・insertSection(text, order, key, lines)・copySections(text, fromKey, slide)・removeSections(text, key)・reorderSections(text, order)
|
|
13
13
|
// manifest:removeAudio(text, slideKey) → {out, removed: {鍵: 記録}, files: [もう使われない audio/ の下のファイル]}
|
|
14
14
|
// newIdFor(src, rand?) → 文書のどの id・スライドの鍵とも重ならない s-xxxxxx
|
|
15
|
+
// setBookmark(src, index, name) → 文字列 index 番目の <section> の data-bookmark(しおり、format spec §8.0)を name に。name が空・null なら外す
|
|
15
16
|
import { parse } from 'parse5';
|
|
16
17
|
import { analyzeSlideIds } from './build-core.mjs';
|
|
17
18
|
import { newSlideId, headingLine, parseHeading, splitKey } from './narration-core.mjs';
|
|
18
19
|
import { TEMPLATE_TEXT, placeholderLine } from './template-text.mjs';
|
|
19
20
|
|
|
20
|
-
export const TEMPLATES = ['title-body', 'two-cols', 'figure', 'section', 'quote'];
|
|
21
|
+
export const TEMPLATES = ['title-body', 'two-cols', 'figure', 'section', 'quote', 'source'];
|
|
21
22
|
|
|
22
23
|
function walk(node, fn) {
|
|
23
24
|
fn(node);
|
|
@@ -153,6 +154,27 @@ export function moveSlide(src, from, to) {
|
|
|
153
154
|
return assemble(gaps, chunks, tail);
|
|
154
155
|
}
|
|
155
156
|
|
|
157
|
+
// しおり(format spec §8.0):<section> の開始タグの data-bookmark だけを書き換える(ほかのバイトは変えない)
|
|
158
|
+
const escAttr = (v) => String(v).replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<');
|
|
159
|
+
export function setBookmark(src, index, name) {
|
|
160
|
+
need(src);
|
|
161
|
+
const doc = parse(src, { sourceCodeLocationInfo: true });
|
|
162
|
+
let node = null, n = 0;
|
|
163
|
+
walk(doc, (x) => { if (x.tagName && isSlide(x)) { if (n === index) node = x; n++; } });
|
|
164
|
+
if (!node) throw Object.assign(new Error(`no slide ${index + 1}`), { code: 'no-slide' });
|
|
165
|
+
const tag = node.sourceCodeLocation.startTag, at = tag.attrs && tag.attrs['data-bookmark'];
|
|
166
|
+
const v = String(name == null ? '' : name).replace(/\s+/g, ' ').trim();
|
|
167
|
+
if (at) {
|
|
168
|
+
if (v) return src.slice(0, at.startOffset) + `data-bookmark="${escAttr(v)}"` + src.slice(at.endOffset);
|
|
169
|
+
let b = at.startOffset; while (b > tag.startOffset && /\s/.test(src[b - 1])) b--; // 前の空白ごと外す
|
|
170
|
+
return src.slice(0, b) + src.slice(at.endOffset);
|
|
171
|
+
}
|
|
172
|
+
if (!v) return src;
|
|
173
|
+
let e = tag.endOffset - 1; if (src[e - 1] === '/') e--;
|
|
174
|
+
while (e > tag.startOffset && /\s/.test(src[e - 1])) e--;
|
|
175
|
+
return src.slice(0, e) + ` data-bookmark="${escAttr(v)}"` + src.slice(e);
|
|
176
|
+
}
|
|
177
|
+
|
|
156
178
|
export function newIdFor(src, rand) {
|
|
157
179
|
const a = analyzeSlideIds(src);
|
|
158
180
|
const taken = new Set([...a.docIds.keys(), ...a.slides.map((s) => s.key)]);
|
|
@@ -177,6 +199,10 @@ export function slideTemplate(kind, { lang = 'ja', id }) {
|
|
|
177
199
|
} else if (kind === 'figure') {
|
|
178
200
|
html = `<section class="slide"${sid}>\n <h2>${t.h}</h2>\n <div class="body">\n <div class="fig"><svg viewBox="0 0 1184 360" role="img" aria-label="${t.fig}"><rect x="2" y="2" width="1180" height="356" rx="12" style="fill:none;stroke:var(--line);stroke-width:3;stroke-dasharray:12 8"/><text x="592" y="190" text-anchor="middle" style="fill:var(--muted);font-size:32px">${t.fig}</text></svg></div>\n <p class="figcap">${t.cap}</p>\n </div>\n <div class="concl"><span>${t.concl}</span></div>\n</section>`;
|
|
179
201
|
steps = [['0', P(t.n)], ['concl', P(t.nc)]];
|
|
202
|
+
} else if (kind === 'source') {
|
|
203
|
+
// 出典の行(handoff #86):結論の行の上に <p class="source">(kit/layouts.css。小さく灰色)。数字・図・引用の出どころを書く
|
|
204
|
+
html = `<section class="slide"${sid}>\n <h2>${t.h}</h2>\n <div class="body">\n <ul>\n <li>${t.li[0]}</li>\n </ul>\n </div>\n <p class="source">${t.src}</p>\n <div class="concl"><span>${t.concl}</span></div>\n</section>`;
|
|
205
|
+
steps = [['0', P(t.n)], ['1', P(t.ni[0])], ['concl', P(t.nc)]];
|
|
180
206
|
} else if (kind === 'section') {
|
|
181
207
|
html = `<section class="slide sec noconcl static"${sid}>\n <h1>${t.h}</h1>\n <div class="lead">${t.lead}</div>\n</section>`;
|
|
182
208
|
steps = [['0', P(t.n)]];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// 縦と横の入れ替わり(handoff #70、作者 2026-11-21):縦書き(layout-tate)と横書きのスライドが何度も入れ替わると、読む向きと見出し・結論の行の位置が
|
|
2
|
+
// そのたびに変わって読みにくい。表紙と扉を除いたスライドを順に見て、縦かどうかが前のスライドと変わった回数を数え、TATE_SWITCH_MAX 回以上なら警告する。
|
|
3
|
+
// Node にもブラウザにも依存しない(純粋な ESM)。品質チェックのコマンド版(kit/check.mjs)と編集アプリ(kit/core/check-source.mjs)が同じものを出す
|
|
4
|
+
// TATE_SWITCH_MAX 警告する回数(3)
|
|
5
|
+
// tateSwitches(slides) analyzeSlideIds の slides → 入れ替わりの回数
|
|
6
|
+
// tateMixFindings(src) 原稿の文字列 → [{i, sev, code: 'tateMixed', a: {n}}](最初に入れ替わったスライドに 1 つ)
|
|
7
|
+
import { analyzeSlideIds } from './build-core.mjs';
|
|
8
|
+
|
|
9
|
+
export const TATE_SWITCH_MAX = 3;
|
|
10
|
+
|
|
11
|
+
export function tateSwitches(slides) {
|
|
12
|
+
let n = 0, prev = null, first = null;
|
|
13
|
+
for (const s of slides) {
|
|
14
|
+
if (s.cover) continue;
|
|
15
|
+
if (prev !== null && s.tate !== prev) { n++; if (first === null) first = s.index; }
|
|
16
|
+
prev = s.tate;
|
|
17
|
+
}
|
|
18
|
+
return { n, first };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function tateMixFindings(src) {
|
|
22
|
+
if (typeof src !== 'string' || !src) return [];
|
|
23
|
+
const { n, first } = tateSwitches(analyzeSlideIds(src).slides);
|
|
24
|
+
return n >= TATE_SWITCH_MAX ? [{ i: first, sev: 'warn', code: 'tateMixed', a: { n } }] : [];
|
|
25
|
+
}
|
|
@@ -24,6 +24,7 @@ export const TEMPLATE_TEXT = Object.freeze({
|
|
|
24
24
|
figure: { h: '図の題', fig: '図をここに', cap: '図 1:図の説明', concl: '→ 図から読み取れること', n: '図を指しながら話すことを書く', nc: '結論の行で話すことを書く' },
|
|
25
25
|
section: { h: '新しい章の題', lead: 'この章で話すこと', n: 'この章で話すことを書く' },
|
|
26
26
|
quote: { h: '引用の題', q: '「引用する文をここに書く」', cite: '— 出典', n: '引用を読み上げ、何を言っているかを書く' },
|
|
27
|
+
source: { h: '出典のあるスライドの見出し', li: ['数字や図を使う項目'], src: '出典:資料の名前(発行者、年)', concl: '⇒ このスライドの結論', n: 'このスライドで話すことを書く', ni: ['項目で話すことを書く'], nc: '結論の行で話すことを書く' },
|
|
27
28
|
},
|
|
28
29
|
en: {
|
|
29
30
|
'title-body': { h: 'New slide heading', li: ['First point', 'Second point'], concl: '⇒ The point of this slide', n: 'Write what you say on this slide', ni: ['Write what you say with the first point', 'Write what you say with the second point'], nc: 'Write what you say with the conclusion line' },
|
|
@@ -31,6 +32,7 @@ export const TEMPLATE_TEXT = Object.freeze({
|
|
|
31
32
|
figure: { h: 'Figure title', fig: 'Figure goes here', cap: 'Figure 1: what it shows', concl: '→ What the figure shows', n: 'Write what you say while pointing at the figure', nc: 'Write what you say with the conclusion line' },
|
|
32
33
|
section: { h: 'New chapter title', lead: 'What this chapter covers', n: 'Write what this chapter covers' },
|
|
33
34
|
quote: { h: 'Quote title', q: '“Write the quoted text here.”', cite: '— Source', n: 'Read the quote and write what it means' },
|
|
35
|
+
source: { h: 'Slide heading with a source', li: ['A point with a number or a figure'], src: 'Source: name of the document (publisher, year)', concl: '⇒ The point of this slide', n: 'Write what you say on this slide', ni: ['Write what you say with the point'], nc: 'Write what you say with the conclusion line' },
|
|
34
36
|
},
|
|
35
37
|
});
|
|
36
38
|
const NARR_KEYS = new Set(['n', 'ni', 'nc']);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// テーマを作る画面(backlog #58 stage 2)の計算:
|
|
2
2
|
// 基調色 1 つからほかの色を導き、裏で色を確かめ、通らないときは通るいちばん近い色を探し、テーマのファイル(tokens.css・theme.json)を書く。
|
|
3
3
|
// 外の名前を使わない(ブラウザでも Node でも動く。app/theme-workshop.js と tools/test-theme-derive.mjs が使う)。色の計算は kit/core/color-check.mjs
|
|
4
4
|
//
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
// 白飛び(明るい部屋の投影。周りの光 15%):用語の色と地のコントラスト 3:1 以上(fail)
|
|
21
21
|
// 印刷:書き出す tokens.css が章の扉と表紙に print-color-adjust:exact を書くので、背景のグラフィックを印刷しない設定でも地が消えない(検査は要らない)
|
|
22
22
|
import { contrast, de76, de2000, simulate, hex2rgb, rgb2hex, relLum } from './color-check.mjs';
|
|
23
|
+
import { BACKGROUNDS, FONT_KINDS, fontKindOf, cleanLook, COVER_BAND_TEXT, lookCss, lookIn, withoutLooks } from './theme-shapes.mjs';
|
|
23
24
|
import { FONT_LIST } from './build-core.mjs';
|
|
24
25
|
|
|
25
26
|
// ---------------------------------------------------------------- OKLab / OKLCH(Björn Ottosson 2020)
|
|
@@ -85,7 +86,7 @@ export function deriveTheme(base, overrides = {}) {
|
|
|
85
86
|
// ---------------------------------------------------------------- 確かめる
|
|
86
87
|
export const NEED = Object.freeze({ text: 4.5, washout: 3, de76: 35, de2000: 20, grey: 8, greyFail: 4, redHue: 25 });
|
|
87
88
|
// input:{base, overrides}。返すのは通らなかったものだけ
|
|
88
|
-
export function checkTheme(t, { coverBg = null, overrides = {} } = {}) {
|
|
89
|
+
export function checkTheme(t, { coverBg = null, overrides = {}, look = {} } = {}) {
|
|
89
90
|
const out = [];
|
|
90
91
|
const who = (k) => (overrides && overrides[k] ? k : 'base'); // 直すときに替える入力
|
|
91
92
|
const text = (id, fg, bg, token) => { const v = contrast(fg, bg); if (v < NEED.text) out.push({ id, level: 'fail', token, value: v, need: NEED.text }); };
|
|
@@ -93,8 +94,11 @@ export function checkTheme(t, { coverBg = null, overrides = {} } = {}) {
|
|
|
93
94
|
text('title-contrast', t.title, t.bg, who('title'));
|
|
94
95
|
text('accent2-contrast', t.accent2, t.bg, who('accent2'));
|
|
95
96
|
text('sec-contrast', t['sec-fg'], t['sec-bg'], 'base');
|
|
97
|
+
if (look.heading === 'band') text('heading-band', t['sec-fg'], t.base, 'base');
|
|
98
|
+
const bandText = COVER_BAND_TEXT[look.cover];
|
|
99
|
+
if (bandText) text('cover-band', t[bandText], t.base, 'base');
|
|
96
100
|
if (overrides && overrides.emph) { text('emph-contrast', t.emph, t.bg, 'emph'); text('concl-contrast', t.emph, t['concl-bg'], 'emph'); }
|
|
97
|
-
if (coverBg) text('cover-title', t.title, coverBg, 'cover');
|
|
101
|
+
if (coverBg) text('cover-title', look.cover === 'left-bar' ? t.fg : t.title, coverBg, 'cover');
|
|
98
102
|
// 色覚:結論の色と用語の色
|
|
99
103
|
const ct = overrides && overrides.term ? 'term' : overrides && overrides.emph ? 'emph' : 'base';
|
|
100
104
|
let worst = null;
|
|
@@ -115,7 +119,7 @@ export function checkTheme(t, { coverBg = null, overrides = {} } = {}) {
|
|
|
115
119
|
if (w < NEED.washout) out.push({ id: 'washout', level: 'fail', token: who('term'), value: w, need: NEED.washout });
|
|
116
120
|
return out;
|
|
117
121
|
}
|
|
118
|
-
export const checkInput = (input, opts = {}) => checkTheme(
|
|
122
|
+
export const checkInput = (input, opts = {}) => checkTheme(builderTokens(input), { ...opts, look: input.look || {}, overrides: input.overrides || {} });
|
|
119
123
|
|
|
120
124
|
// ---------------------------------------------------------------- 直す色を探す
|
|
121
125
|
// token の fail がなくなる色のうち、元の色にいちばん近いもの(CIEDE2000)。OKLCH の明るさを動かし、色相も ±90° まで回して探す
|
|
@@ -170,24 +174,31 @@ export const fontStack = (family) => {
|
|
|
170
174
|
const f = FONT_CHOICES.find((x) => x.family === family) || FONT_CHOICES[0];
|
|
171
175
|
return `"${f.family}", ${SERIF.test(f.family) ? (f.group === 'ja' ? '"Hiragino Mincho ProN", "Yu Mincho", serif' : 'Georgia, serif') : FALLBACK[f.group] || 'sans-serif'}`;
|
|
172
176
|
};
|
|
173
|
-
const TOKEN_ORDER = ['base', 'title', 'complement', 'accent2', 'base-tint', 'base-wash', 'comp-tint', 'term', 'emph', 'ramp-1', 'ramp-2', 'ramp-3', 'ramp-4', 'ramp-5'];
|
|
177
|
+
const TOKEN_ORDER = ['base', 'rule', 'title', 'complement', 'accent2', 'base-tint', 'base-wash', 'comp-tint', 'term', 'emph', 'ramp-1', 'ramp-2', 'ramp-3', 'ramp-4', 'ramp-5'];
|
|
174
178
|
// input:{base, overrides, font}。coverImage:'data:image/…;base64,…'(そのまま tokens.css に入る。テーマの hash と 1 ファイルに入る。#171(b))
|
|
175
|
-
export function themeFiles(input, { name, title = '', coverImage = '', results = null } = {}) {
|
|
176
|
-
const t =
|
|
177
|
-
const
|
|
179
|
+
export function themeFiles(input, { name, title = '', coverImage = '', coverBg = null, results = null } = {}) {
|
|
180
|
+
const t = builderTokens(input);
|
|
181
|
+
const source = input.source;
|
|
182
|
+
const family = FONT_CHOICES.some((f) => f.family === input.font) ? input.font : FONT_KINDS[input.fontKind] || FONT_CHOICES[0].family;
|
|
183
|
+
const look = cleanLook(input.look);
|
|
184
|
+
const res = results || checkInput(input, { coverBg });
|
|
178
185
|
const head = [`/* ${title || name}: made with the theme builder in Egatari Studio (New…, step 3, Custom).`,
|
|
179
186
|
` Main colour ${t.base}. The other colours are worked out from it${Object.keys(input.overrides || {}).length ? '; changed by hand: ' + Object.keys(input.overrides).join(', ') : ''}.`,
|
|
180
187
|
` Checks: ${res.length ? res.map((x) => `${x.level} ${x.id}`).join(', ') : 'all passed'}. */`];
|
|
181
|
-
const
|
|
182
|
-
lines
|
|
188
|
+
const recolour = !source || normHex(input.base) !== source.base;
|
|
189
|
+
const lines = (recolour ? [...TOKEN_ORDER, 'fg', 'muted', 'concl-bg', 'sec-bg', 'sec-fg'] : EDITABLE.filter((k) => isHex(input.overrides?.[k]))).map((k) => ` --${k}: ${t[k]};`);
|
|
190
|
+
if (!source || family !== source.font) lines.push(` --font-sans: ${fontStack(family)};`);
|
|
191
|
+
if (!source || input.background !== source.background) lines.push(` --bg: ${BACKGROUNDS[input.background] || BACKGROUNDS.white};`, ' --cover-bg: var(--bg);');
|
|
183
192
|
if (coverImage) lines.push(` --cover-bg: url("${coverImage}") center / cover no-repeat var(--bg);`);
|
|
184
|
-
const css = [...head, ':root{', ...lines, '}',
|
|
193
|
+
const css = [...head, source ? withoutLooks(source.css) : '', ':root{', ...lines, '}', lookCss(look),
|
|
194
|
+
source && family !== source.font ? `.slide h2,.slide.cover h1,.slide.sec h1,.slide.sec h2{font-family:var(--font-sans)}` : '',
|
|
185
195
|
'/* print the section divider and cover backgrounds even when the browser does not print background graphics */',
|
|
186
196
|
'@media print{.slide.sec,.slide.cover{-webkit-print-color-adjust:exact;print-color-adjust:exact}}', ''].join('\n');
|
|
187
|
-
const f = FONT_CHOICES.find((x) => x.family ===
|
|
197
|
+
const f = FONT_CHOICES.find((x) => x.family === family);
|
|
188
198
|
const json = { name, ...(title ? { title } : {}), extends: 'default', version: '1.0.0',
|
|
189
|
-
...(f && !f.default ? { fonts: { body: f.family } } : {}),
|
|
190
|
-
|
|
199
|
+
...((source && family === source.font) ? { fonts: source.fonts || {} } : f && !f.default ? { fonts: { body: f.family } } : {}),
|
|
200
|
+
look, background: input.background || 'white', fontKind: input.fontKind || fontKindOf(family),
|
|
201
|
+
builder: { ...(coverImage && isHex(coverBg) ? { coverBg: normHex(coverBg) } : {}), base: t.base, font: family, start: input.start || 'default', ...(source ? { source: { ...source, css: withoutLooks(source.css) } } : {}), ...(Object.keys(input.overrides || {}).length ? { overrides: input.overrides } : {}) } };
|
|
191
202
|
return { 'tokens.css': css, 'theme.json': JSON.stringify(json, null, 2) + '\n' };
|
|
192
203
|
}
|
|
193
204
|
export function readBuilder(themeJson) {
|
|
@@ -197,13 +208,41 @@ export function readBuilder(themeJson) {
|
|
|
197
208
|
if (!b || !isHex(b.base)) return null;
|
|
198
209
|
const overrides = {};
|
|
199
210
|
for (const [k, v] of Object.entries(b.overrides || {})) if (EDITABLE.includes(k) && isHex(v)) overrides[k] = normHex(v);
|
|
200
|
-
return { base: normHex(b.base), font: FONT_CHOICES.some((f) => f.family === b.font) ? b.font : '', overrides
|
|
211
|
+
return { ...(isHex(b.coverBg) ? { coverBg: normHex(b.coverBg) } : {}), base: normHex(b.base), font: FONT_CHOICES.some((f) => f.family === b.font) ? b.font : '', overrides,
|
|
212
|
+
look: cleanLook(j.look), background: Object.hasOwn(BACKGROUNDS, j.background) ? j.background : 'white',
|
|
213
|
+
fontKind: Object.hasOwn(FONT_KINDS, j.fontKind) ? j.fontKind : fontKindOf(b.font || ''), start: b.start || 'default',
|
|
214
|
+
...(b.source && typeof b.source.css === 'string' && isHex(b.source.base) ? { source: { ...b.source, base: normHex(b.source.base) } } : {}) };
|
|
201
215
|
}
|
|
202
216
|
// 同梱のテーマの tokens.css から始める値(最後の --base と --font-sans の最初の名前)
|
|
203
|
-
export function startFrom(tokensCss) {
|
|
217
|
+
export function startFrom(tokensCss, config = {}) {
|
|
218
|
+
try { if (typeof config === 'string') config = JSON.parse(config); } catch { config = {}; }
|
|
204
219
|
const c = String(tokensCss || '').replace(/\/\*[\s\S]*?\*\//g, '');
|
|
205
220
|
const b = [...c.matchAll(/--base\s*:\s*(#[0-9a-fA-F]{6})\b/g)].pop();
|
|
206
221
|
const f = [...c.matchAll(/--font-sans\s*:\s*([^;}]+)/g)].pop();
|
|
207
222
|
const fam = f ? f[1].split(',')[0].trim().replace(/^["']|["']$/g, '') : '';
|
|
208
|
-
|
|
223
|
+
const font = config?.fonts?.body || (FONT_CHOICES.some((x) => x.family === fam) ? fam : /var\(--font-mincho\)/.test(c) ? 'BIZ UDPMincho' : '');
|
|
224
|
+
const bg = [...c.matchAll(/--bg\s*:\s*(#[0-9a-fA-F]{6})\b/g)].pop();
|
|
225
|
+
return { base: b ? normHex(b[1]) : null, font, fontKind: fontKindOf(font),
|
|
226
|
+
background: bg && normHex(bg[1]) !== '#FFFFFF' ? 'off-white' : 'white',
|
|
227
|
+
look: cleanLook(config?.look || Object.fromEntries(Object.entries(lookIn(tokensCss)).map(([k, v]) => [k, v.id]))) };
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Keep the starting theme's CSS intact; regenerate its palette only after changing the base.
|
|
231
|
+
export function builderTokens(input) {
|
|
232
|
+
const t = deriveTheme(input.base, input.overrides);
|
|
233
|
+
const source = input.source;
|
|
234
|
+
if (source && normHex(input.base) === source.base) {
|
|
235
|
+
const css = source.css.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
236
|
+
for (const m of css.matchAll(/--([\w-]+)\s*:\s*(#[0-9a-fA-F]{6})\b/g)) t[m[1]] = normHex(m[2]);
|
|
237
|
+
for (const m of css.matchAll(/--([\w-]+)\s*:\s*var\(--([\w-]+)\)/g)) if (t[m[2]]) t[m[1]] = t[m[2]];
|
|
238
|
+
for (const [k, v] of Object.entries(input.overrides || {})) if (EDITABLE.includes(k) && isHex(v)) t[k] = normHex(v);
|
|
239
|
+
}
|
|
240
|
+
if (source && input.background === source.background) {
|
|
241
|
+
const bg = [...source.css.matchAll(/--bg\s*:\s*(#[0-9a-fA-F]{6})\b/g)].pop();
|
|
242
|
+
if (bg) t.bg = normHex(bg[1]);
|
|
243
|
+
} else {
|
|
244
|
+
const bg = BACKGROUNDS[input.background] || BACKGROUNDS.white;
|
|
245
|
+
t.bg = bg === 'var(--base-wash)' ? t['base-wash'] : bg;
|
|
246
|
+
}
|
|
247
|
+
return t;
|
|
209
248
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// テーマの形(見出し・表紙・結論の行)の決まった CSS
|
|
1
|
+
// テーマの形(見出し・表紙・結論の行)の決まった CSS の断片(backlog #58 stage 2)。
|
|
2
2
|
// 同梱のテーマはこの断片をそのまま tokens.css に写し、どれを選んだかを theme.json の look に書く({"heading": "band", "cover": "left-bar", "concl": "left-rule"})。
|
|
3
3
|
// テーマを作る画面は同じ断片を並べるだけで、選んだ形のテーマを書き出せる。tools/test-themes.mjs が、tokens.css の中の断片がここと同じかを確かめる。
|
|
4
4
|
// 断片はテーマのファイルに写す(組み立てはここを読まない)ので、ここを変えても出したテーマの見た目と hash は変わらない(変えたら写したテーマの版を上げる)。
|
|
@@ -15,6 +15,7 @@ const H = '.slide:not(.cover):not(.sec):not(.layout-tate) > h2';
|
|
|
15
15
|
|
|
16
16
|
export const SHAPES = Object.freeze({
|
|
17
17
|
heading: Object.freeze({
|
|
18
|
+
default: '',
|
|
18
19
|
// 下線(既定。kit/layouts.css のまま)
|
|
19
20
|
underline: '',
|
|
20
21
|
// 太い下線と、題の前の四角(常盤)
|
|
@@ -29,6 +30,7 @@ export const SHAPES = Object.freeze({
|
|
|
29
30
|
band: `${H}{left:0;right:0;top:0;padding:26px 48px 18px;background:var(--base);color:var(--sec-fg,#fff);border-bottom:4px solid var(--rule)}\n.slide:not(.cover):not(.sec):not(.layout-tate) > .kicker{--kicker-color:var(--sec-fg,#fff);z-index:1}\n.slide:not(.cover):not(.sec):not(.layout-tate) > .kicker + h2{padding-top:48px;padding-bottom:4px}`,
|
|
30
31
|
}),
|
|
31
32
|
cover: Object.freeze({
|
|
33
|
+
default: '',
|
|
32
34
|
// 中央・上に細い帯(既定。kit/layouts.css のまま)
|
|
33
35
|
'top-band': '',
|
|
34
36
|
// 中央・上に太い帯(常盤)
|
|
@@ -50,6 +52,7 @@ export const SHAPES = Object.freeze({
|
|
|
50
52
|
circle: '.slide.cover::before{left:auto;right:-80px;top:-80px;width:300px;height:300px;border-radius:50%;background:var(--base-tint)}',
|
|
51
53
|
}),
|
|
52
54
|
concl: Object.freeze({
|
|
55
|
+
default: '',
|
|
53
56
|
// 左の縦線(既定。themes/default/tokens.css 1.2.0)
|
|
54
57
|
'left-rule': '',
|
|
55
58
|
// 角丸の枠(浅葱)
|
|
@@ -78,3 +81,14 @@ export function lookIn(tokensCss) {
|
|
|
78
81
|
for (const m of String(tokensCss).replace(/\r\n?/g, '\n').matchAll(/\/\* look (\w+): ([\w-]+) \*\/\n([\s\S]*?)\n\/\* \/look \*\//g)) out[m[1]] = { id: m[2], css: m[3] };
|
|
79
82
|
return out;
|
|
80
83
|
}
|
|
84
|
+
|
|
85
|
+
// Background choices are tokens; the starting theme retains its exact paper colour until changed.
|
|
86
|
+
export const BACKGROUNDS = Object.freeze({ white: '#FFFFFF', 'off-white': '#FFFDF8', 'base-wash': 'var(--base-wash)' });
|
|
87
|
+
export const FONT_KINDS = Object.freeze({ gothic: 'BIZ UDPGothic', mincho: 'BIZ UDPMincho', 'maru-gothic': 'Zen Maru Gothic' });
|
|
88
|
+
export const fontKindOf = (font) => /Maru/.test(font) ? 'maru-gothic' : /Mincho|Serif|Fraunces/.test(font) ? 'mincho' : 'gothic';
|
|
89
|
+
export const cleanLook = (look) => Object.fromEntries(Object.keys(DEFAULT_LOOK).map((key) => [key, Object.hasOwn(SHAPES[key], look?.[key]) ? look[key] : 'default']));
|
|
90
|
+
export const withoutLooks = (css) => String(css || '').replace(/\r\n?/g, '\n').replace(/\/\* look \w+: [\w-]+ \*\/\n[\s\S]*?\n\/\* \/look \*\//g, '');
|
|
91
|
+
|
|
92
|
+
// These bands sit outside all cover text boxes (venue, title and author).
|
|
93
|
+
// Keep this list explicit: a future band behind text must declare the foreground token here.
|
|
94
|
+
export const COVER_BAND_TEXT = Object.freeze({ default: null, 'top-band': null, 'top-band-wide': null, 'bottom-band': null, 'left-bar': null, frame: null, circle: null });
|
package/kit/deck.js
CHANGED
|
@@ -686,7 +686,7 @@ function animDur(i, k){
|
|
|
686
686
|
// 部品に渡す ctx.mode(format spec §8.4:"talk" | "video"):内部の "lecture" は talk(preview は別に渡す)
|
|
687
687
|
// ctx.slide はスライドの鍵(文字列。format spec §8.1・§8.4)。要素は渡さない(部品が要るなら自分で探す)
|
|
688
688
|
function ctxMode(){ return DECK.mode === "lecture" ? "talk" : DECK.mode; }
|
|
689
|
-
// ctx の残りの欄(format spec §8.4):lang・slides・go・report・visited。1.x の部品にも渡す(読まないだけ)。ctx.deck は 1.x の部品にだけ
|
|
689
|
+
// ctx の残りの欄(format spec §8.4):lang・slides・go・report・answer・visited。1.x の部品にも渡す(読まないだけ)。ctx.deck は 1.x の部品にだけ
|
|
690
690
|
var CTX_SLIDES = null, CTX_LANG = "ja";
|
|
691
691
|
var REPORT_CODES = {data: 1, attr: 1, range: 1, size: 1, layout: 1, theme: 1, error: 1};
|
|
692
692
|
var REPORT_ERRORS = {data: 1, attr: 1, error: 1}; // 品質チェックの誤り(ほかは DECK.componentReports にだけ。見た目の知らせ)
|
|
@@ -724,6 +724,36 @@ function reporter(c){
|
|
|
724
724
|
console.warn("[deck] " + tag + " (" + (s.id || s._key) + ") " + cd + ": " + msg);
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
|
+
// ctx.answer(id, correct, value?)(format spec §8.4):問いを持つパーツが見る人の答えを知らせる。見る人の状態でファイルには書かない。
|
|
728
|
+
// 記録(kit/track.js、Player P6 の answer)に deck:answer で渡す:{slideKey, index(スライドの中のパーツの番号), id, correct, value?}。
|
|
729
|
+
// 動画・横に置く描画・発表者ビューなどの写し(DECK.view)・始まる前は渡さない。形の違う知らせ(correct が true・false・null でない)は捨てる。
|
|
730
|
+
// クラスの questions(format spec §8.4)にない id の答えは使わない(仕様:宣言していない id への答えは無視する)
|
|
731
|
+
function questionsOf(c){
|
|
732
|
+
var q = c && c.constructor && c.constructor.questions;
|
|
733
|
+
return Array.isArray(q) ? q.filter(function(x, j){ return typeof x === "string" && x !== "" && q.indexOf(x) === j; }) : [];
|
|
734
|
+
}
|
|
735
|
+
function answerer(c){
|
|
736
|
+
return function(id, correct, value){
|
|
737
|
+
var s = c._slide;
|
|
738
|
+
if (!s || !started || ASIDE || DECK.mode === "video" || DECK.view) return;
|
|
739
|
+
var a = DECK.Checks ? DECK.Checks.answerValue(correct, value) : null, ix = s._comps ? s._comps.indexOf(c) : -1;
|
|
740
|
+
if (!a || ix < 0 || id === undefined || id === null || String(id) === ""){ console.warn("[deck] " + c.tagName.toLowerCase() + ": ctx.answer: not an answer (" + String(id) + ", " + String(correct) + ")"); return; }
|
|
741
|
+
if (questionsOf(c).indexOf(String(id)) < 0){ console.warn("[deck] " + c.tagName.toLowerCase() + ": ctx.answer: \"" + String(id) + "\" is not in the part's questions; ignored"); return; }
|
|
742
|
+
var d = {slideKey: s._key, index: ix, id: String(id).slice(0, 200), correct: a.correct};
|
|
743
|
+
if ("value" in a) d.value = a.value;
|
|
744
|
+
document.dispatchEvent(new CustomEvent("deck:answer", {detail: d}));
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
// ファイルの問い(format spec §9.2):どのスライドのパーツの要素も、クラスが宣言した questions を 1 組ずつ持つ(見たかどうかによらない)。
|
|
748
|
+
// 読み込めなかったパーツ(登録簿の失敗:要素が定義されず s._comps に入らない)と、包んだ失敗(c._bad:描けず最後の状態の代わりを出す)は問いを持たない。
|
|
749
|
+
// 返すもの:[{slideKey, index(スライドの中のパーツの番号), id}](kit/track.js が開いたときに数える)
|
|
750
|
+
DECK.questions = function(){
|
|
751
|
+
var out = [];
|
|
752
|
+
(slides || []).forEach(function(s){
|
|
753
|
+
(s._comps || []).forEach(function(c, ix){ if (!c._bad) questionsOf(c).forEach(function(id){ out.push({slideKey: s._key, index: ix, id: id}); }); });
|
|
754
|
+
});
|
|
755
|
+
return out;
|
|
756
|
+
};
|
|
727
757
|
// Viewer input (format §8.4): totals belong to slide steps, never to duration()/the authored timeline.
|
|
728
758
|
var viewerStep = null, stepExtensions = Object.create(null), liveRun = null;
|
|
729
759
|
var inputEntry = 0, mirrorEntry = null, inputRendering = 0, inputMirroring = false;
|
|
@@ -871,7 +901,7 @@ document.addEventListener("deck:live", function(){
|
|
|
871
901
|
});
|
|
872
902
|
function ctxFor(c, s, o){
|
|
873
903
|
var x = {mode: ctxMode(), preview: previewOn() && !c._ctxNoPrev, slide: s._key, lang: CTX_LANG, slides: CTX_SLIDES,
|
|
874
|
-
go: ctxGo, report: c._reportFn || (c._reportFn = reporter(c)), visited: ctxVisited, extend: function(seconds){ return ctxExtend(s, seconds, c); },
|
|
904
|
+
go: ctxGo, report: c._reportFn || (c._reportFn = reporter(c)), answer: c._answerFn || (c._answerFn = answerer(c)), visited: ctxVisited, extend: function(seconds){ return ctxExtend(s, seconds, c); },
|
|
875
905
|
live: viewerInput() && !DECK.view && DECK.live && typeof DECK.live.poll === "function" ? CTX_LIVE : null};
|
|
876
906
|
for (var k in o) x[k] = o[k];
|
|
877
907
|
if (!c._v2) x.deck = DECK;
|
|
@@ -1947,7 +1977,8 @@ var readySent = false;
|
|
|
1947
1977
|
function postReady(){
|
|
1948
1978
|
if (!EMBED || readySent) return;
|
|
1949
1979
|
readySent = true;
|
|
1950
|
-
var m = DECK.META, msg = {egatari: "ready", version: DECK.VERSION,
|
|
1980
|
+
var m = DECK.META, msg = {egatari: "ready", version: DECK.VERSION, formats: ((FMT && FMT.versions) || ["1.0"]).slice(), player: (FMT && FMT.playerSpec) || "1.0",
|
|
1981
|
+
commands: EMBED_CMDS.slice(), docId: typeof m.docId === "string" ? m.docId : null};
|
|
1951
1982
|
if (typeof m.sourceSha256 === "string") msg.sourceSha256 = m.sourceSha256;
|
|
1952
1983
|
// タイムラインを作れなくても起動は止めない(空のタイムラインで知らせる)
|
|
1953
1984
|
try { msg.timeline = DECK.timeline().map(function(x){
|
|
@@ -1970,7 +2001,8 @@ function broadcast(p){
|
|
|
1970
2001
|
var ni = step < slides[cur]._max ? cur : cur + 1, nk = step < slides[cur]._max ? step + 1 : 0;
|
|
1971
2002
|
var msg = {type: "deck-pos", i: cur, k: step, max: slides[cur]._max, n: slides.length, key: DECK.stepKey(cur, step),
|
|
1972
2003
|
nextKey: ni < slides.length ? DECK.stepKey(ni, nk) : null, auto: p.playing, cause: p.cause || "control",
|
|
1973
|
-
back: p.top ? titleOf(slides[p.top.i]) : null, black: isBlack(), viewer: inputState()
|
|
2004
|
+
back: p.top ? titleOf(slides[p.top.i]) : null, black: isBlack(), viewer: inputState(),
|
|
2005
|
+
bookmarks: DECK.bookmarks(), bm: !!(p.top && p.top.bm)};
|
|
1974
2006
|
if (presenter && !presenter.closed) presenter.postMessage(msg, "*");
|
|
1975
2007
|
// 編集のプレビュー(server/hints.js が DECK_DEV を立てた枠)では、中継する親の窓にも送る。ほかの親(埋め込み・知らない枠)には送らない(埋め込みは下の position だけ)
|
|
1976
2008
|
if (editorParent() && presenter !== window.parent) window.parent.postMessage(msg, "*");
|
|
@@ -2004,6 +2036,7 @@ window.addEventListener("message", function(e){
|
|
|
2004
2036
|
else if (m.cmd === "goto"){ POS.setCause("seek"); go(m.i, m.k, !!m.animate); POS.setCause(null); }
|
|
2005
2037
|
else if (m.cmd === "link" && typeof m.frag === "string") DECK.follow(m.frag); // 発表者ビューの中の画面で押したリンク
|
|
2006
2038
|
else if (m.cmd === "back") back();
|
|
2039
|
+
else if (m.cmd === "bookmark"){ if (m.next) bookmarkNext(); else if (typeof m.n === "number") bookmarkGo(m.n); } // 発表者ビューのしおりのボタンと q
|
|
2007
2040
|
else if (m.cmd === "blackout"){ if (!EDIT) setBlack(!isBlack()); else e.source.postMessage({type: "deck-black", on: false}, "*"); } // 発表者ビューの b(編集中は入らない)
|
|
2008
2041
|
else if (m.cmd === "auto"){ if (!EDIT) DECK.autoplay(); else POS.publish(); } // 編集中は始めない(発表者ビューのボタンは今の状態に戻す)
|
|
2009
2042
|
// 編集の画面から送られたキー:編集のプレビュー(server/hints.js が DECK_DEV を立てる)で、親の窓から届いたものだけ。ほかの送り手(自分・子の枠・別の窓)は無視する
|
|
@@ -2039,6 +2072,11 @@ window.addEventListener("message", function(e){
|
|
|
2039
2072
|
if (typeof m.visible !== "boolean"){ post({egatari: "error", id: m.id, code: "controls", message: "visible must be true or false"}); return; }
|
|
2040
2073
|
setControls(m.visible);
|
|
2041
2074
|
post({egatari: "controls", id: m.id, visible: m.visible});
|
|
2075
|
+
} else if (EMBED && e.source === window.parent && m.egatari === "prefs"){
|
|
2076
|
+
// 見る人の設定をホストから(Player P5・P8):{egatari:"prefs", id?, prefs}。当てたら同じ形で今の値を答える
|
|
2077
|
+
if (!m.prefs || typeof m.prefs !== "object" || Array.isArray(m.prefs)){ post({egatari: "error", id: m.id, code: "prefs", message: "prefs must be an object"}); return; }
|
|
2078
|
+
applyPrefs(m.prefs);
|
|
2079
|
+
post({egatari: "prefs", id: m.id, prefs: prefsNow()});
|
|
2042
2080
|
} else if (EMBED && e.source === window.parent && m.egatari === "snapshot"){
|
|
2043
2081
|
// 位置の画像(Player P8 では OPTIONAL):このプレーヤーは作らない
|
|
2044
2082
|
post({egatari: "error", id: m.id, code: "unsupported", message: "snapshot is not supported by this player"});
|
|
@@ -2060,7 +2098,38 @@ window.addEventListener("message", function(e){
|
|
|
2060
2098
|
});
|
|
2061
2099
|
|
|
2062
2100
|
// 埋め込みの命令(Player P8)。layout は kit/panes.js が受ける。ほかの名前には error(unsupported)で答える
|
|
2063
|
-
var EMBED_CMDS = ["seek", "play", "pause", "rate", "mode", "layout", "preview", "controls", "snapshot", "links"];
|
|
2101
|
+
var EMBED_CMDS = ["seek", "play", "pause", "rate", "mode", "layout", "preview", "controls", "prefs", "snapshot", "links"];
|
|
2102
|
+
// 見る人の設定(Player P5・P8 prefs):layout・textSize・textBackground は kit/panes.js(DECK.panes.prefs / applyPrefs)、captions・captionSize はここ。
|
|
2103
|
+
// 値:layout "slides"|"flow"|"split"、textSize は本の窓の字の倍率(持つ段の一番近いもの)、textBackground "white"|"sepia"|"black"、captions true|false、captionSize "s"|"m"|"l"
|
|
2104
|
+
// (egatari-spec 3d3cdde、Player P8 の表の下の段落)。知らない名前も、知らない値の名前も無視する。見る人が自分で変えたときだけ {egatari:"prefs", prefs} を送る(ホストの命令で変えたときは送らない。同じ値は 2 度送らない)
|
|
2105
|
+
var prefsQuiet = 0, prefsSent = "";
|
|
2106
|
+
function prefsNow(){
|
|
2107
|
+
var p = {};
|
|
2108
|
+
if (DECK.panes && DECK.panes.prefs) { var q = DECK.panes.prefs(); for (var x in q) p[x] = q[x]; }
|
|
2109
|
+
if (CAP_LIVE){ p.captions = !!CAP.on; p.captionSize = CAP.size || "m"; }
|
|
2110
|
+
return p;
|
|
2111
|
+
}
|
|
2112
|
+
function postPrefs(){
|
|
2113
|
+
if (!EMBED || !DECK.ready || prefsQuiet) return;
|
|
2114
|
+
var p = prefsNow(), j = JSON.stringify(p);
|
|
2115
|
+
if (j === prefsSent) return;
|
|
2116
|
+
prefsSent = j;
|
|
2117
|
+
post({egatari: "prefs", prefs: p});
|
|
2118
|
+
}
|
|
2119
|
+
DECK.prefsChanged = postPrefs;
|
|
2120
|
+
document.addEventListener("deck:captions", postPrefs);
|
|
2121
|
+
function applyPrefs(p){
|
|
2122
|
+
prefsQuiet++;
|
|
2123
|
+
try {
|
|
2124
|
+
if (DECK.panes && DECK.panes.applyPrefs) DECK.panes.applyPrefs(p);
|
|
2125
|
+
if (CAP_LIVE && typeof p.captionSize === "string" && Object.prototype.hasOwnProperty.call(CAP_SIZES, p.captionSize)){
|
|
2126
|
+
if (CAP.on) capSize(p.captionSize);
|
|
2127
|
+
else { CAP.size = p.captionSize; try { localStorage.setItem("deck-capsize", CAP.size); } catch (e) {} capApplySize(); }
|
|
2128
|
+
}
|
|
2129
|
+
if (CAP_LIVE && typeof p.captions === "boolean" && p.captions !== CAP.on) setCaptions(p.captions);
|
|
2130
|
+
} finally { prefsQuiet--; }
|
|
2131
|
+
prefsSent = JSON.stringify(prefsNow());
|
|
2132
|
+
}
|
|
2064
2133
|
// seek の slide(スライドの鍵か 0 からの番号)・step(段階の鍵。数字でもよい。なければ 0)・t(秒。null・なしは ∞)を {i, k, t} に。読めなければ {error}
|
|
2065
2134
|
function resolveSeek(m){
|
|
2066
2135
|
var i = typeof m.slide === "string" ? slideIndexOf(m.slide) : typeof m.slide === "number" && Math.floor(m.slide) === m.slide && m.slide >= 0 && m.slide < slides.length ? m.slide : -2;
|
|
@@ -2207,7 +2276,7 @@ function followLink(pos, opts){
|
|
|
2207
2276
|
if (DECK.view){ post({type: "deck-link", frag: fragmentOf(pos.i, pos.k)}); return false; } // 発表者ビューの中の画面:本体に任せる
|
|
2208
2277
|
var target = {slideKey: slides[pos.i]._key, stepKey: stepKey(slides[pos.i], pos.k)};
|
|
2209
2278
|
if (!LINKS.follow){ post(Object.assign({egatari: "linkRefused"}, target)); return false; }
|
|
2210
|
-
var depth = POS.push({i: POS.i, k: POS.k, el: opts.keyboard ? opts.el : null});
|
|
2279
|
+
var depth = POS.push({i: POS.i, k: POS.k, el: opts.keyboard ? opts.el : null, bm: !!opts.bm});
|
|
2211
2280
|
if (TOP) try { history.pushState({egatariLink: depth, to: {i: pos.i, k: pos.k}}, "", "#" + fragmentOf(pos.i, pos.k)); } catch (e) {}
|
|
2212
2281
|
moveTo(pos.i, pos.k, "link");
|
|
2213
2282
|
return true;
|
|
@@ -2248,6 +2317,45 @@ window.addEventListener("popstate", function(e){
|
|
|
2248
2317
|
moveTo(at.i, at.k, "link");
|
|
2249
2318
|
}
|
|
2250
2319
|
});
|
|
2320
|
+
// ---------------------------------------------------------------- しおり(format spec §8.0 Bookmarks、Player P4.3)
|
|
2321
|
+
// data-bookmark="名前" の付いたスライド(section.slide)へ、操作の帯・発表者ビューのボタンと q で飛ぶ。飛ぶ先はそのスライドの最終状態
|
|
2322
|
+
// (#<id>:concl のリンクと同じ。結論の行のないスライドは最後のステップ)。飛ぶのはリンクと同じ流れ(followLink)で、「戻る」の跡に bm の印を付ける。
|
|
2323
|
+
// 跡のいちばん上が bm の間は「しおりで来ている」:続けて飛んでも(ボタン・q)跡を積まず、「元の位置に戻る」(back)はしおりを使い始める前の位置へ。
|
|
2324
|
+
// q は今の位置より後の次のしおりへ。最後のしおりより後で押すと、しおりで来ていれば元の位置へ戻り、そうでなければ最初のしおりへ。
|
|
2325
|
+
// 動画(?mode=video)・発表者ビューの中の画面では使わない(ボタンも作らない。印刷では帯ごと隠れる)
|
|
2326
|
+
var BM = null;
|
|
2327
|
+
function bookmarkList(){
|
|
2328
|
+
if (BM) return BM;
|
|
2329
|
+
BM = [];
|
|
2330
|
+
slides.forEach(function(s, i){ var n = (s.getAttribute("data-bookmark") || "").replace(/\s+/g, " ").trim(); if (n) BM.push({i: i, name: n}); });
|
|
2331
|
+
return BM;
|
|
2332
|
+
}
|
|
2333
|
+
function bmAllowed(){ return started && DECK.mode !== "video" && !DECK.view && !videoViewer(); }
|
|
2334
|
+
function bmPos(b){ var s = slides[b.i]; return {i: b.i, k: s._cstep >= 0 ? s._cstep : s._max}; }
|
|
2335
|
+
function bmOn(){ var t = POS.top(); return !!(t && t.bm); }
|
|
2336
|
+
function bookmarkGo(n){
|
|
2337
|
+
var b = bmAllowed() ? bookmarkList()[n] : null;
|
|
2338
|
+
if (!b) return false;
|
|
2339
|
+
var p = bmPos(b);
|
|
2340
|
+
if (!bmOn()) return followLink(p, {bm: true});
|
|
2341
|
+
// しおりで来ている:跡は積まない(戻る先は元の位置のまま)。上の窓の履歴は今の項目の行き先だけを書き換える
|
|
2342
|
+
if (TOP && history.state && history.state.egatariLink === POS.depth) try { history.replaceState({egatariLink: POS.depth, to: {i: p.i, k: p.k}}, "", "#" + fragmentOf(p.i, p.k)); } catch (e) {}
|
|
2343
|
+
moveTo(p.i, p.k, "link");
|
|
2344
|
+
return true;
|
|
2345
|
+
}
|
|
2346
|
+
function bookmarkNext(){
|
|
2347
|
+
var L = bmAllowed() ? bookmarkList() : [];
|
|
2348
|
+
if (!L.length) return false;
|
|
2349
|
+
for (var n = 0; n < L.length; n++){ var p = bmPos(L[n]); if (p.i > POS.i || (p.i === POS.i && p.k > POS.k)) return bookmarkGo(n); }
|
|
2350
|
+
if (bmOn()) return back(); // 最後のしおりの後:元の位置へ
|
|
2351
|
+
return bookmarkGo(0);
|
|
2352
|
+
}
|
|
2353
|
+
DECK.bookmarks = function(){ return bmAllowed() ? bookmarkList().map(function(b){ return {i: b.i, name: b.name}; }) : []; };
|
|
2354
|
+
DECK.bookmark = function(n){ return bookmarkGo(n); };
|
|
2355
|
+
DECK.nextBookmark = function(){ return bookmarkNext(); };
|
|
2356
|
+
DECK.bookmarkActive = function(){ return bmAllowed() && bmOn(); };
|
|
2357
|
+
DECK.bookmarkBack = function(){ return bmAllowed() && bmOn() ? back() : false; };
|
|
2358
|
+
|
|
2251
2359
|
// ---------------------------------------------------------------- 授業の外へ出るリンク(format spec §11。決まりは kit/core/link-policy.mjs の LinkPolicy)
|
|
2252
2360
|
// 外へ出るときは、行き先の host と全体を見せて確かめる(https: の普通のリンクは、同じ閲覧のあいだ同じ host に一度同意すれば再び聞かない)。
|
|
2253
2361
|
// 見える字が別の host を名指す・https: でない・ダウンロード・userinfo・punycode の host は、毎回確かめる。http(s)・mailto・tel 以外は開かない。
|
|
@@ -2374,6 +2482,15 @@ function syncBack(){
|
|
|
2374
2482
|
document.body.appendChild(b);
|
|
2375
2483
|
}
|
|
2376
2484
|
var to = titleOf(slides[t.i]);
|
|
2485
|
+
if (t.bm){ // しおりで来ている:元の位置に戻る(Player P4.3)
|
|
2486
|
+
LINKS.btn.querySelector(".lab").textContent = L10N("元の位置に戻る", "Back to where you were");
|
|
2487
|
+
LINKS.btn.querySelector(".to").textContent = "";
|
|
2488
|
+
LINKS.btn.title = L10N("元の位置に戻る(Backspace)", "Back to where you were (Backspace)");
|
|
2489
|
+
LINKS.btn.setAttribute("aria-label", L10N("元の位置に戻る", "Back to where you were"));
|
|
2490
|
+
LINKS.btn.setAttribute("aria-keyshortcuts", "Backspace Alt+ArrowLeft");
|
|
2491
|
+
LINKS.btn.hidden = false;
|
|
2492
|
+
return;
|
|
2493
|
+
}
|
|
2377
2494
|
LINKS.btn.querySelector(".lab").textContent = L10N("戻る", "Back");
|
|
2378
2495
|
LINKS.btn.querySelector(".to").textContent = to;
|
|
2379
2496
|
LINKS.btn.title = L10N("戻る:", "Back to ") + to + L10N("(Backspace / Alt+←)", " (Backspace / Alt+←)");
|
|
@@ -2674,6 +2791,7 @@ document.addEventListener("keydown", function(e){
|
|
|
2674
2791
|
if (EDIT && (k === "a" || k === "b" || k === "f")) return;
|
|
2675
2792
|
if (k === "f") DECK.toggleFullscreen();
|
|
2676
2793
|
else if (k === "p") openPresenter();
|
|
2794
|
+
else if (k === "q"){ if (bookmarkNext()) e.preventDefault(); } // 次のしおりへ(Player P4.3)
|
|
2677
2795
|
else if (k === "a") DECK.autoplay();
|
|
2678
2796
|
else if (k === "l") DECK.togglePreview();
|
|
2679
2797
|
else if (k === ">" || k === "<") stepRate(k === ">" ? 1 : -1);
|
package/kit/layouts.css
CHANGED
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
:where(.slide) :where(a[href]){color:var(--term);text-decoration:underline;text-decoration-thickness:.06em;text-underline-offset:.16em}
|
|
35
35
|
:where(.slide) :where(a[href]):focus-visible{outline:3px solid var(--term);outline-offset:2px;border-radius:3px}
|
|
36
36
|
.cite{font-size:20px;color:var(--muted)}
|
|
37
|
+
/* 出典の行(<p class="source">出典:…</p>):数字・図・引用の出どころ。スライドの直下に置けば結論の行のすぐ上(下端をそろえ、2 行なら上へ伸びる)に小さく灰色で。
|
|
38
|
+
本文はその分だけ短くする。本文の中に置けば本文の終わりに。字の大きさの最小は見ない(.cite と同じ。kit/core/layout-scan.mjs) */
|
|
39
|
+
.source{font-size:20px;line-height:1.35;color:var(--muted);margin:0}
|
|
40
|
+
.slide > .source{position:absolute;left:48px;right:48px;bottom:157px}
|
|
41
|
+
.slide:has(> .source) .body{bottom:192px}
|
|
42
|
+
.slide.noconcl > .source{bottom:40px}
|
|
43
|
+
.slide.noconcl:has(> .source) .body{bottom:96px}
|
|
44
|
+
.body .source{margin-top:8px}
|
|
37
45
|
.arrow{text-align:center;font-size:32px;line-height:1.1;margin:2px 0;color:var(--term)}
|
|
38
46
|
.cols{display:flex;gap:32px;align-items:flex-start}
|
|
39
47
|
.cols>*{flex:1;min-width:0}
|
package/kit/llm-pack.mjs
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
// node kit/llm-pack.mjs --no-fit [--sets …] 無料のプランで目安に収めない(下の fit をしない。比べる・調べる用)
|
|
5
5
|
// node kit/llm-pack.mjs --from-sample <名前> [--request <文|ファイル>] [--plan …] [--lang …]
|
|
6
6
|
// 「このサンプルを参考に作る」で ② を書いて ④ で写す指示と同じバイト(backlog #130。kit/core/new-deck-pack.mjs の fromSamplePack):
|
|
7
|
-
// examples/<名前>/sample.json
|
|
8
|
-
//
|
|
9
|
-
//
|
|
7
|
+
// examples/<名前>/sample.json の場面・テーマ・ラベル(伝えたいこと・題材・読み手)と構成。--request の 1 行目は ② のタイトル、
|
|
8
|
+
// 残りは内容(なければ空)。指示はパーツの順位で組む(サンプルのパーツが一番上。handoff #43 ④):上から説明を載せ、
|
|
9
|
+
// 上限を越える手前で止め、残りは言いたいことの表に名前だけ(軽量も詳細も同じ。kit/core/new-deck-pack.mjs の newDeckPack)
|
|
10
10
|
// node kit/llm-pack.mjs --list [--lang ja] 束・その部品・大きさ(無料のプランは収めた大きさと収める前の大きさ。最後に有料のプラン)
|
|
11
11
|
// node kit/llm-pack.mjs --help | -h 使い方
|
|
12
12
|
// 無料のプランは、編集アプリの新規作成と同じに目安(PACK_CAP_KB.free と、貼り付けの長さ FREE_PASTE_UNITS の近いほう。fitSize)に収める(kit/core/llm-pack.mjs の fitPack。backlog #125):
|
|
@@ -110,10 +110,8 @@ if (argv.includes('--from-sample')) {
|
|
|
110
110
|
if (argv.includes('--no-fit') || arg('--sets') !== undefined || argv.includes('--list')) throw new Error('--from-sample cannot be used with --sets, --list or --no-fit');
|
|
111
111
|
const lang = langArg || 'en', plan = planArg || 'free';
|
|
112
112
|
const r = samplePack(String(arg('--from-sample') || ''), lang, plan);
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
if (r.dropped.length) console.error(`note: ${plan} plan: still over the limit, so these specialized parts the sample does not use were left out, largest first: ${r.dropped.join(', ')} (the sample's own parts stay)`);
|
|
116
|
-
if (r.ownShortened.length) console.error(`note: light instructions: still over the limit with nothing else to leave out, so these parts of the sample get only their catalogue line too: ${r.ownShortened.join(', ')}`);
|
|
113
|
+
// 順位で組む(kit/core/new-deck-pack.mjs の newDeckPack):説明つきのパーツと名前だけのパーツの数を stderr に
|
|
114
|
+
console.error(`note: ${plan} plan: ${r.described.length} parts described (${r.described.join(', ') || 'none'}), ${r.named.length} by name only`);
|
|
117
115
|
if (r.over) console.error(`warning: ${plan} plan: ${kbOf(r.bytes)} KB is still over the limit`);
|
|
118
116
|
process.stdout.write(r.text);
|
|
119
117
|
} catch (e) { console.error(e.message); process.exit(2); }
|