egatari 0.6.8 → 0.6.9-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/components.lock.json +84 -3
- package/components2.lock.json +202 -1
- package/kit/check-messages.mjs +5 -0
- package/kit/check.mjs +9 -4
- package/kit/core/check-parity.mjs +62 -0
- package/kit/core/check-source.mjs +56 -0
- package/kit/core/colab-core.mjs +1 -1
- package/kit/core/color-vocab.mjs +8 -2
- package/kit/core/layout-scan.mjs +7 -4
- package/kit/core/llm-pack-assemble.mjs +1 -1
- package/kit/core/llm-pack-data.mjs +185 -9
- package/kit/core/llm-pack.mjs +1 -1
- package/kit/core/narration-lint.mjs +12 -0
- package/kit/core/new-deck.mjs +3 -0
- package/kit/core/part-labels.mjs +6 -0
- package/kit/core/template-text.mjs +5 -3
- package/kit/deck.js +88 -13
- package/kit/instruction-version.json +1 -1
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/presenter.js +33 -9
- package/kit/tools.js +4 -0
- package/package.json +1 -1
- package/themes/asagi/theme.json +1 -1
- package/themes/asagi/tokens.css +12 -0
- package/themes/business/theme.json +1 -1
- package/themes/business/tokens.css +12 -0
- package/themes/default/README.ja.md +24 -1
- package/themes/default/README.md +24 -1
- package/themes/default/theme.json +1 -1
- package/themes/default/tokens.css +12 -0
- package/themes/kogecha/theme.json +1 -1
- package/themes/kogecha/tokens.css +12 -0
- package/themes/kokugo/theme.json +1 -1
- package/themes/kokugo/tokens.css +12 -0
- package/themes/murasaki/theme.json +1 -1
- package/themes/murasaki/tokens.css +12 -0
- package/themes/sumi/theme.json +1 -1
- package/themes/sumi/tokens.css +12 -0
- package/themes/tokiwa/theme.json +1 -1
- package/themes/tokiwa/tokens.css +12 -0
- package/themes.lock.json +80 -24
- package/vendor/components/CATALOG.md +7 -1
- package/vendor/components/sha256/1298d779fe60ccfc09747fbdba47e2111175bd7fd2385a5b68c8f2644cd267be/README.en.md +23 -0
- package/vendor/components/sha256/1298d779fe60ccfc09747fbdba47e2111175bd7fd2385a5b68c8f2644cd267be/index.js +120 -0
- package/vendor/components/sha256/7aea8341beffcd4ad95c12b7e7e3be3f0f52eb7932d424be9e74e2fbd7339e45/README.en.md +23 -0
- package/vendor/components/sha256/7aea8341beffcd4ad95c12b7e7e3be3f0f52eb7932d424be9e74e2fbd7339e45/index.js +289 -0
- package/vendor/components/sha256/90ed438b40ed8d765348834b2bed2baad9b0053c2168c218335b6d95b9c80283/README.en.md +44 -0
- package/vendor/components/sha256/90ed438b40ed8d765348834b2bed2baad9b0053c2168c218335b6d95b9c80283/index.js +203 -0
- package/vendor/components/sha256/a69ab76ff7d0746d093b4e606d7b113be921cbb156edc16c2ad40aafab280d42/README.en.md +22 -0
- package/vendor/components/sha256/a69ab76ff7d0746d093b4e606d7b113be921cbb156edc16c2ad40aafab280d42/index.js +145 -0
- package/vendor/components/sha256/d75c461bb7b2b1c9a2b6d15bee1e11bcec88ef94931174d6b222cd309f6a0287/README.en.md +24 -0
- package/vendor/components/sha256/d75c461bb7b2b1c9a2b6d15bee1e11bcec88ef94931174d6b222cd309f6a0287/index.js +103 -0
- package/vendor/components/sha256/decb7c026527ea269a401efedcb5d4d56d186074b286d2f94772068bef56b256/README.en.md +31 -0
- package/vendor/components/sha256/decb7c026527ea269a401efedcb5d4d56d186074b286d2f94772068bef56b256/index.js +267 -0
- package/vendor/components/sha256/f13af97d7ebf9893d5783eff27e4e1ce092ccd01783b332ad01aa0d201356548/README.en.md +38 -0
- package/vendor/components/sha256/f13af97d7ebf9893d5783eff27e4e1ce092ccd01783b332ad01aa0d201356548/index.js +266 -0
- package/vendor/components-2/manifest-2.6.0.json +2104 -0
- package/vendor/egatari-spec/SOURCE.json +2 -2
- package/vendor/egatari-spec/schema/egatari-audio.schema.json +21 -0
- package/vendor/themes/asagi/1.1.0/theme.json +14 -0
- package/vendor/themes/asagi/1.1.0/tokens.css +18 -0
- package/vendor/themes/business/1.1.0/theme.json +5 -0
- package/vendor/themes/business/1.1.0/tokens.css +29 -0
- package/vendor/themes/default/1.3.0/theme.json +4 -0
- package/vendor/themes/default/1.3.0/tokens.css +74 -0
- package/vendor/themes/kogecha/1.1.0/theme.json +10 -0
- package/vendor/themes/kogecha/1.1.0/tokens.css +17 -0
- package/vendor/themes/kokugo/1.1.0/theme.json +5 -0
- package/vendor/themes/kokugo/1.1.0/tokens.css +13 -0
- package/vendor/themes/murasaki/1.1.0/theme.json +10 -0
- package/vendor/themes/murasaki/1.1.0/tokens.css +13 -0
- package/vendor/themes/sumi/1.1.0/theme.json +10 -0
- package/vendor/themes/sumi/1.1.0/tokens.css +37 -0
- package/vendor/themes/tokiwa/1.1.0/theme.json +10 -0
- package/vendor/themes/tokiwa/1.1.0/tokens.css +15 -0
|
@@ -8,6 +8,18 @@
|
|
|
8
8
|
--sec-bg: #3d3132;
|
|
9
9
|
--series-3: var(--accent2);
|
|
10
10
|
--lit: #EDB91A; /* 光と照らされる側。落ち着いた金茶寄りの黄(生成り地 1.7:1。1.1.0) */
|
|
11
|
+
/* 物の色(format spec §8.4):内容そのものである色。焦茶の落ち着いた配色に合わせて鮮やかさを少し抑えた(色の名前の範囲は同じ)。名前か頭文字を添え、白・黒には輪郭線。1.2.0 */
|
|
12
|
+
--obj-white: #FFFFFF;
|
|
13
|
+
--obj-black: #2A2523;
|
|
14
|
+
--obj-red: #C8323A;
|
|
15
|
+
--obj-green: #3C8A4E;
|
|
16
|
+
--obj-yellow: #E6C619;
|
|
17
|
+
--obj-blue: #2F66B8;
|
|
18
|
+
--obj-brown: #7A5230;
|
|
19
|
+
--obj-purple: #7E4A9E;
|
|
20
|
+
--obj-pink: #DC86AE;
|
|
21
|
+
--obj-orange: #D9822B;
|
|
22
|
+
--obj-gray: #8A8782;
|
|
11
23
|
}
|
|
12
24
|
/* look heading: double */
|
|
13
25
|
.slide:not(.cover):not(.sec):not(.layout-tate) > h2{border-bottom:6px double var(--base)}
|
package/themes/kokugo/theme.json
CHANGED
package/themes/kokugo/tokens.css
CHANGED
|
@@ -10,4 +10,16 @@
|
|
|
10
10
|
--font-sans: var(--font-mincho);
|
|
11
11
|
--font-cap: "BIZ UDPGothic", "Hiragino Sans", sans-serif;
|
|
12
12
|
--lit: #F8B500; /* 光と照らされる側。山吹色(生成り地 1.8:1。1.1.0) */
|
|
13
|
+
/* 物の色(format spec §8.4):内容そのものである色。default と同じ値(どのテーマでも赤い玉は同じ赤)。名前か頭文字を添え、白・黒と地に近い色には輪郭線。1.2.0 */
|
|
14
|
+
--obj-white: #FFFFFF;
|
|
15
|
+
--obj-black: #222222;
|
|
16
|
+
--obj-red: #E0242B;
|
|
17
|
+
--obj-green: #2E9E44;
|
|
18
|
+
--obj-yellow: #F5D90A;
|
|
19
|
+
--obj-blue: #1E6FD9;
|
|
20
|
+
--obj-brown: #8B5A2B;
|
|
21
|
+
--obj-purple: #8E44AD;
|
|
22
|
+
--obj-pink: #F27BB0;
|
|
23
|
+
--obj-orange: #F28C1A;
|
|
24
|
+
--obj-gray: #8C8C8C;
|
|
13
25
|
}
|
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
:root{
|
|
4
4
|
--base: #5a3d8f; /* 江戸紫 */
|
|
5
5
|
--lit: #F3BE00; /* 光と照らされる側。黄(紫の補色。白地 1.7:1。1.1.0) */
|
|
6
|
+
/* 物の色(format spec §8.4):内容そのものである色。default と同じ値(どのテーマでも赤い玉は同じ赤)。名前か頭文字を添え、白・黒と地に近い色には輪郭線。1.2.0 */
|
|
7
|
+
--obj-white: #FFFFFF;
|
|
8
|
+
--obj-black: #222222;
|
|
9
|
+
--obj-red: #E0242B;
|
|
10
|
+
--obj-green: #2E9E44;
|
|
11
|
+
--obj-yellow: #F5D90A;
|
|
12
|
+
--obj-blue: #1E6FD9;
|
|
13
|
+
--obj-brown: #8B5A2B;
|
|
14
|
+
--obj-purple: #8E44AD;
|
|
15
|
+
--obj-pink: #F27BB0;
|
|
16
|
+
--obj-orange: #F28C1A;
|
|
17
|
+
--obj-gray: #8C8C8C;
|
|
6
18
|
}
|
|
7
19
|
/* look heading: left-bar */
|
|
8
20
|
.slide:not(.cover):not(.sec):not(.layout-tate) > h2{border-bottom:0;border-left:10px solid var(--base);padding:4px 0 4px 18px}
|
package/themes/sumi/theme.json
CHANGED
package/themes/sumi/tokens.css
CHANGED
|
@@ -16,6 +16,18 @@
|
|
|
16
16
|
--series-3: var(--accent2);
|
|
17
17
|
--series-4: #8a8f94;
|
|
18
18
|
--lit: #F2C300; /* 光と照らされる側。黄(橙の --emph と分かれるよう赤みを抑えた。白地 1.7:1。1.1.0) */
|
|
19
|
+
/* 物の色(format spec §8.4):内容そのものである色。default と同じ値(どのテーマでも赤い玉は同じ赤)。名前か頭文字を添え、白・黒と地に近い色には輪郭線。1.2.0 */
|
|
20
|
+
--obj-white: #FFFFFF;
|
|
21
|
+
--obj-black: #222222;
|
|
22
|
+
--obj-red: #E0242B;
|
|
23
|
+
--obj-green: #2E9E44;
|
|
24
|
+
--obj-yellow: #F5D90A;
|
|
25
|
+
--obj-blue: #1E6FD9;
|
|
26
|
+
--obj-brown: #8B5A2B;
|
|
27
|
+
--obj-purple: #8E44AD;
|
|
28
|
+
--obj-pink: #F27BB0;
|
|
29
|
+
--obj-orange: #F28C1A;
|
|
30
|
+
--obj-gray: #8C8C8C;
|
|
19
31
|
}
|
|
20
32
|
@supports (color: color-mix(in oklch, red 10%, white)){
|
|
21
33
|
:root{
|
package/themes/tokiwa/theme.json
CHANGED
package/themes/tokiwa/tokens.css
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
:root{
|
|
4
4
|
--base: #0a5753; /* 常盤 */
|
|
5
5
|
--lit: #F5C000; /* 光と照らされる側。菜の花の黄(白地 1.7:1。1.1.0) */
|
|
6
|
+
/* 物の色(format spec §8.4):内容そのものである色。default と同じ値(どのテーマでも赤い玉は同じ赤)。名前か頭文字を添え、白・黒と地に近い色には輪郭線。1.2.0 */
|
|
7
|
+
--obj-white: #FFFFFF;
|
|
8
|
+
--obj-black: #222222;
|
|
9
|
+
--obj-red: #E0242B;
|
|
10
|
+
--obj-green: #2E9E44;
|
|
11
|
+
--obj-yellow: #F5D90A;
|
|
12
|
+
--obj-blue: #1E6FD9;
|
|
13
|
+
--obj-brown: #8B5A2B;
|
|
14
|
+
--obj-purple: #8E44AD;
|
|
15
|
+
--obj-pink: #F27BB0;
|
|
16
|
+
--obj-orange: #F28C1A;
|
|
17
|
+
--obj-gray: #8C8C8C;
|
|
6
18
|
}
|
|
7
19
|
/* look heading: thick-square */
|
|
8
20
|
.slide:not(.cover):not(.sec):not(.layout-tate) > h2{border-bottom-width:5px;padding-left:34px}
|
package/themes.lock.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"themes": {
|
|
3
3
|
"business": {
|
|
4
|
-
"current": "1.
|
|
4
|
+
"current": "1.2.0",
|
|
5
5
|
"versions": [
|
|
6
6
|
"1.0.0",
|
|
7
7
|
"1.0.1",
|
|
8
|
-
"1.1.0"
|
|
8
|
+
"1.1.0",
|
|
9
|
+
"1.2.0"
|
|
9
10
|
],
|
|
10
11
|
"sha256": {
|
|
11
12
|
"1.0.0": "3d6b4175f6bbb71b24ae3b1288cacfe0fce2138dccf0eda4b6887032a062c880",
|
|
12
13
|
"1.0.1": "ca94935076466e609eeed615e077edef0f0e8fb21994bc6614b78303846fae69",
|
|
13
|
-
"1.1.0": "e9b8da437c19f45ec0ac30d8e2db70af2c15179064d83892fd1a677ac57b4ccc"
|
|
14
|
+
"1.1.0": "e9b8da437c19f45ec0ac30d8e2db70af2c15179064d83892fd1a677ac57b4ccc",
|
|
15
|
+
"1.2.0": "e7ee27f2cba4dd665ce40d0165182024f584bf3de8634c5d10f99c1d809d5dcb"
|
|
14
16
|
},
|
|
15
17
|
"changes": {
|
|
16
18
|
"1.0.1": {
|
|
@@ -28,22 +30,29 @@
|
|
|
28
30
|
"date": "2026-11-09",
|
|
29
31
|
"reason": "new role --lit (light and what it lights), #F2C300, a yellow kept away from the orange --emph, for fills drawn with an outline; under colour-vision simulation it stays apart from --emph. No existing colour changes",
|
|
30
32
|
"tokens": []
|
|
33
|
+
},
|
|
34
|
+
"1.2.0": {
|
|
35
|
+
"date": "2026-11-10",
|
|
36
|
+
"reason": "new roles --obj-white … --obj-gray (object colours), the same values as default 1.4.0 so that a red ball is the same red in every theme. No existing colour changes",
|
|
37
|
+
"tokens": []
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
40
|
},
|
|
34
41
|
"default": {
|
|
35
|
-
"current": "1.
|
|
42
|
+
"current": "1.4.0",
|
|
36
43
|
"versions": [
|
|
37
44
|
"1.0.0",
|
|
38
45
|
"1.1.0",
|
|
39
46
|
"1.2.0",
|
|
40
|
-
"1.3.0"
|
|
47
|
+
"1.3.0",
|
|
48
|
+
"1.4.0"
|
|
41
49
|
],
|
|
42
50
|
"sha256": {
|
|
43
51
|
"1.0.0": "d5486df8f7bc6df2f31e6d155f4d22583b5e12fca45ed434e74372788a953d0b",
|
|
44
52
|
"1.1.0": "afdeb965d6f6ce7d221fbe302fdcdd6414df65fcb41554600a6947994162330c",
|
|
45
53
|
"1.2.0": "4b607693e914552cbff5143df415d98aeb00b4be229a7b6446d874f5853b7c1a",
|
|
46
|
-
"1.3.0": "97537e8e5e32ec2b74df74dd4ce247e476e742d1910e08847adedeebd337b953"
|
|
54
|
+
"1.3.0": "97537e8e5e32ec2b74df74dd4ce247e476e742d1910e08847adedeebd337b953",
|
|
55
|
+
"1.4.0": "d7ec9923b2334d70e879048e21a75c6745ce443be93eac2e354a9bb986b4510e"
|
|
47
56
|
},
|
|
48
57
|
"changes": {
|
|
49
58
|
"1.1.0": {
|
|
@@ -77,114 +86,161 @@
|
|
|
77
86
|
"date": "2026-11-09",
|
|
78
87
|
"reason": "new role --lit (light and what it lights: the sun, a lamp, the lit side of the Moon), a warm yellow #F5B800 for fills drawn with an outline (1.8:1 on white, so never used alone or for text); under colour-vision simulation it stays apart from --emph (ΔE*ab ≥ 42, ΔE00 ≥ 28). No existing colour changes",
|
|
79
88
|
"tokens": []
|
|
89
|
+
},
|
|
90
|
+
"1.4.0": {
|
|
91
|
+
"date": "2026-11-10",
|
|
92
|
+
"reason": "new roles --obj-white … --obj-gray (object colours: colours that are the content, such as balls, litmus paper and signals; the eleven basic colour terms), always shown with a name or initial and, for white, black and colours near the background, an outline; each hue lies in its family's window and adjacent families differ by ΔE00 ≥ 20. No existing colour changes",
|
|
93
|
+
"tokens": []
|
|
80
94
|
}
|
|
81
95
|
}
|
|
82
96
|
},
|
|
83
97
|
"kokugo": {
|
|
84
|
-
"current": "1.
|
|
98
|
+
"current": "1.2.0",
|
|
85
99
|
"versions": [
|
|
86
100
|
"1.0.0",
|
|
87
|
-
"1.1.0"
|
|
101
|
+
"1.1.0",
|
|
102
|
+
"1.2.0"
|
|
88
103
|
],
|
|
89
104
|
"sha256": {
|
|
90
105
|
"1.0.0": "b4d4f73585cf84f2de29ff28516fb9b7fac95c9a453130bb1d80b8c3306f15a2",
|
|
91
|
-
"1.1.0": "a75451c67ac68a92021aae7b19bd0d5944c4992a5bbe4d8c64396ff87c97da46"
|
|
106
|
+
"1.1.0": "a75451c67ac68a92021aae7b19bd0d5944c4992a5bbe4d8c64396ff87c97da46",
|
|
107
|
+
"1.2.0": "6d55109225e67aca90d501ddc7ee73efbab45d468f28ea7c1bd50b769eabed06"
|
|
92
108
|
},
|
|
93
109
|
"changes": {
|
|
94
110
|
"1.1.0": {
|
|
95
111
|
"date": "2026-11-09",
|
|
96
112
|
"reason": "new role --lit (light and what it lights), #F8B500, yamabuki yellow, for fills drawn with an outline; under colour-vision simulation it stays apart from --emph. No existing colour changes",
|
|
97
113
|
"tokens": []
|
|
114
|
+
},
|
|
115
|
+
"1.2.0": {
|
|
116
|
+
"date": "2026-11-10",
|
|
117
|
+
"reason": "new roles --obj-white … --obj-gray (object colours), the same values as default 1.4.0 so that a red ball is the same red in every theme. No existing colour changes",
|
|
118
|
+
"tokens": []
|
|
98
119
|
}
|
|
99
120
|
}
|
|
100
121
|
},
|
|
101
122
|
"sumi": {
|
|
102
|
-
"current": "1.
|
|
123
|
+
"current": "1.2.0",
|
|
103
124
|
"versions": [
|
|
104
125
|
"1.0.0",
|
|
105
|
-
"1.1.0"
|
|
126
|
+
"1.1.0",
|
|
127
|
+
"1.2.0"
|
|
106
128
|
],
|
|
107
129
|
"sha256": {
|
|
108
130
|
"1.0.0": "a8ec5ae630ed5d399bca109c36cab9066329f312e5b0512b20498e5e6a0db0f4",
|
|
109
|
-
"1.1.0": "b6ad19b0601da495219040dff46160abd623c380cd183a19055b4203878dadf8"
|
|
131
|
+
"1.1.0": "b6ad19b0601da495219040dff46160abd623c380cd183a19055b4203878dadf8",
|
|
132
|
+
"1.2.0": "c0a61638ed6d461c1aeb64cf4071ac63793905278c049348581798d83c8653ae"
|
|
110
133
|
},
|
|
111
134
|
"changes": {
|
|
112
135
|
"1.1.0": {
|
|
113
136
|
"date": "2026-11-09",
|
|
114
137
|
"reason": "new role --lit (light and what it lights), #F2C300, a yellow kept away from the orange --emph, for fills drawn with an outline; under colour-vision simulation it stays apart from --emph. No existing colour changes",
|
|
115
138
|
"tokens": []
|
|
139
|
+
},
|
|
140
|
+
"1.2.0": {
|
|
141
|
+
"date": "2026-11-10",
|
|
142
|
+
"reason": "new roles --obj-white … --obj-gray (object colours), the same values as default 1.4.0 so that a red ball is the same red in every theme. No existing colour changes",
|
|
143
|
+
"tokens": []
|
|
116
144
|
}
|
|
117
145
|
}
|
|
118
146
|
},
|
|
119
147
|
"tokiwa": {
|
|
120
|
-
"current": "1.
|
|
148
|
+
"current": "1.2.0",
|
|
121
149
|
"versions": [
|
|
122
150
|
"1.0.0",
|
|
123
|
-
"1.1.0"
|
|
151
|
+
"1.1.0",
|
|
152
|
+
"1.2.0"
|
|
124
153
|
],
|
|
125
154
|
"sha256": {
|
|
126
155
|
"1.0.0": "b44963f640db4cde9b16bd7c93d01325690d1072c90922111a4774b527174579",
|
|
127
|
-
"1.1.0": "73b5fe9cdfa0ce1648c73f346f72382c8945fb50f8c144626599fb27868aaeaa"
|
|
156
|
+
"1.1.0": "73b5fe9cdfa0ce1648c73f346f72382c8945fb50f8c144626599fb27868aaeaa",
|
|
157
|
+
"1.2.0": "a89dc73d5446aa7edd2f637111ba6da9b502037bdc7a4609585eaae20637261c"
|
|
128
158
|
},
|
|
129
159
|
"changes": {
|
|
130
160
|
"1.1.0": {
|
|
131
161
|
"date": "2026-11-09",
|
|
132
162
|
"reason": "new role --lit (light and what it lights), #F5C000, rapeseed yellow, for fills drawn with an outline; under colour-vision simulation it stays apart from --emph. No existing colour changes",
|
|
133
163
|
"tokens": []
|
|
164
|
+
},
|
|
165
|
+
"1.2.0": {
|
|
166
|
+
"date": "2026-11-10",
|
|
167
|
+
"reason": "new roles --obj-white … --obj-gray (object colours), the same values as default 1.4.0 so that a red ball is the same red in every theme. No existing colour changes",
|
|
168
|
+
"tokens": []
|
|
134
169
|
}
|
|
135
170
|
}
|
|
136
171
|
},
|
|
137
172
|
"murasaki": {
|
|
138
|
-
"current": "1.
|
|
173
|
+
"current": "1.2.0",
|
|
139
174
|
"versions": [
|
|
140
175
|
"1.0.0",
|
|
141
|
-
"1.1.0"
|
|
176
|
+
"1.1.0",
|
|
177
|
+
"1.2.0"
|
|
142
178
|
],
|
|
143
179
|
"sha256": {
|
|
144
180
|
"1.0.0": "e1d3ecb04a4a42808a780f3f8a3d94e849a644b1c68c5d4f410a5cde9f66ab86",
|
|
145
|
-
"1.1.0": "56d9b1eb518dc05cc50ef70357e45ae361337041ebb9536cd04e408bda68aff5"
|
|
181
|
+
"1.1.0": "56d9b1eb518dc05cc50ef70357e45ae361337041ebb9536cd04e408bda68aff5",
|
|
182
|
+
"1.2.0": "96c442dc5604648ad0fc137f4bf58b3196dc79c7240f39be40863b610ff19b74"
|
|
146
183
|
},
|
|
147
184
|
"changes": {
|
|
148
185
|
"1.1.0": {
|
|
149
186
|
"date": "2026-11-09",
|
|
150
187
|
"reason": "new role --lit (light and what it lights), #F3BE00, a yellow opposite the purple, for fills drawn with an outline; under colour-vision simulation it stays apart from --emph. No existing colour changes",
|
|
151
188
|
"tokens": []
|
|
189
|
+
},
|
|
190
|
+
"1.2.0": {
|
|
191
|
+
"date": "2026-11-10",
|
|
192
|
+
"reason": "new roles --obj-white … --obj-gray (object colours), the same values as default 1.4.0 so that a red ball is the same red in every theme. No existing colour changes",
|
|
193
|
+
"tokens": []
|
|
152
194
|
}
|
|
153
195
|
}
|
|
154
196
|
},
|
|
155
197
|
"kogecha": {
|
|
156
|
-
"current": "1.
|
|
198
|
+
"current": "1.2.0",
|
|
157
199
|
"versions": [
|
|
158
200
|
"1.0.0",
|
|
159
|
-
"1.1.0"
|
|
201
|
+
"1.1.0",
|
|
202
|
+
"1.2.0"
|
|
160
203
|
],
|
|
161
204
|
"sha256": {
|
|
162
205
|
"1.0.0": "e364c687acb0ae78aa560ae2b785fcf8b4aed4392fc3a8c113a517391e9f3258",
|
|
163
|
-
"1.1.0": "74158847f3ce64db3a94202705f9cd6c416e3f1b0331da234e28a39e79a62f83"
|
|
206
|
+
"1.1.0": "74158847f3ce64db3a94202705f9cd6c416e3f1b0331da234e28a39e79a62f83",
|
|
207
|
+
"1.2.0": "8c8407b0e177f50996345bb058b90bd7e2b0b0ed3410447c50b5e8c0d2128171"
|
|
164
208
|
},
|
|
165
209
|
"changes": {
|
|
166
210
|
"1.1.0": {
|
|
167
211
|
"date": "2026-11-09",
|
|
168
212
|
"reason": "new role --lit (light and what it lights), #EDB91A, a subdued golden yellow, for fills drawn with an outline; under colour-vision simulation it stays apart from --emph. No existing colour changes",
|
|
169
213
|
"tokens": []
|
|
214
|
+
},
|
|
215
|
+
"1.2.0": {
|
|
216
|
+
"date": "2026-11-10",
|
|
217
|
+
"reason": "new roles --obj-white … --obj-gray (object colours), slightly less saturated than default to fit the subdued palette, same hue families. No existing colour changes",
|
|
218
|
+
"tokens": []
|
|
170
219
|
}
|
|
171
220
|
}
|
|
172
221
|
},
|
|
173
222
|
"asagi": {
|
|
174
|
-
"current": "1.
|
|
223
|
+
"current": "1.2.0",
|
|
175
224
|
"versions": [
|
|
176
225
|
"1.0.0",
|
|
177
|
-
"1.1.0"
|
|
226
|
+
"1.1.0",
|
|
227
|
+
"1.2.0"
|
|
178
228
|
],
|
|
179
229
|
"sha256": {
|
|
180
230
|
"1.0.0": "e35712155c3d2122e8e2f149899e555d83ea6de0b9659facbd32b498d30f4511",
|
|
181
|
-
"1.1.0": "65cadb2e52800d4dd8ead1eee9eead8987255386a330faf5c0122c827c33256a"
|
|
231
|
+
"1.1.0": "65cadb2e52800d4dd8ead1eee9eead8987255386a330faf5c0122c827c33256a",
|
|
232
|
+
"1.2.0": "4faf4a73bd671eae092db1a6f72daa91fa0ab7822bc19b64120aab3cc06bb74c"
|
|
182
233
|
},
|
|
183
234
|
"changes": {
|
|
184
235
|
"1.1.0": {
|
|
185
236
|
"date": "2026-11-09",
|
|
186
237
|
"reason": "new role --lit (light and what it lights), #FFCE3A, a bright yellow, for fills drawn with an outline; under colour-vision simulation it stays apart from --emph. No existing colour changes",
|
|
187
238
|
"tokens": []
|
|
239
|
+
},
|
|
240
|
+
"1.2.0": {
|
|
241
|
+
"date": "2026-11-10",
|
|
242
|
+
"reason": "new roles --obj-white … --obj-gray (object colours), slightly brighter than default for primary schools and publicity, same hue families. No existing colour changes",
|
|
243
|
+
"tokens": []
|
|
188
244
|
}
|
|
189
245
|
}
|
|
190
246
|
}
|
|
@@ -41,16 +41,22 @@
|
|
|
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.6.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)は教材の作者が直接書かないので一覧には出さない。
|
|
48
48
|
|
|
49
49
|
| 部品 | 版 | 内容 | 段階の数 | 受け取る値 | 見本 |
|
|
50
50
|
|---|---|---|---|---|---|
|
|
51
|
+
| [`<m-balance>`](sha256/1298d779fe60ccfc09747fbdba47e2111175bd7fd2385a5b68c8f2644cd267be/README.md) | 2.0.0 | 確率の重りを置き、支点が期待値でつり合う様子を示す | 数直線と重り→支点を期待値へ→値と和の式(3 段階) | dur, digits, size | [demo](sha256/1298d779fe60ccfc09747fbdba47e2111175bd7fd2385a5b68c8f2644cd267be/demo.html) |
|
|
51
52
|
| [`<m-cards>`](sha256/f3d5b6ce53f40c5f355a67538ff11b9cd28297da6292125ccb6e055aeddef906/README.md) | 2.0.3 | カード(番号の丸・アイコン・見出し・説明)を横一列か 2 段に並べ、段階ごとに出す。矢印で順を、枠の色で強調を見せる | カードの step の最大(既定はカード 1 枚 = 1 段階。per-step で n 枚ずつ) | layout, arrows, nums, hilite, per-step, stagger, dur | [demo](sha256/f3d5b6ce53f40c5f355a67538ff11b9cd28297da6292125ccb6e055aeddef906/demo.html) |
|
|
53
|
+
| [`<m-ci>`](sha256/a69ab76ff7d0746d093b4e606d7b113be921cbb156edc16c2ad40aafab280d42/README.md) | 2.0.0 | 正規標本の区間を重ね、母平均を含む割合で信頼水準を説明する | 軸と μ→区間を順に→含む数と外れの強調(3 段階) | dur, fast, size | [demo](sha256/a69ab76ff7d0746d093b4e606d7b113be921cbb156edc16c2ad40aafab280d42/demo.html) |
|
|
54
|
+
| [`<m-code>`](sha256/f13af97d7ebf9893d5783eff27e4e1ce092ccd01783b332ad01aa0d201356548/README.md) | 2.0.0 | 短いコードを行ごとに説明し、最後に出力を見せる | コード全体→説明を順に→出力(説明数+1、出力ありは+2) | dur, size, outputPos | [demo](sha256/f13af97d7ebf9893d5783eff27e4e1ce092ccd01783b332ad01aa0d201356548/demo.html) |
|
|
55
|
+
| [`<m-folds>`](sha256/d75c461bb7b2b1c9a2b6d15bee1e11bcec88ef94931174d6b222cd309f6a0287/README.md) | 2.0.0 | 検証用の区画を順に替え、各分割の誤差と平均を示す | 分割を 1 行ずつ→平均(k + 1 段階) | dur, size | [demo](sha256/d75c461bb7b2b1c9a2b6d15bee1e11bcec88ef94931174d6b222cd309f6a0287/demo.html) |
|
|
56
|
+
| [`<m-mapping>`](sha256/decb7c026527ea269a401efedcb5d4d56d186074b286d2f94772068bef56b256/README.md) | 2.0.0 | 実験の結果を数値へ対応させ、同じ値になる結果をまとめて確率分布を作る | 結果の札→対応の矢印→同じ値の色と個数・確率の和→分布の横棒の 4 段階 | dur, stagger, digits, size | [demo](sha256/decb7c026527ea269a401efedcb5d4d56d186074b286d2f94772068bef56b256/demo.html) |
|
|
52
57
|
| [`<m-orbit>`](sha256/2e9a35ce9e289196d0b5fd24b8546cf6e0f4a6df857e69f4f78e686cabb00e61/README.md) | 2.0.4 | 月の満ち欠け(金星の満ち欠け)。北極の上から見た図と地球から見た形を並べ、月を位置から位置へ動かす。形は位置から計算する | 動く先の数(既定は 8 つの位置を新月から 1 周 = 8 段階。visit で決める) | mode, hemisphere, sun, earth, moon, observer, size, dur | [demo](sha256/2e9a35ce9e289196d0b5fd24b8546cf6e0f4a6df857e69f4f78e686cabb00e61/demo.html) |
|
|
53
58
|
| [`<m-particles>`](sha256/ec132caf4b4fd019fab20f9e9d6bc86266e30eb80a4fb8d2de4ca440ad45a098/README.md) | 2.0.0 | 状態変化の粒子の並び方と間隔、化学変化で保存される原子の数を見せる | state は states の数 − 1(既定 2)。reaction は反応前→原子に分かれる→反応後の 3 段階 | mode, count, size, dur, volume, motion | [demo](sha256/ec132caf4b4fd019fab20f9e9d6bc86266e30eb80a4fb8d2de4ca440ad45a098/demo.html) |
|
|
59
|
+
| [`<m-sampling>`](sha256/7aea8341beffcd4ad95c12b7e7e3be3f0f52eb7932d424be9e74e2fbd7339e45/README.md) | 2.0.0 | 母集団から標本を取り、比率・平均の標本分布を積む | 母集団→抽出→統計量と点→反復の 4 段階 | dur, stagger, fast, size | [demo](sha256/7aea8341beffcd4ad95c12b7e7e3be3f0f52eb7932d424be9e74e2fbd7339e45/demo.html) |
|
|
54
60
|
| [`<m-score>`](sha256/abbe3a79cdd442191cb76ac572a7fa62af694850c115c4abba30356bae5f475f/README.md) | 2.1.0 | 楽譜(五線譜)を 1 音・和音ずつ、または 1 小節ずつ出して音も鳴らす。ABC 記譜法で書く | 音符・和音・休符 1 つ=1 段階。by="measure" なら 1 小節=1 段階(per-step="N" なら N 小節。弱起の小節は次の段階に入る) | by, names, per-step | [demo](sha256/abbe3a79cdd442191cb76ac572a7fa62af694850c115c4abba30356bae5f475f/demo.html) |
|
|
55
61
|
|
|
56
62
|
名前で引く線のアイコン(土台パーツ `icons`)は[この README](sha256/b2dfb4fa290d240024c95e2d24fda887db9fbc5b94f99b5be00c74c488fcfddb/README.md) を見る。
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Balance at expectation
|
|
3
|
+
steps: Weights → pivot → sum (3)
|
|
4
|
+
props:
|
|
5
|
+
dur: Seconds
|
|
6
|
+
digits: Decimal places
|
|
7
|
+
size: Text px
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
JSON:
|
|
11
|
+
- `values`: 2–12 distinct numbers.
|
|
12
|
+
- `probs`: sum to 1 (else reported).
|
|
13
|
+
- `name`: X.
|
|
14
|
+
|
|
15
|
+
<!-- llm: omit -->
|
|
16
|
+
Bars proportional to probabilities. Pivot: minimum → E[X]. Moment controls tilt, clamped ±8°, then levels. Beam, bars and ticks rotate together. Starts horizontal; tilts at step 2. Final E and mtext sum; first 6 terms then …; computation and accessible weights include all terms. Negative terms parenthesized.
|
|
17
|
+
|
|
18
|
+
Invalid totals stay unnormalized. Out-of-range probabilities, mismatched lengths, duplicates or unrepresentable calculations: report, no draw. dur 1.5s; digits 0–10 (2), trailing zeros removed; size 0=26px, ≥24. Bad props default/report.
|
|
19
|
+
|
|
20
|
+
1184×440px suggested. Scaled coordinates, nice ticks. Close bars, labels or long sums report size.
|
|
21
|
+
|
|
22
|
+
ctx.lang selects ja/en. Font boxes ≥1.43em plus gap. Image role, final summary; preserve author label, hide SVG. No answer preview. Fictional demo.
|
|
23
|
+
<!-- llm: end -->
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// m-balance: expectation is the zero-moment position of probability weights.
|
|
2
|
+
egatariParts.define({name: "balance", version: "2.0.0", requires: {base: "1.1.0", plot: "1.1.1"}, element: "m-balance"}, function(deps){
|
|
3
|
+
"use strict";
|
|
4
|
+
var base = deps.base;
|
|
5
|
+
var TEXT = {
|
|
6
|
+
ja: {title: "期待値はつり合いの位置", probability: "確率", sum: "確率の合計", expectation: "期待値"},
|
|
7
|
+
en: {title: "Expectation is the balance point", probability: "probability", sum: "probability total", expectation: "expectation"}
|
|
8
|
+
};
|
|
9
|
+
function set(e, a, v){ e.setAttribute(a, String(v)); }
|
|
10
|
+
function ticks(lo, hi){
|
|
11
|
+
var rough = (hi - lo) / 5, power = Math.pow(10, Math.floor(Math.log10(rough))), f = rough / power;
|
|
12
|
+
var step = (f <= 1 ? 1 : f <= 2 ? 2 : f <= 5 ? 5 : 10) * power, out = [];
|
|
13
|
+
for (var i = Math.ceil(lo / step); out.length < 10 && i * step <= hi + step * 1e-9; i++) out.push(+(i * step).toPrecision(12));
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
16
|
+
function num(v){ return String(+v.toPrecision(6)); }
|
|
17
|
+
return class extends base.MotionElement {
|
|
18
|
+
static partName = "balance";
|
|
19
|
+
static preview = "none";
|
|
20
|
+
static steps = 3;
|
|
21
|
+
static shape = {schema: {type: "object", additionalProperties: false, required: ["values", "probs"], properties: {
|
|
22
|
+
values: {type: "array", minItems: 2, maxItems: 12, items: {type: "number"}},
|
|
23
|
+
probs: {type: "array", minItems: 2, maxItems: 12, items: {type: "number"}}, name: {type: "string"}
|
|
24
|
+
}}, example: {values: [0, 1, 2, 3], probs: [0.1, 0.3, 0.4, 0.2], name: "X"}};
|
|
25
|
+
static props = {
|
|
26
|
+
dur: {type: "number", default: 1.5, doc: "段階の秒数"},
|
|
27
|
+
digits: {type: "number", default: 2, doc: "期待値の小数桁"},
|
|
28
|
+
size: {type: "number", default: 0, doc: "文字 px(0 は 26)"}
|
|
29
|
+
};
|
|
30
|
+
duration(k){ return k >= 1 && k <= 3 ? this.props.dur : 0; }
|
|
31
|
+
label(g, x, y, s, anchor){
|
|
32
|
+
var e = base.el("text", {x: x, y: y, "font-size": this.fs, "text-anchor": anchor || "start", fill: "var(--fg)"}, g);
|
|
33
|
+
e.textContent = s; return e;
|
|
34
|
+
}
|
|
35
|
+
mount(ctx){
|
|
36
|
+
var self = this, d = this.data, P = this.props;
|
|
37
|
+
this.T = /^ja\b/i.test(ctx.lang || "") ? TEXT.ja : TEXT.en;
|
|
38
|
+
if (!(Number.isFinite(P.dur) && P.dur > 0)){ ctx.report("attr", "[balance] dur must be positive; using 1.5"); P.dur = 1.5; }
|
|
39
|
+
if (!Number.isInteger(P.digits) || P.digits < 0 || P.digits > 10){ ctx.report("attr", "[balance] digits must be an integer 0–10; using 2"); P.digits = 2; }
|
|
40
|
+
if (!(P.size === 0 || Number.isFinite(P.size) && P.size >= 24)){ ctx.report("attr", "[balance] size must be 0 or at least 24; using 26"); P.size = 0; }
|
|
41
|
+
this.fs = P.size || 26;
|
|
42
|
+
this.style.display = "block"; this.style.position = "relative"; this.style.writingMode = "horizontal-tb"; this.setAttribute("role", "img");
|
|
43
|
+
if (d.values.length !== d.probs.length || new Set(d.values).size !== d.values.length){ ctx.report("data", "[balance] values must be distinct and probs must have the same length"); return; }
|
|
44
|
+
var total = d.probs.reduce(function(s, p){ return s + p; }, 0);
|
|
45
|
+
if (Math.abs(total - 1) > 1e-9) ctx.report("data", "[balance] probs must sum to 1 (±1e-9); drawing supplied weights, total " + total);
|
|
46
|
+
if (d.probs.some(function(p){ return p < 0 || p > 1; })){ ctx.report("data", "[balance] probabilities must be between 0 and 1"); return; }
|
|
47
|
+
// Scale before sums and coordinate differences to keep finite extreme values usable.
|
|
48
|
+
var scale = Math.pow(10, Math.floor(Math.log10(Math.max(1, ...d.values.map(Math.abs))))), vals = d.values.map(function(v){ return v / scale; });
|
|
49
|
+
var expectedN = vals.reduce(function(s, v, i){ return s + v * d.probs[i]; }, 0), expected = expectedN * scale;
|
|
50
|
+
if (!Number.isFinite(expected)){ ctx.report("data", "[balance] expectation exceeds the numerical range; rescale values"); return; }
|
|
51
|
+
var lo = Math.min(...vals, expectedN), hi = Math.max(...vals, expectedN), span = hi - lo;
|
|
52
|
+
if (!(span > 0)){ ctx.report("data", "[balance] values are too close to represent; rescale values"); return; }
|
|
53
|
+
var name = d.name === undefined ? "X" : d.name, answer = String(+expected.toFixed(P.digits));
|
|
54
|
+
var expectation = "E[" + name + "] = " + answer;
|
|
55
|
+
var terms = d.values.map(function(v, i){ return (v < 0 ? "(" + num(v) + ")" : num(v)) + "×" + num(d.probs[i]); });
|
|
56
|
+
var formula = terms.slice(0, 6).join(" + ") + (terms.length > 6 ? " + …" : "") + " = " + answer;
|
|
57
|
+
this.model = {values: d.values.slice(), probs: d.probs.slice(), total: total, expected: expected, expectedN: expectedN, scale: scale, name: name, formula: formula, lo: lo, hi: hi};
|
|
58
|
+
if (!this.getAttribute("aria-label")) this.setAttribute("aria-label", this.T.title + "; " + d.values.map(function(v, i){ return num(v) + ": " + self.T.probability + " " + num(d.probs[i]); }).join("; ") + "; " + this.T.sum + " " + num(total) + "; " + this.T.expectation + " " + expectation + "; " + formula);
|
|
59
|
+
var W = Math.max(1, this.clientWidth), H = Math.max(1, this.clientHeight), fs = this.fs, line = fs * 1.45 + 4;
|
|
60
|
+
var width = function(s){ return base.textWidth(s, fs, {font: self}); };
|
|
61
|
+
var pad = Math.max(56, ...d.values.map(function(v){ return width(num(v)) / 2 + 16; }));
|
|
62
|
+
var axisY = H / 2, plot = deps.plot.Plot(this, {xr: [lo, hi], yr: [0, 1], xt: [], yt: [], noY: true, m: {l: pad, r: pad, t: 0, b: H - axisY}});
|
|
63
|
+
this.svg = plot.svg; set(this.svg, "width", W); set(this.svg, "height", H); set(this.svg, "aria-hidden", "true");
|
|
64
|
+
var axes = Array.from(this.svg.children).filter(function(e){ return e.getAttribute("class") === "axes"; })[0]; this.svg.removeChild(axes);
|
|
65
|
+
this.weightLayer = base.el("g", {opacity: 0}, this.svg);
|
|
66
|
+
this.beam = base.el("g", {}, this.weightLayer);
|
|
67
|
+
base.el("line", {x1: pad, x2: W - pad, y1: axisY, y2: axisY, stroke: "var(--muted)", "stroke-width": 4}, this.beam);
|
|
68
|
+
var plotWidth = Math.max(1, W - 2 * pad), maxRise = plotWidth * Math.sin(8 * Math.PI / 180) / 4;
|
|
69
|
+
var barH = Math.max(20, axisY - 1.45 * fs - maxRise - 24), maxP = Math.max(1e-12, ...d.probs);
|
|
70
|
+
var positions = vals.map(plot.x), sorted = positions.slice().sort(function(a, b){ return a - b; });
|
|
71
|
+
var minGap = Math.min(...sorted.slice(1).map(function(x, i){ return x - sorted[i]; })), bw = Math.max(2, Math.min(44, minGap - 12));
|
|
72
|
+
var small = W < 2 * pad + 40 || axisY - barH - 1.1 * fs - maxRise < 0 || axisY + plotWidth * Math.sin(8 * Math.PI / 180) + line + fs * 0.4 > H;
|
|
73
|
+
this.bars = d.values.map(function(v, i){
|
|
74
|
+
var h = d.probs[i] / maxP * barH, x = positions[i], s = num(d.probs[i]);
|
|
75
|
+
var bar = base.el("rect", {x: x - bw / 2, y: axisY - h, width: bw, height: h, fill: "var(--term)"}, self.beam);
|
|
76
|
+
var text = self.label(self.beam, x, axisY - h - fs * 0.4 - 8, s, "middle");
|
|
77
|
+
return {bar: bar, text: text, x: x, h: h, w: width(s)};
|
|
78
|
+
});
|
|
79
|
+
this.bars.forEach(function(a, i){ self.bars.slice(i + 1).forEach(function(b){
|
|
80
|
+
if (Math.abs(a.x - b.x) < (a.w + b.w) / 2 + 6 && Math.abs(a.h - b.h) < 1.45 * fs + 4) small = true;
|
|
81
|
+
// A neighbouring tall bar must not run through a probability label.
|
|
82
|
+
if (Math.abs(a.x - b.x) < a.w / 2 + bw / 2 + 4 && b.h > a.h + 4 || Math.abs(a.x - b.x) < b.w / 2 + bw / 2 + 4 && a.h > b.h + 4) small = true;
|
|
83
|
+
}); });
|
|
84
|
+
// Nice ticks in normalized coordinates; labels retain the original units.
|
|
85
|
+
this.ticks = ticks(lo, hi);
|
|
86
|
+
var lastRight = -Infinity;
|
|
87
|
+
this.ticks.forEach(function(v){
|
|
88
|
+
var x = plot.x(v), s = num(v * scale), w = width(s);
|
|
89
|
+
if (x - w / 2 < lastRight + 4 || x - w / 2 < 0 || x + w / 2 > W) small = true;
|
|
90
|
+
lastRight = x + w / 2;
|
|
91
|
+
base.el("line", {x1: x, x2: x, y1: axisY, y2: axisY + 6, stroke: "var(--muted)", "stroke-width": 2}, self.beam);
|
|
92
|
+
self.label(self.beam, x, axisY + line, s, "middle");
|
|
93
|
+
});
|
|
94
|
+
this.fulcrum = base.el("g", {opacity: 0}, this.svg);
|
|
95
|
+
base.el("path", {d: "M0," + (axisY + 2) + "l-18,26h36Z", fill: "var(--emph-tint)", stroke: "var(--emph)", "stroke-width": 3}, this.fulcrum);
|
|
96
|
+
this.finalLayer = base.el("g", {opacity: 0}, this.svg);
|
|
97
|
+
this.start = plot.x(Math.min(...vals)); this.end = plot.x(expectedN); this.axisY = axisY;
|
|
98
|
+
var ew = width(expectation), labelX = Math.max(ew / 2 + 4, Math.min(W - ew / 2 - 4, this.end));
|
|
99
|
+
var labelY = axisY + 2 * line + 14, formulaY = H - fs * 0.4 - 4;
|
|
100
|
+
this.label(this.finalLayer, labelX, labelY, expectation, "middle");
|
|
101
|
+
// The sum has numeric terms only; variable names above are literal text.
|
|
102
|
+
this.formulaText = base.mtext(this.finalLayer, W / 2, formulaY, formula, {"font-size": fs, "text-anchor": "middle", fill: "var(--fg)"});
|
|
103
|
+
if (ew > W - 8 || width(formula) > W - 8 || formulaY - labelY < line || labelY + fs * 0.4 > H) small = true;
|
|
104
|
+
if (small) ctx.report("size", "[balance] weights, ticks, tilt or formula do not fit; enlarge the element or separate close values");
|
|
105
|
+
}
|
|
106
|
+
render(k, t){
|
|
107
|
+
if (!this.model) return;
|
|
108
|
+
var dur = this.props.dur, e = k > 2 ? 1 : k < 2 ? 0 : base.prog(t, 0, dur);
|
|
109
|
+
var pivot = base.lerp(this.start, this.end, e), m = this.model;
|
|
110
|
+
var pivotN = base.lerp(Math.min(...m.values.map(function(v){ return v / m.scale; })), m.expectedN, e);
|
|
111
|
+
// Positive moment means a heavier right side (clockwise in SVG). At E, the beam levels.
|
|
112
|
+
var moment = m.values.reduce(function(s, v, i){ return s + (v / m.scale - pivotN) * m.probs[i]; }, 0);
|
|
113
|
+
var angle = k >= 2 && e < 1 ? Math.max(-8, Math.min(8, 8 * moment / (m.hi - m.lo))) : 0;
|
|
114
|
+
set(this.weightLayer, "opacity", k > 1 ? 1 : k < 1 ? 0 : base.prog(t, 0, dur));
|
|
115
|
+
set(this.beam, "transform", "rotate(" + angle + " " + pivot + " " + this.axisY + ")");
|
|
116
|
+
set(this.fulcrum, "opacity", k >= 1 ? 1 : 0); set(this.fulcrum, "transform", "translate(" + pivot + " 0)");
|
|
117
|
+
set(this.finalLayer, "opacity", k > 3 ? 1 : k < 3 ? 0 : base.prog(t, 0, dur));
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Sample; stack statistics
|
|
3
|
+
steps: Population → sample → dot → repeat (4)
|
|
4
|
+
props:
|
|
5
|
+
dur: Seconds
|
|
6
|
+
stagger: Delay
|
|
7
|
+
fast: Repeat seconds
|
|
8
|
+
size: Text px
|
|
9
|
+
example: {"values":[1,2,3,4,5,6],"n":2,"replace":true,"repeat":40,"seed":3}
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Child JSON:
|
|
13
|
+
- `balls`: colour counts, total 2–30; proportion of `of`.
|
|
14
|
+
- `values`: 2–30 numbers; mean. One form.
|
|
15
|
+
- `n`: 1–population size; 1–30 with replacement. Clamp/report.
|
|
16
|
+
- `replace`: false; `repeat`: 1–200 (40); `seed`: integer (1).
|
|
17
|
+
- `stat`: proportion/mean; `digits`: 0–10 (2).
|
|
18
|
+
|
|
19
|
+
<!-- llm: omit -->
|
|
20
|
+
Copies with replacement; gaps without. Restore after recording. Seeded simulation, no answer preview. Final marker: population value. Caption: n and repetitions. Image label includes mean of sample statistics; author's label retained.
|
|
21
|
+
|
|
22
|
+
1184×440px suggested. One sample row; large n needs width. Text ≥24px; line spacing ≥1.45em. Dots shrink to radius 5px, then report size. Integer ticks for small integer ranges, otherwise 1–2–5 steps; proportions use quarters. Composition: red 3, blue 2; omit for cards. Incompatible stat: report, use form default. Missing of: first colour; absent: report, zero. Invalid population: report, no draw. Fictional simulations.
|
|
23
|
+
<!-- llm: end -->
|