egatari 0.6.11 → 0.6.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/bin/egatari.mjs +4 -3
  3. package/components.lock.json +30 -15
  4. package/components2.lock.json +201 -1
  5. package/fonts/@fontsource/fraunces/400.css +29 -0
  6. package/fonts/@fontsource/fraunces/700.css +29 -0
  7. package/fonts/@fontsource/fraunces/LICENSE +93 -0
  8. package/fonts/@fontsource/fraunces/files/fraunces-latin-400-normal.woff2 +0 -0
  9. package/fonts/@fontsource/fraunces/files/fraunces-latin-700-normal.woff2 +0 -0
  10. package/fonts/@fontsource/fraunces/files/fraunces-latin-ext-400-normal.woff2 +0 -0
  11. package/fonts/@fontsource/fraunces/files/fraunces-latin-ext-700-normal.woff2 +0 -0
  12. package/fonts/@fontsource/fraunces/files/fraunces-vietnamese-400-normal.woff2 +0 -0
  13. package/fonts/@fontsource/fraunces/files/fraunces-vietnamese-700-normal.woff2 +0 -0
  14. package/fonts/@fontsource/fraunces/package.json +6 -0
  15. package/kit/check-messages.mjs +18 -7
  16. package/kit/check.mjs +12 -4
  17. package/kit/core/article-render.mjs +5 -5
  18. package/kit/core/build-core.mjs +25 -9
  19. package/kit/core/check-parity.mjs +1 -1
  20. package/kit/core/check-rules.mjs +2 -2
  21. package/kit/core/check-source.mjs +3 -0
  22. package/kit/core/colab-core.mjs +1 -1
  23. package/kit/core/kicker.mjs +42 -0
  24. package/kit/core/layout-scan.mjs +19 -7
  25. package/kit/core/llm-pack-data.mjs +8 -8
  26. package/kit/core/llm-pack.mjs +2 -2
  27. package/kit/core/theme-shapes.mjs +3 -1
  28. package/kit/core/themes-list.mjs +2 -0
  29. package/kit/instruction-version.json +1 -1
  30. package/kit/layouts.css +8 -0
  31. package/kit/player.json +1 -1
  32. package/kit/player.lock.json +2 -2
  33. package/package.json +2 -1
  34. package/themes/asagi/theme.json +1 -1
  35. package/themes/asagi/tokens.css +6 -0
  36. package/themes/bengara/theme.json +13 -0
  37. package/themes/bengara/tokens.css +66 -0
  38. package/themes/business/theme.json +1 -1
  39. package/themes/business/tokens.css +6 -0
  40. package/themes/default/theme.json +1 -1
  41. package/themes/default/tokens.css +9 -0
  42. package/themes/kogecha/theme.json +1 -1
  43. package/themes/kogecha/tokens.css +6 -0
  44. package/themes/kokugo/theme.json +1 -1
  45. package/themes/kokugo/tokens.css +6 -0
  46. package/themes/murasaki/theme.json +1 -1
  47. package/themes/murasaki/tokens.css +6 -0
  48. package/themes/sumi/theme.json +1 -1
  49. package/themes/sumi/tokens.css +8 -0
  50. package/themes/tokiwa/theme.json +1 -1
  51. package/themes/tokiwa/tokens.css +6 -0
  52. package/themes.lock.json +90 -24
  53. package/vendor/components/CATALOG.md +11 -11
  54. package/vendor/components/sha256/04626b77b3c683fd4c8e549339eca153615e021eb0e649c31291deb2dab30667/README.en.md +38 -0
  55. package/vendor/components/sha256/04626b77b3c683fd4c8e549339eca153615e021eb0e649c31291deb2dab30667/index.js +289 -0
  56. package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/ABCJS-ADAPTER.md +101 -0
  57. package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/LICENSE-abcjs.txt +21 -0
  58. package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/chords.json +89 -0
  59. package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/doremi.json +261 -0
  60. package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/extras.json +192 -0
  61. package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/kaeru.json +521 -0
  62. package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/rhythm.json +248 -0
  63. package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/ties.json +360 -0
  64. package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/index.js +508 -0
  65. package/vendor/components/sha256/0dc2a0945e7a4004278fcc9b8f02223bbb87f6269bffe3dd3ebeb3a78ce23d34/index.js +404 -0
  66. package/vendor/components/sha256/0e2e45b024bb2f37e82c83a4d9cd9f9c16b5dc4924dde81735c268a3d49f9d7f/index.js +97 -0
  67. package/vendor/components/sha256/0ef62e33d330f8e31ccb1f480b5e3b349769a142cc2737a9e6583d5eff9f56ca/index.js +919 -0
  68. package/vendor/components/sha256/1b33a252d51091e2d8cdea176f10268f128640bed3aa46da88d7de31ced59b44/README.en.md +48 -0
  69. package/vendor/components/sha256/1b33a252d51091e2d8cdea176f10268f128640bed3aa46da88d7de31ced59b44/index.js +384 -0
  70. package/vendor/components/sha256/1b767b6cf1855156872f87981a7c99f0161013499d6c4b21785624435db92078/README.en.md +34 -0
  71. package/vendor/components/sha256/1b767b6cf1855156872f87981a7c99f0161013499d6c4b21785624435db92078/index.js +244 -0
  72. package/vendor/components/sha256/3ace61e46a4555eab46ca8053db2fb76a874d4d5409bc5891cc449f43ef7e0bd/README.en.md +44 -0
  73. package/vendor/components/sha256/3ace61e46a4555eab46ca8053db2fb76a874d4d5409bc5891cc449f43ef7e0bd/index.js +304 -0
  74. package/vendor/components/sha256/4079077e03343995edc5e34b8bda0cf200dc6d854a52486fe0a6a4ceaf0d4b6f/README.en.md +44 -0
  75. package/vendor/components/sha256/4079077e03343995edc5e34b8bda0cf200dc6d854a52486fe0a6a4ceaf0d4b6f/index.js +203 -0
  76. package/vendor/components/sha256/40aaaaf988e7c32460ffaf5f18b5690ee28fd1fe7e879d8434d58283992bc554/README.en.md +37 -0
  77. package/vendor/components/sha256/40aaaaf988e7c32460ffaf5f18b5690ee28fd1fe7e879d8434d58283992bc554/index.js +438 -0
  78. package/vendor/components/sha256/442be174439d106ef462c19d598c407e86d5de3fcd4700ed54ae4147c4b9969c/README.en.md +24 -0
  79. package/vendor/components/sha256/442be174439d106ef462c19d598c407e86d5de3fcd4700ed54ae4147c4b9969c/index.js +103 -0
  80. package/vendor/components/sha256/48a776e7683e1aba8cad5aa4067914c017681efaa74f175066e0ab081bf3d013/index.js +351 -0
  81. package/vendor/components/sha256/4a9331635c2dd28e4b46108eaffe49c6d29cf626ecb900ac6e9029552be0cf49/index.js +607 -0
  82. package/vendor/components/sha256/5458baef7a30298cf4b0029331f13233d162403e686f9c20085dd2104cad7141/README.en.md +23 -0
  83. package/vendor/components/sha256/5458baef7a30298cf4b0029331f13233d162403e686f9c20085dd2104cad7141/index.js +120 -0
  84. package/vendor/components/sha256/586063d3a4e24e2995923811b2b9466bde86dbaafb3bcf103546d3f28159205a/index.js +812 -0
  85. package/vendor/components/sha256/5acc5f87e29f1170bc35dbee08087d0d03c1023969c6c1b1367a0f559d60e5ee/index.js +198 -0
  86. package/vendor/components/sha256/5c032594230fe688f661b6ccf27070c84f8c0e38611186280fb9c56d89ac3319/README.en.md +32 -0
  87. package/vendor/components/sha256/5c032594230fe688f661b6ccf27070c84f8c0e38611186280fb9c56d89ac3319/index.js +222 -0
  88. package/vendor/components/sha256/603de10f0ee50d07ec610e21b45b9db78d69376b4dfd2baba78595c1002e27ec/README.en.md +50 -0
  89. package/vendor/components/sha256/603de10f0ee50d07ec610e21b45b9db78d69376b4dfd2baba78595c1002e27ec/index.js +171 -0
  90. package/vendor/components/sha256/609e45a826d07a54cbbcbf4ce2ad6b5474dca1d0be394eb9fad895db4a73422f/README.en.md +51 -0
  91. package/vendor/components/sha256/609e45a826d07a54cbbcbf4ce2ad6b5474dca1d0be394eb9fad895db4a73422f/index.js +228 -0
  92. package/vendor/components/sha256/6364043cb31bbd86aacb7432af1a8affef8cae5c6efdbe13fbebd116fd51b91f/index.js +233 -0
  93. package/vendor/components/sha256/6f9f7283226d3534aa1cb4a47ba258204aa286ead01b25cdbde14119260bc702/README.en.md +66 -0
  94. package/vendor/components/sha256/6f9f7283226d3534aa1cb4a47ba258204aa286ead01b25cdbde14119260bc702/index.js +920 -0
  95. package/vendor/components/sha256/72edfd6678b22be0bb3e32b0d8cb0dfee403767e1eacac354d278d7318d03826/README.en.md +35 -0
  96. package/vendor/components/sha256/72edfd6678b22be0bb3e32b0d8cb0dfee403767e1eacac354d278d7318d03826/index.js +179 -0
  97. package/vendor/components/sha256/7482c50bea5ef7d72dc5d4afaddb8c4e725b5a83fa0c6175f9a9c556f23a4e10/LICENSE-tabler.txt +21 -0
  98. package/vendor/components/sha256/7482c50bea5ef7d72dc5d4afaddb8c4e725b5a83fa0c6175f9a9c556f23a4e10/index.js +4868 -0
  99. package/vendor/components/sha256/7482c50bea5ef7d72dc5d4afaddb8c4e725b5a83fa0c6175f9a9c556f23a4e10/names.txt +4808 -0
  100. package/vendor/components/sha256/7cb8948c550b66bf4b34a62e7b61385aaa79896e09d82ccb1846c0ac499ad352/README.en.md +40 -0
  101. package/vendor/components/sha256/7cb8948c550b66bf4b34a62e7b61385aaa79896e09d82ccb1846c0ac499ad352/index.js +348 -0
  102. package/vendor/components/sha256/87cc60da38d209cda449dd7c24171e287ac8184c5036ca04548ef9e2015c2d9e/README.en.md +42 -0
  103. package/vendor/components/sha256/87cc60da38d209cda449dd7c24171e287ac8184c5036ca04548ef9e2015c2d9e/index.js +268 -0
  104. package/vendor/components/sha256/8cb367c71c002c689defddc6f075be911d5485421715119b5515181e962a2401/index.js +121 -0
  105. package/vendor/components/sha256/97bfd6e79c7278c55153bf4c2330da0432cf0ee312baa11650e07cdd7912831d/index.js +354 -0
  106. package/vendor/components/sha256/a426e6a3f8f4593403ba63ecc4a3f1f41064f4016fd9fb8d51e7876bf8c6f573/README.en.md +40 -0
  107. package/vendor/components/sha256/a426e6a3f8f4593403ba63ecc4a3f1f41064f4016fd9fb8d51e7876bf8c6f573/index.js +348 -0
  108. package/vendor/components/sha256/c108119117042cacc65a35ec73fcab95a2a92b2a2797129f66e326783f8db178/index.js +465 -0
  109. package/vendor/components/sha256/c3fad2047cec6a2bd8a5b907f752e2addeeea2f373fd8115914552dcee0b2f6f/README.en.md +23 -0
  110. package/vendor/components/sha256/c3fad2047cec6a2bd8a5b907f752e2addeeea2f373fd8115914552dcee0b2f6f/index.js +289 -0
  111. package/vendor/components/sha256/c59f1ac3132fdf6f56e8880c866570cd7443f09eb8802b6e7af32675ad358edf/README.en.md +31 -0
  112. package/vendor/components/sha256/c59f1ac3132fdf6f56e8880c866570cd7443f09eb8802b6e7af32675ad358edf/index.js +236 -0
  113. package/vendor/components/sha256/d3a75f67160490db1831aaa8ac58ebc5f7ffb6a6fd21e2bdeaa6fe979bfaff7f/README.en.md +42 -0
  114. package/vendor/components/sha256/d3a75f67160490db1831aaa8ac58ebc5f7ffb6a6fd21e2bdeaa6fe979bfaff7f/index.js +488 -0
  115. package/vendor/components/sha256/d998b5db828427505e39cdae67676dc6480c791d6037152dec222ae81cdbba1f/index.js +484 -0
  116. package/vendor/components/sha256/ea17602aaecca64b672b3bc827965ff378cb460250177f7b66f73081a48d4e81/index.js +278 -0
  117. package/vendor/components/sha256/f9cef6dd9580a4f19aa09d47f736ab2391f5f585b20b16a62bd781398cb6b8ac/README.en.md +22 -0
  118. package/vendor/components/sha256/f9cef6dd9580a4f19aa09d47f736ab2391f5f585b20b16a62bd781398cb6b8ac/index.js +145 -0
  119. package/vendor/components-2/manifest-2.8.0.json +2199 -0
  120. package/vendor/themes/asagi/1.2.0/theme.json +14 -0
  121. package/vendor/themes/asagi/1.2.0/tokens.css +30 -0
  122. package/vendor/themes/business/1.2.0/theme.json +5 -0
  123. package/vendor/themes/business/1.2.0/tokens.css +41 -0
  124. package/vendor/themes/default/1.4.0/theme.json +4 -0
  125. package/vendor/themes/default/1.4.0/tokens.css +86 -0
  126. package/vendor/themes/kogecha/1.2.0/theme.json +10 -0
  127. package/vendor/themes/kogecha/1.2.0/tokens.css +29 -0
  128. package/vendor/themes/kokugo/1.2.0/theme.json +5 -0
  129. package/vendor/themes/kokugo/1.2.0/tokens.css +25 -0
  130. package/vendor/themes/murasaki/1.2.0/theme.json +10 -0
  131. package/vendor/themes/murasaki/1.2.0/tokens.css +25 -0
  132. package/vendor/themes/sumi/1.2.0/theme.json +10 -0
  133. package/vendor/themes/sumi/1.2.0/tokens.css +49 -0
  134. package/vendor/themes/tokiwa/1.2.0/theme.json +10 -0
  135. package/vendor/themes/tokiwa/1.2.0/tokens.css +27 -0
