@reekon-tools/boldr-utils 1.7.2 → 1.7.4
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.
|
@@ -42,6 +42,11 @@ const useBackgroundUrl = (image, resolveUrl) => {
|
|
|
42
42
|
// on a null/undefined source (despite its DataSourceParam type), so it can't
|
|
43
43
|
// be called unconditionally from a component that usually renders raster
|
|
44
44
|
// backgrounds. An empty url resolves to null (nothing to draw yet).
|
|
45
|
+
// Loaded through Skia's own scheme-agnostic data loader rather than fetch():
|
|
46
|
+
// RN's Android networking rejects non-http(s) schemes, and offline-first
|
|
47
|
+
// consumers resolve the background to a local file:// URI (fromURI handles
|
|
48
|
+
// file://, http(s) and data: on native and web alike). fetch() remains as a
|
|
49
|
+
// fallback for any environment where fromURI can't service the URL.
|
|
45
50
|
const useBackgroundSvg = (url) => {
|
|
46
51
|
const [svg, setSvg] = useState(null);
|
|
47
52
|
useEffect(() => {
|
|
@@ -52,9 +57,16 @@ const useBackgroundSvg = (url) => {
|
|
|
52
57
|
let cancelled = false;
|
|
53
58
|
(async () => {
|
|
54
59
|
try {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
let next = null;
|
|
61
|
+
try {
|
|
62
|
+
const data = await Skia.Data.fromURI(url);
|
|
63
|
+
next = Skia.SVG.MakeFromData(data);
|
|
64
|
+
data.dispose();
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
const res = await fetch(url);
|
|
68
|
+
next = Skia.SVG.MakeFromString(await res.text());
|
|
69
|
+
}
|
|
58
70
|
if (!cancelled)
|
|
59
71
|
setSvg(next);
|
|
60
72
|
}
|
|
@@ -17,6 +17,16 @@ export interface CalculatorFieldEntry {
|
|
|
17
17
|
locked: boolean;
|
|
18
18
|
/** Epoch ms. */
|
|
19
19
|
enteredAt: number;
|
|
20
|
+
/**
|
|
21
|
+
* Id of the group-owned Measurement this entry is mirrored to on a
|
|
22
|
+
* default/list group's grid (see boldr-pro's calculator grid sync). Present
|
|
23
|
+
* only for grid-linked captures — absent for form-group instances, unit-less
|
|
24
|
+
* fields, and values captured before linkage existed. The link is two-way:
|
|
25
|
+
* editing the value updates that doc, clearing the entry deletes it, and
|
|
26
|
+
* deleting the doc on the grid clears the entry. Ignorable by any runtime
|
|
27
|
+
* that doesn't mirror to the grid.
|
|
28
|
+
*/
|
|
29
|
+
gridMeasurementId?: string;
|
|
20
30
|
}
|
|
21
31
|
export interface CalculatorInstanceFileData {
|
|
22
32
|
/** Source doc id in the top-level `calculators` collection. */
|