egatari 0.6.18 → 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.
Files changed (54) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/components.lock.json +34 -9
  3. package/components2.lock.json +363 -1
  4. package/kit/build.mjs +1 -1
  5. package/kit/check-messages.mjs +4 -0
  6. package/kit/check.mjs +3 -1
  7. package/kit/core/build-core.mjs +1 -1
  8. package/kit/core/check-parity.mjs +2 -0
  9. package/kit/core/check-rules.mjs +1 -1
  10. package/kit/core/check-source.mjs +4 -1
  11. package/kit/core/checks.mjs +79 -0
  12. package/kit/core/find-replace.mjs +170 -0
  13. package/kit/core/format.mjs +4 -1
  14. package/kit/core/image-insert.mjs +197 -0
  15. package/kit/core/image-size.mjs +1 -1
  16. package/kit/core/layout-scan.mjs +1 -1
  17. package/kit/core/llm-fix.mjs +1 -1
  18. package/kit/core/llm-pack-assemble.mjs +3 -1
  19. package/kit/core/llm-pack-data.mjs +51 -15
  20. package/kit/core/part-labels.mjs +1 -0
  21. package/kit/core/portable.mjs +5 -2
  22. package/kit/core/scorm.mjs +30 -6
  23. package/kit/core/script-unclosed.mjs +49 -0
  24. package/kit/core/slide-ops.mjs +5 -1
  25. package/kit/core/template-text.mjs +2 -0
  26. package/kit/deck.js +71 -4
  27. package/kit/instruction-version.json +1 -1
  28. package/kit/layouts.css +8 -0
  29. package/kit/panes.js +17 -1
  30. package/kit/player.json +1 -1
  31. package/kit/player.lock.json +2 -2
  32. package/kit/track.js +46 -5
  33. package/package.json +1 -1
  34. package/server/editor-ui.js +21 -1
  35. package/vendor/components/CATALOG.md +3 -2
  36. package/vendor/components/sha256/15306d854d67d52ca2b1d66135f0d3296882e6b21fd85c029399b8077c8a7f9d/README.en.md +34 -0
  37. package/vendor/components/sha256/15306d854d67d52ca2b1d66135f0d3296882e6b21fd85c029399b8077c8a7f9d/index.js +398 -0
  38. package/vendor/components/sha256/277ac772315f93737a094cd0f0842726f2435d352d9a90822aebfe0d5d7e79a1/README.en.md +23 -0
  39. package/vendor/components/sha256/277ac772315f93737a094cd0f0842726f2435d352d9a90822aebfe0d5d7e79a1/index.js +294 -0
  40. package/vendor/components/sha256/3be5f64deb1951327b614b29a9b632878fab362687c76e3f48f3af1d1ebbb1cf/README.en.md +47 -0
  41. package/vendor/components/sha256/3be5f64deb1951327b614b29a9b632878fab362687c76e3f48f3af1d1ebbb1cf/index.js +223 -0
  42. package/vendor/components/sha256/7c7b0373cfd38fd5ecb4169021e0b908f0a17be1a29b14f85dd89fdb92e7bf81/README.en.md +44 -0
  43. package/vendor/components/sha256/7c7b0373cfd38fd5ecb4169021e0b908f0a17be1a29b14f85dd89fdb92e7bf81/index.js +306 -0
  44. package/vendor/components/sha256/939bdae590ebed3d182b0c9940a35b6c03872505bfa242341990a81cae02fd06/README.en.md +34 -0
  45. package/vendor/components/sha256/939bdae590ebed3d182b0c9940a35b6c03872505bfa242341990a81cae02fd06/index.js +397 -0
  46. package/vendor/components/sha256/9c5dd0bc0c3279c5f0fea3fdb9d0735870880aef96e8bbf9ecdd77dff0f5ddc8/README.en.md +44 -0
  47. package/vendor/components/sha256/9c5dd0bc0c3279c5f0fea3fdb9d0735870880aef96e8bbf9ecdd77dff0f5ddc8/index.js +551 -0
  48. package/vendor/components/sha256/a5b032657720d3beb64f0b3699954e13b0eb985f36161b9ae046c83fd6048ff5/README.en.md +18 -0
  49. package/vendor/components/sha256/a5b032657720d3beb64f0b3699954e13b0eb985f36161b9ae046c83fd6048ff5/index.js +382 -0
  50. package/vendor/components-2/manifest-2.20.0.json +3217 -0
  51. package/vendor/components-2/manifest-2.21.0.json +3220 -0
  52. package/vendor/egatari-spec/SOURCE.json +2 -2
  53. package/vendor/egatari-spec/schema/deck-meta.schema.json +3 -0
  54. 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
+ }
@@ -18,7 +18,7 @@ import { analyzeSlideIds } from './build-core.mjs';
18
18
  import { newSlideId, headingLine, parseHeading, splitKey } from './narration-core.mjs';
19
19
  import { TEMPLATE_TEXT, placeholderLine } from './template-text.mjs';
20
20
 
21
- export const TEMPLATES = ['title-body', 'two-cols', 'figure', 'section', 'quote'];
21
+ export const TEMPLATES = ['title-body', 'two-cols', 'figure', 'section', 'quote', 'source'];
22
22
 
