chordsheetjs 12.3.1 → 13.0.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/README.md +42 -1
- package/lib/bundle.js +52591 -7395
- package/lib/bundle.min.js +7091 -137
- package/lib/index.js +17468 -5438
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +799 -203
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +17462 -5439
- package/lib/module.js.map +1 -1
- package/package.json +26 -13
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ChordSheetJS [](https://github.com/martijnversluis/ChordSheetJS/actions/workflows/ci.yml?query=branch%3Amaster) [](https://github.com/martijnversluis/ChordSheetJS/actions/workflows/release.yml)
|
|
1
|
+
# ChordSheetJS   [](https://github.com/martijnversluis/ChordSheetJS/actions/workflows/ci.yml?query=branch%3Amaster) [](https://github.com/martijnversluis/ChordSheetJS/actions/workflows/release.yml)
|
|
2
2
|
|
|
3
3
|
A JavaScript library for parsing and formatting chord sheets
|
|
4
4
|
|
|
@@ -126,6 +126,47 @@ const formatter = new ChordSheetJS.ChordProFormatter();
|
|
|
126
126
|
const disp = formatter.format(song);
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
#### Chords over words format
|
|
130
|
+
|
|
131
|
+
```javascript
|
|
132
|
+
const formatter = new ChordSheetJS.ChordsOverWordsFormatter();
|
|
133
|
+
const disp = formatter.format(song);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### PDF format (BETA)
|
|
137
|
+
|
|
138
|
+
> **Note:** `PdfFormatter` is currently in beta. Its API may change in future releases.
|
|
139
|
+
|
|
140
|
+
Generates a PDF document directly. Requires configuration for page size and fonts.
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
const formatter = new ChordSheetJS.PdfFormatter();
|
|
144
|
+
const doc = formatter.format(song);
|
|
145
|
+
doc.save('song.pdf');
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Measured HTML format (BETA)
|
|
149
|
+
|
|
150
|
+
> **Note:** `MeasuredHtmlFormatter` is currently in beta. Its API may change in future releases.
|
|
151
|
+
|
|
152
|
+
Creates HTML output with precise text measurement for accurate chord positioning.
|
|
153
|
+
|
|
154
|
+
```javascript
|
|
155
|
+
const formatter = new ChordSheetJS.MeasuredHtmlFormatter();
|
|
156
|
+
const disp = formatter.format(song);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Layout Engine
|
|
160
|
+
|
|
161
|
+
The `PdfFormatter` and `MeasuredHtmlFormatter` are powered by a layout engine that handles text measurement
|
|
162
|
+
and precise positioning of chords above lyrics. The layout engine uses measurers to calculate text dimensions:
|
|
163
|
+
|
|
164
|
+
- `DomMeasurer` - Measures text using the browser's DOM
|
|
165
|
+
- `CanvasMeasurer` - Measures text using HTML Canvas
|
|
166
|
+
- `JsPdfMeasurer` - Measures text using jsPDF (for PDF output)
|
|
167
|
+
|
|
168
|
+
These are used internally by the measurement-based formatters but can also be accessed directly for advanced use cases.
|
|
169
|
+
|
|
129
170
|
### Serialize/deserialize
|
|
130
171
|
|
|
131
172
|
Chord sheets (`Song`s) can be serialized to plain JavaScript objects, which can be converted to JSON, XML etc by
|