@ugfoundation/swaralipi-js 0.7.7 → 0.8.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/dist/{batch-6MCPHHKF.js → batch-NDL6CW7Q.js} +5 -5
- package/dist/{batch-6MCPHHKF.js.map → batch-NDL6CW7Q.js.map} +1 -1
- package/dist/{chunk-QM4CXKW2.js → chunk-4HNT6OAT.js} +24 -3
- package/dist/chunk-4HNT6OAT.js.map +1 -0
- package/dist/{chunk-TKTQCUKD.js → chunk-4IVUPMRK.js} +27 -9
- package/dist/chunk-4IVUPMRK.js.map +1 -0
- package/dist/{chunk-ALN4SWMS.js → chunk-LPCKL3AM.js} +15 -4
- package/dist/chunk-LPCKL3AM.js.map +1 -0
- package/dist/{chunk-QQC6WVLJ.js → chunk-Z42M5JAA.js} +4 -4
- package/dist/{chunk-QQC6WVLJ.js.map → chunk-Z42M5JAA.js.map} +1 -1
- package/dist/cli.cjs +13 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +3 -3
- package/dist/convert/index.cjs +12 -1
- package/dist/convert/index.cjs.map +1 -1
- package/dist/convert/index.d.cts +1 -1
- package/dist/convert/index.d.ts +1 -1
- package/dist/convert/index.js +3 -3
- package/dist/index.cjs +39 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{taals-CjzBuZ35.d.ts → lay-Csa4CD46.d.cts} +38 -1
- package/dist/{taals-CjzBuZ35.d.cts → lay-Ct9ky_EE.d.ts} +38 -1
- package/dist/player/index.cjs +276 -117
- package/dist/player/index.cjs.map +1 -1
- package/dist/player/index.d.cts +22 -9
- package/dist/player/index.d.ts +22 -9
- package/dist/player/index.js +230 -114
- package/dist/player/index.js.map +1 -1
- package/dist/{schedule-BpBYGXPL.d.cts → schedule-B_UaluBi.d.cts} +27 -3
- package/dist/{schedule-Tzk01FKj.d.ts → schedule-CdILTNsk.d.ts} +27 -3
- package/dist/{schema-DqBXPGkL.d.cts → schema-DGA_bNVZ.d.cts} +97 -1
- package/dist/{schema-DqBXPGkL.d.ts → schema-DGA_bNVZ.d.ts} +97 -1
- package/dist/spec/index.cjs +39 -1
- package/dist/spec/index.cjs.map +1 -1
- package/dist/spec/index.d.cts +16 -4
- package/dist/spec/index.d.ts +16 -4
- package/dist/spec/index.js +2 -2
- package/dist/viewer/index.cjs +146 -23
- package/dist/viewer/index.cjs.map +1 -1
- package/dist/viewer/index.d.cts +10 -5
- package/dist/viewer/index.d.ts +10 -5
- package/dist/viewer/index.js +75 -18
- package/dist/viewer/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ALN4SWMS.js.map +0 -1
- package/dist/chunk-QM4CXKW2.js.map +0 -1
- package/dist/chunk-TKTQCUKD.js.map +0 -1
package/dist/viewer/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { O as Octave, a as SvaraLetter, N as Note, M as Meta, S as Swaralipi, T as Taal } from '../schema-
|
|
2
|
-
import {
|
|
1
|
+
import { O as Octave, a as SvaraLetter, N as Note, M as Meta, S as Swaralipi, T as Taal } from '../schema-DGA_bNVZ.cjs';
|
|
2
|
+
import { L as Lay } from '../lay-Csa4CD46.cjs';
|
|
3
|
+
import { D as DrumVoice, S as Schedule, P as PlayEvent } from '../schedule-B_UaluBi.cjs';
|
|
3
4
|
import 'zod';
|
|
4
5
|
import 'tone';
|
|
5
|
-
import '../taals-CjzBuZ35.cjs';
|
|
6
6
|
|
|
7
7
|
/** Akarmatrik/Bhatkhande grid languages, rendered synchronously by renderToHtml. */
|
|
8
8
|
type GridLang = 'bn' | 'hi' | 'en';
|
|
@@ -27,6 +27,10 @@ declare const LABELS: Record<GridLang, {
|
|
|
27
27
|
avartan: string;
|
|
28
28
|
notationBy: string;
|
|
29
29
|
}>;
|
|
30
|
+
/** লয় tier names, printed where a row changes tempo. bn/hi keep the Indian
|
|
31
|
+
* term; en names the tempo first (a reader of the English sheet may not know
|
|
32
|
+
* the word — the same call `LABELS.en` makes with "Cycles" over "Avartan"). */
|
|
33
|
+
declare const LAY_LABELS: Record<GridLang, Record<Lay, string>>;
|
|
30
34
|
/** A composed notation cluster: the font's ASCII text plus any residual CSS
|
|
31
35
|
* classes the font itself cannot express (only the bn ati-octave dot). */
|
|
32
36
|
interface Cluster {
|
|
@@ -204,6 +208,7 @@ declare const ZOOM_STEP = 1.2;
|
|
|
204
208
|
* --sw-matra minimum width of one matra column
|
|
205
209
|
* --sw-header-min floor for the নাম/তাল/আবর্তন header (it must stay legible
|
|
206
210
|
* when the notation is scaled down to fit a phone)
|
|
211
|
+
* --sw-lay-min same floor for the লয় (tempo tier) marker band
|
|
207
212
|
* --sw-hl player-highlight background (P2.3)
|
|
208
213
|
* --sw-rule header rule / muted line color
|
|
209
214
|
*
|
|
@@ -231,7 +236,7 @@ declare const SWARALIPI_CSS: string;
|
|
|
231
236
|
* - rows are un-clipped (no scrollbar on paper) and kept whole across page
|
|
232
237
|
* breaks; part headings stay with their first row.
|
|
233
238
|
*/
|
|
234
|
-
declare const SWARALIPI_PRINT_CSS = "\n@page { margin: 16mm; }\n@media print {\n .sw-sheet, .sw-staff { -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #000; }\n .sw-scroll { overflow: visible !important; }\n .sw-row { break-inside: avoid; page-break-inside: avoid; }\n .sw-part-name, .sw-header { break-after: avoid-page; page-break-after: avoid; }\n .sw-hl { background: none !important; }\n /* Keep each engraved staff system whole across a page break (the abcjs line\n is a <div> wrapping the <svg>, so the break rule must sit on the div). */\n .sw-staff-lines > div { break-inside: avoid; page-break-inside: avoid; }\n .sw-staff-meta { break-after: avoid-page; page-break-after: avoid; }\n}\n";
|
|
239
|
+
declare const SWARALIPI_PRINT_CSS = "\n@page { margin: 16mm; }\n@media print {\n .sw-sheet, .sw-staff { -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #000; }\n .sw-scroll { overflow: visible !important; }\n .sw-row { break-inside: avoid; page-break-inside: avoid; }\n .sw-part-name, .sw-header, .sw-lay { break-after: avoid-page; page-break-after: avoid; }\n .sw-hl { background: none !important; }\n /* Keep each engraved staff system whole across a page break (the abcjs line\n is a <div> wrapping the <svg>, so the break rule must sit on the div). */\n .sw-staff-lines > div { break-inside: avoid; page-break-inside: avoid; }\n .sw-staff-meta { break-after: avoid-page; page-break-after: avoid; }\n}\n";
|
|
235
240
|
/** Staff-notation (abcjs) wrapper chrome: instrument/tempo header + a fluid
|
|
236
241
|
* SVG. The engraving itself is drawn by abcjs; this only frames it. */
|
|
237
242
|
declare const SWARALIPI_STAFF_CSS = "\n.sw-staff { color: currentColor; }\n.sw-staff-meta { display: flex; gap: 1.25em; align-items: baseline; margin: 0 0 .5em; font-size: .95em; opacity: .85; }\n.sw-staff-instrument { font-weight: 600; }\n.sw-staff-drums { opacity: .75; }\n.sw-staff-tempo { font-variant-numeric: tabular-nums; }\n/* abcjs (oneSvgPerLine) wraps the music into one <div><svg> per system; stack\n them as short, swaralipi-style lines. abcjs sets a fixed pixel height +\n overflow:hidden on each wrapper div \u2014 neutralise it so the viewBox'd SVG can\n scale to the container (and to the print page) instead of being clipped. */\n.sw-staff-lines > div { margin: 0 0 .35em; height: auto !important; overflow: visible !important; }\n/* Fill up to the engraved (staffwidth) size \u2014 shrink to fit a narrow container,\n but never stretch past natural width (abcToSvg pins per-SVG max-width in px),\n else a short last system balloons. */\n.sw-staff-lines svg { display: block; width: 100%; height: auto; }\n.sw-staff-missing { padding: 1em; border: 1px dashed currentColor; border-radius: 6px; opacity: .8; font-size: .9em; }\n.sw-staff-title { font-size: 1.15em; font-weight: 700; }\n.sw-staff-subtitle { opacity: .8; font-size: .95em; margin-top: .15em; }\n";
|
|
@@ -522,4 +527,4 @@ type Transliterator = (bengaliText: string) => string;
|
|
|
522
527
|
*/
|
|
523
528
|
declare function loadLyricTransliterator(lang: ViewerLang): Promise<Transliterator | undefined>;
|
|
524
529
|
|
|
525
|
-
export { type Arc, type Cell, type Cluster, type ComposeOptions, DEFAULT_NOTATOR, DEFAULT_WATERMARK, DIGITS, type GridLang, LABELS, type Layout, MARKS, MAX_ZOOM, MIN_ZOOM, NOTATION_FONT_URLS, type PrintOptions, type RenderOptions, SWARALIPI_CSS, SWARALIPI_PRINT_CSS, SWARALIPI_STAFF_CSS, type StaffOptions, type SwaralipiSheetElement, type TaalStaffOptions, type Transliterator, type ViewerLang, ZOOM_STEP, abcDuration, abcToSvg, alignRows, buildAbc, buildTaalAbc, cellMatra, composeCluster, defineSwaralipiSheet, docToAbc, fitSwaralipi, groupRowIntoCells, loadLyricTransliterator, localizeDigits, midiToAbc, printSwaralipi, renderMetaHeader, renderPrintDocument, renderStaffHtml, renderStaffPrintDocument, renderTaalStaffHtml, renderToHtml, resolveArcs };
|
|
530
|
+
export { type Arc, type Cell, type Cluster, type ComposeOptions, DEFAULT_NOTATOR, DEFAULT_WATERMARK, DIGITS, type GridLang, LABELS, LAY_LABELS, type Layout, MARKS, MAX_ZOOM, MIN_ZOOM, NOTATION_FONT_URLS, type PrintOptions, type RenderOptions, SWARALIPI_CSS, SWARALIPI_PRINT_CSS, SWARALIPI_STAFF_CSS, type StaffOptions, type SwaralipiSheetElement, type TaalStaffOptions, type Transliterator, type ViewerLang, ZOOM_STEP, abcDuration, abcToSvg, alignRows, buildAbc, buildTaalAbc, cellMatra, composeCluster, defineSwaralipiSheet, docToAbc, fitSwaralipi, groupRowIntoCells, loadLyricTransliterator, localizeDigits, midiToAbc, printSwaralipi, renderMetaHeader, renderPrintDocument, renderStaffHtml, renderStaffPrintDocument, renderTaalStaffHtml, renderToHtml, resolveArcs };
|
package/dist/viewer/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { O as Octave, a as SvaraLetter, N as Note, M as Meta, S as Swaralipi, T as Taal } from '../schema-
|
|
2
|
-
import {
|
|
1
|
+
import { O as Octave, a as SvaraLetter, N as Note, M as Meta, S as Swaralipi, T as Taal } from '../schema-DGA_bNVZ.js';
|
|
2
|
+
import { L as Lay } from '../lay-Ct9ky_EE.js';
|
|
3
|
+
import { D as DrumVoice, S as Schedule, P as PlayEvent } from '../schedule-CdILTNsk.js';
|
|
3
4
|
import 'zod';
|
|
4
5
|
import 'tone';
|
|
5
|
-
import '../taals-CjzBuZ35.js';
|
|
6
6
|
|
|
7
7
|
/** Akarmatrik/Bhatkhande grid languages, rendered synchronously by renderToHtml. */
|
|
8
8
|
type GridLang = 'bn' | 'hi' | 'en';
|
|
@@ -27,6 +27,10 @@ declare const LABELS: Record<GridLang, {
|
|
|
27
27
|
avartan: string;
|
|
28
28
|
notationBy: string;
|
|
29
29
|
}>;
|
|
30
|
+
/** লয় tier names, printed where a row changes tempo. bn/hi keep the Indian
|
|
31
|
+
* term; en names the tempo first (a reader of the English sheet may not know
|
|
32
|
+
* the word — the same call `LABELS.en` makes with "Cycles" over "Avartan"). */
|
|
33
|
+
declare const LAY_LABELS: Record<GridLang, Record<Lay, string>>;
|
|
30
34
|
/** A composed notation cluster: the font's ASCII text plus any residual CSS
|
|
31
35
|
* classes the font itself cannot express (only the bn ati-octave dot). */
|
|
32
36
|
interface Cluster {
|
|
@@ -204,6 +208,7 @@ declare const ZOOM_STEP = 1.2;
|
|
|
204
208
|
* --sw-matra minimum width of one matra column
|
|
205
209
|
* --sw-header-min floor for the নাম/তাল/আবর্তন header (it must stay legible
|
|
206
210
|
* when the notation is scaled down to fit a phone)
|
|
211
|
+
* --sw-lay-min same floor for the লয় (tempo tier) marker band
|
|
207
212
|
* --sw-hl player-highlight background (P2.3)
|
|
208
213
|
* --sw-rule header rule / muted line color
|
|
209
214
|
*
|
|
@@ -231,7 +236,7 @@ declare const SWARALIPI_CSS: string;
|
|
|
231
236
|
* - rows are un-clipped (no scrollbar on paper) and kept whole across page
|
|
232
237
|
* breaks; part headings stay with their first row.
|
|
233
238
|
*/
|
|
234
|
-
declare const SWARALIPI_PRINT_CSS = "\n@page { margin: 16mm; }\n@media print {\n .sw-sheet, .sw-staff { -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #000; }\n .sw-scroll { overflow: visible !important; }\n .sw-row { break-inside: avoid; page-break-inside: avoid; }\n .sw-part-name, .sw-header { break-after: avoid-page; page-break-after: avoid; }\n .sw-hl { background: none !important; }\n /* Keep each engraved staff system whole across a page break (the abcjs line\n is a <div> wrapping the <svg>, so the break rule must sit on the div). */\n .sw-staff-lines > div { break-inside: avoid; page-break-inside: avoid; }\n .sw-staff-meta { break-after: avoid-page; page-break-after: avoid; }\n}\n";
|
|
239
|
+
declare const SWARALIPI_PRINT_CSS = "\n@page { margin: 16mm; }\n@media print {\n .sw-sheet, .sw-staff { -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #000; }\n .sw-scroll { overflow: visible !important; }\n .sw-row { break-inside: avoid; page-break-inside: avoid; }\n .sw-part-name, .sw-header, .sw-lay { break-after: avoid-page; page-break-after: avoid; }\n .sw-hl { background: none !important; }\n /* Keep each engraved staff system whole across a page break (the abcjs line\n is a <div> wrapping the <svg>, so the break rule must sit on the div). */\n .sw-staff-lines > div { break-inside: avoid; page-break-inside: avoid; }\n .sw-staff-meta { break-after: avoid-page; page-break-after: avoid; }\n}\n";
|
|
235
240
|
/** Staff-notation (abcjs) wrapper chrome: instrument/tempo header + a fluid
|
|
236
241
|
* SVG. The engraving itself is drawn by abcjs; this only frames it. */
|
|
237
242
|
declare const SWARALIPI_STAFF_CSS = "\n.sw-staff { color: currentColor; }\n.sw-staff-meta { display: flex; gap: 1.25em; align-items: baseline; margin: 0 0 .5em; font-size: .95em; opacity: .85; }\n.sw-staff-instrument { font-weight: 600; }\n.sw-staff-drums { opacity: .75; }\n.sw-staff-tempo { font-variant-numeric: tabular-nums; }\n/* abcjs (oneSvgPerLine) wraps the music into one <div><svg> per system; stack\n them as short, swaralipi-style lines. abcjs sets a fixed pixel height +\n overflow:hidden on each wrapper div \u2014 neutralise it so the viewBox'd SVG can\n scale to the container (and to the print page) instead of being clipped. */\n.sw-staff-lines > div { margin: 0 0 .35em; height: auto !important; overflow: visible !important; }\n/* Fill up to the engraved (staffwidth) size \u2014 shrink to fit a narrow container,\n but never stretch past natural width (abcToSvg pins per-SVG max-width in px),\n else a short last system balloons. */\n.sw-staff-lines svg { display: block; width: 100%; height: auto; }\n.sw-staff-missing { padding: 1em; border: 1px dashed currentColor; border-radius: 6px; opacity: .8; font-size: .9em; }\n.sw-staff-title { font-size: 1.15em; font-weight: 700; }\n.sw-staff-subtitle { opacity: .8; font-size: .95em; margin-top: .15em; }\n";
|
|
@@ -522,4 +527,4 @@ type Transliterator = (bengaliText: string) => string;
|
|
|
522
527
|
*/
|
|
523
528
|
declare function loadLyricTransliterator(lang: ViewerLang): Promise<Transliterator | undefined>;
|
|
524
529
|
|
|
525
|
-
export { type Arc, type Cell, type Cluster, type ComposeOptions, DEFAULT_NOTATOR, DEFAULT_WATERMARK, DIGITS, type GridLang, LABELS, type Layout, MARKS, MAX_ZOOM, MIN_ZOOM, NOTATION_FONT_URLS, type PrintOptions, type RenderOptions, SWARALIPI_CSS, SWARALIPI_PRINT_CSS, SWARALIPI_STAFF_CSS, type StaffOptions, type SwaralipiSheetElement, type TaalStaffOptions, type Transliterator, type ViewerLang, ZOOM_STEP, abcDuration, abcToSvg, alignRows, buildAbc, buildTaalAbc, cellMatra, composeCluster, defineSwaralipiSheet, docToAbc, fitSwaralipi, groupRowIntoCells, loadLyricTransliterator, localizeDigits, midiToAbc, printSwaralipi, renderMetaHeader, renderPrintDocument, renderStaffHtml, renderStaffPrintDocument, renderTaalStaffHtml, renderToHtml, resolveArcs };
|
|
530
|
+
export { type Arc, type Cell, type Cluster, type ComposeOptions, DEFAULT_NOTATOR, DEFAULT_WATERMARK, DIGITS, type GridLang, LABELS, LAY_LABELS, type Layout, MARKS, MAX_ZOOM, MIN_ZOOM, NOTATION_FONT_URLS, type PrintOptions, type RenderOptions, SWARALIPI_CSS, SWARALIPI_PRINT_CSS, SWARALIPI_STAFF_CSS, type StaffOptions, type SwaralipiSheetElement, type TaalStaffOptions, type Transliterator, type ViewerLang, ZOOM_STEP, abcDuration, abcToSvg, alignRows, buildAbc, buildTaalAbc, cellMatra, composeCluster, defineSwaralipiSheet, docToAbc, fitSwaralipi, groupRowIntoCells, loadLyricTransliterator, localizeDigits, midiToAbc, printSwaralipi, renderMetaHeader, renderPrintDocument, renderStaffHtml, renderStaffPrintDocument, renderTaalStaffHtml, renderToHtml, resolveArcs };
|
package/dist/viewer/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isArcRaw, glideTargets, buildSchedule, drumPattern } from '../chunk-
|
|
2
|
-
import { hasKomal, TAALS, graceNotes } from '../chunk-
|
|
1
|
+
import { isArcRaw, glideTargets, buildSchedule, drumPattern } from '../chunk-4IVUPMRK.js';
|
|
2
|
+
import { hasKomal, TAALS, graceNotes } from '../chunk-4HNT6OAT.js';
|
|
3
3
|
|
|
4
4
|
// src/viewer/glyphs.ts
|
|
5
5
|
var SWARABITAN_SHUDDHA = {
|
|
@@ -44,6 +44,11 @@ var LABELS = {
|
|
|
44
44
|
// one taal cycle is exactly what the number counts.
|
|
45
45
|
en: { title: "Song", taal: "Taal", raag: "Raag", avartan: "Cycles", notationBy: "Notator" }
|
|
46
46
|
};
|
|
47
|
+
var LAY_LABELS = {
|
|
48
|
+
bn: { drut: "\u09A6\u09CD\u09B0\u09C1\u09A4 \u09B2\u09AF\u09BC", madhya: "\u09AE\u09A7\u09CD\u09AF \u09B2\u09AF\u09BC", vilambit: "\u09AC\u09BF\u09B2\u09AE\u09CD\u09AC\u09BF\u09A4 \u09B2\u09AF\u09BC" },
|
|
49
|
+
hi: { drut: "\u0926\u094D\u0930\u0941\u0924 \u0932\u092F", madhya: "\u092E\u0927\u094D\u092F \u0932\u092F", vilambit: "\u0935\u093F\u0932\u0902\u092C\u093F\u0924 \u0932\u092F" },
|
|
50
|
+
en: { drut: "Fast (drut)", madhya: "Medium (madhya)", vilambit: "Slow (vilambit)" }
|
|
51
|
+
};
|
|
47
52
|
function composeCluster(letter, opts) {
|
|
48
53
|
const classes = [];
|
|
49
54
|
if (opts.lang === "bn") {
|
|
@@ -409,16 +414,20 @@ function renderNote(note, kind, opts, ctx) {
|
|
|
409
414
|
}
|
|
410
415
|
function renderArc(arc, offset) {
|
|
411
416
|
const open = arc.line === true;
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
const
|
|
418
|
-
const
|
|
419
|
-
const
|
|
420
|
-
const
|
|
421
|
-
|
|
417
|
+
const openL = arc.openLeft || open;
|
|
418
|
+
const openR = arc.openRight || open;
|
|
419
|
+
const fill = '<i class="sw-arc-m"></i>';
|
|
420
|
+
const hookL = openL ? "" : '<i class="sw-arc-l">w</i>';
|
|
421
|
+
const hookR = openR ? "" : '<i class="sw-arc-r">x</i>';
|
|
422
|
+
const piece = (col, cls, inner) => `<span class="sw-arc${cls}" style="grid-column:${col}">${inner}</span>`;
|
|
423
|
+
const f = offset + arc.start + COL_BASE;
|
|
424
|
+
const t = offset + arc.end + COL_BASE;
|
|
425
|
+
const openCls = (openL ? " sw-arc--openl" : "") + (openR ? " sw-arc--openr" : "");
|
|
426
|
+
if (t === f) return piece(`${f}`, openCls, hookL + fill + hookR);
|
|
427
|
+
const head = piece(`${f}`, openL ? " sw-arc--openl" : " sw-arc--head", hookL + fill);
|
|
428
|
+
const tail = piece(`${t}`, openR ? " sw-arc--openr" : " sw-arc--tail", fill + hookR);
|
|
429
|
+
const mid = t > f + 1 ? piece(`${f + 1} / ${t}`, " sw-arc--mid", fill) : "";
|
|
430
|
+
return head + mid + tail;
|
|
422
431
|
}
|
|
423
432
|
function renderRow(row, partIdx, rowIdx, offset, ctx) {
|
|
424
433
|
const cells = groupRowIntoCells(row.notes);
|
|
@@ -478,11 +487,18 @@ function renderToHtml(doc, opts = {}) {
|
|
|
478
487
|
if (opts.showHeader !== false) out.push(renderHeader(doc.meta, ctx));
|
|
479
488
|
out.push(`<div class="sw-scroll"><div class="sw-block" style="${tracks}">`);
|
|
480
489
|
let n = 0;
|
|
490
|
+
let lay;
|
|
481
491
|
doc.parts.forEach((part, p) => {
|
|
482
492
|
out.push('<section class="sw-part">');
|
|
483
493
|
if (part.name !== void 0)
|
|
484
494
|
out.push(`<h3 class="sw-part-name">${escapeHtml(ctx.tr(part.name))}</h3>`);
|
|
485
|
-
part.rows.forEach((row, r) =>
|
|
495
|
+
part.rows.forEach((row, r) => {
|
|
496
|
+
if (row.lay !== void 0 && row.lay !== lay) {
|
|
497
|
+
lay = row.lay;
|
|
498
|
+
out.push(`<div class="sw-lay" data-lay="${lay}">${escapeHtml(LAY_LABELS[ctx.lang][lay])}</div>`);
|
|
499
|
+
}
|
|
500
|
+
out.push(renderRow(row, p, r, layout.offsets[n++], ctx));
|
|
501
|
+
});
|
|
486
502
|
out.push("</section>");
|
|
487
503
|
});
|
|
488
504
|
out.push("</div></div></div>");
|
|
@@ -574,6 +590,30 @@ ${FONT_FACES}
|
|
|
574
590
|
|
|
575
591
|
.sw-part-name { font-size: 0.85em; font-weight: 600; margin: 1em 0 0.2em; opacity: 0.85; }
|
|
576
592
|
|
|
593
|
+
/* \u09B2\u09AF\u09BC marker: the line where the tempo tier turns over. A full-width rule
|
|
594
|
+
rather than a row label \u2014 the label track is what the notation columns are
|
|
595
|
+
measured against, and a six-em word in it would shove the whole sheet right. */
|
|
596
|
+
.sw-lay {
|
|
597
|
+
grid-column: 1 / -1;
|
|
598
|
+
display: flex;
|
|
599
|
+
align-items: center;
|
|
600
|
+
gap: 0.6em;
|
|
601
|
+
margin: 0.8em 0 0;
|
|
602
|
+
/* Floored like the header: fitSwaralipi shrinks the sheet to fit the
|
|
603
|
+
notation's columns, and this label has none to align. */
|
|
604
|
+
font-size: max(0.7em, var(--sw-lay-min, 0.72rem));
|
|
605
|
+
font-weight: 600;
|
|
606
|
+
letter-spacing: 0.09em;
|
|
607
|
+
opacity: 0.75;
|
|
608
|
+
break-after: avoid;
|
|
609
|
+
}
|
|
610
|
+
.sw-lay::after {
|
|
611
|
+
content: '';
|
|
612
|
+
flex: 1;
|
|
613
|
+
height: 1px;
|
|
614
|
+
background: var(--sw-rule, rgba(128, 128, 128, 0.35));
|
|
615
|
+
}
|
|
616
|
+
|
|
577
617
|
/* ---- block grid: ONE column set for the whole sheet ----
|
|
578
618
|
* NLTR emits a song as a single html table, which is why its lines align
|
|
579
619
|
* down the page. Same here: .sw-block owns the tracks, every .sw-row
|
|
@@ -698,9 +738,26 @@ ${FONT_FACES}
|
|
|
698
738
|
align-items: baseline;
|
|
699
739
|
line-height: 1;
|
|
700
740
|
font-family: Swarabitan, var(--sw-font, sans-serif);
|
|
701
|
-
|
|
741
|
+
/* The 0.9em sits on the children, not here: the end pieces below size
|
|
742
|
+
themselves off the block's own column-gap, which is in the block's em. */
|
|
702
743
|
}
|
|
744
|
+
.sw-arc > i, .sw-arc::before { font-size: 0.9em; }
|
|
703
745
|
.sw-arc-l, .sw-arc-r { flex: none; font-style: normal; }
|
|
746
|
+
/* Every piece needs the same baseline \u2014 the fill rides it, so a piece holding
|
|
747
|
+
only fill would otherwise drop to the bottom of the row. A zero-width copy
|
|
748
|
+
of the hook glyph is the strut (same font, same metrics). */
|
|
749
|
+
.sw-arc::before { content: 'w'; flex: none; width: 0; overflow: hidden; }
|
|
750
|
+
/* The ends hang from the two notes' CENTRES, as the print sets them, so the
|
|
751
|
+
arc is three grid items: each end piece takes half of its own column plus
|
|
752
|
+
the column-gap it has to bridge, and the negative margin on the same side
|
|
753
|
+
lets that bridge overhang the grid area instead of shifting the piece. */
|
|
754
|
+
.sw-arc--head, .sw-arc--tail {
|
|
755
|
+
--sw-arc-gap: calc(var(--sw-cell-gap, 0.4em) * var(--sw-tight, 1));
|
|
756
|
+
width: calc(50% + var(--sw-arc-gap));
|
|
757
|
+
}
|
|
758
|
+
.sw-arc--head { justify-self: end; margin-right: calc(var(--sw-arc-gap) * -1); }
|
|
759
|
+
.sw-arc--tail { justify-self: start; margin-left: calc(var(--sw-arc-gap) * -1);
|
|
760
|
+
justify-content: flex-end; }
|
|
704
761
|
/* The fill's geometry is measured off the font's own 'y' glyph: ink 0.11em
|
|
705
762
|
tall whose bottom sits 0.01em above the baseline. An empty inline-block
|
|
706
763
|
takes its bottom margin edge as its baseline, so -0.01em lifts the bar to
|
|
@@ -758,7 +815,7 @@ var SWARALIPI_PRINT_CSS = `
|
|
|
758
815
|
.sw-sheet, .sw-staff { -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #000; }
|
|
759
816
|
.sw-scroll { overflow: visible !important; }
|
|
760
817
|
.sw-row { break-inside: avoid; page-break-inside: avoid; }
|
|
761
|
-
.sw-part-name, .sw-header { break-after: avoid-page; page-break-after: avoid; }
|
|
818
|
+
.sw-part-name, .sw-header, .sw-lay { break-after: avoid-page; page-break-after: avoid; }
|
|
762
819
|
.sw-hl { background: none !important; }
|
|
763
820
|
/* Keep each engraved staff system whole across a page break (the abcjs line
|
|
764
821
|
is a <div> wrapping the <svg>, so the break rule must sit on the div). */
|
|
@@ -911,7 +968,7 @@ function resolveDrumTaal(doc) {
|
|
|
911
968
|
return id !== void 0 && id in TAALS ? TAALS[id] : { numBeats: 4, sam: 0 };
|
|
912
969
|
}
|
|
913
970
|
function docToAbc(doc, opts = {}) {
|
|
914
|
-
const schedule = buildSchedule(doc, { tonic: opts.tonic, baseOctave: opts.baseOctave });
|
|
971
|
+
const schedule = buildSchedule(doc, { tonic: opts.tonic, baseOctave: opts.baseOctave, lay: false });
|
|
915
972
|
const bpm = opts.bpm ?? doc.meta.bpm ?? 90;
|
|
916
973
|
const beatsPerBar = opts.beatsPerBar ?? doc.meta.taal?.numBeats ?? 4;
|
|
917
974
|
const drums = opts.drums ? drumPattern(resolveDrumTaal(doc)) : void 0;
|
|
@@ -975,7 +1032,7 @@ async function abcToSvg(abc, opts = {}, notePaths) {
|
|
|
975
1032
|
async function renderStaffHtml(doc, opts = {}) {
|
|
976
1033
|
const bpm = opts.bpm ?? doc.meta.bpm ?? 90;
|
|
977
1034
|
const abc = docToAbc(doc, { ...opts, bpm });
|
|
978
|
-
const schedule = buildSchedule(doc, { tonic: opts.tonic, baseOctave: opts.baseOctave });
|
|
1035
|
+
const schedule = buildSchedule(doc, { tonic: opts.tonic, baseOctave: opts.baseOctave, lay: false });
|
|
979
1036
|
const engraved = await abcToSvg(abc, opts, eventPaths(schedule));
|
|
980
1037
|
const lines = engraved.includes("sw-staff-missing") ? engraved : `<div class="sw-staff-lines">${engraved}</div>`;
|
|
981
1038
|
const header = opts.showHeader === false ? "" : renderMetaHeader(doc.meta, opts.headerLang ?? "en", opts.transliterate);
|
|
@@ -1382,6 +1439,6 @@ function defineSwaralipiSheet(tagName = "swaralipi-sheet") {
|
|
|
1382
1439
|
return ctor;
|
|
1383
1440
|
}
|
|
1384
1441
|
|
|
1385
|
-
export { DEFAULT_NOTATOR, DEFAULT_WATERMARK, DIGITS, LABELS, MARKS, MAX_ZOOM, MIN_ZOOM, NOTATION_FONT_URLS, SWARALIPI_CSS, SWARALIPI_PRINT_CSS, SWARALIPI_STAFF_CSS, ZOOM_STEP, abcDuration, abcToSvg, alignRows, buildAbc, buildTaalAbc, cellMatra, composeCluster, defineSwaralipiSheet, docToAbc, fitSwaralipi, groupRowIntoCells, loadLyricTransliterator, localizeDigits, midiToAbc, printSwaralipi, renderMetaHeader, renderPrintDocument, renderStaffHtml, renderStaffPrintDocument, renderTaalStaffHtml, renderToHtml, resolveArcs };
|
|
1442
|
+
export { DEFAULT_NOTATOR, DEFAULT_WATERMARK, DIGITS, LABELS, LAY_LABELS, MARKS, MAX_ZOOM, MIN_ZOOM, NOTATION_FONT_URLS, SWARALIPI_CSS, SWARALIPI_PRINT_CSS, SWARALIPI_STAFF_CSS, ZOOM_STEP, abcDuration, abcToSvg, alignRows, buildAbc, buildTaalAbc, cellMatra, composeCluster, defineSwaralipiSheet, docToAbc, fitSwaralipi, groupRowIntoCells, loadLyricTransliterator, localizeDigits, midiToAbc, printSwaralipi, renderMetaHeader, renderPrintDocument, renderStaffHtml, renderStaffPrintDocument, renderTaalStaffHtml, renderToHtml, resolveArcs };
|
|
1386
1443
|
//# sourceMappingURL=index.js.map
|
|
1387
1444
|
//# sourceMappingURL=index.js.map
|