@hosanna/chordpro 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +201 -0
- package/README.md +177 -0
- package/dist/chunk-6VAMM7S3.mjs +388 -0
- package/dist/chunk-CTBAE2XK.mjs +1154 -0
- package/dist/chunk-PENNIH4J.mjs +1143 -0
- package/dist/chunk-QZY7KJWK.mjs +749 -0
- package/dist/chunk-TUKJQWXG.mjs +50 -0
- package/dist/editor/index.d.mts +44 -0
- package/dist/editor/index.d.ts +44 -0
- package/dist/editor/index.js +789 -0
- package/dist/editor/index.mjs +16 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3459 -0
- package/dist/index.mjs +54 -0
- package/dist/parser/index.d.mts +185 -0
- package/dist/parser/index.d.ts +185 -0
- package/dist/parser/index.js +1567 -0
- package/dist/parser/index.mjs +32 -0
- package/dist/renderer/index.d.mts +52 -0
- package/dist/renderer/index.d.ts +52 -0
- package/dist/renderer/index.js +2237 -0
- package/dist/renderer/index.mjs +15 -0
- package/package.json +74 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// src/components/common/Button.tsx
|
|
2
|
+
import { Loader2 } from "lucide-react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
var Button = React.memo(
|
|
6
|
+
({
|
|
7
|
+
children,
|
|
8
|
+
variant = "primary",
|
|
9
|
+
size = "md",
|
|
10
|
+
isLoading = false,
|
|
11
|
+
icon,
|
|
12
|
+
className = "",
|
|
13
|
+
disabled,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const baseStyles = "inline-flex items-center justify-center font-bold rounded-xl transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-m3-bg disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer active:scale-[0.98]";
|
|
17
|
+
const variantStyles = {
|
|
18
|
+
primary: "bg-m3-primary hover:bg-m3-primary-dark text-white shadow-sm shadow-m3-primary/20 focus:ring-m3-primary",
|
|
19
|
+
secondary: "bg-m3-sidebar hover:bg-m3-hover text-m3-text border border-m3-border/30 focus:ring-m3-primary/30",
|
|
20
|
+
danger: "bg-rose-600 hover:bg-rose-700 text-white shadow-sm focus:ring-rose-500",
|
|
21
|
+
ghost: "hover:bg-m3-hover text-m3-secondary hover:text-m3-text transition-colors",
|
|
22
|
+
outline: "border border-m3-border text-m3-text hover:bg-m3-hover focus:ring-m3-primary/30"
|
|
23
|
+
};
|
|
24
|
+
const sizeStyles = {
|
|
25
|
+
sm: "px-2.5 py-1.5 text-xs gap-1.5",
|
|
26
|
+
md: "px-3.5 py-2 text-sm gap-2",
|
|
27
|
+
lg: "px-5 py-2.5 text-base gap-2.5"
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ jsxs(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
className: `${baseStyles} ${variantStyles[variant]} ${sizeStyles[size]} ${className}`,
|
|
33
|
+
disabled: disabled || isLoading,
|
|
34
|
+
...props,
|
|
35
|
+
children: [
|
|
36
|
+
isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 animate-spin text-current" }) : icon ? /* @__PURE__ */ jsx("span", { className: "shrink-0", children: icon }) : null,
|
|
37
|
+
children
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
Button
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* @license
|
|
49
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
50
|
+
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { IAceEditorProps } from 'react-ace';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Preloads Ace Editor, its themes, and ChordPro syntax modes in the background.
|
|
6
|
+
* Call this after your app finishes loading or in an idle callback so that clicking
|
|
7
|
+
* a song or opening the editor renders immediately with zero delay.
|
|
8
|
+
*/
|
|
9
|
+
declare function preloadEditor(): Promise<React__default.ComponentType<IAceEditorProps>>;
|
|
10
|
+
interface EditorSettings {
|
|
11
|
+
theme?: string;
|
|
12
|
+
fontSize?: number;
|
|
13
|
+
wordWrap?: boolean;
|
|
14
|
+
showLineNumbers?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface EditorProps {
|
|
17
|
+
value: string;
|
|
18
|
+
onChange: (value: string) => void;
|
|
19
|
+
onSave?: (value: string) => void;
|
|
20
|
+
settings?: EditorSettings;
|
|
21
|
+
mode?: string;
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
fallback?: React__default.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
declare function Editor({ value, onChange, onSave, settings, mode, readOnly, fallback, }: EditorProps): React__default.JSX.Element;
|
|
26
|
+
|
|
27
|
+
interface ChordOccurrence {
|
|
28
|
+
value: string;
|
|
29
|
+
meta: string;
|
|
30
|
+
score: number;
|
|
31
|
+
}
|
|
32
|
+
declare class ChordFinder {
|
|
33
|
+
private static readonly CHORD_REGEX;
|
|
34
|
+
/**
|
|
35
|
+
* Extracts chords from text and returns them formatted for Ace Autocomplete
|
|
36
|
+
*/
|
|
37
|
+
static getChords(text: string): ChordOccurrence[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare function registerChordproMode(aceInstance?: any): Promise<void>;
|
|
41
|
+
|
|
42
|
+
declare function registerChordproSnippets(aceInstance?: any): Promise<void>;
|
|
43
|
+
|
|
44
|
+
export { ChordFinder, type ChordOccurrence, Editor, type EditorProps, type EditorSettings, Editor as default, preloadEditor, registerChordproMode, registerChordproSnippets };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { IAceEditorProps } from 'react-ace';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Preloads Ace Editor, its themes, and ChordPro syntax modes in the background.
|
|
6
|
+
* Call this after your app finishes loading or in an idle callback so that clicking
|
|
7
|
+
* a song or opening the editor renders immediately with zero delay.
|
|
8
|
+
*/
|
|
9
|
+
declare function preloadEditor(): Promise<React__default.ComponentType<IAceEditorProps>>;
|
|
10
|
+
interface EditorSettings {
|
|
11
|
+
theme?: string;
|
|
12
|
+
fontSize?: number;
|
|
13
|
+
wordWrap?: boolean;
|
|
14
|
+
showLineNumbers?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface EditorProps {
|
|
17
|
+
value: string;
|
|
18
|
+
onChange: (value: string) => void;
|
|
19
|
+
onSave?: (value: string) => void;
|
|
20
|
+
settings?: EditorSettings;
|
|
21
|
+
mode?: string;
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
fallback?: React__default.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
declare function Editor({ value, onChange, onSave, settings, mode, readOnly, fallback, }: EditorProps): React__default.JSX.Element;
|
|
26
|
+
|
|
27
|
+
interface ChordOccurrence {
|
|
28
|
+
value: string;
|
|
29
|
+
meta: string;
|
|
30
|
+
score: number;
|
|
31
|
+
}
|
|
32
|
+
declare class ChordFinder {
|
|
33
|
+
private static readonly CHORD_REGEX;
|
|
34
|
+
/**
|
|
35
|
+
* Extracts chords from text and returns them formatted for Ace Autocomplete
|
|
36
|
+
*/
|
|
37
|
+
static getChords(text: string): ChordOccurrence[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare function registerChordproMode(aceInstance?: any): Promise<void>;
|
|
41
|
+
|
|
42
|
+
declare function registerChordproSnippets(aceInstance?: any): Promise<void>;
|
|
43
|
+
|
|
44
|
+
export { ChordFinder, type ChordOccurrence, Editor, type EditorProps, type EditorSettings, Editor as default, preloadEditor, registerChordproMode, registerChordproSnippets };
|