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,3 @@
1
+ import { scriptParts } from './scriptParts';
2
+ export { scriptParts };
3
+ export declare function Opening(): import('react').JSX.Element;
@@ -0,0 +1,28 @@
1
+ export { NOTE_COLUMNS, cellOf, type NoteColumn } from './glyphData';
2
+ /** The downloadable chant font (public/downloads/, written by
3
+ * tools/staffless-font/longas.py), and the name it saves under. */
4
+ export declare const GUIDO5_SHARP_URL = "/downloads/guido5-sharp.ttf";
5
+ export declare const GUIDO5_SHARP_FILE = "guido5#.ttf";
6
+ export interface NoteRow {
7
+ base: string;
8
+ pitch: string;
9
+ cells: (string | null)[];
10
+ }
11
+ /** One row per staff position, low to high: the base glyph and each
12
+ * column's variant (null where the font has none). */
13
+ export declare function noteRows(): NoteRow[];
14
+ export interface NoteSearch {
15
+ rows: NoteRow[];
16
+ /** Indexes into NOTE_COLUMNS, in order. */
17
+ columns: number[];
18
+ /** Keys searched for exactly, marked in their cells. */
19
+ hits: Set<string>;
20
+ }
21
+ /**
22
+ * The notes table under a search. Words naming a shape or sign pick
23
+ * columns (virga, flat, accidental); every other word picks rows, by pitch
24
+ * name (c, g', a'') or by a key in the row's shown cells, exactly. Null
25
+ * when no row is left, so the table steps aside for the others.
26
+ */
27
+ export declare function searchNotes(query: string, rows: NoteRow[]): NoteSearch | null;
28
+ export declare function Reference(): import('react').JSX.Element;
@@ -1 +1,2 @@
1
- export declare function RenderSettings(): import('react').JSX.Element;
1
+ export declare function LayoutSettings(): import('react').JSX.Element;
2
+ export declare function TextSettings(): import('react').JSX.Element;
@@ -0,0 +1,8 @@
1
+ export type ScriptView = 'syllables' | 'text' | 'problems' | 'guido' | 'conversion';
2
+ export declare function ProblemsLine({ onShowProblems }: {
3
+ onShowProblems: () => void;
4
+ }): import('react').JSX.Element;
5
+ export declare function ScriptViews({ view, onView }: {
6
+ view: ScriptView;
7
+ onView: (view: ScriptView) => void;
8
+ }): import('react').JSX.Element;
@@ -0,0 +1,33 @@
1
+ import { RefObject } from 'react';
2
+ export declare const canFullscreen: () => boolean;
3
+ /** `section`: the section's id, its name in the link (`expand=editor`). */
4
+ /** Whether a section is expanded or full screen now: a copied link opens
5
+ * it expanded (full screen is as close as a link can get to expanded). */
6
+ export declare function isSectionExpanded(section: string): boolean;
7
+ export declare function useSectionSize(ref: RefObject<HTMLElement | null>, section: string): {
8
+ expanded: boolean;
9
+ fullscreen: boolean;
10
+ expand: () => void;
11
+ collapse: () => void;
12
+ enterFullscreen: () => void;
13
+ exitFullscreen: () => void;
14
+ leaveAll: () => void;
15
+ };
16
+ /** A section elsewhere on the page, linked from an expanded one. */
17
+ export interface SectionLink {
18
+ id: string;
19
+ label: string;
20
+ }
21
+ /** The buttons in a section's head: Expand (the whole page) and Full
22
+ * screen (the whole screen), each with its way back. */
23
+ export declare function SectionSizeButtons({ target, section, label, links, onActiveChange, }: {
24
+ target: RefObject<HTMLElement | null>;
25
+ section: string;
26
+ label: string;
27
+ /** Told whenever the section enters or leaves the expanded or full
28
+ * screen state (the editor lays itself out for it) */
29
+ onActiveChange?: (active: boolean) => void;
30
+ /** Shown while the section is expanded or full screen, where the rest
31
+ * of the page is out of reach: each brings the page back at its section. */
32
+ links?: readonly SectionLink[];
33
+ }): import('react').JSX.Element;
@@ -1 +1,5 @@
1
+ import { GuidoScript } from '../guidoScript';
2
+ /** The pitch letters the clef lines carry in this script: c for a c-clef,
3
+ * f for an f-clef (the opening clef and every inline change). */
4
+ export declare function clefPitchLetters(script: GuidoScript): Set<string>;
1
5
  export declare function StaffSettings(): import('react').JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { RefObject } from 'react';
