vexflow-native 1.4.0 → 1.6.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.
Files changed (63) hide show
  1. package/README.md +4 -0
  2. package/lib/module/base/FontManager.js +0 -0
  3. package/lib/module/base/FontManager.js.map +1 -1
  4. package/lib/module/base/VexflowRecordingIndex.js +13 -0
  5. package/lib/module/base/VexflowRecordingIndex.js.map +1 -0
  6. package/lib/module/base/VexflowRecordingReplay.js +58 -15
  7. package/lib/module/base/VexflowRecordingReplay.js.map +1 -1
  8. package/lib/module/base/index.js +2 -0
  9. package/lib/module/base/index.js.map +1 -1
  10. package/lib/module/renderer/ScoreRenderer/ScoreOverlayPicture.js +81 -0
  11. package/lib/module/renderer/ScoreRenderer/ScoreOverlayPicture.js.map +1 -0
  12. package/lib/module/renderer/ScoreRenderer/ScoreRenderer.js +36 -152
  13. package/lib/module/renderer/ScoreRenderer/ScoreRenderer.js.map +1 -1
  14. package/lib/module/renderer/ScoreRenderer/index.js +2 -1
  15. package/lib/module/renderer/ScoreRenderer/index.js.map +1 -1
  16. package/lib/module/renderer/ScoreRenderer/utils.js +207 -0
  17. package/lib/module/renderer/ScoreRenderer/utils.js.map +1 -0
  18. package/lib/module/renderer/index.js +1 -0
  19. package/lib/module/renderer/index.js.map +1 -1
  20. package/lib/module/renderer/useScoreRecording.js +9 -7
  21. package/lib/module/renderer/useScoreRecording.js.map +1 -1
  22. package/lib/module/shared/debug.js +24 -0
  23. package/lib/module/shared/debug.js.map +1 -0
  24. package/lib/typescript/src/base/FontManager.d.ts +3 -0
  25. package/lib/typescript/src/base/FontManager.d.ts.map +1 -1
  26. package/lib/typescript/src/base/VexflowRecordingIndex.d.ts +4 -0
  27. package/lib/typescript/src/base/VexflowRecordingIndex.d.ts.map +1 -0
  28. package/lib/typescript/src/base/VexflowRecordingReplay.d.ts +8 -1
  29. package/lib/typescript/src/base/VexflowRecordingReplay.d.ts.map +1 -1
  30. package/lib/typescript/src/base/index.d.ts +2 -0
  31. package/lib/typescript/src/base/index.d.ts.map +1 -1
  32. package/lib/typescript/src/renderer/ScoreRenderer/ScoreOverlayPicture.d.ts +11 -0
  33. package/lib/typescript/src/renderer/ScoreRenderer/ScoreOverlayPicture.d.ts.map +1 -0
  34. package/lib/typescript/src/renderer/ScoreRenderer/ScoreRenderer.d.ts +1 -17
  35. package/lib/typescript/src/renderer/ScoreRenderer/ScoreRenderer.d.ts.map +1 -1
  36. package/lib/typescript/src/renderer/ScoreRenderer/index.d.ts +2 -1
  37. package/lib/typescript/src/renderer/ScoreRenderer/index.d.ts.map +1 -1
  38. package/lib/typescript/src/renderer/ScoreRenderer/types.d.ts +34 -1
  39. package/lib/typescript/src/renderer/ScoreRenderer/types.d.ts.map +1 -1
  40. package/lib/typescript/src/renderer/ScoreRenderer/utils.d.ts +40 -0
  41. package/lib/typescript/src/renderer/ScoreRenderer/utils.d.ts.map +1 -0
  42. package/lib/typescript/src/renderer/index.d.ts +1 -0
  43. package/lib/typescript/src/renderer/index.d.ts.map +1 -1
  44. package/lib/typescript/src/renderer/types.d.ts +1 -0
  45. package/lib/typescript/src/renderer/types.d.ts.map +1 -1
  46. package/lib/typescript/src/renderer/useScoreRecording.d.ts +6 -0
  47. package/lib/typescript/src/renderer/useScoreRecording.d.ts.map +1 -1
  48. package/lib/typescript/src/shared/debug.d.ts +3 -0
  49. package/lib/typescript/src/shared/debug.d.ts.map +1 -0
  50. package/package.json +1 -1
  51. package/src/base/FontManager.ts +0 -0
  52. package/src/base/VexflowRecordingIndex.ts +21 -0
  53. package/src/base/VexflowRecordingReplay.ts +103 -19
  54. package/src/base/index.ts +9 -0
  55. package/src/renderer/ScoreRenderer/ScoreOverlayPicture.tsx +118 -0
  56. package/src/renderer/ScoreRenderer/ScoreRenderer.tsx +61 -207
  57. package/src/renderer/ScoreRenderer/index.ts +2 -1
  58. package/src/renderer/ScoreRenderer/types.ts +47 -1
  59. package/src/renderer/ScoreRenderer/utils.ts +285 -0
  60. package/src/renderer/index.ts +5 -0
  61. package/src/renderer/types.ts +1 -0
  62. package/src/renderer/useScoreRecording.ts +18 -9
  63. package/src/shared/debug.ts +27 -0
