egatari 0.6.19 → 0.6.20-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +7 -2
- package/README.md +7 -2
- package/components.lock.json +6 -3
- package/components2.lock.json +172 -1
- package/kit/check-messages.mjs +2 -2
- package/kit/check.mjs +5 -3
- package/kit/core/bookmark.mjs +13 -0
- package/kit/core/llm-pack-assemble.mjs +13 -8
- package/kit/core/llm-pack-data.mjs +48 -20
- package/kit/core/llm-pack.mjs +2 -1
- package/kit/core/script-unclosed.mjs +25 -8
- package/kit/instruction-version.json +1 -1
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/presenter.js +15 -4
- package/kit/templates/new-deck.mjs +1 -1
- package/kit/tools.js +136 -4
- package/package.json +1 -1
- package/server/script-field.js +1 -1
- package/vendor/components/CATALOG.md +3 -3
- package/vendor/components/sha256/8a9215c7fea15265c2f3038f3d01a2f72441fc1e931245dee46dcaacf3548a98/README.en.md +38 -0
- package/vendor/components/sha256/8a9215c7fea15265c2f3038f3d01a2f72441fc1e931245dee46dcaacf3548a98/index.js +414 -0
- package/vendor/components/sha256/91be5c714c046244436569ecac24d9d1eb84504b3e28d8899fc89a5865e8d955/README.en.md +40 -0
- package/vendor/components/sha256/91be5c714c046244436569ecac24d9d1eb84504b3e28d8899fc89a5865e8d955/index.js +355 -0
- package/vendor/components/sha256/9a426812105a44446e8b3f98e0ccfdb6701e8386c08e8aa201b69cb5b52a4c1f/index.js +278 -0
- package/vendor/components/sha256/ad4d42a34eff125d8ccd7caf9ac329b7a8092960e7ee872fdeb853bd9c57942f/README.en.md +54 -0
- package/vendor/components/sha256/ad4d42a34eff125d8ccd7caf9ac329b7a8092960e7ee872fdeb853bd9c57942f/index.js +470 -0
- package/vendor/components/sha256/b35d01e480a203dc27aa18b0d341cc1cbc2dcca69235e909919484f1545b371f/README.en.md +23 -0
- package/vendor/components/sha256/b35d01e480a203dc27aa18b0d341cc1cbc2dcca69235e909919484f1545b371f/index.js +150 -0
- package/vendor/components-2/manifest-2.22.0.json +3240 -0
package/kit/core/llm-pack.mjs
CHANGED
|
@@ -58,7 +58,8 @@ export const PACK_VERSION = PACK.version; // 指示のバージョン(指示
|
|
|
58
58
|
export const buildPack = (opts) => assemble(PACK, opts);
|
|
59
59
|
// sets:入っている束(表が指す部品。省くと [] = 標準だけ)。off:外した札。plan:'free'(既定)| 'paid'
|
|
60
60
|
export const commonBody = (lang = 'en', { exclude = [], sets = [], off = [], plan = 'free' } = {}) => commonOf(PACK, lang, { exclude, sets, off, plan }) + '\n';
|
|
61
|
-
|
|
61
|
+
// plan:既定は 'free'(無料のプランでは束の見本を除く。handoff #95)。docs/llm-parts/*.md と同じ中身は plan: 'paid'
|
|
62
|
+
export const setPart = (name, lang = 'en', { exclude = [], plan = 'free' } = {}) => partOf(PACK, name, lang, { exclude, plan }) + '\n';
|
|
62
63
|
export const PURPOSES = PACK.purposes; // 言いたいこと(kit/core/purposes.mjs の形。source が 'manifest' か 'fallback')
|
|
63
64
|
export const requestBody = (lang = 'en') => requestOf(PACK, lang) + '\n';
|
|
64
65
|
|
|
@@ -2,23 +2,32 @@
|
|
|
2
2
|
// 次の </script> か原稿の終わりまでが <script> の中の文字になる。後ろのスライドは DOM に現れず(id も付かない)、台本の節は
|
|
3
3
|
// 「スライドが見つからない」、組み立てた文書の再生器の <script> まで飲み込んで、前のスライドの台本まで「ない」と出る。
|
|
4
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}}]
|
|
5
|
+
// scriptUnclosedFindings(src) → [{i(その <script> があるスライドの番号か null), sev: 'error', code: 'scriptUnclosed', a: {line, n, headings}, keys}]
|
|
6
6
|
// 閉じていないとみなす <script>:終わりのタグがない・中にスライドの開始タグ(<section class="slide">)がある・
|
|
7
7
|
// データの <script type="application/json"> の中にパーツの終わりのタグ(</m-…>)がある
|
|
8
8
|
// headings:<script> の中に入ったスライドの見出し(n 枚。見出しのないスライドは '')
|
|
9
|
+
// keys:そのスライドに結ぶ台本の節の鍵(id・data-key と、見出しの鍵)
|
|
10
|
+
// withoutSwallowed(warns, findings) → warns から、飲み込まれたスライドの節の「スライドが見つからない」(kit/core/build-core.mjs)を除いたもの。
|
|
11
|
+
// その節の直し方は </script> を書くことなので、「見出しを合わせるか {#id}」(R-headings)を重ねて出さない(handoff #96 の決め)。
|
|
12
|
+
// コマンド版(kit/check.mjs)と編集アプリ(app/main.js の組み立ての警告。修正依頼 app/llm.js もここから)が同じものを除く
|
|
9
13
|
import { parse } from 'parse5';
|
|
14
|
+
import { normalizeKey } from './narration-parse.mjs';
|
|
10
15
|
|
|
11
16
|
const SLIDE_START = /<section\b[^>]*\bclass\s*=\s*(?:"[^"]*\bslide\b[^"]*"|'[^']*\bslide\b[^']*'|slide\b)[^>]*>/gi;
|
|
12
17
|
const attr = (n, name) => (n.attrs || []).find((a) => a.name === name)?.value;
|
|
13
18
|
const isSlide = (n) => n.tagName === 'section' && (attr(n, 'class') || '').split(/\s+/).includes('slide');
|
|
14
19
|
const plain = (s) => s.replace(/<br\s*\/?>/gi, ' ').replace(/<[^>]*>/g, '').replace(/\s+/g, ' ').trim();
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
const attrIn = (tag, name) => tag.match(new RegExp(`\\s${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, 'i'))?.slice(1).find((v) => v !== undefined);
|
|
22
|
+
function swallowedSlides(text) {
|
|
23
|
+
const starts = [...text.matchAll(SLIDE_START)];
|
|
24
|
+
return starts.map((m, k) => {
|
|
25
|
+
const at = m.index + m[0].length;
|
|
26
|
+
const part = text.slice(at, k + 1 < starts.length ? starts[k + 1].index : text.length);
|
|
20
27
|
const h = part.match(/<h([12])\b[^>]*>([\s\S]*?)<\/h\1>/i);
|
|
21
|
-
|
|
28
|
+
const heading = h ? plain(h[2]) : '';
|
|
29
|
+
const keys = [attrIn(m[0], 'id'), attrIn(m[0], 'data-key'), heading && normalizeKey(heading)].filter(Boolean);
|
|
30
|
+
return { heading, keys };
|
|
22
31
|
});
|
|
23
32
|
}
|
|
24
33
|
|
|
@@ -36,8 +45,8 @@ export function scriptUnclosedFindings(src) {
|
|
|
36
45
|
const text = (node.childNodes || []).map((c) => c.value || '').join('');
|
|
37
46
|
const json = /^\s*application\/(?:ld\+)?json\s*$/i.test(attr(node, 'type') || '');
|
|
38
47
|
if (!loc.endTag || new RegExp(SLIDE_START.source, 'i').test(text) || (json && /<\/m-[a-z]/i.test(text))) {
|
|
39
|
-
const
|
|
40
|
-
out.push({ i: here, sev: 'error', code: 'scriptUnclosed', a: { line: lineOf(loc.startOffset), n: headings.length, headings } });
|
|
48
|
+
const sw = swallowedSlides(text), headings = sw.map((x) => x.heading);
|
|
49
|
+
out.push({ i: here, sev: 'error', code: 'scriptUnclosed', a: { line: lineOf(loc.startOffset), n: headings.length, headings }, keys: sw.flatMap((x) => x.keys) });
|
|
41
50
|
}
|
|
42
51
|
return;
|
|
43
52
|
}
|
|
@@ -47,3 +56,11 @@ export function scriptUnclosedFindings(src) {
|
|
|
47
56
|
visit(doc, null);
|
|
48
57
|
return out;
|
|
49
58
|
}
|
|
59
|
+
|
|
60
|
+
// 組み立ての「narration: スライドが見つからない「## 見出し」(スライドの id「鍵」、narration.md N 行目)」の鍵
|
|
61
|
+
const NO_SLIDE = /^narration: スライドが見つからない「[\s\S]*(スライドの id「([\s\S]*)」、narration\.md \d+ 行目)$/;
|
|
62
|
+
export function withoutSwallowed(warns, findings) {
|
|
63
|
+
const keys = new Set((findings || []).flatMap((f) => (f && f.code === 'scriptUnclosed' && f.keys) || []));
|
|
64
|
+
if (!keys.size) return (warns || []).slice();
|
|
65
|
+
return (warns || []).filter((w) => { const m = NO_SLIDE.exec(String(w)); return !m || !keys.has(m[1]); });
|
|
66
|
+
}
|
package/kit/player.json
CHANGED
package/kit/player.lock.json
CHANGED
package/kit/presenter.js
CHANGED
|
@@ -10,11 +10,11 @@ var DECK = window.DECK;
|
|
|
10
10
|
var L = DECK.ja === false
|
|
11
11
|
? {cur: "Current slide", nextFrame: "Next slide", end: "End", auto: "Autoplay", stop: "Stop", autoKey: "Autoplay (a)", reset: "Reset timer", next: "Next slide", notes: "Script", slide: "Slide ", step: "Step ", none: "(no script)", nextStep: "Next step",
|
|
12
12
|
laser: "Laser pointer (x)", pen: "Pen (d)", color: "Pen color", vpen: "Fading pen (v)", clear: "Clear ink", over: "Overview on the main window (o)", lect: "Show later steps faintly (l)",
|
|
13
|
-
feedback: "Send feedback", back: "Back", bmGroup: "Bookmarks", bm: "Bookmark: ", bmBack: "Back to where you were", close: "Close presenter view (p)", tap: "Click here to control", black: "Black screen", blackT: "The audience screen is black (b, or click it, to return)",
|
|
13
|
+
feedback: "Send feedback", goPrev: "Previous", goNext: "Next", back: "Back", bmGroup: "Bookmarks", bm: "Bookmark: ", bmBack: "Back to where you were", close: "Close presenter view (p)", tap: "Click here to control", black: "Black screen", blackT: "The audience screen is black (b, or click it, to return)",
|
|
14
14
|
legend: [["→/Space", "next"], ["←", "prev"], ["a", "autoplay"], ["b", "black screen"], ["x", "laser pointer"], ["d", "pen"], ["v", "fading pen"], ["o", "overview"], ["Esc", "exit tool / close"], ["p", "close"]]}
|
|
15
15
|
: {cur: "今の画面", nextFrame: "次のスライド", end: "終わり", auto: "自動再生", stop: "停止", autoKey: "自動再生(a)", reset: "経過時間を戻す", next: "次のスライド", notes: "台本", slide: "スライド ", step: "ステップ ", none: "(台本なし)", nextStep: "次のステップ",
|
|
16
16
|
laser: "レーザーポインター(x)", pen: "ペン(d)", color: "ペンの色", vpen: "消えるペン(v)", clear: "書き込みを消去", over: "本体でスライド一覧(o)", lect: "先のステップを薄く見せる(l)",
|
|
17
|
-
feedback: "フィードバックを送信", back: "戻る", bmGroup: "しおり", bm: "しおり:", bmBack: "元の位置に戻る", close: "発表者ビューを閉じる(p)", tap: "ここを押すと操作できます", black: "黒い画面中", blackT: "本体の画面は真っ黒です(b か、本体の画面のクリックで戻る)",
|
|
17
|
+
feedback: "フィードバックを送信", goPrev: "前へ", goNext: "次へ", back: "戻る", bmGroup: "しおり", bm: "しおり:", bmBack: "元の位置に戻る", close: "発表者ビューを閉じる(p)", tap: "ここを押すと操作できます", black: "黒い画面中", blackT: "本体の画面は真っ黒です(b か、本体の画面のクリックで戻る)",
|
|
18
18
|
legend: [["→/Space", "次"], ["←", "前"], ["a", "自動再生"], ["b", "黒い画面"], ["x", "レーザーポインター"], ["d", "ペン"], ["v", "消えるペン"], ["o", "一覧"], ["Esc", "解除・閉じる"], ["p", "閉じる"]]};
|
|
19
19
|
// 道具のボタン:[絵の名前, キー(DECK.ptools.key に渡す), 表示するキー]
|
|
20
20
|
var TOOLS = [["laser", "x", "x"], ["pen", "d", "d"], ["vpen", "v", "v"], ["clear", "clear", "⌫"], ["over", "o", "o"], ["lect", "l", "l"]];
|
|
@@ -58,7 +58,10 @@ DECK.presenterView = function(){
|
|
|
58
58
|
'<button type="button" id="pv-reset" title="' + L.reset + '" aria-label="' + L.reset + '">⟲</button>' +
|
|
59
59
|
' <span id="pv-timer" role="timer">00:00</span><span id="pv-clock"></span>' +
|
|
60
60
|
' <button type="button" id="pv-close">' + L.close + '</button></header>' +
|
|
61
|
-
' <main><div id="pv-cur"><iframe id="f-cur" title="' + L.cur + '"></iframe
|
|
61
|
+
' <main><div id="pv-cur"><iframe id="f-cur" title="' + L.cur + '"></iframe>' +
|
|
62
|
+
// 前へ・次へ(handoff #104):キーやリモコンのない所(Sidecar の iPad の Apple Pencil・指のタッチ)でも送れる。帯と同じ言葉と絵、添え字にキー
|
|
63
|
+
' <div id="pv-nav"><button type="button" id="pv-go-prev" aria-label="' + L.goPrev + '">' + (ic.prev || "") + L.goPrev + '<kbd aria-hidden="true">←</kbd></button>' +
|
|
64
|
+
'<button type="button" id="pv-go-next" aria-label="' + L.goNext + '">' + L.goNext + (ic.next || "") + '<kbd aria-hidden="true">→</kbd></button></div></div>' +
|
|
62
65
|
' <aside><div id="pv-next"><div class="lab">' + L.next + '</div><iframe id="f-next" title="' + L.nextFrame + '" tabindex="-1"></iframe><div id="pv-end" hidden>' + L.end + '</div></div>' +
|
|
63
66
|
' <div id="pv-notes"><div class="lab">' + L.notes + '</div><div id="pv-text"></div></div></aside></main>' +
|
|
64
67
|
' <footer id="pv-keys">' + legend + '</footer>' +
|
|
@@ -72,7 +75,12 @@ DECK.presenterView = function(){
|
|
|
72
75
|
"#pv button{background:#333;color:#eee;border:1px solid #555;border-radius:6px;padding:4px 12px;font-size:15px;cursor:pointer}" +
|
|
73
76
|
"#pv button:focus{outline:none}#pv button:focus-visible{outline:2px solid #9cf;outline-offset:2px}" +
|
|
74
77
|
"#pv main{flex:1;display:flex;gap:14px;padding:14px;min-height:0}" +
|
|
75
|
-
"#pv-cur{flex:0 0 62%;display:flex;
|
|
78
|
+
"#pv-cur{flex:0 0 62%;display:flex;flex-direction:column;justify-content:center;gap:10px;min-height:0}#pv-cur iframe{width:100%;aspect-ratio:16/9;border:0;background:#000;min-height:0}" +
|
|
79
|
+
// 前へ・次へ:指・ペンで押しやすい大きさ(高さ 48 px)。次へを広く
|
|
80
|
+
"#pv-nav{display:flex;gap:12px}#pv #pv-nav button{flex:1 1 0;min-height:48px;display:flex;align-items:center;justify-content:center;gap:8px;font-size:18px;user-select:none;-webkit-user-select:none;touch-action:manipulation}" +
|
|
81
|
+
"#pv #pv-nav #pv-go-next{flex-grow:2}#pv #pv-nav button:hover{background:#3d3d3d}" +
|
|
82
|
+
"#pv-nav svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}" +
|
|
83
|
+
"#pv-nav kbd{font:600 12px/1 ui-monospace,SFMono-Regular,Menlo,monospace;opacity:.6}" +
|
|
76
84
|
"#pv aside{flex:1;display:flex;flex-direction:column;gap:12px;min-width:0}" +
|
|
77
85
|
// 「次」の画面は見るだけ:押しても中にフォーカスを入れない(中のデッキはキーを受けないので、キーが止まってしまう)。押すと発表者ビューに残る
|
|
78
86
|
"#pv-next iframe{width:100%;aspect-ratio:16/9;border:0;background:#000;opacity:.85;pointer-events:none}" +
|
|
@@ -249,6 +257,9 @@ DECK.presenterView = function(){
|
|
|
249
257
|
// マウスで押したらフォーカスを残さない(キーボードで押したとき、detail = 0、は残す)
|
|
250
258
|
document.getElementById("pv-auto").onclick = function(e){ send("auto"); if (e.detail !== 0) this.blur(); };
|
|
251
259
|
document.getElementById("pv-back").onclick = function(e){ send("back"); if (e.detail !== 0) this.blur(); };
|
|
260
|
+
// 前へ・次へ:キーの ← → と同じ(暗転の間は暗転を終えるだけ。deck.js の deck-cmd)。フォーカスのあるときの Enter・Space はボタンだけが受ける(上の keydown)
|
|
261
|
+
document.getElementById("pv-go-prev").onclick = function(e){ send("prev"); if (e.detail !== 0) this.blur(); };
|
|
262
|
+
document.getElementById("pv-go-next").onclick = function(e){ send("next"); if (e.detail !== 0) this.blur(); };
|
|
252
263
|
// 道具のボタン:キーと同じ(tools.js の DECK.ptools.key)。フォーカスを奪わないので、押した後も矢印で送れる
|
|
253
264
|
[].forEach.call(document.querySelectorAll("#pv button"), function(b){ b.addEventListener("mousedown", function(e){ e.preventDefault(); }); });
|
|
254
265
|
[].forEach.call(document.querySelectorAll("#pv .pv-tools button"), function(b){
|
|
@@ -179,7 +179,7 @@ ${turns(T.s3.n, T.s3.nc)}
|
|
|
179
179
|
${turns(T.s4.n)}
|
|
180
180
|
`;
|
|
181
181
|
if (opts.blank) {
|
|
182
|
-
//
|
|
182
|
+
// blank:表紙だけ。見本のスライドとその口述原稿は入れない(編集アプリの新規作成の「白紙から」は 0.6.x でなくなった。ライブラリの選択肢として残す)
|
|
183
183
|
const a = deck.indexOf('</section>') + '</section>'.length, z = deck.lastIndexOf('</div>\n</body>');
|
|
184
184
|
const n = narration.indexOf('\n\n## ', narration.indexOf('{#' + ID[0] + '}'));
|
|
185
185
|
return { 'deck.html': deck.slice(0, a) + '\n\n' + deck.slice(z), 'narration.md': narration.slice(0, n) + '\n' };
|
package/kit/tools.js
CHANGED
|
@@ -178,6 +178,11 @@ css(
|
|
|
178
178
|
"#dt-cb .dt-bm{display:flex;align-items:center;gap:2px}" +
|
|
179
179
|
"#dt-cb .dt-bm button{width:auto;max-width:16em;padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;line-height:32px;font:600 12px/32px -apple-system,BlinkMacSystemFont,'Hiragino Sans',sans-serif}" +
|
|
180
180
|
"#dt-cb .dt-bm button[hidden]{display:none}#dt-cb .dt-bm button[aria-current=true]{box-shadow:inset 0 -2px 0 rgba(255,255,255,.7)}" +
|
|
181
|
+
// ツールバーに入りきらないときは、名前のボタンを 1 つの「しおり ▾」にまとめる(dt-bmc。入るかどうかは placeBar で測る)。押すと名前の一覧(帯の上に開く)
|
|
182
|
+
"#dt-cb .dt-bm{flex:none}#dt-cb .dt-bm.dt-bmc>[data-bm]{display:none}#dt-cb .dt-bm:not(.dt-bmc)>[data-b=bmmenu]{display:none}" +
|
|
183
|
+
"#dt-bml{position:absolute;bottom:calc(100% + 6px);left:0;z-index:1;box-sizing:border-box;min-width:10em;max-width:calc(100vw - 16px);overflow-y:auto;padding:4px;border-radius:10px;" +
|
|
184
|
+
" background:rgba(20,20,20,.92);box-shadow:0 4px 16px rgba(0,0,0,.35)}#dt-bml[hidden]{display:none}" +
|
|
185
|
+
"#dt-cb #dt-bml button{width:100%;max-width:none;text-align:left;border-radius:6px}" +
|
|
181
186
|
// 再生速度:字で今の速さを見せる
|
|
182
187
|
"#dt-cb button[data-b=rate]{width:auto;min-width:40px;padding:0 4px;font:600 12px/1 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-variant-numeric:tabular-nums}" +
|
|
183
188
|
// 編集モードの間は、発表の道具(再生・再生速度・レーザー・ペン・消えるペン・色・消す・一覧・全画面)のボタンを隠す
|
|
@@ -817,6 +822,46 @@ var OPEN_MS = 5000, openUntil = 0, hint = null, handle = null, touchAct = 0;
|
|
|
817
822
|
var revealedAt = 0, REVEAL_GUARD = 350;
|
|
818
823
|
function justRevealed(){ return Date.now() - revealedAt < REVEAL_GUARD; }
|
|
819
824
|
// マウスの動き・指のタップで帯が隠れた状態から出たときだけ、その時刻を覚える(開いたときに出すのと Tab で出すのは除く:すぐ押してよい)
|
|
825
|
+
// 指で進める(handoff #97。Kindle・PDF の閲覧ソフトと同じ):舞台の上で横に払う(左へ=次・右へ=前。横に 60 px 以上、縦の 2 倍以上、0.8 秒以内。
|
|
826
|
+
// Egatari Viewer の手書きの面と同じ基準)か、舞台の左右の端(幅の 15%)をタップすると、帯の前へ・次へと同じに 1 ステップ(再生の状態は保つ。DECK.playStep)。
|
|
827
|
+
// 左=前・右=次はキーボードと同じで、縦組みでも変えない。進めたときは帯を出さない(スライドを隠さない)。真ん中のタップは今どおり帯を出す。
|
|
828
|
+
// 指だけ(マウス・ペンは今のまま)。効かせないとき:押した所がリンク・ボタン・入力欄・パーツ(名前に - のある要素)・帯・取っ手・一覧・本の窓、
|
|
829
|
+
// 字を選んでいる途中、ピンチで拡大している間、2 本以上の指、ペンなどの道具を使っている間、暗転の間(暗転はタップで戻すだけ)、
|
|
830
|
+
// 埋め込みで操作を隠したとき(controls=0・deck-nocontrols。ホストが操作を持つ)、動画・発表者ビュー
|
|
831
|
+
var gst = null, touchesDown = 0;
|
|
832
|
+
var GESTURE_SKIP = "a[href], button, input, textarea, select, label, summary, details, [contenteditable], [role=button], [role=slider], [tabindex], #dt-cb, #dt-handle, #dt-ov, #deck-text, #deck-black";
|
|
833
|
+
function gestureOff(t){
|
|
834
|
+
if (DECK.mode === "video" || DECK.view || mode || document.getElementById("deck-black")) return true;
|
|
835
|
+
if (document.documentElement.classList.contains("deck-nocontrols")) return true;
|
|
836
|
+
if (window.visualViewport && window.visualViewport.scale > 1.01) return true;
|
|
837
|
+
var st = document.getElementById("stage");
|
|
838
|
+
if (!st || !t || !t.closest || !st.contains(t)) return true;
|
|
839
|
+
var hit = t.closest(GESTURE_SKIP);
|
|
840
|
+
if (hit && hit !== st && !(hit.classList && hit.classList.contains("slide"))) return true; // 舞台と各スライドの tabindex(フォーカスを受けるため)は除く
|
|
841
|
+
for (var n = t; n && n !== st; n = n.parentElement) if (n.localName && n.localName.indexOf("-") > 0) return true; // パーツ(カスタム要素)の中
|
|
842
|
+
var sel = window.getSelection && window.getSelection();
|
|
843
|
+
return !!(sel && !sel.isCollapsed && String(sel).trim());
|
|
844
|
+
}
|
|
845
|
+
function gestureDown(e){
|
|
846
|
+
if (e.pointerType !== "touch") return;
|
|
847
|
+
touchesDown++;
|
|
848
|
+
gst = touchesDown === 1 && e.isPrimary && !gestureOff(e.target) ? {id: e.pointerId, x: e.clientX, y: e.clientY, t: e.timeStamp} : null;
|
|
849
|
+
}
|
|
850
|
+
// 指を離したとき:進めたら true(帯は出さない)
|
|
851
|
+
function gestureUp(e){
|
|
852
|
+
var g = gst; gst = null;
|
|
853
|
+
if (!g || e.pointerId !== g.id || !DECK.ready || gestureOff(e.target)) return false;
|
|
854
|
+
var dx = e.clientX - g.x, dy = e.clientY - g.y, dt = e.timeStamp - g.t, d = 0;
|
|
855
|
+
if (Math.abs(dx) > 60 && Math.abs(dx) > 2 * Math.abs(dy) && dt < 800) d = dx < 0 ? 1 : -1;
|
|
856
|
+
else if (Math.abs(dx) < 10 && Math.abs(dy) < 10 && dt < 500){
|
|
857
|
+
var r = document.getElementById("stage").getBoundingClientRect(), edge = r.width * 0.15;
|
|
858
|
+
if (e.clientX < r.left + edge) d = -1; else if (e.clientX > r.right - edge) d = 1;
|
|
859
|
+
}
|
|
860
|
+
if (!d) return false;
|
|
861
|
+
touchAct = Date.now(); // 後から届く click で帯のボタンを押さない
|
|
862
|
+
playStep(d);
|
|
863
|
+
return true;
|
|
864
|
+
}
|
|
820
865
|
function wakeByPointer(e){ var was = !!cb && cb.classList.contains("show"); wake(e); if (cb && !was && cb.classList.contains("show")) revealedAt = Date.now(); } // touchAct:指で押した時刻(後から届く click を捨てる)
|
|
821
866
|
var HINT_KEY = ((DECK.FORMAT && DECK.FORMAT.id) || "deck") + "-player-bar-hint-v1";
|
|
822
867
|
|
|
@@ -883,7 +928,7 @@ function buildBar(){
|
|
|
883
928
|
act(b, e.detail === 0);
|
|
884
929
|
});
|
|
885
930
|
function act(b, keyboard){
|
|
886
|
-
if (typeof b._act === "function") b._act(b); else press(b._act);
|
|
931
|
+
if (typeof b._act === "function") b._act(b, keyboard); else press(b._act);
|
|
887
932
|
// マウス・指で押したらフォーカスを残さない(矢印キーがそのまま効く)。キーボード(Enter / Space、detail = 0)なら残す
|
|
888
933
|
if (!keyboard){
|
|
889
934
|
b.blur();
|
|
@@ -898,7 +943,10 @@ function buildBar(){
|
|
|
898
943
|
// 最後に押したのが指か(指で押した後の :hover は残ることがあるので、隠すかどうかの判断に使わない)
|
|
899
944
|
window.addEventListener("pointerdown", function(e){ touchLast = e.pointerType === "touch"; }, {capture: true, passive: true});
|
|
900
945
|
// 指のタップは pointermove を送らない:帯の外をタップしたら帯を出す(送らない。舞台に重ねるときも、下のほうに限らない)
|
|
901
|
-
window.addEventListener("pointerup", function(e){ if (e.pointerType === "touch" && !(e.target && e.target.closest && e.target.closest("#dt-cb"))) wakeByPointer(); }, {passive: true});
|
|
946
|
+
window.addEventListener("pointerup", function(e){ if (e.pointerType === "touch" && !(e.target && e.target.closest && e.target.closest("#dt-cb"))){ if (gestureUp(e)) return; wakeByPointer(); } }, {passive: true});
|
|
947
|
+
window.addEventListener("pointerdown", gestureDown, {capture: true, passive: true});
|
|
948
|
+
window.addEventListener("pointerup", function(e){ if (e.pointerType === "touch") touchesDown = Math.max(0, touchesDown - 1); }, {capture: true, passive: true});
|
|
949
|
+
window.addEventListener("pointercancel", function(e){ if (e.pointerType === "touch"){ touchesDown = Math.max(0, touchesDown - 1); gst = null; } }, {passive: true});
|
|
902
950
|
window.addEventListener("resize", placeBar);
|
|
903
951
|
document.addEventListener("fullscreenchange", function(){ placeBar(); syncBar(); });
|
|
904
952
|
document.addEventListener("webkitfullscreenchange", function(){ if (!("onfullscreenchange" in document)){ placeBar(); syncBar(); } }); // 古い iPadOS の Safari
|
|
@@ -915,8 +963,8 @@ function buildBar(){
|
|
|
915
963
|
}
|
|
916
964
|
// しおり(format spec §8.0、Player P4.3):しおりの名前のボタン(押すとそのスライドの最終状態へ)と、しおりで来ている間だけの「元の位置に戻る」。
|
|
917
965
|
// しおりがなければ作らない(false)。動画ではこの道具ごと作らない。印刷では帯ごと隠れる
|
|
918
|
-
var BM_T = JA ? {group: "しおり", one: function(n){ return "しおり:" + n; }, back: "元の位置に戻る"}
|
|
919
|
-
: {group: "Bookmarks", one: function(n){ return "Bookmark: " + n; }, back: "Back to where you were"};
|
|
966
|
+
var BM_T = JA ? {group: "しおり", one: function(n){ return "しおり:" + n; }, back: "元の位置に戻る", menu: "しおり ▾"}
|
|
967
|
+
: {group: "Bookmarks", one: function(n){ return "Bookmark: " + n; }, back: "Back to where you were", menu: "Bookmarks ▾"};
|
|
920
968
|
function bmGroup(){
|
|
921
969
|
var L = DECK.bookmarks ? DECK.bookmarks() : [];
|
|
922
970
|
if (!L.length) return false;
|
|
@@ -928,12 +976,93 @@ function bmGroup(){
|
|
|
928
976
|
e._act = function(){ DECK.bookmark(n); };
|
|
929
977
|
g.appendChild(e);
|
|
930
978
|
});
|
|
979
|
+
// 入りきらないときの「しおり ▾」と、その名前の一覧(role=menu。項目は開くたびに作る)
|
|
980
|
+
var mb = document.createElement("button"); mb.type = "button";
|
|
981
|
+
mb.setAttribute("data-b", "bmmenu"); mb.textContent = BM_T.menu; mb.title = BM_T.group; mb.setAttribute("aria-label", BM_T.group);
|
|
982
|
+
mb.setAttribute("aria-haspopup", "menu"); mb.setAttribute("aria-expanded", "false"); mb.setAttribute("aria-controls", "dt-bml");
|
|
983
|
+
mb._act = function(b, keyboard){ bmMenu(mb.getAttribute("aria-expanded") !== "true", keyboard); };
|
|
984
|
+
g.appendChild(mb);
|
|
985
|
+
var ml = document.createElement("div"); ml.id = "dt-bml"; ml.setAttribute("role", "menu"); ml.setAttribute("aria-label", BM_T.group); ml.hidden = true;
|
|
986
|
+
g.appendChild(ml);
|
|
931
987
|
var r = document.createElement("button"); r.type = "button";
|
|
932
988
|
r.setAttribute("data-b", "bmback"); r.textContent = "↩ " + BM_T.back; r.hidden = true;
|
|
933
989
|
r.title = BM_T.back + kk("Backspace"); r.setAttribute("aria-label", BM_T.back); r.setAttribute("aria-keyshortcuts", "Backspace");
|
|
934
990
|
r._act = function(){ DECK.bookmarkBack(); };
|
|
935
991
|
g.appendChild(r);
|
|
936
992
|
cb.appendChild(g);
|
|
993
|
+
// 帯の外を押したら一覧を閉じる
|
|
994
|
+
window.addEventListener("pointerdown", function(e){ if (mb.getAttribute("aria-expanded") === "true" && !(e.target && e.target.closest && (e.target.closest("#dt-bml") || e.target.closest('[data-b="bmmenu"]')))) bmMenu(false); }, true);
|
|
995
|
+
if (document.fonts && document.fonts.ready) document.fonts.ready.then(function(){ placeBar(); });
|
|
996
|
+
return true;
|
|
997
|
+
}
|
|
998
|
+
// 名前のボタンがツールバーの 1 行に入るか測り、入らなければ「しおり ▾」にまとめる(数では決めない。窓の大きさが変わるたびに placeBar から)
|
|
999
|
+
function bmFit(){
|
|
1000
|
+
var g = cb && cb.querySelector(".dt-bm");
|
|
1001
|
+
if (!g) return;
|
|
1002
|
+
var was = g.classList.contains("dt-bmc"), cs = getComputedStyle(cb);
|
|
1003
|
+
g.classList.remove("dt-bmc");
|
|
1004
|
+
var room = (parseFloat(cb.style.maxWidth) || innerWidth - 16) - (parseFloat(cs.paddingLeft) || 0) - (parseFloat(cs.paddingRight) || 0);
|
|
1005
|
+
var fold = g.getBoundingClientRect().width > room + 0.5;
|
|
1006
|
+
g.classList.toggle("dt-bmc", fold);
|
|
1007
|
+
if (was && !fold) bmMenu(false);
|
|
1008
|
+
if (!was && fold && g.contains(document.activeElement) && document.activeElement.hasAttribute("data-bm")) g.querySelector('[data-b="bmmenu"]').focus();
|
|
1009
|
+
}
|
|
1010
|
+
// 名前の一覧を開く・閉じる。キーボードで開いたら、今いるしおり(なければ最初)の項目へ
|
|
1011
|
+
function bmMenu(open, keyboard, last){
|
|
1012
|
+
var mb = cb && cb.querySelector('[data-b="bmmenu"]'), ml = document.getElementById("dt-bml");
|
|
1013
|
+
if (!mb || !ml) return;
|
|
1014
|
+
var was = mb.getAttribute("aria-expanded") === "true";
|
|
1015
|
+
if (!open){
|
|
1016
|
+
if (!was) return;
|
|
1017
|
+
var inside = ml.contains(document.activeElement);
|
|
1018
|
+
mb.setAttribute("aria-expanded", "false"); ml.hidden = true; ml.textContent = "";
|
|
1019
|
+
if (inside) mb.focus();
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
var L = DECK.bookmarks ? DECK.bookmarks() : [], act = DECK.bookmarkActive && DECK.bookmarkActive(), st = DECK.state();
|
|
1023
|
+
ml.textContent = "";
|
|
1024
|
+
L.forEach(function(x, n){
|
|
1025
|
+
var e = document.createElement("button"); e.type = "button"; e.className = "dt-bmi";
|
|
1026
|
+
e.setAttribute("role", "menuitem"); e.setAttribute("data-bm", n); e.tabIndex = -1; e.textContent = x.name; e.title = BM_T.one(x.name);
|
|
1027
|
+
if (act && x.i === st.slide - 1) e.setAttribute("aria-current", "true");
|
|
1028
|
+
e._act = function(){ bmMenu(false); DECK.bookmark(n); };
|
|
1029
|
+
ml.appendChild(e);
|
|
1030
|
+
});
|
|
1031
|
+
mb.setAttribute("aria-expanded", "true"); ml.hidden = false;
|
|
1032
|
+
if (hint){ hint.remove(); hint = null; } // 出し方の 1 行が一覧に重ならないように
|
|
1033
|
+
// 帯の上に開き、画面の左右からはみ出さない。高さは帯の上の余白まで
|
|
1034
|
+
var cr = cb.getBoundingClientRect(), br = mb.getBoundingClientRect();
|
|
1035
|
+
ml.style.maxHeight = Math.max(80, Math.floor(cr.top - 12)) + "px";
|
|
1036
|
+
ml.style.left = Math.round(br.left - cr.left) + "px";
|
|
1037
|
+
var r = ml.getBoundingClientRect(), dx = 0;
|
|
1038
|
+
if (r.right > innerWidth - 8) dx = innerWidth - 8 - r.right;
|
|
1039
|
+
if (r.left + dx < 8) dx = 8 - r.left;
|
|
1040
|
+
if (dx) ml.style.left = Math.round(br.left - cr.left + dx) + "px";
|
|
1041
|
+
if (keyboard){
|
|
1042
|
+
var items = ml.querySelectorAll('[role="menuitem"]'), cur = ml.querySelector('[aria-current="true"]');
|
|
1043
|
+
var f = last ? items[items.length - 1] : cur || items[0];
|
|
1044
|
+
if (f) f.focus();
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
// 一覧と「しおり ▾」のキー:↓↑ で動く(端で回る)、Home / End、Esc で閉じて「しおり ▾」へ、Tab で閉じる。「しおり ▾」の上の ↓↑ でも開く
|
|
1048
|
+
function bmMenuKey(e){
|
|
1049
|
+
var ml = document.getElementById("dt-bml"), a = document.activeElement;
|
|
1050
|
+
if (!ml || !a) return false;
|
|
1051
|
+
var k = e.key;
|
|
1052
|
+
if (a.getAttribute("data-b") === "bmmenu"){
|
|
1053
|
+
if (k === "ArrowDown" || k === "ArrowUp"){ bmMenu(true, true, k === "ArrowUp"); return true; }
|
|
1054
|
+
if (k === "Escape" && a.getAttribute("aria-expanded") === "true"){ bmMenu(false); return true; }
|
|
1055
|
+
return false;
|
|
1056
|
+
}
|
|
1057
|
+
if (!ml.contains(a)) return false;
|
|
1058
|
+
var items = [].slice.call(ml.querySelectorAll('[role="menuitem"]')), j = items.indexOf(a);
|
|
1059
|
+
if (k === "ArrowDown") items[(j + 1) % items.length].focus();
|
|
1060
|
+
else if (k === "ArrowUp") items[(j - 1 + items.length) % items.length].focus();
|
|
1061
|
+
else if (k === "Home") items[0].focus();
|
|
1062
|
+
else if (k === "End") items[items.length - 1].focus();
|
|
1063
|
+
else if (k === "Escape") bmMenu(false);
|
|
1064
|
+
else if (k === "Tab"){ bmMenu(false); return false; }
|
|
1065
|
+
else return k !== "Enter" && k !== " "; // Enter / Space は項目の click に任せる。ほかのキー(スライドを送るなど)は一覧の間は止める
|
|
937
1066
|
return true;
|
|
938
1067
|
}
|
|
939
1068
|
// 舞台の下に 44px 以上の余白があれば余白の真ん中に、なければ下端に重ねる
|
|
@@ -944,6 +1073,7 @@ function placeBar(){
|
|
|
944
1073
|
var sb = sbox(), k = Math.min(sb.w / W, sb.h / H), m = (sb.h - H * k) / 2;
|
|
945
1074
|
cb.style.left = Math.round(sb.x + sb.w / 2) + "px";
|
|
946
1075
|
cb.style.maxWidth = Math.max(160, sb.w - 16) + "px";
|
|
1076
|
+
bmFit();
|
|
947
1077
|
// 帯の高さ(狭い画面では 2 行になる)。隠れていても大きさは測れる
|
|
948
1078
|
cb.classList.remove("dt-wrap");
|
|
949
1079
|
var bh = cb.offsetHeight || 38;
|
|
@@ -976,6 +1106,7 @@ function wake(e){
|
|
|
976
1106
|
hideT = setTimeout(function hide(){
|
|
977
1107
|
if ((!touchLast && cb.matches(":hover")) || cb.contains(document.activeElement) || (handle && handle === document.activeElement)){ hideT = setTimeout(hide, 800); return; }
|
|
978
1108
|
cb.classList.remove("show");
|
|
1109
|
+
bmMenu(false);
|
|
979
1110
|
if (hint){ hint.remove(); hint = null; }
|
|
980
1111
|
showHandle(true);
|
|
981
1112
|
liftCaptions();
|
|
@@ -1202,6 +1333,7 @@ window.addEventListener("keydown", function(e){
|
|
|
1202
1333
|
return;
|
|
1203
1334
|
}
|
|
1204
1335
|
if (!layer || typing(e) || e.metaKey || e.ctrlKey || e.altKey) return;
|
|
1336
|
+
if (bmMenuKey(e)){ e.preventDefault(); e.stopImmediatePropagation(); return; }
|
|
1205
1337
|
// 暗転の間(kit/deck.js の b):道具のキーは使わない(b・Esc・クリックで戻すのは deck.js)
|
|
1206
1338
|
if (document.documentElement.classList.contains("blackout")) return;
|
|
1207
1339
|
var k = e.key, done = true;
|
package/package.json
CHANGED
package/server/script-field.js
CHANGED
|
@@ -17,7 +17,7 @@ export function createScriptField(doc, o = {}) {
|
|
|
17
17
|
el.setAttribute('contenteditable', 'true');
|
|
18
18
|
el.setAttribute('role', 'textbox');
|
|
19
19
|
el.setAttribute('aria-multiline', 'false');
|
|
20
|
-
el.setAttribute('spellcheck', '
|
|
20
|
+
el.setAttribute('spellcheck', 'true'); // 台本は文章なのでスペルチェックを入れる(英語の教材。handoff #100 の 4。lang の言葉で)
|
|
21
21
|
if (o.label) el.setAttribute('aria-label', o.label);
|
|
22
22
|
if (o.placeholder) el.setAttribute('data-ph', o.placeholder);
|
|
23
23
|
if (o.lang) el.setAttribute('lang', o.lang);
|
|
@@ -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.
|
|
44
|
+
## 2.x のパーツ(components2.lock.json の既定の版 2.22.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)は教材の作者が直接書かないので一覧には出さない。
|
|
@@ -49,12 +49,12 @@ expr・heatmap-core・hist-core・icons・kanbun-core・markup-reader・plot・s
|
|
|
49
49
|
| 部品 | 版 | 内容 | 段階の数 | 受け取る値 | 見本 |
|
|
50
50
|
|---|---|---|---|---|---|
|
|
51
51
|
| [`<m-balance>`](sha256/5521b5b40a43c48c5ae5a50ce87afb3d47bb23b133b16841086d8322364cdd5e/README.md) | 2.0.2 | 確率の重りを置き、支点が期待値でつり合う様子を示す | 数直線と重り→支点を期待値へ→値と和の式(3 ステップ) | dur, digits, size | [demo](sha256/5521b5b40a43c48c5ae5a50ce87afb3d47bb23b133b16841086d8322364cdd5e/demo.html) |
|
|
52
|
-
| [`<m-callout>`](sha256/
|
|
52
|
+
| [`<m-callout>`](sha256/b35d01e480a203dc27aa18b0d341cc1cbc2dcca69235e909919484f1545b371f/README.md) | 2.1.0 | 画面の画像に番号の丸を置き、引き出し線で横の説明につなぐ。ステップごとに 1 つずつ(研修・手引き・操作の説明) | 説明の step の最大(既定は説明 1 つ = 1 ステップ。per-step で n 個ずつ) | side, label-width, per-step, dur, size | [demo](sha256/b35d01e480a203dc27aa18b0d341cc1cbc2dcca69235e909919484f1545b371f/demo.html) |
|
|
53
53
|
| [`<m-cards>`](sha256/7a5adf73fc053b9f2ca56643b5683b42589edb0f63c845ecb7ae7e6b87eccc30/README.md) | 2.1.0 | カード(番号の丸・アイコン・見出し・説明)を横一列か 2 段に並べ、ステップごとに出す。矢印で順を、枠の色で強調を見せる | カードの step の最大(既定はカード 1 枚 = 1 ステップ。per-step で n 枚ずつ) | layout, arrows, nums, hilite, per-step, stagger, dur | [demo](sha256/7a5adf73fc053b9f2ca56643b5683b42589edb0f63c845ecb7ae7e6b87eccc30/demo.html) |
|
|
54
54
|
| [`<m-checklist>`](sha256/8db9c936c36b79b9e3b2be37639487b15502a6937f411ed714621a8091437e9b/README.md) | 2.0.1 | 確かめる項目を並べ、ステップごとに 1 つずつ印(✓・×)を描く。印はスライドの中身で、見ている人の操作を保存しない | 項目の step の最大(既定は項目 1 つ = 1 ステップ。per-step で n 個ずつ) | reveal, per-step, dur, stagger, size | [demo](sha256/8db9c936c36b79b9e3b2be37639487b15502a6937f411ed714621a8091437e9b/demo.html) |
|
|
55
55
|
| [`<m-ci>`](sha256/832556ea9c82c292a3ba9e1b332f2405c5c2f969ff8157c91ed80226ec8ac62e/README.md) | 2.0.2 | 正規標本の区間を重ね、母平均を含む割合で信頼水準を説明する | 軸と μ→区間を順に→含む数と外れの強調(3 ステップ) | dur, fast, size | [demo](sha256/832556ea9c82c292a3ba9e1b332f2405c5c2f969ff8157c91ed80226ec8ac62e/demo.html) |
|
|
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
|
-
| [`<m-code>`](sha256/
|
|
57
|
+
| [`<m-code>`](sha256/8a9215c7fea15265c2f3038f3d01a2f72441fc1e931245dee46dcaacf3548a98/README.md) | 2.2.1 | 短いコードを行ごとに説明し、最後に出力を見せる | コード全体→説明を順に→出力(説明数+1、出力ありは+2) | dur, size, outputPos | [demo](sha256/8a9215c7fea15265c2f3038f3d01a2f72441fc1e931245dee46dcaacf3548a98/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
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) |
|
|
60
60
|
| [`<m-ctable>`](sha256/3a7962fa87c670447eed54aca08604ef03cd26bf2c334b4667190060e6a17965/README.md) | 2.0.1 | 分散分析表・分割表・潜在結果の表を、ステップごとに埋める。使ったセルと埋めたセルを示し、表の下に式。計算を確かめる | 埋めるステップの数(anova は値の列の数、contingency は計・期待度数・χ²・オッズ比、po は 3) | dur, digits, size | [demo](sha256/3a7962fa87c670447eed54aca08604ef03cd26bf2c334b4667190060e6a17965/demo.html) |
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Code notes
|
|
3
|
+
steps: Code → notes → output (n+1/+2)
|
|
4
|
+
props:
|
|
5
|
+
dur: Seconds
|
|
6
|
+
size: Text px
|
|
7
|
+
outputPos: Output
|
|
8
|
+
example: {"lang":"python","code":"import pandas as pd\ndf = pd.read_csv(\"sales.csv\")\ndf.groupby(\"store\")[\"sales\"].mean()","steps":[{"lines":[1],"note":"Load pandas"},{"lines":[2],"note":"Read CSV"},{"lines":[3],"note":"Mean"}],"output":"store\nA 120.5\nB 98.0"}
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
`<m-code>` child JSON.
|
|
12
|
+
|
|
13
|
+
- `code`: 440px shows 9 lines of 76 chars; longer lines wrap, more scroll in a window (≤16; else split).
|
|
14
|
+
- `lang` (colours for python, r, shell, js only); `steps[{lines,note}]`: `[3]`, range `[3,4]`, or 3+ lines `[2,5,9]`; notes ≤30 chars.
|
|
15
|
+
- `output`: ≤8 lines.
|
|
16
|
+
|
|
17
|
+
Script: explain each line; never read code aloud.
|
|
18
|
+
|
|
19
|
+
<!-- llm: omit -->
|
|
20
|
+
Displays supplied text; never runs code. Code first, then highlights and notes. Beside: natural code width ≤55% and every note fits; earlier notes stay muted, all shown at completion. Otherwise band: only the current note, prefixed “lines 3–4”. Final/print: numbered compact list, no code highlight. If the list needs more height, report and keep the last numbered note. Deterministic seeking. Fit layout (2.2.0), only when the 2.1.0 layout would not fit (same pixels otherwise): band notes up to 2 rows; long lines wrap after a space, comma or opening bracket under a "↪" gutter; a window per step centred on its lines, "⋮ n" for hidden rows (it changes in the step's first half, then shows in the second); a final list that does not fit keeps the last note with `data-fit="last-note"` (no report); a window under 3 rows reports size. Full source and output in `pre[data-readable]`. Preview uses --preview-opacity; the final list previews before notes begin.
|
|
21
|
+
|
|
22
|
+
dur .6s; size 0=24px code/26px notes, otherwise ≥24. outputPos auto/below/right. Beside auto: right for ≤8 lines when columns fit. Band auto: right when natural code width ≤70% and output fits, else below the band. Explicit right/below retained. Bad props report/default.
|
|
23
|
+
|
|
24
|
+
Colours are theme roles: for Python, R, shell and JavaScript (js), keywords term, strings accent2 (Python triple quotes and JS templates span lines), # (JS //) comments outside strings muted, the rest fg; other languages stay fg. Code reads the same without colour. `[[3,4]]` reads as `[3,4]`; two ranges in one step report range. Tabs: four spaces. Monospace width .6em, wide characters 1em. Full-width band mode at 1184px/24px fits 77 ASCII characters with single-digit line numbers, 76 with two digits. Beside notes/right output reduce this. Beside notes wrap/stack with connectors; each band note is one truncated row.
|
|
25
|
+
|
|
26
|
+
Default height, one band row, right/no output: header 50 + n × row 34 + padding 16 + gap 8 + band 58 = **132 + 34n px**. General: r=ceil(1.4×size), header=r+16, b=ceil(1.45×note px+4)+16; H=header+n×r+16+8+b. No notes: omit 8+b. Below output adds 16+header+output rows×r+16. Final list (24px, 35px rows) packs “3–4: note” items; each row beyond one adds 35px. Auto output that would go below sits beside the band when its natural width ≤45%; the zone is then max(band, output). Every “give the element about H px” uses this formula; above 440px (body under a heading) reports give lines that fit at 440px and say fewer lines/shorter notes/split instead. If only the list misses, all code stays and the final state keeps the last note.
|
|
27
|
+
|
|
28
|
+
| Height | Code lines (one band row) |
|
|
29
|
+
|---|---|
|
|
30
|
+
| 380px | 7 (needs 370px) |
|
|
31
|
+
| 440px | 9 (438px) |
|
|
32
|
+
| 540px | 12 (540px) |
|
|
33
|
+
| 680px | 16 (676px) |
|
|
34
|
+
|
|
35
|
+
A 59-character line exceeds 70% width: auto output goes below. Seven lines + band + one output row need 486px; two output rows need 520px. Without output, 380px fits. Separate layout reports give line count/capacity/needed height, longest line/character capacity, or note index/width/capacity/target length. Oversize text truncates with …; tiny elements retain clipped content and numeric size reports. Code ≤16 lines, output ≤8. Invalid ranges report; no highlight/connector, notes/steps preserved.
|
|
36
|
+
|
|
37
|
+
ctx.lang ja/en. Figure role; author label preserved; SVG hidden. Full source/output in non-focusable sr-only pre. All notes remain in the accessible summary. Fictional sales data.
|
|
38
|
+
<!-- llm: end -->
|