2
+ export declare function StaffedGlyph({ text, className }: {
3
+ text: string;
4
+ className: string;
5
+ }): import('react').JSX.Element;
6
+ /** Snaps the drawn lines under `root` after every render and on resize
7
+ * (which a browser zoom fires). */
8
+ export declare function useSnappedStaff(root: RefObject<HTMLElement | null>): void;
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ export interface TabSpec<T extends string> {
3
+ id: T;
4
+ label: ReactNode;
5
+ }
6
+ export declare function tabPanelId(idPrefix: string, tab: string): string;
7
+ export declare function tabId(idPrefix: string, tab: string): string;
8
+ export declare function TabList<T extends string>({ idPrefix, label, tabs, selected, onSelect, className, }: {
9
+ idPrefix: string;
10
+ label: string;
11
+ tabs: readonly TabSpec<T>[];
12
+ selected: T;
13
+ onSelect: (tab: T) => void;
14
+ className?: string;
15
+ }): import('react').JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function TakeItOut(): import('react').JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function ThemeSwitch(): import('react').JSX.Element;
@@ -0,0 +1,6 @@
1
+ export declare const CHANGELOG_URL = "https://github.com/BrownieMaar/guidex/blob/main/CHANGELOG.md";
2
+ export declare const SECTIONS: readonly {
3
+ id: string;
4
+ label: string;
5
+ }[];
6
+ export declare function TopBar(): import('react').JSX.Element;
@@ -0,0 +1,21 @@
1
+ export declare function clampWidth(px: number): number;
2
+ /** The key's new width, or null for a key the slider ignores. */
3
+ export declare function widthForKey(width: number, key: string, shift: boolean, min?: number, max?: number): number | null;
4
+ /** A drag bar for a width: a pointer drag in 10 px steps (one change per
5
+ * frame at most) and a keyboard slider. The editor's score and the
6
+ * reflow showcase both use it. */
7
+ export declare function WidthBar({ id, value, min, max, label, onChange, }: {
8
+ id?: string;
9
+ value: number;
10
+ min: number;
11
+ max: number;
12
+ label?: string;
13
+ onChange: (px: number) => void;
14
+ }): import('react').JSX.Element;
15
+ export declare function WidthHandle(): import('react').JSX.Element | null;
16
+ /** The phone's stand-in for the drag bar. */
17
+ export declare function WidthSlider(): import('react').JSX.Element | null;
18
+ /** The Layout tab's numeric field. It keeps what is typed while the field
19
+ * has the focus: an in-range value applies at once, anything else clamps
20
+ * on commit (blur or Enter); a change from the bar shows up here. */
21
+ export declare function WidthField(): import('react').JSX.Element;
@@ -0,0 +1,47 @@
1
+ import { CaretTarget } from './caretSync';
2
+ import { InkedRun } from './scriptParts';
3
+ type Range = {
4
+ start: number;
5
+ end: number;
6
+ };
7
+ /** One note group of the script, and where it came from in the source */
8
+ interface Slot {
9
+ /** The script syllable the group belongs to (its token, held or not) */
10
+ syl: number;
11
+ /** Its neume on the music line */
12
+ neume: Range;
13
+ /** Its syllable on each w: line under it (stanza 1 first) */
14
+ lyrics: Range[];
15
+ }
16
+ export interface AretinoCaretMap {
17
+ slots: Slot[];
18
+ /** Per script syllable: held by the one before it */
19
+ held: boolean[];
20
+ /** The script's syllable count (the score must have as many) */
21
+ syllables: number;
22
+ }
23
+ /**
24
+ * The lyric slots of one w: line, in text offsets: one per syllable, plus
25
+ * one per hold (a lone `-`, an empty syllable in `Al--le`, each extender `_`).
26
+ * Bar labels `(…)` and display parts before `~~` take no slot.
27
+ */
28
+ export declare function lyricSlots(text: string): Range[];
29
+ /** The map for an Aretino source and the GuidoScript it converted to, or
30
+ * null when they cannot be matched. */
31
+ export declare function aretinoCaretMap(source: string, guido: string): AretinoCaretMap | null;
32
+ /** The syllable the caret is on, from the music line or a w: line: the
33
+ * neume or syllable it is in, else the last one before it on its line. */
34
+ export declare function aretinoCaretTarget(map: AretinoCaretMap, source: string, caret: number): CaretTarget | null;
35
+ /** The two places of the caret's syllable in the source: its text on the
36
+ * first w: line (the holder's), and the neume the caret is on. */
37
+ export declare function aretinoTints(map: AretinoCaretMap, target: CaretTarget): {
38
+ run: Range;
39
+ neume: Range | null;
40
+ } | null;
41
+ /** Where a click on syllable `index` in the score puts the caret: after its
42
+ * text on the w: line, else after its neume. */
43
+ export declare function aretinoCaretForSyllable(map: AretinoCaretMap, index: number): number | null;
44
+ /** An Aretino source cut into runs for the inked copy behind the textarea:
45
+ * no group ink, only the caret's syllable text and neume tinted. */
46
+ export declare function tintedRuns(text: string, run: Range | null, neume: Range | null): InkedRun[];
47
+ export {};
@@ -0,0 +1,46 @@
1
+ import { ScriptSyntax } from '../editorStorage';
2
+ /** What the editor renders for a source: the GuidoScript, and for an
3
+ * Aretino source what the conversion could not keep. */
4
+ export interface SourceConversion {
5
+ /** The GuidoScript the editor renders */
6
+ guido: string;
7
+ /** What Aretino says that GuidoScript cannot: name → count */
8
+ lost: Record<string, number>;
9
+ /** What the GuidoScript approximates */
10
+ warnings: string[];
11
+ /** The Aretino header fields guidex has no place for (title, caption…) */
12
+ metadata: Record<string, string>;
13
+ /** Set when the source does not convert: `guido` is then the last
14
+ * version that did (or empty) */
15
+ error: string | null;
16
+ }
17
+ /** Aretino Chant's own site: the notation's reference, its engine and editor */
18
+ export declare const ARETINO_SITE = "https://aretino-chant.github.io/";
19
+ /** Converts a source written in `syntax`. A source that does not convert
20
+ * keeps `lastGood`, the GuidoScript of the last version that did, so the
21
+ * score does not go blank while it is being typed. */
22
+ export declare function convertSource(source: string, syntax: ScriptSyntax, lastGood?: string): SourceConversion;
23
+ /** Whether pasted text looks like Aretino rather than GuidoScript: at least
24
+ * two of a `%key:` header or `%%`, a clef such as (g2) or (c4) opening a
25
+ * line, and a `w:` or `W:` lyrics line. A GuidoScript chant has none. */
26
+ export declare function looksLikeAretino(text: string): boolean;
27
+ /** What switching a chant to the other syntax does to it */
28
+ export interface SwitchReport {
29
+ /** The source in the other syntax */
30
+ text: string;
31
+ /** What the other syntax cannot say: name → count */
32
+ lost: [string, number][];
33
+ /** What the conversion approximates */
34
+ warnings: string[];
35
+ /** GuidoScript → Aretino: how many note groups come back respelled
36
+ * towards the ideal form (connectors, virgas, gaps) */
37
+ corrected: number;
38
+ /** Aretino → GuidoScript: the header fields that go (title, caption…) */
39
+ dropped: string[];
40
+ /** Set when the source does not convert: nothing switches */
41
+ error: string | null;
42
+ }
43
+ /** Converts a source to the other syntax and says what changes. */
44
+ export declare function switchReport(source: string, from: ScriptSyntax): SwitchReport;
45
+ /** A new Aretino chant's starting text */
46
+ export declare const NEW_ARETINO = "(g2) \nw: ";
@@ -0,0 +1,48 @@
1
+ /** One syllable token of the script as written, with its source offsets. */
2
+ export interface SourceSyllable {
3
+ /** Its text's first character (its `(` when it has no text) */
4
+ start: number;
5
+ /** Just past its `)` */
6
+ end: number;
7
+ /** Its notes' first character, past its `(` */
8
+ notesStart: number;
9
+ /** Just past its notes, before its `)`: where a click puts the caret */
10
+ notesEnd: number;
11
+ held: boolean;
12
+ empty: boolean;
13
+ }
14
+ /** The script's syllables with their offsets, or null when it does not
15
+ * parse (the score shows the error instead). */
16
+ export declare function sourceSyllables(source: string): SourceSyllable[] | null;
17
+ /**
18
+ * The syllable the caret is in: the last one starting at or before it. A
19
+ * caret in a statement belongs to the syllable before it; a held group
20
+ * shows as the syllable that holds it, whose text is the one on the score.
21
+ * Null before the first syllable (in the clef).
22
+ */
23
+ export declare function syllableAtCaret(syllables: readonly SourceSyllable[], caret: number): number | null;
24
+ /** Where the caret goes for syllable `index`: at the end of its notes, so
25
+ * typing adds to the group the click picked. */
26
+ export declare function caretForSyllable(syllables: readonly SourceSyllable[], index: number): number | null;
27
+ /**
28
+ * The neumes of a group's notes: one `[from, to)` range per run of
29
+ * characters between break characters (leading and trailing dashes belong
30
+ * to none). The layout splits a long group only at these characters, so
31
+ * the source and the rendered group have the same neumes in the same order.
32
+ */
33
+ export declare function neumeRanges(notes: string): [number, number][];
34
+ /** The neume at `offset` in `notes`: the one it is in or right after
35
+ * (typing there extends it), else the next one; null in a group with none. */
36
+ export declare function neumeAt(notes: string, offset: number): number | null;
37
+ /** What the caret is on: the syllable whose text the score shows
38
+ * (`holder`) with the held groups that follow it (`run`, holder first), the
39
+ * token the caret is in (`token`, a held group or the holder), and the
40
+ * neume of that token's notes the caret is in (`neume`, null when the caret
41
+ * is outside its notes). */
42
+ export interface CaretTarget {
43
+ holder: number;
44
+ run: number[];
45
+ token: number;
46
+ neume: number | null;
47
+ }
48
+ export declare function caretTarget(syllables: readonly SourceSyllable[], source: string, caret: number): CaretTarget | null;
@@ -1,9 +1,13 @@
1
1
  /** The save form's name suggestion: the chant's first few words. */
