@ugfoundation/swaralipi-js 0.2.0 → 0.2.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-CIAXVKP5.js → batch-SCSIUDB3.js} +4 -4
- package/dist/{batch-CIAXVKP5.js.map → batch-SCSIUDB3.js.map} +1 -1
- package/dist/{chunk-2NBNF6JP.js → chunk-DINRYGRI.js} +3 -3
- package/dist/{chunk-2NBNF6JP.js.map → chunk-DINRYGRI.js.map} +1 -1
- package/dist/{chunk-SH2INDZ2.js → chunk-KYNCQ7OF.js} +3 -3
- package/dist/{chunk-SH2INDZ2.js.map → chunk-KYNCQ7OF.js.map} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/convert/index.cjs +1 -1
- package/dist/convert/index.cjs.map +1 -1
- package/dist/convert/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/spec/index.cjs +1 -1
- package/dist/spec/index.cjs.map +1 -1
- package/dist/spec/index.d.cts +1 -1
- package/dist/spec/index.d.ts +1 -1
- package/dist/spec/index.js +1 -1
- package/dist/viewer/index.cjs +104 -152
- package/dist/viewer/index.cjs.map +1 -1
- package/dist/viewer/index.d.cts +41 -47
- package/dist/viewer/index.d.ts +41 -47
- package/dist/viewer/index.js +103 -151
- package/dist/viewer/index.js.map +1 -1
- package/package.json +1 -1
package/dist/viewer/index.d.cts
CHANGED
|
@@ -2,49 +2,42 @@ import { O as Octave, a as SvaraLetter, N as Note, S as Swaralipi } from '../sch
|
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Per-language
|
|
5
|
+
* Per-language notation encoding for the viewer.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
7
|
+
* Every language renders its notation through a dedicated, purpose-built
|
|
8
|
+
* font whose glyphs ARE the akarmatrik/Bhatkhande marks — so composeCluster
|
|
9
|
+
* emits that font's ASCII encoding and the font does all the hard work
|
|
10
|
+
* (komal/tivra forms, octave reph/dots, matra). This is why the viewer no
|
|
11
|
+
* longer touches Unicode cluster composition at all: the old reph-over-
|
|
12
|
+
* vowel, hasanta-before-matra and dotted-circle hazards simply don't exist
|
|
13
|
+
* when the font supplies precomposed glyphs keyed by plain ASCII.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
15
|
+
* - bn → NLTR's **Swarabitan** (the akarmatrik font this project decodes).
|
|
16
|
+
* Letters s r g m p q n = স র গ ম প ধ ন (q=ধ); komal v t d u = ঋ জ্ঞ দ ণ;
|
|
17
|
+
* tivra ma k = the authentic কড়ি-ম conjunct (ম-based — has NO Unicode
|
|
18
|
+
* form, which is what forced this whole approach); suffix f = taar reph,
|
|
19
|
+
* h = mandra hasanta; trailing a = the আ-কার matra carrier. See codec.ts.
|
|
20
|
+
* - hi/en → **Ome Bhatkhande** Hindi/English (SIL OFL 1.1, © Omenad —
|
|
21
|
+
* github.com/omenad/fonts). Same clean keymap for both: lowercase
|
|
22
|
+
* s r g m p d n = the seven shuddha swaras, uppercase R G M D N = komal
|
|
23
|
+
* Re/Ga, tivra Ma, komal Dha/Ni; octave suffix u/l = taar/mandra dot,
|
|
24
|
+
* U/L = ati (two dots). Bhatkhande has no আ-কার, so no matra is appended.
|
|
25
|
+
*
|
|
26
|
+
* The font is applied by CSS keyed on `.sw-sheet`'s `lang` (see styles.ts);
|
|
27
|
+
* composeCluster only chooses the ASCII. The single residual CSS mark is the
|
|
28
|
+
* bn ati-octave extra dot (Swarabitan's f/h are single reph/hasanta only).
|
|
24
29
|
*/
|
|
25
30
|
|
|
26
31
|
type ViewerLang = 'bn' | 'hi' | 'en';
|
|
27
|
-
interface LetterForms {
|
|
28
|
-
shuddha: string;
|
|
29
|
-
/** Distinct komal glyph (bn/hi); absent for en (CSS underline instead). */
|
|
30
|
-
komal?: string;
|
|
31
|
-
/** Distinct tivra glyph (bn/hi ক্ষ/क्ष); absent for en (CSS prime). */
|
|
32
|
-
tivra?: string;
|
|
33
|
-
}
|
|
34
|
-
declare const LETTERS: Record<ViewerLang, Record<SvaraLetter, LetterForms>>;
|
|
35
32
|
/** Digits 0-9 in the target script (beat labels, avartan). */
|
|
36
33
|
declare const DIGITS: Record<ViewerLang, string>;
|
|
37
34
|
interface LangMarks {
|
|
38
|
-
/** আ-কার matra carrier appended to a group-final cluster ('' for en). */
|
|
39
|
-
matra: string;
|
|
40
35
|
/** Melisma / no-new-attack dash before a sustained cluster. */
|
|
41
36
|
hyphen: string;
|
|
42
37
|
/** Lyric continuation mark shown under sustains (the source uses ৹). */
|
|
43
38
|
melisma: string;
|
|
44
39
|
/** ছেদ cut/articulation mark (two stacked rings, ঃ-shaped). */
|
|
45
40
|
cut: string;
|
|
46
|
-
/** Real-text reph prefix for taar ('' for en → CSS dot instead). */
|
|
47
|
-
reph: string;
|
|
48
41
|
}
|
|
49
42
|
declare const MARKS: Record<ViewerLang, LangMarks>;
|
|
50
43
|
/** Header labels (NLTR prints নাম / তাল / আবর্তন …). */
|
|
@@ -55,28 +48,24 @@ declare const LABELS: Record<ViewerLang, {
|
|
|
55
48
|
avartan: string;
|
|
56
49
|
notationBy: string;
|
|
57
50
|
}>;
|
|
58
|
-
/** A composed notation cluster:
|
|
59
|
-
*
|
|
60
|
-
* CSS-reph fallback). */
|
|
51
|
+
/** A composed notation cluster: the font's ASCII text plus any residual CSS
|
|
52
|
+
* classes the font itself cannot express (only the bn ati-octave dot). */
|
|
61
53
|
interface Cluster {
|
|
62
54
|
text: string;
|
|
63
55
|
classes: string[];
|
|
64
|
-
/** Set when the matra could not join the cluster (ঋ/ऋ, or en where the
|
|
65
|
-
* carrier doesn't exist) and must be emitted as an isolated-matra span. */
|
|
66
|
-
matraSeparate: boolean;
|
|
67
56
|
}
|
|
68
57
|
interface ComposeOptions {
|
|
69
58
|
komal?: boolean;
|
|
70
59
|
tivra?: boolean;
|
|
71
60
|
octave: Octave;
|
|
72
|
-
/** Append the আ-কার matra carrier (group-final notes only). */
|
|
61
|
+
/** Append the আ-কার matra carrier (bn group-final notes only). */
|
|
73
62
|
withMatra: boolean;
|
|
74
63
|
lang: ViewerLang;
|
|
75
64
|
}
|
|
76
65
|
/**
|
|
77
|
-
* Compose one svara
|
|
78
|
-
*
|
|
79
|
-
*
|
|
66
|
+
* Compose one svara into its notation-font ASCII. bn = Swarabitan
|
|
67
|
+
* (letter + f/h octave + a matra); hi/en = Ome Bhatkhande (case-encoded
|
|
68
|
+
* letter + u/l/U/L octave, no matra). The font renders the actual glyph.
|
|
80
69
|
*/
|
|
81
70
|
declare function composeCluster(letter: SvaraLetter, opts: ComposeOptions): Cluster;
|
|
82
71
|
/** Map ASCII digits in `s` to the target script's digits. */
|
|
@@ -97,8 +86,8 @@ declare function localizeDigits(s: string, lang: ViewerLang): string;
|
|
|
97
86
|
* Rendering is spec-driven (semantics, not `raw`): grouping derives from
|
|
98
87
|
* `durationMatra` accumulation so hand-authored documents without `raw`
|
|
99
88
|
* render identically. `raw` is consulted only for (a) raw-only fallback
|
|
100
|
-
* notes (never dropped — dimmed
|
|
101
|
-
* labels, whose grammar lives in raw (see
|
|
89
|
+
* notes (never dropped — dimmed, in Swarabitan when loaded), (b) the ছেদ
|
|
90
|
+
* cut mark and beat labels, whose grammar lives in raw (see codec.ts).
|
|
102
91
|
*/
|
|
103
92
|
|
|
104
93
|
interface RenderOptions {
|
|
@@ -170,12 +159,17 @@ declare function renderToHtml(doc: Swaralipi, opts?: RenderOptions): string;
|
|
|
170
159
|
* --sw-rule header rule / muted line color
|
|
171
160
|
*
|
|
172
161
|
* All ink uses `currentColor`, so the sheet follows the host's text color
|
|
173
|
-
* (dark mode included).
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* the NLTR reference rendering of song 4270.
|
|
162
|
+
* (dark mode included). The only octave mark drawn as a pseudo-element is
|
|
163
|
+
* the bn ati-octave extra dot (Swarabitan's f/h glyphs are a single
|
|
164
|
+
* reph/hasanta); everything else is a real glyph in the notation font.
|
|
177
165
|
*/
|
|
178
|
-
|
|
166
|
+
/** Notation fonts, self-hosted on the project CDN (CORS-enabled), keyed by
|
|
167
|
+
* the CSS `font-family` this stylesheet uses. bn = NLTR's Swarabitan; hi/en
|
|
168
|
+
* = Ome Bhatkhande (SIL OFL 1.1, © Omenad — github.com/omenad/fonts).
|
|
169
|
+
* Self-hosters: declare your own \`@font-face\` for any of these families
|
|
170
|
+
* before this stylesheet / before defineSwaralipiSheet() and it wins. */
|
|
171
|
+
declare const NOTATION_FONT_URLS: Record<string, string>;
|
|
172
|
+
declare const SWARALIPI_CSS: string;
|
|
179
173
|
/**
|
|
180
174
|
* Print stylesheet — pair with `SWARALIPI_CSS` (renderPrintDocument injects
|
|
181
175
|
* both). Gated on `@media print`, so it also works if a consumer drops it into
|
|
@@ -282,4 +276,4 @@ type Transliterator = (bengaliText: string) => string;
|
|
|
282
276
|
*/
|
|
283
277
|
declare function loadLyricTransliterator(lang: ViewerLang): Promise<Transliterator | undefined>;
|
|
284
278
|
|
|
285
|
-
export { type Arc, type Cell, type Cluster, type ComposeOptions, DIGITS, LABELS,
|
|
279
|
+
export { type Arc, type Cell, type Cluster, type ComposeOptions, DIGITS, LABELS, MARKS, NOTATION_FONT_URLS, type PrintOptions, type RenderOptions, SWARALIPI_CSS, SWARALIPI_PRINT_CSS, type SwaralipiSheetElement, type Transliterator, type ViewerLang, composeCluster, defineSwaralipiSheet, groupRowIntoCells, loadLyricTransliterator, localizeDigits, printSwaralipi, renderPrintDocument, renderToHtml, resolveArcs };
|
package/dist/viewer/index.d.ts
CHANGED
|
@@ -2,49 +2,42 @@ import { O as Octave, a as SvaraLetter, N as Note, S as Swaralipi } from '../sch
|
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Per-language
|
|
5
|
+
* Per-language notation encoding for the viewer.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
7
|
+
* Every language renders its notation through a dedicated, purpose-built
|
|
8
|
+
* font whose glyphs ARE the akarmatrik/Bhatkhande marks — so composeCluster
|
|
9
|
+
* emits that font's ASCII encoding and the font does all the hard work
|
|
10
|
+
* (komal/tivra forms, octave reph/dots, matra). This is why the viewer no
|
|
11
|
+
* longer touches Unicode cluster composition at all: the old reph-over-
|
|
12
|
+
* vowel, hasanta-before-matra and dotted-circle hazards simply don't exist
|
|
13
|
+
* when the font supplies precomposed glyphs keyed by plain ASCII.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
15
|
+
* - bn → NLTR's **Swarabitan** (the akarmatrik font this project decodes).
|
|
16
|
+
* Letters s r g m p q n = স র গ ম প ধ ন (q=ধ); komal v t d u = ঋ জ্ঞ দ ণ;
|
|
17
|
+
* tivra ma k = the authentic কড়ি-ম conjunct (ম-based — has NO Unicode
|
|
18
|
+
* form, which is what forced this whole approach); suffix f = taar reph,
|
|
19
|
+
* h = mandra hasanta; trailing a = the আ-কার matra carrier. See codec.ts.
|
|
20
|
+
* - hi/en → **Ome Bhatkhande** Hindi/English (SIL OFL 1.1, © Omenad —
|
|
21
|
+
* github.com/omenad/fonts). Same clean keymap for both: lowercase
|
|
22
|
+
* s r g m p d n = the seven shuddha swaras, uppercase R G M D N = komal
|
|
23
|
+
* Re/Ga, tivra Ma, komal Dha/Ni; octave suffix u/l = taar/mandra dot,
|
|
24
|
+
* U/L = ati (two dots). Bhatkhande has no আ-কার, so no matra is appended.
|
|
25
|
+
*
|
|
26
|
+
* The font is applied by CSS keyed on `.sw-sheet`'s `lang` (see styles.ts);
|
|
27
|
+
* composeCluster only chooses the ASCII. The single residual CSS mark is the
|
|
28
|
+
* bn ati-octave extra dot (Swarabitan's f/h are single reph/hasanta only).
|
|
24
29
|
*/
|
|
25
30
|
|
|
26
31
|
type ViewerLang = 'bn' | 'hi' | 'en';
|
|
27
|
-
interface LetterForms {
|
|
28
|
-
shuddha: string;
|
|
29
|
-
/** Distinct komal glyph (bn/hi); absent for en (CSS underline instead). */
|
|
30
|
-
komal?: string;
|
|
31
|
-
/** Distinct tivra glyph (bn/hi ক্ষ/क्ष); absent for en (CSS prime). */
|
|
32
|
-
tivra?: string;
|
|
33
|
-
}
|
|
34
|
-
declare const LETTERS: Record<ViewerLang, Record<SvaraLetter, LetterForms>>;
|
|
35
32
|
/** Digits 0-9 in the target script (beat labels, avartan). */
|
|
36
33
|
declare const DIGITS: Record<ViewerLang, string>;
|
|
37
34
|
interface LangMarks {
|
|
38
|
-
/** আ-কার matra carrier appended to a group-final cluster ('' for en). */
|
|
39
|
-
matra: string;
|
|
40
35
|
/** Melisma / no-new-attack dash before a sustained cluster. */
|
|
41
36
|
hyphen: string;
|
|
42
37
|
/** Lyric continuation mark shown under sustains (the source uses ৹). */
|
|
43
38
|
melisma: string;
|
|
44
39
|
/** ছেদ cut/articulation mark (two stacked rings, ঃ-shaped). */
|
|
45
40
|
cut: string;
|
|
46
|
-
/** Real-text reph prefix for taar ('' for en → CSS dot instead). */
|
|
47
|
-
reph: string;
|
|
48
41
|
}
|
|
49
42
|
declare const MARKS: Record<ViewerLang, LangMarks>;
|
|
50
43
|
/** Header labels (NLTR prints নাম / তাল / আবর্তন …). */
|
|
@@ -55,28 +48,24 @@ declare const LABELS: Record<ViewerLang, {
|
|
|
55
48
|
avartan: string;
|
|
56
49
|
notationBy: string;
|
|
57
50
|
}>;
|
|
58
|
-
/** A composed notation cluster:
|
|
59
|
-
*
|
|
60
|
-
* CSS-reph fallback). */
|
|
51
|
+
/** A composed notation cluster: the font's ASCII text plus any residual CSS
|
|
52
|
+
* classes the font itself cannot express (only the bn ati-octave dot). */
|
|
61
53
|
interface Cluster {
|
|
62
54
|
text: string;
|
|
63
55
|
classes: string[];
|
|
64
|
-
/** Set when the matra could not join the cluster (ঋ/ऋ, or en where the
|
|
65
|
-
* carrier doesn't exist) and must be emitted as an isolated-matra span. */
|
|
66
|
-
matraSeparate: boolean;
|
|
67
56
|
}
|
|
68
57
|
interface ComposeOptions {
|
|
69
58
|
komal?: boolean;
|
|
70
59
|
tivra?: boolean;
|
|
71
60
|
octave: Octave;
|
|
72
|
-
/** Append the আ-কার matra carrier (group-final notes only). */
|
|
61
|
+
/** Append the আ-কার matra carrier (bn group-final notes only). */
|
|
73
62
|
withMatra: boolean;
|
|
74
63
|
lang: ViewerLang;
|
|
75
64
|
}
|
|
76
65
|
/**
|
|
77
|
-
* Compose one svara
|
|
78
|
-
*
|
|
79
|
-
*
|
|
66
|
+
* Compose one svara into its notation-font ASCII. bn = Swarabitan
|
|
67
|
+
* (letter + f/h octave + a matra); hi/en = Ome Bhatkhande (case-encoded
|
|
68
|
+
* letter + u/l/U/L octave, no matra). The font renders the actual glyph.
|
|
80
69
|
*/
|
|
81
70
|
declare function composeCluster(letter: SvaraLetter, opts: ComposeOptions): Cluster;
|
|
82
71
|
/** Map ASCII digits in `s` to the target script's digits. */
|
|
@@ -97,8 +86,8 @@ declare function localizeDigits(s: string, lang: ViewerLang): string;
|
|
|
97
86
|
* Rendering is spec-driven (semantics, not `raw`): grouping derives from
|
|
98
87
|
* `durationMatra` accumulation so hand-authored documents without `raw`
|
|
99
88
|
* render identically. `raw` is consulted only for (a) raw-only fallback
|
|
100
|
-
* notes (never dropped — dimmed
|
|
101
|
-
* labels, whose grammar lives in raw (see
|
|
89
|
+
* notes (never dropped — dimmed, in Swarabitan when loaded), (b) the ছেদ
|
|
90
|
+
* cut mark and beat labels, whose grammar lives in raw (see codec.ts).
|
|
102
91
|
*/
|
|
103
92
|
|
|
104
93
|
interface RenderOptions {
|
|
@@ -170,12 +159,17 @@ declare function renderToHtml(doc: Swaralipi, opts?: RenderOptions): string;
|
|
|
170
159
|
* --sw-rule header rule / muted line color
|
|
171
160
|
*
|
|
172
161
|
* All ink uses `currentColor`, so the sheet follows the host's text color
|
|
173
|
-
* (dark mode included).
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* the NLTR reference rendering of song 4270.
|
|
162
|
+
* (dark mode included). The only octave mark drawn as a pseudo-element is
|
|
163
|
+
* the bn ati-octave extra dot (Swarabitan's f/h glyphs are a single
|
|
164
|
+
* reph/hasanta); everything else is a real glyph in the notation font.
|
|
177
165
|
*/
|
|
178
|
-
|
|
166
|
+
/** Notation fonts, self-hosted on the project CDN (CORS-enabled), keyed by
|
|
167
|
+
* the CSS `font-family` this stylesheet uses. bn = NLTR's Swarabitan; hi/en
|
|
168
|
+
* = Ome Bhatkhande (SIL OFL 1.1, © Omenad — github.com/omenad/fonts).
|
|
169
|
+
* Self-hosters: declare your own \`@font-face\` for any of these families
|
|
170
|
+
* before this stylesheet / before defineSwaralipiSheet() and it wins. */
|
|
171
|
+
declare const NOTATION_FONT_URLS: Record<string, string>;
|
|
172
|
+
declare const SWARALIPI_CSS: string;
|
|
179
173
|
/**
|
|
180
174
|
* Print stylesheet — pair with `SWARALIPI_CSS` (renderPrintDocument injects
|
|
181
175
|
* both). Gated on `@media print`, so it also works if a consumer drops it into
|
|
@@ -282,4 +276,4 @@ type Transliterator = (bengaliText: string) => string;
|
|
|
282
276
|
*/
|
|
283
277
|
declare function loadLyricTransliterator(lang: ViewerLang): Promise<Transliterator | undefined>;
|
|
284
278
|
|
|
285
|
-
export { type Arc, type Cell, type Cluster, type ComposeOptions, DIGITS, LABELS,
|
|
279
|
+
export { type Arc, type Cell, type Cluster, type ComposeOptions, DIGITS, LABELS, MARKS, NOTATION_FONT_URLS, type PrintOptions, type RenderOptions, SWARALIPI_CSS, SWARALIPI_PRINT_CSS, type SwaralipiSheetElement, type Transliterator, type ViewerLang, composeCluster, defineSwaralipiSheet, groupRowIntoCells, loadLyricTransliterator, localizeDigits, printSwaralipi, renderPrintDocument, renderToHtml, resolveArcs };
|