@buoy-gg/images 7.0.3

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 (195) hide show
  1. package/LICENSE +58 -0
  2. package/README.md +58 -0
  3. package/lib/commonjs/capture/actions.js +227 -0
  4. package/lib/commonjs/capture/actions.js.map +1 -0
  5. package/lib/commonjs/capture/install.js +41 -0
  6. package/lib/commonjs/capture/install.js.map +1 -0
  7. package/lib/commonjs/capture/installExpoImage.js +99 -0
  8. package/lib/commonjs/capture/installExpoImage.js.map +1 -0
  9. package/lib/commonjs/capture/installRnImage.js +128 -0
  10. package/lib/commonjs/capture/installRnImage.js.map +1 -0
  11. package/lib/commonjs/capture/overrides.js +286 -0
  12. package/lib/commonjs/capture/overrides.js.map +1 -0
  13. package/lib/commonjs/capture/savings.js +193 -0
  14. package/lib/commonjs/capture/savings.js.map +1 -0
  15. package/lib/commonjs/capture/shared.js +367 -0
  16. package/lib/commonjs/capture/shared.js.map +1 -0
  17. package/lib/commonjs/components/ImageDetail.js +444 -0
  18. package/lib/commonjs/components/ImageDetail.js.map +1 -0
  19. package/lib/commonjs/components/ImageDetailFooter.js +232 -0
  20. package/lib/commonjs/components/ImageDetailFooter.js.map +1 -0
  21. package/lib/commonjs/components/ImageRow.js +164 -0
  22. package/lib/commonjs/components/ImageRow.js.map +1 -0
  23. package/lib/commonjs/components/ImagesHeader.js +63 -0
  24. package/lib/commonjs/components/ImagesHeader.js.map +1 -0
  25. package/lib/commonjs/components/ImagesIcon.js +59 -0
  26. package/lib/commonjs/components/ImagesIcon.js.map +1 -0
  27. package/lib/commonjs/components/ImagesListFooter.js +194 -0
  28. package/lib/commonjs/components/ImagesListFooter.js.map +1 -0
  29. package/lib/commonjs/components/ImagesModal.js +173 -0
  30. package/lib/commonjs/components/ImagesModal.js.map +1 -0
  31. package/lib/commonjs/components/ImagesRoot.js +24 -0
  32. package/lib/commonjs/components/ImagesRoot.js.map +1 -0
  33. package/lib/commonjs/components/InsightsBar.js +59 -0
  34. package/lib/commonjs/components/InsightsBar.js.map +1 -0
  35. package/lib/commonjs/export.js +81 -0
  36. package/lib/commonjs/export.js.map +1 -0
  37. package/lib/commonjs/format.js +117 -0
  38. package/lib/commonjs/format.js.map +1 -0
  39. package/lib/commonjs/hooks/useImageRecords.js +20 -0
  40. package/lib/commonjs/hooks/useImageRecords.js.map +1 -0
  41. package/lib/commonjs/index.js +236 -0
  42. package/lib/commonjs/index.js.map +1 -0
  43. package/lib/commonjs/package.json +1 -0
  44. package/lib/commonjs/preset.js +45 -0
  45. package/lib/commonjs/preset.js.map +1 -0
  46. package/lib/commonjs/register.js +19 -0
  47. package/lib/commonjs/register.js.map +1 -0
  48. package/lib/commonjs/state.js +54 -0
  49. package/lib/commonjs/state.js.map +1 -0
  50. package/lib/commonjs/store/imageEventStore.js +160 -0
  51. package/lib/commonjs/store/imageEventStore.js.map +1 -0
  52. package/lib/commonjs/store/insights.js +76 -0
  53. package/lib/commonjs/store/insights.js.map +1 -0
  54. package/lib/commonjs/sync/imagesSyncAdapter.js +315 -0
  55. package/lib/commonjs/sync/imagesSyncAdapter.js.map +1 -0
  56. package/lib/commonjs/types.js +2 -0
  57. package/lib/commonjs/types.js.map +1 -0
  58. package/lib/module/capture/actions.js +214 -0
  59. package/lib/module/capture/actions.js.map +1 -0
  60. package/lib/module/capture/install.js +36 -0
  61. package/lib/module/capture/install.js.map +1 -0
  62. package/lib/module/capture/installExpoImage.js +94 -0
  63. package/lib/module/capture/installExpoImage.js.map +1 -0
  64. package/lib/module/capture/installRnImage.js +122 -0
  65. package/lib/module/capture/installRnImage.js.map +1 -0
  66. package/lib/module/capture/overrides.js +269 -0
  67. package/lib/module/capture/overrides.js.map +1 -0
  68. package/lib/module/capture/savings.js +189 -0
  69. package/lib/module/capture/savings.js.map +1 -0
  70. package/lib/module/capture/shared.js +359 -0
  71. package/lib/module/capture/shared.js.map +1 -0
  72. package/lib/module/components/ImageDetail.js +440 -0
  73. package/lib/module/components/ImageDetail.js.map +1 -0
  74. package/lib/module/components/ImageDetailFooter.js +228 -0
  75. package/lib/module/components/ImageDetailFooter.js.map +1 -0
  76. package/lib/module/components/ImageRow.js +160 -0
  77. package/lib/module/components/ImageRow.js.map +1 -0
  78. package/lib/module/components/ImagesHeader.js +59 -0
  79. package/lib/module/components/ImagesHeader.js.map +1 -0
  80. package/lib/module/components/ImagesIcon.js +55 -0
  81. package/lib/module/components/ImagesIcon.js.map +1 -0
  82. package/lib/module/components/ImagesListFooter.js +190 -0
  83. package/lib/module/components/ImagesListFooter.js.map +1 -0
  84. package/lib/module/components/ImagesModal.js +169 -0
  85. package/lib/module/components/ImagesModal.js.map +1 -0
  86. package/lib/module/components/ImagesRoot.js +20 -0
  87. package/lib/module/components/ImagesRoot.js.map +1 -0
  88. package/lib/module/components/InsightsBar.js +55 -0
  89. package/lib/module/components/InsightsBar.js.map +1 -0
  90. package/lib/module/export.js +76 -0
  91. package/lib/module/export.js.map +1 -0
  92. package/lib/module/format.js +108 -0
  93. package/lib/module/format.js.map +1 -0
  94. package/lib/module/hooks/useImageRecords.js +16 -0
  95. package/lib/module/hooks/useImageRecords.js.map +1 -0
  96. package/lib/module/index.js +73 -0
  97. package/lib/module/index.js.map +1 -0
  98. package/lib/module/preset.js +40 -0
  99. package/lib/module/preset.js.map +1 -0
  100. package/lib/module/register.js +19 -0
  101. package/lib/module/register.js.map +1 -0
  102. package/lib/module/state.js +50 -0
  103. package/lib/module/state.js.map +1 -0
  104. package/lib/module/store/imageEventStore.js +146 -0
  105. package/lib/module/store/imageEventStore.js.map +1 -0
  106. package/lib/module/store/insights.js +71 -0
  107. package/lib/module/store/insights.js.map +1 -0
  108. package/lib/module/sync/imagesSyncAdapter.js +311 -0
  109. package/lib/module/sync/imagesSyncAdapter.js.map +1 -0
  110. package/lib/module/types.js +2 -0
  111. package/lib/module/types.js.map +1 -0
  112. package/lib/typescript/capture/actions.d.ts +49 -0
  113. package/lib/typescript/capture/actions.d.ts.map +1 -0
  114. package/lib/typescript/capture/install.d.ts +15 -0
  115. package/lib/typescript/capture/install.d.ts.map +1 -0
  116. package/lib/typescript/capture/installExpoImage.d.ts +23 -0
  117. package/lib/typescript/capture/installExpoImage.d.ts.map +1 -0
  118. package/lib/typescript/capture/installRnImage.d.ts +24 -0
  119. package/lib/typescript/capture/installRnImage.d.ts.map +1 -0
  120. package/lib/typescript/capture/overrides.d.ts +83 -0
  121. package/lib/typescript/capture/overrides.d.ts.map +1 -0
  122. package/lib/typescript/capture/savings.d.ts +37 -0
  123. package/lib/typescript/capture/savings.d.ts.map +1 -0
  124. package/lib/typescript/capture/shared.d.ts +61 -0
  125. package/lib/typescript/capture/shared.d.ts.map +1 -0
  126. package/lib/typescript/components/ImageDetail.d.ts +13 -0
  127. package/lib/typescript/components/ImageDetail.d.ts.map +1 -0
  128. package/lib/typescript/components/ImageDetailFooter.d.ts +19 -0
  129. package/lib/typescript/components/ImageDetailFooter.d.ts.map +1 -0
  130. package/lib/typescript/components/ImageRow.d.ts +15 -0
  131. package/lib/typescript/components/ImageRow.d.ts.map +1 -0
  132. package/lib/typescript/components/ImagesHeader.d.ts +25 -0
  133. package/lib/typescript/components/ImagesHeader.d.ts.map +1 -0
  134. package/lib/typescript/components/ImagesIcon.d.ts +13 -0
  135. package/lib/typescript/components/ImagesIcon.d.ts.map +1 -0
  136. package/lib/typescript/components/ImagesListFooter.d.ts +8 -0
  137. package/lib/typescript/components/ImagesListFooter.d.ts.map +1 -0
  138. package/lib/typescript/components/ImagesModal.d.ts +17 -0
  139. package/lib/typescript/components/ImagesModal.d.ts.map +1 -0
  140. package/lib/typescript/components/ImagesRoot.d.ts +11 -0
  141. package/lib/typescript/components/ImagesRoot.d.ts.map +1 -0
  142. package/lib/typescript/components/InsightsBar.d.ts +13 -0
  143. package/lib/typescript/components/InsightsBar.d.ts.map +1 -0
  144. package/lib/typescript/export.d.ts +12 -0
  145. package/lib/typescript/export.d.ts.map +1 -0
  146. package/lib/typescript/format.d.ts +26 -0
  147. package/lib/typescript/format.d.ts.map +1 -0
  148. package/lib/typescript/hooks/useImageRecords.d.ts +11 -0
  149. package/lib/typescript/hooks/useImageRecords.d.ts.map +1 -0
  150. package/lib/typescript/index.d.ts +33 -0
  151. package/lib/typescript/index.d.ts.map +1 -0
  152. package/lib/typescript/preset.d.ts +38 -0
  153. package/lib/typescript/preset.d.ts.map +1 -0
  154. package/lib/typescript/register.d.ts +15 -0
  155. package/lib/typescript/register.d.ts.map +1 -0
  156. package/lib/typescript/state.d.ts +54 -0
  157. package/lib/typescript/state.d.ts.map +1 -0
  158. package/lib/typescript/store/imageEventStore.d.ts +34 -0
  159. package/lib/typescript/store/imageEventStore.d.ts.map +1 -0
  160. package/lib/typescript/store/insights.d.ts +11 -0
  161. package/lib/typescript/store/insights.d.ts.map +1 -0
  162. package/lib/typescript/sync/imagesSyncAdapter.d.ts +205 -0
  163. package/lib/typescript/sync/imagesSyncAdapter.d.ts.map +1 -0
  164. package/lib/typescript/types.d.ts +121 -0
  165. package/lib/typescript/types.d.ts.map +1 -0
  166. package/package.json +67 -0
  167. package/register.d.ts +1 -0
  168. package/register.js +15 -0
  169. package/src/capture/actions.ts +206 -0
  170. package/src/capture/install.ts +36 -0
  171. package/src/capture/installExpoImage.ts +115 -0
  172. package/src/capture/installRnImage.tsx +133 -0
  173. package/src/capture/overrides.ts +282 -0
  174. package/src/capture/savings.ts +193 -0
  175. package/src/capture/shared.ts +387 -0
  176. package/src/components/ImageDetail.tsx +456 -0
  177. package/src/components/ImageDetailFooter.tsx +270 -0
  178. package/src/components/ImageRow.tsx +148 -0
  179. package/src/components/ImagesHeader.tsx +77 -0
  180. package/src/components/ImagesIcon.tsx +66 -0
  181. package/src/components/ImagesListFooter.tsx +193 -0
  182. package/src/components/ImagesModal.tsx +195 -0
  183. package/src/components/ImagesRoot.tsx +18 -0
  184. package/src/components/InsightsBar.tsx +51 -0
  185. package/src/export.ts +100 -0
  186. package/src/format.ts +85 -0
  187. package/src/hooks/useImageRecords.ts +24 -0
  188. package/src/index.tsx +108 -0
  189. package/src/preset.tsx +35 -0
  190. package/src/register.ts +17 -0
  191. package/src/state.ts +88 -0
  192. package/src/store/imageEventStore.ts +162 -0
  193. package/src/store/insights.ts +66 -0
  194. package/src/sync/imagesSyncAdapter.ts +261 -0
  195. package/src/types.ts +111 -0
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * installImageCapture — idempotent entry point for the capture layer.
5
+ *
6
+ * IMPORTANT (timing): the RN-core decorator only takes effect if this runs
7
+ * before anything evaluates the `Image` module from 'react-native'. The
8
+ * recommended integration is `import "@buoy-gg/images/register"` as the FIRST
9
+ * import of the app entry file. The expo-image patch has no such constraint.
10
+ *
11
+ * Idempotency is keyed on the globalThis singleton, so even if this package
12
+ * gets evaluated as two module instances, capture installs exactly once.
13
+ */
14
+
15
+ import { imagesState } from "../state";
16
+ import { installExpoImageInterceptor, expoCaptureStatus } from "./installExpoImage";
17
+ import { installRnImageInterceptor, rnCaptureStatus } from "./installRnImage";
18
+ export function installImageCapture() {
19
+ const s = imagesState();
20
+ if (s.captureInstalled) return;
21
+ s.captureInstalled = true;
22
+ installRnImageInterceptor();
23
+ installExpoImageInterceptor();
24
+ }
25
+ export function getCaptureStatus() {
26
+ const rn = rnCaptureStatus();
27
+ const expo = expoCaptureStatus();
28
+ return {
29
+ installed: imagesState().captureInstalled,
30
+ rnDecoratorActive: rn.decoratorActive,
31
+ rnDecoratorTooLate: rn.tooLate,
32
+ expoPatched: expo.patched,
33
+ expoAvailable: expo.available
34
+ };
35
+ }
36
+ //# sourceMappingURL=install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["imagesState","installExpoImageInterceptor","expoCaptureStatus","installRnImageInterceptor","rnCaptureStatus","installImageCapture","s","captureInstalled","getCaptureStatus","rn","expo","installed","rnDecoratorActive","decoratorActive","rnDecoratorTooLate","tooLate","expoPatched","patched","expoAvailable","available"],"sourceRoot":"../../../src","sources":["capture/install.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,UAAU;AACtC,SAASC,2BAA2B,EAAEC,iBAAiB,QAAQ,oBAAoB;AACnF,SAASC,yBAAyB,EAAEC,eAAe,QAAQ,kBAAkB;AAG7E,OAAO,SAASC,mBAAmBA,CAAA,EAAS;EAC1C,MAAMC,CAAC,GAAGN,WAAW,CAAC,CAAC;EACvB,IAAIM,CAAC,CAACC,gBAAgB,EAAE;EACxBD,CAAC,CAACC,gBAAgB,GAAG,IAAI;EACzBJ,yBAAyB,CAAC,CAAC;EAC3BF,2BAA2B,CAAC,CAAC;AAC/B;AAEA,OAAO,SAASO,gBAAgBA,CAAA,EAAkB;EAChD,MAAMC,EAAE,GAAGL,eAAe,CAAC,CAAC;EAC5B,MAAMM,IAAI,GAAGR,iBAAiB,CAAC,CAAC;EAChC,OAAO;IACLS,SAAS,EAAEX,WAAW,CAAC,CAAC,CAACO,gBAAgB;IACzCK,iBAAiB,EAAEH,EAAE,CAACI,eAAe;IACrCC,kBAAkB,EAAEL,EAAE,CAACM,OAAO;IAC9BC,WAAW,EAAEN,IAAI,CAACO,OAAO;IACzBC,aAAa,EAAER,IAAI,CAACS;EACtB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * expo-image interception via class-prototype patch.
5
+ *
6
+ * expo-image's <Image> is a class component (React.PureComponent) whose
7
+ * render() reads `this.props`, so wrapping the prototype's render and swapping
8
+ * `this.props` for an instrumented copy for the duration of the original
9
+ * render is timing-immune (prototype methods are looked up dynamically — no
10
+ * import-order race like the RN core decorator). Props are restored in
11
+ * `finally`, so PureComponent's shouldComponentUpdate still compares the
12
+ * app's real props.
13
+ *
14
+ * Double-patch safety: install flags live on the globalThis singleton AND a
15
+ * marker is stamped on the prototype itself, so even two module instances of
16
+ * this package can't wrap render() twice.
17
+ *
18
+ * expo-image is an optional peer: if it isn't installed, this is a no-op.
19
+ */
20
+
21
+ import { imagesState } from "../state";
22
+ import { registerExpoInstance } from "./actions";
23
+ import { applyOverrides } from "./overrides";
24
+ import { ImageInstanceTracker, isInternalImage } from "./shared";
25
+ const PATCH_MARKER = "__buoyImagesPatched";
26
+ const trackers = new WeakMap();
27
+ function trackerFor(instance) {
28
+ let tracker = trackers.get(instance);
29
+ if (!tracker) {
30
+ tracker = new ImageInstanceTracker("expo");
31
+ trackers.set(instance, tracker);
32
+ }
33
+ return tracker;
34
+ }
35
+ export function installExpoImageInterceptor() {
36
+ const s = imagesState();
37
+ if (s.expoInstalled) return;
38
+ s.expoInstalled = true;
39
+ let ImageClass;
40
+ try {
41
+ ImageClass = require("expo-image").Image;
42
+ } catch {
43
+ s.expoAvailable = false;
44
+ return; // expo-image not installed in this app
45
+ }
46
+ if (!ImageClass?.prototype?.render) {
47
+ s.expoAvailable = false;
48
+ return;
49
+ }
50
+ s.expoAvailable = true;
51
+ const proto = ImageClass.prototype;
52
+ if (proto[PATCH_MARKER]) {
53
+ s.expoPatched = true;
54
+ return; // already patched by another module instance of this package
55
+ }
56
+ proto[PATCH_MARKER] = true;
57
+ const originalRender = proto.render;
58
+ const originalUnmount = proto.componentWillUnmount;
59
+ proto.render = function buoyImagesRender() {
60
+ const originalProps = this.props;
61
+ if (isInternalImage(originalProps?.testID)) {
62
+ return originalRender.call(this);
63
+ }
64
+ const tracker = trackerFor(this);
65
+ tracker.syncSource(originalProps?.source);
66
+ tracker.noteA11y(Boolean(originalProps?.alt ?? originalProps?.accessibilityLabel));
67
+ // Keep the action layer pointed at the live instance (reloadAsync etc.).
68
+ registerExpoInstance(tracker.getRecordId(), this);
69
+ const wrapped = tracker.handlers(originalProps);
70
+ try {
71
+ // Simulation layer: global modes + per-record override + locate-flash.
72
+ this.props = applyOverrides({
73
+ ...originalProps,
74
+ ...wrapped
75
+ }, tracker.getRecordId(), "expo");
76
+ return originalRender.call(this);
77
+ } finally {
78
+ this.props = originalProps;
79
+ }
80
+ };
81
+ proto.componentWillUnmount = function buoyImagesUnmount() {
82
+ trackers.get(this)?.unmount();
83
+ originalUnmount?.call(this);
84
+ };
85
+ s.expoPatched = true;
86
+ }
87
+ export function expoCaptureStatus() {
88
+ const s = imagesState();
89
+ return {
90
+ available: s.expoAvailable,
91
+ patched: s.expoPatched
92
+ };
93
+ }
94
+ //# sourceMappingURL=installExpoImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["imagesState","registerExpoInstance","applyOverrides","ImageInstanceTracker","isInternalImage","PATCH_MARKER","trackers","WeakMap","trackerFor","instance","tracker","get","set","installExpoImageInterceptor","s","expoInstalled","ImageClass","require","Image","expoAvailable","prototype","render","proto","expoPatched","originalRender","originalUnmount","componentWillUnmount","buoyImagesRender","originalProps","props","testID","call","syncSource","source","noteA11y","Boolean","alt","accessibilityLabel","getRecordId","wrapped","handlers","buoyImagesUnmount","unmount","expoCaptureStatus","available","patched"],"sourceRoot":"../../../src","sources":["capture/installExpoImage.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,UAAU;AACtC,SAASC,oBAAoB,QAAQ,WAAW;AAChD,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,oBAAoB,EAAEC,eAAe,QAAQ,UAAU;AAOhE,MAAMC,YAAY,GAAG,qBAAqB;AAE1C,MAAMC,QAAQ,GAAG,IAAIC,OAAO,CAA+B,CAAC;AAE5D,SAASC,UAAUA,CAACC,QAAgB,EAAwB;EAC1D,IAAIC,OAAO,GAAGJ,QAAQ,CAACK,GAAG,CAACF,QAAQ,CAAC;EACpC,IAAI,CAACC,OAAO,EAAE;IACZA,OAAO,GAAG,IAAIP,oBAAoB,CAAC,MAAM,CAAC;IAC1CG,QAAQ,CAACM,GAAG,CAACH,QAAQ,EAAEC,OAAO,CAAC;EACjC;EACA,OAAOA,OAAO;AAChB;A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WAAW,CAAC,CAAC,EAAE,IAAI,CAAC;IACjD,MAAMC,OAAO,GAAG7B,OAAO,CAAC8B,QAAQ,CAACZ,aAAiC,CAAC;IACnE,IAAI;MACF;MACA,IAAI,CAACC,KAAK,GAAG3B,cAAc,CACzB;QAAE,GAAG0B,aAAa;QAAE,GAAGW;MAAQ,CAAC,EAChC7B,OAAO,CAAC4B,WAAW,CAAC,CAAC,EACrB,MACF,CAAC;MACD,OAAOd,cAAc,CAACO,IAAI,CAAC,IAAI,CAAC;IAClC,CAAC,SAAS;MACR,IAAI,CAACF,KAAK,GAAGD,aAAa;IAC5B;EACF,CAAC;EAEDN,KAAK,CAACI,oBAAoB,GAAG,SAASe,iBAAiBA,CAAA,EAA0B;IAC/EnC,QAAQ,CAACK,GAAG,CAAC,IAAI,CAAC,EAAE+B,OAAO,CAAC,CAAC;IAC7BjB,eAAe,EAAEM,IAAI,CAAC,IAAI,CAAC;EAC7B,CAAC;EAEDjB,CAAC,CAACS,WAAW,GAAG,IAAI;AACtB;AAEA,OAAO,SAASoB,iBAAiBA,CAAA,EAA6C;EAC5E,MAAM7B,CAAC,GAAGd,WAAW,CAAC,CAAC;EACvB,OAAO;IAAE4C,SAAS,EAAE9B,CAAC,CAACK,aAAa;IAAE0B,OAAO,EAAE/B,CAAC,CAACS;EAAY,CAAC;AAC/D","ignoreList":[]}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * RN core <Image> interception via the official injection hook.
5
+ *
6
+ * `unstable_setImageComponentDecorator` wraps EVERY RN <Image> app-wide — but
7
+ * the decorator is latched ONCE, at Image module evaluation
8
+ * (`Image.ios.js` / `Image.android.js` read it at module scope). So install
9
+ * order matters: this must run before anything touches `Image` from
10
+ * 'react-native' — hence the `@buoy-gg/images/register` first-import.
11
+ *
12
+ * Detection strategy: the decorator sets `decoratorInvoked` when RN's Image
13
+ * module applies it. `unstable_registerImageAttachedCallback` is a live Set
14
+ * (never latched), so image mounts are always visible — if mounts happen but
15
+ * the decorator never ran, we were too late and CaptureStatus reports it.
16
+ *
17
+ * All flags live on the globalThis singleton (../state.ts) so a second module
18
+ * instance of this package neither re-installs nor reports a stale status.
19
+ */
20
+
21
+ import * as React from "react";
22
+ import { imagesState } from "../state";
23
+ import { getReloadNonce, getReloadRequest, subscribeActions } from "./actions";
24
+ import { applyOverrides, getRenderVersion, patchSourceCache } from "./overrides";
25
+ import { ImageInstanceTracker, isInternalImage } from "./shared";
26
+ import { jsx as _jsx } from "react/jsx-runtime";
27
+ /** Wraps one RN Image render with capture instrumentation + reload actions. */
28
+ function useImageCapture(props) {
29
+ const trackerRef = React.useRef(null);
30
+ if (trackerRef.current == null) {
31
+ trackerRef.current = new ImageInstanceTracker("rn");
32
+ }
33
+ const tracker = trackerRef.current;
34
+ const internal = isInternalImage(props.testID);
35
+ if (!internal) {
36
+ tracker.syncSource(props.source);
37
+ tracker.noteA11y(Boolean(props.alt ?? props.accessibilityLabel ?? props["aria-label"]));
38
+ }
39
+
40
+ // Action/override bus: version bumps re-render just this instance (snapshot
41
+ // is per-record with a global floor, so unrelated actions don't invalidate
42
+ // other images but global-mode toggles reach everyone).
43
+ React.useSyncExternalStore(subscribeActions, () => getRenderVersion(internal ? null : tracker.getRecordId()));
44
+ React.useEffect(() => {
45
+ if (internal) return undefined;
46
+ return () => tracker.unmount();
47
+ }, [tracker, internal]);
48
+ if (internal) return {
49
+ props,
50
+ reloadKey: 0
51
+ };
52
+ const recordId = tracker.getRecordId();
53
+ const wrapped = tracker.handlers(props);
54
+ const out = {
55
+ ...props,
56
+ ...wrapped
57
+ };
58
+
59
+ // While a bust request is pending (cleared when the load settles), refetch
60
+ // bypassing caches — VERIFIED both platforms honor source.cache: 'reload'.
61
+ const request = getReloadRequest(recordId);
62
+ if (request?.bust) {
63
+ out.source = patchSourceCache(out.source, "reload");
64
+ }
65
+ // Simulation layer: global modes + per-record override + locate-flash.
66
+ applyOverrides(out, recordId, "rn");
67
+ return {
68
+ props: out,
69
+ reloadKey: getReloadNonce(recordId)
70
+ };
71
+ }
72
+ export function installRnImageInterceptor() {
73
+ const s = imagesState();
74
+ if (s.rnInstalled) return;
75
+ s.rnInstalled = true;
76
+ try {
77
+ // Deep import: evaluates ONLY the injection module, never Image itself.
78
+ const injection = require("react-native/Libraries/Image/ImageInjection");
79
+ const setDecorator = injection.unstable_setImageComponentDecorator;
80
+ const registerAttached = injection.unstable_registerImageAttachedCallback;
81
+ if (typeof setDecorator === "function") {
82
+ setDecorator(BaseImage => {
83
+ imagesState().decoratorInvoked = true;
84
+ const CapturedImage = /*#__PURE__*/React.forwardRef(function BuoyCapturedImage(props, ref) {
85
+ const {
86
+ props: instrumented,
87
+ reloadKey
88
+ } = useImageCapture(props);
89
+ // key bump forces a native remount → fresh load cycle (retry).
90
+ return /*#__PURE__*/_jsx(BaseImage, {
91
+ ...instrumented,
92
+ ref: ref
93
+ }, `buoy-r${reloadKey}`);
94
+ });
95
+ return CapturedImage;
96
+ });
97
+ s.decoratorRegistered = true;
98
+ }
99
+
100
+ // Live mount signal — works regardless of decorator timing. Used purely
101
+ // to detect the "decorator registered too late" condition.
102
+ if (typeof registerAttached === "function") {
103
+ registerAttached(() => {
104
+ imagesState().attachSeen++;
105
+ });
106
+ }
107
+ } catch {
108
+ // Internal RN path moved (version drift) or non-RN platform — expo-image
109
+ // capture still works; status will report the decorator as inactive.
110
+ s.decoratorRegistered = false;
111
+ }
112
+ }
113
+ export function rnCaptureStatus() {
114
+ const s = imagesState();
115
+ return {
116
+ decoratorRegistered: s.decoratorRegistered,
117
+ decoratorActive: s.decoratorInvoked,
118
+ // Mounts observed but our wrapper never rendered → Image latched first.
119
+ tooLate: s.decoratorRegistered && !s.decoratorInvoked && s.attachSeen > 0
120
+ };
121
+ }
122
+ //# sourceMappingURL=installRnImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","imagesState","getReloadNonce","getReloadRequest","subscribeActions","applyOverrides","getRenderVersion","patchSourceCache","ImageInstanceTracker","isInternalImage","jsx","_jsx","useImageCapture","props","trackerRef","useRef","current","tracker","internal","testID","syncSource","source","noteA11y","Boolean","alt","accessibilityLabel","useSyncExternalStore","getRecordId","useEffect","undefined","unmount","reloadKey","recordId","wrapped","handlers","out","request","bust","installRnImageInterceptor","s","rnInstalled","injection","require","setDecorator","unstable_setImageComponentDecorator","registerAttached","unstable_registerImageAttachedCallback","BaseImage","decoratorInvoked","CapturedImage","forwardRef","BuoyCapturedImage","ref","instrumented","decoratorRegistered","attachSeen","rnCaptureStatus","decoratorActive","tooLate"],"sourceRoot":"../../../src","sources":["capture/installRnImage.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,WAAW,QAAQ,UAAU;AACtC,SACEC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,QACX,WAAW;AAClB,SAASC,cAAc,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAQ,aAAa;AAChF,SAASC,oBAAoB,EAAEC,eAAe,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGjE;AACA,SAASC,eAAeA,CAACC,KAA8B,EAGrD;EACA,MAAMC,UAAU,GAAGd,KAAK,CAACe,MAAM,CAA8B,IAAI,CAAC;EAClE,IAAID,UAAU,CAACE,OAAO,IAAI,IAAI,EAAE;IAC9BF,UAAU,CAACE,OAAO,GAAG,IAAIR,oBAAoB,CAAC,IAAI,CAAC;EACrD;EACA,MAAMS,OAAO,GAAGH,UAAU,CAACE,OAAO;EAElC,MAAME,QAAQ,GAAGT,eAAe,CAACI,KAAK,CAACM,MAAM,CAAC;EAC9C,IAAI,CAACD,QAAQ,EAAE;IACbD,OAAO,CAACG,UAAU,CAACP,KAAK,CAACQ,MAAM,CAAC;IAChCJ,OAAO,CAACK,QAAQ,CACdC,OAAO,CAACV,KAAK,CAACW,GAAG,IAAIX,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C,CAACgB,UAAU,GAAG;EAC1E,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,269 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Simulation overrides — the "we own the props" tier of actions.
5
+ *
6
+ * Because the RN decorator and the expo-image render patch control every
7
+ * mounted image's props, anything the component accepts is a simulation:
8
+ * forced errors (instant, offline-safe file:// source), forced loading
9
+ * (blackhole-IP source that never resolves), URL swaps, blanking, style
10
+ * merges (locate-flash border), and app-wide modes (offline images /
11
+ * cold-start / blank images).
12
+ *
13
+ * Re-render plumbing: every mutation bumps a per-record or global version.
14
+ * RN wrappers subscribe via useSyncExternalStore with a per-record snapshot
15
+ * (only the touched image re-renders); expo class instances are re-rendered
16
+ * directly via forceUpdate() from the per-record instance registry.
17
+ */
18
+
19
+ import { imagesState } from "../state";
20
+ import { getRecord, getSnapshot, updateRecord } from "../store/imageEventStore";
21
+
22
+ // ---------------------------------------------------------------------------
23
+ // Override model
24
+ // ---------------------------------------------------------------------------
25
+
26
+ const FORCED_ERROR_URI = "file:///buoy-images-forced-error.png";
27
+ const HANG_URI = "https://10.255.255.1/buoy-images-hang.png";
28
+ /** Offline mode replaces network sources with this (fails immediately). */
29
+ const OFFLINE_URI = "file:///buoy-images-offline-no-network.png";
30
+ const FLASH_STYLE = {
31
+ borderWidth: 3,
32
+ borderColor: "#FF453A"
33
+ };
34
+ /**
35
+ * RN core has NO safe "empty source": undefined resolves to the app bundle
36
+ * path and [] does too on RN 0.85 — both fire a bogus onError ("The file …
37
+ * couldn't be opened", observed live). So RN images blank via opacity
38
+ * instead (visual-only; the decoded image stays resident). expo-image
39
+ * supports a true `source={null}` and keeps showing its placeholder.
40
+ */
41
+ const RN_BLANK_STYLE = {
42
+ opacity: 0
43
+ };
44
+ // ---------------------------------------------------------------------------
45
+ // Version bus (re-render triggers)
46
+ // ---------------------------------------------------------------------------
47
+
48
+ function emit() {
49
+ for (const l of imagesState().actionListeners) l();
50
+ }
51
+ function forceUpdateExpo(recordId) {
52
+ const s = imagesState();
53
+ if (recordId != null) {
54
+ const instance = s.expoInstances.get(recordId);
55
+ instance?.forceUpdate?.();
56
+ return;
57
+ }
58
+ for (const instance of s.expoInstances.values()) {
59
+ instance?.forceUpdate?.();
60
+ }
61
+ }
62
+
63
+ /** Bump one record's render version (re-renders just that image). */
64
+ export function touchRecord(recordId) {
65
+ const s = imagesState();
66
+ s.recordVersions.set(recordId, ++s.versionCounter);
67
+ emit();
68
+ forceUpdateExpo(recordId);
69
+ }
70
+
71
+ /** Bump the global render version (re-renders every wrapped image). */
72
+ export function touchGlobal() {
73
+ const s = imagesState();
74
+ s.globalVersion = ++s.versionCounter;
75
+ emit();
76
+ forceUpdateExpo();
77
+ }
78
+
79
+ /** Snapshot for the RN wrapper's useSyncExternalStore. */
80
+ export function getRenderVersion(recordId) {
81
+ const s = imagesState();
82
+ const record = recordId != null ? s.recordVersions.get(recordId) ?? 0 : 0;
83
+ return Math.max(record, s.globalVersion);
84
+ }
85
+
86
+ // ---------------------------------------------------------------------------
87
+ // Per-record overrides
88
+ // ---------------------------------------------------------------------------
89
+
90
+ export function setOverride(recordId, override) {
91
+ imagesState().overrides.set(recordId, override);
92
+ updateRecord(recordId, {
93
+ overrideLabel: override.label
94
+ });
95
+ touchRecord(recordId);
96
+ }
97
+ export function clearOverride(recordId) {
98
+ imagesState().overrides.delete(recordId);
99
+ updateRecord(recordId, {
100
+ overrideLabel: undefined
101
+ });
102
+ touchRecord(recordId);
103
+ }
104
+ export function getOverride(recordId) {
105
+ if (recordId == null) return undefined;
106
+ return imagesState().overrides.get(recordId);
107
+ }
108
+
109
+ // ---------------------------------------------------------------------------
110
+ // Mass actions (every mounted image at once)
111
+ // ---------------------------------------------------------------------------
112
+
113
+ /** Apply one override to every mounted record. Returns how many were hit. */
114
+ export function setOverrideForAllMounted(source, label) {
115
+ let count = 0;
116
+ for (const record of getSnapshot()) {
117
+ if (!record.mounted) continue;
118
+ setOverride(record.id, {
119
+ source,
120
+ label
121
+ });
122
+ count++;
123
+ }
124
+ return count;
125
+ }
126
+
127
+ /** Remove every active override. Returns how many were cleared. */
128
+ export function clearAllOverrides() {
129
+ const ids = [...imagesState().overrides.keys()];
130
+ for (const id of ids) clearOverride(id);
131
+ return ids.length;
132
+ }
133
+
134
+ /** Flash every mounted image (locate everything the tool tracks). */
135
+ export function flashAllMounted(durationMs = 2500) {
136
+ let count = 0;
137
+ for (const record of getSnapshot()) {
138
+ if (!record.mounted) continue;
139
+ flashRecord(record.id, durationMs);
140
+ count++;
141
+ }
142
+ return count;
143
+ }
144
+
145
+ /** Flash a border on the on-screen image so it can be located visually. */
146
+ export function flashRecord(recordId, durationMs = 2500) {
147
+ const s = imagesState();
148
+ s.flashUntil.set(recordId, Date.now() + durationMs);
149
+ touchRecord(recordId);
150
+ setTimeout(() => {
151
+ imagesState().flashUntil.delete(recordId);
152
+ touchRecord(recordId);
153
+ }, durationMs + 50);
154
+ }
155
+
156
+ // ---------------------------------------------------------------------------
157
+ // Global simulation modes
158
+ // ---------------------------------------------------------------------------
159
+
160
+ /**
161
+ * offline — every NETWORK image load fails immediately (both libs, cache or
162
+ * not); bundled/local assets still load, like a real offline device showing
163
+ * shipped images. Blunt on purpose: toggle + reload = images visibly gone.
164
+ * (The subtler `only-if-cached` variant was correct-but-confusing, and its
165
+ * uncached requests HANG on iOS instead of erroring — bad for QA.)
166
+ * cold — every image bypasses caches (RN `cache:'reload'`, expo
167
+ * `cachePolicy:'none'`): first-launch behavior without clearing anything.
168
+ */
169
+ export function setNetworkMode(mode) {
170
+ imagesState().globalModes.network = mode;
171
+ touchGlobal();
172
+ }
173
+
174
+ /** Chrome-style "disable images": render every image without a source. */
175
+ export function setBlankImages(enabled) {
176
+ imagesState().globalModes.blank = enabled;
177
+ touchGlobal();
178
+ }
179
+ export function getGlobalModes() {
180
+ return imagesState().globalModes;
181
+ }
182
+
183
+ // ---------------------------------------------------------------------------
184
+ // Application (called from the RN wrapper + expo render patch)
185
+ // ---------------------------------------------------------------------------
186
+
187
+ /** Inject a `cache` policy into an RN source (object or array shape). */
188
+ export function patchSourceCache(source, cache) {
189
+ if (Array.isArray(source)) {
190
+ return source.map(entry => entry && typeof entry === "object" && typeof entry.uri === "string" ? {
191
+ ...entry,
192
+ cache
193
+ } : entry);
194
+ }
195
+ if (source && typeof source === "object" && typeof source.uri === "string") {
196
+ return {
197
+ ...source,
198
+ cache
199
+ };
200
+ }
201
+ return source; // numeric assets etc. — nothing to patch
202
+ }
203
+ function resolveOverrideSource(source, lib) {
204
+ switch (source.type) {
205
+ case "url":
206
+ return {
207
+ uri: source.uri
208
+ };
209
+ case "error":
210
+ return {
211
+ uri: FORCED_ERROR_URI
212
+ };
213
+ case "hang":
214
+ return {
215
+ uri: HANG_URI
216
+ };
217
+ case "blank":
218
+ // Only reached for expo — RN blanking is style-based (see RN_BLANK_STYLE).
219
+ return null;
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Merge global modes + per-record override + locate-flash into an
225
+ * already-copied props object. Mutates and returns `out`.
226
+ */
227
+ export function applyOverrides(out, recordId, lib) {
228
+ const s = imagesState();
229
+ const modes = s.globalModes;
230
+ if (modes.network === "offline") {
231
+ // Hard offline: network sources fail outright (both libs); bundled/local
232
+ // assets keep loading like a real offline device.
233
+ const record = recordId != null ? getRecord(recordId) : undefined;
234
+ if (record?.sourceKind === "network") {
235
+ out.source = {
236
+ uri: OFFLINE_URI
237
+ };
238
+ }
239
+ } else if (modes.network === "cold") {
240
+ if (lib === "rn") {
241
+ out.source = patchSourceCache(out.source, "reload");
242
+ } else {
243
+ out.cachePolicy = "none";
244
+ }
245
+ }
246
+ if (modes.blank) {
247
+ if (lib === "expo") out.source = null;else out.style = [out.style, RN_BLANK_STYLE];
248
+ }
249
+ const override = getOverride(recordId);
250
+ if (override) {
251
+ if (override.source) {
252
+ if (override.source.type === "blank" && lib === "rn") {
253
+ out.style = [out.style, RN_BLANK_STYLE];
254
+ } else {
255
+ out.source = resolveOverrideSource(override.source, lib);
256
+ }
257
+ }
258
+ if (override.extraProps) Object.assign(out, override.extraProps);
259
+ if (override.style) out.style = [out.style, override.style];
260
+ }
261
+ if (recordId != null) {
262
+ const until = s.flashUntil.get(recordId);
263
+ if (until != null && until > Date.now()) {
264
+ out.style = [out.style, FLASH_STYLE];
265
+ }
266
+ }
267
+ return out;
268
+ }
269
+ //# sourceMappingURL=overrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["imagesState","getRecord","getSnapshot","updateRecord","FORCED_ERROR_URI","HANG_URI","OFFLINE_URI","FLASH_STYLE","borderWidth","borderColor","RN_BLANK_STYLE","opacity","emit","l","actionListeners","forceUpdateExpo","recordId","s","instance","expoInstances","get","forceUpdate","values","touchRecord","recordVersions","set","versionCounter","touchGlobal","globalVersion","getRenderVersion","record","Math","max","setOverride","override","overrides","overrideLabel","label","clearOverride","delete","undefined","getOverride","setOverrideForAllMounted","source","count","mounted","id","clearAllOverrides","ids","keys","length","flashAllMounted","durationMs","flashRecord","flashUntil","Date","now","setTimeout","setNetworkMode","mode","globalModes","network","setBlankImages","enabled","blank","getGlobalModes","patchSourceCache","cache","Array","isArray","map","entry","uri","resolveOverrideSource","lib","type","applyOverrides","out","modes","sourceKind","cachePolicy","style","extraProps","Object","assign","until"],"sourceRoot":"../../../src","sources":["capture/overrides.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,UAAU;AACtC,SAASC,SAAS,EAAEC,WAAW,EAAEC,YAAY,QAAQ,0BAA0B;;AAG/E;AACA;AACA;;AAqBA,MAAMC,gBAAgB,GAAG,sCAAsC;AAC/D,MAAMC,QAAQ,GAAG,2CAA2C;AAC5D;AACA,MAAMC,WAAW,GAAG,4CAA4C;AAChE,MAAMC,WAAW,GAAG;EAAEC,WAAW,EAAE,CAAC;EAAEC,WAAW,EAAE;AAAU,CAAU;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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