2
2
  export declare function suggestName(script: string): string;
3
- /** The row parts the samples row hosts: the chant chips and the two
4
- * buttons live between the sample chips and the row's feedback spans. */
5
- export declare function ChantLibraryRowParts(): import('react').JSX.Element;
6
- /** Inline save form, between the chips row and the textarea. */
3
+ /** The saved chants as chips between the sample chips and the Save chant
4
+ * button. The active mark follows the editor's content (a hand edit
5
+ * clears it in the reducer), so no re-render can resurrect it on a chant
6
+ * that is no longer loaded. */
7
+ export declare function ChantChips(): import('react').JSX.Element;
8
+ export declare function SaveChantButton(): import('react').JSX.Element;
9
+ export declare function ManageChantsButton(): import('react').JSX.Element;
10
+ /** Inline save form, under the editor toolbar. */
7
11
  export declare function ChantSaveForm(): import('react').JSX.Element;
8
12
  /** The reorderable list view: every chant as a row, rebuilt from state on
9
13
  * every change, so the order, the rename input, and the delete confirm
@@ -0,0 +1,11 @@
1
+ import { ScriptSyntax } from '../editorStorage';
2
+ import { EditorState } from './editorState';
3
+ /** `script` is the chant as GuidoScript (an Aretino draft converted);
4
+ * `source` and `syntax` are the draft as written, for the share link. */
5
+ export type EditorSnapshot = Pick<EditorState, 'script' | 'settings'> & {
6
+ source?: string;
7
+ syntax?: ScriptSyntax;
8
+ };
9
+ export declare function setEditorSnapshot(next: EditorSnapshot): void;
10
+ export declare function getEditorSnapshot(): EditorSnapshot;
11
+ export declare function useEditorSnapshot(): EditorSnapshot;
@@ -1,5 +1,5 @@
1
1
  import { StaffFill } from '../chantLayout';
