guidex 0.5.1 → 0.6.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.
Files changed (86) hide show
  1. package/CHANGELOG.md +200 -0
  2. package/README.md +62 -16
  3. package/dist/lib/app/App.d.ts +1 -0
  4. package/dist/lib/app/AretinoControls.d.ts +35 -0
  5. package/dist/lib/app/CaretBand.d.ts +28 -0
  6. package/dist/lib/app/Developers.d.ts +13 -0
  7. package/dist/lib/app/EditorContext.d.ts +15 -0
  8. package/dist/lib/app/EditorTextarea.d.ts +18 -1
  9. package/dist/lib/app/EditorToolbar.d.ts +13 -0
  10. package/dist/lib/app/ExportSettings.d.ts +20 -1
  11. package/dist/lib/app/Footer.d.ts +1 -0
  12. package/dist/lib/app/GlyphChooser.d.ts +31 -0
  13. package/dist/lib/app/Inspector.d.ts +26 -0
  14. package/dist/lib/app/LiveScore.d.ts +31 -0
  15. package/dist/lib/app/Opening.d.ts +3 -0
  16. package/dist/lib/app/Reference.d.ts +28 -0
  17. package/dist/lib/app/RenderSettings.d.ts +2 -1
  18. package/dist/lib/app/ScriptViews.d.ts +8 -0
  19. package/dist/lib/app/SectionSize.d.ts +33 -0
  20. package/dist/lib/app/StaffSettings.d.ts +4 -0
  21. package/dist/lib/app/StaffedGlyph.d.ts +8 -0
  22. package/dist/lib/app/Tabs.d.ts +15 -0
  23. package/dist/lib/app/TakeItOut.d.ts +1 -0
  24. package/dist/lib/app/ThemeSwitch.d.ts +1 -0
  25. package/dist/lib/app/TopBar.d.ts +6 -0
  26. package/dist/lib/app/WidthControls.d.ts +21 -0
  27. package/dist/lib/app/aretinoCaret.d.ts +47 -0
  28. package/dist/lib/app/aretinoSource.d.ts +46 -0
  29. package/dist/lib/app/caretSync.d.ts +48 -0
  30. package/dist/lib/app/chantLibrary.d.ts +8 -4
  31. package/dist/lib/app/editorSnapshot.d.ts +11 -0
  32. package/dist/lib/app/editorState.d.ts +38 -5
  33. package/dist/lib/app/expandLink.d.ts +19 -0
  34. package/dist/lib/app/glyphData.d.ts +37 -0
  35. package/dist/lib/app/inCode.d.ts +4 -0
  36. package/dist/lib/app/insertAtCaret.d.ts +12 -0
  37. package/dist/lib/app/learn/Learn.d.ts +1 -0
  38. package/dist/lib/app/learn/LessonCard.d.ts +12 -0
  39. package/dist/lib/app/learn/lessons.d.ts +64 -0
  40. package/dist/lib/app/learn/narrowing.d.ts +24 -0
  41. package/dist/lib/app/learn/progress.d.ts +14 -0
  42. package/dist/lib/app/pageEvents.d.ts +14 -0
  43. package/dist/lib/app/previewHighlight.d.ts +44 -0
  44. package/dist/lib/app/samples.d.ts +9 -1
  45. package/dist/lib/app/scriptParts.d.ts +31 -0
  46. package/dist/lib/app/shareLink.d.ts +12 -2
  47. package/dist/lib/app/showcases/Showcases.d.ts +17 -0
  48. package/dist/lib/app/wordCopy.d.ts +4 -0
  49. package/dist/lib/aretino/fromAretino.d.ts +99 -0
  50. package/dist/lib/aretino/index.d.ts +38 -0
  51. package/dist/lib/aretino/index.js +1870 -0
  52. package/dist/lib/aretino/toAretino.d.ts +27 -0
  53. package/dist/lib/chantLayout-BRQ6FYND.js +1345 -0
  54. package/dist/lib/chantLayout.d.ts +101 -6
  55. package/dist/lib/chantMarkup-DX4K86Rv.js +993 -0
  56. package/dist/lib/drawnStaff.d.ts +39 -5
  57. package/dist/lib/editorStorage.d.ts +48 -6
  58. package/dist/lib/embed/core.d.ts +15 -1
  59. package/dist/lib/embed/index.js +1 -1
  60. package/dist/lib/embed/manual.d.ts +5 -4
  61. package/dist/lib/embed/manual.js +6 -4
  62. package/dist/lib/fonts/guidohu-staffless.woff2 +0 -0
  63. package/dist/lib/fonts/guidohu.ttf +0 -0
  64. package/dist/lib/glyphFamilies.d.ts +5 -1
  65. package/dist/lib/guidoRender.d.ts +30 -1
  66. package/dist/lib/guidoScriptTransforms.d.ts +2 -2
  67. package/dist/lib/guidoStyles-CvnACCsk.js +1466 -0
  68. package/dist/lib/guidoStyles.d.ts +23 -2
  69. package/dist/lib/react/GuidexScore.d.ts +10 -2
  70. package/dist/lib/react/index.js +14 -4
  71. package/dist/lib/{scoreImage-DUxsPIm0.js → scoreImage-CKsQxHg5.js} +282 -1026
  72. package/dist/lib/theme.d.ts +13 -0
  73. package/dist/lib/word/index.d.ts +1 -1
  74. package/dist/lib/word/index.js +1 -1
  75. package/dist/lib/{wordChecker-DmjGFR7e.js → wordChecker-BN_9dKAx.js} +133 -20
  76. package/dist/lib/wordChecker.d.ts +18 -1
  77. package/dist/lib/wordExport.d.ts +51 -3
  78. package/dist-embed/demo.html +2 -2
  79. package/dist-embed/fonts/guidohu-staffless.woff2 +0 -0
  80. package/dist-embed/fonts/guidohu.ttf +0 -0
  81. package/dist-embed/guidex-embed.min.js +1 -1
  82. package/package.json +10 -1
  83. package/dist/lib/app/ControlsRow.d.ts +0 -1
  84. package/dist/lib/app/SettingsMenu.d.ts +0 -1
  85. package/dist/lib/app/SettingsPanel.d.ts +0 -1
  86. package/dist/lib/chantLayout-DGWAhg8Q.js +0 -2617
