egatari 0.6.11 → 0.6.12-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/bin/egatari.mjs +4 -3
- package/components.lock.json +30 -15
- package/components2.lock.json +201 -1
- package/fonts/@fontsource/fraunces/400.css +29 -0
- package/fonts/@fontsource/fraunces/700.css +29 -0
- package/fonts/@fontsource/fraunces/LICENSE +93 -0
- package/fonts/@fontsource/fraunces/files/fraunces-latin-400-normal.woff2 +0 -0
- package/fonts/@fontsource/fraunces/files/fraunces-latin-700-normal.woff2 +0 -0
- package/fonts/@fontsource/fraunces/files/fraunces-latin-ext-400-normal.woff2 +0 -0
- package/fonts/@fontsource/fraunces/files/fraunces-latin-ext-700-normal.woff2 +0 -0
- package/fonts/@fontsource/fraunces/files/fraunces-vietnamese-400-normal.woff2 +0 -0
- package/fonts/@fontsource/fraunces/files/fraunces-vietnamese-700-normal.woff2 +0 -0
- package/fonts/@fontsource/fraunces/package.json +6 -0
- package/kit/check-messages.mjs +18 -7
- package/kit/check.mjs +12 -4
- package/kit/core/article-render.mjs +5 -5
- package/kit/core/build-core.mjs +25 -9
- package/kit/core/check-parity.mjs +1 -1
- package/kit/core/check-rules.mjs +2 -2
- package/kit/core/check-source.mjs +3 -0
- package/kit/core/colab-core.mjs +1 -1
- package/kit/core/kicker.mjs +42 -0
- package/kit/core/layout-scan.mjs +19 -7
- package/kit/core/llm-pack-data.mjs +8 -8
- package/kit/core/llm-pack.mjs +2 -2
- package/kit/core/theme-shapes.mjs +3 -1
- package/kit/core/themes-list.mjs +2 -0
- package/kit/instruction-version.json +1 -1
- package/kit/layouts.css +8 -0
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/package.json +2 -1
- package/themes/asagi/theme.json +1 -1
- package/themes/asagi/tokens.css +6 -0
- package/themes/bengara/theme.json +13 -0
- package/themes/bengara/tokens.css +66 -0
- package/themes/business/theme.json +1 -1
- package/themes/business/tokens.css +6 -0
- package/themes/default/theme.json +1 -1
- package/themes/default/tokens.css +9 -0
- package/themes/kogecha/theme.json +1 -1
- package/themes/kogecha/tokens.css +6 -0
- package/themes/kokugo/theme.json +1 -1
- package/themes/kokugo/tokens.css +6 -0
- package/themes/murasaki/theme.json +1 -1
- package/themes/murasaki/tokens.css +6 -0
- package/themes/sumi/theme.json +1 -1
- package/themes/sumi/tokens.css +8 -0
- package/themes/tokiwa/theme.json +1 -1
- package/themes/tokiwa/tokens.css +6 -0
- package/themes.lock.json +90 -24
- package/vendor/components/CATALOG.md +11 -11
- package/vendor/components/sha256/04626b77b3c683fd4c8e549339eca153615e021eb0e649c31291deb2dab30667/README.en.md +38 -0
- package/vendor/components/sha256/04626b77b3c683fd4c8e549339eca153615e021eb0e649c31291deb2dab30667/index.js +289 -0
- package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/ABCJS-ADAPTER.md +101 -0
- package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/LICENSE-abcjs.txt +21 -0
- package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/chords.json +89 -0
- package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/doremi.json +261 -0
- package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/extras.json +192 -0
- package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/kaeru.json +521 -0
- package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/rhythm.json +248 -0
- package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/fixtures/ties.json +360 -0
- package/vendor/components/sha256/0c4eb83646ab8027d40697db161eb952425db78c42b36291626214d5064b9498/index.js +508 -0
- package/vendor/components/sha256/0dc2a0945e7a4004278fcc9b8f02223bbb87f6269bffe3dd3ebeb3a78ce23d34/index.js +404 -0
- package/vendor/components/sha256/0e2e45b024bb2f37e82c83a4d9cd9f9c16b5dc4924dde81735c268a3d49f9d7f/index.js +97 -0
- package/vendor/components/sha256/0ef62e33d330f8e31ccb1f480b5e3b349769a142cc2737a9e6583d5eff9f56ca/index.js +919 -0
- package/vendor/components/sha256/1b33a252d51091e2d8cdea176f10268f128640bed3aa46da88d7de31ced59b44/README.en.md +48 -0
- package/vendor/components/sha256/1b33a252d51091e2d8cdea176f10268f128640bed3aa46da88d7de31ced59b44/index.js +384 -0
- package/vendor/components/sha256/1b767b6cf1855156872f87981a7c99f0161013499d6c4b21785624435db92078/README.en.md +34 -0
- package/vendor/components/sha256/1b767b6cf1855156872f87981a7c99f0161013499d6c4b21785624435db92078/index.js +244 -0
- package/vendor/components/sha256/3ace61e46a4555eab46ca8053db2fb76a874d4d5409bc5891cc449f43ef7e0bd/README.en.md +44 -0
- package/vendor/components/sha256/3ace61e46a4555eab46ca8053db2fb76a874d4d5409bc5891cc449f43ef7e0bd/index.js +304 -0
- package/vendor/components/sha256/4079077e03343995edc5e34b8bda0cf200dc6d854a52486fe0a6a4ceaf0d4b6f/README.en.md +44 -0
- package/vendor/components/sha256/4079077e03343995edc5e34b8bda0cf200dc6d854a52486fe0a6a4ceaf0d4b6f/index.js +203 -0
- package/vendor/components/sha256/40aaaaf988e7c32460ffaf5f18b5690ee28fd1fe7e879d8434d58283992bc554/README.en.md +37 -0
- package/vendor/components/sha256/40aaaaf988e7c32460ffaf5f18b5690ee28fd1fe7e879d8434d58283992bc554/index.js +438 -0
- package/vendor/components/sha256/442be174439d106ef462c19d598c407e86d5de3fcd4700ed54ae4147c4b9969c/README.en.md +24 -0
- package/vendor/components/sha256/442be174439d106ef462c19d598c407e86d5de3fcd4700ed54ae4147c4b9969c/index.js +103 -0
- package/vendor/components/sha256/48a776e7683e1aba8cad5aa4067914c017681efaa74f175066e0ab081bf3d013/index.js +351 -0
- package/vendor/components/sha256/4a9331635c2dd28e4b46108eaffe49c6d29cf626ecb900ac6e9029552be0cf49/index.js +607 -0
- package/vendor/components/sha256/5458baef7a30298cf4b0029331f13233d162403e686f9c20085dd2104cad7141/README.en.md +23 -0
- package/vendor/components/sha256/5458baef7a30298cf4b0029331f13233d162403e686f9c20085dd2104cad7141/index.js +120 -0
- package/vendor/components/sha256/586063d3a4e24e2995923811b2b9466bde86dbaafb3bcf103546d3f28159205a/index.js +812 -0
- package/vendor/components/sha256/5acc5f87e29f1170bc35dbee08087d0d03c1023969c6c1b1367a0f559d60e5ee/index.js +198 -0
- package/vendor/components/sha256/5c032594230fe688f661b6ccf27070c84f8c0e38611186280fb9c56d89ac3319/README.en.md +32 -0
- package/vendor/components/sha256/5c032594230fe688f661b6ccf27070c84f8c0e38611186280fb9c56d89ac3319/index.js +222 -0
- package/vendor/components/sha256/603de10f0ee50d07ec610e21b45b9db78d69376b4dfd2baba78595c1002e27ec/README.en.md +50 -0
- package/vendor/components/sha256/603de10f0ee50d07ec610e21b45b9db78d69376b4dfd2baba78595c1002e27ec/index.js +171 -0
- package/vendor/components/sha256/609e45a826d07a54cbbcbf4ce2ad6b5474dca1d0be394eb9fad895db4a73422f/README.en.md +51 -0
- package/vendor/components/sha256/609e45a826d07a54cbbcbf4ce2ad6b5474dca1d0be394eb9fad895db4a73422f/index.js +228 -0
- package/vendor/components/sha256/6364043cb31bbd86aacb7432af1a8affef8cae5c6efdbe13fbebd116fd51b91f/index.js +233 -0
- package/vendor/components/sha256/6f9f7283226d3534aa1cb4a47ba258204aa286ead01b25cdbde14119260bc702/README.en.md +66 -0
- package/vendor/components/sha256/6f9f7283226d3534aa1cb4a47ba258204aa286ead01b25cdbde14119260bc702/index.js +920 -0
- package/vendor/components/sha256/72edfd6678b22be0bb3e32b0d8cb0dfee403767e1eacac354d278d7318d03826/README.en.md +35 -0
- package/vendor/components/sha256/72edfd6678b22be0bb3e32b0d8cb0dfee403767e1eacac354d278d7318d03826/index.js +179 -0
- package/vendor/components/sha256/7482c50bea5ef7d72dc5d4afaddb8c4e725b5a83fa0c6175f9a9c556f23a4e10/LICENSE-tabler.txt +21 -0
- package/vendor/components/sha256/7482c50bea5ef7d72dc5d4afaddb8c4e725b5a83fa0c6175f9a9c556f23a4e10/index.js +4868 -0
- package/vendor/components/sha256/7482c50bea5ef7d72dc5d4afaddb8c4e725b5a83fa0c6175f9a9c556f23a4e10/names.txt +4808 -0
- package/vendor/components/sha256/7cb8948c550b66bf4b34a62e7b61385aaa79896e09d82ccb1846c0ac499ad352/README.en.md +40 -0
- package/vendor/components/sha256/7cb8948c550b66bf4b34a62e7b61385aaa79896e09d82ccb1846c0ac499ad352/index.js +348 -0
- package/vendor/components/sha256/87cc60da38d209cda449dd7c24171e287ac8184c5036ca04548ef9e2015c2d9e/README.en.md +42 -0
- package/vendor/components/sha256/87cc60da38d209cda449dd7c24171e287ac8184c5036ca04548ef9e2015c2d9e/index.js +268 -0
- package/vendor/components/sha256/8cb367c71c002c689defddc6f075be911d5485421715119b5515181e962a2401/index.js +121 -0
- package/vendor/components/sha256/97bfd6e79c7278c55153bf4c2330da0432cf0ee312baa11650e07cdd7912831d/index.js +354 -0
- package/vendor/components/sha256/a426e6a3f8f4593403ba63ecc4a3f1f41064f4016fd9fb8d51e7876bf8c6f573/README.en.md +40 -0
- package/vendor/components/sha256/a426e6a3f8f4593403ba63ecc4a3f1f41064f4016fd9fb8d51e7876bf8c6f573/index.js +348 -0
- package/vendor/components/sha256/c108119117042cacc65a35ec73fcab95a2a92b2a2797129f66e326783f8db178/index.js +465 -0
- package/vendor/components/sha256/c3fad2047cec6a2bd8a5b907f752e2addeeea2f373fd8115914552dcee0b2f6f/README.en.md +23 -0
- package/vendor/components/sha256/c3fad2047cec6a2bd8a5b907f752e2addeeea2f373fd8115914552dcee0b2f6f/index.js +289 -0
- package/vendor/components/sha256/c59f1ac3132fdf6f56e8880c866570cd7443f09eb8802b6e7af32675ad358edf/README.en.md +31 -0
- package/vendor/components/sha256/c59f1ac3132fdf6f56e8880c866570cd7443f09eb8802b6e7af32675ad358edf/index.js +236 -0
- package/vendor/components/sha256/d3a75f67160490db1831aaa8ac58ebc5f7ffb6a6fd21e2bdeaa6fe979bfaff7f/README.en.md +42 -0
- package/vendor/components/sha256/d3a75f67160490db1831aaa8ac58ebc5f7ffb6a6fd21e2bdeaa6fe979bfaff7f/index.js +488 -0
- package/vendor/components/sha256/d998b5db828427505e39cdae67676dc6480c791d6037152dec222ae81cdbba1f/index.js +484 -0
- package/vendor/components/sha256/ea17602aaecca64b672b3bc827965ff378cb460250177f7b66f73081a48d4e81/index.js +278 -0
- package/vendor/components/sha256/f9cef6dd9580a4f19aa09d47f736ab2391f5f585b20b16a62bd781398cb6b8ac/README.en.md +22 -0
- package/vendor/components/sha256/f9cef6dd9580a4f19aa09d47f736ab2391f5f585b20b16a62bd781398cb6b8ac/index.js +145 -0
- package/vendor/components-2/manifest-2.8.0.json +2199 -0
- package/vendor/themes/asagi/1.2.0/theme.json +14 -0
- package/vendor/themes/asagi/1.2.0/tokens.css +30 -0
- package/vendor/themes/business/1.2.0/theme.json +5 -0
- package/vendor/themes/business/1.2.0/tokens.css +41 -0
- package/vendor/themes/default/1.4.0/theme.json +4 -0
- package/vendor/themes/default/1.4.0/tokens.css +86 -0
- package/vendor/themes/kogecha/1.2.0/theme.json +10 -0
- package/vendor/themes/kogecha/1.2.0/tokens.css +29 -0
- package/vendor/themes/kokugo/1.2.0/theme.json +5 -0
- package/vendor/themes/kokugo/1.2.0/tokens.css +25 -0
- package/vendor/themes/murasaki/1.2.0/theme.json +10 -0
- package/vendor/themes/murasaki/1.2.0/tokens.css +25 -0
- package/vendor/themes/sumi/1.2.0/theme.json +10 -0
- package/vendor/themes/sumi/1.2.0/tokens.css +49 -0
- package/vendor/themes/tokiwa/1.2.0/theme.json +10 -0
- package/vendor/themes/tokiwa/1.2.0/tokens.css +27 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
// m-code: a program, successive line explanations, then its supplied output. Never executes code.
|
|
2
|
+
egatariParts.define({name: "code", version: "2.1.0", requires: {base: "1.2.0"}, element: "m-code"}, function(deps){
|
|
3
|
+
"use strict";
|
|
4
|
+
var base = deps.base, MONO = 'ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace';
|
|
5
|
+
var TEXT = {
|
|
6
|
+
ja: {output: "出力", run: "▶ 実行", readable: "コードと出力", summary: function(lang, n, output){ return (lang || "プログラム") + " のコード " + n + " 行" + (output ? "と出力" : ""); }},
|
|
7
|
+
en: {output: "Output", run: "▶ Run", readable: "Code and output", summary: function(lang, n, output){ return (lang || "Program") + ": " + n + " lines of code" + (output ? " and output" : ""); }}
|
|
8
|
+
};
|
|
9
|
+
function set(e, a, v){ e.setAttribute(a, String(v)); }
|
|
10
|
+
function lines(s){ return s.replace(/\r\n?/g, "\n").split("\n"); }
|
|
11
|
+
function monoWidth(s, fs){ return [...s].reduce(function(w, ch){ return w + (/[\u0000-\u024f]/.test(ch) ? 0.6 : 1); }, 0) * fs; }
|
|
12
|
+
function cut(s, w, fs){
|
|
13
|
+
if (monoWidth(s, fs) <= w) return s;
|
|
14
|
+
var ch = [...s];
|
|
15
|
+
while (ch.length && monoWidth(ch.join("") + "…", fs) > w) ch.pop();
|
|
16
|
+
return w >= fs ? ch.join("") + "…" : "";
|
|
17
|
+
}
|
|
18
|
+
// Colour roles for code: keywords term, strings accent2, comments muted (theme roles only; the text stays readable without colour).
|
|
19
|
+
var KEYWORDS = {
|
|
20
|
+
python: "False None True and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield",
|
|
21
|
+
js: "async await break case catch class const continue default delete do else export extends false finally for function if import in instanceof let new null of return super switch this throw true try typeof undefined var void while yield",
|
|
22
|
+
r: "if else repeat while function for in next break TRUE FALSE NULL Inf NaN NA return",
|
|
23
|
+
shell: "if then else elif fi case esac for while until do done in function return export local"
|
|
24
|
+
};
|
|
25
|
+
function dialect(lang){ return lang === "javascript" ? "js" : lang === "sh" || lang === "bash" ? "shell" : KEYWORDS[lang] ? lang : ""; }
|
|
26
|
+
// Split each line into [start, end, role] spans: strings (also across lines for Python triple quotes / JS templates),
|
|
27
|
+
// line comments outside strings, keywords outside both. Unknown languages give no spans.
|
|
28
|
+
function spans(program, lang){
|
|
29
|
+
var L = dialect(lang), kw = L ? new Set(KEYWORDS[L].split(" ")) : null, quote = "", triple = false;
|
|
30
|
+
return program.map(function(s){
|
|
31
|
+
var out = [], from = quote ? 0 : -1;
|
|
32
|
+
if (!L) return out;
|
|
33
|
+
for (var i = 0; i < s.length; i++){
|
|
34
|
+
var c = s[i];
|
|
35
|
+
if (quote){
|
|
36
|
+
if (c === "\\"){ i++; continue; }
|
|
37
|
+
if (c === quote && (!triple || s.slice(i, i + 3) === quote.repeat(3))){ i += triple ? 2 : 0; out.push([from, i + 1, "accent2"]); quote = ""; triple = false; }
|
|
38
|
+
} else if (c === '"' || c === "'" || L === "js" && c === "`"){
|
|
39
|
+
from = i; quote = c; triple = L === "python" && s.slice(i, i + 3) === c.repeat(3); if (triple) i += 2;
|
|
40
|
+
} else if (L !== "js" && c === "#" && (L !== "shell" || i === 0 || /\s/.test(s[i - 1])) || L === "js" && s.slice(i, i + 2) === "//"){
|
|
41
|
+
out.push([i, s.length, "muted"]); return out;
|
|
42
|
+
} else if (/[A-Za-z_]/.test(c) && (i === 0 || !/[\w.$]/.test(s[i - 1]))){
|
|
43
|
+
var m = /^[A-Za-z_]\w*/.exec(s.slice(i))[0];
|
|
44
|
+
if (kw.has(m)) out.push([i, i + m.length, "term"]);
|
|
45
|
+
i += m.length - 1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (quote){ out.push([from, s.length, "accent2"]); if (!triple && quote !== "`") quote = ""; }
|
|
49
|
+
return out;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Wrap prose on words where possible, falling back to characters for Japanese / long tokens.
|
|
53
|
+
function wrap(s, w, fs, font){
|
|
54
|
+
var out = [];
|
|
55
|
+
lines(s).forEach(function(p){
|
|
56
|
+
var rest = [...p];
|
|
57
|
+
while (rest.length){
|
|
58
|
+
var n = 0;
|
|
59
|
+
while (n < rest.length && base.textWidth(rest.slice(0, n + 1).join(""), fs, {font: font}) <= w) n++;
|
|
60
|
+
n = Math.max(1, n);
|
|
61
|
+
if (n < rest.length){ var space = rest.slice(0, n + 1).lastIndexOf(" "); if (space > 0) n = space; }
|
|
62
|
+
out.push(rest.splice(0, n).join("").trimEnd());
|
|
63
|
+
while (rest[0] === " ") rest.shift();
|
|
64
|
+
}
|
|
65
|
+
if (!p) out.push("");
|
|
66
|
+
});
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
return class extends base.MotionElement {
|
|
70
|
+
static partName = "code";
|
|
71
|
+
static shape = {schema: {type: "object", additionalProperties: false, required: ["code", "steps"], properties: {
|
|
72
|
+
code: {type: "string"}, lang: {type: "string"}, output: {type: "string"},
|
|
73
|
+
steps: {type: "array", items: {type: "object", additionalProperties: false, required: ["lines", "note"], properties: {
|
|
74
|
+
lines: {type: "array", minItems: 1, maxItems: 2, items: {type: ["integer", "array"], minItems: 2, maxItems: 2, items: {type: "integer"}}}, note: {type: "string"}
|
|
75
|
+
}}}
|
|
76
|
+
}}, example: /*@egatari-block example*/{"lang":"python","code":"import pandas as pd\ndf = pd.read_csv(\"sales.csv\")\ndf.groupby(\"store\")[\"sales\"].mean()","steps":[{"lines":[1],"note":"pandas を読み込む"},{"lines":[2],"note":"CSV を表として読む"},{"lines":[3],"note":"店ごとの平均"}],"output":"store\nA 120.5\nB 98.0"}/*@egatari-block-end*/};
|
|
77
|
+
static props = {
|
|
78
|
+
dur: {type: "number", default: 0.6, doc: "ステップの秒数"},
|
|
79
|
+
size: {type: "number", default: 0, doc: "文字 px(0 は既定)"},
|
|
80
|
+
outputPos: {type: "enum", values: ["auto", "below", "right"], default: "auto", doc: "出力の位置"}
|
|
81
|
+
};
|
|
82
|
+
get steps(){ return this.data.steps.length + 1 + (this.data.output !== undefined ? 1 : 0); }
|
|
83
|
+
duration(k){ return k >= 1 && k <= this.steps ? this.props.dur : 0; }
|
|
84
|
+
label(g, x, y, s, fs, color, mono){
|
|
85
|
+
var e = base.el("text", {x: x, y: y, "font-size": fs, fill: color || "var(--fg)"}, g);
|
|
86
|
+
// 等幅と空白:テーマの `svg text{font-family}` は属性より強いので style に書く。行頭の字下げを残す(white-space: pre)
|
|
87
|
+
if (mono){ e.setAttribute("style", (e.getAttribute("style") || "") + "font-family:" + MONO + ";white-space:pre;"); }
|
|
88
|
+
e.textContent = s; return e;
|
|
89
|
+
}
|
|
90
|
+
mount(ctx){
|
|
91
|
+
// [[3, 4]] is read as [3, 4] (one range per step); any other nesting is a range problem below
|
|
92
|
+
var self = this, d = Object.assign({}, this.data, {steps: this.data.steps.map(function(s, j){
|
|
93
|
+
var r = s.lines.length === 1 && Array.isArray(s.lines[0]) ? s.lines[0] : s.lines;
|
|
94
|
+
if (r.some(Array.isArray)){ ctx.report("range", "[code] steps[" + j + "].lines: one range per step, e.g. [3, 4]"); return {lines: [0], note: s.note, nested: true}; }
|
|
95
|
+
return {lines: r, note: s.note};
|
|
96
|
+
})}), P = this.props, T = /^ja\b/i.test(ctx.lang || "") ? TEXT.ja : TEXT.en;
|
|
97
|
+
if (!(Number.isFinite(P.dur) && P.dur > 0)){ ctx.report("attr", "[code] dur must be positive; using 0.6"); P.dur = 0.6; }
|
|
98
|
+
if (!(P.size === 0 || Number.isFinite(P.size) && P.size >= 24)){ ctx.report("attr", "[code] size must be 0 or at least 24; using defaults"); P.size = 0; }
|
|
99
|
+
if (!["auto", "below", "right"].includes(P.outputPos)){ ctx.report("attr", "[code] invalid outputPos; using auto"); P.outputPos = "auto"; }
|
|
100
|
+
// 大きさを測る前にブロックにする(インラインのままだと幅が 0 になる)
|
|
101
|
+
this.style.display = "block"; this.style.position = "relative"; this.style.writingMode = "horizontal-tb";
|
|
102
|
+
this.fs = P.size || 24; this.noteSize = P.size || 26;
|
|
103
|
+
var fs = this.fs, nf = this.noteSize, row = Math.ceil(fs * 1.4), noteRow = Math.ceil(nf * 1.45 + 4);
|
|
104
|
+
var W = Math.max(1, this.clientWidth), H = Math.max(1, this.clientHeight), program = lines(d.code), output = d.output === undefined ? [] : lines(d.output);
|
|
105
|
+
var lang = d.lang || "", marks = spans(program, lang.toLowerCase());
|
|
106
|
+
this.setAttribute("role", "figure"); // 中の読める pre が読まれるように(img の子は読まれない)
|
|
107
|
+
if (!this.getAttribute("aria-label")) this.setAttribute("aria-label", T.summary(lang.toLowerCase() === "python" ? "Python" : lang, program.length, d.output !== undefined) + "; " + d.steps.map(function(s){ return s.note; }).join("; "));
|
|
108
|
+
// Keep the full source readable inside the figure even when the SVG is truncated.
|
|
109
|
+
var pre = document.createElement("pre"); pre.className = "sr-only";
|
|
110
|
+
pre.setAttribute("style", "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:pre;border:0");
|
|
111
|
+
pre.setAttribute("aria-label", T.readable);
|
|
112
|
+
pre.textContent = d.code + (d.output !== undefined ? "\n\n" + T.output + "\n" + d.output : ""); this.appendChild(pre);
|
|
113
|
+
this.svg = base.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, "aria-hidden": "true"}, this);
|
|
114
|
+
var header = row + 16, pad = 16, gap = 32, numW = monoWidth(String(program.length), fs) + 16;
|
|
115
|
+
var expanded = program.map(function(s){ return s.replace(/\t/g, " "); });
|
|
116
|
+
var longest = expanded.reduce(function(a, b){ return monoWidth(a, fs) >= monoWidth(b, fs) ? a : b; }, "");
|
|
117
|
+
var natural = Math.max(160, monoWidth(longest, fs)) + numW + 2 * pad;
|
|
118
|
+
var outNatural = Math.max(monoWidth(T.output, fs) + monoWidth(T.run, fs) + pad + 8, ...output.slice(0, 8).map(function(s){ return monoWidth(s.replace(/\t/g, " "), fs); })) + 2 * pad;
|
|
119
|
+
var outputH = output.length ? header + row * Math.min(8, output.length) + pad : 0;
|
|
120
|
+
var right = output.length > 0 && (P.outputPos === "right" || P.outputPos === "auto" && program.length <= 8 && natural + 280 + outNatural + 2 * gap <= W);
|
|
121
|
+
var outW = right ? Math.max(120, Math.min(outNatural, W * 0.3)) : 0;
|
|
122
|
+
var available = W - (right ? outW + gap : 0), codeW = natural;
|
|
123
|
+
var nx = codeW + gap, nw = Math.max(1, available - nx);
|
|
124
|
+
var areaH = H - (!right && output.length ? outputH + 16 : 0), nextY = header;
|
|
125
|
+
// Keep the beside layout only if *all* the notes fit at their line targets.
|
|
126
|
+
var beside = natural <= W * 0.55 && natural + gap + 260 <= available;
|
|
127
|
+
d.steps.forEach(function(s){
|
|
128
|
+
var a = s.lines[0], b = s.lines.length === 2 ? s.lines[1] : a;
|
|
129
|
+
var target = header + ((a + b - 2) / 2 + 0.5) * row;
|
|
130
|
+
var h = Math.max(1, wrap(s.note, nw - 24, nf, self).length) * noteRow + 16;
|
|
131
|
+
nextY = Math.max(nextY, target - h / 2) + h + 8;
|
|
132
|
+
if (nextY - 8 > areaH) beside = false;
|
|
133
|
+
});
|
|
134
|
+
this.noteLayout = beside ? "beside" : "band";
|
|
135
|
+
if (!beside){
|
|
136
|
+
// 出力は、コードの横に入るなら右に(幅で決める。短い出力なら広いコードの横にも入る)
|
|
137
|
+
right = output.length > 0 && (P.outputPos === "right" || P.outputPos === "auto" && natural + gap + Math.max(120, outNatural) <= W);
|
|
138
|
+
outW = right ? Math.max(120, Math.min(outNatural, W - gap - natural)) : 0;
|
|
139
|
+
available = W - (right ? outW + gap : 0);
|
|
140
|
+
codeW = Math.max(1, Math.min(natural, available));
|
|
141
|
+
nx = 0; nw = right ? codeW : W;
|
|
142
|
+
areaH = H - (!right && output.length ? outputH + 16 : 0);
|
|
143
|
+
}
|
|
144
|
+
// 下帯の最終一覧:説明ごとに行の範囲を付け(「3–4:…」)、説明の途中では折らずに行へ詰める。字は 24px、行間は字の箱 1.45em
|
|
145
|
+
var listFont = Math.max(24, nf - 2), listRow = Math.ceil(listFont * 1.45);
|
|
146
|
+
var items = d.steps.map(function(s){ var r = Array.isArray(s.lines) ? s.lines : []; var x = r[0], y = r.length > 1 ? r[1] : r[0]; return x + (y === x ? "" : "–" + y) + (T === TEXT.ja ? ":" : ": ") + s.note.replace(/\s*\n\s*/g, " "); });
|
|
147
|
+
// 出力が下に回るときは説明帯の右に並べ、帯と出力の高い方だけを使う
|
|
148
|
+
var sideW = Math.max(120, outNatural);
|
|
149
|
+
var side = !beside && !right && output.length > 0 && P.outputPos === "auto" && d.steps.length > 0 && outNatural <= W * 0.45 && W - sideW - gap >= W * 0.4;
|
|
150
|
+
if (side){ nw = W - sideW - gap; areaH = H; }
|
|
151
|
+
var list = [];
|
|
152
|
+
if (!beside && d.steps.length){
|
|
153
|
+
var cur = "", sep = T === TEXT.ja ? " " : " ";
|
|
154
|
+
items.forEach(function(t){
|
|
155
|
+
var cand = cur ? cur + sep + t : t;
|
|
156
|
+
if (cur && base.textWidth(cand, listFont, {font: self}) > nw - 24){ list.push(cur); cur = t; } else cur = cand;
|
|
157
|
+
});
|
|
158
|
+
if (cur) list.push(cur);
|
|
159
|
+
}
|
|
160
|
+
// 高さの式は 1 つ:コード部 + 帯(一覧 r 行)と横の出力の高い方 + 下の出力。報告もこの式で数える
|
|
161
|
+
function bandFor(r){ return r ? noteRow + 16 + (r - 1) * listRow : 0; }
|
|
162
|
+
function need(n, r){ var zone = Math.max(bandFor(r), side ? outputH : 0); return Math.ceil(header + n * row + pad + (zone ? 8 + zone : 0) + (!right && !side && output.length ? outputH + 16 : 0)); }
|
|
163
|
+
var want = Math.min(16, program.length), rows = list.length, fullList = true;
|
|
164
|
+
function fitsAt(h, r){ return Math.max(0, Math.floor((h - need(0, r)) / row)); }
|
|
165
|
+
var capacity = fitsAt(H, rows);
|
|
166
|
+
if (capacity < want && rows > 1 && fitsAt(H, 1) >= want){ fullList = false; capacity = fitsAt(H, 1); } // コードを全部残し、最終一覧は最後の説明だけ
|
|
167
|
+
var bandH = bandFor(fullList ? rows : Math.min(1, rows)), bandSpace = bandH ? bandH + 8 : 0;
|
|
168
|
+
var count = Math.min(want, capacity), codeH = header + count * row + pad;
|
|
169
|
+
var neededH = need(want, rows), SLIDE = 440;
|
|
170
|
+
function advice(){
|
|
171
|
+
return neededH <= SLIDE ? "give the element about " + neededH + " px" : "more than a slide body under a heading (about " + SLIDE + " px) holds; " + SLIDE + " px fits " + Math.min(want, fitsAt(SLIDE, rows)) + " lines with these notes: show fewer lines, shorten notes or split the slide";
|
|
172
|
+
}
|
|
173
|
+
var textX = pad + numW, firstY = header + fs, textW = Math.max(0, codeW - textX - pad);
|
|
174
|
+
if (count < program.length) ctx.report("layout", "[code] " + program.length + " lines; this height fits " + Math.min(16, capacity) + " (" + advice() + (neededH <= SLIDE ? ", or show fewer lines" : "") + ")" + (program.length > 16 ? "; at most 16 lines per panel" : ""));
|
|
175
|
+
if (monoWidth(longest, fs) > textW) ctx.report("layout", "[code] the longest line is " + [...longest].length + " characters; this width fits " + Math.floor(textW / (0.6 * fs)) + " at " + fs + "px (break the line)");
|
|
176
|
+
this.geometry = {side: side, listRows: rows, codeW: codeW, codeH: codeH, nx: nx, nw: nw, row: row, firstY: firstY, right: right, count: count, neededH: neededH, bandH: bandH, noteLayout: this.noteLayout};
|
|
177
|
+
this.codeLayer = base.el("g", {opacity: 0}, this.svg);
|
|
178
|
+
function panel(g, x, y, w, h){ base.el("rect", {x: x, y: y, width: Math.max(1, w), height: Math.max(1, h), rx: 12, fill: "var(--term-tint, color-mix(in srgb, var(--fg) 5%, var(--bg)))", stroke: "var(--line)", "stroke-width": 2}, g); }
|
|
179
|
+
panel(this.codeLayer, 1, 1, codeW - 2, codeH - 2);
|
|
180
|
+
var tagW = Math.max(1, codeW - 2 * pad), tag = cut(lang, tagW, fs);
|
|
181
|
+
if (count || H >= header + pad) this.label(this.codeLayer, codeW - pad - monoWidth(tag, fs), pad + fs, tag, fs, "var(--muted)", true);
|
|
182
|
+
this.bands = d.steps.map(function(){ return base.el("rect", {x: 4, y: header, width: Math.max(1, codeW - 8), height: row, fill: "var(--emph-tint, color-mix(in srgb, var(--emph) 12%, var(--bg)))", opacity: 0}, self.codeLayer); });
|
|
183
|
+
if (tag !== lang) ctx.report("layout", "[code] language tag needs " + Math.ceil(monoWidth(lang, fs)) + " px; header fits " + Math.floor(tagW) + " px");
|
|
184
|
+
this.numbers = [];
|
|
185
|
+
for (var i = 0; i < count; i++){
|
|
186
|
+
var y = firstY + i * row, original = program[i].replace(/\t/g, " "), s = cut(original, Math.max(0, codeW - textX - pad), fs);
|
|
187
|
+
if (i === count - 1 && count < program.length) s = cut(s + "…", Math.max(0, codeW - textX - pad), fs);
|
|
188
|
+
this.numbers.push(this.label(this.codeLayer, pad, y, String(i + 1), fs, "var(--muted)", true));
|
|
189
|
+
// One <text> per line; coloured runs are tspans, so the browser's own advance places them (indices after tab expansion)
|
|
190
|
+
var e = this.label(this.codeLayer, textX, y, "", fs, "var(--fg)", true), pos = 0, line = program[i];
|
|
191
|
+
var put = function(a, b, role){ if (b > a) base.el("tspan", role ? {fill: "var(--" + role + ")"} : {}, e).textContent = s.slice(a, b); };
|
|
192
|
+
marks[i].forEach(function(m){
|
|
193
|
+
var a = Math.min(s.length, line.slice(0, m[0]).replace(/\t/g, " ").length), b = Math.min(s.length, line.slice(0, m[1]).replace(/\t/g, " ").length);
|
|
194
|
+
put(pos, a); put(a, b, m[2]); pos = b;
|
|
195
|
+
});
|
|
196
|
+
put(pos, s.length);
|
|
197
|
+
}
|
|
198
|
+
if (count === 0 || W < 360 || textW < fs){
|
|
199
|
+
ctx.report("size", "[code] element is " + W + " × " + H + " px; allow at least 360 × " + Math.ceil(header + row + pad + bandSpace) + " px for one code line and notes");
|
|
200
|
+
}
|
|
201
|
+
// Even unusably small boxes retain a clipped panel and an ellipsis.
|
|
202
|
+
this.svg.setAttribute("style", "overflow:hidden");
|
|
203
|
+
if (!count) this.label(this.codeLayer, Math.min(pad, W / 4), Math.min(fs, H), "…", fs);
|
|
204
|
+
nextY = header;
|
|
205
|
+
var bandY = codeH + 8, bandRoom = Math.max(0, areaH - bandY);
|
|
206
|
+
function proseCut(s, width, f){
|
|
207
|
+
f = f || nf;
|
|
208
|
+
if (base.textWidth(s, f, {font: self}) <= width) return s;
|
|
209
|
+
var chars = [...s];
|
|
210
|
+
while (chars.length && base.textWidth(chars.join("") + "…", f, {font: self}) > width) chars.pop();
|
|
211
|
+
return width >= f ? chars.join("") + "…" : "";
|
|
212
|
+
}
|
|
213
|
+
function marker(a, b){ return T === TEXT.ja ? a + (b === a ? "" : "–" + b) + " 行目" : (a === b ? "line " + a : "lines " + a + "–" + b); }
|
|
214
|
+
this.notes = d.steps.map(function(s, j){
|
|
215
|
+
var a = s.lines[0], b = s.lines.length === 2 ? s.lines[1] : a;
|
|
216
|
+
var valid = a >= 1 && b >= a && b <= program.length;
|
|
217
|
+
if (!valid && !s.nested) ctx.report("range", "[code] steps[" + j + "].lines must be an inclusive range within 1–" + program.length);
|
|
218
|
+
var target = valid && a <= count ? header + ((a - 1 + Math.min(b, count) - 1) / 2 + 0.5) * row : header;
|
|
219
|
+
var g = base.el("g", {opacity: 0}, self.svg), text, top, h, labels;
|
|
220
|
+
if (beside){
|
|
221
|
+
text = wrap(s.note, nw - 24, nf, self); h = Math.max(noteRow, text.length * noteRow) + 16;
|
|
222
|
+
top = Math.max(nextY, target - h / 2);
|
|
223
|
+
if (valid && a <= count) base.el("path", {d: "M " + codeW + " " + target + " H " + (nx - 12) + " V " + (top + h / 2) + " H " + nx, fill: "none", stroke: "var(--muted)", "stroke-width": 2}, g);
|
|
224
|
+
base.el("rect", {x: nx, y: top, width: nw - 1, height: h, rx: 8, fill: "var(--bg)", stroke: "var(--line)", "stroke-width": 2}, g);
|
|
225
|
+
labels = text.map(function(t, k){ return self.label(g, nx + 12, top + 8 + nf + k * noteRow, t, nf); });
|
|
226
|
+
nextY = top + h + 8;
|
|
227
|
+
} else {
|
|
228
|
+
top = bandY; h = Math.min(bandFor(1), bandRoom);
|
|
229
|
+
var prefix = marker(a, b) + " · ", prefixW = base.textWidth(prefix, nf, {font: self}), room = Math.max(0, nw - 24 - prefixW);
|
|
230
|
+
var width = base.textWidth(s.note, nf, {font: self});
|
|
231
|
+
if (width > room || lines(s.note).length > 1){
|
|
232
|
+
var approx = Math.max(0, Math.floor([...s.note].length * room / Math.max(1, width)));
|
|
233
|
+
ctx.report("layout", "[code] note " + (j + 1) + " is too long for the band (" + Math.ceil(width) + " px of " + Math.floor(room) + "); shorten it to about " + approx + " characters");
|
|
234
|
+
}
|
|
235
|
+
base.el("rect", {x: 1, y: top, width: Math.max(1, nw - 2), height: Math.max(1, h), rx: 8, fill: "var(--bg)", stroke: "var(--line)", "stroke-width": 2}, g);
|
|
236
|
+
labels = [self.label(g, 12, top + 8 + nf, proseCut(prefix + s.note.replace(/\s*\n\s*/g, " "), nw - 24), nf)];
|
|
237
|
+
}
|
|
238
|
+
if (valid && a <= count){ set(self.bands[j], "y", header + (a - 1) * row); set(self.bands[j], "height", (Math.min(b, count) - a + 1) * row); }
|
|
239
|
+
return {g: g, labels: labels, a: a, b: b, valid: valid && a <= count, top: top, height: h, fits: true};
|
|
240
|
+
});
|
|
241
|
+
this.finalNotes = base.el("g", {opacity: 0}, this.svg);
|
|
242
|
+
if (!beside && d.steps.length){
|
|
243
|
+
list = list.map(function(t){ return proseCut(t, nw - 24, listFont); });
|
|
244
|
+
if (!fullList || bandFor(list.length) > bandRoom){
|
|
245
|
+
ctx.report("layout", "[code] " + d.steps.length + " final notes need " + list.length + " band rows (" + bandFor(list.length) + " px); this height fits " + Math.max(0, Math.floor((bandRoom - noteRow - 16) / listRow) + 1) + " (" + advice() + "); showing the last note");
|
|
246
|
+
list = [proseCut(items[items.length - 1], nw - 24, listFont)];
|
|
247
|
+
}
|
|
248
|
+
base.el("rect", {x: 1, y: bandY, width: Math.max(1, nw - 2), height: Math.max(1, Math.min(bandRoom, bandFor(list.length))), rx: 8, fill: "var(--bg)", stroke: "var(--line)", "stroke-width": 2}, this.finalNotes);
|
|
249
|
+
list.forEach(function(s, i){ self.label(self.finalNotes, 12, bandY + 8 + nf + i * listRow, s, listFont); });
|
|
250
|
+
}
|
|
251
|
+
this.outputLayer = base.el("g", {opacity: 0}, this.svg);
|
|
252
|
+
if (output.length){
|
|
253
|
+
var ox = right ? W - outW : side ? W - sideW : 0, oy = right ? 0 : side ? codeH + 8 : areaH + 16, ow = right ? outW : side ? sideW : codeW;
|
|
254
|
+
var oc = Math.max(0, Math.min(8, output.length, Math.floor((H - oy - header - pad) / row)));
|
|
255
|
+
panel(this.outputLayer, ox + 1, oy + 1, ow - 2, header + oc * row + pad - 2);
|
|
256
|
+
self.label(this.outputLayer, ox + pad, oy + pad + fs, cut(T.output, ow - 2 * pad, fs), fs);
|
|
257
|
+
// Run precedes the supplied plain text in a separate header region.
|
|
258
|
+
var run = cut(T.run, ow - 2 * pad - monoWidth(T.output, fs) - pad, fs);
|
|
259
|
+
self.label(this.outputLayer, ox + ow - pad - monoWidth(run, fs), oy + pad + fs, run, fs, "var(--muted)", true);
|
|
260
|
+
var outputCut = oc < output.length || run !== T.run || monoWidth(T.output, fs) > ow - 2 * pad;
|
|
261
|
+
output.slice(0, oc).forEach(function(s, i){
|
|
262
|
+
var txt = cut(s.replace(/\t/g, " "), ow - 2 * pad, fs);
|
|
263
|
+
if (i === oc - 1 && oc < output.length) txt = cut(txt + "…", ow - 2 * pad, fs);
|
|
264
|
+
if (txt !== s) outputCut = true;
|
|
265
|
+
self.label(self.outputLayer, ox + pad, oy + header + fs + i * row, txt, fs, "var(--fg)", true);
|
|
266
|
+
});
|
|
267
|
+
if (outputCut) ctx.report("layout", "[code] output exceeds eight lines or panel width/height; showing what fits with …");
|
|
268
|
+
}
|
|
269
|
+
if (outputH > H) ctx.report("size", "[code] output needs " + outputH + " px height; element has " + H + " px");
|
|
270
|
+
}
|
|
271
|
+
render(k, t, ctx){
|
|
272
|
+
if (!this.codeLayer) return;
|
|
273
|
+
ctx = ctx || {};
|
|
274
|
+
var self = this, preview = ctx.preview || ctx.mode === "lecture", faint = preview ? base.previewOpacity(this) : 0;
|
|
275
|
+
var phase = function(step){ return k > step ? 1 : k < step ? faint : base.prog(t, 0, self.props.dur); };
|
|
276
|
+
set(this.codeLayer, "opacity", phase(1));
|
|
277
|
+
var final = k > this.steps || k === this.steps && t >= this.props.dur, active = !final && k >= 2 && k <= this.notes.length + 1 ? k - 2 : -1;
|
|
278
|
+
this.notes.forEach(function(n, i){
|
|
279
|
+
var band = self.noteLayout === "band", shown = !final && (i === active || active < 0 && k > self.notes.length + 1 && i === self.notes.length - 1);
|
|
280
|
+
set(n.g, "opacity", band ? (shown ? phase(i + 2) : 0) : phase(i + 2));
|
|
281
|
+
n.labels.forEach(function(e){ set(e, "style", "fill:var(--" + (i < k - 2 && !final ? "muted" : "fg") + ")"); });
|
|
282
|
+
set(self.bands[i], "opacity", i === active && n.valid ? base.prog(t, 0, self.props.dur) : 0);
|
|
283
|
+
});
|
|
284
|
+
set(this.finalNotes, "opacity", this.noteLayout === "band" ? (final ? 1 : k < 2 ? faint : 0) : 0);
|
|
285
|
+
this.numbers.forEach(function(e, i){ var n = self.notes[active]; set(e, "style", "font-family:" + MONO + ";white-space:pre;fill:var(--" + (n && n.valid && i + 1 >= n.a && i + 1 <= n.b ? "emph" : "muted") + ")"); });
|
|
286
|
+
set(this.outputLayer, "opacity", phase(this.notes.length + 2));
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Reading abcjs 6.7.2 for m-score (notes for the build hook)
|
|
2
|
+
|
|
3
|
+
m-score knows nothing about abcjs (components 2.0 design §4.1). It reads `abcMap` (`tempo`, `notes`, `beams`, `arcs`)
|
|
4
|
+
and finds things in `abcSvg` only by the build's data- tags, never by an abcjs class. This file gives the abcjs facts a
|
|
5
|
+
producer needs to write those tags. `tools/score-fixtures.mjs` follows them. It is the stand-in for Studio's build
|
|
6
|
+
hook and writes `fixtures/*.json` and `demo.html`. They were checked on the fixtures here (`ties.json` is test-only) and in
|
|
7
|
+
abcjs's source (`src/write/creation/abstract-engraver.js`, `src/write/draw/tie.js`, `src/write/draw/beam.js`).
|
|
8
|
+
|
|
9
|
+
## Tags the build writes (all digits; the part reads no other data- attribute)
|
|
10
|
+
|
|
11
|
+
| Tag | On | Value | The part shows it with |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| `data-note="i"` | each note's or rest's `<g>` (`abselem.elemset[0]` of the parsed note) | its index in `notes` | that note (and colours it while current) |
|
|
14
|
+
| `data-beam="k"` | each beam path (`abcjs-beam-elem`) | its index in `beams` | the first note of `beams[k]` |
|
|
15
|
+
| `data-measure="m"` | each bar line's `<g>` (`abselem.elemset[0]` of a `bar` element) | the measure it closes (its `abcjs-mm`) | the last note of measure `m` |
|
|
16
|
+
| `data-arc="n"` | each drawn tie or slur piece | `arcs[].n` | a tie with its `to`, a slur with its `from` |
|
|
17
|
+
|
|
18
|
+
- Everything without a tag is shown from step 0: the staff, clef, key and time signatures, and whatever else abcjs draws.
|
|
19
|
+
So anything that should appear with a note must be tagged. This covers decorations, lyrics and chord symbols, if abcjs
|
|
20
|
+
ever draws them outside the note's `<g>`; the fixtures have none.
|
|
21
|
+
- A `<g>` that contains a tag is looked into. One that contains none is kept whole.
|
|
22
|
+
- A staff line is one child of the root `<svg>`. abcjs puts each line in its own `abcjs-staff-wrapper` `<g>`.
|
|
23
|
+
The part stacks these children and puts the names band under each.
|
|
24
|
+
- The part reports, without guessing:
|
|
25
|
+
- a note with no `data-note` element, and a `data-note` used twice;
|
|
26
|
+
- a beam with no `data-beam` element;
|
|
27
|
+
- an arc with no `data-arc` line;
|
|
28
|
+
- a tag value that `abcMap` does not have.
|
|
29
|
+
- `notes[].cls` (`"abcjs-v0 abcjs-mm1 abcjs-n2"`) stays in `abcMap` as the adapter's record, for checking. The part does not read it.
|
|
30
|
+
- `tools/test-score.mjs` and `tools/test-score-noclass.mjs` strip every `abcjs-*` class from the fixtures. They check
|
|
31
|
+
that the part behaves the same: same steps, events, names and DOM.
|
|
32
|
+
|
|
33
|
+
## Notes
|
|
34
|
+
|
|
35
|
+
- With `add_classes: true`, a note or rest is a `<g>` with `abcjs-note` or `abcjs-rest`, `abcjs-l<line>`, `abcjs-m<measure in the line>`,
|
|
36
|
+
`abcjs-mm<measure>`, `abcjs-v<voice>` and `abcjs-n<note in the measure>`. Only `abcjs-v… abcjs-mm… abcjs-n…` together is unique.
|
|
37
|
+
- Pitch name: the letter and octave come from `pitches[q].pitch` (a diatonic step, 0 = C4). The accidental comes from the
|
|
38
|
+
sounding MIDI pitch after `tune.setUpAudio()` (`midiPitches[q].pitch`). A tied continuation has no `midiPitches`.
|
|
39
|
+
- `duration` is in whole notes. Multiply it by 4 for quarter notes, and by `tripletMultiplier` from `startTriplet` to
|
|
40
|
+
`endTriplet`. Tempo is `bpm × Σ duration × 4` quarter notes per minute.
|
|
41
|
+
- abcjs writes the tempo, title and lyrics at 16–20 units, below the 24 px floor. Render with `%%printtempo false` and without `T:`.
|
|
42
|
+
|
|
43
|
+
## Beams
|
|
44
|
+
|
|
45
|
+
`drawBeam` draws one path per beam group, all levels in one path, with class `abcjs-beam-elem`. The paths come in the
|
|
46
|
+
order of the engraved voice's `beams`, so the build tags the k-th `abcjs-beam-elem` path in document order `data-beam="k"` (`tune.lines[l].staffGroup.voices[v].beams`, skipping `'bar'`). The notes of each
|
|
47
|
+
group are in `elems[].abcelem`.
|
|
48
|
+
|
|
49
|
+
## Ties and slurs
|
|
50
|
+
|
|
51
|
+
- **Which arcs exist** (from the parsed notes): a tie per pitch, from a pitch with `startTie` to the next note whose pitch
|
|
52
|
+
with the same step has `endTie`. abcjs ends a tie on the first open tie with that pitch, or else the oldest one. A slur
|
|
53
|
+
runs from `startSlur` to the `endSlur` with the same label, on the note or on a pitch. `[C-EG] [CEG]` ties only C.
|
|
54
|
+
- **Which path is which:** each drawn arc is a `TieElem` in the engraved voice's `otherchildren`. Its path is in `elemset[0]`
|
|
55
|
+
and its end noteheads are `anchor1` and `anchor2`. The notehead's `parent.abcelem` is the note, and `parent.heads`
|
|
56
|
+
gives the pitch. A `TieElem` does not record whether it is a tie or a slur.
|
|
57
|
+
- **Line breaks:** an arc that crosses a line break is drawn once per line. The piece on the first line has only `anchor1`
|
|
58
|
+
(class `abcjs-end-edge`). At the start of each later line abcjs recreates every open arc. That piece has only `anchor2`,
|
|
59
|
+
or neither on a middle line (class `abcjs-start-edge`).
|
|
60
|
+
- **Drawing order**, per staff line (the order of `otherchildren`):
|
|
61
|
+
1. First, the pieces continued from the previous line: all open slurs, in start order, then all open ties in the
|
|
62
|
+
order they were created (by start note; a chord's pitches low to high).
|
|
63
|
+
2. Then the arcs that start on this line, by start note. At one note abcjs goes pitch by pitch, low to high. For each
|
|
64
|
+
pitch it creates that pitch's tie, then any slur starting on that pitch. A slur over a chord sits on the lowest pitch.
|
|
65
|
+
So the order at one note is: the lowest pitch's tie, the slur, then the other pitches' ties.
|
|
66
|
+
- **Class quirks:**
|
|
67
|
+
- Every arc path has `abcjs-slur`.
|
|
68
|
+
- A slur within a line has `abcjs-legato`.
|
|
69
|
+
- A slur piece cut by a line break is drawn like a tie and has `abcjs-tie`.
|
|
70
|
+
- So does a slur between two notes of the same pitch with nothing between them.
|
|
71
|
+
- **Hidden duplicate:** the slur leaving a tied chord at a line break is drawn on exactly the same path as the lowest
|
|
72
|
+
pitch's tie, so it cannot be seen. The build drops it.
|
|
73
|
+
- **How `tools/score-fixtures.mjs` tags a piece:**
|
|
74
|
+
- A piece with both anchors matches the one arc between those notes; a tie must also match by pitch.
|
|
75
|
+
- A piece with one anchor can match both a tie and a slur at the same note. Then the order above decides: on the start
|
|
76
|
+
line the tie comes first, and on the next line the slur comes first.
|
|
77
|
+
- Every piece gets `data-arc="<n>"`. If a piece matches no arc, or more than one, the script fails.
|
|
78
|
+
|
|
79
|
+
## Writing only what the rendered-markup list admits (egatari-spec ce96072)
|
|
80
|
+
|
|
81
|
+
The part reads `abcSvg` through the spec's list (`schema/rendered-markup-1.json`, svg) and reports anything it drops.
|
|
82
|
+
abcjs 6.7.2 (`foregroundColor: "currentColor"`, also its default) writes, besides the drawing:
|
|
83
|
+
|
|
84
|
+
| abcjs writes | Admitted? | The build |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| `<style>` (its drag-and-drop CSS) | no | leaves it out |
|
|
87
|
+
| `<title>Sheet Music</title>` | yes | leaves it out (the part's drawing is aria-hidden; the slide gives the label) |
|
|
88
|
+
| `xmlns:xlink` on `<svg>`, `selectable` on each note's `<g>` | no | leaves them out |
|
|
89
|
+
| `data-name`, `data-index` | yes (data-*) | leaves them out: they are abcjs's, not build tags |
|
|
90
|
+
| `fill`, `stroke` on `<svg>` and `<g>` (`stroke="none"` on notes, clef, key, time), `stroke="none"` on text | yes (since ce96072) | keeps them as abcjs writes them |
|
|
91
|
+
| on text (chord symbols, lyrics, title, tempo): `font-family`, `text-decoration` | no | keeps them: the part drops them (expected losses: the slide's font, no underline); the demo has no text, `extras.json` (test only) does |
|
|
92
|
+
|
|
93
|
+
The data records the renderer once at its top: `renderers: {abcjs: {version: "6.7.2", options: {add_classes, staffwidth,
|
|
94
|
+
foregroundColor}}}` (spec §6.2).
|
|
95
|
+
|
|
96
|
+
## What m-score does with it
|
|
97
|
+
|
|
98
|
+
- It finds notes, beams, bar lines and arc pieces only by the tags above.
|
|
99
|
+
- A tie piece appears with the note it leads to (`to`), a slur piece with its first note (`from`).
|
|
100
|
+
- A pitch is not sounded again at note `j` when a tie arc has `to = j` and that `pitch`. A tied pitch sounds for the
|
|
101
|
+
whole chain.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) 2009-2026 Paul Rosen and Gregory Dyke
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
**This text is from: http://opensource.org/licenses/MIT**
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"abc": "X:1\nM:4/4\nL:1/2\n%%printtempo false\nQ:1/4=80\nK:C\n[CEG] [FAc] | [GBd] [CEG] |]",
|
|
3
|
+
"abcSvg": "<svg role=\"img\" fill=\"currentColor\" stroke=\"currentColor\" aria-label=\"Sheet Music\" width=\"550\" height=\"107.31\"><g class=\"abcjs-staff-wrapper abcjs-l0\"><g class=\"abcjs-staff abcjs-l0 abcjs-v0\"><path d=\"M 15 37.71 L 329.85 37.71 L 329.85 38.41 L 15 38.41 z\" stroke=\"none\" fill=\"currentColor\" class=\"abcjs-top-line\"></path><path d=\"M 15 45.46 L 329.85 45.46 L 329.85 46.16 L 15 46.16 z\" stroke=\"none\" fill=\"currentColor\"></path><path d=\"M 15 53.21 L 329.85 53.21 L 329.85 53.91 L 15 53.91 z\" stroke=\"none\" fill=\"currentColor\"></path><path d=\"M 15 60.96 L 329.85 60.96 L 329.85 61.66 L 15 61.66 z\" stroke=\"none\" fill=\"currentColor\"></path><path d=\"M 15 68.71 L 329.85 68.71 L 329.85 69.41 L 15 69.41 z\" stroke=\"none\" fill=\"currentColor\"></path></g><g class=\"abcjs-staff-extra abcjs-clef abcjs-l0 abcjs-m0 abcjs-mm0 abcjs-v0\" fill=\"currentColor\" stroke=\"none\"><path d=\"M 29.689999999999998 23.900000000000006c 0.09 -0.09 0.24 -0.06 0.36 0c 0.12 0.09 0.57 0.6 0.96 1.11c 1.77 2.34 3.21 5.85 3.57 8.73c 0.21 1.56 0.03 3.27 -0.45 4.86c -0.69 2.31 -1.92 4.47 -4.23 7.44c -0.3 0.39 -0.57 0.72 -0.6 0.75c -0.03 0.06 0 0.15 0.18 0.78c 0.54 1.68 1.38 4.44 1.68 5.49l 0.09 0.42l 0.39 0c 1.47 0.09 2.76 0.51 3.96 1.29c 1.83 1.23 3.06 3.21 3.39 5.52c 0.09 0.45 0.12 1.29 0.06 1.74c -0.09 1.02 -0.33 1.83 -0.75 2.73c -0.84 1.71 -2.28 3.06 -4.02 3.72l -0.33 0.12l 0.03 1.26c 0 1.74 -0.06 3.63 -0.21 4.62c -0.45 3.06 -2.19 5.49 -4.47 6.21c -0.57 0.18 -0.9 0.21 -1.59 0.21c -0.69 0 -1.02 -0.03 -1.65 -0.21c -1.14 -0.27 -2.13 -0.84 -2.94 -1.65c -0.99 -0.99 -1.56 -2.16 -1.71 -3.54c -0.09 -0.81 0.06 -1.53 0.45 -2.13c 0.63 -0.99 1.83 -1.56 3 -1.53c 1.5 0.09 2.64 1.32 2.73 2.94c 0.06 1.47 -0.93 2.7 -2.37 2.97c -0.45 0.06 -0.84 0.03 -1.29 -0.09l -0.21 -0.09l 0.09 0.12c 0.39 0.54 0.78 0.93 1.32 1.26c 1.35 0.87 3.06 1.02 4.35 0.36c 1.44 -0.72 2.52 -2.28 2.97 -4.35c 0.15 -0.66 0.24 -1.5 0.3 -3.03c 0.03 -0.84 0.03 -2.94 0 -3c -0.03 0 -0.18 0 -0.36 0.03c -0.66 0.12 -0.99 0.12 -1.83 0.12c -1.05 0 -1.71 -0.06 -2.61 -0.3c -4.02 -0.99 -7.11 -4.35 -7.8 -8.46c -0.12 -0.66 -0.12 -0.99 -0.12 -1.83c 0 -0.84 0 -1.14 0.15 -1.92c 0.36 -2.28 1.41 -4.62 3.3 -7.29l 2.79 -3.6c 0.54 -0.66 0.96 -1.2 0.96 -1.23c 0 -0.03 -0.09 -0.33 -0.18 -0.69c -0.96 -3.21 -1.41 -5.28 -1.59 -7.68c -0.12 -1.38 -0.15 -3.09 -0.06 -3.96c 0.33 -2.67 1.38 -5.07 3.12 -7.08c 0.36 -0.42 0.99 -1.05 1.17 -1.14zm 2.01 4.71c -0.15 -0.3 -0.3 -0.54 -0.3 -0.54c -0.03 0 -0.18 0.09 -0.3 0.21c -2.4 1.74 -3.87 4.2 -4.26 7.11c -0.06 0.54 -0.06 1.41 -0.03 1.89c 0.09 1.29 0.48 3.12 1.08 5.22c 0.15 0.42 0.24 0.78 0.24 0.81c 0 0.03 0.84 -1.11 1.23 -1.68c 1.89 -2.73 2.88 -5.07 3.15 -7.53c 0.09 -0.57 0.12 -1.74 0.06 -2.37c -0.09 -1.23 -0.27 -1.92 -0.87 -3.12zm -2.94 20.7c -0.21 -0.72 -0.39 -1.32 -0.42 -1.32c 0 0 -1.2 1.47 -1.86 2.37c -2.79 3.63 -4.02 6.3 -4.35 9.3c -0.03 0.21 -0.03 0.69 -0.03 1.08c 0 0.69 0 0.75 0.06 1.11c 0.12 0.54 0.27 0.99 0.51 1.47c 0.69 1.38 1.83 2.55 3.42 3.42c 0.96 0.54 2.07 0.9 3.21 1.08c 0.78 0.12 2.04 0.12 2.94 -0.03c 0.51 -0.06 0.45 -0.03 0.42 -0.3c -0.24 -3.33 -0.72 -6.33 -1.62 -10.08c -0.09 -0.39 -0.18 -0.75 -0.18 -0.78c -0.03 -0.03 -0.42 0 -0.81 0.09c -0.9 0.18 -1.65 0.57 -2.22 1.14c -0.72 0.72 -1.08 1.65 -1.05 2.64c 0.06 0.96 0.48 1.83 1.23 2.58c 0.36 0.36 0.72 0.63 1.17 0.9c 0.33 0.18 0.36 0.21 0.42 0.33c 0.18 0.42 -0.18 0.9 -0.6 0.87c -0.18 -0.03 -0.84 -0.36 -1.26 -0.63c -0.78 -0.51 -1.38 -1.11 -1.86 -1.83c -1.77 -2.7 -0.99 -6.42 1.71 -8.19c 0.3 -0.21 0.81 -0.48 1.17 -0.63c 0.3 -0.09 1.02 -0.3 1.14 -0.3c 0.06 0 0.09 0 0.09 -0.03c 0.03 -0.03 -0.51 -1.92 -1.23 -4.26zm 3.78 7.41c -0.18 -0.03 -0.36 -0.06 -0.39 -0.06c -0.03 0 0 0.21 0.18 1.02c 0.75 3.18 1.26 6.3 1.5 9.09c 0.06 0.72 0 0.69 0.51 0.42c 0.78 -0.36 1.44 -0.96 1.98 -1.77c 1.08 -1.62 1.2 -3.69 0.3 -5.55c -0.81 -1.62 -2.31 -2.79 -4.08 -3.15z\"></path></g><g class=\"abcjs-staff-extra abcjs-time-signature abcjs-l0 abcjs-m0 abcjs-mm0 abcjs-v0\" fill=\"currentColor\" stroke=\"none\"><path d=\"M 57.691 38.620000000000005c 0.27 -0.09 0.42 -0.12 0.54 -0.03c 0.09 0.06 0.15 0.21 0.15 0.3c -0.03 0.06 -1.92 2.31 -4.23 5.04c -2.31 2.73 -4.23 4.98 -4.26 5.01c -0.03 0.06 0.12 0.06 2.55 0.06l 2.61 0l 0 -2.37c 0 -2.19 0.03 -2.37 0.06 -2.46c 0.03 -0.06 0.21 -0.18 0.57 -0.42c 1.08 -0.72 1.38 -1.08 1.86 -2.16c 0.12 -0.3 0.24 -0.54 0.27 -0.57c 0.12 -0.12 0.39 -0.06 0.45 0.12c 0.06 0.09 0.06 0.57 0.06 3.96l 0 3.9l 1.08 0c 1.05 0 1.11 0 1.2 0.06c 0.24 0.15 0.24 0.54 0 0.69c -0.09 0.06 -0.15 0.06 -1.2 0.06l -1.08 0l 0 0.33c 0 0.57 0.09 1.11 0.3 1.53c 0.36 0.75 0.93 1.17 1.68 1.26c 0.3 0.03 0.39 0.09 0.39 0.3c 0 0.15 -0.03 0.18 -0.09 0.24c -0.06 0.06 -0.09 0.06 -0.48 0.06c -0.42 0 -0.69 -0.03 -2.1 -0.24c -0.9 -0.15 -1.77 -0.15 -2.67 0c -1.41 0.21 -1.68 0.24 -2.1 0.24c -0.39 0 -0.42 0 -0.48 -0.06c -0.06 -0.06 -0.06 -0.09 -0.06 -0.24c 0 -0.21 0.06 -0.27 0.36 -0.3c 0.75 -0.09 1.32 -0.51 1.68 -1.26c 0.21 -0.42 0.3 -0.96 0.3 -1.53l 0 -0.33l -2.7 0c -2.91 0 -2.85 0 -3.09 -0.15c -0.18 -0.12 -0.3 -0.39 -0.27 -0.54c 0.03 -0.06 0.18 -0.24 0.33 -0.45c 0.75 -0.9 1.59 -2.07 2.13 -3.03c 0.33 -0.54 0.84 -1.62 1.05 -2.16c 0.57 -1.41 0.84 -2.64 0.9 -4.05c 0.03 -0.63 0.06 -0.72 0.24 -0.81l 0.12 -0.06l 0.45 0.12c 0.66 0.18 1.02 0.24 1.47 0.27c 0.6 0.03 1.23 -0.09 2.01 -0.33z\"></path><path d=\"M 57.691 54.120000000000005c 0.27 -0.09 0.42 -0.12 0.54 -0.03c 0.09 0.06 0.15 0.21 0.15 0.3c -0.03 0.06 -1.92 2.31 -4.23 5.04c -2.31 2.73 -4.23 4.98 -4.26 5.01c -0.03 0.06 0.12 0.06 2.55 0.06l 2.61 0l 0 -2.37c 0 -2.19 0.03 -2.37 0.06 -2.46c 0.03 -0.06 0.21 -0.18 0.57 -0.42c 1.08 -0.72 1.38 -1.08 1.86 -2.16c 0.12 -0.3 0.24 -0.54 0.27 -0.57c 0.12 -0.12 0.39 -0.06 0.45 0.12c 0.06 0.09 0.06 0.57 0.06 3.96l 0 3.9l 1.08 0c 1.05 0 1.11 0 1.2 0.06c 0.24 0.15 0.24 0.54 0 0.69c -0.09 0.06 -0.15 0.06 -1.2 0.06l -1.08 0l 0 0.33c 0 0.57 0.09 1.11 0.3 1.53c 0.36 0.75 0.93 1.17 1.68 1.26c 0.3 0.03 0.39 0.09 0.39 0.3c 0 0.15 -0.03 0.18 -0.09 0.24c -0.06 0.06 -0.09 0.06 -0.48 0.06c -0.42 0 -0.69 -0.03 -2.1 -0.24c -0.9 -0.15 -1.77 -0.15 -2.67 0c -1.41 0.21 -1.68 0.24 -2.1 0.24c -0.39 0 -0.42 0 -0.48 -0.06c -0.06 -0.06 -0.06 -0.09 -0.06 -0.24c 0 -0.21 0.06 -0.27 0.36 -0.3c 0.75 -0.09 1.32 -0.51 1.68 -1.26c 0.21 -0.42 0.3 -0.96 0.3 -1.53l 0 -0.33l -2.7 0c -2.91 0 -2.85 0 -3.09 -0.15c -0.18 -0.12 -0.3 -0.39 -0.27 -0.54c 0.03 -0.06 0.18 -0.24 0.33 -0.45c 0.75 -0.9 1.59 -2.07 2.13 -3.03c 0.33 -0.54 0.84 -1.62 1.05 -2.16c 0.57 -1.41 0.84 -2.64 0.9 -4.05c 0.03 -0.63 0.06 -0.72 0.24 -0.81l 0.12 -0.06l 0.45 0.12c 0.66 0.18 1.02 0.24 1.47 0.27c 0.6 0.03 1.23 -0.09 2.01 -0.33z\"></path></g><g class=\"abcjs-note abcjs-d0-5 abcjs-p0 abcjs-p2 abcjs-p4 abcjs-l0 abcjs-m0 abcjs-mm0 abcjs-v0 abcjs-n0\" fill=\"currentColor\" stroke=\"none\" data-note=\"0\"><path d=\"M 78.286 72.76c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-1\"></path><path d=\"M 78.286 65.01c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-2\"></path><path d=\"M 78.286 57.260000000000005c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-3\"></path><path d=\"M 81.22 34.19L 81.22 75.52L 80.22 75.52L 80.22 34.19z\" class=\"abcjs-stem\"></path><path d=\"M 68.85 76.46 L 83.22 76.46 L 83.22 77.16 L 68.85 77.16 z\" stroke=\"none\" fill=\"currentColor\" class=\"abcjs-ledger\"></path></g><g class=\"abcjs-note abcjs-d0-5 abcjs-p3 abcjs-p5 abcjs-p7 abcjs-l0 abcjs-m0 abcjs-mm0 abcjs-v0 abcjs-n1\" fill=\"currentColor\" stroke=\"none\" data-note=\"1\"><path d=\"M 138.286 61.135000000000005c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-1\"></path><path d=\"M 138.286 53.385000000000005c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-2\"></path><path d=\"M 138.286 45.635000000000005c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-3\"></path><path d=\"M 141.22 22.56L 141.22 63.89L 140.22 63.89L 140.22 22.56z\" class=\"abcjs-stem\"></path></g><g class=\"abcjs-bar abcjs-l0 abcjs-m0 abcjs-mm0 abcjs-v0\" fill=\"currentColor\" stroke=\"none\" data-measure=\"0\"><path d=\"M 190.85 69.06L 190.85 38.06L 191.45 38.06L 191.45 69.06z\"></path></g><g class=\"abcjs-note abcjs-d0-5 abcjs-p4 abcjs-p6 abcjs-p8 abcjs-l0 abcjs-m1 abcjs-mm1 abcjs-v0 abcjs-n0\" fill=\"currentColor\" stroke=\"none\" data-note=\"2\"><path d=\"M 209.286 57.260000000000005c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-1\"></path><path d=\"M 209.286 49.510000000000005c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-2\"></path><path d=\"M 209.286 41.760000000000005c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-3\"></path><path d=\"M 201.85 88.44L 201.85 47.1L 202.85 47.1L 202.85 88.44z\" class=\"abcjs-stem\"></path></g><g class=\"abcjs-note abcjs-d0-5 abcjs-p0 abcjs-p2 abcjs-p4 abcjs-l0 abcjs-m1 abcjs-mm1 abcjs-v0 abcjs-n1\" fill=\"currentColor\" stroke=\"none\" data-note=\"3\"><path d=\"M 269.286 72.76c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-1\"></path><path d=\"M 269.286 65.01c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-2\"></path><path d=\"M 269.286 57.260000000000005c 0.06 -0.03 0.27 -0.03 0.48 -0.03c 1.05 0 1.71 0.24 2.1 0.81c 0.42 0.6 0.45 1.35 0.18 2.4c -0.42 1.59 -1.14 2.73 -2.16 3.39c -1.41 0.93 -3.18 1.44 -5.4 1.53c -1.17 0.03 -1.89 -0.21 -2.28 -0.81c -0.42 -0.6 -0.45 -1.35 -0.18 -2.4c 0.42 -1.59 1.14 -2.73 2.16 -3.39c 0.63 -0.42 1.23 -0.72 1.98 -0.96c 0.9 -0.3 1.65 -0.42 3.12 -0.54zm 1.29 0.87c -0.27 -0.09 -0.63 -0.12 -0.9 -0.03c -0.72 0.24 -1.53 0.69 -3.27 1.8c -2.34 1.5 -3.3 2.25 -3.57 2.79c -0.36 0.72 -0.06 1.5 0.66 1.77c 0.24 0.12 0.69 0.09 0.99 0c 0.84 -0.3 1.92 -0.93 4.14 -2.37c 1.62 -1.08 2.37 -1.71 2.61 -2.19c 0.36 -0.72 0.06 -1.5 -0.66 -1.77z\" class=\"abcjs-notehead abcjs-chord-pos-3\"></path><path d=\"M 272.22 34.19L 272.22 75.52L 271.22 75.52L 271.22 34.19z\" class=\"abcjs-stem\"></path><path d=\"M 259.85 76.46 L 274.22 76.46 L 274.22 77.16 L 259.85 77.16 z\" stroke=\"none\" fill=\"currentColor\" class=\"abcjs-ledger\"></path></g><g class=\"abcjs-bar abcjs-l0 abcjs-m1 abcjs-mm1 abcjs-v0\" fill=\"currentColor\" stroke=\"none\" data-measure=\"1\"><path d=\"M 321.85 69.06L 321.85 38.06L 322.45 38.06L 322.45 69.06z\"></path><path d=\"M 325.85 69.06L 325.85 38.06L 329.85 38.06L 329.85 69.06z\"></path></g></g></svg>",
|
|
4
|
+
"abcMap": {
|
|
5
|
+
"tempo": 80,
|
|
6
|
+
"notes": [
|
|
7
|
+
{
|
|
8
|
+
"cls": "abcjs-v0 abcjs-mm0 abcjs-n0",
|
|
9
|
+
"measure": 0,
|
|
10
|
+
"pitch": [
|
|
11
|
+
"C4",
|
|
12
|
+
"E4",
|
|
13
|
+
"G4"
|
|
14
|
+
],
|
|
15
|
+
"beat": 0,
|
|
16
|
+
"dur": 2,
|
|
17
|
+
"box": [
|
|
18
|
+
70.85,
|
|
19
|
+
57.23,
|
|
20
|
+
10.37,
|
|
21
|
+
23.63
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"cls": "abcjs-v0 abcjs-mm0 abcjs-n1",
|
|
26
|
+
"measure": 0,
|
|
27
|
+
"pitch": [
|
|
28
|
+
"F4",
|
|
29
|
+
"A4",
|
|
30
|
+
"C5"
|
|
31
|
+
],
|
|
32
|
+
"beat": 2,
|
|
33
|
+
"dur": 2,
|
|
34
|
+
"box": [
|
|
35
|
+
130.85,
|
|
36
|
+
45.6,
|
|
37
|
+
10.37,
|
|
38
|
+
23.63
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"cls": "abcjs-v0 abcjs-mm1 abcjs-n0",
|
|
43
|
+
"measure": 1,
|
|
44
|
+
"pitch": [
|
|
45
|
+
"G4",
|
|
46
|
+
"B4",
|
|
47
|
+
"D5"
|
|
48
|
+
],
|
|
49
|
+
"beat": 0,
|
|
50
|
+
"dur": 2,
|
|
51
|
+
"box": [
|
|
52
|
+
201.85,
|
|
53
|
+
41.73,
|
|
54
|
+
10.37,
|
|
55
|
+
23.63
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"cls": "abcjs-v0 abcjs-mm1 abcjs-n1",
|
|
60
|
+
"measure": 1,
|
|
61
|
+
"pitch": [
|
|
62
|
+
"C4",
|
|
63
|
+
"E4",
|
|
64
|
+
"G4"
|
|
65
|
+
],
|
|
66
|
+
"beat": 2,
|
|
67
|
+
"dur": 2,
|
|
68
|
+
"box": [
|
|
69
|
+
261.85,
|
|
70
|
+
57.23,
|
|
71
|
+
10.37,
|
|
72
|
+
23.63
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"beams": [],
|
|
77
|
+
"arcs": []
|
|
78
|
+
},
|
|
79
|
+
"renderers": {
|
|
80
|
+
"abcjs": {
|
|
81
|
+
"version": "6.7.2",
|
|
82
|
+
"options": {
|
|
83
|
+
"add_classes": true,
|
|
84
|
+
"staffwidth": 520,
|
|
85
|
+
"foregroundColor": "currentColor"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|