score-viewer 1.0.45 → 1.0.47

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.
@@ -2,7 +2,11 @@ import { Context as Context_2 } from 'react';
2
2
  import { ForwardRefExoticComponent } from 'react';
3
3
  import { JSX } from 'react/jsx-runtime';
4
4
  import { RefAttributes } from 'react';
5
- import { StoreApi } from 'zustand';
5
+
6
+ declare type Action = {
7
+ type: string;
8
+ config: LoadConfig | LoadAutoScrollConfig | RenderConfig | RenderAutoScrollConfig;
9
+ };
6
10
 
7
11
  declare interface Annotation {
8
12
  id: string;
@@ -56,6 +60,22 @@ declare class FetchError extends Error {
56
60
  constructor(type: string, message: string);
57
61
  }
58
62
 
63
+ declare type LoadAutoScrollConfig = {
64
+ height: number;
65
+ meiStr: string;
66
+ transposition: string | null;
67
+ };
68
+
69
+ declare type LoadConfig = {
70
+ scoreUrl: string;
71
+ postLoadTransition?: Transition | undefined;
72
+ meiStr: string;
73
+ page?: number | undefined;
74
+ scale: number;
75
+ transposition: string | null;
76
+ restorePositionForAchor?: string | undefined;
77
+ };
78
+
59
79
  export declare type LyricItem = {
60
80
  title: string;
61
81
  text: string | FetchError;
@@ -68,18 +88,38 @@ declare interface Option_2 {
68
88
  contentDescription: string | undefined;
69
89
  }
70
90
 
71
- export declare type Reconstruction = {
72
- staff: string;
73
- voiceName: string;
74
- reconstructionsForVoice: ReconstructionItem[];
91
+ declare enum PlayingState {
92
+ PLAYING = 0,
93
+ PAUSED = 1,
94
+ STOPPED = 2
95
+ }
96
+
97
+ declare type RenderAutoScrollConfig = {
98
+ height: number;
75
99
  };
76
100
 
77
- declare type ReconstructionItem = {
78
- voice: string;
79
- label: string;
80
- reconstructionBy: string;
101
+ declare type RenderConfig = {
102
+ scoreUrl: string;
103
+ loadedWidth: number;
104
+ loadedHeight: number;
105
+ transition?: Transition | undefined;
106
+ renderPage: number;
107
+ loadedPagesCount: number;
108
+ scale: number;
81
109
  };
82
110
 
111
+ declare interface RenderedData {
112
+ id: string;
113
+ scoreUrl: string;
114
+ scale: number;
115
+ page: number;
116
+ timemap: TimeMapEvent[];
117
+ anchorElement: string | null;
118
+ width?: number;
119
+ height?: number;
120
+ svgHTML?: string;
121
+ }
122
+
83
123
  export declare type Score = {
84
124
  url: string;
85
125
  title: string;
@@ -98,7 +138,6 @@ export declare type ScoreProperties = {
98
138
  composer: string;
99
139
  lyricist: string;
100
140
  editor: string;
101
- reconstructions: Reconstruction[];
102
141
  reconstructionBy: string | null;
103
142
  sections: {
104
143
  label: string;
@@ -152,7 +191,6 @@ export declare interface ScoreViewerConfigSettings {
152
191
  showTextSection: boolean;
153
192
  showFacsimileSection: boolean;
154
193
  showOptions: boolean;
155
- showMusicAnalysisByDefault: boolean;
156
194
  renderTitlesFromMEI: boolean;
157
195
  backgroundColor?: string | undefined;
158
196
  basePath: string;
@@ -175,9 +213,109 @@ export declare interface ScoreViewerRef {
175
213
  selectScore: (scoreIndex: number | null) => void;
176
214
  }
177
215
 
216
+ declare class ScoreViewerStoreApi {
217
+ use: {
218
+ queuedAction: () => Action | null;
219
+ setQueuedAction: () => (action: Action | null) => void;
220
+ pendingAction: () => Action | null;
221
+ setPendingAction: () => (action: Action | null) => void;
222
+ score: () => Score | null;
223
+ showingMei: () => string | null;
224
+ scoreCache: () => {
225
+ [index: string]: Score;
226
+ };
227
+ textCache: () => TextPartsCache;
228
+ textComments: () => string | FetchError | null | undefined;
229
+ textIntroduction: () => string | FetchError | null | undefined;
230
+ textLyrics: () => LyricItem[] | null | undefined;
231
+ setScore: () => (score: Score | null) => void;
232
+ setShowingMei: () => (mei: string | null) => void;
233
+ setScoreCache: () => (scoreCache: {
234
+ [index: string]: Score;
235
+ }) => void;
236
+ setTextCache: () => (textCache: TextPartsCache, replace: boolean) => void;
237
+ setTextComments: () => (textComments: string | FetchError | null | undefined) => void;
238
+ setTextIntroduction: () => (textIntroduction: string | FetchError | null | undefined) => void;
239
+ setTextLyrics: () => (textLyrics: LyricItem[] | null | undefined, replace: boolean) => void;
240
+ isLoading: () => boolean;
241
+ scoreSvg: () => string | null;
242
+ scale: () => number;
243
+ reachedEffectiveMaxScale: () => boolean;
244
+ isSplitView: () => boolean;
245
+ activeSplitView: () => string;
246
+ splitViewOrientation: () => "horizontal" | "vertical";
247
+ activeTab: () => string;
248
+ setIsLoading: () => (isLoading: boolean) => void;
249
+ setScoreSvg: () => (svg: string | null) => void;
250
+ setScale: () => (scale: number) => void;
251
+ increaseScale: () => () => void;
252
+ decreaseScale: () => () => void;
253
+ setReachedEffectiveMaxScale: () => (value: boolean) => void;
254
+ setIsSplitView: () => (splitView: boolean) => void;
255
+ setSplitViewOrientation: () => (orientation: "horizontal" | "vertical") => void;
256
+ setActiveTab: () => (tab: string) => void;
257
+ setActiveSplitView: () => (view: string) => void;
258
+ resetUILayout: () => () => void;
259
+ pageCount: () => number;
260
+ currentPage: () => number;
261
+ sectionPageMap: () => Record<string, number>;
262
+ setScoreLayout: () => (layout: {
263
+ pageCount: number;
264
+ sectionPageMap: Record<string, number>;
265
+ currentPage: number;
266
+ }) => void;
267
+ goToPage: () => (page: number) => void;
268
+ goToNextPage: () => () => void;
269
+ goToPreviousPage: () => () => void;
270
+ goToSection: () => (sectionId: string) => void;
271
+ navigationCommand: () => {
272
+ type: "section" | "page";
273
+ target: string | number;
274
+ } | null;
275
+ clearNavigationCommand: () => () => void;
276
+ playingState: () => PlayingState;
277
+ playingPosition: () => number;
278
+ seekPosition: () => number;
279
+ autoScroll: () => boolean;
280
+ setPlayingState: () => (state: PlayingState) => void;
281
+ setPlayingPosition: () => (position: number) => void;
282
+ setSeekPosition: () => (position: number) => void;
283
+ setAutoScroll: () => (autoScroll: boolean) => void;
284
+ resetPlayerPosition: () => () => void;
285
+ showNVerses: () => number;
286
+ showEditorial: () => boolean;
287
+ showOriginalClefs: () => boolean;
288
+ normalizeFicta: () => boolean;
289
+ showingEditorial: () => string | null;
290
+ appOptions: () => string[];
291
+ choiceOptions: () => string[];
292
+ withoutTransposition: () => boolean;
293
+ showMusicAnalysis: () => boolean;
294
+ measureNumberInterval: () => number;
295
+ showColoredNotes: () => boolean;
296
+ setShowNVerses: () => (n: number) => void;
297
+ setShowEditorial: () => (showEditorial: boolean) => void;
298
+ setShowOriginalClefs: () => (showOriginalClefs: boolean) => void;
299
+ setNormalizeFicta: () => (normalizeFicta: boolean) => void;
300
+ setShowingEditorial: () => (editorial: string | null) => void;
301
+ setAppOptions: () => (options: string[], replace: boolean) => void;
302
+ setChoiceOptions: () => (options: string[], replace: boolean) => void;
303
+ setWithoutTransposition: () => (withoutTransposition: boolean) => void;
304
+ setShowMusicAnalysis: () => (showMusicAnalysis: boolean) => void;
305
+ setMeasureNumberInterval: () => (interval: number) => void;
306
+ setShowColoredNotes: () => (showColoredNotes: boolean) => void;
307
+ resetScoreSettings: () => () => void;
308
+ renderedSvgData: () => RenderedData | null;
309
+ setRenderedSvgData: () => (data: RenderedData) => void;
310
+ pageCache: () => Map<number, RenderedData>;
311
+ setCachedPage: () => (page: number, data: RenderedData) => void;
312
+ getCachedPage: () => (page: number) => RenderedData | null;
313
+ clearPageCache: () => () => void;
314
+ };
315
+ }
316
+
178
317
  declare interface ScoreViewProps {
179
318
  backgroundColor?: string | undefined;
180
- showMusicAnalysisByDefault: boolean;
181
319
  }
182
320
 
183
321
  declare type Sources = {
@@ -192,6 +330,25 @@ export declare type TextParts = {
192
330
  introduction: string | null;
193
331
  };
194
332
 
333
+ declare type TextPartsCache = {
334
+ [url: string]: string | FetchError | null;
335
+ };
336
+
337
+ declare type TimeMapEvent = {
338
+ on?: string[] | undefined;
339
+ off?: string[] | undefined;
340
+ measureOn?: string | undefined;
341
+ qstamp: number;
342
+ tstamp: number;
343
+ tempo?: number | undefined;
344
+ stavesOn?: string[] | undefined;
345
+ };
346
+
347
+ declare enum Transition {
348
+ FADE_OUT = 0,
349
+ FADE_IN = 1
350
+ }
351
+
195
352
  declare type Transposition = "" | "P4" | "+P4" | "-P4" | "M3" | "+M3" | "-M3" | "P8" | "+P8" | "-P8";
196
353
 
197
354
  export declare function useScoreManager({ t, config, normalizeFicta, onScoreAnalyzed, onFetchScoreError }: UseScoreManagerProps): {
@@ -209,7 +366,7 @@ declare interface UseScoreManagerProps {
209
366
  onFetchScoreError?: ((url: string, error: Error) => void) | undefined;
210
367
  }
211
368
 
212
- export declare const useStore: StoreApi;
369
+ export declare const useStore: ScoreViewerStoreApi;
213
370
 
214
371
  export declare function useTextParts({ config, }: UseTextPartsProps): {
215
372
  fetchTextParts: (scoreIndex: number) => void;
@@ -224,9 +381,6 @@ declare interface UseTextPartsProps {
224
381
 
225
382
  export declare type VisualizationOptions = {
226
383
  showOriginalClefs?: boolean | null | undefined;
227
- showReconstructions?: {
228
- [staff: string]: string;
229
- } | undefined;
230
384
  };
231
385
 
232
386
  export { }
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "./style.css": "./dist/style.css"
14
14
  },
15
15
  "private": false,
16
- "version": "1.0.45",
16
+ "version": "1.0.47",
17
17
  "type": "module",
18
18
  "files": [
19
19
  "dist"