smoosic 1.0.25 → 1.0.26
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/build/smoosic.js +1 -1
- package/package.json +1 -1
- package/release/smoosic.js +1 -1
- package/src/application/exports.ts +1 -0
- package/types/src/application/application.d.ts +102 -102
- package/types/src/application/common.d.ts +74 -74
- package/types/src/application/configuration.d.ts +74 -74
- package/types/src/application/dom.d.ts +8 -8
- package/types/src/application/dynamicInit.d.ts +1 -1
- package/types/src/application/eventHandler.d.ts +78 -78
- package/types/src/application/exports.d.ts +494 -493
- package/types/src/application/generateVexTests.d.ts +10 -10
- package/types/src/application/keyCommands.d.ts +90 -90
- package/types/src/common/bootstrap.bundle.d.ts +1138 -1138
- package/types/src/common/htmlHelpers.d.ts +105 -105
- package/types/src/common/jszip.d.ts +2 -2
- package/types/src/common/midi-parser.d.ts +38 -38
- package/types/src/common/promiseHelpers.d.ts +30 -30
- package/types/src/common/serializationHelpers.d.ts +29 -29
- package/types/src/common/textformatter.d.ts +140 -140
- package/types/src/common/vex.d.ts +222 -222
- package/types/src/render/audio/musicCursor.d.ts +25 -25
- package/types/src/render/audio/oscillator.d.ts +98 -98
- package/types/src/render/audio/player.d.ts +141 -141
- package/types/src/render/audio/samples.d.ts +56 -56
- package/types/src/render/sui/configuration.d.ts +12 -12
- package/types/src/render/sui/formatter.d.ts +151 -151
- package/types/src/render/sui/layoutDebug.d.ts +43 -43
- package/types/src/render/sui/mapper.d.ts +116 -116
- package/types/src/render/sui/piano.d.ts +46 -46
- package/types/src/render/sui/renderState.d.ts +88 -88
- package/types/src/render/sui/scoreRender.d.ts +93 -93
- package/types/src/render/sui/scoreView.d.ts +267 -267
- package/types/src/render/sui/scoreViewOperations.d.ts +594 -594
- package/types/src/render/sui/scroller.d.ts +34 -34
- package/types/src/render/sui/svgHelpers.d.ts +85 -85
- package/types/src/render/sui/svgPageMap.d.ts +318 -318
- package/types/src/render/sui/textEdit.d.ts +310 -310
- package/types/src/render/sui/textRender.d.ts +189 -189
- package/types/src/render/sui/tracker.d.ts +90 -90
- package/types/src/render/vex/glyphDimensions.d.ts +23 -23
- package/types/src/render/vex/smoAdapter.d.ts +46 -46
- package/types/src/render/vex/toVex.d.ts +13 -13
- package/types/src/render/vex/vxMeasure.d.ts +95 -95
- package/types/src/render/vex/vxNote.d.ts +55 -55
- package/types/src/render/vex/vxSystem.d.ts +64 -64
- package/types/src/smo/data/common.d.ts +220 -220
- package/types/src/smo/data/measure.d.ts +510 -510
- package/types/src/smo/data/measureModifiers.d.ts +506 -506
- package/types/src/smo/data/music.d.ts +438 -438
- package/types/src/smo/data/note.d.ts +485 -485
- package/types/src/smo/data/noteModifiers.d.ts +590 -590
- package/types/src/smo/data/partInfo.d.ts +162 -162
- package/types/src/smo/data/score.d.ts +395 -395
- package/types/src/smo/data/scoreModifiers.d.ts +433 -433
- package/types/src/smo/data/scoreText.d.ts +277 -277
- package/types/src/smo/data/staffModifiers.d.ts +767 -767
- package/types/src/smo/data/systemStaff.d.ts +238 -238
- package/types/src/smo/data/tuplet.d.ts +146 -146
- package/types/src/smo/midi/midiToSmo.d.ts +198 -198
- package/types/src/smo/midi/smoToMidi.d.ts +23 -23
- package/types/src/smo/mxml/smoToXml.d.ts +165 -165
- package/types/src/smo/mxml/xmlHelpers.d.ts +140 -140
- package/types/src/smo/mxml/xmlState.d.ts +257 -257
- package/types/src/smo/mxml/xmlToSmo.d.ts +92 -92
- package/types/src/smo/xform/beamers.d.ts +46 -46
- package/types/src/smo/xform/copypaste.d.ts +99 -99
- package/types/src/smo/xform/operations.d.ts +127 -127
- package/types/src/smo/xform/roadmap.d.ts +70 -70
- package/types/src/smo/xform/selections.d.ts +153 -153
- package/types/src/smo/xform/tickDuration.d.ts +155 -155
- package/types/src/smo/xform/tickMap.d.ts +34 -34
- package/types/src/smo/xform/undo.d.ts +142 -142
- package/types/src/smo/xform/updateAudio.d.ts +9 -9
- package/types/src/styles/font_metrics/Commissioner-Medium-Metrics.d.ts +871 -871
- package/types/src/styles/font_metrics/ConcertOne-Regular.d.ts +871 -871
- package/types/src/styles/font_metrics/Merriweather-Regular.d.ts +871 -871
- package/types/src/styles/font_metrics/arial_metrics.d.ts +870 -870
- package/types/src/styles/font_metrics/ssp-sans-metrics.d.ts +871 -871
- package/types/src/styles/font_metrics/ssp-serif-metrics.d.ts +871 -871
- package/types/src/styles/font_metrics/times_metrics.d.ts +870 -870
- package/types/src/ui/buttons/button.d.ts +95 -95
- package/types/src/ui/buttons/collapsable.d.ts +42 -42
- package/types/src/ui/buttons/display.d.ts +23 -23
- package/types/src/ui/buttons/ribbon.d.ts +76 -76
- package/types/src/ui/common.d.ts +45 -45
- package/types/src/ui/composable/draggable.d.ts +12 -12
- package/types/src/ui/configuration.d.ts +31 -31
- package/types/src/ui/dialogs/adapter.d.ts +107 -107
- package/types/src/ui/dialogs/addMeasure.d.ts +20 -20
- package/types/src/ui/dialogs/arpeggio.d.ts +2 -2
- package/types/src/ui/dialogs/articulation.d.ts +2 -2
- package/types/src/ui/dialogs/audioSettings.d.ts +32 -32
- package/types/src/ui/dialogs/chordChange.d.ts +35 -35
- package/types/src/ui/dialogs/clefChange.d.ts +2 -2
- package/types/src/ui/dialogs/components/baseComponent.d.ts +158 -158
- package/types/src/ui/dialogs/components/button.d.ts +54 -54
- package/types/src/ui/dialogs/components/buttonArray.d.ts +101 -101
- package/types/src/ui/dialogs/components/checkdrop.d.ts +27 -27
- package/types/src/ui/dialogs/components/dragText.d.ts +27 -27
- package/types/src/ui/dialogs/components/dropdown.d.ts +78 -78
- package/types/src/ui/dialogs/components/fileDownload.d.ts +28 -28
- package/types/src/ui/dialogs/components/fontComponent.d.ts +32 -32
- package/types/src/ui/dialogs/components/noteText.d.ts +98 -98
- package/types/src/ui/dialogs/components/pitch.d.ts +95 -95
- package/types/src/ui/dialogs/components/rocker.d.ts +66 -66
- package/types/src/ui/dialogs/components/staffComponents.d.ts +77 -77
- package/types/src/ui/dialogs/components/textCheck.d.ts +38 -38
- package/types/src/ui/dialogs/components/textInPlace.d.ts +90 -90
- package/types/src/ui/dialogs/components/textInput.d.ts +58 -58
- package/types/src/ui/dialogs/components/tie.d.ts +41 -41
- package/types/src/ui/dialogs/components/toggle.d.ts +53 -53
- package/types/src/ui/dialogs/components/tree.d.ts +46 -46
- package/types/src/ui/dialogs/customTuplets.d.ts +25 -25
- package/types/src/ui/dialogs/dialog.d.ts +201 -201
- package/types/src/ui/dialogs/durations.d.ts +2 -2
- package/types/src/ui/dialogs/dynamics.d.ts +37 -37
- package/types/src/ui/dialogs/endings.d.ts +61 -61
- package/types/src/ui/dialogs/factory.d.ts +15 -15
- package/types/src/ui/dialogs/fileDialogs.d.ts +4 -4
- package/types/src/ui/dialogs/fonts.d.ts +2 -2
- package/types/src/ui/dialogs/globalLayout.d.ts +2 -2
- package/types/src/ui/dialogs/gracenote.d.ts +2 -2
- package/types/src/ui/dialogs/hairpin.d.ts +35 -35
- package/types/src/ui/dialogs/instrument.d.ts +3 -3
- package/types/src/ui/dialogs/keySignature.d.ts +33 -33
- package/types/src/ui/dialogs/library.d.ts +70 -70
- package/types/src/ui/dialogs/lyric.d.ts +39 -39
- package/types/src/ui/dialogs/measureFormat.d.ts +52 -52
- package/types/src/ui/dialogs/microtones.d.ts +2 -2
- package/types/src/ui/dialogs/noteHead.d.ts +2 -2
- package/types/src/ui/dialogs/ornament.d.ts +2 -2
- package/types/src/ui/dialogs/pageLayout.d.ts +2 -2
- package/types/src/ui/dialogs/partInfo.d.ts +2 -2
- package/types/src/ui/dialogs/pedalMarking.d.ts +35 -35
- package/types/src/ui/dialogs/pitch.d.ts +2 -2
- package/types/src/ui/dialogs/preferences.d.ts +2 -2
- package/types/src/ui/dialogs/scoreId.d.ts +2 -2
- package/types/src/ui/dialogs/scoreView.d.ts +2 -2
- package/types/src/ui/dialogs/slur.d.ts +57 -57
- package/types/src/ui/dialogs/staffGroup.d.ts +2 -2
- package/types/src/ui/dialogs/tabNote.d.ts +32 -32
- package/types/src/ui/dialogs/tabStave.d.ts +43 -43
- package/types/src/ui/dialogs/tempo.d.ts +50 -50
- package/types/src/ui/dialogs/textBlock.d.ts +61 -61
- package/types/src/ui/dialogs/textBracket.d.ts +35 -35
- package/types/src/ui/dialogs/tie.d.ts +41 -41
- package/types/src/ui/dialogs/timeSignature.d.ts +34 -34
- package/types/src/ui/dialogs/transposeScore.d.ts +2 -2
- package/types/src/ui/dialogs/volta.d.ts +40 -40
- package/types/src/ui/eventSource.d.ts +63 -63
- package/types/src/ui/exceptions.d.ts +12 -12
- package/types/src/ui/fileio/fileInput.d.ts +12 -12
- package/types/src/ui/fileio/library.d.ts +40 -40
- package/types/src/ui/fileio/xhrLoader.d.ts +18 -18
- package/types/src/ui/help.d.ts +22 -22
- package/types/src/ui/i18n/language.d.ts +37 -37
- package/types/src/ui/i18n/language_ar.d.ts +5 -5
- package/types/src/ui/i18n/language_de.d.ts +1 -1
- package/types/src/ui/i18n/language_en.d.ts +18 -18
- package/types/src/ui/i18n/translationEditor.d.ts +14 -14
- package/types/src/ui/keyBindings/default/editorKeys.d.ts +7 -7
- package/types/src/ui/keyBindings/default/trackerKeys.d.ts +7 -7
- package/types/src/ui/menus/beams.d.ts +13 -13
- package/types/src/ui/menus/edit.d.ts +8 -8
- package/types/src/ui/menus/file.d.ts +26 -26
- package/types/src/ui/menus/help.d.ts +8 -8
- package/types/src/ui/menus/keySignature.d.ts +13 -13
- package/types/src/ui/menus/language.d.ts +12 -12
- package/types/src/ui/menus/manager.d.ts +57 -57
- package/types/src/ui/menus/measure.d.ts +8 -8
- package/types/src/ui/menus/menu.d.ts +136 -136
- package/types/src/ui/menus/note.d.ts +8 -8
- package/types/src/ui/menus/partSelection.d.ts +19 -19
- package/types/src/ui/menus/parts.d.ts +50 -50
- package/types/src/ui/menus/score.d.ts +20 -20
- package/types/src/ui/menus/staffModifier.d.ts +21 -21
- package/types/src/ui/menus/text.d.ts +8 -8
- package/types/src/ui/menus/timeSignature.d.ts +12 -12
- package/types/src/ui/menus/tuplets.d.ts +13 -13
- package/types/src/ui/menus/voices.d.ts +8 -8
- package/types/src/ui/modalDialogs.d.ts +1 -1
- package/types/src/ui/navigation.d.ts +15 -15
- package/types/src/ui/qwerty.d.ts +41 -41
- package/types/src/ui/ribbonLayout/default/defaultRibbon.d.ts +15 -15
- package/types/src/ui/ribbonLayout/default/tabletRibbon.d.ts +22 -22
- package/types/typedoc.d.ts +158 -158
|
@@ -1,277 +1,277 @@
|
|
|
1
|
-
import { SmoScoreModifierBase, ScaledPageLayout } from './scoreModifiers';
|
|
2
|
-
import { SmoAttrs, SmoModifierBase, ElementLike } from './common';
|
|
3
|
-
import { SmoSelector } from '../xform/selections';
|
|
4
|
-
import { FontInfo } from '../../common/vex';
|
|
5
|
-
/**
|
|
6
|
-
* Parameters for a single text block. Text blocks make up a text group.
|
|
7
|
-
* @category SmoObject
|
|
8
|
-
*/
|
|
9
|
-
export interface SmoScoreTextParams {
|
|
10
|
-
/**
|
|
11
|
-
* x location of font
|
|
12
|
-
*/
|
|
13
|
-
x: number;
|
|
14
|
-
/**
|
|
15
|
-
* location of font
|
|
16
|
-
*/
|
|
17
|
-
y: number;
|
|
18
|
-
/**
|
|
19
|
-
* In currently supported text groups, width and height comes from the text bounding box
|
|
20
|
-
* and so isn't required.
|
|
21
|
-
*/
|
|
22
|
-
width: number;
|
|
23
|
-
/**
|
|
24
|
-
* In currently supported text groups, width and height comes from the text bounding box
|
|
25
|
-
* and so isn't required.
|
|
26
|
-
*/
|
|
27
|
-
height: number;
|
|
28
|
-
/**
|
|
29
|
-
* The text content
|
|
30
|
-
*/
|
|
31
|
-
text: string;
|
|
32
|
-
/**
|
|
33
|
-
* Font of the text
|
|
34
|
-
*/
|
|
35
|
-
fontInfo: FontInfo;
|
|
36
|
-
/**
|
|
37
|
-
* defaults to black
|
|
38
|
-
*/
|
|
39
|
-
fill?: string;
|
|
40
|
-
classes?: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* @category serialization
|
|
44
|
-
*/
|
|
45
|
-
export interface SmoScoreTextSer extends SmoScoreTextParams {
|
|
46
|
-
/**
|
|
47
|
-
* class name for deserialization
|
|
48
|
-
*/
|
|
49
|
-
ctor: string;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Identify some text in the score, not associated with any musical element, like page
|
|
53
|
-
* decorations, titles etc.
|
|
54
|
-
* Note: score text is always contained in a text group. So this isn't directly accessed
|
|
55
|
-
* by score, but we keep the collection in score for backwards-compatibility
|
|
56
|
-
* @category SmoObject
|
|
57
|
-
*/
|
|
58
|
-
export declare class SmoScoreText extends SmoScoreModifierBase {
|
|
59
|
-
static fontPointSize(size: string | number | undefined): number;
|
|
60
|
-
/**
|
|
61
|
-
* Convert a numeric or string weight into either 'bold' or 'normal'
|
|
62
|
-
* @param fontWeight
|
|
63
|
-
* @returns
|
|
64
|
-
*/
|
|
65
|
-
static weightString(fontWeight: string | number | undefined): string;
|
|
66
|
-
static familyString(fam: string | undefined): string;
|
|
67
|
-
static get fontFamilies(): Record<string, string>;
|
|
68
|
-
static get parameters(): string[];
|
|
69
|
-
static get defaults(): SmoScoreTextParams;
|
|
70
|
-
static deserialize(jsonObj: SmoScoreTextSer): SmoScoreText;
|
|
71
|
-
x: number;
|
|
72
|
-
y: number;
|
|
73
|
-
width: number;
|
|
74
|
-
height: number;
|
|
75
|
-
text: string;
|
|
76
|
-
fontInfo: FontInfo;
|
|
77
|
-
fill: string;
|
|
78
|
-
classes: string;
|
|
79
|
-
scaleX: number;
|
|
80
|
-
scaleY: number;
|
|
81
|
-
getText(): string;
|
|
82
|
-
estimateWidth(): number;
|
|
83
|
-
tryParseUnicode(): void;
|
|
84
|
-
offsetX(offset: number): void;
|
|
85
|
-
offsetY(offset: number): void;
|
|
86
|
-
serialize(): SmoScoreTextSer;
|
|
87
|
-
static get attributes(): string[];
|
|
88
|
-
static get simpleAttributes(): string[];
|
|
89
|
-
constructor(parameters: SmoScoreTextParams);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Each text block has the text data itself and some data about how it's placed
|
|
93
|
-
* @category SmoObject
|
|
94
|
-
*/
|
|
95
|
-
export interface SmoTextBlock {
|
|
96
|
-
/**
|
|
97
|
-
* The score text
|
|
98
|
-
*/
|
|
99
|
-
text: SmoScoreText;
|
|
100
|
-
/**
|
|
101
|
-
* position relative to other blocks
|
|
102
|
-
*/
|
|
103
|
-
position: number;
|
|
104
|
-
/**
|
|
105
|
-
* run-time flag
|
|
106
|
-
*/
|
|
107
|
-
activeText: boolean;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* @category SmoObject
|
|
111
|
-
*/
|
|
112
|
-
export interface SmoTextBlockSer {
|
|
113
|
-
/**
|
|
114
|
-
* The score text
|
|
115
|
-
*/
|
|
116
|
-
text: SmoScoreTextSer;
|
|
117
|
-
/**
|
|
118
|
-
* position relative to other blocks
|
|
119
|
-
*/
|
|
120
|
-
position: number;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Used to place text imported from other formats, e.g. music xml
|
|
124
|
-
* @category SmoObject
|
|
125
|
-
*/
|
|
126
|
-
export interface SmoTextPlacement {
|
|
127
|
-
fontFamily: string;
|
|
128
|
-
fontSize: number;
|
|
129
|
-
xPlacement: number;
|
|
130
|
-
yOffset: number;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Constructor parameters for a text group, a block of text in Smoosic
|
|
134
|
-
* @param justification one of {@link SmoTextGroup.justifications}
|
|
135
|
-
* @param relativePosition relative position to other text groups
|
|
136
|
-
* @param pagination indicates if this text is paginated (goes on each page)
|
|
137
|
-
* @param spacing distance between blocks
|
|
138
|
-
* @param attachToSelector acts like 'note text' if attached to a note, otherwise
|
|
139
|
-
* the position is based on score position, or page position if paginated
|
|
140
|
-
* @param selector if attached, the selector in question
|
|
141
|
-
* @param textBlocks the actual textBlocks of text - a score text along with a placement parameter
|
|
142
|
-
* @category SmoObject
|
|
143
|
-
*/
|
|
144
|
-
export interface SmoTextGroupParams {
|
|
145
|
-
justification: number;
|
|
146
|
-
relativePosition: number;
|
|
147
|
-
pagination: number;
|
|
148
|
-
purpose: number;
|
|
149
|
-
spacing: number;
|
|
150
|
-
musicXOffset: number;
|
|
151
|
-
musicYOffset: number;
|
|
152
|
-
attachToSelector: boolean;
|
|
153
|
-
selector: SmoSelector;
|
|
154
|
-
textBlocks: SmoTextBlock[];
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* The serializable parts of a text group.
|
|
158
|
-
* @category serialization
|
|
159
|
-
*/
|
|
160
|
-
export interface SmoTextGroupParamsSer {
|
|
161
|
-
/**
|
|
162
|
-
* class name for deserialization
|
|
163
|
-
*/
|
|
164
|
-
ctor: string;
|
|
165
|
-
/**
|
|
166
|
-
* ID so we can identify which text this is in dialogs, UI
|
|
167
|
-
*/
|
|
168
|
-
attrs: SmoAttrs;
|
|
169
|
-
/**
|
|
170
|
-
* justification within the block
|
|
171
|
-
*/
|
|
172
|
-
justification?: number;
|
|
173
|
-
/**
|
|
174
|
-
* position (above, left, right etc)
|
|
175
|
-
*/
|
|
176
|
-
relativePosition?: number;
|
|
177
|
-
/**
|
|
178
|
-
* pagination for headers, footers
|
|
179
|
-
*/
|
|
180
|
-
pagination?: number;
|
|
181
|
-
/**
|
|
182
|
-
* spacing between blocks, future
|
|
183
|
-
*/
|
|
184
|
-
spacing?: number;
|
|
185
|
-
/**
|
|
186
|
-
* true if the text is attached to a note.
|
|
187
|
-
*/
|
|
188
|
-
attachToSelector?: boolean;
|
|
189
|
-
/**
|
|
190
|
-
* defined if the selector is attached to a note
|
|
191
|
-
*/
|
|
192
|
-
selector?: SmoSelector;
|
|
193
|
-
/**
|
|
194
|
-
* the individual text blocks
|
|
195
|
-
*/
|
|
196
|
-
textBlocks: SmoTextBlockSer[];
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Suggestion for text purpose, maybe used to find a match..maybe not used at all
|
|
200
|
-
*/
|
|
201
|
-
export type SmoTextGroupPurpose = 'NONE' | 'TITLE' | 'SUBTITLE' | 'COMPOSER' | 'COPYRIGHT';
|
|
202
|
-
/**
|
|
203
|
-
* @category SmoObject
|
|
204
|
-
*/
|
|
205
|
-
export interface SmoTextGroupContainer {
|
|
206
|
-
updateTextGroup: (textGroup: SmoTextGroup, toAdd: boolean) => void;
|
|
207
|
-
addTextGroup: (textGroup: SmoTextGroup) => void;
|
|
208
|
-
removeTextGroup: (textGroup: SmoTextGroup) => void;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* A grouping of text that can be used as a block for
|
|
212
|
-
* justification, alignment etc.
|
|
213
|
-
* @category SmoObject
|
|
214
|
-
*/
|
|
215
|
-
export declare class SmoTextGroup extends SmoScoreModifierBase {
|
|
216
|
-
static get justifications(): {
|
|
217
|
-
LEFT: number;
|
|
218
|
-
RIGHT: number;
|
|
219
|
-
CENTER: number;
|
|
220
|
-
};
|
|
221
|
-
static get paginations(): {
|
|
222
|
-
EVERY: number;
|
|
223
|
-
EVENT: number;
|
|
224
|
-
ODD: number;
|
|
225
|
-
ONCE: number;
|
|
226
|
-
SUBSEQUENT: number;
|
|
227
|
-
};
|
|
228
|
-
static get relativePositions(): {
|
|
229
|
-
ABOVE: number;
|
|
230
|
-
BELOW: number;
|
|
231
|
-
LEFT: number;
|
|
232
|
-
RIGHT: number;
|
|
233
|
-
};
|
|
234
|
-
static get purposes(): Record<SmoTextGroupPurpose, number>;
|
|
235
|
-
static get attributes(): string[];
|
|
236
|
-
static get nonTextAttributes(): string[];
|
|
237
|
-
static get simpleAttributes(): string[];
|
|
238
|
-
static isTextGroup(modifier: SmoTextGroup | SmoModifierBase): modifier is SmoTextGroup;
|
|
239
|
-
static get purposeToFont(): Record<number | string, SmoTextPlacement>;
|
|
240
|
-
static createTextForLayout(purpose: number, text: string, layout: ScaledPageLayout): SmoTextGroup;
|
|
241
|
-
static get defaults(): SmoTextGroupParams;
|
|
242
|
-
justification: number;
|
|
243
|
-
relativePosition: number;
|
|
244
|
-
pagination: number;
|
|
245
|
-
purpose: number;
|
|
246
|
-
spacing: number;
|
|
247
|
-
attachToSelector: boolean;
|
|
248
|
-
selector?: SmoSelector;
|
|
249
|
-
musicXOffset: number;
|
|
250
|
-
musicYOffset: number;
|
|
251
|
-
elements: ElementLike[];
|
|
252
|
-
textBlocks: SmoTextBlock[];
|
|
253
|
-
edited: boolean;
|
|
254
|
-
skipRender: boolean;
|
|
255
|
-
static deserialize(jObj: SmoTextGroupParamsSer): SmoTextGroup;
|
|
256
|
-
static deserializePreserveId(jObj: any): SmoTextGroup;
|
|
257
|
-
static getPagedTextGroups(tg: SmoTextGroup, pages: number, pageHeight: number): SmoTextGroup[];
|
|
258
|
-
serialize(): SmoTextGroupParamsSer;
|
|
259
|
-
constructor(params: SmoTextGroupParams);
|
|
260
|
-
scaleText(scale: number): void;
|
|
261
|
-
tryParseUnicode(): void;
|
|
262
|
-
estimateWidth(): number;
|
|
263
|
-
isTextVisible(): boolean;
|
|
264
|
-
setActiveBlock(scoreText: SmoScoreText | null): void;
|
|
265
|
-
getActiveBlock(): SmoScoreText;
|
|
266
|
-
setRelativePosition(position: number): void;
|
|
267
|
-
firstBlock(): SmoScoreText;
|
|
268
|
-
indexOf(scoreText: SmoScoreText): number;
|
|
269
|
-
addScoreText(scoreText: SmoScoreText, position?: number): void;
|
|
270
|
-
ul(): {
|
|
271
|
-
x: number;
|
|
272
|
-
y: number;
|
|
273
|
-
};
|
|
274
|
-
removeBlock(scoreText: SmoScoreText): void;
|
|
275
|
-
offsetX(offset: number): void;
|
|
276
|
-
offsetY(offset: number): void;
|
|
277
|
-
}
|
|
1
|
+
import { SmoScoreModifierBase, ScaledPageLayout } from './scoreModifiers';
|
|
2
|
+
import { SmoAttrs, SmoModifierBase, ElementLike } from './common';
|
|
3
|
+
import { SmoSelector } from '../xform/selections';
|
|
4
|
+
import { FontInfo } from '../../common/vex';
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for a single text block. Text blocks make up a text group.
|
|
7
|
+
* @category SmoObject
|
|
8
|
+
*/
|
|
9
|
+
export interface SmoScoreTextParams {
|
|
10
|
+
/**
|
|
11
|
+
* x location of font
|
|
12
|
+
*/
|
|
13
|
+
x: number;
|
|
14
|
+
/**
|
|
15
|
+
* location of font
|
|
16
|
+
*/
|
|
17
|
+
y: number;
|
|
18
|
+
/**
|
|
19
|
+
* In currently supported text groups, width and height comes from the text bounding box
|
|
20
|
+
* and so isn't required.
|
|
21
|
+
*/
|
|
22
|
+
width: number;
|
|
23
|
+
/**
|
|
24
|
+
* In currently supported text groups, width and height comes from the text bounding box
|
|
25
|
+
* and so isn't required.
|
|
26
|
+
*/
|
|
27
|
+
height: number;
|
|
28
|
+
/**
|
|
29
|
+
* The text content
|
|
30
|
+
*/
|
|
31
|
+
text: string;
|
|
32
|
+
/**
|
|
33
|
+
* Font of the text
|
|
34
|
+
*/
|
|
35
|
+
fontInfo: FontInfo;
|
|
36
|
+
/**
|
|
37
|
+
* defaults to black
|
|
38
|
+
*/
|
|
39
|
+
fill?: string;
|
|
40
|
+
classes?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @category serialization
|
|
44
|
+
*/
|
|
45
|
+
export interface SmoScoreTextSer extends SmoScoreTextParams {
|
|
46
|
+
/**
|
|
47
|
+
* class name for deserialization
|
|
48
|
+
*/
|
|
49
|
+
ctor: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Identify some text in the score, not associated with any musical element, like page
|
|
53
|
+
* decorations, titles etc.
|
|
54
|
+
* Note: score text is always contained in a text group. So this isn't directly accessed
|
|
55
|
+
* by score, but we keep the collection in score for backwards-compatibility
|
|
56
|
+
* @category SmoObject
|
|
57
|
+
*/
|
|
58
|
+
export declare class SmoScoreText extends SmoScoreModifierBase {
|
|
59
|
+
static fontPointSize(size: string | number | undefined): number;
|
|
60
|
+
/**
|
|
61
|
+
* Convert a numeric or string weight into either 'bold' or 'normal'
|
|
62
|
+
* @param fontWeight
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
static weightString(fontWeight: string | number | undefined): string;
|
|
66
|
+
static familyString(fam: string | undefined): string;
|
|
67
|
+
static get fontFamilies(): Record<string, string>;
|
|
68
|
+
static get parameters(): string[];
|
|
69
|
+
static get defaults(): SmoScoreTextParams;
|
|
70
|
+
static deserialize(jsonObj: SmoScoreTextSer): SmoScoreText;
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
text: string;
|
|
76
|
+
fontInfo: FontInfo;
|
|
77
|
+
fill: string;
|
|
78
|
+
classes: string;
|
|
79
|
+
scaleX: number;
|
|
80
|
+
scaleY: number;
|
|
81
|
+
getText(): string;
|
|
82
|
+
estimateWidth(): number;
|
|
83
|
+
tryParseUnicode(): void;
|
|
84
|
+
offsetX(offset: number): void;
|
|
85
|
+
offsetY(offset: number): void;
|
|
86
|
+
serialize(): SmoScoreTextSer;
|
|
87
|
+
static get attributes(): string[];
|
|
88
|
+
static get simpleAttributes(): string[];
|
|
89
|
+
constructor(parameters: SmoScoreTextParams);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Each text block has the text data itself and some data about how it's placed
|
|
93
|
+
* @category SmoObject
|
|
94
|
+
*/
|
|
95
|
+
export interface SmoTextBlock {
|
|
96
|
+
/**
|
|
97
|
+
* The score text
|
|
98
|
+
*/
|
|
99
|
+
text: SmoScoreText;
|
|
100
|
+
/**
|
|
101
|
+
* position relative to other blocks
|
|
102
|
+
*/
|
|
103
|
+
position: number;
|
|
104
|
+
/**
|
|
105
|
+
* run-time flag
|
|
106
|
+
*/
|
|
107
|
+
activeText: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @category SmoObject
|
|
111
|
+
*/
|
|
112
|
+
export interface SmoTextBlockSer {
|
|
113
|
+
/**
|
|
114
|
+
* The score text
|
|
115
|
+
*/
|
|
116
|
+
text: SmoScoreTextSer;
|
|
117
|
+
/**
|
|
118
|
+
* position relative to other blocks
|
|
119
|
+
*/
|
|
120
|
+
position: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Used to place text imported from other formats, e.g. music xml
|
|
124
|
+
* @category SmoObject
|
|
125
|
+
*/
|
|
126
|
+
export interface SmoTextPlacement {
|
|
127
|
+
fontFamily: string;
|
|
128
|
+
fontSize: number;
|
|
129
|
+
xPlacement: number;
|
|
130
|
+
yOffset: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Constructor parameters for a text group, a block of text in Smoosic
|
|
134
|
+
* @param justification one of {@link SmoTextGroup.justifications}
|
|
135
|
+
* @param relativePosition relative position to other text groups
|
|
136
|
+
* @param pagination indicates if this text is paginated (goes on each page)
|
|
137
|
+
* @param spacing distance between blocks
|
|
138
|
+
* @param attachToSelector acts like 'note text' if attached to a note, otherwise
|
|
139
|
+
* the position is based on score position, or page position if paginated
|
|
140
|
+
* @param selector if attached, the selector in question
|
|
141
|
+
* @param textBlocks the actual textBlocks of text - a score text along with a placement parameter
|
|
142
|
+
* @category SmoObject
|
|
143
|
+
*/
|
|
144
|
+
export interface SmoTextGroupParams {
|
|
145
|
+
justification: number;
|
|
146
|
+
relativePosition: number;
|
|
147
|
+
pagination: number;
|
|
148
|
+
purpose: number;
|
|
149
|
+
spacing: number;
|
|
150
|
+
musicXOffset: number;
|
|
151
|
+
musicYOffset: number;
|
|
152
|
+
attachToSelector: boolean;
|
|
153
|
+
selector: SmoSelector;
|
|
154
|
+
textBlocks: SmoTextBlock[];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The serializable parts of a text group.
|
|
158
|
+
* @category serialization
|
|
159
|
+
*/
|
|
160
|
+
export interface SmoTextGroupParamsSer {
|
|
161
|
+
/**
|
|
162
|
+
* class name for deserialization
|
|
163
|
+
*/
|
|
164
|
+
ctor: string;
|
|
165
|
+
/**
|
|
166
|
+
* ID so we can identify which text this is in dialogs, UI
|
|
167
|
+
*/
|
|
168
|
+
attrs: SmoAttrs;
|
|
169
|
+
/**
|
|
170
|
+
* justification within the block
|
|
171
|
+
*/
|
|
172
|
+
justification?: number;
|
|
173
|
+
/**
|
|
174
|
+
* position (above, left, right etc)
|
|
175
|
+
*/
|
|
176
|
+
relativePosition?: number;
|
|
177
|
+
/**
|
|
178
|
+
* pagination for headers, footers
|
|
179
|
+
*/
|
|
180
|
+
pagination?: number;
|
|
181
|
+
/**
|
|
182
|
+
* spacing between blocks, future
|
|
183
|
+
*/
|
|
184
|
+
spacing?: number;
|
|
185
|
+
/**
|
|
186
|
+
* true if the text is attached to a note.
|
|
187
|
+
*/
|
|
188
|
+
attachToSelector?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* defined if the selector is attached to a note
|
|
191
|
+
*/
|
|
192
|
+
selector?: SmoSelector;
|
|
193
|
+
/**
|
|
194
|
+
* the individual text blocks
|
|
195
|
+
*/
|
|
196
|
+
textBlocks: SmoTextBlockSer[];
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Suggestion for text purpose, maybe used to find a match..maybe not used at all
|
|
200
|
+
*/
|
|
201
|
+
export type SmoTextGroupPurpose = 'NONE' | 'TITLE' | 'SUBTITLE' | 'COMPOSER' | 'COPYRIGHT';
|
|
202
|
+
/**
|
|
203
|
+
* @category SmoObject
|
|
204
|
+
*/
|
|
205
|
+
export interface SmoTextGroupContainer {
|
|
206
|
+
updateTextGroup: (textGroup: SmoTextGroup, toAdd: boolean) => void;
|
|
207
|
+
addTextGroup: (textGroup: SmoTextGroup) => void;
|
|
208
|
+
removeTextGroup: (textGroup: SmoTextGroup) => void;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* A grouping of text that can be used as a block for
|
|
212
|
+
* justification, alignment etc.
|
|
213
|
+
* @category SmoObject
|
|
214
|
+
*/
|
|
215
|
+
export declare class SmoTextGroup extends SmoScoreModifierBase {
|
|
216
|
+
static get justifications(): {
|
|
217
|
+
LEFT: number;
|
|
218
|
+
RIGHT: number;
|
|
219
|
+
CENTER: number;
|
|
220
|
+
};
|
|
221
|
+
static get paginations(): {
|
|
222
|
+
EVERY: number;
|
|
223
|
+
EVENT: number;
|
|
224
|
+
ODD: number;
|
|
225
|
+
ONCE: number;
|
|
226
|
+
SUBSEQUENT: number;
|
|
227
|
+
};
|
|
228
|
+
static get relativePositions(): {
|
|
229
|
+
ABOVE: number;
|
|
230
|
+
BELOW: number;
|
|
231
|
+
LEFT: number;
|
|
232
|
+
RIGHT: number;
|
|
233
|
+
};
|
|
234
|
+
static get purposes(): Record<SmoTextGroupPurpose, number>;
|
|
235
|
+
static get attributes(): string[];
|
|
236
|
+
static get nonTextAttributes(): string[];
|
|
237
|
+
static get simpleAttributes(): string[];
|
|
238
|
+
static isTextGroup(modifier: SmoTextGroup | SmoModifierBase): modifier is SmoTextGroup;
|
|
239
|
+
static get purposeToFont(): Record<number | string, SmoTextPlacement>;
|
|
240
|
+
static createTextForLayout(purpose: number, text: string, layout: ScaledPageLayout): SmoTextGroup;
|
|
241
|
+
static get defaults(): SmoTextGroupParams;
|
|
242
|
+
justification: number;
|
|
243
|
+
relativePosition: number;
|
|
244
|
+
pagination: number;
|
|
245
|
+
purpose: number;
|
|
246
|
+
spacing: number;
|
|
247
|
+
attachToSelector: boolean;
|
|
248
|
+
selector?: SmoSelector;
|
|
249
|
+
musicXOffset: number;
|
|
250
|
+
musicYOffset: number;
|
|
251
|
+
elements: ElementLike[];
|
|
252
|
+
textBlocks: SmoTextBlock[];
|
|
253
|
+
edited: boolean;
|
|
254
|
+
skipRender: boolean;
|
|
255
|
+
static deserialize(jObj: SmoTextGroupParamsSer): SmoTextGroup;
|
|
256
|
+
static deserializePreserveId(jObj: any): SmoTextGroup;
|
|
257
|
+
static getPagedTextGroups(tg: SmoTextGroup, pages: number, pageHeight: number): SmoTextGroup[];
|
|
258
|
+
serialize(): SmoTextGroupParamsSer;
|
|
259
|
+
constructor(params: SmoTextGroupParams);
|
|
260
|
+
scaleText(scale: number): void;
|
|
261
|
+
tryParseUnicode(): void;
|
|
262
|
+
estimateWidth(): number;
|
|
263
|
+
isTextVisible(): boolean;
|
|
264
|
+
setActiveBlock(scoreText: SmoScoreText | null): void;
|
|
265
|
+
getActiveBlock(): SmoScoreText;
|
|
266
|
+
setRelativePosition(position: number): void;
|
|
267
|
+
firstBlock(): SmoScoreText;
|
|
268
|
+
indexOf(scoreText: SmoScoreText): number;
|
|
269
|
+
addScoreText(scoreText: SmoScoreText, position?: number): void;
|
|
270
|
+
ul(): {
|
|
271
|
+
x: number;
|
|
272
|
+
y: number;
|
|
273
|
+
};
|
|
274
|
+
removeBlock(scoreText: SmoScoreText): void;
|
|
275
|
+
offsetX(offset: number): void;
|
|
276
|
+
offsetY(offset: number): void;
|
|
277
|
+
}
|