@@ -0,0 +1,14 @@
1
+ import { ScriptSyntax } from '../editorStorage';
2
+ export declare const OPEN_IN_EDITOR = "guidex:open-in-editor";
3
+ export declare const SHOW_INSPECTOR_TAB = "guidex:show-inspector-tab";
4
+ export interface OpenInEditorDetail {
5
+ script: string;
6
+ /** Where it came from, for the editor's note: "Lesson 6". */
7
+ from: string;
8
+ /** The script's syntax (issue #79); GuidoScript when absent */
9
+ syntax?: ScriptSyntax;
10
+ }
11
+ export declare function openInEditor(script: string, from: string, syntax?: ScriptSyntax): void;
12
+ export declare function showInspectorTab(tab: string): void;
13
+ /** Scrolls a section into view, where the browser can. */
14
+ export declare function scrollToId(id: string): void;
@@ -0,0 +1,44 @@
1
+ import { RefObject } from 'react';
2
+ /** What a setting changes in the preview. `line:N` is staff line N (1 = bottom). */
3
+ export type HighlightKind = 'padding' | 'width' | 'snap' | 'spacing' | 'staff' | 'clef-line' | `line:${number}`;
4
+ /** How long the highlight stays after the last change, ms. */
5
+ export declare const HIGHLIGHT_MS = 1200;
6
+ /** Shows `kind` in the preview, and clears it `HIGHLIGHT_MS` after the last call. */
7
+ export declare function flash(kind: HighlightKind): void;
8
+ /** Clears the highlight at once (tests, unmount). */
9
+ export declare function clearHighlight(): void;
10
+ export declare function useHighlight(): HighlightKind | null;
11
+ /** Props for a slider: flashes on grab, keys and every change. */
12
+ export declare function flashProps(kind: HighlightKind): {
13
+ onPointerDown: () => void;
14
+ onKeyDown: () => void;
15
+ onInput: () => void;
16
+ };
17
+ interface Band {
18
+ left: number;
19
+ top: number;
20
+ width: number;
21
+ height: number;
22
+ }
23
+ /** The rectangles to draw for `kind`, relative to `host`. */
24
+ export declare function bandsFor(kind: HighlightKind, host: HTMLElement, settings: {
25
+ maxWidthPx: number;
26
+ paddingPx: number;
27
+ staffFillSnapPx: number;
28
+ }): Band[];
29
+ /**
30
+ * The highlight layer over the preview: absolutely placed bands for the
31
+ * geometry kinds, and a `data-highlight` attribute on the score for the
32
+ * staff kinds (the stylesheet turns those lines red). `renderSeq` changes
33
+ * after every render, so the bands follow the score.
34
+ */
35
+ export declare function PreviewHighlight({ scoreRef, renderSeq, settings, }: {
36
+ scoreRef: RefObject<HTMLElement | null>;
37
+ renderSeq: number;
38
+ settings: {
39
+ maxWidthPx: number;
40
+ paddingPx: number;
41
+ staffFillSnapPx: number;
42
+ };
43
+ }): import('react').JSX.Element | null;
44
+ export {};
@@ -1,7 +1,15 @@
1
- export declare const DEFAULT_SCRIPT = "(MX)Ki(3)r\u00E1ly(3)k\u00E9nt(5) tr\u00F3(7i)nol(7-:) **() az(7i) \u00DAr(5-/) mind(5)\u00F6(4t)r\u00F6k(3)k\u00E9.(3-.)";
1
+ /** The default script: the opening's showpiece, the first sample chip and
2
+ * a fresh browser's draft. */
3
+ export declare const DEFAULT_SCRIPT = "(M) Ne(4) t\u00ED(4u)me(tT4)as,(5) Ma(3)r\u00ED(4t)a,(4t-:) in(3)ve(4)n\u00ED(5)sti(4) gr\u00E1(567i)ti(uU6)am(4t-) a(6)pud(5) D\u00F3(4)mi(3r)num,(4-,) ec(5)ce,(4) con(4)c\u00ED(34t)pi(eE2)es,(1-:) et(1) p\u00E1(3)ri(4t)es(5-) f\u00ED(4)li(3r)um,(rR3-:) al(2)le(3r)l\u00FA(4)ia.(4-.)";
4
+ /** The default script as 0.5.x and the first redesign builds wrote it, with
5
+ * the `<` g-clef (the same glyph as `M`, which needs no escaping in HTML):
6
+ * a draft that is still exactly this opens as today's default. */
7
+ export declare const LEGACY_DEFAULT_SCRIPT: string;
2
8
  export interface Sample {
3
9
  name: string;
4
10
  script: string;
11
+ /** Written in Aretino (issue #79): it opens as an Aretino chant */
12
+ syntax?: 'aretino';
5
13
  }