23
23
  function walk(node, fn) {
24
24
  fn(node);
@@ -199,6 +199,10 @@ export function slideTemplate(kind, { lang = 'ja', id }) {
199
199
  } else if (kind === 'figure') {
200
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>`;
201
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)]];
202
206
  } else if (kind === 'section') {
203
207
  html = `<section class="slide sec noconcl static"${sid}>\n <h1>${t.h}</h1>\n <div class="lead">${t.lead}</div>\n</section>`;
204
208
  steps = [['0', P(t.n)]];
@@ -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']);
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, docId: typeof m.docId === "string" ? m.docId : null};
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){
@@ -2041,6 +2072,11 @@ window.addEventListener("message", function(e){
2041
2072
  if (typeof m.visible !== "boolean"){ post({egatari: "error", id: m.id, code: "controls", message: "visible must be true or false"}); return; }
2042
2073
  setControls(m.visible);
2043
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()});
2044
2080
  } else if (EMBED && e.source === window.parent && m.egatari === "snapshot"){
2045
2081
  // 位置の画像(Player P8 では OPTIONAL):このプレーヤーは作らない
2046
2082
  post({egatari: "error", id: m.id, code: "unsupported", message: "snapshot is not supported by this player"});
@@ -2062,7 +2098,38 @@ window.addEventListener("message", function(e){
2062
2098
  });
2063
2099
 
2064
2100
  // 埋め込みの命令(Player P8)。layout は kit/panes.js が受ける。ほかの名前には error(unsupported)で答える
2065
- 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
+ }
2066
2133
  // seek の slide(スライドの鍵か 0 からの番号)・step(段階の鍵。数字でもよい。なければ 0)・t(秒。null・なしは ∞)を {i, k, t} に。読めなければ {error}
2067
2134
  function resolveSeek(m){
2068
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;
@@ -1,3 +1,3 @@
1
1
  {
2
- "instruction": "2a06805c"
2
+ "instruction": "027f5293"
3
3
  }
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/panes.js CHANGED
@@ -336,6 +336,8 @@ function setLayout(name, o){
336
336
  P.layout = name;
337
337
  html.setAttribute("data-deck-layout", name);
338
338
  if (o.persist) store(docKey(), name);
339
+ // 見る人が自分で選んだ並べ方は、埋め込みのホストにも知らせる(Player P5・P8 prefs。kit/deck.js)
340
+ if (o.persist && before !== name && DECK.prefsChanged) DECK.prefsChanged();
339
341
  if (P.pane){
340
342
  P.pane.hidden = name === "slides";
341
343
  P.div.hidden = name !== "split";
@@ -848,7 +850,8 @@ function applyReading(){
848
850
  P.pane.setAttribute("data-dx-lh", P.rs.lh);
849
851
  P.pane.setAttribute("data-dx-bg", P.rs.bg);
850
852
  }
851
- function setReading(k, v){
853
+ function setReading(k, v, quiet){
854
+ if (!P.body){ P.rs[k] = v; store("read-" + k, String(v)); return; }
852
855
  var a = readAnchor(), b = rectOf(P.body), d = a ? (P.vertical ? b.width : b.height) * .25 - along(a.el, b) : 0;
853
856
  P.rs[k] = v;
854
857
  store("read-" + k, String(v));
@@ -857,6 +860,7 @@ function setReading(k, v){
857
860
  // 字の大きさが変わっても、読んでいた所を窓に残す
858
861
  if (a) scrollAlong(a.el, d);
859
862
  progress();
863
+ if (!quiet && DECK.prefsChanged) DECK.prefsChanged();
860
864
  }
861
865
  function openText(anchor){
862
866
  openPop("reading", T.text, anchor, function(m){
@@ -1271,6 +1275,18 @@ DECK.panes = {
1271
1275
  // 選べる並べ方(deck-meta.offer.faces と画面の幅から。kit/tools.js の「表示」のボタンと ? の r の行)
1272
1276
  offered: function(){ return offered(); },
1273
1277
  watch: function(i, k){ if (T) openOverlay(i, k || 0, null); },
1278
+ // 見る人の設定(Player P5・P8 prefs。kit/deck.js が captions・captionSize と合わせる):今の値と、ホストが覚えていた値を当てる(知らない値は無視)
1279
+ prefs: function(){ return {layout: SPEC_OUT[P.layout], textSize: P.rs.size, textBackground: P.rs.bg}; },
1280
+ applyPrefs: function(p){
1281
+ if (!T) return;
1282
+ var n = typeof p.layout === "string" && Object.prototype.hasOwnProperty.call(SPEC_IN, p.layout) ? SPEC_IN[p.layout] : null;
1283
+ if (n && n !== P.layout) setLayout(n, {focus: false});
1284
+ if (typeof p.textSize === "number" && isFinite(p.textSize) && p.textSize > 0){
1285
+ var near = SIZES.reduce(function(a, b){ return Math.abs(b - p.textSize) < Math.abs(a - p.textSize) ? b : a; });
1286
+ if (near !== P.rs.size) setReading("size", near, true);
1287
+ }
1288
+ if ((p.textBackground === "white" || p.textBackground === "sepia" || p.textBackground === "black") && p.textBackground !== P.rs.bg) setReading("bg", p.textBackground, true);
1289
+ },
1274
1290
  close: function(){ closeOverlay(); },
1275
1291
  // 読んだかを見る所(kit/track.js。Player P6 の via "text"):本の窓の本文の欄と、読む単位 {el, steps: [[i, k]…]}。
1276
1292
  // 本文:スライドの節(§9C.5)ごとに、その節のスライドの全ステップ。台本で読む:各ステップの台本、台本のないステップはそのスライドの縮図
package/kit/player.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "egatari-player",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "title": "Egatari Player"
5
5
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "1.10.0",
3
- "sha256": "5c0857bf8e71d70abd5edfea513e484e691429a09230055a1968fa12b6f88230"
2
+ "version": "1.12.0",
3
+ "sha256": "89576cc4c127ae5885020e2bc2a841cb9a93d66025804be4360cac9b423407fd"
4
4
  }
package/kit/track.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // 進み具合の記録(track.js):Player P6 の記録の口(tracking adapter)、format spec §9.2 の終えた判定、SCORM 1.2 の包み方(spec bindings/scorm12.md)
2
2
  // - 口は 1 つだけ、この順に探す:SCORM 1.2 の API(自分と親の窓を 7 段まで、次に opener)→ 親の窓への postMessage(埋め込み ?embed=1 の枠の中。
3
3
  // 埋め込みでない枠には {egatari: …} を送らない:Player P8)→ この端末(localStorage)
4
- // - 出来事:started(見る人の最初の操作)・step {slideKey, stepKey, index, total, via}・completed・suspend {location, data}
4
+ // - 出来事:started(見る人の最初の操作)・step {slideKey, stepKey, index, total, via}・answer {slideKey, id, correct, value?}・completed・suspend {location, data}
5
5
  // via "stage":舞台で再生した(スライド・スライドと本・「スライドで見る」の重ね。本だけの並べ方では台本で読むの縮図で再生している間だけ)。
6
6
  // 舞台が本の窓に付いていっただけ(本の窓のスクロールで動いた:DECK.panes.state().fromText)の所は再生したことにしない(Player P6、spec 9873b9a)。
7
7
  // 再生したことになるのは、舞台の再生・送り・舞台のクリック・ステップへのリンクで来た所
@@ -9,7 +9,11 @@
9
9
  // 舞台の step は位置が変わるたび(舞台が見えているとき)、本の step はそのステップを初めて読んだときに送る
10
10
  // - 舞台で再生したステップと読んだステップは別々に持つ。終えた判定(deck-meta.completion。なければ索引の metadata.completion):
11
11
  // 既定は全ステップ、{visitedFraction} はその割合、{reachedEnd} は最後のステップ。played: true なら舞台で再生したものだけを数える
12
- // - SCORM の再開データ(cmi.suspend_data):{"v":1,"n","h","seen","stage","text"}。seen は再生か読んだかのどちらか(包み方 §2.2 のまま)、
12
+ // - 確認問題(format spec §8.4 ctx.answer・§9.2 checks):ファイルの問いは開いたときにパーツの宣言(questions)から数える(kit/deck.js の DECK.questions)。
13
+ // パーツの答え(kit/deck.js の deck:answer)を問いの鍵ごとに持つ(kit/core/checks.mjs の DECK.Checks)。宣言にない問いの答えは使わない。
14
+ // checks: "answered" / "correct" はステップの決まりに加えて満たす。SCORM では正解のある問いがあれば cmi.core.score.*(min 0・max 100・raw は正解した割合)。
15
+ // 答えた・正解した問いは再開データの qa・qc(包み方 §2.1)。4096 字に収まらなければ qa・qc を省く(stage・text は省かない)
16
+ // - SCORM の再開データ(cmi.suspend_data):{"v":1,"n","h","seen","stage","text","qa"?,"qc"?}。seen は再生か読んだかのどちらか(包み方 §2.2 のまま)、
13
17
  // stage・text はその内訳(同じ bitset の形。省かない:spec 9873b9a)
14
18
  // - 動画・発表者ビュー(とその中の画面)・編集のプレビュー(DECK_DEV)では何もしない。習う人のデータはファイルに書かない(format spec §9.1B)
15
19
  (function(){
@@ -68,6 +72,8 @@ function unpackBits(s, n){
68
72
 
69
73
  // ---------------------------------------------------------------- 状態
70
74
  var TL = [], ORD = Object.create(null), N = 0, H8 = "", stage = null, text = null, rule = {}, done = false, began = false;
75
+ var CK = DECK.Checks, answers = CK ? CK.newAnswers() : null, early = []; // answers は init でファイルの問いから作り直す
76
+ var SUSPEND_MAX = 4096; // cmi.suspend_data の上限(SCORM 1.2 の CMIString4096)
71
77
  var adapter = null, lastStageKey = null, lastSlide = -1;
72
78
  function slideOf(j){ return TL[j] ? TL[j].i : -1; }
73
79
  function stepParts(j){ var key = TL[j].key, c = key.lastIndexOf(":"); return {slideKey: key.slice(0, c), stepKey: key.slice(c + 1)}; }
@@ -83,20 +89,30 @@ function readRule(){
83
89
  if (c.reachedEnd === true) r.reachedEnd = true;
84
90
  else if (typeof c.visitedFraction === "number" && c.visitedFraction > 0 && c.visitedFraction <= 1) r.visitedFraction = c.visitedFraction;
85
91
  if (c.played === true) r.played = true;
92
+ var ck = CK ? CK.checksRule(c) : null;
93
+ if (ck) r.checks = ck;
86
94
  }
87
95
  return r;
88
96
  }
89
97
  function counted(j){ return !!(stage[j] || (!rule.played && text[j])); }
90
- function complete(){
98
+ function stepsDone(){
91
99
  if (!N) return false;
92
100
  if (rule.reachedEnd) return counted(N - 1);
93
101
  var c = 0; for (var j = 0; j < N; j++) if (counted(j)) c++;
94
102
  return c >= Math.ceil((rule.visitedFraction || 1) * N - 1e-9);
95
103
  }
104
+ // ステップの決まりと、確認問題の決まり(checks があるとき)の両方
105
+ function complete(){ return stepsDone() && (!rule.checks || !answers || CK.checksMet(rule.checks, answers)); }
96
106
  function suspendData(){
97
107
  var seen = new Uint8Array(N); for (var j = 0; j < N; j++) seen[j] = stage[j] | text[j];
98
108
  // 内訳(stage・text)は省かない:包み手が 3 つの bitset で 4096 字を超えうる教材を断る(包み方 §2.2)
99
- return JSON.stringify({v: 1, n: N, h: H8, seen: packBits(seen), stage: packBits(stage), text: packBits(text)});
109
+ var d = {v: 1, n: N, h: H8, seen: packBits(seen), stage: packBits(stage), text: packBits(text)}, s = JSON.stringify(d);
110
+ // 答えた・正解した問い(包み方 §2.1 の qa・qc)。答えがなければ書かない。収まらなければ省く(その分は再開で戻らない)
111
+ if (answers){
112
+ var qa = CK.keysText(answers.answered), qc = CK.keysText(answers.correct);
113
+ if (qa){ d.qa = qa; if (qc) d.qc = qc; var w = JSON.stringify(d); if (w.length <= SUSPEND_MAX) s = w; }
114
+ }
115
+ return s;
100
116
  }
101
117
  // 再開データを読む:v・n・h が今の教材と合うときだけ(合わなければ教材が変わった:使わない)。内訳がなければ seen を舞台で再生したものとする
102
118
  function restore(s){
@@ -105,6 +121,7 @@ function restore(s){
105
121
  var seen = unpackBits(d.seen, N), st = d.stage !== undefined ? unpackBits(d.stage, N) : null, tx = d.text !== undefined ? unpackBits(d.text, N) : null;
106
122
  if (!seen) return false;
107
123
  for (var j = 0; j < N; j++){ stage[j] |= st && tx ? st[j] : seen[j]; text[j] |= st && tx ? tx[j] : 0; }
124
+ if (answers) CK.restoreAnswers(answers, d.qa, d.qc);
108
125
  return true;
109
126
  }
110
127
  function locationOf(){ var st = DECK.state && DECK.state(), j = st ? ORD[st.key] : undefined; return "#" + (j === undefined ? 0 : j); }
@@ -158,6 +175,14 @@ function scormAdapter(api){
158
175
  if (sl !== lastSlide){ lastSlide = sl; commit(); } else if (Date.now() - commitAt >= COMMIT_GAP) commit(); else later();
159
176
  },
160
177
  completed: function(){ if (review || lmsDone) return; lmsDone = true; set("cmi.core.lesson_status", "completed"); commit(); },
178
+ // 答え(包み方 §2.1):正解のある問いがあれば点数(min 0・max 100・raw は正解した割合の整数)。合格・不合格は使わない。次の保存で送る
179
+ answer: function(){
180
+ if (review) return;
181
+ var sc = CK.scoreOf(answers);
182
+ if (sc !== null){ set("cmi.core.score.min", "0"); set("cmi.core.score.max", "100"); set("cmi.core.score.raw", String(sc)); }
183
+ set("cmi.suspend_data", suspendData());
184
+ later();
185
+ },
161
186
  hidden: function(){ commit(); },
162
187
  // beforeunload:pagehide より先に来る。ILIAS は Chrome でこの出来事の中なら sendBeacon で送る(basisAPI.js の useSendBeacon)。終えるのは pagehide のまま
163
188
  leaving: function(){ commit(); },
@@ -176,6 +201,7 @@ function postAdapter(){
176
201
  return {name: "postmessage", init: function(){},
177
202
  started: function(){ post({egatari: "started"}); },
178
203
  step: function(j, via){ var p = stepParts(j); post({egatari: "step", slideKey: p.slideKey, stepKey: p.stepKey, index: j, total: N, via: via}); },
204
+ answer: function(d){ var m = {egatari: "answer", slideKey: d.slideKey, id: d.id, correct: d.correct}; if ("value" in d) m.value = d.value; post(m); },
179
205
  completed: function(){ post({egatari: "completed"}); },
180
206
  hidden: function(){ post({egatari: "suspend", location: locationOf(), data: suspendData()}); },
181
207
  end: function(){ post({egatari: "suspend", location: locationOf(), data: suspendData()}); }};
@@ -186,7 +212,7 @@ function localAdapter(){
186
212
  var save = function(){ try { var d = JSON.parse(suspendData()); if (done) d.done = true; localStorage.setItem(key, JSON.stringify(d)); } catch (e) {} };
187
213
  return {name: "local", key: key,
188
214
  init: function(){ var s = null; try { s = localStorage.getItem(key); } catch (e) {} if (s && restore(s)){ try { if (JSON.parse(s).done) done = true; } catch (e) {} } if (!done && complete()) done = true; },
189
- started: function(){}, step: save, completed: save, hidden: save, end: save};
215
+ started: function(){}, step: save, answer: save, completed: save, hidden: save, end: save};
190
216
  }
191
217
 
192
218
  // ---------------------------------------------------------------- 記録する
@@ -203,6 +229,15 @@ function credit(j, via){
203
229
  adapter.step(j, via);
204
230
  if (!done && complete()){ done = true; adapter.completed(); }
205
231
  }
232
+ // パーツの答え(kit/deck.js の deck:answer):同じ問いは最後の答えで置き換え(答えた・正解したは残る)、口に渡し、終えたかを見直す
233
+ function onAnswer(d){
234
+ if (!answers || !d || typeof d.slideKey !== "string" || window.DECK_DEV) return;
235
+ if (!adapter){ if (early.length < 100) early.push(d); return; } // 記録の口を決める前(読み込みの直後)の答えは、決めてから
236
+ if (!CK.recordAnswer(answers, CK.questionKey(d.slideKey, d.index, d.id), d.correct, d.value)) return; // 宣言にない問い
237
+ adapter.answer(d);
238
+ if (!done && complete()){ done = true; adapter.completed(); }
239
+ }
240
+ document.addEventListener("deck:answer", function(e){ onAnswer(e.detail); });
206
241
  // 舞台が見えているか(kit/panes.js の並べ方。窓がなければ舞台だけ)
207
242
  function stageShown(){
208
243
  if (document.visibilityState === "hidden") return false;
@@ -274,10 +309,13 @@ function init(){
274
309
  H8 = sha256Hex(TL.map(function(g){ return g.key + "\n"; }).join("")).slice(0, 8);
275
310
  stage = new Uint8Array(N); text = new Uint8Array(N);
276
311
  rule = readRule();
312
+ // ファイルの問い(§9.2):開いたときに、まだ見ていないスライドのパーツも含めて数える
313
+ if (CK) answers = CK.newAnswers(DECK.questions ? DECK.questions().map(function(q){ return CK.questionKey(q.slideKey, q.index, q.id); }) : []);
277
314
  var api = LMS_API;
278
315
  adapter = api ? scormAdapter(api) : window.parent !== window && Q.get("embed") === "1" ? postAdapter() : localAdapter();
279
316
  adapter.init();
280
317
  if (adapter.resumeAt !== null && adapter.resumeAt !== undefined){ var g = TL[adapter.resumeAt]; DECK.go(g.i, g.k, false); }
318
+ early.splice(0).forEach(onAnswer);
281
319
  ["pointerdown", "keydown"].forEach(function(n){ window.addEventListener(n, begin, {capture: true, passive: true}); });
282
320
  document.addEventListener("deck:pos", function(e){
283
321
  if (e.detail && e.detail.auto) begin();
@@ -305,7 +343,10 @@ var LMS_API = (function(){ var a = findAPI(window); if (!a && window.opener) try
305
343
  DECK.trackingAdapter = function(){ return window.DECK_DEV ? null : LMS_API ? "scorm12" : window.parent !== window && Q.get("embed") === "1" ? "postmessage" : "local"; };
306
344
  DECK.tracking = function(){
307
345
  var list = function(a){ var o = []; if (a) for (var j = 0; j < a.length; j++) if (a[j]) o.push(j); return o; };
346
+ var keys = function(o){ return o ? Object.keys(o).sort() : []; };
308
347
  return {adapter: adapter ? adapter.name : null, total: N, hash: H8, rule: rule, stage: list(stage), text: list(text), completed: done, started: began,
348
+ questions: keys(answers && answers.declared), answered: keys(answers && answers.answered), correct: keys(answers && answers.correct), score: answers ? CK.scoreOf(answers) : null,
349
+ latest: answers ? JSON.parse(JSON.stringify(answers.latest)) : {},
309
350
  suspendData: N ? suspendData() : null, reading: readingView()};
310
351
  };
311
352
  // 試験の手前の口:読む単位を見る間(3 秒)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "egatari",
3
- "version": "0.6.18",
3
+ "version": "0.6.19",
4
4
  "license": "MIT",
5
5
  "homepage": "https://studio.egatari.org/",
6
6
  "repository": {
@@ -22,6 +22,8 @@
22
22
  // pronounce?: {readAloud(text, lang) → Promise<{ok, reason?}>, ai?: {available(lang) → bool, say(text, lang) → Promise<{ok, reason?}>}}
23
23
  // 読み方の欄(#101)の「読み上げで聞く」「AI 音声で聞く」(編集アプリ。開発サーバーには無い:ボタンを出さない)
24
24
  // onRecord?: () => void, r(このページでもデッキからでも):録音モードを開く(編集アプリ app/rec-mode.js。開発サーバーには無い)
25
+ // imageDrop?: {label, open(file)}, 原稿の欄に画像のファイルを持ってきたとき label(「画像をここにドロップすると挿入します」)を出し、落としたら
26
+ // 欄を閉じて(変えていなければ)open(file)(編集アプリの「画像を挿入」の窓 app/image-insert.js。開発サーバーには無い)
25
27
  // })
26
28
  // 信頼する編集の道具(編集モードの札・原稿の欄・コメントの欄と一覧・口述原稿の引き出し)は、どれもプレビューの外の横の板(#dev-side、
27
29
  // drawerHost の中で iframe の隣)に出す。スライドの場所に重ねる欄はない。板の上には、デッキが自分の枠の外に描けない印(色の帯)を付ける。
@@ -131,6 +133,7 @@ const CSS = [
131
133
  '#dev-editor textarea{width:100%;min-height:96px;max-height:50vh;padding:8px 10px;font:13.5px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace;resize:vertical;white-space:pre-wrap}',
132
134
  '.dev-foot{display:flex;align-items:center;gap:8px;margin-top:8px}.dev-foot .dv-hint{color:#6b7385;font-size:12px;flex:1}',
133
135
  '.dev-msg{display:none;margin-top:8px;padding:6px 10px;border-radius:6px;font-size:13px}',
136
+ '.dev-drop{display:none;margin-top:8px;padding:6px 10px;border:2px dashed #2563eb;border-radius:6px;font-size:13px;color:#1d4ed8;background:#eff6ff}.dev-drop.on{display:block}',
134
137
  '.dev-msg.dv-err{display:block;background:#fde8e8;color:#9b1c1c;border:1px solid #f5b5b5}.dev-msg.dv-ok{display:block;background:#e7f6ec;color:#16632f}',
135
138
  '#dev-comment{padding:12px 14px}',
136
139
  '#dev-comment .dv-q{color:#4b5363;background:#f4f5f8;border-left:3px solid #f59e0b;padding:4px 8px;margin-bottom:8px;font-size:12.5px;max-height:4.6em;overflow:hidden}',
@@ -498,13 +501,30 @@ export function createEditorUI(o) {
498
501
  const tag = /^[a-z][a-z0-9-]{0,20}$/.test(String(hint.tag || '')) ? hint.tag : 'element';
499
502
  const ta = h('textarea', { spellcheck: 'false' });
500
503
  const msg = h('div', { cls: 'dev-msg' });
504
+ // 画像のドロップ(o.imageDrop があるときだけ):持ってきている間は知らせを出し、落としたら「画像を挿入」の窓へ(欄には字を入れない)
505
+ const drop = o.imageDrop ? h('div', { cls: 'dev-drop', id: 'dev-drop', role: 'status', text: o.imageDrop.label }) : null;
506
+ if (drop) {
507
+ const files = (e) => !!(e.dataTransfer && [...e.dataTransfer.types].includes('Files'));
508
+ const isImage = (f) => !!f && (/^image\//.test(f.type || '') || /\.(png|jpe?g|webp|svg)$/i.test(f.name || ''));
509
+ ta.addEventListener('dragover', (e) => { if (!files(e)) return; e.preventDefault(); e.dataTransfer.dropEffect = 'copy'; drop.classList.add('on'); });
510
+ ta.addEventListener('dragleave', () => drop.classList.remove('on'));
511
+ ta.addEventListener('drop', (e) => {
512
+ drop.classList.remove('on');
513
+ if (!files(e)) return;
514
+ e.preventDefault();
515
+ const f = [...e.dataTransfer.files].find(isImage);
516
+ if (!f) return;
517
+ closeEditor();
518
+ o.imageDrop.open(f);
519
+ });
520
+ }
501
521
  const save = h('button', { cls: 'dv-pri', text: L.save });
502
522
  const cancel = h('button', { text: L.cancel });
503
523
  const card = h('div', { id: 'dev-editor', cls: 'edit-ui dev-card', role: 'dialog', 'aria-label': L.editSrc }, [
504
524
  h('div', { cls: 'dev-head' }, [h('span', { cls: 'dv-t', text: L.editSrc }), h('span', { cls: 'dv-m', text: '<' + tag + '> ' + range }), h('span', { cls: 'dv-sp' }),
505
525
  h('button', { cls: 'dv-ghost', text: '✕', title: L.closeEsc, on: { click: () => closeEditor(true) } })]),
506
526
  whereLine(),
507
- ta, msg,
527
+ ta, ...(drop ? [drop] : []), msg,
508
528
  h('div', { cls: 'dev-foot' }, [h('span', { cls: 'dv-hint', text: L.editHint }), cancel, save]),
509
529
  h('div', { cls: 'dev-lock', text: L.locked }),
510
530
  ]);
@@ -41,7 +41,7 @@
41
41
  | [`<m-tree>`](sha256/e0daed8338f51de7e86b5980a098394298455972218370ee65331ca48f7f9696/README.md) | 1.13.1 | 階層・分類の木(組織図、生物の分類など)を、根から 1 段ずつ組み立てる。座標は書かず、配置は部品が決める | 節の深さの数(by="level"、既定)か節の数(by="node")。節と edges の step があればその最大 | orient, by, link, size, fade, draw | [demo](sha256/e0daed8338f51de7e86b5980a098394298455972218370ee65331ca48f7f9696/demo.html) |
42
42
  | [`<m-venn>`](sha256/82b2dbc925a4ae4511bb48ccb1777a3932313ac7e18cb91572371d272a930980/README.md) | 1.13.1 | 2 つか 3 つの集合の円(ベン図)。集合を 1 つずつ出し、最後に重なりを強めてその中の項目を出す | 集合の数 + 1(overlaps="each" なら 集合の数 + 項目のある重なりの数) | size, dur, spread, overlaps | [demo](sha256/82b2dbc925a4ae4511bb48ccb1777a3932313ac7e18cb91572371d272a930980/demo.html) |
43
43
 
44
- ## 2.x のパーツ(components2.lock.json の既定の版 2.18.0)
44
+ ## 2.x のパーツ(components2.lock.json の既定の版 2.21.0)
45
45
 
46
46
  1.x の目録にない、2.x 専用の要素パーツ(`kind: "element"`)。土台パーツ(`kind: "library"`:base・boxplot-core・codetree-core・
47
47
  expr・heatmap-core・hist-core・icons・kanbun-core・markup-reader・plot・shape)は教材の作者が直接書かないので一覧には出さない。
@@ -56,11 +56,12 @@ expr・heatmap-core・hist-core・icons・kanbun-core・markup-reader・plot・s
56
56
  | [`<m-classify2d>`](sha256/7ab483e7fb05f646b062340d70f2749d070b4f64fed7acc0b8a7754d9ef9fded/README.md) | 2.0.1 | scikit-learn の分類を 2 次元で描く。点・領域・境界・確率や決定関数の等高線・サポートベクトル・ボロノイ図・決定木の分割・k 平均法 | 点 → 領域 → 等高線 → サポートベクトル(決定木は分割 1 つずつ → 葉、k 平均法は割り当てと更新を交互に) | dur, size, marker | [demo](sha256/7ab483e7fb05f646b062340d70f2749d070b4f64fed7acc0b8a7754d9ef9fded/demo.html) |
57
57
  | [`<m-code>`](sha256/a7c4282db79d46557bdbaf84ca519606dc46f3c23455db4a26f663453f85813c/README.md) | 2.2.1 | 短いコードを行ごとに説明し、最後に出力を見せる | コード全体→説明を順に→出力(説明数+1、出力ありは+2) | dur, size, outputPos | [demo](sha256/a7c4282db79d46557bdbaf84ca519606dc46f3c23455db4a26f663453f85813c/demo.html) |
58
58
  | [`<m-contour>`](sha256/fa6442fa3c5082cf161c29308fe0ecbd85fa33e8e4bad08c12e7961b46b1365b/README.md) | 2.0.1 | 2 変数の関数の等高線を値ごとに引き、勾配の矢印と、勾配降下法などの反復の道を 1 点ずつ見せる | 等高線の値ごと(by="all" なら 1)→ 勾配 → 道の点ごと | dur, size, by | [demo](sha256/fa6442fa3c5082cf161c29308fe0ecbd85fa33e8e4bad08c12e7961b46b1365b/demo.html) |
59
+ | [`<m-contrast>`](sha256/277ac772315f93737a094cd0f0842726f2435d352d9a90822aebfe0d5d7e79a1/README.md) | 2.0.0 | 研究の位置づけの図。問いごとに従来の答え(不明は破線)と本研究の答えを並べるか、近い研究の仮定の札と本研究の札(外した・加えた)を並べ、ステップで出す | answers は 問い → 従来の答え → 矢印と本研究の答え(order="row" で行ごと)。assumptions は 近い研究 → 本研究の行(残した・外した)→ 加えた → 得られること。order="whole" で 1 | order, dur, size | [demo](sha256/277ac772315f93737a094cd0f0842726f2435d352d9a90822aebfe0d5d7e79a1/demo.html) |
59
60
  | [`<m-ctable>`](sha256/3a7962fa87c670447eed54aca08604ef03cd26bf2c334b4667190060e6a17965/README.md) | 2.0.1 | 分散分析表・分割表・潜在結果の表を、ステップごとに埋める。使ったセルと埋めたセルを示し、表の下に式。計算を確かめる | 埋めるステップの数(anova は値の列の数、contingency は計・期待度数・χ²・オッズ比、po は 3) | dur, digits, size | [demo](sha256/3a7962fa87c670447eed54aca08604ef03cd26bf2c334b4667190060e6a17965/demo.html) |
60
61
  | [`<m-diverge>`](sha256/f4100076a37dbde6046d85969d651feffc925bd984ffe9f333ea9bd2b6816918/README.md) | 2.0.1 | 基準の棒から始め、増減の棒を前の棒の端から上下に積んで、最後に合計の棒を立てる(ウォーターフォール) | 棒の step の最大(既定は棒 1 本 = 1 ステップ。per-step で n 本ずつ) | unit, digits, per-step, dur, stagger, min, ticks, links, al | [demo](sha256/f4100076a37dbde6046d85969d651feffc925bd984ffe9f333ea9bd2b6816918/demo.html) |
61
62
  | [`<m-folds>`](sha256/2787e410e533e4ad48b0a3c2b652579cf5797f9c51fcf32f5478212a7acef95f/README.md) | 2.1.2 | データを k 個に分けた 1 つ(フォールド)を検証に使い、検証に使うフォールドを順に替えて、各分割の誤差と平均を示す | 分割を 1 行ずつ→平均(k + 1 ステップ) | dur, size | [demo](sha256/2787e410e533e4ad48b0a3c2b652579cf5797f9c51fcf32f5478212a7acef95f/demo.html) |
62
63
  | [`<m-mapping>`](sha256/6749f44ed6476a05d4e3026373c188a0e1a19b77a5836579813f62a1477ac35e/README.md) | 2.1.0 | 実験の結果を数値へ対応させ、同じ値になる結果をまとめて確率分布を作る | 結果のラベル→対応の矢印→同じ値の色と個数・確率の和→分布の横棒の 4 ステップ | dur, stagger, digits, size | [demo](sha256/6749f44ed6476a05d4e3026373c188a0e1a19b77a5836579813f62a1477ac35e/demo.html) |
63
- | [`<m-matrix>`](sha256/73edc74a2dc4a63b717106c1c1572967b6d306270574e9635d032de16c8ada72/README.md) | 2.1.0 | 研究の位置づけの表。2 本の軸の交差の表(マスに研究の名前、本研究のマスを枠で結論の 1 文と、空きマスは — と注、下に設計の行)か、研究 × 要素の表(✓ △ × や短い字、列の上に要件の出どころ)を、ステップで埋める | cross は 軸と空の表 → 従来の研究(と設計の行の従来)→ 本研究(と設計の行の本研究)→ 注(order="whole" で 1)。attributes は 列・行ごと(order)+本研究の枠 | order, dur, size | [demo](sha256/73edc74a2dc4a63b717106c1c1572967b6d306270574e9635d032de16c8ada72/demo.html) |
64
+ | [`<m-matrix>`](sha256/a5b032657720d3beb64f0b3699954e13b0eb985f36161b9ae046c83fd6048ff5/README.md) | 2.1.0 | 研究の位置づけの表。2 本の軸の交差の表(マスに研究の名前、本研究のマスを枠で結論の 1 文と、空きマスは — と注、下に設計の行)か、研究 × 要素の表(✓ △ × や短い字、列の上に要件の出どころ)を、ステップで埋める | cross は 軸と空の表(0)→ 従来(1)→ 本研究(2)→ 注(3、none のマスがあるときだけ)、order="whole" で 1。attributes は whole で 1、col・row で 列・行の数 + 1(枠) | order, dur, size | [demo](sha256/a5b032657720d3beb64f0b3699954e13b0eb985f36161b9ae046c83fd6048ff5/demo.html) |
64
65
  | [`<m-network>`](sha256/2579bcb46b6525902763cd15a2e08fc5ebd9a2695cdaba63438e5b47907a47e0/README.md) | 2.2.0 | グラフの探索(幅優先・ダイクストラなど)や巡回路を 1 ステップずつ。今の頂点・候補・訪れた頂点、選んだ辺、合計 | steps の数 | dur, size, weights | [demo](sha256/2579bcb46b6525902763cd15a2e08fc5ebd9a2695cdaba63438e5b47907a47e0/demo.html) |
65
66
  | [`<m-nnet>`](sha256/e31f6b058503f7980597c89b3e964c512ee08de7cba3fa99904d499abbb5d0e8/README.md) | 2.1.0 | ニューラルネットの層を並べ、前向きの計算を層ごとに見せる。ニューロンはまとめた丸か、Σ(重み付きの和)と f(活性化関数)に分けた形 | 入力 1 + まとめた層 1・分けた層 2(steps を書けばその数) | dur, digits, edges, size | [demo](sha256/e31f6b058503f7980597c89b3e964c512ee08de7cba3fa99904d499abbb5d0e8/demo.html) |
66
67
  | [`<m-orbit>`](sha256/1a0f21def0efbbdef64461cafa40f3883bc7f7122adf79d01f09ca4a245e5dcb/README.md) | 2.0.7 | 月の満ち欠け(金星の満ち欠け)。北極の上から見た図と地球から見た形を並べ、月を位置から位置へ動かす。形は位置から計算する | 動く先の数(既定は 8 つの位置を新月から 1 周 = 8 ステップ。visit で決める) | mode, hemisphere, sun, earth, moon, observer, size, dur | [demo](sha256/1a0f21def0efbbdef64461cafa40f3883bc7f7122adf79d01f09ca4a245e5dcb/demo.html) |
@@ -0,0 +1,34 @@
1
+ ---
2
+ summary: Predict, reveal; votes as bars, answer framed
3
+ steps: 0 question, 1 bars, answer-step (2)
4
+ props:
5
+ answer-step: 2 or more (default 2); after the step-1 count
6
+ unit: count unit
7
+ poll: live poll id
8
+ ticks: grid
9
+ example: {"question": "Which falls first?", "choices": [{"label": "Heavy"}, {"label": "Light"}, {"label": "Same"}], "answer": 2, "counts": [14, 3, 9], "note": "No air: same"}
10
+ ---
11
+
12
+ Child JSON: `{"question", "choices": [{"label", "tone"?}], "answer": 0-based, "counts"?: [sample], "note"?: answer line, "labels"?: {"correct"?: mark (default "✓ Correct")}}`
13
+
14
+ - 2–6 choices. Video/print/start show `counts` (or 0)
15
+ - Script uses `counts`; vote at `{note:hands up}` (parens get read)
16
+ - `poll="p1"`: live poll totals
17
+
18
+ <!-- llm: omit -->
19
+ Notes for authors of parts (check with dev)
20
+
21
+ - Steps: 0 question, choices, ticks (context first); 1 bars and controls; `answer-step` frame, "✓ correct", `note`, others faded, text `--muted` (≥ 4.5:1)
22
+ - Show later steps faintly: nothing ahead shown (`static preview = "none"`, manifest `preview: "none"`)
23
+ - Viewer state (spec §8.4): counts and guess survive step changes on the slide; reset to author values only on `ctx.entered` (since 2.0.0); `ctx.reset` only drops focus
24
+ - Answers (2.2.0, spec §8.4 `ctx.answer`): reaching the answer step with a guess calls `ctx.answer("q", correct, label)` once (again after going back); none without a guess, in video, or without `ctx.answer`. Since 2.3.0 the class declares `static questions = ["q"]`, so players count the question before its slide is shown
25
+ - Hands up; teacher counts ±1 or types. Alone: click = guess. Counts kept while on the slide
26
+ - Print: author values, no guess marks; screen counts restored after
27
+ - Methods: `input(choice, count)` (0–9999 integer, else console.warn; no-op in video); `counts()`
28
+ - On change: `CustomEvent("egatari-input", {bubbles: true, detail: {counts}})`
29
+ - live: `ctx.live?.poll(id)` → `number[] | null`; bars only for arrays, not in video/print
30
+ - `static interactive = true`, `static viewerInput = true` → manifest
31
+ - Keys: `+` `-` `↑` `↓` (buttons also `←` `→`); no digit keys; Esc/Enter leave the field
32
+ - No controls in video; hidden in print
33
+ - UI text (mark, labels, announcements) follows ctx.lang; `labels.correct` overrides the mark
34
+ <!-- llm: end -->