@ugfoundation/swaralipi-js 0.7.1 → 0.7.3
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-6AINAZJS.js → batch-CYQH6Q33.js} +5 -5
- package/dist/{batch-6AINAZJS.js.map → batch-CYQH6Q33.js.map} +1 -1
- package/dist/{chunk-GHWURC4U.js → chunk-2SAZWTTK.js} +8 -10
- package/dist/chunk-2SAZWTTK.js.map +1 -0
- package/dist/{chunk-7QBLGKJC.js → chunk-56NFRQOW.js} +9 -6
- package/dist/chunk-56NFRQOW.js.map +1 -0
- package/dist/{chunk-ZOCFJL5A.js → chunk-PEOVWTJB.js} +4 -4
- package/dist/{chunk-ZOCFJL5A.js.map → chunk-PEOVWTJB.js.map} +1 -1
- package/dist/{chunk-6ETPFHZ6.js → chunk-UF5OSJRP.js} +9 -3
- package/dist/chunk-UF5OSJRP.js.map +1 -0
- package/dist/cli.cjs +7 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +3 -3
- package/dist/convert/index.cjs +6 -3
- 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 +14 -3
- 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/player/index.cjs +29 -22
- package/dist/player/index.cjs.map +1 -1
- package/dist/player/index.d.cts +3 -12
- package/dist/player/index.d.ts +3 -12
- package/dist/player/index.js +21 -18
- package/dist/player/index.js.map +1 -1
- package/dist/{schedule-CjPcD-Hf.d.cts → schedule-BpBYGXPL.d.cts} +3 -2
- package/dist/{schedule-8WFUBJqB.d.ts → schedule-Tzk01FKj.d.ts} +3 -2
- package/dist/{schema-D_86x4oV.d.ts → schema-DqBXPGkL.d.cts} +13 -4
- package/dist/{schema-D_86x4oV.d.cts → schema-DqBXPGkL.d.ts} +13 -4
- package/dist/spec/index.cjs +14 -3
- package/dist/spec/index.cjs.map +1 -1
- package/dist/spec/index.d.cts +13 -4
- package/dist/spec/index.d.ts +13 -4
- package/dist/spec/index.js +2 -2
- package/dist/viewer/index.cjs +61 -22
- package/dist/viewer/index.cjs.map +1 -1
- package/dist/viewer/index.d.cts +5 -3
- package/dist/viewer/index.d.ts +5 -3
- package/dist/viewer/index.js +34 -13
- package/dist/viewer/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-6ETPFHZ6.js.map +0 -1
- package/dist/chunk-7QBLGKJC.js.map +0 -1
- package/dist/chunk-GHWURC4U.js.map +0 -1
package/dist/viewer/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Octave, a as SvaraLetter, N as Note, M as Meta, S as Swaralipi, T as Taal } from '../schema-
|
|
2
|
-
import { D as DrumVoice, S as Schedule, P as PlayEvent } from '../schedule-
|
|
1
|
+
import { O as Octave, a as SvaraLetter, N as Note, M as Meta, S as Swaralipi, T as Taal } from '../schema-DqBXPGkL.cjs';
|
|
2
|
+
import { D as DrumVoice, S as Schedule, P as PlayEvent } from '../schedule-BpBYGXPL.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'tone';
|
|
5
5
|
import '../taals-CjzBuZ35.cjs';
|
|
@@ -197,7 +197,9 @@ declare function renderToHtml(doc: Swaralipi, opts?: RenderOptions): string;
|
|
|
197
197
|
* `transform` would scale it too, but would also break print
|
|
198
198
|
* pagination). This is what actually makes the glyphs smaller, so it
|
|
199
199
|
* runs second and stops at `minSize` px — past that the block scrolls
|
|
200
|
-
* inside `.sw-scroll` rather than becoming unreadable.
|
|
200
|
+
* inside `.sw-scroll` rather than becoming unreadable. It also runs the
|
|
201
|
+
* other way: a sheet narrower than its container grows (to 2x) rather
|
|
202
|
+
* than leaving dead space to the right of every row.
|
|
201
203
|
*
|
|
202
204
|
* `zoom` (default 1) multiplies the fit scale so callers can zoom in past
|
|
203
205
|
* fit-to-width, or below the readability floor deliberately; past that point
|
package/dist/viewer/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Octave, a as SvaraLetter, N as Note, M as Meta, S as Swaralipi, T as Taal } from '../schema-
|
|
2
|
-
import { D as DrumVoice, S as Schedule, P as PlayEvent } from '../schedule-
|
|
1
|
+
import { O as Octave, a as SvaraLetter, N as Note, M as Meta, S as Swaralipi, T as Taal } from '../schema-DqBXPGkL.js';
|
|
2
|
+
import { D as DrumVoice, S as Schedule, P as PlayEvent } from '../schedule-Tzk01FKj.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'tone';
|
|
5
5
|
import '../taals-CjzBuZ35.js';
|
|
@@ -197,7 +197,9 @@ declare function renderToHtml(doc: Swaralipi, opts?: RenderOptions): string;
|
|
|
197
197
|
* `transform` would scale it too, but would also break print
|
|
198
198
|
* pagination). This is what actually makes the glyphs smaller, so it
|
|
199
199
|
* runs second and stops at `minSize` px — past that the block scrolls
|
|
200
|
-
* inside `.sw-scroll` rather than becoming unreadable.
|
|
200
|
+
* inside `.sw-scroll` rather than becoming unreadable. It also runs the
|
|
201
|
+
* other way: a sheet narrower than its container grows (to 2x) rather
|
|
202
|
+
* than leaving dead space to the right of every row.
|
|
201
203
|
*
|
|
202
204
|
* `zoom` (default 1) multiplies the fit scale so callers can zoom in past
|
|
203
205
|
* fit-to-width, or below the readability floor deliberately; past that point
|
package/dist/viewer/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isArcRaw, glideTargets, buildSchedule, drumPattern } from '../chunk-
|
|
2
|
-
import { TAALS } from '../chunk-
|
|
1
|
+
import { isArcRaw, glideTargets, buildSchedule, drumPattern } from '../chunk-2SAZWTTK.js';
|
|
2
|
+
import { TAALS, graceNotes } from '../chunk-UF5OSJRP.js';
|
|
3
3
|
|
|
4
4
|
// src/viewer/glyphs.ts
|
|
5
5
|
var SWARABITAN_SHUDDHA = {
|
|
@@ -266,11 +266,21 @@ function bracketGlyphs(note, edge) {
|
|
|
266
266
|
function matraGlyph(ctx) {
|
|
267
267
|
return ctx.lang === "bn" ? '<span class="sw-cl">a</span>' : '<span class="sw-iso">\u2013</span>';
|
|
268
268
|
}
|
|
269
|
-
function renderGrace(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
269
|
+
function renderGrace(grace, cls, ctx) {
|
|
270
|
+
return graceNotes(grace).map((n) => {
|
|
271
|
+
if (n.svara === void 0) return "";
|
|
272
|
+
const [octave, letter] = n.svara;
|
|
273
|
+
const c = composeCluster(letter, {
|
|
274
|
+
komal: n.komal,
|
|
275
|
+
tivra: n.tivra,
|
|
276
|
+
octave,
|
|
277
|
+
withMatra: false,
|
|
278
|
+
lang: ctx.lang
|
|
279
|
+
});
|
|
280
|
+
const hy = n.sustain === true ? ctx.marks.hyphen : "";
|
|
281
|
+
const micro = n.microtone !== void 0 ? `<span class="sw-micro" title="${n.microtone}">${localizeDigits(n.microtone === "atikomal" ? "2" : "1", ctx.lang)}</span>` : "";
|
|
282
|
+
return `<span class="${[cls, ...c.classes].join(" ")}">${hy}${c.text}</span>${micro}`;
|
|
283
|
+
}).join("");
|
|
274
284
|
}
|
|
275
285
|
function cutGlyphs(marks, ctx) {
|
|
276
286
|
if (marks === "") return "";
|
|
@@ -492,14 +502,22 @@ function fitSwaralipi(root, minScale = 0, zoom = 1, minSpacing = 0.35, minSize =
|
|
|
492
502
|
const available = scroll.clientWidth;
|
|
493
503
|
let natural = block.scrollWidth;
|
|
494
504
|
if (available === 0 || natural === 0) continue;
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
505
|
+
if (natural > available && minSpacing < 1) {
|
|
506
|
+
let loose = minSpacing;
|
|
507
|
+
let tight = 1;
|
|
508
|
+
for (let i = 0; i < 6; i++) {
|
|
509
|
+
const mid = (loose + tight) / 2;
|
|
510
|
+
sheet.style.setProperty("--sw-tight", String(mid));
|
|
511
|
+
if (block.scrollWidth <= available) loose = mid;
|
|
512
|
+
else tight = mid;
|
|
513
|
+
}
|
|
514
|
+
sheet.style.setProperty("--sw-tight", String(loose));
|
|
498
515
|
natural = block.scrollWidth;
|
|
499
516
|
}
|
|
500
517
|
const base = parseFloat(getComputedStyle(sheet).fontSize);
|
|
501
|
-
|
|
502
|
-
|
|
518
|
+
if (!(base > 0)) continue;
|
|
519
|
+
let fit = Math.max(minScale, Math.min((available - 1) / natural, 2));
|
|
520
|
+
if (minSize > 0) fit = Math.max(fit, Math.min(1, minSize / base));
|
|
503
521
|
const scale = fit * zoom;
|
|
504
522
|
if (scale === 1) continue;
|
|
505
523
|
sheet.style.setProperty("--sw-size", `${(base * scale).toFixed(3)}px`);
|
|
@@ -780,7 +798,7 @@ function abcDuration(beats) {
|
|
|
780
798
|
return `${sixteenths}/4`;
|
|
781
799
|
}
|
|
782
800
|
function abcNote(ev) {
|
|
783
|
-
const grace = ev.kan
|
|
801
|
+
const grace = ev.kan.length > 0 ? `{${ev.kan.map(midiToAbc).join("")}}` : "";
|
|
784
802
|
return `${grace}${midiToAbc(ev.midi)}${abcDuration(ev.durationBeats)}`;
|
|
785
803
|
}
|
|
786
804
|
function eventPaths(schedule) {
|
|
@@ -1308,6 +1326,9 @@ function createElementClass() {
|
|
|
1308
1326
|
});
|
|
1309
1327
|
this.#root.innerHTML = this.#styleFallback() + html;
|
|
1310
1328
|
this.#fit();
|
|
1329
|
+
void document.fonts?.ready.then(() => {
|
|
1330
|
+
if (seq === this.#renderSeq) this.fit();
|
|
1331
|
+
});
|
|
1311
1332
|
}
|
|
1312
1333
|
#renderError(message) {
|
|
1313
1334
|
const div = document.createElement("div");
|