egatari 0.6.12 → 0.6.13-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +2 -2
- package/README.md +2 -2
- package/bin/egatari.mjs +3 -1
- package/components.lock.json +141 -51
- package/components2.lock.json +500 -1
- package/kit/browser.mjs +19 -7
- package/kit/check-messages.mjs +2 -0
- package/kit/check.mjs +2 -0
- package/kit/core/article-links.mjs +5 -4
- package/kit/core/article-messages.mjs +6 -1
- package/kit/core/article-render.mjs +61 -42
- package/kit/core/article-text.mjs +42 -1
- package/kit/core/article.mjs +7 -6
- package/kit/core/build-core.mjs +4 -0
- package/kit/core/caution.mjs +49 -0
- package/kit/core/check-parity.mjs +1 -0
- package/kit/core/check-rules.mjs +3 -0
- package/kit/core/check-source.mjs +2 -0
- package/kit/core/colab-core.mjs +1 -1
- package/kit/core/llm-pack-assemble.mjs +4 -3
- package/kit/core/llm-pack-data.mjs +124 -10
- package/kit/core/part-labels.mjs +3 -0
- package/kit/core/purposes.mjs +6 -8
- package/kit/instruction-version.json +1 -1
- package/kit/layouts.css +8 -1
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/package.json +1 -1
- package/themes/asagi/theme.json +1 -1
- package/themes/asagi/tokens.css +2 -0
- package/themes/bengara/theme.json +1 -1
- package/themes/bengara/tokens.css +2 -0
- package/themes/business/theme.json +1 -1
- package/themes/business/tokens.css +2 -0
- package/themes/default/theme.json +1 -1
- package/themes/default/tokens.css +2 -0
- package/themes/kogecha/theme.json +1 -1
- package/themes/kogecha/tokens.css +2 -0
- package/themes/kokugo/theme.json +1 -1
- package/themes/kokugo/tokens.css +2 -0
- package/themes/murasaki/theme.json +1 -1
- package/themes/murasaki/tokens.css +2 -0
- package/themes/sumi/theme.json +1 -1
- package/themes/sumi/tokens.css +2 -0
- package/themes/tokiwa/theme.json +1 -1
- package/themes/tokiwa/tokens.css +2 -0
- package/themes.lock.json +92 -28
- package/vendor/components/CATALOG.md +6 -3
- package/vendor/components/sha256/061415b5f5a1861e115103224ebbcaf689b602cd9972516001f50f4646d3692a/README.en.md +33 -0
- package/vendor/components/sha256/061415b5f5a1861e115103224ebbcaf689b602cd9972516001f50f4646d3692a/index.js +390 -0
- package/vendor/components/sha256/1854c2d9091a44f465a8de71de2ef3cfa26de3750c67aba4d0ab6eef9b826b8c/README.en.md +21 -0
- package/vendor/components/sha256/1854c2d9091a44f465a8de71de2ef3cfa26de3750c67aba4d0ab6eef9b826b8c/index.js +108 -0
- package/vendor/components/sha256/19803bbabc26cab7937b17c101f0529239ad505e2ef72a5b21c5d0b9afb063b5/README.en.md +35 -0
- package/vendor/components/sha256/19803bbabc26cab7937b17c101f0529239ad505e2ef72a5b21c5d0b9afb063b5/index.js +179 -0
- package/vendor/components/sha256/1fac9a4c6608f0150a51275fb11bad0dcff00bed1696c2d93d150fa97219e41a/README.en.md +23 -0
- package/vendor/components/sha256/1fac9a4c6608f0150a51275fb11bad0dcff00bed1696c2d93d150fa97219e41a/index.js +147 -0
- package/vendor/components/sha256/24e433f4e96427b5b4625ea6542ae74393a8610a9e3d331d01481b3185c827d4/README.en.md +66 -0
- package/vendor/components/sha256/24e433f4e96427b5b4625ea6542ae74393a8610a9e3d331d01481b3185c827d4/index.js +984 -0
- package/vendor/components/sha256/336f518ad98df0700348406a1fcc4a2de6843b68de0d2e6fcb2cf92428cc3f32/index.js +121 -0
- package/vendor/components/sha256/362590bb028486c9b92c90b0c04bb21c9989b7da1b9d234f0d3c26093770eb52/index.js +228 -0
- package/vendor/components/sha256/3c79d2605e1949c302a5e190dab3d12812e548af7d66e80dd73dc517dfa1ae3d/index.js +268 -0
- package/vendor/components/sha256/4526a332a77fce02370c58d6acd2b83777bfac10aca91e304f105ca2d6935e21/README.en.md +40 -0
- package/vendor/components/sha256/4526a332a77fce02370c58d6acd2b83777bfac10aca91e304f105ca2d6935e21/index.js +405 -0
- package/vendor/components/sha256/46fd8b2bfa296e18d7720dec9c9639421fb02cec1b641e50e2cadefcc3945675/README.en.md +31 -0
- package/vendor/components/sha256/46fd8b2bfa296e18d7720dec9c9639421fb02cec1b641e50e2cadefcc3945675/index.js +236 -0
- package/vendor/components/sha256/49fc5add9b34d9a34fcf9ffa3772da4a36d054feead033a7212b98ce1e18705d/index.js +465 -0
- package/vendor/components/sha256/4bedc6e22490461bb624d1801954aed230e9f47e393d2a9779c89c4c6483ab3e/README.en.md +42 -0
- package/vendor/components/sha256/4bedc6e22490461bb624d1801954aed230e9f47e393d2a9779c89c4c6483ab3e/index.js +549 -0
- package/vendor/components/sha256/5b3a29cd3ad1c572ba2864430fde589a0fa90f5a7cf6c8753ccfc97dd16d99f3/README.en.md +37 -0
- package/vendor/components/sha256/5b3a29cd3ad1c572ba2864430fde589a0fa90f5a7cf6c8753ccfc97dd16d99f3/index.js +501 -0
- package/vendor/components/sha256/6e9d8d26ba0427f26a8143ecaf1ff3a3fec1a6cb114ef5feed15a62f6a6e77c2/README.en.md +54 -0
- package/vendor/components/sha256/6e9d8d26ba0427f26a8143ecaf1ff3a3fec1a6cb114ef5feed15a62f6a6e77c2/index.js +470 -0
- package/vendor/components/sha256/9ffe48f7c39657aacbbca355c8268a4682f306c0e453bdd73b69c3ed7e0cb030/README.en.md +30 -0
- package/vendor/components/sha256/9ffe48f7c39657aacbbca355c8268a4682f306c0e453bdd73b69c3ed7e0cb030/index.js +192 -0
- package/vendor/components/sha256/a04ba1b59cae0406ad91c64da77df1f77d0ae6fb5629da4549452f68b926a20b/index.js +315 -0
- package/vendor/components/sha256/c129c1c6c5df8ddafed87ea41fe6f9fc03784b2904059321f970d16ff3238bf8/index.js +312 -0
- package/vendor/components/sha256/d831672acd189fd9e6bd294bdbceab539f4b2dc4ec0415e776a9fe740c499544/index.js +97 -0
- package/vendor/components/sha256/dc5d9e6da444ef49ac343c870271c6679601040bf3a38a389a7991ffd39dd0fc/index.js +607 -0
- package/vendor/components/sha256/deae02519dd79e53cf18137777d486cb3b3234ab02a71d26c4e2925593b047ba/LICENSE-tabler.txt +21 -0
- package/vendor/components/sha256/deae02519dd79e53cf18137777d486cb3b3234ab02a71d26c4e2925593b047ba/index.js +4868 -0
- package/vendor/components/sha256/deae02519dd79e53cf18137777d486cb3b3234ab02a71d26c4e2925593b047ba/names.txt +4808 -0
- package/vendor/components/sha256/e76667b8fbaeb6c5d05ada81b2230f21388e2e68f3437034d2a54ead1c8ccbef/README.en.md +32 -0
- package/vendor/components/sha256/e76667b8fbaeb6c5d05ada81b2230f21388e2e68f3437034d2a54ead1c8ccbef/index.js +222 -0
- package/vendor/components-2/manifest-2.9.0.json +2204 -0
- package/vendor/components-2/manifest-2.9.1.json +2204 -0
- package/vendor/egatari-spec/SOURCE.json +3 -3
- package/vendor/themes/asagi/1.3.0/theme.json +14 -0
- package/vendor/themes/asagi/1.3.0/tokens.css +36 -0
- package/vendor/themes/bengara/1.0.0/theme.json +13 -0
- package/vendor/themes/bengara/1.0.0/tokens.css +66 -0
- package/vendor/themes/business/1.3.0/theme.json +5 -0
- package/vendor/themes/business/1.3.0/tokens.css +47 -0
- package/vendor/themes/default/1.5.0/README.ja.md +65 -0
- package/vendor/themes/default/1.5.0/README.md +65 -0
- package/vendor/themes/default/1.5.0/theme.json +4 -0
- package/vendor/themes/default/1.5.0/tokens.css +95 -0
- package/vendor/themes/kogecha/1.3.0/theme.json +10 -0
- package/vendor/themes/kogecha/1.3.0/tokens.css +35 -0
- package/vendor/themes/kokugo/1.3.0/theme.json +5 -0
- package/vendor/themes/kokugo/1.3.0/tokens.css +31 -0
- package/vendor/themes/murasaki/1.3.0/theme.json +10 -0
- package/vendor/themes/murasaki/1.3.0/tokens.css +31 -0
- package/vendor/themes/sumi/1.3.0/theme.json +10 -0
- package/vendor/themes/sumi/1.3.0/tokens.css +57 -0
- package/vendor/themes/tokiwa/1.3.0/theme.json +10 -0
- package/vendor/themes/tokiwa/1.3.0/tokens.css +33 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// m-kpi:大きな数字の札(KPI)を段階ごとに出す。数字は 0(か from)から数え上げ、下に増減の矢印と一言
|
|
2
|
+
// <m-kpi style="height:300px"><script type="application/json">
|
|
3
|
+
// {"cards": [{"label": "作成時間", "value": 62, "unit": "%", "prefix": "−", "delta": {"dir": "down", "text": "前の版から 8 pt", "good": true}, "note": "1 本あたり"}]}
|
|
4
|
+
// (JSON の終わり)</m-kpi>
|
|
5
|
+
// 段階:既定は札 1 枚 = 1 段階(per-step で n 枚ずつ、札の step で直接、at で段階の中の開始秒)
|
|
6
|
+
// 数え上げは (k, t) だけで決まる(初めに速く、終わりにゆっくり。t = Infinity なら最後の値)。count="false" で数えずに出す
|
|
7
|
+
// 札の幅は cols(既定は札の数、4 まで)で決める。数字と単位の幅は字数から見積もって中央にそろえる(字の読み込みを待たない)
|
|
8
|
+
// 見せ方(docs/conventions.md §1):count(数え上げ、既定)・rise(最後の値のまま少し小さい大きさから戻る)・flip(右の桁から 1 桁ずつ
|
|
9
|
+
// めくれて止まる)・underline(出たあと数字の下に線を引く)。段階の数・長さ・合図・最後の中身はどれも同じ
|
|
10
|
+
// 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・mtext・prog・lerp・clamp・variant・previewOpacity を使い、プレイヤーのグローバルは使わない
|
|
11
|
+
egatariParts.define({name: "kpi", version: "2.0.4", requires: {base: "1.2.0"}, element: "m-kpi"}, function(deps){
|
|
12
|
+
"use strict";
|
|
13
|
+
var base = deps.base;
|
|
14
|
+
return class extends base.MotionElement {
|
|
15
|
+
static partName = "kpi"; // the registry name (define meta name), for report prefixes
|
|
16
|
+
static variants = ["count", "rise", "flip", "underline"];
|
|
17
|
+
// データの形(kit/shape.js)
|
|
18
|
+
static shape = {
|
|
19
|
+
schema: {type: "object", additionalProperties: false, required: ["cards"], properties: {
|
|
20
|
+
cards: {type: "array", minItems: 1, items: {type: "object", required: ["value"], properties: {
|
|
21
|
+
label: {type: "string"}, value: {type: "number"}, digits: {type: "integer"}, unit: {type: "string"}, prefix: {type: "string"}, from: {type: "number"}, tone: {type: "string"},
|
|
22
|
+
delta: {type: "object", properties: {dir: {enum: ["up", "down"]}, text: {type: "string"}, good: {type: "boolean"}}}, note: {type: "string"}, step: {type: "integer"}, at: {type: "number"}}}}}},
|
|
23
|
+
example: {cards: [{label: "作成時間", value: 62, unit: "%", prefix: "−", delta: {dir: "down", text: "前の版から 8 pt", good: true}}]},
|
|
24
|
+
};
|
|
25
|
+
static props = {
|
|
26
|
+
cols: {type: "number", default: 0, doc: "1 行の札の数(0 = 札の数、4 まで)"},
|
|
27
|
+
digits: {type: "number", default: 0, doc: "数字の小数桁(札の digits が優先)"},
|
|
28
|
+
"per-step": {type: "number", default: 1, doc: "1 ステップに出す札の数(0 = 全部をステップ 1 で)"},
|
|
29
|
+
dur: {type: "number", default: 1.2, doc: "数え上げの秒数"},
|
|
30
|
+
stagger: {type: "number", default: 0.3, doc: "同じステップの札の出だしのずれ(秒)"},
|
|
31
|
+
count: {type: "bool", default: true, doc: "数字を数え上げる"},
|
|
32
|
+
size: {type: "number", default: 0, doc: "数字の字の大きさ(px。0 = 札の高さから)"},
|
|
33
|
+
};
|
|
34
|
+
get steps(){
|
|
35
|
+
if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
|
|
36
|
+
var m = 0;
|
|
37
|
+
this.plan().forEach(function(o){ m = Math.max(m, o.step); });
|
|
38
|
+
return m;
|
|
39
|
+
}
|
|
40
|
+
plan(){
|
|
41
|
+
if (this._plan) return this._plan;
|
|
42
|
+
var P = this.props, per = P["per-step"], seen = {};
|
|
43
|
+
return (this._plan = ((this.data || {}).cards || []).map(function(c, i){
|
|
44
|
+
var step = c.step !== undefined ? c.step : per > 0 ? Math.floor(i / per) + 1 : 1;
|
|
45
|
+
var j = seen[step] = (seen[step] || 0) + 1;
|
|
46
|
+
return {c: c, step: step, at: c.at !== undefined ? c.at : +((j - 1) * P.stagger).toFixed(3)};
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
mount(ctx){
|
|
50
|
+
var P = this.props, D = base, self = this, pl = this.plan();
|
|
51
|
+
var vr = this.variant = base.variant(this);
|
|
52
|
+
// count="false"(数えない)が見せ方より強い:数える見せ方なら rise にする
|
|
53
|
+
if (!P.count && (vr === "count" || vr === "flip")){
|
|
54
|
+
console.info('[kpi] count="false", so the variant "' + vr + '" is shown as "rise"');
|
|
55
|
+
vr = this.variant = "rise";
|
|
56
|
+
}
|
|
57
|
+
this.style.display = "block"; this.style.position = "relative";
|
|
58
|
+
var W = this.clientWidth, H = this.clientHeight;
|
|
59
|
+
var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
|
|
60
|
+
// 読み上げ:最後の形(札ごとの名前・最後の値・増減・一言)を 1 文で。作者の aria-label があればそれを使う(上書きしない)
|
|
61
|
+
if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
|
|
62
|
+
this.setAttribute("role", "img");
|
|
63
|
+
if (!this._aria){
|
|
64
|
+
var ja = /^ja\b/i.test(ctx.lang || "ja");
|
|
65
|
+
this.setAttribute("aria-label", pl.map(function(o){
|
|
66
|
+
var c = o.c, dg = c.digits !== undefined ? c.digits : P.digits;
|
|
67
|
+
var more = [c.delta ? (c.delta.dir === "down" ? "↓ " : "↑ ") + (c.delta.text || "") : "", c.note || ""].filter(function(x){ return x.trim(); });
|
|
68
|
+
return (c.label ? c.label + " " : "") + (c.prefix || "") + self.fmt(c.value, dg) + (c.unit || "") + (more.length ? (ja ? "(" + more.join("、") + ")" : " (" + more.join(", ") + ")") : "");
|
|
69
|
+
}).join(ja ? "、" : "; "));
|
|
70
|
+
}
|
|
71
|
+
var n = pl.length || 1, cols = P.cols || Math.min(4, n), rows = Math.ceil(n / cols), gap = 28;
|
|
72
|
+
var cw = Math.max(0, (W - gap * (cols - 1)) / cols), ch = Math.max(0, (H - gap * (rows - 1)) / rows);
|
|
73
|
+
var size = P.size || Math.max(48, Math.min(84, ch * 0.3, cw * 0.24));
|
|
74
|
+
// 字の幅(base の textWidth:テーマの字で測った幅。mk:mtext で書く字で、*_^ は数えない)
|
|
75
|
+
var est = function(s, sz, mk){ return D.textWidth(s, sz, {font: self, mark: !!mk}); };
|
|
76
|
+
this.cards = pl.map(function(o, i){
|
|
77
|
+
var c = o.c, x = (i % cols) * (cw + gap), y = Math.floor(i / cols) * (ch + gap), cx = x + cw / 2;
|
|
78
|
+
var col = "var(--" + (/^(term|emph|accent2|series-[1-4])$/.test(c.tone || "") ? c.tone : "term") + ")";
|
|
79
|
+
var g = D.el("g", {opacity: 0}, svg);
|
|
80
|
+
D.el("rect", {x: x, y: y, width: cw, height: ch, rx: 12, fill: "var(--term-tint)"}, g);
|
|
81
|
+
D.el("rect", {x: x, y: y, width: cw, height: 7, rx: 3, fill: col}, g);
|
|
82
|
+
// 行の位置:名前・数字・増減・一言を札の高さに配る
|
|
83
|
+
var hasD = !!c.delta, hasN = !!c.note;
|
|
84
|
+
var yl = y + 26 + 26, yn = y + ch * (hasD || hasN ? 0.5 : 0.6) + size * 0.36;
|
|
85
|
+
D.mtext(g, cx, yl, c.label || "", {"text-anchor": "middle", "font-size": 26, "font-weight": 700});
|
|
86
|
+
var dg = c.digits !== undefined ? c.digits : P.digits, usz = Math.round(size * 0.46);
|
|
87
|
+
var finalS = (c.prefix || "") + self.fmt(c.value, dg);
|
|
88
|
+
var nw = est(finalS, size), uw = c.unit ? est(c.unit, usz) + 6 : 0, xr = cx - (nw + uw) / 2 + nw;
|
|
89
|
+
var gn = D.el("g", {}, g); // 数字と単位(rise はこれを拡大する)
|
|
90
|
+
var num = D.el("text", {x: xr.toFixed(1), y: yn.toFixed(1), "text-anchor": "end", "font-size": size, "font-weight": 700, fill: col, style: "font-variant-numeric:tabular-nums"}, gn);
|
|
91
|
+
if (c.unit){ var u = D.el("text", {x: (xr + 6).toFixed(1), y: yn.toFixed(1), "font-size": usz, "font-weight": 700, fill: col}, gn); u.textContent = c.unit; }
|
|
92
|
+
// flip:字ごとの tspan(桁だけがめくれる。y でなく dy で前の字との差を書く:y を書くと字の塊が分かれて右寄せが崩れる)
|
|
93
|
+
var digits = null;
|
|
94
|
+
if (vr === "flip"){
|
|
95
|
+
digits = [...finalS].map(function(ch){
|
|
96
|
+
var ts = D.el("tspan", {}, num); ts.textContent = ch;
|
|
97
|
+
return {ts: ts, d: /[0-9]/.test(ch) ? +ch : null};
|
|
98
|
+
});
|
|
99
|
+
var nd = digits.filter(function(o){ return o.d !== null; }).length, j = 0;
|
|
100
|
+
for (var q = digits.length - 1; q >= 0; q--) if (digits[q].d !== null) digits[q].j = j++, digits[q].n = nd;
|
|
101
|
+
}
|
|
102
|
+
var line = vr === "underline" ? D.el("line", {x1: (xr - nw).toFixed(1), x2: (xr - nw).toFixed(1), y1: (yn + size * 0.14).toFixed(1), y2: (yn + size * 0.14).toFixed(1), stroke: "var(--term)", "stroke-width": 5, "stroke-linecap": "round"}, g) : null;
|
|
103
|
+
var gd = null;
|
|
104
|
+
if (hasD){
|
|
105
|
+
// 増減:▲ / ▼ と一言。良い向き(good、既定は up)なら --term、悪い向きなら --emph
|
|
106
|
+
var up = c.delta.dir !== "down", good = c.delta.good !== undefined ? !!c.delta.good : up;
|
|
107
|
+
var dc = good ? "var(--term)" : "var(--emph)", yd = yn + Math.max(44, size * 0.62), tw = est(c.delta.text || "", 24, true) + 30;
|
|
108
|
+
gd = D.el("g", {opacity: 0}, g);
|
|
109
|
+
var tx = cx - tw / 2;
|
|
110
|
+
D.el("path", {d: up ? "M0,-9L9,7L-9,7Z" : "M0,9L9,-7L-9,-7Z", fill: dc, transform: "translate(" + (tx + 9).toFixed(1) + " " + (yd - 8).toFixed(1) + ")"}, gd);
|
|
111
|
+
D.mtext(gd, tx + 30, yd, c.delta.text || "", {"font-size": 24, fill: dc, "font-weight": 700});
|
|
112
|
+
}
|
|
113
|
+
var note = hasN ? D.mtext(g, cx, y + ch - 22, c.note, {"text-anchor": "middle", "font-size": 24, fill: "var(--muted)"}) : null;
|
|
114
|
+
return {o: o, g: g, gn: gn, num: num, gd: gd, dg: dg, from: c.from || 0, cx: cx, cy: y + ch / 2, xn: xr - nw / 2 + uw / 2, yn: yn, size: size, digits: digits, line: line, lx: xr - nw, lw: nw + uw};
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
fmt(v, dg){
|
|
118
|
+
var s = Math.abs(v).toFixed(dg).split("."), i = s[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
119
|
+
return (v < 0 ? "−" : "") + i + (s[1] ? "." + s[1] : "");
|
|
120
|
+
}
|
|
121
|
+
duration(k){
|
|
122
|
+
var P = this.props, d = 0;
|
|
123
|
+
this.plan().forEach(function(o){ if (o.step === k) d = Math.max(d, o.at + (P.count ? P.dur : 0.45) + (o.c.delta ? 0.4 : 0)); });
|
|
124
|
+
return d;
|
|
125
|
+
}
|
|
126
|
+
cues(k){
|
|
127
|
+
var c = [];
|
|
128
|
+
this.plan().forEach(function(o){ if (o.step === k && o.at > 0) c.push(o.at); });
|
|
129
|
+
return c.length ? c.sort(function(a, b){ return a - b; }) : null;
|
|
130
|
+
}
|
|
131
|
+
render(k, t, ctx){
|
|
132
|
+
var P = this.props, D = base, self = this;
|
|
133
|
+
// 先の段階を薄く見せる表示(授業の表示):後の段階の札を最後の値で、テーマの --preview-opacity の濃さに(動かさない)
|
|
134
|
+
var preview = !!ctx.preview, PV = preview ? base.previewOpacity(this) : 1;
|
|
135
|
+
this.cards.forEach(function(o){
|
|
136
|
+
var s = o.o.step, at = o.o.at, ahead = preview && s > k;
|
|
137
|
+
var tt = s < k || ahead ? Infinity : s > k ? -1 : t; // この札の段階の中の時刻(-1 = まだ)
|
|
138
|
+
var e = tt < 0 ? 0 : D.prog(tt, at, 0.45);
|
|
139
|
+
o.g.setAttribute("opacity", ahead ? PV.toFixed(3) : e.toFixed(3));
|
|
140
|
+
o.g.setAttribute("transform", "translate(0 " + ((1 - e) * 14).toFixed(2) + ")");
|
|
141
|
+
var vr = self.variant, span = P.count ? P.dur : 0.45;
|
|
142
|
+
if (vr === "count"){
|
|
143
|
+
// 数え上げ:ease-out(初めに速く)。t = Infinity なら最後の値
|
|
144
|
+
var c = tt < 0 ? 0 : tt === Infinity || !P.count ? 1 : D.clamp((tt - at) / P.dur);
|
|
145
|
+
var q = 1 - Math.pow(1 - c, 3), v = D.lerp(o.from, o.o.c.value, q);
|
|
146
|
+
o.num.textContent = (o.o.c.prefix || "") + self.fmt(c >= 1 ? o.o.c.value : v, o.dg);
|
|
147
|
+
} else if (vr === "rise"){
|
|
148
|
+
// 最後の値のまま、0.85 倍から元の大きさへ(札が現れるのと同じ 0.45 秒)
|
|
149
|
+
var s = 0.85 + 0.15 * (tt < 0 ? 0 : D.prog(tt, at, 0.45)), cx = o.xn, cy = o.yn - o.size * 0.35;
|
|
150
|
+
o.num.textContent = (o.o.c.prefix || "") + self.fmt(o.o.c.value, o.dg);
|
|
151
|
+
o.gn.setAttribute("transform", s >= 1 ? "" : "translate(" + cx.toFixed(1) + " " + cy.toFixed(1) + ") scale(" + s.toFixed(4) + ") translate(" + (-cx).toFixed(1) + " " + (-cy).toFixed(1) + ")");
|
|
152
|
+
} else if (vr === "flip"){
|
|
153
|
+
// 札が出たあと(0.45 秒)、右の桁から 1 桁ずつ 0 → 最後の数字へめくれて、上から定位置に止まる(段階の長さの中で終わる)
|
|
154
|
+
var t0 = at + 0.45, len = Math.max(0.1, span - 0.45), prev = 0;
|
|
155
|
+
o.digits.forEach(function(d){
|
|
156
|
+
var off = 0;
|
|
157
|
+
if (d.d !== null){
|
|
158
|
+
var w = len / (d.n + 1), st = t0 + d.j * w, e = tt < 0 ? 0 : tt === Infinity ? 1 : D.clamp((tt - st) / (2 * w));
|
|
159
|
+
var shown = e >= 1 ? d.d : Math.min(d.d, Math.floor(e * (d.d + 1))), frac = (e * (d.d + 1)) % 1;
|
|
160
|
+
d.ts.textContent = String(shown);
|
|
161
|
+
// めくれる桁は上から少し(字の 0.12)下りて止まる
|
|
162
|
+
off = e > 0 && e < 1 ? -(1 - D.prog(frac, 0, 1)) * o.size * 0.12 : 0;
|
|
163
|
+
}
|
|
164
|
+
d.ts.setAttribute("dy", (off - prev).toFixed(1));
|
|
165
|
+
prev = off;
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
// underline:最後の値で出て、数字の下に左から右へ線を引く
|
|
169
|
+
o.num.textContent = (o.o.c.prefix || "") + self.fmt(o.o.c.value, o.dg);
|
|
170
|
+
// 線は段階の長さの中で引き終える(count="false" なら段階は 0.45 秒なので、後半の半分で引く)
|
|
171
|
+
var u0 = Math.min(0.45, span * 0.5), u = tt < 0 ? 0 : D.prog(tt, at + u0, span - u0);
|
|
172
|
+
o.line.setAttribute("x2", (o.lx + o.lw * u).toFixed(1));
|
|
173
|
+
o.line.setAttribute("opacity", u > 0 ? 1 : 0);
|
|
174
|
+
}
|
|
175
|
+
if (o.gd) o.gd.setAttribute("opacity", (tt < 0 ? 0 : D.prog(tt, at + (P.count ? P.dur : 0.45) * 0.85, 0.4)).toFixed(3));
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Screen steps: numbered circles on a screenshot, joined by leader lines to labels beside it, one per step
|
|
3
|
+
steps: max callout step (default 1 callout = 1 step)
|
|
4
|
+
props:
|
|
5
|
+
side: labels on right, left or both
|
|
6
|
+
label-width: label column (share of width)
|
|
7
|
+
per-step: callouts per step (0 = all)
|
|
8
|
+
dur: seconds per callout
|
|
9
|
+
size: label px (≥ 24)
|
|
10
|
+
example: {"callouts": [{"x": 0.12, "y": 0.08, "text": "Open the menu"}, {"x": 0.7, "y": 0.62, "text": "Press Send"}]}
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
For training and how-to guides: where to click, in order.
|
|
14
|
+
|
|
15
|
+
The screenshot is a child `<img src alt width height>` (the build inlines it).
|
|
16
|
+
|
|
17
|
+
- **Never show real personal data on a screenshot** (names, ID numbers, resident or patient records). Use made-up data, or blur it.
|
|
18
|
+
- `alt`, `width` and `height` (px) are required (else data); an image over 1 MiB is size.
|
|
19
|
+
|
|
20
|
+
Child JSON: `{"callouts": [...]}`; callout: `x`, `y` (0–1 of the image), `text`, `box` (`[x, y, w, h]`, highlighted during its step), `step`, `at`.
|
|
21
|
+
<!-- llm: omit -->
|
|
22
|
+
- Labels follow the circles' vertical order, so leader lines never cross.
|
|
23
|
+
<!-- llm: end -->
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// m-callout:画面の手順。画面の画像の上に番号の丸を置き、引き出し線で横の説明につなぐ。ステップごとに 1 つずつ
|
|
2
|
+
// <m-callout style="height:460px">
|
|
3
|
+
// <img src="screens/apply.png" alt="申請の画面" width="1280" height="800">
|
|
4
|
+
// <script type="application/json">{"callouts": [{"x": 0.12, "y": 0.08, "text": "メニューを開く"},
|
|
5
|
+
// {"x": 0.70, "y": 0.62, "text": "「送る」を押す", "box": [0.62, 0.57, 0.16, 0.1]}]}</script>
|
|
6
|
+
// (JSON の終わり)</m-callout>
|
|
7
|
+
// 画像は子の <img>(src・alt・width・height)。組み立てが作業フォルダの画像を教材に埋め込む。alt がなければ data で知らせる。
|
|
8
|
+
// width と height は画像の縦横比(px の数。なければ data で知らせて 16:10 で描く)。x・y・box は画像の幅と高さに対する割合(0〜1)
|
|
9
|
+
// 説明は画像の横(side:right(既定)・left・both)に、丸と同じ上下の順に並べ、重ならないようにずらす。
|
|
10
|
+
// 引き出し線は丸から画像の端まで水平に、そこから説明まで斜めにつなぐ。説明の順が丸の上下の順と同じなので、線どうしは交わらない
|
|
11
|
+
// ステップ k で k 番目の丸・線・説明が出る(今の丸は --emph、前の丸は --term)
|
|
12
|
+
egatariParts.define({name: "callout", version: "2.0.0", requires: {base: "1.2.0"}, element: "m-callout"}, function(deps){
|
|
13
|
+
"use strict";
|
|
14
|
+
var base = deps.base;
|
|
15
|
+
var BIG = 1048576; // 埋め込んだ画像がこれ(1 MiB)より大きければ size で知らせる
|
|
16
|
+
function imgOf(el){ return [].filter.call(el.children, function(x){ return x.localName === "img"; })[0] || null; }
|
|
17
|
+
return class extends base.MotionElement {
|
|
18
|
+
static partName = "callout";
|
|
19
|
+
static shape = {
|
|
20
|
+
schema: {type: "object", additionalProperties: false, required: ["callouts"], properties: {
|
|
21
|
+
callouts: {type: "array", minItems: 1, items: {type: "object", required: ["x", "y", "text"], properties: {
|
|
22
|
+
x: {type: "number"}, y: {type: "number"}, text: {type: "string"}, box: {type: "array", items: {type: "number"}, minItems: 4, maxItems: 4}, step: {type: "integer"}, at: {type: "number"}}}}}},
|
|
23
|
+
example: {callouts: [{x: 0.12, y: 0.08, text: "メニューを開く"}, {x: 0.7, y: 0.62, text: "「送る」を押す"}]},
|
|
24
|
+
};
|
|
25
|
+
static props = {
|
|
26
|
+
side: {type: "string", default: "right", doc: "説明を置く側:right・left・both(both は画像の左半分の丸を左に、右半分の丸を右に)"},
|
|
27
|
+
"label-width": {type: "number", default: 0.32, doc: "説明の列の幅(要素の幅に対する割合。both なら片側の幅)"},
|
|
28
|
+
"per-step": {type: "number", default: 1, doc: "1 ステップに出す説明の数(0 = 全部をステップ 1 で)"},
|
|
29
|
+
dur: {type: "number", default: 0.7, doc: "1 つの説明が出る秒数(丸、線、説明の順)"},
|
|
30
|
+
size: {type: "number", default: 28, doc: "説明の字の大きさ(px、24 以上)"},
|
|
31
|
+
};
|
|
32
|
+
get steps(){
|
|
33
|
+
if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
|
|
34
|
+
var m = 0;
|
|
35
|
+
this.plan().forEach(function(p){ m = Math.max(m, p.step); });
|
|
36
|
+
return m;
|
|
37
|
+
}
|
|
38
|
+
plan(){
|
|
39
|
+
if (this._plan) return this._plan;
|
|
40
|
+
var d = this.data || {}, per = this.props["per-step"], seen = {};
|
|
41
|
+
return (this._plan = (d.callouts || []).map(function(c, i){
|
|
42
|
+
var step = c.step !== undefined ? c.step : per > 0 ? Math.floor(i / per) + 1 : 1;
|
|
43
|
+
var j = seen[step] = (seen[step] || 0) + 1;
|
|
44
|
+
return {c: c, n: i + 1, step: step, at: c.at !== undefined ? c.at : +((j - 1) * 0.2).toFixed(3)};
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
mount(ctx){
|
|
48
|
+
var P = this.props, D = base, self = this, pl = this.plan();
|
|
49
|
+
this.style.display = "block"; this.style.position = "relative";
|
|
50
|
+
var W = this.clientWidth, H = this.clientHeight, img = imgOf(this);
|
|
51
|
+
var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true", style: "display:block;overflow:visible"}, this);
|
|
52
|
+
if (!img){ ctx.report("data", "[callout] put the screenshot in as a child <img src alt width height>"); return; }
|
|
53
|
+
img.style.display = "none";
|
|
54
|
+
var src = img.getAttribute("src") || "", alt = (img.getAttribute("alt") || "").trim();
|
|
55
|
+
if (!alt) ctx.report("data", "[callout] the <img> needs alt: say what the screen is (it is read aloud and shown when the image cannot be)");
|
|
56
|
+
// 埋め込んだ画像(data:)の大きさ。base64 なら 4 字で 3 バイト。知らせの終わりの [image bytes=N] は、Studio の教材全体の画像の
|
|
57
|
+
// 確かめ(backlog #207)が同じ画像を 2 度知らせないための目印(ctx.report には文しか渡せない)
|
|
58
|
+
var m = /^data:[^,]*?(;base64)?,/i.exec(src);
|
|
59
|
+
if (m){
|
|
60
|
+
var bytes = m[1] ? Math.floor((src.length - m[0].length) * 3 / 4) : src.length - m[0].length;
|
|
61
|
+
if (bytes > BIG) ctx.report("size", "[callout] the screenshot is " + (bytes / BIG).toFixed(1) + " MiB inside the lesson file; crop it to the part that matters, or save it smaller (JPEG or WebP, about 1600 px wide) [image bytes=" + bytes + "]");
|
|
62
|
+
}
|
|
63
|
+
var iw = +img.getAttribute("width"), ih = +img.getAttribute("height");
|
|
64
|
+
if (!(iw > 0 && ih > 0)){ ctx.report("data", "[callout] the <img> needs width and height (the screenshot's pixel size), so the callouts land in the right place"); iw = 16; ih = 10; }
|
|
65
|
+
var fs = Math.max(24, P.size), lh = fs * 1.3;
|
|
66
|
+
var est = function(s){ return D.textWidth(s, fs, {font: self, mark: true}); };
|
|
67
|
+
var both = P.side === "both", left = P.side === "left";
|
|
68
|
+
var lw = Math.max(200, W * Math.min(0.45, Math.max(0.15, P["label-width"]))), gut = 48;
|
|
69
|
+
// 画像の場所:説明の列とすきま(gut)を除いた範囲に、縦横比を保って入れる
|
|
70
|
+
var ax0 = both ? lw + gut : left ? lw + gut : 0, ax1 = both ? W - lw - gut : left ? W : W - lw - gut;
|
|
71
|
+
var aw = Math.max(0, ax1 - ax0), sc = Math.min(aw / iw, H / ih), dw = iw * sc, dh = ih * sc;
|
|
72
|
+
var ix = both ? (W - dw) / 2 : left ? W - dw : 0, iy = (H - dh) / 2;
|
|
73
|
+
var gI = D.el("g", {}, svg);
|
|
74
|
+
D.el("image", {href: src, x: ix.toFixed(1), y: iy.toFixed(1), width: dw.toFixed(1), height: dh.toFixed(1), preserveAspectRatio: "none"}, gI);
|
|
75
|
+
D.el("rect", {x: ix.toFixed(1), y: iy.toFixed(1), width: dw.toFixed(1), height: dh.toFixed(1), fill: "none", stroke: "var(--line)", "stroke-width": 2}, gI);
|
|
76
|
+
var gB = D.el("g", {}, svg), gK = D.el("g", {}, svg), gN = D.el("g", {}, svg), gL = D.el("g", {}, svg);
|
|
77
|
+
// 説明の位置:側ごとに丸の上下の順に並べ、丸の高さを目安に置いて、重なれば下へ、はみ出せば上へずらす
|
|
78
|
+
var items = pl.map(function(p){
|
|
79
|
+
var c = p.c, tx = ix + Math.max(0, Math.min(1, c.x)) * dw, ty = iy + Math.max(0, Math.min(1, c.y)) * dh;
|
|
80
|
+
var lines = String(c.text).split("\n"), h = lines.length * lh + 12;
|
|
81
|
+
var onLeft = both ? c.x < 0.5 : left;
|
|
82
|
+
lines.forEach(function(s){ if (est(s) > lw - 16) ctx.report("size", "[callout] \"" + s + "\" is wider than the label column; break it with \\n or widen label-width"); });
|
|
83
|
+
return {p: p, tx: tx, ty: ty, lines: lines, h: h, left: onLeft};
|
|
84
|
+
});
|
|
85
|
+
[true, false].forEach(function(sideLeft){
|
|
86
|
+
var col = items.filter(function(o){ return o.left === sideLeft; }).sort(function(a, b){ return a.ty - b.ty || a.tx - b.tx; });
|
|
87
|
+
var y = 0;
|
|
88
|
+
col.forEach(function(o){ o.ly = Math.max(y, o.ty - o.h / 2); y = o.ly + o.h + 12; });
|
|
89
|
+
var over = y - 12 - H;
|
|
90
|
+
for (var i = col.length - 1; i >= 0 && over > 0; i--){
|
|
91
|
+
var lim = i === 0 ? 0 : col[i - 1].ly + col[i - 1].h + 12, room = col[i].ly - lim;
|
|
92
|
+
var mv = Math.min(over, room);
|
|
93
|
+
for (var j = i; j < col.length; j++) col[j].ly -= mv;
|
|
94
|
+
over -= mv;
|
|
95
|
+
}
|
|
96
|
+
if (over > 0) ctx.report("size", "[callout] the labels on the " + (sideLeft ? "left" : "right") + " need " + Math.round(y - 12) + " px of height; the element is " + H + " px");
|
|
97
|
+
// 線の折れ目:画像の端の外。丸の上下の順と説明の順が同じなので、折れ目から説明までの線は交わらない
|
|
98
|
+
col.forEach(function(o){ o.gx = sideLeft ? ix - 14 : ix + dw + 14; o.lx = sideLeft ? lw : W - lw; });
|
|
99
|
+
});
|
|
100
|
+
this.items = items.map(function(o){
|
|
101
|
+
var c = o.p.c, r = 20;
|
|
102
|
+
if (Array.isArray(c.box) && c.box.length === 4)
|
|
103
|
+
o.box = D.el("rect", {x: (ix + c.box[0] * dw).toFixed(1), y: (iy + c.box[1] * dh).toFixed(1), width: (c.box[2] * dw).toFixed(1), height: (c.box[3] * dh).toFixed(1), rx: 6, fill: "none", stroke: "var(--emph)", "stroke-width": 4}, gB);
|
|
104
|
+
o.line = D.el("path", {d: "M" + o.tx.toFixed(1) + "," + o.ty.toFixed(1) + "H" + o.gx.toFixed(1) + "L" + o.lx.toFixed(1) + "," + (o.ly + o.h / 2).toFixed(1),
|
|
105
|
+
fill: "none", stroke: "var(--fg)", "stroke-width": 2.5, "stroke-linejoin": "round"}, gK);
|
|
106
|
+
o.len = Math.abs(o.gx - o.tx) + Math.hypot(o.lx - o.gx, o.ly + o.h / 2 - o.ty);
|
|
107
|
+
o.line.setAttribute("stroke-dasharray", o.len.toFixed(1) + " " + o.len.toFixed(1));
|
|
108
|
+
o.dot = D.el("circle", {cx: o.tx.toFixed(1), cy: o.ty.toFixed(1), r: r, stroke: "var(--bg)", "stroke-width": 3}, gN);
|
|
109
|
+
o.num = D.el("text", {x: o.tx.toFixed(1), y: (o.ty + 8.5).toFixed(1), "font-size": 24, "font-weight": 700, "text-anchor": "middle", fill: "var(--bg)"}, gN);
|
|
110
|
+
o.num.textContent = String(o.p.n);
|
|
111
|
+
// 説明:番号と文。左の列は右寄せ(線の側)
|
|
112
|
+
var g = D.el("g", {}, gL), ax = o.left ? lw - 8 : W - lw + 8;
|
|
113
|
+
o.lines.forEach(function(s, j){ D.mtext(g, ax, (o.ly + 6 + fs * 0.95 + j * lh).toFixed(1), (j === 0 ? o.p.n + ". " : "") + s, {"font-size": fs, "text-anchor": o.left ? "end" : "start"}); });
|
|
114
|
+
o.label = g;
|
|
115
|
+
return o;
|
|
116
|
+
});
|
|
117
|
+
if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
|
|
118
|
+
this.setAttribute("role", "img");
|
|
119
|
+
if (!this._aria){
|
|
120
|
+
var ja = /^ja\b/i.test(ctx.lang || "ja");
|
|
121
|
+
this.setAttribute("aria-label", (alt || (ja ? "画面" : "Screen")) + (ja ? ":" : ": ") + pl.map(function(p){ return p.n + ". " + String(p.c.text).replace(/\s*\n\s*/g, " "); }).join(ja ? "、" : "; "));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
duration(k){
|
|
125
|
+
var P = this.props, d = 0;
|
|
126
|
+
this.plan().forEach(function(p){ if (p.step === k) d = Math.max(d, p.at + P.dur); });
|
|
127
|
+
return d;
|
|
128
|
+
}
|
|
129
|
+
render(k, t, ctx){
|
|
130
|
+
if (!this.items) return;
|
|
131
|
+
var P = this.props, D = base, preview = !!ctx.preview, PV = preview ? base.previewOpacity(this) : 1;
|
|
132
|
+
this.items.forEach(function(o){
|
|
133
|
+
var p = o.p, ahead = preview && p.step > k, now = p.step === k;
|
|
134
|
+
var e = ahead || p.step < k ? 1 : p.step > k ? 0 : D.prog(t, p.at, P.dur);
|
|
135
|
+
// 丸(最初の 3 割)→ 線(次の 4 割)→ 説明(残り)
|
|
136
|
+
var a = Math.min(1, e / 0.3), b = Math.max(0, Math.min(1, (e - 0.3) / 0.4)), c = Math.max(0, Math.min(1, (e - 0.7) / 0.3));
|
|
137
|
+
var op = function(x){ return ahead ? PV : x > 0 ? x : 0; };
|
|
138
|
+
o.dot.setAttribute("fill", now ? "var(--emph)" : "var(--term)");
|
|
139
|
+
o.dot.setAttribute("opacity", op(a).toFixed(3)); o.num.setAttribute("opacity", op(a).toFixed(3));
|
|
140
|
+
if (o.box){ o.box.setAttribute("opacity", (ahead ? PV : now ? a : 0).toFixed(3)); }
|
|
141
|
+
o.line.setAttribute("stroke-dashoffset", (o.len * (1 - (ahead ? 1 : b))).toFixed(1));
|
|
142
|
+
o.line.setAttribute("opacity", (ahead ? PV : b > 0 ? 1 : 0).toFixed(3));
|
|
143
|
+
o.label.setAttribute("opacity", op(c).toFixed(3));
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Timeline; events one by one; periods as bands, overlaps stacked; end exclusive ("1912" = start of 1912)
|
|
3
|
+
steps: event count (default 1 per step in time order; per-step n each; node step wins)
|
|
4
|
+
props:
|
|
5
|
+
orient: h or v
|
|
6
|
+
scale: time or even
|
|
7
|
+
per-step: events per step (0 = all)
|
|
8
|
+
size: label px (shrinks to 24)
|
|
9
|
+
dur: event appear (s)
|
|
10
|
+
stagger: event offset (s)
|
|
11
|
+
unit: ticks: day, week, month
|
|
12
|
+
today: today line (YYYY-MM-DD)
|
|
13
|
+
example: {"nodes": [{"id": "a", "label": "Meiji Restoration", "when": "1868", "whenLabel": "Meiji 1"}, {"id": "b", "label": "Constitution", "when": "1889", "note": "Feb 11"}, {"id": "c", "label": "Sino-Japanese War", "when": "1894", "end": "1895", "tone": "emph"}]}
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
History, lives, schedules. No coordinates; content and times only.
|
|
17
|
+
|
|
18
|
+
Child JSON: `{"nodes": [...], "edges": [...]}` (`edges` optional).
|
|
19
|
+
|
|
20
|
+
- `when`: number (`1868`, `-500`, `0.5`) or `"YYYY"` `"YYYY-MM"` `"YYYY-MM-DD"`; shown as the date line
|
|
21
|
+
- `whenLabel`: text replacing the date ("Meiji 1"); `when` still sets position
|
|
22
|
+
- `label` (`\n`) or `tex` (KaTeX)
|
|
23
|
+
- `note`: small last line in the box (`--muted`); after the name for periods/milestones
|
|
24
|
+
- `tone`: `term` (default), `emph`, `muted`, `accent2`, `series-1..4`
|
|
25
|
+
- `end`: period, a band below the axis; name inside (or beside); `\n` names thicken it
|
|
26
|
+
- `end` is exclusive: Meiji 1868–1912 and Taishō 1912–1926 share a row; through December = next month (`"2027-01"`)
|
|
27
|
+
- `lane`: named group of rows ("Eras", "Authors"); overlaps stack within; `lane` without `end` = milestone (◆)
|
|
28
|
+
- `step`, `at` (start s)
|
|
29
|
+
- `edges`: extra links (`from` `to` `label` `tone` `dash` `step`); dashed arrows (`dash: false` solid)
|
|
30
|
+
- Schedules: `after: ["id", …]` (arrow end→start), `progress` (0–100 %); `today` line; tick `unit`
|
|
31
|
+
- `after` only between periods and milestones; `today` needs a period
|
|
32
|
+
|
|
33
|
+
Layout:
|
|
34
|
+
|
|
35
|
+
- `orient`: `h` (default) or `v`; `scale`: `time` (default) or `even` (very uneven gaps)
|
|
36
|
+
- Events (no `end` or `lane`): axis dot plus date-and-name box, alternating sides (`v`: left/right); 2 rows when crowded
|
|
37
|
+
- With periods: round ticks; event boxes all above the axis
|
|
38
|
+
- Steps: time order, periods and events together; the axis comes with the first
|
|
39
|
+
- `variant`: `fade` (default), `draw` (lines first, bands drawn), `grow` (boxes grow, bands stretch); same steps and end
|
|
40
|
+
- Show later steps faintly (`ctx.preview`): later items faint
|
|
41
|
+
- `cues(k)`: start times of 2nd+ items in a step (for `{cue}`)
|
|
42
|
+
|
|
43
|
+
The demo is `demo.html`; the schedule is fictional, years are history.
|
|
44
|
+
|
|
45
|
+
<!-- llm: omit -->
|
|
46
|
+
Notes
|
|
47
|
+
|
|
48
|
+
- Box and tick widths estimated from characters (CJK 1, digits 0.6, Latin 0.62)
|
|
49
|
+
- No fit: names shrink from `size` by 2px to 24px, then `ctx.report("size", …)`
|
|
50
|
+
- No `Date` (leap years computed); months and days as positions in the year
|
|
51
|
+
- Band names sit in the band's `g`
|
|
52
|
+
- Axis `--muted` 5 px; lane dividers `--line`; links and `edges` `--muted` 3 px
|
|
53
|
+
- Motion: boxes and bands move ≤ 12 px from the axis side, within `fade` time (conventions §1.2)
|
|
54
|
+
<!-- llm: end -->
|
|
55
|
+
|
|
56
|
+
<!-- llm: omit -->
|
|
57
|
+
Schedules (`after`, `progress`, `today`, `unit`)
|
|
58
|
+
|
|
59
|
+
- Any `after`: one row per task in each lane (written order). Arrows only between periods and milestones (others reported)
|
|
60
|
+
- Arrows (`--muted` 3px, right-angled) from a task's end to the next one's start; drawn with the later task; avoid crossing bands where possible
|
|
61
|
+
- A last milestone gets room for its name; arrows to bands whose name is left of the start enter at the edge
|
|
62
|
+
- `progress`: band filled darker from the start; "70%" shown if room; outside 0–100 clamped and reported
|
|
63
|
+
- `today`: only with periods (else reported); small triangle and vertical line (`--accent2`, 3px), "Today" below; range widens to include it
|
|
64
|
+
- `unit`: default month (≤ 4 years with months/days) or round numbers. `day`: 1–2 days or 1–8 weeks (Mondays); `week`: 1–26 weeks; `month`: 1–120 months; finest step whose 24px labels don't overlap; minor ticks unlabeled. Day/week labels "11/2"; `day` shades weekends (`--line`)
|
|
65
|
+
- No plan-vs-actual bands yet
|
|
66
|
+
<!-- llm: end -->
|