@delacour/react-native-ui 0.6.0-alpha.20261103104147 → 0.6.0-alpha.20261103132733

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delacour/react-native-ui",
3
- "version": "0.6.0-alpha.20261103104147",
3
+ "version": "0.6.0-alpha.20261103132733",
4
4
  "description": "React Native UI components — Uniwind, Reanimated, Gesture Handler",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -181,10 +181,10 @@
181
181
  "expo-blur": ">=15",
182
182
  "@maplibre/maplibre-react-native": "^11.5.0",
183
183
  "@central-icons-react-native/round-outlined-radius-1-stroke-1.5": "^1.1",
184
- "@delacour/react-native-bottom-sheet": "0.6.0-alpha.20261103104147",
185
- "@delacour/react-native-charts": "0.6.0-alpha.20261103104147",
184
+ "@delacour/react-native-bottom-sheet": "0.6.0-alpha.20261103132733",
185
+ "@delacour/react-native-charts": "0.6.0-alpha.20261103132733",
186
186
  "@legendapp/list": ">=3.3",
187
- "react-native-skia": ">=3.7.3",
187
+ "react-native-skia": ">=3.9.0",
188
188
  "expo-linear-gradient": ">=15",
189
189
  "expo-router": ">=57",
190
190
  "react": ">=19",
@@ -126,8 +126,9 @@ standalone SVG document, or as a PNG.
126
126
  `resolveSignatureExport`, so the same options give the same box, the same
127
127
  literal ink and the same background or none — a PNG is transparent unless
128
128
  `background` is set. It renders the cached stroke paths off screen on a CPU
129
- surface (`Skia.Surface.MakeRaster`) at `scale` pixels per point (default the screen's ratio) and returns
130
- base64 with no `data:` prefix, as `Sketch.toPNG` does. Off screen rather than a
129
+ surface (`Skia.Surface.MakeRaster`) at `scale` pixels per point (default the screen's ratio) and resolves to
130
+ base64 with no `data:` prefix, as `Sketch.toPNG` does — a promise, because
131
+ react-native-skia 3.9 made `encodeToBase64` asynchronous. Off screen rather than a
131
132
  snapshot of the pad, so the guideline, the placeholder and the pad's fill never
132
133
  reach the file. `""` before the pad is measured. The point's `t` is stored so
133
134
  a speed-eased stroke width can follow without a format change.
@@ -69,10 +69,13 @@ function drawSignatureStrokes(canvas: SkCanvas, strokes: readonly SignatureStrok
69
69
  * uses, so the PNG is the SVG rasterised: the same box, the same literal ink,
70
70
  * the same background or none. Off screen rather than a snapshot of the pad, so
71
71
  * the guideline, the placeholder and the pad's own fill never reach the file.
72
- * The strokes are the cached paths the pad draws. Returns `""` when the frame
72
+ * The strokes are the cached paths the pad draws. Resolves to `""` when the frame
73
73
  * has no pixels — an unmeasured pad.
74
74
  */
75
- export function renderSignaturePng(value: SignatureValue, options: SignaturePngOptions & { scale: number }): string {
75
+ export async function renderSignaturePng(
76
+ value: SignatureValue,
77
+ options: SignaturePngOptions & { scale: number }
78
+ ): Promise<string> {
76
79
  const { background, box, strokeColor, strokeWidth } = resolveSignatureExport(value, options);
77
80
  const size = signaturePngSize(box, options.scale);
78
81
  if (size === null) return "";
@@ -369,7 +369,7 @@ function SignatureRoot({
369
369
  *
370
370
  * @example
371
371
  * const svg = pad.current?.toSVG({ viewBox: "tight", background: "#ffffff" });
372
- * const png = pad.current?.toPNG({ viewBox: "tight", background: "#ffffff" }); // base64
372
+ * const png = await pad.current?.toPNG({ viewBox: "tight", background: "#ffffff" }); // base64
373
373
  */
374
374
  export const Signature = Object.assign(SignatureRoot, {
375
375
  /** The drawing surface — the gesture, the ink, the guideline and the accessibility surface. */
@@ -67,11 +67,11 @@ export type SignatureHandle = {
67
67
  /** The signature as a standalone SVG document. Valid, if blank, when empty. */
68
68
  toSVG: (options?: SignatureExportOptions) => string;
69
69
  /**
70
- * The signature as a base64-encoded PNG (no `data:` prefix), framed and
70
+ * Resolves to the signature as a base64-encoded PNG (no `data:` prefix), framed and
71
71
  * coloured as `toSVG` with the same options would be, at `scale` pixels per
72
72
  * point. Transparent unless `background` is set. `""` before the pad is measured.
73
73
  */
74
- toPNG: (options?: SignaturePngOptions) => string;
74
+ toPNG: (options?: SignaturePngOptions) => Promise<string>;
75
75
  /** One smoothed SVG path `d` per stroke, in pad coordinates. */
76
76
  toPaths: () => readonly string[];
77
77
  };
@@ -140,7 +140,8 @@ DisplayNames: `DelacourUI.Sketch`, `.Sketch.Canvas`, `.Toolbar`, `.Tool`,
140
140
  to the canvas times `scale` (default the screen's pixel ratio), by the same
141
141
  `drawSketchItems` the picture records — not a snapshot of the visible canvas,
142
142
  which would need the view mounted and would capture nothing of the background
143
- option. It is synchronous and returns base64 without a `data:` prefix; `""`
143
+ option. It resolves to base64 without a `data:` prefix — asynchronous, because
144
+ react-native-skia 3.9 made `encodeToBase64` return a promise; `""`
144
145
  before the canvas is measured. Saving or sharing it is the app's job.
145
146
 
146
147
  ## Layout
@@ -70,9 +70,9 @@ type SketchPngTarget = SketchArea & { background: string | null; scale: number }
70
70
  *
71
71
  * Off screen rather than a snapshot of the visible canvas, so the file holds the
72
72
  * marks and the background only — never the image being annotated under them —
73
- * matching `toSVG`. Returns `""` before the canvas is measured.
73
+ * matching `toSVG`. Resolves to `""` before the canvas is measured.
74
74
  */
75
- export function renderSketchPng(items: readonly SketchItem[], target: SketchPngTarget): string {
75
+ export async function renderSketchPng(items: readonly SketchItem[], target: SketchPngTarget): Promise<string> {
76
76
  const pixelWidth = Math.round(target.width * target.scale);
77
77
  const pixelHeight = Math.round(target.height * target.scale);
78
78
  if (pixelWidth <= 0 || pixelHeight <= 0) return "";
@@ -26,11 +26,11 @@ export type SketchHandle = {
26
26
  /** Self-contained SVG: the viewBox is the canvas, an optional background rect, masks inlined. */
27
27
  toSVG: (options?: SketchExportOptions) => string;
28
28
  /**
29
- * The drawing as a base64-encoded PNG (no `data:` prefix), the canvas's size
29
+ * Resolves to the drawing as a base64-encoded PNG (no `data:` prefix), the canvas's size
30
30
  * times `scale`. Holds the marks and the background only — never what
31
31
  * `Sketch.Canvas` children paint under them. `""` before the canvas is measured.
32
32
  */
33
- toPNG: (options?: SketchPngOptions) => string;
33
+ toPNG: (options?: SketchPngOptions) => Promise<string>;
34
34
  };
35
35
 
36
36
  /**