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.
Files changed (187) hide show
  1. package/build/smoosic.js +1 -1
  2. package/package.json +1 -1
  3. package/release/smoosic.js +1 -1
  4. package/src/application/exports.ts +1 -0
  5. package/types/src/application/application.d.ts +102 -102
  6. package/types/src/application/common.d.ts +74 -74
  7. package/types/src/application/configuration.d.ts +74 -74
  8. package/types/src/application/dom.d.ts +8 -8
  9. package/types/src/application/dynamicInit.d.ts +1 -1
  10. package/types/src/application/eventHandler.d.ts +78 -78
  11. package/types/src/application/exports.d.ts +494 -493
  12. package/types/src/application/generateVexTests.d.ts +10 -10
  13. package/types/src/application/keyCommands.d.ts +90 -90
  14. package/types/src/common/bootstrap.bundle.d.ts +1138 -1138
  15. package/types/src/common/htmlHelpers.d.ts +105 -105
  16. package/types/src/common/jszip.d.ts +2 -2
  17. package/types/src/common/midi-parser.d.ts +38 -38
  18. package/types/src/common/promiseHelpers.d.ts +30 -30
  19. package/types/src/common/serializationHelpers.d.ts +29 -29
  20. package/types/src/common/textformatter.d.ts +140 -140
  21. package/types/src/common/vex.d.ts +222 -222
  22. package/types/src/render/audio/musicCursor.d.ts +25 -25
  23. package/types/src/render/audio/oscillator.d.ts +98 -98
  24. package/types/src/render/audio/player.d.ts +141 -141
  25. package/types/src/render/audio/samples.d.ts +56 -56
  26. package/types/src/render/sui/configuration.d.ts +12 -12
  27. package/types/src/render/sui/formatter.d.ts +151 -151
  28. package/types/src/render/sui/layoutDebug.d.ts +43 -43
  29. package/types/src/render/sui/mapper.d.ts +116 -116
  30. package/types/src/render/sui/piano.d.ts +46 -46
  31. package/types/src/render/sui/renderState.d.ts +88 -88
  32. package/types/src/render/sui/scoreRender.d.ts +93 -93
  33. package/types/src/render/sui/scoreView.d.ts +267 -267
  34. package/types/src/render/sui/scoreViewOperations.d.ts +594 -594
  35. package/types/src/render/sui/scroller.d.ts +34 -34
  36. package/types/src/render/sui/svgHelpers.d.ts +85 -85
  37. package/types/src/render/sui/svgPageMap.d.ts +318 -318
  38. package/types/src/render/sui/textEdit.d.ts +310 -310
  39. package/types/src/render/sui/textRender.d.ts +189 -189
  40. package/types/src/render/sui/tracker.d.ts +90 -90
  41. package/types/src/render/vex/glyphDimensions.d.ts +23 -23
  42. package/types/src/render/vex/smoAdapter.d.ts +46 -46
  43. package/types/src/render/vex/toVex.d.ts +13 -13
  44. package/types/src/render/vex/vxMeasure.d.ts +95 -95
  45. package/types/src/render/vex/vxNote.d.ts +55 -55
  46. package/types/src/render/vex/vxSystem.d.ts +64 -64
  47. package/types/src/smo/data/common.d.ts +220 -220
  48. package/types/src/smo/data/measure.d.ts +510 -510
  49. package/types/src/smo/data/measureModifiers.d.ts +506 -506
  50. package/types/src/smo/data/music.d.ts +438 -438
  51. package/types/src/smo/data/note.d.ts +485 -485
  52. package/types/src/smo/data/noteModifiers.d.ts +590 -590
  53. package/types/src/smo/data/partInfo.d.ts +162 -162
  54. package/types/src/smo/data/score.d.ts +395 -395
  55. package/types/src/smo/data/scoreModifiers.d.ts +433 -433
  56. package/types/src/smo/data/scoreText.d.ts +277 -277
  57. package/types/src/smo/data/staffModifiers.d.ts +767 -767
  58. package/types/src/smo/data/systemStaff.d.ts +238 -238
  59. package/types/src/smo/data/tuplet.d.ts +146 -146
  60. package/types/src/smo/midi/midiToSmo.d.ts +198 -198
  61. package/types/src/smo/midi/smoToMidi.d.ts +23 -23
  62. package/types/src/smo/mxml/smoToXml.d.ts +165 -165
  63. package/types/src/smo/mxml/xmlHelpers.d.ts +140 -140
  64. package/types/src/smo/mxml/xmlState.d.ts +257 -257
  65. package/types/src/smo/mxml/xmlToSmo.d.ts +92 -92
  66. package/types/src/smo/xform/beamers.d.ts +46 -46
  67. package/types/src/smo/xform/copypaste.d.ts +99 -99
  68. package/types/src/smo/xform/operations.d.ts +127 -127
  69. package/types/src/smo/xform/roadmap.d.ts +70 -70
  70. package/types/src/smo/xform/selections.d.ts +153 -153
  71. package/types/src/smo/xform/tickDuration.d.ts +155 -155
  72. package/types/src/smo/xform/tickMap.d.ts +34 -34
  73. package/types/src/smo/xform/undo.d.ts +142 -142
  74. package/types/src/smo/xform/updateAudio.d.ts +9 -9
  75. package/types/src/styles/font_metrics/Commissioner-Medium-Metrics.d.ts +871 -871
  76. package/types/src/styles/font_metrics/ConcertOne-Regular.d.ts +871 -871
  77. package/types/src/styles/font_metrics/Merriweather-Regular.d.ts +871 -871
  78. package/types/src/styles/font_metrics/arial_metrics.d.ts +870 -870
  79. package/types/src/styles/font_metrics/ssp-sans-metrics.d.ts +871 -871
  80. package/types/src/styles/font_metrics/ssp-serif-metrics.d.ts +871 -871
  81. package/types/src/styles/font_metrics/times_metrics.d.ts +870 -870
  82. package/types/src/ui/buttons/button.d.ts +95 -95
  83. package/types/src/ui/buttons/collapsable.d.ts +42 -42
  84. package/types/src/ui/buttons/display.d.ts +23 -23
  85. package/types/src/ui/buttons/ribbon.d.ts +76 -76
  86. package/types/src/ui/common.d.ts +45 -45
  87. package/types/src/ui/composable/draggable.d.ts +12 -12
  88. package/types/src/ui/configuration.d.ts +31 -31
  89. package/types/src/ui/dialogs/adapter.d.ts +107 -107
  90. package/types/src/ui/dialogs/addMeasure.d.ts +20 -20
  91. package/types/src/ui/dialogs/arpeggio.d.ts +2 -2
  92. package/types/src/ui/dialogs/articulation.d.ts +2 -2
  93. package/types/src/ui/dialogs/audioSettings.d.ts +32 -32
  94. package/types/src/ui/dialogs/chordChange.d.ts +35 -35
  95. package/types/src/ui/dialogs/clefChange.d.ts +2 -2
  96. package/types/src/ui/dialogs/components/baseComponent.d.ts +158 -158
  97. package/types/src/ui/dialogs/components/button.d.ts +54 -54
  98. package/types/src/ui/dialogs/components/buttonArray.d.ts +101 -101
  99. package/types/src/ui/dialogs/components/checkdrop.d.ts +27 -27
  100. package/types/src/ui/dialogs/components/dragText.d.ts +27 -27
  101. package/types/src/ui/dialogs/components/dropdown.d.ts +78 -78
  102. package/types/src/ui/dialogs/components/fileDownload.d.ts +28 -28
  103. package/types/src/ui/dialogs/components/fontComponent.d.ts +32 -32
  104. package/types/src/ui/dialogs/components/noteText.d.ts +98 -98
  105. package/types/src/ui/dialogs/components/pitch.d.ts +95 -95
  106. package/types/src/ui/dialogs/components/rocker.d.ts +66 -66
  107. package/types/src/ui/dialogs/components/staffComponents.d.ts +77 -77
  108. package/types/src/ui/dialogs/components/textCheck.d.ts +38 -38
  109. package/types/src/ui/dialogs/components/textInPlace.d.ts +90 -90
  110. package/types/src/ui/dialogs/components/textInput.d.ts +58 -58
  111. package/types/src/ui/dialogs/components/tie.d.ts +41 -41
  112. package/types/src/ui/dialogs/components/toggle.d.ts +53 -53
  113. package/types/src/ui/dialogs/components/tree.d.ts +46 -46
  114. package/types/src/ui/dialogs/customTuplets.d.ts +25 -25
  115. package/types/src/ui/dialogs/dialog.d.ts +201 -201
  116. package/types/src/ui/dialogs/durations.d.ts +2 -2
  117. package/types/src/ui/dialogs/dynamics.d.ts +37 -37
  118. package/types/src/ui/dialogs/endings.d.ts +61 -61
  119. package/types/src/ui/dialogs/factory.d.ts +15 -15
  120. package/types/src/ui/dialogs/fileDialogs.d.ts +4 -4
  121. package/types/src/ui/dialogs/fonts.d.ts +2 -2
  122. package/types/src/ui/dialogs/globalLayout.d.ts +2 -2
  123. package/types/src/ui/dialogs/gracenote.d.ts +2 -2
  124. package/types/src/ui/dialogs/hairpin.d.ts +35 -35
  125. package/types/src/ui/dialogs/instrument.d.ts +3 -3
  126. package/types/src/ui/dialogs/keySignature.d.ts +33 -33
  127. package/types/src/ui/dialogs/library.d.ts +70 -70
  128. package/types/src/ui/dialogs/lyric.d.ts +39 -39
  129. package/types/src/ui/dialogs/measureFormat.d.ts +52 -52
  130. package/types/src/ui/dialogs/microtones.d.ts +2 -2
  131. package/types/src/ui/dialogs/noteHead.d.ts +2 -2
  132. package/types/src/ui/dialogs/ornament.d.ts +2 -2
  133. package/types/src/ui/dialogs/pageLayout.d.ts +2 -2
  134. package/types/src/ui/dialogs/partInfo.d.ts +2 -2
  135. package/types/src/ui/dialogs/pedalMarking.d.ts +35 -35
  136. package/types/src/ui/dialogs/pitch.d.ts +2 -2
  137. package/types/src/ui/dialogs/preferences.d.ts +2 -2
  138. package/types/src/ui/dialogs/scoreId.d.ts +2 -2
  139. package/types/src/ui/dialogs/scoreView.d.ts +2 -2
  140. package/types/src/ui/dialogs/slur.d.ts +57 -57
  141. package/types/src/ui/dialogs/staffGroup.d.ts +2 -2
  142. package/types/src/ui/dialogs/tabNote.d.ts +32 -32
  143. package/types/src/ui/dialogs/tabStave.d.ts +43 -43
  144. package/types/src/ui/dialogs/tempo.d.ts +50 -50
  145. package/types/src/ui/dialogs/textBlock.d.ts +61 -61
  146. package/types/src/ui/dialogs/textBracket.d.ts +35 -35
  147. package/types/src/ui/dialogs/tie.d.ts +41 -41
  148. package/types/src/ui/dialogs/timeSignature.d.ts +34 -34
  149. package/types/src/ui/dialogs/transposeScore.d.ts +2 -2
  150. package/types/src/ui/dialogs/volta.d.ts +40 -40
  151. package/types/src/ui/eventSource.d.ts +63 -63
  152. package/types/src/ui/exceptions.d.ts +12 -12
  153. package/types/src/ui/fileio/fileInput.d.ts +12 -12
  154. package/types/src/ui/fileio/library.d.ts +40 -40
  155. package/types/src/ui/fileio/xhrLoader.d.ts +18 -18
  156. package/types/src/ui/help.d.ts +22 -22
  157. package/types/src/ui/i18n/language.d.ts +37 -37
  158. package/types/src/ui/i18n/language_ar.d.ts +5 -5
  159. package/types/src/ui/i18n/language_de.d.ts +1 -1
  160. package/types/src/ui/i18n/language_en.d.ts +18 -18
  161. package/types/src/ui/i18n/translationEditor.d.ts +14 -14
  162. package/types/src/ui/keyBindings/default/editorKeys.d.ts +7 -7
  163. package/types/src/ui/keyBindings/default/trackerKeys.d.ts +7 -7
  164. package/types/src/ui/menus/beams.d.ts +13 -13
  165. package/types/src/ui/menus/edit.d.ts +8 -8
  166. package/types/src/ui/menus/file.d.ts +26 -26
  167. package/types/src/ui/menus/help.d.ts +8 -8
  168. package/types/src/ui/menus/keySignature.d.ts +13 -13
  169. package/types/src/ui/menus/language.d.ts +12 -12
  170. package/types/src/ui/menus/manager.d.ts +57 -57
  171. package/types/src/ui/menus/measure.d.ts +8 -8
  172. package/types/src/ui/menus/menu.d.ts +136 -136
  173. package/types/src/ui/menus/note.d.ts +8 -8
  174. package/types/src/ui/menus/partSelection.d.ts +19 -19
  175. package/types/src/ui/menus/parts.d.ts +50 -50
  176. package/types/src/ui/menus/score.d.ts +20 -20
  177. package/types/src/ui/menus/staffModifier.d.ts +21 -21
  178. package/types/src/ui/menus/text.d.ts +8 -8
  179. package/types/src/ui/menus/timeSignature.d.ts +12 -12
  180. package/types/src/ui/menus/tuplets.d.ts +13 -13
  181. package/types/src/ui/menus/voices.d.ts +8 -8
  182. package/types/src/ui/modalDialogs.d.ts +1 -1
  183. package/types/src/ui/navigation.d.ts +15 -15
  184. package/types/src/ui/qwerty.d.ts +41 -41
  185. package/types/src/ui/ribbonLayout/default/defaultRibbon.d.ts +15 -15
  186. package/types/src/ui/ribbonLayout/default/tabletRibbon.d.ts +22 -22
  187. package/types/typedoc.d.ts +158 -158
