@chordproject/editor 1.0.0 → 1.1.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/index.cjs +643 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +652 -70
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/autocomplete/index.ts","../src/autocomplete/chordVocabulary.ts","../src/autocomplete/chords.ts","../src/autocomplete/snippets.ts","../src/extensions.ts","../src/folding.ts","../src/language/index.ts","../src/language/chordproStream.ts","../src/language/tokens.ts","../src/linting.ts","../src/chordNotation.ts","../src/themes/base.ts","../src/themes/dark.ts","../src/themes/light.ts","../src/themes/index.ts"],"sourcesContent":["import { Compartment, EditorState, Extension } from '@codemirror/state';\nimport { EditorView, ViewUpdate } from '@codemirror/view';\nimport { chordProAutocomplete, insertChord, openCompletionList } from './autocomplete';\nexport { getChordCompletionPriorities } from './autocomplete/chords';\nimport { basicSetup } from './extensions';\nimport { chordProFolding } from './folding';\nimport { chordPro } from './language';\nimport { chordNotationLinter, duplicateDirectiveLinter, parserWarningLinter } from './linting';\nimport { ChordNotationSuggestion, findChordNotationReplacements, getChordNotationSuggestions, normalizeChordNotationText } from './chordNotation';\nimport { themeExtension, ThemeName } from './themes';\n\nexport type { ThemeName } from './themes';\nexport type { ChordNotationSuggestion } from './chordNotation';\nexport { getChordNotationSuggestions, normalizeChordNotationText } from './chordNotation';\n\nexport interface ChordProEditorOptions {\n\t/** Element that will contain the editor. */\n\tparent: HTMLElement;\n\t/** Initial document content. */\n\tdoc?: string;\n\t/** Initial theme. Defaults to 'light'. */\n\ttheme?: ThemeName;\n\t/** Extra CodeMirror extensions to append (escape hatch for advanced use cases). */\n\textensions?: Extension[];\n\tonChange?: (value: string) => void;\n\tonFocus?: () => void;\n\tonBlur?: () => void;\n}\n\nexport interface ChordProEditor {\n\t/** Underlying CodeMirror view, for advanced use cases not covered by this API. */\n\treadonly view: EditorView;\n\tgetValue(): string;\n\tsetValue(value: string): void;\n\tsetTheme(theme: ThemeName): void;\n\t/** Inserts \"[]\" at the cursor (or wraps the selection) and opens chord suggestions. */\n\tinsertChord(): void;\n\t/** Opens the completion list (chords or snippets) without needing a keyboard shortcut. */\n\topenCompletionList(): void;\n\t/** Returns grouped non-canonical chord notation suggestions for the current document. */\n\tgetChordNotationSuggestions(): ChordNotationSuggestion[];\n\t/** Replaces every suggested chord notation in one undoable CodeMirror transaction. */\n\tnormalizeChordNotation(): ChordNotationSuggestion[];\n\tfocus(): void;\n\tdestroy(): void;\n}\n\n/** Creates a standalone ChordPro editor instance. */\nexport function createChordProEditor(options: ChordProEditorOptions): ChordProEditor {\n\tconst themeCompartment = new Compartment();\n\n\tconst updateListener = EditorView.updateListener.of((update: ViewUpdate) => {\n\t\tif (update.docChanged) {\n\t\t\toptions.onChange?.(update.state.doc.toString());\n\t\t}\n\t\tif (update.focusChanged) {\n\t\t\t(update.view.hasFocus ? options.onFocus : options.onBlur)?.();\n\t\t}\n\t});\n\n\tconst state = EditorState.create({\n\t\tdoc: options.doc ?? '',\n\t\textensions: [\n\t\t\tbasicSetup(),\n\t\t\tchordPro(),\n\t\t\tchordProFolding,\n\t\t\tduplicateDirectiveLinter,\n\t\t\tparserWarningLinter,\n\t\t\tchordNotationLinter,\n\t\t\tchordProAutocomplete(),\n\t\t\tthemeCompartment.of(themeExtension(options.theme ?? 'light')),\n\t\t\tupdateListener,\n\t\t\t...(options.extensions ?? []),\n\t\t],\n\t});\n\n\tconst view = new EditorView({ state, parent: options.parent });\n\n\treturn {\n\t\tview,\n\t\tgetValue: () => view.state.doc.toString(),\n\t\tsetValue: (value: string) => {\n\t\t\tview.dispatch({\n\t\t\t\tchanges: { from: 0, to: view.state.doc.length, insert: value },\n\t\t\t});\n\t\t},\n\t\tsetTheme: (theme: ThemeName) => {\n\t\t\tview.dispatch({ effects: themeCompartment.reconfigure(themeExtension(theme)) });\n\t\t},\n\t\tinsertChord: () => {\n\t\t\tinsertChord(view);\n\t\t},\n\t\topenCompletionList: () => {\n\t\t\topenCompletionList(view);\n\t\t},\n\t\tgetChordNotationSuggestions: () => getChordNotationSuggestions(view.state.doc.toString()),\n\t\tnormalizeChordNotation: () => {\n\t\t\tconst content = view.state.doc.toString();\n\t\t\tconst normalization = normalizeChordNotationText(content);\n\t\t\tconst replacements = findChordNotationReplacements(content);\n\t\t\tif (replacements.length > 0) {\n\t\t\t\tview.dispatch({\n\t\t\t\t\tchanges: replacements.map(({ from, to, replacement }) => ({ from, to, insert: `[${replacement}]` })),\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn normalization.suggestions;\n\t\t},\n\t\tfocus: () => view.focus(),\n\t\tdestroy: () => view.destroy(),\n\t};\n}\n\n","import { Extension } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\nimport {\n\tCompletionContext,\n\tautocompletion,\n\tcompleteFromList,\n\tstartCompletion,\n} from '@codemirror/autocomplete';\nimport { chordCompletionSource } from './chords';\nimport { CHORDPRO_SNIPPETS } from './snippets';\n\nconst completeSnippets = completeFromList(CHORDPRO_SNIPPETS);\n\nfunction chordProCompletionSource(context: CompletionContext) {\n\tconst chordCompletions = chordCompletionSource(context);\n\tif (chordCompletions) return chordCompletions;\n\n\t// Directive names overlap ordinary lyrics (for example, \"t\" suggests \"title\"). Keep\n\t// snippets behind the explicit toolbar command instead of interrupting normal writing.\n\treturn context.explicit ? completeSnippets(context) : null;\n}\n\n/** Chord suggestions inside \"[...]\", plus explicitly requested directive snippets. */\nexport function chordProAutocomplete(): Extension {\n\treturn autocompletion({ override: [chordProCompletionSource], activateOnTyping: true });\n}\n\n/**\n * Opens the completion list (chords or directive snippets, depending on cursor position) without\n * requiring a keyboard shortcut. On Mac, every Ctrl/Option+key combo risks colliding with system\n * shortcuts or accent dead-keys (especially on Spanish/Latin American layouts) - a button click\n * sidesteps that entirely, and works the same on mobile where there's no keyboard shortcut at all.\n */\nexport function openCompletionList(view: EditorView): boolean {\n\tview.focus();\n\treturn startCompletion(view);\n}\n\n/**\n * Inserts \"[]\" at the cursor (or wraps the current selection, e.g. \"Am\" -> \"[Am]\") and opens\n * the chord completion list. Meant for a toolbar button / shortcut so reaching for the \"[\"\n * key isn't required - most useful on mobile and on a brand new, chord-less song.\n */\nexport function insertChord(view: EditorView): boolean {\n\tconst range = view.state.selection.main;\n\tconst selected = view.state.sliceDoc(range.from, range.to);\n\tview.dispatch({\n\t\tchanges: { from: range.from, to: range.to, insert: `[${selected}]` },\n\t\tselection: { anchor: range.from + 1 + selected.length },\n\t});\n\tview.focus();\n\tstartCompletion(view);\n\treturn true;\n}\n","// Common chord roots (both sharp and flat spellings, since musicians use either)\n// and a practical subset of the official ChordPro extension list:\n// https://www.chordpro.org/chordpro/chordpro-chords/#appendix-list-of-known-chord-extensions\n// We don't enumerate every possible extension (the spec's list is huge) - just the ones\n// musicians actually reach for often, so the dropdown stays useful instead of overwhelming.\nconst ROOTS = ['A', 'A#', 'Bb', 'B', 'C', 'C#', 'Db', 'D', 'D#', 'Eb', 'E', 'F', 'F#', 'Gb', 'G', 'G#', 'Ab'];\n\nconst QUALITIES = ['', 'm', '7', 'm7', 'maj7', 'sus2', 'sus4', '6', 'm6', '9', 'add9', 'dim', 'dim7', 'aug', 'm7b5'];\n\n/** Every root+quality combination, e.g. \"C\", \"Cm\", \"Cmaj7\", \"C#sus4\", ... */\nexport const CHORD_VOCABULARY: readonly string[] = ROOTS.flatMap((root) => QUALITIES.map((quality) => root + quality));\n","import { EditorState } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\nimport { Completion, CompletionContext, CompletionResult } from '@codemirror/autocomplete';\nimport { CHORD_VOCABULARY } from './chordVocabulary';\n\nconst CHORD_TOKEN = /\\[([A-G](?:#|b)?(?:min|mi|m(?!aj)|-)?[^\\]\\s-]*(?:\\/[A-G](?:#|b)?)?)\\]/g;\nconst FREQUENCY_BOOST = 100;\nconst TRANSITION_BOOST = 1_000;\nconst PATTERN_BOOST = 10_000;\n\ninterface ChordOccurrence {\n\tname: string;\n\tfrom: number;\n}\n\n/** Counts how many times each chord already appears in the document, keyed by chord text. */\nfunction countUsedChords(state: EditorState): Map<string, number> {\n\tconst counts = new Map<string, number>();\n\tfor (const { name: chord } of getChordOccurrences(state.doc.toString())) {\n\t\tcounts.set(chord, (counts.get(chord) ?? 0) + 1);\n\t}\n\treturn counts;\n}\n\nfunction getChordOccurrences(content: string): ChordOccurrence[] {\n\treturn [...content.matchAll(CHORD_TOKEN)].flatMap((match) => {\n\t\treturn match.index === undefined ? [] : [{ name: match[1], from: match.index }];\n\t});\n}\n\n/**\n * Scores chords that previously followed the same local progression. Matching the last two\n * chords is stronger than matching only the immediately preceding chord, which is stronger than\n * simple usage frequency.\n */\nexport function getChordCompletionPriorities(content: string, cursor: number): Map<string, number> {\n\tconst history = getChordOccurrences(content)\n\t\t.filter((occurrence) => occurrence.from < cursor - 1)\n\t\t.map((occurrence) => occurrence.name);\n\tconst priorities = new Map<string, number>();\n\n\tfor (let index = 0; index < history.length; index++) {\n\t\tconst candidate = history[index];\n\t\tif (index > 0 && history[index - 1] === history.at(-1)) {\n\t\t\tpriorities.set(candidate, (priorities.get(candidate) ?? 0) + TRANSITION_BOOST);\n\t\t}\n\t\tif (\n\t\t\tindex > 1 &&\n\t\t\thistory[index - 2] === history.at(-2) &&\n\t\t\thistory[index - 1] === history.at(-1)\n\t\t) {\n\t\t\tpriorities.set(candidate, (priorities.get(candidate) ?? 0) + PATTERN_BOOST);\n\t\t}\n\t}\n\n\treturn priorities;\n}\n\n/**\n * Inserts the chosen chord and moves the cursor past the closing \"]\" (already created when\n * opening the ChordPro token, or added here if missing) so typing continues in the lyric, not\n * trapped back inside the brackets.\n */\nfunction applyChord(view: EditorView, completion: Completion, from: number, to: number): void {\n\tconst insert = completion.label;\n\tconst hasClosingBracket = view.state.sliceDoc(to, to + 1) === ']';\n\tconst cursor = from + insert.length + 1;\n\tview.dispatch({\n\t\tchanges: hasClosingBracket ? { from, to, insert } : { from, to, insert: `${insert}]` },\n\t\tselection: { anchor: cursor },\n\t});\n}\n\nfunction buildOptions(used: Map<string, number>, priorities: Map<string, number>): Completion[] {\n\tconst options = new Map<string, Completion>();\n\t// Chords already used in this song are boosted so they float to the top of the list -\n\t// they're the ones you're most likely to want again in the same song.\n\tconst rankedUsedChords = [...used.entries()].sort(([leftChord, leftCount], [rightChord, rightCount]) => {\n\t\tconst priorityDifference = (priorities.get(rightChord) ?? 0) - (priorities.get(leftChord) ?? 0);\n\t\treturn priorityDifference || rightCount - leftCount || leftChord.localeCompare(rightChord);\n\t});\n\tfor (const [chord, count] of rankedUsedChords) {\n\t\toptions.set(chord, {\n\t\t\tlabel: chord,\n\t\t\ttype: 'chord-used',\n\t\t\tboost: FREQUENCY_BOOST + count + (priorities.get(chord) ?? 0),\n\t\t\tapply: applyChord,\n\t\t});\n\t}\n\tfor (const chord of CHORD_VOCABULARY) {\n\t\tif (!options.has(chord)) options.set(chord, { label: chord, type: 'chord', apply: applyChord });\n\t}\n\treturn [...options.values()];\n}\n\n/** Suggests chords while typing inside \"[...]\", including common chords from the first chord. */\nexport function chordCompletionSource(context: CompletionContext): CompletionResult | null {\n\tconst match = context.matchBefore(/\\[[^\\]\\n]*/);\n\tif (!match || (match.from === match.to && !context.explicit)) return null;\n\n\treturn {\n\t\tfrom: match.from + 1,\n\t\toptions: buildOptions(\n\t\t\tcountUsedChords(context.state),\n\t\t\tgetChordCompletionPriorities(context.state.doc.toString(), match.from + 1)\n\t\t),\n\t\tvalidFor: /^[^\\]\\n]*$/,\n\t};\n}\n","import { Completion, snippetCompletion } from '@codemirror/autocomplete';\n\n// These snippets cover commonly used directives; print-only directives and features handled by\n// the client, such as transposition and chord diagrams, are intentionally left out.\nexport const CHORDPRO_SNIPPETS: readonly Completion[] = [\n\tsnippetCompletion('{album: ${value}}', { label: 'album', type: 'directive' }),\n\tsnippetCompletion('{arranger: ${value}}', { label: 'arranger', type: 'directive' }),\n\tsnippetCompletion('{artist: ${value}}', { label: 'artist', type: 'directive' }),\n\tsnippetCompletion('{artist: ${value}}', { label: 'a', type: 'directive', detail: 'artist' }),\n\tsnippetCompletion('{capo: ${5}}', { label: 'capo', type: 'directive' }),\n\tsnippetCompletion('{composer: ${value}}', { label: 'composer', type: 'directive' }),\n\tsnippetCompletion('{copyright: ${value}}', { label: 'copyright', type: 'directive' }),\n\tsnippetCompletion('{duration: ${4}:${00}}', { label: 'duration', type: 'directive' }),\n\tsnippetCompletion('{key: ${Am}}', { label: 'key', type: 'directive' }),\n\tsnippetCompletion('{key: ${Am}}', { label: 'k', type: 'directive', detail: 'key' }),\n\tsnippetCompletion('{lyricist: ${value}}', { label: 'lyricist', type: 'directive' }),\n\tsnippetCompletion('{tempo: ${120}}', { label: 'tempo', type: 'directive' }),\n\tsnippetCompletion('{time: ${4}/${4}}', { label: 'time', type: 'directive' }),\n\tsnippetCompletion('{title: ${value}}', { label: 'title', type: 'directive' }),\n\tsnippetCompletion('{title: ${value}}', { label: 't', type: 'directive', detail: 'title' }),\n\tsnippetCompletion('{subtitle: ${value}}', { label: 'subtitle', type: 'directive' }),\n\tsnippetCompletion('{subtitle: ${value}}', { label: 'st', type: 'directive', detail: 'subtitle' }),\n\tsnippetCompletion('{year: ${2020}}', { label: 'year', type: 'directive' }),\n\tsnippetCompletion('{meta: ${label} ${value}}', { label: 'meta', type: 'directive' }),\n\tsnippetCompletion('{comment: ${value}}', { label: 'comment', type: 'directive' }),\n\tsnippetCompletion('{comment: ${value}}', { label: 'c', type: 'directive', detail: 'comment' }),\n\n\tsnippetCompletion('{start_of_chorus: ${Chorus}}\\n${lyrics}\\n{end_of_chorus}', {\n\t\tlabel: 'chorus',\n\t\ttype: 'directive',\n\t}),\n\tsnippetCompletion('{start_of_chorus}', { label: 'soc', type: 'directive', detail: 'start_of_chorus' }),\n\tsnippetCompletion('{end_of_chorus}', { label: 'eoc', type: 'directive', detail: 'end_of_chorus' }),\n\n\tsnippetCompletion('{start_of_verse: ${Verse} ${1}}\\n${lyrics}\\n{end_of_verse}', {\n\t\tlabel: 'verse',\n\t\ttype: 'directive',\n\t}),\n\tsnippetCompletion('{start_of_verse}', { label: 'sov', type: 'directive', detail: 'start_of_verse' }),\n\tsnippetCompletion('{end_of_verse}', { label: 'eov', type: 'directive', detail: 'end_of_verse' }),\n\n\tsnippetCompletion('{start_of_bridge: ${Bridge}}\\n${lyrics}\\n{end_of_bridge}', {\n\t\tlabel: 'bridge',\n\t\ttype: 'directive',\n\t}),\n\tsnippetCompletion('{start_of_bridge}', { label: 'sob', type: 'directive', detail: 'start_of_bridge' }),\n\tsnippetCompletion('{end_of_bridge}', { label: 'eob', type: 'directive', detail: 'end_of_bridge' }),\n\n\tsnippetCompletion(\n\t\t'{start_of_tab}\\ne|-${1}--------------------------------|\\nB|----------------------------------|\\nG|----------------------------------|\\nD|----------------------------------|\\nA|----------------------------------|\\nE|----------------------------------|\\n{end_of_tab}',\n\t\t{ label: 'tab', type: 'directive' }\n\t),\n\tsnippetCompletion('{start_of_tab}', { label: 'sot', type: 'directive', detail: 'start_of_tab' }),\n\tsnippetCompletion('{end_of_tab}', { label: 'eot', type: 'directive', detail: 'end_of_tab' }),\n\n\tsnippetCompletion('{define: ${Am} base-fret ${1} frets ${0 0 0 0 0 0} fingers ${0 0 0 0 0 0}}', {\n\t\tlabel: 'define',\n\t\ttype: 'directive',\n\t}),\n\tsnippetCompletion('{define: ${Am} base-fret ${1} frets ${0 0 0 0 0 0} fingers ${0 0 0 0 0 0}}', {\n\t\tlabel: 'd',\n\t\ttype: 'directive',\n\t\tdetail: 'define',\n\t}),\n\n\tsnippetCompletion('[${Am}]', { label: '[', type: 'chord', detail: 'insert a chord' }),\n\n\tsnippetCompletion(\n\t\t'{title: ${value}}\\n{artist: ${value}}\\n{key: ${C}}\\n\\n${lyrics}\\n{start_of_chorus}\\n${lyrics}\\n{end_of_chorus}',\n\t\t{ label: '!', type: 'directive', detail: 'new song template' }\n\t),\n];\n","import { EditorState, Extension } from '@codemirror/state';\nimport {\n\tEditorView,\n\tkeymap,\n\tinputHandler,\n\thighlightActiveLine,\n\thighlightSpecialChars,\n\tdrawSelection,\n} from '@codemirror/view';\nimport { defaultKeymap, history, historyKeymap } from '@codemirror/commands';\nimport { bracketMatching, foldGutter, foldKeymap } from '@codemirror/language';\nimport { lintGutter, lintKeymap } from '@codemirror/lint';\nimport {\n\tacceptCompletion,\n\tcloseBrackets,\n\tcloseBracketsKeymap,\n\tcompletionKeymap,\n\tcompletionStatus,\n\tstartCompletion,\n} from '@codemirror/autocomplete';\nimport { insertChord } from './autocomplete';\n\n// True when the cursor sits right after an unclosed \"[\" on the current line.\nfunction isInsideChordBrackets(view: EditorView): boolean {\n\tconst pos = view.state.selection.main.head;\n\tconst line = view.state.doc.lineAt(pos);\n\treturn /\\[[^\\]]*$/.test(line.text.slice(0, pos - line.from));\n}\n\n// Ctrl-Space (and its Mac alternates) should suggest chords wherever the cursor is, not only\n// right after typing \"[\" - so if we're not already inside brackets, insert them first.\nfunction chordAwareCompletion(view: EditorView): boolean {\n\treturn isInsideChordBrackets(view) ? startCompletion(view) : insertChord(view);\n}\n\n// Keymaps do not receive every international keyboard or touch text-input event. Intercept the\n// actual insertion too, so any typed \"[\" always becomes a complete ChordPro token.\nconst chordBracketInputHandler = EditorView.inputHandler.of((view, from, to, text) => {\n\tif (text !== '[') return false;\n\n\tconst selected = view.state.sliceDoc(from, to);\n\tview.dispatch({\n\t\tchanges: { from, to, insert: `[${selected}]` },\n\t\tselection: { anchor: from + 1 + selected.length },\n\t});\n\tstartCompletion(view);\n\treturn true;\n});\n\n// Editing behavior shared by every instance.\nexport function basicSetup(): Extension[] {\n\treturn [\n\t\tfoldGutter(),\n\t\tlintGutter(),\n\t\thighlightSpecialChars(),\n\t\thighlightActiveLine(),\n\t\thistory(),\n\t\tdrawSelection(),\n\t\tbracketMatching(),\n\t\tcloseBrackets(),\n\t\tchordBracketInputHandler,\n\t\tEditorState.allowMultipleSelections.of(true),\n\t\tkeymap.of([\n\t\t\t// Insert a complete ChordPro token before opening suggestions so an unfinished \"[\"\n\t\t\t// is never momentarily interpreted as invalid song content.\n\t\t\t{ key: '[', run: insertChord },\n\t\t\t...closeBracketsKeymap,\n\t\t\t...defaultKeymap,\n\t\t\t...historyKeymap,\n\t\t\t...foldKeymap,\n\t\t\t...lintKeymap,\n\t\t\t// Override completionKeymap's Ctrl-Space/Option-`/Option-i (same keys, listed first so\n\t\t\t// they take precedence) to be chord-aware instead of plain startCompletion.\n\t\t\t{ key: 'Ctrl-Space', run: chordAwareCompletion },\n\t\t\t{ mac: 'Cmd-Shift-Space', run: chordAwareCompletion },\n\t\t\t{ mac: 'Alt-`', run: chordAwareCompletion },\n\t\t\t{ mac: 'Alt-i', run: chordAwareCompletion },\n\t\t\t...completionKeymap,\n\t\t\t// Tab accepts a completion/snippet field when the popup is open.\n\t\t\t{\n\t\t\t\tkey: 'Tab',\n\t\t\t\tpreventDefault: true,\n\t\t\t\trun: (view) => (completionStatus(view.state) ? acceptCompletion(view) : false),\n\t\t\t},\n\t\t]),\n\t];\n}\n","import { foldService } from '@codemirror/language';\n\n// Recognize both abbreviated and long-form ChordPro section markers for line-based folding.\nconst START_RE = /\\{(so(?<name>v|b|c|t)|start_of_(?<longname>[^\\s:}]+))(?:[: ][^}]*)?\\}/i;\nconst END_RE = /\\{(eo(?<name>v|b|c|t)|end_of_(?<longname>[^\\s:}]+))\\}/i;\n\nconst SHORT_TO_LONG: Record<string, string> = { v: 'verse', b: 'bridge', c: 'chorus', t: 'tab' };\n\nfunction blockName(match: RegExpMatchArray): string | null {\n\tconst name = match.groups?.name ?? match.groups?.longname;\n\tif (!name) return null;\n\treturn (SHORT_TO_LONG[name.toLowerCase()] ?? name.toLowerCase()).replace(/s$/, '');\n}\n\n/** Folds {start_of_x}...{end_of_x} blocks, matching start/end by block name (verse/chorus/etc). */\nexport const chordProFolding = foldService.of((state, lineStart, lineEnd) => {\n\tconst startMatch = state.doc.sliceString(lineStart, lineEnd).match(START_RE);\n\tif (!startMatch) return null;\n\tconst name = blockName(startMatch);\n\tif (!name) return null;\n\n\tlet pos = lineEnd;\n\twhile (pos < state.doc.length) {\n\t\tconst line = state.doc.lineAt(pos + 1);\n\t\tconst endMatch = line.text.match(END_RE);\n\t\tif (endMatch && blockName(endMatch) === name) {\n\t\t\treturn line.to > lineEnd ? { from: lineEnd, to: line.to } : null;\n\t\t}\n\t\tpos = line.to;\n\t}\n\treturn null;\n});\n","import { LanguageSupport } from '@codemirror/language';\nimport { chordProLanguage } from './chordproStream';\n\nexport { chordProLanguage } from './chordproStream';\n\n/** ChordPro language support: highlights directives, chords, comments and tab blocks. */\nexport function chordPro(): LanguageSupport {\n\treturn new LanguageSupport(chordProLanguage);\n}\n","import { StreamLanguage, StringStream } from '@codemirror/language';\nimport { Tag, tags as t } from '@lezer/highlight';\nimport {\n\tCHORD_TEXT,\n\tDEFINE_DIRECTIVE,\n\tDEFINE_KEYWORD,\n\tDIRECTIVE_NAME,\n\tTAB_START_DIRECTIVES,\n\tbaseDirectiveName,\n\tisKnownDirective,\n} from './tokens';\n\ntype Mode =\n\t| 'default'\n\t| 'directiveName'\n\t| 'afterName'\n\t| 'directiveValue'\n\t| 'define'\n\t| 'chord'\n\t| 'afterChord'\n\t| 'afterChordInvalid'\n\t| 'tab';\n\ninterface State {\n\tmode: Mode;\n\tpendingName: string;\n}\n\nfunction startState(): State {\n\treturn { mode: 'default', pendingName: '' };\n}\n\nfunction copyState(state: State): State {\n\treturn { ...state };\n}\n\nfunction token(stream: StringStream, state: State): string | null {\n\tif (state.mode === 'tab') {\n\t\tif (stream.match(/^\\{\\s*(end_of_tab|eot)\\s*\\}/i)) {\n\t\t\tstate.mode = 'default';\n\t\t\treturn 'directiveBrace';\n\t\t}\n\t\tif (stream.match(/^-+/)) return 'tabDash';\n\t\tif (stream.match(/^\\|+/)) return 'tabChar';\n\t\tif (stream.match(/^[A-Ga-g][b#]?/)) return 'tabString';\n\t\tif (stream.match(/^[0-9]+/)) return 'tabNumber';\n\t\tstream.next();\n\t\treturn 'tabText';\n\t}\n\n\tif (state.mode === 'define') {\n\t\tif (stream.match(/^\\}/)) {\n\t\t\tstate.mode = 'default';\n\t\t\treturn 'directiveBrace';\n\t\t}\n\t\tif (stream.eatSpace()) return null;\n\t\tif (stream.match(/^[0-9]+/)) return 'defineNumber';\n\t\tif (stream.match(DEFINE_KEYWORD)) return 'defineKeyword';\n\t\tstream.match(/^[^\\s0-9}]+/) || stream.next();\n\t\treturn 'defineValue';\n\t}\n\n\tif (state.mode === 'directiveValue') {\n\t\tif (stream.match(/^\\}/)) {\n\t\t\tstate.mode = 'default';\n\t\t\treturn 'directiveBrace';\n\t\t}\n\t\tstream.match(/^(\\\\.|[^\\\\}])+/) || stream.next();\n\t\treturn 'directiveValue';\n\t}\n\n\tif (state.mode === 'directiveName') {\n\t\tstream.eatSpace();\n\t\tconst match = stream.match(DIRECTIVE_NAME) as RegExpMatchArray | false;\n\t\tif (match) {\n\t\t\tconst name = match[0];\n\t\t\tstate.pendingName = name;\n\t\t\tstate.mode = 'afterName';\n\t\t\treturn isKnownDirective(name) ? 'directiveName' : 'directiveNameInvalid';\n\t\t}\n\t\t// Nothing that looks like a directive name right after \"{\": bail out.\n\t\tstate.mode = 'default';\n\t\tif (stream.match(/^\\}/)) return 'directiveBrace';\n\t\tstream.next();\n\t\treturn 'directiveNameInvalid';\n\t}\n\n\tif (state.mode === 'afterName') {\n\t\tconst name = baseDirectiveName(state.pendingName);\n\t\tif (stream.match(/^:/)) {\n\t\t\tstate.mode = DEFINE_DIRECTIVE.test(name) ? 'define' : 'directiveValue';\n\t\t\treturn 'directiveColon';\n\t\t}\n\t\tif (stream.match(/^\\}/)) {\n\t\t\tstate.mode = TAB_START_DIRECTIVES.test(name) ? 'tab' : 'default';\n\t\t\treturn 'directiveBrace';\n\t\t}\n\t\t// Some directives take their argument after a space instead of a colon, e.g.\n\t\t// {start_of_verse Verse 1} or {image src=\"x.jpg\"} - see \"Arguments and attributes\".\n\t\tif (stream.eatSpace()) {\n\t\t\tstate.mode = DEFINE_DIRECTIVE.test(name) ? 'define' : 'directiveValue';\n\t\t\treturn null;\n\t\t}\n\t\t// Malformed directive (e.g. stray characters before \":\" or \"}\").\n\t\tstate.mode = 'default';\n\t\tstream.next();\n\t\treturn 'directiveNameInvalid';\n\t}\n\n\tif (state.mode === 'chord' || state.mode === 'afterChord' || state.mode === 'afterChordInvalid') {\n\t\tif (stream.eat(']')) {\n\t\t\tstate.mode = 'default';\n\t\t\treturn 'chordBracket';\n\t\t}\n\t\tif (state.mode === 'chord') {\n\t\t\tconst match = stream.match(CHORD_TEXT) as RegExpMatchArray | false;\n\t\t\tstate.mode = match ? 'afterChord' : 'afterChordInvalid';\n\t\t\tif (!match) stream.match(/^[^\\]]+/);\n\t\t\treturn match ? 'chord' : 'chordInvalid';\n\t\t}\n\t\t// Already emitted the chord text; anything else before \"]\" is leftover/invalid.\n\t\tstream.match(/^[^\\]]+/);\n\t\treturn 'chordInvalid';\n\t}\n\n\t// default mode\n\tif (stream.sol() && stream.match(/^#.*/)) return 'comment';\n\tif (stream.match(/^\\{/)) {\n\t\tstate.mode = 'directiveName';\n\t\treturn 'directiveBrace';\n\t}\n\tif (stream.eat('[')) {\n\t\tstate.mode = 'chord';\n\t\treturn 'chordBracket';\n\t}\n\tstream.match(/^[^{[]+/) || stream.next();\n\treturn null;\n}\n\n// Maps our token names to Lezer highlight tags consumed by themes/*.ts.\nconst tokenTable: Record<string, Tag> = {\n\tdirectiveBrace: t.meta,\n\tdirectiveName: t.attributeName,\n\tdirectiveNameInvalid: t.invalid,\n\tdirectiveColon: t.punctuation,\n\tdirectiveValue: t.string,\n\tdefineKeyword: t.keyword,\n\tdefineNumber: t.number,\n\tdefineValue: t.string,\n\tchordBracket: t.character,\n\tchord: t.keyword,\n\tchordInvalid: t.invalid,\n\tcomment: t.lineComment,\n\ttabDash: t.comment,\n\ttabChar: t.character,\n\ttabString: t.string,\n\ttabNumber: t.number,\n\ttabText: t.comment,\n};\n\nexport const chordProLanguage = StreamLanguage.define<State>({\n\tstartState,\n\tcopyState,\n\ttoken,\n\ttokenTable,\n\tlanguageData: {\n\t\tcommentTokens: { line: '#' },\n\t},\n});\n","// Directive names recognized by this editor, aligned with the official spec:\n// https://www.chordpro.org/chordpro/chordpro-directives/ (checked Sep 2026).\n// Grouped the same way the spec groups them, so future updates are easy to diff.\n//\n// Only directives chordproject-parser actually understands (or silently tolerates as a\n// no-op) are marked \"known\" here - anything else is intentionally styled as invalid so the\n// editor and the parser always agree on what's really supported. Print/font-styling\n// directives, {chord} (superseded by the upcoming click-to-view chord diagram feature) and\n// {transpose} (superseded by our own text-rewriting transpose) are deliberately excluded.\n\nexport const PREAMBLE_DIRECTIVES = /^(new_song|ns)$/i;\n\nexport const META_DIRECTIVES =\n\t/^(title|t|sorttitle|subtitle|st|artist|sortartist|composer|arranger|lyricist|copyright|album|year|key|time|tempo|duration|capo|tag|meta)$/i;\n\nexport const FORMATTING_DIRECTIVES = /^(comment|c|highlight|comment_italic|ci|comment_box|cb|image)$/i;\n\nexport const ENV_DIRECTIVES =\n\t/^(start_of_chorus|soc|end_of_chorus|eoc|chorus|start_of_verse|sov|end_of_verse|eov|start_of_bridge|sob|end_of_bridge|eob|start_of_tab|sot|end_of_tab|eot|start_of_grid|sog|end_of_grid|eog)$/i;\n\n// Delegated environments turn their content into an image (abc/lilypond/svg) or a free text block.\nexport const DELEGATED_ENV_DIRECTIVES =\n\t/^(start_of_abc|end_of_abc|start_of_ly|end_of_ly|start_of_svg|end_of_svg|start_of_textblock|end_of_textblock)$/i;\n\n// Note: {chord} (inline diagram reference) is intentionally NOT included - see the module\n// comment above. Only {define} (custom chord diagram data) is actually used.\nexport const CHORD_DIAGRAM_DIRECTIVES = /^define$/i;\n\nexport const CUSTOM_EXTENSION_DIRECTIVE = /^x_[\\w]+$/i;\n\nconst KNOWN_DIRECTIVE_LISTS = [\n\tPREAMBLE_DIRECTIVES,\n\tMETA_DIRECTIVES,\n\tFORMATTING_DIRECTIVES,\n\tENV_DIRECTIVES,\n\tDELEGATED_ENV_DIRECTIVES,\n\tCHORD_DIAGRAM_DIRECTIVES,\n];\n\nexport const TAB_START_DIRECTIVES = /^(start_of_tab|sot)$/i;\nexport const DEFINE_DIRECTIVE = /^define$/i;\n\n\nexport const DIRECTIVE_NAME = /^[A-Za-z_][\\w]*(?:-[\\w!]+)?/;\nexport const DEFINE_KEYWORD = /^(fingers|frets|base-fret)\\b/i;\n\n/**\n * Any directive can be postfixed with \"-selector\" (optionally negated with \"!\"), e.g.\n * {comment-alto: ...} or {start_of_verse-soprano}. Strip that before checking the base name.\n * See \"Conditional directives\" in the spec.\n */\nexport function baseDirectiveName(name: string): string {\n\treturn name.replace(/-[\\w!]+$/, '');\n}\n\nexport function isKnownDirective(name: string): boolean {\n\tconst base = baseDirectiveName(name);\n\tif (CUSTOM_EXTENSION_DIRECTIVE.test(base)) return true;\n\treturn KNOWN_DIRECTIVE_LISTS.some((re) => re.test(base));\n}\n\n// A chord is either a \"*\"-prefixed annotation (printed verbatim, e.g. [*Rit.]), or a real\n// root note (A-G, case-insensitive so single lowercase notes like [f] are accepted too - see\n// \"ChordPro Implementation: Notes\") with any suffix/bass text. This intentionally mirrors\n// \"relaxed mode\" from https://www.chordpro.org/chordpro/chordpro-chords/ (unknown extensions\n// are still accepted) to match chordproject-parser's own permissive Chord.parse.\nexport const CHORD_TEXT = /^(\\*.+|[A-G](?:#{1,2}|b{1,2}|x)?[^\\]]*)/i;\n\n","import { Diagnostic, linter } from '@codemirror/lint';\nimport { EditorView } from '@codemirror/view';\nimport { ChordProParser } from '@chordproject/parser';\nimport { findChordNotationReplacements } from './chordNotation';\n\n// Directives chordproject-parser treats as singular (last one wins silently, see\n// ChordProParser.parseMetadataTag - title/subtitle/key/capo/duration/tempo/time/year/copyright\n// are plain assignments). album/artist/composer/arranger/lyricist are intentionally cumulative\n// (a song can have multiple artists) and are NOT included here.\nconst SINGULAR_DIRECTIVES: Record<string, string> = {\n\ttitle: 'title',\n\tt: 'title',\n\tsubtitle: 'subtitle',\n\tst: 'subtitle',\n\tyear: 'year',\n\tcopyright: 'copyright',\n\tkey: 'key',\n\tcapo: 'capo',\n\tduration: 'duration',\n\ttempo: 'tempo',\n\ttime: 'time',\n};\n\nconst DIRECTIVE_LINE = /^\\s*\\{\\s*([A-Za-z_][\\w]*)\\b/;\n\n/**\n * Warns (without blocking anything) when a \"singular\" directive like {title:} or {key:}\n * appears more than once - the parser silently keeps only the last one, which is easy to miss\n * if you e.g. paste a full song under some test content that already had its own {title:}.\n */\nexport const duplicateDirectiveLinter = linter((view: EditorView): Diagnostic[] => {\n\tconst diagnostics: Diagnostic[] = [];\n\tconst firstSeenAtLine = new Map<string, number>();\n\n\tfor (let lineNumber = 1; lineNumber <= view.state.doc.lines; lineNumber++) {\n\t\tconst line = view.state.doc.line(lineNumber);\n\t\tconst match = line.text.match(DIRECTIVE_LINE);\n\t\tif (!match) continue;\n\n\t\tconst canonical = SINGULAR_DIRECTIVES[match[1].toLowerCase()];\n\t\tif (!canonical) continue;\n\n\t\tconst firstLine = firstSeenAtLine.get(canonical);\n\t\tif (firstLine === undefined) {\n\t\t\tfirstSeenAtLine.set(canonical, lineNumber);\n\t\t\tcontinue;\n\t\t}\n\n\t\tdiagnostics.push({\n\t\t\tfrom: line.from,\n\t\t\tto: line.from + match[0].length,\n\t\t\tseverity: 'warning',\n\t\t\tmessage: `\"${canonical}\" ya se definió en la línea ${firstLine}; este valor la reemplaza.`,\n\t\t});\n\t}\n\n\treturn diagnostics;\n});\n\n/**\n * Surfaces parser warnings next to the ChordPro source line. The client can still\n * render its translated warning summary, while CodeMirror provides local feedback.\n */\nexport const parserWarningLinter = linter((view: EditorView): Diagnostic[] => {\n\tconst parser = new ChordProParser();\n\tparser.parse(view.state.doc.toString());\n\n\treturn parser.warnings.flatMap((warning): Diagnostic[] => {\n\t\tif (warning.lineNumber < 1 || warning.lineNumber > view.state.doc.lines) {\n\t\t\treturn [];\n\t\t}\n\t\tconst line = view.state.doc.line(warning.lineNumber);\n\t\treturn [{\n\t\t\tfrom: line.from,\n\t\t\tto: line.to,\n\t\t\tseverity: 'warning',\n\t\t\tmessage: warning.message,\n\t\t}];\n\t});\n});\n\n/** Suggests explicit, canonical ChordPro suffixes without changing valid input automatically. */\nexport const chordNotationLinter = linter((view: EditorView): Diagnostic[] => {\n\tconst diagnostics: Diagnostic[] = [];\n\tfor (const replacement of findChordNotationReplacements(view.state.doc.toString())) {\n\t\tdiagnostics.push({\n\t\t\tfrom: replacement.from,\n\t\t\tto: replacement.to,\n\t\t\tseverity: 'info',\n\t\t\tmessage: `Usa \"${replacement.replacement}\". ${replacement.reason}`,\n\t\t\tactions: [{\n\t\t\t\tname: `Reemplazar por ${replacement.replacement}`,\n\t\t\t\tapply: (targetView, actionFrom, actionTo) => {\n\t\t\t\t\ttargetView.dispatch({ changes: { from: actionFrom, to: actionTo, insert: `[${replacement.replacement}]` } });\n\t\t\t\t},\n\t\t\t}],\n\t\t});\n\t}\n\n\treturn diagnostics;\n});\n","export interface ChordNotationSuggestion {\n\toriginal: string;\n\treplacement: string;\n\toccurrences: number;\n\treason: string;\n}\n\nexport interface ChordNotationReplacement {\n\tfrom: number;\n\tto: number;\n\toriginal: string;\n\treplacement: string;\n\treason: string;\n}\n\nexport interface ChordNotationNormalization {\n\tcontent: string;\n\tsuggestions: ChordNotationSuggestion[];\n}\n\nconst CHORD_TOKEN = /\\[([A-G](?:#|b)?)([^/\\]\\s]*)(\\/[A-G](?:#|b)?)?\\]/g;\n\nconst CHORD_TYPE_ALIASES: Record<string, { canonical: string; reason: string }> = {\n\tsus: { canonical: 'sus4', reason: '\"sus\" se interpreta como sus4; escríbelo explícitamente.' },\n\t'2': { canonical: 'sus2', reason: '\"sus2\" identifica el acorde suspendido de segunda.' },\n\t'+': { canonical: 'aug', reason: '\"aug\" es la notación explícita para quinta aumentada.' },\n\tM7: { canonical: 'maj7', reason: '\"maj7\" identifica explícitamente la séptima mayor.' },\n\tMaj7: { canonical: 'maj7', reason: '\"maj7\" identifica explícitamente la séptima mayor.' },\n};\n\nexport function findChordNotationReplacements(content: string): ChordNotationReplacement[] {\n\tconst replacements: ChordNotationReplacement[] = [];\n\n\tfor (const match of content.matchAll(CHORD_TOKEN)) {\n\t\tconst alias = CHORD_TYPE_ALIASES[match[2]];\n\t\tif (!alias || match.index === undefined) continue;\n\n\t\tconst replacement = `${match[1]}${alias.canonical}${match[3] ?? ''}`;\n\t\treplacements.push({\n\t\t\tfrom: match.index,\n\t\t\tto: match.index + match[0].length,\n\t\t\toriginal: match[0].slice(1, -1),\n\t\t\treplacement,\n\t\t\treason: alias.reason,\n\t\t});\n\t}\n\n\treturn replacements;\n}\n\nexport function getChordNotationSuggestions(content: string): ChordNotationSuggestion[] {\n\tconst grouped = new Map<string, ChordNotationSuggestion>();\n\tfor (const replacement of findChordNotationReplacements(content)) {\n\t\tconst key = `${replacement.original}\\u0000${replacement.replacement}`;\n\t\tconst suggestion = grouped.get(key);\n\t\tif (suggestion) {\n\t\t\tsuggestion.occurrences++;\n\t\t} else {\n\t\t\tgrouped.set(key, {\n\t\t\t\toriginal: replacement.original,\n\t\t\t\treplacement: replacement.replacement,\n\t\t\t\toccurrences: 1,\n\t\t\t\treason: replacement.reason,\n\t\t\t});\n\t\t}\n\t}\n\treturn [...grouped.values()];\n}\n\nexport function normalizeChordNotationText(content: string): ChordNotationNormalization {\n\tconst replacements = findChordNotationReplacements(content);\n\tconst normalizedContent = [...replacements]\n\t\t.reverse()\n\t\t.reduce((result, replacement) => {\n\t\t\treturn `${result.slice(0, replacement.from)}[${replacement.replacement}]${result.slice(replacement.to)}`;\n\t\t}, content);\n\n\treturn {\n\t\tcontent: normalizedContent,\n\t\tsuggestions: getChordNotationSuggestions(content),\n\t};\n}","import { EditorView } from '@codemirror/view';\n\n// Layout-only rules shared by every theme, so the editor fills its container.\nexport const baseTheme = EditorView.baseTheme({\n\t'&': {\n\t\theight: '100%',\n\t},\n\t'.cm-scroller': {\n\t\tflex: '1',\n\t\toverflow: 'auto',\n\t},\n\t'.cm-lintRange-info': {\n\t\tbackgroundImage: 'url(\"data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"6\" height=\"3\"><path d=\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\" stroke=\"%23dc2626\" fill=\"none\" stroke-width=\"1\"/></svg>\") !important',\n\t},\n\t'.cm-lintRange-warning': {\n\t\tbackgroundImage: 'url(\"data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"6\" height=\"3\"><path d=\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\" stroke=\"%23d97706\" fill=\"none\" stroke-width=\"1\"/></svg>\") !important',\n\t},\n\t'.cm-lintRange-error': {\n\t\tbackgroundImage: 'url(\"data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"6\" height=\"3\"><path d=\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\" stroke=\"%23dc2626\" fill=\"none\" stroke-width=\"1\"/></svg>\") !important',\n\t},\n});\n","import { EditorView } from '@codemirror/view';\nimport { HighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { tags as t } from '@lezer/highlight';\n\n// Colors mirror chordproject-client's actual design tokens via CSS custom properties, so the\n// editor matches the live app's dark theme\n// instead of a generic hardcoded palette. Fallback values only apply outside that app (e.g. this\n// package's standalone demo), approximating Tailwind's zinc/blue/red scales.\nconst editorTheme = EditorView.theme(\n\t{\n\t\t'&': {\n\t\t\tbackgroundColor: 'var(--color-neutral-900, #18181b)',\n\t\t\tcolor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'.cm-content': {\n\t\t\tcaretColor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'.cm-cursor, .cm-dropCursor': {\n\t\t\tborderLeftColor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {\n\t\t\tbackgroundColor: 'color-mix(in oklch, var(--color-primary-400, #60a5fa) 88%, transparent) !important',\n\t\t},\n\t\t'&.cm-focused .cm-content:focus::selection, &.cm-focused .cm-content .cm-line::selection': {\n\t\t\tbackgroundColor: 'color-mix(in oklch, var(--color-primary-400, #60a5fa) 54%, transparent) !important',\n\t\t\tcolor: 'inherit !important',\n\t\t},\n\t\t'.cm-selectionLayer .cm-selectionBackground': {\n\t\t\tboxShadow: 'inset 0 -2px 0 var(--color-primary-200, #bfdbfe)',\n\t\t},\n\t\t'.cm-activeLine': {\n\t\t\tbackgroundColor: 'var(--color-neutral-800, #27272a)',\n\t\t},\n\t\t'.cm-gutters': {\n\t\t\tbackgroundColor: 'var(--color-neutral-900, #18181b)',\n\t\t\tcolor: 'var(--color-neutral-400, #a1a1aa)',\n\t\t\tborder: 'none',\n\t\t},\n\t\t'.cm-activeLineGutter': {\n\t\t\tbackgroundColor: 'var(--color-neutral-800, #27272a)',\n\t\t},\n\t\t'.cm-completionIcon-chord-used + .cm-completionLabel': {\n\t\t\tcolor: 'var(--color-primary-300, #93c5fd)',\n\t\t\tfontWeight: '600',\n\t\t},\n\t\t'.cm-tooltip-autocomplete > ul > li[aria-selected=\"true\"] .cm-completionIcon-chord-used + .cm-completionLabel': {\n\t\t\tcolor: 'var(--color-white, #ffffff)',\n\t\t},\n\t\t'.cm-lintRange-info': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23f87171\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t\t'.cm-lintRange-warning': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23fcd34d\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t\t'.cm-lintRange-error': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23f87171\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t},\n\t{ dark: true }\n);\n\nconst highlightStyle = HighlightStyle.define([\n\t{ tag: t.keyword, color: 'var(--color-error-400, #f87171)' },\n\t{ tag: [t.meta, t.attributeName], color: 'var(--color-primary-300, #93c5fd)' },\n\t{ tag: [t.constant(t.name), t.character, t.number], color: 'var(--color-neutral-400, #a1a1aa)' },\n\t{ tag: t.invalid, color: 'var(--color-error-200, #fecaca)', backgroundColor: 'color-mix(in oklch, var(--color-error-600, #dc2626) 30%, transparent)' },\n\t{ tag: t.string, color: 'var(--color-neutral-300, #d4d4d8)' },\n\t{ tag: [t.comment, t.lineComment], fontStyle: 'italic', color: '#79c98d' },\n\t{ tag: t.heading, color: 'var(--color-primary-300, #93c5fd)' },\n]);\n\nexport const darkTheme = [editorTheme, syntaxHighlighting(highlightStyle)];\n\n","import { EditorView } from '@codemirror/view';\nimport { HighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { tags as t } from '@lezer/highlight';\n\n// Colors mirror chordproject-client's actual design tokens via CSS custom properties, so the\n// editor matches the live app's light theme\n// instead of a generic hardcoded palette. Fallback values only apply outside that app (e.g. this\n// package's standalone demo), approximating Tailwind's zinc/blue/red scales.\nconst editorTheme = EditorView.theme(\n\t{\n\t\t'&': {\n\t\t\tbackgroundColor: 'var(--color-white, #ffffff)',\n\t\t\tcolor: 'var(--color-neutral-950, #09090b)',\n\t\t},\n\t\t'.cm-content': {\n\t\t\tcaretColor: 'var(--color-neutral-950, #09090b)',\n\t\t},\n\t\t'.cm-cursor, .cm-dropCursor': {\n\t\t\tborderLeftColor: 'var(--color-neutral-950, #09090b)',\n\t\t},\n\t\t'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {\n\t\t\tbackgroundColor: 'color-mix(in oklch, var(--color-primary-500, #3b82f6) 78%, transparent) !important',\n\t\t},\n\t\t'&.cm-focused .cm-content:focus::selection, &.cm-focused .cm-content .cm-line::selection': {\n\t\t\tbackgroundColor: 'color-mix(in oklch, var(--color-primary-500, #3b82f6) 52%, transparent) !important',\n\t\t\tcolor: 'inherit !important',\n\t\t},\n\t\t'.cm-selectionLayer .cm-selectionBackground': {\n\t\t\tboxShadow: 'inset 0 -2px 0 var(--color-primary-700, #1d4ed8)',\n\t\t},\n\t\t'.cm-activeLine': {\n\t\t\tbackgroundColor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'.cm-gutters': {\n\t\t\tbackgroundColor: 'var(--color-neutral-50, #fafafa)',\n\t\t\tcolor: 'var(--color-neutral-500, #71717a)',\n\t\t\tborder: 'none',\n\t\t},\n\t\t'.cm-activeLineGutter': {\n\t\t\tbackgroundColor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'.cm-completionIcon-chord-used + .cm-completionLabel': {\n\t\t\tcolor: 'var(--color-primary-700, #1d4ed8)',\n\t\t\tfontWeight: '600',\n\t\t},\n\t\t'.cm-tooltip-autocomplete > ul > li[aria-selected=\"true\"] .cm-completionIcon-chord-used + .cm-completionLabel': {\n\t\t\tcolor: 'var(--color-white, #ffffff)',\n\t\t},\n\t\t'.cm-lintRange-info': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23dc2626\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t\t'.cm-lintRange-warning': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23d97706\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t\t'.cm-lintRange-error': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23dc2626\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t},\n\t{ dark: false }\n);\n\nconst highlightStyle = HighlightStyle.define([\n\t{ tag: t.keyword, color: 'var(--color-error-600, #dc2626)' },\n\t{ tag: [t.meta, t.attributeName], color: 'var(--color-primary-600, #2563eb)' },\n\t{ tag: [t.constant(t.name), t.character, t.number], color: 'var(--color-neutral-600, #52525b)' },\n\t{ tag: t.invalid, color: 'var(--color-error-700, #b91c1c)', backgroundColor: 'var(--color-error-100, #fee2e2)' },\n\t{ tag: t.string, color: 'var(--color-neutral-700, #3f3f46)' },\n\t{ tag: [t.comment, t.lineComment], fontStyle: 'italic', color: '#4d9f68' },\n\t{ tag: t.heading, color: 'var(--color-primary-600, #2563eb)' },\n]);\n\nexport const lightTheme = [editorTheme, syntaxHighlighting(highlightStyle)];\n\n","import { Extension } from '@codemirror/state';\nimport { baseTheme } from './base';\nimport { darkTheme } from './dark';\nimport { lightTheme } from './light';\n\nexport type ThemeName = 'light' | 'dark';\n\nexport function themeExtension(name: ThemeName): Extension[] {\n\treturn [baseTheme, ...(name === 'dark' ? darkTheme : lightTheme)];\n}\n"],"mappings":";AAAA,SAAS,aAAa,eAAAA,oBAA8B;AACpD,SAAS,cAAAC,mBAA8B;;;ACCvC;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,OACM;;;ACFP,IAAM,QAAQ,CAAC,KAAK,MAAM,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,MAAM,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,MAAM,IAAI;AAE5G,IAAM,YAAY,CAAC,IAAI,KAAK,KAAK,MAAM,QAAQ,QAAQ,QAAQ,KAAK,MAAM,KAAK,QAAQ,OAAO,QAAQ,OAAO,MAAM;AAG5G,IAAM,mBAAsC,MAAM,QAAQ,CAAC,SAAS,UAAU,IAAI,CAAC,YAAY,OAAO,OAAO,CAAC;;;ACLrH,IAAM,cAAc;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K,SAAS,EAAE,SAAS,iBAAiB,YAAY,eAAe,KAAK,CAAC,EAAE,CAAC;AAAA,IAC/E;AAAA,IACA,aAAa,MAAM;AAClB,kBAAY,IAAI;AAAA,IACjB;AAAA,IACA,oBAAoB,MAAM;AACzB,yBAAmB,IAAI;AAAA,IACxB;AAAA,IACA,6BAA6B,MAAM,4BAA4B,KAAK,MAAM,IAAI,SAAS,CAAC;AAAA,IACxF,wBAAwB,MAAM;AAC7B,YAAM,UAAU,KAAK,MAAM,IAAI,SAAS;AACxC,YAAM,gBAAgB,2BAA2B,OAAO;AACxD,YAAM,eAAe,8BAA8B,OAAO;AAC1D,UAAI,aAAa,SAAS,GAAG;AAC5B,aAAK,SAAS;AAAA,UACb,SAAS,aAAa,IAAI,CAAC,EAAE,MAAM,IAAI,YAAY,OAAO,EAAE,MAAM,IAAI,QAAQ,IAAI,WAAW,IAAI,EAAE;AAAA,QACpG,CAAC;AAAA,MACF;AACA,aAAO,cAAc;AAAA,IACtB;AAAA,IACA,OAAO,MAAM,KAAK,MAAM;AAAA,IACxB,SAAS,MAAM,KAAK,QAAQ;AAAA,EAC7B;AACD;","names":["EditorState","EditorView","history","startCompletion","startCompletion","CHORD_TOKEN","EditorView","EditorView","t","EditorView","HighlightStyle","syntaxHighlighting","t","editorTheme","highlightStyle","EditorView","EditorState"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/autocomplete/index.ts","../src/autocomplete/chordVocabulary.ts","../src/autocomplete/chords.ts","../src/autocomplete/snippets.ts","../src/extensions.ts","../src/folding.ts","../src/language/index.ts","../src/language/chordproStream.ts","../src/language/tokens.ts","../src/linting.ts","../src/chordNotation.ts","../src/themes/base.ts","../src/themes/dark.ts","../src/themes/light.ts","../src/themes/index.ts","../src/search-panel.ts"],"sourcesContent":["import { Compartment, EditorState, Extension } from '@codemirror/state';\nimport { EditorView, ViewUpdate } from '@codemirror/view';\nimport { openSearchPanel, search } from '@codemirror/search';\nimport { chordProAutocomplete, insertChord, openCompletionList } from './autocomplete';\nexport { getChordCompletionPriorities } from './autocomplete/chords';\nimport { basicSetup } from './extensions';\nimport { chordProFolding } from './folding';\nimport { chordPro } from './language';\nimport { createLintExtensions, defaultLintLabels, LintLabels } from './linting';\nimport { ChordNotationSuggestion, findChordNotationReplacements, getChordNotationSuggestions, normalizeChordNotationText } from './chordNotation';\nimport { themeExtension, ThemeName } from './themes';\nimport { createSearchPanel, SearchLabels } from './search-panel';\n\nexport type { ThemeName } from './themes';\nexport type { ChordNotationSuggestion } from './chordNotation';\nexport type { SearchLabels } from './search-panel';\nexport type { LintLabels } from './linting';\nexport { getChordNotationSuggestions, normalizeChordNotationText } from './chordNotation';\n\nexport interface ChordProEditorOptions {\n\t/** Element that will contain the editor. */\n\tparent: HTMLElement;\n\t/** Initial document content. */\n\tdoc?: string;\n\t/** Initial theme. Defaults to 'light'. */\n\ttheme?: ThemeName;\n\t/** Extra CodeMirror extensions to append (escape hatch for advanced use cases). */\n\textensions?: Extension[];\n\tonChange?: (value: string) => void;\n\tonFocus?: () => void;\n\tonBlur?: () => void;\n\tsearchLabels?: () => SearchLabels;\n\tlintLabels?: () => LintLabels;\n}\n\nexport interface ChordProEditor {\n\t/** Underlying CodeMirror view, for advanced use cases not covered by this API. */\n\treadonly view: EditorView;\n\tgetValue(): string;\n\tsetValue(value: string): void;\n\tsetTheme(theme: ThemeName): void;\n\t/** Inserts \"[]\" at the cursor (or wraps the selection) and opens chord suggestions. */\n\tinsertChord(): void;\n\t/** Opens the completion list (chords or snippets) without needing a keyboard shortcut. */\n\topenCompletionList(): void;\n\t/** Opens CodeMirror's search and replace panel. */\n\topenSearch(): void;\n\t/** Returns grouped non-canonical chord notation suggestions for the current document. */\n\tgetChordNotationSuggestions(): ChordNotationSuggestion[];\n\t/** Replaces every suggested chord notation in one undoable CodeMirror transaction. */\n\tnormalizeChordNotation(): ChordNotationSuggestion[];\n\t/** Re-runs diagnostics, for example after changing their language. */\n\trefreshLint(): void;\n\tfocus(): void;\n\tdestroy(): void;\n}\n\n/** Creates a standalone ChordPro editor instance. */\nexport function createChordProEditor(options: ChordProEditorOptions): ChordProEditor {\n\tconst themeCompartment = new Compartment();\n\n\tconst updateListener = EditorView.updateListener.of((update: ViewUpdate) => {\n\t\tif (update.docChanged) {\n\t\t\toptions.onChange?.(update.state.doc.toString());\n\t\t}\n\t\tif (update.focusChanged) {\n\t\t\t(update.view.hasFocus ? options.onFocus : options.onBlur)?.();\n\t\t}\n\t});\n\tconst lintExtensions = createLintExtensions(options.lintLabels ?? (() => defaultLintLabels));\n\n\tconst state = EditorState.create({\n\t\tdoc: options.doc ?? '',\n\t\textensions: [\n\t\t\tbasicSetup(),\n\t\t\tchordPro(),\n\t\t\tchordProFolding,\n\t\t\t...lintExtensions,\n\t\t\tchordProAutocomplete(),\n\t\t\tthemeCompartment.of(themeExtension(options.theme ?? 'light')),\n\t\t\tsearch({ top: true, createPanel: (view) => createSearchPanel(view, options.searchLabels?.()) }),\n\t\t\tupdateListener,\n\t\t\t...(options.extensions ?? []),\n\t\t],\n\t});\n\n\tconst view = new EditorView({ state, parent: options.parent });\n\n\treturn {\n\t\tview,\n\t\tgetValue: () => view.state.doc.toString(),\n\t\tsetValue: (value: string) => {\n\t\t\tview.dispatch({\n\t\t\t\tchanges: { from: 0, to: view.state.doc.length, insert: value },\n\t\t\t});\n\t\t},\n\t\tsetTheme: (theme: ThemeName) => {\n\t\t\tview.dispatch({ effects: themeCompartment.reconfigure(themeExtension(theme)) });\n\t\t},\n\t\tinsertChord: () => {\n\t\t\tinsertChord(view);\n\t\t},\n\t\topenCompletionList: () => {\n\t\t\topenCompletionList(view);\n\t\t},\n\t\topenSearch: () => {\n\t\t\topenSearchPanel(view);\n\t\t},\n\t\tgetChordNotationSuggestions: () => getChordNotationSuggestions(view.state.doc.toString()),\n\t\tnormalizeChordNotation: () => {\n\t\t\tconst content = view.state.doc.toString();\n\t\t\tconst normalization = normalizeChordNotationText(content);\n\t\t\tconst replacements = findChordNotationReplacements(content);\n\t\t\tif (replacements.length > 0) {\n\t\t\t\tview.dispatch({\n\t\t\t\t\tchanges: replacements.map(({ from, to, replacement }) => ({ from, to, insert: `[${replacement}]` })),\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn normalization.suggestions;\n\t\t},\n\t\trefreshLint: () => view.dispatch({}),\n\t\tfocus: () => view.focus(),\n\t\tdestroy: () => view.destroy(),\n\t};\n}\n\n","import { Extension } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\nimport {\n\tCompletionContext,\n\tautocompletion,\n\tcompleteFromList,\n\tstartCompletion,\n} from '@codemirror/autocomplete';\nimport { chordCompletionSource } from './chords';\nimport { CHORDPRO_SNIPPETS } from './snippets';\n\nconst completeSnippets = completeFromList(CHORDPRO_SNIPPETS);\nconst QUICK_SNIPPET_PREFIXES = new Set(\n\tCHORDPRO_SNIPPETS\n\t\t.map((snippet) => snippet.label)\n\t\t.filter((label) => label.length <= 3 && /^[a-z]+$/i.test(label))\n);\n\nfunction chordProCompletionSource(context: CompletionContext) {\n\tconst chordCompletions = chordCompletionSource(context);\n\tif (chordCompletions) return chordCompletions;\n\n\tconst word = context.matchBefore(/[a-z]+$/i);\n\tconst isQuickSnippet = word && QUICK_SNIPPET_PREFIXES.has(word.text.toLowerCase());\n\n\t// Only the documented short prefixes open automatically. Full directive names remain behind\n\t// the explicit toolbar command so ordinary lyrics are never interrupted by suggestions.\n\treturn context.explicit || isQuickSnippet ? completeSnippets(context) : null;\n}\n\n/** Chord suggestions inside \"[...]\", plus explicitly requested directive snippets. */\nexport function chordProAutocomplete(): Extension {\n\treturn autocompletion({ override: [chordProCompletionSource], activateOnTyping: true });\n}\n\n/**\n * Opens the completion list (chords or directive snippets, depending on cursor position) without\n * requiring a keyboard shortcut. On Mac, every Ctrl/Option+key combo risks colliding with system\n * shortcuts or accent dead-keys (especially on Spanish/Latin American layouts) - a button click\n * sidesteps that entirely, and works the same on mobile where there's no keyboard shortcut at all.\n */\nexport function openCompletionList(view: EditorView): boolean {\n\tview.focus();\n\treturn startCompletion(view);\n}\n\n/**\n * Inserts \"[]\" at the cursor (or wraps the current selection, e.g. \"Am\" -> \"[Am]\") and opens\n * the chord completion list. Meant for a toolbar button / shortcut so reaching for the \"[\"\n * key isn't required - most useful on mobile and on a brand new, chord-less song.\n */\nexport function insertChord(view: EditorView): boolean {\n\tconst range = view.state.selection.main;\n\tconst selected = view.state.sliceDoc(range.from, range.to);\n\tview.dispatch({\n\t\tchanges: { from: range.from, to: range.to, insert: `[${selected}]` },\n\t\tselection: { anchor: range.from + 1 + selected.length },\n\t});\n\tview.focus();\n\tstartCompletion(view);\n\treturn true;\n}\n","// Common chord roots (both sharp and flat spellings, since musicians use either)\n// and a practical subset of the official ChordPro extension list:\n// https://www.chordpro.org/chordpro/chordpro-chords/#appendix-list-of-known-chord-extensions\n// We don't enumerate every possible extension (the spec's list is huge) - just the ones\n// musicians actually reach for often, so the dropdown stays useful instead of overwhelming.\nconst ROOTS = ['A', 'A#', 'Bb', 'B', 'C', 'C#', 'Db', 'D', 'D#', 'Eb', 'E', 'F', 'F#', 'Gb', 'G', 'G#', 'Ab'];\n\nconst QUALITIES = ['', 'm', '7', 'm7', 'maj7', 'sus2', 'sus4', '6', 'm6', '9', 'add9', 'dim', 'dim7', 'aug', 'm7b5'];\n\n/** Every root+quality combination, e.g. \"C\", \"Cm\", \"Cmaj7\", \"C#sus4\", ... */\nexport const CHORD_VOCABULARY: readonly string[] = ROOTS.flatMap((root) => QUALITIES.map((quality) => root + quality));\n","import { EditorState } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\nimport { Completion, CompletionContext, CompletionResult } from '@codemirror/autocomplete';\nimport { CHORD_VOCABULARY } from './chordVocabulary';\n\nconst CHORD_TOKEN = /\\[([A-G](?:#|b)?(?:min|mi|m(?!aj)|-)?[^\\]\\s-]*(?:\\/[A-G](?:#|b)?)?)\\]/g;\nconst FREQUENCY_BOOST = 100;\nconst TRANSITION_BOOST = 1_000;\nconst PATTERN_BOOST = 10_000;\n\ninterface ChordOccurrence {\n\tname: string;\n\tfrom: number;\n}\n\n/** Counts how many times each chord already appears in the document, keyed by chord text. */\nfunction countUsedChords(state: EditorState): Map<string, number> {\n\tconst counts = new Map<string, number>();\n\tfor (const { name: chord } of getChordOccurrences(state.doc.toString())) {\n\t\tcounts.set(chord, (counts.get(chord) ?? 0) + 1);\n\t}\n\treturn counts;\n}\n\nfunction getChordOccurrences(content: string): ChordOccurrence[] {\n\treturn [...content.matchAll(CHORD_TOKEN)].flatMap((match) => {\n\t\treturn match.index === undefined ? [] : [{ name: match[1], from: match.index }];\n\t});\n}\n\n/**\n * Scores chords that previously followed the same local progression. Matching the last two\n * chords is stronger than matching only the immediately preceding chord, which is stronger than\n * simple usage frequency.\n */\nexport function getChordCompletionPriorities(content: string, cursor: number): Map<string, number> {\n\tconst history = getChordOccurrences(content)\n\t\t.filter((occurrence) => occurrence.from < cursor - 1)\n\t\t.map((occurrence) => occurrence.name);\n\tconst priorities = new Map<string, number>();\n\n\tfor (let index = 0; index < history.length; index++) {\n\t\tconst candidate = history[index];\n\t\tif (index > 0 && history[index - 1] === history.at(-1)) {\n\t\t\tpriorities.set(candidate, (priorities.get(candidate) ?? 0) + TRANSITION_BOOST);\n\t\t}\n\t\tif (\n\t\t\tindex > 1 &&\n\t\t\thistory[index - 2] === history.at(-2) &&\n\t\t\thistory[index - 1] === history.at(-1)\n\t\t) {\n\t\t\tpriorities.set(candidate, (priorities.get(candidate) ?? 0) + PATTERN_BOOST);\n\t\t}\n\t}\n\n\treturn priorities;\n}\n\n/**\n * Inserts the chosen chord and moves the cursor past the closing \"]\" (already created when\n * opening the ChordPro token, or added here if missing) so typing continues in the lyric, not\n * trapped back inside the brackets.\n */\nfunction applyChord(view: EditorView, completion: Completion, from: number, to: number): void {\n\tconst insert = completion.label;\n\tconst hasClosingBracket = view.state.sliceDoc(to, to + 1) === ']';\n\tconst cursor = from + insert.length + 1;\n\tview.dispatch({\n\t\tchanges: hasClosingBracket ? { from, to, insert } : { from, to, insert: `${insert}]` },\n\t\tselection: { anchor: cursor },\n\t});\n}\n\nfunction buildOptions(used: Map<string, number>, priorities: Map<string, number>): Completion[] {\n\tconst options = new Map<string, Completion>();\n\t// Chords already used in this song are boosted so they float to the top of the list -\n\t// they're the ones you're most likely to want again in the same song.\n\tconst rankedUsedChords = [...used.entries()].sort(([leftChord, leftCount], [rightChord, rightCount]) => {\n\t\tconst priorityDifference = (priorities.get(rightChord) ?? 0) - (priorities.get(leftChord) ?? 0);\n\t\treturn priorityDifference || rightCount - leftCount || leftChord.localeCompare(rightChord);\n\t});\n\tfor (const [chord, count] of rankedUsedChords) {\n\t\toptions.set(chord, {\n\t\t\tlabel: chord,\n\t\t\ttype: 'chord-used',\n\t\t\tboost: FREQUENCY_BOOST + count + (priorities.get(chord) ?? 0),\n\t\t\tapply: applyChord,\n\t\t});\n\t}\n\tfor (const chord of CHORD_VOCABULARY) {\n\t\tif (!options.has(chord)) options.set(chord, { label: chord, type: 'chord', apply: applyChord });\n\t}\n\treturn [...options.values()];\n}\n\n/** Suggests chords while typing inside \"[...]\", including common chords from the first chord. */\nexport function chordCompletionSource(context: CompletionContext): CompletionResult | null {\n\tconst match = context.matchBefore(/\\[[^\\]\\n]*/);\n\tif (!match || (match.from === match.to && !context.explicit)) return null;\n\n\treturn {\n\t\tfrom: match.from + 1,\n\t\toptions: buildOptions(\n\t\t\tcountUsedChords(context.state),\n\t\t\tgetChordCompletionPriorities(context.state.doc.toString(), match.from + 1)\n\t\t),\n\t\tvalidFor: /^[^\\]\\n]*$/,\n\t};\n}\n","import { Completion, snippetCompletion } from '@codemirror/autocomplete';\n\nfunction sectionShortcut(startDirective: string, endDirective: string, label: string, detail: string): Completion {\n\treturn {\n\t\tlabel,\n\t\ttype: 'directive',\n\t\tdetail,\n\t\tapply: (view, completion, from, to) => {\n\t\t\tconst line = view.state.doc.lineAt(from);\n\t\t\tlet closingAt = view.state.doc.length;\n\n\t\t\tfor (let lineNumber = line.number + 1; lineNumber <= view.state.doc.lines; lineNumber++) {\n\t\t\t\tconst nextLine = view.state.doc.line(lineNumber);\n\t\t\t\tif (!nextLine.text.trim() || /^\\s*\\{\\s*[A-Za-z_][\\w]*\\b/.test(nextLine.text)) {\n\t\t\t\t\tclosingAt = nextLine.from;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst opening = `{${startDirective}}`;\n\t\t\tconst previousCharacter = closingAt > 0\n\t\t\t\t? view.state.doc.sliceString(closingAt - 1, closingAt)\n\t\t\t\t: '';\n\t\t\tconst closing = `${previousCharacter && previousCharacter !== '\\n' ? '\\n' : ''}{${endDirective}}\\n`;\n\t\t\tview.dispatch({\n\t\t\t\tchanges: [\n\t\t\t\t\t{ from, to, insert: opening },\n\t\t\t\t\t{ from: closingAt, insert: closing },\n\t\t\t\t],\n\t\t\t\tselection: { anchor: from + opening.length },\n\t\t\t});\n\t\t},\n\t};\n}\n\n// These snippets cover commonly used directives; print-only directives and features handled by\n// the client, such as transposition and chord diagrams, are intentionally left out.\nexport const CHORDPRO_SNIPPETS: readonly Completion[] = [\n\tsnippetCompletion('{album: ${value}}', { label: 'album', type: 'directive' }),\n\tsnippetCompletion('{arranger: ${value}}', { label: 'arranger', type: 'directive' }),\n\tsnippetCompletion('{artist: ${value}}', { label: 'artist', type: 'directive' }),\n\tsnippetCompletion('{artist: ${value}}', { label: 'a', type: 'directive', detail: 'artist' }),\n\tsnippetCompletion('{capo: ${5}}', { label: 'capo', type: 'directive' }),\n\tsnippetCompletion('{composer: ${value}}', { label: 'composer', type: 'directive' }),\n\tsnippetCompletion('{copyright: ${value}}', { label: 'copyright', type: 'directive' }),\n\tsnippetCompletion('{duration: ${4}:${00}}', { label: 'duration', type: 'directive' }),\n\tsnippetCompletion('{key: ${Am}}', { label: 'key', type: 'directive' }),\n\tsnippetCompletion('{key: ${Am}}', { label: 'k', type: 'directive', detail: 'key' }),\n\tsnippetCompletion('{lyricist: ${value}}', { label: 'lyricist', type: 'directive' }),\n\tsnippetCompletion('{tempo: ${120}}', { label: 'tempo', type: 'directive' }),\n\tsnippetCompletion('{time: ${4}/${4}}', { label: 'time', type: 'directive' }),\n\tsnippetCompletion('{title: ${value}}', { label: 'title', type: 'directive' }),\n\tsnippetCompletion('{title: ${value}}', { label: 't', type: 'directive', detail: 'title' }),\n\tsnippetCompletion('{subtitle: ${value}}', { label: 'subtitle', type: 'directive' }),\n\tsnippetCompletion('{subtitle: ${value}}', { label: 'st', type: 'directive', detail: 'subtitle' }),\n\tsnippetCompletion('{year: ${2020}}', { label: 'year', type: 'directive' }),\n\tsnippetCompletion('{meta: ${label} ${value}}', { label: 'meta', type: 'directive' }),\n\tsnippetCompletion('{comment: ${value}}', { label: 'comment', type: 'directive' }),\n\tsnippetCompletion('{comment: ${value}}', { label: 'c', type: 'directive', detail: 'comment' }),\n\n\tsnippetCompletion('{start_of_chorus: ${Chorus}}\\n${lyrics}\\n{end_of_chorus}', {\n\t\tlabel: 'chorus',\n\t\ttype: 'directive',\n\t}),\n\tsectionShortcut('start_of_chorus', 'end_of_chorus', 'soc', 'start_of_chorus'),\n\tsnippetCompletion('{end_of_chorus}', { label: 'eoc', type: 'directive', detail: 'end_of_chorus' }),\n\n\tsnippetCompletion('{start_of_verse: ${Verse} ${1}}\\n${lyrics}\\n{end_of_verse}', {\n\t\tlabel: 'verse',\n\t\ttype: 'directive',\n\t}),\n\tsectionShortcut('start_of_verse', 'end_of_verse', 'sov', 'start_of_verse'),\n\tsnippetCompletion('{end_of_verse}', { label: 'eov', type: 'directive', detail: 'end_of_verse' }),\n\n\tsnippetCompletion('{start_of_bridge: ${Bridge}}\\n${lyrics}\\n{end_of_bridge}', {\n\t\tlabel: 'bridge',\n\t\ttype: 'directive',\n\t}),\n\tsectionShortcut('start_of_bridge', 'end_of_bridge', 'sob', 'start_of_bridge'),\n\tsnippetCompletion('{end_of_bridge}', { label: 'eob', type: 'directive', detail: 'end_of_bridge' }),\n\n\tsnippetCompletion(\n\t\t'{start_of_tab}\\ne|-${1}--------------------------------|\\nB|----------------------------------|\\nG|----------------------------------|\\nD|----------------------------------|\\nA|----------------------------------|\\nE|----------------------------------|\\n{end_of_tab}',\n\t\t{ label: 'tab', type: 'directive' }\n\t),\n\tsectionShortcut('start_of_tab', 'end_of_tab', 'sot', 'start_of_tab'),\n\tsnippetCompletion('{end_of_tab}', { label: 'eot', type: 'directive', detail: 'end_of_tab' }),\n\n\tsnippetCompletion('{define: ${Am} base-fret ${1} frets ${0 0 0 0 0 0} fingers ${0 0 0 0 0 0}}', {\n\t\tlabel: 'define',\n\t\ttype: 'directive',\n\t}),\n\tsnippetCompletion('{define: ${Am} base-fret ${1} frets ${0 0 0 0 0 0} fingers ${0 0 0 0 0 0}}', {\n\t\tlabel: 'd',\n\t\ttype: 'directive',\n\t\tdetail: 'define',\n\t}),\n\n\tsnippetCompletion('[${Am}]', { label: '[', type: 'chord', detail: 'insert a chord' }),\n\n\tsnippetCompletion(\n\t\t'{title: ${value}}\\n{artist: ${value}}\\n{key: ${C}}\\n\\n${lyrics}\\n{start_of_chorus}\\n${lyrics}\\n{end_of_chorus}',\n\t\t{ label: '!', type: 'directive', detail: 'new song template' }\n\t),\n];\n","import { EditorState, Extension } from '@codemirror/state';\nimport {\n\tEditorView,\n\tkeymap,\n\tinputHandler,\n\thighlightActiveLine,\n\thighlightSpecialChars,\n\tdrawSelection,\n} from '@codemirror/view';\nimport { defaultKeymap, history, historyKeymap } from '@codemirror/commands';\nimport { bracketMatching, foldGutter, foldKeymap } from '@codemirror/language';\nimport { lintGutter, lintKeymap } from '@codemirror/lint';\nimport { searchKeymap } from '@codemirror/search';\nimport {\n\tacceptCompletion,\n\tcloseBrackets,\n\tcloseBracketsKeymap,\n\tcompletionKeymap,\n\tcompletionStatus,\n\tstartCompletion,\n} from '@codemirror/autocomplete';\nimport { insertChord } from './autocomplete';\n\n// True when the cursor sits right after an unclosed \"[\" on the current line.\nfunction isInsideChordBrackets(view: EditorView): boolean {\n\tconst pos = view.state.selection.main.head;\n\tconst line = view.state.doc.lineAt(pos);\n\treturn /\\[[^\\]]*$/.test(line.text.slice(0, pos - line.from));\n}\n\n// Ctrl-Space (and its Mac alternates) should suggest chords wherever the cursor is, not only\n// right after typing \"[\" - so if we're not already inside brackets, insert them first.\nfunction chordAwareCompletion(view: EditorView): boolean {\n\treturn isInsideChordBrackets(view) ? startCompletion(view) : insertChord(view);\n}\n\n// Keymaps do not receive every international keyboard or touch text-input event. Intercept the\n// actual insertion too, so any typed \"[\" always becomes a complete ChordPro token.\nconst chordBracketInputHandler = EditorView.inputHandler.of((view, from, to, text) => {\n\tif (text !== '[') return false;\n\n\tconst selected = view.state.sliceDoc(from, to);\n\tview.dispatch({\n\t\tchanges: { from, to, insert: `[${selected}]` },\n\t\tselection: { anchor: from + 1 + selected.length },\n\t});\n\tstartCompletion(view);\n\treturn true;\n});\n\n// Editing behavior shared by every instance.\nexport function basicSetup(): Extension[] {\n\treturn [\n\t\tfoldGutter(),\n\t\tlintGutter(),\n\t\thighlightSpecialChars(),\n\t\thighlightActiveLine(),\n\t\thistory(),\n\t\tdrawSelection(),\n\t\tbracketMatching(),\n\t\tcloseBrackets(),\n\t\tchordBracketInputHandler,\n\t\tEditorState.allowMultipleSelections.of(true),\n\t\tkeymap.of([\n\t\t\t// Insert a complete ChordPro token before opening suggestions so an unfinished \"[\"\n\t\t\t// is never momentarily interpreted as invalid song content.\n\t\t\t{ key: '[', run: insertChord },\n\t\t\t...closeBracketsKeymap,\n\t\t\t...defaultKeymap,\n\t\t\t...historyKeymap,\n\t\t\t...foldKeymap,\n\t\t\t...lintKeymap,\n\t\t\t...searchKeymap,\n\t\t\t// Override completionKeymap's Ctrl-Space/Option-`/Option-i (same keys, listed first so\n\t\t\t// they take precedence) to be chord-aware instead of plain startCompletion.\n\t\t\t{ key: 'Ctrl-Space', run: chordAwareCompletion },\n\t\t\t{ mac: 'Cmd-Shift-Space', run: chordAwareCompletion },\n\t\t\t{ mac: 'Alt-`', run: chordAwareCompletion },\n\t\t\t{ mac: 'Alt-i', run: chordAwareCompletion },\n\t\t\t...completionKeymap,\n\t\t\t// Tab accepts a completion/snippet field when the popup is open.\n\t\t\t{\n\t\t\t\tkey: 'Tab',\n\t\t\t\tpreventDefault: true,\n\t\t\t\trun: (view) => (completionStatus(view.state) ? acceptCompletion(view) : false),\n\t\t\t},\n\t\t]),\n\t];\n}\n","import { foldService } from '@codemirror/language';\n\n// Recognize both abbreviated and long-form ChordPro section markers for line-based folding.\nconst START_RE = /\\{(so(?<name>v|b|c|t)|start_of_(?<longname>[^\\s:}]+))(?:[: ][^}]*)?\\}/i;\nconst END_RE = /\\{(eo(?<name>v|b|c|t)|end_of_(?<longname>[^\\s:}]+))\\}/i;\n\nconst SHORT_TO_LONG: Record<string, string> = { v: 'verse', b: 'bridge', c: 'chorus', t: 'tab' };\n\nfunction blockName(match: RegExpMatchArray): string | null {\n\tconst name = match.groups?.name ?? match.groups?.longname;\n\tif (!name) return null;\n\treturn (SHORT_TO_LONG[name.toLowerCase()] ?? name.toLowerCase()).replace(/s$/, '');\n}\n\n/** Folds {start_of_x}...{end_of_x} blocks, matching start/end by block name (verse/chorus/etc). */\nexport const chordProFolding = foldService.of((state, lineStart, lineEnd) => {\n\tconst startMatch = state.doc.sliceString(lineStart, lineEnd).match(START_RE);\n\tif (!startMatch) return null;\n\tconst name = blockName(startMatch);\n\tif (!name) return null;\n\n\tlet pos = lineEnd;\n\twhile (pos < state.doc.length) {\n\t\tconst line = state.doc.lineAt(pos + 1);\n\t\tconst endMatch = line.text.match(END_RE);\n\t\tif (endMatch && blockName(endMatch) === name) {\n\t\t\treturn line.to > lineEnd ? { from: lineEnd, to: line.to } : null;\n\t\t}\n\t\tpos = line.to;\n\t}\n\treturn null;\n});\n","import { LanguageSupport } from '@codemirror/language';\nimport { chordProLanguage } from './chordproStream';\n\nexport { chordProLanguage } from './chordproStream';\n\n/** ChordPro language support: highlights directives, chords, comments and tab blocks. */\nexport function chordPro(): LanguageSupport {\n\treturn new LanguageSupport(chordProLanguage);\n}\n","import { StreamLanguage, StringStream } from '@codemirror/language';\nimport { Tag, tags as t } from '@lezer/highlight';\nimport {\n\tCHORD_TEXT,\n\tDEFINE_DIRECTIVE,\n\tDEFINE_KEYWORD,\n\tDIRECTIVE_NAME,\n\tTAB_START_DIRECTIVES,\n\tbaseDirectiveName,\n\tisKnownDirective,\n} from './tokens';\n\ntype Mode =\n\t| 'default'\n\t| 'directiveName'\n\t| 'afterName'\n\t| 'directiveValue'\n\t| 'define'\n\t| 'chord'\n\t| 'afterChord'\n\t| 'afterChordInvalid'\n\t| 'tab';\n\ninterface State {\n\tmode: Mode;\n\tpendingName: string;\n}\n\nfunction startState(): State {\n\treturn { mode: 'default', pendingName: '' };\n}\n\nfunction copyState(state: State): State {\n\treturn { ...state };\n}\n\nfunction token(stream: StringStream, state: State): string | null {\n\tif (state.mode === 'tab') {\n\t\tif (stream.match(/^\\{\\s*(end_of_tab|eot)\\s*\\}/i)) {\n\t\t\tstate.mode = 'default';\n\t\t\treturn 'directiveBrace';\n\t\t}\n\t\tif (stream.match(/^-+/)) return 'tabDash';\n\t\tif (stream.match(/^\\|+/)) return 'tabChar';\n\t\tif (stream.match(/^[A-Ga-g][b#]?/)) return 'tabString';\n\t\tif (stream.match(/^[0-9]+/)) return 'tabNumber';\n\t\tstream.next();\n\t\treturn 'tabText';\n\t}\n\n\tif (state.mode === 'define') {\n\t\tif (stream.match(/^\\}/)) {\n\t\t\tstate.mode = 'default';\n\t\t\treturn 'directiveBrace';\n\t\t}\n\t\tif (stream.eatSpace()) return null;\n\t\tif (stream.match(/^[0-9]+/)) return 'defineNumber';\n\t\tif (stream.match(DEFINE_KEYWORD)) return 'defineKeyword';\n\t\tstream.match(/^[^\\s0-9}]+/) || stream.next();\n\t\treturn 'defineValue';\n\t}\n\n\tif (state.mode === 'directiveValue') {\n\t\tif (stream.match(/^\\}/)) {\n\t\t\tstate.mode = 'default';\n\t\t\treturn 'directiveBrace';\n\t\t}\n\t\tstream.match(/^(\\\\.|[^\\\\}])+/) || stream.next();\n\t\treturn 'directiveValue';\n\t}\n\n\tif (state.mode === 'directiveName') {\n\t\tstream.eatSpace();\n\t\tconst match = stream.match(DIRECTIVE_NAME) as RegExpMatchArray | false;\n\t\tif (match) {\n\t\t\tconst name = match[0];\n\t\t\tstate.pendingName = name;\n\t\t\tstate.mode = 'afterName';\n\t\t\treturn isKnownDirective(name) ? 'directiveName' : 'directiveNameInvalid';\n\t\t}\n\t\t// Nothing that looks like a directive name right after \"{\": bail out.\n\t\tstate.mode = 'default';\n\t\tif (stream.match(/^\\}/)) return 'directiveBrace';\n\t\tstream.next();\n\t\treturn 'directiveNameInvalid';\n\t}\n\n\tif (state.mode === 'afterName') {\n\t\tconst name = baseDirectiveName(state.pendingName);\n\t\tif (stream.match(/^:/)) {\n\t\t\tstate.mode = DEFINE_DIRECTIVE.test(name) ? 'define' : 'directiveValue';\n\t\t\treturn 'directiveColon';\n\t\t}\n\t\tif (stream.match(/^\\}/)) {\n\t\t\tstate.mode = TAB_START_DIRECTIVES.test(name) ? 'tab' : 'default';\n\t\t\treturn 'directiveBrace';\n\t\t}\n\t\t// Some directives take their argument after a space instead of a colon, e.g.\n\t\t// {start_of_verse Verse 1} or {image src=\"x.jpg\"} - see \"Arguments and attributes\".\n\t\tif (stream.eatSpace()) {\n\t\t\tstate.mode = DEFINE_DIRECTIVE.test(name) ? 'define' : 'directiveValue';\n\t\t\treturn null;\n\t\t}\n\t\t// Malformed directive (e.g. stray characters before \":\" or \"}\").\n\t\tstate.mode = 'default';\n\t\tstream.next();\n\t\treturn 'directiveNameInvalid';\n\t}\n\n\tif (state.mode === 'chord' || state.mode === 'afterChord' || state.mode === 'afterChordInvalid') {\n\t\tif (stream.eat(']')) {\n\t\t\tstate.mode = 'default';\n\t\t\treturn 'chordBracket';\n\t\t}\n\t\tif (state.mode === 'chord') {\n\t\t\tconst match = stream.match(CHORD_TEXT) as RegExpMatchArray | false;\n\t\t\tstate.mode = match ? 'afterChord' : 'afterChordInvalid';\n\t\t\tif (!match) stream.match(/^[^\\]]+/);\n\t\t\treturn match ? 'chord' : 'chordInvalid';\n\t\t}\n\t\t// Already emitted the chord text; anything else before \"]\" is leftover/invalid.\n\t\tstream.match(/^[^\\]]+/);\n\t\treturn 'chordInvalid';\n\t}\n\n\t// default mode\n\tif (stream.sol() && stream.match(/^#.*/)) return 'comment';\n\tif (stream.match(/^\\{/)) {\n\t\tstate.mode = 'directiveName';\n\t\treturn 'directiveBrace';\n\t}\n\tif (stream.eat('[')) {\n\t\tstate.mode = 'chord';\n\t\treturn 'chordBracket';\n\t}\n\tstream.match(/^[^{[]+/) || stream.next();\n\treturn null;\n}\n\n// Maps our token names to Lezer highlight tags consumed by themes/*.ts.\nconst tokenTable: Record<string, Tag> = {\n\tdirectiveBrace: t.meta,\n\tdirectiveName: t.attributeName,\n\tdirectiveNameInvalid: t.invalid,\n\tdirectiveColon: t.punctuation,\n\tdirectiveValue: t.string,\n\tdefineKeyword: t.keyword,\n\tdefineNumber: t.number,\n\tdefineValue: t.string,\n\tchordBracket: t.character,\n\tchord: t.keyword,\n\tchordInvalid: t.invalid,\n\tcomment: t.lineComment,\n\ttabDash: t.comment,\n\ttabChar: t.character,\n\ttabString: t.string,\n\ttabNumber: t.number,\n\ttabText: t.comment,\n};\n\nexport const chordProLanguage = StreamLanguage.define<State>({\n\tstartState,\n\tcopyState,\n\ttoken,\n\ttokenTable,\n\tlanguageData: {\n\t\tcommentTokens: { line: '#' },\n\t},\n});\n","// Directive names recognized by this editor, aligned with the official spec:\n// https://www.chordpro.org/chordpro/chordpro-directives/ (checked Sep 2026).\n// Grouped the same way the spec groups them, so future updates are easy to diff.\n//\n// Only directives chordproject-parser actually understands (or silently tolerates as a\n// no-op) are marked \"known\" here - anything else is intentionally styled as invalid so the\n// editor and the parser always agree on what's really supported. Print/font-styling\n// directives, {chord} (superseded by the upcoming click-to-view chord diagram feature) and\n// {transpose} (superseded by our own text-rewriting transpose) are deliberately excluded.\n\nexport const PREAMBLE_DIRECTIVES = /^(new_song|ns)$/i;\n\nexport const META_DIRECTIVES =\n\t/^(title|t|sorttitle|subtitle|st|artist|sortartist|composer|arranger|lyricist|copyright|album|year|key|time|tempo|duration|capo|tag|meta)$/i;\n\nexport const FORMATTING_DIRECTIVES = /^(comment|c|highlight|comment_italic|ci|comment_box|cb|image)$/i;\n\nexport const ENV_DIRECTIVES =\n\t/^(start_of_chorus|soc|end_of_chorus|eoc|chorus|start_of_verse|sov|end_of_verse|eov|start_of_bridge|sob|end_of_bridge|eob|start_of_tab|sot|end_of_tab|eot|start_of_grid|sog|end_of_grid|eog)$/i;\n\n// Delegated environments turn their content into an image (abc/lilypond/svg) or a free text block.\nexport const DELEGATED_ENV_DIRECTIVES =\n\t/^(start_of_abc|end_of_abc|start_of_ly|end_of_ly|start_of_svg|end_of_svg|start_of_textblock|end_of_textblock)$/i;\n\n// Note: {chord} (inline diagram reference) is intentionally NOT included - see the module\n// comment above. Only {define} (custom chord diagram data) is actually used.\nexport const CHORD_DIAGRAM_DIRECTIVES = /^define$/i;\n\nexport const CUSTOM_EXTENSION_DIRECTIVE = /^x_[\\w]+$/i;\n\nconst KNOWN_DIRECTIVE_LISTS = [\n\tPREAMBLE_DIRECTIVES,\n\tMETA_DIRECTIVES,\n\tFORMATTING_DIRECTIVES,\n\tENV_DIRECTIVES,\n\tDELEGATED_ENV_DIRECTIVES,\n\tCHORD_DIAGRAM_DIRECTIVES,\n];\n\nexport const TAB_START_DIRECTIVES = /^(start_of_tab|sot)$/i;\nexport const DEFINE_DIRECTIVE = /^define$/i;\n\n\nexport const DIRECTIVE_NAME = /^[A-Za-z_][\\w]*(?:-[\\w!]+)?/;\nexport const DEFINE_KEYWORD = /^(fingers|frets|base-fret)\\b/i;\n\n/**\n * Any directive can be postfixed with \"-selector\" (optionally negated with \"!\"), e.g.\n * {comment-alto: ...} or {start_of_verse-soprano}. Strip that before checking the base name.\n * See \"Conditional directives\" in the spec.\n */\nexport function baseDirectiveName(name: string): string {\n\treturn name.replace(/-[\\w!]+$/, '');\n}\n\nexport function isKnownDirective(name: string): boolean {\n\tconst base = baseDirectiveName(name);\n\tif (CUSTOM_EXTENSION_DIRECTIVE.test(base)) return true;\n\treturn KNOWN_DIRECTIVE_LISTS.some((re) => re.test(base));\n}\n\n// A chord is either a \"*\"-prefixed annotation (printed verbatim, e.g. [*Rit.]), or a real\n// root note (A-G, case-insensitive so single lowercase notes like [f] are accepted too - see\n// \"ChordPro Implementation: Notes\") with any suffix/bass text. This intentionally mirrors\n// \"relaxed mode\" from https://www.chordpro.org/chordpro/chordpro-chords/ (unknown extensions\n// are still accepted) to match chordproject-parser's own permissive Chord.parse.\nexport const CHORD_TEXT = /^(\\*.+|[A-G](?:#{1,2}|b{1,2}|x)?[^\\]]*)/i;\n\n","import { Diagnostic, linter } from '@codemirror/lint';\nimport { Extension } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\nimport { ChordProParser } from '@chordproject/parser';\nimport { findChordNotationReplacements } from './chordNotation';\n\nexport interface LintLabels {\n\tduplicateDirective: (directive: string, firstLine: number) => string;\n\tparserWarning: (warning: { code: string; message: string; params: Record<string, string> }) => string;\n\tsectionMessage: (endDirective: string) => string;\n\tsectionAction: (endDirective: string) => string;\n\tchordNotationMessage: (replacement: string, reason: string) => string;\n\tchordNotationAction: (replacement: string) => string;\n}\n\nexport const defaultLintLabels: LintLabels = {\n\tduplicateDirective: (directive, firstLine) => `\"${directive}\" was already defined on line ${firstLine}; this value replaces it.`,\n\tparserWarning: (warning) => warning.message,\n\tsectionMessage: (endDirective) => `This section must be closed with {${endDirective}}.`,\n\tsectionAction: (endDirective) => `Insert {${endDirective}}`,\n\tchordNotationMessage: (replacement, reason) => `Use \"${replacement}\". ${reason}`,\n\tchordNotationAction: (replacement) => `Replace with ${replacement}`,\n};\n\n// Directives chordproject-parser treats as singular (last one wins silently, see\n// ChordProParser.parseMetadataTag - title/subtitle/key/capo/duration/tempo/time/year/copyright\n// are plain assignments). album/artist/composer/arranger/lyricist are intentionally cumulative\n// (a song can have multiple artists) and are NOT included here.\nconst SINGULAR_DIRECTIVES: Record<string, string> = {\n\ttitle: 'title',\n\tt: 'title',\n\tsubtitle: 'subtitle',\n\tst: 'subtitle',\n\tyear: 'year',\n\tcopyright: 'copyright',\n\tkey: 'key',\n\tcapo: 'capo',\n\tduration: 'duration',\n\ttempo: 'tempo',\n\ttime: 'time',\n};\n\nconst DIRECTIVE_LINE = /^\\s*\\{\\s*([A-Za-z_][\\w]*)\\b/;\nconst SECTION_STARTS: Record<string, string> = {\n\tstart_of_chorus: 'end_of_chorus',\n\tsoc: 'end_of_chorus',\n\tchorus: 'end_of_chorus',\n\tstart_of_verse: 'end_of_verse',\n\tsov: 'end_of_verse',\n\tstart_of_bridge: 'end_of_bridge',\n\tsob: 'end_of_bridge',\n\tstart_of_tab: 'end_of_tab',\n\tsot: 'end_of_tab',\n};\nconst SECTION_ENDS = new Set(['end_of_chorus', 'eoc', 'end_of_verse', 'eov', 'end_of_bridge', 'eob', 'end_of_tab', 'eot']);\n\n/**\n * Warns (without blocking anything) when a \"singular\" directive like {title:} or {key:}\n * appears more than once - the parser silently keeps only the last one, which is easy to miss\n * if you e.g. paste a full song under some test content that already had its own {title:}.\n */\nexport function createLintExtensions(getLabels: () => LintLabels = () => defaultLintLabels): Extension[] {\n\tconst duplicateDirectiveLinter = linter((view: EditorView): Diagnostic[] => {\n\tconst diagnostics: Diagnostic[] = [];\n\tconst firstSeenAtLine = new Map<string, number>();\n\tconst labels = getLabels();\n\n\tfor (let lineNumber = 1; lineNumber <= view.state.doc.lines; lineNumber++) {\n\t\tconst line = view.state.doc.line(lineNumber);\n\t\tconst match = line.text.match(DIRECTIVE_LINE);\n\t\tif (!match) continue;\n\n\t\tconst canonical = SINGULAR_DIRECTIVES[match[1].toLowerCase()];\n\t\tif (!canonical) continue;\n\n\t\tconst firstLine = firstSeenAtLine.get(canonical);\n\t\tif (firstLine === undefined) {\n\t\t\tfirstSeenAtLine.set(canonical, lineNumber);\n\t\t\tcontinue;\n\t\t}\n\n\t\tdiagnostics.push({\n\t\t\tfrom: line.from,\n\t\t\tto: line.from + match[0].length,\n\t\t\tseverity: 'warning',\n\t\t\tmessage: labels.duplicateDirective(canonical, firstLine),\n\t\t});\n\t}\n\n\treturn diagnostics;\n});\n\n/**\n * Surfaces parser warnings next to the ChordPro source line. The client can still\n * render its translated warning summary, while CodeMirror provides local feedback.\n */\nconst parserWarningLinter = linter((view: EditorView): Diagnostic[] => {\n\tconst parser = new ChordProParser();\n\tparser.parse(view.state.doc.toString());\n\tconst labels = getLabels();\n\n\treturn parser.warnings.flatMap((warning): Diagnostic[] => {\n\t\tif (warning.code === 'empty_sheet') {\n\t\t\treturn [];\n\t\t}\n\t\tif (warning.lineNumber < 1 || warning.lineNumber > view.state.doc.lines) {\n\t\t\treturn [];\n\t\t}\n\t\tconst line = view.state.doc.line(warning.lineNumber);\n\t\treturn [{\n\t\t\tfrom: line.from,\n\t\t\tto: line.to,\n\t\t\tseverity: 'warning',\n\t\t\tmessage: labels.parserWarning(warning),\n\t\t}];\n\t});\n}, { delay: 0 });\n\n/** Offers a one-click closing directive for sections left open while drafting. */\nconst unclosedSectionLinter = linter((view: EditorView): Diagnostic[] => {\n\tconst diagnostics: Diagnostic[] = [];\n\tlet openSection: { endDirective: string; lineFrom: number; lineTo: number; insertionAt: number; insertionTo: number } | null = null;\n\tlet sectionHasContent = false;\n\n\tfor (let lineNumber = 1; lineNumber <= view.state.doc.lines; lineNumber++) {\n\t\tconst line = view.state.doc.line(lineNumber);\n\t\tconst match = line.text.match(DIRECTIVE_LINE);\n\t\tconst directive = match?.[1].toLowerCase();\n\n\t\tif (directive && SECTION_STARTS[directive]) {\n\t\t\tif (openSection) {\n\t\t\t\topenSection.insertionAt = line.from;\n\t\t\t\topenSection.insertionTo = line.from;\n\t\t\t\tdiagnostics.push(sectionDiagnostic(openSection, getLabels()));\n\t\t\t}\n\t\t\topenSection = {\n\t\t\t\tendDirective: SECTION_STARTS[directive],\n\t\t\t\tlineFrom: line.from,\n\t\t\t\tlineTo: line.to,\n\t\t\t\tinsertionAt: line.from,\n\t\t\t\tinsertionTo: line.from,\n\t\t\t};\n\t\t\tsectionHasContent = false;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (directive && SECTION_ENDS.has(directive)) {\n\t\t\topenSection = null;\n\t\t\tsectionHasContent = false;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (openSection && directive) {\n\t\t\topenSection.insertionAt = line.from;\n\t\t\topenSection.insertionTo = line.from;\n\t\t\tdiagnostics.push(sectionDiagnostic(openSection, getLabels()));\n\t\t\topenSection = null;\n\t\t\tsectionHasContent = false;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (openSection && !line.text.trim()) {\n\t\t\tconst nextDirective = nextNonBlankDirective(view, lineNumber);\n\t\t\tif (sectionHasContent) {\n\t\t\t\topenSection.insertionAt = line.from;\n\t\t\t\topenSection.insertionTo = nextDirective\n\t\t\t\t\t? nextNonBlankDirectiveLine(view, lineNumber)\n\t\t\t\t\t: line.from;\n\t\t\t\tdiagnostics.push(sectionDiagnostic(openSection, getLabels()));\n\t\t\t\topenSection = null;\n\t\t\t\tsectionHasContent = false;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (openSection && lineNumber === view.state.doc.lines) {\n\t\t\topenSection.insertionAt = view.state.doc.length;\n\t\t\topenSection.insertionTo = view.state.doc.length;\n\t\t}\n\n\t\tif (openSection) {\n\t\t\tsectionHasContent = true;\n\t\t}\n\t}\n\n\nfunction nextNonBlankDirective(view: EditorView, lineNumber: number): string | null {\n\tconst directiveLine = nextNonBlankDirectiveLine(view, lineNumber);\n\treturn directiveLine < view.state.doc.length\n\t\t? view.state.doc.lineAt(directiveLine).text.match(DIRECTIVE_LINE)?.[1].toLowerCase() ?? null\n\t\t: null;\n}\n\nfunction nextNonBlankDirectiveLine(view: EditorView, lineNumber: number): number {\n\tfor (let nextLineNumber = lineNumber + 1; nextLineNumber <= view.state.doc.lines; nextLineNumber++) {\n\t\tconst nextLine = view.state.doc.line(nextLineNumber);\n\t\tif (!nextLine.text.trim()) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (nextLine.text.match(DIRECTIVE_LINE)) {\n\t\t\treturn nextLine.from;\n\t\t}\n\t\treturn view.state.doc.length;\n\t}\n\treturn view.state.doc.length;\n}\n\tif (openSection) {\n\t\tdiagnostics.push(sectionDiagnostic(openSection, getLabels()));\n\t}\n\n\treturn diagnostics;\n}, { delay: 0 });\n\nfunction sectionDiagnostic(section: { endDirective: string; lineFrom: number; lineTo: number; insertionAt: number; insertionTo: number }, labels: LintLabels): Diagnostic {\n\treturn {\n\t\tfrom: section.lineFrom,\n\t\tto: section.lineTo,\n\t\tseverity: 'warning',\n\t\tmessage: labels.sectionMessage(section.endDirective),\n\t\tactions: [{\n\t\t\tname: labels.sectionAction(section.endDirective),\n\t\t\tapply: (view, from, to) => {\n\t\t\t\tconst previousCharacter = section.insertionAt > 0\n\t\t\t\t\t? view.state.doc.sliceString(section.insertionAt - 1, section.insertionAt)\n\t\t\t\t\t: '';\n\t\t\t\tconst needsLeadingNewline = previousCharacter !== '\\n';\n\t\t\t\tconst insertion = `${needsLeadingNewline ? '\\n' : ''}{${section.endDirective}}${section.insertionTo < view.state.doc.length ? '\\n' : ''}`;\n\t\t\t\tview.dispatch({ changes: { from: section.insertionAt, to: section.insertionTo, insert: insertion } });\n\t\t\t},\n\t\t}],\n\t};\n}\n\n/** Suggests explicit, canonical ChordPro suffixes without changing valid input automatically. */\nconst chordNotationLinter = linter((view: EditorView): Diagnostic[] => {\n\tconst diagnostics: Diagnostic[] = [];\n\tconst labels = getLabels();\n\tfor (const replacement of findChordNotationReplacements(view.state.doc.toString())) {\n\t\tdiagnostics.push({\n\t\t\tfrom: replacement.from,\n\t\t\tto: replacement.to,\n\t\t\tseverity: 'info',\n\t\t\tmessage: labels.chordNotationMessage(replacement.replacement, replacement.reason),\n\t\t\tactions: [{\n\t\t\t\tname: labels.chordNotationAction(replacement.replacement),\n\t\t\t\tapply: (targetView, actionFrom, actionTo) => {\n\t\t\t\t\ttargetView.dispatch({ changes: { from: actionFrom, to: actionTo, insert: `[${replacement.replacement}]` } });\n\t\t\t\t},\n\t\t\t}],\n\t\t});\n\t}\n\n\treturn diagnostics;\n});\n\n\treturn [duplicateDirectiveLinter, parserWarningLinter, unclosedSectionLinter, chordNotationLinter];\n}\n","export interface ChordNotationSuggestion {\n\toriginal: string;\n\treplacement: string;\n\toccurrences: number;\n\treason: string;\n}\n\nexport interface ChordNotationReplacement {\n\tfrom: number;\n\tto: number;\n\toriginal: string;\n\treplacement: string;\n\treason: string;\n}\n\nexport interface ChordNotationNormalization {\n\tcontent: string;\n\tsuggestions: ChordNotationSuggestion[];\n}\n\nconst CHORD_TOKEN = /\\[([A-G](?:#|b)?)([^/\\]\\s]*)(\\/[A-G](?:#|b)?)?\\]/g;\n\nconst CHORD_TYPE_ALIASES: Record<string, { canonical: string; reason: string }> = {\n\tsus: { canonical: 'sus4', reason: '\"sus\" se interpreta como sus4; escríbelo explícitamente.' },\n\t'2': { canonical: 'sus2', reason: '\"sus2\" identifica el acorde suspendido de segunda.' },\n\t'+': { canonical: 'aug', reason: '\"aug\" es la notación explícita para quinta aumentada.' },\n\tM7: { canonical: 'maj7', reason: '\"maj7\" identifica explícitamente la séptima mayor.' },\n\tMaj7: { canonical: 'maj7', reason: '\"maj7\" identifica explícitamente la séptima mayor.' },\n};\n\nexport function findChordNotationReplacements(content: string): ChordNotationReplacement[] {\n\tconst replacements: ChordNotationReplacement[] = [];\n\n\tfor (const match of content.matchAll(CHORD_TOKEN)) {\n\t\tconst alias = CHORD_TYPE_ALIASES[match[2]];\n\t\tif (!alias || match.index === undefined) continue;\n\n\t\tconst replacement = `${match[1]}${alias.canonical}${match[3] ?? ''}`;\n\t\treplacements.push({\n\t\t\tfrom: match.index,\n\t\t\tto: match.index + match[0].length,\n\t\t\toriginal: match[0].slice(1, -1),\n\t\t\treplacement,\n\t\t\treason: alias.reason,\n\t\t});\n\t}\n\n\treturn replacements;\n}\n\nexport function getChordNotationSuggestions(content: string): ChordNotationSuggestion[] {\n\tconst grouped = new Map<string, ChordNotationSuggestion>();\n\tfor (const replacement of findChordNotationReplacements(content)) {\n\t\tconst key = `${replacement.original}\\u0000${replacement.replacement}`;\n\t\tconst suggestion = grouped.get(key);\n\t\tif (suggestion) {\n\t\t\tsuggestion.occurrences++;\n\t\t} else {\n\t\t\tgrouped.set(key, {\n\t\t\t\toriginal: replacement.original,\n\t\t\t\treplacement: replacement.replacement,\n\t\t\t\toccurrences: 1,\n\t\t\t\treason: replacement.reason,\n\t\t\t});\n\t\t}\n\t}\n\treturn [...grouped.values()];\n}\n\nexport function normalizeChordNotationText(content: string): ChordNotationNormalization {\n\tconst replacements = findChordNotationReplacements(content);\n\tconst normalizedContent = [...replacements]\n\t\t.reverse()\n\t\t.reduce((result, replacement) => {\n\t\t\treturn `${result.slice(0, replacement.from)}[${replacement.replacement}]${result.slice(replacement.to)}`;\n\t\t}, content);\n\n\treturn {\n\t\tcontent: normalizedContent,\n\t\tsuggestions: getChordNotationSuggestions(content),\n\t};\n}","import { EditorView } from '@codemirror/view';\n\n// Layout-only rules shared by every theme, so the editor fills its container.\nexport const baseTheme = EditorView.baseTheme({\n\t'&': {\n\t\theight: '100%',\n\t},\n\t'.cm-scroller': {\n\t\tflex: '1',\n\t\toverflow: 'auto',\n\t},\n\t'.cm-selectionLayer': {\n\t\tzIndex: '-1 !important',\n\t},\n\t'.chord-search-panel': {\n\t\tposition: 'absolute',\n\t\ttop: '0.4rem',\n\t\tright: '0.5rem',\n\t\tzIndex: '20',\n\t\tpointerEvents: 'auto',\n\t\tdisplay: 'flex',\n\t\twidth: 'min(100% - 1rem, 32rem)',\n\t\tmargin: '0',\n\t\tborder: '1px solid var(--color-neutral-700, #3f3f46)',\n\t\tborderRadius: '0.45rem',\n\t\tboxShadow: '0 0.5rem 1.25rem color-mix(in oklch, #000 28%, transparent)',\n\t\tflexWrap: 'wrap',\n\t\talignItems: 'center',\n\t\tgap: '0.3rem',\n\t\tpadding: '0.35rem 0.45rem',\n\t\tborderBottom: '1px solid var(--color-neutral-200, #e4e4e7)',\n\t\tbackgroundColor: 'var(--color-white, #ffffff)',\n\t\tfontSize: '0.875rem',\n\t},\n\t'.chord-search-controls': {\n\t\tdisplay: 'flex',\n\t\tflex: '1 1 100%',\n\t\tflexWrap: 'nowrap',\n\t\talignItems: 'center',\n\t\tgap: '0.25rem',\n\t},\n\t'.chord-search-navigation': {\n\t\tdisplay: 'flex',\n\t\tflex: '0 0 auto',\n\t\talignItems: 'center',\n\t\tgap: '0.2rem',\n\t},\n\t'.chord-search-fields': {\n\t\tdisplay: 'flex',\n\t\tflex: '1 1 auto',\n\t\tminWidth: '0',\n\t\tflexDirection: 'column',\n\t\tgap: '0.25rem',\n\t},\n\t'.chord-search-replace-row': {\n\t\tdisplay: 'flex',\n\t\tflex: '1 1 100%',\n\t\tflexWrap: 'nowrap',\n\t\talignItems: 'center',\n\t\tgap: '0.25rem',\n\t},\n\t'.chord-search-replace-row[hidden]': {\n\t\tdisplay: 'none',\n\t},\n\t'.chord-search-field': {\n\t\tflex: '1 1 12rem',\n\t\tborder: '1px solid var(--color-neutral-300, #d4d4d8)',\n\t\tborderRadius: '0.35rem',\n\t\tbackgroundColor: 'var(--color-white, #ffffff)',\n\t},\n\t'.chord-search-match-count': {\n\t\tflex: '0 0 auto',\n\t\tminWidth: '3.5rem',\n\t\tcolor: 'var(--color-neutral-500, #71717a)',\n\t\tfontSize: '0.75rem',\n\t\ttextAlign: 'center',\n\t\twhiteSpace: 'nowrap',\n\t},\n\t'.chord-search-field input': {\n\t\tboxSizing: 'border-box',\n\t\twidth: '100%',\n\t\tminHeight: '1.9rem',\n\t\tpadding: '0.3rem 0.5rem',\n\t\tborder: 'none',\n\t\toutline: 'none',\n\t\tbackgroundColor: 'transparent',\n\t\tcolor: 'inherit',\n\t\tfont: 'inherit',\n\t},\n\t'.chord-search-input-with-options': {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tgap: '0.1rem',\n\t\tpaddingRight: '0.15rem',\n\t},\n\t'.chord-search-input-with-options input': {\n\t\tminWidth: '0',\n\t\tborder: 'none',\n\t\toutline: 'none',\n\t\tbackgroundColor: 'transparent',\n\t\tpaddingRight: '0.2rem',\n\t},\n\t'.chord-search-input-with-options .chord-search-option': {\n\t\tminWidth: '1.6rem',\n\t\tminHeight: '1.6rem',\n\t\tzIndex: '2',\n\t\tpadding: '0.1rem',\n\t\tborder: 'none',\n\t\tbackgroundColor: 'transparent',\n\t\tfontSize: '0.7rem',\n\t},\n\t'.chord-search-button': {\n\t\tminHeight: '1.9rem',\n\t\tminWidth: '1.9rem',\n\t\tpadding: '0.2rem 0.45rem',\n\t\tborder: '1px solid var(--color-neutral-300, #d4d4d8)',\n\t\tborderRadius: '0.35rem',\n\t\tbackgroundColor: 'var(--color-neutral-50, #fafafa)',\n\t\tcolor: 'inherit',\n\t\tfont: 'inherit',\n\t\tcursor: 'pointer',\n\t},\n\t'.chord-search-button:hover': {\n\t\tbackgroundColor: 'var(--color-neutral-100, #f4f4f5)',\n\t},\n\t'.chord-search-toggle-replace, .chord-search-previous, .chord-search-next, .chord-search-close': {\n\t\tborder: 'none',\n\t\tbackgroundColor: 'transparent',\n\t},\n\t'.chord-search-toggle-replace:hover, .chord-search-previous:hover, .chord-search-next:hover, .chord-search-close:hover': {\n\t\tbackgroundColor: 'var(--color-neutral-100, #f4f4f5)',\n\t},\n\t'.chord-search-close': {\n\t\tposition: 'static',\n\t\tfontSize: '1.15rem',\n\t\tlineHeight: '1',\n\t},\n\t'.chord-search-options': {\n\t\tdisplay: 'flex',\n\t\tflexWrap: 'wrap',\n\t\tgap: '0.8rem',\n\t\tcolor: 'var(--color-neutral-600, #52525b)',\n\t},\n\t'.chord-search-controls .chord-search-field': {\n\t\tminWidth: '0',\n\t\tflex: '1 1 auto',\n\t},\n\t'.chord-search-replace-row .chord-search-field': {\n\t\tminWidth: '0',\n\t\tflex: '1 1 auto',\n\t},\n\t'.chord-search-option': {\n\t\tdisplay: 'inline-flex',\n\t\talignItems: 'center',\n\t\tgap: '0.35rem',\n\t\tcursor: 'pointer',\n\t},\n\t'.chord-search-toggle': {\n\t\tminWidth: '2.25rem',\n\t\tjustifyContent: 'center',\n\t\tfontWeight: '600',\n\t},\n\t'.chord-search-toggle input': {\n\t\tdisplay: 'none',\n\t},\n\t'.chord-search-toggle.is-active': {\n\t\tborderColor: 'var(--color-primary-500, #3b82f6)',\n\t\tbackgroundColor: 'var(--color-primary-100, #dbeafe)',\n\t\tcolor: 'var(--color-primary-700, #1d4ed8)',\n\t},\n\t'.cm-lintRange-info': {\n\t\tbackgroundImage: 'url(\"data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"6\" height=\"3\"><path d=\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\" stroke=\"%23dc2626\" fill=\"none\" stroke-width=\"1\"/></svg>\") !important',\n\t\tbackgroundSize: '6px 3px',\n\t\tbackgroundPosition: 'left bottom',\n\t\tbackgroundRepeat: 'repeat-x',\n\t},\n\t'.cm-lintRange-warning': {\n\t\tbackgroundImage: 'url(\"data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"6\" height=\"3\"><path d=\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\" stroke=\"%23d97706\" fill=\"none\" stroke-width=\"1\"/></svg>\") !important',\n\t\tbackgroundSize: '6px 3px',\n\t\tbackgroundPosition: 'left bottom',\n\t\tbackgroundRepeat: 'repeat-x',\n\t},\n\t'.cm-lintRange-error': {\n\t\tbackgroundImage: 'url(\"data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"6\" height=\"3\"><path d=\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\" stroke=\"%23dc2626\" fill=\"none\" stroke-width=\"1\"/></svg>\") !important',\n\t\tbackgroundSize: '6px 3px',\n\t\tbackgroundPosition: 'left bottom',\n\t\tbackgroundRepeat: 'repeat-x',\n\t},\n});\n","import { EditorView } from '@codemirror/view';\nimport { HighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { tags as t } from '@lezer/highlight';\n\n// Colors mirror chordproject-client's actual design tokens via CSS custom properties, so the\n// editor matches the live app's dark theme\n// instead of a generic hardcoded palette. Fallback values only apply outside that app (e.g. this\n// package's standalone demo), approximating Tailwind's zinc/blue/red scales.\nconst editorTheme = EditorView.theme(\n\t{\n\t\t'&': {\n\t\t\tbackgroundColor: 'var(--color-neutral-900, #18181b)',\n\t\t\tcolor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'.cm-content': {\n\t\t\ttextDecoration: 'none',\n\t\t\tcaretColor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'.cm-cursor, .cm-dropCursor': {\n\t\t\tborderLeftColor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {\n\t\t\tbackgroundColor: 'var(--color-primary-700, #1d4ed8) !important',\n\t\t\tcolor: 'inherit !important',\n\t\t},\n\t\t'&.cm-focused .cm-content:focus::selection, &.cm-focused .cm-content .cm-line::selection': {\n\t\t\tbackgroundColor: 'var(--color-primary-700, #1d4ed8) !important',\n\t\t\tcolor: 'inherit !important',\n\t\t},\n\t\t'.cm-selectionLayer .cm-selectionBackground': {\n\t\t\tboxShadow: 'none',\n\t\t},\n\t\t'.cm-activeLine': {\n\t\t\tbackgroundColor: 'transparent',\n\t\t},\n\t\t'.cm-gutters': {\n\t\t\tbackgroundColor: 'var(--color-neutral-900, #18181b)',\n\t\t\tcolor: 'var(--color-neutral-400, #a1a1aa)',\n\t\t\tborder: 'none',\n\t\t},\n\t\t'.cm-activeLineGutter': {\n\t\t\tbackgroundColor: 'var(--color-neutral-800, #27272a)',\n\t\t},\n\t\t'.chord-search-panel': {\n\t\t\tborderBottomColor: 'var(--color-neutral-700, #3f3f46)',\n\t\t\tbackgroundColor: 'var(--color-neutral-900, #18181b)',\n\t\t\tborderColor: 'var(--color-neutral-700, #3f3f46)',\n\t\t},\n\t\t'.chord-search-field input': {\n\t\t\tbackgroundColor: 'var(--color-neutral-800, #27272a)',\n\t\t\tcolor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'.chord-search-field': {\n\t\t\tborderColor: 'var(--color-neutral-700, #3f3f46)',\n\t\t\tbackgroundColor: 'var(--color-neutral-800, #27272a)',\n\t\t},\n\t\t'.chord-search-input-with-options input': {\n\t\t\tbackgroundColor: 'transparent',\n\t\t},\n\t\t'.chord-search-button': {\n\t\t\tborderColor: 'var(--color-neutral-700, #3f3f46)',\n\t\t\tbackgroundColor: 'var(--color-neutral-800, #27272a)',\n\t\t\tcolor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'.chord-search-button:hover': {\n\t\t\tbackgroundColor: 'var(--color-neutral-700, #3f3f46)',\n\t\t},\n\t\t'.chord-search-toggle-replace:hover, .chord-search-previous:hover, .chord-search-next:hover, .chord-search-close:hover': {\n\t\t\tbackgroundColor: 'var(--color-neutral-800, #27272a)',\n\t\t},\n\t\t'.chord-search-options': {\n\t\t\tcolor: 'var(--color-neutral-300, #d4d4d8)',\n\t\t},\n\t\t'.chord-search-toggle.is-active': {\n\t\t\tborderColor: 'var(--color-primary-400, #60a5fa)',\n\t\t\tbackgroundColor: 'var(--color-primary-950, #172554)',\n\t\t\tcolor: 'var(--color-primary-200, #bfdbfe)',\n\t\t},\n\t\t'.cm-completionIcon-chord-used + .cm-completionLabel': {\n\t\t\tcolor: 'var(--color-primary-300, #93c5fd)',\n\t\t\tfontWeight: '600',\n\t\t},\n\t\t'.cm-tooltip-autocomplete ul li[aria-selected] .cm-completionIcon-chord-used + .cm-completionLabel': {\n\t\t\tcolor: 'var(--color-white, #ffffff)',\n\t\t},\n\t\t'.cm-tooltip-autocomplete ul li[aria-selected]': {\n\t\t\tbackgroundColor: 'var(--color-primary-700, #1d4ed8)',\n\t\t\tcolor: 'var(--color-white, #ffffff)',\n\t\t},\n\t\t'.cm-tooltip-autocomplete ul li[aria-selected] .cm-completionLabel, .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionDetail, .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionMatchedText': {\n\t\t\tcolor: 'var(--color-white, #ffffff)',\n\t\t},\n\t\t'.cm-lintRange-info': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23f87171\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t\t'.cm-lintRange-warning': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23fcd34d\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t\t'.cm-lintRange-error': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23f87171\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t},\n\t{ dark: true }\n);\n\nconst highlightStyle = HighlightStyle.define([\n\t{ tag: t.keyword, color: 'var(--color-error-400, #f87171)' },\n\t{ tag: [t.meta, t.attributeName], color: 'var(--color-primary-300, #93c5fd)' },\n\t{ tag: [t.constant(t.name), t.character, t.number], color: 'var(--color-neutral-400, #a1a1aa)' },\n\t{ tag: t.invalid, color: 'var(--color-error-200, #fecaca)', backgroundColor: 'color-mix(in oklch, var(--color-error-600, #dc2626) 30%, transparent)' },\n\t{ tag: t.string, color: 'var(--color-neutral-300, #d4d4d8)' },\n\t{ tag: [t.comment, t.lineComment], fontStyle: 'italic', color: '#79c98d' },\n\t{ tag: t.heading, color: 'var(--color-primary-300, #93c5fd)' },\n]);\n\nexport const darkTheme = [editorTheme, syntaxHighlighting(highlightStyle)];\n\n","import { EditorView } from '@codemirror/view';\nimport { HighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { tags as t } from '@lezer/highlight';\n\n// Colors mirror chordproject-client's actual design tokens via CSS custom properties, so the\n// editor matches the live app's light theme\n// instead of a generic hardcoded palette. Fallback values only apply outside that app (e.g. this\n// package's standalone demo), approximating Tailwind's zinc/blue/red scales.\nconst editorTheme = EditorView.theme(\n\t{\n\t\t'&': {\n\t\t\tbackgroundColor: 'var(--color-white, #ffffff)',\n\t\t\tcolor: 'var(--color-neutral-950, #09090b)',\n\t\t},\n\t\t'.cm-content': {\n\t\t\ttextDecoration: 'none',\n\t\t\tcaretColor: 'var(--color-neutral-950, #09090b)',\n\t\t},\n\t\t'.cm-cursor, .cm-dropCursor': {\n\t\t\tborderLeftColor: 'var(--color-neutral-950, #09090b)',\n\t\t},\n\t\t'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {\n\t\t\tbackgroundColor: 'var(--color-primary-200, #bfdbfe) !important',\n\t\t\tcolor: 'inherit !important',\n\t\t},\n\t\t'&.cm-focused .cm-content:focus::selection, &.cm-focused .cm-content .cm-line::selection': {\n\t\t\tbackgroundColor: 'var(--color-primary-200, #bfdbfe) !important',\n\t\t\tcolor: 'inherit !important',\n\t\t},\n\t\t'.cm-selectionLayer .cm-selectionBackground': {\n\t\t\tboxShadow: 'none',\n\t\t},\n\t\t'.cm-activeLine': {\n\t\t\tbackgroundColor: 'transparent',\n\t\t},\n\t\t'.cm-gutters': {\n\t\t\tbackgroundColor: 'var(--color-neutral-50, #fafafa)',\n\t\t\tcolor: 'var(--color-neutral-500, #71717a)',\n\t\t\tborder: 'none',\n\t\t},\n\t\t'.cm-activeLineGutter': {\n\t\t\tbackgroundColor: 'var(--color-neutral-100, #f4f4f5)',\n\t\t},\n\t\t'.cm-completionIcon-chord-used + .cm-completionLabel': {\n\t\t\tcolor: 'var(--color-primary-700, #1d4ed8)',\n\t\t\tfontWeight: '600',\n\t\t},\n\t\t'.cm-tooltip-autocomplete ul li[aria-selected] .cm-completionIcon-chord-used + .cm-completionLabel': {\n\t\t\tcolor: 'var(--color-white, #ffffff)',\n\t\t},\n\t\t'.cm-tooltip-autocomplete ul li[aria-selected]': {\n\t\t\tbackgroundColor: 'var(--color-primary-600, #2563eb)',\n\t\t\tcolor: 'var(--color-white, #ffffff)',\n\t\t},\n\t\t'.cm-tooltip-autocomplete ul li[aria-selected] .cm-completionLabel, .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionDetail, .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionMatchedText': {\n\t\t\tcolor: 'var(--color-white, #ffffff)',\n\t\t},\n\t\t'.cm-lintRange-info': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23dc2626\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t\t'.cm-lintRange-warning': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23d97706\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t\t'.cm-lintRange-error': {\n\t\t\tbackgroundImage: 'url(\"data:image/svg+xml,%3Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"6\\\" height=\\\"3\\\"%3E%3Cpath d=\\\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\\\" stroke=\\\"%23dc2626\\\" fill=\\\"none\\\" stroke-width=\\\"1\\\"/%3E%3C/svg%3E\") !important',\n\t\t\tbackgroundSize: '6px 3px',\n\t\t\tbackgroundPosition: 'left bottom',\n\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t},\n\t\t'.chord-search-panel': {\n\t\t\tborderColor: 'var(--color-neutral-300, #d4d4d8)',\n\t\t\tbackgroundColor: 'var(--color-white, #ffffff)',\n\t\t},\n\t},\n\t{ dark: false }\n);\n\nconst highlightStyle = HighlightStyle.define([\n\t{ tag: t.keyword, color: 'var(--color-error-600, #dc2626)' },\n\t{ tag: [t.meta, t.attributeName], color: 'var(--color-primary-600, #2563eb)' },\n\t{ tag: [t.constant(t.name), t.character, t.number], color: 'var(--color-neutral-600, #52525b)' },\n\t{ tag: t.invalid, color: 'var(--color-error-700, #b91c1c)', backgroundColor: 'var(--color-error-100, #fee2e2)' },\n\t{ tag: t.string, color: 'var(--color-neutral-700, #3f3f46)' },\n\t{ tag: [t.comment, t.lineComment], fontStyle: 'italic', color: '#4d9f68' },\n\t{ tag: t.heading, color: 'var(--color-primary-600, #2563eb)' },\n]);\n\nexport const lightTheme = [editorTheme, syntaxHighlighting(highlightStyle)];\n\n","import { Extension } from '@codemirror/state';\nimport { baseTheme } from './base';\nimport { darkTheme } from './dark';\nimport { lightTheme } from './light';\n\nexport type ThemeName = 'light' | 'dark';\n\nexport function themeExtension(name: ThemeName): Extension[] {\n\treturn [baseTheme, ...(name === 'dark' ? darkTheme : lightTheme)];\n}\n","import { EditorView, Panel, ViewUpdate } from '@codemirror/view';\nimport {\n closeSearchPanel,\n findNext,\n findPrevious,\n getSearchQuery,\n replaceAll,\n replaceNext,\n SearchQuery,\n setSearchQuery,\n} from '@codemirror/search';\n\nexport interface SearchLabels {\n search: string;\n replace: string;\n next: string;\n previous: string;\n replaceOne: string;\n replaceAll: string;\n close: string;\n toggleReplace: string;\n hideReplace: string;\n preserveCase: string;\n caseSensitive: string;\n wholeWord: string;\n}\n\nexport const defaultSearchLabels: SearchLabels = {\n search: 'Find',\n replace: 'Replace',\n next: 'Next match',\n previous: 'Previous match',\n replaceOne: 'Replace',\n replaceAll: 'Replace all',\n close: 'Close search',\n toggleReplace: 'Show replace field',\n hideReplace: 'Hide replace field',\n preserveCase: 'Preserve case',\n caseSensitive: 'Match case',\n wholeWord: 'Whole word',\n};\n\nexport function createSearchPanel(view: EditorView, labels: SearchLabels = defaultSearchLabels): Panel {\n const panel = document.createElement('form');\n panel.className = 'chord-search-panel';\n panel.addEventListener('submit', (event) => event.preventDefault());\n\n const searchInput = createInput('chord-search-input', labels.search);\n const replaceInput = createInput('chord-replace-input', labels.replace);\n const nextButton = createButton('chord-search-next', labels.next, '›');\n const previousButton = createButton('chord-search-previous', labels.previous, '‹');\n const replaceButton = createButton('chord-search-replace', labels.replaceOne, '↵');\n const replaceAllButton = createButton('chord-search-replace-all', labels.replaceAll, '↵×');\n const replaceToggle = createButton('chord-search-toggle-replace', labels.toggleReplace, '↔');\n const closeButton = createButton('chord-search-close', labels.close, '×');\n const matchCount = document.createElement('span');\n matchCount.className = 'chord-search-match-count';\n matchCount.setAttribute('aria-live', 'polite');\n const preserveCase = createToggle('chord-search-preserve-case', labels.preserveCase, 'AB');\n const caseSensitive = createToggle('chord-search-case', labels.caseSensitive, 'Aa');\n const wholeWord = createToggle('chord-search-whole-word', labels.wholeWord, 'ab');\n\n searchInput.wrapper.classList.add('chord-search-input-with-options');\n searchInput.wrapper.append(caseSensitive.button, wholeWord.button);\n replaceInput.wrapper.classList.add('chord-search-input-with-options');\n replaceInput.wrapper.append(preserveCase.button);\n\n const controls = document.createElement('div');\n controls.className = 'chord-search-controls';\n\n const replaceRow = document.createElement('div');\n replaceRow.className = 'chord-search-replace-row';\n replaceRow.hidden = false;\n replaceRow.append(replaceInput.wrapper, replaceButton, replaceAllButton);\n\n const searchFields = document.createElement('div');\n searchFields.className = 'chord-search-fields';\n searchFields.append(searchInput.wrapper, replaceRow);\n const navigation = document.createElement('div');\n navigation.className = 'chord-search-navigation';\n navigation.append(previousButton, nextButton, closeButton);\n controls.append(replaceToggle, searchFields, matchCount, navigation);\n panel.append(controls);\n\n const updateQuery = (): void => {\n const current = getSearchQuery(view.state);\n view.dispatch({\n effects: setSearchQuery.of(new SearchQuery({\n search: searchInput.input.value,\n replace: replaceInput.input.value,\n caseSensitive: caseSensitive.input.checked,\n wholeWord: wholeWord.input.checked,\n literal: current.literal,\n })),\n });\n };\n\n const runCommand = (command: (target: EditorView) => boolean): void => {\n updateQuery();\n command(view);\n searchInput.input.focus();\n };\n\n searchInput.input.addEventListener('input', updateQuery);\n replaceInput.input.addEventListener('input', updateQuery);\n caseSensitive.input.addEventListener('change', updateQuery);\n caseSensitive.button.addEventListener('click', () => {\n caseSensitive.input.checked = !caseSensitive.input.checked;\n updateQuery();\n });\n wholeWord.button.addEventListener('click', () => {\n wholeWord.input.checked = !wholeWord.input.checked;\n updateQuery();\n });\n preserveCase.button.addEventListener('click', () => {\n preserveCase.input.checked = !preserveCase.input.checked;\n preserveCase.button.classList.toggle('is-active', preserveCase.input.checked);\n });\n wholeWord.input.addEventListener('change', updateQuery);\n searchInput.input.addEventListener('keydown', (event) => handleKey(event, () => runCommand(findNext), () => runCommand(findPrevious)));\n replaceInput.input.addEventListener('keydown', (event) => handleKey(event, () => runCommand(findNext), () => runCommand(findPrevious)));\n nextButton.addEventListener('click', () => runCommand(findNext));\n previousButton.addEventListener('click', () => runCommand(findPrevious));\n replaceButton.addEventListener('click', () => runCommand(replaceNext));\n replaceAllButton.addEventListener('click', () => runCommand(replaceAll));\n closeButton.addEventListener('click', () => closeSearchPanel(view));\n replaceToggle.addEventListener('click', () => {\n replaceRow.hidden = !replaceRow.hidden;\n replaceToggle.classList.toggle('is-active', !replaceRow.hidden);\n replaceToggle.title = replaceRow.hidden ? labels.toggleReplace : labels.hideReplace;\n replaceToggle.setAttribute('aria-label', replaceToggle.title);\n replaceInput.input.focus();\n });\n\n replaceToggle.classList.add('is-active');\n replaceToggle.title = labels.hideReplace;\n replaceToggle.setAttribute('aria-label', labels.hideReplace);\n\n const update = (): void => {\n const query = getSearchQuery(view.state);\n if (document.activeElement !== searchInput.input) searchInput.input.value = query.search;\n if (document.activeElement !== replaceInput.input) replaceInput.input.value = query.replace;\n caseSensitive.input.checked = query.caseSensitive;\n wholeWord.input.checked = query.wholeWord;\n caseSensitive.button.classList.toggle('is-active', query.caseSensitive);\n wholeWord.button.classList.toggle('is-active', query.wholeWord);\n preserveCase.button.classList.toggle('is-active', preserveCase.input.checked);\n updateMatchCount(query, view, matchCount);\n };\n\n update();\n return {\n dom: panel,\n top: true,\n mount: () => {\n update();\n searchInput.input.focus();\n searchInput.input.select();\n },\n update: (_update: ViewUpdate) => update(),\n };\n}\n\nfunction updateMatchCount(query: SearchQuery, view: EditorView, target: HTMLSpanElement): void {\n if (!query.valid || !query.search) {\n target.textContent = '';\n return;\n }\n\n const matches: { from: number; to: number }[] = [];\n const cursor = query.getCursor(view.state);\n for (let match = cursor.next(); !match.done; match = cursor.next()) {\n matches.push(match.value);\n }\n if (!matches.length) {\n target.textContent = '0';\n return;\n }\n\n const selection = view.state.selection.main;\n const current = matches.findIndex((match) => match.from === selection.from && match.to === selection.to);\n target.textContent = `${current >= 0 ? current + 1 : 1} / ${matches.length}`;\n}\n\nfunction createInput(className: string, placeholder: string): { wrapper: HTMLLabelElement; input: HTMLInputElement } {\n const wrapper = document.createElement('label');\n wrapper.className = `chord-search-field ${className}`;\n const input = document.createElement('input');\n input.type = 'text';\n input.placeholder = placeholder;\n input.setAttribute('aria-label', placeholder);\n wrapper.append(input);\n return { wrapper, input };\n}\n\nfunction createButton(className: string, label: string, text = label): HTMLButtonElement {\n const button = document.createElement('button');\n button.type = 'button';\n button.className = `chord-search-button ${className}`;\n button.textContent = text;\n button.title = label;\n button.setAttribute('aria-label', label);\n return button;\n}\n\nfunction createToggle(className: string, label: string, text: string): { button: HTMLButtonElement; input: HTMLInputElement } {\n const button = document.createElement('button');\n button.type = 'button';\n button.className = `chord-search-option chord-search-toggle ${className}`;\n button.title = label;\n button.setAttribute('aria-label', label);\n const input = document.createElement('input');\n input.type = 'checkbox';\n input.tabIndex = -1;\n input.setAttribute('aria-hidden', 'true');\n const textElement = document.createElement('span');\n textElement.textContent = text;\n button.append(input, textElement);\n return { button, input };\n}\n\nfunction handleKey(event: KeyboardEvent, next: () => void, previous: () => void): void {\n if (event.key !== 'Enter') return;\n event.preventDefault();\n event.shiftKey ? previous() : next();\n}\n"],"mappings":";AAAA,SAAS,aAAa,eAAAA,oBAA8B;AACpD,SAAS,cAAAC,mBAA8B;AACvC,SAAS,iBAAiB,cAAc;;;ACAxC;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,OACM;;;ACFP,IAAM,QAAQ,CA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AC,UAAkB;AAC5B,WAAK,SAAS;AAAA,QACb,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,IAAI,QAAQ,QAAQ,MAAM;AAAA,MAC9D,CAAC;AAAA,IACF;AAAA,IACA,UAAU,CAAC,UAAqB;AAC/B,WAAK,SAAS,EAAE,SAAS,iBAAiB,YAAY,eAAe,KAAK,CAAC,EAAE,CAAC;AAAA,IAC/E;AAAA,IACA,aAAa,MAAM;AAClB,kBAAY,IAAI;AAAA,IACjB;AAAA,IACA,oBAAoB,MAAM;AACzB,yBAAmB,IAAI;AAAA,IACxB;AAAA,IACA,YAAY,MAAM;AACjB,sBAAgB,IAAI;AAAA,IACrB;AAAA,IACA,6BAA6B,MAAM,4BAA4B,KAAK,MAAM,IAAI,SAAS,CAAC;AAAA,IACxF,wBAAwB,MAAM;AAC7B,YAAM,UAAU,KAAK,MAAM,IAAI,SAAS;AACxC,YAAM,gBAAgB,2BAA2B,OAAO;AACxD,YAAM,eAAe,8BAA8B,OAAO;AAC1D,UAAI,aAAa,SAAS,GAAG;AAC5B,aAAK,SAAS;AAAA,UACb,SAAS,aAAa,IAAI,CAAC,EAAE,MAAM,IAAI,YAAY,OAAO,EAAE,MAAM,IAAI,QAAQ,IAAI,WAAW,IAAI,EAAE;AAAA,QACpG,CAAC;AAAA,MACF;AACA,aAAO,cAAc;AAAA,IACtB;AAAA,IACA,aAAa,MAAM,KAAK,SAAS,CAAC,CAAC;AAAA,IACnC,OAAO,MAAM,KAAK,MAAM;AAAA,IACxB,SAAS,MAAM,KAAK,QAAQ;AAAA,EAC7B;AACD;","names":["EditorState","EditorView","history","startCompletion","startCompletion","CHORD_TOKEN","view","EditorView","EditorView","t","EditorView","HighlightStyle","syntaxHighlighting","t","editorTheme","highlightStyle","EditorView","EditorState","view"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chordproject/editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A CodeMirror 6 based editor for ChordPro songs.",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"@codemirror/commands": "^6.8.0",
|
|
52
52
|
"@codemirror/language": "^6.10.8",
|
|
53
53
|
"@codemirror/lint": "^6.8.4",
|
|
54
|
+
"@codemirror/search": "^6.7.2",
|
|
54
55
|
"@codemirror/state": "^6.5.0",
|
|
55
56
|
"@codemirror/view": "^6.36.1",
|
|
56
57
|
"@lezer/highlight": "^1.2.1"
|
|
@@ -58,4 +59,4 @@
|
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"@chordproject/parser": "^1.0.0"
|
|
60
61
|
}
|
|
61
|
-
}
|
|
62
|
+
}
|