6
14
  export declare const SAMPLES: Sample[];
7
15
  export declare function sampleChipId(index: number): string;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The script as the page inks it: syllable text apart from note groups.
3
+ * Shared by the opening's script line and the editor's highlighted script
4
+ * field.
5
+ */
6
+ /** The script split into syllable text and note groups (statements and
7
+ * the clef are groups too), so the groups can take their own ink. A group
8
+ * ends at its first `)`, as the parser reads it: a `(` inside one is a
9
+ * glyph (the round bracket), never a nested group. A backslash escape
10
+ * never opens or closes a group. */
11
+ export declare function scriptParts(source: string): {
12
+ text: string;
13
+ group: boolean;
14
+ }[];
15
+ /** A run of the inked script: a note group or text, whether it lies in the
16
+ * caret's syllable (`current`), and in the neume the caret is in (`neume`). */
17
+ export interface InkedRun {
18
+ text: string;
19
+ group: boolean;
20
+ current: boolean;
21
+ neume: boolean;
22
+ }
23
+ type Range = {
24
+ start: number;
25
+ end: number;
26
+ };
27
+ /** The script's parts split again at `range` and `neume` (source offsets,
28
+ * end exclusive), so the caret's syllable and neume can take their tints
29
+ * without changing a character: the runs join back to `source` exactly. */
30
+ export declare function inkedRuns(source: string, range: Range | null, neume?: Range | null): InkedRun[];
31
+ export {};
@@ -1,11 +1,15 @@
1
- import { ChantPrefs } from '../editorStorage';
1
+ import { ChantPrefs, ScriptSyntax } from '../editorStorage';
2
2
  import { EditorState } from './editorState';
3
+ /** The link format this build writes; older links get the 0.5.x reading. */
4
+ export declare const SHARE_LINK_VERSION = 2;
3
5
  /** A chant carried by a share link: its raw script plus the render
4
6
  * prefs the link specifies (absent or invalid params fall back to the
5
7
  * fresh-browser defaults, via `sanitizeChantPrefs`). */
6
8
  export interface SharedChant {
7
9
  script: string;
8
10
  prefs: ChantPrefs;
11
+ /** `syntax=aretino` in the link (issue #79); absent is GuidoScript */
12
+ syntax: ScriptSyntax;
9
13
  }