@@ -1,318 +1,318 @@
1
- import { StrokeInfo } from "./svgHelpers";
2
- import { SvgPoint, SvgBox, Renderable, ElementLike } from '../../smo/data/common';
3
- import { SmoGlobalLayout, SmoPageLayout } from '../../smo/data/scoreModifiers';
4
- import { SmoSelection } from '../../smo/xform/selections';
5
- import { ModifierTab } from '../../smo/xform/selections';
6
- import { Renderer, SVGContext } from '../../common/vex';
7
- /**
8
- * A selection map maps a sub-section of music (a measure, for instance) to a region
9
- * on the screen. SelectionMap can contain other SelectionMaps with
10
- * different 'T', for instance, notes in a measure, in a 'Russian Dolls' kind of model.
11
- * This allows us to search for elements in < O(n) time and avoid
12
- * expensive geometry operations.
13
- * @category SuiRender
14
- */
15
- export declare abstract class SelectionMap<T, K> {
16
- /**
17
- * Create a key from the selection (selector). e.g. (1,1)
18
- * @param selection
19
- */
20
- abstract createKey(selection: SmoSelection): K;
21
- /**
22
- * get a set of coordinates from this selection, if it has been rendered.
23
- * @param selection
24
- */
25
- abstract boxFromSelection(selection: SmoSelection): SvgBox;
26
- /**
27
- * Add the selection to our map, and possibly to our child map.
28
- * @param key
29
- * @param selection
30
- */
31
- abstract addKeyToMap(key: K, selection: SmoSelection): void;
32
- /**
33
- * find a collection of selection that match a bounding box, possibly by
34
- * recursing through our child SelectionMaps.
35
- * @param value
36
- * @param box
37
- * @param rv
38
- */
39
- abstract findValueInMap(value: T, box: SvgBox): SmoSelection[];
40
- /**
41
- * the outer bounding box of these selections
42
- */
43
- box: SvgBox;
44
- /**
45
- * map of key to child SelectionMaps or SmoSelections
46
- */
47
- systemMap: Map<K, T>;
48
- /**
49
- * Given a bounding box (or point), find all the musical elements contained
50
- * in that point
51
- * @param box
52
- * @returns SmoSelection[]
53
- */
54
- findArtifact(box: SvgBox): SmoSelection[];
55
- /**
56
- * Add a rendered element to the map, and update the bounding box
57
- * @param selection
58
- * @returns
59
- */
60
- addArtifact(selection: SmoSelection): void;
61
- }
62
- /**
63
- * logic to map a set of notes to a region on the screen, for searching
64
- * @category SuiRender
65
- */
66
- export declare class MappedNotes extends SelectionMap<SmoSelection, string> {
67
- createKey(selection: SmoSelection): string;
68
- boxFromSelection(selection: SmoSelection): SvgBox;
69
- addKeyToMap(key: string, selection: SmoSelection): void;
70
- findValueInMap(value: SmoSelection, box: SvgBox): SmoSelection[];
71
- }
72
- /**
73
- * Map of measures to a region on the page.
74
- * @category SuiRender
75
- */
76
- export declare class MappedMeasures extends SelectionMap<MappedNotes, string> {
77
- box: SvgBox;
78
- systemMap: Map<string, MappedNotes>;
79
- createKey(selection: SmoSelection): string;
80
- boxFromSelection(selection: SmoSelection): SvgBox;
81
- addKeyToMap(key: string, selection: SmoSelection): void;
82
- findValueInMap(value: MappedNotes, box: SvgBox): SmoSelection[];
83
- }
84
- /**
85
- * Map of the systems on a page. Each system has a unique line index
86
- * which is the hash
87
- * @category SuiRender
88
- */
89
- export declare class MappedSystems extends SelectionMap<MappedMeasures, number> {
90
- box: SvgBox;
91
- systemMap: Map<number, MappedMeasures>;
92
- createKey(selection: SmoSelection): number;
93
- boxFromSelection(selection: SmoSelection): SvgBox;
94
- addKeyToMap(selectionKey: number, selection: SmoSelection): void;
95
- findValueInMap(value: MappedMeasures, box: SvgBox): SmoSelection[];
96
- clearMeasure(selection: SmoSelection): void;
97
- }
98
- /**
99
- * Each page is a different SVG element, with its own offset within the DOM. This
100
- * makes partial updates faster. SvgPage keeps track of all musical elements in SelectionMaps.
101
- * staff and score modifiers are kept in seperate lists since they may span multiple
102
- * musical elements (e.g. slurs, text elements).
103
- * @category SuiRender
104
- */
105
- export declare class SvgPage {
106
- _renderer: Renderer;
107
- pageNumber: number;
108
- box: SvgBox;
109
- systemMap: MappedSystems;
110
- modifierYKeys: number[];
111
- modifierTabDivs: Record<number, ModifierTab[]>;
112
- static get defaultMap(): {
113
- box: SvgBox;
114
- systemMap: Map<any, any>;
115
- };
116
- /**
117
- * Modifiers are divided into `modifierDivs` vertical
118
- * rectangles for event lookup.
119
- */
120
- static get modifierDivs(): number;
121
- /**
122
- * This is the VextFlow renderer context (SVGContext)
123
- * @returns
124
- */
125
- getContext(): SVGContext;
126
- get divSize(): number;
127
- constructor(renderer: Renderer, pageNumber: number, box: SvgBox);
128
- /**
129
- * Given SVG y, return the div for modifiers
130
- * @param y
131
- * @returns
132
- */
133
- divIndex(y: number): number;
134
- /**
135
- * Remove all elements and modifiers in this page, for a redraw.
136
- */
137
- clearMap(): void;
138
- /**
139
- * Clear mapped objects associated with a measure, including any
140
- * modifiers that span that measure.
141
- * @param selection
142
- */
143
- clearMeasure(selection: SmoSelection): void;
144
- /**
145
- * add a modifier to the page, indexed by its rectangle
146
- * @param modifier
147
- */
148
- addModifierTab(modifier: ModifierTab): void;
149
- /**
150
- * Add a new selection to the page
151
- * @param selection
152
- */
153
- addArtifact(selection: SmoSelection): void;
154
- /**
155
- * Try to find a selection on this page, based on the mouse event
156
- * @param box
157
- * @returns
158
- */
159
- findArtifact(box: SvgBox): SmoSelection[];
160
- /**
161
- * Try to find a modifier on this page, based on the mouse event
162
- * @param box
163
- * @returns
164
- */
165
- findModifierTabs(box: SvgBox): ModifierTab[];
166
- clearModifiers(): void;
167
- /**
168
- * Measure the bounding box of an element. Return the box as if the top of the first page were 0,0.
169
- * Bounding boxes are stored in absolute coordinates from the top of the first page. When rendering
170
- * elements, we adjust the coordinates for hte local page.
171
- * @param element
172
- * @returns
173
- */
174
- offsetBbox(element: ElementLike): SvgBox;
175
- /**
176
- * Adjust the bounding box to local coordinates for this page.
177
- * @param box
178
- * @returns
179
- */
180
- offsetSvgBox(box: SvgBox): {
181
- x: number;
182
- y: number;
183
- width: number;
184
- height: number;
185
- };
186
- /**
187
- * Adjust the point to local coordinates for this page.
188
- * @param box
189
- * @returns
190
- */
191
- offsetSvgPoint(box: SvgPoint): {
192
- x: number;
193
- y: number;
194
- };
195
- get svg(): SVGSVGElement;
196
- }
197
- /**
198
- * A container for all the SVG elements, and methods to manage adding and finding elements. Each
199
- * page of the score has its own SVG element.
200
- * @category SuiRender
201
- */
202
- export declare class SvgPageMap {
203
- _layout: SmoGlobalLayout;
204
- _container: HTMLElement;
205
- _pageLayouts: SmoPageLayout[];
206
- vfRenderers: SvgPage[];
207
- static get strokes(): Record<string, StrokeInfo>;
208
- containerOffset: SvgPoint;
209
- /**
210
- *
211
- * @param layout - defines the page width/height and relative zoom common to all the pages
212
- * @param container - the parent DOM element that contains all the pages
213
- * @param pages - the layouts (margins, etc) for each pages.
214
- */
215
- constructor(layout: SmoGlobalLayout, container: HTMLElement, pages: SmoPageLayout[]);
216
- get container(): HTMLElement;
217
- /**
218
- * Update the offset of the music container DOM element, in client coordinates. This is used
219
- * when converting absolute screen coordinates (like from a mouse event) to SVG coordinates
220
- * @param scrollPoint
221
- */
222
- updateContainerOffset(scrollPoint: SvgPoint): void;
223
- get layout(): SmoGlobalLayout;
224
- get pageLayouts(): SmoPageLayout[];
225
- get zoomScale(): number;
226
- get renderScale(): number;
227
- get pageDivHeight(): number;
228
- get pageDivWidth(): number;
229
- get pageHeight(): number;
230
- get pageWidth(): number;
231
- get totalHeight(): number;
232
- /**
233
- * create/re-create all the page SVG elements
234
- */
235
- createRenderers(): void;
236
- addPage(): void;
237
- updateZoom(zoomScale: number): void;
238
- /**
239
- * Convert from screen/client event to SVG space. We assume the scroll offset is already added to `box`
240
- * @param box
241
- * @returns
242
- */
243
- clientToSvg(box: SvgBox): SvgBox;
244
- /**
245
- * Convert from SVG bounding box to screen coordinates
246
- * @param box
247
- * @returns
248
- */
249
- svgToClient(box: SvgBox): SvgBox;
250
- /**
251
- * Convert from SVG bounding box to screen coordinates
252
- * @param box
253
- * @returns
254
- */
255
- svgToClientNoOffset(box: SvgBox): SvgBox;
256
- /**
257
- * Find a selection from a mouse event
258
- * @param box - location of a mouse event or specific screen coordinates
259
- * @returns
260
- */
261
- findArtifact(logicalBox: SvgBox): {
262
- selections: SmoSelection[];
263
- page: SvgPage;
264
- };
265
- /**
266
- * Find any modifiers intersecting with `box`
267
- * @param box
268
- * @returns
269
- */
270
- findModifierTabs(logicalBox: SvgBox): ModifierTab[];
271
- /**
272
- * add a rendered page to the page map
273
- * @param selection
274
- * @returns
275
- */
276
- addArtifact(selection: SmoSelection): void;
277
- /**
278
- * add a rendered modifier to the page map
279
- * @param modifier
280
- */
281
- addModifierTab(modifier: ModifierTab): void;
282
- clearModifiersForPage(page: number): void;
283
- /**
284
- * The number of pages is changing, remove the last page
285
- * @returns
286
- */
287
- removePage(): void;
288
- /**
289
- * The score dimensions have changed, clear maps and recreate the pages.
290
- * @param layout
291
- * @param pageLayouts
292
- */
293
- updateLayout(layout: SmoGlobalLayout, pageLayouts: SmoPageLayout[]): void;
294
- /**
295
- * Return the page by index
296
- * @param page
297
- * @returns
298
- */
299
- getRendererForPage(page: number): SvgPage;
300
- /**
301
- * Return the SvgPage based on SVG point (conversion from client coordinates already done)
302
- * @param point
303
- * @returns
304
- */
305
- getRendererFromPoint(point: SvgPoint): SvgPage | null;
306
- /**
307
- * Return the SvgPage based on SVG point (conversion from client coordinates already done)
308
- * @param box
309
- * @returns
310
- */
311
- getRenderer(box: SvgBox | SvgPoint): SvgPage;
312
- /**
313
- * Return the page based on the coordinates of a modifier
314
- * @param modifier
315
- * @returns
316
- */
317
- getRendererFromModifier(modifier?: Renderable): SvgPage;
318
- }
1
+ import { StrokeInfo } from "./svgHelpers";
2
+ import { SvgPoint, SvgBox, Renderable, ElementLike } from '../../smo/data/common';
3
+ import { SmoGlobalLayout, SmoPageLayout } from '../../smo/data/scoreModifiers';
4
+ import { SmoSelection } from '../../smo/xform/selections';
5
+ import { ModifierTab } from '../../smo/xform/selections';
6
+ import { Renderer, SVGContext } from '../../common/vex';
7
+ /**
8
+ * A selection map maps a sub-section of music (a measure, for instance) to a region
9
+ * on the screen. SelectionMap can contain other SelectionMaps with
10
+ * different 'T', for instance, notes in a measure, in a 'Russian Dolls' kind of model.
11
+ * This allows us to search for elements in < O(n) time and avoid
12
+ * expensive geometry operations.
13
+ * @category SuiRender
14
+ */
15
+ export declare abstract class SelectionMap<T, K> {
16
+ /**
17
+ * Create a key from the selection (selector). e.g. (1,1)
18
+ * @param selection
19
+ */
20
+ abstract createKey(selection: SmoSelection): K;
21
+ /**
22
+ * get a set of coordinates from this selection, if it has been rendered.
23
+ * @param selection
24
+ */
25
+ abstract boxFromSelection(selection: SmoSelection): SvgBox;
26
+ /**
27
+ * Add the selection to our map, and possibly to our child map.
28
+ * @param key
29
+ * @param selection
30
+ */
31
+ abstract addKeyToMap(key: K, selection: SmoSelection): void;
32
+ /**
33
+ * find a collection of selection that match a bounding box, possibly by
34
+ * recursing through our child SelectionMaps.
35
+ * @param value
36
+ * @param box
37
+ * @param rv
38
+ */
39
+ abstract findValueInMap(value: T, box: SvgBox): SmoSelection[];
40
+ /**
41
+ * the outer bounding box of these selections
42
+ */
43
+ box: SvgBox;
44
+ /**
45
+ * map of key to child SelectionMaps or SmoSelections
46
+ */
47
+ systemMap: Map<K, T>;
48
+ /**
49
+ * Given a bounding box (or point), find all the musical elements contained
50
+ * in that point
51
+ * @param box
52
+ * @returns SmoSelection[]
53
+ */
54
+ findArtifact(box: SvgBox): SmoSelection[];
55
+ /**
56
+ * Add a rendered element to the map, and update the bounding box
57
+ * @param selection
58
+ * @returns
59
+ */
60
+ addArtifact(selection: SmoSelection): void;
61
+ }
62
+ /**
63
+ * logic to map a set of notes to a region on the screen, for searching
64
+ * @category SuiRender
65
+ */
66
+ export declare class MappedNotes extends SelectionMap<SmoSelection, string> {
67
+ createKey(selection: SmoSelection): string;
68
+ boxFromSelection(selection: SmoSelection): SvgBox;
69
+ addKeyToMap(key: string, selection: SmoSelection): void;
70
+ findValueInMap(value: SmoSelection, box: SvgBox): SmoSelection[];
71
+ }
72
+ /**
73
+ * Map of measures to a region on the page.
74
+ * @category SuiRender
75
+ */
76
+ export declare class MappedMeasures extends SelectionMap<MappedNotes, string> {
77
+ box: SvgBox;
78
+ systemMap: Map<string, MappedNotes>;
79
+ createKey(selection: SmoSelection): string;
80
+ boxFromSelection(selection: SmoSelection): SvgBox;
81
+ addKeyToMap(key: string, selection: SmoSelection): void;
82
+ findValueInMap(value: MappedNotes, box: SvgBox): SmoSelection[];
83
+ }
84
+ /**
85
+ * Map of the systems on a page. Each system has a unique line index
86
+ * which is the hash
87
+ * @category SuiRender
88
+ */
89
+ export declare class MappedSystems extends SelectionMap<MappedMeasures, number> {
90
+ box: SvgBox;
91
+ systemMap: Map<number, MappedMeasures>;
92
+ createKey(selection: SmoSelection): number;
93
+ boxFromSelection(selection: SmoSelection): SvgBox;
94
+ addKeyToMap(selectionKey: number, selection: SmoSelection): void;
95
+ findValueInMap(value: MappedMeasures, box: SvgBox): SmoSelection[];
96
+ clearMeasure(selection: SmoSelection): void;
97
+ }
98
+ /**
99
+ * Each page is a different SVG element, with its own offset within the DOM. This
100
+ * makes partial updates faster. SvgPage keeps track of all musical elements in SelectionMaps.
101
+ * staff and score modifiers are kept in seperate lists since they may span multiple
102
+ * musical elements (e.g. slurs, text elements).
103
+ * @category SuiRender
104
+ */
105
+ export declare class SvgPage {
106
+ _renderer: Renderer;
107
+ pageNumber: number;
108
+ box: SvgBox;
109
+ systemMap: MappedSystems;
110
+ modifierYKeys: number[];
111
+ modifierTabDivs: Record<number, ModifierTab[]>;
112
+ static get defaultMap(): {
113
+ box: SvgBox;
114
+ systemMap: Map<any, any>;
115
+ };
116
+ /**
117
+ * Modifiers are divided into `modifierDivs` vertical
118
+ * rectangles for event lookup.
119
+ */
120
+ static get modifierDivs(): number;
121
+ /**
122
+ * This is the VextFlow renderer context (SVGContext)
123
+ * @returns
124
+ */
125
+ getContext(): SVGContext;
126
+ get divSize(): number;
127
+ constructor(renderer: Renderer, pageNumber: number, box: SvgBox);
128
+ /**
129
+ * Given SVG y, return the div for modifiers
130
+ * @param y
131
+ * @returns
132
+ */
133
+ divIndex(y: number): number;
134
+ /**
135
+ * Remove all elements and modifiers in this page, for a redraw.
136
+ */
137
+ clearMap(): void;
138
+ /**
139
+ * Clear mapped objects associated with a measure, including any
140
+ * modifiers that span that measure.
141
+ * @param selection
142
+ */
143
+ clearMeasure(selection: SmoSelection): void;
144
+ /**
145
+ * add a modifier to the page, indexed by its rectangle
146
+ * @param modifier
147
+ */
148
+ addModifierTab(modifier: ModifierTab): void;
149
+ /**
150
+ * Add a new selection to the page
151
+ * @param selection
152
+ */
153
+ addArtifact(selection: SmoSelection): void;
154
+ /**
155
+ * Try to find a selection on this page, based on the mouse event
156
+ * @param box
157
+ * @returns
158
+ */
159
+ findArtifact(box: SvgBox): SmoSelection[];
160
+ /**
161
+ * Try to find a modifier on this page, based on the mouse event
162
+ * @param box
163
+ * @returns
164
+ */
165
+ findModifierTabs(box: SvgBox): ModifierTab[];
166
+ clearModifiers(): void;
167
+ /**
168
+ * Measure the bounding box of an element. Return the box as if the top of the first page were 0,0.
169
+ * Bounding boxes are stored in absolute coordinates from the top of the first page. When rendering
170
+ * elements, we adjust the coordinates for hte local page.
171
+ * @param element
172
+ * @returns
173
+ */
174
+ offsetBbox(element: ElementLike): SvgBox;
175
+ /**
176
+ * Adjust the bounding box to local coordinates for this page.
177
+ * @param box
178
+ * @returns
179
+ */
180
+ offsetSvgBox(box: SvgBox): {
181
+ x: number;
182
+ y: number;
183
+ width: number;
184
+ height: number;
185
+ };
186
+ /**
187
+ * Adjust the point to local coordinates for this page.
188
+ * @param box
189
+ * @returns
190
+ */
191
+ offsetSvgPoint(box: SvgPoint): {
192
+ x: number;
193
+ y: number;
194
+ };
195
+ get svg(): SVGSVGElement;
196
+ }
197
+ /**
198
+ * A container for all the SVG elements, and methods to manage adding and finding elements. Each
199
+ * page of the score has its own SVG element.
200
+ * @category SuiRender
201
+ */
202
+ export declare class SvgPageMap {
203
+ _layout: SmoGlobalLayout;
204
+ _container: HTMLElement;
205
+ _pageLayouts: SmoPageLayout[];
206
+ vfRenderers: SvgPage[];
207
+ static get strokes(): Record<string, StrokeInfo>;
208
+ containerOffset: SvgPoint;
209
+ /**
210
+ *
211
+ * @param layout - defines the page width/height and relative zoom common to all the pages
212
+ * @param container - the parent DOM element that contains all the pages
213
+ * @param pages - the layouts (margins, etc) for each pages.
214
+ */
215
+ constructor(layout: SmoGlobalLayout, container: HTMLElement, pages: SmoPageLayout[]);
216
+ get container(): HTMLElement;
217
+ /**
218
+ * Update the offset of the music container DOM element, in client coordinates. This is used
219
+ * when converting absolute screen coordinates (like from a mouse event) to SVG coordinates
220
+ * @param scrollPoint
221
+ */
222
+ updateContainerOffset(scrollPoint: SvgPoint): void;
223
+ get layout(): SmoGlobalLayout;
224
+ get pageLayouts(): SmoPageLayout[];
225
+ get zoomScale(): number;
226
+ get renderScale(): number;
227
+ get pageDivHeight(): number;
228
+ get pageDivWidth(): number;
229
+ get pageHeight(): number;
230
+ get pageWidth(): number;
231
+ get totalHeight(): number;
232
+ /**
233
+ * create/re-create all the page SVG elements
234
+ */
235
+ createRenderers(): void;
236
+ addPage(): void;
237
+ updateZoom(zoomScale: number): void;
238
+ /**
239
+ * Convert from screen/client event to SVG space. We assume the scroll offset is already added to `box`
240
+ * @param box
241
+ * @returns
242
+ */
243
+ clientToSvg(box: SvgBox): SvgBox;
244
+ /**
245
+ * Convert from SVG bounding box to screen coordinates
246
+ * @param box
247
+ * @returns
248
+ */
249
+ svgToClient(box: SvgBox): SvgBox;
250
+ /**
251
+ * Convert from SVG bounding box to screen coordinates
252
+ * @param box
253
+ * @returns
254
+ */
255
+ svgToClientNoOffset(box: SvgBox): SvgBox;
256
+ /**
257
+ * Find a selection from a mouse event
258
+ * @param box - location of a mouse event or specific screen coordinates
259
+ * @returns
260
+ */
261
+ findArtifact(logicalBox: SvgBox): {
262
+ selections: SmoSelection[];
263
+ page: SvgPage;
264
+ };
265
+ /**
266
+ * Find any modifiers intersecting with `box`
267
+ * @param box
268
+ * @returns
269
+ */
270
+ findModifierTabs(logicalBox: SvgBox): ModifierTab[];
271
+ /**
272
+ * add a rendered page to the page map
273
+ * @param selection
274
+ * @returns
275
+ */
276
+ addArtifact(selection: SmoSelection): void;
277
+ /**
278
+ * add a rendered modifier to the page map
279
+ * @param modifier
280
+ */
281
+ addModifierTab(modifier: ModifierTab): void;
282
+ clearModifiersForPage(page: number): void;
283
+ /**
284
+ * The number of pages is changing, remove the last page
285
+ * @returns
286
+ */
287
+ removePage(): void;
288
+ /**
289
+ * The score dimensions have changed, clear maps and recreate the pages.
290
+ * @param layout
291
+ * @param pageLayouts
292
+ */
293
+ updateLayout(layout: SmoGlobalLayout, pageLayouts: SmoPageLayout[]): void;
294
+ /**
295
+ * Return the page by index
296
+ * @param page
297
+ * @returns
298
+ */
299
+ getRendererForPage(page: number): SvgPage;
300
+ /**
301
+ * Return the SvgPage based on SVG point (conversion from client coordinates already done)
302
+ * @param point
303
+ * @returns
304
+ */
305
+ getRendererFromPoint(point: SvgPoint): SvgPage | null;
306
+ /**
307
+ * Return the SvgPage based on SVG point (conversion from client coordinates already done)
308
+ * @param box
309
+ * @returns
310
+ */
311
+ getRenderer(box: SvgBox | SvgPoint): SvgPage;
312
+ /**
313
+ * Return the page based on the coordinates of a modifier
314
+ * @param modifier
315
+ * @returns
316
+ */
317
+ getRendererFromModifier(modifier?: Renderable): SvgPage;
318
+ }