@@ -0,0 +1,351 @@
1
+ // m-kanbun:白文に返り点・送り仮名を付け、訓読の順に読み、書き下し文にする(縦書き)
2
+ // <m-kanbun style="height:440px">
3
+ // 春眠不{=ず}レ覚(エ)レ暁(ヲ)
4
+ // 処処聞(ク)[二]啼鳥(ヲ)[一]
5
+ // </m-kanbun>
6
+ // 1 行が 1 列(句)。行の中の空白は読まない。字の後ろに付けるもの(順は問わない):
7
+ // (送り仮名) [返り点](レ・一二三四五・上中下・甲乙丙丁・天地人、一レ・上レ・甲レ・天レ)。レ点だけは [ ] なしの「レ」でもよい
8
+ // {振り仮名} {=かな}(書き下し文で平仮名にする字:不{=ず}、也{=なり}) {-}(置き字:読まない)
9
+ // (右|二度目) 再読文字:右の送り仮名と二度目の読み(未(ダ|ず)、将(ニ|ス))。二度目の読みの片仮名は左の送り仮名として出す
10
+ // 字-字 竪点(続けて読む熟語。返り点はまとまり全体に効く) 、。 句読点(白文では出さない)
11
+ // 段階(phases の順。既定は kunten order kaki):段階 0 は白文 → kunten 訓点(返り点・送り仮名)→ order 読む順(目が字を順にたどり、
12
+ // 返り点で上へ戻るところに弧を描く)→ kaki 書き下し文(左に縦書きで)。読む順の計算は kanbun-core の order(試験は tools/test-kokugo.mjs)
13
+ // order は既定(order-by="col")で列(句)ごとに 1 段階:読む順の字を、字の列が変わるところで切る。order-by="all" で全体を 1 段階(v1.3.0 まで)
14
+ // 2.0(Egatari spec §6.1 の部品):base の MotionElement・prog・lerp・previewOpacity と、読み取り・訓読の順の kanbun-core を使い、
15
+ // プレイヤーのグローバルは使わない。書き方の誤りは ctx.report("data", "[kanbun] …")、要素に収まらないときは
16
+ // ctx.report("size", "[kanbun] …") で知らせる(1.x の console.warn("m-kanbun: …") の代わり)
17
+ egatariParts.define({name: "kanbun", version: "2.0.3", requires: {base: "1.2.0", "kanbun-core": "1.0.0"}, element: "m-kanbun"}, function(deps){
18
+ "use strict";
19
+ var base = deps.base;
20
+ var D = base;
21
+
22
+ // ---------------------------------------------------------------- 読み取りと訓読の順(kanbun-core)
23
+ var K = deps["kanbun-core"];
24
+ var parse = K.parse, order = K.order, charEvents = K.charEvents, kakikudashi = K.kakikudashi, stepGroups = K.stepGroups;
25
+ var plain = function(line){ return line.map(function(s){ return s.t; }).join(""); };
26
+
27
+ // ---------------------------------------------------------------- 部品
28
+ var PH = ["kunten", "order", "kaki"];
29
+ // 長い送り仮名を詰める:fit は自然の長さ(字数 × 字の大きさ)に対する割合。まず字間を詰め(1 字につき字の大きさの 0.12 まで)、
30
+ // 残りを縦に縮める(transform。字の大きさ・字の幅は変えない)。OK_MIN より詰めない(それより長ければ次の字を下げる)
31
+ var OK_MIN = 0.78, OK_TRACK = 0.12, GAP_OK = 8, OK_DELAY = 0.36;
32
+ // 要素に収めるときの字の大きさの下限(px)。振り仮名・送り仮名・返り点は 24px のままなので、これより小さいと
33
+ // 返り点が隣の列の送り仮名に 4px より近づく(列の間 1.3 字 = 返り点と送り仮名 2 つ分の 48px + 3px + 4px)
34
+ var FIT_MIN = 42;
35
+ // 高さは要素を FIT_SLACK px まで超えてよい(最後の仮名の字の枠の下の余白。見本の『史記』は size=56 で 4.4px 超えていて、これまでどおりに描く)
36
+ var FIT_SLACK = 6;
37
+ // 二桁の番号を横に縮めてよい割合の下限(これより狭い箱では字の大きさを下げる)
38
+ var NUM_SQ = 0.75;
39
+ function okSquash(n, F, fit){
40
+ if (!(fit < 0.999) || !n) return "";
41
+ var ls = Math.max(-OK_TRACK * F, (fit - 1) * F), sy = fit * F / (F + ls);
42
+ return ";letter-spacing:" + ls.toFixed(2) + "px" + (sy < 0.999 ? ";transform:scaleY(" + sy.toFixed(3) + ");transform-origin:50% 0" : "");
43
+ }
44
+ return class extends base.MotionElement {
45
+ static partName = "kanbun"; // the registry name (define meta name), for report prefixes
46
+ // データの形(kit/shape.js):JSON ではなく、要素の中に 1 行 1 句の字(送り仮名 (…)・返り点 […])
47
+ static shape = {text: true, example: "学(ビテ)而{-}時(ニ)習(フ)[レ]之(ヲ)"};
48
+ static props = {
49
+ size: {type: "number", default: 60, doc: "漢字の大きさ(px)。送り仮名・返り点はその 0.42 倍(24px より小さくしない)"},
50
+ slot: {type: "number", default: 0.55, doc: "読む順で 1 字にかける秒数"},
51
+ phases: {type: "string", default: "kunten order kaki", doc: "ステップの並び(kunten 訓点・order 読む順・kaki 書き下し文から選ぶ)"},
52
+ kaki: {type: "number", default: 36, doc: "書き下し文の字の大きさ(px)"},
53
+ nums: {type: "bool", default: true, doc: "読む順の番号を字の左上に出す"},
54
+ "order-by": {type: "string", default: "col", doc: "読む順のステップの分け方:col は列(句)ごとに 1 ステップ、all は読む順の全体で 1 ステップ(v1.3.0 まで)"},
55
+ };
56
+ get phaseList(){
57
+ var a = String(this.props.phases || "").split(/[\s,]+/).filter(function(x){ return PH.indexOf(x) >= 0; });
58
+ return a.length ? a : PH.slice();
59
+ }
60
+ // 読み取りと読む順(段階の数を決めるので mount の前にも読む)。groups:読む順の段階ごとの字の事柄の範囲(stepGroups)
61
+ get kd(){
62
+ if (!this._kd){
63
+ var p = parse(this._src !== undefined ? this._src : this.textContent), o = order(p.chars), ce = charEvents(o);
64
+ this._kd = {p: p, o: o, ce: ce, groups: stepGroups(p.chars, ce, this.props["order-by"])};
65
+ }
66
+ return this._kd;
67
+ }
68
+ // 段階の並び:phases の各段階。order は groups の数だけ({name, g})
69
+ get stepList(){
70
+ var G = this.kd.groups;
71
+ return this.phaseList.reduce(function(a, name){ return a.concat(name === "order" ? G.map(function(g){ return {name: name, g: g}; }) : [{name: name}]); }, []);
72
+ }
73
+ get steps(){ return this.getAttribute("steps") !== null ? +this.getAttribute("steps") : this.stepList.length; }
74
+ // 段階 name の(最初の)番号(1 から)。phases になければ 0
75
+ phaseStep(name){ var L = this.stepList; for (var i = 0; i < L.length; i++) if (L[i].name === name) return i + 1; return 0; }
76
+ mount(ctx){
77
+ var self = this, P = this.props;
78
+ this._src = this.textContent;
79
+ var kd = this.kd, p = kd.p, o = kd.o, kaki = kakikudashi(p.chars, o);
80
+ p.warnings.concat(o.warnings).forEach(function(w){ ctx.report("data", "[kanbun] " + w); });
81
+ this.k = {p: p, o: o, ce: kd.ce, kaki: kaki, groups: kd.groups};
82
+ this.textContent = "";
83
+ this.classList.add("plot", "kanbun");
84
+ this.style.display = "block"; this.style.position = "relative";
85
+ this.setAttribute("role", "img");
86
+ // 読み上げの名前:最後の形(白文と、kaki の段階があれば書き下し文)。作者の aria-label があればそれを使う(上書きしない)
87
+ if (this._aria === undefined) this._aria = this.getAttribute("aria-label");
88
+ if (!this._aria) this.setAttribute("aria-label", "漢文:" + p.chars.map(function(c){ return c.ch; }).join("") + (this.phaseList.indexOf("kaki") >= 0 ? "。書き下し文:" + kaki.map(plain).join("") : ""));
89
+ // ---- 配置:列は右から左へ。列の中は 左の欄(返り点・再読の左の送り仮名)・漢字・右の欄(振り仮名・送り仮名)
90
+ // lay(S):字の大きさ S で並べる(字の位置を p.chars に書き、寸法を返す)。B は字の下端(振り仮名・送り仮名・返り点・句読点を含む)
91
+ var S, F, L, R, G, PITCH, cols, H, XR;
92
+ var lay = function(S0){
93
+ S = S0; F = Math.max(24, Math.round(S * 0.42));
94
+ L = Math.round(S * 0.5); R = Math.round(S * 0.5); G = Math.round(S * 0.3); PITCH = L + S + R + G;
95
+ cols = []; H = 0;
96
+ p.chars.forEach(function(c, n){
97
+ var col = cols[c.col] = cols[c.col] || {y: 0, rEnd: 0, lEnd: 0, list: [], prevOk: null};
98
+ // 前の字の右と左の欄の終わりにぶつからないところまで下げる
99
+ var rStart = c.ruby ? 0 : S * 0.52, lStart = S * 0.5;
100
+ // 番号(左上)を出すときは、前の字の左の欄(一レ点・再読文字の左の送り仮名)の下から始める
101
+ var y = Math.max(col.y, col.lEnd - (P.nums ? 0 : lStart) + 2);
102
+ // 右の欄:前の字の送り仮名は、この字を下げずに収まるように詰める(印刷の組み方:字間を詰め、それでも長ければ縦に縮める。
103
+ // 字の大きさは変えない)。この字に振り仮名も送り仮名もなければ、この字の右の欄の 0.8 まではみ出してよい。
104
+ // 振り仮名は前の字の送り仮名から少し離す(続けて読まないように)。縮めきっても入らないときだけ下げる
105
+ var pk = col.prevOk;
106
+ if (pk){
107
+ // 次の字の送り仮名は下で OK_DELAY まで下げうるので、ここではそれを見込む(足りなければ下で後ろの字をまとめて下げる)
108
+ var room = c.ruby ? -10 : c.okuri ? rStart - GAP_OK + S * OK_DELAY : S * 0.8;
109
+ var need = pk.len * OK_MIN;
110
+ y = Math.max(y, pk.top + need - room);
111
+ pk.c.okFit = Math.min(1, (y + room - pk.top) / pk.len);
112
+ } else y = Math.max(y, col.rEnd - rStart + (c.ruby ? 10 : 6));
113
+ c.y = y; c.n = n;
114
+ var rr = y + (c.ruby ? 0 : S * 0.52);
115
+ if (c.ruby){ c.rubyY = y + Math.max(0, (S * 0.52 - Array.from(c.ruby).length * F) / 2); rr = Math.max(y + S * 0.52, c.rubyY + Array.from(c.ruby).length * F); }
116
+ c.okY = rr; c.okFit = 1;
117
+ var okLen = Array.from(c.okuri).length * F;
118
+ col.rEnd = rr + okLen; col.prevOk = okLen ? {c: c, top: rr, len: okLen} : null;
119
+ var ll = y + S * 0.5, leftKana = c.second ? (c.second.match(/[ァ-ヶー]/g) || []).join("") : "";
120
+ c.leftKana = leftKana; c.lkY = ll; ll += Array.from(leftKana).length * F;
121
+ // 返り点は左下:字の下端をまたぐところ(天を字の 0.72 の高さに)
122
+ c.kaeriY = Math.max(ll, y + S * 0.72); c.kaeriN = (c.mark ? 1 : 0) + (c.re ? 1 : 0);
123
+ col.lEnd = c.kaeriN ? c.kaeriY + c.kaeriN * F * 0.92 : ll;
124
+ col.y = y + S * 1.2 + (c.punct ? S * 0.42 : 0) + (c.join ? S * 0.22 : 0);
125
+ col.list.push(n);
126
+ H = Math.max(H, col.y, col.rEnd, col.lEnd);
127
+ });
128
+ // 右の欄の送り仮名を列ごとに置き直す(字の位置は上で決まったまま)。送り仮名は字の下半分から始め、長ければ詰める。
129
+ // 次の字の送り仮名がその次の字までに楽に収まるなら、次の字の送り仮名を字の 0.36(OK_DELAY)まで下げて、前の長い送り仮名に場所を譲る
130
+ var okLen = function(c){ return Array.from(c.okuri).length * F; };
131
+ cols.forEach(function(col){
132
+ var L2 = col.list.map(function(n){ return p.chars[n]; }), prevEnd = -Infinity;
133
+ // 字 i の送り仮名の終わりの上限(次の字の振り仮名・送り仮名・字そのもの)。delay:次の字の送り仮名を下げる量
134
+ var limitOf = function(i, delay){
135
+ var d = L2[i + 1];
136
+ if (!d) return Infinity;
137
+ return d.ruby ? d.rubyY - 10 : d.okuri ? d.okY + delay - GAP_OK : d.y + S * 0.8;
138
+ };
139
+ L2.forEach(function(c, i){
140
+ if (!c.okuri) return;
141
+ var top = Math.max(c.okY, prevEnd + GAP_OK), len = okLen(c), d = L2[i + 1], delay = 0;
142
+ if (d && d.okuri && !d.ruby){
143
+ var slack = limitOf(i + 1, 0) - (d.okY + okLen(d));
144
+ delay = Math.max(0, Math.min(S * OK_DELAY, slack, top + len + GAP_OK - d.okY));
145
+ }
146
+ var lim = limitOf(i, delay);
147
+ // 縮めきっても入らなければ、この列の後ろの字をまとめて下げる(字どうしの間は変えない)
148
+ var short = top + len * OK_MIN - lim;
149
+ if (short > 0) L2.slice(i + 1).forEach(function(e){
150
+ e.y += short; e.okY += short; e.lkY += short; e.kaeriY += short; if (e.ruby) e.rubyY += short;
151
+ H = Math.max(H, e.y + S * 1.2 + (e.punct ? S * 0.42 : 0), e.kaeriY + e.kaeriN * F * 0.92, e.lkY + Array.from(e.leftKana).length * F);
152
+ });
153
+ if (short > 0) lim += short;
154
+ c.okY = top; c.okFit = Math.max(OK_MIN, Math.min(1, (lim - top) / len));
155
+ prevEnd = top + len * c.okFit;
156
+ H = Math.max(H, prevEnd);
157
+ });
158
+ });
159
+ var B = 0;
160
+ p.chars.forEach(function(c){
161
+ B = Math.max(B, c.y + S, c.okY + Array.from(c.okuri).length * F * c.okFit, c.lkY + Array.from(c.leftKana).length * F);
162
+ if (c.ruby) B = Math.max(B, c.rubyY + Array.from(c.ruby).length * F);
163
+ if (c.kaeriN) B = Math.max(B, c.kaeriY + (c.kaeriN - 1) * F * 0.92 + F);
164
+ if (c.punct) B = Math.max(B, c.y + S * 1.02 + Math.round(S * 0.6));
165
+ if (c.join) B = Math.max(B, c.y + S * 1.06 + Math.round(S * 0.24));
166
+ });
167
+ // 幅:列と、書き下し文との間。字が小さいと右端の列の送り仮名(24px)が右の欄(字の 0.5)からはみ出すので、その分(XR)も
168
+ XR = Math.max(0, F + 1 - R);
169
+ return {S: S, B: B, W: cols.length * PITCH - G + Math.round(S * 0.9) + XR};
170
+ };
171
+ // 要素の高さと幅に収める:字の大きさ size で収まらなければ、字の大きさと字の送りを一緒に 1px ずつ下げる(FIT_MIN まで)。
172
+ // 収まるときは size のまま(配置は今までと同じ)。幅は列と書き下し文(字の大きさによらない)の合計
173
+ var KS = P.kaki, avH = this.clientHeight, HA0 = Math.max(KS * 4, avH), W = this.clientWidth || 1184;
174
+ var kakiW = function(HA){
175
+ var perCol = Math.max(1, Math.floor(HA / KS));
176
+ return kaki.reduce(function(a, line){ return a + Math.max(1, Math.ceil(Array.from(plain(line)).length / perCol)); }, 0) * KS * 1.9;
177
+ };
178
+ var over = function(g){ return {h: avH ? g.B - FIT_SLACK - avH : 0, w: g.W + kakiW(avH ? HA0 : Math.max(KS * 4, H)) - W}; };
179
+ var g = lay(P.size), o2 = over(g);
180
+ while ((o2.h > 0.5 || o2.w > 0.5) && S > FIT_MIN){ g = lay(Math.max(FIT_MIN, Math.ceil(S) - 1)); o2 = over(g); }
181
+ if (o2.h > 0.5 || o2.w > 0.5){
182
+ var at = S < P.size ? "字を size=" + S + " まで小さくしても" : "size=" + S + " では";
183
+ if (o2.h > 0.5) ctx.report("size", "[kanbun] " + at + "要素の高さ " + avH + "px に " + Math.ceil(g.B - avH) + "px 足りない(いちばん長い列 " + Math.ceil(g.B) + "px)。" +
184
+ "高さを " + Math.ceil(g.B) + "px 以上にするか、1 行の字を減らす(長い文は句読点のところで行を分ける)");
185
+ if (o2.w > 0.5) ctx.report("size", "[kanbun] " + at + "要素の幅 " + W + "px に " + Math.ceil(o2.w) + "px 足りない(" + cols.length + " 列と書き下し文)。" +
186
+ "詩を分けて 2 枚にする(1 枚に 2 句など)");
187
+ }
188
+ var nc = cols.length, WK = nc * PITCH - G;
189
+ // 書き下し文:部品の高さで折り返す。列の数は字数から見積もる(振り仮名は数えない)
190
+ var HA = Math.max(KS * 4, avH || H), KW = kakiW(HA), GAP = Math.round(S * 0.9);
191
+ var X0 = Math.max(0, Math.round((W - (WK + GAP + KW + XR)) / 2));
192
+ this.geom = {S: S, F: F, L: L, PITCH: PITCH, WK: WK, H: H};
193
+ var box = function(tag, cls, css, parent, text){
194
+ var e = document.createElement(tag); e.className = cls; e.style.cssText = css; if (text !== undefined) e.textContent = text; (parent || self).appendChild(e); return e;
195
+ };
196
+ var kb = box("div", "kb", "position:absolute;top:0;left:" + (X0 + KW + GAP) + "px;width:" + WK + "px;height:" + Math.ceil(H) + "px;font-family:var(--font-mincho);color:var(--fg)");
197
+ kb.setAttribute("aria-hidden", "true"); // 読み上げは要素の aria-label(role="img")。中の字・番号・弧は読まない
198
+ // 列 c の左端(kb の中の x)
199
+ var colLeft = function(c){ return WK - (c + 1) * PITCH + G; };
200
+ this.cells = p.chars.map(function(c){
201
+ var x = colLeft(c.col) + L, e = {c: c, x: x, y: c.y};
202
+ e.bg = box("div", "kb-bg", "position:absolute;left:" + (x - 3) + "px;top:" + (c.y - 3) + "px;width:" + (S + 6) + "px;height:" + (S + 6) + "px;border-radius:6px;background:var(--term-tint);opacity:0", kb);
203
+ e.ch = box("span", "kb-ch", "position:absolute;left:" + x + "px;top:" + c.y + "px;width:" + S + "px;height:" + S + "px;font-size:" + S + "px;line-height:" + S + "px;text-align:center", kb, c.ch);
204
+ var vt = "writing-mode:vertical-rl;text-orientation:upright;position:absolute;font-size:" + F + "px;line-height:" + F + "px;white-space:nowrap;opacity:0;";
205
+ e.ann = [];
206
+ // 右の欄:振り仮名(上)と送り仮名(下半分から)。左の欄:再読文字の二度目の片仮名、その下に返り点
207
+ if (c.ruby) e.ann.push(box("span", "kb-ruby", vt + "left:" + (x + S + 1) + "px;top:" + c.rubyY + "px;color:var(--muted)", kb, c.ruby));
208
+ if (c.okuri) e.ann.push(box("span", "kb-ok", vt + "left:" + (x + S + 1) + "px;top:" + c.okY + "px;color:var(--term)" + okSquash(Array.from(c.okuri).length, F, c.okFit), kb, c.okuri));
209
+ if (c.leftKana) e.ann.push(box("span", "kb-ok kb-left", vt + "left:" + (x - F - 1) + "px;top:" + c.lkY + "px;color:var(--term)", kb, c.leftKana));
210
+ e.kaeri = [];
211
+ var ky = c.kaeriY, kx = x - F - 2;
212
+ var mk = function(s){ var k = box("span", "kb-kaeri", "position:absolute;left:" + kx + "px;top:" + ky + "px;width:" + F + "px;font-size:" + F + "px;line-height:" + F + "px;text-align:center;color:var(--emph);font-weight:700;opacity:0", kb, s); e.kaeri.push(k); ky += F * 0.92; };
213
+ if (c.mark) mk(c.mark);
214
+ if (c.re) mk("レ");
215
+ if (c.punct) e.punct = box("span", "kb-punct", "writing-mode:vertical-rl;position:absolute;left:" + (x + S * 0.2) + "px;top:" + (c.y + S * 1.02) + "px;font-size:" + Math.round(S * 0.6) + "px;line-height:" + Math.round(S * 0.6) + "px;opacity:0", kb, c.punct);
216
+ if (c.join) e.join = box("span", "kb-join", "position:absolute;left:" + (x + S / 2 - 1.5) + "px;top:" + (c.y + S * 1.06) + "px;width:3px;height:" + Math.round(S * 0.24) + "px;background:var(--fg);opacity:0", kb);
217
+ e.nums = [];
218
+ return e;
219
+ });
220
+ // 読む順:字ごとの番号(左上。再読文字の二度目は右上、振り仮名があれば左上の番号の上)
221
+ var ce = this.k.ce, NF = Math.max(24, Math.round(S * 0.4));
222
+ ce.forEach(function(ev, m){
223
+ var e = self.cells[ev.c], second = ev.kind === "second" && e.c.second !== null;
224
+ // 右上の番号は、字が小さいとき(要素に収めたとき)に送り仮名と重ならないよう、送り仮名の上に上げる
225
+ var nx = second && !e.c.ruby ? e.x + S + 1 : e.x - L, ny = second && e.c.ruby ? e.y - NF : second && e.c.okuri ? Math.min(e.y + 3, e.c.okY - NF - 1) : e.y + 3;
226
+ // 二桁以上は箱(幅 L)に収める。まず字の大きさ NF のまま横だけを縮める(数字 1 つの幅を 0.7em と見た幅 NW の箱を scaleX で幅 L に。
227
+ // 縮める割合は NUM_SQ まで。送り仮名を詰めるのと同じ組み方)。それでも入らなければ字の大きさを下げる(数字 1 つを 0.75em と見て 2 px の余白)。一桁は従来のまま
228
+ var nd = String(m + 1).length, NW = Math.ceil(nd * 0.7 * NF) + 2, sq = nd > 1 && L / NW >= NUM_SQ && L < NW;
229
+ var NS = nd > 1 && !sq ? Math.floor(Math.min(NF, (L - 2) / (nd * 0.75)) * 2) / 2 : NF;
230
+ var nb = box("span", "kb-num", "position:absolute;left:" + (sq ? nx - (NW - L) / 2 : nx) + "px;top:" + ny + "px;width:" + (sq ? NW : L) + "px;font-family:var(--font-sans);font-size:" + NS + "px;line-height:" + NF + "px;text-align:center;font-weight:700;color:var(--emph);font-variant-numeric:tabular-nums;opacity:0" +
231
+ (sq ? ";transform:scaleX(" + (L / NW).toFixed(6) + ");transform-origin:50% 0" : ""), kb, String(m + 1));
232
+ // 字の脇に添える小さい注記の印(Egatari Studio の品質チェックが字の大きさの最小を見ない。docs/contract.md §10)
233
+ nb.setAttribute("data-annot", "");
234
+ e.nums.push(nb); ev.num = nb;
235
+ });
236
+ // 目(今読んでいる字の枠)と、上へ戻るところの弧
237
+ this.eye = box("div", "kb-eye", "position:absolute;left:0;top:0;width:" + (S + 10) + "px;height:" + (S + 10) + "px;border:3px solid var(--emph);border-radius:9px;opacity:0", kb);
238
+ var svg = D.el("svg", {width: WK, height: Math.ceil(H), viewBox: "0 0 " + WK + " " + Math.ceil(H), style: "position:absolute;left:0;top:0;overflow:visible;pointer-events:none"}, kb);
239
+ this.jumps = [];
240
+ ce.forEach(function(ev, m){
241
+ if (m === 0) return;
242
+ var a = self.cells[ce[m - 1].c], b = self.cells[ev.c];
243
+ // 同じ列の上の字へ戻るとき(または右の列へ戻るとき)に弧を描く
244
+ var back = a.c.col === b.c.col ? b.c.n < a.c.n : b.c.col < a.c.col;
245
+ if (!back) return;
246
+ // 弧は左の欄(返り点・番号)の外を通す(2 次曲線の頂点は制御点までの半分)
247
+ var x0 = a.x - 4, y0 = a.y + S / 2, x1 = b.x - 4, y1 = b.y + S / 2, cx = Math.min(x0, x1) - S * 1.3;
248
+ if (a.c.col !== b.c.col){ x0 = a.x + S / 2; y0 = a.y - 4; x1 = b.x + S / 2; y1 = b.y - 4; cx = (x0 + x1) / 2; }
249
+ var cy = a.c.col !== b.c.col ? Math.min(y0, y1) - S * 0.8 : (y0 + y1) / 2;
250
+ var d = "M" + x0.toFixed(1) + "," + y0.toFixed(1) + "Q" + cx.toFixed(1) + "," + cy.toFixed(1) + " " + x1.toFixed(1) + "," + y1.toFixed(1);
251
+ var g = D.el("g", {opacity: 0}, svg);
252
+ var path = D.el("path", {d: d, fill: "none", stroke: "var(--emph)", "stroke-width": 3, "stroke-linecap": "round", pathLength: 1, "stroke-dasharray": 1, "stroke-dashoffset": 1}, g);
253
+ // 矢じり:終わりの点での向き(2 次曲線の終わりの接線は制御点 → 終点)
254
+ var ang = Math.atan2(y1 - cy, x1 - cx) * 180 / Math.PI;
255
+ var head = D.el("path", {d: "M0,0L-13,-6L-13,6Z", fill: "var(--emph)", transform: "translate(" + x1.toFixed(1) + " " + y1.toFixed(1) + ") rotate(" + ang.toFixed(1) + ")", opacity: 0}, g);
256
+ self.jumps.push({m: m, g: g, path: path, head: head});
257
+ });
258
+ // 書き下し文(縦書き、左に)
259
+ var kk = box("div", "kb-kaki", "position:absolute;top:0;left:" + X0 + "px;width:" + Math.ceil(KW) + "px;height:" + Math.ceil(HA) + "px;writing-mode:vertical-rl;font-family:var(--font-mincho);font-size:" + KS + "px;line-height:1.9;color:var(--fg);line-break:strict");
260
+ kk.setAttribute("aria-hidden", "true");
261
+ this.kakiLines = kaki.map(function(line){
262
+ var d = box("div", "kb-kaki-line", "opacity:0", kk);
263
+ line.forEach(function(s){
264
+ if (s.rb){ var r = document.createElement("ruby"); r.textContent = s.t; var rt = document.createElement("rt"); rt.textContent = s.rb; r.appendChild(rt); d.appendChild(r); }
265
+ else d.appendChild(document.createTextNode(s.t));
266
+ });
267
+ return d;
268
+ });
269
+ }
270
+ duration(k){
271
+ var st = this.stepList[k - 1], name = st && st.name;
272
+ if (name === "kunten") return 0.9;
273
+ if (name === "order") return (st.g.b - st.g.a) * this.props.slot + 0.3;
274
+ if (name === "kaki") return (this.kakiLines ? this.kakiLines.length : 1) * 0.3 + 0.45;
275
+ return 0;
276
+ }
277
+ // 読む順の段階:その段階の中で列が変わる字(order-by="all" では 2 列目からの各列の読み始め)の時刻。
278
+ // order-by="col" では列が変わるところで段階が分かれるので、段階の中に合図はない
279
+ cues(k){
280
+ var st = this.stepList[k - 1];
281
+ if (!st || st.name !== "order") return null;
282
+ var ce = this.kd.ce, ch = this.kd.p.chars, slot = this.props.slot, a = st.g.a, out = [];
283
+ for (var m = a + 1; m < st.g.b; m++) if (ch[ce[m].c].col !== ch[ce[m - 1].c].col) out.push(+((m - a) * slot).toFixed(4));
284
+ return out.length ? out : null;
285
+ }
286
+ render(k, t, ctx){
287
+ var self = this, S = this.geom.S, slot = this.props.slot;
288
+ // 先の段階を薄く見せる表示(授業の表示):後の段階の訓点・読む順の番号と弧・書き下し文を、最後の形のまま --preview-opacity の濃さで
289
+ var preview = !!ctx.preview, PV = preview ? base.previewOpacity(this) : 0.45;
290
+ // 段階 name の進み:まだなら -1、済んだら Infinity、今なら t。phases になければ、訓点は初めから済み、ほかは来ない
291
+ var at = function(name){ var s = self.phaseStep(name); if (!s) return name === "kunten" ? Infinity : -1; return k > s ? Infinity : k < s ? -1 : t; };
292
+ var pr = function(tt, a, d){ return tt < 0 ? 0 : D.prog(tt, a, d); };
293
+ var tk = at("kunten"), tw = at("kaki");
294
+ // 読む順の段階は groups の数だけ続く(first から last)。今の段階の範囲 [a, a + len) と、その中の時刻 to
295
+ var first = this.phaseStep("order"), G = this.k.groups, last = first ? first + G.length - 1 : 0;
296
+ var started = first > 0 && k >= first, done = started && k > last, a = 0, len = 0, to = -1;
297
+ if (started && !done){ a = G[k - first].a; len = G[k - first].b - a; to = t; }
298
+ var eK = pr(tk, 0, 0.4), eO = pr(tk, 0.3, 0.45), eP = pr(tk, 0.45, 0.3);
299
+ if (preview && tk < 0) eK = eO = eP = PV;
300
+ this.cells.forEach(function(e){
301
+ e.kaeri.forEach(function(x){ x.style.opacity = eK.toFixed(3); });
302
+ e.ann.forEach(function(x){ x.style.opacity = eO.toFixed(3); });
303
+ if (e.punct) e.punct.style.opacity = eP.toFixed(3);
304
+ if (e.join) e.join.style.opacity = eK.toFixed(3);
305
+ e.bg.style.opacity = 0;
306
+ // 置き字は読む順の段階から薄くする(読まない字)
307
+ e.ch.style.color = e.c.oki && started ? "var(--muted)" : "";
308
+ });
309
+ // 読む順:事柄 m は m * slot 秒に始まる。今の事柄 j
310
+ // 段階の終わりの 0.3 秒(tail)で、今の字の印(目の枠・朱の字)を消し、弧を読み終えた濃さにする:段階の長さの時点で最後の状態と同じ
311
+ var ce = this.k.ce, n = ce.length, j = -1, tail = done ? 1 : to >= 0 ? pr(to - len * slot, 0, 0.25) : 0;
312
+ if (done) j = n;
313
+ else if (to >= 0) j = a + Math.max(0, Math.min(len - 1, Math.floor(to / slot)));
314
+ // 事柄 m の始まりからの時刻
315
+ var lt = function(m){ return to - (m - a) * slot; };
316
+ // 番号と弧は書き下し文が出ても残す(最後の形は印刷にも台本の小さい絵にも出る。読む順はこの部品が教える中身)
317
+ var seen = {};
318
+ ce.forEach(function(ev, m){
319
+ var e = self.cells[ev.c], v = m < j ? 1 : m === j ? pr(lt(m), 0.12 * slot, 0.3 * slot) : 0;
320
+ if (v > 0) seen[ev.c] = Math.max(seen[ev.c] || 0, v);
321
+ // 後の段階の事柄(読む順の段階の前、または今の段階より後)
322
+ var later = preview && first > 0 && (!started || (!done && m >= a + len));
323
+ ev.num.style.opacity = self.props.nums ? (later ? PV : v).toFixed(3) : 0;
324
+ });
325
+ Object.keys(seen).forEach(function(c){ self.cells[c].bg.style.opacity = (seen[c] * 0.9).toFixed(3); });
326
+ this.jumps.forEach(function(J){
327
+ if (preview && first > 0 && (!started || (!done && J.m >= a + len))){
328
+ // 後の段階の弧:引き終えた形を、読み終えた弧の濃さ(0.55)のまま薄く
329
+ J.path.setAttribute("stroke-dashoffset", "0.0000"); J.head.setAttribute("opacity", 1); J.g.setAttribute("opacity", (0.55 * PV).toFixed(3));
330
+ return;
331
+ }
332
+ var d = J.m < j ? 1 : J.m === j ? pr(lt(J.m), 0, 0.35 * slot) : 0;
333
+ J.path.setAttribute("stroke-dashoffset", (1 - d).toFixed(4));
334
+ J.head.setAttribute("opacity", d >= 0.98 ? 1 : 0);
335
+ J.g.setAttribute("opacity", d <= 0 ? 0 : (J.m === j && !done ? 1 - 0.45 * tail : 0.55).toFixed(3));
336
+ });
337
+ // 目:前の字から今の字へ 0.35 slot で動く。読み終えたら消える
338
+ if (j >= 0 && j < n && !done && tail < 1){
339
+ var cur = this.cells[ce[j].c], prev = j > 0 ? this.cells[ce[j - 1].c] : cur;
340
+ // 同じ列の中では滑らせ、列が変わるとき(次の句へ)は今の字で現れる
341
+ var e2 = pr(lt(j), 0, 0.35 * slot), hop = prev.c.col !== cur.c.col;
342
+ var x = hop ? cur.x : D.lerp(prev.x, cur.x, e2), y = hop ? cur.y : D.lerp(prev.y, cur.y, e2);
343
+ this.eye.style.left = (x - 8).toFixed(2) + "px"; this.eye.style.top = (y - 8).toFixed(2) + "px";
344
+ this.eye.style.opacity = ((j === 0 ? pr(to, 0, 0.15) : hop ? e2 : 1) * (1 - tail)).toFixed(3);
345
+ cur.ch.style.color = tail > 0 ? "color-mix(in srgb, var(--emph) " + (100 * (1 - tail)).toFixed(1) + "%, var(--fg))" : "var(--emph)";
346
+ } else this.eye.style.opacity = 0;
347
+ // 書き下し文:行ごとに 0.3 秒ずつ遅らせて出す
348
+ this.kakiLines.forEach(function(d, L){ d.style.opacity = (preview && tw < 0 && self.phaseStep("kaki") ? PV : pr(tw, L * 0.3, 0.45)).toFixed(3); });
349
+ }
350
+ };
351
+ });