10
14
  /** Parses a location hash into the shared chant it carries, or null
11
15
  * when there is nothing to load — no hash at all, or no usable `script`
@@ -18,4 +22,10 @@ export declare function parseShareFragment(hash: string): SharedChant | null;
18
22
  * emitted, so a link renders identically even if the defaults ever
19
23
  * change. Percent-encoding rides on `URLSearchParams`, whose decoding
20
24
  * the fragment parser mirrors. */
21
- export declare function buildShareLink(state: Pick<EditorState, 'script' | 'settings'>): string;
25
+ export declare function buildShareLink(state: Pick<EditorState, 'script' | 'settings'> & {
26
+ syntax?: ScriptSyntax;
27
+ },
28
+ /** `expand`: the section the link opens expanded (expandLink.ts). */
29
+ options?: {
30
+ expand?: string | null;
31
+ }): string;
@@ -0,0 +1,17 @@
1
+ /** The default chant's first phrase, through "María,". */
2
+ export declare const FIRST_PHRASE = "(M) Ne(4) t\u00ED(4u)me(tT4)as,(5) Ma(3)r\u00ED(4t)a,(4t-:)";
3
+ /** Its first sentence, through "Dóminum,". */
4
+ export declare const FIRST_SENTENCE = "(M) Ne(4) t\u00ED(4u)me(tT4)as,(5) Ma(3)r\u00ED(4t)a,(4t-:) in(3)ve(4)n\u00ED(5)sti(4) gr\u00E1(567i)ti(uU6)am(4t-) a(6)pud(5) D\u00F3(4)mi(3r)num,(4-,)";
5
+ /** A segmented switch: one choice pressed, in ink. */
6
+ export declare function Seg<T extends string | number>({ label, value, options, onChange, }: {
7
+ label: string;
8
+ value: T;
9
+ options: readonly {
10
+ value: T;
11
+ label: string;
12
+ }[];
13
+ onChange: (value: T) => void;
14
+ }): import('react').JSX.Element;
15
+ /** The opening clef group of a script, as written: "(<X)". */
16
+ export declare function openingGroup(script: string): string;
17
+ export declare function Showcases(): import('react').JSX.Element;
@@ -22,6 +22,10 @@ export declare function effectiveSpacerWidth(inputs: WordInputs): number;
22
22
  export declare function effectiveTextPt(inputs: WordInputs): number;
23
23
  export declare function effectiveWidthCm(inputs: WordInputs): number;
24
24
  export declare function spacerConfig(inputs: WordInputs): SpacerConfig;
25
+ /** The tab interval a tab-spacer copy uses, pt — the value Word's
26
+ * Default tab stops must be set to; null for the other spacers, which
27
+ * need no setup. */
28
+ export declare function tabIntervalPt(inputs: WordInputs): number | null;
25
29
  /** The destination-document sizing the copy sends: Word text pt (notes
26
30
  * ride at twice it) and the line column in cm → pt. */
27
31
  export declare function wordDestination(inputs: WordInputs): Pick<WordExportOptions, 'textPt' | 'notesPt' | 'maxWidthPt'>;