2
- import { ChantPrefs, EditorSettings, SavedChant } from '../editorStorage';
2
+ import { ChantPrefs, EditorSettings, SavedChant, ScriptSyntax } from '../editorStorage';
3
3
  import { StyleSetName } from '../guidoStyles';
4
4
  import { TranspositionTarget } from '../guidoScriptTransforms';
5
5
  import { GuidoScript } from '../guidoScript';
@@ -13,7 +13,7 @@ import { WordInputs } from './wordCopy';
13
13
  export type RenderSettings = Omit<EditorSettings, 'word'>;
14
14
  /** Transient feedback slots: one `word-copy-feedback`-style span each,
15
15
  * shown for 4 s and cleared by their own timer (FeedbackSpan). */
16
- export type FeedbackSlot = 'draft' | 'copyScript' | 'copyLink' | 'downloadImage' | 'wordCopy' | 'chantSaved' | 'chantSaveForm' | 'chantList';
16
+ export type FeedbackSlot = 'draft' | 'copySource' | 'copyText' | 'copyScript' | 'copyLink' | 'downloadImage' | 'wordCopy' | 'chantSaved' | 'chantSaveForm' | 'chantList';
17
17
  export interface Feedback {
18
18
  message: string;
19
19
  error: boolean;
@@ -31,6 +31,18 @@ export interface SyllableRow {
31
31
  export interface EditorState {
32
32
  /** The textarea's raw script — the draft. */
33
33
  script: string;
34
+ /** The syntax the draft is written in (issue #79): an Aretino draft is
35
+ * converted to GuidoScript on every edit (aretinoSource.ts). */
36
+ syntax: ScriptSyntax;
37
+ /** What the last syntax switch replaced, offered back until the next
38
+ * edit: a switch is one undo step, text and syntax together. */
39
+ switchUndo: {
40
+ script: string;
41
+ syntax: ScriptSyntax;
42
+ } | null;
43
+ /** The Aretino reader's version a loaded Aretino chant was saved with,
44
+ * null for anything else */
45
+ savedConverter: number | null;
34
46
  /** The chip (sample or saved chant) the editor's content was loaded
35
47
  * from; any hand edit clears it. */
36
48
  activeChipId: string | null;
@@ -83,9 +95,21 @@ export declare const INITIAL_EXACT: ExactInputs;
83
95
  /** The backend target the exact-transposition controls describe, or
84
96
  * null when they are off. */
85
97
  export declare function exactTarget(exact: ExactInputs): TranspositionTarget | null;
86
- export type EditorAction = {
98
+ export type EditorAction =
99
+ /** `syntax`: the script arrives in that syntax (a lesson opens GuidoScript) */
100
+ {
87
101
  type: 'EDIT_SCRIPT';
88
102
  script: string;
103
+ syntax?: ScriptSyntax;
104
+ }
105
+ /** Converts the chant to the other syntax (or only reads its text as the
106
+ * other one, when `script` is the text as it is) */
107
+ | {
108
+ type: 'SWITCH_SYNTAX';
109
+ syntax: ScriptSyntax;
110
+ script: string;
111
+ } | {
112
+ type: 'UNDO_SWITCH';
89
113
  } | {
90
114
  type: 'LOAD_SAMPLE';
91
115
  index: number;
@@ -98,6 +122,9 @@ export type EditorAction = {
98
122
  } | {
99
123
  type: 'SET_BOLD';
100
124
  bold: boolean;
125
+ } | {
126
+ type: 'SET_TEXT_FONT';
127
+ font: string;
101
128
  } | {
102
129
  type: 'SET_JUNCTION_DASHES';
103
130
  dashes: number;
@@ -110,12 +137,18 @@ export type EditorAction = {
110
137
  } | {
111
138
  type: 'SET_STAFF_FILL_SNAP';
112
139
  px: number;
140
+ } | {
141
+ type: 'SET_PADDING';
142
+ px: number;
113
143
  } | {
114
144
  type: 'SET_STAFF';
115
145
  patch: Partial<Pick<RenderSettings, StaffSettingKey | 'staffToEdges'>>;
116
146
  } | {
117
147
  type: 'SET_MAX_WIDTH';
118
148
  px: number;
149
+ } | {
150
+ type: 'SET_UNBOUND_WIDTH';
151
+ unbound: boolean;
119
152
  } | {
120
153
  type: 'SET_TRANSPOSE';
121
154
  shift: number;
@@ -212,7 +245,7 @@ export declare function buildEditorScript(state: Pick<EditorState, 'script' | 's
212
245
  };
213
246
  /** The drawn staff's settings: saved with the settings, saved chants and
214
247
  * share links like the other render settings. */
215
- export declare const STAFF_SETTING_KEYS: readonly ["staff", "staffLines", "staffColor", "staffLineColors", "staffPitchColors", "staffWeight", "staffLineWeights", "staffClefLineWeight"];
248
+ export declare const STAFF_SETTING_KEYS: readonly ["staff", "staffLines", "staffColor", "staffLineColors", "staffPitchColors", "staffWeight", "staffLineWeights", "staffClefLineWeight", "staffClefLineColor", "clefMark"];
216
249
  export type StaffSettingKey = (typeof STAFF_SETTING_KEYS)[number];
217
250
  /** The render settings a saved chant snapshots: style, bold, base/chant
218
251
  * sizes with their decouple state, and transpose —
@@ -227,7 +260,7 @@ export declare function settingsSnapshot(state: EditorState): EditorSettings;
227
260
  * ride the same handoff: a decoupled chant without a custom size adopts
228
261
  * the derived 2× base size of the chant's own base font size. */
229
262
  export declare function chantPrefsOverlay(prefs: ChantPrefs): {
230
- settings: Pick<RenderSettings, 'style' | 'bold' | 'transpose' | 'basePx' | 'decoupleNotes' | 'notesPx' | 'notesCustom' | 'junctionDashes' | 'staffFill' | 'staffFillSnapPx' | 'twoSyllableRecitationsToPlain' | 'plainRunsToRecitation' | StaffSettingKey>;
263
+ settings: Pick<RenderSettings, 'style' | 'bold' | 'textFont' | 'transpose' | 'basePx' | 'decoupleNotes' | 'notesPx' | 'notesCustom' | 'junctionDashes' | 'staffFill' | 'staffFillSnapPx' | 'paddingPx' | 'twoSyllableRecitationsToPlain' | 'plainRunsToRecitation' | StaffSettingKey>;
231
264
  inputs: {
232
265
  basePx: string;
233
266
  notesPx: string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The expanded section in the URL fragment: `expand=editor` or
3
+ * `expand=learn`, one more `&`-separated part beside whatever else the
4
+ * fragment carries, so it rides along with a share link
5
+ * (`#script=…&style=BNS&expand=editor`) or stands alone (`#expand=learn`).
6
+ * Another page can link straight to an expanded editor or lesson.
7
+ *
8
+ * The other parts are kept byte for byte (a share link's encoding, a bare
9
+ * `#learn` anchor), and the URL changes with `history.replaceState`: no
10
+ * history entry, no `hashchange`, no scroll, and the share-link parser,
11
+ * which reads the fragment once at mount, never sees a difference.
12
+ */
13
+ /** The section the fragment expands, or null. */
14
+ export declare function expandedIn(hash: string): string | null;
15
+ /** The fragment with `section` expanded (null: none), the rest as it was.
16
+ * Returns '' for an empty fragment. */
17
+ export declare function withExpanded(hash: string, section: string | null): string;
18
+ /** Writes the expanded section into the address bar, if it changed. */
19
+ export declare function writeExpanded(section: string | null): void;
@@ -0,0 +1,37 @@
1
+ import { VariantRole } from '../glyphFamilies';
2
+ /**
3
+ * Four short strokes on each pitch from b to g''. Guido HU draws them, but
4
+ * they are no variant of the glyph data (the exact transposition does not
5
+ * know them), so the table carries them itself.
6
+ */
7
+ export declare const STROKES: Readonly<Record<string, string>>;
8
+ export interface NoteColumn {
9
+ label: string;
10
+ /** The glyph-data role; null for the base glyph, or with `glyphs`. */
11
+ role: VariantRole | null;
12
+ /** Base glyph → this column's glyph, for shapes outside the glyph data. */
13
+ glyphs?: Readonly<Record<string, string>>;
14
+ words: readonly string[];
15
+ }
16
+ export declare const NOTE_COLUMNS: readonly NoteColumn[];
17
+ /** A column's glyph on a pitch, or null where the font has none. */
18
+ export declare function cellOf(column: NoteColumn, base: string): string | null;
19
+ export declare const CLEF_NAMES: Record<string, string>;
20
+ export declare const MARKS: readonly {
21
+ key: string;
22
+ what: string;
23
+ }[];
24
+ /** The rest of the font: glyphs with no pitch of their own, by kind.
25
+ * `show` is how a tile draws it, `key` what a click copies (as typed in a
26
+ * script). */
27
+ export interface OtherGlyph {
28
+ key: string;
29
+ label?: string;
30
+ show: string;
31
+ what: string;
32
+ words: string;
33
+ }
34
+ export declare const OTHER_GLYPHS: readonly {
35
+ title: string;
36
+ glyphs: readonly OtherGlyph[];
37
+ }[];
@@ -0,0 +1,4 @@
1
+ import { ScoreSource, LiveScoreOptions } from './LiveScore';
2
+ export declare function embedSnippet(source: ScoreSource, options?: LiveScoreOptions & {
3
+ maxWidthPx?: number | 'auto';
4
+ }): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Writes text into a textarea at its caret (replacing the selection), the
3
+ * way typing would: through `execCommand('insertText')` so native undo
4
+ * keeps the step and the browser fires the `input` event a controlled value
5
+ * listens for. Without execCommand (jsdom, exotic browsers) the fallback
6
+ * writes the text directly and dispatches that event itself.
7
+ *
8
+ * `caretBack` leaves the caret that many characters before the end of the
9
+ * inserted text: between a bracket pair, or inside a statement waiting for
10
+ * its argument.
11
+ */
12
+ export declare function insertAtCaret(el: HTMLTextAreaElement, text: string, caretBack?: number): void;
@@ -0,0 +1 @@
1
+ export declare function Learn(): import('react').JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { Lesson, LessonOptions, LessonTry } from './lessons';
2
+ /** Applies (or, with `undo`, takes back) a try's text edits; null when
3
+ * one of them cannot be found in the script. */
4
+ export declare function applyEdits(script: string, edits?: LessonTry['edits'], undo?: boolean): string | null;
5
+ /** The options of the tries switched on, later ones winning. */
6
+ export declare function triedOptions(lesson: Lesson, applied: boolean[]): LessonOptions;
7
+ export declare const LESSON_MIN_WIDTH = 160;
8
+ export declare function LessonCard({ lesson, number, onTried, }: {
9
+ lesson: Lesson;
10
+ number: number;
11
+ onTried: () => void;
12
+ }): import('react').JSX.Element;
@@ -0,0 +1,64 @@
1
+ import { EmptySlots } from '../../stanzas';
2
+ import { NarrowGoal } from './narrowing';
3
+ export interface LessonOptions {
4
+ style?: 'BNS' | 'Vesperale';
5
+ stanza?: number;
6
+ stack?: 'all';
7
+ emptySlots?: EmptySlots;
8
+ }
9
+ /** A render option a lesson shows as a switch of its own. */
10
+ export type LessonControlKey = 'plainRunsToRecitation' | 'twoSyllableRecitationsToPlain';
11
+ export interface LessonControl {
12
+ key: LessonControlKey;
13
+ label: string;
14
+ }
15
+ /** The engine's own defaults, where a lesson's switches start. */
16
+ export declare const CONTROL_DEFAULTS: Record<LessonControlKey, boolean>;
17
+ export interface LessonTry {
18
+ label: string;
19
+ edits?: [from: string, to: string][];
20
+ options?: LessonOptions;
21
+ /** Narrow the score to the widest width that shows this. */
22
+ narrow?: NarrowGoal;
23
+ /** Flip this lesson switch: pressed while it is on. */
24
+ control?: LessonControlKey;
25
+ }
26
+ export interface Lesson {
27
+ title: string;
28
+ /** The chant on the card, for the score's label. */
29
+ chant: string;
30
+ paragraphs: string[];
31
+ script: string;
32
+ tries: LessonTry[];
33
+ /** Render options shown as switches on the card. */
34
+ controls?: LessonControl[];
35
+ /** Notation introduced, shown as code chips. */
36
+ introduces: string[];
37
+ /** Written in Aretino (issue #79): the card converts it to draw it,
38
+ * and Open in editor opens it as an Aretino chant */
39
+ syntax?: 'aretino';
40
+ /** Where to read further, outside the page */
41
+ links?: {
42
+ label: string;
43
+ href: string;
44
+ }[];
45
+ }
46
+ /** "Telluris ingens Conditor", the hymn of the stanza tests: an invented
47
+ * stepwise melody under the c-clef on line 4, kept for showcase D, which
48
+ * needs a c-clef for its C and F lines (the liturg.io corpus has none). */
49
+ export declare const TELLURIS_MELODY: string;
50
+ /** "Te lucis ante términum", verbatim from the liturg.io export
51
+ * (tests/fixtures/liturgio-corpus.json, hymn-stack/hymn-te-lucis-ante-terminum-psn):
52
+ * three stanzas, each line pair a kept run inside a kept strophe half.
53
+ * The stanza text separates syllables with soft hyphens (U+00AD). */
54
+ export declare const TE_LUCIS = "(M)(@keep)(@keep) Te(1) lu(0)cis(1) an(eE2)te(3r) t\u00E9r(3)mi(2)num,(1-:)(@keep off)(@keep) re(1r)rum(4) Cre(3)\u00E1(4)tor,(tT4) p\u00F3(3)sci(wW1)mus,(2-,)(@keep off)(@keep off)(@keep)(@keep) ut(1) s\u00F3(2)li(3)ta(0) cle(\u00F0)m\u00E9n(0q)ti(1)a(1-:)(@keep off)(@keep) sis(1) pr\u00E6(0)sul(1) ad(eE2) cu(3r)st\u00F3(3)di(2)am.(1-,,)(@keep off)(@keep off)(@stanza Pro\u00ADcul re\u00ADc\u00E9\u00ADdant s\u00F3m\u00ADni\u00ADa et n\u00F3\u00ADcti\u00ADum phan\u00ADt\u00E1s\u00ADma\u00ADta, ho\u00ADst\u00E9m\u00ADque no\u00ADstrum c\u00F3m\u00ADpri\u00ADme, ne pol\u00ADlu\u00AD\u00E1n\u00ADtur c\u00F3r\u00ADpo\u00ADra!)(@stanza Pr\u00E6\u00ADsta, Pa\u00ADter om\u00ADn\u00ED\u00ADpo\u00ADtens, per Ie\u00ADsum Chri\u00ADstum D\u00F3\u00ADmi\u00ADnum, qui te\u00ADcum in per\u00ADp\u00E9\u00ADtu\u00ADum reg\u00ADnat cum San\u00ADcto Sp\u00ED\u00ADri\u00ADtu!)";
55
+ /** "Lucis Creátor óptime", verbatim from the same export
56
+ * (hymn-stack/hymn-lucis-creator-optime-psn): four stanzas, for showcase E. */
57
+ export declare const LUCIS_CREATOR = "(M)(@keep)(@keep) Lu(5)cis(rf2e) Cre(1)\u00E1(3)tor(3) \u00F3(5)pti(3r)me,(4-:)(@keep off)(@keep) lu(5)cem(rf2e) di(1)\u00E9(3)rum(3) pr\u00F3(5)fe(3r)rens,(4-,)(@keep off)(@keep off)(@keep)(@keep) pri(5)m\u00F3r(7)di(6u)is(5) lu(4)cis(4) no(3)v\u00E6(2-:)(@keep off)(@keep) mun(3)di(4) pa(1)rans(3) o(3)r\u00ED(5)gi(3r)nem,(4-,,)(@keep off)(@keep off)(@stanza Qui ma\u00ADne iun\u00ADctum v\u00E9s\u00ADpe\u00ADri di\u00ADem vo\u00ADc\u00E1\u00ADri pr\u01FD\u00ADci\u00ADpis: t\u00E6\u00ADtrum cha\u00ADos il\u00ADl\u00E1\u00ADbi\u00ADtur, au\u00ADdi pre\u00ADces cum fl\u00E9\u00ADti\u00ADbus!)(@stanza C\u00E6\u00ADl\u00F3\u00ADrum pul\u00ADset \u00EDn\u00ADti\u00ADmum, vi\u00ADt\u00E1\u00ADle tol\u00ADlat pr\u01FD\u00ADmi\u00ADum, vi\u00ADt\u00E9\u00ADmus om\u00ADne n\u00F3\u00ADxi\u00ADum, pur\u00ADg\u00E9\u00ADmus om\u00ADne p\u00E9s\u00ADsi\u00ADmum!)(@stanza Ne mens, gra\u00ADv\u00E1\u00ADta cr\u00ED\u00ADmi\u00ADne, vi\u00ADt\u00E6 sit ex\u00ADsul m\u00FA\u00ADne\u00ADre, dum nil pe\u00ADr\u00E9n\u00ADne c\u00F3\u00ADgi\u00ADtat, se\u00ADs\u00E9\u00ADque cul\u00ADpis \u00EDl\u00ADli\u00ADgat!)";
58
+ export declare const LAUDATE_SECOND_HALF = "lau(8)d\u00E1(9)te(\u00FC) e(\u00F6)um(9) om(8)nes(9) p\u00F3(\u00F6)pu(9)li.(8-.)";
59
+ export declare const LAUDATE: string;
60
+ /** The second half re-notated under the c-clef on line 3: the same
61
+ * sounding pitches, so the clef change never moves the melody. */
62
+ export declare const LAUDATE_SECOND_HALF_C3: string;
63
+ export declare const KIRALYKENT = "(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)re.(3-.)";
64
+ export declare const LESSONS: Lesson[];
@@ -0,0 +1,24 @@
1
+ import { LayoutOptions, LayoutResult } from '../../chantLayout';
2
+ import { ScoreSource } from '../LiveScore';
3
+ export type NarrowGoal = 'break' | 'twoRecited' | 'unitMoves';
4
+ export declare const NARROW_STEP_PX = 10;
5
+ /** The notes of every line: what a reader sees change when lines break
6
+ * elsewhere or a recitation draws differently. */
7
+ export declare function layoutSignature(result: LayoutResult): string;
8
+ /** Where the lines break: how many syllables each line holds. */
9
+ export declare function lineBreakSignature(result: LayoutResult): string;
10
+ /** The script with its kept runs released and its spacing kept: a
11
+ * `(@unit)` run becomes a `(@tight)` one, `(@keep)` statements go. */
12
+ export declare function withoutKeptRuns(script: string): string;
13
+ export declare function findNarrowWidth({ source, options, goal, from, min, step, cancelled, }: {
14
+ source: ScoreSource;
15
+ options: LayoutOptions;
16
+ goal: NarrowGoal;
17
+ /** The width the card starts from: the search goes below it. */
18
+ from: number;
19
+ /** The narrowest width the card shows. */
20
+ min: number;
21
+ step?: number;
22
+ /** Polled between steps, so a superseded search stops early. */
23
+ cancelled?: () => boolean;
24
+ }): Promise<number | 'already' | null>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The Learn section's progress in this browser: which lessons were tried
3
+ * and which one was open last. Best effort, like the editor's storage: a
4
+ * blocked or full localStorage leaves the section working without memory.
5
+ */
6
+ export declare const LEARN_STORAGE_KEY = "guidex.learn.v1";
7
+ export interface LearnProgress {
8
+ /** Lesson numbers (1-based) the visitor has tried something in. */
9
+ done: number[];
10
+ /** The lesson open last (1-based). */
11
+ current: number;
12
+ }
13
+ export declare function loadProgress(count: number): LearnProgress;
14
+ export declare function saveProgress(progress: LearnProgress): void;