@ugfoundation/swaralipi-js 0.7.6 → 0.8.0
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-5NMEPJ6E.js → batch-NJMT3M5Z.js} +5 -5
- package/dist/{batch-5NMEPJ6E.js.map → batch-NJMT3M5Z.js.map} +1 -1
- package/dist/{chunk-ITOP5O5M.js → chunk-4HMHTXDE.js} +15 -4
- package/dist/chunk-4HMHTXDE.js.map +1 -0
- package/dist/{chunk-UF5OSJRP.js → chunk-4HNT6OAT.js} +32 -3
- package/dist/chunk-4HNT6OAT.js.map +1 -0
- package/dist/{chunk-2SAZWTTK.js → chunk-4IVUPMRK.js} +29 -11
- package/dist/chunk-4IVUPMRK.js.map +1 -0
- package/dist/{chunk-NJGHFQJP.js → chunk-YFVAVICF.js} +4 -4
- package/dist/{chunk-NJGHFQJP.js.map → chunk-YFVAVICF.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 +49 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- 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 +286 -119
- 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.ts → schema-DGA_bNVZ.d.cts} +97 -1
- package/dist/{schema-DqBXPGkL.d.cts → schema-DGA_bNVZ.d.ts} +97 -1
- package/dist/spec/index.cjs +49 -1
- package/dist/spec/index.cjs.map +1 -1
- package/dist/spec/index.d.cts +31 -5
- package/dist/spec/index.d.ts +31 -5
- package/dist/spec/index.js +2 -2
- package/dist/viewer/index.cjs +134 -16
- package/dist/viewer/index.cjs.map +1 -1
- package/dist/viewer/index.d.cts +10 -32
- package/dist/viewer/index.d.ts +10 -32
- package/dist/viewer/index.js +44 -9
- package/dist/viewer/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2SAZWTTK.js.map +0 -1
- package/dist/chunk-ITOP5O5M.js.map +0 -1
- package/dist/chunk-UF5OSJRP.js.map +0 -1
package/dist/viewer/index.d.cts
CHANGED
|
@@ -1,35 +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
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Per-language notation encoding for the viewer.
|
|
9
|
-
*
|
|
10
|
-
* Every language renders its notation through a dedicated, purpose-built
|
|
11
|
-
* font whose glyphs ARE the akarmatrik/Bhatkhande marks — so composeCluster
|
|
12
|
-
* emits that font's ASCII encoding and the font does all the hard work
|
|
13
|
-
* (komal/tivra forms, octave reph/dots, matra). This is why the viewer no
|
|
14
|
-
* longer touches Unicode cluster composition at all: the old reph-over-
|
|
15
|
-
* vowel, hasanta-before-matra and dotted-circle hazards simply don't exist
|
|
16
|
-
* when the font supplies precomposed glyphs keyed by plain ASCII.
|
|
17
|
-
*
|
|
18
|
-
* - bn → NLTR's **Swarabitan** (the akarmatrik font this project decodes).
|
|
19
|
-
* Letters s r g m p q n = স র গ ম প ধ ন (q=ধ); komal v t d u = ঋ জ্ঞ দ ণ;
|
|
20
|
-
* tivra ma k = the authentic কড়ি-ম conjunct (ম-based — has NO Unicode
|
|
21
|
-
* form, which is what forced this whole approach); suffix f = taar reph,
|
|
22
|
-
* h = mandra hasanta; trailing a = the আ-কার matra carrier. See codec.ts.
|
|
23
|
-
* - hi/en → **Ome Bhatkhande** Hindi/English (SIL OFL 1.1, © Omenad —
|
|
24
|
-
* github.com/omenad/fonts). Same clean keymap for both: lowercase
|
|
25
|
-
* s r g m p d n = the seven shuddha swaras, uppercase R G M D N = komal
|
|
26
|
-
* Re/Ga, tivra Ma, komal Dha/Ni; octave suffix u/l = taar/mandra dot,
|
|
27
|
-
* U/L = ati (two dots). Bhatkhande has no আ-কার, so no matra is appended.
|
|
28
|
-
*
|
|
29
|
-
* The font is applied by CSS keyed on `.sw-sheet`'s `lang` (see styles.ts);
|
|
30
|
-
* composeCluster only chooses the ASCII. The single residual CSS mark is the
|
|
31
|
-
* bn ati-octave extra dot (Swarabitan's f/h are single reph/hasanta only).
|
|
32
|
-
*/
|
|
33
6
|
|
|
34
7
|
/** Akarmatrik/Bhatkhande grid languages, rendered synchronously by renderToHtml. */
|
|
35
8
|
type GridLang = 'bn' | 'hi' | 'en';
|
|
@@ -54,6 +27,10 @@ declare const LABELS: Record<GridLang, {
|
|
|
54
27
|
avartan: string;
|
|
55
28
|
notationBy: string;
|
|
56
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>>;
|
|
57
34
|
/** A composed notation cluster: the font's ASCII text plus any residual CSS
|
|
58
35
|
* classes the font itself cannot express (only the bn ati-octave dot). */
|
|
59
36
|
interface Cluster {
|
|
@@ -231,6 +208,7 @@ declare const ZOOM_STEP = 1.2;
|
|
|
231
208
|
* --sw-matra minimum width of one matra column
|
|
232
209
|
* --sw-header-min floor for the নাম/তাল/আবর্তন header (it must stay legible
|
|
233
210
|
* when the notation is scaled down to fit a phone)
|
|
211
|
+
* --sw-lay-min same floor for the লয় (tempo tier) marker band
|
|
234
212
|
* --sw-hl player-highlight background (P2.3)
|
|
235
213
|
* --sw-rule header rule / muted line color
|
|
236
214
|
*
|
|
@@ -258,7 +236,7 @@ declare const SWARALIPI_CSS: string;
|
|
|
258
236
|
* - rows are un-clipped (no scrollbar on paper) and kept whole across page
|
|
259
237
|
* breaks; part headings stay with their first row.
|
|
260
238
|
*/
|
|
261
|
-
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";
|
|
262
240
|
/** Staff-notation (abcjs) wrapper chrome: instrument/tempo header + a fluid
|
|
263
241
|
* SVG. The engraving itself is drawn by abcjs; this only frames it. */
|
|
264
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";
|
|
@@ -549,4 +527,4 @@ type Transliterator = (bengaliText: string) => string;
|
|
|
549
527
|
*/
|
|
550
528
|
declare function loadLyricTransliterator(lang: ViewerLang): Promise<Transliterator | undefined>;
|
|
551
529
|
|
|
552
|
-
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,35 +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
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Per-language notation encoding for the viewer.
|
|
9
|
-
*
|
|
10
|
-
* Every language renders its notation through a dedicated, purpose-built
|
|
11
|
-
* font whose glyphs ARE the akarmatrik/Bhatkhande marks — so composeCluster
|
|
12
|
-
* emits that font's ASCII encoding and the font does all the hard work
|
|
13
|
-
* (komal/tivra forms, octave reph/dots, matra). This is why the viewer no
|
|
14
|
-
* longer touches Unicode cluster composition at all: the old reph-over-
|
|
15
|
-
* vowel, hasanta-before-matra and dotted-circle hazards simply don't exist
|
|
16
|
-
* when the font supplies precomposed glyphs keyed by plain ASCII.
|
|
17
|
-
*
|
|
18
|
-
* - bn → NLTR's **Swarabitan** (the akarmatrik font this project decodes).
|
|
19
|
-
* Letters s r g m p q n = স র গ ম প ধ ন (q=ধ); komal v t d u = ঋ জ্ঞ দ ণ;
|
|
20
|
-
* tivra ma k = the authentic কড়ি-ম conjunct (ম-based — has NO Unicode
|
|
21
|
-
* form, which is what forced this whole approach); suffix f = taar reph,
|
|
22
|
-
* h = mandra hasanta; trailing a = the আ-কার matra carrier. See codec.ts.
|
|
23
|
-
* - hi/en → **Ome Bhatkhande** Hindi/English (SIL OFL 1.1, © Omenad —
|
|
24
|
-
* github.com/omenad/fonts). Same clean keymap for both: lowercase
|
|
25
|
-
* s r g m p d n = the seven shuddha swaras, uppercase R G M D N = komal
|
|
26
|
-
* Re/Ga, tivra Ma, komal Dha/Ni; octave suffix u/l = taar/mandra dot,
|
|
27
|
-
* U/L = ati (two dots). Bhatkhande has no আ-কার, so no matra is appended.
|
|
28
|
-
*
|
|
29
|
-
* The font is applied by CSS keyed on `.sw-sheet`'s `lang` (see styles.ts);
|
|
30
|
-
* composeCluster only chooses the ASCII. The single residual CSS mark is the
|
|
31
|
-
* bn ati-octave extra dot (Swarabitan's f/h are single reph/hasanta only).
|
|
32
|
-
*/
|
|
33
6
|
|
|
34
7
|
/** Akarmatrik/Bhatkhande grid languages, rendered synchronously by renderToHtml. */
|
|
35
8
|
type GridLang = 'bn' | 'hi' | 'en';
|
|
@@ -54,6 +27,10 @@ declare const LABELS: Record<GridLang, {
|
|
|
54
27
|
avartan: string;
|
|
55
28
|
notationBy: string;
|
|
56
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>>;
|
|
57
34
|
/** A composed notation cluster: the font's ASCII text plus any residual CSS
|
|
58
35
|
* classes the font itself cannot express (only the bn ati-octave dot). */
|
|
59
36
|
interface Cluster {
|
|
@@ -231,6 +208,7 @@ declare const ZOOM_STEP = 1.2;
|
|
|
231
208
|
* --sw-matra minimum width of one matra column
|
|
232
209
|
* --sw-header-min floor for the নাম/তাল/আবর্তন header (it must stay legible
|
|
233
210
|
* when the notation is scaled down to fit a phone)
|
|
211
|
+
* --sw-lay-min same floor for the লয় (tempo tier) marker band
|
|
234
212
|
* --sw-hl player-highlight background (P2.3)
|
|
235
213
|
* --sw-rule header rule / muted line color
|
|
236
214
|
*
|
|
@@ -258,7 +236,7 @@ declare const SWARALIPI_CSS: string;
|
|
|
258
236
|
* - rows are un-clipped (no scrollbar on paper) and kept whole across page
|
|
259
237
|
* breaks; part headings stay with their first row.
|
|
260
238
|
*/
|
|
261
|
-
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";
|
|
262
240
|
/** Staff-notation (abcjs) wrapper chrome: instrument/tempo header + a fluid
|
|
263
241
|
* SVG. The engraving itself is drawn by abcjs; this only frames it. */
|
|
264
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";
|
|
@@ -549,4 +527,4 @@ type Transliterator = (bengaliText: string) => string;
|
|
|
549
527
|
*/
|
|
550
528
|
declare function loadLyricTransliterator(lang: ViewerLang): Promise<Transliterator | undefined>;
|
|
551
529
|
|
|
552
|
-
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 { 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 = {
|
|
@@ -27,7 +27,6 @@ var BHATKHANDE_OCTAVE = {
|
|
|
27
27
|
"ati-taar": "U",
|
|
28
28
|
"ati-mandra": "L"
|
|
29
29
|
};
|
|
30
|
-
var BHATKHANDE_HAS_KOMAL = /* @__PURE__ */ new Set(["r", "g", "d", "n"]);
|
|
31
30
|
var DIGITS = {
|
|
32
31
|
bn: "\u09E6\u09E7\u09E8\u09E9\u09EA\u09EB\u09EC\u09ED\u09EE\u09EF",
|
|
33
32
|
hi: "\u0966\u0967\u0968\u0969\u096A\u096B\u096C\u096D\u096E\u096F",
|
|
@@ -45,6 +44,11 @@ var LABELS = {
|
|
|
45
44
|
// one taal cycle is exactly what the number counts.
|
|
46
45
|
en: { title: "Song", taal: "Taal", raag: "Raag", avartan: "Cycles", notationBy: "Notator" }
|
|
47
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
|
+
};
|
|
48
52
|
function composeCluster(letter, opts) {
|
|
49
53
|
const classes = [];
|
|
50
54
|
if (opts.lang === "bn") {
|
|
@@ -58,7 +62,7 @@ function composeCluster(letter, opts) {
|
|
|
58
62
|
}
|
|
59
63
|
let base = letter;
|
|
60
64
|
if (opts.tivra && letter === "m") base = "M";
|
|
61
|
-
else if (opts.komal &&
|
|
65
|
+
else if (opts.komal && hasKomal(letter)) base = base.toUpperCase();
|
|
62
66
|
return { text: base + BHATKHANDE_OCTAVE[opts.octave], classes };
|
|
63
67
|
}
|
|
64
68
|
function localizeDigits(s, lang) {
|
|
@@ -479,11 +483,18 @@ function renderToHtml(doc, opts = {}) {
|
|
|
479
483
|
if (opts.showHeader !== false) out.push(renderHeader(doc.meta, ctx));
|
|
480
484
|
out.push(`<div class="sw-scroll"><div class="sw-block" style="${tracks}">`);
|
|
481
485
|
let n = 0;
|
|
486
|
+
let lay;
|
|
482
487
|
doc.parts.forEach((part, p) => {
|
|
483
488
|
out.push('<section class="sw-part">');
|
|
484
489
|
if (part.name !== void 0)
|
|
485
490
|
out.push(`<h3 class="sw-part-name">${escapeHtml(ctx.tr(part.name))}</h3>`);
|
|
486
|
-
part.rows.forEach((row, r) =>
|
|
491
|
+
part.rows.forEach((row, r) => {
|
|
492
|
+
if (row.lay !== void 0 && row.lay !== lay) {
|
|
493
|
+
lay = row.lay;
|
|
494
|
+
out.push(`<div class="sw-lay" data-lay="${lay}">${escapeHtml(LAY_LABELS[ctx.lang][lay])}</div>`);
|
|
495
|
+
}
|
|
496
|
+
out.push(renderRow(row, p, r, layout.offsets[n++], ctx));
|
|
497
|
+
});
|
|
487
498
|
out.push("</section>");
|
|
488
499
|
});
|
|
489
500
|
out.push("</div></div></div>");
|
|
@@ -575,6 +586,30 @@ ${FONT_FACES}
|
|
|
575
586
|
|
|
576
587
|
.sw-part-name { font-size: 0.85em; font-weight: 600; margin: 1em 0 0.2em; opacity: 0.85; }
|
|
577
588
|
|
|
589
|
+
/* \u09B2\u09AF\u09BC marker: the line where the tempo tier turns over. A full-width rule
|
|
590
|
+
rather than a row label \u2014 the label track is what the notation columns are
|
|
591
|
+
measured against, and a six-em word in it would shove the whole sheet right. */
|
|
592
|
+
.sw-lay {
|
|
593
|
+
grid-column: 1 / -1;
|
|
594
|
+
display: flex;
|
|
595
|
+
align-items: center;
|
|
596
|
+
gap: 0.6em;
|
|
597
|
+
margin: 0.8em 0 0;
|
|
598
|
+
/* Floored like the header: fitSwaralipi shrinks the sheet to fit the
|
|
599
|
+
notation's columns, and this label has none to align. */
|
|
600
|
+
font-size: max(0.7em, var(--sw-lay-min, 0.72rem));
|
|
601
|
+
font-weight: 600;
|
|
602
|
+
letter-spacing: 0.09em;
|
|
603
|
+
opacity: 0.75;
|
|
604
|
+
break-after: avoid;
|
|
605
|
+
}
|
|
606
|
+
.sw-lay::after {
|
|
607
|
+
content: '';
|
|
608
|
+
flex: 1;
|
|
609
|
+
height: 1px;
|
|
610
|
+
background: var(--sw-rule, rgba(128, 128, 128, 0.35));
|
|
611
|
+
}
|
|
612
|
+
|
|
578
613
|
/* ---- block grid: ONE column set for the whole sheet ----
|
|
579
614
|
* NLTR emits a song as a single html table, which is why its lines align
|
|
580
615
|
* down the page. Same here: .sw-block owns the tracks, every .sw-row
|
|
@@ -759,7 +794,7 @@ var SWARALIPI_PRINT_CSS = `
|
|
|
759
794
|
.sw-sheet, .sw-staff { -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #000; }
|
|
760
795
|
.sw-scroll { overflow: visible !important; }
|
|
761
796
|
.sw-row { break-inside: avoid; page-break-inside: avoid; }
|
|
762
|
-
.sw-part-name, .sw-header { break-after: avoid-page; page-break-after: avoid; }
|
|
797
|
+
.sw-part-name, .sw-header, .sw-lay { break-after: avoid-page; page-break-after: avoid; }
|
|
763
798
|
.sw-hl { background: none !important; }
|
|
764
799
|
/* Keep each engraved staff system whole across a page break (the abcjs line
|
|
765
800
|
is a <div> wrapping the <svg>, so the break rule must sit on the div). */
|
|
@@ -912,7 +947,7 @@ function resolveDrumTaal(doc) {
|
|
|
912
947
|
return id !== void 0 && id in TAALS ? TAALS[id] : { numBeats: 4, sam: 0 };
|
|
913
948
|
}
|
|
914
949
|
function docToAbc(doc, opts = {}) {
|
|
915
|
-
const schedule = buildSchedule(doc, { tonic: opts.tonic, baseOctave: opts.baseOctave });
|
|
950
|
+
const schedule = buildSchedule(doc, { tonic: opts.tonic, baseOctave: opts.baseOctave, lay: false });
|
|
916
951
|
const bpm = opts.bpm ?? doc.meta.bpm ?? 90;
|
|
917
952
|
const beatsPerBar = opts.beatsPerBar ?? doc.meta.taal?.numBeats ?? 4;
|
|
918
953
|
const drums = opts.drums ? drumPattern(resolveDrumTaal(doc)) : void 0;
|
|
@@ -976,7 +1011,7 @@ async function abcToSvg(abc, opts = {}, notePaths) {
|
|
|
976
1011
|
async function renderStaffHtml(doc, opts = {}) {
|
|
977
1012
|
const bpm = opts.bpm ?? doc.meta.bpm ?? 90;
|
|
978
1013
|
const abc = docToAbc(doc, { ...opts, bpm });
|
|
979
|
-
const schedule = buildSchedule(doc, { tonic: opts.tonic, baseOctave: opts.baseOctave });
|
|
1014
|
+
const schedule = buildSchedule(doc, { tonic: opts.tonic, baseOctave: opts.baseOctave, lay: false });
|
|
980
1015
|
const engraved = await abcToSvg(abc, opts, eventPaths(schedule));
|
|
981
1016
|
const lines = engraved.includes("sw-staff-missing") ? engraved : `<div class="sw-staff-lines">${engraved}</div>`;
|
|
982
1017
|
const header = opts.showHeader === false ? "" : renderMetaHeader(doc.meta, opts.headerLang ?? "en", opts.transliterate);
|
|
@@ -1383,6 +1418,6 @@ function defineSwaralipiSheet(tagName = "swaralipi-sheet") {
|
|
|
1383
1418
|
return ctor;
|
|
1384
1419
|
}
|
|
1385
1420
|
|
|
1386
|
-
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 };
|
|
1421
|
+
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 };
|
|
1387
1422
|
//# sourceMappingURL=index.js.map
|
|
1388
1423
|
//# sourceMappingURL=index.js.map
|