@@ -0,0 +1,99 @@
1
+ import { SpelledInterval } from '../exactTranspose';
2
+ /** Every decision with its default: the decided choice (`DECIDED` in
3
+ * catalog.ts), else the prototype's recommendation. */
4
+ export declare const DEFAULTS: {
5
+ indent: string;
6
+ transpose: string;
7
+ verse: string;
8
+ range: string;
9
+ virga: string;
10
+ upLeap: string;
11
+ tenor: string;
12
+ glyphless: string;
13
+ episema: string;
14
+ moraOnLine: string;
15
+ moraInNeume: string;
16
+ plica: string;
17
+ connectors: string;
18
+ connectBeforePlica: string;
19
+ connectFromPlica: string;
20
+ connectFromSmall: string;
21
+ longLeap: string;
22
+ cut: string;
23
+ multiCut: string;
24
+ noteParens: string;
25
+ neumeLabel: string;
26
+ bar_comma: string;
27
+ bar_comma2: string;
28
+ bar_semi: string;
29
+ bar_pipe: string;
30
+ bar_empty: string;
31
+ bar_dots: string;
32
+ bar_double: string;
33
+ bar_triple: string;
34
+ bar_repStart: string;
35
+ bar_repEnd: string;
36
+ bar_repBoth: string;
37
+ breath: string;
38
+ plicaBar: string;
39
+ barLabel: string;
40
+ badClef: string;
41
+ keyMeaning: string;
42
+ accScope: string;
43
+ breaks: string;
44
+ extenderTail: string;
45
+ tildes2: string;
46
+ star: string;
47
+ dagger: string;
48
+ dagger2: string;
49
+ rv: string;
50
+ red: string;
51
+ color: string;
52
+ underline: string;
53
+ textAccidentals: string;
54
+ missingStanza: string;
55
+ extraSyllables: string;
56
+ tenorText: string;
57
+ sectionBreak: string;
58
+ };
59
+ export type DecisionId = keyof typeof DEFAULTS;
60
+ export type Decisions = Record<DecisionId, string>;
61
+ export interface Translation {
62
+ script: string;
63
+ /** Stanza 2… texts, as written into `(@stanza …)` */
64
+ stanzas: string[];
65
+ /** Things that change or approximate the score */
66
+ warnings: string[];
67
+ /** Constructs with no GuidoScript counterpart: name → count */
68
+ lost: Record<string, number>;
69
+ /** Headers and other text guidex has no place for */
70
+ metadata: Record<string, string>;
71
+ /** `W:` text blocks, kept for the host when `verse` is `meta` */
72
+ verse: string[];
73
+ /** guidex's own stanza count warnings on the result */
74
+ stanzaWarnings: string[];
75
+ error?: string;
76
+ }
77
+ export declare const BAR_DECISION: Record<string, DecisionId>;
78
+ export declare function translate(rawSource: string, d?: Decisions): Translation;
79
+ /** Aretino's transposeTarget: the target key with the fewest accidentals
80
+ * (at most 6 flats or 5 sharps, ties to flats) and the staff steps `d` */
81
+ export declare function transposeTarget(f0: number, semitones: number): {
82
+ f1: number;
83
+ d: number;
84
+ };
85
+ /** A spelled interval's name: { steps: 1, semitones: 1 } → m2 */
86
+ export declare function intervalLabel({ steps, semitones }: SpelledInterval): string;
87
+ /** One Aretino `w:` line → guidex stanza text, plus its bar labels. */
88
+ export declare function lyricsToStanza(raw: string, d: Decisions, warn: (m: string) => void, loss: (w: string) => void): {
89
+ text: string;
90
+ labels: {
91
+ text: string;
92
+ at: number;
93
+ }[];
94
+ };
95
+ /** A lyric line's words, with bar labels as words of their own: as
96
+ * Aretino reads them, a label runs from any unescaped ( to the next ),
97
+ * spaces and all ((\\red{{bold red}})), even in the middle of a word;
98
+ * spaces next to a hyphen do not end a word. */
99
+ export declare function lyricWords(raw: string): string[];
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The Aretino reader's own version: bumped by hand whenever aretinoToGuido
3
+ * gives different GuidoScript for some source (a decision, a fix, a new
4
+ * rule), and only then. A chant saved as Aretino is converted again on every
5
+ * load, so the editor stores this with it and says when today's reader is
6
+ * another. tests/aretino.test.ts fails when the output changes without a bump.
7
+ */
8
+ export declare const ARETINO_CONVERTER_VERSION = 3;
9
+ /** An Aretino source read as GuidoScript */
10
+ export interface AretinoImport {
11
+ /** The GuidoScript, stanzas included as `(@stanza …)` */
12
+ script: string;
13
+ /** Stanza 2… texts, as written into the script */
14
+ stanzas: string[];
15
+ /** What the script approximates */
16
+ warnings: string[];
17
+ /** What Aretino says that GuidoScript cannot: name → count */
18
+ lost: Record<string, number>;
19
+ /** The Aretino header fields guidex has no place for (title, caption…) */
20
+ metadata: Record<string, string>;
21
+ /** Set when the source cannot be read; `script` is then empty */
22
+ error?: string;
23
+ }
24
+ /** A GuidoScript written as Aretino */
25
+ export interface AretinoExport {
26
+ /** The Aretino source */
27
+ aretino: string;
28
+ /** What the Aretino approximates */
29
+ warnings: string[];
30
+ /** What GuidoScript says that Aretino cannot: name → count */
31
+ lost: Record<string, number>;
32
+ /** Set when the script cannot be read; `aretino` is then empty */
33
+ error?: string;
34
+ }
35
+ /** Reads an Aretino source into a GuidoScript. */
36
+ export declare function aretinoToGuido(source: string): AretinoImport;
37
+ /** Writes a GuidoScript as Aretino. */
38
+ export declare function guidoToAretino(script: string): AretinoExport;