package/README.md CHANGED
@@ -349,6 +349,10 @@ export function DirectVexFlow() {
349
349
  - `onItemsLayout`: optional callback fired after each recording pass with the
350
350
  view-space geometry (at scroll offset 0) of rendered items and measures,
351
351
  including each measure's system band `y`/`height`.
352
+ - `onReady`: optional callback fired once per mount, when the first score
353
+ picture has been rasterized for a non-empty viewport. Later re-records
354
+ (resize, option changes) do not re-fire it — the seam for hiding a loading
355
+ indicator once the score is actually on screen.
352
356
 
353
357
  ## Contributing
354
358
 
Binary file
@@ -1 +1 @@
1
- {"version":3,"names":["FontWeight","FontSlant","FontWidth","Skia","PT_TO_PX","parseSize","size","match","trim","value","parseFloat","unit","parseWeight","weight","weightStr","String","toLowerCase","Normal","Bold","Thin","ExtraLight","Light","Medium","SemiBold","ExtraBold","Black","parseSlant","style","styleStr","normal","Upright","italic","Italic","oblique","Oblique","FontManager","__workletClass","constructor","fontProvider","defaultFontName","families","i","countFamilies","push","getFamilyName","includes","Error","join","isFamilyAvailable","family","getFamiliesFromFont","font","split","map","f","matchFontFamilyName","resolveFontDescriptor","slant","width","createSkFont","resolvedSize","resolvedWeight","typeface","matchFamilyStyle","Font"],"sourceRoot":"../../../src","sources":["base/FontManager.ts"],"mappings":";;AACA,SACEA,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,IAAI,QACC,4BAA4B;;AAMnC;;AAEA;;AAUA,MAAMC,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;;AAExB,SAASC,SAASA,CAACC,IAAsB,EAAU;EACjD,SAAS;;EAET,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI;EACb;EAEA,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAI,CAAC,CAAC,CAACD,KAA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BJ;IACF,CAAC,GAAG,IAAI,CAACD,qBAAqB,CAACL,IAAI,EAAE7C,IAAI,EAAEO,MAAM,EAAEc,KAAK,CAAC;IAEzD,MAAMmC,QAAQ,GAAG,IAAI,CAACxB,YAAY,CAACyB,gBAAgB,CAACd,MAAM,EAAE;MAC1DpC,MAAM,EAAEgD,cAAc;MACtBJ,KAAK;MACLC,KAAK,EAAExD,SAAS,CAACe;IACnB,CAAC,CAAC;IAEF,IAAI,CAAC6C,QAAQ,EAAE;MACb,MAAM,IAAIhB,KAAK,CACb,mEAAmEG,MAAM,kBAAkBY,cAAc,gBAAgBJ,KAAK,IAChI,CAAC;IACH;;IAEA;IACA;IACA;;IAEA,OAAOtD,IAAI,CAAC6D,IAAI,CAACF,QAAQ,EAAEF,YAAY,GAAGxD,QAAQ,CAAC,CAAC,CAAC;EACvD;AACF","ignoreList":[]}
1
+ {"version":3,"names":["FontWeight","FontSlant","FontWidth","Skia","PT_TO_PX","parseSize","size","match","trim","value","parseFloat","unit","parseWeight","weight","weightStr","String","toLowerCase","Normal","Bold","Thin","ExtraLight","Light","Medium","SemiBold","ExtraBold","Black","parseSlant","style","styleStr","normal","Upright","italic","Italic","oblique","Oblique","FontManager","__workletClass","familyMatchCache","skFontCache","constructor","fontProvider","defaultFontName","families","i","countFamilies","push","getFamilyName","includes","Error","join","familiesLower","map","family","isFamilyAvailable","getFamiliesFromFont","font","split","f","matchFontFamilyName","cacheKey","cached","matched","resolveFontDescriptor","slant","width","createSkFont","resolvedSize","resolvedWeight","typeface","matchFamilyStyle","skFont","Font"],"sourceRoot":"../../../src","sources":["base/FontManager.ts"],"mappings":";;AACA,SACEA,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,IAAI,QACC,4BAA4B;;AAMnC;;AAEA;;AAUA,MAAMC,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;;AAExB,SAASC,SAASA,CAACC,IAAsB,EAAU;EACjD,SAAS;;EAET,IAAI,OAAOA,IAAI,KAA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AW,CAACqB,QAAQ,CAAC,GAAGW,MAAM;IACnC,OAAOA,MAAM;EACf;AACF","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ export function buildVexflowGroupIndex(commands) {
4
+ const index = {};
5
+ for (const command of commands) {
6
+ if (command.groupId == null) {
7
+ continue;
8
+ }
9
+ (index[command.groupId] ??= []).push(command);
10
+ }
11
+ return index;
12
+ }
13
+ //# sourceMappingURL=VexflowRecordingIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["buildVexflowGroupIndex","commands","index","command","groupId","push"],"sourceRoot":"../../../src","sources":["base/VexflowRecordingIndex.ts"],"mappings":";;AAMA,OAAO,SAASA,sBAAsBA,CACpCC,QAA4C,EAChB;EAC5B,MAAMC,KAAgD,GAAG,CAAC,CAAC;EAE3D,KAAK,MAAMC,OAAO,IAAIF,QAAQ,EAAE;IAC9B,IAAIE,OAAO,CAACC,OAAO,IAAI,IAAI,EAAE;MAC3B;IACF;IAEA,CAACF,KAAK,CAACC,OAAO,CAACC,OAAO,CAAC,KAAK,EAAE,EAAEC,IAAI,CAACF,OAAO,CAAC;EAC/C;EAEA,OAAOD,KAAK;AACd","ignoreList":[]}
@@ -14,20 +14,34 @@ function shadowBlurToSigma(shadowBlur) {
14
14
  return shadowBlur / 2;
15
15
  }
16
16
 
17
+ /**
18
+ * Per-replay `css color -> SkColor` cache: a recording uses a handful of
19
+ * distinct colors but references them thousands of times.
20
+ */
21
+
22
+ function getCachedColor(color, cache) {
23
+ 'worklet';
24
+
25
+ return cache[color] ??= Skia.Color(color);
26
+ }
27
+
17
28
  /**
18
29
  * Apply the recorded glow (CSS shadow) to a Skia paint as a drop-shadow image
19
30
  * filter. `dx = dy = 0` turns the drop shadow into a symmetric glow centred on
20
31
  * the ink; `MakeDropShadow` (not `…Only`) keeps the source content, so the note
21
32
  * still draws on top of its halo. No-op unless a `shadowColor` resolved.
22
33
  */
23
- function applyGlow(skPaint, paint) {
34
+ function applyGlow(skPaint, paint, colorCache) {
24
35
  'worklet';
25
36
 
26
37
  if (paint.shadowColor == null) {
38
+ // Pooled paints carry state between commands — explicitly clear a filter
39
+ // a previous command may have set.
40
+ skPaint.setImageFilter(null);
27
41
  return;
28
42
  }
29
43
  const sigma = shadowBlurToSigma(paint.shadowBlur ?? 0);
30
- skPaint.setImageFilter(Skia.ImageFilter.MakeDropShadow(0, 0, sigma, sigma, Skia.Color(paint.shadowColor)));
44
+ skPaint.setImageFilter(Skia.ImageFilter.MakeDropShadow(0, 0, sigma, sigma, getCachedColor(paint.shadowColor, colorCache)));
31
45
  }
32
46
  function toSkiaRect(rect) {
33
47
  'worklet';
@@ -47,28 +61,48 @@ function mapRecordingLineCap(cap) {
47
61
  return StrokeCap.Butt;
48
62
  }
49
63
  }
50
- function createFillPaint(paint) {
64
+
65
+ /**
66
+ * One fill and one stroke paint are pooled per replay call and reconfigured
67
+ * per command — Skia snapshots paint state into the canvas/display list at
68
+ * each draw call, so mutating the pooled paint afterwards is safe. Optional
69
+ * state (glow filter, dash effect) is explicitly reset on every configure so
70
+ * nothing bleeds between commands.
71
+ */
72
+ function createPooledFillPaint() {
51
73
  'worklet';
52
74
 
53
75
  const skPaint = Skia.Paint();
54
76
  skPaint.setStyle(PaintStyle.Fill);
55
77
  skPaint.setAntiAlias(true);
56
- skPaint.setColor(Skia.Color(paint.color));
57
- applyGlow(skPaint, paint);
58
78
  return skPaint;
59
79
  }
60
- function createStrokePaint(paint) {
80
+ function createPooledStrokePaint() {
61
81
  'worklet';
62
82
 
63
83
  const skPaint = Skia.Paint();
64
84
  skPaint.setStyle(PaintStyle.Stroke);
65
85
  skPaint.setAntiAlias(true);
66
- skPaint.setColor(Skia.Color(paint.color));
86
+ return skPaint;
87
+ }
88
+ function configureFillPaint(skPaint, paint, colorCache) {
89
+ 'worklet';
90
+
91
+ skPaint.setColor(getCachedColor(paint.color, colorCache));
92
+ applyGlow(skPaint, paint, colorCache);
93
+ return skPaint;
94
+ }
95
+ function configureStrokePaint(skPaint, paint, colorCache) {
96
+ 'worklet';
97
+
98
+ skPaint.setColor(getCachedColor(paint.color, colorCache));
67
99
  skPaint.setStrokeWidth(paint.strokeWidth ?? 1);
68
100
  skPaint.setStrokeCap(mapRecordingLineCap(paint.strokeCap ?? 'butt'));
69
- applyGlow(skPaint, paint);
101
+ applyGlow(skPaint, paint, colorCache);
70
102
  if (paint.lineDash != null && paint.lineDash.length > 0) {
71
103
  skPaint.setPathEffect(Skia.PathEffect.MakeDash(paint.lineDash));
104
+ } else {
105
+ skPaint.setPathEffect(null);
72
106
  }
73
107
  return skPaint;
74
108
  }
@@ -167,14 +201,23 @@ export function renderVexflowRecordingCommands(canvas, commands, fontProvider, d
167
201
  * colours, a glow (shadow), and a stroke dash are all expressible. Omit for a
168
202
  * byte-identical replay of the recorded style.
169
203
  */
170
- styleOverrides) {
204
+ styleOverrides,
205
+ /**
206
+ * Optional pre-built FontManager to reuse across replays so its SkFont /
207
+ * family caches survive between calls (e.g. one overlay replay per note).
208
+ * Omitted, one is constructed per call — the original behavior.
209
+ */
210
+ replayFontManager) {
171
211
  'worklet';
172
212
 
173
- const fontManager = new FontManager(fontProvider, defaultFont);
213
+ const fontManager = replayFontManager ?? new FontManager(fontProvider, defaultFont);
214
+ const colorCache = {};
215
+ const fillPaint = createPooledFillPaint();
216
+ const strokePaint = createPooledStrokePaint();
174
217
  for (const command of commands) {
175
218
  switch (command.type) {
176
219
  case 'clear':
177
- canvas.clear(Skia.Color(command.color));
220
+ canvas.clear(getCachedColor(command.color, colorCache));
178
221
  break;
179
222
  case 'save':
180
223
  canvas.save();
@@ -192,19 +235,19 @@ styleOverrides) {
192
235
  canvas.clipRect(toSkiaRect(command.rect), ClipOp.Intersect, true);
193
236
  break;
194
237
  case 'fillRect':
195
- canvas.drawRect(toSkiaRect(command.rect), createFillPaint(resolveStyle(command.paint, command.groupId, 'fill', styleOverrides)));
238
+ canvas.drawRect(toSkiaRect(command.rect), configureFillPaint(fillPaint, resolveStyle(command.paint, command.groupId, 'fill', styleOverrides), colorCache));
196
239
  break;
197
240
  case 'clearRect':
198
241
  canvas.drawRect(toSkiaRect(command.rect), createClearPaint());
199
242
  break;
200
243
  case 'fillPath':
201
- canvas.drawPath(buildPath(command.path), createFillPaint(resolveStyle(command.paint, command.groupId, 'fill', styleOverrides)));
244
+ canvas.drawPath(buildPath(command.path), configureFillPaint(fillPaint, resolveStyle(command.paint, command.groupId, 'fill', styleOverrides), colorCache));
202
245
  break;
203
246
  case 'strokePath':
204
- canvas.drawPath(buildPath(command.path), createStrokePaint(resolveStyle(command.paint, command.groupId, 'stroke', styleOverrides)));
247
+ canvas.drawPath(buildPath(command.path), configureStrokePaint(strokePaint, resolveStyle(command.paint, command.groupId, 'stroke', styleOverrides), colorCache));
205
248
  break;
206
249
  case 'fillText':
207
- canvas.drawText(command.text, command.x, command.y, createFillPaint(resolveStyle(command.paint, command.groupId, 'fill', styleOverrides)), createFont(fontManager, command.font));
250
+ canvas.drawText(command.text, command.x, command.y, configureFillPaint(fillPaint, resolveStyle(command.paint, command.groupId, 'fill', styleOverrides), colorCache), createFont(fontManager, command.font));
208
251
  break;
209
252
  default:
210
253
  assertNever(command);
@@ -1 +1 @@
1
- {"version":3,"names":["BlendMode","ClipOp","PaintStyle","Skia","StrokeCap","FontManager","shadowBlurToSigma","shadowBlur","applyGlow","skPaint","paint","shadowColor","sigma","setImageFilter","ImageFilter","MakeDropShadow","Color","toSkiaRect","rect","XYWHRect","x","y","width","height","mapRecordingLineCap","cap","Round","Square","Butt","createFillPaint","Paint","setStyle","Fill","setAntiAlias","setColor","color","createStrokePaint","Stroke","setStrokeWidth","strokeWidth","setStrokeCap","strokeCap","lineDash","length","setPathEffect","PathEffect","MakeDash","createClearPaint","clearPaint","setBlendMode","Clear","resolveStyle","groupId","kind","styleOverrides","override","fillColor","strokeColor","createFont","fontManager","font","createSkFont","size","weight","style","assertNever","value","Error","String","applyPathCommand","builder","command","type","moveTo","lineTo","cubicTo","cp1x","cp1y","cp2x","cp2y","quadTo","cpx","cpy","addRect","addArc","startDegrees","sweepDegrees","close","buildPath","path","PathBuilder","Make","build","renderVexflowRecordingCommands","canvas","commands","fontProvider","defaultFont","clear","save","restore","scale","translate","clipRect","Intersect","drawRect","drawPath","drawText","text"],"sourceRoot":"../../../src","sources":["base/VexflowRecordingReplay.ts"],"mappings":";;AAAA,SACEA,SAAS,EACTC,MAAM,EACNC,UAAU,EACVC,IAAI,EACJC,SAAS,QAKJ,4BAA4B;AAEnC,OAAOC,WAAW,MAAM,kBAAe;AAWvC;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAACC,UAAkB,EAAU;EACrD,SAAS;;EAET,OAAOA,UAAU,GAAG,CAAC;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAACC,OAAgB,EAAEC,KAA4B,EAAE;EACjE,SAAS;;EAET,IAAIA,KAAK,CAACC,WAAW,IAAI,IAAI,EAAE;IAC7B;EACF;EAEA,MAAMC,KAAK,GAAGN,iBAAiB,CAACI,KAAK,CAACH,UAAU,IAAI,CAAC,CAAC;EAEtDE,OAAO,CAACI,cAAc,CACpBV,IAAI,CAACW,WAAW,CAACC,cAAc,CAC7B,CAAC,EACD,CAAC,EACDH,KAAK,EACLA,KAAK,EACLT,IAAI,CAACa,KAAK,CAACN,KAAK,CAACC,WAAW,CAC9B,CACF,CAAC;AACH;AAEA,SAASM,UAAUA,CAACC,IAA0B,EAAE;EAC9C,SAAS;;EAET,OAAOf,IAAI,CAACgB,QAAQ,CAACD,IAAI,CAACE,CAAC,EAAEF,IAAI,CAACG,CAAC,EAAEH,IAAI,CAACI,KAAK,EAAEJ,IAAI,CAACK,MAAM,CAAC;AAC/D;AAEA,SAASC,mBAAmBA,CAACC,GAA4B,EAAa;EACpE,SAAS;;EAET,QAAQA,GAAG;IACT,KAAK,OAAO;MACV,OAAOrB,SAAS,CAACsB,KAAK;IACxB,KAAK,QAAQ;MACX,OAAOtB,SAA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AQ,CACbxF,UAAU,CAACsD,OAAO,CAACrD,IAAI,CAAC,EACxBW,eAAe,CACbsB,YAAY,CAACoB,OAAO,CAAC7D,KAAK,EAAE6D,OAAO,CAACnB,OAAO,EAAE,MAAM,EAAEE,cAAc,CACrE,CACF,CAAC;QACD;MACF,KAAK,WAAW;QACdwC,MAAM,CAACW,QAAQ,CAACxF,UAAU,CAACsD,OAAO,CAACrD,IAAI,CAAC,EAAE6B,gBAAgB,CAAC,CAAC,CAAC;QAC7D;MACF,KAAK,UAAU;QACb+C,MAAM,CAACY,QAAQ,CACblB,SAAS,CAACjB,OAAO,CAACkB,IAAI,CAAC,EACvB5D,eAAe,CACbsB,YAAY,CAACoB,OAAO,CAAC7D,KAAK,EAAE6D,OAAO,CAACnB,OAAO,EAAE,MAAM,EAAEE,cAAc,CACrE,CACF,CAAC;QACD;MACF,KAAK,YAAY;QACfwC,MAAM,CAACY,QAAQ,CACblB,SAAS,CAACjB,OAAO,CAACkB,IAAI,CAAC,EACvBrD,iBAAiB,CACfe,YAAY,CACVoB,OAAO,CAAC7D,KAAK,EACb6D,OAAO,CAACnB,OAAO,EACf,QAAQ,EACRE,cACF,CACF,CACF,CAAC;QACD;MACF,KAAK,UAAU;QACbwC,MAAM,CAACa,QAAQ,CACbpC,OAAO,CAACqC,IAAI,EACZrC,OAAO,CAACnD,CAAC,EACTmD,OAAO,CAAClD,CAAC,EACTQ,eAAe,CACbsB,YAAY,CAACoB,OAAO,CAAC7D,KAAK,EAAE6D,OAAO,CAACnB,OAAO,EAAE,MAAM,EAAEE,cAAc,CACrE,CAAC,EACDI,UAAU,CAACC,WAAW,EAAEY,OAAO,CAACX,IAAI,CACtC,CAAC;QACD;MACF;QACEK,WAAW,CAACM,OAAO,CAAC;IACxB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["BlendMode","ClipOp","PaintStyle","Skia","StrokeCap","FontManager","shadowBlurToSigma","shadowBlur","getCachedColor","color","cache","Color","applyGlow","skPaint","paint","colorCache","shadowColor","setImageFilter","sigma","ImageFilter","MakeDropShadow","toSkiaRect","rect","XYWHRect","x","y","width","height","mapRecordingLineCap","cap","Round","Square","Butt","createPooledFillPaint","Paint","setStyle","Fill","setAntiAlias","createPooledStrokePaint","Stroke","configureFillPaint","setColor","configureStrokePaint","setStrokeWidth","strokeWidth","setStrokeCap","strokeCap","lineDash","length","setPathEffect","PathEffect","MakeDash","createClearPaint","clearPaint","setBlendMode","Clear","resolveStyle","groupId","kind","styleOverrides","override","fillColor","strokeColor","createFont","fontManager","font","createSkFont","size","weight","style","assertNever","value","Error","String","applyPathCommand","builder","command","type","moveTo","lineTo","cubicTo","cp1x","cp1y","cp2x","cp2y","quadTo","cpx","cpy","addRect","addArc","startDegrees","sweepDegrees","close","buildPath","path","PathBuilder","Make","build","renderVexflowRecordingCommands","canvas","commands","fontProvider","defaultFont","replayFontManager","fillPaint","strokePaint","clear","save","restore","scale","translate","clipRect","Intersect","drawRect","drawPath","drawText","text"],"sourceRoot":"../../../src","sources":["base/VexflowRecordingReplay.ts"],"mappings":";;AAAA,SACEA,SAAS,EACTC,MAAM,EACNC,UAAU,EACVC,IAAI,EACJC,SAAS,QAMJ,4BAA4B;AAEnC,OAAOC,WAAW,MAAM,kBAAe;AAWvC;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAACC,UAAkB,EAAU;EACrD,SAAS;;EAET,OAAOA,UAAU,GAAG,CAAC;AACvB;;AAEA;AACA;AACA;AACA;;AAGA,SAASC,cAAcA,CAACC,KAAa,EAAEC,KAAmB,EAAW;EACnE,SAAS;;EAET,OAAQA,KAAK,CAACD,KAAK,CAAC,KAAKN,IAAI,CAACQ,KAAK,CAACF,KAAK,CAAC;AAC5C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,SAASA,CAChBC,OAAgB,EAChBC,KAA4B,EAC5BC,UAAwB,EACxB;EACA,SAAS;;EAET,IAAID,KAAK,CAACE,WAAW,IAAI,IAAI,EAAE;IAC7B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AI,CAAC,EACxBkB,kBAAkB,CAChBgE,SAAS,EACThD,YAAY,CACVoB,OAAO,CAAC9D,KAAK,EACb8D,OAAO,CAACnB,OAAO,EACf,MAAM,EACNE,cACF,CAAC,EACD5C,UACF,CACF,CAAC;QACD;MACF,KAAK,WAAW;QACdoF,MAAM,CAACc,QAAQ,CAAC5F,UAAU,CAACuD,OAAO,CAACtD,IAAI,CAAC,EAAE8B,gBAAgB,CAAC,CAAC,CAAC;QAC7D;MACF,KAAK,UAAU;QACb+C,MAAM,CAACe,QAAQ,CACbrB,SAAS,CAACjB,OAAO,CAACkB,IAAI,CAAC,EACvBtD,kBAAkB,CAChBgE,SAAS,EACThD,YAAY,CACVoB,OAAO,CAAC9D,KAAK,EACb8D,OAAO,CAACnB,OAAO,EACf,MAAM,EACNE,cACF,CAAC,EACD5C,UACF,CACF,CAAC;QACD;MACF,KAAK,YAAY;QACfoF,MAAM,CAACe,QAAQ,CACbrB,SAAS,CAACjB,OAAO,CAACkB,IAAI,CAAC,EACvBpD,oBAAoB,CAClB+D,WAAW,EACXjD,YAAY,CACVoB,OAAO,CAAC9D,KAAK,EACb8D,OAAO,CAACnB,OAAO,EACf,QAAQ,EACRE,cACF,CAAC,EACD5C,UACF,CACF,CAAC;QACD;MACF,KAAK,UAAU;QACboF,MAAM,CAACgB,QAAQ,CACbvC,OAAO,CAACwC,IAAI,EACZxC,OAAO,CAACpD,CAAC,EACToD,OAAO,CAACnD,CAAC,EACTe,kBAAkB,CAChBgE,SAAS,EACThD,YAAY,CACVoB,OAAO,CAAC9D,KAAK,EACb8D,OAAO,CAACnB,OAAO,EACf,MAAM,EACNE,cACF,CAAC,EACD5C,UACF,CAAC,EACDgD,UAAU,CAACC,WAAW,EAAEY,OAAO,CAACX,IAAI,CACtC,CAAC;QACD;MACF;QACEK,WAAW,CAACM,OAAO,CAAC;IACxB;EACF;AACF","ignoreList":[]}
@@ -3,7 +3,9 @@
3
3
  export { default as VexflowCanvas } from "./VexflowCanvas.js";
4
4
  export { default as VexflowRecordingContext } from "./VexflowRecordingContext.js";
5
5
  export { renderVexflowRecordingCommands } from "./VexflowRecordingReplay.js";
6
+ export { buildVexflowGroupIndex } from "./VexflowRecordingIndex.js";
6
7
  export * from "./VexflowColorScheme.js";
7
8
  export * from "./VexflowRecordingTypes.js";
8
9
  export * from "./types.js";
10
+ export { isVexflowNativeDebugEnabled, setVexflowNativeDebugEnabled } from "../shared/debug.js";
9
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","VexflowCanvas","VexflowRecordingContext","renderVexflowRecordingCommands"],"sourceRoot":"../../../src","sources":["base/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,aAAa,QAAQ,oBAAiB;AAC1D,SAASD,OAAO,IAAIE,uBAAuB,QAAQ,8BAA2B;AAC9E,SAASC,8BAA8B,QAAQ,6BAA0B;AAEzE,cAAc,yBAAsB;AACpC,cAAc,4BAAyB;AACvC,cAAc,YAAS","ignoreList":[]}
1
+ {"version":3,"names":["default","VexflowCanvas","VexflowRecordingContext","renderVexflowRecordingCommands","buildVexflowGroupIndex","isVexflowNativeDebugEnabled","setVexflowNativeDebugEnabled"],"sourceRoot":"../../../src","sources":["base/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,aAAa,QAAQ,oBAAiB;AAC1D,SAASD,OAAO,IAAIE,uBAAuB,QAAQ,8BAA2B;AAC9E,SAASC,8BAA8B,QAAQ,6BAA0B;AACzE,SACEC,sBAAsB,QAEjB,4BAAyB;AAEhC,cAAc,yBAAsB;AACpC,cAAc,4BAAyB;AACvC,cAAc,YAAS;AAEvB,SACEC,2BAA2B,EAC3BC,4BAA4B,QACvB,oBAAiB","ignoreList":[]}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ import { useEffect, useMemo } from 'react';
4
+ import { Picture } from '@shopify/react-native-skia';
5
+ import { runOnUI, useDerivedValue, useSharedValue } from 'react-native-reanimated';
6
+ import { isVexflowNativeDebugEnabled } from "../../shared/debug.js";
7
+ import { createScorePictureWorklet, disposeOverlayPictures, getEmptyOverlayPicture, getOverlayFontManager, logOverlayProfile, nowMsWorklet, retireOverlayPicture } from "./utils.js";
8
+
9
+ /**
10
+ * Draws the style-overridden items on top of the static base picture. Only
11
+ * the overridden groups' commands are re-recorded per override write — the
12
+ * full command array never reaches the UI runtime. Overridden items are drawn
13
+ * opaque over their base-colored twins at identical coordinates; with an
14
+ * opaque override color the result matches an in-place recolor up to a ≤1px
15
+ * anti-aliasing fringe of base ink at glyph edges.
16
+ */
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ export default function ScoreOverlayPicture({
19
+ contentSize,
20
+ defaultFont,
21
+ fontManager,
22
+ groupIndex,
23
+ itemStyleOverrides
24
+ }) {
25
+ const emptyPicture = useMemo(getEmptyOverlayPicture, []);
26
+ // A FontManager instance cannot be serialized into a worklet closure, so
27
+ // each runtime lazily constructs its own in this slot (never crossing
28
+ // runtimes) — its SkFont caches still persist across onsets.
29
+ const fontManagerSlot = useSharedValue({
30
+ manager: null
31
+ });
32
+ const disposal = useSharedValue({
33
+ prev: null,
34
+ pending: []
35
+ });
36
+ const profile = useSharedValue({
37
+ windowStartMs: 0,
38
+ maxMs: 0,
39
+ count: 0
40
+ });
41
+ // Read on JS and captured: the debug singleton lives on the JS runtime, so
42
+ // a toggle takes effect on the overlay's next render.
43
+ const enableProfiling = isVexflowNativeDebugEnabled();
44
+ const picture = useDerivedValue(() => {
45
+ const overrides = itemStyleOverrides.value;
46
+ let commands = null;
47
+ for (const groupId in overrides) {
48
+ const group = groupIndex[groupId];
49
+ if (group != null) {
50
+ (commands ??= []).push(...group);
51
+ }
52
+ }
53
+ if (commands == null) {
54
+ retireOverlayPicture(disposal, null);
55
+ return emptyPicture;
56
+ }
57
+ const start = enableProfiling ? nowMsWorklet() : 0;
58
+ const next = createScorePictureWorklet({
59
+ contentSize,
60
+ defaultFont,
61
+ fontManager,
62
+ recordedCommands: commands,
63
+ replayFontManager: getOverlayFontManager(fontManagerSlot, fontManager, defaultFont),
64
+ styleOverrides: overrides
65
+ });
66
+ if (enableProfiling) {
67
+ logOverlayProfile(profile, commands.length, nowMsWorklet() - start);
68
+ }
69
+ retireOverlayPicture(disposal, next);
70
+ return next;
71
+ }, [contentSize, defaultFont, disposal, emptyPicture, enableProfiling, fontManager, fontManagerSlot, groupIndex, itemStyleOverrides, profile]);
72
+ useEffect(() => {
73
+ return () => {
74
+ runOnUI(disposeOverlayPictures)(disposal);
75
+ };
76
+ }, [disposal]);
77
+ return /*#__PURE__*/_jsx(Picture, {
78
+ picture: picture
79
+ });
80
+ }
81
+ //# sourceMappingURL=ScoreOverlayPicture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useMemo","Picture","runOnUI","useDerivedValue","useSharedValue","isVexflowNativeDebugEnabled","createScorePictureWorklet","disposeOverlayPictures","getEmptyOverlayPicture","getOverlayFontManager","logOverlayProfile","nowMsWorklet","retireOverlayPicture","jsx","_jsx","ScoreOverlayPicture","contentSize","defaultFont","fontManager","groupIndex","itemStyleOverrides","emptyPicture","fontManagerSlot","manager","disposal","prev","pending","profile","windowStartMs","maxMs","count","enableProfiling","picture","overrides","value","commands","groupId","group","push","start","next","recordedCommands","replayFontManager","styleOverrides","length"],"sourceRoot":"../../../../src","sources":["renderer/ScoreRenderer/ScoreOverlayPicture.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAC1C,SAASC,OAAO,QAAwB,4BAA4B;AACpE,SACEC,OAAO,EACPC,eAAe,EACfC,cAAc,QACT,yBAAyB;AAGhC,SAASC,2BAA2B,QAAQ,uBAAoB;AAOhE,SACEC,yBAAyB,EACzBC,sBAAsB,EACtBC,sBAAsB,EACtBC,qBAAqB,EACrBC,iBAAiB,EACjBC,YAAY,EACZC,oBAAoB,QACf,YAAS;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAA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,CACtCa,eAAe,EACfJ,WAAW,EACXD,WACF,CAAC;MACD0B,cAAc,EAAEV;IAClB,CAAC,CAAC;IAEF,IAAIF,eAAe,EAAE;MACnBrB,iBAAiB,CAACiB,OAAO,EAAEQ,QAAQ,CAACS,MAAM,EAAEjC,YAAY,CAAC,CAAC,GAAG4B,KAAK,CAAC;IACrE;IAEA3B,oBAAoB,CAACY,QAAQ,EAAEgB,IAAI,CAAC;IACpC,OAAOA,IAAI;EACb,CAAC,EAAE,CACDxB,WAAW,EACXC,WAAW,EACXO,QAAQ,EACRH,YAAY,EACZU,eAAe,EACfb,WAAW,EACXI,eAAe,EACfH,UAAU,EACVC,kBAAkB,EAClBO,OAAO,CACR,CAAC;EAEF5B,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACXG,OAAO,CAACK,sBAAsB,CAAC,CAACiB,QAAQ,CAAC;IAC3C,CAAC;EACH,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEd,oBAAOV,IAAA,CAACb,OAAO;IAAC+B,OAAO,EAAEA;EAAQ,CAAE,CAAC;AACtC","ignoreList":[]}
@@ -5,15 +5,15 @@ import { Canvas, Group, Picture, Skia, useCanvasRef } from '@shopify/react-nativ
5
5
  import { StyleSheet, View } from 'react-native';
6
6
  import { GestureDetector } from 'react-native-gesture-handler';
7
7
  import { useDerivedValue } from 'react-native-reanimated';
8
- import { renderVexflowRecordingCommands } from "../../base/VexflowRecordingReplay.js";
8
+ import FontManager from "../../base/FontManager.js";
9
9
  import { resolveScoreColorScheme } from "../colorScheme.js";
10
- import { insets, renderOptions, spacing } from "../constants.js";
11
10
  import { getRenderScale, toViewSize } from "../scale.js";
12
11
  import { useScoreRecording } from "../useScoreRecording.js";
13
- import { createVisibleViewport } from "../viewport.js";
12
+ import ScoreOverlayPicture from "./ScoreOverlayPicture.js";
14
13
  import ScorePlayhead, { resolvePlayheadStyle } from "./ScorePlayhead.js";
15
14
  import ScoreScrollbar from "./ScoreScrollbar.js";
16
15
  import { getMaxScroll, getScrollAxis, useScoreScroll } from "./useScoreScroll.js";
16
+ import { createPictureTransform, createScorePicture, withDefaultOptions } from "./utils.js";
17
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
18
  const EMPTY_OPTIONS = {};
19
19
  const EMPTY_SIZE = {
@@ -34,7 +34,8 @@ const ScoreRenderer = ({
34
34
  playhead,
35
35
  playheadStyle,
36
36
  onScrollGeometry,
37
- onItemsLayout
37
+ onItemsLayout,
38
+ onReady
38
39
  }) => {
39
40
  const options = useMemo(() => withDefaultOptions(userOptions), [userOptions]);
40
41
  const resolvedColorScheme = useMemo(() => resolveScoreColorScheme(colorScheme), [colorScheme]);
@@ -69,6 +70,7 @@ const ScoreRenderer = ({
69
70
  }), [viewportSize.height, viewportSize.width]);
70
71
  const {
71
72
  commands: recordedCommands,
73
+ groupIndex,
72
74
  layoutPlan,
73
75
  itemsLayout
74
76
  } = useScoreRecording({
@@ -81,15 +83,9 @@ const ScoreRenderer = ({
81
83
  score,
82
84
  viewport
83
85
  });
84
- // Scrolling and overflow checks need the view-space content size, not the
85
- // content-space size that bounds the recorded picture.
86
86
  const scale = getRenderScale(options);
87
87
  const contentSize = layoutPlan.contentSize;
88
88
  const viewContentSize = useMemo(() => toViewSize(contentSize, scale), [contentSize, scale]);
89
-
90
- // Deliver geometry once per recording pass. The callback lives in a ref so
91
- // a new inline callback identity neither re-fires the effect nor loops when
92
- // the callback sets parent state.
93
89
  const onItemsLayoutRef = useRef(onItemsLayout);
94
90
  useEffect(() => {
95
91
  onItemsLayoutRef.current = onItemsLayout;
@@ -108,9 +104,6 @@ const ScoreRenderer = ({
108
104
  viewportSize
109
105
  });
110
106
  const hasScrollableOverflow = getMaxScroll(effectiveRendererType, viewportSize, viewContentSize) > 0;
111
-
112
- // Announce the scroll envelope like onItemsLayout: latest callback in a
113
- // ref, effect keyed only on the geometry it reports.
114
107
  const onScrollGeometryRef = useRef(onScrollGeometry);
115
108
  useEffect(() => {
116
109
  onScrollGeometryRef.current = onScrollGeometry;
@@ -128,20 +121,37 @@ const ScoreRenderer = ({
128
121
  }, [effectiveRendererType, hasViewportSize, viewContentSize, viewportSize]);
129
122
  const resolvedPlayheadStyle = useMemo(() => resolvePlayheadStyle(playheadStyle, resolvedColorScheme.foreground), [playheadStyle, resolvedColorScheme.foreground]);
130
123
  const viewportClip = useMemo(() => Skia.XYWHRect(0, 0, viewportSize.width, viewportSize.height), [viewportSize.height, viewportSize.width]);
124
+ const replayFontManager = useMemo(() => new FontManager(fontManager, defaultFont), [defaultFont, fontManager]);
131
125
  const picture = useMemo(() => {
132
- if (!hasViewportSize || itemStyleOverrides) {
126
+ if (!hasViewportSize) {
133
127
  return undefined;
134
128
  }
135
129
  return createScorePicture({
136
130
  contentSize,
137
131
  defaultFont,
138
132
  fontManager,
139
- recordedCommands
133
+ recordedCommands,
134
+ replayFontManager
140
135
  });
141
- }, [contentSize, defaultFont, fontManager, hasViewportSize, itemStyleOverrides, recordedCommands]);
142
-
143
- // Destructure so the worklet below doesn't capture the whole scrollState —
144
- // the PanGesture inside it is not serializable and would crash the worklet.
136
+ }, [contentSize, defaultFont, fontManager, hasViewportSize, recordedCommands, replayFontManager]);
137
+ useEffect(() => {
138
+ if (!picture) {
139
+ return;
140
+ }
141
+ return () => picture.dispose();
142
+ }, [picture]);
143
+ const onReadyRef = useRef(onReady);
144
+ useEffect(() => {
145
+ onReadyRef.current = onReady;
146
+ });
147
+ const hasFiredReadyRef = useRef(false);
148
+ useEffect(() => {
149
+ if (hasFiredReadyRef.current || !hasViewportSize || !picture) {
150
+ return;
151
+ }
152
+ hasFiredReadyRef.current = true;
153
+ onReadyRef.current?.();
154
+ }, [hasViewportSize, picture]);
145
155
  const {
146
156
  scrollOffset
147
157
  } = scrollState;
@@ -163,17 +173,17 @@ const ScoreRenderer = ({
163
173
  ref: canvasRef,
164
174
  children: /*#__PURE__*/_jsxs(Group, {
165
175
  clip: viewportClip,
166
- children: [/*#__PURE__*/_jsx(Group, {
176
+ children: [/*#__PURE__*/_jsxs(Group, {
167
177
  transform: pictureTransform,
168
- children: itemStyleOverrides && hasViewportSize ? /*#__PURE__*/_jsx(AnimatedScorePicture, {
178
+ children: [picture ? /*#__PURE__*/_jsx(Picture, {
179
+ picture: picture
180
+ }) : null, itemStyleOverrides && hasViewportSize ? /*#__PURE__*/_jsx(ScoreOverlayPicture, {
169
181
  contentSize: contentSize,
170
182
  defaultFont: defaultFont,
171
183
  fontManager: fontManager,
172
- itemStyleOverrides: itemStyleOverrides,
173
- recordedCommands: recordedCommands
174
- }) : picture ? /*#__PURE__*/_jsx(Picture, {
175
- picture: picture
176
- }) : null
184
+ groupIndex: groupIndex,
185
+ itemStyleOverrides: itemStyleOverrides
186
+ }) : null]
177
187
  }), playhead ? /*#__PURE__*/_jsx(ScorePlayhead, {
178
188
  playhead: playhead,
179
189
  scrollOffset: scrollState.scrollOffset,
@@ -196,132 +206,6 @@ const ScoreRenderer = ({
196
206
  });
197
207
  };
198
208
  export default /*#__PURE__*/memo(ScoreRenderer);
199
- function AnimatedScorePicture({
200
- contentSize,
201
- defaultFont,
202
- fontManager,
203
- itemStyleOverrides,
204
- recordedCommands
205
- }) {
206
- const picture = useDerivedValue(() => {
207
- return createScorePictureWorklet({
208
- contentSize,
209
- defaultFont,
210
- fontManager,
211
- recordedCommands,
212
- styleOverrides: itemStyleOverrides.value
213
- });
214
- }, [contentSize, defaultFont, fontManager, itemStyleOverrides, recordedCommands]);
215
- return /*#__PURE__*/_jsx(Picture, {
216
- picture: picture
217
- });
218
- }
219
- export function createScorePicture({
220
- contentSize,
221
- defaultFont,
222
- fontManager,
223
- recordedCommands,
224
- styleOverrides
225
- }) {
226
- try {
227
- const start = nowMs();
228
- const picture = createScorePictureWorklet({
229
- contentSize,
230
- defaultFont,
231
- fontManager,
232
- recordedCommands,
233
- styleOverrides
234
- });
235
- logScorePictureProfile({
236
- commandCount: recordedCommands.length,
237
- contentSize,
238
- durationMs: nowMs() - start
239
- });
240
- return picture;
241
- } catch (error) {
242
- console.error('ScoreRenderer picture render failed', error);
243
- throw error;
244
- }
245
- }
246
- function createScorePictureWorklet({
247
- contentSize,
248
- defaultFont,
249
- fontManager,
250
- recordedCommands,
251
- styleOverrides
252
- }) {
253
- 'worklet';
254
-
255
- const recorder = Skia.PictureRecorder();
256
- const canvas = recorder.beginRecording(Skia.XYWHRect(0, 0, contentSize.width, contentSize.height));
257
- renderVexflowRecordingCommands(canvas, recordedCommands, fontManager, defaultFont, styleOverrides);
258
- return recorder.finishRecordingAsPicture();
259
- }
260
-
261
- /**
262
- * Maps the content-space picture into the view. Skia applies the transform
263
- * array right-to-left, so the trailing scale entry runs first and the
264
- * translate entries then shift by the view-space scroll offset; `contentSize`
265
- * must be the view-space content size.
266
- */
267
- export function createPictureTransform(scrollOffset, rendererType, viewport, contentSize, scale = 1) {
268
- 'worklet';
269
-
270
- const visibleViewport = createVisibleViewport(scrollOffset, rendererType, viewport, contentSize);
271
- const transform = [{
272
- translateX: visibleViewport.x === 0 ? 0 : -visibleViewport.x
273
- }, {
274
- translateY: visibleViewport.y === 0 ? 0 : -visibleViewport.y
275
- }];
276
- if (scale !== 1) {
277
- transform.push({
278
- scale
279
- });
280
- }
281
- return transform;
282
- }
283
- function withDefaultOptions(options) {
284
- return {
285
- insets: {
286
- ...insets,
287
- ...(options.insets || {})
288
- },
289
- spacing: {
290
- ...spacing,
291
- ...(options.spacing || {})
292
- },
293
- render: {
294
- ...renderOptions,
295
- ...(options.render || {})
296
- }
297
- };
298
- }
299
- function logScorePictureProfile({
300
- commandCount,
301
- contentSize,
302
- durationMs
303
- }) {
304
- if (!isDevBuild()) {
305
- return;
306
- }
307
- console.info('[ScoreRenderer] picture profile', {
308
- contentSize,
309
- commandCount,
310
- durationMs: roundMs(durationMs)
311
- });
312
- }
313
- function nowMs() {
314
- return globalThis.performance?.now?.() ?? Date.now();
315
- }
316
- function roundMs(value) {
317
- return Math.round(value * 10) / 10;
318
- }
319
- function isDevBuild() {
320
- if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'test') {
321
- return false;
322
- }
323
- return typeof __DEV__ === 'undefined' ? false : __DEV__;
324
- }
325
209
  const styles = StyleSheet.create({
326
210
  canvas: {
327
211
  flex: 1